@sulesky/next-core 1.0.3

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 (488) hide show
  1. package/LICENSE.md +20 -0
  2. package/README.md +1 -0
  3. package/dist/designable.core.umd.production.js +1 -0
  4. package/dist/designable.core.umd.production.min.js +7994 -0
  5. package/esm/drivers/DragDropDriver.d.ts +14 -0
  6. package/esm/drivers/DragDropDriver.js +157 -0
  7. package/esm/drivers/KeyboardDriver.d.ts +7 -0
  8. package/esm/drivers/KeyboardDriver.js +90 -0
  9. package/esm/drivers/MouseClickDriver.d.ts +8 -0
  10. package/esm/drivers/MouseClickDriver.js +95 -0
  11. package/esm/drivers/MouseMoveDriver.d.ts +8 -0
  12. package/esm/drivers/MouseMoveDriver.js +75 -0
  13. package/esm/drivers/ViewportResizeDriver.d.ts +10 -0
  14. package/esm/drivers/ViewportResizeDriver.js +94 -0
  15. package/esm/drivers/ViewportScrollDriver.d.ts +8 -0
  16. package/esm/drivers/ViewportScrollDriver.js +74 -0
  17. package/esm/drivers/index.d.ts +6 -0
  18. package/esm/drivers/index.js +6 -0
  19. package/esm/effects/index.d.ts +11 -0
  20. package/esm/effects/index.js +11 -0
  21. package/esm/effects/useAutoScrollEffect.d.ts +2 -0
  22. package/esm/effects/useAutoScrollEffect.js +65 -0
  23. package/esm/effects/useContentEditableEffect.d.ts +2 -0
  24. package/esm/effects/useContentEditableEffect.js +167 -0
  25. package/esm/effects/useCursorEffect.d.ts +2 -0
  26. package/esm/effects/useCursorEffect.js +55 -0
  27. package/esm/effects/useDragDropEffect.d.ts +2 -0
  28. package/esm/effects/useDragDropEffect.js +168 -0
  29. package/esm/effects/useFreeSelectionEffect.d.ts +2 -0
  30. package/esm/effects/useFreeSelectionEffect.js +59 -0
  31. package/esm/effects/useKeyboardEffect.d.ts +2 -0
  32. package/esm/effects/useKeyboardEffect.js +17 -0
  33. package/esm/effects/useResizeEffect.d.ts +2 -0
  34. package/esm/effects/useResizeEffect.js +80 -0
  35. package/esm/effects/useSelectionEffect.d.ts +2 -0
  36. package/esm/effects/useSelectionEffect.js +68 -0
  37. package/esm/effects/useTranslateEffect.d.ts +2 -0
  38. package/esm/effects/useTranslateEffect.js +58 -0
  39. package/esm/effects/useViewportEffect.d.ts +2 -0
  40. package/esm/effects/useViewportEffect.js +31 -0
  41. package/esm/effects/useWorkspaceEffect.d.ts +2 -0
  42. package/esm/effects/useWorkspaceEffect.js +29 -0
  43. package/esm/events/cursor/AbstractCursorEvent.d.ts +21 -0
  44. package/esm/events/cursor/AbstractCursorEvent.js +40 -0
  45. package/esm/events/cursor/DragMoveEvent.d.ts +5 -0
  46. package/esm/events/cursor/DragMoveEvent.js +51 -0
  47. package/esm/events/cursor/DragStartEvent.d.ts +5 -0
  48. package/esm/events/cursor/DragStartEvent.js +51 -0
  49. package/esm/events/cursor/DragStopEvent.d.ts +5 -0
  50. package/esm/events/cursor/DragStopEvent.js +51 -0
  51. package/esm/events/cursor/MouseClickEvent.d.ts +8 -0
  52. package/esm/events/cursor/MouseClickEvent.js +61 -0
  53. package/esm/events/cursor/MouseMoveEvent.d.ts +5 -0
  54. package/esm/events/cursor/MouseMoveEvent.js +51 -0
  55. package/esm/events/cursor/index.d.ts +5 -0
  56. package/esm/events/cursor/index.js +5 -0
  57. package/esm/events/history/AbstractHistoryEvent.d.ts +6 -0
  58. package/esm/events/history/AbstractHistoryEvent.js +7 -0
  59. package/esm/events/history/HistoryGotoEvent.d.ts +5 -0
  60. package/esm/events/history/HistoryGotoEvent.js +51 -0
  61. package/esm/events/history/HistoryPushEvent.d.ts +5 -0
  62. package/esm/events/history/HistoryPushEvent.js +51 -0
  63. package/esm/events/history/HistoryRedoEvent.d.ts +5 -0
  64. package/esm/events/history/HistoryRedoEvent.js +51 -0
  65. package/esm/events/history/HistoryUndoEvent.d.ts +5 -0
  66. package/esm/events/history/HistoryUndoEvent.js +51 -0
  67. package/esm/events/history/index.d.ts +4 -0
  68. package/esm/events/history/index.js +4 -0
  69. package/esm/events/index.d.ts +6 -0
  70. package/esm/events/index.js +6 -0
  71. package/esm/events/keyboard/AbstractKeyboardEvent.d.ts +15 -0
  72. package/esm/events/keyboard/AbstractKeyboardEvent.js +61 -0
  73. package/esm/events/keyboard/KeyDownEvent.d.ts +5 -0
  74. package/esm/events/keyboard/KeyDownEvent.js +51 -0
  75. package/esm/events/keyboard/KeyUpEvent.d.ts +5 -0
  76. package/esm/events/keyboard/KeyUpEvent.js +51 -0
  77. package/esm/events/keyboard/index.d.ts +2 -0
  78. package/esm/events/keyboard/index.js +2 -0
  79. package/esm/events/mutation/AbstractMutationNodeEvent.d.ts +13 -0
  80. package/esm/events/mutation/AbstractMutationNodeEvent.js +7 -0
  81. package/esm/events/mutation/AppendNodeEvent.d.ts +5 -0
  82. package/esm/events/mutation/AppendNodeEvent.js +51 -0
  83. package/esm/events/mutation/CloneNodeEvent.d.ts +5 -0
  84. package/esm/events/mutation/CloneNodeEvent.js +51 -0
  85. package/esm/events/mutation/DragNodeEvent.d.ts +5 -0
  86. package/esm/events/mutation/DragNodeEvent.js +51 -0
  87. package/esm/events/mutation/DropNodeEvent.d.ts +5 -0
  88. package/esm/events/mutation/DropNodeEvent.js +51 -0
  89. package/esm/events/mutation/FromNodeEvent.d.ts +13 -0
  90. package/esm/events/mutation/FromNodeEvent.js +8 -0
  91. package/esm/events/mutation/HoverNodeEvent.d.ts +5 -0
  92. package/esm/events/mutation/HoverNodeEvent.js +51 -0
  93. package/esm/events/mutation/InsertAfterEvent.d.ts +5 -0
  94. package/esm/events/mutation/InsertAfterEvent.js +51 -0
  95. package/esm/events/mutation/InsertBeforeEvent.d.ts +5 -0
  96. package/esm/events/mutation/InsertBeforeEvent.js +51 -0
  97. package/esm/events/mutation/InsertChildrenEvent.d.ts +5 -0
  98. package/esm/events/mutation/InsertChildrenEvent.js +51 -0
  99. package/esm/events/mutation/PrependNodeEvent.d.ts +5 -0
  100. package/esm/events/mutation/PrependNodeEvent.js +51 -0
  101. package/esm/events/mutation/RemoveNodeEvent.d.ts +5 -0
  102. package/esm/events/mutation/RemoveNodeEvent.js +51 -0
  103. package/esm/events/mutation/SelectNodeEvent.d.ts +5 -0
  104. package/esm/events/mutation/SelectNodeEvent.js +51 -0
  105. package/esm/events/mutation/UnSelectNodeEvent.d.ts +5 -0
  106. package/esm/events/mutation/UnSelectNodeEvent.js +51 -0
  107. package/esm/events/mutation/UpdateChildrenEvent.d.ts +5 -0
  108. package/esm/events/mutation/UpdateChildrenEvent.js +51 -0
  109. package/esm/events/mutation/UpdateNodePropsEvent.d.ts +5 -0
  110. package/esm/events/mutation/UpdateNodePropsEvent.js +51 -0
  111. package/esm/events/mutation/UserSelectNodeEvent.d.ts +5 -0
  112. package/esm/events/mutation/UserSelectNodeEvent.js +51 -0
  113. package/esm/events/mutation/WrapNodeEvent.d.ts +5 -0
  114. package/esm/events/mutation/WrapNodeEvent.js +51 -0
  115. package/esm/events/mutation/index.d.ts +16 -0
  116. package/esm/events/mutation/index.js +16 -0
  117. package/esm/events/viewport/AbstractViewportEvent.d.ts +16 -0
  118. package/esm/events/viewport/AbstractViewportEvent.js +17 -0
  119. package/esm/events/viewport/ViewportResizeEvent.d.ts +5 -0
  120. package/esm/events/viewport/ViewportResizeEvent.js +51 -0
  121. package/esm/events/viewport/ViewportScrollEvent.d.ts +5 -0
  122. package/esm/events/viewport/ViewportScrollEvent.js +51 -0
  123. package/esm/events/viewport/index.d.ts +2 -0
  124. package/esm/events/viewport/index.js +2 -0
  125. package/esm/events/workbench/AbstractWorkspaceEvent.d.ts +7 -0
  126. package/esm/events/workbench/AbstractWorkspaceEvent.js +7 -0
  127. package/esm/events/workbench/AddWorkspaceEvent.d.ts +5 -0
  128. package/esm/events/workbench/AddWorkspaceEvent.js +51 -0
  129. package/esm/events/workbench/RemoveWorkspaceEvent.d.ts +5 -0
  130. package/esm/events/workbench/RemoveWorkspaceEvent.js +51 -0
  131. package/esm/events/workbench/SwitchWorkspaceEvent.d.ts +5 -0
  132. package/esm/events/workbench/SwitchWorkspaceEvent.js +51 -0
  133. package/esm/events/workbench/index.d.ts +3 -0
  134. package/esm/events/workbench/index.js +3 -0
  135. package/esm/exports.d.ts +5 -0
  136. package/esm/exports.js +5 -0
  137. package/esm/externals.d.ts +12 -0
  138. package/esm/externals.js +113 -0
  139. package/esm/index.d.ts +1 -0
  140. package/esm/index.js +24 -0
  141. package/esm/internals.d.ts +3 -0
  142. package/esm/internals.js +34 -0
  143. package/esm/models/Cursor.d.ts +60 -0
  144. package/esm/models/Cursor.js +151 -0
  145. package/esm/models/Engine.d.ts +29 -0
  146. package/esm/models/Engine.js +112 -0
  147. package/esm/models/History.d.ts +34 -0
  148. package/esm/models/History.js +110 -0
  149. package/esm/models/Hover.d.ts +14 -0
  150. package/esm/models/Hover.js +38 -0
  151. package/esm/models/Keyboard.d.ts +29 -0
  152. package/esm/models/Keyboard.js +126 -0
  153. package/esm/models/MoveHelper.d.ts +66 -0
  154. package/esm/models/MoveHelper.js +363 -0
  155. package/esm/models/Operation.d.ts +29 -0
  156. package/esm/models/Operation.js +75 -0
  157. package/esm/models/Screen.d.ts +31 -0
  158. package/esm/models/Screen.js +73 -0
  159. package/esm/models/Selection.d.ts +29 -0
  160. package/esm/models/Selection.js +192 -0
  161. package/esm/models/Shortcut.d.ts +20 -0
  162. package/esm/models/Shortcut.js +69 -0
  163. package/esm/models/SnapLine.d.ts +27 -0
  164. package/esm/models/SnapLine.js +141 -0
  165. package/esm/models/SpaceBlock.d.ts +40 -0
  166. package/esm/models/SpaceBlock.js +171 -0
  167. package/esm/models/TransformHelper.d.ts +80 -0
  168. package/esm/models/TransformHelper.js +601 -0
  169. package/esm/models/TreeNode.d.ts +115 -0
  170. package/esm/models/TreeNode.js +933 -0
  171. package/esm/models/Viewport.d.ts +90 -0
  172. package/esm/models/Viewport.js +474 -0
  173. package/esm/models/Workbench.d.ts +23 -0
  174. package/esm/models/Workbench.js +98 -0
  175. package/esm/models/Workspace.d.ts +41 -0
  176. package/esm/models/Workspace.js +95 -0
  177. package/esm/models/index.d.ts +13 -0
  178. package/esm/models/index.js +13 -0
  179. package/esm/presets.d.ts +4 -0
  180. package/esm/presets.js +38 -0
  181. package/esm/registry.d.ts +16 -0
  182. package/esm/registry.js +123 -0
  183. package/esm/shortcuts/CursorSwitch.d.ts +2 -0
  184. package/esm/shortcuts/CursorSwitch.js +10 -0
  185. package/esm/shortcuts/MultiSelection.d.ts +5 -0
  186. package/esm/shortcuts/MultiSelection.js +27 -0
  187. package/esm/shortcuts/NodeMutation.d.ts +7 -0
  188. package/esm/shortcuts/NodeMutation.js +40 -0
  189. package/esm/shortcuts/QuickSelection.d.ts +3 -0
  190. package/esm/shortcuts/QuickSelection.js +85 -0
  191. package/esm/shortcuts/UndoRedo.d.ts +3 -0
  192. package/esm/shortcuts/UndoRedo.js +27 -0
  193. package/esm/shortcuts/index.d.ts +5 -0
  194. package/esm/shortcuts/index.js +5 -0
  195. package/esm/types.d.ts +131 -0
  196. package/esm/types.js +1 -0
  197. package/lib/drivers/DragDropDriver.d.ts +14 -0
  198. package/lib/drivers/DragDropDriver.js +160 -0
  199. package/lib/drivers/KeyboardDriver.d.ts +7 -0
  200. package/lib/drivers/KeyboardDriver.js +93 -0
  201. package/lib/drivers/MouseClickDriver.d.ts +8 -0
  202. package/lib/drivers/MouseClickDriver.js +98 -0
  203. package/lib/drivers/MouseMoveDriver.d.ts +8 -0
  204. package/lib/drivers/MouseMoveDriver.js +78 -0
  205. package/lib/drivers/ViewportResizeDriver.d.ts +10 -0
  206. package/lib/drivers/ViewportResizeDriver.js +97 -0
  207. package/lib/drivers/ViewportScrollDriver.d.ts +8 -0
  208. package/lib/drivers/ViewportScrollDriver.js +77 -0
  209. package/lib/drivers/index.d.ts +6 -0
  210. package/lib/drivers/index.js +22 -0
  211. package/lib/effects/index.d.ts +11 -0
  212. package/lib/effects/index.js +27 -0
  213. package/lib/effects/useAutoScrollEffect.d.ts +2 -0
  214. package/lib/effects/useAutoScrollEffect.js +69 -0
  215. package/lib/effects/useContentEditableEffect.d.ts +2 -0
  216. package/lib/effects/useContentEditableEffect.js +171 -0
  217. package/lib/effects/useCursorEffect.d.ts +2 -0
  218. package/lib/effects/useCursorEffect.js +59 -0
  219. package/lib/effects/useDragDropEffect.d.ts +2 -0
  220. package/lib/effects/useDragDropEffect.js +172 -0
  221. package/lib/effects/useFreeSelectionEffect.d.ts +2 -0
  222. package/lib/effects/useFreeSelectionEffect.js +63 -0
  223. package/lib/effects/useKeyboardEffect.d.ts +2 -0
  224. package/lib/effects/useKeyboardEffect.js +21 -0
  225. package/lib/effects/useResizeEffect.d.ts +2 -0
  226. package/lib/effects/useResizeEffect.js +84 -0
  227. package/lib/effects/useSelectionEffect.d.ts +2 -0
  228. package/lib/effects/useSelectionEffect.js +72 -0
  229. package/lib/effects/useTranslateEffect.d.ts +2 -0
  230. package/lib/effects/useTranslateEffect.js +62 -0
  231. package/lib/effects/useViewportEffect.d.ts +2 -0
  232. package/lib/effects/useViewportEffect.js +35 -0
  233. package/lib/effects/useWorkspaceEffect.d.ts +2 -0
  234. package/lib/effects/useWorkspaceEffect.js +33 -0
  235. package/lib/events/cursor/AbstractCursorEvent.d.ts +21 -0
  236. package/lib/events/cursor/AbstractCursorEvent.js +43 -0
  237. package/lib/events/cursor/DragMoveEvent.d.ts +5 -0
  238. package/lib/events/cursor/DragMoveEvent.js +54 -0
  239. package/lib/events/cursor/DragStartEvent.d.ts +5 -0
  240. package/lib/events/cursor/DragStartEvent.js +54 -0
  241. package/lib/events/cursor/DragStopEvent.d.ts +5 -0
  242. package/lib/events/cursor/DragStopEvent.js +54 -0
  243. package/lib/events/cursor/MouseClickEvent.d.ts +8 -0
  244. package/lib/events/cursor/MouseClickEvent.js +64 -0
  245. package/lib/events/cursor/MouseMoveEvent.d.ts +5 -0
  246. package/lib/events/cursor/MouseMoveEvent.js +54 -0
  247. package/lib/events/cursor/index.d.ts +5 -0
  248. package/lib/events/cursor/index.js +21 -0
  249. package/lib/events/history/AbstractHistoryEvent.d.ts +6 -0
  250. package/lib/events/history/AbstractHistoryEvent.js +10 -0
  251. package/lib/events/history/HistoryGotoEvent.d.ts +5 -0
  252. package/lib/events/history/HistoryGotoEvent.js +54 -0
  253. package/lib/events/history/HistoryPushEvent.d.ts +5 -0
  254. package/lib/events/history/HistoryPushEvent.js +54 -0
  255. package/lib/events/history/HistoryRedoEvent.d.ts +5 -0
  256. package/lib/events/history/HistoryRedoEvent.js +54 -0
  257. package/lib/events/history/HistoryUndoEvent.d.ts +5 -0
  258. package/lib/events/history/HistoryUndoEvent.js +54 -0
  259. package/lib/events/history/index.d.ts +4 -0
  260. package/lib/events/history/index.js +20 -0
  261. package/lib/events/index.d.ts +6 -0
  262. package/lib/events/index.js +22 -0
  263. package/lib/events/keyboard/AbstractKeyboardEvent.d.ts +15 -0
  264. package/lib/events/keyboard/AbstractKeyboardEvent.js +64 -0
  265. package/lib/events/keyboard/KeyDownEvent.d.ts +5 -0
  266. package/lib/events/keyboard/KeyDownEvent.js +54 -0
  267. package/lib/events/keyboard/KeyUpEvent.d.ts +5 -0
  268. package/lib/events/keyboard/KeyUpEvent.js +54 -0
  269. package/lib/events/keyboard/index.d.ts +2 -0
  270. package/lib/events/keyboard/index.js +18 -0
  271. package/lib/events/mutation/AbstractMutationNodeEvent.d.ts +13 -0
  272. package/lib/events/mutation/AbstractMutationNodeEvent.js +10 -0
  273. package/lib/events/mutation/AppendNodeEvent.d.ts +5 -0
  274. package/lib/events/mutation/AppendNodeEvent.js +54 -0
  275. package/lib/events/mutation/CloneNodeEvent.d.ts +5 -0
  276. package/lib/events/mutation/CloneNodeEvent.js +54 -0
  277. package/lib/events/mutation/DragNodeEvent.d.ts +5 -0
  278. package/lib/events/mutation/DragNodeEvent.js +54 -0
  279. package/lib/events/mutation/DropNodeEvent.d.ts +5 -0
  280. package/lib/events/mutation/DropNodeEvent.js +54 -0
  281. package/lib/events/mutation/FromNodeEvent.d.ts +13 -0
  282. package/lib/events/mutation/FromNodeEvent.js +11 -0
  283. package/lib/events/mutation/HoverNodeEvent.d.ts +5 -0
  284. package/lib/events/mutation/HoverNodeEvent.js +54 -0
  285. package/lib/events/mutation/InsertAfterEvent.d.ts +5 -0
  286. package/lib/events/mutation/InsertAfterEvent.js +54 -0
  287. package/lib/events/mutation/InsertBeforeEvent.d.ts +5 -0
  288. package/lib/events/mutation/InsertBeforeEvent.js +54 -0
  289. package/lib/events/mutation/InsertChildrenEvent.d.ts +5 -0
  290. package/lib/events/mutation/InsertChildrenEvent.js +54 -0
  291. package/lib/events/mutation/PrependNodeEvent.d.ts +5 -0
  292. package/lib/events/mutation/PrependNodeEvent.js +54 -0
  293. package/lib/events/mutation/RemoveNodeEvent.d.ts +5 -0
  294. package/lib/events/mutation/RemoveNodeEvent.js +54 -0
  295. package/lib/events/mutation/SelectNodeEvent.d.ts +5 -0
  296. package/lib/events/mutation/SelectNodeEvent.js +54 -0
  297. package/lib/events/mutation/UnSelectNodeEvent.d.ts +5 -0
  298. package/lib/events/mutation/UnSelectNodeEvent.js +54 -0
  299. package/lib/events/mutation/UpdateChildrenEvent.d.ts +5 -0
  300. package/lib/events/mutation/UpdateChildrenEvent.js +54 -0
  301. package/lib/events/mutation/UpdateNodePropsEvent.d.ts +5 -0
  302. package/lib/events/mutation/UpdateNodePropsEvent.js +54 -0
  303. package/lib/events/mutation/UserSelectNodeEvent.d.ts +5 -0
  304. package/lib/events/mutation/UserSelectNodeEvent.js +54 -0
  305. package/lib/events/mutation/WrapNodeEvent.d.ts +5 -0
  306. package/lib/events/mutation/WrapNodeEvent.js +54 -0
  307. package/lib/events/mutation/index.d.ts +16 -0
  308. package/lib/events/mutation/index.js +32 -0
  309. package/lib/events/viewport/AbstractViewportEvent.d.ts +16 -0
  310. package/lib/events/viewport/AbstractViewportEvent.js +20 -0
  311. package/lib/events/viewport/ViewportResizeEvent.d.ts +5 -0
  312. package/lib/events/viewport/ViewportResizeEvent.js +54 -0
  313. package/lib/events/viewport/ViewportScrollEvent.d.ts +5 -0
  314. package/lib/events/viewport/ViewportScrollEvent.js +54 -0
  315. package/lib/events/viewport/index.d.ts +2 -0
  316. package/lib/events/viewport/index.js +18 -0
  317. package/lib/events/workbench/AbstractWorkspaceEvent.d.ts +7 -0
  318. package/lib/events/workbench/AbstractWorkspaceEvent.js +10 -0
  319. package/lib/events/workbench/AddWorkspaceEvent.d.ts +5 -0
  320. package/lib/events/workbench/AddWorkspaceEvent.js +54 -0
  321. package/lib/events/workbench/RemoveWorkspaceEvent.d.ts +5 -0
  322. package/lib/events/workbench/RemoveWorkspaceEvent.js +54 -0
  323. package/lib/events/workbench/SwitchWorkspaceEvent.d.ts +5 -0
  324. package/lib/events/workbench/SwitchWorkspaceEvent.js +54 -0
  325. package/lib/events/workbench/index.d.ts +3 -0
  326. package/lib/events/workbench/index.js +19 -0
  327. package/lib/exports.d.ts +5 -0
  328. package/lib/exports.js +21 -0
  329. package/lib/externals.d.ts +12 -0
  330. package/lib/externals.js +126 -0
  331. package/lib/index.d.ts +1 -0
  332. package/lib/index.js +62 -0
  333. package/lib/internals.d.ts +3 -0
  334. package/lib/internals.js +40 -0
  335. package/lib/models/Cursor.d.ts +60 -0
  336. package/lib/models/Cursor.js +154 -0
  337. package/lib/models/Engine.d.ts +29 -0
  338. package/lib/models/Engine.js +115 -0
  339. package/lib/models/History.d.ts +34 -0
  340. package/lib/models/History.js +113 -0
  341. package/lib/models/Hover.d.ts +14 -0
  342. package/lib/models/Hover.js +41 -0
  343. package/lib/models/Keyboard.d.ts +29 -0
  344. package/lib/models/Keyboard.js +129 -0
  345. package/lib/models/MoveHelper.d.ts +66 -0
  346. package/lib/models/MoveHelper.js +366 -0
  347. package/lib/models/Operation.d.ts +29 -0
  348. package/lib/models/Operation.js +78 -0
  349. package/lib/models/Screen.d.ts +31 -0
  350. package/lib/models/Screen.js +76 -0
  351. package/lib/models/Selection.d.ts +29 -0
  352. package/lib/models/Selection.js +195 -0
  353. package/lib/models/Shortcut.d.ts +20 -0
  354. package/lib/models/Shortcut.js +72 -0
  355. package/lib/models/SnapLine.d.ts +27 -0
  356. package/lib/models/SnapLine.js +144 -0
  357. package/lib/models/SpaceBlock.d.ts +40 -0
  358. package/lib/models/SpaceBlock.js +174 -0
  359. package/lib/models/TransformHelper.d.ts +80 -0
  360. package/lib/models/TransformHelper.js +604 -0
  361. package/lib/models/TreeNode.d.ts +115 -0
  362. package/lib/models/TreeNode.js +936 -0
  363. package/lib/models/Viewport.d.ts +90 -0
  364. package/lib/models/Viewport.js +477 -0
  365. package/lib/models/Workbench.d.ts +23 -0
  366. package/lib/models/Workbench.js +101 -0
  367. package/lib/models/Workspace.d.ts +41 -0
  368. package/lib/models/Workspace.js +98 -0
  369. package/lib/models/index.d.ts +13 -0
  370. package/lib/models/index.js +29 -0
  371. package/lib/presets.d.ts +4 -0
  372. package/lib/presets.js +41 -0
  373. package/lib/registry.d.ts +16 -0
  374. package/lib/registry.js +126 -0
  375. package/lib/shortcuts/CursorSwitch.d.ts +2 -0
  376. package/lib/shortcuts/CursorSwitch.js +13 -0
  377. package/lib/shortcuts/MultiSelection.d.ts +5 -0
  378. package/lib/shortcuts/MultiSelection.js +30 -0
  379. package/lib/shortcuts/NodeMutation.d.ts +7 -0
  380. package/lib/shortcuts/NodeMutation.js +43 -0
  381. package/lib/shortcuts/QuickSelection.d.ts +3 -0
  382. package/lib/shortcuts/QuickSelection.js +88 -0
  383. package/lib/shortcuts/UndoRedo.d.ts +3 -0
  384. package/lib/shortcuts/UndoRedo.js +30 -0
  385. package/lib/shortcuts/index.d.ts +5 -0
  386. package/lib/shortcuts/index.js +21 -0
  387. package/lib/types.d.ts +131 -0
  388. package/lib/types.js +2 -0
  389. package/package.json +43 -0
  390. package/rollup.config.mjs +3 -0
  391. package/src/drivers/DragDropDriver.ts +143 -0
  392. package/src/drivers/KeyboardDriver.ts +49 -0
  393. package/src/drivers/MouseClickDriver.ts +61 -0
  394. package/src/drivers/MouseMoveDriver.ts +34 -0
  395. package/src/drivers/ViewportResizeDriver.ts +52 -0
  396. package/src/drivers/ViewportScrollDriver.ts +34 -0
  397. package/src/drivers/index.ts +6 -0
  398. package/src/effects/index.ts +11 -0
  399. package/src/effects/useAutoScrollEffect.ts +82 -0
  400. package/src/effects/useContentEditableEffect.ts +207 -0
  401. package/src/effects/useCursorEffect.ts +62 -0
  402. package/src/effects/useDragDropEffect.ts +185 -0
  403. package/src/effects/useFreeSelectionEffect.ts +66 -0
  404. package/src/effects/useKeyboardEffect.ts +20 -0
  405. package/src/effects/useResizeEffect.ts +92 -0
  406. package/src/effects/useSelectionEffect.ts +68 -0
  407. package/src/effects/useTranslateEffect.ts +59 -0
  408. package/src/effects/useViewportEffect.ts +29 -0
  409. package/src/effects/useWorkspaceEffect.ts +35 -0
  410. package/src/events/cursor/AbstractCursorEvent.ts +62 -0
  411. package/src/events/cursor/DragMoveEvent.ts +6 -0
  412. package/src/events/cursor/DragStartEvent.ts +9 -0
  413. package/src/events/cursor/DragStopEvent.ts +6 -0
  414. package/src/events/cursor/MouseClickEvent.ts +16 -0
  415. package/src/events/cursor/MouseMoveEvent.ts +9 -0
  416. package/src/events/cursor/index.ts +5 -0
  417. package/src/events/history/AbstractHistoryEvent.ts +9 -0
  418. package/src/events/history/HistoryGotoEvent.ts +9 -0
  419. package/src/events/history/HistoryPushEvent.ts +9 -0
  420. package/src/events/history/HistoryRedoEvent.ts +9 -0
  421. package/src/events/history/HistoryUndoEvent.ts +9 -0
  422. package/src/events/history/index.ts +4 -0
  423. package/src/events/index.ts +6 -0
  424. package/src/events/keyboard/AbstractKeyboardEvent.ts +48 -0
  425. package/src/events/keyboard/KeyDownEvent.ts +9 -0
  426. package/src/events/keyboard/KeyUpEvent.ts +6 -0
  427. package/src/events/keyboard/index.ts +2 -0
  428. package/src/events/mutation/AbstractMutationNodeEvent.ts +21 -0
  429. package/src/events/mutation/AppendNodeEvent.ts +9 -0
  430. package/src/events/mutation/CloneNodeEvent.ts +9 -0
  431. package/src/events/mutation/DragNodeEvent.ts +9 -0
  432. package/src/events/mutation/DropNodeEvent.ts +9 -0
  433. package/src/events/mutation/FromNodeEvent.ts +19 -0
  434. package/src/events/mutation/HoverNodeEvent.ts +9 -0
  435. package/src/events/mutation/InsertAfterEvent.ts +9 -0
  436. package/src/events/mutation/InsertBeforeEvent.ts +9 -0
  437. package/src/events/mutation/InsertChildrenEvent.ts +9 -0
  438. package/src/events/mutation/PrependNodeEvent.ts +9 -0
  439. package/src/events/mutation/RemoveNodeEvent.ts +9 -0
  440. package/src/events/mutation/SelectNodeEvent.ts +9 -0
  441. package/src/events/mutation/UnSelectNodeEvent.ts +9 -0
  442. package/src/events/mutation/UpdateChildrenEvent.ts +9 -0
  443. package/src/events/mutation/UpdateNodePropsEvent.ts +9 -0
  444. package/src/events/mutation/UserSelectNodeEvent.ts +9 -0
  445. package/src/events/mutation/WrapNodeEvent.ts +9 -0
  446. package/src/events/mutation/index.ts +16 -0
  447. package/src/events/viewport/AbstractViewportEvent.ts +30 -0
  448. package/src/events/viewport/ViewportResizeEvent.ts +9 -0
  449. package/src/events/viewport/ViewportScrollEvent.ts +9 -0
  450. package/src/events/viewport/index.ts +2 -0
  451. package/src/events/workbench/AbstractWorkspaceEvent.ts +10 -0
  452. package/src/events/workbench/AddWorkspaceEvent.ts +8 -0
  453. package/src/events/workbench/RemoveWorkspaceEvent.ts +9 -0
  454. package/src/events/workbench/SwitchWorkspaceEvent.ts +9 -0
  455. package/src/events/workbench/index.ts +3 -0
  456. package/src/exports.ts +5 -0
  457. package/src/externals.ts +87 -0
  458. package/src/index.ts +15 -0
  459. package/src/internals.ts +37 -0
  460. package/src/models/Cursor.ts +198 -0
  461. package/src/models/Engine.ts +108 -0
  462. package/src/models/History.ts +125 -0
  463. package/src/models/Hover.ts +49 -0
  464. package/src/models/Keyboard.ts +126 -0
  465. package/src/models/MoveHelper.ts +383 -0
  466. package/src/models/Operation.ts +91 -0
  467. package/src/models/Screen.ts +83 -0
  468. package/src/models/Selection.ts +177 -0
  469. package/src/models/Shortcut.ts +81 -0
  470. package/src/models/SnapLine.ts +129 -0
  471. package/src/models/SpaceBlock.ts +199 -0
  472. package/src/models/TransformHelper.ts +648 -0
  473. package/src/models/TreeNode.ts +894 -0
  474. package/src/models/Viewport.ts +516 -0
  475. package/src/models/Workbench.ts +120 -0
  476. package/src/models/Workspace.ts +142 -0
  477. package/src/models/index.ts +13 -0
  478. package/src/presets.ts +73 -0
  479. package/src/registry.ts +147 -0
  480. package/src/shortcuts/CursorSwitch.ts +11 -0
  481. package/src/shortcuts/MultiSelection.ts +31 -0
  482. package/src/shortcuts/NodeMutation.ts +49 -0
  483. package/src/shortcuts/QuickSelection.ts +81 -0
  484. package/src/shortcuts/UndoRedo.ts +29 -0
  485. package/src/shortcuts/index.ts +5 -0
  486. package/src/types.ts +185 -0
  487. package/tsconfig.build.json +10 -0
  488. package/tsconfig.json +5 -0
