react-panel-layout 0.4.2 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/{FloatingPanelFrame-SOrLGjZd.js → FloatingPanelFrame-DDT6aING.js} +7 -8
  2. package/dist/FloatingPanelFrame-DDT6aING.js.map +1 -0
  3. package/dist/FloatingPanelFrame-DrYwgI9f.cjs +2 -0
  4. package/dist/FloatingPanelFrame-DrYwgI9f.cjs.map +1 -0
  5. package/dist/GridLayout-DC7fCmcI.cjs +2 -0
  6. package/dist/GridLayout-DC7fCmcI.cjs.map +1 -0
  7. package/dist/GridLayout-tpSM0iM-.js +1460 -0
  8. package/dist/GridLayout-tpSM0iM-.js.map +1 -0
  9. package/dist/components/grid/GridLayout.d.ts +5 -0
  10. package/dist/components/window/FloatingWindow.d.ts +15 -0
  11. package/dist/config/panelRouter.d.ts +2 -2
  12. package/dist/config.cjs +1 -1
  13. package/dist/config.cjs.map +1 -1
  14. package/dist/config.js +1 -1
  15. package/dist/config.js.map +1 -1
  16. package/dist/floating.cjs +1 -1
  17. package/dist/floating.js +1 -1
  18. package/dist/index.cjs +2 -2
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.ts +4 -1
  21. package/dist/index.js +892 -822
  22. package/dist/index.js.map +1 -1
  23. package/dist/modules/grid/GridLayoutContext.d.ts +5 -0
  24. package/dist/modules/grid/resizeHandles.d.ts +14 -0
  25. package/dist/modules/grid/trackUtils.d.ts +29 -0
  26. package/dist/modules/grid/useGridTracks.d.ts +6 -15
  27. package/dist/modules/grid/useLayerInteractions.d.ts +2 -1
  28. package/dist/modules/window/useFloatingState.d.ts +9 -0
  29. package/dist/types.d.ts +79 -4
  30. package/dist/utils/css.d.ts +19 -0
  31. package/package.json +1 -1
  32. package/dist/FloatingPanelFrame-SOrLGjZd.js.map +0 -1
  33. package/dist/FloatingPanelFrame-XtBcHANI.cjs +0 -2
  34. package/dist/FloatingPanelFrame-XtBcHANI.cjs.map +0 -1
  35. package/dist/GridLayout-CLvW8jID.js +0 -1352
  36. package/dist/GridLayout-CLvW8jID.js.map +0 -1
  37. package/dist/GridLayout-qufTyOQM.cjs +0 -2
  38. package/dist/GridLayout-qufTyOQM.cjs.map +0 -1
package/dist/index.js CHANGED
@@ -1,24 +1,24 @@
1
- import { u as Dt, a as At, b as kt, c as J, d as Mt, e as M, t as _t, R as ot, G as st } from "./GridLayout-CLvW8jID.js";
2
- import { D as Rr, f as Pr, r as Dr, g as Ar } from "./GridLayout-CLvW8jID.js";
1
+ import { u as kt, a as Mt, b as _t, c as J, d as Ot, e as M, t as Bt, R as ot, G as st } from "./GridLayout-tpSM0iM-.js";
2
+ import { D as kn, f as Mn, F as _n, r as On, g as Bn } from "./GridLayout-tpSM0iM-.js";
3
3
  import { jsx as m, jsxs as H, Fragment as et } from "react/jsx-runtime";
4
4
  import * as l from "react";
