dishui 0.0.65 → 0.0.66

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 (500) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +10 -11
  2. package/dist/chart.js +12 -46
  3. package/dist/code-editor.js +16 -43
  4. package/dist/components/Badge/index.js +10 -15
  5. package/dist/components/Badge/index.js.map +1 -1
  6. package/dist/components/Button/index.js +62 -89
  7. package/dist/components/Button/index.js.map +1 -1
  8. package/dist/components/Card/index.d.ts +76 -0
  9. package/dist/components/Card/index.js +178 -69
  10. package/dist/components/Card/index.js.map +1 -1
  11. package/dist/components/Chart/Chart.js +25 -25
  12. package/dist/components/Chart/Chart.js.map +1 -1
  13. package/dist/components/Checkbox/index.js +57 -65
  14. package/dist/components/Checkbox/index.js.map +1 -1
  15. package/dist/components/ChoicePicker/index.d.ts +44 -0
  16. package/dist/components/ChoicePicker/index.js +81 -0
  17. package/dist/components/ChoicePicker/index.js.map +1 -0
  18. package/dist/components/Column/index.d.ts +28 -0
  19. package/dist/components/Column/index.js +30 -0
  20. package/dist/components/Column/index.js.map +1 -0
  21. package/dist/components/DateTimeInput/index.d.ts +44 -0
  22. package/dist/components/DateTimeInput/index.js +48 -0
  23. package/dist/components/DateTimeInput/index.js.map +1 -0
  24. package/dist/components/Demo/index.js +107 -107
  25. package/dist/components/Demo/index.js.map +1 -1
  26. package/dist/components/Divider/index.d.ts +20 -0
  27. package/dist/components/Divider/index.js +30 -0
  28. package/dist/components/Divider/index.js.map +1 -0
  29. package/dist/components/EmptyState/index.js +24 -24
  30. package/dist/components/EmptyState/index.js.map +1 -1
  31. package/dist/components/FileUploader/DropZone.js +134 -136
  32. package/dist/components/FileUploader/DropZone.js.map +1 -1
  33. package/dist/components/FileUploader/FileItem.js +159 -163
  34. package/dist/components/FileUploader/FileItem.js.map +1 -1
  35. package/dist/components/FileUploader/FileUploader.js +126 -127
  36. package/dist/components/FileUploader/FileUploader.js.map +1 -1
  37. package/dist/components/FileUploader/UploadQueue.js +62 -62
  38. package/dist/components/FileUploader/UploadQueue.js.map +1 -1
  39. package/dist/components/FloatWindow/index.d.ts +28 -0
  40. package/dist/components/GridLayout/index.d.ts +42 -0
  41. package/dist/components/Icon/index.d.ts +24 -0
  42. package/dist/components/Icon/index.js +26 -0
  43. package/dist/components/Icon/index.js.map +1 -0
  44. package/dist/components/Image/index.d.ts +33 -0
  45. package/dist/components/Image/index.js +44 -0
  46. package/dist/components/Image/index.js.map +1 -0
  47. package/dist/components/Input/index.js +196 -197
  48. package/dist/components/Input/index.js.map +1 -1
  49. package/dist/components/Label/index.js +62 -74
  50. package/dist/components/Label/index.js.map +1 -1
  51. package/dist/components/Layout/index.js +134 -139
  52. package/dist/components/Layout/index.js.map +1 -1
  53. package/dist/components/List/index.js +45 -58
  54. package/dist/components/List/index.js.map +1 -1
  55. package/dist/components/Markdown/Markdown.js +106 -107
  56. package/dist/components/Markdown/Markdown.js.map +1 -1
  57. package/dist/components/Markdown/codeThemes.js +24 -33
  58. package/dist/components/Markdown/codeThemes.js.map +1 -1
  59. package/dist/components/Markdown/markdownComponents.js +203 -208
  60. package/dist/components/Markdown/markdownComponents.js.map +1 -1
  61. package/dist/components/Markdown/parseCodeBlockMeta.js +22 -22
  62. package/dist/components/Markdown/parseCodeBlockMeta.js.map +1 -1
  63. package/dist/components/Markdown/useMarkdownSource.js +46 -46
  64. package/dist/components/Markdown/useMarkdownSource.js.map +1 -1
  65. package/dist/components/Markdown/useMarkmapRenderer.js +35 -36
  66. package/dist/components/Markdown/useMarkmapRenderer.js.map +1 -1
  67. package/dist/components/Markdown/useMermaidRenderer.js +41 -42
  68. package/dist/components/Markdown/useMermaidRenderer.js.map +1 -1
  69. package/dist/components/Modal/index.js +82 -82
  70. package/dist/components/Modal/index.js.map +1 -1
  71. package/dist/components/MultipleChoice/index.d.ts +44 -0
  72. package/dist/components/MultipleChoice/index.js +52 -0
  73. package/dist/components/MultipleChoice/index.js.map +1 -0
  74. package/dist/components/Notification/index.d.ts +17 -0
  75. package/dist/components/Page/index.js +40 -71
  76. package/dist/components/Page/index.js.map +1 -1
  77. package/dist/components/PageHeader/index.js +28 -28
  78. package/dist/components/PageHeader/index.js.map +1 -1
  79. package/dist/components/ProtectedRoute/index.js +8 -9
  80. package/dist/components/ProtectedRoute/index.js.map +1 -1
  81. package/dist/components/Row/index.d.ts +28 -0
  82. package/dist/components/Row/index.js +30 -0
  83. package/dist/components/Row/index.js.map +1 -0
  84. package/dist/components/Select/index.js +251 -254
  85. package/dist/components/Select/index.js.map +1 -1
  86. package/dist/components/SidebarToggleButton/index.js +56 -59
  87. package/dist/components/SidebarToggleButton/index.js.map +1 -1
  88. package/dist/components/Slider/index.d.ts +39 -0
  89. package/dist/components/Slider/index.js +52 -0
  90. package/dist/components/Slider/index.js.map +1 -0
  91. package/dist/components/StatCard/index.d.ts +29 -1
  92. package/dist/components/StatCard/index.js +189 -86
  93. package/dist/components/StatCard/index.js.map +1 -1
  94. package/dist/components/Switch/index.d.ts +34 -0
  95. package/dist/components/Switch/index.js +55 -0
  96. package/dist/components/Switch/index.js.map +1 -0
  97. package/dist/components/Tab/index.d.ts +40 -0
  98. package/dist/components/Table/index.js +109 -121
  99. package/dist/components/Table/index.js.map +1 -1
  100. package/dist/components/Tabs/index.js +28 -38
  101. package/dist/components/Tabs/index.js.map +1 -1
  102. package/dist/components/Text/index.d.ts +43 -0
  103. package/dist/components/Text/index.js +55 -0
  104. package/dist/components/Text/index.js.map +1 -0
  105. package/dist/components/Tooltip/index.d.ts +23 -0
  106. package/dist/components/Tooltip/index.js +34 -0
  107. package/dist/components/Tooltip/index.js.map +1 -0
  108. package/dist/components/Tree/Tree.js +205 -205
  109. package/dist/components/Tree/Tree.js.map +1 -1
  110. package/dist/components/pro/ArticleContextMenu/index.js +86 -87
  111. package/dist/components/pro/ArticleContextMenu/index.js.map +1 -1
  112. package/dist/components/pro/ArticleControl/ArticleControl2.js +250 -250
  113. package/dist/components/pro/ArticleControl/ArticleControl2.js.map +1 -1
  114. package/dist/components/pro/ArticleControl/buildHeadingTree.js +31 -32
  115. package/dist/components/pro/ArticleControl/buildHeadingTree.js.map +1 -1
  116. package/dist/components/pro/ArticleControl/useArticleToc.js +100 -102
  117. package/dist/components/pro/ArticleControl/useArticleToc.js.map +1 -1
  118. package/dist/components/pro/Calendar/Calendar.d.ts +10 -0
  119. package/dist/components/pro/Calendar/hooks/useCalendarDrag.d.ts +47 -0
  120. package/dist/components/pro/Calendar/hooks/useCalendarState.d.ts +56 -0
  121. package/dist/components/pro/Calendar/index.d.ts +7 -0
  122. package/dist/components/pro/Calendar/types.d.ts +151 -0
  123. package/dist/components/pro/Calendar/utils.d.ts +94 -0
  124. package/dist/components/pro/Chat/Chat.d.ts +6 -0
  125. package/dist/components/pro/Chat/index.d.ts +2 -0
  126. package/dist/components/pro/Chat/types.d.ts +84 -0
  127. package/dist/components/pro/CodeEditor/editors/CodeEditor.js +287 -327
  128. package/dist/components/pro/CodeEditor/editors/CodeEditor.js.map +1 -1
  129. package/dist/components/pro/CodeEditor/editors/MarkdownEditor.js +167 -224
  130. package/dist/components/pro/CodeEditor/editors/MarkdownEditor.js.map +1 -1
  131. package/dist/components/pro/CodeEditor/editors/markdownExtensions.js +594 -613
  132. package/dist/components/pro/CodeEditor/editors/markdownExtensions.js.map +1 -1
  133. package/dist/components/pro/CodeEditor/extensions/contextMenu.js +54 -55
  134. package/dist/components/pro/CodeEditor/extensions/contextMenu.js.map +1 -1
  135. package/dist/components/pro/CodeEditor/extensions/index.js +152 -160
  136. package/dist/components/pro/CodeEditor/extensions/index.js.map +1 -1
  137. package/dist/components/pro/CodeEditor/langs/index.js +7 -15
  138. package/dist/components/pro/CodeEditor/langs/index.js.map +1 -1
  139. package/dist/components/pro/CodeEditor/langs/javascript.js +11 -48
  140. package/dist/components/pro/CodeEditor/langs/javascript.js.map +1 -1
  141. package/dist/components/pro/CodeEditor/langs/python.js +4 -40
  142. package/dist/components/pro/CodeEditor/langs/python.js.map +1 -1
  143. package/dist/components/pro/CodeEditor/langs/snippets.js +118 -147
  144. package/dist/components/pro/CodeEditor/langs/snippets.js.map +1 -1
  145. package/dist/components/pro/CodeEditor/panels/FootnotePanel.js +153 -153
  146. package/dist/components/pro/CodeEditor/panels/FootnotePanel.js.map +1 -1
  147. package/dist/components/pro/CodeEditor/panels/HistoryPanel.js +180 -190
  148. package/dist/components/pro/CodeEditor/panels/HistoryPanel.js.map +1 -1
  149. package/dist/components/pro/CodeEditor/panels/OutlinePanel.js +130 -137
  150. package/dist/components/pro/CodeEditor/panels/OutlinePanel.js.map +1 -1
  151. package/dist/components/pro/CodeEditor/panels/TableOfContentsPanel.js +228 -242
  152. package/dist/components/pro/CodeEditor/panels/TableOfContentsPanel.js.map +1 -1
  153. package/dist/components/pro/CodeEditor/panels/VariablePanel.js +208 -248
  154. package/dist/components/pro/CodeEditor/panels/VariablePanel.js.map +1 -1
  155. package/dist/components/pro/CodeEditor/themes.js +513 -483
  156. package/dist/components/pro/CodeEditor/themes.js.map +1 -1
  157. package/dist/components/pro/CodeEditor/types.d.ts +1 -1
  158. package/dist/components/pro/CodeEditor/utils.js +171 -175
  159. package/dist/components/pro/CodeEditor/utils.js.map +1 -1
  160. package/dist/components/pro/DataTable/DataTable.js +305 -306
  161. package/dist/components/pro/DataTable/DataTable.js.map +1 -1
  162. package/dist/components/pro/DataTable/Filters.js +299 -314
  163. package/dist/components/pro/DataTable/Filters.js.map +1 -1
  164. package/dist/components/pro/DataTable/PivotPanel.js +203 -204
  165. package/dist/components/pro/DataTable/PivotPanel.js.map +1 -1
  166. package/dist/components/pro/DataTable/PivotView.js +142 -144
  167. package/dist/components/pro/DataTable/PivotView.js.map +1 -1
  168. package/dist/components/pro/DataTable/components/BulkActions.js +42 -42
  169. package/dist/components/pro/DataTable/components/BulkActions.js.map +1 -1
  170. package/dist/components/pro/DataTable/components/ColumnSelector.js +84 -84
  171. package/dist/components/pro/DataTable/components/ColumnSelector.js.map +1 -1
  172. package/dist/components/pro/DataTable/components/FilterBar.js +58 -58
  173. package/dist/components/pro/DataTable/components/FilterBar.js.map +1 -1
  174. package/dist/components/pro/DataTable/components/TableBody.js +93 -94
  175. package/dist/components/pro/DataTable/components/TableBody.js.map +1 -1
  176. package/dist/components/pro/DataTable/components/TableHeader.js +78 -78
  177. package/dist/components/pro/DataTable/components/TableHeader.js.map +1 -1
  178. package/dist/components/pro/DataTable/components/TablePagination.js +77 -77
  179. package/dist/components/pro/DataTable/components/TablePagination.js.map +1 -1
  180. package/dist/components/pro/DataTable/components/TableToolbar.js +40 -40
  181. package/dist/components/pro/DataTable/components/TableToolbar.js.map +1 -1
  182. package/dist/components/pro/DataTable/extension.js +5 -5
  183. package/dist/components/pro/DataTable/extension.js.map +1 -1
  184. package/dist/components/pro/DataTable/pivotEngine.js +84 -92
  185. package/dist/components/pro/DataTable/pivotEngine.js.map +1 -1
  186. package/dist/components/pro/DataTable/pivotExtension.js +93 -93
  187. package/dist/components/pro/DataTable/pivotExtension.js.map +1 -1
  188. package/dist/components/pro/DataTable/rowDetailExtension.js +30 -30
  189. package/dist/components/pro/DataTable/rowDetailExtension.js.map +1 -1
  190. package/dist/components/pro/DataTable/tanstack-table.js +45 -62
  191. package/dist/components/pro/DataTable/tanstack-table.js.map +1 -1
  192. package/dist/components/pro/DataTable/treeDataUtils.js +37 -48
  193. package/dist/components/pro/DataTable/treeDataUtils.js.map +1 -1
  194. package/dist/components/pro/DataTable/useColumnDragReorder.js +68 -68
  195. package/dist/components/pro/DataTable/useColumnDragReorder.js.map +1 -1
  196. package/dist/components/pro/DataTable/utils.js +156 -168
  197. package/dist/components/pro/DataTable/utils.js.map +1 -1
  198. package/dist/components/pro/FileExplorer/Breadcrumb.js +180 -180
  199. package/dist/components/pro/FileExplorer/Breadcrumb.js.map +1 -1
  200. package/dist/components/pro/FileExplorer/CreateDialog.js +78 -78
  201. package/dist/components/pro/FileExplorer/CreateDialog.js.map +1 -1
  202. package/dist/components/pro/FileExplorer/FileExplorer.js +202 -205
  203. package/dist/components/pro/FileExplorer/FileExplorer.js.map +1 -1
  204. package/dist/components/pro/FileExplorer/FileIcon.js +189 -189
  205. package/dist/components/pro/FileExplorer/FileIcon.js.map +1 -1
  206. package/dist/components/pro/FileExplorer/GridView.js +100 -100
  207. package/dist/components/pro/FileExplorer/GridView.js.map +1 -1
  208. package/dist/components/pro/FileExplorer/ListView.js +209 -209
  209. package/dist/components/pro/FileExplorer/ListView.js.map +1 -1
  210. package/dist/components/pro/FileExplorer/Toolbar.js +199 -199
  211. package/dist/components/pro/FileExplorer/Toolbar.js.map +1 -1
  212. package/dist/components/pro/Flow/Flow.js +920 -948
  213. package/dist/components/pro/Flow/Flow.js.map +1 -1
  214. package/dist/components/pro/Flow/FlowCanvas.js +1626 -1662
  215. package/dist/components/pro/Flow/FlowCanvas.js.map +1 -1
  216. package/dist/components/pro/Flow/archify/build.js +85 -94
  217. package/dist/components/pro/Flow/archify/build.js.map +1 -1
  218. package/dist/components/pro/Flow/archify/convert.js +512 -519
  219. package/dist/components/pro/Flow/archify/convert.js.map +1 -1
  220. package/dist/components/pro/Flow/archify/palette.js +87 -104
  221. package/dist/components/pro/Flow/archify/palette.js.map +1 -1
  222. package/dist/components/pro/Flow/archify/presets.js +34 -37
  223. package/dist/components/pro/Flow/archify/presets.js.map +1 -1
  224. package/dist/components/pro/Flow/archify/spec.js +7 -7
  225. package/dist/components/pro/Flow/archify/spec.js.map +1 -1
  226. package/dist/components/pro/Flow/canvas/AlignmentGuides.js +25 -25
  227. package/dist/components/pro/Flow/canvas/AlignmentGuides.js.map +1 -1
  228. package/dist/components/pro/Flow/canvas/GridRenderer.js +54 -55
  229. package/dist/components/pro/Flow/canvas/GridRenderer.js.map +1 -1
  230. package/dist/components/pro/Flow/canvas/MiniMapRenderer.js +54 -58
  231. package/dist/components/pro/Flow/canvas/MiniMapRenderer.js.map +1 -1
  232. package/dist/components/pro/Flow/canvas/PixiApp.js +105 -102
  233. package/dist/components/pro/Flow/canvas/PixiApp.js.map +1 -1
  234. package/dist/components/pro/Flow/canvas/SelectionOverlay.js +38 -38
  235. package/dist/components/pro/Flow/canvas/SelectionOverlay.js.map +1 -1
  236. package/dist/components/pro/Flow/canvas/ViewportContainer.js +117 -117
  237. package/dist/components/pro/Flow/canvas/ViewportContainer.js.map +1 -1
  238. package/dist/components/pro/Flow/constants.js +266 -278
  239. package/dist/components/pro/Flow/constants.js.map +1 -1
  240. package/dist/components/pro/Flow/context/FlowAIContext.js +27 -28
  241. package/dist/components/pro/Flow/context/FlowAIContext.js.map +1 -1
  242. package/dist/components/pro/Flow/context/FlowContext.js +60 -61
  243. package/dist/components/pro/Flow/context/FlowContext.js.map +1 -1
  244. package/dist/components/pro/Flow/context/FlowUIContext.js +115 -117
  245. package/dist/components/pro/Flow/context/FlowUIContext.js.map +1 -1
  246. package/dist/components/pro/Flow/edges/EdgeRenderer.js +135 -138
  247. package/dist/components/pro/Flow/edges/EdgeRenderer.js.map +1 -1
  248. package/dist/components/pro/Flow/edges/edgeMarkers.js +11 -14
  249. package/dist/components/pro/Flow/edges/edgeMarkers.js.map +1 -1
  250. package/dist/components/pro/Flow/edges/edgePaths.js +351 -367
  251. package/dist/components/pro/Flow/edges/edgePaths.js.map +1 -1
  252. package/dist/components/pro/Flow/hooks/useAlignmentGuides.js +49 -52
  253. package/dist/components/pro/Flow/hooks/useAlignmentGuides.js.map +1 -1
  254. package/dist/components/pro/Flow/hooks/useClipboard.js +154 -154
  255. package/dist/components/pro/Flow/hooks/useClipboard.js.map +1 -1
  256. package/dist/components/pro/Flow/hooks/useCompactMode.js +17 -17
  257. package/dist/components/pro/Flow/hooks/useCompactMode.js.map +1 -1
  258. package/dist/components/pro/Flow/hooks/useDeleteSelection.js +40 -40
  259. package/dist/components/pro/Flow/hooks/useDeleteSelection.js.map +1 -1
  260. package/dist/components/pro/Flow/hooks/useDraggablePanel.js +51 -51
  261. package/dist/components/pro/Flow/hooks/useDraggablePanel.js.map +1 -1
  262. package/dist/components/pro/Flow/hooks/useEdgeMutations.js +157 -157
  263. package/dist/components/pro/Flow/hooks/useEdgeMutations.js.map +1 -1
  264. package/dist/components/pro/Flow/hooks/useFlowImportExport.js +190 -201
  265. package/dist/components/pro/Flow/hooks/useFlowImportExport.js.map +1 -1
  266. package/dist/components/pro/Flow/hooks/useKeyboardShortcuts.js +32 -38
  267. package/dist/components/pro/Flow/hooks/useKeyboardShortcuts.js.map +1 -1
  268. package/dist/components/pro/Flow/hooks/useLayoutActions.js +172 -180
  269. package/dist/components/pro/Flow/hooks/useLayoutActions.js.map +1 -1
  270. package/dist/components/pro/Flow/hooks/useLineMutations.js +57 -57
  271. package/dist/components/pro/Flow/hooks/useLineMutations.js.map +1 -1
  272. package/dist/components/pro/Flow/hooks/useMindMap.js +229 -238
  273. package/dist/components/pro/Flow/hooks/useMindMap.js.map +1 -1
  274. package/dist/components/pro/Flow/hooks/useNodeMutations.js +102 -102
  275. package/dist/components/pro/Flow/hooks/useNodeMutations.js.map +1 -1
  276. package/dist/components/pro/Flow/hooks/usePdfExport.js +55 -56
  277. package/dist/components/pro/Flow/hooks/usePdfExport.js.map +1 -1
  278. package/dist/components/pro/Flow/hooks/usePixiApp.js +55 -57
  279. package/dist/components/pro/Flow/hooks/usePixiApp.js.map +1 -1
  280. package/dist/components/pro/Flow/hooks/useResizablePanel.js +31 -31
  281. package/dist/components/pro/Flow/hooks/useResizablePanel.js.map +1 -1
  282. package/dist/components/pro/Flow/hooks/useSelection.js +69 -69
  283. package/dist/components/pro/Flow/hooks/useSelection.js.map +1 -1
  284. package/dist/components/pro/Flow/hooks/useUndoRedo.js +27 -27
  285. package/dist/components/pro/Flow/hooks/useUndoRedo.js.map +1 -1
  286. package/dist/components/pro/Flow/hooks/useViewport.js +28 -28
  287. package/dist/components/pro/Flow/hooks/useViewport.js.map +1 -1
  288. package/dist/components/pro/Flow/lines/FreehandTool.js +63 -63
  289. package/dist/components/pro/Flow/lines/FreehandTool.js.map +1 -1
  290. package/dist/components/pro/Flow/lines/GeometricLineTool.js +80 -80
  291. package/dist/components/pro/Flow/lines/GeometricLineTool.js.map +1 -1
  292. package/dist/components/pro/Flow/lines/LineRenderer.js +88 -88
  293. package/dist/components/pro/Flow/lines/LineRenderer.js.map +1 -1
  294. package/dist/components/pro/Flow/lines/lineSmoothing.js +32 -34
  295. package/dist/components/pro/Flow/lines/lineSmoothing.js.map +1 -1
  296. package/dist/components/pro/Flow/nodes/DataNodeView.js +236 -242
  297. package/dist/components/pro/Flow/nodes/DataNodeView.js.map +1 -1
  298. package/dist/components/pro/Flow/nodes/MediaContent.js +236 -246
  299. package/dist/components/pro/Flow/nodes/MediaContent.js.map +1 -1
  300. package/dist/components/pro/Flow/nodes/MediaOverlay.js +63 -63
  301. package/dist/components/pro/Flow/nodes/MediaOverlay.js.map +1 -1
  302. package/dist/components/pro/Flow/nodes/Model3DView.js +111 -113
  303. package/dist/components/pro/Flow/nodes/Model3DView.js.map +1 -1
  304. package/dist/components/pro/Flow/nodes/NodeHandles.js +74 -80
  305. package/dist/components/pro/Flow/nodes/NodeHandles.js.map +1 -1
  306. package/dist/components/pro/Flow/nodes/NodeRenderer.js +303 -314
  307. package/dist/components/pro/Flow/nodes/NodeRenderer.js.map +1 -1
  308. package/dist/components/pro/Flow/nodes/NodeText.js +25 -29
  309. package/dist/components/pro/Flow/nodes/NodeText.js.map +1 -1
  310. package/dist/components/pro/Flow/nodes/aiClient.js +124 -137
  311. package/dist/components/pro/Flow/nodes/aiClient.js.map +1 -1
  312. package/dist/components/pro/Flow/nodes/animAnchors.js +42 -49
  313. package/dist/components/pro/Flow/nodes/animAnchors.js.map +1 -1
  314. package/dist/components/pro/Flow/nodes/dataUtils.js +246 -267
  315. package/dist/components/pro/Flow/nodes/dataUtils.js.map +1 -1
  316. package/dist/components/pro/Flow/nodes/nodeUtils.js +23 -28
  317. package/dist/components/pro/Flow/nodes/nodeUtils.js.map +1 -1
  318. package/dist/components/pro/Flow/nodes/shapes.js +556 -589
  319. package/dist/components/pro/Flow/nodes/shapes.js.map +1 -1
  320. package/dist/components/pro/Flow/nodes/svgIconTexture.js +37 -39
  321. package/dist/components/pro/Flow/nodes/svgIconTexture.js.map +1 -1
  322. package/dist/components/pro/Flow/nodes/svgIcons.js +684 -689
  323. package/dist/components/pro/Flow/nodes/svgIcons.js.map +1 -1
  324. package/dist/components/pro/Flow/panels/AIPanel.js +464 -491
  325. package/dist/components/pro/Flow/panels/AIPanel.js.map +1 -1
  326. package/dist/components/pro/Flow/panels/Breadcrumb.js +41 -41
  327. package/dist/components/pro/Flow/panels/Breadcrumb.js.map +1 -1
  328. package/dist/components/pro/Flow/panels/ContextMenu.js +37 -37
  329. package/dist/components/pro/Flow/panels/ContextMenu.js.map +1 -1
  330. package/dist/components/pro/Flow/panels/DataInspectorSection.js +428 -432
  331. package/dist/components/pro/Flow/panels/DataInspectorSection.js.map +1 -1
  332. package/dist/components/pro/Flow/panels/ExpandableTextarea.js +61 -62
  333. package/dist/components/pro/Flow/panels/ExpandableTextarea.js.map +1 -1
  334. package/dist/components/pro/Flow/panels/FlowPanelGroup.js +114 -114
  335. package/dist/components/pro/Flow/panels/FlowPanelGroup.js.map +1 -1
  336. package/dist/components/pro/Flow/panels/FlowToolbar.js +347 -391
  337. package/dist/components/pro/Flow/panels/FlowToolbar.js.map +1 -1
  338. package/dist/components/pro/Flow/panels/InspectorPanel.js +1792 -1798
  339. package/dist/components/pro/Flow/panels/InspectorPanel.js.map +1 -1
  340. package/dist/components/pro/Flow/panels/OutlinePanel.js +242 -248
  341. package/dist/components/pro/Flow/panels/OutlinePanel.js.map +1 -1
  342. package/dist/components/pro/Flow/panels/PresentationMode.js +137 -140
  343. package/dist/components/pro/Flow/panels/PresentationMode.js.map +1 -1
  344. package/dist/components/pro/Flow/panels/ProjectTitle.js +46 -46
  345. package/dist/components/pro/Flow/panels/ProjectTitle.js.map +1 -1
  346. package/dist/components/pro/Flow/panels/ShapePalette.js +557 -572
  347. package/dist/components/pro/Flow/panels/ShapePalette.js.map +1 -1
  348. package/dist/components/pro/Flow/panels/toolbarIcons.d.ts +0 -1
  349. package/dist/components/pro/Flow/panels/toolbarIcons.js +508 -557
  350. package/dist/components/pro/Flow/panels/toolbarIcons.js.map +1 -1
  351. package/dist/components/pro/Flow/types.js +26 -26
  352. package/dist/components/pro/Flow/types.js.map +1 -1
  353. package/dist/components/pro/Flow/utils/dashedLine.js +113 -117
  354. package/dist/components/pro/Flow/utils/dashedLine.js.map +1 -1
  355. package/dist/components/pro/Flow/utils/gradient.js +55 -55
  356. package/dist/components/pro/Flow/utils/gradient.js.map +1 -1
  357. package/dist/components/pro/Flow/utils/pdfExport.js +50 -89
  358. package/dist/components/pro/Flow/utils/pdfExport.js.map +1 -1
  359. package/dist/components/pro/Flow/utils/themeColor.js +185 -195
  360. package/dist/components/pro/Flow/utils/themeColor.js.map +1 -1
  361. package/dist/components/pro/Gantt/Gantt.d.ts +7 -0
  362. package/dist/components/pro/Gantt/hooks/useGanttDrag.d.ts +31 -0
  363. package/dist/components/pro/Gantt/hooks/useGanttState.d.ts +58 -0
  364. package/dist/components/pro/Gantt/index.d.ts +6 -0
  365. package/dist/components/pro/Gantt/types.d.ts +478 -0
  366. package/dist/components/pro/Gantt/utils.d.ts +124 -0
  367. package/dist/components/pro/Resizable/Resizable.d.ts +30 -0
  368. package/dist/components/pro/Resizable/index.d.ts +2 -0
  369. package/dist/components/pro/RichTextEditor/AIRewrite.js +323 -334
  370. package/dist/components/pro/RichTextEditor/AIRewrite.js.map +1 -1
  371. package/dist/components/pro/RichTextEditor/BlockHandle.js +314 -316
  372. package/dist/components/pro/RichTextEditor/BlockHandle.js.map +1 -1
  373. package/dist/components/pro/RichTextEditor/BubbleToolbar.js +97 -97
  374. package/dist/components/pro/RichTextEditor/BubbleToolbar.js.map +1 -1
  375. package/dist/components/pro/RichTextEditor/CommentDialog.js +88 -88
  376. package/dist/components/pro/RichTextEditor/CommentDialog.js.map +1 -1
  377. package/dist/components/pro/RichTextEditor/CommentPanel.js +240 -240
  378. package/dist/components/pro/RichTextEditor/CommentPanel.js.map +1 -1
  379. package/dist/components/pro/RichTextEditor/CommentPopover.js +234 -234
  380. package/dist/components/pro/RichTextEditor/CommentPopover.js.map +1 -1
  381. package/dist/components/pro/RichTextEditor/ContextMenu.js +251 -252
  382. package/dist/components/pro/RichTextEditor/ContextMenu.js.map +1 -1
  383. package/dist/components/pro/RichTextEditor/RichTextEditor.js +267 -271
  384. package/dist/components/pro/RichTextEditor/RichTextEditor.js.map +1 -1
  385. package/dist/components/pro/RichTextEditor/SlashMenu.js +214 -214
  386. package/dist/components/pro/RichTextEditor/SlashMenu.js.map +1 -1
  387. package/dist/components/pro/RichTextEditor/Toolbar/ColorPicker.js +44 -75
  388. package/dist/components/pro/RichTextEditor/Toolbar/ColorPicker.js.map +1 -1
  389. package/dist/components/pro/RichTextEditor/Toolbar/FloatingDialogMenu.js +261 -261
  390. package/dist/components/pro/RichTextEditor/Toolbar/FloatingDialogMenu.js.map +1 -1
  391. package/dist/components/pro/RichTextEditor/Toolbar/MarkdownTemplates.js +172 -526
  392. package/dist/components/pro/RichTextEditor/Toolbar/MarkdownTemplates.js.map +1 -1
  393. package/dist/components/pro/RichTextEditor/Toolbar/SelectDropdown.js +112 -114
  394. package/dist/components/pro/RichTextEditor/Toolbar/SelectDropdown.js.map +1 -1
  395. package/dist/components/pro/RichTextEditor/Toolbar/TableOpsMenu.js +194 -194
  396. package/dist/components/pro/RichTextEditor/Toolbar/TableOpsMenu.js.map +1 -1
  397. package/dist/components/pro/RichTextEditor/Toolbar/Toolbar.js +970 -973
  398. package/dist/components/pro/RichTextEditor/Toolbar/Toolbar.js.map +1 -1
  399. package/dist/components/pro/RichTextEditor/Toolbar/ToolbarButton.js +11 -12
  400. package/dist/components/pro/RichTextEditor/Toolbar/ToolbarButton.js.map +1 -1
  401. package/dist/components/pro/RichTextEditor/extensions/CodeBlockView.js +310 -344
  402. package/dist/components/pro/RichTextEditor/extensions/CodeBlockView.js.map +1 -1
  403. package/dist/components/pro/RichTextEditor/extensions/CommentMark.js +38 -39
  404. package/dist/components/pro/RichTextEditor/extensions/CommentMark.js.map +1 -1
  405. package/dist/components/pro/RichTextEditor/extensions/FloatingDialog.js +620 -625
  406. package/dist/components/pro/RichTextEditor/extensions/FloatingDialog.js.map +1 -1
  407. package/dist/components/pro/RichTextEditor/extensions/FontSize.js +25 -25
  408. package/dist/components/pro/RichTextEditor/extensions/FontSize.js.map +1 -1
  409. package/dist/components/pro/RichTextEditor/extensions/MarkdownBlock.js +167 -176
  410. package/dist/components/pro/RichTextEditor/extensions/MarkdownBlock.js.map +1 -1
  411. package/dist/components/pro/RichTextEditor/types.js +75 -75
  412. package/dist/components/pro/RichTextEditor/types.js.map +1 -1
  413. package/dist/contexts/AppContext.d.ts +1 -1
  414. package/dist/contexts/AppContext.js +216 -221
  415. package/dist/contexts/AppContext.js.map +1 -1
  416. package/dist/data-table.js +15 -41
  417. package/dist/data-table.js.map +1 -1
  418. package/dist/dishui.css +1 -1
  419. package/dist/flow.js +27 -83
  420. package/dist/hooks/useClickOutside.js +18 -18
  421. package/dist/hooks/useClickOutside.js.map +1 -1
  422. package/dist/hooks/useContainerElement.js +9 -9
  423. package/dist/hooks/useContainerElement.js.map +1 -1
  424. package/dist/hooks/useControllableState.js +33 -35
  425. package/dist/hooks/useControllableState.js.map +1 -1
  426. package/dist/hooks/useCopyToClipboard.js +16 -16
  427. package/dist/hooks/useCopyToClipboard.js.map +1 -1
  428. package/dist/hooks/useDebounce.js +14 -14
  429. package/dist/hooks/useDebounce.js.map +1 -1
  430. package/dist/hooks/useDraggable.js +50 -50
  431. package/dist/hooks/useDraggable.js.map +1 -1
  432. package/dist/hooks/useTableColumns.js +39 -41
  433. package/dist/hooks/useTableColumns.js.map +1 -1
  434. package/dist/hooks/useTableData.js +67 -68
  435. package/dist/hooks/useTableData.js.map +1 -1
  436. package/dist/index-nostyled.d.ts +8 -0
  437. package/dist/index.d.ts +27 -1
  438. package/dist/index.js +105 -241
  439. package/dist/layouts/MainLayout.js +56 -56
  440. package/dist/layouts/MainLayout.js.map +1 -1
  441. package/dist/layouts/Navbar.js +214 -214
  442. package/dist/layouts/Navbar.js.map +1 -1
  443. package/dist/layouts/Sidebar.js +184 -186
  444. package/dist/layouts/Sidebar.js.map +1 -1
  445. package/dist/layouts/headbar/Headbar.js +25 -25
  446. package/dist/layouts/headbar/Headbar.js.map +1 -1
  447. package/dist/layouts/headbar/HeadbarLangSwitcher.js +39 -39
  448. package/dist/layouts/headbar/HeadbarLangSwitcher.js.map +1 -1
  449. package/dist/layouts/headbar/HeadbarSearch.js +120 -120
  450. package/dist/layouts/headbar/HeadbarSearch.js.map +1 -1
  451. package/dist/layouts/headbar/HeadbarThemeSwitcher.js +27 -27
  452. package/dist/layouts/headbar/HeadbarThemeSwitcher.js.map +1 -1
  453. package/dist/layouts/headbar/HeadbarTitle.js +26 -26
  454. package/dist/layouts/headbar/HeadbarTitle.js.map +1 -1
  455. package/dist/lite.js +9 -24
  456. package/dist/markdown.js +4 -9
  457. package/dist/pages/components/Calendar/index.d.ts +3 -0
  458. package/dist/pages/components/Calendar/index.en.d.ts +3 -0
  459. package/dist/pages/components/Calendar/index.zh.d.ts +3 -0
  460. package/dist/pages/components/Chat/index.d.ts +3 -0
  461. package/dist/pages/components/Chat/index.en.d.ts +3 -0
  462. package/dist/pages/components/Chat/index.zh.d.ts +3 -0
  463. package/dist/pages/components/FloatWindow/index.d.ts +3 -0
  464. package/dist/pages/components/FloatWindow/index.en.d.ts +3 -0
  465. package/dist/pages/components/FloatWindow/index.zh.d.ts +3 -0
  466. package/dist/pages/components/Gantt/index.d.ts +3 -0
  467. package/dist/pages/components/Gantt/index.en.d.ts +3 -0
  468. package/dist/pages/components/Gantt/index.zh.d.ts +3 -0
  469. package/dist/pages/components/GridLayout/index.d.ts +3 -0
  470. package/dist/pages/components/GridLayout/index.en.d.ts +3 -0
  471. package/dist/pages/components/GridLayout/index.zh.d.ts +3 -0
  472. package/dist/pages/components/Notification/index.d.ts +3 -0
  473. package/dist/pages/components/Notification/index.en.d.ts +3 -0
  474. package/dist/pages/components/Notification/index.zh.d.ts +3 -0
  475. package/dist/pages/components/Resizable/index.d.ts +3 -0
  476. package/dist/pages/components/Resizable/index.en.d.ts +3 -0
  477. package/dist/pages/components/Resizable/index.zh.d.ts +3 -0
  478. package/dist/pages/components/Tab/index.d.ts +3 -0
  479. package/dist/pages/components/Tab/index.en.d.ts +3 -0
  480. package/dist/pages/components/Tab/index.zh.d.ts +3 -0
  481. package/dist/styles/themeStyles.js +87 -86
  482. package/dist/styles/themeStyles.js.map +1 -1
  483. package/dist/utils/cn.d.ts +13 -0
  484. package/dist/utils/cn.js +16 -0
  485. package/dist/utils/cn.js.map +1 -0
  486. package/dist/utils/i18n.js +690 -602
  487. package/dist/utils/i18n.js.map +1 -1
  488. package/dist/utils/menu.js +94 -94
  489. package/dist/utils/menu.js.map +1 -1
  490. package/dist/utils/rehype-code-meta.js +14 -14
  491. package/dist/utils/rehype-code-meta.js.map +1 -1
  492. package/dist/utils/remark-code-meta.js +9 -9
  493. package/dist/utils/remark-code-meta.js.map +1 -1
  494. package/dist/utils/routerBuilder.js +59 -60
  495. package/dist/utils/routerBuilder.js.map +1 -1
  496. package/dist/utils/selection.js +28 -29
  497. package/dist/utils/selection.js.map +1 -1
  498. package/dist/utils/themes.js +275 -255
  499. package/dist/utils/themes.js.map +1 -1
  500. package/package.json +19 -6
