react-panel-layout 0.2.0 → 0.3.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.
@@ -1,8 +1,8 @@
1
- import { jsxs as _, Fragment as O, jsx as w } from "react/jsx-runtime";
2
- import * as a from "react";
3
- import { o as xt, p as kt, q as Tt, r as It, s as Ht, t as At, u as _t, v as $t, G as W, w as y, C as Nt, a as Gt, b as Ot, R as ct, x as Wt, y as K } from "./styles-BnvLfp6e.js";
4
- import { createPortal as Ft } from "react-dom";
5
- const Bt = () => {
1
+ import { jsxs as N, Fragment as $, jsx as h } from "react/jsx-runtime";
2
+ import * as i from "react";
3
+ import { C as Tt, F as It, e as Ht, D as At, a as Nt, f as $t, g as _t, h as Gt, b as Ft, i as Ot, G as O, j as y, k as Wt, l as Bt, m as Yt, R as ut, n as Xt, o as K } from "./FloatingPanelFrame-BkjBp0S5.js";
4
+ import { createPortal as Ut } from "react-dom";
5
+ const jt = () => {
6
6
  const t = /* @__PURE__ */ new Map();
7
7
  return (e) => {
8
8
  if (!e)
@@ -13,8 +13,8 @@ const Bt = () => {
13
13
  const o = t.size;
14
14
  return t.set(e, o), o;
15
15
  };
16
- }, Yt = Bt(), q = /* @__PURE__ */ new Map(), Xt = (t) => {
17
- const e = `ovs-threshold:${t.threshold}-rootMargin:${t.rootMargin}-root:${Yt(t.root)}`;
16
+ }, Vt = jt(), q = /* @__PURE__ */ new Map(), Zt = (t) => {
17
+ const e = `ovs-threshold:${t.threshold}-rootMargin:${t.rootMargin}-root:${Vt(t.root)}`;
18
18
  if (q.has(e))
19
19
  return q.get(e);
20
20
  const n = new class {
@@ -32,7 +32,7 @@ const Bt = () => {
32
32
  }
33
33
  }();
34
34
  return q.set(e, n), n;
35
- }, ut = Object.freeze({
35
+ }, lt = Object.freeze({
36
36
  x: 0,
37
37
  y: 0,
38
38
  width: 0,
@@ -42,45 +42,42 @@ const Bt = () => {
42
42
  bottom: 0,
43
43
  left: 0
44
44
  });
45
- function Ut(t, { threshold: e = 0, rootMargin: n = "0px", root: o = null }) {
46
- const [r, s] = a.useState(null);
47
- return a.useEffect(() => {
45
+ function Kt(t, { threshold: e = 0, rootMargin: n = "0px", root: o = null }) {
46
+ const [r, s] = i.useState(null);
47
+ return i.useEffect(() => {
48
48
  const c = t.current;
49
- return c ? Xt({
49
+ return c ? Zt({
50
50
  threshold: e,
51
51
  rootMargin: n,
52
52
  root: o
53
- }).observe(c, (i) => {
53
+ }).observe(c, (a) => {
54
54
  s({
55
- isIntersecting: i.isIntersecting,
56
- boundingClientRect: i.boundingClientRect,
57
- intersectionRatio: i.intersectionRatio,
58
- intersectionRect: i.intersectionRect,
59
- rootBounds: i.rootBounds,
60
- target: i.target,
61
- time: i.time
55
+ isIntersecting: a.isIntersecting,
56
+ boundingClientRect: a.boundingClientRect,
57
+ intersectionRatio: a.intersectionRatio,
58
+ intersectionRect: a.intersectionRect,
59
+ rootBounds: a.rootBounds,
60
+ target: a.target,
61
+ time: a.time
62
62
  });
63
63
  }) : void 0;
64
- }, [t, e, n, o]), a.useMemo(() => ({
64
+ }, [t, e, n, o]), i.useMemo(() => ({
65
65
  isIntersecting: r?.isIntersecting ?? !1,
66
- boundingClientRect: r?.boundingClientRect ?? ut,
66
+ boundingClientRect: r?.boundingClientRect ?? lt,
67
67
  intersectionRatio: r?.intersectionRatio ?? 0,
68
- intersectionRect: r?.intersectionRect ?? ut,
68
+ intersectionRect: r?.intersectionRect ?? lt,
69
69
  rootBounds: r?.rootBounds ?? null,
70
70
  target: r?.target ?? t.current,
71
71
  time: r?.time ?? 0
72
72
  }), [r, t]);
73
73
  }
74
- const jt = {
74
+ const J = {
75
75
  position: "fixed",
76
76
  inset: 0,
77
- background: "rgba(0, 0, 0, 0.5)"
78
- }, Zt = {
79
- position: "fixed",
80
- background: kt,
81
- boxShadow: xt,
77
+ background: Tt
78
+ }, qt = {
82
79
  willChange: "transform"
83
- }, Vt = {
80
+ }, dt = {
84
81
  left: {
85
82
  top: 0,
86
83
  bottom: 0,
@@ -105,124 +102,129 @@ const jt = {
105
102
  right: 0,
106
103
  transform: "translateY(100%)"
107
104
  }
108
- }, Kt = {
109
- display: "flex",
110
- alignItems: "center",
111
- padding: `${At} ${_t}`,
112
- gap: Ht,
113
- borderBottom: `1px solid ${It}`
114
- }, qt = {
115
- fontWeight: 600
116
- }, Jt = {
105
+ }, Jt = i.memo(({ style: t, dismissible: e, onClose: n }) => {
106
+ const o = e ? n : void 0, r = i.useMemo(() => ({ ...J, ...t }), [t]);
107
+ return /* @__PURE__ */ h("div", { style: r, onClick: o });
108
+ }), Qt = (t, e) => t ? e : !1, te = {
117
109
  marginLeft: "auto",
118
110
  border: "none",
119
111
  background: "transparent",
120
112
  cursor: "pointer",
121
- fontSize: $t
122
- }, Qt = {
123
- padding: Tt
124
- }, te = a.memo(({ style: t, dismissible: e, onClose: n }) => {
125
- const o = e ? n : void 0, r = a.useMemo(() => ({ ...jt, ...t }), [t]);
126
- return /* @__PURE__ */ w("div", { style: r, onClick: o });
127
- }), ee = a.memo(({ header: t, dismissible: e, onClose: n }) => {
113
+ fontSize: Ot
114
+ }, ee = ({ header: t, dismissible: e, onClose: n }) => {
128
115
  if (!t)
129
116
  return null;
130
- const o = t.showCloseButton ?? !0, r = () => t.title ? /* @__PURE__ */ w("div", { style: qt, children: t.title }) : null, s = () => !o || !e ? null : /* @__PURE__ */ w("button", { style: Jt, onClick: n, "aria-label": "Close drawer", type: "button", children: "×" });
131
- return /* @__PURE__ */ _("div", { style: Kt, children: [
132
- r(),
133
- s()
134
- ] });
135
- }), ne = ({
117
+ const o = t.showCloseButton ?? !0, r = Qt(e, o);
118
+ return /* @__PURE__ */ h(i.Activity, { mode: t ? "visible" : "hidden", children: /* @__PURE__ */ N(
119
+ Nt,
120
+ {
121
+ style: { padding: `${_t} ${Gt}`, gap: $t },
122
+ children: [
123
+ /* @__PURE__ */ h(i.Activity, { mode: t ? "visible" : "hidden", children: /* @__PURE__ */ h(Ft, { children: t.title }) }),
124
+ /* @__PURE__ */ h(i.Activity, { mode: r ? "visible" : "hidden", children: /* @__PURE__ */ h("button", { style: te, onClick: n, "aria-label": "Close drawer", type: "button", children: "×" }) })
125
+ ]
126
+ }
127
+ ) });
128
+ }, ne = ({ header: t, dismissible: e, onClose: n, chrome: o, children: r }) => o ? /* @__PURE__ */ N(It, { style: { height: "100%", borderRadius: 0 }, children: [
129
+ /* @__PURE__ */ h(ee, { header: t, dismissible: e, onClose: n }),
130
+ /* @__PURE__ */ h(
131
+ Ht,
132
+ {
133
+ style: { padding: At, flex: 1, display: "flex", flexDirection: "column" },
134
+ children: r
135
+ }
136
+ )
137
+ ] }) : /* @__PURE__ */ h($, { children: r }), re = ({
136
138
  id: t,
137
139
  config: e,
138
140
  isOpen: n,
139
141
  onClose: o,
140
142
  children: r,
141
- className: s,
142
- style: c,
143
- zIndex: u,
144
- width: i,
145
- height: f,
146
- position: d,
147
- backdropStyle: p
143
+ zIndex: s,
144
+ width: c,
145
+ height: u,
146
+ position: a
148
147
  }) => {
149
- const { dismissible: h = !0, header: v } = e, P = a.useCallback((z) => z ? z.left !== void 0 ? "left" : z.right !== void 0 ? "right" : z.top !== void 0 ? "top" : z.bottom !== void 0 ? "bottom" : "right" : "right", [])(d), M = a.useMemo(() => {
150
- const z = {
151
- ...Zt,
152
- ...Vt[P],
153
- ...c
148
+ const { dismissible: f = !0, header: d, chrome: p = !0, inline: m = !1 } = e, v = i.useCallback((S) => S ? S.left !== void 0 ? "left" : S.right !== void 0 ? "right" : S.top !== void 0 ? "top" : S.bottom !== void 0 ? "bottom" : "right" : "right", [])(a), P = {
149
+ left: "translateX(0)",
150
+ right: "translateX(0)",
151
+ top: "translateY(0)",
152
+ bottom: "translateY(0)"
153
+ }, M = i.useMemo(() => {
154
+ const S = {
155
+ ...qt,
156
+ ...m ? { position: "absolute" } : { position: "fixed" },
157
+ ...dt[v],
158
+ transform: n ? P[v] : dt[v].transform,
159
+ transition: "transform 220ms ease"
154
160
  };
155
- return u !== void 0 && (z.zIndex = u), i !== void 0 && (z.width = typeof i == "number" ? `${i}px` : i), f !== void 0 && (z.height = typeof f == "number" ? `${f}px` : f), z;
156
- }, [c, u, i, f, P]), x = v ? Qt : void 0, $ = () => v ? /* @__PURE__ */ w(ee, { header: v, dismissible: h, onClose: o }) : null;
157
- return /* @__PURE__ */ _(O, { children: [
158
- p ? /* @__PURE__ */ w(a.Activity, { mode: n ? "visible" : "hidden", children: /* @__PURE__ */ w(te, { style: p, dismissible: h, onClose: o }) }) : null,
159
- /* @__PURE__ */ w(a.Activity, { mode: n ? "visible" : "hidden", children: /* @__PURE__ */ _(
161
+ return s !== void 0 && (S.zIndex = s), c !== void 0 && (S.width = typeof c == "number" ? `${c}px` : c), u !== void 0 && (S.height = typeof u == "number" ? `${u}px` : u), S;
162
+ }, [u, m, n, v, c, s]), x = d?.title ?? e.ariaLabel ?? "Drawer", _ = m ? { ...J, position: "absolute" } : J;
163
+ return /* @__PURE__ */ N($, { children: [
164
+ /* @__PURE__ */ h(i.Activity, { mode: n ? "visible" : "hidden", children: /* @__PURE__ */ h(Jt, { style: _, dismissible: f, onClose: o }) }),
165
+ /* @__PURE__ */ h(i.Activity, { mode: n ? "visible" : "hidden", children: /* @__PURE__ */ h(
160
166
  "div",
161
167
  {
162
- className: s,
163
168
  "data-layer-id": t,
164
- "data-placement": P,
169
+ "data-placement": v,
165
170
  style: M,
166
171
  role: "dialog",
167
- "aria-modal": h ? !0 : void 0,
172
+ "aria-modal": f ? !0 : void 0,
168
173
  "aria-hidden": n ? void 0 : !0,
169
- "aria-label": v?.title ?? "Drawer",
170
- children: [
171
- $(),
172
- /* @__PURE__ */ w("div", { style: x, children: r })
173
- ]
174
+ "aria-label": x,
175
+ children: /* @__PURE__ */ h(ne, { header: d, dismissible: f, onClose: o, chrome: p, children: r })
174
176
  }
175
177
  ) })
176
178
  ] });
177
179
  };
178
180
  function T(t) {
179
- const e = a.useRef(t);
180
- return e.current = t, a.useCallback((...n) => {
181
+ const e = i.useRef(t);
182
+ return e.current = t, i.useCallback((...n) => {
181
183
  const o = e.current;
182
184
  if (o)
183
185
  return o(...n);
184
186
  }, []);
185
187
  }
186
- const re = (t) => {
187
- const [e, n] = a.useState(() => {
188
- const i = {};
188
+ const oe = (t) => {
189
+ const [e, n] = i.useState(() => {
190
+ const a = {};
189
191
  return t.forEach((f) => {
190
- f.drawer && (i[f.id] = f.drawer.defaultOpen ?? !1);
191
- }), i;
192
- }), o = a.useMemo(() => {
193
- const i = /* @__PURE__ */ new Map();
192
+ f.drawer && (a[f.id] = f.drawer.defaultOpen ?? !1);
193
+ }), a;
194
+ }), o = i.useMemo(() => {
195
+ const a = /* @__PURE__ */ new Map();
194
196
  return t.forEach((f) => {
195
- i.set(f.id, f);
196
- }), i;
197
- }, [t]), r = T((i, f) => {
198
- o.get(i)?.drawer?.onStateChange?.(f);
199
- }), s = a.useCallback(
200
- (i) => {
201
- const f = o.get(i);
202
- return f?.drawer ? f.drawer.open !== void 0 ? f.drawer.open : e[i] ?? !1 : !1;
197
+ a.set(f.id, f);
198
+ }), a;
199
+ }, [t]), r = T((a, f) => {
200
+ o.get(a)?.drawer?.onStateChange?.(f);
201
+ }), s = i.useCallback(
202
+ (a) => {
203
+ const f = o.get(a);
204
+ return f?.drawer ? f.drawer.open !== void 0 ? f.drawer.open : e[a] ?? !1 : !1;
203
205
  },
204
206
  [o, e]
205
- ), c = a.useCallback(
206
- (i) => {
207
- const f = o.get(i);
207
+ ), c = i.useCallback(
208
+ (a) => {
209
+ const f = o.get(a);
208
210
  if (f?.drawer) {
209
211
  if (f.drawer.open !== void 0) {
210
- r(i, !0);
212
+ r(a, !0);
211
213
  return;
212
214
  }
213
- n((d) => d[i] ? d : (r(i, !0), { ...d, [i]: !0 }));
215
+ n((d) => d[a] ? d : (r(a, !0), { ...d, [a]: !0 }));
214
216
  }
215
217
  },
216
218
  [o, r]
217
- ), u = a.useCallback(
218
- (i) => {
219
- const f = o.get(i);
219
+ ), u = i.useCallback(
220
+ (a) => {
221
+ const f = o.get(a);
220
222
  if (f?.drawer) {
221
223
  if (f.drawer.open !== void 0) {
222
- r(i, !1);
224
+ r(a, !1);
223
225
  return;
224
226
  }
225
- n((d) => d[i] ? (r(i, !1), { ...d, [i]: !1 }) : d);
227
+ n((d) => d[a] ? (r(a, !1), { ...d, [a]: !1 }) : d);
226
228
  }
227
229
  },
228
230
  [o, r]
@@ -232,52 +234,50 @@ const re = (t) => {
232
234
  open: c,
233
235
  close: u
234
236
  };
235
- }, oe = ({ layers: t }) => {
236
- const e = re(t), n = a.useMemo(() => t.filter((r) => r.drawer), [t]), o = a.useMemo(() => {
237
+ }, se = ({ layers: t }) => {
238
+ const e = oe(t), n = i.useMemo(() => t.filter((r) => r.drawer), [t]), o = i.useMemo(() => {
237
239
  const r = /* @__PURE__ */ new Map();
238
240
  return n.forEach((s) => {
239
241
  r.set(s.id, () => e.close(s.id));
240
242
  }), r;
241
243
  }, [n, e.close]);
242
- return /* @__PURE__ */ w(O, { children: n.map((r) => {
244
+ return /* @__PURE__ */ h($, { children: n.map((r) => {
243
245
  if (!r.drawer)
244
246
  return null;
245
247
  const s = e.state(r.id), c = o.get(r.id);
246
- return c ? /* @__PURE__ */ w(
247
- ne,
248
+ return c ? /* @__PURE__ */ h(
249
+ re,
248
250
  {
249
251
  id: r.id,
250
252
  config: r.drawer,
251
253
  isOpen: s,
252
254
  onClose: c,
253
- style: r.style,
254
255
  zIndex: r.zIndex,
255
256
  width: r.width,
256
257
  height: r.height,
257
258
  position: r.position,
258
- backdropStyle: r.backdropStyle,
259
259
  children: r.component
260
260
  },
261
261
  r.id
262
262
  ) : null;
263
263
  }) });
264
- }, zt = a.createContext(null), se = ({ value: t, children: e }) => /* @__PURE__ */ w(zt.Provider, { value: t, children: e }), ie = () => {
265
- const t = a.useContext(zt);
264
+ }, Rt = i.createContext(null), ie = ({ value: t, children: e }) => /* @__PURE__ */ h(Rt.Provider, { value: t, children: e }), ae = () => {
265
+ const t = i.useContext(Rt);
266
266
  if (!t)
267
267
  throw new Error("useGridLayoutContext must be used within a GridLayoutProvider.");
268
268
  return t;
269
- }, Ct = a.createContext(null), ae = () => {
270
- const t = a.useContext(Ct);
269
+ }, Pt = i.createContext(null), ce = () => {
270
+ const t = i.useContext(Pt);
271
271
  if (!t)
272
272
  throw new Error("usePanelSystem must be used within a PanelSystemProvider.");
273
273
  return t;
274
- }, ce = ({ config: t, layers: e, style: n, children: o }) => {
275
- const r = a.useMemo(() => {
274
+ }, ue = ({ config: t, layers: e, style: n, children: o }) => {
275
+ const r = i.useMemo(() => {
276
276
  const c = /* @__PURE__ */ new Map();
277
277
  return e.forEach((u) => {
278
278
  c.set(u.id, u);
279
279
  }), c;
280
- }, [e]), s = a.useMemo(
280
+ }, [e]), s = i.useMemo(
281
281
  () => ({
282
282
  config: t,
283
283
  style: n,
@@ -288,57 +288,57 @@ const re = (t) => {
288
288
  }),
289
289
  [t, n, e, r]
290
290
  );
291
- return /* @__PURE__ */ w(Ct.Provider, { value: s, children: o });
292
- }, Rt = a.createContext(null), Pt = ({ layerId: t, children: e }) => {
293
- const n = a.useMemo(() => ({ layerId: t }), [t]);
294
- return /* @__PURE__ */ w(Rt.Provider, { value: n, children: e });
295
- }, Sn = () => {
296
- const t = a.useContext(Rt);
291
+ return /* @__PURE__ */ h(Pt.Provider, { value: s, children: o });
292
+ }, yt = i.createContext(null), Dt = ({ layerId: t, children: e }) => {
293
+ const n = i.useMemo(() => ({ layerId: t }), [t]);
294
+ return /* @__PURE__ */ h(yt.Provider, { value: n, children: e });
295
+ }, Cn = () => {
296
+ const t = i.useContext(yt);
297
297
  if (!t)
298
298
  throw new Error("useLayerInstance must be used within a LayerInstanceProvider.");
299
299
  return t;
300
- }, lt = (t, e, n) => {
300
+ }, ft = (t, e, n) => {
301
301
  if (typeof t == "number" && Number.isFinite(t))
302
302
  return t;
303
303
  throw new Error(`Popup layer "${n}" requires a numeric "${e}" value.`);
304
- }, yt = (t, e) => {
304
+ }, Lt = (t, e) => {
305
305
  if (!t)
306
306
  throw new Error(`Popup layer "${e}" must define position (left/top).`);
307
307
  return {
308
- left: lt(t.left, "left", e),
309
- top: lt(t.top, "top", e)
308
+ left: ft(t.left, "left", e),
309
+ top: ft(t.top, "top", e)
310
310
  };
311
- }, F = (t) => `${Math.round(t)}`, A = (t) => {
311
+ }, W = (t) => `${Math.round(t)}`, A = (t) => {
312
312
  if (t !== void 0)
313
313
  return t ? "yes" : "no";
314
- }, ue = (t, e, n, o, r) => {
315
- const s = {}, c = yt(e, t);
314
+ }, le = (t, e, n, o, r) => {
315
+ const s = {}, c = Lt(e, t);
316
316
  if (typeof n != "number" || typeof o != "number")
317
317
  throw new Error(`Popup layer "${t}" requires numeric width/height.`);
318
- s.width = F(n), s.height = F(o), s.left = F(c.left), s.top = F(c.top);
318
+ s.width = W(n), s.height = W(o), s.left = W(c.left), s.top = W(c.top);
319
319
  const u = r?.features;
320
320
  if (u) {
321
- const i = A(u.toolbar), f = A(u.menubar), d = A(u.location), p = A(u.status), h = A(u.resizable), v = A(u.scrollbars);
322
- i !== void 0 && (s.toolbar = i), f !== void 0 && (s.menubar = f), d !== void 0 && (s.location = d), p !== void 0 && (s.status = p), h !== void 0 && (s.resizable = h), v !== void 0 && (s.scrollbars = v);
321
+ const a = A(u.toolbar), f = A(u.menubar), d = A(u.location), p = A(u.status), m = A(u.resizable), E = A(u.scrollbars);
322
+ a !== void 0 && (s.toolbar = a), f !== void 0 && (s.menubar = f), d !== void 0 && (s.location = d), p !== void 0 && (s.status = p), m !== void 0 && (s.resizable = m), E !== void 0 && (s.scrollbars = E);
323
323
  }
324
- return Object.entries(s).map(([i, f]) => `${i}=${f}`).join(",");
325
- }, dt = (t, e, n, o, r) => {
326
- const s = yt(n, e);
324
+ return Object.entries(s).map(([a, f]) => `${a}=${f}`).join(",");
325
+ }, pt = (t, e, n, o, r) => {
326
+ const s = Lt(n, e);
327
327
  if (typeof o != "number" || typeof r != "number")
328
328
  throw new Error(`Popup layer "${e}" requires numeric width/height.`);
329
329
  t.moveTo(Math.round(s.left), Math.round(s.top)), t.resizeTo(Math.round(o), Math.round(r));
330
- }, le = ({ layer: t }) => {
330
+ }, de = ({ layer: t }) => {
331
331
  const e = t.floating;
332
332
  if (!e)
333
333
  throw new Error(`Layer "${t.id}" is missing floating configuration required for popup mode.`);
334
334
  if ((e.mode ?? "embedded") !== "popup")
335
335
  throw new Error(`PopupLayerPortal received layer "${t.id}" that is not configured for popup mode.`);
336
- const o = a.useRef(null), r = a.useRef(null), [s, c] = a.useState(!1);
337
- return a.useEffect(() => {
336
+ const o = i.useRef(null), r = i.useRef(null), [s, c] = i.useState(!1);
337
+ return i.useEffect(() => {
338
338
  if (typeof window > "u")
339
339
  return;
340
- const u = ue(t.id, t.position, t.width, t.height, e.popup), i = e.popup?.name ?? t.id, f = de(
341
- i,
340
+ const u = le(t.id, t.position, t.width, t.height, e.popup), a = e.popup?.name ?? t.id, f = fe(
341
+ a,
342
342
  u,
343
343
  {
344
344
  position: t.position,
@@ -351,12 +351,12 @@ const re = (t) => {
351
351
  const d = f;
352
352
  r.current = d, e.popup?.focus !== !1 && d.focus(), d.document.title || (d.document.title = t.id), d.document.body.innerHTML = "";
353
353
  const p = d.document.createElement("div");
354
- p.dataset.layerId = t.id, d.document.body.appendChild(p), o.current = p, c(!0), dt(d, t.id, t.position, t.width, t.height);
355
- const h = () => {
354
+ p.dataset.layerId = t.id, d.document.body.appendChild(p), o.current = p, c(!0), pt(d, t.id, t.position, t.width, t.height);
355
+ const m = () => {
356
356
  r.current = null, o.current = null, c(!1);
357
357
  };
358
- return d.addEventListener("beforeunload", h), () => {
359
- d.removeEventListener("beforeunload", h), e.popup?.closeOnUnmount !== !1 && d.close(), r.current = null, o.current = null, c(!1);
358
+ return d.addEventListener("beforeunload", m), () => {
359
+ d.removeEventListener("beforeunload", m), e.popup?.closeOnUnmount !== !1 && d.close(), r.current = null, o.current = null, c(!1);
360
360
  };
361
361
  }, [
362
362
  e.popup?.closeOnUnmount,
@@ -369,28 +369,28 @@ const re = (t) => {
369
369
  e.popup?.focus,
370
370
  e.popup?.name,
371
371
  t.id
372
- ]), a.useEffect(() => {
372
+ ]), i.useEffect(() => {
373
373
  const u = r.current;
374
- u && dt(u, t.id, t.position, t.width, t.height);
375
- }, [t.position?.left, t.position?.top, t.height, t.width, t.id]), !s || !o.current ? null : Ft(/* @__PURE__ */ w(Pt, { layerId: t.id, children: t.component }), o.current);
376
- }, de = (t, e, n, o) => {
374
+ u && pt(u, t.id, t.position, t.width, t.height);
375
+ }, [t.position?.left, t.position?.top, t.height, t.width, t.id]), !s || !o.current ? null : Ut(/* @__PURE__ */ h(Dt, { layerId: t.id, children: t.component }), o.current);
376
+ }, fe = (t, e, n, o) => {
377
377
  const r = o?.createWindow;
378
378
  return r ? r({ name: t, features: e, bounds: n }) : window.open("", t, e);
379
- }, Dt = {
379
+ }, Mt = {
380
380
  position: "absolute",
381
381
  pointerEvents: "auto",
382
382
  boxSizing: "border-box",
383
383
  background: "transparent",
384
384
  border: "none"
385
- }, fe = {
386
- ...Dt,
385
+ }, pe = {
386
+ ...Mt,
387
387
  width: y,
388
388
  height: y,
389
389
  zIndex: 2
390
- }, pe = {
391
- ...Dt,
392
- zIndex: 1
393
390
  }, ge = {
391
+ ...Mt,
392
+ zIndex: 1
393
+ }, he = {
394
394
  "top-left": {
395
395
  top: 0,
396
396
  left: 0,
@@ -415,12 +415,12 @@ const re = (t) => {
415
415
  transform: "translate(50%, 50%)",
416
416
  cursor: "nwse-resize"
417
417
  }
418
- }, he = {
418
+ }, me = {
419
419
  left: {
420
420
  top: y,
421
421
  bottom: y,
422
422
  left: 0,
423
- width: W,
423
+ width: O,
424
424
  transform: "translateX(-50%)",
425
425
  cursor: "ew-resize"
426
426
  },
@@ -428,7 +428,7 @@ const re = (t) => {
428
428
  top: y,
429
429
  bottom: y,
430
430
  right: 0,
431
- width: W,
431
+ width: O,
432
432
  transform: "translateX(50%)",
433
433
  cursor: "ew-resize"
434
434
  },
@@ -436,7 +436,7 @@ const re = (t) => {
436
436
  left: y,
437
437
  right: y,
438
438
  top: 0,
439
- height: W,
439
+ height: O,
440
440
  transform: "translateY(-50%)",
441
441
  cursor: "ns-resize"
442
442
  },
@@ -444,11 +444,11 @@ const re = (t) => {
444
444
  left: y,
445
445
  right: y,
446
446
  bottom: 0,
447
- height: W,
447
+ height: O,
448
448
  transform: "translateY(50%)",
449
449
  cursor: "ns-resize"
450
450
  }
451
- }, me = [
451
+ }, be = [
452
452
  { key: "top-left", variant: "corner", horizontal: "left", vertical: "top" },
453
453
  { key: "top-right", variant: "corner", horizontal: "right", vertical: "top" },
454
454
  { key: "bottom-left", variant: "corner", horizontal: "left", vertical: "bottom" },
@@ -457,9 +457,9 @@ const re = (t) => {
457
457
  { key: "right", variant: "edge", horizontal: "right" },
458
458
  { key: "top", variant: "edge", vertical: "top" },
459
459
  { key: "bottom", variant: "edge", vertical: "bottom" }
460
- ], we = ({ layerId: t, onPointerDown: e }) => /* @__PURE__ */ w(O, { children: me.map((n) => {
461
- const o = n.variant === "corner" ? fe : pe, r = n.variant === "corner" ? ge[n.key] : he[n.key], s = { ...o, ...r }, c = n.variant === "corner" ? { "data-resize-corner": n.key } : { "data-resize-edge": n.key };
462
- return /* @__PURE__ */ w(
460
+ ], we = ({ layerId: t, onPointerDown: e }) => /* @__PURE__ */ h($, { children: be.map((n) => {
461
+ const o = n.variant === "corner" ? pe : ge, r = n.variant === "corner" ? he[n.key] : me[n.key], s = { ...o, ...r }, c = n.variant === "corner" ? { "data-resize-corner": n.key } : { "data-resize-edge": n.key };
462
+ return /* @__PURE__ */ h(
463
463
  "div",
464
464
  {
465
465
  role: "presentation",
@@ -471,49 +471,49 @@ const re = (t) => {
471
471
  },
472
472
  n.key
473
473
  );
474
- }) }), be = ({ layers: t }) => {
475
- const { handleLayerPointerDown: e, getLayerRenderState: n } = ie(), o = a.useCallback((r) => r.length === 0 ? null : r.map((s) => /* @__PURE__ */ w(we, { layerId: s.layerId, onPointerDown: s.onPointerDown }, s.layerId)), []);
476
- return /* @__PURE__ */ w(O, { children: t.map((r) => {
474
+ }) }), ve = ({ layers: t }) => {
475
+ const { handleLayerPointerDown: e, getLayerRenderState: n } = ae(), o = i.useCallback((r) => r.length === 0 ? null : r.map((s) => /* @__PURE__ */ h(we, { layerId: s.layerId, onPointerDown: s.onPointerDown }, s.layerId)), []);
476
+ return /* @__PURE__ */ h($, { children: t.map((r) => {
477
477
  const s = r.floating?.mode ?? "embedded";
478
478
  if (r.floating && s === "popup")
479
- return /* @__PURE__ */ w(le, { layer: r }, r.id);
480
- const { style: c, isResizable: u, isResizing: i, onResizeHandlePointerDown: f } = n(r), d = {};
479
+ return /* @__PURE__ */ h(de, { layer: r }, r.id);
480
+ const { style: c, isResizable: u, isResizing: a, onResizeHandlePointerDown: f } = n(r), d = {};
481
481
  r.gridArea && (d.gridArea = r.gridArea), r.gridRow && (d.gridRow = r.gridRow), r.gridColumn && (d.gridColumn = r.gridColumn);
482
- const h = u ? { ...c, ...d, position: "relative" } : { ...c, ...d }, S = o(u ? [
482
+ const m = u ? { ...c, ...d, position: "relative" } : { ...c, ...d }, v = o(u ? [
483
483
  {
484
484
  layerId: r.id,
485
485
  onPointerDown: f
486
486
  }
487
487
  ] : []);
488
- return /* @__PURE__ */ _(
488
+ return /* @__PURE__ */ N(
489
489
  "div",
490
490
  {
491
491
  "data-layer-id": r.id,
492
492
  "data-draggable": !!r.floating?.draggable,
493
493
  "data-resizable": u,
494
- "data-resizing": i,
495
- style: h,
494
+ "data-resizing": a,
495
+ style: m,
496
496
  onPointerDown: e,
497
497
  children: [
498
- /* @__PURE__ */ w(Pt, { layerId: r.id, children: r.component }),
499
- S
498
+ /* @__PURE__ */ h(Dt, { layerId: r.id, children: r.component }),
499
+ v
500
500
  ]
501
501
  },
502
502
  r.id
503
503
  );
504
504
  }) });
505
505
  };
506
- function J(t, e) {
506
+ function Q(t, e) {
507
507
  const n = T(e.onMove), o = T(e.onUp), r = T(e.onCancel);
508
- a.useEffect(() => {
508
+ i.useEffect(() => {
509
509
  if (t)
510
510
  return e.onMove && document.addEventListener("pointermove", n, { passive: !1 }), e.onUp && document.addEventListener("pointerup", o), e.onCancel && document.addEventListener("pointercancel", r), () => {
511
511
  e.onMove && document.removeEventListener("pointermove", n), e.onUp && document.removeEventListener("pointerup", o), e.onCancel && document.removeEventListener("pointercancel", r);
512
512
  };
513
513
  }, [t, e.onMove, e.onUp, e.onCancel, n, o, r]);
514
514
  }
515
- function ve(t, e, n) {
516
- a.useEffect(() => {
515
+ function Ee(t, e, n) {
516
+ i.useEffect(() => {
517
517
  const o = t.current;
518
518
  if (!(!e || !o || n === void 0))
519
519
  return o.setPointerCapture(n), () => {
@@ -521,8 +521,8 @@ function ve(t, e, n) {
521
521
  };
522
522
  }, [t, e, n]);
523
523
  }
524
- function Ee(t, e, n = ["pointerdown", "pointermove", "pointerup"]) {
525
- a.useEffect(() => {
524
+ function ze(t, e, n = ["pointerdown", "pointermove", "pointerup"]) {
525
+ i.useEffect(() => {
526
526
  const o = t.current;
527
527
  if (!e || !o)
528
528
  return;
@@ -538,31 +538,31 @@ function Ee(t, e, n = ["pointerdown", "pointermove", "pointerup"]) {
538
538
  };
539
539
  }, [t, e, n]);
540
540
  }
541
- function Se(t, e, n) {
542
- const { onMove: o, onUp: r, onCancel: s, pointerId: c, capturePointer: u = !0, preventDefaults: i = !0 } = n;
543
- J(e, { onMove: o, onUp: r, onCancel: s }), ve(t, e ? u : !1, c), Ee(t, e ? i : !1);
541
+ function Ce(t, e, n) {
542
+ const { onMove: o, onUp: r, onCancel: s, pointerId: c, capturePointer: u = !0, preventDefaults: a = !0 } = n;
543
+ Q(e, { onMove: o, onUp: r, onCancel: s }), Ee(t, e ? u : !1, c), ze(t, e ? a : !1);
544
544
  }
545
- const ze = (t) => {
546
- const e = a.useRef(null), n = a.useRef(null), o = a.useRef(0), [r, s] = a.useState(!1), c = T((p) => {
545
+ const Se = (t) => {
546
+ const e = i.useRef(null), n = i.useRef(null), o = i.useRef(0), [r, s] = i.useState(!1), c = T((p) => {
547
547
  t.onResize?.(p);
548
- }), u = a.useCallback(
548
+ }), u = i.useCallback(
549
549
  (p) => t.axis === "x" ? p.clientX : p.clientY,
550
550
  [t.axis]
551
- ), i = a.useCallback(
551
+ ), a = i.useCallback(
552
552
  (p) => {
553
553
  p.preventDefault(), e.current = p.currentTarget, n.current = p.pointerId, o.current = u(p), s(!0);
554
554
  },
555
555
  [u]
556
- ), f = a.useCallback(
556
+ ), f = i.useCallback(
557
557
  (p) => {
558
- const h = u(p), v = h - o.current;
559
- v !== 0 && (o.current = h, c(v));
558
+ const m = u(p), E = m - o.current;
559
+ E !== 0 && (o.current = m, c(E));
560
560
  },
561
561
  [u, c]
562
- ), d = a.useCallback(() => {
562
+ ), d = i.useCallback(() => {
563
563
  s(!1), n.current = null;
564
564
  }, []);
565
- return Se(e, r, {
565
+ return Ce(e, r, {
566
566
  onMove: f,
567
567
  onUp: d,
568
568
  pointerId: n.current ?? void 0,
@@ -570,71 +570,71 @@ const ze = (t) => {
570
570
  preventDefaults: !1
571
571
  }), {
572
572
  ref: e,
573
- onPointerDown: i,
573
+ onPointerDown: a,
574
574
  isDragging: r
575
575
  };
576
- }, Ce = ({
576
+ }, Re = ({
577
577
  element: t,
578
578
  component: e
579
- }) => a.forwardRef(({ children: n, ...o }, r) => t ? a.cloneElement(
579
+ }) => i.forwardRef(({ children: n, ...o }, r) => t ? i.cloneElement(
580
580
  t,
581
581
  { ...o, ref: r },
582
582
  n ?? t.props.children
583
- ) : e ? /* @__PURE__ */ w(e, { ...o, ref: r, children: n }) : /* @__PURE__ */ w("div", { ...o, ref: r, children: n }));
584
- function Re({
583
+ ) : e ? /* @__PURE__ */ h(e, { ...o, ref: r, children: n }) : /* @__PURE__ */ h("div", { ...o, ref: r, children: n }));
584
+ function Pe({
585
585
  element: t,
586
586
  component: e
587
587
  }) {
588
- return a.useMemo(
589
- () => Ce({
588
+ return i.useMemo(
589
+ () => Re({
590
590
  element: t,
591
591
  component: e
592
592
  }),
593
593
  [e, t]
594
594
  );
595
595
  }
596
- const Pe = {
596
+ const ye = {
597
597
  position: "absolute",
598
- zIndex: Wt
599
- }, ye = {
598
+ zIndex: Xt
599
+ }, De = {
600
600
  vertical: {
601
- width: ct,
601
+ width: ut,
602
602
  height: "100%",
603
603
  top: 0,
604
604
  cursor: "col-resize"
605
605
  },
606
606
  horizontal: {
607
607
  width: "100%",
608
- height: ct,
608
+ height: ut,
609
609
  left: 0,
610
610
  cursor: "row-resize"
611
611
  }
612
- }, De = {
613
- idle: Ot,
614
- hovered: Gt,
615
- dragging: Nt
616
- }, Le = ({
612
+ }, Le = {
613
+ idle: Yt,
614
+ hovered: Bt,
615
+ dragging: Wt
616
+ }, Me = ({
617
617
  direction: t,
618
618
  onResize: e,
619
619
  component: n,
620
620
  element: o,
621
621
  children: r
622
622
  }) => {
623
- const s = t === "vertical" ? "x" : "y", { ref: c, isDragging: u, onPointerDown: i } = ze({ axis: s, onResize: e }), [f, d] = a.useState(!1), p = a.useCallback(() => {
623
+ const s = t === "vertical" ? "x" : "y", { ref: c, isDragging: u, onPointerDown: a } = Se({ axis: s, onResize: e }), [f, d] = i.useState(!1), p = i.useCallback(() => {
624
624
  d(!0);
625
- }, []), h = a.useCallback(() => {
625
+ }, []), m = i.useCallback(() => {
626
626
  d(!1);
627
- }, []), v = Re({
627
+ }, []), E = Pe({
628
628
  element: o,
629
629
  component: n
630
- }), S = a.useMemo(() => u ? "dragging" : f ? "hovered" : "idle", [u, f]), P = a.useMemo(() => ({
631
- ...Pe,
632
- ...ye[t],
633
- backgroundColor: De[S],
630
+ }), v = i.useMemo(() => u ? "dragging" : f ? "hovered" : "idle", [u, f]), P = i.useMemo(() => ({
631
+ ...ye,
632
+ ...De[t],
633
+ backgroundColor: Le[v],
634
634
  touchAction: "none"
635
- }), [t, S]);
636
- return /* @__PURE__ */ w(
637
- v,
635
+ }), [t, v]);
636
+ return /* @__PURE__ */ h(
637
+ E,
638
638
  {
639
639
  ref: c,
640
640
  style: P,
@@ -644,16 +644,16 @@ const Pe = {
644
644
  "data-resize-handle": "true",
645
645
  "data-direction": t,
646
646
  "data-is-dragging": u ? "true" : void 0,
647
- onPointerDown: i,
647
+ onPointerDown: a,
648
648
  onPointerEnter: p,
649
- onPointerLeave: h,
649
+ onPointerLeave: m,
650
650
  children: r
651
651
  }
652
652
  );
653
- }, ft = {
653
+ }, gt = {
654
654
  position: "absolute",
655
655
  pointerEvents: "auto"
656
- }, pt = ({
656
+ }, ht = ({
657
657
  direction: t,
658
658
  trackIndex: e,
659
659
  align: n,
@@ -661,28 +661,29 @@ const Pe = {
661
661
  span: r,
662
662
  onResize: s
663
663
  }) => {
664
- const c = t === "col" ? "vertical" : "horizontal", u = a.useCallback(
664
+ const c = t === "col" ? "vertical" : "horizontal", u = i.useCallback(
665
665
  (d) => {
666
- s(t, e, d);
666
+ const p = n === "start" ? -d : d;
667
+ s(t, e, p);
667
668
  },
668
- [t, e, s]
669
- ), i = a.useMemo(() => t === "col" ? {
669
+ [n, t, e, s]
670
+ ), a = i.useMemo(() => t === "col" ? {
670
671
  gridColumn: `${e + 1} / ${e + 2}`,
671
672
  gridRow: `${r.start} / ${r.end}`
672
673
  } : {
673
674
  gridRow: `${e + 1} / ${e + 2}`,
674
675
  gridColumn: `${r.start} / ${r.end}`
675
- }, [t, e, r]), f = a.useMemo(() => {
676
+ }, [t, e, r]), f = i.useMemo(() => {
676
677
  const p = Math.max(0, o) / 2 + K / 2;
677
678
  return t === "col" ? {
678
- ...ft,
679
+ ...gt,
679
680
  width: K,
680
681
  height: "100%",
681
682
  top: 0,
682
683
  bottom: 0,
683
684
  ...n === "start" ? { left: -p } : { right: -p }
684
685
  } : {
685
- ...ft,
686
+ ...gt,
686
687
  width: "100%",
687
688
  height: K,
688
689
  left: 0,
@@ -690,8 +691,8 @@ const Pe = {
690
691
  ...n === "start" ? { top: -p } : { bottom: -p }
691
692
  };
692
693
  }, [n, t, o]);
693
- return /* @__PURE__ */ w("div", { "data-resizable": "true", style: { ...i, position: "relative", pointerEvents: "none" }, children: /* @__PURE__ */ w("div", { "data-direction": c, "data-align": n, "data-handle": "true", style: f, children: /* @__PURE__ */ w(Le, { direction: c, onResize: u }) }) });
694
- }, Me = (t) => {
694
+ 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: f, children: /* @__PURE__ */ h(Me, { direction: c, onResize: u }) }) });
695
+ }, xe = (t) => {
695
696
  const e = /* @__PURE__ */ new Map();
696
697
  t.forEach((o, r) => {
697
698
  o.forEach((s, c) => {
@@ -708,25 +709,25 @@ const Pe = {
708
709
  e.set(s, f);
709
710
  return;
710
711
  }
711
- const i = {
712
+ const a = {
712
713
  rowStart: r,
713
714
  rowEnd: r,
714
715
  colStart: c,
715
716
  colEnd: c
716
717
  };
717
- e.set(s, i);
718
+ e.set(s, a);
718
719
  });
719
720
  });
720
721
  const n = /* @__PURE__ */ new Map();
721
722
  return e.forEach((o, r) => {
722
- const s = o.rowStart + 1, c = o.rowEnd + 2, u = o.colStart + 1, i = o.colEnd + 2, f = {
723
+ const s = o.rowStart + 1, c = o.rowEnd + 2, u = o.colStart + 1, a = o.colEnd + 2, f = {
723
724
  gridArea: r,
724
725
  gridRow: `${s} / ${c}`,
725
- gridColumn: `${u} / ${i}`
726
+ gridColumn: `${u} / ${a}`
726
727
  };
727
728
  n.set(r, f);
728
729
  }), n;
729
- }, xe = (t, e) => {
730
+ }, ke = (t, e) => {
730
731
  if ((t.positionMode ?? "grid") !== "grid")
731
732
  return t;
732
733
  const o = t.gridArea ?? t.id, r = e.get(o);
@@ -739,17 +740,17 @@ const Pe = {
739
740
  gridRow: c ? r.gridRow : t.gridRow,
740
741
  gridColumn: u ? r.gridColumn : t.gridColumn
741
742
  };
742
- }, ke = (t, e) => {
743
- const n = a.useMemo(() => Me(t.areas), [t.areas]), o = a.useMemo(() => e.map((u) => xe(u, n)), [e, n]), r = a.useMemo(
743
+ }, Te = (t, e) => {
744
+ const n = i.useMemo(() => xe(t.areas), [t.areas]), o = i.useMemo(() => e.map((u) => ke(u, n)), [e, n]), r = i.useMemo(
744
745
  () => o.filter((u) => u.visible !== !1),
745
746
  [o]
746
- ), s = a.useMemo(
747
+ ), s = i.useMemo(
747
748
  () => r.filter((u) => !u.drawer),
748
749
  [r]
749
- ), c = a.useMemo(() => {
750
+ ), c = i.useMemo(() => {
750
751
  const u = /* @__PURE__ */ new Map();
751
- return o.forEach((i) => {
752
- u.set(i.id, i);
752
+ return o.forEach((a) => {
753
+ u.set(a.id, a);
753
754
  }), u;
754
755
  }, [o]);
755
756
  return {
@@ -758,42 +759,42 @@ const Pe = {
758
759
  regularLayers: s,
759
760
  layerById: c
760
761
  };
761
- }, Te = typeof window < "u" && typeof window.document < "u", Lt = Te ? a.useLayoutEffect : a.useEffect, U = (t, e) => `${t}-${e}`, Ie = (t, e, n, o) => {
762
+ }, Ie = typeof window < "u" && typeof window.document < "u", xt = Ie ? i.useLayoutEffect : i.useEffect, U = (t, e) => `${t}-${e}`, He = (t, e, n, o) => {
762
763
  const r = U(n, o), s = e[r];
763
764
  return s !== void 0 ? `${s}px` : t.size;
764
- }, gt = (t, e, n) => t.map((o, r) => Ie(o, e, n, r)).join(" "), B = (t, e) => t.reduce((n, o, r) => (o.resizable && o.size.endsWith("px") && (n[U(e, r)] = parseInt(o.size, 10)), n), {}), He = (t, e, n) => {
765
+ }, mt = (t, e, n) => t.map((o, r) => He(o, e, n, r)).join(" "), B = (t, e) => t.reduce((n, o, r) => (o.resizable && o.size.endsWith("px") && (n[U(e, r)] = parseInt(o.size, 10)), n), {}), Ae = (t, e, n) => {
765
766
  const o = e !== void 0 ? Math.max(t, e) : t;
766
767
  return n !== void 0 ? Math.min(o, n) : o;
767
- }, Ae = (t, e, n) => {
768
+ }, Ne = (t, e, n) => {
768
769
  const o = t + e;
769
- return He(o, n.minSize, n.maxSize);
770
- }, _e = (t, e, n, o, r) => {
770
+ return Ae(o, n.minSize, n.maxSize);
771
+ }, $e = (t, e, n, o, r) => {
771
772
  const s = U(t, e);
772
773
  return (c) => {
773
- const u = Ae(n, o, r);
774
+ const u = Ne(n, o, r);
774
775
  return { ...c, [s]: u };
775
776
  };
776
- }, ht = (t, e) => {
777
+ }, bt = (t, e) => {
777
778
  const n = t.length, o = [];
778
779
  for (let c = 0; c < n; c++) {
779
- const u = t[c], i = u[e], f = u[e + 1];
780
- i !== f && o.push(c);
780
+ const u = t[c], a = u[e], f = u[e + 1];
781
+ a !== f && o.push(c);
781
782
  }
782
783
  if (o.length === 0)
783
784
  return { start: 1, end: n + 1 };
784
785
  const r = Math.min(...o), s = Math.max(...o);
785
786
  return { start: r + 1, end: s + 2 };
786
- }, mt = (t, e) => {
787
+ }, wt = (t, e) => {
787
788
  const n = t[e], o = t[e + 1], r = n?.length ?? 0, s = [];
788
- for (let i = 0; i < r; i++) {
789
- const f = n?.[i], d = o?.[i];
790
- f !== d && s.push(i);
789
+ for (let a = 0; a < r; a++) {
790
+ const f = n?.[a], d = o?.[a];
791
+ f !== d && s.push(a);
791
792
  }
792
793
  if (s.length === 0)
793
794
  return { start: 1, end: r + 1 };
794
795
  const c = Math.min(...s), u = Math.max(...s);
795
796
  return { start: c + 1, end: u + 2 };
796
- }, $e = (t, e) => {
797
+ }, _e = (t, e) => {
797
798
  if (t.length === 0)
798
799
  return [];
799
800
  const n = e.length;
@@ -803,16 +804,16 @@ const Pe = {
803
804
  return Array.from({ length: t.length - 1 }, (s, c) => c).forEach((s) => {
804
805
  const c = t[s];
805
806
  if (t[s + 1]?.resizable) {
806
- const i = ht(e, s);
807
- o.push({ trackIndex: s + 1, align: "start", span: i });
807
+ const a = bt(e, s);
808
+ o.push({ trackIndex: s + 1, align: "start", span: a });
808
809
  return;
809
810
  }
810
811
  if (c?.resizable) {
811
- const i = ht(e, s);
812
- o.push({ trackIndex: s, align: "end", span: i });
812
+ const a = bt(e, s);
813
+ o.push({ trackIndex: s, align: "end", span: a });
813
814
  }
814
815
  }), o;
815
- }, Ne = (t, e) => {
816
+ }, Ge = (t, e) => {
816
817
  if (t.length === 0)
817
818
  return [];
818
819
  const n = e[0]?.length ?? 0;
@@ -822,16 +823,16 @@ const Pe = {
822
823
  return Array.from({ length: t.length - 1 }, (s, c) => c).forEach((s) => {
823
824
  const c = t[s];
824
825
  if (t[s + 1]?.resizable) {
825
- const i = mt(e, s);
826
- o.push({ trackIndex: s + 1, align: "start", span: i });
826
+ const a = wt(e, s);
827
+ o.push({ trackIndex: s + 1, align: "start", span: a });
827
828
  return;
828
829
  }
829
830
  if (c?.resizable) {
830
- const i = mt(e, s);
831
- o.push({ trackIndex: s, align: "end", span: i });
831
+ const a = wt(e, s);
832
+ o.push({ trackIndex: s, align: "end", span: a });
832
833
  }
833
834
  }), o;
834
- }, Ge = (t) => {
835
+ }, Fe = (t) => {
835
836
  if (!t)
836
837
  return { rowGap: 0, columnGap: 0 };
837
838
  const e = t.split(/\s+/).map((o) => o.trim()).filter(Boolean), n = (o) => {
@@ -849,41 +850,41 @@ const Pe = {
849
850
  }, Oe = (t) => t !== void 0 ? { gap: t } : {}, We = (t, e, n, o) => {
850
851
  const r = U(n, o), s = t[r];
851
852
  return s !== void 0 ? s : e.size.endsWith("px") ? Number.parseInt(e.size, 10) : 300;
852
- }, Fe = (t, e) => {
853
- const [n, o] = a.useState(() => ({
853
+ }, Be = (t, e) => {
854
+ const [n, o] = i.useState(() => ({
854
855
  ...B(t.columns, "col"),
855
856
  ...B(t.rows, "row")
856
857
  }));
857
- Lt(() => {
858
+ xt(() => {
858
859
  const d = {
859
860
  ...B(t.columns, "col"),
860
861
  ...B(t.rows, "row")
861
862
  };
862
863
  o((p) => {
863
- const h = /* @__PURE__ */ new Set([...Object.keys(p), ...Object.keys(d)]);
864
- return Array.from(h).some((S) => p[S] !== d[S]) ? d : p;
864
+ const m = /* @__PURE__ */ new Set([...Object.keys(p), ...Object.keys(d)]);
865
+ return Array.from(m).some((v) => p[v] !== d[v]) ? d : p;
865
866
  });
866
867
  }, [t.columns, t.rows]);
867
- const r = a.useMemo(() => t.areas.map((d) => `"${d.join(" ")}"`).join(" "), [t.areas]), s = a.useMemo(() => Ge(t.gap), [t.gap]), c = a.useMemo(
868
- () => $e(t.columns, t.areas),
868
+ const r = i.useMemo(() => t.areas.map((d) => `"${d.join(" ")}"`).join(" "), [t.areas]), s = i.useMemo(() => Fe(t.gap), [t.gap]), c = i.useMemo(
869
+ () => _e(t.columns, t.areas),
869
870
  [t.columns, t.areas]
870
- ), u = a.useMemo(
871
- () => Ne(t.rows, t.areas),
871
+ ), u = i.useMemo(
872
+ () => Ge(t.rows, t.areas),
872
873
  [t.rows, t.areas]
873
- ), i = a.useMemo(() => ({
874
+ ), a = i.useMemo(() => ({
874
875
  ...t.style,
875
876
  ...e,
876
877
  gridTemplateAreas: r,
877
- gridTemplateRows: gt(t.rows, n, "row"),
878
- gridTemplateColumns: gt(t.columns, n, "col"),
878
+ gridTemplateRows: mt(t.rows, n, "row"),
879
+ gridTemplateColumns: mt(t.columns, n, "col"),
879
880
  ...Oe(t.gap)
880
- }), [r, t.columns, t.gap, t.rows, t.style, e, n]), f = a.useCallback(
881
- (d, p, h) => {
882
- const S = (d === "row" ? t.rows : t.columns)[p];
883
- if (!S || !S.resizable)
881
+ }), [r, t.columns, t.gap, t.rows, t.style, e, n]), f = i.useCallback(
882
+ (d, p, m) => {
883
+ const v = (d === "row" ? t.rows : t.columns)[p];
884
+ if (!v || !v.resizable)
884
885
  return;
885
- const P = We(n, S, d, p);
886
- o(_e(d, p, P, h, S));
886
+ const P = We(n, v, d, p);
887
+ o($e(d, p, P, m, v));
887
888
  },
888
889
  [t.columns, t.rows, n]
889
890
  );
@@ -891,65 +892,65 @@ const Pe = {
891
892
  columnHandles: c,
892
893
  rowHandles: u,
893
894
  gapSizes: s,
894
- gridStyle: i,
895
+ gridStyle: a,
895
896
  handleResize: f
896
897
  };
897
- }, Be = (t, e = Number.NEGATIVE_INFINITY, n = Number.POSITIVE_INFINITY) => Math.min(Math.max(t, e), n), zn = (t, e) => typeof t != "number" || !Number.isFinite(t) ? e : t, Ye = (t) => t.positionMode ? t.positionMode : t.floating ? (t.floating.mode ?? "embedded") === "embedded" ? "absolute" : "relative" : "grid", Xe = (t) => ({ position: t === "grid" ? "relative" : t }), Ue = (t, e) => e !== "grid" ? {} : {
898
+ }, Ye = (t, e = Number.NEGATIVE_INFINITY, n = Number.POSITIVE_INFINITY) => Math.min(Math.max(t, e), n), Sn = (t, e) => typeof t != "number" || !Number.isFinite(t) ? e : t, Xe = (t) => t.positionMode ? t.positionMode : t.floating ? (t.floating.mode ?? "embedded") === "embedded" ? "absolute" : "relative" : "grid", Ue = (t) => ({ position: t === "grid" ? "relative" : t }), je = (t, e) => e !== "grid" ? {} : {
898
899
  gridArea: t.gridArea,
899
900
  gridRow: t.gridRow,
900
901
  gridColumn: t.gridColumn
901
- }, je = (t) => t ? {
902
+ }, Ve = (t) => t ? {
902
903
  top: t.top,
903
904
  right: t.right,
904
905
  bottom: t.bottom,
905
906
  left: t.left
906
- } : {}, Ze = (t) => t !== void 0 ? { zIndex: t } : {}, Ve = (t, e) => ({
907
+ } : {}, Ze = (t) => t !== void 0 ? { zIndex: t } : {}, Ke = (t, e) => ({
907
908
  width: t,
908
909
  height: e
909
- }), Ke = (t, e) => t.pointerEvents !== void 0 ? typeof t.pointerEvents == "boolean" ? { pointerEvents: t.pointerEvents ? "auto" : "none" } : { pointerEvents: t.pointerEvents } : e === "absolute" || e === "fixed" ? { pointerEvents: "auto" } : {}, qe = (t) => t.position, Je = (t) => ({
910
+ }), qe = (t, e) => t.pointerEvents !== void 0 ? typeof t.pointerEvents == "boolean" ? { pointerEvents: t.pointerEvents ? "auto" : "none" } : { pointerEvents: t.pointerEvents } : e === "absolute" || e === "fixed" ? { pointerEvents: "auto" } : {}, Je = (t) => t.position, Qe = (t) => ({
910
911
  width: t.width,
911
912
  height: t.height
912
- }), Qe = (t) => t.zIndex, tn = (t) => {
913
- const e = Ye(t), n = qe(t), o = Je(t), r = Qe(t);
913
+ }), tn = (t) => t.zIndex, en = (t) => {
914
+ const e = Xe(t), n = Je(t), o = Qe(t), r = tn(t);
914
915
  return {
915
916
  ...t.style,
916
- ...Xe(e),
917
- ...Ue(t, e),
918
- ...je(n),
917
+ ...Ue(e),
918
+ ...je(t, e),
919
+ ...Ve(n),
919
920
  ...Ze(r),
920
- ...Ve(o.width, o.height),
921
- ...Ke(t, e)
921
+ ...Ke(o.width, o.height),
922
+ ...qe(t, e)
922
923
  };
923
- }, en = (t) => {
924
+ }, nn = (t) => {
924
925
  const e = t.floating;
925
926
  return e ? e.mode ?? "embedded" : null;
926
- }, I = (t) => en(t) !== "embedded" ? null : t.floating ?? null, wt = (t) => t instanceof HTMLElement ? ["INPUT", "TEXTAREA", "SELECT", "BUTTON"].includes(t.tagName) : !1, bt = (t, e, n) => {
927
+ }, I = (t) => nn(t) !== "embedded" ? null : t.floating ?? null, vt = (t) => t instanceof HTMLElement ? ["INPUT", "TEXTAREA", "SELECT", "BUTTON"].includes(t.tagName) : !1, Et = (t, e, n) => {
927
928
  const o = e ?? Number.NEGATIVE_INFINITY, r = n ?? Number.POSITIVE_INFINITY;
928
- return Be(t, o, r);
929
- }, vt = (t, e, n) => {
929
+ return Ye(t, o, r);
930
+ }, zt = (t, e, n) => {
930
931
  if (typeof t == "number" && Number.isFinite(t))
931
932
  return t;
932
933
  throw new Error(
933
934
  `Floating layer "${n}" must provide a numeric "${e}" value when draggable mode is enabled.`
934
935
  );
935
- }, Et = (t) => {
936
+ }, Ct = (t) => {
936
937
  if (!I(t))
937
938
  throw new Error(`Floating layer "${t.id}" is missing floating configuration required for dragging.`);
938
939
  const n = t.position;
939
940
  if (!n)
940
941
  throw new Error(`Floating layer "${t.id}" must define position with left and top values.`);
941
942
  return {
942
- left: vt(n.left, "left", t.id),
943
- top: vt(n.top, "top", t.id)
943
+ left: zt(n.left, "left", t.id),
944
+ top: zt(n.top, "top", t.id)
944
945
  };
945
- }, nn = (t) => {
946
+ }, rn = (t) => {
946
947
  const e = I(t);
947
948
  return e ? e.constraints ?? {} : {};
948
- }, rn = (t, e, n) => t ? t === "left" ? e - n : e + n : e, on = (t, e, n) => t ? t === "top" ? e - n : e + n : e, sn = (t, e, n) => !t || t === "right" ? e : e + n, an = (t, e, n) => !t || t === "bottom" ? e : e + n, Q = (t, e) => t ? t.dataset.layerId === e ? t : Q(t.parentElement, e) : null, tt = (t, e, n) => !t || n?.(t) ? null : e(t) ? t : tt(t.parentElement, e, n), cn = (t) => t instanceof HTMLElement ? tt(
949
+ }, on = (t, e, n) => t ? t === "left" ? e - n : e + n : e, sn = (t, e, n) => t ? t === "top" ? e - n : e + n : e, an = (t, e, n) => !t || t === "right" ? e : e + n, cn = (t, e, n) => !t || t === "bottom" ? e : e + n, tt = (t, e) => t ? t.dataset.layerId === e ? t : tt(t.parentElement, e) : null, et = (t, e, n) => !t || n?.(t) ? null : e(t) ? t : et(t.parentElement, e, n), un = (t) => t instanceof HTMLElement ? et(
949
950
  t,
950
951
  (e) => e.dataset.dragHandle === "true",
951
952
  (e) => e.dataset.dragIgnore === "true"
952
- ) : null, St = (t) => t instanceof HTMLElement ? tt(
953
+ ) : null, St = (t) => t instanceof HTMLElement ? et(
953
954
  t,
954
955
  (e) => e.dataset.resizeCorner !== void 0 || e.dataset.resizeEdge !== void 0
955
956
  ) !== null : !1, Y = (t) => {
@@ -958,55 +959,55 @@ const Pe = {
958
959
  }, X = (t) => {
959
960
  if (!I(t))
960
961
  return null;
961
- const n = dn(t);
962
+ const n = fn(t);
962
963
  if (!n)
963
964
  throw new Error(`Floating layer "${t.id}" must define width and height when resizable or draggable.`);
964
965
  return {
965
966
  width: n.width,
966
967
  height: n.height
967
968
  };
968
- }, un = (t, e, n) => {
969
- const o = t.filter(Y).reduce((p, h) => {
970
- if (n === h.id) {
971
- const S = e[h.id];
972
- if (S)
973
- return p[h.id] = S, p;
969
+ }, ln = (t, e, n) => {
970
+ const o = t.filter(Y).reduce((p, m) => {
971
+ if (n === m.id) {
972
+ const v = e[m.id];
973
+ if (v)
974
+ return p[m.id] = v, p;
974
975
  }
975
- const v = X(h);
976
- return v && (p[h.id] = v), p;
977
- }, {}), r = Object.keys(e), s = Object.keys(o), c = r.length !== s.length, u = r.some((p) => !Object.prototype.hasOwnProperty.call(o, p)), i = c ? !0 : u, f = s.some((p) => {
978
- const h = e[p], v = o[p];
979
- return !h || !v ? !0 : h.width !== v.width || h.height !== v.height;
976
+ const E = X(m);
977
+ return E && (p[m.id] = E), p;
978
+ }, {}), r = Object.keys(e), s = Object.keys(o), c = r.length !== s.length, u = r.some((p) => !Object.prototype.hasOwnProperty.call(o, p)), a = c ? !0 : u, f = s.some((p) => {
979
+ const m = e[p], E = o[p];
980
+ return !m || !E ? !0 : m.width !== E.width || m.height !== E.height;
980
981
  });
981
982
  return {
982
983
  sizes: o,
983
- changed: i ? !0 : f
984
+ changed: a ? !0 : f
984
985
  };
985
- }, ln = ({
986
+ }, dn = ({
986
987
  layers: t,
987
988
  layerById: e
988
989
  }) => {
989
- const [n, o] = a.useState(null), [r, s] = a.useState(null), [c, u] = a.useState({}), [i, f] = a.useState({}), d = a.useRef(null), p = a.useRef(null), h = T((g, l) => {
990
+ const [n, o] = i.useState(null), [r, s] = i.useState(null), [c, u] = i.useState({}), [a, f] = i.useState({}), d = i.useRef(null), p = i.useRef(null), m = T((g, l) => {
990
991
  e.get(g)?.floating?.onMove?.(l);
991
- }), v = T((g, l) => {
992
+ }), E = T((g, l) => {
992
993
  e.get(g)?.floating?.onResize?.(l);
993
994
  });
994
- Lt(() => {
995
- const { sizes: g, changed: l } = un(t, i, r);
995
+ xt(() => {
996
+ const { sizes: g, changed: l } = ln(t, a, r);
996
997
  l && f(g);
997
998
  }, [t, r]);
998
- const S = a.useCallback(
999
- (g, l, m, b) => {
1000
- const E = Et(l), R = c[g] ?? { x: 0, y: 0 }, C = {
1001
- pointerStartX: b.clientX,
1002
- pointerStartY: b.clientY,
999
+ const v = i.useCallback(
1000
+ (g, l, b, w) => {
1001
+ const z = Ct(l), R = c[g] ?? { x: 0, y: 0 }, C = {
1002
+ pointerStartX: w.clientX,
1003
+ pointerStartY: w.clientY,
1003
1004
  initialTranslationX: R.x,
1004
1005
  initialTranslationY: R.y,
1005
- baseLeft: E.left,
1006
- baseTop: E.top,
1006
+ baseLeft: z.left,
1007
+ baseTop: z.top,
1007
1008
  layerId: g,
1008
- pointerId: b.pointerId,
1009
- target: m
1009
+ pointerId: w.pointerId,
1010
+ target: b
1010
1011
  };
1011
1012
  if (C.target.setPointerCapture)
1012
1013
  try {
@@ -1016,59 +1017,59 @@ const Pe = {
1016
1017
  d.current = C, o(g);
1017
1018
  },
1018
1019
  [c]
1019
- ), P = a.useCallback(
1020
+ ), P = i.useCallback(
1020
1021
  (g) => {
1021
- const l = g.target, m = cn(l);
1022
- if (!m)
1023
- return;
1024
- const b = m.closest("[data-layer-id]")?.getAttribute("data-layer-id");
1022
+ const l = g.target, b = un(l);
1025
1023
  if (!b)
1026
1024
  return;
1027
- const E = e.get(b);
1028
- if (!E)
1025
+ const w = b.closest("[data-layer-id]")?.getAttribute("data-layer-id");
1026
+ if (!w)
1027
+ return;
1028
+ const z = e.get(w);
1029
+ if (!z)
1029
1030
  return;
1030
- const R = I(E);
1031
- if (!(!R || R.draggable !== !0) && !wt(g.target) && !St(g.target) && m) {
1032
- const C = Q(m, b);
1031
+ const R = I(z);
1032
+ if (!(!R || R.draggable !== !0) && !vt(g.target) && !St(g.target) && b) {
1033
+ const C = tt(b, w);
1033
1034
  if (!C)
1034
1035
  return;
1035
- S(b, E, C, g);
1036
+ v(w, z, C, g);
1036
1037
  return;
1037
1038
  }
1038
1039
  },
1039
- [S, e]
1040
- ), M = a.useCallback(
1040
+ [v, e]
1041
+ ), M = i.useCallback(
1041
1042
  (g, l) => {
1042
- const m = e.get(g), b = m ? I(m) : null;
1043
- if (!m || !b || b.draggable !== !0 || wt(l.target) || St(l.target))
1043
+ const b = e.get(g), w = b ? I(b) : null;
1044
+ if (!b || !w || w.draggable !== !0 || vt(l.target) || St(l.target))
1044
1045
  return;
1045
- const E = Q(l.currentTarget, g);
1046
- E && S(g, m, E, l);
1046
+ const z = tt(l.currentTarget, g);
1047
+ z && v(g, b, z, l);
1047
1048
  },
1048
- [S, e]
1049
- ), x = a.useCallback(
1050
- (g, l, m) => {
1051
- const b = e.get(g);
1052
- if (!b || !Y(b))
1049
+ [v, e]
1050
+ ), x = i.useCallback(
1051
+ (g, l, b) => {
1052
+ const w = e.get(g);
1053
+ if (!w || !Y(w))
1053
1054
  return;
1054
- const E = i[g] ?? X(b);
1055
- if (!E)
1055
+ const z = a[g] ?? X(w);
1056
+ if (!z)
1056
1057
  return;
1057
- const R = Et(b), C = nn(b), D = c[g] ?? { x: 0, y: 0 };
1058
- if (m.stopPropagation(), m.preventDefault(), m.currentTarget.setPointerCapture)
1058
+ const R = Ct(w), C = rn(w), D = c[g] ?? { x: 0, y: 0 };
1059
+ if (b.stopPropagation(), b.preventDefault(), b.currentTarget.setPointerCapture)
1059
1060
  try {
1060
- m.currentTarget.setPointerCapture(m.pointerId);
1061
+ b.currentTarget.setPointerCapture(b.pointerId);
1061
1062
  } catch {
1062
1063
  }
1063
1064
  p.current = {
1064
1065
  layerId: g,
1065
- pointerId: m.pointerId,
1066
+ pointerId: b.pointerId,
1066
1067
  horizontalEdge: l.horizontal,
1067
1068
  verticalEdge: l.vertical,
1068
- startX: m.clientX,
1069
- startY: m.clientY,
1070
- startWidth: E.width,
1071
- startHeight: E.height,
1069
+ startX: b.clientX,
1070
+ startY: b.clientY,
1071
+ startWidth: z.width,
1072
+ startHeight: z.height,
1072
1073
  startPosition: D,
1073
1074
  baseLeft: R.left,
1074
1075
  baseTop: R.top,
@@ -1076,50 +1077,50 @@ const Pe = {
1076
1077
  maxWidth: C.maxWidth,
1077
1078
  minHeight: C.minHeight,
1078
1079
  maxHeight: C.maxHeight,
1079
- target: m.currentTarget
1080
+ target: b.currentTarget
1080
1081
  }, s(g);
1081
1082
  },
1082
- [e, c, i]
1083
- ), $ = a.useCallback(
1083
+ [e, c, a]
1084
+ ), _ = i.useCallback(
1084
1085
  (g) => {
1085
1086
  const l = d.current;
1086
1087
  if (!l)
1087
1088
  return;
1088
- const m = g.clientX - l.pointerStartX, b = g.clientY - l.pointerStartY, E = {
1089
- x: l.initialTranslationX + m,
1090
- y: l.initialTranslationY + b
1089
+ const b = g.clientX - l.pointerStartX, w = g.clientY - l.pointerStartY, z = {
1090
+ x: l.initialTranslationX + b,
1091
+ y: l.initialTranslationY + w
1091
1092
  };
1092
- u((R) => ({ ...R, [l.layerId]: E })), h(l.layerId, {
1093
- left: l.baseLeft + E.x,
1094
- top: l.baseTop + E.y
1093
+ u((R) => ({ ...R, [l.layerId]: z })), m(l.layerId, {
1094
+ left: l.baseLeft + z.x,
1095
+ top: l.baseTop + z.y
1095
1096
  });
1096
1097
  },
1097
- [h]
1098
- ), L = a.useCallback(
1098
+ [m]
1099
+ ), S = i.useCallback(
1099
1100
  (g) => {
1100
1101
  const l = p.current;
1101
1102
  if (!l || l.pointerId !== g.pointerId || !e.get(l.layerId))
1102
1103
  return;
1103
- const b = g.clientX - l.startX, E = g.clientY - l.startY, R = rn(l.horizontalEdge, l.startWidth, b), C = on(l.verticalEdge, l.startHeight, E), D = bt(R, l.minWidth, l.maxWidth), k = bt(C, l.minHeight, l.maxHeight), N = l.startWidth - D, j = l.startHeight - k, st = sn(
1104
+ const w = g.clientX - l.startX, z = g.clientY - l.startY, R = on(l.horizontalEdge, l.startWidth, w), C = sn(l.verticalEdge, l.startHeight, z), D = Et(R, l.minWidth, l.maxWidth), k = Et(C, l.minHeight, l.maxHeight), G = l.startWidth - D, j = l.startHeight - k, it = an(
1104
1105
  l.horizontalEdge,
1105
1106
  l.startPosition.x,
1106
- N
1107
- ), Mt = an(l.verticalEdge, l.startPosition.y, j), Z = i[l.layerId], it = { width: D, height: k };
1108
- (!Z || Z.width !== D || Z.height !== k) && (f((V) => ({
1109
- ...V,
1110
- [l.layerId]: it
1111
- })), v(l.layerId, it));
1112
- const at = c[l.layerId] ?? { x: 0, y: 0 }, G = { x: st, y: Mt };
1113
- (at.x !== G.x || at.y !== G.y) && (u((V) => ({
1114
- ...V,
1115
- [l.layerId]: G
1116
- })), h(l.layerId, {
1117
- left: l.baseLeft + G.x,
1118
- top: l.baseTop + G.y
1107
+ G
1108
+ ), kt = cn(l.verticalEdge, l.startPosition.y, j), V = a[l.layerId], at = { width: D, height: k };
1109
+ (!V || V.width !== D || V.height !== k) && (f((Z) => ({
1110
+ ...Z,
1111
+ [l.layerId]: at
1112
+ })), E(l.layerId, at));
1113
+ const ct = c[l.layerId] ?? { x: 0, y: 0 }, F = { x: it, y: kt };
1114
+ (ct.x !== F.x || ct.y !== F.y) && (u((Z) => ({
1115
+ ...Z,
1116
+ [l.layerId]: F
1117
+ })), m(l.layerId, {
1118
+ left: l.baseLeft + F.x,
1119
+ top: l.baseTop + F.y
1119
1120
  }));
1120
1121
  },
1121
- [e, c, i, h, v]
1122
- ), z = a.useCallback((g) => {
1122
+ [e, c, a, m, E]
1123
+ ), L = i.useCallback((g) => {
1123
1124
  const l = d.current;
1124
1125
  if (l) {
1125
1126
  if (l.pointerId === g.pointerId && l.target.releasePointerCapture)
@@ -1130,7 +1131,7 @@ const Pe = {
1130
1131
  d.current = null;
1131
1132
  }
1132
1133
  o(null);
1133
- }, []), H = a.useCallback((g) => {
1134
+ }, []), H = i.useCallback((g) => {
1134
1135
  const l = p.current;
1135
1136
  if (l) {
1136
1137
  if (l.pointerId === g.pointerId && l.target.releasePointerCapture)
@@ -1142,53 +1143,53 @@ const Pe = {
1142
1143
  }
1143
1144
  s(null);
1144
1145
  }, []);
1145
- J(n !== null, {
1146
- onMove: $,
1147
- onUp: z,
1148
- onCancel: z
1149
- }), J(r !== null, {
1150
- onMove: L,
1146
+ Q(n !== null, {
1147
+ onMove: _,
1148
+ onUp: L,
1149
+ onCancel: L
1150
+ }), Q(r !== null, {
1151
+ onMove: S,
1151
1152
  onUp: H,
1152
1153
  onCancel: H
1153
1154
  });
1154
- const et = a.useCallback(
1155
+ const nt = i.useCallback(
1155
1156
  (g) => {
1156
- const l = tn(g), m = I(g);
1157
- if (!m || m.draggable !== !0)
1157
+ const l = en(g), b = I(g);
1158
+ if (!b || b.draggable !== !0)
1158
1159
  return l;
1159
- const b = c[g.id], E = n === g.id, R = r === g.id, C = b ? { transform: `translate(${b.x}px, ${b.y}px)` } : {}, D = i[g.id], k = Y(g) ? X(g) : null, N = D ?? k, j = N ? { width: `${N.width}px`, height: `${N.height}px` } : {};
1160
+ const w = c[g.id], z = n === g.id, R = r === g.id, C = w ? { transform: `translate(${w.x}px, ${w.y}px)` } : {}, D = a[g.id], k = Y(g) ? X(g) : null, G = D ?? k, j = G ? { width: `${G.width}px`, height: `${G.height}px` } : {};
1160
1161
  return {
1161
1162
  ...l,
1162
1163
  ...j,
1163
1164
  ...C,
1164
- ...E || R ? { cursor: "grabbing" } : {}
1165
+ ...z || R ? { cursor: "grabbing" } : {}
1165
1166
  };
1166
1167
  },
1167
- [n, c, i, r]
1168
- ), nt = a.useCallback(
1168
+ [n, c, a, r]
1169
+ ), rt = i.useCallback(
1169
1170
  (g) => {
1170
1171
  if (!Y(g))
1171
1172
  return { isResizable: !1 };
1172
- const m = i[g.id], b = X(g);
1173
- return (m ?? b) !== null ? { isResizable: !0, onPointerDown: (D, k) => {
1173
+ const b = a[g.id], w = X(g);
1174
+ return (b ?? w) !== null ? { isResizable: !0, onPointerDown: (D, k) => {
1174
1175
  x(g.id, D, k);
1175
1176
  } } : { isResizable: !1 };
1176
1177
  },
1177
- [x, i]
1178
- ), rt = a.useCallback(
1178
+ [x, a]
1179
+ ), ot = i.useCallback(
1179
1180
  (g) => {
1180
- const { isResizable: l, onPointerDown: m } = nt(g), b = et(g), E = r === g.id;
1181
+ const { isResizable: l, onPointerDown: b } = rt(g), w = nt(g), z = r === g.id;
1181
1182
  return {
1182
- style: b,
1183
+ style: w,
1183
1184
  isResizable: l,
1184
- isResizing: E,
1185
+ isResizing: z,
1185
1186
  onResizeHandlePointerDown: (R, C) => {
1186
- m && m(R, C);
1187
+ b && b(R, C);
1187
1188
  }
1188
1189
  };
1189
1190
  },
1190
- [et, nt, r]
1191
- ), ot = a.useCallback(
1191
+ [nt, rt, r]
1192
+ ), st = i.useCallback(
1192
1193
  (g) => ({
1193
1194
  "data-drag-handle": "true",
1194
1195
  role: "button",
@@ -1201,95 +1202,95 @@ const Pe = {
1201
1202
  [M]
1202
1203
  );
1203
1204
  return {
1204
- providerValue: a.useMemo(
1205
+ providerValue: i.useMemo(
1205
1206
  () => ({
1206
1207
  handleLayerPointerDown: P,
1207
- getLayerRenderState: rt,
1208
- getLayerHandleProps: ot
1208
+ getLayerRenderState: ot,
1209
+ getLayerHandleProps: st
1209
1210
  }),
1210
- [ot, rt, P]
1211
+ [st, ot, P]
1211
1212
  ),
1212
1213
  draggingLayerId: n,
1213
1214
  resizingLayerId: r
1214
1215
  };
1215
- }, dn = (t) => {
1216
+ }, fn = (t) => {
1216
1217
  if (typeof t.width == "number" && typeof t.height == "number")
1217
1218
  return { width: t.width, height: t.height };
1218
- }, fn = {
1219
+ }, pn = {
1219
1220
  display: "grid",
1220
1221
  width: "100%",
1221
1222
  height: "100%",
1222
1223
  overflow: "hidden"
1223
- }, pn = {
1224
+ }, gn = {
1224
1225
  touchAction: "none",
1225
1226
  WebkitTouchCallout: "none",
1226
1227
  WebkitUserSelect: "none",
1227
1228
  userSelect: "none"
1228
- }, Cn = ({ config: t, layers: e, style: n }) => {
1229
- const o = a.useRef(null), { isIntersecting: r } = Ut(o, { threshold: 0 });
1230
- return /* @__PURE__ */ w(ce, { config: t, layers: e, style: n, children: /* @__PURE__ */ w(gn, { gridRef: o, isIntersecting: r }) });
1231
- }, gn = ({ gridRef: t, isIntersecting: e }) => {
1232
- const { config: n, style: o, layers: r } = ae(), { normalizedLayers: s, visibleLayers: c, regularLayers: u, layerById: i } = ke(n, r.defs), { columnHandles: f, rowHandles: d, gapSizes: p, gridStyle: h, handleResize: v } = Fe(n, o), { providerValue: S, draggingLayerId: P, resizingLayerId: M } = ln({
1229
+ }, Rn = ({ config: t, layers: e, style: n }) => {
1230
+ const o = i.useRef(null), { isIntersecting: r } = Kt(o, { threshold: 0 });
1231
+ return /* @__PURE__ */ h(ue, { config: t, layers: e, style: n, children: /* @__PURE__ */ h(hn, { gridRef: o, isIntersecting: r }) });
1232
+ }, hn = ({ gridRef: t, isIntersecting: e }) => {
1233
+ const { config: n, style: o, layers: r } = ce(), { normalizedLayers: s, visibleLayers: c, regularLayers: u, layerById: a } = Te(n, r.defs), { columnHandles: f, rowHandles: d, gapSizes: p, gridStyle: m, handleResize: E } = Be(n, o), { providerValue: v, draggingLayerId: P, resizingLayerId: M } = dn({
1233
1234
  layers: s,
1234
- layerById: i
1235
- }), x = P ? !0 : !!M, $ = a.useMemo(() => ({
1236
- ...fn,
1237
- ...h,
1238
- ...x ? pn : {}
1239
- }), [h, x]);
1240
- return /* @__PURE__ */ _(O, { children: [
1241
- /* @__PURE__ */ _(
1235
+ layerById: a
1236
+ }), x = P ? !0 : !!M, _ = i.useMemo(() => ({
1237
+ ...pn,
1238
+ ...m,
1239
+ ...x ? gn : {}
1240
+ }), [m, x]);
1241
+ return /* @__PURE__ */ N($, { children: [
1242
+ /* @__PURE__ */ N(
1242
1243
  "div",
1243
1244
  {
1244
1245
  ref: t,
1245
- style: $,
1246
+ style: _,
1246
1247
  "data-dragging": !!P,
1247
1248
  "data-resizing": !!M,
1248
1249
  "data-visible": e,
1249
1250
  children: [
1250
- /* @__PURE__ */ w(se, { value: S, children: /* @__PURE__ */ w(be, { layers: u }) }),
1251
- f.map(({ trackIndex: L, align: z, span: H }) => /* @__PURE__ */ w(
1252
- pt,
1251
+ /* @__PURE__ */ h(ie, { value: v, children: /* @__PURE__ */ h(ve, { layers: u }) }),
1252
+ f.map(({ trackIndex: S, align: L, span: H }) => /* @__PURE__ */ h(
1253
+ ht,
1253
1254
  {
1254
1255
  direction: "col",
1255
- trackIndex: L,
1256
- align: z,
1256
+ trackIndex: S,
1257
+ align: L,
1257
1258
  gap: p.columnGap,
1258
1259
  span: H,
1259
- onResize: v
1260
+ onResize: E
1260
1261
  },
1261
- `col-${L}:${z}`
1262
+ `col-${S}:${L}`
1262
1263
  )),
1263
- d.map(({ trackIndex: L, align: z, span: H }) => /* @__PURE__ */ w(
1264
- pt,
1264
+ d.map(({ trackIndex: S, align: L, span: H }) => /* @__PURE__ */ h(
1265
+ ht,
1265
1266
  {
1266
1267
  direction: "row",
1267
- trackIndex: L,
1268
- align: z,
1268
+ trackIndex: S,
1269
+ align: L,
1269
1270
  gap: p.rowGap,
1270
1271
  span: H,
1271
- onResize: v
1272
+ onResize: E
1272
1273
  },
1273
- `row-${L}:${z}`
1274
+ `row-${S}:${L}`
1274
1275
  ))
1275
1276
  ]
1276
1277
  }
1277
1278
  ),
1278
- /* @__PURE__ */ w(oe, { layers: c })
1279
+ /* @__PURE__ */ h(se, { layers: c })
1279
1280
  ] });
1280
1281
  };
1281
1282
  export {
1282
- ne as D,
1283
- Cn as G,
1284
- Le as R,
1285
- Sn as a,
1286
- ie as b,
1283
+ re as D,
1284
+ Rn as G,
1285
+ Me as R,
1286
+ Cn as a,
1287
+ ae as b,
1287
1288
  T as c,
1288
- Re as d,
1289
- Be as e,
1290
- Lt as f,
1291
- oe as g,
1292
- zn as t,
1293
- ze as u
1289
+ Pe as d,
1290
+ Ye as e,
1291
+ xt as f,
1292
+ se as g,
1293
+ Sn as t,
1294
+ Se as u
1294
1295
  };
1295
- //# sourceMappingURL=GridLayout-CmzKfbPP.js.map
1296
+ //# sourceMappingURL=GridLayout-C0uqEj9E.js.map