flexlayout-react 0.8.0 → 0.8.1
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/ChangeLog.txt +5 -0
- package/declarations/view/Layout.d.ts +1 -0
- package/dist/flexlayout.js +6 -6
- package/dist/flexlayout_min.js +1 -1
- package/lib/model/TabSetNode.js +2 -0
- package/lib/model/TabSetNode.js.map +1 -1
- package/lib/view/BorderButton.js +7 -2
- package/lib/view/BorderButton.js.map +1 -1
- package/lib/view/Layout.js +1 -0
- package/lib/view/Layout.js.map +1 -1
- package/lib/view/TabButton.js +7 -2
- package/lib/view/TabButton.js.map +1 -1
- package/lib/view/TabSet.js +7 -2
- package/lib/view/TabSet.js.map +1 -1
- package/package.json +1 -1
- package/src/model/TabSetNode.ts +3 -0
- package/src/view/BorderButton.tsx +6 -2
- package/src/view/Layout.tsx +2 -0
- package/src/view/TabButton.tsx +6 -2
- package/src/view/TabSet.tsx +6 -2
- package/style/dark.css +685 -685
- package/style/gray.css +668 -668
- package/style/light.css +669 -669
- package/style/rounded.css +697 -697
- package/style/underline.css +690 -690
package/dist/flexlayout_min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],e):"object"==typeof exports?exports.FlexLayout=e(require("react"),require("react-dom")):t.FlexLayout=e(t.React,t.ReactDOM)}(self,((t,e)=>(()=>{"use strict";var i={557:(t,e,i)=>{var n=i(47);e.H=n.createRoot,n.hydrateRoot},36:e=>{e.exports=t},47:t=>{t.exports=e}},n={};function o(t){var e=n[t];if(void 0!==e)return e.exports;var s=n[t]={exports:{}};return i[t](s,s.exports,o),s.exports}o.d=(t,e)=>{for(var i in e)o.o(e,i)&&!o.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var s={};o.r(s),o.d(s,{Action:()=>T,Actions:()=>_,BorderNode:()=>F,BorderSet:()=>b,CLASSES:()=>r,DefaultMax:()=>U,DefaultMin:()=>C,DockLocation:()=>g,DropInfo:()=>m,I18nLabel:()=>a,ICloseType:()=>H,Layout:()=>at,LayoutInternal:()=>rt,LayoutWindow:()=>B,Model:()=>W,Node:()=>f,Orientation:()=>c,Rect:()=>u,RowNode:()=>M,TabNode:()=>O,TabSetNode:()=>I});var a,r,l=o(36),d=o(47),h=o(557);class c{static flip(t){return t===c.HORZ?c.VERT:c.HORZ}constructor(t){this._name=t}getName(){return this._name}toString(){return this._name}}c.HORZ=new c("horz"),c.VERT=new c("vert");class u{static empty(){return new u(0,0,0,0)}static fromJson(t){return new u(t.x,t.y,t.width,t.height)}constructor(t,e,i,n){this.x=t,this.y=e,this.width=i,this.height=n}toJson(){return{x:this.x,y:this.y,width:this.width,height:this.height}}snap(t){this.x=Math.round(this.x/t)*t,this.y=Math.round(this.y/t)*t,this.width=Math.round(this.width/t)*t,this.height=Math.round(this.height/t)*t}static getBoundingClientRect(t){let{x:e,y:i,width:n,height:o}=t.getBoundingClientRect();return new u(e,i,n,o)}static getContentRect(t){const e=t.getBoundingClientRect(),i=window.getComputedStyle(t),n=parseFloat(i.paddingLeft),o=parseFloat(i.paddingRight),s=parseFloat(i.paddingTop),a=parseFloat(i.paddingBottom),r=parseFloat(i.borderLeftWidth),l=parseFloat(i.borderRightWidth),d=parseFloat(i.borderTopWidth),h=parseFloat(i.borderBottomWidth),c=e.width-r-n-o-l,g=e.height-d-s-a-h;return new u(e.left+r+n,e.top+d+s,c,g)}static fromDomRect(t){return new u(t.x,t.y,t.width,t.height)}relativeTo(t){return new u(this.x-t.x,this.y-t.y,this.width,this.height)}clone(){return new u(this.x,this.y,this.width,this.height)}equals(t){return this.x===(null==t?void 0:t.x)&&this.y===(null==t?void 0:t.y)&&this.width===(null==t?void 0:t.width)&&this.height===(null==t?void 0:t.height)}equalSize(t){return this.width===(null==t?void 0:t.width)&&this.height===(null==t?void 0:t.height)}getBottom(){return this.y+this.height}getRight(){return this.x+this.width}getCenter(){return{x:this.x+this.width/2,y:this.y+this.height/2}}positionElement(t,e){this.styleWithPosition(t.style,e)}styleWithPosition(t,e="absolute"){return t.left=this.x+"px",t.top=this.y+"px",t.width=Math.max(0,this.width)+"px",t.height=Math.max(0,this.height)+"px",t.position=e,t}contains(t,e){return this.x<=t&&t<=this.getRight()&&this.y<=e&&e<=this.getBottom()}removeInsets(t){return new u(this.x+t.left,this.y+t.top,Math.max(0,this.width-t.left-t.right),Math.max(0,this.height-t.top-t.bottom))}centerInRect(t){this.x=(t.width-this.width)/2,this.y=(t.height-this.height)/2}_getSize(t){let e=this.width;return t===c.VERT&&(e=this.height),e}toString(){return"(Rect: x="+this.x+", y="+this.y+", width="+this.width+", height="+this.height+")"}}class g{static getByName(t){return g.values.get(t)}static getLocation(t,e,i){if(e=(e-t.x)/t.width,i=(i-t.y)/t.height,e>=.25&&e<.75&&i>=.25&&i<.75)return g.CENTER;const n=i>=1-e;return i>=e?n?g.BOTTOM:g.LEFT:n?g.RIGHT:g.TOP}constructor(t,e,i){this.name=t,this.orientation=e,this.indexPlus=i,g.values.set(this.name,this)}getName(){return this.name}getOrientation(){return this.orientation}getDockRect(t){return this===g.TOP?new u(t.x,t.y,t.width,t.height/2):this===g.BOTTOM?new u(t.x,t.getBottom()-t.height/2,t.width,t.height/2):this===g.LEFT?new u(t.x,t.y,t.width/2,t.height):this===g.RIGHT?new u(t.getRight()-t.width/2,t.y,t.width/2,t.height):t.clone()}split(t,e){return this===g.TOP?{start:new u(t.x,t.y,t.width,e),end:new u(t.x,t.y+e,t.width,t.height-e)}:this===g.LEFT?{start:new u(t.x,t.y,e,t.height),end:new u(t.x+e,t.y,t.width-e,t.height)}:this===g.RIGHT?{start:new u(t.getRight()-e,t.y,e,t.height),end:new u(t.x,t.y,t.width-e,t.height)}:{start:new u(t.x,t.getBottom()-e,t.width,e),end:new u(t.x,t.y,t.width,t.height-e)}}reflect(){return this===g.TOP?g.BOTTOM:this===g.LEFT?g.RIGHT:this===g.RIGHT?g.LEFT:g.TOP}toString(){return"(DockLocation: name="+this.name+", orientation="+this.orientation+")"}}g.values=new Map,g.TOP=new g("top",c.VERT,0),g.BOTTOM=new g("bottom",c.VERT,1),g.LEFT=new g("left",c.HORZ,0),g.RIGHT=new g("right",c.HORZ,1),g.CENTER=new g("center",c.VERT,0),function(t){t.Close_Tab="Close",t.Close_Tabset="Close tab set",t.Active_Tabset="Active tab set",t.Move_Tabset="Move tab set",t.Move_Tabs="Move tabs(?)",t.Maximize="Maximize tab set",t.Restore="Restore tab set",t.Popout_Tab="Popout selected tab",t.Overflow_Menu_Tooltip="Hidden tabs",t.Error_rendering_component="Error rendering component"}(a||(a={})),function(t){t.FLEXLAYOUT__BORDER="flexlayout__border",t.FLEXLAYOUT__BORDER_="flexlayout__border_",t.FLEXLAYOUT__BORDER_TAB_CONTENTS="flexlayout__border_tab_contents",t.FLEXLAYOUT__BORDER_BUTTON="flexlayout__border_button",t.FLEXLAYOUT__BORDER_BUTTON_="flexlayout__border_button_",t.FLEXLAYOUT__BORDER_BUTTON_CONTENT="flexlayout__border_button_content",t.FLEXLAYOUT__BORDER_BUTTON_LEADING="flexlayout__border_button_leading",t.FLEXLAYOUT__BORDER_BUTTON_TRAILING="flexlayout__border_button_trailing",t.FLEXLAYOUT__BORDER_BUTTON__SELECTED="flexlayout__border_button--selected",t.FLEXLAYOUT__BORDER_BUTTON__UNSELECTED="flexlayout__border_button--unselected",t.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW="flexlayout__border_toolbar_button_overflow",t.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW_="flexlayout__border_toolbar_button_overflow_",t.FLEXLAYOUT__BORDER_INNER="flexlayout__border_inner",t.FLEXLAYOUT__BORDER_INNER_="flexlayout__border_inner_",t.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER="flexlayout__border_inner_tab_container",t.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER_="flexlayout__border_inner_tab_container_",t.FLEXLAYOUT__BORDER_TAB_DIVIDER="flexlayout__border_tab_divider",t.FLEXLAYOUT__BORDER_SIZER="flexlayout__border_sizer",t.FLEXLAYOUT__BORDER_TOOLBAR="flexlayout__border_toolbar",t.FLEXLAYOUT__BORDER_TOOLBAR_="flexlayout__border_toolbar_",t.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON="flexlayout__border_toolbar_button",t.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_FLOAT="flexlayout__border_toolbar_button-float",t.FLEXLAYOUT__DRAG_RECT="flexlayout__drag_rect",t.FLEXLAYOUT__EDGE_RECT="flexlayout__edge_rect",t.FLEXLAYOUT__EDGE_RECT_TOP="flexlayout__edge_rect_top",t.FLEXLAYOUT__EDGE_RECT_LEFT="flexlayout__edge_rect_left",t.FLEXLAYOUT__EDGE_RECT_BOTTOM="flexlayout__edge_rect_bottom",t.FLEXLAYOUT__EDGE_RECT_RIGHT="flexlayout__edge_rect_right",t.FLEXLAYOUT__ERROR_BOUNDARY_CONTAINER="flexlayout__error_boundary_container",t.FLEXLAYOUT__ERROR_BOUNDARY_CONTENT="flexlayout__error_boundary_content",t.FLEXLAYOUT__FLOATING_WINDOW_CONTENT="flexlayout__floating_window_content",t.FLEXLAYOUT__FLOATING_WINDOW_TAB="flexlayout__floating_window_tab",t.FLEXLAYOUT__LAYOUT="flexlayout__layout",t.FLEXLAYOUT__LAYOUT_MOVEABLES="flexlayout__layout_moveables",t.FLEXLAYOUT__LAYOUT_OVERLAY="flexlayout__layout_overlay",t.FLEXLAYOUT__LAYOUT_TAB_STAMPS="flexlayout__layout_tab_stamps",t.FLEXLAYOUT__LAYOUT_MAIN="flexlayout__layout_main",t.FLEXLAYOUT__LAYOUT_BORDER_CONTAINER="flexlayout__layout_border_container",t.FLEXLAYOUT__LAYOUT_BORDER_CONTAINER_INNER="flexlayout__layout_border_container_inner",t.FLEXLAYOUT__OUTLINE_RECT="flexlayout__outline_rect",t.FLEXLAYOUT__OUTLINE_RECT_EDGE="flexlayout__outline_rect_edge",t.FLEXLAYOUT__SPLITTER="flexlayout__splitter",t.FLEXLAYOUT__SPLITTER_EXTRA="flexlayout__splitter_extra",t.FLEXLAYOUT__SPLITTER_="flexlayout__splitter_",t.FLEXLAYOUT__SPLITTER_BORDER="flexlayout__splitter_border",t.FLEXLAYOUT__SPLITTER_DRAG="flexlayout__splitter_drag",t.FLEXLAYOUT__SPLITTER_HANDLE="flexlayout__splitter_handle",t.FLEXLAYOUT__SPLITTER_HANDLE_HORZ="flexlayout__splitter_handle_horz",t.FLEXLAYOUT__SPLITTER_HANDLE_VERT="flexlayout__splitter_handle_vert",t.FLEXLAYOUT__ROW="flexlayout__row",t.FLEXLAYOUT__TAB="flexlayout__tab",t.FLEXLAYOUT__TAB_POSITION="flexlayout__tab_position",t.FLEXLAYOUT__TAB_MOVEABLE="flexlayout__tab_moveable",t.FLEXLAYOUT__TAB_OVERLAY="flexlayout__tab_overlay",t.FLEXLAYOUT__TABSET="flexlayout__tabset",t.FLEXLAYOUT__TABSET_CONTAINER="flexlayout__tabset_container",t.FLEXLAYOUT__TABSET_HEADER="flexlayout__tabset_header",t.FLEXLAYOUT__TABSET_HEADER_SIZER="flexlayout__tabset_header_sizer",t.FLEXLAYOUT__TABSET_HEADER_CONTENT="flexlayout__tabset_header_content",t.FLEXLAYOUT__TABSET_MAXIMIZED="flexlayout__tabset-maximized",t.FLEXLAYOUT__TABSET_SELECTED="flexlayout__tabset-selected",t.FLEXLAYOUT__TABSET_SIZER="flexlayout__tabset_sizer",t.FLEXLAYOUT__TABSET_TAB_DIVIDER="flexlayout__tabset_tab_divider",t.FLEXLAYOUT__TABSET_CONTENT="flexlayout__tabset_content",t.FLEXLAYOUT__TABSET_TABBAR_INNER="flexlayout__tabset_tabbar_inner",t.FLEXLAYOUT__TABSET_TABBAR_INNER_="flexlayout__tabset_tabbar_inner_",t.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER="flexlayout__tabset_tabbar_inner_tab_container",t.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER_="flexlayout__tabset_tabbar_inner_tab_container_",t.FLEXLAYOUT__TABSET_TABBAR_OUTER="flexlayout__tabset_tabbar_outer",t.FLEXLAYOUT__TABSET_TABBAR_OUTER_="flexlayout__tabset_tabbar_outer_",t.FLEXLAYOUT__TAB_BORDER="flexlayout__tab_border",t.FLEXLAYOUT__TAB_BORDER_="flexlayout__tab_border_",t.FLEXLAYOUT__TAB_BUTTON="flexlayout__tab_button",t.FLEXLAYOUT__TAB_BUTTON_STRETCH="flexlayout__tab_button_stretch",t.FLEXLAYOUT__TAB_BUTTON_CONTENT="flexlayout__tab_button_content",t.FLEXLAYOUT__TAB_BUTTON_LEADING="flexlayout__tab_button_leading",t.FLEXLAYOUT__TAB_BUTTON_OVERFLOW="flexlayout__tab_button_overflow",t.FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT="flexlayout__tab_button_overflow_count",t.FLEXLAYOUT__TAB_BUTTON_TEXTBOX="flexlayout__tab_button_textbox",t.FLEXLAYOUT__TAB_BUTTON_TRAILING="flexlayout__tab_button_trailing",t.FLEXLAYOUT__TAB_BUTTON_STAMP="flexlayout__tab_button_stamp",t.FLEXLAYOUT__TAB_FLOATING="flexlayout__tab_floating",t.FLEXLAYOUT__TAB_FLOATING_INNER="flexlayout__tab_floating_inner",t.FLEXLAYOUT__TAB_TOOLBAR="flexlayout__tab_toolbar",t.FLEXLAYOUT__TAB_TOOLBAR_BUTTON="flexlayout__tab_toolbar_button",t.FLEXLAYOUT__TAB_TOOLBAR_ICON="flexlayout__tab_toolbar_icon",t.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_="flexlayout__tab_toolbar_button-",t.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_FLOAT="flexlayout__tab_toolbar_button-float",t.FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER="flexlayout__tab_toolbar_sticky_buttons_container",t.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_CLOSE="flexlayout__tab_toolbar_button-close",t.FLEXLAYOUT__POPUP_MENU_CONTAINER="flexlayout__popup_menu_container",t.FLEXLAYOUT__POPUP_MENU_ITEM="flexlayout__popup_menu_item",t.FLEXLAYOUT__POPUP_MENU="flexlayout__popup_menu"}(r||(r={}));class T{constructor(t,e){this.type=t,this.data=e}}class _{static addNode(t,e,i,n,o){return new T(_.ADD_NODE,{json:t,toNode:e,location:i.getName(),index:n,select:o})}static moveNode(t,e,i,n,o){return new T(_.MOVE_NODE,{fromNode:t,toNode:e,location:i.getName(),index:n,select:o})}static deleteTab(t){return new T(_.DELETE_TAB,{node:t})}static deleteTabset(t){return new T(_.DELETE_TABSET,{node:t})}static renameTab(t,e){return new T(_.RENAME_TAB,{node:t,text:e})}static selectTab(t){return new T(_.SELECT_TAB,{tabNode:t})}static setActiveTabset(t,e){return new T(_.SET_ACTIVE_TABSET,{tabsetNode:t,windowId:e})}static adjustWeights(t,e){return new T(_.ADJUST_WEIGHTS,{nodeId:t,weights:e})}static adjustBorderSplit(t,e){return new T(_.ADJUST_BORDER_SPLIT,{node:t,pos:e})}static maximizeToggle(t,e){return new T(_.MAXIMIZE_TOGGLE,{node:t,windowId:e})}static updateModelAttributes(t){return new T(_.UPDATE_MODEL_ATTRIBUTES,{json:t})}static updateNodeAttributes(t,e){return new T(_.UPDATE_NODE_ATTRIBUTES,{node:t,json:e})}static popoutTab(t){return new T(_.POPOUT_TAB,{node:t})}static popoutTabset(t){return new T(_.POPOUT_TABSET,{node:t})}static closeWindow(t){return new T(_.CLOSE_WINDOW,{windowId:t})}static createWindow(t,e){return new T(_.CREATE_WINDOW,{layout:t,rect:e})}}_.ADD_NODE="FlexLayout_AddNode",_.MOVE_NODE="FlexLayout_MoveNode",_.DELETE_TAB="FlexLayout_DeleteTab",_.DELETE_TABSET="FlexLayout_DeleteTabset",_.RENAME_TAB="FlexLayout_RenameTab",_.SELECT_TAB="FlexLayout_SelectTab",_.SET_ACTIVE_TABSET="FlexLayout_SetActiveTabset",_.ADJUST_WEIGHTS="FlexLayout_AdjustWeights",_.ADJUST_BORDER_SPLIT="FlexLayout_AdjustBorderSplit",_.MAXIMIZE_TOGGLE="FlexLayout_MaximizeToggle",_.UPDATE_MODEL_ATTRIBUTES="FlexLayout_UpdateModelAttributes",_.UPDATE_NODE_ATTRIBUTES="FlexLayout_UpdateNodeAttributes",_.POPOUT_TAB="FlexLayout_PopoutTab",_.POPOUT_TABSET="FlexLayout_PopoutTabset",_.CLOSE_WINDOW="FlexLayout_CloseWindow",_.CREATE_WINDOW="FlexLayout_CreateWindow";class p{constructor(t,e,i,n){this.name=t,this.alias=void 0,this.modelName=e,this.defaultValue=i,this.alwaysWriteJson=n,this.required=!1,this.fixed=!1,this.type="any"}setType(t){return this.type=t,this}setAlias(t){return this.alias=t,this}setDescription(t){this.description=t}setRequired(){return this.required=!0,this}setFixed(){return this.fixed=!0,this}setpairedAttr(t){this.pairedAttr=t}setPairedType(t){this.pairedType=t}}p.NUMBER="number",p.STRING="string",p.BOOLEAN="boolean";class E{constructor(){this.attributes=[],this.nameToAttribute=new Map}addWithAll(t,e,i,n){const o=new p(t,e,i,n);return this.attributes.push(o),this.nameToAttribute.set(t,o),o}addInherited(t,e){return this.addWithAll(t,e,void 0,!1)}add(t,e,i){return this.addWithAll(t,void 0,e,i)}getAttributes(){return this.attributes}getModelName(t){const e=this.nameToAttribute.get(t);if(void 0!==e)return e.modelName}toJson(t,e){for(const i of this.attributes){const n=e[i.name];(i.alwaysWriteJson||n!==i.defaultValue)&&(t[i.name]=n)}}fromJson(t,e){for(const i of this.attributes){let n=t[i.name];void 0===n&&i.alias&&(n=t[i.alias]),e[i.name]=void 0===n?i.defaultValue:n}}update(t,e){for(const i of this.attributes)if(t.hasOwnProperty(i.name)){const n=t[i.name];void 0===n?delete e[i.name]:e[i.name]=n}}setDefaults(t){for(const e of this.attributes)t[e.name]=e.defaultValue}pairAttributes(t,e){for(const i of e.attributes)if(i.modelName&&this.nameToAttribute.has(i.modelName)){const e=this.nameToAttribute.get(i.modelName);e.setpairedAttr(i),i.setpairedAttr(e),e.setPairedType(t)}}toTypescriptInterface(t,e){var i,n;const o=[],s=this.attributes.sort(((t,e)=>t.name.localeCompare(e.name)));o.push("export interface I"+t+"Attributes {");for(let t=0;t<s.length;t++){const a=s[t];let r,l,d=a.type,h=a;void 0!==h.defaultValue?r=h.defaultValue:void 0!==h.modelName&&void 0!==e&&void 0!==e.nameToAttribute.get(h.modelName)&&(l=h.modelName,h=e.nameToAttribute.get(l),r=h.defaultValue,d=h.type);let c=JSON.stringify(r);const u=h.required?"":"?";let g="\t/**\n\t ";a.description?g+=a.description:a.pairedType&&(null===(i=a.pairedAttr)||void 0===i?void 0:i.description)&&(g+=`Value for ${a.pairedType} attribute ${a.pairedAttr.name} if not overridden`,g+="\n\n\t ",g+=null===(n=a.pairedAttr)||void 0===n?void 0:n.description),g+="\n\n\t ",a.fixed?g+=`Fixed value: ${c}`:g+=l?`Default: inherited from Global attribute ${a.modelName} (default ${c})`:`Default: ${c}`,g+="\n\t */",o.push(g),o.push("\t"+a.name+u+": "+d+";\n")}return o.push("}"),o.join("\n")}}class m{constructor(t,e,i,n,o){this.node=t,this.rect=e,this.location=i,this.index=n,this.className=o}}class b{static fromJson(t,e){const i=new b(e);i.borders=t.map((t=>F.fromJson(t,e)));for(const t of i.borders)i.borderMap.set(t.getLocation(),t);return i}constructor(t){this.borders=[],this.borderMap=new Map,this.layoutHorizontal=!0}toJson(){return this.borders.map((t=>t.toJson()))}getLayoutHorizontal(){return this.layoutHorizontal}getBorders(){return this.borders}getBorderMap(){return this.borderMap}forEachNode(t){for(const e of this.borders){t(e,0);for(const i of e.getChildren())i.forEachNode(t,1)}}setPaths(){for(const t of this.borders){const e="/border/"+t.getLocation().getName();t.setPath(e);let i=0;for(const n of t.getChildren())n.setPath(e+"/t"+i),i++}}findDropTargetNode(t,e,i){for(const n of this.borders)if(n.isShowing()){const o=n.canDrop(t,e,i);if(void 0!==o)return o}}}class f{constructor(t){this.model=t,this.attributes={},this.children=[],this.rect=u.empty(),this.listeners=new Map,this.path=""}getId(){let t=this.attributes.id;return void 0!==t||(t=this.model.nextUniqueId(),this.setId(t)),t}getModel(){return this.model}getType(){return this.attributes.type}getParent(){return this.parent}getChildren(){return this.children}getRect(){return this.rect}getPath(){return this.path}getOrientation(){return void 0===this.parent?this.model.isRootOrientationVertical()?c.VERT:c.HORZ:c.flip(this.parent.getOrientation())}setEventListener(t,e){this.listeners.set(t,e)}removeEventListener(t){this.listeners.delete(t)}setId(t){this.attributes.id=t}fireEvent(t,e){this.listeners.has(t)&&this.listeners.get(t)(e)}getAttr(t){let e=this.attributes[t];if(void 0===e){const i=this.getAttributeDefinitions().getModelName(t);void 0!==i&&(e=this.model.getAttribute(i))}return e}forEachNode(t,e){t(this,e),e++;for(const i of this.children)i.forEachNode(t,e)}setPaths(t){let e=0;for(const i of this.children){let n=t;"row"===i.getType()?i.getOrientation()===c.VERT?n+="/c"+e:n+="/r"+e:"tabset"===i.getType()?n+="/ts"+e:"tab"===i.getType()&&(n+="/t"+e),i.path=n,i.setPaths(n),e++}}setParent(t){this.parent=t}setRect(t){this.rect=t}setPath(t){this.path=t}setWeight(t){this.attributes.weight=t}setSelected(t){this.attributes.selected=t}findDropTargetNode(t,e,i,n){let o;if(this.rect.contains(i,n))if(void 0!==this.model.getMaximizedTabset(t))o=this.model.getMaximizedTabset(t).canDrop(e,i,n);else if(o=this.canDrop(e,i,n),void 0===o&&0!==this.children.length)for(const s of this.children)if(o=s.findDropTargetNode(t,e,i,n),void 0!==o)break;return o}canDrop(t,e,i){}canDockInto(t,e){if(null!=e){if(e.location===g.CENTER&&!1===e.node.isEnableDrop())return!1;if(e.location===g.CENTER&&"tabset"===t.getType()&&void 0!==t.getName())return!1;if(e.location!==g.CENTER&&!1===e.node.isEnableDivide())return!1;if(this.model.getOnAllowDrop())return this.model.getOnAllowDrop()(t,e)}return!0}removeChild(t){const e=this.children.indexOf(t);return-1!==e&&this.children.splice(e,1),e}addChild(t,e){return null!=e?this.children.splice(e,0,t):(this.children.push(t),e=this.children.length-1),t.parent=this,e}removeAll(){this.children=[]}styleWithPosition(t){return null==t&&(t={}),this.rect.styleWithPosition(t)}isEnableDivide(){return!0}toAttributeString(){return JSON.stringify(this.attributes,void 0,"\t")}}class O extends f{static fromJson(t,e,i=!0){return new O(e,t,i)}constructor(t,e,i=!0){super(t),this.tabRect=u.empty(),this.extra={},this.moveableElement=null,this.tabStamp=null,this.rendered=!1,this.visible=!1,O.attributeDefinitions.fromJson(e,this.attributes),!0===i&&t.addNode(this)}getName(){return this.getAttr("name")}getHelpText(){return this.getAttr("helpText")}getComponent(){return this.getAttr("component")}getWindowId(){return this.parent instanceof I?this.parent.getWindowId():W.MAIN_WINDOW_ID}getWindow(){const t=this.model.getwindowsMap().get(this.getWindowId());if(t)return t.window}getConfig(){return this.attributes.config}getExtraData(){return this.extra}isPoppedOut(){return this.getWindowId()!==W.MAIN_WINDOW_ID}isSelected(){return this.getParent().getSelectedNode()===this}getIcon(){return this.getAttr("icon")}isEnableClose(){return this.getAttr("enableClose")}getCloseType(){return this.getAttr("closeType")}isEnablePopout(){return this.getAttr("enablePopout")}isEnablePopoutIcon(){return this.getAttr("enablePopoutIcon")}isEnablePopoutOverlay(){return this.getAttr("enablePopoutOverlay")}isEnableDrag(){return this.getAttr("enableDrag")}isEnableRename(){return this.getAttr("enableRename")}isEnableWindowReMount(){return this.getAttr("enableWindowReMount")}getClassName(){return this.getAttr("className")}getContentClassName(){return this.getAttr("contentClassName")}getTabSetClassName(){return this.getAttr("tabsetClassName")}isEnableRenderOnDemand(){return this.getAttr("enableRenderOnDemand")}getMinWidth(){return this.getAttr("minWidth")}getMinHeight(){return this.getAttr("minHeight")}getMaxWidth(){return this.getAttr("maxWidth")}getMaxHeight(){return this.getAttr("maxHeight")}toJson(){const t={};return O.attributeDefinitions.toJson(t,this.attributes),t}saveScrollPosition(){this.moveableElement&&(this.scrollLeft=this.moveableElement.scrollLeft,this.scrollTop=this.moveableElement.scrollTop)}restoreScrollPosition(){this.scrollTop&&requestAnimationFrame((()=>{this.moveableElement&&this.scrollTop&&(this.moveableElement.scrollTop=this.scrollTop,this.moveableElement.scrollLeft=this.scrollLeft)}))}setRect(t){t.equals(this.rect)||(this.fireEvent("resize",{rect:t}),this.rect=t)}setVisible(t){t!==this.visible&&(this.fireEvent("visibility",{visible:t}),this.visible=t)}getScrollTop(){return this.scrollTop}setScrollTop(t){this.scrollTop=t}getScrollLeft(){return this.scrollLeft}setScrollLeft(t){this.scrollLeft=t}isRendered(){return this.rendered}setRendered(t){this.rendered=t}getTabRect(){return this.tabRect}setTabRect(t){this.tabRect=t}getTabStamp(){return this.tabStamp}setTabStamp(t){this.tabStamp=t}getMoveableElement(){return this.moveableElement}setMoveableElement(t){this.moveableElement=t}setRenderedName(t){this.renderedName=t}getNameForOverflowMenu(){const t=this.getAttr("altName");return void 0!==t?t:this.renderedName}setName(t){this.attributes.name=t}delete(){this.parent.remove(this),this.fireEvent("close",{})}updateAttrs(t){O.attributeDefinitions.update(t,this.attributes)}getAttributeDefinitions(){return O.attributeDefinitions}setBorderWidth(t){this.attributes.borderWidth=t}setBorderHeight(t){this.attributes.borderHeight=t}static getAttributeDefinitions(){return O.attributeDefinitions}static createAttributeDefinitions(){const t=new E;return t.add("type",O.TYPE,!0).setType(p.STRING).setFixed(),t.add("id",void 0).setType(p.STRING).setDescription("the unique id of the tab, if left undefined a uuid will be assigned"),t.add("name","[Unnamed Tab]").setType(p.STRING).setDescription("name of tab to be displayed in the tab button"),t.add("altName",void 0).setType(p.STRING).setDescription("if there is no name specifed then this value will be used in the overflow menu"),t.add("helpText",void 0).setType(p.STRING).setDescription("An optional help text for the tab to be displayed upon tab hover."),t.add("component",void 0).setType(p.STRING).setDescription("string identifying which component to run (for factory)"),t.add("config",void 0).setType("any").setDescription("a place to hold json config for the hosted component"),t.add("tabsetClassName",void 0).setType(p.STRING).setDescription("class applied to parent tabset when this is the only tab and it is stretched to fill the tabset"),t.add("enableWindowReMount",!1).setType(p.BOOLEAN).setDescription("if enabled the tab will re-mount when popped out/in"),t.addInherited("enableClose","tabEnableClose").setType(p.BOOLEAN).setDescription("allow user to close tab via close button"),t.addInherited("closeType","tabCloseType").setType("ICloseType").setDescription("see values in ICloseType"),t.addInherited("enableDrag","tabEnableDrag").setType(p.BOOLEAN).setDescription("allow user to drag tab to new location"),t.addInherited("enableRename","tabEnableRename").setType(p.BOOLEAN).setDescription("allow user to rename tabs by double clicking"),t.addInherited("className","tabClassName").setType(p.STRING).setDescription("class applied to tab button"),t.addInherited("contentClassName","tabContentClassName").setType(p.STRING).setDescription("class applied to tab content"),t.addInherited("icon","tabIcon").setType(p.STRING).setDescription("the tab icon"),t.addInherited("enableRenderOnDemand","tabEnableRenderOnDemand").setType(p.BOOLEAN).setDescription("whether to avoid rendering component until tab is visible"),t.addInherited("enablePopout","tabEnablePopout").setType(p.BOOLEAN).setAlias("enableFloat").setDescription("enable popout (in popout capable browser)"),t.addInherited("enablePopoutIcon","tabEnablePopoutIcon").setType(p.BOOLEAN).setDescription("whether to show the popout icon in the tabset header if this tab enables popouts"),t.addInherited("enablePopoutOverlay","tabEnablePopoutOverlay").setType(p.BOOLEAN).setDescription("if this tab will not work correctly in a popout window when the main window is backgrounded (inactive)\n then enabling this option will gray out this tab"),t.addInherited("borderWidth","tabBorderWidth").setType(p.NUMBER).setDescription("width when added to border, -1 will use border size"),t.addInherited("borderHeight","tabBorderHeight").setType(p.NUMBER).setDescription("height when added to border, -1 will use border size"),t.addInherited("minWidth","tabMinWidth").setType(p.NUMBER).setDescription("the min width of this tab"),t.addInherited("minHeight","tabMinHeight").setType(p.NUMBER).setDescription("the min height of this tab"),t.addInherited("maxWidth","tabMaxWidth").setType(p.NUMBER).setDescription("the max width of this tab"),t.addInherited("maxHeight","tabMaxHeight").setType(p.NUMBER).setDescription("the max height of this tab"),t}}function w(){return"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(hover: hover) and (pointer: fine)").matches}function A(t,e,i){let n,o=e.getName(),s=e.getName();void 0===i&&(i=0),void 0===n&&void 0!==e.getIcon()&&(n=0!==i?l.createElement("img",{style:{width:"1em",height:"1em",transform:"rotate("+i+"deg)"},src:e.getIcon(),alt:"leadingContent"}):l.createElement("img",{style:{width:"1em",height:"1em"},src:e.getIcon(),alt:"leadingContent"}));const a={leading:n,content:o,name:s,buttons:[]};return t.customizeTab(e,a),e.setRenderedName(a.name),a}function R(t){let e=!1;return t.nativeEvent instanceof MouseEvent&&(0!==t.nativeEvent.button||t.ctrlKey||t.altKey||t.metaKey||t.shiftKey)&&(e=!0),e}function L(t,e){const i=[...y("iframe",e),...y("webview",e)];for(const e of i)e.style.pointerEvents=t?"auto":"none"}function y(t,e){return[...e.getElementsByTagName(t)]}function v(t){if(t instanceof O)return t.isEnablePopout();if(t instanceof I){for(const e of t.getChildren())if(!1===e.isEnablePopout())return!1;return!0}return!1}function N(t){const e=window.screen.availWidth,i=window.screen.availHeight;return t.x>=0&&t.getRight()<=e&&t.y>=0||t.getBottom()<=i}function D(t,e){const i=t.getAttribute("style");return i!==e.getAttribute("style")&&(i?e.setAttribute("style",i):e.removeAttribute("style"),!0)}function x(t,e){if(void 0!==t&&(t instanceof I||t instanceof F)){const i=t.getSelected();-1!==i&&(e===i&&t.getChildren().length>0?e>=t.getChildren().length&&t.setSelected(t.getChildren().length-1):e<i?t.setSelected(i-1):e>i||t.setSelected(-1))}}function S(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(t=>(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16)))}O.TYPE="tab",O.attributeDefinitions=O.createAttributeDefinitions();class I extends f{static fromJson(t,e,i){const n=new I(e,t);if(null!=t.children)for(const i of t.children){const t=O.fromJson(i,e);n.addChild(t)}return 0===n.children.length&&n.setSelected(-1),t.maximized&&!0===t.maximized&&(i.maximizedTabSet=n),t.active&&!0===t.active&&(i.activeTabSet=n),n}constructor(t,e){super(t),this.tabStripRect=u.empty(),this.contentRect=u.empty(),this.calculatedMinHeight=0,this.calculatedMinWidth=0,this.calculatedMaxHeight=0,this.calculatedMaxWidth=0,I.attributeDefinitions.fromJson(e,this.attributes),t.addNode(this)}getName(){return this.getAttr("name")}isEnableActiveIcon(){return this.getAttr("enableActiveIcon")}getSelected(){const t=this.attributes.selected;return void 0!==t?t:-1}getSelectedNode(){const t=this.getSelected();if(-1!==t)return this.children[t]}getWeight(){return this.getAttr("weight")}getAttrMinWidth(){return this.getAttr("minWidth")}getAttrMinHeight(){return this.getAttr("minHeight")}getMinWidth(){return this.calculatedMinWidth}getMinHeight(){return this.calculatedMinHeight}getMinSize(t){return t===c.HORZ?this.getMinWidth():this.getMinHeight()}getAttrMaxWidth(){return this.getAttr("maxWidth")}getAttrMaxHeight(){return this.getAttr("maxHeight")}getMaxWidth(){return this.calculatedMaxWidth}getMaxHeight(){return this.calculatedMaxHeight}getMaxSize(t){return t===c.HORZ?this.getMaxWidth():this.getMaxHeight()}getConfig(){return this.attributes.config}isMaximized(){return this.model.getMaximizedTabset(this.getWindowId())===this}isActive(){return this.model.getActiveTabset(this.getWindowId())===this}isEnableDeleteWhenEmpty(){return this.getAttr("enableDeleteWhenEmpty")}isEnableDrop(){return this.getAttr("enableDrop")}isEnableTabWrap(){return this.getAttr("enableTabWrap")}isEnableDrag(){return this.getAttr("enableDrag")}isEnableDivide(){return this.getAttr("enableDivide")}isEnableMaximize(){return this.getAttr("enableMaximize")}isEnableClose(){return this.getAttr("enableClose")}isEnableSingleTabStretch(){return this.getAttr("enableSingleTabStretch")}isEnableTabStrip(){return this.getAttr("enableTabStrip")}isAutoSelectTab(){return this.getAttr("autoSelectTab")}getClassNameTabStrip(){return this.getAttr("classNameTabStrip")}getTabLocation(){return this.getAttr("tabLocation")}toJson(){const t={};return I.attributeDefinitions.toJson(t,this.attributes),t.children=this.children.map((t=>t.toJson())),this.isActive()&&(t.active=!0),this.isMaximized()&&(t.maximized=!0),t}calcMinMaxSize(){this.calculatedMinHeight=this.getAttrMinHeight(),this.calculatedMinWidth=this.getAttrMinWidth(),this.calculatedMaxHeight=this.getAttrMaxHeight(),this.calculatedMaxWidth=this.getAttrMaxWidth();for(const t of this.children){const e=t;this.calculatedMinWidth=Math.max(this.calculatedMinWidth,e.getMinWidth()),this.calculatedMinHeight=Math.max(this.calculatedMinHeight,e.getMinHeight()),this.calculatedMaxWidth=Math.min(this.calculatedMaxWidth,e.getMaxWidth()),this.calculatedMaxHeight=Math.min(this.calculatedMaxHeight,e.getMaxHeight())}}canMaximize(){return!!this.isEnableMaximize()&&(this.getModel().getMaximizedTabset(this.getWindowId())===this||this.getParent()!==this.getModel().getRoot(this.getWindowId())||1!==this.getModel().getRoot(this.getWindowId()).getChildren().length)}setContentRect(t){this.contentRect=t}getContentRect(){return this.contentRect}setTabStripRect(t){this.tabStripRect=t}setWeight(t){this.attributes.weight=t}setSelected(t){this.attributes.selected=t}getWindowId(){return this.parent.getWindowId()}canDrop(t,e,i){let n;if(t===this){const t=g.CENTER,e=this.tabStripRect;n=new m(this,e,t,-1,r.FLEXLAYOUT__OUTLINE_RECT)}else{if(this.getWindowId()!==W.MAIN_WINDOW_ID&&!v(t))return;if(this.contentRect.contains(e,i)){let t=g.CENTER;void 0===this.model.getMaximizedTabset(this.parent.getWindowId())&&(t=g.getLocation(this.contentRect,e,i));const o=t.getDockRect(this.rect);n=new m(this,o,t,-1,r.FLEXLAYOUT__OUTLINE_RECT)}else if(null!=this.tabStripRect&&this.tabStripRect.contains(e,i)){let t,o,s;if(0===this.children.length)t=this.tabStripRect.clone(),o=t.y+3,s=t.height-4,t.width=2;else{let a=this.children[0];t=a.getTabRect(),o=t.y,s=t.height;let l=this.tabStripRect.x,d=0;for(let s=0;s<this.children.length;s++){if(a=this.children[s],t=a.getTabRect(),t.y!==o&&(o=t.y,l=this.tabStripRect.x),d=t.x+t.width/2,e>=l&&e<d&&i>t.y&&i<t.getBottom()){const e=g.CENTER,i=new u(t.x-2,t.y,3,t.height);n=new m(this,i,e,s,r.FLEXLAYOUT__OUTLINE_RECT);break}l=d}}if(null==n){const e=g.CENTER,i=new u(t.getRight()-2,o,3,s);n=new m(this,i,e,this.children.length,r.FLEXLAYOUT__OUTLINE_RECT)}}}if(t.canDockInto(t,n))return n}delete(){this.parent.removeChild(this)}remove(t){const e=this.removeChild(t);this.model.tidy(),x(this,e)}drop(t,e,i,n){const o=e;if(this===t)return;let s=t.getParent(),a=0;if(void 0!==s&&(a=s.removeChild(t),s instanceof F&&s.getSelected()===a?s.setSelected(-1):x(s,a)),t instanceof O&&s===this&&a<i&&i>0&&i--,o===g.CENTER){let e=i;if(-1===e&&(e=this.children.length),t instanceof O)this.addChild(t,e),(n||!1!==n&&this.isAutoSelectTab())&&this.setSelected(e);else if(t instanceof M)t.forEachNode(((t,i)=>{t instanceof O&&(this.addChild(t,e),e++)}),0);else{for(let i=0;i<t.getChildren().length;i++){const n=t.getChildren()[i];this.addChild(n,e),e++}-1===this.getSelected()&&this.children.length>0&&this.setSelected(0)}this.model.setActiveTabset(this,this.parent.getWindowId())}else{let i=t;if(t instanceof O){const e=this.model.getOnCreateTabSet();i=new I(this.model,e?e(t):{}),i.addChild(t),s=i}else if(t instanceof M){const n=this.getParent();if(t.getOrientation()===n.getOrientation()&&(e.getOrientation()===n.getOrientation()||e===g.CENTER)){const e=new M(this.model,this.getWindowId(),{});e.addChild(t),i=e}}else i=t;const n=this.parent,a=n.getChildren().indexOf(this);if(n.getOrientation()===o.orientation)i.setWeight(this.getWeight()/2),this.setWeight(this.getWeight()/2),n.addChild(i,a+o.indexPlus);else{const t=new M(this.model,this.getWindowId(),{});t.setWeight(this.getWeight()),t.addChild(this),this.setWeight(50),i.setWeight(50),t.addChild(i,o.indexPlus),n.removeChild(this),n.addChild(t,a)}i instanceof I&&this.model.setActiveTabset(i,this.getWindowId())}this.model.tidy()}updateAttrs(t){I.attributeDefinitions.update(t,this.attributes)}getAttributeDefinitions(){return I.attributeDefinitions}static getAttributeDefinitions(){return I.attributeDefinitions}static createAttributeDefinitions(){const t=new E;return t.add("type",I.TYPE,!0).setType(p.STRING).setFixed(),t.add("id",void 0).setType(p.STRING).setDescription("the unique id of the tab set, if left undefined a uuid will be assigned"),t.add("weight",100).setType(p.NUMBER).setDescription("relative weight for sizing of this tabset in parent row"),t.add("selected",0).setType(p.NUMBER).setDescription("index of selected/visible tab in tabset"),t.add("name",void 0).setType(p.STRING),t.add("config",void 0).setType("any").setDescription("a place to hold json config used in your own code"),t.addInherited("enableDeleteWhenEmpty","tabSetEnableDeleteWhenEmpty").setDescription("whether to delete this tabset when is has no tabs"),t.addInherited("enableDrop","tabSetEnableDrop").setDescription("allow user to drag tabs into this tabset"),t.addInherited("enableDrag","tabSetEnableDrag").setDescription("allow user to drag tabs out this tabset"),t.addInherited("enableDivide","tabSetEnableDivide").setDescription("allow user to drag tabs to region of this tabset, splitting into new tabset"),t.addInherited("enableMaximize","tabSetEnableMaximize").setDescription("allow user to maximize tabset to fill view via maximize button"),t.addInherited("enableClose","tabSetEnableClose").setDescription("allow user to close tabset via a close button"),t.addInherited("enableSingleTabStretch","tabSetEnableSingleTabStretch").setDescription("if the tabset has only a single tab then stretch the single tab to fill area and display in a header style"),t.addInherited("classNameTabStrip","tabSetClassNameTabStrip").setDescription("a class name to apply to the tab strip"),t.addInherited("enableTabStrip","tabSetEnableTabStrip").setDescription("enable tab strip and allow multiple tabs in this tabset"),t.addInherited("minWidth","tabSetMinWidth").setDescription("minimum width (in px) for this tabset"),t.addInherited("minHeight","tabSetMinHeight").setDescription("minimum height (in px) for this tabset"),t.addInherited("maxWidth","tabSetMaxWidth").setDescription("maximum width (in px) for this tabset"),t.addInherited("maxHeight","tabSetMaxHeight").setDescription("maximum height (in px) for this tabset"),t.addInherited("enableTabWrap","tabSetEnableTabWrap").setDescription("show tabs in location top or bottom"),t.addInherited("tabLocation","tabSetTabLocation").setDescription("the location of the tabs either top or bottom"),t.addInherited("autoSelectTab","tabSetAutoSelectTab").setType(p.BOOLEAN).setDescription("whether to select new/moved tabs in tabset"),t.addInherited("enableActiveIcon","tabSetEnableActiveIcon").setType(p.BOOLEAN).setDescription("whether the active icon (*) should be displayed when the tabset is active"),t}}I.TYPE="tabset",I.attributeDefinitions=I.createAttributeDefinitions();class M extends f{static fromJson(t,e,i){const n=new M(e,i.windowId,t);if(null!=t.children)for(const o of t.children)if(o.type===I.TYPE){const t=I.fromJson(o,e,i);n.addChild(t)}else{const t=M.fromJson(o,e,i);n.addChild(t)}return n}constructor(t,e,i){super(t),this.windowId=e,this.minHeight=C,this.minWidth=C,this.maxHeight=U,this.maxWidth=U,M.attributeDefinitions.fromJson(i,this.attributes),this.normalizeWeights(),t.addNode(this)}getWeight(){return this.attributes.weight}toJson(){const t={};M.attributeDefinitions.toJson(t,this.attributes),t.children=[];for(const e of this.children)t.children.push(e.toJson());return t}getWindowId(){return this.windowId}setWindowId(t){this.windowId=t}setWeight(t){this.attributes.weight=t}getSplitterBounds(t){const e=this.getOrientation()===c.HORZ,i=this.getChildren(),n=this.model.getSplitterSize(),o=i[0].getRect(),s=i[i.length-1].getRect();let a=e?[o.x,s.getRight()]:[o.y,s.getBottom()];const r=e?[o.x,s.getRight()]:[o.y,s.getBottom()];for(let o=0;o<t;o++){const t=i[o];a[0]+=e?t.getMinWidth():t.getMinHeight(),r[0]+=e?t.getMaxWidth():t.getMaxHeight(),o>0&&(a[0]+=n,r[0]+=n)}for(let o=i.length-1;o>=t;o--){const t=i[o];a[1]-=(e?t.getMinWidth():t.getMinHeight())+n,r[1]-=(e?t.getMaxWidth():t.getMaxHeight())+n}return a=[Math.max(r[1],a[0]),Math.min(r[0],a[1])],a}getSplitterInitials(t){const e=this.getOrientation()===c.HORZ,i=this.getChildren(),n=this.model.getSplitterSize(),o=[];let s=0;for(let t=0;t<i.length;t++){const n=i[t].getRect(),a=e?n.width:n.height;o.push(a),s+=a}const a=i[t].getRect();return{initialSizes:o,sum:s,startPosition:(e?a.x:a.y)-n}}calculateSplit(t,e,i,n,o){const s=this.getOrientation()===c.HORZ,a=this.getChildren(),r=a[t],l=s?r.getMaxWidth():r.getMaxHeight(),d=[...i];if(e<o){let i=o-e,n=0;d[t]+i>l?(n=d[t]+i-l,d[t]=l):d[t]+=i;for(let e=t-1;e>=0;e--){const t=a[e],n=s?t.getMinWidth():t.getMinHeight();if(d[e]-i>n){d[e]-=i;break}i-=d[e]-n,d[e]=n}for(let e=t+1;e<a.length;e++){const t=a[e],i=s?t.getMaxWidth():t.getMaxHeight();if(d[e]+n<i){d[e]+=n;break}n-=i-d[e],d[e]=i}}else{let i=e-o,n=0;d[t-1]+i>l?(n=d[t-1]+i-l,d[t-1]=l):d[t-1]+=i;for(let e=t;e<a.length;e++){const t=a[e],n=s?t.getMinWidth():t.getMinHeight();if(d[e]-i>n){d[e]-=i;break}i-=d[e]-n,d[e]=n}for(let e=t-1;e>=0;e--){const t=a[e],i=s?t.getMaxWidth():t.getMaxHeight();if(d[e]+n<i){d[e]+=n;break}n-=i-d[e],d[e]=i}}return d.map((t=>100*Math.max(.1,t)/n))}getMinSize(t){return t===c.HORZ?this.getMinWidth():this.getMinHeight()}getMinWidth(){return this.minWidth}getMinHeight(){return this.minHeight}getMaxSize(t){return t===c.HORZ?this.getMaxWidth():this.getMaxHeight()}getMaxWidth(){return this.maxWidth}getMaxHeight(){return this.maxHeight}calcMinMaxSize(){this.minHeight=C,this.minWidth=C,this.maxHeight=U,this.maxWidth=U;let t=!0;for(const e of this.children){const i=e;i.calcMinMaxSize(),this.getOrientation()===c.VERT?(this.minHeight+=i.getMinHeight(),this.maxHeight+=i.getMaxHeight(),t||(this.minHeight+=this.model.getSplitterSize(),this.maxHeight+=this.model.getSplitterSize()),this.minWidth=Math.max(this.minWidth,i.getMinWidth()),this.maxWidth=Math.min(this.maxWidth,i.getMaxWidth())):(this.minWidth+=i.getMinWidth(),this.maxWidth+=i.getMaxWidth(),t||(this.minWidth+=this.model.getSplitterSize(),this.maxWidth+=this.model.getSplitterSize()),this.minHeight=Math.max(this.minHeight,i.getMinHeight()),this.maxHeight=Math.min(this.maxHeight,i.getMaxHeight())),t=!1}}tidy(){let t=0;for(;t<this.children.length;){const e=this.children[t];if(e instanceof M){e.tidy();const i=e.getChildren();if(0===i.length)this.removeChild(e);else if(1===i.length){const n=i[0];if(this.removeChild(e),n instanceof M){let i=0;const o=n.getChildren();for(const t of o)i+=t.getWeight();for(let n=0;n<o.length;n++){const s=o[n];s.setWeight(e.getWeight()*s.getWeight()/i),this.addChild(s,t+n)}}else n.setWeight(e.getWeight()),this.addChild(n,t)}else t++}else e instanceof I&&0===e.getChildren().length&&e.isEnableDeleteWhenEmpty()?(this.removeChild(e),e===this.model.getMaximizedTabset(this.windowId)&&this.model.setMaximizedTabset(void 0,this.windowId)):t++}if(this===this.model.getRoot(this.windowId)&&0===this.children.length){const t=this.model.getOnCreateTabSet();let e=t?t():{};e=Object.assign(Object.assign({},e),{selected:-1});const i=new I(this.model,e);this.model.setActiveTabset(i,this.windowId),this.addChild(i)}}canDrop(t,e,i){const n=i-this.rect.y,o=e-this.rect.x,s=this.rect.width,a=this.rect.height,l=50;let d;if(this.getWindowId()===W.MAIN_WINDOW_ID||v(t)){if(this.model.isEnableEdgeDock()&&void 0===this.parent){if(e<this.rect.x+10&&n>a/2-l&&n<a/2+l){const t=g.LEFT,e=t.getDockRect(this.rect);e.width=e.width/2,d=new m(this,e,t,-1,r.FLEXLAYOUT__OUTLINE_RECT_EDGE)}else if(e>this.rect.getRight()-10&&n>a/2-l&&n<a/2+l){const t=g.RIGHT,e=t.getDockRect(this.rect);e.width=e.width/2,e.x+=e.width,d=new m(this,e,t,-1,r.FLEXLAYOUT__OUTLINE_RECT_EDGE)}else if(i<this.rect.y+10&&o>s/2-l&&o<s/2+l){const t=g.TOP,e=t.getDockRect(this.rect);e.height=e.height/2,d=new m(this,e,t,-1,r.FLEXLAYOUT__OUTLINE_RECT_EDGE)}else if(i>this.rect.getBottom()-10&&o>s/2-l&&o<s/2+l){const t=g.BOTTOM,e=t.getDockRect(this.rect);e.height=e.height/2,e.y+=e.height,d=new m(this,e,t,-1,r.FLEXLAYOUT__OUTLINE_RECT_EDGE)}if(void 0!==d&&!t.canDockInto(t,d))return}return d}}drop(t,e,i){const n=e,o=t.getParent();let s;if(o&&o.removeChild(t),void 0!==o&&o instanceof I&&o.setSelected(0),void 0!==o&&o instanceof F&&o.setSelected(-1),t instanceof I||t instanceof M)s=t,s instanceof M&&s.getOrientation()===this.getOrientation()&&(e.getOrientation()===this.getOrientation()||e===g.CENTER)&&(s=new M(this.model,this.windowId,{}),s.addChild(t));else{const e=this.model.getOnCreateTabSet();s=new I(this.model,e?e(t):{}),s.addChild(t)}let a=this.children.reduce(((t,e)=>t+e.getWeight()),0);0===a&&(a=100),s.setWeight(a/3);const r=!this.model.isRootOrientationVertical();if(n===g.CENTER)-1===i?this.addChild(s,this.children.length):this.addChild(s,i);else if(r&&n===g.LEFT||!r&&n===g.TOP)this.addChild(s,0);else if(r&&n===g.RIGHT||!r&&n===g.BOTTOM)this.addChild(s);else if(r&&n===g.TOP||!r&&n===g.LEFT){const t=new M(this.model,this.windowId,{}),e=new M(this.model,this.windowId,{});e.setWeight(75),s.setWeight(25);for(const t of this.children)e.addChild(t);this.removeAll(),t.addChild(s),t.addChild(e),this.addChild(t)}else if(r&&n===g.BOTTOM||!r&&n===g.RIGHT){const t=new M(this.model,this.windowId,{}),e=new M(this.model,this.windowId,{});e.setWeight(75),s.setWeight(25);for(const t of this.children)e.addChild(t);this.removeAll(),t.addChild(e),t.addChild(s),this.addChild(t)}s instanceof I&&this.model.setActiveTabset(s,this.windowId),this.model.tidy()}isEnableDrop(){return!0}getAttributeDefinitions(){return M.attributeDefinitions}updateAttrs(t){M.attributeDefinitions.update(t,this.attributes)}static getAttributeDefinitions(){return M.attributeDefinitions}normalizeWeights(){let t=0;for(const e of this.children)t+=e.getWeight();0===t&&(t=1);for(const e of this.children){const i=e;i.setWeight(Math.max(.001,100*i.getWeight()/t))}}static createAttributeDefinitions(){const t=new E;return t.add("type",M.TYPE,!0).setType(p.STRING).setFixed(),t.add("id",void 0).setType(p.STRING).setDescription("the unique id of the row, if left undefined a uuid will be assigned"),t.add("weight",100).setType(p.NUMBER).setDescription("relative weight for sizing of this row in parent row"),t}}M.TYPE="row",M.attributeDefinitions=M.createAttributeDefinitions();class B{constructor(t,e){this._windowId=t,this._rect=e,this._toScreenRectFunction=t=>t}visitNodes(t){this.root.forEachNode(t,0)}get windowId(){return this._windowId}get rect(){return this._rect}get layout(){return this._layout}get window(){return this._window}get root(){return this._root}get maximizedTabSet(){return this._maximizedTabSet}get activeTabSet(){return this._activeTabSet}set rect(t){this._rect=t}set layout(t){this._layout=t}set window(t){this._window=t}set root(t){this._root=t}set maximizedTabSet(t){this._maximizedTabSet=t}set activeTabSet(t){this._activeTabSet=t}get toScreenRectFunction(){return this._toScreenRectFunction}set toScreenRectFunction(t){this._toScreenRectFunction=t}toJson(){return this._window&&this._window.screenTop>-1e4&&(this.rect=new u(this._window.screenLeft,this._window.screenTop,this._window.outerWidth,this._window.outerHeight)),{layout:this.root.toJson(),rect:this.rect.toJson()}}static fromJson(t,e,i){const n=e.getwindowsMap().size;let o=t.rect?u.fromJson(t.rect):new u(50+50*n,50+50*n,600,400);o=function(t){t.snap(10);const e=window.screen.availWidth,i=window.screen.availHeight;return(t.x+t.width>e||t.y+t.height>i)&&(t.x=Math.max(0,Math.min(t.x,e-t.width)),t.y=Math.max(0,Math.min(t.y,i-t.height))),t}(o);const s=new B(i,o);return s.root=M.fromJson(t.layout,e,s),s}}const C=0,U=99999;class W{constructor(){this.attributes={},this.idMap=new Map,this.borders=new b(this),this.windows=new Map,this.rootWindow=new B(W.MAIN_WINDOW_ID,u.empty()),this.windows.set(W.MAIN_WINDOW_ID,this.rootWindow),this.changeListeners=[]}doAction(t){var e;let i;switch(t.type){case _.ADD_NODE:{const e=new O(this,t.data.json,!0),n=this.idMap.get(t.data.toNode);(n instanceof I||n instanceof F||n instanceof M)&&(n.drop(e,g.getByName(t.data.location),t.data.index,t.data.select),i=e);break}case _.MOVE_NODE:{const e=this.idMap.get(t.data.fromNode);if(e instanceof O||e instanceof I||e instanceof M){e===this.getMaximizedTabset(e.getWindowId())&&(this.windows.get(e.getWindowId()).maximizedTabSet=void 0);const i=this.idMap.get(t.data.toNode);(i instanceof I||i instanceof F||i instanceof M)&&i.drop(e,g.getByName(t.data.location),t.data.index,t.data.select)}this.removeEmptyWindows();break}case _.DELETE_TAB:{const e=this.idMap.get(t.data.node);e instanceof O&&e.delete(),this.removeEmptyWindows();break}case _.DELETE_TABSET:{const e=this.idMap.get(t.data.node);if(e instanceof I){const t=[...e.getChildren()];for(let e=0;e<t.length;e++){const i=t[e];i.isEnableClose()&&i.delete()}0===e.getChildren().length&&e.delete(),this.tidy()}this.removeEmptyWindows();break}case _.POPOUT_TABSET:{const e=this.idMap.get(t.data.node);if(e instanceof I){const t=e.isMaximized(),i=this.windows.get(e.getWindowId()),n=S(),o=new B(n,i.toScreenRectFunction(e.getRect())),s={type:"row",children:[]},a=M.fromJson(s,this,o);o.root=a,this.windows.set(n,o),a.drop(e,g.CENTER,0),t&&(this.rootWindow.maximizedTabSet=void 0)}this.removeEmptyWindows();break}case _.POPOUT_TAB:{const e=this.idMap.get(t.data.node);if(e instanceof O){const t=S();let i=u.empty();i=e.getParent()instanceof I?e.getParent().getRect():e.getParent().getContentRect();const n=this.windows.get(e.getWindowId()),o=new B(t,n.toScreenRectFunction(i)),s=S(),a={type:"row",children:[{type:"tabset",id:s}]},r=M.fromJson(a,this,o);o.root=r,this.windows.set(t,o),this.idMap.get(s).drop(e,g.CENTER,0,!0)}this.removeEmptyWindows();break}case _.CLOSE_WINDOW:{const i=this.windows.get(t.data.windowId);i&&(null===(e=this.rootWindow.root)||void 0===e||e.drop(null==i?void 0:i.root,g.CENTER,-1),this.rootWindow.visitNodes(((t,e)=>{t instanceof M&&t.setWindowId(W.MAIN_WINDOW_ID)})),this.windows.delete(t.data.windowId));break}case _.CREATE_WINDOW:{const e=S(),n=new B(e,u.fromJson(t.data.rect)),o=M.fromJson(t.data.layout,this,n);n.root=o,this.windows.set(e,n),i=e;break}case _.RENAME_TAB:{const e=this.idMap.get(t.data.node);e instanceof O&&e.setName(t.data.text);break}case _.SELECT_TAB:{const e=this.idMap.get(t.data.tabNode),i=t.data.windowId?t.data.windowId:W.MAIN_WINDOW_ID,n=this.windows.get(i);if(e instanceof O){const t=e.getParent(),i=t.getChildren().indexOf(e);t instanceof F?t.getSelected()===i?t.setSelected(-1):t.setSelected(i):t instanceof I&&(t.getSelected()!==i&&t.setSelected(i),n.activeTabSet=t)}break}case _.SET_ACTIVE_TABSET:{const e=t.data.windowId?t.data.windowId:W.MAIN_WINDOW_ID,i=this.windows.get(e);if(void 0===t.data.tabsetNode)i.activeTabSet=void 0;else{const e=this.idMap.get(t.data.tabsetNode);e instanceof I&&(i.activeTabSet=e)}break}case _.ADJUST_WEIGHTS:{const e=this.idMap.get(t.data.nodeId).getChildren();for(let i=0;i<e.length;i++)e[i].setWeight(t.data.weights[i]);break}case _.ADJUST_BORDER_SPLIT:{const e=this.idMap.get(t.data.node);e instanceof F&&e.setSize(t.data.pos);break}case _.MAXIMIZE_TOGGLE:{const e=t.data.windowId?t.data.windowId:W.MAIN_WINDOW_ID,i=this.windows.get(e),n=this.idMap.get(t.data.node);n instanceof I&&(n===i.maximizedTabSet?i.maximizedTabSet=void 0:(i.maximizedTabSet=n,i.activeTabSet=n));break}case _.UPDATE_MODEL_ATTRIBUTES:this.updateAttrs(t.data.json);break;case _.UPDATE_NODE_ATTRIBUTES:this.idMap.get(t.data.node).updateAttrs(t.data.json)}this.updateIdMap();for(const e of this.changeListeners)e(t);return i}getActiveTabset(t=W.MAIN_WINDOW_ID){const e=this.windows.get(t);return e&&e.activeTabSet&&this.getNodeById(e.activeTabSet.getId())?e.activeTabSet:void 0}getMaximizedTabset(t=W.MAIN_WINDOW_ID){return this.windows.get(t).maximizedTabSet}getRoot(t=W.MAIN_WINDOW_ID){return this.windows.get(t).root}isRootOrientationVertical(){return this.attributes.rootOrientationVertical}isEnableRotateBorderIcons(){return this.attributes.enableRotateBorderIcons}getBorderSet(){return this.borders}getwindowsMap(){return this.windows}visitNodes(t){this.borders.forEachNode(t);for(const[e,i]of this.windows)i.root.forEachNode(t,0)}visitWindowNodes(t,e){this.windows.has(t)&&(t===W.MAIN_WINDOW_ID&&this.borders.forEachNode(e),this.windows.get(t).visitNodes(e))}getNodeById(t){return this.idMap.get(t)}getFirstTabSet(t=this.windows.get(W.MAIN_WINDOW_ID).root){const e=t.getChildren()[0];return e instanceof I?e:this.getFirstTabSet(e)}static fromJson(t){const e=new W;if(W.attributeDefinitions.fromJson(t.global,e.attributes),t.borders&&(e.borders=b.fromJson(t.borders,e)),t.popouts){let i=0,n=100,o=100;for(const s in t.popouts){const a=t.popouts[s],r=B.fromJson(a,e,s);e.windows.set(s,r),N(r.rect)||(r.rect=new u(n+50*i,o+50*i,600,400),i++)}}return e.rootWindow.root=M.fromJson(t.layout,e,e.getwindowsMap().get(W.MAIN_WINDOW_ID)),e.tidy(),e}toJson(){const t={};W.attributeDefinitions.toJson(t,this.attributes),this.visitNodes((t=>{t.fireEvent("save",{})}));const e={};for(const[t,i]of this.windows)t!==W.MAIN_WINDOW_ID&&(e[t]=i.toJson());return{global:t,borders:this.borders.toJson(),layout:this.rootWindow.root.toJson(),popouts:e}}getSplitterSize(){return this.attributes.splitterSize}getSplitterExtra(){return this.attributes.splitterExtra}isEnableEdgeDock(){return this.attributes.enableEdgeDock}isSplitterEnableHandle(){return this.attributes.splitterEnableHandle}setOnAllowDrop(t){this.onAllowDrop=t}setOnCreateTabSet(t){this.onCreateTabSet=t}addChangeListener(t){this.changeListeners.push(t)}removeChangeListener(t){const e=this.changeListeners.findIndex((e=>e===t));-1!==e&&this.changeListeners.splice(e,1)}toString(){return JSON.stringify(this.toJson())}removeEmptyWindows(){const t=new Set;for(const[e]of this.windows)if(e!==W.MAIN_WINDOW_ID){let i=0;this.visitWindowNodes(e,(t=>{t instanceof O&&i++})),0===i&&t.add(e)}for(const e of t)this.windows.delete(e)}setActiveTabset(t,e){const i=this.windows.get(e);i&&(i.activeTabSet=t||void 0)}setMaximizedTabset(t,e){const i=this.windows.get(e);i&&(i.maximizedTabSet=t||void 0)}updateIdMap(){this.idMap.clear(),this.visitNodes((t=>{this.idMap.set(t.getId(),t)}))}addNode(t){const e=t.getId();if(this.idMap.has(e))throw new Error(`Error: each node must have a unique id, duplicate id:${t.getId()}`);this.idMap.set(e,t)}findDropTargetNode(t,e,i,n){let o=this.windows.get(t).root.findDropTargetNode(t,e,i,n);return void 0===o&&t===W.MAIN_WINDOW_ID&&(o=this.borders.findDropTargetNode(e,i,n)),o}tidy(){for(const[t,e]of this.windows)e.root.tidy()}updateAttrs(t){W.attributeDefinitions.update(t,this.attributes)}nextUniqueId(){return"#"+S()}getAttribute(t){return this.attributes[t]}getOnAllowDrop(){return this.onAllowDrop}getOnCreateTabSet(){return this.onCreateTabSet}static toTypescriptInterfaces(){W.attributeDefinitions.pairAttributes("RowNode",M.getAttributeDefinitions()),W.attributeDefinitions.pairAttributes("TabSetNode",I.getAttributeDefinitions()),W.attributeDefinitions.pairAttributes("TabNode",O.getAttributeDefinitions()),W.attributeDefinitions.pairAttributes("BorderNode",F.getAttributeDefinitions());let t=[];t.push(W.attributeDefinitions.toTypescriptInterface("Global",void 0)),t.push(M.getAttributeDefinitions().toTypescriptInterface("Row",W.attributeDefinitions)),t.push(I.getAttributeDefinitions().toTypescriptInterface("TabSet",W.attributeDefinitions)),t.push(O.getAttributeDefinitions().toTypescriptInterface("Tab",W.attributeDefinitions)),t.push(F.getAttributeDefinitions().toTypescriptInterface("Border",W.attributeDefinitions)),console.log(t.join("\n"))}static createAttributeDefinitions(){const t=new E;return t.add("enableEdgeDock",!0).setType(p.BOOLEAN).setDescription("enable docking to the edges of the layout, this will show the edge indicators"),t.add("rootOrientationVertical",!1).setType(p.BOOLEAN).setDescription("the top level 'row' will layout horizontally by default, set this option true to make it layout vertically"),t.add("enableRotateBorderIcons",!0).setType(p.BOOLEAN).setDescription("boolean indicating if tab icons should rotate with the text in the left and right borders"),t.add("splitterSize",8).setType(p.NUMBER).setDescription("width in pixels of all splitters between tabsets/borders"),t.add("splitterExtra",0).setType(p.NUMBER).setDescription("additional width in pixels of the splitter hit test area"),t.add("splitterEnableHandle",!1).setType(p.BOOLEAN).setDescription("enable a small centralized handle on all splitters"),t.add("tabEnableClose",!0).setType(p.BOOLEAN),t.add("tabCloseType",1).setType("ICloseType"),t.add("tabEnablePopout",!1).setType(p.BOOLEAN).setAlias("tabEnableFloat"),t.add("tabEnablePopoutIcon",!0).setType(p.BOOLEAN),t.add("tabEnablePopoutOverlay",!1).setType(p.BOOLEAN),t.add("tabEnableDrag",!0).setType(p.BOOLEAN),t.add("tabEnableRename",!0).setType(p.BOOLEAN),t.add("tabContentClassName",void 0).setType(p.STRING),t.add("tabClassName",void 0).setType(p.STRING),t.add("tabIcon",void 0).setType(p.STRING),t.add("tabEnableRenderOnDemand",!0).setType(p.BOOLEAN),t.add("tabDragSpeed",.3).setType(p.NUMBER),t.add("tabBorderWidth",-1).setType(p.NUMBER),t.add("tabBorderHeight",-1).setType(p.NUMBER),t.add("tabSetEnableDeleteWhenEmpty",!0).setType(p.BOOLEAN),t.add("tabSetEnableDrop",!0).setType(p.BOOLEAN),t.add("tabSetEnableDrag",!0).setType(p.BOOLEAN),t.add("tabSetEnableDivide",!0).setType(p.BOOLEAN),t.add("tabSetEnableMaximize",!0).setType(p.BOOLEAN),t.add("tabSetEnableClose",!1).setType(p.BOOLEAN),t.add("tabSetEnableSingleTabStretch",!1).setType(p.BOOLEAN),t.add("tabSetAutoSelectTab",!0).setType(p.BOOLEAN),t.add("tabSetEnableActiveIcon",!1).setType(p.BOOLEAN),t.add("tabSetClassNameTabStrip",void 0).setType(p.STRING),t.add("tabSetEnableTabStrip",!0).setType(p.BOOLEAN),t.add("tabSetEnableTabWrap",!1).setType(p.BOOLEAN),t.add("tabSetTabLocation","top").setType("ITabLocation"),t.add("tabMinWidth",C).setType(p.NUMBER),t.add("tabMinHeight",C).setType(p.NUMBER),t.add("tabSetMinWidth",C).setType(p.NUMBER),t.add("tabSetMinHeight",C).setType(p.NUMBER),t.add("tabMaxWidth",U).setType(p.NUMBER),t.add("tabMaxHeight",U).setType(p.NUMBER),t.add("tabSetMaxWidth",U).setType(p.NUMBER),t.add("tabSetMaxHeight",U).setType(p.NUMBER),t.add("borderSize",200).setType(p.NUMBER),t.add("borderMinSize",C).setType(p.NUMBER),t.add("borderMaxSize",U).setType(p.NUMBER),t.add("borderEnableDrop",!0).setType(p.BOOLEAN),t.add("borderAutoSelectTabWhenOpen",!0).setType(p.BOOLEAN),t.add("borderAutoSelectTabWhenClosed",!1).setType(p.BOOLEAN),t.add("borderClassName",void 0).setType(p.STRING),t.add("borderEnableAutoHide",!1).setType(p.BOOLEAN),t}}W.MAIN_WINDOW_ID="__main_window_id__",W.attributeDefinitions=W.createAttributeDefinitions();class F extends f{static fromJson(t,e){const i=g.getByName(t.location),n=new F(i,t,e);return t.children&&(n.children=t.children.map((t=>{const i=O.fromJson(t,e);return i.setParent(n),i}))),n}constructor(t,e,i){super(i),this.outerRect=u.empty(),this.contentRect=u.empty(),this.tabHeaderRect=u.empty(),this.location=t,this.attributes.id=`border_${t.getName()}`,F.attributeDefinitions.fromJson(e,this.attributes),i.addNode(this)}getLocation(){return this.location}getClassName(){return this.getAttr("className")}isHorizontal(){return this.location.orientation===c.HORZ}getSize(){const t=this.getAttr("size"),e=this.getSelected();if(-1===e)return t;{const i=this.children[e],n=this.isHorizontal()?i.getAttr("borderWidth"):i.getAttr("borderHeight");return-1===n?t:n}}getMinSize(){const t=this.getSelectedNode();let e=this.getAttr("minSize");if(t){const i=this.isHorizontal()?t.getMinWidth():t.getMinHeight();e=Math.max(e,i)}return e}getMaxSize(){const t=this.getSelectedNode();let e=this.getAttr("maxSize");if(t){const i=this.isHorizontal()?t.getMaxWidth():t.getMaxHeight();e=Math.min(e,i)}return e}getSelected(){return this.attributes.selected}isAutoHide(){return this.getAttr("enableAutoHide")}getSelectedNode(){if(-1!==this.getSelected())return this.children[this.getSelected()]}getOrientation(){return this.location.getOrientation()}getConfig(){return this.attributes.config}isMaximized(){return!1}isShowing(){return this.attributes.show}toJson(){const t={};return F.attributeDefinitions.toJson(t,this.attributes),t.location=this.location.getName(),t.children=this.children.map((t=>t.toJson())),t}isAutoSelectTab(t){return null==t&&(t=-1!==this.getSelected()),t?this.getAttr("autoSelectTabWhenOpen"):this.getAttr("autoSelectTabWhenClosed")}setSelected(t){this.attributes.selected=t}getTabHeaderRect(){return this.tabHeaderRect}setTabHeaderRect(t){this.tabHeaderRect=t}getOuterRect(){return this.outerRect}setOuterRect(t){this.outerRect=t}getRect(){return this.tabHeaderRect}getContentRect(){return this.contentRect}setContentRect(t){this.contentRect=t}isEnableDrop(){return this.getAttr("enableDrop")}setSize(t){const e=this.getSelected();if(-1===e)this.attributes.size=t;else{const i=this.children[e];-1===(this.isHorizontal()?i.getAttr("borderWidth"):i.getAttr("borderHeight"))?this.attributes.size=t:this.isHorizontal()?i.setBorderWidth(t):i.setBorderHeight(t)}}updateAttrs(t){F.attributeDefinitions.update(t,this.attributes)}remove(t){const e=this.removeChild(t);-1!==this.getSelected()&&x(this,e)}canDrop(t,e,i){if(!(t instanceof O))return;let n;const o=g.CENTER;if(this.tabHeaderRect.contains(e,i)){if(this.location.orientation===c.VERT)if(this.children.length>0){let t=this.children[0],i=t.getTabRect();const s=i.y,a=i.height;let l=this.tabHeaderRect.x,d=0;for(let h=0;h<this.children.length;h++){if(t=this.children[h],i=t.getTabRect(),d=i.x+i.width/2,e>=l&&e<d){const t=new u(i.x-2,s,3,a);n=new m(this,t,o,h,r.FLEXLAYOUT__OUTLINE_RECT);break}l=d}if(null==n){const t=new u(i.getRight()-2,s,3,a);n=new m(this,t,o,this.children.length,r.FLEXLAYOUT__OUTLINE_RECT)}}else{const t=new u(this.tabHeaderRect.x+1,this.tabHeaderRect.y+2,3,18);n=new m(this,t,o,0,r.FLEXLAYOUT__OUTLINE_RECT)}else if(this.children.length>0){let t=this.children[0],e=t.getTabRect();const s=e.x,a=e.width;let l=this.tabHeaderRect.y,d=0;for(let h=0;h<this.children.length;h++){if(t=this.children[h],e=t.getTabRect(),d=e.y+e.height/2,i>=l&&i<d){const t=new u(s,e.y-2,a,3);n=new m(this,t,o,h,r.FLEXLAYOUT__OUTLINE_RECT);break}l=d}if(null==n){const t=new u(s,e.getBottom()-2,a,3);n=new m(this,t,o,this.children.length,r.FLEXLAYOUT__OUTLINE_RECT)}}else{const t=new u(this.tabHeaderRect.x+2,this.tabHeaderRect.y+1,18,3);n=new m(this,t,o,0,r.FLEXLAYOUT__OUTLINE_RECT)}if(!t.canDockInto(t,n))return}else if(-1!==this.getSelected()&&this.outerRect.contains(e,i)){const e=this.outerRect;if(n=new m(this,e,o,-1,r.FLEXLAYOUT__OUTLINE_RECT),!t.canDockInto(t,n))return}return n}drop(t,e,i,n){let o=0;const s=t.getParent();void 0!==s&&(o=s.removeChild(t),s!==this&&s instanceof F&&s.getSelected()===o?s.setSelected(-1):x(s,o)),t instanceof O&&s===this&&o<i&&i>0&&i--;let a=i;-1===a&&(a=this.children.length),t instanceof O&&this.addChild(t,a),(n||!1!==n&&this.isAutoSelectTab())&&this.setSelected(a),this.model.tidy()}getSplitterBounds(t,e=!1){const i=[0,0],n=e?this.getMinSize():0,o=e?this.getMaxSize():99999,s=this.model.getRoot(W.MAIN_WINDOW_ID),a=s.getRect(),r=this.model.getSplitterSize();if(this.location===g.TOP){i[0]=this.tabHeaderRect.getBottom()+n;const t=this.tabHeaderRect.getBottom()+o;i[1]=Math.max(i[0],a.getBottom()-s.getMinHeight()-r),i[1]=Math.min(i[1],t)}else if(this.location===g.LEFT){i[0]=this.tabHeaderRect.getRight()+n;const t=this.tabHeaderRect.getRight()+o;i[1]=Math.max(i[0],a.getRight()-s.getMinWidth()-r),i[1]=Math.min(i[1],t)}else if(this.location===g.BOTTOM){i[1]=this.tabHeaderRect.y-n-r;const t=this.tabHeaderRect.y-o-r;i[0]=Math.min(i[1],a.y+s.getMinHeight()),i[0]=Math.max(i[0],t)}else if(this.location===g.RIGHT){i[1]=this.tabHeaderRect.x-n-r;const t=this.tabHeaderRect.x-o-r;i[0]=Math.min(i[1],a.x+s.getMinWidth()),i[0]=Math.max(i[0],t)}return i}calculateSplit(t,e){const i=this.getSplitterBounds(e);return this.location===g.BOTTOM||this.location===g.RIGHT?Math.max(0,i[1]-e):Math.max(0,e-i[0])}getAttributeDefinitions(){return F.attributeDefinitions}static getAttributeDefinitions(){return F.attributeDefinitions}static createAttributeDefinitions(){const t=new E;return t.add("type",F.TYPE,!0).setType(p.STRING).setFixed(),t.add("selected",-1).setType(p.NUMBER).setDescription("index of selected/visible tab in border; -1 means no tab selected"),t.add("show",!0).setType(p.BOOLEAN).setDescription("show/hide this border"),t.add("config",void 0).setType("any").setDescription("a place to hold json config used in your own code"),t.addInherited("enableDrop","borderEnableDrop").setType(p.BOOLEAN).setDescription("whether tabs can be dropped into this border"),t.addInherited("className","borderClassName").setType(p.STRING).setDescription("class applied to tab button"),t.addInherited("autoSelectTabWhenOpen","borderAutoSelectTabWhenOpen").setType(p.BOOLEAN).setDescription("whether to select new/moved tabs in border when the border is already open"),t.addInherited("autoSelectTabWhenClosed","borderAutoSelectTabWhenClosed").setType(p.BOOLEAN).setDescription("whether to select new/moved tabs in border when the border is currently closed"),t.addInherited("size","borderSize").setType(p.NUMBER).setDescription("size of the tab area when selected"),t.addInherited("minSize","borderMinSize").setType(p.NUMBER).setDescription("the minimum size of the tab area"),t.addInherited("maxSize","borderMaxSize").setType(p.NUMBER).setDescription("the maximum size of the tab area"),t.addInherited("enableAutoHide","borderEnableAutoHide").setType(p.BOOLEAN).setDescription("hide border if it has zero tabs"),t}}F.TYPE="border",F.attributeDefinitions=F.createAttributeDefinitions();const Y=t=>{const{layout:e,node:i,index:n,horizontal:o}=t,[s,a]=l.useState(!1),d=l.useRef(null),h=l.useRef(null),g=l.useRef([]),T=l.useRef(void 0),p=l.useRef(void 0),E=l.useRef(0),m=l.useRef(0),b=l.useRef({initialSizes:[],sum:0,startPosition:0}),f=i.getModel().getSplitterSize();let O=i.getModel().getSplitterExtra();w()||(O=Math.max(30,O+f)-f),l.useEffect((()=>{var t,e;return null===(t=d.current)||void 0===t||t.addEventListener("touchstart",A,{passive:!1}),null===(e=h.current)||void 0===e||e.addEventListener("touchstart",A,{passive:!1}),()=>{var t,e;null===(t=d.current)||void 0===t||t.removeEventListener("touchstart",A),null===(e=h.current)||void 0===e||e.removeEventListener("touchstart",A)}}),[]);const A=t=>{t.preventDefault(),t.stopImmediatePropagation()},R=t=>{var s;t.stopPropagation(),i instanceof M&&(b.current=i.getSplitterInitials(n)),L(!1,e.getCurrentDocument()),function(t,e,i,n,o){e.preventDefault();const s=t=>{t.preventDefault(),i(t.clientX,t.clientY)},a=t=>{t.preventDefault(),o()},r=()=>{t.removeEventListener("pointermove",s),t.removeEventListener("pointerup",r),t.removeEventListener("pointercancel",a),n()};t.addEventListener("pointermove",s),t.addEventListener("pointerup",r),t.addEventListener("pointercancel",a)}(t.currentTarget.ownerDocument,t,v,N,y),g.current=i.getSplitterBounds(n,!0);const l=e.getRootDiv();T.current=e.getCurrentDocument().createElement("div"),T.current.style.flexDirection=o?"row":"column",T.current.className=e.getClassName(r.FLEXLAYOUT__SPLITTER_DRAG),T.current.style.cursor=i.getOrientation()===c.VERT?"ns-resize":"ew-resize",i.getModel().isSplitterEnableHandle()&&(p.current=e.getCurrentDocument().createElement("div"),p.current.className=S(r.FLEXLAYOUT__SPLITTER_HANDLE)+" "+S(o?r.FLEXLAYOUT__SPLITTER_HANDLE_HORZ:r.FLEXLAYOUT__SPLITTER_HANDLE_VERT),T.current.appendChild(p.current));const h=null===(s=d.current)||void 0===s?void 0:s.getBoundingClientRect(),_=new u(h.x-e.getDomRect().x,h.y-e.getDomRect().y,h.width,h.height);E.current=t.clientX-h.x,m.current=t.clientY-h.y,_.positionElement(T.current),l&&l.appendChild(T.current),a(!0)},y=()=>{const t=e.getRootDiv();t&&T.current&&t.removeChild(T.current),T.current=void 0,a(!1)},v=(t,n)=>{if(T.current){const o=e.getDomRect();if(!o)return;i.getOrientation()===c.VERT?T.current.style.top=x(n-o.y-m.current)+"px":T.current.style.left=x(t-o.x-E.current)+"px",e.isRealtimeResize()&&D(!0)}},N=()=>{if(T.current){D(!1);const t=e.getRootDiv();t&&T.current&&t.removeChild(T.current),T.current=void 0}L(!0,e.getCurrentDocument()),a(!1)},D=t=>{(()=>{if(T.current){let t=0;if(t=i.getOrientation()===c.VERT?T.current.offsetTop:T.current.offsetLeft,i instanceof F){const n=i.calculateSplit(i,t);e.doAction(_.adjustBorderSplit(i.getId(),n))}else{const o=b.current,s=i.calculateSplit(n,t,o.initialSizes,o.sum,o.startPosition);e.doAction(_.adjustWeights(i.getId(),s))}}})()},x=t=>{const e=g.current;let i=t;return t<e[0]&&(i=e[0]),t>e[1]&&(i=e[1]),i},S=e.getClassName,I={cursor:o?"ew-resize":"ns-resize",flexDirection:o?"column":"row"};let B,C=S(r.FLEXLAYOUT__SPLITTER)+" "+S(r.FLEXLAYOUT__SPLITTER_+i.getOrientation().getName());if(i instanceof F?C+=" "+S(r.FLEXLAYOUT__SPLITTER_BORDER):void 0!==i.getModel().getMaximizedTabset(e.getWindowId())&&(I.display="none"),o?(I.width=f+"px",I.minWidth=f+"px"):(I.height=f+"px",I.minHeight=f+"px"),!s&&i.getModel().isSplitterEnableHandle()&&(B=l.createElement("div",{className:S(r.FLEXLAYOUT__SPLITTER_HANDLE)+" "+S(o?r.FLEXLAYOUT__SPLITTER_HANDLE_HORZ:r.FLEXLAYOUT__SPLITTER_HANDLE_VERT)})),0===O)return l.createElement("div",{className:C,style:I,ref:d,"data-layout-path":i.getPath()+"/s"+(n-1),onPointerDown:R},B);{const t={};i.getOrientation()===c.HORZ?(t.height="100%",t.width=f+O+"px",t.cursor="ew-resize"):(t.height=f+O+"px",t.width="100%",t.cursor="ns-resize");const e=S(r.FLEXLAYOUT__SPLITTER_EXTRA);return l.createElement("div",{className:C,style:I,ref:d,"data-layout-path":i.getPath()+"/s"+(n-1),onPointerDown:R},l.createElement("div",{style:t,ref:h,className:e,onPointerDown:R}))}};function P(t){const{layout:e,border:i,show:n}=t,o=l.useRef(null);l.useLayoutEffect((()=>{const t=e.getBoundingClientRect(o.current),n=u.getContentRect(o.current).relativeTo(e.getDomRect());t.width>0&&(i.setOuterRect(t),i.getContentRect().equals(n)||(i.setContentRect(n),e.redrawInternal("border content rect")))}));let s=!0;const a={};i.getOrientation()===c.HORZ?(a.width=i.getSize(),a.minWidth=i.getMinSize(),a.maxWidth=i.getMaxSize()):(a.height=i.getSize(),a.minHeight=i.getMinSize(),a.maxHeight=i.getMaxSize(),s=!1),a.display=n?"flex":"none";const d=e.getClassName(r.FLEXLAYOUT__BORDER_TAB_CONTENTS);return i.getLocation()===g.LEFT||i.getLocation()===g.TOP?l.createElement(l.Fragment,null,l.createElement("div",{ref:o,style:a,className:d}),n&&l.createElement(Y,{layout:e,node:i,index:0,horizontal:s})):l.createElement(l.Fragment,null,n&&l.createElement(Y,{layout:e,node:i,index:0,horizontal:s}),l.createElement("div",{ref:o,style:a,className:d}))}var H;!function(t){t[t.Visible=1]="Visible",t[t.Always=2]="Always",t[t.Selected=3]="Selected"}(H||(H={}));const X=t=>{const{layout:e,node:i,selected:n,border:o,icons:s,path:d}=t,h=l.useRef(null),c=l.useRef(null),u=()=>{e.doAction(_.selectTab(i.getId()))},g=t=>{(()=>{const t=i.getCloseType();return!!(n||t===H.Always||t===H.Visible&&window.matchMedia&&window.matchMedia("(hover: hover) and (pointer: fine)").matches)})()?e.doAction(_.deleteTab(i.getId())):u()},T=t=>{t.stopPropagation()};l.useLayoutEffect((()=>{i.setTabRect(e.getBoundingClientRect(h.current)),e.getEditingTab()===i&&c.current.select()}));const p=e.getClassName;let E=p(r.FLEXLAYOUT__BORDER_BUTTON)+" "+p(r.FLEXLAYOUT__BORDER_BUTTON_+o);E+=n?" "+p(r.FLEXLAYOUT__BORDER_BUTTON__SELECTED):" "+p(r.FLEXLAYOUT__BORDER_BUTTON__UNSELECTED),void 0!==i.getClassName()&&(E+=" "+i.getClassName());let m=0;!1===i.getModel().isEnableRotateBorderIcons()&&("left"===o?m=90:"right"===o&&(m=-90));const b=A(e,i,m);let f=b.content?l.createElement("div",{className:p(r.FLEXLAYOUT__BORDER_BUTTON_CONTENT)},b.content):null;const O=b.leading?l.createElement("div",{className:p(r.FLEXLAYOUT__BORDER_BUTTON_LEADING)},b.leading):null;if(e.getEditingTab()===i&&(f=l.createElement("input",{ref:c,className:p(r.FLEXLAYOUT__TAB_BUTTON_TEXTBOX),"data-layout-path":d+"/textbox",type:"text",autoFocus:!0,defaultValue:i.getName(),onKeyDown:t=>{"Escape"===t.code?e.setEditingTab(void 0):"Enter"===t.code&&(e.setEditingTab(void 0),e.doAction(_.renameTab(i.getId(),t.target.value)))},onPointerDown:t=>{t.stopPropagation()}})),i.isEnableClose()){const t=e.i18nName(a.Close_Tab);b.buttons.push(l.createElement("div",{key:"close","data-layout-path":d+"/button/close",title:t,className:p(r.FLEXLAYOUT__BORDER_BUTTON_TRAILING),onPointerDown:T,onClick:g},"function"==typeof s.close?s.close(i):s.close))}return l.createElement("div",{ref:h,"data-layout-path":d,className:E,onClick:u,onAuxClick:t=>{R(t)&&e.auxMouseClick(i,t)},onContextMenu:t=>{e.showContextMenu(i,t)},title:i.getHelpText(),draggable:!0,onDragStart:t=>{t.stopPropagation(),e.setDragNode(t.nativeEvent,i)},onDragEnd:t=>{t.stopPropagation(),e.clearDragMain()}},O,f,b.buttons)},z=t=>{const{layout:e,node:i}=t,n=e.getClassName;let o=n(r.FLEXLAYOUT__TAB_BUTTON_STAMP);const s=A(e,i);let a=s.content?l.createElement("div",{className:n(r.FLEXLAYOUT__TAB_BUTTON_CONTENT)},s.content):i.getNameForOverflowMenu();const d=s.leading?l.createElement("div",{className:n(r.FLEXLAYOUT__TAB_BUTTON_LEADING)},s.leading):null;return l.createElement("div",{className:o,title:i.getHelpText()},d,a)};function k(t,e,i,n){var o;const s=n.getRootDiv(),a=n.getClassName,d=t.ownerDocument,h=t.getBoundingClientRect(),c=null!==(o=null==s?void 0:s.getBoundingClientRect())&&void 0!==o?o:new DOMRect(0,0,100,100),u=d.createElement("div");u.className=a(r.FLEXLAYOUT__POPUP_MENU_CONTAINER),h.left<c.left+c.width/2?u.style.left=h.left-c.left+"px":u.style.right=c.right-h.right+"px",h.top<c.top+c.height/2?u.style.top=h.top-c.top+"px":u.style.bottom=c.bottom-h.bottom+"px",n.showOverlay(!0),s&&s.appendChild(u);const g=()=>{n.hideControlInPortal(),n.showOverlay(!1),s&&s.removeChild(u),u.removeEventListener("pointerdown",T),d.removeEventListener("pointerdown",_)},T=t=>{t.stopPropagation()},_=t=>{g()};u.addEventListener("pointerdown",T),d.addEventListener("pointerdown",_),n.showControlInPortal(l.createElement(G,{currentDocument:d,onSelect:i,onHide:g,items:e,classNameMapper:a,layout:n}),u)}const G=t=>{const{items:e,onHide:i,onSelect:n,classNameMapper:o,layout:s}=t,a=t=>{s.clearDragMain()},d=e.map(((t,e)=>l.createElement("div",{key:t.index,className:o(r.FLEXLAYOUT__POPUP_MENU_ITEM),"data-layout-path":"/popup-menu/tb"+e,onClick:e=>((t,e)=>{n(t),i(),e.stopPropagation()})(t,e),draggable:!0,onDragStart:e=>{return n=e,o=t.node,n.stopPropagation(),s.setDragNode(n.nativeEvent,o),void setTimeout((()=>{i()}),0);var n,o},onDragEnd:a,title:t.node.getHelpText()},l.createElement(z,{node:t.node,layout:s}))));return l.createElement("div",{className:o(r.FLEXLAYOUT__POPUP_MENU),"data-layout-path":"/popup-menu"},d)},V=(t,e,i,n)=>{const o=l.useRef(!0),s=l.useRef(!1),a=l.useRef(u.empty()),r=l.useRef(null),[d,h]=l.useState(0),g=l.useRef(!1),[T,_]=l.useState([]),p=l.useRef(0);l.useLayoutEffect((()=>{g.current=!1}),[t.getSelectedNode(),t.getRect().width,t.getRect().height]),l.useLayoutEffect((()=>{const e=t instanceof I?t.getRect():t.getTabHeaderRect();e.width>0&&e.height>0&&w()}));const E=i.current;l.useEffect((()=>{if(E)return E.addEventListener("wheel",m,{passive:!1}),()=>{E.removeEventListener("wheel",m)}}),[E]);const m=t=>{t.preventDefault()},b=t=>e===c.HORZ?t.x:t.y,f=t=>e===c.HORZ?t.getRight():t.getBottom(),O=t=>e===c.HORZ?t.width:t.height,w=()=>{!0===o.current&&(s.current=!1);const e=t instanceof I?t.getRect():t.getTabHeaderRect();let r=t.getChildren()[t.getChildren().length-1];const l=null===n.current?0:O(n.current.getBoundingClientRect());if(!0===o.current||0===p.current&&0!==T.length||e.width!==a.current.width||e.height!==a.current.height){p.current=T.length,a.current=e;const n=!(t instanceof I)||!0===t.isEnableTabStrip();let c=f(e)-l;if(null!==i.current&&(c-=O(i.current.getBoundingClientRect())),n&&t.getChildren().length>0){if(0===T.length&&0===d&&f(r.getTabRect())+2<c)return;let i=0;const n=t.getSelectedNode();if(n&&!g.current){const t=n.getTabRect(),o=b(t)-2,s=f(t)+2;O(t)+4>=c-b(e)?i=b(e)-o:(s>c||o<b(e))&&(o<b(e)&&(i=b(e)-o),s+i>c&&(i=c-s))}const a=Math.max(0,c-(f(r.getTabRect())+2+i)),l=Math.min(0,d+i+a),u=l-d,p=[];for(let i=0;i<t.getChildren().length;i++){const n=t.getChildren()[i];(b(n.getTabRect())+u<b(e)||f(n.getTabRect())+u>c)&&p.push({node:n,index:i})}s.current=p.length>0,o.current=!1,_(p),h(l)}}else o.current=!0};return{selfRef:r,position:d,userControlledLeft:g,hiddenTabs:T,onMouseWheel:t=>{let e=0;e=Math.abs(t.deltaX)>Math.abs(t.deltaY)?-t.deltaX:-t.deltaY,1===t.deltaMode&&(e*=40),h(d+e),g.current=!0,t.stopPropagation()},tabsTruncated:s.current}},J=t=>{const{border:e,layout:i,size:n}=t,o=l.useRef(null),s=l.useRef(null),d=l.useRef(null),h=i.getIcons();l.useLayoutEffect((()=>{e.setTabHeaderRect(u.getBoundingClientRect(T.current).relativeTo(i.getDomRect()))}));const{selfRef:T,position:p,userControlledLeft:E,hiddenTabs:m,onMouseWheel:b,tabsTruncated:f}=V(e,c.flip(e.getOrientation()),o,d),O=t=>{R(t)&&i.auxMouseClick(e,t)},w=t=>{t.stopPropagation()},A=t=>{const n=i.getShowOverflowMenu();void 0!==n?n(e,t,m,L):k(s.current,m,L,i),t.stopPropagation()},L=t=>{i.doAction(_.selectTab(t.node.getId())),E.current=!1},y=t=>{const n=e.getChildren()[e.getSelected()];void 0!==n&&i.doAction(_.popoutTab(n.getId())),t.stopPropagation()},v=i.getClassName,N=[],D=t=>{let n=e.getSelected()===t,o=e.getChildren()[t];N.push(l.createElement(X,{layout:i,border:e.getLocation().getName(),node:o,path:e.getPath()+"/tb"+t,key:o.getId(),selected:n,icons:h})),t<e.getChildren().length-1&&N.push(l.createElement("div",{key:"divider"+t,className:v(r.FLEXLAYOUT__BORDER_TAB_DIVIDER)}))};for(let t=0;t<e.getChildren().length;t++)D(t);let x=v(r.FLEXLAYOUT__BORDER)+" "+v(r.FLEXLAYOUT__BORDER_+e.getLocation().getName());void 0!==e.getClassName()&&(x+=" "+e.getClassName());let S=[],I=[];const M={buttons:S,stickyButtons:I,overflowPosition:void 0};if(i.customizeTabSet(e,M),S=M.buttons,void 0===M.overflowPosition&&(M.overflowPosition=I.length),I.length>0&&(f?S=[...I,...S]:N.push(l.createElement("div",{ref:d,key:"sticky_buttons_container",onPointerDown:w,onDragStart:t=>{t.preventDefault()},className:v(r.FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER)},I))),m.length>0){const t=i.i18nName(a.Overflow_Menu_Tooltip);let n;n="function"==typeof h.more?h.more(e,m):l.createElement(l.Fragment,null,h.more,l.createElement("div",{className:v(r.FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT)},m.length)),S.splice(Math.min(M.overflowPosition,S.length),0,l.createElement("button",{key:"overflowbutton",ref:s,className:v(r.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON)+" "+v(r.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW)+" "+v(r.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW_+e.getLocation().getName()),title:t,onClick:A,onPointerDown:w},n))}const B=e.getSelected();if(-1!==B){const t=e.getChildren()[B];if(void 0!==t&&i.isSupportsPopout()&&t.isEnablePopout()){const e=i.i18nName(a.Popout_Tab);S.push(l.createElement("button",{key:"popout",title:e,className:v(r.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON)+" "+v(r.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_FLOAT),onClick:y,onPointerDown:w},"function"==typeof h.popout?h.popout(t):h.popout))}}const C=l.createElement("div",{key:"toolbar",ref:o,className:v(r.FLEXLAYOUT__BORDER_TOOLBAR)+" "+v(r.FLEXLAYOUT__BORDER_TOOLBAR_+e.getLocation().getName())},S);let U={},W={};const F=n-1;return e.getLocation()===g.LEFT?(U={right:"100%",top:p},W={width:F}):e.getLocation()===g.RIGHT?(U={left:"100%",top:p},W={width:F}):(U={left:p},W={height:F}),l.createElement("div",{ref:T,style:{display:"flex",flexDirection:e.getOrientation()===c.VERT?"row":"column"},className:x,"data-layout-path":e.getPath(),onClick:O,onAuxClick:O,onContextMenu:t=>{i.showContextMenu(e,t)},onWheel:b},l.createElement("div",{style:W,className:v(r.FLEXLAYOUT__BORDER_INNER)+" "+v(r.FLEXLAYOUT__BORDER_INNER_+e.getLocation().getName())},l.createElement("div",{style:U,className:v(r.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER)+" "+v(r.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER_+e.getLocation().getName())},N)),C)},Z=t=>{const{layout:e,node:i}=t,n=l.useRef(null);l.useEffect((()=>{i.setTabStamp(n.current)}),[i,n.current]);let o=(0,e.getClassName)(r.FLEXLAYOUT__DRAG_RECT);return l.createElement("div",{ref:n,className:o},l.createElement(z,{key:i.getId(),layout:e,node:i}))};class j extends l.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(t){return{hasError:!0}}componentDidCatch(t,e){console.debug(t),console.debug(e)}render(){return this.state.hasError?l.createElement("div",{className:r.FLEXLAYOUT__ERROR_BOUNDARY_CONTAINER},l.createElement("div",{className:r.FLEXLAYOUT__ERROR_BOUNDARY_CONTENT},this.props.message)):this.props.children}}const q=t=>{const{title:e,layout:i,layoutWindow:n,url:o,onCloseWindow:s,onSetWindow:a,children:h}=t,c=l.useRef(null),[u,g]=l.useState(void 0),T=new Map;return l.useLayoutEffect((()=>{if(!c.current){const t=n.windowId,i=n.rect;c.current=window.open(o,t,`left=${i.x},top=${i.y},width=${i.width},height=${i.height}`),c.current?(n.window=c.current,a(n,c.current),window.addEventListener("beforeunload",(()=>{if(c.current){const t=c.current;c.current=null,t.close()}})),c.current.addEventListener("load",(()=>{if(c.current){c.current.focus(),c.current.resizeTo(i.width,i.height),c.current.moveTo(i.x,i.y);const t=c.current.document;t.title=e;const o=t.createElement("div");o.className=r.FLEXLAYOUT__FLOATING_WINDOW_CONTENT,t.body.appendChild(o),function(t,e){const i=[],n=document.querySelectorAll('style, link[rel="stylesheet"]');for(const o of n)$(t,o,e,i);return Promise.all(i)}(t,T).then((()=>{g(o)}));const a=new MutationObserver((e=>function(t,e,i){for(const n of t)if("childList"===n.type){for(const t of n.addedNodes)(t instanceof HTMLLinkElement||t instanceof HTMLStyleElement)&&$(e,t,i);for(const t of n.removedNodes)if(t instanceof HTMLLinkElement||t instanceof HTMLStyleElement){const n=i.get(t);n&&e.head.removeChild(n)}}}(e,t,T)));a.observe(document.head,{childList:!0}),c.current.addEventListener("beforeunload",(()=>{c.current&&(s(n),c.current=null,a.disconnect())}))}}))):(console.warn(`Unable to open window ${o}`),s(n))}return()=>{var t;i.getModel().getwindowsMap().has(n.windowId)||(null===(t=c.current)||void 0===t||t.close(),c.current=null)}}),[]),void 0!==u?(0,d.createPortal)(h,u):null};function $(t,e,i,n){if(e instanceof HTMLLinkElement){const o=e.cloneNode(!0);t.head.appendChild(o),i.set(e,o),n&&n.push(new Promise((t=>{o.onload=()=>t(!0)})))}else if(e instanceof HTMLStyleElement)try{const n=e.cloneNode(!0);t.head.appendChild(n),i.set(e,n)}catch(t){}}const K={width:"1em",height:"1em",display:"flex",alignItems:"center"},Q=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",style:K,viewBox:"0 0 24 24"},l.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}),l.createElement("path",{stroke:"var(--color-icon)",fill:"var(--color-icon)",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"})),tt=t=>{const{layout:e,show:i}=t;return l.createElement("div",{className:e.getClassName(r.FLEXLAYOUT__LAYOUT_OVERLAY),style:{display:i?"flex":"none"}})},et=t=>{const{layout:e,node:i,selected:n,path:o}=t,s=l.useRef(null),d=l.useRef(null),h=e.getIcons();l.useLayoutEffect((()=>{i.setTabRect(e.getBoundingClientRect(s.current)),e.getEditingTab()===i&&d.current.select()}));const c=()=>{e.doAction(_.selectTab(i.getId()))},u=t=>{t.target!==d.current&&(e.getCurrentDocument().body.removeEventListener("pointerdown",u),e.setEditingTab(void 0))},g=t=>{(()=>{const t=i.getCloseType();return!!(n||t===H.Always||t===H.Visible&&window.matchMedia&&window.matchMedia("(hover: hover) and (pointer: fine)").matches)})()?e.doAction(_.deleteTab(i.getId())):c()},T=t=>{t.stopPropagation()},p=e.getClassName,E=i.getParent(),m=E.isEnableSingleTabStretch()&&1===E.getChildren().length;let b=m?r.FLEXLAYOUT__TAB_BUTTON_STRETCH:r.FLEXLAYOUT__TAB_BUTTON,f=p(b);f+=" "+p(b+"_"+E.getTabLocation()),m||(f+=n?" "+p(b+"--selected"):" "+p(b+"--unselected")),void 0!==i.getClassName()&&(f+=" "+i.getClassName());const O=A(e,i);let w=O.content?l.createElement("div",{className:p(r.FLEXLAYOUT__TAB_BUTTON_CONTENT)},O.content):null;const L=O.leading?l.createElement("div",{className:p(r.FLEXLAYOUT__TAB_BUTTON_LEADING)},O.leading):null;if(e.getEditingTab()===i&&(w=l.createElement("input",{ref:d,className:p(r.FLEXLAYOUT__TAB_BUTTON_TEXTBOX),"data-layout-path":o+"/textbox",type:"text",autoFocus:!0,defaultValue:i.getName(),onKeyDown:t=>{"Escape"===t.code?e.setEditingTab(void 0):"Enter"===t.code&&(e.setEditingTab(void 0),e.doAction(_.renameTab(i.getId(),t.target.value)))},onPointerDown:t=>{t.stopPropagation()}})),i.isEnableClose()&&!m){const t=e.i18nName(a.Close_Tab);O.buttons.push(l.createElement("div",{key:"close","data-layout-path":o+"/button/close",title:t,className:p(r.FLEXLAYOUT__TAB_BUTTON_TRAILING),onPointerDown:T,onClick:g},"function"==typeof h.close?h.close(i):h.close))}return l.createElement("div",{ref:s,"data-layout-path":o,className:f,onClick:c,onAuxClick:t=>{R(t)&&e.auxMouseClick(i,t)},onContextMenu:t=>{e.showContextMenu(i,t)},title:i.getHelpText(),draggable:!0,onDragStart:t=>{t.stopPropagation(),e.setDragNode(t.nativeEvent,i)},onDragEnd:t=>{e.clearDragMain()},onDoubleClick:t=>{i.isEnableRename()&&(e.setEditingTab(i),e.getCurrentDocument().body.addEventListener("pointerdown",u),t.stopPropagation())}},L,w,O.buttons)},it=t=>{const{node:e,layout:i}=t,n=l.useRef(null),o=l.useRef(null),s=l.useRef(null),h=l.useRef(null),g=l.useRef(null),T=l.useRef(null),p=i.getIcons();l.useEffect((()=>{e.setRect(i.getBoundingClientRect(E.current)),n.current&&e.setTabStripRect(i.getBoundingClientRect(n.current));const t=u.getContentRect(s.current).relativeTo(i.getDomRect());e.getContentRect().equals(t)||(e.setContentRect(t),i.redrawInternal("tabset content rect "+t))}));const{selfRef:E,position:m,userControlledLeft:b,hiddenTabs:f,onMouseWheel:O,tabsTruncated:w}=V(e,c.HORZ,h,T),A=t=>{const n=i.getShowOverflowMenu();void 0!==n?n(e,t,f,L):k(g.current,f,L,i),t.stopPropagation()},L=t=>{i.doAction(_.selectTab(t.node.getId())),b.current=!1},y=t=>{i.getEditingTab()?t.preventDefault():(t.stopPropagation(),i.setDragNode(t.nativeEvent,e))},v=t=>{if(!R(t)){let t=e.getName();t=void 0===t?"":": "+t,i.doAction(_.setActiveTabset(e.getId(),i.getWindowId()))}},N=t=>{R(t)&&i.auxMouseClick(e,t)},D=t=>{i.showContextMenu(e,t)},x=t=>{t.stopPropagation()},S=t=>{e.canMaximize()&&i.maximize(e),t.stopPropagation()},I=t=>{i.doAction(_.deleteTabset(e.getId())),t.stopPropagation()},M=t=>{i.doAction(_.deleteTab(e.getChildren()[0].getId())),t.stopPropagation()},B=t=>{void 0!==W&&i.doAction(_.popoutTab(W.getId())),t.stopPropagation()},C=t=>{e.canMaximize()&&i.maximize(e)},U=i.getClassName;null!==o.current&&0!==o.current.scrollLeft&&(o.current.scrollLeft=0);const W=e.getSelectedNode(),F=e.getPath(),Y=[];if(e.isEnableTabStrip())for(let t=0;t<e.getChildren().length;t++){const n=e.getChildren()[t];let o=e.getSelected()===t;Y.push(l.createElement(et,{layout:i,node:n,path:F+"/tb"+t,key:n.getId(),selected:o})),t<e.getChildren().length-1&&Y.push(l.createElement("div",{key:"divider"+t,className:U(r.FLEXLAYOUT__TABSET_TAB_DIVIDER)}))}let P=[],H=[];const X={stickyButtons:P,buttons:H,overflowPosition:void 0};i.customizeTabSet(e,X),P=X.stickyButtons,H=X.buttons;const z=e.isEnableSingleTabStretch()&&1===e.getChildren().length,G=z&&e.getChildren()[0].isEnableClose()||e.isEnableClose();if(void 0===X.overflowPosition&&(X.overflowPosition=P.length),P.length>0&&(e.isEnableTabWrap()||!w&&!z?Y.push(l.createElement("div",{ref:T,key:"sticky_buttons_container",onPointerDown:x,onDragStart:t=>{t.preventDefault()},className:U(r.FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER)},P)):H=[...P,...H]),!e.isEnableTabWrap()&&f.length>0){const t=i.i18nName(a.Overflow_Menu_Tooltip);let n;n="function"==typeof p.more?p.more(e,f):l.createElement(l.Fragment,null,p.more,l.createElement("div",{className:U(r.FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT)},f.length)),H.splice(Math.min(X.overflowPosition,H.length),0,l.createElement("button",{key:"overflowbutton","data-layout-path":F+"/button/overflow",ref:g,className:U(r.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+" "+U(r.FLEXLAYOUT__TAB_BUTTON_OVERFLOW),title:t,onClick:A,onPointerDown:x},n))}if(void 0!==W&&i.isSupportsPopout()&&W.isEnablePopout()&&W.isEnablePopoutIcon()){const t=i.i18nName(a.Popout_Tab);H.push(l.createElement("button",{key:"popout","data-layout-path":F+"/button/popout",title:t,className:U(r.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+" "+U(r.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_FLOAT),onClick:B,onPointerDown:x},"function"==typeof p.popout?p.popout(W):p.popout))}if(e.canMaximize()){const t=i.i18nName(a.Restore),n=i.i18nName(a.Maximize);H.push(l.createElement("button",{key:"max","data-layout-path":F+"/button/max",title:e.isMaximized()?t:n,className:U(r.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+" "+U(r.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_+(e.isMaximized()?"max":"min")),onClick:S,onPointerDown:x},e.isMaximized()?"function"==typeof p.restore?p.restore(e):p.restore:"function"==typeof p.maximize?p.maximize(e):p.maximize))}if(!e.isMaximized()&&G){const t=z?i.i18nName(a.Close_Tab):i.i18nName(a.Close_Tabset);H.push(l.createElement("button",{key:"close","data-layout-path":F+"/button/close",title:t,className:U(r.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+" "+U(r.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_CLOSE),onClick:z?M:I,onPointerDown:x},"function"==typeof p.closeTabset?p.closeTabset(e):p.closeTabset))}if(e.isActive()&&e.isEnableActiveIcon()){const t=i.i18nName(a.Active_Tabset);H.push(l.createElement("div",{key:"active","data-layout-path":F+"/button/active",title:t,className:U(r.FLEXLAYOUT__TAB_TOOLBAR_ICON)},"function"==typeof p.activeTabset?p.activeTabset(e):p.activeTabset))}const J=l.createElement("div",{key:"buttonbar",ref:h,className:U(r.FLEXLAYOUT__TAB_TOOLBAR),onPointerDown:x,onDragStart:t=>{t.preventDefault()}},H);let Z,j=U(r.FLEXLAYOUT__TABSET_TABBAR_OUTER);if(void 0!==e.getClassNameTabStrip()&&(j+=" "+e.getClassNameTabStrip()),j+=" "+r.FLEXLAYOUT__TABSET_TABBAR_OUTER_+e.getTabLocation(),e.isActive()&&(j+=" "+U(r.FLEXLAYOUT__TABSET_SELECTED)),e.isMaximized()&&(j+=" "+U(r.FLEXLAYOUT__TABSET_MAXIMIZED)),z){const t=e.getChildren()[0];void 0!==t.getTabSetClassName()&&(j+=" "+t.getTabSetClassName())}var q;if(e.isEnableTabWrap()?e.isEnableTabStrip()&&(Z=l.createElement("div",{className:j,style:{flexWrap:"wrap",gap:"1px",marginTop:"2px"},ref:n,"data-layout-path":F+"/tabstrip",onPointerDown:v,onDoubleClick:C,onContextMenu:D,onClick:N,onAuxClick:N,draggable:!0,onDragStart:y},Y,l.createElement("div",{style:{flexGrow:1}}),J)):e.isEnableTabStrip()&&(Z=l.createElement("div",{className:j,ref:n,"data-layout-path":F+"/tabstrip",onPointerDown:v,onDoubleClick:C,onContextMenu:D,onClick:N,onAuxClick:N,draggable:!0,onWheel:O,onDragStart:y},l.createElement("div",{ref:o,className:U(r.FLEXLAYOUT__TABSET_TABBAR_INNER)+" "+U(r.FLEXLAYOUT__TABSET_TABBAR_INNER_+e.getTabLocation())},l.createElement("div",{style:{left:m,width:z?"100%":"10000px"},className:U(r.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER)+" "+U(r.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER_+e.getTabLocation())},Y)),J)),0===e.getChildren().length){const t=i.getTabSetPlaceHolderCallback();t&&(q=t(e))}let $=l.createElement("div",{ref:s,className:U(r.FLEXLAYOUT__TABSET_CONTENT)},q);$="top"===e.getTabLocation()?l.createElement(l.Fragment,null,Z,$):l.createElement(l.Fragment,null,$,Z);let K={flexGrow:Math.max(1,1e3*e.getWeight()),minWidth:e.getMinWidth(),minHeight:e.getMinHeight(),maxWidth:e.getMaxWidth(),maxHeight:e.getMaxHeight()};void 0===e.getModel().getMaximizedTabset(i.getWindowId())||e.isMaximized()||(K.display="none");const Q=l.createElement("div",{ref:E,className:U(r.FLEXLAYOUT__TABSET_CONTAINER),style:K},l.createElement("div",{className:U(r.FLEXLAYOUT__TABSET),"data-layout-path":F},$));return e.isMaximized()&&i.getMainElement()?(0,d.createPortal)(l.createElement("div",{style:{position:"absolute",display:"flex",top:0,left:0,bottom:0,right:0}},Q),i.getMainElement()):Q},nt=t=>{const{layout:e,node:i}=t,n=l.useRef(null),o=i.getOrientation()===c.HORZ;l.useLayoutEffect((()=>{i.setRect(e.getBoundingClientRect(n.current))}));const s=[];let a=0;for(const t of i.getChildren())a>0&&s.push(l.createElement(Y,{key:"splitter"+a,layout:e,node:i,index:a,horizontal:o})),t instanceof M?s.push(l.createElement(nt,{key:t.getId(),layout:e,node:t})):t instanceof I&&s.push(l.createElement(it,{key:t.getId(),layout:e,node:t})),a++;const d={flexGrow:Math.max(1,1e3*i.getWeight()),minWidth:i.getMinWidth(),minHeight:i.getMinHeight(),maxWidth:i.getMaxWidth(),maxHeight:i.getMaxHeight()};return d.flexDirection=o?"row":"column",l.createElement("div",{ref:n,className:e.getClassName(r.FLEXLAYOUT__ROW),style:d},s)},ot=t=>{const{layout:e,selected:i,node:n,path:o}=t,s=l.useRef(null),a=l.useRef(!0),d=n.getParent(),h=d.getContentRect();l.useLayoutEffect((()=>{const t=n.getMoveableElement();s.current.appendChild(t),n.setMoveableElement(t);const e=()=>{n.saveScrollPosition()};return t.addEventListener("scroll",e),s.current.addEventListener("pointerdown",c),()=>{t.removeEventListener("scroll",e),s.current&&s.current.removeEventListener("pointerdown",c),n.setVisible(!1)}}),[]),l.useEffect((()=>{n.isSelected()&&a.current&&(n.restoreScrollPosition(),a.current=!1)}));const c=()=>{const t=n.getParent();t instanceof I&&(t.isActive()||e.doAction(_.setActiveTabset(t.getId(),e.getWindowId())))};n.setRect(h);const u=e.getClassName,g={};h.styleWithPosition(g);let T=null;if(i){if(n.setVisible(!0),document.hidden&&n.isEnablePopoutOverlay()){const t={};h.styleWithPosition(t),T=l.createElement("div",{style:t,className:u(r.FLEXLAYOUT__TAB_OVERLAY)})}}else g.display="none",n.setVisible(!1);d instanceof I&&void 0!==n.getModel().getMaximizedTabset(e.getWindowId())&&(d.isMaximized()?g.zIndex=10:g.display="none");let p=u(r.FLEXLAYOUT__TAB);return d instanceof F&&(p+=" "+u(r.FLEXLAYOUT__TAB_BORDER),p+=" "+u(r.FLEXLAYOUT__TAB_BORDER_+d.getLocation().getName())),void 0!==n.getContentClassName()&&(p+=" "+n.getContentClassName()),l.createElement(l.Fragment,null,T,l.createElement("div",{ref:s,style:g,className:p,"data-layout-path":o}))},st=l.memo((({children:t})=>l.createElement(l.Fragment,null,t)),((t,e)=>t.rect.equalSize(e.rect)&&t.selected===e.selected&&t.forceRevision===e.forceRevision&&t.tabsRevision===e.tabsRevision));class at extends l.Component{constructor(t){super(t),this.selfRef=l.createRef(),this.revision=0}redraw(){this.selfRef.current.redraw("parent "+this.revision)}addTabToTabSet(t,e){return this.selfRef.current.addTabToTabSet(t,e)}addTabWithDragAndDrop(t,e,i){this.selfRef.current.addTabWithDragAndDrop(t,e,i)}moveTabWithDragAndDrop(t,e){this.selfRef.current.moveTabWithDragAndDrop(t,e)}addTabToActiveTabSet(t){return this.selfRef.current.addTabToActiveTabSet(t)}setDragComponent(t,e,i,n){this.selfRef.current.setDragComponent(t,e,i,n)}getRootDiv(){return this.selfRef.current.getRootDiv()}render(){return l.createElement(rt,Object.assign({ref:this.selfRef},this.props,{renderRevision:this.revision++}))}}class rt extends l.Component{constructor(t){super(t),this.moveableElementMap=new Map,this.dragEnterCount=0,this.dragging=!1,this.updateLayoutMetrics=()=>{if(this.findBorderBarSizeRef.current){const t=this.findBorderBarSizeRef.current.getBoundingClientRect().height;t!==this.state.calculatedBorderBarSize&&this.setState({calculatedBorderBarSize:t})}},this.onModelChange=t=>{this.redrawInternal("model change"),this.props.onModelChange&&this.props.onModelChange(this.props.model,t)},this.updateRect=()=>{const t=this.getDomRect();t.equals(this.state.rect)||0===t.width||0===t.height||(this.setState({rect:t}),this.windowId!==W.MAIN_WINDOW_ID&&this.redrawInternal("rect updated"))},this.getClassName=t=>void 0===this.props.classNameMapper?t:this.props.classNameMapper(t),this.onCloseWindow=t=>{this.doAction(_.closeWindow(t.windowId))},this.onSetWindow=(t,e)=>{},this.showControlInPortal=(t,e)=>{const i=(0,d.createPortal)(t,e);this.setState({portal:i})},this.hideControlInPortal=()=>{this.setState({portal:void 0})},this.getIcons=()=>this.icons,this.setDragNode=(t,e)=>{if(rt.dragState=new gt(this.mainLayout,dt.Internal,e,void 0,void 0),t.dataTransfer.setData("text/plain","--flexlayout--"),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.dropEffect="move",this.dragEnterCount=0,e instanceof I){let i=!1,n=this.i18nName(a.Move_Tabset);if(e.getChildren().length>0&&(n=this.i18nName(a.Move_Tabs).replace("?",String(e.getChildren().length))),this.props.onRenderDragRect){const o=this.props.onRenderDragRect(n,e,void 0);o&&(this.setDragComponent(t,o,10,10),i=!0)}i||this.setDragComponent(t,n,10,10)}else{const i=t.target.getBoundingClientRect(),n=t.clientX-i.left,o=t.clientY-i.top,s=null==e?void 0:e.getParent(),a=s instanceof F&&s.getOrientation()===c.HORZ,r=a?10:n,d=a?10:o;let h=!1;if(this.props.onRenderDragRect){const i=l.createElement(z,{key:e.getId(),layout:this,node:e}),n=this.props.onRenderDragRect(i,e,void 0);n&&(this.setDragComponent(t,n,r,d),h=!0)}h||(function(){const t=navigator.userAgent;return t.includes("Safari")&&!t.includes("Chrome")&&!t.includes("Chromium")}()?this.setDragComponent(t,l.createElement(z,{node:e,layout:this}),r,d):t.dataTransfer.setDragImage(e.getTabStamp(),r,d))}},this.onDragEnterRaw=t=>{this.dragEnterCount++,1===this.dragEnterCount&&this.onDragEnter(t)},this.onDragLeaveRaw=t=>{this.dragEnterCount--,0===this.dragEnterCount&&this.onDragLeave(t)},this.onDragEnter=t=>{var e;if(!rt.dragState&&this.props.onExternalDrag){const e=this.props.onExternalDrag(t);if(e){const t=O.fromJson(e.json,this.props.model,!1);rt.dragState=new gt(this.mainLayout,dt.External,t,e.json,e.onDrop)}}if(rt.dragState){if(this.windowId!==W.MAIN_WINDOW_ID&&rt.dragState.mainLayout===this.mainLayout&&rt.dragState.mainLayout.setDraggingOverWindow(!0),rt.dragState.mainLayout!==this.mainLayout)return;t.preventDefault(),this.dropInfo=void 0;const i=this.selfRef.current;this.outlineDiv=this.currentDocument.createElement("div"),this.outlineDiv.className=this.getClassName(r.FLEXLAYOUT__OUTLINE_RECT),this.outlineDiv.style.visibility="hidden";const n=this.props.model.getAttribute("tabDragSpeed");this.outlineDiv.style.transition=`top ${n}s, left ${n}s, width ${n}s, height ${n}s`,i.appendChild(this.outlineDiv),this.dragging=!0,this.showOverlay(!0),this.isDraggingOverWindow||void 0!==this.props.model.getMaximizedTabset(this.windowId)||this.setState({showEdges:this.props.model.isEnableEdgeDock()});const o=null===(e=this.selfRef.current)||void 0===e?void 0:e.getBoundingClientRect();new u(t.clientX-o.left,t.clientY-o.top,1,1).positionElement(this.outlineDiv)}},this.onDragOver=t=>{var e,i,n;if(this.dragging&&!this.isDraggingOverWindow){t.preventDefault();const o=null===(e=this.selfRef.current)||void 0===e?void 0:e.getBoundingClientRect(),s={x:t.clientX-(null!==(i=null==o?void 0:o.left)&&void 0!==i?i:0),y:t.clientY-(null!==(n=null==o?void 0:o.top)&&void 0!==n?n:0)};this.checkForBorderToShow(s.x,s.y);let a=this.props.model.findDropTargetNode(this.windowId,rt.dragState.dragNode,s.x,s.y);a&&(this.dropInfo=a,this.outlineDiv&&(this.outlineDiv.className=this.getClassName(a.className),a.rect.positionElement(this.outlineDiv),this.outlineDiv.style.visibility="visible"))}},this.onDragLeave=t=>{this.dragging&&(this.windowId!==W.MAIN_WINDOW_ID&&rt.dragState.mainLayout.setDraggingOverWindow(!1),this.clearDragLocal())},this.onDrop=t=>{if(this.dragging){t.preventDefault();const e=rt.dragState;if(this.dropInfo)if(void 0!==e.dragJson){const i=this.doAction(_.addNode(e.dragJson,this.dropInfo.node.getId(),this.dropInfo.location,this.dropInfo.index));void 0!==e.fnNewNodeDropped&&e.fnNewNodeDropped(i,t)}else void 0!==e.dragNode&&this.doAction(_.moveNode(e.dragNode.getId(),this.dropInfo.node.getId(),this.dropInfo.location,this.dropInfo.index));this.mainLayout.clearDragMain()}this.dragEnterCount=0},this.orderedIds=[],this.selfRef=l.createRef(),this.moveablesRef=l.createRef(),this.mainRef=l.createRef(),this.findBorderBarSizeRef=l.createRef(),this.supportsPopout=void 0!==t.supportsPopout?t.supportsPopout:ht,this.popoutURL=t.popoutURL?t.popoutURL:"popout.html",this.icons=Object.assign(Object.assign({},lt),t.icons),this.windowId=t.windowId?t.windowId:W.MAIN_WINDOW_ID,this.mainLayout=this.props.mainLayout?this.props.mainLayout:this,this.isDraggingOverWindow=!1,this.layoutWindow=this.props.model.getwindowsMap().get(this.windowId),this.layoutWindow.layout=this,this.popoutWindowName=this.props.popoutWindowName||"Popout Window",this.state={rect:u.empty(),editingTab:void 0,showEdges:!1,showOverlay:!1,calculatedBorderBarSize:29,layoutRevision:0,forceRevision:0,showHiddenBorder:g.CENTER},this.isMainWindow=this.windowId===W.MAIN_WINDOW_ID}componentDidMount(){if(this.updateRect(),this.currentDocument=this.selfRef.current.ownerDocument,this.currentWindow=this.currentDocument.defaultView,this.layoutWindow.window=this.currentWindow,this.layoutWindow.toScreenRectFunction=t=>this.getScreenRect(t),this.resizeObserver=new ResizeObserver((t=>{requestAnimationFrame((()=>{this.updateRect()}))})),this.selfRef.current&&this.resizeObserver.observe(this.selfRef.current),this.isMainWindow)this.props.model.addChangeListener(this.onModelChange),this.updateLayoutMetrics();else{this.currentWindow.addEventListener("resize",(()=>{this.updateRect()}));const t=this.props.mainLayout.getRootDiv(),e=this.selfRef.current;D(t,e),this.styleObserver=new MutationObserver((()=>{D(t,e)&&this.redraw("mutation observer")})),this.styleObserver.observe(t,{attributeFilter:["style"]})}document.addEventListener("visibilitychange",(()=>{for(const[t,e]of this.props.model.getwindowsMap())e.layout&&this.redraw("visibility change")}))}componentDidUpdate(){this.currentDocument=this.selfRef.current.ownerDocument,this.currentWindow=this.currentDocument.defaultView,this.isMainWindow&&(this.props.model!==this.previousModel&&(void 0!==this.previousModel&&this.previousModel.removeChangeListener(this.onModelChange),this.props.model.getwindowsMap().get(this.windowId).layout=this,this.props.model.addChangeListener(this.onModelChange),this.layoutWindow=this.props.model.getwindowsMap().get(this.windowId),this.layoutWindow.layout=this,this.layoutWindow.toScreenRectFunction=t=>this.getScreenRect(t),this.previousModel=this.props.model,this.tidyMoveablesMap()),this.updateLayoutMetrics())}componentWillUnmount(){var t,e;this.selfRef.current&&(null===(t=this.resizeObserver)||void 0===t||t.unobserve(this.selfRef.current)),null===(e=this.styleObserver)||void 0===e||e.disconnect()}render(){if(!this.selfRef.current)return l.createElement("div",{ref:this.selfRef,className:this.getClassName(r.FLEXLAYOUT__LAYOUT)},l.createElement("div",{ref:this.moveablesRef,key:"__moveables__",className:this.getClassName(r.FLEXLAYOUT__LAYOUT_MOVEABLES)}),this.renderMetricsElements());const t=this.props.model;t.getRoot(this.windowId).calcMinMaxSize(),t.getRoot(this.windowId).setPaths(""),t.getBorderSet().setPaths();const e=this.renderLayout(),i=this.renderBorders(e),n=this.renderTabs(),o=this.reorderComponents(n,this.orderedIds);let s=null,a=null,d=null,h=null;return this.isMainWindow&&(s=this.renderWindows(),h=this.renderMetricsElements(),a=this.renderTabMoveables(),d=l.createElement("div",{key:"__tabStamps__",className:this.getClassName(r.FLEXLAYOUT__LAYOUT_TAB_STAMPS)},this.renderTabStamps())),l.createElement("div",{ref:this.selfRef,className:this.getClassName(r.FLEXLAYOUT__LAYOUT),onDragEnter:this.onDragEnterRaw,onDragLeave:this.onDragLeaveRaw,onDragOver:this.onDragOver,onDrop:this.onDrop},l.createElement("div",{ref:this.moveablesRef,key:"__moveables__",className:this.getClassName(r.FLEXLAYOUT__LAYOUT_MOVEABLES)}),h,l.createElement(tt,{key:"__overlay__",layout:this,show:this.state.showOverlay}),i,o,a,d,this.state.portal,s)}renderBorders(t){const e=this.getClassName(r.FLEXLAYOUT__LAYOUT_MAIN),i=this.props.model.getBorderSet().getBorderMap();if(this.isMainWindow&&i.size>0){t=l.createElement("div",{className:e,ref:this.mainRef},t);const n=new Map,o=new Map;for(const[t,e]of g.values){const t=i.get(e);t&&(!t.isAutoHide()||t.isAutoHide()&&(t.getChildren().length>0||this.state.showHiddenBorder===e))&&(n.set(e,l.createElement(J,{layout:this,border:t,size:this.state.calculatedBorderBarSize})),o.set(e,l.createElement(P,{layout:this,border:t,show:-1!==t.getSelected()})))}const s=this.getClassName(r.FLEXLAYOUT__LAYOUT_BORDER_CONTAINER),a=this.getClassName(r.FLEXLAYOUT__LAYOUT_BORDER_CONTAINER_INNER);if(this.props.model.getBorderSet().getLayoutHorizontal()){const e=l.createElement("div",{className:a,style:{flexDirection:"column"}},o.get(g.TOP),l.createElement("div",{className:a,style:{flexDirection:"row"}},o.get(g.LEFT),t,o.get(g.RIGHT)),o.get(g.BOTTOM));return l.createElement("div",{className:s,style:{flexDirection:"column"}},n.get(g.TOP),l.createElement("div",{className:a,style:{flexDirection:"row"}},n.get(g.LEFT),e,n.get(g.RIGHT)),n.get(g.BOTTOM))}{const e=l.createElement("div",{className:a,style:{flexDirection:"row"}},o.get(g.LEFT),l.createElement("div",{className:a,style:{flexDirection:"column"}},o.get(g.TOP),t,o.get(g.BOTTOM)),o.get(g.RIGHT));return l.createElement("div",{className:s,style:{flexDirection:"row"}},n.get(g.LEFT),l.createElement("div",{className:a,style:{flexDirection:"column"}},n.get(g.TOP),e,n.get(g.BOTTOM)),n.get(g.RIGHT))}}return l.createElement("div",{className:e,ref:this.mainRef,style:{position:"absolute",top:0,left:0,bottom:0,right:0,display:"flex"}},t)}renderLayout(){return l.createElement(l.Fragment,null,l.createElement(nt,{key:"__row__",layout:this,node:this.props.model.getRoot(this.windowId)}),this.renderEdgeIndicators())}renderEdgeIndicators(){const t=[],e=this.icons.edgeArrow;if(this.state.showEdges){const i=this.props.model.getRoot(this.windowId).getRect(),n=ct,o=ut,s=ct/2,a=this.getClassName(r.FLEXLAYOUT__EDGE_RECT),d=50;t.push(l.createElement("div",{key:"North",style:{top:0,left:i.width/2-s,width:n,height:o,borderBottomLeftRadius:d,borderBottomRightRadius:d},className:a+" "+this.getClassName(r.FLEXLAYOUT__EDGE_RECT_TOP)},l.createElement("div",{style:{transform:"rotate(180deg)"}},e))),t.push(l.createElement("div",{key:"West",style:{top:i.height/2-s,left:0,width:o,height:n,borderTopRightRadius:d,borderBottomRightRadius:d},className:a+" "+this.getClassName(r.FLEXLAYOUT__EDGE_RECT_LEFT)},l.createElement("div",{style:{transform:"rotate(90deg)"}},e))),t.push(l.createElement("div",{key:"South",style:{top:i.height-o,left:i.width/2-s,width:n,height:o,borderTopLeftRadius:d,borderTopRightRadius:d},className:a+" "+this.getClassName(r.FLEXLAYOUT__EDGE_RECT_BOTTOM)},l.createElement("div",null,e))),t.push(l.createElement("div",{key:"East",style:{top:i.height/2-s,left:i.width-o,width:o,height:n,borderTopLeftRadius:d,borderBottomLeftRadius:d},className:a+" "+this.getClassName(r.FLEXLAYOUT__EDGE_RECT_RIGHT)},l.createElement("div",{style:{transform:"rotate(-90deg)"}},e)))}return t}renderWindows(){const t=[];if(this.supportsPopout){const e=this.props.model.getwindowsMap();let i=1;for(const[n,o]of e)n!==W.MAIN_WINDOW_ID&&(t.push(l.createElement(q,{key:n,layout:this,title:this.popoutWindowName+" "+i,layoutWindow:o,url:this.popoutURL+"?id="+n,onSetWindow:this.onSetWindow,onCloseWindow:this.onCloseWindow},l.createElement(rt,Object.assign({},this.props,{windowId:n,mainLayout:this})))),i++)}return t}renderTabMoveables(){const t=[];return this.props.model.visitNodes((e=>{if(e instanceof O){const i=e,n=this.getMoveableElement(i.getId());i.setMoveableElement(n);const o=i.isSelected(),s=i.getParent().getContentRect(),r=i.isRendered()||(o||!i.isEnableRenderOnDemand())&&s.width>0&&s.height>0;if(r){const e=i.getId()+(i.isEnableWindowReMount()?i.getWindowId():"");t.push((0,d.createPortal)(l.createElement(st,{rect:s,selected:i.isSelected(),forceRevision:this.state.forceRevision,tabsRevision:this.props.renderRevision,key:e},l.createElement(j,{message:this.i18nName(a.Error_rendering_component)},this.props.factory(i))),n,e)),i.setRendered(r)}}})),t}renderTabStamps(){const t=[];return this.props.model.visitNodes((e=>{if(e instanceof O){const i=e;t.push(l.createElement(Z,{key:i.getId(),layout:this,node:i}))}})),t}renderTabs(){const t=new Map;return this.props.model.visitWindowNodes(this.windowId,(e=>{if(e instanceof O){const i=e,n=i.isSelected(),o=i.getPath();(i.isRendered()||n||!i.isEnableRenderOnDemand())&&t.set(i.getId(),l.createElement(ot,{key:i.getId(),layout:this,path:o,node:i,selected:n}))}})),t}renderMetricsElements(){return l.createElement("div",{key:"findBorderBarSize",ref:this.findBorderBarSizeRef,className:this.getClassName(r.FLEXLAYOUT__BORDER_SIZER)},"FindBorderBarSize")}checkForBorderToShow(t,e){const i=this.getBoundingClientRect(this.mainRef.current),n=i.getCenter(),o=ut,s=ct/2;let a=!1;this.props.model.isEnableEdgeDock()&&this.state.showHiddenBorder===g.CENTER&&(e>n.y-s&&e<n.y+s||t>n.x-s&&t<n.x+s)&&(a=!0);let r=g.CENTER;a||(t<=i.x+o?r=g.LEFT:t>=i.getRight()-o?r=g.RIGHT:e<=i.y+o?r=g.TOP:e>=i.getBottom()-o&&(r=g.BOTTOM)),r!==this.state.showHiddenBorder&&this.setState({showHiddenBorder:r})}tidyMoveablesMap(){const t=new Map;this.props.model.visitNodes(((e,i)=>{e instanceof O&&t.set(e.getId(),e)}));for(const[e,i]of this.moveableElementMap)t.has(e)||(i.remove(),this.moveableElementMap.delete(e))}reorderComponents(t,e){const i=[],n=new Set;let o=[];for(const o of e)t.get(o)&&(i.push(o),n.add(o));e.splice(0,e.length,...i);for(const[i,o]of t)n.has(i)||e.push(i);return o=e.map((e=>t.get(e))),o}redraw(t){this.mainLayout.setState(((t,e)=>({forceRevision:t.forceRevision+1})))}redrawInternal(t){this.mainLayout.setState(((t,e)=>({layoutRevision:t.layoutRevision+1})))}doAction(t){if(void 0!==this.props.onAction){const e=this.props.onAction(t);return void 0!==e?this.props.model.doAction(e):void 0}return this.props.model.doAction(t)}getBoundingClientRect(t){const e=this.getDomRect();return e?u.getBoundingClientRect(t).relativeTo(e):u.empty()}getMoveableContainer(){return this.moveablesRef.current}getMoveableElement(t){let e=this.moveableElementMap.get(t);return void 0===e&&(e=document.createElement("div"),this.moveablesRef.current.appendChild(e),e.className=r.FLEXLAYOUT__TAB_MOVEABLE,this.moveableElementMap.set(t,e)),e}getMainLayout(){return this.mainLayout}getCurrentDocument(){return this.currentDocument}getDomRect(){return this.selfRef.current?u.fromDomRect(this.selfRef.current.getBoundingClientRect()):u.empty()}getWindowId(){return this.windowId}getRootDiv(){return this.selfRef.current}getMainElement(){return this.mainRef.current}getFactory(){return this.props.factory}isSupportsPopout(){return this.supportsPopout}isRealtimeResize(){var t;return null!==(t=this.props.realtimeResize)&&void 0!==t&&t}getPopoutURL(){return this.popoutURL}setEditingTab(t){this.setState({editingTab:t})}getEditingTab(){return this.state.editingTab}getModel(){return this.props.model}getScreenRect(t){const e=t.clone(),i=this.getDomRect();return e.x=this.currentWindow.screenX+this.currentWindow.scrollX+1+i.x+e.x,e.y=this.currentWindow.screenY+this.currentWindow.scrollY+59+i.y+e.y,e.height+=60,e.width+=2,e}addTabToTabSet(t,e){if(void 0!==this.props.model.getNodeById(t))return this.doAction(_.addNode(e,t,g.CENTER,-1))}addTabToActiveTabSet(t){const e=this.props.model.getActiveTabset(this.windowId);if(void 0!==e)return this.doAction(_.addNode(t,e.getId(),g.CENTER,-1))}maximize(t){this.doAction(_.maximizeToggle(t.getId(),this.getWindowId()))}customizeTab(t,e){this.props.onRenderTab&&this.props.onRenderTab(t,e)}customizeTabSet(t,e){this.props.onRenderTabSet&&this.props.onRenderTabSet(t,e)}i18nName(t,e){let i;return this.props.i18nMapper&&(i=this.props.i18nMapper(t,e)),void 0===i&&(i=t+(void 0===e?"":e)),i}getShowOverflowMenu(){return this.props.onShowOverflowMenu}getTabSetPlaceHolderCallback(){return this.props.onTabSetPlaceHolder}showContextMenu(t,e){this.props.onContextMenu&&this.props.onContextMenu(t,e)}auxMouseClick(t,e){this.props.onAuxMouseClick&&this.props.onAuxMouseClick(t,e)}showOverlay(t){this.setState({showOverlay:t}),L(!t,this.currentDocument)}addTabWithDragAndDrop(t,e,i){const n=O.fromJson(e,this.props.model,!1);rt.dragState=new gt(this.mainLayout,dt.Add,n,e,i)}moveTabWithDragAndDrop(t,e){this.setDragNode(t,e)}setDragComponent(t,e,i,n){let o=l.createElement("div",{style:{position:"unset"},className:this.getClassName(r.FLEXLAYOUT__LAYOUT)+" "+this.getClassName(r.FLEXLAYOUT__DRAG_RECT)},e);const s=this.currentDocument.createElement("div");s.setAttribute("data-layout-path","/drag-rectangle"),s.style.position="absolute",s.style.left="-10000px",s.style.top="-10000px",this.currentDocument.body.appendChild(s),(0,h.H)(s).render(o),t.dataTransfer.setDragImage(s,i,n),setTimeout((()=>{this.currentDocument.body.removeChild(s)}),0)}setDraggingOverWindow(t){this.isDraggingOverWindow!==t&&(this.outlineDiv&&(this.outlineDiv.style.visibility=t?"hidden":"visible"),t?this.setState({showEdges:!1}):void 0===this.props.model.getMaximizedTabset(this.windowId)&&this.setState({showEdges:this.props.model.isEnableEdgeDock()}),this.isDraggingOverWindow=t)}clearDragMain(){rt.dragState=void 0,this.windowId===W.MAIN_WINDOW_ID&&(this.isDraggingOverWindow=!1);for(const[,t]of this.props.model.getwindowsMap())t.layout.clearDragLocal()}clearDragLocal(){this.setState({showEdges:!1}),this.showOverlay(!1),this.dragEnterCount=0,this.dragging=!1,this.outlineDiv&&(this.selfRef.current.removeChild(this.outlineDiv),this.outlineDiv=void 0)}}rt.dragState=void 0;const lt={close:l.createElement(Q,null),closeTabset:l.createElement(Q,null),popout:l.createElement((()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",style:K,viewBox:"0 0 20 20",fill:"var(--color-icon)"},l.createElement("path",{d:"M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z"}),l.createElement("path",{d:"M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z"}))),null),maximize:l.createElement((()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",style:K,viewBox:"0 0 24 24",fill:"var(--color-icon)"},l.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),l.createElement("path",{stroke:"var(--color-icon)",d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"}))),null),restore:l.createElement((()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",style:K,viewBox:"0 0 24 24",fill:"var(--color-icon)"},l.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),l.createElement("path",{stroke:"var(--color-icon)",d:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"}))),null),more:l.createElement((()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",style:K,viewBox:"0 0 24 24",fill:"var(--color-icon)"},l.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),l.createElement("path",{stroke:"var(--color-icon)",d:"M7 10l5 5 5-5z"}))),null),edgeArrow:l.createElement((()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",style:{display:"block",width:10,height:10},preserveAspectRatio:"none",viewBox:"0 0 100 100"},l.createElement("path",{fill:"var(--color-edge-icon)",stroke:"var(--color-edge-icon)",d:"M10 30 L90 30 l-40 40 Z"}))),null),activeTabset:l.createElement((()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",style:K,height:"24px",viewBox:"0 -960 960 960",width:"24px"},l.createElement("path",{fill:"var(--color-icon)",stroke:"var(--color-icon)",d:"M440-120v-264L254-197l-57-57 187-186H120v-80h264L197-706l57-57 186 187v-264h80v264l186-187 57 57-187 186h264v80H576l187 186-57 57-186-187v264h-80Z"}))),null)};var dt;!function(t){t.Internal="internal",t.External="external",t.Add="add"}(dt||(dt={}));const ht=w(),ct=100,ut=10;class gt{constructor(t,e,i,n,o){this.mainLayout=t,this.dragSource=e,this.dragNode=i,this.dragJson=n,this.fnNewNodeDropped=o}}return s})()));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],e):"object"==typeof exports?exports.FlexLayout=e(require("react"),require("react-dom")):t.FlexLayout=e(t.React,t.ReactDOM)}(self,((t,e)=>(()=>{"use strict";var i={557:(t,e,i)=>{var n=i(47);e.H=n.createRoot,n.hydrateRoot},36:e=>{e.exports=t},47:t=>{t.exports=e}},n={};function o(t){var e=n[t];if(void 0!==e)return e.exports;var s=n[t]={exports:{}};return i[t](s,s.exports,o),s.exports}o.d=(t,e)=>{for(var i in e)o.o(e,i)&&!o.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var s={};o.r(s),o.d(s,{Action:()=>T,Actions:()=>_,BorderNode:()=>F,BorderSet:()=>m,CLASSES:()=>r,DefaultMax:()=>U,DefaultMin:()=>C,DockLocation:()=>g,DropInfo:()=>b,FlexLayoutVersion:()=>lt,I18nLabel:()=>a,ICloseType:()=>H,Layout:()=>at,LayoutInternal:()=>rt,LayoutWindow:()=>B,Model:()=>W,Node:()=>f,Orientation:()=>c,Rect:()=>u,RowNode:()=>I,TabNode:()=>O,TabSetNode:()=>M});var a,r,l=o(36),d=o(47),h=o(557);class c{static flip(t){return t===c.HORZ?c.VERT:c.HORZ}constructor(t){this._name=t}getName(){return this._name}toString(){return this._name}}c.HORZ=new c("horz"),c.VERT=new c("vert");class u{static empty(){return new u(0,0,0,0)}static fromJson(t){return new u(t.x,t.y,t.width,t.height)}constructor(t,e,i,n){this.x=t,this.y=e,this.width=i,this.height=n}toJson(){return{x:this.x,y:this.y,width:this.width,height:this.height}}snap(t){this.x=Math.round(this.x/t)*t,this.y=Math.round(this.y/t)*t,this.width=Math.round(this.width/t)*t,this.height=Math.round(this.height/t)*t}static getBoundingClientRect(t){let{x:e,y:i,width:n,height:o}=t.getBoundingClientRect();return new u(e,i,n,o)}static getContentRect(t){const e=t.getBoundingClientRect(),i=window.getComputedStyle(t),n=parseFloat(i.paddingLeft),o=parseFloat(i.paddingRight),s=parseFloat(i.paddingTop),a=parseFloat(i.paddingBottom),r=parseFloat(i.borderLeftWidth),l=parseFloat(i.borderRightWidth),d=parseFloat(i.borderTopWidth),h=parseFloat(i.borderBottomWidth),c=e.width-r-n-o-l,g=e.height-d-s-a-h;return new u(e.left+r+n,e.top+d+s,c,g)}static fromDomRect(t){return new u(t.x,t.y,t.width,t.height)}relativeTo(t){return new u(this.x-t.x,this.y-t.y,this.width,this.height)}clone(){return new u(this.x,this.y,this.width,this.height)}equals(t){return this.x===(null==t?void 0:t.x)&&this.y===(null==t?void 0:t.y)&&this.width===(null==t?void 0:t.width)&&this.height===(null==t?void 0:t.height)}equalSize(t){return this.width===(null==t?void 0:t.width)&&this.height===(null==t?void 0:t.height)}getBottom(){return this.y+this.height}getRight(){return this.x+this.width}getCenter(){return{x:this.x+this.width/2,y:this.y+this.height/2}}positionElement(t,e){this.styleWithPosition(t.style,e)}styleWithPosition(t,e="absolute"){return t.left=this.x+"px",t.top=this.y+"px",t.width=Math.max(0,this.width)+"px",t.height=Math.max(0,this.height)+"px",t.position=e,t}contains(t,e){return this.x<=t&&t<=this.getRight()&&this.y<=e&&e<=this.getBottom()}removeInsets(t){return new u(this.x+t.left,this.y+t.top,Math.max(0,this.width-t.left-t.right),Math.max(0,this.height-t.top-t.bottom))}centerInRect(t){this.x=(t.width-this.width)/2,this.y=(t.height-this.height)/2}_getSize(t){let e=this.width;return t===c.VERT&&(e=this.height),e}toString(){return"(Rect: x="+this.x+", y="+this.y+", width="+this.width+", height="+this.height+")"}}class g{static getByName(t){return g.values.get(t)}static getLocation(t,e,i){if(e=(e-t.x)/t.width,i=(i-t.y)/t.height,e>=.25&&e<.75&&i>=.25&&i<.75)return g.CENTER;const n=i>=1-e;return i>=e?n?g.BOTTOM:g.LEFT:n?g.RIGHT:g.TOP}constructor(t,e,i){this.name=t,this.orientation=e,this.indexPlus=i,g.values.set(this.name,this)}getName(){return this.name}getOrientation(){return this.orientation}getDockRect(t){return this===g.TOP?new u(t.x,t.y,t.width,t.height/2):this===g.BOTTOM?new u(t.x,t.getBottom()-t.height/2,t.width,t.height/2):this===g.LEFT?new u(t.x,t.y,t.width/2,t.height):this===g.RIGHT?new u(t.getRight()-t.width/2,t.y,t.width/2,t.height):t.clone()}split(t,e){return this===g.TOP?{start:new u(t.x,t.y,t.width,e),end:new u(t.x,t.y+e,t.width,t.height-e)}:this===g.LEFT?{start:new u(t.x,t.y,e,t.height),end:new u(t.x+e,t.y,t.width-e,t.height)}:this===g.RIGHT?{start:new u(t.getRight()-e,t.y,e,t.height),end:new u(t.x,t.y,t.width-e,t.height)}:{start:new u(t.x,t.getBottom()-e,t.width,e),end:new u(t.x,t.y,t.width,t.height-e)}}reflect(){return this===g.TOP?g.BOTTOM:this===g.LEFT?g.RIGHT:this===g.RIGHT?g.LEFT:g.TOP}toString(){return"(DockLocation: name="+this.name+", orientation="+this.orientation+")"}}g.values=new Map,g.TOP=new g("top",c.VERT,0),g.BOTTOM=new g("bottom",c.VERT,1),g.LEFT=new g("left",c.HORZ,0),g.RIGHT=new g("right",c.HORZ,1),g.CENTER=new g("center",c.VERT,0),function(t){t.Close_Tab="Close",t.Close_Tabset="Close tab set",t.Active_Tabset="Active tab set",t.Move_Tabset="Move tab set",t.Move_Tabs="Move tabs(?)",t.Maximize="Maximize tab set",t.Restore="Restore tab set",t.Popout_Tab="Popout selected tab",t.Overflow_Menu_Tooltip="Hidden tabs",t.Error_rendering_component="Error rendering component"}(a||(a={})),function(t){t.FLEXLAYOUT__BORDER="flexlayout__border",t.FLEXLAYOUT__BORDER_="flexlayout__border_",t.FLEXLAYOUT__BORDER_TAB_CONTENTS="flexlayout__border_tab_contents",t.FLEXLAYOUT__BORDER_BUTTON="flexlayout__border_button",t.FLEXLAYOUT__BORDER_BUTTON_="flexlayout__border_button_",t.FLEXLAYOUT__BORDER_BUTTON_CONTENT="flexlayout__border_button_content",t.FLEXLAYOUT__BORDER_BUTTON_LEADING="flexlayout__border_button_leading",t.FLEXLAYOUT__BORDER_BUTTON_TRAILING="flexlayout__border_button_trailing",t.FLEXLAYOUT__BORDER_BUTTON__SELECTED="flexlayout__border_button--selected",t.FLEXLAYOUT__BORDER_BUTTON__UNSELECTED="flexlayout__border_button--unselected",t.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW="flexlayout__border_toolbar_button_overflow",t.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW_="flexlayout__border_toolbar_button_overflow_",t.FLEXLAYOUT__BORDER_INNER="flexlayout__border_inner",t.FLEXLAYOUT__BORDER_INNER_="flexlayout__border_inner_",t.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER="flexlayout__border_inner_tab_container",t.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER_="flexlayout__border_inner_tab_container_",t.FLEXLAYOUT__BORDER_TAB_DIVIDER="flexlayout__border_tab_divider",t.FLEXLAYOUT__BORDER_SIZER="flexlayout__border_sizer",t.FLEXLAYOUT__BORDER_TOOLBAR="flexlayout__border_toolbar",t.FLEXLAYOUT__BORDER_TOOLBAR_="flexlayout__border_toolbar_",t.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON="flexlayout__border_toolbar_button",t.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_FLOAT="flexlayout__border_toolbar_button-float",t.FLEXLAYOUT__DRAG_RECT="flexlayout__drag_rect",t.FLEXLAYOUT__EDGE_RECT="flexlayout__edge_rect",t.FLEXLAYOUT__EDGE_RECT_TOP="flexlayout__edge_rect_top",t.FLEXLAYOUT__EDGE_RECT_LEFT="flexlayout__edge_rect_left",t.FLEXLAYOUT__EDGE_RECT_BOTTOM="flexlayout__edge_rect_bottom",t.FLEXLAYOUT__EDGE_RECT_RIGHT="flexlayout__edge_rect_right",t.FLEXLAYOUT__ERROR_BOUNDARY_CONTAINER="flexlayout__error_boundary_container",t.FLEXLAYOUT__ERROR_BOUNDARY_CONTENT="flexlayout__error_boundary_content",t.FLEXLAYOUT__FLOATING_WINDOW_CONTENT="flexlayout__floating_window_content",t.FLEXLAYOUT__FLOATING_WINDOW_TAB="flexlayout__floating_window_tab",t.FLEXLAYOUT__LAYOUT="flexlayout__layout",t.FLEXLAYOUT__LAYOUT_MOVEABLES="flexlayout__layout_moveables",t.FLEXLAYOUT__LAYOUT_OVERLAY="flexlayout__layout_overlay",t.FLEXLAYOUT__LAYOUT_TAB_STAMPS="flexlayout__layout_tab_stamps",t.FLEXLAYOUT__LAYOUT_MAIN="flexlayout__layout_main",t.FLEXLAYOUT__LAYOUT_BORDER_CONTAINER="flexlayout__layout_border_container",t.FLEXLAYOUT__LAYOUT_BORDER_CONTAINER_INNER="flexlayout__layout_border_container_inner",t.FLEXLAYOUT__OUTLINE_RECT="flexlayout__outline_rect",t.FLEXLAYOUT__OUTLINE_RECT_EDGE="flexlayout__outline_rect_edge",t.FLEXLAYOUT__SPLITTER="flexlayout__splitter",t.FLEXLAYOUT__SPLITTER_EXTRA="flexlayout__splitter_extra",t.FLEXLAYOUT__SPLITTER_="flexlayout__splitter_",t.FLEXLAYOUT__SPLITTER_BORDER="flexlayout__splitter_border",t.FLEXLAYOUT__SPLITTER_DRAG="flexlayout__splitter_drag",t.FLEXLAYOUT__SPLITTER_HANDLE="flexlayout__splitter_handle",t.FLEXLAYOUT__SPLITTER_HANDLE_HORZ="flexlayout__splitter_handle_horz",t.FLEXLAYOUT__SPLITTER_HANDLE_VERT="flexlayout__splitter_handle_vert",t.FLEXLAYOUT__ROW="flexlayout__row",t.FLEXLAYOUT__TAB="flexlayout__tab",t.FLEXLAYOUT__TAB_POSITION="flexlayout__tab_position",t.FLEXLAYOUT__TAB_MOVEABLE="flexlayout__tab_moveable",t.FLEXLAYOUT__TAB_OVERLAY="flexlayout__tab_overlay",t.FLEXLAYOUT__TABSET="flexlayout__tabset",t.FLEXLAYOUT__TABSET_CONTAINER="flexlayout__tabset_container",t.FLEXLAYOUT__TABSET_HEADER="flexlayout__tabset_header",t.FLEXLAYOUT__TABSET_HEADER_SIZER="flexlayout__tabset_header_sizer",t.FLEXLAYOUT__TABSET_HEADER_CONTENT="flexlayout__tabset_header_content",t.FLEXLAYOUT__TABSET_MAXIMIZED="flexlayout__tabset-maximized",t.FLEXLAYOUT__TABSET_SELECTED="flexlayout__tabset-selected",t.FLEXLAYOUT__TABSET_SIZER="flexlayout__tabset_sizer",t.FLEXLAYOUT__TABSET_TAB_DIVIDER="flexlayout__tabset_tab_divider",t.FLEXLAYOUT__TABSET_CONTENT="flexlayout__tabset_content",t.FLEXLAYOUT__TABSET_TABBAR_INNER="flexlayout__tabset_tabbar_inner",t.FLEXLAYOUT__TABSET_TABBAR_INNER_="flexlayout__tabset_tabbar_inner_",t.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER="flexlayout__tabset_tabbar_inner_tab_container",t.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER_="flexlayout__tabset_tabbar_inner_tab_container_",t.FLEXLAYOUT__TABSET_TABBAR_OUTER="flexlayout__tabset_tabbar_outer",t.FLEXLAYOUT__TABSET_TABBAR_OUTER_="flexlayout__tabset_tabbar_outer_",t.FLEXLAYOUT__TAB_BORDER="flexlayout__tab_border",t.FLEXLAYOUT__TAB_BORDER_="flexlayout__tab_border_",t.FLEXLAYOUT__TAB_BUTTON="flexlayout__tab_button",t.FLEXLAYOUT__TAB_BUTTON_STRETCH="flexlayout__tab_button_stretch",t.FLEXLAYOUT__TAB_BUTTON_CONTENT="flexlayout__tab_button_content",t.FLEXLAYOUT__TAB_BUTTON_LEADING="flexlayout__tab_button_leading",t.FLEXLAYOUT__TAB_BUTTON_OVERFLOW="flexlayout__tab_button_overflow",t.FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT="flexlayout__tab_button_overflow_count",t.FLEXLAYOUT__TAB_BUTTON_TEXTBOX="flexlayout__tab_button_textbox",t.FLEXLAYOUT__TAB_BUTTON_TRAILING="flexlayout__tab_button_trailing",t.FLEXLAYOUT__TAB_BUTTON_STAMP="flexlayout__tab_button_stamp",t.FLEXLAYOUT__TAB_FLOATING="flexlayout__tab_floating",t.FLEXLAYOUT__TAB_FLOATING_INNER="flexlayout__tab_floating_inner",t.FLEXLAYOUT__TAB_TOOLBAR="flexlayout__tab_toolbar",t.FLEXLAYOUT__TAB_TOOLBAR_BUTTON="flexlayout__tab_toolbar_button",t.FLEXLAYOUT__TAB_TOOLBAR_ICON="flexlayout__tab_toolbar_icon",t.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_="flexlayout__tab_toolbar_button-",t.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_FLOAT="flexlayout__tab_toolbar_button-float",t.FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER="flexlayout__tab_toolbar_sticky_buttons_container",t.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_CLOSE="flexlayout__tab_toolbar_button-close",t.FLEXLAYOUT__POPUP_MENU_CONTAINER="flexlayout__popup_menu_container",t.FLEXLAYOUT__POPUP_MENU_ITEM="flexlayout__popup_menu_item",t.FLEXLAYOUT__POPUP_MENU="flexlayout__popup_menu"}(r||(r={}));class T{constructor(t,e){this.type=t,this.data=e}}class _{static addNode(t,e,i,n,o){return new T(_.ADD_NODE,{json:t,toNode:e,location:i.getName(),index:n,select:o})}static moveNode(t,e,i,n,o){return new T(_.MOVE_NODE,{fromNode:t,toNode:e,location:i.getName(),index:n,select:o})}static deleteTab(t){return new T(_.DELETE_TAB,{node:t})}static deleteTabset(t){return new T(_.DELETE_TABSET,{node:t})}static renameTab(t,e){return new T(_.RENAME_TAB,{node:t,text:e})}static selectTab(t){return new T(_.SELECT_TAB,{tabNode:t})}static setActiveTabset(t,e){return new T(_.SET_ACTIVE_TABSET,{tabsetNode:t,windowId:e})}static adjustWeights(t,e){return new T(_.ADJUST_WEIGHTS,{nodeId:t,weights:e})}static adjustBorderSplit(t,e){return new T(_.ADJUST_BORDER_SPLIT,{node:t,pos:e})}static maximizeToggle(t,e){return new T(_.MAXIMIZE_TOGGLE,{node:t,windowId:e})}static updateModelAttributes(t){return new T(_.UPDATE_MODEL_ATTRIBUTES,{json:t})}static updateNodeAttributes(t,e){return new T(_.UPDATE_NODE_ATTRIBUTES,{node:t,json:e})}static popoutTab(t){return new T(_.POPOUT_TAB,{node:t})}static popoutTabset(t){return new T(_.POPOUT_TABSET,{node:t})}static closeWindow(t){return new T(_.CLOSE_WINDOW,{windowId:t})}static createWindow(t,e){return new T(_.CREATE_WINDOW,{layout:t,rect:e})}}_.ADD_NODE="FlexLayout_AddNode",_.MOVE_NODE="FlexLayout_MoveNode",_.DELETE_TAB="FlexLayout_DeleteTab",_.DELETE_TABSET="FlexLayout_DeleteTabset",_.RENAME_TAB="FlexLayout_RenameTab",_.SELECT_TAB="FlexLayout_SelectTab",_.SET_ACTIVE_TABSET="FlexLayout_SetActiveTabset",_.ADJUST_WEIGHTS="FlexLayout_AdjustWeights",_.ADJUST_BORDER_SPLIT="FlexLayout_AdjustBorderSplit",_.MAXIMIZE_TOGGLE="FlexLayout_MaximizeToggle",_.UPDATE_MODEL_ATTRIBUTES="FlexLayout_UpdateModelAttributes",_.UPDATE_NODE_ATTRIBUTES="FlexLayout_UpdateNodeAttributes",_.POPOUT_TAB="FlexLayout_PopoutTab",_.POPOUT_TABSET="FlexLayout_PopoutTabset",_.CLOSE_WINDOW="FlexLayout_CloseWindow",_.CREATE_WINDOW="FlexLayout_CreateWindow";class p{constructor(t,e,i,n){this.name=t,this.alias=void 0,this.modelName=e,this.defaultValue=i,this.alwaysWriteJson=n,this.required=!1,this.fixed=!1,this.type="any"}setType(t){return this.type=t,this}setAlias(t){return this.alias=t,this}setDescription(t){this.description=t}setRequired(){return this.required=!0,this}setFixed(){return this.fixed=!0,this}setpairedAttr(t){this.pairedAttr=t}setPairedType(t){this.pairedType=t}}p.NUMBER="number",p.STRING="string",p.BOOLEAN="boolean";class E{constructor(){this.attributes=[],this.nameToAttribute=new Map}addWithAll(t,e,i,n){const o=new p(t,e,i,n);return this.attributes.push(o),this.nameToAttribute.set(t,o),o}addInherited(t,e){return this.addWithAll(t,e,void 0,!1)}add(t,e,i){return this.addWithAll(t,void 0,e,i)}getAttributes(){return this.attributes}getModelName(t){const e=this.nameToAttribute.get(t);if(void 0!==e)return e.modelName}toJson(t,e){for(const i of this.attributes){const n=e[i.name];(i.alwaysWriteJson||n!==i.defaultValue)&&(t[i.name]=n)}}fromJson(t,e){for(const i of this.attributes){let n=t[i.name];void 0===n&&i.alias&&(n=t[i.alias]),e[i.name]=void 0===n?i.defaultValue:n}}update(t,e){for(const i of this.attributes)if(t.hasOwnProperty(i.name)){const n=t[i.name];void 0===n?delete e[i.name]:e[i.name]=n}}setDefaults(t){for(const e of this.attributes)t[e.name]=e.defaultValue}pairAttributes(t,e){for(const i of e.attributes)if(i.modelName&&this.nameToAttribute.has(i.modelName)){const e=this.nameToAttribute.get(i.modelName);e.setpairedAttr(i),i.setpairedAttr(e),e.setPairedType(t)}}toTypescriptInterface(t,e){var i,n;const o=[],s=this.attributes.sort(((t,e)=>t.name.localeCompare(e.name)));o.push("export interface I"+t+"Attributes {");for(let t=0;t<s.length;t++){const a=s[t];let r,l,d=a.type,h=a;void 0!==h.defaultValue?r=h.defaultValue:void 0!==h.modelName&&void 0!==e&&void 0!==e.nameToAttribute.get(h.modelName)&&(l=h.modelName,h=e.nameToAttribute.get(l),r=h.defaultValue,d=h.type);let c=JSON.stringify(r);const u=h.required?"":"?";let g="\t/**\n\t ";a.description?g+=a.description:a.pairedType&&(null===(i=a.pairedAttr)||void 0===i?void 0:i.description)&&(g+=`Value for ${a.pairedType} attribute ${a.pairedAttr.name} if not overridden`,g+="\n\n\t ",g+=null===(n=a.pairedAttr)||void 0===n?void 0:n.description),g+="\n\n\t ",a.fixed?g+=`Fixed value: ${c}`:g+=l?`Default: inherited from Global attribute ${a.modelName} (default ${c})`:`Default: ${c}`,g+="\n\t */",o.push(g),o.push("\t"+a.name+u+": "+d+";\n")}return o.push("}"),o.join("\n")}}class b{constructor(t,e,i,n,o){this.node=t,this.rect=e,this.location=i,this.index=n,this.className=o}}class m{static fromJson(t,e){const i=new m(e);i.borders=t.map((t=>F.fromJson(t,e)));for(const t of i.borders)i.borderMap.set(t.getLocation(),t);return i}constructor(t){this.borders=[],this.borderMap=new Map,this.layoutHorizontal=!0}toJson(){return this.borders.map((t=>t.toJson()))}getLayoutHorizontal(){return this.layoutHorizontal}getBorders(){return this.borders}getBorderMap(){return this.borderMap}forEachNode(t){for(const e of this.borders){t(e,0);for(const i of e.getChildren())i.forEachNode(t,1)}}setPaths(){for(const t of this.borders){const e="/border/"+t.getLocation().getName();t.setPath(e);let i=0;for(const n of t.getChildren())n.setPath(e+"/t"+i),i++}}findDropTargetNode(t,e,i){for(const n of this.borders)if(n.isShowing()){const o=n.canDrop(t,e,i);if(void 0!==o)return o}}}class f{constructor(t){this.model=t,this.attributes={},this.children=[],this.rect=u.empty(),this.listeners=new Map,this.path=""}getId(){let t=this.attributes.id;return void 0!==t||(t=this.model.nextUniqueId(),this.setId(t)),t}getModel(){return this.model}getType(){return this.attributes.type}getParent(){return this.parent}getChildren(){return this.children}getRect(){return this.rect}getPath(){return this.path}getOrientation(){return void 0===this.parent?this.model.isRootOrientationVertical()?c.VERT:c.HORZ:c.flip(this.parent.getOrientation())}setEventListener(t,e){this.listeners.set(t,e)}removeEventListener(t){this.listeners.delete(t)}setId(t){this.attributes.id=t}fireEvent(t,e){this.listeners.has(t)&&this.listeners.get(t)(e)}getAttr(t){let e=this.attributes[t];if(void 0===e){const i=this.getAttributeDefinitions().getModelName(t);void 0!==i&&(e=this.model.getAttribute(i))}return e}forEachNode(t,e){t(this,e),e++;for(const i of this.children)i.forEachNode(t,e)}setPaths(t){let e=0;for(const i of this.children){let n=t;"row"===i.getType()?i.getOrientation()===c.VERT?n+="/c"+e:n+="/r"+e:"tabset"===i.getType()?n+="/ts"+e:"tab"===i.getType()&&(n+="/t"+e),i.path=n,i.setPaths(n),e++}}setParent(t){this.parent=t}setRect(t){this.rect=t}setPath(t){this.path=t}setWeight(t){this.attributes.weight=t}setSelected(t){this.attributes.selected=t}findDropTargetNode(t,e,i,n){let o;if(this.rect.contains(i,n))if(void 0!==this.model.getMaximizedTabset(t))o=this.model.getMaximizedTabset(t).canDrop(e,i,n);else if(o=this.canDrop(e,i,n),void 0===o&&0!==this.children.length)for(const s of this.children)if(o=s.findDropTargetNode(t,e,i,n),void 0!==o)break;return o}canDrop(t,e,i){}canDockInto(t,e){if(null!=e){if(e.location===g.CENTER&&!1===e.node.isEnableDrop())return!1;if(e.location===g.CENTER&&"tabset"===t.getType()&&void 0!==t.getName())return!1;if(e.location!==g.CENTER&&!1===e.node.isEnableDivide())return!1;if(this.model.getOnAllowDrop())return this.model.getOnAllowDrop()(t,e)}return!0}removeChild(t){const e=this.children.indexOf(t);return-1!==e&&this.children.splice(e,1),e}addChild(t,e){return null!=e?this.children.splice(e,0,t):(this.children.push(t),e=this.children.length-1),t.parent=this,e}removeAll(){this.children=[]}styleWithPosition(t){return null==t&&(t={}),this.rect.styleWithPosition(t)}isEnableDivide(){return!0}toAttributeString(){return JSON.stringify(this.attributes,void 0,"\t")}}class O extends f{static fromJson(t,e,i=!0){return new O(e,t,i)}constructor(t,e,i=!0){super(t),this.tabRect=u.empty(),this.extra={},this.moveableElement=null,this.tabStamp=null,this.rendered=!1,this.visible=!1,O.attributeDefinitions.fromJson(e,this.attributes),!0===i&&t.addNode(this)}getName(){return this.getAttr("name")}getHelpText(){return this.getAttr("helpText")}getComponent(){return this.getAttr("component")}getWindowId(){return this.parent instanceof M?this.parent.getWindowId():W.MAIN_WINDOW_ID}getWindow(){const t=this.model.getwindowsMap().get(this.getWindowId());if(t)return t.window}getConfig(){return this.attributes.config}getExtraData(){return this.extra}isPoppedOut(){return this.getWindowId()!==W.MAIN_WINDOW_ID}isSelected(){return this.getParent().getSelectedNode()===this}getIcon(){return this.getAttr("icon")}isEnableClose(){return this.getAttr("enableClose")}getCloseType(){return this.getAttr("closeType")}isEnablePopout(){return this.getAttr("enablePopout")}isEnablePopoutIcon(){return this.getAttr("enablePopoutIcon")}isEnablePopoutOverlay(){return this.getAttr("enablePopoutOverlay")}isEnableDrag(){return this.getAttr("enableDrag")}isEnableRename(){return this.getAttr("enableRename")}isEnableWindowReMount(){return this.getAttr("enableWindowReMount")}getClassName(){return this.getAttr("className")}getContentClassName(){return this.getAttr("contentClassName")}getTabSetClassName(){return this.getAttr("tabsetClassName")}isEnableRenderOnDemand(){return this.getAttr("enableRenderOnDemand")}getMinWidth(){return this.getAttr("minWidth")}getMinHeight(){return this.getAttr("minHeight")}getMaxWidth(){return this.getAttr("maxWidth")}getMaxHeight(){return this.getAttr("maxHeight")}toJson(){const t={};return O.attributeDefinitions.toJson(t,this.attributes),t}saveScrollPosition(){this.moveableElement&&(this.scrollLeft=this.moveableElement.scrollLeft,this.scrollTop=this.moveableElement.scrollTop)}restoreScrollPosition(){this.scrollTop&&requestAnimationFrame((()=>{this.moveableElement&&this.scrollTop&&(this.moveableElement.scrollTop=this.scrollTop,this.moveableElement.scrollLeft=this.scrollLeft)}))}setRect(t){t.equals(this.rect)||(this.fireEvent("resize",{rect:t}),this.rect=t)}setVisible(t){t!==this.visible&&(this.fireEvent("visibility",{visible:t}),this.visible=t)}getScrollTop(){return this.scrollTop}setScrollTop(t){this.scrollTop=t}getScrollLeft(){return this.scrollLeft}setScrollLeft(t){this.scrollLeft=t}isRendered(){return this.rendered}setRendered(t){this.rendered=t}getTabRect(){return this.tabRect}setTabRect(t){this.tabRect=t}getTabStamp(){return this.tabStamp}setTabStamp(t){this.tabStamp=t}getMoveableElement(){return this.moveableElement}setMoveableElement(t){this.moveableElement=t}setRenderedName(t){this.renderedName=t}getNameForOverflowMenu(){const t=this.getAttr("altName");return void 0!==t?t:this.renderedName}setName(t){this.attributes.name=t}delete(){this.parent.remove(this),this.fireEvent("close",{})}updateAttrs(t){O.attributeDefinitions.update(t,this.attributes)}getAttributeDefinitions(){return O.attributeDefinitions}setBorderWidth(t){this.attributes.borderWidth=t}setBorderHeight(t){this.attributes.borderHeight=t}static getAttributeDefinitions(){return O.attributeDefinitions}static createAttributeDefinitions(){const t=new E;return t.add("type",O.TYPE,!0).setType(p.STRING).setFixed(),t.add("id",void 0).setType(p.STRING).setDescription("the unique id of the tab, if left undefined a uuid will be assigned"),t.add("name","[Unnamed Tab]").setType(p.STRING).setDescription("name of tab to be displayed in the tab button"),t.add("altName",void 0).setType(p.STRING).setDescription("if there is no name specifed then this value will be used in the overflow menu"),t.add("helpText",void 0).setType(p.STRING).setDescription("An optional help text for the tab to be displayed upon tab hover."),t.add("component",void 0).setType(p.STRING).setDescription("string identifying which component to run (for factory)"),t.add("config",void 0).setType("any").setDescription("a place to hold json config for the hosted component"),t.add("tabsetClassName",void 0).setType(p.STRING).setDescription("class applied to parent tabset when this is the only tab and it is stretched to fill the tabset"),t.add("enableWindowReMount",!1).setType(p.BOOLEAN).setDescription("if enabled the tab will re-mount when popped out/in"),t.addInherited("enableClose","tabEnableClose").setType(p.BOOLEAN).setDescription("allow user to close tab via close button"),t.addInherited("closeType","tabCloseType").setType("ICloseType").setDescription("see values in ICloseType"),t.addInherited("enableDrag","tabEnableDrag").setType(p.BOOLEAN).setDescription("allow user to drag tab to new location"),t.addInherited("enableRename","tabEnableRename").setType(p.BOOLEAN).setDescription("allow user to rename tabs by double clicking"),t.addInherited("className","tabClassName").setType(p.STRING).setDescription("class applied to tab button"),t.addInherited("contentClassName","tabContentClassName").setType(p.STRING).setDescription("class applied to tab content"),t.addInherited("icon","tabIcon").setType(p.STRING).setDescription("the tab icon"),t.addInherited("enableRenderOnDemand","tabEnableRenderOnDemand").setType(p.BOOLEAN).setDescription("whether to avoid rendering component until tab is visible"),t.addInherited("enablePopout","tabEnablePopout").setType(p.BOOLEAN).setAlias("enableFloat").setDescription("enable popout (in popout capable browser)"),t.addInherited("enablePopoutIcon","tabEnablePopoutIcon").setType(p.BOOLEAN).setDescription("whether to show the popout icon in the tabset header if this tab enables popouts"),t.addInherited("enablePopoutOverlay","tabEnablePopoutOverlay").setType(p.BOOLEAN).setDescription("if this tab will not work correctly in a popout window when the main window is backgrounded (inactive)\n then enabling this option will gray out this tab"),t.addInherited("borderWidth","tabBorderWidth").setType(p.NUMBER).setDescription("width when added to border, -1 will use border size"),t.addInherited("borderHeight","tabBorderHeight").setType(p.NUMBER).setDescription("height when added to border, -1 will use border size"),t.addInherited("minWidth","tabMinWidth").setType(p.NUMBER).setDescription("the min width of this tab"),t.addInherited("minHeight","tabMinHeight").setType(p.NUMBER).setDescription("the min height of this tab"),t.addInherited("maxWidth","tabMaxWidth").setType(p.NUMBER).setDescription("the max width of this tab"),t.addInherited("maxHeight","tabMaxHeight").setType(p.NUMBER).setDescription("the max height of this tab"),t}}function w(){return"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(hover: hover) and (pointer: fine)").matches}function R(t,e,i){let n,o=e.getName(),s=e.getName();void 0===i&&(i=0),void 0===n&&void 0!==e.getIcon()&&(n=0!==i?l.createElement("img",{style:{width:"1em",height:"1em",transform:"rotate("+i+"deg)"},src:e.getIcon(),alt:"leadingContent"}):l.createElement("img",{style:{width:"1em",height:"1em"},src:e.getIcon(),alt:"leadingContent"}));const a={leading:n,content:o,name:s,buttons:[]};return t.customizeTab(e,a),e.setRenderedName(a.name),a}function A(t){let e=!1;return t.nativeEvent instanceof MouseEvent&&(0!==t.nativeEvent.button||t.ctrlKey||t.altKey||t.metaKey||t.shiftKey)&&(e=!0),e}function L(t,e){const i=[...y("iframe",e),...y("webview",e)];for(const e of i)e.style.pointerEvents=t?"auto":"none"}function y(t,e){return[...e.getElementsByTagName(t)]}function v(t){if(t instanceof O)return t.isEnablePopout();if(t instanceof M){for(const e of t.getChildren())if(!1===e.isEnablePopout())return!1;return!0}return!1}function N(t){const e=window.screen.availWidth,i=window.screen.availHeight;return t.x>=0&&t.getRight()<=e&&t.y>=0||t.getBottom()<=i}function D(t,e){const i=t.getAttribute("style");return i!==e.getAttribute("style")&&(i?e.setAttribute("style",i):e.removeAttribute("style"),!0)}function x(t,e){if(void 0!==t&&(t instanceof M||t instanceof F)){const i=t.getSelected();-1!==i&&(e===i&&t.getChildren().length>0?e>=t.getChildren().length&&t.setSelected(t.getChildren().length-1):e<i?t.setSelected(i-1):e>i||t.setSelected(-1))}}function S(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(t=>(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16)))}O.TYPE="tab",O.attributeDefinitions=O.createAttributeDefinitions();class M extends f{static fromJson(t,e,i){const n=new M(e,t);if(null!=t.children)for(const i of t.children){const t=O.fromJson(i,e);n.addChild(t)}return 0===n.children.length&&n.setSelected(-1),t.maximized&&!0===t.maximized&&(i.maximizedTabSet=n),t.active&&!0===t.active&&(i.activeTabSet=n),n}constructor(t,e){super(t),this.tabStripRect=u.empty(),this.contentRect=u.empty(),this.calculatedMinHeight=0,this.calculatedMinWidth=0,this.calculatedMaxHeight=0,this.calculatedMaxWidth=0,M.attributeDefinitions.fromJson(e,this.attributes),t.addNode(this)}getName(){return this.getAttr("name")}isEnableActiveIcon(){return this.getAttr("enableActiveIcon")}getSelected(){const t=this.attributes.selected;return void 0!==t?t:-1}getSelectedNode(){const t=this.getSelected();if(-1!==t)return this.children[t]}getWeight(){return this.getAttr("weight")}getAttrMinWidth(){return this.getAttr("minWidth")}getAttrMinHeight(){return this.getAttr("minHeight")}getMinWidth(){return this.calculatedMinWidth}getMinHeight(){return this.calculatedMinHeight}getMinSize(t){return t===c.HORZ?this.getMinWidth():this.getMinHeight()}getAttrMaxWidth(){return this.getAttr("maxWidth")}getAttrMaxHeight(){return this.getAttr("maxHeight")}getMaxWidth(){return this.calculatedMaxWidth}getMaxHeight(){return this.calculatedMaxHeight}getMaxSize(t){return t===c.HORZ?this.getMaxWidth():this.getMaxHeight()}getConfig(){return this.attributes.config}isMaximized(){return this.model.getMaximizedTabset(this.getWindowId())===this}isActive(){return this.model.getActiveTabset(this.getWindowId())===this}isEnableDeleteWhenEmpty(){return this.getAttr("enableDeleteWhenEmpty")}isEnableDrop(){return this.getAttr("enableDrop")}isEnableTabWrap(){return this.getAttr("enableTabWrap")}isEnableDrag(){return this.getAttr("enableDrag")}isEnableDivide(){return this.getAttr("enableDivide")}isEnableMaximize(){return this.getAttr("enableMaximize")}isEnableClose(){return this.getAttr("enableClose")}isEnableSingleTabStretch(){return this.getAttr("enableSingleTabStretch")}isEnableTabStrip(){return this.getAttr("enableTabStrip")}isAutoSelectTab(){return this.getAttr("autoSelectTab")}getClassNameTabStrip(){return this.getAttr("classNameTabStrip")}getTabLocation(){return this.getAttr("tabLocation")}toJson(){const t={};return M.attributeDefinitions.toJson(t,this.attributes),t.children=this.children.map((t=>t.toJson())),this.isActive()&&(t.active=!0),this.isMaximized()&&(t.maximized=!0),t}calcMinMaxSize(){this.calculatedMinHeight=this.getAttrMinHeight(),this.calculatedMinWidth=this.getAttrMinWidth(),this.calculatedMaxHeight=this.getAttrMaxHeight(),this.calculatedMaxWidth=this.getAttrMaxWidth();for(const t of this.children){const e=t;this.calculatedMinWidth=Math.max(this.calculatedMinWidth,e.getMinWidth()),this.calculatedMinHeight=Math.max(this.calculatedMinHeight,e.getMinHeight()),this.calculatedMaxWidth=Math.min(this.calculatedMaxWidth,e.getMaxWidth()),this.calculatedMaxHeight=Math.min(this.calculatedMaxHeight,e.getMaxHeight())}this.calculatedMinHeight+=this.tabStripRect.height,this.calculatedMaxHeight+=this.tabStripRect.height}canMaximize(){return!!this.isEnableMaximize()&&(this.getModel().getMaximizedTabset(this.getWindowId())===this||this.getParent()!==this.getModel().getRoot(this.getWindowId())||1!==this.getModel().getRoot(this.getWindowId()).getChildren().length)}setContentRect(t){this.contentRect=t}getContentRect(){return this.contentRect}setTabStripRect(t){this.tabStripRect=t}setWeight(t){this.attributes.weight=t}setSelected(t){this.attributes.selected=t}getWindowId(){return this.parent.getWindowId()}canDrop(t,e,i){let n;if(t===this){const t=g.CENTER,e=this.tabStripRect;n=new b(this,e,t,-1,r.FLEXLAYOUT__OUTLINE_RECT)}else{if(this.getWindowId()!==W.MAIN_WINDOW_ID&&!v(t))return;if(this.contentRect.contains(e,i)){let t=g.CENTER;void 0===this.model.getMaximizedTabset(this.parent.getWindowId())&&(t=g.getLocation(this.contentRect,e,i));const o=t.getDockRect(this.rect);n=new b(this,o,t,-1,r.FLEXLAYOUT__OUTLINE_RECT)}else if(null!=this.tabStripRect&&this.tabStripRect.contains(e,i)){let t,o,s;if(0===this.children.length)t=this.tabStripRect.clone(),o=t.y+3,s=t.height-4,t.width=2;else{let a=this.children[0];t=a.getTabRect(),o=t.y,s=t.height;let l=this.tabStripRect.x,d=0;for(let s=0;s<this.children.length;s++){if(a=this.children[s],t=a.getTabRect(),t.y!==o&&(o=t.y,l=this.tabStripRect.x),d=t.x+t.width/2,e>=l&&e<d&&i>t.y&&i<t.getBottom()){const e=g.CENTER,i=new u(t.x-2,t.y,3,t.height);n=new b(this,i,e,s,r.FLEXLAYOUT__OUTLINE_RECT);break}l=d}}if(null==n){const e=g.CENTER,i=new u(t.getRight()-2,o,3,s);n=new b(this,i,e,this.children.length,r.FLEXLAYOUT__OUTLINE_RECT)}}}if(t.canDockInto(t,n))return n}delete(){this.parent.removeChild(this)}remove(t){const e=this.removeChild(t);this.model.tidy(),x(this,e)}drop(t,e,i,n){const o=e;if(this===t)return;let s=t.getParent(),a=0;if(void 0!==s&&(a=s.removeChild(t),s instanceof F&&s.getSelected()===a?s.setSelected(-1):x(s,a)),t instanceof O&&s===this&&a<i&&i>0&&i--,o===g.CENTER){let e=i;if(-1===e&&(e=this.children.length),t instanceof O)this.addChild(t,e),(n||!1!==n&&this.isAutoSelectTab())&&this.setSelected(e);else if(t instanceof I)t.forEachNode(((t,i)=>{t instanceof O&&(this.addChild(t,e),e++)}),0);else{for(let i=0;i<t.getChildren().length;i++){const n=t.getChildren()[i];this.addChild(n,e),e++}-1===this.getSelected()&&this.children.length>0&&this.setSelected(0)}this.model.setActiveTabset(this,this.parent.getWindowId())}else{let i=t;if(t instanceof O){const e=this.model.getOnCreateTabSet();i=new M(this.model,e?e(t):{}),i.addChild(t),s=i}else if(t instanceof I){const n=this.getParent();if(t.getOrientation()===n.getOrientation()&&(e.getOrientation()===n.getOrientation()||e===g.CENTER)){const e=new I(this.model,this.getWindowId(),{});e.addChild(t),i=e}}else i=t;const n=this.parent,a=n.getChildren().indexOf(this);if(n.getOrientation()===o.orientation)i.setWeight(this.getWeight()/2),this.setWeight(this.getWeight()/2),n.addChild(i,a+o.indexPlus);else{const t=new I(this.model,this.getWindowId(),{});t.setWeight(this.getWeight()),t.addChild(this),this.setWeight(50),i.setWeight(50),t.addChild(i,o.indexPlus),n.removeChild(this),n.addChild(t,a)}i instanceof M&&this.model.setActiveTabset(i,this.getWindowId())}this.model.tidy()}updateAttrs(t){M.attributeDefinitions.update(t,this.attributes)}getAttributeDefinitions(){return M.attributeDefinitions}static getAttributeDefinitions(){return M.attributeDefinitions}static createAttributeDefinitions(){const t=new E;return t.add("type",M.TYPE,!0).setType(p.STRING).setFixed(),t.add("id",void 0).setType(p.STRING).setDescription("the unique id of the tab set, if left undefined a uuid will be assigned"),t.add("weight",100).setType(p.NUMBER).setDescription("relative weight for sizing of this tabset in parent row"),t.add("selected",0).setType(p.NUMBER).setDescription("index of selected/visible tab in tabset"),t.add("name",void 0).setType(p.STRING),t.add("config",void 0).setType("any").setDescription("a place to hold json config used in your own code"),t.addInherited("enableDeleteWhenEmpty","tabSetEnableDeleteWhenEmpty").setDescription("whether to delete this tabset when is has no tabs"),t.addInherited("enableDrop","tabSetEnableDrop").setDescription("allow user to drag tabs into this tabset"),t.addInherited("enableDrag","tabSetEnableDrag").setDescription("allow user to drag tabs out this tabset"),t.addInherited("enableDivide","tabSetEnableDivide").setDescription("allow user to drag tabs to region of this tabset, splitting into new tabset"),t.addInherited("enableMaximize","tabSetEnableMaximize").setDescription("allow user to maximize tabset to fill view via maximize button"),t.addInherited("enableClose","tabSetEnableClose").setDescription("allow user to close tabset via a close button"),t.addInherited("enableSingleTabStretch","tabSetEnableSingleTabStretch").setDescription("if the tabset has only a single tab then stretch the single tab to fill area and display in a header style"),t.addInherited("classNameTabStrip","tabSetClassNameTabStrip").setDescription("a class name to apply to the tab strip"),t.addInherited("enableTabStrip","tabSetEnableTabStrip").setDescription("enable tab strip and allow multiple tabs in this tabset"),t.addInherited("minWidth","tabSetMinWidth").setDescription("minimum width (in px) for this tabset"),t.addInherited("minHeight","tabSetMinHeight").setDescription("minimum height (in px) for this tabset"),t.addInherited("maxWidth","tabSetMaxWidth").setDescription("maximum width (in px) for this tabset"),t.addInherited("maxHeight","tabSetMaxHeight").setDescription("maximum height (in px) for this tabset"),t.addInherited("enableTabWrap","tabSetEnableTabWrap").setDescription("show tabs in location top or bottom"),t.addInherited("tabLocation","tabSetTabLocation").setDescription("the location of the tabs either top or bottom"),t.addInherited("autoSelectTab","tabSetAutoSelectTab").setType(p.BOOLEAN).setDescription("whether to select new/moved tabs in tabset"),t.addInherited("enableActiveIcon","tabSetEnableActiveIcon").setType(p.BOOLEAN).setDescription("whether the active icon (*) should be displayed when the tabset is active"),t}}M.TYPE="tabset",M.attributeDefinitions=M.createAttributeDefinitions();class I extends f{static fromJson(t,e,i){const n=new I(e,i.windowId,t);if(null!=t.children)for(const o of t.children)if(o.type===M.TYPE){const t=M.fromJson(o,e,i);n.addChild(t)}else{const t=I.fromJson(o,e,i);n.addChild(t)}return n}constructor(t,e,i){super(t),this.windowId=e,this.minHeight=C,this.minWidth=C,this.maxHeight=U,this.maxWidth=U,I.attributeDefinitions.fromJson(i,this.attributes),this.normalizeWeights(),t.addNode(this)}getWeight(){return this.attributes.weight}toJson(){const t={};I.attributeDefinitions.toJson(t,this.attributes),t.children=[];for(const e of this.children)t.children.push(e.toJson());return t}getWindowId(){return this.windowId}setWindowId(t){this.windowId=t}setWeight(t){this.attributes.weight=t}getSplitterBounds(t){const e=this.getOrientation()===c.HORZ,i=this.getChildren(),n=this.model.getSplitterSize(),o=i[0].getRect(),s=i[i.length-1].getRect();let a=e?[o.x,s.getRight()]:[o.y,s.getBottom()];const r=e?[o.x,s.getRight()]:[o.y,s.getBottom()];for(let o=0;o<t;o++){const t=i[o];a[0]+=e?t.getMinWidth():t.getMinHeight(),r[0]+=e?t.getMaxWidth():t.getMaxHeight(),o>0&&(a[0]+=n,r[0]+=n)}for(let o=i.length-1;o>=t;o--){const t=i[o];a[1]-=(e?t.getMinWidth():t.getMinHeight())+n,r[1]-=(e?t.getMaxWidth():t.getMaxHeight())+n}return a=[Math.max(r[1],a[0]),Math.min(r[0],a[1])],a}getSplitterInitials(t){const e=this.getOrientation()===c.HORZ,i=this.getChildren(),n=this.model.getSplitterSize(),o=[];let s=0;for(let t=0;t<i.length;t++){const n=i[t].getRect(),a=e?n.width:n.height;o.push(a),s+=a}const a=i[t].getRect();return{initialSizes:o,sum:s,startPosition:(e?a.x:a.y)-n}}calculateSplit(t,e,i,n,o){const s=this.getOrientation()===c.HORZ,a=this.getChildren(),r=a[t],l=s?r.getMaxWidth():r.getMaxHeight(),d=[...i];if(e<o){let i=o-e,n=0;d[t]+i>l?(n=d[t]+i-l,d[t]=l):d[t]+=i;for(let e=t-1;e>=0;e--){const t=a[e],n=s?t.getMinWidth():t.getMinHeight();if(d[e]-i>n){d[e]-=i;break}i-=d[e]-n,d[e]=n}for(let e=t+1;e<a.length;e++){const t=a[e],i=s?t.getMaxWidth():t.getMaxHeight();if(d[e]+n<i){d[e]+=n;break}n-=i-d[e],d[e]=i}}else{let i=e-o,n=0;d[t-1]+i>l?(n=d[t-1]+i-l,d[t-1]=l):d[t-1]+=i;for(let e=t;e<a.length;e++){const t=a[e],n=s?t.getMinWidth():t.getMinHeight();if(d[e]-i>n){d[e]-=i;break}i-=d[e]-n,d[e]=n}for(let e=t-1;e>=0;e--){const t=a[e],i=s?t.getMaxWidth():t.getMaxHeight();if(d[e]+n<i){d[e]+=n;break}n-=i-d[e],d[e]=i}}return d.map((t=>100*Math.max(.1,t)/n))}getMinSize(t){return t===c.HORZ?this.getMinWidth():this.getMinHeight()}getMinWidth(){return this.minWidth}getMinHeight(){return this.minHeight}getMaxSize(t){return t===c.HORZ?this.getMaxWidth():this.getMaxHeight()}getMaxWidth(){return this.maxWidth}getMaxHeight(){return this.maxHeight}calcMinMaxSize(){this.minHeight=C,this.minWidth=C,this.maxHeight=U,this.maxWidth=U;let t=!0;for(const e of this.children){const i=e;i.calcMinMaxSize(),this.getOrientation()===c.VERT?(this.minHeight+=i.getMinHeight(),this.maxHeight+=i.getMaxHeight(),t||(this.minHeight+=this.model.getSplitterSize(),this.maxHeight+=this.model.getSplitterSize()),this.minWidth=Math.max(this.minWidth,i.getMinWidth()),this.maxWidth=Math.min(this.maxWidth,i.getMaxWidth())):(this.minWidth+=i.getMinWidth(),this.maxWidth+=i.getMaxWidth(),t||(this.minWidth+=this.model.getSplitterSize(),this.maxWidth+=this.model.getSplitterSize()),this.minHeight=Math.max(this.minHeight,i.getMinHeight()),this.maxHeight=Math.min(this.maxHeight,i.getMaxHeight())),t=!1}}tidy(){let t=0;for(;t<this.children.length;){const e=this.children[t];if(e instanceof I){e.tidy();const i=e.getChildren();if(0===i.length)this.removeChild(e);else if(1===i.length){const n=i[0];if(this.removeChild(e),n instanceof I){let i=0;const o=n.getChildren();for(const t of o)i+=t.getWeight();for(let n=0;n<o.length;n++){const s=o[n];s.setWeight(e.getWeight()*s.getWeight()/i),this.addChild(s,t+n)}}else n.setWeight(e.getWeight()),this.addChild(n,t)}else t++}else e instanceof M&&0===e.getChildren().length&&e.isEnableDeleteWhenEmpty()?(this.removeChild(e),e===this.model.getMaximizedTabset(this.windowId)&&this.model.setMaximizedTabset(void 0,this.windowId)):t++}if(this===this.model.getRoot(this.windowId)&&0===this.children.length){const t=this.model.getOnCreateTabSet();let e=t?t():{};e=Object.assign(Object.assign({},e),{selected:-1});const i=new M(this.model,e);this.model.setActiveTabset(i,this.windowId),this.addChild(i)}}canDrop(t,e,i){const n=i-this.rect.y,o=e-this.rect.x,s=this.rect.width,a=this.rect.height,l=50;let d;if(this.getWindowId()===W.MAIN_WINDOW_ID||v(t)){if(this.model.isEnableEdgeDock()&&void 0===this.parent){if(e<this.rect.x+10&&n>a/2-l&&n<a/2+l){const t=g.LEFT,e=t.getDockRect(this.rect);e.width=e.width/2,d=new b(this,e,t,-1,r.FLEXLAYOUT__OUTLINE_RECT_EDGE)}else if(e>this.rect.getRight()-10&&n>a/2-l&&n<a/2+l){const t=g.RIGHT,e=t.getDockRect(this.rect);e.width=e.width/2,e.x+=e.width,d=new b(this,e,t,-1,r.FLEXLAYOUT__OUTLINE_RECT_EDGE)}else if(i<this.rect.y+10&&o>s/2-l&&o<s/2+l){const t=g.TOP,e=t.getDockRect(this.rect);e.height=e.height/2,d=new b(this,e,t,-1,r.FLEXLAYOUT__OUTLINE_RECT_EDGE)}else if(i>this.rect.getBottom()-10&&o>s/2-l&&o<s/2+l){const t=g.BOTTOM,e=t.getDockRect(this.rect);e.height=e.height/2,e.y+=e.height,d=new b(this,e,t,-1,r.FLEXLAYOUT__OUTLINE_RECT_EDGE)}if(void 0!==d&&!t.canDockInto(t,d))return}return d}}drop(t,e,i){const n=e,o=t.getParent();let s;if(o&&o.removeChild(t),void 0!==o&&o instanceof M&&o.setSelected(0),void 0!==o&&o instanceof F&&o.setSelected(-1),t instanceof M||t instanceof I)s=t,s instanceof I&&s.getOrientation()===this.getOrientation()&&(e.getOrientation()===this.getOrientation()||e===g.CENTER)&&(s=new I(this.model,this.windowId,{}),s.addChild(t));else{const e=this.model.getOnCreateTabSet();s=new M(this.model,e?e(t):{}),s.addChild(t)}let a=this.children.reduce(((t,e)=>t+e.getWeight()),0);0===a&&(a=100),s.setWeight(a/3);const r=!this.model.isRootOrientationVertical();if(n===g.CENTER)-1===i?this.addChild(s,this.children.length):this.addChild(s,i);else if(r&&n===g.LEFT||!r&&n===g.TOP)this.addChild(s,0);else if(r&&n===g.RIGHT||!r&&n===g.BOTTOM)this.addChild(s);else if(r&&n===g.TOP||!r&&n===g.LEFT){const t=new I(this.model,this.windowId,{}),e=new I(this.model,this.windowId,{});e.setWeight(75),s.setWeight(25);for(const t of this.children)e.addChild(t);this.removeAll(),t.addChild(s),t.addChild(e),this.addChild(t)}else if(r&&n===g.BOTTOM||!r&&n===g.RIGHT){const t=new I(this.model,this.windowId,{}),e=new I(this.model,this.windowId,{});e.setWeight(75),s.setWeight(25);for(const t of this.children)e.addChild(t);this.removeAll(),t.addChild(e),t.addChild(s),this.addChild(t)}s instanceof M&&this.model.setActiveTabset(s,this.windowId),this.model.tidy()}isEnableDrop(){return!0}getAttributeDefinitions(){return I.attributeDefinitions}updateAttrs(t){I.attributeDefinitions.update(t,this.attributes)}static getAttributeDefinitions(){return I.attributeDefinitions}normalizeWeights(){let t=0;for(const e of this.children)t+=e.getWeight();0===t&&(t=1);for(const e of this.children){const i=e;i.setWeight(Math.max(.001,100*i.getWeight()/t))}}static createAttributeDefinitions(){const t=new E;return t.add("type",I.TYPE,!0).setType(p.STRING).setFixed(),t.add("id",void 0).setType(p.STRING).setDescription("the unique id of the row, if left undefined a uuid will be assigned"),t.add("weight",100).setType(p.NUMBER).setDescription("relative weight for sizing of this row in parent row"),t}}I.TYPE="row",I.attributeDefinitions=I.createAttributeDefinitions();class B{constructor(t,e){this._windowId=t,this._rect=e,this._toScreenRectFunction=t=>t}visitNodes(t){this.root.forEachNode(t,0)}get windowId(){return this._windowId}get rect(){return this._rect}get layout(){return this._layout}get window(){return this._window}get root(){return this._root}get maximizedTabSet(){return this._maximizedTabSet}get activeTabSet(){return this._activeTabSet}set rect(t){this._rect=t}set layout(t){this._layout=t}set window(t){this._window=t}set root(t){this._root=t}set maximizedTabSet(t){this._maximizedTabSet=t}set activeTabSet(t){this._activeTabSet=t}get toScreenRectFunction(){return this._toScreenRectFunction}set toScreenRectFunction(t){this._toScreenRectFunction=t}toJson(){return this._window&&this._window.screenTop>-1e4&&(this.rect=new u(this._window.screenLeft,this._window.screenTop,this._window.outerWidth,this._window.outerHeight)),{layout:this.root.toJson(),rect:this.rect.toJson()}}static fromJson(t,e,i){const n=e.getwindowsMap().size;let o=t.rect?u.fromJson(t.rect):new u(50+50*n,50+50*n,600,400);o=function(t){t.snap(10);const e=window.screen.availWidth,i=window.screen.availHeight;return(t.x+t.width>e||t.y+t.height>i)&&(t.x=Math.max(0,Math.min(t.x,e-t.width)),t.y=Math.max(0,Math.min(t.y,i-t.height))),t}(o);const s=new B(i,o);return s.root=I.fromJson(t.layout,e,s),s}}const C=0,U=99999;class W{constructor(){this.attributes={},this.idMap=new Map,this.borders=new m(this),this.windows=new Map,this.rootWindow=new B(W.MAIN_WINDOW_ID,u.empty()),this.windows.set(W.MAIN_WINDOW_ID,this.rootWindow),this.changeListeners=[]}doAction(t){var e;let i;switch(t.type){case _.ADD_NODE:{const e=new O(this,t.data.json,!0),n=this.idMap.get(t.data.toNode);(n instanceof M||n instanceof F||n instanceof I)&&(n.drop(e,g.getByName(t.data.location),t.data.index,t.data.select),i=e);break}case _.MOVE_NODE:{const e=this.idMap.get(t.data.fromNode);if(e instanceof O||e instanceof M||e instanceof I){e===this.getMaximizedTabset(e.getWindowId())&&(this.windows.get(e.getWindowId()).maximizedTabSet=void 0);const i=this.idMap.get(t.data.toNode);(i instanceof M||i instanceof F||i instanceof I)&&i.drop(e,g.getByName(t.data.location),t.data.index,t.data.select)}this.removeEmptyWindows();break}case _.DELETE_TAB:{const e=this.idMap.get(t.data.node);e instanceof O&&e.delete(),this.removeEmptyWindows();break}case _.DELETE_TABSET:{const e=this.idMap.get(t.data.node);if(e instanceof M){const t=[...e.getChildren()];for(let e=0;e<t.length;e++){const i=t[e];i.isEnableClose()&&i.delete()}0===e.getChildren().length&&e.delete(),this.tidy()}this.removeEmptyWindows();break}case _.POPOUT_TABSET:{const e=this.idMap.get(t.data.node);if(e instanceof M){const t=e.isMaximized(),i=this.windows.get(e.getWindowId()),n=S(),o=new B(n,i.toScreenRectFunction(e.getRect())),s={type:"row",children:[]},a=I.fromJson(s,this,o);o.root=a,this.windows.set(n,o),a.drop(e,g.CENTER,0),t&&(this.rootWindow.maximizedTabSet=void 0)}this.removeEmptyWindows();break}case _.POPOUT_TAB:{const e=this.idMap.get(t.data.node);if(e instanceof O){const t=S();let i=u.empty();i=e.getParent()instanceof M?e.getParent().getRect():e.getParent().getContentRect();const n=this.windows.get(e.getWindowId()),o=new B(t,n.toScreenRectFunction(i)),s=S(),a={type:"row",children:[{type:"tabset",id:s}]},r=I.fromJson(a,this,o);o.root=r,this.windows.set(t,o),this.idMap.get(s).drop(e,g.CENTER,0,!0)}this.removeEmptyWindows();break}case _.CLOSE_WINDOW:{const i=this.windows.get(t.data.windowId);i&&(null===(e=this.rootWindow.root)||void 0===e||e.drop(null==i?void 0:i.root,g.CENTER,-1),this.rootWindow.visitNodes(((t,e)=>{t instanceof I&&t.setWindowId(W.MAIN_WINDOW_ID)})),this.windows.delete(t.data.windowId));break}case _.CREATE_WINDOW:{const e=S(),n=new B(e,u.fromJson(t.data.rect)),o=I.fromJson(t.data.layout,this,n);n.root=o,this.windows.set(e,n),i=e;break}case _.RENAME_TAB:{const e=this.idMap.get(t.data.node);e instanceof O&&e.setName(t.data.text);break}case _.SELECT_TAB:{const e=this.idMap.get(t.data.tabNode),i=t.data.windowId?t.data.windowId:W.MAIN_WINDOW_ID,n=this.windows.get(i);if(e instanceof O){const t=e.getParent(),i=t.getChildren().indexOf(e);t instanceof F?t.getSelected()===i?t.setSelected(-1):t.setSelected(i):t instanceof M&&(t.getSelected()!==i&&t.setSelected(i),n.activeTabSet=t)}break}case _.SET_ACTIVE_TABSET:{const e=t.data.windowId?t.data.windowId:W.MAIN_WINDOW_ID,i=this.windows.get(e);if(void 0===t.data.tabsetNode)i.activeTabSet=void 0;else{const e=this.idMap.get(t.data.tabsetNode);e instanceof M&&(i.activeTabSet=e)}break}case _.ADJUST_WEIGHTS:{const e=this.idMap.get(t.data.nodeId).getChildren();for(let i=0;i<e.length;i++)e[i].setWeight(t.data.weights[i]);break}case _.ADJUST_BORDER_SPLIT:{const e=this.idMap.get(t.data.node);e instanceof F&&e.setSize(t.data.pos);break}case _.MAXIMIZE_TOGGLE:{const e=t.data.windowId?t.data.windowId:W.MAIN_WINDOW_ID,i=this.windows.get(e),n=this.idMap.get(t.data.node);n instanceof M&&(n===i.maximizedTabSet?i.maximizedTabSet=void 0:(i.maximizedTabSet=n,i.activeTabSet=n));break}case _.UPDATE_MODEL_ATTRIBUTES:this.updateAttrs(t.data.json);break;case _.UPDATE_NODE_ATTRIBUTES:this.idMap.get(t.data.node).updateAttrs(t.data.json)}this.updateIdMap();for(const e of this.changeListeners)e(t);return i}getActiveTabset(t=W.MAIN_WINDOW_ID){const e=this.windows.get(t);return e&&e.activeTabSet&&this.getNodeById(e.activeTabSet.getId())?e.activeTabSet:void 0}getMaximizedTabset(t=W.MAIN_WINDOW_ID){return this.windows.get(t).maximizedTabSet}getRoot(t=W.MAIN_WINDOW_ID){return this.windows.get(t).root}isRootOrientationVertical(){return this.attributes.rootOrientationVertical}isEnableRotateBorderIcons(){return this.attributes.enableRotateBorderIcons}getBorderSet(){return this.borders}getwindowsMap(){return this.windows}visitNodes(t){this.borders.forEachNode(t);for(const[e,i]of this.windows)i.root.forEachNode(t,0)}visitWindowNodes(t,e){this.windows.has(t)&&(t===W.MAIN_WINDOW_ID&&this.borders.forEachNode(e),this.windows.get(t).visitNodes(e))}getNodeById(t){return this.idMap.get(t)}getFirstTabSet(t=this.windows.get(W.MAIN_WINDOW_ID).root){const e=t.getChildren()[0];return e instanceof M?e:this.getFirstTabSet(e)}static fromJson(t){const e=new W;if(W.attributeDefinitions.fromJson(t.global,e.attributes),t.borders&&(e.borders=m.fromJson(t.borders,e)),t.popouts){let i=0,n=100,o=100;for(const s in t.popouts){const a=t.popouts[s],r=B.fromJson(a,e,s);e.windows.set(s,r),N(r.rect)||(r.rect=new u(n+50*i,o+50*i,600,400),i++)}}return e.rootWindow.root=I.fromJson(t.layout,e,e.getwindowsMap().get(W.MAIN_WINDOW_ID)),e.tidy(),e}toJson(){const t={};W.attributeDefinitions.toJson(t,this.attributes),this.visitNodes((t=>{t.fireEvent("save",{})}));const e={};for(const[t,i]of this.windows)t!==W.MAIN_WINDOW_ID&&(e[t]=i.toJson());return{global:t,borders:this.borders.toJson(),layout:this.rootWindow.root.toJson(),popouts:e}}getSplitterSize(){return this.attributes.splitterSize}getSplitterExtra(){return this.attributes.splitterExtra}isEnableEdgeDock(){return this.attributes.enableEdgeDock}isSplitterEnableHandle(){return this.attributes.splitterEnableHandle}setOnAllowDrop(t){this.onAllowDrop=t}setOnCreateTabSet(t){this.onCreateTabSet=t}addChangeListener(t){this.changeListeners.push(t)}removeChangeListener(t){const e=this.changeListeners.findIndex((e=>e===t));-1!==e&&this.changeListeners.splice(e,1)}toString(){return JSON.stringify(this.toJson())}removeEmptyWindows(){const t=new Set;for(const[e]of this.windows)if(e!==W.MAIN_WINDOW_ID){let i=0;this.visitWindowNodes(e,(t=>{t instanceof O&&i++})),0===i&&t.add(e)}for(const e of t)this.windows.delete(e)}setActiveTabset(t,e){const i=this.windows.get(e);i&&(i.activeTabSet=t||void 0)}setMaximizedTabset(t,e){const i=this.windows.get(e);i&&(i.maximizedTabSet=t||void 0)}updateIdMap(){this.idMap.clear(),this.visitNodes((t=>{this.idMap.set(t.getId(),t)}))}addNode(t){const e=t.getId();if(this.idMap.has(e))throw new Error(`Error: each node must have a unique id, duplicate id:${t.getId()}`);this.idMap.set(e,t)}findDropTargetNode(t,e,i,n){let o=this.windows.get(t).root.findDropTargetNode(t,e,i,n);return void 0===o&&t===W.MAIN_WINDOW_ID&&(o=this.borders.findDropTargetNode(e,i,n)),o}tidy(){for(const[t,e]of this.windows)e.root.tidy()}updateAttrs(t){W.attributeDefinitions.update(t,this.attributes)}nextUniqueId(){return"#"+S()}getAttribute(t){return this.attributes[t]}getOnAllowDrop(){return this.onAllowDrop}getOnCreateTabSet(){return this.onCreateTabSet}static toTypescriptInterfaces(){W.attributeDefinitions.pairAttributes("RowNode",I.getAttributeDefinitions()),W.attributeDefinitions.pairAttributes("TabSetNode",M.getAttributeDefinitions()),W.attributeDefinitions.pairAttributes("TabNode",O.getAttributeDefinitions()),W.attributeDefinitions.pairAttributes("BorderNode",F.getAttributeDefinitions());let t=[];t.push(W.attributeDefinitions.toTypescriptInterface("Global",void 0)),t.push(I.getAttributeDefinitions().toTypescriptInterface("Row",W.attributeDefinitions)),t.push(M.getAttributeDefinitions().toTypescriptInterface("TabSet",W.attributeDefinitions)),t.push(O.getAttributeDefinitions().toTypescriptInterface("Tab",W.attributeDefinitions)),t.push(F.getAttributeDefinitions().toTypescriptInterface("Border",W.attributeDefinitions)),console.log(t.join("\n"))}static createAttributeDefinitions(){const t=new E;return t.add("enableEdgeDock",!0).setType(p.BOOLEAN).setDescription("enable docking to the edges of the layout, this will show the edge indicators"),t.add("rootOrientationVertical",!1).setType(p.BOOLEAN).setDescription("the top level 'row' will layout horizontally by default, set this option true to make it layout vertically"),t.add("enableRotateBorderIcons",!0).setType(p.BOOLEAN).setDescription("boolean indicating if tab icons should rotate with the text in the left and right borders"),t.add("splitterSize",8).setType(p.NUMBER).setDescription("width in pixels of all splitters between tabsets/borders"),t.add("splitterExtra",0).setType(p.NUMBER).setDescription("additional width in pixels of the splitter hit test area"),t.add("splitterEnableHandle",!1).setType(p.BOOLEAN).setDescription("enable a small centralized handle on all splitters"),t.add("tabEnableClose",!0).setType(p.BOOLEAN),t.add("tabCloseType",1).setType("ICloseType"),t.add("tabEnablePopout",!1).setType(p.BOOLEAN).setAlias("tabEnableFloat"),t.add("tabEnablePopoutIcon",!0).setType(p.BOOLEAN),t.add("tabEnablePopoutOverlay",!1).setType(p.BOOLEAN),t.add("tabEnableDrag",!0).setType(p.BOOLEAN),t.add("tabEnableRename",!0).setType(p.BOOLEAN),t.add("tabContentClassName",void 0).setType(p.STRING),t.add("tabClassName",void 0).setType(p.STRING),t.add("tabIcon",void 0).setType(p.STRING),t.add("tabEnableRenderOnDemand",!0).setType(p.BOOLEAN),t.add("tabDragSpeed",.3).setType(p.NUMBER),t.add("tabBorderWidth",-1).setType(p.NUMBER),t.add("tabBorderHeight",-1).setType(p.NUMBER),t.add("tabSetEnableDeleteWhenEmpty",!0).setType(p.BOOLEAN),t.add("tabSetEnableDrop",!0).setType(p.BOOLEAN),t.add("tabSetEnableDrag",!0).setType(p.BOOLEAN),t.add("tabSetEnableDivide",!0).setType(p.BOOLEAN),t.add("tabSetEnableMaximize",!0).setType(p.BOOLEAN),t.add("tabSetEnableClose",!1).setType(p.BOOLEAN),t.add("tabSetEnableSingleTabStretch",!1).setType(p.BOOLEAN),t.add("tabSetAutoSelectTab",!0).setType(p.BOOLEAN),t.add("tabSetEnableActiveIcon",!1).setType(p.BOOLEAN),t.add("tabSetClassNameTabStrip",void 0).setType(p.STRING),t.add("tabSetEnableTabStrip",!0).setType(p.BOOLEAN),t.add("tabSetEnableTabWrap",!1).setType(p.BOOLEAN),t.add("tabSetTabLocation","top").setType("ITabLocation"),t.add("tabMinWidth",C).setType(p.NUMBER),t.add("tabMinHeight",C).setType(p.NUMBER),t.add("tabSetMinWidth",C).setType(p.NUMBER),t.add("tabSetMinHeight",C).setType(p.NUMBER),t.add("tabMaxWidth",U).setType(p.NUMBER),t.add("tabMaxHeight",U).setType(p.NUMBER),t.add("tabSetMaxWidth",U).setType(p.NUMBER),t.add("tabSetMaxHeight",U).setType(p.NUMBER),t.add("borderSize",200).setType(p.NUMBER),t.add("borderMinSize",C).setType(p.NUMBER),t.add("borderMaxSize",U).setType(p.NUMBER),t.add("borderEnableDrop",!0).setType(p.BOOLEAN),t.add("borderAutoSelectTabWhenOpen",!0).setType(p.BOOLEAN),t.add("borderAutoSelectTabWhenClosed",!1).setType(p.BOOLEAN),t.add("borderClassName",void 0).setType(p.STRING),t.add("borderEnableAutoHide",!1).setType(p.BOOLEAN),t}}W.MAIN_WINDOW_ID="__main_window_id__",W.attributeDefinitions=W.createAttributeDefinitions();class F extends f{static fromJson(t,e){const i=g.getByName(t.location),n=new F(i,t,e);return t.children&&(n.children=t.children.map((t=>{const i=O.fromJson(t,e);return i.setParent(n),i}))),n}constructor(t,e,i){super(i),this.outerRect=u.empty(),this.contentRect=u.empty(),this.tabHeaderRect=u.empty(),this.location=t,this.attributes.id=`border_${t.getName()}`,F.attributeDefinitions.fromJson(e,this.attributes),i.addNode(this)}getLocation(){return this.location}getClassName(){return this.getAttr("className")}isHorizontal(){return this.location.orientation===c.HORZ}getSize(){const t=this.getAttr("size"),e=this.getSelected();if(-1===e)return t;{const i=this.children[e],n=this.isHorizontal()?i.getAttr("borderWidth"):i.getAttr("borderHeight");return-1===n?t:n}}getMinSize(){const t=this.getSelectedNode();let e=this.getAttr("minSize");if(t){const i=this.isHorizontal()?t.getMinWidth():t.getMinHeight();e=Math.max(e,i)}return e}getMaxSize(){const t=this.getSelectedNode();let e=this.getAttr("maxSize");if(t){const i=this.isHorizontal()?t.getMaxWidth():t.getMaxHeight();e=Math.min(e,i)}return e}getSelected(){return this.attributes.selected}isAutoHide(){return this.getAttr("enableAutoHide")}getSelectedNode(){if(-1!==this.getSelected())return this.children[this.getSelected()]}getOrientation(){return this.location.getOrientation()}getConfig(){return this.attributes.config}isMaximized(){return!1}isShowing(){return this.attributes.show}toJson(){const t={};return F.attributeDefinitions.toJson(t,this.attributes),t.location=this.location.getName(),t.children=this.children.map((t=>t.toJson())),t}isAutoSelectTab(t){return null==t&&(t=-1!==this.getSelected()),t?this.getAttr("autoSelectTabWhenOpen"):this.getAttr("autoSelectTabWhenClosed")}setSelected(t){this.attributes.selected=t}getTabHeaderRect(){return this.tabHeaderRect}setTabHeaderRect(t){this.tabHeaderRect=t}getOuterRect(){return this.outerRect}setOuterRect(t){this.outerRect=t}getRect(){return this.tabHeaderRect}getContentRect(){return this.contentRect}setContentRect(t){this.contentRect=t}isEnableDrop(){return this.getAttr("enableDrop")}setSize(t){const e=this.getSelected();if(-1===e)this.attributes.size=t;else{const i=this.children[e];-1===(this.isHorizontal()?i.getAttr("borderWidth"):i.getAttr("borderHeight"))?this.attributes.size=t:this.isHorizontal()?i.setBorderWidth(t):i.setBorderHeight(t)}}updateAttrs(t){F.attributeDefinitions.update(t,this.attributes)}remove(t){const e=this.removeChild(t);-1!==this.getSelected()&&x(this,e)}canDrop(t,e,i){if(!(t instanceof O))return;let n;const o=g.CENTER;if(this.tabHeaderRect.contains(e,i)){if(this.location.orientation===c.VERT)if(this.children.length>0){let t=this.children[0],i=t.getTabRect();const s=i.y,a=i.height;let l=this.tabHeaderRect.x,d=0;for(let h=0;h<this.children.length;h++){if(t=this.children[h],i=t.getTabRect(),d=i.x+i.width/2,e>=l&&e<d){const t=new u(i.x-2,s,3,a);n=new b(this,t,o,h,r.FLEXLAYOUT__OUTLINE_RECT);break}l=d}if(null==n){const t=new u(i.getRight()-2,s,3,a);n=new b(this,t,o,this.children.length,r.FLEXLAYOUT__OUTLINE_RECT)}}else{const t=new u(this.tabHeaderRect.x+1,this.tabHeaderRect.y+2,3,18);n=new b(this,t,o,0,r.FLEXLAYOUT__OUTLINE_RECT)}else if(this.children.length>0){let t=this.children[0],e=t.getTabRect();const s=e.x,a=e.width;let l=this.tabHeaderRect.y,d=0;for(let h=0;h<this.children.length;h++){if(t=this.children[h],e=t.getTabRect(),d=e.y+e.height/2,i>=l&&i<d){const t=new u(s,e.y-2,a,3);n=new b(this,t,o,h,r.FLEXLAYOUT__OUTLINE_RECT);break}l=d}if(null==n){const t=new u(s,e.getBottom()-2,a,3);n=new b(this,t,o,this.children.length,r.FLEXLAYOUT__OUTLINE_RECT)}}else{const t=new u(this.tabHeaderRect.x+2,this.tabHeaderRect.y+1,18,3);n=new b(this,t,o,0,r.FLEXLAYOUT__OUTLINE_RECT)}if(!t.canDockInto(t,n))return}else if(-1!==this.getSelected()&&this.outerRect.contains(e,i)){const e=this.outerRect;if(n=new b(this,e,o,-1,r.FLEXLAYOUT__OUTLINE_RECT),!t.canDockInto(t,n))return}return n}drop(t,e,i,n){let o=0;const s=t.getParent();void 0!==s&&(o=s.removeChild(t),s!==this&&s instanceof F&&s.getSelected()===o?s.setSelected(-1):x(s,o)),t instanceof O&&s===this&&o<i&&i>0&&i--;let a=i;-1===a&&(a=this.children.length),t instanceof O&&this.addChild(t,a),(n||!1!==n&&this.isAutoSelectTab())&&this.setSelected(a),this.model.tidy()}getSplitterBounds(t,e=!1){const i=[0,0],n=e?this.getMinSize():0,o=e?this.getMaxSize():99999,s=this.model.getRoot(W.MAIN_WINDOW_ID),a=s.getRect(),r=this.model.getSplitterSize();if(this.location===g.TOP){i[0]=this.tabHeaderRect.getBottom()+n;const t=this.tabHeaderRect.getBottom()+o;i[1]=Math.max(i[0],a.getBottom()-s.getMinHeight()-r),i[1]=Math.min(i[1],t)}else if(this.location===g.LEFT){i[0]=this.tabHeaderRect.getRight()+n;const t=this.tabHeaderRect.getRight()+o;i[1]=Math.max(i[0],a.getRight()-s.getMinWidth()-r),i[1]=Math.min(i[1],t)}else if(this.location===g.BOTTOM){i[1]=this.tabHeaderRect.y-n-r;const t=this.tabHeaderRect.y-o-r;i[0]=Math.min(i[1],a.y+s.getMinHeight()),i[0]=Math.max(i[0],t)}else if(this.location===g.RIGHT){i[1]=this.tabHeaderRect.x-n-r;const t=this.tabHeaderRect.x-o-r;i[0]=Math.min(i[1],a.x+s.getMinWidth()),i[0]=Math.max(i[0],t)}return i}calculateSplit(t,e){const i=this.getSplitterBounds(e);return this.location===g.BOTTOM||this.location===g.RIGHT?Math.max(0,i[1]-e):Math.max(0,e-i[0])}getAttributeDefinitions(){return F.attributeDefinitions}static getAttributeDefinitions(){return F.attributeDefinitions}static createAttributeDefinitions(){const t=new E;return t.add("type",F.TYPE,!0).setType(p.STRING).setFixed(),t.add("selected",-1).setType(p.NUMBER).setDescription("index of selected/visible tab in border; -1 means no tab selected"),t.add("show",!0).setType(p.BOOLEAN).setDescription("show/hide this border"),t.add("config",void 0).setType("any").setDescription("a place to hold json config used in your own code"),t.addInherited("enableDrop","borderEnableDrop").setType(p.BOOLEAN).setDescription("whether tabs can be dropped into this border"),t.addInherited("className","borderClassName").setType(p.STRING).setDescription("class applied to tab button"),t.addInherited("autoSelectTabWhenOpen","borderAutoSelectTabWhenOpen").setType(p.BOOLEAN).setDescription("whether to select new/moved tabs in border when the border is already open"),t.addInherited("autoSelectTabWhenClosed","borderAutoSelectTabWhenClosed").setType(p.BOOLEAN).setDescription("whether to select new/moved tabs in border when the border is currently closed"),t.addInherited("size","borderSize").setType(p.NUMBER).setDescription("size of the tab area when selected"),t.addInherited("minSize","borderMinSize").setType(p.NUMBER).setDescription("the minimum size of the tab area"),t.addInherited("maxSize","borderMaxSize").setType(p.NUMBER).setDescription("the maximum size of the tab area"),t.addInherited("enableAutoHide","borderEnableAutoHide").setType(p.BOOLEAN).setDescription("hide border if it has zero tabs"),t}}F.TYPE="border",F.attributeDefinitions=F.createAttributeDefinitions();const Y=t=>{const{layout:e,node:i,index:n,horizontal:o}=t,[s,a]=l.useState(!1),d=l.useRef(null),h=l.useRef(null),g=l.useRef([]),T=l.useRef(void 0),p=l.useRef(void 0),E=l.useRef(0),b=l.useRef(0),m=l.useRef({initialSizes:[],sum:0,startPosition:0}),f=i.getModel().getSplitterSize();let O=i.getModel().getSplitterExtra();w()||(O=Math.max(30,O+f)-f),l.useEffect((()=>{var t,e;return null===(t=d.current)||void 0===t||t.addEventListener("touchstart",R,{passive:!1}),null===(e=h.current)||void 0===e||e.addEventListener("touchstart",R,{passive:!1}),()=>{var t,e;null===(t=d.current)||void 0===t||t.removeEventListener("touchstart",R),null===(e=h.current)||void 0===e||e.removeEventListener("touchstart",R)}}),[]);const R=t=>{t.preventDefault(),t.stopImmediatePropagation()},A=t=>{var s;t.stopPropagation(),i instanceof I&&(m.current=i.getSplitterInitials(n)),L(!1,e.getCurrentDocument()),function(t,e,i,n,o){e.preventDefault();const s=t=>{t.preventDefault(),i(t.clientX,t.clientY)},a=t=>{t.preventDefault(),o()},r=()=>{t.removeEventListener("pointermove",s),t.removeEventListener("pointerup",r),t.removeEventListener("pointercancel",a),n()};t.addEventListener("pointermove",s),t.addEventListener("pointerup",r),t.addEventListener("pointercancel",a)}(t.currentTarget.ownerDocument,t,v,N,y),g.current=i.getSplitterBounds(n,!0);const l=e.getRootDiv();T.current=e.getCurrentDocument().createElement("div"),T.current.style.flexDirection=o?"row":"column",T.current.className=e.getClassName(r.FLEXLAYOUT__SPLITTER_DRAG),T.current.style.cursor=i.getOrientation()===c.VERT?"ns-resize":"ew-resize",i.getModel().isSplitterEnableHandle()&&(p.current=e.getCurrentDocument().createElement("div"),p.current.className=S(r.FLEXLAYOUT__SPLITTER_HANDLE)+" "+S(o?r.FLEXLAYOUT__SPLITTER_HANDLE_HORZ:r.FLEXLAYOUT__SPLITTER_HANDLE_VERT),T.current.appendChild(p.current));const h=null===(s=d.current)||void 0===s?void 0:s.getBoundingClientRect(),_=new u(h.x-e.getDomRect().x,h.y-e.getDomRect().y,h.width,h.height);E.current=t.clientX-h.x,b.current=t.clientY-h.y,_.positionElement(T.current),l&&l.appendChild(T.current),a(!0)},y=()=>{const t=e.getRootDiv();t&&T.current&&t.removeChild(T.current),T.current=void 0,a(!1)},v=(t,n)=>{if(T.current){const o=e.getDomRect();if(!o)return;i.getOrientation()===c.VERT?T.current.style.top=x(n-o.y-b.current)+"px":T.current.style.left=x(t-o.x-E.current)+"px",e.isRealtimeResize()&&D(!0)}},N=()=>{if(T.current){D(!1);const t=e.getRootDiv();t&&T.current&&t.removeChild(T.current),T.current=void 0}L(!0,e.getCurrentDocument()),a(!1)},D=t=>{(()=>{if(T.current){let t=0;if(t=i.getOrientation()===c.VERT?T.current.offsetTop:T.current.offsetLeft,i instanceof F){const n=i.calculateSplit(i,t);e.doAction(_.adjustBorderSplit(i.getId(),n))}else{const o=m.current,s=i.calculateSplit(n,t,o.initialSizes,o.sum,o.startPosition);e.doAction(_.adjustWeights(i.getId(),s))}}})()},x=t=>{const e=g.current;let i=t;return t<e[0]&&(i=e[0]),t>e[1]&&(i=e[1]),i},S=e.getClassName,M={cursor:o?"ew-resize":"ns-resize",flexDirection:o?"column":"row"};let B,C=S(r.FLEXLAYOUT__SPLITTER)+" "+S(r.FLEXLAYOUT__SPLITTER_+i.getOrientation().getName());if(i instanceof F?C+=" "+S(r.FLEXLAYOUT__SPLITTER_BORDER):void 0!==i.getModel().getMaximizedTabset(e.getWindowId())&&(M.display="none"),o?(M.width=f+"px",M.minWidth=f+"px"):(M.height=f+"px",M.minHeight=f+"px"),!s&&i.getModel().isSplitterEnableHandle()&&(B=l.createElement("div",{className:S(r.FLEXLAYOUT__SPLITTER_HANDLE)+" "+S(o?r.FLEXLAYOUT__SPLITTER_HANDLE_HORZ:r.FLEXLAYOUT__SPLITTER_HANDLE_VERT)})),0===O)return l.createElement("div",{className:C,style:M,ref:d,"data-layout-path":i.getPath()+"/s"+(n-1),onPointerDown:A},B);{const t={};i.getOrientation()===c.HORZ?(t.height="100%",t.width=f+O+"px",t.cursor="ew-resize"):(t.height=f+O+"px",t.width="100%",t.cursor="ns-resize");const e=S(r.FLEXLAYOUT__SPLITTER_EXTRA);return l.createElement("div",{className:C,style:M,ref:d,"data-layout-path":i.getPath()+"/s"+(n-1),onPointerDown:A},l.createElement("div",{style:t,ref:h,className:e,onPointerDown:A}))}};function P(t){const{layout:e,border:i,show:n}=t,o=l.useRef(null);l.useLayoutEffect((()=>{const t=e.getBoundingClientRect(o.current),n=u.getContentRect(o.current).relativeTo(e.getDomRect());t.width>0&&(i.setOuterRect(t),i.getContentRect().equals(n)||(i.setContentRect(n),e.redrawInternal("border content rect")))}));let s=!0;const a={};i.getOrientation()===c.HORZ?(a.width=i.getSize(),a.minWidth=i.getMinSize(),a.maxWidth=i.getMaxSize()):(a.height=i.getSize(),a.minHeight=i.getMinSize(),a.maxHeight=i.getMaxSize(),s=!1),a.display=n?"flex":"none";const d=e.getClassName(r.FLEXLAYOUT__BORDER_TAB_CONTENTS);return i.getLocation()===g.LEFT||i.getLocation()===g.TOP?l.createElement(l.Fragment,null,l.createElement("div",{ref:o,style:a,className:d}),n&&l.createElement(Y,{layout:e,node:i,index:0,horizontal:s})):l.createElement(l.Fragment,null,n&&l.createElement(Y,{layout:e,node:i,index:0,horizontal:s}),l.createElement("div",{ref:o,style:a,className:d}))}var H;!function(t){t[t.Visible=1]="Visible",t[t.Always=2]="Always",t[t.Selected=3]="Selected"}(H||(H={}));const X=t=>{const{layout:e,node:i,selected:n,border:o,icons:s,path:d}=t,h=l.useRef(null),c=l.useRef(null),u=()=>{e.doAction(_.selectTab(i.getId()))},g=t=>{(()=>{const t=i.getCloseType();return!!(n||t===H.Always||t===H.Visible&&window.matchMedia&&window.matchMedia("(hover: hover) and (pointer: fine)").matches)})()?e.doAction(_.deleteTab(i.getId())):u()},T=t=>{t.stopPropagation()};l.useLayoutEffect((()=>{i.setTabRect(e.getBoundingClientRect(h.current)),e.getEditingTab()===i&&c.current.select()}));const p=e.getClassName;let E=p(r.FLEXLAYOUT__BORDER_BUTTON)+" "+p(r.FLEXLAYOUT__BORDER_BUTTON_+o);E+=n?" "+p(r.FLEXLAYOUT__BORDER_BUTTON__SELECTED):" "+p(r.FLEXLAYOUT__BORDER_BUTTON__UNSELECTED),void 0!==i.getClassName()&&(E+=" "+i.getClassName());let b=0;!1===i.getModel().isEnableRotateBorderIcons()&&("left"===o?b=90:"right"===o&&(b=-90));const m=R(e,i,b);let f=m.content?l.createElement("div",{className:p(r.FLEXLAYOUT__BORDER_BUTTON_CONTENT)},m.content):null;const O=m.leading?l.createElement("div",{className:p(r.FLEXLAYOUT__BORDER_BUTTON_LEADING)},m.leading):null;if(e.getEditingTab()===i&&(f=l.createElement("input",{ref:c,className:p(r.FLEXLAYOUT__TAB_BUTTON_TEXTBOX),"data-layout-path":d+"/textbox",type:"text",autoFocus:!0,defaultValue:i.getName(),onKeyDown:t=>{"Escape"===t.code?e.setEditingTab(void 0):"Enter"===t.code&&(e.setEditingTab(void 0),e.doAction(_.renameTab(i.getId(),t.target.value)))},onPointerDown:t=>{t.stopPropagation()}})),i.isEnableClose()){const t=e.i18nName(a.Close_Tab);m.buttons.push(l.createElement("div",{key:"close","data-layout-path":d+"/button/close",title:t,className:p(r.FLEXLAYOUT__BORDER_BUTTON_TRAILING),onPointerDown:T,onClick:g},"function"==typeof s.close?s.close(i):s.close))}return l.createElement("div",{ref:h,"data-layout-path":d,className:E,onClick:u,onAuxClick:t=>{A(t)&&e.auxMouseClick(i,t)},onContextMenu:t=>{e.showContextMenu(i,t)},title:i.getHelpText(),draggable:!0,onDragStart:t=>{i.isEnableDrag()?(t.stopPropagation(),e.setDragNode(t.nativeEvent,i)):t.preventDefault()},onDragEnd:t=>{t.stopPropagation(),e.clearDragMain()}},O,f,m.buttons)},z=t=>{const{layout:e,node:i}=t,n=e.getClassName;let o=n(r.FLEXLAYOUT__TAB_BUTTON_STAMP);const s=R(e,i);let a=s.content?l.createElement("div",{className:n(r.FLEXLAYOUT__TAB_BUTTON_CONTENT)},s.content):i.getNameForOverflowMenu();const d=s.leading?l.createElement("div",{className:n(r.FLEXLAYOUT__TAB_BUTTON_LEADING)},s.leading):null;return l.createElement("div",{className:o,title:i.getHelpText()},d,a)};function k(t,e,i,n){var o;const s=n.getRootDiv(),a=n.getClassName,d=t.ownerDocument,h=t.getBoundingClientRect(),c=null!==(o=null==s?void 0:s.getBoundingClientRect())&&void 0!==o?o:new DOMRect(0,0,100,100),u=d.createElement("div");u.className=a(r.FLEXLAYOUT__POPUP_MENU_CONTAINER),h.left<c.left+c.width/2?u.style.left=h.left-c.left+"px":u.style.right=c.right-h.right+"px",h.top<c.top+c.height/2?u.style.top=h.top-c.top+"px":u.style.bottom=c.bottom-h.bottom+"px",n.showOverlay(!0),s&&s.appendChild(u);const g=()=>{n.hideControlInPortal(),n.showOverlay(!1),s&&s.removeChild(u),u.removeEventListener("pointerdown",T),d.removeEventListener("pointerdown",_)},T=t=>{t.stopPropagation()},_=t=>{g()};u.addEventListener("pointerdown",T),d.addEventListener("pointerdown",_),n.showControlInPortal(l.createElement(G,{currentDocument:d,onSelect:i,onHide:g,items:e,classNameMapper:a,layout:n}),u)}const G=t=>{const{items:e,onHide:i,onSelect:n,classNameMapper:o,layout:s}=t,a=t=>{s.clearDragMain()},d=e.map(((t,e)=>l.createElement("div",{key:t.index,className:o(r.FLEXLAYOUT__POPUP_MENU_ITEM),"data-layout-path":"/popup-menu/tb"+e,onClick:e=>((t,e)=>{n(t),i(),e.stopPropagation()})(t,e),draggable:!0,onDragStart:e=>{return n=e,o=t.node,n.stopPropagation(),s.setDragNode(n.nativeEvent,o),void setTimeout((()=>{i()}),0);var n,o},onDragEnd:a,title:t.node.getHelpText()},l.createElement(z,{node:t.node,layout:s}))));return l.createElement("div",{className:o(r.FLEXLAYOUT__POPUP_MENU),"data-layout-path":"/popup-menu"},d)},V=(t,e,i,n)=>{const o=l.useRef(!0),s=l.useRef(!1),a=l.useRef(u.empty()),r=l.useRef(null),[d,h]=l.useState(0),g=l.useRef(!1),[T,_]=l.useState([]),p=l.useRef(0);l.useLayoutEffect((()=>{g.current=!1}),[t.getSelectedNode(),t.getRect().width,t.getRect().height]),l.useLayoutEffect((()=>{const e=t instanceof M?t.getRect():t.getTabHeaderRect();e.width>0&&e.height>0&&w()}));const E=i.current;l.useEffect((()=>{if(E)return E.addEventListener("wheel",b,{passive:!1}),()=>{E.removeEventListener("wheel",b)}}),[E]);const b=t=>{t.preventDefault()},m=t=>e===c.HORZ?t.x:t.y,f=t=>e===c.HORZ?t.getRight():t.getBottom(),O=t=>e===c.HORZ?t.width:t.height,w=()=>{!0===o.current&&(s.current=!1);const e=t instanceof M?t.getRect():t.getTabHeaderRect();let r=t.getChildren()[t.getChildren().length-1];const l=null===n.current?0:O(n.current.getBoundingClientRect());if(!0===o.current||0===p.current&&0!==T.length||e.width!==a.current.width||e.height!==a.current.height){p.current=T.length,a.current=e;const n=!(t instanceof M)||!0===t.isEnableTabStrip();let c=f(e)-l;if(null!==i.current&&(c-=O(i.current.getBoundingClientRect())),n&&t.getChildren().length>0){if(0===T.length&&0===d&&f(r.getTabRect())+2<c)return;let i=0;const n=t.getSelectedNode();if(n&&!g.current){const t=n.getTabRect(),o=m(t)-2,s=f(t)+2;O(t)+4>=c-m(e)?i=m(e)-o:(s>c||o<m(e))&&(o<m(e)&&(i=m(e)-o),s+i>c&&(i=c-s))}const a=Math.max(0,c-(f(r.getTabRect())+2+i)),l=Math.min(0,d+i+a),u=l-d,p=[];for(let i=0;i<t.getChildren().length;i++){const n=t.getChildren()[i];(m(n.getTabRect())+u<m(e)||f(n.getTabRect())+u>c)&&p.push({node:n,index:i})}s.current=p.length>0,o.current=!1,_(p),h(l)}}else o.current=!0};return{selfRef:r,position:d,userControlledLeft:g,hiddenTabs:T,onMouseWheel:t=>{let e=0;e=Math.abs(t.deltaX)>Math.abs(t.deltaY)?-t.deltaX:-t.deltaY,1===t.deltaMode&&(e*=40),h(d+e),g.current=!0,t.stopPropagation()},tabsTruncated:s.current}},J=t=>{const{border:e,layout:i,size:n}=t,o=l.useRef(null),s=l.useRef(null),d=l.useRef(null),h=i.getIcons();l.useLayoutEffect((()=>{e.setTabHeaderRect(u.getBoundingClientRect(T.current).relativeTo(i.getDomRect()))}));const{selfRef:T,position:p,userControlledLeft:E,hiddenTabs:b,onMouseWheel:m,tabsTruncated:f}=V(e,c.flip(e.getOrientation()),o,d),O=t=>{A(t)&&i.auxMouseClick(e,t)},w=t=>{t.stopPropagation()},R=t=>{const n=i.getShowOverflowMenu();void 0!==n?n(e,t,b,L):k(s.current,b,L,i),t.stopPropagation()},L=t=>{i.doAction(_.selectTab(t.node.getId())),E.current=!1},y=t=>{const n=e.getChildren()[e.getSelected()];void 0!==n&&i.doAction(_.popoutTab(n.getId())),t.stopPropagation()},v=i.getClassName,N=[],D=t=>{let n=e.getSelected()===t,o=e.getChildren()[t];N.push(l.createElement(X,{layout:i,border:e.getLocation().getName(),node:o,path:e.getPath()+"/tb"+t,key:o.getId(),selected:n,icons:h})),t<e.getChildren().length-1&&N.push(l.createElement("div",{key:"divider"+t,className:v(r.FLEXLAYOUT__BORDER_TAB_DIVIDER)}))};for(let t=0;t<e.getChildren().length;t++)D(t);let x=v(r.FLEXLAYOUT__BORDER)+" "+v(r.FLEXLAYOUT__BORDER_+e.getLocation().getName());void 0!==e.getClassName()&&(x+=" "+e.getClassName());let S=[],M=[];const I={buttons:S,stickyButtons:M,overflowPosition:void 0};if(i.customizeTabSet(e,I),S=I.buttons,void 0===I.overflowPosition&&(I.overflowPosition=M.length),M.length>0&&(f?S=[...M,...S]:N.push(l.createElement("div",{ref:d,key:"sticky_buttons_container",onPointerDown:w,onDragStart:t=>{t.preventDefault()},className:v(r.FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER)},M))),b.length>0){const t=i.i18nName(a.Overflow_Menu_Tooltip);let n;n="function"==typeof h.more?h.more(e,b):l.createElement(l.Fragment,null,h.more,l.createElement("div",{className:v(r.FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT)},b.length)),S.splice(Math.min(I.overflowPosition,S.length),0,l.createElement("button",{key:"overflowbutton",ref:s,className:v(r.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON)+" "+v(r.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW)+" "+v(r.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW_+e.getLocation().getName()),title:t,onClick:R,onPointerDown:w},n))}const B=e.getSelected();if(-1!==B){const t=e.getChildren()[B];if(void 0!==t&&i.isSupportsPopout()&&t.isEnablePopout()){const e=i.i18nName(a.Popout_Tab);S.push(l.createElement("button",{key:"popout",title:e,className:v(r.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON)+" "+v(r.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_FLOAT),onClick:y,onPointerDown:w},"function"==typeof h.popout?h.popout(t):h.popout))}}const C=l.createElement("div",{key:"toolbar",ref:o,className:v(r.FLEXLAYOUT__BORDER_TOOLBAR)+" "+v(r.FLEXLAYOUT__BORDER_TOOLBAR_+e.getLocation().getName())},S);let U={},W={};const F=n-1;return e.getLocation()===g.LEFT?(U={right:"100%",top:p},W={width:F}):e.getLocation()===g.RIGHT?(U={left:"100%",top:p},W={width:F}):(U={left:p},W={height:F}),l.createElement("div",{ref:T,style:{display:"flex",flexDirection:e.getOrientation()===c.VERT?"row":"column"},className:x,"data-layout-path":e.getPath(),onClick:O,onAuxClick:O,onContextMenu:t=>{i.showContextMenu(e,t)},onWheel:m},l.createElement("div",{style:W,className:v(r.FLEXLAYOUT__BORDER_INNER)+" "+v(r.FLEXLAYOUT__BORDER_INNER_+e.getLocation().getName())},l.createElement("div",{style:U,className:v(r.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER)+" "+v(r.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER_+e.getLocation().getName())},N)),C)},Z=t=>{const{layout:e,node:i}=t,n=l.useRef(null);l.useEffect((()=>{i.setTabStamp(n.current)}),[i,n.current]);let o=(0,e.getClassName)(r.FLEXLAYOUT__DRAG_RECT);return l.createElement("div",{ref:n,className:o},l.createElement(z,{key:i.getId(),layout:e,node:i}))};class j extends l.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(t){return{hasError:!0}}componentDidCatch(t,e){console.debug(t),console.debug(e)}render(){return this.state.hasError?l.createElement("div",{className:r.FLEXLAYOUT__ERROR_BOUNDARY_CONTAINER},l.createElement("div",{className:r.FLEXLAYOUT__ERROR_BOUNDARY_CONTENT},this.props.message)):this.props.children}}const q=t=>{const{title:e,layout:i,layoutWindow:n,url:o,onCloseWindow:s,onSetWindow:a,children:h}=t,c=l.useRef(null),[u,g]=l.useState(void 0),T=new Map;return l.useLayoutEffect((()=>{if(!c.current){const t=n.windowId,i=n.rect;c.current=window.open(o,t,`left=${i.x},top=${i.y},width=${i.width},height=${i.height}`),c.current?(n.window=c.current,a(n,c.current),window.addEventListener("beforeunload",(()=>{if(c.current){const t=c.current;c.current=null,t.close()}})),c.current.addEventListener("load",(()=>{if(c.current){c.current.focus(),c.current.resizeTo(i.width,i.height),c.current.moveTo(i.x,i.y);const t=c.current.document;t.title=e;const o=t.createElement("div");o.className=r.FLEXLAYOUT__FLOATING_WINDOW_CONTENT,t.body.appendChild(o),function(t,e){const i=[],n=document.querySelectorAll('style, link[rel="stylesheet"]');for(const o of n)$(t,o,e,i);return Promise.all(i)}(t,T).then((()=>{g(o)}));const a=new MutationObserver((e=>function(t,e,i){for(const n of t)if("childList"===n.type){for(const t of n.addedNodes)(t instanceof HTMLLinkElement||t instanceof HTMLStyleElement)&&$(e,t,i);for(const t of n.removedNodes)if(t instanceof HTMLLinkElement||t instanceof HTMLStyleElement){const n=i.get(t);n&&e.head.removeChild(n)}}}(e,t,T)));a.observe(document.head,{childList:!0}),c.current.addEventListener("beforeunload",(()=>{c.current&&(s(n),c.current=null,a.disconnect())}))}}))):(console.warn(`Unable to open window ${o}`),s(n))}return()=>{var t;i.getModel().getwindowsMap().has(n.windowId)||(null===(t=c.current)||void 0===t||t.close(),c.current=null)}}),[]),void 0!==u?(0,d.createPortal)(h,u):null};function $(t,e,i,n){if(e instanceof HTMLLinkElement){const o=e.cloneNode(!0);t.head.appendChild(o),i.set(e,o),n&&n.push(new Promise((t=>{o.onload=()=>t(!0)})))}else if(e instanceof HTMLStyleElement)try{const n=e.cloneNode(!0);t.head.appendChild(n),i.set(e,n)}catch(t){}}const K={width:"1em",height:"1em",display:"flex",alignItems:"center"},Q=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",style:K,viewBox:"0 0 24 24"},l.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}),l.createElement("path",{stroke:"var(--color-icon)",fill:"var(--color-icon)",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"})),tt=t=>{const{layout:e,show:i}=t;return l.createElement("div",{className:e.getClassName(r.FLEXLAYOUT__LAYOUT_OVERLAY),style:{display:i?"flex":"none"}})},et=t=>{const{layout:e,node:i,selected:n,path:o}=t,s=l.useRef(null),d=l.useRef(null),h=e.getIcons();l.useLayoutEffect((()=>{i.setTabRect(e.getBoundingClientRect(s.current)),e.getEditingTab()===i&&d.current.select()}));const c=()=>{e.doAction(_.selectTab(i.getId()))},u=t=>{t.target!==d.current&&(e.getCurrentDocument().body.removeEventListener("pointerdown",u),e.setEditingTab(void 0))},g=t=>{(()=>{const t=i.getCloseType();return!!(n||t===H.Always||t===H.Visible&&window.matchMedia&&window.matchMedia("(hover: hover) and (pointer: fine)").matches)})()?e.doAction(_.deleteTab(i.getId())):c()},T=t=>{t.stopPropagation()},p=e.getClassName,E=i.getParent(),b=E.isEnableSingleTabStretch()&&1===E.getChildren().length;let m=b?r.FLEXLAYOUT__TAB_BUTTON_STRETCH:r.FLEXLAYOUT__TAB_BUTTON,f=p(m);f+=" "+p(m+"_"+E.getTabLocation()),b||(f+=n?" "+p(m+"--selected"):" "+p(m+"--unselected")),void 0!==i.getClassName()&&(f+=" "+i.getClassName());const O=R(e,i);let w=O.content?l.createElement("div",{className:p(r.FLEXLAYOUT__TAB_BUTTON_CONTENT)},O.content):null;const L=O.leading?l.createElement("div",{className:p(r.FLEXLAYOUT__TAB_BUTTON_LEADING)},O.leading):null;if(e.getEditingTab()===i&&(w=l.createElement("input",{ref:d,className:p(r.FLEXLAYOUT__TAB_BUTTON_TEXTBOX),"data-layout-path":o+"/textbox",type:"text",autoFocus:!0,defaultValue:i.getName(),onKeyDown:t=>{"Escape"===t.code?e.setEditingTab(void 0):"Enter"===t.code&&(e.setEditingTab(void 0),e.doAction(_.renameTab(i.getId(),t.target.value)))},onPointerDown:t=>{t.stopPropagation()}})),i.isEnableClose()&&!b){const t=e.i18nName(a.Close_Tab);O.buttons.push(l.createElement("div",{key:"close","data-layout-path":o+"/button/close",title:t,className:p(r.FLEXLAYOUT__TAB_BUTTON_TRAILING),onPointerDown:T,onClick:g},"function"==typeof h.close?h.close(i):h.close))}return l.createElement("div",{ref:s,"data-layout-path":o,className:f,onClick:c,onAuxClick:t=>{A(t)&&e.auxMouseClick(i,t)},onContextMenu:t=>{e.showContextMenu(i,t)},title:i.getHelpText(),draggable:!0,onDragStart:t=>{i.isEnableDrag()?(t.stopPropagation(),e.setDragNode(t.nativeEvent,i)):t.preventDefault()},onDragEnd:t=>{e.clearDragMain()},onDoubleClick:t=>{i.isEnableRename()&&(e.setEditingTab(i),e.getCurrentDocument().body.addEventListener("pointerdown",u),t.stopPropagation())}},L,w,O.buttons)},it=t=>{const{node:e,layout:i}=t,n=l.useRef(null),o=l.useRef(null),s=l.useRef(null),h=l.useRef(null),g=l.useRef(null),T=l.useRef(null),p=i.getIcons();l.useEffect((()=>{e.setRect(i.getBoundingClientRect(E.current)),n.current&&e.setTabStripRect(i.getBoundingClientRect(n.current));const t=u.getContentRect(s.current).relativeTo(i.getDomRect());e.getContentRect().equals(t)||(e.setContentRect(t),i.redrawInternal("tabset content rect "+t))}));const{selfRef:E,position:b,userControlledLeft:m,hiddenTabs:f,onMouseWheel:O,tabsTruncated:w}=V(e,c.HORZ,h,T),R=t=>{const n=i.getShowOverflowMenu();void 0!==n?n(e,t,f,L):k(g.current,f,L,i),t.stopPropagation()},L=t=>{i.doAction(_.selectTab(t.node.getId())),m.current=!1},y=t=>{i.getEditingTab()?t.preventDefault():e.isEnableDrag()?(t.stopPropagation(),i.setDragNode(t.nativeEvent,e)):t.preventDefault()},v=t=>{if(!A(t)){let t=e.getName();t=void 0===t?"":": "+t,i.doAction(_.setActiveTabset(e.getId(),i.getWindowId()))}},N=t=>{A(t)&&i.auxMouseClick(e,t)},D=t=>{i.showContextMenu(e,t)},x=t=>{t.stopPropagation()},S=t=>{e.canMaximize()&&i.maximize(e),t.stopPropagation()},M=t=>{i.doAction(_.deleteTabset(e.getId())),t.stopPropagation()},I=t=>{i.doAction(_.deleteTab(e.getChildren()[0].getId())),t.stopPropagation()},B=t=>{void 0!==W&&i.doAction(_.popoutTab(W.getId())),t.stopPropagation()},C=t=>{e.canMaximize()&&i.maximize(e)},U=i.getClassName;null!==o.current&&0!==o.current.scrollLeft&&(o.current.scrollLeft=0);const W=e.getSelectedNode(),F=e.getPath(),Y=[];if(e.isEnableTabStrip())for(let t=0;t<e.getChildren().length;t++){const n=e.getChildren()[t];let o=e.getSelected()===t;Y.push(l.createElement(et,{layout:i,node:n,path:F+"/tb"+t,key:n.getId(),selected:o})),t<e.getChildren().length-1&&Y.push(l.createElement("div",{key:"divider"+t,className:U(r.FLEXLAYOUT__TABSET_TAB_DIVIDER)}))}let P=[],H=[];const X={stickyButtons:P,buttons:H,overflowPosition:void 0};i.customizeTabSet(e,X),P=X.stickyButtons,H=X.buttons;const z=e.isEnableSingleTabStretch()&&1===e.getChildren().length,G=z&&e.getChildren()[0].isEnableClose()||e.isEnableClose();if(void 0===X.overflowPosition&&(X.overflowPosition=P.length),P.length>0&&(e.isEnableTabWrap()||!w&&!z?Y.push(l.createElement("div",{ref:T,key:"sticky_buttons_container",onPointerDown:x,onDragStart:t=>{t.preventDefault()},className:U(r.FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER)},P)):H=[...P,...H]),!e.isEnableTabWrap()&&f.length>0){const t=i.i18nName(a.Overflow_Menu_Tooltip);let n;n="function"==typeof p.more?p.more(e,f):l.createElement(l.Fragment,null,p.more,l.createElement("div",{className:U(r.FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT)},f.length)),H.splice(Math.min(X.overflowPosition,H.length),0,l.createElement("button",{key:"overflowbutton","data-layout-path":F+"/button/overflow",ref:g,className:U(r.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+" "+U(r.FLEXLAYOUT__TAB_BUTTON_OVERFLOW),title:t,onClick:R,onPointerDown:x},n))}if(void 0!==W&&i.isSupportsPopout()&&W.isEnablePopout()&&W.isEnablePopoutIcon()){const t=i.i18nName(a.Popout_Tab);H.push(l.createElement("button",{key:"popout","data-layout-path":F+"/button/popout",title:t,className:U(r.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+" "+U(r.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_FLOAT),onClick:B,onPointerDown:x},"function"==typeof p.popout?p.popout(W):p.popout))}if(e.canMaximize()){const t=i.i18nName(a.Restore),n=i.i18nName(a.Maximize);H.push(l.createElement("button",{key:"max","data-layout-path":F+"/button/max",title:e.isMaximized()?t:n,className:U(r.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+" "+U(r.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_+(e.isMaximized()?"max":"min")),onClick:S,onPointerDown:x},e.isMaximized()?"function"==typeof p.restore?p.restore(e):p.restore:"function"==typeof p.maximize?p.maximize(e):p.maximize))}if(!e.isMaximized()&&G){const t=z?i.i18nName(a.Close_Tab):i.i18nName(a.Close_Tabset);H.push(l.createElement("button",{key:"close","data-layout-path":F+"/button/close",title:t,className:U(r.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+" "+U(r.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_CLOSE),onClick:z?I:M,onPointerDown:x},"function"==typeof p.closeTabset?p.closeTabset(e):p.closeTabset))}if(e.isActive()&&e.isEnableActiveIcon()){const t=i.i18nName(a.Active_Tabset);H.push(l.createElement("div",{key:"active","data-layout-path":F+"/button/active",title:t,className:U(r.FLEXLAYOUT__TAB_TOOLBAR_ICON)},"function"==typeof p.activeTabset?p.activeTabset(e):p.activeTabset))}const J=l.createElement("div",{key:"buttonbar",ref:h,className:U(r.FLEXLAYOUT__TAB_TOOLBAR),onPointerDown:x,onDragStart:t=>{t.preventDefault()}},H);let Z,j=U(r.FLEXLAYOUT__TABSET_TABBAR_OUTER);if(void 0!==e.getClassNameTabStrip()&&(j+=" "+e.getClassNameTabStrip()),j+=" "+r.FLEXLAYOUT__TABSET_TABBAR_OUTER_+e.getTabLocation(),e.isActive()&&(j+=" "+U(r.FLEXLAYOUT__TABSET_SELECTED)),e.isMaximized()&&(j+=" "+U(r.FLEXLAYOUT__TABSET_MAXIMIZED)),z){const t=e.getChildren()[0];void 0!==t.getTabSetClassName()&&(j+=" "+t.getTabSetClassName())}var q;if(e.isEnableTabWrap()?e.isEnableTabStrip()&&(Z=l.createElement("div",{className:j,style:{flexWrap:"wrap",gap:"1px",marginTop:"2px"},ref:n,"data-layout-path":F+"/tabstrip",onPointerDown:v,onDoubleClick:C,onContextMenu:D,onClick:N,onAuxClick:N,draggable:!0,onDragStart:y},Y,l.createElement("div",{style:{flexGrow:1}}),J)):e.isEnableTabStrip()&&(Z=l.createElement("div",{className:j,ref:n,"data-layout-path":F+"/tabstrip",onPointerDown:v,onDoubleClick:C,onContextMenu:D,onClick:N,onAuxClick:N,draggable:!0,onWheel:O,onDragStart:y},l.createElement("div",{ref:o,className:U(r.FLEXLAYOUT__TABSET_TABBAR_INNER)+" "+U(r.FLEXLAYOUT__TABSET_TABBAR_INNER_+e.getTabLocation())},l.createElement("div",{style:{left:b,width:z?"100%":"10000px"},className:U(r.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER)+" "+U(r.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER_+e.getTabLocation())},Y)),J)),0===e.getChildren().length){const t=i.getTabSetPlaceHolderCallback();t&&(q=t(e))}let $=l.createElement("div",{ref:s,className:U(r.FLEXLAYOUT__TABSET_CONTENT)},q);$="top"===e.getTabLocation()?l.createElement(l.Fragment,null,Z,$):l.createElement(l.Fragment,null,$,Z);let K={flexGrow:Math.max(1,1e3*e.getWeight()),minWidth:e.getMinWidth(),minHeight:e.getMinHeight(),maxWidth:e.getMaxWidth(),maxHeight:e.getMaxHeight()};void 0===e.getModel().getMaximizedTabset(i.getWindowId())||e.isMaximized()||(K.display="none");const Q=l.createElement("div",{ref:E,className:U(r.FLEXLAYOUT__TABSET_CONTAINER),style:K},l.createElement("div",{className:U(r.FLEXLAYOUT__TABSET),"data-layout-path":F},$));return e.isMaximized()&&i.getMainElement()?(0,d.createPortal)(l.createElement("div",{style:{position:"absolute",display:"flex",top:0,left:0,bottom:0,right:0}},Q),i.getMainElement()):Q},nt=t=>{const{layout:e,node:i}=t,n=l.useRef(null),o=i.getOrientation()===c.HORZ;l.useLayoutEffect((()=>{i.setRect(e.getBoundingClientRect(n.current))}));const s=[];let a=0;for(const t of i.getChildren())a>0&&s.push(l.createElement(Y,{key:"splitter"+a,layout:e,node:i,index:a,horizontal:o})),t instanceof I?s.push(l.createElement(nt,{key:t.getId(),layout:e,node:t})):t instanceof M&&s.push(l.createElement(it,{key:t.getId(),layout:e,node:t})),a++;const d={flexGrow:Math.max(1,1e3*i.getWeight()),minWidth:i.getMinWidth(),minHeight:i.getMinHeight(),maxWidth:i.getMaxWidth(),maxHeight:i.getMaxHeight()};return d.flexDirection=o?"row":"column",l.createElement("div",{ref:n,className:e.getClassName(r.FLEXLAYOUT__ROW),style:d},s)},ot=t=>{const{layout:e,selected:i,node:n,path:o}=t,s=l.useRef(null),a=l.useRef(!0),d=n.getParent(),h=d.getContentRect();l.useLayoutEffect((()=>{const t=n.getMoveableElement();s.current.appendChild(t),n.setMoveableElement(t);const e=()=>{n.saveScrollPosition()};return t.addEventListener("scroll",e),s.current.addEventListener("pointerdown",c),()=>{t.removeEventListener("scroll",e),s.current&&s.current.removeEventListener("pointerdown",c),n.setVisible(!1)}}),[]),l.useEffect((()=>{n.isSelected()&&a.current&&(n.restoreScrollPosition(),a.current=!1)}));const c=()=>{const t=n.getParent();t instanceof M&&(t.isActive()||e.doAction(_.setActiveTabset(t.getId(),e.getWindowId())))};n.setRect(h);const u=e.getClassName,g={};h.styleWithPosition(g);let T=null;if(i){if(n.setVisible(!0),document.hidden&&n.isEnablePopoutOverlay()){const t={};h.styleWithPosition(t),T=l.createElement("div",{style:t,className:u(r.FLEXLAYOUT__TAB_OVERLAY)})}}else g.display="none",n.setVisible(!1);d instanceof M&&void 0!==n.getModel().getMaximizedTabset(e.getWindowId())&&(d.isMaximized()?g.zIndex=10:g.display="none");let p=u(r.FLEXLAYOUT__TAB);return d instanceof F&&(p+=" "+u(r.FLEXLAYOUT__TAB_BORDER),p+=" "+u(r.FLEXLAYOUT__TAB_BORDER_+d.getLocation().getName())),void 0!==n.getContentClassName()&&(p+=" "+n.getContentClassName()),l.createElement(l.Fragment,null,T,l.createElement("div",{ref:s,style:g,className:p,"data-layout-path":o}))},st=l.memo((({children:t})=>l.createElement(l.Fragment,null,t)),((t,e)=>t.rect.equalSize(e.rect)&&t.selected===e.selected&&t.forceRevision===e.forceRevision&&t.tabsRevision===e.tabsRevision));class at extends l.Component{constructor(t){super(t),this.selfRef=l.createRef(),this.revision=0}redraw(){this.selfRef.current.redraw("parent "+this.revision)}addTabToTabSet(t,e){return this.selfRef.current.addTabToTabSet(t,e)}addTabWithDragAndDrop(t,e,i){this.selfRef.current.addTabWithDragAndDrop(t,e,i)}moveTabWithDragAndDrop(t,e){this.selfRef.current.moveTabWithDragAndDrop(t,e)}addTabToActiveTabSet(t){return this.selfRef.current.addTabToActiveTabSet(t)}setDragComponent(t,e,i,n){this.selfRef.current.setDragComponent(t,e,i,n)}getRootDiv(){return this.selfRef.current.getRootDiv()}render(){return l.createElement(rt,Object.assign({ref:this.selfRef},this.props,{renderRevision:this.revision++}))}}class rt extends l.Component{constructor(t){super(t),this.moveableElementMap=new Map,this.dragEnterCount=0,this.dragging=!1,this.updateLayoutMetrics=()=>{if(this.findBorderBarSizeRef.current){const t=this.findBorderBarSizeRef.current.getBoundingClientRect().height;t!==this.state.calculatedBorderBarSize&&this.setState({calculatedBorderBarSize:t})}},this.onModelChange=t=>{this.redrawInternal("model change"),this.props.onModelChange&&this.props.onModelChange(this.props.model,t)},this.updateRect=()=>{const t=this.getDomRect();t.equals(this.state.rect)||0===t.width||0===t.height||(this.setState({rect:t}),this.windowId!==W.MAIN_WINDOW_ID&&this.redrawInternal("rect updated"))},this.getClassName=t=>void 0===this.props.classNameMapper?t:this.props.classNameMapper(t),this.onCloseWindow=t=>{this.doAction(_.closeWindow(t.windowId))},this.onSetWindow=(t,e)=>{},this.showControlInPortal=(t,e)=>{const i=(0,d.createPortal)(t,e);this.setState({portal:i})},this.hideControlInPortal=()=>{this.setState({portal:void 0})},this.getIcons=()=>this.icons,this.setDragNode=(t,e)=>{if(rt.dragState=new Tt(this.mainLayout,ht.Internal,e,void 0,void 0),t.dataTransfer.setData("text/plain","--flexlayout--"),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.dropEffect="move",this.dragEnterCount=0,e instanceof M){let i=!1,n=this.i18nName(a.Move_Tabset);if(e.getChildren().length>0&&(n=this.i18nName(a.Move_Tabs).replace("?",String(e.getChildren().length))),this.props.onRenderDragRect){const o=this.props.onRenderDragRect(n,e,void 0);o&&(this.setDragComponent(t,o,10,10),i=!0)}i||this.setDragComponent(t,n,10,10)}else{const i=t.target.getBoundingClientRect(),n=t.clientX-i.left,o=t.clientY-i.top,s=null==e?void 0:e.getParent(),a=s instanceof F&&s.getOrientation()===c.HORZ,r=a?10:n,d=a?10:o;let h=!1;if(this.props.onRenderDragRect){const i=l.createElement(z,{key:e.getId(),layout:this,node:e}),n=this.props.onRenderDragRect(i,e,void 0);n&&(this.setDragComponent(t,n,r,d),h=!0)}h||(function(){const t=navigator.userAgent;return t.includes("Safari")&&!t.includes("Chrome")&&!t.includes("Chromium")}()?this.setDragComponent(t,l.createElement(z,{node:e,layout:this}),r,d):t.dataTransfer.setDragImage(e.getTabStamp(),r,d))}},this.onDragEnterRaw=t=>{this.dragEnterCount++,1===this.dragEnterCount&&this.onDragEnter(t)},this.onDragLeaveRaw=t=>{this.dragEnterCount--,0===this.dragEnterCount&&this.onDragLeave(t)},this.onDragEnter=t=>{var e;if(!rt.dragState&&this.props.onExternalDrag){const e=this.props.onExternalDrag(t);if(e){const t=O.fromJson(e.json,this.props.model,!1);rt.dragState=new Tt(this.mainLayout,ht.External,t,e.json,e.onDrop)}}if(rt.dragState){if(this.windowId!==W.MAIN_WINDOW_ID&&rt.dragState.mainLayout===this.mainLayout&&rt.dragState.mainLayout.setDraggingOverWindow(!0),rt.dragState.mainLayout!==this.mainLayout)return;t.preventDefault(),this.dropInfo=void 0;const i=this.selfRef.current;this.outlineDiv=this.currentDocument.createElement("div"),this.outlineDiv.className=this.getClassName(r.FLEXLAYOUT__OUTLINE_RECT),this.outlineDiv.style.visibility="hidden";const n=this.props.model.getAttribute("tabDragSpeed");this.outlineDiv.style.transition=`top ${n}s, left ${n}s, width ${n}s, height ${n}s`,i.appendChild(this.outlineDiv),this.dragging=!0,this.showOverlay(!0),this.isDraggingOverWindow||void 0!==this.props.model.getMaximizedTabset(this.windowId)||this.setState({showEdges:this.props.model.isEnableEdgeDock()});const o=null===(e=this.selfRef.current)||void 0===e?void 0:e.getBoundingClientRect();new u(t.clientX-o.left,t.clientY-o.top,1,1).positionElement(this.outlineDiv)}},this.onDragOver=t=>{var e,i,n;if(this.dragging&&!this.isDraggingOverWindow){t.preventDefault();const o=null===(e=this.selfRef.current)||void 0===e?void 0:e.getBoundingClientRect(),s={x:t.clientX-(null!==(i=null==o?void 0:o.left)&&void 0!==i?i:0),y:t.clientY-(null!==(n=null==o?void 0:o.top)&&void 0!==n?n:0)};this.checkForBorderToShow(s.x,s.y);let a=this.props.model.findDropTargetNode(this.windowId,rt.dragState.dragNode,s.x,s.y);a&&(this.dropInfo=a,this.outlineDiv&&(this.outlineDiv.className=this.getClassName(a.className),a.rect.positionElement(this.outlineDiv),this.outlineDiv.style.visibility="visible"))}},this.onDragLeave=t=>{this.dragging&&(this.windowId!==W.MAIN_WINDOW_ID&&rt.dragState.mainLayout.setDraggingOverWindow(!1),this.clearDragLocal())},this.onDrop=t=>{if(this.dragging){t.preventDefault();const e=rt.dragState;if(this.dropInfo)if(void 0!==e.dragJson){const i=this.doAction(_.addNode(e.dragJson,this.dropInfo.node.getId(),this.dropInfo.location,this.dropInfo.index));void 0!==e.fnNewNodeDropped&&e.fnNewNodeDropped(i,t)}else void 0!==e.dragNode&&this.doAction(_.moveNode(e.dragNode.getId(),this.dropInfo.node.getId(),this.dropInfo.location,this.dropInfo.index));this.mainLayout.clearDragMain()}this.dragEnterCount=0},this.orderedIds=[],this.selfRef=l.createRef(),this.moveablesRef=l.createRef(),this.mainRef=l.createRef(),this.findBorderBarSizeRef=l.createRef(),this.supportsPopout=void 0!==t.supportsPopout?t.supportsPopout:ct,this.popoutURL=t.popoutURL?t.popoutURL:"popout.html",this.icons=Object.assign(Object.assign({},dt),t.icons),this.windowId=t.windowId?t.windowId:W.MAIN_WINDOW_ID,this.mainLayout=this.props.mainLayout?this.props.mainLayout:this,this.isDraggingOverWindow=!1,this.layoutWindow=this.props.model.getwindowsMap().get(this.windowId),this.layoutWindow.layout=this,this.popoutWindowName=this.props.popoutWindowName||"Popout Window",this.state={rect:u.empty(),editingTab:void 0,showEdges:!1,showOverlay:!1,calculatedBorderBarSize:29,layoutRevision:0,forceRevision:0,showHiddenBorder:g.CENTER},this.isMainWindow=this.windowId===W.MAIN_WINDOW_ID}componentDidMount(){if(this.updateRect(),this.currentDocument=this.selfRef.current.ownerDocument,this.currentWindow=this.currentDocument.defaultView,this.layoutWindow.window=this.currentWindow,this.layoutWindow.toScreenRectFunction=t=>this.getScreenRect(t),this.resizeObserver=new ResizeObserver((t=>{requestAnimationFrame((()=>{this.updateRect()}))})),this.selfRef.current&&this.resizeObserver.observe(this.selfRef.current),this.isMainWindow)this.props.model.addChangeListener(this.onModelChange),this.updateLayoutMetrics();else{this.currentWindow.addEventListener("resize",(()=>{this.updateRect()}));const t=this.props.mainLayout.getRootDiv(),e=this.selfRef.current;D(t,e),this.styleObserver=new MutationObserver((()=>{D(t,e)&&this.redraw("mutation observer")})),this.styleObserver.observe(t,{attributeFilter:["style"]})}document.addEventListener("visibilitychange",(()=>{for(const[t,e]of this.props.model.getwindowsMap())e.layout&&this.redraw("visibility change")}))}componentDidUpdate(){this.currentDocument=this.selfRef.current.ownerDocument,this.currentWindow=this.currentDocument.defaultView,this.isMainWindow&&(this.props.model!==this.previousModel&&(void 0!==this.previousModel&&this.previousModel.removeChangeListener(this.onModelChange),this.props.model.getwindowsMap().get(this.windowId).layout=this,this.props.model.addChangeListener(this.onModelChange),this.layoutWindow=this.props.model.getwindowsMap().get(this.windowId),this.layoutWindow.layout=this,this.layoutWindow.toScreenRectFunction=t=>this.getScreenRect(t),this.previousModel=this.props.model,this.tidyMoveablesMap()),this.updateLayoutMetrics())}componentWillUnmount(){var t,e;this.selfRef.current&&(null===(t=this.resizeObserver)||void 0===t||t.unobserve(this.selfRef.current)),null===(e=this.styleObserver)||void 0===e||e.disconnect()}render(){if(!this.selfRef.current)return l.createElement("div",{ref:this.selfRef,className:this.getClassName(r.FLEXLAYOUT__LAYOUT)},l.createElement("div",{ref:this.moveablesRef,key:"__moveables__",className:this.getClassName(r.FLEXLAYOUT__LAYOUT_MOVEABLES)}),this.renderMetricsElements());const t=this.props.model;t.getRoot(this.windowId).calcMinMaxSize(),t.getRoot(this.windowId).setPaths(""),t.getBorderSet().setPaths();const e=this.renderLayout(),i=this.renderBorders(e),n=this.renderTabs(),o=this.reorderComponents(n,this.orderedIds);let s=null,a=null,d=null,h=null;return this.isMainWindow&&(s=this.renderWindows(),h=this.renderMetricsElements(),a=this.renderTabMoveables(),d=l.createElement("div",{key:"__tabStamps__",className:this.getClassName(r.FLEXLAYOUT__LAYOUT_TAB_STAMPS)},this.renderTabStamps())),l.createElement("div",{ref:this.selfRef,className:this.getClassName(r.FLEXLAYOUT__LAYOUT),onDragEnter:this.onDragEnterRaw,onDragLeave:this.onDragLeaveRaw,onDragOver:this.onDragOver,onDrop:this.onDrop},l.createElement("div",{ref:this.moveablesRef,key:"__moveables__",className:this.getClassName(r.FLEXLAYOUT__LAYOUT_MOVEABLES)}),h,l.createElement(tt,{key:"__overlay__",layout:this,show:this.state.showOverlay}),i,o,a,d,this.state.portal,s)}renderBorders(t){const e=this.getClassName(r.FLEXLAYOUT__LAYOUT_MAIN),i=this.props.model.getBorderSet().getBorderMap();if(this.isMainWindow&&i.size>0){t=l.createElement("div",{className:e,ref:this.mainRef},t);const n=new Map,o=new Map;for(const[t,e]of g.values){const t=i.get(e);t&&(!t.isAutoHide()||t.isAutoHide()&&(t.getChildren().length>0||this.state.showHiddenBorder===e))&&(n.set(e,l.createElement(J,{layout:this,border:t,size:this.state.calculatedBorderBarSize})),o.set(e,l.createElement(P,{layout:this,border:t,show:-1!==t.getSelected()})))}const s=this.getClassName(r.FLEXLAYOUT__LAYOUT_BORDER_CONTAINER),a=this.getClassName(r.FLEXLAYOUT__LAYOUT_BORDER_CONTAINER_INNER);if(this.props.model.getBorderSet().getLayoutHorizontal()){const e=l.createElement("div",{className:a,style:{flexDirection:"column"}},o.get(g.TOP),l.createElement("div",{className:a,style:{flexDirection:"row"}},o.get(g.LEFT),t,o.get(g.RIGHT)),o.get(g.BOTTOM));return l.createElement("div",{className:s,style:{flexDirection:"column"}},n.get(g.TOP),l.createElement("div",{className:a,style:{flexDirection:"row"}},n.get(g.LEFT),e,n.get(g.RIGHT)),n.get(g.BOTTOM))}{const e=l.createElement("div",{className:a,style:{flexDirection:"row"}},o.get(g.LEFT),l.createElement("div",{className:a,style:{flexDirection:"column"}},o.get(g.TOP),t,o.get(g.BOTTOM)),o.get(g.RIGHT));return l.createElement("div",{className:s,style:{flexDirection:"row"}},n.get(g.LEFT),l.createElement("div",{className:a,style:{flexDirection:"column"}},n.get(g.TOP),e,n.get(g.BOTTOM)),n.get(g.RIGHT))}}return l.createElement("div",{className:e,ref:this.mainRef,style:{position:"absolute",top:0,left:0,bottom:0,right:0,display:"flex"}},t)}renderLayout(){return l.createElement(l.Fragment,null,l.createElement(nt,{key:"__row__",layout:this,node:this.props.model.getRoot(this.windowId)}),this.renderEdgeIndicators())}renderEdgeIndicators(){const t=[],e=this.icons.edgeArrow;if(this.state.showEdges){const i=this.props.model.getRoot(this.windowId).getRect(),n=ut,o=gt,s=ut/2,a=this.getClassName(r.FLEXLAYOUT__EDGE_RECT),d=50;t.push(l.createElement("div",{key:"North",style:{top:0,left:i.width/2-s,width:n,height:o,borderBottomLeftRadius:d,borderBottomRightRadius:d},className:a+" "+this.getClassName(r.FLEXLAYOUT__EDGE_RECT_TOP)},l.createElement("div",{style:{transform:"rotate(180deg)"}},e))),t.push(l.createElement("div",{key:"West",style:{top:i.height/2-s,left:0,width:o,height:n,borderTopRightRadius:d,borderBottomRightRadius:d},className:a+" "+this.getClassName(r.FLEXLAYOUT__EDGE_RECT_LEFT)},l.createElement("div",{style:{transform:"rotate(90deg)"}},e))),t.push(l.createElement("div",{key:"South",style:{top:i.height-o,left:i.width/2-s,width:n,height:o,borderTopLeftRadius:d,borderTopRightRadius:d},className:a+" "+this.getClassName(r.FLEXLAYOUT__EDGE_RECT_BOTTOM)},l.createElement("div",null,e))),t.push(l.createElement("div",{key:"East",style:{top:i.height/2-s,left:i.width-o,width:o,height:n,borderTopLeftRadius:d,borderBottomLeftRadius:d},className:a+" "+this.getClassName(r.FLEXLAYOUT__EDGE_RECT_RIGHT)},l.createElement("div",{style:{transform:"rotate(-90deg)"}},e)))}return t}renderWindows(){const t=[];if(this.supportsPopout){const e=this.props.model.getwindowsMap();let i=1;for(const[n,o]of e)n!==W.MAIN_WINDOW_ID&&(t.push(l.createElement(q,{key:n,layout:this,title:this.popoutWindowName+" "+i,layoutWindow:o,url:this.popoutURL+"?id="+n,onSetWindow:this.onSetWindow,onCloseWindow:this.onCloseWindow},l.createElement(rt,Object.assign({},this.props,{windowId:n,mainLayout:this})))),i++)}return t}renderTabMoveables(){const t=[];return this.props.model.visitNodes((e=>{if(e instanceof O){const i=e,n=this.getMoveableElement(i.getId());i.setMoveableElement(n);const o=i.isSelected(),s=i.getParent().getContentRect(),r=i.isRendered()||(o||!i.isEnableRenderOnDemand())&&s.width>0&&s.height>0;if(r){const e=i.getId()+(i.isEnableWindowReMount()?i.getWindowId():"");t.push((0,d.createPortal)(l.createElement(st,{rect:s,selected:i.isSelected(),forceRevision:this.state.forceRevision,tabsRevision:this.props.renderRevision,key:e},l.createElement(j,{message:this.i18nName(a.Error_rendering_component)},this.props.factory(i))),n,e)),i.setRendered(r)}}})),t}renderTabStamps(){const t=[];return this.props.model.visitNodes((e=>{if(e instanceof O){const i=e;t.push(l.createElement(Z,{key:i.getId(),layout:this,node:i}))}})),t}renderTabs(){const t=new Map;return this.props.model.visitWindowNodes(this.windowId,(e=>{if(e instanceof O){const i=e,n=i.isSelected(),o=i.getPath();(i.isRendered()||n||!i.isEnableRenderOnDemand())&&t.set(i.getId(),l.createElement(ot,{key:i.getId(),layout:this,path:o,node:i,selected:n}))}})),t}renderMetricsElements(){return l.createElement("div",{key:"findBorderBarSize",ref:this.findBorderBarSizeRef,className:this.getClassName(r.FLEXLAYOUT__BORDER_SIZER)},"FindBorderBarSize")}checkForBorderToShow(t,e){const i=this.getBoundingClientRect(this.mainRef.current),n=i.getCenter(),o=gt,s=ut/2;let a=!1;this.props.model.isEnableEdgeDock()&&this.state.showHiddenBorder===g.CENTER&&(e>n.y-s&&e<n.y+s||t>n.x-s&&t<n.x+s)&&(a=!0);let r=g.CENTER;a||(t<=i.x+o?r=g.LEFT:t>=i.getRight()-o?r=g.RIGHT:e<=i.y+o?r=g.TOP:e>=i.getBottom()-o&&(r=g.BOTTOM)),r!==this.state.showHiddenBorder&&this.setState({showHiddenBorder:r})}tidyMoveablesMap(){const t=new Map;this.props.model.visitNodes(((e,i)=>{e instanceof O&&t.set(e.getId(),e)}));for(const[e,i]of this.moveableElementMap)t.has(e)||(i.remove(),this.moveableElementMap.delete(e))}reorderComponents(t,e){const i=[],n=new Set;let o=[];for(const o of e)t.get(o)&&(i.push(o),n.add(o));e.splice(0,e.length,...i);for(const[i,o]of t)n.has(i)||e.push(i);return o=e.map((e=>t.get(e))),o}redraw(t){this.mainLayout.setState(((t,e)=>({forceRevision:t.forceRevision+1})))}redrawInternal(t){this.mainLayout.setState(((t,e)=>({layoutRevision:t.layoutRevision+1})))}doAction(t){if(void 0!==this.props.onAction){const e=this.props.onAction(t);return void 0!==e?this.props.model.doAction(e):void 0}return this.props.model.doAction(t)}getBoundingClientRect(t){const e=this.getDomRect();return e?u.getBoundingClientRect(t).relativeTo(e):u.empty()}getMoveableContainer(){return this.moveablesRef.current}getMoveableElement(t){let e=this.moveableElementMap.get(t);return void 0===e&&(e=document.createElement("div"),this.moveablesRef.current.appendChild(e),e.className=r.FLEXLAYOUT__TAB_MOVEABLE,this.moveableElementMap.set(t,e)),e}getMainLayout(){return this.mainLayout}getCurrentDocument(){return this.currentDocument}getDomRect(){return this.selfRef.current?u.fromDomRect(this.selfRef.current.getBoundingClientRect()):u.empty()}getWindowId(){return this.windowId}getRootDiv(){return this.selfRef.current}getMainElement(){return this.mainRef.current}getFactory(){return this.props.factory}isSupportsPopout(){return this.supportsPopout}isRealtimeResize(){var t;return null!==(t=this.props.realtimeResize)&&void 0!==t&&t}getPopoutURL(){return this.popoutURL}setEditingTab(t){this.setState({editingTab:t})}getEditingTab(){return this.state.editingTab}getModel(){return this.props.model}getScreenRect(t){const e=t.clone(),i=this.getDomRect();return e.x=this.currentWindow.screenX+this.currentWindow.scrollX+1+i.x+e.x,e.y=this.currentWindow.screenY+this.currentWindow.scrollY+59+i.y+e.y,e.height+=60,e.width+=2,e}addTabToTabSet(t,e){if(void 0!==this.props.model.getNodeById(t))return this.doAction(_.addNode(e,t,g.CENTER,-1))}addTabToActiveTabSet(t){const e=this.props.model.getActiveTabset(this.windowId);if(void 0!==e)return this.doAction(_.addNode(t,e.getId(),g.CENTER,-1))}maximize(t){this.doAction(_.maximizeToggle(t.getId(),this.getWindowId()))}customizeTab(t,e){this.props.onRenderTab&&this.props.onRenderTab(t,e)}customizeTabSet(t,e){this.props.onRenderTabSet&&this.props.onRenderTabSet(t,e)}i18nName(t,e){let i;return this.props.i18nMapper&&(i=this.props.i18nMapper(t,e)),void 0===i&&(i=t+(void 0===e?"":e)),i}getShowOverflowMenu(){return this.props.onShowOverflowMenu}getTabSetPlaceHolderCallback(){return this.props.onTabSetPlaceHolder}showContextMenu(t,e){this.props.onContextMenu&&this.props.onContextMenu(t,e)}auxMouseClick(t,e){this.props.onAuxMouseClick&&this.props.onAuxMouseClick(t,e)}showOverlay(t){this.setState({showOverlay:t}),L(!t,this.currentDocument)}addTabWithDragAndDrop(t,e,i){const n=O.fromJson(e,this.props.model,!1);rt.dragState=new Tt(this.mainLayout,ht.Add,n,e,i)}moveTabWithDragAndDrop(t,e){this.setDragNode(t,e)}setDragComponent(t,e,i,n){let o=l.createElement("div",{style:{position:"unset"},className:this.getClassName(r.FLEXLAYOUT__LAYOUT)+" "+this.getClassName(r.FLEXLAYOUT__DRAG_RECT)},e);const s=this.currentDocument.createElement("div");s.setAttribute("data-layout-path","/drag-rectangle"),s.style.position="absolute",s.style.left="-10000px",s.style.top="-10000px",this.currentDocument.body.appendChild(s),(0,h.H)(s).render(o),t.dataTransfer.setDragImage(s,i,n),setTimeout((()=>{this.currentDocument.body.removeChild(s)}),0)}setDraggingOverWindow(t){this.isDraggingOverWindow!==t&&(this.outlineDiv&&(this.outlineDiv.style.visibility=t?"hidden":"visible"),t?this.setState({showEdges:!1}):void 0===this.props.model.getMaximizedTabset(this.windowId)&&this.setState({showEdges:this.props.model.isEnableEdgeDock()}),this.isDraggingOverWindow=t)}clearDragMain(){rt.dragState=void 0,this.windowId===W.MAIN_WINDOW_ID&&(this.isDraggingOverWindow=!1);for(const[,t]of this.props.model.getwindowsMap())t.layout.clearDragLocal()}clearDragLocal(){this.setState({showEdges:!1}),this.showOverlay(!1),this.dragEnterCount=0,this.dragging=!1,this.outlineDiv&&(this.selfRef.current.removeChild(this.outlineDiv),this.outlineDiv=void 0)}}rt.dragState=void 0;const lt="0.8.1",dt={close:l.createElement(Q,null),closeTabset:l.createElement(Q,null),popout:l.createElement((()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",style:K,viewBox:"0 0 20 20",fill:"var(--color-icon)"},l.createElement("path",{d:"M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z"}),l.createElement("path",{d:"M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z"}))),null),maximize:l.createElement((()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",style:K,viewBox:"0 0 24 24",fill:"var(--color-icon)"},l.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),l.createElement("path",{stroke:"var(--color-icon)",d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"}))),null),restore:l.createElement((()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",style:K,viewBox:"0 0 24 24",fill:"var(--color-icon)"},l.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),l.createElement("path",{stroke:"var(--color-icon)",d:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"}))),null),more:l.createElement((()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",style:K,viewBox:"0 0 24 24",fill:"var(--color-icon)"},l.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),l.createElement("path",{stroke:"var(--color-icon)",d:"M7 10l5 5 5-5z"}))),null),edgeArrow:l.createElement((()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",style:{display:"block",width:10,height:10},preserveAspectRatio:"none",viewBox:"0 0 100 100"},l.createElement("path",{fill:"var(--color-edge-icon)",stroke:"var(--color-edge-icon)",d:"M10 30 L90 30 l-40 40 Z"}))),null),activeTabset:l.createElement((()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",style:K,height:"24px",viewBox:"0 -960 960 960",width:"24px"},l.createElement("path",{fill:"var(--color-icon)",stroke:"var(--color-icon)",d:"M440-120v-264L254-197l-57-57 187-186H120v-80h264L197-706l57-57 186 187v-264h80v264l186-187 57 57-187 186h264v80H576l187 186-57 57-186-187v264h-80Z"}))),null)};var ht;!function(t){t.Internal="internal",t.External="external",t.Add="add"}(ht||(ht={}));const ct=w(),ut=100,gt=10;class Tt{constructor(t,e,i,n,o){this.mainLayout=t,this.dragSource=e,this.dragNode=i,this.dragJson=n,this.fnNewNodeDropped=o}}return s})()));
|
package/lib/model/TabSetNode.js
CHANGED
|
@@ -189,6 +189,8 @@ export class TabSetNode extends Node {
|
|
|
189
189
|
this.calculatedMaxWidth = Math.min(this.calculatedMaxWidth, c.getMaxWidth());
|
|
190
190
|
this.calculatedMaxHeight = Math.min(this.calculatedMaxHeight, c.getMaxHeight());
|
|
191
191
|
}
|
|
192
|
+
this.calculatedMinHeight += this.tabStripRect.height;
|
|
193
|
+
this.calculatedMaxHeight += this.tabStripRect.height;
|
|
192
194
|
}
|
|
193
195
|
/** @internal */
|
|
194
196
|
canMaximize() {
|