@unicom-cloud/ui 0.8.167 → 0.8.169

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 (2653) hide show
  1. package/.virtual/_rolldown/runtime.js +1 -1
  2. package/affix/Affix.d.ts +1 -3
  3. package/affix/Affix.js +67 -64
  4. package/affix/constants.js +2 -0
  5. package/affix/context.d.ts +3 -0
  6. package/affix/context.js +7 -0
  7. package/affix/index.d.ts +4 -3
  8. package/affix/index.js +9 -4
  9. package/affix/interface.d.ts +2 -2
  10. package/affix/style/index.css +1 -0
  11. package/affix/style/index.d.ts +1 -0
  12. package/affix/style/index.js +3 -0
  13. package/alert/Alert.js +58 -57
  14. package/alert/constants.js +2 -0
  15. package/alert/context.d.ts +3 -0
  16. package/alert/context.js +10 -0
  17. package/alert/index.d.ts +3 -0
  18. package/alert/index.js +9 -4
  19. package/alert/style/index.css +1 -0
  20. package/alert/style/index.d.ts +1 -0
  21. package/alert/style/index.js +3 -0
  22. package/anchor/Anchor.js +48 -55
  23. package/anchor/Link.js +2 -2
  24. package/anchor/constants.js +2 -0
  25. package/anchor/context.d.ts +3 -2
  26. package/anchor/context.js +12 -3
  27. package/anchor/index.d.ts +4 -1
  28. package/anchor/index.js +10 -7
  29. package/anchor/style/index.css +1 -0
  30. package/anchor/style/index.d.ts +2 -0
  31. package/anchor/style/index.js +4 -0
  32. package/anchor/utils.js +1 -1
  33. package/animation/Animation.js +18 -14
  34. package/animation/constants.js +2 -0
  35. package/animation/context.d.ts +3 -0
  36. package/animation/context.js +7 -0
  37. package/animation/index.d.ts +2 -0
  38. package/animation/index.js +10 -5
  39. package/animation/style/index.d.ts +1 -0
  40. package/animation/style/index.js +3 -0
  41. package/app/App.js +25 -27
  42. package/app/constants.js +2 -0
  43. package/app/context.d.ts +4 -3
  44. package/app/context.js +5 -4
  45. package/app/index.d.ts +2 -1
  46. package/app/index.js +9 -7
  47. package/app/style/index.css +1 -0
  48. package/app/style/index.d.ts +1 -0
  49. package/app/style/index.js +3 -0
  50. package/app/useApp.js +2 -2
  51. package/auto-complete/AutoComplete.js +58 -54
  52. package/auto-complete/constants.d.ts +0 -0
  53. package/auto-complete/constants.js +2 -0
  54. package/auto-complete/context.d.ts +3 -0
  55. package/auto-complete/context.js +7 -0
  56. package/auto-complete/index.d.ts +2 -0
  57. package/auto-complete/index.js +9 -6
  58. package/auto-complete/style/index.css +1 -0
  59. package/auto-complete/style/index.d.ts +3 -0
  60. package/auto-complete/style/index.js +5 -0
  61. package/avatar/Avatar.d.ts +1 -3
  62. package/avatar/Avatar.js +49 -53
  63. package/avatar/Group.js +3 -3
  64. package/avatar/constants.d.ts +0 -0
  65. package/avatar/constants.js +2 -0
  66. package/avatar/context.d.ts +3 -2
  67. package/avatar/context.js +7 -3
  68. package/avatar/index.d.ts +4 -4
  69. package/avatar/index.js +9 -7
  70. package/avatar/interface.d.ts +2 -2
  71. package/avatar/style/index.css +1 -0
  72. package/avatar/style/index.d.ts +2 -0
  73. package/avatar/style/index.js +4 -0
  74. package/back-top/BackTop.d.ts +1 -3
  75. package/back-top/BackTop.js +44 -44
  76. package/back-top/constants.d.ts +0 -0
  77. package/back-top/constants.js +2 -0
  78. package/back-top/context.d.ts +3 -0
  79. package/back-top/context.js +11 -0
  80. package/back-top/index.d.ts +3 -3
  81. package/back-top/index.js +9 -4
  82. package/back-top/interface.d.ts +2 -2
  83. package/back-top/style/index.css +1 -0
  84. package/back-top/style/index.d.ts +1 -0
  85. package/back-top/style/index.js +3 -0
  86. package/badge/Badge.js +84 -85
  87. package/badge/Count.js +2 -2
  88. package/badge/constants.d.ts +0 -0
  89. package/badge/constants.js +2 -0
  90. package/badge/context.d.ts +3 -0
  91. package/badge/context.js +11 -0
  92. package/badge/index.d.ts +2 -0
  93. package/badge/index.js +10 -7
  94. package/badge/style/index.css +1 -0
  95. package/badge/style/index.d.ts +1 -0
  96. package/badge/style/index.js +3 -0
  97. package/badge/utils.js +1 -1
  98. package/border-beam/BorderBeam.js +20 -17
  99. package/border-beam/constants.d.ts +0 -0
  100. package/border-beam/constants.js +2 -0
  101. package/border-beam/context.d.ts +3 -0
  102. package/border-beam/context.js +7 -0
  103. package/border-beam/index.d.ts +2 -0
  104. package/border-beam/index.js +12 -7
  105. package/border-beam/style/index.css +1 -0
  106. package/border-beam/style/index.d.ts +1 -0
  107. package/border-beam/style/index.js +3 -0
  108. package/breadcrumb/Breadcrumb.js +46 -44
  109. package/breadcrumb/Item.js +6 -6
  110. package/breadcrumb/constants.d.ts +0 -0
  111. package/breadcrumb/constants.js +2 -0
  112. package/breadcrumb/context.d.ts +2 -0
  113. package/breadcrumb/context.js +5 -4
  114. package/breadcrumb/index.d.ts +2 -0
  115. package/breadcrumb/index.js +9 -7
  116. package/breadcrumb/style/index.css +1 -0
  117. package/breadcrumb/style/index.d.ts +2 -0
  118. package/breadcrumb/style/index.js +4 -0
  119. package/button/Button.js +48 -49
  120. package/button/Group.js +1 -1
  121. package/button/Toggle.js +1 -1
  122. package/button/constants.d.ts +0 -0
  123. package/button/constants.js +2 -0
  124. package/button/context.d.ts +9 -0
  125. package/button/context.js +11 -0
  126. package/button/index.d.ts +8 -0
  127. package/button/index.js +11 -8
  128. package/button/style/index.css +1 -0
  129. package/button/style/index.d.ts +1 -0
  130. package/button/style/index.js +3 -0
  131. package/calendar/Calendar.js +92 -95
  132. package/calendar/Month.js +4 -4
  133. package/calendar/WeekList.js +1 -1
  134. package/calendar/Year.js +2 -2
  135. package/calendar/constants.d.ts +0 -0
  136. package/calendar/constants.js +2 -0
  137. package/calendar/context.d.ts +3 -0
  138. package/calendar/context.js +13 -0
  139. package/calendar/header/Panel.js +1 -1
  140. package/calendar/header/index.js +3 -3
  141. package/calendar/hooks/useCellClassName.js +34 -0
  142. package/calendar/index.d.ts +2 -0
  143. package/calendar/index.js +11 -8
  144. package/calendar/style/index.css +1 -0
  145. package/calendar/style/index.d.ts +3 -0
  146. package/calendar/style/index.js +5 -0
  147. package/card/Card.js +48 -48
  148. package/card/Grid.js +1 -1
  149. package/card/Meta.js +1 -1
  150. package/card/constants.d.ts +0 -0
  151. package/card/constants.js +2 -0
  152. package/card/context.d.ts +3 -0
  153. package/card/context.js +10 -0
  154. package/card/index.d.ts +2 -0
  155. package/card/index.js +7 -4
  156. package/card/style/index.css +1 -0
  157. package/card/style/index.d.ts +2 -0
  158. package/card/style/index.js +4 -0
  159. package/carousel/Arrow.js +1 -1
  160. package/carousel/Carousel.js +82 -87
  161. package/carousel/Indicator.js +1 -1
  162. package/carousel/constants.d.ts +0 -0
  163. package/carousel/constants.js +2 -0
  164. package/carousel/context.d.ts +3 -0
  165. package/carousel/context.js +16 -0
  166. package/carousel/index.d.ts +2 -0
  167. package/carousel/index.js +9 -4
  168. package/carousel/style/index.css +1 -0
  169. package/carousel/style/index.d.ts +1 -0
  170. package/carousel/style/index.js +3 -0
  171. package/cascader/Cascader.js +151 -155
  172. package/cascader/base/node.js +2 -2
  173. package/cascader/base/store.js +1 -1
  174. package/cascader/constants.d.ts +7 -0
  175. package/cascader/constants.js +13 -0
  176. package/cascader/context.d.ts +3 -0
  177. package/cascader/context.js +17 -0
  178. package/cascader/hooks/useRefCurrent.js +14 -0
  179. package/cascader/index.d.ts +2 -0
  180. package/cascader/index.js +9 -4
  181. package/cascader/panel/List.js +28 -28
  182. package/cascader/panel/Option.js +2 -2
  183. package/cascader/panel/Search.js +16 -16
  184. package/cascader/style/index.css +1 -0
  185. package/cascader/style/index.d.ts +5 -0
  186. package/cascader/style/index.js +7 -0
  187. package/cascader/utils.d.ts +0 -7
  188. package/cascader/utils.js +25 -32
  189. package/checkbox/Checkbox.js +17 -14
  190. package/checkbox/Group.js +4 -4
  191. package/checkbox/GroupBlock.js +3 -3
  192. package/checkbox/constants.d.ts +0 -0
  193. package/checkbox/constants.js +2 -0
  194. package/checkbox/context.d.ts +3 -0
  195. package/checkbox/context.js +3 -3
  196. package/checkbox/index.d.ts +2 -0
  197. package/checkbox/index.js +13 -11
  198. package/checkbox/style/index.css +1 -0
  199. package/checkbox/style/index.d.ts +1 -0
  200. package/checkbox/style/index.js +3 -0
  201. package/checkbox/useCheckbox.js +1 -1
  202. package/collapse/Collapse.js +45 -47
  203. package/collapse/Item.js +2 -2
  204. package/collapse/constants.d.ts +0 -0
  205. package/collapse/constants.js +2 -0
  206. package/collapse/context.d.ts +2 -0
  207. package/collapse/context.js +8 -3
  208. package/collapse/index.d.ts +2 -0
  209. package/collapse/index.js +9 -7
  210. package/collapse/style/index.css +1 -0
  211. package/collapse/style/index.d.ts +1 -0
  212. package/collapse/style/index.js +3 -0
  213. package/collapse/utils.js +1 -1
  214. package/color-picker/ColorPicker.js +79 -80
  215. package/color-picker/ControlBar.js +1 -1
  216. package/color-picker/InputAlpha.js +1 -1
  217. package/color-picker/InputHex.js +1 -1
  218. package/color-picker/InputRgb.js +1 -1
  219. package/color-picker/Mode.js +1 -1
  220. package/color-picker/Palette.js +1 -1
  221. package/color-picker/Panel.js +74 -74
  222. package/color-picker/colors.js +1 -1
  223. package/color-picker/constants.d.ts +0 -0
  224. package/color-picker/constants.js +2 -0
  225. package/color-picker/context.d.ts +3 -0
  226. package/color-picker/context.js +11 -0
  227. package/color-picker/hooks/useColorPicker.d.ts +1 -1
  228. package/color-picker/hooks/useColorPicker.js +1 -1
  229. package/color-picker/hooks/useControlBlock.js +1 -1
  230. package/color-picker/index.d.ts +2 -0
  231. package/color-picker/index.js +19 -16
  232. package/color-picker/interface.js +1 -1
  233. package/color-picker/style/index.css +1 -0
  234. package/color-picker/style/index.d.ts +3 -0
  235. package/color-picker/style/index.js +5 -0
  236. package/color-picker/utils.d.ts +1 -1
  237. package/color-picker/utils.js +1 -1
  238. package/comment/Comment.js +52 -48
  239. package/comment/constants.d.ts +0 -0
  240. package/comment/constants.js +2 -0
  241. package/comment/context.d.ts +3 -0
  242. package/comment/context.js +7 -0
  243. package/comment/index.d.ts +2 -0
  244. package/comment/index.js +9 -4
  245. package/comment/style/index.css +1 -0
  246. package/comment/style/index.d.ts +1 -0
  247. package/comment/style/index.js +3 -0
  248. package/config-provider/ConfigProvider.js +11 -11
  249. package/config-provider/constants.d.ts +0 -0
  250. package/config-provider/constants.js +2 -0
  251. package/config-provider/context.d.ts +21 -0
  252. package/config-provider/context.js +4 -4
  253. package/config-provider/index.d.ts +1 -0
  254. package/config-provider/index.js +2 -1
  255. package/config-provider/initUI.js +1 -1
  256. package/config-provider/interface.d.ts +6 -0
  257. package/config-provider/style/index.d.ts +1 -0
  258. package/config-provider/style/index.js +3 -0
  259. package/config-provider/useConfigProvider.js +2 -2
  260. package/config-provider/utils.js +2 -2
  261. package/constants/index.d.ts +2 -0
  262. package/constants/index.js +6 -0
  263. package/copy/Copy.d.ts +1 -1
  264. package/copy/Copy.js +37 -35
  265. package/copy/constants.d.ts +0 -0
  266. package/copy/constants.js +2 -0
  267. package/copy/context.d.ts +3 -0
  268. package/copy/context.js +7 -0
  269. package/copy/index.d.ts +2 -0
  270. package/copy/index.js +9 -4
  271. package/copy/style/index.css +1 -0
  272. package/copy/style/index.d.ts +2 -0
  273. package/copy/style/index.js +4 -0
  274. package/countdown/Countdown.js +43 -42
  275. package/countdown/constants.d.ts +0 -0
  276. package/countdown/constants.js +2 -0
  277. package/countdown/context.d.ts +3 -0
  278. package/countdown/context.js +10 -0
  279. package/countdown/index.d.ts +2 -0
  280. package/countdown/index.js +9 -4
  281. package/countdown/style/index.css +1 -0
  282. package/countdown/style/index.d.ts +2 -0
  283. package/countdown/style/index.js +4 -0
  284. package/countdown/utils.js +1 -1
  285. package/date-picker/DatePicker.d.ts +6 -5
  286. package/date-picker/DatePicker.js +5 -5
  287. package/date-picker/Picker.js +208 -211
  288. package/date-picker/Range.d.ts +3 -0
  289. package/date-picker/Range.js +404 -0
  290. package/date-picker/constants.d.ts +0 -0
  291. package/date-picker/constants.js +2 -0
  292. package/date-picker/context.d.ts +4 -2
  293. package/date-picker/context.js +9 -3
  294. package/date-picker/hooks/useCellClassName.js +53 -0
  295. package/date-picker/index.d.ts +4 -2
  296. package/date-picker/index.js +13 -18
  297. package/date-picker/panel/Body.js +2 -2
  298. package/date-picker/panel/Footer.js +4 -4
  299. package/date-picker/panel/Header.js +2 -2
  300. package/date-picker/panel/Shortcut.d.ts +1 -1
  301. package/date-picker/panel/Shortcut.js +2 -2
  302. package/date-picker/panel/WeekList.js +1 -1
  303. package/date-picker/panel/date/index.js +3 -3
  304. package/date-picker/panel/month/index.js +2 -2
  305. package/date-picker/panel/quarter/index.js +2 -2
  306. package/date-picker/panel/range/index.js +2 -2
  307. package/date-picker/panel/week/index.js +2 -2
  308. package/date-picker/panel/year/index.js +3 -3
  309. package/date-picker/style/index.css +1 -0
  310. package/date-picker/style/index.d.ts +6 -0
  311. package/date-picker/style/index.js +8 -0
  312. package/date-picker/utils.js +2 -2
  313. package/descriptions/Descriptions.js +83 -83
  314. package/descriptions/constants.d.ts +0 -0
  315. package/descriptions/constants.js +2 -0
  316. package/descriptions/context.d.ts +3 -0
  317. package/descriptions/context.js +11 -0
  318. package/descriptions/index.d.ts +2 -0
  319. package/descriptions/index.js +9 -4
  320. package/descriptions/style/index.css +1 -0
  321. package/descriptions/style/index.d.ts +1 -0
  322. package/descriptions/style/index.js +3 -0
  323. package/details/Details.js +57 -54
  324. package/details/constants.d.ts +0 -0
  325. package/details/constants.js +2 -0
  326. package/details/context.d.ts +3 -0
  327. package/details/context.js +7 -0
  328. package/details/index.d.ts +2 -0
  329. package/details/index.js +9 -4
  330. package/details/style/index.css +1 -0
  331. package/details/style/index.d.ts +1 -0
  332. package/details/style/index.js +3 -0
  333. package/development/Development.js +25 -20
  334. package/development/constants.d.ts +0 -0
  335. package/development/constants.js +2 -0
  336. package/development/context.d.ts +3 -0
  337. package/development/context.js +7 -0
  338. package/development/index.d.ts +2 -0
  339. package/development/index.js +9 -4
  340. package/development/style/index.css +1 -0
  341. package/development/style/index.d.ts +1 -0
  342. package/development/style/index.js +3 -0
  343. package/divider/Divider.js +34 -34
  344. package/divider/constants.d.ts +0 -0
  345. package/divider/constants.js +2 -0
  346. package/divider/context.d.ts +3 -0
  347. package/divider/context.js +10 -0
  348. package/divider/index.d.ts +2 -0
  349. package/divider/index.js +8 -5
  350. package/divider/style/index.css +1 -0
  351. package/divider/style/index.d.ts +1 -0
  352. package/divider/style/index.js +3 -0
  353. package/draggable/Draggable.js +27 -22
  354. package/draggable/Item.js +1 -1
  355. package/draggable/constants.d.ts +0 -0
  356. package/draggable/constants.js +2 -0
  357. package/draggable/context.d.ts +3 -0
  358. package/draggable/context.js +7 -0
  359. package/draggable/index.d.ts +2 -0
  360. package/draggable/index.js +9 -6
  361. package/draggable/style/index.css +1 -0
  362. package/draggable/style/index.d.ts +1 -0
  363. package/draggable/style/index.js +3 -0
  364. package/draw/Draw.d.ts +3 -1
  365. package/draw/Draw.js +102 -31
  366. package/draw/LICENSE +20 -0
  367. package/draw/common/binary-heap.d.ts +12 -0
  368. package/draw/common/binary-heap.js +52 -0
  369. package/draw/common/bounds.d.ts +10 -0
  370. package/draw/common/bounds.js +3 -0
  371. package/draw/common/colors.d.ts +21 -0
  372. package/draw/common/colors.js +109 -0
  373. package/draw/common/constants.d.ts +345 -0
  374. package/draw/common/constants.js +218 -0
  375. package/draw/common/editorInterface.d.ts +34 -0
  376. package/draw/common/editorInterface.js +39 -0
  377. package/draw/common/emitter.d.ts +16 -0
  378. package/draw/common/emitter.js +31 -0
  379. package/draw/common/font-metadata.d.ts +43 -0
  380. package/draw/common/font-metadata.js +94 -0
  381. package/draw/common/index.d.ts +14 -0
  382. package/draw/common/index.js +16 -0
  383. package/draw/common/keys.d.ts +187 -0
  384. package/draw/common/keys.js +87 -0
  385. package/draw/common/points.d.ts +9 -0
  386. package/draw/common/points.js +22 -0
  387. package/draw/common/promise-pool.d.ts +5 -0
  388. package/draw/common/promise-pool.js +24 -0
  389. package/draw/common/queue.d.ts +7 -0
  390. package/draw/common/queue.js +25 -0
  391. package/draw/common/random.d.ts +3 -0
  392. package/draw/common/random.js +9 -0
  393. package/draw/common/url.d.ts +7 -0
  394. package/draw/common/url.js +16 -0
  395. package/draw/common/utility-types.d.ts +37 -0
  396. package/draw/common/utils.d.ts +281 -0
  397. package/draw/common/utils.js +227 -0
  398. package/draw/constants.d.ts +1 -0
  399. package/draw/constants.js +6 -0
  400. package/draw/context.d.ts +3 -0
  401. package/draw/context.js +7 -0
  402. package/draw/core/actions/actionAddToLibrary.d.ts +467 -0
  403. package/draw/core/actions/actionAddToLibrary.js +50 -0
  404. package/draw/core/actions/actionAlign.d.ts +109 -0
  405. package/draw/core/actions/actionAlign.js +159 -0
  406. package/draw/core/actions/actionBoundText.d.ts +348 -0
  407. package/draw/core/actions/actionBoundText.js +160 -0
  408. package/draw/core/actions/actionCanvas.d.ts +2147 -0
  409. package/draw/core/actions/actionCanvas.js +332 -0
  410. package/draw/core/actions/actionClipboard.d.ts +387 -0
  411. package/draw/core/actions/actionClipboard.js +197 -0
  412. package/draw/core/actions/actionCropEditor.d.ts +168 -0
  413. package/draw/core/actions/actionCropEditor.js +48 -0
  414. package/draw/core/actions/actionDeleteSelected.d.ts +503 -0
  415. package/draw/core/actions/actionDeleteSelected.js +144 -0
  416. package/draw/core/actions/actionDistribute.d.ts +34 -0
  417. package/draw/core/actions/actionDistribute.js +68 -0
  418. package/draw/core/actions/actionDuplicateSelection.d.ts +17 -0
  419. package/draw/core/actions/actionDuplicateSelection.js +78 -0
  420. package/draw/core/actions/actionElementLink.d.ts +192 -0
  421. package/draw/core/actions/actionElementLink.js +79 -0
  422. package/draw/core/actions/actionElementLock.d.ts +335 -0
  423. package/draw/core/actions/actionElementLock.js +103 -0
  424. package/draw/core/actions/actionEmbeddable.d.ts +165 -0
  425. package/draw/core/actions/actionEmbeddable.js +29 -0
  426. package/draw/core/actions/actionExport.d.ts +341 -0
  427. package/draw/core/actions/actionExport.js +232 -0
  428. package/draw/core/actions/actionFinalize.d.ts +13 -0
  429. package/draw/core/actions/actionFinalize.js +143 -0
  430. package/draw/core/actions/actionFlip.d.ts +34 -0
  431. package/draw/core/actions/actionFlip.js +82 -0
  432. package/draw/core/actions/actionFrame.d.ts +1127 -0
  433. package/draw/core/actions/actionFrame.js +138 -0
  434. package/draw/core/actions/actionGroup.d.ts +338 -0
  435. package/draw/core/actions/actionGroup.js +130 -0
  436. package/draw/core/actions/actionHistory.d.ts +9 -0
  437. package/draw/core/actions/actionHistory.js +44 -0
  438. package/draw/core/actions/actionLinearEditor.d.ts +664 -0
  439. package/draw/core/actions/actionLinearEditor.js +104 -0
  440. package/draw/core/actions/actionMenu.d.ts +160 -0
  441. package/draw/core/actions/actionMenu.js +32 -0
  442. package/draw/core/actions/actionProperties.d.ts +384 -0
  443. package/draw/core/actions/actionProperties.js +792 -0
  444. package/draw/core/actions/actionSelectAll.d.ts +165 -0
  445. package/draw/core/actions/actionSelectAll.js +39 -0
  446. package/draw/core/actions/actionStyles.d.ts +183 -0
  447. package/draw/core/actions/actionStyles.js +93 -0
  448. package/draw/core/actions/actionTextAutoResize.d.ts +17 -0
  449. package/draw/core/actions/actionTextAutoResize.js +44 -0
  450. package/draw/core/actions/actionToggleGridMode.d.ts +171 -0
  451. package/draw/core/actions/actionToggleGridMode.js +37 -0
  452. package/draw/core/actions/actionToggleObjectsSnapMode.d.ts +169 -0
  453. package/draw/core/actions/actionToggleObjectsSnapMode.js +34 -0
  454. package/draw/core/actions/actionToggleSearchMenu.d.ts +164 -0
  455. package/draw/core/actions/actionToggleSearchMenu.js +45 -0
  456. package/draw/core/actions/actionToggleShapeSwitch.d.ts +19 -0
  457. package/draw/core/actions/actionToggleStats.d.ts +168 -0
  458. package/draw/core/actions/actionToggleStats.js +37 -0
  459. package/draw/core/actions/actionToggleViewMode.d.ts +169 -0
  460. package/draw/core/actions/actionToggleViewMode.js +34 -0
  461. package/draw/core/actions/actionToggleZenMode.d.ts +169 -0
  462. package/draw/core/actions/actionToggleZenMode.js +34 -0
  463. package/draw/core/actions/actionZindex.d.ts +74 -0
  464. package/draw/core/actions/actionZindex.js +107 -0
  465. package/draw/core/actions/index.d.ts +26 -0
  466. package/draw/core/actions/index.js +28 -0
  467. package/draw/core/actions/manager.d.ts +21 -0
  468. package/draw/core/actions/manager.js +64 -0
  469. package/draw/core/actions/register.d.ts +5 -0
  470. package/draw/core/actions/register.js +6 -0
  471. package/draw/core/actions/shortcuts.d.ts +4 -0
  472. package/draw/core/actions/shortcuts.js +58 -0
  473. package/draw/core/actions/types.d.ts +47 -0
  474. package/draw/core/analytics.d.ts +1 -0
  475. package/draw/core/analytics.js +19 -0
  476. package/draw/core/animated-trail.d.ts +32 -0
  477. package/draw/core/animated-trail.js +83 -0
  478. package/draw/core/animation-frame-handler.d.ts +11 -0
  479. package/draw/core/animation-frame-handler.js +51 -0
  480. package/draw/core/appState.d.ts +101 -0
  481. package/draw/core/appState.js +569 -0
  482. package/draw/core/charts.d.ts +27 -0
  483. package/draw/core/charts.js +263 -0
  484. package/draw/core/clients.d.ts +14 -0
  485. package/draw/core/clients.js +38 -0
  486. package/draw/core/clipboard.d.ts +107 -0
  487. package/draw/core/clipboard.js +250 -0
  488. package/draw/core/components/Actions.d.ts +28 -0
  489. package/draw/core/components/Actions.js +493 -0
  490. package/draw/core/components/ActiveConfirmDialog.d.ts +4 -0
  491. package/draw/core/components/ActiveConfirmDialog.js +32 -0
  492. package/draw/core/components/App.d.ts +363 -0
  493. package/draw/core/components/App.js +4076 -0
  494. package/draw/core/components/BraveMeasureTextError.d.ts +2 -0
  495. package/draw/core/components/BraveMeasureTextError.js +23 -0
  496. package/draw/core/components/ButtonIconCycle.d.ts +11 -0
  497. package/draw/core/components/ButtonSeparator.d.ts +1 -0
  498. package/draw/core/components/ContextMenu.d.ts +14 -0
  499. package/draw/core/components/ContextMenu.js +59 -0
  500. package/draw/core/components/ConvertElementTypePopup.d.ts +22 -0
  501. package/draw/core/components/ConvertElementTypePopup.js +318 -0
  502. package/draw/core/components/DarkModeToggle.d.ts +6 -0
  503. package/draw/core/components/DarkModeToggle.js +22 -0
  504. package/draw/core/components/DiagramToCodePlugin/index.d.ts +4 -0
  505. package/draw/core/components/DiagramToCodePlugin/index.js +13 -0
  506. package/draw/core/components/ElementCanvasButtons.d.ts +6 -0
  507. package/draw/core/components/ElementCanvasButtons.js +34 -0
  508. package/draw/core/components/ElementLinkDialog.d.ts +11 -0
  509. package/draw/core/components/ElementLinkDialog.js +112 -0
  510. package/draw/core/components/Ellipsify.d.ts +3 -0
  511. package/draw/core/components/Ellipsify.js +16 -0
  512. package/draw/core/components/ErrorDialog.d.ts +5 -0
  513. package/draw/core/components/ErrorDialog.js +36 -0
  514. package/draw/core/components/ExportDialog.d.ts +14 -0
  515. package/draw/core/components/ExportDialog.js +34 -0
  516. package/draw/core/components/EyeDropper.d.ts +25 -0
  517. package/draw/core/components/EyeDropper.js +84 -0
  518. package/draw/core/components/FixedSideContainer.d.ts +8 -0
  519. package/draw/core/components/FixedSideContainer.js +12 -0
  520. package/draw/core/components/Footer.d.ts +13 -0
  521. package/draw/core/components/Footer.js +118 -0
  522. package/draw/core/components/HandButton.d.ts +9 -0
  523. package/draw/core/components/HandButton.js +26 -0
  524. package/draw/core/components/HelpDialog.d.ts +2 -0
  525. package/draw/core/components/HelpDialog.js +407 -0
  526. package/draw/core/components/HintViewer.d.ts +10 -0
  527. package/draw/core/components/HintViewer.js +96 -0
  528. package/draw/core/components/ImageExportDialog.d.ts +14 -0
  529. package/draw/core/components/ImageExportDialog.js +243 -0
  530. package/draw/core/components/InitializeApp.d.ts +10 -0
  531. package/draw/core/components/InitializeApp.js +25 -0
  532. package/draw/core/components/InlineIcon.d.ts +5 -0
  533. package/draw/core/components/InlineIcon.js +19 -0
  534. package/draw/core/components/Island.d.ts +9 -0
  535. package/draw/core/components/Island.js +17 -0
  536. package/draw/core/components/LaserPointerButton.d.ts +9 -0
  537. package/draw/core/components/LaserPointerButton.js +24 -0
  538. package/draw/core/components/LayerUI.d.ts +30 -0
  539. package/draw/core/components/LayerUI.js +373 -0
  540. package/draw/core/components/LibraryMenu.d.ts +9 -0
  541. package/draw/core/components/LibraryMenu.js +133 -0
  542. package/draw/core/components/LibraryMenuItems.d.ts +14 -0
  543. package/draw/core/components/LibraryMenuItems.js +274 -0
  544. package/draw/core/components/LibraryMenuSection.d.ts +23 -0
  545. package/draw/core/components/LibraryMenuSection.js +37 -0
  546. package/draw/core/components/LibraryUnit.d.ts +13 -0
  547. package/draw/core/components/LibraryUnit.js +52 -0
  548. package/draw/core/components/LinkButton.d.ts +4 -0
  549. package/draw/core/components/LoadingMessage.d.ts +5 -0
  550. package/draw/core/components/LoadingMessage.js +32 -0
  551. package/draw/core/components/LockButton.d.ts +9 -0
  552. package/draw/core/components/LockButton.js +25 -0
  553. package/draw/core/components/MagicButton.d.ts +9 -0
  554. package/draw/core/components/MagicButton.js +22 -0
  555. package/draw/core/components/OverwriteConfirm/OverwriteConfirmState.d.ts +22 -0
  556. package/draw/core/components/OverwriteConfirm/OverwriteConfirmState.js +22 -0
  557. package/draw/core/components/OverwriteConfirm/index.d.ts +4 -0
  558. package/draw/core/components/OverwriteConfirm/index.js +94 -0
  559. package/draw/core/components/PasteChartDialog.d.ts +7 -0
  560. package/draw/core/components/PasteChartDialog.js +78 -0
  561. package/draw/core/components/PenModeButton.d.ts +11 -0
  562. package/draw/core/components/PenModeButton.js +23 -0
  563. package/draw/core/components/Popover.d.ts +15 -0
  564. package/draw/core/components/Popover.js +58 -0
  565. package/draw/core/components/ProjectName.d.ts +9 -0
  566. package/draw/core/components/ProjectName.js +39 -0
  567. package/draw/core/components/Range.d.ts +7 -0
  568. package/draw/core/components/Range.js +37 -0
  569. package/draw/core/components/SVGLayer.d.ts +6 -0
  570. package/draw/core/components/SVGLayer.js +19 -0
  571. package/draw/core/components/ScrollableList.d.ts +7 -0
  572. package/draw/core/components/SearchMenu.d.ts +4 -0
  573. package/draw/core/components/SearchMenu.js +381 -0
  574. package/draw/core/components/Stack.d.ts +14 -0
  575. package/draw/core/components/Stack.js +31 -0
  576. package/draw/core/components/Stats/Angle.d.ts +11 -0
  577. package/draw/core/components/Stats/Angle.js +45 -0
  578. package/draw/core/components/Stats/CanvasGrid.d.ts +10 -0
  579. package/draw/core/components/Stats/CanvasGrid.js +25 -0
  580. package/draw/core/components/Stats/Collapsible.d.ts +10 -0
  581. package/draw/core/components/Stats/Collapsible.js +26 -0
  582. package/draw/core/components/Stats/Dimension.d.ts +11 -0
  583. package/draw/core/components/Stats/Dimension.js +106 -0
  584. package/draw/core/components/Stats/DragInput.d.ts +43 -0
  585. package/draw/core/components/Stats/DragInput.js +133 -0
  586. package/draw/core/components/Stats/FontSize.d.ts +11 -0
  587. package/draw/core/components/Stats/FontSize.js +38 -0
  588. package/draw/core/components/Stats/MultiAngle.d.ts +11 -0
  589. package/draw/core/components/Stats/MultiAngle.js +53 -0
  590. package/draw/core/components/Stats/MultiDimension.d.ts +14 -0
  591. package/draw/core/components/Stats/MultiDimension.js +125 -0
  592. package/draw/core/components/Stats/MultiFontSize.d.ts +12 -0
  593. package/draw/core/components/Stats/MultiFontSize.js +51 -0
  594. package/draw/core/components/Stats/MultiPosition.d.ts +14 -0
  595. package/draw/core/components/Stats/MultiPosition.js +73 -0
  596. package/draw/core/components/Stats/Position.d.ts +12 -0
  597. package/draw/core/components/Stats/Position.js +67 -0
  598. package/draw/core/components/Stats/index.d.ts +34 -0
  599. package/draw/core/components/Stats/index.js +263 -0
  600. package/draw/core/components/Stats/utils.d.ts +19 -0
  601. package/draw/core/components/Stats/utils.js +67 -0
  602. package/draw/core/components/Toast.d.ts +6 -0
  603. package/draw/core/components/Toast.js +21 -0
  604. package/draw/core/components/Tooltip.d.ts +7 -0
  605. package/draw/core/components/Trans.d.ts +7 -0
  606. package/draw/core/components/Trans.js +33 -0
  607. package/draw/core/components/UnlockPopup.d.ts +7 -0
  608. package/draw/core/components/UnlockPopup.js +46 -0
  609. package/draw/core/components/canvases/InteractiveCanvas.d.ts +33 -0
  610. package/draw/core/components/canvases/InteractiveCanvas.js +119 -0
  611. package/draw/core/components/canvases/NewElementCanvas.d.ts +14 -0
  612. package/draw/core/components/canvases/NewElementCanvas.js +33 -0
  613. package/draw/core/components/canvases/StaticCanvas.d.ts +19 -0
  614. package/draw/core/components/canvases/StaticCanvas.js +64 -0
  615. package/draw/core/components/canvases/index.d.ts +3 -0
  616. package/draw/core/components/canvases/index.js +4 -0
  617. package/draw/core/components/context.d.ts +29 -0
  618. package/draw/core/components/context.js +43 -0
  619. package/draw/core/components/hoc/withInternalFallback.d.ts +4 -0
  620. package/draw/core/components/hooks.d.ts +23 -0
  621. package/draw/core/components/hooks.js +10 -0
  622. package/draw/core/components/icons.d.ts +62 -0
  623. package/draw/core/components/icons.js +584 -0
  624. package/draw/core/components/main-menu/DefaultItems.d.ts +38 -0
  625. package/draw/core/components/main-menu/DefaultItems.js +145 -0
  626. package/draw/core/components/main-menu/MenuItem.d.ts +24 -0
  627. package/draw/core/components/main-menu/MenuItem.js +55 -0
  628. package/draw/core/components/main-menu/common.d.ts +6 -0
  629. package/draw/core/components/main-menu/common.js +20 -0
  630. package/draw/core/components/shapes.d.ts +190 -0
  631. package/draw/core/components/shapes.js +96 -0
  632. package/draw/core/context/tunnels.d.ts +132 -0
  633. package/draw/core/context/tunnels.js +30 -0
  634. package/draw/core/context/ui-appState.d.ts +4 -0
  635. package/draw/core/context/ui-appState.js +7 -0
  636. package/draw/core/cursor.d.ts +5 -0
  637. package/draw/core/cursor.js +28 -0
  638. package/draw/core/data/EditorLocalStorage.d.ts +8 -0
  639. package/draw/core/data/ai/types.d.ts +242 -0
  640. package/draw/core/data/blob.d.ts +357 -0
  641. package/draw/core/data/blob.js +171 -0
  642. package/draw/core/data/encode.d.ts +55 -0
  643. package/draw/core/data/encode.js +38 -0
  644. package/draw/core/data/encryption.d.ts +9 -0
  645. package/draw/core/data/encryption.js +4 -0
  646. package/draw/core/data/filesystem.d.ts +21 -0
  647. package/draw/core/data/filesystem.js +44 -0
  648. package/draw/core/data/image.d.ts +9 -0
  649. package/draw/core/data/image.js +35 -0
  650. package/draw/core/data/index.d.ts +3 -0
  651. package/draw/core/data/index.js +5 -0
  652. package/draw/core/data/json.d.ts +168 -0
  653. package/draw/core/data/json.js +51 -0
  654. package/draw/core/data/library.d.ts +116 -0
  655. package/draw/core/data/library.js +279 -0
  656. package/draw/core/data/reconcile.d.ts +7 -0
  657. package/draw/core/data/reconcile.js +32 -0
  658. package/draw/core/data/resave.d.ts +5 -0
  659. package/draw/core/data/resave.js +23 -0
  660. package/draw/core/data/restore.d.ts +39 -0
  661. package/draw/core/data/restore.js +331 -0
  662. package/draw/core/data/types.d.ts +48 -0
  663. package/draw/core/data/utils.d.ts +20 -0
  664. package/draw/core/data/utils.js +84 -0
  665. package/draw/core/deburr.d.ts +1 -0
  666. package/draw/core/deburr.js +197 -0
  667. package/draw/core/editor-jotai.d.ts +7 -0
  668. package/draw/core/editor-jotai.js +11 -0
  669. package/draw/core/eraser/index.d.ts +10 -0
  670. package/draw/core/eraser/index.js +109 -0
  671. package/draw/core/errors.d.ts +43 -0
  672. package/draw/core/errors.js +22 -0
  673. package/draw/core/fonts/DrawFontFace.d.ts +8 -0
  674. package/draw/core/fonts/DrawFontFace.js +29 -0
  675. package/draw/core/fonts/Fonts.d.ts +42 -0
  676. package/draw/core/fonts/Fonts.js +100 -0
  677. package/draw/core/fonts/index.d.ts +1 -0
  678. package/draw/core/fonts/index.js +3 -0
  679. package/draw/core/gesture.d.ts +6 -0
  680. package/draw/core/gesture.js +12 -0
  681. package/draw/core/history.d.ts +46 -0
  682. package/draw/core/history.js +90 -0
  683. package/draw/core/hooks/useCallbackRefState.d.ts +1 -0
  684. package/draw/core/hooks/useCopiedIndicator.d.ts +5 -0
  685. package/draw/core/hooks/useCopiedIndicator.js +20 -0
  686. package/draw/core/hooks/useCreatePortalContainer.d.ts +4 -0
  687. package/draw/core/hooks/useCreatePortalContainer.js +28 -0
  688. package/draw/core/hooks/useEmitter.d.ts +2 -0
  689. package/draw/core/hooks/useEmitter.js +17 -0
  690. package/draw/core/hooks/useLibraryItemSvg.d.ts +11 -0
  691. package/draw/core/hooks/useLibraryItemSvg.js +52 -0
  692. package/draw/core/hooks/useOutsideClick.d.ts +21 -0
  693. package/draw/core/hooks/useOutsideClick.js +28 -0
  694. package/draw/core/hooks/useScrollPosition.d.ts +1 -0
  695. package/draw/core/hooks/useScrollPosition.js +23 -0
  696. package/draw/core/hooks/useStable.d.ts +1 -0
  697. package/draw/core/hooks/useStable.js +10 -0
  698. package/draw/core/hooks/useStableCallback.d.ts +4 -0
  699. package/draw/core/hooks/useTextEditorFocus.d.ts +14 -0
  700. package/draw/core/hooks/useTextEditorFocus.js +39 -0
  701. package/draw/core/hooks/useTransition.d.ts +2 -0
  702. package/draw/core/hooks/useTransition.js +10 -0
  703. package/draw/core/i18n.d.ts +24 -0
  704. package/draw/core/i18n.js +40 -0
  705. package/draw/core/laser-trails.d.ts +17 -0
  706. package/draw/core/laser-trails.js +60 -0
  707. package/draw/core/lasso/index.d.ts +11 -0
  708. package/draw/core/lasso/index.js +104 -0
  709. package/draw/core/lasso/utils.d.ts +13 -0
  710. package/draw/core/lasso/utils.js +41 -0
  711. package/draw/core/locales/percentages.json.js +62 -0
  712. package/draw/core/locales/zh-CN.json.js +704 -0
  713. package/draw/core/mermaid.d.ts +1 -0
  714. package/draw/core/polyfill.d.ts +2 -0
  715. package/draw/core/polyfill.js +6 -0
  716. package/draw/core/reactUtils.d.ts +14 -0
  717. package/draw/core/reactUtils.js +24 -0
  718. package/draw/core/renderer/animation.d.ts +10 -0
  719. package/draw/core/renderer/animation.js +43 -0
  720. package/draw/core/renderer/helpers.d.ts +16 -0
  721. package/draw/core/renderer/helpers.js +16 -0
  722. package/draw/core/renderer/interactiveScene.d.ts +14 -0
  723. package/draw/core/renderer/interactiveScene.js +392 -0
  724. package/draw/core/renderer/renderNewElementScene.d.ts +7 -0
  725. package/draw/core/renderer/renderNewElementScene.js +40 -0
  726. package/draw/core/renderer/renderSnaps.d.ts +2 -0
  727. package/draw/core/renderer/renderSnaps.js +39 -0
  728. package/draw/core/renderer/roundRect.d.ts +11 -0
  729. package/draw/core/renderer/roundRect.js +8 -0
  730. package/draw/core/renderer/staticScene.d.ts +14 -0
  731. package/draw/core/renderer/staticScene.js +106 -0
  732. package/draw/core/renderer/staticSvgScene.d.ts +5 -0
  733. package/draw/core/renderer/staticSvgScene.js +200 -0
  734. package/draw/core/scene/Renderer.d.ts +30 -0
  735. package/draw/core/scene/Renderer.js +55 -0
  736. package/draw/core/scene/export.d.ts +35 -0
  737. package/draw/core/scene/export.js +198 -0
  738. package/draw/core/scene/index.d.ts +3 -0
  739. package/draw/core/scene/index.js +7 -0
  740. package/draw/core/scene/normalize.d.ts +4 -0
  741. package/draw/core/scene/normalize.js +10 -0
  742. package/draw/core/scene/scroll.d.ts +18 -0
  743. package/draw/core/scene/scroll.js +52 -0
  744. package/draw/core/scene/scrollbars.d.ts +11 -0
  745. package/draw/core/scene/scrollbars.js +44 -0
  746. package/draw/core/scene/types.d.ts +138 -0
  747. package/draw/core/scene/zoom.d.ts +12 -0
  748. package/draw/core/scene/zoom.js +13 -0
  749. package/draw/core/shortcut.d.ts +1 -0
  750. package/draw/core/shortcut.js +9 -0
  751. package/draw/core/snapping.d.ts +109 -0
  752. package/draw/core/snapping.js +544 -0
  753. package/draw/core/workers.d.ts +28 -0
  754. package/draw/core/wysiwyg/textWysiwyg.d.ts +24 -0
  755. package/draw/core/wysiwyg/textWysiwyg.js +223 -0
  756. package/draw/element/Scene.d.ts +66 -0
  757. package/draw/element/Scene.js +157 -0
  758. package/draw/element/align.d.ts +8 -0
  759. package/draw/element/align.js +36 -0
  760. package/draw/element/arrows/focus.d.ts +27 -0
  761. package/draw/element/arrows/focus.js +142 -0
  762. package/draw/element/arrows/helpers.d.ts +6 -0
  763. package/draw/element/arrows/helpers.js +16 -0
  764. package/draw/element/binding.d.ts +128 -0
  765. package/draw/element/binding.js +550 -0
  766. package/draw/element/bounds.d.ts +79 -0
  767. package/draw/element/bounds.js +492 -0
  768. package/draw/element/collision.d.ts +37 -0
  769. package/draw/element/collision.js +179 -0
  770. package/draw/element/comparisons.d.ts +8 -0
  771. package/draw/element/comparisons.js +6 -0
  772. package/draw/element/containerCache.d.ts +11 -0
  773. package/draw/element/containerCache.js +11 -0
  774. package/draw/element/cropElement.d.ts +19 -0
  775. package/draw/element/cropElement.js +165 -0
  776. package/draw/element/delta.d.ts +166 -0
  777. package/draw/element/delta.js +544 -0
  778. package/draw/element/distance.d.ts +3 -0
  779. package/draw/element/distance.js +41 -0
  780. package/draw/element/distribute.d.ts +8 -0
  781. package/draw/element/distribute.js +53 -0
  782. package/draw/element/dragElements.d.ts +33 -0
  783. package/draw/element/dragElements.js +93 -0
  784. package/draw/element/duplicate.d.ts +63 -0
  785. package/draw/element/duplicate.js +107 -0
  786. package/draw/element/elbowArrow.d.ts +16 -0
  787. package/draw/element/elbowArrow.js +555 -0
  788. package/draw/element/elementLink.d.ts +13 -0
  789. package/draw/element/elementLink.js +50 -0
  790. package/draw/element/embeddable.d.ts +6 -0
  791. package/draw/element/embeddable.js +58 -0
  792. package/draw/element/flowchart.d.ts +22 -0
  793. package/draw/element/flowchart.js +246 -0
  794. package/draw/element/fractionalIndex.d.ts +57 -0
  795. package/draw/element/fractionalIndex.js +102 -0
  796. package/draw/element/frame.d.ts +74 -0
  797. package/draw/element/frame.js +194 -0
  798. package/draw/element/groups.d.ts +34 -0
  799. package/draw/element/groups.js +137 -0
  800. package/draw/element/heading.d.ts +16 -0
  801. package/draw/element/heading.js +38 -0
  802. package/draw/element/image.d.ts +22 -0
  803. package/draw/element/image.js +59 -0
  804. package/draw/element/index.d.ts +58 -0
  805. package/draw/element/index.js +65 -0
  806. package/draw/element/is.d.ts +2 -0
  807. package/draw/element/is.js +6 -0
  808. package/draw/element/linearElementEditor.d.ts +114 -0
  809. package/draw/element/linearElementEditor.js +602 -0
  810. package/draw/element/mutateElement.d.ts +23 -0
  811. package/draw/element/mutateElement.js +68 -0
  812. package/draw/element/newElement.d.ts +62 -0
  813. package/draw/element/newElement.js +165 -0
  814. package/draw/element/positionElementsOnGrid.d.ts +2 -0
  815. package/draw/element/positionElementsOnGrid.js +47 -0
  816. package/draw/element/renderElement.d.ts +25 -0
  817. package/draw/element/renderElement.js +235 -0
  818. package/draw/element/resizeElements.d.ts +32 -0
  819. package/draw/element/resizeElements.js +401 -0
  820. package/draw/element/resizeTest.d.ts +15 -0
  821. package/draw/element/resizeTest.js +93 -0
  822. package/draw/element/selection.d.ts +474 -0
  823. package/draw/element/selection.js +75 -0
  824. package/draw/element/shape.d.ts +41 -0
  825. package/draw/element/shape.js +366 -0
  826. package/draw/element/showSelectedShapeActions.d.ts +3 -0
  827. package/draw/element/showSelectedShapeActions.js +7 -0
  828. package/draw/element/sizeHelpers.d.ts +35 -0
  829. package/draw/element/sizeHelpers.js +74 -0
  830. package/draw/element/sortElements.d.ts +2 -0
  831. package/draw/element/sortElements.js +31 -0
  832. package/draw/element/store.d.ts +196 -0
  833. package/draw/element/store.js +332 -0
  834. package/draw/element/textElement.d.ts +40 -0
  835. package/draw/element/textElement.js +131 -0
  836. package/draw/element/textMeasurements.d.ts +39 -0
  837. package/draw/element/textMeasurements.js +66 -0
  838. package/draw/element/textWrapping.d.ts +13 -0
  839. package/draw/element/textWrapping.js +149 -0
  840. package/draw/element/transform.d.ts +81 -0
  841. package/draw/element/transform.js +288 -0
  842. package/draw/element/transformHandles.d.ts +35 -0
  843. package/draw/element/transformHandles.js +67 -0
  844. package/draw/element/typeChecks.d.ts +54 -0
  845. package/draw/element/typeChecks.js +30 -0
  846. package/draw/element/types.d.ts +291 -0
  847. package/draw/element/utils.d.ts +33 -0
  848. package/draw/element/utils.js +137 -0
  849. package/draw/element/visualdebug.d.ts +58 -0
  850. package/draw/element/zindex.d.ts +13 -0
  851. package/draw/element/zindex.js +149 -0
  852. package/draw/index.d.ts +48 -2
  853. package/draw/index.js +63 -4
  854. package/draw/interface.d.ts +707 -1
  855. package/draw/libs/browser-fs-access/directory-open.d.mts +5 -0
  856. package/draw/libs/browser-fs-access/directory-open.js +12 -0
  857. package/draw/libs/browser-fs-access/file-open.d.mts +5 -0
  858. package/draw/libs/browser-fs-access/file-open.js +12 -0
  859. package/draw/libs/browser-fs-access/file-save.d.mts +5 -0
  860. package/draw/libs/browser-fs-access/file-save.js +12 -0
  861. package/draw/libs/browser-fs-access/fs-access/directory-open.d.mts +8 -0
  862. package/draw/libs/browser-fs-access/fs-access/directory-open.js +25 -0
  863. package/draw/libs/browser-fs-access/fs-access/file-open.d.mts +2 -0
  864. package/draw/libs/browser-fs-access/fs-access/file-open.js +28 -0
  865. package/draw/libs/browser-fs-access/fs-access/file-save.d.mts +2 -0
  866. package/draw/libs/browser-fs-access/fs-access/file-save.js +31 -0
  867. package/draw/libs/browser-fs-access/index.d.ts +10 -0
  868. package/draw/libs/browser-fs-access/index.js +28 -0
  869. package/draw/libs/browser-fs-access/legacy/directory-open.d.mts +8 -0
  870. package/draw/libs/browser-fs-access/legacy/directory-open.js +18 -0
  871. package/draw/libs/browser-fs-access/legacy/file-open.d.mts +2 -0
  872. package/draw/libs/browser-fs-access/legacy/file-open.js +15 -0
  873. package/draw/libs/browser-fs-access/legacy/file-save.d.mts +2 -0
  874. package/draw/libs/browser-fs-access/legacy/file-save.js +31 -0
  875. package/draw/libs/browser-fs-access/supported.d.mts +22 -0
  876. package/draw/libs/browser-fs-access/supported.js +14 -0
  877. package/draw/libs/canvas-roundrect-polyfill/LICENSE +21 -0
  878. package/draw/libs/canvas-roundrect-polyfill/index.d.ts +2 -0
  879. package/draw/libs/canvas-roundrect-polyfill/index.js +74 -0
  880. package/draw/libs/fractional-indexing/index.d.ts +23 -0
  881. package/draw/libs/fractional-indexing/index.js +110 -0
  882. package/draw/libs/fuzzy/index.d.ts +10 -0
  883. package/draw/libs/fuzzy/index.js +40 -0
  884. package/draw/libs/glur/LICENSE +20 -0
  885. package/draw/libs/glur/index.d.ts +2 -0
  886. package/draw/libs/glur/index.js +37 -0
  887. package/draw/libs/glur/mono16.d.ts +2 -0
  888. package/draw/libs/glur/mono16.js +33 -0
  889. package/draw/libs/hachure-fill/index.d.ts +4 -0
  890. package/draw/libs/hachure-fill/index.js +79 -0
  891. package/draw/libs/image-blob-reduce/index.d.ts +36 -0
  892. package/draw/libs/image-blob-reduce/index.js +96 -0
  893. package/draw/libs/image-blob-reduce/lib/image_traverse.d.ts +6 -0
  894. package/draw/libs/image-blob-reduce/lib/image_traverse.js +212 -0
  895. package/draw/libs/image-blob-reduce/lib/jpeg_plugins.d.ts +11 -0
  896. package/draw/libs/image-blob-reduce/lib/jpeg_plugins.js +57 -0
  897. package/draw/libs/image-blob-reduce/lib/utils.d.ts +14 -0
  898. package/draw/libs/image-blob-reduce/lib/utils.js +21 -0
  899. package/draw/libs/jotai/index.d.ts +2 -0
  900. package/draw/libs/jotai/index.js +24 -0
  901. package/draw/libs/jotai/react/Provider.d.ts +16 -0
  902. package/draw/libs/jotai/react/Provider.js +16 -0
  903. package/draw/libs/jotai/react/useAtom.d.ts +13 -0
  904. package/draw/libs/jotai/react/useAtom.js +10 -0
  905. package/draw/libs/jotai/react/useAtomValue.d.ts +9 -0
  906. package/draw/libs/jotai/react/useAtomValue.js +73 -0
  907. package/draw/libs/jotai/react/useSetAtom.d.ts +7 -0
  908. package/draw/libs/jotai/react/useSetAtom.js +11 -0
  909. package/draw/libs/jotai/react/utils/useAtomCallback.d.ts +5 -0
  910. package/draw/libs/jotai/react/utils/useAtomCallback.js +4 -0
  911. package/draw/libs/jotai/react/utils/useHydrateAtoms.d.ts +14 -0
  912. package/draw/libs/jotai/react/utils/useHydrateAtoms.js +16 -0
  913. package/draw/libs/jotai/react/utils/useReducerAtom.d.ts +14 -0
  914. package/draw/libs/jotai/react/utils/useReducerAtom.js +4 -0
  915. package/draw/libs/jotai/react/utils/useResetAtom.d.ts +6 -0
  916. package/draw/libs/jotai/react/utils/useResetAtom.js +5 -0
  917. package/draw/libs/jotai/react/utils.d.ts +4 -0
  918. package/draw/libs/jotai/react/utils.js +6 -0
  919. package/draw/libs/jotai/react.d.ts +4 -0
  920. package/draw/libs/jotai/react.js +6 -0
  921. package/draw/libs/jotai/utils.d.ts +2 -0
  922. package/draw/libs/jotai/utils.js +6 -0
  923. package/draw/libs/jotai/vanilla/atom.d.ts +47 -0
  924. package/draw/libs/jotai/vanilla/atom.js +18 -0
  925. package/draw/libs/jotai/vanilla/internals.d.ts +165 -0
  926. package/draw/libs/jotai/vanilla/internals.js +303 -0
  927. package/draw/libs/jotai/vanilla/store.d.ts +5 -0
  928. package/draw/libs/jotai/vanilla/store.js +17 -0
  929. package/draw/libs/jotai/vanilla/typeUtils.d.ts +7 -0
  930. package/draw/libs/jotai/vanilla/utils/atomFamily.d.ts +55 -0
  931. package/draw/libs/jotai/vanilla/utils/atomFamily.js +3 -0
  932. package/draw/libs/jotai/vanilla/utils/atomWithDefault.d.ts +6 -0
  933. package/draw/libs/jotai/vanilla/utils/atomWithLazy.d.ts +2 -0
  934. package/draw/libs/jotai/vanilla/utils/atomWithObservable.d.ts +32 -0
  935. package/draw/libs/jotai/vanilla/utils/atomWithReducer.d.ts +3 -0
  936. package/draw/libs/jotai/vanilla/utils/atomWithRefresh.d.ts +6 -0
  937. package/draw/libs/jotai/vanilla/utils/atomWithReset.d.ts +8 -0
  938. package/draw/libs/jotai/vanilla/utils/atomWithStorage.d.ts +50 -0
  939. package/draw/libs/jotai/vanilla/utils/atomWithStorage.js +53 -0
  940. package/draw/libs/jotai/vanilla/utils/constants.d.ts +1 -0
  941. package/draw/libs/jotai/vanilla/utils/freezeAtom.d.ts +6 -0
  942. package/draw/libs/jotai/vanilla/utils/loadable.d.ts +33 -0
  943. package/draw/libs/jotai/vanilla/utils/selectAtom.d.ts +2 -0
  944. package/draw/libs/jotai/vanilla/utils/splitAtom.d.ts +16 -0
  945. package/draw/libs/jotai/vanilla/utils/unwrap.d.ts +5 -0
  946. package/draw/libs/jotai/vanilla/utils.d.ts +14 -0
  947. package/draw/libs/jotai/vanilla/utils.js +4 -0
  948. package/draw/libs/jotai/vanilla.d.ts +4 -0
  949. package/draw/libs/jotai-scope/ScopeProvider/index.d.ts +27 -0
  950. package/draw/libs/jotai-scope/ScopeProvider/index.js +47 -0
  951. package/draw/libs/jotai-scope/ScopeProvider/scope.d.ts +16 -0
  952. package/draw/libs/jotai-scope/ScopeProvider/scope.js +264 -0
  953. package/draw/libs/jotai-scope/createIsolation.d.ts +19 -0
  954. package/draw/libs/jotai-scope/createIsolation.js +50 -0
  955. package/draw/libs/jotai-scope/index.d.ts +3 -0
  956. package/draw/libs/jotai-scope/index.js +14 -0
  957. package/draw/libs/jotai-scope/types.d.ts +53 -0
  958. package/draw/libs/jotai-scope/utils.d.ts +6 -0
  959. package/draw/libs/jotai-scope/utils.js +12 -0
  960. package/draw/libs/laser-pointer/index.d.ts +2 -0
  961. package/draw/libs/laser-pointer/index.js +8 -0
  962. package/draw/libs/laser-pointer/math.d.ts +16 -0
  963. package/draw/libs/laser-pointer/math.js +72 -0
  964. package/draw/libs/laser-pointer/simplify.d.ts +2 -0
  965. package/draw/libs/laser-pointer/simplify.js +29 -0
  966. package/draw/libs/laser-pointer/state.d.ts +31 -0
  967. package/draw/libs/laser-pointer/state.js +155 -0
  968. package/draw/libs/markdown-to-text/index.d.ts +20 -0
  969. package/draw/libs/markdown-to-text/index.js +17 -0
  970. package/draw/libs/math/angle.d.ts +19 -0
  971. package/draw/libs/math/angle.js +24 -0
  972. package/draw/libs/math/constants.d.ts +3 -0
  973. package/draw/libs/math/constants.js +56 -0
  974. package/draw/libs/math/curve.d.ts +74 -0
  975. package/draw/libs/math/curve.js +126 -0
  976. package/draw/libs/math/ellipse.d.ts +44 -0
  977. package/draw/libs/math/ellipse.js +44 -0
  978. package/draw/libs/math/index.d.ts +13 -0
  979. package/draw/libs/math/index.js +105 -0
  980. package/draw/libs/math/line.d.ts +17 -0
  981. package/draw/libs/math/line.js +17 -0
  982. package/draw/libs/math/point.d.ts +122 -0
  983. package/draw/libs/math/point.js +48 -0
  984. package/draw/libs/math/polygon.d.ts +6 -0
  985. package/draw/libs/math/polygon.js +42 -0
  986. package/draw/libs/math/range.d.ts +42 -0
  987. package/draw/libs/math/range.js +17 -0
  988. package/draw/libs/math/rectangle.d.ts +5 -0
  989. package/draw/libs/math/rectangle.js +25 -0
  990. package/draw/libs/math/segment.d.ts +40 -0
  991. package/draw/libs/math/segment.js +38 -0
  992. package/draw/libs/math/triangle.d.ts +11 -0
  993. package/draw/libs/math/triangle.js +9 -0
  994. package/draw/libs/math/types.d.ts +106 -0
  995. package/draw/libs/math/utils.d.ts +7 -0
  996. package/draw/libs/math/utils.js +12 -0
  997. package/draw/libs/math/vector.d.ts +94 -0
  998. package/draw/libs/math/vector.js +41 -0
  999. package/draw/libs/multimath/index.d.ts +21 -0
  1000. package/draw/libs/multimath/index.js +66 -0
  1001. package/draw/libs/multimath/lib/base64decode.d.ts +1 -0
  1002. package/draw/libs/multimath/lib/base64decode.js +8 -0
  1003. package/draw/libs/multimath/lib/wa_detect.d.ts +1 -0
  1004. package/draw/libs/multimath/lib/wa_detect.js +68 -0
  1005. package/draw/libs/nanoid/index.d.ts +5 -0
  1006. package/draw/libs/nanoid/index.js +23 -0
  1007. package/draw/libs/nanoid/nanoid.d.ts +1 -0
  1008. package/draw/libs/nanoid/url-alphabet/index.d.ts +1 -0
  1009. package/draw/libs/nanoid/url-alphabet/index.js +6 -0
  1010. package/draw/libs/pako/index.d.ts +323 -0
  1011. package/draw/libs/pako/index.js +1445 -0
  1012. package/draw/libs/path-data-parser/absolutize.d.ts +2 -0
  1013. package/draw/libs/path-data-parser/absolutize.js +140 -0
  1014. package/draw/libs/path-data-parser/index.d.ts +3 -0
  1015. package/draw/libs/path-data-parser/index.js +15 -0
  1016. package/draw/libs/path-data-parser/normalize.d.ts +2 -0
  1017. package/draw/libs/path-data-parser/normalize.js +168 -0
  1018. package/draw/libs/path-data-parser/parser.d.ts +6 -0
  1019. package/draw/libs/path-data-parser/parser.js +90 -0
  1020. package/draw/libs/perfect-freehand/getStroke.d.ts +20 -0
  1021. package/draw/libs/perfect-freehand/getStroke.js +10 -0
  1022. package/draw/libs/perfect-freehand/getStrokeOutlinePoints.d.ts +16 -0
  1023. package/draw/libs/perfect-freehand/getStrokeOutlinePoints.js +73 -0
  1024. package/draw/libs/perfect-freehand/getStrokePoints.d.ts +20 -0
  1025. package/draw/libs/perfect-freehand/getStrokePoints.js +45 -0
  1026. package/draw/libs/perfect-freehand/getStrokeRadius.d.ts +9 -0
  1027. package/draw/libs/perfect-freehand/getStrokeRadius.js +8 -0
  1028. package/draw/libs/perfect-freehand/index.d.ts +6 -0
  1029. package/draw/libs/perfect-freehand/index.js +15 -0
  1030. package/draw/libs/perfect-freehand/types.d.ts +42 -0
  1031. package/draw/libs/perfect-freehand/vec.d.ts +117 -0
  1032. package/draw/libs/perfect-freehand/vec.js +54 -0
  1033. package/draw/libs/pica/index.d.ts +29 -0
  1034. package/draw/libs/pica/index.js +250 -0
  1035. package/draw/libs/pica/lib/mathlib.d.ts +10 -0
  1036. package/draw/libs/pica/lib/mathlib.js +22 -0
  1037. package/draw/libs/pica/lib/mm_resize/convolve.d.ts +11 -0
  1038. package/draw/libs/pica/lib/mm_resize/convolve.js +51 -0
  1039. package/draw/libs/pica/lib/mm_resize/convolve_wasm_base64.d.ts +2 -0
  1040. package/draw/libs/pica/lib/mm_resize/convolve_wasm_base64.js +6 -0
  1041. package/draw/libs/pica/lib/mm_resize/index.d.ts +11 -0
  1042. package/draw/libs/pica/lib/mm_resize/index.js +14 -0
  1043. package/draw/libs/pica/lib/mm_resize/resize.d.ts +1 -0
  1044. package/draw/libs/pica/lib/mm_resize/resize.js +23 -0
  1045. package/draw/libs/pica/lib/mm_resize/resize_filter_gen.d.ts +1 -0
  1046. package/draw/libs/pica/lib/mm_resize/resize_filter_gen.js +24 -0
  1047. package/draw/libs/pica/lib/mm_resize/resize_filter_info.d.ts +45 -0
  1048. package/draw/libs/pica/lib/mm_resize/resize_filter_info.js +58 -0
  1049. package/draw/libs/pica/lib/mm_resize/resize_wasm.d.ts +1 -0
  1050. package/draw/libs/pica/lib/mm_resize/resize_wasm.js +46 -0
  1051. package/draw/libs/pica/lib/mm_unsharp_mask/index.d.ts +10 -0
  1052. package/draw/libs/pica/lib/mm_unsharp_mask/index.js +14 -0
  1053. package/draw/libs/pica/lib/mm_unsharp_mask/unsharp_mask.d.ts +1 -0
  1054. package/draw/libs/pica/lib/mm_unsharp_mask/unsharp_mask.js +19 -0
  1055. package/draw/libs/pica/lib/mm_unsharp_mask/unsharp_mask_wasm.d.ts +1 -0
  1056. package/draw/libs/pica/lib/mm_unsharp_mask/unsharp_mask_wasm.js +14 -0
  1057. package/draw/libs/pica/lib/mm_unsharp_mask/unsharp_mask_wasm_base64.d.ts +2 -0
  1058. package/draw/libs/pica/lib/mm_unsharp_mask/unsharp_mask_wasm_base64.js +6 -0
  1059. package/draw/libs/pica/lib/pool.d.ts +14 -0
  1060. package/draw/libs/pica/lib/pool.js +18 -0
  1061. package/draw/libs/pica/lib/stepper.d.ts +1 -0
  1062. package/draw/libs/pica/lib/stepper.js +15 -0
  1063. package/draw/libs/pica/lib/tiler.d.ts +18 -0
  1064. package/draw/libs/pica/lib/tiler.js +38 -0
  1065. package/draw/libs/pica/lib/utils.d.ts +9 -0
  1066. package/draw/libs/pica/lib/utils.js +91 -0
  1067. package/draw/libs/pica/lib/worker.d.ts +1 -0
  1068. package/draw/libs/pica/lib/worker.js +19 -0
  1069. package/draw/libs/png-chunk-text/decode.d.ts +5 -0
  1070. package/draw/libs/png-chunk-text/decode.js +18 -0
  1071. package/draw/libs/png-chunk-text/encode.d.ts +5 -0
  1072. package/draw/libs/png-chunk-text/encode.js +22 -0
  1073. package/draw/libs/png-chunk-text/index.d.ts +8 -0
  1074. package/draw/libs/png-chunk-text/index.js +16 -0
  1075. package/draw/libs/png-chunks-encode/index.d.ts +2 -0
  1076. package/draw/libs/png-chunks-encode/index.js +30 -0
  1077. package/draw/libs/png-chunks-extract/index.d.ts +5 -0
  1078. package/draw/libs/png-chunks-extract/index.js +39 -0
  1079. package/draw/libs/points-on-curve/curve-to-bezier.d.ts +2 -0
  1080. package/draw/libs/points-on-curve/curve-to-bezier.js +26 -0
  1081. package/draw/libs/points-on-curve/index.d.ts +4 -0
  1082. package/draw/libs/points-on-curve/index.js +73 -0
  1083. package/draw/libs/points-on-path/index.d.ts +3 -0
  1084. package/draw/libs/points-on-path/index.js +43 -0
  1085. package/draw/libs/promise-pool/LICENSE +19 -0
  1086. package/draw/libs/promise-pool/index.js +93 -0
  1087. package/draw/libs/roughjs/canvas.d.ts +19 -0
  1088. package/draw/libs/roughjs/canvas.js +95 -0
  1089. package/draw/libs/roughjs/core.d.ts +85 -0
  1090. package/draw/libs/roughjs/core.js +6 -0
  1091. package/draw/libs/roughjs/fillers/dashed-filler.d.ts +8 -0
  1092. package/draw/libs/roughjs/fillers/dashed-filler.js +32 -0
  1093. package/draw/libs/roughjs/fillers/dot-filler.d.ts +8 -0
  1094. package/draw/libs/roughjs/fillers/dot-filler.js +36 -0
  1095. package/draw/libs/roughjs/fillers/filler-interface.d.ts +11 -0
  1096. package/draw/libs/roughjs/fillers/filler.d.ts +3 -0
  1097. package/draw/libs/roughjs/fillers/filler.js +36 -0
  1098. package/draw/libs/roughjs/fillers/hachure-filler.d.ts +10 -0
  1099. package/draw/libs/roughjs/fillers/hachure-filler.js +27 -0
  1100. package/draw/libs/roughjs/fillers/hatch-filler.d.ts +6 -0
  1101. package/draw/libs/roughjs/fillers/hatch-filler.js +12 -0
  1102. package/draw/libs/roughjs/fillers/index.d.ts +9 -0
  1103. package/draw/libs/roughjs/fillers/scan-line-hachure.d.ts +3 -0
  1104. package/draw/libs/roughjs/fillers/scan-line-hachure.js +12 -0
  1105. package/draw/libs/roughjs/fillers/zigzag-filler.d.ts +6 -0
  1106. package/draw/libs/roughjs/fillers/zigzag-filler.js +20 -0
  1107. package/draw/libs/roughjs/fillers/zigzag-line-filler.d.ts +8 -0
  1108. package/draw/libs/roughjs/fillers/zigzag-line-filler.js +34 -0
  1109. package/draw/libs/roughjs/generator.d.ts +19 -0
  1110. package/draw/libs/roughjs/generator.js +204 -0
  1111. package/draw/libs/roughjs/geometry.d.ts +9 -0
  1112. package/draw/libs/roughjs/geometry.js +9 -0
  1113. package/draw/libs/roughjs/index.d.ts +9 -0
  1114. package/draw/libs/roughjs/index.js +54 -0
  1115. package/draw/libs/roughjs/math.d.ts +6 -0
  1116. package/draw/libs/roughjs/math.js +17 -0
  1117. package/draw/libs/roughjs/renderer.d.ts +28 -0
  1118. package/draw/libs/roughjs/renderer.js +336 -0
  1119. package/draw/libs/roughjs/rough.d.ts +11 -0
  1120. package/draw/libs/roughjs/rough.js +22 -0
  1121. package/draw/libs/roughjs/svg.d.ts +20 -0
  1122. package/draw/libs/roughjs/svg.js +84 -0
  1123. package/draw/libs/sliced/index.d.ts +9 -0
  1124. package/draw/libs/sliced/index.js +14 -0
  1125. package/draw/libs/webworkify/index.d.ts +3 -0
  1126. package/draw/libs/webworkify/index.js +18 -0
  1127. package/draw/style/index.css +1 -0
  1128. package/draw/style/index.d.ts +1 -0
  1129. package/draw/style/index.js +3 -0
  1130. package/draw/utils/bbox.d.ts +9 -0
  1131. package/draw/utils/bbox.js +32 -0
  1132. package/draw/utils/export.d.ts +36 -0
  1133. package/draw/utils/export.js +77 -0
  1134. package/draw/utils/index.d.ts +12 -0
  1135. package/draw/utils/index.js +22 -0
  1136. package/draw/utils/shape.d.ts +57 -0
  1137. package/draw/utils/shape.js +81 -0
  1138. package/draw/utils/withinBounds.d.ts +19 -0
  1139. package/draw/utils/withinBounds.js +61 -0
  1140. package/drawer/Drawer.js +95 -103
  1141. package/drawer/constants.d.ts +4 -0
  1142. package/drawer/constants.js +6 -0
  1143. package/drawer/context.d.ts +3 -0
  1144. package/drawer/context.js +19 -0
  1145. package/drawer/index.d.ts +2 -0
  1146. package/drawer/index.js +9 -6
  1147. package/drawer/style/index.css +1 -0
  1148. package/drawer/style/index.d.ts +2 -0
  1149. package/drawer/style/index.js +4 -0
  1150. package/drawer/use-drawer/Hook.js +11 -9
  1151. package/drawer/use-drawer/index.js +1 -1
  1152. package/dropdown/Button.d.ts +1 -1
  1153. package/dropdown/Button.js +2 -2
  1154. package/dropdown/Dropdown.js +55 -55
  1155. package/dropdown/constants.d.ts +0 -0
  1156. package/dropdown/constants.js +2 -0
  1157. package/dropdown/context.d.ts +3 -0
  1158. package/dropdown/context.js +11 -0
  1159. package/dropdown/index.d.ts +3 -1
  1160. package/dropdown/index.js +9 -6
  1161. package/dropdown/style/index.css +1 -0
  1162. package/dropdown/style/index.d.ts +3 -0
  1163. package/dropdown/style/index.js +5 -0
  1164. package/empty/Empty.js +22 -18
  1165. package/empty/constants.d.ts +0 -0
  1166. package/empty/constants.js +2 -0
  1167. package/empty/context.d.ts +3 -0
  1168. package/empty/context.js +7 -0
  1169. package/empty/index.d.ts +2 -0
  1170. package/empty/index.js +9 -4
  1171. package/empty/style/index.css +1 -0
  1172. package/empty/style/index.d.ts +1 -0
  1173. package/empty/style/index.js +3 -0
  1174. package/flex/Flex.js +24 -20
  1175. package/flex/constants.d.ts +0 -0
  1176. package/flex/constants.js +2 -0
  1177. package/flex/context.d.ts +3 -0
  1178. package/flex/context.js +7 -0
  1179. package/flex/index.d.ts +2 -0
  1180. package/flex/index.js +8 -5
  1181. package/flex/style/index.d.ts +1 -0
  1182. package/flex/style/index.js +3 -0
  1183. package/form/Control.d.ts +31 -32
  1184. package/form/Control.js +248 -200
  1185. package/form/Form.js +78 -90
  1186. package/form/Item.js +192 -0
  1187. package/form/ItemLabel.js +48 -0
  1188. package/form/ItemTip.js +41 -0
  1189. package/form/LabelSymbol.js +20 -0
  1190. package/form/List.js +83 -0
  1191. package/form/Provider.js +29 -0
  1192. package/form/constants.js +9 -0
  1193. package/form/context.d.ts +3 -1
  1194. package/form/context.js +19 -5
  1195. package/form/hooks/useForm.js +56 -0
  1196. package/form/hooks/useFormContext.js +34 -0
  1197. package/form/hooks/useFormState.js +31 -0
  1198. package/form/hooks/useWatch.js +34 -0
  1199. package/form/index.d.ts +14 -12
  1200. package/form/index.js +31 -29
  1201. package/form/interface.js +1 -1
  1202. package/form/promisify.js +1 -1
  1203. package/form/store.d.ts +1 -1
  1204. package/form/store.js +36 -36
  1205. package/form/style/index.css +1 -0
  1206. package/form/style/index.d.ts +2 -0
  1207. package/form/style/index.js +4 -0
  1208. package/form/utils.js +14 -14
  1209. package/global-provider/GlobalProvider.js +1 -1
  1210. package/global-provider/constants.d.ts +0 -0
  1211. package/global-provider/constants.js +2 -0
  1212. package/global-provider/context.js +1 -1
  1213. package/global-provider/index.d.ts +1 -0
  1214. package/global-provider/index.js +2 -1
  1215. package/global-provider/style/index.d.ts +1 -0
  1216. package/global-provider/style/index.js +3 -0
  1217. package/grid/Grid.js +33 -34
  1218. package/grid/Item.d.ts +1 -1
  1219. package/grid/Item.js +3 -3
  1220. package/grid/constants.d.ts +0 -0
  1221. package/grid/constants.js +2 -0
  1222. package/grid/context.d.ts +2 -0
  1223. package/grid/context.js +8 -3
  1224. package/grid/index.d.ts +4 -1
  1225. package/grid/index.js +9 -7
  1226. package/grid/style/index.css +1 -0
  1227. package/grid/style/index.d.ts +1 -0
  1228. package/grid/style/index.js +3 -0
  1229. package/grid/utils.js +1 -1
  1230. package/hooks/index.js +1 -1
  1231. package/hooks/use-breakpoint/index.js +1 -1
  1232. package/hooks/use-computed-state/index.js +1 -1
  1233. package/hooks/use-controllable-value/index.js +1 -1
  1234. package/hooks/use-create/index.js +1 -1
  1235. package/hooks/use-creation/index.js +1 -1
  1236. package/hooks/use-effect-event/index.js +1 -1
  1237. package/hooks/use-event/index.js +1 -1
  1238. package/hooks/use-event-listener/index.js +1 -1
  1239. package/hooks/use-force-update/index.js +1 -1
  1240. package/hooks/use-fullscreen/index.js +1 -1
  1241. package/hooks/use-id/index.js +1 -1
  1242. package/hooks/use-intersection-observer/index.js +1 -1
  1243. package/hooks/use-intersection-observers/index.js +1 -1
  1244. package/hooks/use-interval/index.js +1 -1
  1245. package/hooks/use-is-first-render/index.js +1 -1
  1246. package/hooks/use-isomorphic-layout-effect/index.js +1 -1
  1247. package/hooks/use-keyboard-event/index.js +1 -1
  1248. package/hooks/use-latest/index.js +1 -1
  1249. package/hooks/use-listen-window-resize/index.js +1 -1
  1250. package/hooks/use-media/index.js +1 -1
  1251. package/hooks/use-memoized-fn/index.js +1 -1
  1252. package/hooks/use-merge-props/index.js +1 -1
  1253. package/hooks/use-move/index.js +1 -1
  1254. package/hooks/use-mutation-observers/index.js +1 -1
  1255. package/hooks/use-online-status/index.js +1 -1
  1256. package/hooks/use-overflow-hidden/index.js +1 -1
  1257. package/hooks/use-override-ref/index.js +1 -1
  1258. package/hooks/use-persist-callback/index.js +1 -1
  1259. package/hooks/use-prefers-color-scheme-dark/index.js +1 -1
  1260. package/hooks/use-previous/index.js +1 -1
  1261. package/hooks/use-refs/index.js +1 -1
  1262. package/hooks/use-resize-observer/index.js +1 -1
  1263. package/hooks/use-resize-observers/index.js +1 -1
  1264. package/hooks/use-responsive-state/index.js +1 -1
  1265. package/hooks/use-set-state/index.js +1 -1
  1266. package/hooks/use-state-callback/index.js +1 -1
  1267. package/hooks/use-state-with-promise/index.js +1 -1
  1268. package/hooks/use-update-effect/index.js +1 -1
  1269. package/hooks/use-update-layout-effect/index.js +1 -1
  1270. package/hooks/use-verification-code/index.js +1 -1
  1271. package/hooks/use-watch/index.js +1 -1
  1272. package/hooks/use-watermark/index.js +18 -18
  1273. package/hooks/use-watermark/utils.js +1 -1
  1274. package/hooks/use-window-size/index.js +1 -1
  1275. package/hooks/useUnmountOnExit.js +1 -1
  1276. package/icon/Icon.d.ts +2 -4
  1277. package/icon/Icon.js +22 -23
  1278. package/icon/addIconFromCdn.js +1 -1
  1279. package/icon/constants.d.ts +0 -0
  1280. package/icon/constants.js +2 -0
  1281. package/icon/context.d.ts +3 -0
  1282. package/icon/context.js +11 -0
  1283. package/icon/index.d.ts +12 -1
  1284. package/icon/index.js +12 -9
  1285. package/icon/style/index.css +1 -0
  1286. package/icon/style/index.d.ts +1 -0
  1287. package/icon/style/index.js +3 -0
  1288. package/icon-hover/IconHover.js +26 -24
  1289. package/icon-hover/constants.d.ts +0 -0
  1290. package/icon-hover/constants.js +2 -0
  1291. package/icon-hover/context.d.ts +3 -0
  1292. package/icon-hover/context.js +7 -0
  1293. package/icon-hover/index.d.ts +2 -0
  1294. package/icon-hover/index.js +9 -4
  1295. package/icon-hover/style/index.css +1 -0
  1296. package/icon-hover/style/index.d.ts +1 -0
  1297. package/icon-hover/style/index.js +3 -0
  1298. package/icons/file/File.js +20 -16
  1299. package/icons/file/constants.d.ts +0 -0
  1300. package/icons/file/context.d.ts +3 -0
  1301. package/icons/file/context.js +7 -0
  1302. package/icons/file/index.d.ts +1 -0
  1303. package/icons/file/index.js +3 -2
  1304. package/icons/file/style/index.d.ts +0 -1
  1305. package/icons/file/style/index.js +3 -0
  1306. package/icons.js +1 -1
  1307. package/image/Footer.d.ts +13 -0
  1308. package/image/Footer.js +58 -0
  1309. package/image/Image.js +66 -66
  1310. package/image/Preview.js +371 -0
  1311. package/image/PreviewArrow.js +30 -0
  1312. package/image/PreviewGroup.js +112 -0
  1313. package/image/PreviewToolbar.js +61 -0
  1314. package/image/TriggerForToolbar.js +1 -1
  1315. package/image/constants.d.ts +0 -0
  1316. package/image/constants.js +2 -0
  1317. package/image/context.d.ts +5 -1
  1318. package/image/context.js +31 -5
  1319. package/image/hooks/useImageStatus.js +18 -0
  1320. package/image/hooks/useShowFooter.js +13 -0
  1321. package/image/index.d.ts +6 -4
  1322. package/image/index.js +11 -9
  1323. package/image/style/index.css +1 -0
  1324. package/image/style/index.d.ts +1 -0
  1325. package/image/style/index.js +3 -0
  1326. package/image/utils/getFixTranslate.js +1 -1
  1327. package/image/utils/getScale.js +1 -1
  1328. package/index.d.ts +0 -2
  1329. package/index.js +485 -505
  1330. package/input/Button.js +2 -2
  1331. package/input/Core.js +8 -6
  1332. package/input/Group.js +2 -2
  1333. package/input/Input.js +52 -48
  1334. package/input/Password.js +2 -2
  1335. package/input/Search.js +2 -2
  1336. package/input/Textarea.js +2 -2
  1337. package/input/autoSizeTextareaHeight.js +1 -1
  1338. package/input/constants.js +1 -1
  1339. package/input/context.d.ts +3 -0
  1340. package/input/context.js +7 -0
  1341. package/input/index.d.ts +4 -0
  1342. package/input/index.js +23 -24
  1343. package/input/style/index.css +1 -0
  1344. package/input/style/index.d.ts +2 -0
  1345. package/input/style/index.js +4 -0
  1346. package/input/useComposition.js +1 -1
  1347. package/input/utils.js +1 -1
  1348. package/input-number/InputNumber.js +56 -58
  1349. package/input-number/constants.d.ts +0 -0
  1350. package/input-number/constants.js +2 -0
  1351. package/input-number/context.d.ts +3 -0
  1352. package/input-number/context.js +13 -0
  1353. package/input-number/decimal.js +1 -1
  1354. package/input-number/hooks/useSelectionRange.js +25 -0
  1355. package/input-number/index.d.ts +2 -0
  1356. package/input-number/index.js +9 -4
  1357. package/input-number/style/index.css +1 -0
  1358. package/input-number/style/index.d.ts +2 -0
  1359. package/input-number/style/index.js +4 -0
  1360. package/input-number/utils.js +1 -1
  1361. package/input-tag/InputTag.js +163 -159
  1362. package/input-tag/constants.js +6 -0
  1363. package/input-tag/context.d.ts +3 -0
  1364. package/input-tag/context.js +7 -0
  1365. package/input-tag/hooks/useComputeAutoWidthDelay.js +12 -0
  1366. package/input-tag/index.d.ts +2 -0
  1367. package/input-tag/index.js +9 -4
  1368. package/input-tag/style/index.css +1 -0
  1369. package/input-tag/style/index.d.ts +2 -0
  1370. package/input-tag/style/index.js +4 -0
  1371. package/layout/Content.js +1 -1
  1372. package/layout/Footer.js +1 -1
  1373. package/layout/Header.js +1 -1
  1374. package/layout/Layout.js +24 -20
  1375. package/layout/Sider.js +3 -3
  1376. package/layout/constants.d.ts +0 -0
  1377. package/layout/constants.js +2 -0
  1378. package/layout/context.d.ts +3 -0
  1379. package/layout/context.js +3 -3
  1380. package/layout/index.d.ts +2 -0
  1381. package/layout/index.js +15 -13
  1382. package/layout/style/index.css +1 -0
  1383. package/layout/style/index.d.ts +3 -0
  1384. package/layout/style/index.js +5 -0
  1385. package/link/Link.js +35 -32
  1386. package/link/constants.d.ts +0 -0
  1387. package/link/constants.js +2 -0
  1388. package/link/context.d.ts +3 -0
  1389. package/link/context.js +7 -0
  1390. package/link/index.d.ts +2 -0
  1391. package/link/index.js +9 -4
  1392. package/link/style/index.css +1 -0
  1393. package/link/style/index.d.ts +1 -0
  1394. package/link/style/index.js +3 -0
  1395. package/liquid-fill/LiquidFill.js +73 -87
  1396. package/liquid-fill/constants.d.ts +0 -0
  1397. package/liquid-fill/constants.js +2 -0
  1398. package/liquid-fill/context.d.ts +3 -0
  1399. package/liquid-fill/context.js +25 -0
  1400. package/liquid-fill/index.d.ts +2 -0
  1401. package/liquid-fill/index.js +9 -4
  1402. package/liquid-fill/style/index.css +1 -0
  1403. package/liquid-fill/style/index.d.ts +1 -0
  1404. package/liquid-fill/style/index.js +3 -0
  1405. package/list/Item.js +2 -2
  1406. package/list/List.js +44 -46
  1407. package/list/Meta.js +1 -1
  1408. package/list/constants.d.ts +0 -0
  1409. package/list/constants.js +2 -0
  1410. package/list/context.d.ts +3 -0
  1411. package/list/context.js +13 -0
  1412. package/list/index.d.ts +2 -0
  1413. package/list/index.js +7 -4
  1414. package/list/style/index.css +1 -0
  1415. package/list/style/index.d.ts +5 -0
  1416. package/list/style/index.js +7 -0
  1417. package/loading/Loading.js +40 -36
  1418. package/loading/constants.d.ts +0 -0
  1419. package/loading/constants.js +2 -0
  1420. package/loading/context.d.ts +3 -0
  1421. package/loading/context.js +7 -0
  1422. package/loading/index.d.ts +2 -0
  1423. package/loading/index.js +9 -4
  1424. package/loading/style/index.d.ts +1 -0
  1425. package/loading/style/index.js +3 -0
  1426. package/locale/ar-EG.js +1 -1
  1427. package/locale/de-DE.js +1 -1
  1428. package/locale/default.js +1 -1
  1429. package/locale/en-US.js +1 -1
  1430. package/locale/es-ES.js +1 -1
  1431. package/locale/fr-FR.js +1 -1
  1432. package/locale/id-ID.js +1 -1
  1433. package/locale/it-IT.js +1 -1
  1434. package/locale/ja-JP.js +20 -20
  1435. package/locale/ko-KR.js +1 -1
  1436. package/locale/ms-MY.js +1 -1
  1437. package/locale/pt-BR.js +1 -1
  1438. package/locale/pt-PT.js +1 -1
  1439. package/locale/ru-RU.js +1 -1
  1440. package/locale/th-TH.js +1 -1
  1441. package/locale/tr-TR.js +1 -1
  1442. package/locale/vi-VN.js +1 -1
  1443. package/locale/zh-CN.js +19 -19
  1444. package/locale/zh-HK.js +20 -20
  1445. package/locale/zh-TW.js +20 -20
  1446. package/marquee/Marquee.js +44 -50
  1447. package/marquee/constants.d.ts +0 -0
  1448. package/marquee/constants.js +2 -0
  1449. package/marquee/context.d.ts +3 -0
  1450. package/marquee/context.js +16 -0
  1451. package/marquee/index.d.ts +2 -0
  1452. package/marquee/index.js +9 -4
  1453. package/marquee/style/index.css +1 -0
  1454. package/marquee/style/index.d.ts +1 -0
  1455. package/marquee/style/index.js +3 -0
  1456. package/mask/Mask.d.ts +1 -3
  1457. package/mask/Mask.js +28 -29
  1458. package/mask/constants.js +10 -0
  1459. package/mask/context.d.ts +3 -0
  1460. package/mask/context.js +11 -0
  1461. package/mask/index.d.ts +3 -3
  1462. package/mask/index.js +9 -4
  1463. package/mask/interface.d.ts +2 -2
  1464. package/mask/style/index.css +1 -0
  1465. package/mask/style/index.d.ts +1 -0
  1466. package/mask/style/index.js +3 -0
  1467. package/masonry/Item.js +1 -1
  1468. package/masonry/Masonry.js +57 -54
  1469. package/masonry/constants.d.ts +0 -0
  1470. package/masonry/constants.js +2 -0
  1471. package/masonry/context.d.ts +3 -0
  1472. package/masonry/context.js +7 -0
  1473. package/masonry/hooks/useDelay.js +1 -1
  1474. package/masonry/hooks/useGutter.js +1 -1
  1475. package/masonry/hooks/usePositions.js +1 -1
  1476. package/masonry/hooks/useRefs.js +1 -1
  1477. package/masonry/index.d.ts +2 -0
  1478. package/masonry/index.js +7 -4
  1479. package/masonry/style/index.css +1 -0
  1480. package/masonry/style/index.d.ts +1 -0
  1481. package/masonry/style/index.js +3 -0
  1482. package/mentions/Mentions.js +37 -39
  1483. package/mentions/constants.d.ts +0 -0
  1484. package/mentions/constants.js +2 -0
  1485. package/mentions/context.d.ts +3 -0
  1486. package/mentions/context.js +13 -0
  1487. package/mentions/index.d.ts +2 -0
  1488. package/mentions/index.js +9 -4
  1489. package/mentions/style/index.css +1 -0
  1490. package/mentions/style/index.d.ts +1 -0
  1491. package/mentions/style/index.js +3 -0
  1492. package/mentions/utils.js +1 -1
  1493. package/menu/Indent.js +1 -1
  1494. package/menu/Item.js +1 -1
  1495. package/menu/ItemGroup.js +1 -1
  1496. package/menu/Menu.js +75 -81
  1497. package/menu/OverflowWrap.js +2 -2
  1498. package/menu/constants.d.ts +0 -0
  1499. package/menu/constants.js +2 -0
  1500. package/menu/context.d.ts +3 -1
  1501. package/menu/context.js +12 -3
  1502. package/menu/index.d.ts +3 -1
  1503. package/menu/index.js +14 -12
  1504. package/menu/style/index.css +1 -0
  1505. package/menu/style/index.d.ts +3 -0
  1506. package/menu/style/index.js +5 -0
  1507. package/menu/sub-menu/Inline.d.ts +2 -1
  1508. package/menu/sub-menu/Inline.js +2 -2
  1509. package/menu/sub-menu/Pop.d.ts +2 -1
  1510. package/menu/sub-menu/Pop.js +3 -3
  1511. package/menu/sub-menu/index.d.ts +1 -1
  1512. package/menu/sub-menu/index.js +2 -2
  1513. package/menu/utils.js +1 -1
  1514. package/message/Message.js +76 -72
  1515. package/message/config.js +1 -1
  1516. package/message/constants.js +1 -1
  1517. package/message/context.d.ts +3 -0
  1518. package/message/context.js +7 -0
  1519. package/message/hooks/useMessage.d.ts +4 -0
  1520. package/message/hooks/useMessage.js +52 -0
  1521. package/message/index.d.ts +3 -1
  1522. package/message/index.js +9 -6
  1523. package/message/interface.d.ts +3 -5
  1524. package/message/style/index.css +1 -0
  1525. package/message/style/index.d.ts +1 -0
  1526. package/message/style/index.js +3 -0
  1527. package/message/utils.js +1 -1
  1528. package/modal/Modal.js +189 -207
  1529. package/modal/config.js +1 -1
  1530. package/modal/confirm.js +12 -12
  1531. package/modal/constants.js +1 -1
  1532. package/modal/context.d.ts +3 -0
  1533. package/modal/context.js +17 -0
  1534. package/modal/index.d.ts +2 -0
  1535. package/modal/index.js +11 -8
  1536. package/modal/interface.d.ts +3 -0
  1537. package/modal/style/index.css +1 -0
  1538. package/modal/style/index.d.ts +2 -0
  1539. package/modal/style/index.js +4 -0
  1540. package/modal/use-modal/Hook.js +11 -9
  1541. package/modal/use-modal/index.js +1 -1
  1542. package/modal/utils.js +1 -1
  1543. package/notice/Notice.js +47 -49
  1544. package/notice/config.js +1 -1
  1545. package/notice/constants.js +1 -1
  1546. package/notice/context.d.ts +3 -0
  1547. package/notice/context.js +13 -0
  1548. package/notice/index.d.ts +2 -0
  1549. package/notice/index.js +10 -7
  1550. package/notice/style/index.d.ts +1 -0
  1551. package/notice/style/index.js +3 -0
  1552. package/notice/utils.js +1 -1
  1553. package/notice/withNotice.js +1 -1
  1554. package/notification/Notification.js +77 -73
  1555. package/notification/config.js +1 -1
  1556. package/notification/constants.js +1 -1
  1557. package/notification/context.d.ts +3 -0
  1558. package/notification/context.js +7 -0
  1559. package/notification/hooks/useNotification.d.ts +4 -0
  1560. package/notification/hooks/useNotification.js +53 -0
  1561. package/notification/index.d.ts +3 -1
  1562. package/notification/index.js +9 -6
  1563. package/notification/style/index.css +1 -0
  1564. package/notification/style/index.d.ts +1 -0
  1565. package/notification/style/index.js +3 -0
  1566. package/notification/utils.js +1 -1
  1567. package/overflow-ellipsis/Item.js +22 -0
  1568. package/overflow-ellipsis/OverflowEllipsis.js +42 -37
  1569. package/overflow-ellipsis/constants.d.ts +0 -0
  1570. package/overflow-ellipsis/constants.js +2 -0
  1571. package/overflow-ellipsis/context.d.ts +3 -0
  1572. package/overflow-ellipsis/context.js +7 -0
  1573. package/overflow-ellipsis/index.d.ts +4 -2
  1574. package/overflow-ellipsis/index.js +10 -5
  1575. package/overflow-ellipsis/style/index.css +1 -0
  1576. package/overflow-ellipsis/style/index.d.ts +1 -0
  1577. package/overflow-ellipsis/style/index.js +3 -0
  1578. package/package.json +1 -1
  1579. package/page-header/PageHeader.js +74 -70
  1580. package/page-header/constants.d.ts +0 -0
  1581. package/page-header/constants.js +2 -0
  1582. package/page-header/context.d.ts +3 -0
  1583. package/page-header/context.js +7 -0
  1584. package/page-header/index.d.ts +2 -0
  1585. package/page-header/index.js +9 -4
  1586. package/page-header/style/index.css +1 -0
  1587. package/page-header/style/index.d.ts +2 -0
  1588. package/page-header/style/index.js +4 -0
  1589. package/pagination/Item.js +2 -2
  1590. package/pagination/Jumper.js +2 -2
  1591. package/pagination/Pagination.js +98 -99
  1592. package/pagination/PreNextButton.js +2 -2
  1593. package/pagination/PreNextJump.js +2 -2
  1594. package/pagination/SizeOption.js +3 -3
  1595. package/pagination/constants.d.ts +0 -0
  1596. package/pagination/constants.js +2 -0
  1597. package/pagination/context.d.ts +3 -0
  1598. package/pagination/context.js +11 -0
  1599. package/pagination/index.d.ts +2 -0
  1600. package/pagination/index.js +10 -5
  1601. package/pagination/interface.js +1 -1
  1602. package/pagination/style/index.css +1 -0
  1603. package/pagination/style/index.d.ts +3 -0
  1604. package/pagination/style/index.js +5 -0
  1605. package/pagination/utils.js +1 -1
  1606. package/picker/Input.js +1 -1
  1607. package/picker/InputRange.js +1 -1
  1608. package/picker/constants.d.ts +0 -0
  1609. package/picker/constants.js +2 -0
  1610. package/picker/context.d.ts +0 -0
  1611. package/picker/context.js +2 -0
  1612. package/picker/index.d.ts +1 -0
  1613. package/picker/index.js +7 -6
  1614. package/picker/style/index.css +1 -0
  1615. package/picker/style/index.d.ts +1 -0
  1616. package/picker/style/index.js +3 -0
  1617. package/popconfirm/Popconfirm.js +40 -43
  1618. package/popconfirm/constants.d.ts +0 -0
  1619. package/popconfirm/constants.js +2 -0
  1620. package/popconfirm/context.d.ts +3 -0
  1621. package/popconfirm/context.js +16 -0
  1622. package/popconfirm/index.d.ts +2 -0
  1623. package/popconfirm/index.js +9 -4
  1624. package/popconfirm/style/index.css +1 -0
  1625. package/popconfirm/style/index.d.ts +4 -0
  1626. package/popconfirm/style/index.js +6 -0
  1627. package/popover/Popover.js +36 -37
  1628. package/popover/constants.d.ts +0 -0
  1629. package/popover/constants.js +2 -0
  1630. package/popover/context.d.ts +3 -0
  1631. package/popover/context.js +11 -0
  1632. package/popover/index.d.ts +2 -0
  1633. package/popover/index.js +9 -4
  1634. package/popover/style/index.css +1 -0
  1635. package/popover/style/index.d.ts +2 -0
  1636. package/popover/style/index.js +4 -0
  1637. package/portal/Portal.js +25 -23
  1638. package/portal/constants.d.ts +0 -0
  1639. package/portal/constants.js +2 -0
  1640. package/portal/context.d.ts +3 -0
  1641. package/portal/context.js +7 -0
  1642. package/portal/index.d.ts +2 -0
  1643. package/portal/index.js +9 -4
  1644. package/portal/style/index.d.ts +1 -0
  1645. package/portal/style/index.js +3 -0
  1646. package/progress/Circle.js +102 -0
  1647. package/progress/Line.js +74 -0
  1648. package/progress/Progress.js +51 -54
  1649. package/progress/Step.js +51 -0
  1650. package/progress/constants.d.ts +0 -0
  1651. package/progress/constants.js +2 -0
  1652. package/progress/context.d.ts +3 -0
  1653. package/progress/context.js +13 -0
  1654. package/progress/index.d.ts +6 -31
  1655. package/progress/index.js +12 -9
  1656. package/progress/style/index.css +1 -0
  1657. package/progress/style/index.d.ts +2 -0
  1658. package/progress/style/index.js +4 -0
  1659. package/qr-code/QRCode.js +31 -37
  1660. package/qr-code/constants.d.ts +0 -0
  1661. package/qr-code/constants.js +2 -0
  1662. package/qr-code/context.d.ts +3 -0
  1663. package/qr-code/context.js +17 -0
  1664. package/qr-code/index.d.ts +2 -0
  1665. package/qr-code/index.js +9 -6
  1666. package/qr-code/src/index.js +1 -1
  1667. package/qr-code/src/qrcodegen.js +1 -1
  1668. package/qr-code/style/index.css +1 -0
  1669. package/qr-code/style/index.d.ts +1 -0
  1670. package/qr-code/style/index.js +3 -0
  1671. package/radio/Group.js +3 -3
  1672. package/radio/GroupBlock.js +3 -3
  1673. package/radio/Radio.js +62 -59
  1674. package/radio/constants.d.ts +0 -0
  1675. package/radio/constants.js +2 -0
  1676. package/radio/context.d.ts +3 -1
  1677. package/radio/context.js +3 -3
  1678. package/radio/index.d.ts +2 -0
  1679. package/radio/index.js +12 -10
  1680. package/radio/style/index.css +1 -0
  1681. package/radio/style/index.d.ts +1 -0
  1682. package/radio/style/index.js +3 -0
  1683. package/rate/Rate.js +32 -33
  1684. package/rate/constants.d.ts +0 -0
  1685. package/rate/constants.js +2 -0
  1686. package/rate/context.d.ts +3 -0
  1687. package/rate/context.js +11 -0
  1688. package/rate/index.d.ts +2 -0
  1689. package/rate/index.js +9 -4
  1690. package/rate/style/index.css +1 -0
  1691. package/rate/style/index.d.ts +2 -0
  1692. package/rate/style/index.js +4 -0
  1693. package/resize-box/ResizeBox.js +75 -76
  1694. package/resize-box/ResizeTrigger.js +1 -1
  1695. package/resize-box/Split.js +13 -13
  1696. package/resize-box/SplitGroup.js +14 -14
  1697. package/resize-box/constants.d.ts +0 -0
  1698. package/resize-box/constants.js +2 -0
  1699. package/resize-box/context.d.ts +3 -0
  1700. package/resize-box/context.js +12 -0
  1701. package/resize-box/index.d.ts +2 -0
  1702. package/resize-box/index.js +11 -8
  1703. package/resize-box/style/index.css +1 -0
  1704. package/resize-box/style/index.d.ts +1 -0
  1705. package/resize-box/style/index.js +3 -0
  1706. package/result/403.js +1 -1
  1707. package/result/404.js +1 -1
  1708. package/result/500.js +1 -1
  1709. package/result/Result.js +57 -53
  1710. package/result/constants.d.ts +0 -0
  1711. package/result/constants.js +2 -0
  1712. package/result/context.d.ts +3 -0
  1713. package/result/context.js +7 -0
  1714. package/result/index.d.ts +2 -0
  1715. package/result/index.js +9 -4
  1716. package/result/style/index.css +1 -0
  1717. package/result/style/index.d.ts +1 -0
  1718. package/result/style/index.js +3 -0
  1719. package/rich-text/RichText.d.ts +1 -1
  1720. package/rich-text/RichText.js +110 -106
  1721. package/rich-text/Toolbar.d.ts +2 -1
  1722. package/rich-text/Toolbar.js +234 -250
  1723. package/rich-text/constants.js +7 -0
  1724. package/rich-text/context.d.ts +3 -0
  1725. package/rich-text/context.js +7 -0
  1726. package/rich-text/index.d.ts +9 -7
  1727. package/rich-text/index.js +25 -22
  1728. package/rich-text/interface.d.ts +4 -2
  1729. package/rich-text/libs/blots/block.js +115 -0
  1730. package/rich-text/libs/blots/break.js +20 -0
  1731. package/rich-text/libs/blots/container.js +8 -0
  1732. package/rich-text/libs/blots/cursor.js +97 -0
  1733. package/rich-text/libs/blots/embed.js +47 -0
  1734. package/rich-text/libs/blots/inline.js +50 -0
  1735. package/rich-text/libs/blots/scroll.js +249 -0
  1736. package/rich-text/libs/blots/text.js +17 -0
  1737. package/rich-text/libs/core/composition.js +38 -0
  1738. package/rich-text/libs/core/editor.js +248 -0
  1739. package/rich-text/libs/core/emitter.d.ts +38 -0
  1740. package/rich-text/libs/core/emitter.js +47 -0
  1741. package/rich-text/libs/core/logger.js +20 -0
  1742. package/rich-text/libs/core/module.js +14 -0
  1743. package/rich-text/libs/core/rich.d.ts +183 -0
  1744. package/rich-text/libs/core/rich.js +369 -0
  1745. package/rich-text/libs/core/selection.js +222 -0
  1746. package/rich-text/libs/core/theme.js +32 -0
  1747. package/rich-text/libs/core/utils/createRegistryWithFormats.js +29 -0
  1748. package/rich-text/libs/core/utils/scrollRectIntoView.js +59 -0
  1749. package/rich-text/libs/delta/AttributeMap.js +37 -0
  1750. package/rich-text/libs/delta/Op.js +10 -0
  1751. package/rich-text/libs/delta/OpIterator.js +45 -0
  1752. package/rich-text/libs/delta/index.js +235 -0
  1753. package/rich-text/libs/diff/index.js +285 -0
  1754. package/rich-text/libs/formats/align.js +20 -0
  1755. package/rich-text/libs/formats/background.js +11 -0
  1756. package/rich-text/libs/formats/blockquote.js +16 -0
  1757. package/rich-text/libs/formats/bold.js +25 -0
  1758. package/rich-text/libs/formats/code.js +37 -0
  1759. package/rich-text/libs/formats/color.js +16 -0
  1760. package/rich-text/libs/formats/direction.js +15 -0
  1761. package/rich-text/libs/formats/emoji.js +20 -0
  1762. package/rich-text/libs/formats/font.js +51 -0
  1763. package/rich-text/libs/formats/formula.js +35 -0
  1764. package/rich-text/libs/formats/header.js +25 -0
  1765. package/rich-text/libs/formats/hr.js +17 -0
  1766. package/rich-text/libs/formats/image.js +46 -0
  1767. package/rich-text/libs/formats/indent.js +38 -0
  1768. package/rich-text/libs/formats/italic.js +16 -0
  1769. package/rich-text/libs/formats/lineHeight.js +12 -0
  1770. package/rich-text/libs/formats/link.js +47 -0
  1771. package/rich-text/libs/formats/list.js +37 -0
  1772. package/rich-text/libs/formats/script.js +23 -0
  1773. package/rich-text/libs/formats/size.js +27 -0
  1774. package/rich-text/libs/formats/strike.js +16 -0
  1775. package/rich-text/libs/formats/table.js +134 -0
  1776. package/rich-text/libs/formats/underline.js +16 -0
  1777. package/rich-text/libs/formats/video.js +40 -0
  1778. package/rich-text/libs/index.js +117 -0
  1779. package/rich-text/libs/modules/clipboard.js +295 -0
  1780. package/rich-text/libs/modules/history.js +119 -0
  1781. package/rich-text/libs/modules/image-resize/index.js +80 -0
  1782. package/rich-text/libs/modules/image-resize/modules/Base.js +14 -0
  1783. package/rich-text/libs/modules/image-resize/modules/DisplaySize.js +41 -0
  1784. package/rich-text/libs/modules/image-resize/modules/Resize.js +62 -0
  1785. package/rich-text/libs/modules/image-resize/options.js +11 -0
  1786. package/rich-text/libs/modules/input.js +54 -0
  1787. package/rich-text/libs/modules/keyboard.js +423 -0
  1788. package/rich-text/libs/modules/normalizeExternalHTML/index.js +12 -0
  1789. package/rich-text/libs/modules/normalizeExternalHTML/normalizers/googleDocs.js +22 -0
  1790. package/rich-text/libs/modules/normalizeExternalHTML/normalizers/msWord.js +39 -0
  1791. package/rich-text/libs/modules/table.js +113 -0
  1792. package/rich-text/libs/modules/toolbar copy.d.ts +0 -0
  1793. package/rich-text/libs/modules/toolbar.js +18 -0
  1794. package/rich-text/libs/modules/uiNode.js +52 -0
  1795. package/rich-text/libs/modules/uploader.js +46 -0
  1796. package/rich-text/libs/parchment/attributor/attributor.js +30 -0
  1797. package/rich-text/libs/parchment/attributor/class.js +26 -0
  1798. package/rich-text/libs/parchment/attributor/store.js +44 -0
  1799. package/rich-text/libs/parchment/attributor/style.js +25 -0
  1800. package/rich-text/libs/parchment/blot/abstract/container.js +32 -0
  1801. package/rich-text/libs/parchment/blot/abstract/leaf.js +25 -0
  1802. package/rich-text/libs/parchment/blot/abstract/parent.js +156 -0
  1803. package/rich-text/libs/parchment/blot/abstract/shadow.js +78 -0
  1804. package/rich-text/libs/parchment/blot/block.js +71 -0
  1805. package/rich-text/libs/parchment/blot/embed.js +18 -0
  1806. package/rich-text/libs/parchment/blot/inline.js +73 -0
  1807. package/rich-text/libs/parchment/blot/scroll.js +100 -0
  1808. package/rich-text/libs/parchment/blot/text.js +56 -0
  1809. package/rich-text/libs/parchment/collection/linked-list.js +86 -0
  1810. package/rich-text/libs/parchment/error.js +10 -0
  1811. package/rich-text/libs/parchment/index.js +36 -0
  1812. package/rich-text/libs/parchment/registry.js +56 -0
  1813. package/rich-text/libs/parchment/scope.js +8 -0
  1814. package/rich-text/style/index.css +1 -0
  1815. package/rich-text/style/index.d.ts +1 -0
  1816. package/rich-text/style/index.js +3 -0
  1817. package/router-error/RouterError.d.ts +4 -0
  1818. package/router-error/RouterError.js +82 -0
  1819. package/router-error/constants.d.ts +0 -0
  1820. package/router-error/constants.js +2 -0
  1821. package/router-error/context.d.ts +3 -0
  1822. package/router-error/context.js +7 -0
  1823. package/router-error/index.d.ts +3 -1
  1824. package/router-error/index.js +5 -75
  1825. package/router-error/interface.d.ts +8 -0
  1826. package/router-error/style/index.d.ts +0 -1
  1827. package/router-error/style/index.js +1 -2
  1828. package/row-col/Col.js +65 -96
  1829. package/row-col/Row.js +36 -39
  1830. package/row-col/constants.d.ts +1 -0
  1831. package/row-col/constants.js +6 -0
  1832. package/row-col/context.d.ts +5 -0
  1833. package/row-col/context.js +8 -3
  1834. package/row-col/index.d.ts +2 -0
  1835. package/row-col/index.js +11 -9
  1836. package/row-col/style/index.css +1 -0
  1837. package/row-col/style/index.d.ts +1 -0
  1838. package/row-col/style/index.js +3 -0
  1839. package/segmented/Segmented.js +82 -89
  1840. package/segmented/constants.d.ts +0 -0
  1841. package/segmented/constants.js +2 -0
  1842. package/segmented/context.d.ts +3 -0
  1843. package/segmented/context.js +18 -0
  1844. package/segmented/index.d.ts +2 -0
  1845. package/segmented/index.js +9 -4
  1846. package/segmented/style/index.css +1 -0
  1847. package/segmented/style/index.d.ts +1 -0
  1848. package/segmented/style/index.js +3 -0
  1849. package/select/Option.js +1 -1
  1850. package/select/OptionGroup.js +1 -1
  1851. package/select/Select.js +195 -197
  1852. package/select/constants.d.ts +0 -0
  1853. package/select/constants.js +2 -0
  1854. package/select/context.d.ts +3 -0
  1855. package/select/context.js +13 -0
  1856. package/select/index.d.ts +2 -0
  1857. package/select/index.js +7 -4
  1858. package/select/style/index.css +1 -0
  1859. package/select/style/index.d.ts +5 -0
  1860. package/select/style/index.js +7 -0
  1861. package/select/utils.js +1 -1
  1862. package/select-view/Core.js +3 -3
  1863. package/select-view/SelectView.js +43 -39
  1864. package/select-view/constants.d.ts +0 -0
  1865. package/select-view/constants.js +2 -0
  1866. package/select-view/context.d.ts +3 -0
  1867. package/select-view/context.js +7 -0
  1868. package/select-view/index.d.ts +2 -0
  1869. package/select-view/index.js +10 -7
  1870. package/select-view/style/index.d.ts +1 -0
  1871. package/select-view/style/index.js +3 -0
  1872. package/skeleton/Image.js +1 -1
  1873. package/skeleton/Skeleton.js +42 -42
  1874. package/skeleton/Text.d.ts +1 -1
  1875. package/skeleton/Text.js +1 -1
  1876. package/skeleton/constants.d.ts +0 -0
  1877. package/skeleton/constants.js +2 -0
  1878. package/skeleton/context.d.ts +3 -0
  1879. package/skeleton/context.js +10 -0
  1880. package/skeleton/index.d.ts +2 -0
  1881. package/skeleton/index.js +11 -8
  1882. package/skeleton/style/index.css +1 -0
  1883. package/skeleton/style/index.d.ts +1 -0
  1884. package/skeleton/style/index.js +3 -0
  1885. package/slider/Button.js +7 -7
  1886. package/slider/Dot.d.ts +1 -1
  1887. package/slider/Dot.js +1 -1
  1888. package/slider/Input.js +1 -1
  1889. package/slider/Mark.d.ts +1 -1
  1890. package/slider/Mark.js +1 -1
  1891. package/slider/Slider.js +188 -189
  1892. package/slider/Tick.d.ts +1 -1
  1893. package/slider/Tick.js +1 -1
  1894. package/slider/constants.d.ts +0 -0
  1895. package/slider/constants.js +2 -0
  1896. package/slider/context.d.ts +3 -0
  1897. package/slider/context.js +11 -0
  1898. package/slider/hooks/useInterval.js +94 -0
  1899. package/slider/hooks/useLegalValue.js +58 -0
  1900. package/slider/index.d.ts +2 -0
  1901. package/slider/index.js +15 -12
  1902. package/slider/style/index.css +1 -0
  1903. package/slider/style/index.d.ts +4 -0
  1904. package/slider/style/index.js +6 -0
  1905. package/slider/utils.d.ts +1 -1
  1906. package/slider/utils.js +1 -1
  1907. package/space/Space.js +29 -29
  1908. package/space/constants.d.ts +0 -0
  1909. package/space/constants.js +2 -0
  1910. package/space/context.d.ts +3 -0
  1911. package/space/context.js +10 -0
  1912. package/space/index.d.ts +2 -0
  1913. package/space/index.js +8 -5
  1914. package/space/style/index.d.ts +1 -0
  1915. package/space/style/index.js +3 -0
  1916. package/speech-synthesis/SpeechSynthesis.js +18 -10
  1917. package/speech-synthesis/constants.d.ts +0 -0
  1918. package/speech-synthesis/constants.js +2 -0
  1919. package/speech-synthesis/context.d.ts +3 -0
  1920. package/speech-synthesis/context.js +7 -0
  1921. package/speech-synthesis/index.d.ts +2 -0
  1922. package/speech-synthesis/index.js +9 -4
  1923. package/speech-synthesis/style/index.d.ts +1 -0
  1924. package/speech-synthesis/style/index.js +3 -0
  1925. package/spin/DotLoading.js +1 -1
  1926. package/spin/Spin.js +69 -65
  1927. package/spin/constants.d.ts +0 -0
  1928. package/spin/constants.js +2 -0
  1929. package/spin/context.d.ts +3 -0
  1930. package/spin/context.js +7 -0
  1931. package/spin/index.d.ts +2 -0
  1932. package/spin/index.js +9 -6
  1933. package/spin/style/index.css +1 -0
  1934. package/spin/style/index.d.ts +1 -0
  1935. package/spin/style/index.js +3 -0
  1936. package/splitter/Bar.js +97 -0
  1937. package/splitter/Panel.js +5 -5
  1938. package/splitter/Splitter.js +61 -58
  1939. package/splitter/constants.d.ts +0 -0
  1940. package/splitter/constants.js +2 -0
  1941. package/splitter/context.d.ts +3 -0
  1942. package/splitter/context.js +7 -0
  1943. package/splitter/hooks/useItems.js +1 -1
  1944. package/splitter/hooks/useResizable.js +1 -1
  1945. package/splitter/hooks/useResize.js +1 -1
  1946. package/splitter/hooks/useSizes.js +1 -1
  1947. package/splitter/index.d.ts +2 -0
  1948. package/splitter/index.js +9 -6
  1949. package/splitter/style/index.css +1 -0
  1950. package/splitter/style/index.d.ts +1 -0
  1951. package/splitter/style/index.js +3 -0
  1952. package/statistic/Statistic.js +32 -31
  1953. package/statistic/constants.d.ts +0 -0
  1954. package/statistic/constants.js +2 -0
  1955. package/statistic/context.d.ts +3 -0
  1956. package/statistic/context.js +10 -0
  1957. package/statistic/index.d.ts +3 -0
  1958. package/statistic/index.js +7 -4
  1959. package/statistic/interface.js +1 -1
  1960. package/statistic/style/index.css +1 -0
  1961. package/statistic/style/index.d.ts +2 -0
  1962. package/statistic/style/index.js +4 -0
  1963. package/steps/Item.js +64 -0
  1964. package/steps/Steps.js +39 -42
  1965. package/steps/constants.d.ts +0 -0
  1966. package/steps/constants.js +2 -0
  1967. package/steps/context.d.ts +3 -0
  1968. package/steps/context.js +13 -0
  1969. package/steps/index.d.ts +4 -2
  1970. package/steps/index.js +10 -7
  1971. package/steps/style/index.css +1 -0
  1972. package/steps/style/index.d.ts +1 -0
  1973. package/steps/style/index.js +3 -0
  1974. package/style/constants.d.ts +0 -0
  1975. package/style/constants.js +2 -0
  1976. package/style/constants.ts +0 -0
  1977. package/style/global.less +24 -0
  1978. package/style/index.less +1 -0
  1979. package/style/variables-css.less +1079 -0
  1980. package/style/variables.less +0 -1109
  1981. package/style.css +1 -2
  1982. package/suspense-fallback-test/SuspenseFallbackTest.js +1 -1
  1983. package/suspense-fallback-test/constants.d.ts +0 -0
  1984. package/suspense-fallback-test/constants.js +2 -0
  1985. package/suspense-fallback-test/context.d.ts +0 -0
  1986. package/suspense-fallback-test/context.js +2 -0
  1987. package/suspense-fallback-test/index.d.ts +2 -0
  1988. package/suspense-fallback-test/index.js +2 -1
  1989. package/suspense-fallback-test/style/index.d.ts +1 -0
  1990. package/suspense-fallback-test/style/index.js +3 -0
  1991. package/switch/Switch.js +61 -59
  1992. package/switch/constants.d.ts +0 -0
  1993. package/switch/constants.js +2 -0
  1994. package/switch/context.d.ts +3 -0
  1995. package/switch/context.js +10 -0
  1996. package/switch/index.d.ts +2 -0
  1997. package/switch/index.js +7 -4
  1998. package/switch/interface.d.ts +7 -0
  1999. package/switch/style/index.css +1 -0
  2000. package/switch/style/index.d.ts +1 -0
  2001. package/switch/style/index.js +3 -0
  2002. package/table/ColGroup.js +2 -2
  2003. package/table/Table.js +250 -261
  2004. package/table/constants.js +36 -0
  2005. package/table/context.d.ts +2 -0
  2006. package/table/context.js +15 -4
  2007. package/table/hooks/useColumns.js +115 -0
  2008. package/table/hooks/useComponent.js +27 -0
  2009. package/table/hooks/useExpand.js +33 -0
  2010. package/table/hooks/useRowSelection.js +73 -0
  2011. package/table/hooks/useSorter.js +51 -0
  2012. package/table/hooks/useStickyClassNames.js +25 -0
  2013. package/table/hooks/useStickyOffsets.js +28 -0
  2014. package/table/hooks/useThResizable.js +31 -0
  2015. package/table/index.d.ts +11 -9
  2016. package/table/index.js +37 -35
  2017. package/table/style/index.css +1 -0
  2018. package/table/style/index.d.ts +11 -0
  2019. package/table/style/index.js +13 -0
  2020. package/table/summary/Cell.js +1 -1
  2021. package/table/summary/Row.js +1 -1
  2022. package/table/summary/context.js +1 -1
  2023. package/table/summary/index.js +1 -1
  2024. package/table/tbody/DataRecordRenderer.js +3 -3
  2025. package/table/tbody/Td.js +4 -4
  2026. package/table/tbody/Tr.js +6 -6
  2027. package/table/tbody/index.js +2 -2
  2028. package/table/tfoot/index.js +1 -1
  2029. package/table/th-resizable/index.js +8 -7
  2030. package/table/th-resizable/style/index.css +1 -0
  2031. package/table/th-resizable/style/index.d.ts +1 -0
  2032. package/table/th-resizable/style/index.js +3 -0
  2033. package/table/thead/Column.js +10 -10
  2034. package/table/thead/index.js +4 -4
  2035. package/table/utils.js +1 -1
  2036. package/tabs/TabContent.js +23 -22
  2037. package/tabs/TabPane.js +1 -1
  2038. package/tabs/Tabs.js +80 -76
  2039. package/tabs/constants.d.ts +1 -0
  2040. package/tabs/constants.js +11 -0
  2041. package/tabs/context.d.ts +5 -3
  2042. package/tabs/context.js +12 -4
  2043. package/tabs/hooks/useDomSize.js +23 -0
  2044. package/tabs/hooks/useHeaderScroll.d.ts +13 -0
  2045. package/tabs/hooks/useHeaderScroll.js +76 -0
  2046. package/tabs/index.d.ts +4 -2
  2047. package/tabs/index.js +13 -11
  2048. package/tabs/interface.d.ts +1 -6
  2049. package/tabs/style/index.css +1 -0
  2050. package/tabs/style/index.d.ts +2 -0
  2051. package/tabs/style/index.js +4 -0
  2052. package/tabs/tab-header/DropdownIcon.js +34 -33
  2053. package/tabs/tab-header/TabInk.js +16 -16
  2054. package/tabs/tab-header/TabNavIcon.d.ts +2 -2
  2055. package/tabs/tab-header/TabNavIcon.js +45 -44
  2056. package/tabs/tab-header/TabTitle.d.ts +1 -1
  2057. package/tabs/tab-header/TabTitle.js +1 -1
  2058. package/tabs/tab-header/index.js +115 -117
  2059. package/tabs/utils.d.ts +5 -1
  2060. package/tabs/utils.js +12 -3
  2061. package/tag/Tag.js +73 -70
  2062. package/tag/constants.d.ts +0 -0
  2063. package/tag/constants.js +2 -0
  2064. package/tag/context.d.ts +3 -0
  2065. package/tag/context.js +7 -0
  2066. package/tag/index.d.ts +2 -0
  2067. package/tag/index.js +10 -5
  2068. package/tag/style/index.css +1 -0
  2069. package/tag/style/index.d.ts +1 -0
  2070. package/tag/style/index.js +3 -0
  2071. package/tag/utils.js +1 -1
  2072. package/time-picker/Picker.js +76 -79
  2073. package/time-picker/TimeColumn.js +1 -1
  2074. package/time-picker/TimePicker.js +69 -67
  2075. package/time-picker/TimePickerRange.js +1 -1
  2076. package/time-picker/constants.d.ts +0 -0
  2077. package/time-picker/constants.js +2 -0
  2078. package/time-picker/context.d.ts +3 -1
  2079. package/time-picker/context.js +9 -3
  2080. package/time-picker/index.d.ts +1 -0
  2081. package/time-picker/index.js +10 -8
  2082. package/time-picker/style/index.css +1 -0
  2083. package/time-picker/style/index.d.ts +4 -0
  2084. package/time-picker/style/index.js +6 -0
  2085. package/time-picker/utils.js +1 -1
  2086. package/time-picker/withTimePicker.js +1 -1
  2087. package/timeline/Item.js +2 -2
  2088. package/timeline/Timeline.js +33 -35
  2089. package/timeline/constants.d.ts +0 -0
  2090. package/timeline/constants.js +2 -0
  2091. package/timeline/context.d.ts +3 -0
  2092. package/timeline/context.js +13 -0
  2093. package/timeline/index.d.ts +2 -0
  2094. package/timeline/index.js +9 -6
  2095. package/timeline/style/index.css +1 -0
  2096. package/timeline/style/index.d.ts +1 -0
  2097. package/timeline/style/index.js +3 -0
  2098. package/timer/Timer.js +19 -15
  2099. package/timer/constants.d.ts +0 -0
  2100. package/timer/constants.js +2 -0
  2101. package/timer/context.d.ts +3 -0
  2102. package/timer/context.js +7 -0
  2103. package/timer/index.d.ts +2 -0
  2104. package/timer/index.js +9 -4
  2105. package/timer/style/index.d.ts +1 -0
  2106. package/timer/style/index.js +3 -0
  2107. package/toast/Toast.d.ts +1 -0
  2108. package/toast/Toast.js +1 -1
  2109. package/toast/constants.d.ts +0 -0
  2110. package/toast/constants.js +2 -0
  2111. package/toast/context.d.ts +0 -0
  2112. package/toast/context.js +2 -0
  2113. package/toast/index.d.ts +2 -0
  2114. package/toast/index.js +3 -2
  2115. package/toast/style/index.d.ts +1 -0
  2116. package/toast/style/index.js +3 -0
  2117. package/tooltip/Tooltip.js +59 -62
  2118. package/tooltip/constants.d.ts +0 -0
  2119. package/tooltip/constants.js +2 -0
  2120. package/tooltip/context.d.ts +3 -0
  2121. package/tooltip/context.js +14 -0
  2122. package/tooltip/index.d.ts +2 -0
  2123. package/tooltip/index.js +9 -4
  2124. package/tooltip/style/index.css +1 -0
  2125. package/tooltip/style/index.d.ts +2 -0
  2126. package/tooltip/style/index.js +4 -0
  2127. package/tour/Tour.js +97 -105
  2128. package/tour/constants.d.ts +0 -0
  2129. package/tour/constants.js +2 -0
  2130. package/tour/context.d.ts +3 -0
  2131. package/tour/context.js +18 -0
  2132. package/tour/index.d.ts +2 -0
  2133. package/tour/index.js +9 -4
  2134. package/tour/style/index.css +1 -0
  2135. package/tour/style/index.d.ts +1 -0
  2136. package/tour/style/index.js +3 -0
  2137. package/transfer/Item.js +1 -1
  2138. package/transfer/List.js +1 -1
  2139. package/transfer/Transfer.js +77 -80
  2140. package/transfer/constants.d.ts +0 -0
  2141. package/transfer/constants.js +2 -0
  2142. package/transfer/context.d.ts +3 -0
  2143. package/transfer/context.js +14 -0
  2144. package/transfer/index.d.ts +2 -0
  2145. package/transfer/index.js +9 -4
  2146. package/transfer/style/index.css +1 -0
  2147. package/transfer/style/index.d.ts +5 -0
  2148. package/transfer/style/index.js +7 -0
  2149. package/transition/constants.d.ts +0 -0
  2150. package/transition/constants.js +2 -0
  2151. package/transition/context.d.ts +0 -0
  2152. package/transition/context.js +2 -0
  2153. package/transition/index.d.ts +1 -0
  2154. package/transition/index.js +2 -1
  2155. package/transition/style/index.d.ts +1 -0
  2156. package/transition/style/index.js +3 -0
  2157. package/tree/Animation.js +2 -2
  2158. package/tree/Node.js +1 -1
  2159. package/tree/NodeList.d.ts +1 -1
  2160. package/tree/NodeList.js +1 -1
  2161. package/tree/Tree.js +226 -240
  2162. package/tree/constants.d.ts +10 -0
  2163. package/tree/constants.js +16 -0
  2164. package/tree/context.d.ts +2 -0
  2165. package/tree/context.js +14 -4
  2166. package/tree/index.d.ts +3 -1
  2167. package/tree/index.js +15 -13
  2168. package/tree/interface.d.ts +1 -1
  2169. package/tree/style/index.css +1 -0
  2170. package/tree/style/index.d.ts +2 -0
  2171. package/tree/style/index.js +4 -0
  2172. package/tree/utils.js +2 -2
  2173. package/tree-select/List.js +1 -1
  2174. package/tree-select/TreeSelect.js +135 -136
  2175. package/tree-select/constants.d.ts +10 -0
  2176. package/tree-select/constants.js +7 -0
  2177. package/tree-select/context.d.ts +3 -0
  2178. package/tree-select/context.js +13 -0
  2179. package/tree-select/hooks/useKeyCache.js +49 -0
  2180. package/tree-select/hooks/useStateValue.js +69 -0
  2181. package/tree-select/hooks/useTreeData.js +15 -0
  2182. package/tree-select/index.d.ts +2 -0
  2183. package/tree-select/index.js +12 -9
  2184. package/tree-select/style/index.css +1 -0
  2185. package/tree-select/style/index.d.ts +4 -0
  2186. package/tree-select/style/index.js +6 -0
  2187. package/tree-select/utils.d.ts +0 -10
  2188. package/tree-select/utils.js +3 -12
  2189. package/trigger/Trigger.js +135 -154
  2190. package/trigger/constants.d.ts +0 -0
  2191. package/trigger/constants.js +2 -0
  2192. package/trigger/context.d.ts +3 -0
  2193. package/trigger/context.js +27 -0
  2194. package/trigger/getPopupStyle.js +1 -1
  2195. package/trigger/index.d.ts +2 -0
  2196. package/trigger/index.js +10 -5
  2197. package/trigger/style/index.css +1 -0
  2198. package/trigger/style/index.d.ts +1 -0
  2199. package/trigger/style/index.js +3 -0
  2200. package/trigger/utils.js +1 -1
  2201. package/typewriter/Typewriter.js +19 -16
  2202. package/typewriter/constants.d.ts +0 -0
  2203. package/typewriter/constants.js +2 -0
  2204. package/typewriter/context.d.ts +3 -0
  2205. package/typewriter/context.js +7 -0
  2206. package/typewriter/index.d.ts +2 -0
  2207. package/typewriter/index.js +9 -4
  2208. package/typewriter/style/index.d.ts +1 -0
  2209. package/typewriter/style/index.js +3 -0
  2210. package/typography/Base.js +67 -62
  2211. package/typography/EditContent.js +1 -1
  2212. package/typography/Ellipsis.js +2 -2
  2213. package/typography/Operations.js +1 -1
  2214. package/typography/Paragraph.js +1 -1
  2215. package/typography/Text.js +1 -1
  2216. package/typography/Title.js +1 -1
  2217. package/typography/Typography.js +21 -16
  2218. package/typography/constants.d.ts +0 -0
  2219. package/typography/constants.js +2 -0
  2220. package/typography/context.d.ts +3 -0
  2221. package/typography/context.js +7 -0
  2222. package/typography/hooks/useCssEllipsis.d.ts +6 -0
  2223. package/typography/hooks/useCssEllipsis.js +41 -0
  2224. package/typography/hooks/useEllipsis.d.ts +21 -0
  2225. package/typography/hooks/useEllipsis.js +149 -0
  2226. package/typography/index.d.ts +4 -2
  2227. package/typography/index.js +19 -16
  2228. package/typography/style/index.css +1 -0
  2229. package/typography/style/index.d.ts +4 -0
  2230. package/typography/style/index.js +6 -0
  2231. package/upload/TriggerNode.js +1 -1
  2232. package/upload/Upload.js +48 -50
  2233. package/upload/Uploader.js +2 -2
  2234. package/upload/constants.js +11 -0
  2235. package/upload/context.d.ts +3 -0
  2236. package/upload/context.js +13 -0
  2237. package/upload/index.d.ts +3 -1
  2238. package/upload/index.js +14 -11
  2239. package/upload/list/PictureItem.js +3 -3
  2240. package/upload/list/TextItem.js +4 -4
  2241. package/upload/list/UploadProgress.js +5 -5
  2242. package/upload/list/index.js +2 -2
  2243. package/upload/list/utils.js +1 -1
  2244. package/upload/request.js +2 -2
  2245. package/upload/style/index.css +1 -0
  2246. package/upload/style/index.d.ts +5 -0
  2247. package/upload/style/index.js +7 -0
  2248. package/upload/utils.js +1 -1
  2249. package/utils/callOrReturn.js +1 -1
  2250. package/utils/callbackOriginRef.js +1 -1
  2251. package/utils/caseName.js +1 -1
  2252. package/utils/className.js +1 -1
  2253. package/utils/constants.d.ts +5 -0
  2254. package/utils/constants.js +24 -0
  2255. package/utils/contextHolder.js +1 -1
  2256. package/utils/copy.js +1 -1
  2257. package/utils/createGlobalConfigFunction.js +1 -1
  2258. package/utils/css.js +1 -1
  2259. package/utils/date.js +1 -1
  2260. package/utils/dayjs.js +2 -2
  2261. package/utils/document.d.ts +1 -0
  2262. package/utils/document.js +10 -0
  2263. package/utils/dom.js +1 -1
  2264. package/utils/emitter.js +1 -1
  2265. package/utils/file.js +1 -1
  2266. package/utils/fileRead.js +1 -1
  2267. package/utils/fileToDataURL.js +1 -1
  2268. package/utils/fillNBSP.js +1 -1
  2269. package/utils/findRootElement.js +1 -1
  2270. package/utils/findScrollParent.js +1 -1
  2271. package/utils/getHighlightText.js +1 -1
  2272. package/utils/getHotkeyHandler.js +1 -1
  2273. package/utils/getScrollBarHeight.js +1 -1
  2274. package/utils/getScrollBarSize.js +1 -1
  2275. package/utils/getScrollBarWidth.js +1 -1
  2276. package/utils/getStringLength.js +1 -1
  2277. package/utils/include.js +1 -1
  2278. package/utils/index.d.ts +1 -1
  2279. package/utils/index.js +53 -53
  2280. package/utils/intersectionObserver.js +1 -1
  2281. package/utils/is.js +1 -1
  2282. package/utils/keyboardCode.d.ts +3 -3
  2283. package/utils/keyboardCode.js +4 -4
  2284. package/utils/lodash.js +1 -1
  2285. package/utils/math.js +1 -1
  2286. package/utils/mergeProps.js +1 -1
  2287. package/utils/mergedToString.js +1 -1
  2288. package/utils/mutationObserver.js +1 -1
  2289. package/utils/names.d.ts +1 -0
  2290. package/utils/names.js +2 -2
  2291. package/utils/object.js +1 -1
  2292. package/utils/omit.js +1 -1
  2293. package/utils/pad.js +1 -1
  2294. package/utils/pick.js +1 -1
  2295. package/utils/pinyin.js +1 -1
  2296. package/utils/react19Adapter.js +1 -1
  2297. package/utils/ref.js +1 -1
  2298. package/utils/resizeObserver.js +1 -1
  2299. package/utils/responsiveObserve.js +1 -1
  2300. package/utils/saveAs.js +1 -1
  2301. package/utils/screenfull.js +1 -1
  2302. package/utils/scrollIntoViewIfNeeded.js +1 -1
  2303. package/utils/setCreateRoot.js +1 -1
  2304. package/utils/setDarkTheme.js +2 -2
  2305. package/utils/setPrimaryColor.js +2 -2
  2306. package/utils/setTheme.js +2 -2
  2307. package/utils/string.d.ts +1 -1
  2308. package/utils/string.js +2 -2
  2309. package/utils/style.js +1 -1
  2310. package/utils/throttleByRequestAnimationFrame.js +1 -1
  2311. package/utils/tinycolor.js +1 -1
  2312. package/utils/toArray.js +1 -1
  2313. package/utils/tree.js +1 -1
  2314. package/utils/tunnel.js +8 -2
  2315. package/utils/tween.js +1 -1
  2316. package/utils/uuid.js +1 -1
  2317. package/utils/validate.js +1 -1
  2318. package/utils/warning.js +1 -1
  2319. package/verification-code/VerificationCode.js +51 -48
  2320. package/verification-code/constants.d.ts +0 -0
  2321. package/verification-code/constants.js +2 -0
  2322. package/verification-code/context.d.ts +3 -0
  2323. package/verification-code/context.js +7 -0
  2324. package/verification-code/index.d.ts +2 -0
  2325. package/verification-code/index.js +7 -4
  2326. package/verification-code/style/index.css +1 -0
  2327. package/verification-code/style/index.d.ts +2 -0
  2328. package/verification-code/style/index.js +4 -0
  2329. package/version/index.js +8 -8
  2330. package/virtual-list/Filler.js +1 -1
  2331. package/virtual-list/VirtualList.js +159 -154
  2332. package/virtual-list/constants.js +7 -0
  2333. package/virtual-list/context.d.ts +3 -0
  2334. package/virtual-list/context.js +7 -0
  2335. package/virtual-list/hooks/useCacheChildrenNodes.js +13 -0
  2336. package/virtual-list/hooks/useComputeVirtualItemHeight.js +17 -0
  2337. package/virtual-list/index.d.ts +2 -0
  2338. package/virtual-list/index.js +9 -6
  2339. package/virtual-list/style/index.d.ts +1 -0
  2340. package/virtual-list/style/index.js +3 -0
  2341. package/virtual-list/utils/algorithm.js +1 -1
  2342. package/virtual-list/utils/item.js +1 -1
  2343. package/watermark/Watermark.js +38 -34
  2344. package/watermark/constants.d.ts +0 -0
  2345. package/watermark/constants.js +2 -0
  2346. package/watermark/context.d.ts +3 -0
  2347. package/watermark/context.js +7 -0
  2348. package/watermark/index.d.ts +2 -0
  2349. package/watermark/index.js +7 -4
  2350. package/watermark/style/index.d.ts +1 -0
  2351. package/watermark/style/index.js +3 -0
  2352. package/.vite/license.md +0 -3
  2353. package/.vite/manifest.json +0 -8807
  2354. package/calendar/hook/useCellClassName.js +0 -34
  2355. package/cascader/hook/useRefCurrent.js +0 -14
  2356. package/constant/index.d.ts +0 -3
  2357. package/constant/index.js +0 -6
  2358. package/date-picker/DatePickerRange.d.ts +0 -3
  2359. package/date-picker/DatePickerRange.js +0 -404
  2360. package/date-picker/hook/useCellClassName.js +0 -53
  2361. package/draw/constant.js +0 -2
  2362. package/form/FormControl.d.ts +0 -50
  2363. package/form/FormControl.js +0 -256
  2364. package/form/FormItem.js +0 -192
  2365. package/form/FormItemLabel.js +0 -48
  2366. package/form/FormItemTip.js +0 -41
  2367. package/form/FormLabelSymbol.js +0 -20
  2368. package/form/FormList.js +0 -83
  2369. package/form/FormProvider.js +0 -29
  2370. package/form/constant.js +0 -9
  2371. package/form/hook/useForm.js +0 -56
  2372. package/form/hook/useFormContext.js +0 -34
  2373. package/form/hook/useFormState.js +0 -31
  2374. package/form/hook/useWatch.js +0 -34
  2375. package/image/ImageFooter.d.ts +0 -13
  2376. package/image/ImageFooter.js +0 -58
  2377. package/image/ImagePreview.js +0 -418
  2378. package/image/ImagePreviewArrow.js +0 -30
  2379. package/image/ImagePreviewGroup.js +0 -112
  2380. package/image/ImagePreviewToolbar.js +0 -61
  2381. package/image/hook/useImageStatus.js +0 -18
  2382. package/image/hook/useShowFooter.js +0 -13
  2383. package/input-number/useSelectionRange.js +0 -25
  2384. package/input-tag/constant.js +0 -6
  2385. package/input-tag/hook/useComputeAutoWidthDelay.js +0 -12
  2386. package/mask/constant.js +0 -10
  2387. package/message/useMessage.d.ts +0 -4
  2388. package/message/useMessage.js +0 -52
  2389. package/notification/useNotification.d.ts +0 -4
  2390. package/notification/useNotification.js +0 -53
  2391. package/overflow-ellipsis/OverflowItem.js +0 -22
  2392. package/progress/CircleProgress.js +0 -102
  2393. package/progress/LineProgess.js +0 -74
  2394. package/progress/StepProgress.js +0 -51
  2395. package/rich-text/constant.js +0 -7
  2396. package/rich-text/lib/blots/block.js +0 -115
  2397. package/rich-text/lib/blots/break.js +0 -20
  2398. package/rich-text/lib/blots/container.js +0 -8
  2399. package/rich-text/lib/blots/cursor.js +0 -97
  2400. package/rich-text/lib/blots/embed.js +0 -47
  2401. package/rich-text/lib/blots/inline.js +0 -50
  2402. package/rich-text/lib/blots/scroll.js +0 -249
  2403. package/rich-text/lib/blots/text.js +0 -17
  2404. package/rich-text/lib/core/composition.js +0 -38
  2405. package/rich-text/lib/core/editor.js +0 -248
  2406. package/rich-text/lib/core/emitter.d.ts +0 -38
  2407. package/rich-text/lib/core/emitter.js +0 -47
  2408. package/rich-text/lib/core/logger.js +0 -20
  2409. package/rich-text/lib/core/module.js +0 -14
  2410. package/rich-text/lib/core/rich.d.ts +0 -183
  2411. package/rich-text/lib/core/rich.js +0 -369
  2412. package/rich-text/lib/core/selection.js +0 -222
  2413. package/rich-text/lib/core/theme.js +0 -32
  2414. package/rich-text/lib/core/utils/createRegistryWithFormats.js +0 -29
  2415. package/rich-text/lib/core/utils/scrollRectIntoView.js +0 -59
  2416. package/rich-text/lib/delta/AttributeMap.js +0 -37
  2417. package/rich-text/lib/delta/Op.js +0 -10
  2418. package/rich-text/lib/delta/OpIterator.js +0 -45
  2419. package/rich-text/lib/delta/index.js +0 -235
  2420. package/rich-text/lib/diff/index.js +0 -285
  2421. package/rich-text/lib/formats/align.js +0 -20
  2422. package/rich-text/lib/formats/background.js +0 -11
  2423. package/rich-text/lib/formats/blockquote.js +0 -16
  2424. package/rich-text/lib/formats/bold.js +0 -25
  2425. package/rich-text/lib/formats/code.js +0 -37
  2426. package/rich-text/lib/formats/color.js +0 -16
  2427. package/rich-text/lib/formats/direction.js +0 -15
  2428. package/rich-text/lib/formats/emoji.js +0 -20
  2429. package/rich-text/lib/formats/font.js +0 -51
  2430. package/rich-text/lib/formats/formula.js +0 -35
  2431. package/rich-text/lib/formats/header.js +0 -25
  2432. package/rich-text/lib/formats/hr.js +0 -17
  2433. package/rich-text/lib/formats/image.js +0 -46
  2434. package/rich-text/lib/formats/indent.js +0 -38
  2435. package/rich-text/lib/formats/italic.js +0 -16
  2436. package/rich-text/lib/formats/lineHeight.js +0 -12
  2437. package/rich-text/lib/formats/link.js +0 -47
  2438. package/rich-text/lib/formats/list.js +0 -37
  2439. package/rich-text/lib/formats/script.js +0 -23
  2440. package/rich-text/lib/formats/size.js +0 -27
  2441. package/rich-text/lib/formats/strike.js +0 -16
  2442. package/rich-text/lib/formats/table.js +0 -134
  2443. package/rich-text/lib/formats/underline.js +0 -16
  2444. package/rich-text/lib/formats/video.js +0 -40
  2445. package/rich-text/lib/index.js +0 -117
  2446. package/rich-text/lib/modules/clipboard.js +0 -295
  2447. package/rich-text/lib/modules/history.js +0 -119
  2448. package/rich-text/lib/modules/image-resize/index.js +0 -80
  2449. package/rich-text/lib/modules/image-resize/modules/Base.js +0 -14
  2450. package/rich-text/lib/modules/image-resize/modules/DisplaySize.js +0 -41
  2451. package/rich-text/lib/modules/image-resize/modules/Resize.js +0 -62
  2452. package/rich-text/lib/modules/image-resize/options.js +0 -11
  2453. package/rich-text/lib/modules/input.js +0 -54
  2454. package/rich-text/lib/modules/keyboard.js +0 -423
  2455. package/rich-text/lib/modules/normalizeExternalHTML/index.js +0 -12
  2456. package/rich-text/lib/modules/normalizeExternalHTML/normalizers/googleDocs.js +0 -22
  2457. package/rich-text/lib/modules/normalizeExternalHTML/normalizers/msWord.js +0 -39
  2458. package/rich-text/lib/modules/table.js +0 -113
  2459. package/rich-text/lib/modules/toolbar.js +0 -18
  2460. package/rich-text/lib/modules/uiNode.js +0 -52
  2461. package/rich-text/lib/modules/uploader.js +0 -46
  2462. package/rich-text/lib/parchment/attributor/attributor.js +0 -30
  2463. package/rich-text/lib/parchment/attributor/class.js +0 -26
  2464. package/rich-text/lib/parchment/attributor/store.js +0 -44
  2465. package/rich-text/lib/parchment/attributor/style.js +0 -25
  2466. package/rich-text/lib/parchment/blot/abstract/container.js +0 -32
  2467. package/rich-text/lib/parchment/blot/abstract/leaf.js +0 -25
  2468. package/rich-text/lib/parchment/blot/abstract/parent.js +0 -156
  2469. package/rich-text/lib/parchment/blot/abstract/shadow.js +0 -78
  2470. package/rich-text/lib/parchment/blot/block.js +0 -71
  2471. package/rich-text/lib/parchment/blot/embed.js +0 -18
  2472. package/rich-text/lib/parchment/blot/inline.js +0 -73
  2473. package/rich-text/lib/parchment/blot/scroll.js +0 -100
  2474. package/rich-text/lib/parchment/blot/text.js +0 -56
  2475. package/rich-text/lib/parchment/collection/linked-list.js +0 -86
  2476. package/rich-text/lib/parchment/error.js +0 -10
  2477. package/rich-text/lib/parchment/index.js +0 -36
  2478. package/rich-text/lib/parchment/registry.js +0 -56
  2479. package/rich-text/lib/parchment/scope.js +0 -8
  2480. package/row-col/Col-.d.ts +0 -4
  2481. package/row-col/Col-.js +0 -65
  2482. package/slider/hook/useInterval.js +0 -94
  2483. package/slider/hook/useLegalValue.js +0 -58
  2484. package/splitter/SplitBar.js +0 -97
  2485. package/steps/Step.js +0 -64
  2486. package/table/constant.js +0 -36
  2487. package/table/hook/useColumns.js +0 -115
  2488. package/table/hook/useComponent.js +0 -27
  2489. package/table/hook/useExpand.js +0 -33
  2490. package/table/hook/useRowSelection.js +0 -73
  2491. package/table/hook/useSorter.js +0 -51
  2492. package/table/hook/useStickyClassNames.js +0 -25
  2493. package/table/hook/useStickyOffsets.js +0 -28
  2494. package/table/hook/useThResizable.js +0 -31
  2495. package/tabs/hook/useDomSize.js +0 -23
  2496. package/tabs/hook/useHeaderScroll.d.ts +0 -12
  2497. package/tabs/hook/useHeaderScroll.js +0 -75
  2498. package/tree-select/hook/useKeyCache.js +0 -49
  2499. package/tree-select/hook/useStateValue.js +0 -70
  2500. package/tree-select/hook/useTreeData.js +0 -15
  2501. package/typography/useCssEllipsis.d.ts +0 -6
  2502. package/typography/useCssEllipsis.js +0 -41
  2503. package/typography/useEllipsis.d.ts +0 -21
  2504. package/typography/useEllipsis.js +0 -149
  2505. package/upload/constant.js +0 -11
  2506. package/utils/constant.d.ts +0 -5
  2507. package/utils/constant.js +0 -24
  2508. package/virtual-list/constant.js +0 -7
  2509. package/virtual-list/hook/useCacheChildrenNodes.js +0 -13
  2510. package/virtual-list/hook/useComputeVirtualItemHeight.js +0 -17
  2511. /package/{draw/constant.d.ts → affix/constants.d.ts} +0 -0
  2512. /package/{rich-text/lib/modules/toolbar copy.d.ts → alert/constants.d.ts} +0 -0
  2513. /package/{rich-text/lib/themes/base.d.ts → anchor/constants.d.ts} +0 -0
  2514. /package/{rich-text/lib/themes/pqb.d.ts → animation/constants.d.ts} +0 -0
  2515. /package/{rich-text/lib/ui/tooltip.d.ts → app/constants.d.ts} +0 -0
  2516. /package/calendar/{hook → hooks}/useCellClassName.d.ts +0 -0
  2517. /package/cascader/{hook → hooks}/useRefCurrent.d.ts +0 -0
  2518. /package/date-picker/{hook → hooks}/useCellClassName.d.ts +0 -0
  2519. /package/form/{FormItem.d.ts → Item.d.ts} +0 -0
  2520. /package/form/{FormItemLabel.d.ts → ItemLabel.d.ts} +0 -0
  2521. /package/form/{FormItemTip.d.ts → ItemTip.d.ts} +0 -0
  2522. /package/form/{FormLabelSymbol.d.ts → LabelSymbol.d.ts} +0 -0
  2523. /package/form/{FormList.d.ts → List.d.ts} +0 -0
  2524. /package/form/{FormProvider.d.ts → Provider.d.ts} +0 -0
  2525. /package/form/{constant.d.ts → constants.d.ts} +0 -0
  2526. /package/form/{hook → hooks}/useForm.d.ts +0 -0
  2527. /package/form/{hook → hooks}/useFormContext.d.ts +0 -0
  2528. /package/form/{hook → hooks}/useFormState.d.ts +0 -0
  2529. /package/form/{hook → hooks}/useWatch.d.ts +0 -0
  2530. /package/image/{ImagePreview.d.ts → Preview.d.ts} +0 -0
  2531. /package/image/{ImagePreviewArrow.d.ts → PreviewArrow.d.ts} +0 -0
  2532. /package/image/{ImagePreviewGroup.d.ts → PreviewGroup.d.ts} +0 -0
  2533. /package/image/{ImagePreviewToolbar.d.ts → PreviewToolbar.d.ts} +0 -0
  2534. /package/image/{hook → hooks}/useImageStatus.d.ts +0 -0
  2535. /package/image/{hook → hooks}/useShowFooter.d.ts +0 -0
  2536. /package/input-number/{useSelectionRange.d.ts → hooks/useSelectionRange.d.ts} +0 -0
  2537. /package/input-tag/{constant.d.ts → constants.d.ts} +0 -0
  2538. /package/input-tag/{hook → hooks}/useComputeAutoWidthDelay.d.ts +0 -0
  2539. /package/mask/{constant.d.ts → constants.d.ts} +0 -0
  2540. /package/overflow-ellipsis/{OverflowItem.d.ts → Item.d.ts} +0 -0
  2541. /package/progress/{CircleProgress.d.ts → Circle.d.ts} +0 -0
  2542. /package/progress/{LineProgess.d.ts → Line.d.ts} +0 -0
  2543. /package/progress/{StepProgress.d.ts → Step.d.ts} +0 -0
  2544. /package/rich-text/{constant.d.ts → constants.d.ts} +0 -0
  2545. /package/rich-text/{lib → libs}/LICENSE +0 -0
  2546. /package/rich-text/{lib → libs}/blots/block.d.ts +0 -0
  2547. /package/rich-text/{lib → libs}/blots/break.d.ts +0 -0
  2548. /package/rich-text/{lib → libs}/blots/container.d.ts +0 -0
  2549. /package/rich-text/{lib → libs}/blots/cursor.d.ts +0 -0
  2550. /package/rich-text/{lib → libs}/blots/embed.d.ts +0 -0
  2551. /package/rich-text/{lib → libs}/blots/inline.d.ts +0 -0
  2552. /package/rich-text/{lib → libs}/blots/scroll.d.ts +0 -0
  2553. /package/rich-text/{lib → libs}/blots/text.d.ts +0 -0
  2554. /package/rich-text/{lib → libs}/core/composition.d.ts +0 -0
  2555. /package/rich-text/{lib → libs}/core/editor.d.ts +0 -0
  2556. /package/rich-text/{lib → libs}/core/logger.d.ts +0 -0
  2557. /package/rich-text/{lib → libs}/core/module.d.ts +0 -0
  2558. /package/rich-text/{lib → libs}/core/selection.d.ts +0 -0
  2559. /package/rich-text/{lib → libs}/core/theme.d.ts +0 -0
  2560. /package/rich-text/{lib → libs}/core/utils/createRegistryWithFormats.d.ts +0 -0
  2561. /package/rich-text/{lib → libs}/core/utils/scrollRectIntoView.d.ts +0 -0
  2562. /package/rich-text/{lib → libs}/delta/AttributeMap.d.ts +0 -0
  2563. /package/rich-text/{lib → libs}/delta/LICENSE +0 -0
  2564. /package/rich-text/{lib → libs}/delta/Op.d.ts +0 -0
  2565. /package/rich-text/{lib → libs}/delta/OpIterator.d.ts +0 -0
  2566. /package/rich-text/{lib → libs}/delta/index.d.ts +0 -0
  2567. /package/rich-text/{lib → libs}/diff/index.d.ts +0 -0
  2568. /package/rich-text/{lib → libs}/formats/align.d.ts +0 -0
  2569. /package/rich-text/{lib → libs}/formats/background.d.ts +0 -0
  2570. /package/rich-text/{lib → libs}/formats/blockquote.d.ts +0 -0
  2571. /package/rich-text/{lib → libs}/formats/bold.d.ts +0 -0
  2572. /package/rich-text/{lib → libs}/formats/code.d.ts +0 -0
  2573. /package/rich-text/{lib → libs}/formats/color.d.ts +0 -0
  2574. /package/rich-text/{lib → libs}/formats/direction.d.ts +0 -0
  2575. /package/rich-text/{lib → libs}/formats/emoji.d.ts +0 -0
  2576. /package/rich-text/{lib → libs}/formats/font.d.ts +0 -0
  2577. /package/rich-text/{lib → libs}/formats/formula.d.ts +0 -0
  2578. /package/rich-text/{lib → libs}/formats/header.d.ts +0 -0
  2579. /package/rich-text/{lib → libs}/formats/hr.d.ts +0 -0
  2580. /package/rich-text/{lib → libs}/formats/image.d.ts +0 -0
  2581. /package/rich-text/{lib → libs}/formats/indent.d.ts +0 -0
  2582. /package/rich-text/{lib → libs}/formats/italic.d.ts +0 -0
  2583. /package/rich-text/{lib → libs}/formats/liOl.d.ts +0 -0
  2584. /package/rich-text/{lib → libs}/formats/liUl.d.ts +0 -0
  2585. /package/rich-text/{lib → libs}/formats/lineHeight.d.ts +0 -0
  2586. /package/rich-text/{lib → libs}/formats/link.d.ts +0 -0
  2587. /package/rich-text/{lib → libs}/formats/list.d.ts +0 -0
  2588. /package/rich-text/{lib → libs}/formats/script.d.ts +0 -0
  2589. /package/rich-text/{lib → libs}/formats/size.d.ts +0 -0
  2590. /package/rich-text/{lib → libs}/formats/strike.d.ts +0 -0
  2591. /package/rich-text/{lib → libs}/formats/table.d.ts +0 -0
  2592. /package/rich-text/{lib → libs}/formats/underline.d.ts +0 -0
  2593. /package/rich-text/{lib → libs}/formats/video.d.ts +0 -0
  2594. /package/rich-text/{lib → libs}/index.d.ts +0 -0
  2595. /package/rich-text/{lib → libs}/modules/clipboard.d.ts +0 -0
  2596. /package/rich-text/{lib → libs}/modules/history.d.ts +0 -0
  2597. /package/rich-text/{lib → libs}/modules/image-resize/index.d.ts +0 -0
  2598. /package/rich-text/{lib → libs}/modules/image-resize/modules/Base.d.ts +0 -0
  2599. /package/rich-text/{lib → libs}/modules/image-resize/modules/DisplaySize.d.ts +0 -0
  2600. /package/rich-text/{lib → libs}/modules/image-resize/modules/Resize.d.ts +0 -0
  2601. /package/rich-text/{lib → libs}/modules/image-resize/options.d.ts +0 -0
  2602. /package/rich-text/{lib → libs}/modules/input.d.ts +0 -0
  2603. /package/rich-text/{lib → libs}/modules/keyboard.d.ts +0 -0
  2604. /package/rich-text/{lib → libs}/modules/normalizeExternalHTML/index.d.ts +0 -0
  2605. /package/rich-text/{lib → libs}/modules/normalizeExternalHTML/normalizers/googleDocs.d.ts +0 -0
  2606. /package/rich-text/{lib → libs}/modules/normalizeExternalHTML/normalizers/msWord.d.ts +0 -0
  2607. /package/rich-text/{lib → libs}/modules/table.d.ts +0 -0
  2608. /package/rich-text/{lib → libs}/modules/tableEmbed.d.ts +0 -0
  2609. /package/rich-text/{lib → libs}/modules/toolbar.d.ts +0 -0
  2610. /package/rich-text/{lib → libs}/modules/uiNode.d.ts +0 -0
  2611. /package/rich-text/{lib → libs}/modules/uploader.d.ts +0 -0
  2612. /package/rich-text/{lib → libs}/parchment/LICENSE +0 -0
  2613. /package/rich-text/{lib → libs}/parchment/attributor/attributor.d.ts +0 -0
  2614. /package/rich-text/{lib → libs}/parchment/attributor/class.d.ts +0 -0
  2615. /package/rich-text/{lib → libs}/parchment/attributor/store.d.ts +0 -0
  2616. /package/rich-text/{lib → libs}/parchment/attributor/style.d.ts +0 -0
  2617. /package/rich-text/{lib → libs}/parchment/blot/abstract/blot.d.ts +0 -0
  2618. /package/rich-text/{lib → libs}/parchment/blot/abstract/container.d.ts +0 -0
  2619. /package/rich-text/{lib → libs}/parchment/blot/abstract/leaf.d.ts +0 -0
  2620. /package/rich-text/{lib → libs}/parchment/blot/abstract/parent.d.ts +0 -0
  2621. /package/rich-text/{lib → libs}/parchment/blot/abstract/shadow.d.ts +0 -0
  2622. /package/rich-text/{lib → libs}/parchment/blot/block.d.ts +0 -0
  2623. /package/rich-text/{lib → libs}/parchment/blot/embed.d.ts +0 -0
  2624. /package/rich-text/{lib → libs}/parchment/blot/inline.d.ts +0 -0
  2625. /package/rich-text/{lib → libs}/parchment/blot/scroll.d.ts +0 -0
  2626. /package/rich-text/{lib → libs}/parchment/blot/text.d.ts +0 -0
  2627. /package/rich-text/{lib → libs}/parchment/collection/linked-list.d.ts +0 -0
  2628. /package/rich-text/{lib → libs}/parchment/collection/linked-node.d.ts +0 -0
  2629. /package/rich-text/{lib → libs}/parchment/error.d.ts +0 -0
  2630. /package/rich-text/{lib → libs}/parchment/index.d.ts +0 -0
  2631. /package/rich-text/{lib → libs}/parchment/registry.d.ts +0 -0
  2632. /package/rich-text/{lib → libs}/parchment/scope.d.ts +0 -0
  2633. /package/slider/{hook → hooks}/useInterval.d.ts +0 -0
  2634. /package/slider/{hook → hooks}/useLegalValue.d.ts +0 -0
  2635. /package/splitter/{SplitBar.d.ts → Bar.d.ts} +0 -0
  2636. /package/steps/{Step.d.ts → Item.d.ts} +0 -0
  2637. /package/table/{constant.d.ts → constants.d.ts} +0 -0
  2638. /package/table/{hook → hooks}/useColumns.d.ts +0 -0
  2639. /package/table/{hook → hooks}/useComponent.d.ts +0 -0
  2640. /package/table/{hook → hooks}/useExpand.d.ts +0 -0
  2641. /package/table/{hook → hooks}/useRowSelection.d.ts +0 -0
  2642. /package/table/{hook → hooks}/useSorter.d.ts +0 -0
  2643. /package/table/{hook → hooks}/useStickyClassNames.d.ts +0 -0
  2644. /package/table/{hook → hooks}/useStickyOffsets.d.ts +0 -0
  2645. /package/table/{hook → hooks}/useThResizable.d.ts +0 -0
  2646. /package/tabs/{hook → hooks}/useDomSize.d.ts +0 -0
  2647. /package/tree-select/{hook → hooks}/useKeyCache.d.ts +0 -0
  2648. /package/tree-select/{hook → hooks}/useStateValue.d.ts +0 -0
  2649. /package/tree-select/{hook → hooks}/useTreeData.d.ts +0 -0
  2650. /package/upload/{constant.d.ts → constants.d.ts} +0 -0
  2651. /package/virtual-list/{constant.d.ts → constants.d.ts} +0 -0
  2652. /package/virtual-list/{hook → hooks}/useCacheChildrenNodes.d.ts +0 -0
  2653. /package/virtual-list/{hook → hooks}/useComputeVirtualItemHeight.d.ts +0 -0
@@ -0,0 +1,4076 @@
1
+ /* 潘启宝 2026-06-25 08:58:50 星期四 山东省济南市 */
2
+ import { ConfigContext as e } from "../../../config-provider/context.js";
3
+ import { EMITTER_EVENT as t, emitter as n } from "../../../utils/emitter.js";
4
+ import r from "../../../config-provider/index.js";
5
+ import { clamp as i } from "../../libs/math/utils.js";
6
+ import { applyDarkModeFilter as a, isTransparent as o } from "../../common/colors.js";
7
+ import { APP_NAME as s, ARROW_TYPE as c, CLASSES as l, CURSOR_TYPE as u, DEFAULT_COLLISION_THRESHOLD as d, DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT as f, DEFAULT_REDUCED_GLOBAL_ALPHA as p, DEFAULT_TEXT_ALIGN as m, EVENT as h, FRAME_STYLE as g, IMAGE_MIME_TYPES as _, MAX_ALLOWED_FILE_BYTES as ee, MIME_TYPES as v, POINTER_BUTTON as y, POINTER_EVENTS as te, ROUNDNESS as ne, THEME as re, TOOL_TYPE as b, VERTICAL_ALIGN as ie, ZOOM_STEP as ae, supportsResizeObserver as oe } from "../../common/constants.js";
8
+ import { MQ_RIGHT_SIDEBAR_MIN_WIDTH as se, createUserAgentDescriptor as ce, deriveStylesPanelMode as le, getFormFactor as ue, isBrave as de, isIOS as fe, isSafari as pe, loadDesktopUIModePreference as me, setDesktopUIMode as he } from "../../common/editorInterface.js";
9
+ import { Emitter as ge } from "../../common/emitter.js";
10
+ import { getLineHeight as _e } from "../../common/font-metadata.js";
11
+ import { CODES as ve, KEYS as x, isArrowKey as ye, shouldMaintainAspectRatio as be, shouldResizeFromCenter as xe, shouldRotateWithDiscreteAngle as Se } from "../../common/keys.js";
12
+ import { vector as Ce, vectorDot as we, vectorFromPoint as Te, vectorNormalize as Ee, vectorSubtract as De } from "../../libs/math/vector.js";
13
+ import { pointDistance as Oe, pointFrom as S, pointRotateRads as ke } from "../../libs/math/point.js";
14
+ import "../../libs/math/index.js";
15
+ import { getGridPoint as C } from "../../common/points.js";
16
+ import { addEventListener as w, arrayToMap as Ae, debounce as je, distance as Me, easeOut as Ne, easeToValuesRAF as Pe, getDateTime as Fe, getFeatureFlag as T, getFontString as Ie, getNearestScrollableContainer as Le, invariant as E, isDevEnv as Re, isInputLike as ze, isSelectionLikeTool as Be, isShallowEqual as Ve, isTestEnv as He, isToolIcon as Ue, isWritableElement as We, muteFSAbortError as Ge, normalizeEOL as Ke, sceneCoordsToViewportCoords as qe, tupleToCoors as Je, updateActiveTool as D, updateObject as Ye, updateStable as Xe, viewportCoordsToSceneCoords as O } from "../../common/utils.js";
17
+ import { nanoid as Ze } from "../../libs/nanoid/index.js";
18
+ import { randomInteger as Qe } from "../../common/random.js";
19
+ import { normalizeLink as $e } from "../../common/url.js";
20
+ import "../../common/index.js";
21
+ import et from "../../libs/roughjs/rough.js";
22
+ import { hasBackground as tt } from "../../element/comparisons.js";
23
+ import { cropElement as nt, getUncroppedWidthAndHeight as rt } from "../../element/cropElement.js";
24
+ import { hasBoundTextElement as it, isArrowElement as at, isBindableElement as ot, isBindingElement as k, isBindingElementType as st, isBoundToContainer as ct, isElbowArrow as A, isEmbeddableElement as lt, isFlowchartNodeElement as ut, isFrameLikeElement as j, isIframeElement as dt, isIframeLikeElement as ft, isImageElement as M, isInitializedImageElement as pt, isLineElement as mt, isLinearElement as N, isLinearElementType as ht, isMagicFrameElement as gt, isSimpleArrow as _t, isTextBindableContainer as vt, isTextElement as P, isUsingAdaptiveRadius as yt } from "../../element/typeChecks.js";
25
+ import { excludeElementsInFramesFromSelection as bt, getElementsWithinSelection as xt, getSelectedElements as St, getSelectionStateForElements as Ct, isSomeElementSelected as wt, makeNextSelectedElementIds as F } from "../../element/selection.js";
26
+ import { getApproxMinLineHeight as Tt, getApproxMinLineWidth as Et, getLineHeightInPx as Dt, getMinTextElementWidth as Ot, isMeasureTextSupported as kt, measureText as At, normalizeText as jt } from "../../element/textMeasurements.js";
27
+ import { wrapText as Mt } from "../../element/textWrapping.js";
28
+ import { getBoundTextElement as Nt, getContainerCenter as Pt, getContainerElement as Ft, isValidTextContainer as It, redrawTextBoundingBox as Lt } from "../../element/textElement.js";
29
+ import { editGroupForSelectedElement as Rt, getElementsInGroup as zt, getSelectedGroupIdForElement as Bt, getSelectedGroupIds as Vt, isElementInGroup as Ht, isSelectedViaGroup as Ut, selectGroupsForSelectedElements as I } from "../../element/groups.js";
30
+ import { mutateElement as Wt, newElementWith as L } from "../../element/mutateElement.js";
31
+ import { addElementsToFrame as Gt, elementOverlapsWithFrame as Kt, filterElementsEligibleAsFrameChildren as qt, getContainingFrame as Jt, getElementsInNewFrame as Yt, getElementsInResizingFrame as Xt, getElementsOverlappingFrame as Zt, getFrameChildren as Qt, getFrameLikeTitle as $t, isCursorInFrame as en, isElementInFrame as tn, removeElementsFromFrame as nn, replaceAllElementsInFrame as rn, updateFrameMembershipOfSelectedElements as an } from "../../element/frame.js";
32
+ import { getRenderOpacity as on } from "../../element/renderElement.js";
33
+ import { ShapeCache as sn } from "../../element/shape.js";
34
+ import { getCornerRadius as cn, isPathALoop as ln } from "../../element/utils.js";
35
+ import { getHoveredElementForBinding as R, hitElementBoundText as un, hitElementBoundingBox as dn, hitElementBoundingBoxOnly as fn, hitElementItself as pn, isPointInElement as mn } from "../../element/collision.js";
36
+ import { bindOrUnbindBindingElement as hn, bindOrUnbindBindingElements as gn, calculateFixedPointForNonElbowArrowBinding as _n, fixBindingsAfterDeletion as vn, isBindingEnabled as yn, maxBindingDistance_simple as bn, shouldEnableBindingForPointerEvent as xn, updateBoundElements as Sn } from "../../element/binding.js";
37
+ import { syncInvalidIndices as Cn, syncMovedIndices as wn } from "../../element/fractionalIndex.js";
38
+ import { LinearElementEditor as z } from "../../element/linearElementEditor.js";
39
+ import { doBoundsIntersect as Tn, getCommonBounds as En, getElementAbsoluteCoords as Dn, getElementBounds as On, getVisibleSceneBounds as kn } from "../../element/bounds.js";
40
+ import { getNormalizedDimensions as An, isElementCompletelyInViewport as jn, isElementInViewport as Mn, isInvisiblySmallElement as Nn } from "../../element/sizeHelpers.js";
41
+ import { handleFocusPointDrag as Pn, handleFocusPointHover as Fn, handleFocusPointPointerDown as In, handleFocusPointPointerUp as Ln } from "../../element/arrows/focus.js";
42
+ import { maybeHandleArrowPointlikeDrag as Rn } from "../../element/arrows/helpers.js";
43
+ import { isNonDeletedElement as zn } from "../../element/is.js";
44
+ import { Scene as Bn } from "../../element/Scene.js";
45
+ import { deepCopyElement as Vn, duplicateElements as Hn } from "../../element/duplicate.js";
46
+ import { CaptureUpdateAction as B, Store as Un, StoreDelta as Wn, getObservedAppState as Gn } from "../../element/store.js";
47
+ import { dragNewElement as Kn, dragSelectedElements as qn, getDragOffsetXY as Jn } from "../../element/dragElements.js";
48
+ import { isElementLink as Yn, parseElementLinkFromURL as Xn } from "../../element/elementLink.js";
49
+ import { newArrowElement as Zn, newElement as Qn, newEmbeddableElement as $n, newFrameElement as er, newFreeDrawElement as tr, newIframeElement as nr, newImageElement as rr, newLinearElement as ir, newMagicFrameElement as ar, newTextElement as or, refreshTextDimensions as sr } from "../../element/newElement.js";
50
+ import { createSrcDoc as cr, embeddableURLValidator as lr, maybeParseEmbedSrc as ur } from "../../element/embeddable.js";
51
+ import { FlowChartCreator as dr, FlowChartNavigator as fr, getLinkDirectionFromKey as pr } from "../../element/flowchart.js";
52
+ import { getInitializedImageElements as mr, normalizeSVG as hr, updateImageCache as gr } from "../../element/image.js";
53
+ import { positionElementsOnGrid as _r } from "../../element/positionElementsOnGrid.js";
54
+ import { getResizeArrowDirection as vr, getResizeOffsetXY as yr, transformElements as br } from "../../element/resizeElements.js";
55
+ import { hasBoundingBox as xr } from "../../element/transformHandles.js";
56
+ import { getCursorForResizingElement as Sr, getElementWithTransformHandleType as Cr, getTransformHandleTypeFromCoords as wr } from "../../element/resizeTest.js";
57
+ import { convertToDrawElements as Tr } from "../../element/transform.js";
58
+ import "../../element/index.js";
59
+ import { trackEvent as V } from "../analytics.js";
60
+ import { ActionManager as Er } from "../actions/manager.js";
61
+ import { getDefaultAppState as Dr, isEraserActive as Or, isHandToolActive as kr } from "../appState.js";
62
+ import { History as Ar } from "../history.js";
63
+ import { AppContext as jr, AppPropsContext as Mr, DrawActionManagerContext as Nr, DrawAppStateContext as Pr, DrawContainerContext as Fr, DrawElementsContext as Ir, DrawHistoryContext as Lr, DrawSetAppStateContext as Rr, EditorInterfaceContext as zr, editorInterfaceContextInitialValue as Br } from "./context.js";
64
+ import { editorJotaiStore as Vr } from "../editor-jotai.js";
65
+ import { defaultLang as Hr, getLanguage as Ur, languages as Wr, setLanguage as Gr, t as H } from "../i18n.js";
66
+ import { getNormalizedZoom as Kr } from "../scene/normalize.js";
67
+ import { calculateScrollCenter as qr } from "../scene/scroll.js";
68
+ import "../scene/index.js";
69
+ import { actions as Jr } from "../actions/register.js";
70
+ import { actionDeleteSelected as Yr } from "../actions/actionDeleteSelected.js";
71
+ import { getShortcutKey as Xr } from "../shortcut.js";
72
+ import { actionDuplicateSelection as Zr } from "../actions/actionDuplicateSelection.js";
73
+ import { ImageSceneDataError as Qr } from "../errors.js";
74
+ import { fileOpen as $r } from "../data/filesystem.js";
75
+ import { Fonts as ei } from "../fonts/Fonts.js";
76
+ import "../fonts/index.js";
77
+ import { restoreAppState as ti, restoreElements as ni } from "../data/restore.js";
78
+ import { ImageURLToFile as ri, SVGStringToFile as ii, dataURLToString as ai, generateIdFromFile as oi, getDataURL as si, getDataURL_sync as ci, isImageFileHandle as li, isSupportedImageFile as ui, loadFromBlob as di, loadSceneOrLibraryFromBlob as fi, normalizeFile as pi, parseLibraryJSON as mi, resizeImageFile as hi } from "../data/blob.js";
79
+ import { copyTextToSystemClipboard as gi, parseClipboard as _i, parseDataTransferEvent as vi } from "../clipboard.js";
80
+ import { MagicIcon as yi } from "./icons.js";
81
+ import { actionSelectAll as bi } from "../actions/actionSelectAll.js";
82
+ import { actionBringForward as xi, actionBringToFront as Si, actionSendBackward as Ci, actionSendToBack as wi } from "../actions/actionZindex.js";
83
+ import { resetCursor as U, setCursor as W, setCursorForShape as G, setEraserCursor as Ti } from "../cursor.js";
84
+ import { getStateForZoom as Ei } from "../scene/zoom.js";
85
+ import { actionToggleHandTool as Di, zoomToFit as Oi } from "../actions/actionCanvas.js";
86
+ import { actionFinalize as K } from "../actions/actionFinalize.js";
87
+ import { exportCanvas as ki } from "../data/utils.js";
88
+ import "../data/index.js";
89
+ import { actionCopyStyles as Ai, actionPasteStyles as ji } from "../actions/actionStyles.js";
90
+ import { actionGroup as Mi, actionUngroup as Ni } from "../actions/actionGroup.js";
91
+ import { actionAddToLibrary as Pi } from "../actions/actionAddToLibrary.js";
92
+ import { actionFlipHorizontal as Fi, actionFlipVertical as Ii } from "../actions/actionFlip.js";
93
+ import { actionCopy as Li, actionCopyAsPng as Ri, actionCopyAsSvg as zi, actionCut as Bi, actionPaste as Vi, copyText as Hi } from "../actions/actionClipboard.js";
94
+ import { actionToggleGridMode as Ui } from "../actions/actionToggleGridMode.js";
95
+ import { actionToggleObjectsSnapMode as Wi } from "../actions/actionToggleObjectsSnapMode.js";
96
+ import { actionToggleZenMode as Gi } from "../actions/actionToggleZenMode.js";
97
+ import { actionBindText as Ki, actionUnbindText as qi, actionWrapTextInContainer as Ji } from "../actions/actionBoundText.js";
98
+ import { actionToggleElementLock as Yi, actionUnlockAllElements as Xi } from "../actions/actionElementLock.js";
99
+ import { actionToggleLinearEditor as Zi } from "../actions/actionLinearEditor.js";
100
+ import { actionToggleStats as Qi } from "../actions/actionToggleStats.js";
101
+ import { actionToggleCropEditor as $i } from "../actions/actionCropEditor.js";
102
+ import "../actions/index.js";
103
+ import { actionCopyElementLink as ea } from "../actions/actionElementLink.js";
104
+ import { actionRemoveAllElementsFromFrame as ta, actionSelectAllElementsInFrame as na, actionWrapSelectionInFrame as ra } from "../actions/actionFrame.js";
105
+ import { createRedoAction as ia, createUndoAction as aa } from "../actions/actionHistory.js";
106
+ import { actionTextAutoResize as oa } from "../actions/actionTextAutoResize.js";
107
+ import { actionToggleViewMode as sa } from "../actions/actionToggleViewMode.js";
108
+ import { getShortcutFromShortcutName as ca } from "../actions/shortcuts.js";
109
+ import { AnimationFrameHandler as la } from "../animation-frame-handler.js";
110
+ import ua, { distributeLibraryItemsOnSquareGrid as da } from "../data/library.js";
111
+ import { EraserTrail as fa } from "../eraser/index.js";
112
+ import { getCenter as pa, getDistance as ma } from "../gesture.js";
113
+ import { LaserTrails as ha } from "../laser-trails.js";
114
+ import { LassoTrail as ga } from "../lasso/index.js";
115
+ import { withBatchedUpdates as q, withBatchedUpdatesThrottled as _a } from "../reactUtils.js";
116
+ import { Renderer as va } from "../scene/Renderer.js";
117
+ import { isOverScrollBars as ya } from "../scene/scrollbars.js";
118
+ import { SnapCache as J, getReferenceSnapPoints as ba, getSnapLinesAtPointer as xa, getVisibleGaps as Sa, isActiveToolNonLinearSnappable as Ca, isGridModeEnabled as wa, isSnappingEnabled as Ta, snapDraggedElements as Ea, snapNewElement as Da, snapResizingElements as Oa } from "../snapping.js";
119
+ import { textWysiwyg as ka } from "../wysiwyg/textWysiwyg.js";
120
+ import { activeConfirmDialogAtom as Aa } from "./ActiveConfirmDialog.js";
121
+ import ja from "./BraveMeasureTextError.js";
122
+ import { CONTEXT_MENU_SEPARATOR as Y, ContextMenu as Ma } from "./ContextMenu.js";
123
+ import Na, { convertElementTypePopupAtom as Pa, convertElementTypes as Fa, getConversionTypeFromElements as Ia } from "./ConvertElementTypePopup.js";
124
+ import { ElementCanvasButtons as La } from "./ElementCanvasButtons.js";
125
+ import { activeEyeDropperAtom as Ra } from "./EyeDropper.js";
126
+ import { findShapeByKey as za } from "./shapes.js";
127
+ import { searchItemInFocusAtom as Ba } from "./SearchMenu.js";
128
+ import Va from "./LayerUI.js";
129
+ import { ElementCanvasButton as Ha } from "./MagicButton.js";
130
+ import { SVGLayer as Ua } from "./SVGLayer.js";
131
+ import { Toast as Wa } from "./Toast.js";
132
+ import Ga from "./UnlockPopup.js";
133
+ import Ka from "./canvases/InteractiveCanvas.js";
134
+ import qa from "./canvases/StaticCanvas.js";
135
+ import "./canvases/index.js";
136
+ import Ja from "./canvases/NewElementCanvas.js";
137
+ import Ya, { Component as Xa } from "react";
138
+ import { UI_PC_PREFIX as Za } from "@unicom-cloud/utils/constants/ui";
139
+ import { Fragment as Qa, jsx as X, jsxs as $a } from "react/jsx-runtime";
140
+ import eo from "lodash/throttle";
141
+ import { flushSync as Z } from "react-dom";
142
+ import to from "@unicom-cloud/icons/IconUiCopy";
143
+ import * as no from "@unicom-cloud/utils/ui-color";
144
+ import ro from "@unicom-cloud/utils/class-name";
145
+ import io from "@unicom-cloud/icons/IconUiFullscreen";
146
+ import ao from "lodash/isUndefined";
147
+ //#region components/pc/draw/core/components/App.tsx
148
+ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
149
+ horizontal: null,
150
+ vertical: null
151
+ }, Q = 0, mo = !1, ho = !1, go = 0, _o = !1, vo = null, $ = {
152
+ pointers: /* @__PURE__ */ new Map(),
153
+ lastCenter: null,
154
+ initialDistance: null,
155
+ initialScale: null
156
+ }, yo = class yo extends Xa {
157
+ #e;
158
+ #t;
159
+ get rootElement() {
160
+ return this.getRootElement();
161
+ }
162
+ #n;
163
+ #r;
164
+ #i;
165
+ #a;
166
+ #o;
167
+ #s;
168
+ #c;
169
+ #l;
170
+ #u;
171
+ constructor(t) {
172
+ super(t), this.interactiveCanvas = null, this.unmounted = !1, this.editorInterface = Br, this.#e = le(Br), this.#t = Ya.createRef(), this.getRootElement = () => this.#t.current, this.files = {}, this.imageCache = /* @__PURE__ */ new Map(), this.#a = /* @__PURE__ */ new Map(), this.#o = /* @__PURE__ */ new Map(), this.#s = /* @__PURE__ */ new Set(), this.#c = () => {
173
+ this.setToast(null);
174
+ }, this.#l = /* @__PURE__ */ new Set(), this.flowChartCreator = new dr(), this.#u = new fr(), this.bindModeHandler = null, this.lastPointerDownEvent = null, this.lastPointerUpEvent = null, this.lastPointerMoveEvent = null, this.lastPointerMoveCoords = null, this.previousPointerMoveCoords = null, this.lastViewportPosition = {
175
+ x: 0,
176
+ y: 0
177
+ }, this.animationFrameHandler = new la(), this.laserTrails = new ha(this.animationFrameHandler, this), this.eraserTrail = new fa(this.animationFrameHandler, this), this.lassoTrail = new ga(this.animationFrameHandler, this), this.onChangeEmitter = new ge(), this.onPointerDownEmitter = new ge(), this.onPointerUpEmitter = new ge(), this.onScrollChangeEmitter = new ge(), this.missingPointerEventCleanupEmitter = new ge(), this.onRemoveEventListenersEmitter = new ge(), this.updateEditorAtom = (e, ...t) => {
178
+ let n = Vr.set(e, ...t);
179
+ return this.#se(), n;
180
+ }, this.#p = null, this.getEffectiveGridSize = () => wa(this) ? this.state.gridSize : null, this.#y = (e, t) => {
181
+ this.#o.set(e.id, t), sn.delete(e);
182
+ }, this.#b = () => {
183
+ let e = /* @__PURE__ */ new Set(), t = !1;
184
+ this.scene.getNonDeletedElements().filter((n) => {
185
+ if (lt(n)) {
186
+ if (e.add(n.id), !this.#o.has(n.id)) {
187
+ t = !0;
188
+ let e = lr(n.link, this.props.validateEmbeddable);
189
+ this.#y(n, e);
190
+ }
191
+ } else dt(n) && e.add(n.id);
192
+ return !1;
193
+ }), t && this.scene.triggerUpdate(), this.#a.forEach((t, n) => {
194
+ e.has(n) || this.#a.delete(n);
195
+ });
196
+ }, this.#S = (e) => `${this.id}-frame-name-${e.id}`, this.frameNameBoundsCache = {
197
+ get: (e) => {
198
+ let t = this.frameNameBoundsCache._cache.get(e.id);
199
+ if (!t || t.zoom !== this.state.zoom.value || t.versionNonce !== e.versionNonce) {
200
+ let n = document.getElementById(this.#S(e));
201
+ if (n) {
202
+ let r = n.getBoundingClientRect(), i = O({
203
+ clientX: r.x,
204
+ clientY: r.y
205
+ }, this.state), a = O({
206
+ clientX: r.right,
207
+ clientY: r.bottom
208
+ }, this.state);
209
+ return t = {
210
+ x: i.x,
211
+ y: i.y,
212
+ width: a.x - i.x,
213
+ height: a.y - i.y,
214
+ angle: 0,
215
+ zoom: this.state.zoom.value,
216
+ versionNonce: e.versionNonce
217
+ }, this.frameNameBoundsCache._cache.set(e.id, t), t;
218
+ }
219
+ return null;
220
+ }
221
+ return t;
222
+ },
223
+ _cache: /* @__PURE__ */ new Map()
224
+ }, this.#C = (e) => {
225
+ e && this.scene.mutateElement(e, { name: e.name?.trim?.() || null }), this.setState({ editingFrame: null });
226
+ }, this.#T = () => {
227
+ if (!this.state.frameRendering.enabled || !this.state.frameRendering.name) return this.state.editingFrame && this.#C(null), null;
228
+ let e = this.scene.getNonDeletedFramesLikes(), t = e.length > 0 && this.state.searchMatches?.focusedId && j(this.scene.getElement(this.state.searchMatches.focusedId)) ? this.state.searchMatches.matches.find((e) => e.focus) : null;
229
+ return e.map((e) => {
230
+ if (!Mn(e, this.canvas.width / window.devicePixelRatio, this.canvas.height / window.devicePixelRatio, {
231
+ offsetLeft: this.state.offsetLeft,
232
+ offsetTop: this.state.offsetTop,
233
+ scrollX: this.state.scrollX,
234
+ scrollY: this.state.scrollY,
235
+ zoom: this.state.zoom
236
+ }, this.scene.getNonDeletedElementsMap())) return this.state.editingFrame === e.id && this.#C(e), null;
237
+ let { x: n, y: r } = qe({
238
+ sceneX: e.x,
239
+ sceneY: e.y
240
+ }, this.state), i, o = $t(e);
241
+ if (e.id === this.state.editingFrame) {
242
+ let t = o;
243
+ i = /* @__PURE__ */ X("input", {
244
+ autoFocus: !0,
245
+ value: t,
246
+ onChange: (t) => {
247
+ this.scene.mutateElement(e, { name: t.target.value });
248
+ },
249
+ onFocus: (e) => e.target.select(),
250
+ onBlur: () => this.#C(e),
251
+ onKeyDown: (t) => {
252
+ (t.key === x.ESCAPE || t.key === x.ENTER) && this.#C(e);
253
+ },
254
+ style: {
255
+ background: this.#w ? a(this.state.viewBackgroundColor) : this.state.viewBackgroundColor,
256
+ zIndex: 2,
257
+ border: "none",
258
+ display: "block",
259
+ padding: "6px",
260
+ borderRadius: 4,
261
+ boxShadow: "inset 0 0 0 1px var(--color-primary)",
262
+ fontFamily: "Assistant",
263
+ fontSize: `${g.nameFontSize}px`,
264
+ transform: "translate(-6px, 6px)",
265
+ color: this.#w ? g.nameColorDarkTheme : g.nameColorLightTheme,
266
+ overflow: "hidden",
267
+ maxWidth: `${document.body.clientWidth - n - 6}px`
268
+ },
269
+ size: t.length + 1 || 1,
270
+ dir: "auto",
271
+ autoComplete: "off",
272
+ autoCapitalize: "off",
273
+ autoCorrect: "off"
274
+ });
275
+ } else i = o;
276
+ return /* @__PURE__ */ X("div", {
277
+ id: this.#S(e),
278
+ className: l.FRAME_NAME,
279
+ style: {
280
+ position: "absolute",
281
+ bottom: `${this.state.height + g.nameOffsetY - r + this.state.offsetTop}px`,
282
+ left: `${n - this.state.offsetLeft}px`,
283
+ zIndex: 2,
284
+ fontSize: g.nameFontSize,
285
+ color: this.#w ? g.nameColorDarkTheme : g.nameColorLightTheme,
286
+ lineHeight: g.nameLineHeight,
287
+ width: "max-content",
288
+ maxWidth: t?.id === e.id && t?.focus ? "none" : `${e.width * this.state.zoom.value}px`,
289
+ overflow: e.id === this.state.editingFrame ? "visible" : "hidden",
290
+ whiteSpace: "nowrap",
291
+ textOverflow: "ellipsis",
292
+ cursor: u.MOVE,
293
+ pointerEvents: this.state.viewModeEnabled ? te.disabled : te.enabled
294
+ },
295
+ onPointerDown: (e) => this.#Ne(e),
296
+ onWheel: (e) => this.#wt(e),
297
+ onContextMenu: this.#yt,
298
+ onDoubleClick: () => {
299
+ this.setState({ editingFrame: e.id });
300
+ },
301
+ children: i
302
+ }, e.id);
303
+ });
304
+ }, this.render = () => {
305
+ let t = this.scene.getSelectedElements(this.state), { renderTopRightUI: n, renderTopLeftUI: i, renderCustomStats: a } = this.props, o = this.scene.getSceneNonce(), { elementsMap: s, visibleElements: c } = this.renderer.getRenderableElements({
306
+ sceneNonce: o,
307
+ zoom: this.state.zoom,
308
+ offsetLeft: this.state.offsetLeft,
309
+ offsetTop: this.state.offsetTop,
310
+ scrollX: this.state.scrollX,
311
+ scrollY: this.state.scrollY,
312
+ height: this.state.height,
313
+ width: this.state.width,
314
+ editingTextElement: this.state.editingTextElement,
315
+ newElementId: this.state.newElement?.id
316
+ });
317
+ this.visibleElements = c;
318
+ let l = this.scene.getNonDeletedElementsMap(), u = "setPointerCapture" in HTMLElement.prototype ? !1 : this.state.selectionElement || this.state.newElement || this.state.selectedElementsAreBeingDragged || this.state.resizingElement || this.state.activeTool.type === "laser" && this.state.cursorButton === "down", d = t[0], f = Vr.get(Pa)?.type === "panel";
319
+ return /* @__PURE__ */ X(r, {
320
+ componentConfig: {
321
+ Trigger: { className: `${Za}-draw-trigger` },
322
+ Modal: { className: `${Za}-draw-modal` },
323
+ Drawer: { className: `${Za}-draw-drawer` },
324
+ Notice: { className: `${Za}-draw-notice` }
325
+ },
326
+ children: /* @__PURE__ */ X("div", {
327
+ translate: "no",
328
+ className: ro("draw draw-container notranslate", {
329
+ "draw--view-mode": this.state.viewModeEnabled || this.state.openDialog?.name === "elementLinkSelector",
330
+ "draw--mobile": this.editorInterface.formFactor === "phone"
331
+ }, this.props.className),
332
+ style: {
333
+ "--ui-pointerEvents": u ? te.disabled : te.enabled,
334
+ "--right-sidebar-width": "302px",
335
+ ...this.props.style
336
+ },
337
+ ref: this.#t,
338
+ onDrop: this.#vt,
339
+ tabIndex: 0,
340
+ onKeyDown: this.props.handleKeyboardGlobally ? void 0 : this.#le,
341
+ onPointerEnter: this.#E,
342
+ onPointerLeave: this.#E,
343
+ children: /* @__PURE__ */ X(e.Consumer, { children: (e) => /* @__PURE__ */ X(jr.Provider, {
344
+ value: this,
345
+ children: /* @__PURE__ */ X(Mr.Provider, {
346
+ value: this.props,
347
+ children: /* @__PURE__ */ X(Fr.Provider, {
348
+ value: this.drawContainerValue,
349
+ children: /* @__PURE__ */ X(zr.Provider, {
350
+ value: this.editorInterface,
351
+ children: /* @__PURE__ */ X(Rr.Provider, {
352
+ value: this.setAppState,
353
+ children: /* @__PURE__ */ X(Pr.Provider, {
354
+ value: this.state,
355
+ children: /* @__PURE__ */ X(Ir.Provider, {
356
+ value: this.scene.getNonDeletedElements(),
357
+ children: /* @__PURE__ */ $a(Lr.Provider, {
358
+ value: this.#i,
359
+ children: [/* @__PURE__ */ $a(Nr.Provider, {
360
+ value: this.actionManager,
361
+ children: [
362
+ /* @__PURE__ */ X(Va, {
363
+ canvas: this.canvas,
364
+ appState: this.state,
365
+ files: this.files,
366
+ setAppState: this.setAppState,
367
+ actionManager: this.actionManager,
368
+ elements: this.scene.getNonDeletedElements(),
369
+ onLockToggle: this.toggleLock,
370
+ onPenModeToggle: this.togglePenMode,
371
+ onHandToolToggle: this.onHandToolToggle,
372
+ langCode: Ur().code,
373
+ renderTopLeftUI: i,
374
+ renderTopRightUI: n,
375
+ renderCustomStats: a,
376
+ showExitZenModeBtn: this.props?.zenModeEnabled === void 0 && this.state.zenModeEnabled,
377
+ UIOptions: this.props.UIOptions,
378
+ onExportImage: this.onExportImage,
379
+ renderWelcomeScreen: !this.state.isLoading && this.state.showWelcomeScreen && this.state.activeTool.type === this.state.preferredSelectionTool.type && !this.state.zenModeEnabled && !this.scene.getElementsIncludingDeleted().length,
380
+ app: this,
381
+ isCollaborating: this.props.isCollaborating,
382
+ generateLinkForSelection: this.props.generateLinkForSelection,
383
+ children: this.props.children
384
+ }),
385
+ /* @__PURE__ */ X("div", { className: "draw-textEditorContainer" }),
386
+ /* @__PURE__ */ X("div", { className: "draw-contextMenuContainer" }),
387
+ /* @__PURE__ */ X("div", { className: "draw-eye-dropper-container" }),
388
+ /* @__PURE__ */ X(Ua, { trails: [
389
+ this.laserTrails,
390
+ this.lassoTrail,
391
+ this.eraserTrail
392
+ ] }),
393
+ this.props.aiEnabled !== !1 && t.length === 1 && gt(d) && /* @__PURE__ */ X(La, {
394
+ element: d,
395
+ elementsMap: s,
396
+ children: /* @__PURE__ */ X(Ha, {
397
+ title: H("labels.convertToCode"),
398
+ icon: yi,
399
+ checked: !1,
400
+ onChange: () => this.#k(d, "button")
401
+ })
402
+ }),
403
+ t.length === 1 && dt(d) && d.customData?.generationData?.status === "done" && /* @__PURE__ */ $a(La, {
404
+ element: d,
405
+ elementsMap: s,
406
+ children: [/* @__PURE__ */ X(Ha, {
407
+ title: H("labels.copySource"),
408
+ icon: /* @__PURE__ */ X(to, {}),
409
+ checked: !1,
410
+ onChange: () => this.#A(d)
411
+ }), /* @__PURE__ */ X(Ha, {
412
+ title: "Enter fullscreen",
413
+ icon: /* @__PURE__ */ X(io, {}),
414
+ checked: !1,
415
+ onChange: () => {
416
+ let e = this.#g(d);
417
+ if (e) try {
418
+ e.requestFullscreen(), this.setState({
419
+ activeEmbeddable: {
420
+ element: d,
421
+ state: "active"
422
+ },
423
+ selectedElementIds: { [d.id]: !0 },
424
+ newElement: null,
425
+ selectionElement: null
426
+ });
427
+ } catch (e) {
428
+ console.warn(e), this.setState({ errorMessage: "Couldn't enter fullscreen" });
429
+ }
430
+ }
431
+ })]
432
+ }),
433
+ this.state.toast !== null && /* @__PURE__ */ X(Wa, {
434
+ message: this.state.toast.message,
435
+ duration: this.state.toast.duration,
436
+ closable: this.state.toast.closable,
437
+ onClose: this.#c
438
+ }),
439
+ this.state.contextMenu && /* @__PURE__ */ X(Ma, {
440
+ items: this.state.contextMenu.items,
441
+ top: this.state.contextMenu.top,
442
+ left: this.state.contextMenu.left,
443
+ actionManager: this.actionManager,
444
+ onClose: (e) => {
445
+ this.setState({ contextMenu: null }, () => {
446
+ this.focusContainer(), e?.();
447
+ });
448
+ }
449
+ }),
450
+ /* @__PURE__ */ X(qa, {
451
+ canvas: this.canvas,
452
+ rc: this.rc,
453
+ elementsMap: s,
454
+ allElementsMap: l,
455
+ visibleElements: c,
456
+ sceneNonce: o,
457
+ selectionNonce: this.state.selectionElement?.versionNonce,
458
+ scale: window.devicePixelRatio,
459
+ appState: this.state,
460
+ renderConfig: {
461
+ imageCache: this.imageCache,
462
+ isExporting: !1,
463
+ renderGrid: wa(this),
464
+ canvasBackgroundColor: this.state.viewBackgroundColor,
465
+ embedsValidationStatus: this.#o,
466
+ elementsPendingErasure: this.#l,
467
+ pendingFlowchartNodes: this.flowChartCreator.pendingNodes,
468
+ theme: this.state.theme
469
+ }
470
+ }),
471
+ this.state.newElement && /* @__PURE__ */ X(Ja, {
472
+ appState: this.state,
473
+ scale: window.devicePixelRatio,
474
+ rc: this.rc,
475
+ elementsMap: s,
476
+ allElementsMap: l,
477
+ renderConfig: {
478
+ imageCache: this.imageCache,
479
+ isExporting: !1,
480
+ renderGrid: !1,
481
+ canvasBackgroundColor: this.state.viewBackgroundColor,
482
+ embedsValidationStatus: this.#o,
483
+ elementsPendingErasure: this.#l,
484
+ pendingFlowchartNodes: null,
485
+ theme: this.state.theme
486
+ }
487
+ }),
488
+ /* @__PURE__ */ X(Ka, {
489
+ app: this,
490
+ containerRef: this.#t,
491
+ canvas: this.interactiveCanvas,
492
+ elementsMap: s,
493
+ visibleElements: c,
494
+ allElementsMap: l,
495
+ selectedElements: t,
496
+ sceneNonce: o,
497
+ selectionNonce: this.state.selectionElement?.versionNonce,
498
+ scale: window.devicePixelRatio,
499
+ appState: this.state,
500
+ renderScrollbars: this.props.renderScrollbars === !0,
501
+ editorInterface: this.editorInterface,
502
+ renderInteractiveSceneCallback: this.#J,
503
+ handleCanvasRef: this.#gt,
504
+ onContextMenu: this.#yt,
505
+ onPointerMove: this.#Ae,
506
+ onPointerUp: this.#Pe,
507
+ onPointerCancel: this.removePointer,
508
+ onTouchMove: this.#Me,
509
+ onPointerDown: this.#Ne,
510
+ onDoubleClick: this.#Oe
511
+ }),
512
+ this.#T(),
513
+ this.state.activeLockedId && /* @__PURE__ */ X(Ga, {
514
+ app: this,
515
+ activeLockedId: this.state.activeLockedId
516
+ }),
517
+ f && /* @__PURE__ */ X(Na, { app: this })
518
+ ]
519
+ }), this.#x()]
520
+ })
521
+ })
522
+ })
523
+ })
524
+ })
525
+ })
526
+ })
527
+ }) })
528
+ })
529
+ });
530
+ }, this.focusContainer = () => {
531
+ this.rootElement?.focus?.();
532
+ }, this.getSceneElementsIncludingDeleted = () => this.scene.getElementsIncludingDeleted(), this.getSceneElementsMapIncludingDeleted = () => this.scene.getElementsMapIncludingDeleted(), this.getSceneElements = () => this.scene.getNonDeletedElements(), this.onInsertElements = (e) => {
533
+ this.addElementsFromPasteOrLibrary({
534
+ elements: e,
535
+ position: "center",
536
+ files: null
537
+ });
538
+ }, this.onExportImage = async (e, t, n) => {
539
+ V("export", e, "ui");
540
+ let r = await ki(e, t, this.state, this.files, {
541
+ exportBackground: this.state.exportBackground,
542
+ name: this.getName(),
543
+ viewBackgroundColor: this.state.viewBackgroundColor,
544
+ exportingFrame: n.exportingFrame
545
+ }).catch(Ge).catch((e) => {
546
+ console.error(e), this.setState({ errorMessage: e.message });
547
+ });
548
+ this.state.exportEmbedScene && r && li(r) && this.setState({ fileHandle: r });
549
+ }, this.#D = /* @__PURE__ */ new Map(), this.#O = ({ frameElement: e, data: t }) => {
550
+ t.status === "pending" ? this.scene.mutateElement(e, { customData: { generationData: void 0 } }, {
551
+ informMutation: !1,
552
+ isDragging: !1
553
+ }) : this.scene.mutateElement(e, { customData: { generationData: t } }, {
554
+ informMutation: !1,
555
+ isDragging: !1
556
+ }), this.#D.set(e.id, t), this.#se();
557
+ }, this.plugins = {}, this.onMagicframeToolSelect = () => {
558
+ let e = this.scene.getSelectedElements({ selectedElementIds: this.state.selectedElementIds });
559
+ if (e.length === 0) this.setActiveTool({ type: b.magicframe }), V("ai", "tool-select (empty-selection)", "d2c");
560
+ else {
561
+ let t = e.length === 1 && gt(e[0]) && e[0];
562
+ if (!t && e.some((e) => j(e) || e.frameId)) {
563
+ this.setActiveTool({ type: b.magicframe });
564
+ return;
565
+ }
566
+ V("ai", "tool-select (existing selection)", "d2c");
567
+ let n;
568
+ if (t) n = t;
569
+ else {
570
+ let [t, r, i, a] = En(e);
571
+ n = ar({
572
+ ...g,
573
+ x: t - 50,
574
+ y: r - 50,
575
+ width: i - t + 100,
576
+ height: a - r + 100,
577
+ opacity: 100,
578
+ locked: !1
579
+ }), this.scene.insertElement(n);
580
+ for (let t of e) this.scene.mutateElement(t, { frameId: n.id });
581
+ this.setState({ selectedElementIds: { [n.id]: !0 } });
582
+ }
583
+ this.#k(n, "upstream");
584
+ }
585
+ }, this.#j = ({ type: e }) => {
586
+ this.updateEditorAtom(Ra, {
587
+ swapPreviewOnAlt: !0,
588
+ colorPickerType: e === "stroke" ? "elementStroke" : "elementBackground",
589
+ onSelect: (t, n) => {
590
+ let r = e === "background" && n.altKey || e === "stroke" && !n.altKey;
591
+ !this.scene.getSelectedElements(this.state).length || this.state.activeTool.type !== "selection" ? r ? this.syncActionResult({
592
+ appState: {
593
+ ...this.state,
594
+ currentItemStrokeColor: t
595
+ },
596
+ captureUpdate: B.IMMEDIATELY
597
+ }) : this.syncActionResult({
598
+ appState: {
599
+ ...this.state,
600
+ currentItemBackgroundColor: t
601
+ },
602
+ captureUpdate: B.IMMEDIATELY
603
+ }) : this.updateScene({
604
+ elements: this.scene.getElementsIncludingDeleted().map((e) => this.state.selectedElementIds[e.id] ? L(e, { [r ? "strokeColor" : "backgroundColor"]: t }) : e),
605
+ captureUpdate: B.IMMEDIATELY
606
+ });
607
+ },
608
+ keepOpenOnAlt: !1
609
+ });
610
+ }, this.dismissLinearEditor = () => {
611
+ setTimeout(() => {
612
+ this.state.selectedLinearElement?.isEditing && this.setState({ selectedLinearElement: {
613
+ ...this.state.selectedLinearElement,
614
+ isEditing: !1
615
+ } });
616
+ });
617
+ }, this.syncActionResult = q((e) => {
618
+ if (this.unmounted || e === !1) return;
619
+ this.#r.scheduleAction(e.captureUpdate);
620
+ let t = !1, n = null;
621
+ if (e.elements && (this.scene.replaceAllElements(e.elements), t = !0), e.files && (this.#oe(e.files, e.replaceFiles), this.#ft()), e.appState || n || this.state.contextMenu) {
622
+ let r = e?.appState?.viewModeEnabled || !1, i = e?.appState?.zenModeEnabled || !1, a = e?.appState?.theme || this.props.theme || re.LIGHT, o = e?.appState?.name ?? this.state.name, s = e?.appState?.errorMessage ?? this.state.errorMessage;
623
+ this.props.viewModeEnabled !== void 0 && (r = this.props.viewModeEnabled), this.props.zenModeEnabled !== void 0 && (i = this.props.zenModeEnabled), n = e.appState?.editingTextElement || null, e.elements && n && e.elements.forEach((e) => {
624
+ n?.id === e.id && n !== e && zn(e) && P(e) && (n = e);
625
+ }), n?.isDeleted && (n = null), this.setState((t) => {
626
+ let c = e.appState || {};
627
+ return {
628
+ ...t,
629
+ ...c,
630
+ contextMenu: null,
631
+ editingTextElement: n,
632
+ viewModeEnabled: r,
633
+ zenModeEnabled: i,
634
+ theme: a,
635
+ name: o,
636
+ errorMessage: s
637
+ };
638
+ }), t = !0;
639
+ }
640
+ t || this.scene.triggerUpdate();
641
+ }), this.#M = q(() => {
642
+ lo = !1, this.setState({ isBindingEnabled: !0 });
643
+ }), this.#N = () => {
644
+ this.#M();
645
+ }, this.#P = (e) => {
646
+ e.preventDefault();
647
+ }, this.#F = () => {
648
+ this.#i.clear();
649
+ }, this.#I = () => {
650
+ this.#r.clear();
651
+ }, this.#L = q((e) => {
652
+ this.scene.replaceAllElements([]), this.setState((t) => ({
653
+ ...Dr(),
654
+ isLoading: e?.resetLoadingState ? !1 : t.isLoading,
655
+ theme: this.state.theme
656
+ })), this.#I(), this.#F();
657
+ }), this.#R = async () => {
658
+ "launchQueue" in window && "LaunchParams" in window && window.launchQueue.setConsumer(async (e) => {
659
+ if (!e.files.length) return;
660
+ let t = e.files[0], n = await t.getFile();
661
+ this.loadFileToCanvas(new File([n], n.name || "", { type: n.type }), t);
662
+ }), this.props.theme && this.setState({ theme: this.props.theme }), this.state.isLoading || this.setState({ isLoading: !0 });
663
+ let e = null;
664
+ try {
665
+ e = typeof this.props.initialData == "function" ? await this.props.initialData() || null : await this.props.initialData || null, e?.libraryItems && this.library.updateLibrary({
666
+ libraryItems: e.libraryItems,
667
+ merge: !0
668
+ }).catch((e) => {
669
+ console.error(e);
670
+ });
671
+ } catch (t) {
672
+ console.error(t), e = { appState: { errorMessage: t.message || "Encountered an error during importing or restoring scene data" } };
673
+ }
674
+ let t = ni(e?.elements, null, {
675
+ repairBindings: !0,
676
+ deleteInvisibleElements: !0
677
+ }), n = ti(e?.appState, null), r = n.activeTool;
678
+ n.preferredSelectionTool.initialized || (n.preferredSelectionTool = {
679
+ type: this.editorInterface.formFactor === "phone" ? "lasso" : "selection",
680
+ initialized: !0
681
+ }), n = {
682
+ ...n,
683
+ theme: this.props.theme || n.theme,
684
+ openSidebar: n?.openSidebar || this.state.openSidebar,
685
+ activeTool: r.type === "image" || r.type === "lasso" || r.type === "selection" ? {
686
+ ...r,
687
+ type: n.preferredSelectionTool.type
688
+ } : n.activeTool,
689
+ isLoading: !1,
690
+ toast: this.state.toast
691
+ }, e?.scrollToContent && (n = {
692
+ ...n,
693
+ ...qr(t, {
694
+ ...n,
695
+ width: this.state.width,
696
+ height: this.state.height,
697
+ offsetTop: this.state.offsetTop,
698
+ offsetLeft: this.state.offsetLeft
699
+ })
700
+ }), this.#I(), this.#F(), this.syncActionResult({
701
+ elements: t,
702
+ appState: n,
703
+ files: e?.files,
704
+ captureUpdate: B.NEVER
705
+ }), this.#H(), this.fonts.loadSceneFonts().then((e) => {
706
+ this.fonts.onLoaded(e);
707
+ }), Yn(window.location.href) && this.scrollToContent(window.location.href, { animate: !1 });
708
+ }, this.#z = (e, t) => this.props.UIOptions.getFormFactor?.(e, t) ?? ue(e, t), this.refreshEditorInterface = () => {
709
+ let e = this.rootElement;
710
+ if (!e) return;
711
+ let { width: t, height: n } = e.getBoundingClientRect(), r = me(), i = ce(typeof navigator < "u" ? navigator.userAgent : ""), a = this.props.UIOptions.dockedSidebarBreakpoint == null ? se : this.props.UIOptions.dockedSidebarBreakpoint, o = Ye(this.editorInterface, {
712
+ desktopUIMode: r ?? this.editorInterface.desktopUIMode,
713
+ formFactor: this.#z(t, n),
714
+ userAgent: i,
715
+ canFitSidebar: t > a,
716
+ isLandscape: t > n
717
+ });
718
+ this.editorInterface = o, this.#B(o);
719
+ }, this.#B = (e) => {
720
+ let t = le(e);
721
+ if (t === this.#e) return;
722
+ let n = this.#e;
723
+ this.#e = t, n !== "full" && t === "full" && this.setState((e) => ({ preferredSelectionTool: {
724
+ type: "selection",
725
+ initialized: !0
726
+ } }));
727
+ }, this.#V = (e) => {
728
+ let t = he(e);
729
+ this.editorInterface = Ye(this.editorInterface, { desktopUIMode: t }), this.#B(this.editorInterface);
730
+ }, this.#U = (e) => {
731
+ let { key: t, value: n } = e ?? {};
732
+ t !== "draw" && (n ? this.setState({ theme: re.DARK }) : this.setState({ theme: re.LIGHT }));
733
+ }, this.#W = q(() => {
734
+ this.scene.getElementsIncludingDeleted().forEach((e) => sn.delete(e)), this.refreshEditorInterface(), this.#Ot(), this.setState({});
735
+ }), this.#G = () => {
736
+ !document.fullscreenElement && this.state.activeEmbeddable?.state === "active" && this.setState({ activeEmbeddable: null });
737
+ }, this.#J = ({ atLeastOneVisibleElement: e, scrollBars: t, elementsMap: n }) => {
738
+ t && (po = t);
739
+ let r = this.state.editingTextElement ? !1 : !e && n.size > 0;
740
+ this.state.scrolledOutside !== r && this.setState({ scrolledOutside: r }), this.#pt();
741
+ }, this.#Y = je(() => {
742
+ let { offsetTop: e, offsetLeft: t } = this.#kt();
743
+ this.setState((n) => n.offsetLeft === t && n.offsetTop === e ? null : {
744
+ offsetTop: e,
745
+ offsetLeft: t
746
+ });
747
+ }, 100), this.#X = q((e) => {
748
+ !this.rootElement?.contains?.(document.activeElement) || We(e.target) || (this.actionManager.executeAction(Bi, "keyboard", e), e.preventDefault(), e.stopPropagation());
749
+ }), this.#Z = q((e) => {
750
+ !this.rootElement?.contains?.(document.activeElement) || We(e.target) || (this.actionManager.executeAction(Li, "keyboard", e), e.preventDefault(), e.stopPropagation());
751
+ }), this.#$ = (e) => {
752
+ if (fe && e.preventDefault(), !oo) {
753
+ oo = !0, e.touches.length === 1 && (co = {
754
+ x: e.touches[0].clientX,
755
+ y: e.touches[0].clientY
756
+ }), clearTimeout(so), so = window.setTimeout(yo.#Q, 300);
757
+ return;
758
+ }
759
+ if (oo && e.touches.length === 1 && co) {
760
+ let t = e.touches[0];
761
+ Oe(S(t.clientX, t.clientY), S(co.x, co.y)) <= 35 && (this.lassoTrail.endPath(), this.#ye(), this.#Oe({
762
+ clientX: t.clientX,
763
+ clientY: t.clientY
764
+ })), oo = !1, clearTimeout(so);
765
+ }
766
+ e.touches.length === 2 && this.setState({
767
+ selectedElementIds: F({}, this.state),
768
+ activeEmbeddable: null
769
+ });
770
+ }, this.#ee = (e) => {
771
+ this.#Ie(), e.touches.length > 0 ? this.setState({
772
+ previousSelectedElementIds: {},
773
+ selectedElementIds: F(this.state.previousSelectedElementIds, this.state)
774
+ }) : $.pointers.clear();
775
+ }, this.pasteFromClipboard = q(async (e) => {
776
+ let t = !!ho, n = document.activeElement, r = this.rootElement?.contains?.(n);
777
+ if (e && !r) return;
778
+ let i = document.elementFromPoint(this.lastViewportPosition.x, this.lastViewportPosition.y);
779
+ if (e && (!(i instanceof HTMLCanvasElement) || We(n))) return;
780
+ let a = await vi(e), o = a.getFiles(), s = await _i(a, t);
781
+ if (this.props.onPaste) try {
782
+ if (await this.props.onPaste(s, e) === !1) return;
783
+ } catch (e) {
784
+ console.error(e);
785
+ }
786
+ await this.#te(s, o, t), this.setActiveTool({ type: this.state.preferredSelectionTool.type }, !0), e?.preventDefault?.();
787
+ }), this.addElementsFromPasteOrLibrary = (e) => {
788
+ let t = ni(e.elements, null, { deleteInvisibleElements: !0 }), [n, r, i, a] = En(t), o = Me(n, i) / 2, s = Me(r, a) / 2, { x: c, y: l } = O({
789
+ clientX: typeof e.position == "object" ? e.position.clientX : e.position === "cursor" ? this.lastViewportPosition.x : this.state.width / 2 + this.state.offsetLeft,
790
+ clientY: typeof e.position == "object" ? e.position.clientY : e.position === "cursor" ? this.lastViewportPosition.y : this.state.height / 2 + this.state.offsetTop
791
+ }, this.state), [u, d] = C(c - o, l - s, this.getEffectiveGridSize()), { duplicatedElements: f } = Hn({
792
+ type: "everything",
793
+ elements: t.map((e) => L(e, {
794
+ x: e.x + u - n,
795
+ y: e.y + d - r
796
+ })),
797
+ randomizeSeed: !e.retainSeed
798
+ }), p = this.scene.getElementsIncludingDeleted(), m = [...p, ...f];
799
+ m = this.props.onDuplicate?.(m, p) || m, wn(m, Ae(f));
800
+ let h = this.#ke({
801
+ x: c,
802
+ y: l
803
+ });
804
+ if (h) {
805
+ let e = qt(f, h);
806
+ Gt(m, e, h, this.state);
807
+ }
808
+ this.scene.replaceAllElements(m), f.forEach((e) => {
809
+ P(e) && ct(e) && Lt(e, Ft(e, this.scene.getElementsMapIncludingDeleted()), this.scene);
810
+ }), pe && ei.loadElementsFonts(f).then((e) => {
811
+ this.fonts.onLoaded(e);
812
+ }), e.files && this.#oe(e.files);
813
+ let g = bt(f);
814
+ this.#r.scheduleCapture(), this.setState({
815
+ ...this.state,
816
+ openSidebar: this.state.openSidebar && this.editorInterface.canFitSidebar ? this.state.openSidebar : null,
817
+ ...I({
818
+ editingGroupId: null,
819
+ selectedElementIds: g.reduce((e, t) => (ct(t) || (e[t.id] = !0), e), {})
820
+ }, this.scene.getNonDeletedElements(), this.state, this)
821
+ }, () => {
822
+ e.files && this.#ft();
823
+ }), this.setActiveTool({ type: this.state.preferredSelectionTool.type }, !0), e.fitToContent && this.scrollToContent(f, {
824
+ fitToContent: !0,
825
+ canvasOffsets: this.getEditorUIOffsets()
826
+ });
827
+ }, this.setAppState = (e, t) => {
828
+ this.setState(e, t);
829
+ }, this.removePointer = (e) => {
830
+ Q && this.#Ie(), $.pointers.delete(e.pointerId);
831
+ }, this.toggleLock = (e = "ui") => {
832
+ this.state.activeTool.locked || V("toolbar", "toggleLock", `${e} (${this.editorInterface.formFactor === "phone" ? "mobile" : "desktop"})`), this.setState((e) => ({ activeTool: {
833
+ ...e.activeTool,
834
+ ...D(this.state, e.activeTool.locked ? { type: this.state.preferredSelectionTool.type } : e.activeTool),
835
+ locked: !e.activeTool.locked
836
+ } }));
837
+ }, this.updateFrameRendering = (e) => {
838
+ this.setState((t) => {
839
+ let n = typeof e == "function" ? e(t.frameRendering) : e;
840
+ return { frameRendering: {
841
+ enabled: n?.enabled ?? t.frameRendering.enabled,
842
+ clip: n?.clip ?? t.frameRendering.clip,
843
+ name: n?.name ?? t.frameRendering.name,
844
+ outline: n?.outline ?? t.frameRendering.outline
845
+ } };
846
+ });
847
+ }, this.togglePenMode = (e) => {
848
+ this.setState((t) => ({
849
+ penMode: e ?? !t.penMode,
850
+ penDetected: !0
851
+ }));
852
+ }, this.onHandToolToggle = () => {
853
+ this.actionManager.executeAction(Di);
854
+ }, this.zoomCanvas = (e) => {
855
+ this.setState({ ...Ei({
856
+ viewportX: this.state.width / 2 + this.state.offsetLeft,
857
+ viewportY: this.state.height / 2 + this.state.offsetTop,
858
+ nextZoom: Kr(e)
859
+ }, this.state) });
860
+ }, this.#ie = null, this.scrollToContent = (e = this.scene.getNonDeletedElements(), t) => {
861
+ if (typeof e == "string") {
862
+ let n;
863
+ if (n = Yn(e) ? Xn(e) : e, n) {
864
+ let r = this.scene.getElementsFromId(n);
865
+ r?.length ? this.scrollToContent(r, {
866
+ fitToContent: t?.fitToContent ?? !0,
867
+ animate: t?.animate ?? !0
868
+ }) : Yn(e) && this.setState({ toast: {
869
+ message: H("elementLink.notFound"),
870
+ duration: 3e3,
871
+ closable: !0
872
+ } });
873
+ }
874
+ return;
875
+ }
876
+ this.#ie?.();
877
+ let n = Array.isArray(e) ? e : [e], r = this.state.zoom, i = this.state.scrollX, a = this.state.scrollY;
878
+ if (t?.fitToContent || t?.fitToViewport) {
879
+ let { appState: e } = Oi({
880
+ canvasOffsets: t.canvasOffsets,
881
+ targetElements: n,
882
+ appState: this.state,
883
+ fitToViewport: !!t?.fitToViewport,
884
+ viewportZoomFactor: t?.viewportZoomFactor,
885
+ minZoom: t?.minZoom,
886
+ maxZoom: t?.maxZoom
887
+ });
888
+ r = e.zoom, i = e.scrollX, a = e.scrollY;
889
+ } else {
890
+ let e = qr(n, this.state);
891
+ i = e.scrollX, a = e.scrollY;
892
+ }
893
+ if (t?.animate) {
894
+ let e = this.state.scrollX, n = this.state.scrollY, o = this.state.zoom.value, s = Pe({
895
+ fromValues: {
896
+ scrollX: e,
897
+ scrollY: n,
898
+ zoom: o
899
+ },
900
+ toValues: {
901
+ scrollX: i,
902
+ scrollY: a,
903
+ zoom: r.value
904
+ },
905
+ interpolateValue: (e, t, n, r) => {
906
+ if (r === "zoom") return e * (t / e) ** +Ne(n);
907
+ },
908
+ onStep: ({ scrollX: e, scrollY: t, zoom: n }) => {
909
+ this.setState({
910
+ scrollX: e,
911
+ scrollY: t,
912
+ zoom: { value: n }
913
+ });
914
+ },
915
+ onStart: () => {
916
+ this.setState({ shouldCacheIgnoreZoom: !0 });
917
+ },
918
+ onEnd: () => {
919
+ this.setState({ shouldCacheIgnoreZoom: !1 });
920
+ },
921
+ onCancel: () => {
922
+ this.setState({ shouldCacheIgnoreZoom: !1 });
923
+ },
924
+ duration: t?.duration ?? 500
925
+ });
926
+ this.#ie = () => {
927
+ s(), this.#ie = null;
928
+ };
929
+ } else this.setState({
930
+ scrollX: i,
931
+ scrollY: a,
932
+ zoom: r
933
+ });
934
+ }, this.#ae = (e) => {
935
+ this.#ie?.(), this.setState(e);
936
+ }, this.setToast = (e) => {
937
+ this.setState({ toast: e });
938
+ }, this.restoreFileFromShare = async () => {
939
+ try {
940
+ let e = await caches.open("web-share-target"), t = await e.match("shared-file");
941
+ if (t) {
942
+ let n = await t.blob(), r = new File([n], n.name || "", { type: n.type });
943
+ this.loadFileToCanvas(r, null), await e.delete("shared-file"), window.history.replaceState(null, s, window.location.pathname);
944
+ }
945
+ } catch (e) {
946
+ this.setState({ errorMessage: e.message });
947
+ }
948
+ }, this.addFiles = q((e) => {
949
+ let { addedFiles: t } = this.#oe(e);
950
+ this.#H(t), this.scene.triggerUpdate(), this.#ft();
951
+ }), this.#oe = (e, t = !1) => {
952
+ let n = t ? {} : { ...this.files }, r = {}, i = Array.isArray(e) ? e : Object.values(e);
953
+ for (let e of i) if (!n[e.id] && (r[e.id] = e, n[e.id] = e, e.mimeType === v.svg)) try {
954
+ let t = ci(hr(ai(e.dataURL)), v.svg);
955
+ e.dataURL !== t && (e.version = (e.version ?? 1) + 1, e.dataURL = t);
956
+ } catch (e) {
957
+ console.error(e);
958
+ }
959
+ return this.files = n, { addedFiles: r };
960
+ }, this.updateScene = q((e) => {
961
+ let { elements: t, appState: n, collaborators: r, captureUpdate: i } = e;
962
+ if (i) {
963
+ let e = t || void 0, r = n ? Gn({
964
+ ...this.#r.snapshot.appState,
965
+ ...n
966
+ }) : void 0;
967
+ this.#r.scheduleMicroAction({
968
+ action: i,
969
+ elements: e,
970
+ appState: r
971
+ });
972
+ }
973
+ n && this.setState(n), t && this.scene.replaceAllElements(t), r && this.setState({ collaborators: r });
974
+ }), this.applyDeltas = (e, t) => {
975
+ let n = Wn.squash(...e), r = { ...this.state }, i = new Map(this.scene.getElementsMapIncludingDeleted());
976
+ return Wn.applyTo(n, i, r, t);
977
+ }, this.mutateElement = (e, t, n = !0) => this.scene.mutateElement(e, t, {
978
+ informMutation: n,
979
+ isDragging: !1
980
+ }), this.#se = (e) => {
981
+ e === !0 ? this.scene.triggerUpdate() : this.setState({});
982
+ }, this.toggleSidebar = ({ name: e, tab: t, force: n }) => {
983
+ let r;
984
+ r = ao(n) ? this.state.openSidebar?.name === e && this.state.openSidebar?.tab === t ? null : e : n ? e : null;
985
+ let i = r ? { name: r } : null;
986
+ return i && t && (i.tab = t), this.setState({ openSidebar: i }), !!r;
987
+ }, this.#ce = q((e) => {
988
+ this.lastViewportPosition.x = e.clientX, this.lastViewportPosition.y = e.clientY;
989
+ }), this.getEditorUIOffsets = () => {
990
+ let e = this.rootElement?.querySelector?.(".App-toolbar")?.getBoundingClientRect?.()?.bottom ?? 0, t = this.rootElement?.querySelector?.(".sidebar")?.getBoundingClientRect?.(), n = this.rootElement?.querySelector?.(".App-menu__left")?.getBoundingClientRect?.();
991
+ return Ur().rtl ? {
992
+ top: e + 16,
993
+ right: Math.max(this.state.width - (n?.left ?? this.state.width), 0) + 16,
994
+ bottom: 16,
995
+ left: Math.max(t?.right ?? 0, 0) + 16
996
+ } : {
997
+ top: e + 16,
998
+ right: Math.max(this.state.width - (t?.left ?? this.state.width) + 16, 0),
999
+ bottom: 16,
1000
+ left: Math.max(n?.right ?? 0, 0) + 16
1001
+ };
1002
+ }, this.#le = q((e) => {
1003
+ if ("Proxy" in window && (!e.shiftKey && /^[A-Z]$/.test(e.key) || e.shiftKey && /^[a-z]$/.test(e.key)) && (e = new Proxy(e, { get(t, n) {
1004
+ let r = t[n];
1005
+ return typeof r == "function" ? r.bind(t) : n === "key" ? e.shiftKey ? t.key.toUpperCase() : t.key.toLowerCase() : r;
1006
+ } })), !ze(e.target)) {
1007
+ if ((e.key === x.ESCAPE || e.key === x.ENTER) && this.state.croppingElementId) {
1008
+ this.#De();
1009
+ return;
1010
+ }
1011
+ let t = St(this.scene.getNonDeletedElementsMap(), this.state);
1012
+ if (t.length === 1 && M(t[0]) && e.key === x.ENTER) {
1013
+ this.#Ee(t[0]);
1014
+ return;
1015
+ }
1016
+ if (e.key === x.ESCAPE) this.updateEditorAtom(Pa, null);
1017
+ else if (e.key === x.TAB && (document.activeElement === this.rootElement || document.activeElement?.classList?.contains?.(l.CONVERT_ELEMENT_TYPE_POPUP))) {
1018
+ e.preventDefault();
1019
+ let n = Ia(t);
1020
+ Vr.get(Pa)?.type === "panel" && Fa(this, {
1021
+ conversionType: n,
1022
+ direction: e.shiftKey ? "left" : "right"
1023
+ }) && this.#r.scheduleCapture(), n && this.updateEditorAtom(Pa, { type: "panel" });
1024
+ }
1025
+ if (e.key === x.ESCAPE && this.flowChartCreator.isCreatingChart) {
1026
+ this.flowChartCreator.clear(), this.#se(!0);
1027
+ return;
1028
+ }
1029
+ let n = ye(e.key);
1030
+ if (e[x.CTRL_OR_CMD] && n && !e.shiftKey) {
1031
+ e.preventDefault();
1032
+ let t = St(this.scene.getNonDeletedElementsMap(), this.state);
1033
+ t.length === 1 && ut(t[0]) && this.flowChartCreator.createNodes(t[0], this.state, pr(e.key), this.scene), this.flowChartCreator.pendingNodes?.length && !jn(this.flowChartCreator.pendingNodes, this.canvas.width / window.devicePixelRatio, this.canvas.height / window.devicePixelRatio, {
1034
+ offsetLeft: this.state.offsetLeft,
1035
+ offsetTop: this.state.offsetTop,
1036
+ scrollX: this.state.scrollX,
1037
+ scrollY: this.state.scrollY,
1038
+ zoom: this.state.zoom
1039
+ }, this.scene.getNonDeletedElementsMap(), this.getEditorUIOffsets()) && this.scrollToContent(this.flowChartCreator.pendingNodes, {
1040
+ animate: !0,
1041
+ duration: 300,
1042
+ fitToContent: !0,
1043
+ canvasOffsets: this.getEditorUIOffsets()
1044
+ });
1045
+ return;
1046
+ }
1047
+ if (e.altKey) {
1048
+ let t = St(this.scene.getNonDeletedElementsMap(), this.state);
1049
+ if (t.length === 1 && n) {
1050
+ e.preventDefault();
1051
+ let n = this.#u.exploreByDirection(t[0], this.scene.getNonDeletedElementsMap(), pr(e.key));
1052
+ if (n) {
1053
+ this.setState((e) => ({ selectedElementIds: F({ [n]: !0 }, e) }));
1054
+ let e = this.scene.getNonDeletedElementsMap().get(n);
1055
+ e && !jn([e], this.canvas.width / window.devicePixelRatio, this.canvas.height / window.devicePixelRatio, {
1056
+ offsetLeft: this.state.offsetLeft,
1057
+ offsetTop: this.state.offsetTop,
1058
+ scrollX: this.state.scrollX,
1059
+ scrollY: this.state.scrollY,
1060
+ zoom: this.state.zoom
1061
+ }, this.scene.getNonDeletedElementsMap(), this.getEditorUIOffsets()) && this.scrollToContent(e, {
1062
+ animate: !0,
1063
+ duration: 300,
1064
+ canvasOffsets: this.getEditorUIOffsets()
1065
+ });
1066
+ }
1067
+ return;
1068
+ }
1069
+ }
1070
+ }
1071
+ if (e[x.CTRL_OR_CMD] && e.key === x.P && !e.shiftKey && !e.altKey) {
1072
+ this.setToast({ message: H("commandPalette.shortcutHint", { shortcut: ca("commandPalette") }) }), e.preventDefault();
1073
+ return;
1074
+ }
1075
+ if (e[x.CTRL_OR_CMD] && e.key.toLowerCase() === x.V && (ho = e.shiftKey, clearTimeout(go), go = window.setTimeout(() => {
1076
+ ho = !1;
1077
+ }, 100)), e[x.CTRL_OR_CMD] && We(e.target) && (e.code === ve.MINUS || e.code === ve.EQUAL)) {
1078
+ e.preventDefault();
1079
+ return;
1080
+ }
1081
+ if (We(e.target) && e.key !== x.ESCAPE || ye(e.key) && ze(e.target)) return;
1082
+ if (e.key === x.QUESTION_MARK) {
1083
+ this.setState({ openDialog: { name: "help" } });
1084
+ return;
1085
+ } else if (e.key.toLowerCase() === x.E && e.shiftKey && e[x.CTRL_OR_CMD]) {
1086
+ e.preventDefault(), this.setState({ openDialog: { name: "imageExport" } });
1087
+ return;
1088
+ }
1089
+ if (e.key === x.PAGE_UP || e.key === x.PAGE_DOWN) {
1090
+ let t = (e.shiftKey ? this.state.width : this.state.height) / this.state.zoom.value;
1091
+ e.key === x.PAGE_DOWN && (t = -t), e.shiftKey ? this.#ae((e) => ({ scrollX: e.scrollX + t })) : this.#ae((e) => ({ scrollY: e.scrollY + t }));
1092
+ }
1093
+ if (this.state.openDialog?.name === "elementLinkSelector" || (e.key === x.ALT && (T("COMPLEX_BINDINGS") ? this.#d() : Rn({
1094
+ app: this,
1095
+ event: e
1096
+ })), this.actionManager.handleKeyDown(e)) || this.state.viewModeEnabled) return;
1097
+ if (e[x.CTRL_OR_CMD] && this.state.isBindingEnabled && (T("COMPLEX_BINDINGS") && this.#f(), Z(() => {
1098
+ this.setState({ isBindingEnabled: !1 });
1099
+ }), Rn({
1100
+ app: this,
1101
+ event: e
1102
+ })), ye(e.key)) {
1103
+ let t = this.scene.getSelectedElements({
1104
+ selectedElementIds: this.state.selectedElementIds,
1105
+ includeBoundTextElement: !0,
1106
+ includeElementsInFrames: !0
1107
+ }), n = /* @__PURE__ */ new Set();
1108
+ t.filter((e) => k(e)).filter((e) => {
1109
+ let n = e.startBinding && !t.some((t) => t.id === e.startBinding?.elementId), r = e.endBinding && !t.some((t) => t.id === e.endBinding?.elementId);
1110
+ return n || r;
1111
+ }).forEach((e) => n.add(e.id)), t = t.filter((e) => !n.has(e.id));
1112
+ let r = this.getEffectiveGridSize() && (e.shiftKey ? 1 : this.getEffectiveGridSize()) || (e.shiftKey ? 5 : 1), i = 0, a = 0;
1113
+ e.key === x.ARROW_LEFT ? i = -r : e.key === x.ARROW_RIGHT ? i = r : e.key === x.ARROW_UP ? a = -r : e.key === x.ARROW_DOWN && (a = r), t.forEach((e) => {
1114
+ this.scene.mutateElement(e, {
1115
+ x: e.x + i,
1116
+ y: e.y + a
1117
+ }, {
1118
+ informMutation: !1,
1119
+ isDragging: !1
1120
+ }), Sn(e, this.scene, { simultaneouslyUpdated: t });
1121
+ }), this.scene.triggerUpdate(), e.preventDefault();
1122
+ } else if (e.key === x.ENTER) {
1123
+ let t = this.scene.getSelectedElements(this.state);
1124
+ if (t.length === 1) {
1125
+ let n = t[0];
1126
+ if (e[x.CTRL_OR_CMD] || mt(n)) N(n) && (!this.state.selectedLinearElement?.isEditing || this.state.selectedLinearElement.elementId !== n.id) && (this.#r.scheduleCapture(), A(n) || this.actionManager.executeAction(Zi));
1127
+ else if (P(n) || It(n)) {
1128
+ let t;
1129
+ P(n) || (t = n);
1130
+ let r = Pt(n, this.state, this.scene.getNonDeletedElementsMap()), i = r.x, a = r.y;
1131
+ this.#Te({
1132
+ sceneX: i,
1133
+ sceneY: a,
1134
+ container: t
1135
+ }), e.preventDefault();
1136
+ return;
1137
+ } else j(n) && this.setState({ editingFrame: n.id });
1138
+ }
1139
+ } else if (!e.ctrlKey && !e.altKey && !e.metaKey && !this.state.newElement && !this.state.selectionElement && !this.state.selectedElementsAreBeingDragged) {
1140
+ let t = za(e.key, this);
1141
+ t ? (this.state.activeTool.type !== t && V("toolbar", t, `keyboard (${this.editorInterface.formFactor === "phone" ? "mobile" : "desktop"})`), t === "arrow" && this.state.activeTool.type === "arrow" && this.setState((e) => ({ currentItemArrowType: e.currentItemArrowType === c.sharp ? c.round : e.currentItemArrowType === c.round ? c.elbow : c.sharp })), this.setActiveTool({ type: t }), e.stopPropagation()) : e.key === x.Q && (this.toggleLock("keyboard"), e.stopPropagation());
1142
+ }
1143
+ if (e.key === x.SPACE && $.pointers.size === 0 && (lo = !0, W(this.interactiveCanvas, u.GRAB), e.preventDefault()), (e.key === x.G || e.key === x.S) && !e.altKey && !e[x.CTRL_OR_CMD]) {
1144
+ let t = this.scene.getSelectedElements(this.state);
1145
+ if (this.state.activeTool.type === "selection" && !t.length) return;
1146
+ e.key === x.G && (tt(this.state.activeTool.type) || t.some((e) => tt(e.type))) && (this.setState({ openPopup: "elementBackground" }), e.stopPropagation()), e.key === x.S && (this.setState({ openPopup: "elementStroke" }), e.stopPropagation());
1147
+ }
1148
+ if (!e[x.CTRL_OR_CMD] && e.shiftKey && e.key.toLowerCase() === x.F) {
1149
+ let t = this.scene.getSelectedElements(this.state);
1150
+ if (this.state.activeTool.type === "selection" && !t.length) return;
1151
+ (this.state.activeTool.type === "text" || t.find((e) => P(e) || Nt(e, this.scene.getNonDeletedElementsMap()))) && (e.preventDefault(), this.setState({ openPopup: "fontFamily" }));
1152
+ }
1153
+ if (e.key === x.K && !e.altKey && !e[x.CTRL_OR_CMD]) {
1154
+ this.state.activeTool.type === "laser" ? this.setActiveTool({ type: this.state.preferredSelectionTool.type }) : this.setActiveTool({ type: "laser" });
1155
+ return;
1156
+ }
1157
+ e[x.CTRL_OR_CMD] && (e.key === x.BACKSPACE || e.key === x.DELETE) && this.updateEditorAtom(Aa, "clearCanvas");
1158
+ let t = e.key.toLocaleLowerCase(), n = t === x.S && e.shiftKey, r = e.key === x.I || t === x.G && e.shiftKey;
1159
+ (n || r) && this.#j({ type: n ? "stroke" : "background" });
1160
+ }), this.#ue = q((e) => {
1161
+ if (e.key === x.SPACE && (this.state.viewModeEnabled || this.state.openDialog?.name === "elementLinkSelector" ? W(this.interactiveCanvas, u.GRAB) : Be(this.state.activeTool.type) ? U(this.interactiveCanvas) : (G(this.interactiveCanvas, this.state), this.setState({
1162
+ selectedElementIds: F({}, this.state),
1163
+ selectedGroupIds: {},
1164
+ editingGroupId: null,
1165
+ activeEmbeddable: null
1166
+ })), lo = !1), e.key === x.ALT && Rn({
1167
+ app: this,
1168
+ event: e
1169
+ }), (e.key === x.ALT && this.state.bindMode === "skip" || !e[x.CTRL_OR_CMD] && !yn(this.state)) && (this.setState({ bindMode: "orbit" }), this.lastPointerMoveEvent && T("COMPLEX_BINDINGS"))) {
1170
+ let e = O({
1171
+ clientX: this.lastPointerMoveEvent.clientX,
1172
+ clientY: this.lastPointerMoveEvent.clientY
1173
+ }, this.state), t = R(S(e.x, e.y), this.scene.getNonDeletedElements(), this.scene.getNonDeletedElementsMap());
1174
+ if (this.state.selectedLinearElement) {
1175
+ let e = z.getElement(this.state.selectedLinearElement.elementId, this.scene.getNonDeletedElementsMap());
1176
+ k(e) && this.#m(e, t);
1177
+ }
1178
+ }
1179
+ if (!e[x.CTRL_OR_CMD] && !this.state.isBindingEnabled && (Z(() => {
1180
+ this.setState({ isBindingEnabled: !0 });
1181
+ }), Rn({
1182
+ app: this,
1183
+ event: e
1184
+ })), ye(e.key)) {
1185
+ gn(this.scene.getSelectedElements(this.state).filter(at), this.scene, this.state);
1186
+ let e = this.scene.getNonDeletedElementsMap();
1187
+ this.scene.getSelectedElements(this.state).filter(_t).forEach((t) => {
1188
+ t.startBinding && this.scene.mutateElement(t, { startBinding: {
1189
+ ...t.startBinding,
1190
+ ..._n(t, e.get(t.startBinding.elementId), "start", e)
1191
+ } }), t.endBinding && this.scene.mutateElement(t, { endBinding: {
1192
+ ...t.endBinding,
1193
+ ..._n(t, e.get(t.endBinding.elementId), "end", e)
1194
+ } });
1195
+ }), this.setState({ suggestedBinding: null });
1196
+ }
1197
+ if (e.altKey || this.#u.isExploring && (this.#u.clear(), this.syncActionResult({ captureUpdate: B.IMMEDIATELY })), !e[x.CTRL_OR_CMD] && this.flowChartCreator.isCreatingChart) {
1198
+ this.flowChartCreator.pendingNodes?.length && this.scene.insertElements(this.flowChartCreator.pendingNodes);
1199
+ let e = this.flowChartCreator.pendingNodes?.[0];
1200
+ e && (this.setState((t) => ({ selectedElementIds: F({ [e.id]: !0 }, t) })), jn([e], this.canvas.width / window.devicePixelRatio, this.canvas.height / window.devicePixelRatio, {
1201
+ offsetLeft: this.state.offsetLeft,
1202
+ offsetTop: this.state.offsetTop,
1203
+ scrollX: this.state.scrollX,
1204
+ scrollY: this.state.scrollY,
1205
+ zoom: this.state.zoom
1206
+ }, this.scene.getNonDeletedElementsMap(), this.getEditorUIOffsets()) || this.scrollToContent(e, {
1207
+ animate: !0,
1208
+ duration: 300,
1209
+ canvasOffsets: this.getEditorUIOffsets()
1210
+ })), this.flowChartCreator.clear(), this.syncActionResult({ captureUpdate: B.IMMEDIATELY });
1211
+ }
1212
+ }), this.#de = (e) => this.props.UIOptions.tools?.[e] !== !1, this.setActiveTool = (e, t = !1) => {
1213
+ if (!this.#de(e.type)) {
1214
+ console.warn(`"${e.type}" tool is disabled via "UIOptions.canvasActions.tools.${e.type}"`);
1215
+ return;
1216
+ }
1217
+ let n = D(this.state, e);
1218
+ n.type === "hand" ? W(this.interactiveCanvas, u.GRAB) : lo || G(this.interactiveCanvas, {
1219
+ ...this.state,
1220
+ activeTool: n
1221
+ }), Ue(document.activeElement) && this.focusContainer(), ht(n.type) || this.setState({ suggestedBinding: null }), n.type === "image" && this.#lt(), this.setState((e) => {
1222
+ let r = {
1223
+ snapLines: e.snapLines.length ? [] : e.snapLines,
1224
+ originSnapOffset: null,
1225
+ activeEmbeddable: null,
1226
+ selectedLinearElement: Be(n.type) ? e.selectedLinearElement : null
1227
+ };
1228
+ return n.type === "freedraw" && this.#r.scheduleCapture(), n.type === "lasso" ? {
1229
+ ...e,
1230
+ ...r,
1231
+ activeTool: n,
1232
+ ...t ? {} : {
1233
+ selectedElementIds: F({}, e),
1234
+ selectedGroupIds: F({}, e),
1235
+ editingGroupId: null,
1236
+ multiElement: null
1237
+ }
1238
+ } : n.type === "selection" ? {
1239
+ ...e,
1240
+ ...r,
1241
+ activeTool: n
1242
+ } : {
1243
+ ...e,
1244
+ ...r,
1245
+ activeTool: n,
1246
+ selectedElementIds: F({}, e),
1247
+ selectedGroupIds: F({}, e),
1248
+ editingGroupId: null,
1249
+ multiElement: null
1250
+ };
1251
+ });
1252
+ }, this.setOpenDialog = (e) => {
1253
+ this.setState({ openDialog: e });
1254
+ }, this.#fe = (e) => {
1255
+ W(this.interactiveCanvas, e);
1256
+ }, this.#pe = () => {
1257
+ U(this.interactiveCanvas);
1258
+ }, this.#me = () => $.pointers.size >= 2, this.getName = () => this.state.name || this.props.name || `${H("labels.untitled")}-${Fe()}`, this.#he = q((e) => {
1259
+ e.preventDefault(), this.#me() && this.setState({
1260
+ selectedElementIds: F({}, this.state),
1261
+ activeEmbeddable: null
1262
+ }), $.initialScale = this.state.zoom.value;
1263
+ }), this.#ge = q((e) => {
1264
+ if (e.preventDefault(), this.#me()) return;
1265
+ let t = $.initialScale;
1266
+ t && this.setState((n) => ({ ...Ei({
1267
+ viewportX: this.lastViewportPosition.x,
1268
+ viewportY: this.lastViewportPosition.y,
1269
+ nextZoom: Kr(t * e.scale)
1270
+ }, n) }));
1271
+ }), this.#_e = q((e) => {
1272
+ e.preventDefault(), this.#me() && this.setState({
1273
+ previousSelectedElementIds: {},
1274
+ selectedElementIds: F(this.state.previousSelectedElementIds, this.state)
1275
+ }), $.initialScale = null;
1276
+ }), this.#Te = ({ sceneX: e, sceneY: t, insertAtParentCenter: n = !0, container: r, autoEdit: i = !0 }) => {
1277
+ let a = !1, o = n && this.#Tt(e, t, this.state, r);
1278
+ r && o && (Nt(r, this.scene.getNonDeletedElementsMap()) || (a = !0));
1279
+ let s = null, c = this.scene.getSelectedElements(this.state);
1280
+ s = c.length === 1 ? P(c[0]) ? c[0] : r ? Nt(c[0], this.scene.getNonDeletedElementsMap()) : this.#be(e, t) : this.#be(e, t);
1281
+ let l = s?.fontFamily || this.state.currentItemFontFamily, u = s?.lineHeight || _e(l), d = this.state.currentItemFontSize;
1282
+ if (!s && a && r && !at(r)) {
1283
+ let n = Et(Ie({
1284
+ fontSize: d,
1285
+ fontFamily: l
1286
+ }), u), i = Tt(d, u), a = Math.max(r.height, i), s = Math.max(r.width, n);
1287
+ this.scene.mutateElement(r, {
1288
+ height: a,
1289
+ width: s
1290
+ }), e = r.x + s / 2, t = r.y + a / 2, o &&= this.#Tt(e, t, this.state, r);
1291
+ }
1292
+ let f = this.#ke({
1293
+ x: e,
1294
+ y: t
1295
+ }), p = s || or({
1296
+ x: o ? o.elementCenterX : e,
1297
+ y: o ? o.elementCenterY : t,
1298
+ strokeColor: this.state.currentItemStrokeColor,
1299
+ backgroundColor: this.state.currentItemBackgroundColor,
1300
+ fillStyle: this.state.currentItemFillStyle,
1301
+ strokeWidth: this.state.currentItemStrokeWidth,
1302
+ strokeStyle: this.state.currentItemStrokeStyle,
1303
+ roughness: this.state.currentItemRoughness,
1304
+ opacity: this.state.currentItemOpacity,
1305
+ text: "",
1306
+ fontSize: d,
1307
+ fontFamily: l,
1308
+ textAlign: o ? "center" : this.state.currentItemTextAlign,
1309
+ verticalAlign: o ? ie.MIDDLE : "top",
1310
+ containerId: a ? r?.id : void 0,
1311
+ groupIds: r?.groupIds ?? [],
1312
+ lineHeight: u,
1313
+ angle: r ? at(r) ? 0 : r.angle : 0,
1314
+ frameId: f ? f.id : null
1315
+ });
1316
+ if (!s && a && r && this.scene.mutateElement(r, { boundElements: (r.boundElements || []).concat({
1317
+ type: "text",
1318
+ id: p.id
1319
+ }) }), this.setState({ editingTextElement: p }), !s) if (r && a) {
1320
+ let e = this.scene.getElementIndex(r.id);
1321
+ this.scene.insertElementAtIndex(p, e + 1);
1322
+ } else this.scene.insertElement(p);
1323
+ i || s || r ? this.#ve(p, { isExistingElement: !!s }) : this.setState({
1324
+ newElement: p,
1325
+ multiElement: null
1326
+ });
1327
+ }, this.#Ee = (e) => {
1328
+ this.#r.scheduleCapture(), this.setState({ croppingElementId: e.id });
1329
+ }, this.#De = () => {
1330
+ this.state.croppingElementId && (this.#r.scheduleCapture(), this.setState({ croppingElementId: null }));
1331
+ }, this.#Oe = (e) => {
1332
+ if (this.state.multiElement || this.state.activeTool.type !== this.state.preferredSelectionTool.type) return;
1333
+ let t = this.scene.getSelectedElements(this.state), { x: n, y: r } = O(e, this.state);
1334
+ if (t.length === 1 && N(t[0])) {
1335
+ let i = t[0];
1336
+ if ((e[x.CTRL_OR_CMD] && _t(i) || mt(i)) && (!this.state.selectedLinearElement?.isEditing || this.state.selectedLinearElement.elementId !== i.id)) {
1337
+ this.actionManager.executeAction(Zi);
1338
+ return;
1339
+ } else if (this.state.selectedLinearElement && A(t[0])) {
1340
+ let e = z.getSegmentMidpointHitCoords(this.state.selectedLinearElement, {
1341
+ x: n,
1342
+ y: r
1343
+ }, this.state, this.scene.getNonDeletedElementsMap()), i = e ? z.getSegmentMidPointIndex(this.state.selectedLinearElement, this.state, e, this.scene.getNonDeletedElementsMap()) : -1;
1344
+ if (i && i > -1) {
1345
+ this.#r.scheduleCapture(), z.deleteFixedSegment(t[0], this.scene, i);
1346
+ let a = z.getSegmentMidpointHitCoords({
1347
+ ...this.state.selectedLinearElement,
1348
+ segmentMidPointHoveredCoords: null
1349
+ }, {
1350
+ x: n,
1351
+ y: r
1352
+ }, this.state, this.scene.getNonDeletedElementsMap()), o = a ? z.getSegmentMidPointIndex(this.state.selectedLinearElement, this.state, a, this.scene.getNonDeletedElementsMap()) : null;
1353
+ this.setState({ selectedLinearElement: {
1354
+ ...this.state.selectedLinearElement,
1355
+ initialState: {
1356
+ ...this.state.selectedLinearElement.initialState,
1357
+ segmentMidpoint: {
1358
+ index: o,
1359
+ value: e,
1360
+ added: !1
1361
+ }
1362
+ },
1363
+ segmentMidPointHoveredCoords: a
1364
+ } });
1365
+ return;
1366
+ }
1367
+ } else if (this.state.selectedLinearElement?.isEditing && this.state.selectedLinearElement.elementId === i.id && mt(i)) return;
1368
+ }
1369
+ if (t.length === 1 && M(t[0])) {
1370
+ this.#Ee(t[0]);
1371
+ return;
1372
+ }
1373
+ if (U(this.interactiveCanvas), Vt(this.state).length > 0) {
1374
+ let e = this.#xe(n, r), t = e && Bt(e, this.state.selectedGroupIds);
1375
+ if (t) {
1376
+ this.#r.scheduleCapture(), this.setState((n) => ({
1377
+ ...n,
1378
+ ...I({
1379
+ editingGroupId: t,
1380
+ selectedElementIds: { [e.id]: !0 }
1381
+ }, this.scene.getNonDeletedElements(), n, this)
1382
+ }));
1383
+ return;
1384
+ }
1385
+ }
1386
+ if (U(this.interactiveCanvas), !e[x.CTRL_OR_CMD] && !this.state.viewModeEnabled) {
1387
+ let t = this.#xe(n, r);
1388
+ if (ft(t)) {
1389
+ this.setState({ activeEmbeddable: {
1390
+ element: t,
1391
+ state: "active"
1392
+ } });
1393
+ return;
1394
+ }
1395
+ if (!this.state.selectedLinearElement?.isEditing) {
1396
+ let t = this.#we(n, r);
1397
+ if (t && (it(t) || !o(t.backgroundColor) || pn({
1398
+ point: S(n, r),
1399
+ element: t,
1400
+ elementsMap: this.scene.getNonDeletedElementsMap(),
1401
+ threshold: this.getElementHitThreshold(t)
1402
+ }))) {
1403
+ let e = Pt(t, this.state, this.scene.getNonDeletedElementsMap());
1404
+ n = e.x, r = e.y;
1405
+ }
1406
+ this.#Te({
1407
+ sceneX: n,
1408
+ sceneY: r,
1409
+ insertAtParentCenter: !e.altKey,
1410
+ container: t
1411
+ });
1412
+ }
1413
+ }
1414
+ }, this.#ke = (e) => {
1415
+ let t = this.scene.getNonDeletedElementsMap(), n = this.scene.getNonDeletedFramesLikes().filter((n) => !n.locked && en(e, n, t));
1416
+ return n.length ? n[n.length - 1] : null;
1417
+ }, this.#Ae = (e) => {
1418
+ this.#Et(e.clientX, e.clientY, this.state.cursorButton), this.lastPointerMoveEvent = e.nativeEvent;
1419
+ let t = O(e, this.state), { x: n, y: r } = t;
1420
+ this.lastPointerMoveCoords = {
1421
+ x: n,
1422
+ y: r
1423
+ }, $.pointers.has(e.pointerId) && $.pointers.set(e.pointerId, {
1424
+ x: e.clientX,
1425
+ y: e.clientY
1426
+ });
1427
+ let i = $.initialScale;
1428
+ if ($.pointers.size === 2 && $.lastCenter && i && $.initialDistance) {
1429
+ let e = pa($.pointers), t = e.x - $.lastCenter.x, n = e.y - $.lastCenter.y;
1430
+ $.lastCenter = e;
1431
+ let r = ma(Array.from($.pointers.values())), a = this.state.activeTool.type === "freedraw" && this.state.penMode ? 1 : r / $.initialDistance, o = a ? Kr(i * a) : this.state.zoom.value;
1432
+ this.setState((r) => {
1433
+ let i = Ei({
1434
+ viewportX: e.x,
1435
+ viewportY: e.y,
1436
+ nextZoom: o
1437
+ }, r);
1438
+ return this.#ae({
1439
+ zoom: i.zoom,
1440
+ scrollX: i.scrollX + t / o * 2,
1441
+ scrollY: i.scrollY + n / o * 2,
1442
+ shouldCacheIgnoreZoom: !0
1443
+ }), null;
1444
+ }), this.#Dt();
1445
+ } else $.lastCenter = $.initialDistance = $.initialScale = null;
1446
+ if (lo || uo || fo || kr(this.state)) return;
1447
+ let a = ya(po, e.clientX - this.state.offsetLeft, e.clientY - this.state.offsetTop).isOverEither;
1448
+ if (!this.state.newElement && !this.state.selectionElement && !this.state.selectedElementsAreBeingDragged && !this.state.multiElement && (a ? U(this.interactiveCanvas) : G(this.interactiveCanvas, this.state)), !this.state.newElement && Ca(this.state.activeTool.type)) {
1449
+ let { originOffset: t, snapLines: i } = xa(this.scene.getNonDeletedElements(), this, {
1450
+ x: n,
1451
+ y: r
1452
+ }, e, this.scene.getNonDeletedElementsMap());
1453
+ this.setState((e) => {
1454
+ let n = Xe(e.snapLines, i), r = e.originSnapOffset ? Xe(e.originSnapOffset, t) : t;
1455
+ return e.snapLines === n && e.originSnapOffset === r ? null : {
1456
+ snapLines: n,
1457
+ originSnapOffset: r
1458
+ };
1459
+ });
1460
+ } else !this.state.newElement && !this.state.selectedElementsAreBeingDragged && !this.state.selectionElement && this.setState((e) => e.snapLines.length ? { snapLines: [] } : null);
1461
+ if (this.state.selectedLinearElement?.isEditing && !this.state.selectedLinearElement.isDragging) {
1462
+ let t = this.state.newElement ? null : z.handlePointerMoveInEditMode(e, n, r, this);
1463
+ t && t !== this.state.selectedLinearElement && Z(() => {
1464
+ this.setState({ selectedLinearElement: t });
1465
+ });
1466
+ }
1467
+ if (st(this.state.activeTool.type)) {
1468
+ let { newElement: e } = this.state;
1469
+ if (!e && yn(this.state)) {
1470
+ let e = R(S(n, r), this.scene.getNonDeletedElements(), this.scene.getNonDeletedElementsMap(), bn(this.state.zoom));
1471
+ e ? this.setState({ suggestedBinding: e }) : this.state.suggestedBinding && this.setState({ suggestedBinding: null });
1472
+ }
1473
+ }
1474
+ if (this.state.multiElement && this.state.selectedLinearElement) {
1475
+ let { multiElement: t, selectedLinearElement: i } = this.state, { x: a, y: o, points: s } = t, c = s[s.length - 1], { lastCommittedPoint: l } = i;
1476
+ if (G(this.interactiveCanvas, this.state), c === l) at(this.state.newElement) && yn(this.state) && R(S(n, r), this.scene.getNonDeletedElements(), this.scene.getNonDeletedElementsMap(), bn(this.state.zoom)) ? (this.actionManager.executeAction(K, "ui", {
1477
+ event: e.nativeEvent,
1478
+ sceneCoords: {
1479
+ x: n,
1480
+ y: r
1481
+ }
1482
+ }), this.setState({
1483
+ suggestedBinding: null,
1484
+ startBoundElement: null
1485
+ }), this.state.activeTool.locked || (U(this.interactiveCanvas), this.setState((e) => ({
1486
+ newElement: null,
1487
+ activeTool: D(this.state, { type: this.state.preferredSelectionTool.type }),
1488
+ selectedElementIds: F({
1489
+ ...e.selectedElementIds,
1490
+ [t.id]: !0
1491
+ }, e),
1492
+ selectedLinearElement: new z(t, this.scene.getNonDeletedElementsMap())
1493
+ })))) : Oe(S(n - a, r - o), c) >= 8 ? (this.scene.mutateElement(t, { points: [...s, S(n - a, r - o)] }, {
1494
+ informMutation: !1,
1495
+ isDragging: !1
1496
+ }), E(this.state.selectedLinearElement?.initialState, "initialState must be set"), this.setState({ selectedLinearElement: {
1497
+ ...this.state.selectedLinearElement,
1498
+ lastCommittedPoint: s[s.length - 1],
1499
+ selectedPointsIndices: [t.points.length - 1],
1500
+ initialState: {
1501
+ ...this.state.selectedLinearElement.initialState,
1502
+ lastClickedPoint: t.points.length - 1
1503
+ }
1504
+ } })) : W(this.interactiveCanvas, u.POINTER);
1505
+ else if (s.length > 2 && l && Oe(S(n - a, r - o), l) < 8) W(this.interactiveCanvas, u.POINTER), this.scene.mutateElement(t, { points: s.slice(0, -1) }, {
1506
+ informMutation: !1,
1507
+ isDragging: !1
1508
+ }), this.setState({ selectedLinearElement: {
1509
+ ...i,
1510
+ selectedPointsIndices: i.selectedPointsIndices?.includes?.(t.points.length) ? [...i.selectedPointsIndices.filter((e) => e !== t.points.length && e !== t.points.length - 1), t.points.length - 1] : i.selectedPointsIndices,
1511
+ lastCommittedPoint: t.points[t.points.length - 1],
1512
+ initialState: {
1513
+ ...i.initialState,
1514
+ lastClickedPoint: t.points.length - 1
1515
+ }
1516
+ } });
1517
+ else {
1518
+ ln(s, this.state.zoom.value) && W(this.interactiveCanvas, u.POINTER);
1519
+ let i = this.scene.getNonDeletedElementsMap();
1520
+ if (_t(t)) {
1521
+ let e = R(S(n, r), this.scene.getNonDeletedElements(), i);
1522
+ T("COMPLEX_BINDINGS") && this.#m(t, e);
1523
+ }
1524
+ E(this.state.selectedLinearElement, "Expected selectedLinearElement to be set to operate on a linear element");
1525
+ let a = z.handlePointerMove(e.nativeEvent, this, n, r, this.state.selectedLinearElement);
1526
+ a && this.setState(a);
1527
+ }
1528
+ return;
1529
+ }
1530
+ if (this.state.activeTool.type === "arrow") {
1531
+ let e = R(S(n, r), this.scene.getNonDeletedElements(), this.scene.getNonDeletedElementsMap(), bn(this.state.zoom));
1532
+ e && !mn(S(n, r), e, this.scene.getNonDeletedElementsMap()) && this.setState({ suggestedBinding: e });
1533
+ }
1534
+ if (e.buttons || this.state.activeTool.type !== "selection" && this.state.activeTool.type !== "lasso" && this.state.activeTool.type !== "text" && this.state.activeTool.type !== "eraser") return;
1535
+ let o = this.scene.getNonDeletedElements(), s = this.scene.getSelectedElements(this.state);
1536
+ if (s.length === 1 && !a && !this.state.selectedLinearElement?.isEditing) {
1537
+ if (this.state.selectedLinearElement && this.handleHoverSelectedLinearElement(this.state.selectedLinearElement, n, r), (!this.state.selectedLinearElement || this.state.selectedLinearElement.hoverPointIndex === -1) && this.state.openDialog?.name !== "elementLinkSelector" && !(s.length === 1 && A(s[0])) && !(N(s[0]) && (this.editorInterface.userAgent.isMobileDevice || s[0].points.length === 2))) {
1538
+ let t = Cr(o, this.state, n, r, this.state.zoom, e.pointerType, this.scene.getNonDeletedElementsMap(), this.editorInterface);
1539
+ if (t && t.transformHandleType) {
1540
+ W(this.interactiveCanvas, Sr(t));
1541
+ return;
1542
+ }
1543
+ }
1544
+ } else if (s.length > 1 && !a && this.state.openDialog?.name !== "elementLinkSelector") {
1545
+ let t = wr(En(s), n, r, this.state.zoom, e.pointerType, this.editorInterface);
1546
+ if (t) {
1547
+ W(this.interactiveCanvas, Sr({ transformHandleType: t }));
1548
+ return;
1549
+ }
1550
+ }
1551
+ let c = this.#xe(n, r, {
1552
+ preferSelected: !0,
1553
+ includeLockedElements: !0
1554
+ }), l = null;
1555
+ l = c && c.locked ? null : c, !Or(this.state) && (this.state.activeTool.type === "text" ? W(this.interactiveCanvas, P(l) ? u.TEXT : u.CROSSHAIR) : this.state.viewModeEnabled ? W(this.interactiveCanvas, u.GRAB) : this.state.openDialog?.name === "elementLinkSelector" || a || e[x.CTRL_OR_CMD] ? W(this.interactiveCanvas, u.AUTO) : (l || this.#We(t, s)) && !l?.locked && (l && ft(l) && this.#v(l, e, n, r) ? (W(this.interactiveCanvas, u.POINTER), this.setState({ activeEmbeddable: {
1556
+ element: l,
1557
+ state: "hover"
1558
+ } })) : (!l || !A(l) || !(l.startBinding || l.endBinding)) && ((this.state.activeTool.type !== "lasso" || s.length > 0) && W(this.interactiveCanvas, u.MOVE), this.state.activeEmbeddable?.state === "hover" && this.setState({ activeEmbeddable: null }))), this.state.selectedLinearElement && this.handleHoverSelectedLinearElement(this.state.selectedLinearElement, n, r), this.state.openDialog?.name === "elementLinkSelector" && l ? this.setState((e) => ({ hoveredElementIds: Xe(e.hoveredElementIds, I({
1559
+ editingGroupId: e.editingGroupId,
1560
+ selectedElementIds: { [l.id]: !0 }
1561
+ }, this.scene.getNonDeletedElements(), e, this).selectedElementIds) })) : this.state.openDialog?.name === "elementLinkSelector" && !l && this.setState((e) => ({ hoveredElementIds: Xe(e.hoveredElementIds, {}) })));
1562
+ }, this.#je = (e, t) => {
1563
+ let n = this.eraserTrail.addPointToPath(t.x, t.y, e.altKey);
1564
+ this.#l = new Set(n), this.#se();
1565
+ }, this.#Me = (e) => {
1566
+ mo = !0;
1567
+ }, this.handleHoverSelectedLinearElement = (e, t, n) => {
1568
+ let r = this.scene.getNonDeletedElementsMap(), i = z.getElement(e.elementId, r);
1569
+ if (i) if (this.state.selectedLinearElement) {
1570
+ let a = -1, o = null;
1571
+ pn({
1572
+ point: S(t, n),
1573
+ element: i,
1574
+ elementsMap: r,
1575
+ threshold: this.getElementHitThreshold(i)
1576
+ }) ? (a = z.getPointIndexUnderCursor(i, r, this.state.zoom, t, n), o = z.getSegmentMidpointHitCoords(e, {
1577
+ x: t,
1578
+ y: n
1579
+ }, this.state, this.scene.getNonDeletedElementsMap()), (A(i) ? a === 0 || a === i.points.length - 1 : a >= 0) || o ? W(this.interactiveCanvas, u.POINTER) : this.#Ce(t, n, i) && (!A(i) || !(i.startBinding || i.endBinding)) && (this.state.activeTool.type !== "lasso" || Object.keys(this.state.selectedElementIds).length > 0) && W(this.interactiveCanvas, u.MOVE)) : this.#Ce(t, n, i) && (!A(i) || !(i.startBinding || i.endBinding)) && (this.state.activeTool.type !== "lasso" || Object.keys(this.state.selectedElementIds).length > 0) && W(this.interactiveCanvas, u.MOVE), this.state.selectedLinearElement.hoverPointIndex !== a && this.setState({ selectedLinearElement: {
1580
+ ...this.state.selectedLinearElement,
1581
+ hoverPointIndex: a
1582
+ } }), z.arePointsEqual(this.state.selectedLinearElement.segmentMidPointHoveredCoords, o) || this.setState({ selectedLinearElement: {
1583
+ ...this.state.selectedLinearElement,
1584
+ segmentMidPointHoveredCoords: o
1585
+ } });
1586
+ let s = null, c = i;
1587
+ (c.startBinding || c.endBinding) && (s = Fn(i, t, n, this.scene, this.state)), this.state.selectedLinearElement.hoveredFocusPointBinding !== s && this.setState({ selectedLinearElement: {
1588
+ ...this.state.selectedLinearElement,
1589
+ isDragging: !1,
1590
+ hoveredFocusPointBinding: s
1591
+ } }), s && W(this.interactiveCanvas, u.POINTER);
1592
+ } else W(this.interactiveCanvas, u.AUTO);
1593
+ }, this.#Ne = (e) => {
1594
+ let { x: t, y: n } = O(e, this.state);
1595
+ this.lastPointerMoveCoords = {
1596
+ x: t,
1597
+ y: n
1598
+ };
1599
+ let r = e.target;
1600
+ if (r.setPointerCapture && r.setPointerCapture(e.pointerId), this.#Le(e.nativeEvent), this.state.searchMatches && (this.setState((e) => ({ searchMatches: e.searchMatches && {
1601
+ focusedId: null,
1602
+ matches: e.searchMatches.matches.map((e) => ({
1603
+ ...e,
1604
+ focus: !1
1605
+ }))
1606
+ } })), this.updateEditorAtom(Ba, null)), Vr.get(Pa) && this.updateEditorAtom(Pa, null), this.state.contextMenu && this.setState({ contextMenu: null }), this.state.snapLines && this.setAppState({ snapLines: [] }), this.state.openPopup && this.setState({ openPopup: null }), this.#Re(e), e.pointerType === "touch" && this.state.newElement && this.state.newElement.type === "freedraw") {
1607
+ let e = this.state.newElement;
1608
+ this.updateScene({
1609
+ ...e.points.length < 10 ? { elements: this.scene.getElementsIncludingDeleted().filter((t) => t.id !== e.id) } : {},
1610
+ appState: {
1611
+ newElement: null,
1612
+ editingTextElement: null,
1613
+ startBoundElement: null,
1614
+ suggestedBinding: null,
1615
+ selectedElementIds: F(Object.keys(this.state.selectedElementIds).filter((t) => t !== e.id).reduce((e, t) => (e[t] = this.state.selectedElementIds[t], e), {}), this.state)
1616
+ },
1617
+ captureUpdate: this.state.openDialog?.name === "elementLinkSelector" ? B.EVENTUALLY : B.NEVER
1618
+ });
1619
+ return;
1620
+ }
1621
+ let i = document.getSelection();
1622
+ if (i?.anchorNode && i.removeAllRanges(), this.#Fe(e), !this.state.penDetected && e.pointerType === "pen" && this.setState((e) => ({
1623
+ penMode: !0,
1624
+ penDetected: !0
1625
+ })), !this.editorInterface.isTouchScreen && ["pen", "touch"].includes(e.pointerType) && (this.editorInterface = Ye(this.editorInterface, { isTouchScreen: !0 })), uo || (this.lastPointerDownEvent = e, this.handleCanvasPanUsingWheelOrSpaceDrag(e))) return;
1626
+ if (this.setState({
1627
+ lastPointerDownWith: e.pointerType,
1628
+ cursorButton: "down"
1629
+ }), this.#Et(e.clientX, e.clientY, "down"), e.button === y.ERASER && this.state.activeTool.type !== b.eraser) {
1630
+ this.setState({ activeTool: D(this.state, {
1631
+ type: b.eraser,
1632
+ lastActiveToolBeforeEraser: this.state.activeTool
1633
+ }) }, () => {
1634
+ this.#Ne(e);
1635
+ let t = () => {
1636
+ n(), r?.(), Or(this.state) && this.setState({ activeTool: D(this.state, {
1637
+ ...this.state.activeTool.lastActiveTool || { type: b.selection },
1638
+ lastActiveToolBeforeEraser: null
1639
+ }) });
1640
+ }, n = w(window, h.POINTER_UP, t, { once: !0 }), r;
1641
+ requestAnimationFrame(() => {
1642
+ r = this.missingPointerEventCleanupEmitter.once(t);
1643
+ });
1644
+ });
1645
+ return;
1646
+ }
1647
+ if (e.button !== y.MAIN && e.button !== y.TOUCH && e.button !== y.ERASER || $.pointers.size > 1) return;
1648
+ let a = this.#ze(e);
1649
+ if (this.setState({ selectedElementsAreBeingDragged: !1 }), this.#Be(e, a) || (this.#Ve(), this.#mt(e), this.#He(e, a)) || !(!this.state.penMode || e.pointerType !== "touch" || this.state.activeTool.type === "selection" || this.state.activeTool.type === "lasso" || this.state.activeTool.type === "text" || this.state.activeTool.type === "image")) return;
1650
+ if (this.state.activeTool.type === "lasso") {
1651
+ let t = a.hit.element && this.#Ue(a.hit.element);
1652
+ !a.hit.hasHitCommonBoundingBoxOfSelectedElements && !a.resize.handleType && !t && (this.lassoTrail.startPath(a.origin.x, a.origin.y, e.shiftKey), a.drag.blockDragging = this.editorInterface.formFactor === "desktop"), this.editorInterface.formFactor !== "desktop" && a.hit.element && !t && (this.setState((e) => {
1653
+ let t = {
1654
+ ...e.selectedElementIds,
1655
+ [a.hit.element.id]: !0
1656
+ }, n = [];
1657
+ Object.keys(e.selectedElementIds).forEach((e) => {
1658
+ let t = this.scene.getElement(e);
1659
+ t && n.push(t);
1660
+ });
1661
+ let r = a.hit.element;
1662
+ if (j(r)) Qt(n, r.id).forEach((e) => {
1663
+ delete t[e.id];
1664
+ });
1665
+ else if (r.frameId) t[r.frameId] && delete t[r.id];
1666
+ else {
1667
+ let e = r.groupIds, i = new Set(e.flatMap((e) => zt(this.scene.getNonDeletedElements(), e)).filter((e) => j(e)).map((e) => e.id));
1668
+ i.size > 0 && n.forEach((e) => {
1669
+ e.frameId && i.has(e.frameId) && (delete t[e.id], e.groupIds.flatMap((e) => zt(this.scene.getNonDeletedElements(), e)).forEach((e) => {
1670
+ delete t[e.id];
1671
+ }));
1672
+ });
1673
+ }
1674
+ return { ...I({
1675
+ editingGroupId: e.editingGroupId,
1676
+ selectedElementIds: t
1677
+ }, this.scene.getNonDeletedElements(), e, this) };
1678
+ }), a.hit.wasAddedToSelection = !0);
1679
+ } else this.state.activeTool.type === "text" ? this.#Ge(e, a) : this.state.activeTool.type === "arrow" || this.state.activeTool.type === "line" ? this.#Je(e, this.state.activeTool.type, a) : this.state.activeTool.type === "freedraw" ? this.#Ke(e, this.state.activeTool.type, a) : this.state.activeTool.type === "custom" ? G(this.interactiveCanvas, this.state) : this.state.activeTool.type === b.frame || this.state.activeTool.type === b.magicframe ? this.#Ze(a, this.state.activeTool.type) : this.state.activeTool.type === "laser" ? this.laserTrails.startPath(a.lastCoords.x, a.lastCoords.y) : this.state.activeTool.type !== "eraser" && this.state.activeTool.type !== "hand" && this.state.activeTool.type !== "image" && this.#Xe(this.state.activeTool.type, a);
1680
+ this.props?.onPointerDown?.(this.state.activeTool, a), this.onPointerDownEmitter.trigger(this.state.activeTool, a, e), this.state.activeTool.type === "eraser" && this.eraserTrail.startPath(a.lastCoords.x, a.lastCoords.y);
1681
+ let o = this.#nt(a), s = this.#it(a), c = this.#et(a), l = this.#tt(a);
1682
+ this.missingPointerEventCleanupEmitter.once((t) => s(t || e.nativeEvent)), (!this.state.viewModeEnabled || this.state.activeTool.type === "laser") && (window.addEventListener(h.POINTER_MOVE, o), window.addEventListener(h.POINTER_UP, s), window.addEventListener(h.KEYDOWN, c), window.addEventListener(h.KEYUP, l), a.eventListeners.onMove = o, a.eventListeners.onUp = s, a.eventListeners.onKeyUp = l, a.eventListeners.onKeyDown = c);
1683
+ }, this.#Pe = (e) => {
1684
+ T("COMPLEX_BINDINGS") && this.#f(), this.removePointer(e), this.lastPointerUpEvent = e;
1685
+ let t = O({
1686
+ clientX: e.clientX,
1687
+ clientY: e.clientY
1688
+ }, this.state), { x: n, y: r } = t;
1689
+ this.lastPointerMoveCoords = {
1690
+ x: n,
1691
+ y: r
1692
+ };
1693
+ let i = e.timeStamp - (this.lastPointerDownEvent?.timeStamp ?? 0);
1694
+ if (this.editorInterface.formFactor === "phone" && i < 300) {
1695
+ let n = this.#xe(t.x, t.y);
1696
+ if (ft(n) && this.#v(n, e, t.x, t.y)) {
1697
+ this.#_(n);
1698
+ return;
1699
+ }
1700
+ }
1701
+ this.editorInterface.isTouchScreen && this.#xe(t.x, t.y, { includeLockedElements: !0 }), this.state.viewModeEnabled && this.setState({
1702
+ activeEmbeddable: null,
1703
+ selectedElementIds: {}
1704
+ });
1705
+ }, this.#Fe = (e) => {
1706
+ e.pointerType === "touch" && (mo = !1, Q ? mo = !0 : Q = window.setTimeout(() => {
1707
+ Q = 0, mo || this.#yt(e);
1708
+ }, 500));
1709
+ }, this.#Ie = () => {
1710
+ clearTimeout(Q), Q = 0, mo = !1;
1711
+ }, this.#Le = (e) => {
1712
+ vo?.(), this.missingPointerEventCleanupEmitter.trigger(e).clear();
1713
+ }, this.handleCanvasPanUsingWheelOrSpaceDrag = (e) => {
1714
+ if (!($.pointers.size <= 1 && (e.button === y.WHEEL || e.button === y.MAIN && lo || kr(this.state) || this.state.viewModeEnabled))) return !1;
1715
+ uo = !0, this.focusContainer(), this.state.editingTextElement || e.preventDefault();
1716
+ let t = !1, n = ao(window) ? !1 : /Linux/.test(window.navigator.platform);
1717
+ W(this.interactiveCanvas, u.GRABBING);
1718
+ let { clientX: r, clientY: i } = e, a = _a((e) => {
1719
+ let a = r - e.clientX, o = i - e.clientY;
1720
+ if (r = e.clientX, i = e.clientY, n && !t && (Math.abs(a) > 1 || Math.abs(o) > 1)) {
1721
+ t = !0;
1722
+ let e = (t) => {
1723
+ document.body.removeEventListener(h.PASTE, e), t.stopPropagation();
1724
+ }, n = () => {
1725
+ setTimeout(() => {
1726
+ document.body.removeEventListener(h.PASTE, e), window.removeEventListener(h.POINTER_UP, n);
1727
+ }, 100);
1728
+ };
1729
+ document.body.addEventListener(h.PASTE, e), window.addEventListener(h.POINTER_UP, n);
1730
+ }
1731
+ this.#ae({
1732
+ scrollX: this.state.scrollX - a / this.state.zoom.value,
1733
+ scrollY: this.state.scrollY - o / this.state.zoom.value
1734
+ });
1735
+ }), o = q(vo = () => {
1736
+ vo = null, uo = !1, lo || (this.state.viewModeEnabled ? W(this.interactiveCanvas, u.GRAB) : G(this.interactiveCanvas, this.state)), this.setState({ cursorButton: "up" }), this.#Et(e.clientX, e.clientY, "up"), window.removeEventListener(h.POINTER_MOVE, a), window.removeEventListener(h.POINTER_UP, o), window.removeEventListener(h.BLUR, o), a.flush();
1737
+ });
1738
+ return window.addEventListener(h.BLUR, o), window.addEventListener(h.POINTER_MOVE, a, { passive: !0 }), window.addEventListener(h.POINTER_UP, o), !0;
1739
+ }, this.#Ve = () => {
1740
+ Be(this.state.activeTool.type) || this.setState({
1741
+ selectedElementIds: F({}, this.state),
1742
+ selectedGroupIds: {},
1743
+ editingGroupId: null,
1744
+ activeEmbeddable: null
1745
+ });
1746
+ }, this.#He = (e, t) => {
1747
+ if (Be(this.state.activeTool.type)) {
1748
+ let n = this.scene.getNonDeletedElements(), r = this.scene.getNonDeletedElementsMap(), i = this.scene.getSelectedElements(this.state);
1749
+ if (i.length === 1 && !this.state.selectedLinearElement?.isEditing && !A(i[0]) && !(N(i[0]) && (this.editorInterface.userAgent.isMobileDevice || i[0].points.length === 2)) && !(this.state.selectedLinearElement && this.state.selectedLinearElement.hoverPointIndex !== -1)) {
1750
+ let r = Cr(n, this.state, t.origin.x, t.origin.y, this.state.zoom, e.pointerType, this.scene.getNonDeletedElementsMap(), this.editorInterface);
1751
+ r != null && (r.transformHandleType === "rotation" ? (this.setState({ resizingElement: r.element }), t.resize.handleType = r.transformHandleType) : (this.state.croppingElementId || this.setState({ resizingElement: r.element }), t.resize.handleType = r.transformHandleType));
1752
+ } else i.length > 1 && (t.resize.handleType = wr(En(i), t.origin.x, t.origin.y, this.state.zoom, e.pointerType, this.editorInterface));
1753
+ if (t.resize.handleType) t.resize.isResizing = !0, t.resize.offset = Je(yr(t.resize.handleType, i, r, t.origin.x, t.origin.y)), i.length === 1 && N(i[0]) && i[0].points.length === 2 && (t.resize.arrowDirection = vr(t.resize.handleType, i[0]));
1754
+ else {
1755
+ if (this.state.selectedLinearElement) {
1756
+ let n = this.state.selectedLinearElement, r = z.handlePointerDown(e, this, this.#r, t.origin, n, this.scene);
1757
+ if (r.hitElement && (t.hit.element = r.hitElement), r.linearElementEditor && this.setState({ selectedLinearElement: r.linearElementEditor }), r.didAddPoint) return !0;
1758
+ let i = this.scene.getNonDeletedElementsMap(), a = z.getElement(n.elementId, i);
1759
+ if (a && k(a)) {
1760
+ let { hitFocusPoint: e, pointerOffset: r } = In(a, t, i, this.state);
1761
+ if (e) return this.setState({ selectedLinearElement: {
1762
+ ...n,
1763
+ hoveredFocusPointBinding: e,
1764
+ draggedFocusPointBinding: e,
1765
+ pointerOffset: r
1766
+ } }), !1;
1767
+ }
1768
+ }
1769
+ let n = this.#Se(t.origin.x, t.origin.y, { includeLockedElements: !0 }), r = n.filter((e) => !e.locked), i = this.#xe(t.origin.x, t.origin.y, { allHitElements: n });
1770
+ (!i || i.id !== this.state.activeLockedId) && this.setState({ activeLockedId: null }), i && i.locked && !r.some((e) => this.state.selectedElementIds[e.id]) ? t.hit.element = null : t.hit.element = t.hit.element ?? this.#xe(t.origin.x, t.origin.y), this.state.croppingElementId && t.hit.element?.id !== this.state.croppingElementId && this.#De(), t.hit.allHitElements = r;
1771
+ let a = t.hit.element, o = t.hit.allHitElements.some((e) => this.#Ue(e));
1772
+ if ((a === null || !o) && !e.shiftKey && !t.hit.hasHitCommonBoundingBoxOfSelectedElements && (!this.state.selectedLinearElement?.isEditing || a && a?.id !== this.state.selectedLinearElement?.elementId) && this.#ht(a), this.state.selectedLinearElement?.isEditing) this.setState((e) => ({
1773
+ selectedLinearElement: e.selectedLinearElement ? {
1774
+ ...e.selectedLinearElement,
1775
+ isEditing: !!a && a.id === this.state.selectedLinearElement?.elementId
1776
+ } : null,
1777
+ selectedElementIds: e.selectedLinearElement ? F({ [e.selectedLinearElement.elementId]: !0 }, this.state) : F({}, e)
1778
+ }));
1779
+ else if (a != null) {
1780
+ if (e[x.CTRL_OR_CMD]) return e.altKey ? (this.state.openDialog?.name === "elementLinkSelector" && this.setOpenDialog(null), this.lassoTrail.startPath(t.origin.x, t.origin.y, e.shiftKey), this.setActiveTool({
1781
+ type: "lasso",
1782
+ fromSelection: !0
1783
+ }), !1) : (this.state.selectedElementIds[a.id] || (t.hit.wasAddedToSelection = !0), this.setState((e) => ({
1784
+ ...Rt(e, a),
1785
+ previousSelectedElementIds: this.state.selectedElementIds
1786
+ })), !1);
1787
+ this.state.selectedElementIds[a.id] || (this.state.editingGroupId && !Ht(a, this.state.editingGroupId) && this.setState({
1788
+ selectedElementIds: F({}, this.state),
1789
+ selectedGroupIds: {},
1790
+ editingGroupId: null,
1791
+ activeEmbeddable: null
1792
+ }), !o && !t.hit.hasHitCommonBoundingBoxOfSelectedElements && (this.setState((e) => {
1793
+ let t = {
1794
+ ...e.selectedElementIds,
1795
+ [a.id]: !0
1796
+ }, n = [];
1797
+ if (Object.keys(e.selectedElementIds).forEach((e) => {
1798
+ let t = this.scene.getElement(e);
1799
+ t && n.push(t);
1800
+ }), j(a)) Qt(n, a.id).forEach((e) => {
1801
+ delete t[e.id];
1802
+ });
1803
+ else if (a.frameId) t[a.frameId] && delete t[a.id];
1804
+ else {
1805
+ let e = a.groupIds, r = new Set(e.flatMap((e) => zt(this.scene.getNonDeletedElements(), e)).filter((e) => j(e)).map((e) => e.id));
1806
+ r.size > 0 && n.forEach((e) => {
1807
+ e.frameId && r.has(e.frameId) && (delete t[e.id], e.groupIds.flatMap((e) => zt(this.scene.getNonDeletedElements(), e)).forEach((e) => {
1808
+ delete t[e.id];
1809
+ }));
1810
+ });
1811
+ }
1812
+ return e.openDialog?.name === "elementLinkSelector" && (a.groupIds.some((t) => e.selectedGroupIds[t]) || (t = { [a.id]: !0 })), { ...I({
1813
+ editingGroupId: e.editingGroupId,
1814
+ selectedElementIds: t
1815
+ }, this.scene.getNonDeletedElements(), e, this) };
1816
+ }), t.hit.wasAddedToSelection = !0));
1817
+ }
1818
+ this.setState({ previousSelectedElementIds: this.state.selectedElementIds });
1819
+ }
1820
+ }
1821
+ return !1;
1822
+ }, this.#Ge = (e, t) => {
1823
+ if (this.state.editingTextElement) return;
1824
+ let n = t.origin.x, r = t.origin.y, i = this.#xe(n, r, { includeBoundTextElement: !0 }), a = this.#we(n, r);
1825
+ it(i) && (a = i, n = i.x + i.width / 2, r = i.y + i.height / 2), this.#Te({
1826
+ sceneX: n,
1827
+ sceneY: r,
1828
+ insertAtParentCenter: !e.altKey,
1829
+ container: a,
1830
+ autoEdit: !1
1831
+ }), U(this.interactiveCanvas), this.state.activeTool.locked || this.setState({ activeTool: D(this.state, { type: this.state.preferredSelectionTool.type }) });
1832
+ }, this.#Ke = (e, t, n) => {
1833
+ let [r, i] = C(n.origin.x, n.origin.y, null), a = this.#ke({
1834
+ x: r,
1835
+ y: i
1836
+ }), o = e.pressure === .5, s = tr({
1837
+ type: t,
1838
+ x: r,
1839
+ y: i,
1840
+ strokeColor: this.state.currentItemStrokeColor,
1841
+ backgroundColor: this.state.currentItemBackgroundColor,
1842
+ fillStyle: this.state.currentItemFillStyle,
1843
+ strokeWidth: this.state.currentItemStrokeWidth,
1844
+ strokeStyle: this.state.currentItemStrokeStyle,
1845
+ roughness: this.state.currentItemRoughness,
1846
+ opacity: this.state.currentItemOpacity,
1847
+ roundness: null,
1848
+ simulatePressure: o,
1849
+ locked: !1,
1850
+ frameId: a ? a.id : null,
1851
+ points: [S(0, 0)],
1852
+ pressures: o ? [] : [e.pressure]
1853
+ });
1854
+ this.scene.insertElement(s), this.setState((e) => {
1855
+ let t = { ...e.selectedElementIds };
1856
+ return delete t[s.id], { selectedElementIds: F(t, e) };
1857
+ });
1858
+ let c = R(S(n.origin.x, n.origin.y), this.scene.getNonDeletedElements(), this.scene.getNonDeletedElementsMap());
1859
+ this.setState({
1860
+ newElement: s,
1861
+ startBoundElement: c,
1862
+ suggestedBinding: null
1863
+ });
1864
+ }, this.insertIframeElement = ({ sceneX: e, sceneY: t, width: n, height: r }) => {
1865
+ let [i, a] = C(e, t, this.lastPointerDownEvent?.[x.CTRL_OR_CMD] ? null : this.getEffectiveGridSize()), o = nr({
1866
+ type: "iframe",
1867
+ x: i,
1868
+ y: a,
1869
+ strokeColor: "transparent",
1870
+ backgroundColor: "transparent",
1871
+ fillStyle: this.state.currentItemFillStyle,
1872
+ strokeWidth: this.state.currentItemStrokeWidth,
1873
+ strokeStyle: this.state.currentItemStrokeStyle,
1874
+ roughness: this.state.currentItemRoughness,
1875
+ roundness: this.#Ye("iframe"),
1876
+ opacity: this.state.currentItemOpacity,
1877
+ locked: !1,
1878
+ width: n,
1879
+ height: r
1880
+ });
1881
+ return this.scene.insertElement(o), o;
1882
+ }, this.insertEmbeddableElement = ({ sceneX: e, sceneY: t, link: n }) => {
1883
+ let [r, i] = C(e, t, this.lastPointerDownEvent?.[x.CTRL_OR_CMD] ? null : this.getEffectiveGridSize());
1884
+ if (!n) return;
1885
+ let a = {
1886
+ w: 560,
1887
+ h: 840
1888
+ }, o = $n({
1889
+ type: "embeddable",
1890
+ x: r,
1891
+ y: i,
1892
+ strokeColor: "transparent",
1893
+ backgroundColor: "transparent",
1894
+ fillStyle: this.state.currentItemFillStyle,
1895
+ strokeWidth: this.state.currentItemStrokeWidth,
1896
+ strokeStyle: this.state.currentItemStrokeStyle,
1897
+ roughness: this.state.currentItemRoughness,
1898
+ roundness: this.#Ye("embeddable"),
1899
+ opacity: this.state.currentItemOpacity,
1900
+ locked: !1,
1901
+ width: a.w,
1902
+ height: a.h,
1903
+ link: n
1904
+ });
1905
+ return this.scene.insertElement(o), o;
1906
+ }, this.#qe = ({ sceneX: e, sceneY: t, addToFrameUnderCursor: n = !0 }) => {
1907
+ let [r, i] = C(e, t, this.lastPointerDownEvent?.[x.CTRL_OR_CMD] ? null : this.getEffectiveGridSize()), a = n ? this.#ke({
1908
+ x: r,
1909
+ y: i
1910
+ }) : null, o = 100 / this.state.zoom.value;
1911
+ return rr({
1912
+ type: "image",
1913
+ strokeColor: this.state.currentItemStrokeColor,
1914
+ backgroundColor: this.state.currentItemBackgroundColor,
1915
+ fillStyle: this.state.currentItemFillStyle,
1916
+ strokeWidth: this.state.currentItemStrokeWidth,
1917
+ strokeStyle: this.state.currentItemStrokeStyle,
1918
+ roughness: this.state.currentItemRoughness,
1919
+ roundness: null,
1920
+ opacity: this.state.currentItemOpacity,
1921
+ locked: !1,
1922
+ frameId: a ? a.id : null,
1923
+ x: r - o / 2,
1924
+ y: i - o / 2,
1925
+ width: o,
1926
+ height: o
1927
+ });
1928
+ }, this.#Je = (e, t, n) => {
1929
+ if (e.ctrlKey && Z(() => {
1930
+ this.setState({ isBindingEnabled: !1 });
1931
+ }), this.state.multiElement) {
1932
+ let { multiElement: t, selectedLinearElement: r } = this.state;
1933
+ if (E(r, "selectedLinearElement is expected to be set"), t.type === "line" && ln(t.points, this.state.zoom.value)) {
1934
+ Z(() => {
1935
+ this.setState({ selectedLinearElement: {
1936
+ ...r,
1937
+ lastCommittedPoint: t.points[t.points.length - 1],
1938
+ initialState: {
1939
+ ...r.initialState,
1940
+ lastClickedPoint: -1
1941
+ }
1942
+ } });
1943
+ }), this.actionManager.executeAction(K);
1944
+ return;
1945
+ }
1946
+ if (A(t) && t.points.length > 1) {
1947
+ this.actionManager.executeAction(K, "ui", {
1948
+ event: e.nativeEvent,
1949
+ sceneCoords: {
1950
+ x: n.origin.x,
1951
+ y: n.origin.y
1952
+ }
1953
+ });
1954
+ return;
1955
+ }
1956
+ let { x: i, y: a } = t, { lastCommittedPoint: o } = r, s = yn(this.state) && R(S(this.lastPointerMoveCoords?.x ?? i + t.points[t.points.length - 1][0], this.lastPointerMoveCoords?.y ?? a + t.points[t.points.length - 1][1]), this.scene.getNonDeletedElements(), this.scene.getNonDeletedElementsMap());
1957
+ if (k(t) && s || t.points.length > 1 && o && Oe(S(n.origin.x - i, n.origin.y - a), o) < 8) {
1958
+ this.actionManager.executeAction(K, "ui", {
1959
+ event: e.nativeEvent,
1960
+ sceneCoords: {
1961
+ x: n.origin.x,
1962
+ y: n.origin.y
1963
+ }
1964
+ });
1965
+ return;
1966
+ }
1967
+ this.setState((e) => ({ selectedElementIds: F({
1968
+ ...e.selectedElementIds,
1969
+ [t.id]: !0
1970
+ }, e) })), W(this.interactiveCanvas, u.POINTER);
1971
+ } else {
1972
+ let [r, i] = C(n.origin.x, n.origin.y, e[x.CTRL_OR_CMD] ? null : this.getEffectiveGridSize()), a = this.#ke({
1973
+ x: r,
1974
+ y: i
1975
+ }), { currentItemStartArrowhead: o, currentItemEndArrowhead: s } = this.state, [l, u] = t === "arrow" ? [o, s] : [null, null], d = t === "arrow" ? Zn({
1976
+ type: t,
1977
+ x: r,
1978
+ y: i,
1979
+ strokeColor: this.state.currentItemStrokeColor,
1980
+ backgroundColor: this.state.currentItemBackgroundColor,
1981
+ fillStyle: this.state.currentItemFillStyle,
1982
+ strokeWidth: this.state.currentItemStrokeWidth,
1983
+ strokeStyle: this.state.currentItemStrokeStyle,
1984
+ roughness: this.state.currentItemRoughness,
1985
+ opacity: this.state.currentItemOpacity,
1986
+ roundness: this.state.currentItemArrowType === c.round ? { type: ne.PROPORTIONAL_RADIUS } : null,
1987
+ startArrowhead: l,
1988
+ endArrowhead: u,
1989
+ locked: !1,
1990
+ frameId: a ? a.id : null,
1991
+ elbowed: this.state.currentItemArrowType === c.elbow,
1992
+ fixedSegments: this.state.currentItemArrowType === c.elbow ? [] : null
1993
+ }) : ir({
1994
+ type: t,
1995
+ x: r,
1996
+ y: i,
1997
+ strokeColor: this.state.currentItemStrokeColor,
1998
+ backgroundColor: this.state.currentItemBackgroundColor,
1999
+ fillStyle: this.state.currentItemFillStyle,
2000
+ strokeWidth: this.state.currentItemStrokeWidth,
2001
+ strokeStyle: this.state.currentItemStrokeStyle,
2002
+ roughness: this.state.currentItemRoughness,
2003
+ opacity: this.state.currentItemOpacity,
2004
+ roundness: this.state.currentItemRoundness === "round" ? { type: ne.PROPORTIONAL_RADIUS } : null,
2005
+ locked: !1,
2006
+ frameId: a ? a.id : null
2007
+ }), f = S(n.origin.x, n.origin.y), p = this.scene.getNonDeletedElementsMap(), m = yn(this.state) ? R(f, this.scene.getNonDeletedElements(), p) : null;
2008
+ this.scene.mutateElement(d, { points: [S(0, 0), S(0, 0)] }), this.scene.insertElement(d), k(d) && hn(d, /* @__PURE__ */ new Map([[0, {
2009
+ point: S(0, 0),
2010
+ isDragging: !1
2011
+ }]]), f[0], f[1], this.scene, this.state, {
2012
+ newArrow: !0,
2013
+ altKey: e.altKey,
2014
+ initialBinding: !0,
2015
+ angleLocked: Se(e.nativeEvent)
2016
+ }), Z(() => {
2017
+ this.setState((e) => {
2018
+ let t = null, r = e.selectedElementIds;
2019
+ if (N(d)) {
2020
+ t = new z(d, this.scene.getNonDeletedElementsMap());
2021
+ let e = d.points.length - 1;
2022
+ t = {
2023
+ ...t,
2024
+ selectedPointsIndices: [e],
2025
+ initialState: {
2026
+ ...t.initialState,
2027
+ lastClickedPoint: e,
2028
+ origin: S(n.origin.x, n.origin.y)
2029
+ }
2030
+ };
2031
+ }
2032
+ return r = this.state.activeTool.locked ? e.selectedElementIds : F({ [d.id]: !0 }, e), {
2033
+ ...e,
2034
+ bindMode: "orbit",
2035
+ newElement: d,
2036
+ startBoundElement: m,
2037
+ suggestedBinding: m || null,
2038
+ selectedElementIds: r,
2039
+ selectedLinearElement: t
2040
+ };
2041
+ });
2042
+ }), k(d) && T("COMPLEX_BINDINGS") && this.#m(d, m);
2043
+ }
2044
+ }, this.#Xe = (e, t) => {
2045
+ let [n, r] = C(t.origin.x, t.origin.y, this.lastPointerDownEvent?.[x.CTRL_OR_CMD] ? null : this.getEffectiveGridSize()), i = this.#ke({
2046
+ x: n,
2047
+ y: r
2048
+ }), a = {
2049
+ x: n,
2050
+ y: r,
2051
+ strokeColor: this.state.currentItemStrokeColor,
2052
+ backgroundColor: this.state.currentItemBackgroundColor,
2053
+ fillStyle: this.state.currentItemFillStyle,
2054
+ strokeWidth: this.state.currentItemStrokeWidth,
2055
+ strokeStyle: this.state.currentItemStrokeStyle,
2056
+ roughness: this.state.currentItemRoughness,
2057
+ opacity: this.state.currentItemOpacity,
2058
+ roundness: this.#Ye(e),
2059
+ locked: !1,
2060
+ frameId: i ? i.id : null
2061
+ }, o;
2062
+ o = e === "embeddable" ? $n({
2063
+ type: "embeddable",
2064
+ ...a
2065
+ }) : Qn({
2066
+ type: e,
2067
+ ...a
2068
+ }), o.type === "selection" ? this.setState({ selectionElement: o }) : (this.scene.insertElement(o), this.setState({
2069
+ multiElement: null,
2070
+ newElement: o
2071
+ }));
2072
+ }, this.#Ze = (e, t) => {
2073
+ let [n, r] = C(e.origin.x, e.origin.y, this.lastPointerDownEvent?.[x.CTRL_OR_CMD] ? null : this.getEffectiveGridSize()), i = {
2074
+ x: n,
2075
+ y: r,
2076
+ opacity: this.state.currentItemOpacity,
2077
+ locked: !1,
2078
+ ...g
2079
+ }, a = t === b.magicframe ? ar(i) : er(i);
2080
+ this.scene.insertElement(a), this.setState({
2081
+ multiElement: null,
2082
+ newElement: a
2083
+ });
2084
+ }, this.#at = () => {
2085
+ this.#l = /* @__PURE__ */ new Set(), this.#se();
2086
+ }, this.#ot = () => {
2087
+ let e = !1;
2088
+ this.#l.forEach((e) => {
2089
+ let t = this.scene.getElement(e);
2090
+ if (k(t)) {
2091
+ if (t.startBinding) {
2092
+ let e = this.scene.getElement(t.startBinding.elementId);
2093
+ Wt(e, this.scene.getElementsMapIncludingDeleted(), { boundElements: e.boundElements.filter((e) => e.id !== t.id) });
2094
+ }
2095
+ if (t.endBinding) {
2096
+ let e = this.scene.getElement(t.endBinding.elementId);
2097
+ Wt(e, this.scene.getElementsMapIncludingDeleted(), { boundElements: e.boundElements.filter((e) => e.id !== t.id) });
2098
+ }
2099
+ } else ot(t) && t.boundElements?.forEach?.((e) => {
2100
+ if (e.type === "arrow") {
2101
+ let n = this.scene.getElement(e.id);
2102
+ n?.startBinding?.elementId === t.id && Wt(n, this.scene.getElementsMapIncludingDeleted(), { startBinding: null }), n?.endBinding?.elementId === t.id && Wt(n, this.scene.getElementsMapIncludingDeleted(), { endBinding: null });
2103
+ }
2104
+ });
2105
+ });
2106
+ let t = this.scene.getElementsIncludingDeleted().map((t) => this.#l.has(t.id) || t.frameId && this.#l.has(t.frameId) || ct(t) && this.#l.has(t.containerId) ? (e = !0, L(t, { isDeleted: !0 })) : t);
2107
+ this.#l = /* @__PURE__ */ new Set(), e && (this.#r.scheduleCapture(), this.scene.replaceAllElements(t));
2108
+ }, this.#st = async (e, t) => {
2109
+ if (!ui(t)) throw Error(H("errors.unsupportedFileType"));
2110
+ let n = t.type;
2111
+ if (W(this.interactiveCanvas, "wait"), n === v.svg) try {
2112
+ t = ii(hr(await t.text()), t.name);
2113
+ } catch (e) {
2114
+ throw console.warn(e), Error(H("errors.svgImageInsertError"));
2115
+ }
2116
+ let r = await (this.props.generateIdForFile?.(t) || oi(t));
2117
+ if (!r) throw console.warn("Couldn't generate file id or the supplied `generateIdForFile` didn't resolve to one."), Error(H("errors.imageInsertError"));
2118
+ if (!this.files[r]?.dataURL) {
2119
+ try {
2120
+ t = await hi(t, { maxWidthOrHeight: f });
2121
+ } catch (e) {
2122
+ console.error("Error trying to resizing image file on insertion", e);
2123
+ }
2124
+ if (t.size > 4194304) throw Error(H("errors.fileTooBig", { maxSize: `${Math.trunc(ee / 1024 / 1024)}MB` }));
2125
+ }
2126
+ let i = this.files[r]?.dataURL || await si(t);
2127
+ return new Promise(async (t, a) => {
2128
+ try {
2129
+ let a = this.#ct(e, r);
2130
+ if (this.#oe([{
2131
+ mimeType: n,
2132
+ id: r,
2133
+ dataURL: i,
2134
+ created: Date.now(),
2135
+ lastRetrieved: Date.now()
2136
+ }]), !this.imageCache.get(r)) {
2137
+ this.#ft();
2138
+ let { erroredFiles: e } = await this.#dt([a]);
2139
+ if (e.size) throw Error("Image cache update resulted with an error.");
2140
+ }
2141
+ let o = await this.imageCache.get(r)?.image;
2142
+ if (o && this.state.newElement?.id !== a.id) {
2143
+ a = this.#ct(e, r);
2144
+ let t = this.#ut(a, o);
2145
+ Object.assign(a, t);
2146
+ }
2147
+ t(a);
2148
+ } catch (e) {
2149
+ console.error(e), a(Error(H("errors.imageInsertError")));
2150
+ }
2151
+ });
2152
+ }, this.#ct = (e, t) => L(this.scene.getElement(e.id) ?? e, { fileId: t }), this.#lt = async () => {
2153
+ try {
2154
+ let { x: e, y: t } = O({
2155
+ clientX: this.state.width / 2 + this.state.offsetLeft,
2156
+ clientY: this.state.height / 2 + this.state.offsetTop
2157
+ }, this.state), n = await $r({
2158
+ description: "Image",
2159
+ extensions: Object.keys(_),
2160
+ multiple: !0
2161
+ });
2162
+ this.#_t(n, e, t);
2163
+ } catch (e) {
2164
+ e.name === "AbortError" ? console.warn(e) : console.error(e), this.setState({
2165
+ newElement: null,
2166
+ activeTool: D(this.state, { type: this.state.preferredSelectionTool.type })
2167
+ }, () => {
2168
+ this.actionManager.executeAction(K);
2169
+ });
2170
+ }
2171
+ }, this.#ut = (e, t) => {
2172
+ let n = Math.max(this.state.height - 120, 160), r = Math.min(n, Math.floor(this.state.height * .5) / this.state.zoom.value), i = Math.min(t.naturalHeight, r), a = i * (t.naturalWidth / t.naturalHeight);
2173
+ return {
2174
+ x: e.x + e.width / 2 - a / 2,
2175
+ y: e.y + e.height / 2 - i / 2,
2176
+ width: a,
2177
+ height: i,
2178
+ crop: null
2179
+ };
2180
+ }, this.#dt = async (e, t = this.files) => {
2181
+ let { updatedFiles: n, erroredFiles: r } = await gr({
2182
+ imageCache: this.imageCache,
2183
+ fileIds: e.map((e) => e.fileId),
2184
+ files: t
2185
+ });
2186
+ return r.size && (this.#r.scheduleAction(B.NEVER), this.scene.replaceAllElements(this.scene.getElementsIncludingDeleted().map((e) => pt(e) && r.has(e.fileId) ? L(e, { status: "error" }) : e))), {
2187
+ updatedFiles: n,
2188
+ erroredFiles: r
2189
+ };
2190
+ }, this.#ft = async (e = mr(this.scene.getNonDeletedElements()), t = this.files) => {
2191
+ let n = e.filter((e) => !e.isDeleted && !this.imageCache.has(e.fileId));
2192
+ if (n.length) {
2193
+ let { updatedFiles: e } = await this.#dt(n, t);
2194
+ if (e.size) for (let t of n) e.has(t.fileId) && sn.delete(t);
2195
+ e.size && this.scene.triggerUpdate();
2196
+ }
2197
+ }, this.#pt = eo(() => {
2198
+ this.#ft();
2199
+ }, 500), this.#mt = (e) => {
2200
+ let t = xn(e);
2201
+ this.state.isBindingEnabled !== t && this.setState({ isBindingEnabled: t });
2202
+ }, this.#gt = (e) => {
2203
+ e === null ? (this.interactiveCanvas?.removeEventListener?.(h.TOUCH_START, this.#$), this.interactiveCanvas?.removeEventListener?.(h.TOUCH_END, this.#ee)) : (this.interactiveCanvas = e, this.interactiveCanvas.addEventListener(h.TOUCH_START, this.#$, { passive: !1 }), this.interactiveCanvas.addEventListener(h.TOUCH_END, this.#ee));
2204
+ }, this.#_t = async (e, t, n) => {
2205
+ let r = 50 / this.state.zoom.value, i = _r(e.map(() => this.#qe({
2206
+ sceneX: t,
2207
+ sceneY: n
2208
+ })), t, n, r);
2209
+ i.forEach((e) => this.scene.insertElement(e));
2210
+ let a = await Promise.all(i.map(async (t, n) => {
2211
+ try {
2212
+ return await this.#st(t, await pi(e[n]));
2213
+ } catch (e) {
2214
+ return this.setState({ errorMessage: e.message || H("errors.imageInsertError") }), L(t, { isDeleted: !0 });
2215
+ }
2216
+ })), o = Ae(a), s = _r(a.filter((e) => !e.isDeleted), t, n, r), c = Ae(s), l = this.scene.getElementsIncludingDeleted().map((e) => c.get(e.id) ?? o.get(e.id) ?? e);
2217
+ this.updateScene({
2218
+ appState: { selectedElementIds: F(Object.fromEntries(s.map((e) => [e.id, !0])), this.state) },
2219
+ elements: l,
2220
+ captureUpdate: B.IMMEDIATELY
2221
+ }), this.setState({}, () => {
2222
+ this.actionManager.executeAction(K);
2223
+ });
2224
+ }, this.#vt = async (e) => {
2225
+ let { x: t, y: n } = O(e, this.state), r = await vi(e), i = r.getFiles();
2226
+ if (i.length === 1) {
2227
+ let { file: e, fileHandle: t } = i[0];
2228
+ if (e && (e.type === v.png || e.type === v.svg)) try {
2229
+ let n = await di(e, this.state, this.scene.getElementsIncludingDeleted(), t);
2230
+ this.syncActionResult({
2231
+ ...n,
2232
+ appState: {
2233
+ ...n.appState || this.state,
2234
+ isLoading: !1
2235
+ },
2236
+ replaceFiles: !0,
2237
+ captureUpdate: B.IMMEDIATELY
2238
+ });
2239
+ return;
2240
+ } catch (e) {
2241
+ if (e.name !== "EncodingError") throw Error(H("alerts.couldNotLoadInvalidFile"), { cause: e });
2242
+ }
2243
+ }
2244
+ let a = i.map((e) => e.file).filter((e) => ui(e));
2245
+ if (a.length > 0 && this.#de("image")) return this.#_t(a, t, n);
2246
+ let o = r.getData(v.drawlibIds), s = r.getData(v.drawlib);
2247
+ if (o || s) {
2248
+ try {
2249
+ let t = null;
2250
+ if (o) {
2251
+ let { itemIds: e } = JSON.parse(o);
2252
+ t = (await this.library.getLatestLibrary()).filter((t) => e.includes(t.id));
2253
+ } else s && (t = mi(s));
2254
+ t?.length && (t = t.map((e) => ({
2255
+ ...e,
2256
+ elements: Hn({
2257
+ type: "everything",
2258
+ elements: e.elements,
2259
+ randomizeSeed: !0
2260
+ }).duplicatedElements
2261
+ })), this.addElementsFromPasteOrLibrary({
2262
+ elements: da(t),
2263
+ position: e,
2264
+ files: null
2265
+ }));
2266
+ } catch (e) {
2267
+ this.setState({ errorMessage: e.message });
2268
+ }
2269
+ return;
2270
+ }
2271
+ if (i.length > 0) {
2272
+ let { file: e, fileHandle: t } = i[0];
2273
+ e && await this.loadFileToCanvas(e, t);
2274
+ }
2275
+ let c = r.findByType(v.text);
2276
+ if (c) {
2277
+ let e = c.value;
2278
+ if (e && lr(e, this.props.validateEmbeddable) && /^(http|https):\/\/[^\s/$.?#].[^\s]*$/.test(e)) {
2279
+ let r = this.insertEmbeddableElement({
2280
+ sceneX: t,
2281
+ sceneY: n,
2282
+ link: $e(e)
2283
+ });
2284
+ r && (this.#r.scheduleCapture(), this.setState({ selectedElementIds: { [r.id]: !0 } }));
2285
+ }
2286
+ }
2287
+ }, this.loadFileToCanvas = async (e, t) => {
2288
+ e = await pi(e);
2289
+ try {
2290
+ let n = this.scene.getElementsIncludingDeleted(), r;
2291
+ try {
2292
+ r = await fi(e, this.state, n, t);
2293
+ } catch (e) {
2294
+ let t = e instanceof Qr;
2295
+ if (t && e.code === "IMAGE_NOT_CONTAINS_SCENE_DATA" && !this.#de("image")) {
2296
+ this.setState({
2297
+ isLoading: !1,
2298
+ errorMessage: H("errors.imageToolNotSupported")
2299
+ });
2300
+ return;
2301
+ }
2302
+ let n = H(t ? "alerts.cannotRestoreFromImage" : "alerts.couldNotLoadInvalidFile");
2303
+ this.setState({
2304
+ isLoading: !1,
2305
+ errorMessage: n
2306
+ });
2307
+ }
2308
+ if (!r) return;
2309
+ r.type === v.draw ? (Cn(n.concat(r.data.elements)), this.#r.scheduleMicroAction({
2310
+ action: B.NEVER,
2311
+ elements: n,
2312
+ appState: void 0
2313
+ }), this.setState({ isLoading: !0 }), this.syncActionResult({
2314
+ ...r.data,
2315
+ appState: {
2316
+ ...r.data.appState || this.state,
2317
+ isLoading: !1
2318
+ },
2319
+ replaceFiles: !0,
2320
+ captureUpdate: B.IMMEDIATELY
2321
+ })) : r.type === v.drawlib && await this.library.updateLibrary({
2322
+ libraryItems: e,
2323
+ merge: !0,
2324
+ openLibraryMenu: !0
2325
+ }).catch((e) => {
2326
+ console.error(e), this.setState({ errorMessage: H("errors.importLibraryError") });
2327
+ });
2328
+ } catch (e) {
2329
+ this.setState({
2330
+ isLoading: !1,
2331
+ errorMessage: e.message
2332
+ });
2333
+ }
2334
+ }, this.#yt = (e) => {
2335
+ if (e.preventDefault(), ("pointerType" in e.nativeEvent && e.nativeEvent.pointerType === "touch" || "pointerType" in e.nativeEvent && e.nativeEvent.pointerType === "pen" && e.button !== y.SECONDARY) && this.state.activeTool.type !== this.state.preferredSelectionTool.type) return;
2336
+ let { x: t, y: n } = O(e, this.state), r = this.#xe(t, n, {
2337
+ preferSelected: !0,
2338
+ includeLockedElements: !0
2339
+ }), i = this.scene.getSelectedElements(this.state), a = this.#We({
2340
+ x: t,
2341
+ y: n
2342
+ }, i), o = r || a ? "element" : "canvas", { top: s, left: c } = this.rootElement.getBoundingClientRect(), l = e.clientX - c, u = e.clientY - s;
2343
+ V("contextMenu", "openContextMenu", o), this.setState({ ...r && !this.state.selectedElementIds[r.id] ? {
2344
+ ...this.state,
2345
+ ...I({
2346
+ editingGroupId: this.state.editingGroupId,
2347
+ selectedElementIds: { [r.id]: !0 }
2348
+ }, this.scene.getNonDeletedElements(), this.state, this),
2349
+ selectedLinearElement: N(r) ? new z(r, this.scene.getNonDeletedElementsMap()) : null
2350
+ } : this.state }, () => {
2351
+ this.setState({ contextMenu: {
2352
+ top: u,
2353
+ left: l,
2354
+ items: this.#Ct(o)
2355
+ } });
2356
+ });
2357
+ }, this.#bt = (e, t, n = !0) => {
2358
+ let r = this.state.selectionElement, i = e.lastCoords;
2359
+ if (r && e.boxSelection.hasOccurred && this.state.activeTool.type !== "eraser") {
2360
+ Kn({
2361
+ newElement: r,
2362
+ elementType: this.state.activeTool.type,
2363
+ originX: e.origin.x,
2364
+ originY: e.origin.y,
2365
+ x: i.x,
2366
+ y: i.y,
2367
+ width: Me(e.origin.x, i.x),
2368
+ height: Me(e.origin.y, i.y),
2369
+ shouldMaintainAspectRatio: be(t),
2370
+ shouldResizeFromCenter: !1,
2371
+ scene: this.scene,
2372
+ zoom: this.state.zoom.value,
2373
+ informMutation: !1
2374
+ });
2375
+ return;
2376
+ }
2377
+ let a = this.state.newElement;
2378
+ if (!a) return;
2379
+ let [o, s] = C(i.x, i.y, t[x.CTRL_OR_CMD] ? null : this.getEffectiveGridSize()), c = pt(a) && this.imageCache.get(a.fileId)?.image, l = c && !(c instanceof Promise) ? c.width / c.height : null;
2380
+ this.#Qe(t, [a]);
2381
+ let { snapOffset: u, snapLines: d } = Da(a, this, t, {
2382
+ x: e.originInGrid.x + (this.state.originSnapOffset?.x ?? 0),
2383
+ y: e.originInGrid.y + (this.state.originSnapOffset?.y ?? 0)
2384
+ }, {
2385
+ x: o - e.originInGrid.x,
2386
+ y: s - e.originInGrid.y
2387
+ }, this.scene.getNonDeletedElementsMap());
2388
+ o += u.x, s += u.y, this.setState({ snapLines: d }), k(a) || Kn({
2389
+ newElement: a,
2390
+ elementType: this.state.activeTool.type,
2391
+ originX: e.originInGrid.x,
2392
+ originY: e.originInGrid.y,
2393
+ x: o,
2394
+ y: s,
2395
+ width: Me(e.originInGrid.x, o),
2396
+ height: Me(e.originInGrid.y, s),
2397
+ shouldMaintainAspectRatio: M(a) ? !be(t) : be(t),
2398
+ shouldResizeFromCenter: xe(t),
2399
+ zoom: this.state.zoom.value,
2400
+ scene: this.scene,
2401
+ widthAspectRatio: l,
2402
+ originOffset: this.state.originSnapOffset,
2403
+ informMutation: n
2404
+ }), this.setState({ newElement: a }), (this.state.activeTool.type === b.frame || this.state.activeTool.type === b.magicframe) && this.setState({ elementsToHighlight: Xt(this.scene.getNonDeletedElements(), a, this.state, this.scene.getNonDeletedElementsMap()) });
2405
+ }, this.#xt = (e, t) => {
2406
+ if (!this.state.croppingElementId) return !1;
2407
+ let n = e.resize.handleType, r = e.lastCoords, [i, a] = C(r.x - e.resize.offset.x, r.y - e.resize.offset.y, t[x.CTRL_OR_CMD] ? null : this.getEffectiveGridSize()), o = this.scene.getNonDeletedElementsMap().get(this.state.croppingElementId);
2408
+ if (n && o && M(o)) {
2409
+ let s = e.originalElements.get(o.id), c = pt(o) && this.imageCache.get(o.fileId)?.image;
2410
+ if (s && M(s) && c && !(c instanceof Promise)) {
2411
+ let [l, u] = C(r.x, r.y, t[x.CTRL_OR_CMD] ? null : this.getEffectiveGridSize()), d = {
2412
+ x: l - e.originInGrid.x,
2413
+ y: u - e.originInGrid.y
2414
+ };
2415
+ this.#Qe(t, [o]);
2416
+ let { snapOffset: f, snapLines: p } = Oa([o], [s], this, t, d, n);
2417
+ this.scene.mutateElement(o, nt(o, this.scene.getNonDeletedElementsMap(), n, c.naturalWidth, c.naturalHeight, i + f.x, a + f.y, t.shiftKey ? s.width / s.height : void 0)), Sn(o, this.scene), this.setState({
2418
+ isCropping: n && n !== "rotation",
2419
+ snapLines: p
2420
+ });
2421
+ }
2422
+ return !0;
2423
+ }
2424
+ return !1;
2425
+ }, this.#St = (e, t) => {
2426
+ let n = this.scene.getSelectedElements(this.state), r = n.filter((e) => j(e)), i = e.resize.handleType;
2427
+ if (r.length > 0 && i === "rotation" || n.length === 1 && A(n[0]) || this.state.croppingElementId) return !1;
2428
+ this.setState({
2429
+ isResizing: i && i !== "rotation",
2430
+ isRotating: i === "rotation",
2431
+ activeEmbeddable: null
2432
+ });
2433
+ let a = e.lastCoords, [o, s] = C(a.x - e.resize.offset.x, a.y - e.resize.offset.y, t[x.CTRL_OR_CMD] ? null : this.getEffectiveGridSize()), c = /* @__PURE__ */ new Map();
2434
+ if (r.forEach((e) => {
2435
+ Qt(this.scene.getNonDeletedElements(), e.id).forEach((t) => {
2436
+ c.set(e.id + t.id, {
2437
+ x: t.x - e.x,
2438
+ y: t.y - e.y
2439
+ });
2440
+ });
2441
+ }), !this.state.selectedElementsAreBeingDragged) {
2442
+ let [r, c] = C(a.x, a.y, t[x.CTRL_OR_CMD] ? null : this.getEffectiveGridSize()), l = {
2443
+ x: r - e.originInGrid.x,
2444
+ y: c - e.originInGrid.y
2445
+ }, u = [...e.originalElements.values()];
2446
+ this.#Qe(t, n);
2447
+ let { snapOffset: d, snapLines: f } = Oa(n, St(u, this.state), this, t, l, i);
2448
+ o += d.x, s += d.y, this.setState({ snapLines: f });
2449
+ }
2450
+ if (br(e.originalElements, i, n, this.scene, Se(t), xe(t), n.some((e) => M(e)) ? !be(t) : be(t), o, s, e.resize.center.x, e.resize.center.y)) {
2451
+ let e = /* @__PURE__ */ new Set();
2452
+ return r.forEach((t) => {
2453
+ Xt(this.scene.getNonDeletedElements(), t, this.state, this.scene.getNonDeletedElementsMap()).forEach((t) => e.add(t));
2454
+ }), this.setState({ elementsToHighlight: [...e] }), !0;
2455
+ }
2456
+ return !1;
2457
+ }, this.#Ct = (e) => {
2458
+ let t = [];
2459
+ if (t.push(Ri, zi), e === "canvas") return this.state.viewModeEnabled ? [
2460
+ ...t,
2461
+ Ui,
2462
+ Gi,
2463
+ sa,
2464
+ Qi
2465
+ ] : [
2466
+ Vi,
2467
+ Y,
2468
+ Ri,
2469
+ zi,
2470
+ Hi,
2471
+ Y,
2472
+ bi,
2473
+ Xi,
2474
+ Y,
2475
+ Ui,
2476
+ Wi,
2477
+ Gi,
2478
+ sa,
2479
+ Qi
2480
+ ];
2481
+ if (t.push(Hi), this.state.viewModeEnabled) return [Li, ...t];
2482
+ let n = this.editorInterface.formFactor === "desktop" ? [
2483
+ Y,
2484
+ Ci,
2485
+ xi,
2486
+ wi,
2487
+ Si
2488
+ ] : [];
2489
+ return [
2490
+ Y,
2491
+ Bi,
2492
+ Li,
2493
+ Vi,
2494
+ Y,
2495
+ na,
2496
+ ta,
2497
+ ra,
2498
+ Y,
2499
+ $i,
2500
+ Y,
2501
+ ...t,
2502
+ Y,
2503
+ Ai,
2504
+ ji,
2505
+ Y,
2506
+ Mi,
2507
+ oa,
2508
+ qi,
2509
+ Ki,
2510
+ Ji,
2511
+ Ni,
2512
+ Y,
2513
+ Pi,
2514
+ ...n,
2515
+ Y,
2516
+ Fi,
2517
+ Ii,
2518
+ Y,
2519
+ Zi,
2520
+ Y,
2521
+ ea,
2522
+ Y,
2523
+ Zr,
2524
+ Yi,
2525
+ Y,
2526
+ Yr
2527
+ ];
2528
+ }, this.#wt = q((e) => {
2529
+ if (!(e.target instanceof HTMLCanvasElement || e.target instanceof HTMLTextAreaElement || e.target instanceof HTMLIFrameElement || e.target instanceof HTMLElement && e.target.classList.contains(l.FRAME_NAME))) {
2530
+ e[x.CTRL_OR_CMD] && e.preventDefault();
2531
+ return;
2532
+ }
2533
+ if (e.preventDefault(), uo) return;
2534
+ let { deltaX: t, deltaY: n } = e;
2535
+ if (e.metaKey || e.ctrlKey) {
2536
+ let e = Math.sign(n), t = ae * 100, r = Math.abs(n), i = n;
2537
+ r > t && (i = t * e);
2538
+ let a = this.state.zoom.value - i / 100;
2539
+ a += Math.log10(Math.max(1, this.state.zoom.value)) * -e * Math.min(1, r / 20), this.#ae((e) => ({
2540
+ ...Ei({
2541
+ viewportX: this.lastViewportPosition.x,
2542
+ viewportY: this.lastViewportPosition.y,
2543
+ nextZoom: Kr(a)
2544
+ }, e),
2545
+ shouldCacheIgnoreZoom: !0
2546
+ })), this.#Dt();
2547
+ return;
2548
+ }
2549
+ if (e.shiftKey) {
2550
+ this.#ae(({ zoom: e, scrollX: r }) => ({ scrollX: r - (n || t) / e.value }));
2551
+ return;
2552
+ }
2553
+ this.#ae(({ zoom: e, scrollX: r, scrollY: i }) => ({
2554
+ scrollX: r - t / e.value,
2555
+ scrollY: i - n / e.value
2556
+ }));
2557
+ }), this.#Et = (e, t, n) => {
2558
+ if (!e || !t) return;
2559
+ let { x: r, y: i } = O({
2560
+ clientX: e,
2561
+ clientY: t
2562
+ }, this.state), a = {
2563
+ x: r,
2564
+ y: i,
2565
+ tool: this.state.activeTool.type === "laser" ? "laser" : "pointer"
2566
+ };
2567
+ this.props.onPointerUpdate?.({
2568
+ pointer: a,
2569
+ button: n,
2570
+ pointersMap: $.pointers
2571
+ });
2572
+ }, this.#Dt = je(() => {
2573
+ this.unmounted || this.setState({ shouldCacheIgnoreZoom: !1 });
2574
+ }, 300), this.#Ot = (e) => {
2575
+ if (this.rootElement) {
2576
+ let { width: t, height: n, left: r, top: i } = this.rootElement.getBoundingClientRect(), { width: a, height: o, offsetTop: s, offsetLeft: c } = this.state;
2577
+ if (t === a && n === o && r === c && i === s) {
2578
+ e && e();
2579
+ return;
2580
+ }
2581
+ this.setState({
2582
+ width: t,
2583
+ height: n,
2584
+ offsetLeft: r,
2585
+ offsetTop: i
2586
+ }, () => {
2587
+ e && e();
2588
+ });
2589
+ }
2590
+ }, this.refresh = () => {
2591
+ this.setState({ ...this.#kt() });
2592
+ }, this.watchState = () => {};
2593
+ let n = Dr(), { drawAPI: i, viewModeEnabled: d = !1, zenModeEnabled: p = !1, gridModeEnabled: m = !1, objectsSnapModeEnabled: oe = !1, theme: de = n.theme, name: Ce = `${H("labels.untitled")}-${Fe()}` } = t;
2594
+ if (this.state = {
2595
+ ...n,
2596
+ theme: de,
2597
+ isLoading: !0,
2598
+ ...this.#kt(),
2599
+ viewModeEnabled: d,
2600
+ zenModeEnabled: p,
2601
+ objectsSnapModeEnabled: oe,
2602
+ gridModeEnabled: m ?? n.gridModeEnabled,
2603
+ name: Ce,
2604
+ width: window.innerWidth,
2605
+ height: window.innerHeight
2606
+ }, this.refreshEditorInterface(), this.#e = le(this.editorInterface), this.id = Ze(), this.library = new ua(this), this.actionManager = new Er(this.syncActionResult, () => this.state, () => this.scene.getElementsIncludingDeleted(), this), this.scene = new Bn(), this.canvas = document.createElement("canvas"), this.rc = et.canvas(this.canvas), this.renderer = new va(this.scene), this.visibleElements = [], this.#r = new Un(this), this.fonts = new ei(this.scene), this.#i = new Ar(this.#r), i) {
2607
+ let e = {
2608
+ updateScene: this.updateScene,
2609
+ applyDeltas: this.applyDeltas,
2610
+ mutateElement: this.mutateElement,
2611
+ updateLibrary: this.library.updateLibrary,
2612
+ addFiles: this.addFiles,
2613
+ resetScene: this.#L,
2614
+ getSceneElementsIncludingDeleted: this.getSceneElementsIncludingDeleted,
2615
+ getSceneElementsMapIncludingDeleted: this.getSceneElementsMapIncludingDeleted,
2616
+ history: { clear: this.#F },
2617
+ scrollToContent: this.scrollToContent,
2618
+ getSceneElements: this.getSceneElements,
2619
+ getAppState: () => this.state,
2620
+ getFiles: () => this.files,
2621
+ getName: this.getName,
2622
+ registerAction: (e) => {
2623
+ this.actionManager.registerAction(e);
2624
+ },
2625
+ refresh: this.refresh,
2626
+ setToast: this.setToast,
2627
+ id: this.id,
2628
+ setActiveTool: this.setActiveTool,
2629
+ setCursor: this.#fe,
2630
+ resetCursor: this.#pe,
2631
+ getEditorInterface: () => this.editorInterface,
2632
+ updateFrameRendering: this.updateFrameRendering,
2633
+ toggleSidebar: this.toggleSidebar,
2634
+ onChange: (e) => this.onChangeEmitter.on(e),
2635
+ onIncrement: (e) => this.#r.onStoreIncrementEmitter.on(e),
2636
+ onPointerDown: (e) => this.onPointerDownEmitter.on(e),
2637
+ onPointerUp: (e) => this.onPointerUpEmitter.on(e),
2638
+ onScrollChange: (e) => this.onScrollChangeEmitter.on(e)
2639
+ };
2640
+ typeof i == "function" ? i(e) : console.error("drawAPI should be a function!");
2641
+ }
2642
+ this.drawContainerValue = {
2643
+ container: this.rootElement,
2644
+ id: this.id
2645
+ }, this.actionManager.registerAll(Jr), this.actionManager.registerAction(aa(this.#i)), this.actionManager.registerAction(ia(this.#i));
2646
+ }
2647
+ #d() {
2648
+ if (this.state.selectedLinearElement?.initialState && !this.state.selectedLinearElement.initialState.arrowStartIsInside) {
2649
+ E(this.lastPointerMoveCoords, "Missing last pointer move coords when changing bind skip mode for arrow start");
2650
+ let e = this.scene.getNonDeletedElementsMap(), t = R(S(this.lastPointerMoveCoords.x, this.lastPointerMoveCoords.y), this.scene.getNonDeletedElements(), e), n = z.getElement(this.state.selectedLinearElement.elementId, e);
2651
+ n?.startBinding && t?.id === n.startBinding.elementId && this.setState({ selectedLinearElement: {
2652
+ ...this.state.selectedLinearElement,
2653
+ initialState: {
2654
+ ...this.state.selectedLinearElement.initialState,
2655
+ arrowStartIsInside: !0
2656
+ }
2657
+ } });
2658
+ }
2659
+ if (this.state.bindMode === "orbit" && (this.bindModeHandler &&= (clearTimeout(this.bindModeHandler), null), Z(() => {
2660
+ this.setState({ bindMode: "skip" });
2661
+ }), this.lastPointerMoveCoords && this.state.selectedLinearElement?.selectedPointsIndices && this.state.selectedLinearElement?.selectedPointsIndices?.length)) {
2662
+ let { x: e, y: t } = this.lastPointerMoveCoords, n = this.lastPointerMoveEvent ?? this.lastPointerDownEvent?.nativeEvent;
2663
+ E(n, "Last event must exist");
2664
+ let r = e - this.state.selectedLinearElement.pointerOffset.x, i = t - this.state.selectedLinearElement.pointerOffset.y, a = this.state.multiElement ? z.handlePointerMove(n, this, r, i, this.state.selectedLinearElement) : z.handlePointDragging(n, this, r, i, this.state.selectedLinearElement);
2665
+ a && this.setState(a);
2666
+ }
2667
+ }
2668
+ #f() {
2669
+ this.bindModeHandler &&= (clearTimeout(this.bindModeHandler), null), this.state.bindMode !== "orbit" && setTimeout(() => this.setState({ bindMode: "orbit" }));
2670
+ }
2671
+ #p;
2672
+ #m(e, t) {
2673
+ if (e.isDeleted || A(e)) return;
2674
+ let n = () => {
2675
+ if (this.bindModeHandler = null, E(this.lastPointerMoveCoords, "Expected lastPointerMoveCoords to be set"), !this.state.multiElement) {
2676
+ if (!this.state.selectedLinearElement || !this.state.selectedLinearElement.selectedPointsIndices || !this.state.selectedLinearElement.selectedPointsIndices.length) return;
2677
+ let t = this.state.selectedLinearElement.selectedPointsIndices.includes(0), n = this.state.selectedLinearElement.selectedPointsIndices.includes(e.points.length - 1);
2678
+ if (!t && !n || t && n) return;
2679
+ }
2680
+ let { x: t, y: n } = this.lastPointerMoveCoords, r = R(S(t, n), this.scene.getNonDeletedElements(), this.scene.getNonDeletedElementsMap());
2681
+ if (r && this.state.bindMode !== "skip") {
2682
+ E(this.state.selectedLinearElement?.elementId === e.id, "The selectedLinearElement is expected to not change while a bind mode timeout is ticking");
2683
+ let i = this.state.selectedLinearElement.initialState.arrowStartIsInside || e.startBinding?.elementId === r.id;
2684
+ Z(() => {
2685
+ E(this.state.selectedLinearElement, "this.state.selectedLinearElement must exist"), this.setState({
2686
+ bindMode: "inside",
2687
+ selectedLinearElement: {
2688
+ ...this.state.selectedLinearElement,
2689
+ initialState: {
2690
+ ...this.state.selectedLinearElement.initialState,
2691
+ arrowStartIsInside: i
2692
+ }
2693
+ }
2694
+ });
2695
+ });
2696
+ let a = this.lastPointerMoveEvent ?? this.lastPointerDownEvent?.nativeEvent;
2697
+ E(a, "Last event must exist");
2698
+ let o = t - this.state.selectedLinearElement.pointerOffset.x, s = n - this.state.selectedLinearElement.pointerOffset.y, c = this.state.multiElement ? z.handlePointerMove(a, this, o, s, this.state.selectedLinearElement) : z.handlePointDragging(a, this, o, s, this.state.selectedLinearElement);
2699
+ c && this.setState(c);
2700
+ }
2701
+ }, r = !1;
2702
+ if (this.state.selectedLinearElement?.selectedPointsIndices) {
2703
+ let n = this.scene.getNonDeletedElementsMap(), i = this.state.selectedLinearElement.selectedPointsIndices.includes(0), a = this.state.selectedLinearElement.selectedPointsIndices.includes(e.points.length - 1), o = i ? t : e.startBinding && n.get(e.startBinding.elementId), s = a ? t : e.endBinding && n.get(e.endBinding.elementId), c = o && On(o, n), l = s && On(s, n);
2704
+ r = !!(c && l && o.id !== s.id && Tn(c, l));
2705
+ }
2706
+ let i = this.state.selectedLinearElement?.selectedPointsIndices?.includes?.(0), a = this.state.selectedLinearElement?.selectedPointsIndices?.includes?.(e.points.length - 1), o = i ? "startBinding" : a ? "endBinding" : null, s = i ? "endBinding" : a ? "startBinding" : null, c = s && e[s]?.mode === "inside" && e[s]?.elementId === t?.id || o && e[o]?.mode === "inside" && t?.id === e[o]?.elementId;
2707
+ o && s && e[o]?.mode === "inside" && t?.id !== e[o]?.elementId && e[s]?.elementId !== e[o]?.elementId && this.scene.mutateElement(e, { [o]: {
2708
+ ...e[o],
2709
+ mode: "orbit"
2710
+ } }, {
2711
+ informMutation: !1,
2712
+ isDragging: !0
2713
+ }), !t || this.#p && t.id !== this.#p.id ? (this.bindModeHandler &&= (clearTimeout(this.bindModeHandler), null), this.state.bindMode === "inside" && Z(() => {
2714
+ this.setState({ bindMode: "orbit" });
2715
+ }), this.#p = null) : !this.bindModeHandler && (!this.state.newElement || !e.startBinding || r) && !c && (this.bindModeHandler = setTimeout(n, 700)), this.#p = t;
2716
+ }
2717
+ #h(e, t) {
2718
+ t && this.#a.set(e.id, t);
2719
+ }
2720
+ #g(e) {
2721
+ return this.#a.get(e.id);
2722
+ }
2723
+ #_(e) {
2724
+ this.state.activeEmbeddable?.element === e && this.state.activeEmbeddable?.state === "active" || (setTimeout(() => {
2725
+ this.setState({
2726
+ activeEmbeddable: {
2727
+ element: e,
2728
+ state: "active"
2729
+ },
2730
+ selectedElementIds: { [e.id]: !0 },
2731
+ newElement: null,
2732
+ selectionElement: null
2733
+ });
2734
+ }, 100), !dt(e) && this.#g(e)?.contentWindow);
2735
+ }
2736
+ #v(e, t, n, r) {
2737
+ return e && !t.altKey && !t.shiftKey && !t.metaKey && !t.ctrlKey && (this.state.activeEmbeddable?.element !== e || this.state.activeEmbeddable?.state === "hover" || !this.state.activeEmbeddable) && n >= e.x + e.width / 3 && n <= e.x + 2 * e.width / 3 && r >= e.y + e.height / 3 && r <= e.y + 2 * e.height / 3;
2738
+ }
2739
+ #y;
2740
+ #b;
2741
+ #x() {
2742
+ let e = this.state.zoom.value, t = this.state.width, n = this.state.height;
2743
+ return /* @__PURE__ */ X(Qa, { children: this.scene.getNonDeletedElements().filter((e) => lt(e) && this.#o.get(e.id) === !0 || dt(e)).map((r) => {
2744
+ let { x: i, y: a } = qe({
2745
+ sceneX: r.x,
2746
+ sceneY: r.y
2747
+ }, this.state), o = Mn(r, t, n, this.state, this.scene.getNonDeletedElementsMap()), s = this.#s.has(r.id);
2748
+ if (o && !s && this.#s.add(r.id), !(o || s)) return null;
2749
+ let c;
2750
+ if (dt(r)) {
2751
+ c = null;
2752
+ let e = (r.customData?.generationData ?? this.#D.get(r.id)) || {
2753
+ status: "error",
2754
+ message: "No generation data",
2755
+ code: "ERR_NO_GENERATION_DATA"
2756
+ };
2757
+ if (e.status === "done") {
2758
+ let t = e.html;
2759
+ c = {
2760
+ intrinsicSize: {
2761
+ w: r.width,
2762
+ h: r.height
2763
+ },
2764
+ type: "document",
2765
+ srcdoc: () => t
2766
+ };
2767
+ } else if (e.status === "pending") c = {
2768
+ intrinsicSize: {
2769
+ w: r.width,
2770
+ h: r.height
2771
+ },
2772
+ type: "document",
2773
+ srcdoc: () => cr(`
2774
+ <style>
2775
+ html, body {
2776
+ width: 100%;
2777
+ height: 100%;
2778
+ color: ${this.#w ? "white" : "black"};
2779
+ }
2780
+ body {
2781
+ display: flex;
2782
+ align-items: center;
2783
+ justify-content: center;
2784
+ flex-direction: column;
2785
+ gap: 1rem;
2786
+ }
2787
+
2788
+ .Spinner {
2789
+ display: flex;
2790
+ align-items: center;
2791
+ justify-content: center;
2792
+ margin-left: auto;
2793
+ margin-right: auto;
2794
+ }
2795
+
2796
+ .Spinner svg {
2797
+ animation: rotate 1.6s linear infinite;
2798
+ transform-origin: center center;
2799
+ width: 40px;
2800
+ height: 40px;
2801
+ }
2802
+
2803
+ .Spinner circle {
2804
+ stroke: currentColor;
2805
+ animation: dash 1.6s linear 0s infinite;
2806
+ stroke-linecap: round;
2807
+ }
2808
+
2809
+ @keyframes rotate {
2810
+ 100% {
2811
+ transform: rotate(360deg);
2812
+ }
2813
+ }
2814
+
2815
+ @keyframes dash {
2816
+ 0% {
2817
+ stroke-dasharray: 1, 300;
2818
+ stroke-dashoffset: 0;
2819
+ }
2820
+ 50% {
2821
+ stroke-dasharray: 150, 300;
2822
+ stroke-dashoffset: -200;
2823
+ }
2824
+ 100% {
2825
+ stroke-dasharray: 1, 300;
2826
+ stroke-dashoffset: -280;
2827
+ }
2828
+ }
2829
+ </style>
2830
+ <div class="Spinner">
2831
+ <svg
2832
+ viewBox="0 0 100 100"
2833
+ >
2834
+ <circle
2835
+ cx="50"
2836
+ cy="50"
2837
+ r="46"
2838
+ stroke-width="8"
2839
+ fill="none"
2840
+ stroke-miter-limit="10"
2841
+ />
2842
+ </svg>
2843
+ </div>
2844
+ <div>Generating...</div>
2845
+ `)
2846
+ };
2847
+ else {
2848
+ let t;
2849
+ t = e.code === "ERR_GENERATION_INTERRUPTED" ? "Generation was interrupted..." : e.message || "Generation failed", c = {
2850
+ intrinsicSize: {
2851
+ w: r.width,
2852
+ h: r.height
2853
+ },
2854
+ type: "document",
2855
+ srcdoc: () => cr(`
2856
+ <style>
2857
+ html, body {
2858
+ height: 100%;
2859
+ }
2860
+ body {
2861
+ display: flex;
2862
+ flex-direction: column;
2863
+ align-items: center;
2864
+ justify-content: center;
2865
+ color: ${no.red.value};
2866
+ }
2867
+ h1, h3 {
2868
+ margin-top: 0;
2869
+ margin-bottom: 0.5rem;
2870
+ }
2871
+ </style>
2872
+ <h1>Error!</h1>
2873
+ <h3>${t}</h3>
2874
+ `)
2875
+ };
2876
+ }
2877
+ }
2878
+ let l = this.state.activeEmbeddable?.element === r && this.state.activeEmbeddable?.state === "active", u = this.state.activeEmbeddable?.element === r && this.state.activeEmbeddable?.state === "hover";
2879
+ return /* @__PURE__ */ X("div", {
2880
+ className: ro("draw__embeddable-container", { "is-hovered": u }),
2881
+ style: {
2882
+ transform: o ? `translate(${i - this.state.offsetLeft}px, ${a - this.state.offsetTop}px) scale(${e})` : "none",
2883
+ display: o ? "block" : "none",
2884
+ opacity: on(r, Jt(r, this.scene.getNonDeletedElementsMap()), this.#l, null, this.state.openDialog?.name === "elementLinkSelector" ? p : 1),
2885
+ "--embeddable-radius": `${cn(Math.min(r.width, r.height), r)}px`
2886
+ },
2887
+ children: /* @__PURE__ */ $a("div", {
2888
+ className: "draw__embeddable-container__inner",
2889
+ style: {
2890
+ width: o ? `${r.width}px` : 0,
2891
+ height: o ? `${r.height}px` : 0,
2892
+ transform: o ? `rotate(${r.angle}rad)` : "none",
2893
+ pointerEvents: l ? te.enabled : te.disabled
2894
+ },
2895
+ children: [u && /* @__PURE__ */ X("div", {
2896
+ className: "draw__embeddable-hint",
2897
+ children: H("buttons.embeddableInteractionButton")
2898
+ }), /* @__PURE__ */ X("div", {
2899
+ className: "draw__embeddable__outer",
2900
+ style: { padding: `${r.strokeWidth}px` },
2901
+ children: (lt(r) ? this.props.renderEmbeddable?.(r, this.state) : null) ?? /* @__PURE__ */ X("iframe", {
2902
+ ref: (e) => this.#h(r, e),
2903
+ className: "draw__embeddable",
2904
+ srcDoc: c?.type === "document" ? c.srcdoc(this.state.theme) : void 0,
2905
+ src: c?.type === "document" ? void 0 : c?.link ?? "",
2906
+ scrolling: "no",
2907
+ referrerPolicy: "no-referrer-when-downgrade",
2908
+ title: "Draw Embedded Content",
2909
+ allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
2910
+ allowFullScreen: !0,
2911
+ sandbox: `${c?.sandbox?.allowSameOrigin ? "allow-same-origin" : ""} allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-presentation allow-downloads`
2912
+ })
2913
+ })]
2914
+ })
2915
+ }, r.id);
2916
+ }) });
2917
+ }
2918
+ #S;
2919
+ #C;
2920
+ get #w() {
2921
+ return this.state.theme === re.DARK;
2922
+ }
2923
+ #T;
2924
+ #E(e) {
2925
+ document.documentElement.style.overscrollBehaviorX = e.type === "pointerenter" ? "none" : "auto";
2926
+ }
2927
+ #D;
2928
+ #O;
2929
+ setPlugins(e) {
2930
+ Object.assign(this.plugins, e);
2931
+ }
2932
+ async #k(e, t) {
2933
+ let n = this.plugins.diagramToCode?.generate;
2934
+ if (!n) {
2935
+ this.setState({ errorMessage: "No diagram to code plugin found" });
2936
+ return;
2937
+ }
2938
+ let r = Zt(this.scene.getNonDeletedElements(), e).filter((e) => !gt(e));
2939
+ if (!r.length) {
2940
+ t === "button" ? (this.setState({ errorMessage: "Cannot generate from an empty frame" }), V("ai", "generate (no-children)", "d2c")) : this.setActiveTool({ type: "magicframe" });
2941
+ return;
2942
+ }
2943
+ let i = this.insertIframeElement({
2944
+ sceneX: e.x + e.width + 30,
2945
+ sceneY: e.y,
2946
+ width: e.width,
2947
+ height: e.height
2948
+ });
2949
+ if (i) {
2950
+ this.#O({
2951
+ frameElement: i,
2952
+ data: { status: "pending" }
2953
+ }), this.setState({ selectedElementIds: { [i.id]: !0 } }), V("ai", "generate (start)", "d2c");
2954
+ try {
2955
+ let { html: t } = await n({
2956
+ frame: e,
2957
+ children: r
2958
+ });
2959
+ if (V("ai", "generate (success)", "d2c"), !t.trim()) {
2960
+ this.#O({
2961
+ frameElement: i,
2962
+ data: {
2963
+ status: "error",
2964
+ code: "ERR_OAI",
2965
+ message: "Nothing genereated :("
2966
+ }
2967
+ });
2968
+ return;
2969
+ }
2970
+ let a = t.includes("<!DOCTYPE html>") && t.includes("</html>") ? t.slice(t.indexOf("<!DOCTYPE html>"), t.indexOf("</html>") + 7) : t;
2971
+ this.#O({
2972
+ frameElement: i,
2973
+ data: {
2974
+ status: "done",
2975
+ html: a
2976
+ }
2977
+ });
2978
+ } catch (e) {
2979
+ V("ai", "generate (failed)", "d2c"), this.#O({
2980
+ frameElement: i,
2981
+ data: {
2982
+ status: "error",
2983
+ code: "ERR_OAI",
2984
+ message: e.message || "Unknown error during generation"
2985
+ }
2986
+ });
2987
+ }
2988
+ }
2989
+ }
2990
+ #A(e) {
2991
+ e.customData?.generationData?.status === "done" && (gi(e.customData.generationData.html), this.setToast({
2992
+ message: "copied to clipboard",
2993
+ closable: !1,
2994
+ duration: 1500
2995
+ }));
2996
+ }
2997
+ #j;
2998
+ #M;
2999
+ #N;
3000
+ #P;
3001
+ #F;
3002
+ #I;
3003
+ #L;
3004
+ #R;
3005
+ #z;
3006
+ #B;
3007
+ #V;
3008
+ #H(e) {
3009
+ let t = e ?? this.files;
3010
+ this.scene.getNonDeletedElements().forEach((e) => {
3011
+ pt(e) && t[e.fileId] && (this.imageCache.delete(e.fileId), sn.delete(e));
3012
+ });
3013
+ }
3014
+ async componentDidMount() {
3015
+ this.unmounted = !1, this.drawContainerValue.container = this.rootElement, (He() || Re()) && (this.setState.bind(this), Object.defineProperties(window.h, {
3016
+ state: {
3017
+ configurable: !0,
3018
+ get: () => this.state
3019
+ },
3020
+ setState: {
3021
+ configurable: !0,
3022
+ value: (...e) => this.setState(...e)
3023
+ },
3024
+ app: {
3025
+ configurable: !0,
3026
+ value: this
3027
+ },
3028
+ history: {
3029
+ configurable: !0,
3030
+ value: this.#i
3031
+ },
3032
+ store: {
3033
+ configurable: !0,
3034
+ value: this.#r
3035
+ },
3036
+ fonts: {
3037
+ configurable: !0,
3038
+ value: this.fonts
3039
+ }
3040
+ })), this.#r.onDurableIncrementEmitter.on((e) => {
3041
+ this.#i.record(e.delta);
3042
+ });
3043
+ let { onIncrement: e } = this.props;
3044
+ e && this.#r.onStoreIncrementEmitter.on((t) => {
3045
+ e(t);
3046
+ }), this.scene.onUpdate(this.#se), this.#q(), this.props.autoFocus && this.rootElement && this.focusContainer(), oe && this.rootElement && (this.#n = new ResizeObserver(() => {
3047
+ this.refreshEditorInterface(), this.#Ot();
3048
+ }), this.#n?.observe?.(this.rootElement)), new URLSearchParams(window.location.search.slice(1)).has("web-share-target") ? this.restoreFileFromShare() : this.#Ot(this.#R), de() && !kt() && this.setState({ errorMessage: /* @__PURE__ */ X(ja, {}) }), n.on(t.DARK_THEME, this.#U);
3049
+ }
3050
+ #U;
3051
+ componentWillUnmount() {
3052
+ window.launchQueue?.setConsumer?.(() => {}), this.renderer.destroy(), this.scene.destroy(), this.scene = new Bn(), this.fonts = new ei(this.scene), this.renderer = new va(this.scene), this.files = {}, this.imageCache.clear(), this.#n?.disconnect?.(), this.unmounted = !0, this.#K(), this.library.destroy(), this.laserTrails.stop(), this.eraserTrail.stop(), this.onChangeEmitter.clear(), this.#r.onStoreIncrementEmitter.clear(), this.#r.onDurableIncrementEmitter.clear(), sn.destroy(), J.destroy(), clearTimeout(Q), wt.clearCache(), I.clearCache(), Q = 0, document.documentElement.style.overscrollBehaviorX = "", n.off(t.DARK_THEME, this.#U);
3053
+ }
3054
+ #W;
3055
+ #G;
3056
+ #K() {
3057
+ this.onRemoveEventListenersEmitter.trigger();
3058
+ }
3059
+ #q() {
3060
+ this.#K(), this.props.handleKeyboardGlobally && this.onRemoveEventListenersEmitter.once(w(document, h.KEYDOWN, this.#le, !1)), this.onRemoveEventListenersEmitter.once(w(this.rootElement, h.WHEEL, this.#wt, { passive: !1 }), w(document, h.POINTER_UP, this.removePointer, { passive: !1 }), w(document, h.COPY, this.#Z, { passive: !1 }), w(document, h.KEYUP, this.#ue, { passive: !0 }), w(document, h.POINTER_MOVE, this.#ce, { passive: !1 }), w(document.fonts, "loadingdone", (e) => {
3061
+ let t = e.fontfaces;
3062
+ this.fonts.onLoaded(t);
3063
+ }, { passive: !1 }), w(document, h.GESTURE_START, this.#he, !1), w(document, h.GESTURE_CHANGE, this.#ge, !1), w(document, h.GESTURE_END, this.#_e, !1), w(window, h.FOCUS, () => {
3064
+ this.#Le(null), this.#se(!0);
3065
+ }, { passive: !1 })), !this.state.viewModeEnabled && (this.onRemoveEventListenersEmitter.once(w(document, h.FULLSCREENCHANGE, this.#G, { passive: !1 }), w(document, h.PASTE, this.pasteFromClipboard, { passive: !1 }), w(document, h.CUT, this.#X, { passive: !1 }), w(window, h.RESIZE, this.#W, !1), w(window, h.UNLOAD, this.#N, !1), w(window, h.BLUR, this.#M, !1), w(this.rootElement, h.WHEEL, this.#wt, { passive: !1 }), w(this.rootElement, h.DRAG_OVER, this.#P, !1), w(this.rootElement, h.DROP, this.#P, !1)), this.props.detectScroll && this.onRemoveEventListenersEmitter.once(w(Le(this.rootElement), h.SCROLL, this.#Y, { passive: !1 })));
3066
+ }
3067
+ componentDidUpdate(e, r) {
3068
+ this.#b();
3069
+ let i = this.scene.getElementsIncludingDeleted(), a = this.scene.getElementsMapIncludingDeleted();
3070
+ !this.state.showWelcomeScreen && !i.length && this.setState({ showWelcomeScreen: !0 }), (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)), Object.keys(this.state.selectedElementIds).length && Or(this.state) && this.setState({ activeTool: D(this.state, { type: "selection" }) }), this.state.activeTool.type === "eraser" && r.theme !== this.state.theme && Ti(this.interactiveCanvas, this.state.theme), e.langCode !== this.props.langCode && this.#At(), Or(r) && !Or(this.state) && this.eraserTrail.endPath(), e.viewModeEnabled !== this.props.viewModeEnabled && this.setState({ viewModeEnabled: !!this.props.viewModeEnabled }), r.viewModeEnabled !== this.state.viewModeEnabled && (this.#q(), this.#ye()), (r.openDialog?.name === "elementLinkSelector" || this.state.openDialog?.name === "elementLinkSelector") && r.openDialog?.name !== this.state.openDialog?.name && (this.#ye(), this.setState({ hoveredElementIds: {} })), e.zenModeEnabled !== this.props.zenModeEnabled && this.setState({ zenModeEnabled: !!this.props.zenModeEnabled }), e.theme !== this.props.theme && this.props.theme && this.setState({ theme: this.props.theme }), this.rootElement?.classList?.toggle?.("theme--dark", this.#w), r.theme === this.state.theme || (this.#w ? n.emit(t.DARK_THEME, {
3071
+ key: "draw",
3072
+ value: !0
3073
+ }) : n.emit(t.DARK_THEME, {
3074
+ key: "draw",
3075
+ value: !1
3076
+ })), this.state.selectedLinearElement?.isEditing && !this.state.selectedElementIds[this.state.selectedLinearElement.elementId] && setTimeout(() => {
3077
+ this.state.selectedLinearElement?.isEditing && this.actionManager.executeAction(K);
3078
+ }), this.state.editingTextElement?.isDeleted && this.setState({ editingTextElement: null }), this.#r.commit(a, this.state), this.state.isLoading || (this.props.onChange?.(i, this.state, this.files), this.onChangeEmitter.trigger(i, this.state, this.files));
3079
+ }
3080
+ #J;
3081
+ #Y;
3082
+ #X;
3083
+ #Z;
3084
+ static #Q() {
3085
+ oo = !1, co = null;
3086
+ }
3087
+ #$;
3088
+ #ee;
3089
+ async #te(e, t, n) {
3090
+ let { x: r, y: i } = O({
3091
+ clientX: this.lastViewportPosition.x,
3092
+ clientY: this.lastViewportPosition.y
3093
+ }, this.state);
3094
+ if (e.errorMessage) {
3095
+ this.setState({ errorMessage: e.errorMessage });
3096
+ return;
3097
+ }
3098
+ if (t.length === 0 && !n && e.mixedContent) {
3099
+ await this.#ne(e.mixedContent, {
3100
+ isPlainPaste: n,
3101
+ sceneX: r,
3102
+ sceneY: i
3103
+ });
3104
+ return;
3105
+ }
3106
+ if (e.spreadsheet && !n) {
3107
+ this.setState({ pasteDialog: {
3108
+ data: e.spreadsheet,
3109
+ shown: !0
3110
+ } });
3111
+ return;
3112
+ }
3113
+ let a = t.map((e) => e.file);
3114
+ if (a.length === 0 && e.text && !n) {
3115
+ let t = e.text.trim();
3116
+ t.startsWith("<svg") && t.endsWith("</svg>") && a.push(ii(t));
3117
+ }
3118
+ if (a.length > 0) {
3119
+ this.#de("image") ? await this.#_t(a, r, i) : this.setState({ errorMessage: H("errors.imageToolNotSupported") });
3120
+ return;
3121
+ }
3122
+ if (e.elements) {
3123
+ let t = e.programmaticAPI ? Tr(e.elements) : e.elements;
3124
+ this.addElementsFromPasteOrLibrary({
3125
+ elements: t,
3126
+ files: e.files || null,
3127
+ position: this.editorInterface.formFactor === "desktop" ? "cursor" : "center",
3128
+ retainSeed: n
3129
+ });
3130
+ return;
3131
+ }
3132
+ if (!e.text) return;
3133
+ let o = Ke(e.text).split(/\n+/).map((e) => e.trim()).filter(Boolean), s = o.map((e) => ur(e)).filter((e) => lr(e, this.props.validateEmbeddable) && /^(http|https):\/\/[^\s/$.?#].[^\s]*$/.test(e));
3134
+ if (!n && s.length > 0 && s.length === o.length) {
3135
+ let e = [];
3136
+ for (let t of s) {
3137
+ let n = e[e.length - 1], a = this.insertEmbeddableElement({
3138
+ sceneX: n ? n.x + n.width + 20 : r,
3139
+ sceneY: i,
3140
+ link: $e(t)
3141
+ });
3142
+ a && e.push(a);
3143
+ }
3144
+ e.length && (this.#r.scheduleCapture(), this.setState({ selectedElementIds: Object.fromEntries(e.map((e) => [e.id, !0])) }));
3145
+ return;
3146
+ }
3147
+ this.#re(e.text, n);
3148
+ }
3149
+ async #ne(e, { isPlainPaste: t, sceneX: n, sceneY: r }) {
3150
+ if (!t && e.some((e) => e.type === "imageUrl") && this.#de("image")) {
3151
+ let t = e.filter((e) => e.type === "imageUrl").map((e) => e.value), i = await Promise.all(t.map(async (e) => {
3152
+ try {
3153
+ return { file: await ri(e) };
3154
+ } catch (e) {
3155
+ let t = e.message;
3156
+ return e.cause === "FETCH_ERROR" ? t = H("errors.failedToFetchImage") : e.cause === "UNSUPPORTED" && (t = H("errors.unsupportedFileType")), { errorMessage: t };
3157
+ }
3158
+ })), a = i.filter((e) => !!e.file).map((e) => e.file);
3159
+ await this.#_t(a, n, r);
3160
+ let o = i.find((e) => !!e.errorMessage);
3161
+ o && o.errorMessage && this.setState({ errorMessage: o.errorMessage });
3162
+ } else {
3163
+ let n = e.filter((e) => e.type === "text");
3164
+ n.length && this.#re(n.map((e) => e.value).join("\n\n"), t);
3165
+ }
3166
+ }
3167
+ #re(e, t = !1) {
3168
+ let { x: n, y: r } = O({
3169
+ clientX: this.lastViewportPosition.x,
3170
+ clientY: this.lastViewportPosition.y
3171
+ }, this.state), i = {
3172
+ x: n,
3173
+ y: r,
3174
+ strokeColor: this.state.currentItemStrokeColor,
3175
+ backgroundColor: this.state.currentItemBackgroundColor,
3176
+ fillStyle: this.state.currentItemFillStyle,
3177
+ strokeWidth: this.state.currentItemStrokeWidth,
3178
+ strokeStyle: this.state.currentItemStrokeStyle,
3179
+ roundness: null,
3180
+ roughness: this.state.currentItemRoughness,
3181
+ opacity: this.state.currentItemOpacity,
3182
+ text: e,
3183
+ fontSize: this.state.currentItemFontSize,
3184
+ fontFamily: this.state.currentItemFontFamily,
3185
+ textAlign: m,
3186
+ verticalAlign: "top",
3187
+ locked: !1
3188
+ }, a = Ie({
3189
+ fontSize: i.fontSize,
3190
+ fontFamily: i.fontFamily
3191
+ }), o = _e(i.fontFamily), [s, , c] = kn(this.state), l = Math.max(Math.min((c - s) * .5, 800), 200), u = r, d = t ? [e] : e.split("\n"), f = d.reduce((e, t, r) => {
3192
+ let s = jt(t).trim();
3193
+ if (s.length) {
3194
+ let t = this.#ke({
3195
+ x: n,
3196
+ y: u
3197
+ }), r = At(s, a, o), c = r.width > l, d = c ? Mt(s, a, l) : s;
3198
+ r = c ? At(d, a, o) : r;
3199
+ let f = n - r.width / 2, p = u - r.height / 2, m = or({
3200
+ ...i,
3201
+ x: f,
3202
+ y: p,
3203
+ text: d,
3204
+ originalText: s,
3205
+ lineHeight: o,
3206
+ autoResize: !c,
3207
+ frameId: t ? t.id : null
3208
+ });
3209
+ e.push(m), u += m.height + 10;
3210
+ } else d[r - 1]?.trim?.() && (u += Dt(i.fontSize, o) + 10);
3211
+ return e;
3212
+ }, []);
3213
+ f.length !== 0 && (this.scene.insertElements(f), this.#r.scheduleCapture(), this.setState({ selectedElementIds: F(Object.fromEntries(f.map((e) => [e.id, !0])), this.state) }), !t && f.length > 1 && _o === !1 && this.editorInterface.formFactor !== "phone" && (this.setToast({
3214
+ message: H("toast.pasteAsSingleElement", { shortcut: Xr("CtrlOrCmd+Shift+V") }),
3215
+ duration: 5e3
3216
+ }), _o = !0));
3217
+ }
3218
+ #ie;
3219
+ #ae;
3220
+ #oe;
3221
+ #se;
3222
+ #ce;
3223
+ #le;
3224
+ #ue;
3225
+ #de;
3226
+ #fe;
3227
+ #pe;
3228
+ #me;
3229
+ #he;
3230
+ #ge;
3231
+ #_e;
3232
+ #ve(e, { isExistingElement: t = !1 }) {
3233
+ let n = this.scene.getElementsMapIncludingDeleted(), r = (t, r) => {
3234
+ this.scene.replaceAllElements([...this.scene.getElementsIncludingDeleted().map((i) => i.id === e.id && P(i) ? L(i, {
3235
+ originalText: t,
3236
+ isDeleted: r ?? i.isDeleted,
3237
+ ...sr(i, Ft(i, n), n, t)
3238
+ }) : i)]);
3239
+ };
3240
+ ka({
3241
+ id: e.id,
3242
+ canvas: this.canvas,
3243
+ getViewportCoords: (e, t) => {
3244
+ let { x: n, y: r } = qe({
3245
+ sceneX: e,
3246
+ sceneY: t
3247
+ }, this.state);
3248
+ return [n - this.state.offsetLeft, r - this.state.offsetTop];
3249
+ },
3250
+ onChange: q((t) => {
3251
+ r(t, !1), zn(e) && Sn(e, this.scene);
3252
+ }),
3253
+ onSubmit: q(({ viaKeyboard: n, nextOriginalText: i }) => {
3254
+ let a = !i.trim();
3255
+ if (r(i, a), !a && n) {
3256
+ let t = e.containerId ? e.containerId : e.id;
3257
+ Z(() => {
3258
+ this.setState((e) => ({ selectedElementIds: F({
3259
+ ...e.selectedElementIds,
3260
+ [t]: !0
3261
+ }, e) }));
3262
+ });
3263
+ }
3264
+ a && vn(this.scene.getNonDeletedElements(), [e]), (!a || t) && this.#r.scheduleCapture(), Z(() => {
3265
+ this.setState({
3266
+ newElement: null,
3267
+ editingTextElement: null
3268
+ });
3269
+ }), this.state.activeTool.locked && G(this.interactiveCanvas, this.state), this.focusContainer();
3270
+ }),
3271
+ element: e,
3272
+ drawContainer: this.rootElement,
3273
+ app: this,
3274
+ autoSelect: !this.editorInterface.isTouchScreen
3275
+ }), this.#ye(), r(e.originalText, !1);
3276
+ }
3277
+ #ye() {
3278
+ this.setState({
3279
+ selectedElementIds: F({}, this.state),
3280
+ selectedGroupIds: {},
3281
+ editingGroupId: null,
3282
+ activeEmbeddable: null
3283
+ });
3284
+ }
3285
+ #be(e, t) {
3286
+ let n = this.#xe(e, t, { includeBoundTextElement: !0 });
3287
+ return n && P(n) && !n.isDeleted ? n : null;
3288
+ }
3289
+ #xe(e, t, n) {
3290
+ let r = [];
3291
+ if (r = n && "allHitElements" in n ? n?.allHitElements || [] : this.#Se(e, t, {
3292
+ includeBoundTextElement: n?.includeBoundTextElement,
3293
+ includeLockedElements: n?.includeLockedElements
3294
+ }), r.length > 1) {
3295
+ if (n?.preferSelected) {
3296
+ for (let e = r.length - 1; e > -1; e--) if (this.state.selectedElementIds[r[e].id]) return r[e];
3297
+ }
3298
+ let i = r[r.length - 1];
3299
+ return pn({
3300
+ point: S(e, t),
3301
+ element: i,
3302
+ threshold: this.getElementHitThreshold(i) / 2,
3303
+ elementsMap: this.scene.getNonDeletedElementsMap(),
3304
+ frameNameBound: j(i) ? this.frameNameBoundsCache.get(i) : null
3305
+ }) ? i : r[r.length - 2];
3306
+ }
3307
+ return r.length === 1 ? r[0] : null;
3308
+ }
3309
+ #Se(e, t, n) {
3310
+ let r = [], i = this.scene.getNonDeletedElementsMap();
3311
+ return (n?.includeBoundTextElement && n?.includeLockedElements ? this.scene.getNonDeletedElements() : this.scene.getNonDeletedElements().filter((e) => (n?.includeLockedElements || !e.locked) && (n?.includeBoundTextElement || !(P(e) && e.containerId)))).filter((n) => this.#Ce(e, t, n)).filter((n) => {
3312
+ let r = Jt(n, i);
3313
+ return r && this.state.frameRendering.enabled && this.state.frameRendering.clip ? en({
3314
+ x: e,
3315
+ y: t
3316
+ }, r, i) : !0;
3317
+ }).filter((e) => dt(e) ? (r.push(e), !1) : !0).concat(r);
3318
+ }
3319
+ getElementHitThreshold(e) {
3320
+ return Math.max(e.strokeWidth / 2 + .1, .85 * (d / this.state.zoom.value));
3321
+ }
3322
+ #Ce(e, t, n, r = !0) {
3323
+ return r && this.state.selectedElementIds[n.id] && xr([n], this.state, this.editorInterface) && dn(S(e, t), n, this.scene.getNonDeletedElementsMap(), this.getElementHitThreshold(n)) || un(S(e, t), n, this.scene.getNonDeletedElementsMap()) ? !0 : pn({
3324
+ point: S(e, t),
3325
+ element: n,
3326
+ threshold: this.getElementHitThreshold(n),
3327
+ elementsMap: this.scene.getNonDeletedElementsMap(),
3328
+ frameNameBound: j(n) ? this.frameNameBoundsCache.get(n) : null
3329
+ });
3330
+ }
3331
+ #we(e, t) {
3332
+ let n = this.scene.getNonDeletedElements(), r = this.scene.getSelectedElements(this.state);
3333
+ if (r.length === 1) return vt(r[0], !1) ? r[0] : null;
3334
+ let i = null;
3335
+ for (let r = n.length - 1; r >= 0; --r) {
3336
+ if (n[r].isDeleted) continue;
3337
+ let [a, o, s, c] = Dn(n[r], this.scene.getNonDeletedElementsMap());
3338
+ if (at(n[r]) && pn({
3339
+ point: S(e, t),
3340
+ element: n[r],
3341
+ elementsMap: this.scene.getNonDeletedElementsMap(),
3342
+ threshold: this.getElementHitThreshold(n[r])
3343
+ })) {
3344
+ i = n[r];
3345
+ break;
3346
+ } else if (a < e && e < s && o < t && t < c) {
3347
+ i = n[r];
3348
+ break;
3349
+ }
3350
+ }
3351
+ return vt(i, !1) ? i : null;
3352
+ }
3353
+ #Te;
3354
+ #Ee;
3355
+ #De;
3356
+ #Oe;
3357
+ #ke;
3358
+ #Ae;
3359
+ #je;
3360
+ #Me;
3361
+ #Ne;
3362
+ #Pe;
3363
+ #Fe;
3364
+ #Ie;
3365
+ #Le;
3366
+ #Re(e) {
3367
+ $.pointers.set(e.pointerId, {
3368
+ x: e.clientX,
3369
+ y: e.clientY
3370
+ }), $.pointers.size === 2 && ($.lastCenter = pa($.pointers), $.initialScale = this.state.zoom.value, $.initialDistance = ma(Array.from($.pointers.values())));
3371
+ }
3372
+ #ze(e) {
3373
+ let t = O(e, this.state), n = this.scene.getSelectedElements(this.state), [r, i, a, o] = En(n), s = n.findIndex(A) === 0;
3374
+ return {
3375
+ origin: t,
3376
+ withCmdOrCtrl: e[x.CTRL_OR_CMD],
3377
+ originInGrid: Je(C(t.x, t.y, e[x.CTRL_OR_CMD] || s ? null : this.getEffectiveGridSize())),
3378
+ scrollbars: ya(po, e.clientX - this.state.offsetLeft, e.clientY - this.state.offsetTop),
3379
+ lastCoords: { ...t },
3380
+ originalElements: this.scene.getNonDeletedElements().reduce((e, t) => (e.set(t.id, Vn(t)), e), /* @__PURE__ */ new Map()),
3381
+ resize: {
3382
+ handleType: !1,
3383
+ isResizing: !1,
3384
+ offset: {
3385
+ x: 0,
3386
+ y: 0
3387
+ },
3388
+ arrowDirection: "origin",
3389
+ center: {
3390
+ x: (a + r) / 2,
3391
+ y: (o + i) / 2
3392
+ }
3393
+ },
3394
+ hit: {
3395
+ element: null,
3396
+ allHitElements: [],
3397
+ wasAddedToSelection: !1,
3398
+ hasBeenDuplicated: !1,
3399
+ hasHitCommonBoundingBoxOfSelectedElements: this.#We(t, n)
3400
+ },
3401
+ drag: {
3402
+ hasOccurred: !1,
3403
+ offset: null,
3404
+ origin: { ...t },
3405
+ blockDragging: !1
3406
+ },
3407
+ eventListeners: {
3408
+ onMove: null,
3409
+ onUp: null,
3410
+ onKeyUp: null,
3411
+ onKeyDown: null
3412
+ },
3413
+ boxSelection: { hasOccurred: !1 }
3414
+ };
3415
+ }
3416
+ #Be(e, t) {
3417
+ if (!(t.scrollbars.isOverEither && !this.state.multiElement)) return !1;
3418
+ fo = !0, t.lastCoords.x = e.clientX, t.lastCoords.y = e.clientY;
3419
+ let n = _a((e) => {
3420
+ e.target instanceof HTMLElement && this.#rt(e, t);
3421
+ }), r = q(() => {
3422
+ vo = null, fo = !1, G(this.interactiveCanvas, this.state), this.setState({ cursorButton: "up" }), this.#Et(e.clientX, e.clientY, "up"), window.removeEventListener(h.POINTER_MOVE, n), window.removeEventListener(h.POINTER_UP, r), n.flush();
3423
+ });
3424
+ return vo = r, window.addEventListener(h.POINTER_MOVE, n), window.addEventListener(h.POINTER_UP, r), !0;
3425
+ }
3426
+ #Ve;
3427
+ #He;
3428
+ #Ue(e) {
3429
+ return e != null && this.state.selectedElementIds[e.id];
3430
+ }
3431
+ #We(e, t) {
3432
+ if (t.length < 2) return !1;
3433
+ let n = Math.max(d / this.state.zoom.value, 1), [r, i, a, o] = En(t);
3434
+ return e.x > r - n && e.x < a + n && e.y > i - n && e.y < o + n;
3435
+ }
3436
+ #Ge;
3437
+ #Ke;
3438
+ #qe;
3439
+ #Je;
3440
+ #Ye(e) {
3441
+ return this.state.currentItemRoundness === "round" ? { type: yt(e) ? ne.ADAPTIVE_RADIUS : ne.PROPORTIONAL_RADIUS } : null;
3442
+ }
3443
+ #Xe;
3444
+ #Ze;
3445
+ #Qe(e, t, n = !1) {
3446
+ Ta({
3447
+ event: e,
3448
+ app: this,
3449
+ selectedElements: t
3450
+ }) && (n || !J.getReferenceSnapPoints()) && J.setReferenceSnapPoints(ba(this.scene.getNonDeletedElements(), t, this.state, this.scene.getNonDeletedElementsMap()));
3451
+ }
3452
+ #$e(e, t, n = !1) {
3453
+ Ta({
3454
+ event: e,
3455
+ app: this,
3456
+ selectedElements: t
3457
+ }) && (n || !J.getVisibleGaps()) && J.setVisibleGaps(Sa(this.scene.getNonDeletedElements(), t, this.state, this.scene.getNonDeletedElementsMap()));
3458
+ }
3459
+ #et(e) {
3460
+ return q((t) => {
3461
+ this.#St(e, t) || this.#bt(e, t);
3462
+ });
3463
+ }
3464
+ #tt(e) {
3465
+ return q((t) => {
3466
+ t.key === x.ALT && t.preventDefault(), !this.#St(e, t) && this.#bt(e, t);
3467
+ });
3468
+ }
3469
+ #nt(e) {
3470
+ return _a((t) => {
3471
+ if (this.state.openDialog?.name === "elementLinkSelector") return;
3472
+ let n = O(t, this.state);
3473
+ if (this.state.activeLockedId && this.setState({ activeLockedId: null }), this.state.selectedLinearElement && this.state.selectedLinearElement.elbowed && this.state.selectedLinearElement.initialState.segmentMidpoint.index) {
3474
+ let [e, r] = C(n.x, n.y, t[x.CTRL_OR_CMD] ? null : this.getEffectiveGridSize()), i = this.state.selectedLinearElement.initialState.segmentMidpoint.index;
3475
+ if (i < 0) {
3476
+ let t = z.getSegmentMidpointHitCoords({
3477
+ ...this.state.selectedLinearElement,
3478
+ segmentMidPointHoveredCoords: null
3479
+ }, {
3480
+ x: e,
3481
+ y: r
3482
+ }, this.state, this.scene.getNonDeletedElementsMap());
3483
+ i = t ? z.getSegmentMidPointIndex(this.state.selectedLinearElement, this.state, t, this.scene.getNonDeletedElementsMap()) : -1;
3484
+ }
3485
+ let a = z.moveFixedSegment(this.state.selectedLinearElement, i, e, r, this.scene);
3486
+ this.setState({ selectedLinearElement: {
3487
+ ...this.state.selectedLinearElement,
3488
+ isDragging: !0,
3489
+ segmentMidPointHoveredCoords: a.segmentMidPointHoveredCoords,
3490
+ initialState: a.initialState
3491
+ } });
3492
+ return;
3493
+ }
3494
+ let r = this.previousPointerMoveCoords ?? e.origin;
3495
+ if (this.previousPointerMoveCoords = n, e.drag.offset === null && (e.drag.offset = Je(Jn(this.scene.getSelectedElements(this.state), e.origin.x, e.origin.y))), !(t.target instanceof HTMLElement) || this.#rt(t, e)) return;
3496
+ if (Or(this.state)) {
3497
+ this.#je(t, n);
3498
+ return;
3499
+ }
3500
+ this.state.activeTool.type === "laser" && this.laserTrails.addPointToPath(n.x, n.y);
3501
+ let [a, o] = C(n.x, n.y, t[x.CTRL_OR_CMD] ? null : this.getEffectiveGridSize());
3502
+ if (e.resize.isResizing && (e.lastCoords.x = n.x, e.lastCoords.y = n.y, this.#xt(e, t) || this.#St(e, t))) return !0;
3503
+ let s = this.scene.getNonDeletedElementsMap();
3504
+ if (this.state.selectedLinearElement) {
3505
+ let r = this.state.selectedLinearElement;
3506
+ if (r.draggedFocusPointBinding) {
3507
+ Pn(r, s, n, this.scene, this.state, this.getEffectiveGridSize(), t.altKey), this.setState({ selectedLinearElement: {
3508
+ ...r,
3509
+ isDragging: !1,
3510
+ selectedPointsIndices: [],
3511
+ initialState: {
3512
+ ...r.initialState,
3513
+ lastClickedPoint: -1
3514
+ }
3515
+ } });
3516
+ return;
3517
+ }
3518
+ if (z.shouldAddMidpoint(this.state.selectedLinearElement, n, this.state, s)) {
3519
+ let e = z.addMidpoint(this.state.selectedLinearElement, n, this, !t[x.CTRL_OR_CMD], this.scene);
3520
+ if (!e) return;
3521
+ Z(() => {
3522
+ this.state.selectedLinearElement && this.setState({ selectedLinearElement: {
3523
+ ...this.state.selectedLinearElement,
3524
+ initialState: e.pointerDownState,
3525
+ selectedPointsIndices: e.selectedPointsIndices,
3526
+ segmentMidPointHoveredCoords: null
3527
+ } });
3528
+ });
3529
+ return;
3530
+ } else if (r.initialState.segmentMidpoint.value !== null && !r.initialState.segmentMidpoint.added) return;
3531
+ else if (r.initialState.lastClickedPoint > -1) {
3532
+ let i = z.getElement(r.elementId, s);
3533
+ if (i?.isDeleted) return;
3534
+ if (k(i)) {
3535
+ let e = R(S(n.x, n.y), this.scene.getNonDeletedElements(), s);
3536
+ T("COMPLEX_BINDINGS") && this.#m(i, e);
3537
+ }
3538
+ if (t.altKey && !this.state.selectedLinearElement?.initialState?.arrowStartIsInside && T("COMPLEX_BINDINGS") && this.#d(), r.initialState.lastClickedPoint === -1) return;
3539
+ let a = z.handlePointDragging(t, this, n.x, n.y, r);
3540
+ if (a) {
3541
+ e.lastCoords.x = n.x, e.lastCoords.y = n.y, e.drag.hasOccurred = !0, (a.suggestedBinding !== this.state.suggestedBinding || !Ve(a.selectedLinearElement?.selectedPointsIndices ?? [], this.state.selectedLinearElement?.selectedPointsIndices ?? []) || a.selectedLinearElement?.hoverPointIndex !== this.state.selectedLinearElement?.hoverPointIndex || a.selectedLinearElement?.customLineAngle !== this.state.selectedLinearElement?.customLineAngle || this.state.selectedLinearElement.isDragging !== a.selectedLinearElement?.isDragging || this.state.selectedLinearElement?.initialState?.altFocusPoint !== a.selectedLinearElement?.initialState?.altFocusPoint) && this.setState(a);
3542
+ return;
3543
+ }
3544
+ }
3545
+ }
3546
+ let c = e.hit.allHitElements.some((e) => this.#Ue(e)), l = this.state.selectedLinearElement?.isEditing && t.shiftKey && this.state.selectedLinearElement.elementId === e.hit.element?.id;
3547
+ if ((c || e.hit.hasHitCommonBoundingBoxOfSelectedElements) && !l && !e.drag.blockDragging) {
3548
+ let a = this.scene.getSelectedElements(this.state);
3549
+ if (a.length > 0 && a.every((e) => e.locked)) return;
3550
+ let o = a.find((e) => j(e)), c = this.#ke(n), l = c && !o ? c : null;
3551
+ if (this.state.frameToHighlight !== l && Z(() => {
3552
+ this.setState({ frameToHighlight: l });
3553
+ }), e.drag.hasOccurred = !0, this.state.activeTool.type === "lasso" && this.lassoTrail.hasCurrentTrail && !(this.editorInterface.formFactor !== "desktop" && e.hit.element) && !this.state.activeTool.fromSelection) return;
3554
+ if (this.state.activeTool.type === "lasso" && a.length > 0 && e.drag.hasOccurred && !this.state.activeTool.fromSelection && this.lassoTrail.endPath(), a.length > 0 && !e.withCmdOrCtrl && !this.state.editingTextElement && this.state.activeEmbeddable?.state !== "active") {
3555
+ let o = {
3556
+ x: n.x - e.drag.origin.x,
3557
+ y: n.y - e.drag.origin.y
3558
+ }, c = [...e.originalElements.values()], l = t.shiftKey;
3559
+ if (l) {
3560
+ let e = Math.abs(o.x), t = Math.abs(o.y), n = l && e < t, r = l && e > t;
3561
+ n && (o.x = 0), r && (o.y = 0);
3562
+ }
3563
+ if (this.state.croppingElementId) {
3564
+ let t = this.scene.getNonDeletedElementsMap().get(this.state.croppingElementId);
3565
+ if (t && M(t) && t.crop !== null && e.hit.element === t) {
3566
+ let e = t.crop, a = pt(t) && this.imageCache.get(t.fileId)?.image;
3567
+ if (a && !(a instanceof Promise)) {
3568
+ let o = rt(t), c = Ce(n.x - r.x, n.y - r.y);
3569
+ c[0] *= a.naturalWidth / o.width, c[1] *= a.naturalHeight / o.height;
3570
+ let [l, u, d, f, p, m] = Dn(t, s), h = Te(ke(S(l, u), S(p, m), t.angle)), g = Te(ke(S(d, u), S(p, m), t.angle)), _ = Te(ke(S(l, f), S(p, m), t.angle)), ee = Ee(De(g, h)), v = Ee(De(_, h)), y = Ce(we(c, ee), we(c, v)), te = {
3571
+ ...e,
3572
+ x: i(e.x - y[0] * Math.sign(t.scale[0]), 0, a.naturalWidth - e.width),
3573
+ y: i(e.y - y[1] * Math.sign(t.scale[1]), 0, a.naturalHeight - e.height)
3574
+ };
3575
+ this.scene.mutateElement(t, { crop: te });
3576
+ return;
3577
+ }
3578
+ }
3579
+ }
3580
+ this.#$e(t, a), this.#Qe(t, a);
3581
+ let { snapOffset: u, snapLines: d } = Ea(c, o, this, t, this.scene.getNonDeletedElementsMap());
3582
+ if (this.setState({ snapLines: d }), this.state.editingFrame || qn(e, a, o, this.scene, u, t[x.CTRL_OR_CMD] ? null : this.getEffectiveGridSize()), this.setState({
3583
+ selectedElementsAreBeingDragged: !0,
3584
+ selectionElement: null
3585
+ }), t.altKey && !e.hit.hasBeenDuplicated) {
3586
+ e.hit.hasBeenDuplicated = !0;
3587
+ let n = this.scene.getElementsIncludingDeleted(), r = e.hit.element, i = this.scene.getSelectedElements({
3588
+ selectedElementIds: this.state.selectedElementIds,
3589
+ includeBoundTextElement: !0,
3590
+ includeElementsInFrames: !0
3591
+ });
3592
+ r && e.hit.wasAddedToSelection && !i.find((e) => e.id === r.id) && i.push(r);
3593
+ let a = new Map(i.map((e) => [e.id, e])), { duplicatedElements: o, duplicateElementsMap: s, elementsWithDuplicates: c, origIdToDuplicateId: l } = Hn({
3594
+ type: "in-place",
3595
+ elements: n,
3596
+ appState: this.state,
3597
+ randomizeSeed: !0,
3598
+ idsOfElementsToDuplicate: a,
3599
+ overrides: ({ duplicateElement: e, origElement: t }) => ({
3600
+ frameId: e.frameId ?? t.frameId,
3601
+ seed: Qe()
3602
+ })
3603
+ });
3604
+ o.forEach((t) => {
3605
+ e.originalElements.set(t.id, Vn(t));
3606
+ });
3607
+ let u = c.map((t) => {
3608
+ if (a.has(t.id)) {
3609
+ let n = e.originalElements.get(t.id);
3610
+ if (n) return L(t, {
3611
+ x: n.x,
3612
+ y: n.y
3613
+ });
3614
+ }
3615
+ return t;
3616
+ }), d = this.props.onDuplicate?.(u, n), f = wn(d || u, Ae(o));
3617
+ Z(() => {
3618
+ if (e.hit.element) {
3619
+ let t = l.get(e.hit.element.id), n = t && s.get(t);
3620
+ e.hit.element = n || null;
3621
+ }
3622
+ e.hit.allHitElements = e.hit.allHitElements.reduce((e, t) => {
3623
+ let n = l.get(t.id), r = n && s.get(n);
3624
+ return r && e.push(r), e;
3625
+ }, []), e.drag.origin = O(t, this.state), this.setState((e) => ({ ...Ct(o, this.scene.getNonDeletedElements(), e) })), this.scene.replaceAllElements(f), i.forEach((e) => {
3626
+ ot(e) && e.boundElements?.some?.((e) => e.type === "arrow") && Sn(e, this.scene);
3627
+ }), this.#$e(t, i, !0), this.#Qe(t, i, !0);
3628
+ });
3629
+ }
3630
+ return;
3631
+ }
3632
+ }
3633
+ if (this.state.selectionElement) {
3634
+ if (e.lastCoords.x = n.x, e.lastCoords.y = n.y, t.altKey) {
3635
+ this.setActiveTool({
3636
+ type: "lasso",
3637
+ fromSelection: !0
3638
+ }, t.shiftKey), this.lassoTrail.startPath(e.origin.x, e.origin.y, t.shiftKey), this.setAppState({ selectionElement: null });
3639
+ return;
3640
+ }
3641
+ this.#bt(e, t);
3642
+ } else if (this.state.activeTool.type === "lasso") !t.altKey && this.state.activeTool.fromSelection ? (this.setActiveTool({ type: "selection" }), this.#Xe("selection", e), e.lastCoords.x = n.x, e.lastCoords.y = n.y, this.#bt(e, t), this.lassoTrail.endPath()) : this.lassoTrail.addPointToPath(n.x, n.y, t.shiftKey);
3643
+ else {
3644
+ let r = this.state.newElement;
3645
+ if (!r) return;
3646
+ if (r.type === "freedraw") {
3647
+ let e = r.points, i = n.x - r.x, a = n.y - r.y, o = e.length > 0 && e[e.length - 1];
3648
+ if (!(o && o[0] === i && o[1] === a)) {
3649
+ let n = r.simulatePressure ? r.pressures : [...r.pressures, t.pressure];
3650
+ this.scene.mutateElement(r, {
3651
+ points: [...e, S(i, a)],
3652
+ pressures: n
3653
+ }, {
3654
+ informMutation: !1,
3655
+ isDragging: !1
3656
+ }), this.setState({ newElement: r });
3657
+ }
3658
+ } else if (N(r) && !r.isDeleted) {
3659
+ e.drag.hasOccurred = !0;
3660
+ let n = r.points;
3661
+ E(n.length > 1, "Do not create linear elements with less than 2 points");
3662
+ let i = this.state.selectedLinearElement;
3663
+ i ||= (i = new z(r, this.scene.getNonDeletedElementsMap()), {
3664
+ ...i,
3665
+ selectedPointsIndices: [1],
3666
+ initialState: {
3667
+ ...i.initialState,
3668
+ lastClickedPoint: 1
3669
+ }
3670
+ }), this.setState({
3671
+ newElement: r,
3672
+ ...z.handlePointDragging(t, this, a, o, i)
3673
+ });
3674
+ } else e.lastCoords.x = n.x, e.lastCoords.y = n.y, this.#bt(e, t, !1);
3675
+ }
3676
+ if (this.state.activeTool.type === "selection") {
3677
+ e.boxSelection.hasOccurred = !0;
3678
+ let n = this.scene.getNonDeletedElements();
3679
+ if (this.state.selectedLinearElement?.isEditing) z.handleBoxSelection(t, this.state, this.setState.bind(this), this.scene.getNonDeletedElementsMap());
3680
+ else {
3681
+ let r = !0;
3682
+ !t.shiftKey && wt(n, this.state) && (e.withCmdOrCtrl && e.hit.element ? this.setState((t) => I({
3683
+ ...t,
3684
+ selectedElementIds: { [e.hit.element.id]: !0 }
3685
+ }, this.scene.getNonDeletedElements(), t, this)) : r = !1);
3686
+ let i = this.state.selectionElement ? xt(n, this.state.selectionElement, this.scene.getNonDeletedElementsMap(), !1) : [];
3687
+ this.setState((t) => {
3688
+ let n = {
3689
+ ...r && t.selectedElementIds,
3690
+ ...i.reduce((e, t) => (e[t.id] = !0, e), {})
3691
+ };
3692
+ return e.hit.element && (i.length ? delete n[e.hit.element.id] : n[e.hit.element.id] = !0), t = r ? t : {
3693
+ ...t,
3694
+ selectedGroupIds: {},
3695
+ editingGroupId: null
3696
+ }, {
3697
+ ...I({
3698
+ editingGroupId: t.editingGroupId,
3699
+ selectedElementIds: n
3700
+ }, this.scene.getNonDeletedElements(), t, this),
3701
+ selectedLinearElement: i.length === 1 && N(i[0]) ? new z(i[0], this.scene.getNonDeletedElementsMap()) : null
3702
+ };
3703
+ });
3704
+ }
3705
+ }
3706
+ });
3707
+ }
3708
+ #rt(e, t) {
3709
+ if (t.scrollbars.isOverHorizontal) {
3710
+ let n = e.clientX, r = n - t.lastCoords.x;
3711
+ return this.#ae({ scrollX: this.state.scrollX - r * (po.horizontal?.deltaMultiplier || 1) / this.state.zoom.value }), t.lastCoords.x = n, !0;
3712
+ }
3713
+ if (t.scrollbars.isOverVertical) {
3714
+ let n = e.clientY, r = n - t.lastCoords.y;
3715
+ return this.#ae({ scrollY: this.state.scrollY - r * (po.vertical?.deltaMultiplier || 1) / this.state.zoom.value }), t.lastCoords.y = n, !0;
3716
+ }
3717
+ return !1;
3718
+ }
3719
+ #it(e) {
3720
+ return q((t) => {
3721
+ let n = this.scene.getNonDeletedElementsMap();
3722
+ this.removePointer(t), e.drag.blockDragging = !1, e.eventListeners.onMove && e.eventListeners.onMove.flush();
3723
+ let { newElement: r, resizingElement: i, croppingElementId: a, multiElement: o, activeTool: s, isResizing: c, isRotating: l, isCropping: d } = this.state;
3724
+ this.setState((e) => ({
3725
+ isResizing: !1,
3726
+ isRotating: !1,
3727
+ isCropping: !1,
3728
+ resizingElement: null,
3729
+ selectionElement: null,
3730
+ frameToHighlight: null,
3731
+ elementsToHighlight: null,
3732
+ cursorButton: "up",
3733
+ snapLines: Xe(e.snapLines, []),
3734
+ originSnapOffset: null
3735
+ })), this.lassoTrail.endPath(), this.previousPointerMoveCoords = null, J.setReferenceSnapPoints(null), J.setVisibleGaps(null), this.#Et(t.clientX, t.clientY, "up");
3736
+ let f = e.hit.allHitElements, p = O({
3737
+ clientX: t.clientX,
3738
+ clientY: t.clientY
3739
+ }, this.state);
3740
+ if (this.state.activeTool.type === "selection" && !e.boxSelection.hasOccurred && !e.resize.isResizing && !f.some((e) => this.state.selectedElementIds[e.id])) {
3741
+ let e = this.#xe(p.x, p.y, { includeLockedElements: !0 });
3742
+ this.#r.scheduleCapture(), e?.locked ? this.setState({ activeLockedId: e.groupIds.length > 0 ? e.groupIds.at(-1) || "" : e.id }) : this.setState({ activeLockedId: null });
3743
+ } else this.setState({ activeLockedId: null });
3744
+ if (T("COMPLEX_BINDINGS") && this.#f(), this.setState({
3745
+ selectedElementsAreBeingDragged: !1,
3746
+ bindMode: "orbit"
3747
+ }), e.drag.hasOccurred && e.hit?.element?.id) {
3748
+ let t = n.get(e.hit.element.id);
3749
+ ot(t) && t.boundElements?.filter?.((e) => e.type === "arrow").map((e) => n.get(e.id)).filter((e) => A(e)).forEach((e) => {
3750
+ e && this.scene.mutateElement(e, {});
3751
+ });
3752
+ }
3753
+ if (this.state.selectedLinearElement?.isEditing && !this.state.newElement && this.state.selectedLinearElement.draggedFocusPointBinding === null) if (!e.boxSelection.hasOccurred && e.hit?.element?.id !== this.state.selectedLinearElement.elementId && this.state.selectedLinearElement.draggedFocusPointBinding === null) this.actionManager.executeAction(K);
3754
+ else {
3755
+ let e = z.handlePointerUp(t, this.state.selectedLinearElement, this.state, this.scene);
3756
+ this.actionManager.executeAction(K, "ui", {
3757
+ event: t,
3758
+ sceneCoords: p
3759
+ }), e !== this.state.selectedLinearElement && this.setState({
3760
+ selectedLinearElement: e,
3761
+ suggestedBinding: null
3762
+ });
3763
+ }
3764
+ else if (this.state.selectedLinearElement) {
3765
+ if (this.state.selectedLinearElement.elbowed) {
3766
+ let e = z.getElement(this.state.selectedLinearElement.elementId, this.scene.getNonDeletedElementsMap());
3767
+ e && this.scene.mutateElement(e, {});
3768
+ }
3769
+ if (this.state.selectedLinearElement.draggedFocusPointBinding ? (Ln(this.state.selectedLinearElement, this.scene), this.setState({ selectedLinearElement: {
3770
+ ...this.state.selectedLinearElement,
3771
+ draggedFocusPointBinding: null
3772
+ } })) : e.hit?.element?.id === this.state.selectedLinearElement.elementId ? this.state.selectedLinearElement.isDragging && (this.setState({ selectedLinearElement: {
3773
+ ...this.state.selectedLinearElement,
3774
+ isDragging: !1
3775
+ } }), this.actionManager.executeAction(K, "ui", {
3776
+ event: t,
3777
+ sceneCoords: p
3778
+ })) : this.scene.getSelectedElements(this.state).length > 1 && this.setState({ selectedLinearElement: null }), this.state.newElement && this.state.multiElement && N(this.state.newElement) && this.state.selectedLinearElement) {
3779
+ let { multiElement: e } = this.state;
3780
+ this.setState({ selectedLinearElement: {
3781
+ ...this.state.selectedLinearElement,
3782
+ lastCommittedPoint: e.points[e.points.length - 1]
3783
+ } });
3784
+ }
3785
+ }
3786
+ if (this.missingPointerEventCleanupEmitter.clear(), window.removeEventListener(h.POINTER_MOVE, e.eventListeners.onMove), window.removeEventListener(h.POINTER_UP, e.eventListeners.onUp), window.removeEventListener(h.KEYDOWN, e.eventListeners.onKeyDown), window.removeEventListener(h.KEYUP, e.eventListeners.onKeyUp), this.props?.onPointerUp?.(s, e), this.onPointerUpEmitter.trigger(this.state.activeTool, e, t), r?.type === "freedraw") {
3787
+ let e = O(t, this.state), n = r.points, i = e.x - r.x, a = e.y - r.y;
3788
+ i === n[0][0] && a === n[0][1] && (a += 1e-4, i += 1e-4);
3789
+ let o = r.simulatePressure ? [] : [...r.pressures, t.pressure];
3790
+ this.scene.mutateElement(r, {
3791
+ points: [...n, S(i, a)],
3792
+ pressures: o
3793
+ }), this.actionManager.executeAction(K);
3794
+ return;
3795
+ }
3796
+ if (N(r)) {
3797
+ r.points.length > 1 && r.points[1][0] !== 0 && r.points[1][1] !== 0 && this.#r.scheduleCapture();
3798
+ let n = O(t, this.state), i = Oe(S(n.x, n.y), S(e.origin.x, e.origin.y)) * this.state.zoom.value;
3799
+ if ((!e.drag.hasOccurred || i < 20) && r && !o) if (this.editorInterface.isTouchScreen) {
3800
+ let e = Math.min(this.state.width * .7 / this.state.zoom.value, 100);
3801
+ this.scene.mutateElement(r, {
3802
+ x: r.x - e / 2,
3803
+ points: [S(0, 0), S(e, 0)]
3804
+ }, {
3805
+ informMutation: !1,
3806
+ isDragging: !1
3807
+ }), this.actionManager.executeAction(K);
3808
+ } else {
3809
+ let e = n.x - r.x, t = n.y - r.y;
3810
+ this.scene.mutateElement(r, { points: [r.points[0], S(e, t)] }, {
3811
+ informMutation: !1,
3812
+ isDragging: !1
3813
+ }), this.setState({
3814
+ multiElement: r,
3815
+ newElement: r
3816
+ });
3817
+ }
3818
+ else e.drag.hasOccurred && !o && (N(r) && this.actionManager.executeAction(K, "ui", {
3819
+ event: t,
3820
+ sceneCoords: p
3821
+ }), this.setState({
3822
+ suggestedBinding: null,
3823
+ startBoundElement: null
3824
+ }), s.locked ? this.setState((e) => ({ newElement: null })) : (U(this.interactiveCanvas), this.setState((e) => ({
3825
+ newElement: null,
3826
+ activeTool: D(this.state, { type: this.state.preferredSelectionTool.type }),
3827
+ selectedElementIds: F({
3828
+ ...e.selectedElementIds,
3829
+ [r.id]: !0
3830
+ }, e),
3831
+ selectedLinearElement: new z(r, this.scene.getNonDeletedElementsMap())
3832
+ }))), this.scene.triggerUpdate());
3833
+ return;
3834
+ }
3835
+ if (P(r)) {
3836
+ let e = Ot(Ie({
3837
+ fontSize: r.fontSize,
3838
+ fontFamily: r.fontFamily
3839
+ }), r.lineHeight);
3840
+ r.width < e && this.scene.mutateElement(r, { autoResize: !0 }), this.#pe(), this.#ve(r, { isExistingElement: !0 });
3841
+ }
3842
+ if (s.type !== "selection" && r && Nn(r)) {
3843
+ this.updateScene({
3844
+ elements: this.scene.getElementsIncludingDeleted().filter((e) => e.id !== r.id),
3845
+ appState: { newElement: null },
3846
+ captureUpdate: B.NEVER
3847
+ });
3848
+ return;
3849
+ }
3850
+ if (j(r)) {
3851
+ let e = Yt(this.scene.getElementsIncludingDeleted(), r, this.scene.getNonDeletedElementsMap());
3852
+ this.scene.replaceAllElements(Gt(this.scene.getElementsMapIncludingDeleted(), e, r, this.state));
3853
+ }
3854
+ if (r && (this.scene.mutateElement(r, An(r), {
3855
+ informMutation: !1,
3856
+ isDragging: !1
3857
+ }), this.scene.triggerUpdate()), e.drag.hasOccurred) {
3858
+ let e = O(t, this.state);
3859
+ if (this.state.selectedLinearElement && this.state.selectedLinearElement.isDragging) {
3860
+ let e = this.scene.getElement(this.state.selectedLinearElement.elementId);
3861
+ if (e?.frameId) {
3862
+ let t = Jt(e, n);
3863
+ t && e && (Kt(e, t, this.scene.getNonDeletedElementsMap()) || (this.scene.mutateElement(e, { groupIds: [] }), nn([e], this.scene.getNonDeletedElementsMap()), this.scene.triggerUpdate()));
3864
+ }
3865
+ } else {
3866
+ let t = this.#ke(e), n = this.scene.getSelectedElements(this.state), r = this.scene.getElementsMapIncludingDeleted(), i = (e) => {
3867
+ if (e.length > 0) {
3868
+ for (let t of e) {
3869
+ let e = t.groupIds.indexOf(this.state.editingGroupId);
3870
+ this.scene.mutateElement(t, { groupIds: t.groupIds.slice(0, e) }, {
3871
+ informMutation: !1,
3872
+ isDragging: !1
3873
+ });
3874
+ }
3875
+ r.forEach((e) => {
3876
+ e.groupIds.length && zt(r, e.groupIds[e.groupIds.length - 1]).length < 2 && this.scene.mutateElement(e, { groupIds: [] }, {
3877
+ informMutation: !1,
3878
+ isDragging: !1
3879
+ });
3880
+ }), this.setState({ editingGroupId: null });
3881
+ }
3882
+ };
3883
+ if (t && !this.state.selectedElementIds[t.id]) {
3884
+ let e = n.filter((e) => e.frameId !== t.id && tn(e, r, this.state));
3885
+ this.state.editingGroupId && i(e), r = Gt(r, e, t, this.state);
3886
+ } else t || this.state.editingGroupId && i(n.filter((e) => e.frameId && !tn(e, r, this.state)));
3887
+ r = an(r, this.state, this), this.scene.replaceAllElements(r);
3888
+ }
3889
+ }
3890
+ if (i && this.#r.scheduleCapture(), i && Nn(i) && this.updateScene({
3891
+ elements: this.scene.getElementsIncludingDeleted().filter((e) => e.id !== i.id),
3892
+ captureUpdate: B.NEVER
3893
+ }), e.resize.isResizing) {
3894
+ let e = an(this.scene.getElementsIncludingDeleted(), this.state, this), t = this.scene.getSelectedElements(this.state).filter((e) => j(e));
3895
+ for (let r of t) e = rn(e, Xt(this.scene.getElementsIncludingDeleted(), r, this.state, n), r, this);
3896
+ this.scene.replaceAllElements(e);
3897
+ }
3898
+ let m = e.hit.element;
3899
+ this.state.selectedLinearElement?.elementId !== m?.id && N(m) && this.scene.getSelectedElements(this.state).length === 1 && this.setState({ selectedLinearElement: new z(m, this.scene.getNonDeletedElementsMap()) }), (!a || a && (!m && !d || m && m.id !== a)) && this.#De();
3900
+ let g = this.lastPointerDownEvent, _ = this.lastPointerUpEvent || this.lastPointerMoveEvent;
3901
+ if (Or(this.state) && g && _) {
3902
+ if (this.eraserTrail.endPath(), Oe(S(g.clientX, g.clientY), S(_.clientX, _.clientY)) === 0) {
3903
+ let e = O({
3904
+ clientX: _.clientX,
3905
+ clientY: _.clientY
3906
+ }, this.state);
3907
+ this.#Se(e.x, e.y).forEach((e) => this.#l.add(e.id));
3908
+ }
3909
+ this.#ot();
3910
+ return;
3911
+ } else this.#l.size && this.#at();
3912
+ if (m && !e.drag.hasOccurred && !e.hit.wasAddedToSelection && (!this.state.selectedLinearElement?.isEditing || !e.boxSelection.hasOccurred) && this.state.activeTool.type !== "lasso" && (t.shiftKey && !this.state.selectedLinearElement?.isEditing ? this.state.selectedElementIds[m.id] ? Ut(this.state, m) ? this.setState((e) => {
3913
+ let t = { ...e.selectedElementIds };
3914
+ for (let e of m.groupIds.flatMap((e) => zt(this.scene.getNonDeletedElements(), e))) delete t[e.id];
3915
+ return {
3916
+ selectedGroupIds: {
3917
+ ...e.selectedElementIds,
3918
+ ...m.groupIds.map((e) => ({ [e]: !1 })).reduce((e, t) => ({
3919
+ ...e,
3920
+ ...t
3921
+ }), {})
3922
+ },
3923
+ selectedElementIds: F(t, e)
3924
+ };
3925
+ }) : this.state.selectedLinearElement?.isDragging || this.setState((e) => {
3926
+ let t = { ...e.selectedElementIds };
3927
+ delete t[m.id];
3928
+ let n = St(this.scene.getNonDeletedElements(), { selectedElementIds: t });
3929
+ return {
3930
+ ...I({
3931
+ editingGroupId: e.editingGroupId,
3932
+ selectedElementIds: t
3933
+ }, this.scene.getNonDeletedElements(), e, this),
3934
+ selectedLinearElement: n.length === 1 && N(n[0]) ? new z(n[0], this.scene.getNonDeletedElementsMap()) : e.selectedLinearElement
3935
+ };
3936
+ }) : m.frameId && this.state.selectedElementIds[m.frameId] ? this.setState((e) => {
3937
+ let t = {
3938
+ ...e.selectedElementIds,
3939
+ [m.id]: !0
3940
+ };
3941
+ return delete t[m.frameId], (this.scene.getElement(m.frameId)?.groupIds ?? []).flatMap((e) => zt(this.scene.getNonDeletedElements(), e)).forEach((e) => {
3942
+ delete t[e.id];
3943
+ }), { ...I({
3944
+ editingGroupId: e.editingGroupId,
3945
+ selectedElementIds: t
3946
+ }, this.scene.getNonDeletedElements(), e, this) };
3947
+ }) : this.setState((e) => ({ selectedElementIds: F({
3948
+ ...e.selectedElementIds,
3949
+ [m.id]: !0
3950
+ }, e) })) : this.setState((e) => ({
3951
+ ...I({
3952
+ editingGroupId: e.editingGroupId,
3953
+ selectedElementIds: { [m.id]: !0 }
3954
+ }, this.scene.getNonDeletedElements(), e, this),
3955
+ selectedLinearElement: N(m) && e.selectedLinearElement?.elementId !== m.id ? new z(m, this.scene.getNonDeletedElementsMap()) : e.selectedLinearElement
3956
+ }))), this.state.activeTool.type !== "lasso" && !(m && A(m)) && !e.drag.hasOccurred && !this.state.isResizing && (m && fn({
3957
+ point: S(e.origin.x, e.origin.y),
3958
+ element: m,
3959
+ elementsMap: n,
3960
+ threshold: this.getElementHitThreshold(m),
3961
+ frameNameBound: j(m) ? this.frameNameBoundsCache.get(m) : null
3962
+ }, n) || !m && e.hit.hasHitCommonBoundingBoxOfSelectedElements)) {
3963
+ this.state.selectedLinearElement?.isEditing ? this.actionManager.executeAction(Zi) : this.setState({
3964
+ selectedElementIds: F({}, this.state),
3965
+ selectedGroupIds: {},
3966
+ editingGroupId: null,
3967
+ activeEmbeddable: null
3968
+ }), W(this.interactiveCanvas, u.AUTO);
3969
+ return;
3970
+ }
3971
+ if (!s.locked && s.type !== "freedraw" && r && this.setState((e) => ({ selectedElementIds: F({
3972
+ ...e.selectedElementIds,
3973
+ [r.id]: !0
3974
+ }, e) })), (s.type !== "selection" || wt(this.scene.getNonDeletedElements(), this.state) || !Ve(this.state.previousSelectedElementIds, this.state.selectedElementIds)) && this.#r.scheduleCapture(), (e.drag.hasOccurred && !this.state.selectedLinearElement || c || l || d) && gn(this.scene.getSelectedElements(this.state).filter(at), this.scene, this.state), s.type === "laser") {
3975
+ this.laserTrails.endPath();
3976
+ return;
3977
+ }
3978
+ !s.locked && s.type !== "freedraw" && (s.type !== "lasso" || s.type === "lasso" && s.fromSelection) ? (U(this.interactiveCanvas), this.setState({
3979
+ newElement: null,
3980
+ suggestedBinding: null,
3981
+ activeTool: D(this.state, { type: this.state.preferredSelectionTool.type })
3982
+ })) : this.setState({
3983
+ newElement: null,
3984
+ suggestedBinding: null
3985
+ }), m && this.lastPointerUpEvent && this.lastPointerDownEvent && this.lastPointerUpEvent.timeStamp - this.lastPointerDownEvent.timeStamp < 300 && $.pointers.size <= 1 && ft(m) && this.#v(m, this.lastPointerUpEvent, e.origin.x, e.origin.y) && this.#_(m);
3986
+ });
3987
+ }
3988
+ #at;
3989
+ #ot;
3990
+ #st;
3991
+ #ct;
3992
+ #lt;
3993
+ #ut;
3994
+ #dt;
3995
+ #ft;
3996
+ #pt;
3997
+ #mt;
3998
+ #ht(e) {
3999
+ this.setState((t) => ({
4000
+ selectedElementIds: F({}, t),
4001
+ activeEmbeddable: null,
4002
+ selectedGroupIds: {},
4003
+ editingGroupId: t.editingGroupId && e != null && Ht(e, t.editingGroupId) ? t.editingGroupId : null
4004
+ })), this.setState({
4005
+ selectedElementIds: F({}, this.state),
4006
+ activeEmbeddable: null,
4007
+ previousSelectedElementIds: this.state.selectedElementIds,
4008
+ selectedLinearElement: null
4009
+ });
4010
+ }
4011
+ #gt;
4012
+ #_t;
4013
+ #vt;
4014
+ #yt;
4015
+ #bt;
4016
+ #xt;
4017
+ #St;
4018
+ #Ct;
4019
+ #wt;
4020
+ #Tt(e, t, n, r) {
4021
+ if (r) {
4022
+ let i = r.x + r.width / 2, a = r.y + r.height / 2, o = Pt(r, n, this.scene.getNonDeletedElementsMap());
4023
+ if (o && (i = o.x, a = o.y), Math.hypot(e - i, t - a) < 30) {
4024
+ let { x: e, y: t } = qe({
4025
+ sceneX: i,
4026
+ sceneY: a
4027
+ }, n);
4028
+ return {
4029
+ viewportX: e,
4030
+ viewportY: t,
4031
+ elementCenterX: i,
4032
+ elementCenterY: a
4033
+ };
4034
+ }
4035
+ }
4036
+ }
4037
+ #Et;
4038
+ #Dt;
4039
+ #Ot;
4040
+ #kt() {
4041
+ if (this.rootElement) {
4042
+ let { left: e, top: t } = this.rootElement.getBoundingClientRect();
4043
+ return {
4044
+ offsetLeft: e,
4045
+ offsetTop: t
4046
+ };
4047
+ }
4048
+ return {
4049
+ offsetLeft: 0,
4050
+ offsetTop: 0
4051
+ };
4052
+ }
4053
+ async #At() {
4054
+ await Gr(Wr.find((e) => e.code === this.props.langCode) || Hr), this.setAppState({});
4055
+ }
4056
+ };
4057
+ (He() || Re()) && (window.h = window.h || {}, Object.defineProperties(window.h, {
4058
+ elements: {
4059
+ configurable: !0,
4060
+ get() {
4061
+ return this.app?.scene?.getElementsIncludingDeleted?.();
4062
+ },
4063
+ set(e) {
4064
+ return this.app?.scene?.replaceAllElements?.(Cn(e));
4065
+ }
4066
+ },
4067
+ scene: {
4068
+ configurable: !0,
4069
+ get() {
4070
+ return this.app?.scene;
4071
+ }
4072
+ }
4073
+ }));
4074
+ //#endregion
4075
+ export { yo as default };
4076
+ /* 独立思考,明辨是非 */