react-panel-layout 0.5.0 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/FloatingPanelFrame-D9Cp2al1.cjs +2 -0
  2. package/dist/FloatingPanelFrame-D9Cp2al1.cjs.map +1 -0
  3. package/dist/FloatingPanelFrame-lLg-Lpg7.js +95 -0
  4. package/dist/FloatingPanelFrame-lLg-Lpg7.js.map +1 -0
  5. package/dist/GridLayout-BQQ63eA1.cjs +2 -0
  6. package/dist/GridLayout-BQQ63eA1.cjs.map +1 -0
  7. package/dist/{GridLayout-tpSM0iM-.js → GridLayout-CJTKq7Mp.js} +465 -460
  8. package/dist/GridLayout-CJTKq7Mp.js.map +1 -0
  9. package/dist/PanelSystemContext.d.ts +9 -0
  10. package/dist/components/grid/GridLayerList.d.ts +3 -0
  11. package/dist/components/paneling/FloatingPanelFrame.d.ts +4 -0
  12. package/dist/config.cjs +1 -1
  13. package/dist/config.js +1 -1
  14. package/dist/constants/styles.d.ts +3 -1
  15. package/dist/floating.cjs +1 -1
  16. package/dist/floating.js +1 -1
  17. package/dist/hooks/ContentCacheContext.d.ts +59 -0
  18. package/dist/hooks/useContainerScroll.d.ts +23 -0
  19. package/dist/hooks/useContentCache.d.ts +67 -0
  20. package/dist/hooks/useDocumentScroll.d.ts +13 -0
  21. package/dist/hooks/useScrollContainer.d.ts +21 -0
  22. package/dist/index.cjs +2 -2
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.js +442 -440
  25. package/dist/index.js.map +1 -1
  26. package/dist/modules/pivot/types.d.ts +6 -0
  27. package/dist/pivot.cjs +1 -1
  28. package/dist/pivot.js +1 -1
  29. package/dist/sticky-header/StickyHeader.d.ts +53 -0
  30. package/dist/sticky-header/index.d.ts +7 -0
  31. package/dist/sticky-header/types.d.ts +50 -0
  32. package/dist/sticky-header.cjs +2 -0
  33. package/dist/sticky-header.cjs.map +1 -0
  34. package/dist/sticky-header.js +198 -0
  35. package/dist/sticky-header.js.map +1 -0
  36. package/dist/styles-CA2_zLZt.js +52 -0
  37. package/dist/{styles-DcG3aIFx.cjs.map → styles-CA2_zLZt.js.map} +1 -1
  38. package/dist/styles-PsqGOEJP.cjs +2 -0
  39. package/dist/styles-PsqGOEJP.cjs.map +1 -0
  40. package/dist/types.d.ts +12 -0
  41. package/dist/useIsomorphicLayoutEffect-DGRNF4Lf.cjs +2 -0
  42. package/dist/useIsomorphicLayoutEffect-DGRNF4Lf.cjs.map +1 -0
  43. package/dist/useIsomorphicLayoutEffect-DhmEnmZ_.js +6 -0
  44. package/dist/useIsomorphicLayoutEffect-DhmEnmZ_.js.map +1 -0
  45. package/dist/usePivot-7ctin_P_.cjs +2 -0
  46. package/dist/usePivot-7ctin_P_.cjs.map +1 -0
  47. package/dist/usePivot-CgQxB8rc.js +124 -0
  48. package/dist/usePivot-CgQxB8rc.js.map +1 -0
  49. package/package.json +6 -1
  50. package/dist/FloatingPanelFrame-DDT6aING.js +0 -66
  51. package/dist/FloatingPanelFrame-DDT6aING.js.map +0 -1
  52. package/dist/FloatingPanelFrame-DrYwgI9f.cjs +0 -2
  53. package/dist/FloatingPanelFrame-DrYwgI9f.cjs.map +0 -1
  54. package/dist/GridLayout-DC7fCmcI.cjs +0 -2
  55. package/dist/GridLayout-DC7fCmcI.cjs.map +0 -1
  56. package/dist/GridLayout-tpSM0iM-.js.map +0 -1
  57. package/dist/styles-DcG3aIFx.cjs +0 -2
  58. package/dist/styles-w0ZixggV.js +0 -51
  59. package/dist/styles-w0ZixggV.js.map +0 -1
  60. package/dist/usePivot-C8q0pMgW.cjs +0 -2
  61. package/dist/usePivot-C8q0pMgW.cjs.map +0 -1
  62. package/dist/usePivot-z9gumDf-.js +0 -97
  63. package/dist/usePivot-z9gumDf-.js.map +0 -1
@@ -1,10 +1,11 @@
1
- import { jsxs as A, Fragment as H, jsx as h } from "react/jsx-runtime";
1
+ import { jsxs as H, Fragment as _, jsx as h } from "react/jsx-runtime";
2
2
  import * as i from "react";
