@aiquants/resize-panels 1.6.0 → 1.7.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.
package/dist/index.js CHANGED
@@ -1,91 +1,91 @@
1
- import { createContext as vt, useContext as Mt, useCallback as pe, useMemo as te, useReducer as wt, useState as ye, useRef as ie, useEffect as re, useLayoutEffect as je, memo as Ke, useId as ut, useSyncExternalStore as ft } from "react";
2
- import { jsx as A, jsxs as le } from "react/jsx-runtime";
3
- import { twMerge as ke } from "tailwind-merge";
1
+ import { createContext as vt, useContext as Mt, useCallback as Se, useMemo as ae, useReducer as wt, useState as Me, useRef as J, useEffect as se, useLayoutEffect as Xe, memo as it, useId as zt, useSyncExternalStore as ht } from "react";
2
+ import { jsx as I, jsxs as fe } from "react/jsx-runtime";
3
+ import { twMerge as $e } from "tailwind-merge";
4
4
  import { createPortal as Et } from "react-dom";
5
- const pt = vt(null), Qe = () => {
6
- const t = Mt(pt);
5
+ const gt = vt(null), rt = () => {
6
+ const t = Mt(gt);
7
7
  if (!t)
8
8
  throw new Error("usePanelGroup must be used within a PanelGroup");
9
9
  return t;
10
- }, zt = (t, e = 0) => {
10
+ }, xt = (t, e = 0) => {
11
11
  if (!Number.isFinite(t))
12
12
  return t;
13
- const n = 10 ** e, d = t * n, r = Math.floor(d), l = d - r, i = Number.EPSILON * Math.max(1, Math.abs(d));
14
- return l < 0.5 - i ? r / n : l > 0.5 + i ? (r + 1) / n : (r % 2 === 0 ? r : r + 1) / n;
15
- }, gt = 12, tt = 8, Bt = 8, Rt = 8, ht = 0.05, xt = 10, It = 0.05, Ft = 20, Nt = 0.05, it = 0, St = 6, me = (t, e) => e <= 0 ? 0 : zt(t / e * 100, St), Te = (t, e) => !t || e <= 0 ? 0 : t / 100 * e, Xe = (t, e = "percentage") => {
13
+ const n = 10 ** e, d = t * n, r = Math.floor(d), c = d - r, i = Number.EPSILON * Math.max(1, Math.abs(d));
14
+ return c < 0.5 - i ? r / n : c > 0.5 + i ? (r + 1) / n : (r % 2 === 0 ? r : r + 1) / n;
15
+ }, St = 12, nt = 8, Bt = 8, Rt = 8, mt = 0.05, Pt = 10, It = 0.05, Ft = 20, Nt = 0.05, ot = 0, bt = 6, Ce = (t, e) => e <= 0 ? 0 : xt(t / e * 100, bt), We = (t, e) => !t || e <= 0 ? 0 : t / 100 * e, Qe = (t, e = "percentage") => {
16
16
  if (t !== void 0)
17
17
  return typeof t == "number" ? { value: t, unit: e } : t;
18
- }, rt = (t, e) => t ? t.unit === "percentage" ? t.value / 100 * e : t.value : 0, q = (t, e, n) => t ? typeof t == "number" ? t / 100 * n : t.unit === "pixels" ? t.value : t.value / 100 * n : e, ze = (t, e, n) => Math.min(Math.max(t, e), n), qe = (t) => {
18
+ }, st = (t, e) => t ? t.unit === "percentage" ? t.value / 100 * e : t.value : 0, te = (t, e, n) => t ? typeof t == "number" ? t / 100 * n : t.unit === "pixels" ? t.value : t.value / 100 * n : e, me = (t, e, n) => Math.min(Math.max(t, e), n), et = (t) => {
19
19
  if (!Number.isFinite(t) || t <= 0)
20
- return it;
21
- const e = t * ht, n = Math.min(gt, xt, e);
22
- return Math.max(it, n);
23
- }, mt = (t, e, n, d = {}) => {
20
+ return ot;
21
+ const e = t * mt, n = Math.min(St, Pt, e);
22
+ return Math.max(ot, n);
23
+ }, Ct = (t, e, n, d = {}) => {
24
24
  if (Math.abs(e) <= 0)
25
25
  return e;
26
- const r = d.enforceAutoMinSize ?? !1, l = t.map((s, a) => ({ panel: s, index: a })).filter(({ panel: s }) => !s.collapsed && (s.sizeUnit === "pixels" || s.originalPixelSize !== void 0));
27
- if (l.length === 0)
26
+ const r = d.enforceAutoMinSize ?? !1, c = t.map((s, a) => ({ panel: s, index: a })).filter(({ panel: s }) => !s.collapsed && (s.sizeUnit === "pixels" || s.originalPixelSize !== void 0));
27
+ if (c.length === 0)
28
28
  return e;
29
- const i = e > 0, f = [...l].sort((s, a) => {
30
- const o = s.panel.pixelAdjustPriority ?? s.index + 1, x = a.panel.pixelAdjustPriority ?? a.index + 1;
31
- return o === x ? i ? a.index - s.index : s.index - a.index : i ? x - o : o - x;
29
+ const i = e > 0, p = [...c].sort((s, a) => {
30
+ const o = s.panel.pixelAdjustPriority ?? s.index + 1, h = a.panel.pixelAdjustPriority ?? a.index + 1;
31
+ return o === h ? i ? a.index - s.index : s.index - a.index : i ? h - o : o - h;
32
32
  });
33
33
  let u = e;
34
34
  const z = (s) => {
35
- for (const { index: a } of f) {
35
+ for (const { index: a } of p) {
36
36
  if (Math.abs(u) <= 0)
37
37
  break;
38
38
  const o = t[a];
39
39
  if (!o || o.collapsed)
40
40
  continue;
41
- const x = Xe(o.minSize, "pixels"), C = Xe(o.maxSize, "pixels"), P = x ? rt(x, n) : 0, v = C ? rt(C, n) : n, S = r ? q(o.autoMinSize, 0, n) : 0, y = Math.max(P, S), m = o.preferredPixelSize !== void 0 ? ze(o.preferredPixelSize, y, v) : o.size, D = o.collapseFromStart || o.collapseFromEnd;
41
+ const h = Qe(o.minSize, "pixels"), b = Qe(o.maxSize, "pixels"), m = h ? st(h, n) : 0, v = b ? st(b, n) : n, x = r ? te(o.autoMinSize, 0, n) : 0, C = Math.max(m, x), S = o.preferredPixelSize !== void 0 ? me(o.preferredPixelSize, C, v) : o.size, D = o.collapseFromStart || o.collapseFromEnd;
42
42
  if (u > 0) {
43
43
  if (Math.abs(o.size) <= 0 && (o.percentageSize ?? 0) <= 0)
44
44
  continue;
45
- const J = Math.max(o.size, m), ae = s ? Math.min(v, J) : v, W = Math.max(0, ae - o.size);
46
- if (W <= 0)
45
+ const re = Math.max(o.size, S), de = s ? Math.min(v, re) : v, j = Math.max(0, de - o.size);
46
+ if (j <= 0)
47
47
  continue;
48
- const O = Math.min(W, u);
49
- if (O <= 0)
48
+ const _ = Math.min(j, u);
49
+ if (_ <= 0)
50
50
  continue;
51
- const B = o.size + O, ee = me(B, n), k = D ? B : o.sizeBeforeCollapse, $ = D ? o.measuredPixelSizeBeforeCollapse ?? o.measuredPixelSize ?? B : o.measuredPixelSizeBeforeCollapse;
51
+ const E = o.size + _, oe = Ce(E, n), U = D ? E : o.sizeBeforeCollapse, V = D ? o.measuredPixelSizeBeforeCollapse ?? o.measuredPixelSize ?? E : o.measuredPixelSizeBeforeCollapse;
52
52
  t[a] = {
53
53
  ...o,
54
- size: B,
55
- percentageSize: ee,
56
- sizeBeforeCollapse: k,
57
- measuredPixelSizeBeforeCollapse: $,
54
+ size: E,
55
+ percentageSize: oe,
56
+ sizeBeforeCollapse: U,
57
+ measuredPixelSizeBeforeCollapse: V,
58
58
  measuredPixelSize: void 0,
59
59
  measuredPercentageSize: void 0
60
- }, u -= O;
60
+ }, u -= _;
61
61
  } else {
62
- const X = s ? m : y, J = Math.max(0, o.size - X);
63
- if (J <= 0)
62
+ const X = s ? S : C, re = Math.max(0, o.size - X);
63
+ if (re <= 0)
64
64
  continue;
65
- const ae = Math.min(J, Math.abs(u));
66
- if (ae <= 0)
65
+ const de = Math.min(re, Math.abs(u));
66
+ if (de <= 0)
67
67
  continue;
68
- const W = o.size - ae, O = me(W, n), B = D ? W : o.sizeBeforeCollapse, ee = D ? o.measuredPixelSizeBeforeCollapse ?? o.measuredPixelSize ?? W : o.measuredPixelSizeBeforeCollapse;
68
+ const j = o.size - de, _ = Ce(j, n), E = D ? j : o.sizeBeforeCollapse, oe = D ? o.measuredPixelSizeBeforeCollapse ?? o.measuredPixelSize ?? j : o.measuredPixelSizeBeforeCollapse;
69
69
  t[a] = {
70
70
  ...o,
71
- size: W,
72
- percentageSize: O,
73
- sizeBeforeCollapse: B,
74
- measuredPixelSizeBeforeCollapse: ee,
71
+ size: j,
72
+ percentageSize: _,
73
+ sizeBeforeCollapse: E,
74
+ measuredPixelSizeBeforeCollapse: oe,
75
75
  measuredPixelSize: void 0,
76
76
  measuredPercentageSize: void 0
77
- }, u += ae;
77
+ }, u += de;
78
78
  }
79
79
  }
80
80
  };
81
81
  return z(!0), (i && u > 0 || !i && u < 0) && z(!1), u;
82
- }, Ue = (t) => {
82
+ }, Ve = (t) => {
83
83
  if (!t)
84
84
  return 0;
85
85
  const e = parseFloat(t);
86
86
  return Number.isFinite(e) ? e : 0;
87
- }, Le = (t, e) => {
88
- const n = t.getBoundingClientRect(), d = typeof window < "u" ? window.getComputedStyle(t) : null, r = d ? Ue(d.borderLeftWidth) + Ue(d.borderRightWidth) : 0, l = d ? Ue(d.borderTopWidth) + Ue(d.borderBottomWidth) : 0;
87
+ }, Oe = (t, e) => {
88
+ const n = t.getBoundingClientRect(), d = typeof window < "u" ? window.getComputedStyle(t) : null, r = d ? Ve(d.borderLeftWidth) + Ve(d.borderRightWidth) : 0, c = d ? Ve(d.borderTopWidth) + Ve(d.borderBottomWidth) : 0;
89
89
  if (e === "horizontal") {
90
90
  const z = n.width > 0 ? n.width : t.offsetWidth, s = n.width > 0 ? Math.max(0, n.width - r) : t.clientWidth, a = t.offsetWidth > 0 ? t.offsetWidth : t.clientWidth + r;
91
91
  return {
@@ -93,9 +93,9 @@ const pt = vt(null), Qe = () => {
93
93
  outer: z > 0 ? z : Math.max(0, a)
94
94
  };
95
95
  }
96
- const i = n.height > 0 ? n.height : t.offsetHeight, f = n.height > 0 ? Math.max(0, n.height - l) : t.clientHeight, u = t.offsetHeight > 0 ? t.offsetHeight : t.clientHeight + l;
96
+ const i = n.height > 0 ? n.height : t.offsetHeight, p = n.height > 0 ? Math.max(0, n.height - c) : t.clientHeight, u = t.offsetHeight > 0 ? t.offsetHeight : t.clientHeight + c;
97
97
  return {
98
- inner: f > 0 ? f : Math.max(0, t.clientHeight),
98
+ inner: p > 0 ? p : Math.max(0, t.clientHeight),
99
99
  outer: i > 0 ? i : Math.max(0, u)
100
100
  };
101
101
  }, At = (t, e) => {
@@ -112,8 +112,8 @@ const pt = vt(null), Qe = () => {
112
112
  return console.warn("Failed to load panel layout:", e), null;
113
113
  }
114
114
  };
115
- var Ve = /* @__PURE__ */ ((t) => (t[t.DEBUG = 0] = "DEBUG", t[t.INFO = 1] = "INFO", t[t.WARN = 2] = "WARN", t[t.ERROR = 3] = "ERROR", t[t.NONE = 4] = "NONE", t))(Ve || {});
116
- const we = class we {
115
+ var qe = /* @__PURE__ */ ((t) => (t[t.DEBUG = 0] = "DEBUG", t[t.INFO = 1] = "INFO", t[t.WARN = 2] = "WARN", t[t.ERROR = 3] = "ERROR", t[t.NONE = 4] = "NONE", t))(qe || {});
116
+ const Ee = class Ee {
117
117
  /**
118
118
  * @constructor
119
119
  * @param {LogLevel} [level=LogLevel.WARN] - The minimum log level to output.
@@ -130,7 +130,7 @@ const we = class we {
130
130
  * @param {LogLevel} level - The new log level.
131
131
  */
132
132
  static setLevel(e) {
133
- we.instance.setLevel(e);
133
+ Ee.instance.setLevel(e);
134
134
  }
135
135
  /**
136
136
  * @method setLevel
@@ -148,7 +148,7 @@ const we = class we {
148
148
  * @param {ILogger} impl - The new logger implementation.
149
149
  */
150
150
  static setImplementation(e) {
151
- we.instance.setImplementation(e);
151
+ Ee.instance.setImplementation(e);
152
152
  }
153
153
  /**
154
154
  * @method setImplementation
@@ -166,7 +166,7 @@ const we = class we {
166
166
  * @param {string} prefix - The new prefix.
167
167
  */
168
168
  static setPrefix(e) {
169
- we.instance.setPrefix(e);
169
+ Ee.instance.setPrefix(e);
170
170
  }
171
171
  /**
172
172
  * @method setPrefix
@@ -181,33 +181,33 @@ const we = class we {
181
181
  return typeof e == "string" ? [`${this.prefix} ${e}`] : [this.prefix, e];
182
182
  }
183
183
  static debug(e, ...n) {
184
- we.instance.debug(e, ...n);
184
+ Ee.instance.debug(e, ...n);
185
185
  }
186
186
  debug(e, ...n) {
187
187
  this.level <= 0 && this.impl.debug(...this.formatMessage(e), ...n);
188
188
  }
189
189
  static info(e, ...n) {
190
- we.instance.info(e, ...n);
190
+ Ee.instance.info(e, ...n);
191
191
  }
192
192
  info(e, ...n) {
193
193
  this.level <= 1 && this.impl.info(...this.formatMessage(e), ...n);
194
194
  }
195
195
  static warn(e, ...n) {
196
- we.instance.warn(e, ...n);
196
+ Ee.instance.warn(e, ...n);
197
197
  }
198
198
  warn(e, ...n) {
199
199
  this.level <= 2 && this.impl.warn(...this.formatMessage(e), ...n);
200
200
  }
201
201
  static error(e, ...n) {
202
- we.instance.error(e, ...n);
202
+ Ee.instance.error(e, ...n);
203
203
  }
204
204
  error(e, ...n) {
205
205
  this.level <= 3 && this.impl.error(...this.formatMessage(e), ...n);
206
206
  }
207
207
  };
208
- we.instance = new we(2, "[resize-panels]");
209
- let Ge = we;
210
- const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
208
+ Ee.instance = new Ee(2, "[resize-panels]");
209
+ let je = Ee;
210
+ const ze = new je(qe.INFO, "[resize-panels]"), ve = (t) => t.map((e) => ({
211
211
  id: e.id,
212
212
  size: e.size,
213
213
  percentageSize: e.percentageSize,
@@ -221,7 +221,7 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
221
221
  collapseFromStart: e.collapseFromStart,
222
222
  collapseFromEnd: e.collapseFromEnd,
223
223
  collapsedByDirection: e.collapsedByDirection ?? null
224
- })), We = (t) => t ? Ce([t])[0] : null, Ae = (t) => t ? !!(t.collapseFromStart || t.collapseFromEnd) : !1, Ze = (t, e) => {
224
+ })), Ye = (t) => t ? ve([t])[0] : null, De = (t) => t ? !!(t.collapseFromStart || t.collapseFromEnd) : !1, Ke = (t, e) => {
225
225
  if (!Number.isFinite(e) || e <= 0)
226
226
  return t;
227
227
  const n = t.map((u) => ({ ...u })), d = [];
@@ -235,35 +235,35 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
235
235
  };
236
236
  continue;
237
237
  }
238
- const s = Math.max(0, q(z.minSize, 0, e)), a = Math.max(0, q(z.autoMinSize, 0, e)), o = Math.max(s, a), x = Math.max(1e-3, o), C = q(z.maxSize, e, e), P = Math.max(o, C), v = z.sizeUnit === "pixels" || z.originalPixelSize !== void 0, S = Math.max(0, z.size);
239
- let y = o;
238
+ const s = Math.max(0, te(z.minSize, 0, e)), a = Math.max(0, te(z.autoMinSize, 0, e)), o = Math.max(s, a), h = Math.max(1e-3, o), b = te(z.maxSize, e, e), m = Math.max(o, b), v = z.sizeUnit === "pixels" || z.originalPixelSize !== void 0, x = Math.max(0, z.size);
239
+ let C = o;
240
240
  if (v) {
241
241
  const D = z.preferredPixelSize ?? z.size ?? z.originalPixelSize ?? o;
242
- y = ze(D, o, P);
242
+ C = me(D, o, m);
243
243
  } else {
244
- const D = z.preferredPercentageSize ?? z.percentageSize ?? me(z.size, e), X = Te(D, e);
245
- y = ze(X, o, P);
244
+ const D = z.preferredPercentageSize ?? z.percentageSize ?? Ce(z.size, e), X = We(D, e);
245
+ C = me(X, o, m);
246
246
  }
247
- const m = !v && (z.excludeFromAutoGrowth ?? !1) && S <= x;
247
+ const S = !v && (z.excludeFromAutoGrowth ?? !1) && x <= h;
248
248
  d.push({
249
249
  index: u,
250
250
  isPixelPanel: v,
251
251
  minSize: o,
252
- maxSize: P,
253
- preferredSize: y,
252
+ maxSize: m,
253
+ preferredSize: C,
254
254
  priority: z.pixelAdjustPriority ?? u + 1,
255
255
  flexPriority: v ? void 0 : z.flexAdjustPriority,
256
- excludeFromGrowth: m
256
+ excludeFromGrowth: S
257
257
  });
258
258
  }
259
259
  if (d.length === 0)
260
260
  return n;
261
261
  const r = /* @__PURE__ */ new Map();
262
- let l = 0;
262
+ let c = 0;
263
263
  for (const u of d)
264
- r.set(u.index, u.minSize), l += u.minSize;
265
- let i = e - l;
266
- const f = (u, z) => {
264
+ r.set(u.index, u.minSize), c += u.minSize;
265
+ let i = e - c;
266
+ const p = (u, z) => {
267
267
  if (z <= 0)
268
268
  return 0;
269
269
  const s = r.get(u.index) ?? u.minSize, a = Math.max(0, u.maxSize - s);
@@ -276,29 +276,29 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
276
276
  const u = (s) => {
277
277
  for (; i > 1e-6; ) {
278
278
  let o = 0;
279
- const x = [];
279
+ const h = [];
280
280
  for (const v of s) {
281
281
  if (!v.isPixelPanel && v.excludeFromGrowth)
282
282
  continue;
283
- const S = r.get(v.index) ?? v.minSize, y = Math.min(v.preferredSize, v.maxSize), m = Math.max(0, y - S);
284
- m > 1e-6 && (o += m, x.push({ descriptor: v, capacity: m }));
283
+ const x = r.get(v.index) ?? v.minSize, C = Math.min(v.preferredSize, v.maxSize), S = Math.max(0, C - x);
284
+ S > 1e-6 && (o += S, h.push({ descriptor: v, capacity: S }));
285
285
  }
286
- if (x.length === 0 || o <= 1e-6)
286
+ if (h.length === 0 || o <= 1e-6)
287
287
  break;
288
- let C = 0;
289
- const P = i;
290
- for (const v of x) {
288
+ let b = 0;
289
+ const m = i;
290
+ for (const v of h) {
291
291
  if (i <= 1e-6)
292
292
  break;
293
293
  if (!v.descriptor.isPixelPanel && v.descriptor.excludeFromGrowth)
294
294
  continue;
295
- const S = P * v.capacity / o, y = Math.min(v.capacity, S);
296
- if (y <= 0)
295
+ const x = m * v.capacity / o, C = Math.min(v.capacity, x);
296
+ if (C <= 0)
297
297
  continue;
298
- const m = f(v.descriptor, y);
299
- m > 0 && (i -= m, C += m);
298
+ const S = p(v.descriptor, C);
299
+ S > 0 && (i -= S, b += S);
300
300
  }
301
- if (C <= 1e-6)
301
+ if (b <= 1e-6)
302
302
  break;
303
303
  }
304
304
  }, z = d.filter((s) => s.isPixelPanel);
@@ -306,32 +306,32 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
306
306
  for (const s of z) {
307
307
  if (i <= 0)
308
308
  break;
309
- const a = r.get(s.index) ?? s.minSize, o = Math.min(s.preferredSize, s.maxSize), x = Math.max(0, o - a);
310
- if (x <= 0)
309
+ const a = r.get(s.index) ?? s.minSize, o = Math.min(s.preferredSize, s.maxSize), h = Math.max(0, o - a);
310
+ if (h <= 0)
311
311
  continue;
312
- const C = f(s, Math.min(x, i));
313
- C > 0 && (i -= C);
312
+ const b = p(s, Math.min(h, i));
313
+ b > 0 && (i -= b);
314
314
  }
315
315
  if (i > 0) {
316
316
  const s = d.filter((a) => !a.isPixelPanel);
317
317
  if (s.length > 0) {
318
318
  const a = s.filter((o) => o.flexPriority !== void 0 && !o.excludeFromGrowth);
319
319
  if (a.length > 0) {
320
- a.sort((o, x) => (x.flexPriority ?? 0) - (o.flexPriority ?? 0));
320
+ a.sort((o, h) => (h.flexPriority ?? 0) - (o.flexPriority ?? 0));
321
321
  for (const o of a) {
322
322
  if (i <= 0)
323
323
  break;
324
324
  if (o.excludeFromGrowth)
325
325
  continue;
326
- const x = r.get(o.index) ?? o.minSize, C = Math.min(o.preferredSize, o.maxSize), P = Math.max(0, C - x);
327
- if (P <= 0)
326
+ const h = r.get(o.index) ?? o.minSize, b = Math.min(o.preferredSize, o.maxSize), m = Math.max(0, b - h);
327
+ if (m <= 0)
328
328
  continue;
329
- const v = f(o, Math.min(P, i));
329
+ const v = p(o, Math.min(m, i));
330
330
  v > 0 && (i -= v);
331
331
  }
332
332
  }
333
333
  if (i > 0) {
334
- const o = a.length > 0 ? s.filter((x) => x.flexPriority === void 0 && !x.excludeFromGrowth) : s.filter((x) => !x.excludeFromGrowth);
334
+ const o = a.length > 0 ? s.filter((h) => h.flexPriority === void 0 && !h.excludeFromGrowth) : s.filter((h) => !h.excludeFromGrowth);
335
335
  o.length > 0 && u(o);
336
336
  }
337
337
  }
@@ -345,8 +345,8 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
345
345
  for (const o of d) {
346
346
  if (!o.isPixelPanel && o.excludeFromGrowth)
347
347
  continue;
348
- const x = r.get(o.index) ?? o.minSize, C = o.isPixelPanel ? Math.min(o.maxSize, o.preferredSize) : o.maxSize, P = Math.max(0, C - x);
349
- P > 0 && (s.push(o), z += P);
348
+ const h = r.get(o.index) ?? o.minSize, b = o.isPixelPanel ? Math.min(o.maxSize, o.preferredSize) : o.maxSize, m = Math.max(0, b - h);
349
+ m > 0 && (s.push(o), z += m);
350
350
  }
351
351
  if (z <= 0)
352
352
  break;
@@ -356,11 +356,11 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
356
356
  break;
357
357
  if (!o.isPixelPanel && o.excludeFromGrowth)
358
358
  continue;
359
- const x = r.get(o.index) ?? o.minSize, C = o.isPixelPanel ? Math.min(o.maxSize, o.preferredSize) : o.maxSize, P = Math.max(0, C - x);
360
- if (P <= 0)
359
+ const h = r.get(o.index) ?? o.minSize, b = o.isPixelPanel ? Math.min(o.maxSize, o.preferredSize) : o.maxSize, m = Math.max(0, b - h);
360
+ if (m <= 0)
361
361
  continue;
362
- const v = a * P / z, S = f(o, Math.min(P, v));
363
- S > 0 && (i -= S);
362
+ const v = a * m / z, x = p(o, Math.min(m, v));
363
+ x > 0 && (i -= x);
364
364
  }
365
365
  if (i <= 1e-6 || Math.abs(u - i) <= 1e-6)
366
366
  break;
@@ -376,15 +376,15 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
376
376
  for (const a of z) {
377
377
  if (i >= 0)
378
378
  break;
379
- const o = r.get(a.index) ?? a.minSize, x = ze(a.preferredSize, a.minSize, a.maxSize), C = Math.max(0, o - x);
380
- if (C > 0 && i < 0) {
381
- const v = Math.min(C, Math.abs(i));
379
+ const o = r.get(a.index) ?? a.minSize, h = me(a.preferredSize, a.minSize, a.maxSize), b = Math.max(0, o - h);
380
+ if (b > 0 && i < 0) {
381
+ const v = Math.min(b, Math.abs(i));
382
382
  r.set(a.index, o - v), i += v, s = !0;
383
383
  continue;
384
384
  }
385
- const P = Math.max(0, o - a.minSize);
386
- if (P > 0 && i < 0) {
387
- const v = Math.min(P, Math.abs(i));
385
+ const m = Math.max(0, o - a.minSize);
386
+ if (m > 0 && i < 0) {
387
+ const v = Math.min(m, Math.abs(i));
388
388
  r.set(a.index, o - v), i += v, s = !0;
389
389
  }
390
390
  }
@@ -394,27 +394,27 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
394
394
  }
395
395
  }
396
396
  for (const u of d) {
397
- const z = r.get(u.index) ?? u.minSize, s = n[u.index], a = Ae(s), o = a ? z : s.sizeBeforeCollapse, x = a ? s.measuredPixelSizeBeforeCollapse ?? s.measuredPixelSize ?? z : s.measuredPixelSizeBeforeCollapse, C = e > 0 ? me(z, e) : 0;
397
+ const z = r.get(u.index) ?? u.minSize, s = n[u.index], a = De(s), o = a ? z : s.sizeBeforeCollapse, h = a ? s.measuredPixelSizeBeforeCollapse ?? s.measuredPixelSize ?? z : s.measuredPixelSizeBeforeCollapse, b = e > 0 ? Ce(z, e) : 0;
398
398
  n[u.index] = {
399
399
  ...s,
400
400
  size: z,
401
- percentageSize: C,
401
+ percentageSize: b,
402
402
  preferredPercentageSize: s.preferredPercentageSize,
403
403
  preferredPixelSize: u.isPixelPanel ? s.preferredPixelSize ?? z : s.preferredPixelSize,
404
404
  sizeBeforeCollapse: o,
405
- measuredPixelSizeBeforeCollapse: x,
405
+ measuredPixelSizeBeforeCollapse: h,
406
406
  measuredPixelSize: void 0,
407
407
  measuredPercentageSize: void 0
408
408
  };
409
409
  }
410
- return Ne(n);
411
- }, Ne = (t) => {
410
+ return Le(n);
411
+ }, Le = (t) => {
412
412
  let e = 0;
413
413
  for (const r of t)
414
414
  r.collapsed || (e += Math.max(r.size, 0));
415
415
  if (e <= 0) {
416
416
  let r = !1;
417
- const l = t.map((i) => (i.percentageSize ?? 0) !== 0 ? (r = !0, {
417
+ const c = t.map((i) => (i.percentageSize ?? 0) !== 0 ? (r = !0, {
418
418
  ...i,
419
419
  percentageSize: 0,
420
420
  measuredPercentageSize: i.measuredPercentageSize !== void 0 ? 0 : i.measuredPercentageSize
@@ -422,7 +422,7 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
422
422
  ...i,
423
423
  sizeBeforeCollapse: i.size
424
424
  }) : i);
425
- return r ? l : t;
425
+ return r ? c : t;
426
426
  }
427
427
  let n = !1;
428
428
  const d = t.map((r) => {
@@ -432,21 +432,21 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
432
432
  percentageSize: 0,
433
433
  measuredPercentageSize: r.measuredPercentageSize !== void 0 ? 0 : r.measuredPercentageSize
434
434
  }) : r;
435
- const l = me(r.size, e), i = r.measuredPercentageSize, z = (i !== void 0 ? Math.abs(i - l) : 1 / 0) < 1e-4 && i !== void 0 ? i : l, s = zt(z, St), o = Math.abs((r.percentageSize ?? 0) - s) > 0 || r.percentageSize === void 0, x = r.sizeBeforeCollapse === void 0 || r.sizeBeforeCollapse !== r.size, C = Ae(r), P = C && x, v = r.measuredPixelSize ?? r.size, S = C && (r.measuredPixelSizeBeforeCollapse === void 0 || r.measuredPixelSizeBeforeCollapse !== v);
436
- if (!(o || P || S))
435
+ const c = Ce(r.size, e), i = r.measuredPercentageSize, z = (i !== void 0 ? Math.abs(i - c) : 1 / 0) < 1e-4 && i !== void 0 ? i : c, s = xt(z, bt), o = Math.abs((r.percentageSize ?? 0) - s) > 0 || r.percentageSize === void 0, h = r.sizeBeforeCollapse === void 0 || r.sizeBeforeCollapse !== r.size, b = De(r), m = b && h, v = r.measuredPixelSize ?? r.size, x = b && (r.measuredPixelSizeBeforeCollapse === void 0 || r.measuredPixelSizeBeforeCollapse !== v);
436
+ if (!(o || m || x))
437
437
  return r;
438
438
  n = !0;
439
- const y = P ? r.size : r.sizeBeforeCollapse, m = S ? v : r.measuredPixelSizeBeforeCollapse;
439
+ const C = m ? r.size : r.sizeBeforeCollapse, S = x ? v : r.measuredPixelSizeBeforeCollapse;
440
440
  return {
441
441
  ...r,
442
442
  percentageSize: s,
443
- sizeBeforeCollapse: y,
444
- measuredPixelSizeBeforeCollapse: m,
443
+ sizeBeforeCollapse: C,
444
+ measuredPixelSizeBeforeCollapse: S,
445
445
  collapsedByDirection: r.collapsed ? r.collapsedByDirection ?? null : null
446
446
  };
447
447
  });
448
448
  return n ? d : t;
449
- }, $e = (t, e) => {
449
+ }, Ze = (t, e) => {
450
450
  if (e <= 0)
451
451
  return !1;
452
452
  const n = [];
@@ -460,34 +460,34 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
460
460
  let r = e - d;
461
461
  if (Math.abs(r) <= 0)
462
462
  return !1;
463
- let l = !1;
463
+ let c = !1;
464
464
  const i = (s) => {
465
- const a = t[s], o = q(a.minSize, 0, e), x = q(a.autoMinSize, 0, e), C = Math.max(o, x), P = q(a.maxSize, e, e), v = a.sizeUnit === "percentage" && a.originalPixelSize === void 0;
465
+ const a = t[s], o = te(a.minSize, 0, e), h = te(a.autoMinSize, 0, e), b = Math.max(o, h), m = te(a.maxSize, e, e), v = a.sizeUnit === "percentage" && a.originalPixelSize === void 0;
466
466
  return {
467
467
  index: s,
468
- minSize: C,
469
- maxSize: P,
468
+ minSize: b,
469
+ maxSize: m,
470
470
  isFlexible: v
471
471
  };
472
- }, f = (s, a) => {
472
+ }, p = (s, a) => {
473
473
  if (!Number.isFinite(a) || Math.abs(a) <= 0)
474
474
  return;
475
475
  const o = t[s];
476
476
  if (!o)
477
477
  return;
478
- const x = Math.max(0, o.size + a);
479
- if (Math.abs(x - o.size) <= 0)
478
+ const h = Math.max(0, o.size + a);
479
+ if (Math.abs(h - o.size) <= 0)
480
480
  return;
481
- const C = me(x, e), P = Ae(o), v = P ? x : o.sizeBeforeCollapse, S = P ? o.measuredPixelSizeBeforeCollapse ?? o.measuredPixelSize ?? x : o.measuredPixelSizeBeforeCollapse;
481
+ const b = Ce(h, e), m = De(o), v = m ? h : o.sizeBeforeCollapse, x = m ? o.measuredPixelSizeBeforeCollapse ?? o.measuredPixelSize ?? h : o.measuredPixelSizeBeforeCollapse;
482
482
  t[s] = {
483
483
  ...o,
484
- size: x,
485
- percentageSize: C,
484
+ size: h,
485
+ percentageSize: b,
486
486
  sizeBeforeCollapse: v,
487
- measuredPixelSizeBeforeCollapse: S,
487
+ measuredPixelSizeBeforeCollapse: x,
488
488
  measuredPixelSize: void 0,
489
489
  measuredPercentageSize: void 0
490
- }, r -= a, l = !0;
490
+ }, r -= a, c = !0;
491
491
  }, u = (s) => {
492
492
  for (const a of s) {
493
493
  if (Math.abs(r) <= 0)
@@ -495,46 +495,46 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
495
495
  const o = t[a.index];
496
496
  if (!o || o.collapsed)
497
497
  continue;
498
- const x = o.size;
498
+ const h = o.size;
499
499
  if (r > 0) {
500
- const C = Math.max(0, a.maxSize - x);
501
- if (C <= 0)
500
+ const b = Math.max(0, a.maxSize - h);
501
+ if (b <= 0)
502
502
  continue;
503
- const P = Math.min(C, r);
504
- if (P <= 0)
503
+ const m = Math.min(b, r);
504
+ if (m <= 0)
505
505
  continue;
506
- f(a.index, P);
506
+ p(a.index, m);
507
507
  } else {
508
- const C = Math.max(0, x - a.minSize);
509
- if (C <= 0)
508
+ const b = Math.max(0, h - a.minSize);
509
+ if (b <= 0)
510
510
  continue;
511
- const P = Math.min(C, Math.abs(r));
512
- if (P <= 0)
511
+ const m = Math.min(b, Math.abs(r));
512
+ if (m <= 0)
513
513
  continue;
514
- f(a.index, -P);
514
+ p(a.index, -m);
515
515
  }
516
516
  }
517
517
  }, z = n.map((s) => i(s)).filter((s) => s.isFlexible);
518
518
  if (z.length > 0 && u(z), Math.abs(r) > 0) {
519
519
  const s = r;
520
- r = mt(t, r, e, { enforceAutoMinSize: !0 }), Math.abs(r - s) > 0 && (l = !0);
520
+ r = Ct(t, r, e, { enforceAutoMinSize: !0 }), Math.abs(r - s) > 0 && (c = !0);
521
521
  }
522
- return l;
523
- }, nt = (t, e, n) => {
522
+ return c;
523
+ }, at = (t, e, n) => {
524
524
  if (!(t.sizeUnit === "pixels" || t.originalPixelSize !== void 0) || t.pixelAdjustPriority !== void 0)
525
525
  return t;
526
- const r = e.filter((i, f) => f !== n && (i.sizeUnit === "pixels" || i.originalPixelSize !== void 0)).map((i) => i.pixelAdjustPriority).filter((i) => i !== void 0), l = r.length > 0 ? Math.max(...r) + 1 : 1;
526
+ const r = e.filter((i, p) => p !== n && (i.sizeUnit === "pixels" || i.originalPixelSize !== void 0)).map((i) => i.pixelAdjustPriority).filter((i) => i !== void 0), c = r.length > 0 ? Math.max(...r) + 1 : 1;
527
527
  return {
528
528
  ...t,
529
- pixelAdjustPriority: l
529
+ pixelAdjustPriority: c
530
530
  };
531
531
  }, Dt = (t, e) => {
532
532
  switch (e.type) {
533
533
  case "REGISTER_PANEL": {
534
- ue.debug("REGISTER_PANEL", e.panel);
535
- const n = t.findIndex((l) => l.id === e.panel.id);
534
+ ze.debug("REGISTER_PANEL", e.panel);
535
+ const n = t.findIndex((c) => c.id === e.panel.id);
536
536
  if (n >= 0) {
537
- const l = [...t], i = t[n], f = {
537
+ const c = [...t], i = t[n], p = {
538
538
  ...i,
539
539
  minSize: e.panel.minSize,
540
540
  maxSize: e.panel.maxSize,
@@ -549,97 +549,97 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
549
549
  pixelAdjustPriority: e.panel.pixelAdjustPriority !== void 0 ? e.panel.pixelAdjustPriority : i.pixelAdjustPriority,
550
550
  autoMinSize: e.panel.autoMinSize !== void 0 ? e.panel.autoMinSize : i.autoMinSize,
551
551
  excludeFromAutoGrowth: e.panel.excludeFromAutoGrowth !== void 0 ? e.panel.excludeFromAutoGrowth : i.excludeFromAutoGrowth
552
- }, u = nt(f, t, n);
553
- return ue.debug("register panel (update)", {
552
+ }, u = at(p, t, n);
553
+ return ze.debug("register panel (update)", {
554
554
  panelId: u.id,
555
- incoming: We(e.panel),
556
- previous: We(i),
557
- next: We(u)
558
- }), l[n] = u, l;
555
+ incoming: Ye(e.panel),
556
+ previous: Ye(i),
557
+ next: Ye(u)
558
+ }), c[n] = u, c;
559
559
  }
560
- const d = { ...e.panel }, r = nt(d, t);
561
- return ue.debug("register panel (insert)", {
560
+ const d = { ...e.panel }, r = at(d, t);
561
+ return ze.debug("register panel (insert)", {
562
562
  panelId: r.id,
563
- incoming: We(r),
563
+ incoming: Ye(r),
564
564
  previousLength: t.length
565
565
  }), [...t, r];
566
566
  }
567
567
  case "UNREGISTER_PANEL": {
568
- ue.debug("UNREGISTER_PANEL", e.id);
569
- const n = t.filter((r) => r.id !== e.id), d = Ne(n);
570
- return ue.debug("unregister panel", {
568
+ ze.debug("UNREGISTER_PANEL", e.id);
569
+ const n = t.filter((r) => r.id !== e.id), d = Le(n);
570
+ return ze.debug("unregister panel", {
571
571
  panelId: e.id,
572
- previous: Ce(t),
573
- filtered: Ce(n),
574
- next: Ce(d)
572
+ previous: ve(t),
573
+ filtered: ve(n),
574
+ next: ve(d)
575
575
  }), d;
576
576
  }
577
577
  case "RESIZE_PANELS": {
578
- ue.debug("RESIZE_PANELS", e.leftId, e.rightId, e.leftSize, e.rightSize);
579
- const n = t.findIndex((g) => g.id === e.leftId), d = t.findIndex((g) => g.id === e.rightId);
578
+ ze.debug("RESIZE_PANELS", e.leftId, e.rightId, e.leftSize, e.rightSize);
579
+ const n = t.findIndex((G) => G.id === e.leftId), d = t.findIndex((G) => G.id === e.rightId);
580
580
  if (n === -1 || d === -1) return t;
581
- const r = [...t], l = r[n], i = r[d];
582
- if (l.collapsed || i.collapsed || e.leftSize === l.size && e.rightSize === i.size)
581
+ const r = [...t], c = r[n], i = r[d];
582
+ if (c.collapsed || i.collapsed || e.leftSize === c.size && e.rightSize === i.size)
583
583
  return t;
584
- const f = e.containerSize ?? t.reduce((g, M) => g + M.size, 0), u = q(l.minSize, 0, f), z = q(l.maxSize, f, f), s = q(i.minSize, 0, f), a = q(i.maxSize, f, f), o = l.size + i.size, x = t.reduce((g, M) => M.collapsed ? g : g + M.size, 0), C = x - o, P = u + s, v = z + a, S = ze(e.leftSize + e.rightSize, P, v);
585
- let y = f > 0 ? f - C : S;
586
- Number.isFinite(y) || (y = S);
587
- const m = ze(Math.max(S, y), P, v), D = (g) => ({
588
- min: Math.max(u, g - a),
589
- max: Math.min(z, g - s)
590
- }), X = (g) => ({
591
- min: Math.max(s, g - z),
592
- max: Math.min(a, g - u)
593
- }), J = Math.abs(e.leftSize - l.size), ae = Math.abs(e.rightSize - i.size), W = J >= ae;
594
- let O = l.size, B = i.size;
595
- if (W) {
596
- const g = D(m);
597
- if (g.min > g.max)
584
+ const p = e.containerSize ?? t.reduce((G, le) => G + le.size, 0), u = te(c.minSize, 0, p), z = te(c.maxSize, p, p), s = te(i.minSize, 0, p), a = te(i.maxSize, p, p), o = c.size + i.size, h = t.reduce((G, le) => le.collapsed ? G : G + le.size, 0), b = h - o, m = u + s, v = z + a, x = me(e.leftSize + e.rightSize, m, v);
585
+ let C = p > 0 ? p - b : x;
586
+ Number.isFinite(C) || (C = x);
587
+ const S = me(Math.max(x, C), m, v), D = (G) => ({
588
+ min: Math.max(u, G - a),
589
+ max: Math.min(z, G - s)
590
+ }), X = (G) => ({
591
+ min: Math.max(s, G - z),
592
+ max: Math.min(a, G - u)
593
+ }), re = Math.abs(e.leftSize - c.size), de = Math.abs(e.rightSize - i.size), j = re >= de;
594
+ let _ = c.size, E = i.size;
595
+ if (j) {
596
+ const G = D(S);
597
+ if (G.min > G.max)
598
598
  return t;
599
- const M = ze(e.leftSize, g.min, g.max), p = m - M;
600
- if (p < s || p > a)
599
+ const le = me(e.leftSize, G.min, G.max), P = S - le;
600
+ if (P < s || P > a)
601
601
  return t;
602
- O = M, B = p;
602
+ _ = le, E = P;
603
603
  } else {
604
- const g = X(m);
605
- if (g.min > g.max)
604
+ const G = X(S);
605
+ if (G.min > G.max)
606
606
  return t;
607
- const M = ze(e.rightSize, g.min, g.max), p = m - M;
608
- if (p < u || p > z)
607
+ const le = me(e.rightSize, G.min, G.max), P = S - le;
608
+ if (P < u || P > z)
609
609
  return t;
610
- B = M, O = p;
610
+ E = le, _ = P;
611
611
  }
612
- const ee = O + B;
613
- if (m !== ee)
612
+ const oe = _ + E;
613
+ if (S !== oe)
614
614
  return t;
615
- const k = x - l.size - i.size + ee, $ = f > 0 ? f : k, G = $ > 0 ? me(O, $) : 0, j = $ > 0 ? me(B, $) : 0, b = l.sizeUnit === "pixels" || l.originalPixelSize !== void 0 ? O : l.preferredPixelSize, H = i.sizeUnit === "pixels" || i.originalPixelSize !== void 0 ? B : i.preferredPixelSize, he = q(l.autoMinSize, 0, f), ce = q(i.autoMinSize, 0, f), ge = Math.max(1e-3, he), Pe = Math.max(1e-3, ce), ne = l.sizeUnit === "percentage" && l.originalPixelSize === void 0, de = i.sizeUnit === "percentage" && i.originalPixelSize === void 0;
616
- let fe = l.excludeFromAutoGrowth, xe = i.excludeFromAutoGrowth;
617
- ne && (O <= ge ? fe = !0 : O > ge && (fe = !1)), de && (B <= Pe ? xe = !0 : B > Pe && (xe = !1));
618
- const ve = Ae(l), h = Ae(i);
615
+ const U = h - c.size - i.size + oe, V = p > 0 ? p : U, O = V > 0 ? Ce(_, V) : 0, Y = V > 0 ? Ce(E, V) : 0, y = c.sizeUnit === "pixels" || c.originalPixelSize !== void 0 ? _ : c.preferredPixelSize, N = i.sizeUnit === "pixels" || i.originalPixelSize !== void 0 ? E : i.preferredPixelSize, be = te(c.autoMinSize, 0, p), ce = te(i.autoMinSize, 0, p), Pe = Math.max(1e-3, be), he = Math.max(1e-3, ce), ue = c.sizeUnit === "percentage" && c.originalPixelSize === void 0, pe = i.sizeUnit === "percentage" && i.originalPixelSize === void 0;
616
+ let ge = c.excludeFromAutoGrowth, ye = i.excludeFromAutoGrowth;
617
+ ue && (_ <= Pe ? ge = !0 : _ > Pe && (ge = !1)), pe && (E <= he ? ye = !0 : E > he && (ye = !1));
618
+ const Be = De(c), Re = De(i);
619
619
  return r[n] = {
620
- ...l,
621
- size: O,
622
- percentageSize: G,
623
- preferredPercentageSize: G > 0 ? G : l.preferredPercentageSize,
624
- preferredPixelSize: b,
625
- sizeBeforeCollapse: ve ? O : l.sizeBeforeCollapse,
620
+ ...c,
621
+ size: _,
622
+ percentageSize: O,
623
+ preferredPercentageSize: O > 0 ? O : c.preferredPercentageSize,
624
+ preferredPixelSize: y,
625
+ sizeBeforeCollapse: Be ? _ : c.sizeBeforeCollapse,
626
626
  measuredPixelSize: void 0,
627
627
  measuredPercentageSize: void 0,
628
- excludeFromAutoGrowth: fe
628
+ excludeFromAutoGrowth: ge
629
629
  }, r[d] = {
630
630
  ...i,
631
- size: B,
632
- percentageSize: j,
633
- preferredPercentageSize: j > 0 ? j : i.preferredPercentageSize,
634
- preferredPixelSize: H,
635
- sizeBeforeCollapse: h ? B : i.sizeBeforeCollapse,
631
+ size: E,
632
+ percentageSize: Y,
633
+ preferredPercentageSize: Y > 0 ? Y : i.preferredPercentageSize,
634
+ preferredPixelSize: N,
635
+ sizeBeforeCollapse: Re ? E : i.sizeBeforeCollapse,
636
636
  measuredPixelSize: void 0,
637
637
  measuredPercentageSize: void 0,
638
- excludeFromAutoGrowth: xe
639
- }, f > 0 && $e(r, f) ? Ne(r) : r;
638
+ excludeFromAutoGrowth: ye
639
+ }, p > 0 && Ze(r, p) ? Le(r) : r;
640
640
  }
641
641
  case "SET_PANELS": {
642
- ue.debug("SET_PANELS", e.panels);
642
+ ze.debug("SET_PANELS", e.panels);
643
643
  const n = e.panels.map((u) => {
644
644
  const z = u.sizeUnit === "pixels" || u.originalPixelSize !== void 0, s = u.preferredPercentageSize !== void 0 ? u.preferredPercentageSize : u.percentageSize, a = u.preferredPixelSize !== void 0 ? u.preferredPixelSize : z ? u.size : u.preferredPixelSize;
645
645
  return {
@@ -647,69 +647,69 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
647
647
  preferredPercentageSize: s,
648
648
  preferredPixelSize: a
649
649
  };
650
- }), d = Ce(t), r = Ce(n), l = Ne(n), i = Ce(l);
651
- let f = d.length === i.length;
652
- if (f)
650
+ }), d = ve(t), r = ve(n), c = Le(n), i = ve(c);
651
+ let p = d.length === i.length;
652
+ if (p)
653
653
  for (let u = 0; u < i.length; u += 1) {
654
654
  const z = i[u], s = d[u];
655
655
  if (!s) {
656
- f = !1;
656
+ p = !1;
657
657
  break;
658
658
  }
659
659
  if (!(s.id === z.id && s.size === z.size && s.percentageSize === z.percentageSize && s.sizeBeforeCollapse === z.sizeBeforeCollapse && s.measuredPercentageSize === z.measuredPercentageSize && s.collapsed === z.collapsed)) {
660
- f = !1;
660
+ p = !1;
661
661
  break;
662
662
  }
663
663
  }
664
- return f ? (ue.debug("set panels skipped (no diff)", {
664
+ return p ? (ze.debug("set panels skipped (no diff)", {
665
665
  previous: d,
666
666
  incoming: r,
667
667
  next: i,
668
668
  previousLength: d.length,
669
669
  incomingLength: r.length
670
- }), t) : (ue.debug("set panels", {
670
+ }), t) : (ze.debug("set panels", {
671
671
  previous: d,
672
672
  incoming: r,
673
673
  next: i,
674
674
  previousLength: d.length,
675
675
  incomingLength: r.length
676
- }), l);
676
+ }), c);
677
677
  }
678
678
  case "CONTAINER_RESIZED": {
679
- if (ue.debug("CONTAINER_RESIZED", e.containerSize), e.containerSize <= 0)
680
- return ue.debug("container resized skipped (non-positive size)", {
679
+ if (ze.debug("CONTAINER_RESIZED", e.containerSize), e.containerSize <= 0)
680
+ return ze.debug("container resized skipped (non-positive size)", {
681
681
  containerSize: e.containerSize,
682
- panels: Ce(t)
682
+ panels: ve(t)
683
683
  }), t;
684
- ue.debug("container resized (before)", {
684
+ ze.debug("container resized (before)", {
685
685
  containerSize: e.containerSize,
686
- panels: Ce(t)
686
+ panels: ve(t)
687
687
  });
688
- const n = Ze(t, e.containerSize);
689
- if (ue.debug("container resized (after recalc)", {
688
+ const n = Ke(t, e.containerSize);
689
+ if (ze.debug("container resized (after recalc)", {
690
690
  containerSize: e.containerSize,
691
- panels: Ce(n)
692
- }), e.containerSize > 0 && $e(n, e.containerSize)) {
693
- const d = Ne(n);
694
- return ue.debug("container resized (after reconcile)", {
691
+ panels: ve(n)
692
+ }), e.containerSize > 0 && Ze(n, e.containerSize)) {
693
+ const d = Le(n);
694
+ return ze.debug("container resized (after reconcile)", {
695
695
  containerSize: e.containerSize,
696
- panels: Ce(d)
696
+ panels: ve(d)
697
697
  }), d;
698
698
  }
699
- return ue.debug("container resized (final)", {
699
+ return ze.debug("container resized (final)", {
700
700
  containerSize: e.containerSize,
701
- panels: Ce(n)
701
+ panels: ve(n)
702
702
  }), n;
703
703
  }
704
704
  case "COLLAPSE_PANEL": {
705
- ue.debug("COLLAPSE_PANEL", e.id);
705
+ ze.debug("COLLAPSE_PANEL", e.id);
706
706
  const n = t.findIndex((o) => o.id === e.id);
707
707
  if (n === -1)
708
708
  return t;
709
709
  const d = t[n], r = e.from === "start" ? d.collapseFromStart : d.collapseFromEnd;
710
- if (!(Ae(d) && r) || d.collapsed)
710
+ if (!(De(d) && r) || d.collapsed)
711
711
  return t;
712
- const i = d.size, f = d.measuredPixelSize ?? i, u = d.percentageSize ?? d.preferredPercentageSize ?? 0, z = {
712
+ const i = d.size, p = d.measuredPixelSize ?? i, u = d.percentageSize ?? d.preferredPercentageSize ?? 0, z = {
713
713
  ...d,
714
714
  collapsed: !0,
715
715
  collapsedByDirection: e.from,
@@ -717,7 +717,7 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
717
717
  percentageSizeBeforeCollapse: u,
718
718
  preferredPercentageSizeBeforeCollapse: d.preferredPercentageSize ?? u,
719
719
  preferredPixelSizeBeforeCollapse: d.preferredPixelSize ?? i,
720
- measuredPixelSizeBeforeCollapse: f,
720
+ measuredPixelSizeBeforeCollapse: p,
721
721
  size: 0,
722
722
  percentageSize: 0,
723
723
  preferredPercentageSize: d.preferredPercentageSize,
@@ -725,392 +725,407 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
725
725
  measuredPercentageSize: d.measuredPercentageSize !== void 0 ? 0 : d.measuredPercentageSize
726
726
  }, s = [...t];
727
727
  s[n] = z;
728
- const a = Ze(s, e.containerSize);
729
- return e.containerSize > 0 && $e(a, e.containerSize) ? Ne(a) : a;
728
+ const a = Ke(s, e.containerSize);
729
+ return e.containerSize > 0 && Ze(a, e.containerSize) ? Le(a) : a;
730
730
  }
731
731
  case "EXPAND_PANEL": {
732
- ue.debug("EXPAND_PANEL", e.id, e.targetSize);
733
- const n = t.findIndex((m) => m.id === e.id);
732
+ ze.debug("EXPAND_PANEL", e.id, e.targetSize);
733
+ const n = t.findIndex((S) => S.id === e.id);
734
734
  if (n === -1)
735
735
  return t;
736
- const d = e.containerSize, r = t[n], l = e.from === "start" ? r.collapseFromStart : r.collapseFromEnd;
737
- if (!(Ae(r) && l && r.collapsed) || r.collapsedByDirection && r.collapsedByDirection !== e.from)
736
+ const d = e.containerSize, r = t[n], c = e.from === "start" ? r.collapseFromStart : r.collapseFromEnd;
737
+ if (!(De(r) && c && r.collapsed) || r.collapsedByDirection && r.collapsedByDirection !== e.from)
738
738
  return t;
739
- const f = [e.targetSize, r.sizeBeforeCollapse, r.measuredPixelSizeBeforeCollapse, r.preferredPixelSizeBeforeCollapse, r.originalPixelSize].find((m) => m !== void 0) ?? 0, u = q(r.minSize, 0, d), z = q(r.maxSize, d, d), s = ze(f, u, z), a = me(s, d), o = r.measuredPixelSizeBeforeCollapse ?? s, x = me(o, d), C = r.preferredPercentageSizeBeforeCollapse ?? r.percentageSizeBeforeCollapse ?? a, P = r.preferredPixelSizeBeforeCollapse ?? r.preferredPixelSize ?? s, v = {
739
+ const p = [e.targetSize, r.sizeBeforeCollapse, r.measuredPixelSizeBeforeCollapse, r.preferredPixelSizeBeforeCollapse, r.originalPixelSize].find((S) => S !== void 0) ?? 0, u = te(r.minSize, 0, d), z = te(r.maxSize, d, d), s = me(p, u, z), a = Ce(s, d), o = r.measuredPixelSizeBeforeCollapse ?? s, h = Ce(o, d), b = r.preferredPercentageSizeBeforeCollapse ?? r.percentageSizeBeforeCollapse ?? a, m = r.preferredPixelSizeBeforeCollapse ?? r.preferredPixelSize ?? s, v = {
740
740
  ...r,
741
741
  collapsed: !1,
742
742
  collapsedByDirection: null,
743
743
  size: s,
744
744
  percentageSize: a,
745
- preferredPercentageSize: C,
746
- preferredPixelSize: P,
745
+ preferredPercentageSize: b,
746
+ preferredPixelSize: m,
747
747
  sizeBeforeCollapse: s,
748
748
  percentageSizeBeforeCollapse: void 0,
749
749
  preferredPercentageSizeBeforeCollapse: void 0,
750
750
  preferredPixelSizeBeforeCollapse: void 0,
751
751
  measuredPixelSize: s,
752
752
  measuredPixelSizeBeforeCollapse: o,
753
- measuredPercentageSize: x
754
- }, S = [...t];
755
- S[n] = v;
756
- const y = Ze(S, d);
757
- return d > 0 && $e(y, d) ? Ne(y) : y;
753
+ measuredPercentageSize: h
754
+ }, x = [...t];
755
+ x[n] = v;
756
+ const C = Ke(x, d);
757
+ return d > 0 && Ze(C, d) ? Le(C) : C;
758
758
  }
759
759
  default:
760
760
  return t;
761
761
  }
762
- }, _e = new Ge(Ve.INFO, "[resize-panels]"), Ot = ({ direction: t, style: e, onLayout: n, autoSaveId: d, showDebugInfo: r = !1 }) => {
763
- const [l, i] = wt(Dt, []), [f, u] = ye({ width: 0, height: 0 }), [z, s] = ye(!1), [a, o] = ye(!1), [x, C] = ye(null), [P, v] = ye({}), [S, y] = ye({}), m = ie(null), D = ie(n), X = ie(!1), J = ie(0), ae = ie(f), W = ie(f), O = ie(z), B = ie(x?.reason ?? null), ee = ie({}), k = ie(null), $ = ie(null), G = pe((h) => h.map((g) => ({ ...g })), []);
764
- re(() => {
765
- W.current = f;
766
- }, [f]), re(() => {
767
- O.current = z;
768
- }, [z]), re(() => {
769
- B.current = x?.reason ?? null;
770
- }, [x?.reason]), re(() => {
771
- if (x)
762
+ }, Ue = new je(qe.INFO, "[resize-panels]"), Ot = ({ direction: t, style: e, onLayout: n, autoSaveId: d, showDebugInfo: r = !1 }) => {
763
+ const [c, i] = wt(Dt, []), [p, u] = Me({ width: 0, height: 0 }), [z, s] = Me(!1), [a, o] = Me(!1), [h, b] = Me(null), [m, v] = Me({}), [x, C] = Me({}), S = J(null), D = J(n), X = J(!1), re = J(0), de = J(p), j = J(p), _ = J(z), E = J(h?.reason ?? null), oe = J({}), U = J(null), V = J(null), O = J(null), Y = J({ width: 0, height: 0 }), y = J({ width: 0, height: 0 }), N = J({}), be = J({}), ce = Se((l) => l.map((g) => ({ ...g })), []);
764
+ se(() => {
765
+ j.current = p;
766
+ }, [p]), se(() => {
767
+ _.current = z;
768
+ }, [z]), se(() => {
769
+ E.current = h?.reason ?? null;
770
+ }, [h?.reason]), se(() => {
771
+ if (h)
772
772
  return;
773
- const h = t === "horizontal" ? f.width : f.height;
774
- !Number.isFinite(h) || h <= 4 || l.length !== 0 && (k.current = G(l));
775
- }, [x, l, t, f.width, f.height, G]), re(() => {
776
- const h = $.current;
777
- if (x) {
778
- $.current = x;
773
+ const l = t === "horizontal" ? p.width : p.height;
774
+ !Number.isFinite(l) || l <= 4 || c.length !== 0 && (U.current = ce(c));
775
+ }, [h, c, t, p.width, p.height, ce]), se(() => {
776
+ const l = V.current;
777
+ if (h) {
778
+ V.current = h;
779
779
  return;
780
780
  }
781
- if (h && !x && k.current) {
782
- $.current = null;
783
- const g = G(k.current);
781
+ if (l && !h && U.current) {
782
+ V.current = null;
783
+ const g = ce(U.current);
784
784
  i({ type: "SET_PANELS", panels: g });
785
785
  return;
786
786
  }
787
- $.current = x;
788
- }, [x, G]), je(() => {
789
- if (!m.current) return;
790
- const h = new ResizeObserver((g) => {
791
- for (const M of g) {
792
- const p = M.target, E = p ? Le(p, "horizontal") : null, R = p ? Le(p, "vertical") : null, _ = E ? E.inner : 0, V = R ? R.inner : 0, F = M.contentRect.width, N = M.contentRect.height, T = _ > 0 ? _ : F, w = V > 0 ? V : N;
793
- u((L) => (!z && T > 0 && w > 0 && s(!0), L.width === T && L.height === w ? L : { width: T, height: w }));
787
+ V.current = h;
788
+ }, [h, ce]), Xe(() => {
789
+ if (!S.current) return;
790
+ const l = new ResizeObserver((g) => {
791
+ for (const w of g) {
792
+ const M = w.target, A = M ? Oe(M, "horizontal") : null, B = M ? Oe(M, "vertical") : null, H = A ? A.inner : 0, Z = B ? B.inner : 0, T = w.contentRect.width, R = w.contentRect.height, F = H > 0 ? H : T, k = Z > 0 ? Z : R;
793
+ Y.current = { width: F, height: k };
794
+ const Q = y.current, ne = Math.abs(Q.width - F) >= 0.5, K = Math.abs(Q.height - k) >= 0.5;
795
+ ne || K ? (O.current && (clearTimeout(O.current), O.current = null), !z && F > 0 && k > 0 && s(!0), u({ width: F, height: k }), y.current = { width: F, height: k }) : (O.current && clearTimeout(O.current), O.current = setTimeout(() => {
796
+ const W = Y.current;
797
+ u(W), y.current = W, O.current = null;
798
+ }, 150));
794
799
  }
795
800
  });
796
- return h.observe(m.current), () => h.disconnect();
797
- }, [z]), je(() => {
798
- const h = ae.current, g = f, M = t === "horizontal" ? Math.abs(h.width - g.width) > 0 : Math.abs(h.height - g.height) > 0;
799
- if (a && M) {
800
- const p = t === "horizontal" ? g.width : g.height;
801
- i({ type: "CONTAINER_RESIZED", containerSize: p, direction: t });
801
+ return l.observe(S.current), () => {
802
+ l.disconnect(), O.current && clearTimeout(O.current);
803
+ };
804
+ }, [z]), se(() => () => {
805
+ Object.values(N.current).forEach(clearTimeout);
806
+ }, []), Xe(() => {
807
+ const l = de.current, g = p, w = t === "horizontal" ? Math.abs(l.width - g.width) >= 0.5 : Math.abs(l.height - g.height) >= 0.5;
808
+ if (a && w) {
809
+ const M = t === "horizontal" ? g.width : g.height;
810
+ i({ type: "CONTAINER_RESIZED", containerSize: M, direction: t });
802
811
  }
803
- ae.current = g;
804
- }, [f, a, t]);
805
- const j = pe(() => {
806
- _e.debug("panels[0]?.id", l[0]?.id);
807
- const h = l.some((c) => {
808
- if (c.collapsed || c.sizeUnit !== "percentage")
812
+ de.current = g;
813
+ }, [p, a, t]);
814
+ const Pe = Se(() => {
815
+ Ue.debug("panels[0]?.id", c[0]?.id);
816
+ const l = c.some((f) => {
817
+ if (f.collapsed || f.sizeUnit !== "percentage")
809
818
  return !1;
810
- const U = c.collapseFromStart || c.collapseFromEnd ? c.sizeBeforeCollapse ?? c.measuredPixelSizeBeforeCollapse ?? c.originalPixelSize ?? c.measuredPixelSize ?? 0 : c.measuredPixelSize ?? c.originalPixelSize ?? c.size, Z = c.percentageSize !== void 0 && c.percentageSize > 0;
811
- return c.size <= 0 && (U > 0 || Z);
812
- }), g = t === "horizontal" ? f.width : f.height, M = g > 0;
813
- if (x || !M || !(l.length > 0 && (l.length !== J.current || !a || h)))
819
+ const ee = f.collapseFromStart || f.collapseFromEnd ? f.sizeBeforeCollapse ?? f.measuredPixelSizeBeforeCollapse ?? f.originalPixelSize ?? f.measuredPixelSize ?? 0 : f.measuredPixelSize ?? f.originalPixelSize ?? f.size, ie = f.percentageSize !== void 0 && f.percentageSize > 0;
820
+ return f.size <= 0 && (ee > 0 || ie);
821
+ }), g = t === "horizontal" ? p.width : p.height, w = g > 0;
822
+ if (h || !w || !(c.length > 0 && (c.length !== re.current || !a || l)))
814
823
  return;
815
- const R = l.filter((c) => !c.collapsed && (c.originalPixelSize !== void 0 || c.sizeUnit === "pixels")).reduce((c, I) => {
816
- const U = I.preferredPixelSize ?? I.originalPixelSize ?? I.size;
817
- return c + Math.max(0, U ?? 0);
818
- }, 0), _ = l.filter((c) => c.sizeUnit === "percentage" && !c.collapsed), V = _.map((c) => c.id), F = _.map((c) => {
819
- const I = c.preferredPercentageSize ?? c.percentageSize;
820
- return I !== void 0 && I > 0 ? Te(I, g) : c.size > 0 ? c.size : 0;
821
- }), N = F.reduce((c, I) => c + I, 0), T = g - R, w = Math.max(0, T), L = w > 0, K = l.map((c) => {
822
- if (c.collapsed) {
823
- const I = c.sizeBeforeCollapse ?? c.measuredPixelSizeBeforeCollapse ?? c.originalPixelSize ?? (c.sizeUnit === "pixels" ? c.size : void 0), U = c.sizeUnit === "percentage" && c.percentageSize !== void 0 ? Te(c.percentageSize, g) : void 0, Z = I ?? U ?? 0, Q = c.measuredPixelSizeBeforeCollapse ?? c.measuredPixelSize ?? Z;
824
+ const B = c.filter((f) => !f.collapsed && (f.originalPixelSize !== void 0 || f.sizeUnit === "pixels")).reduce((f, L) => {
825
+ const ee = L.preferredPixelSize ?? L.originalPixelSize ?? L.size;
826
+ return f + Math.max(0, ee ?? 0);
827
+ }, 0), H = c.filter((f) => f.sizeUnit === "percentage" && !f.collapsed), Z = H.map((f) => f.id), T = H.map((f) => {
828
+ const L = f.preferredPercentageSize ?? f.percentageSize;
829
+ return L !== void 0 && L > 0 ? We(L, g) : f.size > 0 ? f.size : 0;
830
+ }), R = T.reduce((f, L) => f + L, 0), F = g - B, k = Math.max(0, F), Q = k > 0, ne = c.map((f) => {
831
+ if (f.collapsed) {
832
+ const L = f.sizeBeforeCollapse ?? f.measuredPixelSizeBeforeCollapse ?? f.originalPixelSize ?? (f.sizeUnit === "pixels" ? f.size : void 0), ee = f.sizeUnit === "percentage" && f.percentageSize !== void 0 ? We(f.percentageSize, g) : void 0, ie = L ?? ee ?? 0, xe = f.measuredPixelSizeBeforeCollapse ?? f.measuredPixelSize ?? ie;
824
833
  return {
825
- ...c,
834
+ ...f,
826
835
  size: 0,
827
836
  percentageSize: 0,
828
- preferredPercentageSize: c.preferredPercentageSize,
829
- sizeBeforeCollapse: Z,
830
- percentageSizeBeforeCollapse: c.percentageSizeBeforeCollapse ?? c.percentageSize ?? c.preferredPercentageSize ?? 0,
831
- preferredPercentageSizeBeforeCollapse: c.preferredPercentageSizeBeforeCollapse ?? c.preferredPercentageSize ?? c.percentageSize ?? void 0,
832
- preferredPixelSizeBeforeCollapse: c.preferredPixelSizeBeforeCollapse ?? c.preferredPixelSize ?? Z,
833
- measuredPixelSizeBeforeCollapse: Q
837
+ preferredPercentageSize: f.preferredPercentageSize,
838
+ sizeBeforeCollapse: ie,
839
+ percentageSizeBeforeCollapse: f.percentageSizeBeforeCollapse ?? f.percentageSize ?? f.preferredPercentageSize ?? 0,
840
+ preferredPercentageSizeBeforeCollapse: f.preferredPercentageSizeBeforeCollapse ?? f.preferredPercentageSize ?? f.percentageSize ?? void 0,
841
+ preferredPixelSizeBeforeCollapse: f.preferredPixelSizeBeforeCollapse ?? f.preferredPixelSize ?? ie,
842
+ measuredPixelSizeBeforeCollapse: xe
834
843
  };
835
844
  }
836
- if (c.sizeUnit === "pixels" || c.originalPixelSize !== void 0) {
837
- const I = c.size, U = g > 0 ? me(I, g) : 0, Z = {
838
- ...c,
839
- size: I,
840
- percentageSize: U,
841
- preferredPixelSize: c.preferredPixelSize ?? c.originalPixelSize ?? I,
842
- preferredPercentageSize: c.preferredPercentageSize !== void 0 ? c.preferredPercentageSize : U > 0 ? U : void 0
845
+ if (f.sizeUnit === "pixels" || f.originalPixelSize !== void 0) {
846
+ const L = f.size, ee = g > 0 ? Ce(L, g) : 0, ie = {
847
+ ...f,
848
+ size: L,
849
+ percentageSize: ee,
850
+ preferredPixelSize: f.preferredPixelSize ?? f.originalPixelSize ?? L,
851
+ preferredPercentageSize: f.preferredPercentageSize !== void 0 ? f.preferredPercentageSize : ee > 0 ? ee : void 0
843
852
  };
844
- if (c.collapseFromStart || c.collapseFromEnd) {
845
- const Q = c.sizeBeforeCollapse ?? I, Se = c.measuredPixelSizeBeforeCollapse ?? c.measuredPixelSize ?? Q;
846
- Z.sizeBeforeCollapse = Q, Z.measuredPixelSizeBeforeCollapse = Se, Z.preferredPixelSizeBeforeCollapse = c.preferredPixelSizeBeforeCollapse ?? c.preferredPixelSize ?? Q;
853
+ if (f.collapseFromStart || f.collapseFromEnd) {
854
+ const xe = f.sizeBeforeCollapse ?? L, Ne = f.measuredPixelSizeBeforeCollapse ?? f.measuredPixelSize ?? xe;
855
+ ie.sizeBeforeCollapse = xe, ie.measuredPixelSizeBeforeCollapse = Ne, ie.preferredPixelSizeBeforeCollapse = f.preferredPixelSizeBeforeCollapse ?? f.preferredPixelSize ?? xe;
847
856
  }
848
- return Z;
857
+ return ie;
849
858
  }
850
- if (c.sizeUnit === "percentage") {
851
- const I = V.indexOf(c.id), U = I !== -1 ? F[I] : 0, Z = q(c.minSize, 0, g), Q = q(c.maxSize, g, g), Se = Math.max(
852
- Z,
853
- c.sizeBeforeCollapse ?? 0,
854
- c.measuredPixelSizeBeforeCollapse ?? 0,
855
- c.measuredPixelSize ?? 0,
856
- c.originalPixelSize ?? 0,
857
- c.size > 0 ? c.size : 0,
858
- c.percentageSize !== void 0 ? Te(c.percentageSize, g) : 0,
859
+ if (f.sizeUnit === "percentage") {
860
+ const L = Z.indexOf(f.id), ee = L !== -1 ? T[L] : 0, ie = te(f.minSize, 0, g), xe = te(f.maxSize, g, g), Ne = Math.max(
861
+ ie,
862
+ f.sizeBeforeCollapse ?? 0,
863
+ f.measuredPixelSizeBeforeCollapse ?? 0,
864
+ f.measuredPixelSize ?? 0,
865
+ f.originalPixelSize ?? 0,
866
+ f.size > 0 ? f.size : 0,
867
+ f.percentageSize !== void 0 ? We(f.percentageSize, g) : 0,
859
868
  1
860
- ), Be = U > 0 ? U : Se;
861
- let be;
862
- if (!L)
863
- be = Z;
864
- else if (I !== -1 && N > 0) {
865
- const Me = Be / N, Fe = w * Me;
866
- be = ze(Fe, Z, Q);
869
+ ), ke = ee > 0 ? ee : Ne;
870
+ let Ae;
871
+ if (!Q)
872
+ Ae = ie;
873
+ else if (L !== -1 && R > 0) {
874
+ const we = ke / R, Ie = k * we;
875
+ Ae = me(Ie, ie, xe);
867
876
  } else {
868
- const Me = c.percentageSize !== void 0 ? Te(c.percentageSize, g) : c.size, Fe = Me > 0 ? Me : Be;
869
- be = ze(Fe, Z, Q);
877
+ const we = f.percentageSize !== void 0 ? We(f.percentageSize, g) : f.size, Ie = we > 0 ? we : ke;
878
+ Ae = me(Ie, ie, xe);
870
879
  }
871
- const Re = g > 0 ? me(be, g) : 0, Ie = {
872
- ...c,
873
- size: be,
874
- percentageSize: Re,
875
- preferredPercentageSize: c.preferredPercentageSize !== void 0 ? c.preferredPercentageSize : Re > 0 ? Re : void 0
880
+ const Ge = g > 0 ? Ce(Ae, g) : 0, Te = {
881
+ ...f,
882
+ size: Ae,
883
+ percentageSize: Ge,
884
+ preferredPercentageSize: f.preferredPercentageSize !== void 0 ? f.preferredPercentageSize : Ge > 0 ? Ge : void 0
876
885
  };
877
- if (c.collapseFromStart || c.collapseFromEnd) {
878
- const Me = c.sizeBeforeCollapse ?? be, Fe = c.measuredPixelSizeBeforeCollapse ?? c.measuredPixelSize ?? Me;
879
- Ie.sizeBeforeCollapse = Me, Ie.measuredPixelSizeBeforeCollapse = Fe, Ie.preferredPixelSizeBeforeCollapse = c.preferredPixelSizeBeforeCollapse ?? c.preferredPixelSize ?? Me;
886
+ if (f.collapseFromStart || f.collapseFromEnd) {
887
+ const we = f.sizeBeforeCollapse ?? Ae, Ie = f.measuredPixelSizeBeforeCollapse ?? f.measuredPixelSize ?? we;
888
+ Te.sizeBeforeCollapse = we, Te.measuredPixelSizeBeforeCollapse = Ie, Te.preferredPixelSizeBeforeCollapse = f.preferredPixelSizeBeforeCollapse ?? f.preferredPixelSize ?? we;
880
889
  }
881
- return Ie;
890
+ return Te;
882
891
  }
883
- return c;
884
- }), oe = [];
885
- for (let c = 0; c < K.length; c += 1) {
886
- const I = K[c];
887
- I.sizeUnit === "percentage" && !I.collapsed && oe.push(c);
892
+ return f;
893
+ }), K = [];
894
+ for (let f = 0; f < ne.length; f += 1) {
895
+ const L = ne[f];
896
+ L.sizeUnit === "percentage" && !L.collapsed && K.push(f);
888
897
  }
889
- const Y = oe.reduce((c, I) => c + K[I].size, 0), se = T - Y;
890
- Math.abs(se) > 0 && mt(K, se, g, { enforceAutoMinSize: !0 }), i({ type: "SET_PANELS", panels: K }), J.current = l.length, o(!0);
891
- }, [l, t, f.width, f.height, a, x]);
892
- re(() => {
893
- const h = t === "horizontal" ? f.width : f.height, g = h > 0, M = g && l.length > 0, p = M ? l.reduce((N, T) => {
894
- if (T.collapsed)
895
- return N;
896
- const w = q(T.minSize, 0, h);
897
- return N + Math.max(0, w);
898
- }, 0) : null, E = M ? l.reduce((N, T) => {
899
- if (T.collapsed)
900
- return N;
901
- const w = q(T.maxSize, h, h);
902
- return N + Math.max(0, w);
903
- }, 0) : null, R = p ?? x?.totalMinimumSize ?? null, _ = E ?? x?.totalMaximumSize ?? null;
898
+ const W = K.reduce((f, L) => f + ne[L].size, 0), q = F - W;
899
+ Math.abs(q) > 0 && Ct(ne, q, g, { enforceAutoMinSize: !0 }), i({ type: "SET_PANELS", panels: ne }), re.current = c.length, o(!0);
900
+ }, [c, t, p.width, p.height, a, h]);
901
+ se(() => {
902
+ const l = t === "horizontal" ? p.width : p.height, g = l > 0, w = g && c.length > 0, M = w ? c.reduce((R, F) => {
903
+ if (F.collapsed)
904
+ return R;
905
+ const k = te(F.minSize, 0, l);
906
+ return R + Math.max(0, k);
907
+ }, 0) : null, A = w ? c.reduce((R, F) => {
908
+ if (F.collapsed)
909
+ return R;
910
+ const k = te(F.maxSize, l, l);
911
+ return R + Math.max(0, k);
912
+ }, 0) : null, B = M ?? h?.totalMinimumSize ?? null, H = A ?? h?.totalMaximumSize ?? null;
904
913
  if (!g) {
905
- x && C((N) => !N || N.availableContainerSize === h ? N : {
906
- reason: N.reason,
914
+ h && b((R) => !R || R.availableContainerSize === l ? R : {
915
+ reason: R.reason,
907
916
  // totalMinimumSize: previous.totalMinimumSize,
908
917
  // totalMaximumSize: previous.totalMaximumSize,
909
918
  totalMinimumSize: null,
910
919
  totalMaximumSize: null,
911
- availableContainerSize: h
920
+ availableContainerSize: l
912
921
  });
913
922
  return;
914
923
  }
915
- const V = R !== null && R - h > Number.EPSILON, F = _ !== null && h - _ > Number.EPSILON;
916
- if (V || F) {
917
- const T = {
918
- reason: V ? "minimum-exceeded" : "maximum-insufficient",
919
- totalMinimumSize: R,
920
- totalMaximumSize: _,
921
- availableContainerSize: h
924
+ const Z = B !== null && B - l > Number.EPSILON, T = H !== null && l - H > Number.EPSILON;
925
+ if (Z || T) {
926
+ const F = {
927
+ reason: Z ? "minimum-exceeded" : "maximum-insufficient",
928
+ totalMinimumSize: B,
929
+ totalMaximumSize: H,
930
+ availableContainerSize: l
922
931
  };
923
- C((w) => w && w.reason === T.reason && Math.abs((w.totalMinimumSize ?? 0) - (T.totalMinimumSize ?? 0)) <= Number.EPSILON && Math.abs((w.totalMaximumSize ?? 0) - (T.totalMaximumSize ?? 0)) <= Number.EPSILON && Math.abs(w.availableContainerSize - T.availableContainerSize) <= Number.EPSILON ? w : T);
932
+ b((k) => k && k.reason === F.reason && Math.abs((k.totalMinimumSize ?? 0) - (F.totalMinimumSize ?? 0)) <= Number.EPSILON && Math.abs((k.totalMaximumSize ?? 0) - (F.totalMaximumSize ?? 0)) <= Number.EPSILON && Math.abs(k.availableContainerSize - F.availableContainerSize) <= Number.EPSILON ? k : F);
924
933
  return;
925
934
  }
926
- if (x) {
927
- const N = x.reason === "minimum-exceeded", T = x.reason === "maximum-insufficient";
928
- (!N || R !== null) && (!T || _ !== null) && !V && !F && C((Y) => Y && null);
935
+ if (h) {
936
+ const R = h.reason === "minimum-exceeded", F = h.reason === "maximum-insufficient";
937
+ (!R || B !== null) && (!F || H !== null) && !Z && !T && b((W) => W && null);
929
938
  }
930
- }, [l, t, f.width, f.height, x]), re(() => {
931
- j();
932
- }, [j]), re(() => {
939
+ }, [c, t, p.width, p.height, h]), se(() => {
940
+ Pe();
941
+ }, [Pe]), se(() => {
933
942
  D.current = n;
934
943
  }, [n]);
935
- const b = te(() => l.map((h) => h.size), [l]);
936
- je(() => {
937
- b.length > 0 && D.current && D.current(b);
938
- }, [b]), re(() => {
939
- if (d && b.length > 0) {
940
- const h = setTimeout(() => {
941
- At(d, b);
944
+ const he = ae(() => c.map((l) => l.size), [c]);
945
+ Xe(() => {
946
+ he.length > 0 && D.current && D.current(he);
947
+ }, [he]), se(() => {
948
+ if (d && he.length > 0) {
949
+ const l = setTimeout(() => {
950
+ At(d, he);
942
951
  }, 200);
943
- return () => clearTimeout(h);
952
+ return () => clearTimeout(l);
944
953
  }
945
- }, [d, b]), re(() => {
946
- if (!d || l.length === 0 || X.current)
954
+ }, [d, he]), se(() => {
955
+ if (!d || c.length === 0 || X.current)
947
956
  return;
948
- const h = t === "horizontal" ? f.width : f.height;
949
- if (h <= 0)
957
+ const l = t === "horizontal" ? p.width : p.height;
958
+ if (l <= 0)
950
959
  return;
951
960
  const g = Lt(d);
952
- if (g && g.length === l.length) {
953
- const M = l.map((p, E) => {
954
- const R = q(p.minSize, 0, h), _ = q(p.maxSize, h, h), V = ze(g[E], R, _), F = me(V, h), N = p.sizeUnit === "pixels" || p.originalPixelSize !== void 0 ? V : p.preferredPixelSize;
961
+ if (g && g.length === c.length) {
962
+ const w = c.map((M, A) => {
963
+ const B = te(M.minSize, 0, l), H = te(M.maxSize, l, l), Z = me(g[A], B, H), T = Ce(Z, l), R = M.sizeUnit === "pixels" || M.originalPixelSize !== void 0 ? Z : M.preferredPixelSize;
955
964
  return {
956
- ...p,
957
- size: V,
958
- percentageSize: F,
959
- preferredPercentageSize: F > 0 ? F : p.preferredPercentageSize,
960
- preferredPixelSize: N
965
+ ...M,
966
+ size: Z,
967
+ percentageSize: T,
968
+ preferredPercentageSize: T > 0 ? T : M.preferredPercentageSize,
969
+ preferredPixelSize: R
961
970
  };
962
971
  });
963
- i({ type: "SET_PANELS", panels: M }), X.current = !0;
972
+ i({ type: "SET_PANELS", panels: w }), X.current = !0;
964
973
  }
965
- }, [d, l, f.width, f.height, t]);
966
- const H = pe((h) => {
967
- const g = W.current, M = ee.current, p = JSON.stringify({
968
- id: h.id,
969
- size: h.size ?? null,
970
- percentageSize: h.percentageSize ?? null,
971
- preferredPercentageSize: h.preferredPercentageSize ?? null,
972
- preferredPixelSize: h.preferredPixelSize ?? null,
973
- sizeUnit: h.sizeUnit,
974
- originalPixelSize: h.originalPixelSize ?? null,
975
- minSize: h.minSize ?? null,
976
- maxSize: h.maxSize ?? null,
977
- collapseFromStart: h.collapseFromStart,
978
- collapseFromEnd: h.collapseFromEnd,
979
- collapsed: h.collapsed ?? !1,
980
- collapsedByDirection: h.collapsedByDirection ?? null,
981
- sizeBeforeCollapse: h.sizeBeforeCollapse ?? null,
982
- percentageSizeBeforeCollapse: h.percentageSizeBeforeCollapse ?? null,
983
- preferredPercentageSizeBeforeCollapse: h.preferredPercentageSizeBeforeCollapse ?? null,
984
- preferredPixelSizeBeforeCollapse: h.preferredPixelSizeBeforeCollapse ?? null,
985
- pixelAdjustPriority: h.pixelAdjustPriority ?? null
974
+ }, [d, c, p.width, p.height, t]);
975
+ const ue = Se((l) => {
976
+ const g = j.current, w = oe.current, M = JSON.stringify({
977
+ id: l.id,
978
+ size: l.size ?? null,
979
+ percentageSize: l.percentageSize ?? null,
980
+ preferredPercentageSize: l.preferredPercentageSize ?? null,
981
+ preferredPixelSize: l.preferredPixelSize ?? null,
982
+ sizeUnit: l.sizeUnit,
983
+ originalPixelSize: l.originalPixelSize ?? null,
984
+ minSize: l.minSize ?? null,
985
+ maxSize: l.maxSize ?? null,
986
+ collapseFromStart: l.collapseFromStart,
987
+ collapseFromEnd: l.collapseFromEnd,
988
+ collapsed: l.collapsed ?? !1,
989
+ collapsedByDirection: l.collapsedByDirection ?? null,
990
+ sizeBeforeCollapse: l.sizeBeforeCollapse ?? null,
991
+ percentageSizeBeforeCollapse: l.percentageSizeBeforeCollapse ?? null,
992
+ preferredPercentageSizeBeforeCollapse: l.preferredPercentageSizeBeforeCollapse ?? null,
993
+ preferredPixelSizeBeforeCollapse: l.preferredPixelSizeBeforeCollapse ?? null,
994
+ pixelAdjustPriority: l.pixelAdjustPriority ?? null
986
995
  });
987
- if (M[h.id] === p) {
988
- _e.debug("useResizablePanels.registerPanel skipped", {
989
- panelId: h.id,
996
+ if (w[l.id] === M) {
997
+ Ue.debug("useResizablePanels.registerPanel skipped", {
998
+ panelId: l.id,
990
999
  reason: "duplicate-registration"
991
1000
  });
992
1001
  return;
993
1002
  }
994
- M[h.id] = p, _e.debug("useResizablePanels.registerPanel", {
995
- panelId: h.id,
996
- containerReady: O.current,
997
- violationReason: B.current,
1003
+ w[l.id] = M, Ue.debug("useResizablePanels.registerPanel", {
1004
+ panelId: l.id,
1005
+ containerReady: _.current,
1006
+ violationReason: E.current,
998
1007
  containerSize: {
999
1008
  width: g.width,
1000
1009
  height: g.height
1001
1010
  }
1002
- }), i({ type: "REGISTER_PANEL", panel: h });
1003
- }, []), he = pe((h) => {
1004
- const g = W.current;
1005
- _e.debug("useResizablePanels.unregisterPanel", {
1006
- panelId: h,
1007
- containerReady: O.current,
1008
- violationReason: B.current,
1011
+ }), i({ type: "REGISTER_PANEL", panel: l });
1012
+ }, []), pe = Se((l) => {
1013
+ const g = j.current;
1014
+ Ue.debug("useResizablePanels.unregisterPanel", {
1015
+ panelId: l,
1016
+ containerReady: _.current,
1017
+ violationReason: E.current,
1009
1018
  containerSize: {
1010
1019
  width: g.width,
1011
1020
  height: g.height
1012
1021
  }
1013
- }), i({ type: "UNREGISTER_PANEL", id: h }), delete ee.current[h], v((M) => {
1014
- if (!(h in M))
1015
- return M;
1016
- const p = { ...M };
1017
- return delete p[h], p;
1022
+ }), i({ type: "UNREGISTER_PANEL", id: l }), delete oe.current[l], v((w) => {
1023
+ if (!(l in w))
1024
+ return w;
1025
+ const M = { ...w };
1026
+ return delete M[l], M;
1018
1027
  });
1019
- }, []), ce = pe(
1020
- (h, g, M, p) => {
1021
- const E = t === "horizontal" ? f.width : f.height, R = l.find((Y) => Y.id === h), _ = l.find((Y) => Y.id === g);
1022
- if (!(R && _)) {
1023
- i({ type: "RESIZE_PANELS", leftId: h, rightId: g, leftSize: M, rightSize: p, containerSize: E });
1028
+ }, []), ge = Se(
1029
+ (l, g, w, M) => {
1030
+ const A = t === "horizontal" ? p.width : p.height, B = c.find((W) => W.id === l), H = c.find((W) => W.id === g);
1031
+ if (!(B && H)) {
1032
+ i({ type: "RESIZE_PANELS", leftId: l, rightId: g, leftSize: w, rightSize: M, containerSize: A });
1024
1033
  return;
1025
1034
  }
1026
- if (R.collapsed || _.collapsed)
1035
+ if (B.collapsed || H.collapsed)
1027
1036
  return;
1028
- const V = q(R.minSize, 0, E), F = q(R.maxSize, E, E), N = q(_.minSize, 0, E), T = q(_.maxSize, E, E);
1029
- let w = ze(M, V, F), L = ze(p, N, T);
1030
- const K = w + L, oe = M + p;
1031
- if (K !== oe) {
1032
- const Y = oe - K;
1033
- if (Y > 0) {
1034
- const se = F - w, c = T - L, I = se + c;
1035
- if (I > 0) {
1036
- const U = Math.min(Y * (se / I), se), Z = Math.min(Y - U, c);
1037
- w += U, L += Z;
1037
+ const Z = te(B.minSize, 0, A), T = te(B.maxSize, A, A), R = te(H.minSize, 0, A), F = te(H.maxSize, A, A);
1038
+ let k = me(w, Z, T), Q = me(M, R, F);
1039
+ const ne = k + Q, K = w + M;
1040
+ if (Math.abs(ne - K) > 1e-9) {
1041
+ const W = K - ne;
1042
+ if (W > 0) {
1043
+ const q = T - k, f = F - Q, L = q + f;
1044
+ if (L > 0) {
1045
+ const ee = Math.min(W * (q / L), q), ie = Math.min(W - ee, f);
1046
+ k += ee, Q += ie;
1038
1047
  }
1039
- } else if (Y < 0) {
1040
- const se = Math.abs(Y), c = w - V, I = L - N, U = c + I;
1041
- if (U > 0) {
1042
- const Z = Math.min(se * (c / U), c), Q = Math.min(se - Z, I);
1043
- w -= Z, L -= Q;
1048
+ } else if (W < 0) {
1049
+ const q = Math.abs(W), f = k - Z, L = Q - R, ee = f + L;
1050
+ if (ee > 0) {
1051
+ const ie = Math.min(q * (f / ee), f), xe = Math.min(q - ie, L);
1052
+ k -= ie, Q -= xe;
1044
1053
  }
1045
1054
  }
1046
1055
  }
1047
- w = ze(w, V, F), L = ze(L, N, T), w + L !== oe && _e.error("Total size after constraints should be close to the original total size.", { constrainedLeftSize: w, constrainedRightSize: L, originalTotalSize: oe }), i({ type: "RESIZE_PANELS", leftId: h, rightId: g, leftSize: w, rightSize: L, containerSize: E });
1056
+ k = me(k, Z, T), Q = me(Q, R, F), Math.abs(k + Q - K) > 1e-9 && Ue.error("Total size after constraints should be close to the original total size.", { constrainedLeftSize: k, constrainedRightSize: Q, originalTotalSize: K }), i({ type: "RESIZE_PANELS", leftId: l, rightId: g, leftSize: k, rightSize: Q, containerSize: A });
1048
1057
  },
1049
- [t, f.width, f.height, l]
1050
- ), ge = pe(
1051
- (h, g) => {
1052
- const M = t === "horizontal" ? f.width : f.height;
1053
- i({ type: "COLLAPSE_PANEL", id: h, from: g, containerSize: M });
1058
+ [t, p.width, p.height, c]
1059
+ ), ye = Se(
1060
+ (l, g) => {
1061
+ const w = t === "horizontal" ? p.width : p.height;
1062
+ i({ type: "COLLAPSE_PANEL", id: l, from: g, containerSize: w });
1054
1063
  },
1055
- [t, f.width, f.height]
1056
- ), Pe = pe(
1057
- (h, g, M) => {
1058
- const p = t === "horizontal" ? f.width : f.height;
1059
- i({ type: "EXPAND_PANEL", id: h, from: g, containerSize: p, targetSize: M });
1064
+ [t, p.width, p.height]
1065
+ ), Be = Se(
1066
+ (l, g, w) => {
1067
+ const M = t === "horizontal" ? p.width : p.height;
1068
+ i({ type: "EXPAND_PANEL", id: l, from: g, containerSize: M, targetSize: w });
1060
1069
  },
1061
- [t, f.width, f.height]
1062
- ), ne = pe(
1063
- (h) => l.find((g) => g.id === h),
1064
- [l]
1065
- ), de = pe((h, g) => {
1066
- v((M) => {
1070
+ [t, p.width, p.height]
1071
+ ), Re = Se(
1072
+ (l) => c.find((g) => g.id === l),
1073
+ [c]
1074
+ ), G = Se((l, g) => {
1075
+ v((w) => {
1067
1076
  if (g === null) {
1068
- if (!(h in M))
1069
- return M;
1070
- const E = { ...M };
1071
- return delete E[h], E;
1077
+ if (!(l in w))
1078
+ return w;
1079
+ const H = { ...w };
1080
+ return delete H[l], H;
1072
1081
  }
1073
- const p = M[h];
1074
- return p && p.pixelSize === g.pixelSize && p.percentageSize === g.percentageSize ? M : {
1075
- ...M,
1076
- [h]: g
1077
- };
1082
+ const M = w[l], A = M && Math.abs(M.pixelSize - g.pixelSize) < 0.1, B = M && Math.abs(M.percentageSize - g.percentageSize) < 0.01;
1083
+ return A && B ? (N.current[l] && clearTimeout(N.current[l]), be.current[l] = g, N.current[l] = setTimeout(() => {
1084
+ const H = be.current[l];
1085
+ H && v((Z) => ({
1086
+ ...Z,
1087
+ [l]: H
1088
+ })), delete N.current[l];
1089
+ }, 200), w) : (N.current[l] && (clearTimeout(N.current[l]), delete N.current[l]), {
1090
+ ...w,
1091
+ [l]: g
1092
+ });
1078
1093
  });
1079
- }, []), fe = pe((h, g) => {
1080
- y((M) => {
1094
+ }, []), le = Se((l, g) => {
1095
+ C((w) => {
1081
1096
  if (g === null) {
1082
- if (!(h in M))
1083
- return M;
1084
- const E = { ...M };
1085
- return delete E[h], E;
1097
+ if (!(l in w))
1098
+ return w;
1099
+ const A = { ...w };
1100
+ return delete A[l], A;
1086
1101
  }
1087
- const p = M[h];
1088
- return p && Math.abs(p.thickness - g.thickness) <= 0.25 && p.visible === g.visible && p.direction === g.direction && p.startPanelId === g.startPanelId && p.endPanelId === g.endPanelId ? M : {
1089
- ...M,
1090
- [h]: g
1102
+ const M = w[l];
1103
+ return M && Math.abs(M.thickness - g.thickness) <= 0.25 && M.visible === g.visible && M.direction === g.direction && M.startPanelId === g.startPanelId && M.endPanelId === g.endPanelId ? w : {
1104
+ ...w,
1105
+ [l]: g
1091
1106
  };
1092
1107
  });
1093
- }, []), xe = te(
1108
+ }, []), P = ae(
1094
1109
  () => ({
1095
1110
  direction: t,
1096
- panels: l,
1097
- containerSize: f,
1111
+ panels: c,
1112
+ containerSize: p,
1098
1113
  isContainerReady: z,
1099
1114
  showDebugInfo: r,
1100
- registerPanel: H,
1101
- unregisterPanel: he,
1102
- resizePanels: ce,
1103
- collapsePanel: ge,
1104
- expandPanel: Pe,
1105
- getPanel: ne,
1106
- reportPanelMeasurement: de,
1107
- panelMeasurements: P,
1108
- reportHandleMeasurement: fe,
1109
- handleMeasurements: S,
1110
- layoutConstraintViolation: x
1115
+ registerPanel: ue,
1116
+ unregisterPanel: pe,
1117
+ resizePanels: ge,
1118
+ collapsePanel: ye,
1119
+ expandPanel: Be,
1120
+ getPanel: Re,
1121
+ reportPanelMeasurement: G,
1122
+ panelMeasurements: m,
1123
+ reportHandleMeasurement: le,
1124
+ handleMeasurements: x,
1125
+ layoutConstraintViolation: h
1111
1126
  }),
1112
- [t, l, f, z, r, H, he, ce, ge, Pe, ne, de, P, fe, S, x]
1113
- ), ve = te(
1127
+ [t, c, p, z, r, ue, pe, ge, ye, Be, Re, G, m, le, x, h]
1128
+ ), $ = ae(
1114
1129
  () => ({
1115
1130
  display: "flex",
1116
1131
  flexDirection: t === "horizontal" ? "row" : "column",
@@ -1127,59 +1142,59 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
1127
1142
  [t, e]
1128
1143
  );
1129
1144
  return {
1130
- groupRef: m,
1131
- contextValue: xe,
1132
- groupStyle: ve
1145
+ groupRef: S,
1146
+ contextValue: P,
1147
+ groupStyle: $
1133
1148
  };
1134
1149
  }, di = (t) => {
1135
- const { getPanel: e, collapsePanel: n, expandPanel: d } = Qe(), r = e(t), l = pe(
1150
+ const { getPanel: e, collapsePanel: n, expandPanel: d } = rt(), r = e(t), c = Se(
1136
1151
  (u) => {
1137
1152
  n(t, u);
1138
1153
  },
1139
1154
  [n, t]
1140
- ), i = pe(
1155
+ ), i = Se(
1141
1156
  (u, z) => {
1142
1157
  d(t, u, z);
1143
1158
  },
1144
1159
  [d, t]
1145
- ), f = pe(
1160
+ ), p = Se(
1146
1161
  (u, z) => {
1147
- r?.collapsed ? i(u, z) : l(u);
1162
+ r?.collapsed ? i(u, z) : c(u);
1148
1163
  },
1149
- [r?.collapsed, l, i]
1164
+ [r?.collapsed, c, i]
1150
1165
  );
1151
- return te(
1166
+ return ae(
1152
1167
  () => ({
1153
1168
  panel: r,
1154
1169
  isCollapsed: r?.collapsed ?? !1,
1155
1170
  canCollapseFromStart: r?.collapseFromStart ?? !1,
1156
1171
  canCollapseFromEnd: r?.collapseFromEnd ?? !1,
1157
- collapse: l,
1172
+ collapse: c,
1158
1173
  expand: i,
1159
- toggle: f
1174
+ toggle: p
1160
1175
  }),
1161
- [r, l, i, f]
1176
+ [r, c, i, p]
1162
1177
  );
1163
- }, _t = ({ panel: t, measuredPixelSize: e, measuredPercentageSize: n, containerAxisSize: d, containerLabel: r }) => {
1164
- const l = t?.size, i = typeof l == "number" && Number.isFinite(l) ? `${l.toFixed(3)}px` : "-", f = t?.percentageSize !== void 0 ? `${t.percentageSize.toFixed(3)}%` : "-", u = Number.isFinite(e) ? `${e.toFixed(3)}px` : "-", z = Number.isFinite(n) ? `${n.toFixed(3)}%` : "-", s = Number.isFinite(d) ? `${d.toFixed(3)}px` : "-", a = `${i} / ${f}`, o = `${u} / ${z}`, x = t?.sizeUnit === "pixels" ? "Fixed" : "Flexible", C = [x, `${r}: ${s}`, `size (state): ${a}`, `size (measured): ${o}`];
1178
+ }, Tt = ({ panel: t, measuredPixelSize: e, measuredPercentageSize: n, containerAxisSize: d, containerLabel: r }) => {
1179
+ const c = t?.size, i = typeof c == "number" && Number.isFinite(c) ? `${c.toFixed(3)}px` : "-", p = t?.percentageSize !== void 0 ? `${t.percentageSize.toFixed(3)}%` : "-", u = Number.isFinite(e) ? `${e.toFixed(3)}px` : "-", z = Number.isFinite(n) ? `${n.toFixed(3)}%` : "-", s = Number.isFinite(d) ? `${d.toFixed(3)}px` : "-", a = `${i} / ${p}`, o = `${u} / ${z}`, h = t?.sizeUnit === "pixels" ? "Fixed" : "Flexible", b = [h, `${r}: ${s}`, `size (state): ${a}`, `size (measured): ${o}`];
1165
1180
  return {
1166
1181
  stateValueDisplay: a,
1167
1182
  measuredValueDisplay: o,
1168
1183
  containerDisplay: s,
1169
- headlineLabel: x,
1170
- titleText: C.join(`
1184
+ headlineLabel: h,
1185
+ titleText: b.join(`
1171
1186
  `)
1172
1187
  };
1173
- }, Tt = Ke(({ panel: t, measuredPixelSize: e, measuredPercentageSize: n, containerAxisSize: d, direction: r }) => {
1174
- const l = r === "horizontal" ? "container width" : "container height", { stateValueDisplay: i, measuredValueDisplay: f, containerDisplay: u, headlineLabel: z, titleText: s } = te(
1175
- () => _t({
1188
+ }, _t = it(({ panel: t, measuredPixelSize: e, measuredPercentageSize: n, containerAxisSize: d, direction: r }) => {
1189
+ const c = r === "horizontal" ? "container width" : "container height", { stateValueDisplay: i, measuredValueDisplay: p, containerDisplay: u, headlineLabel: z, titleText: s } = ae(
1190
+ () => Tt({
1176
1191
  panel: t,
1177
1192
  measuredPixelSize: e,
1178
1193
  measuredPercentageSize: n,
1179
1194
  containerAxisSize: d,
1180
- containerLabel: l
1195
+ containerLabel: c
1181
1196
  }),
1182
- [t, e, n, d, l]
1197
+ [t, e, n, d, c]
1183
1198
  ), a = {
1184
1199
  position: "absolute",
1185
1200
  top: "2px",
@@ -1204,7 +1219,7 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
1204
1219
  gap: "1px",
1205
1220
  minWidth: "0",
1206
1221
  width: "100%"
1207
- }, x = {
1222
+ }, h = {
1208
1223
  display: "flex",
1209
1224
  justifyContent: "flex-start",
1210
1225
  alignItems: "center",
@@ -1216,7 +1231,7 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
1216
1231
  textOverflow: "ellipsis",
1217
1232
  minWidth: "0",
1218
1233
  width: "100%"
1219
- }, C = {
1234
+ }, b = {
1220
1235
  display: "flex",
1221
1236
  justifyContent: "space-between",
1222
1237
  alignItems: "center",
@@ -1226,27 +1241,27 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
1226
1241
  textOverflow: "ellipsis",
1227
1242
  minWidth: "0",
1228
1243
  width: "100%"
1229
- }, P = {
1244
+ }, m = {
1230
1245
  marginLeft: "auto",
1231
1246
  fontVariantNumeric: "tabular-nums",
1232
1247
  whiteSpace: "nowrap"
1233
1248
  };
1234
- return /* @__PURE__ */ A("div", { style: a, title: s, children: /* @__PURE__ */ le("div", { style: o, children: [
1235
- /* @__PURE__ */ A("div", { style: x, children: /* @__PURE__ */ A("span", { children: z }) }),
1236
- /* @__PURE__ */ le("div", { style: C, children: [
1237
- /* @__PURE__ */ A("span", { children: l }),
1238
- /* @__PURE__ */ A("span", { style: P, children: u })
1249
+ return /* @__PURE__ */ I("div", { style: a, title: s, children: /* @__PURE__ */ fe("div", { style: o, children: [
1250
+ /* @__PURE__ */ I("div", { style: h, children: /* @__PURE__ */ I("span", { children: z }) }),
1251
+ /* @__PURE__ */ fe("div", { style: b, children: [
1252
+ /* @__PURE__ */ I("span", { children: c }),
1253
+ /* @__PURE__ */ I("span", { style: m, children: u })
1239
1254
  ] }),
1240
- /* @__PURE__ */ le("div", { style: C, children: [
1241
- /* @__PURE__ */ A("span", { children: "size (state)" }),
1242
- /* @__PURE__ */ A("span", { style: P, children: i })
1255
+ /* @__PURE__ */ fe("div", { style: b, children: [
1256
+ /* @__PURE__ */ I("span", { children: "size (state)" }),
1257
+ /* @__PURE__ */ I("span", { style: m, children: i })
1243
1258
  ] }),
1244
- /* @__PURE__ */ le("div", { style: C, children: [
1245
- /* @__PURE__ */ A("span", { children: "size (measured)" }),
1246
- /* @__PURE__ */ A("span", { style: P, children: f })
1259
+ /* @__PURE__ */ fe("div", { style: b, children: [
1260
+ /* @__PURE__ */ I("span", { children: "size (measured)" }),
1261
+ /* @__PURE__ */ I("span", { style: m, children: p })
1247
1262
  ] })
1248
1263
  ] }) });
1249
- }), Je = new Ge(Ve.INFO, "[resize-panels]"), kt = {
1264
+ }), tt = new je(qe.INFO, "[resize-panels]"), kt = {
1250
1265
  both: {
1251
1266
  collapseFromStart: !0,
1252
1267
  collapseFromEnd: !0
@@ -1269,175 +1284,181 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
1269
1284
  if (!e)
1270
1285
  throw new Error("Invalid collapsible configuration: unsupported 'from' value");
1271
1286
  return e;
1272
- }, ot = ({ ref: t, setState: e, panelIdRef: n, label: d }) => (r) => {
1273
- if (!Number.isFinite(r))
1287
+ }, lt = ({ ref: t, setState: e, panelIdRef: n, label: d, timerRef: r }) => (c) => {
1288
+ if (!Number.isFinite(c))
1289
+ return;
1290
+ const i = c < 0 ? 0 : c, p = d === "pixel" ? 0.1 : 0.01;
1291
+ if (Math.abs(t.current - i) < p) {
1292
+ r && (r.current && clearTimeout(r.current), r.current = setTimeout(() => {
1293
+ t.current = i, e(i), r.current = null;
1294
+ }, 200));
1274
1295
  return;
1275
- const l = r < 0 ? 0 : r;
1276
- t.current !== l && (t.current = l, Je.debug(`commit ${d}`, {
1296
+ }
1297
+ r?.current && (clearTimeout(r.current), r.current = null), t.current = i, tt.debug(`commit ${d}`, {
1277
1298
  panelId: n.current,
1278
- [d]: l
1279
- }), e(l));
1280
- }, ui = Ke(
1281
- ({ id: t, defaultSize: e = { value: 50, unit: "percentage" }, minSize: n, maxSize: d, autoMinSize: r, className: l, style: i, children: f, order: u = 0, collapsible: z, defaultCollapsed: s = !1, pixelAdjustPriority: a, flexAdjustPriority: o, contentOverflow: x = "auto" }) => {
1282
- const { direction: C, registerPanel: P, unregisterPanel: v, getPanel: S, showDebugInfo: y, isContainerReady: m, reportPanelMeasurement: D, containerSize: X } = Qe(), J = ie(null), ae = ut(), W = ie(t || `panel-${ae}`), O = te(() => Gt(z), [z]), B = O.collapseFromStart || O.collapseFromEnd, ee = te(() => B ? O.collapseFromStart ? "start" : O.collapseFromEnd ? "end" : null : null, [B, O.collapseFromStart, O.collapseFromEnd]), k = B && s, $ = te(() => Xe(e), [e]), G = $?.unit === "pixels", j = G ? void 0 : $?.value, b = S(W.current), H = !!b?.collapsed, he = (b?.size ?? 0) <= 0, ce = H || he, [ge, Pe] = ye(() => G && $ ? $.value : b?.size !== void 0 ? b.size : 0), [ne, de] = ye(() => !G && $ ? $.value : b?.percentageSize !== void 0 ? b.percentageSize : 0), fe = ie(ne);
1283
- fe.current = ne;
1284
- const xe = ie(ge);
1285
- xe.current = ge;
1286
- const ve = te(
1287
- () => ot({
1288
- ref: xe,
1289
- setState: Pe,
1290
- panelIdRef: W,
1291
- label: "pixel"
1299
+ [d]: i
1300
+ }), e(i);
1301
+ }, ui = it(
1302
+ ({ id: t, defaultSize: e = { value: 50, unit: "percentage" }, minSize: n, maxSize: d, autoMinSize: r, className: c, style: i, children: p, order: u = 0, collapsible: z, defaultCollapsed: s = !1, pixelAdjustPriority: a, flexAdjustPriority: o, contentOverflow: h = "auto" }) => {
1303
+ const { direction: b, registerPanel: m, unregisterPanel: v, getPanel: x, showDebugInfo: C, isContainerReady: S, reportPanelMeasurement: D, containerSize: X } = rt(), re = J(null), de = zt(), j = J(t || `panel-${de}`), _ = ae(() => Gt(z), [z]), E = _.collapseFromStart || _.collapseFromEnd, oe = ae(() => E ? _.collapseFromStart ? "start" : _.collapseFromEnd ? "end" : null : null, [E, _.collapseFromStart, _.collapseFromEnd]), U = E && s, V = ae(() => Qe(e), [e]), O = V?.unit === "pixels", Y = O ? void 0 : V?.value, y = x(j.current), N = !!y?.collapsed, be = (y?.size ?? 0) <= 0, ce = N || be, [Pe, he] = Me(() => O && V ? V.value : y?.size !== void 0 ? y.size : 0), [ue, pe] = Me(() => !O && V ? V.value : y?.percentageSize !== void 0 ? y.percentageSize : 0), ge = J(Pe), ye = J(ue), Be = J(null), Re = J(null);
1304
+ se(() => () => {
1305
+ Be.current && clearTimeout(Be.current), Re.current && clearTimeout(Re.current);
1306
+ }, []);
1307
+ const G = ae(
1308
+ () => lt({
1309
+ ref: ge,
1310
+ setState: he,
1311
+ panelIdRef: j,
1312
+ label: "pixel",
1313
+ timerRef: Be
1292
1314
  }),
1293
1315
  []
1294
- ), h = te(
1295
- () => ot({
1296
- ref: fe,
1297
- setState: de,
1298
- panelIdRef: W,
1299
- label: "percentage"
1316
+ ), le = ae(
1317
+ () => lt({
1318
+ ref: ye,
1319
+ setState: pe,
1320
+ panelIdRef: j,
1321
+ label: "percentage",
1322
+ timerRef: Re
1300
1323
  }),
1301
1324
  []
1302
- ), g = pe(() => {
1303
- xe.current !== 0 && (xe.current = 0, Pe(0)), fe.current !== 0 && (fe.current = 0, de(0));
1325
+ ), P = Se(() => {
1326
+ ge.current !== 0 && (ge.current = 0, he(0)), ye.current !== 0 && (ye.current = 0, pe(0));
1304
1327
  }, []);
1305
- re(() => {
1306
- if (!m)
1328
+ se(() => {
1329
+ if (!S)
1307
1330
  return;
1308
- let w = 0;
1309
- if (G && $) {
1310
- let U = $.value;
1311
- n && typeof n == "object" && n.unit === "pixels" && (U = Math.max(U, n.value)), d && typeof d == "object" && d.unit === "pixels" && (U = Math.min(U, d.value)), w = U;
1331
+ let T = 0;
1332
+ if (O && V) {
1333
+ let q = V.value;
1334
+ n && typeof n == "object" && n.unit === "pixels" && (q = Math.max(q, n.value)), d && typeof d == "object" && d.unit === "pixels" && (q = Math.min(q, d.value)), T = q;
1312
1335
  }
1313
- const L = k, K = L ? ee : null;
1314
- s && !B && Je.warn("Panel defaultCollapsed is ignored because collapsible configuration is not provided.");
1315
- const oe = B && L && G ? w : void 0, Y = B ? j : void 0, se = G ? w : void 0, c = {
1316
- id: W.current,
1317
- size: L ? 0 : w,
1318
- percentageSize: L ? 0 : j,
1319
- preferredPercentageSize: j,
1320
- preferredPixelSize: se,
1321
- sizeUnit: $?.unit || "percentage",
1322
- originalPixelSize: G ? w : void 0,
1336
+ const R = U, F = R ? oe : null;
1337
+ s && !E && tt.warn("Panel defaultCollapsed is ignored because collapsible configuration is not provided.");
1338
+ const k = E && R && O ? T : void 0, Q = E ? Y : void 0, ne = O ? T : void 0, K = {
1339
+ id: j.current,
1340
+ size: R ? 0 : T,
1341
+ percentageSize: R ? 0 : Y,
1342
+ preferredPercentageSize: Y,
1343
+ preferredPixelSize: ne,
1344
+ sizeUnit: V?.unit || "percentage",
1345
+ originalPixelSize: O ? T : void 0,
1323
1346
  minSize: n,
1324
1347
  maxSize: d,
1325
- collapseFromStart: O.collapseFromStart,
1326
- collapseFromEnd: O.collapseFromEnd,
1327
- collapsedByDirection: K,
1328
- collapsed: L,
1329
- sizeBeforeCollapse: oe,
1330
- percentageSizeBeforeCollapse: Y,
1331
- preferredPercentageSizeBeforeCollapse: B ? j : void 0,
1332
- preferredPixelSizeBeforeCollapse: B ? se : void 0,
1348
+ collapseFromStart: _.collapseFromStart,
1349
+ collapseFromEnd: _.collapseFromEnd,
1350
+ collapsedByDirection: F,
1351
+ collapsed: R,
1352
+ sizeBeforeCollapse: k,
1353
+ percentageSizeBeforeCollapse: Q,
1354
+ preferredPercentageSizeBeforeCollapse: E ? Y : void 0,
1355
+ preferredPixelSizeBeforeCollapse: E ? ne : void 0,
1333
1356
  pixelAdjustPriority: a,
1334
1357
  flexAdjustPriority: o,
1335
1358
  autoMinSize: r
1336
1359
  };
1337
- return P(c), () => {
1338
- v(W.current), D(W.current, null);
1339
- };
1360
+ m(K);
1340
1361
  }, [
1341
1362
  r,
1342
- O.collapseFromEnd,
1343
- O.collapseFromStart,
1363
+ _.collapseFromEnd,
1364
+ _.collapseFromStart,
1344
1365
  s,
1345
- $,
1366
+ V,
1346
1367
  o,
1347
- B,
1348
- m,
1349
- G,
1368
+ E,
1369
+ S,
1370
+ O,
1350
1371
  d,
1351
1372
  n,
1352
1373
  a,
1353
- ee,
1354
- j,
1355
- P,
1356
- D,
1357
- k,
1358
- v
1359
- ]);
1360
- const M = b?.size ?? 0;
1361
- re(() => {
1362
- const w = J.current;
1363
- if (!w) return;
1364
- const L = () => {
1365
- if (!b)
1374
+ oe,
1375
+ Y,
1376
+ m,
1377
+ U
1378
+ ]), se(() => () => {
1379
+ v(j.current), D(j.current, null);
1380
+ }, [v, D]);
1381
+ const $ = y?.size ?? 0;
1382
+ se(() => {
1383
+ const T = re.current;
1384
+ if (!T) return;
1385
+ const R = () => {
1386
+ if (!y)
1366
1387
  return;
1367
- const c = w.parentElement;
1368
- if (!c) return;
1369
- const I = w.getBoundingClientRect(), U = Le(c, "horizontal"), Z = Le(c, "vertical"), Q = C === "horizontal" ? I.width : I.height, Se = C === "horizontal" ? U.inner : Z.inner, Be = qe(Se);
1388
+ const K = T.parentElement;
1389
+ if (!K) return;
1390
+ const W = T.getBoundingClientRect(), q = Oe(K, "horizontal"), f = Oe(K, "vertical"), L = b === "horizontal" ? W.width : W.height, ee = b === "horizontal" ? q.inner : f.inner, ie = et(ee);
1370
1391
  if (ce) {
1371
- g();
1392
+ P();
1372
1393
  return;
1373
1394
  }
1374
- const be = b.size ?? 0, Re = Math.max(2, Be * 0.5);
1375
- if (be > Be && Q < Re) {
1376
- Je.debug("skip noisy measurement", {
1377
- panelId: W.current,
1378
- expectedPanelSize: be,
1379
- measured: Q,
1380
- noiseThreshold: Re
1395
+ const xe = y.size ?? 0, Ne = Math.max(2, ie * 0.5);
1396
+ if (xe > ie && L < Ne) {
1397
+ tt.debug("skip noisy measurement", {
1398
+ panelId: j.current,
1399
+ expectedPanelSize: xe,
1400
+ measured: L,
1401
+ noiseThreshold: Ne
1381
1402
  });
1382
1403
  return;
1383
1404
  }
1384
- if (Q > 0) {
1385
- ve(Q), Se > 0 && h(Q / Se * 100);
1405
+ if (L > 0) {
1406
+ G(L), ee > 0 && le(L / ee * 100);
1386
1407
  return;
1387
1408
  }
1388
- b.size !== void 0 && ve(b.size), b.percentageSize !== void 0 ? h(b.percentageSize) : b.sizeUnit === "pixels" && b.size !== void 0 && Se > 0 && h(b.size / Se * 100);
1389
- }, K = new ResizeObserver(() => {
1390
- L();
1409
+ y.size !== void 0 && G(y.size), y.percentageSize !== void 0 ? le(y.percentageSize) : y.sizeUnit === "pixels" && y.size !== void 0 && ee > 0 && le(y.size / ee * 100);
1410
+ }, F = new ResizeObserver(() => {
1411
+ R();
1391
1412
  });
1392
- K.observe(w), L();
1393
- const oe = [], Y = new MutationObserver(() => {
1413
+ F.observe(T), R();
1414
+ const k = [], Q = new MutationObserver(() => {
1394
1415
  (() => {
1395
- if (!J.current) return !1;
1396
- const I = J.current.getBoundingClientRect();
1397
- return (C === "horizontal" ? I.width : I.height) !== xe.current;
1398
- })() && setTimeout(L, 0);
1399
- }), se = w.parentElement;
1400
- return se && Y.observe(se, {
1416
+ if (!re.current) return !1;
1417
+ const W = re.current.getBoundingClientRect();
1418
+ return (b === "horizontal" ? W.width : W.height) !== ge.current;
1419
+ })() && setTimeout(R, 0);
1420
+ }), ne = T.parentElement;
1421
+ return ne && Q.observe(ne, {
1401
1422
  childList: !0,
1402
1423
  subtree: !0,
1403
1424
  attributes: !0,
1404
1425
  attributeFilter: ["style", "class"]
1405
1426
  }), () => {
1406
- K.disconnect(), Y.disconnect();
1407
- for (const c of oe)
1408
- clearTimeout(c);
1427
+ F.disconnect(), Q.disconnect();
1428
+ for (const K of k)
1429
+ clearTimeout(K);
1409
1430
  };
1410
- }, [h, ve, b, C, ce, g]);
1411
- const p = b?.size, E = b?.percentageSize, R = b?.sizeUnit;
1412
- re(() => {
1413
- if (b) {
1431
+ }, [le, G, y, b, ce, P]);
1432
+ const l = y?.size, g = y?.percentageSize, w = y?.sizeUnit;
1433
+ se(() => {
1434
+ if (y) {
1414
1435
  if (ce) {
1415
- g();
1436
+ P();
1416
1437
  return;
1417
1438
  }
1418
- if (p !== void 0 && ve(p), E !== void 0)
1419
- h(E);
1420
- else if (R === "pixels" && p !== void 0) {
1421
- const w = J.current, L = w?.parentElement;
1422
- if (w && L) {
1423
- const { width: K, height: oe } = w.getBoundingClientRect(), Y = L.clientWidth, se = L.clientHeight, c = C === "horizontal" ? K : oe, I = C === "horizontal" ? Y : se;
1424
- if (c > 0 && I > 0) {
1425
- const U = c / I * 100;
1426
- h(U);
1439
+ if (l !== void 0 && G(l), g !== void 0)
1440
+ le(g);
1441
+ else if (w === "pixels" && l !== void 0) {
1442
+ const T = re.current, R = T?.parentElement;
1443
+ if (T && R) {
1444
+ const { width: F, height: k } = T.getBoundingClientRect(), Q = R.clientWidth, ne = R.clientHeight, K = b === "horizontal" ? F : k, W = b === "horizontal" ? Q : ne;
1445
+ if (K > 0 && W > 0) {
1446
+ const q = K / W * 100;
1447
+ le(q);
1427
1448
  }
1428
1449
  }
1429
1450
  }
1430
1451
  }
1431
- }, [h, ve, b, E, p, R, C, ce, g]), re(() => {
1432
- D(W.current, {
1433
- pixelSize: ge,
1434
- percentageSize: ne
1452
+ }, [le, G, y, g, l, w, b, ce, P]), se(() => {
1453
+ D(j.current, {
1454
+ pixelSize: Pe,
1455
+ percentageSize: ue
1435
1456
  });
1436
- }, [D, ge, ne]);
1437
- const _ = () => ce ? "0px" : b?.originalPixelSize !== void 0 ? `${M}px` : b?.percentageSize !== void 0 ? `${b.percentageSize}%` : `${M}px`, V = b?.sizeUnit === "percentage" && !b?.collapsed ? 1 : 0, F = {
1438
- flexBasis: _(),
1457
+ }, [D, Pe, ue]);
1458
+ const M = () => ce ? "0px" : y?.originalPixelSize !== void 0 ? `${$}px` : y?.percentageSize !== void 0 ? `${y.percentageSize}%` : `${$}px`, A = y?.sizeUnit === "percentage" && !y?.collapsed ? 1 : 0, B = {
1459
+ flexBasis: M(),
1439
1460
  flexGrow: 0,
1440
- flexShrink: V,
1461
+ flexShrink: A,
1441
1462
  overflow: "hidden",
1442
1463
  position: "relative",
1443
1464
  boxSizing: "border-box",
@@ -1445,12 +1466,12 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
1445
1466
  minWidth: "0px",
1446
1467
  ...i
1447
1468
  };
1448
- C === "horizontal" ? (F.height = "100%", F.minWidth = 0) : (F.width = "100%", F.minHeight = 0), ce && (C === "horizontal" ? (F.width = "0px", F.minWidth = "0px") : (F.height = "0px", F.minHeight = "0px"), F.flexGrow = 0, F.flexShrink = 0, F.pointerEvents = "none", F.visibility = "hidden", H && (F.display = "none"));
1449
- const N = C === "horizontal" ? X.width : X.height, T = te(
1469
+ b === "horizontal" ? (B.height = "100%", B.minWidth = 0) : (B.width = "100%", B.minHeight = 0), ce && (b === "horizontal" ? (B.width = "0px", B.minWidth = "0px") : (B.height = "0px", B.minHeight = "0px"), B.flexGrow = 0, B.flexShrink = 0, B.pointerEvents = "none", B.visibility = "hidden", N && (B.display = "none"));
1470
+ const H = b === "horizontal" ? X.width : X.height, Z = ae(
1450
1471
  () => ({
1451
1472
  position: "absolute",
1452
1473
  inset: "0px",
1453
- overflow: x,
1474
+ overflow: h,
1454
1475
  display: "flex",
1455
1476
  flexDirection: "column",
1456
1477
  width: "100%",
@@ -1458,27 +1479,27 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
1458
1479
  minWidth: "0px",
1459
1480
  minHeight: "0px"
1460
1481
  }),
1461
- [x]
1482
+ [h]
1462
1483
  );
1463
- return /* @__PURE__ */ le(
1484
+ return /* @__PURE__ */ fe(
1464
1485
  "div",
1465
1486
  {
1466
- ref: J,
1467
- className: ke("panel", l),
1468
- style: F,
1469
- "data-panel-id": W.current,
1470
- "data-panel-size": M,
1471
- "data-panel-size-unit": b?.sizeUnit || "percentage",
1472
- "data-panel-pixel-size": b?.sizeUnit === "pixels" ? b?.originalPixelSize : null,
1487
+ ref: re,
1488
+ className: $e("panel", c),
1489
+ style: B,
1490
+ "data-panel-id": j.current,
1491
+ "data-panel-size": $,
1492
+ "data-panel-size-unit": y?.sizeUnit || "percentage",
1493
+ "data-panel-pixel-size": y?.sizeUnit === "pixels" ? y?.originalPixelSize : null,
1473
1494
  "data-panel-order": u,
1474
- "data-panel-collapsible": B,
1475
- "data-panel-collapse-start": O.collapseFromStart,
1476
- "data-panel-collapse-end": O.collapseFromEnd,
1477
- "data-panel-collapsed": b?.collapsed,
1495
+ "data-panel-collapsible": E,
1496
+ "data-panel-collapse-start": _.collapseFromStart,
1497
+ "data-panel-collapse-end": _.collapseFromEnd,
1498
+ "data-panel-collapsed": y?.collapsed,
1478
1499
  "aria-hidden": ce,
1479
1500
  children: [
1480
- /* @__PURE__ */ A("div", { style: T, children: f }),
1481
- y && /* @__PURE__ */ A(Tt, { panel: b, measuredPixelSize: ge, measuredPercentageSize: ne, containerAxisSize: N, direction: C })
1501
+ /* @__PURE__ */ I("div", { style: Z, children: p }),
1502
+ C && /* @__PURE__ */ I(_t, { panel: y, measuredPixelSize: Pe, measuredPercentageSize: ue, containerAxisSize: H, direction: b })
1482
1503
  ]
1483
1504
  }
1484
1505
  );
@@ -1519,104 +1540,104 @@ const ue = new Ge(Ve.INFO, "[resize-panels]"), Ce = (t) => t.map((e) => ({
1519
1540
  }))
1520
1541
  ), Wt = () => {
1521
1542
  const t = /* @__PURE__ */ new Set(), e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set();
1522
- let d = null, r = 0, l = !0, i = [], f = {
1543
+ let d = null, r = 0, c = !0, i = [], p = {
1523
1544
  ownerId: null,
1524
1545
  groups: i
1525
1546
  };
1526
1547
  const u = () => {
1527
- for (const S of t)
1528
- S();
1548
+ for (const x of t)
1549
+ x();
1529
1550
  }, z = () => {
1530
- l = !0, u();
1551
+ c = !0, u();
1531
1552
  }, s = () => {
1532
- const S = d;
1533
- if (S && n.has(S))
1553
+ const x = d;
1554
+ if (x && n.has(x))
1534
1555
  return !1;
1535
1556
  d = null;
1536
- const y = n.values().next();
1537
- return y.done || (d = y.value), S !== d;
1557
+ const C = n.values().next();
1558
+ return C.done || (d = C.value), x !== d;
1538
1559
  };
1539
1560
  return {
1540
- subscribe: (S) => (t.add(S), () => {
1541
- t.delete(S);
1561
+ subscribe: (x) => (t.add(x), () => {
1562
+ t.delete(x);
1542
1563
  }),
1543
- getSnapshot: () => (s() && (l = !0), l && (i = Array.from(e.values()).sort((y, m) => y.index - m.index).map(({ serializedPanels: y, serializedHandles: m, ...D }) => D), f = {
1564
+ getSnapshot: () => (s() && (c = !0), c && (i = Array.from(e.values()).sort((C, S) => C.index - S.index).map(({ serializedPanels: C, serializedHandles: S, ...D }) => D), p = {
1544
1565
  ownerId: d,
1545
1566
  groups: i
1546
- }, l = !1), f),
1547
- getOwnerId: () => (s() && (l = !0), d),
1548
- enableGroup: (S) => {
1549
- const y = n.size;
1550
- n.add(S), n.size !== y && s() && z();
1567
+ }, c = !1), p),
1568
+ getOwnerId: () => (s() && (c = !0), d),
1569
+ enableGroup: (x) => {
1570
+ const C = n.size;
1571
+ n.add(x), n.size !== C && s() && z();
1551
1572
  },
1552
- disableGroup: (S) => {
1553
- n.delete(S) && s() && z();
1573
+ disableGroup: (x) => {
1574
+ n.delete(x) && s() && z();
1554
1575
  },
1555
- updateGroup: (S, y) => {
1556
- const m = e.get(S), D = m?.index ?? r++, X = Ht(y.panels), J = Ut(y.handles), ae = m?.displayName !== y.displayName, W = m?.direction !== y.direction, O = m ? m.containerSize.width !== y.containerSize.width || m.containerSize.height !== y.containerSize.height : !0;
1557
- let B = m?.serializedPanels !== X;
1558
- if (!B && m)
1559
- if (m.panels.length !== y.panels.length)
1560
- B = !0;
1576
+ updateGroup: (x, C) => {
1577
+ const S = e.get(x), D = S?.index ?? r++, X = Ht(C.panels), re = Ut(C.handles), de = S?.displayName !== C.displayName, j = S?.direction !== C.direction, _ = S ? S.containerSize.width !== C.containerSize.width || S.containerSize.height !== C.containerSize.height : !0;
1578
+ let E = S?.serializedPanels !== X;
1579
+ if (!E && S)
1580
+ if (S.panels.length !== C.panels.length)
1581
+ E = !0;
1561
1582
  else
1562
- for (let j = 0; j < y.panels.length; j += 1) {
1563
- const b = m.panels[j], H = y.panels[j];
1564
- if (!(b && H)) {
1565
- B = !0;
1583
+ for (let Y = 0; Y < C.panels.length; Y += 1) {
1584
+ const y = S.panels[Y], N = C.panels[Y];
1585
+ if (!(y && N)) {
1586
+ E = !0;
1566
1587
  break;
1567
1588
  }
1568
- if (b.id !== H.id || b.size !== H.size || b.percentageSize !== H.percentageSize || b.collapsed !== H.collapsed || b.measuredPixelSize !== H.measuredPixelSize || b.measuredPercentageSize !== H.measuredPercentageSize) {
1569
- B = !0;
1589
+ if (y.id !== N.id || y.size !== N.size || y.percentageSize !== N.percentageSize || y.collapsed !== N.collapsed || y.measuredPixelSize !== N.measuredPixelSize || y.measuredPercentageSize !== N.measuredPercentageSize) {
1590
+ E = !0;
1570
1591
  break;
1571
1592
  }
1572
1593
  }
1573
- let ee = m?.serializedHandles !== J;
1574
- if (!ee && m)
1575
- if (m.handles.length !== y.handles.length)
1576
- ee = !0;
1594
+ let oe = S?.serializedHandles !== re;
1595
+ if (!oe && S)
1596
+ if (S.handles.length !== C.handles.length)
1597
+ oe = !0;
1577
1598
  else
1578
- for (let j = 0; j < y.handles.length; j += 1) {
1579
- const b = m.handles[j], H = y.handles[j];
1580
- if (!(b && H)) {
1581
- ee = !0;
1599
+ for (let Y = 0; Y < C.handles.length; Y += 1) {
1600
+ const y = S.handles[Y], N = C.handles[Y];
1601
+ if (!(y && N)) {
1602
+ oe = !0;
1582
1603
  break;
1583
1604
  }
1584
- if (b.id !== H.id || b.thickness !== H.thickness || b.visible !== H.visible || b.direction !== H.direction || b.startPanelId !== H.startPanelId || b.endPanelId !== H.endPanelId) {
1585
- ee = !0;
1605
+ if (y.id !== N.id || y.thickness !== N.thickness || y.visible !== N.visible || y.direction !== N.direction || y.startPanelId !== N.startPanelId || y.endPanelId !== N.endPanelId) {
1606
+ oe = !0;
1586
1607
  break;
1587
1608
  }
1588
1609
  }
1589
- if (!m && y.panels.length === 0 && y.handles.length === 0 || m && !ae && !W && !O && !B && !ee)
1610
+ if (!S && C.panels.length === 0 && C.handles.length === 0 || S && !de && !j && !_ && !E && !oe)
1590
1611
  return;
1591
- const k = y.panels.map((j) => ({ ...j })), $ = y.handles.map((j) => ({ ...j })), G = { ...y.containerSize };
1592
- e.set(S, {
1593
- groupId: S,
1594
- displayName: y.displayName,
1595
- direction: y.direction,
1596
- containerSize: G,
1597
- panels: k,
1598
- handles: $,
1612
+ const U = C.panels.map((Y) => ({ ...Y })), V = C.handles.map((Y) => ({ ...Y })), O = { ...C.containerSize };
1613
+ e.set(x, {
1614
+ groupId: x,
1615
+ displayName: C.displayName,
1616
+ direction: C.direction,
1617
+ containerSize: O,
1618
+ panels: U,
1619
+ handles: V,
1599
1620
  index: D,
1600
1621
  serializedPanels: X,
1601
- serializedHandles: J
1622
+ serializedHandles: re
1602
1623
  }), z();
1603
1624
  },
1604
- removeGroup: (S) => {
1605
- const y = e.delete(S), m = n.delete(S), D = s();
1606
- (y || m || D) && z();
1625
+ removeGroup: (x) => {
1626
+ const C = e.delete(x), S = n.delete(x), D = s();
1627
+ (C || S || D) && z();
1607
1628
  }
1608
1629
  };
1609
- }, Ee = Wt(), $t = () => ft(Ee.subscribe, Ee.getOwnerId, Ee.getOwnerId), jt = () => ft(Ee.subscribe, Ee.getSnapshot, Ee.getSnapshot), Vt = (t) => {
1610
- Ee.enableGroup(t);
1611
- }, st = (t) => {
1612
- Ee.disableGroup(t);
1630
+ }, Fe = Wt(), $t = () => ht(Fe.subscribe, Fe.getOwnerId, Fe.getOwnerId), jt = () => ht(Fe.subscribe, Fe.getSnapshot, Fe.getSnapshot), Vt = (t) => {
1631
+ Fe.enableGroup(t);
1632
+ }, ct = (t) => {
1633
+ Fe.disableGroup(t);
1613
1634
  }, Yt = (t, e) => {
1614
- Ee.updateGroup(t, e);
1615
- }, at = (t) => {
1616
- Ee.removeGroup(t);
1635
+ Fe.updateGroup(t, e);
1636
+ }, dt = (t) => {
1637
+ Fe.removeGroup(t);
1617
1638
  };
1618
- let lt = 0;
1619
- const Zt = () => (lt += 1, `panel-group-${lt}`), De = (t, e) => typeof t != "number" || !Number.isFinite(t) ? "—" : `${(t < 0 ? 0 : t).toFixed(8)}${e}`, Xt = {
1639
+ let ut = 0;
1640
+ const Zt = () => (ut += 1, `panel-group-${ut}`), _e = (t, e) => typeof t != "number" || !Number.isFinite(t) ? "—" : `${(t < 0 ? 0 : t).toFixed(8)}${e}`, Xt = {
1620
1641
  position: "fixed",
1621
1642
  left: "50%",
1622
1643
  bottom: "20px",
@@ -1673,7 +1694,7 @@ const Zt = () => (lt += 1, `panel-group-${lt}`), De = (t, e) => typeof t != "num
1673
1694
  display: "flex",
1674
1695
  flexDirection: "column",
1675
1696
  gap: "4px"
1676
- }, ct = {
1697
+ }, ft = {
1677
1698
  display: "flex",
1678
1699
  justifyContent: "space-between",
1679
1700
  alignItems: "center",
@@ -1694,95 +1715,95 @@ const Zt = () => (lt += 1, `panel-group-${lt}`), De = (t, e) => typeof t != "num
1694
1715
  }, ni = (t, e) => {
1695
1716
  let n = !1;
1696
1717
  const d = t.map((r) => {
1697
- const l = e[r.id];
1698
- return !l || r.measuredPixelSize === l.pixelSize && r.measuredPercentageSize === l.percentageSize ? r : (n = !0, {
1718
+ const c = e[r.id];
1719
+ return !c || r.measuredPixelSize === c.pixelSize && r.measuredPercentageSize === c.percentageSize ? r : (n = !0, {
1699
1720
  ...r,
1700
- measuredPixelSize: l.pixelSize,
1701
- measuredPercentageSize: l.percentageSize
1721
+ measuredPixelSize: c.pixelSize,
1722
+ measuredPercentageSize: c.percentageSize
1702
1723
  });
1703
1724
  });
1704
1725
  return n ? d : t;
1705
- }, dt = (t, e, n) => {
1706
- const d = Le(t, "horizontal"), r = Le(t, "vertical"), l = t.getBoundingClientRect(), i = d.inner > 0 ? d.inner : e ?? l.width, f = r.inner > 0 ? r.inner : n ?? l.height;
1707
- return { width: i, height: f };
1726
+ }, pt = (t, e, n) => {
1727
+ const d = Oe(t, "horizontal"), r = Oe(t, "vertical"), c = t.getBoundingClientRect(), i = d.inner > 0 ? d.inner : e ?? c.width, p = r.inner > 0 ? r.inner : n ?? c.height;
1728
+ return { width: i, height: p };
1708
1729
  }, fi = (t) => {
1709
- const { id: e, className: n, style: d, children: r, direction: l } = t, { groupRef: i, contextValue: f, groupStyle: u } = Ot(t), [z, s] = ye({ width: 0, height: 0 }), a = f.layoutConstraintViolation, o = !!a, x = te(() => {
1730
+ const { id: e, className: n, style: d, children: r, direction: c } = t, { groupRef: i, contextValue: p, groupStyle: u } = Ot(t), [z, s] = Me({ width: 0, height: 0 }), a = p.layoutConstraintViolation, o = !!a, h = ae(() => {
1710
1731
  if (!a)
1711
1732
  return null;
1712
- const { summary: k, detail: $ } = ri(a);
1713
- return /* @__PURE__ */ le(
1733
+ const { summary: U, detail: V } = ri(a);
1734
+ return /* @__PURE__ */ fe(
1714
1735
  "div",
1715
1736
  {
1716
1737
  className: "flex w-full flex-1 flex-col items-center justify-center gap-2 rounded-lg border border-slate-300 border-dashed bg-slate-100/70 px-6 py-8 text-center text-slate-600 text-sm dark:border-slate-600 dark:bg-slate-800/50 dark:text-slate-200",
1717
1738
  "data-panel-group-placeholder": "constraint-violation",
1718
1739
  children: [
1719
- /* @__PURE__ */ A("span", { children: k }),
1720
- /* @__PURE__ */ A("span", { className: "text-slate-500 text-xs dark:text-slate-400", children: $ })
1740
+ /* @__PURE__ */ I("span", { children: U }),
1741
+ /* @__PURE__ */ I("span", { className: "text-slate-500 text-xs dark:text-slate-400", children: V })
1721
1742
  ]
1722
1743
  }
1723
1744
  );
1724
- }, [a]), P = ie(e ?? Zt()).current, v = e ?? P, S = f.showDebugInfo && f.panels.length > 0, y = S ? f.panels : [], m = S ? f.panelMeasurements : {}, D = te(() => {
1725
- if (!S)
1745
+ }, [a]), m = J(e ?? Zt()).current, v = e ?? m, x = p.showDebugInfo && p.panels.length > 0, C = x ? p.panels : [], S = x ? p.panelMeasurements : {}, D = ae(() => {
1746
+ if (!x)
1726
1747
  return [];
1727
- const k = Object.values(f.handleMeasurements);
1728
- return k.length <= 1 ? k : k.slice().sort(($, G) => $.id.localeCompare(G.id));
1729
- }, [f.handleMeasurements, S]), X = f.containerSize, J = z.width > 0 ? z.width : X.width, ae = z.height > 0 ? z.height : X.height, W = $t(), O = S && W === P;
1730
- je(() => {
1731
- if (!S) {
1748
+ const U = Object.values(p.handleMeasurements);
1749
+ return U.length <= 1 ? U : U.slice().sort((V, O) => V.id.localeCompare(O.id));
1750
+ }, [p.handleMeasurements, x]), X = p.containerSize, re = z.width > 0 ? z.width : X.width, de = z.height > 0 ? z.height : X.height, j = $t(), _ = x && j === m;
1751
+ Xe(() => {
1752
+ if (!x) {
1732
1753
  s({ width: 0, height: 0 });
1733
1754
  return;
1734
1755
  }
1735
1756
  if (typeof window > "u" || typeof ResizeObserver > "u")
1736
1757
  return;
1737
- const k = i.current;
1738
- if (!k)
1758
+ const U = i.current;
1759
+ if (!U)
1739
1760
  return;
1740
- const $ = (j) => {
1741
- s((b) => b.width === j.width && b.height === j.height ? b : j);
1742
- }, G = new ResizeObserver((j) => {
1743
- for (const b of j) {
1744
- if (b.target !== k)
1761
+ const V = (Y) => {
1762
+ s((y) => y.width === Y.width && y.height === Y.height ? y : Y);
1763
+ }, O = new ResizeObserver((Y) => {
1764
+ for (const y of Y) {
1765
+ if (y.target !== U)
1745
1766
  continue;
1746
- const H = dt(k, b.contentRect.width, b.contentRect.height);
1747
- $(H);
1767
+ const N = pt(U, y.contentRect.width, y.contentRect.height);
1768
+ V(N);
1748
1769
  }
1749
1770
  });
1750
- return G.observe(k), $(dt(k)), () => {
1751
- G.disconnect();
1771
+ return O.observe(U), V(pt(U)), () => {
1772
+ O.disconnect();
1752
1773
  };
1753
- }, [i, S]);
1754
- const B = te(() => ni(y, m), [y, m]);
1755
- re(() => {
1756
- if (!S) {
1757
- st(P), at(P);
1774
+ }, [i, x]);
1775
+ const E = ae(() => ni(C, S), [C, S]);
1776
+ se(() => {
1777
+ if (!x) {
1778
+ ct(m), dt(m);
1758
1779
  return;
1759
1780
  }
1760
- return Vt(P), () => {
1761
- st(P), at(P);
1781
+ return Vt(m), () => {
1782
+ ct(m), dt(m);
1762
1783
  };
1763
- }, [S, P]), re(() => {
1764
- S && Yt(P, {
1784
+ }, [x, m]), se(() => {
1785
+ x && Yt(m, {
1765
1786
  displayName: v,
1766
- direction: l,
1787
+ direction: c,
1767
1788
  containerSize: {
1768
- width: J,
1769
- height: ae
1789
+ width: re,
1790
+ height: de
1770
1791
  },
1771
- panels: B,
1792
+ panels: E,
1772
1793
  handles: D
1773
1794
  });
1774
- }, [S, P, v, l, J, ae, B, D]);
1775
- const ee = te(() => {
1776
- const k = {
1795
+ }, [x, m, v, c, re, de, E, D]);
1796
+ const oe = ae(() => {
1797
+ const U = {
1777
1798
  ...u,
1778
1799
  ...d
1779
1800
  };
1780
- return k.position || (k.position = "relative"), k;
1801
+ return U.position || (U.position = "relative"), U;
1781
1802
  }, [u, d]);
1782
- return /* @__PURE__ */ le(pt.Provider, { value: f, children: [
1783
- /* @__PURE__ */ le("div", { ref: i, className: ke("panel-group", l === "horizontal" ? "flex-row" : "flex-col", n), style: ee, "data-panel-group-id": e, "data-panel-group-direction": l, children: [
1803
+ return /* @__PURE__ */ fe(gt.Provider, { value: p, children: [
1804
+ /* @__PURE__ */ fe("div", { ref: i, className: $e("panel-group", c === "horizontal" ? "flex-row" : "flex-col", n), style: oe, "data-panel-group-id": e, "data-panel-group-direction": c, children: [
1784
1805
  r,
1785
- o && x ? /* @__PURE__ */ A(
1806
+ o && h ? /* @__PURE__ */ I(
1786
1807
  "div",
1787
1808
  {
1788
1809
  className: "pointer-events-auto",
@@ -1797,17 +1818,17 @@ const Zt = () => (lt += 1, `panel-group-${lt}`), De = (t, e) => typeof t != "num
1797
1818
  backgroundColor: "rgba(248, 250, 252, 0.82)",
1798
1819
  backdropFilter: "blur(2px)"
1799
1820
  },
1800
- children: x
1821
+ children: h
1801
1822
  }
1802
1823
  ) : null
1803
1824
  ] }),
1804
- O && /* @__PURE__ */ A(oi, {})
1825
+ _ && /* @__PURE__ */ I(oi, {})
1805
1826
  ] });
1806
1827
  }, oi = () => {
1807
- const e = jt().groups, [n, d] = ye(!0);
1828
+ const e = jt().groups, [n, d] = Me(!0);
1808
1829
  if (e.length === 0 || typeof document > "u")
1809
1830
  return null;
1810
- const r = e.reduce((u, z) => u + z.panels.length, 0), l = e.reduce((u, z) => u + (z.handles?.length ?? 0), 0), i = () => d((u) => !u), f = /* @__PURE__ */ le(
1831
+ const r = e.reduce((u, z) => u + z.panels.length, 0), c = e.reduce((u, z) => u + (z.handles?.length ?? 0), 0), i = () => d((u) => !u), p = /* @__PURE__ */ fe(
1811
1832
  "div",
1812
1833
  {
1813
1834
  style: {
@@ -1817,7 +1838,7 @@ const Zt = () => (lt += 1, `panel-group-${lt}`), De = (t, e) => typeof t != "num
1817
1838
  transition: "max-height 0.24s ease, padding 0.24s ease"
1818
1839
  },
1819
1840
  children: [
1820
- /* @__PURE__ */ le(
1841
+ /* @__PURE__ */ fe(
1821
1842
  "div",
1822
1843
  {
1823
1844
  style: {
@@ -1825,8 +1846,8 @@ const Zt = () => (lt += 1, `panel-group-${lt}`), De = (t, e) => typeof t != "num
1825
1846
  marginBottom: n ? 0 : "12px"
1826
1847
  },
1827
1848
  children: [
1828
- /* @__PURE__ */ le("div", { style: Jt, children: [
1829
- /* @__PURE__ */ A(
1849
+ /* @__PURE__ */ fe("div", { style: Jt, children: [
1850
+ /* @__PURE__ */ I(
1830
1851
  "span",
1831
1852
  {
1832
1853
  style: {
@@ -1837,16 +1858,16 @@ const Zt = () => (lt += 1, `panel-group-${lt}`), De = (t, e) => typeof t != "num
1837
1858
  children: "Panel Overview"
1838
1859
  }
1839
1860
  ),
1840
- /* @__PURE__ */ le("span", { style: { color: "#cbd5f5" }, children: [
1861
+ /* @__PURE__ */ fe("span", { style: { color: "#cbd5f5" }, children: [
1841
1862
  "groups: ",
1842
1863
  e.length,
1843
1864
  " / panels: ",
1844
1865
  r,
1845
1866
  " / resizers: ",
1846
- l
1867
+ c
1847
1868
  ] })
1848
1869
  ] }),
1849
- /* @__PURE__ */ A(
1870
+ /* @__PURE__ */ I(
1850
1871
  "button",
1851
1872
  {
1852
1873
  type: "button",
@@ -1862,7 +1883,7 @@ const Zt = () => (lt += 1, `panel-group-${lt}`), De = (t, e) => typeof t != "num
1862
1883
  ]
1863
1884
  }
1864
1885
  ),
1865
- !n && /* @__PURE__ */ A(
1886
+ !n && /* @__PURE__ */ I(
1866
1887
  "div",
1867
1888
  {
1868
1889
  style: {
@@ -1875,18 +1896,18 @@ const Zt = () => (lt += 1, `panel-group-${lt}`), De = (t, e) => typeof t != "num
1875
1896
  },
1876
1897
  children: e.map((u, z) => {
1877
1898
  const s = u.direction === "horizontal" ? u.containerSize.width : u.containerSize.height;
1878
- return /* @__PURE__ */ le("div", { style: Qt, children: [
1879
- /* @__PURE__ */ le(
1899
+ return /* @__PURE__ */ fe("div", { style: Qt, children: [
1900
+ /* @__PURE__ */ fe(
1880
1901
  "div",
1881
1902
  {
1882
1903
  style: {
1883
- ...ct,
1904
+ ...ft,
1884
1905
  flexWrap: "wrap",
1885
1906
  gap: "10px",
1886
1907
  color: "#dbeafe"
1887
1908
  },
1888
1909
  children: [
1889
- /* @__PURE__ */ le(
1910
+ /* @__PURE__ */ fe(
1890
1911
  "span",
1891
1912
  {
1892
1913
  style: {
@@ -1903,18 +1924,18 @@ const Zt = () => (lt += 1, `panel-group-${lt}`), De = (t, e) => typeof t != "num
1903
1924
  ]
1904
1925
  }
1905
1926
  ),
1906
- /* @__PURE__ */ le("span", { children: [
1927
+ /* @__PURE__ */ fe("span", { children: [
1907
1928
  "direction: ",
1908
1929
  u.direction,
1909
1930
  " / container: ",
1910
- De(u.containerSize.width, "px"),
1931
+ _e(u.containerSize.width, "px"),
1911
1932
  " × ",
1912
- De(u.containerSize.height, "px")
1933
+ _e(u.containerSize.height, "px")
1913
1934
  ] })
1914
1935
  ]
1915
1936
  }
1916
1937
  ),
1917
- /* @__PURE__ */ A(
1938
+ /* @__PURE__ */ I(
1918
1939
  "div",
1919
1940
  {
1920
1941
  style: {
@@ -1923,43 +1944,43 @@ const Zt = () => (lt += 1, `panel-group-${lt}`), De = (t, e) => typeof t != "num
1923
1944
  gap: "10px"
1924
1945
  },
1925
1946
  children: u.panels.map((a, o) => {
1926
- const x = a.measuredPixelSize ?? a.size, C = a.size, P = De(C, "px"), v = a.percentageSize ?? (s > 0 ? a.size / s * 100 : void 0), S = a.measuredPercentageSize !== void 0 ? a.measuredPercentageSize : s > 0 ? x / s * 100 : void 0, y = a.collapsed || x <= gt, m = a.collapsed ? "collapsed" : y ? "hidden" : "visible", D = De(v, "%"), X = De(S, "%"), J = De(x, "px");
1927
- return /* @__PURE__ */ le("div", { style: ei, children: [
1928
- /* @__PURE__ */ le("div", { style: ct, children: [
1929
- /* @__PURE__ */ A("span", { style: { flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis" }, children: a.id }),
1930
- /* @__PURE__ */ A(
1947
+ const h = a.measuredPixelSize ?? a.size, b = a.size, m = _e(b, "px"), v = a.percentageSize ?? (s > 0 ? a.size / s * 100 : void 0), x = a.measuredPercentageSize !== void 0 ? a.measuredPercentageSize : s > 0 ? h / s * 100 : void 0, C = a.collapsed || h <= St, S = a.collapsed ? "collapsed" : C ? "hidden" : "visible", D = _e(v, "%"), X = _e(x, "%"), re = _e(h, "px");
1948
+ return /* @__PURE__ */ fe("div", { style: ei, children: [
1949
+ /* @__PURE__ */ fe("div", { style: ft, children: [
1950
+ /* @__PURE__ */ I("span", { style: { flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis" }, children: a.id }),
1951
+ /* @__PURE__ */ I(
1931
1952
  "span",
1932
1953
  {
1933
1954
  style: {
1934
1955
  ...ii,
1935
- backgroundColor: a.collapsed ? "rgba(251, 113, 133, 0.25)" : y ? "rgba(250, 204, 21, 0.25)" : "rgba(74, 222, 128, 0.25)",
1936
- color: a.collapsed ? "#fecdd3" : y ? "#fef08a" : "#bbf7d0"
1956
+ backgroundColor: a.collapsed ? "rgba(251, 113, 133, 0.25)" : C ? "rgba(250, 204, 21, 0.25)" : "rgba(74, 222, 128, 0.25)",
1957
+ color: a.collapsed ? "#fecdd3" : C ? "#fef08a" : "#bbf7d0"
1937
1958
  },
1938
- children: m
1959
+ children: S
1939
1960
  }
1940
1961
  )
1941
1962
  ] }),
1942
- /* @__PURE__ */ le("div", { style: ti, children: [
1943
- /* @__PURE__ */ A("span", { children: "size (state):" }),
1944
- /* @__PURE__ */ A("span", { children: P }),
1945
- /* @__PURE__ */ A("span", { children: "size (measured):" }),
1946
- /* @__PURE__ */ A("span", { children: J }),
1947
- /* @__PURE__ */ A("span", { children: "percentage (state):" }),
1948
- /* @__PURE__ */ A("span", { children: D }),
1949
- /* @__PURE__ */ A("span", { children: "percentage (measured):" }),
1950
- /* @__PURE__ */ A("span", { children: X }),
1951
- /* @__PURE__ */ A("span", { children: "unit:" }),
1952
- /* @__PURE__ */ A("span", { children: a.sizeUnit }),
1953
- /* @__PURE__ */ A("span", { children: "min:" }),
1954
- /* @__PURE__ */ A("span", { children: a.minSize !== void 0 ? JSON.stringify(a.minSize) : "—" }),
1955
- /* @__PURE__ */ A("span", { children: "auto min:" }),
1956
- /* @__PURE__ */ A("span", { children: a.autoMinSize !== void 0 ? JSON.stringify(a.autoMinSize) : "—" }),
1957
- /* @__PURE__ */ A("span", { children: "max:" }),
1958
- /* @__PURE__ */ A("span", { children: a.maxSize !== void 0 ? JSON.stringify(a.maxSize) : "—" }),
1959
- /* @__PURE__ */ A("span", { children: "priority:" }),
1960
- /* @__PURE__ */ A("span", { children: a.pixelAdjustPriority ?? "—" }),
1961
- /* @__PURE__ */ A("span", { children: "flex priority:" }),
1962
- /* @__PURE__ */ A("span", { children: a.flexAdjustPriority ?? "—" })
1963
+ /* @__PURE__ */ fe("div", { style: ti, children: [
1964
+ /* @__PURE__ */ I("span", { children: "size (state):" }),
1965
+ /* @__PURE__ */ I("span", { children: m }),
1966
+ /* @__PURE__ */ I("span", { children: "size (measured):" }),
1967
+ /* @__PURE__ */ I("span", { children: re }),
1968
+ /* @__PURE__ */ I("span", { children: "percentage (state):" }),
1969
+ /* @__PURE__ */ I("span", { children: D }),
1970
+ /* @__PURE__ */ I("span", { children: "percentage (measured):" }),
1971
+ /* @__PURE__ */ I("span", { children: X }),
1972
+ /* @__PURE__ */ I("span", { children: "unit:" }),
1973
+ /* @__PURE__ */ I("span", { children: a.sizeUnit }),
1974
+ /* @__PURE__ */ I("span", { children: "min:" }),
1975
+ /* @__PURE__ */ I("span", { children: a.minSize !== void 0 ? JSON.stringify(a.minSize) : "—" }),
1976
+ /* @__PURE__ */ I("span", { children: "auto min:" }),
1977
+ /* @__PURE__ */ I("span", { children: a.autoMinSize !== void 0 ? JSON.stringify(a.autoMinSize) : "—" }),
1978
+ /* @__PURE__ */ I("span", { children: "max:" }),
1979
+ /* @__PURE__ */ I("span", { children: a.maxSize !== void 0 ? JSON.stringify(a.maxSize) : "—" }),
1980
+ /* @__PURE__ */ I("span", { children: "priority:" }),
1981
+ /* @__PURE__ */ I("span", { children: a.pixelAdjustPriority ?? "—" }),
1982
+ /* @__PURE__ */ I("span", { children: "flex priority:" }),
1983
+ /* @__PURE__ */ I("span", { children: a.flexAdjustPriority ?? "—" })
1963
1984
  ] })
1964
1985
  ] }, a.id || o);
1965
1986
  })
@@ -1972,287 +1993,287 @@ const Zt = () => (lt += 1, `panel-group-${lt}`), De = (t, e) => typeof t != "num
1972
1993
  ]
1973
1994
  }
1974
1995
  );
1975
- return Et(f, document.body);
1976
- }, pi = Ke(({ id: t, disabled: e = !1, className: n, style: d, children: r, onDragging: l }) => {
1977
- const { direction: i, resizePanels: f, getPanel: u, collapsePanel: z, expandPanel: s, panels: a, reportHandleMeasurement: o, containerSize: x, layoutConstraintViolation: C } = Qe(), [P, v] = ye(!1), S = ie(null), y = ie(null), m = ie(""), D = ie(""), [X, J] = ye({ left: null, right: null }), ae = ut(), W = ie(t ?? `resize-handle-${ae}`), O = ie(null), B = t ?? W.current, ee = !!C, k = e || ee;
1978
- re(() => {
1979
- if (S.current) {
1980
- const p = S.current.parentElement;
1981
- if (p) {
1982
- y.current = p;
1983
- const E = Array.from(p.children), R = S.current, _ = E.indexOf(R);
1984
- if (_ > 0 && _ < E.length - 1) {
1985
- let V = null, F = null;
1986
- for (let N = _ - 1; N >= 0; N -= 1) {
1987
- const T = E[N];
1988
- if (T.dataset.panelId) {
1989
- V = T;
1996
+ return Et(p, document.body);
1997
+ }, pi = it(({ id: t, disabled: e = !1, className: n, style: d, children: r, onDragging: c }) => {
1998
+ const { direction: i, resizePanels: p, getPanel: u, collapsePanel: z, expandPanel: s, panels: a, reportHandleMeasurement: o, containerSize: h, layoutConstraintViolation: b } = rt(), [m, v] = Me(!1), x = J(null), C = J(null), S = J(""), D = J(""), [X, re] = Me({ left: null, right: null }), de = zt(), j = J(t ?? `resize-handle-${de}`), _ = J(null), E = t ?? j.current, oe = !!b, U = e || oe;
1999
+ se(() => {
2000
+ if (x.current) {
2001
+ const P = x.current.parentElement;
2002
+ if (P) {
2003
+ C.current = P;
2004
+ const $ = Array.from(P.children), l = x.current, g = $.indexOf(l);
2005
+ if (g > 0 && g < $.length - 1) {
2006
+ let w = null, M = null;
2007
+ for (let A = g - 1; A >= 0; A -= 1) {
2008
+ const B = $[A];
2009
+ if (B.dataset.panelId) {
2010
+ w = B;
1990
2011
  break;
1991
2012
  }
1992
2013
  }
1993
- for (let N = _ + 1; N < E.length; N += 1) {
1994
- const T = E[N];
1995
- if (T.dataset.panelId) {
1996
- F = T;
2014
+ for (let A = g + 1; A < $.length; A += 1) {
2015
+ const B = $[A];
2016
+ if (B.dataset.panelId) {
2017
+ M = B;
1997
2018
  break;
1998
2019
  }
1999
2020
  }
2000
- m.current = V?.dataset.panelId || "", D.current = F?.dataset.panelId || "", J({
2001
- left: m.current || null,
2021
+ S.current = w?.dataset.panelId || "", D.current = M?.dataset.panelId || "", re({
2022
+ left: S.current || null,
2002
2023
  right: D.current || null
2003
2024
  });
2004
2025
  }
2005
2026
  }
2006
2027
  }
2007
- }, []), re(() => {
2008
- if (B === W.current)
2028
+ }, []), se(() => {
2029
+ if (E === j.current)
2009
2030
  return;
2010
- const p = W.current;
2011
- W.current = B, O.current = null, p !== B && o(p, null);
2012
- }, [o, B]), re(() => {
2013
- const p = W.current;
2031
+ const P = j.current;
2032
+ j.current = E, _.current = null, P !== E && o(P, null);
2033
+ }, [o, E]), se(() => {
2034
+ const P = j.current;
2014
2035
  return () => {
2015
- o(p, null);
2036
+ o(P, null);
2016
2037
  };
2017
2038
  }, [o]);
2018
- const $ = pe(
2019
- (p) => {
2020
- if (k || !y.current) return;
2021
- p.preventDefault(), p.stopPropagation();
2022
- const E = y.current, { inner: R } = Le(E, i), _ = { x: p.clientX, y: p.clientY }, V = u(m.current), F = u(D.current);
2023
- if (!(V && F)) return;
2024
- const N = V.size, T = F.size;
2025
- let w = 0;
2026
- const L = Rt;
2027
- v(!0), l?.(!0), p.currentTarget.setPointerCapture(p.pointerId);
2028
- const K = (Y) => {
2029
- if (!S.current) return;
2030
- Y.preventDefault(), Y.stopPropagation();
2031
- const se = performance.now();
2032
- if (se - w < L) return;
2033
- w = se;
2034
- const c = i === "horizontal" ? Y.clientX - _.x : Y.clientY - _.y;
2035
- if (c === 0)
2039
+ const V = Se(
2040
+ (P) => {
2041
+ if (U || !C.current) return;
2042
+ P.preventDefault(), P.stopPropagation();
2043
+ const $ = C.current, { inner: l } = Oe($, i), g = { x: P.clientX, y: P.clientY }, w = u(S.current), M = u(D.current);
2044
+ if (!(w && M)) return;
2045
+ const A = w.size, B = M.size;
2046
+ let H = 0;
2047
+ const Z = Rt;
2048
+ v(!0), c?.(!0), P.currentTarget.setPointerCapture(P.pointerId);
2049
+ const T = (F) => {
2050
+ if (!x.current) return;
2051
+ F.preventDefault(), F.stopPropagation();
2052
+ const k = performance.now();
2053
+ if (k - H < Z) return;
2054
+ H = k;
2055
+ const Q = i === "horizontal" ? F.clientX - g.x : F.clientY - g.y;
2056
+ if (Q === 0)
2036
2057
  return;
2037
- const I = N + c, U = T - c, Z = u(m.current), Q = u(D.current);
2038
- if (Z && Q && m.current && D.current) {
2039
- const Se = q(Z.minSize, 0, R), Be = q(Q.minSize, 0, R), be = Se, Re = Be, Ie = Math.min(R * ht, xt), Me = Math.min(R * It, Ft), Fe = Q.collapseFromStart, Pt = Q.collapsedByDirection ?? "start";
2040
- if (Fe && !Q.collapsed && U <= Math.max(Be * 0.3, Ie)) {
2058
+ const ne = A + Q, K = B - Q, W = u(S.current), q = u(D.current);
2059
+ if (W && q && S.current && D.current) {
2060
+ const f = te(W.minSize, 0, l), L = te(q.minSize, 0, l), ee = f, ie = L, xe = Math.min(l * mt, Pt), Ne = Math.min(l * It, Ft), ke = q.collapseFromStart, Ae = q.collapsedByDirection ?? "start";
2061
+ if (ke && !q.collapsed && K <= Math.max(L * 0.3, xe)) {
2041
2062
  z(D.current, "start");
2042
2063
  return;
2043
2064
  }
2044
- const bt = Z.collapseFromEnd, Ct = Z.collapsedByDirection ?? "end";
2045
- if (bt && !Z.collapsed && I <= Math.max(Se * 0.3, Ie)) {
2046
- z(m.current, "end");
2065
+ const Ge = W.collapseFromEnd, Te = W.collapsedByDirection ?? "end";
2066
+ if (Ge && !W.collapsed && ne <= Math.max(f * 0.3, xe)) {
2067
+ z(S.current, "end");
2047
2068
  return;
2048
2069
  }
2049
- if (Q.collapsed && U > Math.max(Be * 0.3, Me)) {
2050
- s(D.current, Pt, U);
2070
+ if (q.collapsed && K > Math.max(L * 0.3, Ne)) {
2071
+ s(D.current, Ae, K);
2051
2072
  return;
2052
2073
  }
2053
- if (Z.collapsed && I > Math.max(Se * 0.3, Me)) {
2054
- s(m.current, Ct, I);
2074
+ if (W.collapsed && ne > Math.max(f * 0.3, Ne)) {
2075
+ s(S.current, Te, ne);
2055
2076
  return;
2056
2077
  }
2057
- if (R > 0) {
2058
- const et = Z.size + Q.size, He = qe(R);
2059
- let Ye = !1;
2060
- if (be <= He && I <= He && N !== 0) {
2061
- const Oe = Math.max(0, et - 0);
2062
- Oe >= Re && (f(m.current, D.current, 0, Oe), Ye = !0);
2063
- } else if (Re <= He && U <= He && T !== 0) {
2064
- const Oe = Math.max(0, et - 0);
2065
- Oe >= be && (f(m.current, D.current, Oe, 0), Ye = !0);
2078
+ if (l > 0) {
2079
+ const we = W.size + q.size, Ie = et(l);
2080
+ let Je = !1;
2081
+ if (ee <= Ie && ne <= Ie && A !== 0) {
2082
+ const He = Math.max(0, we - 0);
2083
+ He >= ie && (p(S.current, D.current, 0, He), Je = !0);
2084
+ } else if (ie <= Ie && K <= Ie && B !== 0) {
2085
+ const He = Math.max(0, we - 0);
2086
+ He >= ee && (p(S.current, D.current, He, 0), Je = !0);
2066
2087
  }
2067
- if (Ye)
2088
+ if (Je)
2068
2089
  return;
2069
2090
  }
2070
- if (Z.collapsed || Q.collapsed)
2091
+ if (W.collapsed || q.collapsed)
2071
2092
  return;
2072
- f(m.current, D.current, I, U);
2093
+ p(S.current, D.current, ne, K);
2073
2094
  }
2074
- }, oe = () => {
2075
- v(!1), l?.(!1), document.removeEventListener("pointermove", K), document.removeEventListener("pointerup", oe);
2095
+ }, R = () => {
2096
+ v(!1), c?.(!1), document.removeEventListener("pointermove", T), document.removeEventListener("pointerup", R);
2076
2097
  };
2077
- document.addEventListener("pointermove", K), document.addEventListener("pointerup", oe);
2098
+ document.addEventListener("pointermove", T), document.addEventListener("pointerup", R);
2078
2099
  },
2079
- [k, i, f, u, z, s, l]
2080
- ), G = i === "horizontal", b = ke(
2100
+ [U, i, p, u, z, s, c]
2101
+ ), O = i === "horizontal", y = $e(
2081
2102
  "group absolute z-20 flex select-none items-center justify-center border-none bg-transparent transition-colors duration-150 overflow-visible",
2082
- G ? "cursor-col-resize" : "cursor-row-resize",
2083
- G ? "h-full" : "w-full",
2084
- !k && "hover:bg-gray-200/70 dark:hover:bg-gray-700/70",
2085
- !k && "active:bg-blue-300/60 dark:active:bg-blue-700/60",
2086
- P && "bg-blue-200/80 dark:bg-blue-800/60",
2087
- k && "cursor-not-allowed opacity-50",
2103
+ O ? "cursor-col-resize" : "cursor-row-resize",
2104
+ O ? "h-full" : "w-full",
2105
+ !U && "hover:bg-gray-200/70 dark:hover:bg-gray-700/70",
2106
+ !U && "active:bg-blue-300/60 dark:active:bg-blue-700/60",
2107
+ m && "bg-blue-200/80 dark:bg-blue-800/60",
2108
+ U && "cursor-not-allowed opacity-50",
2088
2109
  "focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-50",
2089
2110
  n
2090
- ), H = te(() => {
2091
- const p = (E) => {
2092
- if (!E)
2111
+ ), N = ae(() => {
2112
+ const P = ($) => {
2113
+ if (!$)
2093
2114
  return -1;
2094
- for (let R = 0; R < a.length; R += 1)
2095
- if (a[R].id === E)
2096
- return R;
2115
+ for (let l = 0; l < a.length; l += 1)
2116
+ if (a[l].id === $)
2117
+ return l;
2097
2118
  return -1;
2098
2119
  };
2099
2120
  return {
2100
- left: p(X.left),
2101
- right: p(X.right)
2121
+ left: P(X.left),
2122
+ right: P(X.right)
2102
2123
  };
2103
- }, [X.left, X.right, a]), he = G ? x.width : x.height, ce = te(() => {
2104
- const p = (E, R) => {
2105
- if (E > R)
2124
+ }, [X.left, X.right, a]), be = O ? h.width : h.height, ce = ae(() => {
2125
+ const P = ($, l) => {
2126
+ if ($ > l)
2106
2127
  return 0;
2107
- let _ = 0;
2108
- for (let V = E; V <= R; V += 1) {
2109
- const F = a[V];
2110
- if (!F)
2128
+ let g = 0;
2129
+ for (let w = $; w <= l; w += 1) {
2130
+ const M = a[w];
2131
+ if (!M)
2111
2132
  continue;
2112
- const N = F.size ?? 0, T = Math.max(0, N);
2113
- _ += F.collapsed ? 0 : T;
2133
+ const A = M.size ?? 0, B = Math.max(0, A);
2134
+ g += M.collapsed ? 0 : B;
2114
2135
  }
2115
- return _;
2136
+ return g;
2116
2137
  };
2117
- return H.left >= 0 ? p(0, H.left) : H.right > 0 ? p(0, H.right - 1) : 0;
2118
- }, [H.left, H.right, a]), ge = te(() => !Number.isFinite(ce) || ce < 0 ? 0 : he > 0 && ce > he ? he : ce, [ce, he]), Pe = te(() => {
2119
- const p = {
2138
+ return N.left >= 0 ? P(0, N.left) : N.right > 0 ? P(0, N.right - 1) : 0;
2139
+ }, [N.left, N.right, a]), Pe = ae(() => !Number.isFinite(ce) || ce < 0 ? 0 : be > 0 && ce > be ? be : ce, [ce, be]), he = ae(() => {
2140
+ const P = {
2120
2141
  position: "absolute",
2121
2142
  zIndex: 20,
2122
2143
  touchAction: "none"
2123
2144
  };
2124
- return G ? (p.top = 0, p.left = `${ge}px`, p.transform = "translateX(-50%)", p.width = `${tt}px`, p.height = "100%") : (p.left = 0, p.top = `${ge}px`, p.transform = "translateY(-50%)", p.height = `${tt}px`, p.width = "100%"), p;
2125
- }, [ge, G]), ne = te(() => {
2126
- const p = qe(he), E = (L) => {
2127
- if (L < 0 || L >= a.length)
2145
+ return O ? (P.top = 0, P.left = `${Pe}px`, P.transform = "translateX(-50%)", P.width = `${nt}px`, P.height = "100%") : (P.left = 0, P.top = `${Pe}px`, P.transform = "translateY(-50%)", P.height = `${nt}px`, P.width = "100%"), P;
2146
+ }, [Pe, O]), ue = ae(() => {
2147
+ const P = et(be), $ = (Z) => {
2148
+ if (Z < 0 || Z >= a.length)
2128
2149
  return !1;
2129
- const K = a[L];
2130
- return K ? K.collapsed ? !0 : K.size <= p : !1;
2131
- }, R = (L, K) => {
2132
- if (!E(L))
2150
+ const T = a[Z];
2151
+ return T ? T.collapsed ? !0 : T.size <= P : !1;
2152
+ }, l = (Z, T) => {
2153
+ if (!$(Z))
2133
2154
  return 0;
2134
- let oe = 0;
2135
- for (let Y = L; Y >= 0 && Y < a.length && E(Y); Y += K)
2136
- oe += 1;
2137
- return oe;
2138
- }, _ = H.left, V = H.right, F = _ >= 0 ? R(_, -1) : 0, N = V >= 0 ? R(V, 1) : 0;
2155
+ let R = 0;
2156
+ for (let F = Z; F >= 0 && F < a.length && $(F); F += T)
2157
+ R += 1;
2158
+ return R;
2159
+ }, g = N.left, w = N.right, M = g >= 0 ? l(g, -1) : 0, A = w >= 0 ? l(w, 1) : 0;
2139
2160
  return {
2140
- groupSize: F + N + 1,
2141
- overlapIndex: F
2161
+ groupSize: M + A + 1,
2162
+ overlapIndex: M
2142
2163
  };
2143
- }, [H.left, H.right, a, he]), de = te(() => {
2144
- if (ee)
2164
+ }, [N.left, N.right, a, be]), pe = ae(() => {
2165
+ if (oe)
2145
2166
  return !0;
2146
- if (ne.groupSize <= 1)
2167
+ if (ue.groupSize <= 1)
2147
2168
  return !1;
2148
- const p = ne.groupSize - 1;
2149
- return ne.overlapIndex > 0 && ne.overlapIndex < p;
2150
- }, [ne, ee]), fe = te(() => {
2151
- if (ne.groupSize <= 1 || de)
2169
+ const P = ue.groupSize - 1;
2170
+ return ue.overlapIndex > 0 && ue.overlapIndex < P;
2171
+ }, [ue, oe]), ge = ae(() => {
2172
+ if (ue.groupSize <= 1 || pe)
2152
2173
  return 0;
2153
- const p = ne.groupSize > 1 ? 2 : 1;
2154
- if (p === 1)
2174
+ const P = ue.groupSize > 1 ? 2 : 1;
2175
+ if (P === 1)
2155
2176
  return 0;
2156
- const E = ne.overlapIndex === 0 ? 0 : p - 1, R = (p - 1) / 2;
2157
- return (E - R) * Bt;
2158
- }, [ne, de]), xe = te(() => {
2159
- if (de)
2177
+ const $ = ue.overlapIndex === 0 ? 0 : P - 1, l = (P - 1) / 2;
2178
+ return ($ - l) * Bt;
2179
+ }, [ue, pe]), ye = ae(() => {
2180
+ if (pe)
2160
2181
  return { display: "none" };
2161
- if (fe !== 0)
2162
- return G ? { transform: `translateX(${fe}px)` } : { transform: `translateY(${fe}px)` };
2163
- }, [fe, G, de]), ve = ke(
2182
+ if (ge !== 0)
2183
+ return O ? { transform: `translateX(${ge}px)` } : { transform: `translateY(${ge}px)` };
2184
+ }, [ge, O, pe]), Be = $e(
2164
2185
  "flex items-center justify-center rounded-full bg-white text-slate-700 ring-1 ring-inset ring-white/80 backdrop-blur-sm transition-colors duration-150 shadow-[0_0_0_1px_rgba(255,255,255,0.85),0_1px_3px_rgba(15,23,42,0.18)]",
2165
2186
  "dark:bg-slate-800/95 dark:text-slate-200 dark:ring-slate-500/60 dark:shadow-[0_0_0_1px_rgba(148,163,184,0.45),0_1px_3px_rgba(2,6,23,0.55)]",
2166
- G ? "h-12 w-[6px] px-[2px]" : "h-[6px] w-20 py-[2px]",
2167
- P && "bg-blue-200/80 ring-blue-300 shadow-[0_0_0_1px_rgba(191,219,254,0.65),0_1px_4px_rgba(59,130,246,0.45)] dark:bg-blue-900/70 dark:ring-blue-400 dark:shadow-[0_0_0_1px_rgba(147,197,253,0.5),0_1px_4px_rgba(59,130,246,0.55)]"
2168
- ), h = ke(
2187
+ O ? "h-12 w-[6px] px-[2px]" : "h-[6px] w-20 py-[2px]",
2188
+ m && "bg-blue-200/80 ring-blue-300 shadow-[0_0_0_1px_rgba(191,219,254,0.65),0_1px_4px_rgba(59,130,246,0.45)] dark:bg-blue-900/70 dark:ring-blue-400 dark:shadow-[0_0_0_1px_rgba(147,197,253,0.5),0_1px_4px_rgba(59,130,246,0.55)]"
2189
+ ), Re = $e(
2169
2190
  "rounded-full bg-slate-600 transition-colors duration-150 shadow-[0_0_0_1px_rgba(255,255,255,0.9)] dark:bg-slate-200 dark:shadow-[0_0_0_1px_rgba(15,23,42,0.55)]",
2170
- G ? "h-8 w-[2px]" : "h-[2px] w-16",
2171
- P && "bg-blue-500 dark:bg-blue-300",
2172
- !k && "group-hover:bg-slate-700 dark:group-hover:bg-slate-100"
2173
- ), g = pe(() => {
2174
- const p = S.current;
2175
- if (!p)
2191
+ O ? "h-8 w-[2px]" : "h-[2px] w-16",
2192
+ m && "bg-blue-500 dark:bg-blue-300",
2193
+ !U && "group-hover:bg-slate-700 dark:group-hover:bg-slate-100"
2194
+ ), G = Se(() => {
2195
+ const P = x.current;
2196
+ if (!P)
2176
2197
  return;
2177
- let E = 0;
2178
- if (!de) {
2179
- const V = i === "horizontal" ? p.offsetWidth : p.offsetHeight;
2180
- let F = 0, N = 0;
2198
+ let $ = 0;
2199
+ if (!pe) {
2200
+ const w = i === "horizontal" ? P.offsetWidth : P.offsetHeight;
2201
+ let M = 0, A = 0;
2181
2202
  if (typeof window < "u") {
2182
- const w = window.getComputedStyle(p);
2183
- i === "horizontal" ? (F = Number.parseFloat(w.marginLeft || "0"), N = Number.parseFloat(w.marginRight || "0")) : (F = Number.parseFloat(w.marginTop || "0"), N = Number.parseFloat(w.marginBottom || "0"));
2203
+ const H = window.getComputedStyle(P);
2204
+ i === "horizontal" ? (M = Number.parseFloat(H.marginLeft || "0"), A = Number.parseFloat(H.marginRight || "0")) : (M = Number.parseFloat(H.marginTop || "0"), A = Number.parseFloat(H.marginBottom || "0"));
2184
2205
  }
2185
- E = [V, F, N].reduce((w, L) => Number.isFinite(L) ? w + L : w, 0);
2206
+ $ = [w, M, A].reduce((H, Z) => Number.isFinite(Z) ? H + Z : H, 0);
2186
2207
  }
2187
- (!Number.isFinite(E) || E < 0) && (E = 0);
2188
- const R = {
2189
- id: B,
2190
- thickness: E,
2208
+ (!Number.isFinite($) || $ < 0) && ($ = 0);
2209
+ const l = {
2210
+ id: E,
2211
+ thickness: $,
2191
2212
  direction: i,
2192
- visible: !de && E > Nt,
2213
+ visible: !pe && $ > Nt,
2193
2214
  startPanelId: X.left,
2194
2215
  endPanelId: X.right
2195
- }, _ = O.current;
2196
- _ && Math.abs(_.thickness - R.thickness) <= 0.25 && _.visible === R.visible && _.direction === R.direction && _.startPanelId === R.startPanelId && _.endPanelId === R.endPanelId || (O.current = R, o(B, R));
2197
- }, [i, X.left, X.right, o, B, de]);
2198
- re(() => {
2199
- g();
2200
- }, [g]), re(() => {
2201
- const p = S.current;
2202
- if (!p)
2216
+ }, g = _.current;
2217
+ g && Math.abs(g.thickness - l.thickness) <= 0.25 && g.visible === l.visible && g.direction === l.direction && g.startPanelId === l.startPanelId && g.endPanelId === l.endPanelId || (_.current = l, o(E, l));
2218
+ }, [i, X.left, X.right, o, E, pe]);
2219
+ se(() => {
2220
+ G();
2221
+ }, [G]), se(() => {
2222
+ const P = x.current;
2223
+ if (!P)
2203
2224
  return;
2204
2225
  if (typeof ResizeObserver > "u") {
2205
- g();
2226
+ G();
2206
2227
  return;
2207
2228
  }
2208
- const E = new ResizeObserver(() => {
2209
- g();
2229
+ const $ = new ResizeObserver(() => {
2230
+ G();
2210
2231
  });
2211
- return E.observe(p), () => {
2212
- E.disconnect();
2232
+ return $.observe(P), () => {
2233
+ $.disconnect();
2213
2234
  };
2214
- }, [g]);
2215
- const M = te(() => {
2216
- const p = d ? { ...Pe, ...d } : Pe;
2217
- return de ? {
2218
- ...p,
2235
+ }, [G]);
2236
+ const le = ae(() => {
2237
+ const P = d ? { ...he, ...d } : he;
2238
+ return pe ? {
2239
+ ...P,
2219
2240
  display: "none",
2220
2241
  pointerEvents: "none",
2221
2242
  visibility: "hidden"
2222
- } : p;
2223
- }, [Pe, de, d]);
2224
- return /* @__PURE__ */ A(
2243
+ } : P;
2244
+ }, [he, pe, d]);
2245
+ return /* @__PURE__ */ I(
2225
2246
  "button",
2226
2247
  {
2227
2248
  type: "button",
2228
- ref: S,
2229
- className: b,
2230
- style: M,
2231
- onPointerDown: $,
2232
- disabled: k,
2233
- "aria-hidden": de || void 0,
2234
- "aria-label": `Resize ${G ? "columns" : "rows"} - Drag to collapse/expand panels`,
2235
- "data-resize-handle-id": B,
2236
- title: `ドラッグして${G ? "列" : "行"}をリサイズ、端まで移動して折りたたみ/展開`,
2237
- children: r || /* @__PURE__ */ A("div", { className: ve, style: xe, children: /* @__PURE__ */ A("span", { className: h }) })
2249
+ ref: x,
2250
+ className: y,
2251
+ style: le,
2252
+ onPointerDown: V,
2253
+ disabled: U,
2254
+ "aria-hidden": pe || void 0,
2255
+ "aria-label": `Resize ${O ? "columns" : "rows"} - Drag to collapse/expand panels`,
2256
+ "data-resize-handle-id": E,
2257
+ title: `ドラッグして${O ? "列" : "行"}をリサイズ、端まで移動して折りたたみ/展開`,
2258
+ children: r || /* @__PURE__ */ I("div", { className: Be, style: ye, children: /* @__PURE__ */ I("span", { className: Re }) })
2238
2259
  }
2239
2260
  );
2240
- }), zi = (t) => document.querySelector(`[data-panel-id="${t}"]`), gi = (t) => document.querySelector(`[data-panel-group-id="${t}"]`), hi = (t) => document.querySelector(`[data-resize-handle-id="${t}"]`);
2261
+ }), zi = (t) => document.querySelector(`[data-panel-id="${t}"]`), hi = (t) => document.querySelector(`[data-panel-group-id="${t}"]`), gi = (t) => document.querySelector(`[data-resize-handle-id="${t}"]`);
2241
2262
  export {
2242
2263
  ui as Panel,
2243
2264
  fi as PanelGroup,
2244
- pt as PanelGroupContext,
2265
+ gt as PanelGroupContext,
2245
2266
  pi as PanelResizeHandle,
2246
- ze as clamp,
2247
- q as getConstraintInPixels,
2248
- Le as getContainerSize,
2267
+ me as clamp,
2268
+ te as getConstraintInPixels,
2269
+ Oe as getContainerSize,
2249
2270
  zi as getPanelElement,
2250
- gi as getPanelGroupElement,
2251
- hi as getResizeHandleElement,
2271
+ hi as getPanelGroupElement,
2272
+ gi as getResizeHandleElement,
2252
2273
  Lt as loadLayout,
2253
- Xe as normalizeSizeConfig,
2274
+ Qe as normalizeSizeConfig,
2254
2275
  At as saveLayout,
2255
2276
  di as usePanelControls,
2256
- Qe as usePanelGroup,
2277
+ rt as usePanelGroup,
2257
2278
  Ot as useResizablePanels
2258
2279
  };