@jimka/typescript-ui 0.4.1 → 0.6.0

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 (292) hide show
  1. package/dist/lib/{AbstractInput-BxfrmD2W.js → AbstractInput-sRNPzWel.js} +2 -2
  2. package/dist/lib/{AbstractInput-BxfrmD2W.js.map → AbstractInput-sRNPzWel.js.map} +1 -1
  3. package/dist/lib/Anchor-CwRhdP2J.js +2 -0
  4. package/dist/lib/Anchor-CwRhdP2J.js.map +1 -0
  5. package/dist/lib/AnchorConstraints-Bfkt8019.js +2 -0
  6. package/dist/lib/AnchorConstraints-Bfkt8019.js.map +1 -0
  7. package/dist/lib/AnimatedDropdown-H3Rh-YMZ.js +2 -0
  8. package/dist/lib/AnimatedDropdown-H3Rh-YMZ.js.map +1 -0
  9. package/dist/lib/Border-0DJFDiij.js +2 -0
  10. package/dist/lib/Border-0DJFDiij.js.map +1 -0
  11. package/dist/lib/Button-MpMIYBYJ.js +2 -0
  12. package/dist/lib/Button-MpMIYBYJ.js.map +1 -0
  13. package/dist/lib/{Card-a4dzYrbX.js → Card-QYo27r5b.js} +2 -2
  14. package/dist/lib/{Card-a4dzYrbX.js.map → Card-QYo27r5b.js.map} +1 -1
  15. package/dist/lib/Checkbox-D0JYK-wc.js +2 -0
  16. package/dist/lib/Checkbox-D0JYK-wc.js.map +1 -0
  17. package/dist/lib/CheckboxMenuRow-CesLhSnp.js +2 -0
  18. package/dist/lib/CheckboxMenuRow-CesLhSnp.js.map +1 -0
  19. package/dist/lib/CodeEditor-N1FQodcF.js +2 -0
  20. package/dist/lib/CodeEditor-N1FQodcF.js.map +1 -0
  21. package/dist/lib/ComboBox-Dx8Tk9yg.js +2 -0
  22. package/dist/lib/ComboBox-Dx8Tk9yg.js.map +1 -0
  23. package/dist/lib/Component-B0ShfPVi.js +2 -0
  24. package/dist/lib/Component-B0ShfPVi.js.map +1 -0
  25. package/dist/lib/Container-abY5Ww3W.js +2 -0
  26. package/dist/lib/{Container-0bsG2Q8Z.js.map → Container-abY5Ww3W.js.map} +1 -1
  27. package/dist/lib/DOM-C-Edb3tA.js +2 -0
  28. package/dist/lib/DOM-C-Edb3tA.js.map +1 -0
  29. package/dist/lib/Dialog-cbA9V17e.js +2 -0
  30. package/dist/lib/Dialog-cbA9V17e.js.map +1 -0
  31. package/dist/lib/{FieldDecorator-Bpx8J8n9.js → FieldDecorator-BlYMfZ9L.js} +2 -2
  32. package/dist/lib/{FieldDecorator-Bpx8J8n9.js.map → FieldDecorator-BlYMfZ9L.js.map} +1 -1
  33. package/dist/lib/{Fit-CL1m1nIZ.js → Fit-BhlB-HAo.js} +2 -2
  34. package/dist/lib/{Fit-CL1m1nIZ.js.map → Fit-BhlB-HAo.js.map} +1 -1
  35. package/dist/lib/FloatingPanel-DkJXsZ2D.js +2 -0
  36. package/dist/lib/FloatingPanel-DkJXsZ2D.js.map +1 -0
  37. package/dist/lib/{Glyph-wN7bk7mg.js → Glyph-_VeBacS2.js} +2 -2
  38. package/dist/lib/{Glyph-wN7bk7mg.js.map → Glyph-_VeBacS2.js.map} +1 -1
  39. package/dist/lib/{Grid-DHHmaB-Y.js → Grid-Daiz7F5d.js} +2 -2
  40. package/dist/lib/Grid-Daiz7F5d.js.map +1 -0
  41. package/dist/lib/GridConstraints-C58LuTqM.js +2 -0
  42. package/dist/lib/{GridConstraints-DVc1BmlP.js.map → GridConstraints-C58LuTqM.js.map} +1 -1
  43. package/dist/lib/{Header-2hKwQo_u.js → Header-Dql3Zxc6.js} +2 -2
  44. package/dist/lib/{Header-2hKwQo_u.js.map → Header-Dql3Zxc6.js.map} +1 -1
  45. package/dist/lib/{IconText-DC7Xe34b.js → IconText-PUjhTLlp.js} +2 -2
  46. package/dist/lib/{IconText-DC7Xe34b.js.map → IconText-PUjhTLlp.js.map} +1 -1
  47. package/dist/lib/LanguageRegistry-CcVnbKuh.js +2 -0
  48. package/dist/lib/LanguageRegistry-CcVnbKuh.js.map +1 -0
  49. package/dist/lib/LayoutSerialization-CMxunLfV.js +2 -0
  50. package/dist/lib/LayoutSerialization-CMxunLfV.js.map +1 -0
  51. package/dist/lib/List-nx8220Fi.js +2 -0
  52. package/dist/lib/{List-CG4NvwuV.js.map → List-nx8220Fi.js.map} +1 -1
  53. package/dist/lib/MemoryStore-DhPoU-7X.js +2 -0
  54. package/dist/lib/MemoryStore-DhPoU-7X.js.map +1 -0
  55. package/dist/lib/Menu-Q0bpXXze.js +2 -0
  56. package/dist/lib/Menu-Q0bpXXze.js.map +1 -0
  57. package/dist/lib/{MenuButton-wy_0RskC.js → MenuButton-DCXi0tsP.js} +2 -2
  58. package/dist/lib/{MenuButton-wy_0RskC.js.map → MenuButton-DCXi0tsP.js.map} +1 -1
  59. package/dist/lib/OverlayFade-3pof2AJH.js +2 -0
  60. package/dist/lib/OverlayFade-3pof2AJH.js.map +1 -0
  61. package/dist/lib/Panel-Cy1pdlWO.js +2 -0
  62. package/dist/lib/{Panel-Rd9zkNXx.js.map → Panel-Cy1pdlWO.js.map} +1 -1
  63. package/dist/lib/{Position-Ck_KD4cR.js → Position-BwtxouxK.js} +2 -2
  64. package/dist/lib/{Position-Ck_KD4cR.js.map → Position-BwtxouxK.js.map} +1 -1
  65. package/dist/lib/{ProgressSpinner-yt-VXyCb.js → ProgressSpinner-DK8xEQ9y.js} +2 -2
  66. package/dist/lib/{ProgressSpinner-yt-VXyCb.js.map → ProgressSpinner-DK8xEQ9y.js.map} +1 -1
  67. package/dist/lib/RadioButton-BEwpqg1k.js +2 -0
  68. package/dist/lib/RadioButton-BEwpqg1k.js.map +1 -0
  69. package/dist/lib/RadioMenuRow-DP5qPyFR.js +2 -0
  70. package/dist/lib/RadioMenuRow-DP5qPyFR.js.map +1 -0
  71. package/dist/lib/{RovingTabIndex-DFJyoveq.js → RovingTabIndex-pHEv5oLD.js} +2 -2
  72. package/dist/lib/{RovingTabIndex-DFJyoveq.js.map → RovingTabIndex-pHEv5oLD.js.map} +1 -1
  73. package/dist/lib/Scrollbar-t8fFrUVQ.js +2 -0
  74. package/dist/lib/Scrollbar-t8fFrUVQ.js.map +1 -0
  75. package/dist/lib/Slider-CTbwR6HR.js +2 -0
  76. package/dist/lib/Slider-CTbwR6HR.js.map +1 -0
  77. package/dist/lib/{Spacer-qalSEJ5i.js → Spacer-srdN2d2b.js} +2 -2
  78. package/dist/lib/{Spacer-qalSEJ5i.js.map → Spacer-srdN2d2b.js.map} +1 -1
  79. package/dist/lib/TabButton-DLoMQzky.js +2 -0
  80. package/dist/lib/TabButton-DLoMQzky.js.map +1 -0
  81. package/dist/lib/TabCloseButton-CY7BGitY.js +2 -0
  82. package/dist/lib/TabCloseButton-CY7BGitY.js.map +1 -0
  83. package/dist/lib/Text-CMKnK9uB.js +2 -0
  84. package/dist/lib/Text-CMKnK9uB.js.map +1 -0
  85. package/dist/lib/{Tooltip-Dro4DOZs.js → Tooltip-CUOJOqQi.js} +3 -3
  86. package/dist/lib/Tooltip-CUOJOqQi.js.map +1 -0
  87. package/dist/lib/Tree-C64JNPWJ.js +2 -0
  88. package/dist/lib/Tree-C64JNPWJ.js.map +1 -0
  89. package/dist/lib/VBox-DfJPWXqc.js +2 -0
  90. package/dist/lib/VBox-DfJPWXqc.js.map +1 -0
  91. package/dist/lib/{Validator-Du8PqS5i.js → Validator-Cjs1EU5Q.js} +2 -2
  92. package/dist/lib/{Validator-Du8PqS5i.js.map → Validator-Cjs1EU5Q.js.map} +1 -1
  93. package/dist/lib/VirtualScroller-DTIn19o1.js +2 -0
  94. package/dist/lib/VirtualScroller-DTIn19o1.js.map +1 -0
  95. package/dist/lib/assets/StoreWorker-B5NwRM2I.js +2 -0
  96. package/dist/lib/assets/StoreWorker-B5NwRM2I.js.map +1 -0
  97. package/dist/lib/component/button.es.js +1 -1
  98. package/dist/lib/component/button.es.js.map +1 -1
  99. package/dist/lib/component/chart.es.js +1 -1
  100. package/dist/lib/component/chart.es.js.map +1 -1
  101. package/dist/lib/component/container.es.js +1 -1
  102. package/dist/lib/component/container.es.js.map +1 -1
  103. package/dist/lib/component/diagram.es.js +1 -1
  104. package/dist/lib/component/diagram.es.js.map +1 -1
  105. package/dist/lib/component/display.es.js +1 -1
  106. package/dist/lib/component/display.es.js.map +1 -1
  107. package/dist/lib/component/editor.es.js +3 -3
  108. package/dist/lib/component/editor.es.js.map +1 -1
  109. package/dist/lib/component/input.es.js +1 -1
  110. package/dist/lib/component/input.es.js.map +1 -1
  111. package/dist/lib/component/list.es.js +1 -1
  112. package/dist/lib/component/list.es.js.map +1 -1
  113. package/dist/lib/component/menubar.es.js +1 -1
  114. package/dist/lib/component/menubar.es.js.map +1 -1
  115. package/dist/lib/component/table.es.js +6 -3
  116. package/dist/lib/component/table.es.js.map +1 -1
  117. package/dist/lib/component/tree.es.js +1 -1
  118. package/dist/lib/component/tree.es.js.map +1 -1
  119. package/dist/lib/core.es.js +1 -1
  120. package/dist/lib/core.es.js.map +1 -1
  121. package/dist/lib/data.es.js +1 -1
  122. package/dist/lib/glyphs/solid/index.es.js +1 -1
  123. package/dist/lib/languages-Dl8qdL8a.js +2 -0
  124. package/dist/lib/languages-Dl8qdL8a.js.map +1 -0
  125. package/dist/lib/layout.es.js +1 -1
  126. package/dist/lib/layout.es.js.map +1 -1
  127. package/dist/lib/overlay.es.js +1 -1
  128. package/dist/lib/overlay.es.js.map +1 -1
  129. package/dist/lib/primitive.es.js +1 -1
  130. package/dist/lib/router.es.js +1 -1
  131. package/dist/lib/router.es.js.map +1 -1
  132. package/dist/lib/selectionsEqual-gMG7gCVI.js +2 -0
  133. package/dist/lib/selectionsEqual-gMG7gCVI.js.map +1 -0
  134. package/dist/lib/types/component/button/Button.d.ts +13 -0
  135. package/dist/lib/types/component/button/MenuButton.d.ts +1 -0
  136. package/dist/lib/types/component/button/PopupButton.d.ts +22 -0
  137. package/dist/lib/types/component/button/TabButton.d.ts +5 -1
  138. package/dist/lib/types/component/button/ToggleButton.d.ts +1 -1
  139. package/dist/lib/types/component/button/index.d.ts +2 -0
  140. package/dist/lib/types/component/chart/ChartLegend.d.ts +1 -1
  141. package/dist/lib/types/component/container/CheckboxMenuRow.d.ts +33 -0
  142. package/dist/lib/types/component/container/CollapseButton.d.ts +11 -3
  143. package/dist/lib/types/component/container/FloatingPanel.d.ts +23 -0
  144. package/dist/lib/types/component/container/MenuItem.d.ts +15 -5
  145. package/dist/lib/types/component/container/MenuRow.d.ts +24 -0
  146. package/dist/lib/types/component/container/MenuSeparator.d.ts +4 -2
  147. package/dist/lib/types/component/container/RadioMenuRow.d.ts +33 -0
  148. package/dist/lib/types/component/container/ScrollStrip.d.ts +1 -1
  149. package/dist/lib/types/component/container/Scrollbar.d.ts +6 -3
  150. package/dist/lib/types/component/container/SplitGutter.d.ts +7 -2
  151. package/dist/lib/types/component/container/TabBar.d.ts +3 -1
  152. package/dist/lib/types/component/container/WindowBorder.d.ts +1 -1
  153. package/dist/lib/types/component/container/index.d.ts +8 -1
  154. package/dist/lib/types/component/diagram/DiagramGroupNode.d.ts +1 -1
  155. package/dist/lib/types/component/display/Markdown.d.ts +42 -1
  156. package/dist/lib/types/component/display/MarkdownMinimap.d.ts +38 -0
  157. package/dist/lib/types/component/display/MarkdownViewer.d.ts +60 -0
  158. package/dist/lib/types/component/display/WebGLCanvas.d.ts +1 -0
  159. package/dist/lib/types/component/display/index.d.ts +6 -0
  160. package/dist/lib/types/component/editor/CodeEditor.d.ts +13 -0
  161. package/dist/lib/types/component/editor/index.d.ts +1 -1
  162. package/dist/lib/types/component/input/AbstractCalendarDropdown.d.ts +2 -0
  163. package/dist/lib/types/component/input/AbstractPickerField.d.ts +3 -2
  164. package/dist/lib/types/component/input/Checkbox.d.ts +1 -1
  165. package/dist/lib/types/component/input/RadioButton.d.ts +1 -1
  166. package/dist/lib/types/component/input/Slider.d.ts +1 -1
  167. package/dist/lib/types/component/input/Text.d.ts +0 -2
  168. package/dist/lib/types/component/input/Toggle.d.ts +1 -1
  169. package/dist/lib/types/component/list/AbstractSelectableList.d.ts +1 -1
  170. package/dist/lib/types/component/list/MultiSelectList.d.ts +2 -1
  171. package/dist/lib/types/component/menubar/MenuBar.d.ts +1 -1
  172. package/dist/lib/types/component/menubar/ToolBar.d.ts +1 -0
  173. package/dist/lib/types/component/shared/VirtualRowView.d.ts +2 -0
  174. package/dist/lib/types/component/table/Body.d.ts +23 -1
  175. package/dist/lib/types/component/table/Column.d.ts +3 -1
  176. package/dist/lib/types/component/table/ColumnConfig.d.ts +2 -0
  177. package/dist/lib/types/component/table/ColumnFilter.d.ts +27 -0
  178. package/dist/lib/types/component/table/Header.d.ts +30 -3
  179. package/dist/lib/types/component/table/Row.d.ts +4 -0
  180. package/dist/lib/types/component/table/Table.d.ts +29 -0
  181. package/dist/lib/types/component/table/TableExporter.d.ts +4 -3
  182. package/dist/lib/types/component/table/TreeBody.d.ts +2 -1
  183. package/dist/lib/types/component/table/cell/CellText.d.ts +9 -0
  184. package/dist/lib/types/component/table/cell/Filter.d.ts +54 -0
  185. package/dist/lib/types/component/table/cell/FilterClauseBadge.d.ts +21 -0
  186. package/dist/lib/types/component/table/cell/GroupSeparator.d.ts +9 -0
  187. package/dist/lib/types/component/table/cell/Header.d.ts +1 -0
  188. package/dist/lib/types/component/table/cell/SortPriorityBadge.d.ts +1 -1
  189. package/dist/lib/types/component/table/cell/editor/CellEditor.d.ts +1 -0
  190. package/dist/lib/types/component/table/cell/editor/CellEditorPool.d.ts +1 -0
  191. package/dist/lib/types/component/table/cell/editor/Date.d.ts +1 -0
  192. package/dist/lib/types/component/table/cell/editor/DateTime.d.ts +1 -0
  193. package/dist/lib/types/component/table/cell/editor/Time.d.ts +1 -0
  194. package/dist/lib/types/component/table/cell/renderer/CellRenderer.d.ts +1 -0
  195. package/dist/lib/types/component/table/cell/renderer/Combo.d.ts +2 -0
  196. package/dist/lib/types/component/table/cell/renderer/Date.d.ts +2 -0
  197. package/dist/lib/types/component/table/cell/renderer/DateTime.d.ts +2 -0
  198. package/dist/lib/types/component/table/cell/renderer/Filter.d.ts +16 -0
  199. package/dist/lib/types/component/table/cell/renderer/Glyph.d.ts +1 -0
  200. package/dist/lib/types/component/table/cell/renderer/Link.d.ts +2 -0
  201. package/dist/lib/types/component/table/cell/renderer/Number.d.ts +3 -1
  202. package/dist/lib/types/component/table/cell/renderer/String.d.ts +2 -0
  203. package/dist/lib/types/component/table/cell/renderer/Time.d.ts +2 -0
  204. package/dist/lib/types/component/table/cell/renderer/TreeCell.d.ts +1 -0
  205. package/dist/lib/types/component/table/index.d.ts +6 -0
  206. package/dist/lib/types/component/tree/Tree.d.ts +26 -2
  207. package/dist/lib/types/component/tree/index.d.ts +1 -1
  208. package/dist/lib/types/component/tree/renderer/Label.d.ts +1 -1
  209. package/dist/lib/types/core/AnimatedDropdown.d.ts +0 -9
  210. package/dist/lib/types/core/Body.d.ts +4 -0
  211. package/dist/lib/types/core/ClassStyleRules.d.ts +1 -0
  212. package/dist/lib/types/core/Component.d.ts +5 -0
  213. package/dist/lib/types/core/DOM.d.ts +10 -0
  214. package/dist/lib/types/core/Event.d.ts +11 -2
  215. package/dist/lib/types/core/OverlayFade.d.ts +12 -0
  216. package/dist/lib/types/core/OverlayPosition.d.ts +6 -0
  217. package/dist/lib/types/core/Theme.d.ts +12 -2
  218. package/dist/lib/types/core/index.d.ts +5 -3
  219. package/dist/lib/types/data/AbstractStore.d.ts +3 -0
  220. package/dist/lib/types/data/FilterDescriptor.d.ts +13 -0
  221. package/dist/lib/types/data/index.d.ts +2 -1
  222. package/dist/lib/types/data/temporalText.d.ts +2 -0
  223. package/dist/lib/types/layout/BoxLayout.d.ts +6 -1
  224. package/dist/lib/types/layout/Grid.d.ts +1 -0
  225. package/dist/lib/types/layout/HFlow.d.ts +1 -1
  226. package/dist/lib/types/layout/LayoutManager.d.ts +8 -0
  227. package/dist/lib/types/layout/Split.d.ts +10 -1
  228. package/dist/lib/types/layout/Tab.d.ts +7 -1
  229. package/dist/lib/types/layout/VFlow.d.ts +1 -1
  230. package/dist/lib/types/layout/index.d.ts +1 -1
  231. package/dist/lib/types/overlay/Dock.d.ts +1 -0
  232. package/dist/lib/types/overlay/Menu.d.ts +1 -1
  233. package/dist/lib/types/overlay/Popover.d.ts +3 -0
  234. package/dist/lib/types/overlay/PopupPanel.d.ts +17 -0
  235. package/dist/lib/types/overlay/Window.d.ts +2 -0
  236. package/dist/lib/types/overlay/index.d.ts +2 -0
  237. package/dist/lib/types/router/RoutePattern.d.ts +7 -0
  238. package/dist/lib/types/router/Router.d.ts +6 -2
  239. package/dist/lib/types/router/index.d.ts +1 -1
  240. package/dist/lib/validation.es.js +1 -1
  241. package/llms.txt +7 -0
  242. package/package.json +15 -15
  243. package/dist/lib/AbstractBooleanInput-DE5NNJT0.js +0 -2
  244. package/dist/lib/AbstractBooleanInput-DE5NNJT0.js.map +0 -1
  245. package/dist/lib/AnchorConstraints-DdDYSDkf.js +0 -2
  246. package/dist/lib/AnchorConstraints-DdDYSDkf.js.map +0 -1
  247. package/dist/lib/AnimatedDropdown-QLNasu_Y.js +0 -2
  248. package/dist/lib/AnimatedDropdown-QLNasu_Y.js.map +0 -1
  249. package/dist/lib/Border-CKKUk5G9.js +0 -2
  250. package/dist/lib/Border-CKKUk5G9.js.map +0 -1
  251. package/dist/lib/Button-MZDYJOMC.js +0 -2
  252. package/dist/lib/Button-MZDYJOMC.js.map +0 -1
  253. package/dist/lib/ComboBox-C04SfXAR.js +0 -2
  254. package/dist/lib/ComboBox-C04SfXAR.js.map +0 -1
  255. package/dist/lib/Component-fRQvgaEY.js +0 -2
  256. package/dist/lib/Component-fRQvgaEY.js.map +0 -1
  257. package/dist/lib/Container-0bsG2Q8Z.js +0 -2
  258. package/dist/lib/DOM-67StIm5G.js +0 -2
  259. package/dist/lib/DOM-67StIm5G.js.map +0 -1
  260. package/dist/lib/DragManager-DRor_-1x.js +0 -2
  261. package/dist/lib/DragManager-DRor_-1x.js.map +0 -1
  262. package/dist/lib/Grid-DHHmaB-Y.js.map +0 -1
  263. package/dist/lib/GridConstraints-DVc1BmlP.js +0 -2
  264. package/dist/lib/LayoutSerialization-D5bBas4W.js +0 -2
  265. package/dist/lib/LayoutSerialization-D5bBas4W.js.map +0 -1
  266. package/dist/lib/LayoutSizes-qNaURyiw.js +0 -2
  267. package/dist/lib/LayoutSizes-qNaURyiw.js.map +0 -1
  268. package/dist/lib/List-CG4NvwuV.js +0 -2
  269. package/dist/lib/MemoryStore-DT6iWWco.js +0 -2
  270. package/dist/lib/MemoryStore-DT6iWWco.js.map +0 -1
  271. package/dist/lib/Menu-CrZy2u0g.js +0 -2
  272. package/dist/lib/Menu-CrZy2u0g.js.map +0 -1
  273. package/dist/lib/Panel-Rd9zkNXx.js +0 -2
  274. package/dist/lib/RadioButton-D23rId-V.js +0 -2
  275. package/dist/lib/RadioButton-D23rId-V.js.map +0 -1
  276. package/dist/lib/Scrollbar-SOj9psiP.js +0 -2
  277. package/dist/lib/Scrollbar-SOj9psiP.js.map +0 -1
  278. package/dist/lib/Slider-DBnAZ-F7.js +0 -2
  279. package/dist/lib/Slider-DBnAZ-F7.js.map +0 -1
  280. package/dist/lib/TabButton-DKECTTk1.js +0 -2
  281. package/dist/lib/TabButton-DKECTTk1.js.map +0 -1
  282. package/dist/lib/Text-KB5LksJl.js +0 -2
  283. package/dist/lib/Text-KB5LksJl.js.map +0 -1
  284. package/dist/lib/Tooltip-Dro4DOZs.js.map +0 -1
  285. package/dist/lib/VBox-P3WFGkPc.js +0 -2
  286. package/dist/lib/VBox-P3WFGkPc.js.map +0 -1
  287. package/dist/lib/VirtualScroller-Bv4KXGKW.js +0 -2
  288. package/dist/lib/VirtualScroller-Bv4KXGKW.js.map +0 -1
  289. package/dist/lib/assets/StoreWorker-CgOBYoai.js +0 -2
  290. package/dist/lib/assets/StoreWorker-CgOBYoai.js.map +0 -1
  291. package/dist/lib/selectionsEqual-Ci3_uflt.js +0 -2
  292. package/dist/lib/selectionsEqual-Ci3_uflt.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{t as e}from"./DOM-67StIm5G.js";import{l as t,n,o as r,t as i}from"./Position-Ck_KD4cR.js";import{S as a,b as o,h as s,t as c,v as l}from"./Component-fRQvgaEY.js";import{t as u}from"./ListenerBag-WPdKuuds.js";import{t as d}from"./Container-0bsG2Q8Z.js";import{t as f}from"./Glyph-wN7bk7mg.js";import{t as p}from"./Panel-Rd9zkNXx.js";import{a as m,t as ee}from"./Tooltip-Dro4DOZs.js";import{n as te,r as ne}from"./AnimatedDropdown-QLNasu_Y.js";import{t as h}from"./Fit-CL1m1nIZ.js";import{t as g}from"./Text-KB5LksJl.js";import{i as re,n as ie,r as ae}from"./VBox-P3WFGkPc.js";import{a as _,d as v,f as y,g as oe,l as se,o as b,p as x}from"./LayoutSizes-qNaURyiw.js";import{r as ce,t as le}from"./Border-CKKUk5G9.js";import{t as S}from"./Placement-7kqdaK4Z.js";import{t as C}from"./LayoutConstraints-LIHYYd2F.js";import{t as w}from"./Button-MZDYJOMC.js";import{xmark as T}from"./glyphs/solid/xmark.es.js";import{a as ue,i as de,o as fe,r as pe,t as E}from"./DragManager-DRor_-1x.js";import{t as me}from"./Menu-CrZy2u0g.js";import{circle_check as D}from"./glyphs/solid/circle_check.es.js";import{circle_info as O}from"./glyphs/solid/circle_info.es.js";import{triangle_exclamation as he}from"./glyphs/solid/triangle_exclamation.es.js";import{circle_exclamation as ge}from"./glyphs/solid/circle_exclamation.es.js";import{t as _e}from"./MenuButton-wy_0RskC.js";import{clock_rotate_left as ve}from"./glyphs/solid/clock_rotate_left.es.js";import{a as ye,i as k,n as be,r as xe,t as Se}from"./LayoutSerialization-D5bBas4W.js";var A=14,j=A/2*Math.SQRT2,M=Math.ceil(j)+2,N=6,P=5,F=120,Ce={insets:new n(5,5,5,5),placement:`auto`,dismissOn:`click-outside`,showArrow:!0},Popover=class extends d{_resolvedPlacement=`bottom`;_bodyComponent=null;_actionsRow=null;_fadeShowAnimation=null;_fadeHideAnimation=null;_anchorElement=null;_arrowComponent=null;_isOpen=!1;_scrollAncestors=[];_onWindowResize;_onScroll;constructor(e,t){super(e,{...Ce,...t??{}});let n=new ie;n.setStretching(!0),this.setLayoutManager(n),this.setBackgroundColor(`var(--ts-ui-popover-bg, rgb(255, 255, 255))`),this.setForegroundColor(`var(--ts-ui-popover-color, rgb(0, 0, 0))`),this.setBorder({border:`1px solid var(--ts-ui-popover-border, rgb(200, 200, 200))`}),this.setBorderRadius(`var(--ts-ui-popover-radius, 6px)`),this.setShadow(`var(--ts-ui-popover-shadow, 2px 4px 12px rgba(0, 0, 0, 0.18))`),this.setPosition(i.FIXED),this.setVisible(!1),this.setContain(`layout`),this.setOverflow(`visible`),this.getAria().setRole(`dialog`),this._onWindowResize=()=>this._reposition(),this._onScroll=()=>this._reposition(),this._title??=null,this._titleComponent??=null}applyOptions(e){return super.applyOptions(e),this.setPlacement(e.placement??this.getPlacement()),this.setDismissOn(e.dismissOn??this.getDismissOn()),this.setShowArrow(e.showArrow??this.isShowArrow()),e.title!==void 0&&this.setTitle(e.title),this}setPlacement(e){return this._placement=e,this}getPlacement(){return this._placement??this._defaultOptions.placement}setDismissOn(e){return this._dismissOn=e,this}getDismissOn(){return this._dismissOn??this._defaultOptions.dismissOn}setShowArrow(e){return this._showArrow=e,this._arrowComponent&&this._arrowComponent.setVisible(e),this}isShowArrow(){return this._showArrow??this._defaultOptions.showArrow}setTitle(e){return e===null?this.clearTitle():(this._title=e,this._titleComponent?this._titleComponent.setText(e):(this._titleComponent=new g(e),this._titleComponent.setFontWeight(`bold`),this.insertComponent(this._titleComponent,0)),this)}getTitle(){return this._title}clearTitle(){return this._titleComponent&&=(this.removeComponent(this._titleComponent),null),this._title=null,this}setBody(e){this._bodyComponent&&=(this.removeComponent(this._bodyComponent),null);let t=typeof e==`string`?new g(e):e;this._bodyComponent=t;let n=+!!this._titleComponent;return this.insertComponent(t,n),this}getBody(){return this._bodyComponent}addAction(e,t){this._actionsRow||(this._actionsRow=new c,this._actionsRow.setLayoutManager(new ae),this.addComponent(this._actionsRow));let n=new w(e);return n.on(`action`,t),this._actionsRow.addComponent(n),this}clearActions(){return this._actionsRow&&=(this.removeComponent(this._actionsRow),null),this}_attachToElement(e){return this._anchorElement=e,this}attachToComponent(e){return this._attachToElement(e.getElement(!0))}show(){if(!this._anchorElement)return console.warn(`Popover.show(): no anchor attached; call attachToComponent first.`),this;this._isOpen=!0,m.register(this),this.setZIndex(m.getZIndex(this));let e=this.getElement(!0);return m.mount(e),y(this),this.ensureArrow(),this.setVisible(!0),this.doLayout(),this._reposition(),this._fadeShowAnimation?.cancel(),this._fadeShowAnimation=ne(this,{durationMs:F}),this.attachRepositionListeners(),this}hide(){return this._isOpen?(this._isOpen=!1,this.detachRepositionListeners(),m.unregister(this),x(this),this._fadeHideAnimation?.cancel(),this._fadeHideAnimation=te(this,{durationMs:F}),this):this}isOpen(){return this._isOpen}getLayerElement(){return this.getElement()??null}getDismissMode(){return this._dismissOn??this._defaultOptions.dismissOn}requestClose(){this.hide()}getAnchorElement(){return this._anchorElement}getBand(){return m.Band.Popover}doLayout(){return super.doLayout(),this._arrowComponent&&this._showArrow&&this._anchorElement&&this.positionArrow(),this}destructor(){this._isOpen&&this.hide(),this._fadeShowAnimation?.cancel(),this._fadeShowAnimation=null,this._fadeHideAnimation?.cancel(),this._fadeHideAnimation=null,this._arrowComponent?.dispose(),this._anchorElement=null,this._titleComponent=null,this._bodyComponent=null,this._actionsRow=null,this._arrowComponent=null,super.destructor()}_reposition(){if(!this._anchorElement)return;let n=e.source.getElementRect(this._anchorElement);if(n.width===0&&n.height===0){this.hide();return}let r=this.getPreferredSize(),i=r?.width??this.getWidth(),a=r?.height??this.getHeight(),o=e.source.getViewportSize(),s=this.resolvePlacement(n,i,a,o);this._resolvedPlacement=s;let c=0,l=0;s===`top`?(c=n.left+(n.width-i)/2,l=n.top-a-M):s===`bottom`?(c=n.left+(n.width-i)/2,l=n.bottom+M):s===`left`?(c=n.left-i-M,l=n.top+(n.height-a)/2):(c=n.right+M,l=n.top+(n.height-a)/2);let u=P,d=o.width-i-P,f=P,p=o.height-a-P;s===`right`?u+=j:s===`left`?d-=j:s===`bottom`?f+=j:p-=j,c=t.clamp(c,u,d),l=t.clamp(l,f,p),this.setX(c),this.setY(l),this.setWidth(i),this.setHeight(a),this._arrowComponent&&this._showArrow&&this.positionArrow()}resolvePlacement(e,t,n,r){let i=e.top,a=r.height-e.bottom,o=e.left,s=r.width-e.right;if(this._placement===`auto`){let e=n+M,r=t+M,c=[{side:`bottom`,space:a,need:e},{side:`top`,space:i,need:e},{side:`right`,space:s,need:r},{side:`left`,space:o,need:r}],l=c.filter(e=>e.space>=e.need),u=l.length>0?l:c;return u.sort((e,t)=>t.space-e.space),u[0].side}let fits=e=>e===`top`?i>=n+M:e===`bottom`?a>=n+M:e===`left`?o>=t+M:s>=t+M;if(fits(this._placement))return this._placement;let c={top:`bottom`,bottom:`top`,left:`right`,right:`left`}[this._placement];return console.warn(`Popover: explicit placement "${this._placement}" overflows the viewport; falling back to "${c}".`),c}ensureArrow(){if(this._arrowComponent)return;let t=new c,n=A;t.setBackgroundColor(`var(--ts-ui-popover-bg, rgb(255, 255, 255))`),t.setWidth(n),t.setHeight(n),t.setTransform(`rotate(45deg)`),t.setPointerEvents(`none`),t.setVisible(this._showArrow),this._arrowComponent=t;let r=this.getElement(!0);e.sink.insertBefore(r,t.getElement(!0),e.source.getFirstChild(r))}positionArrow(){if(!this._anchorElement||!this._arrowComponent)return;let t=e.source.getElementRect(this._anchorElement),n=A,r=n/2,i=this.getX(),a=this.getY(),o=this.getWidth(),s=this.getHeight(),clamp=(e,t,n)=>Math.max(t,Math.min(e,n)),c=`var(--ts-ui-popover-border, rgb(200, 200, 200))`,l;l=this._resolvedPlacement===`bottom`?`inset 1px 0 0 ${c}, inset 0 1px 0 ${c}`:this._resolvedPlacement===`top`?`inset -1px 0 0 ${c}, inset 0 -1px 0 ${c}`:this._resolvedPlacement===`right`?`inset 1px 0 0 ${c}, inset 0 -1px 0 ${c}`:`inset 0 1px 0 ${c}, inset -1px 0 0 ${c}`,this._arrowComponent.setShadow(l);let u=e.source.getViewportSize(),d=this.getBorderSize();if(this._resolvedPlacement===`top`||this._resolvedPlacement===`bottom`){let e=t.left+t.width/2,a=Math.max(N,P-i+j-r),c=Math.min(o-n-N,u.width-P-i-r-j),l=clamp(e-i-r-d.left,a,c);this._arrowComponent.setX(l),this._resolvedPlacement===`bottom`?this._arrowComponent.setY(-7-d.top):this._arrowComponent.setY(s-r-d.top)}else{let e=t.top+t.height/2,i=Math.max(N,P-a+j-r),c=Math.min(s-n-N,u.height-P-a-r-j),l=clamp(e-a-r-d.top,i,c);this._arrowComponent.setY(l),this._resolvedPlacement===`right`?this._arrowComponent.setX(-7-d.left):this._arrowComponent.setX(o-r-d.left)}}attachRepositionListeners(){if(a.addViewportListener(this,`resize`,this._onWindowResize),this._anchorElement){this._scrollAncestors=this.collectScrollAncestors(this._anchorElement);for(let t of this._scrollAncestors)e.sink.addListener(t,`scroll`,this._onScroll,{passive:!0})}}detachRepositionListeners(){a.removeViewportListener(this,`resize`,this._onWindowResize);for(let t of this._scrollAncestors)e.sink.removeListener(t,`scroll`,this._onScroll);this._scrollAncestors=[]}collectScrollAncestors(t){let n=[],r=e.source.getParentElement(t);for(;r&&r!==e.source.getDocumentElement();){let t=e.source.getComputedOverflow(r),i=t.overflow+t.overflowX+t.overflowY;/(auto|scroll|overlay)/.test(i)&&n.push(r),r=e.source.getParentElement(r)}return n.push(e.source.getDocumentElement()),n}},we=s(Popover),Te={},DialogBackdrop=class extends c{constructor(t,n){super(t,{...Te,...n??{}});let r=e.source.getViewportSize();this.setPosition(i.FIXED),this.setX(0),this.setY(0),this.setWidth(r.width),this.setHeight(r.height),this.setZIndex(10100),this.setBackgroundColor(`var(--ts-ui-dialog-backdrop-bg)`)}addClickListener(e){return a.addListener(this,`click`,e),this}resize(){let t=e.source.getViewportSize();this.setWidth(t.width),this.setHeight(t.height)}destroy(){this.removeElement(),this.destructor()}},I=s(DialogBackdrop);f.register(T,D,O,he,ge);var L=36,R=52,Ee=90,De=8,Oe=11,z=20,B=12,ke=320,V=160,H=80,Ae=24,je={info:`circle-info`,success:`circle-check`,warning:`triangle-exclamation`,error:`circle-exclamation`},U=150,W=`button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`,G=4,K=4,Me=8,DialogTitleBar=class extends c{_titleText;_closeButton=null;_titleGlyph=null;constructor(e,t,r){super(),this.setBackgroundColor(`var(--ts-ui-body-bg)`),this.setBorder({border:`none`,borderBottom:`1px solid var(--ts-ui-dialog-border)`}),this.setPreferredSize({width:0,height:L}),this._titleText=new g(e),this._titleText.setFontWeight(`bold`),this._titleText.setOverflow(`hidden`),this._titleText.setTextOverflow(`ellipsis`),this._titleText.setWhiteSpace(`nowrap`),this._titleText.centerInHeight(L-G*2),this.addComponent(this._titleText),r&&(this._closeButton=new w({glyph:`xmark`}),this._closeButton.setInsets(new n(0,0,0,0)),this._closeButton.setBorder(`none`),this._closeButton.clearBackgroundImage(),this._closeButton.setBackgroundColor(`transparent`),this._closeButton.clearShadow(),this._closeButton.clearPressedShadow(),this._closeButton.clearHoverShadow(),this._closeButton.setHoverBackgroundColor(`var(--ts-ui-titlebar-btn-hover-bg, rgba(0, 0, 0, 0.08))`),this._closeButton.setPressedBackgroundColor(`var(--ts-ui-titlebar-btn-active-bg, rgba(0, 0, 0, 0.16))`),this._closeButton.clearHoverBackgroundImage(),this._closeButton.clearPressedBackgroundImage(),this._closeButton.setPreferredSize({width:z,height:z}),this.addComponent(this._closeButton),this._closeButton.on(`action`,t))}getCloseButton(){return this._closeButton}getTitleText(){return this._titleText}setGlyph(e){this._titleGlyph&&=(this.removeComponent(this._titleGlyph),null);let t=new f(e);return t.setPointerEvents(`none`),t.setPreferredSize({width:16,height:16}),this._titleGlyph=t,this.addComponent(t),this.doLayout(),this}clearGlyph(){return this._titleGlyph&&(this.removeComponent(this._titleGlyph),this._titleGlyph=null,this.doLayout()),this}getGlyph(){return this._titleGlyph}doLayout(){super.doLayout();let e=this.getContentBounds();if(!e)return this;let t=e.width,n=e.height,r=t-z-K,i=Math.floor((n-z)/2),a=this._closeButton?r:t-B,o=B;if(this._titleGlyph){let t=this._titleGlyph.getPreferredSize()??{width:16,height:16},r=Math.max(0,Math.floor((n-t.height)/2));this._titleGlyph.setX(e.x+B),this._titleGlyph.setY(e.y+r),this._titleGlyph.setWidth(t.width),this._titleGlyph.setHeight(t.height),o=B+t.width+Me}let s=Math.max(0,a-o-K),c=n-G*2;return this._titleText.setX(e.x+o),this._titleText.setY(e.y+G),this._titleText.setWidth(s),this._titleText.setHeight(c),this._closeButton&&(this._closeButton.setX(e.x+r),this._closeButton.setY(e.y+i),this._closeButton.setWidth(z),this._closeButton.setHeight(z),this._closeButton.doLayout()),this}},DialogButtonRow=class extends c{_buttons=[];constructor(e,t){super(),this.setBorder({border:`none`,borderTop:`1px solid var(--ts-ui-dialog-border)`}),this.setBackgroundColor(`var(--ts-ui-body-bg)`),this.setPreferredSize({width:0,height:R});for(let n of e){let e=new w(n.text,n.glyph===void 0?void 0:{glyph:n.glyph}),r=n.result??`cancel`;if(n.primary&&e.setBackgroundImage(`var(--ts-ui-toggle-selected-bg, rgb(200, 200, 200))`),n.glyph!==void 0){let t=e.getGlyph(),r=n.tint;t!==null&&r&&t.setForegroundColor(r)}e.on(`action`,()=>t(r)),this._buttons.push(e),this.addComponent(e)}}doLayout(){super.doLayout();let e=this.getContentBounds();if(!e)return this;let t=e.height-Oe*2,n=this._buttons.length*Ee+(this._buttons.length-1)*De,r=Math.round((e.width-n)/2);for(let n of this._buttons)n.setX(e.x+r),n.setY(e.y+Oe),n.setWidth(Ee),n.setHeight(t),n.doLayout(),r+=98;return this}},q={Confirm:{text:`Confirm`,result:`confirm`,glyph:`circle-check`,tint:`var(--ts-ui-dialog-confirm-color)`},Ok:{text:`Ok`,result:`confirm`,glyph:`circle-check`,tint:`var(--ts-ui-dialog-confirm-color)`},Cancel:{text:`Cancel`,result:`cancel`,glyph:`xmark`,tint:`var(--ts-ui-dialog-cancel-color)`},Close:{text:`Close`,result:`close`,glyph:`xmark`,tint:`var(--ts-ui-dialog-cancel-color)`}},J=[{...q.Ok,primary:!0}],Ne=class Dialog extends c{_titleBar;_contentContainer;_buttonRow;_backdrop;_config;_resolvePromise=null;_previousFocus=null;_boundKeyHandler;_boundResizeHandler;_panelInAnimation=null;_backdropInAnimation=null;_panelOutAnimation=null;_backdropOutAnimation=null;_finalizing=!1;constructor(e){super(),this._config=e;let t=Math.max(ke,e.width??480),r=e.buttons??J,a=Math.max(H,this.computeContentHeight(e)),o=Math.max(V,e.height??L+a+R);this.setPosition(i.FIXED),this.setWidth(t),this.setHeight(o),this.setBackgroundColor(`var(--ts-ui-body-bg)`),this.setBorderRadius(`var(--ts-ui-border-radius, 4px)`),this.setShadow(`var(--ts-ui-dialog-shadow)`),this.setOverflow(`hidden`),this.setContain(`strict`);let s=new le;if(s.setComponentSpacing(0),this.setLayoutManager(s),this._titleBar=new DialogTitleBar(e.title,()=>this.hide(`close`),e.dismissable!==!1),this.addComponent(this._titleBar,{placement:S.NORTH}),e.severity?this.applySeverityHeader(e.severity):this.applyHeaderVariant(this.computeHeaderVariant(r)),this._contentContainer=new p({autoScroll:`y`,layoutManager:new h,insets:new n(0,0,0,0)}),e.contentComponent)this._contentContainer.addComponent(e.contentComponent);else{let t=new g(e.message??``);t.setWhiteSpace(`normal`),t.setWordBreak(`break-word`),t.setPadding(new n(16,16,16,16)),this._contentContainer.addComponent(t)}this.addComponent(this._contentContainer,{placement:S.CENTER}),this._buttonRow=new DialogButtonRow(r,e=>this.hide(e)),this.addComponent(this._buttonRow,{placement:S.SOUTH}),this._backdrop=new I,this._boundKeyHandler=e=>this.onKeyDown(e),this._boundResizeHandler=()=>this.onViewportResize()}computeHeaderVariant(e){let t=new Set(e.map(e=>e.result??`cancel`));return t.size===1&&t.has(`confirm`)?`info`:t.has(`confirm`)&&t.has(`cancel`)?`affirm`:`plain`}applyHeaderVariant(e){if(e===`plain`)return;let t=e===`info`?`var(--ts-ui-dialog-info-bg)`:`var(--ts-ui-dialog-affirm-bg)`,n=e===`info`?`var(--ts-ui-dialog-info-fg)`:`var(--ts-ui-dialog-affirm-fg)`;if(this._titleBar.setBackgroundColor(t),this._titleBar.getTitleText().setForegroundColor(n),e===`info`){this._titleBar.setGlyph(`circle-info`);let e=this._titleBar.getGlyph();e!==null&&e.setForegroundColor(n)}}applySeverityHeader(e){let t=`var(--ts-ui-notification-${e}-bg)`,n=`var(--ts-ui-notification-${e}-border)`;this._titleBar.setBackgroundColor(t),this._titleBar.getTitleText().setForegroundColor(n),this._titleBar.setGlyph(je[e]);let r=this._titleBar.getGlyph();r!==null&&r.setForegroundColor(n)}computeContentHeight(e){if(e.contentComponent){let t=e.contentComponent.getPreferredSize();if(t)return t.height}return 100}show(){return new Promise(e=>{this._resolvePromise=e,this.open()})}resizeToContent(){if(!this.getElement())return this;let t=Math.max(H,this.computeContentHeight(this._config)),n=Math.max(V,L+t+R),r=e.source.getViewportSize(),i=Math.min(n,Math.max(V,r.height-Ae*2));return i===this.getHeight()?this:(this.setHeight(i),this.scheduleLayout(),this.center(),this)}open(){this._previousFocus=e.source.getActiveElement(),this._config.closeOnBackdrop&&this._config.dismissable!==!1&&this._backdrop.addClickListener(()=>{this.hide(`close`)}),m.register(this);let t=m.getZIndex(this);this.setZIndex(t),this._backdrop.setZIndex(t-1);let n=this._backdrop.getElement(!0);m.mount(n);let r=this.getElement(!0);m.mount(r),y(this),this.scheduleLayout(),this.center(),this.animateIn(),c.afterNextLayout(()=>this.resizeToContent()),a.addViewportListener(this,`keydown`,this._boundKeyHandler),a.addViewportListener(this,`resize`,this._boundResizeHandler),c.afterNextLayout(()=>this.focusFirst())}animateIn(){let e=this.getElement(),t=this._backdrop.getElement();e&&(this._panelInAnimation?.cancel(),this._panelInAnimation=l.play(e,{from:{opacity:`0`,transform:`scale(0.97)`},to:{opacity:`1`,transform:`scale(1)`},durationMs:U,properties:[`opacity`,`transform`]}),t&&(this._backdropInAnimation?.cancel(),this._backdropInAnimation=l.play(t,{from:{opacity:`0`},to:{opacity:`1`},durationMs:U,properties:[`opacity`]})))}center(){let t=e.source.getViewportSize(),n=Math.max(0,Math.round((t.width-this.getWidth())/2)),r=Math.max(0,Math.round((t.height-this.getHeight())/2));this.setX(n),this.setY(r)}focusFirst(){let t=this.requestedFocusElement();if(t){e.sink.focus(t);return}let n=this._contentContainer.getElement(),r=n?e.source.querySelectorAll(n,W):[];if(r.length>0){e.sink.focus(r[0]);return}let i=this.primaryButtonElement();if(i){e.sink.focus(i);return}let a=this.getElement(),o=a?e.source.querySelectorAll(a,W):[];o.length>0&&e.sink.focus(o[0])}requestedFocusElement(){let t=this._config.initialFocus?.getElement();return t?e.source.matches(t,W)?t:e.source.querySelector(t,W):null}primaryButtonElement(){let t=(this._config.buttons??J).findIndex(e=>e.primary);if(t<0)return null;let n=this._buttonRow.getElement();return(n?e.source.querySelectorAll(n,W):[])[t]??null}getFocusable(){let t=this.getElement();return t?e.source.querySelectorAll(t,W).filter(t=>!e.source.hasAttribute(t,`disabled`)):[]}onKeyDown(t){if(t.key===`Enter`)return this.onEnter(t);if(t.key===`Tab`){let n=this.getFocusable();if(n.length===0)return{stop:!0,prevent:!0};let r=n[0],i=n[n.length-1];if(t.shiftKey){if(e.source.getActiveElement()===r)return e.sink.focus(i),{stop:!0,prevent:!0}}else if(e.source.getActiveElement()===i)return e.sink.focus(r),{stop:!0,prevent:!0}}}onEnter(t){let n=e.source.getActiveElement(),r=n?e.source.getTagName(n).toLowerCase():null;if(r===`textarea`||r===`button`)return;let i=this.primaryResult();if(i!==null)return this.hide(i),{stop:!0,prevent:!0}}primaryResult(){let e=(this._config.buttons??J).find(e=>e.primary);return e?e.result??`cancel`:null}onViewportResize(){this._backdrop.resize(),this.resizeToContent(),this.center()}hide(t){a.removeViewportListener(this,`keydown`,this._boundKeyHandler),a.removeViewportListener(this,`resize`,this._boundResizeHandler);let finalize=()=>{this._finalizing=!0,this._backdrop.destroy(),this.removeElement(),this.destructor(),m.unregister(this),x(this),this._previousFocus!==null&&e.sink.focus(this._previousFocus),this._resolvePromise&&=(this._resolvePromise(t),null)},n=this.getElement(),r=this._backdrop.getElement();return n?(this._panelOutAnimation?.cancel(),this._panelOutAnimation=l.play(n,{to:{opacity:`0`,transform:`scale(0.97)`},durationMs:U,properties:[`opacity`,`transform`],onComplete:finalize}),r&&(this._backdropOutAnimation?.cancel(),this._backdropOutAnimation=l.play(r,{to:{opacity:`0`},durationMs:U,properties:[`opacity`]})),this):(finalize(),this)}destructor(){this._panelInAnimation?.cancel(),this._panelInAnimation=null,this._backdropInAnimation?.cancel(),this._backdropInAnimation=null,this._panelOutAnimation?.cancel(),this._panelOutAnimation=null,this._backdropOutAnimation?.cancel(),this._backdropOutAnimation=null,this._finalizing||(this._backdrop.destroy(),m.unregister(this),x(this),this._resolvePromise&&=(this._resolvePromise(`close`),null)),super.destructor()}getContentComponent(){return this._contentContainer}clampsToContentSize(){return!1}getTitleBar(){return this._titleBar}getLayerElement(){return this.getElement()??null}getDismissMode(){return`modal`}requestClose(){this._config.dismissable!==!1&&this.hide(`close`)}getBand(){return m.Band.Dialog}static show(e){return new Dialog(e).show()}static async confirm(e,t){return await Dialog.show({title:e,message:t,buttons:[{...q.Cancel,primary:!0},q.Confirm]})===`confirm`}static async alert(e,t,n){await Dialog.show({title:t,message:n,severity:e,buttons:[{...q.Ok,primary:!0}]})}static info(e,t){return Dialog.alert(`info`,e,t)}static success(e,t){return Dialog.alert(`success`,e,t)}static warning(e,t){return Dialog.alert(`warning`,e,t)}static error(e,t){return Dialog.alert(`error`,e,t)}},Pe=s(Ne);f.register(O,D,he,ge,T);var Y={info:`circle-info`,success:`circle-check`,warning:`triangle-exclamation`,error:`circle-exclamation`},Fe={info:`Information`,success:`Success`,warning:`Warning`,error:`Error`},Ie=8e3,Le=200,Re=200,X=class Notification extends c{_showAnimation=null;_dismissAnimation=null;static WIDTH=320;static HEIGHT=64;static MARGIN=16;static H_PADDING=12;static V_PADDING=10;static CLOSE_SIZE=20;static BADGE_SIZE=20;static BADGE_TEXT_GAP=8;static Z_INDEX=10002;static activeNotifications=[];static HISTORY_CAP=50;static history=[];static hoverCount=0;static modalCount=0;_type;_fullMessage;_badge;_messageText;_closeButton;_dismissTimer=null;_remainingDuration=0;_timerStartedAt=0;_dismissing=!1;_boundOnCloseAction=()=>(this.dismiss(),!0);_boundOnDblClick=()=>this.openDetail();_boundOnMouseOver=e=>Notification.acquireHoverHold(e,this.getElement());_boundOnMouseOut=e=>Notification.releaseHoverHold(e,this.getElement());constructor(e,t){super(),this._type=t,this._fullMessage=e,this.setPosition(i.FIXED),this.setZIndex(Notification.Z_INDEX),this.setWidth(Notification.WIDTH),this.setHeight(Notification.HEIGHT),this.setOverflow(`hidden`),this.setContain(`strict`);let r=t===`error`||t===`warning`;this.getAria().setRole(r?`alert`:`status`),this.getAria().setLive(r?`assertive`:`polite`);let o=`var(--ts-ui-notification-${t}-bg)`,s=`var(--ts-ui-notification-${t}-border)`;this.setBackgroundColor(o),this.setBorder({border:`1px solid ${s}`}),this.setShadow(`var(--ts-ui-notification-shadow)`),this.setBorderRadius(`var(--ts-ui-border-radius, 4px)`),this._badge=new f(Y[t]),this._badge.setForegroundColor(s),this._badge.setPreferredSize({width:Notification.BADGE_SIZE,height:Notification.BADGE_SIZE}),this._badge.setPointerEvents(`none`),this._badge.getAria().setHidden(!0),this.addComponent(this._badge),this._messageText=new g(e),this._messageText.setLineClamp(2),this._messageText.setWhiteSpace(`normal`),this._messageText.setWordBreak(`break-word`),this.addComponent(this._messageText),this._closeButton=new w({glyph:`xmark`}),this._closeButton.setInsets(new n(0,0,0,0)),this._closeButton.setBorder(`none`),this._closeButton.clearBackgroundImage(),this._closeButton.setBackgroundColor(`transparent`),this._closeButton.clearShadow(),this._closeButton.clearPressedShadow(),this._closeButton.setForegroundColor(`var(--ts-ui-text-color, rgb(0, 0, 0))`),this._closeButton.setPreferredSize({width:Notification.CLOSE_SIZE,height:Notification.CLOSE_SIZE}),this._closeButton.getAria().setLabel(`Dismiss notification`),this.addComponent(this._closeButton),this._closeButton.on(`action`,this._boundOnCloseAction),a.addSubtreeListener(this,`dblclick`,this._boundOnDblClick),a.addSubtreeListener(this,`mouseover`,this._boundOnMouseOver),a.addSubtreeListener(this,`mouseout`,this._boundOnMouseOut)}static show(e,t=`info`,n=3e3){Notification.record(e,t);let r=new Notification(e,t);Notification.activeNotifications.push(r);let i=r.getElement(!0);r.scheduleLayout(),m.mount(i),Notification.restack(),r.animateIn(),n>0&&(r.startTimer(n),Notification.isPaused()&&r.pauseTimer())}static record(e,t){Notification.history.push({message:e,type:t,timestamp:Date.now()}),Notification.history.length>Notification.HISTORY_CAP&&Notification.history.shift()}static getHistory(){return[...Notification.history]}animateIn(){let e=this.getElement();e&&(this._showAnimation?.cancel(),this._showAnimation=l.play(e,{from:{transform:`translateX(100%)`,opacity:`0`},to:{transform:`translateX(0)`,opacity:`1`},durationMs:Re,properties:[`transform`,`opacity`]}))}static pauseAll(){let e=Notification.isPaused();Notification.modalCount+=1,e||Notification.pauseAllTimers()}static resumeAll(){Notification.modalCount!==0&&(--Notification.modalCount,Notification.isPaused()||Notification.resumeAllTimers(!0))}static acquireHoverHold(t,n){if(n&&e.source.isNode(t.relatedTarget)&&e.source.contains(n,e.source.intern(t.relatedTarget)))return;let r=Notification.isPaused();Notification.hoverCount+=1,r||Notification.pauseAllTimers()}static releaseHoverHold(t,n){n&&e.source.isNode(t.relatedTarget)&&e.source.contains(n,e.source.intern(t.relatedTarget))||Notification.hoverCount!==0&&(--Notification.hoverCount,Notification.isPaused()||Notification.resumeAllTimers(!1))}static isPaused(){return Notification.hoverCount>0||Notification.modalCount>0}static pauseAllTimers(){for(let e of Notification.activeNotifications)e.pauseTimer()}static resumeAllTimers(e){for(let t of Notification.activeNotifications)t.restartTimer(e)}startTimer(e){this._remainingDuration=e,this._timerStartedAt=Date.now(),this._dismissTimer=setTimeout(()=>this.dismiss(),e)}pauseTimer(){this._dismissTimer!==null&&(clearTimeout(this._dismissTimer),this._dismissTimer=null,this._remainingDuration=Math.max(0,this._remainingDuration-(Date.now()-this._timerStartedAt)))}restartTimer(e){this._dismissing||this._remainingDuration<=0||this._dismissTimer!==null||(e&&(this._remainingDuration=Math.max(this._remainingDuration,Ie)),this._timerStartedAt=Date.now(),this._dismissTimer=setTimeout(()=>this.dismiss(),this._remainingDuration))}openDetail(){Notification.showDetail(this._fullMessage,this._type)}static showDetail(e,t){Notification.pauseAll();let r=new g(e);r.setAutoMeasure(!1),r.setWhiteSpace(`pre-wrap`),r.setWordBreak(`break-word`),r.setPadding(new n(16,16,16,16));let i=new Ne({title:Fe[t],contentComponent:r,buttons:[{...q.Close,primary:!0}],width:420,height:220}),a=i.getTitleBar();a.setBackgroundColor(`var(--ts-ui-notification-${t}-bg)`),a.getTitleText().setForegroundColor(`var(--ts-ui-notification-${t}-border)`),a.setGlyph(Y[t]);let o=a.getGlyph();o!==null&&o.setForegroundColor(`var(--ts-ui-notification-${t}-border)`),i.show().then(()=>Notification.resumeAll())}dismiss(){if(this._dismissing)return;this._dismissing=!0,this._dismissTimer!==null&&(clearTimeout(this._dismissTimer),this._dismissTimer=null);let e=this.getElement();if(!e){this.finishDismiss();return}this._dismissAnimation?.cancel(),this._dismissAnimation=l.play(e,{to:{transform:`translateX(100%)`,opacity:`0`},durationMs:Le,properties:[`transform`,`opacity`],onComplete:()=>this.finishDismiss()})}finishDismiss(){Notification.activeNotifications=Notification.activeNotifications.filter(e=>e!==this),this.dispose(),Notification.restack()}static restack(){let t=e.source.getViewportSize(),n=t.width-Notification.WIDTH-Notification.MARGIN,r=t.height-Notification.MARGIN;for(let e=Notification.activeNotifications.length-1;e>=0;e--){let t=Notification.activeNotifications[e];r-=Notification.HEIGHT,t.setX(n),t.setY(r),r-=Notification.MARGIN}}doLayout(){super.doLayout();let e=Notification.WIDTH-Notification.CLOSE_SIZE-4,t=Notification.H_PADDING,n=Notification.V_PADDING+2,r=t+Notification.BADGE_SIZE+Notification.BADGE_TEXT_GAP,i=e-r-4,a=Notification.HEIGHT-Notification.V_PADDING*2;return this._badge.setX(t),this._badge.setY(n),this._badge.setWidth(Notification.BADGE_SIZE),this._badge.setHeight(Notification.BADGE_SIZE),this._messageText.setX(r),this._messageText.setY(Notification.V_PADDING),this._messageText.setWidth(i),this._messageText.setHeight(a),this._closeButton.setX(e),this._closeButton.setY(4),this._closeButton.setWidth(Notification.CLOSE_SIZE),this._closeButton.setHeight(Notification.CLOSE_SIZE),this._closeButton.doLayout(),this}destructor(){this._showAnimation?.cancel(),this._showAnimation=null,this._dismissAnimation?.cancel(),this._dismissAnimation=null,Notification.activeNotifications.includes(this)&&(Notification.activeNotifications=Notification.activeNotifications.filter(e=>e!==this),Notification.restack()),super.destructor()}};f.register(ve);var ze=6e4,Be=36e5,Ve=864e5;function formatRelativeTime(e,t){let n=Math.max(0,t-e);return n<ze?`just now`:n<Be?`${Math.floor(n/ze)}m ago`:n<Ve?`${Math.floor(n/Be)}h ago`:`${Math.floor(n/Ve)}d ago`}function buildHistoryItems(){let e=X.getHistory();if(e.length===0)return[{text:`No notifications yet`,enabled:!1}];let t=Date.now();return e.map(e=>({glyph:Y[e.type],glyphColor:`var(--ts-ui-notification-${e.type}-border)`,text:e.message,shortcut:formatRelativeTime(e.timestamp,t),action:()=>X.showDetail(e.message,e.type)}))}var NotificationHistoryButton=class extends _e{constructor(e){super(void 0,e,{glyph:`clock-rotate-left`,menuItems:buildHistoryItems,scrollToBottomOnShow:!0}),this.getAria().setLabel(`Notification history`),this.applyListeners(e?.listeners)}},He=s(NotificationHistoryButton),Ue={edge:S.WEST,modal:!1,size:320,durationMs:220,overflow:`auto`,backgroundColor:`var(--ts-ui-drawer-bg)`,shadow:`var(--ts-ui-drawer-shadow)`},Drawer=class extends c{_panelInAnimation=null;_panelOutAnimation=null;_backdropInAnimation=null;_backdropOutAnimation=null;_open=!1;_closing=!1;_backdrop=null;_listeners=new u;_boundResizeHandler=()=>this.onViewportResize();_boundBackdropClose=()=>{this.close()};constructor(e,t){super(e,{...Ue,...t??{}}),this.setPosition(i.FIXED),this.applyListeners(e?.listeners)}applyOptions(e){return super.applyOptions(e),this.setEdge(e.edge??this.getEdge()),this.setModal(e.modal??this.isModal()),this.setDrawerSize(e.size??this.getDrawerSize()),this.setDurationMs(e.durationMs??this.getDurationMs()),this}setEdge(e){return this._options.edge=e,this}getEdge(){return this._options.edge??this._defaultOptions.edge}setModal(e){return this._options.modal=e,this}isModal(){return this._options.modal??this._defaultOptions.modal}setDrawerSize(e){return this._options.size=e,this}getDrawerSize(){return this._options.size??this._defaultOptions.size}setDurationMs(e){return this._options.durationMs=e,this}getDurationMs(){return this._options.durationMs??this._defaultOptions.durationMs}open(){if(this._open)return this;m.register(this);let t=m.getZIndex(this);return this.setZIndex(t),this.isModal()&&this.openBackdrop(t-1),this.applyEdgeBorder(),this.applyRestingGeometry(),e.sink.appendChild(e.source.getDocumentElement(),this.getElement(!0)),y(this),this.scheduleLayout(),this.animateIn(),a.addViewportListener(this,`resize`,this._boundResizeHandler),this._open=!0,this.emit(`open`),this}close(){if(!this._open||this._closing)return this;let e=!1;return this.emit(`beforeclose`,{preventDefault:()=>{e=!0}}),e?this:(this._closing=!0,a.removeViewportListener(this,`resize`,this._boundResizeHandler),this.animateOutAndFinalize(),this)}toggle(){return this._open?this.close():this.open()}isOpen(){return this._open}restingRect(){let t=e.source.getViewportSize(),n=this.getDrawerSize();switch(this.getEdge()){case S.EAST:return{x:t.width-n,y:0,width:n,height:t.height};case S.NORTH:return{x:0,y:0,width:t.width,height:n};case S.SOUTH:return{x:0,y:t.height-n,width:t.width,height:n};case S.WEST:default:return{x:0,y:0,width:n,height:t.height}}}applyRestingGeometry(){let e=this.restingRect();this.setX(e.x),this.setY(e.y),this.setWidth(e.width),this.setHeight(e.height)}offscreenTransform(){let e=this.getDrawerSize();switch(this.getEdge()){case S.EAST:return`translateX(${e}px)`;case S.NORTH:return`translateY(${-e}px)`;case S.SOUTH:return`translateY(${e}px)`;case S.WEST:default:return`translateX(${-e}px)`}}applyEdgeBorder(){let e=`1px solid var(--ts-ui-drawer-border)`;switch(this.getEdge()){case S.EAST:this.setBorder({border:`none`,borderLeft:e});break;case S.NORTH:this.setBorder({border:`none`,borderBottom:e});break;case S.SOUTH:this.setBorder({border:`none`,borderTop:e});break;case S.WEST:default:this.setBorder({border:`none`,borderRight:e});break}}animateIn(){let e=this.getElement();e&&(this._panelInAnimation?.cancel(),this._panelInAnimation=l.play(e,{from:{transform:this.offscreenTransform()},to:{transform:`translate(0, 0)`},durationMs:this.getDurationMs(),properties:[`transform`]}))}animateOutAndFinalize(){let e=this.getElement(),finalize=()=>{this.removeElement(),this.teardownBackdrop(),m.unregister(this),x(this),this._open=!1,this._closing=!1,this.emit(`close`)};if(!e){finalize();return}this._panelOutAnimation?.cancel(),this._panelOutAnimation=l.play(e,{to:{transform:this.offscreenTransform()},durationMs:this.getDurationMs(),properties:[`transform`],onComplete:finalize}),this.fadeBackdropOut()}openBackdrop(t){this._backdrop=new I,this._backdrop.setZIndex(t),this._backdrop.addClickListener(this._boundBackdropClose);let n=this._backdrop.getElement(!0);e.sink.appendChild(e.source.getDocumentElement(),n),this._backdropInAnimation?.cancel(),this._backdropInAnimation=l.play(n,{from:{opacity:`0`},to:{opacity:`1`},durationMs:this.getDurationMs(),properties:[`opacity`]})}fadeBackdropOut(){let e=this._backdrop?.getElement();e&&(this._backdropOutAnimation?.cancel(),this._backdropOutAnimation=l.play(e,{to:{opacity:`0`},durationMs:this.getDurationMs(),properties:[`opacity`]}))}teardownBackdrop(){this._backdrop!==null&&(this._backdrop.destroy(),this._backdrop=null)}onViewportResize(){this._backdrop!==null&&this._backdrop.resize(),this.applyRestingGeometry()}on(e,t){return this._listeners.add(e,t),this}off(e,t){return this._listeners.remove(e,t),this}emit(e,...t){this._listeners.fire(e,...t)}getLayerElement(){return this.getElement()??null}getDismissMode(){return this.isModal()?`modal`:`manual`}requestClose(){this.close()}isLayerRoot(){return!0}onZIndexChanged(e){this.setZIndex(e),this._backdrop!==null&&this._backdrop.setZIndex(e-1)}destructor(){this._panelInAnimation?.cancel(),this._panelInAnimation=null,this._panelOutAnimation?.cancel(),this._panelOutAnimation=null,this._backdropInAnimation?.cancel(),this._backdropInAnimation=null,this._backdropOutAnimation?.cancel(),this._backdropOutAnimation=null,this.teardownBackdrop(),m.unregister(this),x(this),this._open=!1,this._closing=!1,super.destructor()}},We=s(Drawer),RailHandle=class extends w{get selectedRule(){return this._selectedRule??=this.createStyleRule(`.selected`)}get railHoverRule(){return this._railHoverRule??=this.createStyleRule(`:hover:not(.selected)`)}constructor(e={}){super(e.text,e,{chromeless:!0}),this.railHoverRule.set(`backgroundColor`,`var(--ts-ui-rail-handle-hover-bg)`),this.selectedRule.set(`backgroundColor`,`var(--ts-ui-rail-handle-selected-bg)`)}applyOptions(e){return super.applyOptions(e),e.selected!==void 0&&this.setSelected(e.selected),this}isSelected(){return this._options.selected??!1}setSelected(t){this._options.selected=t,this.getAria().setPressed(t);let n=this.getElement();return n&&e.sink.apply(n,{toggleClass:{selected:t}}),this}render(){let t=super.render();return e.sink.apply(t,{toggleClass:{selected:this.isSelected()}}),t}},Z=s(RailHandle),Q=48,Ge=8900,$=200,Ke=10,qe=5;function collapseHeadingFor(e){switch(e){case S.EAST:return`east`;case S.NORTH:return`north`;case S.SOUTH:return`south`;case S.WEST:default:return`west`}}var Je={west:`east`,east:`west`,north:`south`,south:`north`},Ye={edge:S.WEST,orientation:`horizontal`,backgroundColor:`var(--ts-ui-rail-bg)`,shadow:`var(--ts-ui-rail-shadow)`},Rail=class extends c{_collapseAnimation=null;_slideOutAnimation=null;_slideInAnimation=null;_listeners=new u;_drawers=new Map;_windows=new Map;_mounted=!1;_collapseButton;_expandedThickness=Q;_boundResizeHandler=()=>this.applyRestingGeometry();constructor(e,t){super(e,{...Ye,...t??{}}),this.setPosition(i.FIXED),this.setZIndex(Ge),this._collapseButton=new ce({direction:collapseHeadingFor(this.getEdge()),listeners:{collapse:()=>{this.toggleCollapsed()}}}),e?.listeners!==void 0&&this.applyListeners(e.listeners)}applyOptions(e){return super.applyOptions(e),this.setEdge(e.edge??this.getEdge()),this.setOrientation(e.orientation??this.getOrientation()),e.thickness!==void 0&&this.setThickness(e.thickness),e.collapsed!==void 0&&(this._options.collapsed=e.collapsed),this}setEdge(e){return this._options.edge=e,this}getEdge(){return this._options.edge??this._defaultOptions.edge}setThickness(e){return this._options.thickness=e,this.adaptThickness(),this}getThickness(){return this.isCollapsed()?Ke:this._options.thickness===void 0?this.measureContentThickness():this._options.thickness}measureContentThickness(){let e=this.getPreferredSize();if(!e)return Q;let t=this.isVertical()?e.width:e.height;return t<=0||r(t)?Q:Math.ceil(t)}adaptThickness(){this._mounted&&this.applyRestingGeometry()}isCollapsed(){return this._options.collapsed??!1}setCollapsed(e){return e===this.isCollapsed()?this:(e&&(this._expandedThickness=this.getThickness()),this._options.collapsed=e,this._mounted&&this.animateCollapseTransition(e),this)}toggleCollapsed(){return this.setCollapsed(!this.isCollapsed())}applyCollapseAppearance(){let e=this.isCollapsed(),t=collapseHeadingFor(this.getEdge());this._collapseButton.setDirection(e?Je[t]:t),this.applyCollapseStyling(e),this.positionChevron(e),this.setAllHandlesDisplayed(!e)}applyCollapseStyling(e){e?(this.setBackgroundColor(`var(--ts-ui-button-bg, #e8e8e8)`),this.setBackgroundImage(`var(--ts-ui-button-bg, linear-gradient(rgb(241, 241, 241), rgb(200, 200, 200)))`),this.setBorder(`1px solid var(--ts-ui-button-border, #c8c8c8)`)):(this.clearBackgroundImage(),this.setBackgroundColor(`var(--ts-ui-rail-bg)`),this.applyEdgeBorder())}positionChevron(e){let t,n;if(e)t=`50%`,n=`50%`;else{let e=`calc(100% - ${qe}px)`,r=`${qe}px`;switch(this.getEdge()){case S.EAST:t=r,n=`50%`;break;case S.NORTH:t=`50%`,n=e;break;case S.SOUTH:t=`50%`,n=r;break;case S.WEST:default:t=e,n=`50%`;break}}let r=e?`10px`:null;new o({scope:`component`,name:this._collapseButton.getId(),styles:{left:t,top:n,width:r,zIndex:`1`}})}animateCollapseTransition(e){let t=collapseHeadingFor(this.getEdge());this._collapseButton.setDirection(e?Je[t]:t),this.applyCollapseStyling(e),this.positionChevron(e);let n=this.getElement(),r=this.isVertical()?this.getWidth():this.getHeight(),i=e?Ke:this._expandedThickness;e||(this.setAllHandlesDisplayed(!0),this.applyRestingGeometry(),this.scheduleLayout());let finalize=()=>{e&&this.setAllHandlesDisplayed(!1),this.applyRestingGeometry(),e||this.scheduleLayout()};if(!n){finalize();return}let a=this.collapseTween(r,i);this._collapseAnimation?.cancel(),this._collapseAnimation=l.play(n,{from:a.from,to:a.to,durationMs:$,properties:a.properties,onComplete:finalize})}collapseTween(t,n){let r=e.source.getViewportSize(),i={},a={};return this.isVertical()?(i.width=t+`px`,a.width=n+`px`,this.getEdge()===S.EAST&&(i.left=r.width-t+`px`,a.left=r.width-n+`px`)):(i.height=t+`px`,a.height=n+`px`,this.getEdge()===S.SOUTH&&(i.top=r.height-t+`px`,a.top=r.height-n+`px`)),{from:i,to:a,properties:Object.keys(a)}}setAllHandlesDisplayed(e){for(let t of this._drawers.values())t.handle.setDisplayed(e);for(let t of this._windows.values())t.handle?.setDisplayed(e)}setOrientation(e){return this._options.orientation=e,this._drawers!==void 0&&this.applyOrientation(),this}getOrientation(){return this._options.orientation??this._defaultOptions.orientation}mount(){if(this._mounted)return this;this.setLayoutManager(this.isVertical()?new ie:new ae),this.applyEdgeBorder(),this.applyRestingGeometry();let t=this.getElement(!0);e.sink.appendChild(e.source.getDocumentElement(),t);let n=this._collapseButton.getElement(!0);return n&&e.source.getParentElement(n)!==t&&e.sink.appendChild(t,n),this.applyCollapseAppearance(),this.scheduleLayout(),a.addViewportListener(this,`resize`,this._boundResizeHandler),this._mounted=!0,this.animateIn(),this}unmount(){if(!this._mounted)return this;a.removeViewportListener(this,`resize`,this._boundResizeHandler),this._mounted=!1;let e=this.getElement(),detach=()=>{this.removeElement()};return e?(this._slideOutAnimation?.cancel(),this._slideOutAnimation=l.play(e,{to:{transform:this.offscreenTransform()},durationMs:$,properties:[`transform`],onComplete:detach}),this):(detach(),this)}animateIn(){let e=this.getElement();e&&(this._slideInAnimation?.cancel(),this._slideInAnimation=l.play(e,{from:{transform:this.offscreenTransform()},to:{transform:`translate(0, 0)`},durationMs:$,properties:[`transform`]}))}offscreenTransform(){switch(this.getEdge()){case S.EAST:return`translateX(100%)`;case S.NORTH:return`translateY(-100%)`;case S.SOUTH:return`translateY(100%)`;case S.WEST:default:return`translateX(-100%)`}}registerDrawer(e,t={}){if(this._drawers.has(e))return this;let n=new Z({text:t.text,glyph:t.glyph,selected:e.isOpen()}),onOpen=()=>{n.setSelected(!0)},onClose=()=>{n.setSelected(!1)},onAction=()=>{e.toggle()};return e.on(`open`,onOpen),e.on(`close`,onClose),n.on(`action`,onAction),t.alignEdge!==!1&&e.setEdge(this.getEdge()),this.applyHandleOrientation(n),n.setDisplayed(!this.isCollapsed()),this.addComponent(n),this._drawers.set(e,{handle:n,onOpen,onClose,onAction}),this.adaptThickness(),this.scheduleLayout(),this.emit(`register`,e),this}unregisterDrawer(e){let t=this._drawers.get(e);return t?(e.off(`open`,t.onOpen),e.off(`close`,t.onClose),t.handle.off(`action`,t.onAction),this.removeComponent(t.handle),this._drawers.delete(e),this.adaptThickness(),this.emit(`unregister`,e),this):this}registerWindow(e){if(this._windows.has(e))return this;let onMinimize=()=>{this.showWindowHandle(e)},onRestore=()=>{this.removeWindowHandle(e)},onClose=()=>{this.unregisterWindow(e)},onAction=()=>{e.restore()};return e.on(`minimize`,onMinimize),e.on(`restore`,onRestore),e.on(`close`,onClose),this._windows.set(e,{handle:null,onMinimize,onRestore,onClose,onAction}),e.isMinimized()&&this.showWindowHandle(e),this.emit(`register`,e),this}unregisterWindow(e){let t=this._windows.get(e);return t?(e.off(`minimize`,t.onMinimize),e.off(`restore`,t.onRestore),e.off(`close`,t.onClose),this.removeWindowHandle(e),this._windows.delete(e),this.emit(`unregister`,e),this):this}showWindowHandle(e){let t=this._windows.get(e);if(!t||t.handle!==null)return;let n=new Z({text:e.getTitle(),glyph:e.getGlyph(),selected:!0});n.on(`action`,t.onAction),t.handle=n,this.applyHandleOrientation(n),n.setDisplayed(!this.isCollapsed()),this.addComponent(n),this.adaptThickness(),this.scheduleLayout()}removeWindowHandle(e){let t=this._windows.get(e);!t||t.handle===null||(t.handle.off(`action`,t.onAction),this.removeComponent(t.handle),t.handle=null,this.adaptThickness())}applyOrientation(){for(let e of this._drawers.values())this.applyHandleOrientation(e.handle);for(let e of this._windows.values())e.handle!==null&&this.applyHandleOrientation(e.handle);this.adaptThickness(),this.scheduleLayout()}applyHandleOrientation(e){let t=this.getOrientation(),n=t===`vertical-cw`?`sideways-rl`:t===`vertical-ccw`?`sideways-lr`:null;this.isVertical()&&n!==null?e.setWritingMode(n):e.clearWritingMode()}clampsToContentSize(){return!1}isVertical(){let e=this.getEdge();return e===S.WEST||e===S.EAST}handleMainAxisOffset(e){let t=this.isVertical(),mainPos=e=>t?e.getY():e.getX(),mainExtent=e=>t?e.getHeight():e.getWidth(),n=this._windows.get(e)?.handle??null;if(n!==null)return mainPos(n);let r=this.getComponents();if(r.length===0)return 0;let i=r[r.length-1];return mainPos(i)+mainExtent(i)+this.handleSpacing()}handleMainAxisExtent(e){let t=this.isVertical(),mainExtent=e=>t?e.getHeight():e.getWidth(),n=this._windows.get(e)?.handle??null;if(n!==null)return mainExtent(n);let r=this.getComponents();return r.length===0?0:mainExtent(r[r.length-1])}handleSpacing(){let e=this.getLayoutManager();return e instanceof re?e.getComponentSpacing():0}restingRect(){let t=e.source.getViewportSize(),n=this.getThickness();switch(this.getEdge()){case S.EAST:return{x:t.width-n,y:0,width:n,height:t.height};case S.NORTH:return{x:0,y:0,width:t.width,height:n};case S.SOUTH:return{x:0,y:t.height-n,width:t.width,height:n};case S.WEST:default:return{x:0,y:0,width:n,height:t.height}}}applyRestingGeometry(){let e=this.restingRect();this.setX(e.x),this.setY(e.y),this.setWidth(e.width),this.setHeight(e.height)}applyEdgeBorder(){let e=`1px solid transparent`,t=`1px solid var(--ts-ui-rail-border)`;switch(this.getEdge()){case S.EAST:this.setBorder({border:e,borderLeft:t});break;case S.NORTH:this.setBorder({border:e,borderBottom:t});break;case S.SOUTH:this.setBorder({border:e,borderTop:t});break;case S.WEST:default:this.setBorder({border:e,borderRight:t});break}}on(e,t){return this._listeners.add(e,t),this}off(e,t){return this._listeners.remove(e,t),this}emit(e,t){this._listeners.fire(e,t)}destructor(){this._collapseAnimation?.cancel(),this._collapseAnimation=null,this._slideOutAnimation?.cancel(),this._slideOutAnimation=null,this._slideInAnimation?.cancel(),this._slideInAnimation=null,this._collapseButton.dispose(),super.destructor()}},Xe=s(Rail),Dock=class extends d{_panels=new Map;_frames=new Map;_lazyFactories=new Map;_wiring=new Map;_sweepScheduled=!1;_listeners=new u;_focusedPanelId=null;_panelHost=new Map;_frameRegion=new Map;_lastActiveRegion=null;_floatSubscribed=new Set;_emptyDropOverlay=new k;_empty=!0;_emptyReconciled=!1;requestSweep=()=>{this.scheduleSweep()};onPanelDocked=e=>{this.requestSweep()};constructor(e,t){super(e,{layoutManager:new h,...t});let n=e?.layout?this.compileLayout(e.layout):this.newTabRegion();this.addComponent(n),this.scheduleSweep(),this.wireEmptyDropTarget(),this.applyListeners(e?.listeners)}applyOptions(e){return super.applyOptions(e),e.emptyContent!==void 0&&this.setEmptyContent(e.emptyContent),this}setEmptyContent(e){let t=this._emptyReconciled&&this.mainRegionEmpty();return t&&this.hideEmptyState(),this._options.emptyContent=e??void 0,t&&this.showEmptyState(),this}getEmptyContent(){return this._options.emptyContent??null}isEmpty(){return this._frames.size===0}wireEmptyDropTarget(){E.makeDropTarget(this,{accepts:e=>e.dragData.tabDrag===!0&&this.getComponents().length===0,suppressValidityTint:!0,onDragOver:()=>(this._emptyDropOverlay.attachTo(this),this._emptyDropOverlay.highlightFull(),null),onDragLeave:()=>{this._emptyDropOverlay.detach()},onDrop:e=>{this._emptyDropOverlay.detach();let t=pe.get(e.dragData.componentId);if(!t)return;let n=this.newTabRegion();this.addComponent(n),n.moveComponent(t),this.scheduleSweep()}})}addPanel(e){this._panels.set(e.id,e);let t=this.resolvePanel(e.id);if(t){let n=this.activeTabRegion();this._lastActiveRegion=n,n.moveComponent(t,void 0,this.leafConstraints(e)),n.getLayoutManager().setActiveContent(t),this._frameRegion.set(e.id,n),this.scheduleSweep()}return this}addLazyPanel(e){this._panels.set(e.id,e),this._lazyFactories.set(e.id,typeof e.content==`function`?e.content:()=>e.content);let t=this.resolvePanel(e.id);if(t){let n=this.activeTabRegion();this._lastActiveRegion=n,n.moveComponent(t,void 0,this.leafConstraints(e)),n.getLayoutManager().setActiveContent(t),this._frameRegion.set(e.id,n),this.scheduleSweep()}return this}getRootRegion(){return this.getComponents()[0]}getLayoutState(){return be(this.getRootRegion())}setLayoutState(e){return this._frameRegion.clear(),Se(this.getRootRegion(),e,e=>this.resolvePanel(e)),this.scheduleSweep(),this}resolvePanel(e){let t=this._panels.get(e);if(!t)return null;let n=this._frames.get(e);if(!n){let r=this._lazyFactories.get(e);if(r){let e=new b;e.setBarVisible(!1),n=new d({id:t.id,name:t.title,layoutManager:e});let onFailed=e=>{this.failPanel(t.id,e)};e.on(`exception`,onFailed),e.addLazyTab(r,t.title??t.id)}else n=new d({id:t.id,name:t.title,layoutManager:new h}),n.addComponent(t.content);this._frames.set(e,n)}return n}leafConstraints(e){let t=new C;return t.closeable=e.closeable??!0,t.disposeOnClose=e.disposeOnClose??!0,e.glyph&&(t.glyph=e.glyph),e.tooltip&&(t.tooltip=e.tooltip),t}activeTabRegion(){let e=this.getRootRegion(),t=this._lastActiveRegion;return t&&this.isTab(t)&&this.containsRegion(e,t)?t:this.isTab(e)?e:this.firstTabRegion(e)??this.wrapRootInTab()}containsRegion(e,t){if(e===t)return!0;for(let n of e.getComponents())if(this.isRegionContainer(n)&&this.containsRegion(n,t))return!0;return!1}firstTabRegion(e){if(this.isTab(e))return e;for(let t of e.getComponents())if(this.isRegionContainer(t)){let e=this.firstTabRegion(t);if(e)return e}return null}wrapRootInTab(){let e=this.newTabRegion(),t=this.getRootRegion();return this.addComponent(e),e.moveComponent(t),e}newTabRegion(){return new d({layoutManager:new b({reorderable:!0,compact:!0})})}compileLayout(e){if(`split`in e){let t=new d({layoutManager:new ye({orientation:e.split})});for(let n of e.children)t.addComponent(this.compileRegion(n));return t}return`tabs`in e?this.compileTabs(e.tabs):this.compileTabs([e])}compileRegion(e){return`split`in e||`tabs`in e?this.compileLayout(e):this.compileTabs([e])}compileTabs(e){let t=this.newTabRegion();for(let n of e){this._panels.set(n.id,n);let e=this.resolvePanel(n.id);e&&(t.addComponent(e,this.leafConstraints(n)),this._panelHost.set(n.id,null),this._frameRegion.set(n.id,t))}return t}scheduleSweep(){this._sweepScheduled||(this._sweepScheduled=!0,e.sink.requestAnimationFrame(()=>{this._sweepScheduled=!1,this.runSweep()}))}runSweep(){let e=this.getRootRegion();if(!e)return;let t=this.ownedFloatWindows().map(e=>this.adoptFloat(e)).filter(e=>e!==null);this.wireRegion(e);for(let e of t)this.wireRegion(e);this.subscribeFloatWindows(),this.reconcileHosts(e),this.teardownVanished(e,t),this.reconcileEmptyState()}reconcileEmptyState(){this.mainRegionEmpty()?this.showEmptyState():this.hideEmptyState();let e=this.isEmpty();!this._emptyReconciled&&(this._emptyReconciled=!0,e===this._empty)||e!==this._empty&&(this._empty=e,this.emit(`emptychange`,{empty:e}))}mainRegionEmpty(){let e=this.getRootRegion();if(!e)return!1;let t=this.getEmptyContent();return e.getComponents().every(e=>e===t)}showEmptyState(){let e=this.getRootRegion(),t=this.getEmptyContent();e&&(t?(this.rootTab()?.setBarVisible(!0),t.getParentComponent()!==e&&e.moveComponent(t,void 0,this.placeholderConstraints())):this.rootTab()?.setBarVisible(!1))}hideEmptyState(){let e=this.getEmptyContent(),t=e?.getParentComponent(),n=t?.getLayoutManager();e&&(n instanceof b&&n.closeTab(e)||t?.removeComponent(e)),this.rootTab()?.setBarVisible(!0)}rootTab(){let e=this.getRootRegion()?.getLayoutManager();return e instanceof b?e:null}placeholderConstraints(){let e=new C;return e.closeable=!1,e.transient=!0,e.disposeOnClose=!1,e}subscribeFloatWindows(){for(let e of this.floatWindowsHoldingFrames()){if(this._floatSubscribed.has(e))continue;let onFloatActivate=()=>{this.onFloatActivated(e)},onFloatClose=()=>{this.onFloatClosed(e)};if(e.on(`activate`,onFloatActivate),e.on(`close`,onFloatClose),e instanceof _){let t=e.getLayoutManager();t.on(`activate`,this.onPanelFocused),t.on(`tabclose`,this.onPanelClosed),t.on(`detach`,this.onPanelDetached),t.on(`dock`,this.onPanelDocked)}this._floatSubscribed.add(e)}this.pruneClosedFloatSubscriptions()}pruneClosedFloatSubscriptions(){let e=new Set(v.getOpenWindows());for(let t of this._floatSubscribed)e.has(t)||this._floatSubscribed.delete(t)}floatWindowsHoldingFrames(){let e=[...this._frames.values()];return v.getOpenWindows().filter(t=>!this.windowContains(t,this)&&e.some(e=>this.windowContains(t,e)))}reconcileHosts(e){for(let[t,n]of this._frames){if(!this._panels.has(t))continue;let r=this.hostForFrame(n,e),i=this._panelHost.has(t),a=this._panelHost.get(t)??null,o=this.regionForFrame(n),s=this._frameRegion.get(t)??null;i?r===a?o&&s&&o!==s&&this.emit(`move`,{id:t,content:n,window:r}):(this.emit(`detach`,{id:t,content:n,window:a}),this.emit(`attach`,{id:t,content:n,window:r})):this.emit(`attach`,{id:t,content:n,window:r}),this._panelHost.set(t,r),o&&this._frameRegion.set(t,o)}}hostForFrame(e,t){return this.isUnder(t,e)?null:this.floatForFrame(e)}ownedFloatWindows(){let e=[...this._frames.values()];return v.getOpenWindows().filter(t=>!(t instanceof _)&&!this.windowContains(t,this)&&e.some(e=>this.windowContains(t,e)))}windowContains(e,t){for(let n=t;n;n=n.getParentComponent())if(n===e)return!0;return!1}windowContent(e){return e.getComponents().find(t=>!e.isChromeComponent(t))??null}adoptFloat(e){let t=this.windowContent(e);if(!t)return null;if(this.isRegionContainer(t))return t;let n=this.newTabRegion();return e.moveComponent(n),n.moveComponent(t),n}wireRegion(e){let t=this._wiring.get(e);t||(t={dockRegion:new xe(e,this.requestSweep),tabWired:!1},this._wiring.set(e,t));let n=e.getLayoutManager();if(this.isTab(e)&&!t.tabWired){let r=n;r.setReorderable(!0);let onEmpty=()=>{this.pruneRegion(e)};r.on(`empty`,onEmpty),r.on(`tabclose`,this.onPanelClosed),r.on(`activate`,this.onPanelFocused),r.on(`detach`,this.onPanelDetached),r.on(`dock`,this.onPanelDocked),t.tabWired=!0}for(let t of e.getComponents())this.isRegionContainer(t)&&this._frames.get(t.getId())!==t&&this.wireRegion(t)}pruneRegion(e){let t=e.getParentComponent();!t||e.getComponents().length>0||t!==this&&(t.removeComponent(e),this.collapseSinglePaneSplit(t),this.closeFloatIfEmpty(t),this.scheduleSweep())}closeFloatIfEmpty(e){v.getOpenWindows().includes(e)&&(this.windowContent(e)||e.requestClose())}collapseSinglePaneSplit(e){if(this.regionKind(e)!==`Split`)return;let t=e.getComponents();if(t.length!==1)return;let n=e.getParentComponent();if(!n)return;let r=n.getComponents().indexOf(e);this.regionKind(n)===`Split`&&n.getLayoutManager().transferPaneSize(e,t[0]),n.moveComponent(t[0],r),n.removeComponent(e)}teardownVanished(e,t){let n=new Set;this.collectRegions(e,n);for(let e of t)this.collectRegions(e,n);for(let[e,t]of this._wiring)n.has(e)||(t.dockRegion.destroy(),this._wiring.delete(e))}collectRegions(e,t){t.add(e);for(let n of e.getComponents())this.isRegionContainer(n)&&this.collectRegions(n,t)}isRegionContainer(e){let t=this.regionKind(e);return t===`Split`||t===`Tab`}isTab(e){return this.regionKind(e)===`Tab`}regionKind(e){let t=e.getLayoutManager();return t?t.getClassName().replace(/^_/,``):``}onPanelClosed=e=>{let t=e.getId();if(this._frames.get(t)!==e)return;let n=this._frameRegion.get(t)??null;this._frames.delete(t),this._panelHost.delete(t),this._frameRegion.delete(t),this.emit(`close`,{id:t,content:e,window:null}),this.scheduleSweep(),this._focusedPanelId===t&&this.scheduleFocusRecompute(n)};failPanel(e,t){this._frames.has(e)&&(this.removePanel(e)||this._frames.delete(e),this.emit(`exception`,{id:e,error:t}))}onPanelFocused=e=>{let t=e.getId();if(this._frames.get(t)!==e)return;let n=this._frameRegion.get(t);n&&(this._lastActiveRegion=n),this.setFocus(t)};onPanelDetached=e=>{this.scheduleSweep()};onFloatActivated(e){let t=this.activeFrameInFloat(e);t&&this.setFocus(t.getId())}onFloatClosed(e){let t=!1;for(let n of this.framesInWindow(e)){let e=n.getId();this._frames.delete(e),this._panelHost.delete(e),this._frameRegion.delete(e),this.emit(`close`,{id:e,content:n,window:null}),this._focusedPanelId===e&&(t=!0)}this.scheduleSweep(),t&&this.scheduleFocusRecompute(null)}setFocus(e){if(e===this._focusedPanelId)return;if(this._focusedPanelId=e,e===null){this.emit(`focus`,null);return}let t=this._frames.get(e);if(t){let n=this.hostForFrame(t,this.getRootRegion());this.emit(`focus`,{id:e,content:t,window:n})}}scheduleFocusRecompute(t){e.sink.requestAnimationFrame(()=>this.recomputeFocusAfterClose(t))}recomputeFocusAfterClose(e){if(this._frames.size===0){this.setFocus(null);return}if(!e||!this.isTab(e)||e.getComponents().length===0){this.setFocus(null);return}let t=e.getLayoutManager().getActiveContent();this.setFocus(t?t.getId():null)}focusPanel(e){let t=this._frames.get(e);if(!t)return!1;let n=this.regionForFrame(t);if(!n)return!1;let r=n.getLayoutManager().indexOfContent(t);return r<0?!1:(this.floatForFrame(t)?.bringToFront(),n.getLayoutManager().setActiveTabIndex(r),!0)}removePanel(e){let t=this._frames.get(e);if(!t)return!1;let n=this.regionForFrame(t);return n?n.getLayoutManager().closeTab(t):!1}regionForFrame(e){for(let t of this.allTabRegions())if(t.getLayoutManager().indexOfContent(e)>=0)return t;return null}floatForFrame(e){return this.floatWindowsHoldingFrames().find(t=>this.windowContains(t,e))??null}allTabRegions(){let e=[],t=this.getRootRegion();t&&this.collectTabRegions(t,e);for(let t of this.floatWindowsHoldingFrames()){if(t instanceof _){e.push(t);continue}let n=this.windowContent(t);n&&this.collectTabRegions(n,e)}return e}collectTabRegions(e,t){this.isTab(e)&&t.push(e);for(let n of e.getComponents())this.isRegionContainer(n)&&this.collectTabRegions(n,t)}framesInWindow(e){return[...this._frames.values()].filter(t=>this.windowContains(e,t))}activeFrameInFloat(e){let t=null;if(e instanceof _)t=e.getLayoutManager();else{let n=this.windowContent(e),r=[];n&&this.collectTabRegions(n,r),t=r.length>0?r[0].getLayoutManager():null}let n=t?t.getActiveContent():null;return n&&this._frames.get(n.getId())===n?n:null}isUnder(e,t){for(let n=t;n;n=n.getParentComponent())if(n===e)return!0;return!1}on(e,t){return this._listeners.add(e,t),this}off(e,t){return this._listeners.remove(e,t),this}emit(e,t){this._listeners.fire(e,t)}destructor(){this._emptyDropOverlay.dispose();for(let e of this._wiring.values())e.dockRegion.destroy();this._wiring.clear(),super.destructor()}},Ze=s(Dock);export{v as AbstractWindow,oe as ButtonGroup,Pe as Dialog,q as DialogButtons,DialogTitleBar,Ze as Dock,fe as DragFeedback,ue as DragGhost,E as DragManager,We as Drawer,k as DropZoneOverlay,me as Menu,X as Notification,He as NotificationHistoryButton,we as Popover,Xe as Rail,Z as RailHandle,de as ReorderIndicator,_ as TabWindow,ee as Tooltip,se as Window};
