react-resizable-panels 4.9.0 → 4.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { jsx as ie } from "react/jsx-runtime";
3
- import { useState as re, useCallback as ne, useId as pt, useLayoutEffect as We, useEffect as he, useRef as O, createContext as ht, useImperativeHandle as Ue, useMemo as ye, useSyncExternalStore as Ke, useContext as mt } from "react";
2
+ import { jsx as ae } from "react/jsx-runtime";
3
+ import { useState as Q, useCallback as re, useId as pt, useLayoutEffect as Ue, useEffect as me, useRef as T, createContext as ht, useImperativeHandle as Ke, useMemo as Se, useSyncExternalStore as Xe, useContext as mt } from "react";
4
4
  function gt(e, t) {
5
5
  const n = getComputedStyle(e), o = parseFloat(n.fontSize);
6
6
  return t * o;
@@ -15,7 +15,7 @@ function St(e) {
15
15
  function vt(e) {
16
16
  return e / 100 * window.innerWidth;
17
17
  }
18
- function zt(e) {
18
+ function bt(e) {
19
19
  switch (typeof e) {
20
20
  case "number":
21
21
  return [e, "px"];
@@ -25,14 +25,14 @@ function zt(e) {
25
25
  }
26
26
  }
27
27
  }
28
- function te({
28
+ function ie({
29
29
  groupSize: e,
30
30
  panelElement: t,
31
31
  styleProp: n
32
32
  }) {
33
33
  let o;
34
- const [i, s] = zt(n);
35
- switch (s) {
34
+ const [i, r] = bt(n);
35
+ switch (r) {
36
36
  case "%": {
37
37
  o = i / 100 * e;
38
38
  break;
@@ -60,17 +60,17 @@ function te({
60
60
  }
61
61
  return o;
62
62
  }
63
- function T(e) {
63
+ function O(e) {
64
64
  return parseFloat(e.toFixed(3));
65
65
  }
66
- function Q({
66
+ function ne({
67
67
  group: e
68
68
  }) {
69
69
  const { orientation: t, panels: n } = e;
70
70
  return n.reduce((o, i) => (o += t === "horizontal" ? i.element.offsetWidth : i.element.offsetHeight, o), 0);
71
71
  }
72
- function Se(e) {
73
- const { panels: t } = e, n = Q({ group: e });
72
+ function ve(e) {
73
+ const { panels: t } = e, n = ne({ group: e });
74
74
  return n === 0 ? t.map((o) => ({
75
75
  groupResizeBehavior: o.panelConstraints.groupResizeBehavior,
76
76
  collapsedSize: 0,
@@ -81,51 +81,51 @@ function Se(e) {
81
81
  maxSize: 100,
82
82
  panelId: o.id
83
83
  })) : t.map((o) => {
84
- const { element: i, panelConstraints: s } = o;
85
- let l = 0;
86
- if (s.collapsedSize !== void 0) {
87
- const f = te({
84
+ const { element: i, panelConstraints: r } = o;
85
+ let f = 0;
86
+ if (r.collapsedSize !== void 0) {
87
+ const u = ie({
88
88
  groupSize: n,
89
89
  panelElement: i,
90
- styleProp: s.collapsedSize
90
+ styleProp: r.collapsedSize
91
91
  });
92
- l = T(f / n * 100);
92
+ f = O(u / n * 100);
93
93
  }
94
- let r;
95
- if (s.defaultSize !== void 0) {
96
- const f = te({
94
+ let a;
95
+ if (r.defaultSize !== void 0) {
96
+ const u = ie({
97
97
  groupSize: n,
98
98
  panelElement: i,
99
- styleProp: s.defaultSize
99
+ styleProp: r.defaultSize
100
100
  });
101
- r = T(f / n * 100);
101
+ a = O(u / n * 100);
102
102
  }
103
- let a = 0;
104
- if (s.minSize !== void 0) {
105
- const f = te({
103
+ let s = 0;
104
+ if (r.minSize !== void 0) {
105
+ const u = ie({
106
106
  groupSize: n,
107
107
  panelElement: i,
108
- styleProp: s.minSize
108
+ styleProp: r.minSize
109
109
  });
110
- a = T(f / n * 100);
110
+ s = O(u / n * 100);
111
111
  }
112
- let c = 100;
113
- if (s.maxSize !== void 0) {
114
- const f = te({
112
+ let l = 100;
113
+ if (r.maxSize !== void 0) {
114
+ const u = ie({
115
115
  groupSize: n,
116
116
  panelElement: i,
117
- styleProp: s.maxSize
117
+ styleProp: r.maxSize
118
118
  });
119
- c = T(f / n * 100);
119
+ l = O(u / n * 100);
120
120
  }
121
121
  return {
122
- groupResizeBehavior: s.groupResizeBehavior,
123
- collapsedSize: l,
124
- collapsible: s.collapsible === !0,
125
- defaultSize: r,
126
- disabled: s.disabled,
127
- minSize: a,
128
- maxSize: c,
122
+ groupResizeBehavior: r.groupResizeBehavior,
123
+ collapsedSize: f,
124
+ collapsible: r.collapsible === !0,
125
+ defaultSize: a,
126
+ disabled: r.disabled,
127
+ minSize: s,
128
+ maxSize: l,
129
129
  panelId: o.id
130
130
  };
131
131
  });
@@ -134,12 +134,12 @@ function C(e, t = "Assertion error") {
134
134
  if (!e)
135
135
  throw Error(t);
136
136
  }
137
- function ve(e, t) {
137
+ function be(e, t) {
138
138
  return Array.from(t).sort(
139
- e === "horizontal" ? bt : xt
139
+ e === "horizontal" ? zt : xt
140
140
  );
141
141
  }
142
- function bt(e, t) {
142
+ function zt(e, t) {
143
143
  const n = e.element.offsetLeft - t.element.offsetLeft;
144
144
  return n !== 0 ? n : e.element.offsetWidth - t.element.offsetWidth;
145
145
  }
@@ -147,10 +147,10 @@ function xt(e, t) {
147
147
  const n = e.element.offsetTop - t.element.offsetTop;
148
148
  return n !== 0 ? n : e.element.offsetHeight - t.element.offsetHeight;
149
149
  }
150
- function Xe(e) {
150
+ function qe(e) {
151
151
  return e !== null && typeof e == "object" && "nodeType" in e && e.nodeType === Node.ELEMENT_NODE;
152
152
  }
153
- function qe(e, t) {
153
+ function Ye(e, t) {
154
154
  return {
155
155
  x: e.x >= t.left && e.x <= t.right ? 0 : Math.min(
156
156
  Math.abs(e.x - t.left),
@@ -162,7 +162,7 @@ function qe(e, t) {
162
162
  )
163
163
  };
164
164
  }
165
- function wt({
165
+ function Pt({
166
166
  orientation: e,
167
167
  rects: t,
168
168
  targetRect: n
@@ -171,41 +171,41 @@ function wt({
171
171
  x: n.x + n.width / 2,
172
172
  y: n.y + n.height / 2
173
173
  };
174
- let i, s = Number.MAX_VALUE;
175
- for (const l of t) {
176
- const { x: r, y: a } = qe(o, l), c = e === "horizontal" ? r : a;
177
- c < s && (s = c, i = l);
174
+ let i, r = Number.MAX_VALUE;
175
+ for (const f of t) {
176
+ const { x: a, y: s } = Ye(o, f), l = e === "horizontal" ? a : s;
177
+ l < r && (r = l, i = f);
178
178
  }
179
179
  return C(i, "No rect found"), i;
180
180
  }
181
- let ce;
182
- function Pt() {
183
- return ce === void 0 && (typeof matchMedia == "function" ? ce = !!matchMedia("(pointer:coarse)").matches : ce = !1), ce;
181
+ let fe;
182
+ function wt() {
183
+ return fe === void 0 && (typeof matchMedia == "function" ? fe = !!matchMedia("(pointer:coarse)").matches : fe = !1), fe;
184
184
  }
185
- function Ye(e) {
186
- const { element: t, orientation: n, panels: o, separators: i } = e, s = ve(
185
+ function Je(e) {
186
+ const { element: t, orientation: n, panels: o, separators: i } = e, r = be(
187
187
  n,
188
- Array.from(t.children).filter(Xe).map((b) => ({ element: b }))
189
- ).map(({ element: b }) => b), l = [];
190
- let r = !1, a = !1, c = -1, f = -1, g = 0, d, z = [];
188
+ Array.from(t.children).filter(qe).map((z) => ({ element: z }))
189
+ ).map(({ element: z }) => z), f = [];
190
+ let a = !1, s = !1, l = -1, u = -1, h = 0, d, S = [];
191
191
  {
192
- let b = -1;
193
- for (const u of s)
194
- u.hasAttribute("data-panel") && (b++, u.hasAttribute("data-disabled") || (g++, c === -1 && (c = b), f = b));
192
+ let z = -1;
193
+ for (const c of r)
194
+ c.hasAttribute("data-panel") && (z++, c.hasAttribute("data-disabled") || (h++, l === -1 && (l = z), u = z));
195
195
  }
196
- if (g > 1) {
197
- let b = -1;
198
- for (const u of s)
199
- if (u.hasAttribute("data-panel")) {
200
- b++;
196
+ if (h > 1) {
197
+ let z = -1;
198
+ for (const c of r)
199
+ if (c.hasAttribute("data-panel")) {
200
+ z++;
201
201
  const p = o.find(
202
- (m) => m.element === u
202
+ (m) => m.element === c
203
203
  );
204
204
  if (p) {
205
205
  if (d) {
206
- const m = d.element.getBoundingClientRect(), S = u.getBoundingClientRect();
207
- let v;
208
- if (a) {
206
+ const m = d.element.getBoundingClientRect(), v = c.getBoundingClientRect();
207
+ let b;
208
+ if (s) {
209
209
  const y = n === "horizontal" ? new DOMRect(
210
210
  m.right,
211
211
  m.top,
@@ -216,91 +216,91 @@ function Ye(e) {
216
216
  m.bottom,
217
217
  m.width,
218
218
  0
219
- ), h = n === "horizontal" ? new DOMRect(S.left, S.top, 0, S.height) : new DOMRect(S.left, S.top, S.width, 0);
220
- switch (z.length) {
219
+ ), g = n === "horizontal" ? new DOMRect(v.left, v.top, 0, v.height) : new DOMRect(v.left, v.top, v.width, 0);
220
+ switch (S.length) {
221
221
  case 0: {
222
- v = [
222
+ b = [
223
223
  y,
224
- h
224
+ g
225
225
  ];
226
226
  break;
227
227
  }
228
228
  case 1: {
229
- const P = z[0], M = wt({
229
+ const P = S[0], M = Pt({
230
230
  orientation: n,
231
- rects: [m, S],
231
+ rects: [m, v],
232
232
  targetRect: P.element.getBoundingClientRect()
233
233
  });
234
- v = [
234
+ b = [
235
235
  P,
236
- M === m ? h : y
236
+ M === m ? g : y
237
237
  ];
238
238
  break;
239
239
  }
240
240
  default: {
241
- v = z;
241
+ b = S;
242
242
  break;
243
243
  }
244
244
  }
245
245
  } else
246
- z.length ? v = z : v = [
246
+ S.length ? b = S : b = [
247
247
  n === "horizontal" ? new DOMRect(
248
248
  m.right,
249
- S.top,
250
- S.left - m.right,
251
- S.height
249
+ v.top,
250
+ v.left - m.right,
251
+ v.height
252
252
  ) : new DOMRect(
253
- S.left,
253
+ v.left,
254
254
  m.bottom,
255
- S.width,
256
- S.top - m.bottom
255
+ v.width,
256
+ v.top - m.bottom
257
257
  )
258
258
  ];
259
- for (const y of v) {
260
- let h = "width" in y ? y : y.element.getBoundingClientRect();
261
- const P = Pt() ? e.resizeTargetMinimumSize.coarse : e.resizeTargetMinimumSize.fine;
262
- if (h.width < P) {
263
- const L = P - h.width;
264
- h = new DOMRect(
265
- h.x - L / 2,
266
- h.y,
267
- h.width + L,
268
- h.height
259
+ for (const y of b) {
260
+ let g = "width" in y ? y : y.element.getBoundingClientRect();
261
+ const P = wt() ? e.resizeTargetMinimumSize.coarse : e.resizeTargetMinimumSize.fine;
262
+ if (g.width < P) {
263
+ const w = P - g.width;
264
+ g = new DOMRect(
265
+ g.x - w / 2,
266
+ g.y,
267
+ g.width + w,
268
+ g.height
269
269
  );
270
270
  }
271
- if (h.height < P) {
272
- const L = P - h.height;
273
- h = new DOMRect(
274
- h.x,
275
- h.y - L / 2,
276
- h.width,
277
- h.height + L
271
+ if (g.height < P) {
272
+ const w = P - g.height;
273
+ g = new DOMRect(
274
+ g.x,
275
+ g.y - w / 2,
276
+ g.width,
277
+ g.height + w
278
278
  );
279
279
  }
280
- const M = b <= c || b > f;
281
- !r && !M && l.push({
280
+ const M = z <= l || z > u;
281
+ !a && !M && f.push({
282
282
  group: e,
283
- groupSize: Q({ group: e }),
283
+ groupSize: ne({ group: e }),
284
284
  panels: [d, p],
285
285
  separator: "width" in y ? void 0 : y,
286
- rect: h
287
- }), r = !1;
286
+ rect: g
287
+ }), a = !1;
288
288
  }
289
289
  }
290
- a = !1, d = p, z = [];
290
+ s = !1, d = p, S = [];
291
291
  }
292
- } else if (u.hasAttribute("data-separator")) {
293
- u.ariaDisabled !== null && (r = !0);
292
+ } else if (c.hasAttribute("data-separator")) {
293
+ c.ariaDisabled !== null && (a = !0);
294
294
  const p = i.find(
295
- (m) => m.element === u
295
+ (m) => m.element === c
296
296
  );
297
- p ? z.push(p) : (d = void 0, z = []);
297
+ p ? S.push(p) : (d = void 0, S = []);
298
298
  } else
299
- a = !0;
299
+ s = !0;
300
300
  }
301
- return l;
301
+ return f;
302
302
  }
303
- class Je {
303
+ class Ze {
304
304
  #e = {};
305
305
  addListener(t, n) {
306
306
  const o = this.#e[t];
@@ -314,18 +314,18 @@ class Je {
314
314
  if (o.length === 1)
315
315
  o[0].call(null, n);
316
316
  else {
317
- let i = !1, s = null;
318
- const l = Array.from(o);
319
- for (let r = 0; r < l.length; r++) {
320
- const a = l[r];
317
+ let i = !1, r = null;
318
+ const f = Array.from(o);
319
+ for (let a = 0; a < f.length; a++) {
320
+ const s = f[a];
321
321
  try {
322
- a.call(null, n);
323
- } catch (c) {
324
- s === null && (i = !0, s = c);
322
+ s.call(null, n);
323
+ } catch (l) {
324
+ r === null && (i = !0, r = l);
325
325
  }
326
326
  }
327
327
  if (i)
328
- throw s;
328
+ throw r;
329
329
  }
330
330
  }
331
331
  removeAllListeners() {
@@ -339,34 +339,34 @@ class Je {
339
339
  }
340
340
  }
341
341
  }
342
- let A = /* @__PURE__ */ new Map();
343
- const Ze = new Je();
342
+ let F = /* @__PURE__ */ new Map();
343
+ const Qe = new Ze();
344
344
  function Lt(e) {
345
- A = new Map(A), A.delete(e);
345
+ F = new Map(F), F.delete(e);
346
346
  }
347
- function Ee(e, t) {
348
- for (const [n] of A)
347
+ function ke(e, t) {
348
+ for (const [n] of F)
349
349
  if (n.id === e)
350
350
  return n;
351
351
  }
352
- function j(e, t) {
353
- for (const [n, o] of A)
352
+ function H(e, t) {
353
+ for (const [n, o] of F)
354
354
  if (n.id === e)
355
355
  return o;
356
356
  if (t)
357
357
  throw Error(`Could not find data for Group with id ${e}`);
358
358
  }
359
- function U() {
360
- return A;
359
+ function X() {
360
+ return F;
361
361
  }
362
362
  function ze(e, t) {
363
- return Ze.addListener("groupChange", (n) => {
363
+ return Qe.addListener("groupChange", (n) => {
364
364
  n.group.id === e && t(n);
365
365
  });
366
366
  }
367
- function _(e, t) {
368
- const n = A.get(e);
369
- A = new Map(A), A.set(e, t), Ze.emit("groupChange", {
367
+ function $(e, t) {
368
+ const n = F.get(e);
369
+ F = new Map(F), F.set(e, t), Qe.emit("groupChange", {
370
370
  group: e,
371
371
  prev: n,
372
372
  next: t
@@ -377,15 +377,15 @@ function Ct(e, t, n) {
377
377
  x: 1 / 0,
378
378
  y: 1 / 0
379
379
  };
380
- for (const s of t) {
381
- const l = qe(n, s.rect);
380
+ for (const r of t) {
381
+ const f = Ye(n, r.rect);
382
382
  switch (e) {
383
383
  case "horizontal": {
384
- l.x <= i.x && (o = s, i = l);
384
+ f.x <= i.x && (o = r, i = f);
385
385
  break;
386
386
  }
387
387
  case "vertical": {
388
- l.y <= i.y && (o = s, i = l);
388
+ f.y <= i.y && (o = r, i = f);
389
389
  break;
390
390
  }
391
391
  }
@@ -401,8 +401,8 @@ function Rt(e) {
401
401
  function Mt(e, t) {
402
402
  if (e === t) throw new Error("Cannot compare node with itself");
403
403
  const n = {
404
- a: De(e),
405
- b: De(t)
404
+ a: Oe(e),
405
+ b: Oe(t)
406
406
  };
407
407
  let o;
408
408
  for (; n.a.at(-1) === n.b.at(-1); )
@@ -412,33 +412,33 @@ function Mt(e, t) {
412
412
  "Stacking order can only be calculated for elements with a common ancestor"
413
413
  );
414
414
  const i = {
415
- a: Ie(ke(n.a)),
416
- b: Ie(ke(n.b))
415
+ a: De(Ie(n.a)),
416
+ b: De(Ie(n.b))
417
417
  };
418
418
  if (i.a === i.b) {
419
- const s = o.childNodes, l = {
419
+ const r = o.childNodes, f = {
420
420
  a: n.a.at(-1),
421
421
  b: n.b.at(-1)
422
422
  };
423
- let r = s.length;
424
- for (; r--; ) {
425
- const a = s[r];
426
- if (a === l.a) return 1;
427
- if (a === l.b) return -1;
423
+ let a = r.length;
424
+ for (; a--; ) {
425
+ const s = r[a];
426
+ if (s === f.a) return 1;
427
+ if (s === f.b) return -1;
428
428
  }
429
429
  }
430
430
  return Math.sign(i.a - i.b);
431
431
  }
432
432
  const Et = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
433
433
  function kt(e) {
434
- const t = getComputedStyle(Qe(e) ?? e).display;
434
+ const t = getComputedStyle(et(e) ?? e).display;
435
435
  return t === "flex" || t === "inline-flex";
436
436
  }
437
437
  function It(e) {
438
438
  const t = getComputedStyle(e);
439
439
  return !!(t.position === "fixed" || t.zIndex !== "auto" && (t.position !== "static" || kt(e)) || +t.opacity < 1 || "transform" in t && t.transform !== "none" || "webkitTransform" in t && t.webkitTransform !== "none" || "mixBlendMode" in t && t.mixBlendMode !== "normal" || "filter" in t && t.filter !== "none" || "webkitFilter" in t && t.webkitFilter !== "none" || "isolation" in t && t.isolation === "isolate" || Et.test(t.willChange) || t.webkitOverflowScrolling === "touch");
440
440
  }
441
- function ke(e) {
441
+ function Ie(e) {
442
442
  let t = e.length;
443
443
  for (; t--; ) {
444
444
  const n = e[t];
@@ -446,28 +446,28 @@ function ke(e) {
446
446
  }
447
447
  return null;
448
448
  }
449
- function Ie(e) {
449
+ function De(e) {
450
450
  return e && Number(getComputedStyle(e).zIndex) || 0;
451
451
  }
452
- function De(e) {
452
+ function Oe(e) {
453
453
  const t = [];
454
454
  for (; e; )
455
- t.push(e), e = Qe(e);
455
+ t.push(e), e = et(e);
456
456
  return t;
457
457
  }
458
- function Qe(e) {
458
+ function et(e) {
459
459
  const { parentNode: t } = e;
460
460
  return Rt(t) ? t.host : t;
461
461
  }
462
462
  function Dt(e, t) {
463
463
  return e.x < t.x + t.width && e.x + e.width > t.x && e.y < t.y + t.height && e.y + e.height > t.y;
464
464
  }
465
- function Tt({
465
+ function Ot({
466
466
  groupElement: e,
467
467
  hitRegion: t,
468
468
  pointerEventTarget: n
469
469
  }) {
470
- if (!Xe(n) || n.contains(e) || e.contains(n))
470
+ if (!qe(n) || n.contains(e) || e.contains(n))
471
471
  return !0;
472
472
  if (Mt(n, e) > 0) {
473
473
  let o = n;
@@ -481,23 +481,23 @@ function Tt({
481
481
  }
482
482
  return !0;
483
483
  }
484
- function be(e, t) {
484
+ function xe(e, t) {
485
485
  const n = [];
486
486
  return t.forEach((o, i) => {
487
487
  if (i.disabled)
488
488
  return;
489
- const s = Ye(i), l = Ct(i.orientation, s, {
489
+ const r = Je(i), f = Ct(i.orientation, r, {
490
490
  x: e.clientX,
491
491
  y: e.clientY
492
492
  });
493
- l && l.distance.x <= 0 && l.distance.y <= 0 && Tt({
493
+ f && f.distance.x <= 0 && f.distance.y <= 0 && Ot({
494
494
  groupElement: i.element,
495
- hitRegion: l.hitRegion.rect,
495
+ hitRegion: f.hitRegion.rect,
496
496
  pointerEventTarget: e.target
497
- }) && n.push(l.hitRegion);
497
+ }) && n.push(f.hitRegion);
498
498
  }), n;
499
499
  }
500
- function Ot(e, t) {
500
+ function Tt(e, t) {
501
501
  if (e.length !== t.length)
502
502
  return !1;
503
503
  for (let n = 0; n < e.length; n++)
@@ -505,13 +505,13 @@ function Ot(e, t) {
505
505
  return !1;
506
506
  return !0;
507
507
  }
508
- function D(e, t, n = 0) {
509
- return Math.abs(T(e) - T(t)) <= n;
508
+ function I(e, t, n = 0) {
509
+ return Math.abs(O(e) - O(t)) <= n;
510
510
  }
511
- function G(e, t) {
512
- return D(e, t) ? 0 : e > t ? 1 : -1;
511
+ function A(e, t) {
512
+ return I(e, t) ? 0 : e > t ? 1 : -1;
513
513
  }
514
- function Y({
514
+ function Z({
515
515
  overrideDisabledPanels: e,
516
516
  panelConstraints: t,
517
517
  prevSize: n,
@@ -519,369 +519,392 @@ function Y({
519
519
  }) {
520
520
  const {
521
521
  collapsedSize: i = 0,
522
- collapsible: s,
523
- disabled: l,
524
- maxSize: r = 100,
525
- minSize: a = 0
522
+ collapsible: r,
523
+ disabled: f,
524
+ maxSize: a = 100,
525
+ minSize: s = 0
526
526
  } = t;
527
- if (l && !e)
527
+ if (f && !e)
528
528
  return n;
529
- if (G(o, a) < 0)
530
- if (s) {
531
- const c = (i + a) / 2;
532
- G(o, c) < 0 ? o = i : o = a;
529
+ if (A(o, s) < 0)
530
+ if (r) {
531
+ const l = (i + s) / 2;
532
+ A(o, l) < 0 ? o = i : o = s;
533
533
  } else
534
- o = a;
535
- return o = Math.min(r, o), o = T(o), o;
534
+ o = s;
535
+ return o = Math.min(a, o), o = O(o), o;
536
536
  }
537
- function se({
537
+ function le({
538
538
  delta: e,
539
539
  initialLayout: t,
540
540
  panelConstraints: n,
541
541
  pivotIndices: o,
542
542
  prevLayout: i,
543
- trigger: s
543
+ trigger: r
544
544
  }) {
545
- if (D(e, 0))
545
+ if (I(e, 0))
546
546
  return t;
547
- const l = s === "imperative-api", r = Object.values(t), a = Object.values(i), c = [...r], [f, g] = o;
548
- C(f != null, "Invalid first pivot index"), C(g != null, "Invalid second pivot index");
547
+ const f = r === "imperative-api", a = Object.values(t), s = Object.values(i), l = [...a], [u, h] = o;
548
+ C(u != null, "Invalid first pivot index"), C(h != null, "Invalid second pivot index");
549
549
  let d = 0;
550
- switch (s) {
550
+ switch (r) {
551
551
  case "keyboard": {
552
552
  {
553
- const u = e < 0 ? g : f, p = n[u];
553
+ const c = e < 0 ? h : u, p = n[c];
554
554
  C(
555
555
  p,
556
- `Panel constraints not found for index ${u}`
556
+ `Panel constraints not found for index ${c}`
557
557
  );
558
558
  const {
559
559
  collapsedSize: m = 0,
560
- collapsible: S,
561
- minSize: v = 0
560
+ collapsible: v,
561
+ minSize: b = 0
562
562
  } = p;
563
- if (S) {
564
- const y = r[u];
563
+ if (v) {
564
+ const y = a[c];
565
565
  if (C(
566
566
  y != null,
567
- `Previous layout not found for panel index ${u}`
568
- ), D(y, m)) {
569
- const h = v - y;
570
- G(h, Math.abs(e)) > 0 && (e = e < 0 ? 0 - h : h);
567
+ `Previous layout not found for panel index ${c}`
568
+ ), I(y, m)) {
569
+ const g = b - y;
570
+ A(g, Math.abs(e)) > 0 && (e = e < 0 ? 0 - g : g);
571
571
  }
572
572
  }
573
573
  }
574
574
  {
575
- const u = e < 0 ? f : g, p = n[u];
575
+ const c = e < 0 ? u : h, p = n[c];
576
576
  C(
577
577
  p,
578
- `No panel constraints found for index ${u}`
578
+ `No panel constraints found for index ${c}`
579
579
  );
580
580
  const {
581
581
  collapsedSize: m = 0,
582
- collapsible: S,
583
- minSize: v = 0
582
+ collapsible: v,
583
+ minSize: b = 0
584
584
  } = p;
585
- if (S) {
586
- const y = r[u];
585
+ if (v) {
586
+ const y = a[c];
587
587
  if (C(
588
588
  y != null,
589
- `Previous layout not found for panel index ${u}`
590
- ), D(y, v)) {
591
- const h = y - m;
592
- G(h, Math.abs(e)) > 0 && (e = e < 0 ? 0 - h : h);
589
+ `Previous layout not found for panel index ${c}`
590
+ ), I(y, b)) {
591
+ const g = y - m;
592
+ A(g, Math.abs(e)) > 0 && (e = e < 0 ? 0 - g : g);
593
593
  }
594
594
  }
595
595
  }
596
596
  break;
597
597
  }
598
598
  default: {
599
- const u = e < 0 ? g : f, p = n[u];
599
+ const c = e < 0 ? h : u, p = n[c];
600
600
  C(
601
601
  p,
602
- `Panel constraints not found for index ${u}`
602
+ `Panel constraints not found for index ${c}`
603
603
  );
604
- const m = r[u], { collapsible: S, collapsedSize: v, minSize: y } = p;
605
- if (S && G(m, y) < 0)
604
+ const m = a[c], { collapsible: v, collapsedSize: b, minSize: y } = p;
605
+ if (v && A(m, y) < 0)
606
606
  if (e > 0) {
607
- const h = y - v, P = h / 2, M = m + e;
608
- G(M, y) < 0 && (e = G(e, P) <= 0 ? 0 : h);
607
+ const g = y - b, P = g / 2, M = m + e;
608
+ A(M, y) < 0 && (e = A(e, P) <= 0 ? 0 : g);
609
609
  } else {
610
- const h = y - v, P = 100 - h / 2, M = m - e;
611
- G(M, y) < 0 && (e = G(100 + e, P) > 0 ? 0 : -h);
610
+ const g = y - b, P = 100 - g / 2, M = m - e;
611
+ A(M, y) < 0 && (e = A(100 + e, P) > 0 ? 0 : -g);
612
612
  }
613
613
  break;
614
614
  }
615
615
  }
616
616
  {
617
- const u = e < 0 ? 1 : -1;
618
- let p = e < 0 ? g : f, m = 0;
617
+ const c = e < 0 ? 1 : -1;
618
+ let p = e < 0 ? h : u, m = 0;
619
619
  for (; ; ) {
620
- const v = r[p];
620
+ const b = a[p];
621
621
  C(
622
- v != null,
622
+ b != null,
623
623
  `Previous layout not found for panel index ${p}`
624
624
  );
625
- const h = Y({
626
- overrideDisabledPanels: l,
625
+ const g = Z({
626
+ overrideDisabledPanels: f,
627
627
  panelConstraints: n[p],
628
- prevSize: v,
628
+ prevSize: b,
629
629
  size: 100
630
- }) - v;
631
- if (m += h, p += u, p < 0 || p >= n.length)
630
+ }) - b;
631
+ if (m += g, p += c, p < 0 || p >= n.length)
632
632
  break;
633
633
  }
634
- const S = Math.min(Math.abs(e), Math.abs(m));
635
- e = e < 0 ? 0 - S : S;
634
+ const v = Math.min(Math.abs(e), Math.abs(m));
635
+ e = e < 0 ? 0 - v : v;
636
636
  }
637
637
  {
638
- let p = e < 0 ? f : g;
638
+ let p = e < 0 ? u : h;
639
639
  for (; p >= 0 && p < n.length; ) {
640
- const m = Math.abs(e) - Math.abs(d), S = r[p];
640
+ const m = Math.abs(e) - Math.abs(d), v = a[p];
641
641
  C(
642
- S != null,
642
+ v != null,
643
643
  `Previous layout not found for panel index ${p}`
644
644
  );
645
- const v = S - m, y = Y({
646
- overrideDisabledPanels: l,
645
+ const b = v - m, y = Z({
646
+ overrideDisabledPanels: f,
647
647
  panelConstraints: n[p],
648
- prevSize: S,
649
- size: v
648
+ prevSize: v,
649
+ size: b
650
650
  });
651
- if (!D(S, y) && (d += S - y, c[p] = y, d.toFixed(3).localeCompare(Math.abs(e).toFixed(3), void 0, {
651
+ if (!I(v, y) && (d += v - y, l[p] = y, d.toFixed(3).localeCompare(Math.abs(e).toFixed(3), void 0, {
652
652
  numeric: !0
653
653
  }) >= 0))
654
654
  break;
655
655
  e < 0 ? p-- : p++;
656
656
  }
657
657
  }
658
- if (Ot(a, c))
658
+ if (Tt(s, l))
659
659
  return i;
660
660
  {
661
- const u = e < 0 ? g : f, p = r[u];
661
+ const c = e < 0 ? h : u, p = a[c];
662
662
  C(
663
663
  p != null,
664
- `Previous layout not found for panel index ${u}`
664
+ `Previous layout not found for panel index ${c}`
665
665
  );
666
- const m = p + d, S = Y({
667
- overrideDisabledPanels: l,
668
- panelConstraints: n[u],
666
+ const m = p + d, v = Z({
667
+ overrideDisabledPanels: f,
668
+ panelConstraints: n[c],
669
669
  prevSize: p,
670
670
  size: m
671
671
  });
672
- if (c[u] = S, !D(S, m)) {
673
- let v = m - S, h = e < 0 ? g : f;
674
- for (; h >= 0 && h < n.length; ) {
675
- const P = c[h];
672
+ if (l[c] = v, !I(v, m)) {
673
+ let b = m - v, g = e < 0 ? h : u;
674
+ for (; g >= 0 && g < n.length; ) {
675
+ const P = l[g];
676
676
  C(
677
677
  P != null,
678
- `Previous layout not found for panel index ${h}`
678
+ `Previous layout not found for panel index ${g}`
679
679
  );
680
- const M = P + v, L = Y({
681
- overrideDisabledPanels: l,
682
- panelConstraints: n[h],
680
+ const M = P + b, w = Z({
681
+ overrideDisabledPanels: f,
682
+ panelConstraints: n[g],
683
683
  prevSize: P,
684
684
  size: M
685
685
  });
686
- if (D(P, L) || (v -= L - P, c[h] = L), D(v, 0))
686
+ if (I(P, w) || (b -= w - P, l[g] = w), I(b, 0))
687
687
  break;
688
- e > 0 ? h-- : h++;
688
+ e > 0 ? g-- : g++;
689
689
  }
690
690
  }
691
691
  }
692
- const z = Object.values(c).reduce(
693
- (u, p) => p + u,
692
+ const S = Object.values(l).reduce(
693
+ (c, p) => p + c,
694
694
  0
695
695
  );
696
- if (!D(z, 100, 0.1))
696
+ if (!I(S, 100, 0.1))
697
697
  return i;
698
- const b = Object.keys(i);
699
- return c.reduce((u, p, m) => (u[b[m]] = p, u), {});
698
+ const z = Object.keys(i);
699
+ return l.reduce((c, p, m) => (c[z[m]] = p, c), {});
700
700
  }
701
- function V(e, t) {
701
+ function W(e, t) {
702
702
  if (Object.keys(e).length !== Object.keys(t).length)
703
703
  return !1;
704
704
  for (const n in e)
705
- if (t[n] === void 0 || G(e[n], t[n]) !== 0)
705
+ if (t[n] === void 0 || A(e[n], t[n]) !== 0)
706
706
  return !1;
707
707
  return !0;
708
708
  }
709
- function B({
709
+ function U({
710
710
  layout: e,
711
711
  panelConstraints: t
712
712
  }) {
713
713
  const n = Object.values(e), o = [...n], i = o.reduce(
714
- (r, a) => r + a,
714
+ (a, s) => a + s,
715
715
  0
716
716
  );
717
717
  if (o.length !== t.length)
718
718
  throw Error(
719
- `Invalid ${t.length} panel layout: ${o.map((r) => `${r}%`).join(", ")}`
719
+ `Invalid ${t.length} panel layout: ${o.map((a) => `${a}%`).join(", ")}`
720
720
  );
721
- if (!D(i, 100) && o.length > 0)
722
- for (let r = 0; r < t.length; r++) {
723
- const a = o[r];
724
- C(a != null, `No layout data found for index ${r}`);
725
- const c = 100 / i * a;
726
- o[r] = c;
721
+ if (!I(i, 100) && o.length > 0)
722
+ for (let a = 0; a < t.length; a++) {
723
+ const s = o[a];
724
+ C(s != null, `No layout data found for index ${a}`);
725
+ const l = 100 / i * s;
726
+ o[a] = l;
727
727
  }
728
- let s = 0;
729
- for (let r = 0; r < t.length; r++) {
730
- const a = n[r];
731
- C(a != null, `No layout data found for index ${r}`);
732
- const c = o[r];
733
- C(c != null, `No layout data found for index ${r}`);
734
- const f = Y({
728
+ let r = 0;
729
+ for (let a = 0; a < t.length; a++) {
730
+ const s = n[a];
731
+ C(s != null, `No layout data found for index ${a}`);
732
+ const l = o[a];
733
+ C(l != null, `No layout data found for index ${a}`);
734
+ const u = Z({
735
735
  overrideDisabledPanels: !0,
736
- panelConstraints: t[r],
737
- prevSize: a,
738
- size: c
736
+ panelConstraints: t[a],
737
+ prevSize: s,
738
+ size: l
739
739
  });
740
- c != f && (s += c - f, o[r] = f);
740
+ l != u && (r += l - u, o[a] = u);
741
741
  }
742
- if (!D(s, 0))
743
- for (let r = 0; r < t.length; r++) {
744
- const a = o[r];
745
- C(a != null, `No layout data found for index ${r}`);
746
- const c = a + s, f = Y({
742
+ if (!I(r, 0))
743
+ for (let a = 0; a < t.length; a++) {
744
+ const s = o[a];
745
+ C(s != null, `No layout data found for index ${a}`);
746
+ const l = s + r, u = Z({
747
747
  overrideDisabledPanels: !0,
748
- panelConstraints: t[r],
749
- prevSize: a,
750
- size: c
748
+ panelConstraints: t[a],
749
+ prevSize: s,
750
+ size: l
751
751
  });
752
- if (a !== f && (s -= f - a, o[r] = f, D(s, 0)))
752
+ if (s !== u && (r -= u - s, o[a] = u, I(r, 0)))
753
753
  break;
754
754
  }
755
- const l = Object.keys(e);
756
- return o.reduce((r, a, c) => (r[l[c]] = a, r), {});
755
+ const f = Object.keys(e);
756
+ return o.reduce((a, s, l) => (a[f[l]] = s, a), {});
757
757
  }
758
- function et({
758
+ function tt({
759
759
  groupId: e,
760
760
  panelId: t
761
761
  }) {
762
762
  const n = () => {
763
- const r = U();
763
+ const s = X();
764
764
  for (const [
765
- a,
765
+ l,
766
766
  {
767
- defaultLayoutDeferred: c,
768
- derivedPanelConstraints: f,
769
- layout: g,
770
- groupSize: d,
767
+ defaultLayoutDeferred: u,
768
+ derivedPanelConstraints: h,
769
+ layout: d,
770
+ groupSize: S,
771
771
  separatorToPanels: z
772
772
  }
773
- ] of r)
774
- if (a.id === e)
773
+ ] of s)
774
+ if (l.id === e)
775
775
  return {
776
- defaultLayoutDeferred: c,
777
- derivedPanelConstraints: f,
778
- group: a,
779
- groupSize: d,
780
- layout: g,
776
+ defaultLayoutDeferred: u,
777
+ derivedPanelConstraints: h,
778
+ group: l,
779
+ groupSize: S,
780
+ layout: d,
781
781
  separatorToPanels: z
782
782
  };
783
783
  throw Error(`Group ${e} not found`);
784
784
  }, o = () => {
785
- const r = n().derivedPanelConstraints.find(
786
- (a) => a.panelId === t
785
+ const s = n().derivedPanelConstraints.find(
786
+ (l) => l.panelId === t
787
787
  );
788
- if (r !== void 0)
789
- return r;
788
+ if (s !== void 0)
789
+ return s;
790
790
  throw Error(`Panel constraints not found for Panel ${t}`);
791
791
  }, i = () => {
792
- const r = n().group.panels.find((a) => a.id === t);
793
- if (r !== void 0)
794
- return r;
792
+ const s = n().group.panels.find((l) => l.id === t);
793
+ if (s !== void 0)
794
+ return s;
795
795
  throw Error(`Layout not found for Panel ${t}`);
796
- }, s = () => {
797
- const r = n().layout[t];
798
- if (r !== void 0)
799
- return r;
796
+ }, r = () => {
797
+ const s = n().layout[t];
798
+ if (s !== void 0)
799
+ return s;
800
800
  throw Error(`Layout not found for Panel ${t}`);
801
- }, l = (r) => {
802
- const a = s();
803
- if (r === a)
801
+ }, f = ({
802
+ nextSize: s,
803
+ panels: l,
804
+ prevLayout: u,
805
+ derivedPanelConstraints: h
806
+ }) => {
807
+ const d = r(), S = l.findIndex((m) => m.id === t), z = S === 0, c = S === l.length - 1;
808
+ if (c && s < d && (z || l.slice(0, S).every((m, v) => {
809
+ const b = h[v];
810
+ return b?.collapsible && I(b.collapsedSize, u[b.panelId]);
811
+ }))) {
812
+ const m = l.slice(0, S).reduce((v, b) => v + u[b.id], 0);
813
+ return {
814
+ ...u,
815
+ [t]: O(100 - m)
816
+ };
817
+ }
818
+ return le({
819
+ delta: c ? d - s : s - d,
820
+ initialLayout: u,
821
+ panelConstraints: h,
822
+ pivotIndices: c ? [S - 1, S] : [S, S + 1],
823
+ prevLayout: u,
824
+ trigger: "imperative-api"
825
+ });
826
+ }, a = (s) => {
827
+ const l = r();
828
+ if (s === l)
804
829
  return;
805
830
  const {
806
- defaultLayoutDeferred: c,
807
- derivedPanelConstraints: f,
808
- group: g,
809
- groupSize: d,
831
+ defaultLayoutDeferred: u,
832
+ derivedPanelConstraints: h,
833
+ group: d,
834
+ groupSize: S,
810
835
  layout: z,
811
- separatorToPanels: b
812
- } = n(), u = g.panels.findIndex((v) => v.id === t), p = u === g.panels.length - 1, m = se({
813
- delta: p ? a - r : r - a,
814
- initialLayout: z,
815
- panelConstraints: f,
816
- pivotIndices: p ? [u - 1, u] : [u, u + 1],
836
+ separatorToPanels: c
837
+ } = n(), p = f({
838
+ nextSize: s,
839
+ panels: d.panels,
817
840
  prevLayout: z,
818
- trigger: "imperative-api"
819
- }), S = B({
820
- layout: m,
821
- panelConstraints: f
841
+ derivedPanelConstraints: h
842
+ }), m = U({
843
+ layout: p,
844
+ panelConstraints: h
822
845
  });
823
- V(z, S) || _(g, {
824
- defaultLayoutDeferred: c,
825
- derivedPanelConstraints: f,
826
- groupSize: d,
827
- layout: S,
828
- separatorToPanels: b
846
+ W(z, m) || $(d, {
847
+ defaultLayoutDeferred: u,
848
+ derivedPanelConstraints: h,
849
+ groupSize: S,
850
+ layout: m,
851
+ separatorToPanels: c
829
852
  });
830
853
  };
831
854
  return {
832
855
  collapse: () => {
833
- const { collapsible: r, collapsedSize: a } = o(), { mutableValues: c } = i(), f = s();
834
- r && f !== a && (c.expandToSize = f, l(a));
856
+ const { collapsible: s, collapsedSize: l } = o(), { mutableValues: u } = i(), h = r();
857
+ s && h !== l && (u.expandToSize = h, a(l));
835
858
  },
836
859
  expand: () => {
837
- const { collapsible: r, collapsedSize: a, minSize: c } = o(), { mutableValues: f } = i(), g = s();
838
- if (r && g === a) {
839
- let d = f.expandToSize ?? c;
840
- d === 0 && (d = 1), l(d);
860
+ const { collapsible: s, collapsedSize: l, minSize: u } = o(), { mutableValues: h } = i(), d = r();
861
+ if (s && d === l) {
862
+ let S = h.expandToSize ?? u;
863
+ S === 0 && (S = 1), a(S);
841
864
  }
842
865
  },
843
866
  getSize: () => {
844
- const { group: r } = n(), a = s(), { element: c } = i(), f = r.orientation === "horizontal" ? c.offsetWidth : c.offsetHeight;
867
+ const { group: s } = n(), l = r(), { element: u } = i(), h = s.orientation === "horizontal" ? u.offsetWidth : u.offsetHeight;
845
868
  return {
846
- asPercentage: a,
847
- inPixels: f
869
+ asPercentage: l,
870
+ inPixels: h
848
871
  };
849
872
  },
850
873
  isCollapsed: () => {
851
- const { collapsible: r, collapsedSize: a } = o(), c = s();
852
- return r && D(a, c);
874
+ const { collapsible: s, collapsedSize: l } = o(), u = r();
875
+ return s && I(l, u);
853
876
  },
854
- resize: (r) => {
855
- const { group: a } = n(), { element: c } = i(), f = Q({ group: a }), g = te({
856
- groupSize: f,
857
- panelElement: c,
858
- styleProp: r
859
- }), d = T(g / f * 100);
860
- l(d);
877
+ resize: (s) => {
878
+ const { group: l } = n(), { element: u } = i(), h = ne({ group: l }), d = ie({
879
+ groupSize: h,
880
+ panelElement: u,
881
+ styleProp: s
882
+ }), S = O(d / h * 100);
883
+ a(S);
861
884
  }
862
885
  };
863
886
  }
864
887
  function Te(e) {
865
888
  if (e.defaultPrevented)
866
889
  return;
867
- const t = U();
868
- be(e, t).forEach((o) => {
890
+ const t = X();
891
+ xe(e, t).forEach((o) => {
869
892
  if (o.separator && !o.separator.disableDoubleClick) {
870
893
  const i = o.panels.find(
871
- (s) => s.panelConstraints.defaultSize !== void 0
894
+ (r) => r.panelConstraints.defaultSize !== void 0
872
895
  );
873
896
  if (i) {
874
- const s = i.panelConstraints.defaultSize, l = et({
897
+ const r = i.panelConstraints.defaultSize, f = tt({
875
898
  groupId: o.group.id,
876
899
  panelId: i.id
877
900
  });
878
- l && s !== void 0 && (l.resize(s), e.preventDefault());
901
+ f && r !== void 0 && (f.resize(r), e.preventDefault());
879
902
  }
880
903
  }
881
904
  });
882
905
  }
883
- function de(e) {
884
- const t = U();
906
+ function pe(e) {
907
+ const t = X();
885
908
  for (const [n] of t)
886
909
  if (n.separators.some(
887
910
  (o) => o.element === e
@@ -889,11 +912,11 @@ function de(e) {
889
912
  return n;
890
913
  throw Error("Could not find parent Group for separator element");
891
914
  }
892
- function tt({
915
+ function nt({
893
916
  groupId: e
894
917
  }) {
895
918
  const t = () => {
896
- const n = U();
919
+ const n = X();
897
920
  for (const [o, i] of n)
898
921
  if (o.id === e)
899
922
  return { group: o, ...i };
@@ -908,152 +931,154 @@ function tt({
908
931
  const {
909
932
  defaultLayoutDeferred: o,
910
933
  derivedPanelConstraints: i,
911
- group: s,
912
- groupSize: l,
913
- layout: r,
914
- separatorToPanels: a
915
- } = t(), c = B({
934
+ group: r,
935
+ groupSize: f,
936
+ layout: a,
937
+ separatorToPanels: s
938
+ } = t(), l = U({
916
939
  layout: n,
917
940
  panelConstraints: i
918
941
  });
919
- return o ? r : (V(r, c) || _(s, {
942
+ return o ? a : (W(a, l) || $(r, {
920
943
  defaultLayoutDeferred: o,
921
944
  derivedPanelConstraints: i,
922
- groupSize: l,
923
- layout: c,
924
- separatorToPanels: a
925
- }), c);
945
+ groupSize: f,
946
+ layout: l,
947
+ separatorToPanels: s
948
+ }), l);
926
949
  }
927
950
  };
928
951
  }
929
- function H(e, t) {
930
- const n = de(e), o = j(n.id, !0), i = n.separators.find(
931
- (g) => g.element === e
952
+ function B(e, t) {
953
+ const n = pe(e), o = H(n.id, !0), i = n.separators.find(
954
+ (h) => h.element === e
932
955
  );
933
956
  C(i, "Matching separator not found");
934
- const s = o.separatorToPanels.get(i);
935
- C(s, "Matching panels not found");
936
- const l = s.map((g) => n.panels.indexOf(g)), a = tt({ groupId: n.id }).getLayout(), c = se({
957
+ const r = o.separatorToPanels.get(i);
958
+ C(r, "Matching panels not found");
959
+ const f = r.map((h) => n.panels.indexOf(h)), s = nt({ groupId: n.id }).getLayout(), l = le({
937
960
  delta: t,
938
- initialLayout: a,
961
+ initialLayout: s,
939
962
  panelConstraints: o.derivedPanelConstraints,
940
- pivotIndices: l,
941
- prevLayout: a,
963
+ pivotIndices: f,
964
+ prevLayout: s,
942
965
  trigger: "keyboard"
943
- }), f = B({
944
- layout: c,
966
+ }), u = U({
967
+ layout: l,
945
968
  panelConstraints: o.derivedPanelConstraints
946
969
  });
947
- V(a, f) || _(n, {
970
+ W(s, u) || $(n, {
948
971
  defaultLayoutDeferred: o.defaultLayoutDeferred,
949
972
  derivedPanelConstraints: o.derivedPanelConstraints,
950
973
  groupSize: o.groupSize,
951
- layout: f,
974
+ layout: u,
952
975
  separatorToPanels: o.separatorToPanels
953
976
  });
954
977
  }
955
- function Oe(e) {
978
+ function Ge(e) {
956
979
  if (e.defaultPrevented)
957
980
  return;
958
- const t = e.currentTarget, n = de(t);
981
+ const t = e.currentTarget, n = pe(t);
959
982
  if (!n.disabled)
960
983
  switch (e.key) {
961
984
  case "ArrowDown": {
962
- e.preventDefault(), n.orientation === "vertical" && H(t, 5);
985
+ e.preventDefault(), n.orientation === "vertical" && B(t, 5);
963
986
  break;
964
987
  }
965
988
  case "ArrowLeft": {
966
- e.preventDefault(), n.orientation === "horizontal" && H(t, -5);
989
+ e.preventDefault(), n.orientation === "horizontal" && B(t, -5);
967
990
  break;
968
991
  }
969
992
  case "ArrowRight": {
970
- e.preventDefault(), n.orientation === "horizontal" && H(t, 5);
993
+ e.preventDefault(), n.orientation === "horizontal" && B(t, 5);
971
994
  break;
972
995
  }
973
996
  case "ArrowUp": {
974
- e.preventDefault(), n.orientation === "vertical" && H(t, -5);
997
+ e.preventDefault(), n.orientation === "vertical" && B(t, -5);
975
998
  break;
976
999
  }
977
1000
  case "End": {
978
- e.preventDefault(), H(t, 100);
1001
+ e.preventDefault(), B(t, 100);
979
1002
  break;
980
1003
  }
981
1004
  case "Enter": {
982
1005
  e.preventDefault();
983
- const o = de(t), i = j(o.id, !0), { derivedPanelConstraints: s, layout: l, separatorToPanels: r } = i, a = o.separators.find(
1006
+ const o = pe(t), i = H(o.id, !0), { derivedPanelConstraints: r, layout: f, separatorToPanels: a } = i, s = o.separators.find(
984
1007
  (d) => d.element === t
985
1008
  );
986
- C(a, "Matching separator not found");
987
- const c = r.get(a);
988
- C(c, "Matching panels not found");
989
- const f = c[0], g = s.find(
990
- (d) => d.panelId === f.id
1009
+ C(s, "Matching separator not found");
1010
+ const l = a.get(s);
1011
+ C(l, "Matching panels not found");
1012
+ const u = l[0], h = r.find(
1013
+ (d) => d.panelId === u.id
991
1014
  );
992
- if (C(g, "Panel metadata not found"), g.collapsible) {
993
- const d = l[f.id], z = g.collapsedSize === d ? o.mutableState.expandedPanelSizes[f.id] ?? g.minSize : g.collapsedSize;
994
- H(t, z - d);
1015
+ if (C(h, "Panel metadata not found"), h.collapsible) {
1016
+ const d = f[u.id], S = h.collapsedSize === d ? o.mutableState.expandedPanelSizes[u.id] ?? h.minSize : h.collapsedSize;
1017
+ B(t, S - d);
995
1018
  }
996
1019
  break;
997
1020
  }
998
1021
  case "F6": {
999
1022
  e.preventDefault();
1000
- const i = de(t).separators.map(
1001
- (a) => a.element
1002
- ), s = Array.from(i).findIndex(
1003
- (a) => a === e.currentTarget
1023
+ const i = pe(t).separators.map(
1024
+ (s) => s.element
1025
+ ), r = Array.from(i).findIndex(
1026
+ (s) => s === e.currentTarget
1004
1027
  );
1005
- C(s !== null, "Index not found");
1006
- const l = e.shiftKey ? s > 0 ? s - 1 : i.length - 1 : s + 1 < i.length ? s + 1 : 0;
1007
- i[l].focus({
1028
+ C(r !== null, "Index not found");
1029
+ const f = e.shiftKey ? r > 0 ? r - 1 : i.length - 1 : r + 1 < i.length ? r + 1 : 0;
1030
+ i[f].focus({
1008
1031
  preventScroll: !0
1009
1032
  });
1010
1033
  break;
1011
1034
  }
1012
1035
  case "Home": {
1013
- e.preventDefault(), H(t, -100);
1036
+ e.preventDefault(), B(t, -100);
1014
1037
  break;
1015
1038
  }
1016
1039
  }
1017
1040
  }
1018
- let J = {
1041
+ let ee = {
1019
1042
  cursorFlags: 0,
1020
1043
  state: "inactive"
1021
1044
  };
1022
- const xe = new Je();
1023
- function W() {
1024
- return J;
1045
+ const Pe = new Ze();
1046
+ function K() {
1047
+ return ee;
1025
1048
  }
1026
1049
  function Gt(e) {
1027
- return xe.addListener("change", e);
1050
+ return Pe.addListener("change", e);
1028
1051
  }
1029
1052
  function At(e) {
1030
- const t = J, n = { ...J };
1031
- n.cursorFlags = e, J = n, xe.emit("change", {
1053
+ const t = ee, n = { ...ee };
1054
+ n.cursorFlags = e, ee = n, Pe.emit("change", {
1032
1055
  prev: t,
1033
1056
  next: n
1034
1057
  });
1035
1058
  }
1036
- function Z(e) {
1037
- const t = J;
1038
- J = e, xe.emit("change", {
1059
+ function te(e) {
1060
+ const t = ee;
1061
+ ee = e, Pe.emit("change", {
1039
1062
  prev: t,
1040
1063
  next: e
1041
1064
  });
1042
1065
  }
1043
- function Ge(e) {
1066
+ function Ae(e) {
1044
1067
  if (e.defaultPrevented)
1045
1068
  return;
1046
1069
  if (e.pointerType === "mouse" && e.button > 0)
1047
1070
  return;
1048
- const t = U(), n = be(e, t), o = /* @__PURE__ */ new Map();
1071
+ const t = X(), n = xe(e, t), o = /* @__PURE__ */ new Map();
1049
1072
  let i = !1;
1050
- n.forEach((s) => {
1051
- s.separator && (i || (i = !0, s.separator.element.focus({
1073
+ n.forEach((r) => {
1074
+ r.separator && (i || (i = !0, r.separator.element.focus({
1075
+ // @ts-expect-error https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#browser_compatibility
1076
+ focusVisible: !1,
1052
1077
  preventScroll: !0
1053
1078
  })));
1054
- const l = t.get(s.group);
1055
- l && o.set(s.group, l.layout);
1056
- }), Z({
1079
+ const f = t.get(r.group);
1080
+ f && o.set(r.group, f.layout);
1081
+ }), te({
1057
1082
  cursorFlags: 0,
1058
1083
  hitRegions: n,
1059
1084
  initialLayoutMap: o,
@@ -1061,13 +1086,13 @@ function Ge(e) {
1061
1086
  state: "active"
1062
1087
  }), n.length && e.preventDefault();
1063
1088
  }
1064
- const Nt = (e) => e, ge = () => {
1065
- }, nt = 1, ot = 2, it = 4, rt = 8, Ae = 3, Ne = 12;
1066
- let fe;
1089
+ const Ft = (e) => e, ye = () => {
1090
+ }, ot = 1, it = 2, rt = 4, st = 8, Fe = 3, Ne = 12;
1091
+ let de;
1067
1092
  function _e() {
1068
- return fe === void 0 && (fe = !1, typeof window < "u" && (window.navigator.userAgent.includes("Chrome") || window.navigator.userAgent.includes("Firefox")) && (fe = !0)), fe;
1093
+ return de === void 0 && (de = !1, typeof window < "u" && (window.navigator.userAgent.includes("Chrome") || window.navigator.userAgent.includes("Firefox")) && (de = !0)), de;
1069
1094
  }
1070
- function _t({
1095
+ function Nt({
1071
1096
  cursorFlags: e,
1072
1097
  groups: t,
1073
1098
  state: n
@@ -1076,9 +1101,9 @@ function _t({
1076
1101
  switch (n) {
1077
1102
  case "active":
1078
1103
  case "hover":
1079
- t.forEach((s) => {
1080
- if (!s.mutableState.disableCursor)
1081
- switch (s.orientation) {
1104
+ t.forEach((r) => {
1105
+ if (!r.mutableState.disableCursor)
1106
+ switch (r.orientation) {
1082
1107
  case "horizontal": {
1083
1108
  o++;
1084
1109
  break;
@@ -1094,14 +1119,14 @@ function _t({
1094
1119
  switch (n) {
1095
1120
  case "active": {
1096
1121
  if (e && _e()) {
1097
- const s = (e & nt) !== 0, l = (e & ot) !== 0, r = (e & it) !== 0, a = (e & rt) !== 0;
1098
- if (s)
1099
- return r ? "se-resize" : a ? "ne-resize" : "e-resize";
1100
- if (l)
1101
- return r ? "sw-resize" : a ? "nw-resize" : "w-resize";
1122
+ const r = (e & ot) !== 0, f = (e & it) !== 0, a = (e & rt) !== 0, s = (e & st) !== 0;
1102
1123
  if (r)
1103
- return "s-resize";
1124
+ return a ? "se-resize" : s ? "ne-resize" : "e-resize";
1125
+ if (f)
1126
+ return a ? "sw-resize" : s ? "nw-resize" : "w-resize";
1104
1127
  if (a)
1128
+ return "s-resize";
1129
+ if (s)
1105
1130
  return "n-resize";
1106
1131
  }
1107
1132
  break;
@@ -1110,24 +1135,27 @@ function _t({
1110
1135
  return _e() ? o > 0 && i > 0 ? "move" : o > 0 ? "ew-resize" : "ns-resize" : o > 0 && i > 0 ? "grab" : o > 0 ? "col-resize" : "row-resize";
1111
1136
  }
1112
1137
  }
1113
- const Fe = /* @__PURE__ */ new WeakMap();
1138
+ const $e = /* @__PURE__ */ new WeakMap();
1114
1139
  function we(e) {
1115
1140
  if (e.defaultView === null || e.defaultView === void 0)
1116
1141
  return;
1117
- let { prevStyle: t, styleSheet: n } = Fe.get(e) ?? {};
1118
- n === void 0 && (n = new e.defaultView.CSSStyleSheet(), e.adoptedStyleSheets && e.adoptedStyleSheets.push(n));
1119
- const o = W();
1142
+ let { prevStyle: t, styleSheet: n } = $e.get(e) ?? {};
1143
+ n === void 0 && (n = new e.defaultView.CSSStyleSheet(), e.adoptedStyleSheets && (Object.isExtensible(e.adoptedStyleSheets) ? e.adoptedStyleSheets.push(n) : e.adoptedStyleSheets = [
1144
+ ...e.adoptedStyleSheets,
1145
+ n
1146
+ ]));
1147
+ const o = K();
1120
1148
  switch (o.state) {
1121
1149
  case "active":
1122
1150
  case "hover": {
1123
- const i = _t({
1151
+ const i = Nt({
1124
1152
  cursorFlags: o.cursorFlags,
1125
- groups: o.hitRegions.map((l) => l.group),
1153
+ groups: o.hitRegions.map((f) => f.group),
1126
1154
  state: o.state
1127
- }), s = `*, *:hover {cursor: ${i} !important; }`;
1128
- if (t === s)
1155
+ }), r = `*, *:hover {cursor: ${i} !important; }`;
1156
+ if (t === r)
1129
1157
  return;
1130
- t = s, i ? n.cssRules.length === 0 ? n.insertRule(s) : n.replaceSync(s) : n.cssRules.length === 1 && n.deleteRule(0);
1158
+ t = r, i ? n.cssRules.length === 0 ? n.insertRule(r) : n.replaceSync(r) : n.cssRules.length === 1 && n.deleteRule(0);
1131
1159
  break;
1132
1160
  }
1133
1161
  case "inactive": {
@@ -1135,74 +1163,74 @@ function we(e) {
1135
1163
  break;
1136
1164
  }
1137
1165
  }
1138
- Fe.set(e, {
1166
+ $e.set(e, {
1139
1167
  prevStyle: t,
1140
1168
  styleSheet: n
1141
1169
  });
1142
1170
  }
1143
- function st({
1171
+ function at({
1144
1172
  document: e,
1145
1173
  event: t,
1146
1174
  hitRegions: n,
1147
1175
  initialLayoutMap: o,
1148
1176
  mountedGroups: i,
1149
- pointerDownAtPoint: s,
1150
- prevCursorFlags: l
1177
+ pointerDownAtPoint: r,
1178
+ prevCursorFlags: f
1151
1179
  }) {
1152
- let r = 0;
1153
- n.forEach((c) => {
1154
- const { group: f, groupSize: g } = c, { orientation: d, panels: z } = f, { disableCursor: b } = f.mutableState;
1155
- let u = 0;
1156
- s ? d === "horizontal" ? u = (t.clientX - s.x) / g * 100 : u = (t.clientY - s.y) / g * 100 : d === "horizontal" ? u = t.clientX < 0 ? -100 : 100 : u = t.clientY < 0 ? -100 : 100;
1157
- const p = o.get(f), m = i.get(f);
1180
+ let a = 0;
1181
+ n.forEach((l) => {
1182
+ const { group: u, groupSize: h } = l, { orientation: d, panels: S } = u, { disableCursor: z } = u.mutableState;
1183
+ let c = 0;
1184
+ r ? d === "horizontal" ? c = (t.clientX - r.x) / h * 100 : c = (t.clientY - r.y) / h * 100 : d === "horizontal" ? c = t.clientX < 0 ? -100 : 100 : c = t.clientY < 0 ? -100 : 100;
1185
+ const p = o.get(u), m = i.get(u);
1158
1186
  if (!p || !m)
1159
1187
  return;
1160
1188
  const {
1161
- defaultLayoutDeferred: S,
1162
- derivedPanelConstraints: v,
1189
+ defaultLayoutDeferred: v,
1190
+ derivedPanelConstraints: b,
1163
1191
  groupSize: y,
1164
- layout: h,
1192
+ layout: g,
1165
1193
  separatorToPanels: P
1166
1194
  } = m;
1167
- if (v && h && P) {
1168
- const M = se({
1169
- delta: u,
1195
+ if (b && g && P) {
1196
+ const M = le({
1197
+ delta: c,
1170
1198
  initialLayout: p,
1171
- panelConstraints: v,
1172
- pivotIndices: c.panels.map((L) => z.indexOf(L)),
1173
- prevLayout: h,
1199
+ panelConstraints: b,
1200
+ pivotIndices: l.panels.map((w) => S.indexOf(w)),
1201
+ prevLayout: g,
1174
1202
  trigger: "mouse-or-touch"
1175
1203
  });
1176
- if (V(M, h)) {
1177
- if (u !== 0 && !b)
1204
+ if (W(M, g)) {
1205
+ if (c !== 0 && !z)
1178
1206
  switch (d) {
1179
1207
  case "horizontal": {
1180
- r |= u < 0 ? nt : ot;
1208
+ a |= c < 0 ? ot : it;
1181
1209
  break;
1182
1210
  }
1183
1211
  case "vertical": {
1184
- r |= u < 0 ? it : rt;
1212
+ a |= c < 0 ? rt : st;
1185
1213
  break;
1186
1214
  }
1187
1215
  }
1188
1216
  } else
1189
- _(c.group, {
1190
- defaultLayoutDeferred: S,
1191
- derivedPanelConstraints: v,
1217
+ $(l.group, {
1218
+ defaultLayoutDeferred: v,
1219
+ derivedPanelConstraints: b,
1192
1220
  groupSize: y,
1193
1221
  layout: M,
1194
1222
  separatorToPanels: P
1195
1223
  });
1196
1224
  }
1197
1225
  });
1198
- let a = 0;
1199
- t.movementX === 0 ? a |= l & Ae : a |= r & Ae, t.movementY === 0 ? a |= l & Ne : a |= r & Ne, At(a), we(e);
1226
+ let s = 0;
1227
+ t.movementX === 0 ? s |= f & Fe : s |= a & Fe, t.movementY === 0 ? s |= f & Ne : s |= a & Ne, At(s), we(e);
1200
1228
  }
1201
- function $e(e) {
1202
- const t = U(), n = W();
1229
+ function je(e) {
1230
+ const t = X(), n = K();
1203
1231
  switch (n.state) {
1204
1232
  case "active":
1205
- st({
1233
+ at({
1206
1234
  document: e.currentTarget,
1207
1235
  event: e,
1208
1236
  hitRegions: n.hitRegions,
@@ -1212,22 +1240,22 @@ function $e(e) {
1212
1240
  });
1213
1241
  }
1214
1242
  }
1215
- function je(e) {
1243
+ function He(e) {
1216
1244
  if (e.defaultPrevented)
1217
1245
  return;
1218
- const t = W(), n = U();
1246
+ const t = K(), n = X();
1219
1247
  switch (t.state) {
1220
1248
  case "active": {
1221
1249
  if (
1222
1250
  // Skip this check for "pointerleave" events, else Firefox triggers a false positive (see #514)
1223
1251
  e.buttons === 0
1224
1252
  ) {
1225
- Z({
1253
+ te({
1226
1254
  cursorFlags: 0,
1227
1255
  state: "inactive"
1228
1256
  }), t.hitRegions.forEach((o) => {
1229
- const i = j(o.group.id, !0);
1230
- _(o.group, i);
1257
+ const i = H(o.group.id, !0);
1258
+ $(o.group, i);
1231
1259
  });
1232
1260
  return;
1233
1261
  }
@@ -1236,7 +1264,7 @@ function je(e) {
1236
1264
  const { element: i } = o.separator;
1237
1265
  i.hasPointerCapture?.(e.pointerId) || i.setPointerCapture?.(e.pointerId);
1238
1266
  }
1239
- st({
1267
+ at({
1240
1268
  document: e.currentTarget,
1241
1269
  event: e,
1242
1270
  hitRegions: t.hitRegions,
@@ -1248,11 +1276,11 @@ function je(e) {
1248
1276
  break;
1249
1277
  }
1250
1278
  default: {
1251
- const o = be(e, n);
1252
- o.length === 0 ? t.state !== "inactive" && Z({
1279
+ const o = xe(e, n);
1280
+ o.length === 0 ? t.state !== "inactive" && te({
1253
1281
  cursorFlags: 0,
1254
1282
  state: "inactive"
1255
- }) : Z({
1283
+ }) : te({
1256
1284
  cursorFlags: 0,
1257
1285
  hitRegions: o,
1258
1286
  state: "hover"
@@ -1261,62 +1289,62 @@ function je(e) {
1261
1289
  }
1262
1290
  }
1263
1291
  }
1264
- function He(e) {
1292
+ function Ve(e) {
1265
1293
  if (e.relatedTarget instanceof HTMLIFrameElement)
1266
- switch (W().state) {
1294
+ switch (K().state) {
1267
1295
  case "hover":
1268
- Z({
1296
+ te({
1269
1297
  cursorFlags: 0,
1270
1298
  state: "inactive"
1271
1299
  });
1272
1300
  }
1273
1301
  }
1274
- function Ve(e) {
1302
+ function Be(e) {
1275
1303
  if (e.defaultPrevented)
1276
1304
  return;
1277
1305
  if (e.pointerType === "mouse" && e.button > 0)
1278
1306
  return;
1279
- const t = W();
1307
+ const t = K();
1280
1308
  switch (t.state) {
1281
1309
  case "active":
1282
- Z({
1310
+ te({
1283
1311
  cursorFlags: 0,
1284
1312
  state: "inactive"
1285
1313
  }), t.hitRegions.length > 0 && (we(e.currentTarget), t.hitRegions.forEach((n) => {
1286
- const o = j(n.group.id, !0);
1287
- _(n.group, o);
1314
+ const o = H(n.group.id, !0);
1315
+ $(n.group, o);
1288
1316
  }), e.preventDefault());
1289
1317
  }
1290
1318
  }
1291
- function Be(e) {
1319
+ function We(e) {
1292
1320
  let t = 0, n = 0;
1293
1321
  const o = {};
1294
- for (const s of e)
1295
- if (s.defaultSize !== void 0) {
1322
+ for (const r of e)
1323
+ if (r.defaultSize !== void 0) {
1296
1324
  t++;
1297
- const l = T(s.defaultSize);
1298
- n += l, o[s.panelId] = l;
1325
+ const f = O(r.defaultSize);
1326
+ n += f, o[r.panelId] = f;
1299
1327
  } else
1300
- o[s.panelId] = void 0;
1328
+ o[r.panelId] = void 0;
1301
1329
  const i = e.length - t;
1302
1330
  if (i !== 0) {
1303
- const s = T((100 - n) / i);
1304
- for (const l of e)
1305
- l.defaultSize === void 0 && (o[l.panelId] = s);
1331
+ const r = O((100 - n) / i);
1332
+ for (const f of e)
1333
+ f.defaultSize === void 0 && (o[f.panelId] = r);
1306
1334
  }
1307
1335
  return o;
1308
1336
  }
1309
- function Ft(e, t, n) {
1337
+ function _t(e, t, n) {
1310
1338
  if (!n[0])
1311
1339
  return;
1312
- const i = e.panels.find((c) => c.element === t);
1340
+ const i = e.panels.find((l) => l.element === t);
1313
1341
  if (!i || !i.onResize)
1314
1342
  return;
1315
- const s = Q({ group: e }), l = e.orientation === "horizontal" ? i.element.offsetWidth : i.element.offsetHeight, r = i.mutableValues.prevSize, a = {
1316
- asPercentage: T(l / s * 100),
1317
- inPixels: l
1343
+ const r = ne({ group: e }), f = e.orientation === "horizontal" ? i.element.offsetWidth : i.element.offsetHeight, a = i.mutableValues.prevSize, s = {
1344
+ asPercentage: O(f / r * 100),
1345
+ inPixels: f
1318
1346
  };
1319
- i.mutableValues.prevSize = a, i.onResize(a, i.id, r);
1347
+ i.mutableValues.prevSize = s, i.onResize(s, i.id, a);
1320
1348
  }
1321
1349
  function $t(e, t) {
1322
1350
  if (Object.keys(e).length !== Object.keys(t).length)
@@ -1334,46 +1362,46 @@ function jt({
1334
1362
  }) {
1335
1363
  if (n <= 0 || t <= 0 || n === t)
1336
1364
  return o;
1337
- let i = 0, s = 0, l = !1;
1338
- const r = /* @__PURE__ */ new Map(), a = [];
1339
- for (const g of e.panels) {
1340
- const d = o[g.id] ?? 0;
1341
- switch (g.panelConstraints.groupResizeBehavior) {
1365
+ let i = 0, r = 0, f = !1;
1366
+ const a = /* @__PURE__ */ new Map(), s = [];
1367
+ for (const h of e.panels) {
1368
+ const d = o[h.id] ?? 0;
1369
+ switch (h.panelConstraints.groupResizeBehavior) {
1342
1370
  case "preserve-pixel-size": {
1343
- l = !0;
1344
- const z = d / 100 * n, b = T(
1345
- z / t * 100
1371
+ f = !0;
1372
+ const S = d / 100 * n, z = O(
1373
+ S / t * 100
1346
1374
  );
1347
- r.set(g.id, b), i += b;
1375
+ a.set(h.id, z), i += z;
1348
1376
  break;
1349
1377
  }
1350
1378
  case "preserve-relative-size":
1351
1379
  default: {
1352
- a.push(g.id), s += d;
1380
+ s.push(h.id), r += d;
1353
1381
  break;
1354
1382
  }
1355
1383
  }
1356
1384
  }
1357
- if (!l || a.length === 0)
1385
+ if (!f || s.length === 0)
1358
1386
  return o;
1359
- const c = 100 - i, f = { ...o };
1360
- if (r.forEach((g, d) => {
1361
- f[d] = g;
1362
- }), s > 0)
1363
- for (const g of a) {
1364
- const d = o[g] ?? 0;
1365
- f[g] = T(
1366
- d / s * c
1387
+ const l = 100 - i, u = { ...o };
1388
+ if (a.forEach((h, d) => {
1389
+ u[d] = h;
1390
+ }), r > 0)
1391
+ for (const h of s) {
1392
+ const d = o[h] ?? 0;
1393
+ u[h] = O(
1394
+ d / r * l
1367
1395
  );
1368
1396
  }
1369
1397
  else {
1370
- const g = T(
1371
- c / a.length
1398
+ const h = O(
1399
+ l / s.length
1372
1400
  );
1373
- for (const d of a)
1374
- f[d] = g;
1401
+ for (const d of s)
1402
+ u[d] = h;
1375
1403
  }
1376
- return f;
1404
+ return u;
1377
1405
  }
1378
1406
  function Ht(e, t) {
1379
1407
  const n = e.map((i) => i.id), o = Object.keys(t);
@@ -1384,118 +1412,118 @@ function Ht(e, t) {
1384
1412
  return !1;
1385
1413
  return !0;
1386
1414
  }
1387
- const q = /* @__PURE__ */ new Map();
1415
+ const J = /* @__PURE__ */ new Map();
1388
1416
  function Vt(e) {
1389
1417
  let t = !0;
1390
1418
  C(
1391
1419
  e.element.ownerDocument.defaultView,
1392
1420
  "Cannot register an unmounted Group"
1393
1421
  );
1394
- const n = e.element.ownerDocument.defaultView.ResizeObserver, o = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), s = new n((u) => {
1395
- for (const p of u) {
1396
- const { borderBoxSize: m, target: S } = p;
1397
- if (S === e.element) {
1422
+ const n = e.element.ownerDocument.defaultView.ResizeObserver, o = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), r = new n((c) => {
1423
+ for (const p of c) {
1424
+ const { borderBoxSize: m, target: v } = p;
1425
+ if (v === e.element) {
1398
1426
  if (t) {
1399
- const v = Q({ group: e });
1400
- if (v === 0)
1427
+ const b = ne({ group: e });
1428
+ if (b === 0)
1401
1429
  return;
1402
- const y = j(e.id);
1430
+ const y = H(e.id);
1403
1431
  if (!y)
1404
1432
  return;
1405
- const h = Se(e), P = y.defaultLayoutDeferred ? Be(h) : y.layout, M = jt({
1433
+ const g = ve(e), P = y.defaultLayoutDeferred ? We(g) : y.layout, M = jt({
1406
1434
  group: e,
1407
- nextGroupSize: v,
1435
+ nextGroupSize: b,
1408
1436
  prevGroupSize: y.groupSize,
1409
1437
  prevLayout: P
1410
- }), L = B({
1438
+ }), w = U({
1411
1439
  layout: M,
1412
- panelConstraints: h
1440
+ panelConstraints: g
1413
1441
  });
1414
- if (!y.defaultLayoutDeferred && V(y.layout, L) && $t(
1442
+ if (!y.defaultLayoutDeferred && W(y.layout, w) && $t(
1415
1443
  y.derivedPanelConstraints,
1416
- h
1417
- ) && y.groupSize === v)
1444
+ g
1445
+ ) && y.groupSize === b)
1418
1446
  return;
1419
- _(e, {
1447
+ $(e, {
1420
1448
  defaultLayoutDeferred: !1,
1421
- derivedPanelConstraints: h,
1422
- groupSize: v,
1423
- layout: L,
1449
+ derivedPanelConstraints: g,
1450
+ groupSize: b,
1451
+ layout: w,
1424
1452
  separatorToPanels: y.separatorToPanels
1425
1453
  });
1426
1454
  }
1427
1455
  } else
1428
- Ft(e, S, m);
1456
+ _t(e, v, m);
1429
1457
  }
1430
1458
  });
1431
- s.observe(e.element), e.panels.forEach((u) => {
1459
+ r.observe(e.element), e.panels.forEach((c) => {
1432
1460
  C(
1433
- !o.has(u.id),
1434
- `Panel ids must be unique; id "${u.id}" was used more than once`
1435
- ), o.add(u.id), u.onResize && s.observe(u.element);
1461
+ !o.has(c.id),
1462
+ `Panel ids must be unique; id "${c.id}" was used more than once`
1463
+ ), o.add(c.id), c.onResize && r.observe(c.element);
1436
1464
  });
1437
- const l = Q({ group: e }), r = Se(e), a = e.panels.map(({ id: u }) => u).join(",");
1438
- let c = e.mutableState.defaultLayout;
1439
- c && (Ht(e.panels, c) || (c = void 0));
1440
- const f = e.mutableState.layouts[a] ?? c ?? Be(r), g = B({
1441
- layout: f,
1442
- panelConstraints: r
1465
+ const f = ne({ group: e }), a = ve(e), s = e.panels.map(({ id: c }) => c).join(",");
1466
+ let l = e.mutableState.defaultLayout;
1467
+ l && (Ht(e.panels, l) || (l = void 0));
1468
+ const u = e.mutableState.layouts[s] ?? l ?? We(a), h = U({
1469
+ layout: u,
1470
+ panelConstraints: a
1443
1471
  }), d = e.element.ownerDocument;
1444
- q.set(
1472
+ J.set(
1445
1473
  d,
1446
- (q.get(d) ?? 0) + 1
1474
+ (J.get(d) ?? 0) + 1
1447
1475
  );
1448
- const z = /* @__PURE__ */ new Map();
1449
- return Ye(e).forEach((u) => {
1450
- u.separator && z.set(u.separator, u.panels);
1451
- }), _(e, {
1452
- defaultLayoutDeferred: l === 0,
1453
- derivedPanelConstraints: r,
1454
- groupSize: l,
1455
- layout: g,
1456
- separatorToPanels: z
1457
- }), e.separators.forEach((u) => {
1476
+ const S = /* @__PURE__ */ new Map();
1477
+ return Je(e).forEach((c) => {
1478
+ c.separator && S.set(c.separator, c.panels);
1479
+ }), $(e, {
1480
+ defaultLayoutDeferred: f === 0,
1481
+ derivedPanelConstraints: a,
1482
+ groupSize: f,
1483
+ layout: h,
1484
+ separatorToPanels: S
1485
+ }), e.separators.forEach((c) => {
1458
1486
  C(
1459
- !i.has(u.id),
1460
- `Separator ids must be unique; id "${u.id}" was used more than once`
1461
- ), i.add(u.id), u.element.addEventListener("keydown", Oe);
1462
- }), q.get(d) === 1 && (d.addEventListener("dblclick", Te, !0), d.addEventListener("pointerdown", Ge, !0), d.addEventListener("pointerleave", $e), d.addEventListener("pointermove", je), d.addEventListener("pointerout", He), d.addEventListener("pointerup", Ve, !0)), function() {
1463
- t = !1, q.set(
1487
+ !i.has(c.id),
1488
+ `Separator ids must be unique; id "${c.id}" was used more than once`
1489
+ ), i.add(c.id), c.element.addEventListener("keydown", Ge);
1490
+ }), J.get(d) === 1 && (d.addEventListener("dblclick", Te, !0), d.addEventListener("pointerdown", Ae, !0), d.addEventListener("pointerleave", je), d.addEventListener("pointermove", He), d.addEventListener("pointerout", Ve), d.addEventListener("pointerup", Be, !0)), function() {
1491
+ t = !1, J.set(
1464
1492
  d,
1465
- Math.max(0, (q.get(d) ?? 0) - 1)
1493
+ Math.max(0, (J.get(d) ?? 0) - 1)
1466
1494
  ), Lt(e), e.separators.forEach((p) => {
1467
- p.element.removeEventListener("keydown", Oe);
1468
- }), q.get(d) || (d.removeEventListener(
1495
+ p.element.removeEventListener("keydown", Ge);
1496
+ }), J.get(d) || (d.removeEventListener(
1469
1497
  "dblclick",
1470
1498
  Te,
1471
1499
  !0
1472
1500
  ), d.removeEventListener(
1473
1501
  "pointerdown",
1474
- Ge,
1502
+ Ae,
1475
1503
  !0
1476
- ), d.removeEventListener("pointerleave", $e), d.removeEventListener("pointermove", je), d.removeEventListener("pointerout", He), d.removeEventListener("pointerup", Ve, !0)), s.disconnect();
1504
+ ), d.removeEventListener("pointerleave", je), d.removeEventListener("pointermove", He), d.removeEventListener("pointerout", Ve), d.removeEventListener("pointerup", Be, !0)), r.disconnect();
1477
1505
  };
1478
1506
  }
1479
1507
  function Bt() {
1480
- const [e, t] = re({}), n = ne(() => t({}), []);
1508
+ const [e, t] = Q({}), n = re(() => t({}), []);
1481
1509
  return [e, n];
1482
1510
  }
1483
- function Pe(e) {
1511
+ function Le(e) {
1484
1512
  const t = pt();
1485
1513
  return `${e ?? t}`;
1486
1514
  }
1487
- const K = typeof window < "u" ? We : he;
1488
- function oe(e) {
1489
- const t = O(e);
1490
- return K(() => {
1515
+ const q = typeof window < "u" ? Ue : me;
1516
+ function se(e) {
1517
+ const t = T(e);
1518
+ return q(() => {
1491
1519
  t.current = e;
1492
- }, [e]), ne(
1520
+ }, [e]), re(
1493
1521
  (...n) => t.current?.(...n),
1494
1522
  [t]
1495
1523
  );
1496
1524
  }
1497
- function Le(...e) {
1498
- return oe((t) => {
1525
+ function Ce(...e) {
1526
+ return se((t) => {
1499
1527
  e.forEach((n) => {
1500
1528
  if (n)
1501
1529
  switch (typeof n) {
@@ -1511,23 +1539,23 @@ function Le(...e) {
1511
1539
  });
1512
1540
  });
1513
1541
  }
1514
- function Ce(e) {
1515
- const t = O({ ...e });
1516
- return K(() => {
1542
+ function Re(e) {
1543
+ const t = T({ ...e });
1544
+ return q(() => {
1517
1545
  for (const n in e)
1518
1546
  t.current[n] = e[n];
1519
1547
  }, [e]), t.current;
1520
1548
  }
1521
- const at = ht(null);
1549
+ const lt = ht(null);
1522
1550
  function Wt(e, t) {
1523
- const n = O({
1551
+ const n = T({
1524
1552
  getLayout: () => ({}),
1525
- setLayout: Nt
1553
+ setLayout: Ft
1526
1554
  });
1527
- Ue(t, () => n.current, []), K(() => {
1555
+ Ke(t, () => n.current, []), q(() => {
1528
1556
  Object.assign(
1529
1557
  n.current,
1530
- tt({ groupId: e })
1558
+ nt({ groupId: e })
1531
1559
  );
1532
1560
  });
1533
1561
  }
@@ -1537,124 +1565,124 @@ function Ut({
1537
1565
  defaultLayout: n,
1538
1566
  disableCursor: o,
1539
1567
  disabled: i,
1540
- elementRef: s,
1541
- groupRef: l,
1542
- id: r,
1543
- onLayoutChange: a,
1544
- onLayoutChanged: c,
1545
- orientation: f = "horizontal",
1546
- resizeTargetMinimumSize: g = {
1568
+ elementRef: r,
1569
+ groupRef: f,
1570
+ id: a,
1571
+ onLayoutChange: s,
1572
+ onLayoutChanged: l,
1573
+ orientation: u = "horizontal",
1574
+ resizeTargetMinimumSize: h = {
1547
1575
  coarse: 20,
1548
1576
  fine: 10
1549
1577
  },
1550
1578
  style: d,
1551
- ...z
1579
+ ...S
1552
1580
  }) {
1553
- const b = O({
1581
+ const z = T({
1554
1582
  onLayoutChange: {},
1555
1583
  onLayoutChanged: {}
1556
- }), u = oe((x) => {
1557
- V(b.current.onLayoutChange, x) || (b.current.onLayoutChange = x, a?.(x));
1558
- }), p = oe((x) => {
1559
- V(b.current.onLayoutChanged, x) || (b.current.onLayoutChanged = x, c?.(x));
1560
- }), m = Pe(r), S = O(null), [v, y] = Bt(), h = O({
1584
+ }), c = se((x) => {
1585
+ W(z.current.onLayoutChange, x) || (z.current.onLayoutChange = x, s?.(x));
1586
+ }), p = se((x) => {
1587
+ W(z.current.onLayoutChanged, x) || (z.current.onLayoutChanged = x, l?.(x));
1588
+ }), m = Le(a), v = T(null), [b, y] = Bt(), g = T({
1561
1589
  lastExpandedPanelSizes: {},
1562
1590
  layouts: {},
1563
1591
  panels: [],
1564
- resizeTargetMinimumSize: g,
1592
+ resizeTargetMinimumSize: h,
1565
1593
  separators: []
1566
- }), P = Le(S, s);
1567
- Wt(m, l);
1568
- const M = oe(
1569
- (x, w) => {
1570
- const E = W(), R = Ee(x), k = j(x);
1571
- if (k) {
1572
- let I = !1;
1573
- switch (E.state) {
1594
+ }), P = Ce(v, r);
1595
+ Wt(m, f);
1596
+ const M = se(
1597
+ (x, L) => {
1598
+ const k = K(), R = ke(x), E = H(x);
1599
+ if (E) {
1600
+ let D = !1;
1601
+ switch (k.state) {
1574
1602
  case "active": {
1575
- I = E.hitRegions.some(
1576
- ($) => $.group === R
1603
+ D = k.hitRegions.some(
1604
+ (V) => V.group === R
1577
1605
  );
1578
1606
  break;
1579
1607
  }
1580
1608
  }
1581
1609
  return {
1582
- flexGrow: k.layout[w] ?? 1,
1583
- pointerEvents: I ? "none" : void 0
1610
+ flexGrow: E.layout[L] ?? 1,
1611
+ pointerEvents: D ? "none" : void 0
1584
1612
  };
1585
1613
  }
1586
- if (n?.[w])
1614
+ if (n?.[L])
1587
1615
  return {
1588
- flexGrow: n?.[w]
1616
+ flexGrow: n?.[L]
1589
1617
  };
1590
1618
  }
1591
- ), L = Ce({
1619
+ ), w = Re({
1592
1620
  defaultLayout: n,
1593
1621
  disableCursor: o
1594
- }), X = ye(
1622
+ }), G = Se(
1595
1623
  () => ({
1596
1624
  get disableCursor() {
1597
- return !!L.disableCursor;
1625
+ return !!w.disableCursor;
1598
1626
  },
1599
1627
  getPanelStyles: M,
1600
1628
  id: m,
1601
- orientation: f,
1629
+ orientation: u,
1602
1630
  registerPanel: (x) => {
1603
- const w = h.current;
1604
- return w.panels = ve(f, [
1605
- ...w.panels,
1631
+ const L = g.current;
1632
+ return L.panels = be(u, [
1633
+ ...L.panels,
1606
1634
  x
1607
1635
  ]), y(), () => {
1608
- w.panels = w.panels.filter(
1609
- (E) => E !== x
1636
+ L.panels = L.panels.filter(
1637
+ (k) => k !== x
1610
1638
  ), y();
1611
1639
  };
1612
1640
  },
1613
1641
  registerSeparator: (x) => {
1614
- const w = h.current;
1615
- return w.separators = ve(f, [
1616
- ...w.separators,
1642
+ const L = g.current;
1643
+ return L.separators = be(u, [
1644
+ ...L.separators,
1617
1645
  x
1618
1646
  ]), y(), () => {
1619
- w.separators = w.separators.filter(
1620
- (E) => E !== x
1647
+ L.separators = L.separators.filter(
1648
+ (k) => k !== x
1621
1649
  ), y();
1622
1650
  };
1623
1651
  },
1624
- updatePanelProps: (x, { disabled: w }) => {
1625
- const R = h.current.panels.find(
1626
- ($) => $.id === x
1652
+ updatePanelProps: (x, { disabled: L }) => {
1653
+ const R = g.current.panels.find(
1654
+ (V) => V.id === x
1627
1655
  );
1628
- R && (R.panelConstraints.disabled = w);
1629
- const k = Ee(m), I = j(m);
1630
- k && I && _(k, {
1631
- ...I,
1632
- derivedPanelConstraints: Se(k)
1656
+ R && (R.panelConstraints.disabled = L);
1657
+ const E = ke(m), D = H(m);
1658
+ E && D && $(E, {
1659
+ ...D,
1660
+ derivedPanelConstraints: ve(E)
1633
1661
  });
1634
1662
  },
1635
1663
  updateSeparatorProps: (x, {
1636
- disabled: w,
1637
- disableDoubleClick: E
1664
+ disabled: L,
1665
+ disableDoubleClick: k
1638
1666
  }) => {
1639
- const k = h.current.separators.find(
1640
- (I) => I.id === x
1667
+ const E = g.current.separators.find(
1668
+ (D) => D.id === x
1641
1669
  );
1642
- k && (k.disabled = w, k.disableDoubleClick = E);
1670
+ E && (E.disabled = L, E.disableDoubleClick = k);
1643
1671
  }
1644
1672
  }),
1645
- [M, m, y, f, L]
1646
- ), F = O(null);
1647
- return K(() => {
1648
- const x = S.current;
1673
+ [M, m, y, u, w]
1674
+ ), N = T(null);
1675
+ return q(() => {
1676
+ const x = v.current;
1649
1677
  if (x === null)
1650
1678
  return;
1651
- const w = h.current;
1652
- let E;
1653
- if (L.defaultLayout !== void 0 && Object.keys(L.defaultLayout).length === w.panels.length) {
1654
- E = {};
1655
- for (const ee of w.panels) {
1656
- const le = L.defaultLayout[ee.id];
1657
- le !== void 0 && (E[ee.id] = le);
1679
+ const L = g.current;
1680
+ let k;
1681
+ if (w.defaultLayout !== void 0 && Object.keys(w.defaultLayout).length === L.panels.length) {
1682
+ k = {};
1683
+ for (const j of L.panels) {
1684
+ const Y = w.defaultLayout[j.id];
1685
+ Y !== void 0 && (k[j.id] = Y);
1658
1686
  }
1659
1687
  }
1660
1688
  const R = {
@@ -1662,60 +1690,60 @@ function Ut({
1662
1690
  element: x,
1663
1691
  id: m,
1664
1692
  mutableState: {
1665
- defaultLayout: E,
1666
- disableCursor: !!L.disableCursor,
1667
- expandedPanelSizes: h.current.lastExpandedPanelSizes,
1668
- layouts: h.current.layouts
1693
+ defaultLayout: k,
1694
+ disableCursor: !!w.disableCursor,
1695
+ expandedPanelSizes: g.current.lastExpandedPanelSizes,
1696
+ layouts: g.current.layouts
1669
1697
  },
1670
- orientation: f,
1671
- panels: w.panels,
1672
- resizeTargetMinimumSize: w.resizeTargetMinimumSize,
1673
- separators: w.separators
1698
+ orientation: u,
1699
+ panels: L.panels,
1700
+ resizeTargetMinimumSize: L.resizeTargetMinimumSize,
1701
+ separators: L.separators
1674
1702
  };
1675
- F.current = R;
1676
- const k = Vt(R), { defaultLayoutDeferred: I, derivedPanelConstraints: $, layout: ae } = j(R.id, !0);
1677
- !I && $.length > 0 && (u(ae), p(ae));
1678
- const lt = ze(m, (ee) => {
1679
- const { defaultLayoutDeferred: le, derivedPanelConstraints: Me, layout: ue } = ee.next;
1680
- if (le || Me.length === 0)
1703
+ N.current = R;
1704
+ const E = Vt(R), { defaultLayoutDeferred: D, derivedPanelConstraints: V, layout: ue } = H(R.id, !0);
1705
+ !D && V.length > 0 && (c(ue), p(ue));
1706
+ const oe = ze(m, (j) => {
1707
+ const { defaultLayoutDeferred: Y, derivedPanelConstraints: Ee, layout: ce } = j.next;
1708
+ if (Y || Ee.length === 0)
1681
1709
  return;
1682
- const ut = R.panels.map(({ id: N }) => N).join(",");
1683
- R.mutableState.layouts[ut] = ue, Me.forEach((N) => {
1684
- if (N.collapsible) {
1685
- const { layout: me } = ee.prev ?? {};
1686
- if (me) {
1687
- const ft = D(
1688
- N.collapsedSize,
1689
- ue[N.panelId]
1690
- ), dt = D(
1691
- N.collapsedSize,
1692
- me[N.panelId]
1710
+ const ut = R.panels.map(({ id: _ }) => _).join(",");
1711
+ R.mutableState.layouts[ut] = ce, Ee.forEach((_) => {
1712
+ if (_.collapsible) {
1713
+ const { layout: ge } = j.prev ?? {};
1714
+ if (ge) {
1715
+ const ft = I(
1716
+ _.collapsedSize,
1717
+ ce[_.panelId]
1718
+ ), dt = I(
1719
+ _.collapsedSize,
1720
+ ge[_.panelId]
1693
1721
  );
1694
- ft && !dt && (R.mutableState.expandedPanelSizes[N.panelId] = me[N.panelId]);
1722
+ ft && !dt && (R.mutableState.expandedPanelSizes[_.panelId] = ge[_.panelId]);
1695
1723
  }
1696
1724
  }
1697
1725
  });
1698
- const ct = W().state !== "active";
1699
- u(ue), ct && p(ue);
1726
+ const ct = K().state !== "active";
1727
+ c(ce), ct && p(ce);
1700
1728
  });
1701
1729
  return () => {
1702
- F.current = null, k(), lt();
1730
+ N.current = null, E(), oe();
1703
1731
  };
1704
1732
  }, [
1705
1733
  i,
1706
1734
  m,
1707
1735
  p,
1736
+ c,
1708
1737
  u,
1709
- f,
1710
- v,
1711
- L
1712
- ]), he(() => {
1713
- const x = F.current;
1738
+ b,
1739
+ w
1740
+ ]), me(() => {
1741
+ const x = N.current;
1714
1742
  x && (x.mutableState.defaultLayout = n, x.mutableState.disableCursor = !!o);
1715
- }), /* @__PURE__ */ ie(at.Provider, { value: X, children: /* @__PURE__ */ ie(
1743
+ }), /* @__PURE__ */ ae(lt.Provider, { value: G, children: /* @__PURE__ */ ae(
1716
1744
  "div",
1717
1745
  {
1718
- ...z,
1746
+ ...S,
1719
1747
  className: t,
1720
1748
  "data-group": !0,
1721
1749
  "data-testid": m,
@@ -1727,20 +1755,20 @@ function Ut({
1727
1755
  overflow: "hidden",
1728
1756
  ...d,
1729
1757
  display: "flex",
1730
- flexDirection: f === "horizontal" ? "row" : "column",
1758
+ flexDirection: u === "horizontal" ? "row" : "column",
1731
1759
  flexWrap: "nowrap",
1732
1760
  // Inform the browser that the library is handling touch events for this element
1733
1761
  // but still allow users to scroll content within panels in the non-resizing direction
1734
1762
  // NOTE This is not an inherited style
1735
1763
  // See github.com/bvaughn/react-resizable-panels/issues/662
1736
- touchAction: f === "horizontal" ? "pan-y" : "pan-x"
1764
+ touchAction: u === "horizontal" ? "pan-y" : "pan-x"
1737
1765
  },
1738
1766
  children: e
1739
1767
  }
1740
1768
  ) });
1741
1769
  }
1742
1770
  Ut.displayName = "Group";
1743
- function pe(e, t) {
1771
+ function he(e, t) {
1744
1772
  return `react-resizable-panels:${[e, ...t].join(":")}`;
1745
1773
  }
1746
1774
  function Kt({
@@ -1748,29 +1776,29 @@ function Kt({
1748
1776
  panelIds: t,
1749
1777
  storage: n
1750
1778
  }) {
1751
- const o = pe(e, []), i = n.getItem(o);
1779
+ const o = he(e, []), i = n.getItem(o);
1752
1780
  if (i)
1753
1781
  try {
1754
- const s = JSON.parse(i);
1782
+ const r = JSON.parse(i);
1755
1783
  if (t) {
1756
- const l = t.join(","), r = s[l];
1757
- if (r && Array.isArray(r.layout) && t.length === r.layout.length) {
1758
- const a = {};
1759
- for (let c = 0; c < t.length; c++)
1760
- a[t[c]] = r.layout[c];
1761
- return a;
1784
+ const f = t.join(","), a = r[f];
1785
+ if (a && Array.isArray(a.layout) && t.length === a.layout.length) {
1786
+ const s = {};
1787
+ for (let l = 0; l < t.length; l++)
1788
+ s[t[l]] = a.layout[l];
1789
+ return s;
1762
1790
  }
1763
1791
  } else {
1764
- const l = Object.keys(s);
1765
- if (l.length === 1) {
1766
- const r = s[l[0]];
1767
- if (r && Array.isArray(r.layout)) {
1768
- const a = l[0].split(",");
1769
- if (a.length === r.layout.length) {
1770
- const c = {};
1771
- for (let f = 0; f < a.length; f++)
1772
- c[a[f]] = r.layout[f];
1773
- return c;
1792
+ const f = Object.keys(r);
1793
+ if (f.length === 1) {
1794
+ const a = r[f[0]];
1795
+ if (a && Array.isArray(a.layout)) {
1796
+ const s = f[0].split(",");
1797
+ if (s.length === a.layout.length) {
1798
+ const l = {};
1799
+ for (let u = 0; u < s.length; u++)
1800
+ l[s[u]] = a.layout[u];
1801
+ return l;
1774
1802
  }
1775
1803
  }
1776
1804
  }
@@ -1784,65 +1812,65 @@ function on({
1784
1812
  storage: n = localStorage,
1785
1813
  ...o
1786
1814
  }) {
1787
- const i = t !== void 0, s = "id" in o ? o.id : o.groupId, l = pe(s, t ?? []), r = Ke(
1815
+ const i = t !== void 0, r = "id" in o ? o.id : o.groupId, f = he(r, t ?? []), a = Xe(
1788
1816
  Xt,
1789
- () => n.getItem(l),
1790
- () => n.getItem(l)
1791
- ), a = ye(() => {
1792
- if (r) {
1793
- const u = JSON.parse(r), p = Object.values(u);
1817
+ () => n.getItem(f),
1818
+ () => n.getItem(f)
1819
+ ), s = Se(() => {
1820
+ if (a) {
1821
+ const c = JSON.parse(a), p = Object.values(c);
1794
1822
  if (Array.from(p).every((m) => typeof m == "number"))
1795
- return u;
1823
+ return c;
1796
1824
  }
1797
- }, [r]), c = ye(() => {
1798
- if (!a)
1825
+ }, [a]), l = Se(() => {
1826
+ if (!s)
1799
1827
  return Kt({
1800
- id: s,
1828
+ id: r,
1801
1829
  panelIds: t,
1802
1830
  storage: n
1803
1831
  });
1804
- }, [a, s, t, n]), f = a ?? c, g = O(null), d = ne(() => {
1805
- const u = g.current;
1806
- u && (g.current = null, clearTimeout(u));
1832
+ }, [s, r, t, n]), u = s ?? l, h = T(null), d = re(() => {
1833
+ const c = h.current;
1834
+ c && (h.current = null, clearTimeout(c));
1807
1835
  }, []);
1808
- We(() => () => {
1836
+ Ue(() => () => {
1809
1837
  d();
1810
1838
  }, [d]);
1811
- const z = ne(
1812
- (u) => {
1839
+ const S = re(
1840
+ (c) => {
1813
1841
  d();
1814
1842
  let p;
1815
- i ? p = pe(s, Object.keys(u)) : p = pe(s, []);
1843
+ i ? p = he(r, Object.keys(c)) : p = he(r, []);
1816
1844
  try {
1817
- n.setItem(p, JSON.stringify(u));
1845
+ n.setItem(p, JSON.stringify(c));
1818
1846
  } catch (m) {
1819
1847
  console.error(m);
1820
1848
  }
1821
1849
  },
1822
- [d, i, s, n]
1823
- ), b = ne(
1824
- (u) => {
1825
- d(), e === 0 ? z(u) : g.current = setTimeout(() => {
1826
- z(u);
1850
+ [d, i, r, n]
1851
+ ), z = re(
1852
+ (c) => {
1853
+ d(), e === 0 ? S(c) : h.current = setTimeout(() => {
1854
+ S(c);
1827
1855
  }, e);
1828
1856
  },
1829
- [d, e, z]
1857
+ [d, e, S]
1830
1858
  );
1831
1859
  return {
1832
1860
  /**
1833
1861
  * Pass this value to `Group` as the `defaultLayout` prop.
1834
1862
  */
1835
- defaultLayout: f,
1863
+ defaultLayout: u,
1836
1864
  /**
1837
1865
  * Attach this callback on the `Group` as the `onLayoutChange` prop.
1838
1866
  *
1839
1867
  * @deprecated Use the {@link onLayoutChanged} prop instead.
1840
1868
  */
1841
- onLayoutChange: b,
1869
+ onLayoutChange: z,
1842
1870
  /**
1843
1871
  * Attach this callback on the `Group` as the `onLayoutChanged` prop.
1844
1872
  */
1845
- onLayoutChanged: z
1873
+ onLayoutChanged: S
1846
1874
  };
1847
1875
  }
1848
1876
  function Xt() {
@@ -1850,33 +1878,33 @@ function Xt() {
1850
1878
  };
1851
1879
  }
1852
1880
  function rn() {
1853
- return re(null);
1881
+ return Q(null);
1854
1882
  }
1855
1883
  function sn() {
1856
- return O(null);
1884
+ return T(null);
1857
1885
  }
1858
- function Re() {
1859
- const e = mt(at);
1886
+ function Me() {
1887
+ const e = mt(lt);
1860
1888
  return C(
1861
1889
  e,
1862
1890
  "Group Context not found; did you render a Panel or Separator outside of a Group?"
1863
1891
  ), e;
1864
1892
  }
1865
1893
  function qt(e, t) {
1866
- const { id: n } = Re(), o = O({
1867
- collapse: ge,
1868
- expand: ge,
1894
+ const { id: n } = Me(), o = T({
1895
+ collapse: ye,
1896
+ expand: ye,
1869
1897
  getSize: () => ({
1870
1898
  asPercentage: 0,
1871
1899
  inPixels: 0
1872
1900
  }),
1873
1901
  isCollapsed: () => !1,
1874
- resize: ge
1902
+ resize: ye
1875
1903
  });
1876
- Ue(t, () => o.current, []), K(() => {
1904
+ Ke(t, () => o.current, []), q(() => {
1877
1905
  Object.assign(
1878
1906
  o.current,
1879
- et({ groupId: n, panelId: e })
1907
+ tt({ groupId: n, panelId: e })
1880
1908
  );
1881
1909
  });
1882
1910
  }
@@ -1886,102 +1914,102 @@ function Yt({
1886
1914
  collapsedSize: n = "0%",
1887
1915
  collapsible: o = !1,
1888
1916
  defaultSize: i,
1889
- disabled: s,
1890
- elementRef: l,
1891
- groupResizeBehavior: r = "preserve-relative-size",
1892
- id: a,
1893
- maxSize: c = "100%",
1894
- minSize: f = "0%",
1895
- onResize: g,
1917
+ disabled: r,
1918
+ elementRef: f,
1919
+ groupResizeBehavior: a = "preserve-relative-size",
1920
+ id: s,
1921
+ maxSize: l = "100%",
1922
+ minSize: u = "0%",
1923
+ onResize: h,
1896
1924
  panelRef: d,
1897
- style: z,
1898
- ...b
1925
+ style: S,
1926
+ ...z
1899
1927
  }) {
1900
- const u = !!a, p = Pe(a), m = Ce({
1901
- disabled: s
1902
- }), S = O(null), v = Le(S, l), {
1928
+ const c = !!s, p = Le(s), m = Re({
1929
+ disabled: r
1930
+ }), v = T(null), b = Ce(v, f), {
1903
1931
  getPanelStyles: y,
1904
- id: h,
1932
+ id: g,
1905
1933
  orientation: P,
1906
1934
  registerPanel: M,
1907
- updatePanelProps: L
1908
- } = Re(), X = g !== null, F = oe(
1909
- (R, k, I) => {
1910
- g?.(R, a, I);
1935
+ updatePanelProps: w
1936
+ } = Me(), G = h !== null, N = se(
1937
+ (R, E, D) => {
1938
+ h?.(R, s, D);
1911
1939
  }
1912
1940
  );
1913
- K(() => {
1914
- const R = S.current;
1941
+ q(() => {
1942
+ const R = v.current;
1915
1943
  if (R !== null) {
1916
- const k = {
1944
+ const E = {
1917
1945
  element: R,
1918
1946
  id: p,
1919
- idIsStable: u,
1947
+ idIsStable: c,
1920
1948
  mutableValues: {
1921
1949
  expandToSize: void 0,
1922
1950
  prevSize: void 0
1923
1951
  },
1924
- onResize: X ? F : void 0,
1952
+ onResize: G ? N : void 0,
1925
1953
  panelConstraints: {
1926
- groupResizeBehavior: r,
1954
+ groupResizeBehavior: a,
1927
1955
  collapsedSize: n,
1928
1956
  collapsible: o,
1929
1957
  defaultSize: i,
1930
1958
  disabled: m.disabled,
1931
- maxSize: c,
1932
- minSize: f
1959
+ maxSize: l,
1960
+ minSize: u
1933
1961
  }
1934
1962
  };
1935
- return M(k);
1963
+ return M(E);
1936
1964
  }
1937
1965
  }, [
1938
- r,
1966
+ a,
1939
1967
  n,
1940
1968
  o,
1941
1969
  i,
1942
- X,
1970
+ G,
1943
1971
  p,
1944
- u,
1945
1972
  c,
1946
- f,
1947
- F,
1973
+ l,
1974
+ u,
1975
+ N,
1948
1976
  M,
1949
1977
  m
1950
- ]), he(() => {
1951
- L(p, { disabled: s });
1952
- }, [s, p, L]), qt(p, d);
1978
+ ]), me(() => {
1979
+ w(p, { disabled: r });
1980
+ }, [r, p, w]), qt(p, d);
1953
1981
  const x = () => {
1954
- const R = y(h, p);
1982
+ const R = y(g, p);
1955
1983
  if (R)
1956
1984
  return JSON.stringify(R);
1957
- }, w = Ke(
1958
- (R) => ze(h, R),
1985
+ }, L = Xe(
1986
+ (R) => ze(g, R),
1959
1987
  x,
1960
1988
  x
1961
1989
  );
1962
- let E;
1963
- return w ? E = JSON.parse(w) : i ? E = {
1990
+ let k;
1991
+ return L ? k = JSON.parse(L) : i ? k = {
1964
1992
  flexGrow: void 0,
1965
1993
  flexShrink: void 0,
1966
1994
  flexBasis: i
1967
- } : E = { flexGrow: 1 }, /* @__PURE__ */ ie(
1995
+ } : k = { flexGrow: 1 }, /* @__PURE__ */ ae(
1968
1996
  "div",
1969
1997
  {
1970
- ...b,
1971
- "data-disabled": s || void 0,
1998
+ ...z,
1999
+ "data-disabled": r || void 0,
1972
2000
  "data-panel": !0,
1973
2001
  "data-testid": p,
1974
2002
  id: p,
1975
- ref: v,
2003
+ ref: b,
1976
2004
  style: {
1977
2005
  ...Jt,
1978
2006
  display: "flex",
1979
2007
  flexBasis: 0,
1980
2008
  flexShrink: 1,
1981
2009
  overflow: "visible",
1982
- ...E
2010
+ ...k
1983
2011
  },
1984
- children: /* @__PURE__ */ ie(
2012
+ children: /* @__PURE__ */ ae(
1985
2013
  "div",
1986
2014
  {
1987
2015
  className: t,
@@ -1990,7 +2018,7 @@ function Yt({
1990
2018
  maxWidth: "100%",
1991
2019
  flexGrow: 1,
1992
2020
  overflow: "auto",
1993
- ...z,
2021
+ ...S,
1994
2022
  // Inform the browser that the library is handling touch events for this element
1995
2023
  // but still allow users to scroll content within panels in the non-resizing direction
1996
2024
  // NOTE This is not an inherited style
@@ -2017,10 +2045,10 @@ const Jt = {
2017
2045
  margin: 0
2018
2046
  };
2019
2047
  function an() {
2020
- return re(null);
2048
+ return Q(null);
2021
2049
  }
2022
2050
  function ln() {
2023
- return O(null);
2051
+ return T(null);
2024
2052
  }
2025
2053
  function Zt({
2026
2054
  layout: e,
@@ -2028,27 +2056,27 @@ function Zt({
2028
2056
  panelId: n,
2029
2057
  panelIndex: o
2030
2058
  }) {
2031
- let i, s;
2032
- const l = e[n], r = t.find(
2033
- (a) => a.panelId === n
2059
+ let i, r;
2060
+ const f = e[n], a = t.find(
2061
+ (s) => s.panelId === n
2034
2062
  );
2035
- if (r) {
2036
- const a = r.maxSize, c = r.collapsible ? r.collapsedSize : r.minSize, f = [o, o + 1];
2037
- s = B({
2038
- layout: se({
2039
- delta: c - l,
2063
+ if (a) {
2064
+ const s = a.maxSize, l = a.collapsible ? a.collapsedSize : a.minSize, u = [o, o + 1];
2065
+ r = U({
2066
+ layout: le({
2067
+ delta: l - f,
2040
2068
  initialLayout: e,
2041
2069
  panelConstraints: t,
2042
- pivotIndices: f,
2070
+ pivotIndices: u,
2043
2071
  prevLayout: e
2044
2072
  }),
2045
2073
  panelConstraints: t
2046
- })[n], i = B({
2047
- layout: se({
2048
- delta: a - l,
2074
+ })[n], i = U({
2075
+ layout: le({
2076
+ delta: s - f,
2049
2077
  initialLayout: e,
2050
2078
  panelConstraints: t,
2051
- pivotIndices: f,
2079
+ pivotIndices: u,
2052
2080
  prevLayout: e
2053
2081
  }),
2054
2082
  panelConstraints: t
@@ -2057,8 +2085,8 @@ function Zt({
2057
2085
  return {
2058
2086
  valueControls: n,
2059
2087
  valueMax: i,
2060
- valueMin: s,
2061
- valueNow: l
2088
+ valueMin: r,
2089
+ valueNow: f
2062
2090
  };
2063
2091
  }
2064
2092
  function Qt({
@@ -2067,82 +2095,97 @@ function Qt({
2067
2095
  disabled: n,
2068
2096
  disableDoubleClick: o,
2069
2097
  elementRef: i,
2070
- id: s,
2071
- style: l,
2072
- ...r
2098
+ id: r,
2099
+ style: f,
2100
+ ...a
2073
2101
  }) {
2074
- const a = Pe(s), c = Ce({
2102
+ const s = Le(r), l = Re({
2075
2103
  disabled: n,
2076
2104
  disableDoubleClick: o
2077
- }), [f, g] = re({}), [d, z] = re("inactive"), b = O(null), u = Le(b, i), {
2078
- disableCursor: p,
2079
- id: m,
2080
- orientation: S,
2081
- registerSeparator: v,
2082
- updateSeparatorProps: y
2083
- } = Re(), h = S === "horizontal" ? "vertical" : "horizontal";
2084
- K(() => {
2085
- const M = b.current;
2086
- if (M !== null) {
2087
- const L = {
2088
- disabled: c.disabled,
2089
- disableDoubleClick: c.disableDoubleClick,
2090
- element: M,
2091
- id: a
2092
- }, X = v(L), F = Gt(
2093
- (w) => {
2094
- z(
2095
- w.next.state !== "inactive" && w.next.hitRegions.some(
2096
- (E) => E.separator === L
2097
- ) ? w.next.state : "inactive"
2105
+ }), [u, h] = Q({}), [d, S] = Q("inactive"), [z, c] = Q(!1), p = T(null), m = Ce(p, i), {
2106
+ disableCursor: v,
2107
+ id: b,
2108
+ orientation: y,
2109
+ registerSeparator: g,
2110
+ updateSeparatorProps: P
2111
+ } = Me(), M = y === "horizontal" ? "vertical" : "horizontal";
2112
+ q(() => {
2113
+ const N = p.current;
2114
+ if (N !== null) {
2115
+ const x = {
2116
+ disabled: l.disabled,
2117
+ disableDoubleClick: l.disableDoubleClick,
2118
+ element: N,
2119
+ id: s
2120
+ }, L = g(x), k = Gt(
2121
+ (E) => {
2122
+ S(
2123
+ E.next.state !== "inactive" && E.next.hitRegions.some(
2124
+ (D) => D.separator === x
2125
+ ) ? E.next.state : "inactive"
2098
2126
  );
2099
2127
  }
2100
- ), x = ze(
2101
- m,
2102
- (w) => {
2103
- const { derivedPanelConstraints: E, layout: R, separatorToPanels: k } = w.next, I = k.get(L);
2104
- if (I) {
2105
- const $ = I[0], ae = I.indexOf($);
2106
- g(
2128
+ ), R = ze(
2129
+ b,
2130
+ (E) => {
2131
+ const { derivedPanelConstraints: D, layout: V, separatorToPanels: ue } = E.next, oe = ue.get(x);
2132
+ if (oe) {
2133
+ const j = oe[0], Y = oe.indexOf(j);
2134
+ h(
2107
2135
  Zt({
2108
- layout: R,
2109
- panelConstraints: E,
2110
- panelId: $.id,
2111
- panelIndex: ae
2136
+ layout: V,
2137
+ panelConstraints: D,
2138
+ panelId: j.id,
2139
+ panelIndex: Y
2112
2140
  })
2113
2141
  );
2114
2142
  }
2115
2143
  }
2116
2144
  );
2117
2145
  return () => {
2118
- F(), x(), X();
2146
+ k(), R(), L();
2119
2147
  };
2120
2148
  }
2121
- }, [m, a, v, c]), he(() => {
2122
- y(a, { disabled: n, disableDoubleClick: o });
2123
- }, [n, o, a, y]);
2124
- let P;
2125
- return n && !p && (P = "not-allowed"), /* @__PURE__ */ ie(
2149
+ }, [b, s, g, l]), me(() => {
2150
+ P(s, { disabled: n, disableDoubleClick: o });
2151
+ }, [n, o, s, P]);
2152
+ let w;
2153
+ n && !v && (w = "not-allowed");
2154
+ let G;
2155
+ if (n)
2156
+ G = "disabled";
2157
+ else
2158
+ switch (d) {
2159
+ case "active": {
2160
+ G = "active";
2161
+ break;
2162
+ }
2163
+ default:
2164
+ z ? G = "focus" : G = d;
2165
+ }
2166
+ return /* @__PURE__ */ ae(
2126
2167
  "div",
2127
2168
  {
2128
- ...r,
2129
- "aria-controls": f.valueControls,
2169
+ ...a,
2170
+ "aria-controls": u.valueControls,
2130
2171
  "aria-disabled": n || void 0,
2131
- "aria-orientation": h,
2132
- "aria-valuemax": f.valueMax,
2133
- "aria-valuemin": f.valueMin,
2134
- "aria-valuenow": f.valueNow,
2172
+ "aria-orientation": M,
2173
+ "aria-valuemax": u.valueMax,
2174
+ "aria-valuemin": u.valueMin,
2175
+ "aria-valuenow": u.valueNow,
2135
2176
  children: e,
2136
2177
  className: t,
2137
- "data-separator": n ? "disabled" : d,
2138
- "data-testid": a,
2139
- id: a,
2140
- ref: u,
2178
+ "data-separator": G,
2179
+ "data-testid": s,
2180
+ id: s,
2181
+ onBlur: () => c(!1),
2182
+ onFocus: () => c(!0),
2183
+ ref: m,
2141
2184
  role: "separator",
2142
2185
  style: {
2143
2186
  flexBasis: "auto",
2144
- cursor: P,
2145
- ...l,
2187
+ cursor: w,
2188
+ ...f,
2146
2189
  flexGrow: 0,
2147
2190
  flexShrink: 0,
2148
2191
  // Inform the browser that the library is handling touch events for this element
@@ -2158,7 +2201,7 @@ export {
2158
2201
  Ut as Group,
2159
2202
  Yt as Panel,
2160
2203
  Qt as Separator,
2161
- Pt as isCoarsePointer,
2204
+ wt as isCoarsePointer,
2162
2205
  on as useDefaultLayout,
2163
2206
  rn as useGroupCallbackRef,
2164
2207
  sn as useGroupRef,