nx-kv 0.67.2 → 0.68.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/package.json +1 -1
  3. package/src/web/frontend/components/layout/vsc-crumbs-model.ts +232 -0
  4. package/src/web/frontend/components/layout/vsc-crumbs.css +88 -0
  5. package/src/web/frontend/components/layout/vsc-crumbs.tsx +99 -0
  6. package/src/web/frontend/page/dir/task.tsx +14 -15
  7. package/src/web/frontend/page/settings/index.tsx +20 -0
  8. package/src/web/frontend/page/settings/style.css +24 -0
  9. package/src/web/frontend/types.ts +2 -0
  10. package/src/web/frontend/workspace/open.ts +4 -2
  11. package/src/web/public/assets/{bar-C0Q_Qe4z.js → bar-C-XvccT_.js} +1 -1
  12. package/src/web/public/assets/{composer-launch-BF3_hyn5.js → composer-launch-DocQvHKh.js} +1 -1
  13. package/src/web/public/assets/{composer-panel-BWJzkrXS.js → composer-panel-BYxKIE03.js} +1 -1
  14. package/src/web/public/assets/{dag-C3OiVSpt.js → dag-EGY58BeS.js} +1 -1
  15. package/src/web/public/assets/{dir-BD8bocip.js → dir-BjMCzD3e.js} +1 -1
  16. package/src/web/public/assets/doc-CKbuO1Gj.js +6 -0
  17. package/src/web/public/assets/{group-DaBalriD.js → group-Bh5tkQR3.js} +1 -1
  18. package/src/web/public/assets/{index-q51dndMj.js → index-cyRcywoY.js} +3 -3
  19. package/src/web/public/assets/{md-history-COQu16vy.js → md-history-sxG54jJ_.js} +1 -1
  20. package/src/web/public/assets/{progress-CDh6DY7g.js → progress-CPQSMxLp.js} +1 -1
  21. package/src/web/public/assets/{refs-t79ynSY8.js → refs-Bzf1kVpx.js} +1 -1
  22. package/src/web/public/assets/{repo-form-modal-dZqpHyUj.js → repo-form-modal-geOSTx9x.js} +1 -1
  23. package/src/web/public/assets/{repos-DdhOQJqF.js → repos-BbKWW4no.js} +1 -1
  24. package/src/web/public/assets/route-crumb-CqDySF_k.js +1 -0
  25. package/src/web/public/assets/{settings-BWHjNegB.css → settings-d2ah_h6O.css} +1 -1
  26. package/src/web/public/assets/{settings-2rNJ_YAJ.js → settings-iqLRF9ip.js} +1 -1
  27. package/src/web/public/assets/task-BeaiJyO3.js +14 -0
  28. package/src/web/public/assets/task-Dcd2eA8B.css +1 -0
  29. package/src/web/public/assets/{task-ops-CWb5frMG.js → task-ops-BKVm1WHw.js} +1 -1
  30. package/src/web/public/assets/{templates-B9Nu7yqL.js → templates-B32TlcGk.js} +3 -3
  31. package/src/web/public/assets/{tool-bar-DPXnjdQF.js → tool-bar-DpfJRjFG.js} +1 -1
  32. package/src/web/public/assets/{use-rail-drag-B6J0iqFK.js → use-rail-drag-DcUzHeV_.js} +1 -1
  33. package/src/web/public/index.html +7 -8
  34. package/src/web/public/assets/doc-CVIVBV6n.js +0 -6
  35. package/src/web/public/assets/list-search-DFvFY408.js +0 -1
  36. package/src/web/public/assets/route-crumb-BKq2jry0.js +0 -1
  37. package/src/web/public/assets/task-PK9OACFo.js +0 -13
@@ -25,4 +25,4 @@ Error generating stack: `+e.message+`
25
25
  via the ui, and cannot be dragged out of their tabset (they can be reordered within the pinned group).
26
26
  Set via Actions.setTabPinned. Only applies to tabs in tabsets (not borders); pinned tabs should be
27
27
  listed first in the json`),t.addInherited(`enableClose`,`tabEnableClose`).setDescription(`whether the tab can be closed by the user via its close button`),t.addInherited(`closeType`,`tabCloseType`).setDescription(`when the tab's close button is active: Visible (default) active if selected or hovered (note: mobile doesnt support hovered), Always: always active, Selected only active on selected tab (clicking on the x button on a non-selected tab will just select it)`),t.addInherited(`enableDrag`,`tabEnableDrag`).setDescription(`whether the user can drag the tab to a new location`),t.addInherited(`enableRename`,`tabEnableRename`).setDescription(`whether the user can rename the tab by double clicking`),t.addInherited(`enablePin`,`tabEnablePin`).setDescription(`whether the user can pin/unpin the tab via the context menu`),t.addInherited(`className`,`tabClassName`).setDescription(`class applied to tab button`),t.addInherited(`contentClassName`,`tabContentClassName`).setDescription(`class applied to tab content`),t.addInherited(`icon`,`tabIcon`).setDescription(`the tab icon`),t.addInherited(`enableRenderOnDemand`,`tabEnableRenderOnDemand`).setDescription(`whether to avoid rendering component until tab is visible`),t.addInherited(`enablePopout`,`tabEnablePopout`).setDescription(`enable window popout (in popout capable browser), to show an icon in the tabset header also set the enablePopoutIcon attribute`),t.addInherited(`enableFloat`,`tabEnableFloat`).setDescription(`whether the user can move the tab to a floating window via the context menu`),t.addInherited(`enablePopoutIcon`,`tabEnablePopoutIcon`).setDescription(`whether to show the popout icon in the tabset header if this tab enables popouts`),t.addInherited(`enableFloatIcon`,`tabEnableFloatIcon`).setAlias(`enablePopoutFloatIcon`).setDescription(`whether to show the float icon in the tabset header if this tab enables floating`),t.addInherited(`enablePopoutOverlay`,`tabEnablePopoutOverlay`).setDescription(`if this tab will not work correctly in a popout window when the main window is backgrounded (inactive)
28
- then enabling this option will gray out this tab`),t.addInherited(`borderWidth`,`tabBorderWidth`).setDescription(`the width of this tab when shown in a border; -1 uses the border's default size`),t.addInherited(`borderHeight`,`tabBorderHeight`).setDescription(`the height of this tab when shown in a border; -1 uses the border's default size`),t.addInherited(`minWidth`,`tabMinWidth`).setDescription(`the minimum width (in px) of this tab`),t.addInherited(`minHeight`,`tabMinHeight`).setDescription(`the minimum height (in px) of this tab`),t.addInherited(`maxWidth`,`tabMaxWidth`).setDescription(`the maximum width (in px) of this tab`),t.addInherited(`maxHeight`,`tabMaxHeight`).setDescription(`the maximum height (in px) of this tab`),t.addInherited(`enableScrollbars`,`tabEnableScrollbars`).setDescription(`whether the tab will be hosted in a scrollable container`),t}},V=function(e){return e.Close_Tab=`flexlayout.ui.close.tab`,e.Pinned_Tab=`flexlayout.ui.pinned.tab`,e.Rename_Tab=`flexlayout.ui.rename.tab`,e.Close_Tabset=`flexlayout.ui.close.tabset`,e.Active_Tabset=`flexlayout.ui.active.tabset`,e.Move_Tabset=`flexlayout.ui.move.tabset`,e.Move_Tabs=`flexlayout.ui.move.tabs (?)`,e.Move_Group=`flexlayout.ui.move.group (?)`,e.Maximize=`flexlayout.ui.maximize.tabset`,e.Restore=`flexlayout.ui.restore.tabset`,e.Popout_Tab=`flexlayout.ui.popout.tab`,e.Popout_Tab_Float=`flexlayout.ui.popout.tab.float`,e.Popout_Float_To_Window=`flexlayout.ui.popout.float.to.window`,e.Dock_Float_To_Layout=`flexlayout.ui.dock.float.to.layout`,e.Dock_Float_Tabs=`flexlayout.ui.dock.float.tabs (?)`,e.Overflow_Menu_Tooltip=`flexlayout.ui.overflow.menu.tooltip`,e.Splitter=`flexlayout.ui.splitter`,e.Error_rendering_component=`flexlayout.ui.error.rendering.component`,e.Error_rendering_component_retry=`flexlayout.ui.error.rendering.component.retry`,e.Popout_Window_Name=`flexlayout.ui.popout.window.name`,e.Menu_Rename=`flexlayout.ui.menu.rename`,e.Menu_Pin=`flexlayout.ui.menu.pin`,e.Menu_Unpin=`flexlayout.ui.menu.unpin`,e.Menu_Popout=`flexlayout.ui.menu.popout`,e.Menu_Float=`flexlayout.ui.menu.float`,e.Menu_Popout_Tabset=`flexlayout.ui.menu.popout.tabset`,e.Menu_Float_Tabset=`flexlayout.ui.menu.float.tabset`,e.Menu_Maximize=`flexlayout.ui.menu.maximize`,e.Menu_Restore=`flexlayout.ui.menu.restore`,e.Menu_Overlay=`flexlayout.ui.menu.overlay`,e.Menu_Split=`flexlayout.ui.menu.split`,e.Menu_Close_All=`flexlayout.ui.menu.close.all`,e.Menu_Close_Right=`flexlayout.ui.menu.close.right`,e.Menu_Close_Others=`flexlayout.ui.menu.close.others`,e.Menu_Add_To_New_Group=`flexlayout.ui.menu.add.to.new.group`,e.Menu_Add_To_Group=`flexlayout.ui.menu.add.to.group`,e.Menu_Remove_From_Group=`flexlayout.ui.menu.remove.from.group`,e.Menu_Ungroup=`flexlayout.ui.menu.ungroup`,e.Menu_Expand=`flexlayout.ui.menu.expand`,e.Menu_Collapse=`flexlayout.ui.menu.collapse`,e.Rename_Group=`flexlayout.ui.rename.group`,e.Group_Color=`flexlayout.ui.group.color`,e.Group_Pill_Tooltip=`flexlayout.ui.group.pill.tooltip`,e.Group_Name_Label=`flexlayout.ui.group.name.label`,e.Group_Name_Placeholder=`flexlayout.ui.group.name.placeholder`,e.Group_Color_N=`flexlayout.ui.group.color.n`,e.Group_Default_Name=`flexlayout.ui.group.default.name`,e}({}),he={"flexlayout.ui.close.tab":`Close`,"flexlayout.ui.pinned.tab":`Pinned`,"flexlayout.ui.rename.tab":`Rename tab`,"flexlayout.ui.close.tabset":`Close tabset`,"flexlayout.ui.active.tabset":`Active tabset`,"flexlayout.ui.move.tabset":`Move tabset`,"flexlayout.ui.move.tabs (?)":`Move tabs (?)`,"flexlayout.ui.move.group (?)":`Move group (?)`,"flexlayout.ui.maximize.tabset":`Maximize tabset`,"flexlayout.ui.restore.tabset":`Restore tabset`,"flexlayout.ui.popout.tab":`Popout selected tab`,"flexlayout.ui.popout.tab.float":`Float selected tab`,"flexlayout.ui.popout.float.to.window":`Popout panel`,"flexlayout.ui.dock.float.to.layout":`Drag into another layout`,"flexlayout.ui.dock.float.tabs (?)":`Dock tabs (?)`,"flexlayout.ui.overflow.menu.tooltip":`Hidden tabs`,"flexlayout.ui.splitter":`Resize`,"flexlayout.ui.error.rendering.component":`Error rendering component`,"flexlayout.ui.error.rendering.component.retry":`Retry`,"flexlayout.ui.popout.window.name":`Popout Window`,"flexlayout.ui.menu.rename":`Rename`,"flexlayout.ui.menu.pin":`Pin`,"flexlayout.ui.menu.unpin":`Unpin`,"flexlayout.ui.menu.popout":`Popout`,"flexlayout.ui.menu.float":`Float`,"flexlayout.ui.menu.popout.tabset":`Pop out tabset`,"flexlayout.ui.menu.float.tabset":`Float tabset`,"flexlayout.ui.menu.maximize":`Maximize`,"flexlayout.ui.menu.restore":`Restore`,"flexlayout.ui.menu.overlay":`Overlay`,"flexlayout.ui.menu.split":`Split`,"flexlayout.ui.menu.close.all":`Close All`,"flexlayout.ui.menu.close.right":`Close to the Right`,"flexlayout.ui.menu.close.others":`Close Others`,"flexlayout.ui.menu.add.to.new.group":`Add to new group`,"flexlayout.ui.menu.add.to.group":`Add to group`,"flexlayout.ui.menu.remove.from.group":`Remove from group`,"flexlayout.ui.menu.ungroup":`Ungroup`,"flexlayout.ui.menu.expand":`Expand`,"flexlayout.ui.menu.collapse":`Collapse`,"flexlayout.ui.rename.group":`Rename group`,"flexlayout.ui.group.color":`Group color`,"flexlayout.ui.group.pill.tooltip":`Tab Group, click to expand/collapse`,"flexlayout.ui.group.name.label":`Name`,"flexlayout.ui.group.name.placeholder":`Group Name`,"flexlayout.ui.group.color.n":`Group color ?`,"flexlayout.ui.group.default.name":`Group`},H={closeTab:`Ctrl+Delete`,renameTab:`F2`,focusTabToggle:void 0,focusNextTabset:void 0,focusPreviousTabset:void 0,closeOverlayBorder:`Escape`};function ge(){return typeof window<`u`&&window.matchMedia&&window.matchMedia(`(hover: hover) and (pointer: fine)`).matches}function _e(e,t,n){let r,i=t.getName(),a=t.getName();n===void 0&&(n=0),r===void 0&&t.getIcon()!==void 0&&(r=n===0?(0,f.jsx)(`img`,{style:{width:`1em`,height:`1em`},src:t.getIcon(),alt:``}):(0,f.jsx)(`img`,{style:{width:`1em`,height:`1em`,transform:`rotate(`+n+`deg)`},src:t.getIcon(),alt:``}));let o={leading:r,content:i,name:a,buttons:[]};return e.customizeTab(t,o),t.setRenderedName(o.name),o}function ve(e,t){return e+t.replace(/\s/g,`_`)}function ye(e){return e.getPath().replace(/\/t(\d+)$/,`/tb$1`)}function be(e,t){if(!t||typeof e.key!=`string`)return!1;let n=t.split(`+`),r=n.pop(),i=e=>n.some(t=>t.toLowerCase()===e);return e.key.toLowerCase()===r.toLowerCase()&&e.ctrlKey===i(`ctrl`)&&e.shiftKey===i(`shift`)&&e.altKey===i(`alt`)&&e.metaKey===i(`meta`)}function xe(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey}function Se(e){return{...H,...e}}function Ce(e){return e?.replace(/\bctrl\b/i,`Control`)}function we(e){e&&(e.querySelector(`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`)??e).focus()}function Te(e){let t=!1;return e.nativeEvent instanceof MouseEvent&&(e.nativeEvent.button!==0||e.ctrlKey||e.altKey||e.metaKey||e.shiftKey)&&(t=!0),t}function Ee(e,t){let n=[...De(`iframe`,t),...De(`webview`,t)];for(let t of n)t.style.pointerEvents=e?`auto`:`none`}function De(e,t){return[...t.getElementsByTagName(e)]}var Oe=!1;function ke(e,t,n,r,i){Oe=!0,t.preventDefault(),t.currentTarget&&typeof t.currentTarget.setPointerCapture==`function`&&t.currentTarget.setPointerCapture(t.pointerId);let a=e=>{e.preventDefault(),n(e.clientX,e.clientY)},o=()=>{e.removeEventListener(`pointermove`,a),e.removeEventListener(`pointerup`,c),e.removeEventListener(`pointercancel`,s)},s=e=>{e.preventDefault(),o(),Oe=!1,i()},c=()=>{o(),Oe=!1,r()};e.addEventListener(`pointermove`,a),e.addEventListener(`pointerup`,c),e.addEventListener(`pointercancel`,s)}function Ae(e,t){let n=e.getAttribute(`style`);return n!==t.getAttribute(`style`)&&(n?t.setAttribute(`style`,n):t.removeAttribute(`style`),!0)}function je(){let e=navigator.userAgent;return e.includes(`Safari`)&&!e.includes(`Chrome`)&&!e.includes(`Chromium`)}function Me(e=window){let t=e.document;return{scrollTop:e.pageYOffset||t.documentElement.scrollTop||t.body.scrollTop||0,scrollLeft:e.pageXOffset||t.documentElement.scrollLeft||t.body.scrollLeft||0,fullHeight:Math.max(t.body.scrollHeight,t.documentElement.scrollHeight,t.body.offsetHeight,t.documentElement.offsetHeight,t.body.clientHeight,t.documentElement.clientHeight),fullWidth:Math.max(t.body.scrollWidth,t.documentElement.scrollWidth,t.body.offsetWidth,t.documentElement.offsetWidth,t.body.clientWidth,t.documentElement.clientWidth),viewportHeight:e.innerHeight||t.documentElement.clientHeight,viewportWidth:e.innerWidth||t.documentElement.clientWidth}}var Ne=e=>{let{controller:t,show:n}=e;return(0,f.jsx)(`div`,{"aria-hidden":`true`,className:t.getClassName(T.FLEXLAYOUT__LAYOUT_OVERLAY),style:{display:n?`flex`:`none`}})};Ne.displayName=`Overlay`;var Pe=2e3,Fe=750,Ie=e=>{let{title:t,controller:n,layout:r,url:i,onCloseLayout:a,children:o}=e,s=d.useRef(null),[c,l]=d.useState(void 0),[u,f]=d.useState(void 0),[m,h]=d.useState(void 0),g=d.useMemo(()=>new Map,[]),_=d.useRef(!1),v=d.useRef(null),y=d.useRef(null),b=d.useRef(null),x=d.useRef(new Map);if(d.useLayoutEffect(()=>{!_.current&&c&&(_.current=!0,n.redrawLayout(),He(g))},[c,n,g]),d.useLayoutEffect(()=>{let e=()=>{if(s.current){let e=s.current;s.current=null,e.close()}};if(!s.current){let o=r.getLayoutId(),c=r.getRect();s.current=window.open(i,o,`left=${c.x},top=${c.y},width=${c.width},height=${c.height}`),s.current?(window.addEventListener(`beforeunload`,e),s.current.addEventListener(`load`,()=>{if(s.current){b.current?.(),_.current=!1;let e=s.current;s.current.focus(),s.current.resizeTo(c.width,c.height),s.current.moveTo(c.x,c.y);let i=s.current;i.resizeBy(c.width-i.outerWidth,c.height-i.outerHeight),i.moveBy(c.x-i.screenLeft,c.y-i.screenTop);let o=s.current.document;f(s.current),h(o),o.title=t,document.documentElement.lang&&(o.documentElement.lang=document.documentElement.lang),document.documentElement.dir&&(o.documentElement.dir=document.documentElement.dir);let u=o.createElement(`div`);u.className=T.FLEXLAYOUT__FLOATING_WINDOW_CONTENT,o.body.appendChild(u),n.getProps().onPopoutOpen?.(r,s.current,o),ze(o,g).then(()=>{l(u)}),v.current=new MutationObserver(e=>Le(e,o,g)),v.current.observe(document.head,{childList:!0,subtree:!0,characterData:!0}),y.current=o.defaultView?.setInterval(()=>{Ue(g,x.current)},Fe)??null;let d=()=>{s.current&&(n.getProps().onPopoutClose?.(r,s.current,o),a(r),s.current=null,b.current?.())};e.addEventListener(`beforeunload`,d),b.current=()=>{v.current?.disconnect(),v.current=null,y.current!=null&&(o.defaultView?.clearInterval(y.current),y.current=null),e.removeEventListener(`beforeunload`,d)}}})):(console.warn(`Unable to open window ${i}`),a(r))}return()=>{window.removeEventListener(`beforeunload`,e),s.current?.close(),s.current=null,b.current?.()}},[]),c!==void 0){let e=n.getProps().renderPopoutContent,t=o;return e&&m&&(t=e({children:o,layout:r,popoutWindow:u??window,popoutDocument:m})),(0,p.createPortal)(t,c)}return null};function Le(e,t,n){for(let r of e)if(r.type===`childList`&&r.target===document.head){for(let e of r.addedNodes)(e instanceof HTMLLinkElement||e instanceof HTMLStyleElement)&&Be(t,e,n);for(let e of r.removedNodes)if(e instanceof HTMLLinkElement||e instanceof HTMLStyleElement){let t=n.get(e);t&&(t.remove(),n.delete(e))}}else{let e=Re(r.target),t=e&&n.get(e);e&&t&&Ve(e,t)}}function Re(e){let t=e instanceof HTMLElement?e:e.parentNode;for(;t&&!(t instanceof HTMLStyleElement);)t=t.parentNode;return t instanceof HTMLStyleElement?t:void 0}function ze(e,t){let n=[],r=document.querySelectorAll(`style, link[rel="stylesheet"]`);for(let i of r)Be(e,i,t,n);return Promise.all(n)}function Be(e,t,n,r){if(t instanceof HTMLLinkElement){let i=t.cloneNode(!0);e.head.appendChild(i),n.set(t,i),r&&r.push(new Promise(t=>{let n=!1,r=e=>{n||(n=!0,t(e))};i.onload=()=>r(!0),i.onerror=()=>r(!1),e.defaultView?.setTimeout(()=>r(!1),Pe)}))}else if(t instanceof HTMLStyleElement)try{let r=t.cloneNode(!0);e.head.appendChild(r),Ve(t,r),n.set(t,r)}catch{}}function Ve(e,t){let n=e.textContent??``;if(n.trim()!==``)t.textContent=n;else try{t.textContent=``;let n=e.sheet?.cssRules;if(n)for(let e of n)t.sheet.insertRule(e.cssText,t.sheet.cssRules.length)}catch{}}function He(e){for(let[t,n]of e)t instanceof HTMLStyleElement&&Ve(t,n)}function Ue(e,t){for(let[n,r]of e){if(!(n instanceof HTMLStyleElement)||(n.textContent??``).trim()!==``)continue;let e=0;try{e=n.sheet?.cssRules.length??0}catch{}e!==t.get(n)&&(t.set(n,e),Ve(n,r))}}Ie.displayName=`PopoutWindow`;var We=10,Ge=-4,Ke=8,qe=12,Je=150,Ye=25,Xe=e=>{let{controller:t,layout:n,children:r}=e,[i,a]=d.useState(n.getRect()),o=d.useRef(x.empty()),s=t.getClassName,c=d.useRef(null),l=d.useRef(null),u=d.useRef(null),p=d.useRef(null),m=d.useRef(null),h=d.useRef(null),g=d.useRef(null),_=d.useRef(null),v=d.useRef(null),y=d.useRef(null),b=d.useRef(!1),S=d.useRef(void 0);d.useEffect(()=>{o.current=i},[i]),d.useEffect(()=>{let e=requestAnimationFrame(()=>{a(n.getRect())});return()=>cancelAnimationFrame(e)},[n]);let C=d.useCallback(e=>{let n=t.getCurrentWindow()??window,r=x.fromDomRect(t.getRootDiv().getBoundingClientRect()),i;if(t.getProps().constrainFloatPanels)i=new x(0,0,r.width,r.height);else{let e=Me(n),t=Math.max(e.fullWidth,n.innerWidth),a=Math.max(e.fullHeight,n.innerHeight);i=new x(-r.x,-r.y,t,a)}let a=e.clone();return a.clamp(i),a},[t]),w=d.useCallback(e=>{e.preventDefault(),e.stopImmediatePropagation()},[]);d.useEffect(()=>{let e=[l,u,p,m,h,g,_,v,y].map(e=>e.current).filter(e=>e!==null);return e.forEach(e=>e.addEventListener(`touchstart`,w,{passive:!1})),()=>{e.forEach(e=>e.removeEventListener(`touchstart`,w))}},[w]);let D=d.useRef(!1);d.useLayoutEffect(()=>{if(!D.current){D.current=!0;let e=C(i);e.equals(i)||(a(e),n.setRect(e))}},[C,i,n]),d.useEffect(()=>{let e=()=>{let e=[...t.getModel().getLayouts()],r=e[e.length-1][1];n!==r&&(b.current=!0)},r=t.getCurrentWindow()??window,i=()=>{b.current&&=(S.current=r.setTimeout(()=>{S.current=void 0,t.moveWindowToFront(n.getLayoutId())},10),!1)},a=c.current;return a&&(a.addEventListener(`pointerdown`,e,{capture:!0}),a.addEventListener(`pointerup`,i)),()=>{a&&(a.removeEventListener(`pointerdown`,e,{capture:!0}),a.removeEventListener(`pointerup`,i)),S.current!==void 0&&(r.clearTimeout(S.current),S.current=void 0)}},[t,n]);let O=e=>{e.stopPropagation();let r={x:e.clientX-i.x,y:e.clientY-i.y};t.showOverlayOnAllWindows(!0),ke(t.getCurrentDocument()??document,e,(e,o)=>{b.current&&=(t.moveWindowToFront(n.getLayoutId()),!1);let s=new x(e-r.x,o-r.y,i.width,i.height),c=C(s);a(c),t.doAction(E.moveFloat(n.getLayoutId(),c).setAdjusting(!0))},()=>{t.doAction(E.moveFloat(n.getLayoutId(),o.current).setAdjusting(!1)),t.redrawLayout(),t.showOverlayOnAllWindows(!1)},()=>{t.doAction(E.moveFloat(n.getLayoutId(),o.current).setAdjusting(!1)),t.redrawLayout(),t.showOverlayOnAllWindows(!1)})},k=t.getIcons(),A=t.isSupportsPopout()&&n.getRootRow()?.isAllowedInWindow()===!0,j=e=>{e.stopPropagation(),n.getRootRow()?.getChildren().length?t.getDragDropManager().startDockLayoutDrag(e.nativeEvent,n,c.current??void 0):e.preventDefault()},M=e=>{t.getDragDropManager().onDragEnded()},N=e=>{e.stopPropagation()},ee=e=>{e.stopPropagation();let r=t.getScreenRect(n.getRect());t.doAction(E.popoutFloat(n.getLayoutId(),r.toJson()))},P=(e,r)=>{let s=i,c={x:e.clientX,y:e.clientY};t.showOverlayOnAllWindows(!0),ke(t.getCurrentDocument()??document,e,(e,i)=>{let o=e-c.x,l=i-c.y,u=s.x,d=s.y,f=s.width,p=s.height;r.includes(`n`)&&(d+=l,p-=l),r.includes(`s`)&&(p+=l),r.includes(`w`)&&(u+=o,f-=o),r.includes(`e`)&&(f+=o);let m=new x(u,d,Math.max(Je,f),Math.max(Ye,p)),h=C(m);a(h),t.doAction(E.moveFloat(n.getLayoutId(),h).setAdjusting(!0))},()=>{t.doAction(E.moveFloat(n.getLayoutId(),o.current).setAdjusting(!1)),t.redrawLayout(),t.showOverlayOnAllWindows(!1)},()=>{t.doAction(E.moveFloat(n.getLayoutId(),o.current).setAdjusting(!1)),t.redrawLayout(),t.showOverlayOnAllWindows(!1)}),e.stopPropagation()};return(0,f.jsxs)(`div`,{ref:c,className:s(T.FLEXLAYOUT__FLOAT_WINDOW),style:{left:i.x,top:i.y,width:i.width,height:i.height,position:`absolute`},children:[(0,f.jsxs)(`div`,{ref:l,className:s(T.FLEXLAYOUT__FLOAT_WINDOW_HEADER),onPointerDown:O,children:[(0,f.jsx)(`div`,{"data-layout-path":`/floatwindow/drag-handle`,className:s(T.FLEXLAYOUT__FLOAT_WINDOW_DRAG_HANDLE),draggable:!0,title:t.i18nName(V.Dock_Float_To_Layout),"aria-label":t.i18nName(V.Dock_Float_To_Layout),onDragStart:j,onDragEnd:M,onPointerDown:N,children:k.dragToDock}),(0,f.jsx)(`div`,{style:{flexGrow:1,display:`flex`,justifyContent:`center`,alignItems:`center`,minWidth:0,overflow:`hidden`},children:n.getName()===void 0?(0,f.jsx)(`div`,{style:{width:50,height:8,display:`flex`,flexDirection:`column`,justifyContent:`space-around`,opacity:.5},children:(0,f.jsx)(`div`,{style:{height:2,backgroundColor:`gray`,borderRadius:1}})}):(0,f.jsx)(`span`,{"data-layout-path":`/floatwindow/title`,className:s(T.FLEXLAYOUT__FLOAT_WINDOW_HEADER_TITLE),title:n.getName(),children:n.getName()})}),A&&(0,f.jsx)(`button`,{type:`button`,"data-layout-path":`/floatwindow/button/popout`,className:s(T.FLEXLAYOUT__FLOAT_WINDOW_BUTTON),title:t.i18nName(V.Popout_Float_To_Window),"aria-label":t.i18nName(V.Popout_Float_To_Window),onClick:ee,onPointerDown:N,children:k.popoutFloatWindow})]}),(0,f.jsx)(`div`,{className:s(T.FLEXLAYOUT__FLOAT_WINDOW_CONTENT),children:r}),(0,f.jsx)(`div`,{ref:u,style:{position:`absolute`,zIndex:We,top:Ge,left:Ke,right:Ke,height:Ke,cursor:`ns-resize`},onPointerDown:e=>P(e,`n`)}),(0,f.jsx)(`div`,{ref:g,style:{position:`absolute`,zIndex:We,bottom:Ge,left:Ke,right:Ke,height:Ke,cursor:`ns-resize`},onPointerDown:e=>P(e,`s`)}),(0,f.jsx)(`div`,{ref:m,style:{position:`absolute`,zIndex:We,top:Ke,bottom:Ke,right:Ge,width:Ke,cursor:`ew-resize`},onPointerDown:e=>P(e,`e`)}),(0,f.jsx)(`div`,{ref:v,style:{position:`absolute`,zIndex:We,top:Ke,bottom:Ke,left:Ge,width:Ke,cursor:`ew-resize`},onPointerDown:e=>P(e,`w`)}),(0,f.jsx)(`div`,{ref:y,style:{position:`absolute`,zIndex:We,top:Ge,left:Ge,width:qe,height:qe,cursor:`nwse-resize`},onPointerDown:e=>P(e,`nw`)}),(0,f.jsx)(`div`,{ref:p,style:{position:`absolute`,zIndex:We,top:Ge,right:Ge,width:qe,height:qe,cursor:`nesw-resize`},onPointerDown:e=>P(e,`ne`)}),(0,f.jsx)(`div`,{ref:_,style:{position:`absolute`,zIndex:We,bottom:Ge,left:Ge,width:qe,height:qe,cursor:`nesw-resize`},onPointerDown:e=>P(e,`sw`)}),(0,f.jsx)(`div`,{ref:h,style:{position:`absolute`,zIndex:We,bottom:0,right:0,width:qe,height:qe,cursor:`nwse-resize`},onPointerDown:e=>P(e,`se`)})]})},Ze=({controller:e})=>{let t=[],n=e.getModel().getLayouts(),r=2e3;for(let[i,a]of n)a.isMainLayout()||(a.getType()===`window`&&e.isSupportsPopout()?t.push((0,f.jsx)(Ie,{controller:e,layout:a,title:e.getPopoutWindowName()+` `+i,url:e.getPopoutURL()+`?id=`+encodeURIComponent(i),onCloseLayout:e.onCloseLayout,children:(0,f.jsx)(`div`,{className:e.getProps().popoutClassName,children:(0,f.jsx)(Ht,{...e.getProps(),layoutId:i,path:a.getPath(),mainLayoutController:e})})},i)):a.getType()===`float`&&(t.push((0,f.jsx)(Xe,{controller:e,layout:a,zIndex:r,onCloseLayout:e.onCloseLayout,children:(0,f.jsx)(Ht,{...e.getProps(),layoutId:i,path:a.getPath(),mainLayoutController:e})},i+`float`)),r++));return(0,f.jsx)(f.Fragment,{children:t})};Ze.displayName=`FloatingWindowContainer`;var Qe=e=>{let{controller:t,tabNode:n,selected:r,border:i,icons:a,path:o}=e,s=d.useRef(null),c=d.useRef(null),l=t.getKeyMap(),u=e=>{n.isEnableDrag()?(e.stopPropagation(),t.getDragDropManager().setDragNode(e.nativeEvent,n)):e.preventDefault()},p=e=>{e.stopPropagation(),t.getDragDropManager().onDragEnded()},m=e=>{Te(e)&&t.auxMouseClick(n,e)},h=e=>{t.showContextMenu(n,e)},g=()=>{t.doAction(E.selectTab(n.getId()))},_=e=>{let t=s.current?.closest(`[role="tablist"]`);if(t){let n=Array.from(t.querySelectorAll(`[role="tab"]`));n[n.indexOf(s.current)+e]?.focus()}},v=()=>{let e=s.current.ownerDocument,t=()=>we(e.getElementById(ve(`flexlayout-tab-`,n.getId())));r?t():(g(),requestAnimationFrame(t))},y=e=>{t.getEditingTab()!==n&&(be(e,l.focusTabToggle)?(v(),e.preventDefault()):e.key===`Enter`||e.key===` `?(g(),e.preventDefault()):(e.key===`ArrowLeft`||e.key===`ArrowUp`)&&!xe(e)?(_(-1),e.preventDefault()):(e.key===`ArrowRight`||e.key===`ArrowDown`)&&!xe(e)?(_(1),e.preventDefault()):be(e,l.closeTab)&&n.isCloseable()&&(_(1),t.doAction(E.deleteTab(n.getId())),e.preventDefault()))},b=()=>{let e=n.getCloseType();return!!(r||e===A.Always||e===A.Visible&&t.getCurrentWindow()?.matchMedia(`(hover: hover) and (pointer: fine)`).matches)},x=e=>{b()&&(t.doAction(E.deleteTab(n.getId())),e.stopPropagation())},S=e=>{e.stopPropagation()},C=()=>{if(r)return!0;let e=n.getTabContainer();return e instanceof z&&e.getSelected()===-1&&e.getTabNodes()[0]===n},w=t.getEditingTab()===n,D=d.useCallback(e=>{s.current=e,t.registerMeasurable(n,`tabbutton`,e)},[t,n]);d.useLayoutEffect(()=>{w&&c.current.select()},[w]),d.useEffect(()=>{if(w){let e=t.getCurrentDocument().body,n=e=>{e.target!==c.current&&t.setEditingTab(void 0)};return e.addEventListener(`pointerdown`,n),()=>e.removeEventListener(`pointerdown`,n)}},[w,t]);let O=e=>{e.stopPropagation()},k=e=>{e.code===`Escape`?(t.setEditingTab(void 0),s.current?.focus()):(e.code===`Enter`||e.code===`NumpadEnter`)&&(t.setEditingTab(void 0),t.doAction(E.renameTab(n.getId(),e.target.value)),s.current?.focus())},j=t.getClassName,M=j(T.FLEXLAYOUT__BORDER_BUTTON)+` `+j(T.FLEXLAYOUT__BORDER_BUTTON_+i);M+=r?` `+j(T.FLEXLAYOUT__BORDER_BUTTON__SELECTED):` `+j(T.FLEXLAYOUT__BORDER_BUTTON__UNSELECTED);let N=n.getParent()instanceof R?n.getParent():void 0;N!==void 0&&(M+=` `+j(T.FLEXLAYOUT__TAB_BUTTON_GROUPED),n.getModel().getTabGroupType()===`underline`&&(M+=` `+j(T.FLEXLAYOUT__TAB_BUTTON_GROUPED_UNDERLINE))),n.getClassName()!==void 0&&(M+=` `+n.getClassName());let ee=0;n.getModel().isEnableRotateBorderIcons()===!1&&(i===`left`?ee=n.getModel().getBorderLeftTabDirection()===`down`?-90:90:i===`right`&&(ee=-90));let P=_e(t,n,ee),te=P.content?(0,f.jsx)(`div`,{className:j(T.FLEXLAYOUT__BORDER_BUTTON_CONTENT),children:P.content}):null,ne=P.leading?(0,f.jsx)(`div`,{className:j(T.FLEXLAYOUT__BORDER_BUTTON_LEADING),children:P.leading}):null;if(w&&(te=(0,f.jsx)(`input`,{ref:c,className:j(T.FLEXLAYOUT__TAB_BUTTON_TEXTBOX),"data-layout-path":o+`/textbox`,type:`text`,"aria-label":t.i18nName(V.Rename_Tab),autoFocus:!0,defaultValue:n.getName(),onKeyDown:k,onPointerDown:O})),n.isCloseable()){let e=t.i18nName(V.Close_Tab);P.buttons.push((0,f.jsx)(`div`,{"data-layout-path":o+`/button/close`,title:e,"aria-hidden":`true`,className:j(T.FLEXLAYOUT__BORDER_BUTTON_TRAILING),onPointerDown:S,onClick:x,children:typeof a.close==`function`?a.close(n):a.close},`close`))}let re=[Ce(l.focusTabToggle),n.isCloseable()?Ce(l.closeTab):void 0].filter(Boolean).join(` `)||void 0,ie={};return N!==void 0&&(ie[`--flexlayout-group-color`]=N.getColor()),(0,f.jsxs)(`div`,{ref:D,id:ve(`flexlayout-tabbutton-`,n.getId()),role:w?void 0:`tab`,"aria-selected":w?void 0:r,"aria-controls":w?void 0:ve(`flexlayout-tab-`,n.getId()),"aria-label":w?void 0:P.name,"aria-keyshortcuts":w?void 0:re,tabIndex:w?-1:C()?0:-1,onKeyDown:y,"data-layout-path":o,className:M,style:ie,onClick:g,onAuxClick:m,onContextMenu:h,title:n.getHelpText(),draggable:!0,onDragStart:u,onDragEnd:p,children:[ne,te,P.buttons]})};Qe.displayName=`BorderButton`;var $e=e=>{let{controller:t,groupNode:n,path:r}=e,i=d.useRef(null),a=d.useCallback(e=>{i.current=e,t.registerMeasurable(n,`grouppill`,e)},[t,n]),o=e=>{n.isEnableDrag()?(e.stopPropagation(),t.getDragDropManager().setDragNode(e.nativeEvent,n)):e.preventDefault()},s=e=>{t.getDragDropManager().onDragEnded()},c=e=>{t.showContextMenu(n,e)},l=()=>{t.doAction(E.updateNodeAttributes(n.getId(),{opened:!n.isOpened()}))},u=e=>{l(),e.stopPropagation()},p=e=>{if(e.key===`Enter`||e.key===` `)l(),e.preventDefault();else if(e.key===`ContextMenu`||e.shiftKey&&e.key===`F10`){let t=i.current.getBoundingClientRect();i.current.dispatchEvent(new MouseEvent(`contextmenu`,{bubbles:!0,cancelable:!0,clientX:t.x+t.width/2,clientY:t.y+t.height/2})),e.preventDefault()}},m=t.getClassName,h=m(T.FLEXLAYOUT__GROUP_PILL);n.isOpened()?t.getModel().getTabGroupType()===`underline`&&(h+=` `+m(T.FLEXLAYOUT__GROUP_PILL_UNDERLINE)):h+=` `+m(T.FLEXLAYOUT__GROUP_PILL_COLLAPSED);let g=n.getColor(),_={backgroundColor:g,borderColor:g},v=t.i18nName(V.Group_Pill_Tooltip);return(0,f.jsxs)(`div`,{ref:a,"data-layout-path":r,role:`button`,"aria-label":n.getName(),"aria-expanded":n.isOpened(),tabIndex:0,title:v,className:h,style:_,draggable:!0,onDragStart:o,onDragEnd:s,onClick:u,onKeyDown:p,onContextMenu:c,children:[(0,f.jsx)(`span`,{className:m(T.FLEXLAYOUT__GROUP_PILL_NAME),children:n.getName()}),!n.isOpened()&&(0,f.jsx)(`span`,{"aria-hidden":`true`,className:m(T.FLEXLAYOUT__GROUP_PILL_COUNT),children:n.getChildren().length})]})};$e.displayName=`GroupPill`;var et=e=>{let{controller:t,groupNode:n,path:r}=e,i=d.useRef(null),a=d.useCallback(e=>{i.current=e,t.registerMeasurable(n,`groupendmarker`,e)},[t,n]),o=e=>{t.doAction(E.updateNodeAttributes(n.getId(),{opened:!n.isOpened()})),e.stopPropagation()},s=n.getColor(),c={backgroundColor:s,borderColor:s};return(0,f.jsx)(`div`,{ref:a,"data-layout-path":r,title:n.getName(),"aria-hidden":!0,className:t.getClassName(T.FLEXLAYOUT__GROUP_END_MARKER),style:c,onClick:o})};et.displayName=`GroupEndMarker`;var tt=e=>{let{controller:t,tabNode:n}=e,r=t.getClassName,i=r(T.FLEXLAYOUT__TAB_BUTTON_STAMP),a=_e(t,n),o=a.content?(0,f.jsx)(`div`,{className:r(T.FLEXLAYOUT__TAB_BUTTON_CONTENT),children:a.content}):n.getNameForOverflowMenu(),s=a.leading?(0,f.jsx)(`div`,{className:r(T.FLEXLAYOUT__TAB_BUTTON_LEADING),children:a.leading}):null;return(0,f.jsxs)(`div`,{className:i,title:n.getHelpText(),children:[s,o]})};tt.displayName=`TabButtonStamp`;var nt=500;function rt(e){return typeof e.getBoundingClientRect==`function`}function it(e){return e.container?e.container:rt(e.anchor)?e.anchor.ownerDocument.body:document.body}function at(e){if(rt(e))return e.getBoundingClientRect();if(`right`in e&&`bottom`in e)return e;let t=e;return new DOMRect(t.x,t.y,0,0)}function ot(e,t){let n=t,{left:r,right:i,top:a,bottom:o}=e,s={};return(r+i)/2<n.left+n.width/2?s.left=r-n.left:s.right=n.right-i,(a+o)/2<n.top+n.height/2?s.top=a-n.top:s.bottom=n.bottom-o,s}var st=e=>{let{anchor:t,items:n,onSelect:r,onClose:i,renderItem:a,title:o}=e,s=e.classNameMapper??(e=>e),c=it(e),l=d.useRef(null),u=d.useRef(null),m=d.useRef({buffer:``,timer:void 0});d.useEffect(()=>()=>{m.current.timer&&clearTimeout(m.current.timer)},[]);let h=d.useCallback(e=>{e.disabled||((e.onSelect??r)?.(e),i())},[r,i]);d.useEffect(()=>{let n=c.ownerDocument;u.current?.contains(n.activeElement)||(u.current?.querySelector(`[role="menuitem"]:not([aria-disabled="true"])`)??u.current)?.focus();let r=e.returnFocusTo??(rt(t)?t:void 0);return()=>{r?.focus?.()}},[]),d.useEffect(()=>{let e=c.ownerDocument,t=e=>{l.current?.contains(e.target)||i()};return e.addEventListener(`pointerdown`,t),()=>e.removeEventListener(`pointerdown`,t)},[c,i]);let g=e=>{let t=Array.from(u.current?.querySelectorAll(`[role="menuitem"]:not([aria-disabled="true"])`)??[]),n=e.target.closest?.(`[role="menuitem"]`),r=n?t.indexOf(n):-1;if(e.key===`Escape`||e.key===`Tab`)i(),e.preventDefault();else if(e.key===`ArrowDown`||e.key===`ArrowUp`)t.length>0&&t[(r+(e.key===`ArrowDown`?1:-1)+t.length)%t.length]?.focus(),e.preventDefault();else if(e.key===`Home`||e.key===`End`)(e.key===`Home`?t[0]:t[t.length-1])?.focus(),e.preventDefault();else if(e.key.length===1&&e.key!==` `&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let n=m.current;n.timer&&clearTimeout(n.timer),n.buffer+=e.key.toLowerCase(),n.timer=setTimeout(()=>{n.buffer=``},nt);let i=[...n.buffer].every(e=>e===n.buffer[0]),a=i?n.buffer[0]:n.buffer,o=i?r+1:Math.max(r,0);for(let e=0;e<t.length;e++){let n=(o+e)%t.length;if((t[n].textContent??``).trim().toLowerCase().startsWith(a)){t[n].focus();break}}e.preventDefault()}else(e.key===`Enter`||e.key===` `)&&n&&(n.click(),e.preventDefault())},_=e=>({select:()=>h(e),close:i}),v=e=>(0,f.jsx)(`div`,{className:s(T.FLEXLAYOUT__POPUP_MENU_ITEM)+(e.disabled?` `+s(T.FLEXLAYOUT__POPUP_MENU_ITEM__DISABLED):``),role:`menuitem`,tabIndex:-1,"aria-disabled":e.disabled||void 0,onClick:t=>{h(e),t.stopPropagation()},children:e.content??(0,f.jsxs)(f.Fragment,{children:[e.icon,e.label]})},e.key),y=(0,f.jsx)(`div`,{ref:l,className:s(T.FLEXLAYOUT__POPUP_MENU_CONTAINER),style:ot(at(t),c.getBoundingClientRect()),children:(0,f.jsx)(`div`,{ref:u,className:s(T.FLEXLAYOUT__POPUP_MENU),role:`menu`,"aria-label":o,tabIndex:0,onKeyDown:g,"data-layout-path":`/popup-menu`,children:n.map((e,t)=>e.type===`divider`?(0,f.jsx)(`div`,{className:s(T.FLEXLAYOUT__POPUP_MENU_DIVIDER),role:`separator`},e.key):a?a(e,t,_(e)):v(e))})});return(0,p.createPortal)(y,c)};function ct(e){let t=it(e),n=rt(e.anchor)?e.anchor.getBoundingClientRect():e.anchor,r=t.ownerDocument.createElement(`div`);t.appendChild(r);let i=(0,m.createRoot)(r),a=!1,o=()=>{a||(a=!0,i.unmount(),r.remove(),e.onClose())};return i.render((0,f.jsx)(st,{...e,anchor:n,container:t,onClose:o})),o}function lt(e,t,n,r,i,a){let o=i.getClassName,s=n.map(e=>({key:e.node.getId()}));return i.showOverlayOnAllWindows(!0),ct({anchor:e,container:i.getRootDiv()??void 0,classNameMapper:o,returnFocusTo:e,title:i.i18nName(V.Overflow_Menu_Tooltip),items:s,onSelect:e=>{let t=s.indexOf(e);t>=0&&r(n[t])},renderItem:(e,r,a)=>{let s=n[r],c=s.node.getParent()instanceof R?s.node.getParent():void 0,l=c!==void 0,u=o(T.FLEXLAYOUT__POPUP_MENU_ITEM);l&&(u+=` `+o(T.FLEXLAYOUT__POPUP_MENU_ITEM_GROUPED)),t.getSelected()===s.index&&(u+=` `+o(T.FLEXLAYOUT__POPUP_MENU_ITEM__SELECTED));let d={};return l&&(d[`--flexlayout-group-color`]=c.getColor()),(0,f.jsx)(`div`,{className:u,role:`menuitem`,"aria-label":s.node.getNameForOverflowMenu(),tabIndex:-1,"data-layout-path":`/popup-menu/tb`+r,style:d,onClick:e=>{a.select(),e.stopPropagation()},draggable:!0,onDragStart:e=>{e.stopPropagation(),i.getDragDropManager().setDragNode(e.nativeEvent,s.node)},onDragEnd:()=>{i.getDragDropManager().onDragEnded(),a.close()},title:s.node.getHelpText(),children:(0,f.jsx)(tt,{tabNode:s.node,controller:i})},e.key)},onClose:()=>{i.showOverlayOnAllWindows(!1),a?.()}})}st.displayName=`PopupMenu`;var ut=(e,t,n,r,i,a,o,s)=>{let[c,l]=d.useState([]),[u,f]=d.useState(!1),[p,m]=d.useState(!1),h=d.useRef(!1),g=d.useRef(void 0),_=d.useRef([]),v=d.useRef(0),y=d.useRef(!1),b=d.useRef(0);d.useEffect(()=>()=>{g.current!==void 0&&clearTimeout(g.current)},[]),d.useLayoutEffect(()=>{_.current=c});let x=d.useCallback(e=>{n===S.HORZ?r.current.scrollLeft=e:r.current.scrollTop=e},[n,r]),C=d.useCallback(e=>n===S.HORZ?e.scrollLeft:e.scrollTop,[n]),w=d.useCallback(e=>n===S.HORZ?e.clientWidth:e.clientHeight,[n]),T=d.useCallback(e=>n===S.HORZ?e.scrollWidth:e.scrollHeight,[n]),E=d.useCallback(e=>n===S.HORZ?e.width:e.height,[n]),D=d.useCallback(e=>n===S.HORZ?e.x:e.y,[n]),O=d.useCallback(e=>n===S.HORZ?e.right:e.bottom,[n]),k=d.useCallback(()=>{let e=[];if(r.current){let t=r.current,n=t.getBoundingClientRect(),i=D(n)-1,a=O(n)+1,s=t.firstElementChild,c=0;Array.from(s.children).forEach(t=>{let n=t.getBoundingClientRect();t.classList.contains(o)&&((D(n)<i||O(n)>a)&&e.push(c),c++)})}return e},[o,r,D,O]),A=d.useCallback(()=>{if(r.current&&i.current){let e=r.current,t=i.current,a=w(e),o=T(e),s=C(e);if(o>a&&o>0){let e=a*a/o,r=0;e<20&&(r=20-e,e=20);let i=s*(a-r)/o;n===S.HORZ?(t.style.width=e+`px`,t.style.left=i+`px`):(t.style.height=e+`px`,t.style.top=i+`px`),t.style.display=`block`}else t.style.display=`none`;n===S.HORZ?t.style.bottom=`0px`:t.style.right=`0px`}},[n,r,i,w,T,C]),j=d.useCallback((e=!1)=>{let t=k(),n=t.length>0;n!==u&&f(n),e?l(t):g.current===void 0&&(g.current=setTimeout(()=>{let e=k();dt(e,_.current)||l(e),g.current=void 0},100))},[k,u]),M=d.useCallback(()=>{let n=t.getSelectedNode();if(n&&r.current){let t=e.getBoundingClientRect(r.current),i=r.current.ownerDocument.getElementById(ve(`flexlayout-tabbutton-`,n.getId()));if(!i)return;let a=e.getBoundingClientRect(i),o=D(t)-D(a);o>0||E(a)>E(t)?(x(C(r.current)-o),y.current=!0):(o=O(a)-O(t),o>0&&(x(C(r.current)+o),y.current=!0))}},[t,e,r,D,O,E,C,x]),N=d.useCallback(()=>{if(r.current){let e=r.current,t=0;for(let n of Array.from(e.children))t+=w(n);if(s?.current){let e=w(s.current);e>0&&(b.current=e)}let n=b.current,i=t+(p?n:0)>w(r.current);i!==p&&m(i)}},[r,s,p,w]),ee=d.useCallback(()=>{y.current||(h.current=!0),y.current=!1,A(),j()},[A,j]),P=d.useCallback((e,t)=>{if(r.current&&i.current){let a=r.current,o=i.current,s=w(a),c=T(a),l=w(o),u=a.getBoundingClientRect(),d;if(d=n===S.HORZ?e-u.x-v.current:t-u.y-v.current,d=Math.max(0,Math.min(c-l,d)),s>0){let e=d*c/s;x(e)}}},[r,i,n,w,T,x]),te=d.useCallback(()=>{},[]),ne=d.useCallback(()=>{},[]),re=d.useCallback(e=>{e.stopPropagation(),i.current.setPointerCapture(e.pointerId);let t=i.current.getBoundingClientRect();n===S.HORZ?v.current=e.clientX-t.x:v.current=e.clientY-t.y,ke(e.currentTarget.ownerDocument,e,P,te,ne)},[i,n,P,te,ne]),ie=d.useCallback(e=>{if(!r.current||t.getChildren().length===0)return;let i=Math.abs(e.deltaX),a=Math.abs(e.deltaY);if(i===0&&a===0)return;let o;o=n===S.HORZ?i>a?e.deltaX:e.deltaY:a>i?e.deltaY:e.deltaX,e.deltaMode===1&&(o*=40);let s=T(r.current)-w(r.current);if(s<=0)return;let c=C(r.current)+o;x(Math.max(0,Math.min(s,c))),e.stopPropagation()},[t,r,n,C,T,w,x]),ae=d.useCallback(e=>{let t=r.current;t&&(T(t)-w(t)<=0||e.preventDefault())},[r,T,w]),oe=t.getId(),se=t.getSelectedNode();return d.useLayoutEffect(()=>{r.current&&x(0)},[oe,r,x]),d.useLayoutEffect(()=>{h.current=!1},[se]),d.useLayoutEffect(()=>{N(),h.current===!1&&M(),A(),j(!0);let e=requestAnimationFrame(()=>{j()});return()=>cancelAnimationFrame(e)},[N,M,A,j,n,se]),d.useLayoutEffect(()=>{let t=r.current;if(!t)return;let n=t.ownerDocument.defaultView,i=new n.ResizeObserver(()=>{N();let t=e.isSplitterDragging();(!h.current||t)&&(t&&(h.current=!1),M()),A(),j()});i.observe(t);let a=t.firstElementChild,o=new n.MutationObserver(()=>{j()});return a&&o.observe(a,{childList:!0,subtree:!0}),()=>{i.disconnect(),o.disconnect()}},[N,M,A,j,r,e]),d.useLayoutEffect(()=>{let e=s?.current;if(!e)return;let t=new e.ownerDocument.defaultView.ResizeObserver(()=>{N()});return t.observe(e),()=>t.disconnect()},[N,s,p]),d.useEffect(()=>{if(t instanceof F&&t.isEnableTabWrap())return;let e=a.current;return e?.addEventListener(`wheel`,ae,{passive:!1}),()=>{e?.removeEventListener(`wheel`,ae)}}),{userControlledPositionRef:h,onScroll:ee,onScrollPointerDown:re,hiddenTabs:c,onMouseWheel:ie,isDockStickyButtons:p,isShowHiddenTabs:u}};function dt(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}var ft=e=>{let{borderNode:t,controller:n,size:r}=e,i=d.useRef(null),a=d.useRef(null),o=d.useRef(null),s=d.useRef(null),c=d.useRef(null),l=d.useRef(null),[u,p]=d.useState(!1),m=d.useRef(null),h=n.getIcons();d.useEffect(()=>()=>m.current?.(),[]);let{userControlledPositionRef:g,onScroll:_,onScrollPointerDown:v,hiddenTabs:y,onMouseWheel:b,isDockStickyButtons:x,isShowHiddenTabs:w}=ut(n,t,S.flip(t.getOrientation()),l,o,i,n.getClassName(T.FLEXLAYOUT__BORDER_BUTTON),c),D=d.useCallback(e=>{i.current=e,n.registerMeasurable(t,`borderheader`,e)},[n,t]),O=e=>{Te(e)&&n.auxMouseClick(t,e)},k=e=>{n.showContextMenu(t,e)},A=e=>{e.stopPropagation()},j=e=>{let r=n.getShowOverflowMenu(),i=t.getTabNodes(),a=y.map(e=>({index:e,node:i[e]}));if(r!==void 0)r(t,e,a,M);else{let e=s.current;p(!0),m.current=lt(e,t,a,M,n,()=>{p(!1),m.current=null})}e.stopPropagation()},M=e=>{n.doAction(E.selectTab(e.node.getId())),g.current=!1},N=e=>{let r=t.getSelectedNode();r!==void 0&&n.doAction(E.popoutTab(r.getId(),`window`)),e.stopPropagation()},ee=e=>{let r=t.getSelectedNode();r!==void 0&&n.doAction(E.popoutTab(r.getId(),`float`)),e.stopPropagation()},P=n.getClassName,te=()=>{let e=[],r=n.getModel().getTabGroupType()===`splitpill`,i=0,a=!1,o=0,s=()=>(0,f.jsx)(`div`,{className:P(T.FLEXLAYOUT__BORDER_TAB_DIVIDER)},`divider`+o++),c=t.getLocation()===C.LEFT&&n.getModel().getBorderLeftTabDirection()!==`down`;for(let o of t.getChildren()){if(o instanceof R){let l=o.getChildren();if(c&&o.isOpened()){a&&e.push(s()),r&&e.push((0,f.jsx)(et,{controller:n,groupNode:o,path:o.getPath()+`/end`},o.getId()+`/end`));let c=i;for(let r=l.length-1;r>=0;r--){let i=t.getSelected()===c+r;r<l.length-1&&e.push(s()),e.push((0,f.jsx)(Qe,{controller:n,border:t.getLocation().getName(),tabNode:l[r],path:ye(l[r]),selected:i,icons:h},l[r].getId()))}i+=l.length,e.push((0,f.jsx)($e,{controller:n,groupNode:o,path:o.getPath()},o.getId())),a=!0}else if(a&&e.push(s()),e.push((0,f.jsx)($e,{controller:n,groupNode:o,path:o.getPath()},o.getId())),a=!0,o.isOpened()){for(let r=0;r<l.length;r++){let a=t.getSelected()===i;r>0&&e.push(s()),e.push((0,f.jsx)(Qe,{controller:n,border:t.getLocation().getName(),tabNode:l[r],path:ye(l[r]),selected:a,icons:h},l[r].getId())),i++}r&&e.push((0,f.jsx)(et,{controller:n,groupNode:o,path:o.getPath()+`/end`},o.getId()+`/end`))}continue}let l=o,u=t.getSelected()===i;a&&e.push(s()),e.push((0,f.jsx)(Qe,{controller:n,border:t.getLocation().getName(),tabNode:l,path:ye(l),selected:u,icons:h},l.getId())),a=!0,i++}return e},ne=()=>{let e,r=[],i=[],o,l={leading:e,buttons:r,stickyButtons:i,overflowPosition:void 0};if(n.customizeTabSet(t,l),e=l.leading,i=l.stickyButtons,r=l.buttons,l.overflowPosition===void 0&&(l.overflowPosition=i.length),i.length>0&&(x?r=[...i,...r]:o=(0,f.jsx)(`div`,{ref:c,onPointerDown:A,onDragStart:e=>{e.preventDefault()},className:P(T.FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER),children:i},`sticky_buttons_container`)),w){let e=n.i18nName(V.Overflow_Menu_Tooltip),i;if(typeof h.more==`function`){let e=t.getTabNodes(),n=y.map(t=>({index:t,node:e[t]}));i=h.more(t,n)}else i=(0,f.jsxs)(f.Fragment,{children:[h.more,(0,f.jsx)(`div`,{className:P(T.FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT),children:y.length>0?y.length:``})]});r.splice(Math.min(l.overflowPosition,r.length),0,(0,f.jsx)(`button`,{tabIndex:0,"aria-haspopup":`menu`,"aria-expanded":u,"aria-label":e,ref:s,className:P(T.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON)+` `+P(T.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW)+` `+P(T.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW_+t.getLocation().getName()),title:e,onClick:j,onPointerDown:A,children:i},`overflowbutton`))}if(t.getSelected()!==-1){let e=t.getSelectedNode();if(e!==void 0&&n.isMainLayout()){if(e.isEnableFloat()&&e.isEnableFloatIcon()){let t=n.i18nName(V.Popout_Tab_Float);r.push((0,f.jsx)(`button`,{tabIndex:0,title:t,"aria-label":t,className:P(T.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON)+` `+P(T.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_FLOAT),onClick:ee,onPointerDown:A,children:typeof h.popoutFloat==`function`?h.popoutFloat(e):h.popoutFloat},`popout-float`))}if(n.isSupportsPopout()&&e.isEnablePopoutIcon()&&e.isAllowedInWindow()){let t=n.i18nName(V.Popout_Tab);r.push((0,f.jsx)(`button`,{tabIndex:0,title:t,"aria-label":t,className:P(T.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON)+` `+P(T.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_FLOAT),onClick:N,onPointerDown:A,children:typeof h.popout==`function`?h.popout(e):h.popout},`popout`))}}}let d=(0,f.jsx)(`div`,{ref:a,className:P(T.FLEXLAYOUT__BORDER_TOOLBAR)+` `+P(T.FLEXLAYOUT__BORDER_TOOLBAR_+t.getLocation().getName()),children:r},`toolbar`);return{leading:e,toolbar:d,stickyBar:o}},re=te(),{leading:ie,toolbar:ae,stickyBar:oe}=ne(),se=P(T.FLEXLAYOUT__BORDER)+` `+P(T.FLEXLAYOUT__BORDER_+t.getLocation().getName());t.getClassName()!==void 0&&(se+=` `+t.getClassName());let ce,le,F=r-1;t.getLocation()===C.LEFT?(ce=n.getModel().getBorderLeftTabDirection()===`down`?{left:`100%`,top:0}:{right:`100%`,top:0},le={width:F,overflowY:`auto`}):t.getLocation()===C.RIGHT?(ce={left:`100%`,top:0},le={width:F,overflowY:`auto`}):(ce={left:0},le={height:F,overflowX:`auto`});let I;t.isEnableTabScrollbar()&&(I=(0,f.jsx)(`div`,{ref:o,"aria-hidden":`true`,className:P(T.FLEXLAYOUT__MINI_SCROLLBAR),onPointerDown:v}));let ue;ie&&(ue=(0,f.jsx)(`div`,{className:P(T.FLEXLAYOUT__BORDER_LEADING),children:ie}));let de=P(T.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER)+` `+P(T.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER_+t.getLocation().getName())+(t.getLocation()===C.LEFT&&n.getModel().getBorderLeftTabDirection()===`down`?` `+P(T.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER_LEFT_DOWN):``);return(0,f.jsxs)(`div`,{ref:D,style:{display:`flex`,flexDirection:t.getOrientation()===S.VERT?`row`:`column`},className:se,"data-layout-path":t.getPath(),onClick:O,onAuxClick:O,onContextMenu:k,onWheel:b,children:[ue,(0,f.jsxs)(`div`,{className:P(T.FLEXLAYOUT__MINI_SCROLLBAR_CONTAINER),children:[(0,f.jsxs)(`div`,{ref:l,className:P(T.FLEXLAYOUT__BORDER_INNER)+` `+P(T.FLEXLAYOUT__BORDER_INNER_+t.getLocation().getName()),style:le,onScroll:_,children:[(0,f.jsx)(`div`,{style:ce,role:n.getEditingTab()?.getParent()===t?void 0:`tablist`,"aria-orientation":n.getEditingTab()?.getParent()!==t&&(t.getLocation()===C.LEFT||t.getLocation()===C.RIGHT)?`vertical`:void 0,className:de,children:re}),oe]}),I]}),ae]})};ft.displayName=`BorderTabSet`;var pt=e=>{let{controller:t,node:n,index:r,horizontal:i}=e,a=d.useRef(null),o=d.useRef([]),s=d.useRef(void 0),c=d.useRef(void 0),l=d.useRef(0),u=d.useRef(0),p=d.useRef({initialSizes:[],sum:0,startPosition:0}),m=d.useRef(void 0),h=d.useCallback(e=>{e.preventDefault(),e.stopImmediatePropagation()},[]);d.useEffect(()=>{let e=a.current;return e?.addEventListener(`touchstart`,h,{passive:!1}),()=>{e?.removeEventListener(`touchstart`,h),m.current!==void 0&&(clearTimeout(m.current),m.current=void 0),s.current&&(t.getRootDiv()?.removeChild(s.current),s.current=void 0,Ee(!0,t.getCurrentDocument()),t.setSplitterDragging(!1))}},[h,t]);let g=e=>{e.stopPropagation(),n instanceof I&&(p.current=n.getSplitterInitials(r)),t.setSplitterDragging(!0),Ee(!1,t.getCurrentDocument()),ke(e.currentTarget.ownerDocument,e,y,b,v),o.current=n instanceof z?n.getSplitterBounds(!0):n.getSplitterBounds(r);let d=t.getRootDiv();s.current=t.getCurrentDocument().createElement(`div`),s.current.style.flexDirection=i?`row`:`column`,s.current.className=t.getClassName(T.FLEXLAYOUT__SPLITTER_DRAG)+(n instanceof z?` `+t.getClassName(T.FLEXLAYOUT__SPLITTER_BORDER):``),s.current.style.cursor=n.getOrientation()===S.VERT?`ns-resize`:`ew-resize`,c.current=t.getCurrentDocument().createElement(`div`),c.current.className=O(T.FLEXLAYOUT__SPLITTER_HANDLE)+` `+O(i?T.FLEXLAYOUT__SPLITTER_HANDLE_HORZ:T.FLEXLAYOUT__SPLITTER_HANDLE_VERT),s.current.appendChild(c.current);let f=a.current.getBoundingClientRect(),m=new x(f.x-t.getDomRect().x,f.y-t.getDomRect().y,f.width,f.height);l.current=e.clientX-f.x,u.current=e.clientY-f.y,m.positionElement(s.current),d&&d.appendChild(s.current)},_=e=>{if(xe(e))return;let a=0;if(i?(e.key===`ArrowLeft`&&(a=-10),e.key===`ArrowRight`&&(a=10)):(e.key===`ArrowUp`&&(a=-10),e.key===`ArrowDown`&&(a=10)),a!==0){if(e.preventDefault(),t.setSplitterDragging(!0),n instanceof z){let e=n.getLocation(),r=e===C.BOTTOM||e===C.RIGHT?-a:a,i=Math.max(n.getMinSize(),Math.min(n.getMaxSize(),n.getSize()+r));t.doAction(E.adjustBorderSplit(n.getId(),i))}else{let e=n.getSplitterInitials(r);if(e.sum<=0){t.setSplitterDragging(!1);return}let i=n.getSplitterBounds(r),o=Math.max(i[0],Math.min(i[1],e.startPosition+a)),s=n.calculateSplit(r,o,e.initialSizes,e.sum,e.startPosition);t.doAction(E.adjustWeights(n.getId(),s))}setTimeout(()=>t.setSplitterDragging(!1),300)}},v=()=>{if(s.current){t.isRealtimeResize()&&w(!1);let e=t.getRootDiv();e&&s.current&&e.removeChild(s.current),s.current=void 0}m.current=window.setTimeout(()=>t.setSplitterDragging(!1),300),Ee(!0,t.getCurrentDocument())},y=(e,r)=>{if(s.current){let i=t.getDomRect();if(!i)return;n.getOrientation()===S.VERT?s.current.style.top=D(r-i.y-u.current)+`px`:s.current.style.left=D(e-i.x-l.current)+`px`,t.isRealtimeResize()&&w(!0)}},b=()=>{if(s.current){w(!1);let e=t.getRootDiv();e&&s.current&&e.removeChild(s.current),s.current=void 0}m.current=window.setTimeout(()=>t.setSplitterDragging(!1),300),Ee(!0,t.getCurrentDocument())},w=e=>{(()=>{if(s.current){let i;if(i=n.getOrientation()===S.VERT?s.current.offsetTop:s.current.offsetLeft,n instanceof z){let r=n.calculateSplit(n,i);t.doAction(E.adjustBorderSplit(n.getId(),r).setAdjusting(e))}else{let a=p.current;if(a.sum<=0)return;let o=n.calculateSplit(r,i,a.initialSizes,a.sum,a.startPosition);t.doAction(E.adjustWeights(n.getId(),o).setAdjusting(e))}}})()},D=e=>{let t=o.current,n=e;return e<t[0]&&(n=t[0]),e>t[1]&&(n=t[1]),n},O=t.getClassName,k={cursor:i?`ew-resize`:`ns-resize`,flexDirection:i?`column`:`row`},A=O(T.FLEXLAYOUT__SPLITTER)+` `+O(T.FLEXLAYOUT__SPLITTER_+n.getOrientation().getName());n instanceof z?A+=` `+O(T.FLEXLAYOUT__SPLITTER_BORDER):n.getModel().getMaximizedTabset(t.getLayoutId())!==void 0&&(k.display=`none`),ge()||(k[`--fl-splitter-active-size`]=`30px`);let j,M,N,ee;if(n instanceof I){let e=n.getRect(),t=n.getChildren()[r-1],a=i?e.width:e.height;if(t&&a>0){let n=t.getRect();j=Math.round((i?n.getRight()-e.x:n.getBottom()-e.y)/a*100),M=0,N=100,ee=j+`%`}}else j=Math.round(n.getSize()),M=Math.round(n.getMinSize()),N=Math.round(n.getMaxSize()),ee=j+`px`;return(0,f.jsx)(`div`,{className:A,style:k,ref:a,role:`separator`,"aria-label":t.i18nName(V.Splitter),"aria-orientation":i?`vertical`:`horizontal`,"aria-valuenow":j,"aria-valuemin":M,"aria-valuemax":N,"aria-valuetext":ee,tabIndex:0,onKeyDown:_,"data-layout-path":n.getPath()+`/s`+(r-1),onPointerDown:g,children:(0,f.jsx)(`div`,{className:O(T.FLEXLAYOUT__SPLITTER_HANDLE)+` `+O(i?T.FLEXLAYOUT__SPLITTER_HANDLE_HORZ:T.FLEXLAYOUT__SPLITTER_HANDLE_VERT)})})};pt.displayName=`Splitter`;function mt(e){let{controller:t,borderNode:n,show:r}=e,i=d.useRef(null),a=d.useCallback(e=>{i.current=e,t.registerMeasurable(n,`bordercontent`,e)},[t,n]),o=!0,s={};n.getOrientation()===S.HORZ?(s.width=n.getSize(),s.minWidth=n.getMinSize(),s.maxWidth=n.getMaxSize()):(s.height=n.getSize(),s.minHeight=n.getMinSize(),s.maxHeight=n.getMaxSize(),o=!1);let c=t.getClassName(T.FLEXLAYOUT__BORDER_TAB_CONTENTS),l=n.getLocation()===C.LEFT||n.getLocation()===C.TOP;if(n.isOverlay()){s.display=`flex`;let e={display:r?`flex`:`none`};if(o){let r=t.getModel();for(let t of r.getBorderSet().getBorders())if(t!==n&&t.isOverlay()&&t.isShowing()&&t.getSelected()!==-1){let n=t.getSize()+r.getSplitterSize();t.getLocation()===C.TOP?e.top=n:t.getLocation()===C.BOTTOM&&(e.bottom=n)}}let i=t.getClassName(T.FLEXLAYOUT__BORDER_TAB_OVERLAY)+` `+t.getClassName(T.FLEXLAYOUT__BORDER_TAB_OVERLAY_+n.getLocation().getName());return(0,f.jsxs)(`div`,{className:i,style:e,children:[l&&(0,f.jsx)(`div`,{ref:a,style:s,className:c}),r&&(0,f.jsx)(pt,{controller:t,node:n,index:0,horizontal:o}),!l&&(0,f.jsx)(`div`,{ref:a,style:s,className:c})]})}return s.display=r?`flex`:`none`,l?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`div`,{ref:a,style:s,className:c}),r&&(0,f.jsx)(pt,{controller:t,node:n,index:0,horizontal:o})]}):(0,f.jsxs)(f.Fragment,{children:[r&&(0,f.jsx)(pt,{controller:t,node:n,index:0,horizontal:o}),(0,f.jsx)(`div`,{ref:a,style:s,className:c})]})}mt.displayName=`BorderTab`;var ht=({controller:e,inner:t})=>{let n=e.getClassName(T.FLEXLAYOUT__LAYOUT_MAIN),r=e.getModel().getBorderSet().getBorderMap();if(e.isMainLayout()&&r.size>0){let i=(0,f.jsx)(`div`,{className:n,ref:e.getMainRef(),children:t}),a=new Map,o=new Map;for(let[t,n]of C.values){let t=r.get(n);t&&t.isShowing()&&(!t.isAutoHide()||t.isAutoHide()&&(t.getChildren().length>0||e.getState().showHiddenBorder===n))&&(a.set(n,(0,f.jsx)(ft,{controller:e,borderNode:t,size:e.getState().calculatedBorderBarSize})),o.set(n,(0,f.jsx)(mt,{controller:e,borderNode:t,show:t.getSelected()!==-1})))}let s=e.getClassName(T.FLEXLAYOUT__LAYOUT_BORDER_CONTAINER),c=e.getClassName(T.FLEXLAYOUT__LAYOUT_BORDER_CONTAINER_INNER),l=(0,f.jsxs)(`div`,{className:c,style:{flexDirection:`column`},children:[o.get(C.TOP),(0,f.jsxs)(`div`,{className:c,style:{flexDirection:`row`},children:[o.get(C.LEFT),i,o.get(C.RIGHT)]}),o.get(C.BOTTOM)]});return(0,f.jsxs)(`div`,{className:s,style:{flexDirection:`column`},children:[a.get(C.TOP),(0,f.jsxs)(`div`,{className:c,style:{flexDirection:`row`},children:[a.get(C.LEFT),l,a.get(C.RIGHT)]}),a.get(C.BOTTOM)]})}return(0,f.jsx)(`div`,{className:n,ref:e.getMainRef(),style:{position:`absolute`,top:0,left:0,bottom:0,right:0,display:`flex`},children:t})};ht.displayName=`BorderContainer`;var gt={width:`1em`,height:`1em`,display:`flex`,alignItems:`center`},_t=()=>(0,f.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:gt,viewBox:`0 0 24 24`,children:[(0,f.jsx)(`path`,{fill:`none`,d:`M0 0h24v24H0z`}),(0,f.jsx)(`path`,{stroke:`var(--fl-color-icon)`,fill:`var(--fl-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`})]});_t.displayName=`CloseIcon`;var vt=()=>(0,f.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:gt,viewBox:`0 0 24 24`,fill:`var(--fl-color-icon)`,children:[(0,f.jsx)(`path`,{fill:`none`,d:`M0 0h24v24H0z`}),(0,f.jsx)(`path`,{transform:`rotate(45 12 12)`,d:`M16 9V4h1a1 1 0 000-2H7a1 1 0 000 2h1v5c0 1.66-1.34 3-3 3v2h5.97v7l1 1 1-1v-7H19v-2c-1.66 0-3-1.34-3-3z`})]});vt.displayName=`PinIcon`;var yt=()=>(0,f.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:gt,viewBox:`0 0 24 24`,fill:`var(--fl-color-icon)`,children:[(0,f.jsx)(`path`,{d:`M0 0h24v24H0z`,fill:`none`}),(0,f.jsx)(`path`,{stroke:`var(--fl-color-icon)`,d:`M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z`})]});yt.displayName=`MaximizeIcon`;var bt=()=>(0,f.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:gt,viewBox:`0 0 24 24`,fill:`var(--fl-color-icon)`,children:[(0,f.jsx)(`path`,{d:`M0 0h24v24H0z`,fill:`none`}),(0,f.jsx)(`path`,{stroke:`var(--fl-color-icon)`,d:`M7 10l5 5 5-5z`})]});bt.displayName=`OverflowIcon`;var xt=()=>(0,f.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:{display:`block`,width:10,height:10},preserveAspectRatio:`none`,viewBox:`0 0 100 100`,children:(0,f.jsx)(`path`,{fill:`var(--fl-color-edge-icon)`,stroke:`var(--fl-color-edge-icon)`,d:`M10 30 L90 30 l-40 40 Z`})});xt.displayName=`EdgeIcon`;var St=()=>(0,f.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:gt,viewBox:`0 0 20 20`,fill:`var(--fl-color-icon)`,children:[(0,f.jsx)(`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`}),(0,f.jsx)(`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`})]});St.displayName=`PopoutIcon`;var Ct=()=>(0,f.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 -960 960 960`,style:gt,fill:`var(--fl-color-icon)`,children:(0,f.jsx)(`path`,{d:`M360-280q-33 0-56.5-23.5T280-360v-400q0-33 23.5-56.5T360-840h400q33 0 56.5 23.5T840-760v400q0 33-23.5 56.5T760-280H360Zm0-80h400v-400H360v400ZM200-200v80q-33 0-56.5-23.5T120-200h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 480v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z`})});Ct.displayName=`PopoutFloatIcon`;var wt=()=>(0,f.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,style:gt,fill:`var(--fl-color-icon)`,children:(0,f.jsx)(`path`,{d:`M4 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm0 6a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm0 6a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm6-12a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm0 6a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm0 6a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm6-12a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm0 6a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm0 6a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z`})});wt.displayName=`GripIcon`;var Tt=()=>(0,f.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:gt,viewBox:`0 0 24 24`,fill:`var(--fl-color-icon)`,children:[(0,f.jsx)(`path`,{d:`M0 0h24v24H0z`,fill:`none`}),(0,f.jsx)(`path`,{stroke:`var(--fl-color-icon)`,d:`M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z`})]});Tt.displayName=`RestoreIcon`;var Et=()=>(0,f.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:gt,height:`24px`,viewBox:`0 -960 960 960`,width:`24px`,children:(0,f.jsx)(`path`,{fill:`var(--fl-color-icon)`,stroke:`var(--fl-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`})});Et.displayName=`AsterickIcon`;var Dt=e=>{let{controller:t,tabNode:n,selected:r,path:i}=e,a=d.useRef(null),o=d.useRef(null),s=t.getIcons(),c=t.getKeyMap(),l=t.getEditingTab()===n,u=d.useCallback(e=>{a.current=e,t.registerMeasurable(n,`tabbutton`,e)},[t,n]);d.useLayoutEffect(()=>{l&&o.current.select()},[l]),d.useEffect(()=>{if(l){let e=t.getCurrentDocument().body,n=e=>{e.target!==o.current&&t.setEditingTab(void 0)};return e.addEventListener(`pointerdown`,n),()=>e.removeEventListener(`pointerdown`,n)}},[l,t]);let p=e=>{n.isEnableDrag()?(e.stopPropagation(),t.getDragDropManager().setDragNode(e.nativeEvent,n)):e.preventDefault()},m=e=>{t.getDragDropManager().onDragEnded()},h=e=>{Te(e)&&t.auxMouseClick(n,e)},g=e=>{t.showContextMenu(n,e)},_=()=>{n.isSelected()||t.doAction(E.selectTab(n.getId()))},v=e=>{let t=a.current?.closest(`[role="tablist"]`);if(t){let n=Array.from(t.querySelectorAll(`[role="tab"]`));n[n.indexOf(a.current)+e]?.focus()}},y=()=>{let e=a.current.ownerDocument,t=()=>we(e.getElementById(ve(`flexlayout-tab-`,n.getId())));r?t():(_(),requestAnimationFrame(t))},b=e=>{l||(be(e,c.focusTabToggle)?(y(),e.preventDefault()):e.key===`Enter`||e.key===` `?(r?y():_(),e.preventDefault()):(e.key===`ArrowLeft`||e.key===`ArrowUp`)&&!xe(e)?(v(-1),e.preventDefault()):(e.key===`ArrowRight`||e.key===`ArrowDown`)&&!xe(e)?(v(1),e.preventDefault()):be(e,c.closeTab)&&n.isCloseable()?(v(1),t.doAction(E.deleteTab(n.getId())),e.preventDefault()):be(e,c.renameTab)&&n.isEnableRename()&&(S(),e.preventDefault()))},x=e=>{n.isEnableRename()&&(S(),e.stopPropagation())},S=()=>{t.setEditingTab(n)},C=()=>{let e=n.getCloseType();return!!(r||e===A.Always||e===A.Visible&&t.getCurrentWindow()?.matchMedia(`(hover: hover) and (pointer: fine)`).matches)},w=e=>{C()&&(t.doAction(E.deleteTab(n.getId())),e.stopPropagation())},D=e=>{e.stopPropagation()},O=e=>{e.stopPropagation()},k=e=>{e.code===`Escape`?(t.setEditingTab(void 0),a.current?.focus()):(e.code===`Enter`||e.code===`NumpadEnter`)&&(t.setEditingTab(void 0),t.doAction(E.renameTab(n.getId(),e.target.value)),a.current?.focus())},j=t.getClassName,M=n.getTabContainer(),N=n.getParent()instanceof R?n.getParent():void 0,ee=M.isEnableSingleTabStretch()&&M.getChildren().length===1&&M.getChildren()[0]===n,P=ee?T.FLEXLAYOUT__TAB_BUTTON_STRETCH:T.FLEXLAYOUT__TAB_BUTTON,te=j(P);te+=` `+j(P+`_`+M.getTabLocation()),ee||(te+=r?` `+j(P+`--selected`):` `+j(P+`--unselected`)),n.isPinned()&&(te+=` `+j(P+`--pinned`)),N!==void 0&&(te+=` `+j(T.FLEXLAYOUT__TAB_BUTTON_GROUPED),n.getModel().getTabGroupType()===`underline`&&(te+=` `+j(T.FLEXLAYOUT__TAB_BUTTON_GROUPED_UNDERLINE))),n.getClassName()!==void 0&&(te+=` `+n.getClassName());let ne=_e(t,n),re=r||M.getSelectedNode()===void 0&&M.getTabNodes()[0]===n,ie=[Ce(c.focusTabToggle),n.isCloseable()?Ce(c.closeTab):void 0,n.isEnableRename()?Ce(c.renameTab):void 0].filter(Boolean).join(` `)||void 0,ae=ne.content?(0,f.jsx)(`div`,{className:j(T.FLEXLAYOUT__TAB_BUTTON_CONTENT),children:ne.content}):null,oe=ne.leading?(0,f.jsx)(`div`,{className:j(T.FLEXLAYOUT__TAB_BUTTON_LEADING),children:ne.leading}):null;if(l&&(ae=(0,f.jsx)(`input`,{ref:o,className:j(T.FLEXLAYOUT__TAB_BUTTON_TEXTBOX),"data-layout-path":i+`/textbox`,type:`text`,"aria-label":t.i18nName(V.Rename_Tab),autoFocus:!0,defaultValue:n.getName(),onKeyDown:k,onPointerDown:O})),n.isPinned()){let e=t.i18nName(V.Pinned_Tab);ne.buttons.push((0,f.jsx)(`div`,{"data-layout-path":i+`/button/pin`,title:e,"aria-hidden":`true`,className:j(T.FLEXLAYOUT__TAB_BUTTON_PIN),children:typeof s.pin==`function`?s.pin(n):s.pin},`pin`))}if(n.isCloseable()&&!ee){let e=t.i18nName(V.Close_Tab);ne.buttons.push((0,f.jsx)(`div`,{"data-layout-path":i+`/button/close`,title:e,"aria-hidden":`true`,className:j(T.FLEXLAYOUT__TAB_BUTTON_TRAILING),onPointerDown:D,onClick:w,children:typeof s.close==`function`?s.close(n):s.close},`close`))}let se={};return N!==void 0&&(se[`--flexlayout-group-color`]=N.getColor()),(0,f.jsxs)(`div`,{ref:u,id:ve(`flexlayout-tabbutton-`,n.getId()),role:l?void 0:`tab`,"aria-selected":l?void 0:r,"aria-controls":l?void 0:ve(`flexlayout-tab-`,n.getId()),"aria-label":l?void 0:n.isPinned()?ne.name+` (`+t.i18nName(V.Pinned_Tab)+`)`:ne.name,"aria-keyshortcuts":l?void 0:ie,tabIndex:l?-1:re?0:-1,onKeyDown:b,"data-layout-path":i,className:te,style:se,onClick:_,onAuxClick:h,onContextMenu:g,title:n.getHelpText(),draggable:!0,onDragStart:p,onDragEnd:m,onDoubleClick:x,children:[oe,ae,ne.buttons]})};Dt.displayName=`TabButton`;var Ot=e=>{let{tabsetNode:t,controller:n}=e,r=d.useRef(null),i=d.useRef(null),a=d.useRef(null),o=d.useRef(null),s=d.useRef(null),c=d.useRef(null),l=d.useRef(null),u=d.useRef(null),[m,h]=d.useState(!1),g=d.useRef(null),_=n.getIcons();d.useEffect(()=>()=>g.current?.(),[]);let{userControlledPositionRef:v,onScroll:y,onScrollPointerDown:b,hiddenTabs:x,onMouseWheel:C,isDockStickyButtons:w,isShowHiddenTabs:D}=ut(n,t,S.HORZ,o,a,i,n.getClassName(T.FLEXLAYOUT__TAB_BUTTON),u),O=d.useCallback(e=>{r.current=e,n.registerMeasurable(t,`tabset`,e)},[n,t]),k=d.useCallback(e=>{i.current=e,n.registerMeasurable(t,`tabstrip`,e)},[n,t]),A=d.useCallback(e=>{s.current=e,n.registerMeasurable(t,`tabsetcontent`,e)},[n,t]),j=e=>{let r=n.getShowOverflowMenu(),i=t.getTabNodes(),a=x.map(e=>({index:e,node:i[e]}));if(r!==void 0)r(t,e,a,M);else{let e=l.current;h(!0),g.current=lt(e,t,a,M,n,()=>{h(!1),g.current=null})}e.stopPropagation()},M=e=>{n.doAction(E.selectTab(e.node.getId())),v.current=!1},N=e=>{n.getEditingTab()?e.preventDefault():t.isEnableDrag()?(e.stopPropagation(),n.getDragDropManager().setDragNode(e.nativeEvent,t)):e.preventDefault()},ee=e=>{n.getDragDropManager().onDragEnded()},P=e=>{!Te(e)&&!t.isActive()&&n.doAction(E.setActiveTabset(t.getId(),n.getLayoutId()))},te=e=>{Te(e)&&n.auxMouseClick(t,e)},ne=e=>{n.showContextMenu(t,e)},re=e=>{e.stopPropagation()},ie=e=>{t.canMaximize()&&n.maximize(t),e.stopPropagation()},ae=e=>{n.doAction(E.deleteTabset(t.getId())),e.stopPropagation()},oe=e=>{n.doAction(E.deleteTab(t.getChildren()[0].getId())),e.stopPropagation()},se=e=>{I!==void 0&&n.doAction(E.popoutTab(I.getId(),`window`)),e.stopPropagation()},ce=e=>{I!==void 0&&n.doAction(E.popoutTab(I.getId(),`float`)),e.stopPropagation()},le=e=>{t.canMaximize()&&n.maximize(t)},F=n.getClassName,I=t.getSelectedNode(),ue=t.getPath(),de=t.getChildren(),fe=t.isEnableSingleTabStretch()&&de.length===1&&de[0]instanceof B,pe=(e,n,r,i)=>{let a=F(T.FLEXLAYOUT__TABSET_TAB_SPACER);return i&&(a+=` `+F(T.FLEXLAYOUT__TABSET_TAB_DIVIDER)),!t.isEnableTabWrap()&&!fe&&(n?a+=` `+F(T.FLEXLAYOUT__TABSET_TAB_DIVIDER_SELECTED_BEFORE):r&&(a+=` `+F(T.FLEXLAYOUT__TABSET_TAB_DIVIDER_SELECTED_AFTER))),(0,f.jsx)(`div`,{className:a,children:(0,f.jsx)(`div`,{className:F(T.FLEXLAYOUT__TABSET_TAB_DIVIDER_INNER)})},`divider`+e)},L=()=>{let e=[],r=n.getModel().getTabGroupType()===`splitpill`,i=0,a=0,o=!1,s=!1,c=!1;if(t.isEnableTabStrip()){for(let l of de){if(l instanceof R){if(e.push(pe(a++,!1,o,c)),e.push((0,f.jsx)($e,{controller:n,groupNode:l,path:l.getPath()},l.getId())),c=!0,s=!1,l.isOpened()){let u=l.getChildren();for(let r=0;r<u.length;r++){let l=u[r],d=t.getSelected()===i;e.push(pe(a++,d,o,r>0)),e.push((0,f.jsx)(Dt,{controller:n,tabNode:l,path:ye(l),selected:d},l.getId())),o=d,s=!0,c=!0,i++}r&&(e.push(pe(a++,!1,o,!1)),e.push((0,f.jsx)(et,{controller:n,groupNode:l,path:l.getPath()+`/end`},l.getId()+`/end`)),o=!1)}continue}let u=l,d=t.getSelected()===i;e.push(pe(a++,d,o,c)),e.push((0,f.jsx)(Dt,{controller:n,tabNode:u,path:ye(u),selected:d},u.getId())),o=d,s=!0,c=!0,i++}if(s){let n=F(T.FLEXLAYOUT__TABSET_TAB_SPACER);!t.isEnableTabWrap()&&!fe&&o&&(n+=` `+F(T.FLEXLAYOUT__TABSET_TAB_DIVIDER_SELECTED_AFTER)),e.push((0,f.jsx)(`div`,{className:n,children:(0,f.jsx)(`div`,{className:F(T.FLEXLAYOUT__TABSET_TAB_DIVIDER_INNER)})},`divider`+a))}}return e},me=()=>{let e,r=[],i=[],a={leading:e,stickyButtons:r,buttons:i,overflowPosition:void 0};n.customizeTabSet(t,a),e=a.leading,r=a.stickyButtons,i=a.buttons;let o=fe,s=o&&t.getChildren()[0].isCloseable()||t.isCloseable();s&&=t.isEnableCloseButton(),a.overflowPosition===void 0&&(a.overflowPosition=r.length);let d;if(r.length>0&&(!t.isEnableTabWrap()&&(w||o)?i=[...r,...i]:d=(0,f.jsx)(`div`,{ref:u,onPointerDown:re,onDragStart:e=>{e.preventDefault()},className:F(T.FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER),children:r},`sticky_buttons_container`)),!t.isEnableTabWrap()&&D){let e=n.i18nName(V.Overflow_Menu_Tooltip),r;if(typeof _.more==`function`){let e=t.getTabNodes(),n=x.map(t=>({index:t,node:e[t]}));r=_.more(t,n)}else r=(0,f.jsxs)(f.Fragment,{children:[_.more,(0,f.jsx)(`div`,{className:F(T.FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT),children:x.length>0?x.length:``})]});i.splice(Math.min(a.overflowPosition,i.length),0,(0,f.jsx)(`button`,{tabIndex:0,"data-layout-path":ue+`/button/overflow`,"aria-haspopup":`menu`,"aria-expanded":m,"aria-label":e,ref:l,className:F(T.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+` `+F(T.FLEXLAYOUT__TAB_BUTTON_OVERFLOW),title:e,onClick:j,onPointerDown:re,children:r},`overflowbutton`))}if(I!==void 0&&!I.isPinned()){if(I.isEnableFloat()&&I.isEnableFloatIcon()){let e=n.i18nName(V.Popout_Tab_Float);i.push((0,f.jsx)(`button`,{tabIndex:0,"data-layout-path":ue+`/button/popout-float`,title:e,"aria-label":e,className:F(T.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+` `+F(T.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_FLOAT),onClick:ce,onPointerDown:re,children:typeof _.popoutFloat==`function`?_.popoutFloat(I):_.popoutFloat},`popout-float`))}if(n.isSupportsPopout()&&I.isAllowedInWindow()&&I.isEnablePopoutIcon()){let e=n.i18nName(V.Popout_Tab);i.push((0,f.jsx)(`button`,{tabIndex:0,"data-layout-path":ue+`/button/popout`,title:e,"aria-label":e,className:F(T.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+` `+F(T.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_FLOAT),onClick:se,onPointerDown:re,children:typeof _.popout==`function`?_.popout(I):_.popout},`popout`))}}if(t.canMaximize()){let e=n.i18nName(V.Restore),r=n.i18nName(V.Maximize);i.push((0,f.jsx)(`button`,{tabIndex:0,"data-layout-path":ue+`/button/max`,title:t.isMaximized()?e:r,"aria-label":t.isMaximized()?e:r,"aria-pressed":t.isMaximized(),className:F(T.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+` `+F(T.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_+(t.isMaximized()?`max`:`min`)),onClick:ie,onPointerDown:re,children:t.isMaximized()?typeof _.restore==`function`?_.restore(t):_.restore:typeof _.maximize==`function`?_.maximize(t):_.maximize},`max`))}if(!t.isMaximized()&&s){let e=o?n.i18nName(V.Close_Tab):n.i18nName(V.Close_Tabset);i.push((0,f.jsx)(`button`,{tabIndex:0,"data-layout-path":ue+`/button/close`,title:e,"aria-label":e,className:F(T.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+` `+F(T.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_CLOSE),onClick:o?oe:ae,onPointerDown:re,children:typeof _.closeTabset==`function`?_.closeTabset(t):_.closeTabset},`close`))}if(t.isActive()&&t.isEnableActiveIcon()){let e=n.i18nName(V.Active_Tabset);i.push((0,f.jsx)(`div`,{"data-layout-path":ue+`/button/active`,title:e,"aria-hidden":`true`,className:F(T.FLEXLAYOUT__TAB_TOOLBAR_ICON),children:typeof _.activeTabset==`function`?_.activeTabset(t):_.activeTabset},`active`))}let p=(0,f.jsx)(`div`,{ref:c,className:F(T.FLEXLAYOUT__TAB_TOOLBAR),onPointerDown:re,onDragStart:e=>{e.preventDefault()},children:i},`buttonbar`);return{leading:e,buttonbar:p,stickyBar:d}},z=(e,r,i,s)=>{let c,l=n.getKeyMap(),u=[Ce(l.focusNextTabset),Ce(l.focusPreviousTabset)].filter(Boolean).join(` `)||void 0,d=n.getEditingTab()?.getParent()===t,p=d?void 0:`tablist`,m=F(T.FLEXLAYOUT__TABSET_TABBAR_OUTER);t.getClassNameTabStrip()!==void 0&&(m+=` `+t.getClassNameTabStrip()),m+=` `+F(T.FLEXLAYOUT__TABSET_TABBAR_OUTER_+t.getTabLocation()),t.isActive()&&(m+=` `+F(T.FLEXLAYOUT__TABSET_SELECTED)),t.isMaximized()&&(m+=` `+F(T.FLEXLAYOUT__TABSET_MAXIMIZED));let h=fe;if(h){let e=t.getChildren()[0];e.getTabSetClassName()!==void 0&&(m+=` `+e.getTabSetClassName())}let g;if(r&&(g=(0,f.jsx)(`div`,{className:F(T.FLEXLAYOUT__TABSET_LEADING),children:r})),t.isEnableTabWrap())t.isEnableTabStrip()&&(c=(0,f.jsxs)(`div`,{className:m,style:{flexWrap:`wrap`,gap:`1px`,marginTop:`2px`},ref:k,"data-layout-path":ue+`/tabstrip`,onPointerDown:P,onDoubleClick:le,onContextMenu:ne,onClick:te,onAuxClick:te,draggable:!0,onDragStart:N,onDragEnd:ee,children:[g,(0,f.jsx)(`div`,{role:p,"aria-orientation":d?void 0:`horizontal`,"aria-label":d?void 0:t.getName(),"aria-keyshortcuts":d?void 0:u,style:{display:`contents`},children:e}),s,(0,f.jsx)(`div`,{style:{flexGrow:1,display:`flex`,justifyContent:`flex-end`},children:i})]}));else if(t.isEnableTabStrip()){let n;t.isEnableTabScrollbar()&&(n=(0,f.jsx)(`div`,{ref:a,"aria-hidden":`true`,className:F(T.FLEXLAYOUT__MINI_SCROLLBAR),onPointerDown:b})),c=(0,f.jsxs)(`div`,{className:m,ref:k,"data-layout-path":ue+`/tabstrip`,onPointerDown:P,onDoubleClick:le,onContextMenu:ne,onClick:te,onAuxClick:te,draggable:!0,onWheel:C,onDragStart:N,onDragEnd:ee,children:[g,(0,f.jsxs)(`div`,{className:F(T.FLEXLAYOUT__MINI_SCROLLBAR_CONTAINER),children:[(0,f.jsxs)(`div`,{ref:o,className:F(T.FLEXLAYOUT__TABSET_TABBAR_INNER)+` `+F(T.FLEXLAYOUT__TABSET_TABBAR_INNER_+t.getTabLocation()),style:{overflowX:`auto`,overflowY:`hidden`},onScroll:y,children:[(0,f.jsx)(`div`,{style:{width:h?`100%`:`none`},role:p,"aria-orientation":d?void 0:`horizontal`,"aria-label":d?void 0:t.getName(),"aria-keyshortcuts":d?void 0:u,className:F(T.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER)+` `+F(T.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER_+t.getTabLocation()),children:e}),s]}),n]}),i]})}return c},he=e=>{let r;if(t.getTabNodes().length===0){let e=n.getTabSetPlaceHolderCallback();e&&(r=e(t))}let i=(0,f.jsx)(`div`,{ref:A,className:F(T.FLEXLAYOUT__TABSET_CONTENT),children:r});return i=t.getTabLocation()===`top`?(0,f.jsxs)(f.Fragment,{children:[e,i]}):(0,f.jsxs)(f.Fragment,{children:[i,e]}),i},H=L(),{leading:ge,buttonbar:_e,stickyBar:ve}=me(),be=he(z(H,ge,_e,ve)),xe={flexGrow:Math.max(1,t.getWeight()*1e3),minWidth:t.getMinWidth(),minHeight:t.getMinHeight(),maxWidth:t.getMaxWidth(),maxHeight:t.getMaxHeight()};t.getModel().getMaximizedTabset(n.getLayoutId())!==void 0&&!t.isMaximized()&&(xe.display=`none`);let Se=(0,f.jsx)(`div`,{ref:O,className:F(T.FLEXLAYOUT__TABSET_CONTAINER),style:xe,children:(0,f.jsx)(`div`,{className:F(T.FLEXLAYOUT__TABSET),"data-layout-path":ue,children:be})});return t.isMaximized()&&n.getMainElement()?(0,p.createPortal)((0,f.jsx)(`div`,{style:{position:`absolute`,display:`flex`,top:0,left:0,bottom:0,right:0},children:Se}),n.getMainElement()):Se};Ot.displayName=`TabSet`;var kt=e=>{let{controller:t,rowNode:n}=e,r=d.useRef(null),i=n.getOrientation()===S.HORZ,a=d.useCallback(e=>{r.current=e,t.registerMeasurable(n,`row`,e)},[t,n]),o=[],s=0;for(let e of n.getChildren())s>0&&o.push((0,f.jsx)(pt,{controller:t,node:n,index:s,horizontal:i},`splitter`+s)),e instanceof I?o.push((0,f.jsx)(kt,{controller:t,rowNode:e},e.getId())):e instanceof F&&o.push((0,f.jsx)(Ot,{controller:t,tabsetNode:e},e.getId())),s++;let c={flexGrow:Math.max(1,n.getWeight()*1e3),minWidth:n.getMinWidth(),minHeight:n.getMinHeight(),maxWidth:n.getMaxWidth(),maxHeight:n.getMaxHeight()};return c.flexDirection=i?`row`:`column`,(0,f.jsx)(`div`,{ref:a,className:t.getClassName(T.FLEXLAYOUT__ROW),style:c,children:o})};kt.displayName=`Row`;var At=e=>{let{controller:t,selected:n,tabNode:r}=e,i=d.useRef(null),a=d.useRef(!0),o=d.useCallback(()=>{let e=r.getParent();e instanceof F&&(e.isActive()||t.doAction(E.setActiveTabset(e.getId(),t.getLayoutId())))},[r,t]),s=r.getParent(),c=t.getKeyMap().focusTabToggle,l=e=>{if(be(e,c)){let t=e.currentTarget.ownerDocument.getElementById(ve(`flexlayout-tabbutton-`,r.getId()));t&&(t.focus(),e.preventDefault(),e.stopPropagation())}};d.useLayoutEffect(()=>{let e=r.getMoveableElement(),n=i.current.ownerDocument,a=e.ownerDocument!==n;a&&n.adoptNode(e),e.parentElement!==i.current&&i.current.appendChild(e),a&&t.redrawLayoutAndTabContent();let s=()=>{r.saveScrollPosition()};e.addEventListener(`scroll`,s);let c=i.current;return c&&c.addEventListener(`pointerdown`,o),()=>{c&&c.removeEventListener(`pointerdown`,o),e.removeEventListener(`scroll`,s),e.isConnected||(t.getModel().getNodeById(r.getId())&&(r.isEnableWindowReMount()||t.getMainController()?.getMoveablesHome()?.appendChild(e)),r.setVisible(!1))}},[r,t,o]),d.useEffect(()=>{r.isSelected()&&(a.current&&=(r.restoreScrollPosition(),!1))}),d.useLayoutEffect(()=>(t.registerTabPanel(r,i.current),()=>{t.registerTabPanel(r,null)}),[t,r]);let u=t.getClassName,p=null;if(n&&document.hidden&&r.isEnablePopoutOverlay()){let e={};s.getContentRect().styleWithPosition(e);let t=u(T.FLEXLAYOUT__TAB_OVERLAY);s instanceof z&&s.isOverlay()&&(t+=` `+u(T.FLEXLAYOUT__TAB_OVERLAY_RAISED)),p=(0,f.jsx)(`div`,{style:e,className:t})}let m=u(T.FLEXLAYOUT__TAB);return s instanceof z&&(m+=` `+u(T.FLEXLAYOUT__TAB_BORDER),m+=` `+u(T.FLEXLAYOUT__TAB_BORDER_+s.getLocation().getName()),s.isOverlay()&&(m+=` `+u(T.FLEXLAYOUT__TAB_BORDER_OVERLAY))),r.getContentClassName()!==void 0&&(m+=` `+r.getContentClassName()),(0,f.jsxs)(f.Fragment,{children:[p,(0,f.jsx)(`div`,{ref:i,id:ve(`flexlayout-tab-`,r.getId()),role:`tabpanel`,"aria-labelledby":ve(`flexlayout-tabbutton-`,r.getId()),"aria-keyshortcuts":Ce(c),tabIndex:-1,onKeyDown:c?l:void 0,className:m,"data-layout-path":r.getPath()})]})};At.displayName=`Tab`;var jt=class extends d.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0}}componentDidCatch(e,t){}retry=()=>{this.setState({hasError:!1})};render(){return this.state.hasError?(0,f.jsx)(`div`,{className:T.FLEXLAYOUT__ERROR_BOUNDARY_CONTAINER,children:(0,f.jsx)(`div`,{role:`alert`,className:T.FLEXLAYOUT__ERROR_BOUNDARY_CONTENT,children:(0,f.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`},children:[this.props.message,(0,f.jsx)(`p`,{children:(0,f.jsx)(`button`,{tabIndex:0,onClick:this.retry,children:this.props.retryText})})]})})}):this.props.children}},Mt=d.memo(({controller:e,tabNode:t})=>{let n;if(t.getComponent())n=e.getFactory()(t);else if(t.getSubLayoutId()){let r=t.getModel().getLayouts().get(t.getSubLayoutId());n=(0,f.jsx)(`div`,{className:e.getClassName(T.FLEXLAYOUT__TAB_LAYOUT_CONTAINER),children:(0,f.jsx)(Ht,{...e.getProps(),layoutId:t.getSubLayoutId(),path:t.getPath()+r.getPath(),mainLayoutController:e.getMainController()})})}return(0,f.jsx)(jt,{message:e.i18nName(V.Error_rendering_component),retryText:e.i18nName(V.Error_rendering_component_retry),children:n})},Nt);Mt.displayName=`TabContentRenderer`;function Nt(e,t){return!t.visible||e.windowId===t.windowId&&e.fullRedrawRevision===t.fullRedrawRevision&&e.parentRedrawRevision===t.parentRedrawRevision&&e.tabNode===t.tabNode&&t.tabNode.getSubLayoutId()===void 0}var Pt=class e{static dragState=void 0;_controller;_dragEnterCount=0;_dragging=!1;_active=!1;_dropInfo;_outlineDiv;_mainController;constructor(e){this._controller=e,this._mainController=e.getMainController()}isDockTarget(){return this._controller.getLayout().getLayoutId()!==e.dragState?.floatLayoutId}isExcludeCenter(){if(e.dragState?.dockFloatToMain)return!0;let t=e.dragState?.dragNode;return t instanceof F?!t.isEnableClose()||t.getPinnedRunLength()>0:!1}addTabWithDragAndDrop(t,n,r){let i=B.fromJson(n,this._controller.getModel(),!1);e.dragState=new Ft(this._controller.getMainController(),`add`,i,n,r)}onDragEnded(){this.clearDragMain(),e.dragState=void 0}moveTabWithDragAndDrop(e,t){this.setDragNode(e,t)}startDockLayoutDrag(t,n,r){let i=n.getRootRow();e.dragState=new Ft(this._controller.getMainController(),`float`,i,void 0,void 0,!0,n.getLayoutId(),r),t.dataTransfer.setData(`text/plain`,`--flexlayout--`),t.dataTransfer.effectAllowed=`copyMove`,t.dataTransfer.dropEffect=`move`,this._dragEnterCount=0,this._controller.getModel().sortLayouts();let a=0;n.getRootRow()?.forEachNode(e=>{e instanceof B&&a++},0);let o=this._controller.i18nName(V.Dock_Float_Tabs).replace(`?`,String(a)),s=!1;if(this._controller.getProps().onRenderDragRect){let e=this._controller.getProps().onRenderDragRect(o,i,void 0);e&&(this.setDragComponent(t,e,10,10),s=!0)}s||this.setDragComponent(t,o,10,10)}setDragNode=(t,n)=>{if(e.dragState=new Ft(this._controller.getMainController(),`internal`,n,void 0,void 0),t.dataTransfer.setData(`text/plain`,`--flexlayout--`),t.dataTransfer.effectAllowed=`copyMove`,t.dataTransfer.dropEffect=`move`,this._dragEnterCount=0,this._controller.getModel().sortLayouts(),n instanceof F){let e=!1,r=this._controller.i18nName(V.Move_Tabset);if(n.getChildren().length>0&&(r=this._controller.i18nName(V.Move_Tabs).replace(`?`,String(n.getChildren().length))),this._controller.getProps().onRenderDragRect){let i=this._controller.getProps().onRenderDragRect(r,n,void 0);i&&(this.setDragComponent(t,i,10,10),e=!0)}e||this.setDragComponent(t,r,10,10)}else if(n instanceof R){let e=!1,r=this._controller.i18nName(V.Move_Group).replace(`?`,String(n.getChildren().length));if(this._controller.getProps().onRenderDragRect){let i=this._controller.getProps().onRenderDragRect(r,n,void 0);i&&(this.setDragComponent(t,i,10,10),e=!0)}e||this.setDragComponent(t,r,10,10)}else{let e=t.target;if(e&&typeof e.getBoundingClientRect==`function`){let r=e.getBoundingClientRect(),i=t.clientX-r.left,a=t.clientY-r.top,o=n?.getParent(),s=o instanceof z&&o.getOrientation()===S.HORZ,c=s?10:i,l=s?10:a,u=!1;if(this._controller.getProps().onRenderDragRect){let e=(0,f.jsx)(tt,{controller:this._controller,tabNode:n},n.getId()),r=this._controller.getProps().onRenderDragRect(e,n,void 0);r&&(this.setDragComponent(t,r,c,l),u=!0)}u||(je()?this.setDragComponent(t,(0,f.jsx)(tt,{tabNode:n,controller:this._controller}),c,l):t.dataTransfer.setDragImage(n.getTabStamp(),c,l))}}};setDragComponent(e,t,n,r){let i=(0,f.jsx)(`div`,{style:{position:`unset`},className:this._controller.getClassName(T.FLEXLAYOUT__LAYOUT)+` `+this._controller.getClassName(T.FLEXLAYOUT__DRAG_RECT),children:t}),a=this._controller.getCurrentDocument(),o=a.createElement(`div`);o.setAttribute(`data-layout-path`,`/drag-rectangle`),o.style.position=`absolute`,o.style.left=`-10000px`,o.style.top=`-10000px`,a.body.appendChild(o);let s=(0,m.createRoot)(o);(0,p.flushSync)(()=>s.render(i)),e.dataTransfer.setDragImage(o,n,r),setTimeout(()=>{s.unmount(),a.body.removeChild(o)},0)}updateActive(t){let n=Array.from(this._controller.getModel().getLayouts().values()),r=e.dragState?.dockFloatToMain===!0,i,a;for(let t=n.length-1;t>=0;t--){let o=n[t];if(r&&o.getLayoutId()===e.dragState?.floatLayoutId)continue;let s=U(o)?.getDragDropManager();s&&s.getDragEnterCount()>0&&(o.getType()===`tab`?a=o:!i&&!a&&(i=o))}if(a){let e=a.findParentLayout();(i===e||!i)&&(i=a)}i&&U(i).getDragDropManager().setActive(!0,t);for(let e of n)e!==i&&U(e)?.getDragDropManager().setActive(!1,t)}setActive(e,t){this._active!==e&&(this._active=e,this._active?this.onDragEnter(t):this.onDragLeave(t))}onDragEnterRaw=e=>{this._dragEnterCount++,this.updateActive(e)};onDragLeaveRaw=e=>{this._dragEnterCount--,this.updateActive(e)};clearDragMain(){this._controller.showOverlayOnAllWindows(!1);for(let[,e]of this._controller.getModel().getLayouts()){let t=U(e);t&&t.getDragDropManager().clearDragLocal()}}clearDragLocal(){this._dragEnterCount=0,this._active=!1,this.clearDragLocalVisuals()}clearDragLocalVisuals(){this._controller.setState({showEdges:!1}),this._dragging=!1,this._outlineDiv&&=(this._controller.getRootDiv().removeChild(this._outlineDiv),void 0)}onDragEnter=t=>{if(!e.dragState&&this._controller.getProps().onExternalDrag){let n=this._controller.getProps().onExternalDrag(t);if(n){let t=B.fromJson(n.json,this._controller.getModel(),!1);e.dragState=new Ft(this._controller.getMainController(),`external`,t,n.json,n.onDrop)}}if(this._mainController===e.dragState?.mainLayoutController&&(!e.dragState?.dockFloatToMain||this.isDockTarget())&&e.dragState){t.preventDefault(),this._dropInfo=void 0;let e=this._controller.getRootDiv(),n=this._controller.getCurrentDocument();this._outlineDiv=n.createElement(`div`),this._outlineDiv.className=this._controller.getClassName(T.FLEXLAYOUT__OUTLINE_RECT),this._outlineDiv.style.visibility=`hidden`;let r=this._controller.getTabDragSpeed();this._outlineDiv.style.transition=`top ${r}s, left ${r}s, width ${r}s, height ${r}s`,e.appendChild(this._outlineDiv),this._dragging=!0,this._controller.showOverlayOnAllWindows(!0),this._controller.getModel().getMaximizedTabset(this._controller.getLayoutId())===void 0&&this._controller.setState({showEdges:this._controller.getModel().isEnableEdgeDock()});let i=this._controller.getRootDiv().getBoundingClientRect();new x(t.clientX-i.left,t.clientY-i.top,1,1).positionElement(this._outlineDiv)}};onDragOver=t=>{if(this._mainController===e.dragState?.mainLayoutController&&(!e.dragState?.dockFloatToMain||this.isDockTarget())&&this._active){if(e.dragState?.dockFloatToMain){let n=t.target;if(n&&e.dragState.sourceFloatElement?.contains(n)){this._dropInfo=void 0;return}}let n=this._controller.getRootDiv()?.getBoundingClientRect(),r={x:t.clientX-(n?.left??0),y:t.clientY-(n?.top??0)};e.dragState.dockFloatToMain||this._controller.checkForBorderToShow(r.x,r.y);let i=this._controller.getModel().findDropTargetNode(this._controller.getLayoutId(),e.dragState.dragNode,r.x,r.y,this.isExcludeCenter());if(i){if(e.dragState.dockFloatToMain&&(i.location===C.CENTER||!(i.node instanceof F)&&!(i.node instanceof I)))return;t.preventDefault(),this._dropInfo=i,this._outlineDiv&&(this._outlineDiv.className=this._controller.getClassName(i.className),i.rect.positionElement(this._outlineDiv),this._outlineDiv.style.visibility=`visible`)}}};onDragLeave=t=>{if(this._mainController===e.dragState?.mainLayoutController&&(this.clearDragLocalVisuals(),this._controller.isMainLayout())){let e=!1;for(let[,t]of this._controller.getModel().getLayouts()){let n=U(t);if(n&&n.getDragDropManager().isDragging()){e=!0;break}}e===!1&&this.clearDragMain()}};onDrop=t=>{if(this._mainController!==e.dragState?.mainLayoutController){this.clearDragLocal();return}if(!e.dragState?.dockFloatToMain||this.isDockTarget()){if(this._active){t.preventDefault();let n=e.dragState;if(this._dropInfo&&n.dockFloatToMain){let e=t.target;e&&n.sourceFloatElement?.contains(e)&&(this._dropInfo=void 0)}if(this._dropInfo){if(n.dragJson!==void 0){let e=this._controller.doAction(E.addTab(n.dragJson,this._dropInfo.node.getId(),this._dropInfo.location,this._dropInfo.index));n.fnNewNodeDropped!==void 0&&n.fnNewNodeDropped(e,t)}else n.dragNode!==void 0&&(n.dockFloatToMain?this._controller.doAction(E.dockFloatToLayout(n.floatLayoutId,this._dropInfo.node.getId(),this._dropInfo.location,this._dropInfo.index)):this._controller.doAction(E.moveNode(n.dragNode.getId(),this._dropInfo.node.getId(),this._dropInfo.location,this._dropInfo.index)))}this.clearDragMain(),e.dragState=void 0}this._dragEnterCount=0}};getDragEnterCount(){return this._dragEnterCount}isDragging(){return this._dragging}},Ft=class{mainLayoutController;dragSource;dragNode;dragJson;fnNewNodeDropped;dockFloatToMain;floatLayoutId;sourceFloatElement;constructor(e,t,n,r,i,a=!1,o=void 0,s=void 0){this.mainLayoutController=e,this.dragSource=t,this.dragNode=n,this.dragJson=r,this.fnNewNodeDropped=i,this.dockFloatToMain=a,this.floatLayoutId=o,this.sourceFloatElement=s}},It=({controller:e})=>{let t=[],n=e.getIcons().edgeArrow;if(e.getState().showEdges&&e.getModel().isEnableEdgeDockIndicators()){let r=e.getModel().getRootRow(e.getLayoutId()).getRect(),i=e.getClassName(T.FLEXLAYOUT__EDGE_RECT);t.push((0,f.jsx)(`div`,{"aria-hidden":`true`,style:{top:0,left:r.width/2-50,width:100,height:10,borderBottomLeftRadius:50,borderBottomRightRadius:50},className:i+` `+e.getClassName(T.FLEXLAYOUT__EDGE_RECT_TOP),children:(0,f.jsx)(`div`,{style:{transform:`rotate(180deg)`},children:n})},`North`)),t.push((0,f.jsx)(`div`,{"aria-hidden":`true`,style:{top:r.height/2-50,left:0,width:10,height:100,borderTopRightRadius:50,borderBottomRightRadius:50},className:i+` `+e.getClassName(T.FLEXLAYOUT__EDGE_RECT_LEFT),children:(0,f.jsx)(`div`,{style:{transform:`rotate(90deg)`},children:n})},`West`)),t.push((0,f.jsx)(`div`,{"aria-hidden":`true`,style:{top:r.height-10,left:r.width/2-50,width:100,height:10,borderTopLeftRadius:50,borderTopRightRadius:50},className:i+` `+e.getClassName(T.FLEXLAYOUT__EDGE_RECT_BOTTOM),children:(0,f.jsx)(`div`,{children:n})},`South`)),t.push((0,f.jsx)(`div`,{"aria-hidden":`true`,style:{top:r.height/2-50,left:r.width-10,width:10,height:100,borderTopLeftRadius:50,borderBottomLeftRadius:50},className:i+` `+e.getClassName(T.FLEXLAYOUT__EDGE_RECT_RIGHT),children:(0,f.jsx)(`div`,{style:{transform:`rotate(-90deg)`},children:n})},`East`))}return(0,f.jsx)(f.Fragment,{children:t})};It.displayName=`EdgeIndicators`;var Lt=d.memo(e=>{Lt.displayName=`DragTabButton`;let{controller:t,tabNode:n}=e,r=d.useRef(null);d.useEffect(()=>(n.setTabStamp(r.current),()=>{n.setTabStamp(null)}),[n]);let i=t.getClassName,a=i(T.FLEXLAYOUT__DRAG_RECT);return(0,f.jsx)(`div`,{ref:r,className:a,children:(0,f.jsx)(tt,{controller:t,tabNode:n},n.getId())})},Rt);function Rt(e,t){return t.dragging}var zt=class e{static Windows=new WeakMap;_props;_state;_setState;_layoutRef;_moveablesHomeRef;_findBorderBarSizeRef;_findSplitterSizeRef;_mainRef;_orderedTabIds;_orderedTabMoveableIds;_currentDocument;_currentWindow;_showOverlay=!1;_supportsPopout;_popoutURL;_icons;_dragDropManager;_layoutId;_layout;_mainController;_popoutWindowName;_cachedLayoutDOMRect;_reLayout;_measurables=new Map;_tabPanels=new Map;_lastRect=x.empty();_lastSplitterSize=8;_geometryResizeObserver;_splitterDragging=!1;constructor(e,t,n){this._props=e,this._state=t,this._setState=n,this._orderedTabIds=[],this._orderedTabMoveableIds=[],this._supportsPopout=e.supportsPopout===void 0?Vt:e.supportsPopout,this._popoutURL=e.popoutURL?e.popoutURL:`popout.html`,this._icons={...Bt,...e.icons},this._layoutId=e.layoutId?e.layoutId:pe.MAIN_LAYOUT_ID,this._mainController=e.mainLayoutController?e.mainLayoutController:this,this._dragDropManager=new Pt(this),this._layout=e.model.getLayouts().get(this._layoutId),this._layout.setController(this),this._popoutWindowName=e.popoutWindowName,this._reLayout=!1}renderLayout(){return this._cachedLayoutDOMRect=void 0,(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(kt,{controller:this,rowNode:this._props.model.getRootRow(this._layoutId)},`__row__`),(0,f.jsx)(It,{controller:this})]})}renderTabContainers(){let e=new Map;return this._props.model.visitLayoutNodes(this._layoutId,t=>{if(t instanceof B){let n=t,r=n.isSelected(),i=n.isRendered(),a=n.isEnableRenderOnDemand();(i||r||!a)&&e.set(n.getId(),(0,f.jsx)(At,{controller:this,tabNode:n,selected:r},n.getId()))}}),e}renderTabContents(){let e=new Map;for(let[t,n]of this._props.model.getLayouts())this._props.model.visitLayoutNodes(t,t=>{if(t instanceof B){let r=t,i=r.isSelected(),a=r.isRendered(),o=r.isEnableRenderOnDemand(),s=r.getTabContainer().getContentRect(),c=i||!o;if(a||c&&s.width>0&&s.height>0){let t=r.getMoveableElement();t.style.overflow=r.isEnableScrollbars()?`auto`:`hidden`;let i=n.getWindowId()||``,a=r.getId()+(r.isEnableWindowReMount()?i:``);e.set(r.getId(),(0,p.createPortal)((0,f.jsx)(Mt,{controller:this,tabNode:r,windowId:i,visible:c,fullRedrawRevision:this._state.fullRedrawRevision,parentRedrawRevision:this._props.parentRedrawRevision},a),t,a)),r.setRendered(!0)}}});return e}renderDragTabButtons(){let e=[];return this._props.model.visitNodes(t=>{if(t instanceof B){let n=t;e.push((0,f.jsx)(Lt,{controller:this,tabNode:n,dragging:Oe},n.getId()))}}),e}redrawLayout(){this._mainController?.setState(e=>({layoutRedrawRevision:e.layoutRedrawRevision+1}))}redrawLayoutAndTabContent(){this._mainController?.setState(e=>({fullRedrawRevision:e.fullRedrawRevision+1}))}doAction(e){if(this._props.onAction!==void 0){let t=this._props.onAction(e);return t===void 0?void 0:this._props.model.doAction(t)}return this._props.model.doAction(e)}updateRect=()=>{if(this._layoutRef.current){let e=this._layoutRef.current;if(!this._layout.isMainLayout()&&this._layout.getType()===`float`){let t=e.closest(`.`+this.getClassName(T.FLEXLAYOUT__FLOAT_WINDOW));t instanceof HTMLDivElement&&(e=t)}let t=x.fromDomRect(e.getBoundingClientRect());if(!this._layout.isMainLayout()&&this._layout.getType()===`float`){let e=this._mainController.getDomRect();t=t.relativeTo(e)}!t.equalsWhenRounded(this._lastRect)&&t.width!==0&&t.height!==0&&(this._lastRect=t,this._layout.setRect(t),this.redrawLayout())}};onModelChange=e=>{let t=e instanceof O?e.actions:[e];for(let e of t)if(e.type==E.DELETE_TAB&&this._state.showHiddenBorder!==C.CENTER){let e=this._props.model.getBorderSet().getBorderMap().get(this._state.showHiddenBorder);if(!e||e.getChildren().length===0){this._setState({showHiddenBorder:C.CENTER});break}}if(e.isAdjusting()&&(e.type===E.ADJUST_WEIGHTS||e.type===E.ADJUST_BORDER_SPLIT)){e.type===E.ADJUST_WEIGHTS?this.applyAdjustingWeights(e):this.applyAdjustingBorderSplit(e),this._props.onModelChange&&this._props.onModelChange(this._props.model,e);return}this.redrawLayout(),this._props.onModelChange&&this._props.onModelChange(this._props.model,e)};applyMeasuredGeometry(){this.syncLayoutMetrics(),this.positionTabPanels(),this.isReLayout()&&(this.redrawLayout(),this.setReLayout(!1))}applyAdjustingWeights(e){let t=this._props.model.getNodeById(e.data.nodeId);if(!(t instanceof I)){this.redrawLayout();return}let n=e.data.weights,r=t.getChildren();for(let e=0;e<r.length;e++){let t=r[e];if(typeof n?.[e]!=`number`||!Number.isFinite(n[e]))continue;let i=t instanceof I?`row`:`tabset`,a=this._measurables.get(i+`:`+t.getId())?.element;if(!a){this.redrawLayout();return}a.style.flexGrow=String(Math.max(1,n[e]*1e3))}this.applyMeasuredGeometry()}applyAdjustingBorderSplit(e){let t=this._props.model.getNodeById(e.data.node);if(!(t instanceof z)){this.redrawLayout();return}if(t.isOverlay()){this.redrawLayout();return}let n=this._measurables.get(`bordercontent:`+t.getId())?.element;if(!n){this.redrawLayout();return}let r=t.getSize();t.isHorizontal()?(n.style.width=r+`px`,n.style.minWidth=t.getMinSize()+`px`,n.style.maxWidth=t.getMaxSize()+`px`):(n.style.height=r+`px`,n.style.minHeight=t.getMinSize()+`px`,n.style.maxHeight=t.getMaxSize()+`px`),this.applyMeasuredGeometry()}reorderComponents(e,t){let n=t.filter(t=>e.has(t)),r=new Set(n);for(let t of e.keys())r.has(t)||n.push(t);return t===this._orderedTabIds?this._orderedTabIds=n:t===this._orderedTabMoveableIds&&(this._orderedTabMoveableIds=n),n.map(t=>e.get(t))}checkForBorderToShow(e,t){let n=this.getBoundingClientRect(this._mainRef.current),r=n.getCenter(),i=!1;this._props.model.isEnableEdgeDock()&&this._state.showHiddenBorder===C.CENTER&&(t>r.y-50&&t<r.y+50||e>r.x-50&&e<r.x+50)&&(i=!0);let a=C.CENTER;i||(e<=n.x+10?a=C.LEFT:e>=n.getRight()-10?a=C.RIGHT:t<=n.y+10?a=C.TOP:t>=n.getBottom()-10&&(a=C.BOTTOM)),a!==C.CENTER&&!this._props.model.getBorderSet().getBorderMap().has(a)&&(a=C.CENTER),a!==this._state.showHiddenBorder&&this.setState({showHiddenBorder:a})}onOverlayBorderPointerDown=e=>{let t=this._props.model.getBorderSet().getBorders().filter(e=>e.isOverlay()&&e.getSelected()!==-1);if(t.length===0||e.target?.closest?.(`.`+this.getClassName(T.FLEXLAYOUT__POPUP_MENU_CONTAINER)+`,.`+this.getClassName(T.FLEXLAYOUT__FLOAT_WINDOW)+`,.`+this.getClassName(T.FLEXLAYOUT__FLOATING_WINDOW_CONTENT)+`,.`+this.getClassName(T.FLEXLAYOUT__BORDER_TAB_OVERLAY)))return;let n=this.getDomRect();if(!n)return;let r=e.clientX-n.x,i=e.clientY-n.y,a=this._props.model.getRootRow(pe.MAIN_LAYOUT_ID)?.getRect();if(a&&a.contains(r,i))for(let e of t)e.getContentRect()?.contains(r,i)||this.closeOverlayBorder(e)};closeOverlayBorder(e){let t=e.getSelectedNode();if(t===void 0)return;let n=this._currentDocument,r=n?.getElementById(ve(`flexlayout-tab-`,t.getId())),i=!!n&&!!r&&r.contains(n.activeElement);this.doAction(E.selectTab(t.getId())),i&&n.getElementById(ve(`flexlayout-tabbutton-`,t.getId()))?.focus()}onOverlayBorderKeyDown=e=>{if(!be(e,this.getKeyMap().closeOverlayBorder))return;let t=this._currentDocument?.activeElement;if(!t)return;let n=this._props.model.getBorderSet().getBorders().filter(e=>e.isOverlay()&&e.getSelected()!==-1);for(let r of n){let n=r.getSelectedNode(),i=this._currentDocument.getElementById(ve(`flexlayout-tab-`,n.getId())),a=this._currentDocument.getElementById(ve(`flexlayout-tabbutton-`,n.getId()));if(i&&i.contains(t)||t===a){this.closeOverlayBorder(r),e.preventDefault();break}}};onTabsetNavKeyDown=e=>{if(e.defaultPrevented)return;let t=this.getKeyMap(),n;if(be(e,t.focusNextTabset))n=1;else if(be(e,t.focusPreviousTabset))n=-1;else return;this.focusAdjacentTabset(n)&&e.preventDefault()};focusAdjacentTabset(e){let t=this._currentDocument,n=t?.activeElement;if(!t||!n||!this.getRootDiv()?.contains(n))return!1;let r=n.tagName;if(r===`INPUT`||r===`TEXTAREA`||n.isContentEditable||n.closest(`[role="menu"]`)||this._props.model.getMaximizedTabset(this._layoutId)!==void 0)return!1;let i=[];if(this._props.model.visitLayoutNodes(this._layoutId,e=>{e instanceof F&&e.getSelectedNode()!==void 0&&i.push(e)}),i.length<2)return!1;let a=i.findIndex(e=>this._measurables.get(`tabset:`+e.getId())?.element.contains(n)?!0:!!t.getElementById(ve(`flexlayout-tab-`,e.getSelectedNode().getId()))?.contains(n));if(a===-1){let e=this._props.model.getActiveTabset(this._layoutId);a=e===void 0?0:i.indexOf(e),a===-1&&(a=0)}let o=i[(a+e+i.length)%i.length];return t.getElementById(ve(`flexlayout-tabbutton-`,o.getSelectedNode().getId()))?.focus(),this.doAction(E.setActiveTabset(o.getId(),this._layoutId)),!0}registerMeasurable(e,t,n){let r=t+`:`+e.getId(),i=this._measurables.get(r);n?this._measurables.set(r,{kind:t,node:e,element:n}):(this._measurables.delete(r),t===`grouppill`?e.setPillRect(x.empty()):t===`groupendmarker`&&e.setEndMarkerRect(x.empty())),t!==`tabbutton`&&(i&&this._geometryResizeObserver?.unobserve(i.element),n&&this._geometryResizeObserver?.observe(n))}setGeometryResizeObserver(e){if(this._geometryResizeObserver=e,e)for(let{kind:t,element:n}of this._measurables.values())t!==`tabbutton`&&e.observe(n)}syncLayoutMetrics(){this._cachedLayoutDOMRect=void 0;let e=!1;for(let{kind:t,node:n,element:r}of this._measurables.values()){if(!r.isConnected)continue;let i=this.getBoundingClientRect(r);switch(t){case`row`:case`tabset`:i.equalsWhenRounded(n.getRect())||(n.setRect(i),e=!0);break;case`tabstrip`:i.equalsWhenRounded(n.getTabStripRect())||(n.setTabStripRect(i),e=!0);break;case`tabsetcontent`:{let t=n;if(!isNaN(i.x)&&!t.getContentRect().equalsWhenRounded(i)){let n=t.getContentRect().width>0&&t.getContentRect().height>0;t.setContentRect(i),e=!0,!n&&i.width>0&&i.height>0&&this.setReLayout(!0)}break}case`tabbutton`:i.equalsWhenRounded(n.getTabRect())||(n.setTabRect(i),e=!0);break;case`grouppill`:i.equalsWhenRounded(n.getPillRect())||(n.setPillRect(i),e=!0);break;case`groupendmarker`:i.equalsWhenRounded(n.getEndMarkerRect())||(n.setEndMarkerRect(i),e=!0);break;case`borderheader`:i.equalsWhenRounded(n.getRect())||(n.setTabHeaderRect(i),e=!0);break;case`bordercontent`:{let t=n;if(!isNaN(i.x)&&i.width>0&&!t.getContentRect().equalsWhenRounded(i)){let n=t.getContentRect().width>0&&t.getContentRect().height>0;t.setContentRect(i),e=!0,!n&&i.height>0&&this.setReLayout(!0)}break}}}for(let{kind:t,node:n}of this._measurables.values())if(t===`grouppill`){let t=n,r=t.getDropRegion();r.equalsWhenRounded(t.getRect())||(t.setRect(r),e=!0)}return e}registerTabPanel(e,t){t?this._tabPanels.set(e.getId(),{node:e,element:t}):this._tabPanels.delete(e.getId())}positionTabPanels(){for(let{node:e,element:t}of this._tabPanels.values()){let n=e.getTabContainer(),r=n.getContentRect(),i=e.isSelected();n instanceof F?this._props.model.getMaximizedTabset(this._layoutId)!==void 0&&!n.isMaximized()&&(i=!1):n instanceof z&&(n.isShowing()||(i=!1)),r.positionElement(t),t.style.display=i?``:`none`,e.setRect(r),e.setVisible(i)}}updateLayoutMetrics=()=>{if(this._findBorderBarSizeRef.current){let e=this._findBorderBarSizeRef.current.getBoundingClientRect().height;Math.abs(e-this._state.calculatedBorderBarSize)>.5&&this.setState({calculatedBorderBarSize:e})}if(this._findSplitterSizeRef.current){let e=this._findSplitterSizeRef.current.getBoundingClientRect().width;Math.abs(e-this._lastSplitterSize)>.5&&(this._lastSplitterSize=e,this._props.model.setSplitterSize(e),this.redrawLayout())}};addTabWithDragAndDrop(e,t,n){this._dragDropManager.addTabWithDragAndDrop(e,t,n)}moveTabWithDragAndDrop(e,t){this._dragDropManager.moveTabWithDragAndDrop(e,t)}setDragComponent(e,t,n,r){this._dragDropManager.setDragComponent(e,t,n,r)}getMoveablesHome(){return this._moveablesHomeRef.current}getProps(){return this._props}getKeyMap(){return Se(this._props.keyMap)}setProps(e){this._props=e}getState(){return this._state}setStateRaw(e){this._state=e}setState(e){this._setState(e)}setSetState(e){this._setState=e}setLayoutRef(e){this._layoutRef=e}setMoveablesHomeRef(e){this._moveablesHomeRef=e}setFindBorderBarSizeRef(e){this._findBorderBarSizeRef=e}setFindSplitterSizeRef(e){this._findSplitterSizeRef=e}getMainRef(){return this._mainRef}setMainRef(e){this._mainRef=e}getOrderedTabIds(){return this._orderedTabIds}getOrderedTabMoveableIds(){return this._orderedTabMoveableIds}getCurrentDocument(){return this._currentDocument}setCurrentDocument(e){this._currentDocument=e}getCurrentWindow(){return this._currentWindow}setCurrentWindow(t){this._currentWindow=t,t&&!e.Windows.has(t)&&e.Windows.set(t,le())}getWindowId(){if(this.getCurrentWindow())return e.Windows.get(this.getCurrentWindow())}isSupportsPopout(){return this._supportsPopout}getPopoutURL(){return this._popoutURL}getIcons(){return this._icons}getDragDropManager(){return this._dragDropManager}getLayoutId(){return this._layoutId}getLayout(){return this._layout}setLayout(e){this._layout=e}getMainController(){return this._mainController}isMainLayout(){return this._layout.isMainLayout()}getPopoutWindowName(){return this._popoutWindowName??this.i18nName(V.Popout_Window_Name)}isReLayout(){return this._reLayout}setReLayout(e){this._reLayout=e}getBoundingClientRect(e){let t=this.getDomRect();return t?x.getBoundingClientRect(e).relativeTo(t):x.empty()}getClassName=e=>this._props.classNameMapper===void 0?e:this._props.classNameMapper(e);getLayoutRef(){return this._layoutRef.current}getDomRect(){return this._cachedLayoutDOMRect===void 0?this._layoutRef.current?(this._cachedLayoutDOMRect=x.fromDomRect(this._layoutRef.current.getBoundingClientRect()),this._cachedLayoutDOMRect):x.empty():this._cachedLayoutDOMRect}getRootDiv(){return this._layoutRef.current}getMainElement(){return this._mainRef.current}getFactory(){return this._props.factory}isRealtimeResize(){return this._props.realtimeResize??!0}isSplitterDragging(){return this._mainController?this._mainController._splitterDragging:this._splitterDragging}setSplitterDragging(e){let t=this._mainController??this;t._splitterDragging=e}setEditingTab(e){this.setState({editingTab:e})}getEditingTab(){return this._state.editingTab}getModel(){return this._props.model}getTabDragSpeed(){return this._props.tabDragSpeed?this._props.tabDragSpeed:.3}onCloseLayout=e=>{this.doAction(E.closePopout(e.getLayoutId()))};getScreenRect(e){let t=e.clone(),n=this.getDomRect(),r=this._currentWindow.outerHeight-this._currentWindow.innerHeight,i=this._currentWindow.outerWidth-this._currentWindow.innerWidth,a=r>=0&&r<=200?r:60,o=i>=0&&i<=100?i:2;return t.x=this._currentWindow.screenX+this._currentWindow.scrollX+o/2+n.x+t.x,t.y=this._currentWindow.screenY+this._currentWindow.scrollY+(a-o/2)+n.y+t.y,t.height+=a,t.width+=o,t}getRelativeRect(e){let t=e.clone();if(!this._layout.isMainLayout()){let e=this._layout.getRect();t.x+=e.x,t.y+=e.y}return t}moveWindowToFront(e){this.doAction(E.movePopoutToFront(e))}addTabToTabSet(e,t){if(this._props.model.getNodeById(e)!==void 0)return this.doAction(E.addTab(t,e,C.CENTER,-1))}addTabToActiveTabSet(e){let t=this._props.model.getActiveTabset(this._layoutId);if(t!==void 0)return this.doAction(E.addTab(e,t.getId(),C.CENTER,-1))}maximize(e){this.doAction(E.maximizeToggle(e.getId(),this.getLayoutId()))}customizeTab(e,t){this._props.onRenderTab&&this._props.onRenderTab(e,t)}customizeTabSet(e,t){this._props.onRenderTabSet&&this._props.onRenderTabSet(e,t)}i18nName(e,t){let n=this._props.model.translate(e);return n===e&&(n=he[e]??e),n===void 0&&(n=e+(t===void 0?``:t)),n}getShowOverflowMenu(){return this._props.onShowOverflowMenu}getTabSetPlaceHolderCallback(){return this._props.onTabSetPlaceHolder}showContextMenu(e,t){this._props.onContextMenu&&this._props.onContextMenu(e,t)}auxMouseClick(e,t){this._props.onAuxMouseClick&&this._props.onAuxMouseClick(e,t)}showOverlay(e){this._showOverlay!==e&&(this._showOverlay=e,this.setState({showOverlay:e}),Ee(!e,this._currentDocument))}showOverlayOnAllWindows(e){for(let[,t]of this._props.model.getLayouts()){let n=U(t);n&&n.showOverlay(e)}}},Bt={close:(0,f.jsx)(_t,{}),pin:(0,f.jsx)(vt,{}),closeTabset:(0,f.jsx)(_t,{}),closeFloatPopout:(0,f.jsx)(_t,{}),popout:(0,f.jsx)(St,{}),popoutFloat:(0,f.jsx)(Ct,{}),maximize:(0,f.jsx)(yt,{}),restore:(0,f.jsx)(Tt,{}),more:(0,f.jsx)(bt,{}),edgeArrow:(0,f.jsx)(xt,{}),activeTabset:(0,f.jsx)(Et,{}),dragToDock:(0,f.jsx)(wt,{}),popoutFloatWindow:(0,f.jsx)(St,{})},Vt=ge();function U(e){return e.getController()}var Ht=d.forwardRef((e,t)=>{let[n,r]=d.useState({editingTab:void 0,showEdges:!1,showOverlay:!1,calculatedBorderBarSize:29,layoutRedrawRevision:0,fullRedrawRevision:0,showHiddenBorder:C.CENTER}),i=d.useCallback(t=>{r(n=>({...n,...typeof t==`function`?t(n,e):t}))},[e]),a=d.useRef(null),[o,s]=d.useState(0),c=d.useRef(null),l=d.useRef(null),u=d.useRef(null),p=d.useRef(null),m=d.useMemo(()=>new zt(e,n,i),[]);m.setProps(e),m.setStateRaw(n),m.setSetState(i),m.setLayoutRef(a),m.setMoveablesHomeRef(c),m.setFindBorderBarSizeRef(l),m.setFindSplitterSizeRef(u),m.setMainRef(p);let h=e.model.getLayouts().get(m.getLayoutId());h.setController(m),d.useImperativeHandle(t,()=>m,[m]),d.useLayoutEffect(()=>{let e=m.syncLayoutMetrics();if(m.positionTabPanels(),m.isMainLayout()&&m.updateLayoutMetrics(),m.isReLayout()&&(m.redrawLayout(),m.setReLayout(!1)),a.current&&m.getCurrentDocument()!==void 0&&m.getCurrentDocument()!==a.current.ownerDocument&&s(e=>e+1),e){let e=a.current?.ownerDocument.defaultView??window,t=e.requestAnimationFrame(()=>{m.syncLayoutMetrics(),m.positionTabPanels(),m.isReLayout()&&(m.redrawLayout(),m.setReLayout(!1))});return()=>e.cancelAnimationFrame(t)}}),d.useEffect(()=>{let e=a.current.ownerDocument,t=e.defaultView;m.setCurrentDocument(e),m.setCurrentWindow(t);let n=new t.ResizeObserver(()=>{m.updateRect(),m.syncLayoutMetrics(),m.positionTabPanels(),m.updateLayoutMetrics(),m.isReLayout()&&(m.redrawLayout(),m.setReLayout(!1))});n.observe(a.current),m.setGeometryResizeObserver(n),l.current&&n.observe(l.current),u.current&&n.observe(u.current);let r=()=>{m.updateRect()};t.addEventListener(`resize`,r);let i=()=>{for(let[e,t]of m.getProps().model.getLayouts()){let e=t.getController();e&&e.redrawLayout()}};return m.isMainLayout()&&(e.addEventListener(`visibilitychange`,i),e.addEventListener(`pointerdown`,m.onOverlayBorderPointerDown,!0),e.addEventListener(`keydown`,m.onOverlayBorderKeyDown)),(m.isMainLayout()||m.getLayout()?.getType()===`window`)&&e.addEventListener(`keydown`,m.onTabsetNavKeyDown),()=>{m.setGeometryResizeObserver(void 0),n.disconnect(),t.removeEventListener(`resize`,r),e.removeEventListener(`visibilitychange`,i),e.removeEventListener(`pointerdown`,m.onOverlayBorderPointerDown,!0),e.removeEventListener(`keydown`,m.onOverlayBorderKeyDown),e.removeEventListener(`keydown`,m.onTabsetNavKeyDown)}},[m,o]),d.useEffect(()=>{let e;if(!m.isMainLayout()&&m.getLayout().getType()===`window`){let t=m.getProps().mainLayoutController?.getRootDiv();if(t){let n=t,r=a.current;Ae(n,r),e=new MutationObserver(()=>{Ae(n,r)&&m.redrawLayout()}),e.observe(n,{attributeFilter:[`style`]})}}return()=>{e&&e.disconnect()}},[m]),d.useEffect(()=>{let t=e.model;if(h.setToExportRectFunction((e,t)=>t===`window`?m.getScreenRect(e):m.getRelativeRect(e)),m.setLayout(h),m.isMainLayout()){let e={onAfterAction:m.onModelChange};return t.addChangeListener(e),()=>{t.removeChangeListener(e)}}},[e.model,m,h]);let g=m.isMainLayout()?(0,f.jsxs)(`div`,{className:m.getClassName(T.FLEXLAYOUT__LAYOUT_METRICS),children:[(0,f.jsx)(`div`,{ref:l,className:m.getClassName(T.FLEXLAYOUT__BORDER_SIZER),children:`FindBorderBarSize`},`findBorderBarSize`),(0,f.jsx)(`div`,{ref:u,className:m.getClassName(T.FLEXLAYOUT__SPLITTER_+`horz`)},`findSplitterSize`)]}):null;if(!a.current)return(0,f.jsx)(`div`,{ref:a,className:m.getClassName(T.FLEXLAYOUT__LAYOUT),children:g});let _=e.model,v=m.getLayoutId();_.getRootRow(v).calcMinMaxSize(),_.getRootRow(v).setPaths(e.path||``),m.isMainLayout()&&_.getBorderSet().setPaths();let y=(0,f.jsx)(Ne,{controller:m,show:n.showOverlay},`__overlay__`),b=m.renderLayout(),x=(0,f.jsx)(ht,{controller:m,inner:b}),S=m.renderTabContainers(),w=m.reorderComponents(S,m.getOrderedTabIds()),E=null,D=null,O=null,k=null;return m.isMainLayout()&&(E=(0,f.jsx)(Ze,{controller:m}),D=m.reorderComponents(m.renderTabContents(),m.getOrderedTabMoveableIds()),O=(0,f.jsx)(`div`,{"aria-hidden":`true`,className:m.getClassName(T.FLEXLAYOUT__LAYOUT_TAB_STAMPS),children:m.renderDragTabButtons()},`__dragTabButtons__`),k=(0,f.jsx)(`div`,{ref:c,className:m.getClassName(T.FLEXLAYOUT__LAYOUT_MOVEABLES_HOME)},`__moveables_home__`)),(0,f.jsxs)(`div`,{ref:a,className:m.getClassName(T.FLEXLAYOUT__LAYOUT),onDragEnter:m.getDragDropManager().onDragEnterRaw,onDragLeave:m.getDragDropManager().onDragLeaveRaw,onDragOver:m.getDragDropManager().onDragOver,onDrop:m.getDragDropManager().onDrop,children:[g,k,y,x,w,D,E,O]})});Ht.displayName=`LayoutInternal`;var Ut=d.forwardRef((e,t)=>{let n=(0,d.useRef)(null),r=(0,d.useRef)(e.model),i=(0,d.useRef)(0);r.current!==e.model&&(e.model.getAdoptedFromModel()!==r.current&&i.current++,r.current=e.model),(0,d.useEffect)(()=>(e.model.setI18nDefaults(he),e.model.setI18nTranslator(e.i18nTranslator),()=>{e.model.setI18nDefaults(void 0),e.model.setI18nTranslator(void 0)}),[e.model,e.i18nTranslator]),Ut.displayName=`Layout`,(0,d.useImperativeHandle)(t,()=>({redraw:()=>{n.current?.redrawLayoutAndTabContent()},addTabToTabSet:(e,t)=>n.current?.addTabToTabSet(e,t),addTabWithDragAndDrop:(e,t,r)=>{n.current?.addTabWithDragAndDrop(e,t,r)},moveTabWithDragAndDrop:(e,t)=>{n.current?.moveTabWithDragAndDrop(e,t)},addTabToActiveTabSet:e=>n.current?.addTabToActiveTabSet(e),setDragComponent:(e,t,r,i)=>{n.current?.setDragComponent(e,t,r,i)},editTabName:e=>{let t=n.current?.getModel().getNodeById(e);t instanceof B&&t.isEnableRename()&&U(t.getLayout())?.setEditingTab(t)},getRootDiv:()=>n.current.getRootDiv()}));let a=(0,d.useRef)({}),o=e.invalidateTabContentOnParentRender===!1?a.current:{};return(0,f.jsx)(Ht,{ref:n,...e,parentRedrawRevision:o},i.current)});E.SET_ACTIVE_TABSET;var Wt=1.2,Gt=2.5;function Kt(e){let t=Number(e);return!Number.isFinite(t)||t<=0?`expanded`:t<2?`closed`:t<8?`collapsed`:`expanded`}function qt(e){let t=Number(e);return!Number.isFinite(t)||t<=0?16:t<.5?Wt:Jt(Kt(t)).weight}function Jt(e){return{weight:e===`closed`?Wt:e===`collapsed`?Gt:16,enableTabStrip:!1}}var Yt=e=>C.getByName(e);function Xt(e){let t=e||{};return Object.keys(t).filter(e=>t[e]!==void 0).sort().map(e=>`${e}=${String(t[e])}`).join(`|`)}function Zt(e,t,n){if(!e)return null;let r=Xt(n),i=null;return e.visitNodes(e=>{if(i||e.getType()!==`tab`)return;let n=e;n.getComponent()===t&&Xt(n.getConfig()||{})===r&&(i=n)}),i}function Qt(e){let t=[];return e.visitNodes(e=>{e.getType()===`tabset`&&t.push(e)}),t}function $t(e,t){if(!e)return null;let n=null;return e.visitNodes(e=>{if(n||e.getType()!==`tab`)return;let r=e;r.getComponent()===t&&(n=r)}),n}function en(e){if(!e)return null;let t=rn(e);if(!t)return null;let n=e.getNodeById(t);if(!n)return null;let r=typeof n.getSelectedTab==`function`?n.getSelectedTab():null,i=n.getTabNodes&&n.getTabNodes()||[],a=r||i[i.length-1]||null;return a?{component:a.getComponent()||``,name:a.getName(),config:a.getConfig()||{}}:null}function tn(e,t){return!t||!t.length?!1:(e.getTabNodes()||[]).some(e=>t.includes(e.getComponent()||``))}function nn(e,t=[]){let n=e.getActiveTabset()||e.getFirstTabSet();if(n&&!tn(n,t))return n.getId();let r=[...Qt(e)].reverse().find(e=>!tn(e,t));return r?r.getId():n?n.getId():void 0}function rn(e){if(!e)return null;let t=null;return e.visitNodes(e=>{if(t||e.getType()!==`tabset`)return;let n=e,r=n.getId();if(r===`ts_main`){t=r;return}r!==`ts_sidebar`&&r!==`ts_right`&&!tn(n,[`sidebar`])&&(t=r)}),t}var an=[`progress`,`refs`],on=[`dir`,`page`,`group`,`repos`,`doc`,`dag`,`compose`,`templates`];function sn(e){if(!e)return null;let t=null;return e.visitNodes(e=>{if(!t&&!String(e.getId()).startsWith(`float`)){if(e.getType()===`tabset`&&e.getId()===`ts_right`){t=e.getId();return}if(e.getType()===`tabset`&&typeof e.getTabNodes==`function`){let n=(e.getTabNodes()||[]).map(e=>e.getComponent()||``);if(n.some(e=>on.includes(e)))return;n.some(e=>an.includes(e))&&(t=e.getId())}}}),t}var cn=16,ln=0;function un(e,t){let n=sn(e);return n?bn(e,n,{weight:t?cn:ln,enableTabStrip:!1}):!1}function dn(e){if(!e)return;let t=[];e.visitNodes(e=>{e.getType()===`tab`&&e.getComponent()===`progress`&&t.push(e.getId())});for(let n of t)e.doAction(E.deleteTab(n));un(e,!1)}function fn(e,t){if(!e)return 0;let n=sn(e),r=[];e.visitNodes(e=>{if(e.getType()!==`tab`)return;let i=e;if(t&&i.getComponent()===t)return;let a=i.getParent();a&&a.getId()===n&&r.push(i.getId())});for(let t of r)e.doAction(E.deleteTab(t));return r.length}function pn(e,t){if(!e)return;let n=[];e.visitNodes(e=>{e.getType()===`tab`&&e.getComponent()===t&&n.push(e.getId())});for(let t of n)e.doAction(E.deleteTab(t));let r=sn(e),i=r?e.getNodeById(r):null;i&&(i.getTabNodes()||[]).length||un(e,!1)}function mn(e,{dirKey:t,groupId:n,task:r}={}){if(!e)return;let i=$t(e,`progress`);if(!i)return;fn(e,`progress`);let a=i.getConfig()||{},o=n?{groupKey:n}:{dirKey:t||``};r!=null&&String(r)!==``&&(o.task=String(r)),JSON.stringify(a)!==JSON.stringify(o)&&(e.doAction(E.updateNodeAttributes(i.getId(),{config:o})),(t||n)&&un(e,!0))}function hn(e,t=null){if(!e)return 0;let n=sn(e),r=[];e.visitNodes(e=>{if(e.getType()!==`tab`||t&&e.getId()===t)return;let i=e,a=i.getComponent();if(a===`sidebar`||an.includes(a||``))return;let o=i.getParent();if(!o||o.getType()!==`tabset`)return;let s=o.getId();s===`ts_sidebar`||n&&s===n||(typeof i.getWindowId!=`function`||i.getWindowId()!==`float`)&&r.push(i.getId())});for(let t of r)e.doAction(E.deleteTab(t));return r.length}function gn(e){if(!e)return 0;let t=[];e.visitNodes(e=>{e.getType()===`tab`&&(e.getConfig()||{}).beside&&t.push(e.getId())});for(let n of t)e.doAction(E.deleteTab(n));return t.length}function _n(e,t){if(!e||!t)return!1;let n=e.getNodeById(t);if(!n)return!1;let r=sn(e),i=n.getParent&&n.getParent()?n.getParent().getId():``;if(r&&i===r)return!1;if(r)return e.doAction(E.moveNode(t,r,Yt(`center`),-1,!0)),!0;let a=e.getRootRow?e.getRootRow():null;return a?(e.doAction(E.moveNode(t,a.getId(),Yt(`right`),-1,!0)),!0):!1}function vn(e,t){if(!e)return null;let n=[];e.visitNodes(e=>{if(n.length||e.getType()!==`tab`||e.getComponent()!==t)return;let r=e.getParent();r&&r.getType()===`tabset`&&n.push(r)});let r=n[0];return r?r.getId():null}function yn(e,t){if(!e||!t)return null;let n=null;return e.visitNodes(e=>{n===null&&e.getType()===`tabset`&&e.getId()===t&&(n=e.getWeight())}),n}function bn(e,t,n){if(!e||!t)return!1;let r=!1;return e.visitNodes(e=>{r||e.getType()===`tabset`&&e.getId()===t&&(r=!0)}),r?(e.doAction(E.updateNodeAttributes(t,n)),!0):!1}function xn(e){if(!e)return null;let t=vn(e,`sidebar`);if(t)return t;let n=e.getFirstTabSet&&e.getFirstTabSet(),r=n?n.getId():null;if(!r)return null;e.doAction(E.addTab({type:`tab`,id:`t_sidebar`,name:`目录`,component:`sidebar`,enableClose:!1},r,Yt(`left`),-1,!0));let i=vn(e,`sidebar`);return i&&bn(e,i,Jt(`expanded`)),i}function Sn(e){let t=e&&e.getActiveTabset();return t&&t.getSelectedNode()||null}var Cn={SIDEBAR:`sidebar`,MAIN:`maincontent`,RIGHT:`rightSidebar`,FLOAT:`float`},wn={sidebar:Cn.SIDEBAR,dir:Cn.MAIN,page:Cn.MAIN,group:Cn.MAIN,repos:Cn.MAIN,templates:Cn.MAIN,doc:Cn.MAIN,dag:Cn.MAIN,compose:Cn.MAIN,progress:Cn.RIGHT,refs:Cn.RIGHT,settings:Cn.FLOAT},Tn=new Set([`sidebar`,`repos`,`progress`,`refs`,`settings`]);function En(e){return wn[e]||Cn.MAIN}function Dn(e){return Tn.has(e)}var On=e=>C.getByName(e);function kn(e,t){let{component:n,name:r,config:i={}}=t||{};if(!e||!n)return{tabId:null,reused:!1};let a=rn(e);if(!a)return{tabId:null,reused:!1};let o={...i,beside:!0},s=Zt(e,n,o);if(s)return e.doAction(E.selectTab(s.getId())),r&&s.getName()!==r&&e.doAction(E.renameTab(s.getId(),r)),{tabId:s.getId(),reused:!0};gn(e),e.doAction(E.addTab({type:`tab`,name:r||n,component:n,config:o,enableClose:!0},a,On(`right`),-1,!0));let c=Zt(e,n,o);return{tabId:c?c.getId():null,reused:!1}}function An(e,t){let{component:n,config:r={}}=t,i=t.name??void 0;if(!e)return{tabId:null,reused:!1};let a=t.area||En(n),o=Zt(e,n,r);if(o)return e.doAction(E.selectTab(o.getId())),i&&o.getName()!==i&&e.doAction(E.renameTab(o.getId(),i)),a===Cn.RIGHT&&(_n(e,o.getId()),un(e,!0)),a===Cn.MAIN&&(n===`page`||n===`dir`)&&mn(e,{dirKey:r.dirKey,groupId:r.groupId,task:r.task}),{tabId:o.getId(),reused:!0};if(a===Cn.RIGHT&&Dn(n)){fn(e,n);let t=$t(e,n);if(t)return e.doAction(E.updateNodeAttributes(t.getId(),{config:r})),e.doAction(E.selectTab(t.getId())),i&&t.getName()!==i&&e.doAction(E.renameTab(t.getId(),i)),_n(e,t.getId()),un(e,!0),{tabId:t.getId(),reused:!0}}if(a===Cn.MAIN){let a=rn(e);if(!a)return{tabId:null,reused:!1};e.doAction(E.addTab({type:`tab`,name:i,component:n,config:r},a,On(`center`),-1,!0));let o=Zt(e,n,r);return o&&!t._float&&hn(e,o.getId()),o&&!t._float&&(n===`page`||n===`dir`)&&mn(e,{dirKey:r.dirKey,groupId:r.groupId,task:r.task}),{tabId:o?o.getId():null,reused:!1}}if(a===Cn.RIGHT){let t=sn(e);if(t){fn(e,n),un(e,!0),e.doAction(E.addTab({type:`tab`,name:i,component:n,config:r},t,On(`center`),-1,!0));let a=Zt(e,n,r);return{tabId:a?a.getId():null,reused:!1}}let a=e.getRootRow?e.getRootRow():null;if(a){e.doAction(E.addTab({type:`tab`,name:i,component:n,config:r},a.getId(),On(`right`),-1,!0));let t=Zt(e,n,r);return un(e,!0),{tabId:t?t.getId():null,reused:!1}}}if(a===Cn.FLOAT)return jn(e,{...t,component:n,name:i,config:r});let s=nn(e,[`sidebar`]);if(!s)return{tabId:null,reused:!1};let c=On(t.location||`center`);e.doAction(E.addTab({type:`tab`,name:i,component:n,config:r},s,c,-1,!0));let l=Zt(e,n,r);return{tabId:l?l.getId():null,reused:!1}}function jn(e,t){if(!e)return{tabId:null,reused:!1};let n=e,r=Zt(e,t.component,t.config||{});if(r)return e.doAction(E.selectTab(r.getId())),{tabId:r.getId(),reused:!0};let i=rn(e);if(!i)return{tabId:null,reused:!1};let a=n.nextUniqueId(),o=[E.addTab({type:`tab`,id:a,name:t.name||t.component,component:t.component,config:t.config||{}},i,On(`center`),-1,!0),E.popoutTab(a,`float`)];e.doAction(E.group(o));let s=typeof window<`u`?window.innerWidth:1280,c=typeof window<`u`?window.innerHeight:800,l=Math.min(760,Math.max(560,s-160)),u=Math.min(700,Math.max(460,c-160));for(let[,t]of n.getLayouts()){if(t.getType()!==`float`)continue;let n=t.getRect(),r=new x(Math.round(n.x+(n.width-l)/2),Math.round(n.y+(n.height-u)/2),l,u);e.doAction(E.moveFloat(t.getLayoutId(),r))}return{tabId:a,reused:!1}}var Mn=[{id:`new`,label:`新建页`,icon:`plus`,section:`primary`,noHide:!0},{id:`import`,label:`导入`,icon:`import`,section:`bar`},{id:`progress`,label:`进程`,icon:`progress`,section:`bar`},{id:`orch`,label:`编排`,icon:`flow`,section:`bar`},{id:`plan`,label:`草稿态`,icon:`pin`,section:`bar`},{id:`more`,label:`更多`,icon:`dots`,section:`bar`,noHide:!0},{id:`refs`,label:`查看列表`,icon:`list`,section:`more`},{id:`getloop`,label:`持续 get`,icon:`refresh`,section:`more`}],Nn=[{id:`new`,label:`新增任务`,icon:`plus`,section:`primary`,noHide:!0},{id:`import`,label:`导入`,icon:`import`,section:`bar`},{id:`progress`,label:`进程`,icon:`progress`,section:`bar`},{id:`addMember`,label:`添加成员`,icon:`users`,section:`bar`},{id:`orch`,label:`编排`,icon:`flow`,section:`bar`},{id:`plan`,label:`草稿态`,icon:`pin`,section:`bar`},{id:`more`,label:`更多`,icon:`dots`,section:`bar`,noHide:!0},{id:`refs`,label:`查看列表`,icon:`list`,section:`more`},{id:`getloop`,label:`持续 get`,icon:`refresh`,section:`more`}],Pn=[{id:`new`,label:`新任务`,icon:`plus`,section:`primary`,noHide:!0},{id:`submit`,label:`提交`,icon:`send`,section:`primary`,noHide:!0},{id:`more`,label:`更多`,icon:`dots`,section:`bar`,noHide:!0},{id:`mode`,label:`源码模式`,icon:`code`,section:`more`,menuGroup:`edit`},{id:`img`,label:`插入图片`,icon:`img`,section:`more`,menuGroup:`edit`},{id:`att`,label:`添加附件`,icon:`clip`,section:`more`,menuGroup:`edit`},{id:`import`,label:`导入`,icon:`import`,section:`more`,menuGroup:`edit`},{id:`draft`,label:`存草稿`,icon:`save`,section:`more`,menuGroup:`edit`},{id:`chain`,label:`任务链`,icon:`chain`,section:`more`,menuGroup:`task`},{id:`clone`,label:`克隆任务`,icon:`copy`,section:`more`,menuGroup:`task`},{id:`fork`,label:`Fork 任务`,icon:`fork`,section:`more`,menuGroup:`task`},{id:`plan`,label:`转为草稿`,icon:`pin`,section:`more`,menuGroup:`task`},{id:`complete`,label:`标为完成`,icon:`check`,section:`more`,menuGroup:`task`},{id:`cancel-task`,label:`取消任务`,icon:`ban`,section:`more`,menuGroup:`task`,danger:!0},{id:`mark`,label:`评论`,icon:`comment`,section:`more`,menuGroup:`task`},{id:`delete`,label:`删除`,icon:`trash`,section:`more`,menuGroup:`task`,danger:!0},{id:`preview`,label:`预览提示词`,icon:`eye`,section:`more`,menuGroup:`view`},{id:`prog`,label:`进程`,icon:`progress`,section:`more`,menuGroup:`view`},{id:`source`,label:`原文`,icon:`doc`,section:`more`,menuGroup:`view`},{id:`shortcuts`,label:`快捷键`,icon:`keyboard`,section:`more`,menuGroup:`view`}],Fn=[{id:`save`,label:`保存`,icon:`save`,section:`primary`,noHide:!0},{id:`more`,label:`更多`,icon:`dots`,section:`bar`,noHide:!0},{id:`mode`,label:`源码模式`,icon:`code`,section:`more`,menuGroup:`edit`},{id:`rename`,label:`重命名`,icon:`rename`,section:`more`,menuGroup:`doc`},{id:`delete`,label:`删除`,icon:`trash`,section:`more`,menuGroup:`doc`,danger:!0},{id:`list`,label:`文字列表`,icon:`list`,section:`more`,menuGroup:`view`}],In=[{id:`add`,label:`登记仓库`,icon:`plus`,section:`primary`,noHide:!0},{id:`more`,label:`更多`,icon:`dots`,section:`bar`,noHide:!0},{id:`boards`,label:`分组管理`,icon:`board`,section:`more`,menuGroup:`manage`},{id:`refs`,label:`参考仓库管理`,icon:`repo-ref`,section:`more`,menuGroup:`manage`},{id:`transfer`,label:`导入导出`,icon:`transfer`,section:`more`,menuGroup:`manage`}],Ln=[{id:`edit`,label:`编辑`,icon:`edit`,section:`bar`},{id:`open`,label:`打开`,icon:`open`,section:`bar`},{id:`del`,label:`删除`,icon:`trash`,section:`bar`,danger:!0},{id:`more`,label:`更多`,icon:`dots`,section:`bar`,noHide:!0},{id:`remote`,label:`对齐 remote`,icon:`remote`,section:`more`,menuGroup:`repo`}],Rn={dir:Object.fromEntries(Mn.map(e=>[e.id,e])),group:Object.fromEntries(Nn.map(e=>[e.id,e])),task:Object.fromEntries(Pn.map(e=>[e.id,e])),doc:Object.fromEntries(Fn.map(e=>[e.id,e])),repos:Object.fromEntries(In.map(e=>[e.id,e])),"repos-row":Object.fromEntries(Ln.map(e=>[e.id,e]))};function zn(e){return e===`group`?Nn:e===`task`?Pn:e===`doc`?Fn:e===`repos`?In:e===`repos-row`?Ln:Mn}function Bn(e,t){return Rn[e]&&Rn[e][t]||{}}function Vn(e,t){let n=Bn(e,t);return String(n.section||``).startsWith(`more`)||!!n.defaultInMore}function Hn(e,t){return Bn(e,t.id).noHide?!0:t.visible===void 0?!Vn(e,t.id):t.visible!==!1}function Un(e,t){return t.id===`more`||Bn(e,t.id).noHide?!1:!Hn(e,t)}function Wn(e,t){let n=zn(e),r=new Set(n.map(e=>e.id)),i=new Set,a=[];for(let n of t||[]){if(!n||!n.id||!r.has(n.id)||i.has(n.id))continue;i.add(n.id);let t=Bn(e,n.id);a.push(t.noHide?{...n,visible:!0}:n)}for(let t of n)i.has(t.id)||a.push({id:t.id,visible:t.noHide?!0:!Vn(e,t.id)});let o=a.findIndex(e=>e.id===`more`);if(o>=0&&o<a.length-1){let[t]=a.splice(o,1),n=a.length;for(let t=0;t<a.length;t++){let r=a[t];if(r&&Vn(e,r.id)&&!Hn(e,r)){n=t;break}}t&&a.splice(n,0,t)}return a}function Gn(e){return Wn(e,zn(e).map(t=>({id:t.id,visible:t.noHide?!0:!Vn(e,t.id)})))}var Kn=e=>`nx-kv-tb-${e}`;function qn(e){let[t,n]=(0,d.useState)(()=>{try{let t=JSON.parse(localStorage.getItem(Kn(e))??`null`);if(Array.isArray(t))return Wn(e,t)}catch{}return Gn(e)});return(0,d.useEffect)(()=>{try{localStorage.setItem(Kn(e),JSON.stringify(t))}catch{}},[t,e]),{layout:t,setLayout:n,resetLayout:()=>n(Gn(e))}}function Jn(e,t){return!!Bn(e,t).lockLast}function Yn(e,t,n){return e.map(e=>e.id===t?{...e,...n}:e)}function Xn(e,t,{id:n,anchorId:r=null,after:i=!1,visible:a}){let o=t.findIndex(e=>e.id===n);if(o<0||Jn(e,n))return t;let s={...t[o]};a!==void 0&&(s.visible=Bn(e,n).noHide?!0:!!a);let c=t.filter((e,t)=>t!==o),l;if(r===n)l=o;else if(r){let e=c.findIndex(e=>e.id===r);l=e<0?c.length:e+ +!!i}else{let e=c.findIndex(e=>e.id===`more`);l=e>=0?e:c.length}let u=c.findIndex(t=>Jn(e,t.id));u>=0&&l>u&&(l=u);let d=c.slice();return d.splice(l,0,s),d}function Zn(e,t,n,r){let i=t.filter(t=>Hn(e,t)&&!Jn(e,t.id)),a=i.findIndex(e=>e.id===n);if(a<0)return t;let o=a+r;if(o<0||o>=i.length)return t;let s=i[o];return Xn(e,t,{id:n,anchorId:s.id,after:r>0})}function Qn({kind:t,layout:n,setLayout:r,onClose:i}){let[a,o]=(0,d.useState)(()=>n.map(e=>({...e}))),[s,c]=(0,d.useState)(null),[l,u]=(0,d.useState)(null),p=(0,d.useRef)(null),m=a.filter(e=>Hn(t,e)),h=a.filter(e=>Un(t,e)),g=m.filter(e=>!Jn(t,e.id)),_=()=>{let e=p.current;return e&&!Jn(t,e.id)?e:null},v=(e,n)=>{Jn(t,n.id)||(p.current={id:n.id,onBar:Hn(t,n)},u(n.id),e.dataTransfer&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,n.id)))},y=()=>{p.current=null,u(null),c(null)},b=(e,n)=>{o(r=>Xn(t,r,{...n,id:e.id,visible:e.onBar===!1||n.visible}))},x=e=>{let t=e.clientY;for(let n of e.currentTarget.querySelectorAll(`[data-row-id]`)){let e=n.getBoundingClientRect(),r=n.dataset.rowId??null;if(t<e.top)return{anchorId:r,after:!1};if(t<=e.bottom)return{anchorId:r,after:t>e.top+e.height/2}}return{anchorId:null,after:!1}},S=e=>{let t=_();if(!t)return;e.preventDefault();let n=x(e);c(n.anchorId?n.anchorId===t.id?null:`row:${n.anchorId}:${n.after?`after`:`before`}`:`zone:bar:end`)},C=e=>{e.preventDefault();let t=x(e),n=_();y(),n&&b(n,{anchorId:t.anchorId,after:t.after,visible:!0})},w=e=>{e.currentTarget.contains(e.relatedTarget)||c(e=>e&&e.startsWith(`zone:`)?null:e)},T=e=>{let n=_();n&&!Bn(t,n.id).noHide&&(e.preventDefault(),c(`menu`))},E=e=>{e.preventDefault();let n=_();y(),n&&!Bn(t,n.id).noHide&&o(e=>Yn(e,n.id,{visible:!1}))},D=e=>{e.currentTarget.contains(e.relatedTarget)||c(e=>e===`menu`?null:e)},O=e=>{let t=e.currentTarget.getBoundingClientRect();return(e.clientX-t.left)/(t.width||1)>.5},k=(e,t)=>{let n=_();n&&n.id!==e.id&&(t.preventDefault(),c(`chip:${e.id}:${O(t)?`after`:`before`}`))},A=(e,t)=>{let n=O(t);t.preventDefault();let r=_();y(),r&&b(r,{anchorId:e.id,after:n,visible:!0})},j=e=>{Bn(t,e).noHide||o(n=>{let r=n.find(t=>t.id===e);return Yn(n,e,{visible:!(r&&Hn(t,r))})})},M=(e,n)=>o(r=>Zn(t,r,e.id,n)),N=(e,t)=>{t.altKey&&(t.key===`ArrowUp`?(t.preventDefault(),M(e,-1)):t.key===`ArrowDown`&&(t.preventDefault(),M(e,1)))},ee=()=>{r(a),i()},P=()=>o(Gn(t)),te=(e,n)=>{let r=s===`row:${e.id}:before`?` drop-before`:s===`row:${e.id}:after`?` drop-after`:``;return[`tlp-row`,n?``:`off`,Jn(t,e.id)?`lock`:``,l===e.id?`dragging`:``,r].filter(Boolean).join(` `)};return(0,f.jsxs)(`div`,{className:`tlp-panel`,role:`dialog`,"aria-label":`自定义工具栏`,children:[(0,f.jsxs)(`div`,{className:`tlp-head`,children:[(0,f.jsx)(`b`,{children:`自定义工具栏`}),(0,f.jsx)(`span`,{className:`tlp-head-sub`,children:`拖拽排序;关显隐 → 收入「更多」`})]}),(0,f.jsxs)(`div`,{className:`tlp-body`,children:[(0,f.jsxs)(`div`,{className:`tlp-section tlp-span`,children:[(0,f.jsx)(`div`,{className:`tlp-section-label`,children:`预览(可直接拖动这里的按钮排序)`}),(0,f.jsx)(`div`,{className:`tlp-preview`,role:`list`,"data-testid":`tlp-preview`,children:m.map(n=>{let r=Bn(t,n.id),i=s===`chip:${n.id}:before`?` drop-before`:s===`chip:${n.id}:after`?` drop-after`:``;return(0,f.jsxs)(`span`,{className:[`tlp-chip`,r.section===`primary`?`primary`:``,l===n.id?`dragging`:``,i].filter(Boolean).join(` `),draggable:!Jn(t,n.id),role:`listitem`,onDragStart:e=>v(e,n),onDragEnd:y,onDragOver:e=>k(n,e),onDrop:e=>A(n,e),children:[r.icon?(0,f.jsx)(e,{name:r.icon,size:12}):null,r.label||n.id]},n.id)})})]}),(0,f.jsxs)(`div`,{className:`tlp-section`,children:[(0,f.jsx)(`div`,{className:`tlp-section-label`,children:`工具栏 · 拖进来即排序(行上/下半 = 前/后)`}),(0,f.jsxs)(`div`,{className:`tlp-list`+(s===`zone:bar:end`?` drop-on`:``),role:`list`,onDragOver:S,onDragLeave:w,onDrop:C,children:[g.length===0&&m.every(e=>Jn(t,e.id))?(0,f.jsx)(`div`,{className:`tlp-empty`,children:`空 —— 把「更多」里的项拖到这里`}):null,m.map(n=>{let r=Bn(t,n.id),i=g.findIndex(e=>e.id===n.id);return(0,f.jsxs)(`div`,{className:te(n,!0),draggable:!Jn(t,n.id),"data-row-id":n.id,tabIndex:Jn(t,n.id)?void 0:0,role:`listitem`,"aria-label":`${r.label||n.id}:拖动排序,Alt+上下换位`,onKeyDown:e=>N(n,e),onDragStart:e=>v(e,n),onDragEnd:y,children:[(0,f.jsx)(`span`,{className:`tlp-hnd`,title:Jn(t,n.id)?`锁定`:`拖动排序`,children:Jn(t,n.id)?`·`:`⋮⋮`}),(0,f.jsx)(`input`,{type:`checkbox`,checked:!0,disabled:!!r.noHide,onChange:()=>j(n.id),title:r.noHide?`不可隐藏`:`收入「更多」`}),(0,f.jsxs)(`span`,{className:`tlp-nm`,children:[(0,f.jsx)(`span`,{className:`tlp-nm-ico`,children:r.icon?(0,f.jsx)(e,{name:r.icon,size:13}):null}),r.label||n.id,r.noHide?(0,f.jsx)(`span`,{className:`tlp-sub`,children:`固定显示`}):null]}),Jn(t,n.id)?null:(0,f.jsxs)(`span`,{className:`tlp-acts`,children:[(0,f.jsx)(`button`,{type:`button`,className:`btn ghost sm`,disabled:i<=0,title:`上移`,onClick:()=>M(n,-1),children:`↑`}),(0,f.jsx)(`button`,{type:`button`,className:`btn ghost sm`,disabled:i<0||i>=g.length-1,title:`下移`,onClick:()=>M(n,1),children:`↓`})]})]},n.id)})]})]}),(0,f.jsxs)(`div`,{className:`tlp-section`,children:[(0,f.jsx)(`div`,{className:`tlp-section-label`,children:`更多菜单(拖到上方 = 显示到工具栏;拖回这里 = 收入更多)`}),(0,f.jsxs)(`div`,{className:`tlp-list tlp-menu`+(s===`menu`?` dropping`:``),role:`list`,onDragOver:T,onDragLeave:D,onDrop:E,children:[h.map(n=>{let r=Bn(t,n.id);return(0,f.jsxs)(`div`,{className:te(n,!1),draggable:!0,role:`listitem`,onDragStart:e=>v(e,n),onDragEnd:y,children:[(0,f.jsx)(`span`,{className:`tlp-hnd`,title:`拖到上方工具栏 = 显示`,children:`⋮⋮`}),(0,f.jsx)(`input`,{type:`checkbox`,checked:!1,onChange:()=>j(n.id),title:`显示到工具栏`}),(0,f.jsxs)(`span`,{className:`tlp-nm`,children:[r.icon?(0,f.jsx)(`span`,{className:`tlp-nm-ico`,children:(0,f.jsx)(e,{name:r.icon,size:13})}):null,r.label||n.id]})]},n.id)}),(0,f.jsx)(`div`,{className:`tlp-drop-hint`,role:`presentation`,children:s===`menu`?`松手 = 收入「更多」`:h.length?`把项拖到上方工具栏区域 = 显示到工具栏`:`工具栏上的按钮拖到这里即可收入「更多」`})]})]})]}),(0,f.jsxs)(`div`,{className:`tlp-foot`,children:[(0,f.jsx)(`span`,{className:`tlp-equiv`,children:`保存到本机 localStorage(每种工具区各存一份)`}),(0,f.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:P,children:`恢复默认`}),(0,f.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:i,children:`取消`}),(0,f.jsx)(`button`,{type:`button`,className:`btn sm primary`,onClick:ee,children:`保存`})]})]})}var $n=`task`,er=[{id:`edit`,label:`编辑`},{id:`task`,label:`任务`},{id:`view`,label:`查看`}];function tr(){let[e,t]=(0,d.useState)(!1),[n,r]=(0,d.useState)({x:0,y:0}),i=(0,d.useRef)(null),a=(0,d.useRef)(null);return(0,d.useEffect)(()=>{if(!e)return;let n=e=>{let n=e.target;i.current?.contains(n)||a.current?.contains(n)||t(!1)};return document.addEventListener(`mousedown`,n),()=>document.removeEventListener(`mousedown`,n)},[e]),{open:e,setOpen:t,pos:n,setPos:r,ref:i,menuRef:a}}function nr({menu:e,className:t=``,style:n,children:r}){return e.open?(0,p.createPortal)((0,f.jsx)(`div`,{className:`mdw-fmt-menu${t?` ${t}`:``}`,role:`menu`,ref:e.menuRef,style:{position:`fixed`,...e.pos,...n},children:r}),document.body):null}function rr(e,t,n=`left`){let r=t.currentTarget.getBoundingClientRect(),i=r.bottom+4;e.setPos(n===`left`?{left:r.left,top:i}:{left:`auto`,right:Math.max(8,window.innerWidth-r.right),top:i}),e.setOpen(e=>!e)}function ir({mode:t,onMode:n,showMark:r,submitLabel:i,onNew:a,onSubmit:o,onChain:s,onPreview:c,onImg:l,onAtt:u,onImport:m,onClone:h,onFork:g,onComplete:_,onPlan:v,planLabel:y,onCancelTask:b,onMark:x,onDraft:S,onDelete:C,onProg:w,onSource:T,onShortcuts:E,goalBadge:D,goalMenu:O}){let k=tr(),{layout:A,setLayout:j}=qn($n),[M,N]=(0,d.useState)(!1);(0,d.useEffect)(()=>{k.setOpen(!1)},[t]);let ee={new:a&&{label:`新任务`,run:a},submit:{label:i||`提交`,run:o,primary:!0},mode:n&&{label:t===`edit`?`返回实时预览`:`源码模式`,hint:t===`edit`?`当前`:``,run:()=>n?.(t===`edit`?`split`:`edit`)},img:l&&{label:`插入图片`,run:l},att:u&&{label:`添加附件`,run:u},import:m&&t!==`split`?{label:`导入`,run:m}:null,draft:S&&t!==`split`?{label:`存草稿`,run:S}:null,chain:s&&{label:`任务链`,run:s},clone:h&&{label:`克隆任务`,run:h},fork:g&&{label:`Fork 任务`,run:g},complete:_&&{label:`标为完成`,run:_},plan:v&&{label:y||`转为草稿(plan)`,run:v,hint:`不进队列`},"cancel-task":b&&{label:`取消任务`,run:b,danger:!0},mark:r&&x?{label:`评论`,run:x}:null,delete:C&&{label:`删除`,run:C,danger:!0},preview:c&&{label:`预览提示词`,run:c},prog:w&&{label:`进程`,run:w},source:T&&{label:`原文`,run:T},shortcuts:E&&{label:`快捷键`,run:E}},P=e=>e===`more`||!!ee[e],te=A.filter(e=>Hn($n,e)&&P(e.id)),ne=A.filter(e=>Un($n,e)&&P(e.id)),re=e=>{ee[e]?.run?.(),k.setOpen(!1)},ie=t=>{if(t===`more`)return(0,f.jsx)(`div`,{className:`mdw-actions-more`,ref:k.ref,children:(0,f.jsxs)(`button`,{type:`button`,className:`btn ghost sm${k.open?` on`:``}`,title:`更多操作`,"aria-expanded":k.open,"aria-haspopup":`menu`,onClick:e=>rr(k,e,`right`),children:[(0,f.jsx)(e,{name:`dots`}),`更多`]})},`more`);let n=ee[t];if(!n)return null;let r=Bn($n,t);return(0,f.jsxs)(`button`,{type:`button`,className:n.primary?`btn sm primary`:`btn ghost sm`,onClick:()=>re(t),children:[r.icon?(0,f.jsx)(e,{name:r.icon}):null,n.label]},t)},ae=er.map(e=>({...e,items:ne.filter(t=>Bn($n,t.id).menuGroup===e.id)})).filter(e=>e.items.length),oe=ne.filter(e=>!Bn($n,e.id).menuGroup);return(0,f.jsxs)(`div`,{className:`mdw-toolbar`,children:[(0,f.jsx)(`div`,{className:`mdw-toolbar-left`,children:D&&(0,f.jsx)(`button`,{type:`button`,className:`mdw-goal-badge`,title:D.title,"aria-haspopup":`menu`,"aria-expanded":k.open,onClick:e=>rr(k,e,`right`),children:D.label})}),(0,f.jsxs)(`div`,{className:`mdw-actions`,role:`group`,"aria-label":`任务操作`,children:[te.map(e=>ie(e.id)),(0,f.jsxs)(nr,{menu:k,className:`mdw-act-menu`,children:[O,O&&(0,f.jsx)(`div`,{className:`mdw-fmt-menu-sep`,role:`separator`}),ae.map(t=>(0,f.jsxs)(`div`,{className:`mdw-fmt-menu-group`,role:`group`,"aria-label":t.label,children:[(0,f.jsx)(`div`,{className:`mdw-fmt-menu-cap`,children:t.label}),t.items.map(t=>{let n=ee[t.id],r=n?.danger||Bn($n,t.id).danger,i=Bn($n,t.id);return(0,f.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`mdw-fmt-menu-item`+(r?` danger`:``),onClick:()=>re(t.id),children:[i.icon?(0,f.jsx)(e,{name:i.icon}):null,n?.label||Bn($n,t.id).label||t.id,n?.hint?(0,f.jsx)(`span`,{className:`hint`,children:n.hint}):null]},t.id)})]},t.id)),oe.map(t=>{let n=ee[t.id],r=Bn($n,t.id);return(0,f.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`mdw-fmt-menu-item`+(n?.danger||Bn($n,t.id).danger?` danger`:``),onClick:()=>re(t.id),children:[r.icon?(0,f.jsx)(e,{name:r.icon}):null,n?.label||Bn($n,t.id).label||t.id]},t.id)}),(0,f.jsx)(`div`,{className:`mdw-fmt-menu-sep`,role:`separator`}),(0,f.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`mdw-fmt-menu-item`,onClick:()=>{k.setOpen(!1),N(!0)},children:[(0,f.jsx)(e,{name:`gear`}),`自定义工具栏…`]})]})]}),M&&(0,p.createPortal)((0,f.jsx)(`div`,{className:`ta-panel-mask`,onClick:()=>N(!1),children:(0,f.jsx)(`div`,{className:`ta-panel-wrap`,onClick:e=>e.stopPropagation(),children:(0,f.jsx)(Qn,{kind:$n,layout:A,setLayout:j,onClose:()=>N(!1)})})}),document.body)]})}export{pe as A,yn as C,E as D,Jt as E,u as M,c as N,C as O,vn as S,qt as T,en as _,Qn as a,xn as b,Bn as c,jn as d,An as f,Xt as g,dn as h,tr as i,H as j,Ut as k,Hn as l,pn as m,ir as n,qn as o,Sn as p,rr as r,Un as s,nr as t,kn as u,$t as v,Kt as w,bn as x,Zt as y};
28
+ then enabling this option will gray out this tab`),t.addInherited(`borderWidth`,`tabBorderWidth`).setDescription(`the width of this tab when shown in a border; -1 uses the border's default size`),t.addInherited(`borderHeight`,`tabBorderHeight`).setDescription(`the height of this tab when shown in a border; -1 uses the border's default size`),t.addInherited(`minWidth`,`tabMinWidth`).setDescription(`the minimum width (in px) of this tab`),t.addInherited(`minHeight`,`tabMinHeight`).setDescription(`the minimum height (in px) of this tab`),t.addInherited(`maxWidth`,`tabMaxWidth`).setDescription(`the maximum width (in px) of this tab`),t.addInherited(`maxHeight`,`tabMaxHeight`).setDescription(`the maximum height (in px) of this tab`),t.addInherited(`enableScrollbars`,`tabEnableScrollbars`).setDescription(`whether the tab will be hosted in a scrollable container`),t}},V=function(e){return e.Close_Tab=`flexlayout.ui.close.tab`,e.Pinned_Tab=`flexlayout.ui.pinned.tab`,e.Rename_Tab=`flexlayout.ui.rename.tab`,e.Close_Tabset=`flexlayout.ui.close.tabset`,e.Active_Tabset=`flexlayout.ui.active.tabset`,e.Move_Tabset=`flexlayout.ui.move.tabset`,e.Move_Tabs=`flexlayout.ui.move.tabs (?)`,e.Move_Group=`flexlayout.ui.move.group (?)`,e.Maximize=`flexlayout.ui.maximize.tabset`,e.Restore=`flexlayout.ui.restore.tabset`,e.Popout_Tab=`flexlayout.ui.popout.tab`,e.Popout_Tab_Float=`flexlayout.ui.popout.tab.float`,e.Popout_Float_To_Window=`flexlayout.ui.popout.float.to.window`,e.Dock_Float_To_Layout=`flexlayout.ui.dock.float.to.layout`,e.Dock_Float_Tabs=`flexlayout.ui.dock.float.tabs (?)`,e.Overflow_Menu_Tooltip=`flexlayout.ui.overflow.menu.tooltip`,e.Splitter=`flexlayout.ui.splitter`,e.Error_rendering_component=`flexlayout.ui.error.rendering.component`,e.Error_rendering_component_retry=`flexlayout.ui.error.rendering.component.retry`,e.Popout_Window_Name=`flexlayout.ui.popout.window.name`,e.Menu_Rename=`flexlayout.ui.menu.rename`,e.Menu_Pin=`flexlayout.ui.menu.pin`,e.Menu_Unpin=`flexlayout.ui.menu.unpin`,e.Menu_Popout=`flexlayout.ui.menu.popout`,e.Menu_Float=`flexlayout.ui.menu.float`,e.Menu_Popout_Tabset=`flexlayout.ui.menu.popout.tabset`,e.Menu_Float_Tabset=`flexlayout.ui.menu.float.tabset`,e.Menu_Maximize=`flexlayout.ui.menu.maximize`,e.Menu_Restore=`flexlayout.ui.menu.restore`,e.Menu_Overlay=`flexlayout.ui.menu.overlay`,e.Menu_Split=`flexlayout.ui.menu.split`,e.Menu_Close_All=`flexlayout.ui.menu.close.all`,e.Menu_Close_Right=`flexlayout.ui.menu.close.right`,e.Menu_Close_Others=`flexlayout.ui.menu.close.others`,e.Menu_Add_To_New_Group=`flexlayout.ui.menu.add.to.new.group`,e.Menu_Add_To_Group=`flexlayout.ui.menu.add.to.group`,e.Menu_Remove_From_Group=`flexlayout.ui.menu.remove.from.group`,e.Menu_Ungroup=`flexlayout.ui.menu.ungroup`,e.Menu_Expand=`flexlayout.ui.menu.expand`,e.Menu_Collapse=`flexlayout.ui.menu.collapse`,e.Rename_Group=`flexlayout.ui.rename.group`,e.Group_Color=`flexlayout.ui.group.color`,e.Group_Pill_Tooltip=`flexlayout.ui.group.pill.tooltip`,e.Group_Name_Label=`flexlayout.ui.group.name.label`,e.Group_Name_Placeholder=`flexlayout.ui.group.name.placeholder`,e.Group_Color_N=`flexlayout.ui.group.color.n`,e.Group_Default_Name=`flexlayout.ui.group.default.name`,e}({}),he={"flexlayout.ui.close.tab":`Close`,"flexlayout.ui.pinned.tab":`Pinned`,"flexlayout.ui.rename.tab":`Rename tab`,"flexlayout.ui.close.tabset":`Close tabset`,"flexlayout.ui.active.tabset":`Active tabset`,"flexlayout.ui.move.tabset":`Move tabset`,"flexlayout.ui.move.tabs (?)":`Move tabs (?)`,"flexlayout.ui.move.group (?)":`Move group (?)`,"flexlayout.ui.maximize.tabset":`Maximize tabset`,"flexlayout.ui.restore.tabset":`Restore tabset`,"flexlayout.ui.popout.tab":`Popout selected tab`,"flexlayout.ui.popout.tab.float":`Float selected tab`,"flexlayout.ui.popout.float.to.window":`Popout panel`,"flexlayout.ui.dock.float.to.layout":`Drag into another layout`,"flexlayout.ui.dock.float.tabs (?)":`Dock tabs (?)`,"flexlayout.ui.overflow.menu.tooltip":`Hidden tabs`,"flexlayout.ui.splitter":`Resize`,"flexlayout.ui.error.rendering.component":`Error rendering component`,"flexlayout.ui.error.rendering.component.retry":`Retry`,"flexlayout.ui.popout.window.name":`Popout Window`,"flexlayout.ui.menu.rename":`Rename`,"flexlayout.ui.menu.pin":`Pin`,"flexlayout.ui.menu.unpin":`Unpin`,"flexlayout.ui.menu.popout":`Popout`,"flexlayout.ui.menu.float":`Float`,"flexlayout.ui.menu.popout.tabset":`Pop out tabset`,"flexlayout.ui.menu.float.tabset":`Float tabset`,"flexlayout.ui.menu.maximize":`Maximize`,"flexlayout.ui.menu.restore":`Restore`,"flexlayout.ui.menu.overlay":`Overlay`,"flexlayout.ui.menu.split":`Split`,"flexlayout.ui.menu.close.all":`Close All`,"flexlayout.ui.menu.close.right":`Close to the Right`,"flexlayout.ui.menu.close.others":`Close Others`,"flexlayout.ui.menu.add.to.new.group":`Add to new group`,"flexlayout.ui.menu.add.to.group":`Add to group`,"flexlayout.ui.menu.remove.from.group":`Remove from group`,"flexlayout.ui.menu.ungroup":`Ungroup`,"flexlayout.ui.menu.expand":`Expand`,"flexlayout.ui.menu.collapse":`Collapse`,"flexlayout.ui.rename.group":`Rename group`,"flexlayout.ui.group.color":`Group color`,"flexlayout.ui.group.pill.tooltip":`Tab Group, click to expand/collapse`,"flexlayout.ui.group.name.label":`Name`,"flexlayout.ui.group.name.placeholder":`Group Name`,"flexlayout.ui.group.color.n":`Group color ?`,"flexlayout.ui.group.default.name":`Group`},H={closeTab:`Ctrl+Delete`,renameTab:`F2`,focusTabToggle:void 0,focusNextTabset:void 0,focusPreviousTabset:void 0,closeOverlayBorder:`Escape`};function ge(){return typeof window<`u`&&window.matchMedia&&window.matchMedia(`(hover: hover) and (pointer: fine)`).matches}function _e(e,t,n){let r,i=t.getName(),a=t.getName();n===void 0&&(n=0),r===void 0&&t.getIcon()!==void 0&&(r=n===0?(0,f.jsx)(`img`,{style:{width:`1em`,height:`1em`},src:t.getIcon(),alt:``}):(0,f.jsx)(`img`,{style:{width:`1em`,height:`1em`,transform:`rotate(`+n+`deg)`},src:t.getIcon(),alt:``}));let o={leading:r,content:i,name:a,buttons:[]};return e.customizeTab(t,o),t.setRenderedName(o.name),o}function ve(e,t){return e+t.replace(/\s/g,`_`)}function ye(e){return e.getPath().replace(/\/t(\d+)$/,`/tb$1`)}function be(e,t){if(!t||typeof e.key!=`string`)return!1;let n=t.split(`+`),r=n.pop(),i=e=>n.some(t=>t.toLowerCase()===e);return e.key.toLowerCase()===r.toLowerCase()&&e.ctrlKey===i(`ctrl`)&&e.shiftKey===i(`shift`)&&e.altKey===i(`alt`)&&e.metaKey===i(`meta`)}function xe(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey}function Se(e){return{...H,...e}}function Ce(e){return e?.replace(/\bctrl\b/i,`Control`)}function we(e){e&&(e.querySelector(`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`)??e).focus()}function Te(e){let t=!1;return e.nativeEvent instanceof MouseEvent&&(e.nativeEvent.button!==0||e.ctrlKey||e.altKey||e.metaKey||e.shiftKey)&&(t=!0),t}function Ee(e,t){let n=[...De(`iframe`,t),...De(`webview`,t)];for(let t of n)t.style.pointerEvents=e?`auto`:`none`}function De(e,t){return[...t.getElementsByTagName(e)]}var Oe=!1;function ke(e,t,n,r,i){Oe=!0,t.preventDefault(),t.currentTarget&&typeof t.currentTarget.setPointerCapture==`function`&&t.currentTarget.setPointerCapture(t.pointerId);let a=e=>{e.preventDefault(),n(e.clientX,e.clientY)},o=()=>{e.removeEventListener(`pointermove`,a),e.removeEventListener(`pointerup`,c),e.removeEventListener(`pointercancel`,s)},s=e=>{e.preventDefault(),o(),Oe=!1,i()},c=()=>{o(),Oe=!1,r()};e.addEventListener(`pointermove`,a),e.addEventListener(`pointerup`,c),e.addEventListener(`pointercancel`,s)}function Ae(e,t){let n=e.getAttribute(`style`);return n!==t.getAttribute(`style`)&&(n?t.setAttribute(`style`,n):t.removeAttribute(`style`),!0)}function je(){let e=navigator.userAgent;return e.includes(`Safari`)&&!e.includes(`Chrome`)&&!e.includes(`Chromium`)}function Me(e=window){let t=e.document;return{scrollTop:e.pageYOffset||t.documentElement.scrollTop||t.body.scrollTop||0,scrollLeft:e.pageXOffset||t.documentElement.scrollLeft||t.body.scrollLeft||0,fullHeight:Math.max(t.body.scrollHeight,t.documentElement.scrollHeight,t.body.offsetHeight,t.documentElement.offsetHeight,t.body.clientHeight,t.documentElement.clientHeight),fullWidth:Math.max(t.body.scrollWidth,t.documentElement.scrollWidth,t.body.offsetWidth,t.documentElement.offsetWidth,t.body.clientWidth,t.documentElement.clientWidth),viewportHeight:e.innerHeight||t.documentElement.clientHeight,viewportWidth:e.innerWidth||t.documentElement.clientWidth}}var Ne=e=>{let{controller:t,show:n}=e;return(0,f.jsx)(`div`,{"aria-hidden":`true`,className:t.getClassName(T.FLEXLAYOUT__LAYOUT_OVERLAY),style:{display:n?`flex`:`none`}})};Ne.displayName=`Overlay`;var Pe=2e3,Fe=750,Ie=e=>{let{title:t,controller:n,layout:r,url:i,onCloseLayout:a,children:o}=e,s=d.useRef(null),[c,l]=d.useState(void 0),[u,f]=d.useState(void 0),[m,h]=d.useState(void 0),g=d.useMemo(()=>new Map,[]),_=d.useRef(!1),v=d.useRef(null),y=d.useRef(null),b=d.useRef(null),x=d.useRef(new Map);if(d.useLayoutEffect(()=>{!_.current&&c&&(_.current=!0,n.redrawLayout(),He(g))},[c,n,g]),d.useLayoutEffect(()=>{let e=()=>{if(s.current){let e=s.current;s.current=null,e.close()}};if(!s.current){let o=r.getLayoutId(),c=r.getRect();s.current=window.open(i,o,`left=${c.x},top=${c.y},width=${c.width},height=${c.height}`),s.current?(window.addEventListener(`beforeunload`,e),s.current.addEventListener(`load`,()=>{if(s.current){b.current?.(),_.current=!1;let e=s.current;s.current.focus(),s.current.resizeTo(c.width,c.height),s.current.moveTo(c.x,c.y);let i=s.current;i.resizeBy(c.width-i.outerWidth,c.height-i.outerHeight),i.moveBy(c.x-i.screenLeft,c.y-i.screenTop);let o=s.current.document;f(s.current),h(o),o.title=t,document.documentElement.lang&&(o.documentElement.lang=document.documentElement.lang),document.documentElement.dir&&(o.documentElement.dir=document.documentElement.dir);let u=o.createElement(`div`);u.className=T.FLEXLAYOUT__FLOATING_WINDOW_CONTENT,o.body.appendChild(u),n.getProps().onPopoutOpen?.(r,s.current,o),ze(o,g).then(()=>{l(u)}),v.current=new MutationObserver(e=>Le(e,o,g)),v.current.observe(document.head,{childList:!0,subtree:!0,characterData:!0}),y.current=o.defaultView?.setInterval(()=>{Ue(g,x.current)},Fe)??null;let d=()=>{s.current&&(n.getProps().onPopoutClose?.(r,s.current,o),a(r),s.current=null,b.current?.())};e.addEventListener(`beforeunload`,d),b.current=()=>{v.current?.disconnect(),v.current=null,y.current!=null&&(o.defaultView?.clearInterval(y.current),y.current=null),e.removeEventListener(`beforeunload`,d)}}})):(console.warn(`Unable to open window ${i}`),a(r))}return()=>{window.removeEventListener(`beforeunload`,e),s.current?.close(),s.current=null,b.current?.()}},[]),c!==void 0){let e=n.getProps().renderPopoutContent,t=o;return e&&m&&(t=e({children:o,layout:r,popoutWindow:u??window,popoutDocument:m})),(0,p.createPortal)(t,c)}return null};function Le(e,t,n){for(let r of e)if(r.type===`childList`&&r.target===document.head){for(let e of r.addedNodes)(e instanceof HTMLLinkElement||e instanceof HTMLStyleElement)&&Be(t,e,n);for(let e of r.removedNodes)if(e instanceof HTMLLinkElement||e instanceof HTMLStyleElement){let t=n.get(e);t&&(t.remove(),n.delete(e))}}else{let e=Re(r.target),t=e&&n.get(e);e&&t&&Ve(e,t)}}function Re(e){let t=e instanceof HTMLElement?e:e.parentNode;for(;t&&!(t instanceof HTMLStyleElement);)t=t.parentNode;return t instanceof HTMLStyleElement?t:void 0}function ze(e,t){let n=[],r=document.querySelectorAll(`style, link[rel="stylesheet"]`);for(let i of r)Be(e,i,t,n);return Promise.all(n)}function Be(e,t,n,r){if(t instanceof HTMLLinkElement){let i=t.cloneNode(!0);e.head.appendChild(i),n.set(t,i),r&&r.push(new Promise(t=>{let n=!1,r=e=>{n||(n=!0,t(e))};i.onload=()=>r(!0),i.onerror=()=>r(!1),e.defaultView?.setTimeout(()=>r(!1),Pe)}))}else if(t instanceof HTMLStyleElement)try{let r=t.cloneNode(!0);e.head.appendChild(r),Ve(t,r),n.set(t,r)}catch{}}function Ve(e,t){let n=e.textContent??``;if(n.trim()!==``)t.textContent=n;else try{t.textContent=``;let n=e.sheet?.cssRules;if(n)for(let e of n)t.sheet.insertRule(e.cssText,t.sheet.cssRules.length)}catch{}}function He(e){for(let[t,n]of e)t instanceof HTMLStyleElement&&Ve(t,n)}function Ue(e,t){for(let[n,r]of e){if(!(n instanceof HTMLStyleElement)||(n.textContent??``).trim()!==``)continue;let e=0;try{e=n.sheet?.cssRules.length??0}catch{}e!==t.get(n)&&(t.set(n,e),Ve(n,r))}}Ie.displayName=`PopoutWindow`;var We=10,Ge=-4,Ke=8,qe=12,Je=150,Ye=25,Xe=e=>{let{controller:t,layout:n,children:r}=e,[i,a]=d.useState(n.getRect()),o=d.useRef(x.empty()),s=t.getClassName,c=d.useRef(null),l=d.useRef(null),u=d.useRef(null),p=d.useRef(null),m=d.useRef(null),h=d.useRef(null),g=d.useRef(null),_=d.useRef(null),v=d.useRef(null),y=d.useRef(null),b=d.useRef(!1),S=d.useRef(void 0);d.useEffect(()=>{o.current=i},[i]),d.useEffect(()=>{let e=requestAnimationFrame(()=>{a(n.getRect())});return()=>cancelAnimationFrame(e)},[n]);let C=d.useCallback(e=>{let n=t.getCurrentWindow()??window,r=x.fromDomRect(t.getRootDiv().getBoundingClientRect()),i;if(t.getProps().constrainFloatPanels)i=new x(0,0,r.width,r.height);else{let e=Me(n),t=Math.max(e.fullWidth,n.innerWidth),a=Math.max(e.fullHeight,n.innerHeight);i=new x(-r.x,-r.y,t,a)}let a=e.clone();return a.clamp(i),a},[t]),w=d.useCallback(e=>{e.preventDefault(),e.stopImmediatePropagation()},[]);d.useEffect(()=>{let e=[l,u,p,m,h,g,_,v,y].map(e=>e.current).filter(e=>e!==null);return e.forEach(e=>e.addEventListener(`touchstart`,w,{passive:!1})),()=>{e.forEach(e=>e.removeEventListener(`touchstart`,w))}},[w]);let D=d.useRef(!1);d.useLayoutEffect(()=>{if(!D.current){D.current=!0;let e=C(i);e.equals(i)||(a(e),n.setRect(e))}},[C,i,n]),d.useEffect(()=>{let e=()=>{let e=[...t.getModel().getLayouts()],r=e[e.length-1][1];n!==r&&(b.current=!0)},r=t.getCurrentWindow()??window,i=()=>{b.current&&=(S.current=r.setTimeout(()=>{S.current=void 0,t.moveWindowToFront(n.getLayoutId())},10),!1)},a=c.current;return a&&(a.addEventListener(`pointerdown`,e,{capture:!0}),a.addEventListener(`pointerup`,i)),()=>{a&&(a.removeEventListener(`pointerdown`,e,{capture:!0}),a.removeEventListener(`pointerup`,i)),S.current!==void 0&&(r.clearTimeout(S.current),S.current=void 0)}},[t,n]);let O=e=>{e.stopPropagation();let r={x:e.clientX-i.x,y:e.clientY-i.y};t.showOverlayOnAllWindows(!0),ke(t.getCurrentDocument()??document,e,(e,o)=>{b.current&&=(t.moveWindowToFront(n.getLayoutId()),!1);let s=new x(e-r.x,o-r.y,i.width,i.height),c=C(s);a(c),t.doAction(E.moveFloat(n.getLayoutId(),c).setAdjusting(!0))},()=>{t.doAction(E.moveFloat(n.getLayoutId(),o.current).setAdjusting(!1)),t.redrawLayout(),t.showOverlayOnAllWindows(!1)},()=>{t.doAction(E.moveFloat(n.getLayoutId(),o.current).setAdjusting(!1)),t.redrawLayout(),t.showOverlayOnAllWindows(!1)})},k=t.getIcons(),A=t.isSupportsPopout()&&n.getRootRow()?.isAllowedInWindow()===!0,j=e=>{e.stopPropagation(),n.getRootRow()?.getChildren().length?t.getDragDropManager().startDockLayoutDrag(e.nativeEvent,n,c.current??void 0):e.preventDefault()},M=e=>{t.getDragDropManager().onDragEnded()},N=e=>{e.stopPropagation()},ee=e=>{e.stopPropagation();let r=t.getScreenRect(n.getRect());t.doAction(E.popoutFloat(n.getLayoutId(),r.toJson()))},P=(e,r)=>{let s=i,c={x:e.clientX,y:e.clientY};t.showOverlayOnAllWindows(!0),ke(t.getCurrentDocument()??document,e,(e,i)=>{let o=e-c.x,l=i-c.y,u=s.x,d=s.y,f=s.width,p=s.height;r.includes(`n`)&&(d+=l,p-=l),r.includes(`s`)&&(p+=l),r.includes(`w`)&&(u+=o,f-=o),r.includes(`e`)&&(f+=o);let m=new x(u,d,Math.max(Je,f),Math.max(Ye,p)),h=C(m);a(h),t.doAction(E.moveFloat(n.getLayoutId(),h).setAdjusting(!0))},()=>{t.doAction(E.moveFloat(n.getLayoutId(),o.current).setAdjusting(!1)),t.redrawLayout(),t.showOverlayOnAllWindows(!1)},()=>{t.doAction(E.moveFloat(n.getLayoutId(),o.current).setAdjusting(!1)),t.redrawLayout(),t.showOverlayOnAllWindows(!1)}),e.stopPropagation()};return(0,f.jsxs)(`div`,{ref:c,className:s(T.FLEXLAYOUT__FLOAT_WINDOW),style:{left:i.x,top:i.y,width:i.width,height:i.height,position:`absolute`},children:[(0,f.jsxs)(`div`,{ref:l,className:s(T.FLEXLAYOUT__FLOAT_WINDOW_HEADER),onPointerDown:O,children:[(0,f.jsx)(`div`,{"data-layout-path":`/floatwindow/drag-handle`,className:s(T.FLEXLAYOUT__FLOAT_WINDOW_DRAG_HANDLE),draggable:!0,title:t.i18nName(V.Dock_Float_To_Layout),"aria-label":t.i18nName(V.Dock_Float_To_Layout),onDragStart:j,onDragEnd:M,onPointerDown:N,children:k.dragToDock}),(0,f.jsx)(`div`,{style:{flexGrow:1,display:`flex`,justifyContent:`center`,alignItems:`center`,minWidth:0,overflow:`hidden`},children:n.getName()===void 0?(0,f.jsx)(`div`,{style:{width:50,height:8,display:`flex`,flexDirection:`column`,justifyContent:`space-around`,opacity:.5},children:(0,f.jsx)(`div`,{style:{height:2,backgroundColor:`gray`,borderRadius:1}})}):(0,f.jsx)(`span`,{"data-layout-path":`/floatwindow/title`,className:s(T.FLEXLAYOUT__FLOAT_WINDOW_HEADER_TITLE),title:n.getName(),children:n.getName()})}),A&&(0,f.jsx)(`button`,{type:`button`,"data-layout-path":`/floatwindow/button/popout`,className:s(T.FLEXLAYOUT__FLOAT_WINDOW_BUTTON),title:t.i18nName(V.Popout_Float_To_Window),"aria-label":t.i18nName(V.Popout_Float_To_Window),onClick:ee,onPointerDown:N,children:k.popoutFloatWindow})]}),(0,f.jsx)(`div`,{className:s(T.FLEXLAYOUT__FLOAT_WINDOW_CONTENT),children:r}),(0,f.jsx)(`div`,{ref:u,style:{position:`absolute`,zIndex:We,top:Ge,left:Ke,right:Ke,height:Ke,cursor:`ns-resize`},onPointerDown:e=>P(e,`n`)}),(0,f.jsx)(`div`,{ref:g,style:{position:`absolute`,zIndex:We,bottom:Ge,left:Ke,right:Ke,height:Ke,cursor:`ns-resize`},onPointerDown:e=>P(e,`s`)}),(0,f.jsx)(`div`,{ref:m,style:{position:`absolute`,zIndex:We,top:Ke,bottom:Ke,right:Ge,width:Ke,cursor:`ew-resize`},onPointerDown:e=>P(e,`e`)}),(0,f.jsx)(`div`,{ref:v,style:{position:`absolute`,zIndex:We,top:Ke,bottom:Ke,left:Ge,width:Ke,cursor:`ew-resize`},onPointerDown:e=>P(e,`w`)}),(0,f.jsx)(`div`,{ref:y,style:{position:`absolute`,zIndex:We,top:Ge,left:Ge,width:qe,height:qe,cursor:`nwse-resize`},onPointerDown:e=>P(e,`nw`)}),(0,f.jsx)(`div`,{ref:p,style:{position:`absolute`,zIndex:We,top:Ge,right:Ge,width:qe,height:qe,cursor:`nesw-resize`},onPointerDown:e=>P(e,`ne`)}),(0,f.jsx)(`div`,{ref:_,style:{position:`absolute`,zIndex:We,bottom:Ge,left:Ge,width:qe,height:qe,cursor:`nesw-resize`},onPointerDown:e=>P(e,`sw`)}),(0,f.jsx)(`div`,{ref:h,style:{position:`absolute`,zIndex:We,bottom:0,right:0,width:qe,height:qe,cursor:`nwse-resize`},onPointerDown:e=>P(e,`se`)})]})},Ze=({controller:e})=>{let t=[],n=e.getModel().getLayouts(),r=2e3;for(let[i,a]of n)a.isMainLayout()||(a.getType()===`window`&&e.isSupportsPopout()?t.push((0,f.jsx)(Ie,{controller:e,layout:a,title:e.getPopoutWindowName()+` `+i,url:e.getPopoutURL()+`?id=`+encodeURIComponent(i),onCloseLayout:e.onCloseLayout,children:(0,f.jsx)(`div`,{className:e.getProps().popoutClassName,children:(0,f.jsx)(Ht,{...e.getProps(),layoutId:i,path:a.getPath(),mainLayoutController:e})})},i)):a.getType()===`float`&&(t.push((0,f.jsx)(Xe,{controller:e,layout:a,zIndex:r,onCloseLayout:e.onCloseLayout,children:(0,f.jsx)(Ht,{...e.getProps(),layoutId:i,path:a.getPath(),mainLayoutController:e})},i+`float`)),r++));return(0,f.jsx)(f.Fragment,{children:t})};Ze.displayName=`FloatingWindowContainer`;var Qe=e=>{let{controller:t,tabNode:n,selected:r,border:i,icons:a,path:o}=e,s=d.useRef(null),c=d.useRef(null),l=t.getKeyMap(),u=e=>{n.isEnableDrag()?(e.stopPropagation(),t.getDragDropManager().setDragNode(e.nativeEvent,n)):e.preventDefault()},p=e=>{e.stopPropagation(),t.getDragDropManager().onDragEnded()},m=e=>{Te(e)&&t.auxMouseClick(n,e)},h=e=>{t.showContextMenu(n,e)},g=()=>{t.doAction(E.selectTab(n.getId()))},_=e=>{let t=s.current?.closest(`[role="tablist"]`);if(t){let n=Array.from(t.querySelectorAll(`[role="tab"]`));n[n.indexOf(s.current)+e]?.focus()}},v=()=>{let e=s.current.ownerDocument,t=()=>we(e.getElementById(ve(`flexlayout-tab-`,n.getId())));r?t():(g(),requestAnimationFrame(t))},y=e=>{t.getEditingTab()!==n&&(be(e,l.focusTabToggle)?(v(),e.preventDefault()):e.key===`Enter`||e.key===` `?(g(),e.preventDefault()):(e.key===`ArrowLeft`||e.key===`ArrowUp`)&&!xe(e)?(_(-1),e.preventDefault()):(e.key===`ArrowRight`||e.key===`ArrowDown`)&&!xe(e)?(_(1),e.preventDefault()):be(e,l.closeTab)&&n.isCloseable()&&(_(1),t.doAction(E.deleteTab(n.getId())),e.preventDefault()))},b=()=>{let e=n.getCloseType();return!!(r||e===A.Always||e===A.Visible&&t.getCurrentWindow()?.matchMedia(`(hover: hover) and (pointer: fine)`).matches)},x=e=>{b()&&(t.doAction(E.deleteTab(n.getId())),e.stopPropagation())},S=e=>{e.stopPropagation()},C=()=>{if(r)return!0;let e=n.getTabContainer();return e instanceof z&&e.getSelected()===-1&&e.getTabNodes()[0]===n},w=t.getEditingTab()===n,D=d.useCallback(e=>{s.current=e,t.registerMeasurable(n,`tabbutton`,e)},[t,n]);d.useLayoutEffect(()=>{w&&c.current.select()},[w]),d.useEffect(()=>{if(w){let e=t.getCurrentDocument().body,n=e=>{e.target!==c.current&&t.setEditingTab(void 0)};return e.addEventListener(`pointerdown`,n),()=>e.removeEventListener(`pointerdown`,n)}},[w,t]);let O=e=>{e.stopPropagation()},k=e=>{e.code===`Escape`?(t.setEditingTab(void 0),s.current?.focus()):(e.code===`Enter`||e.code===`NumpadEnter`)&&(t.setEditingTab(void 0),t.doAction(E.renameTab(n.getId(),e.target.value)),s.current?.focus())},j=t.getClassName,M=j(T.FLEXLAYOUT__BORDER_BUTTON)+` `+j(T.FLEXLAYOUT__BORDER_BUTTON_+i);M+=r?` `+j(T.FLEXLAYOUT__BORDER_BUTTON__SELECTED):` `+j(T.FLEXLAYOUT__BORDER_BUTTON__UNSELECTED);let N=n.getParent()instanceof R?n.getParent():void 0;N!==void 0&&(M+=` `+j(T.FLEXLAYOUT__TAB_BUTTON_GROUPED),n.getModel().getTabGroupType()===`underline`&&(M+=` `+j(T.FLEXLAYOUT__TAB_BUTTON_GROUPED_UNDERLINE))),n.getClassName()!==void 0&&(M+=` `+n.getClassName());let ee=0;n.getModel().isEnableRotateBorderIcons()===!1&&(i===`left`?ee=n.getModel().getBorderLeftTabDirection()===`down`?-90:90:i===`right`&&(ee=-90));let P=_e(t,n,ee),te=P.content?(0,f.jsx)(`div`,{className:j(T.FLEXLAYOUT__BORDER_BUTTON_CONTENT),children:P.content}):null,ne=P.leading?(0,f.jsx)(`div`,{className:j(T.FLEXLAYOUT__BORDER_BUTTON_LEADING),children:P.leading}):null;if(w&&(te=(0,f.jsx)(`input`,{ref:c,className:j(T.FLEXLAYOUT__TAB_BUTTON_TEXTBOX),"data-layout-path":o+`/textbox`,type:`text`,"aria-label":t.i18nName(V.Rename_Tab),autoFocus:!0,defaultValue:n.getName(),onKeyDown:k,onPointerDown:O})),n.isCloseable()){let e=t.i18nName(V.Close_Tab);P.buttons.push((0,f.jsx)(`div`,{"data-layout-path":o+`/button/close`,title:e,"aria-hidden":`true`,className:j(T.FLEXLAYOUT__BORDER_BUTTON_TRAILING),onPointerDown:S,onClick:x,children:typeof a.close==`function`?a.close(n):a.close},`close`))}let re=[Ce(l.focusTabToggle),n.isCloseable()?Ce(l.closeTab):void 0].filter(Boolean).join(` `)||void 0,ie={};return N!==void 0&&(ie[`--flexlayout-group-color`]=N.getColor()),(0,f.jsxs)(`div`,{ref:D,id:ve(`flexlayout-tabbutton-`,n.getId()),role:w?void 0:`tab`,"aria-selected":w?void 0:r,"aria-controls":w?void 0:ve(`flexlayout-tab-`,n.getId()),"aria-label":w?void 0:P.name,"aria-keyshortcuts":w?void 0:re,tabIndex:w?-1:C()?0:-1,onKeyDown:y,"data-layout-path":o,className:M,style:ie,onClick:g,onAuxClick:m,onContextMenu:h,title:n.getHelpText(),draggable:!0,onDragStart:u,onDragEnd:p,children:[ne,te,P.buttons]})};Qe.displayName=`BorderButton`;var $e=e=>{let{controller:t,groupNode:n,path:r}=e,i=d.useRef(null),a=d.useCallback(e=>{i.current=e,t.registerMeasurable(n,`grouppill`,e)},[t,n]),o=e=>{n.isEnableDrag()?(e.stopPropagation(),t.getDragDropManager().setDragNode(e.nativeEvent,n)):e.preventDefault()},s=e=>{t.getDragDropManager().onDragEnded()},c=e=>{t.showContextMenu(n,e)},l=()=>{t.doAction(E.updateNodeAttributes(n.getId(),{opened:!n.isOpened()}))},u=e=>{l(),e.stopPropagation()},p=e=>{if(e.key===`Enter`||e.key===` `)l(),e.preventDefault();else if(e.key===`ContextMenu`||e.shiftKey&&e.key===`F10`){let t=i.current.getBoundingClientRect();i.current.dispatchEvent(new MouseEvent(`contextmenu`,{bubbles:!0,cancelable:!0,clientX:t.x+t.width/2,clientY:t.y+t.height/2})),e.preventDefault()}},m=t.getClassName,h=m(T.FLEXLAYOUT__GROUP_PILL);n.isOpened()?t.getModel().getTabGroupType()===`underline`&&(h+=` `+m(T.FLEXLAYOUT__GROUP_PILL_UNDERLINE)):h+=` `+m(T.FLEXLAYOUT__GROUP_PILL_COLLAPSED);let g=n.getColor(),_={backgroundColor:g,borderColor:g},v=t.i18nName(V.Group_Pill_Tooltip);return(0,f.jsxs)(`div`,{ref:a,"data-layout-path":r,role:`button`,"aria-label":n.getName(),"aria-expanded":n.isOpened(),tabIndex:0,title:v,className:h,style:_,draggable:!0,onDragStart:o,onDragEnd:s,onClick:u,onKeyDown:p,onContextMenu:c,children:[(0,f.jsx)(`span`,{className:m(T.FLEXLAYOUT__GROUP_PILL_NAME),children:n.getName()}),!n.isOpened()&&(0,f.jsx)(`span`,{"aria-hidden":`true`,className:m(T.FLEXLAYOUT__GROUP_PILL_COUNT),children:n.getChildren().length})]})};$e.displayName=`GroupPill`;var et=e=>{let{controller:t,groupNode:n,path:r}=e,i=d.useRef(null),a=d.useCallback(e=>{i.current=e,t.registerMeasurable(n,`groupendmarker`,e)},[t,n]),o=e=>{t.doAction(E.updateNodeAttributes(n.getId(),{opened:!n.isOpened()})),e.stopPropagation()},s=n.getColor(),c={backgroundColor:s,borderColor:s};return(0,f.jsx)(`div`,{ref:a,"data-layout-path":r,title:n.getName(),"aria-hidden":!0,className:t.getClassName(T.FLEXLAYOUT__GROUP_END_MARKER),style:c,onClick:o})};et.displayName=`GroupEndMarker`;var tt=e=>{let{controller:t,tabNode:n}=e,r=t.getClassName,i=r(T.FLEXLAYOUT__TAB_BUTTON_STAMP),a=_e(t,n),o=a.content?(0,f.jsx)(`div`,{className:r(T.FLEXLAYOUT__TAB_BUTTON_CONTENT),children:a.content}):n.getNameForOverflowMenu(),s=a.leading?(0,f.jsx)(`div`,{className:r(T.FLEXLAYOUT__TAB_BUTTON_LEADING),children:a.leading}):null;return(0,f.jsxs)(`div`,{className:i,title:n.getHelpText(),children:[s,o]})};tt.displayName=`TabButtonStamp`;var nt=500;function rt(e){return typeof e.getBoundingClientRect==`function`}function it(e){return e.container?e.container:rt(e.anchor)?e.anchor.ownerDocument.body:document.body}function at(e){if(rt(e))return e.getBoundingClientRect();if(`right`in e&&`bottom`in e)return e;let t=e;return new DOMRect(t.x,t.y,0,0)}function ot(e,t){let n=t,{left:r,right:i,top:a,bottom:o}=e,s={};return(r+i)/2<n.left+n.width/2?s.left=r-n.left:s.right=n.right-i,(a+o)/2<n.top+n.height/2?s.top=a-n.top:s.bottom=n.bottom-o,s}var st=e=>{let{anchor:t,items:n,onSelect:r,onClose:i,renderItem:a,title:o}=e,s=e.classNameMapper??(e=>e),c=it(e),l=d.useRef(null),u=d.useRef(null),m=d.useRef({buffer:``,timer:void 0});d.useEffect(()=>()=>{m.current.timer&&clearTimeout(m.current.timer)},[]);let h=d.useCallback(e=>{e.disabled||((e.onSelect??r)?.(e),i())},[r,i]);d.useEffect(()=>{let n=c.ownerDocument;u.current?.contains(n.activeElement)||(u.current?.querySelector(`[role="menuitem"]:not([aria-disabled="true"])`)??u.current)?.focus();let r=e.returnFocusTo??(rt(t)?t:void 0);return()=>{r?.focus?.()}},[]),d.useEffect(()=>{let e=c.ownerDocument,t=e=>{l.current?.contains(e.target)||i()};return e.addEventListener(`pointerdown`,t),()=>e.removeEventListener(`pointerdown`,t)},[c,i]);let g=e=>{let t=Array.from(u.current?.querySelectorAll(`[role="menuitem"]:not([aria-disabled="true"])`)??[]),n=e.target.closest?.(`[role="menuitem"]`),r=n?t.indexOf(n):-1;if(e.key===`Escape`||e.key===`Tab`)i(),e.preventDefault();else if(e.key===`ArrowDown`||e.key===`ArrowUp`)t.length>0&&t[(r+(e.key===`ArrowDown`?1:-1)+t.length)%t.length]?.focus(),e.preventDefault();else if(e.key===`Home`||e.key===`End`)(e.key===`Home`?t[0]:t[t.length-1])?.focus(),e.preventDefault();else if(e.key.length===1&&e.key!==` `&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let n=m.current;n.timer&&clearTimeout(n.timer),n.buffer+=e.key.toLowerCase(),n.timer=setTimeout(()=>{n.buffer=``},nt);let i=[...n.buffer].every(e=>e===n.buffer[0]),a=i?n.buffer[0]:n.buffer,o=i?r+1:Math.max(r,0);for(let e=0;e<t.length;e++){let n=(o+e)%t.length;if((t[n].textContent??``).trim().toLowerCase().startsWith(a)){t[n].focus();break}}e.preventDefault()}else(e.key===`Enter`||e.key===` `)&&n&&(n.click(),e.preventDefault())},_=e=>({select:()=>h(e),close:i}),v=e=>(0,f.jsx)(`div`,{className:s(T.FLEXLAYOUT__POPUP_MENU_ITEM)+(e.disabled?` `+s(T.FLEXLAYOUT__POPUP_MENU_ITEM__DISABLED):``),role:`menuitem`,tabIndex:-1,"aria-disabled":e.disabled||void 0,onClick:t=>{h(e),t.stopPropagation()},children:e.content??(0,f.jsxs)(f.Fragment,{children:[e.icon,e.label]})},e.key),y=(0,f.jsx)(`div`,{ref:l,className:s(T.FLEXLAYOUT__POPUP_MENU_CONTAINER),style:ot(at(t),c.getBoundingClientRect()),children:(0,f.jsx)(`div`,{ref:u,className:s(T.FLEXLAYOUT__POPUP_MENU),role:`menu`,"aria-label":o,tabIndex:0,onKeyDown:g,"data-layout-path":`/popup-menu`,children:n.map((e,t)=>e.type===`divider`?(0,f.jsx)(`div`,{className:s(T.FLEXLAYOUT__POPUP_MENU_DIVIDER),role:`separator`},e.key):a?a(e,t,_(e)):v(e))})});return(0,p.createPortal)(y,c)};function ct(e){let t=it(e),n=rt(e.anchor)?e.anchor.getBoundingClientRect():e.anchor,r=t.ownerDocument.createElement(`div`);t.appendChild(r);let i=(0,m.createRoot)(r),a=!1,o=()=>{a||(a=!0,i.unmount(),r.remove(),e.onClose())};return i.render((0,f.jsx)(st,{...e,anchor:n,container:t,onClose:o})),o}function lt(e,t,n,r,i,a){let o=i.getClassName,s=n.map(e=>({key:e.node.getId()}));return i.showOverlayOnAllWindows(!0),ct({anchor:e,container:i.getRootDiv()??void 0,classNameMapper:o,returnFocusTo:e,title:i.i18nName(V.Overflow_Menu_Tooltip),items:s,onSelect:e=>{let t=s.indexOf(e);t>=0&&r(n[t])},renderItem:(e,r,a)=>{let s=n[r],c=s.node.getParent()instanceof R?s.node.getParent():void 0,l=c!==void 0,u=o(T.FLEXLAYOUT__POPUP_MENU_ITEM);l&&(u+=` `+o(T.FLEXLAYOUT__POPUP_MENU_ITEM_GROUPED)),t.getSelected()===s.index&&(u+=` `+o(T.FLEXLAYOUT__POPUP_MENU_ITEM__SELECTED));let d={};return l&&(d[`--flexlayout-group-color`]=c.getColor()),(0,f.jsx)(`div`,{className:u,role:`menuitem`,"aria-label":s.node.getNameForOverflowMenu(),tabIndex:-1,"data-layout-path":`/popup-menu/tb`+r,style:d,onClick:e=>{a.select(),e.stopPropagation()},draggable:!0,onDragStart:e=>{e.stopPropagation(),i.getDragDropManager().setDragNode(e.nativeEvent,s.node)},onDragEnd:()=>{i.getDragDropManager().onDragEnded(),a.close()},title:s.node.getHelpText(),children:(0,f.jsx)(tt,{tabNode:s.node,controller:i})},e.key)},onClose:()=>{i.showOverlayOnAllWindows(!1),a?.()}})}st.displayName=`PopupMenu`;var ut=(e,t,n,r,i,a,o,s)=>{let[c,l]=d.useState([]),[u,f]=d.useState(!1),[p,m]=d.useState(!1),h=d.useRef(!1),g=d.useRef(void 0),_=d.useRef([]),v=d.useRef(0),y=d.useRef(!1),b=d.useRef(0);d.useEffect(()=>()=>{g.current!==void 0&&clearTimeout(g.current)},[]),d.useLayoutEffect(()=>{_.current=c});let x=d.useCallback(e=>{n===S.HORZ?r.current.scrollLeft=e:r.current.scrollTop=e},[n,r]),C=d.useCallback(e=>n===S.HORZ?e.scrollLeft:e.scrollTop,[n]),w=d.useCallback(e=>n===S.HORZ?e.clientWidth:e.clientHeight,[n]),T=d.useCallback(e=>n===S.HORZ?e.scrollWidth:e.scrollHeight,[n]),E=d.useCallback(e=>n===S.HORZ?e.width:e.height,[n]),D=d.useCallback(e=>n===S.HORZ?e.x:e.y,[n]),O=d.useCallback(e=>n===S.HORZ?e.right:e.bottom,[n]),k=d.useCallback(()=>{let e=[];if(r.current){let t=r.current,n=t.getBoundingClientRect(),i=D(n)-1,a=O(n)+1,s=t.firstElementChild,c=0;Array.from(s.children).forEach(t=>{let n=t.getBoundingClientRect();t.classList.contains(o)&&((D(n)<i||O(n)>a)&&e.push(c),c++)})}return e},[o,r,D,O]),A=d.useCallback(()=>{if(r.current&&i.current){let e=r.current,t=i.current,a=w(e),o=T(e),s=C(e);if(o>a&&o>0){let e=a*a/o,r=0;e<20&&(r=20-e,e=20);let i=s*(a-r)/o;n===S.HORZ?(t.style.width=e+`px`,t.style.left=i+`px`):(t.style.height=e+`px`,t.style.top=i+`px`),t.style.display=`block`}else t.style.display=`none`;n===S.HORZ?t.style.bottom=`0px`:t.style.right=`0px`}},[n,r,i,w,T,C]),j=d.useCallback((e=!1)=>{let t=k(),n=t.length>0;n!==u&&f(n),e?l(t):g.current===void 0&&(g.current=setTimeout(()=>{let e=k();dt(e,_.current)||l(e),g.current=void 0},100))},[k,u]),M=d.useCallback(()=>{let n=t.getSelectedNode();if(n&&r.current){let t=e.getBoundingClientRect(r.current),i=r.current.ownerDocument.getElementById(ve(`flexlayout-tabbutton-`,n.getId()));if(!i)return;let a=e.getBoundingClientRect(i),o=D(t)-D(a);o>0||E(a)>E(t)?(x(C(r.current)-o),y.current=!0):(o=O(a)-O(t),o>0&&(x(C(r.current)+o),y.current=!0))}},[t,e,r,D,O,E,C,x]),N=d.useCallback(()=>{if(r.current){let e=r.current,t=0;for(let n of Array.from(e.children))t+=w(n);if(s?.current){let e=w(s.current);e>0&&(b.current=e)}let n=b.current,i=t+(p?n:0)>w(r.current);i!==p&&m(i)}},[r,s,p,w]),ee=d.useCallback(()=>{y.current||(h.current=!0),y.current=!1,A(),j()},[A,j]),P=d.useCallback((e,t)=>{if(r.current&&i.current){let a=r.current,o=i.current,s=w(a),c=T(a),l=w(o),u=a.getBoundingClientRect(),d;if(d=n===S.HORZ?e-u.x-v.current:t-u.y-v.current,d=Math.max(0,Math.min(c-l,d)),s>0){let e=d*c/s;x(e)}}},[r,i,n,w,T,x]),te=d.useCallback(()=>{},[]),ne=d.useCallback(()=>{},[]),re=d.useCallback(e=>{e.stopPropagation(),i.current.setPointerCapture(e.pointerId);let t=i.current.getBoundingClientRect();n===S.HORZ?v.current=e.clientX-t.x:v.current=e.clientY-t.y,ke(e.currentTarget.ownerDocument,e,P,te,ne)},[i,n,P,te,ne]),ie=d.useCallback(e=>{if(!r.current||t.getChildren().length===0)return;let i=Math.abs(e.deltaX),a=Math.abs(e.deltaY);if(i===0&&a===0)return;let o;o=n===S.HORZ?i>a?e.deltaX:e.deltaY:a>i?e.deltaY:e.deltaX,e.deltaMode===1&&(o*=40);let s=T(r.current)-w(r.current);if(s<=0)return;let c=C(r.current)+o;x(Math.max(0,Math.min(s,c))),e.stopPropagation()},[t,r,n,C,T,w,x]),ae=d.useCallback(e=>{let t=r.current;t&&(T(t)-w(t)<=0||e.preventDefault())},[r,T,w]),oe=t.getId(),se=t.getSelectedNode();return d.useLayoutEffect(()=>{r.current&&x(0)},[oe,r,x]),d.useLayoutEffect(()=>{h.current=!1},[se]),d.useLayoutEffect(()=>{N(),h.current===!1&&M(),A(),j(!0);let e=requestAnimationFrame(()=>{j()});return()=>cancelAnimationFrame(e)},[N,M,A,j,n,se]),d.useLayoutEffect(()=>{let t=r.current;if(!t)return;let n=t.ownerDocument.defaultView,i=new n.ResizeObserver(()=>{N();let t=e.isSplitterDragging();(!h.current||t)&&(t&&(h.current=!1),M()),A(),j()});i.observe(t);let a=t.firstElementChild,o=new n.MutationObserver(()=>{j()});return a&&o.observe(a,{childList:!0,subtree:!0}),()=>{i.disconnect(),o.disconnect()}},[N,M,A,j,r,e]),d.useLayoutEffect(()=>{let e=s?.current;if(!e)return;let t=new e.ownerDocument.defaultView.ResizeObserver(()=>{N()});return t.observe(e),()=>t.disconnect()},[N,s,p]),d.useEffect(()=>{if(t instanceof F&&t.isEnableTabWrap())return;let e=a.current;return e?.addEventListener(`wheel`,ae,{passive:!1}),()=>{e?.removeEventListener(`wheel`,ae)}}),{userControlledPositionRef:h,onScroll:ee,onScrollPointerDown:re,hiddenTabs:c,onMouseWheel:ie,isDockStickyButtons:p,isShowHiddenTabs:u}};function dt(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}var ft=e=>{let{borderNode:t,controller:n,size:r}=e,i=d.useRef(null),a=d.useRef(null),o=d.useRef(null),s=d.useRef(null),c=d.useRef(null),l=d.useRef(null),[u,p]=d.useState(!1),m=d.useRef(null),h=n.getIcons();d.useEffect(()=>()=>m.current?.(),[]);let{userControlledPositionRef:g,onScroll:_,onScrollPointerDown:v,hiddenTabs:y,onMouseWheel:b,isDockStickyButtons:x,isShowHiddenTabs:w}=ut(n,t,S.flip(t.getOrientation()),l,o,i,n.getClassName(T.FLEXLAYOUT__BORDER_BUTTON),c),D=d.useCallback(e=>{i.current=e,n.registerMeasurable(t,`borderheader`,e)},[n,t]),O=e=>{Te(e)&&n.auxMouseClick(t,e)},k=e=>{n.showContextMenu(t,e)},A=e=>{e.stopPropagation()},j=e=>{let r=n.getShowOverflowMenu(),i=t.getTabNodes(),a=y.map(e=>({index:e,node:i[e]}));if(r!==void 0)r(t,e,a,M);else{let e=s.current;p(!0),m.current=lt(e,t,a,M,n,()=>{p(!1),m.current=null})}e.stopPropagation()},M=e=>{n.doAction(E.selectTab(e.node.getId())),g.current=!1},N=e=>{let r=t.getSelectedNode();r!==void 0&&n.doAction(E.popoutTab(r.getId(),`window`)),e.stopPropagation()},ee=e=>{let r=t.getSelectedNode();r!==void 0&&n.doAction(E.popoutTab(r.getId(),`float`)),e.stopPropagation()},P=n.getClassName,te=()=>{let e=[],r=n.getModel().getTabGroupType()===`splitpill`,i=0,a=!1,o=0,s=()=>(0,f.jsx)(`div`,{className:P(T.FLEXLAYOUT__BORDER_TAB_DIVIDER)},`divider`+o++),c=t.getLocation()===C.LEFT&&n.getModel().getBorderLeftTabDirection()!==`down`;for(let o of t.getChildren()){if(o instanceof R){let l=o.getChildren();if(c&&o.isOpened()){a&&e.push(s()),r&&e.push((0,f.jsx)(et,{controller:n,groupNode:o,path:o.getPath()+`/end`},o.getId()+`/end`));let c=i;for(let r=l.length-1;r>=0;r--){let i=t.getSelected()===c+r;r<l.length-1&&e.push(s()),e.push((0,f.jsx)(Qe,{controller:n,border:t.getLocation().getName(),tabNode:l[r],path:ye(l[r]),selected:i,icons:h},l[r].getId()))}i+=l.length,e.push((0,f.jsx)($e,{controller:n,groupNode:o,path:o.getPath()},o.getId())),a=!0}else if(a&&e.push(s()),e.push((0,f.jsx)($e,{controller:n,groupNode:o,path:o.getPath()},o.getId())),a=!0,o.isOpened()){for(let r=0;r<l.length;r++){let a=t.getSelected()===i;r>0&&e.push(s()),e.push((0,f.jsx)(Qe,{controller:n,border:t.getLocation().getName(),tabNode:l[r],path:ye(l[r]),selected:a,icons:h},l[r].getId())),i++}r&&e.push((0,f.jsx)(et,{controller:n,groupNode:o,path:o.getPath()+`/end`},o.getId()+`/end`))}continue}let l=o,u=t.getSelected()===i;a&&e.push(s()),e.push((0,f.jsx)(Qe,{controller:n,border:t.getLocation().getName(),tabNode:l,path:ye(l),selected:u,icons:h},l.getId())),a=!0,i++}return e},ne=()=>{let e,r=[],i=[],o,l={leading:e,buttons:r,stickyButtons:i,overflowPosition:void 0};if(n.customizeTabSet(t,l),e=l.leading,i=l.stickyButtons,r=l.buttons,l.overflowPosition===void 0&&(l.overflowPosition=i.length),i.length>0&&(x?r=[...i,...r]:o=(0,f.jsx)(`div`,{ref:c,onPointerDown:A,onDragStart:e=>{e.preventDefault()},className:P(T.FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER),children:i},`sticky_buttons_container`)),w){let e=n.i18nName(V.Overflow_Menu_Tooltip),i;if(typeof h.more==`function`){let e=t.getTabNodes(),n=y.map(t=>({index:t,node:e[t]}));i=h.more(t,n)}else i=(0,f.jsxs)(f.Fragment,{children:[h.more,(0,f.jsx)(`div`,{className:P(T.FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT),children:y.length>0?y.length:``})]});r.splice(Math.min(l.overflowPosition,r.length),0,(0,f.jsx)(`button`,{tabIndex:0,"aria-haspopup":`menu`,"aria-expanded":u,"aria-label":e,ref:s,className:P(T.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON)+` `+P(T.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW)+` `+P(T.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW_+t.getLocation().getName()),title:e,onClick:j,onPointerDown:A,children:i},`overflowbutton`))}if(t.getSelected()!==-1){let e=t.getSelectedNode();if(e!==void 0&&n.isMainLayout()){if(e.isEnableFloat()&&e.isEnableFloatIcon()){let t=n.i18nName(V.Popout_Tab_Float);r.push((0,f.jsx)(`button`,{tabIndex:0,title:t,"aria-label":t,className:P(T.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON)+` `+P(T.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_FLOAT),onClick:ee,onPointerDown:A,children:typeof h.popoutFloat==`function`?h.popoutFloat(e):h.popoutFloat},`popout-float`))}if(n.isSupportsPopout()&&e.isEnablePopoutIcon()&&e.isAllowedInWindow()){let t=n.i18nName(V.Popout_Tab);r.push((0,f.jsx)(`button`,{tabIndex:0,title:t,"aria-label":t,className:P(T.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON)+` `+P(T.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_FLOAT),onClick:N,onPointerDown:A,children:typeof h.popout==`function`?h.popout(e):h.popout},`popout`))}}}let d=(0,f.jsx)(`div`,{ref:a,className:P(T.FLEXLAYOUT__BORDER_TOOLBAR)+` `+P(T.FLEXLAYOUT__BORDER_TOOLBAR_+t.getLocation().getName()),children:r},`toolbar`);return{leading:e,toolbar:d,stickyBar:o}},re=te(),{leading:ie,toolbar:ae,stickyBar:oe}=ne(),se=P(T.FLEXLAYOUT__BORDER)+` `+P(T.FLEXLAYOUT__BORDER_+t.getLocation().getName());t.getClassName()!==void 0&&(se+=` `+t.getClassName());let ce,le,F=r-1;t.getLocation()===C.LEFT?(ce=n.getModel().getBorderLeftTabDirection()===`down`?{left:`100%`,top:0}:{right:`100%`,top:0},le={width:F,overflowY:`auto`}):t.getLocation()===C.RIGHT?(ce={left:`100%`,top:0},le={width:F,overflowY:`auto`}):(ce={left:0},le={height:F,overflowX:`auto`});let I;t.isEnableTabScrollbar()&&(I=(0,f.jsx)(`div`,{ref:o,"aria-hidden":`true`,className:P(T.FLEXLAYOUT__MINI_SCROLLBAR),onPointerDown:v}));let ue;ie&&(ue=(0,f.jsx)(`div`,{className:P(T.FLEXLAYOUT__BORDER_LEADING),children:ie}));let de=P(T.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER)+` `+P(T.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER_+t.getLocation().getName())+(t.getLocation()===C.LEFT&&n.getModel().getBorderLeftTabDirection()===`down`?` `+P(T.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER_LEFT_DOWN):``);return(0,f.jsxs)(`div`,{ref:D,style:{display:`flex`,flexDirection:t.getOrientation()===S.VERT?`row`:`column`},className:se,"data-layout-path":t.getPath(),onClick:O,onAuxClick:O,onContextMenu:k,onWheel:b,children:[ue,(0,f.jsxs)(`div`,{className:P(T.FLEXLAYOUT__MINI_SCROLLBAR_CONTAINER),children:[(0,f.jsxs)(`div`,{ref:l,className:P(T.FLEXLAYOUT__BORDER_INNER)+` `+P(T.FLEXLAYOUT__BORDER_INNER_+t.getLocation().getName()),style:le,onScroll:_,children:[(0,f.jsx)(`div`,{style:ce,role:n.getEditingTab()?.getParent()===t?void 0:`tablist`,"aria-orientation":n.getEditingTab()?.getParent()!==t&&(t.getLocation()===C.LEFT||t.getLocation()===C.RIGHT)?`vertical`:void 0,className:de,children:re}),oe]}),I]}),ae]})};ft.displayName=`BorderTabSet`;var pt=e=>{let{controller:t,node:n,index:r,horizontal:i}=e,a=d.useRef(null),o=d.useRef([]),s=d.useRef(void 0),c=d.useRef(void 0),l=d.useRef(0),u=d.useRef(0),p=d.useRef({initialSizes:[],sum:0,startPosition:0}),m=d.useRef(void 0),h=d.useCallback(e=>{e.preventDefault(),e.stopImmediatePropagation()},[]);d.useEffect(()=>{let e=a.current;return e?.addEventListener(`touchstart`,h,{passive:!1}),()=>{e?.removeEventListener(`touchstart`,h),m.current!==void 0&&(clearTimeout(m.current),m.current=void 0),s.current&&(t.getRootDiv()?.removeChild(s.current),s.current=void 0,Ee(!0,t.getCurrentDocument()),t.setSplitterDragging(!1))}},[h,t]);let g=e=>{e.stopPropagation(),n instanceof I&&(p.current=n.getSplitterInitials(r)),t.setSplitterDragging(!0),Ee(!1,t.getCurrentDocument()),ke(e.currentTarget.ownerDocument,e,y,b,v),o.current=n instanceof z?n.getSplitterBounds(!0):n.getSplitterBounds(r);let d=t.getRootDiv();s.current=t.getCurrentDocument().createElement(`div`),s.current.style.flexDirection=i?`row`:`column`,s.current.className=t.getClassName(T.FLEXLAYOUT__SPLITTER_DRAG)+(n instanceof z?` `+t.getClassName(T.FLEXLAYOUT__SPLITTER_BORDER):``),s.current.style.cursor=n.getOrientation()===S.VERT?`ns-resize`:`ew-resize`,c.current=t.getCurrentDocument().createElement(`div`),c.current.className=O(T.FLEXLAYOUT__SPLITTER_HANDLE)+` `+O(i?T.FLEXLAYOUT__SPLITTER_HANDLE_HORZ:T.FLEXLAYOUT__SPLITTER_HANDLE_VERT),s.current.appendChild(c.current);let f=a.current.getBoundingClientRect(),m=new x(f.x-t.getDomRect().x,f.y-t.getDomRect().y,f.width,f.height);l.current=e.clientX-f.x,u.current=e.clientY-f.y,m.positionElement(s.current),d&&d.appendChild(s.current)},_=e=>{if(xe(e))return;let a=0;if(i?(e.key===`ArrowLeft`&&(a=-10),e.key===`ArrowRight`&&(a=10)):(e.key===`ArrowUp`&&(a=-10),e.key===`ArrowDown`&&(a=10)),a!==0){if(e.preventDefault(),t.setSplitterDragging(!0),n instanceof z){let e=n.getLocation(),r=e===C.BOTTOM||e===C.RIGHT?-a:a,i=Math.max(n.getMinSize(),Math.min(n.getMaxSize(),n.getSize()+r));t.doAction(E.adjustBorderSplit(n.getId(),i))}else{let e=n.getSplitterInitials(r);if(e.sum<=0){t.setSplitterDragging(!1);return}let i=n.getSplitterBounds(r),o=Math.max(i[0],Math.min(i[1],e.startPosition+a)),s=n.calculateSplit(r,o,e.initialSizes,e.sum,e.startPosition);t.doAction(E.adjustWeights(n.getId(),s))}setTimeout(()=>t.setSplitterDragging(!1),300)}},v=()=>{if(s.current){t.isRealtimeResize()&&w(!1);let e=t.getRootDiv();e&&s.current&&e.removeChild(s.current),s.current=void 0}m.current=window.setTimeout(()=>t.setSplitterDragging(!1),300),Ee(!0,t.getCurrentDocument())},y=(e,r)=>{if(s.current){let i=t.getDomRect();if(!i)return;n.getOrientation()===S.VERT?s.current.style.top=D(r-i.y-u.current)+`px`:s.current.style.left=D(e-i.x-l.current)+`px`,t.isRealtimeResize()&&w(!0)}},b=()=>{if(s.current){w(!1);let e=t.getRootDiv();e&&s.current&&e.removeChild(s.current),s.current=void 0}m.current=window.setTimeout(()=>t.setSplitterDragging(!1),300),Ee(!0,t.getCurrentDocument())},w=e=>{(()=>{if(s.current){let i;if(i=n.getOrientation()===S.VERT?s.current.offsetTop:s.current.offsetLeft,n instanceof z){let r=n.calculateSplit(n,i);t.doAction(E.adjustBorderSplit(n.getId(),r).setAdjusting(e))}else{let a=p.current;if(a.sum<=0)return;let o=n.calculateSplit(r,i,a.initialSizes,a.sum,a.startPosition);t.doAction(E.adjustWeights(n.getId(),o).setAdjusting(e))}}})()},D=e=>{let t=o.current,n=e;return e<t[0]&&(n=t[0]),e>t[1]&&(n=t[1]),n},O=t.getClassName,k={cursor:i?`ew-resize`:`ns-resize`,flexDirection:i?`column`:`row`},A=O(T.FLEXLAYOUT__SPLITTER)+` `+O(T.FLEXLAYOUT__SPLITTER_+n.getOrientation().getName());n instanceof z?A+=` `+O(T.FLEXLAYOUT__SPLITTER_BORDER):n.getModel().getMaximizedTabset(t.getLayoutId())!==void 0&&(k.display=`none`),ge()||(k[`--fl-splitter-active-size`]=`30px`);let j,M,N,ee;if(n instanceof I){let e=n.getRect(),t=n.getChildren()[r-1],a=i?e.width:e.height;if(t&&a>0){let n=t.getRect();j=Math.round((i?n.getRight()-e.x:n.getBottom()-e.y)/a*100),M=0,N=100,ee=j+`%`}}else j=Math.round(n.getSize()),M=Math.round(n.getMinSize()),N=Math.round(n.getMaxSize()),ee=j+`px`;return(0,f.jsx)(`div`,{className:A,style:k,ref:a,role:`separator`,"aria-label":t.i18nName(V.Splitter),"aria-orientation":i?`vertical`:`horizontal`,"aria-valuenow":j,"aria-valuemin":M,"aria-valuemax":N,"aria-valuetext":ee,tabIndex:0,onKeyDown:_,"data-layout-path":n.getPath()+`/s`+(r-1),onPointerDown:g,children:(0,f.jsx)(`div`,{className:O(T.FLEXLAYOUT__SPLITTER_HANDLE)+` `+O(i?T.FLEXLAYOUT__SPLITTER_HANDLE_HORZ:T.FLEXLAYOUT__SPLITTER_HANDLE_VERT)})})};pt.displayName=`Splitter`;function mt(e){let{controller:t,borderNode:n,show:r}=e,i=d.useRef(null),a=d.useCallback(e=>{i.current=e,t.registerMeasurable(n,`bordercontent`,e)},[t,n]),o=!0,s={};n.getOrientation()===S.HORZ?(s.width=n.getSize(),s.minWidth=n.getMinSize(),s.maxWidth=n.getMaxSize()):(s.height=n.getSize(),s.minHeight=n.getMinSize(),s.maxHeight=n.getMaxSize(),o=!1);let c=t.getClassName(T.FLEXLAYOUT__BORDER_TAB_CONTENTS),l=n.getLocation()===C.LEFT||n.getLocation()===C.TOP;if(n.isOverlay()){s.display=`flex`;let e={display:r?`flex`:`none`};if(o){let r=t.getModel();for(let t of r.getBorderSet().getBorders())if(t!==n&&t.isOverlay()&&t.isShowing()&&t.getSelected()!==-1){let n=t.getSize()+r.getSplitterSize();t.getLocation()===C.TOP?e.top=n:t.getLocation()===C.BOTTOM&&(e.bottom=n)}}let i=t.getClassName(T.FLEXLAYOUT__BORDER_TAB_OVERLAY)+` `+t.getClassName(T.FLEXLAYOUT__BORDER_TAB_OVERLAY_+n.getLocation().getName());return(0,f.jsxs)(`div`,{className:i,style:e,children:[l&&(0,f.jsx)(`div`,{ref:a,style:s,className:c}),r&&(0,f.jsx)(pt,{controller:t,node:n,index:0,horizontal:o}),!l&&(0,f.jsx)(`div`,{ref:a,style:s,className:c})]})}return s.display=r?`flex`:`none`,l?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`div`,{ref:a,style:s,className:c}),r&&(0,f.jsx)(pt,{controller:t,node:n,index:0,horizontal:o})]}):(0,f.jsxs)(f.Fragment,{children:[r&&(0,f.jsx)(pt,{controller:t,node:n,index:0,horizontal:o}),(0,f.jsx)(`div`,{ref:a,style:s,className:c})]})}mt.displayName=`BorderTab`;var ht=({controller:e,inner:t})=>{let n=e.getClassName(T.FLEXLAYOUT__LAYOUT_MAIN),r=e.getModel().getBorderSet().getBorderMap();if(e.isMainLayout()&&r.size>0){let i=(0,f.jsx)(`div`,{className:n,ref:e.getMainRef(),children:t}),a=new Map,o=new Map;for(let[t,n]of C.values){let t=r.get(n);t&&t.isShowing()&&(!t.isAutoHide()||t.isAutoHide()&&(t.getChildren().length>0||e.getState().showHiddenBorder===n))&&(a.set(n,(0,f.jsx)(ft,{controller:e,borderNode:t,size:e.getState().calculatedBorderBarSize})),o.set(n,(0,f.jsx)(mt,{controller:e,borderNode:t,show:t.getSelected()!==-1})))}let s=e.getClassName(T.FLEXLAYOUT__LAYOUT_BORDER_CONTAINER),c=e.getClassName(T.FLEXLAYOUT__LAYOUT_BORDER_CONTAINER_INNER),l=(0,f.jsxs)(`div`,{className:c,style:{flexDirection:`column`},children:[o.get(C.TOP),(0,f.jsxs)(`div`,{className:c,style:{flexDirection:`row`},children:[o.get(C.LEFT),i,o.get(C.RIGHT)]}),o.get(C.BOTTOM)]});return(0,f.jsxs)(`div`,{className:s,style:{flexDirection:`column`},children:[a.get(C.TOP),(0,f.jsxs)(`div`,{className:c,style:{flexDirection:`row`},children:[a.get(C.LEFT),l,a.get(C.RIGHT)]}),a.get(C.BOTTOM)]})}return(0,f.jsx)(`div`,{className:n,ref:e.getMainRef(),style:{position:`absolute`,top:0,left:0,bottom:0,right:0,display:`flex`},children:t})};ht.displayName=`BorderContainer`;var gt={width:`1em`,height:`1em`,display:`flex`,alignItems:`center`},_t=()=>(0,f.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:gt,viewBox:`0 0 24 24`,children:[(0,f.jsx)(`path`,{fill:`none`,d:`M0 0h24v24H0z`}),(0,f.jsx)(`path`,{stroke:`var(--fl-color-icon)`,fill:`var(--fl-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`})]});_t.displayName=`CloseIcon`;var vt=()=>(0,f.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:gt,viewBox:`0 0 24 24`,fill:`var(--fl-color-icon)`,children:[(0,f.jsx)(`path`,{fill:`none`,d:`M0 0h24v24H0z`}),(0,f.jsx)(`path`,{transform:`rotate(45 12 12)`,d:`M16 9V4h1a1 1 0 000-2H7a1 1 0 000 2h1v5c0 1.66-1.34 3-3 3v2h5.97v7l1 1 1-1v-7H19v-2c-1.66 0-3-1.34-3-3z`})]});vt.displayName=`PinIcon`;var yt=()=>(0,f.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:gt,viewBox:`0 0 24 24`,fill:`var(--fl-color-icon)`,children:[(0,f.jsx)(`path`,{d:`M0 0h24v24H0z`,fill:`none`}),(0,f.jsx)(`path`,{stroke:`var(--fl-color-icon)`,d:`M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z`})]});yt.displayName=`MaximizeIcon`;var bt=()=>(0,f.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:gt,viewBox:`0 0 24 24`,fill:`var(--fl-color-icon)`,children:[(0,f.jsx)(`path`,{d:`M0 0h24v24H0z`,fill:`none`}),(0,f.jsx)(`path`,{stroke:`var(--fl-color-icon)`,d:`M7 10l5 5 5-5z`})]});bt.displayName=`OverflowIcon`;var xt=()=>(0,f.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:{display:`block`,width:10,height:10},preserveAspectRatio:`none`,viewBox:`0 0 100 100`,children:(0,f.jsx)(`path`,{fill:`var(--fl-color-edge-icon)`,stroke:`var(--fl-color-edge-icon)`,d:`M10 30 L90 30 l-40 40 Z`})});xt.displayName=`EdgeIcon`;var St=()=>(0,f.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:gt,viewBox:`0 0 20 20`,fill:`var(--fl-color-icon)`,children:[(0,f.jsx)(`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`}),(0,f.jsx)(`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`})]});St.displayName=`PopoutIcon`;var Ct=()=>(0,f.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 -960 960 960`,style:gt,fill:`var(--fl-color-icon)`,children:(0,f.jsx)(`path`,{d:`M360-280q-33 0-56.5-23.5T280-360v-400q0-33 23.5-56.5T360-840h400q33 0 56.5 23.5T840-760v400q0 33-23.5 56.5T760-280H360Zm0-80h400v-400H360v400ZM200-200v80q-33 0-56.5-23.5T120-200h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 480v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z`})});Ct.displayName=`PopoutFloatIcon`;var wt=()=>(0,f.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,style:gt,fill:`var(--fl-color-icon)`,children:(0,f.jsx)(`path`,{d:`M4 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm0 6a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm0 6a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm6-12a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm0 6a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm0 6a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm6-12a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm0 6a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm0 6a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z`})});wt.displayName=`GripIcon`;var Tt=()=>(0,f.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:gt,viewBox:`0 0 24 24`,fill:`var(--fl-color-icon)`,children:[(0,f.jsx)(`path`,{d:`M0 0h24v24H0z`,fill:`none`}),(0,f.jsx)(`path`,{stroke:`var(--fl-color-icon)`,d:`M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z`})]});Tt.displayName=`RestoreIcon`;var Et=()=>(0,f.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:gt,height:`24px`,viewBox:`0 -960 960 960`,width:`24px`,children:(0,f.jsx)(`path`,{fill:`var(--fl-color-icon)`,stroke:`var(--fl-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`})});Et.displayName=`AsterickIcon`;var Dt=e=>{let{controller:t,tabNode:n,selected:r,path:i}=e,a=d.useRef(null),o=d.useRef(null),s=t.getIcons(),c=t.getKeyMap(),l=t.getEditingTab()===n,u=d.useCallback(e=>{a.current=e,t.registerMeasurable(n,`tabbutton`,e)},[t,n]);d.useLayoutEffect(()=>{l&&o.current.select()},[l]),d.useEffect(()=>{if(l){let e=t.getCurrentDocument().body,n=e=>{e.target!==o.current&&t.setEditingTab(void 0)};return e.addEventListener(`pointerdown`,n),()=>e.removeEventListener(`pointerdown`,n)}},[l,t]);let p=e=>{n.isEnableDrag()?(e.stopPropagation(),t.getDragDropManager().setDragNode(e.nativeEvent,n)):e.preventDefault()},m=e=>{t.getDragDropManager().onDragEnded()},h=e=>{Te(e)&&t.auxMouseClick(n,e)},g=e=>{t.showContextMenu(n,e)},_=()=>{n.isSelected()||t.doAction(E.selectTab(n.getId()))},v=e=>{let t=a.current?.closest(`[role="tablist"]`);if(t){let n=Array.from(t.querySelectorAll(`[role="tab"]`));n[n.indexOf(a.current)+e]?.focus()}},y=()=>{let e=a.current.ownerDocument,t=()=>we(e.getElementById(ve(`flexlayout-tab-`,n.getId())));r?t():(_(),requestAnimationFrame(t))},b=e=>{l||(be(e,c.focusTabToggle)?(y(),e.preventDefault()):e.key===`Enter`||e.key===` `?(r?y():_(),e.preventDefault()):(e.key===`ArrowLeft`||e.key===`ArrowUp`)&&!xe(e)?(v(-1),e.preventDefault()):(e.key===`ArrowRight`||e.key===`ArrowDown`)&&!xe(e)?(v(1),e.preventDefault()):be(e,c.closeTab)&&n.isCloseable()?(v(1),t.doAction(E.deleteTab(n.getId())),e.preventDefault()):be(e,c.renameTab)&&n.isEnableRename()&&(S(),e.preventDefault()))},x=e=>{n.isEnableRename()&&(S(),e.stopPropagation())},S=()=>{t.setEditingTab(n)},C=()=>{let e=n.getCloseType();return!!(r||e===A.Always||e===A.Visible&&t.getCurrentWindow()?.matchMedia(`(hover: hover) and (pointer: fine)`).matches)},w=e=>{C()&&(t.doAction(E.deleteTab(n.getId())),e.stopPropagation())},D=e=>{e.stopPropagation()},O=e=>{e.stopPropagation()},k=e=>{e.code===`Escape`?(t.setEditingTab(void 0),a.current?.focus()):(e.code===`Enter`||e.code===`NumpadEnter`)&&(t.setEditingTab(void 0),t.doAction(E.renameTab(n.getId(),e.target.value)),a.current?.focus())},j=t.getClassName,M=n.getTabContainer(),N=n.getParent()instanceof R?n.getParent():void 0,ee=M.isEnableSingleTabStretch()&&M.getChildren().length===1&&M.getChildren()[0]===n,P=ee?T.FLEXLAYOUT__TAB_BUTTON_STRETCH:T.FLEXLAYOUT__TAB_BUTTON,te=j(P);te+=` `+j(P+`_`+M.getTabLocation()),ee||(te+=r?` `+j(P+`--selected`):` `+j(P+`--unselected`)),n.isPinned()&&(te+=` `+j(P+`--pinned`)),N!==void 0&&(te+=` `+j(T.FLEXLAYOUT__TAB_BUTTON_GROUPED),n.getModel().getTabGroupType()===`underline`&&(te+=` `+j(T.FLEXLAYOUT__TAB_BUTTON_GROUPED_UNDERLINE))),n.getClassName()!==void 0&&(te+=` `+n.getClassName());let ne=_e(t,n),re=r||M.getSelectedNode()===void 0&&M.getTabNodes()[0]===n,ie=[Ce(c.focusTabToggle),n.isCloseable()?Ce(c.closeTab):void 0,n.isEnableRename()?Ce(c.renameTab):void 0].filter(Boolean).join(` `)||void 0,ae=ne.content?(0,f.jsx)(`div`,{className:j(T.FLEXLAYOUT__TAB_BUTTON_CONTENT),children:ne.content}):null,oe=ne.leading?(0,f.jsx)(`div`,{className:j(T.FLEXLAYOUT__TAB_BUTTON_LEADING),children:ne.leading}):null;if(l&&(ae=(0,f.jsx)(`input`,{ref:o,className:j(T.FLEXLAYOUT__TAB_BUTTON_TEXTBOX),"data-layout-path":i+`/textbox`,type:`text`,"aria-label":t.i18nName(V.Rename_Tab),autoFocus:!0,defaultValue:n.getName(),onKeyDown:k,onPointerDown:O})),n.isPinned()){let e=t.i18nName(V.Pinned_Tab);ne.buttons.push((0,f.jsx)(`div`,{"data-layout-path":i+`/button/pin`,title:e,"aria-hidden":`true`,className:j(T.FLEXLAYOUT__TAB_BUTTON_PIN),children:typeof s.pin==`function`?s.pin(n):s.pin},`pin`))}if(n.isCloseable()&&!ee){let e=t.i18nName(V.Close_Tab);ne.buttons.push((0,f.jsx)(`div`,{"data-layout-path":i+`/button/close`,title:e,"aria-hidden":`true`,className:j(T.FLEXLAYOUT__TAB_BUTTON_TRAILING),onPointerDown:D,onClick:w,children:typeof s.close==`function`?s.close(n):s.close},`close`))}let se={};return N!==void 0&&(se[`--flexlayout-group-color`]=N.getColor()),(0,f.jsxs)(`div`,{ref:u,id:ve(`flexlayout-tabbutton-`,n.getId()),role:l?void 0:`tab`,"aria-selected":l?void 0:r,"aria-controls":l?void 0:ve(`flexlayout-tab-`,n.getId()),"aria-label":l?void 0:n.isPinned()?ne.name+` (`+t.i18nName(V.Pinned_Tab)+`)`:ne.name,"aria-keyshortcuts":l?void 0:ie,tabIndex:l?-1:re?0:-1,onKeyDown:b,"data-layout-path":i,className:te,style:se,onClick:_,onAuxClick:h,onContextMenu:g,title:n.getHelpText(),draggable:!0,onDragStart:p,onDragEnd:m,onDoubleClick:x,children:[oe,ae,ne.buttons]})};Dt.displayName=`TabButton`;var Ot=e=>{let{tabsetNode:t,controller:n}=e,r=d.useRef(null),i=d.useRef(null),a=d.useRef(null),o=d.useRef(null),s=d.useRef(null),c=d.useRef(null),l=d.useRef(null),u=d.useRef(null),[m,h]=d.useState(!1),g=d.useRef(null),_=n.getIcons();d.useEffect(()=>()=>g.current?.(),[]);let{userControlledPositionRef:v,onScroll:y,onScrollPointerDown:b,hiddenTabs:x,onMouseWheel:C,isDockStickyButtons:w,isShowHiddenTabs:D}=ut(n,t,S.HORZ,o,a,i,n.getClassName(T.FLEXLAYOUT__TAB_BUTTON),u),O=d.useCallback(e=>{r.current=e,n.registerMeasurable(t,`tabset`,e)},[n,t]),k=d.useCallback(e=>{i.current=e,n.registerMeasurable(t,`tabstrip`,e)},[n,t]),A=d.useCallback(e=>{s.current=e,n.registerMeasurable(t,`tabsetcontent`,e)},[n,t]),j=e=>{let r=n.getShowOverflowMenu(),i=t.getTabNodes(),a=x.map(e=>({index:e,node:i[e]}));if(r!==void 0)r(t,e,a,M);else{let e=l.current;h(!0),g.current=lt(e,t,a,M,n,()=>{h(!1),g.current=null})}e.stopPropagation()},M=e=>{n.doAction(E.selectTab(e.node.getId())),v.current=!1},N=e=>{n.getEditingTab()?e.preventDefault():t.isEnableDrag()?(e.stopPropagation(),n.getDragDropManager().setDragNode(e.nativeEvent,t)):e.preventDefault()},ee=e=>{n.getDragDropManager().onDragEnded()},P=e=>{!Te(e)&&!t.isActive()&&n.doAction(E.setActiveTabset(t.getId(),n.getLayoutId()))},te=e=>{Te(e)&&n.auxMouseClick(t,e)},ne=e=>{n.showContextMenu(t,e)},re=e=>{e.stopPropagation()},ie=e=>{t.canMaximize()&&n.maximize(t),e.stopPropagation()},ae=e=>{n.doAction(E.deleteTabset(t.getId())),e.stopPropagation()},oe=e=>{n.doAction(E.deleteTab(t.getChildren()[0].getId())),e.stopPropagation()},se=e=>{I!==void 0&&n.doAction(E.popoutTab(I.getId(),`window`)),e.stopPropagation()},ce=e=>{I!==void 0&&n.doAction(E.popoutTab(I.getId(),`float`)),e.stopPropagation()},le=e=>{t.canMaximize()&&n.maximize(t)},F=n.getClassName,I=t.getSelectedNode(),ue=t.getPath(),de=t.getChildren(),fe=t.isEnableSingleTabStretch()&&de.length===1&&de[0]instanceof B,pe=(e,n,r,i)=>{let a=F(T.FLEXLAYOUT__TABSET_TAB_SPACER);return i&&(a+=` `+F(T.FLEXLAYOUT__TABSET_TAB_DIVIDER)),!t.isEnableTabWrap()&&!fe&&(n?a+=` `+F(T.FLEXLAYOUT__TABSET_TAB_DIVIDER_SELECTED_BEFORE):r&&(a+=` `+F(T.FLEXLAYOUT__TABSET_TAB_DIVIDER_SELECTED_AFTER))),(0,f.jsx)(`div`,{className:a,children:(0,f.jsx)(`div`,{className:F(T.FLEXLAYOUT__TABSET_TAB_DIVIDER_INNER)})},`divider`+e)},L=()=>{let e=[],r=n.getModel().getTabGroupType()===`splitpill`,i=0,a=0,o=!1,s=!1,c=!1;if(t.isEnableTabStrip()){for(let l of de){if(l instanceof R){if(e.push(pe(a++,!1,o,c)),e.push((0,f.jsx)($e,{controller:n,groupNode:l,path:l.getPath()},l.getId())),c=!0,s=!1,l.isOpened()){let u=l.getChildren();for(let r=0;r<u.length;r++){let l=u[r],d=t.getSelected()===i;e.push(pe(a++,d,o,r>0)),e.push((0,f.jsx)(Dt,{controller:n,tabNode:l,path:ye(l),selected:d},l.getId())),o=d,s=!0,c=!0,i++}r&&(e.push(pe(a++,!1,o,!1)),e.push((0,f.jsx)(et,{controller:n,groupNode:l,path:l.getPath()+`/end`},l.getId()+`/end`)),o=!1)}continue}let u=l,d=t.getSelected()===i;e.push(pe(a++,d,o,c)),e.push((0,f.jsx)(Dt,{controller:n,tabNode:u,path:ye(u),selected:d},u.getId())),o=d,s=!0,c=!0,i++}if(s){let n=F(T.FLEXLAYOUT__TABSET_TAB_SPACER);!t.isEnableTabWrap()&&!fe&&o&&(n+=` `+F(T.FLEXLAYOUT__TABSET_TAB_DIVIDER_SELECTED_AFTER)),e.push((0,f.jsx)(`div`,{className:n,children:(0,f.jsx)(`div`,{className:F(T.FLEXLAYOUT__TABSET_TAB_DIVIDER_INNER)})},`divider`+a))}}return e},me=()=>{let e,r=[],i=[],a={leading:e,stickyButtons:r,buttons:i,overflowPosition:void 0};n.customizeTabSet(t,a),e=a.leading,r=a.stickyButtons,i=a.buttons;let o=fe,s=o&&t.getChildren()[0].isCloseable()||t.isCloseable();s&&=t.isEnableCloseButton(),a.overflowPosition===void 0&&(a.overflowPosition=r.length);let d;if(r.length>0&&(!t.isEnableTabWrap()&&(w||o)?i=[...r,...i]:d=(0,f.jsx)(`div`,{ref:u,onPointerDown:re,onDragStart:e=>{e.preventDefault()},className:F(T.FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER),children:r},`sticky_buttons_container`)),!t.isEnableTabWrap()&&D){let e=n.i18nName(V.Overflow_Menu_Tooltip),r;if(typeof _.more==`function`){let e=t.getTabNodes(),n=x.map(t=>({index:t,node:e[t]}));r=_.more(t,n)}else r=(0,f.jsxs)(f.Fragment,{children:[_.more,(0,f.jsx)(`div`,{className:F(T.FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT),children:x.length>0?x.length:``})]});i.splice(Math.min(a.overflowPosition,i.length),0,(0,f.jsx)(`button`,{tabIndex:0,"data-layout-path":ue+`/button/overflow`,"aria-haspopup":`menu`,"aria-expanded":m,"aria-label":e,ref:l,className:F(T.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+` `+F(T.FLEXLAYOUT__TAB_BUTTON_OVERFLOW),title:e,onClick:j,onPointerDown:re,children:r},`overflowbutton`))}if(I!==void 0&&!I.isPinned()){if(I.isEnableFloat()&&I.isEnableFloatIcon()){let e=n.i18nName(V.Popout_Tab_Float);i.push((0,f.jsx)(`button`,{tabIndex:0,"data-layout-path":ue+`/button/popout-float`,title:e,"aria-label":e,className:F(T.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+` `+F(T.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_FLOAT),onClick:ce,onPointerDown:re,children:typeof _.popoutFloat==`function`?_.popoutFloat(I):_.popoutFloat},`popout-float`))}if(n.isSupportsPopout()&&I.isAllowedInWindow()&&I.isEnablePopoutIcon()){let e=n.i18nName(V.Popout_Tab);i.push((0,f.jsx)(`button`,{tabIndex:0,"data-layout-path":ue+`/button/popout`,title:e,"aria-label":e,className:F(T.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+` `+F(T.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_FLOAT),onClick:se,onPointerDown:re,children:typeof _.popout==`function`?_.popout(I):_.popout},`popout`))}}if(t.canMaximize()){let e=n.i18nName(V.Restore),r=n.i18nName(V.Maximize);i.push((0,f.jsx)(`button`,{tabIndex:0,"data-layout-path":ue+`/button/max`,title:t.isMaximized()?e:r,"aria-label":t.isMaximized()?e:r,"aria-pressed":t.isMaximized(),className:F(T.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+` `+F(T.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_+(t.isMaximized()?`max`:`min`)),onClick:ie,onPointerDown:re,children:t.isMaximized()?typeof _.restore==`function`?_.restore(t):_.restore:typeof _.maximize==`function`?_.maximize(t):_.maximize},`max`))}if(!t.isMaximized()&&s){let e=o?n.i18nName(V.Close_Tab):n.i18nName(V.Close_Tabset);i.push((0,f.jsx)(`button`,{tabIndex:0,"data-layout-path":ue+`/button/close`,title:e,"aria-label":e,className:F(T.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+` `+F(T.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_CLOSE),onClick:o?oe:ae,onPointerDown:re,children:typeof _.closeTabset==`function`?_.closeTabset(t):_.closeTabset},`close`))}if(t.isActive()&&t.isEnableActiveIcon()){let e=n.i18nName(V.Active_Tabset);i.push((0,f.jsx)(`div`,{"data-layout-path":ue+`/button/active`,title:e,"aria-hidden":`true`,className:F(T.FLEXLAYOUT__TAB_TOOLBAR_ICON),children:typeof _.activeTabset==`function`?_.activeTabset(t):_.activeTabset},`active`))}let p=(0,f.jsx)(`div`,{ref:c,className:F(T.FLEXLAYOUT__TAB_TOOLBAR),onPointerDown:re,onDragStart:e=>{e.preventDefault()},children:i},`buttonbar`);return{leading:e,buttonbar:p,stickyBar:d}},z=(e,r,i,s)=>{let c,l=n.getKeyMap(),u=[Ce(l.focusNextTabset),Ce(l.focusPreviousTabset)].filter(Boolean).join(` `)||void 0,d=n.getEditingTab()?.getParent()===t,p=d?void 0:`tablist`,m=F(T.FLEXLAYOUT__TABSET_TABBAR_OUTER);t.getClassNameTabStrip()!==void 0&&(m+=` `+t.getClassNameTabStrip()),m+=` `+F(T.FLEXLAYOUT__TABSET_TABBAR_OUTER_+t.getTabLocation()),t.isActive()&&(m+=` `+F(T.FLEXLAYOUT__TABSET_SELECTED)),t.isMaximized()&&(m+=` `+F(T.FLEXLAYOUT__TABSET_MAXIMIZED));let h=fe;if(h){let e=t.getChildren()[0];e.getTabSetClassName()!==void 0&&(m+=` `+e.getTabSetClassName())}let g;if(r&&(g=(0,f.jsx)(`div`,{className:F(T.FLEXLAYOUT__TABSET_LEADING),children:r})),t.isEnableTabWrap())t.isEnableTabStrip()&&(c=(0,f.jsxs)(`div`,{className:m,style:{flexWrap:`wrap`,gap:`1px`,marginTop:`2px`},ref:k,"data-layout-path":ue+`/tabstrip`,onPointerDown:P,onDoubleClick:le,onContextMenu:ne,onClick:te,onAuxClick:te,draggable:!0,onDragStart:N,onDragEnd:ee,children:[g,(0,f.jsx)(`div`,{role:p,"aria-orientation":d?void 0:`horizontal`,"aria-label":d?void 0:t.getName(),"aria-keyshortcuts":d?void 0:u,style:{display:`contents`},children:e}),s,(0,f.jsx)(`div`,{style:{flexGrow:1,display:`flex`,justifyContent:`flex-end`},children:i})]}));else if(t.isEnableTabStrip()){let n;t.isEnableTabScrollbar()&&(n=(0,f.jsx)(`div`,{ref:a,"aria-hidden":`true`,className:F(T.FLEXLAYOUT__MINI_SCROLLBAR),onPointerDown:b})),c=(0,f.jsxs)(`div`,{className:m,ref:k,"data-layout-path":ue+`/tabstrip`,onPointerDown:P,onDoubleClick:le,onContextMenu:ne,onClick:te,onAuxClick:te,draggable:!0,onWheel:C,onDragStart:N,onDragEnd:ee,children:[g,(0,f.jsxs)(`div`,{className:F(T.FLEXLAYOUT__MINI_SCROLLBAR_CONTAINER),children:[(0,f.jsxs)(`div`,{ref:o,className:F(T.FLEXLAYOUT__TABSET_TABBAR_INNER)+` `+F(T.FLEXLAYOUT__TABSET_TABBAR_INNER_+t.getTabLocation()),style:{overflowX:`auto`,overflowY:`hidden`},onScroll:y,children:[(0,f.jsx)(`div`,{style:{width:h?`100%`:`none`},role:p,"aria-orientation":d?void 0:`horizontal`,"aria-label":d?void 0:t.getName(),"aria-keyshortcuts":d?void 0:u,className:F(T.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER)+` `+F(T.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER_+t.getTabLocation()),children:e}),s]}),n]}),i]})}return c},he=e=>{let r;if(t.getTabNodes().length===0){let e=n.getTabSetPlaceHolderCallback();e&&(r=e(t))}let i=(0,f.jsx)(`div`,{ref:A,className:F(T.FLEXLAYOUT__TABSET_CONTENT),children:r});return i=t.getTabLocation()===`top`?(0,f.jsxs)(f.Fragment,{children:[e,i]}):(0,f.jsxs)(f.Fragment,{children:[i,e]}),i},H=L(),{leading:ge,buttonbar:_e,stickyBar:ve}=me(),be=he(z(H,ge,_e,ve)),xe={flexGrow:Math.max(1,t.getWeight()*1e3),minWidth:t.getMinWidth(),minHeight:t.getMinHeight(),maxWidth:t.getMaxWidth(),maxHeight:t.getMaxHeight()};t.getModel().getMaximizedTabset(n.getLayoutId())!==void 0&&!t.isMaximized()&&(xe.display=`none`);let Se=(0,f.jsx)(`div`,{ref:O,className:F(T.FLEXLAYOUT__TABSET_CONTAINER),style:xe,children:(0,f.jsx)(`div`,{className:F(T.FLEXLAYOUT__TABSET),"data-layout-path":ue,children:be})});return t.isMaximized()&&n.getMainElement()?(0,p.createPortal)((0,f.jsx)(`div`,{style:{position:`absolute`,display:`flex`,top:0,left:0,bottom:0,right:0},children:Se}),n.getMainElement()):Se};Ot.displayName=`TabSet`;var kt=e=>{let{controller:t,rowNode:n}=e,r=d.useRef(null),i=n.getOrientation()===S.HORZ,a=d.useCallback(e=>{r.current=e,t.registerMeasurable(n,`row`,e)},[t,n]),o=[],s=0;for(let e of n.getChildren())s>0&&o.push((0,f.jsx)(pt,{controller:t,node:n,index:s,horizontal:i},`splitter`+s)),e instanceof I?o.push((0,f.jsx)(kt,{controller:t,rowNode:e},e.getId())):e instanceof F&&o.push((0,f.jsx)(Ot,{controller:t,tabsetNode:e},e.getId())),s++;let c={flexGrow:Math.max(1,n.getWeight()*1e3),minWidth:n.getMinWidth(),minHeight:n.getMinHeight(),maxWidth:n.getMaxWidth(),maxHeight:n.getMaxHeight()};return c.flexDirection=i?`row`:`column`,(0,f.jsx)(`div`,{ref:a,className:t.getClassName(T.FLEXLAYOUT__ROW),style:c,children:o})};kt.displayName=`Row`;var At=e=>{let{controller:t,selected:n,tabNode:r}=e,i=d.useRef(null),a=d.useRef(!0),o=d.useCallback(()=>{let e=r.getParent();e instanceof F&&(e.isActive()||t.doAction(E.setActiveTabset(e.getId(),t.getLayoutId())))},[r,t]),s=r.getParent(),c=t.getKeyMap().focusTabToggle,l=e=>{if(be(e,c)){let t=e.currentTarget.ownerDocument.getElementById(ve(`flexlayout-tabbutton-`,r.getId()));t&&(t.focus(),e.preventDefault(),e.stopPropagation())}};d.useLayoutEffect(()=>{let e=r.getMoveableElement(),n=i.current.ownerDocument,a=e.ownerDocument!==n;a&&n.adoptNode(e),e.parentElement!==i.current&&i.current.appendChild(e),a&&t.redrawLayoutAndTabContent();let s=()=>{r.saveScrollPosition()};e.addEventListener(`scroll`,s);let c=i.current;return c&&c.addEventListener(`pointerdown`,o),()=>{c&&c.removeEventListener(`pointerdown`,o),e.removeEventListener(`scroll`,s),e.isConnected||(t.getModel().getNodeById(r.getId())&&(r.isEnableWindowReMount()||t.getMainController()?.getMoveablesHome()?.appendChild(e)),r.setVisible(!1))}},[r,t,o]),d.useEffect(()=>{r.isSelected()&&(a.current&&=(r.restoreScrollPosition(),!1))}),d.useLayoutEffect(()=>(t.registerTabPanel(r,i.current),()=>{t.registerTabPanel(r,null)}),[t,r]);let u=t.getClassName,p=null;if(n&&document.hidden&&r.isEnablePopoutOverlay()){let e={};s.getContentRect().styleWithPosition(e);let t=u(T.FLEXLAYOUT__TAB_OVERLAY);s instanceof z&&s.isOverlay()&&(t+=` `+u(T.FLEXLAYOUT__TAB_OVERLAY_RAISED)),p=(0,f.jsx)(`div`,{style:e,className:t})}let m=u(T.FLEXLAYOUT__TAB);return s instanceof z&&(m+=` `+u(T.FLEXLAYOUT__TAB_BORDER),m+=` `+u(T.FLEXLAYOUT__TAB_BORDER_+s.getLocation().getName()),s.isOverlay()&&(m+=` `+u(T.FLEXLAYOUT__TAB_BORDER_OVERLAY))),r.getContentClassName()!==void 0&&(m+=` `+r.getContentClassName()),(0,f.jsxs)(f.Fragment,{children:[p,(0,f.jsx)(`div`,{ref:i,id:ve(`flexlayout-tab-`,r.getId()),role:`tabpanel`,"aria-labelledby":ve(`flexlayout-tabbutton-`,r.getId()),"aria-keyshortcuts":Ce(c),tabIndex:-1,onKeyDown:c?l:void 0,className:m,"data-layout-path":r.getPath()})]})};At.displayName=`Tab`;var jt=class extends d.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0}}componentDidCatch(e,t){}retry=()=>{this.setState({hasError:!1})};render(){return this.state.hasError?(0,f.jsx)(`div`,{className:T.FLEXLAYOUT__ERROR_BOUNDARY_CONTAINER,children:(0,f.jsx)(`div`,{role:`alert`,className:T.FLEXLAYOUT__ERROR_BOUNDARY_CONTENT,children:(0,f.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`},children:[this.props.message,(0,f.jsx)(`p`,{children:(0,f.jsx)(`button`,{tabIndex:0,onClick:this.retry,children:this.props.retryText})})]})})}):this.props.children}},Mt=d.memo(({controller:e,tabNode:t})=>{let n;if(t.getComponent())n=e.getFactory()(t);else if(t.getSubLayoutId()){let r=t.getModel().getLayouts().get(t.getSubLayoutId());n=(0,f.jsx)(`div`,{className:e.getClassName(T.FLEXLAYOUT__TAB_LAYOUT_CONTAINER),children:(0,f.jsx)(Ht,{...e.getProps(),layoutId:t.getSubLayoutId(),path:t.getPath()+r.getPath(),mainLayoutController:e.getMainController()})})}return(0,f.jsx)(jt,{message:e.i18nName(V.Error_rendering_component),retryText:e.i18nName(V.Error_rendering_component_retry),children:n})},Nt);Mt.displayName=`TabContentRenderer`;function Nt(e,t){return!t.visible||e.windowId===t.windowId&&e.fullRedrawRevision===t.fullRedrawRevision&&e.parentRedrawRevision===t.parentRedrawRevision&&e.tabNode===t.tabNode&&t.tabNode.getSubLayoutId()===void 0}var Pt=class e{static dragState=void 0;_controller;_dragEnterCount=0;_dragging=!1;_active=!1;_dropInfo;_outlineDiv;_mainController;constructor(e){this._controller=e,this._mainController=e.getMainController()}isDockTarget(){return this._controller.getLayout().getLayoutId()!==e.dragState?.floatLayoutId}isExcludeCenter(){if(e.dragState?.dockFloatToMain)return!0;let t=e.dragState?.dragNode;return t instanceof F?!t.isEnableClose()||t.getPinnedRunLength()>0:!1}addTabWithDragAndDrop(t,n,r){let i=B.fromJson(n,this._controller.getModel(),!1);e.dragState=new Ft(this._controller.getMainController(),`add`,i,n,r)}onDragEnded(){this.clearDragMain(),e.dragState=void 0}moveTabWithDragAndDrop(e,t){this.setDragNode(e,t)}startDockLayoutDrag(t,n,r){let i=n.getRootRow();e.dragState=new Ft(this._controller.getMainController(),`float`,i,void 0,void 0,!0,n.getLayoutId(),r),t.dataTransfer.setData(`text/plain`,`--flexlayout--`),t.dataTransfer.effectAllowed=`copyMove`,t.dataTransfer.dropEffect=`move`,this._dragEnterCount=0,this._controller.getModel().sortLayouts();let a=0;n.getRootRow()?.forEachNode(e=>{e instanceof B&&a++},0);let o=this._controller.i18nName(V.Dock_Float_Tabs).replace(`?`,String(a)),s=!1;if(this._controller.getProps().onRenderDragRect){let e=this._controller.getProps().onRenderDragRect(o,i,void 0);e&&(this.setDragComponent(t,e,10,10),s=!0)}s||this.setDragComponent(t,o,10,10)}setDragNode=(t,n)=>{if(e.dragState=new Ft(this._controller.getMainController(),`internal`,n,void 0,void 0),t.dataTransfer.setData(`text/plain`,`--flexlayout--`),t.dataTransfer.effectAllowed=`copyMove`,t.dataTransfer.dropEffect=`move`,this._dragEnterCount=0,this._controller.getModel().sortLayouts(),n instanceof F){let e=!1,r=this._controller.i18nName(V.Move_Tabset);if(n.getChildren().length>0&&(r=this._controller.i18nName(V.Move_Tabs).replace(`?`,String(n.getChildren().length))),this._controller.getProps().onRenderDragRect){let i=this._controller.getProps().onRenderDragRect(r,n,void 0);i&&(this.setDragComponent(t,i,10,10),e=!0)}e||this.setDragComponent(t,r,10,10)}else if(n instanceof R){let e=!1,r=this._controller.i18nName(V.Move_Group).replace(`?`,String(n.getChildren().length));if(this._controller.getProps().onRenderDragRect){let i=this._controller.getProps().onRenderDragRect(r,n,void 0);i&&(this.setDragComponent(t,i,10,10),e=!0)}e||this.setDragComponent(t,r,10,10)}else{let e=t.target;if(e&&typeof e.getBoundingClientRect==`function`){let r=e.getBoundingClientRect(),i=t.clientX-r.left,a=t.clientY-r.top,o=n?.getParent(),s=o instanceof z&&o.getOrientation()===S.HORZ,c=s?10:i,l=s?10:a,u=!1;if(this._controller.getProps().onRenderDragRect){let e=(0,f.jsx)(tt,{controller:this._controller,tabNode:n},n.getId()),r=this._controller.getProps().onRenderDragRect(e,n,void 0);r&&(this.setDragComponent(t,r,c,l),u=!0)}u||(je()?this.setDragComponent(t,(0,f.jsx)(tt,{tabNode:n,controller:this._controller}),c,l):t.dataTransfer.setDragImage(n.getTabStamp(),c,l))}}};setDragComponent(e,t,n,r){let i=(0,f.jsx)(`div`,{style:{position:`unset`},className:this._controller.getClassName(T.FLEXLAYOUT__LAYOUT)+` `+this._controller.getClassName(T.FLEXLAYOUT__DRAG_RECT),children:t}),a=this._controller.getCurrentDocument(),o=a.createElement(`div`);o.setAttribute(`data-layout-path`,`/drag-rectangle`),o.style.position=`absolute`,o.style.left=`-10000px`,o.style.top=`-10000px`,a.body.appendChild(o);let s=(0,m.createRoot)(o);(0,p.flushSync)(()=>s.render(i)),e.dataTransfer.setDragImage(o,n,r),setTimeout(()=>{s.unmount(),a.body.removeChild(o)},0)}updateActive(t){let n=Array.from(this._controller.getModel().getLayouts().values()),r=e.dragState?.dockFloatToMain===!0,i,a;for(let t=n.length-1;t>=0;t--){let o=n[t];if(r&&o.getLayoutId()===e.dragState?.floatLayoutId)continue;let s=U(o)?.getDragDropManager();s&&s.getDragEnterCount()>0&&(o.getType()===`tab`?a=o:!i&&!a&&(i=o))}if(a){let e=a.findParentLayout();(i===e||!i)&&(i=a)}i&&U(i).getDragDropManager().setActive(!0,t);for(let e of n)e!==i&&U(e)?.getDragDropManager().setActive(!1,t)}setActive(e,t){this._active!==e&&(this._active=e,this._active?this.onDragEnter(t):this.onDragLeave(t))}onDragEnterRaw=e=>{this._dragEnterCount++,this.updateActive(e)};onDragLeaveRaw=e=>{this._dragEnterCount--,this.updateActive(e)};clearDragMain(){this._controller.showOverlayOnAllWindows(!1);for(let[,e]of this._controller.getModel().getLayouts()){let t=U(e);t&&t.getDragDropManager().clearDragLocal()}}clearDragLocal(){this._dragEnterCount=0,this._active=!1,this.clearDragLocalVisuals()}clearDragLocalVisuals(){this._controller.setState({showEdges:!1}),this._dragging=!1,this._outlineDiv&&=(this._controller.getRootDiv().removeChild(this._outlineDiv),void 0)}onDragEnter=t=>{if(!e.dragState&&this._controller.getProps().onExternalDrag){let n=this._controller.getProps().onExternalDrag(t);if(n){let t=B.fromJson(n.json,this._controller.getModel(),!1);e.dragState=new Ft(this._controller.getMainController(),`external`,t,n.json,n.onDrop)}}if(this._mainController===e.dragState?.mainLayoutController&&(!e.dragState?.dockFloatToMain||this.isDockTarget())&&e.dragState){t.preventDefault(),this._dropInfo=void 0;let e=this._controller.getRootDiv(),n=this._controller.getCurrentDocument();this._outlineDiv=n.createElement(`div`),this._outlineDiv.className=this._controller.getClassName(T.FLEXLAYOUT__OUTLINE_RECT),this._outlineDiv.style.visibility=`hidden`;let r=this._controller.getTabDragSpeed();this._outlineDiv.style.transition=`top ${r}s, left ${r}s, width ${r}s, height ${r}s`,e.appendChild(this._outlineDiv),this._dragging=!0,this._controller.showOverlayOnAllWindows(!0),this._controller.getModel().getMaximizedTabset(this._controller.getLayoutId())===void 0&&this._controller.setState({showEdges:this._controller.getModel().isEnableEdgeDock()});let i=this._controller.getRootDiv().getBoundingClientRect();new x(t.clientX-i.left,t.clientY-i.top,1,1).positionElement(this._outlineDiv)}};onDragOver=t=>{if(this._mainController===e.dragState?.mainLayoutController&&(!e.dragState?.dockFloatToMain||this.isDockTarget())&&this._active){if(e.dragState?.dockFloatToMain){let n=t.target;if(n&&e.dragState.sourceFloatElement?.contains(n)){this._dropInfo=void 0;return}}let n=this._controller.getRootDiv()?.getBoundingClientRect(),r={x:t.clientX-(n?.left??0),y:t.clientY-(n?.top??0)};e.dragState.dockFloatToMain||this._controller.checkForBorderToShow(r.x,r.y);let i=this._controller.getModel().findDropTargetNode(this._controller.getLayoutId(),e.dragState.dragNode,r.x,r.y,this.isExcludeCenter());if(i){if(e.dragState.dockFloatToMain&&(i.location===C.CENTER||!(i.node instanceof F)&&!(i.node instanceof I)))return;t.preventDefault(),this._dropInfo=i,this._outlineDiv&&(this._outlineDiv.className=this._controller.getClassName(i.className),i.rect.positionElement(this._outlineDiv),this._outlineDiv.style.visibility=`visible`)}}};onDragLeave=t=>{if(this._mainController===e.dragState?.mainLayoutController&&(this.clearDragLocalVisuals(),this._controller.isMainLayout())){let e=!1;for(let[,t]of this._controller.getModel().getLayouts()){let n=U(t);if(n&&n.getDragDropManager().isDragging()){e=!0;break}}e===!1&&this.clearDragMain()}};onDrop=t=>{if(this._mainController!==e.dragState?.mainLayoutController){this.clearDragLocal();return}if(!e.dragState?.dockFloatToMain||this.isDockTarget()){if(this._active){t.preventDefault();let n=e.dragState;if(this._dropInfo&&n.dockFloatToMain){let e=t.target;e&&n.sourceFloatElement?.contains(e)&&(this._dropInfo=void 0)}if(this._dropInfo){if(n.dragJson!==void 0){let e=this._controller.doAction(E.addTab(n.dragJson,this._dropInfo.node.getId(),this._dropInfo.location,this._dropInfo.index));n.fnNewNodeDropped!==void 0&&n.fnNewNodeDropped(e,t)}else n.dragNode!==void 0&&(n.dockFloatToMain?this._controller.doAction(E.dockFloatToLayout(n.floatLayoutId,this._dropInfo.node.getId(),this._dropInfo.location,this._dropInfo.index)):this._controller.doAction(E.moveNode(n.dragNode.getId(),this._dropInfo.node.getId(),this._dropInfo.location,this._dropInfo.index)))}this.clearDragMain(),e.dragState=void 0}this._dragEnterCount=0}};getDragEnterCount(){return this._dragEnterCount}isDragging(){return this._dragging}},Ft=class{mainLayoutController;dragSource;dragNode;dragJson;fnNewNodeDropped;dockFloatToMain;floatLayoutId;sourceFloatElement;constructor(e,t,n,r,i,a=!1,o=void 0,s=void 0){this.mainLayoutController=e,this.dragSource=t,this.dragNode=n,this.dragJson=r,this.fnNewNodeDropped=i,this.dockFloatToMain=a,this.floatLayoutId=o,this.sourceFloatElement=s}},It=({controller:e})=>{let t=[],n=e.getIcons().edgeArrow;if(e.getState().showEdges&&e.getModel().isEnableEdgeDockIndicators()){let r=e.getModel().getRootRow(e.getLayoutId()).getRect(),i=e.getClassName(T.FLEXLAYOUT__EDGE_RECT);t.push((0,f.jsx)(`div`,{"aria-hidden":`true`,style:{top:0,left:r.width/2-50,width:100,height:10,borderBottomLeftRadius:50,borderBottomRightRadius:50},className:i+` `+e.getClassName(T.FLEXLAYOUT__EDGE_RECT_TOP),children:(0,f.jsx)(`div`,{style:{transform:`rotate(180deg)`},children:n})},`North`)),t.push((0,f.jsx)(`div`,{"aria-hidden":`true`,style:{top:r.height/2-50,left:0,width:10,height:100,borderTopRightRadius:50,borderBottomRightRadius:50},className:i+` `+e.getClassName(T.FLEXLAYOUT__EDGE_RECT_LEFT),children:(0,f.jsx)(`div`,{style:{transform:`rotate(90deg)`},children:n})},`West`)),t.push((0,f.jsx)(`div`,{"aria-hidden":`true`,style:{top:r.height-10,left:r.width/2-50,width:100,height:10,borderTopLeftRadius:50,borderTopRightRadius:50},className:i+` `+e.getClassName(T.FLEXLAYOUT__EDGE_RECT_BOTTOM),children:(0,f.jsx)(`div`,{children:n})},`South`)),t.push((0,f.jsx)(`div`,{"aria-hidden":`true`,style:{top:r.height/2-50,left:r.width-10,width:10,height:100,borderTopLeftRadius:50,borderBottomLeftRadius:50},className:i+` `+e.getClassName(T.FLEXLAYOUT__EDGE_RECT_RIGHT),children:(0,f.jsx)(`div`,{style:{transform:`rotate(-90deg)`},children:n})},`East`))}return(0,f.jsx)(f.Fragment,{children:t})};It.displayName=`EdgeIndicators`;var Lt=d.memo(e=>{Lt.displayName=`DragTabButton`;let{controller:t,tabNode:n}=e,r=d.useRef(null);d.useEffect(()=>(n.setTabStamp(r.current),()=>{n.setTabStamp(null)}),[n]);let i=t.getClassName,a=i(T.FLEXLAYOUT__DRAG_RECT);return(0,f.jsx)(`div`,{ref:r,className:a,children:(0,f.jsx)(tt,{controller:t,tabNode:n},n.getId())})},Rt);function Rt(e,t){return t.dragging}var zt=class e{static Windows=new WeakMap;_props;_state;_setState;_layoutRef;_moveablesHomeRef;_findBorderBarSizeRef;_findSplitterSizeRef;_mainRef;_orderedTabIds;_orderedTabMoveableIds;_currentDocument;_currentWindow;_showOverlay=!1;_supportsPopout;_popoutURL;_icons;_dragDropManager;_layoutId;_layout;_mainController;_popoutWindowName;_cachedLayoutDOMRect;_reLayout;_measurables=new Map;_tabPanels=new Map;_lastRect=x.empty();_lastSplitterSize=8;_geometryResizeObserver;_splitterDragging=!1;constructor(e,t,n){this._props=e,this._state=t,this._setState=n,this._orderedTabIds=[],this._orderedTabMoveableIds=[],this._supportsPopout=e.supportsPopout===void 0?Vt:e.supportsPopout,this._popoutURL=e.popoutURL?e.popoutURL:`popout.html`,this._icons={...Bt,...e.icons},this._layoutId=e.layoutId?e.layoutId:pe.MAIN_LAYOUT_ID,this._mainController=e.mainLayoutController?e.mainLayoutController:this,this._dragDropManager=new Pt(this),this._layout=e.model.getLayouts().get(this._layoutId),this._layout.setController(this),this._popoutWindowName=e.popoutWindowName,this._reLayout=!1}renderLayout(){return this._cachedLayoutDOMRect=void 0,(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(kt,{controller:this,rowNode:this._props.model.getRootRow(this._layoutId)},`__row__`),(0,f.jsx)(It,{controller:this})]})}renderTabContainers(){let e=new Map;return this._props.model.visitLayoutNodes(this._layoutId,t=>{if(t instanceof B){let n=t,r=n.isSelected(),i=n.isRendered(),a=n.isEnableRenderOnDemand();(i||r||!a)&&e.set(n.getId(),(0,f.jsx)(At,{controller:this,tabNode:n,selected:r},n.getId()))}}),e}renderTabContents(){let e=new Map;for(let[t,n]of this._props.model.getLayouts())this._props.model.visitLayoutNodes(t,t=>{if(t instanceof B){let r=t,i=r.isSelected(),a=r.isRendered(),o=r.isEnableRenderOnDemand(),s=r.getTabContainer().getContentRect(),c=i||!o;if(a||c&&s.width>0&&s.height>0){let t=r.getMoveableElement();t.style.overflow=r.isEnableScrollbars()?`auto`:`hidden`;let i=n.getWindowId()||``,a=r.getId()+(r.isEnableWindowReMount()?i:``);e.set(r.getId(),(0,p.createPortal)((0,f.jsx)(Mt,{controller:this,tabNode:r,windowId:i,visible:c,fullRedrawRevision:this._state.fullRedrawRevision,parentRedrawRevision:this._props.parentRedrawRevision},a),t,a)),r.setRendered(!0)}}});return e}renderDragTabButtons(){let e=[];return this._props.model.visitNodes(t=>{if(t instanceof B){let n=t;e.push((0,f.jsx)(Lt,{controller:this,tabNode:n,dragging:Oe},n.getId()))}}),e}redrawLayout(){this._mainController?.setState(e=>({layoutRedrawRevision:e.layoutRedrawRevision+1}))}redrawLayoutAndTabContent(){this._mainController?.setState(e=>({fullRedrawRevision:e.fullRedrawRevision+1}))}doAction(e){if(this._props.onAction!==void 0){let t=this._props.onAction(e);return t===void 0?void 0:this._props.model.doAction(t)}return this._props.model.doAction(e)}updateRect=()=>{if(this._layoutRef.current){let e=this._layoutRef.current;if(!this._layout.isMainLayout()&&this._layout.getType()===`float`){let t=e.closest(`.`+this.getClassName(T.FLEXLAYOUT__FLOAT_WINDOW));t instanceof HTMLDivElement&&(e=t)}let t=x.fromDomRect(e.getBoundingClientRect());if(!this._layout.isMainLayout()&&this._layout.getType()===`float`){let e=this._mainController.getDomRect();t=t.relativeTo(e)}!t.equalsWhenRounded(this._lastRect)&&t.width!==0&&t.height!==0&&(this._lastRect=t,this._layout.setRect(t),this.redrawLayout())}};onModelChange=e=>{let t=e instanceof O?e.actions:[e];for(let e of t)if(e.type==E.DELETE_TAB&&this._state.showHiddenBorder!==C.CENTER){let e=this._props.model.getBorderSet().getBorderMap().get(this._state.showHiddenBorder);if(!e||e.getChildren().length===0){this._setState({showHiddenBorder:C.CENTER});break}}if(e.isAdjusting()&&(e.type===E.ADJUST_WEIGHTS||e.type===E.ADJUST_BORDER_SPLIT)){e.type===E.ADJUST_WEIGHTS?this.applyAdjustingWeights(e):this.applyAdjustingBorderSplit(e),this._props.onModelChange&&this._props.onModelChange(this._props.model,e);return}this.redrawLayout(),this._props.onModelChange&&this._props.onModelChange(this._props.model,e)};applyMeasuredGeometry(){this.syncLayoutMetrics(),this.positionTabPanels(),this.isReLayout()&&(this.redrawLayout(),this.setReLayout(!1))}applyAdjustingWeights(e){let t=this._props.model.getNodeById(e.data.nodeId);if(!(t instanceof I)){this.redrawLayout();return}let n=e.data.weights,r=t.getChildren();for(let e=0;e<r.length;e++){let t=r[e];if(typeof n?.[e]!=`number`||!Number.isFinite(n[e]))continue;let i=t instanceof I?`row`:`tabset`,a=this._measurables.get(i+`:`+t.getId())?.element;if(!a){this.redrawLayout();return}a.style.flexGrow=String(Math.max(1,n[e]*1e3))}this.applyMeasuredGeometry()}applyAdjustingBorderSplit(e){let t=this._props.model.getNodeById(e.data.node);if(!(t instanceof z)){this.redrawLayout();return}if(t.isOverlay()){this.redrawLayout();return}let n=this._measurables.get(`bordercontent:`+t.getId())?.element;if(!n){this.redrawLayout();return}let r=t.getSize();t.isHorizontal()?(n.style.width=r+`px`,n.style.minWidth=t.getMinSize()+`px`,n.style.maxWidth=t.getMaxSize()+`px`):(n.style.height=r+`px`,n.style.minHeight=t.getMinSize()+`px`,n.style.maxHeight=t.getMaxSize()+`px`),this.applyMeasuredGeometry()}reorderComponents(e,t){let n=t.filter(t=>e.has(t)),r=new Set(n);for(let t of e.keys())r.has(t)||n.push(t);return t===this._orderedTabIds?this._orderedTabIds=n:t===this._orderedTabMoveableIds&&(this._orderedTabMoveableIds=n),n.map(t=>e.get(t))}checkForBorderToShow(e,t){let n=this.getBoundingClientRect(this._mainRef.current),r=n.getCenter(),i=!1;this._props.model.isEnableEdgeDock()&&this._state.showHiddenBorder===C.CENTER&&(t>r.y-50&&t<r.y+50||e>r.x-50&&e<r.x+50)&&(i=!0);let a=C.CENTER;i||(e<=n.x+10?a=C.LEFT:e>=n.getRight()-10?a=C.RIGHT:t<=n.y+10?a=C.TOP:t>=n.getBottom()-10&&(a=C.BOTTOM)),a!==C.CENTER&&!this._props.model.getBorderSet().getBorderMap().has(a)&&(a=C.CENTER),a!==this._state.showHiddenBorder&&this.setState({showHiddenBorder:a})}onOverlayBorderPointerDown=e=>{let t=this._props.model.getBorderSet().getBorders().filter(e=>e.isOverlay()&&e.getSelected()!==-1);if(t.length===0||e.target?.closest?.(`.`+this.getClassName(T.FLEXLAYOUT__POPUP_MENU_CONTAINER)+`,.`+this.getClassName(T.FLEXLAYOUT__FLOAT_WINDOW)+`,.`+this.getClassName(T.FLEXLAYOUT__FLOATING_WINDOW_CONTENT)+`,.`+this.getClassName(T.FLEXLAYOUT__BORDER_TAB_OVERLAY)))return;let n=this.getDomRect();if(!n)return;let r=e.clientX-n.x,i=e.clientY-n.y,a=this._props.model.getRootRow(pe.MAIN_LAYOUT_ID)?.getRect();if(a&&a.contains(r,i))for(let e of t)e.getContentRect()?.contains(r,i)||this.closeOverlayBorder(e)};closeOverlayBorder(e){let t=e.getSelectedNode();if(t===void 0)return;let n=this._currentDocument,r=n?.getElementById(ve(`flexlayout-tab-`,t.getId())),i=!!n&&!!r&&r.contains(n.activeElement);this.doAction(E.selectTab(t.getId())),i&&n.getElementById(ve(`flexlayout-tabbutton-`,t.getId()))?.focus()}onOverlayBorderKeyDown=e=>{if(!be(e,this.getKeyMap().closeOverlayBorder))return;let t=this._currentDocument?.activeElement;if(!t)return;let n=this._props.model.getBorderSet().getBorders().filter(e=>e.isOverlay()&&e.getSelected()!==-1);for(let r of n){let n=r.getSelectedNode(),i=this._currentDocument.getElementById(ve(`flexlayout-tab-`,n.getId())),a=this._currentDocument.getElementById(ve(`flexlayout-tabbutton-`,n.getId()));if(i&&i.contains(t)||t===a){this.closeOverlayBorder(r),e.preventDefault();break}}};onTabsetNavKeyDown=e=>{if(e.defaultPrevented)return;let t=this.getKeyMap(),n;if(be(e,t.focusNextTabset))n=1;else if(be(e,t.focusPreviousTabset))n=-1;else return;this.focusAdjacentTabset(n)&&e.preventDefault()};focusAdjacentTabset(e){let t=this._currentDocument,n=t?.activeElement;if(!t||!n||!this.getRootDiv()?.contains(n))return!1;let r=n.tagName;if(r===`INPUT`||r===`TEXTAREA`||n.isContentEditable||n.closest(`[role="menu"]`)||this._props.model.getMaximizedTabset(this._layoutId)!==void 0)return!1;let i=[];if(this._props.model.visitLayoutNodes(this._layoutId,e=>{e instanceof F&&e.getSelectedNode()!==void 0&&i.push(e)}),i.length<2)return!1;let a=i.findIndex(e=>this._measurables.get(`tabset:`+e.getId())?.element.contains(n)?!0:!!t.getElementById(ve(`flexlayout-tab-`,e.getSelectedNode().getId()))?.contains(n));if(a===-1){let e=this._props.model.getActiveTabset(this._layoutId);a=e===void 0?0:i.indexOf(e),a===-1&&(a=0)}let o=i[(a+e+i.length)%i.length];return t.getElementById(ve(`flexlayout-tabbutton-`,o.getSelectedNode().getId()))?.focus(),this.doAction(E.setActiveTabset(o.getId(),this._layoutId)),!0}registerMeasurable(e,t,n){let r=t+`:`+e.getId(),i=this._measurables.get(r);n?this._measurables.set(r,{kind:t,node:e,element:n}):(this._measurables.delete(r),t===`grouppill`?e.setPillRect(x.empty()):t===`groupendmarker`&&e.setEndMarkerRect(x.empty())),t!==`tabbutton`&&(i&&this._geometryResizeObserver?.unobserve(i.element),n&&this._geometryResizeObserver?.observe(n))}setGeometryResizeObserver(e){if(this._geometryResizeObserver=e,e)for(let{kind:t,element:n}of this._measurables.values())t!==`tabbutton`&&e.observe(n)}syncLayoutMetrics(){this._cachedLayoutDOMRect=void 0;let e=!1;for(let{kind:t,node:n,element:r}of this._measurables.values()){if(!r.isConnected)continue;let i=this.getBoundingClientRect(r);switch(t){case`row`:case`tabset`:i.equalsWhenRounded(n.getRect())||(n.setRect(i),e=!0);break;case`tabstrip`:i.equalsWhenRounded(n.getTabStripRect())||(n.setTabStripRect(i),e=!0);break;case`tabsetcontent`:{let t=n;if(!isNaN(i.x)&&!t.getContentRect().equalsWhenRounded(i)){let n=t.getContentRect().width>0&&t.getContentRect().height>0;t.setContentRect(i),e=!0,!n&&i.width>0&&i.height>0&&this.setReLayout(!0)}break}case`tabbutton`:i.equalsWhenRounded(n.getTabRect())||(n.setTabRect(i),e=!0);break;case`grouppill`:i.equalsWhenRounded(n.getPillRect())||(n.setPillRect(i),e=!0);break;case`groupendmarker`:i.equalsWhenRounded(n.getEndMarkerRect())||(n.setEndMarkerRect(i),e=!0);break;case`borderheader`:i.equalsWhenRounded(n.getRect())||(n.setTabHeaderRect(i),e=!0);break;case`bordercontent`:{let t=n;if(!isNaN(i.x)&&i.width>0&&!t.getContentRect().equalsWhenRounded(i)){let n=t.getContentRect().width>0&&t.getContentRect().height>0;t.setContentRect(i),e=!0,!n&&i.height>0&&this.setReLayout(!0)}break}}}for(let{kind:t,node:n}of this._measurables.values())if(t===`grouppill`){let t=n,r=t.getDropRegion();r.equalsWhenRounded(t.getRect())||(t.setRect(r),e=!0)}return e}registerTabPanel(e,t){t?this._tabPanels.set(e.getId(),{node:e,element:t}):this._tabPanels.delete(e.getId())}positionTabPanels(){for(let{node:e,element:t}of this._tabPanels.values()){let n=e.getTabContainer(),r=n.getContentRect(),i=e.isSelected();n instanceof F?this._props.model.getMaximizedTabset(this._layoutId)!==void 0&&!n.isMaximized()&&(i=!1):n instanceof z&&(n.isShowing()||(i=!1)),r.positionElement(t),t.style.display=i?``:`none`,e.setRect(r),e.setVisible(i)}}updateLayoutMetrics=()=>{if(this._findBorderBarSizeRef.current){let e=this._findBorderBarSizeRef.current.getBoundingClientRect().height;Math.abs(e-this._state.calculatedBorderBarSize)>.5&&this.setState({calculatedBorderBarSize:e})}if(this._findSplitterSizeRef.current){let e=this._findSplitterSizeRef.current.getBoundingClientRect().width;Math.abs(e-this._lastSplitterSize)>.5&&(this._lastSplitterSize=e,this._props.model.setSplitterSize(e),this.redrawLayout())}};addTabWithDragAndDrop(e,t,n){this._dragDropManager.addTabWithDragAndDrop(e,t,n)}moveTabWithDragAndDrop(e,t){this._dragDropManager.moveTabWithDragAndDrop(e,t)}setDragComponent(e,t,n,r){this._dragDropManager.setDragComponent(e,t,n,r)}getMoveablesHome(){return this._moveablesHomeRef.current}getProps(){return this._props}getKeyMap(){return Se(this._props.keyMap)}setProps(e){this._props=e}getState(){return this._state}setStateRaw(e){this._state=e}setState(e){this._setState(e)}setSetState(e){this._setState=e}setLayoutRef(e){this._layoutRef=e}setMoveablesHomeRef(e){this._moveablesHomeRef=e}setFindBorderBarSizeRef(e){this._findBorderBarSizeRef=e}setFindSplitterSizeRef(e){this._findSplitterSizeRef=e}getMainRef(){return this._mainRef}setMainRef(e){this._mainRef=e}getOrderedTabIds(){return this._orderedTabIds}getOrderedTabMoveableIds(){return this._orderedTabMoveableIds}getCurrentDocument(){return this._currentDocument}setCurrentDocument(e){this._currentDocument=e}getCurrentWindow(){return this._currentWindow}setCurrentWindow(t){this._currentWindow=t,t&&!e.Windows.has(t)&&e.Windows.set(t,le())}getWindowId(){if(this.getCurrentWindow())return e.Windows.get(this.getCurrentWindow())}isSupportsPopout(){return this._supportsPopout}getPopoutURL(){return this._popoutURL}getIcons(){return this._icons}getDragDropManager(){return this._dragDropManager}getLayoutId(){return this._layoutId}getLayout(){return this._layout}setLayout(e){this._layout=e}getMainController(){return this._mainController}isMainLayout(){return this._layout.isMainLayout()}getPopoutWindowName(){return this._popoutWindowName??this.i18nName(V.Popout_Window_Name)}isReLayout(){return this._reLayout}setReLayout(e){this._reLayout=e}getBoundingClientRect(e){let t=this.getDomRect();return t?x.getBoundingClientRect(e).relativeTo(t):x.empty()}getClassName=e=>this._props.classNameMapper===void 0?e:this._props.classNameMapper(e);getLayoutRef(){return this._layoutRef.current}getDomRect(){return this._cachedLayoutDOMRect===void 0?this._layoutRef.current?(this._cachedLayoutDOMRect=x.fromDomRect(this._layoutRef.current.getBoundingClientRect()),this._cachedLayoutDOMRect):x.empty():this._cachedLayoutDOMRect}getRootDiv(){return this._layoutRef.current}getMainElement(){return this._mainRef.current}getFactory(){return this._props.factory}isRealtimeResize(){return this._props.realtimeResize??!0}isSplitterDragging(){return this._mainController?this._mainController._splitterDragging:this._splitterDragging}setSplitterDragging(e){let t=this._mainController??this;t._splitterDragging=e}setEditingTab(e){this.setState({editingTab:e})}getEditingTab(){return this._state.editingTab}getModel(){return this._props.model}getTabDragSpeed(){return this._props.tabDragSpeed?this._props.tabDragSpeed:.3}onCloseLayout=e=>{this.doAction(E.closePopout(e.getLayoutId()))};getScreenRect(e){let t=e.clone(),n=this.getDomRect(),r=this._currentWindow.outerHeight-this._currentWindow.innerHeight,i=this._currentWindow.outerWidth-this._currentWindow.innerWidth,a=r>=0&&r<=200?r:60,o=i>=0&&i<=100?i:2;return t.x=this._currentWindow.screenX+this._currentWindow.scrollX+o/2+n.x+t.x,t.y=this._currentWindow.screenY+this._currentWindow.scrollY+(a-o/2)+n.y+t.y,t.height+=a,t.width+=o,t}getRelativeRect(e){let t=e.clone();if(!this._layout.isMainLayout()){let e=this._layout.getRect();t.x+=e.x,t.y+=e.y}return t}moveWindowToFront(e){this.doAction(E.movePopoutToFront(e))}addTabToTabSet(e,t){if(this._props.model.getNodeById(e)!==void 0)return this.doAction(E.addTab(t,e,C.CENTER,-1))}addTabToActiveTabSet(e){let t=this._props.model.getActiveTabset(this._layoutId);if(t!==void 0)return this.doAction(E.addTab(e,t.getId(),C.CENTER,-1))}maximize(e){this.doAction(E.maximizeToggle(e.getId(),this.getLayoutId()))}customizeTab(e,t){this._props.onRenderTab&&this._props.onRenderTab(e,t)}customizeTabSet(e,t){this._props.onRenderTabSet&&this._props.onRenderTabSet(e,t)}i18nName(e,t){let n=this._props.model.translate(e);return n===e&&(n=he[e]??e),n===void 0&&(n=e+(t===void 0?``:t)),n}getShowOverflowMenu(){return this._props.onShowOverflowMenu}getTabSetPlaceHolderCallback(){return this._props.onTabSetPlaceHolder}showContextMenu(e,t){this._props.onContextMenu&&this._props.onContextMenu(e,t)}auxMouseClick(e,t){this._props.onAuxMouseClick&&this._props.onAuxMouseClick(e,t)}showOverlay(e){this._showOverlay!==e&&(this._showOverlay=e,this.setState({showOverlay:e}),Ee(!e,this._currentDocument))}showOverlayOnAllWindows(e){for(let[,t]of this._props.model.getLayouts()){let n=U(t);n&&n.showOverlay(e)}}},Bt={close:(0,f.jsx)(_t,{}),pin:(0,f.jsx)(vt,{}),closeTabset:(0,f.jsx)(_t,{}),closeFloatPopout:(0,f.jsx)(_t,{}),popout:(0,f.jsx)(St,{}),popoutFloat:(0,f.jsx)(Ct,{}),maximize:(0,f.jsx)(yt,{}),restore:(0,f.jsx)(Tt,{}),more:(0,f.jsx)(bt,{}),edgeArrow:(0,f.jsx)(xt,{}),activeTabset:(0,f.jsx)(Et,{}),dragToDock:(0,f.jsx)(wt,{}),popoutFloatWindow:(0,f.jsx)(St,{})},Vt=ge();function U(e){return e.getController()}var Ht=d.forwardRef((e,t)=>{let[n,r]=d.useState({editingTab:void 0,showEdges:!1,showOverlay:!1,calculatedBorderBarSize:29,layoutRedrawRevision:0,fullRedrawRevision:0,showHiddenBorder:C.CENTER}),i=d.useCallback(t=>{r(n=>({...n,...typeof t==`function`?t(n,e):t}))},[e]),a=d.useRef(null),[o,s]=d.useState(0),c=d.useRef(null),l=d.useRef(null),u=d.useRef(null),p=d.useRef(null),m=d.useMemo(()=>new zt(e,n,i),[]);m.setProps(e),m.setStateRaw(n),m.setSetState(i),m.setLayoutRef(a),m.setMoveablesHomeRef(c),m.setFindBorderBarSizeRef(l),m.setFindSplitterSizeRef(u),m.setMainRef(p);let h=e.model.getLayouts().get(m.getLayoutId());h.setController(m),d.useImperativeHandle(t,()=>m,[m]),d.useLayoutEffect(()=>{let e=m.syncLayoutMetrics();if(m.positionTabPanels(),m.isMainLayout()&&m.updateLayoutMetrics(),m.isReLayout()&&(m.redrawLayout(),m.setReLayout(!1)),a.current&&m.getCurrentDocument()!==void 0&&m.getCurrentDocument()!==a.current.ownerDocument&&s(e=>e+1),e){let e=a.current?.ownerDocument.defaultView??window,t=e.requestAnimationFrame(()=>{m.syncLayoutMetrics(),m.positionTabPanels(),m.isReLayout()&&(m.redrawLayout(),m.setReLayout(!1))});return()=>e.cancelAnimationFrame(t)}}),d.useEffect(()=>{let e=a.current.ownerDocument,t=e.defaultView;m.setCurrentDocument(e),m.setCurrentWindow(t);let n=new t.ResizeObserver(()=>{m.updateRect(),m.syncLayoutMetrics(),m.positionTabPanels(),m.updateLayoutMetrics(),m.isReLayout()&&(m.redrawLayout(),m.setReLayout(!1))});n.observe(a.current),m.setGeometryResizeObserver(n),l.current&&n.observe(l.current),u.current&&n.observe(u.current);let r=()=>{m.updateRect()};t.addEventListener(`resize`,r);let i=()=>{for(let[e,t]of m.getProps().model.getLayouts()){let e=t.getController();e&&e.redrawLayout()}};return m.isMainLayout()&&(e.addEventListener(`visibilitychange`,i),e.addEventListener(`pointerdown`,m.onOverlayBorderPointerDown,!0),e.addEventListener(`keydown`,m.onOverlayBorderKeyDown)),(m.isMainLayout()||m.getLayout()?.getType()===`window`)&&e.addEventListener(`keydown`,m.onTabsetNavKeyDown),()=>{m.setGeometryResizeObserver(void 0),n.disconnect(),t.removeEventListener(`resize`,r),e.removeEventListener(`visibilitychange`,i),e.removeEventListener(`pointerdown`,m.onOverlayBorderPointerDown,!0),e.removeEventListener(`keydown`,m.onOverlayBorderKeyDown),e.removeEventListener(`keydown`,m.onTabsetNavKeyDown)}},[m,o]),d.useEffect(()=>{let e;if(!m.isMainLayout()&&m.getLayout().getType()===`window`){let t=m.getProps().mainLayoutController?.getRootDiv();if(t){let n=t,r=a.current;Ae(n,r),e=new MutationObserver(()=>{Ae(n,r)&&m.redrawLayout()}),e.observe(n,{attributeFilter:[`style`]})}}return()=>{e&&e.disconnect()}},[m]),d.useEffect(()=>{let t=e.model;if(h.setToExportRectFunction((e,t)=>t===`window`?m.getScreenRect(e):m.getRelativeRect(e)),m.setLayout(h),m.isMainLayout()){let e={onAfterAction:m.onModelChange};return t.addChangeListener(e),()=>{t.removeChangeListener(e)}}},[e.model,m,h]);let g=m.isMainLayout()?(0,f.jsxs)(`div`,{className:m.getClassName(T.FLEXLAYOUT__LAYOUT_METRICS),children:[(0,f.jsx)(`div`,{ref:l,className:m.getClassName(T.FLEXLAYOUT__BORDER_SIZER),children:`FindBorderBarSize`},`findBorderBarSize`),(0,f.jsx)(`div`,{ref:u,className:m.getClassName(T.FLEXLAYOUT__SPLITTER_+`horz`)},`findSplitterSize`)]}):null;if(!a.current)return(0,f.jsx)(`div`,{ref:a,className:m.getClassName(T.FLEXLAYOUT__LAYOUT),children:g});let _=e.model,v=m.getLayoutId();_.getRootRow(v).calcMinMaxSize(),_.getRootRow(v).setPaths(e.path||``),m.isMainLayout()&&_.getBorderSet().setPaths();let y=(0,f.jsx)(Ne,{controller:m,show:n.showOverlay},`__overlay__`),b=m.renderLayout(),x=(0,f.jsx)(ht,{controller:m,inner:b}),S=m.renderTabContainers(),w=m.reorderComponents(S,m.getOrderedTabIds()),E=null,D=null,O=null,k=null;return m.isMainLayout()&&(E=(0,f.jsx)(Ze,{controller:m}),D=m.reorderComponents(m.renderTabContents(),m.getOrderedTabMoveableIds()),O=(0,f.jsx)(`div`,{"aria-hidden":`true`,className:m.getClassName(T.FLEXLAYOUT__LAYOUT_TAB_STAMPS),children:m.renderDragTabButtons()},`__dragTabButtons__`),k=(0,f.jsx)(`div`,{ref:c,className:m.getClassName(T.FLEXLAYOUT__LAYOUT_MOVEABLES_HOME)},`__moveables_home__`)),(0,f.jsxs)(`div`,{ref:a,className:m.getClassName(T.FLEXLAYOUT__LAYOUT),onDragEnter:m.getDragDropManager().onDragEnterRaw,onDragLeave:m.getDragDropManager().onDragLeaveRaw,onDragOver:m.getDragDropManager().onDragOver,onDrop:m.getDragDropManager().onDrop,children:[g,k,y,x,w,D,E,O]})});Ht.displayName=`LayoutInternal`;var Ut=d.forwardRef((e,t)=>{let n=(0,d.useRef)(null),r=(0,d.useRef)(e.model),i=(0,d.useRef)(0);r.current!==e.model&&(e.model.getAdoptedFromModel()!==r.current&&i.current++,r.current=e.model),(0,d.useEffect)(()=>(e.model.setI18nDefaults(he),e.model.setI18nTranslator(e.i18nTranslator),()=>{e.model.setI18nDefaults(void 0),e.model.setI18nTranslator(void 0)}),[e.model,e.i18nTranslator]),Ut.displayName=`Layout`,(0,d.useImperativeHandle)(t,()=>({redraw:()=>{n.current?.redrawLayoutAndTabContent()},addTabToTabSet:(e,t)=>n.current?.addTabToTabSet(e,t),addTabWithDragAndDrop:(e,t,r)=>{n.current?.addTabWithDragAndDrop(e,t,r)},moveTabWithDragAndDrop:(e,t)=>{n.current?.moveTabWithDragAndDrop(e,t)},addTabToActiveTabSet:e=>n.current?.addTabToActiveTabSet(e),setDragComponent:(e,t,r,i)=>{n.current?.setDragComponent(e,t,r,i)},editTabName:e=>{let t=n.current?.getModel().getNodeById(e);t instanceof B&&t.isEnableRename()&&U(t.getLayout())?.setEditingTab(t)},getRootDiv:()=>n.current.getRootDiv()}));let a=(0,d.useRef)({}),o=e.invalidateTabContentOnParentRender===!1?a.current:{};return(0,f.jsx)(Ht,{ref:n,...e,parentRedrawRevision:o},i.current)});E.SET_ACTIVE_TABSET;var Wt=1.2,Gt=2.5;function Kt(e){let t=Number(e);return!Number.isFinite(t)||t<=0?`expanded`:t<2?`closed`:t<8?`collapsed`:`expanded`}function qt(e){let t=Number(e);return!Number.isFinite(t)||t<=0?16:t<.5?Wt:Jt(Kt(t)).weight}function Jt(e){return{weight:e===`closed`?Wt:e===`collapsed`?Gt:16,enableTabStrip:!1}}var Yt=e=>C.getByName(e);function Xt(e){let t=e||{};return Object.keys(t).filter(e=>t[e]!==void 0).sort().map(e=>`${e}=${String(t[e])}`).join(`|`)}function Zt(e,t,n){if(!e)return null;let r=Xt(n),i=null;return e.visitNodes(e=>{if(i||e.getType()!==`tab`)return;let n=e;n.getComponent()===t&&Xt(n.getConfig()||{})===r&&(i=n)}),i}function Qt(e){let t=[];return e.visitNodes(e=>{e.getType()===`tabset`&&t.push(e)}),t}function $t(e,t){if(!e)return null;let n=null;return e.visitNodes(e=>{if(n||e.getType()!==`tab`)return;let r=e;r.getComponent()===t&&(n=r)}),n}function en(e){if(!e)return null;let t=rn(e);if(!t)return null;let n=e.getNodeById(t);if(!n)return null;let r=typeof n.getSelectedTab==`function`?n.getSelectedTab():null,i=n.getTabNodes&&n.getTabNodes()||[],a=r||i[i.length-1]||null;return a?{component:a.getComponent()||``,name:a.getName(),config:a.getConfig()||{}}:null}function tn(e,t){return!t||!t.length?!1:(e.getTabNodes()||[]).some(e=>t.includes(e.getComponent()||``))}function nn(e,t=[]){let n=e.getActiveTabset()||e.getFirstTabSet();if(n&&!tn(n,t))return n.getId();let r=[...Qt(e)].reverse().find(e=>!tn(e,t));return r?r.getId():n?n.getId():void 0}function rn(e){if(!e)return null;let t=null;return e.visitNodes(e=>{if(t||e.getType()!==`tabset`)return;let n=e,r=n.getId();if(r===`ts_main`){t=r;return}r!==`ts_sidebar`&&r!==`ts_right`&&!tn(n,[`sidebar`])&&(t=r)}),t}var an=[`progress`,`refs`],on=[`dir`,`page`,`group`,`repos`,`doc`,`dag`,`compose`,`templates`];function sn(e){if(!e)return null;let t=null;return e.visitNodes(e=>{if(!t&&!String(e.getId()).startsWith(`float`)){if(e.getType()===`tabset`&&e.getId()===`ts_right`){t=e.getId();return}if(e.getType()===`tabset`&&typeof e.getTabNodes==`function`){let n=(e.getTabNodes()||[]).map(e=>e.getComponent()||``);if(n.some(e=>on.includes(e)))return;n.some(e=>an.includes(e))&&(t=e.getId())}}}),t}var cn=16,ln=0;function un(e,t){let n=sn(e);return n?bn(e,n,{weight:t?cn:ln,enableTabStrip:!1}):!1}function dn(e){if(!e)return;let t=[];e.visitNodes(e=>{e.getType()===`tab`&&e.getComponent()===`progress`&&t.push(e.getId())});for(let n of t)e.doAction(E.deleteTab(n));un(e,!1)}function fn(e,t){if(!e)return 0;let n=sn(e),r=[];e.visitNodes(e=>{if(e.getType()!==`tab`)return;let i=e;if(t&&i.getComponent()===t)return;let a=i.getParent();a&&a.getId()===n&&r.push(i.getId())});for(let t of r)e.doAction(E.deleteTab(t));return r.length}function pn(e,t){if(!e)return;let n=[];e.visitNodes(e=>{e.getType()===`tab`&&e.getComponent()===t&&n.push(e.getId())});for(let t of n)e.doAction(E.deleteTab(t));let r=sn(e),i=r?e.getNodeById(r):null;i&&(i.getTabNodes()||[]).length||un(e,!1)}function mn(e,{dirKey:t,groupId:n,task:r}={}){if(!e)return;let i=$t(e,`progress`);if(!i)return;fn(e,`progress`);let a=i.getConfig()||{},o=n?{groupKey:n}:{dirKey:t||``};r!=null&&String(r)!==``&&(o.task=String(r)),JSON.stringify(a)!==JSON.stringify(o)&&(e.doAction(E.updateNodeAttributes(i.getId(),{config:o})),(t||n)&&un(e,!0))}function hn(e,t=null){if(!e)return 0;let n=sn(e),r=[];e.visitNodes(e=>{if(e.getType()!==`tab`||t&&e.getId()===t)return;let i=e,a=i.getComponent();if(a===`sidebar`||an.includes(a||``))return;let o=i.getParent();if(!o||o.getType()!==`tabset`)return;let s=o.getId();s===`ts_sidebar`||n&&s===n||(typeof i.getWindowId!=`function`||i.getWindowId()!==`float`)&&r.push(i.getId())});for(let t of r)e.doAction(E.deleteTab(t));return r.length}function gn(e){if(!e)return 0;let t=[];e.visitNodes(e=>{e.getType()===`tab`&&(e.getConfig()||{}).beside&&t.push(e.getId())});for(let n of t)e.doAction(E.deleteTab(n));return t.length}function _n(e,t){if(!e||!t)return!1;let n=e.getNodeById(t);if(!n)return!1;let r=sn(e),i=n.getParent&&n.getParent()?n.getParent().getId():``;if(r&&i===r)return!1;if(r)return e.doAction(E.moveNode(t,r,Yt(`center`),-1,!0)),!0;let a=e.getRootRow?e.getRootRow():null;return a?(e.doAction(E.moveNode(t,a.getId(),Yt(`right`),-1,!0)),!0):!1}function vn(e,t){if(!e)return null;let n=[];e.visitNodes(e=>{if(n.length||e.getType()!==`tab`||e.getComponent()!==t)return;let r=e.getParent();r&&r.getType()===`tabset`&&n.push(r)});let r=n[0];return r?r.getId():null}function yn(e,t){if(!e||!t)return null;let n=null;return e.visitNodes(e=>{n===null&&e.getType()===`tabset`&&e.getId()===t&&(n=e.getWeight())}),n}function bn(e,t,n){if(!e||!t)return!1;let r=!1;return e.visitNodes(e=>{r||e.getType()===`tabset`&&e.getId()===t&&(r=!0)}),r?(e.doAction(E.updateNodeAttributes(t,n)),!0):!1}function xn(e){if(!e)return null;let t=vn(e,`sidebar`);if(t)return t;let n=e.getFirstTabSet&&e.getFirstTabSet(),r=n?n.getId():null;if(!r)return null;e.doAction(E.addTab({type:`tab`,id:`t_sidebar`,name:`目录`,component:`sidebar`,enableClose:!1},r,Yt(`left`),-1,!0));let i=vn(e,`sidebar`);return i&&bn(e,i,Jt(`expanded`)),i}function Sn(e){let t=e&&e.getActiveTabset();return t&&t.getSelectedNode()||null}var Cn={SIDEBAR:`sidebar`,MAIN:`maincontent`,RIGHT:`rightSidebar`,FLOAT:`float`},wn={sidebar:Cn.SIDEBAR,dir:Cn.MAIN,page:Cn.MAIN,group:Cn.MAIN,repos:Cn.MAIN,templates:Cn.MAIN,doc:Cn.MAIN,dag:Cn.MAIN,compose:Cn.MAIN,progress:Cn.RIGHT,refs:Cn.RIGHT,settings:Cn.FLOAT},Tn=new Set([`sidebar`,`repos`,`progress`,`refs`,`settings`]);function En(e){return wn[e]||Cn.MAIN}function Dn(e){return Tn.has(e)}var On=e=>C.getByName(e);function kn(e,t){let{component:n,name:r,config:i={}}=t||{};if(!e||!n)return{tabId:null,reused:!1};let a=rn(e);if(!a)return{tabId:null,reused:!1};let o={...i,beside:!0},s=Zt(e,n,o);if(s)return e.doAction(E.selectTab(s.getId())),r&&s.getName()!==r&&e.doAction(E.renameTab(s.getId(),r)),{tabId:s.getId(),reused:!0};gn(e),e.doAction(E.addTab({type:`tab`,name:r||n,component:n,config:o,enableClose:!0},a,On(`right`),-1,!0));let c=Zt(e,n,o);return{tabId:c?c.getId():null,reused:!1}}function An(e,t){let{component:n,config:r={}}=t,i=t.name??void 0;if(!e)return{tabId:null,reused:!1};let a=t.area||En(n),o=Zt(e,n,r);if(o)return e.doAction(E.selectTab(o.getId())),i&&o.getName()!==i&&e.doAction(E.renameTab(o.getId(),i)),a===Cn.RIGHT&&(_n(e,o.getId()),un(e,!0)),a===Cn.MAIN&&(n===`page`||n===`dir`)&&mn(e,{dirKey:r.dirKey,groupId:r.groupId,task:r.task}),{tabId:o.getId(),reused:!0};if(a===Cn.RIGHT&&Dn(n)){fn(e,n);let t=$t(e,n);if(t)return e.doAction(E.updateNodeAttributes(t.getId(),{config:r})),e.doAction(E.selectTab(t.getId())),i&&t.getName()!==i&&e.doAction(E.renameTab(t.getId(),i)),_n(e,t.getId()),un(e,!0),{tabId:t.getId(),reused:!0}}if(a===Cn.MAIN){let a=rn(e);if(!a)return{tabId:null,reused:!1};e.doAction(E.addTab({type:`tab`,name:i,component:n,config:r},a,On(`center`),-1,!0));let o=Zt(e,n,r);return o&&!t._float&&hn(e,o.getId()),o&&!t._float&&(n===`page`||n===`dir`)&&mn(e,{dirKey:r.dirKey,groupId:r.groupId,task:r.task}),{tabId:o?o.getId():null,reused:!1}}if(a===Cn.RIGHT){let t=sn(e);if(t){fn(e,n),un(e,!0),e.doAction(E.addTab({type:`tab`,name:i,component:n,config:r},t,On(`center`),-1,!0));let a=Zt(e,n,r);return{tabId:a?a.getId():null,reused:!1}}let a=e.getRootRow?e.getRootRow():null;if(a){e.doAction(E.addTab({type:`tab`,name:i,component:n,config:r},a.getId(),On(`right`),-1,!0));let t=Zt(e,n,r);return un(e,!0),{tabId:t?t.getId():null,reused:!1}}}if(a===Cn.FLOAT)return jn(e,{...t,component:n,name:i,config:r});let s=nn(e,[`sidebar`]);if(!s)return{tabId:null,reused:!1};let c=On(t.location||`center`);e.doAction(E.addTab({type:`tab`,name:i,component:n,config:r},s,c,-1,!0));let l=Zt(e,n,r);return{tabId:l?l.getId():null,reused:!1}}function jn(e,t){if(!e)return{tabId:null,reused:!1};let n=e,r=Zt(e,t.component,t.config||{});if(r)return e.doAction(E.selectTab(r.getId())),{tabId:r.getId(),reused:!0};let i=rn(e);if(!i)return{tabId:null,reused:!1};let a=n.nextUniqueId(),o=[E.addTab({type:`tab`,id:a,name:t.name||t.component,component:t.component,config:t.config||{}},i,On(`center`),-1,!0),E.popoutTab(a,`float`)];e.doAction(E.group(o));let s=typeof window<`u`?window.innerWidth:1280,c=typeof window<`u`?window.innerHeight:800,l=Math.min(1295,Math.max(560,s-160)),u=Math.min(857,Math.max(460,c-160));for(let[,t]of n.getLayouts()){if(t.getType()!==`float`)continue;let n=t.getRect(),r=new x(Math.round(n.x+(n.width-l)/2),Math.round(n.y+(n.height-u)/2),l,u);e.doAction(E.moveFloat(t.getLayoutId(),r))}return{tabId:a,reused:!1}}var Mn=[{id:`new`,label:`新建页`,icon:`plus`,section:`primary`,noHide:!0},{id:`import`,label:`导入`,icon:`import`,section:`bar`},{id:`progress`,label:`进程`,icon:`progress`,section:`bar`},{id:`orch`,label:`编排`,icon:`flow`,section:`bar`},{id:`plan`,label:`草稿态`,icon:`pin`,section:`bar`},{id:`more`,label:`更多`,icon:`dots`,section:`bar`,noHide:!0},{id:`refs`,label:`查看列表`,icon:`list`,section:`more`},{id:`getloop`,label:`持续 get`,icon:`refresh`,section:`more`}],Nn=[{id:`new`,label:`新增任务`,icon:`plus`,section:`primary`,noHide:!0},{id:`import`,label:`导入`,icon:`import`,section:`bar`},{id:`progress`,label:`进程`,icon:`progress`,section:`bar`},{id:`addMember`,label:`添加成员`,icon:`users`,section:`bar`},{id:`orch`,label:`编排`,icon:`flow`,section:`bar`},{id:`plan`,label:`草稿态`,icon:`pin`,section:`bar`},{id:`more`,label:`更多`,icon:`dots`,section:`bar`,noHide:!0},{id:`refs`,label:`查看列表`,icon:`list`,section:`more`},{id:`getloop`,label:`持续 get`,icon:`refresh`,section:`more`}],Pn=[{id:`new`,label:`新任务`,icon:`plus`,section:`primary`,noHide:!0},{id:`submit`,label:`提交`,icon:`send`,section:`primary`,noHide:!0},{id:`more`,label:`更多`,icon:`dots`,section:`bar`,noHide:!0},{id:`mode`,label:`源码模式`,icon:`code`,section:`more`,menuGroup:`edit`},{id:`img`,label:`插入图片`,icon:`img`,section:`more`,menuGroup:`edit`},{id:`att`,label:`添加附件`,icon:`clip`,section:`more`,menuGroup:`edit`},{id:`import`,label:`导入`,icon:`import`,section:`more`,menuGroup:`edit`},{id:`draft`,label:`存草稿`,icon:`save`,section:`more`,menuGroup:`edit`},{id:`chain`,label:`任务链`,icon:`chain`,section:`more`,menuGroup:`task`},{id:`clone`,label:`克隆任务`,icon:`copy`,section:`more`,menuGroup:`task`},{id:`fork`,label:`Fork 任务`,icon:`fork`,section:`more`,menuGroup:`task`},{id:`plan`,label:`转为草稿`,icon:`pin`,section:`more`,menuGroup:`task`},{id:`complete`,label:`标为完成`,icon:`check`,section:`more`,menuGroup:`task`},{id:`cancel-task`,label:`取消任务`,icon:`ban`,section:`more`,menuGroup:`task`,danger:!0},{id:`mark`,label:`评论`,icon:`comment`,section:`more`,menuGroup:`task`},{id:`delete`,label:`删除`,icon:`trash`,section:`more`,menuGroup:`task`,danger:!0},{id:`preview`,label:`预览提示词`,icon:`eye`,section:`more`,menuGroup:`view`},{id:`prog`,label:`进程`,icon:`progress`,section:`more`,menuGroup:`view`},{id:`source`,label:`原文`,icon:`doc`,section:`more`,menuGroup:`view`},{id:`shortcuts`,label:`快捷键`,icon:`keyboard`,section:`more`,menuGroup:`view`}],Fn=[{id:`save`,label:`保存`,icon:`save`,section:`primary`,noHide:!0},{id:`more`,label:`更多`,icon:`dots`,section:`bar`,noHide:!0},{id:`mode`,label:`源码模式`,icon:`code`,section:`more`,menuGroup:`edit`},{id:`rename`,label:`重命名`,icon:`rename`,section:`more`,menuGroup:`doc`},{id:`delete`,label:`删除`,icon:`trash`,section:`more`,menuGroup:`doc`,danger:!0},{id:`list`,label:`文字列表`,icon:`list`,section:`more`,menuGroup:`view`}],In=[{id:`add`,label:`登记仓库`,icon:`plus`,section:`primary`,noHide:!0},{id:`more`,label:`更多`,icon:`dots`,section:`bar`,noHide:!0},{id:`boards`,label:`分组管理`,icon:`board`,section:`more`,menuGroup:`manage`},{id:`refs`,label:`参考仓库管理`,icon:`repo-ref`,section:`more`,menuGroup:`manage`},{id:`transfer`,label:`导入导出`,icon:`transfer`,section:`more`,menuGroup:`manage`}],Ln=[{id:`edit`,label:`编辑`,icon:`edit`,section:`bar`},{id:`open`,label:`打开`,icon:`open`,section:`bar`},{id:`del`,label:`删除`,icon:`trash`,section:`bar`,danger:!0},{id:`more`,label:`更多`,icon:`dots`,section:`bar`,noHide:!0},{id:`remote`,label:`对齐 remote`,icon:`remote`,section:`more`,menuGroup:`repo`}],Rn={dir:Object.fromEntries(Mn.map(e=>[e.id,e])),group:Object.fromEntries(Nn.map(e=>[e.id,e])),task:Object.fromEntries(Pn.map(e=>[e.id,e])),doc:Object.fromEntries(Fn.map(e=>[e.id,e])),repos:Object.fromEntries(In.map(e=>[e.id,e])),"repos-row":Object.fromEntries(Ln.map(e=>[e.id,e]))};function zn(e){return e===`group`?Nn:e===`task`?Pn:e===`doc`?Fn:e===`repos`?In:e===`repos-row`?Ln:Mn}function Bn(e,t){return Rn[e]&&Rn[e][t]||{}}function Vn(e,t){let n=Bn(e,t);return String(n.section||``).startsWith(`more`)||!!n.defaultInMore}function Hn(e,t){return Bn(e,t.id).noHide?!0:t.visible===void 0?!Vn(e,t.id):t.visible!==!1}function Un(e,t){return t.id===`more`||Bn(e,t.id).noHide?!1:!Hn(e,t)}function Wn(e,t){let n=zn(e),r=new Set(n.map(e=>e.id)),i=new Set,a=[];for(let n of t||[]){if(!n||!n.id||!r.has(n.id)||i.has(n.id))continue;i.add(n.id);let t=Bn(e,n.id);a.push(t.noHide?{...n,visible:!0}:n)}for(let t of n)i.has(t.id)||a.push({id:t.id,visible:t.noHide?!0:!Vn(e,t.id)});let o=a.findIndex(e=>e.id===`more`);if(o>=0&&o<a.length-1){let[t]=a.splice(o,1),n=a.length;for(let t=0;t<a.length;t++){let r=a[t];if(r&&Vn(e,r.id)&&!Hn(e,r)){n=t;break}}t&&a.splice(n,0,t)}return a}function Gn(e){return Wn(e,zn(e).map(t=>({id:t.id,visible:t.noHide?!0:!Vn(e,t.id)})))}var Kn=e=>`nx-kv-tb-${e}`;function qn(e){let[t,n]=(0,d.useState)(()=>{try{let t=JSON.parse(localStorage.getItem(Kn(e))??`null`);if(Array.isArray(t))return Wn(e,t)}catch{}return Gn(e)});return(0,d.useEffect)(()=>{try{localStorage.setItem(Kn(e),JSON.stringify(t))}catch{}},[t,e]),{layout:t,setLayout:n,resetLayout:()=>n(Gn(e))}}function Jn(e,t){return!!Bn(e,t).lockLast}function Yn(e,t,n){return e.map(e=>e.id===t?{...e,...n}:e)}function Xn(e,t,{id:n,anchorId:r=null,after:i=!1,visible:a}){let o=t.findIndex(e=>e.id===n);if(o<0||Jn(e,n))return t;let s={...t[o]};a!==void 0&&(s.visible=Bn(e,n).noHide?!0:!!a);let c=t.filter((e,t)=>t!==o),l;if(r===n)l=o;else if(r){let e=c.findIndex(e=>e.id===r);l=e<0?c.length:e+ +!!i}else{let e=c.findIndex(e=>e.id===`more`);l=e>=0?e:c.length}let u=c.findIndex(t=>Jn(e,t.id));u>=0&&l>u&&(l=u);let d=c.slice();return d.splice(l,0,s),d}function Zn(e,t,n,r){let i=t.filter(t=>Hn(e,t)&&!Jn(e,t.id)),a=i.findIndex(e=>e.id===n);if(a<0)return t;let o=a+r;if(o<0||o>=i.length)return t;let s=i[o];return Xn(e,t,{id:n,anchorId:s.id,after:r>0})}function Qn({kind:t,layout:n,setLayout:r,onClose:i}){let[a,o]=(0,d.useState)(()=>n.map(e=>({...e}))),[s,c]=(0,d.useState)(null),[l,u]=(0,d.useState)(null),p=(0,d.useRef)(null),m=a.filter(e=>Hn(t,e)),h=a.filter(e=>Un(t,e)),g=m.filter(e=>!Jn(t,e.id)),_=()=>{let e=p.current;return e&&!Jn(t,e.id)?e:null},v=(e,n)=>{Jn(t,n.id)||(p.current={id:n.id,onBar:Hn(t,n)},u(n.id),e.dataTransfer&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,n.id)))},y=()=>{p.current=null,u(null),c(null)},b=(e,n)=>{o(r=>Xn(t,r,{...n,id:e.id,visible:e.onBar===!1||n.visible}))},x=e=>{let t=e.clientY;for(let n of e.currentTarget.querySelectorAll(`[data-row-id]`)){let e=n.getBoundingClientRect(),r=n.dataset.rowId??null;if(t<e.top)return{anchorId:r,after:!1};if(t<=e.bottom)return{anchorId:r,after:t>e.top+e.height/2}}return{anchorId:null,after:!1}},S=e=>{let t=_();if(!t)return;e.preventDefault();let n=x(e);c(n.anchorId?n.anchorId===t.id?null:`row:${n.anchorId}:${n.after?`after`:`before`}`:`zone:bar:end`)},C=e=>{e.preventDefault();let t=x(e),n=_();y(),n&&b(n,{anchorId:t.anchorId,after:t.after,visible:!0})},w=e=>{e.currentTarget.contains(e.relatedTarget)||c(e=>e&&e.startsWith(`zone:`)?null:e)},T=e=>{let n=_();n&&!Bn(t,n.id).noHide&&(e.preventDefault(),c(`menu`))},E=e=>{e.preventDefault();let n=_();y(),n&&!Bn(t,n.id).noHide&&o(e=>Yn(e,n.id,{visible:!1}))},D=e=>{e.currentTarget.contains(e.relatedTarget)||c(e=>e===`menu`?null:e)},O=e=>{let t=e.currentTarget.getBoundingClientRect();return(e.clientX-t.left)/(t.width||1)>.5},k=(e,t)=>{let n=_();n&&n.id!==e.id&&(t.preventDefault(),c(`chip:${e.id}:${O(t)?`after`:`before`}`))},A=(e,t)=>{let n=O(t);t.preventDefault();let r=_();y(),r&&b(r,{anchorId:e.id,after:n,visible:!0})},j=e=>{Bn(t,e).noHide||o(n=>{let r=n.find(t=>t.id===e);return Yn(n,e,{visible:!(r&&Hn(t,r))})})},M=(e,n)=>o(r=>Zn(t,r,e.id,n)),N=(e,t)=>{t.altKey&&(t.key===`ArrowUp`?(t.preventDefault(),M(e,-1)):t.key===`ArrowDown`&&(t.preventDefault(),M(e,1)))},ee=()=>{r(a),i()},P=()=>o(Gn(t)),te=(e,n)=>{let r=s===`row:${e.id}:before`?` drop-before`:s===`row:${e.id}:after`?` drop-after`:``;return[`tlp-row`,n?``:`off`,Jn(t,e.id)?`lock`:``,l===e.id?`dragging`:``,r].filter(Boolean).join(` `)};return(0,f.jsxs)(`div`,{className:`tlp-panel`,role:`dialog`,"aria-label":`自定义工具栏`,children:[(0,f.jsxs)(`div`,{className:`tlp-head`,children:[(0,f.jsx)(`b`,{children:`自定义工具栏`}),(0,f.jsx)(`span`,{className:`tlp-head-sub`,children:`拖拽排序;关显隐 → 收入「更多」`})]}),(0,f.jsxs)(`div`,{className:`tlp-body`,children:[(0,f.jsxs)(`div`,{className:`tlp-section tlp-span`,children:[(0,f.jsx)(`div`,{className:`tlp-section-label`,children:`预览(可直接拖动这里的按钮排序)`}),(0,f.jsx)(`div`,{className:`tlp-preview`,role:`list`,"data-testid":`tlp-preview`,children:m.map(n=>{let r=Bn(t,n.id),i=s===`chip:${n.id}:before`?` drop-before`:s===`chip:${n.id}:after`?` drop-after`:``;return(0,f.jsxs)(`span`,{className:[`tlp-chip`,r.section===`primary`?`primary`:``,l===n.id?`dragging`:``,i].filter(Boolean).join(` `),draggable:!Jn(t,n.id),role:`listitem`,onDragStart:e=>v(e,n),onDragEnd:y,onDragOver:e=>k(n,e),onDrop:e=>A(n,e),children:[r.icon?(0,f.jsx)(e,{name:r.icon,size:12}):null,r.label||n.id]},n.id)})})]}),(0,f.jsxs)(`div`,{className:`tlp-section`,children:[(0,f.jsx)(`div`,{className:`tlp-section-label`,children:`工具栏 · 拖进来即排序(行上/下半 = 前/后)`}),(0,f.jsxs)(`div`,{className:`tlp-list`+(s===`zone:bar:end`?` drop-on`:``),role:`list`,onDragOver:S,onDragLeave:w,onDrop:C,children:[g.length===0&&m.every(e=>Jn(t,e.id))?(0,f.jsx)(`div`,{className:`tlp-empty`,children:`空 —— 把「更多」里的项拖到这里`}):null,m.map(n=>{let r=Bn(t,n.id),i=g.findIndex(e=>e.id===n.id);return(0,f.jsxs)(`div`,{className:te(n,!0),draggable:!Jn(t,n.id),"data-row-id":n.id,tabIndex:Jn(t,n.id)?void 0:0,role:`listitem`,"aria-label":`${r.label||n.id}:拖动排序,Alt+上下换位`,onKeyDown:e=>N(n,e),onDragStart:e=>v(e,n),onDragEnd:y,children:[(0,f.jsx)(`span`,{className:`tlp-hnd`,title:Jn(t,n.id)?`锁定`:`拖动排序`,children:Jn(t,n.id)?`·`:`⋮⋮`}),(0,f.jsx)(`input`,{type:`checkbox`,checked:!0,disabled:!!r.noHide,onChange:()=>j(n.id),title:r.noHide?`不可隐藏`:`收入「更多」`}),(0,f.jsxs)(`span`,{className:`tlp-nm`,children:[(0,f.jsx)(`span`,{className:`tlp-nm-ico`,children:r.icon?(0,f.jsx)(e,{name:r.icon,size:13}):null}),r.label||n.id,r.noHide?(0,f.jsx)(`span`,{className:`tlp-sub`,children:`固定显示`}):null]}),Jn(t,n.id)?null:(0,f.jsxs)(`span`,{className:`tlp-acts`,children:[(0,f.jsx)(`button`,{type:`button`,className:`btn ghost sm`,disabled:i<=0,title:`上移`,onClick:()=>M(n,-1),children:`↑`}),(0,f.jsx)(`button`,{type:`button`,className:`btn ghost sm`,disabled:i<0||i>=g.length-1,title:`下移`,onClick:()=>M(n,1),children:`↓`})]})]},n.id)})]})]}),(0,f.jsxs)(`div`,{className:`tlp-section`,children:[(0,f.jsx)(`div`,{className:`tlp-section-label`,children:`更多菜单(拖到上方 = 显示到工具栏;拖回这里 = 收入更多)`}),(0,f.jsxs)(`div`,{className:`tlp-list tlp-menu`+(s===`menu`?` dropping`:``),role:`list`,onDragOver:T,onDragLeave:D,onDrop:E,children:[h.map(n=>{let r=Bn(t,n.id);return(0,f.jsxs)(`div`,{className:te(n,!1),draggable:!0,role:`listitem`,onDragStart:e=>v(e,n),onDragEnd:y,children:[(0,f.jsx)(`span`,{className:`tlp-hnd`,title:`拖到上方工具栏 = 显示`,children:`⋮⋮`}),(0,f.jsx)(`input`,{type:`checkbox`,checked:!1,onChange:()=>j(n.id),title:`显示到工具栏`}),(0,f.jsxs)(`span`,{className:`tlp-nm`,children:[r.icon?(0,f.jsx)(`span`,{className:`tlp-nm-ico`,children:(0,f.jsx)(e,{name:r.icon,size:13})}):null,r.label||n.id]})]},n.id)}),(0,f.jsx)(`div`,{className:`tlp-drop-hint`,role:`presentation`,children:s===`menu`?`松手 = 收入「更多」`:h.length?`把项拖到上方工具栏区域 = 显示到工具栏`:`工具栏上的按钮拖到这里即可收入「更多」`})]})]})]}),(0,f.jsxs)(`div`,{className:`tlp-foot`,children:[(0,f.jsx)(`span`,{className:`tlp-equiv`,children:`保存到本机 localStorage(每种工具区各存一份)`}),(0,f.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:P,children:`恢复默认`}),(0,f.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:i,children:`取消`}),(0,f.jsx)(`button`,{type:`button`,className:`btn sm primary`,onClick:ee,children:`保存`})]})]})}var $n=`task`,er=[{id:`edit`,label:`编辑`},{id:`task`,label:`任务`},{id:`view`,label:`查看`}];function tr(){let[e,t]=(0,d.useState)(!1),[n,r]=(0,d.useState)({x:0,y:0}),i=(0,d.useRef)(null),a=(0,d.useRef)(null);return(0,d.useEffect)(()=>{if(!e)return;let n=e=>{let n=e.target;i.current?.contains(n)||a.current?.contains(n)||t(!1)};return document.addEventListener(`mousedown`,n),()=>document.removeEventListener(`mousedown`,n)},[e]),{open:e,setOpen:t,pos:n,setPos:r,ref:i,menuRef:a}}function nr({menu:e,className:t=``,style:n,children:r}){return e.open?(0,p.createPortal)((0,f.jsx)(`div`,{className:`mdw-fmt-menu${t?` ${t}`:``}`,role:`menu`,ref:e.menuRef,style:{position:`fixed`,...e.pos,...n},children:r}),document.body):null}function rr(e,t,n=`left`){let r=t.currentTarget.getBoundingClientRect(),i=r.bottom+4;e.setPos(n===`left`?{left:r.left,top:i}:{left:`auto`,right:Math.max(8,window.innerWidth-r.right),top:i}),e.setOpen(e=>!e)}function ir({mode:t,onMode:n,showMark:r,submitLabel:i,onNew:a,onSubmit:o,onChain:s,onPreview:c,onImg:l,onAtt:u,onImport:m,onClone:h,onFork:g,onComplete:_,onPlan:v,planLabel:y,onCancelTask:b,onMark:x,onDraft:S,onDelete:C,onProg:w,onSource:T,onShortcuts:E,goalBadge:D,goalMenu:O}){let k=tr(),{layout:A,setLayout:j}=qn($n),[M,N]=(0,d.useState)(!1);(0,d.useEffect)(()=>{k.setOpen(!1)},[t]);let ee={new:a&&{label:`新任务`,run:a},submit:{label:i||`提交`,run:o,primary:!0},mode:n&&{label:t===`edit`?`返回实时预览`:`源码模式`,hint:t===`edit`?`当前`:``,run:()=>n?.(t===`edit`?`split`:`edit`)},img:l&&{label:`插入图片`,run:l},att:u&&{label:`添加附件`,run:u},import:m&&t!==`split`?{label:`导入`,run:m}:null,draft:S&&t!==`split`?{label:`存草稿`,run:S}:null,chain:s&&{label:`任务链`,run:s},clone:h&&{label:`克隆任务`,run:h},fork:g&&{label:`Fork 任务`,run:g},complete:_&&{label:`标为完成`,run:_},plan:v&&{label:y||`转为草稿(plan)`,run:v,hint:`不进队列`},"cancel-task":b&&{label:`取消任务`,run:b,danger:!0},mark:r&&x?{label:`评论`,run:x}:null,delete:C&&{label:`删除`,run:C,danger:!0},preview:c&&{label:`预览提示词`,run:c},prog:w&&{label:`进程`,run:w},source:T&&{label:`原文`,run:T},shortcuts:E&&{label:`快捷键`,run:E}},P=e=>e===`more`||!!ee[e],te=A.filter(e=>Hn($n,e)&&P(e.id)),ne=A.filter(e=>Un($n,e)&&P(e.id)),re=e=>{ee[e]?.run?.(),k.setOpen(!1)},ie=t=>{if(t===`more`)return(0,f.jsx)(`div`,{className:`mdw-actions-more`,ref:k.ref,children:(0,f.jsxs)(`button`,{type:`button`,className:`btn ghost sm${k.open?` on`:``}`,title:`更多操作`,"aria-expanded":k.open,"aria-haspopup":`menu`,onClick:e=>rr(k,e,`right`),children:[(0,f.jsx)(e,{name:`dots`}),`更多`]})},`more`);let n=ee[t];if(!n)return null;let r=Bn($n,t);return(0,f.jsxs)(`button`,{type:`button`,className:n.primary?`btn sm primary`:`btn ghost sm`,onClick:()=>re(t),children:[r.icon?(0,f.jsx)(e,{name:r.icon}):null,n.label]},t)},ae=er.map(e=>({...e,items:ne.filter(t=>Bn($n,t.id).menuGroup===e.id)})).filter(e=>e.items.length),oe=ne.filter(e=>!Bn($n,e.id).menuGroup);return(0,f.jsxs)(`div`,{className:`mdw-toolbar`,children:[(0,f.jsx)(`div`,{className:`mdw-toolbar-left`,children:D&&(0,f.jsx)(`button`,{type:`button`,className:`mdw-goal-badge`,title:D.title,"aria-haspopup":`menu`,"aria-expanded":k.open,onClick:e=>rr(k,e,`right`),children:D.label})}),(0,f.jsxs)(`div`,{className:`mdw-actions`,role:`group`,"aria-label":`任务操作`,children:[te.map(e=>ie(e.id)),(0,f.jsxs)(nr,{menu:k,className:`mdw-act-menu`,children:[O,O&&(0,f.jsx)(`div`,{className:`mdw-fmt-menu-sep`,role:`separator`}),ae.map(t=>(0,f.jsxs)(`div`,{className:`mdw-fmt-menu-group`,role:`group`,"aria-label":t.label,children:[(0,f.jsx)(`div`,{className:`mdw-fmt-menu-cap`,children:t.label}),t.items.map(t=>{let n=ee[t.id],r=n?.danger||Bn($n,t.id).danger,i=Bn($n,t.id);return(0,f.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`mdw-fmt-menu-item`+(r?` danger`:``),onClick:()=>re(t.id),children:[i.icon?(0,f.jsx)(e,{name:i.icon}):null,n?.label||Bn($n,t.id).label||t.id,n?.hint?(0,f.jsx)(`span`,{className:`hint`,children:n.hint}):null]},t.id)})]},t.id)),oe.map(t=>{let n=ee[t.id],r=Bn($n,t.id);return(0,f.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`mdw-fmt-menu-item`+(n?.danger||Bn($n,t.id).danger?` danger`:``),onClick:()=>re(t.id),children:[r.icon?(0,f.jsx)(e,{name:r.icon}):null,n?.label||Bn($n,t.id).label||t.id]},t.id)}),(0,f.jsx)(`div`,{className:`mdw-fmt-menu-sep`,role:`separator`}),(0,f.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`mdw-fmt-menu-item`,onClick:()=>{k.setOpen(!1),N(!0)},children:[(0,f.jsx)(e,{name:`gear`}),`自定义工具栏…`]})]})]}),M&&(0,p.createPortal)((0,f.jsx)(`div`,{className:`ta-panel-mask`,onClick:()=>N(!1),children:(0,f.jsx)(`div`,{className:`ta-panel-wrap`,onClick:e=>e.stopPropagation(),children:(0,f.jsx)(Qn,{kind:$n,layout:A,setLayout:j,onClose:()=>N(!1)})})}),document.body)]})}export{pe as A,yn as C,E as D,Jt as E,u as M,c as N,C as O,vn as S,qt as T,en as _,Qn as a,xn as b,Bn as c,jn as d,An as f,Xt as g,dn as h,tr as i,H as j,Ut as k,Hn as l,pn as m,ir as n,qn as o,Sn as p,rr as r,Un as s,nr as t,kn as u,$t as v,Kt as w,bn as x,Zt as y};