3
- import { F as Pt, e as yt, a as Lt, b as Mt, d as Vt } from "./FloatingPanelFrame-DDT6aING.js";
4
- import { C as Xt, D as Ut, m as jt, n as Zt, o as Kt, p as qt, q as Jt, r as Qt, G as B, s as I, t as te, u as ee, v as ne, R as ut, w as oe, x as J } from "./styles-w0ZixggV.js";
5
- import { createPortal as re } from "react-dom";
6
- import { u as se, a as Dt } from "./usePivot-z9gumDf-.js";
7
- const ie = () => {
3
+ import { F as Pt, e as yt, a as Lt, b as Mt, f as Dt, d as Ut } from "./FloatingPanelFrame-lLg-Lpg7.js";
4
+ import { C as jt, D as Kt, o as Zt, p as qt, q as Jt, r as Qt, s as te, G as Y, t as T, u as ee, v as ne, w as oe, R as ut, x as re, y as Q } from "./styles-CA2_zLZt.js";
5
+ import { a as se, u as ie } from "./usePivot-CgQxB8rc.js";
6
+ import { createPortal as ae } from "react-dom";
7
+ import { u as It } from "./useIsomorphicLayoutEffect-DhmEnmZ_.js";
8
+ const ce = () => {
8
9
  const t = /* @__PURE__ */ new Map();
9
10
  return (e) => {
10
11
  if (!e)
@@ -15,10 +16,10 @@ const ie = () => {
15
16
  const o = t.size;
16
17
  return t.set(e, o), o;
17
18
  };
18
- }, ae = ie(), Q = /* @__PURE__ */ new Map(), ce = (t) => {
19
- const e = `ovs-threshold:${t.threshold}-rootMargin:${t.rootMargin}-root:${ae(t.root)}`;
20
- if (Q.has(e))
21
- return Q.get(e);
19
+ }, ue = ce(), tt = /* @__PURE__ */ new Map(), le = (t) => {
20
+ const e = `ovs-threshold:${t.threshold}-rootMargin:${t.rootMargin}-root:${ue(t.root)}`;
21
+ if (tt.has(e))
22
+ return tt.get(e);
22
23
  const n = new class {
23
24
  #t = /* @__PURE__ */ new Map();
24
25
  #e = new IntersectionObserver((o) => {
@@ -33,7 +34,7 @@ const ie = () => {
33
34
  };
34
35
  }
35
36
  }();
36
- return Q.set(e, n), n;
37
+ return tt.set(e, n), n;
37
38
  }, lt = Object.freeze({
38
39
  x: 0,
39
40
  y: 0,
@@ -44,15 +45,15 @@ const ie = () => {
44
45
  bottom: 0,
45
46
  left: 0
46
47
  });
47
- function ue(t, { threshold: e = 0, rootMargin: n = "0px", root: o = null }) {
48
+ function de(t, { threshold: e = 0, rootMargin: n = "0px", root: o = null }) {
48
49
  const [r, s] = i.useState(null);
49
50
  return i.useEffect(() => {
50
- const c = t.current;
51
- return c ? ce({
51
+ const u = t.current;
52
+ return u ? le({
52
53
  threshold: e,
53
54
  rootMargin: n,
54
55
  root: o
55
- }).observe(c, (a) => {
56
+ }).observe(u, (a) => {
56
57
  s({
57
58
  isIntersecting: a.isIntersecting,
58
59
  boundingClientRect: a.boundingClientRect,
@@ -76,8 +77,8 @@ function ue(t, { threshold: e = 0, rootMargin: n = "0px", root: o = null }) {
76
77
  const dt = {
77
78
  position: "fixed",
78
79
  inset: 0,
79
- background: Xt
80
- }, le = {
80
+ background: jt
81
+ }, fe = {
81
82
  willChange: "transform"
82
83
  }, ft = {
83
84
  left: {
@@ -104,44 +105,45 @@ const dt = {
104
105
  right: 0,
105
106
  transform: "translateY(100%)"
106
107
  }
107
- }, de = (t, e, n) => t === "none" ? void 0 : `transform ${e ?? Ut} ${n ?? jt}`, fe = (t, e) => t ? e : !1, ge = {
108
- marginLeft: "auto",
109
- border: "none",
110
- background: "transparent",
111
- cursor: "pointer",
112
- fontSize: Qt
113
- }, pe = ({ header: t, dismissible: e, onClose: n }) => {
108
+ }, ge = (t, e, n) => t === "none" ? void 0 : `transform ${e ?? Kt} ${n ?? Zt}`, pe = (t, e) => t ? e : !1, he = ({ chrome: t, frameStyle: e, header: n, dismissible: o, onClose: r, children: s }) => t ? /* @__PURE__ */ H(Pt, { style: e, children: [
109
+ /* @__PURE__ */ h(me, { header: n, dismissible: o, onClose: r }),
110
+ /* @__PURE__ */ h(
111
+ yt,
112
+ {
113
+ style: { padding: qt, flex: 1, display: "flex", flexDirection: "column" },
114
+ children: s
115
+ }
116
+ )
117
+ ] }) : /* @__PURE__ */ h(_, { children: s }), me = ({ header: t, dismissible: e, onClose: n }) => {
114
118
  if (!t)
115
119
  return null;
116
- const o = t.showCloseButton ?? !0, r = fe(e, o);
117
- return /* @__PURE__ */ h(i.Activity, { mode: t ? "visible" : "hidden", children: /* @__PURE__ */ A(
120
+ const o = t.showCloseButton ?? !0, r = pe(e, o);
121
+ return /* @__PURE__ */ h(i.Activity, { mode: t ? "visible" : "hidden", children: /* @__PURE__ */ H(
118
122
  Lt,
119
123
  {
120
- style: { padding: `${qt} ${Jt}`, gap: Kt },
124
+ style: { padding: `${Qt} ${te}`, gap: Jt },
121
125
  children: [
122
126
  /* @__PURE__ */ h(i.Activity, { mode: t ? "visible" : "hidden", children: /* @__PURE__ */ h(Mt, { children: t.title }) }),
123
- /* @__PURE__ */ h(i.Activity, { mode: r ? "visible" : "hidden", children: /* @__PURE__ */ h("button", { style: ge, onClick: n, "aria-label": "Close drawer", type: "button", children: "×" }) })
127
+ /* @__PURE__ */ h(i.Activity, { mode: r ? "visible" : "hidden", children: /* @__PURE__ */ h(
128
+ Dt,
129
+ {
130
+ onClick: n,
131
+ "aria-label": "Close drawer",
132
+ style: { marginLeft: "auto" }
133
+ }
134
+ ) })
124
135
  ]
125
136
  }
126
137
  ) });
127
- }, he = ({ header: t, dismissible: e, onClose: n, chrome: o, children: r }) => o ? /* @__PURE__ */ A(Pt, { style: { height: "100%", borderRadius: 0 }, children: [
128
- /* @__PURE__ */ h(pe, { header: t, dismissible: e, onClose: n }),
129
- /* @__PURE__ */ h(
130
- yt,
131
- {
132
- style: { padding: Zt, flex: 1, display: "flex", flexDirection: "column" },
133
- children: r
134
- }
135
- )
136
- ] }) : /* @__PURE__ */ h(H, { children: r }), me = ({
138
+ }, we = ({
137
139
  id: t,
138
140
  config: e,
139
141
  isOpen: n,
140
142
  onClose: o,
141
143
  children: r,
142
144
  zIndex: s,
143
- width: c,
144
- height: u,
145
+ width: u,
146
+ height: c,
145
147
  position: a
146
148
  }) => {
147
149
  const {
@@ -149,11 +151,11 @@ const dt = {
149
151
  header: g,
150
152
  chrome: f = !0,
151
153
  inline: m = !1,
152
- transitionMode: b = "css",
153
- transitionDuration: z,
154
- transitionEasing: E
154
+ transitionMode: w = "css",
155
+ transitionDuration: C,
156
+ transitionEasing: z
155
157
  } = e, L = i.useCallback(
156
- (M, y) => M || (y ? y.left !== void 0 ? "left" : y.right !== void 0 ? "right" : y.top !== void 0 ? "top" : y.bottom !== void 0 ? "bottom" : "right" : "right"),
158
+ (I, R) => I || (R ? R.left !== void 0 ? "left" : R.right !== void 0 ? "right" : R.top !== void 0 ? "top" : R.bottom !== void 0 ? "bottom" : "right" : "right"),
157
159
  []
158
160
  )(e.anchor, a), x = {
159
161
  left: "translateX(0)",
@@ -161,26 +163,29 @@ const dt = {
161
163
  top: "translateY(0)",
162
164
  bottom: "translateY(0)"
163
165
  }, N = i.useMemo(() => {
164
- const M = de(b, z, E), y = {
165
- ...le,
166
+ const I = ge(w, C, z), R = {
167
+ ...fe,
166
168
  ...m ? { position: "absolute" } : { position: "fixed" },
167
169
  ...ft[L],
168
170
  transform: n ? x[L] : ft[L].transform,
169
- transition: M
171
+ transition: I
170
172
  };
171
- return s !== void 0 && (y.zIndex = s), c !== void 0 && (y.width = typeof c == "number" ? `${c}px` : c), u !== void 0 && (y.height = typeof u == "number" ? `${u}px` : u), y;
172
- }, [u, m, n, L, z, E, b, c, s]), D = g?.title ?? e.ariaLabel ?? "Drawer", T = i.useMemo(() => {
173
- const M = m ? { ...dt, position: "absolute" } : dt, y = b === "none" ? void 0 : `opacity ${z ?? "220ms"} ease`;
173
+ return s !== void 0 && (R.zIndex = s), u !== void 0 && (R.width = typeof u == "number" ? `${u}px` : u), c !== void 0 && (R.height = typeof c == "number" ? `${c}px` : c), R;
174
+ }, [c, m, n, L, C, z, w, u, s]), M = g?.title ?? e.ariaLabel ?? "Drawer", D = i.useMemo(() => {
175
+ const I = m ? { ...dt, position: "absolute" } : dt, R = w === "none" ? void 0 : `opacity ${C ?? "220ms"} ease`;
174
176
  return {
175
- ...M,
177
+ ...I,
176
178
  opacity: n ? 1 : 0,
177
179
  pointerEvents: n ? "auto" : "none",
178
- transition: y,
180
+ transition: R,
179
181
  zIndex: s !== void 0 ? s - 1 : void 0
180
182
  };
181
- }, [m, n, z, b, s]);
182
- return /* @__PURE__ */ A(H, { children: [
183
- /* @__PURE__ */ h("div", { style: T, onClick: l ? o : void 0 }),
183
+ }, [m, n, C, w, s]), A = i.useMemo(() => {
184
+ const I = L === "left" || L === "right", R = { borderRadius: 0 };
185
+ return I && (R.height = "100%"), R;
186
+ }, [L]);
187
+ return /* @__PURE__ */ H(_, { children: [
188
+ /* @__PURE__ */ h("div", { style: D, onClick: l ? o : void 0 }),
184
189
  /* @__PURE__ */ h(
185
190
  "div",
186
191
  {
@@ -190,8 +195,18 @@ const dt = {
190
195
  role: "dialog",
191
196
  "aria-modal": l ? !0 : void 0,
192
197
  "aria-hidden": n ? void 0 : !0,
193
- "aria-label": D,
194
- children: /* @__PURE__ */ h(he, { header: g, dismissible: l, onClose: o, chrome: f, children: r })
198
+ "aria-label": M,
199
+ children: /* @__PURE__ */ h(
200
+ he,
201
+ {
202
+ chrome: f,
203
+ frameStyle: A,
204
+ header: g,
205
+ dismissible: l,
206
+ onClose: o,
207
+ children: r
208
+ }
209
+ )
195
210
  }
196
211
  )
197
212
  ] });
@@ -199,8 +214,8 @@ const dt = {
199
214
  let o = !1;
200
215
  const r = () => {
201
216
  o || (o = !0, t.removeEventListener("transitionend", s), n());
202
- }, s = (c) => {
203
- c.target === t && r();
217
+ }, s = (u) => {
218
+ u.target === t && r();
204
219
  };
205
220
  t.addEventListener("transitionend", s), setTimeout(r, e + 50);
206
221
  }), Tt = async (t, e, n, o) => {
@@ -212,33 +227,33 @@ const dt = {
212
227
  t(), n && await be(n, o);
213
228
  return;
214
229
  }
215
- }, Vn = (t) => {
230
+ }, Xn = (t) => {
216
231
  const [e, n] = i.useState({}), o = i.useRef(t);
217
232
  o.current = t;
218
233
  const r = i.useCallback(
219
234
  async (a, l, g) => {
220
- const { mode: f = "none", element: m, duration: b = 300 } = g ?? {};
235
+ const { mode: f = "none", element: m, duration: w = 300 } = g ?? {};
221
236
  await Tt(() => {
222
- n((P) => P[a] === l ? P : { ...P, [a]: l });
223
- }, f, m?.current, b);
224
- const E = o.current;
225
- l ? E?.onOpen?.(a) : E?.onClose?.(a), E?.onTransitionEnd?.(a, l);
237
+ n((y) => y[a] === l ? y : { ...y, [a]: l });
238
+ }, f, m?.current, w);
239
+ const z = o.current;
240
+ l ? z?.onOpen?.(a) : z?.onClose?.(a), z?.onTransitionEnd?.(a, l);
226
241
  },
227
242
  []
228
- ), s = i.useCallback((a) => e[a] ?? !1, [e]), c = i.useCallback(
243
+ ), s = i.useCallback((a) => e[a] ?? !1, [e]), u = i.useCallback(
229
244
  (a, l) => r(a, !0, l),
230
245
  [r]
231
- ), u = i.useCallback(
246
+ ), c = i.useCallback(
232
247
  (a, l) => r(a, !1, l),
233
248
  [r]
234
249
  );
235
- return { state: s, open: c, close: u };
236
- }, we = (t) => {
250
+ return { state: s, open: u, close: c };
251
+ }, ve = (t) => {
237
252
  if (!t)
238
253
  return 300;
239
254
  const e = t.match(/(\d+)/);
240
255
  return e ? parseInt(e[1], 10) : 300;
241
- }, ve = (t) => {
256
+ }, Se = (t) => {
242
257
  const [e, n] = i.useState(() => {
243
258
  const a = {};
244
259
  return t.forEach((l) => {
@@ -252,10 +267,10 @@ const dt = {
252
267
  const f = o.get(a);
253
268
  if (!f?.drawer)
254
269
  return;
255
- const m = g?.mode ?? f.drawer.transitionMode ?? "css", b = g?.duration ?? we(f.drawer.transitionDuration), z = g?.element?.current;
270
+ const m = g?.mode ?? f.drawer.transitionMode ?? "css", w = g?.duration ?? ve(f.drawer.transitionDuration), C = g?.element?.current;
256
271
  await Tt(() => {
257
- f.drawer?.open === void 0 && n((P) => P[a] === l ? P : { ...P, [a]: l }), f.drawer?.onStateChange?.(l);
258
- }, m, z, b);
272
+ f.drawer?.open === void 0 && n((y) => y[a] === l ? y : { ...y, [a]: l }), f.drawer?.onStateChange?.(l);
273
+ }, m, C, w);
259
274
  },
260
275
  [o]
261
276
  ), s = i.useCallback(
@@ -264,32 +279,32 @@ const dt = {
264
279
  return l?.drawer?.open !== void 0 ? l.drawer.open : e[a] ?? !1;
265
280
  },
266
281
  [o, e]
267
- ), c = i.useCallback(
282
+ ), u = i.useCallback(
268
283
  (a, l) => r(a, !0, l),
269
284
  [r]
270
- ), u = i.useCallback(
285
+ ), c = i.useCallback(
271
286
  (a, l) => r(a, !1, l),
272
287
  [r]
273
288
  );
274
- return { state: s, open: c, close: u };
275
- }, Se = ({ layers: t }) => {
276
- const e = ve(t), n = i.useMemo(() => t.filter((r) => r.drawer), [t]), o = i.useMemo(() => {
289
+ return { state: s, open: u, close: c };
290
+ }, Ce = ({ layers: t }) => {
291
+ const e = Se(t), n = i.useMemo(() => t.filter((r) => r.drawer), [t]), o = i.useMemo(() => {
277
292
  const r = /* @__PURE__ */ new Map();
278
293
  return n.forEach((s) => {
279
294
  r.set(s.id, () => e.close(s.id));
280
295
  }), r;
281
296
  }, [n, e.close]);
282
- return /* @__PURE__ */ h(H, { children: n.map((r) => {
297
+ return /* @__PURE__ */ h(_, { children: n.map((r) => {
283
298
  if (!r.drawer)
284
299
  return null;
285
- const s = e.state(r.id), c = o.get(r.id);
286
- return c ? /* @__PURE__ */ h(
287
- me,
300
+ const s = e.state(r.id), u = o.get(r.id);
301
+ return u ? /* @__PURE__ */ h(
302
+ we,
288
303
  {
289
304
  id: r.id,
290
305
  config: r.drawer,
291
306
  isOpen: s,
292
- onClose: c,
307
+ onClose: u,
293
308
  zIndex: r.zIndex,
294
309
  width: r.width,
295
310
  height: r.height,
@@ -299,39 +314,46 @@ const dt = {
299
314
  r.id
300
315
  ) : null;
301
316
  }) });
302
- }, It = i.createContext(null), ze = ({ value: t, children: e }) => /* @__PURE__ */ h(It.Provider, { value: t, children: e }), xt = () => {
303
- const t = i.useContext(It);
317
+ }, xt = i.createContext(null), ze = ({ value: t, children: e }) => /* @__PURE__ */ h(xt.Provider, { value: t, children: e }), kt = () => {
318
+ const t = i.useContext(xt);
304
319
  if (!t)
305
320
  throw new Error("useGridLayoutContext must be used within a GridLayoutProvider.");
306
321
  return t;
307
- }, kt = i.createContext(null), Ee = () => {
308
- const t = i.useContext(kt);
322
+ }, At = i.createContext(null), Ht = () => {
323
+ const t = i.useContext(At);
309
324
  if (!t)
310
325
  throw new Error("usePanelSystem must be used within a PanelSystemProvider.");
311
326
  return t;
312
- }, Ce = ({ config: t, layers: e, style: n, children: o }) => {
327
+ }, Ee = ({ config: t, layers: e, style: n, children: o }) => {
313
328
  const r = i.useMemo(() => {
314
- const c = /* @__PURE__ */ new Map();
315
- return e.forEach((u) => {
316
- c.set(u.id, u);
317
- }), c;
318
- }, [e]), s = i.useMemo(
329
+ const l = /* @__PURE__ */ new Map();
330
+ return e.forEach((g) => {
331
+ l.set(g.id, g);
332
+ }), l;
333
+ }, [e]), s = i.useCallback(
334
+ (l) => r.get(l)?.component ?? null,
335
+ [r]
336
+ ), u = i.useMemo(() => e.map((l) => l.id), [e]), { getCachedContent: c } = se({
337
+ resolveContent: s,
338
+ validIds: u
339
+ }), a = i.useMemo(
319
340
  () => ({
320
341
  config: t,
321
342
  style: n,
322
343
  layers: {
323
344
  defs: e,
324
345
  layerById: r
325
- }
346
+ },
347
+ getCachedContent: c
326
348
  }),
327
- [t, n, e, r]
349
+ [t, n, e, r, c]
328
350
  );
329
- return /* @__PURE__ */ h(kt.Provider, { value: s, children: o });
330
- }, At = i.createContext(null), Ht = ({ layerId: t, children: e }) => {
351
+ return /* @__PURE__ */ h(At.Provider, { value: a, children: o });
352
+ }, Nt = i.createContext(null), $t = ({ layerId: t, children: e }) => {
331
353
  const n = i.useMemo(() => ({ layerId: t }), [t]);
332
- return /* @__PURE__ */ h(At.Provider, { value: n, children: e });
333
- }, Xn = () => {
334
- const t = i.useContext(At);
354
+ return /* @__PURE__ */ h(Nt.Provider, { value: n, children: e });
355
+ }, Un = () => {
356
+ const t = i.useContext(Nt);
335
357
  if (!t)
336
358
  throw new Error("useLayerInstance must be used within a LayerInstanceProvider.");
337
359
  return t;
@@ -339,29 +361,29 @@ const dt = {
339
361
  if (typeof t == "number" && Number.isFinite(t))
340
362
  return t;
341
363
  throw new Error(`Popup layer "${n}" requires a numeric "${e}" value.`);
342
- }, Nt = (t, e) => {
364
+ }, Ft = (t, e) => {
343
365
  if (!t)
344
366
  throw new Error(`Popup layer "${e}" must define position (left/top).`);
345
367
  return {
346
368
  left: gt(t.left, "left", e),
347
369
  top: gt(t.top, "top", e)
348
370
  };
349
- }, Y = (t) => `${Math.round(t)}`, F = (t) => {
371
+ }, V = (t) => `${Math.round(t)}`, G = (t) => {
350
372
  if (t !== void 0)
351
373
  return t ? "yes" : "no";
352
374
  }, Re = (t, e, n, o, r) => {
353
- const s = {}, c = Nt(e, t);
375
+ const s = {}, u = Ft(e, t);
354
376
  if (typeof n != "number" || typeof o != "number")
355
377
  throw new Error(`Popup layer "${t}" requires numeric width/height.`);
356
- s.width = Y(n), s.height = Y(o), s.left = Y(c.left), s.top = Y(c.top);
357
- const u = r?.features;
358
- if (u) {
359
- const a = F(u.toolbar), l = F(u.menubar), g = F(u.location), f = F(u.status), m = F(u.resizable), b = F(u.scrollbars);
360
- a !== void 0 && (s.toolbar = a), l !== void 0 && (s.menubar = l), g !== void 0 && (s.location = g), f !== void 0 && (s.status = f), m !== void 0 && (s.resizable = m), b !== void 0 && (s.scrollbars = b);
378
+ s.width = V(n), s.height = V(o), s.left = V(u.left), s.top = V(u.top);
379
+ const c = r?.features;
380
+ if (c) {
381
+ const a = G(c.toolbar), l = G(c.menubar), g = G(c.location), f = G(c.status), m = G(c.resizable), w = G(c.scrollbars);
382
+ a !== void 0 && (s.toolbar = a), l !== void 0 && (s.menubar = l), g !== void 0 && (s.location = g), f !== void 0 && (s.status = f), m !== void 0 && (s.resizable = m), w !== void 0 && (s.scrollbars = w);
361
383
  }
362
384
  return Object.entries(s).map(([a, l]) => `${a}=${l}`).join(",");
363
385
  }, pt = (t, e, n, o, r) => {
364
- const s = Nt(n, e);
386
+ const s = Ft(n, e);
365
387
  if (typeof o != "number" || typeof r != "number")
366
388
  throw new Error(`Popup layer "${e}" requires numeric width/height.`);
367
389
  t.moveTo(Math.round(s.left), Math.round(s.top)), t.resizeTo(Math.round(o), Math.round(r));
@@ -371,13 +393,13 @@ const dt = {
371
393
  throw new Error(`Layer "${t.id}" is missing floating configuration required for popup mode.`);
372
394
  if ((e.mode ?? "embedded") !== "popup")
373
395
  throw new Error(`PopupLayerPortal received layer "${t.id}" that is not configured for popup mode.`);
374
- const o = i.useRef(null), r = i.useRef(null), [s, c] = i.useState(!1);
396
+ const o = i.useRef(null), r = i.useRef(null), [s, u] = i.useState(!1);
375
397
  return i.useEffect(() => {
376
398
  if (typeof window > "u")
377
399
  return;
378
- const u = Re(t.id, t.position, t.width, t.height, e.popup), a = e.popup?.name ?? t.id, l = ye(
400
+ const c = Re(t.id, t.position, t.width, t.height, e.popup), a = e.popup?.name ?? t.id, l = ye(
379
401
  a,
380
- u,
402
+ c,
381
403
  {
382
404
  position: t.position,
383
405
  size: { width: t.width, height: t.height }
@@ -389,12 +411,12 @@ const dt = {
389
411
  const g = l;
390
412
  r.current = g, e.popup?.focus !== !1 && g.focus(), g.document.title || (g.document.title = t.id), g.document.body.innerHTML = "";
391
413
  const f = g.document.createElement("div");
392
- f.dataset.layerId = t.id, g.document.body.appendChild(f), o.current = f, c(!0), pt(g, t.id, t.position, t.width, t.height);
414
+ f.dataset.layerId = t.id, g.document.body.appendChild(f), o.current = f, u(!0), pt(g, t.id, t.position, t.width, t.height);
393
415
  const m = () => {
394
- r.current = null, o.current = null, c(!1);
416
+ r.current = null, o.current = null, u(!1);
395
417
  };
396
418
  return g.addEventListener("beforeunload", m), () => {
397
- g.removeEventListener("beforeunload", m), e.popup?.closeOnUnmount !== !1 && g.close(), r.current = null, o.current = null, c(!1);
419
+ g.removeEventListener("beforeunload", m), e.popup?.closeOnUnmount !== !1 && g.close(), r.current = null, o.current = null, u(!1);
398
420
  };
399
421
  }, [
400
422
  e.popup?.closeOnUnmount,
@@ -408,61 +430,43 @@ const dt = {
408
430
  e.popup?.name,
409
431
  t.id
410
432
  ]), i.useEffect(() => {
411
- const u = r.current;
412
- u && pt(u, t.id, t.position, t.width, t.height);
413
- }, [t.position?.left, t.position?.top, t.height, t.width, t.id]), !s || !o.current ? null : re(/* @__PURE__ */ h(Ht, { layerId: t.id, children: t.component }), o.current);
433
+ const c = r.current;
434
+ c && pt(c, t.id, t.position, t.width, t.height);
435
+ }, [t.position?.left, t.position?.top, t.height, t.width, t.id]), !s || !o.current ? null : ae(/* @__PURE__ */ h($t, { layerId: t.id, children: t.component }), o.current);
414
436
  }, ye = (t, e, n, o) => {
415
437
  const r = o?.createWindow;
416
438
  return r ? r({ name: t, features: e, bounds: n }) : window.open("", t, e);
417
- }, Le = {
418
- marginLeft: "auto",
419
- border: "none",
420
- background: "transparent",
421
- cursor: "pointer",
422
- fontSize: "1.25rem",
423
- padding: "0.25rem 0.5rem",
424
- lineHeight: 1
425
- }, Me = ({ onClick: t }) => /* @__PURE__ */ h(Vt, { children: /* @__PURE__ */ h(
426
- "button",
427
- {
428
- style: Le,
429
- onClick: t,
430
- "aria-label": "Close window",
431
- type: "button",
432
- "data-drag-ignore": "true",
433
- children: "×"
434
- }
435
- ) }), De = ({ header: t, draggable: e, onClose: n }) => {
439
+ }, Le = ({ onClick: t }) => /* @__PURE__ */ h(Ut, { children: /* @__PURE__ */ h(Dt, { onClick: t, "aria-label": "Close window", "data-drag-ignore": "true" }) }), Me = ({ header: t, draggable: e, onClose: n }) => {
436
440
  if (!t)
437
441
  return null;
438
442
  const o = t.showCloseButton ?? !1;
439
- return /* @__PURE__ */ A(Lt, { ...e ? { "data-drag-handle": "true" } : {}, style: { cursor: e ? "grab" : void 0 }, children: [
443
+ return /* @__PURE__ */ H(Lt, { ...e ? { "data-drag-handle": "true" } : {}, style: { cursor: e ? "grab" : void 0 }, children: [
440
444
  t.title ? /* @__PURE__ */ h(Mt, { children: t.title }) : null,
441
- o ? /* @__PURE__ */ h(Me, { onClick: n }) : null
445
+ o ? /* @__PURE__ */ h(Le, { onClick: n }) : null
442
446
  ] });
443
- }, Te = ({ header: t, draggable: e, chrome: n, onClose: o, children: r }) => n ? /* @__PURE__ */ A(Pt, { style: { height: "100%", width: "100%" }, children: [
444
- /* @__PURE__ */ h(De, { header: t, draggable: e, onClose: o }),
447
+ }, De = ({ header: t, draggable: e, chrome: n, onClose: o, children: r }) => n ? /* @__PURE__ */ H(Pt, { style: { height: "100%", width: "100%" }, children: [
448
+ /* @__PURE__ */ h(Me, { header: t, draggable: e, onClose: o }),
445
449
  /* @__PURE__ */ h(yt, { style: { flex: 1, display: "flex", flexDirection: "column" }, children: r })
446
- ] }) : /* @__PURE__ */ h(H, { children: r }), _t = ({ id: t, config: e, onClose: n, children: o }) => {
447
- const r = e.chrome ?? !1, s = e.draggable ?? !1, c = e.header?.title ?? e.ariaLabel ?? "Floating window";
448
- return /* @__PURE__ */ h("div", { "data-floating-window": t, role: "dialog", "aria-label": c, style: { height: "100%", width: "100%" }, children: /* @__PURE__ */ h(Te, { header: e.header, draggable: s, chrome: r, onClose: n, children: o }) });
450
+ ] }) : /* @__PURE__ */ h(_, { children: r }), _t = ({ id: t, config: e, onClose: n, children: o }) => {
451
+ const r = e.chrome ?? !1, s = e.draggable ?? !1, u = e.header?.title ?? e.ariaLabel ?? "Floating window";
452
+ return /* @__PURE__ */ h("div", { "data-floating-window": t, role: "dialog", "aria-label": u, style: { height: "100%", width: "100%" }, children: /* @__PURE__ */ h(De, { header: e.header, draggable: s, chrome: r, onClose: n, children: o }) });
449
453
  };
450
454
  _t.displayName = "FloatingWindow";
451
- const $t = {
455
+ const Gt = {
452
456
  position: "absolute",
453
457
  pointerEvents: "auto",
454
458
  boxSizing: "border-box",
455
459
  background: "transparent",
456
460
  border: "none"
457
461
  }, Ie = {
458
- ...$t,
459
- width: I,
460
- height: I,
462
+ ...Gt,
463
+ width: T,
464
+ height: T,
461
465
  zIndex: 2
462
- }, xe = {
463
- ...$t,
466
+ }, Te = {
467
+ ...Gt,
464
468
  zIndex: 1
465
- }, ke = {
469
+ }, xe = {
466
470
  "top-left": {
467
471
  top: 0,
468
472
  left: 0,
@@ -487,40 +491,40 @@ const $t = {
487
491
  transform: "translate(50%, 50%)",
488
492
  cursor: "nwse-resize"
489
493
  }
490
- }, Ae = {
494
+ }, ke = {
491
495
  left: {
492
- top: I,
493
- bottom: I,
496
+ top: T,
497
+ bottom: T,
494
498
  left: 0,
495
- width: B,
499
+ width: Y,
496
500
  transform: "translateX(-50%)",
497
501
  cursor: "ew-resize"
498
502
  },
499
503
  right: {
500
- top: I,
501
- bottom: I,
504
+ top: T,
505
+ bottom: T,
502
506
  right: 0,
503
- width: B,
507
+ width: Y,
504
508
  transform: "translateX(50%)",
505
509
  cursor: "ew-resize"
506
510
  },
507
511
  top: {
508
- left: I,
509
- right: I,
512
+ left: T,
513
+ right: T,
510
514
  top: 0,
511
- height: B,
515
+ height: Y,
512
516
  transform: "translateY(-50%)",
513
517
  cursor: "ns-resize"
514
518
  },
515
519
  bottom: {
516
- left: I,
517
- right: I,
520
+ left: T,
521
+ right: T,
518
522
  bottom: 0,
519
- height: B,
523
+ height: Y,
520
524
  transform: "translateY(50%)",
521
525
  cursor: "ns-resize"
522
526
  }
523
- }, He = [
527
+ }, Ae = [
524
528
  { key: "top-left", variant: "corner", horizontal: "left", vertical: "top" },
525
529
  { key: "top-right", variant: "corner", horizontal: "right", vertical: "top" },
526
530
  { key: "bottom-left", variant: "corner", horizontal: "left", vertical: "bottom" },
@@ -529,22 +533,22 @@ const $t = {
529
533
  { key: "right", variant: "edge", horizontal: "right" },
530
534
  { key: "top", variant: "edge", vertical: "top" },
531
535
  { key: "bottom", variant: "edge", vertical: "bottom" }
532
- ], Ne = ({ layerId: t, onPointerDown: e }) => /* @__PURE__ */ h(H, { children: He.map((n) => {
533
- const o = n.variant === "corner" ? Ie : xe, r = n.variant === "corner" ? ke[n.key] : Ae[n.key], s = { ...o, ...r }, c = n.variant === "corner" ? { "data-resize-corner": n.key } : { "data-resize-edge": n.key };
536
+ ], He = ({ layerId: t, onPointerDown: e }) => /* @__PURE__ */ h(_, { children: Ae.map((n) => {
537
+ const o = n.variant === "corner" ? Ie : Te, r = n.variant === "corner" ? xe[n.key] : ke[n.key], s = { ...o, ...r }, u = n.variant === "corner" ? { "data-resize-corner": n.key } : { "data-resize-edge": n.key };
534
538
  return /* @__PURE__ */ h(
535
539
  "div",
536
540
  {
537
541
  role: "presentation",
538
542
  "aria-hidden": "true",
539
543
  style: s,
540
- ...c,
544
+ ...u,
541
545
  "data-layer-id": t,
542
- onPointerDown: (u) => e(n, u)
546
+ onPointerDown: (c) => e(n, c)
543
547
  },
544
548
  n.key
545
549
  );
546
- }) }), _e = ({ pivot: t }) => {
547
- const { Outlet: e } = se({
550
+ }) }), Ne = ({ pivot: t }) => {
551
+ const { Outlet: e } = ie({
548
552
  items: t.items,
549
553
  activeId: t.activeId,
550
554
  defaultActiveId: t.defaultActiveId,
@@ -552,30 +556,30 @@ const $t = {
552
556
  transitionMode: t.transitionMode
553
557
  });
554
558
  return /* @__PURE__ */ h(e, {});
555
- }, Ft = i.memo(({ layer: t, onClose: e }) => {
556
- const n = t.pivot ? /* @__PURE__ */ h(_e, { pivot: t.pivot }) : /* @__PURE__ */ h(H, { children: t.component });
557
- return t.floating?.chrome ? /* @__PURE__ */ h(_t, { id: t.id, config: t.floating, onClose: e, children: n }) : n;
559
+ }, $e = (t, e) => t.pivot ? /* @__PURE__ */ h(Ne, { pivot: t.pivot }) : t.cache ? e(t.id) : t.component, Wt = i.memo(({ layer: t, onClose: e }) => {
560
+ const { getCachedContent: n } = Ht(), o = $e(t, n);
561
+ return t.floating?.chrome ? /* @__PURE__ */ h(_t, { id: t.id, config: t.floating, onClose: e, children: o }) : o;
558
562
  });
559
- Ft.displayName = "LayerContentRenderer";
560
- const Gt = i.memo(({ layerId: t, isResizable: e, onPointerDown: n }) => e ? /* @__PURE__ */ h(Ne, { layerId: t, onPointerDown: n }) : null);
561
- Gt.displayName = "LayerResizeHandles";
562
- const $e = (t) => t ? "auto" : "hidden", Ot = i.memo(({ layer: t, handleLayerPointerDown: e }) => {
563
- const { getLayerRenderState: n } = xt(), { style: o, isResizable: r, isResizing: s, onResizeHandlePointerDown: c } = n(t), u = i.useMemo(() => {
563
+ Wt.displayName = "LayerContentRenderer";
564
+ const Ot = i.memo(({ layerId: t, isResizable: e, onPointerDown: n }) => e ? /* @__PURE__ */ h(He, { layerId: t, onPointerDown: n }) : null);
565
+ Ot.displayName = "LayerResizeHandles";
566
+ const Fe = (t, e) => t ? "auto" : e ? "visible" : "hidden", Bt = i.memo(({ layer: t, handleLayerPointerDown: e }) => {
567
+ const { getLayerRenderState: n } = kt(), { style: o, isResizable: r, isResizing: s, onResizeHandlePointerDown: u } = n(t), c = i.useMemo(() => {
564
568
  const g = {};
565
569
  return t.gridArea && (g.gridArea = t.gridArea), t.gridRow && (g.gridRow = t.gridRow), t.gridColumn && (g.gridColumn = t.gridColumn), g;
566
570
  }, [t.gridArea, t.gridRow, t.gridColumn]), a = i.useMemo(() => {
567
- const g = $e(t.scrollable), f = {
571
+ const g = !!t.floating, f = Fe(t.scrollable, g), m = {
568
572
  ...o,
569
- ...u,
573
+ ...c,
570
574
  minWidth: 0,
571
575
  minHeight: 0,
572
- overflow: g
576
+ overflow: f
573
577
  };
574
- return r ? { ...f, position: "relative" } : f;
575
- }, [o, u, r, t.scrollable]), l = i.useCallback(() => {
578
+ return r ? { ...m, position: "relative" } : m;
579
+ }, [o, c, r, t.scrollable, t.floating]), l = i.useCallback(() => {
576
580
  t.floating?.onClose?.();
577
581
  }, [t.floating]);
578
- return /* @__PURE__ */ A(
582
+ return /* @__PURE__ */ H(
579
583
  "div",
580
584
  {
581
585
  "data-layer-id": t.id,
@@ -585,21 +589,21 @@ const $e = (t) => t ? "auto" : "hidden", Ot = i.memo(({ layer: t, handleLayerPoi
585
589
  style: a,
586
590
  onPointerDown: e,
587
591
  children: [
588
- /* @__PURE__ */ h(Ht, { layerId: t.id, children: /* @__PURE__ */ h(Ft, { layer: t, onClose: l }) }),
589
- /* @__PURE__ */ h(Gt, { layerId: t.id, isResizable: r, onPointerDown: c })
592
+ /* @__PURE__ */ h($t, { layerId: t.id, children: /* @__PURE__ */ h(Wt, { layer: t, onClose: l }) }),
593
+ /* @__PURE__ */ h(Ot, { layerId: t.id, isResizable: r, onPointerDown: u })
590
594
  ]
591
595
  }
592
596
  );
593
597
  });
594
- Ot.displayName = "EmbeddedLayer";
595
- const Fe = ({ layers: t }) => {
596
- const { handleLayerPointerDown: e } = xt();
597
- return /* @__PURE__ */ h(H, { children: t.map((n) => {
598
+ Bt.displayName = "EmbeddedLayer";
599
+ const _e = ({ layers: t }) => {
600
+ const { handleLayerPointerDown: e } = kt();
601
+ return /* @__PURE__ */ h(_, { children: t.map((n) => {
598
602
  const o = n.floating?.mode ?? "embedded";
599
- return n.floating && o === "popup" ? /* @__PURE__ */ h(Pe, { layer: n }, n.id) : /* @__PURE__ */ h(Ot, { layer: n, handleLayerPointerDown: e }, n.id);
603
+ return n.floating && o === "popup" ? /* @__PURE__ */ h(Pe, { layer: n }, n.id) : /* @__PURE__ */ h(Bt, { layer: n, handleLayerPointerDown: e }, n.id);
600
604
  }) });
601
605
  };
602
- function G(t) {
606
+ function W(t) {
603
607
  const e = i.useRef(t);
604
608
  return e.current = t, i.useCallback((...n) => {
605
609
  const o = e.current;
@@ -607,8 +611,8 @@ function G(t) {
607
611
  return o(...n);
608
612
  }, []);
609
613
  }
610
- function tt(t, e) {
611
- const n = G(e.onMove), o = G(e.onUp), r = G(e.onCancel);
614
+ function et(t, e) {
615
+ const n = W(e.onMove), o = W(e.onUp), r = W(e.onCancel);
612
616
  i.useEffect(() => {
613
617
  if (t)
614
618
  return e.onMove && document.addEventListener("pointermove", n, { passive: !1 }), e.onUp && document.addEventListener("pointerup", o), e.onCancel && document.addEventListener("pointercancel", r), () => {
@@ -625,7 +629,7 @@ function Ge(t, e, n) {
625
629
  };
626
630
  }, [t, e, n]);
627
631
  }
628
- function Oe(t, e, n = ["pointerdown", "pointermove", "pointerup"]) {
632
+ function We(t, e, n = ["pointerdown", "pointermove", "pointerup"]) {
629
633
  i.useEffect(() => {
630
634
  const o = t.current;
631
635
  if (!e || !o)
@@ -642,31 +646,31 @@ function Oe(t, e, n = ["pointerdown", "pointermove", "pointerup"]) {
642
646
  };
643
647
  }, [t, e, n]);
644
648
  }
645
- function We(t, e, n) {
646
- const { onMove: o, onUp: r, onCancel: s, pointerId: c, capturePointer: u = !0, preventDefaults: a = !0 } = n;
647
- tt(e, { onMove: o, onUp: r, onCancel: s }), Ge(t, e ? u : !1, c), Oe(t, e ? a : !1);
649
+ function Oe(t, e, n) {
650
+ const { onMove: o, onUp: r, onCancel: s, pointerId: u, capturePointer: c = !0, preventDefaults: a = !0 } = n;
651
+ et(e, { onMove: o, onUp: r, onCancel: s }), Ge(t, e ? c : !1, u), We(t, e ? a : !1);
648
652
  }
649
653
  const Be = (t) => {
650
- const e = i.useRef(null), n = i.useRef(null), o = i.useRef(0), [r, s] = i.useState(!1), c = G((f) => {
654
+ const e = i.useRef(null), n = i.useRef(null), o = i.useRef(0), [r, s] = i.useState(!1), u = W((f) => {
651
655
  t.onResize?.(f);
652
- }), u = i.useCallback(
656
+ }), c = i.useCallback(
653
657
  (f) => t.axis === "x" ? f.clientX : f.clientY,
654
658
  [t.axis]
655
659
  ), a = i.useCallback(
656
660
  (f) => {
657
- f.preventDefault(), e.current = f.currentTarget, n.current = f.pointerId, o.current = u(f), s(!0);
661
+ f.preventDefault(), e.current = f.currentTarget, n.current = f.pointerId, o.current = c(f), s(!0);
658
662
  },
659
- [u]
663
+ [c]
660
664
  ), l = i.useCallback(
661
665
  (f) => {
662
- const m = u(f), b = m - o.current;
663
- b !== 0 && (o.current = m, c(b));
666
+ const m = c(f), w = m - o.current;
667
+ w !== 0 && (o.current = m, u(w));
664
668
  },
665
- [u, c]
669
+ [c, u]
666
670
  ), g = i.useCallback(() => {
667
671
  s(!1), n.current = null;
668
672
  }, []);
669
- return We(e, r, {
673
+ return Oe(e, r, {
670
674
  onMove: l,
671
675
  onUp: g,
672
676
  pointerId: n.current ?? void 0,
@@ -699,7 +703,7 @@ function Ve({
699
703
  }
700
704
  const Xe = {
701
705
  position: "absolute",
702
- zIndex: oe
706
+ zIndex: re
703
707
  }, Ue = {
704
708
  vertical: {
705
709
  width: ut,
@@ -714,40 +718,40 @@ const Xe = {
714
718
  cursor: "row-resize"
715
719
  }
716
720
  }, je = {
717
- idle: ne,
718
- hovered: ee,
719
- dragging: te
720
- }, Ze = ({
721
+ idle: oe,
722
+ hovered: ne,
723
+ dragging: ee
724
+ }, Ke = ({
721
725
  direction: t,
722
726
  onResize: e,
723
727
  component: n,
724
728
  element: o,
725
729
  children: r
726
730
  }) => {
727
- const s = t === "vertical" ? "x" : "y", { ref: c, isDragging: u, onPointerDown: a } = Be({ axis: s, onResize: e }), [l, g] = i.useState(!1), f = i.useCallback(() => {
731
+ const s = t === "vertical" ? "x" : "y", { ref: u, isDragging: c, onPointerDown: a } = Be({ axis: s, onResize: e }), [l, g] = i.useState(!1), f = i.useCallback(() => {
728
732
  g(!0);
729
733
  }, []), m = i.useCallback(() => {
730
734
  g(!1);
731
- }, []), b = Ve({
735
+ }, []), w = Ve({
732
736
  element: o,
733
737
  component: n
734
- }), z = i.useMemo(() => u ? "dragging" : l ? "hovered" : "idle", [u, l]), E = i.useMemo(() => ({
738
+ }), C = i.useMemo(() => c ? "dragging" : l ? "hovered" : "idle", [c, l]), z = i.useMemo(() => ({
735
739
  ...Xe,
736
740
  ...Ue[t],
737
- backgroundColor: je[z],
741
+ backgroundColor: je[C],
738
742
  touchAction: "none"
739
- }), [t, z]);
743
+ }), [t, C]);
740
744
  return /* @__PURE__ */ h(
741
- b,
745
+ w,
742
746
  {
743
- ref: c,
744
- style: E,
747
+ ref: u,
748
+ style: z,
745
749
  role: "separator",
746
750
  "aria-orientation": t,
747
751
  "aria-hidden": void 0,
748
752
  "data-resize-handle": "true",
749
753
  "data-direction": t,
750
- "data-is-dragging": u ? "true" : void 0,
754
+ "data-is-dragging": c ? "true" : void 0,
751
755
  onPointerDown: a,
752
756
  onPointerEnter: f,
753
757
  onPointerLeave: m,
@@ -765,7 +769,7 @@ const Xe = {
765
769
  span: r,
766
770
  onResize: s
767
771
  }) => {
768
- const c = t === "col" ? "vertical" : "horizontal", u = i.useCallback(
772
+ const u = t === "col" ? "vertical" : "horizontal", c = i.useCallback(
769
773
  (g) => {
770
774
  const f = n === "start" ? -g : g;
771
775
  s(t, e, f);
@@ -778,10 +782,10 @@ const Xe = {
778
782
  gridRow: `${e + 1} / ${e + 2}`,
779
783
  gridColumn: `${r.start} / ${r.end}`
780
784
  }, [t, e, r]), l = i.useMemo(() => {
781
- const f = Math.max(0, o) / 2 + J / 2;
785
+ const f = Math.max(0, o) / 2 + Q / 2;
782
786
  return t === "col" ? {
783
787
  ...ht,
784
- width: J,
788
+ width: Q,
785
789
  height: "100%",
786
790
  top: 0,
787
791
  bottom: 0,
@@ -789,26 +793,26 @@ const Xe = {
789
793
  } : {
790
794
  ...ht,
791
795
  width: "100%",
792
- height: J,
796
+ height: Q,
793
797
  left: 0,
794
798
  right: 0,
795
799
  ...n === "start" ? { top: -f } : { bottom: -f }
796
800
  };
797
801
  }, [n, t, o]);
798
- return /* @__PURE__ */ h("div", { "data-resizable": "true", style: { ...a, position: "relative", pointerEvents: "none" }, children: /* @__PURE__ */ h("div", { "data-direction": c, "data-align": n, "data-handle": "true", style: l, children: /* @__PURE__ */ h(Ze, { direction: c, onResize: u }) }) });
799
- }, Ke = (t) => {
802
+ return /* @__PURE__ */ h("div", { "data-resizable": "true", style: { ...a, position: "relative", pointerEvents: "none" }, children: /* @__PURE__ */ h("div", { "data-direction": u, "data-align": n, "data-handle": "true", style: l, children: /* @__PURE__ */ h(Ke, { direction: u, onResize: c }) }) });
803
+ }, Ze = (t) => {
800
804
  const e = /* @__PURE__ */ new Map();
801
805
  t.forEach((o, r) => {
802
- o.forEach((s, c) => {
806
+ o.forEach((s, u) => {
803
807
  if (!s || s === ".")
804
808
  return;
805
- const u = e.get(s);
806
- if (u) {
809
+ const c = e.get(s);
810
+ if (c) {
807
811
  const l = {
808
- rowStart: Math.min(u.rowStart, r),
809
- rowEnd: Math.max(u.rowEnd, r),
810
- colStart: Math.min(u.colStart, c),
811
- colEnd: Math.max(u.colEnd, c)
812
+ rowStart: Math.min(c.rowStart, r),
813
+ rowEnd: Math.max(c.rowEnd, r),
814
+ colStart: Math.min(c.colStart, u),
815
+ colEnd: Math.max(c.colEnd, u)
812
816
  };
813
817
  e.set(s, l);
814
818
  return;
@@ -816,18 +820,18 @@ const Xe = {
816
820
  const a = {
817
821
  rowStart: r,
818
822
  rowEnd: r,
819
- colStart: c,
820
- colEnd: c
823
+ colStart: u,
824
+ colEnd: u
821
825
  };
822
826
  e.set(s, a);
823
827
  });
824
828
  });
825
829
  const n = /* @__PURE__ */ new Map();
826
830
  return e.forEach((o, r) => {
827
- const s = o.rowStart + 1, c = o.rowEnd + 2, u = o.colStart + 1, a = o.colEnd + 2, l = {
831
+ const s = o.rowStart + 1, u = o.rowEnd + 2, c = o.colStart + 1, a = o.colEnd + 2, l = {
828
832
  gridArea: r,
829
- gridRow: `${s} / ${c}`,
830
- gridColumn: `${u} / ${a}`
833
+ gridRow: `${s} / ${u}`,
834
+ gridColumn: `${c} / ${a}`
831
835
  };
832
836
  n.set(r, l);
833
837
  }), n;
@@ -837,31 +841,31 @@ const Xe = {
837
841
  const o = t.gridArea ?? t.id, r = e.get(o);
838
842
  if (!r)
839
843
  return t;
840
- const s = !t.gridArea, c = !t.gridRow, u = !t.gridColumn;
841
- return !s && !c && !u ? t : {
844
+ const s = !t.gridArea, u = !t.gridRow, c = !t.gridColumn;
845
+ return !s && !u && !c ? t : {
842
846
  ...t,
843
847
  gridArea: s ? r.gridArea : t.gridArea,
844
- gridRow: c ? r.gridRow : t.gridRow,
845
- gridColumn: u ? r.gridColumn : t.gridColumn
848
+ gridRow: u ? r.gridRow : t.gridRow,
849
+ gridColumn: c ? r.gridColumn : t.gridColumn
846
850
  };
847
851
  }, Je = (t, e) => {
848
- const n = i.useMemo(() => Ke(t.areas), [t.areas]), o = i.useMemo(() => e.map((u) => qe(u, n)), [e, n]), r = i.useMemo(
849
- () => o.filter((u) => u.visible !== !1),
852
+ const n = i.useMemo(() => Ze(t.areas), [t.areas]), o = i.useMemo(() => e.map((c) => qe(c, n)), [e, n]), r = i.useMemo(
853
+ () => o.filter((c) => c.visible !== !1),
850
854
  [o]
851
855
  ), s = i.useMemo(
852
- () => r.filter((u) => !u.drawer),
856
+ () => r.filter((c) => !c.drawer),
853
857
  [r]
854
- ), c = i.useMemo(() => {
855
- const u = /* @__PURE__ */ new Map();
858
+ ), u = i.useMemo(() => {
859
+ const c = /* @__PURE__ */ new Map();
856
860
  return o.forEach((a) => {
857
- u.set(a.id, a);
858
- }), u;
861
+ c.set(a.id, a);
862
+ }), c;
859
863
  }, [o]);
860
864
  return {
861
865
  normalizedLayers: o,
862
866
  visibleLayers: r,
863
867
  regularLayers: s,
864
- layerById: c
868
+ layerById: u
865
869
  };
866
870
  }, Qe = (t) => {
867
871
  if (!t)
@@ -883,19 +887,19 @@ const Xe = {
883
887
  return [];
884
888
  const n = getComputedStyle(t);
885
889
  return (e === "col" ? n.gridTemplateColumns : n.gridTemplateRows).split(/\s+/).map((r) => parseFloat(r)).filter((r) => !Number.isNaN(r));
886
- }, Wt = (t, e = Number.NEGATIVE_INFINITY, n = Number.POSITIVE_INFINITY) => Math.min(Math.max(t, e), n), Un = (t, e) => typeof t != "number" || !Number.isFinite(t) ? e : t, j = (t, e) => `${t}-${e}`, en = (t, e, n, o) => {
887
- const r = j(n, o), s = e[r];
890
+ }, Yt = (t, e = Number.NEGATIVE_INFINITY, n = Number.POSITIVE_INFINITY) => Math.min(Math.max(t, e), n), jn = (t, e) => typeof t != "number" || !Number.isFinite(t) ? e : t, K = (t, e) => `${t}-${e}`, en = (t, e, n, o) => {
891
+ const r = K(n, o), s = e[r];
888
892
  return s !== void 0 ? `minmax(${t.minSize ?? 0}px, ${s}px)` : t.size;
889
- }, bt = (t, e, n) => t.map((o, r) => en(o, e, n, r)).join(" "), V = (t, e) => t.reduce((n, o, r) => (o.resizable && o.size.endsWith("px") && (n[j(e, r)] = parseInt(o.size, 10)), n), {}), nn = ({
893
+ }, wt = (t, e, n) => t.map((o, r) => en(o, e, n, r)).join(" "), X = (t, e) => t.reduce((n, o, r) => (o.resizable && o.size.endsWith("px") && (n[K(e, r)] = parseInt(o.size, 10)), n), {}), nn = ({
890
894
  trackSizes: t,
891
895
  track: e,
892
896
  direction: n,
893
897
  trackIndex: o,
894
898
  containerRef: r
895
899
  }) => {
896
- const s = j(n, o), c = t[s];
897
- if (c !== void 0)
898
- return c;
900
+ const s = K(n, o), u = t[s];
901
+ if (u !== void 0)
902
+ return u;
899
903
  const a = tn(r?.current ?? null, n)[o];
900
904
  return a !== void 0 && a > 0 ? a : e.size.endsWith("px") ? Number.parseInt(e.size, 10) : 300;
901
905
  }, on = (t, e) => t.reduce((n, o, r) => r === e ? n : o.size.includes("fr") ? n + 100 : n + (o.minSize ?? 50), 0), rn = ({
@@ -908,13 +912,13 @@ const Xe = {
908
912
  }) => {
909
913
  if (!r?.current)
910
914
  return t.maxSize;
911
- const c = o === "col" ? r.current.offsetWidth : r.current.offsetHeight, u = on(e, n), a = e.length - 1, l = o === "col" ? s.columnGap : s.rowGap, g = a * l, f = c - u - g;
915
+ const u = o === "col" ? r.current.offsetWidth : r.current.offsetHeight, c = on(e, n), a = e.length - 1, l = o === "col" ? s.columnGap : s.rowGap, g = a * l, f = u - c - g;
912
916
  return t.maxSize !== void 0 ? Math.min(t.maxSize, f) : f;
913
- }, sn = (t, e, n) => Wt(t, e ?? Number.NEGATIVE_INFINITY, n ?? Number.POSITIVE_INFINITY), wt = (t, e) => {
917
+ }, sn = (t, e, n) => Yt(t, e ?? Number.NEGATIVE_INFINITY, n ?? Number.POSITIVE_INFINITY), bt = (t, e) => {
914
918
  const n = t.length, o = [];
915
- for (let c = 0; c < n; c++) {
916
- const u = t[c], a = u[e], l = u[e + 1];
917
- a !== l && o.push(c);
919
+ for (let u = 0; u < n; u++) {
920
+ const c = t[u], a = c[e], l = c[e + 1];
921
+ a !== l && o.push(u);
918
922
  }
919
923
  if (o.length === 0)
920
924
  return { start: 1, end: n + 1 };
@@ -928,8 +932,8 @@ const Xe = {
928
932
  }
929
933
  if (s.length === 0)
930
934
  return { start: 1, end: r + 1 };
931
- const c = Math.min(...s), u = Math.max(...s);
932
- return { start: c + 1, end: u + 2 };
935
+ const u = Math.min(...s), c = Math.max(...s);
936
+ return { start: u + 1, end: c + 2 };
933
937
  }, an = (t, e) => {
934
938
  if (t.length === 0)
935
939
  return [];
@@ -937,15 +941,15 @@ const Xe = {
937
941
  if (t.length === 1)
938
942
  return t[0]?.resizable ? [{ trackIndex: 0, align: "end", span: { start: 1, end: n + 1 } }] : [];
939
943
  const o = [];
940
- return Array.from({ length: t.length - 1 }, (s, c) => c).forEach((s) => {
941
- const c = t[s];
944
+ return Array.from({ length: t.length - 1 }, (s, u) => u).forEach((s) => {
945
+ const u = t[s];
942
946
  if (t[s + 1]?.resizable) {
943
- const a = wt(e, s);
947
+ const a = bt(e, s);
944
948
  o.push({ trackIndex: s + 1, align: "start", span: a });
945
949
  return;
946
950
  }
947
- if (c?.resizable) {
948
- const a = wt(e, s);
951
+ if (u?.resizable) {
952
+ const a = bt(e, s);
949
953
  o.push({ trackIndex: s, align: "end", span: a });
950
954
  }
951
955
  }), o;
@@ -956,14 +960,14 @@ const Xe = {
956
960
  if (t.length === 1)
957
961
  return t[0]?.resizable ? [{ trackIndex: 0, align: "end", span: { start: 1, end: n + 1 } }] : [];
958
962
  const o = [];
959
- return Array.from({ length: t.length - 1 }, (s, c) => c).forEach((s) => {
960
- const c = t[s];
963
+ return Array.from({ length: t.length - 1 }, (s, u) => u).forEach((s) => {
964
+ const u = t[s];
961
965
  if (t[s + 1]?.resizable) {
962
966
  const a = vt(e, s);
963
967
  o.push({ trackIndex: s + 1, align: "start", span: a });
964
968
  return;
965
969
  }
966
- if (c?.resizable) {
970
+ if (u?.resizable) {
967
971
  const a = vt(e, s);
968
972
  o.push({ trackIndex: s, align: "end", span: a });
969
973
  }
@@ -972,23 +976,23 @@ const Xe = {
972
976
  const n = Object.keys(e), o = {};
973
977
  for (const g of n)
974
978
  o[g] = t[g] ?? e[g];
975
- const r = Object.keys(t), s = r.length !== n.length, c = r.some(
979
+ const r = Object.keys(t), s = r.length !== n.length, u = r.some(
976
980
  (g) => !Object.prototype.hasOwnProperty.call(o, g)
977
- ), u = s ? !0 : c, a = n.some((g) => t[g] !== o[g]);
978
- return (u ? !0 : a) ? o : null;
981
+ ), c = s ? !0 : u, a = n.some((g) => t[g] !== o[g]);
982
+ return (c ? !0 : a) ? o : null;
979
983
  }, dn = (t, e, n) => {
980
984
  const [o, r] = i.useState(() => ({
981
- ...V(t.columns, "col"),
982
- ...V(t.rows, "row")
985
+ ...X(t.columns, "col"),
986
+ ...X(t.rows, "row")
983
987
  }));
984
- Dt(() => {
988
+ It(() => {
985
989
  const f = {
986
- ...V(t.columns, "col"),
987
- ...V(t.rows, "row")
990
+ ...X(t.columns, "col"),
991
+ ...X(t.rows, "row")
988
992
  };
989
993
  r((m) => ln(m, f) ?? m);
990
994
  }, [t.columns, t.rows]);
991
- const s = i.useMemo(() => t.areas.map((f) => `"${f.join(" ")}"`).join(" "), [t.areas]), c = i.useMemo(() => Qe(t.gap), [t.gap]), u = i.useMemo(
995
+ const s = i.useMemo(() => t.areas.map((f) => `"${f.join(" ")}"`).join(" "), [t.areas]), u = i.useMemo(() => Qe(t.gap), [t.gap]), c = i.useMemo(
992
996
  () => an(t.columns, t.areas),
993
997
  [t.columns, t.areas]
994
998
  ), a = i.useMemo(
@@ -998,39 +1002,39 @@ const Xe = {
998
1002
  ...t.style,
999
1003
  ...e,
1000
1004
  gridTemplateAreas: s,
1001
- gridTemplateRows: bt(t.rows, o, "row"),
1002
- gridTemplateColumns: bt(t.columns, o, "col"),
1005
+ gridTemplateRows: wt(t.rows, o, "row"),
1006
+ gridTemplateColumns: wt(t.columns, o, "col"),
1003
1007
  ...un(t.gap)
1004
1008
  }), [s, t.columns, t.gap, t.rows, t.style, e, o]), g = i.useCallback(
1005
- (f, m, b) => {
1006
- const z = f === "row" ? t.rows : t.columns, E = z[m];
1007
- if (!E || !E.resizable)
1009
+ (f, m, w) => {
1010
+ const C = f === "row" ? t.rows : t.columns, z = C[m];
1011
+ if (!z || !z.resizable)
1008
1012
  return;
1009
- const P = nn({
1013
+ const y = nn({
1010
1014
  trackSizes: o,
1011
- track: E,
1015
+ track: z,
1012
1016
  direction: f,
1013
1017
  trackIndex: m,
1014
1018
  containerRef: n
1015
1019
  }), L = rn({
1016
- track: E,
1017
- tracks: z,
1020
+ track: z,
1021
+ tracks: C,
1018
1022
  trackIndex: m,
1019
1023
  direction: f,
1020
1024
  containerRef: n,
1021
- gapSizes: c
1022
- }), x = j(f, m);
1025
+ gapSizes: u
1026
+ }), x = K(f, m);
1023
1027
  r((N) => {
1024
- const D = P + b, T = sn(D, E.minSize, L);
1025
- return { ...N, [x]: T };
1028
+ const M = y + w, D = sn(M, z.minSize, L);
1029
+ return { ...N, [x]: D };
1026
1030
  });
1027
1031
  },
1028
- [t.columns, t.rows, o, n, c]
1032
+ [t.columns, t.rows, o, n, u]
1029
1033
  );
1030
1034
  return {
1031
- columnHandles: u,
1035
+ columnHandles: c,
1032
1036
  rowHandles: a,
1033
- gapSizes: c,
1037
+ gapSizes: u,
1034
1038
  gridStyle: l,
1035
1039
  handleResize: g
1036
1040
  };
@@ -1043,10 +1047,10 @@ const Xe = {
1043
1047
  right: t.right,
1044
1048
  bottom: t.bottom,
1045
1049
  left: t.left
1046
- } : {}, mn = (t) => t !== void 0 ? { zIndex: t } : {}, bn = (t, e) => ({
1050
+ } : {}, mn = (t) => t !== void 0 ? { zIndex: t } : {}, wn = (t, e) => ({
1047
1051
  width: t,
1048
1052
  height: e
1049
- }), wn = (t, e) => t.pointerEvents !== void 0 ? typeof t.pointerEvents == "boolean" ? { pointerEvents: t.pointerEvents ? "auto" : "none" } : { pointerEvents: t.pointerEvents } : e === "absolute" || e === "fixed" ? { pointerEvents: "auto" } : {}, vn = (t) => t.floating ? t.floating.position ?? t.floating.defaultPosition ?? t.position : t.position, Sn = (t) => {
1053
+ }), bn = (t, e) => t.pointerEvents !== void 0 ? typeof t.pointerEvents == "boolean" ? { pointerEvents: t.pointerEvents ? "auto" : "none" } : { pointerEvents: t.pointerEvents } : e === "absolute" || e === "fixed" ? { pointerEvents: "auto" } : {}, vn = (t) => t.floating ? t.floating.position ?? t.floating.defaultPosition ?? t.position : t.position, Sn = (t) => {
1050
1054
  if (t.floating) {
1051
1055
  const e = t.floating.size ?? t.floating.defaultSize;
1052
1056
  if (e)
@@ -1059,55 +1063,55 @@ const Xe = {
1059
1063
  width: t.width,
1060
1064
  height: t.height
1061
1065
  };
1062
- }, zn = (t) => t.floating?.zIndex !== void 0 ? t.floating.zIndex : t.zIndex, En = (t) => {
1063
- const e = fn(t), n = vn(t), o = Sn(t), r = zn(t);
1066
+ }, Cn = (t) => t.floating?.zIndex !== void 0 ? t.floating.zIndex : t.zIndex, zn = (t) => {
1067
+ const e = fn(t), n = vn(t), o = Sn(t), r = Cn(t);
1064
1068
  return {
1065
1069
  ...t.style,
1066
1070
  ...gn(e),
1067
1071
  ...pn(t, e),
1068
1072
  ...hn(n),
1069
1073
  ...mn(r),
1070
- ...bn(o.width, o.height),
1071
- ...wn(t, e)
1074
+ ...wn(o.width, o.height),
1075
+ ...bn(t, e)
1072
1076
  };
1073
- }, Cn = (t) => {
1077
+ }, En = (t) => {
1074
1078
  const e = t.floating;
1075
1079
  return e ? e.mode ?? "embedded" : null;
1076
- }, $ = (t) => Cn(t) !== "embedded" ? null : t.floating ?? null, St = (t) => t instanceof HTMLElement ? ["INPUT", "TEXTAREA", "SELECT", "BUTTON"].includes(t.tagName) : !1, zt = (t, e, n) => {
1080
+ }, F = (t) => En(t) !== "embedded" ? null : t.floating ?? null, St = (t) => t instanceof HTMLElement ? ["INPUT", "TEXTAREA", "SELECT", "BUTTON"].includes(t.tagName) : !1, Ct = (t, e, n) => {
1077
1081
  const o = e ?? Number.NEGATIVE_INFINITY, r = n ?? Number.POSITIVE_INFINITY;
1078
- return Wt(t, o, r);
1079
- }, Et = (t, e, n) => {
1082
+ return Yt(t, o, r);
1083
+ }, zt = (t, e, n) => {
1080
1084
  if (typeof t == "number" && Number.isFinite(t))
1081
1085
  return t;
1082
1086
  throw new Error(
1083
1087
  `Floating layer "${n}" must provide a numeric "${e}" value when draggable mode is enabled.`
1084
1088
  );
1085
- }, Ct = (t) => {
1086
- const e = $(t);
1089
+ }, Et = (t) => {
1090
+ const e = F(t);
1087
1091
  if (!e)
1088
1092
  throw new Error(`Floating layer "${t.id}" is missing floating configuration required for dragging.`);
1089
1093
  const n = e.position ?? e.defaultPosition ?? t.position;
1090
1094
  if (!n)
1091
1095
  throw new Error(`Floating layer "${t.id}" must define position with left and top values.`);
1092
1096
  return {
1093
- left: Et(n.left, "left", t.id),
1094
- top: Et(n.top, "top", t.id)
1097
+ left: zt(n.left, "left", t.id),
1098
+ top: zt(n.top, "top", t.id)
1095
1099
  };
1096
1100
  }, Rn = (t) => {
1097
- const e = $(t);
1101
+ const e = F(t);
1098
1102
  return e ? e.constraints ?? {} : {};
1099
- }, Pn = (t, e, n) => t ? t === "left" ? e - n : e + n : e, yn = (t, e, n) => t ? t === "top" ? e - n : e + n : e, Ln = (t, e, n) => !t || t === "right" ? e : e + n, Mn = (t, e, n) => !t || t === "bottom" ? e : e + n, et = (t, e) => t ? t.dataset.layerId === e ? t : et(t.parentElement, e) : null, nt = (t, e, n) => !t || n?.(t) ? null : e(t) ? t : nt(t.parentElement, e, n), Dn = (t) => t instanceof HTMLElement ? nt(
1103
+ }, Pn = (t, e, n) => t ? t === "left" ? e - n : e + n : e, yn = (t, e, n) => t ? t === "top" ? e - n : e + n : e, Ln = (t, e, n) => !t || t === "right" ? e : e + n, Mn = (t, e, n) => !t || t === "bottom" ? e : e + n, nt = (t, e) => t ? t.dataset.layerId === e ? t : nt(t.parentElement, e) : null, ot = (t, e, n) => !t || n?.(t) ? null : e(t) ? t : ot(t.parentElement, e, n), Dn = (t) => t instanceof HTMLElement ? ot(
1100
1104
  t,
1101
1105
  (e) => e.dataset.dragHandle === "true",
1102
1106
  (e) => e.dataset.dragIgnore === "true"
1103
- ) : null, Rt = (t) => t instanceof HTMLElement ? nt(
1107
+ ) : null, Rt = (t) => t instanceof HTMLElement ? ot(
1104
1108
  t,
1105
1109
  (e) => e.dataset.resizeCorner !== void 0 || e.dataset.resizeEdge !== void 0
1106
- ) !== null : !1, X = (t) => {
1107
- const e = $(t);
1110
+ ) !== null : !1, U = (t) => {
1111
+ const e = F(t);
1108
1112
  return e ? e.resizable === !0 : !1;
1109
- }, U = (t) => {
1110
- if (!$(t))
1113
+ }, j = (t) => {
1114
+ if (!F(t))
1111
1115
  return null;
1112
1116
  const n = xn(t);
1113
1117
  if (!n)
@@ -1116,162 +1120,162 @@ const Xe = {
1116
1120
  width: n.width,
1117
1121
  height: n.height
1118
1122
  };
1119
- }, Tn = (t, e, n) => {
1120
- const o = t.filter(X).reduce((f, m) => {
1123
+ }, In = (t, e, n) => {
1124
+ const o = t.filter(U).reduce((f, m) => {
1121
1125
  if (n === m.id) {
1122
- const z = e[m.id];
1123
- if (z)
1124
- return f[m.id] = z, f;
1126
+ const C = e[m.id];
1127
+ if (C)
1128
+ return f[m.id] = C, f;
1125
1129
  }
1126
- const b = U(m);
1127
- return b && (f[m.id] = b), f;
1128
- }, {}), r = Object.keys(e), s = Object.keys(o), c = r.length !== s.length, u = r.some((f) => !Object.prototype.hasOwnProperty.call(o, f)), a = c ? !0 : u, l = s.some((f) => {
1129
- const m = e[f], b = o[f];
1130
- return !m || !b ? !0 : m.width !== b.width || m.height !== b.height;
1130
+ const w = j(m);
1131
+ return w && (f[m.id] = w), f;
1132
+ }, {}), r = Object.keys(e), s = Object.keys(o), u = r.length !== s.length, c = r.some((f) => !Object.prototype.hasOwnProperty.call(o, f)), a = u ? !0 : c, l = s.some((f) => {
1133
+ const m = e[f], w = o[f];
1134
+ return !m || !w ? !0 : m.width !== w.width || m.height !== w.height;
1131
1135
  });
1132
1136
  return {
1133
1137
  sizes: o,
1134
1138
  changed: a ? !0 : l
1135
1139
  };
1136
- }, In = ({
1140
+ }, Tn = ({
1137
1141
  layers: t,
1138
1142
  layerById: e,
1139
1143
  isRootLevel: n
1140
1144
  }) => {
1141
- const [o, r] = i.useState(null), [s, c] = i.useState(null), [u, a] = i.useState({}), [l, g] = i.useState({}), f = i.useRef(null), m = i.useRef(null), b = G((p, d) => {
1145
+ const [o, r] = i.useState(null), [s, u] = i.useState(null), [c, a] = i.useState({}), [l, g] = i.useState({}), f = i.useRef(null), m = i.useRef(null), w = W((p, d) => {
1142
1146
  e.get(p)?.floating?.onMove?.(d);
1143
- }), z = G((p, d) => {
1147
+ }), C = W((p, d) => {
1144
1148
  e.get(p)?.floating?.onResize?.(d);
1145
1149
  });
1146
- Dt(() => {
1147
- const { sizes: p, changed: d } = Tn(t, l, s);
1150
+ It(() => {
1151
+ const { sizes: p, changed: d } = In(t, l, s);
1148
1152
  d && g(p);
1149
1153
  }, [t, s]);
1150
- const E = i.useCallback(
1151
- (p, d, w, v) => {
1152
- const S = Ct(d), R = u[p] ?? { x: 0, y: 0 }, C = {
1154
+ const z = i.useCallback(
1155
+ (p, d, b, v) => {
1156
+ const S = Et(d), P = c[p] ?? { x: 0, y: 0 }, E = {
1153
1157
  pointerStartX: v.clientX,
1154
1158
  pointerStartY: v.clientY,
1155
- initialTranslationX: R.x,
1156
- initialTranslationY: R.y,
1159
+ initialTranslationX: P.x,
1160
+ initialTranslationY: P.y,
1157
1161
  baseLeft: S.left,
1158
1162
  baseTop: S.top,
1159
1163
  layerId: p,
1160
1164
  pointerId: v.pointerId,
1161
- target: w
1165
+ target: b
1162
1166
  };
1163
- if (C.target.setPointerCapture)
1167
+ if (E.target.setPointerCapture)
1164
1168
  try {
1165
- C.target.setPointerCapture(C.pointerId);
1169
+ E.target.setPointerCapture(E.pointerId);
1166
1170
  } catch {
1167
1171
  }
1168
- f.current = C, r(p);
1172
+ f.current = E, r(p);
1169
1173
  },
1170
- [u]
1171
- ), P = i.useCallback(
1174
+ [c]
1175
+ ), y = i.useCallback(
1172
1176
  (p) => {
1173
- const d = p.target, w = Dn(d);
1174
- if (!w)
1177
+ const d = p.target, b = Dn(d);
1178
+ if (!b)
1175
1179
  return;
1176
- const v = w.closest("[data-layer-id]")?.getAttribute("data-layer-id");
1180
+ const v = b.closest("[data-layer-id]")?.getAttribute("data-layer-id");
1177
1181
  if (!v)
1178
1182
  return;
1179
1183
  const S = e.get(v);
1180
1184
  if (!S)
1181
1185
  return;
1182
- const R = $(S);
1183
- if (!(!R || R.draggable !== !0) && !St(p.target) && !Rt(p.target) && w) {
1184
- const C = et(w, v);
1185
- if (!C)
1186
+ const P = F(S);
1187
+ if (!(!P || P.draggable !== !0) && !St(p.target) && !Rt(p.target) && b) {
1188
+ const E = nt(b, v);
1189
+ if (!E)
1186
1190
  return;
1187
- E(v, S, C, p);
1191
+ z(v, S, E, p);
1188
1192
  return;
1189
1193
  }
1190
1194
  },
1191
- [E, e]
1195
+ [z, e]
1192
1196
  ), L = i.useCallback(
1193
1197
  (p, d) => {
1194
- const w = e.get(p), v = w ? $(w) : null;
1195
- if (!w || !v || v.draggable !== !0 || St(d.target) || Rt(d.target))
1198
+ const b = e.get(p), v = b ? F(b) : null;
1199
+ if (!b || !v || v.draggable !== !0 || St(d.target) || Rt(d.target))
1196
1200
  return;
1197
- const S = et(d.currentTarget, p);
1198
- S && E(p, w, S, d);
1201
+ const S = nt(d.currentTarget, p);
1202
+ S && z(p, b, S, d);
1199
1203
  },
1200
- [E, e]
1204
+ [z, e]
1201
1205
  ), x = i.useCallback(
1202
- (p, d, w) => {
1206
+ (p, d, b) => {
1203
1207
  const v = e.get(p);
1204
- if (!v || !X(v))
1208
+ if (!v || !U(v))
1205
1209
  return;
1206
- const S = l[p] ?? U(v);
1210
+ const S = l[p] ?? j(v);
1207
1211
  if (!S)
1208
1212
  return;
1209
- const R = Ct(v), C = Rn(v), k = u[p] ?? { x: 0, y: 0 };
1210
- if (w.stopPropagation(), w.preventDefault(), w.currentTarget.setPointerCapture)
1213
+ const P = Et(v), E = Rn(v), k = c[p] ?? { x: 0, y: 0 };
1214
+ if (b.stopPropagation(), b.preventDefault(), b.currentTarget.setPointerCapture)
1211
1215
  try {
1212
- w.currentTarget.setPointerCapture(w.pointerId);
1216
+ b.currentTarget.setPointerCapture(b.pointerId);
1213
1217
  } catch {
1214
1218
  }
1215
1219
  m.current = {
1216
1220
  layerId: p,
1217
- pointerId: w.pointerId,
1221
+ pointerId: b.pointerId,
1218
1222
  horizontalEdge: d.horizontal,
1219
1223
  verticalEdge: d.vertical,
1220
- startX: w.clientX,
1221
- startY: w.clientY,
1224
+ startX: b.clientX,
1225
+ startY: b.clientY,
1222
1226
  startWidth: S.width,
1223
1227
  startHeight: S.height,
1224
1228
  startPosition: k,
1225
- baseLeft: R.left,
1226
- baseTop: R.top,
1227
- minWidth: C.minWidth,
1228
- maxWidth: C.maxWidth,
1229
- minHeight: C.minHeight,
1230
- maxHeight: C.maxHeight,
1231
- target: w.currentTarget
1232
- }, c(p);
1229
+ baseLeft: P.left,
1230
+ baseTop: P.top,
1231
+ minWidth: E.minWidth,
1232
+ maxWidth: E.maxWidth,
1233
+ minHeight: E.minHeight,
1234
+ maxHeight: E.maxHeight,
1235
+ target: b.currentTarget
1236
+ }, u(p);
1233
1237
  },
1234
- [e, u, l]
1238
+ [e, c, l]
1235
1239
  ), N = i.useCallback(
1236
1240
  (p) => {
1237
1241
  const d = f.current;
1238
1242
  if (!d)
1239
1243
  return;
1240
- const w = p.clientX - d.pointerStartX, v = p.clientY - d.pointerStartY, S = {
1241
- x: d.initialTranslationX + w,
1244
+ const b = p.clientX - d.pointerStartX, v = p.clientY - d.pointerStartY, S = {
1245
+ x: d.initialTranslationX + b,
1242
1246
  y: d.initialTranslationY + v
1243
1247
  };
1244
- a((R) => ({ ...R, [d.layerId]: S })), b(d.layerId, {
1248
+ a((P) => ({ ...P, [d.layerId]: S })), w(d.layerId, {
1245
1249
  left: d.baseLeft + S.x,
1246
1250
  top: d.baseTop + S.y
1247
1251
  });
1248
1252
  },
1249
- [b]
1250
- ), D = i.useCallback(
1253
+ [w]
1254
+ ), M = i.useCallback(
1251
1255
  (p) => {
1252
1256
  const d = m.current;
1253
1257
  if (!d || d.pointerId !== p.pointerId || !e.get(d.layerId))
1254
1258
  return;
1255
- const v = p.clientX - d.startX, S = p.clientY - d.startY, R = Pn(d.horizontalEdge, d.startWidth, v), C = yn(d.verticalEdge, d.startHeight, S), k = zt(R, d.minWidth, d.maxWidth), _ = zt(C, d.minHeight, d.maxHeight), O = d.startWidth - k, Z = d.startHeight - _, it = Ln(
1259
+ const v = p.clientX - d.startX, S = p.clientY - d.startY, P = Pn(d.horizontalEdge, d.startWidth, v), E = yn(d.verticalEdge, d.startHeight, S), k = Ct(P, d.minWidth, d.maxWidth), $ = Ct(E, d.minHeight, d.maxHeight), O = d.startWidth - k, Z = d.startHeight - $, it = Ln(
1256
1260
  d.horizontalEdge,
1257
1261
  d.startPosition.x,
1258
1262
  O
1259
- ), Yt = Mn(d.verticalEdge, d.startPosition.y, Z), K = l[d.layerId], at = { width: k, height: _ };
1260
- (!K || K.width !== k || K.height !== _) && (g((q) => ({
1261
- ...q,
1263
+ ), Xt = Mn(d.verticalEdge, d.startPosition.y, Z), q = l[d.layerId], at = { width: k, height: $ };
1264
+ (!q || q.width !== k || q.height !== $) && (g((J) => ({
1265
+ ...J,
1262
1266
  [d.layerId]: at
1263
- })), z(d.layerId, at));
1264
- const ct = u[d.layerId] ?? { x: 0, y: 0 }, W = { x: it, y: Yt };
1265
- (ct.x !== W.x || ct.y !== W.y) && (a((q) => ({
1266
- ...q,
1267
- [d.layerId]: W
1268
- })), b(d.layerId, {
1269
- left: d.baseLeft + W.x,
1270
- top: d.baseTop + W.y
1267
+ })), C(d.layerId, at));
1268
+ const ct = c[d.layerId] ?? { x: 0, y: 0 }, B = { x: it, y: Xt };
1269
+ (ct.x !== B.x || ct.y !== B.y) && (a((J) => ({
1270
+ ...J,
1271
+ [d.layerId]: B
1272
+ })), w(d.layerId, {
1273
+ left: d.baseLeft + B.x,
1274
+ top: d.baseTop + B.y
1271
1275
  }));
1272
1276
  },
1273
- [e, u, l, b, z]
1274
- ), T = i.useCallback((p) => {
1277
+ [e, c, l, w, C]
1278
+ ), D = i.useCallback((p) => {
1275
1279
  const d = f.current;
1276
1280
  if (d) {
1277
1281
  if (d.pointerId === p.pointerId && d.target.releasePointerCapture)
@@ -1282,7 +1286,7 @@ const Xe = {
1282
1286
  f.current = null;
1283
1287
  }
1284
1288
  r(null);
1285
- }, []), M = i.useCallback((p) => {
1289
+ }, []), A = i.useCallback((p) => {
1286
1290
  const d = m.current;
1287
1291
  if (d) {
1288
1292
  if (d.pointerId === p.pointerId && d.target.releasePointerCapture)
@@ -1292,54 +1296,54 @@ const Xe = {
1292
1296
  }
1293
1297
  m.current = null;
1294
1298
  }
1295
- c(null);
1299
+ u(null);
1296
1300
  }, []);
1297
- tt(o !== null, {
1301
+ et(o !== null, {
1298
1302
  onMove: N,
1299
- onUp: T,
1300
- onCancel: T
1301
- }), tt(s !== null, {
1302
- onMove: D,
1303
- onUp: M,
1304
- onCancel: M
1303
+ onUp: D,
1304
+ onCancel: D
1305
+ }), et(s !== null, {
1306
+ onMove: M,
1307
+ onUp: A,
1308
+ onCancel: A
1305
1309
  });
1306
- const y = i.useCallback(
1310
+ const I = i.useCallback(
1307
1311
  (p) => {
1308
- const d = En(p), w = $(p);
1309
- if (!w || w.draggable !== !0)
1312
+ const d = zn(p), b = F(p);
1313
+ if (!b || b.draggable !== !0)
1310
1314
  return d;
1311
- const v = u[p.id], S = o === p.id, R = s === p.id, C = v ? { transform: `translate(${v.x}px, ${v.y}px)` } : {}, k = l[p.id], _ = X(p) ? U(p) : null, O = k ?? _, Z = O ? { width: `${O.width}px`, height: `${O.height}px` } : {};
1315
+ const v = c[p.id], S = o === p.id, P = s === p.id, E = v ? { transform: `translate(${v.x}px, ${v.y}px)` } : {}, k = l[p.id], $ = U(p) ? j(p) : null, O = k ?? $, Z = O ? { width: `${O.width}px`, height: `${O.height}px` } : {};
1312
1316
  return {
1313
1317
  ...d,
1314
1318
  ...Z,
1315
- ...C,
1316
- ...S || R ? { cursor: "grabbing" } : {}
1319
+ ...E,
1320
+ ...S || P ? { cursor: "grabbing" } : {}
1317
1321
  };
1318
1322
  },
1319
- [o, u, l, s]
1320
- ), ot = i.useCallback(
1323
+ [o, c, l, s]
1324
+ ), R = i.useCallback(
1321
1325
  (p) => {
1322
- if (!X(p))
1326
+ if (!U(p))
1323
1327
  return { isResizable: !1 };
1324
- const w = l[p.id], v = U(p);
1325
- return (w ?? v) !== null ? { isResizable: !0, onPointerDown: (k, _) => {
1326
- x(p.id, k, _);
1328
+ const b = l[p.id], v = j(p);
1329
+ return (b ?? v) !== null ? { isResizable: !0, onPointerDown: (k, $) => {
1330
+ x(p.id, k, $);
1327
1331
  } } : { isResizable: !1 };
1328
1332
  },
1329
1333
  [x, l]
1330
1334
  ), rt = i.useCallback(
1331
1335
  (p) => {
1332
- const { isResizable: d, onPointerDown: w } = ot(p), v = y(p), S = s === p.id;
1336
+ const { isResizable: d, onPointerDown: b } = R(p), v = I(p), S = s === p.id;
1333
1337
  return {
1334
1338
  style: v,
1335
1339
  isResizable: d,
1336
1340
  isResizing: S,
1337
- onResizeHandlePointerDown: (R, C) => {
1338
- w && w(R, C);
1341
+ onResizeHandlePointerDown: (P, E) => {
1342
+ b && b(P, E);
1339
1343
  }
1340
1344
  };
1341
1345
  },
1342
- [y, ot, s]
1346
+ [I, R, s]
1343
1347
  ), st = i.useCallback(
1344
1348
  (p) => ({
1345
1349
  "data-drag-handle": "true",
@@ -1355,12 +1359,12 @@ const Xe = {
1355
1359
  return {
1356
1360
  providerValue: i.useMemo(
1357
1361
  () => ({
1358
- handleLayerPointerDown: P,
1362
+ handleLayerPointerDown: y,
1359
1363
  getLayerRenderState: rt,
1360
1364
  getLayerHandleProps: st,
1361
1365
  isRootLevel: n
1362
1366
  }),
1363
- [st, rt, P, n]
1367
+ [st, rt, y, n]
1364
1368
  ),
1365
1369
  draggingLayerId: o,
1366
1370
  resizingLayerId: s
@@ -1373,7 +1377,7 @@ const Xe = {
1373
1377
  }
1374
1378
  if (typeof t.width == "number" && typeof t.height == "number")
1375
1379
  return { width: t.width, height: t.height };
1376
- }, Bt = {
1380
+ }, Vt = {
1377
1381
  display: "grid",
1378
1382
  width: "100%",
1379
1383
  height: "100%",
@@ -1384,77 +1388,78 @@ const Xe = {
1384
1388
  WebkitUserSelect: "none",
1385
1389
  userSelect: "none"
1386
1390
  }, An = {
1387
- ...Bt,
1391
+ ...Vt,
1392
+ overflow: "visible",
1388
1393
  height: "auto",
1389
1394
  minHeight: "100%"
1390
- }, Hn = (t) => t ? An : Bt, jn = ({ config: t, layers: e, style: n, root: o = !1 }) => {
1391
- const r = i.useRef(null), { isIntersecting: s } = ue(r, { threshold: 0 });
1392
- return /* @__PURE__ */ h(Ce, { config: t, layers: e, style: n, children: /* @__PURE__ */ h(Nn, { gridRef: r, isIntersecting: s, isRoot: o }) });
1395
+ }, Hn = (t) => t ? An : Vt, Kn = ({ config: t, layers: e, style: n, root: o = !1 }) => {
1396
+ const r = i.useRef(null), { isIntersecting: s } = de(r, { threshold: 0 });
1397
+ return /* @__PURE__ */ h(Ee, { config: t, layers: e, style: n, children: /* @__PURE__ */ h(Nn, { gridRef: r, isIntersecting: s, isRoot: o }) });
1393
1398
  }, Nn = ({ gridRef: t, isIntersecting: e, isRoot: n }) => {
1394
- const { config: o, style: r, layers: s } = Ee(), { normalizedLayers: c, visibleLayers: u, regularLayers: a, layerById: l } = Je(o, s.defs), { columnHandles: g, rowHandles: f, gapSizes: m, gridStyle: b, handleResize: z } = dn(o, r, t), { providerValue: E, draggingLayerId: P, resizingLayerId: L } = In({
1395
- layers: c,
1399
+ const { config: o, style: r, layers: s } = Ht(), { normalizedLayers: u, visibleLayers: c, regularLayers: a, layerById: l } = Je(o, s.defs), { columnHandles: g, rowHandles: f, gapSizes: m, gridStyle: w, handleResize: C } = dn(o, r, t), { providerValue: z, draggingLayerId: y, resizingLayerId: L } = Tn({
1400
+ layers: u,
1396
1401
  layerById: l,
1397
1402
  isRootLevel: n
1398
- }), x = P ? !0 : !!L, N = i.useMemo(() => ({
1403
+ }), x = y ? !0 : !!L, N = i.useMemo(() => ({
1399
1404
  ...Hn(n),
1400
- ...b,
1405
+ ...w,
1401
1406
  ...x ? kn : {}
1402
- }), [b, x, n]);
1403
- return /* @__PURE__ */ A(H, { children: [
1404
- /* @__PURE__ */ A(
1407
+ }), [w, x, n]);
1408
+ return /* @__PURE__ */ H(_, { children: [
1409
+ /* @__PURE__ */ H(
1405
1410
  "div",
1406
1411
  {
1407
1412
  ref: t,
1408
1413
  style: N,
1409
- "data-dragging": !!P,
1414
+ "data-dragging": !!y,
1410
1415
  "data-resizing": !!L,
1411
1416
  "data-visible": e,
1412
1417
  children: [
1413
- /* @__PURE__ */ h(ze, { value: E, children: /* @__PURE__ */ h(Fe, { layers: a }) }),
1414
- g.map(({ trackIndex: D, align: T, span: M }) => /* @__PURE__ */ h(
1418
+ /* @__PURE__ */ h(ze, { value: z, children: /* @__PURE__ */ h(_e, { layers: a }) }),
1419
+ g.map(({ trackIndex: M, align: D, span: A }) => /* @__PURE__ */ h(
1415
1420
  mt,
1416
1421
  {
1417
1422
  direction: "col",
1418
- trackIndex: D,
1419
- align: T,
1423
+ trackIndex: M,
1424
+ align: D,
1420
1425
  gap: m.columnGap,
1421
- span: M,
1422
- onResize: z
1426
+ span: A,
1427
+ onResize: C
1423
1428
  },
1424
- `col-${D}:${T}`
1429
+ `col-${M}:${D}`
1425
1430
  )),
1426
- f.map(({ trackIndex: D, align: T, span: M }) => /* @__PURE__ */ h(
1431
+ f.map(({ trackIndex: M, align: D, span: A }) => /* @__PURE__ */ h(
1427
1432
  mt,
1428
1433
  {
1429
1434
  direction: "row",
1430
- trackIndex: D,
1431
- align: T,
1435
+ trackIndex: M,
1436
+ align: D,
1432
1437
  gap: m.rowGap,
1433
- span: M,
1434
- onResize: z
1438
+ span: A,
1439
+ onResize: C
1435
1440
  },
1436
- `row-${D}:${T}`
1441
+ `row-${M}:${D}`
1437
1442
  ))
1438
1443
  ]
1439
1444
  }
1440
1445
  ),
1441
- /* @__PURE__ */ h(Se, { layers: u })
1446
+ /* @__PURE__ */ h(Ce, { layers: c })
1442
1447
  ] });
1443
1448
  };
1444
1449
  export {
1445
- me as D,
1450
+ we as D,
1446
1451
  _t as F,
1447
- jn as G,
1448
- Ze as R,
1449
- Xn as a,
1450
- xt as b,
1451
- G as c,
1452
+ Kn as G,
1453
+ Ke as R,
1454
+ Un as a,
1455
+ kt as b,
1456
+ W as c,
1452
1457
  Ve as d,
1453
- Wt as e,
1454
- Se as f,
1455
- Vn as g,
1458
+ Yt as e,
1459
+ Ce as f,
1460
+ Xn as g,
1456
1461
  Tt as r,
1457
- Un as t,
1462
+ jn as t,
1458
1463
  Be as u
1459
1464
  };
1460
- //# sourceMappingURL=GridLayout-tpSM0iM-.js.map
1465
+ //# sourceMappingURL=GridLayout-CJTKq7Mp.js.map