1
+ import{t as e}from"./DOM-C-Edb3tA.js";import{n as t,o as n,t as r}from"./Position-BwtxouxK.js";import{S as i,b as a,h as o,t as s,v as c}from"./Component-B0ShfPVi.js";import{t as l}from"./ListenerBag-WPdKuuds.js";import{t as u}from"./Container-abY5Ww3W.js";import{t as d}from"./Glyph-_VeBacS2.js";import{a as f,r as ee,t as p}from"./Tooltip-CUOJOqQi.js";import{t as te}from"./AnimatedDropdown-H3Rh-YMZ.js";import{t as m}from"./Fit-BhlB-HAo.js";import{t as h}from"./Text-CMKnK9uB.js";import{i as ne,n as g,r as re}from"./VBox-DfJPWXqc.js";import{f as _,h as ie,o as v,s as y,u as ae}from"./RadioMenuRow-DP5qPyFR.js";import{a as b,c as oe,i as se,l as x,n as S,o as C,s as ce}from"./CheckboxMenuRow-CesLhSnp.js";import{t as w}from"./Placement-7kqdaK4Z.js";import{t as T}from"./LayoutConstraints-LIHYYd2F.js";import{r as le}from"./Border-0DJFDiij.js";import{t as E}from"./Button-MpMIYBYJ.js";import{xmark as ue}from"./glyphs/solid/xmark.es.js";import{t as de}from"./Menu-Q0bpXXze.js";import{a as D,i as O,n as k,o as A,r as j,t as M}from"./Dialog-cbA9V17e.js";import{circle_check as N}from"./glyphs/solid/circle_check.es.js";import{circle_info as P}from"./glyphs/solid/circle_info.es.js";import{triangle_exclamation as F}from"./glyphs/solid/triangle_exclamation.es.js";import{circle_exclamation as I}from"./glyphs/solid/circle_exclamation.es.js";import{t as L}from"./MenuButton-DCXi0tsP.js";import{clock_rotate_left as R}from"./glyphs/solid/clock_rotate_left.es.js";import{a as z,i as B,n as V,r as H,t as fe}from"./LayoutSerialization-CMxunLfV.js";var pe=4,PopupPanel=class extends te{_currentOpener=null;constructor(e,n){super(e,{layoutManager:new g({stretching:!0}),insets:new t(4,4,4,4),backgroundColor:`var(--ts-ui-autocomplete-bg, rgb(255, 255, 255))`,border:`var(--ts-ui-input-border)`,borderRadius:`var(--ts-ui-border-radius, 4px)`,shadow:`var(--ts-ui-autocomplete-shadow, 2px 4px 8px rgba(0,0,0,0.15))`,...n??{}}),this.getAria().setRole(`dialog`),this.setContain(`layout`),this.setOverflowX(`hidden`),this.setOverflowY(`auto`),this.getLayoutManager()?.setOverflowing(!1,!0)}showAt(t){this.getElement(!0),this.setMaxSize({width:Number.MAX_VALUE,height:Number.MAX_VALUE});let n=this.getPreferredSize(),r=n?.width??this.getWidth(),i=n?.height??this.getHeight(),a=e.source.getViewportSize(),o=this.resolvePlacement(t,{width:r,height:i},a);return this.setWidth(r),this.setMaxSize({width:Number.MAX_VALUE,height:Math.max(0,o.available)}),this.setHeight(i),this.setX(o.x),this.setY(o.y),this.showAnimated(),this.doLayout(),this}toggleFor(t,n){if(this.isOpen()&&this._currentOpener===t)return this.hideAnimated(),this;this._currentOpener=t,this.setAnchorElement(t);let r=e.source.getId(t);return r!==``&&this.getAria().setLabelledBy(r),this.showAt(n)}hideAnimated(){return this._currentOpener=null,super.hideAnimated()}resolvePlacement(e,t,n){return ee(e,t,n,pe)}},me=o(PopupPanel);d.register(P,N,F,I,ue);var U={info:`circle-info`,success:`circle-check`,warning:`triangle-exclamation`,error:`circle-exclamation`},he={info:`Information`,success:`Success`,warning:`Warning`,error:`Error`},ge=8e3,_e=200,ve=200,W=class Notification extends s{_showAnimation=null;_dismissAnimation=null;static WIDTH=320;static HEIGHT=64;static MARGIN=16;static H_PADDING=12;static V_PADDING=10;static CLOSE_SIZE=20;static BADGE_SIZE=20;static BADGE_TEXT_GAP=8;static Z_INDEX=10002;static activeNotifications=[];static HISTORY_CAP=50;static history=[];static hoverCount=0;static modalCount=0;_type;_fullMessage;_badge;_messageText;_closeButton;_dismissTimer=null;_remainingDuration=0;_timerStartedAt=0;_dismissing=!1;_boundOnCloseAction=()=>(this.dismiss(),!0);_boundOnDblClick=()=>this.openDetail();_boundOnMouseOver=e=>Notification.acquireHoverHold(e,this.getElement());_boundOnMouseOut=e=>Notification.releaseHoverHold(e,this.getElement());constructor(e,n){super(),this._type=n,this._fullMessage=e,this.setPosition(r.FIXED),this.setZIndex(Notification.Z_INDEX),this.setWidth(Notification.WIDTH),this.setHeight(Notification.HEIGHT),this.setOverflow(`hidden`),this.setContain(`strict`);let a=n===`error`||n===`warning`;this.getAria().setRole(a?`alert`:`status`),this.getAria().setLive(a?`assertive`:`polite`);let o=`var(--ts-ui-notification-${n}-bg)`,s=`var(--ts-ui-notification-${n}-border)`;this.setBackgroundColor(o),this.setBorder({border:`1px solid ${s}`}),this.setShadow(`var(--ts-ui-notification-shadow)`),this.setBorderRadius(`var(--ts-ui-border-radius, 4px)`),this._badge=new d(U[n]),this._badge.setForegroundColor(s),this._badge.setPreferredSize({width:Notification.BADGE_SIZE,height:Notification.BADGE_SIZE}),this._badge.setPointerEvents(`none`),this._badge.getAria().setHidden(!0),this.addComponent(this._badge),this._messageText=new h(e),this._messageText.setLineClamp(2),this._messageText.setWhiteSpace(`normal`),this._messageText.setWordBreak(`break-word`),this._messageText.setUserSelect(`text`),this._messageText.setCursor(`text`),this.addComponent(this._messageText),this._closeButton=new E({glyph:`xmark`}),this._closeButton.setInsets(new t(0,0,0,0)),this._closeButton.setBorder(`none`),this._closeButton.clearBackgroundImage(),this._closeButton.setBackgroundColor(`transparent`),this._closeButton.clearShadow(),this._closeButton.clearPressedShadow(),this._closeButton.setForegroundColor(`var(--ts-ui-text-color, rgb(0, 0, 0))`),this._closeButton.setPreferredSize({width:Notification.CLOSE_SIZE,height:Notification.CLOSE_SIZE}),this._closeButton.getAria().setLabel(`Dismiss notification`),this.addComponent(this._closeButton),this._closeButton.on(`action`,this._boundOnCloseAction),i.addSubtreeListener(this,`dblclick`,this._boundOnDblClick),i.addSubtreeListener(this,`mouseover`,this._boundOnMouseOver),i.addSubtreeListener(this,`mouseout`,this._boundOnMouseOut)}static show(e,t=`info`,n=3e3){Notification.record(e,t);let r=new Notification(e,t);Notification.activeNotifications.push(r);let i=r.getElement(!0);r.scheduleLayout(),f.mount(i),Notification.restack(),r.animateIn(),n>0&&(r.startTimer(n),Notification.isPaused()&&r.pauseTimer())}static record(e,t){Notification.history.push({message:e,type:t,timestamp:Date.now()}),Notification.history.length>Notification.HISTORY_CAP&&Notification.history.shift()}static getHistory(){return[...Notification.history]}animateIn(){let e=this.getElement();e&&(this._showAnimation?.cancel(),this._showAnimation=c.play(e,{from:{transform:`translateX(100%)`,opacity:`0`},to:{transform:`translateX(0)`,opacity:`1`},durationMs:ve,properties:[`transform`,`opacity`]}))}static pauseAll(){let e=Notification.isPaused();Notification.modalCount+=1,e||Notification.pauseAllTimers()}static resumeAll(){Notification.modalCount!==0&&(--Notification.modalCount,Notification.isPaused()||Notification.resumeAllTimers(!0))}static acquireHoverHold(t,n){if(n&&e.source.isNode(t.relatedTarget)&&e.source.contains(n,e.source.intern(t.relatedTarget)))return;let r=Notification.isPaused();Notification.hoverCount+=1,r||Notification.pauseAllTimers()}static releaseHoverHold(t,n){n&&e.source.isNode(t.relatedTarget)&&e.source.contains(n,e.source.intern(t.relatedTarget))||Notification.hoverCount!==0&&(--Notification.hoverCount,Notification.isPaused()||Notification.resumeAllTimers(!1))}static isPaused(){return Notification.hoverCount>0||Notification.modalCount>0}static pauseAllTimers(){for(let e of Notification.activeNotifications)e.pauseTimer()}static resumeAllTimers(e){for(let t of Notification.activeNotifications)t.restartTimer(e)}startTimer(e){this._remainingDuration=e,this._timerStartedAt=Date.now(),this._dismissTimer=setTimeout(()=>this.dismiss(),e)}pauseTimer(){this._dismissTimer!==null&&(clearTimeout(this._dismissTimer),this._dismissTimer=null,this._remainingDuration=Math.max(0,this._remainingDuration-(Date.now()-this._timerStartedAt)))}restartTimer(e){this._dismissing||this._remainingDuration<=0||this._dismissTimer!==null||(e&&(this._remainingDuration=Math.max(this._remainingDuration,ge)),this._timerStartedAt=Date.now(),this._dismissTimer=setTimeout(()=>this.dismiss(),this._remainingDuration))}openDetail(){Notification.showDetail(this._fullMessage,this._type)}static showDetail(e,n){Notification.pauseAll();let r=new h(e);r.setAutoMeasure(!1),r.setWhiteSpace(`pre-wrap`),r.setWordBreak(`break-word`),r.setPadding(new t(16,16,16,16)),r.setUserSelect(`text`),r.setCursor(`text`);let i=new M({title:he[n],contentComponent:r,buttons:[{...k.Close,primary:!0}],width:420,height:220}),a=i.getTitleBar();a.setBackgroundColor(`var(--ts-ui-notification-${n}-bg)`),a.getTitleText().setForegroundColor(`var(--ts-ui-notification-${n}-border)`),a.setGlyph(U[n]);let o=a.getGlyph();o!==null&&o.setForegroundColor(`var(--ts-ui-notification-${n}-border)`),i.show().then(()=>Notification.resumeAll())}dismiss(){if(this._dismissing)return;this._dismissing=!0,this._dismissTimer!==null&&(clearTimeout(this._dismissTimer),this._dismissTimer=null);let e=this.getElement();if(!e){this.finishDismiss();return}this._dismissAnimation?.cancel(),this._dismissAnimation=c.play(e,{to:{transform:`translateX(100%)`,opacity:`0`},durationMs:_e,properties:[`transform`,`opacity`],onComplete:()=>this.finishDismiss()})}finishDismiss(){Notification.activeNotifications=Notification.activeNotifications.filter(e=>e!==this),this.dispose(),Notification.restack()}static restack(){let t=e.source.getViewportSize(),n=t.width-Notification.WIDTH-Notification.MARGIN,r=t.height-Notification.MARGIN;for(let e=Notification.activeNotifications.length-1;e>=0;e--){let t=Notification.activeNotifications[e];r-=Notification.HEIGHT,t.setX(n),t.setY(r),r-=Notification.MARGIN}}doLayout(){super.doLayout();let e=Notification.WIDTH-Notification.CLOSE_SIZE-4,t=Notification.H_PADDING,n=Notification.V_PADDING+2,r=t+Notification.BADGE_SIZE+Notification.BADGE_TEXT_GAP,i=e-r-4,a=Notification.HEIGHT-Notification.V_PADDING*2;return this._badge.setX(t),this._badge.setY(n),this._badge.setWidth(Notification.BADGE_SIZE),this._badge.setHeight(Notification.BADGE_SIZE),this._messageText.setX(r),this._messageText.setY(Notification.V_PADDING),this._messageText.setWidth(i),this._messageText.setHeight(a),this._closeButton.setX(e),this._closeButton.setY(4),this._closeButton.setWidth(Notification.CLOSE_SIZE),this._closeButton.setHeight(Notification.CLOSE_SIZE),this._closeButton.doLayout(),this}destructor(){this._showAnimation?.cancel(),this._showAnimation=null,this._dismissAnimation?.cancel(),this._dismissAnimation=null,Notification.activeNotifications.includes(this)&&(Notification.activeNotifications=Notification.activeNotifications.filter(e=>e!==this),Notification.restack()),super.destructor()}};d.register(R);var G=6e4,K=36e5,q=864e5;function formatRelativeTime(e,t){let n=Math.max(0,t-e);return n<G?`just now`:n<K?`${Math.floor(n/G)}m ago`:n<q?`${Math.floor(n/K)}h ago`:`${Math.floor(n/q)}d ago`}function buildHistoryItems(){let e=W.getHistory();if(e.length===0)return[{text:`No notifications yet`,enabled:!1}];let t=Date.now();return e.map(e=>({glyph:U[e.type],glyphColor:`var(--ts-ui-notification-${e.type}-border)`,text:e.message,shortcut:formatRelativeTime(e.timestamp,t),action:()=>W.showDetail(e.message,e.type)}))}var NotificationHistoryButton=class extends L{constructor(e){super(void 0,e,{glyph:`clock-rotate-left`,menuItems:buildHistoryItems,scrollToBottomOnShow:!0}),this.getAria().setLabel(`Notification history`),this.applyListeners(e?.listeners)}},ye=o(NotificationHistoryButton),be={edge:w.WEST,modal:!1,size:320,durationMs:220,overflow:`auto`,backgroundColor:`var(--ts-ui-body-bg)`,shadow:`var(--ts-ui-drawer-shadow)`},Drawer=class extends s{_panelInAnimation=null;_panelOutAnimation=null;_backdropInAnimation=null;_backdropOutAnimation=null;_open=!1;_closing=!1;_backdrop=null;_listeners=new l;_boundResizeHandler=()=>this.onViewportResize();_boundBackdropClose=()=>{this.close()};constructor(e,t){super(e,{...be,...t??{}}),this.setPosition(r.FIXED),this.applyListeners(e?.listeners)}applyOptions(e){return super.applyOptions(e),this.setEdge(e.edge??this.getEdge()),this.setModal(e.modal??this.isModal()),this.setDrawerSize(e.size??this.getDrawerSize()),this.setDurationMs(e.durationMs??this.getDurationMs()),this}setEdge(e){return this._options.edge=e,this}getEdge(){return this._options.edge??this._defaultOptions.edge}setModal(e){return this._options.modal=e,this}isModal(){return this._options.modal??this._defaultOptions.modal}setDrawerSize(e){return this._options.size=e,this}getDrawerSize(){return this._options.size??this._defaultOptions.size}setDurationMs(e){return this._options.durationMs=e,this}getDurationMs(){return this._options.durationMs??this._defaultOptions.durationMs}open(){if(this._open)return this;f.register(this);let t=f.getZIndex(this);return this.setZIndex(t),this.isModal()&&this.openBackdrop(t-1),this.applyEdgeBorder(),this.applyRestingGeometry(),e.sink.appendChild(e.source.getDocumentElement(),this.getElement(!0)),oe(this),this.scheduleLayout(),this.animateIn(),i.addViewportListener(this,`resize`,this._boundResizeHandler),this._open=!0,this.emit(`open`),this}close(){if(!this._open||this._closing)return this;let e=!1;return this.emit(`beforeclose`,{preventDefault:()=>{e=!0}}),e?this:(this._closing=!0,i.removeViewportListener(this,`resize`,this._boundResizeHandler),this.animateOutAndFinalize(),this)}toggle(){return this._open?this.close():this.open()}isOpen(){return this._open}restingRect(){let t=e.source.getViewportSize(),n=this.getDrawerSize();switch(this.getEdge()){case w.EAST:return{x:t.width-n,y:0,width:n,height:t.height};case w.NORTH:return{x:0,y:0,width:t.width,height:n};case w.SOUTH:return{x:0,y:t.height-n,width:t.width,height:n};case w.WEST:default:return{x:0,y:0,width:n,height:t.height}}}applyRestingGeometry(){let e=this.restingRect();this.setX(e.x),this.setY(e.y),this.setWidth(e.width),this.setHeight(e.height)}offscreenTransform(){let e=this.getDrawerSize();switch(this.getEdge()){case w.EAST:return`translateX(${e}px)`;case w.NORTH:return`translateY(${-e}px)`;case w.SOUTH:return`translateY(${e}px)`;case w.WEST:default:return`translateX(${-e}px)`}}applyEdgeBorder(){let e=`1px solid var(--ts-ui-drawer-border)`;switch(this.getEdge()){case w.EAST:this.setBorder({border:`none`,borderLeft:e});break;case w.NORTH:this.setBorder({border:`none`,borderBottom:e});break;case w.SOUTH:this.setBorder({border:`none`,borderTop:e});break;case w.WEST:default:this.setBorder({border:`none`,borderRight:e})}}animateIn(){let e=this.getElement();e&&(this._panelInAnimation?.cancel(),this._panelInAnimation=c.play(e,{from:{transform:this.offscreenTransform()},to:{transform:`translate(0, 0)`},durationMs:this.getDurationMs(),properties:[`transform`]}))}animateOutAndFinalize(){let e=this.getElement(),finalize=()=>{this.removeElement(),this.teardownBackdrop(),f.unregister(this),x(this),this._open=!1,this._closing=!1,this.emit(`close`)};if(!e){finalize();return}this._panelOutAnimation?.cancel(),this._panelOutAnimation=c.play(e,{to:{transform:this.offscreenTransform()},durationMs:this.getDurationMs(),properties:[`transform`],onComplete:finalize}),this.fadeBackdropOut()}openBackdrop(t){this._backdrop=new D,this._backdrop.setZIndex(t),this._backdrop.addClickListener(this._boundBackdropClose);let n=this._backdrop.getElement(!0);e.sink.appendChild(e.source.getDocumentElement(),n),this._backdropInAnimation?.cancel(),this._backdropInAnimation=c.play(n,{from:{opacity:`0`},to:{opacity:`1`},durationMs:this.getDurationMs(),properties:[`opacity`]})}fadeBackdropOut(){let e=this._backdrop?.getElement();e&&(this._backdropOutAnimation?.cancel(),this._backdropOutAnimation=c.play(e,{to:{opacity:`0`},durationMs:this.getDurationMs(),properties:[`opacity`]}))}teardownBackdrop(){this._backdrop!==null&&(this._backdrop.destroy(),this._backdrop=null)}onViewportResize(){this._backdrop!==null&&this._backdrop.resize(),this.applyRestingGeometry()}on(e,t){return this._listeners.add(e,t),this}off(e,t){return this._listeners.remove(e,t),this}emit(e,...t){this._listeners.fire(e,...t)}getLayerElement(){return this.getElement()??null}getDismissMode(){return this.isModal()?`modal`:`manual`}requestClose(){this.close()}isLayerRoot(){return!0}onZIndexChanged(e){this.setZIndex(e),this._backdrop!==null&&this._backdrop.setZIndex(e-1)}destructor(){this._panelInAnimation?.cancel(),this._panelInAnimation=null,this._panelOutAnimation?.cancel(),this._panelOutAnimation=null,this._backdropInAnimation?.cancel(),this._backdropInAnimation=null,this._backdropOutAnimation?.cancel(),this._backdropOutAnimation=null,this.teardownBackdrop(),f.unregister(this),x(this),this._open=!1,this._closing=!1,super.destructor()}},xe=o(Drawer),RailHandle=class extends E{get selectedRule(){return this._selectedRule??=this.createStyleRule(`.selected`)}get railHoverRule(){return this._railHoverRule??=this.createStyleRule(`:hover:not(.selected)`)}constructor(e={}){super(e.text,e,{chromeless:!0}),this.railHoverRule.set(`backgroundColor`,`var(--ts-ui-rail-handle-hover-bg)`),this.selectedRule.set(`backgroundColor`,`var(--ts-ui-rail-handle-selected-bg)`)}applyOptions(e){return super.applyOptions(e),e.selected!==void 0&&this.setSelected(e.selected),this}isSelected(){return this._options.selected??!1}setSelected(t){this._options.selected=t,this.getAria().setPressed(t);let n=this.getElement();return n&&e.sink.apply(n,{toggleClass:{selected:t}}),this}render(){let t=super.render();return e.sink.apply(t,{toggleClass:{selected:this.isSelected()}}),t}},J=o(RailHandle),Y=48,Se=8900,X=200,Z=10,Q=5;function collapseHeadingFor(e){switch(e){case w.EAST:return`east`;case w.NORTH:return`north`;case w.SOUTH:return`south`;case w.WEST:default:return`west`}}var $={west:`east`,east:`west`,north:`south`,south:`north`},Ce={edge:w.WEST,orientation:`horizontal`,backgroundColor:`var(--ts-ui-body-bg)`,shadow:`var(--ts-ui-rail-shadow)`},Rail=class extends s{_collapseAnimation=null;_slideOutAnimation=null;_slideInAnimation=null;_listeners=new l;_drawers=new Map;_windows=new Map;_mounted=!1;_collapseButton;_expandedThickness=Y;_boundResizeHandler=()=>this.applyRestingGeometry();constructor(e,t){super(e,{...Ce,...t??{}}),this.setPosition(r.FIXED),this.setZIndex(Se),this._collapseButton=new le({direction:collapseHeadingFor(this.getEdge()),listeners:{collapse:()=>{this.toggleCollapsed()}}}),e?.listeners!==void 0&&this.applyListeners(e.listeners)}applyOptions(e){return super.applyOptions(e),this.setEdge(e.edge??this.getEdge()),this.setOrientation(e.orientation??this.getOrientation()),e.thickness!==void 0&&this.setThickness(e.thickness),e.collapsed!==void 0&&(this._options.collapsed=e.collapsed),this}setEdge(e){return this._options.edge=e,this}getEdge(){return this._options.edge??this._defaultOptions.edge}setThickness(e){return this._options.thickness=e,this.adaptThickness(),this}getThickness(){return this.isCollapsed()?Z:this._options.thickness===void 0?this.measureContentThickness():this._options.thickness}measureContentThickness(){let e=this.getPreferredSize();if(!e)return Y;let t=this.isVertical()?e.width:e.height;return t<=0||n(t)?Y:Math.ceil(t)}adaptThickness(){this._mounted&&this.applyRestingGeometry()}isCollapsed(){return this._options.collapsed??!1}setCollapsed(e){return e===this.isCollapsed()?this:(e&&(this._expandedThickness=this.getThickness()),this._options.collapsed=e,this._mounted&&this.animateCollapseTransition(e),this)}toggleCollapsed(){return this.setCollapsed(!this.isCollapsed())}applyCollapseAppearance(){let e=this.isCollapsed(),t=collapseHeadingFor(this.getEdge());this._collapseButton.setDirection(e?$[t]:t),this.applyCollapseStyling(e),this.positionChevron(e),this.setAllHandlesDisplayed(!e)}applyCollapseStyling(e){e?(this.setBackgroundColor(`var(--ts-ui-button-bg, #e8e8e8)`),this.setBackgroundImage(`var(--ts-ui-button-bg, linear-gradient(rgb(241, 241, 241), rgb(200, 200, 200)))`),this.setBorder(`1px solid var(--ts-ui-button-border, #c8c8c8)`)):(this.clearBackgroundImage(),this.setBackgroundColor(`var(--ts-ui-body-bg)`),this.applyEdgeBorder())}positionChevron(e){let t,n;if(e)t=`50%`,n=`50%`;else{let e=`calc(100% - ${Q}px)`,r=`${Q}px`;switch(this.getEdge()){case w.EAST:t=r,n=`50%`;break;case w.NORTH:t=`50%`,n=e;break;case w.SOUTH:t=`50%`,n=r;break;case w.WEST:default:t=e,n=`50%`}}let r=e?`10px`:null;new a({scope:`component`,name:this._collapseButton.getId(),styles:{left:t,top:n,width:r,zIndex:`1`}})}animateCollapseTransition(e){let t=collapseHeadingFor(this.getEdge());this._collapseButton.setDirection(e?$[t]:t),this.applyCollapseStyling(e),this.positionChevron(e);let n=this.getElement(),r=this.isVertical()?this.getWidth():this.getHeight(),i=e?Z:this._expandedThickness;e||(this.setAllHandlesDisplayed(!0),this.applyRestingGeometry(),this.scheduleLayout());let finalize=()=>{e&&this.setAllHandlesDisplayed(!1),this.applyRestingGeometry(),e||this.scheduleLayout()};if(!n){finalize();return}let a=this.collapseTween(r,i);this._collapseAnimation?.cancel(),this._collapseAnimation=c.play(n,{from:a.from,to:a.to,durationMs:X,properties:a.properties,onComplete:finalize})}collapseTween(t,n){let r=e.source.getViewportSize(),i={},a={};return this.isVertical()?(i.width=t+`px`,a.width=n+`px`,this.getEdge()===w.EAST&&(i.left=r.width-t+`px`,a.left=r.width-n+`px`)):(i.height=t+`px`,a.height=n+`px`,this.getEdge()===w.SOUTH&&(i.top=r.height-t+`px`,a.top=r.height-n+`px`)),{from:i,to:a,properties:Object.keys(a)}}setAllHandlesDisplayed(e){for(let t of this._drawers.values())t.handle.setDisplayed(e);for(let t of this._windows.values())t.handle?.setDisplayed(e)}setOrientation(e){return this._options.orientation=e,this._drawers!==void 0&&this.applyOrientation(),this}getOrientation(){return this._options.orientation??this._defaultOptions.orientation}mount(){if(this._mounted)return this;this.setLayoutManager(this.isVertical()?new g:new re),this.applyEdgeBorder(),this.applyRestingGeometry();let t=this.getElement(!0);e.sink.appendChild(e.source.getDocumentElement(),t);let n=this._collapseButton.getElement(!0);return n&&e.source.getParentElement(n)!==t&&e.sink.appendChild(t,n),this.applyCollapseAppearance(),this.scheduleLayout(),i.addViewportListener(this,`resize`,this._boundResizeHandler),this._mounted=!0,this.animateIn(),this}unmount(){if(!this._mounted)return this;i.removeViewportListener(this,`resize`,this._boundResizeHandler),this._mounted=!1;let e=this.getElement(),detach=()=>{this.removeElement()};return e?(this._slideOutAnimation?.cancel(),this._slideOutAnimation=c.play(e,{to:{transform:this.offscreenTransform()},durationMs:X,properties:[`transform`],onComplete:detach}),this):(detach(),this)}animateIn(){let e=this.getElement();e&&(this._slideInAnimation?.cancel(),this._slideInAnimation=c.play(e,{from:{transform:this.offscreenTransform()},to:{transform:`translate(0, 0)`},durationMs:X,properties:[`transform`]}))}offscreenTransform(){switch(this.getEdge()){case w.EAST:return`translateX(100%)`;case w.NORTH:return`translateY(-100%)`;case w.SOUTH:return`translateY(100%)`;case w.WEST:default:return`translateX(-100%)`}}registerDrawer(e,t={}){if(this._drawers.has(e))return this;let n=new J({text:t.text,glyph:t.glyph,selected:e.isOpen()}),onOpen=()=>{n.setSelected(!0)},onClose=()=>{n.setSelected(!1)},onAction=()=>{e.toggle()};return e.on(`open`,onOpen),e.on(`close`,onClose),n.on(`action`,onAction),t.alignEdge!==!1&&e.setEdge(this.getEdge()),this.applyHandleOrientation(n),n.setDisplayed(!this.isCollapsed()),this.addComponent(n),this._drawers.set(e,{handle:n,onOpen,onClose,onAction}),this.adaptThickness(),this.scheduleLayout(),this.emit(`register`,e),this}unregisterDrawer(e){let t=this._drawers.get(e);return t?(e.off(`open`,t.onOpen),e.off(`close`,t.onClose),t.handle.off(`action`,t.onAction),this.removeComponent(t.handle),this._drawers.delete(e),this.adaptThickness(),this.emit(`unregister`,e),this):this}registerWindow(e){if(this._windows.has(e))return this;let onMinimize=()=>{this.showWindowHandle(e)},onRestore=()=>{this.removeWindowHandle(e)},onClose=()=>{this.unregisterWindow(e)},onAction=()=>{e.restore()};return e.on(`minimize`,onMinimize),e.on(`restore`,onRestore),e.on(`close`,onClose),this._windows.set(e,{handle:null,onMinimize,onRestore,onClose,onAction}),e.isMinimized()&&this.showWindowHandle(e),this.emit(`register`,e),this}unregisterWindow(e){let t=this._windows.get(e);return t?(e.off(`minimize`,t.onMinimize),e.off(`restore`,t.onRestore),e.off(`close`,t.onClose),this.removeWindowHandle(e),this._windows.delete(e),this.emit(`unregister`,e),this):this}showWindowHandle(e){let t=this._windows.get(e);if(!t||t.handle!==null)return;let n=new J({text:e.getTitle(),glyph:e.getGlyph(),selected:!0});n.on(`action`,t.onAction),t.handle=n,this.applyHandleOrientation(n),n.setDisplayed(!this.isCollapsed()),this.addComponent(n),this.adaptThickness(),this.scheduleLayout()}removeWindowHandle(e){let t=this._windows.get(e);!t||t.handle===null||(t.handle.off(`action`,t.onAction),this.removeComponent(t.handle),t.handle=null,this.adaptThickness())}applyOrientation(){for(let e of this._drawers.values())this.applyHandleOrientation(e.handle);for(let e of this._windows.values())e.handle!==null&&this.applyHandleOrientation(e.handle);this.adaptThickness(),this.scheduleLayout()}applyHandleOrientation(e){let t=this.getOrientation(),n=t===`vertical-cw`?`sideways-rl`:t===`vertical-ccw`?`sideways-lr`:null;this.isVertical()&&n!==null?e.setWritingMode(n):e.clearWritingMode()}clampsToContentSize(){return!1}isVertical(){let e=this.getEdge();return e===w.WEST||e===w.EAST}handleMainAxisOffset(e){let t=this.isVertical(),mainPos=e=>t?e.getY():e.getX(),mainExtent=e=>t?e.getHeight():e.getWidth(),n=this._windows.get(e)?.handle??null;if(n!==null)return mainPos(n);let r=this.getComponents();if(r.length===0)return 0;let i=r[r.length-1];return mainPos(i)+mainExtent(i)+this.handleSpacing()}handleMainAxisExtent(e){let t=this.isVertical(),mainExtent=e=>t?e.getHeight():e.getWidth(),n=this._windows.get(e)?.handle??null;if(n!==null)return mainExtent(n);let r=this.getComponents();return r.length===0?0:mainExtent(r[r.length-1])}handleSpacing(){let e=this.getLayoutManager();return e instanceof ne?e.getComponentSpacing():0}restingRect(){let t=e.source.getViewportSize(),n=this.getThickness();switch(this.getEdge()){case w.EAST:return{x:t.width-n,y:0,width:n,height:t.height};case w.NORTH:return{x:0,y:0,width:t.width,height:n};case w.SOUTH:return{x:0,y:t.height-n,width:t.width,height:n};case w.WEST:default:return{x:0,y:0,width:n,height:t.height}}}applyRestingGeometry(){let e=this.restingRect();this.setX(e.x),this.setY(e.y),this.setWidth(e.width),this.setHeight(e.height)}applyEdgeBorder(){let e=`1px solid transparent`,t=`1px solid var(--ts-ui-rail-border)`;switch(this.getEdge()){case w.EAST:this.setBorder({border:e,borderLeft:t});break;case w.NORTH:this.setBorder({border:e,borderBottom:t});break;case w.SOUTH:this.setBorder({border:e,borderTop:t});break;case w.WEST:default:this.setBorder({border:e,borderRight:t})}}on(e,t){return this._listeners.add(e,t),this}off(e,t){return this._listeners.remove(e,t),this}emit(e,t){this._listeners.fire(e,t)}destructor(){this._collapseAnimation?.cancel(),this._collapseAnimation=null,this._slideOutAnimation?.cancel(),this._slideOutAnimation=null,this._slideInAnimation?.cancel(),this._slideInAnimation=null,this._collapseButton.dispose(),super.destructor()}},we=o(Rail),Dock=class extends u{_panels=new Map;_frames=new Map;_lazyFactories=new Map;_wiring=new Map;_sweepScheduled=!1;_listeners=new l;_focusedPanelId=null;_panelHost=new Map;_frameRegion=new Map;_lastActiveRegion=null;_floatSubscribed=new Set;_emptyDropOverlay=new B;_empty=!0;_emptyReconciled=!1;requestSweep=()=>{this.scheduleSweep()};onPanelDocked=e=>{this.requestSweep()};constructor(e,t){super(e,{layoutManager:new m,...t});let n=e?.layout?this.compileLayout(e.layout):this.newTabRegion();this.addComponent(n),this.scheduleSweep(),this.wireEmptyDropTarget(),this.applyListeners(e?.listeners)}applyOptions(e){return super.applyOptions(e),e.emptyContent!==void 0&&this.setEmptyContent(e.emptyContent),this}setEmptyContent(e){let t=this._emptyReconciled&&this.mainRegionEmpty();return t&&this.hideEmptyState(),this._options.emptyContent=e??void 0,t&&this.showEmptyState(),this}getEmptyContent(){return this._options.emptyContent??null}isEmpty(){return this._frames.size===0}wireEmptyDropTarget(){S.makeDropTarget(this,{accepts:e=>e.dragData.tabDrag===!0&&this.getComponents().length===0,suppressValidityTint:!0,onDragOver:()=>(this._emptyDropOverlay.attachTo(this),this._emptyDropOverlay.highlightFull(),null),onDragLeave:()=>{this._emptyDropOverlay.detach()},onDrop:e=>{this._emptyDropOverlay.detach();let t=se.get(e.dragData.componentId);if(!t)return;let n=this.newTabRegion();this.addComponent(n),n.moveComponent(t),this.scheduleSweep()}})}addPanel(e){this._panels.set(e.id,e);let t=this.resolvePanel(e.id);if(t){let n=this.activeTabRegion();this._lastActiveRegion=n,n.moveComponent(t,void 0,this.leafConstraints(e)),n.getLayoutManager().setActiveContent(t),this._frameRegion.set(e.id,n),this.scheduleSweep()}return this}addLazyPanel(e){this._panels.set(e.id,e),this._lazyFactories.set(e.id,typeof e.content==`function`?e.content:()=>e.content);let t=this.resolvePanel(e.id);if(t){let n=this.activeTabRegion();this._lastActiveRegion=n,n.moveComponent(t,void 0,this.leafConstraints(e)),n.getLayoutManager().setActiveContent(t),this._frameRegion.set(e.id,n),this.scheduleSweep()}return this}getRootRegion(){return this.getComponents()[0]}getLayoutState(){return V(this.getRootRegion())}setLayoutState(e){return this._frameRegion.clear(),fe(this.getRootRegion(),e,e=>this.resolvePanel(e)),this.scheduleSweep(),this}resolvePanel(e){let t=this._panels.get(e);if(!t)return null;let n=this._frames.get(e);if(!n){let r=this._lazyFactories.get(e);if(r){let e=new y;e.setBarVisible(!1),n=new u({id:t.id,name:t.title,layoutManager:e});let onFailed=e=>{this.failPanel(t.id,e)},onBusyChanged=e=>{this.setFrameBusy(t.id,e)};e.on(`exception`,onFailed),e.on(`busychange`,onBusyChanged),e.addLazyTab(r,t.title??t.id)}else n=new u({id:t.id,name:t.title,layoutManager:new m}),n.addComponent(t.content);this._frames.set(e,n)}return n}leafConstraints(e){let t=new T;return t.closeable=e.closeable??!0,t.disposeOnClose=e.disposeOnClose??!0,e.glyph&&(t.glyph=e.glyph),e.tooltip&&(t.tooltip=e.tooltip),t}activeTabRegion(){let e=this.getRootRegion(),t=this._lastActiveRegion;return t&&this.isTab(t)&&this.containsRegion(e,t)?t:this.isTab(e)?e:this.firstTabRegion(e)??this.wrapRootInTab()}containsRegion(e,t){if(e===t)return!0;for(let n of e.getComponents())if(this.isRegionContainer(n)&&this.containsRegion(n,t))return!0;return!1}firstTabRegion(e){if(this.isTab(e))return e;for(let t of e.getComponents())if(this.isRegionContainer(t)){let e=this.firstTabRegion(t);if(e)return e}return null}wrapRootInTab(){let e=this.newTabRegion(),t=this.getRootRegion();return this.addComponent(e),e.moveComponent(t),e}newTabRegion(){return new u({layoutManager:new y({reorderable:!0,compact:!0})})}compileLayout(e){if(`split`in e){let t=new u({layoutManager:new z({orientation:e.split})});for(let n of e.children)t.addComponent(this.compileRegion(n));return t}return`tabs`in e?this.compileTabs(e.tabs):this.compileTabs([e])}compileRegion(e){return`split`in e||`tabs`in e?this.compileLayout(e):this.compileTabs([e])}compileTabs(e){let t=this.newTabRegion();for(let n of e){this._panels.set(n.id,n);let e=this.resolvePanel(n.id);e&&(t.addComponent(e,this.leafConstraints(n)),this._panelHost.set(n.id,null),this._frameRegion.set(n.id,t))}return t}scheduleSweep(){this._sweepScheduled||(this._sweepScheduled=!0,e.sink.requestAnimationFrame(()=>{this._sweepScheduled=!1,this.runSweep()}))}runSweep(){let e=this.getRootRegion();if(!e)return;let t=this.ownedFloatWindows().map(e=>this.adoptFloat(e)).filter(e=>e!==null);this.wireRegion(e);for(let e of t)this.wireRegion(e);this.subscribeFloatWindows(),this.reconcileHosts(e),this.teardownVanished(e,t),this.reconcileEmptyState()}reconcileEmptyState(){this.mainRegionEmpty()?this.showEmptyState():this.hideEmptyState();let e=this.isEmpty();!this._emptyReconciled&&(this._emptyReconciled=!0,e===this._empty)||e!==this._empty&&(this._empty=e,this.emit(`emptychange`,{empty:e}))}mainRegionEmpty(){let e=this.getRootRegion();if(!e)return!1;let t=this.getEmptyContent();return e.getComponents().every(e=>e===t)}showEmptyState(){let e=this.getRootRegion(),t=this.getEmptyContent();e&&(t?(this.rootTab()?.setBarVisible(!0),t.getParentComponent()!==e&&e.moveComponent(t,void 0,this.placeholderConstraints())):this.rootTab()?.setBarVisible(!1))}hideEmptyState(){let e=this.getEmptyContent(),t=e?.getParentComponent(),n=t?.getLayoutManager();e&&(n instanceof y&&n.closeTab(e)||t?.removeComponent(e)),this.rootTab()?.setBarVisible(!0)}rootTab(){let e=this.getRootRegion()?.getLayoutManager();return e instanceof y?e:null}placeholderConstraints(){let e=new T;return e.closeable=!1,e.transient=!0,e.disposeOnClose=!1,e}subscribeFloatWindows(){for(let e of this.floatWindowsHoldingFrames()){if(this._floatSubscribed.has(e))continue;let onFloatActivate=()=>{this.onFloatActivated(e)},onFloatClose=()=>{this.onFloatClosed(e)};if(e.on(`activate`,onFloatActivate),e.on(`close`,onFloatClose),e instanceof v){let t=e.getLayoutManager();t.on(`activate`,this.onPanelFocused),t.on(`tabclose`,this.onPanelClosed),t.on(`detach`,this.onPanelDetached),t.on(`dock`,this.onPanelDocked)}this._floatSubscribed.add(e)}this.pruneClosedFloatSubscriptions()}pruneClosedFloatSubscriptions(){let e=new Set(_.getOpenWindows());for(let t of this._floatSubscribed)e.has(t)||this._floatSubscribed.delete(t)}floatWindowsHoldingFrames(){let e=[...this._frames.values()];return _.getOpenWindows().filter(t=>!this.windowContains(t,this)&&e.some(e=>this.windowContains(t,e)))}reconcileHosts(e){for(let[t,n]of this._frames){if(!this._panels.has(t))continue;let r=this.hostForFrame(n,e),i=this._panelHost.has(t),a=this._panelHost.get(t)??null,o=this.regionForFrame(n),s=this._frameRegion.get(t)??null;i?r===a?o&&s&&o!==s&&this.emit(`move`,{id:t,content:n,window:r}):(this.emit(`detach`,{id:t,content:n,window:a}),this.emit(`attach`,{id:t,content:n,window:r})):this.emit(`attach`,{id:t,content:n,window:r}),this._panelHost.set(t,r),o&&this._frameRegion.set(t,o)}}hostForFrame(e,t){return this.isUnder(t,e)?null:this.floatForFrame(e)}ownedFloatWindows(){let e=[...this._frames.values()];return _.getOpenWindows().filter(t=>!(t instanceof v)&&!this.windowContains(t,this)&&e.some(e=>this.windowContains(t,e)))}windowContains(e,t){for(let n=t;n;n=n.getParentComponent())if(n===e)return!0;return!1}windowContent(e){return e.getComponents().find(t=>!e.isChromeComponent(t))??null}adoptFloat(e){let t=this.windowContent(e);if(!t)return null;if(this.isRegionContainer(t))return t;let n=this.newTabRegion();return e.moveComponent(n),n.moveComponent(t),n}wireRegion(e){let t=this._wiring.get(e);t||(t={dockRegion:new H(e,this.requestSweep),tabWired:!1},this._wiring.set(e,t));let n=e.getLayoutManager();if(this.isTab(e)&&!t.tabWired){let r=n;r.setReorderable(!0);let onEmpty=()=>{this.pruneRegion(e)};r.on(`empty`,onEmpty),r.on(`tabclose`,this.onPanelClosed),r.on(`activate`,this.onPanelFocused),r.on(`detach`,this.onPanelDetached),r.on(`dock`,this.onPanelDocked),t.tabWired=!0}for(let t of e.getComponents())this.isRegionContainer(t)&&this._frames.get(t.getId())!==t&&this.wireRegion(t)}pruneRegion(e){let t=e.getParentComponent();!t||e.getComponents().length>0||t!==this&&(t.removeComponent(e),this.collapseSinglePaneSplit(t),this.closeFloatIfEmpty(t),this.scheduleSweep())}closeFloatIfEmpty(e){_.getOpenWindows().includes(e)&&(this.windowContent(e)||e.requestClose())}collapseSinglePaneSplit(e){if(this.regionKind(e)!==`Split`)return;let t=e.getComponents();if(t.length!==1)return;let n=e.getParentComponent();if(!n)return;let r=n.getComponents().indexOf(e);this.regionKind(n)===`Split`&&n.getLayoutManager().transferPaneSize(e,t[0]),n.moveComponent(t[0],r),n.removeComponent(e)}teardownVanished(e,t){let n=new Set;this.collectRegions(e,n);for(let e of t)this.collectRegions(e,n);for(let[e,t]of this._wiring)n.has(e)||(t.dockRegion.destroy(),this._wiring.delete(e))}collectRegions(e,t){t.add(e);for(let n of e.getComponents())this.isRegionContainer(n)&&this.collectRegions(n,t)}isRegionContainer(e){let t=this.regionKind(e);return t===`Split`||t===`Tab`}isTab(e){return this.regionKind(e)===`Tab`}regionKind(e){let t=e.getLayoutManager();return t?t.getClassName().replace(/^_/,``):``}onPanelClosed=e=>{let t=e.getId();if(this._frames.get(t)!==e)return;let n=this._frameRegion.get(t)??null;this._frames.delete(t),this._panelHost.delete(t),this._frameRegion.delete(t),this.emit(`close`,{id:t,content:e,window:null}),this.scheduleSweep(),this._focusedPanelId===t&&this.scheduleFocusRecompute(n)};failPanel(e,t){this._frames.has(e)&&(this.removePanel(e)||this._frames.delete(e),this.emit(`exception`,{id:e,error:t}))}setFrameBusy(e,t){let n=this._frames.get(e);if(!n)return;let r=this.regionForFrame(n);r&&r.getLayoutManager().setTabBusy(n,t)}onPanelFocused=e=>{let t=e.getId();if(this._frames.get(t)!==e)return;let n=this._frameRegion.get(t);n&&(this._lastActiveRegion=n),this.setFocus(t)};onPanelDetached=e=>{this.scheduleSweep()};onFloatActivated(e){let t=this.activeFrameInFloat(e);t&&this.setFocus(t.getId())}onFloatClosed(e){let t=!1;for(let n of this.framesInWindow(e)){let e=n.getId();this._frames.delete(e),this._panelHost.delete(e),this._frameRegion.delete(e),this.emit(`close`,{id:e,content:n,window:null}),this._focusedPanelId===e&&(t=!0)}this.scheduleSweep(),t&&this.scheduleFocusRecompute(null)}setFocus(e){if(e===this._focusedPanelId)return;if(this._focusedPanelId=e,e===null){this.emit(`focus`,null);return}let t=this._frames.get(e);if(t){let n=this.hostForFrame(t,this.getRootRegion());this.emit(`focus`,{id:e,content:t,window:n})}}scheduleFocusRecompute(t){e.sink.requestAnimationFrame(()=>this.recomputeFocusAfterClose(t))}recomputeFocusAfterClose(e){if(this._frames.size===0){this.setFocus(null);return}if(!e||!this.isTab(e)||e.getComponents().length===0){this.setFocus(null);return}let t=e.getLayoutManager().getActiveContent();this.setFocus(t?t.getId():null)}focusPanel(e){let t=this._frames.get(e);if(!t)return!1;let n=this.regionForFrame(t);if(!n)return!1;let r=n.getLayoutManager().indexOfContent(t);return r<0?!1:(this.floatForFrame(t)?.bringToFront(),n.getLayoutManager().setActiveTabIndex(r),!0)}removePanel(e){let t=this._frames.get(e);if(!t)return!1;let n=this.regionForFrame(t);return n?n.getLayoutManager().closeTab(t):!1}regionForFrame(e){for(let t of this.allTabRegions())if(t.getLayoutManager().indexOfContent(e)>=0)return t;return null}floatForFrame(e){return this.floatWindowsHoldingFrames().find(t=>this.windowContains(t,e))??null}allTabRegions(){let e=[],t=this.getRootRegion();t&&this.collectTabRegions(t,e);for(let t of this.floatWindowsHoldingFrames()){if(t instanceof v){e.push(t);continue}let n=this.windowContent(t);n&&this.collectTabRegions(n,e)}return e}collectTabRegions(e,t){this.isTab(e)&&t.push(e);for(let n of e.getComponents())this.isRegionContainer(n)&&this.collectTabRegions(n,t)}framesInWindow(e){return[...this._frames.values()].filter(t=>this.windowContains(e,t))}activeFrameInFloat(e){let t=null;if(e instanceof v)t=e.getLayoutManager();else{let n=this.windowContent(e),r=[];n&&this.collectTabRegions(n,r),t=r.length>0?r[0].getLayoutManager():null}let n=t?t.getActiveContent():null;return n&&this._frames.get(n.getId())===n?n:null}isUnder(e,t){for(let n=t;n;n=n.getParentComponent())if(n===e)return!0;return!1}on(e,t){return this._listeners.add(e,t),this}off(e,t){return this._listeners.remove(e,t),this}emit(e,t){this._listeners.fire(e,t)}destructor(){this._emptyDropOverlay.dispose();for(let e of this._wiring.values())e.dockRegion.destroy();this._wiring.clear(),super.destructor()}},Te=o(Dock);export{_ as AbstractWindow,ie as ButtonGroup,j as Dialog,k as DialogButtons,O as DialogTitleBar,Te as Dock,ce as DragFeedback,C as DragGhost,S as DragManager,xe as Drawer,B as DropZoneOverlay,de as Menu,W as Notification,ye as NotificationHistoryButton,A as Popover,me as PopupPanel,we as Rail,J as RailHandle,b as ReorderIndicator,v as TabWindow,p as Tooltip,ae as Window};
2
2
  //# sourceMappingURL=overlay.es.js.map