dockview 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/api/component.api.d.ts +3 -1
- package/dist/cjs/api/component.api.js +14 -0
- package/dist/cjs/api/component.api.js.map +1 -1
- package/dist/cjs/paneview/draggablePaneviewPanel.js +1 -1
- package/dist/cjs/paneview/draggablePaneviewPanel.js.map +1 -1
- package/dist/cjs/paneview/paneviewComponent.d.ts +4 -2
- package/dist/cjs/paneview/paneviewComponent.js +10 -16
- package/dist/cjs/paneview/paneviewComponent.js.map +1 -1
- package/dist/cjs/paneview/paneviewPanel.d.ts +5 -1
- package/dist/cjs/paneview/paneviewPanel.js +13 -1
- package/dist/cjs/paneview/paneviewPanel.js.map +1 -1
- package/dist/cjs/splitview/core/splitview.js +1 -1
- package/dist/cjs/splitview/core/splitview.js.map +1 -1
- package/dist/cjs/splitview/splitviewComponent.d.ts +9 -3
- package/dist/cjs/splitview/splitviewComponent.js +10 -0
- package/dist/cjs/splitview/splitviewComponent.js.map +1 -1
- package/dist/dockview.amd.js +38 -14
- package/dist/dockview.amd.min.js +3 -3
- package/dist/dockview.amd.min.noStyle.js +3 -3
- package/dist/dockview.amd.noStyle.js +37 -13
- package/dist/dockview.cjs.js +38 -14
- package/dist/dockview.esm.js +38 -14
- package/dist/dockview.esm.min.js +3 -3
- package/dist/dockview.js +38 -14
- package/dist/dockview.min.js +3 -3
- package/dist/dockview.min.noStyle.js +3 -3
- package/dist/dockview.noStyle.js +37 -13
- package/dist/esm/api/component.api.d.ts +3 -1
- package/dist/esm/api/component.api.js +6 -0
- package/dist/esm/paneview/draggablePaneviewPanel.js +1 -1
- package/dist/esm/paneview/paneviewComponent.d.ts +4 -2
- package/dist/esm/paneview/paneviewComponent.js +10 -8
- package/dist/esm/paneview/paneviewPanel.d.ts +5 -1
- package/dist/esm/paneview/paneviewPanel.js +9 -1
- package/dist/esm/splitview/core/splitview.js +1 -1
- package/dist/esm/splitview/splitviewComponent.d.ts +9 -3
- package/dist/esm/splitview/splitviewComponent.js +9 -1
- package/dist/styles/dockview.css +45 -45
- package/package.json +2 -2
package/dist/dockview.min.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview
|
|
3
|
-
* @version 1.0.
|
|
3
|
+
* @version 1.0.3
|
|
4
4
|
* @link https://github.com/mathuo/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).dockview={},e.React,e.ReactDOM)}(this,(function(e,t,i){"use strict";function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(i){if("default"!==i){var n=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,n.get?n:{enumerable:!0,get:function(){return e[i]}})}})),t.default=e,Object.freeze(t)}var s=n(t),o=n(i);!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===i&&n.firstChild?n.insertBefore(s,n.firstChild):n.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}('.dockview-theme-dark {\n --dv-paneview-active-outline-color: dodgerblue;\n --dv-tabs-and-actions-container-font-size: 13px;\n --dv-tabs-and-actions-container-height: 35px;\n --dv-tab-close-icon: url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>\');\n --dv-tab-dirty-icon: url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z"/></svg>\');\n --dv-drag-over-background-color: rgba(83, 89, 93, 0.5);\n --dv-drag-over-border-color: white;\n --dv-tabs-container-scrollbar-color: #888;\n --dv-group-view-background-color: #1e1e1e;\n --dv-tabs-and-actions-container-background-color: #252526;\n --dv-activegroup-visiblepanel-tab-background-color: #1e1e1e;\n --dv-activegroup-hiddenpanel-tab-background-color: #2d2d2d;\n --dv-inactivegroup-visiblepanel-tab-background-color: #1e1e1e;\n --dv-inactivegroup-hiddenpanel-tab-background-color: #2d2d2d;\n --dv-tab-divider-color: #1e1e1e;\n --dv-activegroup-visiblepanel-tab-color: white;\n --dv-activegroup-hiddenpanel-tab-color: #969696;\n --dv-inactivegroup-visiblepanel-tab-color: #8f8f8f;\n --dv-inactivegroup-hiddenpanel-tab-color: #626262;\n --dv-separator-border: rgb(68, 68, 68);\n --dv-paneview-header-border-color: rgba(204, 204, 204, 0.2);\n}\n\n.dockview-theme-light {\n --dv-paneview-active-outline-color: dodgerblue;\n --dv-tabs-and-actions-container-font-size: 13px;\n --dv-tabs-and-actions-container-height: 35px;\n --dv-tab-close-icon: url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>\');\n --dv-tab-dirty-icon: url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z"/></svg>\');\n --dv-drag-over-background-color: rgba(83, 89, 93, 0.5);\n --dv-drag-over-border-color: white;\n --dv-tabs-container-scrollbar-color: #888;\n --dv-group-view-background-color: white;\n --dv-tabs-and-actions-container-background-color: #f3f3f3;\n --dv-activegroup-visiblepanel-tab-background-color: white;\n --dv-activegroup-hiddenpanel-tab-background-color: #ececec;\n --dv-inactivegroup-visiblepanel-tab-background-color: white;\n --dv-inactivegroup-hiddenpanel-tab-background-color: #ececec;\n --dv-tab-divider-color: white;\n --dv-activegroup-visiblepanel-tab-color: rgb(51, 51, 51);\n --dv-activegroup-hiddenpanel-tab-color: rgba(51, 51, 51, 0.7);\n --dv-inactivegroup-visiblepanel-tab-color: rgba(51, 51, 51, 0.7);\n --dv-inactivegroup-hiddenpanel-tab-color: rgba(51, 51, 51, 0.35);\n --dv-separator-border: rgba(128, 128, 128, 0.35);\n --dv-paneview-header-border-color: rgb(51, 51, 51);\n}\n\n.dockview-theme-vs {\n --dv-paneview-active-outline-color: dodgerblue;\n --dv-tabs-and-actions-container-font-size: 13px;\n --dv-tabs-and-actions-container-height: 35px;\n --dv-tab-close-icon: url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>\');\n --dv-tab-dirty-icon: url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z"/></svg>\');\n --dv-drag-over-background-color: rgba(83, 89, 93, 0.5);\n --dv-drag-over-border-color: white;\n --dv-tabs-container-scrollbar-color: #888;\n --dv-group-view-background-color: #1e1e1e;\n --dv-tabs-and-actions-container-background-color: #252526;\n --dv-activegroup-visiblepanel-tab-background-color: #1e1e1e;\n --dv-activegroup-hiddenpanel-tab-background-color: #2d2d2d;\n --dv-inactivegroup-visiblepanel-tab-background-color: #1e1e1e;\n --dv-inactivegroup-hiddenpanel-tab-background-color: #2d2d2d;\n --dv-tab-divider-color: #1e1e1e;\n --dv-activegroup-visiblepanel-tab-color: white;\n --dv-activegroup-hiddenpanel-tab-color: #969696;\n --dv-inactivegroup-visiblepanel-tab-color: #8f8f8f;\n --dv-inactivegroup-hiddenpanel-tab-color: #626262;\n --dv-separator-border: rgb(68, 68, 68);\n --dv-paneview-header-border-color: rgba(204, 204, 204, 0.2);\n --dv-activegroup-visiblepanel-tab-background-color: dodgerblue;\n --dv-tabs-and-actions-container-height: 18px;\n --dv-tabs-and-actions-container-font-size: 11px;\n}\n.dockview-theme-vs .groupview.active-group > .tabs-and-actions-container {\n border-bottom: 2px solid var(--dv-activegroup-visiblepanel-tab-background-color);\n}\n.dockview-theme-vs .groupview.inactive-group > .tabs-and-actions-container {\n border-bottom: 2px solid var(--dv-inactivegroup-visiblepanel-tab-background-color);\n}\n.actions-bar {\n text-align: right;\n width: 28px;\n display: flex;\n align-items: center;\n flex-shrink: 0;\n}\n.actions-bar .actions-container {\n display: flex;\n padding: 0px;\n margin: 0px;\n justify-content: flex-end;\n}\n.actions-bar .actions-container a:active {\n -webkit-mask-size: 100% 100% !important;\n mask-size: 100% 100% !important;\n}\n.actions-bar .actions-container .close-action {\n background-color: white;\n height: 16px;\n width: 16px;\n display: block;\n -webkit-mask: var(--dv-tab-close-icon) 50% 50%/90% 90% no-repeat;\n mask: var(--dv-tab-close-icon) 50% 50%/90% 90% no-repeat;\n margin-right: "0.5em";\n cursor: pointer;\n}\n.custom-dragging {\n height: 24px;\n line-height: 24px;\n font-size: 11px;\n width: 100px;\n background-color: dodgerblue;\n color: ghostwhite;\n border-radius: 11px;\n position: absolute;\n padding-left: 10px;\n}\n\n.groupview.active-group > .tabs-and-actions-container > .tabs-container > .tab.active-tab {\n background-color: var(--dv-activegroup-visiblepanel-tab-background-color);\n color: var(--dv-activegroup-visiblepanel-tab-color);\n}\n.groupview.active-group > .tabs-and-actions-container > .tabs-container > .tab.active-tab .tab-action {\n background-color: var(--dv-activegroup-visiblepanel-tab-color);\n}\n.groupview.active-group > .tabs-and-actions-container > .tabs-container > .tab.inactive-tab {\n background-color: var(--dv-activegroup-hiddenpanel-tab-background-color);\n color: var(--dv-activegroup-hiddenpanel-tab-color);\n}\n.groupview.active-group > .tabs-and-actions-container > .tabs-container > .tab.inactive-tab .tab-action {\n background-color: var(--dv-activegroup-hiddenpanel-tab-color);\n}\n.groupview.inactive-group > .tabs-and-actions-container > .tabs-container > .tab.active-tab {\n background-color: var(--dv-inactivegroup-visiblepanel-tab-background-color);\n color: var(--dv-inactivegroup-visiblepanel-tab-color);\n}\n.groupview.inactive-group > .tabs-and-actions-container > .tabs-container > .tab.active-tab .tab-action {\n background-color: var(--dv-inactivegroup-visiblepanel-tab-color);\n}\n.groupview.inactive-group > .tabs-and-actions-container > .tabs-container > .tab.inactive-tab {\n background-color: var(--dv-inactivegroup-hiddenpanel-tab-background-color);\n color: var(--dv-inactivegroup-hiddenpanel-tab-color);\n}\n.groupview.inactive-group > .tabs-and-actions-container > .tabs-container > .tab.inactive-tab .tab-action {\n background-color: var(--dv-inactivegroup-hiddenpanel-tab-color);\n}\n\n/**\n * when a tab is dragged we lose the above stylings because they are conditional on parent elements\n * therefore we also set some stylings for the dragging event\n **/\n.tab.dragging {\n background-color: var(--dv-activegroup-visiblepanel-tab-background-color);\n color: var(--dv-activegroup-visiblepanel-tab-color);\n}\n.drop-target {\n position: relative;\n}\n.drop-target > .drop-target-dropzone {\n position: absolute;\n left: 0px;\n top: 0px;\n height: 100%;\n width: 100%;\n z-index: 10000;\n}\n.drop-target > .drop-target-dropzone > .drop-target-selection {\n position: relative;\n pointer-events: none;\n box-sizing: border-box;\n height: 100%;\n width: 100%;\n background-color: var(--dv-drag-over-background-color);\n transition-duration: 0.15s;\n transition-timing-function: ease-out;\n}\n.drop-target > .drop-target-dropzone > .drop-target-selection.left, .drop-target > .drop-target-dropzone > .drop-target-selection.right {\n width: 50%;\n}\n.drop-target > .drop-target-dropzone > .drop-target-selection.right {\n transform: translate(100%, 0%);\n}\n.drop-target > .drop-target-dropzone > .drop-target-selection.bottom {\n transform: translate(0%, 100%);\n}\n.drop-target > .drop-target-dropzone > .drop-target-selection.top, .drop-target > .drop-target-dropzone > .drop-target-selection.bottom {\n height: 50%;\n}\n.drop-target > .drop-target-dropzone > .drop-target-selection.small-top {\n border-top: 1px solid var(--dv-drag-over-border-color);\n}\n.drop-target > .drop-target-dropzone > .drop-target-selection.small-bottom {\n border-bottom: 1px solid var(--dv-drag-over-border-color);\n}\n.drop-target > .drop-target-dropzone > .drop-target-selection.small-left {\n border-left: 1px solid var(--dv-drag-over-border-color);\n}\n.drop-target > .drop-target-dropzone > .drop-target-selection.small-right {\n border-right: 1px solid var(--dv-drag-over-border-color);\n}\n.grid-view,\n.branch-node {\n height: 100%;\n width: 100%;\n}\n.groupview {\n display: flex;\n flex-direction: column;\n height: 100%;\n background-color: var(--dv-group-view-background-color);\n overflow: hidden;\n}\n.groupview:focus {\n outline: none;\n}\n.groupview.empty > .tabs-and-actions-container {\n display: none;\n}\n.groupview > .content-container {\n flex-grow: 1;\n overflow: hidden;\n outline: none;\n}\n.pane-container {\n height: 100%;\n width: 100%;\n}\n.pane-container.animated .view {\n transition-duration: 0.15s;\n transition-timing-function: ease-out;\n}\n.pane-container .view {\n overflow: hidden;\n display: flex;\n flex-direction: column;\n padding: 0px !important;\n}\n.pane-container .view:not(:first-child)::before {\n background-color: transparent !important;\n}\n.pane-container .view:not(:first-child) .pane > .pane-header {\n border-top: 1px solid var(--dv-paneview-header-border-color);\n}\n.pane-container .view .default-header {\n background-color: var(--dv-group-view-background-color);\n color: var(--dv-activegroup-visiblepanel-tab-color);\n display: flex;\n padding: 0px 8px;\n}\n.pane-container .view .default-header > span {\n flex-grow: 1;\n}\n.pane-container:first-of-type > .pane > .pane-header {\n border-top: none !important;\n}\n.pane-container .pane {\n display: flex;\n flex-direction: column;\n overflow: hidden;\n height: 100%;\n}\n.pane-container .pane .pane-header {\n box-sizing: border-box;\n user-select: none;\n position: relative;\n outline: none;\n}\n.pane-container .pane .pane-header.pane-draggable {\n cursor: pointer;\n}\n.pane-container .pane .pane-header:focus:before, .pane-container .pane .pane-header:focus-within:before {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 5;\n content: "";\n pointer-events: none;\n outline: 1px solid;\n outline-width: -1px;\n outline-style: solid;\n outline-offset: -1px;\n outline-color: var(--dv-paneview-active-outline-color);\n}\n.pane-container .pane .pane-body {\n overflow-y: auto;\n overflow-x: hidden;\n flex-grow: 1;\n position: relative;\n outline: none;\n}\n.pane-container .pane .pane-body:focus:before, .pane-container .pane .pane-body:focus-within:before {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 5;\n content: "";\n pointer-events: none;\n outline: 1px solid;\n outline-width: -1px;\n outline-style: solid;\n outline-offset: -1px;\n outline-color: var(--dv-paneview-active-outline-color);\n}\n.tabs-and-actions-container {\n display: flex;\n background-color: var(--dv-tabs-and-actions-container-background-color);\n flex-shrink: 0;\n box-sizing: border-box;\n height: var(--dv-tabs-and-actions-container-height);\n font-size: var(--dv-tabs-and-actions-container-font-size);\n}\n.tabs-and-actions-container.hidden {\n display: none;\n}\n.tabs-and-actions-container .void-container {\n display: flex;\n flex-grow: 1;\n}\n.tabs-and-actions-container .tabs-container {\n display: flex;\n overflow-x: overlay;\n overflow-y: hidden;\n scrollbar-width: thin;\n /* Track */\n /* Handle */\n}\n.tabs-and-actions-container .tabs-container::-webkit-scrollbar {\n height: 3px;\n}\n.tabs-and-actions-container .tabs-container::-webkit-scrollbar-track {\n background: transparent;\n}\n.tabs-and-actions-container .tabs-container::-webkit-scrollbar-thumb {\n background: var(--dv-tabs-container-scrollbar-color);\n}\n.tabs-and-actions-container .tabs-container .tab {\n -webkit-user-drag: element;\n outline: none;\n min-width: 75px;\n cursor: pointer;\n position: relative;\n box-sizing: border-box;\n}\n.tabs-and-actions-container .tabs-container .tab:not(:first-child)::before {\n content: " ";\n position: absolute;\n top: 0;\n left: 0;\n z-index: 5;\n pointer-events: none;\n background-color: var(--dv-tab-divider-color);\n width: 1px;\n height: 100%;\n}\n.split-view-container {\n position: relative;\n overflow: hidden;\n height: 100%;\n width: 100%;\n}\n.split-view-container.animation .view,\n.split-view-container.animation .sash {\n transition-duration: 0.15s;\n transition-timing-function: ease-out;\n}\n.split-view-container.horizontal {\n height: 100%;\n}\n.split-view-container.horizontal > .sash-container > .sash {\n height: 100%;\n width: 4px;\n}\n.split-view-container.horizontal > .sash-container > .sash.enabled {\n cursor: ew-resize;\n}\n.split-view-container.horizontal > .sash-container > .sash.disabled {\n cursor: default;\n}\n.split-view-container.horizontal > .sash-container > .sash.maximum {\n cursor: w-resize;\n}\n.split-view-container.horizontal > .sash-container > .sash.minimum {\n cursor: e-resize;\n}\n.split-view-container.horizontal > .view-container > .view:not(:first-child)::before {\n height: 100%;\n width: 1px;\n}\n.split-view-container.vertical {\n width: 100%;\n}\n.split-view-container.vertical > .sash-container > .sash {\n width: 100%;\n height: 4px;\n}\n.split-view-container.vertical > .sash-container > .sash.enabled {\n cursor: ns-resize;\n}\n.split-view-container.vertical > .sash-container > .sash.disabled {\n cursor: default;\n}\n.split-view-container.vertical > .sash-container > .sash.maximum {\n cursor: n-resize;\n}\n.split-view-container.vertical > .sash-container > .sash.minimum {\n cursor: s-resize;\n}\n.split-view-container.vertical > .view-container > .view {\n width: 100%;\n}\n.split-view-container.vertical > .view-container > .view:not(:first-child)::before {\n height: 1px;\n width: 100%;\n}\n.split-view-container .sash-container {\n height: 100%;\n width: 100%;\n position: absolute;\n}\n.split-view-container .sash-container .sash {\n position: absolute;\n z-index: 99;\n outline: none;\n}\n.split-view-container .sash-container .sash:active {\n transition: background-color 0.1s ease-in-out;\n background-color: var(--dv-active-sash-color, transparent);\n}\n.split-view-container .sash-container .sash:hover {\n background-color: var(--dv-active-sash-color, transparent);\n transition: background-color 0.1s ease-in-out;\n transition-delay: 0.5s;\n}\n.split-view-container .view-container {\n position: relative;\n height: 100%;\n width: 100%;\n}\n.split-view-container .view-container .view {\n height: 100%;\n box-sizing: border-box;\n overflow: auto;\n position: absolute;\n}\n.split-view-container.separator-border .view:not(:first-child)::before {\n content: " ";\n position: absolute;\n top: 0;\n left: 0;\n z-index: 5;\n pointer-events: none;\n background-color: var(--dv-separator-border);\n}\n.dragged {\n transform: translate3d(0px, 0px, 0px);\n /* forces tab to be drawn on a separate layer (see https://github.com/microsoft/vscode/issues/18733) */\n}\n\n.tab {\n flex-shrink: 0;\n}\n.tab.dragging .tab-action {\n background-color: var(--dv-activegroup-visiblepanel-tab-color);\n}\n.tab.active-tab > .default-tab .tab-action {\n visibility: visible;\n}\n.tab.inactive-tab > .default-tab .tab-action:not(.dirty) {\n visibility: hidden;\n}\n.tab.inactive-tab > .default-tab:hover .tab-action {\n visibility: visible;\n}\n.tab .default-tab {\n position: relative;\n height: 100%;\n display: flex;\n min-width: 80px;\n align-items: center;\n padding-left: 10px;\n white-space: nowrap;\n text-overflow: elipsis;\n}\n.tab .default-tab .tab-content {\n flex-grow: 1;\n}\n.tab .default-tab .action-container {\n text-align: right;\n width: 28px;\n display: flex;\n}\n.tab .default-tab .action-container .tab-list {\n display: flex;\n padding: 0px;\n margin: 0px;\n justify-content: flex-end;\n}\n.tab .default-tab .action-container .tab-list a:active:hover {\n -webkit-mask-size: 100% 100% !important;\n mask-size: 100% 100% !important;\n}\n.tab .default-tab .action-container .tab-list .tab-action {\n height: 16px;\n width: 16px;\n display: block;\n -webkit-mask: var(--dv-tab-close-icon) 50% 50%/90% 90% no-repeat;\n mask: var(--dv-tab-close-icon) 50% 50%/90% 90% no-repeat;\n margin-right: "0.5em";\n}\n.tab .default-tab .action-container .tab-list .tab-action.disable-close {\n display: none;\n}\n.tab .default-tab .action-container .tab-list .tab-action.dirty:not(:hover) {\n display: block;\n -webkit-mask: var(--dv-tab-dirty-icon) 50% 50%/60% 60% no-repeat;\n mask: var(--dv-tab-dirty-icon) 50% 50%/60% 60% no-repeat;\n}\n.watermark {\n display: flex;\n width: 100%;\n}\n.watermark.has-actions .watermark-title .actions-bar {\n display: none;\n}\n.watermark .watermark-title {\n height: 35px;\n width: 100%;\n display: flex;\n}\n.watermark .watermark-content {\n flex-grow: 1;\n}'),e.Event=void 0,(e.Event||(e.Event={})).any=(...e)=>t=>{const i=e.map((e=>e(t)));return{dispose:()=>{i.forEach((e=>{e.dispose()}))}}};class a{constructor(e){this.options=e,this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=e=>{var t;return(null===(t=this.options)||void 0===t?void 0:t.replay)&&void 0!==this._last&&e(this._last),this._listeners.length,this._listeners.push(e),{dispose:()=>{const t=this._listeners.indexOf(e);t>-1&&this._listeners.splice(t,1)}}}),this._event}fire(e){this._last=e,this._listeners.forEach((t=>{t(e)}))}dispose(){this._listeners=[],this._disposed=!0}}function r(e,t,i,n){return e.addEventListener(t,i,n),{dispose:()=>{e.removeEventListener(t,i)}}}function h(e,t,i,n){return e.addEventListener(t,i,n),{dispose:()=>{e.removeEventListener(t,i)}}}class d{constructor(){this._onFired=new a,this.onEvent=this._onFired.event}fire(){this.timer&&clearTimeout(this.timer),this.timer=setTimeout((()=>{this._onFired.fire(),clearTimeout(this.timer)}))}dispose(){this._onFired.dispose()}}e.Disposable=void 0,(e.Disposable||(e.Disposable={})).NONE={dispose:()=>{}};class l{constructor(...e){this.disposables=e}static from(...e){return new l(...e)}addDisposables(...e){null==e||e.forEach((e=>this.disposables.push(e)))}dispose(){this.disposables.forEach((e=>e.dispose()))}}class p{constructor(){this._disposable=e.Disposable.NONE}set value(e){this._disposable&&this._disposable.dispose(),this._disposable=e}dispose(){this._disposable&&this._disposable.dispose()}}class c{constructor(){}}class u extends c{constructor(e,t,i){super(),this.viewId=e,this.groupId=t,this.panelId=i}}class m extends c{constructor(e,t){super(),this.viewId=e,this.paneId=t}}const v="splitview/transfer";var g;e.DragType=void 0,(g=e.DragType||(e.DragType={})).DOCKVIEW_TAB="dockview_tab",g.EXTERNAL="external_group_drag";class w{constructor(){}static getInstance(){return w.INSTANCE}hasData(e){return e&&e===this.proto}clearData(e){this.hasData(e)&&(this.proto=void 0,this.data=void 0)}getData(e){if(this.hasData(e))return this.data}setData(e,t){t&&(this.data=e,this.proto=t)}}function b(){const e=w.getInstance();if(e.hasData(u.prototype))return e.getData(u.prototype)[0]}function f(){const e=w.getInstance();if(e.hasData(m.prototype))return e.getData(m.prototype)[0]}w.INSTANCE=new w;class _{constructor(e){this.component=e}get minimumSize(){return this.component.minimumSize}get maximumSize(){return this.component.maximumSize}get height(){return this.component.height}get width(){return this.component.width}get length(){return this.component.length}get onDidLayoutChange(){return this.component.onDidLayoutChange}get orientation(){return this.component.orientation}updateOptions(e){this.component.updateOptions(e)}removePanel(e,t){this.component.removePanel(e,t)}setVisible(e,t){this.component.setVisible(e,t)}getPanels(){return this.component.getPanels()}focus(){this.component.focus()}getPanel(e){return this.component.getPanel(e)}setActive(e){this.component.setActive(e)}layout(e,t){return this.component.layout(e,t)}addPanel(e){this.component.addPanel(e)}resizeToFit(){this.component.resizeToFit()}movePanel(e,t){this.component.movePanel(e,t)}fromJSON(e,t){this.component.fromJSON(e,t)}toJSON(){return this.component.toJSON()}}class C{constructor(e){this.component=e}get width(){return this.component.width}get height(){return this.component.height}get minimumSize(){return this.component.minimumSize}get maximumSize(){return this.component.maximumSize}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidAddView(){return this.component.onDidAddView}get onDidRemoveView(){return this.component.onDidRemoveView}get onDidDrop(){const e=new a,t=this.component.onDidDrop((t=>{e.fire(Object.assign(Object.assign({},t),{api:this}))}));return e.dispose=()=>{t.dispose(),e.dispose()},e.event}getPanels(){return this.component.getPanels()}removePanel(e){this.component.removePanel(e)}getPanel(e){return this.component.getPanel(e)}movePanel(e,t){this.component.movePanel(e,t)}focus(){this.component.focus()}layout(e,t){this.component.layout(e,t)}addPanel(e){return this.component.addPanel(e)}resizeToFit(){this.component.resizeToFit()}fromJSON(e,t){this.component.fromJSON(e,t)}toJSON(){return this.component.toJSON()}}class y{constructor(e){this.component=e}get width(){return this.component.width}get height(){return this.component.height}get minimumHeight(){return this.component.minimumHeight}get maximumHeight(){return this.component.maximumHeight}get minimumWidth(){return this.component.minimumWidth}get maximumWidth(){return this.component.maximumWidth}get onGridEvent(){return this.component.onGridEvent}get onDidLayoutChange(){return this.component.onDidLayoutChange}get panels(){return this.component.groups}get orientation(){return this.component.orientation}set orientation(e){this.component.updateOptions({orientation:e})}focus(){this.component.focus()}layout(e,t,i=!1){this.component.layout(e,t,i)}addPanel(e){this.component.addPanel(e)}removePanel(e,t){this.component.removePanel(e,t)}movePanel(e,t){this.component.movePanel(e,t)}resizeToFit(){this.component.resizeToFit()}getPanel(e){return this.component.getPanel(e)}toggleVisibility(e){this.component.toggleVisibility(e)}setVisible(e,t){this.component.setVisible(e,t)}setActive(e){this.component.setActive(e)}fromJSON(e,t){return this.component.fromJSON(e,t)}toJSON(){return this.component.toJSON()}}class z{constructor(e){this.component=e}get width(){return this.component.width}get height(){return this.component.height}get minimumHeight(){return this.component.minimumHeight}get maximumHeight(){return this.component.maximumHeight}get minimumWidth(){return this.component.minimumWidth}get maximumWidth(){return this.component.maximumWidth}get size(){return this.component.size}get totalPanels(){return this.component.totalPanels}get onGridEvent(){return this.component.onGridEvent}get onDidLayoutChange(){return this.component.onDidLayoutChange}get panels(){return this.component.panels}get groups(){return this.component.groups}get activePanel(){return this.component.activePanel}get activeGroup(){return this.component.activeGroup}getTabHeight(){return this.component.tabHeight}setTabHeight(e){this.component.tabHeight=e}focus(){this.component.focus()}getPanel(e){return this.component.getGroupPanel(e)}setActivePanel(e){this.component.setActivePanel(e)}layout(e,t,i=!1){this.component.layout(e,t,i)}addPanel(e){return this.component.addPanel(e)}removePanel(e){this.component.removePanel(e)}addEmptyGroup(e){this.component.addEmptyGroup(e)}moveToNext(e){this.component.moveToNext(e)}moveToPrevious(e){this.component.moveToPrevious(e)}closeAllGroups(){return this.component.closeAllGroups()}removeGroup(e){this.component.removeGroup(e)}resizeToFit(){return this.component.resizeToFit()}getGroup(e){return this.component.getPanel(e)}fromJSON(e){this.component.fromJSON(e)}toJSON(){return this.component.toJSON()}}function D(e,t){const i=new ResizeObserver((e=>{const i=e[0];t(i)}));return i.observe(e),{dispose:()=>{i.unobserve(e),i.disconnect()}}}const S=(e,...t)=>{for(const i of t)e.classList.contains(i)&&e.classList.remove(i)},x=(e,...t)=>{for(const i of t)e.classList.contains(i)||e.classList.add(i)},E=(e,t,i)=>{const n=e.classList.contains(t);i&&!n&&e.classList.add(t),!i&&n&&e.classList.remove(t)};function P(e,t){for(;e;){if(e===t)return!0;e=e.parentNode}return!1}function A(e){return Array.prototype.slice.call(document.getElementsByTagName(e),0)}function O(e){return new N(e)}class N extends l{constructor(e){super(),this._onDidFocus=new a,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new a,this.onDidBlur=this._onDidBlur.event;let t=P(document.activeElement,e),i=!1;const n=()=>{i=!1,t||(t=!0,this._onDidFocus.fire())},s=()=>{t&&(i=!0,window.setTimeout((()=>{i&&(i=!1,t=!1,this._onDidBlur.fire())}),0))};this._refreshStateHandler=()=>{P(document.activeElement,e)!==t&&(t?s():n())},e instanceof HTMLElement?(this.addDisposables(h(e,"focus",n,!0)),this.addDisposables(h(e,"blur",s,!0))):(this.addDisposables(r(e,"focus",n,!0)),this.addDisposables(r(e,"blur",s,!0)))}refreshState(){this._refreshStateHandler()}dispose(){super.dispose(),this._onDidBlur.dispose(),this._onDidFocus.dispose()}}const k=(e,t,i)=>{if(t>i)throw new Error(`${t} > ${i} is an invalid condition`);return Math.min(i,Math.max(e,t))},I=()=>{let e=1;return{next:()=>(e++).toString()}};function T(e){if(0===e.length)throw new Error("Invalid tail call");return[e.slice(0,e.length-1),e[e.length-1]]}function V(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0}function G(e,t){const i=e.indexOf(t);i>-1&&(e.splice(i,1),e.unshift(t))}function L(e,t){const i=e.indexOf(t);i>-1&&(e.splice(i,1),e.push(t))}const R=(e,t)=>{const i=[];if("number"!=typeof t&&(t=e,e=0),e<=t)for(let n=e;n<t;n++)i.push(n);else for(let n=e;n>t;n--)i.push(n);return i};class H{constructor(e,t,i,n){this.container=e,this.view=t,this.disposable=n,this._cachedVisibleSize=void 0,"number"==typeof i?(this._size=i,this._cachedVisibleSize=void 0,e.classList.add("visible")):(this._size=0,this._cachedVisibleSize=i.cachedVisibleSize)}set size(e){this._size=e}get size(){return this._size}get cachedVisibleSize(){return this._cachedVisibleSize}get visible(){return void 0===this._cachedVisibleSize}setVisible(e,t){var i;e!==this.visible&&(e?(this.size=k(null!==(i=this._cachedVisibleSize)&&void 0!==i?i:0,this.viewMinimumSize,this.viewMaximumSize),this._cachedVisibleSize=void 0):(this._cachedVisibleSize="number"==typeof t?t:this.size,this.size=0),this.container.classList.toggle("visible",e),this.view.setVisible&&this.view.setVisible(e))}get minimumSize(){return this.visible?this.view.minimumSize:0}get viewMinimumSize(){return this.view.minimumSize}get maximumSize(){return this.visible?this.view.maximumSize:0}get viewMaximumSize(){return this.view.maximumSize}get priority(){return this.view.priority}get snap(){return!!this.view.snap}set enabled(e){this.container.style.pointerEvents=e?"":"none"}dispose(){return this.disposable.dispose(),this.view}}var M,F,W,B,J;e.Orientation=void 0,(M=e.Orientation||(e.Orientation={})).HORIZONTAL="HORIZONTAL",M.VERTICAL="VERTICAL",e.SashState=void 0,(F=e.SashState||(e.SashState={}))[F.MAXIMUM=0]="MAXIMUM",F[F.MINIMUM=1]="MINIMUM",F[F.DISABLED=2]="DISABLED",F[F.ENABLED=3]="ENABLED",e.LayoutPriority=void 0,(W=e.LayoutPriority||(e.LayoutPriority={})).Low="low",W.High="high",W.Normal="normal",e.Sizing=void 0,(B=e.Sizing||(e.Sizing={})).Distribute={type:"distribute"},B.Split=function(e){return{type:"split",index:e}},B.Invisible=function(e){return{type:"invisible",cachedVisibleSize:e}};class j{constructor(e,t){this.container=e,this.views=[],this.sashes=[],this._size=0,this._orthogonalSize=0,this.contentSize=0,this._proportions=void 0,this._onDidSashEnd=new a,this.onDidSashEnd=this._onDidSashEnd.event,this._onDidAddView=new a,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new a,this.onDidRemoveView=this._onDidAddView.event,this._startSnappingEnabled=!0,this._endSnappingEnabled=!0,this.resize=(e,t,i=this.views.map((e=>e.size)),n,s,o=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY,r,h)=>{if(e<0||e>this.views.length)return 0;const d=R(e,-1),l=R(e+1,this.views.length);if(s)for(const e of s)G(d,e),G(l,e);if(n)for(const e of n)L(d,e),L(l,e);const p=d.map((e=>this.views[e])),c=d.map((e=>i[e])),u=l.map((e=>this.views[e])),m=l.map((e=>i[e])),v=d.reduce(((e,t)=>e+this.views[t].minimumSize-i[t]),0),g=d.reduce(((e,t)=>e+this.views[t].maximumSize-i[t]),0),w=0===l.length?Number.POSITIVE_INFINITY:l.reduce(((e,t)=>e+i[t]-this.views[t].minimumSize),0),b=0===l.length?Number.NEGATIVE_INFINITY:l.reduce(((e,t)=>e+i[t]-this.views[t].maximumSize),0),f=Math.max(v,b),_=Math.min(w,g);let C=!1;if(r){const e=this.views[r.index],i=t>=r.limitDelta;C=i!==e.visible,e.setVisible(i,r.size)}if(!C&&h){const e=this.views[h.index],i=t<h.limitDelta;C=i!==e.visible,e.setVisible(i,h.size)}if(C)return this.resize(e,t,i,n,s,o,a);let y=0,z=k(t,f,_);for(let e=0;e<p.length;e++){const t=p[e],i=k(c[e]+z,t.minimumSize,t.maximumSize),n=i-c[e];y+=n,z-=n,t.size=i}let D=y;for(let e=0;e<u.length;e++){const t=u[e],i=k(m[e]-D,t.minimumSize,t.maximumSize);D+=i-m[e],t.size=i}return t},this._orientation=t.orientation,this.element=this.createContainer(),this.proportionalLayout=void 0===t.proportionalLayout||!!t.proportionalLayout,this.viewContainer=this.createViewContainer(),this.sashContainer=this.createSashContainer(),this.element.appendChild(this.sashContainer),this.element.appendChild(this.viewContainer),this.container.appendChild(this.element),this.style(t.styles),t.descriptor&&(this._size=t.descriptor.size,t.descriptor.views.forEach(((e,t)=>{const i=void 0===e.visible||e.visible?e.size:{type:"invisible",cachedVisibleSize:e.size},n=e.view;this.addView(n,i,t,!0)})),this.contentSize=this.views.reduce(((e,t)=>e+t.size),0),this.saveProportions())}get size(){return this._size}set size(e){this._size=e}get orthogonalSize(){return this._orthogonalSize}set orthogonalSize(e){this._orthogonalSize=e}get length(){return this.views.length}get proportions(){return this._proportions?[...this._proportions]:void 0}get orientation(){return this._orientation}set orientation(t){this._orientation=t;const i=this.size;this.size=this.orthogonalSize,this.orthogonalSize=i,S(this.element,"horizontal","vertical"),this.element.classList.add(this.orientation==e.Orientation.HORIZONTAL?"horizontal":"vertical")}get minimumSize(){return this.views.reduce(((e,t)=>e+t.minimumSize),0)}get maximumSize(){return 0===this.length?Number.POSITIVE_INFINITY:this.views.reduce(((e,t)=>e+t.maximumSize),0)}get startSnappingEnabled(){return this._startSnappingEnabled}set startSnappingEnabled(e){this._startSnappingEnabled!==e&&(this._startSnappingEnabled=e,this.updateSashEnablement())}get endSnappingEnabled(){return this._endSnappingEnabled}set endSnappingEnabled(e){this._endSnappingEnabled!==e&&(this._endSnappingEnabled=e,this.updateSashEnablement())}style(e){"transparent"===(null==e?void 0:e.separatorBorder)?(S(this.element,"separator-border"),this.element.style.removeProperty("--dv-separator-border")):(x(this.element,"separator-border"),(null==e?void 0:e.separatorBorder)&&this.element.style.setProperty("--dv-separator-border",e.separatorBorder))}isViewVisible(e){if(e<0||e>=this.views.length)throw new Error("Index out of bounds");return this.views[e].visible}setViewVisible(e,t){if(e<0||e>=this.views.length)throw new Error("Index out of bounds");E(this.container,"visible",t);const i=this.views[e];E(this.container,"visible",t),i.setVisible(t,i.size),this.distributeEmptySpace(e),this.layoutViews(),this.saveProportions()}getViewSize(e){return e<0||e>=this.views.length?-1:this.views[e].size}resizeView(t,i){if(t<0||t>=this.views.length)return;const n=R(this.views.length).filter((e=>e!==t)),s=[...n.filter((t=>this.views[t].priority===e.LayoutPriority.Low)),t],o=n.filter((t=>this.views[t].priority===e.LayoutPriority.High)),a=this.views[t];i=Math.round(i),i=k(i,a.minimumSize,Math.min(a.maximumSize,this._size)),a.size=i,this.relayout(s,o)}getViews(){return this.views.map((e=>e.view))}onDidChange(e,t){const i=this.views.indexOf(e);i<0||i>=this.views.length||(t="number"==typeof t?t:e.size,t=k(t,e.minimumSize,e.maximumSize),e.size=t,this.relayout([i]))}addView(t,i={type:"distribute"},n=this.views.length,s){const o=document.createElement("div");let a;o.className="view",o.appendChild(t.element),a="number"==typeof i?i:"split"===i.type?this.getViewSize(i.index)/2:"invisible"===i.type?{cachedVisibleSize:i.cachedVisibleSize}:t.minimumSize;const r=t.onDidChange((e=>this.onDidChange(h,e))),h=new H(o,t,a,{dispose:()=>{null==r||r.dispose(),this.viewContainer.removeChild(o)}});if(n===this.views.length?this.viewContainer.appendChild(o):this.viewContainer.insertBefore(o,this.viewContainer.children.item(n)),this.views.splice(n,0,h),this.views.length>1){const t=document.createElement("div");t.className="sash";const i=i=>{for(const e of this.views)e.enabled=!1;const n=[...A("iframe"),...A("webview")];for(const e of n)e.style.pointerEvents="none";const s=this._orientation===e.Orientation.HORIZONTAL?i.clientX:i.clientY,o=function(e,t){for(let i=0;i<e.length;i++)if(t(e[i]))return i;return-1}(this.sashes,(e=>e.container===t)),a=this.views.map((e=>e.size));let r,h;const d=R(o,-1),l=R(o+1,this.views.length),p=d.reduce(((e,t)=>e+(this.views[t].minimumSize-a[t])),0),c=d.reduce(((e,t)=>e+(this.views[t].viewMaximumSize-a[t])),0),u=0===l.length?Number.POSITIVE_INFINITY:l.reduce(((e,t)=>e+(a[t]-this.views[t].minimumSize)),0),m=0===l.length?Number.NEGATIVE_INFINITY:l.reduce(((e,t)=>e+(a[t]-this.views[t].viewMaximumSize)),0),v=Math.max(p,m),g=Math.min(u,c),w=this.findFirstSnapIndex(d),b=this.findFirstSnapIndex(l);if("number"==typeof w){const e=this.views[w],t=Math.floor(e.viewMinimumSize/2);r={index:w,limitDelta:e.visible?v-t:v+t,size:e.size}}if("number"==typeof b){const e=this.views[b],t=Math.floor(e.viewMinimumSize/2);h={index:b,limitDelta:e.visible?g+t:g-t,size:e.size}}const f=t=>{const i=(this._orientation===e.Orientation.HORIZONTAL?t.clientX:t.clientY)-s;this.resize(o,i,a,void 0,void 0,v,g,r,h),this.distributeEmptySpace(),this.layoutViews()},_=()=>{for(const e of this.views)e.enabled=!0;for(const e of n)e.style.pointerEvents="auto";this.saveProportions(),document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",_),document.removeEventListener("mouseend",_),this._onDidSashEnd.fire(void 0)};document.addEventListener("mousemove",f),document.addEventListener("mouseup",_),document.addEventListener("mouseend",_)};t.addEventListener("mousedown",i);const n={container:t,disposable:()=>{t.removeEventListener("mousedown",i),this.sashContainer.removeChild(t)}};this.sashContainer.appendChild(t),this.sashes.push(n)}s||this.relayout([n]),s||"number"==typeof i||"distribute"!==i.type||this.distributeViewSizes(),this._onDidAddView.fire(t)}distributeViewSizes(){const t=[];let i=0;for(const e of this.views)e.maximumSize-e.minimumSize>0&&(t.push(e),i+=e.size);const n=Math.floor(i/t.length);for(const e of t)e.size=k(n,e.minimumSize,e.maximumSize);const s=R(this.views.length),o=s.filter((t=>this.views[t].priority===e.LayoutPriority.Low)),a=s.filter((t=>this.views[t].priority===e.LayoutPriority.High));this.relayout(o,a)}removeView(e,t,i=!1){const n=this.views.splice(e,1)[0];if(n.dispose(),this.views.length>=1){const t=Math.max(e-1,0);this.sashes.splice(t,1)[0].disposable()}return i||this.relayout(),t&&"distribute"===t.type&&this.distributeViewSizes(),this._onDidRemoveView.fire(n.view),n.view}getViewCachedVisibleSize(e){if(e<0||e>=this.views.length)throw new Error("Index out of bounds");return this.views[e].cachedVisibleSize}moveView(t,i){const n=this.getViewCachedVisibleSize(t),s=void 0===n?this.getViewSize(t):e.Sizing.Invisible(n),o=this.removeView(t,void 0,!0);this.addView(o,s,i)}layout(t,i){const n=Math.max(this.size,this.contentSize);if(this.size=t,this.orthogonalSize=i,this.proportions)for(let e=0;e<this.views.length;e++){const i=this.views[e];i.size=k(Math.round(this.proportions[e]*t),i.minimumSize,i.maximumSize)}else{const i=R(this.views.length),s=i.filter((t=>this.views[t].priority===e.LayoutPriority.Low)),o=i.filter((t=>this.views[t].priority===e.LayoutPriority.High));this.resize(this.views.length-1,t-n,void 0,s,o)}this.distributeEmptySpace(),this.layoutViews()}relayout(e,t){const i=this.views.reduce(((e,t)=>e+t.size),0);this.resize(this.views.length-1,this._size-i,void 0,e,t),this.distributeEmptySpace(),this.layoutViews(),this.saveProportions()}distributeEmptySpace(t){const i=this.views.reduce(((e,t)=>e+t.size),0);let n=this.size-i;const s=R(this.views.length-1,-1),o=s.filter((t=>this.views[t].priority===e.LayoutPriority.Low)),a=s.filter((t=>this.views[t].priority===e.LayoutPriority.High));for(const e of a)G(s,e);for(const e of o)L(s,e);"number"==typeof t&&L(s,t);for(let e=0;0!==n&&e<s.length;e++){const t=this.views[s[e]],i=k(t.size+n,t.minimumSize,t.maximumSize);n-=i-t.size,t.size=i}}saveProportions(){this.proportionalLayout&&this.contentSize>0&&(this._proportions=this.views.map((e=>e.size/this.contentSize)))}layoutViews(){this.contentSize=this.views.reduce(((e,t)=>e+t.size),0);let t=0;const i=[];this.updateSashEnablement();for(let n=0;n<this.views.length-1;n++){t+=this.views[n].size,i.push(t);const s=Math.min(Math.max(0,t-2),this.size-4);this._orientation===e.Orientation.HORIZONTAL&&(this.sashes[n].container.style.left=`${s}px`,this.sashes[n].container.style.top="0px"),this._orientation===e.Orientation.VERTICAL&&(this.sashes[n].container.style.left="0px",this.sashes[n].container.style.top=`${s}px`)}this.views.forEach(((t,n)=>{this._orientation===e.Orientation.HORIZONTAL&&(t.container.style.width=`${t.size}px`,t.container.style.left=0==n?"0px":`${i[n-1]}px`,t.container.style.top="",t.container.style.height=""),this._orientation===e.Orientation.VERTICAL&&(t.container.style.height=`${t.size}px`,t.container.style.top=0==n?"0px":`${i[n-1]}px`,t.container.style.width="",t.container.style.left=""),t.view.layout(t.size,this._orthogonalSize)}))}findFirstSnapIndex(e){for(const t of e){const e=this.views[t];if(e.visible&&e.snap)return t}for(const t of e){const e=this.views[t];if(e.visible&&e.maximumSize-e.minimumSize>0)return;if(!e.visible&&e.snap)return t}}updateSashEnablement(){let t=!1;const i=this.views.map((e=>t=e.size-e.minimumSize>0||t));t=!1;const n=this.views.map((e=>t=e.maximumSize-e.size>0||t)),s=[...this.views].reverse();t=!1;const o=s.map((e=>t=e.size-e.minimumSize>0||t)).reverse();t=!1;const a=s.map((e=>t=e.maximumSize-e.size>0||t)).reverse();let r=0;for(let t=0;t<this.sashes.length;t++){const s=this.sashes[t];r+=this.views[t].size;const h=!(i[t]&&a[t+1]),d=!(n[t]&&o[t+1]);if(h&&d){const n=R(t,-1),a=R(t+1,this.views.length),h=this.findFirstSnapIndex(n),d=this.findFirstSnapIndex(a),l="number"==typeof h&&!this.views[h].visible,p="number"==typeof d&&!this.views[d].visible;l&&o[t]&&(r>0||this.startSnappingEnabled)?this.updateSash(s,e.SashState.MINIMUM):p&&i[t]&&(r<this.contentSize||this.endSnappingEnabled)?this.updateSash(s,e.SashState.MAXIMUM):this.updateSash(s,e.SashState.DISABLED)}else h&&!d?this.updateSash(s,e.SashState.MINIMUM):!h&&d?this.updateSash(s,e.SashState.MAXIMUM):this.updateSash(s,e.SashState.ENABLED)}}updateSash(t,i){E(t.container,"disabled",i===e.SashState.DISABLED),E(t.container,"enabled",i===e.SashState.ENABLED),E(t.container,"maximum",i===e.SashState.MAXIMUM),E(t.container,"minimum",i===e.SashState.MINIMUM)}createViewContainer(){const e=document.createElement("div");return e.className="view-container",e}createSashContainer(){const e=document.createElement("div");return e.className="sash-container",e}createContainer(){const t=document.createElement("div"),i=this._orientation===e.Orientation.HORIZONTAL?"horizontal":"vertical";return t.className=`split-view-container ${i}`,t}dispose(){this._onDidSashEnd.dispose(),this._onDidAddView.dispose(),this._onDidRemoveView.dispose(),this.element.remove();for(let e=0;e<this.element.children.length;e++)if(this.element.children.item(e)===this.element){this.element.removeChild(this.element);break}}}class U extends l{constructor(t,i){var n;super(),this.paneItems=[],this.skipAnimation=!1,this._onDidChange=new a,this.onDidChange=this._onDidChange.event,this._orientation=null!==(n=i.orientation)&&void 0!==n?n:e.Orientation.VERTICAL,this.element=document.createElement("div"),this.element.className="pane-container",t.appendChild(this.element),this.splitview=new j(this.element,{orientation:this._orientation,proportionalLayout:!1,descriptor:i.descriptor}),this.getPanes().forEach(((e,t)=>{const i=new l(e.onDidChangeExpansionState((()=>{this.setupAnimation(),this._onDidChange.fire(void 0)}))),n={pane:e,disposable:{dispose:()=>{i.dispose()}}};this.paneItems.push(n),e.orthogonalSize=this.splitview.orthogonalSize})),this.addDisposables(this.splitview.onDidSashEnd((()=>{this._onDidChange.fire(void 0)})),this.splitview.onDidAddView((()=>{this._onDidChange.fire()})),this.splitview.onDidRemoveView((()=>{this._onDidChange.fire()})))}get onDidAddView(){return this.splitview.onDidAddView}get onDidRemoveView(){return this.splitview.onDidRemoveView}get minimumSize(){return this.splitview.minimumSize}get maximumSize(){return this.splitview.maximumSize}get orientation(){return this.splitview.orientation}get size(){return this.splitview.size}get orthogonalSize(){return this.splitview.orthogonalSize}addPane(e,t,i=this.splitview.length,n=!1){const s=e.onDidChangeExpansionState((()=>{this.setupAnimation(),this._onDidChange.fire(void 0)})),o={pane:e,disposable:{dispose:()=>{s.dispose()}}};this.paneItems.splice(i,0,o),e.orthogonalSize=this.splitview.orthogonalSize,this.splitview.addView(e,t,i,n)}getViewSize(e){return this.splitview.getViewSize(e)}getPanes(){return this.splitview.getViews()}removePane(e){const t=this.paneItems.splice(e,1)[0];return this.splitview.removeView(e),t.disposable.dispose(),t}moveView(e,t){if(e===t)return;const i=this.removePane(e);this.skipAnimation=!0;try{this.addPane(i.pane,i.pane.size,t,!1)}finally{this.skipAnimation=!1}}layout(e,t){this.splitview.layout(e,t)}setupAnimation(){this.skipAnimation||(this.animationTimer&&(clearTimeout(this.animationTimer),this.animationTimer=void 0),x(this.element,"animated"),this.animationTimer=setTimeout((()=>{this.animationTimer=void 0,S(this.element,"animated")}),200))}dispose(){super.dispose(),this.splitview.dispose(),this.animationTimer&&(clearTimeout(this.animationTimer),this.animationTimer=void 0),this.paneItems.forEach((e=>{e.disposable.dispose()})),this.paneItems=[],this.element.remove()}}class K extends l{constructor(e,t){super(),this.element=e,this.callbacks=t,this.counter=0,this.registerListeners()}registerListeners(){this.addDisposables(h(this.element,"dragenter",(e=>{this.counter++,this.callbacks.onDragEnter(e)}))),this.addDisposables(h(this.element,"dragover",(e=>{e.preventDefault(),this.callbacks.onDragOver&&this.callbacks.onDragOver(e)}))),this.addDisposables(h(this.element,"dragleave",(e=>{this.counter--,0===this.counter&&this.callbacks.onDragLeave(e)}))),this.addDisposables(h(this.element,"dragend",(e=>{this.counter=0,this.callbacks.onDragEnd(e)}))),this.addDisposables(h(this.element,"drop",(e=>{this.counter=0,this.callbacks.onDrop(e)})))}}e.Position=void 0,(J=e.Position||(e.Position={})).Top="Top",J.Left="Left",J.Bottom="Bottom",J.Right="Right",J.Center="Center";class $ extends l{constructor(t,i){super(),this.element=t,this.options=i,this._onDrop=new a,this.onDrop=this._onDrop.event,this.addDisposables(new K(this.element,{onDragEnter:e=>{},onDragOver:t=>{if("boolean"==typeof this.options.canDisplayOverlay){if(!this.options.canDisplayOverlay)return}else if(!this.options.canDisplayOverlay(t))return;if(this.target||(this.target=document.createElement("div"),this.target.className="drop-target-dropzone",this.overlay=document.createElement("div"),this.overlay.className="drop-target-selection",this._state=e.Position.Center,this.target.appendChild(this.overlay),this.element.classList.add("drop-target"),this.element.append(this.target)),"none"===this.options.validOverlays)return;if(!this.target||!this.overlay)return;const i=this.target.clientWidth,n=this.target.clientHeight;if(0===i||0===n)return;const s=100*t.offsetX/i,o=100*t.offsetY/n;let a=!1,r=!1,h=!1,d=!1;switch(this.options.validOverlays){case"all":a=s>80,r=s<20,h=!a&&!r&&o<20,d=!a&&!r&&o>80;break;case"vertical":h=o<50,d=o>=50;break;case"horizontal":r=s<50,a=s>=50}const l=i<100,p=n<100;E(this.overlay,"right",!l&&a),E(this.overlay,"left",!l&&r),E(this.overlay,"top",!p&&h),E(this.overlay,"bottom",!p&&d),E(this.overlay,"small-right",l&&a),E(this.overlay,"small-left",l&&r),E(this.overlay,"small-top",p&&h),E(this.overlay,"small-bottom",p&&d),this._state=a?e.Position.Right:r?e.Position.Left:h?e.Position.Top:d?e.Position.Bottom:e.Position.Center},onDragLeave:e=>{this.removeDropTarget()},onDragEnd:e=>{this.removeDropTarget()},onDrop:e=>{e.preventDefault(),e.stopPropagation();const t=this._state;this.removeDropTarget(),t&&this._onDrop.fire({position:t,nativeEvent:e})}}))}get state(){return this._state}set validOverlays(e){this.options.validOverlays=e}set canDisplayOverlay(e){this.options.canDisplayOverlay=e}dispose(){this._onDrop.dispose(),this.removeDropTarget()}removeDropTarget(){this.target&&(this._state=void 0,this.element.removeChild(this.target),this.target=void 0,this.element.classList.remove("drop-target"))}}class Z{constructor(t,i,n,s=0){this.view=t,this.orientation=i,this._onDidChange=new a,this.onDidChange=this._onDidChange.event,this._orthogonalSize=n,this._size=s,this._disposable=this.view.onDidChange((t=>{t?this._onDidChange.fire(this.orientation===e.Orientation.VERTICAL?t.width:t.height):this._onDidChange.fire(void 0)}))}get minimumWidth(){return this.view.minimumWidth}get maximumWidth(){return this.view.maximumWidth}get minimumHeight(){return this.view.minimumHeight}get maximumHeight(){return this.view.maximumHeight}get priority(){return this.view.priority}get snap(){return this.view.snap}get minimumSize(){return this.orientation===e.Orientation.HORIZONTAL?this.minimumHeight:this.minimumWidth}get maximumSize(){return this.orientation===e.Orientation.HORIZONTAL?this.maximumHeight:this.maximumWidth}get minimumOrthogonalSize(){return this.orientation===e.Orientation.HORIZONTAL?this.minimumWidth:this.minimumHeight}get maximumOrthogonalSize(){return this.orientation===e.Orientation.HORIZONTAL?this.maximumWidth:this.maximumHeight}get orthogonalSize(){return this._orthogonalSize}get size(){return this._size}get element(){return this.view.element}get width(){return this.orientation===e.Orientation.HORIZONTAL?this.orthogonalSize:this.size}get height(){return this.orientation===e.Orientation.HORIZONTAL?this.size:this.orthogonalSize}setVisible(e){this.view.setVisible&&(this.view.setVisible(e),this._onDidChange.fire(void 0))}layout(e,t){this._size=e,this._orthogonalSize=t,this.view.layout(this.width,this.height)}dispose(){this._disposable.dispose()}}class Y extends l{constructor(t,i,n,s,o,r){if(super(),this.orientation=t,this.proportionalLayout=i,this.styles=n,this.children=[],this._onDidChange=new a,this.onDidChange=this._onDidChange.event,this._childrenDisposable=e.Disposable.NONE,this._orthogonalSize=o,this._size=s,this.element=document.createElement("div"),this.element.className="branch-node",r){const e={views:r.map((e=>({view:e.node,size:e.node.size,visible:!(e.node instanceof Z&&void 0!==e.visible)||e.visible}))),size:this.orthogonalSize};this.children=r.map((e=>e.node)),this.splitview=new j(this.element,{orientation:this.orientation,descriptor:e,proportionalLayout:i})}else this.splitview=new j(this.element,{orientation:this.orientation,proportionalLayout:i,styles:n}),this.splitview.layout(this.size,this.orthogonalSize);this.addDisposables(this.splitview.onDidSashEnd((()=>{this._onDidChange.fire(void 0)}))),this.setupChildrenEvents()}get width(){return this.orientation===e.Orientation.HORIZONTAL?this.size:this.orthogonalSize}get height(){return this.orientation===e.Orientation.HORIZONTAL?this.orthogonalSize:this.size}get minimumSize(){return 0===this.children.length?0:Math.max(...this.children.map((e=>e.minimumOrthogonalSize)))}get maximumSize(){return Math.min(...this.children.map((e=>e.maximumOrthogonalSize)))}get minimumOrthogonalSize(){return this.splitview.minimumSize}get maximumOrthogonalSize(){return this.splitview.maximumSize}get orthogonalSize(){return this._orthogonalSize}get size(){return this._size}get minimumWidth(){return this.orientation===e.Orientation.HORIZONTAL?this.minimumOrthogonalSize:this.minimumSize}get minimumHeight(){return this.orientation===e.Orientation.HORIZONTAL?this.minimumSize:this.minimumOrthogonalSize}get maximumWidth(){return this.orientation===e.Orientation.HORIZONTAL?this.maximumOrthogonalSize:this.maximumSize}get maximumHeight(){return this.orientation===e.Orientation.HORIZONTAL?this.maximumSize:this.maximumOrthogonalSize}get priority(){if(0===this.children.length)return e.LayoutPriority.Normal;const t=this.children.map((t=>void 0===t.priority?e.LayoutPriority.Normal:t.priority));return t.some((t=>t===e.LayoutPriority.High))?e.LayoutPriority.High:t.some((t=>t===e.LayoutPriority.Low))?e.LayoutPriority.Low:e.LayoutPriority.Normal}setVisible(e){for(const t of this.children)t.setVisible(e)}isChildVisible(e){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.isViewVisible(e)}setChildVisible(e,t){if(e<0||e>=this.children.length)throw new Error("Invalid index");this.splitview.isViewVisible(e)!==t&&this.splitview.setViewVisible(e,t)}moveChild(e,t){if(e===t)return;if(e<0||e>=this.children.length)throw new Error("Invalid from index");e<t&&t--,this.splitview.moveView(e,t);const i=this._removeChild(e);this._addChild(i,t)}getChildSize(e){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.getViewSize(e)}resizeChild(e,t){if(e<0||e>=this.children.length)throw new Error("Invalid index");this.splitview.resizeView(e,t)}layout(e,t){this._size=t,this._orthogonalSize=e,this.splitview.layout(this.size,this.orthogonalSize)}addChild(e,t,i,n){if(i<0||i>this.children.length)throw new Error("Invalid index");this.splitview.addView(e,t,i,n),this._addChild(e,i)}getChildCachedVisibleSize(e){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.getViewCachedVisibleSize(e)}removeChild(e,t){if(e<0||e>=this.children.length)throw new Error("Invalid index");this.splitview.removeView(e,t),this._removeChild(e)}_addChild(e,t){this.children.splice(t,0,e),this.setupChildrenEvents()}_removeChild(e){const[t]=this.children.splice(e,1);return this.setupChildrenEvents(),t}setupChildrenEvents(){this._childrenDisposable.dispose(),this._childrenDisposable=e.Event.any(...this.children.map((e=>e.onDidChange)))((e=>{this._onDidChange.fire(void 0)}))}dispose(){super.dispose(),this._childrenDisposable.dispose(),this.children.forEach((e=>e.dispose())),this.splitview.dispose()}}function X(e,t,i){if(e instanceof Y){const n=new Y(ne(e.orientation),e.proportionalLayout,e.styles,t,i);let s=0;for(let o=e.children.length-1;o>=0;o--){const a=e.children[o],r=a instanceof Y?a.orthogonalSize:a.size;let h=0===e.size?0:Math.round(t*r/e.size);s+=h,0===o&&(h+=t-s),n.addChild(X(a,i,h),h,0,!0)}return n}return new Z(e.view,ne(e.orientation),i)}function q(e){const t=e.parentElement;if(!t)throw new Error("Invalid grid element");let i=t.firstElementChild,n=0;for(;i!==e&&i!==t.lastElementChild&&i;)i=i.nextElementSibling,n++;return n}function Q(e){const t=e.parentElement;if(!t)throw new Error("Invalid grid element");if(/\bgrid-view\b/.test(t.className))return[];const i=q(t);return[...Q(t.parentElement.parentElement.parentElement),i]}function ee(t,i,n){if(ie(t,i)===te(n)){const[t,s]=T(i);let o=s;return n!==e.Position.Right&&n!==e.Position.Bottom||(o+=1),[...t,o]}{const t=n===e.Position.Right||n===e.Position.Bottom?1:0;return[...i,t]}}function te(t){return t===e.Position.Top||t===e.Position.Bottom?e.Orientation.VERTICAL:e.Orientation.HORIZONTAL}function ie(e,t){return t.length%2==0?ne(e):e}const ne=t=>t===e.Orientation.HORIZONTAL?e.Orientation.VERTICAL:e.Orientation.HORIZONTAL;function se(e){return!!e.children}const oe=(t,i)=>{const n=i===e.Orientation.VERTICAL?t.box.width:t.box.height;return se(t)?{type:"branch",data:t.children.map((e=>oe(e,ne(i)))),size:n}:"number"==typeof t.cachedVisibleSize?{type:"leaf",data:t.view.toJSON(),size:t.cachedVisibleSize,visible:!1}:{type:"leaf",data:t.view.toJSON(),size:n}};class ae{constructor(e,t,i){this.proportionalLayout=e,this.styles=t,this.disposable=new p,this._onDidChange=new a,this.onDidChange=this._onDidChange.event,this.element=document.createElement("div"),this.element.className="grid-view",this.root=new Y(i,e,t,0,0)}serialize(){return{root:oe(this.getView(),this.orientation),width:this.width,height:this.height,orientation:this.orientation}}dispose(){this.disposable.dispose(),this._onDidChange.dispose(),this.root.dispose()}clear(){const e=this.root.orientation;this.root=new Y(e,this.proportionalLayout,this.styles,this.root.size,this.root.orthogonalSize)}deserialize(e,t){const i=e.orientation,n=e.height;this._deserialize(e.root,i,t,n)}_deserialize(e,t,i,n){this.root=this._deserializeNode(e,t,i,n)}_deserializeNode(e,t,i,n){let s;if("branch"===e.type){const o=e.data.map((n=>({node:this._deserializeNode(n,ne(t),i,e.size),visible:n.visible})));s=new Y(t,this.proportionalLayout,this.styles,e.size,n,o)}else s=new Z(i.fromJSON(e),t,n,e.size);return s}get orientation(){return this.root.orientation}set orientation(e){if(this.root.orientation===e)return;const{size:t,orthogonalSize:i}=this.root;this.root=X(this.root,i,t),this.root.layout(t,i)}get root(){return this._root}set root(e){const t=this._root;t&&(t.dispose(),this.element.removeChild(t.element)),this._root=e,this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange((e=>{this._onDidChange.fire(e)}))}next(e){return this.progmaticSelect(e)}previous(e){return this.progmaticSelect(e,!0)}getView(e){const t=e?this.getNode(e)[1]:this.root;return this._getViews(t,this.orientation)}_getViews(e,t,i){const n={height:e.height,width:e.width};if(e instanceof Z)return{box:n,view:e.view,cachedVisibleSize:i};const s=[];for(let i=0;i<e.children.length;i++){const n=e.children[i],o=e.getChildCachedVisibleSize(i);s.push(this._getViews(n,ne(t),o))}return{box:n,children:s}}progmaticSelect(e,t=!1){const[i,n]=this.getNode(e);if(!(n instanceof Z))throw new Error("invalid location");const s=(e,t)=>{if(e instanceof Z)return e;if(e instanceof Y)return s(e.children[t?e.children.length-1:0],t);throw new Error("invalid node")};for(let n=i.length-1;n>-1;n--){const o=i[n],a=e[n]||0;if(t?a-1>-1:a+1<o.children.length)return s(o.children[t?a-1:a+1],t)}return s(this.root,t)}get width(){return this.root.width}get height(){return this.root.height}get minimumWidth(){return this.root.minimumWidth}get minimumHeight(){return this.root.minimumHeight}get maximumWidth(){return this.root.maximumHeight}get maximumHeight(){return this.root.maximumHeight}isViewVisible(e){const[t,i]=T(e),[,n]=this.getNode(t);if(!(n instanceof Y))throw new Error("Invalid from location");return n.isChildVisible(i)}setViewVisible(e,t){const[i,n]=T(e),[,s]=this.getNode(i);if(!(s instanceof Y))throw new Error("Invalid from location");s.setChildVisible(n,t)}moveView(e,t,i){const[,n]=this.getNode(e);if(!(n instanceof Y))throw new Error("Invalid location");n.moveChild(t,i)}addView(t,i,n){const[s,o]=T(n),[a,r]=this.getNode(s);if(r instanceof Y){const e=new Z(t,ne(r.orientation),r.orthogonalSize);r.addChild(e,i,o)}else{const[n,...h]=[...a].reverse(),[d,...l]=[...s].reverse();let p=0;const c=n.getChildCachedVisibleSize(d);"number"==typeof c&&(p=e.Sizing.Invisible(c)),n.removeChild(d);const u=new Y(r.orientation,this.proportionalLayout,this.styles,r.size,r.orthogonalSize);n.addChild(u,r.size,d);const m=new Z(r.view,n.orientation,r.size);u.addChild(m,p,0),"number"!=typeof i&&"split"===i.type&&(i={type:"split",index:0});const v=new Z(t,n.orientation,r.size);u.addChild(v,i,o)}}remove(e,t){const i=Q(e.element);return this.removeView(i,t)}removeView(t,i){const[n,s]=T(t),[o,a]=this.getNode(n);if(!(a instanceof Y))throw new Error("Invalid location");const r=a.children[s];if(!(r instanceof Z))throw new Error("Invalid location");if(a.removeChild(s,i),0===a.children.length)return r.view;if(a.children.length>1)return r.view;if(0===o.length){const e=a.children[0];return e instanceof Z||(a.removeChild(0,i),this.root=e),r.view}const[h,...d]=[...o].reverse(),[l,...p]=[...n].reverse(),c=a.children[0],u=a.isChildVisible(0);a.removeChild(0,i);const m=h.children.map(((e,t)=>h.getChildSize(t)));if(h.removeChild(l,i),c instanceof Y){m.splice(l,1,...c.children.map((e=>e.size)));for(let e=0;e<c.children.length;e++){const t=c.children[e];h.addChild(t,t.size,l+e)}}else{const t=new Z(c.view,ne(c.orientation),c.size),i=u?c.orthogonalSize:e.Sizing.Invisible(c.orthogonalSize);h.addChild(t,i,l)}for(let e=0;e<m.length;e++)h.resizeChild(e,m[e]);return r.view}layout(t,i){const[n,s]=this.root.orientation===e.Orientation.HORIZONTAL?[i,t]:[t,i];this.root.layout(n,s)}getNode(e,t=this.root,i=[]){if(0===e.length)return[i,t];if(!(t instanceof Y))throw new Error("Invalid location");const[n,...s]=e;if(n<0||n>=t.children.length)throw new Error("Invalid location");const o=t.children[n];return i.push(t),this.getNode(s,o,i)}}
|
|
7
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).dockview={},e.React,e.ReactDOM)}(this,(function(e,t,i){"use strict";function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(i){if("default"!==i){var n=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,n.get?n:{enumerable:!0,get:function(){return e[i]}})}})),t.default=e,Object.freeze(t)}var s=n(t),o=n(i);!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===i&&n.firstChild?n.insertBefore(s,n.firstChild):n.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}('.dockview-theme-dark {\n --dv-paneview-active-outline-color: dodgerblue;\n --dv-tabs-and-actions-container-font-size: 13px;\n --dv-tabs-and-actions-container-height: 35px;\n --dv-tab-close-icon: url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>\');\n --dv-tab-dirty-icon: url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z"/></svg>\');\n --dv-drag-over-background-color: rgba(83, 89, 93, 0.5);\n --dv-drag-over-border-color: white;\n --dv-tabs-container-scrollbar-color: #888;\n --dv-group-view-background-color: #1e1e1e;\n --dv-tabs-and-actions-container-background-color: #252526;\n --dv-activegroup-visiblepanel-tab-background-color: #1e1e1e;\n --dv-activegroup-hiddenpanel-tab-background-color: #2d2d2d;\n --dv-inactivegroup-visiblepanel-tab-background-color: #1e1e1e;\n --dv-inactivegroup-hiddenpanel-tab-background-color: #2d2d2d;\n --dv-tab-divider-color: #1e1e1e;\n --dv-activegroup-visiblepanel-tab-color: white;\n --dv-activegroup-hiddenpanel-tab-color: #969696;\n --dv-inactivegroup-visiblepanel-tab-color: #8f8f8f;\n --dv-inactivegroup-hiddenpanel-tab-color: #626262;\n --dv-separator-border: rgb(68, 68, 68);\n --dv-paneview-header-border-color: rgba(204, 204, 204, 0.2);\n}\n\n.dockview-theme-light {\n --dv-paneview-active-outline-color: dodgerblue;\n --dv-tabs-and-actions-container-font-size: 13px;\n --dv-tabs-and-actions-container-height: 35px;\n --dv-tab-close-icon: url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>\');\n --dv-tab-dirty-icon: url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z"/></svg>\');\n --dv-drag-over-background-color: rgba(83, 89, 93, 0.5);\n --dv-drag-over-border-color: white;\n --dv-tabs-container-scrollbar-color: #888;\n --dv-group-view-background-color: white;\n --dv-tabs-and-actions-container-background-color: #f3f3f3;\n --dv-activegroup-visiblepanel-tab-background-color: white;\n --dv-activegroup-hiddenpanel-tab-background-color: #ececec;\n --dv-inactivegroup-visiblepanel-tab-background-color: white;\n --dv-inactivegroup-hiddenpanel-tab-background-color: #ececec;\n --dv-tab-divider-color: white;\n --dv-activegroup-visiblepanel-tab-color: rgb(51, 51, 51);\n --dv-activegroup-hiddenpanel-tab-color: rgba(51, 51, 51, 0.7);\n --dv-inactivegroup-visiblepanel-tab-color: rgba(51, 51, 51, 0.7);\n --dv-inactivegroup-hiddenpanel-tab-color: rgba(51, 51, 51, 0.35);\n --dv-separator-border: rgba(128, 128, 128, 0.35);\n --dv-paneview-header-border-color: rgb(51, 51, 51);\n}\n\n.dockview-theme-vs {\n --dv-paneview-active-outline-color: dodgerblue;\n --dv-tabs-and-actions-container-font-size: 13px;\n --dv-tabs-and-actions-container-height: 35px;\n --dv-tab-close-icon: url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>\');\n --dv-tab-dirty-icon: url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z"/></svg>\');\n --dv-drag-over-background-color: rgba(83, 89, 93, 0.5);\n --dv-drag-over-border-color: white;\n --dv-tabs-container-scrollbar-color: #888;\n --dv-group-view-background-color: #1e1e1e;\n --dv-tabs-and-actions-container-background-color: #252526;\n --dv-activegroup-visiblepanel-tab-background-color: #1e1e1e;\n --dv-activegroup-hiddenpanel-tab-background-color: #2d2d2d;\n --dv-inactivegroup-visiblepanel-tab-background-color: #1e1e1e;\n --dv-inactivegroup-hiddenpanel-tab-background-color: #2d2d2d;\n --dv-tab-divider-color: #1e1e1e;\n --dv-activegroup-visiblepanel-tab-color: white;\n --dv-activegroup-hiddenpanel-tab-color: #969696;\n --dv-inactivegroup-visiblepanel-tab-color: #8f8f8f;\n --dv-inactivegroup-hiddenpanel-tab-color: #626262;\n --dv-separator-border: rgb(68, 68, 68);\n --dv-paneview-header-border-color: rgba(204, 204, 204, 0.2);\n --dv-activegroup-visiblepanel-tab-background-color: dodgerblue;\n --dv-tabs-and-actions-container-height: 18px;\n --dv-tabs-and-actions-container-font-size: 11px;\n}\n.dockview-theme-vs .groupview.active-group > .tabs-and-actions-container {\n border-bottom: 2px solid var(--dv-activegroup-visiblepanel-tab-background-color);\n}\n.dockview-theme-vs .groupview.inactive-group > .tabs-and-actions-container {\n border-bottom: 2px solid var(--dv-inactivegroup-visiblepanel-tab-background-color);\n}\n.actions-bar {\n text-align: right;\n width: 28px;\n display: flex;\n align-items: center;\n flex-shrink: 0;\n}\n.actions-bar .actions-container {\n display: flex;\n padding: 0px;\n margin: 0px;\n justify-content: flex-end;\n}\n.actions-bar .actions-container a:active {\n -webkit-mask-size: 100% 100% !important;\n mask-size: 100% 100% !important;\n}\n.actions-bar .actions-container .close-action {\n background-color: white;\n height: 16px;\n width: 16px;\n display: block;\n -webkit-mask: var(--dv-tab-close-icon) 50% 50%/90% 90% no-repeat;\n mask: var(--dv-tab-close-icon) 50% 50%/90% 90% no-repeat;\n margin-right: "0.5em";\n cursor: pointer;\n}\n.drop-target {\n position: relative;\n}\n.drop-target > .drop-target-dropzone {\n position: absolute;\n left: 0px;\n top: 0px;\n height: 100%;\n width: 100%;\n z-index: 10000;\n}\n.drop-target > .drop-target-dropzone > .drop-target-selection {\n position: relative;\n pointer-events: none;\n box-sizing: border-box;\n height: 100%;\n width: 100%;\n background-color: var(--dv-drag-over-background-color);\n transition-duration: 0.15s;\n transition-timing-function: ease-out;\n}\n.drop-target > .drop-target-dropzone > .drop-target-selection.left, .drop-target > .drop-target-dropzone > .drop-target-selection.right {\n width: 50%;\n}\n.drop-target > .drop-target-dropzone > .drop-target-selection.right {\n transform: translate(100%, 0%);\n}\n.drop-target > .drop-target-dropzone > .drop-target-selection.bottom {\n transform: translate(0%, 100%);\n}\n.drop-target > .drop-target-dropzone > .drop-target-selection.top, .drop-target > .drop-target-dropzone > .drop-target-selection.bottom {\n height: 50%;\n}\n.drop-target > .drop-target-dropzone > .drop-target-selection.small-top {\n border-top: 1px solid var(--dv-drag-over-border-color);\n}\n.drop-target > .drop-target-dropzone > .drop-target-selection.small-bottom {\n border-bottom: 1px solid var(--dv-drag-over-border-color);\n}\n.drop-target > .drop-target-dropzone > .drop-target-selection.small-left {\n border-left: 1px solid var(--dv-drag-over-border-color);\n}\n.drop-target > .drop-target-dropzone > .drop-target-selection.small-right {\n border-right: 1px solid var(--dv-drag-over-border-color);\n}\n.custom-dragging {\n height: 24px;\n line-height: 24px;\n font-size: 11px;\n width: 100px;\n background-color: dodgerblue;\n color: ghostwhite;\n border-radius: 11px;\n position: absolute;\n padding-left: 10px;\n}\n\n.groupview.active-group > .tabs-and-actions-container > .tabs-container > .tab.active-tab {\n background-color: var(--dv-activegroup-visiblepanel-tab-background-color);\n color: var(--dv-activegroup-visiblepanel-tab-color);\n}\n.groupview.active-group > .tabs-and-actions-container > .tabs-container > .tab.active-tab .tab-action {\n background-color: var(--dv-activegroup-visiblepanel-tab-color);\n}\n.groupview.active-group > .tabs-and-actions-container > .tabs-container > .tab.inactive-tab {\n background-color: var(--dv-activegroup-hiddenpanel-tab-background-color);\n color: var(--dv-activegroup-hiddenpanel-tab-color);\n}\n.groupview.active-group > .tabs-and-actions-container > .tabs-container > .tab.inactive-tab .tab-action {\n background-color: var(--dv-activegroup-hiddenpanel-tab-color);\n}\n.groupview.inactive-group > .tabs-and-actions-container > .tabs-container > .tab.active-tab {\n background-color: var(--dv-inactivegroup-visiblepanel-tab-background-color);\n color: var(--dv-inactivegroup-visiblepanel-tab-color);\n}\n.groupview.inactive-group > .tabs-and-actions-container > .tabs-container > .tab.active-tab .tab-action {\n background-color: var(--dv-inactivegroup-visiblepanel-tab-color);\n}\n.groupview.inactive-group > .tabs-and-actions-container > .tabs-container > .tab.inactive-tab {\n background-color: var(--dv-inactivegroup-hiddenpanel-tab-background-color);\n color: var(--dv-inactivegroup-hiddenpanel-tab-color);\n}\n.groupview.inactive-group > .tabs-and-actions-container > .tabs-container > .tab.inactive-tab .tab-action {\n background-color: var(--dv-inactivegroup-hiddenpanel-tab-color);\n}\n\n/**\n * when a tab is dragged we lose the above stylings because they are conditional on parent elements\n * therefore we also set some stylings for the dragging event\n **/\n.tab.dragging {\n background-color: var(--dv-activegroup-visiblepanel-tab-background-color);\n color: var(--dv-activegroup-visiblepanel-tab-color);\n}\n.grid-view,\n.branch-node {\n height: 100%;\n width: 100%;\n}\n.groupview {\n display: flex;\n flex-direction: column;\n height: 100%;\n background-color: var(--dv-group-view-background-color);\n overflow: hidden;\n}\n.groupview:focus {\n outline: none;\n}\n.groupview.empty > .tabs-and-actions-container {\n display: none;\n}\n.groupview > .content-container {\n flex-grow: 1;\n overflow: hidden;\n outline: none;\n}\n.pane-container {\n height: 100%;\n width: 100%;\n}\n.pane-container.animated .view {\n transition-duration: 0.15s;\n transition-timing-function: ease-out;\n}\n.pane-container .view {\n overflow: hidden;\n display: flex;\n flex-direction: column;\n padding: 0px !important;\n}\n.pane-container .view:not(:first-child)::before {\n background-color: transparent !important;\n}\n.pane-container .view:not(:first-child) .pane > .pane-header {\n border-top: 1px solid var(--dv-paneview-header-border-color);\n}\n.pane-container .view .default-header {\n background-color: var(--dv-group-view-background-color);\n color: var(--dv-activegroup-visiblepanel-tab-color);\n display: flex;\n padding: 0px 8px;\n}\n.pane-container .view .default-header > span {\n flex-grow: 1;\n}\n.pane-container:first-of-type > .pane > .pane-header {\n border-top: none !important;\n}\n.pane-container .pane {\n display: flex;\n flex-direction: column;\n overflow: hidden;\n height: 100%;\n}\n.pane-container .pane .pane-header {\n box-sizing: border-box;\n user-select: none;\n position: relative;\n outline: none;\n}\n.pane-container .pane .pane-header.pane-draggable {\n cursor: pointer;\n}\n.pane-container .pane .pane-header:focus:before, .pane-container .pane .pane-header:focus-within:before {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 5;\n content: "";\n pointer-events: none;\n outline: 1px solid;\n outline-width: -1px;\n outline-style: solid;\n outline-offset: -1px;\n outline-color: var(--dv-paneview-active-outline-color);\n}\n.pane-container .pane .pane-body {\n overflow-y: auto;\n overflow-x: hidden;\n flex-grow: 1;\n position: relative;\n outline: none;\n}\n.pane-container .pane .pane-body:focus:before, .pane-container .pane .pane-body:focus-within:before {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 5;\n content: "";\n pointer-events: none;\n outline: 1px solid;\n outline-width: -1px;\n outline-style: solid;\n outline-offset: -1px;\n outline-color: var(--dv-paneview-active-outline-color);\n}\n.tabs-and-actions-container {\n display: flex;\n background-color: var(--dv-tabs-and-actions-container-background-color);\n flex-shrink: 0;\n box-sizing: border-box;\n height: var(--dv-tabs-and-actions-container-height);\n font-size: var(--dv-tabs-and-actions-container-font-size);\n}\n.tabs-and-actions-container.hidden {\n display: none;\n}\n.tabs-and-actions-container .void-container {\n display: flex;\n flex-grow: 1;\n}\n.tabs-and-actions-container .tabs-container {\n display: flex;\n overflow-x: overlay;\n overflow-y: hidden;\n scrollbar-width: thin;\n /* Track */\n /* Handle */\n}\n.tabs-and-actions-container .tabs-container::-webkit-scrollbar {\n height: 3px;\n}\n.tabs-and-actions-container .tabs-container::-webkit-scrollbar-track {\n background: transparent;\n}\n.tabs-and-actions-container .tabs-container::-webkit-scrollbar-thumb {\n background: var(--dv-tabs-container-scrollbar-color);\n}\n.tabs-and-actions-container .tabs-container .tab {\n -webkit-user-drag: element;\n outline: none;\n min-width: 75px;\n cursor: pointer;\n position: relative;\n box-sizing: border-box;\n}\n.tabs-and-actions-container .tabs-container .tab:not(:first-child)::before {\n content: " ";\n position: absolute;\n top: 0;\n left: 0;\n z-index: 5;\n pointer-events: none;\n background-color: var(--dv-tab-divider-color);\n width: 1px;\n height: 100%;\n}\n.split-view-container {\n position: relative;\n overflow: hidden;\n height: 100%;\n width: 100%;\n}\n.split-view-container.animation .view,\n.split-view-container.animation .sash {\n transition-duration: 0.15s;\n transition-timing-function: ease-out;\n}\n.split-view-container.horizontal {\n height: 100%;\n}\n.split-view-container.horizontal > .sash-container > .sash {\n height: 100%;\n width: 4px;\n}\n.split-view-container.horizontal > .sash-container > .sash.enabled {\n cursor: ew-resize;\n}\n.split-view-container.horizontal > .sash-container > .sash.disabled {\n cursor: default;\n}\n.split-view-container.horizontal > .sash-container > .sash.maximum {\n cursor: w-resize;\n}\n.split-view-container.horizontal > .sash-container > .sash.minimum {\n cursor: e-resize;\n}\n.split-view-container.horizontal > .view-container > .view:not(:first-child)::before {\n height: 100%;\n width: 1px;\n}\n.split-view-container.vertical {\n width: 100%;\n}\n.split-view-container.vertical > .sash-container > .sash {\n width: 100%;\n height: 4px;\n}\n.split-view-container.vertical > .sash-container > .sash.enabled {\n cursor: ns-resize;\n}\n.split-view-container.vertical > .sash-container > .sash.disabled {\n cursor: default;\n}\n.split-view-container.vertical > .sash-container > .sash.maximum {\n cursor: n-resize;\n}\n.split-view-container.vertical > .sash-container > .sash.minimum {\n cursor: s-resize;\n}\n.split-view-container.vertical > .view-container > .view {\n width: 100%;\n}\n.split-view-container.vertical > .view-container > .view:not(:first-child)::before {\n height: 1px;\n width: 100%;\n}\n.split-view-container .sash-container {\n height: 100%;\n width: 100%;\n position: absolute;\n}\n.split-view-container .sash-container .sash {\n position: absolute;\n z-index: 99;\n outline: none;\n}\n.split-view-container .sash-container .sash:active {\n transition: background-color 0.1s ease-in-out;\n background-color: var(--dv-active-sash-color, transparent);\n}\n.split-view-container .sash-container .sash:hover {\n background-color: var(--dv-active-sash-color, transparent);\n transition: background-color 0.1s ease-in-out;\n transition-delay: 0.5s;\n}\n.split-view-container .view-container {\n position: relative;\n height: 100%;\n width: 100%;\n}\n.split-view-container .view-container .view {\n height: 100%;\n box-sizing: border-box;\n overflow: auto;\n position: absolute;\n}\n.split-view-container.separator-border .view:not(:first-child)::before {\n content: " ";\n position: absolute;\n top: 0;\n left: 0;\n z-index: 5;\n pointer-events: none;\n background-color: var(--dv-separator-border);\n}\n.dragged {\n transform: translate3d(0px, 0px, 0px);\n /* forces tab to be drawn on a separate layer (see https://github.com/microsoft/vscode/issues/18733) */\n}\n\n.tab {\n flex-shrink: 0;\n}\n.tab.dragging .tab-action {\n background-color: var(--dv-activegroup-visiblepanel-tab-color);\n}\n.tab.active-tab > .default-tab .tab-action {\n visibility: visible;\n}\n.tab.inactive-tab > .default-tab .tab-action:not(.dirty) {\n visibility: hidden;\n}\n.tab.inactive-tab > .default-tab:hover .tab-action {\n visibility: visible;\n}\n.tab .default-tab {\n position: relative;\n height: 100%;\n display: flex;\n min-width: 80px;\n align-items: center;\n padding-left: 10px;\n white-space: nowrap;\n text-overflow: elipsis;\n}\n.tab .default-tab .tab-content {\n flex-grow: 1;\n}\n.tab .default-tab .action-container {\n text-align: right;\n width: 28px;\n display: flex;\n}\n.tab .default-tab .action-container .tab-list {\n display: flex;\n padding: 0px;\n margin: 0px;\n justify-content: flex-end;\n}\n.tab .default-tab .action-container .tab-list a:active:hover {\n -webkit-mask-size: 100% 100% !important;\n mask-size: 100% 100% !important;\n}\n.tab .default-tab .action-container .tab-list .tab-action {\n height: 16px;\n width: 16px;\n display: block;\n -webkit-mask: var(--dv-tab-close-icon) 50% 50%/90% 90% no-repeat;\n mask: var(--dv-tab-close-icon) 50% 50%/90% 90% no-repeat;\n margin-right: "0.5em";\n}\n.tab .default-tab .action-container .tab-list .tab-action.disable-close {\n display: none;\n}\n.tab .default-tab .action-container .tab-list .tab-action.dirty:not(:hover) {\n display: block;\n -webkit-mask: var(--dv-tab-dirty-icon) 50% 50%/60% 60% no-repeat;\n mask: var(--dv-tab-dirty-icon) 50% 50%/60% 60% no-repeat;\n}\n.watermark {\n display: flex;\n width: 100%;\n}\n.watermark.has-actions .watermark-title .actions-bar {\n display: none;\n}\n.watermark .watermark-title {\n height: 35px;\n width: 100%;\n display: flex;\n}\n.watermark .watermark-content {\n flex-grow: 1;\n}'),e.Event=void 0,(e.Event||(e.Event={})).any=(...e)=>t=>{const i=e.map((e=>e(t)));return{dispose:()=>{i.forEach((e=>{e.dispose()}))}}};class a{constructor(e){this.options=e,this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=e=>{var t;return(null===(t=this.options)||void 0===t?void 0:t.replay)&&void 0!==this._last&&e(this._last),this._listeners.length,this._listeners.push(e),{dispose:()=>{const t=this._listeners.indexOf(e);t>-1&&this._listeners.splice(t,1)}}}),this._event}fire(e){this._last=e,this._listeners.forEach((t=>{t(e)}))}dispose(){this._listeners=[],this._disposed=!0}}function r(e,t,i,n){return e.addEventListener(t,i,n),{dispose:()=>{e.removeEventListener(t,i)}}}function h(e,t,i,n){return e.addEventListener(t,i,n),{dispose:()=>{e.removeEventListener(t,i)}}}class d{constructor(){this._onFired=new a,this.onEvent=this._onFired.event}fire(){this.timer&&clearTimeout(this.timer),this.timer=setTimeout((()=>{this._onFired.fire(),clearTimeout(this.timer)}))}dispose(){this._onFired.dispose()}}e.Disposable=void 0,(e.Disposable||(e.Disposable={})).NONE={dispose:()=>{}};class l{constructor(...e){this.disposables=e}static from(...e){return new l(...e)}addDisposables(...e){null==e||e.forEach((e=>this.disposables.push(e)))}dispose(){this.disposables.forEach((e=>e.dispose()))}}class p{constructor(){this._disposable=e.Disposable.NONE}set value(e){this._disposable&&this._disposable.dispose(),this._disposable=e}dispose(){this._disposable&&this._disposable.dispose()}}class c{constructor(){}}class u extends c{constructor(e,t,i){super(),this.viewId=e,this.groupId=t,this.panelId=i}}class m extends c{constructor(e,t){super(),this.viewId=e,this.paneId=t}}const v="splitview/transfer";var g;e.DragType=void 0,(g=e.DragType||(e.DragType={})).DOCKVIEW_TAB="dockview_tab",g.EXTERNAL="external_group_drag";class w{constructor(){}static getInstance(){return w.INSTANCE}hasData(e){return e&&e===this.proto}clearData(e){this.hasData(e)&&(this.proto=void 0,this.data=void 0)}getData(e){if(this.hasData(e))return this.data}setData(e,t){t&&(this.data=e,this.proto=t)}}function b(){const e=w.getInstance();if(e.hasData(u.prototype))return e.getData(u.prototype)[0]}function f(){const e=w.getInstance();if(e.hasData(m.prototype))return e.getData(m.prototype)[0]}w.INSTANCE=new w;class _{constructor(e){this.component=e}get minimumSize(){return this.component.minimumSize}get maximumSize(){return this.component.maximumSize}get height(){return this.component.height}get width(){return this.component.width}get length(){return this.component.length}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidAddView(){return this.component.onDidAddView}get onDidRemoveView(){return this.component.onDidRemoveView}get orientation(){return this.component.orientation}updateOptions(e){this.component.updateOptions(e)}removePanel(e,t){this.component.removePanel(e,t)}setVisible(e,t){this.component.setVisible(e,t)}getPanels(){return this.component.getPanels()}focus(){this.component.focus()}getPanel(e){return this.component.getPanel(e)}setActive(e){this.component.setActive(e)}layout(e,t){return this.component.layout(e,t)}addPanel(e){this.component.addPanel(e)}resizeToFit(){this.component.resizeToFit()}movePanel(e,t){this.component.movePanel(e,t)}fromJSON(e,t){this.component.fromJSON(e,t)}toJSON(){return this.component.toJSON()}}class C{constructor(e){this.component=e}get width(){return this.component.width}get height(){return this.component.height}get minimumSize(){return this.component.minimumSize}get maximumSize(){return this.component.maximumSize}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidAddView(){return this.component.onDidAddView}get onDidRemoveView(){return this.component.onDidRemoveView}get onDidDrop(){const e=new a,t=this.component.onDidDrop((t=>{e.fire(Object.assign(Object.assign({},t),{api:this}))}));return e.dispose=()=>{t.dispose(),e.dispose()},e.event}getPanels(){return this.component.getPanels()}removePanel(e){this.component.removePanel(e)}getPanel(e){return this.component.getPanel(e)}movePanel(e,t){this.component.movePanel(e,t)}focus(){this.component.focus()}layout(e,t){this.component.layout(e,t)}addPanel(e){return this.component.addPanel(e)}resizeToFit(){this.component.resizeToFit()}fromJSON(e,t){this.component.fromJSON(e,t)}toJSON(){return this.component.toJSON()}}class y{constructor(e){this.component=e}get width(){return this.component.width}get height(){return this.component.height}get minimumHeight(){return this.component.minimumHeight}get maximumHeight(){return this.component.maximumHeight}get minimumWidth(){return this.component.minimumWidth}get maximumWidth(){return this.component.maximumWidth}get onGridEvent(){return this.component.onGridEvent}get onDidLayoutChange(){return this.component.onDidLayoutChange}get panels(){return this.component.groups}get orientation(){return this.component.orientation}set orientation(e){this.component.updateOptions({orientation:e})}focus(){this.component.focus()}layout(e,t,i=!1){this.component.layout(e,t,i)}addPanel(e){this.component.addPanel(e)}removePanel(e,t){this.component.removePanel(e,t)}movePanel(e,t){this.component.movePanel(e,t)}resizeToFit(){this.component.resizeToFit()}getPanel(e){return this.component.getPanel(e)}toggleVisibility(e){this.component.toggleVisibility(e)}setVisible(e,t){this.component.setVisible(e,t)}setActive(e){this.component.setActive(e)}fromJSON(e,t){return this.component.fromJSON(e,t)}toJSON(){return this.component.toJSON()}}class D{constructor(e){this.component=e}get width(){return this.component.width}get height(){return this.component.height}get minimumHeight(){return this.component.minimumHeight}get maximumHeight(){return this.component.maximumHeight}get minimumWidth(){return this.component.minimumWidth}get maximumWidth(){return this.component.maximumWidth}get size(){return this.component.size}get totalPanels(){return this.component.totalPanels}get onGridEvent(){return this.component.onGridEvent}get onDidLayoutChange(){return this.component.onDidLayoutChange}get panels(){return this.component.panels}get groups(){return this.component.groups}get activePanel(){return this.component.activePanel}get activeGroup(){return this.component.activeGroup}getTabHeight(){return this.component.tabHeight}setTabHeight(e){this.component.tabHeight=e}focus(){this.component.focus()}getPanel(e){return this.component.getGroupPanel(e)}setActivePanel(e){this.component.setActivePanel(e)}layout(e,t,i=!1){this.component.layout(e,t,i)}addPanel(e){return this.component.addPanel(e)}removePanel(e){this.component.removePanel(e)}addEmptyGroup(e){this.component.addEmptyGroup(e)}moveToNext(e){this.component.moveToNext(e)}moveToPrevious(e){this.component.moveToPrevious(e)}closeAllGroups(){return this.component.closeAllGroups()}removeGroup(e){this.component.removeGroup(e)}resizeToFit(){return this.component.resizeToFit()}getGroup(e){return this.component.getPanel(e)}fromJSON(e){this.component.fromJSON(e)}toJSON(){return this.component.toJSON()}}function z(e,t){const i=new ResizeObserver((e=>{const i=e[0];t(i)}));return i.observe(e),{dispose:()=>{i.unobserve(e),i.disconnect()}}}const S=(e,...t)=>{for(const i of t)e.classList.contains(i)&&e.classList.remove(i)},x=(e,...t)=>{for(const i of t)e.classList.contains(i)||e.classList.add(i)},E=(e,t,i)=>{const n=e.classList.contains(t);i&&!n&&e.classList.add(t),!i&&n&&e.classList.remove(t)};function P(e,t){for(;e;){if(e===t)return!0;e=e.parentNode}return!1}function A(e){return Array.prototype.slice.call(document.getElementsByTagName(e),0)}function O(e){return new N(e)}class N extends l{constructor(e){super(),this._onDidFocus=new a,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new a,this.onDidBlur=this._onDidBlur.event;let t=P(document.activeElement,e),i=!1;const n=()=>{i=!1,t||(t=!0,this._onDidFocus.fire())},s=()=>{t&&(i=!0,window.setTimeout((()=>{i&&(i=!1,t=!1,this._onDidBlur.fire())}),0))};this._refreshStateHandler=()=>{P(document.activeElement,e)!==t&&(t?s():n())},e instanceof HTMLElement?(this.addDisposables(h(e,"focus",n,!0)),this.addDisposables(h(e,"blur",s,!0))):(this.addDisposables(r(e,"focus",n,!0)),this.addDisposables(r(e,"blur",s,!0)))}refreshState(){this._refreshStateHandler()}dispose(){super.dispose(),this._onDidBlur.dispose(),this._onDidFocus.dispose()}}const V=(e,t,i)=>{if(t>i)throw new Error(`${t} > ${i} is an invalid condition`);return Math.min(i,Math.max(e,t))},T=()=>{let e=1;return{next:()=>(e++).toString()}};function k(e){if(0===e.length)throw new Error("Invalid tail call");return[e.slice(0,e.length-1),e[e.length-1]]}function I(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0}function G(e,t){const i=e.indexOf(t);i>-1&&(e.splice(i,1),e.unshift(t))}function L(e,t){const i=e.indexOf(t);i>-1&&(e.splice(i,1),e.push(t))}const R=(e,t)=>{const i=[];if("number"!=typeof t&&(t=e,e=0),e<=t)for(let n=e;n<t;n++)i.push(n);else for(let n=e;n>t;n--)i.push(n);return i};class H{constructor(e,t,i,n){this.container=e,this.view=t,this.disposable=n,this._cachedVisibleSize=void 0,"number"==typeof i?(this._size=i,this._cachedVisibleSize=void 0,e.classList.add("visible")):(this._size=0,this._cachedVisibleSize=i.cachedVisibleSize)}set size(e){this._size=e}get size(){return this._size}get cachedVisibleSize(){return this._cachedVisibleSize}get visible(){return void 0===this._cachedVisibleSize}setVisible(e,t){var i;e!==this.visible&&(e?(this.size=V(null!==(i=this._cachedVisibleSize)&&void 0!==i?i:0,this.viewMinimumSize,this.viewMaximumSize),this._cachedVisibleSize=void 0):(this._cachedVisibleSize="number"==typeof t?t:this.size,this.size=0),this.container.classList.toggle("visible",e),this.view.setVisible&&this.view.setVisible(e))}get minimumSize(){return this.visible?this.view.minimumSize:0}get viewMinimumSize(){return this.view.minimumSize}get maximumSize(){return this.visible?this.view.maximumSize:0}get viewMaximumSize(){return this.view.maximumSize}get priority(){return this.view.priority}get snap(){return!!this.view.snap}set enabled(e){this.container.style.pointerEvents=e?"":"none"}dispose(){return this.disposable.dispose(),this.view}}var M,F,W,B,J;e.Orientation=void 0,(M=e.Orientation||(e.Orientation={})).HORIZONTAL="HORIZONTAL",M.VERTICAL="VERTICAL",e.SashState=void 0,(F=e.SashState||(e.SashState={}))[F.MAXIMUM=0]="MAXIMUM",F[F.MINIMUM=1]="MINIMUM",F[F.DISABLED=2]="DISABLED",F[F.ENABLED=3]="ENABLED",e.LayoutPriority=void 0,(W=e.LayoutPriority||(e.LayoutPriority={})).Low="low",W.High="high",W.Normal="normal",e.Sizing=void 0,(B=e.Sizing||(e.Sizing={})).Distribute={type:"distribute"},B.Split=function(e){return{type:"split",index:e}},B.Invisible=function(e){return{type:"invisible",cachedVisibleSize:e}};class j{constructor(e,t){this.container=e,this.views=[],this.sashes=[],this._size=0,this._orthogonalSize=0,this.contentSize=0,this._proportions=void 0,this._onDidSashEnd=new a,this.onDidSashEnd=this._onDidSashEnd.event,this._onDidAddView=new a,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new a,this.onDidRemoveView=this._onDidRemoveView.event,this._startSnappingEnabled=!0,this._endSnappingEnabled=!0,this.resize=(e,t,i=this.views.map((e=>e.size)),n,s,o=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY,r,h)=>{if(e<0||e>this.views.length)return 0;const d=R(e,-1),l=R(e+1,this.views.length);if(s)for(const e of s)G(d,e),G(l,e);if(n)for(const e of n)L(d,e),L(l,e);const p=d.map((e=>this.views[e])),c=d.map((e=>i[e])),u=l.map((e=>this.views[e])),m=l.map((e=>i[e])),v=d.reduce(((e,t)=>e+this.views[t].minimumSize-i[t]),0),g=d.reduce(((e,t)=>e+this.views[t].maximumSize-i[t]),0),w=0===l.length?Number.POSITIVE_INFINITY:l.reduce(((e,t)=>e+i[t]-this.views[t].minimumSize),0),b=0===l.length?Number.NEGATIVE_INFINITY:l.reduce(((e,t)=>e+i[t]-this.views[t].maximumSize),0),f=Math.max(v,b),_=Math.min(w,g);let C=!1;if(r){const e=this.views[r.index],i=t>=r.limitDelta;C=i!==e.visible,e.setVisible(i,r.size)}if(!C&&h){const e=this.views[h.index],i=t<h.limitDelta;C=i!==e.visible,e.setVisible(i,h.size)}if(C)return this.resize(e,t,i,n,s,o,a);let y=0,D=V(t,f,_);for(let e=0;e<p.length;e++){const t=p[e],i=V(c[e]+D,t.minimumSize,t.maximumSize),n=i-c[e];y+=n,D-=n,t.size=i}let z=y;for(let e=0;e<u.length;e++){const t=u[e],i=V(m[e]-z,t.minimumSize,t.maximumSize);z+=i-m[e],t.size=i}return t},this._orientation=t.orientation,this.element=this.createContainer(),this.proportionalLayout=void 0===t.proportionalLayout||!!t.proportionalLayout,this.viewContainer=this.createViewContainer(),this.sashContainer=this.createSashContainer(),this.element.appendChild(this.sashContainer),this.element.appendChild(this.viewContainer),this.container.appendChild(this.element),this.style(t.styles),t.descriptor&&(this._size=t.descriptor.size,t.descriptor.views.forEach(((e,t)=>{const i=void 0===e.visible||e.visible?e.size:{type:"invisible",cachedVisibleSize:e.size},n=e.view;this.addView(n,i,t,!0)})),this.contentSize=this.views.reduce(((e,t)=>e+t.size),0),this.saveProportions())}get size(){return this._size}set size(e){this._size=e}get orthogonalSize(){return this._orthogonalSize}set orthogonalSize(e){this._orthogonalSize=e}get length(){return this.views.length}get proportions(){return this._proportions?[...this._proportions]:void 0}get orientation(){return this._orientation}set orientation(t){this._orientation=t;const i=this.size;this.size=this.orthogonalSize,this.orthogonalSize=i,S(this.element,"horizontal","vertical"),this.element.classList.add(this.orientation==e.Orientation.HORIZONTAL?"horizontal":"vertical")}get minimumSize(){return this.views.reduce(((e,t)=>e+t.minimumSize),0)}get maximumSize(){return 0===this.length?Number.POSITIVE_INFINITY:this.views.reduce(((e,t)=>e+t.maximumSize),0)}get startSnappingEnabled(){return this._startSnappingEnabled}set startSnappingEnabled(e){this._startSnappingEnabled!==e&&(this._startSnappingEnabled=e,this.updateSashEnablement())}get endSnappingEnabled(){return this._endSnappingEnabled}set endSnappingEnabled(e){this._endSnappingEnabled!==e&&(this._endSnappingEnabled=e,this.updateSashEnablement())}style(e){"transparent"===(null==e?void 0:e.separatorBorder)?(S(this.element,"separator-border"),this.element.style.removeProperty("--dv-separator-border")):(x(this.element,"separator-border"),(null==e?void 0:e.separatorBorder)&&this.element.style.setProperty("--dv-separator-border",e.separatorBorder))}isViewVisible(e){if(e<0||e>=this.views.length)throw new Error("Index out of bounds");return this.views[e].visible}setViewVisible(e,t){if(e<0||e>=this.views.length)throw new Error("Index out of bounds");E(this.container,"visible",t);const i=this.views[e];E(this.container,"visible",t),i.setVisible(t,i.size),this.distributeEmptySpace(e),this.layoutViews(),this.saveProportions()}getViewSize(e){return e<0||e>=this.views.length?-1:this.views[e].size}resizeView(t,i){if(t<0||t>=this.views.length)return;const n=R(this.views.length).filter((e=>e!==t)),s=[...n.filter((t=>this.views[t].priority===e.LayoutPriority.Low)),t],o=n.filter((t=>this.views[t].priority===e.LayoutPriority.High)),a=this.views[t];i=Math.round(i),i=V(i,a.minimumSize,Math.min(a.maximumSize,this._size)),a.size=i,this.relayout(s,o)}getViews(){return this.views.map((e=>e.view))}onDidChange(e,t){const i=this.views.indexOf(e);i<0||i>=this.views.length||(t="number"==typeof t?t:e.size,t=V(t,e.minimumSize,e.maximumSize),e.size=t,this.relayout([i]))}addView(t,i={type:"distribute"},n=this.views.length,s){const o=document.createElement("div");let a;o.className="view",o.appendChild(t.element),a="number"==typeof i?i:"split"===i.type?this.getViewSize(i.index)/2:"invisible"===i.type?{cachedVisibleSize:i.cachedVisibleSize}:t.minimumSize;const r=t.onDidChange((e=>this.onDidChange(h,e))),h=new H(o,t,a,{dispose:()=>{null==r||r.dispose(),this.viewContainer.removeChild(o)}});if(n===this.views.length?this.viewContainer.appendChild(o):this.viewContainer.insertBefore(o,this.viewContainer.children.item(n)),this.views.splice(n,0,h),this.views.length>1){const t=document.createElement("div");t.className="sash";const i=i=>{for(const e of this.views)e.enabled=!1;const n=[...A("iframe"),...A("webview")];for(const e of n)e.style.pointerEvents="none";const s=this._orientation===e.Orientation.HORIZONTAL?i.clientX:i.clientY,o=function(e,t){for(let i=0;i<e.length;i++)if(t(e[i]))return i;return-1}(this.sashes,(e=>e.container===t)),a=this.views.map((e=>e.size));let r,h;const d=R(o,-1),l=R(o+1,this.views.length),p=d.reduce(((e,t)=>e+(this.views[t].minimumSize-a[t])),0),c=d.reduce(((e,t)=>e+(this.views[t].viewMaximumSize-a[t])),0),u=0===l.length?Number.POSITIVE_INFINITY:l.reduce(((e,t)=>e+(a[t]-this.views[t].minimumSize)),0),m=0===l.length?Number.NEGATIVE_INFINITY:l.reduce(((e,t)=>e+(a[t]-this.views[t].viewMaximumSize)),0),v=Math.max(p,m),g=Math.min(u,c),w=this.findFirstSnapIndex(d),b=this.findFirstSnapIndex(l);if("number"==typeof w){const e=this.views[w],t=Math.floor(e.viewMinimumSize/2);r={index:w,limitDelta:e.visible?v-t:v+t,size:e.size}}if("number"==typeof b){const e=this.views[b],t=Math.floor(e.viewMinimumSize/2);h={index:b,limitDelta:e.visible?g+t:g-t,size:e.size}}const f=t=>{const i=(this._orientation===e.Orientation.HORIZONTAL?t.clientX:t.clientY)-s;this.resize(o,i,a,void 0,void 0,v,g,r,h),this.distributeEmptySpace(),this.layoutViews()},_=()=>{for(const e of this.views)e.enabled=!0;for(const e of n)e.style.pointerEvents="auto";this.saveProportions(),document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",_),document.removeEventListener("mouseend",_),this._onDidSashEnd.fire(void 0)};document.addEventListener("mousemove",f),document.addEventListener("mouseup",_),document.addEventListener("mouseend",_)};t.addEventListener("mousedown",i);const n={container:t,disposable:()=>{t.removeEventListener("mousedown",i),this.sashContainer.removeChild(t)}};this.sashContainer.appendChild(t),this.sashes.push(n)}s||this.relayout([n]),s||"number"==typeof i||"distribute"!==i.type||this.distributeViewSizes(),this._onDidAddView.fire(t)}distributeViewSizes(){const t=[];let i=0;for(const e of this.views)e.maximumSize-e.minimumSize>0&&(t.push(e),i+=e.size);const n=Math.floor(i/t.length);for(const e of t)e.size=V(n,e.minimumSize,e.maximumSize);const s=R(this.views.length),o=s.filter((t=>this.views[t].priority===e.LayoutPriority.Low)),a=s.filter((t=>this.views[t].priority===e.LayoutPriority.High));this.relayout(o,a)}removeView(e,t,i=!1){const n=this.views.splice(e,1)[0];if(n.dispose(),this.views.length>=1){const t=Math.max(e-1,0);this.sashes.splice(t,1)[0].disposable()}return i||this.relayout(),t&&"distribute"===t.type&&this.distributeViewSizes(),this._onDidRemoveView.fire(n.view),n.view}getViewCachedVisibleSize(e){if(e<0||e>=this.views.length)throw new Error("Index out of bounds");return this.views[e].cachedVisibleSize}moveView(t,i){const n=this.getViewCachedVisibleSize(t),s=void 0===n?this.getViewSize(t):e.Sizing.Invisible(n),o=this.removeView(t,void 0,!0);this.addView(o,s,i)}layout(t,i){const n=Math.max(this.size,this.contentSize);if(this.size=t,this.orthogonalSize=i,this.proportions)for(let e=0;e<this.views.length;e++){const i=this.views[e];i.size=V(Math.round(this.proportions[e]*t),i.minimumSize,i.maximumSize)}else{const i=R(this.views.length),s=i.filter((t=>this.views[t].priority===e.LayoutPriority.Low)),o=i.filter((t=>this.views[t].priority===e.LayoutPriority.High));this.resize(this.views.length-1,t-n,void 0,s,o)}this.distributeEmptySpace(),this.layoutViews()}relayout(e,t){const i=this.views.reduce(((e,t)=>e+t.size),0);this.resize(this.views.length-1,this._size-i,void 0,e,t),this.distributeEmptySpace(),this.layoutViews(),this.saveProportions()}distributeEmptySpace(t){const i=this.views.reduce(((e,t)=>e+t.size),0);let n=this.size-i;const s=R(this.views.length-1,-1),o=s.filter((t=>this.views[t].priority===e.LayoutPriority.Low)),a=s.filter((t=>this.views[t].priority===e.LayoutPriority.High));for(const e of a)G(s,e);for(const e of o)L(s,e);"number"==typeof t&&L(s,t);for(let e=0;0!==n&&e<s.length;e++){const t=this.views[s[e]],i=V(t.size+n,t.minimumSize,t.maximumSize);n-=i-t.size,t.size=i}}saveProportions(){this.proportionalLayout&&this.contentSize>0&&(this._proportions=this.views.map((e=>e.size/this.contentSize)))}layoutViews(){this.contentSize=this.views.reduce(((e,t)=>e+t.size),0);let t=0;const i=[];this.updateSashEnablement();for(let n=0;n<this.views.length-1;n++){t+=this.views[n].size,i.push(t);const s=Math.min(Math.max(0,t-2),this.size-4);this._orientation===e.Orientation.HORIZONTAL&&(this.sashes[n].container.style.left=`${s}px`,this.sashes[n].container.style.top="0px"),this._orientation===e.Orientation.VERTICAL&&(this.sashes[n].container.style.left="0px",this.sashes[n].container.style.top=`${s}px`)}this.views.forEach(((t,n)=>{this._orientation===e.Orientation.HORIZONTAL&&(t.container.style.width=`${t.size}px`,t.container.style.left=0==n?"0px":`${i[n-1]}px`,t.container.style.top="",t.container.style.height=""),this._orientation===e.Orientation.VERTICAL&&(t.container.style.height=`${t.size}px`,t.container.style.top=0==n?"0px":`${i[n-1]}px`,t.container.style.width="",t.container.style.left=""),t.view.layout(t.size,this._orthogonalSize)}))}findFirstSnapIndex(e){for(const t of e){const e=this.views[t];if(e.visible&&e.snap)return t}for(const t of e){const e=this.views[t];if(e.visible&&e.maximumSize-e.minimumSize>0)return;if(!e.visible&&e.snap)return t}}updateSashEnablement(){let t=!1;const i=this.views.map((e=>t=e.size-e.minimumSize>0||t));t=!1;const n=this.views.map((e=>t=e.maximumSize-e.size>0||t)),s=[...this.views].reverse();t=!1;const o=s.map((e=>t=e.size-e.minimumSize>0||t)).reverse();t=!1;const a=s.map((e=>t=e.maximumSize-e.size>0||t)).reverse();let r=0;for(let t=0;t<this.sashes.length;t++){const s=this.sashes[t];r+=this.views[t].size;const h=!(i[t]&&a[t+1]),d=!(n[t]&&o[t+1]);if(h&&d){const n=R(t,-1),a=R(t+1,this.views.length),h=this.findFirstSnapIndex(n),d=this.findFirstSnapIndex(a),l="number"==typeof h&&!this.views[h].visible,p="number"==typeof d&&!this.views[d].visible;l&&o[t]&&(r>0||this.startSnappingEnabled)?this.updateSash(s,e.SashState.MINIMUM):p&&i[t]&&(r<this.contentSize||this.endSnappingEnabled)?this.updateSash(s,e.SashState.MAXIMUM):this.updateSash(s,e.SashState.DISABLED)}else h&&!d?this.updateSash(s,e.SashState.MINIMUM):!h&&d?this.updateSash(s,e.SashState.MAXIMUM):this.updateSash(s,e.SashState.ENABLED)}}updateSash(t,i){E(t.container,"disabled",i===e.SashState.DISABLED),E(t.container,"enabled",i===e.SashState.ENABLED),E(t.container,"maximum",i===e.SashState.MAXIMUM),E(t.container,"minimum",i===e.SashState.MINIMUM)}createViewContainer(){const e=document.createElement("div");return e.className="view-container",e}createSashContainer(){const e=document.createElement("div");return e.className="sash-container",e}createContainer(){const t=document.createElement("div"),i=this._orientation===e.Orientation.HORIZONTAL?"horizontal":"vertical";return t.className=`split-view-container ${i}`,t}dispose(){this._onDidSashEnd.dispose(),this._onDidAddView.dispose(),this._onDidRemoveView.dispose(),this.element.remove();for(let e=0;e<this.element.children.length;e++)if(this.element.children.item(e)===this.element){this.element.removeChild(this.element);break}}}class U extends l{constructor(t,i){var n;super(),this.paneItems=[],this.skipAnimation=!1,this._onDidChange=new a,this.onDidChange=this._onDidChange.event,this._orientation=null!==(n=i.orientation)&&void 0!==n?n:e.Orientation.VERTICAL,this.element=document.createElement("div"),this.element.className="pane-container",t.appendChild(this.element),this.splitview=new j(this.element,{orientation:this._orientation,proportionalLayout:!1,descriptor:i.descriptor}),this.getPanes().forEach(((e,t)=>{const i=new l(e.onDidChangeExpansionState((()=>{this.setupAnimation(),this._onDidChange.fire(void 0)}))),n={pane:e,disposable:{dispose:()=>{i.dispose()}}};this.paneItems.push(n),e.orthogonalSize=this.splitview.orthogonalSize})),this.addDisposables(this.splitview.onDidSashEnd((()=>{this._onDidChange.fire(void 0)})),this.splitview.onDidAddView((()=>{this._onDidChange.fire()})),this.splitview.onDidRemoveView((()=>{this._onDidChange.fire()})))}get onDidAddView(){return this.splitview.onDidAddView}get onDidRemoveView(){return this.splitview.onDidRemoveView}get minimumSize(){return this.splitview.minimumSize}get maximumSize(){return this.splitview.maximumSize}get orientation(){return this.splitview.orientation}get size(){return this.splitview.size}get orthogonalSize(){return this.splitview.orthogonalSize}addPane(e,t,i=this.splitview.length,n=!1){const s=e.onDidChangeExpansionState((()=>{this.setupAnimation(),this._onDidChange.fire(void 0)})),o={pane:e,disposable:{dispose:()=>{s.dispose()}}};this.paneItems.splice(i,0,o),e.orthogonalSize=this.splitview.orthogonalSize,this.splitview.addView(e,t,i,n)}getViewSize(e){return this.splitview.getViewSize(e)}getPanes(){return this.splitview.getViews()}removePane(e){const t=this.paneItems.splice(e,1)[0];return this.splitview.removeView(e),t.disposable.dispose(),t}moveView(e,t){if(e===t)return;const i=this.removePane(e);this.skipAnimation=!0;try{this.addPane(i.pane,i.pane.size,t,!1)}finally{this.skipAnimation=!1}}layout(e,t){this.splitview.layout(e,t)}setupAnimation(){this.skipAnimation||(this.animationTimer&&(clearTimeout(this.animationTimer),this.animationTimer=void 0),x(this.element,"animated"),this.animationTimer=setTimeout((()=>{this.animationTimer=void 0,S(this.element,"animated")}),200))}dispose(){super.dispose(),this.splitview.dispose(),this.animationTimer&&(clearTimeout(this.animationTimer),this.animationTimer=void 0),this.paneItems.forEach((e=>{e.disposable.dispose()})),this.paneItems=[],this.element.remove()}}class K extends l{constructor(e,t){super(),this.element=e,this.callbacks=t,this.counter=0,this.registerListeners()}registerListeners(){this.addDisposables(h(this.element,"dragenter",(e=>{this.counter++,this.callbacks.onDragEnter(e)}))),this.addDisposables(h(this.element,"dragover",(e=>{e.preventDefault(),this.callbacks.onDragOver&&this.callbacks.onDragOver(e)}))),this.addDisposables(h(this.element,"dragleave",(e=>{this.counter--,0===this.counter&&this.callbacks.onDragLeave(e)}))),this.addDisposables(h(this.element,"dragend",(e=>{this.counter=0,this.callbacks.onDragEnd(e)}))),this.addDisposables(h(this.element,"drop",(e=>{this.counter=0,this.callbacks.onDrop(e)})))}}e.Position=void 0,(J=e.Position||(e.Position={})).Top="Top",J.Left="Left",J.Bottom="Bottom",J.Right="Right",J.Center="Center";class $ extends l{constructor(t,i){super(),this.element=t,this.options=i,this._onDrop=new a,this.onDrop=this._onDrop.event,this.addDisposables(new K(this.element,{onDragEnter:e=>{},onDragOver:t=>{if("boolean"==typeof this.options.canDisplayOverlay){if(!this.options.canDisplayOverlay)return}else if(!this.options.canDisplayOverlay(t))return;if(this.target||(this.target=document.createElement("div"),this.target.className="drop-target-dropzone",this.overlay=document.createElement("div"),this.overlay.className="drop-target-selection",this._state=e.Position.Center,this.target.appendChild(this.overlay),this.element.classList.add("drop-target"),this.element.append(this.target)),"none"===this.options.validOverlays)return;if(!this.target||!this.overlay)return;const i=this.target.clientWidth,n=this.target.clientHeight;if(0===i||0===n)return;const s=100*t.offsetX/i,o=100*t.offsetY/n;let a=!1,r=!1,h=!1,d=!1;switch(this.options.validOverlays){case"all":a=s>80,r=s<20,h=!a&&!r&&o<20,d=!a&&!r&&o>80;break;case"vertical":h=o<50,d=o>=50;break;case"horizontal":r=s<50,a=s>=50}const l=i<100,p=n<100;E(this.overlay,"right",!l&&a),E(this.overlay,"left",!l&&r),E(this.overlay,"top",!p&&h),E(this.overlay,"bottom",!p&&d),E(this.overlay,"small-right",l&&a),E(this.overlay,"small-left",l&&r),E(this.overlay,"small-top",p&&h),E(this.overlay,"small-bottom",p&&d),this._state=a?e.Position.Right:r?e.Position.Left:h?e.Position.Top:d?e.Position.Bottom:e.Position.Center},onDragLeave:e=>{this.removeDropTarget()},onDragEnd:e=>{this.removeDropTarget()},onDrop:e=>{e.preventDefault(),e.stopPropagation();const t=this._state;this.removeDropTarget(),t&&this._onDrop.fire({position:t,nativeEvent:e})}}))}get state(){return this._state}set validOverlays(e){this.options.validOverlays=e}set canDisplayOverlay(e){this.options.canDisplayOverlay=e}dispose(){this._onDrop.dispose(),this.removeDropTarget()}removeDropTarget(){this.target&&(this._state=void 0,this.element.removeChild(this.target),this.target=void 0,this.element.classList.remove("drop-target"))}}class Z{constructor(t,i,n,s=0){this.view=t,this.orientation=i,this._onDidChange=new a,this.onDidChange=this._onDidChange.event,this._orthogonalSize=n,this._size=s,this._disposable=this.view.onDidChange((t=>{t?this._onDidChange.fire(this.orientation===e.Orientation.VERTICAL?t.width:t.height):this._onDidChange.fire(void 0)}))}get minimumWidth(){return this.view.minimumWidth}get maximumWidth(){return this.view.maximumWidth}get minimumHeight(){return this.view.minimumHeight}get maximumHeight(){return this.view.maximumHeight}get priority(){return this.view.priority}get snap(){return this.view.snap}get minimumSize(){return this.orientation===e.Orientation.HORIZONTAL?this.minimumHeight:this.minimumWidth}get maximumSize(){return this.orientation===e.Orientation.HORIZONTAL?this.maximumHeight:this.maximumWidth}get minimumOrthogonalSize(){return this.orientation===e.Orientation.HORIZONTAL?this.minimumWidth:this.minimumHeight}get maximumOrthogonalSize(){return this.orientation===e.Orientation.HORIZONTAL?this.maximumWidth:this.maximumHeight}get orthogonalSize(){return this._orthogonalSize}get size(){return this._size}get element(){return this.view.element}get width(){return this.orientation===e.Orientation.HORIZONTAL?this.orthogonalSize:this.size}get height(){return this.orientation===e.Orientation.HORIZONTAL?this.size:this.orthogonalSize}setVisible(e){this.view.setVisible&&(this.view.setVisible(e),this._onDidChange.fire(void 0))}layout(e,t){this._size=e,this._orthogonalSize=t,this.view.layout(this.width,this.height)}dispose(){this._disposable.dispose()}}class Y extends l{constructor(t,i,n,s,o,r){if(super(),this.orientation=t,this.proportionalLayout=i,this.styles=n,this.children=[],this._onDidChange=new a,this.onDidChange=this._onDidChange.event,this._childrenDisposable=e.Disposable.NONE,this._orthogonalSize=o,this._size=s,this.element=document.createElement("div"),this.element.className="branch-node",r){const e={views:r.map((e=>({view:e.node,size:e.node.size,visible:!(e.node instanceof Z&&void 0!==e.visible)||e.visible}))),size:this.orthogonalSize};this.children=r.map((e=>e.node)),this.splitview=new j(this.element,{orientation:this.orientation,descriptor:e,proportionalLayout:i})}else this.splitview=new j(this.element,{orientation:this.orientation,proportionalLayout:i,styles:n}),this.splitview.layout(this.size,this.orthogonalSize);this.addDisposables(this.splitview.onDidSashEnd((()=>{this._onDidChange.fire(void 0)}))),this.setupChildrenEvents()}get width(){return this.orientation===e.Orientation.HORIZONTAL?this.size:this.orthogonalSize}get height(){return this.orientation===e.Orientation.HORIZONTAL?this.orthogonalSize:this.size}get minimumSize(){return 0===this.children.length?0:Math.max(...this.children.map((e=>e.minimumOrthogonalSize)))}get maximumSize(){return Math.min(...this.children.map((e=>e.maximumOrthogonalSize)))}get minimumOrthogonalSize(){return this.splitview.minimumSize}get maximumOrthogonalSize(){return this.splitview.maximumSize}get orthogonalSize(){return this._orthogonalSize}get size(){return this._size}get minimumWidth(){return this.orientation===e.Orientation.HORIZONTAL?this.minimumOrthogonalSize:this.minimumSize}get minimumHeight(){return this.orientation===e.Orientation.HORIZONTAL?this.minimumSize:this.minimumOrthogonalSize}get maximumWidth(){return this.orientation===e.Orientation.HORIZONTAL?this.maximumOrthogonalSize:this.maximumSize}get maximumHeight(){return this.orientation===e.Orientation.HORIZONTAL?this.maximumSize:this.maximumOrthogonalSize}get priority(){if(0===this.children.length)return e.LayoutPriority.Normal;const t=this.children.map((t=>void 0===t.priority?e.LayoutPriority.Normal:t.priority));return t.some((t=>t===e.LayoutPriority.High))?e.LayoutPriority.High:t.some((t=>t===e.LayoutPriority.Low))?e.LayoutPriority.Low:e.LayoutPriority.Normal}setVisible(e){for(const t of this.children)t.setVisible(e)}isChildVisible(e){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.isViewVisible(e)}setChildVisible(e,t){if(e<0||e>=this.children.length)throw new Error("Invalid index");this.splitview.isViewVisible(e)!==t&&this.splitview.setViewVisible(e,t)}moveChild(e,t){if(e===t)return;if(e<0||e>=this.children.length)throw new Error("Invalid from index");e<t&&t--,this.splitview.moveView(e,t);const i=this._removeChild(e);this._addChild(i,t)}getChildSize(e){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.getViewSize(e)}resizeChild(e,t){if(e<0||e>=this.children.length)throw new Error("Invalid index");this.splitview.resizeView(e,t)}layout(e,t){this._size=t,this._orthogonalSize=e,this.splitview.layout(this.size,this.orthogonalSize)}addChild(e,t,i,n){if(i<0||i>this.children.length)throw new Error("Invalid index");this.splitview.addView(e,t,i,n),this._addChild(e,i)}getChildCachedVisibleSize(e){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.getViewCachedVisibleSize(e)}removeChild(e,t){if(e<0||e>=this.children.length)throw new Error("Invalid index");this.splitview.removeView(e,t),this._removeChild(e)}_addChild(e,t){this.children.splice(t,0,e),this.setupChildrenEvents()}_removeChild(e){const[t]=this.children.splice(e,1);return this.setupChildrenEvents(),t}setupChildrenEvents(){this._childrenDisposable.dispose(),this._childrenDisposable=e.Event.any(...this.children.map((e=>e.onDidChange)))((e=>{this._onDidChange.fire(void 0)}))}dispose(){super.dispose(),this._childrenDisposable.dispose(),this.children.forEach((e=>e.dispose())),this.splitview.dispose()}}function X(e,t,i){if(e instanceof Y){const n=new Y(ne(e.orientation),e.proportionalLayout,e.styles,t,i);let s=0;for(let o=e.children.length-1;o>=0;o--){const a=e.children[o],r=a instanceof Y?a.orthogonalSize:a.size;let h=0===e.size?0:Math.round(t*r/e.size);s+=h,0===o&&(h+=t-s),n.addChild(X(a,i,h),h,0,!0)}return n}return new Z(e.view,ne(e.orientation),i)}function q(e){const t=e.parentElement;if(!t)throw new Error("Invalid grid element");let i=t.firstElementChild,n=0;for(;i!==e&&i!==t.lastElementChild&&i;)i=i.nextElementSibling,n++;return n}function Q(e){const t=e.parentElement;if(!t)throw new Error("Invalid grid element");if(/\bgrid-view\b/.test(t.className))return[];const i=q(t);return[...Q(t.parentElement.parentElement.parentElement),i]}function ee(t,i,n){if(ie(t,i)===te(n)){const[t,s]=k(i);let o=s;return n!==e.Position.Right&&n!==e.Position.Bottom||(o+=1),[...t,o]}{const t=n===e.Position.Right||n===e.Position.Bottom?1:0;return[...i,t]}}function te(t){return t===e.Position.Top||t===e.Position.Bottom?e.Orientation.VERTICAL:e.Orientation.HORIZONTAL}function ie(e,t){return t.length%2==0?ne(e):e}const ne=t=>t===e.Orientation.HORIZONTAL?e.Orientation.VERTICAL:e.Orientation.HORIZONTAL;function se(e){return!!e.children}const oe=(t,i)=>{const n=i===e.Orientation.VERTICAL?t.box.width:t.box.height;return se(t)?{type:"branch",data:t.children.map((e=>oe(e,ne(i)))),size:n}:"number"==typeof t.cachedVisibleSize?{type:"leaf",data:t.view.toJSON(),size:t.cachedVisibleSize,visible:!1}:{type:"leaf",data:t.view.toJSON(),size:n}};class ae{constructor(e,t,i){this.proportionalLayout=e,this.styles=t,this.disposable=new p,this._onDidChange=new a,this.onDidChange=this._onDidChange.event,this.element=document.createElement("div"),this.element.className="grid-view",this.root=new Y(i,e,t,0,0)}serialize(){return{root:oe(this.getView(),this.orientation),width:this.width,height:this.height,orientation:this.orientation}}dispose(){this.disposable.dispose(),this._onDidChange.dispose(),this.root.dispose()}clear(){const e=this.root.orientation;this.root=new Y(e,this.proportionalLayout,this.styles,this.root.size,this.root.orthogonalSize)}deserialize(e,t){const i=e.orientation,n=e.height;this._deserialize(e.root,i,t,n)}_deserialize(e,t,i,n){this.root=this._deserializeNode(e,t,i,n)}_deserializeNode(e,t,i,n){let s;if("branch"===e.type){const o=e.data.map((n=>({node:this._deserializeNode(n,ne(t),i,e.size),visible:n.visible})));s=new Y(t,this.proportionalLayout,this.styles,e.size,n,o)}else s=new Z(i.fromJSON(e),t,n,e.size);return s}get orientation(){return this.root.orientation}set orientation(e){if(this.root.orientation===e)return;const{size:t,orthogonalSize:i}=this.root;this.root=X(this.root,i,t),this.root.layout(t,i)}get root(){return this._root}set root(e){const t=this._root;t&&(t.dispose(),this.element.removeChild(t.element)),this._root=e,this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange((e=>{this._onDidChange.fire(e)}))}next(e){return this.progmaticSelect(e)}previous(e){return this.progmaticSelect(e,!0)}getView(e){const t=e?this.getNode(e)[1]:this.root;return this._getViews(t,this.orientation)}_getViews(e,t,i){const n={height:e.height,width:e.width};if(e instanceof Z)return{box:n,view:e.view,cachedVisibleSize:i};const s=[];for(let i=0;i<e.children.length;i++){const n=e.children[i],o=e.getChildCachedVisibleSize(i);s.push(this._getViews(n,ne(t),o))}return{box:n,children:s}}progmaticSelect(e,t=!1){const[i,n]=this.getNode(e);if(!(n instanceof Z))throw new Error("invalid location");const s=(e,t)=>{if(e instanceof Z)return e;if(e instanceof Y)return s(e.children[t?e.children.length-1:0],t);throw new Error("invalid node")};for(let n=i.length-1;n>-1;n--){const o=i[n],a=e[n]||0;if(t?a-1>-1:a+1<o.children.length)return s(o.children[t?a-1:a+1],t)}return s(this.root,t)}get width(){return this.root.width}get height(){return this.root.height}get minimumWidth(){return this.root.minimumWidth}get minimumHeight(){return this.root.minimumHeight}get maximumWidth(){return this.root.maximumHeight}get maximumHeight(){return this.root.maximumHeight}isViewVisible(e){const[t,i]=k(e),[,n]=this.getNode(t);if(!(n instanceof Y))throw new Error("Invalid from location");return n.isChildVisible(i)}setViewVisible(e,t){const[i,n]=k(e),[,s]=this.getNode(i);if(!(s instanceof Y))throw new Error("Invalid from location");s.setChildVisible(n,t)}moveView(e,t,i){const[,n]=this.getNode(e);if(!(n instanceof Y))throw new Error("Invalid location");n.moveChild(t,i)}addView(t,i,n){const[s,o]=k(n),[a,r]=this.getNode(s);if(r instanceof Y){const e=new Z(t,ne(r.orientation),r.orthogonalSize);r.addChild(e,i,o)}else{const[n,...h]=[...a].reverse(),[d,...l]=[...s].reverse();let p=0;const c=n.getChildCachedVisibleSize(d);"number"==typeof c&&(p=e.Sizing.Invisible(c)),n.removeChild(d);const u=new Y(r.orientation,this.proportionalLayout,this.styles,r.size,r.orthogonalSize);n.addChild(u,r.size,d);const m=new Z(r.view,n.orientation,r.size);u.addChild(m,p,0),"number"!=typeof i&&"split"===i.type&&(i={type:"split",index:0});const v=new Z(t,n.orientation,r.size);u.addChild(v,i,o)}}remove(e,t){const i=Q(e.element);return this.removeView(i,t)}removeView(t,i){const[n,s]=k(t),[o,a]=this.getNode(n);if(!(a instanceof Y))throw new Error("Invalid location");const r=a.children[s];if(!(r instanceof Z))throw new Error("Invalid location");if(a.removeChild(s,i),0===a.children.length)return r.view;if(a.children.length>1)return r.view;if(0===o.length){const e=a.children[0];return e instanceof Z||(a.removeChild(0,i),this.root=e),r.view}const[h,...d]=[...o].reverse(),[l,...p]=[...n].reverse(),c=a.children[0],u=a.isChildVisible(0);a.removeChild(0,i);const m=h.children.map(((e,t)=>h.getChildSize(t)));if(h.removeChild(l,i),c instanceof Y){m.splice(l,1,...c.children.map((e=>e.size)));for(let e=0;e<c.children.length;e++){const t=c.children[e];h.addChild(t,t.size,l+e)}}else{const t=new Z(c.view,ne(c.orientation),c.size),i=u?c.orthogonalSize:e.Sizing.Invisible(c.orthogonalSize);h.addChild(t,i,l)}for(let e=0;e<m.length;e++)h.resizeChild(e,m[e]);return r.view}layout(t,i){const[n,s]=this.root.orientation===e.Orientation.HORIZONTAL?[i,t]:[t,i];this.root.layout(n,s)}getNode(e,t=this.root,i=[]){if(0===e.length)return[i,t];if(!(t instanceof Y))throw new Error("Invalid location");const[n,...s]=e;if(n<0||n>=t.children.length)throw new Error("Invalid location");const o=t.children[n];return i.push(t),this.getNode(s,o,i)}}
|
|
8
8
|
/*! *****************************************************************************
|
|
9
9
|
Copyright (c) Microsoft Corporation.
|
|
10
10
|
|
|
@@ -18,4 +18,4 @@
|
|
|
18
18
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
19
19
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
20
20
|
PERFORMANCE OF THIS SOFTWARE.
|
|
21
|
-
***************************************************************************** */function re(e,t,i,n){return new(i||(i=Promise))((function(s,o){function a(e){try{h(n.next(e))}catch(e){o(e)}}function r(e){try{h(n.throw(e))}catch(e){o(e)}}function h(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,r)}h((n=n.apply(e,t||[])).next())}))}class he extends l{constructor(){super(),this.disposable=new p,this._onDidFocus=new a,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new a,this.onDidBlur=this._onDidBlur.event,this._element=document.createElement("div"),this._element.className="content-container",this._element.tabIndex=-1}get element(){return this._element}show(){this.element.style.display=""}hide(){this.element.style.display="none"}openPanel(e){var t;if(this.panel===e)return;this.panel&&((null===(t=this.panel.view)||void 0===t?void 0:t.content)&&this._element.removeChild(this.panel.view.content.element),this.panel=void 0),this.panel=e;const i=new l;if(this.panel.view){const e=this.panel.view.content.onDidFocus,t=this.panel.view.content.onDidBlur,{onDidFocus:n,onDidBlur:s}=O(this._element);i.addDisposables(n((()=>this._onDidFocus.fire())),s((()=>this._onDidBlur.fire()))),e&&i.addDisposables(e((()=>this._onDidFocus.fire()))),t&&i.addDisposables(t((()=>this._onDidBlur.fire()))),this._element.appendChild(this.panel.view.content.element)}this.disposable.value=i}layout(e,t){}closePanel(){var e,t,i;(null===(i=null===(t=null===(e=this.panel)||void 0===e?void 0:e.view)||void 0===t?void 0:t.content)||void 0===i?void 0:i.element)&&(this._element.removeChild(this.panel.view.content.element),this.panel=void 0)}dispose(){this.disposable.dispose(),super.dispose()}}var de,le,pe,ce;!function(e){e[e.Tab=0]="Tab",e[e.Panel=1]="Panel",e[e.TabContainer=2]="TabContainer"}(de||(de={})),e.MouseEventKind=void 0,(le=e.MouseEventKind||(e.MouseEventKind={})).CLICK="CLICK",le.CONTEXT_MENU="CONTEXT_MENU";class ue extends l{constructor(t,i,n){super(),this.panelId=t,this.accessor=i,this.group=n,this._onChanged=new a,this.onChanged=this._onChanged.event,this._onDropped=new a,this.onDrop=this._onDropped.event,this.panelTransfer=w.getInstance(),this.iframes=[],this.addDisposables(this._onChanged,this._onDropped),this._element=document.createElement("div"),this._element.className="tab",this._element.tabIndex=0,this._element.draggable=!0,this.addDisposables(h(this._element,"dragstart",(e=>{this.iframes=[...A("iframe"),...A("webview")];for(const e of this.iframes)e.style.pointerEvents="none";this.element.classList.add("dragged"),setTimeout((()=>this.element.classList.remove("dragged")),0),this.panelTransfer.setData([new u(this.accessor.id,this.group.id,this.panelId)],u.prototype),e.dataTransfer&&(e.dataTransfer.effectAllowed="move")})),h(this._element,"dragend",(e=>{for(const e of this.iframes)e.style.pointerEvents="auto";this.iframes=[],this.panelTransfer.clearData(u.prototype)})),h(this._element,"mousedown",(t=>{t.defaultPrevented||(t.stopPropagation(),this._onChanged.fire({kind:e.MouseEventKind.CLICK,event:t}))})),h(this._element,"contextmenu",(t=>{this._onChanged.fire({kind:e.MouseEventKind.CONTEXT_MENU,event:t})}))),this.droptarget=new $(this._element,{validOverlays:"none",canDisplayOverlay:e=>{const t=b();return t?this.panelId!==t.panelId:this.group.model.canDisplayOverlay(e,de.Tab)}}),this.addDisposables(this.droptarget.onDrop((e=>{this._onDropped.fire(e)})))}get element(){return this._element}setActive(e){E(this.element,"active-tab",e),E(this.element,"inactive-tab",!e)}setContent(e){this.content&&this._element.removeChild(this.content.element),this.content=e,this._element.appendChild(this.content.element)}dispose(){super.dispose(),this.droptarget.dispose()}}class me extends l{constructor(e,t,i){super(),this.accessor=e,this.group=t,this.tabs=[],this.selectedIndex=-1,this.active=!1,this._onDrop=new a,this.onDrop=this._onDrop.event,this.addDisposables(this._onDrop),this._element=document.createElement("div"),this._element.className="tabs-and-actions-container",this.height=i.tabHeight,this.actionContainer=document.createElement("div"),this.actionContainer.className="action-container",this.tabContainer=document.createElement("div"),this.tabContainer.className="tabs-container",this.voidContainer=document.createElement("div"),this.voidContainer.className="void-container",this._element.appendChild(this.tabContainer),this._element.appendChild(this.voidContainer),this._element.appendChild(this.actionContainer),this.voidDropTarget=new $(this.voidContainer,{validOverlays:"none",canDisplayOverlay:e=>{var i;const n=b();return n?(null===(i=(s=this.tabs).length>0?s[s.length-1]:void 0)||void 0===i?void 0:i.value.panelId)!==n.panelId:t.model.canDisplayOverlay(e,de.Panel);var s}}),this.addDisposables(this.voidDropTarget.onDrop((e=>{this._onDrop.fire({event:e.nativeEvent,index:this.tabs.length})})),this.voidDropTarget,h(this.tabContainer,"mousedown",(e=>{if(e.defaultPrevented)return;0===e.button&&this.accessor.doSetGroupActive(this.group)})))}get panels(){return this.tabs.map((e=>e.value.panelId))}get size(){return this.tabs.length}get height(){return this._height}set height(e){this._height=e,"number"!=typeof e?this.element.style.removeProperty("--dv-tabs-and-actions-container-height"):this.element.style.setProperty("--dv-tabs-and-actions-container-height",`${e}px`)}show(){this.element.style.display=""}hide(){this.element.style.display="none"}setActionElement(e){this.actions!==e&&(this.actions&&(this.actions.remove(),this.actions=void 0),e&&(this.actionContainer.appendChild(e),this.actions=e))}get element(){return this._element}isActive(e){return this.selectedIndex>-1&&this.tabs[this.selectedIndex].value===e}at(e){var t;return null===(t=this.tabs[e])||void 0===t?void 0:t.value}indexOf(e){return this.tabs.findIndex((t=>t.value.panelId===e))}setActive(e){this.active=e}addTab(e,t=this.tabs.length){if(t<0||t>this.tabs.length)throw new Error("invalid location");this.tabContainer.insertBefore(e.value.element,this.tabContainer.children[t]),this.tabs=[...this.tabs.slice(0,t),e,...this.tabs.slice(t)],this.selectedIndex<0&&(this.selectedIndex=t)}delete(e){const t=this.tabs.findIndex((t=>t.value.panelId===e)),i=this.tabs.splice(t,1)[0],{value:n,disposable:s}=i;s.dispose(),n.element.remove()}setActivePanel(e){this.tabs.forEach((t=>{const i=e.id===t.value.panelId;t.value.setActive(i)}))}openPanel(t,i=this.tabs.length){var n;if(this.tabs.find((e=>e.value.panelId===t.id)))return;const s=new ue(t.id,this.accessor,this.group);if(!(null===(n=t.view)||void 0===n?void 0:n.tab))throw new Error("invalid header component");s.setContent(t.view.tab);const o=l.from(s.onChanged((i=>{var n;const s=t.id===(null===(n=this.group.model.activePanel)||void 0===n?void 0:n.id)&&this.group.model.isContentFocused();this.accessor.fireMouseEvent(Object.assign(Object.assign({},i),{panel:t,tab:!0}));if(0===i.event.button&&!i.event.defaultPrevented&&i.kind===e.MouseEventKind.CLICK)this.group.model.openPanel(t,{skipFocus:s})})),s.onDrop((e=>{this._onDrop.fire({event:e.nativeEvent,index:this.tabs.findIndex((e=>e.value===s))})}))),a={value:s,disposable:o};this.addTab(a,i),this.activePanel=t}closePanel(e){this.delete(e.id)}dispose(){super.dispose(),this.tabs.forEach((e=>{e.disposable.dispose()})),this.tabs=[]}}e.GroupChangeKind2=void 0,(pe=e.GroupChangeKind2||(e.GroupChangeKind2={})).ADD_PANEL="ADD_PANEL",pe.REMOVE_PANEL="REMOVE_PANEL",pe.PANEL_ACTIVE="PANEL_ACTIVE",pe.GROUP_ACTIVE="GROUP_ACTIVE";class ve extends l{constructor(t,i,n,s,o){super(),this.container=t,this.accessor=i,this.id=n,this.options=s,this.parent=o,this._isGroupActive=!1,this.mostRecentlyUsed=[],this._onDidChange=new a,this.onDidChange=this._onDidChange.event,this._width=0,this._height=0,this._panels=[],this._onMove=new a,this.onMove=this._onMove.event,this._onDidGroupChange=new a,this.onDidGroupChange=this._onDidGroupChange.event,this.closePanel=e=>re(this,void 0,void 0,(function*(){return!(e.close&&!(yield e.close()))&&(this.doClose(e),!0)})),this.container.classList.add("groupview"),this.addDisposables(this._onMove,this._onDidGroupChange),this.tabsContainer=new me(this.accessor,this.parent,{tabHeight:s.tabHeight}),this.contentContainer=new he,this.dropTarget=new $(this.contentContainer.element,{validOverlays:"all",canDisplayOverlay:e=>{const t=b();if(t){return!(1===this._panels.length&&t.groupId===this.id)}return this.canDisplayOverlay(e,de.Panel)}}),t.append(this.tabsContainer.element,this.contentContainer.element),this.addDisposables(this._onMove,this._onDidGroupChange,this.tabsContainer.onDrop((t=>{this.handleDropEvent(t.event,e.Position.Center,t.index)})),this.contentContainer.onDidFocus((()=>{this.accessor.doSetGroupActive(this.parent,!0)})),this.contentContainer.onDidBlur((()=>{})),this.dropTarget.onDrop((e=>{this.handleDropEvent(e.nativeEvent,e.position)})))}get element(){throw new Error("not supported")}get activePanel(){return this._activePanel}get tabHeight(){return this.tabsContainer.height}set tabHeight(e){this.tabsContainer.height=e,this.layout(this._width,this._height)}get isActive(){return this._isGroupActive}get panels(){return this._panels}get size(){return this._panels.length}get isEmpty(){return 0===this._panels.length}get minimumHeight(){return 100}get maximumHeight(){return Number.MAX_SAFE_INTEGER}get minimumWidth(){return 100}get maximumWidth(){return Number.MAX_SAFE_INTEGER}initialize(){var e,t;(null===(e=this.options)||void 0===e?void 0:e.panels)&&this.options.panels.forEach((e=>{this.doAddPanel(e)})),(null===(t=this.options)||void 0===t?void 0:t.activePanel)&&this.openPanel(this.options.activePanel),this.setActive(this.isActive,!0,!0),this.updateContainer()}isContentFocused(){return!!document.activeElement&&P(document.activeElement,this.contentContainer.element)}indexOf(e){return this.tabsContainer.indexOf(e.id)}toJSON(){var e;return{views:this.tabsContainer.panels,activeView:null===(e=this._activePanel)||void 0===e?void 0:e.id,id:this.id}}moveToNext(e){e||(e={}),e.panel||(e.panel=this.activePanel);const t=e.panel?this.panels.indexOf(e.panel):-1;let i;if(t<this.panels.length-1)i=t+1;else{if(e.suppressRoll)return;i=0}this.openPanel(this.panels[i])}moveToPrevious(e){if(e||(e={}),e.panel||(e.panel=this.activePanel),!e.panel)return;const t=this.panels.indexOf(e.panel);let i;if(t>0)i=t-1;else{if(e.suppressRoll)return;i=this.panels.length-1}this.openPanel(this.panels[i])}containsPanel(e){return this.panels.includes(e)}init(e){}update(e){}focus(){var e;null===(e=this._activePanel)||void 0===e||e.focus()}openPanel(e,t={}){("number"!=typeof t.index||t.index>this.panels.length)&&(t.index=this.panels.length),this._activePanel!==e?(this.doAddPanel(e,t.index),this.doSetActivePanel(e),this.accessor.doSetGroupActive(this.parent,!!t.skipFocus),this.updateContainer()):this.accessor.doSetGroupActive(this.parent)}removePanel(e){const t="string"==typeof e?e:e.id,i=this._panels.find((e=>e.id===t));if(!i)throw new Error("invalid operation");return this._removePanel(i)}closeAllPanels(){var e;return re(this,void 0,void 0,(function*(){const t=this._activePanel?this.panels.indexOf(this._activePanel):-1;if(this._activePanel&&t>-1){this.panels.indexOf(this._activePanel)<0&&console.warn("active panel not tracked");if(!(!(null===(e=this._activePanel)||void 0===e?void 0:e.close)||(yield this._activePanel.close())))return!1}for(let e=0;e<this.panels.length;e++){if(e===t)continue;const i=this.panels[e];if(this.openPanel(i),i.close){if(!(yield i.close()))return!1}}if(this.panels.length>0){const e=[...this.panels];yield Promise.all(e.map((e=>this.doClose(e))))}else this.accessor.removeGroup(this.parent);return!0}))}doClose(e){this.accessor.removePanel(e)}isPanelActive(e){return this._activePanel===e}updateActions(){var e,t;this.isActive&&(null===(t=null===(e=this._activePanel)||void 0===e?void 0:e.view)||void 0===t?void 0:t.actions)?this.tabsContainer.setActionElement(this._activePanel.view.actions.element):this.tabsContainer.setActionElement(void 0)}setActive(e,t=!1,i=!1){var n,s;i||this.isActive!==e?(this._isGroupActive=e,E(this.container,"active-group",e),E(this.container,"inactive-group",!e),this.tabsContainer.setActive(this.isActive),!this._activePanel&&this.panels.length>0&&this.doSetActivePanel(this.panels[0]),this.updateContainer(),e&&(t||null===(s=this._activePanel)||void 0===s||s.focus())):t||null===(n=this._activePanel)||void 0===n||n.focus()}layout(e,t){var i;this._width=e,this._height=t,this.contentContainer.layout(this._width,this._height),(null===(i=this._activePanel)||void 0===i?void 0:i.layout)&&this._activePanel.layout(this._width,this._height)}_removePanel(e){const t=this._activePanel===e;if(this.doRemovePanel(e),t&&this.panels.length>0){const e=this.mostRecentlyUsed[0];this.openPanel(e)}return this._activePanel&&0===this.panels.length&&this.doSetActivePanel(void 0),this.updateContainer(),e}doRemovePanel(t){const i=this.panels.indexOf(t);this._activePanel===t&&this.contentContainer.closePanel(),this.tabsContainer.delete(t.id),this._panels.splice(i,1),this.mostRecentlyUsed.includes(t)&&this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(t),1),this._onDidGroupChange.fire({kind:e.GroupChangeKind2.REMOVE_PANEL,panel:t})}doAddPanel(t,i=this.panels.length){const n=this._panels.indexOf(t)>-1;this.tabsContainer.openPanel(t,i),this.contentContainer.openPanel(t),this.tabsContainer.show(),this.contentContainer.show(),n||(this.updateMru(t),this.panels.splice(i,0,t),this._onDidGroupChange.fire({kind:e.GroupChangeKind2.ADD_PANEL,panel:t}))}doSetActivePanel(t){this._activePanel=t,t&&(this.tabsContainer.setActivePanel(t),t.layout(this._width,this._height),this.updateMru(t),this._onDidGroupChange.fire({kind:e.GroupChangeKind2.PANEL_ACTIVE,panel:t}))}updateMru(e){this.mostRecentlyUsed.includes(e)&&this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(e),1),this.mostRecentlyUsed=[e,...this.mostRecentlyUsed]}updateContainer(){if(this.updateActions(),E(this.container,"empty",this.isEmpty),this.panels.forEach((e=>e.updateParentGroup(this.parent,this.isActive))),this.isEmpty&&!this.watermark){const e=this.accessor.createWatermarkComponent();e.init({containerApi:new z(this.accessor),params:{},title:"",api:null}),this.watermark=e,h(this.watermark.element,"click",(()=>{this.isActive||this.accessor.doSetGroupActive(this.parent)})),this.contentContainer.hide(),this.tabsContainer.hide(),this.container.appendChild(this.watermark.element),this.watermark.updateParentGroup(this.parent,!0)}!this.isEmpty&&this.watermark&&(this.watermark.element.remove(),this.watermark.dispose(),this.watermark=void 0,this.contentContainer.show(),this.tabsContainer.show())}canDisplayOverlay(e,t){return!1}handleDropEvent(e,t,i){const n=b();if(n){if(-1!==this.tabsContainer.indexOf(n.panelId)&&1===this.tabsContainer.size)return;const{groupId:e,panelId:s}=n;if(this.id===e&&!t){if(this.tabsContainer.indexOf(s)===i)return}this._onMove.fire({target:t,groupId:n.groupId,itemId:n.panelId,index:i})}}dispose(){for(const e of this.panels)e.dispose();super.dispose(),this.dropTarget.dispose(),this.tabsContainer.dispose(),this.contentContainer.dispose()}}e.GroupChangeKind=void 0,(ce=e.GroupChangeKind||(e.GroupChangeKind={})).ADD_PANEL="ADD_PANEL",ce.REMOVE_PANEL="REMOVE_PANEL",ce.PANEL_ACTIVE="PANEL_ACTIVE",ce.GROUP_ACTIVE="GROUP_ACTIVE",ce.ADD_GROUP="ADD_GROUP",ce.REMOVE_GROUP="REMOVE_GROUP",ce.LAYOUT_FROM_JSON="LAYOUT_FROM_JSON",ce.LAYOUT="LAYOUT";const ge=I();function we(t){switch(t){case"left":return e.Position.Left;case"right":return e.Position.Right;case"above":return e.Position.Top;case"below":return e.Position.Bottom;default:return e.Position.Center}}class be extends l{constructor(t,i){super(),this._element=t,this._id=ge.next(),this._groups=new Map,this._onGridEvent=new a,this.onGridEvent=this._onGridEvent.event,this._onDidLayoutChange=new a,this.onDidLayoutChange=this._onDidLayoutChange.event,this.gridview=new ae(!!i.proportionalLayout,i.styles,i.orientation),this.element.appendChild(this.gridview.element),this.layout(0,0,!0),this.addDisposables(this.gridview.onDidChange((()=>{this._onGridEvent.fire({kind:e.GroupChangeKind.LAYOUT})}))),this.addDisposables((()=>{const t=new d;return new l(this.onGridEvent((i=>{[e.GroupChangeKind.ADD_GROUP,e.GroupChangeKind.REMOVE_GROUP,e.GroupChangeKind.ADD_PANEL,e.GroupChangeKind.REMOVE_PANEL,e.GroupChangeKind.GROUP_ACTIVE,e.GroupChangeKind.PANEL_ACTIVE,e.GroupChangeKind.LAYOUT].includes(i.kind)&&t.fire()})),t.onEvent((()=>{this._onDidLayoutChange.fire()})),t)})())}get id(){return this._id}get element(){return this._element}get size(){return this._groups.size}get groups(){return Array.from(this._groups.values()).map((e=>e.value))}get width(){return this.gridview.width}get height(){return this.gridview.height}get minimumHeight(){return this.gridview.minimumHeight}get maximumHeight(){return this.gridview.maximumHeight}get minimumWidth(){return this.gridview.minimumWidth}get maximumWidth(){return this.gridview.maximumWidth}get activeGroup(){return this._activeGroup}setVisible(t,i){this.gridview.setViewVisible(Q(t.element),i),this._onGridEvent.fire({kind:e.GroupChangeKind.LAYOUT})}isVisible(e){return this.gridview.isViewVisible(Q(e.element))}doAddGroup(t,i=[0],n){this.gridview.addView(t,null!=n?n:e.Sizing.Distribute,i),this._onGridEvent.fire({kind:e.GroupChangeKind.ADD_GROUP}),this.doSetGroupActive(t)}doRemoveGroup(t,i){if(!this._groups.has(t.id))throw new Error("invalid operation");const n=this._groups.get(t.id),s=this.gridview.remove(t,e.Sizing.Distribute);if(n&&!(null==i?void 0:i.skipDispose)&&(n.disposable.dispose(),this._groups.delete(t.id)),this._onGridEvent.fire({kind:e.GroupChangeKind.REMOVE_GROUP}),!(null==i?void 0:i.skipActive)&&this._activeGroup===t){const e=Array.from(this._groups.values());this.doSetGroupActive(e.length>0?e[0].value:void 0)}return s}getPanel(e){var t;return null===(t=this._groups.get(e))||void 0===t?void 0:t.value}doSetGroupActive(t,i){this._activeGroup!==t&&(this._activeGroup&&(this._activeGroup.setActive(!1),i||this._activeGroup.focus()),t&&(t.setActive(!0),i||t.focus()),this._activeGroup=t,this._onGridEvent.fire({kind:e.GroupChangeKind.GROUP_ACTIVE}))}removeGroup(e){this.doRemoveGroup(e)}moveToNext(e){var t;if(e||(e={}),!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}const i=Q(e.group.element),n=null===(t=this.gridview.next(i))||void 0===t?void 0:t.view;this.doSetGroupActive(n)}moveToPrevious(e){var t;if(e||(e={}),!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}const i=Q(e.group.element),n=null===(t=this.gridview.previous(i))||void 0===t?void 0:t.view;this.doSetGroupActive(n)}layout(e,t,i){(i||e!==this.width||t!==this.height)&&(this.element.style.height=`${t}px`,this.element.style.width=`${e}px`,this.gridview.layout(e,t))}resizeToFit(){if(!this.element.parentElement)return;const{width:e,height:t}=this.element.parentElement.getBoundingClientRect();this.layout(e,t)}dispose(){super.dispose(),this._onGridEvent.dispose(),this.gridview.dispose()}}class fe extends l{constructor(e){super(),this.id=e,this._state={},this._isFocused=!1,this._isActive=!1,this._isVisible=!0,this._width=0,this._height=0,this._onDidStateChange=new a,this.onDidStateChange=this._onDidStateChange.event,this._onDidPanelDimensionChange=new a({replay:!0}),this.onDidDimensionsChange=this._onDidPanelDimensionChange.event,this._onDidChangeFocus=new a({replay:!0}),this.onDidFocusChange=this._onDidChangeFocus.event,this._onFocusEvent=new a,this.onFocusEvent=this._onFocusEvent.event,this._onDidVisibilityChange=new a({replay:!0}),this.onDidVisibilityChange=this._onDidVisibilityChange.event,this._onVisibilityChange=new a,this.onVisibilityChange=this._onVisibilityChange.event,this._onDidActiveChange=new a({replay:!0}),this.onDidActiveChange=this._onDidActiveChange.event,this._onActiveChange=new a,this.onActiveChange=this._onActiveChange.event,this.addDisposables(this._onDidStateChange,this._onDidPanelDimensionChange,this._onDidChangeFocus,this._onDidVisibilityChange,this._onDidActiveChange,this._onFocusEvent,this.onDidFocusChange((e=>{this._isFocused=e.isFocused})),this.onDidActiveChange((e=>{this._isActive=e.isActive})),this.onDidVisibilityChange((e=>{this._isVisible=e.isVisible})),this.onDidDimensionsChange((e=>{this._width=e.width,this._height=e.height})))}get isFocused(){return this._isFocused}get isActive(){return this._isActive}get isVisible(){return this._isVisible}get width(){return this._width}get height(){return this._height}setVisible(e){this._onVisibilityChange.fire({isVisible:e})}setActive(){this._onActiveChange.fire()}setState(e,t){"object"==typeof e?this._state=e:void 0!==typeof t&&(this._state[e]=t),this._onDidStateChange.fire(void 0)}getState(){return this._state}getStateKey(e){return this._state[e]}dispose(){super.dispose()}}class _e extends fe{constructor(e){super(e),this._onDidConstraintsChangeInternal=new a,this.onDidConstraintsChangeInternal=this._onDidConstraintsChangeInternal.event,this._onDidConstraintsChange=new a({replay:!0}),this.onDidConstraintsChange=this._onDidConstraintsChange.event,this._onDidSizeChange=new a,this.onDidSizeChange=this._onDidSizeChange.event}setConstraints(e){this._onDidConstraintsChangeInternal.fire(e)}setSize(e){this._onDidSizeChange.fire(e)}}class Ce extends _e{constructor(e,t){super(e.id),this.panel=e,this._onDidDirtyChange=new a,this.onDidDirtyChange=this._onDidDirtyChange.event,this._onDidTitleChange=new a,this.onDidTitleChange=this._onDidTitleChange.event,this._titleChanged=new a,this.titleChanged=this._titleChanged.event,this._suppressClosableChanged=new a,this.suppressClosableChanged=this._suppressClosableChanged.event,this._group=t,this.addDisposables(this._onDidDirtyChange)}get tryClose(){return this._interceptor}get title(){return this.panel.title}get suppressClosable(){return!!this.panel.suppressClosable}get isGroupActive(){var e;return!!(null===(e=this.group)||void 0===e?void 0:e.isActive)}set group(e){this._group=e}get group(){return this._group}setTitle(e){this._onDidTitleChange.fire({title:e})}close(){if(!this.group)throw new Error(`panel ${this.id} has no group`);return this.group.model.closePanel(this.panel)}interceptOnCloseAction(e){this._interceptor=e}dispose(){super.dispose()}}class ye extends l{constructor(e,t){super(),this.id=e,this.containerApi=t,this.mutableDisposable=new p,this._suppressClosable=!1,this._title="",this.api=new Ce(this,this._group),this.onDidStateChange=this.api.onDidStateChange,this.addDisposables(this.api.onActiveChange((()=>{this.containerApi.setActivePanel(this)})),this.api.onDidTitleChange((e=>{const t=e.title;this.update({params:{title:t}})})))}get title(){return this._title}get suppressClosable(){return this._suppressClosable}get group(){return this._group}get view(){return this._view}init(e){var t;this._params=e.params,this._view=e.view,this.setTitle(e.title),this.setSuppressClosable(e.suppressClosable||!1),e.state&&this.api.setState(e.state),null===(t=this.view)||void 0===t||t.init(Object.assign(Object.assign({},e),{api:this.api,containerApi:this.containerApi}))}focus(){this.api._onFocusEvent.fire()}setDirty(e){this.api._onDidDirtyChange.fire(e)}close(){return this.api.tryClose?this.api.tryClose():Promise.resolve(!0)}toJSON(){const e=this.api.getState();return{id:this.id,view:this.view.toJSON(),params:Object.keys(this._params||{}).length>0?this._params:void 0,state:e&&Object.keys(e).length>0?e:void 0,suppressClosable:this.suppressClosable||void 0,title:this.title}}setTitle(e){var t;e!==(null===(t=this._params)||void 0===t?void 0:t.title)&&(this._title=e,this.api._titleChanged.fire({title:this.title}))}setSuppressClosable(e){var t;e!==(null===(t=this._params)||void 0===t?void 0:t.suppressClosable)&&(this._suppressClosable=e,this.api._suppressClosableChanged.fire({suppressClosable:!!this.suppressClosable}))}update(e){var t;const i=e.params;this._params=Object.assign(Object.assign({},this._params||{}),e.params.params),"string"==typeof i.title&&this.setTitle(i.title),"boolean"==typeof i.suppressClosable&&this.setSuppressClosable(i.suppressClosable),null===(t=this.view)||void 0===t||t.update({params:{params:this._params,title:this.title,suppressClosable:this.suppressClosable}})}updateParentGroup(t,i){var n;this._group=t,this.api.group=t,this.mutableDisposable.value=this._group.model.onDidGroupChange((t=>{var n;if(t.kind===e.GroupChangeKind2.GROUP_ACTIVE){const e=!!(null===(n=this._group)||void 0===n?void 0:n.model.isPanelActive(this));this.api._onDidActiveChange.fire({isActive:i&&e}),this.api._onDidVisibilityChange.fire({isVisible:e})}}));const s=this._group.model.isPanelActive(this);this.api._onDidActiveChange.fire({isActive:i&&s}),this.api._onDidVisibilityChange.fire({isVisible:s}),null===(n=this.view)||void 0===n||n.updateParentGroup(this._group,this._group.model.isPanelActive(this))}layout(e,t){var i,n;this.api._onDidPanelDimensionChange.fire({width:e,height:t-((null===(i=this.group)||void 0===i?void 0:i.model.tabHeight)||0)}),null===(n=this.view)||void 0===n||n.layout(e,t)}dispose(){var e;this.api.dispose(),this.mutableDisposable.dispose(),null===(e=this.view)||void 0===e||e.dispose()}}class ze{constructor(){this._element=document.createElement("div"),this._element.className="actions-bar",this._list=document.createElement("ul"),this._list.className="actions-container",this._element.appendChild(this._list)}get element(){return this._element}add(e){document.createElement("li").className="action-item",this._list.appendChild(e)}}class De extends l{constructor(){super(),this._element=document.createElement("div"),this._element.className="watermark";const e=document.createElement("div");e.className="watermark-title";const t=document.createElement("span");t.style.flexGrow="1";const i=document.createElement("div");i.className="watermark-content",this._element.appendChild(e),this._element.appendChild(i);const n=new ze;e.appendChild(t),e.appendChild(n.element);const s=document.createElement("a");s.className="close-action",n.add(s),this.addDisposables(h(s,"click",(e=>{var t;e.preventDefault(),this.group&&(null===(t=this.params)||void 0===t||t.containerApi.removeGroup(this.group))})))}get id(){return"watermark"}update(e){}focus(){}toJSON(){return{}}layout(e,t){}init(e){this.params=e,this.addDisposables(this.params.containerApi.onDidLayoutChange((e=>{this.render()}))),this.render()}updateParentGroup(e,t){this.group=e,this.render()}get element(){return this._element}render(){const e=!!(this.params&&this.params.containerApi.size<=1);E(this.element,"has-actions",e)}dispose(){super.dispose()}}class Se{constructor(e,t){this.layout=e,this.panelDeserializer=t}fromJSON(e){const t=e.data.views,i=e.data.activeView,n=[];for(const e of t){const t=this.panelDeserializer.createPanel(e);n.push(t)}return this.layout.createGroup({panels:n,activePanel:n.find((e=>e.id===i)),id:e.data.id})}}function xe(e,t,i={},n={},s,o){const a="string"==typeof t?i[t]:void 0,r="string"==typeof t?n[t]:void 0;if(a&&r)throw new Error(`Cannot create '${e}'. component '${t}' registered as both a component and frameworkComponent`);if(r){if(!s)throw new Error(`Cannot create '${e}' for framework component '${t}'. you must register a frameworkPanelWrapper to use framework components`);return s.createComponent(e,t,r)}if(!a){if(o)return o();throw new Error(`Cannot create '${e}', no component '${t}' provided`)}return new a(e,t)}class Ee{constructor(e){this.renderer=e,this._element=document.createElement("element"),this.show()}get innerRenderer(){return this.renderer}get element(){return this._element}get id(){return this.renderer.id}show(){this.renderer.element.parentElement||this._element.appendChild(this.renderer.element)}hide(){this.renderer.element.parentElement&&this.renderer.element.remove()}layout(e,t){this.renderer.layout(e,t)}update(e){this.renderer.update(e)}toJSON(){return this.renderer.toJSON()}focus(){this.renderer.focus()}init(e){this.renderer.init(e)}updateParentGroup(e,t){this.renderer.updateParentGroup(e,t)}dispose(){this.renderer.dispose()}}class Pe extends l{constructor(){super(),this._isPanelVisible=!1,this._isGroupActive=!1,this.params={},this.isDirtyDisposable=new p,this.addDisposables(this.isDirtyDisposable),this._element=document.createElement("div"),this._element.className="default-tab",this._content=document.createElement("div"),this._content.className="tab-content",this._actionContainer=document.createElement("div"),this._actionContainer.className="action-container",this._list=document.createElement("ul"),this._list.className="tab-list",this.action=document.createElement("a"),this.action.className="tab-action",this._element.appendChild(this._content),this._element.appendChild(this._actionContainer),this._actionContainer.appendChild(this._list),this._list.appendChild(this.action),this.addDisposables(h(this._actionContainer,"mousedown",(e=>{e.preventDefault()}))),this.render()}get element(){return this._element}get id(){return"__DEFAULT_TAB__"}update(e){this.params=Object.assign(Object.assign({},this.params),e.params),this.render()}toJSON(){return{id:this.id}}focus(){}init(e){this.params=e,this._content.textContent=e.title,this.isDirtyDisposable.value=this.params.api.onDidDirtyChange((e=>{const t=e;E(this.action,"dirty",t)})),this.params.suppressClosable?this.action.classList.add("disable-close"):h(this.action,"click",(e=>{e.preventDefault(),this.params.api.close()}))}updateParentGroup(e,t){this._isPanelVisible=t,this._isGroupActive=e.isActive,this.render()}layout(e,t){}render(){this._content.textContent=this.params.title}}class Ae extends l{constructor(e,t,i){super(),this.id=e,this.component=t,this.api=i,this._height=0,this._width=0,this._element=document.createElement("div"),this._element.tabIndex=-1,this._element.style.outline="none",this._element.style.height="100%",this._element.style.width="100%",this._element.style.overflow="hidden";const{onDidFocus:n,onDidBlur:s}=O(this._element);this.addDisposables(this.api,n((()=>{this.api._onDidChangeFocus.fire({isFocused:!0})})),s((()=>{this.api._onDidChangeFocus.fire({isFocused:!1})})))}get element(){return this._element}get width(){return this._width}get height(){return this._height}focus(){this.api._onFocusEvent.fire()}layout(e,t){this._width=e,this._height=t,this.api._onDidPanelDimensionChange.fire({width:e,height:t}),this.part&&this.params&&this.part.update(this.params.params)}init(e){this.params=e,this.part=this.getComponent()}update(e){var t,i;this.params=Object.assign(Object.assign({},this.params),{params:Object.assign(Object.assign({},null===(t=this.params)||void 0===t?void 0:t.params),e.params)}),null===(i=this.part)||void 0===i||i.update({params:this.params.params})}toJSON(){var e,t;const i=this.api.getState(),n=null!==(t=null===(e=this.params)||void 0===e?void 0:e.params)&&void 0!==t?t:{};return{id:this.id,component:this.component,params:Object.keys(n).length>0?n:void 0,state:0===Object.keys(i).length?void 0:i}}dispose(){super.dispose(),this.api.dispose()}}class Oe extends Ae{constructor(e,t,i=new _e(e)){super(e,t,i),this._evaluatedMinimumWidth=0,this._evaluatedMaximumWidth=Number.MAX_SAFE_INTEGER,this._evaluatedMinimumHeight=0,this._evaluatedMaximumHeight=Number.MAX_SAFE_INTEGER,this._minimumWidth=0,this._minimumHeight=0,this._maximumWidth=Number.MAX_SAFE_INTEGER,this._maximumHeight=Number.MAX_SAFE_INTEGER,this._snap=!1,this._onDidChange=new a,this.onDidChange=this._onDidChange.event,this.addDisposables(this.api.onVisibilityChange((e=>{const{isVisible:t}=e,{containerApi:i}=this.params;i.setVisible(this,t)})),this.api.onActiveChange((()=>{const{containerApi:e}=this.params;e.setActive(this)})),this.api.onDidConstraintsChangeInternal((e=>{"number"!=typeof e.minimumWidth&&"function"!=typeof e.minimumWidth||(this._minimumWidth=e.minimumWidth),"number"!=typeof e.minimumHeight&&"function"!=typeof e.minimumHeight||(this._minimumHeight=e.minimumHeight),"number"!=typeof e.maximumWidth&&"function"!=typeof e.maximumWidth||(this._maximumWidth=e.maximumWidth),"number"!=typeof e.maximumHeight&&"function"!=typeof e.maximumHeight||(this._maximumHeight=e.maximumHeight)})),this.api.onDidSizeChange((e=>{this._onDidChange.fire({height:e.height,width:e.width})})))}get priority(){return this._priority}get snap(){return this._snap}get minimumWidth(){const e="function"==typeof this._minimumWidth?this._minimumWidth():this._minimumWidth;return e!==this._evaluatedMinimumWidth&&(this._evaluatedMinimumWidth=e,this.updateConstraints()),e}get minimumHeight(){const e="function"==typeof this._minimumHeight?this._minimumHeight():this._minimumHeight;return e!==this._evaluatedMinimumHeight&&(this._evaluatedMinimumHeight=e,this.updateConstraints()),e}get maximumHeight(){const e="function"==typeof this._maximumHeight?this._maximumHeight():this._maximumHeight;return e!==this._evaluatedMaximumHeight&&(this._evaluatedMaximumHeight=e,this.updateConstraints()),e}get maximumWidth(){const e="function"==typeof this._maximumWidth?this._maximumWidth():this._maximumWidth;return e!==this._evaluatedMaximumWidth&&(this._evaluatedMaximumWidth=e,this.updateConstraints()),e}get isActive(){return this.api.isActive}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}init(e){e.maximumHeight&&(this._maximumHeight=e.maximumHeight),e.minimumHeight&&(this._minimumHeight=e.minimumHeight),e.maximumWidth&&(this._maximumWidth=e.maximumWidth),e.minimumWidth&&(this._minimumWidth=e.minimumWidth),this._priority=e.priority,this._snap=!!e.snap,super.init(e),"boolean"==typeof e.isVisible&&this.setVisible(e.isVisible)}updateConstraints(){this.api._onDidConstraintsChange.fire({minimumWidth:this._evaluatedMinimumWidth,maximumWidth:this._evaluatedMaximumWidth,minimumHeight:this._evaluatedMinimumHeight,maximumHeight:this._evaluatedMaximumHeight})}toJSON(){const e=super.toJSON(),t=e=>e===Number.MAX_SAFE_INTEGER?void 0:e,i=e=>e<=0?void 0:e;return Object.assign(Object.assign({},e),{minimumHeight:i(this.minimumHeight),maximumHeight:t(this.maximumHeight),minimumWidth:i(this.minimumWidth),maximumWidth:t(this.maximumWidth),snap:this.snap,priority:this.priority})}dispose(){super.dispose()}}class Ne extends Oe{constructor(e,t,i){super(t,"groupview_default",new _e(t)),this._model=new ve(this.element,e,t,i,this)}get model(){return this._model}get minimumHeight(){return this._model.minimumHeight}get maximumHeight(){return this._model.maximumHeight}get minimumWidth(){return this._model.minimumWidth}get maximumWidth(){return this._model.maximumWidth}initialize(){this.model.initialize()}setActive(e){super.setActive(e),this.model.setActive(e)}layout(e,t){super.layout(e,t),this.model.layout(e,t)}getComponent(){return this._model}toJSON(){return this.model.toJSON()}}class ke{constructor(e){var t;this._content=e.content,this._tab=new Ee(null!==(t=e.tab)&&void 0!==t?t:new Pe),this._actions=e.actions||(this.content.actions?{element:this.content.actions,dispose:()=>{}}:void 0)}get content(){return this._content}get tab(){return this._tab}get actions(){return this._actions}init(e){this.content.init(Object.assign(Object.assign({},e),{tab:this.tab})),this.tab.init(e)}updateParentGroup(e,t){var i;this._content.updateParentGroup(e,t),null===(i=this._tab)||void 0===i||i.updateParentGroup(e,t)}layout(e,t){this.content.layout(e,t)}update(e){this.content.update(e),this.tab.update(e)}toJSON(){return{content:this.content.toJSON(),tab:this.tab.innerRenderer instanceof Pe?void 0:this.tab.toJSON()}}dispose(){var e;this.content.dispose(),this.tab.dispose(),null===(e=this.actions)||void 0===e||e.dispose()}}const Ie=I();class Te extends be{constructor(t,i){super(t,{proportionalLayout:!0,orientation:i.orientation||e.Orientation.HORIZONTAL,styles:i.styles}),this._panels=new Map,this.dirtyPanels=new Set,this.debouncedDeque=function(e,t){let i;return(...n)=>{clearTimeout(i),i=setTimeout((()=>e(...n)),t)}}(this.syncConfigs.bind(this),5e3),this._onTabInteractionEvent=new a,this.onTabInteractionEvent=this._onTabInteractionEvent.event,this._onTabContextMenu=new a,this.onTabContextMenu=this._onTabContextMenu.event,this.panelState={},this._options=i,this.options.components||(this.options.components={}),this.options.frameworkComponents||(this.options.frameworkComponents={}),this.options.frameworkTabComponents||(this.options.frameworkTabComponents={}),this.options.tabComponents||(this.options.tabComponents={}),this.options.watermarkComponent||this.options.watermarkFrameworkComponent||(this.options.watermarkComponent=De),this._api=new z(this)}get totalPanels(){return this._panels.size}get panels(){return Array.from(this._panels.values()).map((e=>e.value))}get deserializer(){return this._deserializer}set deserializer(e){this._deserializer=e}get options(){return this._options}get activePanel(){const e=this.activeGroup;if(e)return e.model.activePanel}set tabHeight(e){this.options.tabHeight=e,this._groups.forEach((t=>{t.value.model.tabHeight=e}))}get tabHeight(){return this.options.tabHeight}updateOptions(e){const t="string"==typeof e.orientation&&this.options.orientation!==e.orientation;this._options=Object.assign(Object.assign({},this.options),e),t&&(this.gridview.orientation=e.orientation),this.layout(this.gridview.width,this.gridview.height,!0)}focus(){var e;null===(e=this.activeGroup)||void 0===e||e.focus()}getGroupPanel(e){var t;return null===(t=this._panels.get(e))||void 0===t?void 0:t.value}setActivePanel(e){if(!e.group)throw new Error(`Panel ${e.id} has no associated group`);this.doSetGroupActive(e.group),e.group.model.openPanel(e)}moveToNext(e={}){var t;if(!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}if(e.includePanel&&e.group&&e.group.model.activePanel!==e.group.model.panels[e.group.model.panels.length-1])return void e.group.model.moveToNext({suppressRoll:!0});const i=Q(e.group.element),n=null===(t=this.gridview.next(i))||void 0===t?void 0:t.view;this.doSetGroupActive(n)}moveToPrevious(e={}){var t;if(!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}if(e.includePanel&&e.group&&e.group.model.activePanel!==e.group.model.panels[0])return void e.group.model.moveToPrevious({suppressRoll:!0});const i=Q(e.group.element),n=null===(t=this.gridview.previous(i))||void 0===t?void 0:t.view;n&&this.doSetGroupActive(n)}registerPanel(e){if(this._panels.has(e.id))throw new Error(`panel ${e.id} already exists`);const t=new l(e.onDidStateChange((()=>this.addDirtyPanel(e))));this._panels.set(e.id,{value:e,disposable:t})}unregisterPanel(e){if(!this._panels.has(e.id))throw new Error(`panel ${e.id} doesn't exist`);const t=this._panels.get(e.id);t&&(t.disposable.dispose(),t.value.dispose()),this._panels.delete(e.id)}toJSON(){var e;this.syncConfigs();return{grid:this.gridview.serialize(),panels:Array.from(this._panels.values()).reduce(((e,t)=>(this.panelState[t.value.id]||(e[t.value.id]=t.value.toJSON()),e)),{}),activeGroup:null===(e=this.activeGroup)||void 0===e?void 0:e.id,options:{tabHeight:this.tabHeight}}}fromJSON(t){if(this.gridview.clear(),this._panels.forEach((e=>{e.disposable.dispose(),e.value.dispose()})),this._panels.clear(),this._groups.clear(),!this.deserializer)throw new Error("invalid deserializer");const{grid:i,panels:n,options:s,activeGroup:o}=t;if("number"==typeof(null==s?void 0:s.tabHeight)&&(this.tabHeight=s.tabHeight),!this.deserializer)throw new Error("no deserializer provided");if(this.gridview.deserialize(i,new Se(this,{createPanel:e=>{const t=n[e],i=this.deserializer.fromJSON(t);return this.registerPanel(i),i}})),"string"==typeof o){const e=this.getPanel(o);e&&this.doSetGroupActive(e)}this.gridview.layout(this.width,this.height),this._onGridEvent.fire({kind:e.GroupChangeKind.LAYOUT_FROM_JSON})}closeAllGroups(){return re(this,void 0,void 0,(function*(){for(const e of this._groups.entries()){const[t,i]=e;if(!(yield i.value.model.closeAllPanels()))return!1}return!0}))}fireMouseEvent(t){if(t.kind===e.MouseEventKind.CONTEXT_MENU)t.tab&&t.panel&&this._onTabContextMenu.fire({event:t.event,api:this._api,panel:t.panel})}addPanel(t){var i,n;const s=this._addPanel(t);let o;if(null===(i=t.position)||void 0===i?void 0:i.referencePanel){const e=this.getGroupPanel(t.position.referencePanel);if(!e)throw new Error(`referencePanel ${t.position.referencePanel} does not exist`);o=this.findGroup(e)}else o=this.activeGroup;if(o){const i=we((null===(n=t.position)||void 0===n?void 0:n.direction)||"within");if(i===e.Position.Center)o.model.openPanel(s);else{const e=Q(o.element),t=ee(this.gridview.orientation,e,i);this.addPanelToNewGroup(s,t)}}else this.addPanelToNewGroup(s);return s}removePanel(e){this.unregisterPanel(e);const t=e.group;if(!t)throw new Error(`cannot remove panel ${e.id}. it's missing a group.`);t.model.removePanel(e),0===t.model.size&&this.removeGroup(t)}createWatermarkComponent(){var e;return xe("watermark-id","watermark-name",this.options.watermarkComponent?{"watermark-name":this.options.watermarkComponent}:{},this.options.watermarkFrameworkComponent?{"watermark-name":this.options.watermarkFrameworkComponent}:{},null===(e=this.options.frameworkComponentFactory)||void 0===e?void 0:e.watermark)}addEmptyGroup(e){var t;const i=this.createGroup();if(e){const n=null===(t=this._panels.get(e.referencePanel))||void 0===t?void 0:t.value;if(!n)throw new Error(`reference panel ${e.referencePanel} does not exist`);const s=this.findGroup(n);if(!s)throw new Error(`reference group for reference panel ${e.referencePanel} does not exist`);const o=we(e.direction||"within"),a=Q(s.element),r=ee(this.gridview.orientation,a,o);this.doAddGroup(i,r)}else this.doAddGroup(i)}removeGroup(e){[...e.model.panels].forEach((e=>{this.removePanel(e)})),1!==this._groups.size?super.removeGroup(e):this._activeGroup=e}moveGroupOrPanel(t,i,n,s,o){var a,r,h;const d=i?null===(a=this._groups.get(i))||void 0===a?void 0:a.value:void 0;if(s&&s!==e.Position.Center){const e=Q(t.element),i=ee(this.gridview.orientation,e,s);if(d&&d.model.size<2){const[e,n]=T(i),o=Q(d.element),[a,r]=T(o);if(V(a,e))this.gridview.moveView(a,r,n);else{const e=this.doRemoveGroup(d,{skipActive:!0,skipDispose:!0}),i=Q(t.element),n=ee(this.gridview.orientation,i,s);this.doAddGroup(e,n)}}else{const t=(null==d?void 0:d.model.removePanel(n))||(null===(h=this._panels.get(n))||void 0===h?void 0:h.value);if(!t)throw new Error(`No panel with id ${n}`);const i=ee(this.gridview.orientation,e,s);this.addPanelToNewGroup(t,i)}}else{const e=(null==d?void 0:d.model.removePanel(n))||(null===(r=this._panels.get(n))||void 0===r?void 0:r.value);if(!e)throw new Error(`No panel with id ${n}`);0===(null==d?void 0:d.model.size)&&this.doRemoveGroup(d),t.model.openPanel(e,{index:o})}}doSetGroupActive(t,i){var n,s;const o=this._activeGroup===t;super.doSetGroupActive(t,i),!o&&(null===(n=this._activeGroup)||void 0===n?void 0:n.model.activePanel)&&this._onGridEvent.fire({kind:e.GroupChangeKind.PANEL_ACTIVE,panel:null===(s=this._activeGroup)||void 0===s?void 0:s.model.activePanel})}createGroup(t){t||(t={tabHeight:this.tabHeight}),"number"!=typeof t.tabHeight&&(t.tabHeight=this.tabHeight);let i=null==t?void 0:t.id;if(i&&this._groups.has(t.id)&&(console.warn(`Duplicate group id ${null==t?void 0:t.id}. reassigning group id to avoid errors`),i=void 0),!i)for(i=Ie.next();this._groups.has(i);)i=Ie.next();const n=new Ne(this,i,t);if(!this._groups.has(n.id)){const t=new l(n.model.onMove((e=>{const{groupId:t,itemId:i,target:s,index:o}=e;this.moveGroupOrPanel(n,t,i,s,o)})),n.model.onDidGroupChange((t=>{switch(t.kind){case e.GroupChangeKind2.ADD_PANEL:this._onGridEvent.fire({kind:e.GroupChangeKind.ADD_PANEL,panel:t.panel});break;case e.GroupChangeKind2.GROUP_ACTIVE:this._onGridEvent.fire({kind:e.GroupChangeKind.GROUP_ACTIVE,panel:t.panel});break;case e.GroupChangeKind2.REMOVE_PANEL:this._onGridEvent.fire({kind:e.GroupChangeKind.REMOVE_PANEL,panel:t.panel});break;case e.GroupChangeKind2.PANEL_ACTIVE:this._onGridEvent.fire({kind:e.GroupChangeKind.PANEL_ACTIVE,panel:t.panel})}})));this._groups.set(n.id,{value:n,disposable:t})}return n.initialize(),"number"==typeof this.options.tabHeight&&(n.model.tabHeight=this.options.tabHeight),n}dispose(){super.dispose(),this._onGridEvent.dispose()}syncConfigs(){const e=Array.from(this.dirtyPanels);e.length,this.dirtyPanels.clear();const t=e.map((e=>this._panels.get(e.id))).filter((e=>!!e)).reduce(((e,t)=>(e[t.value.id]=t.value.toJSON(),e)),{});this.panelState=Object.assign(Object.assign({},this.panelState),t),e.filter((e=>this._panels.has(e.id))).forEach((e=>{e.setDirty(!1)}))}_addPanel(e){const t=new ke({content:this.createContentComponent(e.id,e.component),tab:this.createTabComponent(e.id,e.tabComponent)}),i=new ye(e.id,this._api);return i.init({view:t,title:e.title||e.id,suppressClosable:null==e?void 0:e.suppressClosable,params:(null==e?void 0:e.params)||{}}),this.registerPanel(i),i}createContentComponent(e,t){var i;return xe(e,t,this.options.components||{},this.options.frameworkComponents,null===(i=this.options.frameworkComponentFactory)||void 0===i?void 0:i.content)}createTabComponent(e,t){var i;return xe(e,t,this.options.tabComponents||{},this.options.frameworkTabComponents,null===(i=this.options.frameworkComponentFactory)||void 0===i?void 0:i.tab,(()=>new Pe))}addPanelToNewGroup(e,t=[0]){const i=this.createGroup();this.doAddGroup(i,t),i.model.openPanel(e)}findGroup(e){var t;return null===(t=Array.from(this._groups.values()).find((t=>t.value.model.containsPanel(e))))||void 0===t?void 0:t.value}addDirtyPanel(e){this.dirtyPanels.add(e),e.setDirty(!0),this.debouncedDeque()}}class Ve extends be{constructor(e,t){super(e,{proportionalLayout:t.proportionalLayout,orientation:t.orientation,styles:t.styles}),this._options=t,this.options.components||(this.options.components={}),this.options.frameworkComponents||(this.options.frameworkComponents={})}get orientation(){return this.gridview.orientation}set orientation(e){this.gridview.orientation=e}get options(){return this._options}get deserializer(){return this._deserializer}set deserializer(e){this._deserializer=e}updateOptions(e){const t="string"==typeof e.orientation&&this.options.orientation!==e.orientation;this._options=Object.assign(Object.assign({},this.options),e),t&&(this.gridview.orientation=e.orientation),this.layout(this.gridview.width,this.gridview.height,!0)}removePanel(e){this.removeGroup(e)}toJSON(){var e;return{grid:this.gridview.serialize(),activePanel:null===(e=this.activeGroup)||void 0===e?void 0:e.id}}setVisible(e,t){this.gridview.setViewVisible(Q(e.element),t)}setActive(e){this._groups.forEach(((t,i)=>{t.value.setActive(e===t.value)}))}toggleVisibility(e){this.setVisible(e,!this.isVisible(e))}focus(){var e;null===(e=this.activeGroup)||void 0===e||e.focus()}fromJSON(t,i){const{grid:n,activePanel:s}=t;this.gridview.clear(),this._groups.clear();const o=[];if(this.gridview.deserialize(n,{fromJSON:e=>{const{data:t}=e,i=xe(t.id,t.component,this.options.components||{},this.options.frameworkComponents||{},this.options.frameworkComponentFactory?{createComponent:this.options.frameworkComponentFactory.createComponent}:void 0);return o.push((()=>i.init({params:t.params,minimumWidth:t.minimumWidth,maximumWidth:t.maximumWidth,minimumHeight:t.minimumHeight,maximumHeight:t.maximumHeight,priority:t.priority,snap:!!t.snap,containerApi:new y(this),isVisible:e.visible}))),this.registerPanel(i),i}}),this.layout(this.width,this.height,!0),i?setTimeout((()=>{o.forEach((e=>e()))}),0):o.forEach((e=>e())),"string"==typeof s){const e=this.getPanel(s);e&&this.doSetGroupActive(e)}this._onGridEvent.fire({kind:e.GroupChangeKind.LAYOUT_FROM_JSON})}movePanel(t,i){var n;let s;const o=this.gridview.remove(t),a=null===(n=this._groups.get(i.reference))||void 0===n?void 0:n.value;if(!a)throw new Error(`reference group ${i.reference} does not exist`);const r=we(i.direction);if(r===e.Position.Center)throw new Error(`${r} not supported as an option`);{const e=Q(a.element);s=ee(this.gridview.orientation,e,r)}this.doAddGroup(o,s,i.size)}addPanel(t){var i,n;let s=t.location||[0];if(null===(i=t.position)||void 0===i?void 0:i.reference){const i=null===(n=this._groups.get(t.position.reference))||void 0===n?void 0:n.value;if(!i)throw new Error(`reference group ${t.position.reference} does not exist`);const o=we(t.position.direction);if(o===e.Position.Center)throw new Error(`${o} not supported as an option`);{const e=Q(i.element);s=ee(this.gridview.orientation,e,o)}}const o=xe(t.id,t.component,this.options.components||{},this.options.frameworkComponents||{},this.options.frameworkComponentFactory?{createComponent:this.options.frameworkComponentFactory.createComponent}:void 0);return o.init({params:t.params||{},minimumWidth:t.minimumWidth,maximumWidth:t.maximumWidth,minimumHeight:t.minimumHeight,maximumHeight:t.maximumHeight,priority:t.priority,snap:!!t.snap,containerApi:new y(this),isVisible:!0}),this.registerPanel(o),this.doAddGroup(o,s,t.size),{api:o.api}}registerPanel(e){const t=new l(e.api.onDidFocusChange((t=>{t.isFocused&&this._groups.forEach((t=>{const i=t.value;i!==e?i.setActive(!1):i.setActive(!0)}))})));this._groups.set(e.id,{value:e,disposable:t})}moveGroup(e,t,i){const n=this.getPanel(t);if(!n)throw new Error("invalid operation");const s=Q(e.element),o=ee(this.gridview.orientation,s,i),[a,r]=T(o),h=Q(n.element),[d,l]=T(h);if(V(d,a))return void this.gridview.moveView(d,l,r);const p=this.doRemoveGroup(n,{skipActive:!0,skipDispose:!0}),c=Q(e.element),u=ee(this.gridview.orientation,c,i);this.doAddGroup(p,u)}removeGroup(e){super.removeGroup(e);const t=this._groups.get(e.id);t&&(t.disposable.dispose(),this._groups.delete(e.id))}dispose(){super.dispose()}}class Ge extends l{constructor(e,t){super(),this.element=e,this._disposable=new p,this.panels=new Map,this._onDidLayoutChange=new a,this.onDidLayoutChange=this._onDidLayoutChange.event,this._options=t,t.components||(t.components={}),t.frameworkComponents||(t.frameworkComponents={}),this.splitview=new j(this.element,t),this.addDisposables(this._disposable)}get options(){return this._options}get orientation(){return this.splitview.orientation}get splitview(){return this._splitview}set splitview(e){this._splitview=e,this._disposable.value=new l(this._splitview.onDidSashEnd((()=>{this._onDidLayoutChange.fire(void 0)})))}get minimumSize(){return this.splitview.minimumSize}get maximumSize(){return this.splitview.maximumSize}get height(){return this.splitview.orientation===e.Orientation.HORIZONTAL?this.splitview.orthogonalSize:this.splitview.size}get width(){return this.splitview.orientation===e.Orientation.HORIZONTAL?this.splitview.size:this.splitview.orthogonalSize}get length(){return this.panels.size}updateOptions(e){const t="string"==typeof e.orientation&&this.options.orientation!==e.orientation;this._options=Object.assign(Object.assign({},this.options),e),t&&(this.splitview.orientation=e.orientation),this.splitview.layout(this.splitview.size,this.splitview.orthogonalSize)}focus(){var e;null===(e=this._activePanel)||void 0===e||e.focus()}movePanel(e,t){this.splitview.moveView(e,t)}setVisible(e,t){const i=this.getPanels().indexOf(e);this.splitview.setViewVisible(i,t)}setActive(e,t){this._activePanel=e,this.getPanels().filter((t=>t!==e)).forEach((e=>{e.api._onDidActiveChange.fire({isActive:!1}),t||e.focus()})),e.api._onDidActiveChange.fire({isActive:!0}),t||e.focus()}getPanels(){return this.splitview.getViews()}removePanel(e,t){const i=this.panels.get(e.id);null==i||i.dispose(),this.panels.delete(e.id);const n=this.getPanels().findIndex((t=>t===e));this.splitview.removeView(n,t);const s=this.getPanels();s.length>0&&this.setActive(s[s.length-1])}getPanel(e){return this.getPanels().find((t=>t.id===e))}addPanel(t){if(this.panels.has(t.id))throw new Error(`panel ${t.id} already exists`);const i=xe(t.id,t.component,this.options.components||{},this.options.frameworkComponents||{},this.options.frameworkWrapper?{createComponent:this.options.frameworkWrapper.createComponent}:void 0);i.orientation=this.splitview.orientation,i.init({params:t.params||{},minimumSize:t.minimumSize,maximumSize:t.maximumSize,snap:t.snap,priority:t.priority,containerApi:new _(this)});const n="number"==typeof t.size?t.size:e.Sizing.Distribute,s="number"==typeof t.index?t.index:void 0;this.splitview.addView(i,n,s),this.doAddView(i),this.setActive(i)}resizeToFit(){if(!this.element.parentElement)return;const{width:e,height:t}=this.element.parentElement.getBoundingClientRect();this.layout(e,t)}layout(t,i){const[n,s]=this.splitview.orientation===e.Orientation.HORIZONTAL?[t,i]:[i,t];this.splitview.layout(n,s)}doAddView(e){const t=e.api.onDidFocusChange((t=>{t.isFocused&&this.setActive(e,!0)}));this.panels.set(e.id,t)}toJSON(){var e;return{views:this.splitview.getViews().map(((e,t)=>({size:this.splitview.getViewSize(t),data:e.toJSON(),snap:!!e.snap,priority:e.priority}))),activeView:null===(e=this._activePanel)||void 0===e?void 0:e.id,size:this.splitview.size,orientation:this.splitview.orientation}}fromJSON(e,t=!1){const{views:i,orientation:n,size:s,activeView:o}=e;this.splitview.dispose();const a=[];if(this.splitview=new j(this.element,{orientation:n,proportionalLayout:this.options.proportionalLayout,descriptor:{size:s,views:i.map((e=>{const t=e.data;if(this.panels.has(t.id))throw new Error(`panel ${t.id} already exists`);const i=xe(t.id,t.component,this.options.components||{},this.options.frameworkComponents||{},this.options.frameworkWrapper?{createComponent:this.options.frameworkWrapper.createComponent}:void 0);return a.push((()=>{i.init({params:t.params||{},minimumSize:t.minimumSize,maximumSize:t.maximumSize,snap:e.snap,priority:e.priority,containerApi:new _(this)})})),i.orientation=n,this.doAddView(i),{size:e.size,view:i}}))}}),this.layout(this.width,this.height),t?setTimeout((()=>{a.forEach((e=>e()))}),0):a.forEach((e=>e())),"string"==typeof o){const e=this.getPanel(o);e&&this.setActive(e)}}dispose(){Array.from(this.panels.values()).forEach((e=>{e.dispose()})),this.panels.clear(),super.dispose()}}class Le extends l{constructor(e){super(),this.el=e,this.iframes=[],this._onDragStart=new a,this.onDragStart=this._onDragStart.event,this.configure()}configure(){this.addDisposables(h(this.el,"dragstart",(e=>{var t;this.iframes=[...A("iframe"),...A("webview")];for(const e of this.iframes)e.style.pointerEvents="none";this.el.classList.add("dragged"),setTimeout((()=>this.el.classList.remove("dragged")),0),null===(t=this.disposable)||void 0===t||t.dispose(),this.disposable=this.getData()})),h(this.el,"dragend",(e=>{var t;for(const e of this.iframes)e.style.pointerEvents="auto";this.iframes=[],null===(t=this.disposable)||void 0===t||t.dispose(),this.disposable=void 0})))}}class Re extends fe{constructor(e){super(e),this._onDidConstraintsChangeInternal=new a,this.onDidConstraintsChangeInternal=this._onDidConstraintsChangeInternal.event,this._onDidConstraintsChange=new a({replay:!0}),this.onDidConstraintsChange=this._onDidConstraintsChange.event,this._onDidSizeChange=new a,this.onDidSizeChange=this._onDidSizeChange.event}setConstraints(e){this._onDidConstraintsChangeInternal.fire(e)}setSize(e){this._onDidSizeChange.fire(e)}dispose(){super.dispose(),this._onDidConstraintsChange.dispose(),this._onDidSizeChange.dispose()}}class He extends Re{constructor(e){super(e),this._onDidExpansionChange=new a({replay:!0}),this.onDidExpansionChange=this._onDidExpansionChange.event,this._onMouseEnter=new a({}),this.onMouseEnter=this._onMouseEnter.event,this._onMouseLeave=new a({}),this.onMouseLeave=this._onMouseLeave.event}set pane(e){this._pane=e}setExpanded(e){var t;null===(t=this._pane)||void 0===t||t.setExpanded(e)}get isExpanded(){var e;return!!(null===(e=this._pane)||void 0===e?void 0:e.isExpanded())}}class Me extends Ae{constructor(e,t,i,n,s){super(e,t,new He(e)),this.headerComponent=i,this._onDidChangeExpansionState=new a({replay:!0}),this.onDidChangeExpansionState=this._onDidChangeExpansionState.event,this._onDidChange=new a,this.onDidChange=this._onDidChange.event,this.headerSize=22,this._orthogonalSize=0,this._size=0,this._minimumBodySize=100,this._maximumBodySize=Number.POSITIVE_INFINITY,this._isExpanded=!1,this.expandedSize=0,this.api.pane=this,this._isExpanded=s,this._onDidChangeExpansionState.fire(this.isExpanded()),this._orientation=n,this.element.classList.add("pane"),this.addDisposables(this.api.onDidSizeChange((e=>{this._onDidChange.fire(e.size)})),h(this.element,"mouseenter",(e=>{this.api._onMouseEnter.fire(e)})),h(this.element,"mouseleave",(e=>{this.api._onMouseLeave.fire(e)}))),this.addDisposables(this._onDidChangeExpansionState,this.onDidChangeExpansionState((e=>{this.api._onDidExpansionChange.fire({isExpanded:e})})),this.api.onDidFocusChange((e=>{this.header&&(e.isFocused?x(this.header,"focused"):S(this.header,"focused"))}))),this.renderOnce()}set orientation(e){this._orientation=e}get orientation(){return this._orientation}get minimumSize(){return this.headerSize+(this.isExpanded()?this._minimumBodySize:0)}get maximumSize(){return this.headerSize+(this.isExpanded()?this._maximumBodySize:0)}get size(){return this._size}get orthogonalSize(){return this._orthogonalSize}set orthogonalSize(e){this._orthogonalSize=e}get minimumBodySize(){return this._minimumBodySize}set minimumBodySize(e){this._minimumBodySize="number"==typeof e?e:0}get maximumBodySize(){return this._maximumBodySize}set maximumBodySize(e){this._maximumBodySize="number"==typeof e?e:Number.POSITIVE_INFINITY}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}isExpanded(){return this._isExpanded}setExpanded(e){this._isExpanded!==e&&(this._isExpanded=e,e?(this.animationTimer&&clearTimeout(this.animationTimer),this.body&&this.element.appendChild(this.body)):this.animationTimer=setTimeout((()=>{var e;null===(e=this.body)||void 0===e||e.remove()}),200),this._onDidChange.fire(e?this.width:void 0),this._onDidChangeExpansionState.fire(e))}layout(t,i){this._size=t,this._orthogonalSize=i;const[n,s]=this.orientation===e.Orientation.HORIZONTAL?[t,i]:[i,t];this.isExpanded()&&(this.expandedSize=n),super.layout(n,s)}init(e){var t,i;super.init(e),"number"==typeof e.minimumBodySize&&(this.minimumBodySize=e.minimumBodySize),"number"==typeof e.maximumBodySize&&(this.maximumBodySize=e.maximumBodySize),this.bodyPart=this.getBodyComponent(),this.headerPart=this.getHeaderComponent(),this.bodyPart.init(Object.assign(Object.assign({},e),{api:this.api})),this.headerPart.init(Object.assign(Object.assign({},e),{api:this.api})),null===(t=this.body)||void 0===t||t.append(this.bodyPart.element),null===(i=this.header)||void 0===i||i.append(this.headerPart.element),"boolean"==typeof e.isExpanded&&this.setExpanded(e.isExpanded)}toJSON(){const e=this.params;return Object.assign(Object.assign({},super.toJSON()),{headerComponent:this.headerComponent,title:e.title})}renderOnce(){this.header=document.createElement("div"),this.header.tabIndex=0,this.header.className="pane-header",this.header.style.height=`${this.headerSize}px`,this.header.style.lineHeight=`${this.headerSize}px`,this.header.style.minHeight=`${this.headerSize}px`,this.header.style.maxHeight=`${this.headerSize}px`,this.element.appendChild(this.header),this.body=document.createElement("div"),this.body.className="pane-body",this.element.appendChild(this.body)}getComponent(){return{update:e=>{var t,i;null===(t=this.bodyPart)||void 0===t||t.update({params:e}),null===(i=this.headerPart)||void 0===i||i.update({params:e})},dispose:()=>{var e,t;null===(e=this.bodyPart)||void 0===e||e.dispose(),null===(t=this.headerPart)||void 0===t||t.dispose()}}}}class Fe extends Me{constructor(e,t,i,n,s,o){super(e,t,i,n,s),this._onDidDrop=new a,this.onDidDrop=this._onDidDrop.event,o||this.initDragFeatures()}initDragFeatures(){if(!this.header)return;const t=this.id;this.header.draggable=!0,this.handler=new class extends Le{getData(){return w.getInstance().setData([new m("paneview",t)],m.prototype),{dispose:()=>{w.getInstance().clearData(m.prototype)}}}}(this.header),this.target=new $(this.element,{validOverlays:"vertical",canDisplayOverlay:e=>{const t=f();return!t||t.paneId!==this.id}}),this.addDisposables(this._onDidDrop,this.handler,this.target,this.target.onDrop((t=>{const i=f();if(!i)return void this._onDidDrop.fire(Object.assign(Object.assign({},t),{panel:this,getData:()=>f()}));const n=this.params.containerApi,s=i.paneId,o=n.getPanel(s);if(!o)return void this._onDidDrop.fire(Object.assign(Object.assign({},t),{panel:this,getData:()=>f()}));const a=n.getPanels(),r=a.indexOf(o);let h=n.getPanels().indexOf(this);t.position!==e.Position.Left&&t.position!==e.Position.Top||(h=Math.max(0,h-1)),t.position!==e.Position.Right&&t.position!==e.Position.Bottom||(r>h&&h++,h=Math.min(a.length-1,h)),n.movePanel(r,h)})))}}class We extends l{constructor(){super(),this.disposable=new p,this.apiRef={api:null},this._element=document.createElement("div"),this.element.className="default-header",this._content=document.createElement("span"),this._expander=document.createElement("a"),this.element.appendChild(this._content),this.element.appendChild(this._expander),this.addDisposables(h(this._expander,"click",(()=>{var e;null===(e=this.apiRef.api)||void 0===e||e.setExpanded(!this.apiRef.api.isExpanded)})))}get element(){return this._element}init(e){this.apiRef.api=e.api,this._content.textContent=e.title,this._expander.textContent=e.api.isExpanded?"<":">",this.disposable.value=e.api.onDidExpansionChange((e=>{this._expander.textContent=e.isExpanded?"<":">"}))}update(e){}dispose(){this.disposable.dispose(),super.dispose()}}class Be extends Fe{constructor(e){super(e.id,e.component,e.headerComponent,e.orientation,e.isExpanded,e.disableDnd),this.options=e}getBodyComponent(){return this.options.body}getHeaderComponent(){return this.options.header}}class Je extends l{constructor(t,i){super(),this.element=t,this._disposable=new p,this._onDidLayoutChange=new a,this.onDidLayoutChange=this._onDidLayoutChange.event,this._onDidDrop=new a,this.onDidDrop=this._onDidDrop.event,this._options=i,i.components||(i.components={}),i.frameworkComponents||(i.frameworkComponents={}),this.paneview=new U(this.element,{orientation:e.Orientation.VERTICAL}),this.addDisposables(this._disposable)}get onDidAddView(){return this._paneview.onDidAddView}get onDidRemoveView(){return this._paneview.onDidRemoveView}set paneview(e){this._paneview=e,this._disposable.value=new l(this.paneview.onDidChange((()=>{this._onDidLayoutChange.fire(void 0)})))}get paneview(){return this._paneview}get minimumSize(){return this.paneview.minimumSize}get maximumSize(){return this.paneview.maximumSize}get height(){return this.paneview.orientation===e.Orientation.HORIZONTAL?this.paneview.orthogonalSize:this.paneview.size}get width(){return this.paneview.orientation===e.Orientation.HORIZONTAL?this.paneview.size:this.paneview.orthogonalSize}get options(){return this._options}focus(){}updateOptions(e){this._options=Object.assign(Object.assign({},this.options),e)}addPanel(t){const i=xe(t.id,t.component,this.options.components||{},this.options.frameworkComponents||{},this.options.frameworkWrapper?{createComponent:this.options.frameworkWrapper.body.createComponent}:void 0);let n;n=t.headerComponent?xe(t.id,t.headerComponent,this.options.headerComponents||{},this.options.headerframeworkComponents,this.options.frameworkWrapper?{createComponent:this.options.frameworkWrapper.header.createComponent}:void 0):new We;const s=new Be({id:t.id,component:t.component,headerComponent:t.headerComponent,header:n,body:i,orientation:e.Orientation.VERTICAL,isExpanded:!!t.isExpanded,disableDnd:!!this.options.disableDnd}),o=new l(s.onDidDrop((e=>{this._onDidDrop.fire(e)}))),a="number"==typeof t.size?t.size:e.Sizing.Distribute,r="number"==typeof t.index?t.index:void 0;return s.init({params:t.params||{},minimumBodySize:t.minimumBodySize,maximumBodySize:t.maximumBodySize,isExpanded:t.isExpanded,title:t.title,containerApi:new C(this)}),this.paneview.addPane(s,a,r),s.orientation=this.paneview.orientation,o}getPanels(){return this.paneview.getPanes()}removePanel(e){const t=this.getPanels().findIndex((t=>t===e));this.paneview.removePane(t)}movePanel(e,t){this.paneview.moveView(e,t)}getPanel(e){return this.getPanels().find((t=>t.id===e))}layout(t,i){const[n,s]=this.paneview.orientation===e.Orientation.HORIZONTAL?[t,i]:[i,t];this.paneview.layout(n,s)}resizeToFit(){if(!this.element.parentElement)return;const{width:e,height:t}=this.element.parentElement.getBoundingClientRect();this.layout(e,t)}toJSON(){const e=e=>e===Number.MAX_SAFE_INTEGER||e===Number.POSITIVE_INFINITY?void 0:e;return{views:this.paneview.getPanes().map(((t,i)=>{return{size:this.paneview.getViewSize(i),data:t.toJSON(),minimumSize:(n=t.minimumBodySize,n<=0?void 0:n),maximumSize:e(t.maximumBodySize),expanded:t.isExpanded()};var n})),size:this.paneview.size}}fromJSON(t,i){const{views:n,size:s}=t,o=[];this.paneview.dispose(),this.paneview=new U(this.element,{orientation:e.Orientation.VERTICAL,descriptor:{size:s,views:n.map((t=>{const i=t.data,n=xe(i.id,i.component,this.options.components||{},this.options.frameworkComponents||{},this.options.frameworkWrapper?{createComponent:this.options.frameworkWrapper.body.createComponent}:void 0);let s;s=i.headerComponent?xe(i.id,i.headerComponent,this.options.headerComponents||{},this.options.headerframeworkComponents||{},this.options.frameworkWrapper?{createComponent:this.options.frameworkWrapper.header.createComponent}:void 0):new We;const a=new Be({id:i.id,component:i.component,headerComponent:i.headerComponent,header:s,body:n,orientation:e.Orientation.VERTICAL,isExpanded:!!t.expanded,disableDnd:!!this.options.disableDnd});return a.onDidDrop((e=>{this._onDidDrop.fire(e)})),o.push((()=>{a.init({params:i.params||{},minimumBodySize:t.minimumSize,maximumBodySize:t.maximumSize,title:i.title,isExpanded:!!t.expanded,containerApi:new C(this)}),a.orientation=this.paneview.orientation})),{size:t.size,view:a}}))}}),this.layout(this.width,this.height),i?setTimeout((()=>{o.forEach((e=>e()))}),0):o.forEach((e=>e()))}}class je extends Ae{constructor(e,t){super(e,t,new Re(e)),this._evaluatedMinimumSize=0,this._evaluatedMaximumSize=Number.POSITIVE_INFINITY,this._minimumSize=0,this._maximumSize=Number.POSITIVE_INFINITY,this._snap=!1,this._onDidChange=new a,this.onDidChange=this._onDidChange.event,this.addDisposables(this.api.onVisibilityChange((e=>{const{isVisible:t}=e,{containerApi:i}=this.params;i.setVisible(this,t)})),this.api.onActiveChange((()=>{const{containerApi:e}=this.params;e.setActive(this)})),this.api.onDidConstraintsChangeInternal((e=>{"number"!=typeof e.minimumSize&&"function"!=typeof e.minimumSize||(this._minimumSize=e.minimumSize),"number"!=typeof e.maximumSize&&"function"!=typeof e.maximumSize||(this._maximumSize=e.maximumSize),this.updateConstraints()})),this.api.onDidSizeChange((e=>{this._onDidChange.fire(e.size)})))}get priority(){return this._priority}set orientation(e){this._orientation=e}get orientation(){return this._orientation}get minimumSize(){const e="function"==typeof this._minimumSize?this._minimumSize():this._minimumSize;return e!==this._evaluatedMinimumSize&&(this._evaluatedMinimumSize=e,this.updateConstraints()),e}get maximumSize(){const e="function"==typeof this._maximumSize?this._maximumSize():this._maximumSize;return e!==this._evaluatedMaximumSize&&(this._evaluatedMaximumSize=e,this.updateConstraints()),e}get snap(){return this._snap}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}layout(t,i){const[n,s]=this.orientation===e.Orientation.HORIZONTAL?[t,i]:[i,t];super.layout(n,s)}init(e){super.init(e),this._priority=e.priority,e.minimumSize&&(this._minimumSize=e.minimumSize),e.maximumSize&&(this._maximumSize=e.maximumSize),e.snap&&(this._snap=e.snap)}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{minimumSize:(e=this.minimumSize,e<=0?void 0:e),maximumSize:(e=>e===Number.MAX_SAFE_INTEGER||e===Number.POSITIVE_INFINITY?void 0:e)(this.maximumSize)});var e}updateConstraints(){this.api._onDidConstraintsChange.fire({maximumSize:this._evaluatedMaximumSize,minimumSize:this._evaluatedMinimumSize})}}const Ue=(e,t)=>{const[i,n]=s.useState(),o=s.useRef(e.componentProps);return s.useImperativeHandle(t,(()=>({update:e=>{o.current=Object.assign(Object.assign({},o.current),e),n(Date.now())}})),[]),s.createElement(e.component,o.current)};Ue.displayName="DockviewReactJsBridge";const Ke=I(),$e=s.createContext({});class Ze{constructor(e,t,i,n,s){this.parent=e,this.portalStore=t,this.component=i,this.parameters=n,this.context=s,this.disposed=!1,this.createPortal()}update(e){var t;if(this.disposed)throw new Error("invalid operation: resource is already disposed");null===(t=this.componentInstance)||void 0===t||t.update(e)}createPortal(){if(this.disposed)throw new Error("invalid operation: resource is already disposed");if("function"!=typeof this.component)throw new Error("invalid operation: only functional components are supported");const e=s.createElement(s.forwardRef(Ue),{component:this.component,componentProps:this.parameters,ref:e=>{this.componentInstance=e}}),t=this.context?s.createElement($e.Provider,{value:this.context},e):e,i=o.createPortal(t,this.parent,Ke.next());this.ref={portal:i,disposable:this.portalStore.addPortal(i)}}dispose(){var e;null===(e=this.ref)||void 0===e||e.disposable.dispose(),this.disposed=!0}}const Ye=()=>{const[e,t]=s.useState([]);s.useDebugValue(`Portal count: ${e.length}`);return[e,s.useCallback((e=>{t((t=>[...t,e]));let i=!1;return{dispose:()=>{if(i)throw new Error("invalid operation: resource already disposed");i=!0,t((t=>t.filter((t=>t!==e))))}}}),[])]};function Xe(e){return null==e?void 0:e.type}class qe{constructor(e,t,i){this.id=e,this.component=t,this.reactPortalStore=i,this._onDidFocus=new a,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new a,this.onDidBlur=this._onDidBlur.event,this._element=document.createElement("div"),this._element.style.height="100%",this._element.style.width="100%",this._actionsElement=document.createElement("div"),this._actionsElement.style.height="100%",this._actionsElement.style.width="100%"}get element(){return this._element}get actions(){return this._actionsElement}focus(){}init(e){const t={api:e.api,containerApi:e.containerApi,actionsPortalElement:this._actionsElement,tabPortalElement:e.tab};this.part=new Ze(this.element,this.reactPortalStore,this.component,{params:e.params,api:e.api,containerApi:e.containerApi},t)}toJSON(){return{id:this.id}}update(e){var t;null===(t=this.part)||void 0===t||t.update(e.params)}updateParentGroup(e,t){this._group=e}layout(e,t){}close(){return Promise.resolve(!0)}dispose(){var e,t;null===(e=this.part)||void 0===e||e.dispose(),null===(t=this.actionsPart)||void 0===t||t.dispose()}}class Qe{constructor(e,t,i){this.id=e,this.component=t,this.reactPortalStore=i,this._element=document.createElement("div")}get element(){return this._element}focus(){}init(e){this.part=new Ze(this.element,this.reactPortalStore,this.component,{params:e.params,api:e.api,containerApi:e.containerApi})}update(e){var t;null===(t=this.part)||void 0===t||t.update(e.params)}toJSON(){return{id:this.id}}layout(e,t){}updateParentGroup(e,t){}dispose(){var e;null===(e=this.part)||void 0===e||e.dispose()}}class et{constructor(e){this.layout=e}fromJSON(e){var t,i,n;const s=e.id,o=e.params,a=e.title,r=e.state,h=e.suppressClosable,d=e.view,l=new ke({content:xe(d.content.id,d.content.id,this.layout.options.components,this.layout.options.frameworkComponents,null===(t=this.layout.options.frameworkComponentFactory)||void 0===t?void 0:t.content),tab:(null===(i=d.tab)||void 0===i?void 0:i.id)?xe(d.tab.id,d.tab.id,this.layout.options.tabComponents,this.layout.options.frameworkTabComponents,null===(n=this.layout.options.frameworkComponentFactory)||void 0===n?void 0:n.tab):new Pe}),p=new ye(s,new z(this.layout));return p.init({view:l,title:a,suppressClosable:h,params:o||{},state:r||{}}),p}}class tt{constructor(e,t,i){this.id=e,this.component=t,this.reactPortalStore=i,this._groupRef={value:void 0},this._element=document.createElement("div"),this._element.style.height="100%",this._element.style.width="100%"}get element(){return this._element}init(e){this.parameters=e,this.part=new Ze(this.element,this.reactPortalStore,this.component,{params:e.params,api:e.api,containerApi:e.containerApi,close:()=>{this._groupRef.value&&e.containerApi.removeGroup(this._groupRef.value)}})}focus(){}update(e){var t,i;this.parameters&&(this.parameters.params=e.params),null===(t=this.part)||void 0===t||t.update({params:(null===(i=this.parameters)||void 0===i?void 0:i.params)||{}})}toJSON(){return{id:this.id}}layout(e,t){}updateParentGroup(e,t){this._groupRef.value=e}dispose(){var e;null===(e=this.part)||void 0===e||e.dispose()}}const it=s.forwardRef(((e,t)=>{const i=s.useRef(null),n=s.useRef(),[o,a]=Ye();return s.useImperativeHandle(t,(()=>i.current),[]),s.useEffect((()=>{if(e.disableAutoResizing)return()=>{};const t=D(i.current,(e=>{var t;const{width:i,height:s}=e.contentRect;null===(t=n.current)||void 0===t||t.layout(i,s)}));return()=>{t.dispose()}}),[e.disableAutoResizing]),s.useEffect((()=>{var t;const s={content:{createComponent:(e,t,i)=>new qe(t,i,{addPortal:a})},tab:{createComponent:(e,t,i)=>new Qe(t,i,{addPortal:a})},watermark:{createComponent:(e,t,i)=>new tt(t,i,{addPortal:a})}},o=document.createElement("div"),r=new Te(o,{frameworkComponentFactory:s,frameworkComponents:e.components,frameworkTabComponents:e.tabComponents,tabHeight:e.tabHeight,debug:e.debug,enableExternalDragEvents:e.enableExternalDragEvents,watermarkFrameworkComponent:e.watermarkComponent,styles:e.hideBorders?{separatorBorder:"transparent"}:void 0});null===(t=i.current)||void 0===t||t.appendChild(r.element),r.deserializer=new et(r);const{clientWidth:h,clientHeight:d}=i.current;return r.layout(h,d),e.onReady&&e.onReady({api:new z(r)}),n.current=r,()=>{r.dispose()}}),[]),s.useEffect((()=>{n.current&&n.current.updateOptions({frameworkComponents:e.components})}),[e.components]),s.useEffect((()=>{n.current&&n.current.updateOptions({frameworkTabComponents:e.tabComponents})}),[e.tabComponents]),s.useEffect((()=>{if(!e.onTabContextMenu||!n.current)return()=>{};const t=n.current.onTabContextMenu((t=>{e.onTabContextMenu&&e.onTabContextMenu(t)}));return()=>{t.dispose()}}),[e.onTabContextMenu]),s.createElement("div",{className:e.className,style:{height:"100%",width:"100%"},ref:i},o)}));it.displayName="DockviewComponent";const nt=e=>s.createElement(s.Fragment,null,e.children),st=e=>s.createElement(s.Fragment,null,e.children),ot=e=>s.createElement(s.Fragment,null,e.children);const at={Tab:nt,Content:st,Actions:ot,Panel:e=>{const t=s.useContext($e),i=s.useMemo((()=>{var t;const i=(null===(t=s.Children.map(e.children,(e=>e)))||void 0===t?void 0:t.filter(Xe))||[];if(!!i.find((e=>{return t=e,![st,ot,nt].find((e=>t.type===e));var t})))throw new Error("Children of DockviewComponents.Panel must be one of the following: DockviewComponents.Content, DockviewComponents.Actions, DockviewComponents.Tab");return{body:i.find((e=>e.type===st)),actions:i.find((e=>e.type===ot)),tab:i.find((e=>e.type===nt))}}),[e.children]);return s.useEffect((()=>{i.tab?t.tabPortalElement.hide():t.tabPortalElement.show()}),[i.tab]),s.createElement(s.Fragment,null,i.actions&&o.createPortal(i.actions,t.actionsPortalElement),i.tab&&o.createPortal(i.tab,t.tabPortalElement.element),i.body||e.children)}};class rt extends je{constructor(e,t,i,n){super(e,t),this.reactComponent=i,this.reactPortalStore=n}getComponent(){var e;return new Ze(this.element,this.reactPortalStore,this.reactComponent,{params:(null===(e=this.params)||void 0===e?void 0:e.params)||{},api:this.api,containerApi:this.params.containerApi})}}const ht=s.forwardRef(((e,t)=>{const i=s.useRef(null),n=s.useRef(),[o,a]=Ye();return s.useImperativeHandle(t,(()=>i.current),[]),s.useEffect((()=>{if(e.disableAutoResizing)return()=>{};const t=D(i.current,(e=>{var t;const{width:i,height:s}=e.contentRect;null===(t=n.current)||void 0===t||t.layout(i,s)}));return()=>{t.dispose()}}),[e.disableAutoResizing]),s.useEffect((()=>{const t=new Ge(i.current,{orientation:e.orientation,frameworkComponents:e.components,frameworkWrapper:{createComponent:(e,t,i)=>new rt(e,t,i,{addPortal:a})},proportionalLayout:e.proportionalLayout,styles:e.hideBorders?{separatorBorder:"transparent"}:void 0}),{clientWidth:s,clientHeight:o}=i.current;return t.layout(s,o),e.onReady&&e.onReady({api:new _(t)}),n.current=t,()=>{t.dispose()}}),[]),s.useEffect((()=>{n.current&&n.current.updateOptions({frameworkComponents:e.components})}),[e.components]),s.createElement("div",{className:e.className,style:{height:"100%",width:"100%"},ref:i},o)}));ht.displayName="SplitviewComponent";class dt extends Oe{constructor(e,t,i,n){super(e,t),this.reactComponent=i,this.reactPortalStore=n}getComponent(){var e;return new Ze(this.element,this.reactPortalStore,this.reactComponent,{params:(null===(e=this.params)||void 0===e?void 0:e.params)||{},api:this.api,containerApi:this.params.containerApi})}}const lt=s.forwardRef(((e,t)=>{const i=s.useRef(null),n=s.useRef(),[o,a]=Ye();return s.useImperativeHandle(t,(()=>i.current),[]),s.useEffect((()=>{if(e.disableAutoResizing)return()=>{};const t=D(i.current,(e=>{var t;const{width:i,height:s}=e.contentRect;null===(t=n.current)||void 0===t||t.layout(i,s)}));return()=>{t.dispose()}}),[e.disableAutoResizing]),s.useEffect((()=>{var t;const s=document.createElement("div"),o=new Ve(s,{proportionalLayout:!!e.proportionalLayout,orientation:e.orientation,frameworkComponents:e.components,frameworkComponentFactory:{createComponent:(e,t,i)=>new dt(e,t,i,{addPortal:a})},styles:e.hideBorders?{separatorBorder:"transparent"}:void 0});null===(t=i.current)||void 0===t||t.appendChild(o.element);const{clientWidth:r,clientHeight:h}=i.current;return o.layout(r,h),e.onReady&&e.onReady({api:new y(o)}),n.current=o,()=>{o.dispose()}}),[]),s.useEffect((()=>{n.current&&n.current.updateOptions({frameworkComponents:e.components})}),[e.components]),s.createElement("div",{className:e.className,style:{height:"100%",width:"100%"},ref:i},o)}));lt.displayName="GridviewComponent";class pt{constructor(e,t,i){this.id=e,this.component=t,this.reactPortalStore=i,this._element=document.createElement("div"),this._element.style.height="100%",this._element.style.width="100%"}get element(){return this._element}init(e){this.part=new Ze(this.element,this.reactPortalStore,this.component,{params:e.params,api:e.api,title:e.title,containerApi:e.containerApi})}toJSON(){return{id:this.id}}update(e){var t;null===(t=this.part)||void 0===t||t.update(e.params)}dispose(){var e;null===(e=this.part)||void 0===e||e.dispose()}}const ct=s.forwardRef(((e,t)=>{const i=s.useRef(null),n=s.useRef(),[o,a]=Ye();return s.useImperativeHandle(t,(()=>i.current),[]),s.useEffect((()=>{if(e.disableAutoResizing)return()=>{};const t=D(i.current,(e=>{var t;const{width:i,height:s}=e.contentRect;null===(t=n.current)||void 0===t||t.layout(i,s)}));return()=>{t.dispose()}}),[e.disableAutoResizing]),s.useEffect((()=>{const t=(e,t,i)=>new pt(e,i,{addPortal:a}),s=new Je(i.current,{frameworkComponents:e.components,components:{},headerComponents:{},disableDnd:e.disableDnd,headerframeworkComponents:e.headerComponents,frameworkWrapper:{header:{createComponent:t},body:{createComponent:t}}}),o=new C(s),{clientWidth:r,clientHeight:h}=i.current;return s.layout(r,h),e.onReady&&e.onReady({api:o}),n.current=s,()=>{s.dispose()}}),[]),s.useEffect((()=>{n.current&&n.current.updateOptions({frameworkComponents:e.components})}),[e.components]),s.useEffect((()=>{n.current&&n.current.updateOptions({headerframeworkComponents:e.headerComponents})}),[e.headerComponents]),s.useEffect((()=>{if(!n.current)return()=>{};const t=n.current,i=t.onDidDrop((i=>{e.onDidDrop&&e.onDidDrop(Object.assign(Object.assign({},i),{api:new C(t)}))}));return()=>{i.dispose()}}),[e.onDidDrop]),s.createElement("div",{className:e.className,style:{height:"100%",width:"100%"},ref:i},o)}));ct.displayName="PaneviewComponent",e.BaseGrid=be,e.CompositeDisposable=l,e.ContentContainer=he,e.DATA_KEY=v,e.DockviewApi=z,e.DockviewComponent=Te,e.DockviewComponents=at,e.DockviewReact=it,e.Emitter=a,e.Gridview=ae,e.GridviewApi=y,e.GridviewComponent=Ve,e.GridviewPanel=Oe,e.GridviewReact=lt,e.Groupview=ve,e.LocalSelectionTransfer=w,e.MutableDisposable=p,e.PaneFramework=Be,e.PaneTransfer=m,e.PanelTransfer=u,e.Paneview=U,e.PaneviewApi=C,e.PaneviewComponent=Je,e.PaneviewPanel=Me,e.PaneviewReact=ct,e.ReactPanelContentPart=qe,e.ReactPanelHeaderPart=Qe,e.ReactPart=Ze,e.ReactPartContext=$e,e.Splitview=j,e.SplitviewApi=_,e.SplitviewComponent=Ge,e.SplitviewPanel=je,e.SplitviewReact=ht,e.Tab=ue,e.TickDelayedEvent=d,e.addDisposableListener=h,e.addDisposableWindowListener=r,e.extractData=e=>{if(!e.dataTransfer)return null;const t=function(e,t){try{return JSON.parse(e,t)}catch(e){return void console.warn("failed to parse JSON")}}(e.dataTransfer.getData(v));return t||console.warn(`[dragEvent] ${v} data is missing`),"string"!=typeof t.type&&console.warn(`[dragEvent] invalid type ${t.type}`),t},e.getDirectionOrientation=te,e.getGridLocation=Q,e.getLocationOrientation=ie,e.getPaneData=f,e.getPanelData=b,e.getRelativeLocation=ee,e.indexInParent=q,e.isCustomDragEvent=t=>t.type===e.DragType.EXTERNAL,e.isGridBranchNode=se,e.isPanelTransferEvent=e=>!!e.dataTransfer&&e.dataTransfer.types.includes(v),e.isReactElement=Xe,e.isTabDragEvent=t=>t.type===e.DragType.DOCKVIEW_TAB,e.orthogonal=ne,e.toTarget=we,e.usePortalsLifecycle=Ye,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
21
|
+
***************************************************************************** */function re(e,t,i,n){return new(i||(i=Promise))((function(s,o){function a(e){try{h(n.next(e))}catch(e){o(e)}}function r(e){try{h(n.throw(e))}catch(e){o(e)}}function h(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,r)}h((n=n.apply(e,t||[])).next())}))}class he extends l{constructor(){super(),this.disposable=new p,this._onDidFocus=new a,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new a,this.onDidBlur=this._onDidBlur.event,this._element=document.createElement("div"),this._element.className="content-container",this._element.tabIndex=-1}get element(){return this._element}show(){this.element.style.display=""}hide(){this.element.style.display="none"}openPanel(e){var t;if(this.panel===e)return;this.panel&&((null===(t=this.panel.view)||void 0===t?void 0:t.content)&&this._element.removeChild(this.panel.view.content.element),this.panel=void 0),this.panel=e;const i=new l;if(this.panel.view){const e=this.panel.view.content.onDidFocus,t=this.panel.view.content.onDidBlur,{onDidFocus:n,onDidBlur:s}=O(this._element);i.addDisposables(n((()=>this._onDidFocus.fire())),s((()=>this._onDidBlur.fire()))),e&&i.addDisposables(e((()=>this._onDidFocus.fire()))),t&&i.addDisposables(t((()=>this._onDidBlur.fire()))),this._element.appendChild(this.panel.view.content.element)}this.disposable.value=i}layout(e,t){}closePanel(){var e,t,i;(null===(i=null===(t=null===(e=this.panel)||void 0===e?void 0:e.view)||void 0===t?void 0:t.content)||void 0===i?void 0:i.element)&&(this._element.removeChild(this.panel.view.content.element),this.panel=void 0)}dispose(){this.disposable.dispose(),super.dispose()}}var de,le,pe,ce;!function(e){e[e.Tab=0]="Tab",e[e.Panel=1]="Panel",e[e.TabContainer=2]="TabContainer"}(de||(de={})),e.MouseEventKind=void 0,(le=e.MouseEventKind||(e.MouseEventKind={})).CLICK="CLICK",le.CONTEXT_MENU="CONTEXT_MENU";class ue extends l{constructor(t,i,n){super(),this.panelId=t,this.accessor=i,this.group=n,this._onChanged=new a,this.onChanged=this._onChanged.event,this._onDropped=new a,this.onDrop=this._onDropped.event,this.panelTransfer=w.getInstance(),this.iframes=[],this.addDisposables(this._onChanged,this._onDropped),this._element=document.createElement("div"),this._element.className="tab",this._element.tabIndex=0,this._element.draggable=!0,this.addDisposables(h(this._element,"dragstart",(e=>{this.iframes=[...A("iframe"),...A("webview")];for(const e of this.iframes)e.style.pointerEvents="none";this.element.classList.add("dragged"),setTimeout((()=>this.element.classList.remove("dragged")),0),this.panelTransfer.setData([new u(this.accessor.id,this.group.id,this.panelId)],u.prototype),e.dataTransfer&&(e.dataTransfer.effectAllowed="move")})),h(this._element,"dragend",(e=>{for(const e of this.iframes)e.style.pointerEvents="auto";this.iframes=[],this.panelTransfer.clearData(u.prototype)})),h(this._element,"mousedown",(t=>{t.defaultPrevented||(t.stopPropagation(),this._onChanged.fire({kind:e.MouseEventKind.CLICK,event:t}))})),h(this._element,"contextmenu",(t=>{this._onChanged.fire({kind:e.MouseEventKind.CONTEXT_MENU,event:t})}))),this.droptarget=new $(this._element,{validOverlays:"none",canDisplayOverlay:e=>{const t=b();return t?this.panelId!==t.panelId:this.group.model.canDisplayOverlay(e,de.Tab)}}),this.addDisposables(this.droptarget.onDrop((e=>{this._onDropped.fire(e)})))}get element(){return this._element}setActive(e){E(this.element,"active-tab",e),E(this.element,"inactive-tab",!e)}setContent(e){this.content&&this._element.removeChild(this.content.element),this.content=e,this._element.appendChild(this.content.element)}dispose(){super.dispose(),this.droptarget.dispose()}}class me extends l{constructor(e,t,i){super(),this.accessor=e,this.group=t,this.tabs=[],this.selectedIndex=-1,this.active=!1,this._onDrop=new a,this.onDrop=this._onDrop.event,this.addDisposables(this._onDrop),this._element=document.createElement("div"),this._element.className="tabs-and-actions-container",this.height=i.tabHeight,this.actionContainer=document.createElement("div"),this.actionContainer.className="action-container",this.tabContainer=document.createElement("div"),this.tabContainer.className="tabs-container",this.voidContainer=document.createElement("div"),this.voidContainer.className="void-container",this._element.appendChild(this.tabContainer),this._element.appendChild(this.voidContainer),this._element.appendChild(this.actionContainer),this.voidDropTarget=new $(this.voidContainer,{validOverlays:"none",canDisplayOverlay:e=>{var i;const n=b();return n?(null===(i=(s=this.tabs).length>0?s[s.length-1]:void 0)||void 0===i?void 0:i.value.panelId)!==n.panelId:t.model.canDisplayOverlay(e,de.Panel);var s}}),this.addDisposables(this.voidDropTarget.onDrop((e=>{this._onDrop.fire({event:e.nativeEvent,index:this.tabs.length})})),this.voidDropTarget,h(this.tabContainer,"mousedown",(e=>{if(e.defaultPrevented)return;0===e.button&&this.accessor.doSetGroupActive(this.group)})))}get panels(){return this.tabs.map((e=>e.value.panelId))}get size(){return this.tabs.length}get height(){return this._height}set height(e){this._height=e,"number"!=typeof e?this.element.style.removeProperty("--dv-tabs-and-actions-container-height"):this.element.style.setProperty("--dv-tabs-and-actions-container-height",`${e}px`)}show(){this.element.style.display=""}hide(){this.element.style.display="none"}setActionElement(e){this.actions!==e&&(this.actions&&(this.actions.remove(),this.actions=void 0),e&&(this.actionContainer.appendChild(e),this.actions=e))}get element(){return this._element}isActive(e){return this.selectedIndex>-1&&this.tabs[this.selectedIndex].value===e}at(e){var t;return null===(t=this.tabs[e])||void 0===t?void 0:t.value}indexOf(e){return this.tabs.findIndex((t=>t.value.panelId===e))}setActive(e){this.active=e}addTab(e,t=this.tabs.length){if(t<0||t>this.tabs.length)throw new Error("invalid location");this.tabContainer.insertBefore(e.value.element,this.tabContainer.children[t]),this.tabs=[...this.tabs.slice(0,t),e,...this.tabs.slice(t)],this.selectedIndex<0&&(this.selectedIndex=t)}delete(e){const t=this.tabs.findIndex((t=>t.value.panelId===e)),i=this.tabs.splice(t,1)[0],{value:n,disposable:s}=i;s.dispose(),n.element.remove()}setActivePanel(e){this.tabs.forEach((t=>{const i=e.id===t.value.panelId;t.value.setActive(i)}))}openPanel(t,i=this.tabs.length){var n;if(this.tabs.find((e=>e.value.panelId===t.id)))return;const s=new ue(t.id,this.accessor,this.group);if(!(null===(n=t.view)||void 0===n?void 0:n.tab))throw new Error("invalid header component");s.setContent(t.view.tab);const o=l.from(s.onChanged((i=>{var n;const s=t.id===(null===(n=this.group.model.activePanel)||void 0===n?void 0:n.id)&&this.group.model.isContentFocused();this.accessor.fireMouseEvent(Object.assign(Object.assign({},i),{panel:t,tab:!0}));if(0===i.event.button&&!i.event.defaultPrevented&&i.kind===e.MouseEventKind.CLICK)this.group.model.openPanel(t,{skipFocus:s})})),s.onDrop((e=>{this._onDrop.fire({event:e.nativeEvent,index:this.tabs.findIndex((e=>e.value===s))})}))),a={value:s,disposable:o};this.addTab(a,i),this.activePanel=t}closePanel(e){this.delete(e.id)}dispose(){super.dispose(),this.tabs.forEach((e=>{e.disposable.dispose()})),this.tabs=[]}}e.GroupChangeKind2=void 0,(pe=e.GroupChangeKind2||(e.GroupChangeKind2={})).ADD_PANEL="ADD_PANEL",pe.REMOVE_PANEL="REMOVE_PANEL",pe.PANEL_ACTIVE="PANEL_ACTIVE",pe.GROUP_ACTIVE="GROUP_ACTIVE";class ve extends l{constructor(t,i,n,s,o){super(),this.container=t,this.accessor=i,this.id=n,this.options=s,this.parent=o,this._isGroupActive=!1,this.mostRecentlyUsed=[],this._onDidChange=new a,this.onDidChange=this._onDidChange.event,this._width=0,this._height=0,this._panels=[],this._onMove=new a,this.onMove=this._onMove.event,this._onDidGroupChange=new a,this.onDidGroupChange=this._onDidGroupChange.event,this.closePanel=e=>re(this,void 0,void 0,(function*(){return!(e.close&&!(yield e.close()))&&(this.doClose(e),!0)})),this.container.classList.add("groupview"),this.addDisposables(this._onMove,this._onDidGroupChange),this.tabsContainer=new me(this.accessor,this.parent,{tabHeight:s.tabHeight}),this.contentContainer=new he,this.dropTarget=new $(this.contentContainer.element,{validOverlays:"all",canDisplayOverlay:e=>{const t=b();if(t){return!(1===this._panels.length&&t.groupId===this.id)}return this.canDisplayOverlay(e,de.Panel)}}),t.append(this.tabsContainer.element,this.contentContainer.element),this.addDisposables(this._onMove,this._onDidGroupChange,this.tabsContainer.onDrop((t=>{this.handleDropEvent(t.event,e.Position.Center,t.index)})),this.contentContainer.onDidFocus((()=>{this.accessor.doSetGroupActive(this.parent,!0)})),this.contentContainer.onDidBlur((()=>{})),this.dropTarget.onDrop((e=>{this.handleDropEvent(e.nativeEvent,e.position)})))}get element(){throw new Error("not supported")}get activePanel(){return this._activePanel}get tabHeight(){return this.tabsContainer.height}set tabHeight(e){this.tabsContainer.height=e,this.layout(this._width,this._height)}get isActive(){return this._isGroupActive}get panels(){return this._panels}get size(){return this._panels.length}get isEmpty(){return 0===this._panels.length}get minimumHeight(){return 100}get maximumHeight(){return Number.MAX_SAFE_INTEGER}get minimumWidth(){return 100}get maximumWidth(){return Number.MAX_SAFE_INTEGER}initialize(){var e,t;(null===(e=this.options)||void 0===e?void 0:e.panels)&&this.options.panels.forEach((e=>{this.doAddPanel(e)})),(null===(t=this.options)||void 0===t?void 0:t.activePanel)&&this.openPanel(this.options.activePanel),this.setActive(this.isActive,!0,!0),this.updateContainer()}isContentFocused(){return!!document.activeElement&&P(document.activeElement,this.contentContainer.element)}indexOf(e){return this.tabsContainer.indexOf(e.id)}toJSON(){var e;return{views:this.tabsContainer.panels,activeView:null===(e=this._activePanel)||void 0===e?void 0:e.id,id:this.id}}moveToNext(e){e||(e={}),e.panel||(e.panel=this.activePanel);const t=e.panel?this.panels.indexOf(e.panel):-1;let i;if(t<this.panels.length-1)i=t+1;else{if(e.suppressRoll)return;i=0}this.openPanel(this.panels[i])}moveToPrevious(e){if(e||(e={}),e.panel||(e.panel=this.activePanel),!e.panel)return;const t=this.panels.indexOf(e.panel);let i;if(t>0)i=t-1;else{if(e.suppressRoll)return;i=this.panels.length-1}this.openPanel(this.panels[i])}containsPanel(e){return this.panels.includes(e)}init(e){}update(e){}focus(){var e;null===(e=this._activePanel)||void 0===e||e.focus()}openPanel(e,t={}){("number"!=typeof t.index||t.index>this.panels.length)&&(t.index=this.panels.length),this._activePanel!==e?(this.doAddPanel(e,t.index),this.doSetActivePanel(e),this.accessor.doSetGroupActive(this.parent,!!t.skipFocus),this.updateContainer()):this.accessor.doSetGroupActive(this.parent)}removePanel(e){const t="string"==typeof e?e:e.id,i=this._panels.find((e=>e.id===t));if(!i)throw new Error("invalid operation");return this._removePanel(i)}closeAllPanels(){var e;return re(this,void 0,void 0,(function*(){const t=this._activePanel?this.panels.indexOf(this._activePanel):-1;if(this._activePanel&&t>-1){this.panels.indexOf(this._activePanel)<0&&console.warn("active panel not tracked");if(!(!(null===(e=this._activePanel)||void 0===e?void 0:e.close)||(yield this._activePanel.close())))return!1}for(let e=0;e<this.panels.length;e++){if(e===t)continue;const i=this.panels[e];if(this.openPanel(i),i.close){if(!(yield i.close()))return!1}}if(this.panels.length>0){const e=[...this.panels];yield Promise.all(e.map((e=>this.doClose(e))))}else this.accessor.removeGroup(this.parent);return!0}))}doClose(e){this.accessor.removePanel(e)}isPanelActive(e){return this._activePanel===e}updateActions(){var e,t;this.isActive&&(null===(t=null===(e=this._activePanel)||void 0===e?void 0:e.view)||void 0===t?void 0:t.actions)?this.tabsContainer.setActionElement(this._activePanel.view.actions.element):this.tabsContainer.setActionElement(void 0)}setActive(e,t=!1,i=!1){var n,s;i||this.isActive!==e?(this._isGroupActive=e,E(this.container,"active-group",e),E(this.container,"inactive-group",!e),this.tabsContainer.setActive(this.isActive),!this._activePanel&&this.panels.length>0&&this.doSetActivePanel(this.panels[0]),this.updateContainer(),e&&(t||null===(s=this._activePanel)||void 0===s||s.focus())):t||null===(n=this._activePanel)||void 0===n||n.focus()}layout(e,t){var i;this._width=e,this._height=t,this.contentContainer.layout(this._width,this._height),(null===(i=this._activePanel)||void 0===i?void 0:i.layout)&&this._activePanel.layout(this._width,this._height)}_removePanel(e){const t=this._activePanel===e;if(this.doRemovePanel(e),t&&this.panels.length>0){const e=this.mostRecentlyUsed[0];this.openPanel(e)}return this._activePanel&&0===this.panels.length&&this.doSetActivePanel(void 0),this.updateContainer(),e}doRemovePanel(t){const i=this.panels.indexOf(t);this._activePanel===t&&this.contentContainer.closePanel(),this.tabsContainer.delete(t.id),this._panels.splice(i,1),this.mostRecentlyUsed.includes(t)&&this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(t),1),this._onDidGroupChange.fire({kind:e.GroupChangeKind2.REMOVE_PANEL,panel:t})}doAddPanel(t,i=this.panels.length){const n=this._panels.indexOf(t)>-1;this.tabsContainer.openPanel(t,i),this.contentContainer.openPanel(t),this.tabsContainer.show(),this.contentContainer.show(),n||(this.updateMru(t),this.panels.splice(i,0,t),this._onDidGroupChange.fire({kind:e.GroupChangeKind2.ADD_PANEL,panel:t}))}doSetActivePanel(t){this._activePanel=t,t&&(this.tabsContainer.setActivePanel(t),t.layout(this._width,this._height),this.updateMru(t),this._onDidGroupChange.fire({kind:e.GroupChangeKind2.PANEL_ACTIVE,panel:t}))}updateMru(e){this.mostRecentlyUsed.includes(e)&&this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(e),1),this.mostRecentlyUsed=[e,...this.mostRecentlyUsed]}updateContainer(){if(this.updateActions(),E(this.container,"empty",this.isEmpty),this.panels.forEach((e=>e.updateParentGroup(this.parent,this.isActive))),this.isEmpty&&!this.watermark){const e=this.accessor.createWatermarkComponent();e.init({containerApi:new D(this.accessor),params:{},title:"",api:null}),this.watermark=e,h(this.watermark.element,"click",(()=>{this.isActive||this.accessor.doSetGroupActive(this.parent)})),this.contentContainer.hide(),this.tabsContainer.hide(),this.container.appendChild(this.watermark.element),this.watermark.updateParentGroup(this.parent,!0)}!this.isEmpty&&this.watermark&&(this.watermark.element.remove(),this.watermark.dispose(),this.watermark=void 0,this.contentContainer.show(),this.tabsContainer.show())}canDisplayOverlay(e,t){return!1}handleDropEvent(e,t,i){const n=b();if(n){if(-1!==this.tabsContainer.indexOf(n.panelId)&&1===this.tabsContainer.size)return;const{groupId:e,panelId:s}=n;if(this.id===e&&!t){if(this.tabsContainer.indexOf(s)===i)return}this._onMove.fire({target:t,groupId:n.groupId,itemId:n.panelId,index:i})}}dispose(){for(const e of this.panels)e.dispose();super.dispose(),this.dropTarget.dispose(),this.tabsContainer.dispose(),this.contentContainer.dispose()}}e.GroupChangeKind=void 0,(ce=e.GroupChangeKind||(e.GroupChangeKind={})).ADD_PANEL="ADD_PANEL",ce.REMOVE_PANEL="REMOVE_PANEL",ce.PANEL_ACTIVE="PANEL_ACTIVE",ce.GROUP_ACTIVE="GROUP_ACTIVE",ce.ADD_GROUP="ADD_GROUP",ce.REMOVE_GROUP="REMOVE_GROUP",ce.LAYOUT_FROM_JSON="LAYOUT_FROM_JSON",ce.LAYOUT="LAYOUT";const ge=T();function we(t){switch(t){case"left":return e.Position.Left;case"right":return e.Position.Right;case"above":return e.Position.Top;case"below":return e.Position.Bottom;default:return e.Position.Center}}class be extends l{constructor(t,i){super(),this._element=t,this._id=ge.next(),this._groups=new Map,this._onGridEvent=new a,this.onGridEvent=this._onGridEvent.event,this._onDidLayoutChange=new a,this.onDidLayoutChange=this._onDidLayoutChange.event,this.gridview=new ae(!!i.proportionalLayout,i.styles,i.orientation),this.element.appendChild(this.gridview.element),this.layout(0,0,!0),this.addDisposables(this.gridview.onDidChange((()=>{this._onGridEvent.fire({kind:e.GroupChangeKind.LAYOUT})}))),this.addDisposables((()=>{const t=new d;return new l(this.onGridEvent((i=>{[e.GroupChangeKind.ADD_GROUP,e.GroupChangeKind.REMOVE_GROUP,e.GroupChangeKind.ADD_PANEL,e.GroupChangeKind.REMOVE_PANEL,e.GroupChangeKind.GROUP_ACTIVE,e.GroupChangeKind.PANEL_ACTIVE,e.GroupChangeKind.LAYOUT].includes(i.kind)&&t.fire()})),t.onEvent((()=>{this._onDidLayoutChange.fire()})),t)})())}get id(){return this._id}get element(){return this._element}get size(){return this._groups.size}get groups(){return Array.from(this._groups.values()).map((e=>e.value))}get width(){return this.gridview.width}get height(){return this.gridview.height}get minimumHeight(){return this.gridview.minimumHeight}get maximumHeight(){return this.gridview.maximumHeight}get minimumWidth(){return this.gridview.minimumWidth}get maximumWidth(){return this.gridview.maximumWidth}get activeGroup(){return this._activeGroup}setVisible(t,i){this.gridview.setViewVisible(Q(t.element),i),this._onGridEvent.fire({kind:e.GroupChangeKind.LAYOUT})}isVisible(e){return this.gridview.isViewVisible(Q(e.element))}doAddGroup(t,i=[0],n){this.gridview.addView(t,null!=n?n:e.Sizing.Distribute,i),this._onGridEvent.fire({kind:e.GroupChangeKind.ADD_GROUP}),this.doSetGroupActive(t)}doRemoveGroup(t,i){if(!this._groups.has(t.id))throw new Error("invalid operation");const n=this._groups.get(t.id),s=this.gridview.remove(t,e.Sizing.Distribute);if(n&&!(null==i?void 0:i.skipDispose)&&(n.disposable.dispose(),this._groups.delete(t.id)),this._onGridEvent.fire({kind:e.GroupChangeKind.REMOVE_GROUP}),!(null==i?void 0:i.skipActive)&&this._activeGroup===t){const e=Array.from(this._groups.values());this.doSetGroupActive(e.length>0?e[0].value:void 0)}return s}getPanel(e){var t;return null===(t=this._groups.get(e))||void 0===t?void 0:t.value}doSetGroupActive(t,i){this._activeGroup!==t&&(this._activeGroup&&(this._activeGroup.setActive(!1),i||this._activeGroup.focus()),t&&(t.setActive(!0),i||t.focus()),this._activeGroup=t,this._onGridEvent.fire({kind:e.GroupChangeKind.GROUP_ACTIVE}))}removeGroup(e){this.doRemoveGroup(e)}moveToNext(e){var t;if(e||(e={}),!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}const i=Q(e.group.element),n=null===(t=this.gridview.next(i))||void 0===t?void 0:t.view;this.doSetGroupActive(n)}moveToPrevious(e){var t;if(e||(e={}),!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}const i=Q(e.group.element),n=null===(t=this.gridview.previous(i))||void 0===t?void 0:t.view;this.doSetGroupActive(n)}layout(e,t,i){(i||e!==this.width||t!==this.height)&&(this.element.style.height=`${t}px`,this.element.style.width=`${e}px`,this.gridview.layout(e,t))}resizeToFit(){if(!this.element.parentElement)return;const{width:e,height:t}=this.element.parentElement.getBoundingClientRect();this.layout(e,t)}dispose(){super.dispose(),this._onGridEvent.dispose(),this.gridview.dispose()}}class fe extends l{constructor(e){super(),this.id=e,this._state={},this._isFocused=!1,this._isActive=!1,this._isVisible=!0,this._width=0,this._height=0,this._onDidStateChange=new a,this.onDidStateChange=this._onDidStateChange.event,this._onDidPanelDimensionChange=new a({replay:!0}),this.onDidDimensionsChange=this._onDidPanelDimensionChange.event,this._onDidChangeFocus=new a({replay:!0}),this.onDidFocusChange=this._onDidChangeFocus.event,this._onFocusEvent=new a,this.onFocusEvent=this._onFocusEvent.event,this._onDidVisibilityChange=new a({replay:!0}),this.onDidVisibilityChange=this._onDidVisibilityChange.event,this._onVisibilityChange=new a,this.onVisibilityChange=this._onVisibilityChange.event,this._onDidActiveChange=new a({replay:!0}),this.onDidActiveChange=this._onDidActiveChange.event,this._onActiveChange=new a,this.onActiveChange=this._onActiveChange.event,this.addDisposables(this._onDidStateChange,this._onDidPanelDimensionChange,this._onDidChangeFocus,this._onDidVisibilityChange,this._onDidActiveChange,this._onFocusEvent,this.onDidFocusChange((e=>{this._isFocused=e.isFocused})),this.onDidActiveChange((e=>{this._isActive=e.isActive})),this.onDidVisibilityChange((e=>{this._isVisible=e.isVisible})),this.onDidDimensionsChange((e=>{this._width=e.width,this._height=e.height})))}get isFocused(){return this._isFocused}get isActive(){return this._isActive}get isVisible(){return this._isVisible}get width(){return this._width}get height(){return this._height}setVisible(e){this._onVisibilityChange.fire({isVisible:e})}setActive(){this._onActiveChange.fire()}setState(e,t){"object"==typeof e?this._state=e:void 0!==typeof t&&(this._state[e]=t),this._onDidStateChange.fire(void 0)}getState(){return this._state}getStateKey(e){return this._state[e]}dispose(){super.dispose()}}class _e extends fe{constructor(e){super(e),this._onDidConstraintsChangeInternal=new a,this.onDidConstraintsChangeInternal=this._onDidConstraintsChangeInternal.event,this._onDidConstraintsChange=new a({replay:!0}),this.onDidConstraintsChange=this._onDidConstraintsChange.event,this._onDidSizeChange=new a,this.onDidSizeChange=this._onDidSizeChange.event}setConstraints(e){this._onDidConstraintsChangeInternal.fire(e)}setSize(e){this._onDidSizeChange.fire(e)}}class Ce extends _e{constructor(e,t){super(e.id),this.panel=e,this._onDidDirtyChange=new a,this.onDidDirtyChange=this._onDidDirtyChange.event,this._onDidTitleChange=new a,this.onDidTitleChange=this._onDidTitleChange.event,this._titleChanged=new a,this.titleChanged=this._titleChanged.event,this._suppressClosableChanged=new a,this.suppressClosableChanged=this._suppressClosableChanged.event,this._group=t,this.addDisposables(this._onDidDirtyChange)}get tryClose(){return this._interceptor}get title(){return this.panel.title}get suppressClosable(){return!!this.panel.suppressClosable}get isGroupActive(){var e;return!!(null===(e=this.group)||void 0===e?void 0:e.isActive)}set group(e){this._group=e}get group(){return this._group}setTitle(e){this._onDidTitleChange.fire({title:e})}close(){if(!this.group)throw new Error(`panel ${this.id} has no group`);return this.group.model.closePanel(this.panel)}interceptOnCloseAction(e){this._interceptor=e}dispose(){super.dispose()}}class ye extends l{constructor(e,t){super(),this.id=e,this.containerApi=t,this.mutableDisposable=new p,this._suppressClosable=!1,this._title="",this.api=new Ce(this,this._group),this.onDidStateChange=this.api.onDidStateChange,this.addDisposables(this.api.onActiveChange((()=>{this.containerApi.setActivePanel(this)})),this.api.onDidTitleChange((e=>{const t=e.title;this.update({params:{title:t}})})))}get title(){return this._title}get suppressClosable(){return this._suppressClosable}get group(){return this._group}get view(){return this._view}init(e){var t;this._params=e.params,this._view=e.view,this.setTitle(e.title),this.setSuppressClosable(e.suppressClosable||!1),e.state&&this.api.setState(e.state),null===(t=this.view)||void 0===t||t.init(Object.assign(Object.assign({},e),{api:this.api,containerApi:this.containerApi}))}focus(){this.api._onFocusEvent.fire()}setDirty(e){this.api._onDidDirtyChange.fire(e)}close(){return this.api.tryClose?this.api.tryClose():Promise.resolve(!0)}toJSON(){const e=this.api.getState();return{id:this.id,view:this.view.toJSON(),params:Object.keys(this._params||{}).length>0?this._params:void 0,state:e&&Object.keys(e).length>0?e:void 0,suppressClosable:this.suppressClosable||void 0,title:this.title}}setTitle(e){var t;e!==(null===(t=this._params)||void 0===t?void 0:t.title)&&(this._title=e,this.api._titleChanged.fire({title:this.title}))}setSuppressClosable(e){var t;e!==(null===(t=this._params)||void 0===t?void 0:t.suppressClosable)&&(this._suppressClosable=e,this.api._suppressClosableChanged.fire({suppressClosable:!!this.suppressClosable}))}update(e){var t;const i=e.params;this._params=Object.assign(Object.assign({},this._params||{}),e.params.params),"string"==typeof i.title&&this.setTitle(i.title),"boolean"==typeof i.suppressClosable&&this.setSuppressClosable(i.suppressClosable),null===(t=this.view)||void 0===t||t.update({params:{params:this._params,title:this.title,suppressClosable:this.suppressClosable}})}updateParentGroup(t,i){var n;this._group=t,this.api.group=t,this.mutableDisposable.value=this._group.model.onDidGroupChange((t=>{var n;if(t.kind===e.GroupChangeKind2.GROUP_ACTIVE){const e=!!(null===(n=this._group)||void 0===n?void 0:n.model.isPanelActive(this));this.api._onDidActiveChange.fire({isActive:i&&e}),this.api._onDidVisibilityChange.fire({isVisible:e})}}));const s=this._group.model.isPanelActive(this);this.api._onDidActiveChange.fire({isActive:i&&s}),this.api._onDidVisibilityChange.fire({isVisible:s}),null===(n=this.view)||void 0===n||n.updateParentGroup(this._group,this._group.model.isPanelActive(this))}layout(e,t){var i,n;this.api._onDidPanelDimensionChange.fire({width:e,height:t-((null===(i=this.group)||void 0===i?void 0:i.model.tabHeight)||0)}),null===(n=this.view)||void 0===n||n.layout(e,t)}dispose(){var e;this.api.dispose(),this.mutableDisposable.dispose(),null===(e=this.view)||void 0===e||e.dispose()}}class De{constructor(){this._element=document.createElement("div"),this._element.className="actions-bar",this._list=document.createElement("ul"),this._list.className="actions-container",this._element.appendChild(this._list)}get element(){return this._element}add(e){document.createElement("li").className="action-item",this._list.appendChild(e)}}class ze extends l{constructor(){super(),this._element=document.createElement("div"),this._element.className="watermark";const e=document.createElement("div");e.className="watermark-title";const t=document.createElement("span");t.style.flexGrow="1";const i=document.createElement("div");i.className="watermark-content",this._element.appendChild(e),this._element.appendChild(i);const n=new De;e.appendChild(t),e.appendChild(n.element);const s=document.createElement("a");s.className="close-action",n.add(s),this.addDisposables(h(s,"click",(e=>{var t;e.preventDefault(),this.group&&(null===(t=this.params)||void 0===t||t.containerApi.removeGroup(this.group))})))}get id(){return"watermark"}update(e){}focus(){}toJSON(){return{}}layout(e,t){}init(e){this.params=e,this.addDisposables(this.params.containerApi.onDidLayoutChange((e=>{this.render()}))),this.render()}updateParentGroup(e,t){this.group=e,this.render()}get element(){return this._element}render(){const e=!!(this.params&&this.params.containerApi.size<=1);E(this.element,"has-actions",e)}dispose(){super.dispose()}}class Se{constructor(e,t){this.layout=e,this.panelDeserializer=t}fromJSON(e){const t=e.data.views,i=e.data.activeView,n=[];for(const e of t){const t=this.panelDeserializer.createPanel(e);n.push(t)}return this.layout.createGroup({panels:n,activePanel:n.find((e=>e.id===i)),id:e.data.id})}}function xe(e,t,i={},n={},s,o){const a="string"==typeof t?i[t]:void 0,r="string"==typeof t?n[t]:void 0;if(a&&r)throw new Error(`Cannot create '${e}'. component '${t}' registered as both a component and frameworkComponent`);if(r){if(!s)throw new Error(`Cannot create '${e}' for framework component '${t}'. you must register a frameworkPanelWrapper to use framework components`);return s.createComponent(e,t,r)}if(!a){if(o)return o();throw new Error(`Cannot create '${e}', no component '${t}' provided`)}return new a(e,t)}class Ee{constructor(e){this.renderer=e,this._element=document.createElement("element"),this.show()}get innerRenderer(){return this.renderer}get element(){return this._element}get id(){return this.renderer.id}show(){this.renderer.element.parentElement||this._element.appendChild(this.renderer.element)}hide(){this.renderer.element.parentElement&&this.renderer.element.remove()}layout(e,t){this.renderer.layout(e,t)}update(e){this.renderer.update(e)}toJSON(){return this.renderer.toJSON()}focus(){this.renderer.focus()}init(e){this.renderer.init(e)}updateParentGroup(e,t){this.renderer.updateParentGroup(e,t)}dispose(){this.renderer.dispose()}}class Pe extends l{constructor(){super(),this._isPanelVisible=!1,this._isGroupActive=!1,this.params={},this.isDirtyDisposable=new p,this.addDisposables(this.isDirtyDisposable),this._element=document.createElement("div"),this._element.className="default-tab",this._content=document.createElement("div"),this._content.className="tab-content",this._actionContainer=document.createElement("div"),this._actionContainer.className="action-container",this._list=document.createElement("ul"),this._list.className="tab-list",this.action=document.createElement("a"),this.action.className="tab-action",this._element.appendChild(this._content),this._element.appendChild(this._actionContainer),this._actionContainer.appendChild(this._list),this._list.appendChild(this.action),this.addDisposables(h(this._actionContainer,"mousedown",(e=>{e.preventDefault()}))),this.render()}get element(){return this._element}get id(){return"__DEFAULT_TAB__"}update(e){this.params=Object.assign(Object.assign({},this.params),e.params),this.render()}toJSON(){return{id:this.id}}focus(){}init(e){this.params=e,this._content.textContent=e.title,this.isDirtyDisposable.value=this.params.api.onDidDirtyChange((e=>{const t=e;E(this.action,"dirty",t)})),this.params.suppressClosable?this.action.classList.add("disable-close"):h(this.action,"click",(e=>{e.preventDefault(),this.params.api.close()}))}updateParentGroup(e,t){this._isPanelVisible=t,this._isGroupActive=e.isActive,this.render()}layout(e,t){}render(){this._content.textContent=this.params.title}}class Ae extends l{constructor(e,t,i){super(),this.id=e,this.component=t,this.api=i,this._height=0,this._width=0,this._element=document.createElement("div"),this._element.tabIndex=-1,this._element.style.outline="none",this._element.style.height="100%",this._element.style.width="100%",this._element.style.overflow="hidden";const{onDidFocus:n,onDidBlur:s}=O(this._element);this.addDisposables(this.api,n((()=>{this.api._onDidChangeFocus.fire({isFocused:!0})})),s((()=>{this.api._onDidChangeFocus.fire({isFocused:!1})})))}get element(){return this._element}get width(){return this._width}get height(){return this._height}focus(){this.api._onFocusEvent.fire()}layout(e,t){this._width=e,this._height=t,this.api._onDidPanelDimensionChange.fire({width:e,height:t}),this.part&&this.params&&this.part.update(this.params.params)}init(e){this.params=e,this.part=this.getComponent()}update(e){var t,i;this.params=Object.assign(Object.assign({},this.params),{params:Object.assign(Object.assign({},null===(t=this.params)||void 0===t?void 0:t.params),e.params)}),null===(i=this.part)||void 0===i||i.update({params:this.params.params})}toJSON(){var e,t;const i=this.api.getState(),n=null!==(t=null===(e=this.params)||void 0===e?void 0:e.params)&&void 0!==t?t:{};return{id:this.id,component:this.component,params:Object.keys(n).length>0?n:void 0,state:0===Object.keys(i).length?void 0:i}}dispose(){super.dispose(),this.api.dispose()}}class Oe extends Ae{constructor(e,t,i=new _e(e)){super(e,t,i),this._evaluatedMinimumWidth=0,this._evaluatedMaximumWidth=Number.MAX_SAFE_INTEGER,this._evaluatedMinimumHeight=0,this._evaluatedMaximumHeight=Number.MAX_SAFE_INTEGER,this._minimumWidth=0,this._minimumHeight=0,this._maximumWidth=Number.MAX_SAFE_INTEGER,this._maximumHeight=Number.MAX_SAFE_INTEGER,this._snap=!1,this._onDidChange=new a,this.onDidChange=this._onDidChange.event,this.addDisposables(this.api.onVisibilityChange((e=>{const{isVisible:t}=e,{containerApi:i}=this.params;i.setVisible(this,t)})),this.api.onActiveChange((()=>{const{containerApi:e}=this.params;e.setActive(this)})),this.api.onDidConstraintsChangeInternal((e=>{"number"!=typeof e.minimumWidth&&"function"!=typeof e.minimumWidth||(this._minimumWidth=e.minimumWidth),"number"!=typeof e.minimumHeight&&"function"!=typeof e.minimumHeight||(this._minimumHeight=e.minimumHeight),"number"!=typeof e.maximumWidth&&"function"!=typeof e.maximumWidth||(this._maximumWidth=e.maximumWidth),"number"!=typeof e.maximumHeight&&"function"!=typeof e.maximumHeight||(this._maximumHeight=e.maximumHeight)})),this.api.onDidSizeChange((e=>{this._onDidChange.fire({height:e.height,width:e.width})})))}get priority(){return this._priority}get snap(){return this._snap}get minimumWidth(){const e="function"==typeof this._minimumWidth?this._minimumWidth():this._minimumWidth;return e!==this._evaluatedMinimumWidth&&(this._evaluatedMinimumWidth=e,this.updateConstraints()),e}get minimumHeight(){const e="function"==typeof this._minimumHeight?this._minimumHeight():this._minimumHeight;return e!==this._evaluatedMinimumHeight&&(this._evaluatedMinimumHeight=e,this.updateConstraints()),e}get maximumHeight(){const e="function"==typeof this._maximumHeight?this._maximumHeight():this._maximumHeight;return e!==this._evaluatedMaximumHeight&&(this._evaluatedMaximumHeight=e,this.updateConstraints()),e}get maximumWidth(){const e="function"==typeof this._maximumWidth?this._maximumWidth():this._maximumWidth;return e!==this._evaluatedMaximumWidth&&(this._evaluatedMaximumWidth=e,this.updateConstraints()),e}get isActive(){return this.api.isActive}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}init(e){e.maximumHeight&&(this._maximumHeight=e.maximumHeight),e.minimumHeight&&(this._minimumHeight=e.minimumHeight),e.maximumWidth&&(this._maximumWidth=e.maximumWidth),e.minimumWidth&&(this._minimumWidth=e.minimumWidth),this._priority=e.priority,this._snap=!!e.snap,super.init(e),"boolean"==typeof e.isVisible&&this.setVisible(e.isVisible)}updateConstraints(){this.api._onDidConstraintsChange.fire({minimumWidth:this._evaluatedMinimumWidth,maximumWidth:this._evaluatedMaximumWidth,minimumHeight:this._evaluatedMinimumHeight,maximumHeight:this._evaluatedMaximumHeight})}toJSON(){const e=super.toJSON(),t=e=>e===Number.MAX_SAFE_INTEGER?void 0:e,i=e=>e<=0?void 0:e;return Object.assign(Object.assign({},e),{minimumHeight:i(this.minimumHeight),maximumHeight:t(this.maximumHeight),minimumWidth:i(this.minimumWidth),maximumWidth:t(this.maximumWidth),snap:this.snap,priority:this.priority})}dispose(){super.dispose()}}class Ne extends Oe{constructor(e,t,i){super(t,"groupview_default",new _e(t)),this._model=new ve(this.element,e,t,i,this)}get model(){return this._model}get minimumHeight(){return this._model.minimumHeight}get maximumHeight(){return this._model.maximumHeight}get minimumWidth(){return this._model.minimumWidth}get maximumWidth(){return this._model.maximumWidth}initialize(){this.model.initialize()}setActive(e){super.setActive(e),this.model.setActive(e)}layout(e,t){super.layout(e,t),this.model.layout(e,t)}getComponent(){return this._model}toJSON(){return this.model.toJSON()}}class Ve{constructor(e){var t;this._content=e.content,this._tab=new Ee(null!==(t=e.tab)&&void 0!==t?t:new Pe),this._actions=e.actions||(this.content.actions?{element:this.content.actions,dispose:()=>{}}:void 0)}get content(){return this._content}get tab(){return this._tab}get actions(){return this._actions}init(e){this.content.init(Object.assign(Object.assign({},e),{tab:this.tab})),this.tab.init(e)}updateParentGroup(e,t){var i;this._content.updateParentGroup(e,t),null===(i=this._tab)||void 0===i||i.updateParentGroup(e,t)}layout(e,t){this.content.layout(e,t)}update(e){this.content.update(e),this.tab.update(e)}toJSON(){return{content:this.content.toJSON(),tab:this.tab.innerRenderer instanceof Pe?void 0:this.tab.toJSON()}}dispose(){var e;this.content.dispose(),this.tab.dispose(),null===(e=this.actions)||void 0===e||e.dispose()}}const Te=T();class ke extends be{constructor(t,i){super(t,{proportionalLayout:!0,orientation:i.orientation||e.Orientation.HORIZONTAL,styles:i.styles}),this._panels=new Map,this.dirtyPanels=new Set,this.debouncedDeque=function(e,t){let i;return(...n)=>{clearTimeout(i),i=setTimeout((()=>e(...n)),t)}}(this.syncConfigs.bind(this),5e3),this._onTabInteractionEvent=new a,this.onTabInteractionEvent=this._onTabInteractionEvent.event,this._onTabContextMenu=new a,this.onTabContextMenu=this._onTabContextMenu.event,this.panelState={},this._options=i,this.options.components||(this.options.components={}),this.options.frameworkComponents||(this.options.frameworkComponents={}),this.options.frameworkTabComponents||(this.options.frameworkTabComponents={}),this.options.tabComponents||(this.options.tabComponents={}),this.options.watermarkComponent||this.options.watermarkFrameworkComponent||(this.options.watermarkComponent=ze),this._api=new D(this)}get totalPanels(){return this._panels.size}get panels(){return Array.from(this._panels.values()).map((e=>e.value))}get deserializer(){return this._deserializer}set deserializer(e){this._deserializer=e}get options(){return this._options}get activePanel(){const e=this.activeGroup;if(e)return e.model.activePanel}set tabHeight(e){this.options.tabHeight=e,this._groups.forEach((t=>{t.value.model.tabHeight=e}))}get tabHeight(){return this.options.tabHeight}updateOptions(e){const t="string"==typeof e.orientation&&this.options.orientation!==e.orientation;this._options=Object.assign(Object.assign({},this.options),e),t&&(this.gridview.orientation=e.orientation),this.layout(this.gridview.width,this.gridview.height,!0)}focus(){var e;null===(e=this.activeGroup)||void 0===e||e.focus()}getGroupPanel(e){var t;return null===(t=this._panels.get(e))||void 0===t?void 0:t.value}setActivePanel(e){if(!e.group)throw new Error(`Panel ${e.id} has no associated group`);this.doSetGroupActive(e.group),e.group.model.openPanel(e)}moveToNext(e={}){var t;if(!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}if(e.includePanel&&e.group&&e.group.model.activePanel!==e.group.model.panels[e.group.model.panels.length-1])return void e.group.model.moveToNext({suppressRoll:!0});const i=Q(e.group.element),n=null===(t=this.gridview.next(i))||void 0===t?void 0:t.view;this.doSetGroupActive(n)}moveToPrevious(e={}){var t;if(!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}if(e.includePanel&&e.group&&e.group.model.activePanel!==e.group.model.panels[0])return void e.group.model.moveToPrevious({suppressRoll:!0});const i=Q(e.group.element),n=null===(t=this.gridview.previous(i))||void 0===t?void 0:t.view;n&&this.doSetGroupActive(n)}registerPanel(e){if(this._panels.has(e.id))throw new Error(`panel ${e.id} already exists`);const t=new l(e.onDidStateChange((()=>this.addDirtyPanel(e))));this._panels.set(e.id,{value:e,disposable:t})}unregisterPanel(e){if(!this._panels.has(e.id))throw new Error(`panel ${e.id} doesn't exist`);const t=this._panels.get(e.id);t&&(t.disposable.dispose(),t.value.dispose()),this._panels.delete(e.id)}toJSON(){var e;this.syncConfigs();return{grid:this.gridview.serialize(),panels:Array.from(this._panels.values()).reduce(((e,t)=>(this.panelState[t.value.id]||(e[t.value.id]=t.value.toJSON()),e)),{}),activeGroup:null===(e=this.activeGroup)||void 0===e?void 0:e.id,options:{tabHeight:this.tabHeight}}}fromJSON(t){if(this.gridview.clear(),this._panels.forEach((e=>{e.disposable.dispose(),e.value.dispose()})),this._panels.clear(),this._groups.clear(),!this.deserializer)throw new Error("invalid deserializer");const{grid:i,panels:n,options:s,activeGroup:o}=t;if("number"==typeof(null==s?void 0:s.tabHeight)&&(this.tabHeight=s.tabHeight),!this.deserializer)throw new Error("no deserializer provided");if(this.gridview.deserialize(i,new Se(this,{createPanel:e=>{const t=n[e],i=this.deserializer.fromJSON(t);return this.registerPanel(i),i}})),"string"==typeof o){const e=this.getPanel(o);e&&this.doSetGroupActive(e)}this.gridview.layout(this.width,this.height),this._onGridEvent.fire({kind:e.GroupChangeKind.LAYOUT_FROM_JSON})}closeAllGroups(){return re(this,void 0,void 0,(function*(){for(const e of this._groups.entries()){const[t,i]=e;if(!(yield i.value.model.closeAllPanels()))return!1}return!0}))}fireMouseEvent(t){if(t.kind===e.MouseEventKind.CONTEXT_MENU)t.tab&&t.panel&&this._onTabContextMenu.fire({event:t.event,api:this._api,panel:t.panel})}addPanel(t){var i,n;const s=this._addPanel(t);let o;if(null===(i=t.position)||void 0===i?void 0:i.referencePanel){const e=this.getGroupPanel(t.position.referencePanel);if(!e)throw new Error(`referencePanel ${t.position.referencePanel} does not exist`);o=this.findGroup(e)}else o=this.activeGroup;if(o){const i=we((null===(n=t.position)||void 0===n?void 0:n.direction)||"within");if(i===e.Position.Center)o.model.openPanel(s);else{const e=Q(o.element),t=ee(this.gridview.orientation,e,i);this.addPanelToNewGroup(s,t)}}else this.addPanelToNewGroup(s);return s}removePanel(e){this.unregisterPanel(e);const t=e.group;if(!t)throw new Error(`cannot remove panel ${e.id}. it's missing a group.`);t.model.removePanel(e),0===t.model.size&&this.removeGroup(t)}createWatermarkComponent(){var e;return xe("watermark-id","watermark-name",this.options.watermarkComponent?{"watermark-name":this.options.watermarkComponent}:{},this.options.watermarkFrameworkComponent?{"watermark-name":this.options.watermarkFrameworkComponent}:{},null===(e=this.options.frameworkComponentFactory)||void 0===e?void 0:e.watermark)}addEmptyGroup(e){var t;const i=this.createGroup();if(e){const n=null===(t=this._panels.get(e.referencePanel))||void 0===t?void 0:t.value;if(!n)throw new Error(`reference panel ${e.referencePanel} does not exist`);const s=this.findGroup(n);if(!s)throw new Error(`reference group for reference panel ${e.referencePanel} does not exist`);const o=we(e.direction||"within"),a=Q(s.element),r=ee(this.gridview.orientation,a,o);this.doAddGroup(i,r)}else this.doAddGroup(i)}removeGroup(e){[...e.model.panels].forEach((e=>{this.removePanel(e)})),1!==this._groups.size?super.removeGroup(e):this._activeGroup=e}moveGroupOrPanel(t,i,n,s,o){var a,r,h;const d=i?null===(a=this._groups.get(i))||void 0===a?void 0:a.value:void 0;if(s&&s!==e.Position.Center){const e=Q(t.element),i=ee(this.gridview.orientation,e,s);if(d&&d.model.size<2){const[e,n]=k(i),o=Q(d.element),[a,r]=k(o);if(I(a,e))this.gridview.moveView(a,r,n);else{const e=this.doRemoveGroup(d,{skipActive:!0,skipDispose:!0}),i=Q(t.element),n=ee(this.gridview.orientation,i,s);this.doAddGroup(e,n)}}else{const t=(null==d?void 0:d.model.removePanel(n))||(null===(h=this._panels.get(n))||void 0===h?void 0:h.value);if(!t)throw new Error(`No panel with id ${n}`);const i=ee(this.gridview.orientation,e,s);this.addPanelToNewGroup(t,i)}}else{const e=(null==d?void 0:d.model.removePanel(n))||(null===(r=this._panels.get(n))||void 0===r?void 0:r.value);if(!e)throw new Error(`No panel with id ${n}`);0===(null==d?void 0:d.model.size)&&this.doRemoveGroup(d),t.model.openPanel(e,{index:o})}}doSetGroupActive(t,i){var n,s;const o=this._activeGroup===t;super.doSetGroupActive(t,i),!o&&(null===(n=this._activeGroup)||void 0===n?void 0:n.model.activePanel)&&this._onGridEvent.fire({kind:e.GroupChangeKind.PANEL_ACTIVE,panel:null===(s=this._activeGroup)||void 0===s?void 0:s.model.activePanel})}createGroup(t){t||(t={tabHeight:this.tabHeight}),"number"!=typeof t.tabHeight&&(t.tabHeight=this.tabHeight);let i=null==t?void 0:t.id;if(i&&this._groups.has(t.id)&&(console.warn(`Duplicate group id ${null==t?void 0:t.id}. reassigning group id to avoid errors`),i=void 0),!i)for(i=Te.next();this._groups.has(i);)i=Te.next();const n=new Ne(this,i,t);if(!this._groups.has(n.id)){const t=new l(n.model.onMove((e=>{const{groupId:t,itemId:i,target:s,index:o}=e;this.moveGroupOrPanel(n,t,i,s,o)})),n.model.onDidGroupChange((t=>{switch(t.kind){case e.GroupChangeKind2.ADD_PANEL:this._onGridEvent.fire({kind:e.GroupChangeKind.ADD_PANEL,panel:t.panel});break;case e.GroupChangeKind2.GROUP_ACTIVE:this._onGridEvent.fire({kind:e.GroupChangeKind.GROUP_ACTIVE,panel:t.panel});break;case e.GroupChangeKind2.REMOVE_PANEL:this._onGridEvent.fire({kind:e.GroupChangeKind.REMOVE_PANEL,panel:t.panel});break;case e.GroupChangeKind2.PANEL_ACTIVE:this._onGridEvent.fire({kind:e.GroupChangeKind.PANEL_ACTIVE,panel:t.panel})}})));this._groups.set(n.id,{value:n,disposable:t})}return n.initialize(),"number"==typeof this.options.tabHeight&&(n.model.tabHeight=this.options.tabHeight),n}dispose(){super.dispose(),this._onGridEvent.dispose()}syncConfigs(){const e=Array.from(this.dirtyPanels);e.length,this.dirtyPanels.clear();const t=e.map((e=>this._panels.get(e.id))).filter((e=>!!e)).reduce(((e,t)=>(e[t.value.id]=t.value.toJSON(),e)),{});this.panelState=Object.assign(Object.assign({},this.panelState),t),e.filter((e=>this._panels.has(e.id))).forEach((e=>{e.setDirty(!1)}))}_addPanel(e){const t=new Ve({content:this.createContentComponent(e.id,e.component),tab:this.createTabComponent(e.id,e.tabComponent)}),i=new ye(e.id,this._api);return i.init({view:t,title:e.title||e.id,suppressClosable:null==e?void 0:e.suppressClosable,params:(null==e?void 0:e.params)||{}}),this.registerPanel(i),i}createContentComponent(e,t){var i;return xe(e,t,this.options.components||{},this.options.frameworkComponents,null===(i=this.options.frameworkComponentFactory)||void 0===i?void 0:i.content)}createTabComponent(e,t){var i;return xe(e,t,this.options.tabComponents||{},this.options.frameworkTabComponents,null===(i=this.options.frameworkComponentFactory)||void 0===i?void 0:i.tab,(()=>new Pe))}addPanelToNewGroup(e,t=[0]){const i=this.createGroup();this.doAddGroup(i,t),i.model.openPanel(e)}findGroup(e){var t;return null===(t=Array.from(this._groups.values()).find((t=>t.value.model.containsPanel(e))))||void 0===t?void 0:t.value}addDirtyPanel(e){this.dirtyPanels.add(e),e.setDirty(!0),this.debouncedDeque()}}class Ie extends be{constructor(e,t){super(e,{proportionalLayout:t.proportionalLayout,orientation:t.orientation,styles:t.styles}),this._options=t,this.options.components||(this.options.components={}),this.options.frameworkComponents||(this.options.frameworkComponents={})}get orientation(){return this.gridview.orientation}set orientation(e){this.gridview.orientation=e}get options(){return this._options}get deserializer(){return this._deserializer}set deserializer(e){this._deserializer=e}updateOptions(e){const t="string"==typeof e.orientation&&this.options.orientation!==e.orientation;this._options=Object.assign(Object.assign({},this.options),e),t&&(this.gridview.orientation=e.orientation),this.layout(this.gridview.width,this.gridview.height,!0)}removePanel(e){this.removeGroup(e)}toJSON(){var e;return{grid:this.gridview.serialize(),activePanel:null===(e=this.activeGroup)||void 0===e?void 0:e.id}}setVisible(e,t){this.gridview.setViewVisible(Q(e.element),t)}setActive(e){this._groups.forEach(((t,i)=>{t.value.setActive(e===t.value)}))}toggleVisibility(e){this.setVisible(e,!this.isVisible(e))}focus(){var e;null===(e=this.activeGroup)||void 0===e||e.focus()}fromJSON(t,i){const{grid:n,activePanel:s}=t;this.gridview.clear(),this._groups.clear();const o=[];if(this.gridview.deserialize(n,{fromJSON:e=>{const{data:t}=e,i=xe(t.id,t.component,this.options.components||{},this.options.frameworkComponents||{},this.options.frameworkComponentFactory?{createComponent:this.options.frameworkComponentFactory.createComponent}:void 0);return o.push((()=>i.init({params:t.params,minimumWidth:t.minimumWidth,maximumWidth:t.maximumWidth,minimumHeight:t.minimumHeight,maximumHeight:t.maximumHeight,priority:t.priority,snap:!!t.snap,containerApi:new y(this),isVisible:e.visible}))),this.registerPanel(i),i}}),this.layout(this.width,this.height,!0),i?setTimeout((()=>{o.forEach((e=>e()))}),0):o.forEach((e=>e())),"string"==typeof s){const e=this.getPanel(s);e&&this.doSetGroupActive(e)}this._onGridEvent.fire({kind:e.GroupChangeKind.LAYOUT_FROM_JSON})}movePanel(t,i){var n;let s;const o=this.gridview.remove(t),a=null===(n=this._groups.get(i.reference))||void 0===n?void 0:n.value;if(!a)throw new Error(`reference group ${i.reference} does not exist`);const r=we(i.direction);if(r===e.Position.Center)throw new Error(`${r} not supported as an option`);{const e=Q(a.element);s=ee(this.gridview.orientation,e,r)}this.doAddGroup(o,s,i.size)}addPanel(t){var i,n;let s=t.location||[0];if(null===(i=t.position)||void 0===i?void 0:i.reference){const i=null===(n=this._groups.get(t.position.reference))||void 0===n?void 0:n.value;if(!i)throw new Error(`reference group ${t.position.reference} does not exist`);const o=we(t.position.direction);if(o===e.Position.Center)throw new Error(`${o} not supported as an option`);{const e=Q(i.element);s=ee(this.gridview.orientation,e,o)}}const o=xe(t.id,t.component,this.options.components||{},this.options.frameworkComponents||{},this.options.frameworkComponentFactory?{createComponent:this.options.frameworkComponentFactory.createComponent}:void 0);return o.init({params:t.params||{},minimumWidth:t.minimumWidth,maximumWidth:t.maximumWidth,minimumHeight:t.minimumHeight,maximumHeight:t.maximumHeight,priority:t.priority,snap:!!t.snap,containerApi:new y(this),isVisible:!0}),this.registerPanel(o),this.doAddGroup(o,s,t.size),{api:o.api}}registerPanel(e){const t=new l(e.api.onDidFocusChange((t=>{t.isFocused&&this._groups.forEach((t=>{const i=t.value;i!==e?i.setActive(!1):i.setActive(!0)}))})));this._groups.set(e.id,{value:e,disposable:t})}moveGroup(e,t,i){const n=this.getPanel(t);if(!n)throw new Error("invalid operation");const s=Q(e.element),o=ee(this.gridview.orientation,s,i),[a,r]=k(o),h=Q(n.element),[d,l]=k(h);if(I(d,a))return void this.gridview.moveView(d,l,r);const p=this.doRemoveGroup(n,{skipActive:!0,skipDispose:!0}),c=Q(e.element),u=ee(this.gridview.orientation,c,i);this.doAddGroup(p,u)}removeGroup(e){super.removeGroup(e);const t=this._groups.get(e.id);t&&(t.disposable.dispose(),this._groups.delete(e.id))}dispose(){super.dispose()}}class Ge extends l{constructor(e,t){super(),this.element=e,this._disposable=new p,this.panels=new Map,this._onDidAddView=new a,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new a,this.onDidRemoveView=this._onDidRemoveView.event,this._onDidLayoutChange=new a,this.onDidLayoutChange=this._onDidLayoutChange.event,this._options=t,t.components||(t.components={}),t.frameworkComponents||(t.frameworkComponents={}),this.splitview=new j(this.element,t),this.addDisposables(this._disposable)}get options(){return this._options}get orientation(){return this.splitview.orientation}get splitview(){return this._splitview}set splitview(e){this._splitview=e,this._disposable.value=new l(this._splitview.onDidSashEnd((()=>{this._onDidLayoutChange.fire(void 0)})),this._splitview.onDidAddView((e=>this._onDidAddView.fire(e))),this._splitview.onDidRemoveView((e=>this._onDidRemoveView.fire(e))))}get minimumSize(){return this.splitview.minimumSize}get maximumSize(){return this.splitview.maximumSize}get height(){return this.splitview.orientation===e.Orientation.HORIZONTAL?this.splitview.orthogonalSize:this.splitview.size}get width(){return this.splitview.orientation===e.Orientation.HORIZONTAL?this.splitview.size:this.splitview.orthogonalSize}get length(){return this.panels.size}updateOptions(e){const t="string"==typeof e.orientation&&this.options.orientation!==e.orientation;this._options=Object.assign(Object.assign({},this.options),e),t&&(this.splitview.orientation=e.orientation),this.splitview.layout(this.splitview.size,this.splitview.orthogonalSize)}focus(){var e;null===(e=this._activePanel)||void 0===e||e.focus()}movePanel(e,t){this.splitview.moveView(e,t)}setVisible(e,t){const i=this.getPanels().indexOf(e);this.splitview.setViewVisible(i,t)}setActive(e,t){this._activePanel=e,this.getPanels().filter((t=>t!==e)).forEach((e=>{e.api._onDidActiveChange.fire({isActive:!1}),t||e.focus()})),e.api._onDidActiveChange.fire({isActive:!0}),t||e.focus()}getPanels(){return this.splitview.getViews()}removePanel(e,t){const i=this.panels.get(e.id);null==i||i.dispose(),this.panels.delete(e.id);const n=this.getPanels().findIndex((t=>t===e));this.splitview.removeView(n,t);const s=this.getPanels();s.length>0&&this.setActive(s[s.length-1])}getPanel(e){return this.getPanels().find((t=>t.id===e))}addPanel(t){if(this.panels.has(t.id))throw new Error(`panel ${t.id} already exists`);const i=xe(t.id,t.component,this.options.components||{},this.options.frameworkComponents||{},this.options.frameworkWrapper?{createComponent:this.options.frameworkWrapper.createComponent}:void 0);i.orientation=this.splitview.orientation,i.init({params:t.params||{},minimumSize:t.minimumSize,maximumSize:t.maximumSize,snap:t.snap,priority:t.priority,containerApi:new _(this)});const n="number"==typeof t.size?t.size:e.Sizing.Distribute,s="number"==typeof t.index?t.index:void 0;this.splitview.addView(i,n,s),this.doAddView(i),this.setActive(i)}resizeToFit(){if(!this.element.parentElement)return;const{width:e,height:t}=this.element.parentElement.getBoundingClientRect();this.layout(e,t)}layout(t,i){const[n,s]=this.splitview.orientation===e.Orientation.HORIZONTAL?[t,i]:[i,t];this.splitview.layout(n,s)}doAddView(e){const t=e.api.onDidFocusChange((t=>{t.isFocused&&this.setActive(e,!0)}));this.panels.set(e.id,t)}toJSON(){var e;return{views:this.splitview.getViews().map(((e,t)=>({size:this.splitview.getViewSize(t),data:e.toJSON(),snap:!!e.snap,priority:e.priority}))),activeView:null===(e=this._activePanel)||void 0===e?void 0:e.id,size:this.splitview.size,orientation:this.splitview.orientation}}fromJSON(e,t=!1){const{views:i,orientation:n,size:s,activeView:o}=e;this.splitview.dispose();const a=[];if(this.splitview=new j(this.element,{orientation:n,proportionalLayout:this.options.proportionalLayout,descriptor:{size:s,views:i.map((e=>{const t=e.data;if(this.panels.has(t.id))throw new Error(`panel ${t.id} already exists`);const i=xe(t.id,t.component,this.options.components||{},this.options.frameworkComponents||{},this.options.frameworkWrapper?{createComponent:this.options.frameworkWrapper.createComponent}:void 0);return a.push((()=>{i.init({params:t.params||{},minimumSize:t.minimumSize,maximumSize:t.maximumSize,snap:e.snap,priority:e.priority,containerApi:new _(this)})})),i.orientation=n,this.doAddView(i),setTimeout((()=>{this._onDidAddView.fire(i)}),0),{size:e.size,view:i}}))}}),this.layout(this.width,this.height),t?setTimeout((()=>{a.forEach((e=>e()))}),0):a.forEach((e=>e())),"string"==typeof o){const e=this.getPanel(o);e&&this.setActive(e)}}dispose(){Array.from(this.panels.values()).forEach((e=>{e.dispose()})),this.panels.clear(),super.dispose()}}class Le extends l{constructor(e){super(),this.el=e,this.iframes=[],this._onDragStart=new a,this.onDragStart=this._onDragStart.event,this.configure()}configure(){this.addDisposables(h(this.el,"dragstart",(e=>{var t;this.iframes=[...A("iframe"),...A("webview")];for(const e of this.iframes)e.style.pointerEvents="none";this.el.classList.add("dragged"),setTimeout((()=>this.el.classList.remove("dragged")),0),null===(t=this.disposable)||void 0===t||t.dispose(),this.disposable=this.getData()})),h(this.el,"dragend",(e=>{var t;for(const e of this.iframes)e.style.pointerEvents="auto";this.iframes=[],null===(t=this.disposable)||void 0===t||t.dispose(),this.disposable=void 0})))}}class Re extends fe{constructor(e){super(e),this._onDidConstraintsChangeInternal=new a,this.onDidConstraintsChangeInternal=this._onDidConstraintsChangeInternal.event,this._onDidConstraintsChange=new a({replay:!0}),this.onDidConstraintsChange=this._onDidConstraintsChange.event,this._onDidSizeChange=new a,this.onDidSizeChange=this._onDidSizeChange.event}setConstraints(e){this._onDidConstraintsChangeInternal.fire(e)}setSize(e){this._onDidSizeChange.fire(e)}dispose(){super.dispose(),this._onDidConstraintsChange.dispose(),this._onDidSizeChange.dispose()}}class He extends Re{constructor(e){super(e),this._onDidExpansionChange=new a({replay:!0}),this.onDidExpansionChange=this._onDidExpansionChange.event,this._onMouseEnter=new a({}),this.onMouseEnter=this._onMouseEnter.event,this._onMouseLeave=new a({}),this.onMouseLeave=this._onMouseLeave.event}set pane(e){this._pane=e}setExpanded(e){var t;null===(t=this._pane)||void 0===t||t.setExpanded(e)}get isExpanded(){var e;return!!(null===(e=this._pane)||void 0===e?void 0:e.isExpanded())}}class Me extends Ae{constructor(e,t,i,n,s,o){super(e,t,new He(e)),this.headerComponent=i,this._onDidChangeExpansionState=new a({replay:!0}),this.onDidChangeExpansionState=this._onDidChangeExpansionState.event,this._onDidChange=new a,this.onDidChange=this._onDidChange.event,this.headerSize=22,this._orthogonalSize=0,this._size=0,this._minimumBodySize=100,this._maximumBodySize=Number.POSITIVE_INFINITY,this._isExpanded=!1,this.expandedSize=0,this.api.pane=this,this._isExpanded=s,this._headerVisible=o,this._onDidChangeExpansionState.fire(this.isExpanded()),this._orientation=n,this.element.classList.add("pane"),this.addDisposables(this.api.onDidSizeChange((e=>{this._onDidChange.fire(e.size)})),h(this.element,"mouseenter",(e=>{this.api._onMouseEnter.fire(e)})),h(this.element,"mouseleave",(e=>{this.api._onMouseLeave.fire(e)}))),this.addDisposables(this._onDidChangeExpansionState,this.onDidChangeExpansionState((e=>{this.api._onDidExpansionChange.fire({isExpanded:e})})),this.api.onDidFocusChange((e=>{this.header&&(e.isFocused?x(this.header,"focused"):S(this.header,"focused"))}))),this.renderOnce()}set orientation(e){this._orientation=e}get orientation(){return this._orientation}get minimumSize(){return this.headerSize+(this.isExpanded()?this._minimumBodySize:0)}get maximumSize(){return this.headerSize+(this.isExpanded()?this._maximumBodySize:0)}get size(){return this._size}get orthogonalSize(){return this._orthogonalSize}set orthogonalSize(e){this._orthogonalSize=e}get minimumBodySize(){return this._minimumBodySize}set minimumBodySize(e){this._minimumBodySize="number"==typeof e?e:0}get maximumBodySize(){return this._maximumBodySize}set maximumBodySize(e){this._maximumBodySize="number"==typeof e?e:Number.POSITIVE_INFINITY}get headerVisible(){return this._headerVisible}set headerVisible(e){this._headerVisible=e,this.header.style.display=e?"":"none"}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}isExpanded(){return this._isExpanded}setExpanded(e){this._isExpanded!==e&&(this._isExpanded=e,e?(this.animationTimer&&clearTimeout(this.animationTimer),this.body&&this.element.appendChild(this.body)):this.animationTimer=setTimeout((()=>{var e;null===(e=this.body)||void 0===e||e.remove()}),200),this._onDidChange.fire(e?this.width:void 0),this._onDidChangeExpansionState.fire(e))}layout(t,i){this._size=t,this._orthogonalSize=i;const[n,s]=this.orientation===e.Orientation.HORIZONTAL?[t,i]:[i,t];this.isExpanded()&&(this.expandedSize=n),super.layout(n,s)}init(e){var t,i;super.init(e),"number"==typeof e.minimumBodySize&&(this.minimumBodySize=e.minimumBodySize),"number"==typeof e.maximumBodySize&&(this.maximumBodySize=e.maximumBodySize),this.bodyPart=this.getBodyComponent(),this.headerPart=this.getHeaderComponent(),this.bodyPart.init(Object.assign(Object.assign({},e),{api:this.api})),this.headerPart.init(Object.assign(Object.assign({},e),{api:this.api})),null===(t=this.body)||void 0===t||t.append(this.bodyPart.element),null===(i=this.header)||void 0===i||i.append(this.headerPart.element),"boolean"==typeof e.isExpanded&&this.setExpanded(e.isExpanded)}toJSON(){const e=this.params;return Object.assign(Object.assign({},super.toJSON()),{headerComponent:this.headerComponent,title:e.title})}renderOnce(){this.header=document.createElement("div"),this.header.tabIndex=0,this.header.className="pane-header",this.header.style.height=`${this.headerSize}px`,this.header.style.lineHeight=`${this.headerSize}px`,this.header.style.minHeight=`${this.headerSize}px`,this.header.style.maxHeight=`${this.headerSize}px`,this.element.appendChild(this.header),this.body=document.createElement("div"),this.body.className="pane-body",this.element.appendChild(this.body)}getComponent(){return{update:e=>{var t,i;null===(t=this.bodyPart)||void 0===t||t.update({params:e}),null===(i=this.headerPart)||void 0===i||i.update({params:e})},dispose:()=>{var e,t;null===(e=this.bodyPart)||void 0===e||e.dispose(),null===(t=this.headerPart)||void 0===t||t.dispose()}}}}class Fe extends Me{constructor(e,t,i,n,s,o){super(e,t,i,n,s,!0),this._onDidDrop=new a,this.onDidDrop=this._onDidDrop.event,o||this.initDragFeatures()}initDragFeatures(){if(!this.header)return;const t=this.id;this.header.draggable=!0,this.handler=new class extends Le{getData(){return w.getInstance().setData([new m("paneview",t)],m.prototype),{dispose:()=>{w.getInstance().clearData(m.prototype)}}}}(this.header),this.target=new $(this.element,{validOverlays:"vertical",canDisplayOverlay:e=>{const t=f();return!t||t.paneId!==this.id}}),this.addDisposables(this._onDidDrop,this.handler,this.target,this.target.onDrop((t=>{const i=f();if(!i)return void this._onDidDrop.fire(Object.assign(Object.assign({},t),{panel:this,getData:()=>f()}));const n=this.params.containerApi,s=i.paneId,o=n.getPanel(s);if(!o)return void this._onDidDrop.fire(Object.assign(Object.assign({},t),{panel:this,getData:()=>f()}));const a=n.getPanels(),r=a.indexOf(o);let h=n.getPanels().indexOf(this);t.position!==e.Position.Left&&t.position!==e.Position.Top||(h=Math.max(0,h-1)),t.position!==e.Position.Right&&t.position!==e.Position.Bottom||(r>h&&h++,h=Math.min(a.length-1,h)),n.movePanel(r,h)})))}}class We extends l{constructor(){super(),this.disposable=new p,this.apiRef={api:null},this._element=document.createElement("div"),this.element.className="default-header",this._content=document.createElement("span"),this._expander=document.createElement("a"),this.element.appendChild(this._content),this.element.appendChild(this._expander),this.addDisposables(h(this._expander,"click",(()=>{var e;null===(e=this.apiRef.api)||void 0===e||e.setExpanded(!this.apiRef.api.isExpanded)})))}get element(){return this._element}init(e){this.apiRef.api=e.api,this._content.textContent=e.title,this._expander.textContent=e.api.isExpanded?"<":">",this.disposable.value=e.api.onDidExpansionChange((e=>{this._expander.textContent=e.isExpanded?"<":">"}))}update(e){}dispose(){this.disposable.dispose(),super.dispose()}}class Be extends Fe{constructor(e){super(e.id,e.component,e.headerComponent,e.orientation,e.isExpanded,e.disableDnd),this.options=e}getBodyComponent(){return this.options.body}getHeaderComponent(){return this.options.header}}class Je extends l{constructor(t,i){super(),this.element=t,this._disposable=new p,this._onDidLayoutChange=new a,this.onDidLayoutChange=this._onDidLayoutChange.event,this._onDidDrop=new a,this.onDidDrop=this._onDidDrop.event,this._onDidAddView=new a,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new a,this.onDidRemoveView=this._onDidRemoveView.event,this._options=i,i.components||(i.components={}),i.frameworkComponents||(i.frameworkComponents={}),this.paneview=new U(this.element,{orientation:e.Orientation.VERTICAL}),this.addDisposables(this._disposable)}set paneview(e){this._paneview=e,this._disposable.value=new l(this._paneview.onDidChange((()=>{this._onDidLayoutChange.fire(void 0)})),this._paneview.onDidAddView((e=>this._onDidAddView.fire(e))),this._paneview.onDidRemoveView((e=>this._onDidRemoveView.fire(e))))}get paneview(){return this._paneview}get minimumSize(){return this.paneview.minimumSize}get maximumSize(){return this.paneview.maximumSize}get height(){return this.paneview.orientation===e.Orientation.HORIZONTAL?this.paneview.orthogonalSize:this.paneview.size}get width(){return this.paneview.orientation===e.Orientation.HORIZONTAL?this.paneview.size:this.paneview.orthogonalSize}get options(){return this._options}focus(){}updateOptions(e){this._options=Object.assign(Object.assign({},this.options),e)}addPanel(t){const i=xe(t.id,t.component,this.options.components||{},this.options.frameworkComponents||{},this.options.frameworkWrapper?{createComponent:this.options.frameworkWrapper.body.createComponent}:void 0);let n;n=t.headerComponent?xe(t.id,t.headerComponent,this.options.headerComponents||{},this.options.headerframeworkComponents,this.options.frameworkWrapper?{createComponent:this.options.frameworkWrapper.header.createComponent}:void 0):new We;const s=new Be({id:t.id,component:t.component,headerComponent:t.headerComponent,header:n,body:i,orientation:e.Orientation.VERTICAL,isExpanded:!!t.isExpanded,disableDnd:!!this.options.disableDnd}),o=new l(s.onDidDrop((e=>{this._onDidDrop.fire(e)}))),a="number"==typeof t.size?t.size:e.Sizing.Distribute,r="number"==typeof t.index?t.index:void 0;return s.init({params:t.params||{},minimumBodySize:t.minimumBodySize,maximumBodySize:t.maximumBodySize,isExpanded:t.isExpanded,title:t.title,containerApi:new C(this)}),this.paneview.addPane(s,a,r),s.orientation=this.paneview.orientation,o}getPanels(){return this.paneview.getPanes()}removePanel(e){const t=this.getPanels().findIndex((t=>t===e));this.paneview.removePane(t)}movePanel(e,t){this.paneview.moveView(e,t)}getPanel(e){return this.getPanels().find((t=>t.id===e))}layout(t,i){const[n,s]=this.paneview.orientation===e.Orientation.HORIZONTAL?[t,i]:[i,t];this.paneview.layout(n,s)}resizeToFit(){if(!this.element.parentElement)return;const{width:e,height:t}=this.element.parentElement.getBoundingClientRect();this.layout(e,t)}toJSON(){const e=e=>e===Number.MAX_SAFE_INTEGER||e===Number.POSITIVE_INFINITY?void 0:e;return{views:this.paneview.getPanes().map(((t,i)=>{return{size:this.paneview.getViewSize(i),data:t.toJSON(),minimumSize:(n=t.minimumBodySize,n<=0?void 0:n),maximumSize:e(t.maximumBodySize),expanded:t.isExpanded()};var n})),size:this.paneview.size}}fromJSON(t,i){const{views:n,size:s}=t,o=[];this.paneview.dispose(),this.paneview=new U(this.element,{orientation:e.Orientation.VERTICAL,descriptor:{size:s,views:n.map((t=>{const i=t.data,n=xe(i.id,i.component,this.options.components||{},this.options.frameworkComponents||{},this.options.frameworkWrapper?{createComponent:this.options.frameworkWrapper.body.createComponent}:void 0);let s;s=i.headerComponent?xe(i.id,i.headerComponent,this.options.headerComponents||{},this.options.headerframeworkComponents||{},this.options.frameworkWrapper?{createComponent:this.options.frameworkWrapper.header.createComponent}:void 0):new We;const a=new Be({id:i.id,component:i.component,headerComponent:i.headerComponent,header:s,body:n,orientation:e.Orientation.VERTICAL,isExpanded:!!t.expanded,disableDnd:!!this.options.disableDnd});return a.onDidDrop((e=>{this._onDidDrop.fire(e)})),o.push((()=>{a.init({params:i.params||{},minimumBodySize:t.minimumSize,maximumBodySize:t.maximumSize,title:i.title,isExpanded:!!t.expanded,containerApi:new C(this)}),a.orientation=this.paneview.orientation})),setTimeout((()=>{this._onDidAddView.fire(a)}),0),{size:t.size,view:a}}))}}),this.layout(this.width,this.height),i?setTimeout((()=>{o.forEach((e=>e()))}),0):o.forEach((e=>e()))}}class je extends Ae{constructor(e,t){super(e,t,new Re(e)),this._evaluatedMinimumSize=0,this._evaluatedMaximumSize=Number.POSITIVE_INFINITY,this._minimumSize=0,this._maximumSize=Number.POSITIVE_INFINITY,this._snap=!1,this._onDidChange=new a,this.onDidChange=this._onDidChange.event,this.addDisposables(this.api.onVisibilityChange((e=>{const{isVisible:t}=e,{containerApi:i}=this.params;i.setVisible(this,t)})),this.api.onActiveChange((()=>{const{containerApi:e}=this.params;e.setActive(this)})),this.api.onDidConstraintsChangeInternal((e=>{"number"!=typeof e.minimumSize&&"function"!=typeof e.minimumSize||(this._minimumSize=e.minimumSize),"number"!=typeof e.maximumSize&&"function"!=typeof e.maximumSize||(this._maximumSize=e.maximumSize),this.updateConstraints()})),this.api.onDidSizeChange((e=>{this._onDidChange.fire(e.size)})))}get priority(){return this._priority}set orientation(e){this._orientation=e}get orientation(){return this._orientation}get minimumSize(){const e="function"==typeof this._minimumSize?this._minimumSize():this._minimumSize;return e!==this._evaluatedMinimumSize&&(this._evaluatedMinimumSize=e,this.updateConstraints()),e}get maximumSize(){const e="function"==typeof this._maximumSize?this._maximumSize():this._maximumSize;return e!==this._evaluatedMaximumSize&&(this._evaluatedMaximumSize=e,this.updateConstraints()),e}get snap(){return this._snap}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}layout(t,i){const[n,s]=this.orientation===e.Orientation.HORIZONTAL?[t,i]:[i,t];super.layout(n,s)}init(e){super.init(e),this._priority=e.priority,e.minimumSize&&(this._minimumSize=e.minimumSize),e.maximumSize&&(this._maximumSize=e.maximumSize),e.snap&&(this._snap=e.snap)}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{minimumSize:(e=this.minimumSize,e<=0?void 0:e),maximumSize:(e=>e===Number.MAX_SAFE_INTEGER||e===Number.POSITIVE_INFINITY?void 0:e)(this.maximumSize)});var e}updateConstraints(){this.api._onDidConstraintsChange.fire({maximumSize:this._evaluatedMaximumSize,minimumSize:this._evaluatedMinimumSize})}}const Ue=(e,t)=>{const[i,n]=s.useState(),o=s.useRef(e.componentProps);return s.useImperativeHandle(t,(()=>({update:e=>{o.current=Object.assign(Object.assign({},o.current),e),n(Date.now())}})),[]),s.createElement(e.component,o.current)};Ue.displayName="DockviewReactJsBridge";const Ke=T(),$e=s.createContext({});class Ze{constructor(e,t,i,n,s){this.parent=e,this.portalStore=t,this.component=i,this.parameters=n,this.context=s,this.disposed=!1,this.createPortal()}update(e){var t;if(this.disposed)throw new Error("invalid operation: resource is already disposed");null===(t=this.componentInstance)||void 0===t||t.update(e)}createPortal(){if(this.disposed)throw new Error("invalid operation: resource is already disposed");if("function"!=typeof this.component)throw new Error("invalid operation: only functional components are supported");const e=s.createElement(s.forwardRef(Ue),{component:this.component,componentProps:this.parameters,ref:e=>{this.componentInstance=e}}),t=this.context?s.createElement($e.Provider,{value:this.context},e):e,i=o.createPortal(t,this.parent,Ke.next());this.ref={portal:i,disposable:this.portalStore.addPortal(i)}}dispose(){var e;null===(e=this.ref)||void 0===e||e.disposable.dispose(),this.disposed=!0}}const Ye=()=>{const[e,t]=s.useState([]);s.useDebugValue(`Portal count: ${e.length}`);return[e,s.useCallback((e=>{t((t=>[...t,e]));let i=!1;return{dispose:()=>{if(i)throw new Error("invalid operation: resource already disposed");i=!0,t((t=>t.filter((t=>t!==e))))}}}),[])]};function Xe(e){return null==e?void 0:e.type}class qe{constructor(e,t,i){this.id=e,this.component=t,this.reactPortalStore=i,this._onDidFocus=new a,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new a,this.onDidBlur=this._onDidBlur.event,this._element=document.createElement("div"),this._element.style.height="100%",this._element.style.width="100%",this._actionsElement=document.createElement("div"),this._actionsElement.style.height="100%",this._actionsElement.style.width="100%"}get element(){return this._element}get actions(){return this._actionsElement}focus(){}init(e){const t={api:e.api,containerApi:e.containerApi,actionsPortalElement:this._actionsElement,tabPortalElement:e.tab};this.part=new Ze(this.element,this.reactPortalStore,this.component,{params:e.params,api:e.api,containerApi:e.containerApi},t)}toJSON(){return{id:this.id}}update(e){var t;null===(t=this.part)||void 0===t||t.update(e.params)}updateParentGroup(e,t){this._group=e}layout(e,t){}close(){return Promise.resolve(!0)}dispose(){var e,t;null===(e=this.part)||void 0===e||e.dispose(),null===(t=this.actionsPart)||void 0===t||t.dispose()}}class Qe{constructor(e,t,i){this.id=e,this.component=t,this.reactPortalStore=i,this._element=document.createElement("div")}get element(){return this._element}focus(){}init(e){this.part=new Ze(this.element,this.reactPortalStore,this.component,{params:e.params,api:e.api,containerApi:e.containerApi})}update(e){var t;null===(t=this.part)||void 0===t||t.update(e.params)}toJSON(){return{id:this.id}}layout(e,t){}updateParentGroup(e,t){}dispose(){var e;null===(e=this.part)||void 0===e||e.dispose()}}class et{constructor(e){this.layout=e}fromJSON(e){var t,i,n;const s=e.id,o=e.params,a=e.title,r=e.state,h=e.suppressClosable,d=e.view,l=new Ve({content:xe(d.content.id,d.content.id,this.layout.options.components,this.layout.options.frameworkComponents,null===(t=this.layout.options.frameworkComponentFactory)||void 0===t?void 0:t.content),tab:(null===(i=d.tab)||void 0===i?void 0:i.id)?xe(d.tab.id,d.tab.id,this.layout.options.tabComponents,this.layout.options.frameworkTabComponents,null===(n=this.layout.options.frameworkComponentFactory)||void 0===n?void 0:n.tab):new Pe}),p=new ye(s,new D(this.layout));return p.init({view:l,title:a,suppressClosable:h,params:o||{},state:r||{}}),p}}class tt{constructor(e,t,i){this.id=e,this.component=t,this.reactPortalStore=i,this._groupRef={value:void 0},this._element=document.createElement("div"),this._element.style.height="100%",this._element.style.width="100%"}get element(){return this._element}init(e){this.parameters=e,this.part=new Ze(this.element,this.reactPortalStore,this.component,{params:e.params,api:e.api,containerApi:e.containerApi,close:()=>{this._groupRef.value&&e.containerApi.removeGroup(this._groupRef.value)}})}focus(){}update(e){var t,i;this.parameters&&(this.parameters.params=e.params),null===(t=this.part)||void 0===t||t.update({params:(null===(i=this.parameters)||void 0===i?void 0:i.params)||{}})}toJSON(){return{id:this.id}}layout(e,t){}updateParentGroup(e,t){this._groupRef.value=e}dispose(){var e;null===(e=this.part)||void 0===e||e.dispose()}}const it=s.forwardRef(((e,t)=>{const i=s.useRef(null),n=s.useRef(),[o,a]=Ye();return s.useImperativeHandle(t,(()=>i.current),[]),s.useEffect((()=>{if(e.disableAutoResizing)return()=>{};const t=z(i.current,(e=>{var t;const{width:i,height:s}=e.contentRect;null===(t=n.current)||void 0===t||t.layout(i,s)}));return()=>{t.dispose()}}),[e.disableAutoResizing]),s.useEffect((()=>{var t;const s={content:{createComponent:(e,t,i)=>new qe(t,i,{addPortal:a})},tab:{createComponent:(e,t,i)=>new Qe(t,i,{addPortal:a})},watermark:{createComponent:(e,t,i)=>new tt(t,i,{addPortal:a})}},o=document.createElement("div"),r=new ke(o,{frameworkComponentFactory:s,frameworkComponents:e.components,frameworkTabComponents:e.tabComponents,tabHeight:e.tabHeight,debug:e.debug,enableExternalDragEvents:e.enableExternalDragEvents,watermarkFrameworkComponent:e.watermarkComponent,styles:e.hideBorders?{separatorBorder:"transparent"}:void 0});null===(t=i.current)||void 0===t||t.appendChild(r.element),r.deserializer=new et(r);const{clientWidth:h,clientHeight:d}=i.current;return r.layout(h,d),e.onReady&&e.onReady({api:new D(r)}),n.current=r,()=>{r.dispose()}}),[]),s.useEffect((()=>{n.current&&n.current.updateOptions({frameworkComponents:e.components})}),[e.components]),s.useEffect((()=>{n.current&&n.current.updateOptions({frameworkTabComponents:e.tabComponents})}),[e.tabComponents]),s.useEffect((()=>{if(!e.onTabContextMenu||!n.current)return()=>{};const t=n.current.onTabContextMenu((t=>{e.onTabContextMenu&&e.onTabContextMenu(t)}));return()=>{t.dispose()}}),[e.onTabContextMenu]),s.createElement("div",{className:e.className,style:{height:"100%",width:"100%"},ref:i},o)}));it.displayName="DockviewComponent";const nt=e=>s.createElement(s.Fragment,null,e.children),st=e=>s.createElement(s.Fragment,null,e.children),ot=e=>s.createElement(s.Fragment,null,e.children);const at={Tab:nt,Content:st,Actions:ot,Panel:e=>{const t=s.useContext($e),i=s.useMemo((()=>{var t;const i=(null===(t=s.Children.map(e.children,(e=>e)))||void 0===t?void 0:t.filter(Xe))||[];if(!!i.find((e=>{return t=e,![st,ot,nt].find((e=>t.type===e));var t})))throw new Error("Children of DockviewComponents.Panel must be one of the following: DockviewComponents.Content, DockviewComponents.Actions, DockviewComponents.Tab");return{body:i.find((e=>e.type===st)),actions:i.find((e=>e.type===ot)),tab:i.find((e=>e.type===nt))}}),[e.children]);return s.useEffect((()=>{i.tab?t.tabPortalElement.hide():t.tabPortalElement.show()}),[i.tab]),s.createElement(s.Fragment,null,i.actions&&o.createPortal(i.actions,t.actionsPortalElement),i.tab&&o.createPortal(i.tab,t.tabPortalElement.element),i.body||e.children)}};class rt extends je{constructor(e,t,i,n){super(e,t),this.reactComponent=i,this.reactPortalStore=n}getComponent(){var e;return new Ze(this.element,this.reactPortalStore,this.reactComponent,{params:(null===(e=this.params)||void 0===e?void 0:e.params)||{},api:this.api,containerApi:this.params.containerApi})}}const ht=s.forwardRef(((e,t)=>{const i=s.useRef(null),n=s.useRef(),[o,a]=Ye();return s.useImperativeHandle(t,(()=>i.current),[]),s.useEffect((()=>{if(e.disableAutoResizing)return()=>{};const t=z(i.current,(e=>{var t;const{width:i,height:s}=e.contentRect;null===(t=n.current)||void 0===t||t.layout(i,s)}));return()=>{t.dispose()}}),[e.disableAutoResizing]),s.useEffect((()=>{const t=new Ge(i.current,{orientation:e.orientation,frameworkComponents:e.components,frameworkWrapper:{createComponent:(e,t,i)=>new rt(e,t,i,{addPortal:a})},proportionalLayout:e.proportionalLayout,styles:e.hideBorders?{separatorBorder:"transparent"}:void 0}),{clientWidth:s,clientHeight:o}=i.current;return t.layout(s,o),e.onReady&&e.onReady({api:new _(t)}),n.current=t,()=>{t.dispose()}}),[]),s.useEffect((()=>{n.current&&n.current.updateOptions({frameworkComponents:e.components})}),[e.components]),s.createElement("div",{className:e.className,style:{height:"100%",width:"100%"},ref:i},o)}));ht.displayName="SplitviewComponent";class dt extends Oe{constructor(e,t,i,n){super(e,t),this.reactComponent=i,this.reactPortalStore=n}getComponent(){var e;return new Ze(this.element,this.reactPortalStore,this.reactComponent,{params:(null===(e=this.params)||void 0===e?void 0:e.params)||{},api:this.api,containerApi:this.params.containerApi})}}const lt=s.forwardRef(((e,t)=>{const i=s.useRef(null),n=s.useRef(),[o,a]=Ye();return s.useImperativeHandle(t,(()=>i.current),[]),s.useEffect((()=>{if(e.disableAutoResizing)return()=>{};const t=z(i.current,(e=>{var t;const{width:i,height:s}=e.contentRect;null===(t=n.current)||void 0===t||t.layout(i,s)}));return()=>{t.dispose()}}),[e.disableAutoResizing]),s.useEffect((()=>{var t;const s=document.createElement("div"),o=new Ie(s,{proportionalLayout:!!e.proportionalLayout,orientation:e.orientation,frameworkComponents:e.components,frameworkComponentFactory:{createComponent:(e,t,i)=>new dt(e,t,i,{addPortal:a})},styles:e.hideBorders?{separatorBorder:"transparent"}:void 0});null===(t=i.current)||void 0===t||t.appendChild(o.element);const{clientWidth:r,clientHeight:h}=i.current;return o.layout(r,h),e.onReady&&e.onReady({api:new y(o)}),n.current=o,()=>{o.dispose()}}),[]),s.useEffect((()=>{n.current&&n.current.updateOptions({frameworkComponents:e.components})}),[e.components]),s.createElement("div",{className:e.className,style:{height:"100%",width:"100%"},ref:i},o)}));lt.displayName="GridviewComponent";class pt{constructor(e,t,i){this.id=e,this.component=t,this.reactPortalStore=i,this._element=document.createElement("div"),this._element.style.height="100%",this._element.style.width="100%"}get element(){return this._element}init(e){this.part=new Ze(this.element,this.reactPortalStore,this.component,{params:e.params,api:e.api,title:e.title,containerApi:e.containerApi})}toJSON(){return{id:this.id}}update(e){var t;null===(t=this.part)||void 0===t||t.update(e.params)}dispose(){var e;null===(e=this.part)||void 0===e||e.dispose()}}const ct=s.forwardRef(((e,t)=>{const i=s.useRef(null),n=s.useRef(),[o,a]=Ye();return s.useImperativeHandle(t,(()=>i.current),[]),s.useEffect((()=>{if(e.disableAutoResizing)return()=>{};const t=z(i.current,(e=>{var t;const{width:i,height:s}=e.contentRect;null===(t=n.current)||void 0===t||t.layout(i,s)}));return()=>{t.dispose()}}),[e.disableAutoResizing]),s.useEffect((()=>{const t=(e,t,i)=>new pt(e,i,{addPortal:a}),s=new Je(i.current,{frameworkComponents:e.components,components:{},headerComponents:{},disableDnd:e.disableDnd,headerframeworkComponents:e.headerComponents,frameworkWrapper:{header:{createComponent:t},body:{createComponent:t}}}),o=new C(s),{clientWidth:r,clientHeight:h}=i.current;return s.layout(r,h),e.onReady&&e.onReady({api:o}),n.current=s,()=>{s.dispose()}}),[]),s.useEffect((()=>{n.current&&n.current.updateOptions({frameworkComponents:e.components})}),[e.components]),s.useEffect((()=>{n.current&&n.current.updateOptions({headerframeworkComponents:e.headerComponents})}),[e.headerComponents]),s.useEffect((()=>{if(!n.current)return()=>{};const t=n.current,i=t.onDidDrop((i=>{e.onDidDrop&&e.onDidDrop(Object.assign(Object.assign({},i),{api:new C(t)}))}));return()=>{i.dispose()}}),[e.onDidDrop]),s.createElement("div",{className:e.className,style:{height:"100%",width:"100%"},ref:i},o)}));ct.displayName="PaneviewComponent",e.BaseGrid=be,e.CompositeDisposable=l,e.ContentContainer=he,e.DATA_KEY=v,e.DockviewApi=D,e.DockviewComponent=ke,e.DockviewComponents=at,e.DockviewReact=it,e.Emitter=a,e.Gridview=ae,e.GridviewApi=y,e.GridviewComponent=Ie,e.GridviewPanel=Oe,e.GridviewReact=lt,e.Groupview=ve,e.LocalSelectionTransfer=w,e.MutableDisposable=p,e.PaneFramework=Be,e.PaneTransfer=m,e.PanelTransfer=u,e.Paneview=U,e.PaneviewApi=C,e.PaneviewComponent=Je,e.PaneviewPanel=Me,e.PaneviewReact=ct,e.ReactPanelContentPart=qe,e.ReactPanelHeaderPart=Qe,e.ReactPart=Ze,e.ReactPartContext=$e,e.Splitview=j,e.SplitviewApi=_,e.SplitviewComponent=Ge,e.SplitviewPanel=je,e.SplitviewReact=ht,e.Tab=ue,e.TickDelayedEvent=d,e.addDisposableListener=h,e.addDisposableWindowListener=r,e.extractData=e=>{if(!e.dataTransfer)return null;const t=function(e,t){try{return JSON.parse(e,t)}catch(e){return void console.warn("failed to parse JSON")}}(e.dataTransfer.getData(v));return t||console.warn(`[dragEvent] ${v} data is missing`),"string"!=typeof t.type&&console.warn(`[dragEvent] invalid type ${t.type}`),t},e.getDirectionOrientation=te,e.getGridLocation=Q,e.getLocationOrientation=ie,e.getPaneData=f,e.getPanelData=b,e.getRelativeLocation=ee,e.indexInParent=q,e.isCustomDragEvent=t=>t.type===e.DragType.EXTERNAL,e.isGridBranchNode=se,e.isPanelTransferEvent=e=>!!e.dataTransfer&&e.dataTransfer.types.includes(v),e.isReactElement=Xe,e.isTabDragEvent=t=>t.type===e.DragType.DOCKVIEW_TAB,e.orthogonal=ne,e.toTarget=we,e.usePortalsLifecycle=Ye,Object.defineProperty(e,"__esModule",{value:!0})}));
|