react-resizable-panels 4.0.11 → 4.0.13

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
2
  import { jsx as K } from "react/jsx-runtime";
3
- import { useId as Xe, useLayoutEffect as Ye, useEffect as Re, useRef as O, useCallback as Ee, createContext as qe, useImperativeHandle as Me, useState as k, useMemo as ke, useSyncExternalStore as Ze, useContext as Je } from "react";
3
+ import { useId as Ve, useLayoutEffect as Ke, useEffect as Re, useRef as O, useCallback as Xe, createContext as Ye, useImperativeHandle as Ee, useState as I, useMemo as se, useSyncExternalStore as qe, useContext as Ze } from "react";
4
4
  function z(e, t = "Assertion error") {
5
5
  if (!e)
6
6
  throw Error(t);
@@ -11,20 +11,20 @@ function B({
11
11
  const { orientation: t, panels: n } = e;
12
12
  return n.reduce((o, r) => (o += t === "horizontal" ? r.element.offsetWidth : r.element.offsetHeight, o), 0);
13
13
  }
14
- function se(e, t) {
14
+ function ae(e, t) {
15
15
  return t.sort(
16
- e === "horizontal" ? Qe : et
16
+ e === "horizontal" ? Je : Qe
17
17
  );
18
18
  }
19
- function Qe(e, t) {
19
+ function Je(e, t) {
20
20
  const n = e.element.offsetLeft - t.element.offsetLeft;
21
21
  return n !== 0 ? n : e.element.offsetWidth - t.element.offsetWidth;
22
22
  }
23
- function et(e, t) {
23
+ function Qe(e, t) {
24
24
  const n = e.element.offsetTop - t.element.offsetTop;
25
25
  return n !== 0 ? n : e.element.offsetHeight - t.element.offsetHeight;
26
26
  }
27
- function Ie(e, t) {
27
+ function Me(e, t) {
28
28
  return {
29
29
  x: e.x >= t.left && e.x <= t.right ? 0 : Math.min(
30
30
  Math.abs(e.x - t.left),
@@ -36,7 +36,7 @@ function Ie(e, t) {
36
36
  )
37
37
  };
38
38
  }
39
- function tt({
39
+ function et({
40
40
  orientation: e,
41
41
  rects: t,
42
42
  targetRect: n
@@ -47,13 +47,13 @@ function tt({
47
47
  };
48
48
  let r, a = Number.MAX_VALUE;
49
49
  for (const l of t) {
50
- const { x: i, y: s } = Ie(o, l), u = e === "horizontal" ? i : s;
50
+ const { x: i, y: s } = Me(o, l), u = e === "horizontal" ? i : s;
51
51
  u < a && (a = u, r = l);
52
52
  }
53
53
  return z(r, "No rect found"), r;
54
54
  }
55
- function Ge(e) {
56
- const { element: t, orientation: n, panels: o, separators: r } = e, a = se(
55
+ function Ie(e) {
56
+ const { element: t, orientation: n, panels: o, separators: r } = e, a = ae(
57
57
  n,
58
58
  Array.from(t.children).filter((c) => c instanceof HTMLElement).map((c) => ({ element: c }))
59
59
  ).map(({ element: c }) => c), l = [];
@@ -73,24 +73,24 @@ function Ge(e) {
73
73
  m.bottom,
74
74
  m.width,
75
75
  0
76
- ), y = n === "horizontal" ? new DOMRect(p.left, p.top, 0, p.height) : new DOMRect(p.left, p.top, p.width, 0);
76
+ ), g = n === "horizontal" ? new DOMRect(p.left, p.top, 0, p.height) : new DOMRect(p.left, p.top, p.width, 0);
77
77
  switch (u.length) {
78
78
  case 0: {
79
79
  f = [
80
80
  d,
81
- y
81
+ g
82
82
  ];
83
83
  break;
84
84
  }
85
85
  case 1: {
86
- const v = u[0], S = tt({
86
+ const v = u[0], S = et({
87
87
  orientation: n,
88
88
  rects: [m, p],
89
89
  targetRect: v.element.getBoundingClientRect()
90
90
  });
91
91
  f = [
92
92
  v,
93
- S === m ? y : d
93
+ S === m ? g : d
94
94
  ];
95
95
  break;
96
96
  }
@@ -133,21 +133,21 @@ function Ge(e) {
133
133
  i = !0;
134
134
  return l;
135
135
  }
136
- function nt(e, t) {
136
+ function tt(e, t) {
137
137
  const n = getComputedStyle(e), o = parseFloat(n.fontSize);
138
138
  return t * o;
139
139
  }
140
- function ot(e, t) {
140
+ function nt(e, t) {
141
141
  const n = getComputedStyle(e.ownerDocument.body), o = parseFloat(n.fontSize);
142
142
  return t * o;
143
143
  }
144
- function it(e) {
144
+ function ot(e) {
145
145
  return e / 100 * window.innerHeight;
146
146
  }
147
- function rt(e) {
147
+ function it(e) {
148
148
  return e / 100 * window.innerWidth;
149
149
  }
150
- function st(e) {
150
+ function rt(e) {
151
151
  switch (typeof e) {
152
152
  case "number":
153
153
  return [e, "px"];
@@ -163,7 +163,7 @@ function te({
163
163
  styleProp: n
164
164
  }) {
165
165
  let o;
166
- const [r, a] = st(n);
166
+ const [r, a] = rt(n);
167
167
  switch (a) {
168
168
  case "%": {
169
169
  o = r / 100 * e;
@@ -174,28 +174,28 @@ function te({
174
174
  break;
175
175
  }
176
176
  case "rem": {
177
- o = ot(t, r);
177
+ o = nt(t, r);
178
178
  break;
179
179
  }
180
180
  case "em": {
181
- o = nt(t, r);
181
+ o = tt(t, r);
182
182
  break;
183
183
  }
184
184
  case "vh": {
185
- o = it(r);
185
+ o = ot(r);
186
186
  break;
187
187
  }
188
188
  case "vw": {
189
- o = rt(r);
189
+ o = it(r);
190
190
  break;
191
191
  }
192
192
  }
193
193
  return o;
194
194
  }
195
- function I(e) {
195
+ function k(e) {
196
196
  return parseFloat(e.toFixed(3));
197
197
  }
198
- function ye(e) {
198
+ function ge(e) {
199
199
  const { panels: t } = e, n = B({ group: e });
200
200
  return n === 0 ? t.map((o) => ({
201
201
  collapsedSize: 0,
@@ -213,7 +213,7 @@ function ye(e) {
213
213
  panelElement: r,
214
214
  styleProp: a.collapsedSize
215
215
  });
216
- l = I(c / n * 100);
216
+ l = k(c / n * 100);
217
217
  }
218
218
  let i;
219
219
  if (a.defaultSize) {
@@ -222,7 +222,7 @@ function ye(e) {
222
222
  panelElement: r,
223
223
  styleProp: a.defaultSize
224
224
  });
225
- i = I(c / n * 100);
225
+ i = k(c / n * 100);
226
226
  }
227
227
  let s = 0;
228
228
  if (a.minSize) {
@@ -231,7 +231,7 @@ function ye(e) {
231
231
  panelElement: r,
232
232
  styleProp: a.minSize
233
233
  });
234
- s = I(c / n * 100);
234
+ s = k(c / n * 100);
235
235
  }
236
236
  let u = 100;
237
237
  if (a.maxSize) {
@@ -240,7 +240,7 @@ function ye(e) {
240
240
  panelElement: r,
241
241
  styleProp: a.maxSize
242
242
  });
243
- u = I(c / n * 100);
243
+ u = k(c / n * 100);
244
244
  }
245
245
  return {
246
246
  collapsedSize: l,
@@ -252,7 +252,7 @@ function ye(e) {
252
252
  };
253
253
  });
254
254
  }
255
- class at {
255
+ class st {
256
256
  #e = {};
257
257
  addListener(t, n) {
258
258
  const o = this.#e[t];
@@ -292,7 +292,7 @@ class at {
292
292
  }
293
293
  }
294
294
  function P(e, t, n = 0) {
295
- return Math.abs(I(e) - I(t)) <= n;
295
+ return Math.abs(k(e) - k(t)) <= n;
296
296
  }
297
297
  let R = {
298
298
  cursorFlags: 0,
@@ -301,7 +301,7 @@ let R = {
301
301
  },
302
302
  mountedGroups: /* @__PURE__ */ new Map()
303
303
  };
304
- const _ = new at();
304
+ const _ = new st();
305
305
  function D() {
306
306
  return R;
307
307
  }
@@ -331,12 +331,12 @@ function E(e) {
331
331
  });
332
332
  }), _.emit("mountedGroupsChange", R.mountedGroups)), R;
333
333
  }
334
- const lt = (e) => e, ie = () => {
335
- }, De = 1, Oe = 2, Te = 4, _e = 8, ge = {
334
+ const at = (e) => e, ie = () => {
335
+ }, ke = 1, Ge = 2, De = 4, Oe = 8, ye = {
336
336
  coarse: 10,
337
337
  precise: 5
338
338
  };
339
- function ut({
339
+ function lt({
340
340
  cursorFlags: e,
341
341
  groups: t,
342
342
  state: n
@@ -363,7 +363,7 @@ function ut({
363
363
  return null;
364
364
  switch (n) {
365
365
  case "active": {
366
- const a = (e & De) !== 0, l = (e & Oe) !== 0, i = (e & Te) !== 0, s = (e & _e) !== 0;
366
+ const a = (e & ke) !== 0, l = (e & Ge) !== 0, i = (e & De) !== 0, s = (e & Oe) !== 0;
367
367
  if (e) {
368
368
  if (a)
369
369
  return i ? "se-resize" : s ? "ne-resize" : "e-resize";
@@ -386,7 +386,7 @@ function le() {
386
386
  switch (t.state) {
387
387
  case "active":
388
388
  case "hover": {
389
- const n = ut({
389
+ const n = lt({
390
390
  cursorFlags: e,
391
391
  groups: t.hitRegions.map((r) => r.group),
392
392
  state: t.state
@@ -402,7 +402,7 @@ function le() {
402
402
  }
403
403
  }
404
404
  }
405
- function ct(e, t) {
405
+ function ut(e, t) {
406
406
  if (e.length !== t.length)
407
407
  return !1;
408
408
  for (let n = 0; n < e.length; n++)
@@ -429,7 +429,7 @@ function W({
429
429
  X(t, l) < 0 ? t = n : t = a;
430
430
  } else
431
431
  t = a;
432
- return t = Math.min(r, t), t = I(t), t;
432
+ return t = Math.min(r, t), t = k(t), t;
433
433
  }
434
434
  function Y({
435
435
  delta: e,
@@ -452,7 +452,7 @@ function Y({
452
452
  `Panel constraints not found for index ${f}`
453
453
  );
454
454
  const {
455
- collapsedSize: y = 0,
455
+ collapsedSize: g = 0,
456
456
  collapsible: v,
457
457
  minSize: S = 0
458
458
  } = d;
@@ -461,9 +461,9 @@ function Y({
461
461
  if (z(
462
462
  x != null,
463
463
  `Previous layout not found for panel index ${f}`
464
- ), P(x, y)) {
465
- const g = S - x;
466
- X(g, Math.abs(e)) > 0 && (e = e < 0 ? 0 - g : g);
464
+ ), P(x, g)) {
465
+ const y = S - x;
466
+ X(y, Math.abs(e)) > 0 && (e = e < 0 ? 0 - y : y);
467
467
  }
468
468
  }
469
469
  }
@@ -474,7 +474,7 @@ function Y({
474
474
  `No panel constraints found for index ${f}`
475
475
  );
476
476
  const {
477
- collapsedSize: y = 0,
477
+ collapsedSize: g = 0,
478
478
  collapsible: v,
479
479
  minSize: S = 0
480
480
  } = d;
@@ -484,40 +484,40 @@ function Y({
484
484
  x != null,
485
485
  `Previous layout not found for panel index ${f}`
486
486
  ), P(x, S)) {
487
- const g = x - y;
488
- X(g, Math.abs(e)) > 0 && (e = e < 0 ? 0 - g : g);
487
+ const y = x - g;
488
+ X(y, Math.abs(e)) > 0 && (e = e < 0 ? 0 - y : y);
489
489
  }
490
490
  }
491
491
  }
492
492
  }
493
493
  {
494
494
  const f = e < 0 ? 1 : -1;
495
- let d = e < 0 ? c : u, y = 0;
495
+ let d = e < 0 ? c : u, g = 0;
496
496
  for (; ; ) {
497
497
  const S = l[d];
498
498
  z(
499
499
  S != null,
500
500
  `Previous layout not found for panel index ${d}`
501
501
  );
502
- const g = W({
502
+ const y = W({
503
503
  panelConstraints: n[d],
504
504
  size: 100
505
505
  }) - S;
506
- if (y += g, d += f, d < 0 || d >= n.length)
506
+ if (g += y, d += f, d < 0 || d >= n.length)
507
507
  break;
508
508
  }
509
- const v = Math.min(Math.abs(e), Math.abs(y));
509
+ const v = Math.min(Math.abs(e), Math.abs(g));
510
510
  e = e < 0 ? 0 - v : v;
511
511
  }
512
512
  {
513
513
  let d = e < 0 ? u : c;
514
514
  for (; d >= 0 && d < n.length; ) {
515
- const y = Math.abs(e) - Math.abs(h), v = l[d];
515
+ const g = Math.abs(e) - Math.abs(h), v = l[d];
516
516
  z(
517
517
  v != null,
518
518
  `Previous layout not found for panel index ${d}`
519
519
  );
520
- const S = v - y, x = W({
520
+ const S = v - g, x = W({
521
521
  panelConstraints: n[d],
522
522
  size: S
523
523
  });
@@ -528,7 +528,7 @@ function Y({
528
528
  e < 0 ? d-- : d++;
529
529
  }
530
530
  }
531
- if (ct(i, s))
531
+ if (ut(i, s))
532
532
  return r;
533
533
  {
534
534
  const f = e < 0 ? c : u, d = l[f];
@@ -536,25 +536,25 @@ function Y({
536
536
  d != null,
537
537
  `Previous layout not found for panel index ${f}`
538
538
  );
539
- const y = d + h, v = W({
539
+ const g = d + h, v = W({
540
540
  panelConstraints: n[f],
541
- size: y
541
+ size: g
542
542
  });
543
- if (s[f] = v, !P(v, y)) {
544
- let S = y - v, g = e < 0 ? c : u;
545
- for (; g >= 0 && g < n.length; ) {
546
- const b = s[g];
543
+ if (s[f] = v, !P(v, g)) {
544
+ let S = g - v, y = e < 0 ? c : u;
545
+ for (; y >= 0 && y < n.length; ) {
546
+ const b = s[y];
547
547
  z(
548
548
  b != null,
549
- `Previous layout not found for panel index ${g}`
549
+ `Previous layout not found for panel index ${y}`
550
550
  );
551
551
  const L = b + S, C = W({
552
- panelConstraints: n[g],
552
+ panelConstraints: n[y],
553
553
  size: L
554
554
  });
555
- if (P(b, C) || (S -= C - b, s[g] = C), P(S, 0))
555
+ if (P(b, C) || (S -= C - b, s[y] = C), P(S, 0))
556
556
  break;
557
- e > 0 ? g-- : g++;
557
+ e > 0 ? y-- : y++;
558
558
  }
559
559
  }
560
560
  }
@@ -565,7 +565,7 @@ function Y({
565
565
  if (!P(m, 100, 0.1))
566
566
  return r;
567
567
  const p = Object.keys(r);
568
- return s.reduce((f, d, y) => (f[p[y]] = d, f), {});
568
+ return s.reduce((f, d, g) => (f[p[g]] = d, f), {});
569
569
  }
570
570
  function U(e, t) {
571
571
  if (Object.keys(e).length !== Object.keys(t).length)
@@ -575,7 +575,7 @@ function U(e, t) {
575
575
  return !1;
576
576
  return !0;
577
577
  }
578
- function Ae({
578
+ function Te({
579
579
  event: e,
580
580
  hitRegions: t,
581
581
  initialLayoutMap: n,
@@ -590,16 +590,16 @@ function Ae({
590
590
  r ? h === "horizontal" ? p = (e.clientX - r.x) / u * 100 : p = (e.clientY - r.y) / u * 100 : h === "horizontal" ? p = e.clientX < 0 ? -100 : 100 : p = e.clientY < 0 ? -100 : 100;
591
591
  const f = n.get(s), {
592
592
  defaultLayoutDeferred: d,
593
- derivedPanelConstraints: y,
593
+ derivedPanelConstraints: g,
594
594
  layout: v,
595
595
  separatorToPanels: S
596
596
  } = o.get(s) ?? { defaultLayoutDeferred: !1 };
597
- if (y && f && v && S) {
597
+ if (g && f && v && S) {
598
598
  const x = Y({
599
599
  delta: p,
600
600
  initialLayout: f,
601
- panelConstraints: y,
602
- pivotIndices: i.panels.map((g) => m.indexOf(g)),
601
+ panelConstraints: g,
602
+ pivotIndices: i.panels.map((y) => m.indexOf(y)),
603
603
  prevLayout: v,
604
604
  trigger: "mouse-or-touch"
605
605
  });
@@ -607,23 +607,23 @@ function Ae({
607
607
  if (p !== 0 && !c)
608
608
  switch (h) {
609
609
  case "horizontal": {
610
- a |= p < 0 ? De : Oe;
610
+ a |= p < 0 ? ke : Ge;
611
611
  break;
612
612
  }
613
613
  case "vertical": {
614
- a |= p < 0 ? Te : _e;
614
+ a |= p < 0 ? De : Oe;
615
615
  break;
616
616
  }
617
617
  }
618
618
  } else {
619
619
  l.set(i.group, {
620
620
  defaultLayoutDeferred: d,
621
- derivedPanelConstraints: y,
621
+ derivedPanelConstraints: g,
622
622
  layout: x,
623
623
  separatorToPanels: S
624
624
  });
625
- const g = i.group.panels.map(({ id: b }) => b).join(",");
626
- i.group.inMemoryLayouts[g] = x;
625
+ const y = i.group.panels.map(({ id: b }) => b).join(",");
626
+ i.group.inMemoryLayouts[y] = x;
627
627
  }
628
628
  }
629
629
  }), E({
@@ -642,7 +642,7 @@ function ve(e) {
642
642
  switch (t.state) {
643
643
  case "active":
644
644
  t.hitRegions.forEach((o) => {
645
- e.currentTarget === o.group.element && Ae({
645
+ e.currentTarget === o.group.element && Te({
646
646
  event: e,
647
647
  hitRegions: t.hitRegions,
648
648
  initialLayoutMap: t.initialLayoutMap,
@@ -703,7 +703,7 @@ function A({
703
703
  const l = Object.keys(e);
704
704
  return o.reduce((i, s, u) => (i[l[u]] = s, i), {});
705
705
  }
706
- function Ne({
706
+ function _e({
707
707
  groupId: e
708
708
  }) {
709
709
  const t = () => {
@@ -740,18 +740,18 @@ function Ne({
740
740
  }
741
741
  };
742
742
  }
743
- function $e(e) {
743
+ function Ae(e) {
744
744
  const { mountedGroups: t } = D(), n = t.get(e);
745
745
  return z(n, `Mounted Group ${e.id} not found`), n;
746
746
  }
747
747
  function T(e, t) {
748
- const n = oe(e), o = $e(n), r = n.separators.find(
748
+ const n = oe(e), o = Ae(n), r = n.separators.find(
749
749
  (h) => h.element === e
750
750
  );
751
751
  z(r, "Matching separator not found");
752
752
  const a = o.separatorToPanels.get(r);
753
753
  z(a, "Matching panels not found");
754
- const l = a.map((h) => n.panels.indexOf(h)), s = Ne({ groupId: n.id }).getLayout(), u = Y({
754
+ const l = a.map((h) => n.panels.indexOf(h)), s = _e({ groupId: n.id }).getLayout(), u = Y({
755
755
  delta: t,
756
756
  initialLayout: s,
757
757
  panelConstraints: o.derivedPanelConstraints,
@@ -799,7 +799,7 @@ function Se(e) {
799
799
  }
800
800
  case "Enter": {
801
801
  e.preventDefault();
802
- const o = oe(t), { derivedPanelConstraints: r, layout: a, separatorToPanels: l } = $e(o), i = o.separators.find(
802
+ const o = oe(t), { derivedPanelConstraints: r, layout: a, separatorToPanels: l } = Ae(o), i = o.separators.find(
803
803
  (h) => h.element === t
804
804
  );
805
805
  z(i, "Matching separator not found");
@@ -832,13 +832,13 @@ function Se(e) {
832
832
  }
833
833
  }
834
834
  }
835
- function ft(e, t, n) {
835
+ function ct(e, t, n) {
836
836
  let o, r = {
837
837
  x: 1 / 0,
838
838
  y: 1 / 0
839
839
  };
840
840
  for (const a of t) {
841
- const l = Ie(n, a.rect);
841
+ const l = Me(n, a.rect);
842
842
  switch (e) {
843
843
  case "horizontal": {
844
844
  l.x <= r.x && (o = a, r = l);
@@ -856,10 +856,10 @@ function ft(e, t, n) {
856
856
  } : void 0;
857
857
  }
858
858
  let ne;
859
- function dt() {
859
+ function ft() {
860
860
  return ne === void 0 && (typeof matchMedia == "function" ? ne = !!matchMedia("(pointer:coarse)").matches : ne = !1), ne;
861
861
  }
862
- function pt(e, t) {
862
+ function dt(e, t) {
863
863
  if (e === t) throw new Error("Cannot compare node with itself");
864
864
  const n = {
865
865
  a: we(e),
@@ -890,20 +890,20 @@ function pt(e, t) {
890
890
  }
891
891
  return Math.sign(r.a - r.b);
892
892
  }
893
- const ht = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
894
- function mt(e) {
895
- const t = getComputedStyle(Fe(e) ?? e).display;
893
+ const pt = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
894
+ function ht(e) {
895
+ const t = getComputedStyle(Ne(e) ?? e).display;
896
896
  return t === "flex" || t === "inline-flex";
897
897
  }
898
- function yt(e) {
898
+ function mt(e) {
899
899
  const t = getComputedStyle(e);
900
- return !!(t.position === "fixed" || t.zIndex !== "auto" && (t.position !== "static" || mt(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" || ht.test(t.willChange) || t.webkitOverflowScrolling === "touch");
900
+ return !!(t.position === "fixed" || t.zIndex !== "auto" && (t.position !== "static" || ht(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" || pt.test(t.willChange) || t.webkitOverflowScrolling === "touch");
901
901
  }
902
902
  function xe(e) {
903
903
  let t = e.length;
904
904
  for (; t--; ) {
905
905
  const n = e[t];
906
- if (z(n, "Missing node"), yt(n)) return n;
906
+ if (z(n, "Missing node"), mt(n)) return n;
907
907
  }
908
908
  return null;
909
909
  }
@@ -913,24 +913,24 @@ function ze(e) {
913
913
  function we(e) {
914
914
  const t = [];
915
915
  for (; e; )
916
- t.push(e), e = Fe(e);
916
+ t.push(e), e = Ne(e);
917
917
  return t;
918
918
  }
919
- function Fe(e) {
919
+ function Ne(e) {
920
920
  const { parentNode: t } = e;
921
921
  return t && t instanceof ShadowRoot ? t.host : t;
922
922
  }
923
923
  function gt(e, t) {
924
924
  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;
925
925
  }
926
- function vt({
926
+ function yt({
927
927
  groupElement: e,
928
928
  hitRegion: t,
929
929
  pointerEventTarget: n
930
930
  }) {
931
931
  if (!(n instanceof HTMLElement) || n.contains(e) || e.contains(n))
932
932
  return !0;
933
- if (pt(n, e) > 0) {
933
+ if (dt(n, e) > 0) {
934
934
  let o = n;
935
935
  for (; o; ) {
936
936
  if (o.contains(e))
@@ -942,16 +942,16 @@ function vt({
942
942
  }
943
943
  return !0;
944
944
  }
945
- function He(e, t) {
945
+ function $e(e, t) {
946
946
  const n = [];
947
947
  return t.forEach((o, r) => {
948
948
  if (r.disabled)
949
949
  return;
950
- const a = dt() ? ge.coarse : ge.precise, l = Ge(r), i = ft(r.orientation, l, {
950
+ const a = ft() ? ye.coarse : ye.precise, l = Ie(r), i = ct(r.orientation, l, {
951
951
  x: e.clientX,
952
952
  y: e.clientY
953
953
  });
954
- i && i.distance.x <= a && i.distance.y <= a && vt({
954
+ i && i.distance.x <= a && i.distance.y <= a && yt({
955
955
  groupElement: r.element,
956
956
  hitRegion: i.hitRegion.rect,
957
957
  pointerEventTarget: e.target
@@ -961,7 +961,7 @@ function He(e, t) {
961
961
  function be(e) {
962
962
  if (e.defaultPrevented)
963
963
  return;
964
- const { mountedGroups: t } = D(), n = He(e, t), o = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Map();
964
+ const { mountedGroups: t } = D(), n = $e(e, t), o = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Map();
965
965
  let i = !1;
966
966
  n.forEach((s) => {
967
967
  o.add(s.group), s.panels.forEach((c) => {
@@ -998,7 +998,7 @@ function Le(e) {
998
998
  );
999
999
  return;
1000
1000
  }
1001
- Ae({
1001
+ Te({
1002
1002
  event: e,
1003
1003
  hitRegions: t.hitRegions,
1004
1004
  initialLayoutMap: t.initialLayoutMap,
@@ -1008,7 +1008,7 @@ function Le(e) {
1008
1008
  break;
1009
1009
  }
1010
1010
  default: {
1011
- const o = He(e, n);
1011
+ const o = $e(e, n);
1012
1012
  o.length === 0 ? t.state !== "inactive" && E({
1013
1013
  interactionState: { state: "inactive" }
1014
1014
  }) : E({
@@ -1042,19 +1042,19 @@ function Ce(e) {
1042
1042
  for (const a of e)
1043
1043
  if (a.defaultSize !== void 0) {
1044
1044
  t++;
1045
- const l = I(a.defaultSize);
1045
+ const l = k(a.defaultSize);
1046
1046
  n += l, o[a.panelId] = l;
1047
1047
  } else
1048
1048
  o[a.panelId] = void 0;
1049
1049
  const r = e.length - t;
1050
1050
  if (r !== 0) {
1051
- const a = I((100 - n) / r);
1051
+ const a = k((100 - n) / r);
1052
1052
  for (const l of e)
1053
1053
  l.defaultSize === void 0 && (o[l.panelId] = a);
1054
1054
  }
1055
1055
  return o;
1056
1056
  }
1057
- function St(e, t, n) {
1057
+ function vt(e, t, n) {
1058
1058
  const o = n[0];
1059
1059
  if (!o)
1060
1060
  return;
@@ -1064,7 +1064,7 @@ function St(e, t, n) {
1064
1064
  const a = B({ group: e });
1065
1065
  r.onResize(
1066
1066
  {
1067
- asPercentage: I(
1067
+ asPercentage: k(
1068
1068
  o.inlineSize / a * 100
1069
1069
  ),
1070
1070
  inPixels: o.inlineSize
@@ -1072,7 +1072,7 @@ function St(e, t, n) {
1072
1072
  r.id
1073
1073
  );
1074
1074
  }
1075
- function xt(e, t) {
1075
+ function St(e, t) {
1076
1076
  if (Object.keys(e).length !== Object.keys(t).length)
1077
1077
  return !1;
1078
1078
  for (const o in e)
@@ -1080,29 +1080,29 @@ function xt(e, t) {
1080
1080
  return !1;
1081
1081
  return !0;
1082
1082
  }
1083
- function zt(e) {
1083
+ function xt(e) {
1084
1084
  let t = !0;
1085
1085
  const n = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), r = new ResizeObserver((p) => {
1086
1086
  for (const f of p) {
1087
- const { borderBoxSize: d, target: y } = f;
1088
- if (y === e.element) {
1087
+ const { borderBoxSize: d, target: g } = f;
1088
+ if (g === e.element) {
1089
1089
  if (t) {
1090
1090
  if (B({ group: e }) === 0)
1091
1091
  return;
1092
1092
  E((S) => {
1093
1093
  const x = S.mountedGroups.get(e);
1094
1094
  if (x) {
1095
- const g = ye(e), b = x.defaultLayoutDeferred ? Ce(g) : x.layout, L = A({
1095
+ const y = ge(e), b = x.defaultLayoutDeferred ? Ce(y) : x.layout, L = A({
1096
1096
  layout: b,
1097
- panelConstraints: g
1097
+ panelConstraints: y
1098
1098
  });
1099
- return !x.defaultLayoutDeferred && U(b, L) && xt(
1099
+ return !x.defaultLayoutDeferred && U(b, L) && St(
1100
1100
  x.derivedPanelConstraints,
1101
- g
1101
+ y
1102
1102
  ) ? S : {
1103
1103
  mountedGroups: new Map(S.mountedGroups).set(e, {
1104
1104
  defaultLayoutDeferred: !1,
1105
- derivedPanelConstraints: g,
1105
+ derivedPanelConstraints: y,
1106
1106
  layout: L,
1107
1107
  separatorToPanels: x.separatorToPanels
1108
1108
  })
@@ -1112,7 +1112,7 @@ function zt(e) {
1112
1112
  });
1113
1113
  }
1114
1114
  } else
1115
- St(e, y, d);
1115
+ vt(e, g, d);
1116
1116
  }
1117
1117
  });
1118
1118
  r.observe(e.element), e.panels.forEach((p) => {
@@ -1121,13 +1121,13 @@ function zt(e) {
1121
1121
  `Panel ids must be unique; id "${p.id}" was used more than once`
1122
1122
  ), n.add(p.id), p.onResize && r.observe(p.element);
1123
1123
  });
1124
- const a = B({ group: e }), l = ye(e), i = e.panels.map(({ id: p }) => p).join(",");
1124
+ const a = B({ group: e }), l = ge(e), i = e.panels.map(({ id: p }) => p).join(",");
1125
1125
  let s = e.defaultLayout;
1126
1126
  s && e.panels.length !== Object.keys(s).length && (s = void 0);
1127
1127
  const u = e.inMemoryLayouts[i] ?? s ?? Ce(l), c = A({
1128
1128
  layout: u,
1129
1129
  panelConstraints: l
1130
- }), h = Ge(e), m = E((p) => {
1130
+ }), h = Ie(e), m = E((p) => {
1131
1131
  const f = /* @__PURE__ */ new Map();
1132
1132
  return h.forEach((d) => {
1133
1133
  d.separator && f.set(d.separator, d.panels);
@@ -1148,8 +1148,8 @@ function zt(e) {
1148
1148
  }), m.mountedGroups.size === 1 && (window.addEventListener("pointerdown", be), window.addEventListener("pointermove", Le), window.addEventListener("pointerup", Pe)), function() {
1149
1149
  t = !1;
1150
1150
  const f = E((d) => {
1151
- const y = new Map(d.mountedGroups);
1152
- return y.delete(e), { mountedGroups: y };
1151
+ const g = new Map(d.mountedGroups);
1152
+ return g.delete(e), { mountedGroups: g };
1153
1153
  });
1154
1154
  e.element.removeEventListener("pointerleave", ve), e.separators.forEach((d) => {
1155
1155
  d.element.removeEventListener("keydown", Se);
@@ -1157,15 +1157,15 @@ function zt(e) {
1157
1157
  };
1158
1158
  }
1159
1159
  function ue(e) {
1160
- const t = Xe();
1160
+ const t = Ve();
1161
1161
  return `${e ?? t}`;
1162
1162
  }
1163
- const N = typeof window < "u" ? Ye : Re;
1163
+ const N = typeof window < "u" ? Ke : Re;
1164
1164
  function ce(e) {
1165
1165
  const t = O(e);
1166
1166
  return N(() => {
1167
1167
  t.current = e;
1168
- }, [e]), Ee((n) => t.current?.(n), [t]);
1168
+ }, [e]), Xe((n) => t.current?.(n), [t]);
1169
1169
  }
1170
1170
  function fe(...e) {
1171
1171
  return ce((t) => {
@@ -1184,28 +1184,28 @@ function fe(...e) {
1184
1184
  });
1185
1185
  });
1186
1186
  }
1187
- function wt(e) {
1187
+ function zt(e) {
1188
1188
  const t = O({ ...e });
1189
1189
  return N(() => {
1190
1190
  for (const n in e)
1191
1191
  t.current[n] = e[n];
1192
1192
  }, [e]), t.current;
1193
1193
  }
1194
- const je = "--react-resizable-panels--panel--pointer-events";
1195
- function We(e, t) {
1194
+ const Fe = "--react-resizable-panels--panel--pointer-events";
1195
+ function He(e, t) {
1196
1196
  const n = e.replace(/[^a-zA-Z0-9\-_]/g, ""), o = t.replace(/[^a-zA-Z0-9\-_]/g, "");
1197
1197
  return `--react-resizable-panels--${n}--${o}`;
1198
1198
  }
1199
- const Be = qe(null);
1200
- function bt(e, t) {
1199
+ const je = Ye(null);
1200
+ function wt(e, t) {
1201
1201
  const n = O({
1202
1202
  getLayout: () => ({}),
1203
- setLayout: lt
1203
+ setLayout: at
1204
1204
  });
1205
- Me(t, () => n.current, []), N(() => {
1205
+ Ee(t, () => n.current, []), N(() => {
1206
1206
  Object.assign(
1207
1207
  n.current,
1208
- Ne({ groupId: e })
1208
+ _e({ groupId: e })
1209
1209
  );
1210
1210
  });
1211
1211
  }
@@ -1225,20 +1225,20 @@ function Gt({
1225
1225
  }) {
1226
1226
  const m = O({}), p = ce((w) => {
1227
1227
  U(m.current, w) || (m.current = w, s?.(w));
1228
- }), f = ue(i), [d, y] = k(!1), [v, S] = k(null), [x, g] = k(n ?? {}), [b, L] = k([]), [C, q] = k([]), Z = O({
1228
+ }), f = ue(i), [d, g] = I(!1), [v, S] = I(null), [x, y] = I(n ?? {}), [b, L] = I([]), [C, q] = I([]), Z = O({
1229
1229
  lastExpandedPanelSizes: {},
1230
1230
  layouts: {}
1231
1231
  }), J = fe(S, a);
1232
- bt(f, l);
1233
- const Q = ke(
1232
+ wt(f, l);
1233
+ const Q = se(
1234
1234
  () => ({
1235
1235
  id: f,
1236
1236
  orientation: u,
1237
- registerPanel: (w) => (L((M) => se(u, [...M, w])), () => {
1237
+ registerPanel: (w) => (L((M) => ae(u, [...M, w])), () => {
1238
1238
  L((M) => M.filter((F) => F !== w));
1239
1239
  }),
1240
1240
  registerSeparator: (w) => (q(
1241
- (M) => se(u, [...M, w])
1241
+ (M) => ae(u, [...M, w])
1242
1242
  ), () => {
1243
1243
  q(
1244
1244
  (M) => M.filter((F) => F !== w)
@@ -1246,7 +1246,7 @@ function Gt({
1246
1246
  })
1247
1247
  }),
1248
1248
  [f, u]
1249
- ), $ = wt({
1249
+ ), $ = zt({
1250
1250
  defaultLayout: n,
1251
1251
  disableCursor: o
1252
1252
  }), V = O(null);
@@ -1266,17 +1266,17 @@ function Gt({
1266
1266
  separators: C
1267
1267
  };
1268
1268
  V.current = w;
1269
- const M = zt(w), he = D().mountedGroups.get(w);
1269
+ const M = xt(w), he = D().mountedGroups.get(w);
1270
1270
  if (he) {
1271
1271
  const { defaultLayoutDeferred: H, derivedPanelConstraints: j, layout: ee } = he;
1272
- !H && j.length > 0 && (g(ee), p?.(ee));
1272
+ !H && j.length > 0 && (y(ee), p?.(ee));
1273
1273
  }
1274
- const Ue = _.addListener(
1274
+ const We = _.addListener(
1275
1275
  "interactionStateChange",
1276
1276
  (H) => {
1277
1277
  switch (H.state) {
1278
1278
  case "active": {
1279
- y(
1279
+ g(
1280
1280
  H.hitRegions.some(
1281
1281
  (j) => j.group === w
1282
1282
  )
@@ -1284,25 +1284,25 @@ function Gt({
1284
1284
  break;
1285
1285
  }
1286
1286
  default: {
1287
- y(!1);
1287
+ g(!1);
1288
1288
  break;
1289
1289
  }
1290
1290
  }
1291
1291
  }
1292
- ), Ve = _.addListener(
1292
+ ), Be = _.addListener(
1293
1293
  "mountedGroupsChange",
1294
1294
  (H) => {
1295
1295
  const j = H.get(w);
1296
1296
  if (j) {
1297
- const { defaultLayoutDeferred: ee, derivedPanelConstraints: Ke, layout: me } = j;
1298
- if (ee || Ke.length === 0)
1297
+ const { defaultLayoutDeferred: ee, derivedPanelConstraints: Ue, layout: me } = j;
1298
+ if (ee || Ue.length === 0)
1299
1299
  return;
1300
- g(me), p?.(me);
1300
+ y(me), p?.(me);
1301
1301
  }
1302
1302
  }
1303
1303
  );
1304
1304
  return () => {
1305
- V.current = null, M(), Ue(), Ve();
1305
+ V.current = null, M(), We(), Be();
1306
1306
  };
1307
1307
  }, [
1308
1308
  r,
@@ -1318,13 +1318,13 @@ function Gt({
1318
1318
  w && (w.defaultLayout = n, w.disableCursor = !!o);
1319
1319
  });
1320
1320
  const pe = {
1321
- [je]: d ? "none" : void 0
1321
+ [Fe]: d ? "none" : void 0
1322
1322
  };
1323
1323
  for (const w in x) {
1324
- const M = We(f, w), F = x[w];
1324
+ const M = He(f, w), F = x[w];
1325
1325
  pe[M] = F;
1326
1326
  }
1327
- return /* @__PURE__ */ K(Be.Provider, { value: Q, children: /* @__PURE__ */ K(
1327
+ return /* @__PURE__ */ K(je.Provider, { value: Q, children: /* @__PURE__ */ K(
1328
1328
  "div",
1329
1329
  {
1330
1330
  ...h,
@@ -1345,43 +1345,42 @@ function Gt({
1345
1345
  }
1346
1346
  ) });
1347
1347
  }
1348
- function ae(e) {
1349
- return `react-resizable-panels:${e}`;
1348
+ function bt(e, t = 10) {
1349
+ let n = null;
1350
+ return (o) => {
1351
+ n !== null && clearTimeout(n), n = setTimeout(() => {
1352
+ e(o);
1353
+ }, t);
1354
+ };
1350
1355
  }
1351
- function Lt({
1352
- id: e,
1353
- layout: t,
1354
- storage: n
1355
- }) {
1356
- try {
1357
- const o = ae(e);
1358
- n.setItem(o, JSON.stringify(t));
1359
- } catch (o) {
1360
- console.error(o);
1361
- }
1356
+ function Lt(e) {
1357
+ return `react-resizable-panels:${e}`;
1362
1358
  }
1363
1359
  function Dt({
1364
- groupId: e,
1365
- storage: t
1360
+ debounceSaveMs: e = 100,
1361
+ storage: t,
1362
+ ...n
1366
1363
  }) {
1367
- const n = Ze(
1364
+ const o = "id" in n ? n.id : n.groupId, r = Lt(o), a = qe(
1368
1365
  Pt,
1369
- () => t.getItem(ae(e)),
1370
- () => t.getItem(ae(e))
1371
- ), o = ke(
1372
- () => n ? JSON.parse(n) : void 0,
1373
- [n]
1374
- ), r = Ee(
1375
- (a) => Lt({
1376
- id: e,
1377
- layout: a,
1378
- storage: t
1379
- }),
1380
- [e, t]
1381
- );
1366
+ () => t.getItem(r),
1367
+ () => t.getItem(r)
1368
+ ), l = se(
1369
+ () => a ? JSON.parse(a) : void 0,
1370
+ [a]
1371
+ ), i = se(() => {
1372
+ const s = (u) => {
1373
+ try {
1374
+ t.setItem(r, JSON.stringify(u));
1375
+ } catch (c) {
1376
+ console.error(c);
1377
+ }
1378
+ };
1379
+ return e > 0 ? bt(s, e) : s;
1380
+ }, [e, t, r]);
1382
1381
  return {
1383
- defaultLayout: o,
1384
- onLayoutChange: r
1382
+ defaultLayout: l,
1383
+ onLayoutChange: i
1385
1384
  };
1386
1385
  }
1387
1386
  function Pt() {
@@ -1389,13 +1388,13 @@ function Pt() {
1389
1388
  };
1390
1389
  }
1391
1390
  function Ot() {
1392
- return k(null);
1391
+ return I(null);
1393
1392
  }
1394
1393
  function Tt() {
1395
1394
  return O(null);
1396
1395
  }
1397
1396
  function de() {
1398
- const e = Je(Be);
1397
+ const e = Ze(je);
1399
1398
  return z(
1400
1399
  e,
1401
1400
  "Group Context not found; did you render a Panel or Separator outside of a Group?"
@@ -1452,7 +1451,7 @@ function Ct({
1452
1451
  group: h,
1453
1452
  layout: m,
1454
1453
  separatorToPanels: p
1455
- } = n(), f = h.panels.findIndex((S) => S.id === t), d = f === h.panels.length - 1, y = Y({
1454
+ } = n(), f = h.panels.findIndex((S) => S.id === t), d = f === h.panels.length - 1, g = Y({
1456
1455
  delta: d ? s - i : i - s,
1457
1456
  initialLayout: m,
1458
1457
  panelConstraints: c,
@@ -1460,7 +1459,7 @@ function Ct({
1460
1459
  prevLayout: m,
1461
1460
  trigger: "imperative-api"
1462
1461
  }), v = A({
1463
- layout: y,
1462
+ layout: g,
1464
1463
  panelConstraints: c
1465
1464
  });
1466
1465
  U(m, v) || E((S) => ({
@@ -1498,7 +1497,7 @@ function Ct({
1498
1497
  switch (typeof i) {
1499
1498
  case "number": {
1500
1499
  const { group: c } = n(), h = B({ group: c });
1501
- u = I(i / h * 100);
1500
+ u = k(i / h * 100);
1502
1501
  break;
1503
1502
  }
1504
1503
  case "string": {
@@ -1522,7 +1521,7 @@ function Rt(e, t) {
1522
1521
  isCollapsed: () => !1,
1523
1522
  resize: ie
1524
1523
  });
1525
- Me(t, () => o.current, []), N(() => {
1524
+ Ee(t, () => o.current, []), N(() => {
1526
1525
  Object.assign(
1527
1526
  o.current,
1528
1527
  Ct({ groupId: n, panelId: e })
@@ -1544,7 +1543,7 @@ function _t({
1544
1543
  style: h,
1545
1544
  ...m
1546
1545
  }) {
1547
- const p = !!l, f = ue(l), [d, y] = k(null), v = fe(y, a), { id: S, registerPanel: x } = de(), g = u !== null, b = ce((C) => {
1546
+ const p = !!l, f = ue(l), [d, g] = I(null), v = fe(g, a), { id: S, registerPanel: x } = de(), y = u !== null, b = ce((C) => {
1548
1547
  u?.(C, l);
1549
1548
  });
1550
1549
  N(() => {
@@ -1553,7 +1552,7 @@ function _t({
1553
1552
  element: d,
1554
1553
  id: f,
1555
1554
  idIsStable: p,
1556
- onResize: g ? b : void 0,
1555
+ onResize: y ? b : void 0,
1557
1556
  panelConstraints: {
1558
1557
  collapsedSize: n,
1559
1558
  collapsible: o,
@@ -1567,7 +1566,7 @@ function _t({
1567
1566
  o,
1568
1567
  r,
1569
1568
  d,
1570
- g,
1569
+ y,
1571
1570
  f,
1572
1571
  p,
1573
1572
  i,
@@ -1575,7 +1574,7 @@ function _t({
1575
1574
  b,
1576
1575
  x
1577
1576
  ]), Rt(f, c);
1578
- const L = We(S, f);
1577
+ const L = He(S, f);
1579
1578
  return /* @__PURE__ */ K(
1580
1579
  "div",
1581
1580
  {
@@ -1593,7 +1592,7 @@ function _t({
1593
1592
  overflow: "hidden",
1594
1593
  // Disable pointer events inside of a panel during resize
1595
1594
  // This avoid edge cases like nested iframes
1596
- pointerEvents: `var(${je})`
1595
+ pointerEvents: `var(${Fe})`
1597
1596
  },
1598
1597
  children: /* @__PURE__ */ K(
1599
1598
  "div",
@@ -1627,7 +1626,7 @@ const Et = {
1627
1626
  margin: "unset"
1628
1627
  };
1629
1628
  function At() {
1630
- return k(null);
1629
+ return I(null);
1631
1630
  }
1632
1631
  function Nt() {
1633
1632
  return O(null);
@@ -1681,17 +1680,17 @@ function $t({
1681
1680
  style: r,
1682
1681
  ...a
1683
1682
  }) {
1684
- const l = ue(o), [i, s] = k({}), [u, c] = k("inactive"), [h, m] = k(null), p = fe(m, n), {
1683
+ const l = ue(o), [i, s] = I({}), [u, c] = I("inactive"), [h, m] = I(null), p = fe(m, n), {
1685
1684
  id: f,
1686
1685
  orientation: d,
1687
- registerSeparator: y
1686
+ registerSeparator: g
1688
1687
  } = de(), v = d === "horizontal" ? "vertical" : "horizontal";
1689
1688
  return N(() => {
1690
1689
  if (h !== null) {
1691
1690
  const S = {
1692
1691
  element: h,
1693
1692
  id: l
1694
- }, x = y(S), g = _.addListener(
1693
+ }, x = g(S), y = _.addListener(
1695
1694
  "interactionStateChange",
1696
1695
  (L) => {
1697
1696
  c(
@@ -1724,10 +1723,10 @@ function $t({
1724
1723
  }
1725
1724
  );
1726
1725
  return () => {
1727
- g(), b(), x();
1726
+ y(), b(), x();
1728
1727
  };
1729
1728
  }
1730
- }, [h, f, l, y]), /* @__PURE__ */ K(
1729
+ }, [h, f, l, g]), /* @__PURE__ */ K(
1731
1730
  "div",
1732
1731
  {
1733
1732
  ...a,