react-resizable-panels 4.0.15 → 4.0.16

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,11 +1,11 @@
1
1
  "use client";
2
2
  import { jsx as K } from "react/jsx-runtime";
3
- import { useId as Ke, useLayoutEffect as Xe, useEffect as Re, useRef as D, useCallback as qe, createContext as Ye, useImperativeHandle as Ee, useState as I, useMemo as ie, useSyncExternalStore as Ze, useContext as Je } from "react";
3
+ import { useId as Ke, useLayoutEffect as Xe, useEffect as Ce, useRef as D, useCallback as qe, createContext as Ye, useImperativeHandle as Ee, useState as I, useMemo as ie, useSyncExternalStore as Ze, useContext as Je } from "react";
4
4
  function z(e, t = "Assertion error") {
5
5
  if (!e)
6
6
  throw Error(t);
7
7
  }
8
- function W({
8
+ function V({
9
9
  group: e
10
10
  }) {
11
11
  const { orientation: t, panels: n } = e;
@@ -64,19 +64,19 @@ function ke(e) {
64
64
  for (const f of s)
65
65
  if (f.hasAttribute("data-panel")) {
66
66
  const p = o.find(
67
- (m) => m.element === f
67
+ (h) => h.element === f
68
68
  );
69
69
  if (p) {
70
70
  if (a) {
71
- const m = a.element.getBoundingClientRect(), h = f.getBoundingClientRect();
71
+ const h = a.element.getBoundingClientRect(), m = f.getBoundingClientRect();
72
72
  let c;
73
73
  if (r) {
74
- const d = n === "horizontal" ? new DOMRect(m.right, m.top, 0, m.height) : new DOMRect(
75
- m.left,
76
- m.bottom,
77
- m.width,
74
+ const d = n === "horizontal" ? new DOMRect(h.right, h.top, 0, h.height) : new DOMRect(
75
+ h.left,
76
+ h.bottom,
77
+ h.width,
78
78
  0
79
- ), y = n === "horizontal" ? new DOMRect(h.left, h.top, 0, h.height) : new DOMRect(h.left, h.top, h.width, 0);
79
+ ), y = n === "horizontal" ? new DOMRect(m.left, m.top, 0, m.height) : new DOMRect(m.left, m.top, m.width, 0);
80
80
  switch (u.length) {
81
81
  case 0: {
82
82
  c = [
@@ -88,12 +88,12 @@ function ke(e) {
88
88
  case 1: {
89
89
  const v = u[0], S = tt({
90
90
  orientation: n,
91
- rects: [m, h],
91
+ rects: [h, m],
92
92
  targetRect: v.element.getBoundingClientRect()
93
93
  });
94
94
  c = [
95
95
  v,
96
- S === m ? y : d
96
+ S === h ? y : d
97
97
  ];
98
98
  break;
99
99
  }
@@ -105,21 +105,21 @@ function ke(e) {
105
105
  } else
106
106
  u.length ? c = u : c = [
107
107
  n === "horizontal" ? new DOMRect(
108
- m.right,
109
- h.top,
110
- h.left - m.right,
111
- h.height
108
+ h.right,
109
+ m.top,
110
+ m.left - h.right,
111
+ m.height
112
112
  ) : new DOMRect(
113
- h.left,
114
- m.bottom,
115
- h.width,
116
- h.top - m.bottom
113
+ m.left,
114
+ h.bottom,
115
+ m.width,
116
+ m.top - h.bottom
117
117
  )
118
118
  ];
119
119
  for (const d of c)
120
120
  l.push({
121
121
  group: e,
122
- groupSize: W({ group: e }),
122
+ groupSize: V({ group: e }),
123
123
  panels: [a, p],
124
124
  separator: "width" in d ? void 0 : d,
125
125
  rect: "width" in d ? d : d.element.getBoundingClientRect()
@@ -129,7 +129,7 @@ function ke(e) {
129
129
  }
130
130
  } else if (f.hasAttribute("data-separator")) {
131
131
  const p = i.find(
132
- (m) => m.element === f
132
+ (h) => h.element === f
133
133
  );
134
134
  p ? u.push(p) : (a = void 0, u = []);
135
135
  } else
@@ -199,7 +199,7 @@ function k(e) {
199
199
  return parseFloat(e.toFixed(3));
200
200
  }
201
201
  function me(e) {
202
- const { panels: t } = e, n = W({ group: e });
202
+ const { panels: t } = e, n = V({ group: e });
203
203
  return n === 0 ? t.map((o) => ({
204
204
  collapsedSize: 0,
205
205
  collapsible: o.panelConstraints.collapsible === !0,
@@ -294,37 +294,37 @@ class at {
294
294
  }
295
295
  }
296
296
  }
297
- function C(e, t, n = 0) {
297
+ function R(e, t, n = 0) {
298
298
  return Math.abs(k(e) - k(t)) <= n;
299
299
  }
300
- let R = {
300
+ let C = {
301
301
  cursorFlags: 0,
302
302
  interactionState: {
303
303
  state: "inactive"
304
304
  },
305
305
  mountedGroups: /* @__PURE__ */ new Map()
306
306
  };
307
- const T = new at();
307
+ const O = new at();
308
308
  function G() {
309
- return R;
309
+ return C;
310
310
  }
311
311
  function E(e) {
312
- const t = typeof e == "function" ? e(R) : e;
313
- if (R === t)
314
- return R;
315
- const n = R;
316
- return R = {
317
- ...R,
312
+ const t = typeof e == "function" ? e(C) : e;
313
+ if (C === t)
314
+ return C;
315
+ const n = C;
316
+ return C = {
317
+ ...C,
318
318
  ...t
319
- }, t.cursorFlags !== void 0 && T.emit("cursorFlagsChange", R.cursorFlags), t.interactionState !== void 0 && T.emit("interactionStateChange", R.interactionState), t.mountedGroups !== void 0 && (R.mountedGroups.forEach((o, i) => {
319
+ }, t.cursorFlags !== void 0 && O.emit("cursorFlagsChange", C.cursorFlags), t.interactionState !== void 0 && O.emit("interactionStateChange", C.interactionState), t.mountedGroups !== void 0 && (C.mountedGroups.forEach((o, i) => {
320
320
  o.derivedPanelConstraints.forEach((s) => {
321
321
  if (s.collapsible) {
322
322
  const { layout: l } = n.mountedGroups.get(i) ?? {};
323
323
  if (l) {
324
- const r = C(
324
+ const r = R(
325
325
  s.collapsedSize,
326
326
  o.layout[s.panelId]
327
- ), a = C(
327
+ ), a = R(
328
328
  s.collapsedSize,
329
329
  l[s.panelId]
330
330
  );
@@ -332,7 +332,7 @@ function E(e) {
332
332
  }
333
333
  }
334
334
  });
335
- }), T.emit("mountedGroupsChange", R.mountedGroups)), R;
335
+ }), O.emit("mountedGroupsChange", C.mountedGroups)), C;
336
336
  }
337
337
  function lt(e, t) {
338
338
  if (e.length !== t.length)
@@ -343,7 +343,7 @@ function lt(e, t) {
343
343
  return !0;
344
344
  }
345
345
  function X(e, t) {
346
- return C(e, t) ? 0 : e > t ? 1 : -1;
346
+ return R(e, t) ? 0 : e > t ? 1 : -1;
347
347
  }
348
348
  function B({
349
349
  panelConstraints: e,
@@ -371,7 +371,7 @@ function q({
371
371
  prevLayout: i,
372
372
  trigger: s
373
373
  }) {
374
- if (C(e, 0))
374
+ if (R(e, 0))
375
375
  return t;
376
376
  const l = Object.values(t), r = Object.values(i), a = [...l], [u, f] = o;
377
377
  z(u != null, "Invalid first pivot index"), z(f != null, "Invalid second pivot index");
@@ -393,7 +393,7 @@ function q({
393
393
  if (z(
394
394
  x != null,
395
395
  `Previous layout not found for panel index ${c}`
396
- ), C(x, y)) {
396
+ ), R(x, y)) {
397
397
  const g = S - x;
398
398
  X(g, Math.abs(e)) > 0 && (e = e < 0 ? 0 - g : g);
399
399
  }
@@ -415,7 +415,7 @@ function q({
415
415
  if (z(
416
416
  x != null,
417
417
  `Previous layout not found for panel index ${c}`
418
- ), C(x, S)) {
418
+ ), R(x, S)) {
419
419
  const g = x - y;
420
420
  X(g, Math.abs(e)) > 0 && (e = e < 0 ? 0 - g : g);
421
421
  }
@@ -453,7 +453,7 @@ function q({
453
453
  panelConstraints: n[d],
454
454
  size: S
455
455
  });
456
- if (!C(v, x) && (p += v - x, a[d] = x, p.toFixed(3).localeCompare(Math.abs(e).toFixed(3), void 0, {
456
+ if (!R(v, x) && (p += v - x, a[d] = x, p.toFixed(3).localeCompare(Math.abs(e).toFixed(3), void 0, {
457
457
  numeric: !0
458
458
  }) >= 0))
459
459
  break;
@@ -472,7 +472,7 @@ function q({
472
472
  panelConstraints: n[c],
473
473
  size: y
474
474
  });
475
- if (a[c] = v, !C(v, y)) {
475
+ if (a[c] = v, !R(v, y)) {
476
476
  let S = y - v, g = e < 0 ? f : u;
477
477
  for (; g >= 0 && g < n.length; ) {
478
478
  const w = a[g];
@@ -484,20 +484,20 @@ function q({
484
484
  panelConstraints: n[g],
485
485
  size: L
486
486
  });
487
- if (C(w, P) || (S -= P - w, a[g] = P), C(S, 0))
487
+ if (R(w, P) || (S -= P - w, a[g] = P), R(S, 0))
488
488
  break;
489
489
  e > 0 ? g-- : g++;
490
490
  }
491
491
  }
492
492
  }
493
- const m = Object.values(a).reduce(
493
+ const h = Object.values(a).reduce(
494
494
  (c, d) => d + c,
495
495
  0
496
496
  );
497
- if (!C(m, 100, 0.1))
497
+ if (!R(h, 100, 0.1))
498
498
  return i;
499
- const h = Object.keys(i);
500
- return a.reduce((c, d, y) => (c[h[y]] = d, c), {});
499
+ const m = Object.keys(i);
500
+ return a.reduce((c, d, y) => (c[m[y]] = d, c), {});
501
501
  }
502
502
  function oe(e) {
503
503
  const t = e.parentElement;
@@ -508,7 +508,7 @@ function oe(e) {
508
508
  return o;
509
509
  throw Error("Could not find parent Group for separator element");
510
510
  }
511
- function V(e, t) {
511
+ function W(e, t) {
512
512
  if (Object.keys(e).length !== Object.keys(t).length)
513
513
  return !1;
514
514
  for (const n in e)
@@ -528,7 +528,7 @@ function _({
528
528
  throw Error(
529
529
  `Invalid ${t.length} panel layout: ${o.map((r) => `${r}%`).join(", ")}`
530
530
  );
531
- if (!C(i, 100) && o.length > 0)
531
+ if (!R(i, 100) && o.length > 0)
532
532
  for (let r = 0; r < t.length; r++) {
533
533
  const a = o[r];
534
534
  z(a != null, `No layout data found for index ${r}`);
@@ -545,7 +545,7 @@ function _({
545
545
  });
546
546
  a != u && (s += a - u, o[r] = u);
547
547
  }
548
- if (!C(s, 0))
548
+ if (!R(s, 0))
549
549
  for (let r = 0; r < t.length; r++) {
550
550
  const a = o[r];
551
551
  z(a != null, `No layout data found for index ${r}`);
@@ -553,7 +553,7 @@ function _({
553
553
  panelConstraints: t[r],
554
554
  size: u
555
555
  });
556
- if (a !== f && (s -= f - a, o[r] = f, C(s, 0)))
556
+ if (a !== f && (s -= f - a, o[r] = f, R(s, 0)))
557
557
  break;
558
558
  }
559
559
  const l = Object.keys(e);
@@ -585,7 +585,7 @@ function Ge({
585
585
  layout: n,
586
586
  panelConstraints: i
587
587
  });
588
- return o ? l : (V(l, a) || E((u) => ({
588
+ return o ? l : (W(l, a) || E((u) => ({
589
589
  mountedGroups: new Map(u.mountedGroups).set(s, {
590
590
  defaultLayoutDeferred: o,
591
591
  derivedPanelConstraints: i,
@@ -600,7 +600,7 @@ function De(e) {
600
600
  const { mountedGroups: t } = G(), n = t.get(e);
601
601
  return z(n, `Mounted Group ${e.id} not found`), n;
602
602
  }
603
- function O(e, t) {
603
+ function T(e, t) {
604
604
  const n = oe(e), o = De(n), i = n.separators.find(
605
605
  (p) => p.element === e
606
606
  );
@@ -618,7 +618,7 @@ function O(e, t) {
618
618
  layout: u,
619
619
  panelConstraints: o.derivedPanelConstraints
620
620
  });
621
- V(a, f) || E((p) => ({
621
+ W(a, f) || E((p) => ({
622
622
  mountedGroups: new Map(p.mountedGroups).set(n, {
623
623
  defaultLayoutDeferred: o.defaultLayoutDeferred,
624
624
  derivedPanelConstraints: o.derivedPanelConstraints,
@@ -634,23 +634,23 @@ function ye(e) {
634
634
  if (!n.disabled)
635
635
  switch (e.key) {
636
636
  case "ArrowDown": {
637
- e.preventDefault(), n.orientation === "vertical" && O(t, 5);
637
+ e.preventDefault(), n.orientation === "vertical" && T(t, 5);
638
638
  break;
639
639
  }
640
640
  case "ArrowLeft": {
641
- e.preventDefault(), n.orientation === "horizontal" && O(t, -5);
641
+ e.preventDefault(), n.orientation === "horizontal" && T(t, -5);
642
642
  break;
643
643
  }
644
644
  case "ArrowRight": {
645
- e.preventDefault(), n.orientation === "horizontal" && O(t, 5);
645
+ e.preventDefault(), n.orientation === "horizontal" && T(t, 5);
646
646
  break;
647
647
  }
648
648
  case "ArrowUp": {
649
- e.preventDefault(), n.orientation === "vertical" && O(t, -5);
649
+ e.preventDefault(), n.orientation === "vertical" && T(t, -5);
650
650
  break;
651
651
  }
652
652
  case "End": {
653
- e.preventDefault(), O(t, 100);
653
+ e.preventDefault(), T(t, 100);
654
654
  break;
655
655
  }
656
656
  case "Enter": {
@@ -665,8 +665,8 @@ function ye(e) {
665
665
  (p) => p.panelId === u.id
666
666
  );
667
667
  if (z(f, "Panel metadata not found"), f.collapsible) {
668
- const p = s[u.id], m = f.collapsedSize === p ? o.inMemoryLastExpandedPanelSizes[u.id] ?? f.minSize : f.collapsedSize;
669
- O(t, m - p);
668
+ const p = s[u.id], h = f.collapsedSize === p ? o.inMemoryLastExpandedPanelSizes[u.id] ?? f.minSize : f.collapsedSize;
669
+ T(t, h - p);
670
670
  }
671
671
  break;
672
672
  }
@@ -683,13 +683,13 @@ function ye(e) {
683
683
  break;
684
684
  }
685
685
  case "Home": {
686
- e.preventDefault(), O(t, -100);
686
+ e.preventDefault(), T(t, -100);
687
687
  break;
688
688
  }
689
689
  }
690
690
  }
691
691
  const ut = (e) => e, re = () => {
692
- }, Oe = 1, Te = 2, _e = 4, Ne = 8, ge = {
692
+ }, Te = 1, Oe = 2, _e = 4, Ne = 8, ge = {
693
693
  coarse: 10,
694
694
  precise: 5
695
695
  };
@@ -869,7 +869,7 @@ function St({
869
869
  return null;
870
870
  switch (n) {
871
871
  case "active": {
872
- const s = (e & Oe) !== 0, l = (e & Te) !== 0, r = (e & _e) !== 0, a = (e & Ne) !== 0;
872
+ const s = (e & Te) !== 0, l = (e & Oe) !== 0, r = (e & _e) !== 0, a = (e & Ne) !== 0;
873
873
  if (e) {
874
874
  if (s)
875
875
  return r ? "se-resize" : a ? "ne-resize" : "e-resize";
@@ -887,7 +887,7 @@ function St({
887
887
  }
888
888
  const be = /* @__PURE__ */ new WeakMap();
889
889
  function ae(e) {
890
- if (e.defaultView === null)
890
+ if (e.defaultView === null || e.defaultView === void 0)
891
891
  return;
892
892
  let { prevStyle: t, styleSheet: n } = be.get(e) ?? {};
893
893
  n === void 0 && (n = new e.defaultView.CSSStyleSheet(), e.adoptedStyleSheets = [n]);
@@ -926,9 +926,9 @@ function Fe({
926
926
  let l = 0;
927
927
  const r = new Map(i);
928
928
  n.forEach((a) => {
929
- const { group: u, groupSize: f } = a, { disableCursor: p, orientation: m, panels: h } = u;
929
+ const { group: u, groupSize: f } = a, { disableCursor: p, orientation: h, panels: m } = u;
930
930
  let c = 0;
931
- s ? m === "horizontal" ? c = (t.clientX - s.x) / f * 100 : c = (t.clientY - s.y) / f * 100 : m === "horizontal" ? c = t.clientX < 0 ? -100 : 100 : c = t.clientY < 0 ? -100 : 100;
931
+ s ? h === "horizontal" ? c = (t.clientX - s.x) / f * 100 : c = (t.clientY - s.y) / f * 100 : h === "horizontal" ? c = t.clientX < 0 ? -100 : 100 : c = t.clientY < 0 ? -100 : 100;
932
932
  const d = o.get(u), {
933
933
  defaultLayoutDeferred: y,
934
934
  derivedPanelConstraints: v,
@@ -940,15 +940,15 @@ function Fe({
940
940
  delta: c,
941
941
  initialLayout: d,
942
942
  panelConstraints: v,
943
- pivotIndices: a.panels.map((w) => h.indexOf(w)),
943
+ pivotIndices: a.panels.map((w) => m.indexOf(w)),
944
944
  prevLayout: S,
945
945
  trigger: "mouse-or-touch"
946
946
  });
947
- if (V(g, S)) {
947
+ if (W(g, S)) {
948
948
  if (c !== 0 && !p)
949
- switch (m) {
949
+ switch (h) {
950
950
  case "horizontal": {
951
- l |= c < 0 ? Oe : Te;
951
+ l |= c < 0 ? Te : Oe;
952
952
  break;
953
953
  }
954
954
  case "vertical": {
@@ -1044,7 +1044,7 @@ function Pe(e) {
1044
1044
  }), ae(e.currentTarget);
1045
1045
  }
1046
1046
  }
1047
- function Ce(e) {
1047
+ function Re(e) {
1048
1048
  let t = 0, n = 0;
1049
1049
  const o = {};
1050
1050
  for (const s of e)
@@ -1069,7 +1069,7 @@ function xt(e, t, n) {
1069
1069
  const i = e.panels.find((l) => l.element === t);
1070
1070
  if (!i || !i.onResize)
1071
1071
  return;
1072
- const s = W({ group: e });
1072
+ const s = V({ group: e });
1073
1073
  i.onResize(
1074
1074
  {
1075
1075
  asPercentage: k(
@@ -1109,16 +1109,16 @@ function wt(e) {
1109
1109
  const { borderBoxSize: y, target: v } = d;
1110
1110
  if (v === e.element) {
1111
1111
  if (t) {
1112
- if (W({ group: e }) === 0)
1112
+ if (V({ group: e }) === 0)
1113
1113
  return;
1114
1114
  E((x) => {
1115
1115
  const g = x.mountedGroups.get(e);
1116
1116
  if (g) {
1117
- const w = me(e), L = g.defaultLayoutDeferred ? Ce(w) : g.layout, P = _({
1117
+ const w = me(e), L = g.defaultLayoutDeferred ? Re(w) : g.layout, P = _({
1118
1118
  layout: L,
1119
1119
  panelConstraints: w
1120
1120
  });
1121
- return !g.defaultLayoutDeferred && V(L, P) && zt(
1121
+ return !g.defaultLayoutDeferred && W(L, P) && zt(
1122
1122
  g.derivedPanelConstraints,
1123
1123
  w
1124
1124
  ) ? x : {
@@ -1143,19 +1143,19 @@ function wt(e) {
1143
1143
  `Panel ids must be unique; id "${c.id}" was used more than once`
1144
1144
  ), o.add(c.id), c.onResize && s.observe(c.element);
1145
1145
  });
1146
- const l = W({ group: e }), r = me(e), a = e.panels.map(({ id: c }) => c).join(",");
1146
+ const l = V({ group: e }), r = me(e), a = e.panels.map(({ id: c }) => c).join(",");
1147
1147
  let u = e.defaultLayout;
1148
1148
  u && (bt(e.panels, u) || (u = void 0));
1149
- const f = e.inMemoryLayouts[a] ?? u ?? Ce(r), p = _({
1149
+ const f = e.inMemoryLayouts[a] ?? u ?? Re(r), p = _({
1150
1150
  layout: f,
1151
1151
  panelConstraints: r
1152
- }), m = ke(e), h = e.element.ownerDocument;
1152
+ }), h = ke(e), m = e.element.ownerDocument;
1153
1153
  return E((c) => {
1154
1154
  const d = /* @__PURE__ */ new Map();
1155
1155
  return j.set(
1156
- h,
1157
- (j.get(h) ?? 0) + 1
1158
- ), m.forEach((y) => {
1156
+ m,
1157
+ (j.get(m) ?? 0) + 1
1158
+ ), h.forEach((y) => {
1159
1159
  y.separator && d.set(y.separator, y.panels);
1160
1160
  }), {
1161
1161
  mountedGroups: new Map(c.mountedGroups).set(e, {
@@ -1170,23 +1170,23 @@ function wt(e) {
1170
1170
  !i.has(c.id),
1171
1171
  `Separator ids must be unique; id "${c.id}" was used more than once`
1172
1172
  ), i.add(c.id), c.element.addEventListener("keydown", ye);
1173
- }), j.get(h) === 1 && (h.addEventListener("pointerdown", ze), h.addEventListener("pointerleave", we), h.addEventListener("pointermove", Le), h.addEventListener("pointerup", Pe)), function() {
1173
+ }), j.get(m) === 1 && (m.addEventListener("pointerdown", ze), m.addEventListener("pointerleave", we), m.addEventListener("pointermove", Le), m.addEventListener("pointerup", Pe)), function() {
1174
1174
  t = !1, j.set(
1175
- h,
1176
- Math.max(0, (j.get(h) ?? 0) - 1)
1175
+ m,
1176
+ Math.max(0, (j.get(m) ?? 0) - 1)
1177
1177
  ), E((d) => {
1178
1178
  const y = new Map(d.mountedGroups);
1179
1179
  return y.delete(e), { mountedGroups: y };
1180
1180
  }), e.separators.forEach((d) => {
1181
1181
  d.element.removeEventListener("keydown", ye);
1182
- }), j.get(h) || (h.removeEventListener("pointerdown", ze), h.removeEventListener("pointerleave", we), h.removeEventListener("pointermove", Le), h.removeEventListener("pointerup", Pe)), s.disconnect();
1182
+ }), j.get(m) || (m.removeEventListener("pointerdown", ze), m.removeEventListener("pointerleave", we), m.removeEventListener("pointermove", Le), m.removeEventListener("pointerup", Pe)), s.disconnect();
1183
1183
  };
1184
1184
  }
1185
1185
  function le(e) {
1186
1186
  const t = Ke();
1187
1187
  return `${e ?? t}`;
1188
1188
  }
1189
- const N = typeof window < "u" ? Xe : Re;
1189
+ const N = typeof window < "u" ? Xe : Ce;
1190
1190
  function ue(e) {
1191
1191
  const t = D(e);
1192
1192
  return N(() => {
@@ -1235,7 +1235,7 @@ function Pt(e, t) {
1235
1235
  );
1236
1236
  });
1237
1237
  }
1238
- function Tt({
1238
+ function Ot({
1239
1239
  children: e,
1240
1240
  className: t,
1241
1241
  defaultLayout: n,
@@ -1249,8 +1249,8 @@ function Tt({
1249
1249
  style: f,
1250
1250
  ...p
1251
1251
  }) {
1252
- const m = D({}), h = ue((b) => {
1253
- V(m.current, b) || (m.current = b, a?.(b));
1252
+ const h = D({}), m = ue((b) => {
1253
+ W(h.current, b) || (h.current = b, a?.(b));
1254
1254
  }), c = le(r), [d, y] = I(!1), [v, S] = I(null), [x, g] = I(n ?? {}), [w, L] = I([]), [P, Y] = I([]), Z = D({
1255
1255
  lastExpandedPanelSizes: {},
1256
1256
  layouts: {}
@@ -1295,9 +1295,9 @@ function Tt({
1295
1295
  const M = wt(b), pe = G().mountedGroups.get(b);
1296
1296
  if (pe) {
1297
1297
  const { defaultLayoutDeferred: F, derivedPanelConstraints: H, layout: ee } = pe;
1298
- !F && H.length > 0 && (g(ee), h?.(ee));
1298
+ !F && H.length > 0 && (g(ee), m?.(ee));
1299
1299
  }
1300
- const We = T.addListener(
1300
+ const Ve = O.addListener(
1301
1301
  "interactionStateChange",
1302
1302
  (F) => {
1303
1303
  switch (F.state) {
@@ -1315,7 +1315,7 @@ function Tt({
1315
1315
  }
1316
1316
  }
1317
1317
  }
1318
- ), Ve = T.addListener(
1318
+ ), We = O.addListener(
1319
1319
  "mountedGroupsChange",
1320
1320
  (F) => {
1321
1321
  const H = F.get(b);
@@ -1323,23 +1323,23 @@ function Tt({
1323
1323
  const { defaultLayoutDeferred: ee, derivedPanelConstraints: Ue, layout: he } = H;
1324
1324
  if (ee || Ue.length === 0)
1325
1325
  return;
1326
- g(he), h?.(he);
1326
+ g(he), m?.(he);
1327
1327
  }
1328
1328
  }
1329
1329
  );
1330
1330
  return () => {
1331
- U.current = null, M(), We(), Ve();
1331
+ U.current = null, M(), Ve(), We();
1332
1332
  };
1333
1333
  }, [
1334
1334
  i,
1335
1335
  v,
1336
1336
  c,
1337
- h,
1337
+ m,
1338
1338
  u,
1339
1339
  w,
1340
1340
  P,
1341
1341
  A
1342
- ]), Re(() => {
1342
+ ]), Ce(() => {
1343
1343
  const b = U.current;
1344
1344
  b && (b.defaultLayout = n, b.disableCursor = !!o);
1345
1345
  });
@@ -1371,7 +1371,7 @@ function Tt({
1371
1371
  }
1372
1372
  ) });
1373
1373
  }
1374
- function Ct(e, t = 10) {
1374
+ function Rt(e, t = 10) {
1375
1375
  let n = null;
1376
1376
  return (o) => {
1377
1377
  n !== null && clearTimeout(n), n = setTimeout(() => {
@@ -1379,7 +1379,7 @@ function Ct(e, t = 10) {
1379
1379
  }, t);
1380
1380
  };
1381
1381
  }
1382
- function Rt(e) {
1382
+ function Ct(e) {
1383
1383
  return `react-resizable-panels:${e}`;
1384
1384
  }
1385
1385
  function _t({
@@ -1387,7 +1387,7 @@ function _t({
1387
1387
  storage: t,
1388
1388
  ...n
1389
1389
  }) {
1390
- const o = "id" in n ? n.id : n.groupId, i = Rt(o), s = Ze(
1390
+ const o = "id" in n ? n.id : n.groupId, i = Ct(o), s = Ze(
1391
1391
  Et,
1392
1392
  () => t.getItem(i),
1393
1393
  () => t.getItem(i)
@@ -1402,7 +1402,7 @@ function _t({
1402
1402
  console.error(f);
1403
1403
  }
1404
1404
  };
1405
- return e > 0 ? Ct(a, e) : a;
1405
+ return e > 0 ? Rt(a, e) : a;
1406
1406
  }, [e, t, i]);
1407
1407
  return {
1408
1408
  defaultLayout: l,
@@ -1438,7 +1438,7 @@ function Mt({
1438
1438
  defaultLayoutDeferred: u,
1439
1439
  derivedPanelConstraints: f,
1440
1440
  layout: p,
1441
- separatorToPanels: m
1441
+ separatorToPanels: h
1442
1442
  }
1443
1443
  ] of r)
1444
1444
  if (a.id === e)
@@ -1447,7 +1447,7 @@ function Mt({
1447
1447
  derivedPanelConstraints: f,
1448
1448
  group: a,
1449
1449
  layout: p,
1450
- separatorToPanels: m
1450
+ separatorToPanels: h
1451
1451
  };
1452
1452
  throw Error(`Group ${e} not found`);
1453
1453
  }, o = () => {
@@ -1475,36 +1475,39 @@ function Mt({
1475
1475
  defaultLayoutDeferred: u,
1476
1476
  derivedPanelConstraints: f,
1477
1477
  group: p,
1478
- layout: m,
1479
- separatorToPanels: h
1478
+ layout: h,
1479
+ separatorToPanels: m
1480
1480
  } = n(), c = p.panels.findIndex((S) => S.id === t), d = c === p.panels.length - 1, y = q({
1481
1481
  delta: d ? a - r : r - a,
1482
- initialLayout: m,
1482
+ initialLayout: h,
1483
1483
  panelConstraints: f,
1484
1484
  pivotIndices: d ? [c - 1, c] : [c, c + 1],
1485
- prevLayout: m,
1485
+ prevLayout: h,
1486
1486
  trigger: "imperative-api"
1487
1487
  }), v = _({
1488
1488
  layout: y,
1489
1489
  panelConstraints: f
1490
1490
  });
1491
- V(m, v) || E((S) => ({
1491
+ W(h, v) || E((S) => ({
1492
1492
  mountedGroups: new Map(S.mountedGroups).set(p, {
1493
1493
  defaultLayoutDeferred: u,
1494
1494
  derivedPanelConstraints: f,
1495
1495
  layout: v,
1496
- separatorToPanels: h
1496
+ separatorToPanels: m
1497
1497
  })
1498
1498
  }));
1499
1499
  };
1500
1500
  return {
1501
1501
  collapse: () => {
1502
- const { collapsible: r, collapsedSize: a } = o(), u = s();
1503
- r && u !== a && l(a);
1502
+ const { collapsible: r, collapsedSize: a } = o(), { expandToSizeRef: u } = i(), f = s();
1503
+ r && f !== a && (u.current = f, l(a));
1504
1504
  },
1505
1505
  expand: () => {
1506
- const { collapsible: r, collapsedSize: a, minSize: u } = o(), f = s();
1507
- r && f === a && l(u);
1506
+ const { collapsible: r, collapsedSize: a, minSize: u } = o(), { expandToSizeRef: f } = i(), p = s();
1507
+ if (r && p === a) {
1508
+ let h = f.current ?? u;
1509
+ h === 0 && (h = 1), l(h);
1510
+ }
1508
1511
  },
1509
1512
  getSize: () => {
1510
1513
  const { group: r } = n(), a = s(), { element: u } = i(), f = r.orientation === "horizontal" ? u.offsetWidth : u.offsetHeight;
@@ -1515,14 +1518,14 @@ function Mt({
1515
1518
  },
1516
1519
  isCollapsed: () => {
1517
1520
  const { collapsible: r, collapsedSize: a } = o(), u = s();
1518
- return r && C(a, u);
1521
+ return r && R(a, u);
1519
1522
  },
1520
1523
  resize: (r) => {
1521
1524
  if (s() !== r) {
1522
1525
  let u;
1523
1526
  switch (typeof r) {
1524
1527
  case "number": {
1525
- const { group: f } = n(), p = W({ group: f });
1528
+ const { group: f } = n(), p = V({ group: f });
1526
1529
  u = k(r / p * 100);
1527
1530
  break;
1528
1531
  }
@@ -1567,17 +1570,18 @@ function $t({
1567
1570
  onResize: u,
1568
1571
  panelRef: f,
1569
1572
  style: p,
1570
- ...m
1573
+ ...h
1571
1574
  }) {
1572
- const h = !!l, c = le(l), [d, y] = I(null), v = ce(y, s), { id: S, registerPanel: x } = fe(), g = u !== null, w = ue((P) => {
1575
+ const m = !!l, c = le(l), [d, y] = I(null), v = ce(y, s), { id: S, registerPanel: x } = fe(), g = u !== null, w = ue((P) => {
1573
1576
  u?.(P, l);
1574
1577
  });
1575
1578
  N(() => {
1576
1579
  if (d !== null)
1577
1580
  return x({
1578
1581
  element: d,
1582
+ expandToSizeRef: { current: void 0 },
1579
1583
  id: c,
1580
- idIsStable: h,
1584
+ idIsStable: m,
1581
1585
  onResize: g ? w : void 0,
1582
1586
  panelConstraints: {
1583
1587
  collapsedSize: n,
@@ -1594,7 +1598,7 @@ function $t({
1594
1598
  d,
1595
1599
  g,
1596
1600
  c,
1597
- h,
1601
+ m,
1598
1602
  r,
1599
1603
  a,
1600
1604
  w,
@@ -1604,7 +1608,7 @@ function $t({
1604
1608
  return /* @__PURE__ */ K(
1605
1609
  "div",
1606
1610
  {
1607
- ...m,
1611
+ ...h,
1608
1612
  "data-panel": !0,
1609
1613
  "data-testid": c,
1610
1614
  id: c,
@@ -1706,7 +1710,7 @@ function jt({
1706
1710
  style: i,
1707
1711
  ...s
1708
1712
  }) {
1709
- const l = le(o), [r, a] = I({}), [u, f] = I("inactive"), [p, m] = I(null), h = ce(m, n), {
1713
+ const l = le(o), [r, a] = I({}), [u, f] = I("inactive"), [p, h] = I(null), m = ce(h, n), {
1710
1714
  id: c,
1711
1715
  orientation: d,
1712
1716
  registerSeparator: y
@@ -1716,7 +1720,7 @@ function jt({
1716
1720
  const S = {
1717
1721
  element: p,
1718
1722
  id: l
1719
- }, x = y(S), g = T.addListener(
1723
+ }, x = y(S), g = O.addListener(
1720
1724
  "interactionStateChange",
1721
1725
  (L) => {
1722
1726
  f(
@@ -1725,7 +1729,7 @@ function jt({
1725
1729
  ) ? L.state : "inactive"
1726
1730
  );
1727
1731
  }
1728
- ), w = T.addListener(
1732
+ ), w = O.addListener(
1729
1733
  "mountedGroupsChange",
1730
1734
  (L) => {
1731
1735
  L.forEach(
@@ -1766,7 +1770,7 @@ function jt({
1766
1770
  "data-separator": u,
1767
1771
  "data-testid": l,
1768
1772
  id: l,
1769
- ref: h,
1773
+ ref: m,
1770
1774
  role: "separator",
1771
1775
  style: {
1772
1776
  flexBasis: "auto",
@@ -1779,7 +1783,7 @@ function jt({
1779
1783
  );
1780
1784
  }
1781
1785
  export {
1782
- Tt as Group,
1786
+ Ot as Group,
1783
1787
  $t as Panel,
1784
1788
  jt as Separator,
1785
1789
  _t as useDefaultLayout,