docking-egid
Version:
This library is built to provide a solution for Angular enables the creation of complex layouts consisting of panels that can be floated, docked, nested, resized, pinned, unpinned and closed. Additional components can be integrated to create an IDE-like l
1 lines • 155 kB
JavaScript
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const index=require("./index-f11f2141.js"),locale=require("./locale-758076f2.js"),buttonComponentCss="button{position:static;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:auto;height:100%;min-width:10px;padding:2px 4px;border-radius:2px;color:var(--igc-button-text, rgba(0, 0, 0, 0.72));cursor:pointer;outline-style:none;font-size:14px;font-family:inherit;background:transparent;border:none;-webkit-tap-highlight-color:transparent;opacity:0.7;-webkit-transition:background 0.25s ease-out, opacity 0.25s ease-out, -webkit-box-shadow 0.25s ease-out;transition:background 0.25s ease-out, opacity 0.25s ease-out, -webkit-box-shadow 0.25s ease-out;transition:background 0.25s ease-out, opacity 0.25s ease-out, box-shadow 0.25s ease-out;transition:background 0.25s ease-out, opacity 0.25s ease-out, box-shadow 0.25s ease-out, -webkit-box-shadow 0.25s ease-out}:host([disabled]){pointer-events:none}:host{display:-ms-flexbox;display:flex}button{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}button:hover{opacity:1}button:focus{background:var(--igc-accent-color, #fff);-webkit-box-shadow:inset 0 0 0 1px var(--igc-active-color, cornflowerblue);box-shadow:inset 0 0 0 1px var(--igc-active-color, cornflowerblue);opacity:1}button[disabled]{opacity:0.54}";let IgcButtonComponent=class{constructor(e){index.registerInstance(this,e)}render(){return index.h(index.Host,{disabled:this.disabled},index.h("button",{name:this.name,type:this.type,value:this.value,"aria-disabled":this.disabled?"true":null},index.h("slot",null)))}};IgcButtonComponent.style=buttonComponentCss;class Utils{static isDockingIndicatorVertical(e){return e===locale.IgcDockingIndicatorPosition.top||e===locale.IgcDockingIndicatorPosition.bottom||e===locale.IgcDockingIndicatorPosition.outerTop||e===locale.IgcDockingIndicatorPosition.outerBottom}static isDockingIndicatorBefore(e){return e===locale.IgcDockingIndicatorPosition.top||e===locale.IgcDockingIndicatorPosition.left||e===locale.IgcDockingIndicatorPosition.outerTop||e===locale.IgcDockingIndicatorPosition.outerLeft}static isDockingIndicatorBeforeRTL(e){return e===locale.IgcDockingIndicatorPosition.top||e===locale.IgcDockingIndicatorPosition.right||e===locale.IgcDockingIndicatorPosition.outerTop||e===locale.IgcDockingIndicatorPosition.outerRight}static isDockingIndicatorOuter(e){return e===locale.IgcDockingIndicatorPosition.outerLeft||e===locale.IgcDockingIndicatorPosition.outerRight||e===locale.IgcDockingIndicatorPosition.outerTop||e===locale.IgcDockingIndicatorPosition.outerBottom}static isSplitPaneVertical(e){return e.orientation===locale.IgcSplitPaneOrientation.vertical}static isAltPressed(e){return e.altKey||e.getModifierState("Alt")||e.getModifierState("AltGraph")}static isControlOrMetaPressed(e){return e.ctrlKey||e.metaKey||e.getModifierState("Meta")||e.getModifierState("OS")}static partNameMap(e,t=" "){return Object.keys(e).filter((t=>e[t])).join(t)}static getDirection(e){let t="";if(""!==e.dir)t=e.dir;else{let n=e.parentElement;for(;n;){if(""!==n.dir){t=n.dir;break}n=n.parentElement}}return t}}const IGC_DEFAULT_PANE_SIZE=100,IGC_DEFAULT_UNPIN_PANE_SIZE=200,IGC_RESIZING_MIN_SIZE=42,IGC_DEFAULT_RESIZE=10,IGC_DRAG_FLYOUT_THRESHOLD=50;var IgcTabHeadersPosition,IgcContextMenuOrientation,IgcPinBehavior;!function(e){e.top="top",e.bottom="bottom"}(IgcTabHeadersPosition||(IgcTabHeadersPosition={})),function(e){e.top="top",e.bottom="bottom"}(IgcContextMenuOrientation||(IgcContextMenuOrientation={})),function(e){e.allPanes="allPanes",e.selectedPane="selectedPane"}(IgcPinBehavior||(IgcPinBehavior={}));const contentPaneComponentCss=":host{--min-pane-size:0px;position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;overflow:hidden;width:100%;height:100%;min-width:var(--min-pane-size);min-height:var(--min-pane-size);-webkit-box-sizing:border-box;box-sizing:border-box;pointer-events:all}:host(:focus){outline-style:none}:host([part~=disabled]:not([part~=single-floating])),:host([part~=disabled])>slot:not([name]){pointer-events:none}";let IgcContentPaneComponent=class{constructor(e){index.registerInstance(this,e),this.rendered=index.createEvent(this,"rendered",7),this.disabled=!1,this.isSingleFloating=!1}componentDidRender(){this.rendered.emit()}render(){const e=this.size||0===this.size?this.size:100,t=this.unpinnedSize?this.unpinnedSize:200,n=Utils.partNameMap({"content-pane":!0,disabled:this.disabled,"single-floating":this.isSingleFloating});return index.h(index.Host,{role:"group","aria-label":this.header,"aria-disabled":this.disabled?"true":"false",tabindex:this.disabled?-1:0,style:{flex:this.isFlyout?`0 1 ${t}px`:`${e} 1 ${e}px`},part:n},index.h("slot",{name:"header"}),index.h("slot",null))}};IgcContentPaneComponent.style=contentPaneComponentCss;const contextMenuComponentCss=":host{position:absolute;display:block;-webkit-box-sizing:border-box;box-sizing:border-box;top:0;left:0;bottom:0;right:0;z-index:10002;pointer-events:none}:host igc-icon-component svg{width:17px;height:17px}:host igc-icon-component{margin-left:8px}[part=menu-content]{position:absolute;visibility:hidden;color:var(--igc-context-menu-color, var(--igc-text-color, rgba(0, 0, 0, 0.72)));background:var(--igc-context-menu-background, var(--igc-accent-color, #fff));border:1px solid var(--igc-context-menu-background, var(--igc-accent-color, #fff));pointer-events:all;-webkit-box-shadow:0 5px 22px rgba(0, 0, 0, 0.08), 0 12px 17px 2px rgba(0, 0, 0, 0.12), 0 7px 8px -4px rgba(0, 0, 0, 0.26);box-shadow:0 5px 22px rgba(0, 0, 0, 0.08), 0 12px 17px 2px rgba(0, 0, 0, 0.12), 0 7px 8px -4px rgba(0, 0, 0, 0.26);-webkit-box-sizing:border-box;box-sizing:border-box}[part~=menu-item]{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;padding:6px 8px;font-size:0.75em;line-height:1.7;cursor:pointer;-webkit-transition:background 0.25s ease-out, color 0.25s ease-out;transition:background 0.25s ease-out, color 0.25s ease-out;outline-style:none}[part~=menu-item]:hover{background:var(--igc-context-menu-background-active, var(--igc-border-color, #F3F5F7));color:var(--igc-context-menu-color-active, #000)}[part~=menu-item]:focus{background:var(--igc-context-menu-background-active, var(--igc-border-color, #F3F5F7));color:var(--igc-context-menu-color-active, #000)}[part~=disabled]{pointer-events:none;color:var(--igc-disabled-color, rgba(0, 0, 0, 0.38))}";let IgcContextMenuComponent=class{constructor(e){index.registerInstance(this,e),this.menuClosed=index.createEvent(this,"menuClosed",7),this.activeIndex=0,this.handleDocumentResize=()=>{this.menuClosed.emit()},this.handleDocumentMouseDown=e=>{e.composedPath().every((e=>e!==this.elem))&&this.menuClosed.emit()}}emitMenuClosed(){this.menuClosed.emit()}connectedCallback(){document.defaultView.addEventListener("resize",this.handleDocumentResize,!1),document.defaultView.addEventListener("mousedown",this.handleDocumentMouseDown,!1)}disconnectedCallback(){document.defaultView.removeEventListener("resize",this.handleDocumentResize,!1),document.defaultView.removeEventListener("mousedown",this.handleDocumentMouseDown,!1)}componentDidLoad(){const e=null!==this.target.querySelector('slot[name="tabsMoreButton"]'),t=this.menuItemsDiv.getBoundingClientRect(),n=this.elem.getBoundingClientRect(),i=this.target.getRootNode(),o=i.host.getBoundingClientRect(),a="igc-tab-header-component"===i.host.tagName.toLowerCase(),s=a?i.host.parentElement.shadowRoot:i,r=s.host.getBoundingClientRect(),c=s.querySelector('div[part~="tabs-content"]').getBoundingClientRect(),l=o.right-t.right<=0,d=r.bottom+t.bottom>=window.innerHeight||r.height+t.bottom>=window.innerHeight||e&&c.height-t.height>0?c.top+(c.height-t.bottom):o.top-t.top+o.height,h=c.top-t.top,g=l?o.right-t.width:o.left,p=l?o.left:o.right-t.width,u=o.left+(o.width-t.width)/2;let m=l?p:g,P=this.orientation===IgcContextMenuOrientation.bottom?a?d:h:d;const b=P+t.height;switch(P=P>=0?P:d,this.position){case"start":m=g;break;case"center":m=o.width>t.width&&u;break;case"stretch":this.menuItemsDiv.style.width=o.width>t.width&&`${o.width}px`;break;default:m=p}this.orientation===IgcContextMenuOrientation.bottom&&b>n.height&&(P=h),m-=t.left,this.menuItemsDiv.style.left=`${m}px`,this.menuItemsDiv.style.top=`${P}px`,this.menuItemsDiv.style.visibility="visible",this.focusItemAndSetActiveIndex()}focusItemAndSetActiveIndex(){var e;null===(e=this.menuItemsDiv.querySelector('div[part="menu-item"]'))||void 0===e||e.focus()}handleKeyboardEvents(e,t){const n=this.menuItemsDiv.querySelectorAll('div[part="menu-item"]');"ArrowDown"===t.key?this.activeIndex<n.length-1&&(this.activeIndex++,n[this.activeIndex].focus()):"ArrowUp"===t.key?this.activeIndex>0&&(this.activeIndex--,n[this.activeIndex].focus()):"Enter"===t.key||" "===t.key?(e.clickHandler(),this.emitMenuClosed()):"Escape"===t.key&&this.emitMenuClosed()}handleMenuItemClick(e){e.clickHandler(),this.emitMenuClosed()}renderItemIcon(e){return index.h(index.Fragment,null,"close"===e.iconName&&this.renderCloseButton(),"unpin"===e.iconName&&this.renderUnpinButton(),null!==e.iconName&&"close"!==e.iconName&&"unpin"!==e.iconName&&index.h("igc-icon-component",{name:e.iconName}))}renderCloseButton(){return index.h("slot",{name:"contextMenuCloseButton"},index.h("igc-icon-component",{part:"context-menu-close-button",name:"close"}))}renderUnpinButton(){return index.h("slot",{name:"contextMenuUnpinButton"},index.h("igc-icon-component",{part:"context-menu-unpin-button",name:"unpin"}))}render(){return index.h(index.Host,{part:"context-menu",exportparts:"context-menu,\r\n menu-item: context-menu-item,\r\n menu-content: context-menu-content,\r\n context-menu-close-button,\r\n context-menu-unpin-button"},index.h("div",{role:"menu",part:"menu-content",ref:e=>this.menuItemsDiv=e,onMouseDown:e=>{e.preventDefault()}},this.items.map((e=>{const t=Utils.partNameMap({"menu-item":!0,disabled:e.disabled});return index.h("div",{role:"menuitem",part:t,tabindex:"-1",onKeyDown:this.handleKeyboardEvents.bind(this,e),onClick:this.handleMenuItemClick.bind(this,e)},index.h("span",{style:{flexGrow:"1",userSelect:"none"}},e.displayText),this.renderItemIcon(e))}))))}get elem(){return index.getElement(this)}};function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),e}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t)}function _createSuper(e){var t=_isNativeReflectConstruct();return function(){var n,i=_getPrototypeOf(e);if(t){var o=_getPrototypeOf(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return _possibleConstructorReturn(this,n)}}function _possibleConstructorReturn(e,t){return!t||"object"!==_typeof(t)&&"function"!=typeof t?_assertThisInitialized(e):t}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _wrapNativeSuper(e){var t="function"==typeof Map?new Map:void 0;return _wrapNativeSuper=function(e){if(null===e||!_isNativeFunction(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return _construct(e,arguments,_getPrototypeOf(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(n,e)},_wrapNativeSuper(e)}function _construct(e,t,n){return _construct=_isNativeReflectConstruct()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return n&&_setPrototypeOf(o,n.prototype),o},_construct.apply(null,arguments)}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function _isNativeFunction(e){return-1!==Function.toString.call(e).indexOf("[native code]")}function _setPrototypeOf(e,t){return _setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},_setPrototypeOf(e,t)}function _getPrototypeOf(e){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},_getPrototypeOf(e)}IgcContextMenuComponent.style=contextMenuComponentCss;class TwoWayMap{constructor(){this.map=new Map,this.reversedMap=new Map}set(e,t){this.map.set(e,t),this.reversedMap.set(t,e)}get(e){return this.map.get(e)}getByValue(e){return this.reversedMap.get(e)}delete(e){const t=this.map.get(e);this.map.delete(e),this.reversedMap.delete(t)}has(e){return this.map.has(e)}hasValue(e){return this.reversedMap.has(e)}}class IgcDockManagerService{constructor(e){this.dockManager=e,this.unpinnedLocationMap=new Map}getContent(e){return this.clientContentPanesMap.get(e)}generateUuid(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}populatePaneParents(e,t,n){if(e){e.id||(e.id=this.generateUuid());for(const i of e.panes)if(this.paneParentMap.set(i,e),i.id||(i.id=this.generateUuid()),i.type!==locale.IgcDockManagerPaneType.contentPane||i.hidden)if(i.type===locale.IgcDockManagerPaneType.splitPane)this.populatePaneParents(i,t,n);else if(i.type===locale.IgcDockManagerPaneType.tabGroupPane)for(const e of i.panes)e.id||(e.id=this.generateUuid()),this.paneParentMap.set(e,i),e.hidden||(this.clientContentPanesMap.set(e.contentId,e),n?this.visibleDocuments.push(e):this.visibleContentPanes.push(e));else i.type===locale.IgcDockManagerPaneType.documentHost&&(t&&this.documentHosts.push(i),this.paneParentMap.set(i.rootPane,i),this.populatePaneParents(i.rootPane,t,!0));else this.clientContentPanesMap.set(i.contentId,i),n?this.visibleDocuments.push(i):this.visibleContentPanes.push(i)}}populatePinLocations(e){if(e)for(const t of e.panes)if(t.type===locale.IgcDockManagerPaneType.splitPane)this.populatePinLocations(t);else if(t.type===locale.IgcDockManagerPaneType.tabGroupPane)for(const e of t.panes)this.addContentPanePinLocation(e),this.paneParentMap.set(e,t);else t.type===locale.IgcDockManagerPaneType.contentPane&&this.addContentPanePinLocation(t)}resolvePaneUnpinLocation(e){let t;if(e.unpinnedLocation)t=e.unpinnedLocation;else{const n=this.findClosestDocumentHost(e);t=n?this.findPaneUnpinLocation(e,n):locale.IgcUnpinnedLocation.left}return t}addContentPanePinLocation(e){if(!1===e.isPinned){const t=this.resolvePaneUnpinLocation(e);this.unpinnedLocationMap.set(e,t)}}findClosestDocumentHost(e){const t=this.getPanePath(e);let n,i=-1;for(const e of this.documentHosts){const o=this.getPanePath(e);let a;for(a=0;a<t.length;a++){if(t[a]!==o[a])break}a>i&&(i=a,n=e)}return n}findPaneUnpinLocation(e,t){const n=this.getPanePath(e),i=this.getPanePath(t);let o=-1;for(let e=0;e<n.length;e++){if(n[e]!==i[e])break;o=e}if(o>=0){const e=n[o],t=e.panes.indexOf(n[o+1]),a=e.panes.indexOf(i[o+1]);return e.orientation===locale.IgcSplitPaneOrientation.horizontal?t<a?locale.IgcUnpinnedLocation.left:locale.IgcUnpinnedLocation.right:t<a?locale.IgcUnpinnedLocation.top:locale.IgcUnpinnedLocation.bottom}return locale.IgcUnpinnedLocation.left}removePane(e){e===this.dockManager.maximizedPane&&(this.dockManager.maximizedPane=null);const t=this.paneParentMap.get(e);if(t)if(t.type===locale.IgcDockManagerPaneType.splitPane||t.type===locale.IgcDockManagerPaneType.tabGroupPane){const n=t.panes.indexOf(e);if(t.panes.splice(n,1),0===t.panes.length)if(t.allowEmpty){const t=this.getRootParent(e);this.isFloatingPane(t)&&this.removeFloatingPaneIfEmpty(t)}else this.removePane(t);else if(t.type===locale.IgcDockManagerPaneType.splitPane){const e=this.getRootParent(t);this.isFloatingPane(e)&&this.removeFloatingPaneIfEmpty(t)}}else t.type===locale.IgcDockManagerPaneType.documentHost&&(t.rootPane=null,this.removePane(t));else if(this.dockManager.layout.floatingPanes){const t=this.dockManager.layout.floatingPanes.indexOf(e);t>-1&&this.dockManager.layout.floatingPanes.splice(t,1)}}removeFloatingPaneIfEmpty(e){0===this.getChildContentPanes(e).length&&this.removePane(e)}isFloatingPane(e){return!!this.dockManager.layout.floatingPanes&&this.dockManager.layout.floatingPanes.indexOf(e)>-1}addFloatingPane(e,t,n,i){const o={type:locale.IgcDockManagerPaneType.splitPane,orientation:locale.IgcSplitPaneOrientation.vertical,panes:[e]};o.floatingLocation=t,o.floatingWidth=n,o.floatingHeight=i,this.dockManager.layout.floatingPanes||(this.dockManager.layout.floatingPanes=[]),this.dockManager.layout.floatingPanes.push(o),this.dockManager.draggedPane=o,this.initialFloatingPaneLocation=o.floatingLocation,this.forceDragPane=o}getChildContentPanes(e){const t=[];return this.getChildContentPanesRecursive(e,t),t}getChildContentPanesRecursive(e,t){for(const n of e.panes)n.type===locale.IgcDockManagerPaneType.contentPane?t.push(n):n.type===locale.IgcDockManagerPaneType.tabGroupPane||n.type===locale.IgcDockManagerPaneType.splitPane?this.getChildContentPanesRecursive(n,t):n.type===locale.IgcDockManagerPaneType.documentHost&&this.getChildContentPanesRecursive(n.rootPane,t)}getChildDocHostRecursive(e){for(const t of e.panes){if(t.type===locale.IgcDockManagerPaneType.documentHost)return t;if(t.type===locale.IgcDockManagerPaneType.splitPane){const e=this.getChildDocHostRecursive(t);if(e)return e}}return null}getVisibleContentPanes(e){return e.panes.filter((e=>this.isContentPaneVisible(e)))}getPaneToDock(e){return e.type===locale.IgcDockManagerPaneType.contentPane?e:(e.type===locale.IgcDockManagerPaneType.tabGroupPane||e.type===locale.IgcDockManagerPaneType.splitPane)&&1===e.panes.length?e.panes[0]:e}removeDocumentHost(e){const t=this.getChildDocHostRecursive(e);if(t){const e=this.getParent(t),n=e.panes.indexOf(t);e.panes[n]=1===t.rootPane.panes.length?t.rootPane.panes[0]:t.rootPane}}dockToCenter(e,t){let n;if(e.type===locale.IgcDockManagerPaneType.tabGroupPane)n=e;else if(e.type===locale.IgcDockManagerPaneType.contentPane){n={type:locale.IgcDockManagerPaneType.tabGroupPane,size:e.size,panes:[e]};const t=this.paneParentMap.get(e),i=t.panes.indexOf(e);t.panes[i]=n}else e.type===locale.IgcDockManagerPaneType.splitPane?n=e:e.type===locale.IgcDockManagerPaneType.documentHost&&(n=e.rootPane);if(n.type===locale.IgcDockManagerPaneType.tabGroupPane){const e=t.type===locale.IgcDockManagerPaneType.contentPane?[t]:this.getChildContentPanes(t);n.panes.push(...e)}else if(n.type===locale.IgcDockManagerPaneType.splitPane){let e=t;if((null==t?void 0:t.type)===locale.IgcDockManagerPaneType.splitPane&&this.dockManager.documentOnlyDrag){this.removeDocumentHost(t);const n=this.getChildContentPanes(t);e=1===n.length?n[0]:e}n.panes.push(e)}}dockToEdge(e,t){const n=this.getParent(e),i=n.panes.indexOf(e),o=Utils.isDockingIndicatorVertical(t),a=Utils.isSplitPaneVertical(n),s=this.dockingIndicator&&"rtl"===this.dockingIndicator.direction;let r=this.dockManager.draggedPane;(null==r?void 0:r.type)===locale.IgcDockManagerPaneType.splitPane&&this.dockManager.documentOnlyDrag&&!this.dockManager.dropTargetPaneInfo.floatingPaneWithoutDocHost?this.removeDocumentHost(r):(null==r?void 0:r.type)===locale.IgcDockManagerPaneType.contentPane&&this.dockManager.documentOnlyDrag&&this.dockManager.dropTargetPaneInfo.floatingPaneWithoutDocHost&&(r={type:locale.IgcDockManagerPaneType.documentHost,rootPane:{type:locale.IgcDockManagerPaneType.splitPane,orientation:locale.IgcSplitPaneOrientation.horizontal,panes:[r]}});const c=r?this.getPaneToDock(r):this.dockManager.activePane;if(o&&a||!o&&!a){const e=Utils.isDockingIndicatorBefore(t)&&!s||Utils.isDockingIndicatorBeforeRTL(t)&&s?i:i+1;n.panes.splice(e,0,c)}else{const o={type:locale.IgcDockManagerPaneType.splitPane,orientation:a?locale.IgcSplitPaneOrientation.horizontal:locale.IgcSplitPaneOrientation.vertical,panes:Utils.isDockingIndicatorBefore(t)&&!s||Utils.isDockingIndicatorBeforeRTL(t)&&s?[c,e]:[e,c],size:e.size};e.size=void 0,c.size=void 0,n.panes[i]=o}}updateLayout(){this.dockManager.layout=Object.assign({},this.dockManager.layout)}processLayout(){this.paneParentMap=new Map,this.unpinnedLocationMap=new Map,this.clientContentPanesMap=new Map,this.documentHosts=[],this.visibleContentPanes=[],this.visibleDocuments=[];const e=this.dockManager.layout;if(e){if(this.populatePaneParents(e.rootPane,!0,!1),e.floatingPanes){const t=new Map(this.dockManager.floatingPaneZIndicesMap);for(let n=0;n<e.floatingPanes.length;n++){const i=e.floatingPanes[n];this.populatePaneParents(i,!1,!1),this.dockManager.floatingPaneZIndicesMap.has(i)?t.delete(i):this.dockManager.floatingPaneZIndicesMap.set(i,n)}for(const e of t.keys())this.dockManager.floatingPaneZIndicesMap.delete(e)}this.populatePinLocations(e.rootPane),this.dockManager.flyoutPane&&!this.unpinnedLocationMap.has(this.dockManager.flyoutPane)&&(this.dockManager.flyoutPane=null)}}getParent(e){return this.paneParentMap.get(e)}getRootParent(e){return this.getPanePath(e)[0]}getPanePath(e){const t=[];let n=e;for(;n;)t.splice(0,0,n),n=this.paneParentMap.get(n);return t}getDocHostParent(e){let t=e;do{t=this.paneParentMap.get(t)}while(t&&t.type!==locale.IgcDockManagerPaneType.documentHost);return t}resizeFlyoutPane(e){const t=this.dockManager.flyoutPane,n=this.unpinnedLocationMap.get(t),i=t.unpinnedSize?t.unpinnedSize:200,o=n===locale.IgcUnpinnedLocation.left||n===locale.IgcUnpinnedLocation.top?i+e:i-e;t.unpinnedSize=o,this.updateLayout()}resizePane(e,t){const n=this.getParent(e),i=this.getSplitPaneVisibleChildren(n),o=i.indexOf(e),a=i.map((e=>e.size||0===e.size?e.size:100)),s=t*a.reduce(((e,t)=>t+e),0);i[o-1].size=a[o-1]+s,i[o].size=a[o]-s,this.updateLayout()}togglePin(e,t=IgcPinBehavior.allPanes){const n=!this.getActualIsPinned(e),i=this.paneParentMap.get(e),o={sourcePane:e,panes:i.type===locale.IgcDockManagerPaneType.tabGroupPane&&t===IgcPinBehavior.allPanes?i.panes.filter((e=>!1!==e.allowPinning)):[e],newValue:n,location:this.resolvePaneUnpinLocation(e)};if(!this.dockManager.panePinnedToggle.emit(o).defaultPrevented){for(const e of o.panes)e.isPinned=n;this.dockManager.maximizedPane?(this.dockManager.maximizedPane=null,n?this.dockManager.flyoutPane=null:this.flyoutPane(e)):n&&(this.dockManager.flyoutPane=null),this.updateLayout()}}closePane(e){let t=e;if(e.type===locale.IgcDockManagerPaneType.contentPane&&e!==this.dockManager.flyoutPane){const n=this.paneParentMap.get(e);n.type===locale.IgcDockManagerPaneType.tabGroupPane&&(t=n)}((t.type===locale.IgcDockManagerPaneType.tabGroupPane?this.removeAllowedPanes(e,t):this.emitPaneClose(e,[t]))||e.hidden)&&e===this.dockManager.flyoutPane&&(this.dockManager.flyoutPane=null),this.updateLayout()}closeFloatingPane(e){this.removeAllowedPanes(e,e),this.updateLayout()}emitPaneClose(e,t){let n=!1;const i={sourcePane:e,panes:t};if(!this.dockManager.paneClose.emit(i).defaultPrevented)for(const e of i.panes)this.removePane(e),n=!0;return n}removeAllowedPanes(e,t){let n=!1;const i=this.getChildContentPanes(t).filter((e=>this.getActualAllowClose(e))).filter((n=>t.type!==locale.IgcDockManagerPaneType.tabGroupPane||e.type!==locale.IgcDockManagerPaneType.contentPane||!1!==n.isPinned));return n=this.emitPaneClose(e,i),n}flyoutPane(e){this.dockManager.flyoutPane=this.dockManager.flyoutPane===e?null:e}maximizePane(e){const t=this.getParent(e),n=t&&t.type===locale.IgcDockManagerPaneType.tabGroupPane&&e!==this.dockManager.flyoutPane?t:e;this.dockManager.maximizedPane=this.dockManager.maximizedPane===n?null:n}moveFloatingPane(e,t){e.floatingLocation=t,this.updateLayout()}resizeFloatingPaneStart(e,t){var n,i,o;const a={sourcePane:e,resizerLocation:t};return!this.dockManager.floatingPaneResizeStart.emit(a).defaultPrevented&&(this.initialFloatingPaneLocation=null!==(n=e.floatingLocation)&&void 0!==n?n:{x:0,y:0},this.initialFloatingPaneWidth=null!==(i=e.floatingWidth)&&void 0!==i?i:100,this.initialFloatingPaneHeight=null!==(o=e.floatingHeight)&&void 0!==o?o:100,!0)}resizeFloatingPane(e,t){const n=e.floatingLocation?e.floatingLocation.x:0,i=e.floatingLocation?e.floatingLocation.y:0,o=e.floatingWidth?e.floatingWidth:100,a=e.floatingHeight?e.floatingHeight:100,s=100,r=100,c=this.initialFloatingPaneWidth,l=this.initialFloatingPaneHeight,d=this.initialFloatingPaneLocation;let h=t.dragMoveArgs.totalOffsetY,g=t.dragMoveArgs.totalOffsetX,p=n,u=i,m=o,P=a;const b=document.documentElement.clientHeight,x=document.documentElement.clientWidth;switch(t.resizerLocation){case locale.IgcResizerLocation.top:case locale.IgcResizerLocation.topLeft:case locale.IgcResizerLocation.topRight:P=l-h,P<r&&(h=l-r,P=r),u=d.y+h,u<0?(P+=u,u=0):u>=b-1&&(u=b-1);break;case locale.IgcResizerLocation.bottom:case locale.IgcResizerLocation.bottomLeft:case locale.IgcResizerLocation.bottomRight:P=l+h,P<r&&(P=r),u+P>b&&(P=b-u)}switch(t.resizerLocation){case locale.IgcResizerLocation.left:case locale.IgcResizerLocation.topLeft:case locale.IgcResizerLocation.bottomLeft:m=c-g,m<s&&(g=c-s,m=s),p=d.x+g,p<0?(m+=p,p=0):p>=x&&(p=x);break;case locale.IgcResizerLocation.right:case locale.IgcResizerLocation.topRight:case locale.IgcResizerLocation.bottomRight:m=c+g,m<s&&(m=s),p+m>x&&(m=x-p)}if(n===p&&i===u&&o===m&&a===P)return;const f={sourcePane:e,oldWidth:o,newWidth:m,oldHeight:a,newHeight:P,oldLocation:{x:n,y:i},newLocation:{x:p,y:u},resizerLocation:t.resizerLocation};this.dockManager.floatingPaneResizeMove.emit(f).defaultPrevented?t.dragMoveArgs.cancel=!0:(e.floatingLocation=f.newLocation,e.floatingWidth=f.newWidth,e.floatingHeight=f.newHeight,this.updateLayout())}resizeFloatingPaneEnd(e,t){this.dockManager.floatingPaneResizeEnd.emit({sourcePane:e,resizerLocation:t}),this.dockManager.layoutChange.emit()}floatPane(e,t,n,i,o){let a=[e],s=e;const r=this.paneParentMap.get(e);if(e!==this.dockManager.flyoutPane&&r.type===locale.IgcDockManagerPaneType.tabGroupPane)if(r.allowEmpty){const t=[...r.panes];a=t,s=1===r.panes.length?e:{type:locale.IgcDockManagerPaneType.tabGroupPane,panes:t,selectedIndex:r.selectedIndex}}else a=[r],s=r;a.forEach((e=>this.removePane(e))),this.addFloatingPane(s,{x:t,y:n},i,o),e===this.dockManager.flyoutPane&&(e.isPinned=!0,this.dockManager.flyoutPane=null),this.updateLayout()}floatTab(e,t,n,i,o){this.removePane(e);let a;if(!!this.getDocHostParent(e)&&e.documentOnly){a={type:locale.IgcDockManagerPaneType.documentHost,rootPane:{type:locale.IgcDockManagerPaneType.splitPane,orientation:locale.IgcSplitPaneOrientation.vertical,panes:[e]}}}else a=e;this.addFloatingPane(a,{x:t,y:n},i,o),this.updateLayout()}hasFloatingPaneHeader(e){const t=this.getSplitPaneVisibleChildren(e);if(t&&t.length){if(t.length>1)return!0;const e=t[0];if(e.type===locale.IgcDockManagerPaneType.splitPane)return this.hasFloatingPaneHeader(e);if(e.type===locale.IgcDockManagerPaneType.documentHost)return!0}return!1}rootDockPane(e){const t=this.dockManager.layout,n=t.rootPane,i=this.dockManager.draggedPane?this.getPaneToDock(this.dockManager.draggedPane):this.dockManager.activePane;this.removePane(i);const o=e===locale.IgcDockingIndicatorPosition.top||e===locale.IgcDockingIndicatorPosition.bottom,a=Utils.isSplitPaneVertical(n),s=this.dockingIndicator&&"rtl"===this.dockingIndicator.direction;if(o&&a||!o&&!a){const t=e===locale.IgcDockingIndicatorPosition.left&&!s||e===locale.IgcDockingIndicatorPosition.right&&s||e===locale.IgcDockingIndicatorPosition.top?0:n.panes.length;n.panes.splice(t,0,i)}else{const o={type:locale.IgcDockManagerPaneType.splitPane,orientation:a?locale.IgcSplitPaneOrientation.horizontal:locale.IgcSplitPaneOrientation.vertical,panes:e===locale.IgcDockingIndicatorPosition.left&&!s||e===locale.IgcDockingIndicatorPosition.right&&s||e===locale.IgcDockingIndicatorPosition.top?[i,n]:[n,i]};n.size=void 0,i.size=void 0,t.rootPane=o}this.updateLayout()}dockPane(e){var t;const n=null!==(t=this.dockManager.draggedPane)&&void 0!==t?t:this.dockManager.activePane,i=this.dockManager.dropTargetPaneInfo;this.removePane(n);const o=this.dockManager.draggedPane?i.pane:this.getParent(this.dockManager.activePane);switch(e){case locale.IgcDockingIndicatorPosition.center:this.dockToCenter(o,n);break;case locale.IgcDockingIndicatorPosition.left:case locale.IgcDockingIndicatorPosition.top:case locale.IgcDockingIndicatorPosition.right:case locale.IgcDockingIndicatorPosition.bottom:this.dockToEdge(o,e);break;case locale.IgcDockingIndicatorPosition.outerLeft:case locale.IgcDockingIndicatorPosition.outerTop:case locale.IgcDockingIndicatorPosition.outerRight:case locale.IgcDockingIndicatorPosition.outerBottom:const t=this.dockManager.dropTargetPaneInfo.docHost;this.dockToEdge(t,e)}this.updateLayout()}getActualIsPinned(e){return!1!==e.isPinned}getActualAllowClose(e){return!1!==e.allowClose}isContentPaneVisible(e){return!1!==e.isPinned&&!0!==e.hidden}getSplitPaneVisibleChildren(e){return e.panes.filter((e=>e.type===locale.IgcDockManagerPaneType.contentPane?this.isContentPaneVisible(e):e.type===locale.IgcDockManagerPaneType.splitPane?e.allowEmpty||this.getSplitPaneVisibleChildren(e).length:e.type===locale.IgcDockManagerPaneType.tabGroupPane?e.allowEmpty||e.panes.some((e=>this.isContentPaneVisible(e))):e.type===locale.IgcDockManagerPaneType.documentHost?e.rootPane.allowEmpty||this.getSplitPaneVisibleChildren(e.rootPane).length:void 0))}closeTabPane(e){this.emitPaneClose(e,[e]),this.updateLayout()}bringFloatingPaneOnTop(e){const t=this.dockManager.layout.floatingPanes,n=this.dockManager.floatingPaneZIndicesMap,i=n.get(e);for(const e of t){const o=n.get(e);o<i||(o>i?n.set(e,o-1):n.set(e,t.length-1))}this.dockManager.floatingPaneZIndicesMap=new Map(n)}createContextMenuItems(e){const t=[];return this.getActualAllowClose(e)&&t.push({displayText:this.dockManager.resourceStrings.close,iconName:"close",clickHandler:()=>this.closeTabPane(e)}),!1!==e.allowPinning&&t.push({displayText:this.dockManager.resourceStrings.unpin,iconName:"unpin",clickHandler:()=>this.togglePin(e,IgcPinBehavior.selectedPane)}),t}dragPaneStart(e,t,n,i){var o;if(this.dockManager.maximizedPane)return!1;let a,s;if(e.type===locale.IgcDockManagerPaneType.contentPane)s=this.getParent(e),a=s.type===locale.IgcDockManagerPaneType.tabGroupPane&&e!==this.dockManager.flyoutPane?s.panes:[e];else{if(this.dockManager.draggedPane===e)return!0;a=this.getChildContentPanes(e)}const r=a.some((e=>!1===e.allowDocking))&&a.some((e=>!1===e.allowFloating));if(e.type===locale.IgcDockManagerPaneType.contentPane&&r)return!1;if(this.dockManager.paneDragStart.emit({sourcePane:e,panes:a}).defaultPrevented)return!1;if(this.draggedPanes=a,this.initialDragClientPoint={x:n,y:i},e.type!==locale.IgcDockManagerPaneType.splitPane){if(this.draggedPanes.some((e=>!1===e.allowFloating)))return this.dockManager.draggedPane=a.length>1?s:e,!0;const n={type:locale.IgcPaneDragActionType.floatPane,location:{x:t.x,y:t.y},width:t.width,height:t.height},i=this.dockManager.paneDragOver.emit({sourcePane:e,panes:a,action:n,isValid:!0});return!i.defaultPrevented&&(i.detail.isValid?(this.floatPane(e,t.x,t.y,n.width,n.height),!1):(this.dockManager.draggedPane=a.length>1?s:e,!0))}return this.dockManager.draggedPane=e,this.initialFloatingPaneLocation=null!==(o=e.floatingLocation)&&void 0!==o?o:{x:0,y:0},!0}dragPaneMove(e,t){const n=this.dockManager.draggedPane;if(n.type===locale.IgcDockManagerPaneType.splitPane){const i=n.floatingLocation?n.floatingLocation:{x:0,y:0},o={x:this.initialFloatingPaneLocation.x+e-this.initialDragClientPoint.x,y:this.initialFloatingPaneLocation.y+t-this.initialDragClientPoint.y},a=this.dockManager.paneDragOver.emit({sourcePane:n,panes:this.draggedPanes,action:{type:locale.IgcPaneDragActionType.moveFloatingPane,oldLocation:i,newLocation:o},isValid:!0});if(a.defaultPrevented)return!1;a.detail.isValid&&this.moveFloatingPane(n,o),this.dockManager.isValidDrop=a.detail.isValid}return this.dragOver()}dragPaneEnd(){var e;const t=this.dockingIndicator,n=null!==(e=this.dockManager.draggedPane)&&void 0!==e?e:this.draggedTab;let i=!1;return this.dockManager.paneDragEnd.emit({sourcePane:n,panes:this.draggedPanes}),t&&this.dockManager.isValidDrop&&(n.type===locale.IgcDockManagerPaneType.contentPane&&!1===n.isPinned&&(n.isPinned=!0,n===this.dockManager.flyoutPane&&(this.dockManager.flyoutPane=null)),t.isRoot?this.rootDockPane(t.position):this.dockPane(t.position),i=!0),this.draggedPanes=null,this.draggedTab=null,this.dockManager.draggedPane=null,this.dockManager.dropTargetPaneInfo=null,this.dockManager.dropShadowRect=null,this.dockManager.isValidDrop=!0,this.dockManager.layoutChange.emit(),i}dragOver(){var e;if(this.dockingIndicator){const t=this.dockManager.paneDragOver.emit({sourcePane:this.dockManager.draggedPane,panes:this.draggedPanes,action:{type:locale.IgcPaneDragActionType.dockPane,dockingIndicator:this.dockingIndicator,targetPane:null===(e=this.dockManager.dropTargetPaneInfo)||void 0===e?void 0:e.pane},isValid:!0});if(t.defaultPrevented)return!1;this.dockManager.isValidDrop=t.detail.isValid,this.dockManager.dropShadowRect=this.dockManager.isValidDrop?this.dockingIndicator.isRoot?this.getDropShadowRectRoot():this.getDropShadowRect():null}else this.dockManager.dropShadowRect=null,this.dockManager.draggedPane.type!==locale.IgcDockManagerPaneType.splitPane&&(this.dockManager.isValidDrop=!1);return!0}dragTabStart(e){if(this.shiftLeftThreshold=Number.MAX_VALUE,this.shiftRightThreshold=0,this.dockManager.draggedPane===e)return!0;return!this.dockManager.paneDragStart.emit({sourcePane:e,panes:[e]}).defaultPrevented&&(this.initialTabHeaderClickOffset=null,this.draggedTab=e,this.draggedPanes=[e],!0)}dragTabMove(e,t,n){const i=t.clientX,o=t.clientY,a=t.offsetX,s=t.totalOffsetX,r=t.totalOffsetY,c=n.headerRect,l=n.prevHeaderRect,d=n.nextHeaderRect,h=n.lastVisibleHeaderRect,g=n.tabsRect;if(!this.initialTabHeaderClickOffset){const e=i-s-c.left,t=o-r-c.top;this.initialTabHeaderClickOffset={x:e,y:t}}if(!1===e.allowFloating&&(i<g.left||i>g.right||o<c.top||o>c.bottom))return this.dockManager.draggedPane=e,this.dragOver();this.dockManager.draggedPane=null,this.dockManager.isValidDrop=!0;const p=this.getParent(e).panes.indexOf(e);if(l&&i<c.left&&i<this.shiftLeftThreshold&&a<0){this.shiftLeftThreshold=l.left;const t={type:locale.IgcPaneDragActionType.moveTab,oldIndex:p,newIndex:p-1},n=this.dockManager.paneDragOver.emit({sourcePane:e,panes:[e],action:t,isValid:!0});if(n.defaultPrevented)return!1;if(!n.detail.isValid)return!0;this.shiftTabLeft(e)}else if(d&&i>c.right&&i>this.shiftRightThreshold&&a>0&&(this.shiftRightThreshold=d.right,c.top===d.top)){const t={type:locale.IgcPaneDragActionType.moveTab,oldIndex:p,newIndex:p+1},n=this.dockManager.paneDragOver.emit({sourcePane:e,panes:[e],action:t,isValid:!0});if(n.defaultPrevented)return!1;if(!n.detail.isValid)return!0;this.shiftTabRight(e)}return!((Math.abs(r)>50||g.left-i>50||i-h.right>50)&&!1!==e.allowFloating&&!this.dockManager.maximizedPane)||this.floatTabHeader(e,i,o,g)}floatTabHeader(e,t,n,i){const o=new DOMRect(t-this.initialTabHeaderClickOffset.x,n-this.initialTabHeaderClickOffset.y,i.width,i.height);let a,s;e.type===locale.IgcDockManagerPaneType.contentPane&&(s=this.getParent(e),a=s.type===locale.IgcDockManagerPaneType.tabGroupPane&&e!==this.dockManager.flyoutPane?s.panes:[e]),this.draggedTab=null;const r={type:locale.IgcPaneDragActionType.floatPane,location:{x:o.x,y:o.y},width:o.width,height:o.height},c=this.dockManager.paneDragOver.emit({sourcePane:e,panes:a,action:r,isValid:!0});return!c.defaultPrevented&&(!c.detail.isValid||(this.initialDragClientPoint={x:t,y:n},this.floatTab(e,o.x,o.y,r.width,r.height),!1))}resolveChildPanesAllowMaximize(e){return this.getChildContentPanes(e).filter((e=>this.isContentPaneVisible(e))).every((e=>{var t;return null!==(t=e.allowMaximize)&&void 0!==t?t:this.dockManager.allowMaximize}))}normalizeMaximizedPane(e){if(this.dockManager.maximizedPane){(this.dockManager.maximizedPane.type===locale.IgcDockManagerPaneType.splitPane||this.dockManager.maximizedPane.type===locale.IgcDockManagerPaneType.tabGroupPane?this.getChildContentPanes(this.dockManager.maximizedPane):[this.dockManager.maximizedPane]).every((t=>t!==e))&&this.maximizePane(this.dockManager.maximizedPane)}}resolveAllowMaximize(e){var t,n;if(e.type===locale.IgcDockManagerPaneType.splitPane||e.type===locale.IgcDockManagerPaneType.tabGroupPane)return this.resolveChildPanesAllowMaximize(e);if(e.type===locale.IgcDockManagerPaneType.contentPane){if(!this.getActualIsPinned(e))return null!==(t=e.allowMaximize)&&void 0!==t?t:this.dockManager.allowMaximize;const i=this.getParent(e);return i.type===locale.IgcDockManagerPaneType.tabGroupPane?this.resolveChildPanesAllowMaximize(i):null!==(n=e.allowMaximize)&&void 0!==n?n:this.dockManager.allowMaximize}}getDropShadowRect(){var e;const t=this.dropTargetParentRect,n=this.dockManager.dropTargetPaneInfo;if(!n)return;const i=new DOMRect,o=null!==(e=this.getPaneToDock(this.dockManager.draggedPane).size)&&void 0!==e?e:100,a=Utils.isDockingIndicatorOuter(this.dockingIndicator.position),s=a?t:n.targetRect;if(this.dockingIndicator.position===locale.IgcDockingIndicatorPosition.center)return i.x=s.x,i.y=s.y,i.width=s.width,i.height=s.height,i;const r=a?n.docHost:n.pane,c=this.getParent(r),l=this.getSplitPaneVisibleChildren(c),d=l.indexOf(this.dockManager.draggedPane);d>-1&&l.splice(d,1);const h=l.indexOf(r),g=Utils.isDockingIndicatorVertical(this.dockingIndicator.position),p=Utils.isSplitPaneVertical(c),u=g&&p||!g&&!p,m="rtl"===this.dockingIndicator.direction,P=l.reduce(((e,t)=>e+(t.size||100)),0),b=!m||g?l.slice(0,h).reduce(((e,t)=>e+(t.size||100)),0):l.slice(h,l.length).reduce(((e,t)=>e+(t.size||100)),0),x=!m||g?l.slice(0,h+1).reduce(((e,t)=>e+(t.size||100)),0):l.slice(h+1,l.length).reduce(((e,t)=>e+(t.size||100)),0);switch(this.dockingIndicator.position){case locale.IgcDockingIndicatorPosition.left:case locale.IgcDockingIndicatorPosition.outerLeft:i.x=s.x,i.y=s.y,i.height=s.height,u?(i.width=o/(o+P)*t.width,i.x=m?t.left+x/(o+P)*t.width:t.left+b/(o+P)*t.width):i.width=t.width/2;break;case locale.IgcDockingIndicatorPosition.right:case locale.IgcDockingIndicatorPosition.outerRight:i.y=s.y,i.height=s.height,u?(i.width=o/(o+P)*t.width,i.x=m?t.left+b/(o+P)*t.width:t.left+x/(o+P)*t.width):(i.width=t.width/2,i.x=t.right-i.width);break;case locale.IgcDockingIndicatorPosition.top:case locale.IgcDockingIndicatorPosition.outerTop:i.x=s.x,i.y=s.y,i.width=s.width,u?(i.height=o/(o+P)*t.height,i.y=t.top+b/(o+P)*t.height):i.height=t.height/2;break;case locale.IgcDockingIndicatorPosition.bottom:case locale.IgcDockingIndicatorPosition.outerBottom:i.x=s.x,i.width=s.width,u?(i.height=o/(o+P)*t.height,i.y=t.top+x/(o+P)*t.height):(i.height=t.height/2,i.y=t.bottom-i.height)}return i}getDropShadowRectRoot(){var e;const t=this.dropTargetParentRect,n=new DOMRect,i=null!==(e=this.getPaneToDock(this.dockManager.draggedPane).size)&&void 0!==e?e:100,o=this.getSplitPaneVisibleChildren(this.dockManager.layout.rootPane),a=o.indexOf(this.dockManager.draggedPane);a>-1&&o.splice(a,1);const s=o.reduce(((e,t)=>e+(t.size||100)),0),r=Utils.isDockingIndicatorVertical(this.dockingIndicator.position),c=Utils.isSplitPaneVertical(this.dockManager.layout.rootPane),l=r&&c||!r&&!c,d=0===o.length;switch(this.dockingIndicator.position){case locale.IgcDockingIndicatorPosition.left:n.x=t.x,n.y=t.y,n.height=t.height,n.width=l||d?i/(i+s)*t.width:t.width/2;break;case locale.IgcDockingIndicatorPosition.right:n.y=t.y,n.height=t.height,n.width=l||d?n.width=i/(i+s)*t.width:t.width/2,n.x=t.right-n.width;break;case locale.IgcDockingIndicatorPosition.top:n.x=t.x,n.y=t.y,n.width=t.width,n.height=l||d?i/(i+s)*t.height:t.height/2;break;case locale.IgcDockingIndicatorPosition.bottom:n.x=t.x,n.width=t.width,n.height=l||d?i/(i+s)*t.height:t.height/2,n.y=t.bottom-n.height}return n}selectHiddenTab(e,t){const n=e.panes.indexOf(t);e.panes.splice(n,1),e.panes.splice(0,0,t),e.selectedIndex=0,this.updateLayout()}shiftTabLeft(e){const t=this.getParent(e),n=t.panes.indexOf(e);n>0&&(t.panes.splice(n,1),t.panes.splice(n-1,0,e),t.selectedIndex=n-1,this.updateLayout()),this.forceDragTabHeader=e}shiftTabRight(e){const t=this.getParent(e),n=t.panes.indexOf(e);n<t.panes.length-1&&(t.panes.splice(n,1),t.panes.splice(n+1,0,e),t.selectedIndex=n+1,this.updateLayout()),this.forceDragTabHeader=e}cacheDocumentsOrder(){this.documentsCache=this.visibleDocuments.filter((e=>!e.disabled))}cacheContentPanesOrder(){this.contentPanesCache=this.visibleContentPanes.filter((e=>!e.disabled))}focusPrevContentPane(e){const t=e?this.documentsCache:this.contentPanesCache,n=t.indexOf(this.dockManager.activePane),i=n>0?t[n-1]:t[t.length-1];this.normalizeMaximizedPane(i),this.dockManager.activePane=i}focusNextContentPane(e){const t=e?this.documentsCache:this.contentPanesCache,n=t.indexOf(this.dockManager.activePane),i=n>=0&&n<t.length-1?t[n+1]:t[0];this.normalizeMaximizedPane(i),this.dockManager.activePane=i}}class IgcDockManagerKeyboardService{constructor(e){this.service=e}handleKeydown(e){if(this.service.dockManager.disableKeyboardNavigation)return;const t=this.service.dockManager.activePane,n=Utils.isControlOrMetaPressed(e),i=Utils.isAltPressed(e),o=e.shiftKey;if("Control"===e.key||"Meta"===e.key||"OS"===e.key)this.service.cacheDocumentsOrder();else if("Alt"===e.key||"AltGraph"===e.key)this.service.cacheContentPanesOrder();else if("F6"===e.key||e.key.startsWith("Arrow")&&!o&&n)this.handleFocusPane(e),e.stopPropagation();else if("F3"===e.key&&i&&t)this.service.dockManager.focusElement(),this.service.closePane(t),e.stopPropagation();else if(e.key.startsWith("Arrow")&&o&&t)this.service.dockManager.focusElement(),this.handleDockPane(e),e.stopPropagation();else{if("F7"!==e.key&&"F8"!==e.key||!i&&!n)return;this.setPaneNavigatorMeta(i,n,o),e.stopPropagation()}}handleFocusPane(e){const t=Utils.isAltPressed(e),n=Utils.isControlOrMetaPressed(e),i=e.shiftKey,o="F6"===e.key,a="ArrowLeft"===e.key,s="ArrowRight"===e.key;t&&i&&o?this.service.focusPrevContentPane(!1):t&&o?this.service.focusNextContentPane(!1):n&&i&&o||n&&a?this.service.focusPrevContentPane(!0):(n&&o||n&&s)&&this.service.focusNextContentPane(!0)}handleDockPane(e){const t=e.key,n=Utils.isControlOrMetaPressed(e),i=e.shiftKey;if(n&&i)this.handleRootDockPane(t);else if(i){const e=this.service.dockManager.activePane,n=this.service.getParent(e);n.type===locale.IgcDockManagerPaneType.tabGroupPane&&n.panes.length>1&&this.handleInnerDockPane(t)}}handleRootDockPane(e){switch(e){case"ArrowUp":this.service.rootDockPane(locale.IgcDockingIndicatorPosition.top);break;case"ArrowDown":this.service.rootDockPane(locale.IgcDockingIndicatorPosition.bottom);break;case"ArrowLeft":this.service.rootDockPane(locale.IgcDockingIndicatorPosition.left);break;case"ArrowRight":this.service.rootDockPane(locale.IgcDockingIndicatorPosition.right)}}handleInnerDockPane(e){switch(e){case"ArrowUp":this.service.dockPane(locale.IgcDockingIndicatorPosition.top);break;case"ArrowDown":this.service.dockPane(locale.IgcDockingIndicatorPosition.bottom);break;case"ArrowLeft":this.service.dockPane(locale.IgcDockingIndicatorPosition.left);break;case"ArrowRight":this.service.dockPane(locale.IgcDockingIndicatorPosition.right)}}setPaneNavigatorMeta(e,t,n){let i=0;const o=this.service.visibleContentPanes.concat(this.service.visibleDocuments);if(o.length>0){t?i=this.service.visibleDocuments.length>0?n?this.service.visibleContentPanes.length+this.service.visibleDocuments.length-1:this.service.visibleContentPanes.length:n?this.service.visibleContentPanes.length-1:0:e&&(i=n?this.service.visibleContentPanes.length>0?this.service.visibleContentPanes.length-1:this.service.visibleDocuments.length-1:0);const a={activePanes:this.service.visibleContentPanes,activeDocuments:this.service.visibleDocuments,initialIndex:i,previousActivePaneIndex:o.indexOf(this.service.dockManager.activePane)};this.service.dockManager.activePane=null,this.service.dockManager.navigationPaneMeta=a}}}const dockmanagerComponentCss=':host{position:relative;display:-ms-flexbox;display:flex;overflow:hidden;-webkit-box-sizing:border-box;box-sizing:border-box;height:100%;background:var(--igc-dock-background, var(--igc-background-color, #E5E7E9));color:var(--igc-dock-text, var(--igc-text-color, rgba(0, 0, 0, 0.72)));font-family:var(--igc-font-family, "Titillium Web", "Roboto", "Helvetica Neue", sans-serif);outline-style:none;--unpinned-tab-area-size:30px}:host igc-icon-component svg{width:17px;height:17px}.pane-container--vertical,.pane-container--horizontal,.pane-container{display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;height:100%;width:100%;overflow:hidden}.pane-container--vertical{-ms-flex-direction:column;flex-direction:column}.unpinned-tab-area{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;width:var(--unpinned-tab-area-size);height:auto}.unpinned-tab-area--left{padding:8px 8px 8px 0}.unpinned-tab-area--right{padding:8px 0 8px 8px}.unpinned-tab-area--bottom{padding-top:8px}.unpinned-tab-area--horizontal{-ms-flex-direction:row;flex-direction:row;width:auto;height:var(--unpinned-tab-area-size)}.unpinned-tab-area--hidden{display:none}.flyout-pane{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;position:absolute;width:100%;height:100%;pointer-events:none;z-index:2}.flyout-pane igc-content-pane-component{-webkit-box-shadow:0 12px 8px var(--igc-flyout-shadow-color, rgba(0, 0, 0, 0.08));box-shadow:0 12px 8px var(--igc-flyout-shadow-color, rgba(0, 0, 0, 0.08))}.flyout-pane--right{-ms-flex-direction:row-reverse;flex-direction:row-reverse}.flyout-pane--right igc-content-pane-component{-webkit-box-shadow:-12px 0px 8px var(--igc-flyout-shadow-color, rgba(0, 0, 0, 0.08));box-shadow:-12px 0px 8px var(--igc-flyout-shadow-color, rgba(0, 0, 0, 0.08))}.flyout-pane--bottom{-ms-flex-direction:column-reverse;flex-direction:column-reverse}.flyout-pane--bottom igc-content-pane-component{-webkit-box-shadow:0 -12px 8px var(--igc-flyout-shadow-color, rgba(0, 0, 0, 0.08));box-shadow:0 -12px 8px var(--igc-flyout-shadow-color, rgba(0, 0, 0, 0.08))}.flyout-pane--left{-ms-flex-direction:row;flex-direction:row}.flyout-pane--left igc-content-pane-component{-webkit-box-shadow:12px 0px 8px var(--igc-flyout-shadow-color, rgba(0, 0, 0, 0.08));box-shadow:12px 0px 8px var(--igc-flyout-shadow-color, rgba(0, 0, 0, 0.08))}.floating-panes{position:fixed;top:0;left:0;bottom:0;right:0;pointer-events:none;z-index:10000}.docking-indicators-container{position:absolute;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;width:100%;height:100%;pointer-events:none;z-index:10004}.content{overflow:auto;height:100%;-ms-flex-positive:1;flex-grow:1;color:var(--igc-pane-content-text, var(--igc-text-color, rgba(0, 0, 0, 0.72)));background:var(--igc-pane-content-background, var(--igc-border-color, #F3F5F7))}.maximized{position:absolute;top:0;bottom:0;left:0;right:0;z-index:10002}.drop-shadow{background-color:var(--igc-drop-shadow-background, rgba(100, 149, 237, 0.2));position:fixed;z-index:10003;display:block;pointer-events:none}';var ActionReason;!function(e){e.click="click",e.drop="drop",e.maximizeOrMinimize="maximizeOrMinimize"}(ActionReason||(ActionReason={}));let IgcDockManager=class{constructor(e){index.registerInstance(this,e),this.paneHeaderConnected=index.createEvent(this,"paneHeaderConnected",7),this.paneHeaderDisconnected=index.createEvent(this,"paneHeaderDisconnected",7),this.tabHeaderConnected=index.createEvent(this,"tabHeaderConnected",7),this.tabHeaderDisconnected=index.createEvent(this,"tabHeaderDisconnected",7),this.splitterResizeStart=index.createEvent(this,"splitterResizeStart",7),this.splitterResizeEnd=index.createEvent(this,"splitterResizeEnd",7),this.paneClose=index.createEvent(this,"paneClose",7),this.panePinnedToggle=index.createEvent(this,"panePinnedToggle",7),this.activePaneChanged=index.createEvent(this,"activePaneChanged",7),this.paneDragStart=index.createEvent(this,"paneDragStart",7),this.paneDragOver=index.createEvent(this,"paneDragOver",7),this.paneDragEnd=index.createEvent(this,"paneDragEnd",7),this.floatingPaneResizeMove=index.createEvent(this,"floatingPaneResizeMove",7),this.floatingPaneResizeEnd=index.createEvent(this,"floatingPaneResizeEnd",7),this.floatingPaneResizeStart=index.createEvent(this,"floatingPaneResizeStart",7),this.layoutChange=index.createEvent(this,"layoutChange",7),this._tabHeaderIconClicked=!1,this.service=new IgcDockManagerService(this),this.keyboardService=new IgcDockManagerKeyboardService(this.service),this.activePaneInternalSet=!1,this.domObserver=new MutationObserver(this.mutationCallback.bind(this)),this.shouldMovePane=!1,this.scheduledCallbacks=[],this.shouldClearActivePane=!0,this.isDragging=!1,this.splitterOffset=1,this.templatableComponents=[{slot:"paneHeaderCloseButton",targetName:"igc-pane-header-component",targetSlot:"paneHeaderCloseButton",targetPart:"pane-header-close-button"},{slot:"tabHeaderCloseButton",targetName:"igc-tab-header-component",targetSlot:"tabHeaderCloseButton",targetPart:"tab-header-close-button"},{slot:"tabHeaderCloseButton",targetName:"igc-context-menu-component",targetSlot:"contextMenuCloseButton",targetPart:"context-menu-clo