react-zeugma 6.9.0 → 6.9.2
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 +118 -67
- package/dist/index.cjs +4 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/{types-u7NTLFqJ.d.cts → types-DFl4yzkP.d.cts} +17 -6
- package/dist/{types-u7NTLFqJ.d.ts → types-DFl4yzkP.d.ts} +17 -6
- package/dist/utils.cjs +1 -1
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -96,28 +96,29 @@ import { Zeugma } from 'react-zeugma'
|
|
|
96
96
|
|
|
97
97
|
##### Props
|
|
98
98
|
|
|
99
|
-
| Property | Description
|
|
100
|
-
| ------------------------ |
|
|
101
|
-
| `controller` | The layout state controller returned by `useZeugma(options)`.
|
|
102
|
-
| `children` | Children components rendered inside the context provider.
|
|
103
|
-
| `renderPane` | Callback function to map active pane IDs to custom pane structures. Required in standalone mode (without children) and must not be passed in provider mode.
|
|
104
|
-
| `renderDragOverlay` | Custom overlay renderer function for the drag-under-cursor preview.
|
|
105
|
-
| `classNames` | CSS class name mapping overrides for custom dashboard and overlay styling.
|
|
106
|
-
| `resizerSize` | Thickness of the split resizer bars in pixels.
|
|
107
|
-
| `dragActivationDistance` | Minimum pointer drag distance (in pixels) required to activate dragging.
|
|
108
|
-
| `snapThreshold` | Threshold in pixels to snap layout resizers to adjacent edges.
|
|
109
|
-
| `minSplitPercentage` | Minimum split limit percentage allowed for resized panes.
|
|
110
|
-
| `maxSplitPercentage` | Maximum split limit percentage allowed for resized panes.
|
|
111
|
-
| `enableDragToDismiss` | Enables drag-out-to-dismiss gesture for widgets.
|
|
112
|
-
| `dismissThreshold` | Distance in pixels outside container bounds required to trigger dismissal.
|
|
113
|
-
| `onRemove` | Callback triggered when a pane is removed.
|
|
114
|
-
| `onDragStart` | Callback triggered when a drag gesture begins.
|
|
115
|
-
| `onDragEnd` | Callback triggered when a drag gesture ends, containing active pane, target pane, and action metadata.
|
|
116
|
-
| `onResizeStart` | Callback triggered when resizing begins.
|
|
117
|
-
| `onResize` | Callback triggered during pane resizing.
|
|
118
|
-
| `onResizeEnd` | Callback triggered when pane resizing completes.
|
|
119
|
-
| `onDismissIntentChange` | Callback triggered when drag-out dismiss intent changes.
|
|
120
|
-
| `persist` | Layout persistence configuration in localStorage. If true, uses default options.
|
|
99
|
+
| Property | Description | Type | Default |
|
|
100
|
+
| ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------- |
|
|
101
|
+
| `controller` | The layout state controller returned by `useZeugma(options)`. | `ZeugmaController` | - |
|
|
102
|
+
| `children` | Children components rendered inside the context provider. | `ReactNode` | - |
|
|
103
|
+
| `renderPane` | Callback function to map active pane IDs to custom pane structures. Required in standalone mode (without children) and must not be passed in provider mode. | `(paneId: string) => ReactNode` | - |
|
|
104
|
+
| `renderDragOverlay` | Custom overlay renderer function for the drag-under-cursor preview. | `(active: DragOverlayActiveItem) => ReactNode` | - |
|
|
105
|
+
| `classNames` | CSS class name mapping overrides for custom dashboard and overlay styling. | `ZeugmaClassNames` | - |
|
|
106
|
+
| `resizerSize` | Thickness of the split resizer bars in pixels. | `number` | `4` |
|
|
107
|
+
| `dragActivationDistance` | Minimum pointer drag distance (in pixels) required to activate dragging. | `number` | `8` |
|
|
108
|
+
| `snapThreshold` | Threshold in pixels to snap layout resizers to adjacent edges. | `number` | `8` |
|
|
109
|
+
| `minSplitPercentage` | Minimum split limit percentage allowed for resized panes. | `number` | `5` |
|
|
110
|
+
| `maxSplitPercentage` | Maximum split limit percentage allowed for resized panes. | `number` | `95` |
|
|
111
|
+
| `enableDragToDismiss` | Enables drag-out-to-dismiss gesture for widgets. | `boolean` | `false` |
|
|
112
|
+
| `dismissThreshold` | Distance in pixels outside container bounds required to trigger dismissal. | `number` | `60` |
|
|
113
|
+
| `onRemove` | Callback triggered when a pane is removed. | `(paneId: string) => void` | - |
|
|
114
|
+
| `onDragStart` | Callback triggered when a drag gesture begins. | `(activeId: string) => void` | - |
|
|
115
|
+
| `onDragEnd` | Callback triggered when a drag gesture ends, containing active pane, target pane, and action metadata. | `(activeId: string, overId: string \| null, dropAction: { type: 'split' \| 'move'; direction?: SplitDirection; position?: 'top' \| 'bottom' \| 'left' \| 'right' \| 'center' } \| null) => void` | - |
|
|
116
|
+
| `onResizeStart` | Callback triggered when resizing begins. | `(currentNode: SplitNode) => void` | - |
|
|
117
|
+
| `onResize` | Callback triggered during pane resizing. | `(currentNode: SplitNode, percentage: number) => void` | - |
|
|
118
|
+
| `onResizeEnd` | Callback triggered when pane resizing completes. | `(currentNode: SplitNode, percentage: number) => void` | - |
|
|
119
|
+
| `onDismissIntentChange` | Callback triggered when drag-out dismiss intent changes. | `(paneId: string \| null) => void` | - |
|
|
120
|
+
| `persist` | Layout persistence configuration in localStorage. If true, uses default options. | `boolean \| ZeugmaPersistOptions` | `false` |
|
|
121
|
+
| `renderPopoutWrapper` | **[Experimental]** Custom wrapper to inject context or style managers (e.g. `styled-components`' `StyleSheetManager` or `antd`'s `StyleProvider`/`ConfigProvider`) into popout windows. | `(props: { tabId: string; document: Document; window: Window; children: React.ReactNode }) => React.ReactNode` | - |
|
|
121
122
|
|
|
122
123
|
##### `ZeugmaPersistOptions`
|
|
123
124
|
|
|
@@ -130,6 +131,25 @@ interface ZeugmaPersistOptions {
|
|
|
130
131
|
}
|
|
131
132
|
```
|
|
132
133
|
|
|
134
|
+
##### `TabDetails`
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
interface TabDetails {
|
|
138
|
+
/** The tab's unique ID. */
|
|
139
|
+
id: string
|
|
140
|
+
/** The ID of the pane containing this tab. */
|
|
141
|
+
paneId: string
|
|
142
|
+
/** True if this tab is currently selected/active. */
|
|
143
|
+
isActive: boolean
|
|
144
|
+
/** The tab's 0-indexed position in the pane tab bar. */
|
|
145
|
+
index: number
|
|
146
|
+
/** Custom metadata associated with this tab. */
|
|
147
|
+
metadata?: Record<string, unknown>
|
|
148
|
+
/** **[Experimental]** Force-remount the component during window transitions instead of adopting the DOM node. */
|
|
149
|
+
remountOnPopout?: boolean
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
133
153
|
---
|
|
134
154
|
|
|
135
155
|
#### `<PaneTree>`
|
|
@@ -290,32 +310,32 @@ const { layout, locked, setLocked, addTab, removePane, selectTab, findPaneById }
|
|
|
290
310
|
|
|
291
311
|
##### Context Values
|
|
292
312
|
|
|
293
|
-
| Property / Method | Description
|
|
294
|
-
| ----------------------- |
|
|
295
|
-
| `layout` | The current active layout tree structure.
|
|
296
|
-
| `fullscreenPaneId` | The ID of the maximized fullscreen pane.
|
|
297
|
-
| `locked` | Whether the dashboard layout is globally locked.
|
|
298
|
-
| `setLayout` | React state setter to update the layout tree.
|
|
299
|
-
| `setFullscreenPaneId` | Updates the active fullscreen pane ID.
|
|
300
|
-
| `setLocked` | Updates the global layout lock state.
|
|
301
|
-
| `removePane` | Removes a pane and collapses the split.
|
|
302
|
-
| `addTab` | Adds a tab to a pane, or splits/creates one if target is omitted.
|
|
303
|
-
| `updateMetadata` | Mutates a specific tab's metadata.
|
|
304
|
-
| `updatePaneLock` | Toggles the lock status of a specific pane.
|
|
305
|
-
| `selectTab` | Focuses/activates a tab within a pane.
|
|
306
|
-
| `mergeTab` | Programmatically drags and drops a tab from one pane to another.
|
|
307
|
-
| `removeTab` | Programmatically closes a tab.
|
|
308
|
-
| `splitPane` | Programmatically splits a pane node and adds a new one.
|
|
309
|
-
| `updateSplitPercentage` | Updates a SplitNode percentage.
|
|
310
|
-
| `moveTab` | Reorders a tab next to another, or swaps them if position is 'center'.
|
|
311
|
-
| `findPaneById` | Queries a PaneNode by its unique ID.
|
|
312
|
-
| `findPaneContainingTab` | Queries the parent PaneNode of a tab ID.
|
|
313
|
-
| `findTabById` | Queries detailed tab location and state metadata.
|
|
314
|
-
| `getTabMetadata` | Gets metadata for a tab ID.
|
|
315
|
-
| `getActiveTabMetadata` | Gets metadata for the active tab in a pane.
|
|
316
|
-
| `poppedOutTabIds` | The list of tab/widget IDs that are currently open in a new window.
|
|
317
|
-
| `popoutTab` | Popout the specified tab into a new window.
|
|
318
|
-
| `dockTab` | Dock the specified tab back to the main layout.
|
|
313
|
+
| Property / Method | Description | Type |
|
|
314
|
+
| ----------------------- | -------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
|
|
315
|
+
| `layout` | The current active layout tree structure. | `TreeNode \| null` |
|
|
316
|
+
| `fullscreenPaneId` | The ID of the maximized fullscreen pane. | `string \| null` |
|
|
317
|
+
| `locked` | Whether the dashboard layout is globally locked. | `boolean` |
|
|
318
|
+
| `setLayout` | React state setter to update the layout tree. | `Dispatch<SetStateAction<TreeNode \| null>>` |
|
|
319
|
+
| `setFullscreenPaneId` | Updates the active fullscreen pane ID. | `(paneId: string \| null) => void` |
|
|
320
|
+
| `setLocked` | Updates the global layout lock state. | `Dispatch<SetStateAction<boolean>>` |
|
|
321
|
+
| `removePane` | Removes a pane and collapses the split. | `(paneId: string) => void` |
|
|
322
|
+
| `addTab` | Adds a tab to a pane, or splits/creates one if target is omitted. | `(tabId: string, targetPaneId?: string, metadata?: Record<string, unknown>) => void` |
|
|
323
|
+
| `updateMetadata` | Mutates a specific tab's metadata. | `(id: string, updater: (current: Record<string, unknown> \| undefined) => Record<string, unknown> \| undefined) => void` |
|
|
324
|
+
| `updatePaneLock` | Toggles the lock status of a specific pane. | `(paneId: string, locked: boolean) => void` |
|
|
325
|
+
| `selectTab` | Focuses/activates a tab within a pane. | `(paneId: string, tabId: string) => void` |
|
|
326
|
+
| `mergeTab` | Programmatically drags and drops a tab from one pane to another. | `(draggedTabId: string, targetPaneId: string) => void` |
|
|
327
|
+
| `removeTab` | Programmatically closes a tab. | `(tabId: string) => void` |
|
|
328
|
+
| `splitPane` | Programmatically splits a pane node and adds a new one. | `(targetId: string, direction: SplitDirection, splitType: 'left' \| 'right' \| 'top' \| 'bottom', paneToAdd: string) => void` |
|
|
329
|
+
| `updateSplitPercentage` | Updates a SplitNode percentage. | `(currentNode: SplitNode, percentage: number) => void` |
|
|
330
|
+
| `moveTab` | Reorders a tab next to another, or swaps them if position is 'center'. | `(draggedTabId: string, targetTabId: string, position?: 'before' \| 'after' \| 'center') => void` |
|
|
331
|
+
| `findPaneById` | Queries a PaneNode by its unique ID. | `(paneId: string) => PaneNode \| null` |
|
|
332
|
+
| `findPaneContainingTab` | Queries the parent PaneNode of a tab ID. | `(tabId: string) => PaneNode \| null` |
|
|
333
|
+
| `findTabById` | Queries detailed tab location and state metadata. | `(tabId: string) => TabDetails \| null` |
|
|
334
|
+
| `getTabMetadata` | Gets metadata for a tab ID. | `(tabId: string) => Record<string, unknown> \| undefined` |
|
|
335
|
+
| `getActiveTabMetadata` | Gets metadata for the active tab in a pane. | `(paneId: string) => Record<string, unknown> \| undefined` |
|
|
336
|
+
| `poppedOutTabIds` | **[Experimental]** The list of tab/widget IDs that are currently open in a new window. | `string[]` |
|
|
337
|
+
| `popoutTab` | **[Experimental]** Popout the specified tab into a new window. | `(tabId: string) => void` |
|
|
338
|
+
| `dockTab` | **[Experimental]** Dock the specified tab back to the main layout. | `(tabId: string) => void` |
|
|
319
339
|
|
|
320
340
|
---
|
|
321
341
|
|
|
@@ -344,25 +364,25 @@ const {
|
|
|
344
364
|
|
|
345
365
|
##### Context Values
|
|
346
366
|
|
|
347
|
-
| Property / Method | Description
|
|
348
|
-
| ---------------------- |
|
|
349
|
-
| `id` | The ID of the current pane.
|
|
350
|
-
| `tabIds` | List of tab IDs inside the pane.
|
|
351
|
-
| `activeTabId` | Currently active tab ID.
|
|
352
|
-
| `isDragging` | `true` if this pane is being dragged.
|
|
353
|
-
| `isFullscreen` | `true` if this pane is maximized.
|
|
354
|
-
| `toggleFullscreen` | Toggles maximized state for this pane.
|
|
355
|
-
| `remove` | Removes this pane from the layout tree.
|
|
356
|
-
| `selectTab` | Activates a tab within this pane.
|
|
357
|
-
| `removeTab` | Closes a tab from this pane.
|
|
358
|
-
| `metadata` | Active tab's custom metadata.
|
|
359
|
-
| `updateMetadata` | Updates active tab's metadata.
|
|
360
|
-
| `locked` | Whether the pane or the dashboard is locked.
|
|
361
|
-
| `tabsMetadata` | Tab metadata mapping for all tabs inside this pane.
|
|
362
|
-
| `updateTabMetadata` | Updates metadata for a specific tab in the pane.
|
|
363
|
-
| `isActiveTabPoppedOut` | Whether the active tab is popped out into a new window. | `boolean` |
|
|
364
|
-
| `popoutTab` | Popout the active tab into a new window. | `(tabId?: string) => void` |
|
|
365
|
-
| `dockTab` | Dock the active tab back to the main layout. | `(tabId?: string) => void` |
|
|
367
|
+
| Property / Method | Description | Type |
|
|
368
|
+
| ---------------------- | -------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
|
|
369
|
+
| `id` | The ID of the current pane. | `string` |
|
|
370
|
+
| `tabIds` | List of tab IDs inside the pane. | `string[]` |
|
|
371
|
+
| `activeTabId` | Currently active tab ID. | `string` |
|
|
372
|
+
| `isDragging` | `true` if this pane is being dragged. | `boolean` |
|
|
373
|
+
| `isFullscreen` | `true` if this pane is maximized. | `boolean` |
|
|
374
|
+
| `toggleFullscreen` | Toggles maximized state for this pane. | `() => void` |
|
|
375
|
+
| `remove` | Removes this pane from the layout tree. | `() => void` |
|
|
376
|
+
| `selectTab` | Activates a tab within this pane. | `(tabId: string) => void` |
|
|
377
|
+
| `removeTab` | Closes a tab from this pane. | `(tabId: string) => void` |
|
|
378
|
+
| `metadata` | Active tab's custom metadata. | `Record<string, unknown> \| undefined` |
|
|
379
|
+
| `updateMetadata` | Updates active tab's metadata. | `(updater: (current: Record<string, unknown> \| undefined) => Record<string, unknown> \| undefined) => void` |
|
|
380
|
+
| `locked` | Whether the pane or the dashboard is locked. | `boolean` |
|
|
381
|
+
| `tabsMetadata` | Tab metadata mapping for all tabs inside this pane. | `Record<string, Record<string, unknown>> \| undefined` |
|
|
382
|
+
| `updateTabMetadata` | Updates metadata for a specific tab in the pane. | `(tabId: string, updater: (current: Record<string, unknown> \| undefined) => Record<string, unknown> \| undefined) => void` |
|
|
383
|
+
| `isActiveTabPoppedOut` | **[Experimental]** Whether the active tab is popped out into a new window. | `boolean` |
|
|
384
|
+
| `popoutTab` | **[Experimental]** Popout the active tab into a new window. | `(tabId?: string) => void` |
|
|
385
|
+
| `dockTab` | **[Experimental]** Dock the active tab back to the main layout. | `(tabId?: string) => void` |
|
|
366
386
|
|
|
367
387
|
---
|
|
368
388
|
|
|
@@ -475,3 +495,34 @@ const parentPane = findPaneContainingTab(currentTree, 'new-file.js')
|
|
|
475
495
|
| `tab` | Individual tab list items. |
|
|
476
496
|
| `tabCloseButton` | Close button inside a tab item. |
|
|
477
497
|
| `dragHandle` | Drag target region. |
|
|
498
|
+
|
|
499
|
+
---
|
|
500
|
+
|
|
501
|
+
## Popout Window Styling (Experimental)
|
|
502
|
+
|
|
503
|
+
> [!WARNING]
|
|
504
|
+
> Popout window capabilities (opening tabs in separate browser windows via `window.open` and React portals) are **experimental** and may experience limitations or browser warnings depending on popup blockers, iframe restrictions, and context cleanup in third-party libraries. Use with caution in production.
|
|
505
|
+
|
|
506
|
+
When using CSS-in-JS libraries like `styled-components` or `antd` (Ant Design) inside your widgets, dynamic styles and modals/portals are injected into the main document's `head`/`body` by default. In popped-out tabs, these styles will not apply because they render inside a separate window.
|
|
507
|
+
|
|
508
|
+
You can use the `renderPopoutWrapper` callback prop on the `<Zeugma>` component to wrap popped-out widgets with the required style managers and providers targeting the child window's DOM.
|
|
509
|
+
|
|
510
|
+
##### Example (`styled-components` & `antd`):
|
|
511
|
+
|
|
512
|
+
```tsx
|
|
513
|
+
import { StyleSheetManager } from 'styled-components'
|
|
514
|
+
import { StyleProvider } from '@ant-design/cssinjs'
|
|
515
|
+
import { ConfigProvider } from 'antd'
|
|
516
|
+
;<Zeugma
|
|
517
|
+
controller={controller}
|
|
518
|
+
renderPopoutWrapper={({ document, children }) => (
|
|
519
|
+
<StyleSheetManager target={document.head}>
|
|
520
|
+
<StyleProvider container={document.head}>
|
|
521
|
+
<ConfigProvider getPopupContainer={() => document.body}>{children}</ConfigProvider>
|
|
522
|
+
</StyleProvider>
|
|
523
|
+
</StyleSheetManager>
|
|
524
|
+
)}
|
|
525
|
+
>
|
|
526
|
+
{/* Dashboard grid structure */}
|
|
527
|
+
</Zeugma>
|
|
528
|
+
```
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var ge=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 ge__default=/*#__PURE__*/_interopDefault(ge);function
|
|
1
|
+
'use strict';var ge=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 ge__default=/*#__PURE__*/_interopDefault(ge);function Nt({cursor:e,resizerEl:t,onMove:n,onEnd:a}){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,6 +6,7 @@
|
|
|
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 c=a=>{n(a);},s=()=>{document.body.classList.remove("zeugma-resizing"),t.removeAttribute("data-resizing");let a=document.getElementById("zeugma-global-cursor-style");a&&a.remove(),document.removeEventListener("pointermove",c),document.removeEventListener("pointerup",s),r();};document.addEventListener("pointermove",c),document.addEventListener("pointerup",s);}function ke(e){try{return JSON.stringify(e)}catch{return ""}}var st=ge.createContext(void 0),xe=ge.createContext(void 0),ye=ge.createContext(void 0),lt=ge.createContext(void 0),ae=()=>{let e=ge.useContext(st);if(!e)throw new Error("useZeugmaState must be used within a Zeugma provider");return e},Me=()=>{let e=ge.useContext(xe);if(!e)throw new Error("useZeugmaActions must be used within a Zeugma provider");return e},Ve=()=>{let e=ge.useContext(lt);if(!e)throw new Error("useZeugmaDrag must be used within a Zeugma provider");return e};function wt(e){let t=ge.useRef(null);return ge.useEffect(()=>{if(!e){t.current=null;return}let n=o=>{t.current={x:o.clientX,y:o.clientY};},r=o=>{let c=o.touches[0]||o.changedTouches[0];c&&(t.current={x:c.clientX,y:c.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 Dt(e){ge.useEffect(()=>(e?document.body.style.setProperty("cursor","not-allowed","important"):document.body.style.removeProperty("cursor"),()=>{document.body.style.removeProperty("cursor");}),[e]);}function Ct(){let[e,t]=ge.useState({}),[n,r]=ge.useState({}),o=ge.useRef({}),c=ge.useRef(null),s=ge.useRef({}),a=ge.useRef(null),l=ge.useRef(true);ge.useEffect(()=>(l.current=true,()=>{l.current=false;}),[]);let f=ge.useCallback((u,m,P)=>{l.current&&t(g=>{if(!m){if(P&&g[u]!==P||!g[u])return g;let S={...g};return delete S[u],S}return g[u]===m?g:{...g,[u]:m}});},[]),i=ge.useCallback((u,m)=>{l.current&&r(P=>{if(!m){if(!P[u])return P;let g={...P};return delete g[u],g}return P[u]===m?P:{...P,[u]:m}});},[]),h=ge.useCallback((u,m)=>{o.current[u]=m;},[]),T=ge.useCallback(u=>{c.current=u;},[]),b=ge.useCallback((u,m)=>{s.current[u]=m;},[]);return {portalTargets:ge.useMemo(()=>({...e,...n}),[e,n]),registerPortalTarget:f,registerPopoutTarget:i,registerRenderCallback:h,renderCallbacksRef:o,registerRenderPane:T,renderPaneRef:c,registerTabHeader:b,tabHeadersRef:s,activeIdRef:a}}function Sn(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 St(e){return ge.useMemo(()=>Sn(e),[e])}function Et(e){let{onDragStart:t,onDragEnd:n}=e,[r,o]=ge.useState(null),[c,s]=ge.useState(null),a=ge.useCallback(f=>{t&&t(f);},[t]),l=ge.useCallback((f,i,h)=>{n&&n(f,i,h);},[n]);return {overTabId:r,setOverTabId:o,overTabPosition:c,setOverTabPosition:s,handleDragStartInternal:a,handleDragEndInternal:l}}function Nt(e){let n=ge.useContext(ye)?.registerRenderPane;ge.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 pe(e,t){if(e===null)return null;if(e.type==="pane"){if(e.tabIds.includes(t)){let o=e.tabIds.filter(a=>a!==t);if(o.length===0)return null;let c=e.activeTabId;e.activeTabId===t&&(c=o[0]);let s={...e.tabsMetadata};return delete s[t],{...e,tabIds:o,activeTabId:c,tabsMetadata:Object.keys(s).length>0?s:void 0}}return e}let n=pe(e.first,t),r=pe(e.second,t);return n===null?r:r===null?n:{...e,first:n,second:r}}function Se(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 c=typeof o=="string"?{type:"pane",id:de(),tabIds:[o],activeTabId:o}:o,s=r==="left"||r==="top";return {type:"split",direction:n,first:s?c:e,second:s?e:c,splitPercentage:50}}return e}return {...e,first:Se(e.first,t,n,r,o)||e.first,second:Se(e.second,t,n,r,o)||e.second}}function En(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 It(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?ee(e,t):null;if(o&&o.type==="pane"){let a=function(l){if(l.type==="pane"&&l.id===t){let f=[...l.tabIds];f.includes(n)||f.push(n);let i=l.tabsMetadata;return r&&(i={...l.tabsMetadata,[n]:r}),{...l,tabIds:f,activeTabId:n,tabsMetadata:i}}return l.type==="split"?{...l,first:a(l.first),second:a(l.second)}:l};return a(e)}let c={type:"pane",id:de(),tabIds:[n],activeTabId:n,tabsMetadata:r?{[n]:r}:void 0};return En(e,c)}function we(e,t,n){return e===null?null:e===t?{...e,splitPercentage:n}:e.type==="split"?{...e,first:we(e.first,t,n)||e.first,second:we(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 W(e,t){return e===null?null:e.type==="pane"?e.tabIds.includes(t)?e:null:e.type==="split"?W(e.first,t)??W(e.second,t):null}function Lt(e,t){return ee(e,t)??W(e,t)}function kt(e,t){let n=W(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 Mt(e,t){return W(e,t)?.tabsMetadata?.[t]}function zt(e,t){let n=ee(e,t);return n?.tabsMetadata?.[n.activeTabId]}function Ue(e,t,n){if(e===null)return null;if(e.type==="pane"){if(e.tabIds.includes(t)){let r=e.tabsMetadata||{},o=r[t],c=n(o),s={...r};return c===void 0?delete s[t]:s[t]=c,{...e,tabsMetadata:Object.keys(s).length>0?s:void 0}}return e}return e.type==="split"?{...e,first:Ue(e.first,t,n)??e.first,second:Ue(e.second,t,n)??e.second}:e}function je(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:je(e.first,t,n)??e.first,second:je(e.second,t,n)??e.second}:e}function Ee(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:Ee(e.first,t,n)??e.first,second:Ee(e.second,t,n)??e.second}:e}function At(e,t,n){if(e===null)return null;let o=W(e,t)?.tabsMetadata?.[t],c=pe(e,t);if(c===null)return {type:"pane",id:de(),tabIds:[t],activeTabId:t,tabsMetadata:o?{[t]:o}:void 0};function s(a){if(a.type==="pane"){if(a.id===n){let l=[...a.tabIds];l.includes(t)||l.push(t);let f={...a.tabsMetadata};return o&&(f[t]=o),{...a,tabIds:l,activeTabId:t,tabsMetadata:Object.keys(f).length>0?f:void 0}}return a}return a.type==="split"?{...a,first:s(a.first),second:s(a.second)}:a}return s(c)}function Nn(e,t,n){if(e===null)return null;if(t===n)return e;let r=W(e,t),o=W(e,n);if(!r||!o)return e;let c=r.id,s=o.id,a=r.tabsMetadata?.[t],l=o.tabsMetadata?.[n];function f(i){if(i.type==="pane"){let h=false,T=[...i.tabIds],b=i.activeTabId,d=i.tabsMetadata?{...i.tabsMetadata}:{};if(c===s){if(i.id===c){let u=T.indexOf(t),m=T.indexOf(n);u!==-1&&m!==-1&&(T[u]=n,T[m]=t),b=t,h=true;}}else i.id===c&&(T=T.map(u=>u===t?n:u),b===t&&(b=n),delete d[t],l&&(d[n]=l),h=true),i.id===s&&(T=T.map(u=>u===n?t:u),b===n&&(b=t),delete d[n],a&&(d[t]=a),h=true);return h?{...i,tabIds:T,activeTabId:b,tabsMetadata:Object.keys(d).length>0?d:void 0}:i}return i.type==="split"?{...i,first:f(i.first),second:f(i.second)}:i}return f(e)}function ze(e,t,n,r="before"){if(e===null)return null;if(t===n)return e;if(r==="center")return Nn(e,t,n);let c=W(e,t)?.tabsMetadata?.[t],s=pe(e,t);if(s===null)return {type:"pane",id:de(),tabIds:[t],activeTabId:t,tabsMetadata:c?{[t]:c}:void 0};function a(l){if(l.type==="pane"){if(l.tabIds.includes(n)){let i=[...l.tabIds].filter(b=>b!==t),h=i.indexOf(n);h<0&&(h=0),r==="after"&&(h+=1),i.splice(h,0,t);let T={...l.tabsMetadata};return c&&(T[t]=c),{...l,tabIds:i,activeTabId:t,tabsMetadata:Object.keys(T).length>0?T:void 0}}return l}return l.type==="split"?{...l,first:a(l.first),second:a(l.second)}:l}return a(s)}function ve(e,t=0,n=0,r=100,o=100,c="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:s,splitPercentage:a,first:l,second:f}=e,h={id:`splitter-${c}-${s}`,currentNode:e,direction:s,left:s==="row"?t+r*(a/100):t,top:s==="column"?n+o*(a/100):n,width:s==="row"?0:r,height:s==="column"?0:o,parentLeft:t,parentTop:n,parentWidth:r,parentHeight:o},T={panes:[],splitters:[]},b={panes:[],splitters:[]};if(s==="row"){let d=r*(a/100);T=ve(l,t,n,d,o,`${c}-L`),b=ve(f,t+d,n,r-d,o,`${c}-R`);}else {let d=o*(a/100);T=ve(l,t,n,r,d,`${c}-T`),b=ve(f,t,n+d,r,o-d,`${c}-B`);}return {panes:[...T.panes,...b.panes],splitters:[h,...T.splitters,...b.splitters]}}function Zt(e,t,n,r="before"){if(e===null)return null;let o=ee(e,t);if(!o)return e;let c=o.tabIds,s=o.activeTabId,a=o.tabsMetadata||{},l=fe(e,t);if(l===null)return o;function f(i){if(i.type==="pane"){if(i.tabIds.includes(n)){let T=[...i.tabIds].filter(u=>!c.includes(u)),b=T.indexOf(n);b<0&&(b=0),r==="after"&&(b+=1),T.splice(b,0,...c);let d={...i.tabsMetadata};for(let u of c)a[u]&&(d[u]=a[u]);return {...i,tabIds:T,activeTabId:s,tabsMetadata:Object.keys(d).length>0?d:void 0}}return i}return i.type==="split"?{...i,first:f(i.first),second:f(i.second)}:i}return f(l)}function Ot(e,t,n,r){if(!((t==="tab"||t==="pane")&&n&&e.includes(n))||!r)return -1;let s=e.indexOf(n);return r==="before"?s:s+1}function In(e){let{initialLayout:t,layout:n,onChange:r,fullscreenPaneId:o,onFullscreenChange:c,locked:s=false}=e,[a,l]=ge.useState(()=>n!==void 0?n:t??null),[f,i]=ge.useState(()=>n!==void 0?n:t??null),[h,T]=ge.useState(()=>ke(n!==void 0?n:null)),[b,d]=ge.useState(o||null),[u,m]=ge.useState(s),[P,g]=ge.useState([]),[S,E]=ge.useState(null),[k,I]=ge.useState(null),[x,M]=ge.useState(null),F=ge.useRef(null),j=ge.useCallback(p=>{F.current=p;},[]),$=ge.useRef(a);$.current=a;let te=ge.useRef(r);te.current=r;let X=ge.useRef(c);X.current=c;let ne=ge.useCallback(p=>{d(p),X.current?.(p);},[]);if(ge.useEffect(()=>{m(s);},[s]),ge.useEffect(()=>{o!==void 0&&d(o);},[o]),n!==void 0){let p=ke(n);p!==h&&(T(p),l(n),i(n));}let N=ge.useCallback(p=>(...y)=>{let w=$.current,_=p(w,...y);ke(w)!==ke(_)&&($.current=_,l(_),i(_),te.current?.(_));},[]),A=ge.useCallback(N((p,y)=>typeof y=="function"?y(p):y),[N]),U=ge.useCallback(p=>{i(y=>typeof p=="function"?p(y):p);},[]),B=ge.useCallback(p=>{d(null),X.current?.(null),E(null),I(null),M(null),A(p),i(()=>typeof p=="function"?p($.current):p);},[A]),L=ge.useCallback(N((p,y)=>fe(p,y)),[N]),z=ge.useCallback(N((p,y,w,_)=>{let H=pe(p,y)??p;return It(H,w,y,_)}),[N]),v=ge.useCallback(N((p,y,w,_,H)=>{let se=ee(p,y)??W(p,y);if(!se)return p;let V=ee(p,H)??W(p,H)??{type:"pane",id:H,tabIds:[H],activeTabId:H},be=fe(p,V.id);return Se(be,se.id,w,_,V)}),[N]),Z=ge.useCallback(N((p,y,w)=>we(p,y,w)),[N]),R=ge.useCallback(N((p,y,w)=>Ue(p,y,w)),[N]),O=ge.useCallback(N((p,y,w)=>{let _=ee(p,y)??W(p,y);return _?je(p,_.id,w):p}),[N]),ce=ge.useCallback(N((p,y,w)=>{let _=ee(p,y)??W(p,y);return _?Ee(p,_.id,w):p}),[N]),J=ge.useCallback(N((p,y,w)=>{let _=ee(p,w)??W(p,w);return _?At(p,y,_.id):p}),[N]),Y=ge.useCallback(N((p,y,w,_)=>ze(p,y,w,_)),[N]),G=ge.useCallback(N((p,y)=>pe(p,y)),[N]),Q=ge.useCallback(p=>ee($.current,p),[]),D=ge.useCallback(p=>W($.current,p),[]),C=ge.useCallback(p=>kt($.current,p),[]),ie=ge.useCallback(p=>Mt($.current,p),[]),re=ge.useCallback(p=>zt($.current,p),[]),K=ge.useCallback(p=>{g(y=>y.includes(p)?y:[...y,p]);},[]),oe=ge.useCallback(p=>{g(y=>y.includes(p)?y.filter(w=>w!==p):y);},[]);return {layout:a,setLayout:B,_internalSetLayout:U,renderingLayout:f,fullscreenPaneId:b,setFullscreenPaneId:ne,locked:u,setLocked:m,poppedOutTabIds:P,activeId:S,setActiveId:E,activeType:k,setActiveType:I,dismissIntentId:x,setDismissIntentId:M,containerRef:F,setContainerRef:j,removePane:L,addTab:z,updateMetadata:R,updatePaneLock:O,selectTab:ce,mergeTab:J,moveTab:Y,removeTab:G,splitPane:v,updateSplitPercentage:Z,popoutTab:K,dockTab:oe,findPaneById:Q,findPaneContainingTab:D,findTabById:C,getTabMetadata:ie,getActiveTabMetadata:re}}var Ln=()=>{let e=ae(),t=Me();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,poppedOutTabIds:e.poppedOutTabIds,popoutTab:t.popoutTab,dockTab:t.dockTab}};var Je=class extends core.PointerSensor{static activators=[{eventName:"onPointerDown",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]},Ye=class extends core.TouchSensor{static activators=[{eventName:"onTouchStart",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]};var _t=e=>{let n=e.active.id.toString().startsWith("tab-header-"),o=core.pointerWithin(e);if(o.length>0)return [...o].sort((s,a)=>{let l=s.id.toString(),f=a.id.toString(),i=l.startsWith("tab-drop-"),h=f.startsWith("tab-drop-");if(i&&!h)return -1;if(!i&&h)return 1;let T=l.startsWith("drop-root-"),b=f.startsWith("drop-root-");return T&&!b?-1:!T&&b?1:0});if(n){let c=e.droppableContainers.filter(s=>s.id.toString().startsWith("tab-drop-"));return core.closestCenter({...e,droppableContainers:c})}return []};function Ae(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 Ft(e){let{layout:t,_internalSetLayout:n,setLayout:r,activeId:o,setActiveId:c,activeType:s,setActiveType:a,dismissIntentId:l,setDismissIntentId:f,setOverTabId:i,setOverTabPosition:h,containerRef:T,dragActivationDistance:b,enableDragToDismiss:d,dismissThreshold:u,onRemove:m,onDragStart:P,onDragEnd:g,onDismissIntentChange:S,removeTab:E,removePane:k}=e,I=ge.useRef(null),x=wt(o),M=ge.useRef(null),[F,j]=ge.useState(false);return Dt(F),{sensors:core.useSensors(core.useSensor(Je,{activationConstraint:{distance:b}}),core.useSensor(Ye,{activationConstraint:{delay:250,tolerance:5}})),collisionDetection:_t,onDragStart:A=>{let U=A.active.id.toString(),B=U.startsWith("tab-header-"),L=B?U.substring(11):U;c(L),a(B?"tab":"pane"),i(null),h(null);let z=A.activatorEvent;x.current=Ae(z),d&&T.current?I.current=T.current.getBoundingClientRect():I.current=null;let v=t;if(B){let R=W(t,L);R&&(v=Ee(t,R.id,L)||t);}M.current=v;let Z=B?pe(v,L):fe(v,L);n(Z),P&&P(L);},onDragMove:A=>{let{over:U}=A,B=U?.id.toString()||"",L=B.startsWith("drop-locked-");j(D=>D===L?D:L);let z=A.active.id.toString(),v=z.startsWith("tab-header-"),Z=v?z.substring(11):z,R=B.match(/^tab-drop-(.+)$/);if(R&&U&&(v||s==="pane")){let[,D]=R;if(Z!==D){let C="before",ie=U.rect,re=A.activatorEvent,K=null;if(x.current)K=x.current.x;else {let oe=Ae(re);oe&&(K=oe.x+A.delta.x);}if(K!==null){let oe=ie.left+ie.width/2;K>oe&&(C="after");}i(oe=>oe===D?oe:D),h(oe=>oe===C?oe:C);}else i(C=>C===null?C:null),h(C=>C===null?C:null);}else i(D=>D===null?D:null),h(D=>D===null?D:null);if(!d)return;let O=I.current;if(!O){l!==null&&(f(null),S?.(null));return}let ce=A.activatorEvent,J=null,Y=null;if(x.current)J=x.current.x,Y=x.current.y;else {let D=Ae(ce);D&&(J=D.x+A.delta.x,Y=D.y+A.delta.y);}let G=0;if(J!==null&&Y!==null){let D=0,C=0;J<O.left?D=O.left-J:J>O.right&&(D=J-O.right),Y<O.top?C=O.top-Y:Y>O.bottom&&(C=Y-O.bottom),G=Math.sqrt(D*D+C*C);}else {let D=A.active.rect.current.translated;if(D){let C=D.left+D.width/2,ie=D.top+D.height/2,re=0,K=0;C<O.left?re=O.left-C:C>O.right&&(re=C-O.right),ie<O.top?K=O.top-ie:ie>O.bottom&&(K=ie-O.bottom),G=Math.sqrt(re*re+K*K);}}G>u?l!==Z&&(f(Z),S?.(Z)):l!==null&&(f(null),S?.(null));},onDragEnd:A=>{c(null),a(null),j(false),i(null),h(null);let{active:U,over:B}=A,L=U.id.toString(),z=L.startsWith("tab-header-"),v=z?L.substring(11):L,Z=d&&l===v;f(null),S?.(null),I.current=null;let R=M.current||t;if(M.current=null,Z){m?m(v):z?E(v):k(v),g&&g(v,null,null);return}if(!B){n(R),g&&g(v,null,null);return}let O=B.id.toString();if(O.startsWith("drop-locked-")){n(R),g&&g(v,null,null);return}let ce=O.match(/^tab-drop-(.+)$/);if(ce){let[,p]=ce;if(z)if(v!==p){let y="before",w=B.rect,_=A.activatorEvent,H=null;if(x.current)H=x.current.x;else {let V=Ae(_);V&&(H=V.x+A.delta.x);}if(H!==null){let V=w.left+w.width/2;H>V&&(y="after");}let se=ze(R,v,p,y);r(se),g&&g(v,p,{type:"move",position:"center"});}else n(R),g&&g(v,null,null);else {let y="before",w=B.rect,_=A.activatorEvent,H=null;if(x.current)H=x.current.x;else {let V=Ae(_);V&&(H=V.x+A.delta.x);}if(H!==null){let V=w.left+w.width/2;H>V&&(y="after");}let se=Zt(R,v,p,y);r(se),g&&g(v,p,{type:"move",position:"center"});}return}let J=O.match(/^drop-root-(1\/4|1\/3)-(top|bottom|left|right|start|end)$/);if(J){let[,p,y]=J,w=y;w==="start"&&(w="left"),w==="end"&&(w="right");let _=z?pe(R,v):fe(R,v),H;if(z){let V=W(R,v)?.tabsMetadata?.[v];H={type:"pane",id:de(),tabIds:[v],activeTabId:v,tabsMetadata:V?{[v]:V}:void 0};}else H=ee(R,v)??{type:"pane",id:de(),tabIds:[v],activeTabId:v};if(_===null)r(H);else {let se=w==="left"||w==="right",V=w==="left"||w==="top",be=50;p==="1/4"?be=V?25:75:p==="1/3"&&(be=V?100/3:200/3),r({type:"split",direction:se?"row":"column",first:V?H:_,second:V?_:H,splitPercentage:be});}g&&g(v,"root",{type:"split",direction:w==="left"||w==="right"?"row":"column",position:w});return}let Y=O.match(/^drop-(left|right|top|bottom|center)-(.+)$/);if(!Y){n(R),g&&g(v,null,null);return}let[,G,Q]=Y;if(G==="center"){if(z){let p=ee(R,Q);if(p&&p.activeTabId){let y=p.activeTabId,w=ze(R,v,y,"center");r(w),g&&g(v,Q,{type:"move",position:"center"});}else n(R),g&&g(v,null,null);}else n(R),g&&g(v,null,null);return}let D=z?W(R,v):ee(R,v),C=D&&D.id===Q,ie=D&&D.tabIds.length===1;if(v===Q||C&&ie){n(R),g&&g(v,null,null);return}let re=G==="left"||G==="right"?"row":"column",K;if(z){let y=W(R,v)?.tabsMetadata?.[v];K={type:"pane",id:de(),tabIds:[v],activeTabId:v,tabsMetadata:y?{[v]:y}:void 0};}else K=ee(R,v)??{type:"pane",id:de(),tabIds:[v],activeTabId:v};let oe=z?pe(R,v):fe(R,v),Le=Se(oe,Q,re,G,K);r(Le),g&&g(v,Q,{type:"split",direction:re,position:G});},onDragCancel:()=>{c(null),a(null),j(false),i(null),h(null),f(null),S?.(null),I.current=null;let A=M.current||t;M.current=null,n(A),A!==t&&r(A);}}}function Wt({persist:e,layout:t,setLayout:n}){let r=typeof e=="object"?e.enabled!==false:!!e,o=typeof e=="object"&&e.key||"zeugma-layout",[c,s]=ge.useState(false);ge.useEffect(()=>{if(r){let a=localStorage.getItem(o);if(a)try{let l=JSON.parse(a);l&&n(l);}catch(l){console.error("Failed to parse persisted zeugma layout",l);}}s(true);},[r,o,n]),ge.useEffect(()=>{r&&c&&(t?localStorage.setItem(o,JSON.stringify(t)):localStorage.removeItem(o));},[r,o,t,c]);}var De=null,Ut=false,Te=new Set;function me(){if(typeof window>"u")return document;if(De&&De.target){let t=De.target.ownerDocument;if(t&&t!==document)return t}let e=window.event;if(e&&e.target){let n=e.target.ownerDocument;if(n&&n!==document)return n}return window.__zeugmaActivePopoutDocument?window.__zeugmaActivePopoutDocument:document}function Bn(){if(typeof window>"u"||Ut)return;Ut=true;let e=()=>{De=null,globalThis.__zeugmaActivePopoutDocument=null;};["pointerdown","mousedown","click","keydown","focus","touchstart"].forEach(d=>{window.addEventListener(d,e,true);});let n=document.createElement;document.createElement=function(d,u){let m=me();return m&&m!==document?m.createElement(d,u):n.call(document,d,u)};let r=document.body.appendChild;document.body.appendChild=function(d){let u=me();return u&&u!==document?u.body.appendChild(d):r.call(document.body,d)};let o=document.body.removeChild;document.body.removeChild=function(d){let u=me();return u&&u!==document?u.body.removeChild(d):o.call(document.body,d)};let c=document.body.insertBefore;document.body.insertBefore=function(d,u){let m=me();return m&&m!==document?m.body.insertBefore(d,u):c.call(document.body,d,u)};let s=document.body.replaceChild;document.body.replaceChild=function(d,u){let m=me();return m&&m!==document?m.body.replaceChild(d,u):s.call(document.body,d,u)};let a=document.addEventListener;document.addEventListener=function(d,u,m){let P=me();return P&&P!==document?P.addEventListener(d,u,m):a.call(document,d,u,m)};let l=document.removeEventListener;document.removeEventListener=function(d,u,m){l.call(document,d,u,m),Te.forEach(P=>{try{P.removeEventListener(d,u,m);}catch{}});};let f=window.addEventListener;window.addEventListener=function(d,u,m){let P=me();return P&&P!==document&&P.defaultView?P.defaultView.addEventListener(d,u,m):f.call(window,d,u,m)};let i=window.removeEventListener;window.removeEventListener=function(d,u,m){i.call(window,d,u,m),Te.forEach(P=>{try{P.defaultView&&P.defaultView.removeEventListener(d,u,m);}catch{}});};let h=document.getElementById;document.getElementById=function(d){let u=me();if(u&&u!==document)return u.getElementById(d);let m=h.call(document,d);if(m)return m;for(let P of Te)try{let g=P.getElementById(d);if(g)return g}catch{}return null};let T=document.querySelector;document.querySelector=function(d){let u=me();if(u&&u!==document)return u.querySelector(d);let m=T.call(document,d);if(m)return m;for(let P of Te)try{let g=P.querySelector(d);if(g)return g}catch{}return null};let b=document.querySelectorAll;document.querySelectorAll=function(d){let u=me();if(u&&u!==document)return u.querySelectorAll(d);let m=b.call(document,d);if(m.length>0)return m;for(let P of Te)try{let g=P.querySelectorAll(d);if(g.length>0)return g}catch{}return m};}function jt(e){let{poppedOutTabIds:t,registerPopoutTarget:n,findTabById:r,dockTab:o}=e,c=ge.useRef({});ge.useEffect(()=>{let s=c.current;t.forEach(a=>{if(s[a]){try{s[a].focus();}catch{}return}Bn();let f=r(a)?.metadata?.title||`Tab ${a}`,i=window.open("",`zeugma-popout-${a}`,"width=800,height=600");if(!i){console.warn("Failed to open popout window. Check popup blocker."),o(a);return}s[a]=i,Te.add(i.document),i.document.title=f,i.document.head.innerHTML="",Array.from(document.querySelectorAll('style, link[rel="stylesheet"]')).forEach(x=>{let M=x.cloneNode(true);if(x.tagName.toLowerCase()==="link"){let F=x.href;F&&M.setAttribute("href",F);}else if(x.tagName.toLowerCase()==="style")try{let F=x.sheet?.cssRules;if(F&&F.length>0){let j=Array.from(F).map($=>$.cssText).join(`
|
|
10
|
-
`);M.textContent=j;}}catch{}i.document.head.appendChild(M);}),i.document.documentElement.className=document.documentElement.className,i.document.body.className=document.body.className,i.document.body.style.margin="0",i.document.body.style.padding="0",i.document.body.style.height="100vh",i.document.body.style.overflow="hidden";let h=document.getElementById(`zeugma-tab-target-${a}`),T="";h&&(T=window.getComputedStyle(h).backgroundColor,(!T||T==="transparent"||T==="rgba(0, 0, 0, 0)")&&h.parentElement&&(T=window.getComputedStyle(h.parentElement).backgroundColor));let b=window.getComputedStyle(document.documentElement),d=window.getComputedStyle(document.body),u=d.backgroundColor,P=!u||u==="transparent"||u==="rgba(0, 0, 0, 0)"?b.backgroundColor:u,g=T&&T!=="transparent"&&T!=="rgba(0, 0, 0, 0)"?T:P&&P!=="transparent"&&P!=="rgba(0, 0, 0, 0)"?P:"#181b1f";i.document.documentElement.style.backgroundColor=g,i.document.body.style.backgroundColor=g,i.document.body.style.color=d.color||b.color,i.document.body.style.fontFamily=d.fontFamily||b.fontFamily;let S=i.document.createElement("div");S.id=`zeugma-popout-container-${a}`,S.className="grafana-panel h-full w-full overflow-hidden",S.style.width="100%",S.style.height="100%",S.style.border="none",i.document.body.appendChild(S),n?.(a,S);let E=["pointerdown","mousedown","click","keydown","focus","touchstart"],k=x=>{De=x,globalThis.__zeugmaActivePopoutDocument=i.document,queueMicrotask(()=>{De===x&&(De=null,globalThis.__zeugmaActivePopoutDocument=null);});};E.forEach(x=>{i.addEventListener(x,k,true);});let I=()=>{Te.delete(i.document),o(a);};i.addEventListener("beforeunload",I),i.__zeugmaCleanup=()=>{E.forEach(x=>{i.removeEventListener(x,k,true);}),i.removeEventListener("beforeunload",I);};}),Object.keys(s).forEach(a=>{if(!t.includes(a)){let l=s[a];if(delete s[a],n?.(a,null),l){Te.delete(l.document);try{let f=l;f.__zeugmaCleanup&&f.__zeugmaCleanup(),f.close();}catch{}}}});},[t,n,r,o]),ge.useEffect(()=>()=>{let s=c.current;Object.keys(s).forEach(a=>{let l=s[a];if(l){Te.delete(l.document);try{let f=l;f.__zeugmaCleanup&&f.__zeugmaCleanup(),f.close();}catch{}}});},[]);}var Xt=({activeId:e,render:t,className:n})=>{let r=ge.useRef(null);return ge.useEffect(()=>{let o=c=>{r.current&&(r.current.style.transform=`translate(${c.clientX+12}px, ${c.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 Un=({popoutDoc:e,children:t})=>{let n=ge__default.default.useEffect,r=ge__default.default.useLayoutEffect,o=ge__default.default.useInsertionEffect;ge__default.default.useEffect=(c,s)=>n(()=>{window.__zeugmaActivePopoutDocument=e;try{let a=c();return typeof a=="function"?()=>{window.__zeugmaActivePopoutDocument=e;try{return a()}finally{window.__zeugmaActivePopoutDocument=null;}}:a}finally{window.__zeugmaActivePopoutDocument=null;}},s),ge__default.default.useLayoutEffect=(c,s)=>r(()=>{window.__zeugmaActivePopoutDocument=e;try{let a=c();return typeof a=="function"?()=>{window.__zeugmaActivePopoutDocument=e;try{return a()}finally{window.__zeugmaActivePopoutDocument=null;}}:a}finally{window.__zeugmaActivePopoutDocument=null;}},s),o&&(ge__default.default.useInsertionEffect=(c,s)=>o(()=>{window.__zeugmaActivePopoutDocument=e;try{let a=c();return typeof a=="function"?()=>{window.__zeugmaActivePopoutDocument=e;try{return a()}finally{window.__zeugmaActivePopoutDocument=null;}}:a}finally{window.__zeugmaActivePopoutDocument=null;}},s)),window.__zeugmaActivePopoutDocument=e;try{return jsxRuntime.jsx(jsxRuntime.Fragment,{children:t})}finally{window.__zeugmaActivePopoutDocument=null,ge__default.default.useEffect=n,ge__default.default.useLayoutEffect=r,o&&(ge__default.default.useInsertionEffect=o);}},Yt=ge__default.default.memo(({tabDetails:e,target:t,renderWidget:n})=>{let{id:r}=e,[o,c]=ge.useState(false),s=ge.useRef(null);if(ge.useEffect(()=>{c(true);},[]),ge.useEffect(()=>{if(!o||!s.current)return;let f=s.current;if(t)t.ownerDocument.adoptNode(f),t.appendChild(f);else {let i=document.getElementById("zeugma-hidden-portal-container");i||(i=document.createElement("div"),i.id="zeugma-hidden-portal-container",i.style.display="none",document.body.appendChild(i)),document.adoptNode(f),i.appendChild(f);}},[t,o]),ge.useEffect(()=>()=>{s.current&&s.current.remove();},[]),!o)return null;s.current||(s.current=document.createElement("div"),s.current.className=`zeugma-portal-wrapper-${r}`,s.current.style.width="100%",s.current.style.height="100%");let a=s.current;if(!a||!n)return null;let l=n(e);return t&&t.ownerDocument&&t.ownerDocument!==document?reactDom.createPortal(jsxRuntime.jsx(Un,{popoutDoc:t.ownerDocument,children:l}),a):reactDom.createPortal(l,a)},(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 Qt=({activeId:e,activeType:t,dismissIntentId:n,renderDragOverlay:r,renderPaneRef:o,renderPane:c,tabHeadersRef:s,classNames:a})=>{if(r)return jsxRuntime.jsx(jsxRuntime.Fragment,{children:r({type:t,id:e,isDismissing:e===n})});if(t==="pane"){let l=o.current||c;if(l)return jsxRuntime.jsx("div",{className:a.paneDragPreview||"",style:{pointerEvents:"none",width:"420px",height:"260px",overflow:"hidden"},children:l(e)})}else if(t==="tab"){let l=o.current||c;if(l)return jsxRuntime.jsx("div",{className:a.tabDragPreview||"",style:{pointerEvents:"none",width:"420px",height:"260px",overflow:"hidden"},children:l(e)});let f=s.current[e];if(f){let i=a.tab?typeof a.tab=="function"?a.tab(e):a.tab:"";return jsxRuntime.jsx("div",{className:`${a.tabDragPreview||""} ${i}`.trim(),style:{display:"inline-flex",position:"relative",pointerEvents:"none",overflow:"hidden"},children:f({isDragging:true,isOver:false})})}}return jsxRuntime.jsx("div",{style:{pointerEvents:"none",overflow:"hidden",width:"100%",height:"100%"}})};function ut({containerRef:e,isRow:t,direction:n,splitPercentage:r,resizerSize:o,snapThreshold:c,layout:s,currentNode:a,onLayoutChange:l,onResizeStart:f,onResizeEnd:i,parentLeft:h,parentTop:T,parentWidth:b,parentHeight:d}){let{onResizeStart:u,onResize:m,onResizeEnd:P,minSplitPercentage:g=5,maxSplitPercentage:S=95,locked:E=false}=ae();return ge.useCallback(k=>{if(E)return;k.preventDefault();let I=e.current;if(!I)return;f&&f(),u&&u(a);let x=I.getBoundingClientRect(),M=k.clientX,F=k.clientY,j=r,$=k.currentTarget,te=x.left+x.width*(h/100),X=x.top+x.height*(T/100),ne=x.width*(b/100),N=x.height*(d/100),U=Array.from(document.querySelectorAll('div[role="separator"][data-direction]')).filter(L=>L!==$&&L.getAttribute("data-direction")===n).map(L=>{let z=L.getBoundingClientRect();return t?z.left+z.width/2:z.top+z.height/2}),B=j;xt({cursor:t?"col-resize":"row-resize",resizerEl:$,onMove:L=>{let z=t?(L.clientX-M)/ne*100:(L.clientY-F)/N*100,v=j+z,Z=t?te+(ne-o)*(v/100)+o/2:X+(N-o)*(v/100)+o/2,R=1/0,O=null;for(let G of U){let Q=Math.abs(Z-G);Q<c&&Q<R&&(R=Q,O=G);}let ce=v;O!==null&&(ce=t?(O-o/2-te)/(ne-o)*100:(O-o/2-X)/(N-o)*100);let J=Math.max(g,Math.min(S,ce));B=J;let Y=we(s,a,J);if(Y){let{panes:G,splitters:Q}=ve(Y),D=e.current;if(D){for(let C of G)D.style.setProperty(`--pane-left-${C.paneId}`,`${C.left}%`),D.style.setProperty(`--pane-top-${C.paneId}`,`${C.top}%`),D.style.setProperty(`--pane-width-${C.paneId}`,`${C.width}%`),D.style.setProperty(`--pane-height-${C.paneId}`,`${C.height}%`);for(let C of Q)D.style.setProperty(`--splitter-pos-${C.id}`,`${C.direction==="row"?C.left:C.top}%`);}}m&&m(a,J);},onEnd:()=>{let L=we(s,a,B),z=e.current;if(z){let{panes:v,splitters:Z}=ve(L);for(let R of v)z.style.removeProperty(`--pane-left-${R.paneId}`),z.style.removeProperty(`--pane-top-${R.paneId}`),z.style.removeProperty(`--pane-width-${R.paneId}`),z.style.removeProperty(`--pane-height-${R.paneId}`);for(let R of Z)z.style.removeProperty(`--splitter-pos-${R.id}`);}l(L),i&&i(),P&&P(a,B);}});},[e,t,n,r,o,c,s,a,l,f,i,u,m,P,g,S,h,T,b,d])}var Kt=({splitter:e,resizerSize:t,snapThreshold:n,containerRef:r})=>{let{renderingLayout:o,setLayout:c,classNames:s,locked:a}=ae(),[l,f]=ge.useState(false),{currentNode:i,direction:h,left:T,top:b,width:d,height:u,parentLeft:m,parentTop:P,parentWidth:g,parentHeight:S}=e,E=h==="row",k=ut({containerRef:r,isRow:E,direction:h,splitPercentage:i.splitPercentage,resizerSize:t,snapThreshold:n,layout:o,currentNode:i,onLayoutChange:c,onResizeStart:()=>f(true),onResizeEnd:()=>f(false),parentLeft:m,parentTop:P,parentWidth:g,parentHeight:S}),I=E?{position:"absolute",left:`calc(var(--splitter-pos-${e.id}, ${T}%) - ${t/2}px)`,top:`calc(${b}% + ${t/2}px)`,width:`${t}px`,height:`calc(${u}% - ${t}px)`,cursor:a?"default":"col-resize",pointerEvents:a?"none":"auto",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box"}:{position:"absolute",left:`calc(${T}% + ${t/2}px)`,top:`calc(var(--splitter-pos-${e.id}, ${b}%) - ${t/2}px)`,width:`calc(${d}% - ${t}px)`,height:`${t}px`,cursor:a?"default":"row-resize",pointerEvents:a?"none":"auto",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box"};return jsxRuntime.jsx("div",{className:s.resizer||"","data-direction":h,"data-resizing":l||void 0,style:I,onPointerDown:k,role:"separator","aria-valuenow":i.splitPercentage,"aria-valuemin":5,"aria-valuemax":95})},en=ge__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 dt=({renderPane:e,tree:t,resizerSize:n,snapThreshold:r})=>{Nt(e);let{renderingLayout:o,activeId:c,dismissIntentId:s,setContainerRef:a,fullscreenPaneId:l,snapThreshold:f,locked:i,classNames:h,resizerSize:T}=ae(),b=r!==void 0?r:f??8,d=n!==void 0?n:T??4,u=t!==void 0?t:o,m=ge.useRef(null),{panes:P,splitters:g}=ge.useMemo(()=>u?ve(u):{panes:[],splitters:[]},[u]);if(!u&&t!==void 0)return null;let S=()=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[P.map(E=>{let k=l===E.paneId;return jsxRuntime.jsx("div",{style:{position:"absolute",left:k?"0%":`var(--pane-left-${E.paneId}, ${E.left}%)`,top:k?"0%":`var(--pane-top-${E.paneId}, ${E.top}%)`,width:k?"100%":`var(--pane-width-${E.paneId}, ${E.width}%)`,height:k?"100%":`var(--pane-height-${E.paneId}, ${E.height}%)`,overflow:"hidden",zIndex:k?20:1,display:l&&!k?"none":"block",padding:k?"0px":`${d/2}px`,boxSizing:"border-box"},children:jsxRuntime.jsx(en,{paneId:E.paneId,renderPane:e})},E.paneId)}),!l&&g.map(E=>jsxRuntime.jsx(Kt,{splitter:E,resizerSize:d,snapThreshold:b,containerRef:m},E.id))]});if(t===void 0){let E=c!==null&&c===s,k=x=>{a(x),m.current=x;},I=`${h.dashboard||""} ${E&&h.dashboardDismissActive||""} ${i&&h.dashboardLocked||""}`.trim();return jsxRuntime.jsxs("div",{ref:k,className:I,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:[S(),c!==null&&!i&&jsxRuntime.jsx(on,{activeClassName:h.rootDropPreview??h.dropPreview})]})}return jsxRuntime.jsx("div",{ref:m,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:S()})};var oo=e=>{let{controller:t,children:n,renderDragOverlay:r,classNames:o={},renderPane:c,resizerSize:s,dragActivationDistance:a=8,snapThreshold:l=8,minSplitPercentage:f=5,maxSplitPercentage:i=95,enableDragToDismiss:h=false,dismissThreshold:T=60,onRemove:b,onDragStart:d,onDragEnd:u,onResizeStart:m,onResize:P,onResizeEnd:g,onDismissIntentChange:S,persist:E=false}=e,k=t,{layout:I,setLayout:x,_internalSetLayout:M,renderingLayout:F,fullscreenPaneId:j,setFullscreenPaneId:$,locked:te,setLocked:X,findPaneById:ne,findPaneContainingTab:N,findTabById:A,getTabMetadata:U,getActiveTabMetadata:B,activeId:L,setActiveId:z,activeType:v,setActiveType:Z,dismissIntentId:R,setDismissIntentId:O,containerRef:ce,setContainerRef:J,removePane:Y,addTab:G,updateMetadata:Q,updatePaneLock:D,selectTab:C,mergeTab:ie,removeTab:re,splitPane:K,updateSplitPercentage:oe,moveTab:Le,poppedOutTabIds:p=[],popoutTab:y,dockTab:w}=k;Wt({persist:E,layout:I,setLayout:x});let{portalTargets:_,registerPortalTarget:H,registerPopoutTarget:se,registerRenderCallback:V,renderCallbacksRef:be,registerRenderPane:nt,renderPaneRef:ot,registerTabHeader:bt,tabHeadersRef:rt,activeIdRef:Be}=Ct();jt({poppedOutTabIds:p,registerPopoutTarget:se,findTabById:A,dockTab:w});let vt=ge.useCallback(ue=>p.includes(ue),[p]),{overTabId:ht,setOverTabId:bn,overTabPosition:Tt,setOverTabPosition:vn,handleDragStartInternal:hn,handleDragEndInternal:Tn}=Et({onDragStart:d,onDragEnd:u}),Pn=Ft({layout:I,_internalSetLayout:M,setLayout:x,activeId:L,setActiveId:z,activeType:v,setActiveType:Z,dismissIntentId:R,setDismissIntentId:O,setOverTabId:bn,setOverTabPosition:vn,containerRef:ce,dragActivationDistance:a,enableDragToDismiss:h,dismissThreshold:T,onRemove:b,onDragStart:hn,onDragEnd:Tn,onDismissIntentChange:S,removeTab:re,removePane:Y}),at=ge.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]),Pt=ge.useCallback((ue,He)=>{g&&g(ue,He);},[g]),yn=ge.useMemo(()=>({layout:I,renderingLayout:F,setLayout:x,activeId:L,activeType:v,dismissIntentId:R,setContainerRef:J,fullscreenPaneId:j,classNames:at,onRemove:b,onFullscreenChange:$,snapThreshold:l,onResizeStart:m,onResize:P,onResizeEnd:Pt,minSplitPercentage:f,maxSplitPercentage:i,locked:te,setLocked:X,findPaneById:ne,findPaneContainingTab:N,findTabById:A,getTabMetadata:U,getActiveTabMetadata:B,renderPane:c,resizerSize:s,poppedOutTabIds:p,isTabPoppedOut:vt}),[I,F,L,v,R,J,j,at,b,$,l,m,P,f,i,x,Pt,te,X,ne,N,A,U,B,c,s,p,vt]),xn=ge.useMemo(()=>({overTabId:ht,overTabPosition:Tt}),[ht,Tt]),Rn=ge.useMemo(()=>({removePane:Y,addTab:G,updateMetadata:Q,updatePaneLock:D,selectTab:C,mergeTab:ie,removeTab:re,setFullscreenPaneId:$,setLocked:X,splitPane:K,updateSplitPercentage:oe,moveTab:Le,popoutTab:y,dockTab:w}),[Y,G,Q,D,C,ie,re,$,X,K,oe,Le,y,w]),wn=St(I),Dn=ge.useMemo(()=>({registerPortalTarget:H,registerRenderCallback:V,renderCallbacksRef:be,registerRenderPane:nt,renderPaneRef:ot,registerTabHeader:bt,tabHeadersRef:rt,activeIdRef:Be,registerPopoutTarget:se}),[H,V,be,nt,ot,bt,rt,Be,se]);return Be&&(Be.current=L),jsxRuntime.jsx(xe.Provider,{value:Rn,children:jsxRuntime.jsx(st.Provider,{value:yn,children:jsxRuntime.jsx(lt.Provider,{value:xn,children:jsxRuntime.jsxs(ye.Provider,{value:Dn,children:[jsxRuntime.jsx(core.DndContext,{id:"zeugma-dnd-context",...Pn,children:n}),L&&v&&jsxRuntime.jsx(Xt,{activeId:L,render:ue=>jsxRuntime.jsx("div",{style:{transition:"transform 150ms cubic-bezier(0.2, 0, 0, 1)",transform:ue===R?"scale(0.8)":"scale(1)",transformOrigin:"top left"},children:jsxRuntime.jsx(Qt,{activeId:ue,activeType:v,dismissIntentId:R,renderDragOverlay:r,renderPaneRef:ot,renderPane:c,tabHeadersRef:rt,classNames:at})}),className:`${o.dragOverlay||""} ${L===R&&o.dismissPreview||""}`.trim()}),jsxRuntime.jsx("div",{id:"zeugma-portal-host",style:{display:"none"},children:wn.map(ue=>{let He=_[ue],yt=A(ue);return yt?jsxRuntime.jsx(Yt,{tabDetails:yt,target:He||null,renderWidget:be.current[ue]},ue):null})})]})})})})},ro=({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(dt,{renderPane:e,resizerSize:t,snapThreshold:n})},ao=e=>{let{children:t,...n}=e,{controller:r}=e;if(!r)throw new Error("Zeugma component requires a controller.");return jsxRuntime.jsx(oo,{...e,children:t!==void 0?t:jsxRuntime.jsx(ro,{...n})})};var lo={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"}}},co={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"}}},uo=({id:e,fraction:t,edge:n,activeClassName:r})=>{let{setNodeRef:o,isOver:c}=core.useDroppable({id:e}),s={position:"absolute",pointerEvents:"none",zIndex:101,boxSizing:"border-box",...co[n][t]};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:o,style:lo[n][t]}),c&&jsxRuntime.jsx("div",{className:r,style:s})]})},on=({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(uo,{id:n.id,fraction:n.fraction,edge:n.edge,activeClassName:e},n.id))});var Qe=ge.createContext(null);var bo={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"},center:{position:"absolute",top:"25%",left:"25%",width:"50%",height:"50%",zIndex:22,pointerEvents:"auto"}},vo={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"},center:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:21,pointerEvents:"none",boxSizing:"border-box"}},Ke=({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:bo[t]}),o&&jsxRuntime.jsx("div",{className:n,style:vo[t]})]})};var sn=({children:e,className:t,style:n})=>{let r=ge.useContext(Qe);if(!r)throw new Error("<DragHandle> must be used inside a <Pane>");let{disabled:o,...c}=r;return jsxRuntime.jsx("div",{className:t,style:{cursor:o?"default":"grab",userSelect:o?"auto":"none",touchAction:o?"auto":"none",...n},...o?{}:c,children:e})};var So=ge.createContext(void 0);var _e=({id:e,locked:t=false,children:n,className:r,style:o})=>{let{locked:c,classNames:s={},fullscreenPaneId:a,poppedOutTabIds:l=[]}=ae(),f=ge.useContext(xe),{overTabId:i}=Ve(),h=ge.useContext(ye);ge.useEffect(()=>(h?.registerTabHeader&&h.registerTabHeader(e,n),()=>{h?.registerTabHeader&&h.activeIdRef?.current!==e&&h.registerTabHeader(e,()=>null);}),[e,n,h]);let T=l.includes(e),b=ge.useContext(ft),d=t||c||(b?.locked??false)||a!==null,{attributes:u,listeners:m,setNodeRef:P,isDragging:g}=core.useDraggable({id:`tab-header-${e}`,disabled:d}),{setNodeRef:S,isOver:E}=core.useDroppable({id:`tab-drop-${e}`,disabled:d}),k=U=>{P(U),S(U);},I=E&&i===e,x=b?.tabIds||[],M=x.indexOf(e),F=b?.activeTabId,$=M>0&&e!==F&&x[M-1]!==F?jsxRuntime.jsx("div",{className:s.tabSeparator}):null,te=b?b.activeTabId===e:false,X=b?.tabsMetadata?.[e],ne=ge.useCallback(()=>{b?.selectTab(e);},[b,e]),N=ge.useCallback(()=>{b?.removeTab(e);},[b,e]),A=ge.useMemo(()=>({tabId:e,isActive:te,isDragging:g,isOver:I,metadata:X,locked:d,selectTab:ne,removeTab:N,isPoppedOut:T,popoutTab:()=>f?.popoutTab(e),dockTab:()=>f?.dockTab(e)}),[e,te,g,I,X,d,ne,N,T,f]);return jsxRuntime.jsx(So.Provider,{value:A,children:jsxRuntime.jsxs("div",{ref:k,id:`tab-header-${e}`,className:r,style:{display:"inline-flex",position:"relative",cursor:d?"default":"grab",...o},...d?{}:m,...d?{}:u,children:[$,n({isDragging:g,isOver:I})]})})};var ft=ge.createContext(void 0);var dn=(e,t)=>typeof e=="function"?e(t):e,mt=({tabIds:e,activeTabId:t,locked:n,tabsMetadata:r,selectTab:o,removeTab:c,renderTab:s,classNames:a,styles:l})=>{let f=ge.useContext(et),i=e??f?.tabIds??[],h=t??f?.activeTabId??"",T=n??f?.locked??false,b=r??f?.tabsMetadata,d=o??f?.selectTab??(()=>{}),u=c??f?.removeTab??(()=>{}),{classNames:m={},activeType:P,poppedOutTabIds:g=[]}=ae(),S=ge.useContext(xe),{overTabId:E,overTabPosition:k}=Ve(),I=ge.useMemo(()=>({tabIds:i,activeTabId:h,locked:T,tabsMetadata:b,selectTab:d,removeTab:u}),[i,h,T,b,d,u]),x=Ot(i,P,E,k);return jsxRuntime.jsx(ft.Provider,{value:I,children:jsxRuntime.jsxs("div",{className:a?.container,style:{display:"flex",alignItems:"center",height:"100%",...l?.container},children:[i.map((M,F)=>{let j=b?.[M],$=dn(a?.tab,M),te=dn(l?.tab,M),X=F===x;return jsxRuntime.jsxs(ge__default.default.Fragment,{children:[X&&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:F===0?"none":"translateX(-50%)"}})}),jsxRuntime.jsx(_e,{id:M,locked:T,className:$,style:te,children:({isDragging:ne,isOver:N})=>s({id:M,paneId:f?.id??"",isActive:M===h,index:F,isDragging:ne,isOver:N,metadata:j,onSelect:()=>d(M),onRemove:()=>u(M),isPoppedOut:g.includes(M),popout:()=>S?.popoutTab(M),dock:()=>S?.dockTab(M)})})]},M)}),x===i.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%)"}})})]})})};mt.Tab=_e;var fn=({className:e,style:t,children:n})=>jsxRuntime.jsx("div",{className:e,style:t,children:n});var et=ge.createContext(void 0),gn=()=>{let e=ge.useContext(et);if(!e)throw new Error("usePaneContext must be used within a Pane component");return e},Oo=({children:e,className:t,style:n})=>{let{activeTabId:r}=gn(),{classNames:o,isTabPoppedOut:c}=ae(),{dockTab:s}=Me(),a=ge.useRef(null),l=ge.useContext(ye);if(!l)throw new Error("PaneContent must be used within a Zeugma provider");let{registerPortalTarget:f,registerRenderCallback:i}=l,h=ge.useMemo(()=>typeof e=="function"?e:()=>e,[e]);i(r,h),ge.useEffect(()=>{let b=a.current;return f(r,b),()=>{f(r,null,b);}},[r,f]);let T=c(r);return jsxRuntime.jsx("div",{ref:a,id:`zeugma-tab-target-${r}`,className:`${o.tabContentWrapper||""} ${t||""}`.trim(),style:{height:"100%",width:"100%",position:"relative",...n},children:T&&jsxRuntime.jsxs("div",{className:"zeugma-popout-placeholder",style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"12px",padding:"24px",textAlign:"center",backgroundColor:"#161719",color:"#94a3b8",fontSize:"13px",fontWeight:500},children:[jsxRuntime.jsx("div",{children:"This panel is open in a new window"}),jsxRuntime.jsx("button",{onClick:()=>s(r),style:{padding:"6px 12px",fontSize:"11px",fontWeight:600,borderRadius:"4px",backgroundColor:"#2563eb",color:"#ffffff",border:"none",cursor:"pointer",boxShadow:"0 1px 3px rgba(0,0,0,0.1)"},onMouseOver:b=>{b.currentTarget.style.backgroundColor="#1d4ed8";},onMouseOut:b=>{b.currentTarget.style.backgroundColor="#2563eb";},children:"Dock Back"})]})})},Ie=({id:e,children:t,style:n,locked:r=false})=>{let{layout:o,renderingLayout:c,activeId:s,activeType:a,classNames:l,fullscreenPaneId:f,onFullscreenChange:i,locked:h,poppedOutTabIds:T=[]}=ae(),{removePane:b,updateMetadata:d,selectTab:u,removeTab:m,popoutTab:P,dockTab:g}=Me(),S=ge.useMemo(()=>{if(a==="tab"&&e===s){let O=W(o,e)?.tabsMetadata?.[e];return {type:"pane",id:e,tabIds:[e],activeTabId:e,tabsMetadata:O?{[e]:O}:void 0}}return Lt(e===s?o:c,e)},[o,c,e,s,a]),E=S?.id??e,k=S?.tabIds??[e],I=S?.activeTabId??e,x=S?.tabsMetadata,M=x?.[e],F=S?.locked??false,j=r||F,$=h||j||f!==null,te=h||j||f!==null,X=s!==null&&s!==e&&(!k.includes(s)||k.length>1)&&!te,{attributes:ne,listeners:N,setNodeRef:A}=core.useDraggable({id:e,disabled:$}),U=s!==null&&k.includes(s),B=f===e,L=ge.useMemo(()=>({isDragging:U,isFullscreen:B,toggleFullscreen:()=>i?.(B?null:e),remove:()=>{B&&i?.(null),b(E);},metadata:M,updateMetadata:Z=>{d(e,Z);},locked:$,tabIds:k,activeTabId:I,selectTab:Z=>u(E,Z),removeTab:Z=>{B&&Z===I&&i?.(null),m(Z);},tabsMetadata:x,updateTabMetadata:(Z,R)=>{d(Z,R);},isActiveTabPoppedOut:T.includes(I),popoutTab:Z=>P(Z||I),dockTab:Z=>g(Z||I)}),[U,B,i,e,m,M,d,$,k,I,u,E,x,T,P,g]),z=ge.useMemo(()=>$?{disabled:true}:{...N,...ne},[N,ne,$]),v=`${l.pane||""} ${j&&l.paneLocked||""}`.trim();return jsxRuntime.jsx(et.Provider,{value:{id:e,...L},children:jsxRuntime.jsx(Qe.Provider,{value:z,children:jsxRuntime.jsxs("div",{ref:A,id:e,className:v,style:{position:"relative",width:"100%",height:"100%",...n},children:[t,X&&jsxRuntime.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:15,pointerEvents:"none"},children:[["top","bottom","left","right"].map(Z=>jsxRuntime.jsx(Ke,{id:`drop-${Z}-${e}`,position:Z,activeClassName:l.dropPreview},Z)),a==="tab"&&jsxRuntime.jsx(Ke,{id:`drop-center-${e}`,position:"center",activeClassName:l.swapPreview??l.dropPreview})]}),s!==null&&s!==e&&te&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:15,pointerEvents:"none"},children:jsxRuntime.jsx(Ke,{id:`drop-locked-${e}`,position:"full",activeClassName:l.lockedPreview||""})})]})})})};Ie.Content=Oo;Ie.DragHandle=sn;Ie.Tabs=mt;Ie.Tab=_e;Ie.Controls=fn;exports.Pane=Ie;exports.PaneTree=dt;exports.Zeugma=ao;exports.usePaneContext=gn;exports.useResizer=ut;exports.useZeugma=In;exports.useZeugmaContext=Ln;//# sourceMappingURL=index.cjs.map
|
|
9
|
+
`,document.head.appendChild(o),t.setAttribute("data-resizing","true");let c=i=>{n(i);},u=()=>{document.body.classList.remove("zeugma-resizing"),t.removeAttribute("data-resizing");let i=document.getElementById("zeugma-global-cursor-style");i&&i.remove(),document.removeEventListener("pointermove",c),document.removeEventListener("pointerup",u),a();};document.addEventListener("pointermove",c),document.addEventListener("pointerup",u);}function Ae(e){try{return JSON.stringify(e)}catch{return ""}}var dt=ge.createContext(void 0),we=ge.createContext(void 0),Pe=ge.createContext(void 0),pt=ge.createContext(void 0),re=()=>{let e=ge.useContext(dt);if(!e)throw new Error("useZeugmaState must be used within a Zeugma provider");return e},ze=()=>{let e=ge.useContext(we);if(!e)throw new Error("useZeugmaActions must be used within a Zeugma provider");return e},Ue=()=>{let e=ge.useContext(pt);if(!e)throw new Error("useZeugmaDrag must be used within a Zeugma provider");return e};function Lt(e){let t=ge.useRef(null);return ge.useEffect(()=>{if(!e){t.current=null;return}let n=o=>{t.current={x:o.clientX,y:o.clientY};},a=o=>{let c=o.touches[0]||o.changedTouches[0];c&&(t.current={x:c.clientX,y:c.clientY});};return window.addEventListener("pointermove",n,{passive:true}),window.addEventListener("touchmove",a,{passive:true}),()=>{window.removeEventListener("pointermove",n),window.removeEventListener("touchmove",a);}},[e]),t}function Mt(e){ge.useEffect(()=>(e?document.body.style.setProperty("cursor","not-allowed","important"):document.body.style.removeProperty("cursor"),()=>{document.body.style.removeProperty("cursor");}),[e]);}function kt(){let[e,t]=ge.useState({}),[n,a]=ge.useState({}),o=ge.useRef({}),c=ge.useRef(null),u=ge.useRef({}),i=ge.useRef(null),d=ge.useRef(true);ge.useEffect(()=>(d.current=true,()=>{d.current=false;}),[]);let f=ge.useCallback((T,x,L)=>{d.current&&t(h=>{if(!x){if(L&&h[T]!==L||!h[T])return h;let H={...h};return delete H[T],H}return h[T]===x?h:{...h,[T]:x}});},[]),s=ge.useCallback((T,x)=>{d.current&&a(L=>{if(!x){if(!L[T])return L;let h={...L};return delete h[T],h}return L[T]===x?L:{...L,[T]:x}});},[]),b=ge.useCallback((T,x)=>{o.current[T]=x;},[]),g=ge.useCallback(T=>{c.current=T;},[]),m=ge.useCallback((T,x)=>{u.current[T]=x;},[]);return {portalTargets:ge.useMemo(()=>({...e,...n}),[e,n]),registerPortalTarget:f,registerPopoutTarget:s,registerRenderCallback:b,renderCallbacksRef:o,registerRenderPane:g,renderPaneRef:c,registerTabHeader:m,tabHeadersRef:u,activeIdRef:i}}function An(e){let t=new Set;function n(a){a&&(a.type==="pane"?a.tabIds.forEach(o=>{t.add(o);}):a.type==="split"&&(n(a.first),n(a.second)));}return n(e),Array.from(t).sort()}function Ot(e){return ge.useMemo(()=>An(e),[e])}function At(e){let{onDragStart:t,onDragEnd:n}=e,[a,o]=ge.useState(null),[c,u]=ge.useState(null),i=ge.useCallback(f=>{t&&t(f);},[t]),d=ge.useCallback((f,s,b)=>{n&&n(f,s,b);},[n]);return {overTabId:a,setOverTabId:o,overTabPosition:c,setOverTabPosition:u,handleDragStartInternal:i,handleDragEndInternal:d}}function zt(e){let n=ge.useContext(Pe)?.registerRenderPane;ge.useEffect(()=>{n&&e&&n(e);},[n,e]);}function pe(){return "pane-"+Math.random().toString(36).substring(2,11)}function be(e,t){if(e===null)return null;if(e.type==="pane")return e.id===t?null:e;let n=be(e.first,t),a=be(e.second,t);return n===null?a:a===null?n:{...e,first:n,second:a}}function fe(e,t){if(e===null)return null;if(e.type==="pane"){if(e.tabIds.includes(t)){let o=e.tabIds.filter(i=>i!==t);if(o.length===0)return null;let c=e.activeTabId;e.activeTabId===t&&(c=o[0]);let u={...e.tabsMetadata};return delete u[t],{...e,tabIds:o,activeTabId:c,tabsMetadata:Object.keys(u).length>0?u:void 0}}return e}let n=fe(e.first,t),a=fe(e.second,t);return n===null?a:a===null?n:{...e,first:n,second:a}}function Se(e,t,n,a,o){if(e===null)return typeof o=="string"?{type:"pane",id:pe(),tabIds:[o],activeTabId:o}:o;if(e.type==="pane"){if(e.id===t){let c=typeof o=="string"?{type:"pane",id:pe(),tabIds:[o],activeTabId:o}:o,u=a==="left"||a==="top";return {type:"split",direction:n,first:u?c:e,second:u?e:c,splitPercentage:50}}return e}return {...e,first:Se(e.first,t,n,a,o)||e.first,second:Se(e.second,t,n,a,o)||e.second}}function zn(e,t){if(e===null)return t;function n(a,o){return a.type==="pane"?{type:"split",direction:o==="row"?"column":"row",splitPercentage:50,first:a,second:t}:{...a,second:n(a.second,a.direction)}}return n(e,null)}function Zt(e,t,n,a){if(e===null)return {type:"pane",id:pe(),tabIds:[n],activeTabId:n,tabsMetadata:a?{[n]:a}:void 0};let o=t?te(e,t):null;if(o&&o.type==="pane"){let i=function(d){if(d.type==="pane"&&d.id===t){let f=[...d.tabIds];f.includes(n)||f.push(n);let s=d.tabsMetadata;return a&&(s={...d.tabsMetadata,[n]:a}),{...d,tabIds:f,activeTabId:n,tabsMetadata:s}}return d.type==="split"?{...d,first:i(d.first),second:i(d.second)}:d};return i(e)}let c={type:"pane",id:pe(),tabIds:[n],activeTabId:n,tabsMetadata:a?{[n]:a}:void 0};return zn(e,c)}function xe(e,t,n){return e===null?null:e===t?{...e,splitPercentage:n}:e.type==="split"?{...e,first:xe(e.first,t,n)||e.first,second:xe(e.second,t,n)||e.second}:e}function te(e,t){return e===null?null:e.type==="pane"?e.id===t?e:null:e.type==="split"?te(e.first,t)??te(e.second,t):null}function U(e,t){return e===null?null:e.type==="pane"?e.tabIds.includes(t)?e:null:e.type==="split"?U(e.first,t)??U(e.second,t):null}function Ht(e,t){return te(e,t)??U(e,t)}function $t(e,t){let n=U(e,t);if(!n)return null;let a=n.tabIds.indexOf(t);return {id:t,paneId:n.id,isActive:n.activeTabId===t,index:a,metadata:n.tabsMetadata?.[t],remountOnPopout:n.tabsMetadata?.[t]?.remountOnPopout}}function _t(e,t){return U(e,t)?.tabsMetadata?.[t]}function Bt(e,t){let n=te(e,t);return n?.tabsMetadata?.[n.activeTabId]}function Je(e,t,n){if(e===null)return null;if(e.type==="pane"){if(e.tabIds.includes(t)){let a=e.tabsMetadata||{},o=a[t],c=n(o),u={...a};return c===void 0?delete u[t]:u[t]=c,{...e,tabsMetadata:Object.keys(u).length>0?u:void 0}}return e}return e.type==="split"?{...e,first:Je(e.first,t,n)??e.first,second:Je(e.second,t,n)??e.second}:e}function Ge(e,t,n){if(e===null)return null;if(e.type==="pane"){if(e.id===t){if(n===false){let{locked:a,...o}=e;return o}return {...e,locked:n}}return e}return e.type==="split"?{...e,first:Ge(e.first,t,n)??e.first,second:Ge(e.second,t,n)??e.second}:e}function Ne(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:Ne(e.first,t,n)??e.first,second:Ne(e.second,t,n)??e.second}:e}function Ft(e,t,n){if(e===null)return null;let o=U(e,t)?.tabsMetadata?.[t],c=fe(e,t);if(c===null)return {type:"pane",id:pe(),tabIds:[t],activeTabId:t,tabsMetadata:o?{[t]:o}:void 0};function u(i){if(i.type==="pane"){if(i.id===n){let d=[...i.tabIds];d.includes(t)||d.push(t);let f={...i.tabsMetadata};return o&&(f[t]=o),{...i,tabIds:d,activeTabId:t,tabsMetadata:Object.keys(f).length>0?f:void 0}}return i}return i.type==="split"?{...i,first:u(i.first),second:u(i.second)}:i}return u(c)}function Zn(e,t,n){if(e===null)return null;if(t===n)return e;let a=U(e,t),o=U(e,n);if(!a||!o)return e;let c=a.id,u=o.id,i=a.tabsMetadata?.[t],d=o.tabsMetadata?.[n];function f(s){if(s.type==="pane"){let b=false,g=[...s.tabIds],m=s.activeTabId,y=s.tabsMetadata?{...s.tabsMetadata}:{};if(c===u){if(s.id===c){let T=g.indexOf(t),x=g.indexOf(n);T!==-1&&x!==-1&&(g[T]=n,g[x]=t),m=t,b=true;}}else s.id===c&&(g=g.map(T=>T===t?n:T),m===t&&(m=n),delete y[t],d&&(y[n]=d),b=true),s.id===u&&(g=g.map(T=>T===n?t:T),m===n&&(m=t),delete y[n],i&&(y[t]=i),b=true);return b?{...s,tabIds:g,activeTabId:m,tabsMetadata:Object.keys(y).length>0?y:void 0}:s}return s.type==="split"?{...s,first:f(s.first),second:f(s.second)}:s}return f(e)}function Ze(e,t,n,a="before"){if(e===null)return null;if(t===n)return e;if(a==="center")return Zn(e,t,n);let c=U(e,t)?.tabsMetadata?.[t],u=fe(e,t);if(u===null)return {type:"pane",id:pe(),tabIds:[t],activeTabId:t,tabsMetadata:c?{[t]:c}:void 0};function i(d){if(d.type==="pane"){if(d.tabIds.includes(n)){let s=[...d.tabIds].filter(m=>m!==t),b=s.indexOf(n);b<0&&(b=0),a==="after"&&(b+=1),s.splice(b,0,t);let g={...d.tabsMetadata};return c&&(g[t]=c),{...d,tabIds:s,activeTabId:t,tabsMetadata:Object.keys(g).length>0?g:void 0}}return d}return d.type==="split"?{...d,first:i(d.first),second:i(d.second)}:d}return i(u)}function ve(e,t=0,n=0,a=100,o=100,c="root"){if(e===null)return {panes:[],splitters:[]};if(e.type==="pane")return {panes:[{paneId:e.id,left:t,top:n,width:a,height:o,node:e}],splitters:[]};let{direction:u,splitPercentage:i,first:d,second:f}=e,b={id:`splitter-${c}-${u}`,currentNode:e,direction:u,left:u==="row"?t+a*(i/100):t,top:u==="column"?n+o*(i/100):n,width:u==="row"?0:a,height:u==="column"?0:o,parentLeft:t,parentTop:n,parentWidth:a,parentHeight:o},g={panes:[],splitters:[]},m={panes:[],splitters:[]};if(u==="row"){let y=a*(i/100);g=ve(d,t,n,y,o,`${c}-L`),m=ve(f,t+y,n,a-y,o,`${c}-R`);}else {let y=o*(i/100);g=ve(d,t,n,a,y,`${c}-T`),m=ve(f,t,n+y,a,o-y,`${c}-B`);}return {panes:[...g.panes,...m.panes],splitters:[b,...g.splitters,...m.splitters]}}function Vt(e,t,n,a="before"){if(e===null)return null;let o=te(e,t);if(!o)return e;let c=o.tabIds,u=o.activeTabId,i=o.tabsMetadata||{},d=be(e,t);if(d===null)return o;function f(s){if(s.type==="pane"){if(s.tabIds.includes(n)){let g=[...s.tabIds].filter(T=>!c.includes(T)),m=g.indexOf(n);m<0&&(m=0),a==="after"&&(m+=1),g.splice(m,0,...c);let y={...s.tabsMetadata};for(let T of c)i[T]&&(y[T]=i[T]);return {...s,tabIds:g,activeTabId:u,tabsMetadata:Object.keys(y).length>0?y:void 0}}return s}return s.type==="split"?{...s,first:f(s.first),second:f(s.second)}:s}return f(d)}function Wt(e,t,n,a){if(!((t==="tab"||t==="pane")&&n&&e.includes(n))||!a)return -1;let u=e.indexOf(n);return a==="before"?u:u+1}function Hn(e){let{initialLayout:t,layout:n,onChange:a,fullscreenPaneId:o,onFullscreenChange:c,locked:u=false}=e,[i,d]=ge.useState(()=>n!==void 0?n:t??null),[f,s]=ge.useState(()=>n!==void 0?n:t??null),[b,g]=ge.useState(()=>Ae(n!==void 0?n:null)),[m,y]=ge.useState(o||null),[T,x]=ge.useState(u),[L,h]=ge.useState([]),[H,D]=ge.useState(null),[O,Z]=ge.useState(null),[r,l]=ge.useState(null),v=ge.useRef(null),R=ge.useCallback(p=>{v.current=p;},[]),M=ge.useRef(i);M.current=i;let q=ge.useRef(a);q.current=a;let ne=ge.useRef(c);ne.current=c;let J=ge.useCallback(p=>{y(p),ne.current?.(p);},[]);if(ge.useEffect(()=>{x(u);},[u]),ge.useEffect(()=>{o!==void 0&&y(o);},[o]),n!==void 0){let p=Ae(n);p!==b&&(g(p),d(n),s(n));}let A=ge.useCallback(p=>(...w)=>{let E=M.current,_=p(E,...w);Ae(E)!==Ae(_)&&(M.current=_,d(_),s(_),q.current?.(_));},[]),$=ge.useCallback(A((p,w)=>typeof w=="function"?w(p):w),[A]),W=ge.useCallback(p=>{s(w=>typeof p=="function"?p(w):p);},[]),F=ge.useCallback(p=>{y(null),ne.current?.(null),D(null),Z(null),l(null),$(p),s(()=>typeof p=="function"?p(M.current):p);},[$]),B=ge.useCallback(A((p,w)=>be(p,w)),[A]),N=ge.useCallback(A((p,w,E,_)=>{let V=fe(p,w)??p;return Zt(V,E,w,_)}),[A]),P=ge.useCallback(A((p,w,E,_,V)=>{let le=te(p,w)??U(p,w);if(!le)return p;let j=te(p,V)??U(p,V)??{type:"pane",id:V,tabIds:[V],activeTabId:V},Te=be(p,j.id);return Se(Te,le.id,E,_,j)}),[A]),z=ge.useCallback(A((p,w,E)=>xe(p,w,E)),[A]),C=ge.useCallback(A((p,w,E)=>Je(p,w,E)),[A]),k=ge.useCallback(A((p,w,E)=>{let _=te(p,w)??U(p,w);return _?Ge(p,_.id,E):p}),[A]),ue=ge.useCallback(A((p,w,E)=>{let _=te(p,w)??U(p,w);return _?Ne(p,_.id,E):p}),[A]),Q=ge.useCallback(A((p,w,E)=>{let _=te(p,E)??U(p,E);return _?Ft(p,w,_.id):p}),[A]),K=ge.useCallback(A((p,w,E,_)=>Ze(p,w,E,_)),[A]),Y=ge.useCallback(A((p,w)=>fe(p,w)),[A]),ee=ge.useCallback(p=>te(M.current,p),[]),S=ge.useCallback(p=>U(M.current,p),[]),I=ge.useCallback(p=>$t(M.current,p),[]),ie=ge.useCallback(p=>_t(M.current,p),[]),se=ge.useCallback(p=>Bt(M.current,p),[]),G=ge.useCallback(p=>{h(w=>w.includes(p)?w:[...w,p]);},[]),oe=ge.useCallback(p=>{h(w=>w.includes(p)?w.filter(E=>E!==p):w);},[]);return {layout:i,setLayout:F,_internalSetLayout:W,renderingLayout:f,fullscreenPaneId:m,setFullscreenPaneId:J,locked:T,setLocked:x,poppedOutTabIds:L,activeId:H,setActiveId:D,activeType:O,setActiveType:Z,dismissIntentId:r,setDismissIntentId:l,containerRef:v,setContainerRef:R,removePane:B,addTab:N,updateMetadata:C,updatePaneLock:k,selectTab:ue,mergeTab:Q,moveTab:K,removeTab:Y,splitPane:P,updateSplitPercentage:z,popoutTab:G,dockTab:oe,findPaneById:ee,findPaneContainingTab:S,findTabById:I,getTabMetadata:ie,getActiveTabMetadata:se}}var $n=()=>{let e=re(),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,poppedOutTabIds:e.poppedOutTabIds,popoutTab:t.popoutTab,dockTab:t.dockTab}};var Ke=class extends core.PointerSensor{static activators=[{eventName:"onPointerDown",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]},et=class extends core.TouchSensor{static activators=[{eventName:"onTouchStart",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]};var qt=e=>{let n=e.active.id.toString().startsWith("tab-header-"),o=core.pointerWithin(e);if(o.length>0)return [...o].sort((u,i)=>{let d=u.id.toString(),f=i.id.toString(),s=d.startsWith("tab-drop-"),b=f.startsWith("tab-drop-");if(s&&!b)return -1;if(!s&&b)return 1;let g=d.startsWith("drop-root-"),m=f.startsWith("drop-root-");return g&&!m?-1:!g&&m?1:0});if(n){let c=e.droppableContainers.filter(u=>u.id.toString().startsWith("tab-drop-"));return core.closestCenter({...e,droppableContainers:c})}return []};function He(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 Yt(e){let{layout:t,_internalSetLayout:n,setLayout:a,activeId:o,setActiveId:c,activeType:u,setActiveType:i,dismissIntentId:d,setDismissIntentId:f,setOverTabId:s,setOverTabPosition:b,containerRef:g,dragActivationDistance:m,enableDragToDismiss:y,dismissThreshold:T,onRemove:x,onDragStart:L,onDragEnd:h,onDismissIntentChange:H,removeTab:D,removePane:O}=e,Z=ge.useRef(null),r=Lt(o),l=ge.useRef(null),[v,R]=ge.useState(false);return Mt(v),{sensors:core.useSensors(core.useSensor(Ke,{activationConstraint:{distance:m}}),core.useSensor(et,{activationConstraint:{delay:250,tolerance:5}})),collisionDetection:qt,onDragStart:$=>{let W=$.active.id.toString(),F=W.startsWith("tab-header-"),B=F?W.substring(11):W;c(B),i(F?"tab":"pane"),s(null),b(null);let N=$.activatorEvent;r.current=He(N),y&&g.current?Z.current=g.current.getBoundingClientRect():Z.current=null;let P=t;if(F){let C=U(t,B);C&&(P=Ne(t,C.id,B)||t);}l.current=P;let z=F?fe(P,B):be(P,B);n(z),L&&L(B);},onDragMove:$=>{let{over:W}=$,F=W?.id.toString()||"",B=F.startsWith("drop-locked-");R(S=>S===B?S:B);let N=$.active.id.toString(),P=N.startsWith("tab-header-"),z=P?N.substring(11):N,C=F.match(/^tab-drop-(.+)$/);if(C&&W&&(P||u==="pane")){let[,S]=C;if(z!==S){let I="before",ie=W.rect,se=$.activatorEvent,G=null;if(r.current)G=r.current.x;else {let oe=He(se);oe&&(G=oe.x+$.delta.x);}if(G!==null){let oe=ie.left+ie.width/2;G>oe&&(I="after");}s(oe=>oe===S?oe:S),b(oe=>oe===I?oe:I);}else s(I=>I===null?I:null),b(I=>I===null?I:null);}else s(S=>S===null?S:null),b(S=>S===null?S:null);if(!y)return;let k=Z.current;if(!k){d!==null&&(f(null),H?.(null));return}let ue=$.activatorEvent,Q=null,K=null;if(r.current)Q=r.current.x,K=r.current.y;else {let S=He(ue);S&&(Q=S.x+$.delta.x,K=S.y+$.delta.y);}let Y=0;if(Q!==null&&K!==null){let S=0,I=0;Q<k.left?S=k.left-Q:Q>k.right&&(S=Q-k.right),K<k.top?I=k.top-K:K>k.bottom&&(I=K-k.bottom),Y=Math.sqrt(S*S+I*I);}else {let S=$.active.rect.current.translated;if(S){let I=S.left+S.width/2,ie=S.top+S.height/2,se=0,G=0;I<k.left?se=k.left-I:I>k.right&&(se=I-k.right),ie<k.top?G=k.top-ie:ie>k.bottom&&(G=ie-k.bottom),Y=Math.sqrt(se*se+G*G);}}Y>T?d!==z&&(f(z),H?.(z)):d!==null&&(f(null),H?.(null));},onDragEnd:$=>{c(null),i(null),R(false),s(null),b(null);let{active:W,over:F}=$,B=W.id.toString(),N=B.startsWith("tab-header-"),P=N?B.substring(11):B,z=y&&d===P;f(null),H?.(null),Z.current=null;let C=l.current||t;if(l.current=null,z){x?x(P):N?D(P):O(P),h&&h(P,null,null);return}if(!F){n(C),h&&h(P,null,null);return}let k=F.id.toString();if(k.startsWith("drop-locked-")){n(C),h&&h(P,null,null);return}let ue=k.match(/^tab-drop-(.+)$/);if(ue){let[,p]=ue;if(N)if(P!==p){let w="before",E=F.rect,_=$.activatorEvent,V=null;if(r.current)V=r.current.x;else {let j=He(_);j&&(V=j.x+$.delta.x);}if(V!==null){let j=E.left+E.width/2;V>j&&(w="after");}let le=Ze(C,P,p,w);a(le),h&&h(P,p,{type:"move",position:"center"});}else n(C),h&&h(P,null,null);else {let w="before",E=F.rect,_=$.activatorEvent,V=null;if(r.current)V=r.current.x;else {let j=He(_);j&&(V=j.x+$.delta.x);}if(V!==null){let j=E.left+E.width/2;V>j&&(w="after");}let le=Vt(C,P,p,w);a(le),h&&h(P,p,{type:"move",position:"center"});}return}let Q=k.match(/^drop-root-(1\/4|1\/3)-(top|bottom|left|right|start|end)$/);if(Q){let[,p,w]=Q,E=w;E==="start"&&(E="left"),E==="end"&&(E="right");let _=N?fe(C,P):be(C,P),V;if(N){let j=U(C,P)?.tabsMetadata?.[P];V={type:"pane",id:pe(),tabIds:[P],activeTabId:P,tabsMetadata:j?{[P]:j}:void 0};}else V=te(C,P)??{type:"pane",id:pe(),tabIds:[P],activeTabId:P};if(_===null)a(V);else {let le=E==="left"||E==="right",j=E==="left"||E==="top",Te=50;p==="1/4"?Te=j?25:75:p==="1/3"&&(Te=j?100/3:200/3),a({type:"split",direction:le?"row":"column",first:j?V:_,second:j?_:V,splitPercentage:Te});}h&&h(P,"root",{type:"split",direction:E==="left"||E==="right"?"row":"column",position:E});return}let K=k.match(/^drop-(left|right|top|bottom|center)-(.+)$/);if(!K){n(C),h&&h(P,null,null);return}let[,Y,ee]=K;if(Y==="center"){if(N){let p=te(C,ee);if(p&&p.activeTabId){let w=p.activeTabId,E=Ze(C,P,w,"center");a(E),h&&h(P,ee,{type:"move",position:"center"});}else n(C),h&&h(P,null,null);}else n(C),h&&h(P,null,null);return}let S=N?U(C,P):te(C,P),I=S&&S.id===ee,ie=S&&S.tabIds.length===1;if(P===ee||I&&ie){n(C),h&&h(P,null,null);return}let se=Y==="left"||Y==="right"?"row":"column",G;if(N){let w=U(C,P)?.tabsMetadata?.[P];G={type:"pane",id:pe(),tabIds:[P],activeTabId:P,tabsMetadata:w?{[P]:w}:void 0};}else G=te(C,P)??{type:"pane",id:pe(),tabIds:[P],activeTabId:P};let oe=N?fe(C,P):be(C,P),Oe=Se(oe,ee,se,Y,G);a(Oe),h&&h(P,ee,{type:"split",direction:se,position:Y});},onDragCancel:()=>{c(null),i(null),R(false),s(null),b(null),f(null),H?.(null),Z.current=null;let $=l.current||t;l.current=null,n($),$!==t&&a($);}}}function Gt({persist:e,layout:t,setLayout:n}){let a=typeof e=="object"?e.enabled!==false:!!e,o=typeof e=="object"&&e.key||"zeugma-layout",[c,u]=ge.useState(false);ge.useEffect(()=>{if(a){let i=localStorage.getItem(o);if(i)try{let d=JSON.parse(i);d&&n(d);}catch(d){console.error("Failed to parse persisted zeugma layout",d);}}u(true);},[a,o,n]),ge.useEffect(()=>{a&&c&&(t?localStorage.setItem(o,JSON.stringify(t)):localStorage.removeItem(o));},[a,o,t,c]);}var Ee=null,Kt=false,ae=new Set,De=new Set,Ie=null;function Xn(){typeof window>"u"||Ie||(Ie=new MutationObserver(e=>{e.forEach(t=>{t.addedNodes.forEach(n=>{n instanceof HTMLElement&&(n.tagName.toLowerCase()==="style"||n.tagName.toLowerCase()==="link")&&ae.forEach(a=>{try{let o=n.cloneNode(!0);if(o.tagName.toLowerCase()==="link"){let c=n.href;c&&o.setAttribute("href",c);}a.head.appendChild(o);}catch(o){console.warn("Failed to mirror style node to popout:",o);}});});});}),Ie.observe(document.head,{childList:true}));}function ft(){Ie&&(Ie.disconnect(),Ie=null);}var Le=null;function Yn(){typeof window>"u"||Le||(Le=new MutationObserver(e=>{e.forEach(t=>{if(t.type==="attributes"&&t.attributeName){let n=document.documentElement.getAttribute(t.attributeName);ae.forEach(a=>{try{a&&a.documentElement&&(n!==null?a.documentElement.setAttribute(t.attributeName,n):a.documentElement.removeAttribute(t.attributeName));}catch(o){console.warn("Failed to sync documentElement attribute:",o);}});}});}),Le.observe(document.documentElement,{attributes:true}));}function mt(){Le&&(Le.disconnect(),Le=null);}var en=e=>{typeof requestAnimationFrame<"u"?requestAnimationFrame(e):setTimeout(e,0);};function me(){if(typeof window>"u")return document;if(Ee&&Ee.target){let t=Ee.target.ownerDocument;if(t&&t!==document)return t}let e=window.event;if(e&&e.target){let n=e.target.ownerDocument;if(n&&n!==document)return n}return window.__zeugmaActivePopoutDocument?window.__zeugmaActivePopoutDocument:document}function tn(){if(typeof window>"u"||Kt)return;Kt=true;let e=(r,l)=>{if(!r||!l)return false;try{let v=Object.getPrototypeOf(r);for(;v;){if(v===l)return !0;v=Object.getPrototypeOf(v);}}catch{}return false},t=(r,l)=>{try{Object.defineProperty(r,Symbol.hasInstance,{value:function(v){return v?e(v,r.prototype)?!0:l(v):!1},configurable:!0,writable:!0});}catch(v){console.warn("Failed to patch Symbol.hasInstance on",r,v);}};typeof Node<"u"&&t(Node,r=>typeof r.nodeType=="number"&&typeof r.nodeName=="string"),typeof Element<"u"&&t(Element,r=>r.nodeType===1),typeof HTMLElement<"u"&&t(HTMLElement,r=>r.nodeType===1&&typeof r.style=="object"),typeof HTMLBodyElement<"u"&&t(HTMLBodyElement,r=>r.nodeType===1&&r.tagName==="BODY"),typeof HTMLHtmlElement<"u"&&t(HTMLHtmlElement,r=>r.nodeType===1&&r.tagName==="HTML"),typeof HTMLInputElement<"u"&&t(HTMLInputElement,r=>r.nodeType===1&&r.tagName==="INPUT"),typeof HTMLTextAreaElement<"u"&&t(HTMLTextAreaElement,r=>r.nodeType===1&&r.tagName==="TEXTAREA"),typeof ShadowRoot<"u"&&t(ShadowRoot,r=>r.nodeType===11&&r.host!==void 0),typeof SVGElement<"u"&&t(SVGElement,r=>r.nodeType===1&&typeof r.getBBox=="function"),typeof Document<"u"&&t(Document,r=>r.nodeType===9),typeof Window<"u"&&t(Window,r=>r&&typeof r.document=="object"&&typeof r.location=="object");let n=Document.prototype,a=Object.getOwnPropertyDescriptor(n,"body"),o=Object.getOwnPropertyDescriptor(n,"documentElement"),c=Object.getOwnPropertyDescriptor(n,"head"),u=Object.getOwnPropertyDescriptor(n,"activeElement"),i=Object.getOwnPropertyDescriptor(n,"defaultView"),d=Object.getOwnPropertyDescriptor(n,"scrollingElement");Object.defineProperties(document,{body:{get(){let r=me();return r&&r!==document?r.body:a?.get?.call(document)||document.body},configurable:true},documentElement:{get(){let r=me();return r&&r!==document?r.documentElement:o?.get?.call(document)||document.documentElement},configurable:true},head:{get(){let r=me();return r&&r!==document?r.head:c?.get?.call(document)||document.head},configurable:true},activeElement:{get(){let r=me();return r&&r!==document?r.activeElement:u?.get?.call(document)||document.activeElement},configurable:true},defaultView:{get(){let r=me();return r&&r!==document?r.defaultView:i?.get?.call(document)||document.defaultView},configurable:true},scrollingElement:{get(){let r=me();return r&&r!==document?r.scrollingElement:d?.get?.call(document)||document.scrollingElement},configurable:true}});let f=Window.prototype,s=["innerWidth","innerHeight","pageXOffset","pageYOffset","scrollX","scrollY","screenX","screenY","outerWidth","outerHeight","devicePixelRatio"],b={};s.forEach(r=>{let l=Object.getOwnPropertyDescriptor(f,r)||Object.getOwnPropertyDescriptor(window,r);l&&l.get&&(b[r]=l.get);}),s.forEach(r=>{Object.defineProperty(window,r,{get(){let l=me();if(l&&l!==document&&l.defaultView)try{return l.defaultView[r]}catch{}let v=b[r];return v?v.call(window):window[r]},configurable:true});});let g=Node.prototype.contains;Node.prototype.contains=function(r){if(!r)return false;if(g.call(this,r))return true;if(this===document||this===document.body||this===document.documentElement)for(let l of ae)try{if(l.contains(r))return !0}catch{}return false};let m=()=>{Ee=null,globalThis.__zeugmaActivePopoutDocument=null;};["pointerdown","mousedown","click","keydown","focus","touchstart"].forEach(r=>{window.addEventListener(r,m,true);});let T=document.createElement;document.createElement=function(r,l){let v=me();return v&&v!==document?v.createElement(r,l):T.call(document,r,l)};let x=document.addEventListener;document.addEventListener=function(r,l,v){De.add({target:"document",type:r,listener:l,options:v}),x.call(document,r,l,v),ae.forEach(R=>{try{R.addEventListener(r,l,v);}catch{}});};let L=document.removeEventListener;document.removeEventListener=function(r,l,v){for(let R of De)if(R.target==="document"&&R.type===r&&R.listener===l){De.delete(R);break}L.call(document,r,l,v),ae.forEach(R=>{try{R.removeEventListener(r,l,v);}catch{}});};let h=window.addEventListener;window.addEventListener=function(r,l,v){De.add({target:"window",type:r,listener:l,options:v}),h.call(window,r,l,v),ae.forEach(R=>{try{R.defaultView&&R.defaultView.addEventListener(r,l,v);}catch{}});};let H=window.removeEventListener;window.removeEventListener=function(r,l,v){for(let R of De)if(R.target==="window"&&R.type===r&&R.listener===l){De.delete(R);break}H.call(window,r,l,v),ae.forEach(R=>{try{R.defaultView&&R.defaultView.removeEventListener(r,l,v);}catch{}});};let D=document.getElementById;document.getElementById=function(r){let l=me();if(l&&l!==document)return l.getElementById(r);let v=D.call(document,r);if(v)return v;for(let R of ae)try{let M=R.getElementById(r);if(M)return M}catch{}return null};let O=document.querySelector;document.querySelector=function(r){let l=me();if(l&&l!==document)return l.querySelector(r);let v=O.call(document,r);if(v)return v;for(let R of ae)try{let M=R.querySelector(r);if(M)return M}catch{}return null};let Z=document.querySelectorAll;document.querySelectorAll=function(r){let l=me();if(l&&l!==document)return l.querySelectorAll(r);let v=Z.call(document,r);if(v.length>0)return v;for(let R of ae)try{let M=R.querySelectorAll(r);if(M.length>0)return M}catch{}return v};}function nn(e){let{poppedOutTabIds:t,registerPopoutTarget:n,findTabById:a,dockTab:o}=e,c=ge.useRef({});ge.useEffect(()=>{let u=c.current;t.forEach(i=>{if(u[i]){try{u[i].focus();}catch{}return}tn();let f=a(i)?.metadata?.title||`Tab ${i}`,s=window.open("",`zeugma-popout-${i}`,"width=800,height=600");if(!s){console.warn("Failed to open popout window. Check popup blocker."),o(i);return}u[i]=s,ae.add(s.document),De.forEach(l=>{try{l.target==="window"?s.addEventListener(l.type,l.listener,l.options):s.document.addEventListener(l.type,l.listener,l.options);}catch{}}),Xn(),Yn(),s.document.title=f,s.document.head.innerHTML="";try{let l=s.document.createElement("base");l.setAttribute("href",window.location.origin+"/"),s.document.head.appendChild(l);}catch{}if(Array.from(document.querySelectorAll('style, link[rel="stylesheet"]')).forEach(l=>{let v=l.cloneNode(true);if(l.tagName.toLowerCase()==="link"){let R=l.href;R&&v.setAttribute("href",R);}else if(l.tagName.toLowerCase()==="style")try{let R=l.sheet?.cssRules;if(R&&R.length>0){let M=Array.from(R).map(q=>q.cssText).join(`
|
|
10
|
+
`);v.textContent=M;}}catch{}s.document.head.appendChild(v);}),typeof document.adoptedStyleSheets<"u"&&typeof s.document.adoptedStyleSheets<"u")try{let l=Array.from(document.adoptedStyleSheets).map(v=>{try{let R=new s.CSSStyleSheet,M=Array.from(v.cssRules).map(q=>q.cssText).join(`
|
|
11
|
+
`);return R.replaceSync(M),R}catch{return null}}).filter(v=>v!==null);s.document.adoptedStyleSheets=l;}catch(l){console.warn("Failed to copy adoptedStyleSheets:",l);}s.document.documentElement.className=document.documentElement.className,s.document.body.className=document.body.className,Array.from(document.documentElement.attributes).forEach(l=>{s.document.documentElement.setAttribute(l.name,l.value);}),s.document.body.style.margin="0",s.document.body.style.padding="0",s.document.body.style.height="100vh",s.document.body.style.overflow="hidden";let b=document.getElementById(`zeugma-tab-target-${i}`),g="";b&&(g=window.getComputedStyle(b).backgroundColor,(!g||g==="transparent"||g==="rgba(0, 0, 0, 0)")&&b.parentElement&&(g=window.getComputedStyle(b.parentElement).backgroundColor));let m=window.getComputedStyle(document.documentElement),y=window.getComputedStyle(document.body),T=y.backgroundColor,L=!T||T==="transparent"||T==="rgba(0, 0, 0, 0)"?m.backgroundColor:T,h=g&&g!=="transparent"&&g!=="rgba(0, 0, 0, 0)"?g:L&&L!=="transparent"&&L!=="rgba(0, 0, 0, 0)"?L:"#181b1f";document.documentElement.getAttribute("data-theme")||(s.document.documentElement.style.backgroundColor=h,s.document.body.style.backgroundColor=h),s.document.body.style.color=y.color||m.color,s.document.body.style.fontFamily=y.fontFamily||m.fontFamily;let D=s.document.createElement("div");D.id=`zeugma-popout-container-${i}`,D.className="grafana-panel h-full w-full overflow-hidden",D.style.width="100%",D.style.height="100%",D.style.border="none",s.document.body.appendChild(D),n?.(i,D);let O=["pointerdown","mousedown","click","keydown","focus","touchstart"],Z=l=>{Ee=l,globalThis.__zeugmaActivePopoutDocument=s.document,setTimeout(()=>{Ee===l&&(Ee=null,globalThis.__zeugmaActivePopoutDocument=null);},0);};O.forEach(l=>{s.addEventListener(l,Z,true);});let r=()=>{ae.delete(s.document),ae.size===0&&(ft(),mt()),o(i);};s.addEventListener("beforeunload",r),s.__zeugmaCleanup=()=>{O.forEach(l=>{s.removeEventListener(l,Z,true);}),s.removeEventListener("beforeunload",r);};}),Object.keys(u).forEach(i=>{if(!t.includes(i)){let d=u[i];if(delete u[i],n?.(i,null),d){ae.delete(d.document),ae.size===0&&(ft(),mt());try{let f=d;f.__zeugmaCleanup&&f.__zeugmaCleanup(),en(()=>{try{f.close();}catch{}});}catch{}}}});},[t,n,a,o]),ge.useEffect(()=>()=>{let u=c.current;Object.keys(u).forEach(i=>{let d=u[i];if(d){ae.delete(d.document);try{let f=d;f.__zeugmaCleanup&&f.__zeugmaCleanup(),en(()=>{try{f.close();}catch{}});}catch{}}}),ae.size===0&&(ft(),mt());},[]);}typeof window<"u"&&tn();var on=({activeId:e,render:t,className:n})=>{let a=ge.useRef(null);return ge.useEffect(()=>{let o=c=>{a.current&&(a.current.style.transform=`translate(${c.clientX+12}px, ${c.clientY+12}px)`);};return document.addEventListener("pointermove",o),()=>document.removeEventListener("pointermove",o)},[]),jsxRuntime.jsx("div",{ref:a,className:n,style:{position:"fixed",top:0,left:0,zIndex:9999,pointerEvents:"none"},children:t(e)})};var no=({popoutDoc:e,children:t})=>{if(e===document)return jsxRuntime.jsx(jsxRuntime.Fragment,{children:t});let n=ge__default.default.useEffect,a=ge__default.default.useLayoutEffect,o=ge__default.default.useInsertionEffect;ge__default.default.useEffect=(c,u)=>n(()=>{window.__zeugmaActivePopoutDocument=e;try{let i=c();return typeof i=="function"?()=>{window.__zeugmaActivePopoutDocument=e;try{return i()}finally{window.__zeugmaActivePopoutDocument=null;}}:i}finally{window.__zeugmaActivePopoutDocument=null;}},u),ge__default.default.useLayoutEffect=(c,u)=>a(()=>{window.__zeugmaActivePopoutDocument=e;try{let i=c();return typeof i=="function"?()=>{window.__zeugmaActivePopoutDocument=e;try{return i()}finally{window.__zeugmaActivePopoutDocument=null;}}:i}finally{window.__zeugmaActivePopoutDocument=null;}},u),o&&(ge__default.default.useInsertionEffect=(c,u)=>o(()=>{window.__zeugmaActivePopoutDocument=e;try{let i=c();return typeof i=="function"?()=>{window.__zeugmaActivePopoutDocument=e;try{return i()}finally{window.__zeugmaActivePopoutDocument=null;}}:i}finally{window.__zeugmaActivePopoutDocument=null;}},u)),window.__zeugmaActivePopoutDocument=e;try{return jsxRuntime.jsx(jsxRuntime.Fragment,{children:t})}finally{window.__zeugmaActivePopoutDocument=null,ge__default.default.useEffect=n,ge__default.default.useLayoutEffect=a,o&&(ge__default.default.useInsertionEffect=o);}},an=ge__default.default.memo(({tabDetails:e,target:t,renderWidget:n})=>{let{id:a}=e,{renderPopoutWrapper:o}=re(),[c,u]=ge.useState(false),i=ge.useRef(null);if(ge.useEffect(()=>{u(true);},[]),ge.useEffect(()=>{if(!c||!i.current)return;let m=i.current;if(t)t.ownerDocument.adoptNode(m),t.appendChild(m);else {let y=document.getElementById("zeugma-hidden-portal-container");y||(y=document.createElement("div"),y.id="zeugma-hidden-portal-container",y.style.display="none",document.body.appendChild(y)),document.adoptNode(m),y.appendChild(m);}},[t,c]),ge.useEffect(()=>()=>{i.current&&i.current.remove();},[]),!c)return null;let d=t?t.ownerDocument:document;i.current&&i.current.ownerDocument!==d&&(i.current.remove(),i.current=null),i.current||(i.current=d.createElement("div"),i.current.className=`zeugma-portal-wrapper-${a}`,i.current.style.width="100%",i.current.style.height="100%");let f=i.current;if(!f||!n)return null;let s=!!(t&&t.ownerDocument&&t.ownerDocument!==document),b=e.remountOnPopout?s?"-popped":"-docked":"",g=jsxRuntime.jsx(ge__default.default.Fragment,{children:n(e)},`${a}${b}`);return s&&t&&t.ownerDocument&&o&&(g=o({tabId:a,document:t.ownerDocument,window:t.ownerDocument.defaultView||window,children:g})),reactDom.createPortal(jsxRuntime.jsx(no,{popoutDoc:s&&t?t.ownerDocument:document,children:g}),f)},(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 sn=({activeId:e,activeType:t,dismissIntentId:n,renderDragOverlay:a,renderPaneRef:o,renderPane:c,tabHeadersRef:u,classNames:i})=>{if(a)return jsxRuntime.jsx(jsxRuntime.Fragment,{children:a({type:t,id:e,isDismissing:e===n})});if(t==="pane"){let d=o.current||c;if(d)return jsxRuntime.jsx("div",{className:i.paneDragPreview||"",style:{pointerEvents:"none",width:"420px",height:"260px",overflow:"hidden"},children:d(e)})}else if(t==="tab"){let d=o.current||c;if(d)return jsxRuntime.jsx("div",{className:i.tabDragPreview||"",style:{pointerEvents:"none",width:"420px",height:"260px",overflow:"hidden"},children:d(e)});let f=u.current[e];if(f){let s=i.tab?typeof i.tab=="function"?i.tab(e):i.tab:"";return jsxRuntime.jsx("div",{className:`${i.tabDragPreview||""} ${s}`.trim(),style:{display:"inline-flex",position:"relative",pointerEvents:"none",overflow:"hidden"},children:f({isDragging:true,isOver:false})})}}return jsxRuntime.jsx("div",{style:{pointerEvents:"none",overflow:"hidden",width:"100%",height:"100%"}})};function bt({containerRef:e,isRow:t,direction:n,splitPercentage:a,resizerSize:o,snapThreshold:c,layout:u,currentNode:i,onLayoutChange:d,onResizeStart:f,onResizeEnd:s,parentLeft:b,parentTop:g,parentWidth:m,parentHeight:y}){let{onResizeStart:T,onResize:x,onResizeEnd:L,minSplitPercentage:h=5,maxSplitPercentage:H=95,locked:D=false}=re();return ge.useCallback(O=>{if(D)return;O.preventDefault();let Z=e.current;if(!Z)return;f&&f(),T&&T(i);let r=Z.getBoundingClientRect(),l=O.clientX,v=O.clientY,R=a,M=O.currentTarget,q=r.left+r.width*(b/100),ne=r.top+r.height*(g/100),J=r.width*(m/100),A=r.height*(y/100),W=Array.from(document.querySelectorAll('div[role="separator"][data-direction]')).filter(B=>B!==M&&B.getAttribute("data-direction")===n).map(B=>{let N=B.getBoundingClientRect();return t?N.left+N.width/2:N.top+N.height/2}),F=R;Nt({cursor:t?"col-resize":"row-resize",resizerEl:M,onMove:B=>{let N=t?(B.clientX-l)/J*100:(B.clientY-v)/A*100,P=R+N,z=t?q+(J-o)*(P/100)+o/2:ne+(A-o)*(P/100)+o/2,C=1/0,k=null;for(let Y of W){let ee=Math.abs(z-Y);ee<c&&ee<C&&(C=ee,k=Y);}let ue=P;k!==null&&(ue=t?(k-o/2-q)/(J-o)*100:(k-o/2-ne)/(A-o)*100);let Q=Math.max(h,Math.min(H,ue));F=Q;let K=xe(u,i,Q);if(K){let{panes:Y,splitters:ee}=ve(K),S=e.current;if(S){for(let I of Y)S.style.setProperty(`--pane-left-${I.paneId}`,`${I.left}%`),S.style.setProperty(`--pane-top-${I.paneId}`,`${I.top}%`),S.style.setProperty(`--pane-width-${I.paneId}`,`${I.width}%`),S.style.setProperty(`--pane-height-${I.paneId}`,`${I.height}%`);for(let I of ee)S.style.setProperty(`--splitter-pos-${I.id}`,`${I.direction==="row"?I.left:I.top}%`);}}x&&x(i,Q);},onEnd:()=>{let B=xe(u,i,F),N=e.current;if(N){let{panes:P,splitters:z}=ve(B);for(let C of P)N.style.removeProperty(`--pane-left-${C.paneId}`),N.style.removeProperty(`--pane-top-${C.paneId}`),N.style.removeProperty(`--pane-width-${C.paneId}`),N.style.removeProperty(`--pane-height-${C.paneId}`);for(let C of z)N.style.removeProperty(`--splitter-pos-${C.id}`);}d(B),s&&s(),L&&L(i,F);}});},[e,t,n,a,o,c,u,i,d,f,s,T,x,L,h,H,b,g,m,y])}var ln=({splitter:e,resizerSize:t,snapThreshold:n,containerRef:a})=>{let{renderingLayout:o,setLayout:c,classNames:u,locked:i}=re(),[d,f]=ge.useState(false),{currentNode:s,direction:b,left:g,top:m,width:y,height:T,parentLeft:x,parentTop:L,parentWidth:h,parentHeight:H}=e,D=b==="row",O=bt({containerRef:a,isRow:D,direction:b,splitPercentage:s.splitPercentage,resizerSize:t,snapThreshold:n,layout:o,currentNode:s,onLayoutChange:c,onResizeStart:()=>f(true),onResizeEnd:()=>f(false),parentLeft:x,parentTop:L,parentWidth:h,parentHeight:H}),Z=D?{position:"absolute",left:`calc(var(--splitter-pos-${e.id}, ${g}%) - ${t/2}px)`,top:`calc(${m}% + ${t/2}px)`,width:`${t}px`,height:`calc(${T}% - ${t}px)`,cursor:i?"default":"col-resize",pointerEvents:i?"none":"auto",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box"}:{position:"absolute",left:`calc(${g}% + ${t/2}px)`,top:`calc(var(--splitter-pos-${e.id}, ${m}%) - ${t/2}px)`,width:`calc(${y}% - ${t}px)`,height:`${t}px`,cursor:i?"default":"row-resize",pointerEvents:i?"none":"auto",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box"};return jsxRuntime.jsx("div",{className:u.resizer||"","data-direction":b,"data-resizing":d||void 0,style:Z,onPointerDown:O,role:"separator","aria-valuenow":s.splitPercentage,"aria-valuemin":5,"aria-valuemax":95})},cn=ge__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 vt=({renderPane:e,tree:t,resizerSize:n,snapThreshold:a})=>{zt(e);let{renderingLayout:o,activeId:c,dismissIntentId:u,setContainerRef:i,fullscreenPaneId:d,snapThreshold:f,locked:s,classNames:b,resizerSize:g}=re(),m=a!==void 0?a:f??8,y=n!==void 0?n:g??4,T=t!==void 0?t:o,x=ge.useRef(null),{panes:L,splitters:h}=ge.useMemo(()=>T?ve(T):{panes:[],splitters:[]},[T]);if(!T&&t!==void 0)return null;let H=()=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[L.map(D=>{let O=d===D.paneId;return jsxRuntime.jsx("div",{style:{position:"absolute",left:O?"0%":`var(--pane-left-${D.paneId}, ${D.left}%)`,top:O?"0%":`var(--pane-top-${D.paneId}, ${D.top}%)`,width:O?"100%":`var(--pane-width-${D.paneId}, ${D.width}%)`,height:O?"100%":`var(--pane-height-${D.paneId}, ${D.height}%)`,overflow:"hidden",zIndex:O?20:1,display:d&&!O?"none":"block",padding:O?"0px":`${y/2}px`,boxSizing:"border-box"},children:jsxRuntime.jsx(cn,{paneId:D.paneId,renderPane:e})},D.paneId)}),!d&&h.map(D=>jsxRuntime.jsx(ln,{splitter:D,resizerSize:y,snapThreshold:m,containerRef:x},D.id))]});if(t===void 0){let D=c!==null&&c===u,O=r=>{i(r),x.current=r;},Z=`${b.dashboard||""} ${D&&b.dashboardDismissActive||""} ${s&&b.dashboardLocked||""}`.trim();return jsxRuntime.jsxs("div",{ref:O,className:Z,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:[H(),c!==null&&!s&&jsxRuntime.jsx(pn,{activeClassName:b.rootDropPreview??b.dropPreview})]})}return jsxRuntime.jsx("div",{ref:x,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:H()})};var fo=e=>{let{controller:t,children:n,renderDragOverlay:a,classNames:o={},renderPane:c,resizerSize:u,dragActivationDistance:i=8,snapThreshold:d=8,minSplitPercentage:f=5,maxSplitPercentage:s=95,enableDragToDismiss:b=false,dismissThreshold:g=60,onRemove:m,onDragStart:y,onDragEnd:T,onResizeStart:x,onResize:L,onResizeEnd:h,onDismissIntentChange:H,persist:D=false,renderPopoutWrapper:O}=e,Z=t,{layout:r,setLayout:l,_internalSetLayout:v,renderingLayout:R,fullscreenPaneId:M,setFullscreenPaneId:q,locked:ne,setLocked:J,findPaneById:A,findPaneContainingTab:$,findTabById:W,getTabMetadata:F,getActiveTabMetadata:B,activeId:N,setActiveId:P,activeType:z,setActiveType:C,dismissIntentId:k,setDismissIntentId:ue,containerRef:Q,setContainerRef:K,removePane:Y,addTab:ee,updateMetadata:S,updatePaneLock:I,selectTab:ie,mergeTab:se,removeTab:G,splitPane:oe,updateSplitPercentage:Oe,moveTab:p,poppedOutTabIds:w=[],popoutTab:E,dockTab:_}=Z;Gt({persist:D,layout:r,setLayout:l});let{portalTargets:V,registerPortalTarget:le,registerPopoutTarget:j,registerRenderCallback:Te,renderCallbacksRef:Ve,registerRenderPane:wt,renderPaneRef:st,registerTabHeader:Rt,tabHeadersRef:lt,activeIdRef:We}=kt();nn({poppedOutTabIds:w,registerPopoutTarget:j,findTabById:W,dockTab:_});let xt=ge.useCallback(de=>w.includes(de),[w]),{overTabId:Dt,setOverTabId:xn,overTabPosition:Et,setOverTabPosition:Dn,handleDragStartInternal:En,handleDragEndInternal:Cn}=At({onDragStart:y,onDragEnd:T}),Sn=Yt({layout:r,_internalSetLayout:v,setLayout:l,activeId:N,setActiveId:P,activeType:z,setActiveType:C,dismissIntentId:k,setDismissIntentId:ue,setOverTabId:xn,setOverTabPosition:Dn,containerRef:Q,dragActivationDistance:i,enableDragToDismiss:b,dismissThreshold:g,onRemove:m,onDragStart:En,onDragEnd:Cn,onDismissIntentChange:H,removeTab:G,removePane:Y}),ct=ge.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=ge.useCallback((de,je)=>{h&&h(de,je);},[h]),Nn=ge.useMemo(()=>({layout:r,renderingLayout:R,setLayout:l,activeId:N,activeType:z,dismissIntentId:k,setContainerRef:K,fullscreenPaneId:M,classNames:ct,onRemove:m,onFullscreenChange:q,snapThreshold:d,onResizeStart:x,onResize:L,onResizeEnd:Ct,minSplitPercentage:f,maxSplitPercentage:s,locked:ne,setLocked:J,findPaneById:A,findPaneContainingTab:$,findTabById:W,getTabMetadata:F,getActiveTabMetadata:B,renderPane:c,resizerSize:u,poppedOutTabIds:w,isTabPoppedOut:xt,renderPopoutWrapper:O}),[r,R,N,z,k,K,M,ct,m,q,d,x,L,f,s,l,Ct,ne,J,A,$,W,F,B,c,u,w,xt,O]),In=ge.useMemo(()=>({overTabId:Dt,overTabPosition:Et}),[Dt,Et]),Ln=ge.useMemo(()=>({removePane:Y,addTab:ee,updateMetadata:S,updatePaneLock:I,selectTab:ie,mergeTab:se,removeTab:G,setFullscreenPaneId:q,setLocked:J,splitPane:oe,updateSplitPercentage:Oe,moveTab:p,popoutTab:E,dockTab:_}),[Y,ee,S,I,ie,se,G,q,J,oe,Oe,p,E,_]),Mn=Ot(r),kn=ge.useMemo(()=>({registerPortalTarget:le,registerRenderCallback:Te,renderCallbacksRef:Ve,registerRenderPane:wt,renderPaneRef:st,registerTabHeader:Rt,tabHeadersRef:lt,activeIdRef:We,registerPopoutTarget:j}),[le,Te,Ve,wt,st,Rt,lt,We,j]);return We&&(We.current=N),jsxRuntime.jsx(we.Provider,{value:Ln,children:jsxRuntime.jsx(dt.Provider,{value:Nn,children:jsxRuntime.jsx(pt.Provider,{value:In,children:jsxRuntime.jsxs(Pe.Provider,{value:kn,children:[jsxRuntime.jsx(core.DndContext,{id:"zeugma-dnd-context",...Sn,children:n}),N&&z&&jsxRuntime.jsx(on,{activeId:N,render:de=>jsxRuntime.jsx("div",{style:{transition:"transform 150ms cubic-bezier(0.2, 0, 0, 1)",transform:de===k?"scale(0.8)":"scale(1)",transformOrigin:"top left"},children:jsxRuntime.jsx(sn,{activeId:de,activeType:z,dismissIntentId:k,renderDragOverlay:a,renderPaneRef:st,renderPane:c,tabHeadersRef:lt,classNames:ct})}),className:`${o.dragOverlay||""} ${N===k&&o.dismissPreview||""}`.trim()}),jsxRuntime.jsx("div",{id:"zeugma-portal-host",style:{display:"none"},children:Mn.map(de=>{let je=V[de],St=W(de);return St?jsxRuntime.jsx(an,{tabDetails:St,target:je||null,renderWidget:Ve.current[de]},de):null})})]})})})})},mo=({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(vt,{renderPane:e,resizerSize:t,snapThreshold:n})},go=e=>{let{children:t,...n}=e,{controller:a}=e;if(!a)throw new Error("Zeugma component requires a controller.");return jsxRuntime.jsx(fo,{...e,children:t!==void 0?t:jsxRuntime.jsx(mo,{...n})})};var ho={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"}}},yo={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"}}},To=({id:e,fraction:t,edge:n,activeClassName:a})=>{let{setNodeRef:o,isOver:c}=core.useDroppable({id:e}),u={position:"absolute",pointerEvents:"none",zIndex:101,boxSizing:"border-box",...yo[n][t]};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:o,style:ho[n][t]}),c&&jsxRuntime.jsx("div",{className:a,style:u})]})},pn=({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(To,{id:n.id,fraction:n.fraction,edge:n.edge,activeClassName:e},n.id))});var ot=ge.createContext(null);var Do={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"},center:{position:"absolute",top:"25%",left:"25%",width:"50%",height:"50%",zIndex:22,pointerEvents:"auto"}},Eo={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"},center:{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:a,isOver:o}=core.useDroppable({id:e});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:a,style:Do[t]}),o&&jsxRuntime.jsx("div",{className:n,style:Eo[t]})]})};var gn=({children:e,className:t,style:n})=>{let a=ge.useContext(ot);if(!a)throw new Error("<DragHandle> must be used inside a <Pane>");let{disabled:o,...c}=a;return jsxRuntime.jsx("div",{className:t,style:{cursor:o?"default":"grab",userSelect:o?"auto":"none",touchAction:o?"auto":"none",...n},...o?{}:c,children:e})};var zo=ge.createContext(void 0);var Fe=({id:e,locked:t=false,children:n,className:a,style:o})=>{let{locked:c,classNames:u={},fullscreenPaneId:i,poppedOutTabIds:d=[]}=re(),f=ge.useContext(we),{overTabId:s}=Ue(),b=ge.useContext(Pe);ge.useEffect(()=>(b?.registerTabHeader&&b.registerTabHeader(e,n),()=>{b?.registerTabHeader&&b.activeIdRef?.current!==e&&b.registerTabHeader(e,()=>null);}),[e,n,b]);let g=d.includes(e),m=ge.useContext(yt),y=t||c||(m?.locked??false)||i!==null,{attributes:T,listeners:x,setNodeRef:L,isDragging:h}=core.useDraggable({id:`tab-header-${e}`,disabled:y}),{setNodeRef:H,isOver:D}=core.useDroppable({id:`tab-drop-${e}`,disabled:y}),O=W=>{L(W),H(W);},Z=D&&s===e,r=m?.tabIds||[],l=r.indexOf(e),v=m?.activeTabId,M=l>0&&e!==v&&r[l-1]!==v?jsxRuntime.jsx("div",{className:u.tabSeparator}):null,q=m?m.activeTabId===e:false,ne=m?.tabsMetadata?.[e],J=ge.useCallback(()=>{m?.selectTab(e);},[m,e]),A=ge.useCallback(()=>{m?.removeTab(e);},[m,e]),$=ge.useMemo(()=>({tabId:e,isActive:q,isDragging:h,isOver:Z,metadata:ne,locked:y,selectTab:J,removeTab:A,isPoppedOut:g,popoutTab:()=>f?.popoutTab(e),dockTab:()=>f?.dockTab(e)}),[e,q,h,Z,ne,y,J,A,g,f]);return jsxRuntime.jsx(zo.Provider,{value:$,children:jsxRuntime.jsxs("div",{ref:O,id:`tab-header-${e}`,className:a,style:{display:"inline-flex",position:"relative",cursor:y?"default":"grab",...o},...y?{}:x,...y?{}:T,children:[M,n({isDragging:h,isOver:Z})]})})};var yt=ge.createContext(void 0);var yn=(e,t)=>typeof e=="function"?e(t):e,Tt=({tabIds:e,activeTabId:t,locked:n,tabsMetadata:a,selectTab:o,removeTab:c,renderTab:u,classNames:i,styles:d})=>{let f=ge.useContext(at),s=e??f?.tabIds??[],b=t??f?.activeTabId??"",g=n??f?.locked??false,m=a??f?.tabsMetadata,y=o??f?.selectTab??(()=>{}),T=c??f?.removeTab??(()=>{}),{classNames:x={},activeType:L,poppedOutTabIds:h=[]}=re(),H=ge.useContext(we),{overTabId:D,overTabPosition:O}=Ue(),Z=ge.useMemo(()=>({tabIds:s,activeTabId:b,locked:g,tabsMetadata:m,selectTab:y,removeTab:T}),[s,b,g,m,y,T]),r=Wt(s,L,D,O);return jsxRuntime.jsx(yt.Provider,{value:Z,children:jsxRuntime.jsxs("div",{className:i?.container,style:{display:"flex",alignItems:"center",height:"100%",...d?.container},children:[s.map((l,v)=>{let R=m?.[l],M=yn(i?.tab,l),q=yn(d?.tab,l),ne=v===r;return jsxRuntime.jsxs(ge__default.default.Fragment,{children:[ne&&x.tabDropPreview&&jsxRuntime.jsx("div",{style:{position:"relative",height:"100%",width:0,zIndex:10},children:jsxRuntime.jsx("div",{className:x.tabDropPreview,style:{position:"absolute",top:0,bottom:0,transform:v===0?"none":"translateX(-50%)"}})}),jsxRuntime.jsx(Fe,{id:l,locked:g,className:M,style:q,children:({isDragging:J,isOver:A})=>u({id:l,paneId:f?.id??"",isActive:l===b,index:v,isDragging:J,isOver:A,metadata:R,onSelect:()=>y(l),onRemove:()=>T(l),isPoppedOut:h.includes(l),popout:()=>H?.popoutTab(l),dock:()=>H?.dockTab(l)})})]},l)}),r===s.length&&x.tabDropPreview&&jsxRuntime.jsx("div",{style:{position:"relative",height:"100%",width:0,zIndex:10},children:jsxRuntime.jsx("div",{className:x.tabDropPreview,style:{position:"absolute",top:0,bottom:0,transform:"translateX(-100%)"}})})]})})};Tt.Tab=Fe;var Pn=({className:e,style:t,children:n})=>jsxRuntime.jsx("div",{className:e,style:t,children:n});var at=ge.createContext(void 0),Rn=()=>{let e=ge.useContext(at);if(!e)throw new Error("usePaneContext must be used within a Pane component");return e},qo=({children:e,className:t,style:n})=>{let{activeTabId:a}=Rn(),{classNames:o,isTabPoppedOut:c}=re(),{dockTab:u}=ze(),i=ge.useRef(null),d=ge.useContext(Pe);if(!d)throw new Error("PaneContent must be used within a Zeugma provider");let{registerPortalTarget:f,registerRenderCallback:s}=d,b=ge.useMemo(()=>typeof e=="function"?e:()=>e,[e]);s(a,b),ge.useEffect(()=>{let m=i.current;return f(a,m),()=>{f(a,null,m);}},[a,f]);let g=c(a);return jsxRuntime.jsx("div",{ref:i,id:`zeugma-tab-target-${a}`,className:`${o.tabContentWrapper||""} ${t||""}`.trim(),style:{height:"100%",width:"100%",position:"relative",...n},children:g&&jsxRuntime.jsxs("div",{className:"zeugma-popout-placeholder",style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"12px",padding:"24px",textAlign:"center",backgroundColor:"#161719",color:"#94a3b8",fontSize:"13px",fontWeight:500},children:[jsxRuntime.jsx("div",{children:"This panel is open in a new window"}),jsxRuntime.jsx("button",{onClick:()=>u(a),style:{padding:"6px 12px",fontSize:"11px",fontWeight:600,borderRadius:"4px",backgroundColor:"#2563eb",color:"#ffffff",border:"none",cursor:"pointer",boxShadow:"0 1px 3px rgba(0,0,0,0.1)"},onMouseOver:m=>{m.currentTarget.style.backgroundColor="#1d4ed8";},onMouseOut:m=>{m.currentTarget.style.backgroundColor="#2563eb";},children:"Dock Back"})]})})},ke=({id:e,children:t,style:n,locked:a=false})=>{let{layout:o,renderingLayout:c,activeId:u,activeType:i,classNames:d,fullscreenPaneId:f,onFullscreenChange:s,locked:b,poppedOutTabIds:g=[]}=re(),{removePane:m,updateMetadata:y,selectTab:T,removeTab:x,popoutTab:L,dockTab:h}=ze(),H=ge.useMemo(()=>{if(i==="tab"&&e===u){let k=U(o,e)?.tabsMetadata?.[e];return {type:"pane",id:e,tabIds:[e],activeTabId:e,tabsMetadata:k?{[e]:k}:void 0}}return Ht(e===u?o:c,e)},[o,c,e,u,i]),D=H?.id??e,O=H?.tabIds??[e],Z=H?.activeTabId??e,r=H?.tabsMetadata,l=r?.[e],v=H?.locked??false,R=a||v,M=b||R||f!==null,q=b||R||f!==null,ne=u!==null&&u!==e&&(!O.includes(u)||O.length>1)&&!q,{attributes:J,listeners:A,setNodeRef:$}=core.useDraggable({id:e,disabled:M}),W=u!==null&&O.includes(u),F=f===e,B=ge.useMemo(()=>({isDragging:W,isFullscreen:F,toggleFullscreen:()=>s?.(F?null:e),remove:()=>{F&&s?.(null),m(D);},metadata:l,updateMetadata:z=>{y(e,z);},locked:M,tabIds:O,activeTabId:Z,selectTab:z=>T(D,z),removeTab:z=>{F&&z===Z&&s?.(null),x(z);},tabsMetadata:r,updateTabMetadata:(z,C)=>{y(z,C);},isActiveTabPoppedOut:g.includes(Z),popoutTab:z=>L(z||Z),dockTab:z=>h(z||Z)}),[W,F,s,e,x,l,y,M,O,Z,T,D,r,g,L,h]),N=ge.useMemo(()=>M?{disabled:true}:{...A,...J},[A,J,M]),P=`${d.pane||""} ${R&&d.paneLocked||""}`.trim();return jsxRuntime.jsx(at.Provider,{value:{id:e,...B},children:jsxRuntime.jsx(ot.Provider,{value:N,children:jsxRuntime.jsxs("div",{ref:$,id:e,className:P,style:{position:"relative",width:"100%",height:"100%",...n},children:[t,ne&&jsxRuntime.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:15,pointerEvents:"none"},children:[["top","bottom","left","right"].map(z=>jsxRuntime.jsx(rt,{id:`drop-${z}-${e}`,position:z,activeClassName:d.dropPreview},z)),i==="tab"&&jsxRuntime.jsx(rt,{id:`drop-center-${e}`,position:"center",activeClassName:d.swapPreview??d.dropPreview})]}),u!==null&&u!==e&&q&&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:d.lockedPreview||""})})]})})})};ke.Content=qo;ke.DragHandle=gn;ke.Tabs=Tt;ke.Tab=Fe;ke.Controls=Pn;exports.Pane=ke;exports.PaneTree=vt;exports.Zeugma=go;exports.usePaneContext=Rn;exports.useResizer=bt;exports.useZeugma=Hn;exports.useZeugmaContext=$n;//# sourceMappingURL=index.cjs.map
|
|
11
12
|
//# sourceMappingURL=index.cjs.map
|