5
- import { t as Ot, u as Bt, v as Lt, H as Ht, y as Nt, z as $t, A as zt, B as Xt, E as Yt, I as Ft, T as jt, J as Kt, K as Vt, L as Ut, M as Wt, N as qt, O as Zt, S as Jt } from "./styles-w0ZixggV.js";
6
- import { Q as Mr } from "./styles-w0ZixggV.js";
7
- import { a as rt } from "./usePivot-z9gumDf-.js";
8
- import { createPortal as Qt } from "react-dom";
9
- const te = (t) => ({
10
- width: Ht,
5
+ import { t as Lt, u as Ht, v as Nt, H as zt, y as $t, z as Ft, A as Xt, B as Yt, E as jt, I as Kt, T as Ut, J as Vt, K as Wt, L as qt, M as Zt, N as Jt, O as Qt, S as te } from "./styles-w0ZixggV.js";
6
+ import { Q as Hn } from "./styles-w0ZixggV.js";
7
+ import { a as nt } from "./usePivot-z9gumDf-.js";
8
+ import { createPortal as ee } from "react-dom";
9
+ const ne = (t) => ({
10
+ width: zt,
11
11
  cursor: "col-resize",
12
12
  position: "relative",
13
13
  userSelect: "none",
14
- backgroundColor: t === "drag" ? Ot : t === "hover" ? Bt : Lt
15
- }), Tr = ({ onResize: t, component: e, element: r }) => {
16
- const { ref: n, isDragging: o, onPointerDown: s } = Dt({
14
+ backgroundColor: t === "drag" ? Lt : t === "hover" ? Ht : Nt
15
+ }), Gn = ({ onResize: t, component: e, element: n }) => {
16
+ const { ref: r, isDragging: o, onPointerDown: s } = kt({
17
17
  axis: "x",
18
18
  onResize: t
19
19
  }), [a, i] = l.useState(!1), c = {
20
- ref: n,
21
- style: te(o ? "drag" : a ? "hover" : "idle"),
20
+ ref: r,
21
+ style: ne(o ? "drag" : a ? "hover" : "idle"),
22
22
  role: "separator",
23
23
  "aria-orientation": "vertical",
24
24
  "data-dragging": o ? "true" : void 0,
@@ -26,78 +26,146 @@ const te = (t) => ({
26
26
  onPointerEnter: () => i(!0),
27
27
  onPointerLeave: () => i(!1)
28
28
  };
29
- return r ? l.cloneElement(r, c) : e ? /* @__PURE__ */ m(e, { ...c }) : /* @__PURE__ */ m("div", { ...c });
30
- }, xr = () => {
31
- const { layerId: t } = At(), { getLayerHandleProps: e } = kt();
29
+ return n ? l.cloneElement(n, c) : e ? /* @__PURE__ */ m(e, { ...c }) : /* @__PURE__ */ m("div", { ...c });
30
+ }, Cn = () => {
31
+ const { layerId: t } = Mt(), { getLayerHandleProps: e } = _t();
32
32
  return l.useMemo(() => e(t), [e, t]);
33
- }, dt = l.createContext(null), ee = () => {
34
- const t = l.useContext(dt);
33
+ }, it = { left: 0, top: 0 }, at = { width: 400, height: 300 }, En = (t) => {
34
+ const [e, n] = l.useState(() => {
35
+ const u = {};
36
+ return t.forEach((p) => {
37
+ if (p.floating) {
38
+ const g = p.floating;
39
+ u[p.id] = {
40
+ position: g.defaultPosition ?? it,
41
+ size: g.defaultSize ?? at
42
+ };
43
+ }
44
+ }), u;
45
+ }), r = l.useMemo(() => {
46
+ const u = /* @__PURE__ */ new Map();
47
+ return t.forEach((p) => u.set(p.id, p)), u;
48
+ }, [t]), o = l.useCallback(
49
+ (u) => {
50
+ const p = r.get(u);
51
+ return p?.floating?.position !== void 0 ? p.floating.position : e[u]?.position ?? it;
52
+ },
53
+ [r, e]
54
+ ), s = l.useCallback(
55
+ (u) => {
56
+ const p = r.get(u);
57
+ return p?.floating?.size !== void 0 ? p.floating.size : e[u]?.size ?? at;
58
+ },
59
+ [r, e]
60
+ ), a = l.useCallback(
61
+ (u) => r.get(u)?.floating?.zIndex,
62
+ [r]
63
+ ), i = l.useCallback(
64
+ (u, p) => {
65
+ const g = r.get(u);
66
+ g?.floating && (g.floating.position === void 0 && n((v) => {
67
+ const h = v[u];
68
+ return h ? {
69
+ ...v,
70
+ [u]: { ...h, position: p }
71
+ } : v;
72
+ }), g.floating.onMove?.(p));
73
+ },
74
+ [r]
75
+ ), c = l.useCallback(
76
+ (u, p) => {
77
+ const g = r.get(u);
78
+ g?.floating && (g.floating.size === void 0 && n((v) => {
79
+ const h = v[u];
80
+ return h ? {
81
+ ...v,
82
+ [u]: { ...h, size: p }
83
+ } : v;
84
+ }), g.floating.onResize?.(p));
85
+ },
86
+ [r]
87
+ ), d = l.useCallback(
88
+ (u) => {
89
+ r.get(u)?.floating?.onClose?.();
90
+ },
91
+ [r]
92
+ );
93
+ return {
94
+ getPosition: o,
95
+ getSize: s,
96
+ getZIndex: a,
97
+ updatePosition: i,
98
+ updateSize: c,
99
+ close: d
100
+ };
101
+ }, ft = l.createContext(null), re = () => {
102
+ const t = l.useContext(ft);
35
103
  if (!t)
36
104
  throw new Error("useKeybindings must be used within KeybindingsProvider");
37
105
  return t;
38
- }, re = (t) => {
106
+ }, oe = (t) => {
39
107
  const e = [];
40
108
  t.metaKey && e.push("Mod"), t.ctrlKey && e.push("Ctrl"), t.altKey && e.push("Alt"), t.shiftKey && e.push("Shift");
41
- const r = t.key.length === 1 ? t.key.toUpperCase() : t.key;
42
- return e.push(r), e.join("-");
43
- }, ne = ({ children: t, configure: e }) => {
44
- const r = l.useRef({}), n = l.useCallback((a, i) => {
45
- r.current = { ...r.current, [a]: i };
109
+ const n = t.key.length === 1 ? t.key.toUpperCase() : t.key;
110
+ return e.push(n), e.join("-");
111
+ }, se = ({ children: t, configure: e }) => {
112
+ const n = l.useRef({}), r = l.useCallback((a, i) => {
113
+ n.current = { ...n.current, [a]: i };
46
114
  }, []), o = l.useCallback((a) => {
47
- const i = { ...r.current };
48
- delete i[a], r.current = i;
115
+ const i = { ...n.current };
116
+ delete i[a], n.current = i;
49
117
  }, []);
50
118
  l.useEffect(() => {
51
119
  const a = (i) => {
52
- const c = re(i), u = r.current[c];
53
- u && u(i);
120
+ const c = oe(i), d = n.current[c];
121
+ d && d(i);
54
122
  };
55
123
  return window.addEventListener("keydown", a), () => {
56
124
  window.removeEventListener("keydown", a);
57
125
  };
58
126
  }, []);
59
- const s = l.useMemo(() => ({ register: n, unregister: o }), [n, o]);
127
+ const s = l.useMemo(() => ({ register: r, unregister: o }), [r, o]);
60
128
  return l.useEffect(() => {
61
129
  e && e(s);
62
- }, [s, e]), /* @__PURE__ */ m(dt.Provider, { value: s, children: t });
63
- }, oe = (t, e) => {
64
- t.register("Mod-\\", (r) => {
65
- r.preventDefault(), e.splitFocused("vertical");
66
- }), t.register("Mod-Shift-\\", (r) => {
67
- r.preventDefault(), e.splitFocused("horizontal");
130
+ }, [s, e]), /* @__PURE__ */ m(ft.Provider, { value: s, children: t });
131
+ }, ie = (t, e) => {
132
+ t.register("Mod-\\", (n) => {
133
+ n.preventDefault(), e.splitFocused("vertical");
134
+ }), t.register("Mod-Shift-\\", (n) => {
135
+ n.preventDefault(), e.splitFocused("horizontal");
68
136
  });
69
- for (const r of [1, 2, 3, 4, 5, 6, 7, 8, 9])
70
- t.register(`Mod-${String(r)}`, (n) => {
71
- n.preventDefault(), e.focusGroupIndex(r);
137
+ for (const n of [1, 2, 3, 4, 5, 6, 7, 8, 9])
138
+ t.register(`Mod-${String(n)}`, (r) => {
139
+ r.preventDefault(), e.focusGroupIndex(n);
72
140
  });
73
- t.register("Alt-ArrowRight", (r) => {
74
- r.preventDefault(), e.focusNextGroup();
75
- }), t.register("Alt-ArrowLeft", (r) => {
76
- r.preventDefault(), e.focusPrevGroup();
141
+ t.register("Alt-ArrowRight", (n) => {
142
+ n.preventDefault(), e.focusNextGroup();
143
+ }), t.register("Alt-ArrowLeft", (n) => {
144
+ n.preventDefault(), e.focusPrevGroup();
77
145
  });
78
- }, se = (t) => t.type === "group", pt = (t, e = { x: 0, y: 0, w: 100, h: 100 }) => {
79
- const r = /* @__PURE__ */ new Map(), n = (o, s) => {
80
- if (se(o)) {
81
- r.set(o.groupId, s);
146
+ }, ae = (t) => t.type === "group", gt = (t, e = { x: 0, y: 0, w: 100, h: 100 }) => {
147
+ const n = /* @__PURE__ */ new Map(), r = (o, s) => {
148
+ if (ae(o)) {
149
+ n.set(o.groupId, s);
82
150
  return;
83
151
  }
84
152
  if (o.direction === "vertical") {
85
- const c = s.w * o.ratio, u = s.w - c;
86
- n(o.a, { x: s.x, y: s.y, w: c, h: s.h }), n(o.b, { x: s.x + c, y: s.y, w: u, h: s.h });
153
+ const c = s.w * o.ratio, d = s.w - c;
154
+ r(o.a, { x: s.x, y: s.y, w: c, h: s.h }), r(o.b, { x: s.x + c, y: s.y, w: d, h: s.h });
87
155
  return;
88
156
  }
89
157
  const a = s.h * o.ratio, i = s.h - a;
90
- n(o.a, { x: s.x, y: s.y, w: s.w, h: a }), n(o.b, { x: s.x, y: s.y + a, w: s.w, h: i });
158
+ r(o.a, { x: s.x, y: s.y, w: s.w, h: a }), r(o.b, { x: s.x, y: s.y + a, w: s.w, h: i });
91
159
  };
92
- return n(t, e), r;
93
- }, ie = (t, e) => {
94
- const r = pt(t.tree), n = {
160
+ return r(t, e), n;
161
+ }, ce = (t, e) => {
162
+ const n = gt(t.tree), r = {
95
163
  areas: [["root"]],
96
164
  rows: [{ size: "1fr" }],
97
165
  columns: [{ size: "1fr" }],
98
166
  gap: "0px",
99
167
  style: { position: "relative" }
100
- }, o = Array.from(r.entries()).map(([s, a]) => {
168
+ }, o = Array.from(n.entries()).map(([s, a]) => {
101
169
  const i = {
102
170
  position: "absolute",
103
171
  left: `${a.x}%`,
@@ -115,167 +183,167 @@ const te = (t) => ({
115
183
  component: e(s)
116
184
  };
117
185
  });
118
- return { config: n, layers: o };
119
- }, ae = (t, e, r) => {
120
- const n = pt(t.tree), o = Array.from(new Set(Array.from(n.values()).flatMap((h) => [h.x, h.x + h.w]))).sort((h, w) => h - w), s = Array.from(new Set(Array.from(n.values()).flatMap((h) => [h.y, h.y + h.h]))).sort((h, w) => h - w), a = o.slice(1).map((h, w) => `${h - o[w]}fr`), i = s.slice(1).map((h, w) => `${h - s[w]}fr`), c = a.map((h) => ({ size: h, resizable: r })), u = i.map((h) => ({ size: h, resizable: r })), d = (h, w, I, T) => {
121
- for (const [b, v] of n.entries())
122
- if (h >= v.x && w <= v.x + v.w && I >= v.y && T <= v.y + v.h)
186
+ return { config: r, layers: o };
187
+ }, ue = (t, e, n) => {
188
+ const r = gt(t.tree), o = Array.from(new Set(Array.from(r.values()).flatMap((h) => [h.x, h.x + h.w]))).sort((h, y) => h - y), s = Array.from(new Set(Array.from(r.values()).flatMap((h) => [h.y, h.y + h.h]))).sort((h, y) => h - y), a = o.slice(1).map((h, y) => `${h - o[y]}fr`), i = s.slice(1).map((h, y) => `${h - s[y]}fr`), c = a.map((h) => ({ size: h, resizable: n })), d = i.map((h) => ({ size: h, resizable: n })), u = (h, y, w, T) => {
189
+ for (const [b, I] of r.entries())
190
+ if (h >= I.x && y <= I.x + I.w && w >= I.y && T <= I.y + I.h)
123
191
  return b;
124
192
  return ".";
125
- }, f = [];
193
+ }, p = [];
126
194
  for (let h = 0; h < s.length - 1; h += 1) {
127
- const w = [];
128
- for (let I = 0; I < o.length - 1; I += 1)
129
- w.push(d(o[I], o[I + 1], s[h], s[h + 1]));
130
- f.push(w);
195
+ const y = [];
196
+ for (let w = 0; w < o.length - 1; w += 1)
197
+ y.push(u(o[w], o[w + 1], s[h], s[h + 1]));
198
+ p.push(y);
131
199
  }
132
200
  const g = {
133
- areas: f,
134
- rows: u,
201
+ areas: p,
202
+ rows: d,
135
203
  columns: c,
136
204
  gap: "0px"
137
- }, y = Array.from(n.keys()).map((h) => ({
205
+ }, v = Array.from(r.keys()).map((h) => ({
138
206
  id: h,
139
207
  gridArea: h,
140
208
  component: e(h)
141
209
  }));
142
- return { config: g, layers: y };
143
- }, ft = l.createContext(null), ce = () => {
144
- const t = l.useContext(ft);
210
+ return { config: g, layers: v };
211
+ }, bt = l.createContext(null), le = () => {
212
+ const t = l.useContext(bt);
145
213
  if (!t)
146
214
  throw new Error("usePanelRenderContext must be used within PanelRenderProvider");
147
215
  return t;
148
- }, ue = ({ value: t, children: e }) => /* @__PURE__ */ m(ft.Provider, { value: t, children: e }), bt = l.createContext(null), gt = () => {
149
- const t = l.useContext(bt);
216
+ }, de = ({ value: t, children: e }) => /* @__PURE__ */ m(bt.Provider, { value: t, children: e }), ht = l.createContext(null), mt = () => {
217
+ const t = l.useContext(ht);
150
218
  if (!t)
151
219
  throw new Error("useDomRegistry must be used within DomRegistryProvider");
152
220
  return t;
153
- }, le = ({ children: t }) => {
154
- const e = l.useRef(/* @__PURE__ */ new Map()), r = l.useCallback((c) => {
155
- const u = e.current.get(c);
156
- if (u)
157
- return u;
158
- const d = { group: null, tabbar: null, content: null };
159
- return e.current.set(c, d), d;
160
- }, []), n = l.useCallback(
161
- (c, u) => {
162
- const d = r(c);
163
- if (d.group = u, u === null) {
164
- const f = e.current.get(c);
165
- (f ? f.tabbar === null && f.content === null : !1) && e.current.delete(c);
221
+ }, pe = ({ children: t }) => {
222
+ const e = l.useRef(/* @__PURE__ */ new Map()), n = l.useCallback((c) => {
223
+ const d = e.current.get(c);
224
+ if (d)
225
+ return d;
226
+ const u = { group: null, tabbar: null, content: null };
227
+ return e.current.set(c, u), u;
228
+ }, []), r = l.useCallback(
229
+ (c, d) => {
230
+ const u = n(c);
231
+ if (u.group = d, d === null) {
232
+ const p = e.current.get(c);
233
+ (p ? p.tabbar === null && p.content === null : !1) && e.current.delete(c);
166
234
  }
167
235
  },
168
- [r]
236
+ [n]
169
237
  ), o = l.useCallback(
170
- (c, u) => {
171
- const d = r(c);
172
- if (d.tabbar = u, u === null) {
173
- const f = e.current.get(c);
174
- (f ? f.group === null && f.content === null : !1) && e.current.delete(c);
238
+ (c, d) => {
239
+ const u = n(c);
240
+ if (u.tabbar = d, d === null) {
241
+ const p = e.current.get(c);
242
+ (p ? p.group === null && p.content === null : !1) && e.current.delete(c);
175
243
  }
176
244
  },
177
- [r]
245
+ [n]
178
246
  ), s = l.useCallback(
179
- (c, u) => {
180
- const d = r(c);
181
- if (d.content = u, u === null) {
182
- const f = e.current.get(c);
183
- (f ? f.group === null && f.tabbar === null : !1) && e.current.delete(c);
247
+ (c, d) => {
248
+ const u = n(c);
249
+ if (u.content = d, d === null) {
250
+ const p = e.current.get(c);
251
+ (p ? p.group === null && p.tabbar === null : !1) && e.current.delete(c);
184
252
  }
185
253
  },
186
- [r]
187
- ), a = l.useCallback(() => e.current, []), i = l.useMemo(() => ({ setGroupEl: n, setTabbarEl: o, setContentEl: s, getAll: a }), [n, o, s, a]);
188
- return /* @__PURE__ */ m(bt.Provider, { value: i, children: t });
189
- }, de = {
254
+ [n]
255
+ ), a = l.useCallback(() => e.current, []), i = l.useMemo(() => ({ setGroupEl: r, setTabbarEl: o, setContentEl: s, getAll: a }), [r, o, s, a]);
256
+ return /* @__PURE__ */ m(ht.Provider, { value: i, children: t });
257
+ }, fe = {
190
258
  display: "flex",
191
259
  flexDirection: "column",
192
260
  width: "100%",
193
261
  height: "100%"
194
- }, pe = {
262
+ }, ge = {
195
263
  flex: "1 1 auto",
196
264
  minWidth: 0,
197
265
  minHeight: 0,
198
266
  position: "relative",
199
267
  overflow: "hidden"
200
268
  };
201
- function fe(t, e, r, n) {
202
- return t ? l.cloneElement(t, r, n) : e ? /* @__PURE__ */ m(e, { ...r, children: n }) : /* @__PURE__ */ m("div", { ...r, children: n });
269
+ function be(t, e, n, r) {
270
+ return t ? l.cloneElement(t, n, r) : e ? /* @__PURE__ */ m(e, { ...n, children: r }) : /* @__PURE__ */ m("div", { ...n, children: r });
203
271
  }
204
- function be(t, e, r, n) {
205
- return t ? l.cloneElement(t, r, n) : e ? /* @__PURE__ */ m(e, { ...r, children: n }) : /* @__PURE__ */ m("div", { ...r, children: n });
272
+ function he(t, e, n, r) {
273
+ return t ? l.cloneElement(t, n, r) : e ? /* @__PURE__ */ m(e, { ...n, children: r }) : /* @__PURE__ */ m("div", { ...n, children: r });
206
274
  }
207
- const ge = ({
275
+ const me = ({
208
276
  group: t,
209
277
  tabbar: e,
210
- content: r,
211
- onContentPointerDown: n,
278
+ content: n,
279
+ onContentPointerDown: r,
212
280
  groupRef: o,
213
281
  contentRef: s,
214
282
  component: a,
215
283
  element: i,
216
284
  contentComponent: c,
217
- contentElement: u
285
+ contentElement: d
218
286
  }) => {
219
- const d = {
287
+ const u = {
220
288
  ref: o,
221
- style: de,
289
+ style: fe,
222
290
  "data-group-id": t.id
223
- }, g = fe(u, c, {
291
+ }, g = be(d, c, {
224
292
  ref: s,
225
- style: pe,
293
+ style: ge,
226
294
  "data-dnd-zone": "content",
227
- onPointerDown: n
228
- }, r);
229
- return be(i, a, d, /* @__PURE__ */ H(et, { children: [
295
+ onPointerDown: r
296
+ }, n);
297
+ return he(i, a, u, /* @__PURE__ */ H(et, { children: [
230
298
  e,
231
299
  g
232
300
  ] }));
233
- }, ht = l.memo(ge, (t, e) => t.group.id !== e.group.id || t.group.activeTabId !== e.group.activeTabId || t.group.tabs.length !== e.group.tabs.length ? !1 : t.group.tabs === e.group.tabs);
234
- ht.displayName = "PanelGroupView";
235
- const K = (t, e, r) => {
236
- const n = t.left, o = t.top, s = t.width, a = t.height, i = e - n, c = r - o, u = s / 3, d = a / 3;
237
- return i > u && i < s - u && c > d && c < a - d ? "center" : i < c && i < s - i && c < a - c ? "left" : s - i < c && s - i < i && c < a - c ? "right" : c < i && c < a - c && i < s - i ? "top" : "bottom";
301
+ }, vt = l.memo(me, (t, e) => t.group.id !== e.group.id || t.group.activeTabId !== e.group.activeTabId || t.group.tabs.length !== e.group.tabs.length ? !1 : t.group.tabs === e.group.tabs);
302
+ vt.displayName = "PanelGroupView";
303
+ const K = (t, e, n) => {
304
+ const r = t.left, o = t.top, s = t.width, a = t.height, i = e - r, c = n - o, d = s / 3, u = a / 3;
305
+ return i > d && i < s - d && c > u && c < a - u ? "center" : i < c && i < s - i && c < a - c ? "left" : s - i < c && s - i < i && c < a - c ? "right" : c < i && c < a - c && i < s - i ? "top" : "bottom";
238
306
  };
239
307
  function A(t, e) {
240
308
  if (!e) {
241
- const n = (() => ({ type: t }));
242
- return Object.defineProperty(n, "type", {
309
+ const r = (() => ({ type: t }));
310
+ return Object.defineProperty(r, "type", {
243
311
  value: t,
244
312
  writable: !1,
245
313
  enumerable: !0
246
- }), n;
314
+ }), r;
247
315
  }
248
- const r = ((...n) => {
249
- const o = e(...n);
316
+ const n = ((...r) => {
317
+ const o = e(...r);
250
318
  return typeof o > "u" ? { type: t } : { type: t, payload: o };
251
319
  });
252
- return Object.defineProperty(r, "type", {
320
+ return Object.defineProperty(n, "type", {
253
321
  value: t,
254
322
  writable: !1,
255
323
  enumerable: !0
256
- }), r;
324
+ }), n;
257
325
  }
258
- const he = (t, e) => {
259
- const r = {};
260
- return Object.keys(t).forEach((n) => {
261
- const o = t[n];
262
- r[n] = ((...s) => {
326
+ const ve = (t, e) => {
327
+ const n = {};
328
+ return Object.keys(t).forEach((r) => {
329
+ const o = t[r];
330
+ n[r] = ((...s) => {
263
331
  const a = o(...s);
264
332
  return e(a), a;
265
333
  });
266
- }), r;
267
- }, mt = (t, e) => {
268
- const r = {};
269
- return Object.keys(e).forEach((n) => {
270
- const o = e[n];
334
+ }), n;
335
+ }, It = (t, e) => {
336
+ const n = {};
337
+ return Object.keys(e).forEach((r) => {
338
+ const o = e[r];
271
339
  if (!o)
272
340
  return;
273
- const s = t[n];
341
+ const s = t[r];
274
342
  if (!s)
275
- throw new Error(`Missing action creator for key "${String(n)}"`);
276
- r[s.type] = o;
277
- }), r;
278
- }, vt = { phase: { kind: "idle" }, suggest: null, pointer: null, tabbarHover: null, draggingTabElement: null }, D = {
343
+ throw new Error(`Missing action creator for key "${String(r)}"`);
344
+ n[s.type] = o;
345
+ }), n;
346
+ }, wt = { phase: { kind: "idle" }, suggest: null, pointer: null, tabbarHover: null, draggingTabElement: null }, D = {
279
347
  startContent: A(
280
348
  "START_CONTENT",
281
349
  (t) => t
@@ -291,7 +359,7 @@ const he = (t, e) => {
291
359
  (t) => t
292
360
  ),
293
361
  reset: A("RESET")
294
- }, me = mt(D, {
362
+ }, Ie = It(D, {
295
363
  startContent: (t, e) => ({
296
364
  phase: {
297
365
  kind: "content",
@@ -323,114 +391,114 @@ const he = (t, e) => {
323
391
  setSuggest: (t, e) => ({ ...t, suggest: e.payload }),
324
392
  setPointer: (t, e) => ({ ...t, pointer: e.payload }),
325
393
  setTabbarHover: (t, e) => ({ ...t, tabbarHover: e.payload }),
326
- reset: () => vt
327
- }), ve = (t, e) => {
328
- const r = me[e.type];
329
- return r ? r(t, e, void 0) : t;
330
- }, It = l.createContext(null), W = () => {
331
- const t = l.useContext(It);
394
+ reset: () => wt
395
+ }), we = (t, e) => {
396
+ const n = Ie[e.type];
397
+ return n ? n(t, e, void 0) : t;
398
+ }, yt = l.createContext(null), W = () => {
399
+ const t = l.useContext(yt);
332
400
  if (!t)
333
401
  throw new Error("usePanelInteractions must be used within InteractionsProvider");
334
402
  return t;
335
- }, Ie = ({
403
+ }, ye = ({
336
404
  containerRef: t,
337
405
  dragThresholdPx: e,
338
- onCommitContentDrop: r,
339
- onCommitTabDrop: n,
406
+ onCommitContentDrop: n,
407
+ onCommitTabDrop: r,
340
408
  isContentZoneAllowed: o,
341
409
  children: s
342
410
  }) => {
343
- const [a, i] = l.useReducer(ve, vt), c = gt(), u = l.useCallback(() => {
344
- const I = Array.from(c.getAll().entries()), T = I.map(([p, x]) => ({ gid: p, el: x.content ?? x.group })).filter((p) => !!p.el).map((p) => ({ ...p, rect: p.el.getBoundingClientRect() })), b = I.map(([p, x]) => ({ gid: p, el: x.tabbar })).filter((p) => !!p.el).map((p) => ({ ...p, rect: p.el.getBoundingClientRect() })), v = I.map(([p, x]) => ({ gid: p, el: x.content ?? x.group })).filter((p) => !!p.el).map((p) => ({ ...p, rect: p.el.getBoundingClientRect() }));
345
- return { groups: T, tabbars: b, contents: v };
346
- }, [c]), d = J((I) => {
411
+ const [a, i] = l.useReducer(we, wt), c = mt(), d = l.useCallback(() => {
412
+ const w = Array.from(c.getAll().entries()), T = w.map(([f, S]) => ({ gid: f, el: S.content ?? S.group })).filter((f) => !!f.el).map((f) => ({ ...f, rect: f.el.getBoundingClientRect() })), b = w.map(([f, S]) => ({ gid: f, el: S.tabbar })).filter((f) => !!f.el).map((f) => ({ ...f, rect: f.el.getBoundingClientRect() })), I = w.map(([f, S]) => ({ gid: f, el: S.content ?? S.group })).filter((f) => !!f.el).map((f) => ({ ...f, rect: f.el.getBoundingClientRect() }));
413
+ return { groups: T, tabbars: b, contents: I };
414
+ }, [c]), u = J((w) => {
347
415
  if (!t.current)
348
416
  return;
349
- const b = I.clientX, v = I.clientY, p = a.phase;
350
- if (p.kind === "idle")
417
+ const b = w.clientX, I = w.clientY, f = a.phase;
418
+ if (f.kind === "idle")
351
419
  return;
352
- const x = Math.abs(b - p.startX), E = Math.abs(v - p.startY);
353
- if (x < e && E < e) {
420
+ const S = Math.abs(b - f.startX), C = Math.abs(I - f.startY);
421
+ if (S < e && C < e) {
354
422
  a.phase.kind === "content" && i(D.setSuggest(null)), i(D.setPointer(null)), i(D.setTabbarHover(null));
355
423
  return;
356
424
  }
357
- if (i(D.setPointer({ x: b, y: v })), p.kind === "content") {
358
- const S = p.cache.groups.find(({ rect: G }) => b >= G.left && b <= G.right && v >= G.top && v <= G.bottom);
359
- if (!S) {
425
+ if (i(D.setPointer({ x: b, y: I })), f.kind === "content") {
426
+ const G = f.cache.groups.find(({ rect: x }) => b >= x.left && b <= x.right && I >= x.top && I <= x.bottom);
427
+ if (!G) {
360
428
  i(D.setSuggest(null));
361
429
  return;
362
430
  }
363
- const R = K(S.rect, b, v);
364
- if (o && !o({ targetGroupId: S.gid, zone: R })) {
431
+ const R = K(G.rect, b, I);
432
+ if (o && !o({ targetGroupId: G.gid, zone: R })) {
365
433
  i(D.setSuggest(null));
366
434
  return;
367
435
  }
368
- i(D.setSuggest({ rect: S.rect, zone: R }));
436
+ i(D.setSuggest({ rect: G.rect, zone: R }));
369
437
  return;
370
438
  }
371
- if (p.kind === "tab") {
372
- const S = p.cache.tabbars.find(({ rect: C }) => b >= C.left && b <= C.right && v >= C.top && v <= C.bottom);
373
- if (S) {
374
- const k = Array.from(S.el.querySelectorAll("[role='tab']")).map(($) => $.getBoundingClientRect()), P = k.map(($) => $.left + $.width / 2), O = P.findIndex(($) => b < $), B = O === -1 ? P.length : O, Pt = k.length === 0 ? S.rect.left + 8 : B === 0 ? k[0].left : B === k.length ? k[k.length - 1].right : (k[B - 1].right + k[B].left) / 2;
375
- i(D.setTabbarHover({ groupId: S.gid, index: B, rect: S.rect, insertX: Pt }));
439
+ if (f.kind === "tab") {
440
+ const G = f.cache.tabbars.find(({ rect: E }) => b >= E.left && b <= E.right && I >= E.top && I <= E.bottom);
441
+ if (G) {
442
+ const k = Array.from(G.el.querySelectorAll("[role='tab']")).map((z) => z.getBoundingClientRect()), P = k.map((z) => z.left + z.width / 2), O = P.findIndex((z) => b < z), B = O === -1 ? P.length : O, At = k.length === 0 ? G.rect.left + 8 : B === 0 ? k[0].left : B === k.length ? k[k.length - 1].right : (k[B - 1].right + k[B].left) / 2;
443
+ i(D.setTabbarHover({ groupId: G.gid, index: B, rect: G.rect, insertX: At }));
376
444
  } else
377
445
  i(D.setTabbarHover(null));
378
- const R = p.cache.contents.find(({ rect: C }) => b >= C.left && b <= C.right && v >= C.top && v <= C.bottom);
446
+ const R = f.cache.contents.find(({ rect: E }) => b >= E.left && b <= E.right && I >= E.top && I <= E.bottom);
379
447
  if (!R) {
380
448
  i(D.setSuggest(null));
381
449
  return;
382
450
  }
383
- const G = K(R.rect, b, v);
384
- if (o && !o({ targetGroupId: R.gid, zone: G })) {
451
+ const x = K(R.rect, b, I);
452
+ if (o && !o({ targetGroupId: R.gid, zone: x })) {
385
453
  i(D.setSuggest(null));
386
454
  return;
387
455
  }
388
- i(D.setSuggest({ rect: R.rect, zone: G }));
456
+ i(D.setSuggest({ rect: R.rect, zone: x }));
389
457
  }
390
- }), f = J((I) => {
458
+ }), p = J((w) => {
391
459
  const T = t.current, b = a;
392
460
  if (i(D.reset()), !T)
393
461
  return;
394
- const v = I.clientX, p = I.clientY;
462
+ const I = w.clientX, f = w.clientY;
395
463
  if (b.phase.kind === "idle")
396
464
  return;
397
- const x = Math.abs(v - b.phase.startX), E = Math.abs(p - b.phase.startY);
398
- if (!(x < e && E < e)) {
465
+ const S = Math.abs(I - b.phase.startX), C = Math.abs(f - b.phase.startY);
466
+ if (!(S < e && C < e)) {
399
467
  if (b.phase.kind === "content") {
400
- const S = b.phase.cache.groups.find(({ rect: C }) => v >= C.left && v <= C.right && p >= C.top && p <= C.bottom);
401
- if (!S)
468
+ const G = b.phase.cache.groups.find(({ rect: E }) => I >= E.left && I <= E.right && f >= E.top && f <= E.bottom);
469
+ if (!G)
402
470
  return;
403
- const R = S.gid ?? null;
471
+ const R = G.gid ?? null;
404
472
  if (!R)
405
473
  return;
406
- const G = K(S.rect, v, p);
407
- if (o && !o({ targetGroupId: R, zone: G }))
474
+ const x = K(G.rect, I, f);
475
+ if (o && !o({ targetGroupId: R, zone: x }))
408
476
  return;
409
- r({ fromGroupId: b.phase.fromGroupId, tabId: b.phase.tabId, targetGroupId: R, zone: G });
477
+ n({ fromGroupId: b.phase.fromGroupId, tabId: b.phase.tabId, targetGroupId: R, zone: x });
410
478
  return;
411
479
  }
412
480
  if (b.phase.kind === "tab") {
413
- const S = b.phase.cache.tabbars.find(({ rect: G }) => v >= G.left && v <= G.right && p >= G.top && p <= G.bottom);
414
- if (S) {
415
- const G = S.gid;
416
- if (!G)
481
+ const G = b.phase.cache.tabbars.find(({ rect: x }) => I >= x.left && I <= x.right && f >= x.top && f <= x.bottom);
482
+ if (G) {
483
+ const x = G.gid;
484
+ if (!x)
417
485
  return;
418
- const k = Array.from(S.el.querySelectorAll("[role='tab']")).map((B) => {
486
+ const k = Array.from(G.el.querySelectorAll("[role='tab']")).map((B) => {
419
487
  const Z = B.getBoundingClientRect();
420
488
  return Z.left + Z.width / 2;
421
- }), P = k.findIndex((B) => v < B), O = P === -1 ? k.length : P;
422
- n({ fromGroupId: b.phase.fromGroupId, tabId: b.phase.tabId, targetGroupId: G, targetIndex: O });
489
+ }), P = k.findIndex((B) => I < B), O = P === -1 ? k.length : P;
490
+ r({ fromGroupId: b.phase.fromGroupId, tabId: b.phase.tabId, targetGroupId: x, targetIndex: O });
423
491
  return;
424
492
  }
425
- const R = b.phase.cache.contents.find(({ rect: G }) => v >= G.left && v <= G.right && p >= G.top && p <= G.bottom);
493
+ const R = b.phase.cache.contents.find(({ rect: x }) => I >= x.left && I <= x.right && f >= x.top && f <= x.bottom);
426
494
  if (R) {
427
- const G = R.gid ?? null;
428
- if (!G)
495
+ const x = R.gid ?? null;
496
+ if (!x)
429
497
  return;
430
- const C = K(R.rect, v, p);
431
- if (o && !o({ targetGroupId: G, zone: C }))
498
+ const E = K(R.rect, I, f);
499
+ if (o && !o({ targetGroupId: x, zone: E }))
432
500
  return;
433
- r({ fromGroupId: b.phase.fromGroupId, tabId: b.phase.tabId, targetGroupId: G, zone: C });
501
+ n({ fromGroupId: b.phase.fromGroupId, tabId: b.phase.tabId, targetGroupId: x, zone: E });
434
502
  }
435
503
  }
436
504
  }
@@ -439,82 +507,82 @@ const he = (t, e) => {
439
507
  });
440
508
  l.useEffect(() => {
441
509
  if (a.phase.kind !== "idle")
442
- return window.addEventListener("pointermove", d), window.addEventListener("pointerup", f, { once: !0 }), window.addEventListener("pointercancel", g, { once: !0 }), () => {
443
- window.removeEventListener("pointermove", d), window.removeEventListener("pointerup", f), window.removeEventListener("pointercancel", g);
510
+ return window.addEventListener("pointermove", u), window.addEventListener("pointerup", p, { once: !0 }), window.addEventListener("pointercancel", g, { once: !0 }), () => {
511
+ window.removeEventListener("pointermove", u), window.removeEventListener("pointerup", p), window.removeEventListener("pointercancel", g);
444
512
  };
445
513
  }, [a.phase.kind]);
446
- const y = l.useCallback((I, T, b) => {
514
+ const v = l.useCallback((w, T, b) => {
447
515
  if (b.button !== 0)
448
516
  return;
449
517
  b.currentTarget.setPointerCapture(b.pointerId);
450
- const v = u();
451
- i(D.startContent({ x: b.clientX, y: b.clientY, groupId: I, tabId: T, cache: v }));
452
- }, [u]), h = l.useCallback((I, T, b) => {
518
+ const I = d();
519
+ i(D.startContent({ x: b.clientX, y: b.clientY, groupId: w, tabId: T, cache: I }));
520
+ }, [d]), h = l.useCallback((w, T, b) => {
453
521
  if (b.button !== 0)
454
522
  return;
455
- const v = b.currentTarget;
456
- v && v.setPointerCapture(b.pointerId);
457
- const p = u();
458
- i(D.startTab({ x: b.clientX, y: b.clientY, groupId: T, tabId: I, cache: p, element: v }));
459
- }, [u]), w = l.useMemo(() => ({
523
+ const I = b.currentTarget;
524
+ I && I.setPointerCapture(b.pointerId);
525
+ const f = d();
526
+ i(D.startTab({ x: b.clientX, y: b.clientY, groupId: T, tabId: w, cache: f, element: I }));
527
+ }, [d]), y = l.useMemo(() => ({
460
528
  suggest: a.suggest,
461
529
  isTabDragging: a.phase.kind === "tab",
462
530
  draggingTabId: a.phase.kind === "tab" ? a.phase.tabId : null,
463
531
  dragPointer: a.pointer,
464
532
  tabbarHover: a.tabbarHover,
465
533
  draggingTabElement: a.draggingTabElement,
466
- onStartContentDrag: y,
534
+ onStartContentDrag: v,
467
535
  onStartTabDrag: h
468
- }), [a.suggest, a.pointer, a.tabbarHover, a.phase, a.draggingTabElement, y, h]);
469
- return /* @__PURE__ */ m(It.Provider, { value: w, children: s });
470
- }, it = {
536
+ }), [a.suggest, a.pointer, a.tabbarHover, a.phase, a.draggingTabElement, v, h]);
537
+ return /* @__PURE__ */ m(yt.Provider, { value: y, children: s });
538
+ }, ct = {
471
539
  display: "inline-flex",
472
540
  alignItems: "center",
473
541
  userSelect: "none"
474
- }, we = ({
542
+ }, Te = ({
475
543
  groupId: t,
476
544
  tab: e,
477
- active: r,
478
- dragging: n,
545
+ active: n,
546
+ dragging: r,
479
547
  onClickTab: o,
480
548
  onStartDrag: s,
481
549
  onCloseTab: a,
482
550
  tabComponent: i,
483
551
  tabElement: c,
484
- onDoubleClick: u
552
+ onDoubleClick: d
485
553
  }) => {
486
- const d = l.useEffectEvent(() => {
554
+ const u = l.useEffectEvent(() => {
487
555
  o(e.id);
488
- }), f = l.useEffectEvent((w) => {
489
- s && w.button === 0 && s(e.id, t, w);
556
+ }), p = l.useEffectEvent((y) => {
557
+ s && y.button === 0 && s(e.id, t, y);
490
558
  }), g = () => {
491
- const w = !!a;
492
- return /* @__PURE__ */ m(l.Activity, { mode: w ? "visible" : "hidden", children: /* @__PURE__ */ m(
559
+ const y = !!a;
560
+ return /* @__PURE__ */ m(l.Activity, { mode: y ? "visible" : "hidden", children: /* @__PURE__ */ m(
493
561
  "button",
494
562
  {
495
563
  type: "button",
496
564
  "aria-label": `Close tab ${e.title}`,
497
- onClick: (I) => {
498
- a && (I.stopPropagation(), a(t, e.id));
565
+ onClick: (w) => {
566
+ a && (w.stopPropagation(), a(t, e.id));
499
567
  },
500
568
  style: { marginLeft: 6 },
501
- tabIndex: w ? void 0 : -1,
502
- disabled: !w,
503
- "aria-hidden": w ? void 0 : !0,
569
+ tabIndex: y ? void 0 : -1,
570
+ disabled: !y,
571
+ "aria-hidden": y ? void 0 : !0,
504
572
  children: "×"
505
573
  }
506
574
  ) });
507
- }, y = {
575
+ }, v = {
508
576
  role: "tab",
509
- "aria-selected": r,
510
- tabIndex: r ? 0 : -1,
511
- style: it,
512
- onClick: d,
513
- onPointerDown: f,
514
- onDoubleClick: u,
577
+ "aria-selected": n,
578
+ tabIndex: n ? 0 : -1,
579
+ style: ct,
580
+ onClick: u,
581
+ onPointerDown: p,
582
+ onDoubleClick: d,
515
583
  "data-tab-id": e.id,
516
- "data-active": r ? "true" : "false",
517
- "data-dragging": n ? "true" : "false",
584
+ "data-active": n ? "true" : "false",
585
+ "data-dragging": r ? "true" : "false",
518
586
  children: /* @__PURE__ */ H(et, { children: [
519
587
  /* @__PURE__ */ m("span", { children: e.title }),
520
588
  g()
@@ -522,120 +590,120 @@ const he = (t, e) => {
522
590
  }, h = {
523
591
  type: "button",
524
592
  role: "tab",
525
- "aria-selected": r,
526
- tabIndex: r ? 0 : -1,
527
- style: it,
593
+ "aria-selected": n,
594
+ tabIndex: n ? 0 : -1,
595
+ style: ct,
528
596
  onClick: () => {
529
597
  o(e.id);
530
598
  },
531
- onPointerDown: (w) => {
532
- s && w.button === 0 && s(e.id, t, w);
599
+ onPointerDown: (y) => {
600
+ s && y.button === 0 && s(e.id, t, y);
533
601
  },
534
- onDoubleClick: u,
602
+ onDoubleClick: d,
535
603
  children: /* @__PURE__ */ m("span", { children: e.title })
536
604
  };
537
- return c ? c(h) : i ? /* @__PURE__ */ m(i, { ...h }) : /* @__PURE__ */ m("div", { ...y });
538
- }, ye = {
605
+ return c ? c(h) : i ? /* @__PURE__ */ m(i, { ...h }) : /* @__PURE__ */ m("div", { ...v });
606
+ }, Se = {
539
607
  display: "flex",
540
608
  alignItems: "center"
541
- }, Te = {
609
+ }, xe = {
542
610
  flex: "1 1 auto",
543
611
  alignSelf: "stretch"
544
- }, xe = ({
612
+ }, Ge = ({
545
613
  group: t,
546
614
  onClickTab: e,
547
- onStartDrag: r,
548
- rootRef: n,
615
+ onStartDrag: n,
616
+ rootRef: r,
549
617
  component: o,
550
618
  element: s,
551
619
  tabComponent: a,
552
620
  tabElement: i,
553
621
  onAddTab: c,
554
- onCloseTab: u,
555
- doubleClickToAdd: d
622
+ onCloseTab: d,
623
+ doubleClickToAdd: u
556
624
  }) => {
557
- const { isTabDragging: f, draggingTabId: g } = W(), y = l.useRef(null), h = l.useCallback(
558
- (p) => {
559
- if (y.current = p, !!n) {
560
- if (typeof n == "function") {
561
- n(p);
625
+ const { isTabDragging: p, draggingTabId: g } = W(), v = l.useRef(null), h = l.useCallback(
626
+ (f) => {
627
+ if (v.current = f, !!r) {
628
+ if (typeof r == "function") {
629
+ r(f);
562
630
  return;
563
631
  }
564
632
  try {
565
- n.current = p;
633
+ r.current = f;
566
634
  } catch {
567
635
  }
568
636
  }
569
637
  },
570
- [n]
571
- ), w = l.useEffectEvent((p) => {
572
- const x = y.current ?? p.currentTarget;
573
- if (!x)
638
+ [r]
639
+ ), y = l.useEffectEvent((f) => {
640
+ const S = v.current ?? f.currentTarget;
641
+ if (!S)
574
642
  return;
575
- const E = Array.from(x.querySelectorAll('[role="tab"]'));
576
- if (E.length === 0)
643
+ const C = Array.from(S.querySelectorAll('[role="tab"]'));
644
+ if (C.length === 0)
577
645
  return;
578
- const S = (P) => {
579
- const O = Math.max(0, Math.min(P, E.length - 1)), B = E[O];
646
+ const G = (P) => {
647
+ const O = Math.max(0, Math.min(P, C.length - 1)), B = C[O];
580
648
  B && B.focus();
581
- }, R = document.activeElement, G = R ? E.indexOf(R) : E.findIndex((P) => P.getAttribute("data-tab-id") === t.activeTabId);
582
- if (p.key === "ArrowRight") {
583
- p.preventDefault();
584
- const P = G >= 0 ? G + 1 : 0;
585
- S(P >= E.length ? 0 : P);
649
+ }, R = document.activeElement, x = R ? C.indexOf(R) : C.findIndex((P) => P.getAttribute("data-tab-id") === t.activeTabId);
650
+ if (f.key === "ArrowRight") {
651
+ f.preventDefault();
652
+ const P = x >= 0 ? x + 1 : 0;
653
+ G(P >= C.length ? 0 : P);
586
654
  return;
587
655
  }
588
- if (p.key === "ArrowLeft") {
589
- p.preventDefault();
590
- const P = G >= 0 ? G - 1 : E.length - 1;
591
- S(P < 0 ? E.length - 1 : P);
656
+ if (f.key === "ArrowLeft") {
657
+ f.preventDefault();
658
+ const P = x >= 0 ? x - 1 : C.length - 1;
659
+ G(P < 0 ? C.length - 1 : P);
592
660
  return;
593
661
  }
594
- if (p.key === "Home") {
595
- p.preventDefault(), S(0);
662
+ if (f.key === "Home") {
663
+ f.preventDefault(), G(0);
596
664
  return;
597
665
  }
598
- if (p.key === "End") {
599
- p.preventDefault(), S(E.length - 1);
666
+ if (f.key === "End") {
667
+ f.preventDefault(), G(C.length - 1);
600
668
  return;
601
669
  }
602
- if (p.key === "Enter" || p.key === " ") {
603
- p.preventDefault();
604
- const O = (G >= 0 ? E[G] : null)?.getAttribute("data-tab-id") ?? null;
670
+ if (f.key === "Enter" || f.key === " ") {
671
+ f.preventDefault();
672
+ const O = (x >= 0 ? C[x] : null)?.getAttribute("data-tab-id") ?? null;
605
673
  O && e(O);
606
674
  return;
607
675
  }
608
- if (p.key === "Delete" || p.key === "Backspace") {
609
- if (u) {
610
- p.preventDefault();
611
- const O = (G >= 0 ? E[G] : null)?.getAttribute("data-tab-id") ?? null;
612
- O && u(t.id, O);
676
+ if (f.key === "Delete" || f.key === "Backspace") {
677
+ if (d) {
678
+ f.preventDefault();
679
+ const O = (x >= 0 ? C[x] : null)?.getAttribute("data-tab-id") ?? null;
680
+ O && d(t.id, O);
613
681
  }
614
682
  return;
615
683
  }
616
- const C = (p.ctrlKey ? 1 : 0) + (p.metaKey ? 1 : 0) > 0, k = typeof p.key == "string" ? p.key.toLowerCase() : "";
617
- if (C && k === "t") {
618
- c && (p.preventDefault(), c(t.id));
684
+ const E = (f.ctrlKey ? 1 : 0) + (f.metaKey ? 1 : 0) > 0, k = typeof f.key == "string" ? f.key.toLowerCase() : "";
685
+ if (E && k === "t") {
686
+ c && (f.preventDefault(), c(t.id));
619
687
  return;
620
688
  }
621
689
  });
622
690
  l.useEffect(() => {
623
- const p = y.current;
624
- if (!p)
691
+ const f = v.current;
692
+ if (!f)
625
693
  return;
626
- const x = p.querySelector(`[role="tab"][data-tab-id="${t.activeTabId}"]`);
627
- if (x === document.activeElement)
694
+ const S = f.querySelector(`[role="tab"][data-tab-id="${t.activeTabId}"]`);
695
+ if (S === document.activeElement)
628
696
  return;
629
- !p.contains(document.activeElement) && x && x.focus();
697
+ !f.contains(document.activeElement) && S && S.focus();
630
698
  }, [t.activeTabId]);
631
- const I = {
632
- style: ye,
699
+ const w = {
700
+ style: Se,
633
701
  role: "tablist",
634
702
  "data-tabbar": "true",
635
703
  "data-group-id": t.id,
636
- "data-dragging": f ? "true" : "false",
637
- onKeyDown: w
638
- }, T = Mt({
704
+ "data-dragging": p ? "true" : "false",
705
+ onKeyDown: y
706
+ }, T = Ot({
639
707
  element: s,
640
708
  component: o
641
709
  }), b = () => c ? /* @__PURE__ */ m(
@@ -648,85 +716,85 @@ const he = (t, e) => {
648
716
  },
649
717
  children: "+"
650
718
  }
651
- ) : null, v = l.useCallback(() => {
652
- d && c && c(t.id);
653
- }, [d, c, t.id]);
654
- return /* @__PURE__ */ H(T, { ...I, ref: h, onDoubleClick: v, children: [
655
- t.tabs.map((p, x) => /* @__PURE__ */ m(
656
- we,
719
+ ) : null, I = l.useCallback(() => {
720
+ u && c && c(t.id);
721
+ }, [u, c, t.id]);
722
+ return /* @__PURE__ */ H(T, { ...w, ref: h, onDoubleClick: I, children: [
723
+ t.tabs.map((f, S) => /* @__PURE__ */ m(
724
+ Te,
657
725
  {
658
726
  groupId: t.id,
659
- tab: p,
660
- active: t.activeTabId === p.id,
661
- dragging: g === p.id,
727
+ tab: f,
728
+ active: t.activeTabId === f.id,
729
+ dragging: g === f.id,
662
730
  onClickTab: e,
663
- onStartDrag: r,
664
- onCloseTab: u,
731
+ onStartDrag: n,
732
+ onCloseTab: d,
665
733
  tabComponent: a,
666
734
  tabElement: i,
667
- onDoubleClick: (E) => E.stopPropagation()
735
+ onDoubleClick: (C) => C.stopPropagation()
668
736
  },
669
- `${t.id}:${p.id}:${x}`
737
+ `${t.id}:${f.id}:${S}`
670
738
  )),
671
- /* @__PURE__ */ m("span", { style: Te }),
739
+ /* @__PURE__ */ m("span", { style: xe }),
672
740
  b()
673
741
  ] });
674
- }, Ge = ({ id: t, TabBarComponent: e, PanelGroupComponent: r }) => {
675
- const { getGroup: n, getGroupContent: o, onClickTab: s, onAddTab: a, onCloseTab: i, onStartTabDrag: c, doubleClickToAdd: u, registerContentContainer: d } = ce(), { setGroupEl: f, setTabbarEl: g, setContentEl: y } = gt(), h = l.useCallback(
676
- (x) => {
677
- f(t, x);
742
+ }, Ce = ({ id: t, TabBarComponent: e, PanelGroupComponent: n }) => {
743
+ const { getGroup: r, getGroupContent: o, onClickTab: s, onAddTab: a, onCloseTab: i, onStartTabDrag: c, doubleClickToAdd: d, registerContentContainer: u } = le(), { setGroupEl: p, setTabbarEl: g, setContentEl: v } = mt(), h = l.useCallback(
744
+ (S) => {
745
+ p(t, S);
678
746
  },
679
- [t, f]
680
- ), w = l.useCallback(
681
- (x) => {
682
- y(t, x), d(t, x);
747
+ [t, p]
748
+ ), y = l.useCallback(
749
+ (S) => {
750
+ v(t, S), u(t, S);
683
751
  },
684
- [t, y, d]
685
- ), I = l.useCallback(
686
- (x) => {
687
- g(t, x);
752
+ [t, v, u]
753
+ ), w = l.useCallback(
754
+ (S) => {
755
+ g(t, S);
688
756
  },
689
757
  [t, g]
690
- ), T = n(t);
758
+ ), T = r(t);
691
759
  if (!T)
692
760
  return null;
693
761
  const b = o(t);
694
762
  return /* @__PURE__ */ m(
695
- r ?? ((x) => /* @__PURE__ */ m(ht, { ...x })),
763
+ n ?? ((S) => /* @__PURE__ */ m(vt, { ...S })),
696
764
  {
697
765
  group: T,
698
766
  tabbar: /* @__PURE__ */ m(
699
- e ?? xe,
767
+ e ?? Ge,
700
768
  {
701
- rootRef: I,
769
+ rootRef: w,
702
770
  group: T,
703
- onClickTab: (x) => s(t, x),
771
+ onClickTab: (S) => s(t, S),
704
772
  onAddTab: a,
705
773
  onCloseTab: i,
706
- onStartDrag: (x, E, S) => c(x, E, S),
707
- doubleClickToAdd: u
774
+ onStartDrag: (S, C, G) => c(S, C, G),
775
+ doubleClickToAdd: d
708
776
  }
709
777
  ),
710
778
  content: b,
711
779
  groupRef: h,
712
- contentRef: w
780
+ contentRef: y
713
781
  }
714
782
  );
715
- }, Se = (t, e) => {
716
- const r = new Array(16);
717
- for (let n = 0; n < 4; n++)
783
+ }, Ee = (t, e) => {
784
+ const n = new Array(16);
785
+ for (let r = 0; r < 4; r++)
718
786
  for (let o = 0; o < 4; o++)
719
- r[n * 4 + o] = t[0 + o] * e[n * 4 + 0] + t[4 + o] * e[n * 4 + 1] + t[8 + o] * e[n * 4 + 2] + t[12 + o] * e[n * 4 + 3];
720
- return r;
721
- }, V = (t) => {
787
+ n[r * 4 + o] = t[0 + o] * e[r * 4 + 0] + t[4 + o] * e[r * 4 + 1] + t[8 + o] * e[r * 4 + 2] + t[12 + o] * e[r * 4 + 3];
788
+ return n;
789
+ }, U = (t) => {
722
790
  if (t.length !== 16)
723
791
  throw new Error("Matrix must have exactly 16 values");
724
- const e = Object.freeze([...t]), r = (n) => {
725
- const o = Se(e, n);
726
- return V(o);
792
+ const e = Object.freeze([...t]), n = (r) => {
793
+ const o = Ee(e, r);
794
+ return U(o);
727
795
  };
728
796
  return Object.freeze({
729
- translate: (n = 0, o = 0, s = 0) => r([
797
+ translate: (r = 0, o = 0, s = 0) => n([
730
798
  1,
731
799
  0,
732
800
  0,
@@ -739,12 +807,12 @@ const he = (t, e) => {
739
807
  0,
740
808
  1,
741
809
  0,
742
- n,
810
+ r,
743
811
  o,
744
812
  s,
745
813
  1
746
814
  ]),
747
- translate3d: (n, o, s) => r([
815
+ translate3d: (r, o, s) => n([
748
816
  1,
749
817
  0,
750
818
  0,
@@ -757,12 +825,12 @@ const he = (t, e) => {
757
825
  0,
758
826
  1,
759
827
  0,
760
- n,
828
+ r,
761
829
  o,
762
830
  s,
763
831
  1
764
832
  ]),
765
- translateX: (n) => r([
833
+ translateX: (r) => n([
766
834
  1,
767
835
  0,
768
836
  0,
@@ -775,12 +843,12 @@ const he = (t, e) => {
775
843
  0,
776
844
  1,
777
845
  0,
778
- n,
846
+ r,
779
847
  0,
780
848
  0,
781
849
  1
782
850
  ]),
783
- translateY: (n) => r([
851
+ translateY: (r) => n([
784
852
  1,
785
853
  0,
786
854
  0,
@@ -794,11 +862,11 @@ const he = (t, e) => {
794
862
  1,
795
863
  0,
796
864
  0,
797
- n,
865
+ r,
798
866
  0,
799
867
  1
800
868
  ]),
801
- translateZ: (n) => r([
869
+ translateZ: (r) => n([
802
870
  1,
803
871
  0,
804
872
  0,
@@ -813,11 +881,11 @@ const he = (t, e) => {
813
881
  0,
814
882
  0,
815
883
  0,
816
- n,
884
+ r,
817
885
  1
818
886
  ]),
819
- scale: (n = 1, o = 1, s = 1) => r([
820
- n,
887
+ scale: (r = 1, o = 1, s = 1) => n([
888
+ r,
821
889
  0,
822
890
  0,
823
891
  0,
@@ -834,8 +902,8 @@ const he = (t, e) => {
834
902
  0,
835
903
  1
836
904
  ]),
837
- scale3d: (n, o, s) => r([
838
- n,
905
+ scale3d: (r, o, s) => n([
906
+ r,
839
907
  0,
840
908
  0,
841
909
  0,
@@ -852,8 +920,8 @@ const he = (t, e) => {
852
920
  0,
853
921
  1
854
922
  ]),
855
- scaleX: (n) => r([
856
- n,
923
+ scaleX: (r) => n([
924
+ r,
857
925
  0,
858
926
  0,
859
927
  0,
@@ -870,13 +938,13 @@ const he = (t, e) => {
870
938
  0,
871
939
  1
872
940
  ]),
873
- scaleY: (n) => r([
941
+ scaleY: (r) => n([
874
942
  1,
875
943
  0,
876
944
  0,
877
945
  0,
878
946
  0,
879
- n,
947
+ r,
880
948
  0,
881
949
  0,
882
950
  0,
@@ -888,7 +956,7 @@ const he = (t, e) => {
888
956
  0,
889
957
  1
890
958
  ]),
891
- scaleZ: (n) => r([
959
+ scaleZ: (r) => n([
892
960
  1,
893
961
  0,
894
962
  0,
@@ -899,16 +967,16 @@ const he = (t, e) => {
899
967
  0,
900
968
  0,
901
969
  0,
902
- n,
970
+ r,
903
971
  0,
904
972
  0,
905
973
  0,
906
974
  0,
907
975
  1
908
976
  ]),
909
- rotateX: (n) => {
910
- const o = Math.cos(n), s = Math.sin(n);
911
- return r([
977
+ rotateX: (r) => {
978
+ const o = Math.cos(r), s = Math.sin(r);
979
+ return n([
912
980
  1,
913
981
  0,
914
982
  0,
@@ -927,9 +995,9 @@ const he = (t, e) => {
927
995
  1
928
996
  ]);
929
997
  },
930
- rotateY: (n) => {
931
- const o = Math.cos(n), s = Math.sin(n);
932
- return r([
998
+ rotateY: (r) => {
999
+ const o = Math.cos(r), s = Math.sin(r);
1000
+ return n([
933
1001
  o,
934
1002
  0,
935
1003
  -s,
@@ -948,9 +1016,9 @@ const he = (t, e) => {
948
1016
  1
949
1017
  ]);
950
1018
  },
951
- rotateZ: (n) => {
952
- const o = Math.cos(n), s = Math.sin(n);
953
- return r([
1019
+ rotateZ: (r) => {
1020
+ const o = Math.cos(r), s = Math.sin(r);
1021
+ return n([
954
1022
  o,
955
1023
  s,
956
1024
  0,
@@ -969,24 +1037,24 @@ const he = (t, e) => {
969
1037
  1
970
1038
  ]);
971
1039
  },
972
- rotate: (n, o, s, a) => {
1040
+ rotate: (r, o, s, a) => {
973
1041
  const i = Math.sqrt(o * o + s * s + a * a);
974
1042
  if (i === 0)
975
- return V(e);
1043
+ return U(e);
976
1044
  o /= i, s /= i, a /= i;
977
- const c = Math.cos(n), u = Math.sin(n), d = 1 - c;
978
- return r([
979
- d * o * o + c,
980
- d * o * s + u * a,
981
- d * o * a - u * s,
1045
+ const c = Math.cos(r), d = Math.sin(r), u = 1 - c;
1046
+ return n([
1047
+ u * o * o + c,
1048
+ u * o * s + d * a,
1049
+ u * o * a - d * s,
982
1050
  0,
983
- d * o * s - u * a,
984
- d * s * s + c,
985
- d * s * a + u * o,
1051
+ u * o * s - d * a,
1052
+ u * s * s + c,
1053
+ u * s * a + d * o,
986
1054
  0,
987
- d * o * a + u * s,
988
- d * s * a - u * o,
989
- d * a * a + c,
1055
+ u * o * a + d * s,
1056
+ u * s * a - d * o,
1057
+ u * a * a + c,
990
1058
  0,
991
1059
  0,
992
1060
  0,
@@ -994,24 +1062,24 @@ const he = (t, e) => {
994
1062
  1
995
1063
  ]);
996
1064
  },
997
- rotate3d: (n, o, s, a) => {
998
- const i = Math.sqrt(n * n + o * o + s * s);
1065
+ rotate3d: (r, o, s, a) => {
1066
+ const i = Math.sqrt(r * r + o * o + s * s);
999
1067
  if (i === 0)
1000
- return V(e);
1001
- n /= i, o /= i, s /= i;
1002
- const c = Math.cos(a), u = Math.sin(a), d = 1 - c;
1003
- return r([
1004
- d * n * n + c,
1005
- d * n * o + u * s,
1006
- d * n * s - u * o,
1068
+ return U(e);
1069
+ r /= i, o /= i, s /= i;
1070
+ const c = Math.cos(a), d = Math.sin(a), u = 1 - c;
1071
+ return n([
1072
+ u * r * r + c,
1073
+ u * r * o + d * s,
1074
+ u * r * s - d * o,
1007
1075
  0,
1008
- d * n * o - u * s,
1009
- d * o * o + c,
1010
- d * o * s + u * n,
1076
+ u * r * o - d * s,
1077
+ u * o * o + c,
1078
+ u * o * s + d * r,
1011
1079
  0,
1012
- d * n * s + u * o,
1013
- d * o * s - u * n,
1014
- d * s * s + c,
1080
+ u * r * s + d * o,
1081
+ u * o * s - d * r,
1082
+ u * s * s + c,
1015
1083
  0,
1016
1084
  0,
1017
1085
  0,
@@ -1019,9 +1087,9 @@ const he = (t, e) => {
1019
1087
  1
1020
1088
  ]);
1021
1089
  },
1022
- skew: (n = 0, o = 0) => {
1023
- const s = Math.tan(n), a = Math.tan(o);
1024
- return r([
1090
+ skew: (r = 0, o = 0) => {
1091
+ const s = Math.tan(r), a = Math.tan(o);
1092
+ return n([
1025
1093
  1,
1026
1094
  a,
1027
1095
  0,
@@ -1040,9 +1108,9 @@ const he = (t, e) => {
1040
1108
  1
1041
1109
  ]);
1042
1110
  },
1043
- skewX: (n) => {
1044
- const o = Math.tan(n);
1045
- return r([
1111
+ skewX: (r) => {
1112
+ const o = Math.tan(r);
1113
+ return n([
1046
1114
  1,
1047
1115
  0,
1048
1116
  0,
@@ -1061,9 +1129,9 @@ const he = (t, e) => {
1061
1129
  1
1062
1130
  ]);
1063
1131
  },
1064
- skewY: (n) => {
1065
- const o = Math.tan(n);
1066
- return r([
1132
+ skewY: (r) => {
1133
+ const o = Math.tan(r);
1134
+ return n([
1067
1135
  1,
1068
1136
  o,
1069
1137
  0,
@@ -1082,10 +1150,10 @@ const he = (t, e) => {
1082
1150
  1
1083
1151
  ]);
1084
1152
  },
1085
- perspective: (n) => {
1086
- if (n === 0)
1153
+ perspective: (r) => {
1154
+ if (r === 0)
1087
1155
  throw new Error("Perspective distance cannot be zero");
1088
- return r([
1156
+ return n([
1089
1157
  1,
1090
1158
  0,
1091
1159
  0,
@@ -1097,7 +1165,7 @@ const he = (t, e) => {
1097
1165
  0,
1098
1166
  0,
1099
1167
  1,
1100
- -1 / n,
1168
+ -1 / r,
1101
1169
  0,
1102
1170
  0,
1103
1171
  0,
@@ -1114,7 +1182,7 @@ const he = (t, e) => {
1114
1182
  ].join(`
1115
1183
  `)
1116
1184
  });
1117
- }, Ee = () => V([
1185
+ }, Re = () => U([
1118
1186
  1,
1119
1187
  0,
1120
1188
  0,
@@ -1131,142 +1199,142 @@ const he = (t, e) => {
1131
1199
  0,
1132
1200
  0,
1133
1201
  1
1134
- ]), Ce = {
1202
+ ]), Pe = {
1135
1203
  position: "fixed",
1136
1204
  inset: 0,
1137
1205
  pointerEvents: "none",
1138
- zIndex: Nt
1139
- }, Re = {
1206
+ zIndex: $t
1207
+ }, De = {
1140
1208
  position: "absolute",
1141
- border: `${Xt} dashed ${Yt}`,
1142
- background: zt,
1143
- borderRadius: $t,
1209
+ border: `${Yt} dashed ${jt}`,
1210
+ background: Xt,
1211
+ borderRadius: Ft,
1144
1212
  transformOrigin: "top left"
1145
- }, L = (t, e) => e <= 0 ? 0 : M(t / e, 0), Pe = (t, e, r) => {
1146
- const { width: n, height: o } = t, s = r / 2, a = n > 0 ? n : 1, i = o > 0 ? o : 1, c = {
1147
- translateX: r,
1148
- translateY: r,
1149
- scaleX: L(M(n - r * 2, 0), a),
1150
- scaleY: L(M(o - r * 2, 0), i)
1151
- }, u = {
1152
- translateX: r,
1153
- translateY: r,
1154
- scaleX: L(M(n / 2 - r * 1.5, 0), a),
1155
- scaleY: L(M(o - r * 2, 0), i)
1213
+ }, L = (t, e) => e <= 0 ? 0 : M(t / e, 0), Ae = (t, e, n) => {
1214
+ const { width: r, height: o } = t, s = n / 2, a = r > 0 ? r : 1, i = o > 0 ? o : 1, c = {
1215
+ translateX: n,
1216
+ translateY: n,
1217
+ scaleX: L(M(r - n * 2, 0), a),
1218
+ scaleY: L(M(o - n * 2, 0), i)
1156
1219
  }, d = {
1157
- translateX: n / 2 + s,
1158
- translateY: r,
1159
- scaleX: L(M(n / 2 - r * 1.5, 0), a),
1160
- scaleY: L(M(o - r * 2, 0), i)
1161
- }, f = {
1162
- translateX: r,
1163
- translateY: r,
1164
- scaleX: L(M(n - r * 2, 0), a),
1165
- scaleY: L(M(o / 2 - r * 1.5, 0), i)
1220
+ translateX: n,
1221
+ translateY: n,
1222
+ scaleX: L(M(r / 2 - n * 1.5, 0), a),
1223
+ scaleY: L(M(o - n * 2, 0), i)
1224
+ }, u = {
1225
+ translateX: r / 2 + s,
1226
+ translateY: n,
1227
+ scaleX: L(M(r / 2 - n * 1.5, 0), a),
1228
+ scaleY: L(M(o - n * 2, 0), i)
1229
+ }, p = {
1230
+ translateX: n,
1231
+ translateY: n,
1232
+ scaleX: L(M(r - n * 2, 0), a),
1233
+ scaleY: L(M(o / 2 - n * 1.5, 0), i)
1166
1234
  }, g = {
1167
- translateX: r,
1235
+ translateX: n,
1168
1236
  translateY: o / 2 + s,
1169
- scaleX: L(M(n - r * 2, 0), a),
1170
- scaleY: L(M(o / 2 - r * 1.5, 0), i)
1171
- }, y = {
1237
+ scaleX: L(M(r - n * 2, 0), a),
1238
+ scaleY: L(M(o / 2 - n * 1.5, 0), i)
1239
+ }, v = {
1172
1240
  center: c,
1173
- left: u,
1174
- right: d,
1175
- top: f,
1241
+ left: d,
1242
+ right: u,
1243
+ top: p,
1176
1244
  bottom: g
1177
- }, { translateX: h, translateY: w, scaleX: I, scaleY: T } = y[e];
1178
- return Ee().translate(h, w, 0).scale(I, T, 1).toCSS();
1179
- }, De = (t, e) => {
1180
- const r = Ft;
1245
+ }, { translateX: h, translateY: y, scaleX: w, scaleY: T } = v[e];
1246
+ return Re().translate(h, y, 0).scale(w, T, 1).toCSS();
1247
+ }, ke = (t, e) => {
1248
+ const n = Kt;
1181
1249
  return {
1182
- ...Re,
1250
+ ...De,
1183
1251
  left: t.left,
1184
1252
  top: t.top,
1185
1253
  width: t.width,
1186
1254
  height: t.height,
1187
- transform: Pe(t, e, r)
1255
+ transform: Ae(t, e, n)
1188
1256
  };
1189
- }, Ae = ({ suggest: t }) => {
1257
+ }, Me = ({ suggest: t }) => {
1190
1258
  if (!t)
1191
1259
  return null;
1192
- const { rect: e, zone: r } = t, n = De(e, r);
1193
- return /* @__PURE__ */ m("div", { style: Ce, children: /* @__PURE__ */ m("div", { style: n }) });
1194
- }, ke = typeof window < "u" && typeof document < "u", Me = (t) => {
1195
- const [e, r] = l.useState(null), [n, o] = l.useState(null);
1196
- return rt(() => {
1197
- if (!ke || !t) {
1198
- r(null), o(null);
1260
+ const { rect: e, zone: n } = t, r = ke(e, n);
1261
+ return /* @__PURE__ */ m("div", { style: Pe, children: /* @__PURE__ */ m("div", { style: r }) });
1262
+ }, _e = typeof window < "u" && typeof document < "u", Oe = (t) => {
1263
+ const [e, n] = l.useState(null), [r, o] = l.useState(null);
1264
+ return nt(() => {
1265
+ if (!_e || !t) {
1266
+ n(null), o(null);
1199
1267
  return;
1200
1268
  }
1201
1269
  const s = t.getBoundingClientRect();
1202
- r({ width: s.width, height: s.height }), o(t.outerHTML);
1203
- }, [t]), { html: n, size: e };
1204
- }, _e = {
1270
+ n({ width: s.width, height: s.height }), o(t.outerHTML);
1271
+ }, [t]), { html: r, size: e };
1272
+ }, Be = {
1205
1273
  position: "fixed",
1206
1274
  inset: 0,
1207
1275
  pointerEvents: "none",
1208
- zIndex: Zt
1209
- }, Oe = {
1276
+ zIndex: Qt
1277
+ }, Le = {
1210
1278
  position: "absolute",
1211
- width: qt,
1212
- borderRadius: Wt,
1213
- background: Ut,
1214
- boxShadow: Vt
1215
- }, Be = () => {
1216
- const { isTabDragging: t, draggingTabId: e, dragPointer: r, tabbarHover: n, draggingTabElement: o } = W(), { html: s, size: a } = Me(o), i = r !== null && e !== null, c = l.useMemo(() => {
1217
- if (!(!i || !r))
1279
+ width: Jt,
1280
+ borderRadius: Zt,
1281
+ background: qt,
1282
+ boxShadow: Wt
1283
+ }, He = () => {
1284
+ const { isTabDragging: t, draggingTabId: e, dragPointer: n, tabbarHover: r, draggingTabElement: o } = W(), { html: s, size: a } = Oe(o), i = n !== null && e !== null, c = l.useMemo(() => {
1285
+ if (!(!i || !n))
1218
1286
  return {
1219
1287
  position: "absolute",
1220
- left: r.x,
1221
- top: r.y,
1222
- transform: `translate(${jt}, ${Kt})`,
1288
+ left: n.x,
1289
+ top: n.y,
1290
+ transform: `translate(${Ut}, ${Vt})`,
1223
1291
  pointerEvents: "none"
1224
1292
  };
1225
- }, [i, r]), u = l.useMemo(() => {
1293
+ }, [i, n]), d = l.useMemo(() => {
1226
1294
  if (!(!c || !o))
1227
1295
  return a ? { ...c, width: a.width, height: a.height } : c;
1228
- }, [c, o, a]), d = l.useMemo(() => {
1229
- if (n)
1296
+ }, [c, o, a]), u = l.useMemo(() => {
1297
+ if (r)
1230
1298
  return {
1231
- ...Oe,
1232
- left: n.insertX,
1233
- top: n.rect.top + 4,
1234
- height: Math.max(0, n.rect.height - 8)
1299
+ ...Le,
1300
+ left: r.insertX,
1301
+ top: r.rect.top + 4,
1302
+ height: Math.max(0, r.rect.height - 8)
1235
1303
  };
1236
- }, [n]);
1237
- return t ? /* @__PURE__ */ H("div", { style: _e, children: [
1238
- /* @__PURE__ */ m(l.Activity, { mode: u ? "visible" : "hidden", children: /* @__PURE__ */ m("div", { style: u, children: /* @__PURE__ */ m(
1304
+ }, [r]);
1305
+ return t ? /* @__PURE__ */ H("div", { style: Be, children: [
1306
+ /* @__PURE__ */ m(l.Activity, { mode: d ? "visible" : "hidden", children: /* @__PURE__ */ m("div", { style: d, children: /* @__PURE__ */ m(
1239
1307
  "div",
1240
1308
  {
1241
1309
  style: { width: "100%", height: "100%", pointerEvents: "none" },
1242
1310
  dangerouslySetInnerHTML: { __html: s ?? "" }
1243
1311
  }
1244
1312
  ) }) }),
1245
- /* @__PURE__ */ m(l.Activity, { mode: d ? "visible" : "hidden", children: /* @__PURE__ */ m("div", { style: d }) })
1313
+ /* @__PURE__ */ m(l.Activity, { mode: u ? "visible" : "hidden", children: /* @__PURE__ */ m("div", { style: u }) })
1246
1314
  ] }) : null;
1247
- }, _ = (t) => t.type === "group", F = (t, e = []) => {
1315
+ }, _ = (t) => t.type === "group", Y = (t, e = []) => {
1248
1316
  if (_(t))
1249
1317
  return [...e, t.groupId];
1250
- const r = F(t.a, e);
1251
- return F(t.b, r);
1252
- }, q = (t, e) => e.reduce((r, n) => _(r) ? r : r[n], t), j = (t, e, r) => {
1318
+ const n = Y(t.a, e);
1319
+ return Y(t.b, n);
1320
+ }, q = (t, e) => e.reduce((n, r) => _(n) ? n : n[r], t), j = (t, e, n) => {
1253
1321
  if (e.length === 0)
1254
- return r;
1255
- const [n, ...o] = e;
1256
- return _(t) ? t : n === "a" ? { ...t, a: j(t.a, o, r) } : { ...t, b: j(t.b, o, r) };
1257
- }, U = (t, e, r = []) => {
1322
+ return n;
1323
+ const [r, ...o] = e;
1324
+ return _(t) ? t : r === "a" ? { ...t, a: j(t.a, o, n) } : { ...t, b: j(t.b, o, n) };
1325
+ }, V = (t, e, n = []) => {
1258
1326
  if (_(t))
1259
1327
  return t.groupId === e ? { splitPath: null, side: null } : null;
1260
1328
  if (_(t.a) && t.a.groupId === e)
1261
- return { splitPath: r, side: "a" };
1329
+ return { splitPath: n, side: "a" };
1262
1330
  if (_(t.b) && t.b.groupId === e)
1263
- return { splitPath: r, side: "b" };
1264
- const n = U(t.a, e, [...r, "a"]);
1265
- return n || U(t.b, e, [...r, "b"]);
1266
- }, wt = (t, e, r, n) => {
1267
- const o = n(), s = U(t, e), a = {
1331
+ return { splitPath: n, side: "b" };
1332
+ const r = V(t.a, e, [...n, "a"]);
1333
+ return r || V(t.b, e, [...n, "b"]);
1334
+ }, Tt = (t, e, n, r) => {
1335
+ const o = r(), s = V(t, e), a = {
1268
1336
  type: "split",
1269
- direction: r,
1337
+ direction: n,
1270
1338
  ratio: 0.5,
1271
1339
  a: { type: "group", groupId: e },
1272
1340
  b: { type: "group", groupId: o }
@@ -1276,139 +1344,139 @@ const he = (t, e) => {
1276
1344
  const i = s.splitPath, c = q(t, i);
1277
1345
  if (_(c))
1278
1346
  return { tree: a, newGroupId: o };
1279
- const u = s.side === "a" ? { ...c, a } : { ...c, b: a };
1280
- return { tree: j(t, i, u), newGroupId: o };
1281
- }, Le = (t, e) => {
1282
- const r = U(t, e);
1283
- if (!r || r.splitPath === null)
1347
+ const d = s.side === "a" ? { ...c, a } : { ...c, b: a };
1348
+ return { tree: j(t, i, d), newGroupId: o };
1349
+ }, Ne = (t, e) => {
1350
+ const n = V(t, e);
1351
+ if (!n || n.splitPath === null)
1284
1352
  return { tree: t, survivorGroupId: e };
1285
- const n = r.splitPath, o = q(t, n);
1353
+ const r = n.splitPath, o = q(t, r);
1286
1354
  if (_(o))
1287
1355
  return { tree: t, survivorGroupId: e };
1288
- const s = r.side === "a" ? o.b : o.a, a = j(t, n, s), i = _(s) ? s.groupId : F(s)[0] ?? null;
1356
+ const s = n.side === "a" ? o.b : o.a, a = j(t, r, s), i = _(s) ? s.groupId : Y(s)[0] ?? null;
1289
1357
  return { tree: a, survivorGroupId: i };
1290
- }, He = (t, e, r) => {
1291
- const n = q(t, e);
1292
- if (_(n))
1358
+ }, ze = (t, e, n) => {
1359
+ const r = q(t, e);
1360
+ if (_(r))
1293
1361
  return t;
1294
- const o = { ...n, ratio: M(r, 0.05, 0.95) };
1362
+ const o = { ...r, ratio: M(n, 0.05, 0.95) };
1295
1363
  return j(t, e, o);
1296
1364
  }, Q = (t) => {
1297
1365
  if (Object.keys(t.groups).filter((o) => t.groups[o].tabIds.length === 0).length === 0)
1298
1366
  return t;
1299
- const n = (o, s) => {
1367
+ const r = (o, s) => {
1300
1368
  const a = o.groups[s];
1301
1369
  if (!a || a.tabs.length > 0 || Object.keys(o.groups).length <= 1)
1302
1370
  return o;
1303
- const { tree: c, survivorGroupId: u } = Le(o.tree, s), { [s]: d, ...f } = o.groups, g = F(c), y = o.focusedGroupId === s ? u ?? g[0] ?? null : o.focusedGroupId;
1304
- return { ...o, tree: c, groups: f, groupOrder: g, focusedGroupId: y };
1371
+ const { tree: c, survivorGroupId: d } = Ne(o.tree, s), { [s]: u, ...p } = o.groups, g = Y(c), v = o.focusedGroupId === s ? d ?? g[0] ?? null : o.focusedGroupId;
1372
+ return { ...o, tree: c, groups: p, groupOrder: g, focusedGroupId: v };
1305
1373
  };
1306
- return t.groupOrder.reduce((o, s) => n(o, s), t);
1307
- }, Ne = (t) => ({ id: t, tabIds: [], tabs: [], activeTabId: null }), at = (t, e, r, n) => {
1374
+ return t.groupOrder.reduce((o, s) => r(o, s), t);
1375
+ }, $e = (t) => ({ id: t, tabIds: [], tabs: [], activeTabId: null }), ut = (t, e, n, r) => {
1308
1376
  const o = { ...t.groups }, s = o[e];
1309
1377
  if (!s)
1310
1378
  throw new Error(`Group ${e} does not exist.`);
1311
- const a = { ...t.panels, [r.id]: r }, i = [...s.tabIds, r.id], c = n ? r.id : s.activeTabId ?? r.id, u = i.map((f) => a[f]), d = { ...s, tabIds: i, tabs: u, activeTabId: c };
1312
- return o[e] = d, { ...t, panels: a, groups: o };
1313
- }, $e = (t, e, r) => {
1314
- const n = { ...t.groups }, o = n[e];
1379
+ const a = { ...t.panels, [n.id]: n }, i = [...s.tabIds, n.id], c = r ? n.id : s.activeTabId ?? n.id, d = i.map((p) => a[p]), u = { ...s, tabIds: i, tabs: d, activeTabId: c };
1380
+ return o[e] = u, { ...t, panels: a, groups: o };
1381
+ }, Fe = (t, e, n) => {
1382
+ const r = { ...t.groups }, o = r[e];
1315
1383
  if (!o)
1316
1384
  throw new Error(`Group ${e} does not exist.`);
1317
- const s = o.tabIds.filter((c) => c !== r), a = s.map((c) => t.panels[c]), i = o.activeTabId === r ? s[0] ?? null : o.activeTabId;
1318
- return n[e] = { ...o, tabIds: s, tabs: a, activeTabId: i }, { ...t, groups: n };
1319
- }, ct = (t, e, r, n, o) => {
1320
- const s = t.groups[e], a = t.groups[r];
1385
+ const s = o.tabIds.filter((c) => c !== n), a = s.map((c) => t.panels[c]), i = o.activeTabId === n ? s[0] ?? null : o.activeTabId;
1386
+ return r[e] = { ...o, tabIds: s, tabs: a, activeTabId: i }, { ...t, groups: r };
1387
+ }, lt = (t, e, n, r, o) => {
1388
+ const s = t.groups[e], a = t.groups[n];
1321
1389
  if (!s || !a)
1322
1390
  throw new Error("moveTab: source or target group is missing.");
1323
- const i = { ...t.groups }, c = s.tabIds.filter((f) => f !== n), u = [...a.tabIds.filter((f) => f !== n), n], d = s.activeTabId === n ? c[0] ?? null : s.activeTabId;
1324
- return i[e] = { ...s, tabIds: c, tabs: c.map((f) => t.panels[f]), activeTabId: d }, i[r] = { ...a, tabIds: u, tabs: u.map((f) => t.panels[f]), activeTabId: n }, { ...t, groups: i };
1325
- }, yt = (t, e, r) => {
1326
- const n = t.groups[e];
1327
- if (!n)
1391
+ const i = { ...t.groups }, c = s.tabIds.filter((p) => p !== r), d = [...a.tabIds.filter((p) => p !== r), r], u = s.activeTabId === r ? c[0] ?? null : s.activeTabId;
1392
+ return i[e] = { ...s, tabIds: c, tabs: c.map((p) => t.panels[p]), activeTabId: u }, i[n] = { ...a, tabIds: d, tabs: d.map((p) => t.panels[p]), activeTabId: r }, { ...t, groups: i };
1393
+ }, St = (t, e, n) => {
1394
+ const r = t.groups[e];
1395
+ if (!r)
1328
1396
  throw new Error(`setActiveTab: group ${e} not found.`);
1329
- if (!n.tabIds.some((s) => s === r))
1330
- throw new Error(`setActiveTab: tab ${r} not found in group ${e}.`);
1331
- const o = { ...t.groups, [e]: { ...n, activeTabId: r } };
1397
+ if (!r.tabIds.some((s) => s === n))
1398
+ throw new Error(`setActiveTab: tab ${n} not found in group ${e}.`);
1399
+ const o = { ...t.groups, [e]: { ...r, activeTabId: n } };
1332
1400
  return { ...t, groups: o, focusedGroupId: e };
1333
- }, ut = (t, e, r, n, o) => {
1401
+ }, dt = (t, e, n, r, o) => {
1334
1402
  const s = t.groups[e];
1335
1403
  if (!s)
1336
1404
  throw new Error(`addTabToGroupAtIndex: group ${e} not found.`);
1337
- const a = { ...t.panels, [r.id]: r }, i = s.tabIds.slice(), c = Math.max(0, Math.min(n, i.length));
1338
- i.splice(c, 0, r.id);
1339
- const u = i.map((g) => a[g]), d = o ? r.id : s.activeTabId ?? r.id, f = { ...t.groups, [e]: { ...s, tabIds: i, tabs: u, activeTabId: d } };
1340
- return { ...t, panels: a, groups: f };
1405
+ const a = { ...t.panels, [n.id]: n }, i = s.tabIds.slice(), c = Math.max(0, Math.min(r, i.length));
1406
+ i.splice(c, 0, n.id);
1407
+ const d = i.map((g) => a[g]), u = o ? n.id : s.activeTabId ?? n.id, p = { ...t.groups, [e]: { ...s, tabIds: i, tabs: d, activeTabId: u } };
1408
+ return { ...t, panels: a, groups: p };
1341
1409
  }, N = (t, e) => {
1342
1410
  if (!t.groups[e])
1343
1411
  throw new Error(`setFocusedGroup: group ${e} not found.`);
1344
1412
  return { ...t, focusedGroupId: e };
1345
- }, ze = (t, e) => {
1346
- const r = e - 1, n = t.groupOrder[r];
1347
- return n ? N(t, n) : t;
1348
- }, Xe = (t) => {
1349
- const e = t.groupOrder, r = t.focusedGroupId;
1350
- if (!r) {
1413
+ }, Xe = (t, e) => {
1414
+ const n = e - 1, r = t.groupOrder[n];
1415
+ return r ? N(t, r) : t;
1416
+ }, Ye = (t) => {
1417
+ const e = t.groupOrder, n = t.focusedGroupId;
1418
+ if (!n) {
1351
1419
  const s = e[0];
1352
1420
  return s ? N(t, s) : t;
1353
1421
  }
1354
- const n = e.indexOf(r), o = e[(n + 1) % e.length];
1422
+ const r = e.indexOf(n), o = e[(r + 1) % e.length];
1355
1423
  return N(t, o);
1356
- }, Ye = (t) => {
1357
- const e = t.groupOrder, r = t.focusedGroupId;
1358
- if (!r) {
1424
+ }, je = (t) => {
1425
+ const e = t.groupOrder, n = t.focusedGroupId;
1426
+ if (!n) {
1359
1427
  const s = e[e.length - 1];
1360
1428
  return s ? N(t, s) : t;
1361
1429
  }
1362
- const n = e.indexOf(r), o = e[(n - 1 + e.length) % e.length];
1430
+ const r = e.indexOf(n), o = e[(r - 1 + e.length) % e.length];
1363
1431
  return N(t, o);
1364
- }, Tt = (t, e, r, n) => {
1365
- const { tree: o, newGroupId: s } = wt(t.tree, e, r, n), a = { ...t.groups, [s]: Ne(s) }, i = F(o);
1432
+ }, xt = (t, e, n, r) => {
1433
+ const { tree: o, newGroupId: s } = Tt(t.tree, e, n, r), a = { ...t.groups, [s]: $e(s) }, i = Y(o);
1366
1434
  return { ...t, tree: o, groups: a, groupOrder: i, focusedGroupId: s };
1367
- }, Gr = (t) => {
1368
- const r = { type: "group", groupId: "g_1" }, n = Object.fromEntries(t.map((i) => [i.id, i])), s = { g_1: { id: "g_1", tabIds: t.map((i) => i.id), tabs: t, activeTabId: t[0]?.id ?? null } };
1369
- return { tree: r, panels: n, groups: s, groupOrder: ["g_1"], focusedGroupId: "g_1" };
1370
- }, Fe = l.createContext(null), je = ({ value: t, children: e }) => /* @__PURE__ */ m(Fe.Provider, { value: t, children: e }), xt = l.createContext(null), Ke = () => {
1371
- const t = l.useContext(xt);
1435
+ }, Rn = (t) => {
1436
+ const n = { type: "group", groupId: "g_1" }, r = Object.fromEntries(t.map((i) => [i.id, i])), s = { g_1: { id: "g_1", tabIds: t.map((i) => i.id), tabs: t, activeTabId: t[0]?.id ?? null } };
1437
+ return { tree: n, panels: r, groups: s, groupOrder: ["g_1"], focusedGroupId: "g_1" };
1438
+ }, Ke = l.createContext(null), Ue = ({ value: t, children: e }) => /* @__PURE__ */ m(Ke.Provider, { value: t, children: e }), Gt = l.createContext(null), Ve = () => {
1439
+ const t = l.useContext(Gt);
1372
1440
  if (!t)
1373
1441
  throw new Error("useTree must be used within TreeProvider");
1374
1442
  return t;
1375
- }, Ve = ({ value: t, children: e }) => /* @__PURE__ */ m(xt.Provider, { value: t, children: e }), Ue = l.createContext(null), We = ({ value: t, children: e }) => /* @__PURE__ */ m(Ue.Provider, { value: t, children: e }), X = (t) => {
1376
- const e = _t(t, Number.POSITIVE_INFINITY);
1443
+ }, We = ({ value: t, children: e }) => /* @__PURE__ */ m(Gt.Provider, { value: t, children: e }), qe = l.createContext(null), Ze = ({ value: t, children: e }) => /* @__PURE__ */ m(qe.Provider, { value: t, children: e }), F = (t) => {
1444
+ const e = Bt(t, Number.POSITIVE_INFINITY);
1377
1445
  return M(e, 1);
1378
- }, qe = (t) => typeof t == "object" && t !== null, Ze = (t) => qe(t) ? "rows" in t ? !0 : "cols" in t : !1, Gt = (t) => {
1446
+ }, Je = (t) => typeof t == "object" && t !== null, Qe = (t) => Je(t) ? "rows" in t ? !0 : "cols" in t : !1, Ct = (t) => {
1379
1447
  if (!t)
1380
1448
  return {
1381
1449
  rows: Number.POSITIVE_INFINITY,
1382
1450
  cols: Number.POSITIVE_INFINITY
1383
1451
  };
1384
1452
  if (typeof t == "number") {
1385
- const r = X(t);
1386
- return { rows: r, cols: r };
1453
+ const n = F(t);
1454
+ return { rows: n, cols: n };
1387
1455
  }
1388
- if (Ze(t))
1456
+ if (Qe(t))
1389
1457
  return {
1390
- rows: X(t.rows),
1391
- cols: X(t.cols)
1458
+ rows: F(t.rows),
1459
+ cols: F(t.cols)
1392
1460
  };
1393
1461
  const e = t;
1394
1462
  return {
1395
- rows: X(e.maxHorizontal),
1396
- cols: X(e.maxVertical)
1463
+ rows: F(e.maxHorizontal),
1464
+ cols: F(e.maxVertical)
1397
1465
  };
1398
1466
  }, tt = (t) => {
1399
1467
  if (_(t))
1400
1468
  return { horizontal: 1, vertical: 1 };
1401
- const e = tt(t.a), r = tt(t.b);
1402
- return t.direction === "horizontal" ? { horizontal: e.horizontal + r.horizontal, vertical: Math.max(e.vertical, r.vertical) } : { horizontal: Math.max(e.horizontal, r.horizontal), vertical: e.vertical + r.vertical };
1403
- }, Je = (t, e, r) => {
1404
- const { tree: n } = wt(t, e, r, () => "__preview__");
1405
- return n;
1406
- }, nt = (t, e, r, n) => {
1407
- if (!Number.isFinite(n.rows) && !Number.isFinite(n.cols))
1469
+ const e = tt(t.a), n = tt(t.b);
1470
+ return t.direction === "horizontal" ? { horizontal: e.horizontal + n.horizontal, vertical: Math.max(e.vertical, n.vertical) } : { horizontal: Math.max(e.horizontal, n.horizontal), vertical: e.vertical + n.vertical };
1471
+ }, tn = (t, e, n) => {
1472
+ const { tree: r } = Tt(t, e, n, () => "__preview__");
1473
+ return r;
1474
+ }, rt = (t, e, n, r) => {
1475
+ if (!Number.isFinite(r.rows) && !Number.isFinite(r.cols))
1408
1476
  return !0;
1409
- const o = Je(t, e, r), s = tt(o);
1410
- return !(s.horizontal > n.rows || s.vertical > n.cols);
1411
- }, St = {
1477
+ const o = tn(t, e, n), s = tt(o);
1478
+ return !(s.horizontal > r.rows || s.vertical > r.cols);
1479
+ }, Et = {
1412
1480
  splitFocused: A("panelState/splitFocused", (t) => ({ direction: t })),
1413
1481
  focusGroupIndex: A("panelState/focusGroupIndex", (t) => ({ index1Based: t })),
1414
1482
  focusNextGroup: A("panelState/focusNextGroup"),
@@ -1432,136 +1500,136 @@ const he = (t, e) => {
1432
1500
  (t) => t
1433
1501
  ),
1434
1502
  adjustSplitRatio: A("panelState/adjustSplitRatio", (t) => t)
1435
- }, Qe = (t, e, r) => {
1436
- const n = t.groups[e.fromGroupId], o = t.groups[e.targetGroupId];
1437
- if (!n || !o || !n.tabs.find((f) => f.id === e.tabId))
1503
+ }, en = (t, e, n) => {
1504
+ const r = t.groups[e.fromGroupId], o = t.groups[e.targetGroupId];
1505
+ if (!r || !o || !r.tabs.find((p) => p.id === e.tabId))
1438
1506
  return t;
1439
1507
  if (e.zone === "center" && e.fromGroupId === e.targetGroupId)
1440
- return yt(t, e.fromGroupId, e.tabId);
1508
+ return St(t, e.fromGroupId, e.tabId);
1441
1509
  if (e.zone === "center") {
1442
- const f = ct(t, e.fromGroupId, e.targetGroupId, e.tabId);
1443
- return N(f, e.targetGroupId);
1510
+ const p = lt(t, e.fromGroupId, e.targetGroupId, e.tabId);
1511
+ return N(p, e.targetGroupId);
1444
1512
  }
1445
1513
  const a = e.zone === "left" || e.zone === "right" ? "vertical" : "horizontal";
1446
- if (!nt(t.tree, e.targetGroupId, a, r.splitLimits))
1514
+ if (!rt(t.tree, e.targetGroupId, a, n.splitLimits))
1447
1515
  return t;
1448
- const i = r.createGroupId(), c = Tt(t, e.targetGroupId, a, () => i), u = e.zone === "left" || e.zone === "top" ? e.targetGroupId : i, d = ct(c, e.fromGroupId, u, e.tabId);
1449
- return N(d, u);
1450
- }, tr = (t, e) => {
1451
- const r = t.groups[e.fromGroupId], n = t.groups[e.targetGroupId];
1452
- if (!r || !n || !t.panels[e.tabId])
1516
+ const i = n.createGroupId(), c = xt(t, e.targetGroupId, a, () => i), d = e.zone === "left" || e.zone === "top" ? e.targetGroupId : i, u = lt(c, e.fromGroupId, d, e.tabId);
1517
+ return N(u, d);
1518
+ }, nn = (t, e) => {
1519
+ const n = t.groups[e.fromGroupId], r = t.groups[e.targetGroupId];
1520
+ if (!n || !r || !t.panels[e.tabId])
1453
1521
  return t;
1454
1522
  if (e.fromGroupId === e.targetGroupId) {
1455
- const g = r.tabIds.filter((T) => T !== e.tabId), y = Math.max(0, Math.min(e.targetIndex, g.length)), h = g.slice(0, y).concat([e.tabId], g.slice(y)), w = h.map((T) => t.panels[T]).filter(Boolean), I = { ...t.groups, [e.fromGroupId]: { ...r, tabIds: h, tabs: w } };
1456
- return { ...t, groups: I };
1523
+ const g = n.tabIds.filter((T) => T !== e.tabId), v = Math.max(0, Math.min(e.targetIndex, g.length)), h = g.slice(0, v).concat([e.tabId], g.slice(v)), y = h.map((T) => t.panels[T]).filter(Boolean), w = { ...t.groups, [e.fromGroupId]: { ...n, tabIds: h, tabs: y } };
1524
+ return { ...t, groups: w };
1457
1525
  }
1458
- const s = { ...t.groups }, a = r.tabIds.filter((g) => g !== e.tabId), i = a.map((g) => t.panels[g]);
1526
+ const s = { ...t.groups }, a = n.tabIds.filter((g) => g !== e.tabId), i = a.map((g) => t.panels[g]);
1459
1527
  s[e.fromGroupId] = {
1460
- ...r,
1528
+ ...n,
1461
1529
  tabIds: a,
1462
1530
  tabs: i,
1463
- activeTabId: r.activeTabId === e.tabId ? i[0]?.id ?? null : r.activeTabId
1531
+ activeTabId: n.activeTabId === e.tabId ? i[0]?.id ?? null : n.activeTabId
1464
1532
  };
1465
- const c = n.tabIds.filter((g) => g !== e.tabId), u = Math.max(0, Math.min(e.targetIndex, c.length)), d = c.slice(0, u).concat([e.tabId], c.slice(u)), f = d.map((g) => t.panels[g]).filter(Boolean);
1466
- return s[e.targetGroupId] = { ...n, tabIds: d, tabs: f, activeTabId: e.tabId }, { ...t, groups: s, focusedGroupId: e.targetGroupId };
1467
- }, er = mt(St, {
1468
- splitFocused: (t, e, r) => {
1469
- const n = t.focusedGroupId ?? t.groupOrder[0] ?? null;
1470
- return !n || !nt(t.tree, n, e.payload.direction, r.splitLimits) ? t : Tt(t, n, e.payload.direction, r.createGroupId);
1533
+ const c = r.tabIds.filter((g) => g !== e.tabId), d = Math.max(0, Math.min(e.targetIndex, c.length)), u = c.slice(0, d).concat([e.tabId], c.slice(d)), p = u.map((g) => t.panels[g]).filter(Boolean);
1534
+ return s[e.targetGroupId] = { ...r, tabIds: u, tabs: p, activeTabId: e.tabId }, { ...t, groups: s, focusedGroupId: e.targetGroupId };
1535
+ }, rn = It(Et, {
1536
+ splitFocused: (t, e, n) => {
1537
+ const r = t.focusedGroupId ?? t.groupOrder[0] ?? null;
1538
+ return !r || !rt(t.tree, r, e.payload.direction, n.splitLimits) ? t : xt(t, r, e.payload.direction, n.createGroupId);
1471
1539
  },
1472
- focusGroupIndex: (t, e) => ze(t, e.payload.index1Based),
1473
- focusNextGroup: (t) => Xe(t),
1474
- focusPrevGroup: (t) => Ye(t),
1475
- setActiveTab: (t, e) => yt(t, e.payload.groupId, e.payload.tabId),
1540
+ focusGroupIndex: (t, e) => Xe(t, e.payload.index1Based),
1541
+ focusNextGroup: (t) => Ye(t),
1542
+ focusPrevGroup: (t) => je(t),
1543
+ setActiveTab: (t, e) => St(t, e.payload.groupId, e.payload.tabId),
1476
1544
  addTab: (t, e) => {
1477
- const { groupId: r, tab: n, index: o, makeActive: s } = e.payload;
1478
- return typeof o == "number" ? ut(t, r, n, o, s ?? !0) : at(t, r, n, s ?? !0);
1545
+ const { groupId: n, tab: r, index: o, makeActive: s } = e.payload;
1546
+ return typeof o == "number" ? dt(t, n, r, o, s ?? !0) : ut(t, n, r, s ?? !0);
1479
1547
  },
1480
- addNewTab: (t, e, r) => {
1481
- if (!r.createPanelId)
1548
+ addNewTab: (t, e, n) => {
1549
+ if (!n.createPanelId)
1482
1550
  throw new Error("addNewTab requires PanelSystemProvider.createPanelId");
1483
- const o = { id: r.createPanelId(), title: e.payload.title, render: () => e.payload.title }, { groupId: s, index: a, makeActive: i } = e.payload;
1484
- return typeof a == "number" ? ut(t, s, o, a, i ?? !0) : at(t, s, o, i ?? !0);
1551
+ const o = { id: n.createPanelId(), title: e.payload.title, render: () => e.payload.title }, { groupId: s, index: a, makeActive: i } = e.payload;
1552
+ return typeof a == "number" ? dt(t, s, o, a, i ?? !0) : ut(t, s, o, i ?? !0);
1485
1553
  },
1486
- removeTab: (t, e) => $e(t, e.payload.groupId, e.payload.tabId),
1487
- contentDrop: (t, e, r) => Qe(t, e.payload, r),
1488
- tabDrop: (t, e) => tr(t, e.payload),
1554
+ removeTab: (t, e) => Fe(t, e.payload.groupId, e.payload.tabId),
1555
+ contentDrop: (t, e, n) => en(t, e.payload, n),
1556
+ tabDrop: (t, e) => nn(t, e.payload),
1489
1557
  adjustSplitRatio: (t, e) => {
1490
- const r = q(t.tree, e.payload.path);
1491
- if (_(r))
1558
+ const n = q(t.tree, e.payload.path);
1559
+ if (_(n))
1492
1560
  return t;
1493
- const n = He(t.tree, e.payload.path, r.ratio + e.payload.deltaRatio);
1494
- return { ...t, tree: n };
1561
+ const r = ze(t.tree, e.payload.path, n.ratio + e.payload.deltaRatio);
1562
+ return { ...t, tree: r };
1495
1563
  }
1496
- }), lt = (t, e, r) => {
1497
- const n = er[e.type];
1498
- if (!n)
1564
+ }), pt = (t, e, n) => {
1565
+ const r = rn[e.type];
1566
+ if (!r)
1499
1567
  return t;
1500
- const o = n(t, e, r);
1568
+ const o = r(t, e, n);
1501
1569
  return Q(o);
1502
- }, Et = l.createContext(null), z = () => {
1503
- const t = l.useContext(Et);
1570
+ }, Rt = l.createContext(null), $ = () => {
1571
+ const t = l.useContext(Rt);
1504
1572
  if (!t)
1505
1573
  throw new Error("usePanelSystem must be used within PanelSystemProvider");
1506
1574
  return t;
1507
- }, rr = ({
1575
+ }, on = ({
1508
1576
  initialState: t,
1509
1577
  createGroupId: e,
1510
- createPanelId: r,
1511
- state: n,
1578
+ createPanelId: n,
1579
+ state: r,
1512
1580
  onStateChange: o,
1513
1581
  splitLimits: s,
1514
1582
  children: a
1515
1583
  }) => {
1516
- const i = l.useMemo(() => Q(t), [t]), c = l.useMemo(() => Gt(s), [s]), u = l.useRef({ createGroupId: e, splitLimits: c, createPanelId: r });
1517
- u.current.createGroupId = e, u.current.splitLimits = c, u.current.createPanelId = r;
1518
- const [d, f] = l.useReducer(
1519
- (x, E) => lt(x, E, u.current),
1584
+ const i = l.useMemo(() => Q(t), [t]), c = l.useMemo(() => Ct(s), [s]), d = l.useRef({ createGroupId: e, splitLimits: c, createPanelId: n });
1585
+ d.current.createGroupId = e, d.current.splitLimits = c, d.current.createPanelId = n;
1586
+ const [u, p] = l.useReducer(
1587
+ (S, C) => pt(S, C, d.current),
1520
1588
  i
1521
1589
  ), g = l.useMemo(
1522
- () => n ? Q(n) : d,
1523
- [n, d]
1524
- ), y = l.useRef(g);
1525
- y.current = g;
1526
- const h = n !== void 0, w = l.useCallback(
1527
- (x) => {
1590
+ () => r ? Q(r) : u,
1591
+ [r, u]
1592
+ ), v = l.useRef(g);
1593
+ v.current = g;
1594
+ const h = r !== void 0, y = l.useCallback(
1595
+ (S) => {
1528
1596
  if (h) {
1529
- const E = lt(y.current, x, u.current);
1530
- o?.(E);
1597
+ const C = pt(v.current, S, d.current);
1598
+ o?.(C);
1531
1599
  return;
1532
1600
  }
1533
- f(x);
1601
+ p(S);
1534
1602
  },
1535
- [h, o, f]
1536
- ), I = l.useMemo(() => he(St, w), [w]), T = l.useMemo(
1603
+ [h, o, p]
1604
+ ), w = l.useMemo(() => ve(Et, y), [y]), T = l.useMemo(
1537
1605
  () => ({
1538
- setActiveTab: I.setActiveTab,
1539
- tabDrop: I.tabDrop
1606
+ setActiveTab: w.setActiveTab,
1607
+ tabDrop: w.tabDrop
1540
1608
  }),
1541
- [I]
1609
+ [w]
1542
1610
  ), b = l.useMemo(
1543
1611
  () => ({
1544
- adjustSplitRatio: I.adjustSplitRatio
1612
+ adjustSplitRatio: w.adjustSplitRatio
1545
1613
  }),
1546
- [I]
1547
- ), v = l.useMemo(
1614
+ [w]
1615
+ ), I = l.useMemo(
1548
1616
  () => ({
1549
- focusGroupIndex: I.focusGroupIndex,
1550
- focusNextGroup: I.focusNextGroup,
1551
- focusPrevGroup: I.focusPrevGroup
1617
+ focusGroupIndex: w.focusGroupIndex,
1618
+ focusNextGroup: w.focusNextGroup,
1619
+ focusPrevGroup: w.focusPrevGroup
1552
1620
  }),
1553
- [I]
1554
- ), p = l.useMemo(
1621
+ [w]
1622
+ ), f = l.useMemo(
1555
1623
  () => ({
1556
1624
  state: g,
1557
- dispatch: w,
1558
- actions: I
1625
+ dispatch: y,
1626
+ actions: w
1559
1627
  }),
1560
- [g, w, I]
1628
+ [g, y, w]
1561
1629
  );
1562
- return /* @__PURE__ */ m(Et.Provider, { value: p, children: /* @__PURE__ */ m(je, { value: T, children: /* @__PURE__ */ m(Ve, { value: b, children: /* @__PURE__ */ m(We, { value: v, children: a }) }) }) });
1563
- }, nr = () => {
1564
- const { actions: t } = z();
1630
+ return /* @__PURE__ */ m(Rt.Provider, { value: f, children: /* @__PURE__ */ m(Ue, { value: T, children: /* @__PURE__ */ m(We, { value: b, children: /* @__PURE__ */ m(Ze, { value: I, children: a }) }) }) });
1631
+ }, sn = () => {
1632
+ const { actions: t } = $();
1565
1633
  return l.useMemo(
1566
1634
  () => ({
1567
1635
  splitFocused: (e) => {
@@ -1581,341 +1649,341 @@ const he = (t, e) => {
1581
1649
  }),
1582
1650
  [t]
1583
1651
  );
1584
- }, or = () => {
1585
- const { actions: t } = z(), e = l.useCallback(
1586
- ({ fromGroupId: n, tabId: o, targetGroupId: s, zone: a }) => {
1587
- t.contentDrop({ fromGroupId: n, tabId: o, targetGroupId: s, zone: a });
1652
+ }, an = () => {
1653
+ const { actions: t } = $(), e = l.useCallback(
1654
+ ({ fromGroupId: r, tabId: o, targetGroupId: s, zone: a }) => {
1655
+ t.contentDrop({ fromGroupId: r, tabId: o, targetGroupId: s, zone: a });
1588
1656
  },
1589
1657
  [t]
1590
- ), r = l.useCallback(
1591
- ({ fromGroupId: n, tabId: o, targetGroupId: s, targetIndex: a }) => {
1592
- t.tabDrop({ fromGroupId: n, tabId: o, targetGroupId: s, targetIndex: a });
1658
+ ), n = l.useCallback(
1659
+ ({ fromGroupId: r, tabId: o, targetGroupId: s, targetIndex: a }) => {
1660
+ t.tabDrop({ fromGroupId: r, tabId: o, targetGroupId: s, targetIndex: a });
1593
1661
  },
1594
1662
  [t]
1595
1663
  );
1596
- return { onCommitContentDrop: e, onCommitTabDrop: r };
1597
- }, sr = () => {
1598
- const t = ee(), e = nr();
1664
+ return { onCommitContentDrop: e, onCommitTabDrop: n };
1665
+ }, cn = () => {
1666
+ const t = re(), e = sn();
1599
1667
  return l.useEffect(() => {
1600
- oe(t, e);
1668
+ ie(t, e);
1601
1669
  }, [t, e]), null;
1602
- }, Ct = l.createContext(null), ir = () => {
1603
- const t = l.useContext(Ct);
1670
+ }, Pt = l.createContext(null), un = () => {
1671
+ const t = l.useContext(Pt);
1604
1672
  if (!t)
1605
1673
  throw new Error("useContentRegistry must be used within ContentRegistryProvider");
1606
1674
  return t;
1607
- }, ar = (t) => {
1675
+ }, ln = (t) => {
1608
1676
  const e = document.createElement("div");
1609
1677
  return e.setAttribute("data-panel-wrapper", t), e.style.display = "contents", e;
1610
- }, cr = (t, e, r) => {
1611
- const [n] = l.useState(() => ar(t));
1612
- return rt(() => (n.style.display = r ? "contents" : "none", e && n.parentElement !== e && e.appendChild(n), () => {
1613
- n.parentElement?.removeChild(n);
1614
- }), [n, e, r]), n;
1615
- }, Rt = l.memo(
1616
- ({ panelId: t, content: e, placement: r, containerElement: n }) => {
1617
- const o = r?.isActive ?? !1, s = cr(t, n, o);
1618
- return Qt(
1678
+ }, dn = (t, e, n) => {
1679
+ const [r] = l.useState(() => ln(t));
1680
+ return nt(() => (r.style.display = n ? "contents" : "none", e && r.parentElement !== e && e.appendChild(r), () => {
1681
+ r.parentElement?.removeChild(r);
1682
+ }), [r, e, n]), r;
1683
+ }, Dt = l.memo(
1684
+ ({ panelId: t, content: e, placement: n, containerElement: r }) => {
1685
+ const o = n?.isActive ?? !1, s = dn(t, r, o);
1686
+ return ee(
1619
1687
  /* @__PURE__ */ m(l.Activity, { mode: o ? "visible" : "hidden", children: e }),
1620
1688
  s
1621
1689
  );
1622
1690
  }
1623
1691
  );
1624
- Rt.displayName = "PanelContentHost";
1625
- const ur = ({
1692
+ Dt.displayName = "PanelContentHost";
1693
+ const pn = ({
1626
1694
  children: t,
1627
1695
  panels: e,
1628
- placements: r
1696
+ placements: n
1629
1697
  }) => {
1630
- const [n, o] = l.useState(/* @__PURE__ */ new Map()), s = l.useRef(/* @__PURE__ */ new Map()), a = l.useCallback((d, f) => {
1698
+ const [r, o] = l.useState(/* @__PURE__ */ new Map()), s = l.useRef(/* @__PURE__ */ new Map()), a = l.useCallback((u, p) => {
1631
1699
  o((g) => {
1632
- const y = new Map(g);
1633
- return f ? y.set(d, f) : y.delete(d), y;
1700
+ const v = new Map(g);
1701
+ return p ? v.set(u, p) : v.delete(u), v;
1634
1702
  });
1635
1703
  }, []), i = l.useMemo(
1636
1704
  () => ({ registerContentContainer: a }),
1637
1705
  [a]
1638
- ), c = l.useCallback((d, f) => {
1639
- const g = s.current.get(d);
1706
+ ), c = l.useCallback((u, p) => {
1707
+ const g = s.current.get(u);
1640
1708
  if (g)
1641
1709
  return g;
1642
- const y = f.render(f.id);
1643
- return s.current.set(d, y), y;
1644
- }, []), u = Object.keys(e);
1645
- return /* @__PURE__ */ H(Ct.Provider, { value: i, children: [
1710
+ const v = p.render(p.id);
1711
+ return s.current.set(u, v), v;
1712
+ }, []), d = Object.keys(e);
1713
+ return /* @__PURE__ */ H(Pt.Provider, { value: i, children: [
1646
1714
  t,
1647
- u.map((d) => {
1648
- const f = e[d];
1649
- if (!f)
1715
+ d.map((u) => {
1716
+ const p = e[u];
1717
+ if (!p)
1650
1718
  return null;
1651
- const g = r[d] ?? null, y = g ? n.get(g.groupId) ?? null : null, h = c(d, f);
1719
+ const g = n[u] ?? null, v = g ? r.get(g.groupId) ?? null : null, h = c(u, p);
1652
1720
  return /* @__PURE__ */ m(
1653
- Rt,
1721
+ Dt,
1654
1722
  {
1655
- panelId: d,
1723
+ panelId: u,
1656
1724
  content: h,
1657
1725
  placement: g,
1658
- containerElement: y
1726
+ containerElement: v
1659
1727
  },
1660
- d
1728
+ u
1661
1729
  );
1662
1730
  })
1663
1731
  ] });
1664
- }, lr = ({
1732
+ }, fn = ({
1665
1733
  children: t,
1666
1734
  emptyContentComponent: e,
1667
- doubleClickToAdd: r
1735
+ doubleClickToAdd: n
1668
1736
  }) => {
1669
- const n = W(), { state: o, actions: s } = z(), { registerContentContainer: a } = ir(), i = l.useCallback(() => l.createElement("div", { style: { color: "#888", fontSize: 12, padding: 12 } }, "No tabs"), []), c = e ?? i, u = l.useCallback(
1737
+ const r = W(), { state: o, actions: s } = $(), { registerContentContainer: a } = un(), i = l.useCallback(() => l.createElement("div", { style: { color: "#888", fontSize: 12, padding: 12 } }, "No tabs"), []), c = e ?? i, d = l.useCallback(
1670
1738
  (T) => {
1671
1739
  const b = o.groups[T];
1672
1740
  if (!b)
1673
1741
  return null;
1674
- const v = b.tabIds.map((p) => o.panels[p]).filter(Boolean);
1675
- return { ...b, tabs: v };
1742
+ const I = b.tabIds.map((f) => o.panels[f]).filter(Boolean);
1743
+ return { ...b, tabs: I };
1676
1744
  },
1677
1745
  [o.groups, o.panels]
1678
- ), d = l.useCallback(
1746
+ ), u = l.useCallback(
1679
1747
  (T) => {
1680
1748
  const b = o.groups[T];
1681
1749
  return !b || b.tabIds.length === 0 ? /* @__PURE__ */ m(c, {}) : null;
1682
1750
  },
1683
1751
  [o.groups, c]
1684
- ), f = l.useCallback((T, b) => {
1752
+ ), p = l.useCallback((T, b) => {
1685
1753
  s.setActiveTab(T, b);
1686
1754
  }, [s]), g = l.useCallback((T) => {
1687
1755
  s.addNewTab({ groupId: T, title: "New Tab", makeActive: !0 });
1688
- }, [s]), y = l.useCallback((T, b) => {
1756
+ }, [s]), v = l.useCallback((T, b) => {
1689
1757
  s.removeTab(T, b);
1690
- }, [s]), h = l.useCallback((T, b, v) => {
1691
- s.setActiveTab(b, T), n.onStartTabDrag(T, b, v);
1692
- }, [s, n]), w = l.useCallback((T, b) => {
1693
- const v = o.groups[T];
1694
- !v || !v.activeTabId || n.onStartContentDrag(T, v.activeTabId, b);
1695
- }, [o.groups, n]), I = l.useMemo(
1696
- () => ({ getGroup: u, getGroupContent: d, onClickTab: f, onAddTab: g, onCloseTab: y, onStartTabDrag: h, onStartContentDrag: w, doubleClickToAdd: r, registerContentContainer: a }),
1697
- [u, d, f, g, y, h, w, r, a]
1758
+ }, [s]), h = l.useCallback((T, b, I) => {
1759
+ s.setActiveTab(b, T), r.onStartTabDrag(T, b, I);
1760
+ }, [s, r]), y = l.useCallback((T, b) => {
1761
+ const I = o.groups[T];
1762
+ !I || !I.activeTabId || r.onStartContentDrag(T, I.activeTabId, b);
1763
+ }, [o.groups, r]), w = l.useMemo(
1764
+ () => ({ getGroup: d, getGroupContent: u, onClickTab: p, onAddTab: g, onCloseTab: v, onStartTabDrag: h, onStartContentDrag: y, doubleClickToAdd: n, registerContentContainer: a }),
1765
+ [d, u, p, g, v, h, y, n, a]
1698
1766
  );
1699
- return /* @__PURE__ */ m(ue, { value: I, children: t });
1700
- }, dr = ({
1767
+ return /* @__PURE__ */ m(de, { value: w, children: t });
1768
+ }, gn = ({
1701
1769
  children: t,
1702
1770
  emptyContentComponent: e,
1703
- doubleClickToAdd: r
1771
+ doubleClickToAdd: n
1704
1772
  }) => {
1705
- const { state: n } = z(), o = l.useMemo(() => {
1773
+ const { state: r } = $(), o = l.useMemo(() => {
1706
1774
  const s = {};
1707
- for (const [a, i] of Object.entries(n.groups))
1775
+ for (const [a, i] of Object.entries(r.groups))
1708
1776
  for (const c of i.tabIds)
1709
1777
  s[c] = {
1710
1778
  groupId: a,
1711
1779
  isActive: c === i.activeTabId
1712
1780
  };
1713
1781
  return s;
1714
- }, [n.groups]);
1715
- return /* @__PURE__ */ m(ur, { panels: n.panels, placements: o, children: /* @__PURE__ */ m(lr, { emptyContentComponent: e, doubleClickToAdd: r, children: t }) });
1716
- }, Y = (t, e, r, n) => {
1782
+ }, [r.groups]);
1783
+ return /* @__PURE__ */ m(pn, { panels: r.panels, placements: o, children: /* @__PURE__ */ m(fn, { emptyContentComponent: e, doubleClickToAdd: n, children: t }) });
1784
+ }, X = (t, e, n, r) => {
1717
1785
  if (_(t))
1718
- return n;
1719
- const o = t.direction, s = o === "vertical" ? r.x + r.w * t.ratio : r.y + r.h * t.ratio;
1720
- if (n.push({ path: e, direction: o, parentRect: r, linePos: s }), o === "vertical") {
1721
- const c = r.w * t.ratio, u = r.w - c;
1722
- return Y(t.a, [...e, "a"], { x: r.x, y: r.y, w: c, h: r.h }, n), Y(t.b, [...e, "b"], { x: r.x + c, y: r.y, w: u, h: r.h }, n), n;
1786
+ return r;
1787
+ const o = t.direction, s = o === "vertical" ? n.x + n.w * t.ratio : n.y + n.h * t.ratio;
1788
+ if (r.push({ path: e, direction: o, parentRect: n, linePos: s }), o === "vertical") {
1789
+ const c = n.w * t.ratio, d = n.w - c;
1790
+ return X(t.a, [...e, "a"], { x: n.x, y: n.y, w: c, h: n.h }, r), X(t.b, [...e, "b"], { x: n.x + c, y: n.y, w: d, h: n.h }, r), r;
1723
1791
  }
1724
- const a = r.h * t.ratio, i = r.h - a;
1725
- return Y(t.a, [...e, "a"], { x: r.x, y: r.y, w: r.w, h: a }, n), Y(t.b, [...e, "b"], { x: r.x, y: r.y + a, w: r.w, h: i }, n), n;
1726
- }, pr = ({ containerRef: t }) => {
1727
- const { state: e } = z(), { adjustSplitRatio: r } = Ke(), n = l.useMemo(() => Y(e.tree, [], { x: 0, y: 0, w: 100, h: 100 }, []), [e.tree]), [o, s] = l.useState(null);
1728
- if (rt(() => {
1792
+ const a = n.h * t.ratio, i = n.h - a;
1793
+ return X(t.a, [...e, "a"], { x: n.x, y: n.y, w: n.w, h: a }, r), X(t.b, [...e, "b"], { x: n.x, y: n.y + a, w: n.w, h: i }, r), r;
1794
+ }, bn = ({ containerRef: t }) => {
1795
+ const { state: e } = $(), { adjustSplitRatio: n } = Ve(), r = l.useMemo(() => X(e.tree, [], { x: 0, y: 0, w: 100, h: 100 }, []), [e.tree]), [o, s] = l.useState(null);
1796
+ if (nt(() => {
1729
1797
  const i = t.current;
1730
1798
  if (!i)
1731
1799
  return;
1732
1800
  const c = () => {
1733
- const y = i.getBoundingClientRect();
1734
- s({ left: y.left, top: y.top, width: y.width, height: y.height });
1801
+ const v = i.getBoundingClientRect();
1802
+ s({ left: v.left, top: v.top, width: v.width, height: v.height });
1735
1803
  };
1736
1804
  c();
1737
- function u() {
1805
+ function d() {
1738
1806
  try {
1739
- const y = window.ResizeObserver;
1740
- return typeof y == "function" ? y : null;
1807
+ const v = window.ResizeObserver;
1808
+ return typeof v == "function" ? v : null;
1741
1809
  } catch {
1742
1810
  return null;
1743
1811
  }
1744
1812
  }
1745
- const d = u(), f = d ? new d(() => c()) : null;
1746
- f && f.observe(i);
1813
+ const u = d(), p = u ? new u(() => c()) : null;
1814
+ p && p.observe(i);
1747
1815
  const g = () => c();
1748
1816
  return window.addEventListener("scroll", g, !0), () => {
1749
- window.removeEventListener("scroll", g, !0), f && f.disconnect();
1817
+ window.removeEventListener("scroll", g, !0), p && p.disconnect();
1750
1818
  };
1751
1819
  }, [t, e.tree]), !o)
1752
1820
  return null;
1753
1821
  const a = (i, c) => {
1754
- const u = {
1822
+ const d = {
1755
1823
  left: o.left + o.width * i.parentRect.x / 100,
1756
1824
  top: o.top + o.height * i.parentRect.y / 100,
1757
1825
  width: o.width * i.parentRect.w / 100,
1758
1826
  height: o.height * i.parentRect.h / 100
1759
- }, d = Jt;
1827
+ }, u = te;
1760
1828
  if (i.direction === "vertical") {
1761
- const h = u.left + u.width * (i.linePos - i.parentRect.x) / i.parentRect.w, w = {
1829
+ const h = d.left + d.width * (i.linePos - i.parentRect.x) / i.parentRect.w, y = {
1762
1830
  position: "fixed",
1763
- left: `calc(${Math.round(h)}px - ${d} / 2)`,
1764
- top: Math.round(u.top),
1765
- width: d,
1766
- height: Math.round(u.height),
1831
+ left: `calc(${Math.round(h)}px - ${u} / 2)`,
1832
+ top: Math.round(d.top),
1833
+ width: u,
1834
+ height: Math.round(d.height),
1767
1835
  cursor: "col-resize",
1768
1836
  pointerEvents: "auto"
1769
1837
  };
1770
- return /* @__PURE__ */ m("div", { style: w, children: /* @__PURE__ */ m(ot, { direction: "vertical", onResize: (T) => {
1771
- const b = o.width * i.parentRect.w / 100, v = b === 0 ? 0 : T / b;
1772
- r({ path: i.path, deltaRatio: v });
1838
+ return /* @__PURE__ */ m("div", { style: y, children: /* @__PURE__ */ m(ot, { direction: "vertical", onResize: (T) => {
1839
+ const b = o.width * i.parentRect.w / 100, I = b === 0 ? 0 : T / b;
1840
+ n({ path: i.path, deltaRatio: I });
1773
1841
  } }) }, `split-${c}`);
1774
1842
  }
1775
- const f = u.top + u.height * (i.linePos - i.parentRect.y) / i.parentRect.h, g = {
1843
+ const p = d.top + d.height * (i.linePos - i.parentRect.y) / i.parentRect.h, g = {
1776
1844
  position: "fixed",
1777
- left: Math.round(u.left),
1778
- top: `calc(${Math.round(f)}px - ${d} / 2)`,
1779
- width: Math.round(u.width),
1780
- height: d,
1845
+ left: Math.round(d.left),
1846
+ top: `calc(${Math.round(p)}px - ${u} / 2)`,
1847
+ width: Math.round(d.width),
1848
+ height: u,
1781
1849
  cursor: "row-resize",
1782
1850
  pointerEvents: "auto"
1783
1851
  };
1784
1852
  return /* @__PURE__ */ m("div", { style: g, children: /* @__PURE__ */ m(ot, { direction: "horizontal", onResize: (h) => {
1785
- const w = o.height * i.parentRect.h / 100, I = w === 0 ? 0 : h / w;
1786
- r({ path: i.path, deltaRatio: I });
1853
+ const y = o.height * i.parentRect.h / 100, w = y === 0 ? 0 : h / y;
1854
+ n({ path: i.path, deltaRatio: w });
1787
1855
  } }) }, `split-${c}`);
1788
1856
  };
1789
- return /* @__PURE__ */ m("div", { style: { position: "fixed", inset: 0, pointerEvents: "none" }, children: n.map((i, c) => a(i, c)) });
1790
- }, fr = {
1857
+ return /* @__PURE__ */ m("div", { style: { position: "fixed", inset: 0, pointerEvents: "none" }, children: r.map((i, c) => a(i, c)) });
1858
+ }, hn = {
1791
1859
  position: "relative",
1792
1860
  display: "flex",
1793
1861
  width: "100%",
1794
1862
  height: "100%"
1795
- }, br = ({
1863
+ }, mn = ({
1796
1864
  state: t,
1797
1865
  layoutMode: e,
1798
- gridTracksInteractive: r,
1799
- view: n,
1866
+ gridTracksInteractive: n,
1867
+ view: r,
1800
1868
  tabBarComponent: o,
1801
1869
  panelGroupComponent: s
1802
1870
  }) => {
1803
- const a = (c) => n ? /* @__PURE__ */ m(n, { groupId: c }) : /* @__PURE__ */ m(Ge, { id: c, TabBarComponent: o, PanelGroupComponent: s });
1871
+ const a = (c) => r ? /* @__PURE__ */ m(r, { groupId: c }) : /* @__PURE__ */ m(Ce, { id: c, TabBarComponent: o, PanelGroupComponent: s });
1804
1872
  if (e === "grid") {
1805
- const c = ae(t, a, !!r);
1873
+ const c = ue(t, a, !!n);
1806
1874
  return /* @__PURE__ */ m(st, { config: c.config, layers: c.layers });
1807
1875
  }
1808
- const i = ie(t, a);
1876
+ const i = ce(t, a);
1809
1877
  return /* @__PURE__ */ m(st, { config: i.config, layers: i.layers });
1810
- }, gr = ({
1878
+ }, vn = ({
1811
1879
  containerRef: t,
1812
1880
  layoutMode: e,
1813
- gridTracksInteractive: r,
1814
- dragThresholdPx: n,
1881
+ gridTracksInteractive: n,
1882
+ dragThresholdPx: r,
1815
1883
  view: o,
1816
1884
  style: s,
1817
1885
  className: a,
1818
1886
  tabBarComponent: i,
1819
1887
  panelGroupComponent: c,
1820
- splitLimits: u,
1821
- emptyContentComponent: d,
1822
- doubleClickToAdd: f
1888
+ splitLimits: d,
1889
+ emptyContentComponent: u,
1890
+ doubleClickToAdd: p
1823
1891
  }) => {
1824
- const { state: g } = z(), { onCommitContentDrop: y, onCommitTabDrop: h } = or(), w = l.useMemo(() => ({ ...fr, ...s }), [s]), I = l.useCallback(
1892
+ const { state: g } = $(), { onCommitContentDrop: v, onCommitTabDrop: h } = an(), y = l.useMemo(() => ({ ...hn, ...s }), [s]), w = l.useCallback(
1825
1893
  ({ targetGroupId: T, zone: b }) => {
1826
1894
  if (b === "center")
1827
1895
  return !0;
1828
- const v = b === "left" || b === "right" ? "vertical" : "horizontal";
1829
- return nt(g.tree, T, v, u);
1896
+ const I = b === "left" || b === "right" ? "vertical" : "horizontal";
1897
+ return rt(g.tree, T, I, d);
1830
1898
  },
1831
- [g.tree, u]
1899
+ [g.tree, d]
1832
1900
  );
1833
- return /* @__PURE__ */ m(le, { children: /* @__PURE__ */ H(
1834
- Ie,
1901
+ return /* @__PURE__ */ m(pe, { children: /* @__PURE__ */ H(
1902
+ ye,
1835
1903
  {
1836
1904
  containerRef: t,
1837
- dragThresholdPx: n,
1838
- onCommitContentDrop: y,
1905
+ dragThresholdPx: r,
1906
+ onCommitContentDrop: v,
1839
1907
  onCommitTabDrop: h,
1840
- isContentZoneAllowed: I,
1908
+ isContentZoneAllowed: w,
1841
1909
  children: [
1842
- /* @__PURE__ */ m(dr, { emptyContentComponent: d, doubleClickToAdd: f, children: /* @__PURE__ */ m("div", { ref: t, className: a, style: w, children: /* @__PURE__ */ m(
1843
- br,
1910
+ /* @__PURE__ */ m(gn, { emptyContentComponent: u, doubleClickToAdd: p, children: /* @__PURE__ */ m("div", { ref: t, className: a, style: y, children: /* @__PURE__ */ m(
1911
+ mn,
1844
1912
  {
1845
1913
  state: g,
1846
1914
  layoutMode: e,
1847
- gridTracksInteractive: r,
1915
+ gridTracksInteractive: n,
1848
1916
  view: o,
1849
1917
  tabBarComponent: i,
1850
1918
  panelGroupComponent: c
1851
1919
  }
1852
1920
  ) }) }),
1853
- /* @__PURE__ */ m(pr, { containerRef: t }),
1854
- /* @__PURE__ */ m(hr, {})
1921
+ /* @__PURE__ */ m(bn, { containerRef: t }),
1922
+ /* @__PURE__ */ m(In, {})
1855
1923
  ]
1856
1924
  }
1857
1925
  ) });
1858
- }, hr = () => {
1926
+ }, In = () => {
1859
1927
  const t = W();
1860
1928
  return /* @__PURE__ */ H(et, { children: [
1861
- /* @__PURE__ */ m(Ae, { suggest: t.suggest }),
1862
- /* @__PURE__ */ m(Be, {})
1929
+ /* @__PURE__ */ m(Me, { suggest: t.suggest }),
1930
+ /* @__PURE__ */ m(He, {})
1863
1931
  ] });
1864
- }, Sr = ({
1932
+ }, Pn = ({
1865
1933
  initialState: t,
1866
1934
  createGroupId: e,
1867
- createPanelId: r,
1868
- layoutMode: n,
1935
+ createPanelId: n,
1936
+ layoutMode: r,
1869
1937
  gridTracksInteractive: o,
1870
1938
  dragThresholdPx: s,
1871
1939
  view: a,
1872
1940
  emptyContentComponent: i,
1873
1941
  state: c,
1874
- onStateChange: u,
1875
- className: d,
1876
- style: f,
1942
+ onStateChange: d,
1943
+ className: u,
1944
+ style: p,
1877
1945
  tabBarComponent: g,
1878
- panelGroupComponent: y,
1946
+ panelGroupComponent: v,
1879
1947
  splitLimits: h,
1880
- doubleClickToAdd: w
1948
+ doubleClickToAdd: y
1881
1949
  }) => {
1882
1950
  if (!t)
1883
1951
  throw new Error("PanelSystem requires initialState.");
1884
1952
  if (!e)
1885
1953
  throw new Error("PanelSystem requires explicit createGroupId function.");
1886
- if (!n)
1954
+ if (!r)
1887
1955
  throw new Error("PanelSystem requires explicit layoutMode ('absolute' | 'grid').");
1888
- if (n === "grid" && o === void 0)
1956
+ if (r === "grid" && o === void 0)
1889
1957
  throw new Error("PanelSystem(layoutMode='grid') requires explicit 'gridTracksInteractive' flag.");
1890
1958
  if (s === void 0)
1891
1959
  throw new Error("PanelSystem requires explicit 'dragThresholdPx' value.");
1892
- const I = l.useRef(null), T = l.useMemo(() => Gt(h), [h]);
1960
+ const w = l.useRef(null), T = l.useMemo(() => Ct(h), [h]);
1893
1961
  return /* @__PURE__ */ m(
1894
- rr,
1962
+ on,
1895
1963
  {
1896
1964
  initialState: t,
1897
1965
  createGroupId: e,
1898
- createPanelId: r,
1966
+ createPanelId: n,
1899
1967
  state: c,
1900
- onStateChange: u,
1968
+ onStateChange: d,
1901
1969
  splitLimits: h,
1902
- children: /* @__PURE__ */ H(ne, { children: [
1903
- /* @__PURE__ */ m(sr, {}),
1970
+ children: /* @__PURE__ */ H(se, { children: [
1971
+ /* @__PURE__ */ m(cn, {}),
1904
1972
  /* @__PURE__ */ m(
1905
- gr,
1973
+ vn,
1906
1974
  {
1907
- containerRef: I,
1908
- layoutMode: n,
1975
+ containerRef: w,
1976
+ layoutMode: r,
1909
1977
  gridTracksInteractive: o,
1910
1978
  dragThresholdPx: s,
1911
1979
  view: a,
1912
- style: f,
1913
- className: d,
1980
+ style: p,
1981
+ className: u,
1914
1982
  tabBarComponent: g,
1915
- panelGroupComponent: y,
1983
+ panelGroupComponent: v,
1916
1984
  splitLimits: T,
1917
1985
  emptyContentComponent: i,
1918
- doubleClickToAdd: w
1986
+ doubleClickToAdd: y
1919
1987
  }
1920
1988
  )
1921
1989
  ] })
@@ -1923,16 +1991,18 @@ const ur = ({
1923
1991
  );
1924
1992
  };
1925
1993
  export {
1926
- Mr as CSS_VAR_PREFIX,
1927
- Rr as Drawer,
1928
- Pr as DrawerLayers,
1994
+ Hn as CSS_VAR_PREFIX,
1995
+ kn as Drawer,
1996
+ Mn as DrawerLayers,
1997
+ _n as FloatingWindow,
1929
1998
  st as GridLayout,
1930
- Tr as HorizontalDivider,
1931
- Sr as PanelSystem,
1999
+ Gn as HorizontalDivider,
2000
+ Pn as PanelSystem,
1932
2001
  ot as ResizeHandle,
1933
- Gr as buildInitialState,
1934
- Dr as runTransition,
1935
- xr as useLayerDragHandle,
1936
- Ar as useTransitionState
2002
+ Rn as buildInitialState,
2003
+ On as runTransition,
2004
+ En as useFloatingState,
2005
+ Cn as useLayerDragHandle,
2006
+ Bn as useTransitionState
1937
2007
  };
1938
2008
  //# sourceMappingURL=index.js.map