@jimka/typescript-ui 0.1.0 → 0.2.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.
- package/README.md +5 -18
- package/dist/lib/{AbstractBooleanInput-C3rj7sje.js → AbstractBooleanInput-BGesvIZy.js} +2 -2
- package/dist/lib/{AbstractBooleanInput-C3rj7sje.js.map → AbstractBooleanInput-BGesvIZy.js.map} +1 -1
- package/dist/lib/{AbstractInput-DD-NpicS.js → AbstractInput-BxOtFrER.js} +2 -2
- package/dist/lib/{AbstractInput-DD-NpicS.js.map → AbstractInput-BxOtFrER.js.map} +1 -1
- package/dist/lib/AnimatedDropdown-CZQEqQi-.js +2 -0
- package/dist/lib/AnimatedDropdown-CZQEqQi-.js.map +1 -0
- package/dist/lib/Border-BgaZkc1R.js +2 -0
- package/dist/lib/Border-BgaZkc1R.js.map +1 -0
- package/dist/lib/{BoxLayout-DgZukB5_.js → BoxLayout-DrKGfsup.js} +2 -2
- package/dist/lib/{BoxLayout-DgZukB5_.js.map → BoxLayout-DrKGfsup.js.map} +1 -1
- package/dist/lib/Button-U1rsP4v8.js +2 -0
- package/dist/lib/Button-U1rsP4v8.js.map +1 -0
- package/dist/lib/{Card-UF0fq8cQ.js → Card-BVwOS8AG.js} +2 -2
- package/dist/lib/{Card-UF0fq8cQ.js.map → Card-BVwOS8AG.js.map} +1 -1
- package/dist/lib/ComboBox-B9EDPu6T.js +2 -0
- package/dist/lib/ComboBox-B9EDPu6T.js.map +1 -0
- package/dist/lib/Component-DXf5a3g0.js +2 -0
- package/dist/lib/Component-DXf5a3g0.js.map +1 -0
- package/dist/lib/Container-D5H8VxJK.js +2 -0
- package/dist/lib/{Container-3KsvsJ6S.js.map → Container-D5H8VxJK.js.map} +1 -1
- package/dist/lib/DOM-CGn7xyTw.js +2 -0
- package/dist/lib/DOM-CGn7xyTw.js.map +1 -0
- package/dist/lib/DragManager-CI4mZQFy.js +2 -0
- package/dist/lib/{DragManager-tPMnbjeO.js.map → DragManager-CI4mZQFy.js.map} +1 -1
- package/dist/lib/FieldDecorator-CJs9gwqH.js +2 -0
- package/dist/lib/{FieldDecorator-E7WzutjO.js.map → FieldDecorator-CJs9gwqH.js.map} +1 -1
- package/dist/lib/{Fit-CFIr4P9R.js → Fit-DjRsiwlg.js} +2 -2
- package/dist/lib/{Fit-CFIr4P9R.js.map → Fit-DjRsiwlg.js.map} +1 -1
- package/dist/lib/Glyph-KEf4nIv2.js +2 -0
- package/dist/lib/Glyph-KEf4nIv2.js.map +1 -0
- package/dist/lib/{Grid-Czux--Mr.js → Grid-DdL9TVeJ.js} +2 -2
- package/dist/lib/{Grid-Czux--Mr.js.map → Grid-DdL9TVeJ.js.map} +1 -1
- package/dist/lib/GridConstraints-DkLueyrf.js +2 -0
- package/dist/lib/GridConstraints-DkLueyrf.js.map +1 -0
- package/dist/lib/{HBox-Q8y1PHlk.js → HBox-Ce0GTCJP.js} +2 -2
- package/dist/lib/{HBox-Q8y1PHlk.js.map → HBox-Ce0GTCJP.js.map} +1 -1
- package/dist/lib/{Header-zPdvC2AX.js → Header-BQIVpBte.js} +2 -2
- package/dist/lib/{Header-zPdvC2AX.js.map → Header-BQIVpBte.js.map} +1 -1
- package/dist/lib/{IconText-BvGfu7eq.js → IconText-Bo4Qcnot.js} +2 -2
- package/dist/lib/{IconText-BvGfu7eq.js.map → IconText-Bo4Qcnot.js.map} +1 -1
- package/dist/lib/LayoutConstraints-DkctJZXB.js +2 -0
- package/dist/lib/LayoutConstraints-DkctJZXB.js.map +1 -0
- package/dist/lib/LayoutSerialization-BT66TY83.js +2 -0
- package/dist/lib/LayoutSerialization-BT66TY83.js.map +1 -0
- package/dist/lib/LayoutSizes-DU3qSq0w.js +2 -0
- package/dist/lib/LayoutSizes-DU3qSq0w.js.map +1 -0
- package/dist/lib/List-DtTVTyWW.js +2 -0
- package/dist/lib/List-DtTVTyWW.js.map +1 -0
- package/dist/lib/Menu-Dz4L7EKJ.js +2 -0
- package/dist/lib/Menu-Dz4L7EKJ.js.map +1 -0
- package/dist/lib/MenuButton-VJ5uC3c1.js +2 -0
- package/dist/lib/{MenuButton-JQQaKThJ.js.map → MenuButton-VJ5uC3c1.js.map} +1 -1
- package/dist/lib/Panel-DzWdYwq1.js +2 -0
- package/dist/lib/Panel-DzWdYwq1.js.map +1 -0
- package/dist/lib/Position-A39T7-_1.js +2 -0
- package/dist/lib/Position-A39T7-_1.js.map +1 -0
- package/dist/lib/ProgressSpinner-zJKtGyNJ.js +2 -0
- package/dist/lib/ProgressSpinner-zJKtGyNJ.js.map +1 -0
- package/dist/lib/RadioButton-CYSSv4nV.js +2 -0
- package/dist/lib/RadioButton-CYSSv4nV.js.map +1 -0
- package/dist/lib/{RovingTabIndex-CFIzIjjU.js → RovingTabIndex-BSZ31Vp5.js} +2 -2
- package/dist/lib/{RovingTabIndex-CFIzIjjU.js.map → RovingTabIndex-BSZ31Vp5.js.map} +1 -1
- package/dist/lib/Scrollbar-BhtOjqkG.js +2 -0
- package/dist/lib/Scrollbar-BhtOjqkG.js.map +1 -0
- package/dist/lib/Slider-CdXm7E64.js +2 -0
- package/dist/lib/Slider-CdXm7E64.js.map +1 -0
- package/dist/lib/{Spacer-BVQncB5B.js → Spacer-D9NGW4QG.js} +2 -2
- package/dist/lib/{Spacer-BVQncB5B.js.map → Spacer-D9NGW4QG.js.map} +1 -1
- package/dist/lib/TabButton-CThevdY_.js +2 -0
- package/dist/lib/{TabButton-pZKFYg7b.js.map → TabButton-CThevdY_.js.map} +1 -1
- package/dist/lib/Text-gz6qjFfP.js +2 -0
- package/dist/lib/Text-gz6qjFfP.js.map +1 -0
- package/dist/lib/Tooltip-tkXDk5Bo.js +3 -0
- package/dist/lib/Tooltip-tkXDk5Bo.js.map +1 -0
- package/dist/lib/{VBox-D5B9ecw0.js → VBox-EIqw85Rh.js} +2 -2
- package/dist/lib/{VBox-D5B9ecw0.js.map → VBox-EIqw85Rh.js.map} +1 -1
- package/dist/lib/VirtualRowView-BxpHQ_u8.js +2 -0
- package/dist/lib/{VirtualRowView-Con9SWiU.js.map → VirtualRowView-BxpHQ_u8.js.map} +1 -1
- package/dist/lib/VirtualScroller-DwEEJE1_.js +2 -0
- package/dist/lib/{VirtualScroller-BPDmO1ir.js.map → VirtualScroller-DwEEJE1_.js.map} +1 -1
- package/dist/lib/component/button.es.js +1 -1
- package/dist/lib/component/button.es.js.map +1 -1
- package/dist/lib/component/chart.es.js +1 -1
- package/dist/lib/component/chart.es.js.map +1 -1
- package/dist/lib/component/container.es.js +1 -1
- package/dist/lib/component/container.es.js.map +1 -1
- package/dist/lib/component/diagram.es.js +1 -1
- package/dist/lib/component/diagram.es.js.map +1 -1
- package/dist/lib/component/display.es.js +1 -1
- package/dist/lib/component/display.es.js.map +1 -1
- package/dist/lib/component/editor.es.js +3 -1
- package/dist/lib/component/editor.es.js.map +1 -1
- package/dist/lib/component/input.es.js +1 -1
- package/dist/lib/component/input.es.js.map +1 -1
- package/dist/lib/component/list.es.js +1 -1
- package/dist/lib/component/list.es.js.map +1 -1
- package/dist/lib/component/menubar.es.js +1 -1
- package/dist/lib/component/menubar.es.js.map +1 -1
- package/dist/lib/component/table.es.js +2 -2
- package/dist/lib/component/table.es.js.map +1 -1
- package/dist/lib/component/tree.es.js +1 -1
- package/dist/lib/component/tree.es.js.map +1 -1
- package/dist/lib/core.es.js +1 -1
- package/dist/lib/core.es.js.map +1 -1
- package/dist/lib/layout.es.js +1 -1
- package/dist/lib/overlay.es.js +1 -1
- package/dist/lib/overlay.es.js.map +1 -1
- package/dist/lib/primitive.es.js +1 -1
- package/dist/lib/router.es.js +2 -0
- package/dist/lib/router.es.js.map +1 -0
- package/dist/lib/types/component/button/Button.d.ts +4 -3
- package/dist/lib/types/component/chart/AbstractChart.d.ts +1 -1
- package/dist/lib/types/component/chart/ChartLegend.d.ts +1 -1
- package/dist/lib/types/component/container/DialogBackdrop.d.ts +2 -1
- package/dist/lib/types/component/container/MenuItem.d.ts +1 -1
- package/dist/lib/types/component/container/ScrollStrip.d.ts +1 -0
- package/dist/lib/types/component/container/SplitGutter.d.ts +3 -2
- package/dist/lib/types/component/container/TabBar.d.ts +1 -2
- package/dist/lib/types/component/container/TabPanel.d.ts +6 -3
- package/dist/lib/types/component/container/WindowBorder.d.ts +2 -1
- package/dist/lib/types/component/container/WindowHeader.d.ts +2 -1
- package/dist/lib/types/component/display/Glyph.d.ts +2 -1
- package/dist/lib/types/component/display/Markdown.d.ts +11 -1
- package/dist/lib/types/component/display/PaginationBar.d.ts +1 -1
- package/dist/lib/types/component/display/SpinnerWrap.d.ts +2 -0
- package/dist/lib/types/component/display/Video.d.ts +1 -1
- package/dist/lib/types/component/display/VideoPlayer.d.ts +1 -1
- package/dist/lib/types/component/display/index.d.ts +1 -1
- package/dist/lib/types/component/editor/CodeEditor.d.ts +2 -1
- package/dist/lib/types/component/editor/MarkdownEditor.d.ts +7 -1
- package/dist/lib/types/component/editor/markdownTableTransformer.d.ts +2 -0
- package/dist/lib/types/component/input/Checkbox.d.ts +2 -1
- package/dist/lib/types/component/input/Link.d.ts +1 -1
- package/dist/lib/types/component/input/RadioButton.d.ts +2 -1
- package/dist/lib/types/component/input/Slider.d.ts +2 -1
- package/dist/lib/types/component/input/Text.d.ts +1 -3
- package/dist/lib/types/component/input/TextInput.d.ts +3 -2
- package/dist/lib/types/component/list/AbstractSelectableList.d.ts +2 -1
- package/dist/lib/types/component/menubar/MenuBarButton.d.ts +1 -1
- package/dist/lib/types/core/AnimatedDropdown.d.ts +6 -2
- package/dist/lib/types/core/Animation.d.ts +9 -6
- package/dist/lib/types/core/Component.d.ts +16 -11
- package/dist/lib/types/core/DOM.d.ts +14 -0
- package/dist/lib/types/core/Event.d.ts +12 -6
- package/dist/lib/types/core/index.d.ts +2 -2
- package/dist/lib/types/layout/Accordion.d.ts +2 -0
- package/dist/lib/types/layout/Border.d.ts +1 -0
- package/dist/lib/types/layout/CollapseSupport.d.ts +5 -1
- package/dist/lib/types/layout/LayoutConstraints.d.ts +1 -0
- package/dist/lib/types/layout/LayoutManager.d.ts +2 -0
- package/dist/lib/types/layout/Split.d.ts +1 -0
- package/dist/lib/types/layout/Tab.d.ts +10 -3
- package/dist/lib/types/overlay/AbstractWindow.d.ts +9 -2
- package/dist/lib/types/overlay/Dialog.d.ts +6 -0
- package/dist/lib/types/overlay/Dock.d.ts +12 -2
- package/dist/lib/types/overlay/Drawer.d.ts +5 -0
- package/dist/lib/types/overlay/Menu.d.ts +3 -1
- package/dist/lib/types/overlay/Notification.d.ts +3 -0
- package/dist/lib/types/overlay/Popover.d.ts +3 -1
- package/dist/lib/types/overlay/Rail.d.ts +7 -0
- package/dist/lib/types/overlay/Tooltip.d.ts +3 -0
- package/dist/lib/types/overlay/index.d.ts +1 -1
- package/dist/lib/types/router/RoutePattern.d.ts +18 -0
- package/dist/lib/types/router/Router.d.ts +36 -0
- package/dist/lib/types/router/index.d.ts +2 -0
- package/dist/lib/validation.es.js +1 -1
- package/llms.txt +9 -5
- package/package.json +6 -1
- package/dist/lib/AnimatedDropdown-BbGCs70E.js +0 -2
- package/dist/lib/AnimatedDropdown-BbGCs70E.js.map +0 -1
- package/dist/lib/Border-oZC_SDy8.js +0 -2
- package/dist/lib/Border-oZC_SDy8.js.map +0 -1
- package/dist/lib/Button-DEUtBqK4.js +0 -2
- package/dist/lib/Button-DEUtBqK4.js.map +0 -1
- package/dist/lib/ComboBox-GOBOAJ1N.js +0 -2
- package/dist/lib/ComboBox-GOBOAJ1N.js.map +0 -1
- package/dist/lib/Component-BR2f0Itb.js +0 -2
- package/dist/lib/Component-BR2f0Itb.js.map +0 -1
- package/dist/lib/Container-3KsvsJ6S.js +0 -2
- package/dist/lib/DragManager-tPMnbjeO.js +0 -2
- package/dist/lib/FieldDecorator-E7WzutjO.js +0 -2
- package/dist/lib/Glyph-WUqTF_Z9.js +0 -2
- package/dist/lib/Glyph-WUqTF_Z9.js.map +0 -1
- package/dist/lib/GridConstraints-Q3wvuovN.js +0 -2
- package/dist/lib/GridConstraints-Q3wvuovN.js.map +0 -1
- package/dist/lib/LayoutConstraints-CHI2lhPd.js +0 -2
- package/dist/lib/LayoutConstraints-CHI2lhPd.js.map +0 -1
- package/dist/lib/LayoutSerialization-CWU0iEuV.js +0 -2
- package/dist/lib/LayoutSerialization-CWU0iEuV.js.map +0 -1
- package/dist/lib/LayoutSizes-BW4wyGDI.js +0 -2
- package/dist/lib/LayoutSizes-BW4wyGDI.js.map +0 -1
- package/dist/lib/List-D-GhoVgB.js +0 -2
- package/dist/lib/List-D-GhoVgB.js.map +0 -1
- package/dist/lib/Menu-Wz4MK6sA.js +0 -2
- package/dist/lib/Menu-Wz4MK6sA.js.map +0 -1
- package/dist/lib/MenuButton-JQQaKThJ.js +0 -2
- package/dist/lib/Panel-DIsdaqc2.js +0 -2
- package/dist/lib/Panel-DIsdaqc2.js.map +0 -1
- package/dist/lib/Position-B-WfZYAJ.js +0 -2
- package/dist/lib/Position-B-WfZYAJ.js.map +0 -1
- package/dist/lib/ProgressSpinner-Dzaka7_c.js +0 -2
- package/dist/lib/ProgressSpinner-Dzaka7_c.js.map +0 -1
- package/dist/lib/RadioButton-eI3-vXn3.js +0 -2
- package/dist/lib/RadioButton-eI3-vXn3.js.map +0 -1
- package/dist/lib/Scrollbar-DchfiFKC.js +0 -2
- package/dist/lib/Scrollbar-DchfiFKC.js.map +0 -1
- package/dist/lib/Slider-xRxNSjFN.js +0 -2
- package/dist/lib/Slider-xRxNSjFN.js.map +0 -1
- package/dist/lib/TabButton-pZKFYg7b.js +0 -2
- package/dist/lib/Text-D1RrBY52.js +0 -2
- package/dist/lib/Text-D1RrBY52.js.map +0 -1
- package/dist/lib/Tooltip-4lU_tf6r.js +0 -3
- package/dist/lib/Tooltip-4lU_tf6r.js.map +0 -1
- package/dist/lib/VirtualRowView-Con9SWiU.js +0 -2
- package/dist/lib/VirtualScroller-BPDmO1ir.js +0 -2
package/dist/lib/overlay.es.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{l as e,n as t,o as n,t as r,u as i}from"./Position-B-WfZYAJ.js";import{_ as a,f as o,h as s,t as c,y as l}from"./Component-BR2f0Itb.js";import{t as u}from"./ListenerBag-WPdKuuds.js";import{t as d}from"./Container-3KsvsJ6S.js";import{t as f}from"./Glyph-WUqTF_Z9.js";import{t as p}from"./Panel-DIsdaqc2.js";import{a as m,t as ee}from"./Tooltip-4lU_tf6r.js";import{n as te,r as ne}from"./AnimatedDropdown-BbGCs70E.js";import{t as h}from"./Fit-CFIr4P9R.js";import{t as g}from"./Text-D1RrBY52.js";import{t as _}from"./HBox-Q8y1PHlk.js";import{a as v,d as y,f as b,g as re,l as ie,o as x,p as S}from"./LayoutSizes-BW4wyGDI.js";import{r as ae,t as oe}from"./Border-oZC_SDy8.js";import{t as C}from"./Placement-7kqdaK4Z.js";import{t as w}from"./LayoutConstraints-CHI2lhPd.js";import{n as se}from"./VBox-D5B9ecw0.js";import{t as T}from"./Button-DEUtBqK4.js";import{xmark as E}from"./glyphs/solid/xmark.es.js";import{a as ce,i as le,o as ue,r as de,t as fe}from"./DragManager-tPMnbjeO.js";import{t as pe}from"./Menu-Wz4MK6sA.js";import{circle_check as me}from"./glyphs/solid/circle_check.es.js";import{circle_info as he}from"./glyphs/solid/circle_info.es.js";import{triangle_exclamation as ge}from"./glyphs/solid/triangle_exclamation.es.js";import{circle_exclamation as _e}from"./glyphs/solid/circle_exclamation.es.js";import{t as ve}from"./MenuButton-JQQaKThJ.js";import{clock_rotate_left as ye}from"./glyphs/solid/clock_rotate_left.es.js";import{a as be,i as D,n as xe,r as Se,t as Ce}from"./LayoutSerialization-CWU0iEuV.js";var O=14,k=O/2*Math.SQRT2,A=Math.ceil(k)+2,j=6,M=5,N=120,we={insets:new t(5,5,5,5),placement:`auto`,dismissOn:`click-outside`,showArrow:!0},Popover=class extends d{_resolvedPlacement=`bottom`;_bodyComponent=null;_actionsRow=null;_anchorElement=null;_arrowComponent=null;_isOpen=!1;_scrollAncestors=[];_onWindowResize;_onScroll;constructor(e){super(e,we);let t=new se;t.setStretching(!0),this.setLayoutManager(t),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(r.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 _),this.addComponent(this._actionsRow));let n=new T(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),b(this),this.ensureArrow(),this.setVisible(!0),this.doLayout(),this._reposition(),ne(this,{durationMs:N}),this.attachRepositionListeners(),this}hide(){return this._isOpen?(this._isOpen=!1,this.detachRepositionListeners(),m.unregister(this),S(this),te(this,{durationMs:N}),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}dispose(){this._isOpen&&this.hide(),this._anchorElement=null,this._titleComponent=null,this._bodyComponent=null,this._actionsRow=null,this._arrowComponent=null}_reposition(){if(!this._anchorElement)return;let t=i.source.getElementRect(this._anchorElement);if(t.width===0&&t.height===0){this.hide();return}let n=this.getPreferredSize(),r=n?.width??this.getWidth(),a=n?.height??this.getHeight(),o=i.source.getViewportSize(),s=this.resolvePlacement(t,r,a,o);this._resolvedPlacement=s;let c=0,l=0;s===`top`?(c=t.left+(t.width-r)/2,l=t.top-a-A):s===`bottom`?(c=t.left+(t.width-r)/2,l=t.bottom+A):s===`left`?(c=t.left-r-A,l=t.top+(t.height-a)/2):(c=t.right+A,l=t.top+(t.height-a)/2);let u=M,d=o.width-r-M,f=M,p=o.height-a-M;s===`right`?u+=k:s===`left`?d-=k:s===`bottom`?f+=k:p-=k,c=e.clamp(c,u,d),l=e.clamp(l,f,p),this.setX(c),this.setY(l),this.setWidth(r),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+A,r=t+A,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+A:e===`bottom`?a>=n+A:e===`left`?o>=t+A:s>=t+A;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 e=new c,t=O;e.setBackgroundColor(`var(--ts-ui-popover-bg, rgb(255, 255, 255))`),e.setWidth(t),e.setHeight(t),e.setTransform(`rotate(45deg)`),e.setPointerEvents(`none`),e.setVisible(this._showArrow),this._arrowComponent=e;let n=this.getElement(!0);i.sink.insertBefore(n,e.getElement(!0),i.source.getFirstChild(n))}positionArrow(){if(!this._anchorElement||!this._arrowComponent)return;let e=i.source.getElementRect(this._anchorElement),t=O,n=t/2,r=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=i.source.getViewportSize(),d=this.getBorderSize();if(this._resolvedPlacement===`top`||this._resolvedPlacement===`bottom`){let i=e.left+e.width/2,a=Math.max(j,M-r+k-n),c=Math.min(o-t-j,u.width-M-r-n-k),l=clamp(i-r-n-d.left,a,c);this._arrowComponent.setX(l),this._resolvedPlacement===`bottom`?this._arrowComponent.setY(-7-d.top):this._arrowComponent.setY(s-n-d.top)}else{let r=e.top+e.height/2,i=Math.max(j,M-a+k-n),c=Math.min(s-t-j,u.height-M-a-n-k),l=clamp(r-a-n-d.top,i,c);this._arrowComponent.setY(l),this._resolvedPlacement===`right`?this._arrowComponent.setX(-7-d.left):this._arrowComponent.setX(o-n-d.left)}}attachRepositionListeners(){if(l.addViewportListener(this,`resize`,this._onWindowResize),this._anchorElement){this._scrollAncestors=this.collectScrollAncestors(this._anchorElement);for(let e of this._scrollAncestors)i.sink.addListener(e,`scroll`,this._onScroll,{passive:!0})}}detachRepositionListeners(){l.removeViewportListener(this,`resize`,this._onWindowResize);for(let e of this._scrollAncestors)i.sink.removeListener(e,`scroll`,this._onScroll);this._scrollAncestors=[]}collectScrollAncestors(e){let t=[],n=i.source.getParentElement(e);for(;n&&n!==i.source.getDocumentElement();){let e=i.source.getComputedOverflow(n),r=e.overflow+e.overflowX+e.overflowY;/(auto|scroll|overlay)/.test(r)&&t.push(n),n=i.source.getParentElement(n)}return t.push(i.source.getDocumentElement()),t}},Te=o(Popover),Ee={},DialogBackdrop=class extends c{constructor(e){super(e,Ee);let t=i.source.getViewportSize();this.setPosition(r.FIXED),this.setX(0),this.setY(0),this.setWidth(t.width),this.setHeight(t.height),this.setZIndex(10100),this.setBackgroundColor(`var(--ts-ui-dialog-backdrop-bg)`)}addClickListener(e){return l.addListener(this,`click`,e),this}resize(){let e=i.source.getViewportSize();this.setWidth(e.width),this.setHeight(e.height)}destroy(){this.removeElement(),this.destructor()}},P=o(DialogBackdrop);f.register(E,me,he,ge,_e);var F=36,I=52,L=90,De=8,R=11,z=20,B=12,Oe=320,V=160,H=80,ke=24,Ae={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,je=4,Me=8,DialogTitleBar=class extends c{_titleText;_closeButton=null;_titleGlyph=null;constructor(e,n,r){super(),this.setBackgroundColor(`var(--ts-ui-body-bg)`),this.setBorder({border:`none`,borderBottom:`1px solid var(--ts-ui-dialog-border)`}),this.setPreferredSize(0,F),this._titleText=new g(e),this._titleText.setFontWeight(`bold`),this._titleText.setOverflow(`hidden`),this._titleText.setTextOverflow(`ellipsis`),this._titleText.setWhiteSpace(`nowrap`),this._titleText.centerInHeight(F-G*2),this.addComponent(this._titleText),r&&(this._closeButton=new T({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.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(z,z),this.addComponent(this._closeButton),this._closeButton.on(`action`,n))}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(16,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.getWidth(),t=this.getHeight(),n=e-z-je,r=Math.floor((t-z)/2),i=this._closeButton?n:e-B,a=B;if(this._titleGlyph){let e=this._titleGlyph.getPreferredSize()??{width:16,height:16},n=Math.max(0,Math.floor((t-e.height)/2));this._titleGlyph.setX(B),this._titleGlyph.setY(n),this._titleGlyph.setWidth(e.width),this._titleGlyph.setHeight(e.height),a=B+e.width+Me}let o=Math.max(0,i-a-je),s=t-G*2;return this._titleText.setX(a),this._titleText.setY(G),this._titleText.setWidth(o),this._titleText.setHeight(s),this._closeButton&&(this._closeButton.setX(n),this._closeButton.setY(r),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(0,I);for(let n of e){let e=new T(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.getWidth(),t=this.getHeight()-R*2,n=this._buttons.length*L+(this._buttons.length-1)*De,r=Math.round((e-n)/2);for(let e of this._buttons)e.setX(r),e.setY(R),e.setWidth(L),e.setHeight(t),e.doLayout(),r+=98;return this}},K={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)`}},q=[{...K.Ok,primary:!0}],Ne=class Dialog extends c{_titleBar;_contentContainer;_buttonRow;_backdrop;_config;_resolvePromise=null;_previousFocus=null;_boundKeyHandler;_boundResizeHandler;constructor(e){super(),this._config=e;let n=Math.max(Oe,e.width??480),i=e.buttons??q,a=Math.max(H,this.computeContentHeight(e)),o=Math.max(V,e.height??F+a+I);this.setPosition(r.FIXED),this.setWidth(n),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 oe;if(s.setComponentSpacing(0),this.setLayoutManager(s),this._titleBar=new DialogTitleBar(e.title,()=>this.hide(`close`),e.dismissable!==!1),this.addComponent(this._titleBar,{placement:C.NORTH}),e.severity?this.applySeverityHeader(e.severity):this.applyHeaderVariant(this.computeHeaderVariant(i)),this._contentContainer=new p({autoScroll:`y`,layoutManager:new h,insets:new t(0,0,0,0)}),e.contentComponent)this._contentContainer.addComponent(e.contentComponent);else{let n=new g(e.message??``);n.setWhiteSpace(`normal`),n.setWordBreak(`break-word`),n.setPadding(new t(16,16,16,16)),this._contentContainer.addComponent(n)}this.addComponent(this._contentContainer,{placement:C.CENTER}),this._buttonRow=new DialogButtonRow(i,e=>this.hide(e)),this.addComponent(this._buttonRow,{placement:C.SOUTH}),this._backdrop=new P,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(Ae[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 e=Math.max(H,this.computeContentHeight(this._config)),t=Math.max(V,F+e+I),n=i.source.getViewportSize(),r=Math.min(t,Math.max(V,n.height-ke*2));return r===this.getHeight()?this:(this.setHeight(r),this.scheduleLayout(),this.center(),this)}open(){this._previousFocus=i.source.getActiveElement(),this._config.closeOnBackdrop&&this._config.dismissable!==!1&&this._backdrop.addClickListener(()=>this.hide(`close`)),m.register(this);let e=m.getZIndex(this);this.setZIndex(e),this._backdrop.setZIndex(e-1);let t=this._backdrop.getElement(!0);m.mount(t);let n=this.getElement(!0);m.mount(n),b(this),this.scheduleLayout(),this.center(),this.animateIn(),c.afterNextLayout(()=>this.resizeToContent()),l.addViewportListener(this,`keydown`,this._boundKeyHandler),l.addViewportListener(this,`resize`,this._boundResizeHandler),c.afterNextLayout(()=>this.focusFirst())}animateIn(){let e=this.getElement(),t=this._backdrop.getElement();e&&(s.play(e,{from:{opacity:`0`,transform:`scale(0.97)`},to:{opacity:`1`,transform:`scale(1)`},durationMs:U,properties:[`opacity`,`transform`]}),t&&s.play(t,{from:{opacity:`0`},to:{opacity:`1`},durationMs:U,properties:[`opacity`]}))}center(){let e=i.source.getViewportSize(),t=Math.max(0,Math.round((e.width-this.getWidth())/2)),n=Math.max(0,Math.round((e.height-this.getHeight())/2));this.setX(t),this.setY(n)}focusFirst(){let e=this.requestedFocusElement();if(e){i.sink.focus(e);return}let t=this._contentContainer.getElement(),n=t?i.source.querySelectorAll(t,W):[];if(n.length>0){i.sink.focus(n[0]);return}let r=this.primaryButtonElement();if(r){i.sink.focus(r);return}let a=this.getElement(),o=a?i.source.querySelectorAll(a,W):[];o.length>0&&i.sink.focus(o[0])}requestedFocusElement(){let e=this._config.initialFocus?.getElement();return e?i.source.matches(e,W)?e:i.source.querySelector(e,W):null}primaryButtonElement(){let e=(this._config.buttons??q).findIndex(e=>e.primary);if(e<0)return null;let t=this._buttonRow.getElement();return(t?i.source.querySelectorAll(t,W):[])[e]??null}getFocusable(){let e=this.getElement();return e?i.source.querySelectorAll(e,W).filter(e=>!i.source.hasAttribute(e,`disabled`)):[]}onKeyDown(e){if(e.key===`Enter`){this.onEnter(e);return}if(e.key===`Tab`){let t=this.getFocusable();if(t.length===0){e.preventDefault();return}let n=t[0],r=t[t.length-1];e.shiftKey?i.source.getActiveElement()===n&&(e.preventDefault(),i.sink.focus(r)):i.source.getActiveElement()===r&&(e.preventDefault(),i.sink.focus(n))}}onEnter(e){let t=i.source.getActiveElement(),n=t?i.source.getTagName(t).toLowerCase():null;if(n===`textarea`||n===`button`)return;let r=this.primaryResult();r!==null&&(e.preventDefault(),this.hide(r))}primaryResult(){let e=(this._config.buttons??q).find(e=>e.primary);return e?e.result??`cancel`:null}onViewportResize(){this._backdrop.resize(),this.resizeToContent(),this.center()}hide(e){l.removeViewportListener(this,`keydown`,this._boundKeyHandler),l.removeViewportListener(this,`resize`,this._boundResizeHandler);let finalize=()=>{this._backdrop.destroy(),this.removeElement(),this.destructor(),m.unregister(this),S(this),this._previousFocus!==null&&i.sink.focus(this._previousFocus),this._resolvePromise&&=(this._resolvePromise(e),null)},t=this.getElement(),n=this._backdrop.getElement();return t?(s.play(t,{to:{opacity:`0`,transform:`scale(0.97)`},durationMs:U,properties:[`opacity`,`transform`],onComplete:finalize}),n&&s.play(n,{to:{opacity:`0`},durationMs:U,properties:[`opacity`]}),this):(finalize(),this)}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:[{...K.Cancel,primary:!0},K.Confirm]})===`confirm`}static async alert(e,t,n){await Dialog.show({title:t,message:n,severity:e,buttons:[{...K.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=o(Ne);f.register(he,me,ge,_e,E);var J={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,Y=class Notification extends c{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=e=>{e.stopPropagation(),this.dismiss()};_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 i=n===`error`||n===`warning`;this.getAria().setRole(i?`alert`:`status`),this.getAria().setLive(i?`assertive`:`polite`);let a=`var(--ts-ui-notification-${n}-bg)`,o=`var(--ts-ui-notification-${n}-border)`;this.setBackgroundColor(a),this.setBorder({border:`1px solid ${o}`}),this.setShadow(`var(--ts-ui-notification-shadow)`),this.setBorderRadius(`var(--ts-ui-border-radius, 4px)`),this._badge=new f(J[n]),this._badge.setForegroundColor(o),this._badge.setPreferredSize(Notification.BADGE_SIZE,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 T({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(Notification.CLOSE_SIZE,Notification.CLOSE_SIZE),this._closeButton.getAria().setLabel(`Dismiss notification`),this.addComponent(this._closeButton),this._closeButton.on(`action`,this._boundOnCloseAction),l.addSubtreeListener(this,`dblclick`,this._boundOnDblClick),l.addSubtreeListener(this,`mouseover`,this._boundOnMouseOver),l.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&&s.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(e,t){if(t&&i.source.isNode(e.relatedTarget)&&i.source.contains(t,i.source.intern(e.relatedTarget)))return;let n=Notification.isPaused();Notification.hoverCount+=1,n||Notification.pauseAllTimers()}static releaseHoverHold(e,t){t&&i.source.isNode(e.relatedTarget)&&i.source.contains(t,i.source.intern(e.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,n){Notification.pauseAll();let r=new g(e);r.setAutoMeasure(!1),r.setWhiteSpace(`pre-wrap`),r.setWordBreak(`break-word`),r.setPadding(new t(16,16,16,16));let i=new Ne({title:Fe[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(J[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}s.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.removeElement(),Notification.restack()}static restack(){let e=i.source.getViewportSize(),t=e.width-Notification.WIDTH-Notification.MARGIN,n=e.height-Notification.MARGIN;for(let e=Notification.activeNotifications.length-1;e>=0;e--){let r=Notification.activeNotifications[e];n-=Notification.HEIGHT,r.setX(t),r.setY(n),n-=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}};f.register(ye);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=Y.getHistory();if(e.length===0)return[{text:`No notifications yet`,enabled:!1}];let t=Date.now();return e.map(e=>({glyph:J[e.type],glyphColor:`var(--ts-ui-notification-${e.type}-border)`,text:e.message,shortcut:formatRelativeTime(e.timestamp,t),action:()=>Y.showDetail(e.message,e.type)}))}var NotificationHistoryButton=class extends ve{constructor(e){super(void 0,e,{glyph:`clock-rotate-left`,menuItems:buildHistoryItems,scrollToBottomOnShow:!0}),this.getAria().setLabel(`Notification history`),this.applyListeners(e?.listeners)}},He=o(NotificationHistoryButton),Ue={edge:C.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{_open=!1;_closing=!1;_backdrop=null;_listeners=new u;_boundResizeHandler=()=>this.onViewportResize();_boundBackdropClose=()=>{this.close()};constructor(e,t){super(e,{...Ue,...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;m.register(this);let e=m.getZIndex(this);return this.setZIndex(e),this.isModal()&&this.openBackdrop(e-1),this.applyEdgeBorder(),this.applyRestingGeometry(),i.sink.appendChild(i.source.getDocumentElement(),this.getElement(!0)),b(this),this.scheduleLayout(),this.animateIn(),l.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,l.removeViewportListener(this,`resize`,this._boundResizeHandler),this.animateOutAndFinalize(),this)}toggle(){return this._open?this.close():this.open()}isOpen(){return this._open}restingRect(){let e=i.source.getViewportSize(),t=this.getDrawerSize();switch(this.getEdge()){case C.EAST:return{x:e.width-t,y:0,width:t,height:e.height};case C.NORTH:return{x:0,y:0,width:e.width,height:t};case C.SOUTH:return{x:0,y:e.height-t,width:e.width,height:t};case C.WEST:default:return{x:0,y:0,width:t,height:e.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 C.EAST:return`translateX(${e}px)`;case C.NORTH:return`translateY(${-e}px)`;case C.SOUTH:return`translateY(${e}px)`;case C.WEST:default:return`translateX(${-e}px)`}}applyEdgeBorder(){let e=`1px solid var(--ts-ui-drawer-border)`;switch(this.getEdge()){case C.EAST:this.setBorder({border:`none`,borderLeft:e});break;case C.NORTH:this.setBorder({border:`none`,borderBottom:e});break;case C.SOUTH:this.setBorder({border:`none`,borderTop:e});break;case C.WEST:default:this.setBorder({border:`none`,borderRight:e});break}}animateIn(){let e=this.getElement();e&&s.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),S(this),this._open=!1,this._closing=!1,this.emit(`close`)};if(!e){finalize();return}s.play(e,{to:{transform:this.offscreenTransform()},durationMs:this.getDurationMs(),properties:[`transform`],onComplete:finalize}),this.fadeBackdropOut()}openBackdrop(e){this._backdrop=new P,this._backdrop.setZIndex(e),this._backdrop.addClickListener(this._boundBackdropClose);let t=this._backdrop.getElement(!0);i.sink.appendChild(i.source.getDocumentElement(),t),s.play(t,{from:{opacity:`0`},to:{opacity:`1`},durationMs:this.getDurationMs(),properties:[`opacity`]})}fadeBackdropOut(){let e=this._backdrop?.getElement();e&&s.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)}},We=o(Drawer),RailHandle=class extends T{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(e){this._options.selected=e,this.getAria().setPressed(e);let t=this.getElement();return t&&i.sink.apply(t,{toggleClass:{selected:e}}),this}render(){let e=super.render();return i.sink.apply(e,{toggleClass:{selected:this.isSelected()}}),e}},X=o(RailHandle),Z=48,Ge=8900,Q=200,Ke=10,qe=5;function collapseHeadingFor(e){switch(e){case C.EAST:return`east`;case C.NORTH:return`north`;case C.SOUTH:return`south`;case C.WEST:default:return`west`}}var $={west:`east`,east:`west`,north:`south`,south:`north`},Je={edge:C.WEST,orientation:`horizontal`,backgroundColor:`var(--ts-ui-rail-bg)`,shadow:`var(--ts-ui-rail-shadow)`},Rail=class extends c{_listeners=new u;_drawers=new Map;_windows=new Map;_mounted=!1;_collapseButton;_expandedThickness=Z;_boundResizeHandler=()=>this.applyRestingGeometry();constructor(e,t){super(e,{...Je,...t??{}}),this.setPosition(r.FIXED),this.setZIndex(Ge),this._collapseButton=new ae({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 Z;let t=this.isVertical()?e.width:e.height;return t<=0||n(t)?Z: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-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 C.EAST:t=r,n=`50%`;break;case C.NORTH:t=`50%`,n=e;break;case C.SOUTH:t=`50%`,n=r;break;case C.WEST:default:t=e,n=`50%`;break}}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?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);s.play(n,{from:a.from,to:a.to,durationMs:Q,properties:a.properties,onComplete:finalize})}collapseTween(e,t){let n=i.source.getViewportSize(),r={},a={};return this.isVertical()?(r.width=e+`px`,a.width=t+`px`,this.getEdge()===C.EAST&&(r.left=n.width-e+`px`,a.left=n.width-t+`px`)):(r.height=e+`px`,a.height=t+`px`,this.getEdge()===C.SOUTH&&(r.top=n.height-e+`px`,a.top=n.height-t+`px`)),{from:r,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 se:new _),this.applyEdgeBorder(),this.applyRestingGeometry();let e=this.getElement(!0);i.sink.appendChild(i.source.getDocumentElement(),e);let t=this._collapseButton.getElement(!0);return t&&i.source.getParentElement(t)!==e&&i.sink.appendChild(e,t),this.applyCollapseAppearance(),this.scheduleLayout(),l.addViewportListener(this,`resize`,this._boundResizeHandler),this._mounted=!0,this.animateIn(),this}unmount(){if(!this._mounted)return this;l.removeViewportListener(this,`resize`,this._boundResizeHandler),this._mounted=!1;let e=this.getElement(),detach=()=>{this.removeElement()};return e?(s.play(e,{to:{transform:this.offscreenTransform()},durationMs:Q,properties:[`transform`],onComplete:detach}),this):(detach(),this)}animateIn(){let e=this.getElement();e&&s.play(e,{from:{transform:this.offscreenTransform()},to:{transform:`translate(0, 0)`},durationMs:Q,properties:[`transform`]})}offscreenTransform(){switch(this.getEdge()){case C.EAST:return`translateX(100%)`;case C.NORTH:return`translateY(-100%)`;case C.SOUTH:return`translateY(100%)`;case C.WEST:default:return`translateX(-100%)`}}registerDrawer(e,t={}){if(this._drawers.has(e))return this;let n=new X({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 X({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===C.WEST||e===C.EAST}restingRect(){let e=i.source.getViewportSize(),t=this.getThickness();switch(this.getEdge()){case C.EAST:return{x:e.width-t,y:0,width:t,height:e.height};case C.NORTH:return{x:0,y:0,width:e.width,height:t};case C.SOUTH:return{x:0,y:e.height-t,width:e.width,height:t};case C.WEST:default:return{x:0,y:0,width:t,height:e.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 C.EAST:this.setBorder({border:e,borderLeft:t});break;case C.NORTH:this.setBorder({border:e,borderBottom:t});break;case C.SOUTH:this.setBorder({border:e,borderTop:t});break;case C.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)}},Ye=o(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 D;_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(){fe.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=de.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 xe(this.getRootRegion())}setLayoutState(e){return this._frameRegion.clear(),Ce(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 x;e.setBarVisible(!1),n=new d({id:t.id,name:t.title,layoutManager:e}),e.addLazyTab(r,t.title??t.id)}else{n=new d({id:t.id,name:t.title,layoutManager:new h});let e=typeof t.content==`function`?t.content():t.content;n.addComponent(e)}this._frames.set(e,n)}return n}leafConstraints(e){let t=new w;return t.closeable=e.closeable??!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 x({reorderable:!0,compact:!0})})}compileLayout(e){if(`split`in e){let t=new d({layoutManager:new be({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,i.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 x&&n.closeTab(e)||t?.removeComponent(e)),this.rootTab()?.setBarVisible(!0)}rootTab(){let e=this.getRootRegion()?.getLayoutManager();return e instanceof x?e:null}placeholderConstraints(){let e=new w;return e.closeable=!1,e.transient=!0,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(y.getOpenWindows());for(let t of this._floatSubscribed)e.has(t)||this._floatSubscribed.delete(t)}floatWindowsHoldingFrames(){let e=[...this._frames.values()];return y.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 y.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 Se(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.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){y.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)};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(e){i.sink.requestAnimationFrame(()=>this.recomputeFocusAfterClose(e))}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)}},Xe=o(Dock);export{y as AbstractWindow,re as ButtonGroup,Pe as Dialog,K as DialogButtons,DialogTitleBar,Xe as Dock,ue as DragFeedback,ce as DragGhost,fe as DragManager,We as Drawer,D as DropZoneOverlay,pe as Menu,Y as Notification,He as NotificationHistoryButton,Te as Popover,Ye as Rail,X as RailHandle,le as ReorderIndicator,v as TabWindow,ee as Tooltip,ie as Window};
|
|
1
|
+
import{t as e}from"./DOM-CGn7xyTw.js";import{l as t,n,o as r,t as i}from"./Position-A39T7-_1.js";import{_ as a,f as o,h as s,t as c,y as l}from"./Component-DXf5a3g0.js";import{t as u}from"./ListenerBag-WPdKuuds.js";import{t as d}from"./Container-D5H8VxJK.js";import{t as f}from"./Glyph-KEf4nIv2.js";import{t as p}from"./Panel-DzWdYwq1.js";import{a as m,t as ee}from"./Tooltip-tkXDk5Bo.js";import{n as te,r as ne}from"./AnimatedDropdown-CZQEqQi-.js";import{t as h}from"./Fit-DjRsiwlg.js";import{t as g}from"./Text-gz6qjFfP.js";import{t as re}from"./BoxLayout-DrKGfsup.js";import{t as ie}from"./HBox-Ce0GTCJP.js";import{a as _,d as v,f as y,g as ae,l as oe,o as b,p as x}from"./LayoutSizes-DU3qSq0w.js";import{r as se,t as ce}from"./Border-BgaZkc1R.js";import{t as S}from"./Placement-7kqdaK4Z.js";import{t as le}from"./LayoutConstraints-DkctJZXB.js";import{n as C}from"./VBox-EIqw85Rh.js";import{t as w}from"./Button-U1rsP4v8.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-CI4mZQFy.js";import{t as me}from"./Menu-Dz4L7EKJ.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-VJ5uC3c1.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-BT66TY83.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){super(e,Ce);let t=new C;t.setStretching(!0),this.setLayoutManager(t),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 ie),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(l.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(){l.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=o(Popover),Te={},DialogBackdrop=class extends c{constructor(t){super(t,Te);let n=e.source.getViewportSize();this.setPosition(i.FIXED),this.setX(0),this.setY(0),this.setWidth(n.width),this.setHeight(n.height),this.setZIndex(10100),this.setBackgroundColor(`var(--ts-ui-dialog-backdrop-bg)`)}addClickListener(e){return l.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=o(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.getWidth(),t=this.getHeight(),n=e-z-K,r=Math.floor((t-z)/2),i=this._closeButton?n:e-B,a=B;if(this._titleGlyph){let e=this._titleGlyph.getPreferredSize()??{width:16,height:16},n=Math.max(0,Math.floor((t-e.height)/2));this._titleGlyph.setX(B),this._titleGlyph.setY(n),this._titleGlyph.setWidth(e.width),this._titleGlyph.setHeight(e.height),a=B+e.width+Me}let o=Math.max(0,i-a-K),s=t-G*2;return this._titleText.setX(a),this._titleText.setY(G),this._titleText.setWidth(o),this._titleText.setHeight(s),this._closeButton&&(this._closeButton.setX(n),this._closeButton.setY(r),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.getWidth(),t=this.getHeight()-Oe*2,n=this._buttons.length*Ee+(this._buttons.length-1)*De,r=Math.round((e-n)/2);for(let e of this._buttons)e.setX(r),e.setY(Oe),e.setWidth(Ee),e.setHeight(t),e.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 ce;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()),l.addViewportListener(this,`keydown`,this._boundKeyHandler),l.addViewportListener(this,`resize`,this._boundResizeHandler),c.afterNextLayout(()=>this.focusFirst())}animateIn(){let e=this.getElement(),t=this._backdrop.getElement();e&&(this._panelInAnimation?.cancel(),this._panelInAnimation=s.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=s.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){l.removeViewportListener(this,`keydown`,this._boundKeyHandler),l.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=s.play(n,{to:{opacity:`0`,transform:`scale(0.97)`},durationMs:U,properties:[`opacity`,`transform`],onComplete:finalize}),r&&(this._backdropOutAnimation?.cancel(),this._backdropOutAnimation=s.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=o(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 a=`var(--ts-ui-notification-${t}-bg)`,o=`var(--ts-ui-notification-${t}-border)`;this.setBackgroundColor(a),this.setBorder({border:`1px solid ${o}`}),this.setShadow(`var(--ts-ui-notification-shadow)`),this.setBorderRadius(`var(--ts-ui-border-radius, 4px)`),this._badge=new f(Y[t]),this._badge.setForegroundColor(o),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),l.addSubtreeListener(this,`dblclick`,this._boundOnDblClick),l.addSubtreeListener(this,`mouseover`,this._boundOnMouseOver),l.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=s.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=s.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.removeElement(),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=o(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(),l.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,l.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=s.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=s.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=s.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=s.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=o(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=o(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 se({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 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?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=s.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 C:new ie),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(),l.addViewportListener(this,`resize`,this._boundResizeHandler),this._mounted=!0,this.animateIn(),this}unmount(){if(!this._mounted)return this;l.removeViewportListener(this,`resize`,this._boundResizeHandler),this._mounted=!1;let e=this.getElement(),detach=()=>{this.removeElement()};return e?(this._slideOutAnimation?.cancel(),this._slideOutAnimation=s.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=s.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,super.destructor()}},Xe=o(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 le;return t.closeable=e.closeable??!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 le;return e.closeable=!1,e.transient=!0,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)}},Ze=o(Dock);export{v as AbstractWindow,ae 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,oe as Window};
|
|
2
2
|
//# sourceMappingURL=overlay.es.js.map
|