react-zeugma 6.7.1 → 6.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -6
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +5 -1
- package/dist/utils.d.ts +5 -1
- package/dist/utils.js +1 -1
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,8 +27,8 @@ const initialLayout: TreeNode = {
|
|
|
27
27
|
type: 'split',
|
|
28
28
|
direction: 'row',
|
|
29
29
|
splitPercentage: 30,
|
|
30
|
-
first: { type: 'pane', id: 'left-panel',
|
|
31
|
-
second: { type: 'pane', id: 'right-panel',
|
|
30
|
+
first: { type: 'pane', id: 'left-panel', tabIds: ['left-panel'], activeTabId: 'left-panel' },
|
|
31
|
+
second: { type: 'pane', id: 'right-panel', tabIds: ['right-panel'], activeTabId: 'right-panel' },
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
// 2. Build your custom pane wrapper
|
|
@@ -201,7 +201,7 @@ A helper component to render and reorder a list of tabs inside a pane.
|
|
|
201
201
|
```tsx
|
|
202
202
|
import { Tabs } from 'react-zeugma'
|
|
203
203
|
;<Tabs
|
|
204
|
-
|
|
204
|
+
tabIds={['tab1', 'tab2']}
|
|
205
205
|
activeTabId="tab1"
|
|
206
206
|
selectTab={(tabId) => console.log('Select tab:', tabId)}
|
|
207
207
|
removeTab={(tabId) => console.log('Close tab:', tabId)}
|
|
@@ -229,7 +229,7 @@ import { Tabs } from 'react-zeugma'
|
|
|
229
229
|
|
|
230
230
|
| Property | Description | Type | Default |
|
|
231
231
|
| -------------- | ------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------- |
|
|
232
|
-
| `
|
|
232
|
+
| `tabIds` | Array of tab IDs. | `string[]` | - |
|
|
233
233
|
| `activeTabId` | The currently active tab ID. | `string` | - |
|
|
234
234
|
| `locked` | Whether tab dragging/reordering is disabled. | `boolean` | `false` |
|
|
235
235
|
| `tabsMetadata` | Metadata mapping associated with each tab in the pane. | `Record<string, Record<string, unknown>>` | - |
|
|
@@ -327,7 +327,7 @@ import { usePaneContext } from 'react-zeugma'
|
|
|
327
327
|
|
|
328
328
|
const {
|
|
329
329
|
id,
|
|
330
|
-
|
|
330
|
+
tabIds,
|
|
331
331
|
activeTabId,
|
|
332
332
|
isDragging,
|
|
333
333
|
isFullscreen,
|
|
@@ -344,7 +344,7 @@ const {
|
|
|
344
344
|
| Property / Method | Description | Type |
|
|
345
345
|
| ------------------- | --------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
|
|
346
346
|
| `id` | The ID of the current pane. | `string` |
|
|
347
|
-
| `
|
|
347
|
+
| `tabIds` | List of tab IDs inside the pane. | `string[]` |
|
|
348
348
|
| `activeTabId` | Currently active tab ID. | `string` |
|
|
349
349
|
| `isDragging` | `true` if this pane is being dragged. | `boolean` |
|
|
350
350
|
| `isFullscreen` | `true` if this pane is maximized. | `boolean` |
|
|
@@ -400,6 +400,7 @@ import {
|
|
|
400
400
|
selectTab,
|
|
401
401
|
mergeTab,
|
|
402
402
|
moveTab,
|
|
403
|
+
movePaneTabs,
|
|
403
404
|
findPaneById,
|
|
404
405
|
findPaneContainingTab,
|
|
405
406
|
findTabById,
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var Dn=require('react'),core=require('@dnd-kit/core'),jsxRuntime=require('react/jsx-runtime'),reactDom=require('react-dom');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Dn__default=/*#__PURE__*/_interopDefault(Dn);function ut({cursor:e,resizerEl:t,onMove:n,onEnd:r}){document.body.classList.add("zeugma-resizing");let o=document.createElement("style");o.id="zeugma-global-cursor-style",o.textContent=`
|
|
2
2
|
* {
|
|
3
3
|
cursor: ${e} !important;
|
|
4
4
|
user-select: none !important;
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
.zeugma-resizing *:not([role="separator"]) {
|
|
7
7
|
pointer-events: none !important;
|
|
8
8
|
}
|
|
9
|
-
`,document.head.appendChild(o),t.setAttribute("data-resizing","true");let i=s=>{n(s);},a=()=>{document.body.classList.remove("zeugma-resizing"),t.removeAttribute("data-resizing");let s=document.getElementById("zeugma-global-cursor-style");s&&s.remove(),document.removeEventListener("pointermove",i),document.removeEventListener("pointerup",a),r();};document.addEventListener("pointermove",i),document.addEventListener("pointerup",a);}function Se(e){try{return JSON.stringify(e)}catch{return ""}}var Ke=yn.createContext(void 0),je=yn.createContext(void 0),ge=yn.createContext(void 0),Qe=yn.createContext(void 0),oe=()=>{let e=yn.useContext(Ke);if(!e)throw new Error("useZeugmaState must be used within a Zeugma provider");return e},ze=()=>{let e=yn.useContext(je);if(!e)throw new Error("useZeugmaActions must be used within a Zeugma provider");return e},$e=()=>{let e=yn.useContext(Qe);if(!e)throw new Error("useZeugmaDrag must be used within a Zeugma provider");return e};function pt(e){let t=yn.useRef(null);return yn.useEffect(()=>{if(!e){t.current=null;return}let n=o=>{t.current={x:o.clientX,y:o.clientY};},r=o=>{let i=o.touches[0]||o.changedTouches[0];i&&(t.current={x:i.clientX,y:i.clientY});};return window.addEventListener("pointermove",n,{passive:true}),window.addEventListener("touchmove",r,{passive:true}),()=>{window.removeEventListener("pointermove",n),window.removeEventListener("touchmove",r);}},[e]),t}function ft(e){yn.useEffect(()=>(e?document.body.style.setProperty("cursor","not-allowed","important"):document.body.style.removeProperty("cursor"),()=>{document.body.style.removeProperty("cursor");}),[e]);}function gt(){let[e,t]=yn.useState({}),n=yn.useRef({}),r=yn.useRef(null),o=yn.useRef({}),i=yn.useRef(null),a=yn.useRef(true);yn.useEffect(()=>(a.current=true,()=>{a.current=false;}),[]);let s=yn.useCallback((f,m)=>{a.current&&t(b=>{if(!m){if(!b[f])return b;let C={...b};return delete C[f],C}return b[f]===m?b:{...b,[f]:m}});},[]),c=yn.useCallback((f,m)=>{n.current[f]=m;},[]),d=yn.useCallback(f=>{r.current=f;},[]),p=yn.useCallback((f,m)=>{o.current[f]=m;},[]);return {portalTargets:e,registerPortalTarget:s,registerRenderCallback:c,renderCallbacksRef:n,registerRenderPane:d,renderPaneRef:r,registerTabHeader:p,tabHeadersRef:o,activeIdRef:i}}function cn(e){let t=new Set;function n(r){r&&(r.type==="pane"?r.tabIds.forEach(o=>{t.add(o);}):r.type==="split"&&(n(r.first),n(r.second)));}return n(e),Array.from(t).sort()}function mt(e){return yn.useMemo(()=>cn(e),[e])}function bt(e){let{onDragStart:t,onDragEnd:n}=e,[r,o]=yn.useState(null),[i,a]=yn.useState(null),s=yn.useCallback(d=>{t&&t(d);},[t]),c=yn.useCallback((d,p,f)=>{n&&n(d,p,f);},[n]);return {overTabId:r,setOverTabId:o,overTabPosition:i,setOverTabPosition:a,handleDragStartInternal:s,handleDragEndInternal:c}}function vt(e){let n=yn.useContext(ge)?.registerRenderPane;yn.useEffect(()=>{n&&e&&n(e);},[n,e]);}function le(){return "pane-"+Math.random().toString(36).substring(2,11)}function fe(e,t){if(e===null)return null;if(e.type==="pane")return e.id===t?null:e;let n=fe(e.first,t),r=fe(e.second,t);return n===null?r:r===null?n:{...e,first:n,second:r}}function ce(e,t){if(e===null)return null;if(e.type==="pane"){if(e.tabIds.includes(t)){let o=e.tabIds.filter(s=>s!==t);if(o.length===0)return null;let i=e.activeTabId;e.activeTabId===t&&(i=o[0]);let a={...e.tabsMetadata};return delete a[t],{...e,tabIds:o,activeTabId:i,tabsMetadata:Object.keys(a).length>0?a:void 0}}return e}let n=ce(e.first,t),r=ce(e.second,t);return n===null?r:r===null?n:{...e,first:n,second:r}}function xe(e,t,n,r,o){if(e===null)return typeof o=="string"?{type:"pane",id:le(),tabIds:[o],activeTabId:o}:o;if(e.type==="pane"){if(e.id===t){let i=typeof o=="string"?{type:"pane",id:le(),tabIds:[o],activeTabId:o}:o,a=r==="left"||r==="top";return {type:"split",direction:n,first:a?i:e,second:a?e:i,splitPercentage:50}}return e}return {...e,first:xe(e.first,t,n,r,o)||e.first,second:xe(e.second,t,n,r,o)||e.second}}function dn(e,t){if(e===null)return t;function n(r,o){return r.type==="pane"?{type:"split",direction:o==="row"?"column":"row",splitPercentage:50,first:r,second:t}:{...r,second:n(r.second,r.direction)}}return n(e,null)}function ht(e,t,n,r){if(e===null)return {type:"pane",id:le(),tabIds:[n],activeTabId:n,tabsMetadata:r?{[n]:r}:void 0};let o=t?ee(e,t):null;if(o&&o.type==="pane"){let s=function(c){if(c.type==="pane"&&c.id===t){let d=[...c.tabIds];d.includes(n)||d.push(n);let p=c.tabsMetadata;return r&&(p={...c.tabsMetadata,[n]:r}),{...c,tabIds:d,activeTabId:n,tabsMetadata:p}}return c.type==="split"?{...c,first:s(c.first),second:s(c.second)}:c};return s(e)}let i={type:"pane",id:le(),tabIds:[n],activeTabId:n,tabsMetadata:r?{[n]:r}:void 0};return dn(e,i)}function ve(e,t,n){return e===null?null:e===t?{...e,splitPercentage:n}:e.type==="split"?{...e,first:ve(e.first,t,n)||e.first,second:ve(e.second,t,n)||e.second}:e}function ee(e,t){return e===null?null:e.type==="pane"?e.id===t?e:null:e.type==="split"?ee(e.first,t)??ee(e.second,t):null}function J(e,t){return e===null?null:e.type==="pane"?e.tabIds.includes(t)?e:null:e.type==="split"?J(e.first,t)??J(e.second,t):null}function Tt(e,t){return ee(e,t)??J(e,t)}function Pt(e,t){let n=J(e,t);if(!n)return null;let r=n.tabIds.indexOf(t);return {id:t,paneId:n.id,isActive:n.activeTabId===t,index:r,metadata:n.tabsMetadata?.[t]}}function Rt(e,t){return J(e,t)?.tabsMetadata?.[t]}function xt(e,t){let n=ee(e,t);return n?.tabsMetadata?.[n.activeTabId]}function He(e,t,n){if(e===null)return null;if(e.type==="pane"){if(e.tabIds.includes(t)){let r=e.tabsMetadata||{},o=r[t],i=n(o),a={...r};return i===void 0?delete a[t]:a[t]=i,{...e,tabsMetadata:Object.keys(a).length>0?a:void 0}}return e}return e.type==="split"?{...e,first:He(e.first,t,n)??e.first,second:He(e.second,t,n)??e.second}:e}function Oe(e,t,n){if(e===null)return null;if(e.type==="pane"){if(e.id===t){if(n===false){let{locked:r,...o}=e;return o}return {...e,locked:n}}return e}return e.type==="split"?{...e,first:Oe(e.first,t,n)??e.first,second:Oe(e.second,t,n)??e.second}:e}function ye(e,t,n){return e===null?null:e.type==="pane"?e.id===t?e.activeTabId===n?e:{...e,activeTabId:n}:e:e.type==="split"?{...e,first:ye(e.first,t,n)??e.first,second:ye(e.second,t,n)??e.second}:e}function yt(e,t,n){if(e===null)return null;let o=J(e,t)?.tabsMetadata?.[t],i=ce(e,t);if(i===null)return {type:"pane",id:le(),tabIds:[t],activeTabId:t,tabsMetadata:o?{[t]:o}:void 0};function a(s){if(s.type==="pane"){if(s.id===n){let c=[...s.tabIds];c.includes(t)||c.push(t);let d={...s.tabsMetadata};return o&&(d[t]=o),{...s,tabIds:c,activeTabId:t,tabsMetadata:Object.keys(d).length>0?d:void 0}}return s}return s.type==="split"?{...s,first:a(s.first),second:a(s.second)}:s}return a(i)}function Fe(e,t,n,r="before"){if(e===null)return null;let i=J(e,t)?.tabsMetadata?.[t],a=ce(e,t);if(a===null)return {type:"pane",id:le(),tabIds:[t],activeTabId:t,tabsMetadata:i?{[t]:i}:void 0};function s(c){if(c.type==="pane"){if(c.tabIds.includes(n)){let p=[...c.tabIds].filter(b=>b!==t),f=p.indexOf(n);f<0&&(f=0),r==="after"&&(f+=1),p.splice(f,0,t);let m={...c.tabsMetadata};return i&&(m[t]=i),{...c,tabIds:p,activeTabId:t,tabsMetadata:Object.keys(m).length>0?m:void 0}}return c}return c.type==="split"?{...c,first:s(c.first),second:s(c.second)}:c}return s(a)}function pe(e,t=0,n=0,r=100,o=100,i="root"){if(e===null)return {panes:[],splitters:[]};if(e.type==="pane")return {panes:[{paneId:e.id,left:t,top:n,width:r,height:o,node:e}],splitters:[]};let{direction:a,splitPercentage:s,first:c,second:d}=e,f={id:`splitter-${i}-${a}`,currentNode:e,direction:a,left:a==="row"?t+r*(s/100):t,top:a==="column"?n+o*(s/100):n,width:a==="row"?0:r,height:a==="column"?0:o,parentLeft:t,parentTop:n,parentWidth:r,parentHeight:o},m={panes:[],splitters:[]},b={panes:[],splitters:[]};if(a==="row"){let C=r*(s/100);m=pe(c,t,n,C,o,`${i}-L`),b=pe(d,t+C,n,r-C,o,`${i}-R`);}else {let C=o*(s/100);m=pe(c,t,n,r,C,`${i}-T`),b=pe(d,t,n+C,r,o-C,`${i}-B`);}return {panes:[...m.panes,...b.panes],splitters:[f,...m.splitters,...b.splitters]}}function Dt(e,t,n,r){if(!(t==="tab"&&n&&e.includes(n))||!r)return -1;let a=e.indexOf(n);return r==="before"?a:a+1}function un(e){let{initialLayout:t,layout:n,onChange:r,fullscreenPaneId:o,onFullscreenChange:i,locked:a=false}=e,[s,c]=yn.useState(()=>n!==void 0?n:t??null),[d,p]=yn.useState(()=>n!==void 0?n:t??null),[f,m]=yn.useState(()=>Se(n!==void 0?n:null)),[b,C]=yn.useState(o||null),[N,Z]=yn.useState(a),[v,z]=yn.useState(null),[H,y]=yn.useState(null),[S,T]=yn.useState(null),I=yn.useRef(null),re=yn.useCallback(l=>{I.current=l;},[]),$=yn.useRef(s);$.current=s;let _=yn.useRef(r);_.current=r;let B=yn.useRef(i);B.current=i;let te=yn.useCallback(l=>{C(l),B.current?.(l);},[]);if(yn.useEffect(()=>{Z(a);},[a]),yn.useEffect(()=>{o!==void 0&&C(o);},[o]),n!==void 0){let l=Se(n);l!==f&&(m(l),c(n),p(n));}let R=yn.useCallback(l=>(...g)=>{let A=$.current,M=l(A,...g);Se(A)!==Se(M)&&($.current=M,c(M),p(M),_.current?.(M));},[]),U=yn.useCallback(R((l,g)=>typeof g=="function"?g(l):g),[R]),L=yn.useCallback(l=>{p(g=>typeof l=="function"?l(g):l);},[]),Y=yn.useCallback(l=>{C(null),B.current?.(null),z(null),y(null),T(null),U(l),p(()=>typeof l=="function"?l($.current):l);},[U]),V=yn.useCallback(R((l,g)=>fe(l,g)),[R]),D=yn.useCallback(R((l,g,A,M)=>{let q=ce(l,g)??l;return ht(q,A,g,M)}),[R]),x=yn.useCallback(R((l,g,A,M,q)=>{let W=ee(l,g)??J(l,g);if(!W)return l;let de=ee(l,q)??J(l,q)??{type:"pane",id:q,tabIds:[q],activeTabId:q},j=fe(l,q);return xe(j,W.id,A,M,de)}),[R]),u=yn.useCallback(R((l,g,A)=>ve(l,g,A)),[R]),O=yn.useCallback(R((l,g,A)=>He(l,g,A)),[R]),E=yn.useCallback(R((l,g,A)=>{let M=ee(l,g)??J(l,g);return M?Oe(l,M.id,A):l}),[R]),P=yn.useCallback(R((l,g,A)=>{let M=ee(l,g)??J(l,g);return M?ye(l,M.id,A):l}),[R]),ae=yn.useCallback(R((l,g,A)=>{let M=ee(l,A)??J(l,A);return M?yt(l,g,M.id):l}),[R]),G=yn.useCallback(R((l,g,A,M)=>Fe(l,g,A,M)),[R]),X=yn.useCallback(R((l,g)=>ce(l,g)),[R]),K=yn.useCallback(l=>ee($.current,l),[]),ne=yn.useCallback(l=>J($.current,l),[]),h=yn.useCallback(l=>Pt($.current,l),[]),w=yn.useCallback(l=>Rt($.current,l),[]),k=yn.useCallback(l=>xt($.current,l),[]);return {layout:s,setLayout:Y,_internalSetLayout:L,renderingLayout:d,fullscreenPaneId:b,setFullscreenPaneId:te,locked:N,setLocked:Z,activeId:v,setActiveId:z,activeType:H,setActiveType:y,dismissIntentId:S,setDismissIntentId:T,containerRef:I,setContainerRef:re,removePane:V,addTab:D,updateMetadata:O,updatePaneLock:E,selectTab:P,mergeTab:ae,moveTab:G,removeTab:X,splitPane:x,updateSplitPercentage:u,findPaneById:K,findPaneContainingTab:ne,findTabById:h,getTabMetadata:w,getActiveTabMetadata:k}}var pn=()=>{let e=oe(),t=ze();return {layout:e.layout,setLayout:e.setLayout,fullscreenPaneId:e.fullscreenPaneId,setFullscreenPaneId:t.setFullscreenPaneId,locked:e.locked,setLocked:t.setLocked,removePane:t.removePane,addTab:t.addTab,updateMetadata:t.updateMetadata,updatePaneLock:t.updatePaneLock,selectTab:t.selectTab,mergeTab:t.mergeTab,removeTab:t.removeTab,splitPane:t.splitPane,updateSplitPercentage:t.updateSplitPercentage,moveTab:t.moveTab,findPaneById:e.findPaneById,findPaneContainingTab:e.findPaneContainingTab,findTabById:e.findTabById,getTabMetadata:e.getTabMetadata,getActiveTabMetadata:e.getActiveTabMetadata}};var Ve=class extends core.PointerSensor{static activators=[{eventName:"onPointerDown",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]},We=class extends core.TouchSensor{static activators=[{eventName:"onTouchStart",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]};var St=e=>{let n=e.active.id.toString().startsWith("tab-header-"),r=core.pointerWithin(e),o=n?r:r.filter(i=>!i.id.toString().startsWith("tab-drop-"));if(o.length>0)return [...o].sort((a,s)=>{let c=a.id.toString(),d=s.id.toString();if(n){let m=c.startsWith("tab-drop-"),b=d.startsWith("tab-drop-");if(m&&!b)return -1;if(!m&&b)return 1}let p=c.startsWith("drop-root-"),f=d.startsWith("drop-root-");return p&&!f?-1:!p&&f?1:0});if(n){let i=e.droppableContainers.filter(a=>a.id.toString().startsWith("tab-drop-"));return core.closestCenter({...e,droppableContainers:i})}return []};function Ue(e){if(e instanceof MouseEvent||e instanceof PointerEvent)return {x:e.clientX,y:e.clientY};if(typeof TouchEvent<"u"&&e instanceof TouchEvent){let t=e.touches[0]||e.changedTouches[0];if(t)return {x:t.clientX,y:t.clientY}}return null}function Nt(e){let{layout:t,_internalSetLayout:n,setLayout:r,activeId:o,setActiveId:i,setActiveType:a,dismissIntentId:s,setDismissIntentId:c,setOverTabId:d,setOverTabPosition:p,containerRef:f,dragActivationDistance:m,enableDragToDismiss:b,dismissThreshold:C,onRemove:N,onDragStart:Z,onDragEnd:v,onDismissIntentChange:z,removeTab:H,removePane:y}=e,S=yn.useRef(null),T=pt(o),I=yn.useRef(null),[re,$]=yn.useState(false);return ft(re),{sensors:core.useSensors(core.useSensor(Ve,{activationConstraint:{distance:m}}),core.useSensor(We,{activationConstraint:{delay:250,tolerance:5}})),collisionDetection:St,onDragStart:L=>{let Y=L.active.id.toString(),V=Y.startsWith("tab-header-"),D=V?Y.substring(11):Y;i(D),a(V?"tab":"pane"),d(null),p(null);let x=L.activatorEvent;T.current=Ue(x),b&&f.current?S.current=f.current.getBoundingClientRect():S.current=null;let u=t;if(V){let E=J(t,D);E&&(u=ye(t,E.id,D)||t);}I.current=u;let O=V?ce(u,D):fe(u,D);n(O),Z&&Z(D);},onDragMove:L=>{let{over:Y}=L,V=Y?.id.toString()||"",D=V.startsWith("drop-locked-");$(h=>h===D?h:D);let x=L.active.id.toString(),u=x.startsWith("tab-header-"),O=u?x.substring(11):x,E=V.match(/^tab-drop-(.+)$/);if(E&&Y&&u){let[,h]=E;if(O!==h){let w="before",k=Y.rect,se=L.activatorEvent,l=null;if(T.current)l=T.current.x;else {let g=Ue(se);g&&(l=g.x+L.delta.x);}if(l!==null){let g=k.left+k.width/2;l>g&&(w="after");}d(g=>g===h?g:h),p(g=>g===w?g:w);}else d(w=>w===null?w:null),p(w=>w===null?w:null);}else d(h=>h===null?h:null),p(h=>h===null?h:null);if(!b)return;let P=S.current;if(!P){s!==null&&(c(null),z?.(null));return}let ae=L.activatorEvent,G=null,X=null;if(T.current)G=T.current.x,X=T.current.y;else {let h=Ue(ae);h&&(G=h.x+L.delta.x,X=h.y+L.delta.y);}let K=0;if(G!==null&&X!==null){let h=0,w=0;G<P.left?h=P.left-G:G>P.right&&(h=G-P.right),X<P.top?w=P.top-X:X>P.bottom&&(w=X-P.bottom),K=Math.sqrt(h*h+w*w);}else {let h=L.active.rect.current.translated;if(h){let w=h.left+h.width/2,k=h.top+h.height/2,se=0,l=0;w<P.left?se=P.left-w:w>P.right&&(se=w-P.right),k<P.top?l=P.top-k:k>P.bottom&&(l=k-P.bottom),K=Math.sqrt(se*se+l*l);}}K>C?s!==O&&(c(O),z?.(O)):s!==null&&(c(null),z?.(null));},onDragEnd:L=>{i(null),a(null),$(false),d(null),p(null);let{active:Y,over:V}=L,D=Y.id.toString(),x=D.startsWith("tab-header-"),u=x?D.substring(11):D,O=b&&s===u;c(null),z?.(null),S.current=null;let E=I.current||t;if(I.current=null,O){N?N(u):x?H(u):y(u),v&&v(u,null,null);return}if(!V){n(E),v&&v(u,null,null);return}let P=V.id.toString();if(P.startsWith("drop-locked-")){n(E),v&&v(u,null,null);return}let ae=P.match(/^tab-drop-(.+)$/);if(ae){if(!x){n(E),v&&v(u,null,null);return}let[,M]=ae;if(u!==M){let q="before",W=V.rect,de=L.activatorEvent,j=null;if(T.current)j=T.current.x;else {let Q=Ue(de);Q&&(j=Q.x+L.delta.x);}if(j!==null){let Q=W.left+W.width/2;j>Q&&(q="after");}let be=Fe(E,u,M,q);r(be),v&&v(u,M,{type:"move",position:"center"});}else n(E),v&&v(u,null,null);return}let G=P.match(/^drop-root-(1\/4|1\/3)-(top|bottom|left|right|start|end)$/);if(G){let[,M,q]=G,W=q;W==="start"&&(W="left"),W==="end"&&(W="right");let de=x?ce(E,u):fe(E,u),j;if(x){let Q=J(E,u)?.tabsMetadata?.[u];j={type:"pane",id:le(),tabIds:[u],activeTabId:u,tabsMetadata:Q?{[u]:Q}:void 0};}else j=ee(E,u)??{type:"pane",id:le(),tabIds:[u],activeTabId:u};if(de===null)r(j);else {let be=W==="left"||W==="right",Q=W==="left"||W==="top",Te=50;M==="1/4"?Te=Q?25:75:M==="1/3"&&(Te=Q?100/3:200/3),r({type:"split",direction:be?"row":"column",first:Q?j:de,second:Q?de:j,splitPercentage:Te});}v&&v(u,"root",{type:"split",direction:W==="left"||W==="right"?"row":"column",position:W});return}let X=P.match(/^drop-(left|right|top|bottom)-(.+)$/);if(!X){n(E),v&&v(u,null,null);return}let[,K,ne]=X,h=x?J(E,u):ee(E,u),w=h&&h.id===ne,k=h&&h.tabIds.length===1;if(u===ne||w&&k){n(E),v&&v(u,null,null);return}let se=K==="left"||K==="right"?"row":"column",l;if(x){let q=J(E,u)?.tabsMetadata?.[u];l={type:"pane",id:le(),tabIds:[u],activeTabId:u,tabsMetadata:q?{[u]:q}:void 0};}else l=ee(E,u)??{type:"pane",id:le(),tabIds:[u],activeTabId:u};let g=x?ce(E,u):fe(E,u),A=xe(g,ne,se,K,l);r(A),v&&v(u,ne,{type:"split",direction:se,position:K});},onDragCancel:()=>{i(null),a(null),$(false),d(null),p(null),c(null),z?.(null),S.current=null;let L=I.current||t;I.current=null,n(L),L!==t&&r(L);}}}function Mt({persist:e,layout:t,setLayout:n}){let r=typeof e=="object"?e.enabled!==false:!!e,o=typeof e=="object"&&e.key||"zeugma-layout",[i,a]=yn.useState(false);yn.useEffect(()=>{if(r){let s=localStorage.getItem(o);if(s)try{let c=JSON.parse(s);c&&n(c);}catch(c){console.error("Failed to parse persisted zeugma layout",c);}}a(true);},[r,o,n]),yn.useEffect(()=>{r&&i&&(t?localStorage.setItem(o,JSON.stringify(t)):localStorage.removeItem(o));},[r,o,t,i]);}var Lt=({activeId:e,render:t,className:n})=>{let r=yn.useRef(null);return yn.useEffect(()=>{let o=i=>{r.current&&(r.current.style.transform=`translate(${i.clientX+12}px, ${i.clientY+12}px)`);};return document.addEventListener("pointermove",o),()=>document.removeEventListener("pointermove",o)},[]),jsxRuntime.jsx("div",{ref:r,className:n,style:{position:"fixed",top:0,left:0,zIndex:9999,pointerEvents:"none"},children:t(e)})};var Zt=yn__default.default.memo(({tabDetails:e,target:t,renderWidget:n})=>{let{id:r}=e,[o,i]=yn.useState(false),a=yn.useRef(null);if(yn.useEffect(()=>{i(true);},[]),yn.useEffect(()=>{if(!o||!a.current)return;let c=a.current;if(t)t.appendChild(c);else {let d=document.getElementById("zeugma-hidden-portal-container");d||(d=document.createElement("div"),d.id="zeugma-hidden-portal-container",d.style.display="none",document.body.appendChild(d)),d.appendChild(c);}},[t,o]),yn.useEffect(()=>()=>{a.current&&a.current.remove();},[]),!o)return null;a.current||(a.current=document.createElement("div"),a.current.className=`zeugma-portal-wrapper-${r}`,a.current.style.width="100%",a.current.style.height="100%");let s=a.current;return !s||!n?null:reactDom.createPortal(n(e),s)},(e,t)=>e.target===t.target&&e.renderWidget===t.renderWidget&&e.tabDetails.id===t.tabDetails.id&&e.tabDetails.paneId===t.tabDetails.paneId&&e.tabDetails.isActive===t.tabDetails.isActive&&e.tabDetails.index===t.tabDetails.index&&e.tabDetails.metadata===t.tabDetails.metadata);var kt=({activeId:e,activeType:t,dismissIntentId:n,renderDragOverlay:r,renderPaneRef:o,renderPane:i,tabHeadersRef:a,classNames:s})=>{if(r)return jsxRuntime.jsx(jsxRuntime.Fragment,{children:r({type:t,id:e,isDismissing:e===n})});if(t==="pane"){let c=o.current||i;if(c)return jsxRuntime.jsx("div",{className:s.paneDragPreview||"",style:{pointerEvents:"none",width:"420px",height:"260px",overflow:"hidden"},children:c(e)})}else if(t==="tab"){let c=o.current||i;if(c)return jsxRuntime.jsx("div",{className:s.tabDragPreview||"",style:{pointerEvents:"none",width:"420px",height:"260px",overflow:"hidden"},children:c(e)});let d=a.current[e];if(d){let p=s.tab?typeof s.tab=="function"?s.tab(e):s.tab:"";return jsxRuntime.jsx("div",{className:`${s.tabDragPreview||""} ${p}`.trim(),style:{display:"inline-flex",position:"relative",pointerEvents:"none",overflow:"hidden",width:"420px",height:"260px"},children:d({isDragging:true,isOver:false})})}}return jsxRuntime.jsx("div",{style:{pointerEvents:"none",overflow:"hidden",width:"100%",height:"100%"}})};function nt({containerRef:e,isRow:t,direction:n,splitPercentage:r,resizerSize:o,snapThreshold:i,layout:a,currentNode:s,onLayoutChange:c,onResizeStart:d,onResizeEnd:p,parentLeft:f,parentTop:m,parentWidth:b,parentHeight:C}){let{onResizeStart:N,onResize:Z,onResizeEnd:v,minSplitPercentage:z=5,maxSplitPercentage:H=95,locked:y=false}=oe();return yn.useCallback(S=>{if(y)return;S.preventDefault();let T=e.current;if(!T)return;d&&d(),N&&N(s);let I=T.getBoundingClientRect(),re=S.clientX,$=S.clientY,_=r,B=S.currentTarget,te=I.left+I.width*(f/100),R=I.top+I.height*(m/100),U=I.width*(b/100),L=I.height*(C/100),V=Array.from(document.querySelectorAll('div[role="separator"][data-direction]')).filter(x=>x!==B&&x.getAttribute("data-direction")===n).map(x=>{let u=x.getBoundingClientRect();return t?u.left+u.width/2:u.top+u.height/2}),D=_;ut({cursor:t?"col-resize":"row-resize",resizerEl:B,onMove:x=>{let u=t?(x.clientX-re)/U*100:(x.clientY-$)/L*100,O=_+u,E=t?te+(U-o)*(O/100)+o/2:R+(L-o)*(O/100)+o/2,P=1/0,ae=null;for(let ne of V){let h=Math.abs(E-ne);h<i&&h<P&&(P=h,ae=ne);}let G=O;ae!==null&&(G=t?(ae-o/2-te)/(U-o)*100:(ae-o/2-R)/(L-o)*100);let X=Math.max(z,Math.min(H,G));D=X;let K=ve(a,s,X);if(K){let{panes:ne,splitters:h}=pe(K),w=e.current;if(w){for(let k of ne)w.style.setProperty(`--pane-left-${k.paneId}`,`${k.left}%`),w.style.setProperty(`--pane-top-${k.paneId}`,`${k.top}%`),w.style.setProperty(`--pane-width-${k.paneId}`,`${k.width}%`),w.style.setProperty(`--pane-height-${k.paneId}`,`${k.height}%`);for(let k of h)w.style.setProperty(`--splitter-pos-${k.id}`,`${k.direction==="row"?k.left:k.top}%`);}}Z&&Z(s,X);},onEnd:()=>{let x=ve(a,s,D),u=e.current;if(u){let{panes:O,splitters:E}=pe(x);for(let P of O)u.style.removeProperty(`--pane-left-${P.paneId}`),u.style.removeProperty(`--pane-top-${P.paneId}`),u.style.removeProperty(`--pane-width-${P.paneId}`),u.style.removeProperty(`--pane-height-${P.paneId}`);for(let P of E)u.style.removeProperty(`--splitter-pos-${P.id}`);}c(x),p&&p(),v&&v(s,D);}});},[e,t,n,r,o,i,a,s,c,d,p,N,Z,v,z,H,f,m,b,C])}var zt=({splitter:e,resizerSize:t,snapThreshold:n,containerRef:r})=>{let{renderingLayout:o,setLayout:i,classNames:a,locked:s}=oe(),[c,d]=yn.useState(false),{currentNode:p,direction:f,left:m,top:b,width:C,height:N,parentLeft:Z,parentTop:v,parentWidth:z,parentHeight:H}=e,y=f==="row",S=nt({containerRef:r,isRow:y,direction:f,splitPercentage:p.splitPercentage,resizerSize:t,snapThreshold:n,layout:o,currentNode:p,onLayoutChange:i,onResizeStart:()=>d(true),onResizeEnd:()=>d(false),parentLeft:Z,parentTop:v,parentWidth:z,parentHeight:H}),T=y?{position:"absolute",left:`calc(var(--splitter-pos-${e.id}, ${m}%) - ${t/2}px)`,top:`calc(${b}% + ${t/2}px)`,width:`${t}px`,height:`calc(${N}% - ${t}px)`,cursor:s?"default":"col-resize",pointerEvents:s?"none":"auto",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box"}:{position:"absolute",left:`calc(${m}% + ${t/2}px)`,top:`calc(var(--splitter-pos-${e.id}, ${b}%) - ${t/2}px)`,width:`calc(${C}% - ${t}px)`,height:`${t}px`,cursor:s?"default":"row-resize",pointerEvents:s?"none":"auto",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box"};return jsxRuntime.jsx("div",{className:a.resizer||"","data-direction":f,"data-resizing":c||void 0,style:T,onPointerDown:S,role:"separator","aria-valuenow":p.splitPercentage,"aria-valuemin":5,"aria-valuemax":95})},$t=yn__default.default.memo(({paneId:e,renderPane:t})=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:t(e)}),(e,t)=>e.paneId===t.paneId&&e.renderPane===t.renderPane);var ot=({renderPane:e,tree:t,resizerSize:n,snapThreshold:r})=>{vt(e);let{renderingLayout:o,activeId:i,dismissIntentId:a,setContainerRef:s,fullscreenPaneId:c,snapThreshold:d,locked:p,classNames:f,resizerSize:m}=oe(),b=r!==void 0?r:d??8,C=n!==void 0?n:m??4,N=t!==void 0?t:o,Z=yn.useRef(null),{panes:v,splitters:z}=yn.useMemo(()=>N?pe(N):{panes:[],splitters:[]},[N]);if(!N&&t!==void 0)return null;let H=()=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[v.map(y=>{let S=c===y.paneId;return jsxRuntime.jsx("div",{style:{position:"absolute",left:S?"0%":`var(--pane-left-${y.paneId}, ${y.left}%)`,top:S?"0%":`var(--pane-top-${y.paneId}, ${y.top}%)`,width:S?"100%":`var(--pane-width-${y.paneId}, ${y.width}%)`,height:S?"100%":`var(--pane-height-${y.paneId}, ${y.height}%)`,overflow:"hidden",zIndex:S?20:1,display:c&&!S?"none":"block",padding:S?"0px":`${C/2}px`,boxSizing:"border-box"},children:jsxRuntime.jsx($t,{paneId:y.paneId,renderPane:e})},y.paneId)}),!c&&z.map(y=>jsxRuntime.jsx(zt,{splitter:y,resizerSize:C,snapThreshold:b,containerRef:Z},y.id))]});if(t===void 0){let y=i!==null&&i===a,S=I=>{s(I),Z.current=I;},T=`${f.dashboard||""} ${y&&f.dashboardDismissActive||""} ${p&&f.dashboardLocked||""}`.trim();return jsxRuntime.jsxs("div",{ref:S,className:T,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:[H(),i!==null&&!p&&jsxRuntime.jsx(Ot,{activeClassName:f.rootDropPreview??f.dropPreview})]})}return jsxRuntime.jsx("div",{ref:Z,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:H()})};var An=e=>{let{controller:t,children:n,renderDragOverlay:r,classNames:o={},renderPane:i,resizerSize:a,dragActivationDistance:s=8,snapThreshold:c=8,minSplitPercentage:d=5,maxSplitPercentage:p=95,enableDragToDismiss:f=false,dismissThreshold:m=60,onRemove:b,onDragStart:C,onDragEnd:N,onResizeStart:Z,onResize:v,onResizeEnd:z,onDismissIntentChange:H,persist:y=false}=e,S=t,{layout:T,setLayout:I,_internalSetLayout:re,renderingLayout:$,fullscreenPaneId:_,setFullscreenPaneId:B,locked:te,setLocked:R,findPaneById:U,findPaneContainingTab:L,findTabById:Y,getTabMetadata:V,getActiveTabMetadata:D,activeId:x,setActiveId:u,activeType:O,setActiveType:E,dismissIntentId:P,setDismissIntentId:ae,containerRef:G,setContainerRef:X,removePane:K,addTab:ne,updateMetadata:h,updatePaneLock:w,selectTab:k,mergeTab:se,removeTab:l,splitPane:g,updateSplitPercentage:A,moveTab:M}=S;Mt({persist:y,layout:T,setLayout:I});let{portalTargets:q,registerPortalTarget:W,registerRenderCallback:de,renderCallbacksRef:j,registerRenderPane:be,renderPaneRef:Q,registerTabHeader:Te,tabHeadersRef:Me,activeIdRef:Le}=gt(),{overTabId:it,setOverTabId:Gt,overTabPosition:lt,setOverTabPosition:Kt,handleDragStartInternal:jt,handleDragEndInternal:Qt}=bt({onDragStart:C,onDragEnd:N}),en=Nt({layout:T,_internalSetLayout:re,setLayout:I,activeId:x,setActiveId:u,setActiveType:E,dismissIntentId:P,setDismissIntentId:ae,setOverTabId:Gt,setOverTabPosition:Kt,containerRef:G,dragActivationDistance:s,enableDragToDismiss:f,dismissThreshold:m,onRemove:b,onDragStart:jt,onDragEnd:Qt,onDismissIntentChange:H,removeTab:l,removePane:K}),_e=yn.useMemo(()=>o,[o.dashboard,o.dashboardDismissActive,o.pane,o.paneLocked,o.dropPreview,o.rootDropPreview,o.dragOverlay,o.paneDragPreview,o.tabDragPreview,o.resizer,o.dismissPreview,o.dashboardLocked,o.lockedPreview,o.tabDropPreview,o.tabSeparator,o.tabsContainer,o.tab,o.paneContainer,o.paneHeader,o.paneControls,o.paneButton,o.tabCloseButton,o.dragHandle]),ct=yn.useCallback((ue,Ze)=>{z&&z(ue,Ze);},[z]),tn=yn.useMemo(()=>({layout:T,renderingLayout:$,setLayout:I,activeId:x,activeType:O,dismissIntentId:P,setContainerRef:X,fullscreenPaneId:_,classNames:_e,onRemove:b,onFullscreenChange:B,snapThreshold:c,onResizeStart:Z,onResize:v,onResizeEnd:ct,minSplitPercentage:d,maxSplitPercentage:p,locked:te,setLocked:R,findPaneById:U,findPaneContainingTab:L,findTabById:Y,getTabMetadata:V,getActiveTabMetadata:D,renderPane:i,resizerSize:a}),[T,$,x,O,P,X,_,_e,b,B,c,Z,v,d,p,I,ct,te,R,U,L,Y,V,D,i,a]),nn=yn.useMemo(()=>({overTabId:it,overTabPosition:lt}),[it,lt]),on=yn.useMemo(()=>({removePane:K,addTab:ne,updateMetadata:h,updatePaneLock:w,selectTab:k,mergeTab:se,removeTab:l,setFullscreenPaneId:B,setLocked:R,splitPane:g,updateSplitPercentage:A,moveTab:M}),[K,ne,h,w,k,se,l,B,R,g,A,M]),rn=mt(T),an=yn.useMemo(()=>({registerPortalTarget:W,registerRenderCallback:de,renderCallbacksRef:j,registerRenderPane:be,renderPaneRef:Q,registerTabHeader:Te,tabHeadersRef:Me,activeIdRef:Le}),[W,de,j,be,Q,Te,Me,Le]);return Le&&(Le.current=x),jsxRuntime.jsx(je.Provider,{value:on,children:jsxRuntime.jsx(Ke.Provider,{value:tn,children:jsxRuntime.jsx(Qe.Provider,{value:nn,children:jsxRuntime.jsxs(ge.Provider,{value:an,children:[jsxRuntime.jsx(core.DndContext,{id:"zeugma-dnd-context",...en,children:n}),x&&O&&jsxRuntime.jsx(Lt,{activeId:x,render:ue=>jsxRuntime.jsx("div",{style:{transition:"transform 150ms cubic-bezier(0.2, 0, 0, 1)",transform:ue===P?"scale(0.8)":"scale(1)",transformOrigin:"top left"},children:jsxRuntime.jsx(kt,{activeId:ue,activeType:O,dismissIntentId:P,renderDragOverlay:r,renderPaneRef:Q,renderPane:i,tabHeadersRef:Me,classNames:_e})}),className:`${o.dragOverlay||""} ${x===P&&o.dismissPreview||""}`.trim()}),jsxRuntime.jsx("div",{id:"zeugma-portal-host",style:{display:"none"},children:rn.map(ue=>{let Ze=q[ue],dt=Y(ue);return dt?jsxRuntime.jsx(Zt,{tabDetails:dt,target:Ze||null,renderWidget:j.current[ue]},ue):null})})]})})})})},Hn=({renderPane:e,resizerSize:t,snapThreshold:n})=>{if(!e)throw new Error("Zeugma component requires a renderPane prop when used as a standalone renderer.");return jsxRuntime.jsx(ot,{renderPane:e,resizerSize:t,snapThreshold:n})},On=e=>{let{children:t,...n}=e,{controller:r}=e;if(!r)throw new Error("Zeugma component requires a controller.");return jsxRuntime.jsx(An,{...e,children:t!==void 0?t:jsxRuntime.jsx(Hn,{...n})})};var Vn={top:{"1/4":{position:"absolute",top:0,left:0,width:"100%",height:"24px",zIndex:100,pointerEvents:"auto"},"1/3":{position:"absolute",top:"24px",left:0,width:"100%",height:"24px",zIndex:100,pointerEvents:"auto"}},bottom:{"1/4":{position:"absolute",bottom:0,left:0,width:"100%",height:"24px",zIndex:100,pointerEvents:"auto"},"1/3":{position:"absolute",bottom:"24px",left:0,width:"100%",height:"24px",zIndex:100,pointerEvents:"auto"}},left:{"1/4":{position:"absolute",left:0,top:"48px",width:"24px",height:"calc(100% - 96px)",zIndex:100,pointerEvents:"auto"},"1/3":{position:"absolute",left:"24px",top:"48px",width:"24px",height:"calc(100% - 96px)",zIndex:100,pointerEvents:"auto"}},right:{"1/4":{position:"absolute",right:0,top:"48px",width:"24px",height:"calc(100% - 96px)",zIndex:100,pointerEvents:"auto"},"1/3":{position:"absolute",right:"24px",top:"48px",width:"24px",height:"calc(100% - 96px)",zIndex:100,pointerEvents:"auto"}}},Wn={top:{"1/4":{top:0,left:0,width:"100%",height:"60px",borderBottomLeftRadius:"12px",borderBottomRightRadius:"12px",borderTopLeftRadius:"0px",borderTopRightRadius:"0px"},"1/3":{top:0,left:0,width:"100%",height:"96px",borderBottomLeftRadius:"12px",borderBottomRightRadius:"12px",borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}},bottom:{"1/4":{bottom:0,left:0,width:"100%",height:"60px",borderTopLeftRadius:"12px",borderTopRightRadius:"12px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px"},"1/3":{bottom:0,left:0,width:"100%",height:"96px",borderTopLeftRadius:"12px",borderTopRightRadius:"12px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px"}},left:{"1/4":{left:0,top:0,width:"60px",height:"100%",borderTopRightRadius:"12px",borderBottomRightRadius:"12px",borderTopLeftRadius:"0px",borderBottomLeftRadius:"0px"},"1/3":{left:0,top:0,width:"96px",height:"100%",borderTopRightRadius:"12px",borderBottomRightRadius:"12px",borderTopLeftRadius:"0px",borderBottomLeftRadius:"0px"}},right:{"1/4":{right:0,top:0,width:"60px",height:"100%",borderTopLeftRadius:"12px",borderBottomLeftRadius:"12px",borderTopRightRadius:"0px",borderBottomRightRadius:"0px"},"1/3":{right:0,top:0,width:"96px",height:"100%",borderTopLeftRadius:"12px",borderBottomLeftRadius:"12px",borderTopRightRadius:"0px",borderBottomRightRadius:"0px"}}},Un=({id:e,fraction:t,edge:n,activeClassName:r})=>{let{setNodeRef:o,isOver:i}=core.useDroppable({id:e}),a={position:"absolute",pointerEvents:"none",zIndex:101,boxSizing:"border-box",...Wn[n][t]};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:o,style:Vn[n][t]}),i&&jsxRuntime.jsx("div",{className:r,style:a})]})},Ot=({activeClassName:e})=>jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:99,pointerEvents:"none"},children:[{id:"drop-root-1/4-top",fraction:"1/4",edge:"top"},{id:"drop-root-1/3-top",fraction:"1/3",edge:"top"},{id:"drop-root-1/4-bottom",fraction:"1/4",edge:"bottom"},{id:"drop-root-1/3-bottom",fraction:"1/3",edge:"bottom"},{id:"drop-root-1/4-left",fraction:"1/4",edge:"left"},{id:"drop-root-1/3-left",fraction:"1/3",edge:"left"},{id:"drop-root-1/4-right",fraction:"1/4",edge:"right"},{id:"drop-root-1/3-right",fraction:"1/3",edge:"right"}].map(n=>jsxRuntime.jsx(Un,{id:n.id,fraction:n.fraction,edge:n.edge,activeClassName:e},n.id))});var Je=yn.createContext(null);var _n={top:{position:"absolute",top:0,left:0,width:"100%",height:"25%",zIndex:20,pointerEvents:"auto"},bottom:{position:"absolute",bottom:0,left:0,width:"100%",height:"25%",zIndex:20,pointerEvents:"auto"},left:{position:"absolute",top:"25%",left:0,width:"50%",height:"50%",zIndex:20,pointerEvents:"auto"},right:{position:"absolute",top:"25%",right:0,width:"50%",height:"50%",zIndex:20,pointerEvents:"auto"},full:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:20,pointerEvents:"auto",cursor:"not-allowed"}},Gn={top:{position:"absolute",top:0,left:0,right:0,height:"50%",zIndex:21,pointerEvents:"none",boxSizing:"border-box"},bottom:{position:"absolute",bottom:0,left:0,right:0,height:"50%",zIndex:21,pointerEvents:"none",boxSizing:"border-box"},left:{position:"absolute",top:0,bottom:0,left:0,width:"50%",zIndex:21,pointerEvents:"none",boxSizing:"border-box"},right:{position:"absolute",top:0,bottom:0,right:0,width:"50%",zIndex:21,pointerEvents:"none",boxSizing:"border-box"},full:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:21,pointerEvents:"none",boxSizing:"border-box"}},rt=({id:e,position:t,activeClassName:n})=>{let{setNodeRef:r,isOver:o}=core.useDroppable({id:e});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:r,style:_n[t]}),o&&jsxRuntime.jsx("div",{className:n,style:Gn[t]})]})};var Bt=({children:e,className:t,style:n})=>{let r=yn.useContext(Je);if(!r)throw new Error("<DragHandle> must be used inside a <Pane>");let{disabled:o,...i}=r;return jsxRuntime.jsx("div",{className:t,style:{cursor:o?"default":"grab",userSelect:o?"auto":"none",touchAction:o?"auto":"none",...n},...o?{}:i,children:e})};var so=yn.createContext(void 0);var Ee=({id:e,locked:t=false,children:n,className:r,style:o})=>{let{locked:i,classNames:a={},activeType:s}=oe(),{overTabId:c}=$e(),d=yn.useContext(ge);yn.useEffect(()=>(d?.registerTabHeader&&d.registerTabHeader(e,n),()=>{d?.registerTabHeader&&d.activeIdRef?.current!==e&&d.registerTabHeader(e,()=>null);}),[e,n,d]);let p=yn.useContext(at),f=t||i||(p?.locked??false),{attributes:m,listeners:b,setNodeRef:C,isDragging:N}=core.useDraggable({id:`tab-header-${e}`,disabled:f}),{setNodeRef:Z,isOver:v}=core.useDroppable({id:`tab-drop-${e}`,disabled:f||s==="pane"}),z=U=>{C(U),Z(U);},H=v&&c===e,y=p?.tabIds||[],S=y.indexOf(e),T=p?.activeTabId,re=S>0&&e!==T&&y[S-1]!==T?jsxRuntime.jsx("div",{className:a.tabSeparator}):null,$=p?p.activeTabId===e:false,_=p?.tabsMetadata?.[e],B=yn.useCallback(()=>{p?.selectTab(e);},[p,e]),te=yn.useCallback(()=>{p?.removeTab(e);},[p,e]),R=yn.useMemo(()=>({tabId:e,isActive:$,isDragging:N,isOver:H,metadata:_,locked:f,selectTab:B,removeTab:te}),[e,$,N,H,_,f,B,te]);return jsxRuntime.jsx(so.Provider,{value:R,children:jsxRuntime.jsxs("div",{ref:z,id:`tab-header-${e}`,className:r,style:{display:"inline-flex",position:"relative",cursor:f?"default":"grab",...o},...f?{}:b,...f?{}:m,children:[re,n({isDragging:N,isOver:H})]})})};var at=yn.createContext(void 0);var Xt=(e,t)=>typeof e=="function"?e(t):e,st=({tabIds:e,activeTabId:t,locked:n,tabsMetadata:r,selectTab:o,removeTab:i,renderTab:a,classNames:s,styles:c})=>{let d=yn.useContext(Ye),p=e??d?.tabIds??[],f=t??d?.activeTabId??"",m=n??d?.locked??false,b=r??d?.tabsMetadata,C=o??d?.selectTab??(()=>{}),N=i??d?.removeTab??(()=>{}),{classNames:Z={},activeType:v}=oe(),{overTabId:z,overTabPosition:H}=$e(),y=yn.useMemo(()=>({tabIds:p,activeTabId:f,locked:m,tabsMetadata:b,selectTab:C,removeTab:N}),[p,f,m,b,C,N]),S=Dt(p,v,z,H);return jsxRuntime.jsx(at.Provider,{value:y,children:jsxRuntime.jsxs("div",{className:s?.container,style:{display:"flex",alignItems:"center",height:"100%",...c?.container},children:[p.map((T,I)=>{let re=b?.[T],$=Xt(s?.tab,T),_=Xt(c?.tab,T),B=I===S;return jsxRuntime.jsxs(yn__default.default.Fragment,{children:[B&&Z.tabDropPreview&&jsxRuntime.jsx("div",{style:{position:"relative",height:"100%",width:0,zIndex:10},children:jsxRuntime.jsx("div",{className:Z.tabDropPreview,style:{position:"absolute",top:0,bottom:0,transform:I===0?"none":"translateX(-50%)"}})}),jsxRuntime.jsx(Ee,{id:T,locked:m,className:$,style:_,children:({isDragging:te,isOver:R})=>a({id:T,paneId:d?.id??"",isActive:T===f,index:I,isDragging:te,isOver:R,metadata:re,onSelect:()=>C(T),onRemove:()=>N(T)})})]},T)}),S===p.length&&Z.tabDropPreview&&jsxRuntime.jsx("div",{style:{position:"relative",height:"100%",width:0,zIndex:10},children:jsxRuntime.jsx("div",{className:Z.tabDropPreview,style:{position:"absolute",top:0,bottom:0,transform:"translateX(-100%)"}})})]})})};st.Tab=Ee;var Yt=({className:e,style:t,children:n})=>jsxRuntime.jsx("div",{className:e,style:t,children:n});var Ye=yn.createContext(void 0),_t=()=>{let e=yn.useContext(Ye);if(!e)throw new Error("usePaneContext must be used within a Pane component");return e},ho=({children:e,className:t,style:n})=>{let{activeTabId:r}=_t(),{classNames:o}=oe(),i=yn.useRef(null),a=yn.useContext(ge);if(!a)throw new Error("PaneContent must be used within a Zeugma provider");let{registerPortalTarget:s,registerRenderCallback:c}=a,d=yn.useMemo(()=>typeof e=="function"?e:()=>e,[e]);return c(r,d),yn.useEffect(()=>{let p=i.current;return s(r,p),()=>{s(r,null);}},[r,s]),jsxRuntime.jsx("div",{ref:i,id:`zeugma-tab-target-${r}`,className:`${o.tabContentWrapper||""} ${t||""}`.trim(),style:{height:"100%",width:"100%",...n}})},Ce=({id:e,children:t,style:n,locked:r=false})=>{let{layout:o,renderingLayout:i,activeId:a,classNames:s,fullscreenPaneId:c,onFullscreenChange:d,locked:p}=oe(),{removePane:f,updateMetadata:m,selectTab:b,removeTab:C}=ze(),N=yn.useMemo(()=>Tt(e===a?o:i,e),[o,i,e,a]),Z=N?.id??e,v=N?.tabIds??[e],z=N?.activeTabId??e,H=N?.tabsMetadata,y=H?.[e],S=N?.locked??false,T=r||S,I=p||T,re=p||T,$=a!==null&&a!==e&&(!v.includes(a)||v.length>1)&&!re,{attributes:_,listeners:B,setNodeRef:te}=core.useDraggable({id:e,disabled:I}),R=a!==null&&v.includes(a),U=c===e,L=yn.useMemo(()=>({isDragging:R,isFullscreen:U,toggleFullscreen:()=>d?.(U?null:e),remove:()=>{U&&d?.(null),f(Z);},metadata:y,updateMetadata:D=>{m(e,D);},locked:I,tabIds:v,activeTabId:z,selectTab:D=>b(Z,D),removeTab:D=>{U&&D===z&&d?.(null),C(D);},tabsMetadata:H,updateTabMetadata:(D,x)=>{m(D,x);}}),[R,U,d,e,C,y,m,I,v,z,b,Z,H]),Y=yn.useMemo(()=>I?{disabled:true}:{...B,..._},[B,_,I]),V=`${s.pane||""} ${T&&s.paneLocked||""}`.trim();return jsxRuntime.jsx(Ye.Provider,{value:{id:e,...L},children:jsxRuntime.jsx(Je.Provider,{value:Y,children:jsxRuntime.jsxs("div",{ref:te,id:e,className:V,style:{position:"relative",width:"100%",height:"100%",...n},children:[t,$&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:15,pointerEvents:"none"},children:["top","bottom","left","right"].map(D=>jsxRuntime.jsx(rt,{id:`drop-${D}-${e}`,position:D,activeClassName:s.dropPreview},D))}),a!==null&&a!==e&&re&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:15,pointerEvents:"none"},children:jsxRuntime.jsx(rt,{id:`drop-locked-${e}`,position:"full",activeClassName:s.lockedPreview||""})})]})})})};Ce.Content=ho;Ce.DragHandle=Bt;Ce.Tabs=st;Ce.Tab=Ee;Ce.Controls=Yt;exports.Pane=Ce;exports.PaneTree=ot;exports.Zeugma=On;exports.usePaneContext=_t;exports.useResizer=nt;exports.useZeugma=un;exports.useZeugmaContext=pn;//# sourceMappingURL=index.cjs.map
|
|
9
|
+
`,document.head.appendChild(o),t.setAttribute("data-resizing","true");let l=s=>{n(s);},a=()=>{document.body.classList.remove("zeugma-resizing"),t.removeAttribute("data-resizing");let s=document.getElementById("zeugma-global-cursor-style");s&&s.remove(),document.removeEventListener("pointermove",l),document.removeEventListener("pointerup",a),r();};document.addEventListener("pointermove",l),document.addEventListener("pointerup",a);}function we(e){try{return JSON.stringify(e)}catch{return ""}}var je=Dn.createContext(void 0),Ke=Dn.createContext(void 0),be=Dn.createContext(void 0),Qe=Dn.createContext(void 0),re=()=>{let e=Dn.useContext(je);if(!e)throw new Error("useZeugmaState must be used within a Zeugma provider");return e},$e=()=>{let e=Dn.useContext(Ke);if(!e)throw new Error("useZeugmaActions must be used within a Zeugma provider");return e},Ae=()=>{let e=Dn.useContext(Qe);if(!e)throw new Error("useZeugmaDrag must be used within a Zeugma provider");return e};function pt(e){let t=Dn.useRef(null);return Dn.useEffect(()=>{if(!e){t.current=null;return}let n=o=>{t.current={x:o.clientX,y:o.clientY};},r=o=>{let l=o.touches[0]||o.changedTouches[0];l&&(t.current={x:l.clientX,y:l.clientY});};return window.addEventListener("pointermove",n,{passive:true}),window.addEventListener("touchmove",r,{passive:true}),()=>{window.removeEventListener("pointermove",n),window.removeEventListener("touchmove",r);}},[e]),t}function ft(e){Dn.useEffect(()=>(e?document.body.style.setProperty("cursor","not-allowed","important"):document.body.style.removeProperty("cursor"),()=>{document.body.style.removeProperty("cursor");}),[e]);}function gt(){let[e,t]=Dn.useState({}),n=Dn.useRef({}),r=Dn.useRef(null),o=Dn.useRef({}),l=Dn.useRef(null),a=Dn.useRef(true);Dn.useEffect(()=>(a.current=true,()=>{a.current=false;}),[]);let s=Dn.useCallback((f,v,P)=>{a.current&&t(g=>{if(!v){if(P&&g[f]!==P||!g[f])return g;let w={...g};return delete w[f],w}return g[f]===v?g:{...g,[f]:v}});},[]),i=Dn.useCallback((f,v)=>{n.current[f]=v;},[]),d=Dn.useCallback(f=>{r.current=f;},[]),u=Dn.useCallback((f,v)=>{o.current[f]=v;},[]);return {portalTargets:e,registerPortalTarget:s,registerRenderCallback:i,renderCallbacksRef:n,registerRenderPane:d,renderPaneRef:r,registerTabHeader:u,tabHeadersRef:o,activeIdRef:l}}function dn(e){let t=new Set;function n(r){r&&(r.type==="pane"?r.tabIds.forEach(o=>{t.add(o);}):r.type==="split"&&(n(r.first),n(r.second)));}return n(e),Array.from(t).sort()}function mt(e){return Dn.useMemo(()=>dn(e),[e])}function bt(e){let{onDragStart:t,onDragEnd:n}=e,[r,o]=Dn.useState(null),[l,a]=Dn.useState(null),s=Dn.useCallback(d=>{t&&t(d);},[t]),i=Dn.useCallback((d,u,f)=>{n&&n(d,u,f);},[n]);return {overTabId:r,setOverTabId:o,overTabPosition:l,setOverTabPosition:a,handleDragStartInternal:s,handleDragEndInternal:i}}function vt(e){let n=Dn.useContext(be)?.registerRenderPane;Dn.useEffect(()=>{n&&e&&n(e);},[n,e]);}function de(){return "pane-"+Math.random().toString(36).substring(2,11)}function fe(e,t){if(e===null)return null;if(e.type==="pane")return e.id===t?null:e;let n=fe(e.first,t),r=fe(e.second,t);return n===null?r:r===null?n:{...e,first:n,second:r}}function ue(e,t){if(e===null)return null;if(e.type==="pane"){if(e.tabIds.includes(t)){let o=e.tabIds.filter(s=>s!==t);if(o.length===0)return null;let l=e.activeTabId;e.activeTabId===t&&(l=o[0]);let a={...e.tabsMetadata};return delete a[t],{...e,tabIds:o,activeTabId:l,tabsMetadata:Object.keys(a).length>0?a:void 0}}return e}let n=ue(e.first,t),r=ue(e.second,t);return n===null?r:r===null?n:{...e,first:n,second:r}}function ye(e,t,n,r,o){if(e===null)return typeof o=="string"?{type:"pane",id:de(),tabIds:[o],activeTabId:o}:o;if(e.type==="pane"){if(e.id===t){let l=typeof o=="string"?{type:"pane",id:de(),tabIds:[o],activeTabId:o}:o,a=r==="left"||r==="top";return {type:"split",direction:n,first:a?l:e,second:a?e:l,splitPercentage:50}}return e}return {...e,first:ye(e.first,t,n,r,o)||e.first,second:ye(e.second,t,n,r,o)||e.second}}function un(e,t){if(e===null)return t;function n(r,o){return r.type==="pane"?{type:"split",direction:o==="row"?"column":"row",splitPercentage:50,first:r,second:t}:{...r,second:n(r.second,r.direction)}}return n(e,null)}function ht(e,t,n,r){if(e===null)return {type:"pane",id:de(),tabIds:[n],activeTabId:n,tabsMetadata:r?{[n]:r}:void 0};let o=t?K(e,t):null;if(o&&o.type==="pane"){let s=function(i){if(i.type==="pane"&&i.id===t){let d=[...i.tabIds];d.includes(n)||d.push(n);let u=i.tabsMetadata;return r&&(u={...i.tabsMetadata,[n]:r}),{...i,tabIds:d,activeTabId:n,tabsMetadata:u}}return i.type==="split"?{...i,first:s(i.first),second:s(i.second)}:i};return s(e)}let l={type:"pane",id:de(),tabIds:[n],activeTabId:n,tabsMetadata:r?{[n]:r}:void 0};return un(e,l)}function Te(e,t,n){return e===null?null:e===t?{...e,splitPercentage:n}:e.type==="split"?{...e,first:Te(e.first,t,n)||e.first,second:Te(e.second,t,n)||e.second}:e}function K(e,t){return e===null?null:e.type==="pane"?e.id===t?e:null:e.type==="split"?K(e.first,t)??K(e.second,t):null}function B(e,t){return e===null?null:e.type==="pane"?e.tabIds.includes(t)?e:null:e.type==="split"?B(e.first,t)??B(e.second,t):null}function Tt(e,t){return K(e,t)??B(e,t)}function Pt(e,t){let n=B(e,t);if(!n)return null;let r=n.tabIds.indexOf(t);return {id:t,paneId:n.id,isActive:n.activeTabId===t,index:r,metadata:n.tabsMetadata?.[t]}}function Rt(e,t){return B(e,t)?.tabsMetadata?.[t]}function xt(e,t){let n=K(e,t);return n?.tabsMetadata?.[n.activeTabId]}function Oe(e,t,n){if(e===null)return null;if(e.type==="pane"){if(e.tabIds.includes(t)){let r=e.tabsMetadata||{},o=r[t],l=n(o),a={...r};return l===void 0?delete a[t]:a[t]=l,{...e,tabsMetadata:Object.keys(a).length>0?a:void 0}}return e}return e.type==="split"?{...e,first:Oe(e.first,t,n)??e.first,second:Oe(e.second,t,n)??e.second}:e}function Fe(e,t,n){if(e===null)return null;if(e.type==="pane"){if(e.id===t){if(n===false){let{locked:r,...o}=e;return o}return {...e,locked:n}}return e}return e.type==="split"?{...e,first:Fe(e.first,t,n)??e.first,second:Fe(e.second,t,n)??e.second}:e}function De(e,t,n){return e===null?null:e.type==="pane"?e.id===t?e.activeTabId===n?e:{...e,activeTabId:n}:e:e.type==="split"?{...e,first:De(e.first,t,n)??e.first,second:De(e.second,t,n)??e.second}:e}function yt(e,t,n){if(e===null)return null;let o=B(e,t)?.tabsMetadata?.[t],l=ue(e,t);if(l===null)return {type:"pane",id:de(),tabIds:[t],activeTabId:t,tabsMetadata:o?{[t]:o}:void 0};function a(s){if(s.type==="pane"){if(s.id===n){let i=[...s.tabIds];i.includes(t)||i.push(t);let d={...s.tabsMetadata};return o&&(d[t]=o),{...s,tabIds:i,activeTabId:t,tabsMetadata:Object.keys(d).length>0?d:void 0}}return s}return s.type==="split"?{...s,first:a(s.first),second:a(s.second)}:s}return a(l)}function Be(e,t,n,r="before"){if(e===null)return null;let l=B(e,t)?.tabsMetadata?.[t],a=ue(e,t);if(a===null)return {type:"pane",id:de(),tabIds:[t],activeTabId:t,tabsMetadata:l?{[t]:l}:void 0};function s(i){if(i.type==="pane"){if(i.tabIds.includes(n)){let u=[...i.tabIds].filter(P=>P!==t),f=u.indexOf(n);f<0&&(f=0),r==="after"&&(f+=1),u.splice(f,0,t);let v={...i.tabsMetadata};return l&&(v[t]=l),{...i,tabIds:u,activeTabId:t,tabsMetadata:Object.keys(v).length>0?v:void 0}}return i}return i.type==="split"?{...i,first:s(i.first),second:s(i.second)}:i}return s(a)}function me(e,t=0,n=0,r=100,o=100,l="root"){if(e===null)return {panes:[],splitters:[]};if(e.type==="pane")return {panes:[{paneId:e.id,left:t,top:n,width:r,height:o,node:e}],splitters:[]};let{direction:a,splitPercentage:s,first:i,second:d}=e,f={id:`splitter-${l}-${a}`,currentNode:e,direction:a,left:a==="row"?t+r*(s/100):t,top:a==="column"?n+o*(s/100):n,width:a==="row"?0:r,height:a==="column"?0:o,parentLeft:t,parentTop:n,parentWidth:r,parentHeight:o},v={panes:[],splitters:[]},P={panes:[],splitters:[]};if(a==="row"){let g=r*(s/100);v=me(i,t,n,g,o,`${l}-L`),P=me(d,t+g,n,r-g,o,`${l}-R`);}else {let g=o*(s/100);v=me(i,t,n,r,g,`${l}-T`),P=me(d,t,n+g,r,o-g,`${l}-B`);}return {panes:[...v.panes,...P.panes],splitters:[f,...v.splitters,...P.splitters]}}function Dt(e,t,n,r="before"){if(e===null)return null;let o=K(e,t);if(!o)return e;let l=o.tabIds,a=o.activeTabId,s=o.tabsMetadata||{},i=fe(e,t);if(i===null)return o;function d(u){if(u.type==="pane"){if(u.tabIds.includes(n)){let v=[...u.tabIds].filter(w=>!l.includes(w)),P=v.indexOf(n);P<0&&(P=0),r==="after"&&(P+=1),v.splice(P,0,...l);let g={...u.tabsMetadata};for(let w of l)s[w]&&(g[w]=s[w]);return {...u,tabIds:v,activeTabId:a,tabsMetadata:Object.keys(g).length>0?g:void 0}}return u}return u.type==="split"?{...u,first:d(u.first),second:d(u.second)}:u}return d(i)}function Ct(e,t,n,r){if(!((t==="tab"||t==="pane")&&n&&e.includes(n))||!r)return -1;let a=e.indexOf(n);return r==="before"?a:a+1}function pn(e){let{initialLayout:t,layout:n,onChange:r,fullscreenPaneId:o,onFullscreenChange:l,locked:a=false}=e,[s,i]=Dn.useState(()=>n!==void 0?n:t??null),[d,u]=Dn.useState(()=>n!==void 0?n:t??null),[f,v]=Dn.useState(()=>we(n!==void 0?n:null)),[P,g]=Dn.useState(o||null),[w,M]=Dn.useState(a),[A,h]=Dn.useState(null),[k,C]=Dn.useState(null),[E,N]=Dn.useState(null),y=Dn.useRef(null),F=Dn.useCallback(c=>{y.current=c;},[]),$=Dn.useRef(s);$.current=s;let X=Dn.useRef(r);X.current=r;let W=Dn.useRef(l);W.current=l;let ne=Dn.useCallback(c=>{g(c),W.current?.(c);},[]);if(Dn.useEffect(()=>{M(a);},[a]),Dn.useEffect(()=>{o!==void 0&&g(o);},[o]),n!==void 0){let c=we(n);c!==f&&(v(c),i(n),u(n));}let D=Dn.useCallback(c=>(...m)=>{let I=$.current,z=c(I,...m);we(I)!==we(z)&&($.current=z,i(z),u(z),X.current?.(z));},[]),ae=Dn.useCallback(D((c,m)=>typeof m=="function"?m(c):m),[D]),oe=Dn.useCallback(c=>{u(m=>typeof c=="function"?c(m):c);},[]),Z=Dn.useCallback(c=>{g(null),W.current?.(null),h(null),C(null),N(null),ae(c),u(()=>typeof c=="function"?c($.current):c);},[ae]),_=Dn.useCallback(D((c,m)=>fe(c,m)),[D]),H=Dn.useCallback(D((c,m,I,z)=>{let q=ue(c,m)??c;return ht(q,I,m,z)}),[D]),b=Dn.useCallback(D((c,m,I,z,q)=>{let te=K(c,m)??B(c,m);if(!te)return c;let O=K(c,q)??B(c,q)??{type:"pane",id:q,tabIds:[q],activeTabId:q},ie=fe(c,O.id);return ye(ie,te.id,I,z,O)}),[D]),S=Dn.useCallback(D((c,m,I)=>Te(c,m,I)),[D]),p=Dn.useCallback(D((c,m,I)=>Oe(c,m,I)),[D]),Q=Dn.useCallback(D((c,m,I)=>{let z=K(c,m)??B(c,m);return z?Fe(c,z.id,I):c}),[D]),R=Dn.useCallback(D((c,m,I)=>{let z=K(c,m)??B(c,m);return z?De(c,z.id,I):c}),[D]),L=Dn.useCallback(D((c,m,I)=>{let z=K(c,I)??B(c,I);return z?yt(c,m,z.id):c}),[D]),ce=Dn.useCallback(D((c,m,I,z)=>Be(c,m,I,z)),[D]),J=Dn.useCallback(D((c,m)=>ue(c,m)),[D]),Y=Dn.useCallback(c=>K($.current,c),[]),G=Dn.useCallback(c=>B($.current,c),[]),ee=Dn.useCallback(c=>Pt($.current,c),[]),T=Dn.useCallback(c=>Rt($.current,c),[]),x=Dn.useCallback(c=>xt($.current,c),[]);return {layout:s,setLayout:Z,_internalSetLayout:oe,renderingLayout:d,fullscreenPaneId:P,setFullscreenPaneId:ne,locked:w,setLocked:M,activeId:A,setActiveId:h,activeType:k,setActiveType:C,dismissIntentId:E,setDismissIntentId:N,containerRef:y,setContainerRef:F,removePane:_,addTab:H,updateMetadata:p,updatePaneLock:Q,selectTab:R,mergeTab:L,moveTab:ce,removeTab:J,splitPane:b,updateSplitPercentage:S,findPaneById:Y,findPaneContainingTab:G,findTabById:ee,getTabMetadata:T,getActiveTabMetadata:x}}var fn=()=>{let e=re(),t=$e();return {layout:e.layout,setLayout:e.setLayout,fullscreenPaneId:e.fullscreenPaneId,setFullscreenPaneId:t.setFullscreenPaneId,locked:e.locked,setLocked:t.setLocked,removePane:t.removePane,addTab:t.addTab,updateMetadata:t.updateMetadata,updatePaneLock:t.updatePaneLock,selectTab:t.selectTab,mergeTab:t.mergeTab,removeTab:t.removeTab,splitPane:t.splitPane,updateSplitPercentage:t.updateSplitPercentage,moveTab:t.moveTab,findPaneById:e.findPaneById,findPaneContainingTab:e.findPaneContainingTab,findTabById:e.findTabById,getTabMetadata:e.getTabMetadata,getActiveTabMetadata:e.getActiveTabMetadata}};var We=class extends core.PointerSensor{static activators=[{eventName:"onPointerDown",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]},Ue=class extends core.TouchSensor{static activators=[{eventName:"onTouchStart",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]};var St=e=>{let n=e.active.id.toString().startsWith("tab-header-"),o=core.pointerWithin(e);if(o.length>0)return [...o].sort((a,s)=>{let i=a.id.toString(),d=s.id.toString(),u=i.startsWith("tab-drop-"),f=d.startsWith("tab-drop-");if(u&&!f)return -1;if(!u&&f)return 1;let v=i.startsWith("drop-root-"),P=d.startsWith("drop-root-");return v&&!P?-1:!v&&P?1:0});if(n){let l=e.droppableContainers.filter(a=>a.id.toString().startsWith("tab-drop-"));return core.closestCenter({...e,droppableContainers:l})}return []};function Ne(e){if(e instanceof MouseEvent||e instanceof PointerEvent)return {x:e.clientX,y:e.clientY};if(typeof TouchEvent<"u"&&e instanceof TouchEvent){let t=e.touches[0]||e.changedTouches[0];if(t)return {x:t.clientX,y:t.clientY}}return null}function Mt(e){let{layout:t,_internalSetLayout:n,setLayout:r,activeId:o,setActiveId:l,activeType:a,setActiveType:s,dismissIntentId:i,setDismissIntentId:d,setOverTabId:u,setOverTabPosition:f,containerRef:v,dragActivationDistance:P,enableDragToDismiss:g,dismissThreshold:w,onRemove:M,onDragStart:A,onDragEnd:h,onDismissIntentChange:k,removeTab:C,removePane:E}=e,N=Dn.useRef(null),y=pt(o),F=Dn.useRef(null),[$,X]=Dn.useState(false);return ft($),{sensors:core.useSensors(core.useSensor(We,{activationConstraint:{distance:P}}),core.useSensor(Ue,{activationConstraint:{delay:250,tolerance:5}})),collisionDetection:St,onDragStart:Z=>{let _=Z.active.id.toString(),H=_.startsWith("tab-header-"),b=H?_.substring(11):_;l(b),s(H?"tab":"pane"),u(null),f(null);let S=Z.activatorEvent;y.current=Ne(S),g&&v.current?N.current=v.current.getBoundingClientRect():N.current=null;let p=t;if(H){let R=B(t,b);R&&(p=De(t,R.id,b)||t);}F.current=p;let Q=H?ue(p,b):fe(p,b);n(Q),A&&A(b);},onDragMove:Z=>{let{over:_}=Z,H=_?.id.toString()||"",b=H.startsWith("drop-locked-");X(T=>T===b?T:b);let S=Z.active.id.toString(),p=S.startsWith("tab-header-"),Q=p?S.substring(11):S,R=H.match(/^tab-drop-(.+)$/);if(R&&_&&(p||a==="pane")){let[,T]=R;if(Q!==T){let x="before",se=_.rect,c=Z.activatorEvent,m=null;if(y.current)m=y.current.x;else {let I=Ne(c);I&&(m=I.x+Z.delta.x);}if(m!==null){let I=se.left+se.width/2;m>I&&(x="after");}u(I=>I===T?I:T),f(I=>I===x?I:x);}else u(x=>x===null?x:null),f(x=>x===null?x:null);}else u(T=>T===null?T:null),f(T=>T===null?T:null);if(!g)return;let L=N.current;if(!L){i!==null&&(d(null),k?.(null));return}let ce=Z.activatorEvent,J=null,Y=null;if(y.current)J=y.current.x,Y=y.current.y;else {let T=Ne(ce);T&&(J=T.x+Z.delta.x,Y=T.y+Z.delta.y);}let G=0;if(J!==null&&Y!==null){let T=0,x=0;J<L.left?T=L.left-J:J>L.right&&(T=J-L.right),Y<L.top?x=L.top-Y:Y>L.bottom&&(x=Y-L.bottom),G=Math.sqrt(T*T+x*x);}else {let T=Z.active.rect.current.translated;if(T){let x=T.left+T.width/2,se=T.top+T.height/2,c=0,m=0;x<L.left?c=L.left-x:x>L.right&&(c=x-L.right),se<L.top?m=L.top-se:se>L.bottom&&(m=se-L.bottom),G=Math.sqrt(c*c+m*m);}}G>w?i!==Q&&(d(Q),k?.(Q)):i!==null&&(d(null),k?.(null));},onDragEnd:Z=>{l(null),s(null),X(false),u(null),f(null);let{active:_,over:H}=Z,b=_.id.toString(),S=b.startsWith("tab-header-"),p=S?b.substring(11):b,Q=g&&i===p;d(null),k?.(null),N.current=null;let R=F.current||t;if(F.current=null,Q){M?M(p):S?C(p):E(p),h&&h(p,null,null);return}if(!H){n(R),h&&h(p,null,null);return}let L=H.id.toString();if(L.startsWith("drop-locked-")){n(R),h&&h(p,null,null);return}let ce=L.match(/^tab-drop-(.+)$/);if(ce){let[,q]=ce;if(S)if(p!==q){let te="before",O=H.rect,ie=Z.activatorEvent,j=null;if(y.current)j=y.current.x;else {let U=Ne(ie);U&&(j=U.x+Z.delta.x);}if(j!==null){let U=O.left+O.width/2;j>U&&(te="after");}let pe=Be(R,p,q,te);r(pe),h&&h(p,q,{type:"move",position:"center"});}else n(R),h&&h(p,null,null);else {let te="before",O=H.rect,ie=Z.activatorEvent,j=null;if(y.current)j=y.current.x;else {let U=Ne(ie);U&&(j=U.x+Z.delta.x);}if(j!==null){let U=O.left+O.width/2;j>U&&(te="after");}let pe=Dt(R,p,q,te);r(pe),h&&h(p,q,{type:"move",position:"center"});}return}let J=L.match(/^drop-root-(1\/4|1\/3)-(top|bottom|left|right|start|end)$/);if(J){let[,q,te]=J,O=te;O==="start"&&(O="left"),O==="end"&&(O="right");let ie=S?ue(R,p):fe(R,p),j;if(S){let U=B(R,p)?.tabsMetadata?.[p];j={type:"pane",id:de(),tabIds:[p],activeTabId:p,tabsMetadata:U?{[p]:U}:void 0};}else j=K(R,p)??{type:"pane",id:de(),tabIds:[p],activeTabId:p};if(ie===null)r(j);else {let pe=O==="left"||O==="right",U=O==="left"||O==="top",he=50;q==="1/4"?he=U?25:75:q==="1/3"&&(he=U?100/3:200/3),r({type:"split",direction:pe?"row":"column",first:U?j:ie,second:U?ie:j,splitPercentage:he});}h&&h(p,"root",{type:"split",direction:O==="left"||O==="right"?"row":"column",position:O});return}let Y=L.match(/^drop-(left|right|top|bottom)-(.+)$/);if(!Y){n(R),h&&h(p,null,null);return}let[,G,ee]=Y,T=S?B(R,p):K(R,p),x=T&&T.id===ee,se=T&&T.tabIds.length===1;if(p===ee||x&&se){n(R),h&&h(p,null,null);return}let c=G==="left"||G==="right"?"row":"column",m;if(S){let te=B(R,p)?.tabsMetadata?.[p];m={type:"pane",id:de(),tabIds:[p],activeTabId:p,tabsMetadata:te?{[p]:te}:void 0};}else m=K(R,p)??{type:"pane",id:de(),tabIds:[p],activeTabId:p};let I=S?ue(R,p):fe(R,p),z=ye(I,ee,c,G,m);r(z),h&&h(p,ee,{type:"split",direction:c,position:G});},onDragCancel:()=>{l(null),s(null),X(false),u(null),f(null),d(null),k?.(null),N.current=null;let Z=F.current||t;F.current=null,n(Z),Z!==t&&r(Z);}}}function Lt({persist:e,layout:t,setLayout:n}){let r=typeof e=="object"?e.enabled!==false:!!e,o=typeof e=="object"&&e.key||"zeugma-layout",[l,a]=Dn.useState(false);Dn.useEffect(()=>{if(r){let s=localStorage.getItem(o);if(s)try{let i=JSON.parse(s);i&&n(i);}catch(i){console.error("Failed to parse persisted zeugma layout",i);}}a(true);},[r,o,n]),Dn.useEffect(()=>{r&&l&&(t?localStorage.setItem(o,JSON.stringify(t)):localStorage.removeItem(o));},[r,o,t,l]);}var Zt=({activeId:e,render:t,className:n})=>{let r=Dn.useRef(null);return Dn.useEffect(()=>{let o=l=>{r.current&&(r.current.style.transform=`translate(${l.clientX+12}px, ${l.clientY+12}px)`);};return document.addEventListener("pointermove",o),()=>document.removeEventListener("pointermove",o)},[]),jsxRuntime.jsx("div",{ref:r,className:n,style:{position:"fixed",top:0,left:0,zIndex:9999,pointerEvents:"none"},children:t(e)})};var kt=Dn__default.default.memo(({tabDetails:e,target:t,renderWidget:n})=>{let{id:r}=e,[o,l]=Dn.useState(false),a=Dn.useRef(null);if(Dn.useEffect(()=>{l(true);},[]),Dn.useEffect(()=>{if(!o||!a.current)return;let i=a.current;if(t)t.appendChild(i);else {let d=document.getElementById("zeugma-hidden-portal-container");d||(d=document.createElement("div"),d.id="zeugma-hidden-portal-container",d.style.display="none",document.body.appendChild(d)),d.appendChild(i);}},[t,o]),Dn.useEffect(()=>()=>{a.current&&a.current.remove();},[]),!o)return null;a.current||(a.current=document.createElement("div"),a.current.className=`zeugma-portal-wrapper-${r}`,a.current.style.width="100%",a.current.style.height="100%");let s=a.current;return !s||!n?null:reactDom.createPortal(n(e),s)},(e,t)=>e.target===t.target&&e.renderWidget===t.renderWidget&&e.tabDetails.id===t.tabDetails.id&&e.tabDetails.paneId===t.tabDetails.paneId&&e.tabDetails.isActive===t.tabDetails.isActive&&e.tabDetails.index===t.tabDetails.index&&e.tabDetails.metadata===t.tabDetails.metadata);var zt=({activeId:e,activeType:t,dismissIntentId:n,renderDragOverlay:r,renderPaneRef:o,renderPane:l,tabHeadersRef:a,classNames:s})=>{if(r)return jsxRuntime.jsx(jsxRuntime.Fragment,{children:r({type:t,id:e,isDismissing:e===n})});if(t==="pane"){let i=o.current||l;if(i)return jsxRuntime.jsx("div",{className:s.paneDragPreview||"",style:{pointerEvents:"none",width:"420px",height:"260px",overflow:"hidden"},children:i(e)})}else if(t==="tab"){let i=o.current||l;if(i)return jsxRuntime.jsx("div",{className:s.tabDragPreview||"",style:{pointerEvents:"none",width:"420px",height:"260px",overflow:"hidden"},children:i(e)});let d=a.current[e];if(d){let u=s.tab?typeof s.tab=="function"?s.tab(e):s.tab:"";return jsxRuntime.jsx("div",{className:`${s.tabDragPreview||""} ${u}`.trim(),style:{display:"inline-flex",position:"relative",pointerEvents:"none",overflow:"hidden"},children:d({isDragging:true,isOver:false})})}}return jsxRuntime.jsx("div",{style:{pointerEvents:"none",overflow:"hidden",width:"100%",height:"100%"}})};function nt({containerRef:e,isRow:t,direction:n,splitPercentage:r,resizerSize:o,snapThreshold:l,layout:a,currentNode:s,onLayoutChange:i,onResizeStart:d,onResizeEnd:u,parentLeft:f,parentTop:v,parentWidth:P,parentHeight:g}){let{onResizeStart:w,onResize:M,onResizeEnd:A,minSplitPercentage:h=5,maxSplitPercentage:k=95,locked:C=false}=re();return Dn.useCallback(E=>{if(C)return;E.preventDefault();let N=e.current;if(!N)return;d&&d(),w&&w(s);let y=N.getBoundingClientRect(),F=E.clientX,$=E.clientY,X=r,W=E.currentTarget,ne=y.left+y.width*(f/100),D=y.top+y.height*(v/100),ae=y.width*(P/100),oe=y.height*(g/100),_=Array.from(document.querySelectorAll('div[role="separator"][data-direction]')).filter(b=>b!==W&&b.getAttribute("data-direction")===n).map(b=>{let S=b.getBoundingClientRect();return t?S.left+S.width/2:S.top+S.height/2}),H=X;ut({cursor:t?"col-resize":"row-resize",resizerEl:W,onMove:b=>{let S=t?(b.clientX-F)/ae*100:(b.clientY-$)/oe*100,p=X+S,Q=t?ne+(ae-o)*(p/100)+o/2:D+(oe-o)*(p/100)+o/2,R=1/0,L=null;for(let G of _){let ee=Math.abs(Q-G);ee<l&&ee<R&&(R=ee,L=G);}let ce=p;L!==null&&(ce=t?(L-o/2-ne)/(ae-o)*100:(L-o/2-D)/(oe-o)*100);let J=Math.max(h,Math.min(k,ce));H=J;let Y=Te(a,s,J);if(Y){let{panes:G,splitters:ee}=me(Y),T=e.current;if(T){for(let x of G)T.style.setProperty(`--pane-left-${x.paneId}`,`${x.left}%`),T.style.setProperty(`--pane-top-${x.paneId}`,`${x.top}%`),T.style.setProperty(`--pane-width-${x.paneId}`,`${x.width}%`),T.style.setProperty(`--pane-height-${x.paneId}`,`${x.height}%`);for(let x of ee)T.style.setProperty(`--splitter-pos-${x.id}`,`${x.direction==="row"?x.left:x.top}%`);}}M&&M(s,J);},onEnd:()=>{let b=Te(a,s,H),S=e.current;if(S){let{panes:p,splitters:Q}=me(b);for(let R of p)S.style.removeProperty(`--pane-left-${R.paneId}`),S.style.removeProperty(`--pane-top-${R.paneId}`),S.style.removeProperty(`--pane-width-${R.paneId}`),S.style.removeProperty(`--pane-height-${R.paneId}`);for(let R of Q)S.style.removeProperty(`--splitter-pos-${R.id}`);}i(b),u&&u(),A&&A(s,H);}});},[e,t,n,r,o,l,a,s,i,d,u,w,M,A,h,k,f,v,P,g])}var $t=({splitter:e,resizerSize:t,snapThreshold:n,containerRef:r})=>{let{renderingLayout:o,setLayout:l,classNames:a,locked:s}=re(),[i,d]=Dn.useState(false),{currentNode:u,direction:f,left:v,top:P,width:g,height:w,parentLeft:M,parentTop:A,parentWidth:h,parentHeight:k}=e,C=f==="row",E=nt({containerRef:r,isRow:C,direction:f,splitPercentage:u.splitPercentage,resizerSize:t,snapThreshold:n,layout:o,currentNode:u,onLayoutChange:l,onResizeStart:()=>d(true),onResizeEnd:()=>d(false),parentLeft:M,parentTop:A,parentWidth:h,parentHeight:k}),N=C?{position:"absolute",left:`calc(var(--splitter-pos-${e.id}, ${v}%) - ${t/2}px)`,top:`calc(${P}% + ${t/2}px)`,width:`${t}px`,height:`calc(${w}% - ${t}px)`,cursor:s?"default":"col-resize",pointerEvents:s?"none":"auto",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box"}:{position:"absolute",left:`calc(${v}% + ${t/2}px)`,top:`calc(var(--splitter-pos-${e.id}, ${P}%) - ${t/2}px)`,width:`calc(${g}% - ${t}px)`,height:`${t}px`,cursor:s?"default":"row-resize",pointerEvents:s?"none":"auto",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box"};return jsxRuntime.jsx("div",{className:a.resizer||"","data-direction":f,"data-resizing":i||void 0,style:N,onPointerDown:E,role:"separator","aria-valuenow":u.splitPercentage,"aria-valuemin":5,"aria-valuemax":95})},At=Dn__default.default.memo(({paneId:e,renderPane:t})=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:t(e)}),(e,t)=>e.paneId===t.paneId&&e.renderPane===t.renderPane);var ot=({renderPane:e,tree:t,resizerSize:n,snapThreshold:r})=>{vt(e);let{renderingLayout:o,activeId:l,dismissIntentId:a,setContainerRef:s,fullscreenPaneId:i,snapThreshold:d,locked:u,classNames:f,resizerSize:v}=re(),P=r!==void 0?r:d??8,g=n!==void 0?n:v??4,w=t!==void 0?t:o,M=Dn.useRef(null),{panes:A,splitters:h}=Dn.useMemo(()=>w?me(w):{panes:[],splitters:[]},[w]);if(!w&&t!==void 0)return null;let k=()=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[A.map(C=>{let E=i===C.paneId;return jsxRuntime.jsx("div",{style:{position:"absolute",left:E?"0%":`var(--pane-left-${C.paneId}, ${C.left}%)`,top:E?"0%":`var(--pane-top-${C.paneId}, ${C.top}%)`,width:E?"100%":`var(--pane-width-${C.paneId}, ${C.width}%)`,height:E?"100%":`var(--pane-height-${C.paneId}, ${C.height}%)`,overflow:"hidden",zIndex:E?20:1,display:i&&!E?"none":"block",padding:E?"0px":`${g/2}px`,boxSizing:"border-box"},children:jsxRuntime.jsx(At,{paneId:C.paneId,renderPane:e})},C.paneId)}),!i&&h.map(C=>jsxRuntime.jsx($t,{splitter:C,resizerSize:g,snapThreshold:P,containerRef:M},C.id))]});if(t===void 0){let C=l!==null&&l===a,E=y=>{s(y),M.current=y;},N=`${f.dashboard||""} ${C&&f.dashboardDismissActive||""} ${u&&f.dashboardLocked||""}`.trim();return jsxRuntime.jsxs("div",{ref:E,className:N,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:[k(),l!==null&&!u&&jsxRuntime.jsx(Ft,{activeClassName:f.rootDropPreview??f.dropPreview})]})}return jsxRuntime.jsx("div",{ref:M,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:k()})};var Hn=e=>{let{controller:t,children:n,renderDragOverlay:r,classNames:o={},renderPane:l,resizerSize:a,dragActivationDistance:s=8,snapThreshold:i=8,minSplitPercentage:d=5,maxSplitPercentage:u=95,enableDragToDismiss:f=false,dismissThreshold:v=60,onRemove:P,onDragStart:g,onDragEnd:w,onResizeStart:M,onResize:A,onResizeEnd:h,onDismissIntentChange:k,persist:C=false}=e,E=t,{layout:N,setLayout:y,_internalSetLayout:F,renderingLayout:$,fullscreenPaneId:X,setFullscreenPaneId:W,locked:ne,setLocked:D,findPaneById:ae,findPaneContainingTab:oe,findTabById:Z,getTabMetadata:_,getActiveTabMetadata:H,activeId:b,setActiveId:S,activeType:p,setActiveType:Q,dismissIntentId:R,setDismissIntentId:L,containerRef:ce,setContainerRef:J,removePane:Y,addTab:G,updateMetadata:ee,updatePaneLock:T,selectTab:x,mergeTab:se,removeTab:c,splitPane:m,updateSplitPercentage:I,moveTab:z}=E;Lt({persist:C,layout:N,setLayout:y});let{portalTargets:q,registerPortalTarget:te,registerRenderCallback:O,renderCallbacksRef:ie,registerRenderPane:j,renderPaneRef:pe,registerTabHeader:U,tabHeadersRef:he,activeIdRef:Se}=gt(),{overTabId:it,setOverTabId:jt,overTabPosition:lt,setOverTabPosition:Kt,handleDragStartInternal:Qt,handleDragEndInternal:en}=bt({onDragStart:g,onDragEnd:w}),tn=Mt({layout:N,_internalSetLayout:F,setLayout:y,activeId:b,setActiveId:S,activeType:p,setActiveType:Q,dismissIntentId:R,setDismissIntentId:L,setOverTabId:jt,setOverTabPosition:Kt,containerRef:ce,dragActivationDistance:s,enableDragToDismiss:f,dismissThreshold:v,onRemove:P,onDragStart:Qt,onDragEnd:en,onDismissIntentChange:k,removeTab:c,removePane:Y}),_e=Dn.useMemo(()=>o,[o.dashboard,o.dashboardDismissActive,o.pane,o.paneLocked,o.dropPreview,o.rootDropPreview,o.dragOverlay,o.paneDragPreview,o.tabDragPreview,o.resizer,o.dismissPreview,o.dashboardLocked,o.lockedPreview,o.tabDropPreview,o.tabSeparator,o.tabsContainer,o.tab,o.paneContainer,o.paneHeader,o.paneControls,o.paneButton,o.tabCloseButton,o.dragHandle]),ct=Dn.useCallback((ge,ke)=>{h&&h(ge,ke);},[h]),nn=Dn.useMemo(()=>({layout:N,renderingLayout:$,setLayout:y,activeId:b,activeType:p,dismissIntentId:R,setContainerRef:J,fullscreenPaneId:X,classNames:_e,onRemove:P,onFullscreenChange:W,snapThreshold:i,onResizeStart:M,onResize:A,onResizeEnd:ct,minSplitPercentage:d,maxSplitPercentage:u,locked:ne,setLocked:D,findPaneById:ae,findPaneContainingTab:oe,findTabById:Z,getTabMetadata:_,getActiveTabMetadata:H,renderPane:l,resizerSize:a}),[N,$,b,p,R,J,X,_e,P,W,i,M,A,d,u,y,ct,ne,D,ae,oe,Z,_,H,l,a]),on=Dn.useMemo(()=>({overTabId:it,overTabPosition:lt}),[it,lt]),rn=Dn.useMemo(()=>({removePane:Y,addTab:G,updateMetadata:ee,updatePaneLock:T,selectTab:x,mergeTab:se,removeTab:c,setFullscreenPaneId:W,setLocked:D,splitPane:m,updateSplitPercentage:I,moveTab:z}),[Y,G,ee,T,x,se,c,W,D,m,I,z]),an=mt(N),sn=Dn.useMemo(()=>({registerPortalTarget:te,registerRenderCallback:O,renderCallbacksRef:ie,registerRenderPane:j,renderPaneRef:pe,registerTabHeader:U,tabHeadersRef:he,activeIdRef:Se}),[te,O,ie,j,pe,U,he,Se]);return Se&&(Se.current=b),jsxRuntime.jsx(Ke.Provider,{value:rn,children:jsxRuntime.jsx(je.Provider,{value:nn,children:jsxRuntime.jsx(Qe.Provider,{value:on,children:jsxRuntime.jsxs(be.Provider,{value:sn,children:[jsxRuntime.jsx(core.DndContext,{id:"zeugma-dnd-context",...tn,children:n}),b&&p&&jsxRuntime.jsx(Zt,{activeId:b,render:ge=>jsxRuntime.jsx("div",{style:{transition:"transform 150ms cubic-bezier(0.2, 0, 0, 1)",transform:ge===R?"scale(0.8)":"scale(1)",transformOrigin:"top left"},children:jsxRuntime.jsx(zt,{activeId:ge,activeType:p,dismissIntentId:R,renderDragOverlay:r,renderPaneRef:pe,renderPane:l,tabHeadersRef:he,classNames:_e})}),className:`${o.dragOverlay||""} ${b===R&&o.dismissPreview||""}`.trim()}),jsxRuntime.jsx("div",{id:"zeugma-portal-host",style:{display:"none"},children:an.map(ge=>{let ke=q[ge],dt=Z(ge);return dt?jsxRuntime.jsx(kt,{tabDetails:dt,target:ke||null,renderWidget:ie.current[ge]},ge):null})})]})})})})},On=({renderPane:e,resizerSize:t,snapThreshold:n})=>{if(!e)throw new Error("Zeugma component requires a renderPane prop when used as a standalone renderer.");return jsxRuntime.jsx(ot,{renderPane:e,resizerSize:t,snapThreshold:n})},Fn=e=>{let{children:t,...n}=e,{controller:r}=e;if(!r)throw new Error("Zeugma component requires a controller.");return jsxRuntime.jsx(Hn,{...e,children:t!==void 0?t:jsxRuntime.jsx(On,{...n})})};var Wn={top:{"1/4":{position:"absolute",top:0,left:0,width:"100%",height:"24px",zIndex:100,pointerEvents:"auto"},"1/3":{position:"absolute",top:"24px",left:0,width:"100%",height:"24px",zIndex:100,pointerEvents:"auto"}},bottom:{"1/4":{position:"absolute",bottom:0,left:0,width:"100%",height:"24px",zIndex:100,pointerEvents:"auto"},"1/3":{position:"absolute",bottom:"24px",left:0,width:"100%",height:"24px",zIndex:100,pointerEvents:"auto"}},left:{"1/4":{position:"absolute",left:0,top:"48px",width:"24px",height:"calc(100% - 96px)",zIndex:100,pointerEvents:"auto"},"1/3":{position:"absolute",left:"24px",top:"48px",width:"24px",height:"calc(100% - 96px)",zIndex:100,pointerEvents:"auto"}},right:{"1/4":{position:"absolute",right:0,top:"48px",width:"24px",height:"calc(100% - 96px)",zIndex:100,pointerEvents:"auto"},"1/3":{position:"absolute",right:"24px",top:"48px",width:"24px",height:"calc(100% - 96px)",zIndex:100,pointerEvents:"auto"}}},Un={top:{"1/4":{top:0,left:0,width:"100%",height:"60px",borderBottomLeftRadius:"12px",borderBottomRightRadius:"12px",borderTopLeftRadius:"0px",borderTopRightRadius:"0px"},"1/3":{top:0,left:0,width:"100%",height:"96px",borderBottomLeftRadius:"12px",borderBottomRightRadius:"12px",borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}},bottom:{"1/4":{bottom:0,left:0,width:"100%",height:"60px",borderTopLeftRadius:"12px",borderTopRightRadius:"12px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px"},"1/3":{bottom:0,left:0,width:"100%",height:"96px",borderTopLeftRadius:"12px",borderTopRightRadius:"12px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px"}},left:{"1/4":{left:0,top:0,width:"60px",height:"100%",borderTopRightRadius:"12px",borderBottomRightRadius:"12px",borderTopLeftRadius:"0px",borderBottomLeftRadius:"0px"},"1/3":{left:0,top:0,width:"96px",height:"100%",borderTopRightRadius:"12px",borderBottomRightRadius:"12px",borderTopLeftRadius:"0px",borderBottomLeftRadius:"0px"}},right:{"1/4":{right:0,top:0,width:"60px",height:"100%",borderTopLeftRadius:"12px",borderBottomLeftRadius:"12px",borderTopRightRadius:"0px",borderBottomRightRadius:"0px"},"1/3":{right:0,top:0,width:"96px",height:"100%",borderTopLeftRadius:"12px",borderBottomLeftRadius:"12px",borderTopRightRadius:"0px",borderBottomRightRadius:"0px"}}},Xn=({id:e,fraction:t,edge:n,activeClassName:r})=>{let{setNodeRef:o,isOver:l}=core.useDroppable({id:e}),a={position:"absolute",pointerEvents:"none",zIndex:101,boxSizing:"border-box",...Un[n][t]};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:o,style:Wn[n][t]}),l&&jsxRuntime.jsx("div",{className:r,style:a})]})},Ft=({activeClassName:e})=>jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:99,pointerEvents:"none"},children:[{id:"drop-root-1/4-top",fraction:"1/4",edge:"top"},{id:"drop-root-1/3-top",fraction:"1/3",edge:"top"},{id:"drop-root-1/4-bottom",fraction:"1/4",edge:"bottom"},{id:"drop-root-1/3-bottom",fraction:"1/3",edge:"bottom"},{id:"drop-root-1/4-left",fraction:"1/4",edge:"left"},{id:"drop-root-1/3-left",fraction:"1/3",edge:"left"},{id:"drop-root-1/4-right",fraction:"1/4",edge:"right"},{id:"drop-root-1/3-right",fraction:"1/3",edge:"right"}].map(n=>jsxRuntime.jsx(Xn,{id:n.id,fraction:n.fraction,edge:n.edge,activeClassName:e},n.id))});var Je=Dn.createContext(null);var Gn={top:{position:"absolute",top:0,left:0,width:"100%",height:"25%",zIndex:20,pointerEvents:"auto"},bottom:{position:"absolute",bottom:0,left:0,width:"100%",height:"25%",zIndex:20,pointerEvents:"auto"},left:{position:"absolute",top:"25%",left:0,width:"50%",height:"50%",zIndex:20,pointerEvents:"auto"},right:{position:"absolute",top:"25%",right:0,width:"50%",height:"50%",zIndex:20,pointerEvents:"auto"},full:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:20,pointerEvents:"auto",cursor:"not-allowed"}},jn={top:{position:"absolute",top:0,left:0,right:0,height:"50%",zIndex:21,pointerEvents:"none",boxSizing:"border-box"},bottom:{position:"absolute",bottom:0,left:0,right:0,height:"50%",zIndex:21,pointerEvents:"none",boxSizing:"border-box"},left:{position:"absolute",top:0,bottom:0,left:0,width:"50%",zIndex:21,pointerEvents:"none",boxSizing:"border-box"},right:{position:"absolute",top:0,bottom:0,right:0,width:"50%",zIndex:21,pointerEvents:"none",boxSizing:"border-box"},full:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:21,pointerEvents:"none",boxSizing:"border-box"}},rt=({id:e,position:t,activeClassName:n})=>{let{setNodeRef:r,isOver:o}=core.useDroppable({id:e});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:r,style:Gn[t]}),o&&jsxRuntime.jsx("div",{className:n,style:jn[t]})]})};var Vt=({children:e,className:t,style:n})=>{let r=Dn.useContext(Je);if(!r)throw new Error("<DragHandle> must be used inside a <Pane>");let{disabled:o,...l}=r;return jsxRuntime.jsx("div",{className:t,style:{cursor:o?"default":"grab",userSelect:o?"auto":"none",touchAction:o?"auto":"none",...n},...o?{}:l,children:e})};var io=Dn.createContext(void 0);var Ze=({id:e,locked:t=false,children:n,className:r,style:o})=>{let{locked:l,classNames:a={}}=re(),{overTabId:s}=Ae(),i=Dn.useContext(be);Dn.useEffect(()=>(i?.registerTabHeader&&i.registerTabHeader(e,n),()=>{i?.registerTabHeader&&i.activeIdRef?.current!==e&&i.registerTabHeader(e,()=>null);}),[e,n,i]);let d=Dn.useContext(at),u=t||l||(d?.locked??false),{attributes:f,listeners:v,setNodeRef:P,isDragging:g}=core.useDraggable({id:`tab-header-${e}`,disabled:u}),{setNodeRef:w,isOver:M}=core.useDroppable({id:`tab-drop-${e}`,disabled:u}),A=D=>{P(D),w(D);},h=M&&s===e,k=d?.tabIds||[],C=k.indexOf(e),E=d?.activeTabId,y=C>0&&e!==E&&k[C-1]!==E?jsxRuntime.jsx("div",{className:a.tabSeparator}):null,F=d?d.activeTabId===e:false,$=d?.tabsMetadata?.[e],X=Dn.useCallback(()=>{d?.selectTab(e);},[d,e]),W=Dn.useCallback(()=>{d?.removeTab(e);},[d,e]),ne=Dn.useMemo(()=>({tabId:e,isActive:F,isDragging:g,isOver:h,metadata:$,locked:u,selectTab:X,removeTab:W}),[e,F,g,h,$,u,X,W]);return jsxRuntime.jsx(io.Provider,{value:ne,children:jsxRuntime.jsxs("div",{ref:A,id:`tab-header-${e}`,className:r,style:{display:"inline-flex",position:"relative",cursor:u?"default":"grab",...o},...u?{}:v,...u?{}:f,children:[y,n({isDragging:g,isOver:h})]})})};var at=Dn.createContext(void 0);var Jt=(e,t)=>typeof e=="function"?e(t):e,st=({tabIds:e,activeTabId:t,locked:n,tabsMetadata:r,selectTab:o,removeTab:l,renderTab:a,classNames:s,styles:i})=>{let d=Dn.useContext(Ye),u=e??d?.tabIds??[],f=t??d?.activeTabId??"",v=n??d?.locked??false,P=r??d?.tabsMetadata,g=o??d?.selectTab??(()=>{}),w=l??d?.removeTab??(()=>{}),{classNames:M={},activeType:A}=re(),{overTabId:h,overTabPosition:k}=Ae(),C=Dn.useMemo(()=>({tabIds:u,activeTabId:f,locked:v,tabsMetadata:P,selectTab:g,removeTab:w}),[u,f,v,P,g,w]),E=Ct(u,A,h,k);return jsxRuntime.jsx(at.Provider,{value:C,children:jsxRuntime.jsxs("div",{className:s?.container,style:{display:"flex",alignItems:"center",height:"100%",...i?.container},children:[u.map((N,y)=>{let F=P?.[N],$=Jt(s?.tab,N),X=Jt(i?.tab,N),W=y===E;return jsxRuntime.jsxs(Dn__default.default.Fragment,{children:[W&&M.tabDropPreview&&jsxRuntime.jsx("div",{style:{position:"relative",height:"100%",width:0,zIndex:10},children:jsxRuntime.jsx("div",{className:M.tabDropPreview,style:{position:"absolute",top:0,bottom:0,transform:y===0?"none":"translateX(-50%)"}})}),jsxRuntime.jsx(Ze,{id:N,locked:v,className:$,style:X,children:({isDragging:ne,isOver:D})=>a({id:N,paneId:d?.id??"",isActive:N===f,index:y,isDragging:ne,isOver:D,metadata:F,onSelect:()=>g(N),onRemove:()=>w(N)})})]},N)}),E===u.length&&M.tabDropPreview&&jsxRuntime.jsx("div",{style:{position:"relative",height:"100%",width:0,zIndex:10},children:jsxRuntime.jsx("div",{className:M.tabDropPreview,style:{position:"absolute",top:0,bottom:0,transform:"translateX(-100%)"}})})]})})};st.Tab=Ze;var qt=({className:e,style:t,children:n})=>jsxRuntime.jsx("div",{className:e,style:t,children:n});var Ye=Dn.createContext(void 0),Gt=()=>{let e=Dn.useContext(Ye);if(!e)throw new Error("usePaneContext must be used within a Pane component");return e},To=({children:e,className:t,style:n})=>{let{activeTabId:r}=Gt(),{classNames:o}=re(),l=Dn.useRef(null),a=Dn.useContext(be);if(!a)throw new Error("PaneContent must be used within a Zeugma provider");let{registerPortalTarget:s,registerRenderCallback:i}=a,d=Dn.useMemo(()=>typeof e=="function"?e:()=>e,[e]);return i(r,d),Dn.useEffect(()=>{let u=l.current;return s(r,u),()=>{s(r,null,u);}},[r,s]),jsxRuntime.jsx("div",{ref:l,id:`zeugma-tab-target-${r}`,className:`${o.tabContentWrapper||""} ${t||""}`.trim(),style:{height:"100%",width:"100%",...n}})},Ie=({id:e,children:t,style:n,locked:r=false})=>{let{layout:o,renderingLayout:l,activeId:a,activeType:s,classNames:i,fullscreenPaneId:d,onFullscreenChange:u,locked:f}=re(),{removePane:v,updateMetadata:P,selectTab:g,removeTab:w}=$e(),M=Dn.useMemo(()=>{if(s==="tab"&&e===a){let p=B(o,e)?.tabsMetadata?.[e];return {type:"pane",id:e,tabIds:[e],activeTabId:e,tabsMetadata:p?{[e]:p}:void 0}}return Tt(e===a?o:l,e)},[o,l,e,a,s]),A=M?.id??e,h=M?.tabIds??[e],k=M?.activeTabId??e,C=M?.tabsMetadata,E=C?.[e],N=M?.locked??false,y=r||N,F=f||y,$=f||y,X=a!==null&&a!==e&&(!h.includes(a)||h.length>1)&&!$,{attributes:W,listeners:ne,setNodeRef:D}=core.useDraggable({id:e,disabled:F}),ae=a!==null&&h.includes(a),oe=d===e,Z=Dn.useMemo(()=>({isDragging:ae,isFullscreen:oe,toggleFullscreen:()=>u?.(oe?null:e),remove:()=>{oe&&u?.(null),v(A);},metadata:E,updateMetadata:b=>{P(e,b);},locked:F,tabIds:h,activeTabId:k,selectTab:b=>g(A,b),removeTab:b=>{oe&&b===k&&u?.(null),w(b);},tabsMetadata:C,updateTabMetadata:(b,S)=>{P(b,S);}}),[ae,oe,u,e,w,E,P,F,h,k,g,A,C]),_=Dn.useMemo(()=>F?{disabled:true}:{...ne,...W},[ne,W,F]),H=`${i.pane||""} ${y&&i.paneLocked||""}`.trim();return jsxRuntime.jsx(Ye.Provider,{value:{id:e,...Z},children:jsxRuntime.jsx(Je.Provider,{value:_,children:jsxRuntime.jsxs("div",{ref:D,id:e,className:H,style:{position:"relative",width:"100%",height:"100%",...n},children:[t,X&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:15,pointerEvents:"none"},children:["top","bottom","left","right"].map(b=>jsxRuntime.jsx(rt,{id:`drop-${b}-${e}`,position:b,activeClassName:i.dropPreview},b))}),a!==null&&a!==e&&$&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:15,pointerEvents:"none"},children:jsxRuntime.jsx(rt,{id:`drop-locked-${e}`,position:"full",activeClassName:i.lockedPreview||""})})]})})})};Ie.Content=To;Ie.DragHandle=Vt;Ie.Tabs=st;Ie.Tab=Ze;Ie.Controls=qt;exports.Pane=Ie;exports.PaneTree=ot;exports.Zeugma=Fn;exports.usePaneContext=Gt;exports.useResizer=nt;exports.useZeugma=pn;exports.useZeugmaContext=fn;//# sourceMappingURL=index.cjs.map
|
|
10
10
|
//# sourceMappingURL=index.cjs.map
|