@@ -1 +1 @@
1
- {"version":3,"file":"PixiApp.js","names":[],"sources":["../../../../../src/components/pro/Flow/canvas/PixiApp.ts"],"sourcesContent":["import { Application, Container } from 'pixi.js';\n\nexport interface PixiAppOptions {\n canvas: HTMLCanvasElement;\n backgroundColor?: number;\n antialias?: boolean;\n resolution?: number;\n autoDensity?: boolean;\n width?: number;\n height?: number;\n}\n\n/**\n * Wraps PixiJS Application lifecycle: init, resize, destroy.\n * The world container holds all flow content and is transformed for pan/zoom.\n */\nexport class PixiApp {\n app: Application;\n world: Container;\n private _destroyed = false;\n private _initialized = false;\n\n constructor() {\n this.app = new Application();\n this.world = new Container({ label: 'world' });\n }\n\n async init(options: PixiAppOptions): Promise<void> {\n if (this._destroyed) return;\n await this.app.init({\n canvas: options.canvas,\n background: options.backgroundColor ?? 0xf8f9fa,\n antialias: options.antialias ?? true,\n resolution: options.resolution ?? (window.devicePixelRatio || 1),\n autoDensity: options.autoDensity ?? true,\n width: options.width,\n height: options.height,\n });\n if (this._destroyed) return;\n this._initialized = true;\n this.app.stage.addChild(this.world);\n this.app.stage.eventMode = 'static';\n this.app.stage.hitArea = this.app.screen;\n }\n\n resize(width: number, height: number): void {\n if (this._destroyed || !this._initialized) return;\n this.app.renderer.resize(width, height);\n this.app.stage.hitArea = this.app.screen;\n }\n\n /** Update the canvas backdrop color (e.g. when the DishUI theme changes). */\n setBackgroundColor(color: number): void {\n if (this._destroyed || !this._initialized) return;\n this.app.renderer.background.color = color;\n }\n\n /**\n * Export the current scene to a PNG data URL.\n *\n * Reading the WebGL canvas directly with `canvas.toDataURL()` returns a black\n * image because PixiJS does not preserve the drawing buffer between frames.\n * The renderer's `extract` plugin re-renders the target into an offscreen\n * canvas, which is the reliable way to snapshot the scene.\n */\n async exportPNG(backgroundColor?: number): Promise<string | null> {\n if (this._destroyed || !this._initialized) return null;\n const renderer = this.app.renderer as unknown as {\n extract?: {\n canvas: (target: unknown) => HTMLCanvasElement | OffscreenCanvas;\n };\n };\n if (!renderer || !renderer.extract) return null;\n\n // Force a fresh render so the extract reflects the latest state.\n this.app.render();\n\n let out: HTMLCanvasElement | OffscreenCanvas;\n try {\n out = renderer.extract.canvas(this.app.stage);\n } catch {\n return null;\n }\n\n const w = (out as HTMLCanvasElement).width;\n const h = (out as HTMLCanvasElement).height;\n if (!w || !h) return null;\n\n // Composite onto an opaque background so transparent areas aren't black.\n const composite = document.createElement('canvas');\n composite.width = w;\n composite.height = h;\n const ctx = composite.getContext('2d');\n if (!ctx) {\n return typeof (out as HTMLCanvasElement).toDataURL === 'function'\n ? (out as HTMLCanvasElement).toDataURL('image/png')\n : null;\n }\n ctx.fillStyle = backgroundColor !== undefined\n ? `#${backgroundColor.toString(16).padStart(6, '0')}`\n : '#ffffff';\n ctx.fillRect(0, 0, w, h);\n ctx.drawImage(out as CanvasImageSource, 0, 0);\n return composite.toDataURL('image/png');\n }\n\n /**\n * Export a specific world-space rectangle to a PNG data URL, cropped exactly\n * to that rectangle (used for per-anchor slide capture).\n *\n * Uses the extract system's `frame` option to render precisely the given\n * region of the `world` container in world coordinates, independent of the\n * current pan/zoom. This guarantees the output is exactly the anchor's\n * framed content — no screen-space cropping or transform juggling.\n */\n async exportRegionPNG(\n rect: { x: number; y: number; w: number; h: number },\n options?: { scale?: number; backgroundColor?: number },\n ): Promise<{ dataUrl: string; width: number; height: number } | null> {\n if (this._destroyed || !this._initialized) return null;\n const { Rectangle } = await import('pixi.js');\n const renderer = this.app.renderer as unknown as {\n extract?: {\n canvas: (options: unknown) => HTMLCanvasElement | OffscreenCanvas;\n };\n };\n if (!renderer || !renderer.extract) return null;\n\n const scale = Math.max(0.1, options?.scale ?? 2);\n\n // Temporarily reset the world transform to identity so the `frame` (given in\n // world coordinates) maps 1:1 to the anchor content, independent of the\n // current pan/zoom. Restored immediately after extraction.\n const prev = {\n x: this.world.position.x,\n y: this.world.position.y,\n sx: this.world.scale.x,\n sy: this.world.scale.y,\n };\n this.world.position.set(0, 0);\n this.world.scale.set(1, 1);\n\n let out: HTMLCanvasElement | OffscreenCanvas;\n try {\n // Fresh render so the extract reflects the latest scene state.\n this.app.render();\n out = renderer.extract.canvas({\n target: this.world,\n // Frame is in the target's LOCAL (world) coordinates.\n frame: new Rectangle(rect.x, rect.y, rect.w, rect.h),\n resolution: scale,\n antialias: true,\n });\n } catch {\n this.world.position.set(prev.x, prev.y);\n this.world.scale.set(prev.sx, prev.sy);\n this.app.render();\n return null;\n }\n\n // Restore the interactive viewport transform immediately.\n this.world.position.set(prev.x, prev.y);\n this.world.scale.set(prev.sx, prev.sy);\n this.app.render();\n\n const w = (out as HTMLCanvasElement).width;\n const h = (out as HTMLCanvasElement).height;\n if (!w || !h) return null;\n\n // Composite onto an opaque background so transparent areas aren't black.\n const composite = document.createElement('canvas');\n composite.width = w;\n composite.height = h;\n const ctx = composite.getContext('2d');\n if (!ctx) {\n const url = typeof (out as HTMLCanvasElement).toDataURL === 'function'\n ? (out as HTMLCanvasElement).toDataURL('image/png')\n : null;\n return url ? { dataUrl: url, width: w, height: h } : null;\n }\n ctx.fillStyle = options?.backgroundColor !== undefined\n ? `#${options.backgroundColor.toString(16).padStart(6, '0')}`\n : '#ffffff';\n ctx.fillRect(0, 0, w, h);\n ctx.drawImage(out as CanvasImageSource, 0, 0);\n return { dataUrl: composite.toDataURL('image/png'), width: w, height: h };\n }\n\n destroy(): void {\n if (this._destroyed) return;\n this._destroyed = true;\n if (!this._initialized) return;\n try {\n this.app.destroy(true, { children: true, texture: true });\n } catch {\n // PixiJS may throw if internal state is partially torn down\n }\n }\n\n get destroyed(): boolean {\n return this._destroyed;\n }\n}\n"],"mappings":";AAgBA,IAAa,IAAb,MAAqB;AAAA,EACnB;AAAA,EACA;AAAA,EACA,aAAqB;AAAA,EACrB,eAAuB;AAAA,EAEvB,cAAc;AACZ,SAAK,MAAM,IAAI,EAAY,GAC3B,KAAK,QAAQ,IAAI,EAAU,EAAE,OAAO,QAAQ,CAAC;AAAA,EAC/C;AAAA,EAEA,MAAM,KAAK,GAAwC;AACjD,IAAI,KAAK,eACT,MAAM,KAAK,IAAI,KAAK;AAAA,MAClB,QAAQ,EAAQ;AAAA,MAChB,YAAY,EAAQ,mBAAmB;AAAA,MACvC,WAAW,EAAQ,aAAa;AAAA,MAChC,YAAY,EAAQ,eAAe,OAAO,oBAAoB;AAAA,MAC9D,aAAa,EAAQ,eAAe;AAAA,MACpC,OAAO,EAAQ;AAAA,MACf,QAAQ,EAAQ;AAAA,IAClB,CAAC,GACG,MAAK,eACT,KAAK,eAAe,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I;AACrC,QAAI,CAAC,GAAK;AACR,YAAM,IAAM,OAAQ,EAA0B,aAAc,aACvD,EAA0B,UAAU,WAAW,IAChD;AACJ,aAAO,IAAM;AAAA,QAAE,SAAS;AAAA,QAAK,OAAO;AAAA,QAAG,QAAQ;AAAA,MAAE,IAAI;AAAA,IACvD;AACA,WAAA,EAAI,YAAY,GAAS,oBAAoB,SACzC,IAAI,EAAQ,gBAAgB,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG,CAAA,KACxD,WACJ,EAAI,SAAS,GAAG,GAAG,GAAG,CAAC,GACvB,EAAI,UAAU,GAA0B,GAAG,CAAC,GACrC;AAAA,MAAE,SAAS,EAAU,UAAU,WAAW;AAAA,MAAG,OAAO;AAAA,MAAG,QAAQ;AAAA,IAAE;AAAA,EAC1E;AAAA,EAEA,UAAgB;AACd,QAAI,MAAK,eACT,KAAK,aAAa,IACd,EAAC,KAAK;AACV,UAAI;AACF,aAAK,IAAI,QAAQ,IAAM;AAAA,UAAE,UAAU;AAAA,UAAM,SAAS;AAAA,QAAK,CAAC;AAAA,MAC1D,QAAQ;AAAA,MAER;AAAA,EACF;AAAA,EAEA,IAAI,YAAqB;AACvB,WAAO,KAAK;AAAA,EACd;AACF"}
1
+ {"version":3,"file":"PixiApp.js","names":[],"sources":["../../../../../src/components/pro/Flow/canvas/PixiApp.ts"],"sourcesContent":["import { Application, Container } from 'pixi.js';\n\nexport interface PixiAppOptions {\n canvas: HTMLCanvasElement;\n backgroundColor?: number;\n antialias?: boolean;\n resolution?: number;\n autoDensity?: boolean;\n width?: number;\n height?: number;\n}\n\n/**\n * Wraps PixiJS Application lifecycle: init, resize, destroy.\n * The world container holds all flow content and is transformed for pan/zoom.\n */\nexport class PixiApp {\n app: Application;\n world: Container;\n private _destroyed = false;\n private _initialized = false;\n\n constructor() {\n this.app = new Application();\n this.world = new Container({ label: 'world' });\n }\n\n async init(options: PixiAppOptions): Promise<void> {\n if (this._destroyed) return;\n await this.app.init({\n canvas: options.canvas,\n background: options.backgroundColor ?? 0xf8f9fa,\n antialias: options.antialias ?? true,\n resolution: options.resolution ?? (window.devicePixelRatio || 1),\n autoDensity: options.autoDensity ?? true,\n width: options.width,\n height: options.height,\n });\n if (this._destroyed) return;\n this._initialized = true;\n this.app.stage.addChild(this.world);\n this.app.stage.eventMode = 'static';\n this.app.stage.hitArea = this.app.screen;\n }\n\n resize(width: number, height: number): void {\n if (this._destroyed || !this._initialized) return;\n this.app.renderer.resize(width, height);\n this.app.stage.hitArea = this.app.screen;\n }\n\n /** Update the canvas backdrop color (e.g. when the DishUI theme changes). */\n setBackgroundColor(color: number): void {\n if (this._destroyed || !this._initialized) return;\n this.app.renderer.background.color = color;\n }\n\n /**\n * Export the current scene to a PNG data URL.\n *\n * Reading the WebGL canvas directly with `canvas.toDataURL()` returns a black\n * image because PixiJS does not preserve the drawing buffer between frames.\n * The renderer's `extract` plugin re-renders the target into an offscreen\n * canvas, which is the reliable way to snapshot the scene.\n */\n async exportPNG(backgroundColor?: number): Promise<string | null> {\n if (this._destroyed || !this._initialized) return null;\n const renderer = this.app.renderer as unknown as {\n extract?: {\n canvas: (target: unknown) => HTMLCanvasElement | OffscreenCanvas;\n };\n };\n if (!renderer || !renderer.extract) return null;\n\n // Force a fresh render so the extract reflects the latest state.\n this.app.render();\n\n let out: HTMLCanvasElement | OffscreenCanvas;\n try {\n out = renderer.extract.canvas(this.app.stage);\n } catch {\n return null;\n }\n\n const w = (out as HTMLCanvasElement).width;\n const h = (out as HTMLCanvasElement).height;\n if (!w || !h) return null;\n\n // Composite onto an opaque background so transparent areas aren't black.\n const composite = document.createElement('canvas');\n composite.width = w;\n composite.height = h;\n const ctx = composite.getContext('2d');\n if (!ctx) {\n return typeof (out as HTMLCanvasElement).toDataURL === 'function'\n ? (out as HTMLCanvasElement).toDataURL('image/png')\n : null;\n }\n ctx.fillStyle = backgroundColor !== undefined\n ? `#${backgroundColor.toString(16).padStart(6, '0')}`\n : '#ffffff';\n ctx.fillRect(0, 0, w, h);\n ctx.drawImage(out as CanvasImageSource, 0, 0);\n return composite.toDataURL('image/png');\n }\n\n /**\n * Export a specific world-space rectangle to a PNG data URL, cropped exactly\n * to that rectangle (used for per-anchor slide capture).\n *\n * Uses the extract system's `frame` option to render precisely the given\n * region of the `world` container in world coordinates, independent of the\n * current pan/zoom. This guarantees the output is exactly the anchor's\n * framed content — no screen-space cropping or transform juggling.\n */\n async exportRegionPNG(\n rect: { x: number; y: number; w: number; h: number },\n options?: { scale?: number; backgroundColor?: number },\n ): Promise<{ dataUrl: string; width: number; height: number } | null> {\n if (this._destroyed || !this._initialized) return null;\n const { Rectangle } = await import('pixi.js');\n const renderer = this.app.renderer as unknown as {\n extract?: {\n canvas: (options: unknown) => HTMLCanvasElement | OffscreenCanvas;\n };\n };\n if (!renderer || !renderer.extract) return null;\n\n const scale = Math.max(0.1, options?.scale ?? 2);\n\n // Temporarily reset the world transform to identity so the `frame` (given in\n // world coordinates) maps 1:1 to the anchor content, independent of the\n // current pan/zoom. Restored immediately after extraction.\n const prev = {\n x: this.world.position.x,\n y: this.world.position.y,\n sx: this.world.scale.x,\n sy: this.world.scale.y,\n };\n this.world.position.set(0, 0);\n this.world.scale.set(1, 1);\n\n let out: HTMLCanvasElement | OffscreenCanvas;\n try {\n // Fresh render so the extract reflects the latest scene state.\n this.app.render();\n out = renderer.extract.canvas({\n target: this.world,\n // Frame is in the target's LOCAL (world) coordinates.\n frame: new Rectangle(rect.x, rect.y, rect.w, rect.h),\n resolution: scale,\n antialias: true,\n });\n } catch {\n this.world.position.set(prev.x, prev.y);\n this.world.scale.set(prev.sx, prev.sy);\n this.app.render();\n return null;\n }\n\n // Restore the interactive viewport transform immediately.\n this.world.position.set(prev.x, prev.y);\n this.world.scale.set(prev.sx, prev.sy);\n this.app.render();\n\n const w = (out as HTMLCanvasElement).width;\n const h = (out as HTMLCanvasElement).height;\n if (!w || !h) return null;\n\n // Composite onto an opaque background so transparent areas aren't black.\n const composite = document.createElement('canvas');\n composite.width = w;\n composite.height = h;\n const ctx = composite.getContext('2d');\n if (!ctx) {\n const url = typeof (out as HTMLCanvasElement).toDataURL === 'function'\n ? (out as HTMLCanvasElement).toDataURL('image/png')\n : null;\n return url ? { dataUrl: url, width: w, height: h } : null;\n }\n ctx.fillStyle = options?.backgroundColor !== undefined\n ? `#${options.backgroundColor.toString(16).padStart(6, '0')}`\n : '#ffffff';\n ctx.fillRect(0, 0, w, h);\n ctx.drawImage(out as CanvasImageSource, 0, 0);\n return { dataUrl: composite.toDataURL('image/png'), width: w, height: h };\n }\n\n destroy(): void {\n if (this._destroyed) return;\n this._destroyed = true;\n if (!this._initialized) return;\n // 先销毁舞台子树:此时渲染器的纹理池仍存活,Text.destroy() 才能把\n // 纹理安全归还到池中。若先销毁渲染器,后续 Text.unload 会向已清空的\n // 池归还纹理,触发 \"Cannot read properties of undefined (reading 'push')\"\n // (TexturePool.returnTexture)。随后 React 卸载 FlowCanvas 子树时对\n // 已销毁对象的二次 destroy() 也会因池被清空而崩溃。\n try {\n this.app.stage.destroy({ children: true, texture: true });\n } catch {\n // ignore partial teardown issues\n }\n try {\n this.app.destroy(false);\n } catch {\n // PixiJS may throw if internal state is partially torn down\n }\n }\n\n get destroyed(): boolean {\n return this._destroyed;\n }\n}\n"],"mappings":";;AAgBA,IAAa,IAAb,MAAqB;CACnB;CACA;CACA,aAAqB;CACrB,eAAuB;CAEvB,cAAc;EAEZ,AADA,KAAK,MAAM,IAAI,EAAY,GAC3B,KAAK,QAAQ,IAAI,EAAU,EAAE,OAAO,QAAQ,CAAC;CAC/C;CAEA,MAAM,KAAK,GAAwC;EAC7C,KAAK,eACT,MAAM,KAAK,IAAI,KAAK;GAClB,QAAQ,EAAQ;GAChB,YAAY,EAAQ,mBAAmB;GACvC,WAAW,EAAQ,aAAa;GAChC,YAAY,EAAQ,eAAe,OAAO,oBAAoB;GAC9D,aAAa,EAAQ,eAAe;GACpC,OAAO,EAAQ;GACf,QAAQ,EAAQ;EAClB,CAAC,GAC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;IAAK,OAAO;IAAG,QAAQ;GAAE,IAAI;EACvD;EAMA,OALA,EAAI,YAAY,GAAS,oBAAoB,KAAA,IAEzC,YADA,IAAI,EAAQ,gBAAgB,SAAS,EAAE,CAAC,CAAC,SAAS,GAAG,GAAG,KAE5D,EAAI,SAAS,GAAG,GAAG,GAAG,CAAC,GACvB,EAAI,UAAU,GAA0B,GAAG,CAAC,GACrC;GAAE,SAAS,EAAU,UAAU,WAAW;GAAG,OAAO;GAAG,QAAQ;EAAE;CAC1E;CAEA,UAAgB;EACV,UAAK,eACT,KAAK,aAAa,IACb,KAAK,eAMV;OAAI;IACF,KAAK,IAAI,MAAM,QAAQ;KAAE,UAAU;KAAM,SAAS;IAAK,CAAC;GAC1D,QAAQ,CAER;GACA,IAAI;IACF,KAAK,IAAI,QAAQ,EAAK;GACxB,QAAQ,CAER;EALA;CAMF;CAEA,IAAI,YAAqB;EACvB,OAAO,KAAK;CACd;AACF"}
@@ -1,41 +1,41 @@
1
- import { Graphics as t } from "pixi.js";
2
- var h = class {
3
- marquee;
4
- rings;
5
- constructor(e) {
6
- this.marquee = new t(), this.marquee.label = "marquee", this.marquee.visible = !1, e.addChild(this.marquee), this.rings = new t(), this.rings.label = "selection-rings", e.addChild(this.rings);
7
- }
8
- showMarquee(e, s, r, a) {
9
- const i = this.marquee;
10
- i.clear(), i.rect(e, s, r, a).fill({
11
- color: 3900150,
12
- alpha: 0.08
13
- }).stroke({
14
- color: 3900150,
15
- width: 1,
16
- alpha: 0.5
17
- }), i.visible = !0;
18
- }
19
- hideMarquee() {
20
- this.marquee.visible = !1, this.marquee.clear();
21
- }
22
- drawRings(e) {
23
- const s = this.rings;
24
- s.clear();
25
- for (const r of e) s.rect(r.x - 2, r.y - 2, r.w + 4, r.h + 4).stroke({
26
- color: 3900150,
27
- width: 1.5
28
- });
29
- }
30
- clearRings() {
31
- this.rings.clear();
32
- }
33
- destroy() {
34
- this.marquee.destroy(), this.rings.destroy();
35
- }
36
- };
37
- export {
38
- h as SelectionOverlay
1
+ import { Graphics as e } from "pixi.js";
2
+ //#region src/components/pro/Flow/canvas/SelectionOverlay.ts
3
+ var t = class {
4
+ marquee;
5
+ rings;
6
+ constructor(t) {
7
+ this.marquee = new e(), this.marquee.label = "marquee", this.marquee.visible = !1, t.addChild(this.marquee), this.rings = new e(), this.rings.label = "selection-rings", t.addChild(this.rings);
8
+ }
9
+ showMarquee(e, t, n, r) {
10
+ let i = this.marquee;
11
+ i.clear(), i.rect(e, t, n, r).fill({
12
+ color: 3900150,
13
+ alpha: .08
14
+ }).stroke({
15
+ color: 3900150,
16
+ width: 1,
17
+ alpha: .5
18
+ }), i.visible = !0;
19
+ }
20
+ hideMarquee() {
21
+ this.marquee.visible = !1, this.marquee.clear();
22
+ }
23
+ drawRings(e) {
24
+ let t = this.rings;
25
+ t.clear();
26
+ for (let n of e) t.rect(n.x - 2, n.y - 2, n.w + 4, n.h + 4).stroke({
27
+ color: 3900150,
28
+ width: 1.5
29
+ });
30
+ }
31
+ clearRings() {
32
+ this.rings.clear();
33
+ }
34
+ destroy() {
35
+ this.marquee.destroy(), this.rings.destroy();
36
+ }
39
37
  };
38
+ //#endregion
39
+ export { t as SelectionOverlay };
40
40
 
41
41
  //# sourceMappingURL=SelectionOverlay.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelectionOverlay.js","names":[],"sources":["../../../../../src/components/pro/Flow/canvas/SelectionOverlay.ts"],"sourcesContent":["import { Graphics, Container } from 'pixi.js';\n\n/**\n * Renders marquee selection rectangle and node selection rings.\n */\nexport class SelectionOverlay {\n private marquee: Graphics;\n private rings: Graphics;\n\n constructor(stage: Container) {\n this.marquee = new Graphics();\n this.marquee.label = 'marquee';\n this.marquee.visible = false;\n stage.addChild(this.marquee);\n\n this.rings = new Graphics();\n this.rings.label = 'selection-rings';\n stage.addChild(this.rings);\n }\n\n showMarquee(x: number, y: number, w: number, h: number): void {\n const m = this.marquee;\n m.clear();\n m.rect(x, y, w, h)\n .fill({ color: 0x3b82f6, alpha: 0.08 })\n .stroke({ color: 0x3b82f6, width: 1, alpha: 0.5 });\n m.visible = true;\n }\n\n hideMarquee(): void {\n this.marquee.visible = false;\n this.marquee.clear();\n }\n\n drawRings(rects: Array<{ x: number; y: number; w: number; h: number }>): void {\n const g = this.rings;\n g.clear();\n for (const r of rects) {\n g.rect(r.x - 2, r.y - 2, r.w + 4, r.h + 4)\n .stroke({ color: 0x3b82f6, width: 1.5 });\n }\n }\n\n clearRings(): void {\n this.rings.clear();\n }\n\n destroy(): void {\n this.marquee.destroy();\n this.rings.destroy();\n }\n}\n"],"mappings":";AAKA,IAAa,IAAb,MAA8B;AAAA,EAC5B;AAAA,EACA;AAAA,EAEA,YAAY,GAAkB;AAC5B,SAAK,UAAU,IAAI,EAAS,GAC5B,KAAK,QAAQ,QAAQ,WACrB,KAAK,QAAQ,UAAU,IACvB,EAAM,SAAS,KAAK,OAAO,GAE3B,KAAK,QAAQ,IAAI,EAAS,GAC1B,KAAK,MAAM,QAAQ,mBACnB,EAAM,SAAS,KAAK,KAAK;AAAA,EAC3B;AAAA,EAEA,YAAY,GAAW,GAAW,GAAW,GAAiB;AAC5D,UAAM,IAAI,KAAK;AACf,IAAA,EAAE,MAAM,GACR,EAAE,KAAK,GAAG,GAAG,GAAG,CAAC,EACd,KAAK;AAAA,MAAE,OAAO;AAAA,MAAU,OAAO;AAAA,IAAK,CAAC,EACrC,OAAO;AAAA,MAAE,OAAO;AAAA,MAAU,OAAO;AAAA,MAAG,OAAO;AAAA,IAAI,CAAC,GACnD,EAAE,UAAU;AAAA,EACd;AAAA,EAEA,cAAoB;AAClB,SAAK,QAAQ,UAAU,IACvB,KAAK,QAAQ,MAAM;AAAA,EACrB;AAAA,EAEA,UAAU,GAAoE;AAC5E,UAAM,IAAI,KAAK;AACf,IAAA,EAAE,MAAM;AACR,eAAW,KAAK,EACd,CAAA,EAAE,KAAK,EAAE,IAAI,GAAG,EAAE,IAAI,GAAG,EAAE,IAAI,GAAG,EAAE,IAAI,CAAC,EACtC,OAAO;AAAA,MAAE,OAAO;AAAA,MAAU,OAAO;AAAA,IAAI,CAAC;AAAA,EAE7C;AAAA,EAEA,aAAmB;AACjB,SAAK,MAAM,MAAM;AAAA,EACnB;AAAA,EAEA,UAAgB;AACd,SAAK,QAAQ,QAAQ,GACrB,KAAK,MAAM,QAAQ;AAAA,EACrB;AACF"}
1
+ {"version":3,"file":"SelectionOverlay.js","names":[],"sources":["../../../../../src/components/pro/Flow/canvas/SelectionOverlay.ts"],"sourcesContent":["import { Graphics, Container } from 'pixi.js';\n\n/**\n * Renders marquee selection rectangle and node selection rings.\n */\nexport class SelectionOverlay {\n private marquee: Graphics;\n private rings: Graphics;\n\n constructor(stage: Container) {\n this.marquee = new Graphics();\n this.marquee.label = 'marquee';\n this.marquee.visible = false;\n stage.addChild(this.marquee);\n\n this.rings = new Graphics();\n this.rings.label = 'selection-rings';\n stage.addChild(this.rings);\n }\n\n showMarquee(x: number, y: number, w: number, h: number): void {\n const m = this.marquee;\n m.clear();\n m.rect(x, y, w, h)\n .fill({ color: 0x3b82f6, alpha: 0.08 })\n .stroke({ color: 0x3b82f6, width: 1, alpha: 0.5 });\n m.visible = true;\n }\n\n hideMarquee(): void {\n this.marquee.visible = false;\n this.marquee.clear();\n }\n\n drawRings(rects: Array<{ x: number; y: number; w: number; h: number }>): void {\n const g = this.rings;\n g.clear();\n for (const r of rects) {\n g.rect(r.x - 2, r.y - 2, r.w + 4, r.h + 4)\n .stroke({ color: 0x3b82f6, width: 1.5 });\n }\n }\n\n clearRings(): void {\n this.rings.clear();\n }\n\n destroy(): void {\n this.marquee.destroy();\n this.rings.destroy();\n }\n}\n"],"mappings":";;AAKA,IAAa,IAAb,MAA8B;CAC5B;CACA;CAEA,YAAY,GAAkB;EAQ5B,AAPA,KAAK,UAAU,IAAI,EAAS,GAC5B,KAAK,QAAQ,QAAQ,WACrB,KAAK,QAAQ,UAAU,IACvB,EAAM,SAAS,KAAK,OAAO,GAE3B,KAAK,QAAQ,IAAI,EAAS,GAC1B,KAAK,MAAM,QAAQ,mBACnB,EAAM,SAAS,KAAK,KAAK;CAC3B;CAEA,YAAY,GAAW,GAAW,GAAW,GAAiB;EAC5D,IAAM,IAAI,KAAK;EAKf,AAJA,EAAE,MAAM,GACR,EAAE,KAAK,GAAG,GAAG,GAAG,CAAC,CAAC,CACf,KAAK;GAAE,OAAO;GAAU,OAAO;EAAK,CAAC,CAAC,CACtC,OAAO;GAAE,OAAO;GAAU,OAAO;GAAG,OAAO;EAAI,CAAC,GACnD,EAAE,UAAU;CACd;CAEA,cAAoB;EAElB,AADA,KAAK,QAAQ,UAAU,IACvB,KAAK,QAAQ,MAAM;CACrB;CAEA,UAAU,GAAoE;EAC5E,IAAM,IAAI,KAAK;EACf,EAAE,MAAM;EACR,KAAK,IAAM,KAAK,GACd,EAAE,KAAK,EAAE,IAAI,GAAG,EAAE,IAAI,GAAG,EAAE,IAAI,GAAG,EAAE,IAAI,CAAC,CAAC,CACvC,OAAO;GAAE,OAAO;GAAU,OAAO;EAAI,CAAC;CAE7C;CAEA,aAAmB;EACjB,KAAK,MAAM,MAAM;CACnB;CAEA,UAAgB;EAEd,AADA,KAAK,QAAQ,QAAQ,GACrB,KAAK,MAAM,QAAQ;CACrB;AACF"}
@@ -1,120 +1,120 @@
1
- import { MIN_ZOOM as h } from "../constants.js";
2
- var d = class {
3
- world;
4
- stage;
5
- _state = {
6
- x: 0,
7
- y: 0,
8
- zoom: 1
9
- };
10
- onChange;
11
- _panning = !1;
12
- _panStart = {
13
- x: 0,
14
- y: 0
15
- };
16
- _worldStart = {
17
- x: 0,
18
- y: 0
19
- };
20
- _spaceHeld = !1;
21
- _rightPanning = !1;
22
- _rightPanMoved = !1;
23
- multiTouchActive = !1;
24
- constructor(t, s, i) {
25
- this.world = t, this.stage = s, this.onChange = i, this._bindStageEvents(), this._bindKeyEvents();
26
- }
27
- get state() {
28
- return { ...this._state };
29
- }
30
- setState(t) {
31
- const s = t.x !== void 0 ? t.x : this._state.x, i = t.y !== void 0 ? t.y : this._state.y, e = t.zoom !== void 0 ? Math.max(h, Math.min(4, t.zoom)) : this._state.zoom;
32
- s === this._state.x && i === this._state.y && e === this._state.zoom || (this._state.x = s, this._state.y = i, this._state.zoom = e, this._applyTransform());
33
- }
34
- startPan(t, s) {
35
- this._panning = !0, this._panStart = {
36
- x: t,
37
- y: s
38
- }, this._worldStart = {
39
- x: this._state.x,
40
- y: this._state.y
41
- };
42
- }
43
- cancelPan() {
44
- this._panning = !1, this._rightPanning = !1;
45
- }
46
- animateTo(t, s = 300) {
47
- const i = { ...this._state }, e = performance.now(), n = () => {
48
- const r = performance.now() - e, o = Math.min(1, r / s), a = o < 0.5 ? 2 * o * o : 1 - (-2 * o + 2) ** 2 / 2;
49
- this._state.x = i.x + (t.x - i.x) * a, this._state.y = i.y + (t.y - i.y) * a, this._state.zoom = i.zoom + (t.zoom - i.zoom) * a, this._applyTransform(), o < 1 && requestAnimationFrame(n);
50
- };
51
- requestAnimationFrame(n);
52
- }
53
- screenToWorld(t, s) {
54
- return {
55
- x: (t - this._state.x) / this._state.zoom,
56
- y: (s - this._state.y) / this._state.zoom
57
- };
58
- }
59
- worldToScreen(t, s) {
60
- return {
61
- x: t * this._state.zoom + this._state.x,
62
- y: s * this._state.zoom + this._state.y
63
- };
64
- }
65
- _applyTransform() {
66
- this.world.position.set(this._state.x, this._state.y), this.world.scale.set(this._state.zoom), this.onChange?.(this.state);
67
- }
68
- _bindStageEvents() {
69
- this.stage.on("pointerdown", this._onPointerDown, this), this.stage.on("pointermove", this._onPointerMove, this), this.stage.on("pointerup", this._onPointerUp, this), this.stage.on("pointerupoutside", this._onPointerUp, this);
70
- }
71
- _bindKeyEvents() {
72
- this._handleKeyDown = this._handleKeyDown.bind(this), this._handleKeyUp = this._handleKeyUp.bind(this), window.addEventListener("keydown", this._handleKeyDown), window.addEventListener("keyup", this._handleKeyUp);
73
- }
74
- _handleKeyDown(t) {
75
- t.code === "Space" && (this._spaceHeld = !0);
76
- }
77
- _handleKeyUp(t) {
78
- t.code === "Space" && (this._spaceHeld = !1, this._panning = !1);
79
- }
80
- zoomAt(t, s, i) {
81
- const e = this._state.zoom, n = Math.max(h, Math.min(4, e * i));
82
- n !== e && (this._state.x = t - (t - this._state.x) * (n / e), this._state.y = s - (s - this._state.y) * (n / e), this._state.zoom = n, this._applyTransform());
83
- }
84
- _onPointerDown = (t) => {
85
- if (this.multiTouchActive) return;
86
- const s = t.button === 1, i = t.button === 2;
87
- (s || i || this._spaceHeld) && (this._panning = !0, this._rightPanning = i, this._rightPanMoved = !1, this._panStart = {
88
- x: t.global.x,
89
- y: t.global.y
90
- }, this._worldStart = {
91
- x: this._state.x,
92
- y: this._state.y
93
- });
94
- };
95
- _onPointerMove = (t) => {
96
- if (!this._panning || this.multiTouchActive) return;
97
- const s = t.global.x - this._panStart.x, i = t.global.y - this._panStart.y;
98
- this._rightPanning && (Math.abs(s) > 3 || Math.abs(i) > 3) && (this._rightPanMoved = !0), this._state.x = this._worldStart.x + s, this._state.y = this._worldStart.y + i, this._applyTransform();
99
- };
100
- _onPointerUp = () => {
101
- this._panning = !1, this._rightPanning = !1;
102
- };
103
- get isPanning() {
104
- return this._panning;
105
- }
106
- get isSpaceHeld() {
107
- return this._spaceHeld;
108
- }
109
- get didRightPan() {
110
- return this._rightPanMoved;
111
- }
112
- destroy() {
113
- window.removeEventListener("keydown", this._handleKeyDown), window.removeEventListener("keyup", this._handleKeyUp), this.stage.off("pointerdown", this._onPointerDown, this), this.stage.off("pointermove", this._onPointerMove, this), this.stage.off("pointerup", this._onPointerUp, this), this.stage.off("pointerupoutside", this._onPointerUp, this);
114
- }
115
- };
116
- export {
117
- d as ViewportManager
1
+ import { MIN_ZOOM as e } from "../constants.js";
2
+ //#region src/components/pro/Flow/canvas/ViewportContainer.ts
3
+ var t = class {
4
+ world;
5
+ stage;
6
+ _state = {
7
+ x: 0,
8
+ y: 0,
9
+ zoom: 1
10
+ };
11
+ onChange;
12
+ _panning = !1;
13
+ _panStart = {
14
+ x: 0,
15
+ y: 0
16
+ };
17
+ _worldStart = {
18
+ x: 0,
19
+ y: 0
20
+ };
21
+ _spaceHeld = !1;
22
+ _rightPanning = !1;
23
+ _rightPanMoved = !1;
24
+ multiTouchActive = !1;
25
+ constructor(e, t, n) {
26
+ this.world = e, this.stage = t, this.onChange = n, this._bindStageEvents(), this._bindKeyEvents();
27
+ }
28
+ get state() {
29
+ return { ...this._state };
30
+ }
31
+ setState(t) {
32
+ let n = t.x === void 0 ? this._state.x : t.x, r = t.y === void 0 ? this._state.y : t.y, i = t.zoom === void 0 ? this._state.zoom : Math.max(e, Math.min(4, t.zoom));
33
+ (n !== this._state.x || r !== this._state.y || i !== this._state.zoom) && (this._state.x = n, this._state.y = r, this._state.zoom = i, this._applyTransform());
34
+ }
35
+ startPan(e, t) {
36
+ this._panning = !0, this._panStart = {
37
+ x: e,
38
+ y: t
39
+ }, this._worldStart = {
40
+ x: this._state.x,
41
+ y: this._state.y
42
+ };
43
+ }
44
+ cancelPan() {
45
+ this._panning = !1, this._rightPanning = !1;
46
+ }
47
+ animateTo(e, t = 300) {
48
+ let n = { ...this._state }, r = performance.now(), i = () => {
49
+ let a = performance.now() - r, o = Math.min(1, a / t), s = o < .5 ? 2 * o * o : 1 - (-2 * o + 2) ** 2 / 2;
50
+ this._state.x = n.x + (e.x - n.x) * s, this._state.y = n.y + (e.y - n.y) * s, this._state.zoom = n.zoom + (e.zoom - n.zoom) * s, this._applyTransform(), o < 1 && requestAnimationFrame(i);
51
+ };
52
+ requestAnimationFrame(i);
53
+ }
54
+ screenToWorld(e, t) {
55
+ return {
56
+ x: (e - this._state.x) / this._state.zoom,
57
+ y: (t - this._state.y) / this._state.zoom
58
+ };
59
+ }
60
+ worldToScreen(e, t) {
61
+ return {
62
+ x: e * this._state.zoom + this._state.x,
63
+ y: t * this._state.zoom + this._state.y
64
+ };
65
+ }
66
+ _applyTransform() {
67
+ this.world.position.set(this._state.x, this._state.y), this.world.scale.set(this._state.zoom), this.onChange?.(this.state);
68
+ }
69
+ _bindStageEvents() {
70
+ this.stage.on("pointerdown", this._onPointerDown, this), this.stage.on("pointermove", this._onPointerMove, this), this.stage.on("pointerup", this._onPointerUp, this), this.stage.on("pointerupoutside", this._onPointerUp, this);
71
+ }
72
+ _bindKeyEvents() {
73
+ this._handleKeyDown = this._handleKeyDown.bind(this), this._handleKeyUp = this._handleKeyUp.bind(this), window.addEventListener("keydown", this._handleKeyDown), window.addEventListener("keyup", this._handleKeyUp);
74
+ }
75
+ _handleKeyDown(e) {
76
+ e.code === "Space" && (this._spaceHeld = !0);
77
+ }
78
+ _handleKeyUp(e) {
79
+ e.code === "Space" && (this._spaceHeld = !1, this._panning = !1);
80
+ }
81
+ zoomAt(t, n, r) {
82
+ let i = this._state.zoom, a = Math.max(e, Math.min(4, i * r));
83
+ a !== i && (this._state.x = t - (t - this._state.x) * (a / i), this._state.y = n - (n - this._state.y) * (a / i), this._state.zoom = a, this._applyTransform());
84
+ }
85
+ _onPointerDown = (e) => {
86
+ if (this.multiTouchActive) return;
87
+ let t = e.button === 1, n = e.button === 2;
88
+ (t || n || this._spaceHeld) && (this._panning = !0, this._rightPanning = n, this._rightPanMoved = !1, this._panStart = {
89
+ x: e.global.x,
90
+ y: e.global.y
91
+ }, this._worldStart = {
92
+ x: this._state.x,
93
+ y: this._state.y
94
+ });
95
+ };
96
+ _onPointerMove = (e) => {
97
+ if (!this._panning || this.multiTouchActive) return;
98
+ let t = e.global.x - this._panStart.x, n = e.global.y - this._panStart.y;
99
+ this._rightPanning && (Math.abs(t) > 3 || Math.abs(n) > 3) && (this._rightPanMoved = !0), this._state.x = this._worldStart.x + t, this._state.y = this._worldStart.y + n, this._applyTransform();
100
+ };
101
+ _onPointerUp = () => {
102
+ this._panning = !1, this._rightPanning = !1;
103
+ };
104
+ get isPanning() {
105
+ return this._panning;
106
+ }
107
+ get isSpaceHeld() {
108
+ return this._spaceHeld;
109
+ }
110
+ get didRightPan() {
111
+ return this._rightPanMoved;
112
+ }
113
+ destroy() {
114
+ window.removeEventListener("keydown", this._handleKeyDown), window.removeEventListener("keyup", this._handleKeyUp), this.stage.off("pointerdown", this._onPointerDown, this), this.stage.off("pointermove", this._onPointerMove, this), this.stage.off("pointerup", this._onPointerUp, this), this.stage.off("pointerupoutside", this._onPointerUp, this);
115
+ }
118
116
  };
117
+ //#endregion
118
+ export { t as ViewportManager };
119
119
 
120
120
  //# sourceMappingURL=ViewportContainer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ViewportContainer.js","names":[],"sources":["../../../../../src/components/pro/Flow/canvas/ViewportContainer.ts"],"sourcesContent":["import { Container, FederatedPointerEvent } from 'pixi.js';\nimport { MIN_ZOOM, MAX_ZOOM } from '../constants';\nimport type { ViewportState } from '../types';\n\nexport type ViewportChangeCallback = (state: ViewportState) => void;\n\n/**\n * Manages pan/zoom on the world container.\n * Listens for wheel (zoom) and middle-click / space+drag (pan).\n */\nexport class ViewportManager {\n private world: Container;\n private stage: Container;\n private _state: ViewportState = { x: 0, y: 0, zoom: 1 };\n private onChange?: ViewportChangeCallback;\n\n private _panning = false;\n private _panStart = { x: 0, y: 0 };\n private _worldStart = { x: 0, y: 0 };\n private _spaceHeld = false;\n /** True while a pan was triggered by the right mouse button. */\n private _rightPanning = false;\n /** Whether the current right-button pan actually moved (used to suppress the context menu). */\n private _rightPanMoved = false;\n /** True while a multi-touch gesture (pinch zoom / two-finger pan) is active.\n * Set by FlowCanvas's native touch handlers; while set, pointer-driven\n * interactions (marquee, node drag, tap-to-place) must be suppressed. */\n multiTouchActive = false;\n\n constructor(world: Container, stage: Container, onChange?: ViewportChangeCallback) {\n this.world = world;\n this.stage = stage;\n this.onChange = onChange;\n this._bindStageEvents();\n this._bindKeyEvents();\n }\n\n get state(): ViewportState {\n return { ...this._state };\n }\n\n setState(s: Partial<ViewportState>): void {\n const nx = s.x !== undefined ? s.x : this._state.x;\n const ny = s.y !== undefined ? s.y : this._state.y;\n const nz = s.zoom !== undefined\n ? Math.max(MIN_ZOOM, Math.min(MAX_ZOOM, s.zoom))\n : this._state.zoom;\n // Skip if nothing actually changed — avoids a needless onChange emit that\n // could feed back into React state and cause viewport jitter.\n if (nx === this._state.x && ny === this._state.y && nz === this._state.zoom) return;\n this._state.x = nx;\n this._state.y = ny;\n this._state.zoom = nz;\n this._applyTransform();\n }\n\n /** Start a pan from an external trigger (e.g. pan tool mode) */\n startPan(sx: number, sy: number): void {\n this._panning = true;\n this._panStart = { x: sx, y: sy };\n this._worldStart = { x: this._state.x, y: this._state.y };\n }\n\n /** Abort any in-progress pan (used when a multi-touch gesture takes over). */\n cancelPan(): void {\n this._panning = false;\n this._rightPanning = false;\n }\n\n /** Smoothly animate to a target state */\n animateTo(target: ViewportState, duration = 300): void {\n const start = { ...this._state };\n const startTime = performance.now();\n const tick = () => {\n const elapsed = performance.now() - startTime;\n const t = Math.min(1, elapsed / duration);\n const ease = t < 0.5 ? 2 * t * t : 1 - (-2 * t + 2) ** 2 / 2;\n this._state.x = start.x + (target.x - start.x) * ease;\n this._state.y = start.y + (target.y - start.y) * ease;\n this._state.zoom = start.zoom + (target.zoom - start.zoom) * ease;\n this._applyTransform();\n if (t < 1) requestAnimationFrame(tick);\n };\n requestAnimationFrame(tick);\n }\n\n /** Convert screen coords to world coords */\n screenToWorld(sx: number, sy: number): { x: number; y: number } {\n return {\n x: (sx - this._state.x) / this._state.zoom,\n y: (sy - this._state.y) / this._state.zoom,\n };\n }\n\n /** Convert world coords to screen coords */\n worldToScreen(wx: number, wy: number): { x: number; y: number } {\n return {\n x: wx * this._state.zoom + this._state.x,\n y: wy * this._state.zoom + this._state.y,\n };\n }\n\n private _applyTransform(): void {\n this.world.position.set(this._state.x, this._state.y);\n this.world.scale.set(this._state.zoom);\n this.onChange?.(this.state);\n }\n\n private _bindStageEvents(): void {\n // NOTE: wheel/zoom is handled by a native, non-passive DOM listener in\n // FlowCanvas (see `zoomAt`) so it can call preventDefault() and stop the\n // browser's Ctrl/Cmd+wheel page zoom. Pixi's federated wheel event cannot\n // reliably prevent that native gesture.\n this.stage.on('pointerdown', this._onPointerDown, this);\n this.stage.on('pointermove', this._onPointerMove, this);\n this.stage.on('pointerup', this._onPointerUp, this);\n this.stage.on('pointerupoutside', this._onPointerUp, this);\n }\n\n private _bindKeyEvents(): void {\n this._handleKeyDown = this._handleKeyDown.bind(this);\n this._handleKeyUp = this._handleKeyUp.bind(this);\n window.addEventListener('keydown', this._handleKeyDown);\n window.addEventListener('keyup', this._handleKeyUp);\n }\n\n private _handleKeyDown(e: KeyboardEvent): void {\n if (e.code === 'Space') this._spaceHeld = true;\n }\n\n private _handleKeyUp(e: KeyboardEvent): void {\n if (e.code === 'Space') {\n this._spaceHeld = false;\n this._panning = false;\n }\n }\n\n /**\n * Zoom by a multiplicative factor around a screen-space anchor point.\n * Driven by a native wheel listener so the browser page zoom can be blocked.\n */\n zoomAt(sx: number, sy: number, factor: number): void {\n const oldZoom = this._state.zoom;\n const newZoom = Math.max(MIN_ZOOM, Math.min(MAX_ZOOM, oldZoom * factor));\n if (newZoom === oldZoom) return;\n this._state.x = sx - (sx - this._state.x) * (newZoom / oldZoom);\n this._state.y = sy - (sy - this._state.y) * (newZoom / oldZoom);\n this._state.zoom = newZoom;\n this._applyTransform();\n }\n\n private _onPointerDown = (e: FederatedPointerEvent): void => {\n if (this.multiTouchActive) return;\n const isMiddle = e.button === 1;\n const isRight = e.button === 2;\n if (isMiddle || isRight || this._spaceHeld) {\n this._panning = true;\n this._rightPanning = isRight;\n this._rightPanMoved = false;\n this._panStart = { x: e.global.x, y: e.global.y };\n this._worldStart = { x: this._state.x, y: this._state.y };\n }\n };\n\n private _onPointerMove = (e: FederatedPointerEvent): void => {\n if (!this._panning || this.multiTouchActive) return;\n const dx = e.global.x - this._panStart.x;\n const dy = e.global.y - this._panStart.y;\n // Mark a right-button pan as \"moved\" once it passes a small threshold so\n // that a plain right-click (no drag) still opens the context menu.\n if (this._rightPanning && (Math.abs(dx) > 3 || Math.abs(dy) > 3)) {\n this._rightPanMoved = true;\n }\n this._state.x = this._worldStart.x + dx;\n this._state.y = this._worldStart.y + dy;\n this._applyTransform();\n };\n\n private _onPointerUp = (): void => {\n this._panning = false;\n this._rightPanning = false;\n };\n\n get isPanning(): boolean {\n return this._panning;\n }\n\n get isSpaceHeld(): boolean {\n return this._spaceHeld;\n }\n\n /**\n * Whether the most recent right-button interaction was a pan drag (moved past\n * the threshold). Consumers use this to suppress the context menu after a\n * right-drag pan. The flag resets on the next pointer down.\n */\n get didRightPan(): boolean {\n return this._rightPanMoved;\n }\n\n destroy(): void {\n window.removeEventListener('keydown', this._handleKeyDown);\n window.removeEventListener('keyup', this._handleKeyUp);\n this.stage.off('pointerdown', this._onPointerDown, this);\n this.stage.off('pointermove', this._onPointerMove, this);\n this.stage.off('pointerup', this._onPointerUp, this);\n this.stage.off('pointerupoutside', this._onPointerUp, this);\n }\n}\n"],"mappings":";AAUA,IAAa,IAAb,MAA6B;AAAA,EAC3B;AAAA,EACA;AAAA,EACA,SAAgC;AAAA,IAAE,GAAG;AAAA,IAAG,GAAG;AAAA,IAAG,MAAM;AAAA,EAAE;AAAA,EACtD;AAAA,EAEA,WAAmB;AAAA,EACnB,YAAoB;AAAA,IAAE,GAAG;AAAA,IAAG,GAAG;AAAA,EAAE;AAAA,EACjC,cAAsB;AAAA,IAAE,GAAG;AAAA,IAAG,GAAG;AAAA,EAAE;AAAA,EACnC,aAAqB;AAAA,EAErB,gBAAwB;AAAA,EAExB,iBAAyB;AAAA,EAIzB,mBAAmB;AAAA,EAEnB,YAAY,GAAkB,GAAkB,GAAmC;AACjF,SAAK,QAAQ,GACb,KAAK,QAAQ,GACb,KAAK,WAAW,GAChB,KAAK,iBAAiB,GACtB,KAAK,eAAe;AAAA,EACtB;AAAA,EAEA,IAAI,QAAuB;AACzB,WAAO,EAAE,GAAG,KAAK,OAAO;AAAA,EAC1B;AAAA,EAEA,SAAS,GAAiC;AACxC,UAAM,IAAK,EA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AAI,cAAuB;AACzB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,UAAgB;AACd,WAAO,oBAAoB,WAAW,KAAK,cAAc,GACzD,OAAO,oBAAoB,SAAS,KAAK,YAAY,GACrD,KAAK,MAAM,IAAI,eAAe,KAAK,gBAAgB,IAAI,GACvD,KAAK,MAAM,IAAI,eAAe,KAAK,gBAAgB,IAAI,GACvD,KAAK,MAAM,IAAI,aAAa,KAAK,cAAc,IAAI,GACnD,KAAK,MAAM,IAAI,oBAAoB,KAAK,cAAc,IAAI;AAAA,EAC5D;AACF"}
1
+ {"version":3,"file":"ViewportContainer.js","names":[],"sources":["../../../../../src/components/pro/Flow/canvas/ViewportContainer.ts"],"sourcesContent":["import { Container, FederatedPointerEvent } from 'pixi.js';\nimport { MIN_ZOOM, MAX_ZOOM } from '../constants';\nimport type { ViewportState } from '../types';\n\nexport type ViewportChangeCallback = (state: ViewportState) => void;\n\n/**\n * Manages pan/zoom on the world container.\n * Listens for wheel (zoom) and middle-click / space+drag (pan).\n */\nexport class ViewportManager {\n private world: Container;\n private stage: Container;\n private _state: ViewportState = { x: 0, y: 0, zoom: 1 };\n private onChange?: ViewportChangeCallback;\n\n private _panning = false;\n private _panStart = { x: 0, y: 0 };\n private _worldStart = { x: 0, y: 0 };\n private _spaceHeld = false;\n /** True while a pan was triggered by the right mouse button. */\n private _rightPanning = false;\n /** Whether the current right-button pan actually moved (used to suppress the context menu). */\n private _rightPanMoved = false;\n /** True while a multi-touch gesture (pinch zoom / two-finger pan) is active.\n * Set by FlowCanvas's native touch handlers; while set, pointer-driven\n * interactions (marquee, node drag, tap-to-place) must be suppressed. */\n multiTouchActive = false;\n\n constructor(world: Container, stage: Container, onChange?: ViewportChangeCallback) {\n this.world = world;\n this.stage = stage;\n this.onChange = onChange;\n this._bindStageEvents();\n this._bindKeyEvents();\n }\n\n get state(): ViewportState {\n return { ...this._state };\n }\n\n setState(s: Partial<ViewportState>): void {\n const nx = s.x !== undefined ? s.x : this._state.x;\n const ny = s.y !== undefined ? s.y : this._state.y;\n const nz = s.zoom !== undefined\n ? Math.max(MIN_ZOOM, Math.min(MAX_ZOOM, s.zoom))\n : this._state.zoom;\n // Skip if nothing actually changed — avoids a needless onChange emit that\n // could feed back into React state and cause viewport jitter.\n if (nx === this._state.x && ny === this._state.y && nz === this._state.zoom) return;\n this._state.x = nx;\n this._state.y = ny;\n this._state.zoom = nz;\n this._applyTransform();\n }\n\n /** Start a pan from an external trigger (e.g. pan tool mode) */\n startPan(sx: number, sy: number): void {\n this._panning = true;\n this._panStart = { x: sx, y: sy };\n this._worldStart = { x: this._state.x, y: this._state.y };\n }\n\n /** Abort any in-progress pan (used when a multi-touch gesture takes over). */\n cancelPan(): void {\n this._panning = false;\n this._rightPanning = false;\n }\n\n /** Smoothly animate to a target state */\n animateTo(target: ViewportState, duration = 300): void {\n const start = { ...this._state };\n const startTime = performance.now();\n const tick = () => {\n const elapsed = performance.now() - startTime;\n const t = Math.min(1, elapsed / duration);\n const ease = t < 0.5 ? 2 * t * t : 1 - (-2 * t + 2) ** 2 / 2;\n this._state.x = start.x + (target.x - start.x) * ease;\n this._state.y = start.y + (target.y - start.y) * ease;\n this._state.zoom = start.zoom + (target.zoom - start.zoom) * ease;\n this._applyTransform();\n if (t < 1) requestAnimationFrame(tick);\n };\n requestAnimationFrame(tick);\n }\n\n /** Convert screen coords to world coords */\n screenToWorld(sx: number, sy: number): { x: number; y: number } {\n return {\n x: (sx - this._state.x) / this._state.zoom,\n y: (sy - this._state.y) / this._state.zoom,\n };\n }\n\n /** Convert world coords to screen coords */\n worldToScreen(wx: number, wy: number): { x: number; y: number } {\n return {\n x: wx * this._state.zoom + this._state.x,\n y: wy * this._state.zoom + this._state.y,\n };\n }\n\n private _applyTransform(): void {\n this.world.position.set(this._state.x, this._state.y);\n this.world.scale.set(this._state.zoom);\n this.onChange?.(this.state);\n }\n\n private _bindStageEvents(): void {\n // NOTE: wheel/zoom is handled by a native, non-passive DOM listener in\n // FlowCanvas (see `zoomAt`) so it can call preventDefault() and stop the\n // browser's Ctrl/Cmd+wheel page zoom. Pixi's federated wheel event cannot\n // reliably prevent that native gesture.\n this.stage.on('pointerdown', this._onPointerDown, this);\n this.stage.on('pointermove', this._onPointerMove, this);\n this.stage.on('pointerup', this._onPointerUp, this);\n this.stage.on('pointerupoutside', this._onPointerUp, this);\n }\n\n private _bindKeyEvents(): void {\n this._handleKeyDown = this._handleKeyDown.bind(this);\n this._handleKeyUp = this._handleKeyUp.bind(this);\n window.addEventListener('keydown', this._handleKeyDown);\n window.addEventListener('keyup', this._handleKeyUp);\n }\n\n private _handleKeyDown(e: KeyboardEvent): void {\n if (e.code === 'Space') this._spaceHeld = true;\n }\n\n private _handleKeyUp(e: KeyboardEvent): void {\n if (e.code === 'Space') {\n this._spaceHeld = false;\n this._panning = false;\n }\n }\n\n /**\n * Zoom by a multiplicative factor around a screen-space anchor point.\n * Driven by a native wheel listener so the browser page zoom can be blocked.\n */\n zoomAt(sx: number, sy: number, factor: number): void {\n const oldZoom = this._state.zoom;\n const newZoom = Math.max(MIN_ZOOM, Math.min(MAX_ZOOM, oldZoom * factor));\n if (newZoom === oldZoom) return;\n this._state.x = sx - (sx - this._state.x) * (newZoom / oldZoom);\n this._state.y = sy - (sy - this._state.y) * (newZoom / oldZoom);\n this._state.zoom = newZoom;\n this._applyTransform();\n }\n\n private _onPointerDown = (e: FederatedPointerEvent): void => {\n if (this.multiTouchActive) return;\n const isMiddle = e.button === 1;\n const isRight = e.button === 2;\n if (isMiddle || isRight || this._spaceHeld) {\n this._panning = true;\n this._rightPanning = isRight;\n this._rightPanMoved = false;\n this._panStart = { x: e.global.x, y: e.global.y };\n this._worldStart = { x: this._state.x, y: this._state.y };\n }\n };\n\n private _onPointerMove = (e: FederatedPointerEvent): void => {\n if (!this._panning || this.multiTouchActive) return;\n const dx = e.global.x - this._panStart.x;\n const dy = e.global.y - this._panStart.y;\n // Mark a right-button pan as \"moved\" once it passes a small threshold so\n // that a plain right-click (no drag) still opens the context menu.\n if (this._rightPanning && (Math.abs(dx) > 3 || Math.abs(dy) > 3)) {\n this._rightPanMoved = true;\n }\n this._state.x = this._worldStart.x + dx;\n this._state.y = this._worldStart.y + dy;\n this._applyTransform();\n };\n\n private _onPointerUp = (): void => {\n this._panning = false;\n this._rightPanning = false;\n };\n\n get isPanning(): boolean {\n return this._panning;\n }\n\n get isSpaceHeld(): boolean {\n return this._spaceHeld;\n }\n\n /**\n * Whether the most recent right-button interaction was a pan drag (moved past\n * the threshold). Consumers use this to suppress the context menu after a\n * right-drag pan. The flag resets on the next pointer down.\n */\n get didRightPan(): boolean {\n return this._rightPanMoved;\n }\n\n destroy(): void {\n window.removeEventListener('keydown', this._handleKeyDown);\n window.removeEventListener('keyup', this._handleKeyUp);\n this.stage.off('pointerdown', this._onPointerDown, this);\n this.stage.off('pointermove', this._onPointerMove, this);\n this.stage.off('pointerup', this._onPointerUp, this);\n this.stage.off('pointerupoutside', this._onPointerUp, this);\n }\n}\n"],"mappings":";;AAUA,IAAa,IAAb,MAA6B;CAC3B;CACA;CACA,SAAgC;EAAE,GAAG;EAAG,GAAG;EAAG,MAAM;CAAE;CACtD;CAEA,WAAmB;CACnB,YAAoB;EAAE,GAAG;EAAG,GAAG;CAAE;CACjC,cAAsB;EAAE,GAAG;EAAG,GAAG;CAAE;CACnC,aAAqB;CAErB,gBAAwB;CAExB,iBAAyB;CAIzB,mBAAmB;CAEnB,YAAY,GAAkB,GAAkB,GAAmC;EAKjF,AAJA,KAAK,QAAQ,GACb,KAAK,QAAQ,GACb,KAAK,WAAW,GAChB,KAAK,iBAAiB,GACtB,KAAK,eAAe;CACtB;CAEA,IAAI,QAAuB;EACzB,OAAO,EAAE,GAAG,KAAK,OAAO;CAC1B;CAEA,SAAS,GAAiC;EACxC,IAAM,IAAK,EAAE,MAAM,KAAA,IAAkB,KAAK,OAAO,IAAlB,EAAE,GAC3B,IAAK,EAAE,MAAM,KAAA,IAAkB,KAAK,OAAO,IAAlB,EAA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