package/LICENSE.md ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015-present, Alibaba Group Holding Limited. All rights reserved.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1 @@
1
+ # @designable/core
@@ -0,0 +1 @@
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).Designable=t.Designable||{},t.Designable.Core={}))}(this,function(t){"use strict";var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},e(t,n)};function n(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}var o=function(){return o=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},o.apply(this,arguments)};function r(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],o=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&o>=t.length&&(t=void 0),{value:t&&t[o++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function i(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,r,i=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(t){r={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return s}function s(t,e,n){if(n||2===arguments.length)for(var o,r=0,i=e.length;r<i;r++)!o&&r in e||(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var a=function(t){return function(e){return null!=e&&(Array.isArray(t)?t:[t]).some(function(t){return c(e)==="[object ".concat(t,"]")})}},c=function(t){return Object.prototype.toString.call(t)},l=a(["Function","AsyncFunction","GeneratorFunction"]),u=a("Window"),d=Array.isArray,h=a("Object"),p=a("String"),f=a("Number"),v=function(t){return!isNaN(t)&&f(t)},g=Symbol("UNSUBSCRIBE_ID_SYMBOL"),y=function(){function t(){var t=this;this.subscribers={index:0},this.unsubscribe=function(e){if(null!=e)l(e)?delete t.subscribers[e[g]]:delete t.subscribers[e];else for(var n in t.subscribers)t.unsubscribe(n)}}return t.prototype.dispatch=function(t,e){var n=!1;for(var o in this.subscribers)l(this.subscribers[o])&&(t.context=e,!1===this.subscribers[o](t)&&(n=!0));return!n},t.prototype.subscribe=function(t){var e,n=this;l(t)&&(e=this.subscribers.index+1,this.subscribers[e]=t,this.subscribers.index++);var o=function(){n.unsubscribe(e)};return o[g]=e,o},t}();var m=function(){try{if("undefined"!=typeof self)return self}catch(t){}try{if(void 0!==m)return m}catch(t){}try{if("undefined"!=typeof global)return global}catch(t){}return Function("return this")()}(),b=Symbol("ATTACHED_SYMBOL"),w=Symbol("__EVENTS_SYMBOL__"),E=Symbol("EVENTS_ONCE_SYMBOL"),S=Symbol("EVENTS_BATCH_SYMBOL"),C=Symbol("DRIVER_INSTANCES_SYMBOL"),R=function(t){return"onlyOne"===t||"onlyChild"===t||"onlyParent"===t},N=function(){function t(t,e){this.container=document,this.contentWindow=m,this.engine=t,this.context=e}return t.prototype.dispatch=function(t){return this.engine.dispatch(t,this.context)},t.prototype.subscribe=function(t){return this.engine.subscribe(t)},t.prototype.subscribeTo=function(t,e){return this.engine.subscribeTo(t,e)},t.prototype.subscribeWith=function(t,e){return this.engine.subscribeWith(t,e)},t.prototype.attach=function(t){console.error("attach must implement.")},t.prototype.detach=function(t){console.error("attach must implement.")},t.prototype.eventTarget=function(t){var e;return"resize"!==t&&"scroll"!==t||this.container!==(null===(e=this.contentWindow)||void 0===e?void 0:e.document)?this.container:this.contentWindow},t.prototype.addEventListener=function(t,e,n){var o,r,i,s,a=this.eventTarget(t);if(R(null==n?void 0:n.mode)){a[E]=a[E]||{};var c=this.constructor;c[E]=c[E]||{};var l=a[E][t],u=c[E][t];if(!l){if(u)if("onlyChild"===n.mode)u.contains(a)&&(u.removeEventListener(t,u[E][t],n),delete u[E][t]);else if("onlyParent"===n.mode&&u.contains(a))return;a.addEventListener(t,e,n),a[E][t]=e,c[E][t]=a}}else a[w]=a[w]||{},a[w][t]=a[w][t]||new Map,(null===(r=null===(o=a[w][t])||void 0===o?void 0:o.get)||void 0===r?void 0:r.call(o,e))||(a.addEventListener(t,e,n),null===(s=null===(i=a[w][t])||void 0===i?void 0:i.set)||void 0===s||s.call(i,e,!0))},t.prototype.removeEventListener=function(t,e,n){var o,r,i=this.eventTarget(t);if(R(null==n?void 0:n.mode)){var s=this.constructor;s[E]=s[E]||{},i[E]=i[E]||{},delete s[E][t],delete i[E][t],i.removeEventListener(t,e,n)}else i[w]=i[w]||{},i[w][t]=i[w][t]||new Map,null===(r=null===(o=i[w][t])||void 0===o?void 0:o.delete)||void 0===r||r.call(o,e),i.removeEventListener(t,e,n)},t.prototype.batchAddEventListener=function(t,e,n){this.engine[C]=this.engine[C]||[],this.engine[C].includes(this)||this.engine[C].push(this),this.engine[C].forEach(function(o){var r=o.eventTarget(t);r[S]=r[S]||{},r[S][t]||(r.addEventListener(t,e,n),r[S][t]=e)})},t.prototype.batchRemoveEventListener=function(t,e,n){this.engine[C]=this.engine[C]||[],this.engine[C].forEach(function(o){var r=o.eventTarget(t);r[S]=r[S]||{},r.removeEventListener(t,e,n),delete r[S][t]})},t}(),x=function(t){function e(e){var n=t.call(this)||this;return n.drivers=[],n.containers=[],d(null==e?void 0:e.effects)&&e.effects.forEach(function(t){t(n)}),d(null==e?void 0:e.drivers)&&(n.drivers=e.drivers),n}return n(e,t),e.prototype.subscribeTo=function(t,e){return this.subscribe(function(n){if(t&&n instanceof t)return e(n)})},e.prototype.subscribeWith=function(t,e){return this.subscribe(function(n){if(d(t)){if(t.includes(null==n?void 0:n.type))return e(n)}else if(t&&(null==n?void 0:n.type)===t)return e(n)})},e.prototype.attachEvents=function(t,e,n){var o=this;if(void 0===e&&(e=m),t)return u(t)?this.attachEvents(t.document,t,n):void(t[b]||(t[b]=this.drivers.map(function(r){var i=new r(o,n);return i.contentWindow=e,i.container=t,i.attach(t),i}),this.containers.includes(t)||this.containers.push(t)))},e.prototype.detachEvents=function(t){var e=this;if(t)return u(t)?this.detachEvents(t.document):void(t[b]&&(t[b].forEach(function(e){e.detach(t)}),this[C]=this[C]||[],this[C]=this[C].reduce(function(e,n){return n.container===t?(n.detach(t),e):e.concat(n)},[]),this.containers=this.containers.filter(function(e){return e!==t}),delete t[b],delete t[w],delete t[E],delete t[S]));this.containers.forEach(function(t){e.detachEvents(t)})},e}(y),k=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=1/0),e>=t?(e-t)/e:0},P=function(t,e,n,o){void 0===o&&(o=80);var r,i,s,a,c=n.left,l=n.right,u=n.top,d=n.bottom,h=t.x,p=t.y;"x"===e?(r=c,i=l,s=h):(r=u,i=d,s=p);var f=i-r,v=f>400?100:f/3;return i-s<v?{direction:"end",speedFactor:a,speed:o*k(i-s,v)}:s-r<v?{direction:"begin",speedFactor:a,speed:o*k(s-r,v)}:null},T=function(t,e,n,o,r){return function(t,e){void 0===t&&(t=10);var n=null,o=null,r=function(){n||(n=requestAnimationFrame(function(i){null===o&&(o=i),e((i-o)/1e3*t),n=null,r()}))};return r(),function(){n&&(cancelAnimationFrame(n),n=null),o=null}}(o,function(o){!function(t,e,n,o){if(t)if(u(t))"x"===e?t.scrollBy({left:n,behavior:"smooth"}):t.scrollBy({top:n,behavior:"smooth"}),l(o)&&o(n);else if("x"===e){if(t.scrollLeft+n>t.scrollWidth)return;t.scrollLeft+=n,l(o)&&o(t.scrollLeft)}else{if(t.scrollTop+n>t.scrollHeight)return;t.scrollTop+=n,l(o)&&o(t.scrollTop)}}(t,e,"begin"===n?0-o:o,r)})};function D(t){return v(null==t?void 0:t.x)&&v(null==t?void 0:t.y)}function O(t){return D(null==t?void 0:t.start)&&D(null==t?void 0:t.end)}var A,F=function(t,e){this.x=t,this.y=e},M=function(){function t(t,e,n,o){this.x=0,this.y=0,this.width=0,this.height=0,this.x=t,this.y=e,this.width=n,this.height=o}return Object.defineProperty(t.prototype,"left",{get:function(){return this.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this.x+this.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this.y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!1,configurable:!0}),t}(),I=function(t,e){this.start=o({},t),this.end=o({},e)};function L(t,e,n){void 0===n&&(n=!0);var o=function(t){if(!n)return 0;var e=.1*t;return e>20?20:e<10?10:e};return t.x>=e.x+o(e.width)&&t.x<=e.x+e.width-o(e.width)&&t.y>=e.y+o(e.height)&&t.y<=e.y+e.height-o(e.height)}function B(t,e){var n=i(function(t){return[new F(t.x,t.y),new F(t.x+t.width,t.y),new F(t.x+t.width,t.y+t.height),new F(t.x,t.y+t.height)]}(t),4),o=n[0],r=n[1],s=n[2],a=n[3];return L(o,e,!1)&&L(r,e,!1)&&L(s,e,!1)&&L(a,e,!1)}function W(t){if((null==t?void 0:t.length)&&(1!==(null==t?void 0:t.length)||t[0])){var e=1/0,n=-1/0,o=1/0,r=-1/0;return t.forEach(function(t){var i=new M(t.x,t.y,t.width,t.height);i.top<=e&&(e=i.top),i.bottom>=n&&(n=i.bottom),i.left<=o&&(o=i.left),i.right>=r&&(r=i.right)}),new M(o,e,r-o,n-e)}}function z(t){return{v:[new I(new F(t.x,t.y),new F(t.x,t.y+t.height)),new I(new F(t.x+t.width/2,t.y),new F(t.x+t.width/2,t.y+t.height)),new I(new F(t.x+t.width,t.y),new F(t.x+t.width,t.y+t.height))],h:[new I(new F(t.x,t.y),new F(t.x+t.width,t.y)),new I(new F(t.x,t.y+t.height/2),new F(t.x+t.width,t.y+t.height/2)),new I(new F(t.x,t.y+t.height),new F(t.x+t.width,t.y+t.height))]}}function j(t,e){var n,o={x:[(n=e).x,n.x+n.width/2,n.x+n.width],y:[n.y,n.y+n.height/2,n.y+n.height]};if(t.start.x===t.end.x)return{x:r(o.x,t.start.x)-e.x,y:0};function r(t,e){for(var n=1/0,o=-1,r=0;r<t.length;r++){var i=Math.abs(t[r]-e);n>i&&(n=i,o=r)}return t[o]}return{x:0,y:r(o.y,t.start.y)-e.y}}function K(t,e){var n,o,r,i,s=1/0;if((null===(n=null==t?void 0:t.start)||void 0===n?void 0:n.y)===(null===(o=null==t?void 0:t.end)||void 0===o?void 0:o.y))e.h.forEach(function(e){var n=Math.abs(e.start.y-t.start.y);n<s&&(s=n)});else{if((null===(r=null==t?void 0:t.start)||void 0===r?void 0:r.x)!==(null===(i=null==t?void 0:t.end)||void 0===i?void 0:i.x))throw new Error("can not calculate slash distance");e.v.forEach(function(e){var n=Math.abs(e.start.x-t.start.x);n<s&&(s=n)})}return s}!function(t){t.Inner1="I1",t.Inner2="I2",t.Inner3="I3",t.Inner4="I4",t.Outer1="O1",t.Outer2="O2",t.Outer3="O3",t.Outer4="O4"}(A||(A={}));for(var X=36,Y="";X--;)Y+=X.toString(36);function V(t){for(var e="",n=11;n--;)e+=Y[36*Math.random()|0];return e}var U=Symbol("newer"),_=Symbol("older");function q(t,e){this.key=t,this.value=e,this[U]=void 0,this[_]=void 0}!function(){function t(t,e){"number"!=typeof t&&(e=t,t=0),this.size=0,this.limit=t,this.oldest=this.newest=void 0,this._keymap=new Map,e&&(this.assign(e),t<1&&(this.limit=this.size))}t.prototype._markEntryAsUsed=function(t){t!==this.newest&&(t[U]&&(t===this.oldest&&(this.oldest=t[U]),t[U][_]=t[_]),t[_]&&(t[_][U]=t[U]),t[U]=void 0,t[_]=this.newest,this.newest&&(this.newest[U]=t),this.newest=t)},t.prototype.assign=function(t){var e,n=this.limit||Number.MAX_VALUE;this._keymap.clear();for(var o=t[Symbol.iterator](),r=o.next();!r.done;r=o.next()){var i=new q(r.value[0],r.value[1]);if(this._keymap.set(i.key,i),e?(e[U]=i,i[_]=e):this.oldest=i,e=i,0===n--)throw new Error("overflow")}this.newest=e,this.size=this._keymap.size},t.prototype.get=function(t){var e=this._keymap.get(t);if(e)return this._markEntryAsUsed(e),e.value},t.prototype.set=function(t,e){var n=this._keymap.get(t);return n?(n.value=e,this._markEntryAsUsed(n),this):(this._keymap.set(t,n=new q(t,e)),this.newest?(this.newest[U]=n,n[_]=this.newest):this.oldest=n,this.newest=n,++this.size,this.size>this.limit&&this.shift(),this)},t.prototype.shift=function(){var t=this.oldest;if(t)return this.oldest[U]?(this.oldest=this.oldest[U],this.oldest[_]=void 0):(this.oldest=void 0,this.newest=void 0),t[U]=t[_]=void 0,this._keymap.delete(t.key),--this.size,[t.key,t.value]},t.prototype.find=function(t){var e=this._keymap.get(t);return e?e.value:void 0},t.prototype.has=function(t){return this._keymap.has(t)},t.prototype.delete=function(t){var e=this._keymap.get(t);if(e)return this._keymap.delete(e.key),e[U]&&e[_]?(e[_][U]=e[U],e[U][_]=e[_]):e[U]?(e[U][_]=void 0,this.oldest=e[U]):e[_]?(e[_][U]=void 0,this.newest=e[_]):this.oldest=this.newest=void 0,this.size--,e.value},t.prototype.clear=function(){this.oldest=this.newest=void 0,this.size=0,this._keymap.clear()},t.prototype.keys=function(){return new $(this.oldest)},t.prototype.values=function(){return new Z(this.oldest)},t.prototype.entries=function(){},t.prototype.forEach=function(t,e){"object"!=typeof e&&(e=this);for(var n=this.oldest;n;)t.call(e,n.value,n.key,this),n=n[U]},t.prototype.toJSON=function(){for(var t=new Array(this.size),e=0,n=this.oldest;n;)t[e++]={key:n.key,value:n.value},n=n[U];return t},t.prototype.toString=function(){for(var t="",e=this.oldest;e;)t+=String(e.key)+":"+e.value,(e=e[U])&&(t+=" < ");return t},t.prototype[Symbol.iterator]=function(){return new G(this.oldest)}}();var H,G=function(){function t(t){this.entry=t}return t.prototype[Symbol.iterator]=function(){return this},t.prototype.next=function(){var t=this.entry;return t?(this.entry=t[U],{done:!1,value:[t.key,t.value]}):{done:!0,value:void 0}},t}(),$=function(){function t(t){this.entry=t}return t.prototype[Symbol.iterator]=function(){return this},t.prototype.next=function(){var t=this.entry;return t?(this.entry=t[U],{done:!1,value:t.key}):{done:!0,value:void 0}},t}(),Z=function(){function t(t){this.entry=t}return t.prototype[Symbol.iterator]=function(){return this},t.prototype.next=function(){var t=this.entry;return t?(this.entry=t[U],{done:!1,value:t.value}):{done:!0,value:void 0}},t}();function J(t,e,n){if(d(t)||p(t)){for(var o=0;o<t.length;o++)if(!1===e(t[o],o))return}else if(function(t){return"object"==typeof t}(t)){var r=void 0;for(r in t)if(Object.hasOwnProperty.call(t,r)&&!1===e(t[r],r))return}}t.KeyCode=void 0,(H=t.KeyCode||(t.KeyCode={})).Backspace="Backspace",H.Tab="Tab",H.Enter="Enter",H.Shift="Shift",H.Control="Control",H.Alt="Alt",H.CapsLock="CapsLock",H.Escape="Escape",H.Space=" ",H.PageUp="PageUp",H.PageDown="PageDown",H.End="End",H.Home="Home",H.ArrowLeft="ArrowLeft",H.ArrowUp="ArrowUp",H.ArrowRight="ArrowRight",H.ArrowDown="ArrowDown",H.Left="Left",H.Up="Up",H.Right="Right",H.Down="Down",H.Insert="Insert",H.Delete="Delete",H.Zero="0",H.ClosedParen=")",H.One="1",H.ExclamationMark="!",H.Two="2",H.AtSign="@",H.Three="3",H.PoundSign="£",H.Hash="#",H.Four="4",H.DollarSign="$",H.Five="5",H.PercentSign="%",H.Six="6",H.Caret="^",H.Hat="^",H.Seven="7",H.Ampersand="&",H.Eight="8",H.Star="*",H.Asterisk="*",H.Nine="9",H.OpenParen="(",H.a="a",H.b="b",H.c="c",H.d="d",H.e="e",H.f="f",H.g="g",H.h="h",H.i="i",H.j="j",H.k="k",H.l="l",H.m="m",H.n="n",H.o="o",H.p="p",H.q="q",H.r="r",H.s="s",H.t="t",H.u="u",H.v="v",H.w="w",H.x="x",H.y="y",H.z="z",H.A="A",H.B="B",H.C="C",H.D="D",H.E="E",H.F="F",H.G="G",H.H="H",H.I="I",H.J="J",H.K="K",H.L="L",H.M="M",H.N="N",H.O="O",H.P="P",H.Q="Q",H.R="R",H.S="S",H.T="T",H.U="U",H.V="V",H.W="W",H.X="X",H.Y="Y",H.Z="Z",H.Meta="Meta",H.LeftWindowKey="Meta",H.RightWindowKey="Meta",H.Numpad0="0",H.Numpad1="1",H.Numpad2="2",H.Numpad3="3",H.Numpad4="4",H.Numpad5="5",H.Numpad6="6",H.Numpad7="7",H.Numpad8="8",H.Numpad9="9",H.Multiply="*",H.Add="+",H.Subtract="-",H.DecimalPoint=".",H.MSDecimalPoint="Decimal",H.Divide="/",H.F1="F1",H.F2="F2",H.F3="F3",H.F4="F4",H.F5="F5",H.F6="F6",H.F7="F7",H.F8="F8",H.F9="F9",H.F10="F10",H.F11="F11",H.F12="F12",H.NumLock="NumLock",H.ScrollLock="ScrollLock",H.SemiColon=";",H.Equals="=",H.Comma=",",H.Dash="-",H.Period=".",H.UnderScore="_",H.PlusSign="+",H.ForwardSlash="/",H.Tilde="~",H.GraveAccent="`",H.OpenBracket="[",H.ClosedBracket="]",H.Quote="'";var Q,tt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},et={exports:{}};Q||(Q=1,function(t){var e;e=function(){var t,e,n,o,r,i,s,a,c="undefined"!=typeof window?window:null!=typeof tt?tt:this||{},l=c.cancelRequestAnimationFrame&&c.requestAnimationFrame||setTimeout,u=c.cancelRequestAnimationFrame||clearTimeout,d=[],h=0,p=!1,f=7,v=35,g=125,y=0,m=0,b=0,w={get didTimeout(){return!1},timeRemaining:function(){var t=f-(Date.now()-m);return t<0?0:t}},E=(r=function(){f=22,g=66,v=0},a=function(){var t=Date.now()-s;t<99?i=setTimeout(a,99-t):(i=null,r())},function(){s=Date.now(),i||(i=setTimeout(a,99))});function S(){125!=g&&(f=7,g=125,v=35,p&&(p&&(o&&u(o),n&&clearTimeout(n),p=!1),N())),E()}function C(){o=null,n=setTimeout(x,0)}function R(){n=null,l(C)}function N(){p||(e=g-(Date.now()-m),t=Date.now(),p=!0,v&&e<v&&(e=v),e>9?n=setTimeout(R,e):(e=0,R()))}function x(){var o,r,i,s=f>9?9:1;if(m=Date.now(),p=!1,n=null,h>2||m-e-50<t)for(r=0,i=d.length;r<i&&w.timeRemaining()>s;r++)o=d.shift(),b++,o&&o(w);d.length?N():h=0}function k(t){return y++,d.push(t),N(),y}function P(t){var e=t-1-b;d[e]&&(d[e]=null)}if(c.requestIdleCallback&&c.cancelIdleCallback)try{c.requestIdleCallback(function(){},{timeout:0})}catch(t){!function(t){var e,n;if(c.requestIdleCallback=function(e,n){return n&&"number"==typeof n.timeout?t(e,n.timeout):t(e)},c.IdleCallbackDeadline&&(e=IdleCallbackDeadline.prototype)){if(!(n=Object.getOwnPropertyDescriptor(e,"timeRemaining"))||!n.configurable||!n.get)return;Object.defineProperty(e,"timeRemaining",{value:function(){return n.get.call(this)},enumerable:!0,configurable:!0})}}(c.requestIdleCallback)}else c.requestIdleCallback=k,c.cancelIdleCallback=P,c.document&&document.addEventListener&&(c.addEventListener("scroll",S,!0),c.addEventListener("resize",S),document.addEventListener("focus",S,!0),document.addEventListener("mouseover",S,!0),["click","keypress","touchstart","mousedown"].forEach(function(t){document.addEventListener(t,S,{capture:!0,passive:!0})}),c.MutationObserver&&new MutationObserver(S).observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0}));return{request:k,cancel:P}},t.exports?t.exports=e():window.idleCallbackShim=e()}(et));var nt,ot=function(t,e){return m.requestIdleCallback(t,e)},rt=function(t){m.cancelIdleCallback(t)},it=new Set(["A","ABBR","ACRONYM","AUDIO","B","BDI","BDO","BIG","BR","BUTTON","CANVAS","CITE","CODE","DATA","DATALIST","DEL","DFN","EM","EMBED","I","IFRAME","IMG","INS","KBD","LABEL","MAP","MARK","METER","NOSCRIPT","OBJECT","OUTPUT","PICTURE","PROGRESS","Q","RUBY","S","SAMP","SELECT","SLOT","SMALL","STRONG","SUB","SUP","SVG","TEMPLATE","TEXTAREA","TIME","U","TT","VAR","VIDEO","WBR","INPUT","SPAN"]),st=function(t){if(!t)return"vertical";var e=t.parentElement;if(!e)return"vertical";var n=t.tagName,o=e.tagName,r=getComputedStyle(t),i=getComputedStyle(e),s=function(){var n=function(t,e){return t+parseFloat(e.marginLeft)+parseFloat(e.marginRight)+parseFloat(e.paddingLeft)+parseFloat(e.paddingRight)+parseFloat(e.borderLeftWidth)+parseFloat(e.borderRightWidth)}(t.getBoundingClientRect().width,r),o=e.getBoundingClientRect().width;return n.toFixed(0)<o.toFixed(0)};return"TH"!==n&&"TD"!==n||"TR"!==o?"flex"===i.display&&"row"===i.flexDirection||"grid"===i.display&&s()?"horizontal":it.has(n)?"block"===r.display&&("left"!==r.float&&"right"!==r.float||!s())?"vertical":"horizontal":void 0:"horizontal"},at=function(){function t(t){this.data=t||{clientX:0,clientY:0,pageX:0,pageY:0,target:null,view:m},this.transformCoordinates()}return t.prototype.transformCoordinates=function(){var t,e=((null===(t=this.data)||void 0===t?void 0:t.view)||{}).frameElement;if(e&&this.data.view!==m){var n=e.getBoundingClientRect(),o=n.width/e.offsetWidth;this.data.topClientX=this.data.clientX*o+n.x,this.data.topClientY=this.data.clientY*o+n.y,this.data.topPageX=this.data.pageX+n.x-this.data.view.scrollX,this.data.topPageY=this.data.pageY+n.y-this.data.view.scrollY;var r=document.elementFromPoint(this.data.topPageX,this.data.topClientY);r!==e&&(this.data.target=r)}else this.data.topClientX=this.data.clientX,this.data.topClientY=this.data.clientY,this.data.topPageX=this.data.pageX,this.data.topPageY=this.data.pageY},t}(),ct=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.type="drag:move",e}return n(e,t),e}(at),lt=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.type="drag:start",e}return n(e,t),e}(at),ut=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.type="drag:stop",e}return n(e,t),e}(at),dt=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.type="mouse:click",e}return n(e,t),e}(at),ht=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.type="mouse:dblclick",e}return n(e,t),e}(at),pt=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.type="mouse:move",e}return n(e,t),e}(at),ft=function(){function t(t){this.data=t.key,this.originEvent=t}return Object.defineProperty(t.prototype,"eventType",{get:function(){return this.originEvent.type},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ctrlKey",{get:function(){return this.originEvent.ctrlKey},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shiftKey",{get:function(){return this.originEvent.shiftKey},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"metaKey",{get:function(){return this.originEvent.metaKey},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"altkey",{get:function(){return this.originEvent.altKey},enumerable:!1,configurable:!0}),t.prototype.preventDefault=function(){this.originEvent.preventDefault?this.originEvent.preventDefault():this.originEvent.returnValue=!1},t.prototype.stopPropagation=function(){var t;(null===(t=this.originEvent)||void 0===t?void 0:t.stopPropagation)?this.originEvent.stopPropagation():this.originEvent.cancelBubble=!0},t}(),vt=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.type="key:down",e}return n(e,t),e}(ft),gt=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.type="key:up",e}return n(e,t),e}(ft),yt=function(t){this.data=t},mt=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.type="drag:node",e}return n(e,t),e}(yt),bt=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.type="drop:node",e}return n(e,t),e}(yt),wt=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.type="hover:node",e}return n(e,t),e}(yt),Et=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.type="insert:after",e}return n(e,t),e}(yt),St=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.type="insert:before",e}return n(e,t),e}(yt),Ct=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.type="insert:children",e}return n(e,t),e}(yt),Rt=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.type="prepend:node",e}return n(e,t),e}(yt),Nt=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.type="remove:node",e}return n(e,t),e}(yt),xt=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.type="select:node",e}return n(e,t),e}(yt),kt=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.type="unselect:node",e}return n(e,t),e}(yt),Pt=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.type="update:children",e}return n(e,t),e}(yt),Tt=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.type="update:node:props",e}return n(e,t),e}(yt),Dt=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.type="wrap:node",e}return n(e,t),e}(yt),Ot=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.type="clone:node",e}return n(e,t),e}(yt),At=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.type="append:node",e}return n(e,t),e}(yt),Ft=function(t){this.type="from:node",this.data=t},Mt=function(t){this.data=t||{scrollX:m.scrollX,scrollY:m.scrollY,width:m.innerWidth,height:m.innerHeight,innerWidth:m.innerWidth,innerHeight:m.innerHeight,view:m,target:m}},It=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.type="viewport:resize",e}return n(e,t),e}(Mt),Lt=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.type="viewport:scroll",e}return n(e,t),e}(Mt),Bt=function(t){this.data=t},Wt=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.type="add:workspace",e}return n(e,t),e}(Bt),zt=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.type="remove:workspace",e}return n(e,t),e}(Bt),jt=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.type="switch:workspace",e}return n(e,t),e}(Bt),Kt=function(t){this.data=t},Xt=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.type="history:undo",e}return n(e,t),e}(Kt),Yt=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.type="history:redo",e}return n(e,t),e}(Kt),Vt=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.type="history:goto",e}return n(e,t),e}(Kt),Ut=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.type="history:push",e}return n(e,t),e}(Kt),_t={dragging:!1,onMouseDownAt:0,startEvent:null,moveEvent:null},qt=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.mouseDownTimer=null,e.onMouseDown=function(t){var n,o;if(0===t.button&&!t.ctrlKey&&!t.metaKey)return!(!t.target.isContentEditable&&"true"!==t.target.contentEditable)||void((null===(o=null===(n=t.target)||void 0===n?void 0:n.closest)||void 0===o?void 0:o.call(n,".monaco-editor"))||(_t.startEvent=t,_t.dragging=!1,_t.onMouseDownAt=Date.now(),e.batchAddEventListener("mouseup",e.onMouseUp),e.batchAddEventListener("dragend",e.onMouseUp),e.batchAddEventListener("dragstart",e.onStartDrag),e.batchAddEventListener("mousemove",e.onDistanceChange)))},e.onMouseUp=function(t){_t.dragging&&e.dispatch(new ut({clientX:t.clientX,clientY:t.clientY,pageX:t.pageX,pageY:t.pageY,target:t.target,view:t.view})),e.batchRemoveEventListener("contextmenu",e.onContextMenuWhileDragging,!0),e.batchRemoveEventListener("mouseup",e.onMouseUp),e.batchRemoveEventListener("mousedown",e.onMouseDown),e.batchRemoveEventListener("dragover",e.onMouseMove),e.batchRemoveEventListener("mousemove",e.onMouseMove),e.batchRemoveEventListener("mousemove",e.onDistanceChange),_t.dragging=!1},e.onMouseMove=function(t){var n,o;t.clientX===(null===(n=_t.moveEvent)||void 0===n?void 0:n.clientX)&&t.clientY===(null===(o=_t.moveEvent)||void 0===o?void 0:o.clientY)||(e.dispatch(new ct({clientX:t.clientX,clientY:t.clientY,pageX:t.pageX,pageY:t.pageY,target:t.target,view:t.view})),_t.moveEvent=t)},e.onContextMenuWhileDragging=function(t){t.preventDefault()},e.onStartDrag=function(t){_t.dragging||(_t.startEvent=_t.startEvent||t,e.batchAddEventListener("dragover",e.onMouseMove),e.batchAddEventListener("mousemove",e.onMouseMove),e.batchAddEventListener("contextmenu",e.onContextMenuWhileDragging,!0),e.dispatch(new lt({clientX:_t.startEvent.clientX,clientY:_t.startEvent.clientY,pageX:_t.startEvent.pageX,pageY:_t.startEvent.pageY,target:_t.startEvent.target,view:_t.startEvent.view})),_t.dragging=!0)},e.onDistanceChange=function(t){var n=Math.sqrt(Math.pow(t.pageX-_t.startEvent.pageX,2)+Math.pow(t.pageY-_t.startEvent.pageY,2));Date.now()-_t.onMouseDownAt>10&&t!==_t.startEvent&&n>4&&(e.batchRemoveEventListener("mousemove",e.onDistanceChange),e.onStartDrag(t))},e}return n(e,t),e.prototype.attach=function(){this.batchAddEventListener("mousedown",this.onMouseDown,!0)},e.prototype.detach=function(){_t.dragging=!1,_t.moveEvent=null,_t.onMouseDownAt=null,_t.startEvent=null,this.batchRemoveEventListener("mousedown",this.onMouseDown,!0),this.batchRemoveEventListener("dragstart",this.onStartDrag),this.batchRemoveEventListener("dragend",this.onMouseUp),this.batchRemoveEventListener("dragover",this.onMouseMove),this.batchRemoveEventListener("mouseup",this.onMouseUp),this.batchRemoveEventListener("mousemove",this.onMouseMove),this.batchRemoveEventListener("mousemove",this.onDistanceChange),this.batchRemoveEventListener("contextmenu",this.onContextMenuWhileDragging,!0)},e}(N),Ht=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.onMouseClick=function(t){var n=t.target;(null==n?void 0:n.closest("*[".concat(e.engine.props.clickStopPropagationAttrName,"]")))||e.dispatch(new dt({clientX:t.clientX,clientY:t.clientY,pageX:t.pageX,pageY:t.pageY,target:t.target,view:t.view}))},e.onMouseDoubleClick=function(t){var n=t.target;(null==n?void 0:n.closest("*[".concat(e.engine.props.clickStopPropagationAttrName,"]")))||e.dispatch(new ht({clientX:t.clientX,clientY:t.clientY,pageX:t.pageX,pageY:t.pageY,target:t.target,view:t.view}))},e}return n(e,t),e.prototype.attach=function(){this.addEventListener("click",this.onMouseClick,{mode:"onlyChild"}),this.addEventListener("dblclick",this.onMouseDoubleClick,{mode:"onlyChild"})},e.prototype.detach=function(){this.removeEventListener("click",this.onMouseClick,{mode:"onlyChild"}),this.removeEventListener("dblclick",this.onMouseDoubleClick,{mode:"onlyChild"})},e}(N),Gt=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.request=null,e.onMouseMove=function(t){e.request=requestAnimationFrame(function(){cancelAnimationFrame(e.request),e.dispatch(new pt({clientX:t.clientX,clientY:t.clientY,pageX:t.pageX,pageY:t.pageY,target:t.target,view:t.view}))})},e}return n(e,t),e.prototype.attach=function(){this.addEventListener("mousemove",this.onMouseMove,{mode:"onlyOne"})},e.prototype.detach=function(){this.removeEventListener("mouseover",this.onMouseMove,{mode:"onlyOne"})},e}(N),$t=[],Zt=function(){return $t.some(function(t){return t.activeTargets.length>0})},Jt="ResizeObserver loop completed with undelivered notifications.";!function(t){t.BORDER_BOX="border-box",t.CONTENT_BOX="content-box",t.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"}(nt||(nt={}));var Qt,te=function(t){return Object.freeze(t)},ee=function(t,e){this.inlineSize=t,this.blockSize=e,te(this)},ne=function(){function t(t,e,n,o){return this.x=t,this.y=e,this.width=n,this.height=o,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,te(this)}return t.prototype.toJSON=function(){var t=this;return{x:t.x,y:t.y,top:t.top,right:t.right,bottom:t.bottom,left:t.left,width:t.width,height:t.height}},t.fromRect=function(e){return new t(e.x,e.y,e.width,e.height)},t}(),oe=function(t){return t instanceof SVGElement&&"getBBox"in t},re=function(t){if(oe(t)){var e=t.getBBox(),n=e.width,o=e.height;return!n&&!o}var r=t,i=r.offsetWidth,s=r.offsetHeight;return!(i||s||t.getClientRects().length)},ie=function(t){var e;if(t instanceof Element)return!0;var n=null===(e=null==t?void 0:t.ownerDocument)||void 0===e?void 0:e.defaultView;return!!(n&&t instanceof n.Element)},se="undefined"!=typeof window?window:{},ae=new WeakMap,ce=/auto|scroll/,le=/^tb|vertical/,ue=/msie|trident/i.test(se.navigator&&se.navigator.userAgent),de=function(t){return parseFloat(t||"0")},he=function(t,e,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=!1),new ee((n?e:t)||0,(n?t:e)||0)},pe=te({devicePixelContentBoxSize:he(),borderBoxSize:he(),contentBoxSize:he(),contentRect:new ne(0,0,0,0)}),fe=function(t,e){if(void 0===e&&(e=!1),ae.has(t)&&!e)return ae.get(t);if(re(t))return ae.set(t,pe),pe;var n=getComputedStyle(t),o=oe(t)&&t.ownerSVGElement&&t.getBBox(),r=!ue&&"border-box"===n.boxSizing,i=le.test(n.writingMode||""),s=!o&&ce.test(n.overflowY||""),a=!o&&ce.test(n.overflowX||""),c=o?0:de(n.paddingTop),l=o?0:de(n.paddingRight),u=o?0:de(n.paddingBottom),d=o?0:de(n.paddingLeft),h=o?0:de(n.borderTopWidth),p=o?0:de(n.borderRightWidth),f=o?0:de(n.borderBottomWidth),v=d+l,g=c+u,y=(o?0:de(n.borderLeftWidth))+p,m=h+f,b=a?t.offsetHeight-m-t.clientHeight:0,w=s?t.offsetWidth-y-t.clientWidth:0,E=r?v+y:0,S=r?g+m:0,C=o?o.width:de(n.width)-E-w,R=o?o.height:de(n.height)-S-b,N=C+v+w+y,x=R+g+b+m,k=te({devicePixelContentBoxSize:he(Math.round(C*devicePixelRatio),Math.round(R*devicePixelRatio),i),borderBoxSize:he(N,x,i),contentBoxSize:he(C,R,i),contentRect:new ne(d,c,C,R)});return ae.set(t,k),k},ve=function(t,e,n){var o=fe(t,n),r=o.borderBoxSize,i=o.contentBoxSize,s=o.devicePixelContentBoxSize;switch(e){case nt.DEVICE_PIXEL_CONTENT_BOX:return s;case nt.BORDER_BOX:return r;default:return i}},ge=function(t){var e=fe(t);this.target=t,this.contentRect=e.contentRect,this.borderBoxSize=te([e.borderBoxSize]),this.contentBoxSize=te([e.contentBoxSize]),this.devicePixelContentBoxSize=te([e.devicePixelContentBoxSize])},ye=function(t){if(re(t))return 1/0;for(var e=0,n=t.parentNode;n;)e+=1,n=n.parentNode;return e},me=function(){var t=1/0,e=[];$t.forEach(function(n){if(0!==n.activeTargets.length){var o=[];n.activeTargets.forEach(function(e){var n=new ge(e.target),r=ye(e.target);o.push(n),e.lastReportedSize=ve(e.target,e.observedBox),r<t&&(t=r)}),e.push(function(){n.callback.call(n.observer,o,n.observer)}),n.activeTargets.splice(0,n.activeTargets.length)}});for(var n=0,o=e;n<o.length;n++){(0,o[n])()}return t},be=function(t){$t.forEach(function(e){e.activeTargets.splice(0,e.activeTargets.length),e.skippedTargets.splice(0,e.skippedTargets.length),e.observationTargets.forEach(function(n){n.isActive()&&(ye(n.target)>t?e.activeTargets.push(n):e.skippedTargets.push(n))})})},we=function(){var t,e=0;for(be(e);Zt();)e=me(),be(e);return $t.some(function(t){return t.skippedTargets.length>0})&&("function"==typeof ErrorEvent?t=new ErrorEvent("error",{message:Jt}):((t=document.createEvent("Event")).initEvent("error",!1,!1),t.message=Jt),window.dispatchEvent(t)),e>0},Ee=[],Se=function(t){if(!Qt){var e=0,n=document.createTextNode("");new MutationObserver(function(){return Ee.splice(0).forEach(function(t){return t()})}).observe(n,{characterData:!0}),Qt=function(){n.textContent="".concat(e?e--:e++)}}Ee.push(t),Qt()},Ce=0,Re={attributes:!0,characterData:!0,childList:!0,subtree:!0},Ne=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],xe=function(t){return void 0===t&&(t=0),Date.now()+t},ke=!1,Pe=new(function(){function t(){var t=this;this.stopped=!0,this.listener=function(){return t.schedule()}}return t.prototype.run=function(t){var e=this;if(void 0===t&&(t=250),!ke){ke=!0;var n,o=xe(t);n=function(){var n=!1;try{n=we()}finally{if(ke=!1,t=o-xe(),!Ce)return;n?e.run(1e3):t>0?e.run(t):e.start()}},Se(function(){requestAnimationFrame(n)})}},t.prototype.schedule=function(){this.stop(),this.run()},t.prototype.observe=function(){var t=this,e=function(){return t.observer&&t.observer.observe(document.body,Re)};document.body?e():se.addEventListener("DOMContentLoaded",e)},t.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Ne.forEach(function(e){return se.addEventListener(e,t.listener,!0)}))},t.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),Ne.forEach(function(e){return se.removeEventListener(e,t.listener,!0)}),this.stopped=!0)},t}()),Te=function(t){!Ce&&t>0&&Pe.start(),!(Ce+=t)&&Pe.stop()},De=function(){function t(t,e){this.target=t,this.observedBox=e||nt.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return t.prototype.isActive=function(){var t,e=ve(this.target,this.observedBox,!0);return t=this.target,oe(t)||function(t){switch(t.tagName){case"INPUT":if("image"!==t.type)break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1}(t)||"inline"!==getComputedStyle(t).display||(this.lastReportedSize=e),this.lastReportedSize.inlineSize!==e.inlineSize||this.lastReportedSize.blockSize!==e.blockSize},t}(),Oe=function(t,e){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=e},Ae=new WeakMap,Fe=function(t,e){for(var n=0;n<t.length;n+=1)if(t[n].target===e)return n;return-1},Me=function(){function t(){}return t.connect=function(t,e){var n=new Oe(t,e);Ae.set(t,n)},t.observe=function(t,e,n){var o=Ae.get(t),r=0===o.observationTargets.length;Fe(o.observationTargets,e)<0&&(r&&$t.push(o),o.observationTargets.push(new De(e,n&&n.box)),Te(1),Pe.schedule())},t.unobserve=function(t,e){var n=Ae.get(t),o=Fe(n.observationTargets,e),r=1===n.observationTargets.length;o>=0&&(r&&$t.splice($t.indexOf(n),1),n.observationTargets.splice(o,1),Te(-1))},t.disconnect=function(t){var e=this,n=Ae.get(t);n.observationTargets.slice().forEach(function(n){return e.unobserve(t,n.target)}),n.activeTargets.splice(0,n.activeTargets.length)},t}(),Ie=function(){function t(t){if(0===arguments.length)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if("function"!=typeof t)throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");Me.connect(this,t)}return t.prototype.observe=function(t,e){if(0===arguments.length)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!ie(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");Me.observe(this,t,e)},t.prototype.unobserve=function(t){if(0===arguments.length)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!ie(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");Me.unobserve(this,t)},t.prototype.disconnect=function(){Me.disconnect(this)},t.toString=function(){return"function ResizeObserver () { [polyfill code] }"},t}(),Le=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.request=null,e.resizeObserver=null,e.onResize=function(t){t.preventDefault&&t.preventDefault(),e.request=requestAnimationFrame(function(){cancelAnimationFrame(e.request),e.dispatch(new It({scrollX:e.contentWindow.scrollX,scrollY:e.contentWindow.scrollY,width:e.contentWindow.innerWidth,height:e.contentWindow.innerHeight,innerHeight:e.contentWindow.innerHeight,innerWidth:e.contentWindow.innerWidth,view:e.contentWindow,target:t.target||e.container}))})},e}return n(e,t),e.prototype.attach=function(){this.contentWindow&&this.contentWindow!==m?this.addEventListener("resize",this.onResize):this.container&&this.container!==document&&(this.resizeObserver=new Ie(this.onResize),this.resizeObserver.observe(this.container))},e.prototype.detach=function(){this.contentWindow&&this.contentWindow!==m?this.removeEventListener("resize",this.onResize):this.resizeObserver&&this.container&&this.container!==document&&(this.resizeObserver.unobserve(this.container),this.resizeObserver.disconnect())},e}(N),Be=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.request=null,e.onScroll=function(t){t.preventDefault(),e.request=m.requestAnimationFrame(function(){e.dispatch(new Lt({scrollX:e.contentWindow.scrollX,scrollY:e.contentWindow.scrollY,width:e.contentWindow.document.body.clientWidth,height:e.contentWindow.document.body.clientHeight,innerHeight:e.contentWindow.innerHeight,innerWidth:e.contentWindow.innerWidth,view:e.contentWindow,target:t.target})),cancelAnimationFrame(e.request)})},e}return n(e,t),e.prototype.attach=function(){this.addEventListener("scroll",this.onScroll)},e.prototype.detach=function(){this.removeEventListener("scroll",this.onScroll)},e}(N);var We,ze,je,Ke=function(t){function e(){var e=t.apply(this,s([],i(arguments),!1))||this;return e.onKeyDown=function(t){var n,o,r;(n=t.target,o=n.tagName,r=!0,(n.isContentEditable||("INPUT"===o||"TEXTAREA"===o||"SELECT"===o||customElements.get(o.toLocaleLowerCase()))&&!n.readOnly)&&(r=!1),r)&&e.dispatch(new vt(t))},e.onKeyUp=function(t){e.dispatch(new gt(t))},e}return n(e,t),e.prototype.attach=function(){this.addEventListener("keydown",this.onKeyDown,{mode:"onlyParent"}),this.addEventListener("keyup",this.onKeyUp,{mode:"onlyParent"})},e.prototype.detach=function(){this.removeEventListener("keydown",this.onKeyDown,{mode:"onlyParent"}),this.removeEventListener("keyup",this.onKeyUp,{mode:"onlyParent"})},e}(N),Xe=function(t){return String(t).replace(/\s+/g,"_").toLocaleLowerCase()},Ye=function(t,e){if(h(t)&&h(e))return J(e,function(e,n){var o=Xe(n),r=Ye(t[n]||t[o],e);t[o]=r}),t;if(h(e)){var n=Array.isArray(e)?[]:{};return J(e,function(t,e){var o=Ye(void 0,t);n[Xe(e)]=o}),n}return e},Ve=function(t){var e=Ge.value,n=Xe(t);return He.value[n]?n:(J(He.value,function(t,o){if(o.indexOf(n)>-1||String(n).indexOf(o)>-1)return e=o,!1}),e)},Ue=function(t,e){var n=function(e){return t.includes(e)};J(e,function(o){o&&(qn(o)&&J(o.Behavior,function(o){if(!n(o)){var r=o.name;J(o.extends,function(o){var i=function(t){for(var n in e)for(var o=e[n].Behavior,r=0;r<o.length;r++)if(o[r].name===t)return o[r]}(o);if(!i)throw new Error("No ".concat(o," behavior that ").concat(r," depends on"));n(i)||t.unshift(i)}),t.push(o)}}))})},_e=Formily.Reactive.observable.ref([]),qe=Formily.Reactive.observable.ref({}),He=Formily.Reactive.observable.ref({}),Ge=Formily.Reactive.observable.ref(function(){var t;return m.navigator&&(m.navigator.browserlanguage||(null===(t=m.navigator)||void 0===t?void 0:t.language))||"en"}()),$e={setDesignerLanguage:function(t){Ge.value=t},setDesignerBehaviors:function(t){_e.value=t.reduce(function(t,e){return qn(e)?t.concat(e.Behavior):Hn(e)?t.concat(e):t},[])},getDesignerBehaviors:function(t){return _e.value.filter(function(e){return e.selector(t)})},getDesignerIcon:function(t){return qe[t]},getDesignerLanguage:function(){return Ve(Ge.value)},getDesignerMessage:function(t,e){var n=Ve(Ge.value),o=e?e[n]:He.value[n];if(o)return Formily.Path.Path.getIn(o,Xe(t));for(var r in He.value){var i=Formily.Path.Path.getIn(He.value[r],Xe(t));if(i)return i}},registerDesignerIcons:function(t){Object.assign(qe,t)},registerDesignerLocales:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];t.forEach(function(t){Ye(He.value,t)})},registerDesignerBehaviors:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=[];t.forEach(function(t){Ue(n,t)}),n.length&&(_e.value=n)}},Ze=$e,Je=new Map,Qe=new Map,tn=function(t){t.parent&&(t.parent.children=t.parent.children.filter(function(e){return e!==t}))},en=function(t,e){var n=function(t){t.depth=t.parent?t.parent.depth+1:0,t.children.forEach(n)},o=function(t){t.parent=e,t.root=e.root,n(t)},r=function(t){o(t),en(t.children,t)};return t.map(function(t){var i;return t===e||(e.isSourceNode?r(t):t.isSourceNode?(t=t.clone(e),n(t)):!t.isRoot&&t.isInOperation?(null===(i=t.operation)||void 0===i||i.selection.remove(t),tn(t),o(t)):r(t),Je.has(t.id)||(Je.set(t.id,t),Qe.set(t.componentName,t.designerProps))),t})},nn=function(t,e){return en([t],e)[0]},on=function(){function t(e,n){if(this.depth=0,this.hidden=!1,this.componentName="NO_NAME_COMPONENT",this.sourceName="",this.props={},this.children=[],e instanceof t)return e;this.id=e.id||V(),n?(this.parent=n,this.depth=n.depth+1,this.root=n.root,Je.set(this.id,this)):(this.root=this,this.rootOperation=e.operation,this.isSelfSourceNode=e.isSourceNode||!1,Je.set(this.id,this)),e&&this.from(e),this.makeObservable()}return t.prototype.makeObservable=function(){Formily.Reactive.define(this,{componentName:Formily.Reactive.observable.ref,props:Formily.Reactive.observable,hidden:Formily.Reactive.observable.ref,children:Formily.Reactive.observable.shallow,designerProps:Formily.Reactive.observable.computed,designerLocales:Formily.Reactive.observable.computed,wrap:Formily.Reactive.action,prepend:Formily.Reactive.action,append:Formily.Reactive.action,insertAfter:Formily.Reactive.action,insertBefore:Formily.Reactive.action,remove:Formily.Reactive.action,setProps:Formily.Reactive.action,setChildren:Formily.Reactive.action,setComponentName:Formily.Reactive.action})},Object.defineProperty(t.prototype,"designerProps",{get:function(){var t=this;return Ze.getDesignerBehaviors(this).reduce(function(e,n){return n.designerProps?(Object.assign(e,(o=t,r=n.designerProps,l(r)?r(o):r)),e):e;var o,r},{})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"designerLocales",{get:function(){return Ze.getDesignerBehaviors(this).reduce(function(t,e){return e.designerLocales?(Ye(t,e.designerLocales),t):t},{})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"previous",{get:function(){if(this.parent!==this&&this.parent)return this.parent.children[this.index-1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"next",{get:function(){if(this.parent!==this&&this.parent)return this.parent.children[this.index+1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"siblings",{get:function(){var t=this;return this.parent?this.parent.children.filter(function(e){return e!==t}):[]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"index",{get:function(){return this.parent!==this&&this.parent?this.parent.children.indexOf(this):0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"descendants",{get:function(){return this.children.reduce(function(t,e){return t.concat(e).concat(e.descendants)},[])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isRoot",{get:function(){return this===this.root},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isInOperation",{get:function(){return!!this.operation},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastChild",{get:function(){return this.children[this.children.length-1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"firstChild",{get:function(){return this.children[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isSourceNode",{get:function(){return this.root.isSelfSourceNode},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"operation",{get:function(){var t;return null===(t=this.root)||void 0===t?void 0:t.rootOperation},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"viewport",{get:function(){var t,e;return null===(e=null===(t=this.operation)||void 0===t?void 0:t.workspace)||void 0===e?void 0:e.viewport},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"outline",{get:function(){var t,e;return null===(e=null===(t=this.operation)||void 0===t?void 0:t.workspace)||void 0===e?void 0:e.outline},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"moveLayout",{get:function(){var t;return null===(t=this.viewport)||void 0===t?void 0:t.getValidNodeLayout(this)},enumerable:!1,configurable:!0}),t.prototype.getElement=function(t){var e;return void 0===t&&(t="viewport"),null===(e=this[t])||void 0===e?void 0:e.findElementById(this.id)},t.prototype.getValidElement=function(t){var e;return void 0===t&&(t="viewport"),null===(e=this[t])||void 0===e?void 0:e.getValidNodeElement(this)},t.prototype.getElementRect=function(t){var e;return void 0===t&&(t="viewport"),null===(e=this[t])||void 0===e?void 0:e.getElementRect(this.getElement(t))},t.prototype.getValidElementRect=function(t){var e;return void 0===t&&(t="viewport"),null===(e=this[t])||void 0===e?void 0:e.getValidNodeRect(this)},t.prototype.getElementOffsetRect=function(t){var e;return void 0===t&&(t="viewport"),null===(e=this[t])||void 0===e?void 0:e.getElementOffsetRect(this.getElement(t))},t.prototype.getValidElementOffsetRect=function(t){var e;return void 0===t&&(t="viewport"),null===(e=this[t])||void 0===e?void 0:e.getValidNodeOffsetRect(this)},t.prototype.getPrevious=function(t){return void 0===t&&(t=1),this.parent.children[this.index-t]},t.prototype.getAfter=function(t){return void 0===t&&(t=1),this.parent.children[this.index+t]},t.prototype.getSibling=function(t){return void 0===t&&(t=0),this.parent.children[t]},t.prototype.getParents=function(t){var e=t||this;return(null==e?void 0:e.parent)?[e.parent].concat(this.getParents(e.parent)):[]},t.prototype.getParentByDepth=function(t){void 0===t&&(t=0);var e=this.parent;return(null==e?void 0:e.depth)===t?e:null==e?void 0:e.getParentByDepth(t)},t.prototype.getMessage=function(t){return Ze.getDesignerMessage(t,this.designerLocales)},t.prototype.isMyAncestor=function(t){return t!==this&&this.parent!==t&&t.contains(this)},t.prototype.isMyParent=function(t){return this.parent===t},t.prototype.isMyParents=function(t){return t!==this&&(this.isMyParent(t)||this.isMyAncestor(t))},t.prototype.isMyChild=function(t){return t.isMyParent(this)},t.prototype.isMyChildren=function(t){return t.isMyParents(this)},t.prototype.takeSnapshot=function(t){var e;null===(e=this.operation)||void 0===e||e.snapshot(t)},t.prototype.triggerMutation=function(t,e,n){if(this.operation){var o=this.operation.dispatch(t,e);return this.takeSnapshot(null==t?void 0:t.type),null!=o?o:n}return l(e)?e():n},t.prototype.find=function(t){if(t(this))return this;var e=void 0;return this.eachChildren(function(n){if(t(n))return e=n,!1}),e},t.prototype.findAll=function(t){var e=[];return t(this)&&e.push(this),this.eachChildren(function(n){t(n)&&e.push(n)}),e},t.prototype.distanceTo=function(t){return this.root!==t.root||this.parent!==t.parent?1/0:Math.abs(this.index-t.index)},t.prototype.crossSiblings=function(t){if(this.parent!==t.parent)return[];for(var e=Math.min(this.index,t.index),n=Math.max(this.index,t.index),o=[],r=e+1;r<n;r++)o.push(this.parent.children[r]);return o},t.prototype.allowSibling=function(t){var e,n,o;return!1!==(null===(n=null===(e=this.designerProps)||void 0===e?void 0:e.allowSiblings)||void 0===n?void 0:n.call(e,this,t))&&(null===(o=this.parent)||void 0===o?void 0:o.allowAppend(t))},t.prototype.allowDrop=function(t){return!l(this.designerProps.allowDrop)||this.designerProps.allowDrop(t)},t.prototype.allowAppend=function(t){var e,n,o,r=this;return!!(null===(e=this.designerProps)||void 0===e?void 0:e.droppable)&&(!1!==(null===(o=null===(n=this.designerProps)||void 0===n?void 0:n.allowAppend)||void 0===o?void 0:o.call(n,this,t))&&(!t.some(function(t){return!t.allowDrop(r)})&&(this.root,!0)))},t.prototype.allowClone=function(){var t;return this!==this.root&&(null===(t=this.designerProps.cloneable)||void 0===t||t)},t.prototype.allowDrag=function(){var t;return!(this===this.root&&!this.isSourceNode)&&(null===(t=this.designerProps.draggable)||void 0===t||t)},t.prototype.allowResize=function(){if(this===this.root&&!this.isSourceNode)return!1;var t=this.designerProps.resizable;return!!t&&(t.width&&t.height?["x","y"]:t.width?["x"]:["y"])},t.prototype.allowRotate=function(){},t.prototype.allowRound=function(){},t.prototype.allowScale=function(){},t.prototype.allowTranslate=function(){if(this===this.root&&!this.isSourceNode)return!1;var t=this.designerProps.translatable;return!(!(null==t?void 0:t.x)||!(null==t?void 0:t.y))},t.prototype.allowDelete=function(){var t;return this!==this.root&&(null===(t=this.designerProps.deletable)||void 0===t||t)},t.prototype.findById=function(t){var e;if(t)return this.id===t?this:(null===(e=this.children)||void 0===e?void 0:e.length)>0?Je.get(t):void 0},t.prototype.contains=function(){for(var t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return e.every(function(e){return e===t||(null==e?void 0:e.parent)===t||(null==e?void 0:e.getParentByDepth(t.depth))===t})},t.prototype.eachTree=function(t){var e;l(t)&&(t(this.root),null===(e=this.root)||void 0===e||e.eachChildren(t))},t.prototype.eachChildren=function(t){if(l(t))for(var e=0;e<this.children.length;e++){var n=this.children[e];if(!1===t(n))return;n.eachChildren(t)}},t.prototype.resetNodesParent=function(t,e){var n=this;return en(t.filter(function(t){return t!==n}),e)},t.prototype.setProps=function(t){var e=this;return this.triggerMutation(new Tt({target:this,source:null}),function(){Object.assign(e.props,t)})},t.prototype.setComponentName=function(t){this.componentName=t},t.prototype.prepend=function(){for(var t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(e.some(function(e){return e.contains(t)}))return[];var o=e.map(function(t){return t.parent}),r=this.resetNodesParent(e,this);return r.length?this.triggerMutation(new Rt({originSourceParents:o,target:this,source:r}),function(){return t.children=r.concat(t.children),r},[]):[]},t.prototype.append=function(){for(var t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(e.some(function(e){return e.contains(t)}))return[];var o=e.map(function(t){return t.parent}),r=this.resetNodesParent(e,this);return r.length?this.triggerMutation(new At({originSourceParents:o,target:this,source:r}),function(){return t.children=t.children.concat(r),r},[]):[]},t.prototype.wrap=function(t){var e=this;if(t!==this){var n=this.parent;return this.triggerMutation(new Dt({target:this,source:t}),function(){return nn(e,t),nn(t,n),t})}},t.prototype.insertAfter=function(){for(var t,e=this,n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var r=this.parent;if(n.some(function(t){return t.contains(e)}))return[];if(null===(t=null==r?void 0:r.children)||void 0===t?void 0:t.length){var i=n.map(function(t){return t.parent}),s=this.resetNodesParent(n,r);return s.length?this.triggerMutation(new Et({originSourceParents:i,target:this,source:s}),function(){return r.children=r.children.reduce(function(t,n){return n===e?t.concat([n]).concat(s):t.concat([n])},[]),s},[]):[]}return[]},t.prototype.insertBefore=function(){for(var t,e=this,n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var r=this.parent;if(n.some(function(t){return t.contains(e)}))return[];if(null===(t=null==r?void 0:r.children)||void 0===t?void 0:t.length){var i=n.map(function(t){return t.parent}),s=this.resetNodesParent(n,r);return s.length?this.triggerMutation(new St({originSourceParents:i,target:this,source:s}),function(){return r.children=r.children.reduce(function(t,n){return n===e?t.concat(s).concat([n]):t.concat([n])},[]),s},[]):[]}return[]},t.prototype.insertChildren=function(t){for(var e,n=this,o=[],r=1;r<arguments.length;r++)o[r-1]=arguments[r];if(o.some(function(t){return t.contains(n)}))return[];if(null===(e=this.children)||void 0===e?void 0:e.length){var i=o.map(function(t){return t.parent}),s=this.resetNodesParent(o,this);return s.length?this.triggerMutation(new Ct({originSourceParents:i,target:this,source:s}),function(){return n.children=n.children.reduce(function(e,n,o){return o===t?e.concat(s).concat([n]):e.concat([n])},[]),s},[]):[]}return[]},t.prototype.setChildren=function(){for(var t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var o=e.map(function(t){return t.parent}),r=this.resetNodesParent(e,this);return this.triggerMutation(new Pt({originSourceParents:o,target:this,source:r}),function(){return t.children=r,r},[])},t.prototype.setNodeChildren=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this.setChildren.apply(this,s([],i(t),!1))},t.prototype.remove=function(){var t=this;return this.triggerMutation(new Nt({target:this,source:null}),function(){tn(t),Je.delete(t.id)})},t.prototype.clone=function(e){var n=new t({id:V(),componentName:this.componentName,sourceName:this.sourceName,props:Formily.Reactive.toJS(this.props),children:[]},e||this.parent);return n.children=en(this.children.map(function(t){return t.clone(n)}),n),this.triggerMutation(new Ot({target:this,source:n}),function(){return n})},t.prototype.from=function(e){var n=this;if(e)return this.triggerMutation(new Ft({target:this,source:e}),function(){var o,r,i;e.id&&e.id!==n.id&&(Je.delete(n.id),Je.set(e.id,n),n.id=e.id),e.componentName&&(n.componentName=e.componentName),n.props=null!==(o=e.props)&&void 0!==o?o:{},e.hidden&&(n.hidden=e.hidden),e.children&&(n.children=(null===(i=null===(r=e.children)||void 0===r?void 0:r.map)||void 0===i?void 0:i.call(r,function(e){return new t(e,n)}))||[])})},t.prototype.serialize=function(){return{id:this.id,componentName:this.componentName,sourceName:this.sourceName,props:Formily.Reactive.toJS(this.props),hidden:this.hidden,children:this.children.map(function(t){return t.serialize()})}},t.create=function(e,n){return new t(e,n)},t.findById=function(t){return Je.get(t)},t.remove=function(t){var e,n;void 0===t&&(t=[]);for(var o=t.length-1;o>=0;o--){var r=t[o];if(r.allowDelete()){var i=r.previous,s=r.next;r.remove(),null===(e=r.operation)||void 0===e||e.selection.select(i||(s||r.parent)),null===(n=r.operation)||void 0===n||n.hover.clear()}}},t.sort=function(t){return void 0===t&&(t=[]),t.sort(function(t,e){return t.depth!==e.depth?0:t.index-e.index>=0?1:-1})},t.clone=function(e){void 0===e&&(e=[]);var n={},o={};J(t.sort(e).filter(function(t){return!e.some(function(e){return t.isMyParents(e)})}),function(t){var e,r,i,s,a,c,l;t!==t.root&&t.allowClone()&&(null==t?void 0:t.operation)&&(n[null===(e=null==t?void 0:t.parent)||void 0===e?void 0:e.id]=n[null===(r=null==t?void 0:t.parent)||void 0===r?void 0:r.id]||[],n[null===(i=null==t?void 0:t.parent)||void 0===i?void 0:i.id].push(t),o[null===(s=null==t?void 0:t.parent)||void 0===s?void 0:s.id]?t.index>o[null===(a=null==t?void 0:t.parent)||void 0===a?void 0:a.id].index&&(o[null===(c=null==t?void 0:t.parent)||void 0===c?void 0:c.id]=t):o[null===(l=null==t?void 0:t.parent)||void 0===l?void 0:l.id]=t)});var r=new Map;J(n,function(t,e){var n=o[e];J(t,function(t){var e,o,i=t.clone();if(i)if((null===(e=t.operation)||void 0===e?void 0:e.selection.has(t))&&n.parent.allowAppend([i]))n.insertAfter(i),n=n.next;else if(1===t.operation.selection.length){var s=null===(o=t.operation)||void 0===o?void 0:o.tree.findById(t.operation.selection.first),a=r.get(s);a||(a=[],r.set(s,a)),s&&s.allowAppend([i])&&a.push(i)}})}),r.forEach(function(t,e){t.length&&e.append.apply(e,s([],i(t),!1))})},t.filterResizable=function(t){return void 0===t&&(t=[]),t.filter(function(t){return t.allowResize()})},t.filterRotatable=function(t){return void 0===t&&(t=[]),t.filter(function(t){return t.allowRotate()})},t.filterScalable=function(t){return void 0===t&&(t=[]),t.filter(function(t){return t.allowScale()})},t.filterRoundable=function(t){return void 0===t&&(t=[]),t.filter(function(t){return t.allowRound()})},t.filterTranslatable=function(t){return void 0===t&&(t=[]),t.filter(function(t){return t.allowTranslate()})},t.filterDraggable=function(t){return void 0===t&&(t=[]),t.reduce(function(t,e){var n;if(!e.allowDrag())return t;if(l(null===(n=null==e?void 0:e.designerProps)||void 0===n?void 0:n.getDragNodes)){var o=e.designerProps.getDragNodes(e);return o?t.concat(o):t}return"$$ResourceNode$$"===e.componentName?t.concat(e.children):t.concat([e])},[])},t.filterDroppable=function(t,e){return void 0===t&&(t=[]),t.reduce(function(t,n){var o;if(!n.allowDrop(e))return t;if(l(null===(o=n.designerProps)||void 0===o?void 0:o.getDropNodes)){var r=n.isSourceNode?n.clone(n.parent):n,i=n.designerProps.getDropNodes(r,e);return i?t.concat(i):t}return"$$ResourceNode$$"===n.componentName?t.concat(n.children):t.concat([n])},[])},t}(),rn=function(){function t(t){var e,n;this.scrollX=0,this.scrollY=0,this.width=0,this.height=0,this.mounted=!1,this.nodeElementsStore={},this.workspace=t.workspace,this.engine=t.engine,this.moveSensitive=null!==(e=t.moveSensitive)&&void 0!==e&&e,this.moveInsertionType=null!==(n=t.moveInsertionType)&&void 0!==n?n:"all",this.viewportElement=t.viewportElement,this.contentWindow=t.contentWindow,this.nodeIdAttrName=t.nodeIdAttrName,this.digestViewport(),this.makeObservable(),this.attachEvents()}return Object.defineProperty(t.prototype,"isScrollLeft",{get:function(){return 0===this.scrollX},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isScrollTop",{get:function(){return 0===this.scrollY},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isScrollRight",{get:function(){var t,e,n;return this.isIframe?this.width+this.contentWindow.scrollX>=(null===(n=null===(e=null===(t=this.contentWindow)||void 0===t?void 0:t.document)||void 0===e?void 0:e.body)||void 0===n?void 0:n.scrollWidth):this.viewportElement?this.viewportElement.offsetWidth+this.scrollX>=this.viewportElement.scrollWidth:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isScrollBottom",{get:function(){var t,e;return this.isIframe?!!(null===(e=null===(t=this.contentWindow)||void 0===t?void 0:t.document)||void 0===e?void 0:e.body)&&this.height+this.contentWindow.scrollY>=this.contentWindow.document.body.scrollHeight:this.viewportElement?!!this.viewportElement&&this.viewportElement.offsetHeight+this.viewportElement.scrollTop>=this.viewportElement.scrollHeight:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"viewportRoot",{get:function(){var t,e;return this.isIframe?null===(e=null===(t=this.contentWindow)||void 0===t?void 0:t.document)||void 0===e?void 0:e.body:this.viewportElement},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isMaster",{get:function(){return this.contentWindow===m},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isIframe",{get:function(){var t;return!!(null===(t=this.contentWindow)||void 0===t?void 0:t.frameElement)&&!this.isMaster},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scrollContainer",{get:function(){return this.isIframe?this.contentWindow:this.viewportElement},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rect",{get:function(){var t=this.viewportElement;if(t)return t.getBoundingClientRect()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"innerRect",{get:function(){var t=this.rect;return new M(0,0,null==t?void 0:t.width,null==t?void 0:t.height)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"offsetX",{get:function(){var t=this.rect;return t?t.x:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"offsetY",{get:function(){var t=this.rect;return t?t.y:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scale",{get:function(){if(!this.viewportElement)return 1;var t=this.viewportElement.getBoundingClientRect(),e=this.viewportElement.offsetWidth;return t.width&&e?Math.round(t.width/e):1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dragScrollXDelta",{get:function(){return this.scrollX-this.dragStartSnapshot.scrollX},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dragScrollYDelta",{get:function(){return this.scrollY-this.dragStartSnapshot.scrollY},enumerable:!1,configurable:!0}),t.prototype.cacheElements=function(){var t,e=this;this.nodeElementsStore={},null===(t=this.viewportRoot)||void 0===t||t.querySelectorAll("*[".concat(this.nodeIdAttrName,"]")).forEach(function(t){var n=t.getAttribute(e.nodeIdAttrName);e.nodeElementsStore[n]=e.nodeElementsStore[n]||[],e.nodeElementsStore[n].push(t)})},t.prototype.clearCache=function(){this.nodeElementsStore={}},t.prototype.getCurrentData=function(){var t,e,n,o,r,i,s,a,c={};return this.isIframe?(c.scrollX=(null===(t=this.contentWindow)||void 0===t?void 0:t.scrollX)||0,c.scrollY=(null===(e=this.contentWindow)||void 0===e?void 0:e.scrollY)||0,c.width=(null===(n=this.contentWindow)||void 0===n?void 0:n.innerWidth)||0,c.height=(null===(o=this.contentWindow)||void 0===o?void 0:o.innerHeight)||0):this.viewportElement&&(c.scrollX=(null===(r=this.viewportElement)||void 0===r?void 0:r.scrollLeft)||0,c.scrollY=(null===(i=this.viewportElement)||void 0===i?void 0:i.scrollTop)||0,c.width=(null===(s=this.viewportElement)||void 0===s?void 0:s.clientWidth)||0,c.height=(null===(a=this.viewportElement)||void 0===a?void 0:a.clientHeight)||0),c},t.prototype.takeDragStartSnapshot=function(){this.dragStartSnapshot=this.getCurrentData()},t.prototype.digestViewport=function(){Object.assign(this,this.getCurrentData())},t.prototype.elementFromPoint=function(t){var e;if(null===(e=this.contentWindow)||void 0===e?void 0:e.document)return this.contentWindow.document.elementFromPoint(t.x,t.y)},t.prototype.matchViewport=function(t){var e;return this.isIframe?t===this.viewportElement||t===this.contentWindow||t===(null===(e=this.contentWindow)||void 0===e?void 0:e.document):t===this.viewportElement},t.prototype.attachEvents=function(){var t=this,e=this.engine;rt(this.attachRequest),this.attachRequest=ot(function(){var n;e&&(t.isIframe?t.workspace.attachEvents(t.contentWindow,t.contentWindow):((null==(n=t.viewportElement)?void 0:n.nodeName)||(null==n?void 0:n.tagName))&&t.workspace.attachEvents(t.viewportElement,t.contentWindow))})},t.prototype.detachEvents=function(){this.isIframe?(this.workspace.detachEvents(this.contentWindow),this.workspace.detachEvents(this.viewportElement)):this.viewportElement&&this.workspace.detachEvents(this.viewportElement)},t.prototype.onMount=function(t,e){this.mounted=!0,this.viewportElement=t,this.contentWindow=e,this.attachEvents(),this.digestViewport()},t.prototype.onUnmount=function(){this.mounted=!1,this.detachEvents()},t.prototype.isPointInViewport=function(t,e){return!!this.rect&&(!!this.containsElement(document.elementFromPoint(t.x,t.y))&&L(t,this.rect,e))},t.prototype.isRectInViewport=function(t){return!!this.rect&&(!!this.containsElement(document.elementFromPoint(t.x,t.y))&&B(t,this.rect))},t.prototype.isPointInViewportArea=function(t,e){return!!this.rect&&L(t,this.rect,e)},t.prototype.isOffsetPointInViewport=function(t,e){return!!this.innerRect&&(!!this.containsElement(document.elementFromPoint(t.x,t.y))&&L(t,this.innerRect,e))},t.prototype.isOffsetRectInViewport=function(t){return!!this.innerRect&&(!!this.containsElement(document.elementFromPoint(t.x,t.y))&&B(t,this.innerRect))},t.prototype.makeObservable=function(){Formily.Reactive.define(this,{scrollX:Formily.Reactive.observable.ref,scrollY:Formily.Reactive.observable.ref,width:Formily.Reactive.observable.ref,height:Formily.Reactive.observable.ref,digestViewport:Formily.Reactive.action,viewportElement:Formily.Reactive.observable.ref,contentWindow:Formily.Reactive.observable.ref})},t.prototype.findElementById=function(t){var e;if(t)return this.nodeElementsStore[t]?this.nodeElementsStore[t][0]:null===(e=this.viewportRoot)||void 0===e?void 0:e.querySelector("*[".concat(this.nodeIdAttrName,"='").concat(t,"']"))},t.prototype.findElementsById=function(t){var e,n;return t?this.nodeElementsStore[t]?this.nodeElementsStore[t]:Array.from(null!==(n=null===(e=this.viewportRoot)||void 0===e?void 0:e.querySelectorAll("*[".concat(this.nodeIdAttrName,"='").concat(t,"']")))&&void 0!==n?n:[]):[]},t.prototype.containsElement=function(t){var e=this.viewportElement;return e===t||(null==e?void 0:e.contains(t))},t.prototype.getOffsetPoint=function(t){var e=this.getCurrentData();return{x:t.x-this.offsetX+e.scrollX,y:t.y-this.offsetY+e.scrollY}},t.prototype.getElementRect=function(t){var e=t.getBoundingClientRect(),n=t.offsetWidth?t.offsetWidth:e.width,o=t.offsetHeight?t.offsetHeight:e.height;return new M(e.x,e.y,1!==this.scale?n:e.width,1!==this.scale?o:e.height)},t.prototype.getElementRectById=function(t){var e=this,n=W(this.findElementsById(t).map(function(t){return e.getElementRect(t)}));if(n)return this.isIframe?new M(n.x+this.offsetX,n.y+this.offsetY,n.width,n.height):new M(n.x,n.y,n.width,n.height)},t.prototype.getElementOffsetRect=function(t){var e=t.getBoundingClientRect();if(e)return this.isIframe?new M(e.x+this.contentWindow.scrollX,e.y+this.contentWindow.scrollY,e.width,e.height):new M((e.x-this.offsetX+this.viewportElement.scrollLeft)/this.scale,(e.y-this.offsetY+this.viewportElement.scrollTop)/this.scale,e.width,e.height)},t.prototype.getElementOffsetRectById=function(t){var e=this,n=this.findElementsById(t);if(n.length){var o=W(n.map(function(t){return e.getElementRect(t)}));return o?this.isIframe?new M(o.x+this.contentWindow.scrollX,o.y+this.contentWindow.scrollY,o.width,o.height):new M((o.x-this.offsetX+this.viewportElement.scrollLeft)/this.scale,(o.y-this.offsetY+this.viewportElement.scrollTop)/this.scale,o.width,o.height):void 0}},t.prototype.getValidNodeElement=function(t){var e=this,n=function(t){if(t){var o=e.findElementById(t.id);return o||n(t.parent)}};return n(t)},t.prototype.getChildrenRect=function(t){var e,n=this;if(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)return W(t.children.reduce(function(t,e){var o=n.getValidNodeRect(e);return o?t.concat(o):t},[]))},t.prototype.getChildrenOffsetRect=function(t){var e,n=this;if(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)return W(t.children.reduce(function(t,e){var o=n.getValidNodeOffsetRect(e);return o?t.concat(o):t},[]))},t.prototype.getValidNodeRect=function(t){if(t){var e=this.getElementRectById(t.id);return t&&t===t.root&&t.isInOperation?e?W([this.rect,e]):this.rect:e||this.getChildrenRect(t)}},t.prototype.getValidNodeOffsetRect=function(t){if(t){var e=this.getElementOffsetRectById(t.id);return t&&t===t.root&&t.isInOperation?e?W([this.innerRect,e]):this.innerRect:e||this.getChildrenOffsetRect(t)}},t.prototype.getValidNodeLayout=function(t){var e,n;return t?(null===(n=null===(e=t.parent)||void 0===e?void 0:e.designerProps)||void 0===n?void 0:n.inlineChildrenLayout)?"horizontal":st(this.findElementById(t.id)):"vertical"},t}(),sn=function(){function t(t){this.selected=[],this.indexes={},t.selected&&(this.selected=t.selected),t.operation&&(this.operation=t.operation),this.makeObservable()}return t.prototype.makeObservable=function(){Formily.Reactive.define(this,{selected:Formily.Reactive.observable,select:Formily.Reactive.action,batchSelect:Formily.Reactive.action,add:Formily.Reactive.action,remove:Formily.Reactive.action,clear:Formily.Reactive.action,crossAddTo:Formily.Reactive.action})},t.prototype.trigger=function(t){return void 0===t&&(t=xt),this.operation.dispatch(new t({target:this.operation.tree,source:this.selectedNodes}))},t.prototype.select=function(t){var e;if(p(t)){if(1===this.selected.length&&this.selected.includes(t))return void this.trigger(xt);this.selected=[t],this.indexes=((e={})[t]=!0,e),this.trigger(xt)}else this.select(null==t?void 0:t.id)},t.prototype.safeSelect=function(t){t&&this.select(t)},t.prototype.mapIds=function(t){return d(t)?t.map(function(t){return p(t)?t:null==t?void 0:t.id}):[]},t.prototype.batchSelect=function(t){this.selected=this.mapIds(t),this.indexes=this.selected.reduce(function(t,e){return t[e]=!0,t},{}),this.trigger(xt)},t.prototype.batchSafeSelect=function(t){(null==t?void 0:t.length)&&this.batchSelect(t)},Object.defineProperty(t.prototype,"selectedNodes",{get:function(){var t=this;return this.selected.map(function(e){return t.operation.tree.findById(e)})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"first",{get:function(){if(this.selected&&this.selected.length)return this.selected[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"last",{get:function(){if(this.selected&&this.selected.length)return this.selected[this.selected.length-1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this.selected.length},enumerable:!1,configurable:!0}),t.prototype.add=function(){for(var t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.mapIds(e).forEach(function(e){p(e)?t.selected.includes(e)||(t.selected.push(e),t.indexes[e]=!0):t.add(null==e?void 0:e.id)}),this.trigger()},t.prototype.crossAddTo=function(t){var e=this;if(t.parent){var n=this.selectedNodes;if(this.has(t))this.remove(t);else{var o=n.reduce(function(e,n){return n.distanceTo(t)<e.distanceTo(t)?n:e},n[0]);if(o)t.crossSiblings(o).forEach(function(t){e.has(t.id)||(e.selected.push(t.id),e.indexes[t.id]=!0)});this.has(t.id)||(this.selected.push(t.id),this.indexes[t.id]=!0)}}},t.prototype.remove=function(){for(var t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.mapIds(e).forEach(function(e){p(e)?(t.selected=t.selected.filter(function(t){return t!==e}),delete t.indexes[e]):t.remove(null==e?void 0:e.id)}),this.trigger(kt)},t.prototype.has=function(){for(var t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return this.mapIds(e).some(function(e){return p(e)?t.indexes[e]:!!(null==e?void 0:e.id)&&t.has(null==e?void 0:e.id)})},t.prototype.clear=function(){this.selected=[],this.indexes={},this.trigger(kt)},t}(),an=function(){function t(t){this.node=null,this.operation=null==t?void 0:t.operation,this.makeObservable()}return t.prototype.setHover=function(t){this.node=t||null,this.trigger()},t.prototype.clear=function(){this.node=null},t.prototype.trigger=function(){if(this.operation)return this.operation.dispatch(new wt({target:this.operation.tree,source:this.node}))},t.prototype.makeObservable=function(){Formily.Reactive.define(this,{node:Formily.Reactive.observable.ref,setHover:Formily.Reactive.action,clear:Formily.Reactive.action})},t}(),cn=function(){function t(t,e){this.helper=t,this.type=e.type||"normal",this._id=e.id,this.refer=e.refer,this.start=o({},e.start),this.end=o({},e.end),this.distance=e.distance}return Object.defineProperty(t.prototype,"id",{get:function(){var t;return null!==(t=this._id)&&void 0!==t?t:"".concat(this.start.x,"-").concat(this.start.y,"-").concat(this.end.x,"-").concat(this.end.y)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"direction",{get:function(){var t,e;return(null===(t=this.start)||void 0===t?void 0:t.x)===(null===(e=this.end)||void 0===e?void 0:e.x)?"v":"h"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"closest",{get:function(){return this.distance<fn.threshold},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rect",{get:function(){return function(t){if(O(t)){var e=t.start.x===t.end.x;return new M(t.start.x,t.start.y,e?0:t.end.x-t.start.x,e?t.end.y-t.start.y:0)}}(this)},enumerable:!1,configurable:!0}),t.prototype.translate=function(t,e){if(t&&(null==t?void 0:t.parent)){var n=t.parent,o=t.getValidElementOffsetRect(),r=n.getValidElementOffsetRect(),i=j(this,o);"h"===this.direction?e.y=this.start.y-r.y-i.y:e.x=this.start.x-r.x-i.x}},t.prototype.resize=function(t,e){if(t&&(null==t?void 0:t.parent)){var n=t.parent,o=t.getValidElementOffsetRect(),r=n.getValidElementOffsetRect(),i=j(this,o),s=this.helper.cursorDragNodesRect,a=this.snapEdge(e);if("h"===this.direction){var c=this.start.y-r.y-i.y;switch(this.helper.direction){case"left-top":case"center-top":case"right-top":if("ht"!==a)return;e.y=c,e.height=s.bottom-c;break;case"left-bottom":case"center-bottom":case"right-bottom":if("hb"!==a)return;e.height=this.start.y-s.top}}else{var l=this.start.x-r.x-i.x;switch(this.helper.direction){case"left-top":case"left-bottom":case"left-center":if("vl"!==a)return;e.x=l,e.width=s.right-l;break;case"right-center":case"right-top":case"right-bottom":if("vr"!==a)return;e.width=this.start.x-s.left}}}},t.prototype.snapEdge=function(t){var e=fn.threshold;if("h"===this.direction){if(Math.abs(this.start.y-t.top)<e)return"ht";if(Math.abs(this.start.y-(t.top+t.height/2))<e)return"hc";if(Math.abs(this.start.y-t.bottom)<e)return"hb"}else{if(Math.abs(this.start.x-t.left)<e)return"vl";if(Math.abs(this.start.x-(t.left+t.width/2))<e)return"vc";if(Math.abs(this.start.x-t.right)<e)return"vr"}},t}(),ln=function(){function t(t,e){this.helper=t,this.distance=e.distance,this.refer=e.refer,this.rect=e.rect,this.type=e.type}return Object.defineProperty(t.prototype,"referRect",{get:function(){if(this.refer)return this.helper.getNodeRect(this.refer)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"id",{get:function(){var t;return null!==(t=this._id)&&void 0!==t?t:"".concat(this.rect.x,"-").concat(this.rect.y,"-").concat(this.rect.width,"-").concat(this.rect.height)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"next",{get:function(){return this.helper.calcAroundSpaceBlocks(this.referRect)[this.type]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"extendsLine",{get:function(){if(this.needExtendsLine)return function(t,e){if(e.right<t.right&&t.left<=e.right){if(e.bottom<t.top)return{start:{x:e.right,y:e.bottom},end:{x:t.right,y:e.bottom}};if(e.top>t.bottom)return{start:{x:e.right,y:e.top},end:{x:t.right,y:e.top}}}else if(e.left>t.left&&t.right>=e.left){if(e.bottom<t.top)return{start:{x:t.left,y:e.bottom},end:{x:e.left,y:e.bottom}};if(e.top>t.bottom)return{start:{x:t.left,y:e.top},end:{x:e.left,y:e.top}}}if(e.top<t.top&&t.bottom>=e.top){if(e.right<t.left)return{start:{x:e.right,y:e.bottom},end:{x:e.right,y:t.bottom}};if(e.left>t.right)return{start:{x:e.left,y:e.bottom},end:{x:e.left,y:t.bottom}}}else if(e.bottom>t.bottom&&e.top<=t.bottom){if(e.right<t.left)return{start:{x:e.right,y:t.top},end:{x:e.right,y:e.top}};if(e.left>t.right)return{start:{x:e.left,y:t.top},end:{x:e.left,y:e.top}}}}(this.helper.dragNodesRect,this.referRect)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"needExtendsLine",{get:function(){var t=this.crossDragNodesRect,e=this.crossReferRect;if("top"===this.type||"bottom"===this.type){var n=e.right-t.left,o=t.right-e.left;return n<t.width/2||o<t.width/2}var r=t.bottom-e.top,i=e.bottom-t.top;return r<t.height/2||i<t.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"crossReferRect",{get:function(){var t=this.referRect;return"top"===this.type||"bottom"===this.type?new M(t.x,this.rect.y,t.width,this.rect.height):new M(this.rect.x,t.y,this.rect.width,t.height)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"crossDragNodesRect",{get:function(){var t=this.helper.dragNodesRect;return"top"===this.type||"bottom"===this.type?new M(t.x,this.rect.y,t.width,this.rect.height):new M(this.rect.x,t.y,this.rect.width,t.height)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isometrics",{get:function(){for(var t=[],e=this;e=e.next;)if(Math.abs(e.distance-this.distance)<fn.threshold){if(t.some(function(t){return t.distance!==e.distance}))continue;t.push(e)}return t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"snapLine",{get:function(){if(this.isometrics.length){var t,e=this.next.rect,n=this.referRect,r=K(t="top"===this.type?new I({x:e.left,y:n.bottom+e.height},{x:e.right,y:n.bottom+e.height}):"bottom"===this.type?new I({x:e.left,y:n.top-e.height},{x:e.right,y:n.top-e.height}):"left"===this.type?new I({x:n.right+e.width,y:e.top},{x:n.right+e.width,y:e.bottom}):new I({x:n.left-e.width,y:e.top},{x:n.left-e.width,y:e.bottom}),this.helper.dragNodesEdgeLines);return new cn(this.helper,o(o({},t),{distance:r,type:"space-block"}))}},enumerable:!1,configurable:!0}),t}();t.CursorStatus=void 0,(We=t.CursorStatus||(t.CursorStatus={})).Normal="NORMAL",We.DragStart="DRAG_START",We.Dragging="DRAGGING",We.DragStop="DRAG_STOP",t.CursorDragType=void 0,(ze=t.CursorDragType||(t.CursorDragType={})).Move="MOVE",ze.Resize="RESIZE",ze.Rotate="ROTATE",ze.Scale="SCALE",ze.Translate="TRANSLATE",ze.Round="ROUND",t.CursorType=void 0,(je=t.CursorType||(t.CursorType={})).Normal="NORMAL",je.Selection="SELECTION",je.Sketch="SKETCH";var un,dn={pageX:0,pageY:0,clientX:0,clientY:0,topPageX:0,topPageY:0,topClientX:0,topClientY:0},hn=function(t,e){return Object.keys(t||{}).reduce(function(n,o){return v(null==t?void 0:t[o])&&v(null==e?void 0:e[o])?n[o]=t[o]-e[o]:n[o]=t[o],n},{})},pn=function(){function e(e){this.type=t.CursorType.Normal,this.dragType=t.CursorDragType.Move,this.status=t.CursorStatus.Normal,this.position=dn,this.dragAtomDelta=dn,this.dragStartToCurrentDelta=dn,this.dragStartToEndDelta=dn,this.view=m,this.engine=e,this.makeObservable()}return e.prototype.makeObservable=function(){Formily.Reactive.define(this,{type:Formily.Reactive.observable.ref,dragType:Formily.Reactive.observable.ref,status:Formily.Reactive.observable.ref,position:Formily.Reactive.observable.ref,dragStartPosition:Formily.Reactive.observable.ref,dragEndPosition:Formily.Reactive.observable.ref,dragAtomDelta:Formily.Reactive.observable.ref,dragStartToCurrentDelta:Formily.Reactive.observable.ref,dragStartToEndDelta:Formily.Reactive.observable.ref,view:Formily.Reactive.observable.ref,setStyle:Formily.Reactive.action,setPosition:Formily.Reactive.action,setStatus:Formily.Reactive.action,setType:Formily.Reactive.action})},Object.defineProperty(e.prototype,"speed",{get:function(){return Math.sqrt(Math.pow(this.dragAtomDelta.clientX,2)+Math.pow(this.dragAtomDelta.clientY,2))},enumerable:!1,configurable:!0}),e.prototype.setStatus=function(t){this.status=t},e.prototype.setType=function(t){this.type=t},e.prototype.setDragType=function(t){this.dragType=t},e.prototype.setStyle=function(t){this.engine.workbench.eachWorkspace(function(e){!function(t,e){var n,o,r,i,s=null===(o=null===(n=null===document||void 0===document?void 0:document.getElementsByTagName)||void 0===n?void 0:n.call(document,"html"))||void 0===o?void 0:o[0],a=null===(i=null===(r=null==t?void 0:t.document)||void 0===r?void 0:r.getElementsByTagName("html"))||void 0===i?void 0:i[0];a&&a.style.cursor!==e&&(a.style.cursor=e),s&&s.style.cursor!==e&&(s.style.cursor=e)}(e.viewport.contentWindow,t)})},e.prototype.setPosition=function(e){this.dragAtomDelta=hn(this.position,e),this.position=o({},e),this.status===t.CursorStatus.Dragging&&(this.dragStartToCurrentDelta=hn(this.position,this.dragStartPosition))},e.prototype.setDragStartPosition=function(t){t?this.dragStartPosition=o({},t):(this.dragStartPosition=null,this.dragStartToCurrentDelta=dn)},e.prototype.setDragEndPosition=function(t){this.dragStartPosition&&(t?(this.dragEndPosition=o({},t),this.dragStartToEndDelta=hn(this.dragStartPosition,this.dragEndPosition)):(this.dragEndPosition=null,this.dragStartToEndDelta=dn))},e}(),fn=function(){function e(t){this.dragNodes=[],this.rulerSnapLines=[],this.aroundSnapLines=[],this.aroundSpaceBlocks=null,this.viewportRectsStore={},this.dragStartTranslateStore={},this.dragStartSizeStore={},this.dragStartNodesRect=null,this.snapping=!1,this.dragging=!1,this.snapped=!1,this.operation=t.operation,this.makeObservable()}return Object.defineProperty(e.prototype,"tree",{get:function(){return this.operation.tree},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cursor",{get:function(){return this.operation.engine.cursor},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"viewport",{get:function(){return this.operation.workspace.viewport},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"deltaX",{get:function(){return this.cursor.dragStartToCurrentDelta.clientX},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"deltaY",{get:function(){return this.cursor.dragStartToCurrentDelta.clientY},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cursorPosition",{get:function(){var t=this.cursor.position;return this.operation.workspace.viewport.getOffsetPoint(new F(t.clientX,t.clientY))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cursorDragNodesRect",{get:function(){if("translate"===this.type)return new M(this.cursorPosition.x-this.dragStartCursorOffset.x,this.cursorPosition.y-this.dragStartCursorOffset.y,this.dragNodesRect.width,this.dragNodesRect.height);if("resize"===this.type){var t=this.dragStartNodesRect,e=this.cursor.dragStartToCurrentDelta.clientX,n=this.cursor.dragStartToCurrentDelta.clientY;switch(this.direction){case"left-top":return new M(this.cursorPosition.x-this.dragStartCursorOffset.x,this.cursorPosition.y-this.dragStartCursorOffset.y,t.width-e,t.height-n);case"left-center":return new M(this.cursorPosition.x-this.dragStartCursorOffset.x,t.y,t.width-e,t.height);case"left-bottom":return new M(this.cursorPosition.x-this.dragStartCursorOffset.x,t.y,t.width-e,t.height-n);case"center-top":return new M(t.x,this.cursorPosition.y-this.dragStartCursorOffset.y,t.width,t.height-n);case"center-bottom":return new M(t.x,t.y,t.width,t.height+n);case"right-top":return new M(t.x,this.cursorPosition.y-this.dragStartCursorOffset.y,t.width+e,t.height-n);case"right-center":return new M(t.x,t.y,t.width+e,t.height);case"right-bottom":return new M(t.x,t.y,t.width+e,t.height-n)}}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cursorDragNodesEdgeLines",{get:function(){return z(this.cursorDragNodesRect)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dragNodesRect",{get:function(){return this.draggingNodesRect?this.draggingNodesRect:W(this.dragNodes.map(function(t){return t.getValidElementOffsetRect()}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dragNodesEdgeLines",{get:function(){return z(this.dragNodesRect)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cursorOffset",{get:function(){return new F(this.cursorPosition.x-this.dragNodesRect.x,this.cursorPosition.y-this.dragNodesRect.y)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dragStartCursor",{get:function(){var t=this.operation.engine.cursor.dragStartPosition;return this.operation.workspace.viewport.getOffsetPoint(new F(t.clientX,t.clientY))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dragStartCursorOffset",{get:function(){return new F(this.dragStartCursor.x-this.dragStartNodesRect.x,this.dragStartCursor.y-this.dragStartNodesRect.y)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"closestSnapLines",{get:function(){if(!this.dragging)return[];var t=[],n=this.cursorDragNodesEdgeLines;return this.thresholdSnapLines.forEach(function(o){var r=K(o,n);if(r<e.threshold){var i=t.findIndex(function(t){return t.distance>r&&t.distance>0&&t.direction===o.direction});i>-1&&t.splice(i,1),t.push(o)}}),t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"closestSpaceBlocks",{get:function(){if(!this.dragging)return[];var t=this.cursorDragNodesEdgeLines;return this.thresholdSpaceBlocks.filter(function(n){var o=n.snapLine;return!!o&&K(o,t)<e.threshold})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thresholdSnapLines",{get:function(){if(!this.dragging)return[];var t=[];for(var e in this.aroundSnapLines.forEach(function(e){t.push(e)}),this.rulerSnapLines.forEach(function(e){e.closest&&t.push(e)}),this.aroundSpaceBlocks){var n=this.aroundSpaceBlocks[e].snapLine;n&&t.push(n)}return t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thresholdSpaceBlocks",{get:function(){var t=[];if(!this.dragging)return[];for(var e in this.aroundSpaceBlocks){var n=this.aroundSpaceBlocks[e];if(!n.snapLine)return[];if(0!==n.snapLine.distance)return[];n.isometrics.length&&(t.push(n),t.push.apply(t,s([],i(n.isometrics),!1)))}return t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"measurerSpaceBlocks",{get:function(){var t=[];if(!this.dragging||!this.snapped)return[];for(var e in this.aroundSpaceBlocks)this.aroundSpaceBlocks[e]&&t.push(this.aroundSpaceBlocks[e]);return t},enumerable:!1,configurable:!0}),e.prototype.calcBaseTranslate=function(t){var e,n=null!==(e=this.dragStartTranslateStore[t.id])&&void 0!==e?e:{x:0,y:0};return{x:n.x+this.deltaX,y:n.y+this.deltaY}},e.prototype.calcBaseResize=function(t){var e,n,o=this.deltaX,r=this.deltaY,i=null!==(e=this.dragStartTranslateStore[t.id])&&void 0!==e?e:{x:0,y:0},s=null!==(n=this.dragStartSizeStore[t.id])&&void 0!==n?n:{width:0,height:0};switch(this.direction){case"left-top":return new M(i.x+o,i.y+r,s.width-o,s.height-r);case"left-center":return new M(i.x+o,i.y,s.width-o,s.height);case"left-bottom":return new M(i.x+o,i.y,s.width-o,s.height+r);case"center-bottom":return new M(i.x,i.y,s.width,s.height+r);case"center-top":return new M(i.x,i.y+r,s.width,s.height-r);case"right-top":return new M(i.x,i.y+r,s.width+o,s.height-r);case"right-bottom":return new M(i.x,i.y,s.width+o,s.height+r);case"right-center":return new M(i.x,i.y,s.width+o,s.height)}},e.prototype.calcDragStartStore=function(t){var e=this;void 0===t&&(t=[]),this.dragStartNodesRect=this.dragNodesRect,t.forEach(function(t){var n=t.getElement(),o=t.getElementOffsetRect();e.dragStartTranslateStore[t.id]=function(t){var e,n,o,r=null===(e=null==t?void 0:t.style)||void 0===e?void 0:e.transform;if(r){var s=i(null!==(o=null===(n=r.match(/translate(?:3d)?\(\s*([-\d.]+)[a-z]+?[\s,]+([-\d.]+)[a-z]+?(?:[\s,]+([-\d.]+))?[a-z]+?\s*\)/))||void 0===n?void 0:n.slice(1,3))&&void 0!==o?o:[0,0],2),a=s[0],c=s[1];return new F(Number(a),Number(c))}return new F(Number(t.offsetLeft),Number(t.offsetTop))}(n),e.dragStartSizeStore[t.id]={width:o.width,height:o.height}})},e.prototype.calcRulerSnapLines=function(t){var e=z(t);return this.rulerSnapLines.map(function(t){return t.distance=K(t,e),t})},e.prototype.calcAroundSnapLines=function(t){var n=this,r=[],s=z(t);return this.eachViewportNodes(function(a,c){if(!n.dragNodes.includes(a)){var l=z(c),u=function(a){var c,l,u=i(function(t,e){var n,o,r,i,s,a=1/0;if((null===(n=null==t?void 0:t.start)||void 0===n?void 0:n.y)===(null===(o=null==t?void 0:t.end)||void 0===o?void 0:o.y))e.h.forEach(function(e){var n=Math.abs(e.start.y-t.start.y);n<a&&(a=n,s=e)});else{if((null===(r=null==t?void 0:t.start)||void 0===r?void 0:r.x)!==(null===(i=null==t?void 0:t.end)||void 0===i?void 0:i.x))throw new Error("can not calculate slash distance");e.v.forEach(function(e){var n=Math.abs(e.start.x-t.start.x);n<a&&(a=n,s=e)})}return[a,s]}(a,s),2),d=u[0],h=u[1],p=(l=h,(c=a).start.x===c.end.x?new I(new F(c.start.x,c.start.y>l.start.y?l.start.y:c.start.y),new F(c.start.x,c.end.y>l.end.y?c.end.y:l.end.y)):new I(new F(c.start.x>l.start.x?l.start.x:c.start.x,c.start.y),new F(c.end.x>l.end.x?c.end.x:l.end.x,c.end.y)));if(d<e.threshold){if(n.snapping&&0!==d)return;var f=new cn(n,o(o({},p),{distance:d})),v=f.snapEdge(t);("translate"===n.type||"hc"!==v&&"vc"!==v)&&r.push(f)}};l.h.forEach(u),l.v.forEach(u)}}),r},e.prototype.calcAroundSpaceBlocks=function(t){var e=this,n={};return this.eachViewportNodes(function(r,i){if(a=i,(null==(s=t)?void 0:s.x)!==(null==a?void 0:a.x)||s.y!==a.y||s.width!==a.width||s.height!==a.height){var s,a,c=function(t,e){var n=new M(t.x,t.y,t.width,t.height),o=new M(e.x,e.y,e.width,e.height);if(!(o.bottom<n.top&&o.left>n.right||o.top>n.bottom&&o.left>n.right||o.bottom<n.top&&o.right<n.left||o.top>n.bottom&&o.right<n.left)){if(o.bottom<n.top){var r=n.top-o.bottom,i=Math.min(o.left,n.left),s=Math.max(o.right,n.right);return{type:"top",distance:r,rect:new M(i,o.bottom,s-i,r)}}if(o.top>n.bottom)return r=o.top-n.bottom,i=Math.min(o.left,n.left),s=Math.max(o.right,n.right),{type:"bottom",distance:r,rect:new M(i,n.bottom,s-i,r)};if(o.right<n.left){r=n.left-o.right;var a=Math.min(o.top,n.top),c=Math.max(o.bottom,n.bottom);return{type:"left",distance:r,rect:new M(o.right,a,r,c-a)}}if(o.left>n.right){r=o.left-n.right;var l=Math.min(o.top,n.top);return c=Math.max(o.bottom,n.bottom),{type:"right",distance:r,rect:new M(n.right,l,r,c-l)}}}}(t,i);if(c){var l=new ln(e,o({refer:r},c));n[c.type]?l.distance<n[c.type].distance&&(n[c.type]=l):n[c.type]=l}}}),n},e.prototype.calcViewportNodes=function(){var t=this;this.tree.eachTree(function(e){var n=e.getValidElementRect(),o=e.getValidElementOffsetRect();t.dragNodes.includes(e)||t.viewport.isRectInViewport(n)&&(t.viewportRectsStore[e.id]=o)})},e.prototype.getNodeRect=function(t){return this.viewportRectsStore[t.id]},e.prototype.eachViewportNodes=function(t){for(var e in this.viewportRectsStore)t(this.tree.findById(e),this.viewportRectsStore[e])},e.prototype.translate=function(t,e){var n,o;if(this.dragging){var i=this.calcBaseTranslate(t);this.snapped=!1,this.snapping=!1;try{for(var s=r(this.closestSnapLines),a=s.next();!a.done;a=s.next()){a.value.translate(t,i),this.snapping=!0,this.snapped=!0}}catch(t){n={error:t}}finally{try{a&&!a.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}e(i),this.snapping&&(this.dragMove(),this.snapping=!1)}},e.prototype.resize=function(t,e){var n,o;if(this.dragging){var i=this.calcBaseResize(t);this.snapping=!1,this.snapping=!1;try{for(var s=r(this.closestSnapLines),a=s.next();!a.done;a=s.next()){a.value.resize(t,i),this.snapping=!0,this.snapped=!0}}catch(t){n={error:t}}finally{try{a&&!a.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}e(i),this.snapping&&(this.dragMove(),this.snapping=!1)}},e.prototype.findRulerSnapLine=function(t){return this.rulerSnapLines.find(function(e){return e.id===t})},e.prototype.addRulerSnapLine=function(t){O(t)&&(this.findRulerSnapLine(t.id)||this.rulerSnapLines.push(new cn(this,o(o({},t),{type:"ruler"}))))},e.prototype.removeRulerSnapLine=function(t){var e=this.rulerSnapLines.findIndex(function(e){return e.id===t});e>-1&&this.rulerSnapLines.splice(e,1)},e.prototype.dragStart=function(e){var n=null==e?void 0:e.dragNodes,o=null==e?void 0:e.type,r=null==e?void 0:e.direction;if("resize"===o)(i=on.filterResizable(n)).length&&(this.dragging=!0,this.type=o,this.direction=r,this.dragNodes=i,this.calcDragStartStore(i),this.cursor.setDragType(t.CursorDragType.Resize));else if("translate"===o){(i=on.filterTranslatable(n)).length&&(this.dragging=!0,this.type=o,this.direction=r,this.dragNodes=i,this.calcDragStartStore(i),this.cursor.setDragType(t.CursorDragType.Translate))}else if("rotate"===o){(i=on.filterRotatable(n)).length&&(this.dragging=!0,this.type=o,this.dragNodes=i,this.calcDragStartStore(i),this.cursor.setDragType(t.CursorDragType.Rotate))}else if("scale"===o){(i=on.filterScalable(n)).length&&(this.dragging=!0,this.type=o,this.dragNodes=i,this.calcDragStartStore(i),this.cursor.setDragType(t.CursorDragType.Scale))}else if("round"===o){var i;(i=on.filterRoundable(n)).length&&(this.dragging=!0,this.type=o,this.dragNodes=i,this.calcDragStartStore(i),this.cursor.setDragType(t.CursorDragType.Round))}this.dragging&&this.calcViewportNodes()},e.prototype.dragMove=function(){this.dragging&&(this.draggingNodesRect=null,this.draggingNodesRect=this.dragNodesRect,this.rulerSnapLines=this.calcRulerSnapLines(this.dragNodesRect),this.aroundSnapLines=this.calcAroundSnapLines(this.dragNodesRect),this.aroundSpaceBlocks=this.calcAroundSpaceBlocks(this.dragNodesRect))},e.prototype.dragEnd=function(){this.dragging=!1,this.viewportRectsStore={},this.dragStartTranslateStore={},this.aroundSnapLines=[],this.draggingNodesRect=null,this.aroundSpaceBlocks=null,this.dragStartNodesRect=null,this.dragNodes=[],this.cursor.setDragType(t.CursorDragType.Move)},e.prototype.makeObservable=function(){Formily.Reactive.define(this,{snapped:Formily.Reactive.observable.ref,dragging:Formily.Reactive.observable.ref,snapping:Formily.Reactive.observable.ref,dragNodes:Formily.Reactive.observable.ref,aroundSnapLines:Formily.Reactive.observable.ref,aroundSpaceBlocks:Formily.Reactive.observable.ref,rulerSnapLines:Formily.Reactive.observable.shallow,closestSnapLines:Formily.Reactive.observable.computed,thresholdSnapLines:Formily.Reactive.observable.computed,thresholdSpaceBlocks:Formily.Reactive.observable.computed,measurerSpaceBlocks:Formily.Reactive.observable.computed,cursor:Formily.Reactive.observable.computed,cursorPosition:Formily.Reactive.observable.computed,cursorOffset:Formily.Reactive.observable.computed,dragStartCursor:Formily.Reactive.observable.computed,translate:Formily.Reactive.action,dragStart:Formily.Reactive.action,dragMove:Formily.Reactive.action,dragEnd:Formily.Reactive.action})},e.threshold=6,e}();t.ClosestPosition=void 0,(un=t.ClosestPosition||(t.ClosestPosition={})).Before="BEFORE",un.ForbidBefore="FORBID_BEFORE",un.After="After",un.ForbidAfter="FORBID_AFTER",un.Upper="UPPER",un.ForbidUpper="FORBID_UPPER",un.Under="UNDER",un.ForbidUnder="FORBID_UNDER",un.Inner="INNER",un.ForbidInner="FORBID_INNER",un.InnerAfter="INNER_AFTER",un.ForbidInnerAfter="FORBID_INNER_AFTER",un.InnerBefore="INNER_BEFORE",un.ForbidInnerBefore="FORBID_INNER_BEFORE",un.Forbid="FORBID";var vn,gn,yn=function(){function e(t){this.dragNodes=[],this.touchNode=null,this.closestNode=null,this.activeViewport=null,this.viewportClosestRect=null,this.outlineClosestRect=null,this.viewportClosestOffsetRect=null,this.outlineClosestOffsetRect=null,this.viewportClosestDirection=null,this.outlineClosestDirection=null,this.dragging=!1,this.operation=t.operation,this.rootNode=this.operation.tree,this.makeObservable()}return Object.defineProperty(e.prototype,"cursor",{get:function(){return this.operation.engine.cursor},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"viewport",{get:function(){return this.operation.workspace.viewport},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"outline",{get:function(){return this.operation.workspace.outline},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasDragNodes",{get:function(){return this.dragNodes.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"closestDirection",{get:function(){return this.activeViewport===this.outline?this.outlineClosestDirection:this.viewportClosestDirection},enumerable:!1,configurable:!0}),e.prototype.getClosestLayout=function(t){return t.getValidNodeLayout(this.closestNode)},e.prototype.calcClosestPosition=function(e,n){var o=this,r=this.closestNode;if(!r||!n.isPointInViewport(e))return t.ClosestPosition.Forbid;var a=n.getValidNodeRect(r),c="horizontal"===this.getClosestLayout(n);if(a){var l,u=function(t,e,n){return void 0===n&&(n=!1),n?Math.abs(t.x-e.x)+Math.abs(t.y-e.y)>Math.abs(t.x-(e.x+e.width))+Math.abs(t.y-(e.y+e.height)):Math.abs(t.y-e.y)>Math.abs(t.y-(e.y+e.height))}(e,a,"block"!==n.moveInsertionType&&c),d=function(t){var e;if(t)return(null===(e=t.parent)||void 0===e?void 0:e.allowSibling(o.dragNodes))?t.parent:d(t.parent)};return L(e,a,n.moveSensitive)?r.allowAppend(this.dragNodes)?r.contains.apply(r,s([],i(this.dragNodes),!1))?u?t.ClosestPosition.InnerAfter:t.ClosestPosition.InnerBefore:t.ClosestPosition.Inner:r.allowSibling(this.dragNodes)?c?u?t.ClosestPosition.After:t.ClosestPosition.Before:u?t.ClosestPosition.Under:t.ClosestPosition.Upper:((l=d(r))&&(this.closestNode=l),c?l?u?t.ClosestPosition.After:t.ClosestPosition.Before:u?t.ClosestPosition.ForbidAfter:t.ClosestPosition.ForbidBefore:l?u?t.ClosestPosition.Under:t.ClosestPosition.Upper:u?t.ClosestPosition.ForbidUnder:t.ClosestPosition.ForbidUpper):r===r.root?u?t.ClosestPosition.InnerAfter:t.ClosestPosition.InnerBefore:r.allowSibling(this.dragNodes)?c?u?t.ClosestPosition.After:t.ClosestPosition.Before:u?t.ClosestPosition.Under:t.ClosestPosition.Upper:((l=d(r))&&(this.closestNode=l),c?l?u?t.ClosestPosition.After:t.ClosestPosition.Before:u?t.ClosestPosition.ForbidAfter:t.ClosestPosition.ForbidBefore:l?u?t.ClosestPosition.Under:t.ClosestPosition.Upper:u?t.ClosestPosition.ForbidUnder:t.ClosestPosition.ForbidUpper)}},e.prototype.calcClosestNode=function(t,e){var n,o;if(this.touchNode){var r=e.getValidNodeRect(this.touchNode);if(!r)return;if(null===(o=null===(n=this.touchNode)||void 0===n?void 0:n.children)||void 0===o?void 0:o.length){var i=function(t,e){var n=Math.abs(t.y-e.y),o=Math.abs(t.y-(e.y+e.height)),r=Math.abs(t.x-e.x),i=Math.abs(t.x-(e.x+e.width));return Math.min(n,o,r,i)}(t,r),s=i,a=this.touchNode;return this.touchNode.eachChildren(function(n){var o=e.getElementRectById(n.id);if(o){var r=L(t,o,e.moveSensitive)?0:function(t,e){var n=Math.min(Math.abs(t.x-e.x),Math.abs(t.x-(e.x+e.width))),o=Math.min(Math.abs(t.y-e.y),Math.abs(t.y-(e.y+e.height)));return t.x>=e.x&&t.x<=e.x+e.width&&(n=0),t.y>=e.y&&t.y<=e.y+e.height&&(o=0),Math.sqrt(Math.pow(n,2)+Math.pow(o,2))}(t,o);r<=s&&(s=r,a=n)}}),a}return this.touchNode}return this.operation.tree},e.prototype.calcClosestRect=function(e,n){var o=this.closestNode;if(o&&n){var r=e.getValidNodeRect(o);return n===t.ClosestPosition.InnerAfter||n===t.ClosestPosition.InnerBefore?e.getChildrenRect(o):r}},e.prototype.calcClosestOffsetRect=function(e,n){var o=this.closestNode;if(o&&n){var r=e.getValidNodeOffsetRect(o);return n===t.ClosestPosition.InnerAfter||n===t.ClosestPosition.InnerBefore?e.getChildrenOffsetRect(o):r}},e.prototype.dragStart=function(e){var n=on.filterDraggable(null==e?void 0:e.dragNodes);n.length&&(this.dragNodes=n,this.trigger(new mt({target:this.operation.tree,source:this.dragNodes})),this.viewport.cacheElements(),this.cursor.setDragType(t.CursorDragType.Move),this.dragging=!0)},e.prototype.dragMove=function(t){var e=t.point,n=t.touchNode;this.dragging&&(this.outline.isPointInViewport(e,!1)?(this.activeViewport=this.outline,this.touchNode=n,this.closestNode=this.calcClosestNode(e,this.outline)):this.viewport.isPointInViewport(e,!1)&&(this.activeViewport=this.viewport,this.touchNode=n,this.closestNode=this.calcClosestNode(e,this.viewport)),this.activeViewport&&(this.activeViewport===this.outline?(this.outlineClosestDirection=this.calcClosestPosition(e,this.outline),this.viewportClosestDirection=this.outlineClosestDirection):(this.viewportClosestDirection=this.calcClosestPosition(e,this.viewport),this.outlineClosestDirection=this.viewportClosestDirection),this.outline.mounted&&(this.outlineClosestRect=this.calcClosestRect(this.outline,this.outlineClosestDirection),this.outlineClosestOffsetRect=this.calcClosestOffsetRect(this.outline,this.outlineClosestDirection)),this.viewport.mounted&&(this.viewportClosestRect=this.calcClosestRect(this.viewport,this.viewportClosestDirection),this.viewportClosestOffsetRect=this.calcClosestOffsetRect(this.viewport,this.viewportClosestDirection))))},e.prototype.dragDrop=function(t){this.trigger(new bt({target:this.operation.tree,source:null==t?void 0:t.dropNode}))},e.prototype.dragEnd=function(){this.dragging=!1,this.dragNodes=[],this.touchNode=null,this.closestNode=null,this.activeViewport=null,this.outlineClosestDirection=null,this.outlineClosestOffsetRect=null,this.outlineClosestRect=null,this.viewportClosestDirection=null,this.viewportClosestOffsetRect=null,this.viewportClosestRect=null,this.viewport.clearCache()},e.prototype.trigger=function(t){if(this.operation)return this.operation.dispatch(t)},e.prototype.makeObservable=function(){Formily.Reactive.define(this,{dragging:Formily.Reactive.observable.ref,dragNodes:Formily.Reactive.observable.ref,touchNode:Formily.Reactive.observable.ref,closestNode:Formily.Reactive.observable.ref,outlineClosestDirection:Formily.Reactive.observable.ref,outlineClosestOffsetRect:Formily.Reactive.observable.ref,outlineClosestRect:Formily.Reactive.observable.ref,viewportClosestDirection:Formily.Reactive.observable.ref,viewportClosestOffsetRect:Formily.Reactive.observable.ref,viewportClosestRect:Formily.Reactive.observable.ref,dragStart:Formily.Reactive.action,dragMove:Formily.Reactive.action,dragEnd:Formily.Reactive.action})},e}(),mn=function(){function t(t){this.requests={snapshot:null},this.engine=t.engine,this.workspace=t,this.tree=new on(o(o({componentName:this.engine.props.rootComponentName},this.engine.props.defaultComponentTree),{operation:this})),this.hover=new an({operation:this}),this.selection=new sn({operation:this}),this.moveHelper=new yn({operation:this}),this.transformHelper=new fn({operation:this}),this.selection.select(this.tree)}return t.prototype.dispatch=function(t,e){if(!1!==this.workspace.dispatch(t))return l(e)?e():void 0},t.prototype.snapshot=function(t){var e=this;rt(this.requests.snapshot),this.workspace&&this.workspace.history&&!this.workspace.history.locking&&(this.requests.snapshot=ot(function(){e.workspace.history.push(t)}))},t.prototype.from=function(t){t&&(t.tree&&this.tree.from(t.tree),t.selected&&(this.selection.selected=t.selected))},t.prototype.serialize=function(){return{tree:this.tree.serialize(),selected:[this.tree.id]}},t}(),bn=function(){function t(t,e){this.current=0,this.history=[],this.updateTimer=null,this.maxSize=100,this.locking=!1,this.context=t,this.props=e,this.push(),this.makeObservable()}return t.prototype.makeObservable=function(){Formily.Reactive.define(this,{current:Formily.Reactive.observable.ref,history:Formily.Reactive.observable.shallow,push:Formily.Reactive.action,undo:Formily.Reactive.action,redo:Formily.Reactive.action,goTo:Formily.Reactive.action,clear:Formily.Reactive.action})},t.prototype.list=function(){return this.history},t.prototype.push=function(t){var e;if(!this.locking){this.current<this.history.length-1&&(this.history=this.history.slice(0,this.current+1));var n={data:this.context.serialize(),timestamp:Date.now(),type:t};this.current=this.history.length,this.history.push(n);var o=this.history.length-this.maxSize;o>0&&(this.history.splice(0,o),this.current=this.history.length-1),(null===(e=this.props)||void 0===e?void 0:e.onPush)&&this.props.onPush(n)}},Object.defineProperty(t.prototype,"allowUndo",{get:function(){return this.history.length>0&&this.current-1>=0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"allowRedo",{get:function(){return this.history.length>this.current+1},enumerable:!1,configurable:!0}),t.prototype.redo=function(){var t;if(this.allowRedo){var e=this.history[this.current+1];this.locking=!0,this.context.from(e.data),this.locking=!1,this.current++,(null===(t=this.props)||void 0===t?void 0:t.onRedo)&&this.props.onRedo(e)}},t.prototype.undo=function(){var t;if(this.allowUndo){var e=this.history[this.current-1];this.locking=!0,this.context.from(e.data),this.locking=!1,this.current--,(null===(t=this.props)||void 0===t?void 0:t.onUndo)&&this.props.onUndo(e)}},t.prototype.goTo=function(t){var e,n=this.history[t];n&&(this.locking=!0,this.context.from(n.data),this.locking=!1,this.current=t,(null===(e=this.props)||void 0===e?void 0:e.onGoto)&&this.props.onGoto(n))},t.prototype.clear=function(){this.history=[],this.current=0},t}(),wn=function(){function t(t,e){var n=this;this.engine=t,this.props=e,this.id=e.id||V(),this.title=e.title,this.description=e.description,this.viewport=new rn({engine:this.engine,workspace:this,viewportElement:e.viewportElement,contentWindow:e.contentWindow,nodeIdAttrName:this.engine.props.nodeIdAttrName,moveSensitive:!0,moveInsertionType:"all"}),this.outline=new rn({engine:this.engine,workspace:this,viewportElement:e.viewportElement,contentWindow:e.contentWindow,nodeIdAttrName:this.engine.props.outlineNodeIdAttrName,moveSensitive:!1,moveInsertionType:"block"}),this.operation=new mn(this),this.history=new bn(this,{onPush:function(t){n.operation.dispatch(new Ut(t))},onRedo:function(t){n.operation.hover.clear(),n.operation.dispatch(new Yt(t))},onUndo:function(t){n.operation.hover.clear(),n.operation.dispatch(new Xt(t))},onGoto:function(t){n.operation.hover.clear(),n.operation.dispatch(new Vt(t))}})}return t.prototype.getEventContext=function(){return{workbench:this.engine.workbench,workspace:this,engine:this.engine,viewport:this.viewport}},t.prototype.attachEvents=function(t,e){this.engine.attachEvents(t,e,this.getEventContext())},t.prototype.detachEvents=function(t){this.engine.detachEvents(t)},t.prototype.dispatch=function(t){return this.engine.dispatch(t,this.getEventContext())},t.prototype.serialize=function(){return{id:this.id,title:this.title,description:this.description,operation:this.operation.serialize()}},t.prototype.from=function(t){t&&(t.operation&&this.operation.from(t.operation),t.id&&(this.id=t.id),t.title&&(this.title=t.title),t.description&&(this.description=t.description))},t}(),En=function(){function t(t){this.type="DESIGNABLE",this.engine=t,this.workspaces=[],this.currentWorkspace=null,this.activeWorkspace=null,this.makeObservable()}return t.prototype.makeObservable=function(){Formily.Reactive.define(this,{currentWorkspace:Formily.Reactive.observable.ref,workspaces:Formily.Reactive.observable.shallow,activeWorkspace:Formily.Reactive.observable.ref,type:Formily.Reactive.observable.ref,switchWorkspace:Formily.Reactive.action,addWorkspace:Formily.Reactive.action,removeWorkspace:Formily.Reactive.action,setActiveWorkspace:Formily.Reactive.action,setWorkbenchType:Formily.Reactive.action})},t.prototype.getEventContext=function(){return{engine:this.engine,workbench:this.engine.workbench,workspace:null,viewport:null}},t.prototype.switchWorkspace=function(t){var e=this.findWorkspaceById(t);return e&&(this.currentWorkspace=e,this.engine.dispatch(new jt(e))),this.currentWorkspace},t.prototype.setActiveWorkspace=function(t){return this.activeWorkspace=t,t},t.prototype.setWorkbenchType=function(t){this.type=t},t.prototype.addWorkspace=function(t){var e=this.findWorkspaceById(t.id);return e||(this.currentWorkspace=new wn(this.engine,t),this.workspaces.push(this.currentWorkspace),this.engine.dispatch(new Wt(this.currentWorkspace)),this.currentWorkspace)},t.prototype.removeWorkspace=function(t){var e=this.findWorkspaceIndexById(t);if(e>-1&&e<this.workspaces.length){var n=this.workspaces[e];n.viewport.detachEvents(),this.workspaces.splice(e,1),n===this.currentWorkspace&&(this.workspaces.length&&this.workspaces[e]?this.currentWorkspace=this.workspaces[e]:this.currentWorkspace=this.workspaces[this.workspaces.length-1]),this.engine.dispatch(new zt(n))}},t.prototype.ensureWorkspace=function(t){void 0===t&&(t={});var e=this.findWorkspaceById(t.id);return e||(this.addWorkspace(t),this.currentWorkspace)},t.prototype.findWorkspaceById=function(t){return this.workspaces.find(function(e){return e.id===t})},t.prototype.findWorkspaceIndexById=function(t){return this.workspaces.findIndex(function(e){return e.id===t})},t.prototype.mapWorkspace=function(t){return this.workspaces.map(t)},t.prototype.eachWorkspace=function(t){this.workspaces.forEach(t)},t}(),Sn=function(){function t(t){this.codes=this.parseCodes(t.codes),this.handler=t.handler,this.matcher=t.matcher}return t.prototype.parseCodes=function(t){var e=[];return t.forEach(function(t){Array.isArray(t)?e.push(t):e.push([t])}),e},t.prototype.preventCodes=function(e){var n;if(this.codes.length){for(var o=0;o<e.length;o++)for(var r=null!==(n=this.codes[o])&&void 0!==n?n:[],i=0;i<r.length;i++)if(!t.matchCode(e[i],r[i]))return!1;return!0}return!1},t.prototype.matched=function(t,e){return l(this.handler)&&t&&this.handler(e),t},t.prototype.match=function(e,n){var o=this;return this.codes.some(function(r){var i=t.sortCodes(r),s=t.sortCodes(e);if(l(o.matcher))return o.matched(o.matcher(s),n);if(s.length!==i.length)return o.matched(!1,n);for(var a=0;a<i.length;a++)if(!t.matchCode(s[a],i[a]))return o.matched(!1,n);return o.matched(!0,n)})},t.matchCode=function(t,e){var n,o;return(null===(n=null==t?void 0:t.toLocaleLowerCase)||void 0===n?void 0:n.call(t))===(null===(o=null==e?void 0:e.toLocaleLowerCase)||void 0===o?void 0:o.call(e))},t.sortCodes=function(t){return t.map(function(t){return t.toLocaleLowerCase()}).sort()},t}(),Cn=[["metaKey",t.KeyCode.Meta],["shiftKey",t.KeyCode.Shift],["ctrlKey",t.KeyCode.Control],["altKey",t.KeyCode.Alt]],Rn=function(){function t(t){var e;this.shortcuts=[],this.sequence=[],this.keyDown=null,this.modifiers={},this.requestTimer=null,this.engine=t,this.shortcuts=(null===(e=t.props)||void 0===e?void 0:e.shortcuts)||[],this.makeObservable()}return t.prototype.matchCodes=function(t){for(var e=0;e<this.shortcuts.length;e++){if(this.shortcuts[e].match(this.sequence,t))return!0}return!1},t.prototype.preventCodes=function(){var t=this;return this.shortcuts.some(function(e){return e.preventCodes(t.sequence)})},t.prototype.includes=function(t){return this.sequence.some(function(e){return Sn.matchCode(e,t)})},t.prototype.excludes=function(t){this.sequence=this.sequence.filter(function(e){return!Sn.matchCode(t,e)})},t.prototype.addKeyCode=function(t){this.includes(t)||this.sequence.push(t)},t.prototype.removeKeyCode=function(t){this.includes(t)&&this.excludes(t)},t.prototype.isModifier=function(t){return Cn.some(function(e){return Sn.matchCode(e[1],t)})},t.prototype.handleModifiers=function(t){var e=this;Cn.forEach(function(n){var o=i(n,2),r=o[0],s=o[1];t[r]&&(e.includes(s)||(e.sequence=[s].concat(e.sequence)))})},t.prototype.handleKeyboard=function(t,e){"keydown"===t.eventType?(this.keyDown=t.data,this.addKeyCode(this.keyDown),this.handleModifiers(t),this.matchCodes(e)&&(this.sequence=[]),this.requestClean(4e3),this.preventCodes()&&(t.preventDefault(),t.stopPropagation())):(this.isModifier(t.data)&&(this.sequence=[]),this.keyDown=null)},t.prototype.isKeyDown=function(t){return this.keyDown===t},t.prototype.requestClean=function(t){var e=this;void 0===t&&(t=320),clearTimeout(this.requestTimer),this.requestTimer=setTimeout(function(){e.keyDown=null,e.sequence=[],clearTimeout(e.requestTimer)},t)},t.prototype.makeObservable=function(){Formily.Reactive.define(this,{sequence:Formily.Reactive.observable.shallow,keyDown:Formily.Reactive.observable.ref,handleKeyboard:Formily.Reactive.action})},t}();t.ScreenType=void 0,(vn=t.ScreenType||(t.ScreenType={})).PC="PC",vn.Responsive="Responsive",vn.Mobile="Mobile",vn.Sketch="Sketch",t.ScreenStatus=void 0,(gn=t.ScreenStatus||(t.ScreenStatus={})).Normal="Normal",gn.Resizing="Resizing",gn.Zooming="Zooming";var Nn=function(){function e(e){this.scale=1,this.width="100%",this.height="100%",this.background="",this.flip=!1,this.status=t.ScreenStatus.Normal,this.engine=e,this.type=e.props.defaultScreenType,this.makeObservable()}return e.prototype.makeObservable=function(){Formily.Reactive.define(this,{type:Formily.Reactive.observable.ref,scale:Formily.Reactive.observable.ref,width:Formily.Reactive.observable.ref,height:Formily.Reactive.observable.ref,status:Formily.Reactive.observable.ref,flip:Formily.Reactive.observable.ref,background:Formily.Reactive.observable.ref,setType:Formily.Reactive.action,setScale:Formily.Reactive.action,setSize:Formily.Reactive.action,resetSize:Formily.Reactive.action,setBackground:Formily.Reactive.action,setFlip:Formily.Reactive.action})},e.prototype.setStatus=function(t){this.status=t},e.prototype.setType=function(t){this.type=t},e.prototype.setScale=function(t){this.scale=t},e.prototype.setSize=function(t,e){t&&(this.width=t),e&&(this.height=e)},e.prototype.resetSize=function(){this.width="100%",this.height="100%"},e.prototype.setBackground=function(t){this.background=t},e.prototype.setFlip=function(t){this.flip=t},e}(),xn=function(e){function r(t){var n=e.call(this,t)||this;return n.props=o(o({},r.defaultProps),t),n.init(),n.id=V(),n}return n(r,e),r.prototype.init=function(){this.workbench=new En(this),this.screen=new Nn(this),this.cursor=new pn(this),this.keyboard=new Rn(this)},r.prototype.setCurrentTree=function(t){this.workbench.currentWorkspace&&this.workbench.currentWorkspace.operation.tree.from(t)},r.prototype.getCurrentTree=function(){var t,e,n;return null===(n=null===(e=null===(t=this.workbench)||void 0===t?void 0:t.currentWorkspace)||void 0===e?void 0:e.operation)||void 0===n?void 0:n.tree},r.prototype.getAllSelectedNodes=function(){for(var t=[],e=0;e<this.workbench.workspaces.length;e++){var n=this.workbench.workspaces[e];t=t.concat(n.operation.selection.selectedNodes)}return t},r.prototype.findNodeById=function(t){return on.findById(t)},r.prototype.findMovingNodes=function(){var t=[];return this.workbench.eachWorkspace(function(e){var n;null===(n=e.operation.moveHelper.dragNodes)||void 0===n||n.forEach(function(e){t.includes(e)||t.push(e)})}),t},r.prototype.createNode=function(t,e){return new on(t,e)},r.prototype.mount=function(){this.attachEvents(m)},r.prototype.unmount=function(){this.detachEvents()},r.defaultProps={shortcuts:[],effects:[],drivers:[],rootComponentName:"Root",sourceIdAttrName:"data-designer-source-id",nodeIdAttrName:"data-designer-node-id",contentEditableAttrName:"data-content-editable",contentEditableNodeIdAttrName:"data-content-editable-node-id",clickStopPropagationAttrName:"data-click-stop-propagation",nodeSelectionIdAttrName:"data-designer-node-helpers-id",nodeDragHandlerAttrName:"data-designer-node-drag-handler",screenResizeHandlerAttrName:"data-designer-screen-resize-handler",nodeResizeHandlerAttrName:"data-designer-node-resize-handler",outlineNodeIdAttrName:"data-designer-outline-node-id",nodeTranslateAttrName:"data-designer-node-translate-handler",defaultScreenType:t.ScreenType.PC},r}(x);function kn(t){var e=m.getSelection();if(!e.containsNode(t)){var n=function(t){for(var e=[],n=0;n<t.rangeCount;n++){var o=t.getRangeAt(n);e[n]={collapsed:o.collapsed,startOffset:o.startOffset,endOffset:o.endOffset}}return e}(e);return function(e){void 0===e&&(e=0);var o=m.getSelection(),r=t.childNodes[0];r&&(o.removeAllRanges(),n.forEach(function(t){var n=document.createRange();n.collapse(t.collapsed),n.setStart(r,t.startOffset+e),n.setEnd(r,t.endOffset+e),o.addRange(n)}))}}}var Pn,Tn=new Sn({codes:[[t.KeyCode.Meta],[t.KeyCode.Control]]}),Dn=new Sn({codes:[t.KeyCode.Shift]}),On=new Sn({codes:[[t.KeyCode.Meta,t.KeyCode.X],[t.KeyCode.Control,t.KeyCode.X]]}),An=new Sn({codes:[[t.KeyCode.Meta,t.KeyCode.A],[t.KeyCode.Control,t.KeyCode.A]],handler:function(t){var e=null==t?void 0:t.workspace.operation;if(e){var n=e.tree;e.selection.batchSelect(n.descendants)}}}),Fn=new Sn({codes:[[t.KeyCode.Backspace],[t.KeyCode.Delete]],handler:function(t){var e=null==t?void 0:t.workspace.operation;e&&on.remove(e.selection.selectedNodes)}}),Mn={nodes:[]},In=new Sn({codes:[[t.KeyCode.Meta,t.KeyCode.C],[t.KeyCode.Control,t.KeyCode.C]],handler:function(t){var e=null==t?void 0:t.workspace.operation;e&&(Mn.nodes=e.selection.selectedNodes)}}),Ln=new Sn({codes:[[t.KeyCode.Meta,t.KeyCode.V],[t.KeyCode.Control,t.KeyCode.V]],handler:function(t){(null==t?void 0:t.workspace.operation)&&on.clone(Mn.nodes)}}),Bn=new Sn({codes:[[t.KeyCode.Meta,t.KeyCode.Z],[t.KeyCode.Control,t.KeyCode.Z]],handler:function(t){var e=null==t?void 0:t.workspace;e&&e.history.undo(),e.operation.hover.clear()}}),Wn=new Sn({codes:[[t.KeyCode.Meta,t.KeyCode.Shift,t.KeyCode.Z],[t.KeyCode.Control,t.KeyCode.Shift,t.KeyCode.Z]],handler:function(t){var e=null==t?void 0:t.workspace;e&&e.history.redo(),e.operation.hover.clear()}}),zn=new Sn({codes:[t.KeyCode.Shift,t.KeyCode.S],handler:function(e){var n=null==e?void 0:e.engine;n&&n.cursor.setType(t.CursorType.Selection)}}),jn=function(t){return t&&t.lastChild?jn(t.lastChild):t},Kn=function(t){var e;return t.parent?(null===(e=t.parent)||void 0===e?void 0:e.next)?t.parent.next:Kn(t.parent):t},Xn=new Sn({codes:[[t.KeyCode.Up],[t.KeyCode.PageUp],[t.KeyCode.ArrowUp],[t.KeyCode.Left],[t.KeyCode.LeftWindowKey],[t.KeyCode.ArrowLeft]],handler:function(t){var e=null==t?void 0:t.workspace.operation;if(e){var n=e.tree,o=e.selection,r=n.findById(o.last);if(r){var i=r.previous;if(i)(s=jn(i))?o.select(s):o.select(i);else if(r.parent)o.select(r.parent);else{var s;(s=jn(r.lastChild))&&o.select(s)}}}}}),Yn=new Sn({codes:[[t.KeyCode.Down],[t.KeyCode.PageDown],[t.KeyCode.ArrowDown],[t.KeyCode.Right],[t.KeyCode.RightWindowKey],[t.KeyCode.ArrowRight]],handler:function(t){var e=null==t?void 0:t.workspace.operation;if(e){var n=e.tree,o=e.selection,r=n.findById(o.last);if(r){var i=r.firstChild?r.firstChild:r.next;i?o.select(i):o.select(Kn(r))}}}}),Vn=[function(e){e.subscribeTo(ut,function(n){e.cursor.dragType===t.CursorDragType.Move&&(e.workbench.eachWorkspace(function(t){var o=t.viewport,r=new F(n.data.topClientX,n.data.topClientY),s=o.getOffsetPoint(new F(e.cursor.dragStartPosition.topClientX,e.cursor.dragStartPosition.topClientY)),a=o.getOffsetPoint(new F(e.cursor.position.topClientX,e.cursor.position.topClientY));if(o.isPointInViewport(r,!1)){var c=t.operation.tree,l=function(t,e,n,o){void 0===n&&(n=0),void 0===o&&(o=0);var r=0,i=0;return e.x+n>=t.x&&e.y+o>=t.y?(r=t.x,i=t.y,new M(r-n,i-o,Math.abs(e.x-t.x+n),Math.abs(e.y-t.y+o))):e.x+n<t.x&&e.y+o<t.y?(r=e.x,i=e.y,new M(r,i,Math.abs(e.x-t.x+n),Math.abs(e.y-t.y+o))):e.x+n<t.x&&e.y+o>=t.y?(r=e.x,i=t.y,new M(r-n,i-o,Math.abs(e.x-t.x+n),Math.abs(e.y-t.y+o))):(r=t.x,i=e.y,new M(r,i,Math.abs(e.x-t.x+n),Math.abs(e.y-t.y+o)))}(s,a,o.dragScrollXDelta,o.dragScrollYDelta),u=[];c.eachChildren(function(t){var e,n,r,i,s=o.getValidNodeOffsetRect(t);s&&(n=s,r=new F((e=l).x+e.width/2,e.y+e.height/2),i=new F(n.x+n.width/2,n.y+n.height/2),Math.abs(r.x-i.x)<=e.width/2+n.width/2&&Math.abs(r.y-i.y)<=e.height/2+n.height/2)&&u.push([t,s])});var d=u.reduce(function(t,e){var n=i(e,2),o=n[0];return B(n[1],l)&&u.some(function(t){return i(t,1)[0].isMyParents(o)})?t:t.concat(o)},[]);t.operation.selection.batchSafeSelect(d)}}),e.cursor.type===t.CursorType.Selection&&e.cursor.setType(t.CursorType.Normal))})},function(e){e.subscribeTo(pt,function(n){e.cursor.setStatus(e.cursor.status===t.CursorStatus.Dragging||e.cursor.status===t.CursorStatus.DragStart?e.cursor.status:t.CursorStatus.Normal),e.cursor.status!==t.CursorStatus.Dragging&&e.cursor.setPosition(n.data)}),e.subscribeTo(lt,function(n){e.cursor.setStatus(t.CursorStatus.DragStart),e.cursor.setDragStartPosition(n.data)}),e.subscribeTo(ct,function(n){e.cursor.setStatus(t.CursorStatus.Dragging),e.cursor.setPosition(n.data)}),e.subscribeTo(ut,function(n){e.cursor.setStatus(t.CursorStatus.DragStop),e.cursor.setDragEndPosition(n.data),e.cursor.setDragStartPosition(null),ot(function(){e.cursor.setStatus(t.CursorStatus.Normal)})}),e.subscribeTo(pt,function(n){var o,r,i=null===(o=null==n?void 0:n.context)||void 0===o?void 0:o.workspace;if(i){var s=i.operation;if(e.cursor.status===t.CursorStatus.Normal){var a=n.data.target,c=null===(r=null==a?void 0:a.closest)||void 0===r?void 0:r.call(a,"\n *[".concat(e.props.nodeIdAttrName,"],\n *[").concat(e.props.outlineNodeIdAttrName,"]\n "));if(null==c?void 0:c.getAttribute){var l=c.getAttribute(e.props.nodeIdAttrName),u=c.getAttribute(e.props.outlineNodeIdAttrName),d=s.tree.findById(l||u);d?s.hover.setHover(d):s.hover.clear()}}else s.hover.clear()}})},function(t){t.subscribeTo(It,function(t){var e,n=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.workspace;if(n){var o=n.viewport,r=n.outline;o.matchViewport(t.data.target)&&o.digestViewport(),r.matchViewport(t.data.target)&&r.digestViewport()}}),t.subscribeTo(Lt,function(t){var e,n=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.workspace;if(n){var o=n.viewport,r=n.outline;o.matchViewport(t.data.target)&&o.digestViewport(),r.matchViewport(t.data.target)&&r.digestViewport()}})},function(e){e.subscribeTo(lt,function(n){if(e.cursor.type===t.CursorType.Normal){var o=n.data.target,r=null==o?void 0:o.closest("\n *[".concat(e.props.nodeIdAttrName,"],\n *[").concat(e.props.sourceIdAttrName,"],\n *[").concat(e.props.outlineNodeIdAttrName,"]\n ")),i=null==o?void 0:o.closest("*[".concat(e.props.nodeDragHandlerAttrName,"]")),s=null==i?void 0:i.closest("*[".concat(e.props.nodeSelectionIdAttrName,"]"));if((null==r?void 0:r.getAttribute)||i){var a=null==r?void 0:r.getAttribute(e.props.sourceIdAttrName),c=null==r?void 0:r.getAttribute(e.props.outlineNodeIdAttrName),l=null==s?void 0:s.getAttribute(e.props.nodeSelectionIdAttrName),u=null==r?void 0:r.getAttribute(e.props.nodeIdAttrName);e.workbench.eachWorkspace(function(t){var n=t.operation.moveHelper;if(u||c||l){var o=e.findNodeById(c||u||l);if(o){if(!o.allowDrag())return;if(o===o.root)return;var r=e.getAllSelectedNodes().filter(function(t){return t.allowDrag()});r.some(function(t){return t===o})?n.dragStart({dragNodes:on.sort(r)}):n.dragStart({dragNodes:[o]})}}else if(a){var i=e.findNodeById(a);i&&n.dragStart({dragNodes:[i]})}}),e.cursor.setStyle("move")}}}),e.subscribeTo(ct,function(n){if(e.cursor.type===t.CursorType.Normal&&e.cursor.dragType===t.CursorDragType.Move){var o=n.data.target,r=null==o?void 0:o.closest("\n *[".concat(e.props.nodeIdAttrName,"],\n *[").concat(e.props.outlineNodeIdAttrName,"]\n ")),i=new F(n.data.topClientX,n.data.topClientY),s=null==r?void 0:r.getAttribute(e.props.nodeIdAttrName),a=null==r?void 0:r.getAttribute(e.props.outlineNodeIdAttrName);e.workbench.eachWorkspace(function(t){var e=t.operation,n=e.moveHelper,o=n.dragNodes,r=e.tree;if(o.length){var c=r.findById(a||s);n.dragMove({point:i,touchNode:c})}})}}),e.subscribeTo(Lt,function(n){var o,r;if(e.cursor.type===t.CursorType.Normal&&e.cursor.dragType===t.CursorDragType.Move){var i=new F(e.cursor.position.topClientX,e.cursor.position.topClientY),s=null!==(r=null===(o=null==n?void 0:n.context)||void 0===o?void 0:o.workspace)&&void 0!==r?r:e.workbench.activeWorkspace;if(s){var a=s.operation,c=a.moveHelper;if(c.dragNodes.length){var l=a.tree,u=s.viewport,d=s.outline,h=u.elementFromPoint(i),p=d.elementFromPoint(i),f=null==h?void 0:h.closest("\n *[".concat(e.props.nodeIdAttrName,"],\n *[").concat(e.props.outlineNodeIdAttrName,"]\n ")),v=null==p?void 0:p.closest("\n *[".concat(e.props.nodeIdAttrName,"],\n *[").concat(e.props.outlineNodeIdAttrName,"]\n ")),g=null==f?void 0:f.getAttribute(e.props.nodeIdAttrName),y=null==v?void 0:v.getAttribute(e.props.outlineNodeIdAttrName),m=l.findById(y||g);c.dragMove({point:i,touchNode:m})}}}}),e.subscribeTo(ut,function(){e.cursor.type===t.CursorType.Normal&&e.cursor.dragType===t.CursorDragType.Move&&(e.workbench.eachWorkspace(function(e){var n=e.operation,o=n.moveHelper,r=o.dragNodes,a=o.closestNode,c=o.closestDirection,l=n.selection;r.length&&(r.length&&a&&c&&(c===t.ClosestPosition.After||c===t.ClosestPosition.Under?a.allowSibling(r)&&l.batchSafeSelect(a.insertAfter.apply(a,s([],i(on.filterDroppable(r,a.parent)),!1))):c===t.ClosestPosition.Before||c===t.ClosestPosition.Upper?a.allowSibling(r)&&l.batchSafeSelect(a.insertBefore.apply(a,s([],i(on.filterDroppable(r,a.parent)),!1))):c===t.ClosestPosition.Inner||c===t.ClosestPosition.InnerAfter?a.allowAppend(r)&&(l.batchSafeSelect(a.append.apply(a,s([],i(on.filterDroppable(r,a)),!1))),o.dragDrop({dropNode:a})):c===t.ClosestPosition.InnerBefore&&a.allowAppend(r)&&(l.batchSafeSelect(a.prepend.apply(a,s([],i(on.filterDroppable(r,a)),!1))),o.dragDrop({dropNode:a}))),o.dragEnd())}),e.cursor.setStyle(""))})},function(e){e.subscribeTo(dt,function(n){var o,r,i,s;if(e.cursor.status===t.CursorStatus.Normal){var a=n.data.target,c=null===(o=null==a?void 0:a.closest)||void 0===o?void 0:o.call(a,"\n *[".concat(e.props.nodeIdAttrName,"],\n *[").concat(e.props.outlineNodeIdAttrName,"]\n ")),l=null===(r=null==a?void 0:a.closest)||void 0===r?void 0:r.call(a,"*[".concat(e.props.nodeSelectionIdAttrName,"]")),u=null!==(s=null===(i=n.context)||void 0===i?void 0:i.workspace)&&void 0!==s?s:e.workbench.activeWorkspace;if(u)if(null==c?void 0:c.getAttribute){var d=c.getAttribute(e.props.nodeIdAttrName),h=c.getAttribute(e.props.outlineNodeIdAttrName),p=u.operation,f=p.selection,v=p.tree,g=v.findById(d||h);g?(e.keyboard.requestClean(),e.keyboard.isKeyDown(t.KeyCode.Meta)||e.keyboard.isKeyDown(t.KeyCode.Control)?f.has(g)?f.selected.length>1&&f.remove(g):f.add(g):e.keyboard.isKeyDown(t.KeyCode.Shift)?f.has(g)?f.selected.length>1&&f.remove(g):f.crossAddTo(g):f.select(g)):f.select(v)}else{var y=new F(n.data.topClientX,n.data.topClientY),m=u.operation,b=u.viewport,w=u.outline,E=b.isPointInViewport(y,!1),S=w.isPointInViewport(y,!1);if(l)return;if(E||S){var C=m.selection,R=m.tree;C.select(R)}}}})},function(t){t.subscribeTo(vt,function(e){var n=t.keyboard;if(n){var o=t.workbench.activeWorkspace||t.workbench.currentWorkspace;n.handleKeyboard(e,o.getEventContext())}}),t.subscribeTo(gt,function(e){var n=t.keyboard;if(n){var o=t.workbench.activeWorkspace||t.workbench.currentWorkspace;n.handleKeyboard(e,o.getEventContext())}})},function(e){var n=null,o=null,r=null,i=null,s=function(s,a){e.cursor.status===t.CursorStatus.Dragging&&(n=P(s,"x",a.rect),o=P(s,"y",a.rect),n?(r&&r(),r=T(a.scrollContainer,"x",n.direction,n.speed)):r&&r(),o?(i&&i(),i=T(a.scrollContainer,"y",o.direction,o.speed)):i&&i())};e.subscribeTo(lt,function(){e.workbench.eachWorkspace(function(t){t.viewport.takeDragStartSnapshot()})}),e.subscribeTo(ct,function(t){e.workbench.eachWorkspace(function(e){var n=e.viewport,o=e.outline,r=new F(t.data.topClientX,t.data.topClientY);o.isPointInViewport(r)?s(r,o):n.isPointInViewport(r)&&s(r,n)})}),e.subscribeTo(ut,function(){n=null,o=null,r&&r(),i&&i()})},function(t){t.subscribeWith(["append:node","insert:after","insert:before","insert:children","drag:node","drop:node","prepend:node","remove:node","select:node","update:children","wrap:node","update:node:props"],function(e){var n;(null===(n=e.context)||void 0===n?void 0:n.workbench)&&t.workbench.setActiveWorkspace(e.context.workspace)}),t.subscribeTo(xt,function(e){t.workbench.eachWorkspace(function(t){t!==e.context.workspace&&t.operation.selection.clear()})})},function(t){var e={activeElements:new Map,queue:[],requestTimer:null,isComposition:!1};function n(t){"Enter"===t.key&&(t.stopPropagation(),t.preventDefault())}function o(n){var o=this,r=e.activeElements.get(this);if(n.stopPropagation(),n.preventDefault(),r){var i=n.target,s=function(){if(e.queue.length=0,!e.isComposition){var n=kn(i);Formily.Path.Path.setIn(r.props,o.getAttribute(t.props.contentEditableAttrName),null==i?void 0:i.textContent),ot(function(){r.takeSnapshot("update:node:props"),n()})}};e.queue.push(s),clearTimeout(e.requestTimer),e.requestTimer=setTimeout(s,600)}}function r(){clearTimeout(e.requestTimer),e.requestTimer=setTimeout(e.queue[e.queue.length-1],600)}function i(t){"compositionend"===t.type?(e.isComposition=!1,o(t)):(clearTimeout(e.requestTimer),e.isComposition=!0)}function s(n){n.preventDefault();var o=e.activeElements.get(this),r=n.clipboardData.getData("text"),i=m.getSelection(),s=n.target,a=i.getRangeAt(0),c=kn(s);a.deleteContents(),a.insertNode(document.createTextNode(r)),Formily.Path.Path.setIn(o.props,this.getAttribute(t.props.contentEditableAttrName),s.textContent),c(r.length)}t.subscribeTo(dt,function(n){var a,c=n.data.target,l=null===(a=null==c?void 0:c.closest)||void 0===a?void 0:a.call(c,"*[".concat(t.props.contentEditableAttrName,"]"));l&&"true"===l.getAttribute("contenteditable")||e.activeElements.forEach(function(t,n){e.activeElements.delete(n),n.removeAttribute("contenteditable"),n.removeAttribute("spellcheck"),n.removeEventListener("input",o),n.removeEventListener("compositionstart",i),n.removeEventListener("compositionupdate",i),n.removeEventListener("compositionend",i),n.removeEventListener("past",s),document.removeEventListener("selectionchange",r)})}),t.subscribeTo(ht,function(a){var c,l=a.data.target,u=null===(c=null==l?void 0:l.closest)||void 0===c?void 0:c.call(l,"*[".concat(t.props.contentEditableAttrName,"]")),d=t.workbench.activeWorkspace.operation.tree;if(u){var h=u.getAttribute("contenteditable");if("false"===h||!h){var p=function(e){if(e){var n=e.getAttribute(t.props.contentEditableNodeIdAttrName);if(n)return n;var o=e.closest("*[".concat(t.props.nodeIdAttrName,"]"));return o?o.getAttribute(t.props.nodeIdAttrName):void 0}}(u);if(p){var f=d.findById(p);f&&(e.activeElements.set(u,f),u.setAttribute("spellcheck","false"),u.setAttribute("contenteditable","true"),u.focus(),u.addEventListener("input",o),u.addEventListener("compositionstart",i),u.addEventListener("compositionupdate",i),u.addEventListener("compositionend",i),u.addEventListener("keydown",n),u.addEventListener("paste",s),document.addEventListener("selectionchange",r),function(t){var e=document.createRange();e.selectNodeContents(t),e.collapse(!1);var n=m.getSelection();n.removeAllRanges(),n.addRange(e)}(u))}}}})},function(e){e.subscribeTo(lt,function(t){var n,o,r=t.data.target,i=null!==(o=null===(n=t.context)||void 0===n?void 0:n.workspace)&&void 0!==o?o:e.workbench.activeWorkspace,s=null==r?void 0:r.closest("*[".concat(e.props.nodeTranslateAttrName,"]"));if(i){var a=i.operation.transformHelper;if(s)if(s.getAttribute(e.props.nodeTranslateAttrName)){var c=s.closest("*[".concat(e.props.nodeSelectionIdAttrName,"]"));if(c){var l=c.getAttribute(e.props.nodeSelectionIdAttrName);if(l){var u=e.findNodeById(l);u&&a.dragStart({dragNodes:[u],type:"translate"})}}}}}),e.subscribeTo(ct,function(n){var o,r;if(e.cursor.dragType===t.CursorDragType.Translate){var i=null!==(r=null===(o=n.context)||void 0===o?void 0:o.workspace)&&void 0!==r?r:e.workbench.activeWorkspace,s=null==i?void 0:i.operation.transformHelper,a=s.dragNodes;a.length&&(s.dragMove(),a.forEach(function(t){var e=t.getElement();s.translate(t,function(t){e.style.position="absolute",e.style.left="0px",e.style.top="0px",e.style.transform="translate3d(".concat(t.x,"px,").concat(t.y,"px,0)")})}))}}),e.subscribeTo(ut,function(n){var o,r;if(e.cursor.dragType===t.CursorDragType.Translate){var i=null!==(r=null===(o=n.context)||void 0===o?void 0:o.workspace)&&void 0!==r?r:e.workbench.activeWorkspace,s=null==i?void 0:i.operation.transformHelper;s&&s.dragEnd()}})},function(e){e.subscribeTo(lt,function(t){var n,o,r=t.data.target,i=null!==(o=null===(n=t.context)||void 0===n?void 0:n.workspace)&&void 0!==o?o:e.workbench.activeWorkspace;if(i){var s=function(t){var n=null==t?void 0:t.closest("*[".concat(e.props.nodeResizeHandlerAttrName,"]"));if(n){var o=n.getAttribute(e.props.nodeResizeHandlerAttrName);if(o){var r=n.closest("*[".concat(e.props.nodeSelectionIdAttrName,"]"));if(r){var i=r.getAttribute(e.props.nodeSelectionIdAttrName);if(i){var s=e.findNodeById(i);if(s)return{direction:o,node:s,element:r}}}}}}(r),a=i.operation.transformHelper;if(s){var c=s.element.closest("*[".concat(e.props.nodeSelectionIdAttrName,"]"));if(c){var l=c.getAttribute(e.props.nodeSelectionIdAttrName);if(l){var u=e.findNodeById(l);u&&a.dragStart({dragNodes:[u],type:"resize",direction:s.direction})}}}}}),e.subscribeTo(ct,function(n){var o,r;if(e.cursor.dragType===t.CursorDragType.Resize){var i=null!==(r=null===(o=n.context)||void 0===o?void 0:o.workspace)&&void 0!==r?r:e.workbench.activeWorkspace,s=null==i?void 0:i.operation.transformHelper,a=s.dragNodes;a.length&&(s.dragMove(),a.forEach(function(t){var e=t.getElement();s.resize(t,function(t){e.style.width=t.width+"px",e.style.height=t.height+"px",e.style.position="absolute",e.style.left="0px",e.style.top="0px",e.style.transform="translate3d(".concat(t.x,"px,").concat(t.y,"px,0)")})}))}}),e.subscribeTo(ut,function(n){var o,r;if(e.cursor.dragType===t.CursorDragType.Resize){var i=null!==(r=null===(o=n.context)||void 0===o?void 0:o.workspace)&&void 0!==r?r:e.workbench.activeWorkspace,s=null==i?void 0:i.operation.transformHelper;s&&s.dragEnd()}})}],Un=[Gt,qt,Ht,Le,Be,Ke],_n=[On,Tn,An,Dn,Fn,In,Ln,Xn,Yn,Bn,Wn,zn],qn=function(t){return(null==t?void 0:t.Behavior)&&Hn(t.Behavior)},Hn=function(t){return Array.isArray(t)&&t.every(Gn)},Gn=function(t){return(null==t?void 0:t.name)||(null==t?void 0:t.selector)||(null==t?void 0:t.extends)||(null==t?void 0:t.designerProps)||(null==t?void 0:t.designerLocales)},$n=function(t){return(null==t?void 0:t.Resource)&&Zn(t.Resource)},Zn=function(t){return Array.isArray(t)&&t.every(Jn)},Jn=function(t){return(null==t?void 0:t.node)&&!!t.node.isSourceNode&&t.node instanceof on},Qn=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n={};return t.forEach(function(t){Ye(n,t)}),n},to=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.reduce(function(t,e){if(d(e))return t.concat(to.apply(void 0,s([],i(e),!1)));var n=(e||{}).selector;return n?("string"==typeof n&&(e.selector=function(t){return t.componentName===n}),t.concat(e)):t},[])},eo=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.reduce(function(t,e){return t.concat(o(o({},e),{node:new on({componentName:"$$ResourceNode$$",isSourceNode:!0,children:e.elements||[]})}))},[])},no=function(t){void 0===t&&(t={});var e=t.drivers||[],n=t.effects||[],r=t.shortcuts||[];return Formily.Reactive.untracked(function(){return new xn(o(o({},t),{effects:s(s([],i(n),!1),i(Vn),!1),drivers:s(s([],i(e),!1),i(Un),!1),shortcuts:s(s([],i(r),!1),i(_n),!1)}))})},oo=Object.freeze({__proto__:null,AddWorkspaceEvent:Wt,AppendNodeEvent:At,CloneNodeEvent:Ot,get ClosestPosition(){return t.ClosestPosition},Cursor:pn,get CursorDragType(){return t.CursorDragType},get CursorStatus(){return t.CursorStatus},get CursorType(){return t.CursorType},DragMoveEvent:ct,DragNodeEvent:mt,DragStartEvent:lt,DragStopEvent:ut,DropNodeEvent:bt,Engine:xn,FromNodeEvent:Ft,GlobalRegistry:Ze,History:bn,HistoryGotoEvent:Vt,HistoryPushEvent:Ut,HistoryRedoEvent:Yt,HistoryUndoEvent:Xt,HoverNodeEvent:wt,InsertAfterEvent:Et,InsertBeforeEvent:St,InsertChildrenEvent:Ct,get KeyCode(){return t.KeyCode},KeyDownEvent:vt,KeyUpEvent:gt,Keyboard:Rn,MouseClickEvent:dt,MouseDoubleClickEvent:ht,MouseMoveEvent:pt,MoveHelper:yn,Operation:mn,PrependNodeEvent:Rt,RemoveNodeEvent:Nt,RemoveWorkspaceEvent:zt,Screen:Nn,get ScreenStatus(){return t.ScreenStatus},get ScreenType(){return t.ScreenType},SelectNodeEvent:xt,Selection:sn,Shortcut:Sn,SwitchWorkspaceEvent:jt,TreeNode:on,UnSelectNodeEvent:kt,UpdateChildrenEvent:Pt,UpdateNodePropsEvent:Tt,Viewport:rn,ViewportResizeEvent:It,ViewportScrollEvent:Lt,Workbench:En,Workspace:wn,WrapNodeEvent:Dt,createBehavior:to,createDesigner:no,createLocales:Qn,createResource:eo,isBehavior:Gn,isBehaviorHost:qn,isBehaviorList:Hn,isResource:Jn,isResourceHost:$n,isResourceList:Zn});(null===(Pn=null==m?void 0:m.Designable)||void 0===Pn?void 0:Pn.Core)?module.exports&&(module.exports=o({__esModule:!0},m.Designable.Core)):(m.Designable=m.Designable||{},m.Designable.Core=oo),t.AddWorkspaceEvent=Wt,t.AppendNodeEvent=At,t.CloneNodeEvent=Ot,t.Cursor=pn,t.DragMoveEvent=ct,t.DragNodeEvent=mt,t.DragStartEvent=lt,t.DragStopEvent=ut,t.DropNodeEvent=bt,t.Engine=xn,t.FromNodeEvent=Ft,t.GlobalRegistry=Ze,t.History=bn,t.HistoryGotoEvent=Vt,t.HistoryPushEvent=Ut,t.HistoryRedoEvent=Yt,t.HistoryUndoEvent=Xt,t.HoverNodeEvent=wt,t.InsertAfterEvent=Et,t.InsertBeforeEvent=St,t.InsertChildrenEvent=Ct,t.KeyDownEvent=vt,t.KeyUpEvent=gt,t.Keyboard=Rn,t.MouseClickEvent=dt,t.MouseDoubleClickEvent=ht,t.MouseMoveEvent=pt,t.MoveHelper=yn,t.Operation=mn,t.PrependNodeEvent=Rt,t.RemoveNodeEvent=Nt,t.RemoveWorkspaceEvent=zt,t.Screen=Nn,t.SelectNodeEvent=xt,t.Selection=sn,t.Shortcut=Sn,t.SwitchWorkspaceEvent=jt,t.TreeNode=on,t.UnSelectNodeEvent=kt,t.UpdateChildrenEvent=Pt,t.UpdateNodePropsEvent=Tt,t.Viewport=rn,t.ViewportResizeEvent=It,t.ViewportScrollEvent=Lt,t.Workbench=En,t.Workspace=wn,t.WrapNodeEvent=Dt,t.createBehavior=to,t.createDesigner=no,t.createLocales=Qn,t.createResource=eo,t.isBehavior=Gn,t.isBehaviorHost=qn,t.isBehaviorList=Hn,t.isResource=Jn,t.isResourceHost=$n,t.isResourceList=Zn});