react-resizable-panels 4.0.0-alpha.5 → 4.0.1

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,25 +1,25 @@
1
1
  "use client";
2
- import { jsx as j } from "react/jsx-runtime";
3
- import { useId as De, useLayoutEffect as Ae, useEffect as $e, useRef as T, useCallback as Se, createContext as Ne, useImperativeHandle as xe, useState as G, useMemo as ze, useSyncExternalStore as _e, useContext as Fe } from "react";
4
- function S(e, t = "Assertion error") {
2
+ import { jsx as W } from "react/jsx-runtime";
3
+ import { useId as $e, useLayoutEffect as Ne, useEffect as _e, useRef as T, useCallback as xe, createContext as He, useImperativeHandle as ze, useState as G, useMemo as be, useSyncExternalStore as Fe, useContext as We } from "react";
4
+ function z(e, t = "Assertion error") {
5
5
  if (!e)
6
6
  throw Error(t);
7
7
  }
8
- function re(e, t) {
8
+ function se(e, t) {
9
9
  return t.sort(
10
- e === "horizontal" ? He : je
10
+ e === "horizontal" ? je : Be
11
11
  );
12
12
  }
13
- function He(e, t) {
13
+ function je(e, t) {
14
14
  const n = e.element.offsetLeft - t.element.offsetLeft;
15
15
  return n !== 0 ? n : e.element.offsetWidth - t.element.offsetWidth;
16
16
  }
17
- function je(e, t) {
17
+ function Be(e, t) {
18
18
  const n = e.element.offsetTop - t.element.offsetTop;
19
19
  return n !== 0 ? n : e.element.offsetHeight - t.element.offsetHeight;
20
20
  }
21
- function be(e) {
22
- const { element: t, orientation: n, panels: o, separators: r } = e, s = re(
21
+ function we(e) {
22
+ const { element: t, orientation: n, panels: o, separators: r } = e, s = se(
23
23
  n,
24
24
  Array.from(t.children).filter((l) => l instanceof HTMLElement).map((l) => ({ element: l }))
25
25
  ).map(({ element: l }) => l), u = [];
@@ -58,21 +58,21 @@ function be(e) {
58
58
  }
59
59
  return u;
60
60
  }
61
- function We(e, t) {
61
+ function Ue(e, t) {
62
62
  const n = getComputedStyle(e), o = parseFloat(n.fontSize);
63
63
  return t * o;
64
64
  }
65
- function Be(e, t) {
65
+ function Ke(e, t) {
66
66
  const n = getComputedStyle(e.ownerDocument.body), o = parseFloat(n.fontSize);
67
67
  return t * o;
68
68
  }
69
- function Ue(e) {
69
+ function Ve(e) {
70
70
  return e / 100 * window.innerHeight;
71
71
  }
72
- function Ke(e) {
72
+ function Xe(e) {
73
73
  return e / 100 * window.innerWidth;
74
74
  }
75
- function Ve(e) {
75
+ function Ye(e) {
76
76
  switch (typeof e) {
77
77
  case "number":
78
78
  return [e, "px"];
@@ -88,7 +88,7 @@ function J({
88
88
  styleProp: n
89
89
  }) {
90
90
  let o;
91
- const [r, s] = Ve(n);
91
+ const [r, s] = Ye(n);
92
92
  switch (s) {
93
93
  case "%": {
94
94
  o = r / 100 * e;
@@ -99,19 +99,19 @@ function J({
99
99
  break;
100
100
  }
101
101
  case "rem": {
102
- o = Be(t, r);
102
+ o = Ke(t, r);
103
103
  break;
104
104
  }
105
105
  case "em": {
106
- o = We(t, r);
106
+ o = Ue(t, r);
107
107
  break;
108
108
  }
109
109
  case "vh": {
110
- o = Ue(r);
110
+ o = Ve(r);
111
111
  break;
112
112
  }
113
113
  case "vw": {
114
- o = Ke(r);
114
+ o = Xe(r);
115
115
  break;
116
116
  }
117
117
  }
@@ -120,14 +120,14 @@ function J({
120
120
  function I(e) {
121
121
  return parseFloat(e.toFixed(3));
122
122
  }
123
- function ue({
123
+ function ae({
124
124
  group: e
125
125
  }) {
126
126
  const { orientation: t, panels: n } = e;
127
127
  return n.reduce((o, r) => (o += t === "horizontal" ? r.element.offsetWidth : r.element.offsetHeight, o), 0);
128
128
  }
129
- function me(e) {
130
- const { panels: t } = e, n = ue({ group: e });
129
+ function pe(e) {
130
+ const { panels: t } = e, n = ae({ group: e });
131
131
  return t.map((o) => {
132
132
  const { element: r, panelConstraints: s } = o;
133
133
  let u = 0;
@@ -218,7 +218,7 @@ class qe {
218
218
  function w(e, t, n = 0) {
219
219
  return Math.abs(I(e) - I(t)) <= n;
220
220
  }
221
- let C = {
221
+ let R = {
222
222
  cursorFlags: 0,
223
223
  interactionState: {
224
224
  state: "inactive"
@@ -227,17 +227,17 @@ let C = {
227
227
  };
228
228
  const A = new qe();
229
229
  function O() {
230
- return C;
230
+ return R;
231
231
  }
232
- function R(e) {
233
- const t = typeof e == "function" ? e(C) : e;
234
- if (C === t)
235
- return C;
236
- const n = C;
237
- return C = {
238
- ...C,
232
+ function C(e) {
233
+ const t = typeof e == "function" ? e(R) : e;
234
+ if (R === t)
235
+ return R;
236
+ const n = R;
237
+ return R = {
238
+ ...R,
239
239
  ...t
240
- }, t.cursorFlags !== void 0 && A.emit("cursorFlagsChange", C.cursorFlags), t.interactionState !== void 0 && A.emit("interactionStateChange", C.interactionState), t.mountedGroups !== void 0 && (C.mountedGroups.forEach((o, r) => {
240
+ }, t.cursorFlags !== void 0 && A.emit("cursorFlagsChange", R.cursorFlags), t.interactionState !== void 0 && A.emit("interactionStateChange", R.interactionState), t.mountedGroups !== void 0 && (R.mountedGroups.forEach((o, r) => {
241
241
  o.derivedPanelConstraints.forEach((s) => {
242
242
  if (s.collapsible) {
243
243
  const { layout: u } = n.mountedGroups.get(r) ?? {};
@@ -253,9 +253,80 @@ function R(e) {
253
253
  }
254
254
  }
255
255
  });
256
- }), A.emit("mountedGroupsChange", C.mountedGroups)), C;
256
+ }), A.emit("mountedGroupsChange", R.mountedGroups)), R;
257
257
  }
258
- function Xe(e, t) {
258
+ const Ze = (e) => e, oe = () => {
259
+ }, Le = 1, Pe = 2, Ee = 4, Re = 8, me = {
260
+ coarse: 10,
261
+ precise: 5
262
+ };
263
+ function Je({
264
+ cursorFlags: e,
265
+ groups: t,
266
+ state: n
267
+ }) {
268
+ let o = 0, r = 0;
269
+ switch (n) {
270
+ case "active":
271
+ case "hover":
272
+ t.forEach((s) => {
273
+ if (!s.disableCursor)
274
+ switch (s.orientation) {
275
+ case "horizontal": {
276
+ o++;
277
+ break;
278
+ }
279
+ case "vertical": {
280
+ r++;
281
+ break;
282
+ }
283
+ }
284
+ });
285
+ }
286
+ if (o === 0 && r === 0)
287
+ return null;
288
+ switch (n) {
289
+ case "active": {
290
+ const s = (e & Le) !== 0, u = (e & Pe) !== 0, i = (e & Ee) !== 0, a = (e & Re) !== 0;
291
+ if (e) {
292
+ if (s)
293
+ return i ? "se-resize" : a ? "ne-resize" : "e-resize";
294
+ if (u)
295
+ return i ? "sw-resize" : a ? "nw-resize" : "w-resize";
296
+ if (i)
297
+ return "s-resize";
298
+ if (a)
299
+ return "n-resize";
300
+ }
301
+ break;
302
+ }
303
+ }
304
+ return o > 0 && r > 0 ? "move" : o > 0 ? "ew-resize" : "ns-resize";
305
+ }
306
+ let ie = null, k;
307
+ function le() {
308
+ k === void 0 && (k = new CSSStyleSheet(), document.adoptedStyleSheets = [k]);
309
+ const { cursorFlags: e, interactionState: t } = O();
310
+ switch (t.state) {
311
+ case "active":
312
+ case "hover": {
313
+ const n = Je({
314
+ cursorFlags: e,
315
+ groups: t.hitRegions.map((o) => o.group),
316
+ state: t.state
317
+ });
318
+ if (ie === n)
319
+ return;
320
+ ie = n, n ? k.cssRules.length === 0 ? k.insertRule(`*{cursor: ${n} !important;}`) : k.replaceSync(`*{cursor: ${n} !important;}`) : k.cssRules.length === 1 && k.deleteRule(0);
321
+ break;
322
+ }
323
+ case "inactive": {
324
+ ie = null, k.cssRules.length === 1 && k.deleteRule(0);
325
+ break;
326
+ }
327
+ }
328
+ }
329
+ function Qe(e, t) {
259
330
  if (e.length !== t.length)
260
331
  return !1;
261
332
  for (let n = 0; n < e.length; n++)
@@ -263,10 +334,10 @@ function Xe(e, t) {
263
334
  return !1;
264
335
  return !0;
265
336
  }
266
- function W(e, t) {
337
+ function j(e, t) {
267
338
  return w(e, t) ? 0 : e > t ? 1 : -1;
268
339
  }
269
- function F({
340
+ function H({
270
341
  panelConstraints: e,
271
342
  size: t
272
343
  }) {
@@ -276,10 +347,10 @@ function F({
276
347
  maxSize: r = 100,
277
348
  minSize: s = 0
278
349
  } = e;
279
- if (W(t, s) < 0)
350
+ if (j(t, s) < 0)
280
351
  if (o) {
281
352
  const u = (n + s) / 2;
282
- W(t, u) < 0 ? t = n : t = s;
353
+ j(t, u) < 0 ? t = n : t = s;
283
354
  } else
284
355
  t = s;
285
356
  return t = Math.min(r, t), t = I(t), t;
@@ -295,117 +366,117 @@ function B({
295
366
  if (w(e, 0))
296
367
  return t;
297
368
  const u = Object.values(t), i = Object.values(r), a = [...u], [l, f] = o;
298
- S(l != null, "Invalid first pivot index"), S(f != null, "Invalid second pivot index");
369
+ z(l != null, "Invalid first pivot index"), z(f != null, "Invalid second pivot index");
299
370
  let c = 0;
300
371
  if (s === "keyboard") {
301
372
  {
302
373
  const d = e < 0 ? f : l, p = n[d];
303
- S(
374
+ z(
304
375
  p,
305
376
  `Panel constraints not found for index ${d}`
306
377
  );
307
378
  const {
308
- collapsedSize: h = 0,
309
- collapsible: v,
310
- minSize: z = 0
379
+ collapsedSize: v = 0,
380
+ collapsible: h,
381
+ minSize: g = 0
311
382
  } = p;
312
- if (v) {
383
+ if (h) {
313
384
  const x = u[d];
314
- if (S(
385
+ if (z(
315
386
  x != null,
316
387
  `Previous layout not found for panel index ${d}`
317
- ), w(x, h)) {
318
- const y = z - x;
319
- W(y, Math.abs(e)) > 0 && (e = e < 0 ? 0 - y : y);
388
+ ), w(x, v)) {
389
+ const y = g - x;
390
+ j(y, Math.abs(e)) > 0 && (e = e < 0 ? 0 - y : y);
320
391
  }
321
392
  }
322
393
  }
323
394
  {
324
395
  const d = e < 0 ? l : f, p = n[d];
325
- S(
396
+ z(
326
397
  p,
327
398
  `No panel constraints found for index ${d}`
328
399
  );
329
400
  const {
330
- collapsedSize: h = 0,
331
- collapsible: v,
332
- minSize: z = 0
401
+ collapsedSize: v = 0,
402
+ collapsible: h,
403
+ minSize: g = 0
333
404
  } = p;
334
- if (v) {
405
+ if (h) {
335
406
  const x = u[d];
336
- if (S(
407
+ if (z(
337
408
  x != null,
338
409
  `Previous layout not found for panel index ${d}`
339
- ), w(x, z)) {
340
- const y = x - h;
341
- W(y, Math.abs(e)) > 0 && (e = e < 0 ? 0 - y : y);
410
+ ), w(x, g)) {
411
+ const y = x - v;
412
+ j(y, Math.abs(e)) > 0 && (e = e < 0 ? 0 - y : y);
342
413
  }
343
414
  }
344
415
  }
345
416
  }
346
417
  {
347
418
  const d = e < 0 ? 1 : -1;
348
- let p = e < 0 ? f : l, h = 0;
419
+ let p = e < 0 ? f : l, v = 0;
349
420
  for (; ; ) {
350
- const z = u[p];
351
- S(
352
- z != null,
421
+ const g = u[p];
422
+ z(
423
+ g != null,
353
424
  `Previous layout not found for panel index ${p}`
354
425
  );
355
- const y = F({
426
+ const y = H({
356
427
  panelConstraints: n[p],
357
428
  size: 100
358
- }) - z;
359
- if (h += y, p += d, p < 0 || p >= n.length)
429
+ }) - g;
430
+ if (v += y, p += d, p < 0 || p >= n.length)
360
431
  break;
361
432
  }
362
- const v = Math.min(Math.abs(e), Math.abs(h));
363
- e = e < 0 ? 0 - v : v;
433
+ const h = Math.min(Math.abs(e), Math.abs(v));
434
+ e = e < 0 ? 0 - h : h;
364
435
  }
365
436
  {
366
437
  let p = e < 0 ? l : f;
367
438
  for (; p >= 0 && p < n.length; ) {
368
- const h = Math.abs(e) - Math.abs(c), v = u[p];
369
- S(
370
- v != null,
439
+ const v = Math.abs(e) - Math.abs(c), h = u[p];
440
+ z(
441
+ h != null,
371
442
  `Previous layout not found for panel index ${p}`
372
443
  );
373
- const z = v - h, x = F({
444
+ const g = h - v, x = H({
374
445
  panelConstraints: n[p],
375
- size: z
446
+ size: g
376
447
  });
377
- if (!w(v, x) && (c += v - x, a[p] = x, c.toFixed(3).localeCompare(Math.abs(e).toFixed(3), void 0, {
448
+ if (!w(h, x) && (c += h - x, a[p] = x, c.toFixed(3).localeCompare(Math.abs(e).toFixed(3), void 0, {
378
449
  numeric: !0
379
450
  }) >= 0))
380
451
  break;
381
452
  e < 0 ? p-- : p++;
382
453
  }
383
454
  }
384
- if (Xe(i, a))
455
+ if (Qe(i, a))
385
456
  return r;
386
457
  {
387
458
  const d = e < 0 ? f : l, p = u[d];
388
- S(
459
+ z(
389
460
  p != null,
390
461
  `Previous layout not found for panel index ${d}`
391
462
  );
392
- const h = p + c, v = F({
463
+ const v = p + c, h = H({
393
464
  panelConstraints: n[d],
394
- size: h
465
+ size: v
395
466
  });
396
- if (a[d] = v, !w(v, h)) {
397
- let z = h - v, y = e < 0 ? f : l;
467
+ if (a[d] = h, !w(h, v)) {
468
+ let g = v - h, y = e < 0 ? f : l;
398
469
  for (; y >= 0 && y < n.length; ) {
399
- const P = a[y];
400
- S(
401
- P != null,
470
+ const L = a[y];
471
+ z(
472
+ L != null,
402
473
  `Previous layout not found for panel index ${y}`
403
474
  );
404
- const L = P + z, E = F({
475
+ const P = L + g, E = H({
405
476
  panelConstraints: n[y],
406
- size: L
477
+ size: P
407
478
  });
408
- if (w(P, E) || (z -= E - P, a[y] = E), w(z, 0))
479
+ if (w(L, E) || (g -= E - L, a[y] = E), w(g, 0))
409
480
  break;
410
481
  e > 0 ? y-- : y++;
411
482
  }
@@ -417,26 +488,98 @@ function B({
417
488
  );
418
489
  if (!w(m, 100, 0.1))
419
490
  return r;
420
- const g = Object.keys(r);
421
- return a.reduce((d, p, h) => (d[g[h]] = p, d), {});
422
- }
423
- function te(e) {
424
- const t = e.parentElement;
425
- S(t, "Parent group element not found");
426
- const { mountedGroups: n } = O();
427
- for (const [o] of n)
428
- if (o.element === t)
429
- return o;
430
- throw Error("Could not find parent Group for separator element");
491
+ const S = Object.keys(r);
492
+ return a.reduce((d, p, v) => (d[S[v]] = p, d), {});
431
493
  }
432
494
  function U(e, t) {
433
495
  if (Object.keys(e).length !== Object.keys(t).length)
434
496
  return !1;
435
497
  for (const n in e)
436
- if (W(e[n], t[n]) !== 0)
498
+ if (j(e[n], t[n]) !== 0)
437
499
  return !1;
438
500
  return !0;
439
501
  }
502
+ function Ce({
503
+ event: e,
504
+ hitRegions: t,
505
+ initialLayoutMap: n,
506
+ mountedGroups: o,
507
+ pointerDownAtPoint: r
508
+ }) {
509
+ let s = 0;
510
+ const u = new Map(o);
511
+ t.forEach((i) => {
512
+ const { disableCursor: a, element: l, orientation: f, panels: c } = i.group;
513
+ let m = 0;
514
+ r ? f === "horizontal" ? m = (e.clientX - r.x) / l.offsetWidth * 100 : m = (e.clientY - r.y) / l.offsetHeight * 100 : f === "horizontal" ? m = e.clientX < 0 ? -100 : 100 : m = e.clientY < 0 ? -100 : 100;
515
+ const S = n.get(i.group), {
516
+ derivedPanelConstraints: d,
517
+ layout: p,
518
+ separatorToPanels: v
519
+ } = o.get(i.group) ?? {};
520
+ if (d && S && p && v) {
521
+ const h = B({
522
+ delta: m,
523
+ initialLayout: S,
524
+ panelConstraints: d,
525
+ pivotIndices: i.panels.map((g) => c.indexOf(g)),
526
+ prevLayout: p,
527
+ trigger: "mouse-or-touch"
528
+ });
529
+ if (U(h, p)) {
530
+ if (m !== 0 && !a)
531
+ switch (f) {
532
+ case "horizontal": {
533
+ s |= m < 0 ? Le : Pe;
534
+ break;
535
+ }
536
+ case "vertical": {
537
+ s |= m < 0 ? Ee : Re;
538
+ break;
539
+ }
540
+ }
541
+ } else {
542
+ u.set(i.group, {
543
+ derivedPanelConstraints: d,
544
+ layout: h,
545
+ separatorToPanels: v
546
+ });
547
+ const g = i.group.panels.map(({ id: x }) => x).join(",");
548
+ i.group.inMemoryLayouts[g] = h;
549
+ }
550
+ }
551
+ }), C({
552
+ cursorFlags: s,
553
+ mountedGroups: u
554
+ }), le();
555
+ }
556
+ function he(e) {
557
+ if (e.defaultPrevented)
558
+ return;
559
+ if (e.relatedTarget !== null)
560
+ return;
561
+ const { interactionState: t, mountedGroups: n } = O();
562
+ switch (t.state) {
563
+ case "active":
564
+ t.hitRegions.forEach((o) => {
565
+ e.currentTarget === o.group.element && Ce({
566
+ event: e,
567
+ hitRegions: t.hitRegions,
568
+ initialLayoutMap: t.initialLayoutMap,
569
+ mountedGroups: n
570
+ });
571
+ });
572
+ }
573
+ }
574
+ function ee(e) {
575
+ const t = e.parentElement;
576
+ z(t, "Parent group element not found");
577
+ const { mountedGroups: n } = O();
578
+ for (const [o] of n)
579
+ if (o.element === t)
580
+ return o;
581
+ throw Error("Could not find parent Group for separator element");
582
+ }
440
583
  function $({
441
584
  layout: e,
442
585
  panelConstraints: t
@@ -452,15 +595,15 @@ function $({
452
595
  if (!w(r, 100) && o.length > 0)
453
596
  for (let i = 0; i < t.length; i++) {
454
597
  const a = o[i];
455
- S(a != null, `No layout data found for index ${i}`);
598
+ z(a != null, `No layout data found for index ${i}`);
456
599
  const l = 100 / r * a;
457
600
  o[i] = l;
458
601
  }
459
602
  let s = 0;
460
603
  for (let i = 0; i < t.length; i++) {
461
604
  const a = o[i];
462
- S(a != null, `No layout data found for index ${i}`);
463
- const l = F({
605
+ z(a != null, `No layout data found for index ${i}`);
606
+ const l = H({
464
607
  panelConstraints: t[i],
465
608
  size: a
466
609
  });
@@ -469,8 +612,8 @@ function $({
469
612
  if (!w(s, 0))
470
613
  for (let i = 0; i < t.length; i++) {
471
614
  const a = o[i];
472
- S(a != null, `No layout data found for index ${i}`);
473
- const l = a + s, f = F({
615
+ z(a != null, `No layout data found for index ${i}`);
616
+ const l = a + s, f = H({
474
617
  panelConstraints: t[i],
475
618
  size: l
476
619
  });
@@ -480,7 +623,7 @@ function $({
480
623
  const u = Object.keys(e);
481
624
  return o.reduce((i, a, l) => (i[u[l]] = a, i), {});
482
625
  }
483
- function we({
626
+ function Me({
484
627
  groupId: e
485
628
  }) {
486
629
  const t = () => {
@@ -505,7 +648,7 @@ function we({
505
648
  layout: n,
506
649
  panelConstraints: o
507
650
  });
508
- return U(s, i) || R((a) => ({
651
+ return U(s, i) || C((a) => ({
509
652
  mountedGroups: new Map(a.mountedGroups).set(r, {
510
653
  derivedPanelConstraints: o,
511
654
  layout: i,
@@ -515,18 +658,18 @@ function we({
515
658
  }
516
659
  };
517
660
  }
518
- function Pe(e) {
661
+ function Ge(e) {
519
662
  const { mountedGroups: t } = O(), n = t.get(e);
520
- return S(n, `Mounted Group ${e.id} not found`), n;
663
+ return z(n, `Mounted Group ${e.id} not found`), n;
521
664
  }
522
665
  function D(e, t) {
523
- const n = te(e), o = Pe(n), r = n.separators.find(
666
+ const n = ee(e), o = Ge(n), r = n.separators.find(
524
667
  (c) => c.element === e
525
668
  );
526
- S(r, "Matching separator not found");
669
+ z(r, "Matching separator not found");
527
670
  const s = o.separatorToPanels.get(r);
528
- S(s, "Matching panels not found");
529
- const u = s.map((c) => n.panels.indexOf(c)), a = we({ groupId: n.id }).getLayout(), l = B({
671
+ z(s, "Matching panels not found");
672
+ const u = s.map((c) => n.panels.indexOf(c)), a = Me({ groupId: n.id }).getLayout(), l = B({
530
673
  delta: t,
531
674
  initialLayout: a,
532
675
  panelConstraints: o.derivedPanelConstraints,
@@ -537,7 +680,7 @@ function D(e, t) {
537
680
  layout: l,
538
681
  panelConstraints: o.derivedPanelConstraints
539
682
  });
540
- U(a, f) || R((c) => ({
683
+ U(a, f) || C((c) => ({
541
684
  mountedGroups: new Map(c.mountedGroups).set(n, {
542
685
  derivedPanelConstraints: o.derivedPanelConstraints,
543
686
  layout: f,
@@ -545,10 +688,10 @@ function D(e, t) {
545
688
  })
546
689
  }));
547
690
  }
548
- function he(e) {
691
+ function ve(e) {
549
692
  if (e.defaultPrevented)
550
693
  return;
551
- const t = e.currentTarget, n = te(t);
694
+ const t = e.currentTarget, n = ee(t);
552
695
  if (!n.disabled)
553
696
  switch (e.key) {
554
697
  case "ArrowDown": {
@@ -573,16 +716,16 @@ function he(e) {
573
716
  }
574
717
  case "Enter": {
575
718
  e.preventDefault();
576
- const o = te(t), { derivedPanelConstraints: r, layout: s, separatorToPanels: u } = Pe(o), i = o.separators.find(
719
+ const o = ee(t), { derivedPanelConstraints: r, layout: s, separatorToPanels: u } = Ge(o), i = o.separators.find(
577
720
  (c) => c.element === t
578
721
  );
579
- S(i, "Matching separator not found");
722
+ z(i, "Matching separator not found");
580
723
  const a = u.get(i);
581
- S(a, "Matching panels not found");
724
+ z(a, "Matching panels not found");
582
725
  const l = a[0], f = r.find(
583
726
  (c) => c.panelId === l.id
584
727
  );
585
- if (S(f, "Panel metadata not found"), f.collapsible) {
728
+ if (z(f, "Panel metadata not found"), f.collapsible) {
586
729
  const c = s[l.id], m = f.collapsedSize === c ? o.inMemoryLastExpandedPanelSizes[l.id] ?? f.minSize : f.collapsedSize;
587
730
  D(t, m - c);
588
731
  }
@@ -590,12 +733,12 @@ function he(e) {
590
733
  }
591
734
  case "F6": {
592
735
  e.preventDefault();
593
- const r = te(t).separators.map(
736
+ const r = ee(t).separators.map(
594
737
  (a) => a.element
595
738
  ), s = Array.from(r).findIndex(
596
739
  (a) => a === e.currentTarget
597
740
  );
598
- S(s !== null, "Index not found");
741
+ z(s !== null, "Index not found");
599
742
  const u = e.shiftKey ? s > 0 ? s - 1 : r.length - 1 : s + 1 < r.length ? s + 1 : 0;
600
743
  r[u].focus();
601
744
  break;
@@ -606,12 +749,7 @@ function he(e) {
606
749
  }
607
750
  }
608
751
  }
609
- const Ye = (e) => e, ie = () => {
610
- }, Le = 1, Ee = 2, Ce = 4, Re = 8, ve = {
611
- coarse: 10,
612
- precise: 5
613
- };
614
- function Ze(e, t) {
752
+ function et(e, t) {
615
753
  return {
616
754
  x: e.x >= t.left && e.x <= t.right ? 0 : Math.min(
617
755
  Math.abs(e.x - t.left),
@@ -623,13 +761,13 @@ function Ze(e, t) {
623
761
  )
624
762
  };
625
763
  }
626
- function Je(e, t, n) {
764
+ function tt(e, t, n) {
627
765
  let o, r = {
628
766
  x: 1 / 0,
629
767
  y: 1 / 0
630
768
  };
631
769
  for (const s of t) {
632
- const u = Ze(n, s.rect);
770
+ const u = et(n, s.rect);
633
771
  switch (e) {
634
772
  case "horizontal": {
635
773
  u.x <= r.x && (o = s, r = u);
@@ -647,15 +785,15 @@ function Je(e, t, n) {
647
785
  } : void 0;
648
786
  }
649
787
  let Q;
650
- function Qe() {
788
+ function nt() {
651
789
  return Q === void 0 && (typeof matchMedia == "function" ? Q = !!matchMedia("(pointer:coarse)").matches : Q = !1), Q;
652
790
  }
653
- function Me(e, t) {
791
+ function Ie(e, t) {
654
792
  const n = [];
655
793
  return t.forEach((o, r) => {
656
794
  if (r.disabled)
657
795
  return;
658
- const s = Qe() ? ve.coarse : ve.precise, u = be(r), i = Je(r.orientation, u, {
796
+ const s = nt() ? me.coarse : me.precise, u = we(r), i = tt(r.orientation, u, {
659
797
  x: e.clientX,
660
798
  y: e.clientY
661
799
  });
@@ -665,14 +803,14 @@ function Me(e, t) {
665
803
  function ge(e) {
666
804
  if (e.defaultPrevented)
667
805
  return;
668
- const { mountedGroups: t } = O(), n = Me(e, t), o = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Map();
806
+ const { mountedGroups: t } = O(), n = Ie(e, t), o = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Map();
669
807
  n.forEach((i) => {
670
808
  o.add(i.group), i.panels.forEach((l) => {
671
809
  r.add(l);
672
810
  }), i.separator && s.add(i.separator);
673
811
  const a = t.get(i.group);
674
812
  a && u.set(i.group, a.layout);
675
- }), R({
813
+ }), C({
676
814
  interactionState: {
677
815
  hitRegions: n,
678
816
  initialLayoutMap: u,
@@ -681,73 +819,7 @@ function ge(e) {
681
819
  }
682
820
  }), n.length && e.preventDefault();
683
821
  }
684
- function et({
685
- cursorFlags: e,
686
- groups: t,
687
- state: n
688
- }) {
689
- let o = 0, r = 0;
690
- switch (n) {
691
- case "active":
692
- case "hover":
693
- t.forEach((s) => {
694
- if (!s.disableCursor)
695
- switch (s.orientation) {
696
- case "horizontal": {
697
- o++;
698
- break;
699
- }
700
- case "vertical": {
701
- r++;
702
- break;
703
- }
704
- }
705
- });
706
- }
707
- if (o === 0 && r === 0)
708
- return null;
709
- switch (n) {
710
- case "active": {
711
- const s = (e & Le) !== 0, u = (e & Ee) !== 0, i = (e & Ce) !== 0, a = (e & Re) !== 0;
712
- if (e) {
713
- if (s)
714
- return i ? "se-resize" : a ? "ne-resize" : "e-resize";
715
- if (u)
716
- return i ? "sw-resize" : a ? "nw-resize" : "w-resize";
717
- if (i)
718
- return "s-resize";
719
- if (a)
720
- return "n-resize";
721
- }
722
- break;
723
- }
724
- }
725
- return o > 0 && r > 0 ? "move" : o > 0 ? "ew-resize" : "ns-resize";
726
- }
727
- let se = null, k;
728
- function ae() {
729
- k === void 0 && (k = new CSSStyleSheet(), document.adoptedStyleSheets = [k]);
730
- const { cursorFlags: e, interactionState: t } = O();
731
- switch (t.state) {
732
- case "active":
733
- case "hover": {
734
- const n = et({
735
- cursorFlags: e,
736
- groups: t.hitRegions.map((o) => o.group),
737
- state: t.state
738
- });
739
- if (se === n)
740
- return;
741
- se = n, n ? k.cssRules.length === 0 ? k.insertRule(`*{cursor: ${n} !important;}`) : k.replaceSync(`*{cursor: ${n} !important;}`) : k.cssRules.length === 1 && k.deleteRule(0);
742
- break;
743
- }
744
- case "inactive": {
745
- se = null, k.cssRules.length === 1 && k.deleteRule(0);
746
- break;
747
- }
748
- }
749
- }
750
- function ee(e) {
822
+ function ye(e) {
751
823
  if (e.defaultPrevented)
752
824
  return;
753
825
  const { interactionState: t, mountedGroups: n } = O();
@@ -757,8 +829,8 @@ function ee(e) {
757
829
  // Skip this check for "pointerleave" events, else Firefox triggers a false positive (see #514)
758
830
  e.type !== "pointerleave" && e.buttons === 0
759
831
  ) {
760
- R(
761
- (s) => s.interactionState.state === "inactive" ? s : {
832
+ C(
833
+ (o) => o.interactionState.state === "inactive" ? o : {
762
834
  cursorFlags: 0,
763
835
  interactionState: {
764
836
  state: "inactive"
@@ -767,86 +839,45 @@ function ee(e) {
767
839
  );
768
840
  return;
769
841
  }
770
- let o = 0;
771
- const r = new Map(n);
772
- t.hitRegions.forEach((s) => {
773
- const { disableCursor: u, element: i, orientation: a, panels: l } = s.group;
774
- let f = 0;
775
- t.state === "active" && (a === "horizontal" ? f = (e.clientX - t.pointerDownAtPoint.x) / i.offsetWidth * 100 : f = (e.clientY - t.pointerDownAtPoint.y) / i.offsetHeight * 100);
776
- const c = t.initialLayoutMap.get(
777
- s.group
778
- ), {
779
- derivedPanelConstraints: m,
780
- layout: g,
781
- separatorToPanels: d
782
- } = n.get(s.group) ?? {};
783
- if (m && c && g && d) {
784
- const p = B({
785
- delta: f,
786
- initialLayout: c,
787
- panelConstraints: m,
788
- pivotIndices: s.panels.map((h) => l.indexOf(h)),
789
- prevLayout: g,
790
- trigger: "mouse-or-touch"
791
- });
792
- if (U(p, g)) {
793
- if (f !== 0 && !u)
794
- switch (a) {
795
- case "horizontal": {
796
- o |= f < 0 ? Le : Ee;
797
- break;
798
- }
799
- case "vertical": {
800
- o |= f < 0 ? Ce : Re;
801
- break;
802
- }
803
- }
804
- } else {
805
- r.set(s.group, {
806
- derivedPanelConstraints: m,
807
- layout: p,
808
- separatorToPanels: d
809
- });
810
- const h = s.group.panels.map(({ id: v }) => v).join(",");
811
- s.group.inMemoryLayouts[h] = p;
812
- }
813
- }
814
- }), R({
815
- cursorFlags: o,
816
- mountedGroups: r
817
- }), ae();
842
+ Ce({
843
+ event: e,
844
+ hitRegions: t.hitRegions,
845
+ initialLayoutMap: t.initialLayoutMap,
846
+ mountedGroups: n,
847
+ pointerDownAtPoint: t.pointerDownAtPoint
848
+ });
818
849
  break;
819
850
  }
820
851
  default: {
821
- const o = Me(e, n);
822
- o.length === 0 ? t.state !== "inactive" && R({
852
+ const o = Ie(e, n);
853
+ o.length === 0 ? t.state !== "inactive" && C({
823
854
  interactionState: { state: "inactive" }
824
- }) : R({
855
+ }) : C({
825
856
  interactionState: {
826
857
  hitRegions: o,
827
858
  state: "hover"
828
859
  }
829
- }), ae();
860
+ }), le();
830
861
  break;
831
862
  }
832
863
  }
833
864
  }
834
- function ye(e) {
865
+ function Se(e) {
835
866
  if (e.defaultPrevented)
836
867
  return;
837
868
  e.preventDefault();
838
869
  const { interactionState: t } = O();
839
870
  switch (t.state) {
840
871
  case "active":
841
- R({
872
+ C({
842
873
  cursorFlags: 0,
843
874
  interactionState: {
844
875
  state: "inactive"
845
876
  }
846
- }), ae();
877
+ }), le();
847
878
  }
848
879
  }
849
- function tt(e) {
880
+ function ot(e) {
850
881
  let t = 0, n = 0;
851
882
  const o = {};
852
883
  for (const s of e)
@@ -864,14 +895,14 @@ function tt(e) {
864
895
  }
865
896
  return o;
866
897
  }
867
- function nt(e, t, n) {
898
+ function it(e, t, n) {
868
899
  const o = n[0];
869
900
  if (!o)
870
901
  return;
871
902
  const r = e.panels.find((u) => u.element === t);
872
903
  if (!r || !r.onResize)
873
904
  return;
874
- const s = ue({ group: e });
905
+ const s = ae({ group: e });
875
906
  r.onResize(
876
907
  {
877
908
  asPercentage: I(
@@ -882,44 +913,44 @@ function nt(e, t, n) {
882
913
  r.id
883
914
  );
884
915
  }
885
- function ot(e) {
916
+ function st(e) {
886
917
  let t = !0;
887
- S(
918
+ z(
888
919
  e.separators.length === 0 || e.separators.length < e.panels.length,
889
920
  "Invalid Group configuration; too many Separator components"
890
921
  );
891
922
  const n = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), r = new ResizeObserver((c) => {
892
923
  for (const m of c) {
893
- const { borderBoxSize: g, target: d } = m;
894
- d === e.element ? t && R((p) => {
895
- const h = p.mountedGroups.get(e);
896
- if (h) {
897
- const v = me(e), z = h.layout, x = $({
898
- layout: z,
899
- panelConstraints: v
924
+ const { borderBoxSize: S, target: d } = m;
925
+ d === e.element ? t && C((p) => {
926
+ const v = p.mountedGroups.get(e);
927
+ if (v) {
928
+ const h = pe(e), g = v.layout, x = $({
929
+ layout: g,
930
+ panelConstraints: h
900
931
  });
901
932
  return {
902
933
  mountedGroups: new Map(p.mountedGroups).set(e, {
903
- derivedPanelConstraints: v,
934
+ derivedPanelConstraints: h,
904
935
  layout: x,
905
- separatorToPanels: h.separatorToPanels
936
+ separatorToPanels: v.separatorToPanels
906
937
  })
907
938
  };
908
939
  }
909
940
  return p;
910
- }) : nt(e, d, g);
941
+ }) : it(e, d, S);
911
942
  }
912
943
  });
913
944
  r.observe(e.element), e.panels.forEach((c) => {
914
- S(
945
+ z(
915
946
  !n.has(c.id),
916
947
  `Panel ids must be unique; id "${c.id}" was used more than once`
917
948
  ), n.add(c.id), c.onResize && r.observe(c.element);
918
949
  });
919
- const s = me(e), u = e.panels.map(({ id: c }) => c).join(","), i = e.inMemoryLayouts[u] ?? e.defaultLayout ?? tt(s), a = $({
950
+ const s = pe(e), u = e.panels.map(({ id: c }) => c).join(","), i = e.inMemoryLayouts[u] ?? e.defaultLayout ?? ot(s), a = $({
920
951
  layout: i,
921
952
  panelConstraints: s
922
- }), l = be(e), f = R((c) => ({
953
+ }), l = we(e), f = C((c) => ({
923
954
  mountedGroups: new Map(c.mountedGroups).set(e, {
924
955
  derivedPanelConstraints: s,
925
956
  layout: a,
@@ -928,35 +959,35 @@ function ot(e) {
928
959
  )
929
960
  })
930
961
  }));
931
- return e.separators.forEach((c) => {
932
- S(
962
+ return e.element.addEventListener("pointerleave", he), e.separators.forEach((c) => {
963
+ z(
933
964
  !o.has(c.id),
934
965
  `Separator ids must be unique; id "${c.id}" was used more than once`
935
- ), o.add(c.id), c.element.addEventListener("keydown", he);
936
- }), f.mountedGroups.size === 1 && (window.addEventListener("pointerdown", ge), window.addEventListener("pointerleave", ee), window.addEventListener("pointermove", ee), window.addEventListener("pointerup", ye)), function() {
966
+ ), o.add(c.id), c.element.addEventListener("keydown", ve);
967
+ }), f.mountedGroups.size === 1 && (window.addEventListener("pointerdown", ge), window.addEventListener("pointermove", ye), window.addEventListener("pointerup", Se)), function() {
937
968
  t = !1;
938
- const m = R((g) => {
939
- const d = new Map(g.mountedGroups);
969
+ const m = C((S) => {
970
+ const d = new Map(S.mountedGroups);
940
971
  return d.delete(e), { mountedGroups: d };
941
972
  });
942
- e.separators.forEach((g) => {
943
- g.element.removeEventListener("keydown", he);
944
- }), m.mountedGroups.size === 0 && (window.removeEventListener("pointerdown", ge), window.removeEventListener("pointerleave", ee), window.removeEventListener("pointermove", ee), window.removeEventListener("pointerup", ye)), r.disconnect();
973
+ e.element.removeEventListener("pointerleave", he), e.separators.forEach((S) => {
974
+ S.element.removeEventListener("keydown", ve);
975
+ }), m.mountedGroups.size === 0 && (window.removeEventListener("pointerdown", ge), window.removeEventListener("pointermove", ye), window.removeEventListener("pointerup", Se)), r.disconnect();
945
976
  };
946
977
  }
947
- function ce(e) {
948
- const t = De();
978
+ function ue(e) {
979
+ const t = $e();
949
980
  return `${e ?? t}`;
950
981
  }
951
- const H = typeof window < "u" ? Ae : $e;
952
- function fe(e) {
982
+ const F = typeof window < "u" ? Ne : _e;
983
+ function ce(e) {
953
984
  const t = T(e);
954
- return H(() => {
985
+ return F(() => {
955
986
  t.current = e;
956
- }, [e]), Se((n) => t.current?.(n), [t]);
987
+ }, [e]), xe((n) => t.current?.(n), [t]);
957
988
  }
958
- function de(...e) {
959
- return fe((t) => {
989
+ function fe(...e) {
990
+ return ce((t) => {
960
991
  e.forEach((n) => {
961
992
  if (n)
962
993
  switch (typeof n) {
@@ -972,25 +1003,25 @@ function de(...e) {
972
1003
  });
973
1004
  });
974
1005
  }
975
- const Ge = "--react-resizable-panels--panel--pointer-events";
976
- function Ie(e, t) {
1006
+ const ke = "--react-resizable-panels--panel--pointer-events";
1007
+ function Oe(e, t) {
977
1008
  const n = e.replace(/[^a-zA-Z0-9\-_]/g, ""), o = t.replace(/[^a-zA-Z0-9\-_]/g, "");
978
1009
  return `--react-resizable-panels--${n}--${o}`;
979
1010
  }
980
- const ke = Ne(null);
981
- function it(e, t) {
1011
+ const Te = He(null);
1012
+ function rt(e, t) {
982
1013
  const n = T({
983
1014
  getLayout: () => ({}),
984
- setLayout: Ye
1015
+ setLayout: Ze
985
1016
  });
986
- xe(t, () => n.current, []), H(() => {
1017
+ ze(t, () => n.current, []), F(() => {
987
1018
  Object.assign(
988
1019
  n.current,
989
- we({ groupId: e })
1020
+ Me({ groupId: e })
990
1021
  );
991
1022
  });
992
1023
  }
993
- function pt({
1024
+ function ht({
994
1025
  children: e,
995
1026
  className: t,
996
1027
  defaultLayout: n,
@@ -1004,19 +1035,19 @@ function pt({
1004
1035
  style: f,
1005
1036
  ...c
1006
1037
  }) {
1007
- const m = T({}), g = fe((b) => {
1038
+ const m = T({}), S = ce((b) => {
1008
1039
  U(m.current, b) || (m.current = b, a?.(b));
1009
- }), d = ce(i), [p, h] = G(!1), [v, z] = G(null), [x, y] = G(n ?? {}), [P, L] = G([]), [E, K] = G([]), ne = T({}), V = T({}), q = de(z, s);
1010
- it(d, u);
1011
- const X = ze(
1040
+ }), d = ue(i), [p, v] = G(!1), [h, g] = G(null), [x, y] = G(n ?? {}), [L, P] = G([]), [E, K] = G([]), te = T({}), V = T({}), X = fe(g, s);
1041
+ rt(d, u);
1042
+ const Y = be(
1012
1043
  () => ({
1013
1044
  id: d,
1014
1045
  orientation: l,
1015
- registerPanel: (b) => (L((M) => re(l, [...M, b])), () => {
1016
- L((M) => M.filter((N) => N !== b));
1046
+ registerPanel: (b) => (P((M) => se(l, [...M, b])), () => {
1047
+ P((M) => M.filter((N) => N !== b));
1017
1048
  }),
1018
1049
  registerSeparator: (b) => (K(
1019
- (M) => re(l, [...M, b])
1050
+ (M) => se(l, [...M, b])
1020
1051
  ), () => {
1021
1052
  K(
1022
1053
  (M) => M.filter((N) => N !== b)
@@ -1025,28 +1056,28 @@ function pt({
1025
1056
  }),
1026
1057
  [d, l]
1027
1058
  );
1028
- H(() => {
1029
- if (v !== null && P.length > 0) {
1059
+ F(() => {
1060
+ if (h !== null && L.length > 0) {
1030
1061
  const b = {
1031
1062
  defaultLayout: n,
1032
1063
  disableCursor: !!o,
1033
1064
  disabled: !!r,
1034
- element: v,
1065
+ element: h,
1035
1066
  id: d,
1036
- inMemoryLastExpandedPanelSizes: ne.current,
1067
+ inMemoryLastExpandedPanelSizes: te.current,
1037
1068
  inMemoryLayouts: V.current,
1038
1069
  orientation: l,
1039
- panels: P,
1070
+ panels: L,
1040
1071
  separators: E
1041
- }, M = ot(b), oe = O().mountedGroups.get(b);
1042
- oe && (y(oe.layout), g?.(oe.layout));
1043
- const Oe = A.addListener(
1072
+ }, M = st(b), ne = O().mountedGroups.get(b);
1073
+ ne && (y(ne.layout), S?.(ne.layout));
1074
+ const De = A.addListener(
1044
1075
  "interactionStateChange",
1045
1076
  (Z) => {
1046
1077
  switch (Z.state) {
1047
1078
  case "active":
1048
1079
  case "hover": {
1049
- h(
1080
+ v(
1050
1081
  Z.hitRegions.some(
1051
1082
  (_) => _.group === b
1052
1083
  )
@@ -1055,36 +1086,36 @@ function pt({
1055
1086
  }
1056
1087
  }
1057
1088
  }
1058
- ), Te = A.addListener(
1089
+ ), Ae = A.addListener(
1059
1090
  "mountedGroupsChange",
1060
1091
  (Z) => {
1061
1092
  const _ = Z.get(b);
1062
- _ && _.derivedPanelConstraints.length > 0 && (y(_.layout), g?.(_.layout));
1093
+ _ && _.derivedPanelConstraints.length > 0 && (y(_.layout), S?.(_.layout));
1063
1094
  }
1064
1095
  );
1065
1096
  return () => {
1066
- M(), Oe(), Te();
1097
+ M(), De(), Ae();
1067
1098
  };
1068
1099
  }
1069
1100
  }, [
1070
1101
  n,
1071
1102
  o,
1072
1103
  r,
1073
- v,
1104
+ h,
1074
1105
  d,
1075
- g,
1106
+ S,
1076
1107
  l,
1077
- P,
1108
+ L,
1078
1109
  E
1079
1110
  ]);
1080
- const Y = {
1081
- [Ge]: p ? "none" : void 0
1111
+ const q = {
1112
+ [ke]: p ? "none" : void 0
1082
1113
  };
1083
1114
  for (const b in x) {
1084
- const M = Ie(d, b), N = x[b];
1085
- Y[M] = N;
1115
+ const M = Oe(d, b), N = x[b];
1116
+ q[M] = N;
1086
1117
  }
1087
- return /* @__PURE__ */ j(ke.Provider, { value: X, children: /* @__PURE__ */ j(
1118
+ return /* @__PURE__ */ W(Te.Provider, { value: Y, children: /* @__PURE__ */ W(
1088
1119
  "div",
1089
1120
  {
1090
1121
  ...c,
@@ -1093,10 +1124,10 @@ function pt({
1093
1124
  "data-group": !0,
1094
1125
  "data-testid": d,
1095
1126
  id: d,
1096
- ref: q,
1127
+ ref: X,
1097
1128
  style: {
1098
1129
  ...f,
1099
- ...Y,
1130
+ ...q,
1100
1131
  display: "flex",
1101
1132
  flexDirection: l === "horizontal" ? "row" : "column",
1102
1133
  flexWrap: "nowrap"
@@ -1105,34 +1136,34 @@ function pt({
1105
1136
  }
1106
1137
  ) });
1107
1138
  }
1108
- function le(e) {
1139
+ function re(e) {
1109
1140
  return `react-resizable-panels:${e}`;
1110
1141
  }
1111
- function st({
1142
+ function at({
1112
1143
  id: e,
1113
1144
  layout: t,
1114
1145
  storage: n
1115
1146
  }) {
1116
1147
  try {
1117
- const o = le(e);
1148
+ const o = re(e);
1118
1149
  n.setItem(o, JSON.stringify(t));
1119
1150
  } catch (o) {
1120
1151
  console.error(o);
1121
1152
  }
1122
1153
  }
1123
- function mt({
1154
+ function vt({
1124
1155
  groupId: e,
1125
1156
  storage: t
1126
1157
  }) {
1127
- const n = _e(
1128
- rt,
1129
- () => t.getItem(le(e)),
1130
- () => t.getItem(le(e))
1131
- ), o = ze(
1158
+ const n = Fe(
1159
+ lt,
1160
+ () => t.getItem(re(e)),
1161
+ () => t.getItem(re(e))
1162
+ ), o = be(
1132
1163
  () => n ? JSON.parse(n) : null,
1133
1164
  [n]
1134
- ), r = Se(
1135
- (s) => st({
1165
+ ), r = xe(
1166
+ (s) => at({
1136
1167
  id: e,
1137
1168
  layout: s,
1138
1169
  storage: t
@@ -1144,24 +1175,24 @@ function mt({
1144
1175
  onLayoutChange: r
1145
1176
  };
1146
1177
  }
1147
- function rt() {
1178
+ function lt() {
1148
1179
  return function() {
1149
1180
  };
1150
1181
  }
1151
- function ht() {
1182
+ function gt() {
1152
1183
  return G(null);
1153
1184
  }
1154
- function vt() {
1185
+ function yt() {
1155
1186
  return T(null);
1156
1187
  }
1157
- function pe() {
1158
- const e = Fe(ke);
1159
- return S(
1188
+ function de() {
1189
+ const e = We(Te);
1190
+ return z(
1160
1191
  e,
1161
1192
  "Group Context not found; did you render a Panel or Separator outside of a Group?"
1162
1193
  ), e;
1163
1194
  }
1164
- function at({
1195
+ function ut({
1165
1196
  groupId: e,
1166
1197
  panelId: t
1167
1198
  }) {
@@ -1200,21 +1231,21 @@ function at({
1200
1231
  group: f,
1201
1232
  layout: c,
1202
1233
  separatorToPanels: m
1203
- } = n(), g = f.panels.findIndex((v) => v.id === t), d = g === f.panels.length - 1, p = B({
1234
+ } = n(), S = f.panels.findIndex((h) => h.id === t), d = S === f.panels.length - 1, p = B({
1204
1235
  delta: d ? a - i : i - a,
1205
1236
  initialLayout: c,
1206
1237
  panelConstraints: l,
1207
- pivotIndices: d ? [g - 1, g] : [g, g + 1],
1238
+ pivotIndices: d ? [S - 1, S] : [S, S + 1],
1208
1239
  prevLayout: c,
1209
1240
  trigger: "imperative-api"
1210
- }), h = $({
1241
+ }), v = $({
1211
1242
  layout: p,
1212
1243
  panelConstraints: l
1213
1244
  });
1214
- U(c, h) || R((v) => ({
1215
- mountedGroups: new Map(v.mountedGroups).set(f, {
1245
+ U(c, v) || C((h) => ({
1246
+ mountedGroups: new Map(h.mountedGroups).set(f, {
1216
1247
  derivedPanelConstraints: l,
1217
- layout: h,
1248
+ layout: v,
1218
1249
  separatorToPanels: m
1219
1250
  })
1220
1251
  }));
@@ -1244,7 +1275,7 @@ function at({
1244
1275
  let l;
1245
1276
  switch (typeof i) {
1246
1277
  case "number": {
1247
- const { group: f } = n(), c = ue({ group: f });
1278
+ const { group: f } = n(), c = ae({ group: f });
1248
1279
  l = I(i / c * 100);
1249
1280
  break;
1250
1281
  }
@@ -1258,25 +1289,25 @@ function at({
1258
1289
  }
1259
1290
  };
1260
1291
  }
1261
- function lt(e, t) {
1262
- const { id: n } = pe(), o = T({
1263
- collapse: ie,
1264
- expand: ie,
1292
+ function ct(e, t) {
1293
+ const { id: n } = de(), o = T({
1294
+ collapse: oe,
1295
+ expand: oe,
1265
1296
  getSize: () => ({
1266
1297
  asPercentage: 0,
1267
1298
  inPixels: 0
1268
1299
  }),
1269
1300
  isCollapsed: () => !1,
1270
- resize: ie
1301
+ resize: oe
1271
1302
  });
1272
- xe(t, () => o.current, []), H(() => {
1303
+ ze(t, () => o.current, []), F(() => {
1273
1304
  Object.assign(
1274
1305
  o.current,
1275
- at({ groupId: n, panelId: e })
1306
+ ut({ groupId: n, panelId: e })
1276
1307
  );
1277
1308
  });
1278
1309
  }
1279
- function gt({
1310
+ function St({
1280
1311
  children: e,
1281
1312
  className: t,
1282
1313
  collapsedSize: n = 0,
@@ -1291,16 +1322,16 @@ function gt({
1291
1322
  style: c,
1292
1323
  ...m
1293
1324
  }) {
1294
- const g = !!u, d = ce(u), [p, h] = G(null), v = de(h, s), { id: z, registerPanel: x } = pe(), y = l !== null, P = fe((E) => {
1325
+ const S = !!u, d = ue(u), [p, v] = G(null), h = fe(v, s), { id: g, registerPanel: x } = de(), y = l !== null, L = ce((E) => {
1295
1326
  l?.(E, u);
1296
1327
  });
1297
- H(() => {
1328
+ F(() => {
1298
1329
  if (p !== null)
1299
1330
  return x({
1300
1331
  element: p,
1301
1332
  id: d,
1302
- idIsStable: g,
1303
- onResize: y ? P : void 0,
1333
+ idIsStable: S,
1334
+ onResize: y ? L : void 0,
1304
1335
  panelConstraints: {
1305
1336
  collapsedSize: n,
1306
1337
  collapsible: o,
@@ -1316,33 +1347,33 @@ function gt({
1316
1347
  p,
1317
1348
  y,
1318
1349
  d,
1319
- g,
1350
+ S,
1320
1351
  i,
1321
1352
  a,
1322
- P,
1353
+ L,
1323
1354
  x
1324
- ]), lt(d, f);
1325
- const L = Ie(z, d);
1326
- return /* @__PURE__ */ j(
1355
+ ]), ct(d, f);
1356
+ const P = Oe(g, d);
1357
+ return /* @__PURE__ */ W(
1327
1358
  "div",
1328
1359
  {
1329
1360
  ...m,
1330
1361
  "data-panel": !0,
1331
1362
  "data-testid": d,
1332
1363
  id: d,
1333
- ref: v,
1364
+ ref: h,
1334
1365
  style: {
1335
- ...ut,
1366
+ ...ft,
1336
1367
  flexBasis: 0,
1337
- flexGrow: `var(${L}, 1)`,
1368
+ flexGrow: `var(${P}, 1)`,
1338
1369
  flexShrink: 1,
1339
1370
  // Prevent Panel content from interfering with panel size
1340
1371
  overflow: "hidden",
1341
1372
  // Disable pointer events inside of a panel during resize
1342
1373
  // This avoid edge cases like nested iframes
1343
- pointerEvents: `var(${Ge})`
1374
+ pointerEvents: `var(${ke})`
1344
1375
  },
1345
- children: /* @__PURE__ */ j(
1376
+ children: /* @__PURE__ */ W(
1346
1377
  "div",
1347
1378
  {
1348
1379
  className: t,
@@ -1357,7 +1388,7 @@ function gt({
1357
1388
  }
1358
1389
  );
1359
1390
  }
1360
- const ut = {
1391
+ const ft = {
1361
1392
  minHeight: "unset",
1362
1393
  maxHeight: "unset",
1363
1394
  height: "unset",
@@ -1373,13 +1404,13 @@ const ut = {
1373
1404
  padding: "unset",
1374
1405
  margin: "unset"
1375
1406
  };
1376
- function yt() {
1407
+ function xt() {
1377
1408
  return G(null);
1378
1409
  }
1379
- function St() {
1410
+ function zt() {
1380
1411
  return T(null);
1381
1412
  }
1382
- function ct({
1413
+ function dt({
1383
1414
  layout: e,
1384
1415
  panelConstraints: t,
1385
1416
  panelId: n,
@@ -1420,7 +1451,7 @@ function ct({
1420
1451
  valueNow: u
1421
1452
  };
1422
1453
  }
1423
- function xt({
1454
+ function bt({
1424
1455
  children: e,
1425
1456
  className: t,
1426
1457
  elementRef: n,
@@ -1428,40 +1459,40 @@ function xt({
1428
1459
  style: r,
1429
1460
  ...s
1430
1461
  }) {
1431
- const u = ce(o), [i, a] = G({}), [l, f] = G("inactive"), [c, m] = G(null), g = de(m, n), {
1462
+ const u = ue(o), [i, a] = G({}), [l, f] = G("inactive"), [c, m] = G(null), S = fe(m, n), {
1432
1463
  id: d,
1433
1464
  orientation: p,
1434
- registerSeparator: h
1435
- } = pe(), v = p === "horizontal" ? "vertical" : "horizontal";
1436
- return H(() => {
1465
+ registerSeparator: v
1466
+ } = de(), h = p === "horizontal" ? "vertical" : "horizontal";
1467
+ return F(() => {
1437
1468
  if (c !== null) {
1438
- const z = {
1469
+ const g = {
1439
1470
  element: c,
1440
1471
  id: u
1441
- }, x = h(z), y = A.addListener(
1472
+ }, x = v(g), y = A.addListener(
1442
1473
  "interactionStateChange",
1443
- (L) => {
1474
+ (P) => {
1444
1475
  f(
1445
- L.state !== "inactive" && L.hitRegions.some(
1446
- (E) => E.separator === z
1447
- ) ? L.state : "inactive"
1476
+ P.state !== "inactive" && P.hitRegions.some(
1477
+ (E) => E.separator === g
1478
+ ) ? P.state : "inactive"
1448
1479
  );
1449
1480
  }
1450
- ), P = A.addListener(
1481
+ ), L = A.addListener(
1451
1482
  "mountedGroupsChange",
1452
- (L) => {
1453
- L.forEach(
1454
- ({ derivedPanelConstraints: E, layout: K, separatorToPanels: ne }, V) => {
1483
+ (P) => {
1484
+ P.forEach(
1485
+ ({ derivedPanelConstraints: E, layout: K, separatorToPanels: te }, V) => {
1455
1486
  if (V.id === d) {
1456
- const q = ne.get(z);
1457
- if (q) {
1458
- const X = q[0], Y = V.panels.indexOf(X);
1487
+ const X = te.get(g);
1488
+ if (X) {
1489
+ const Y = X[0], q = V.panels.indexOf(Y);
1459
1490
  a(
1460
- ct({
1491
+ dt({
1461
1492
  layout: K,
1462
1493
  panelConstraints: E,
1463
- panelId: X.id,
1464
- panelIndex: Y
1494
+ panelId: Y.id,
1495
+ panelIndex: q
1465
1496
  })
1466
1497
  );
1467
1498
  }
@@ -1471,15 +1502,15 @@ function xt({
1471
1502
  }
1472
1503
  );
1473
1504
  return () => {
1474
- y(), P(), x();
1505
+ y(), L(), x();
1475
1506
  };
1476
1507
  }
1477
- }, [c, d, u, h]), /* @__PURE__ */ j(
1508
+ }, [c, d, u, v]), /* @__PURE__ */ W(
1478
1509
  "div",
1479
1510
  {
1480
1511
  ...s,
1481
1512
  "aria-controls": i.valueControls,
1482
- "aria-orientation": v,
1513
+ "aria-orientation": h,
1483
1514
  "aria-valuemax": i.valueMax,
1484
1515
  "aria-valuemin": i.valueMin,
1485
1516
  "aria-valuenow": i.valueNow,
@@ -1488,7 +1519,7 @@ function xt({
1488
1519
  "data-separator": l,
1489
1520
  "data-testid": u,
1490
1521
  id: u,
1491
- ref: g,
1522
+ ref: S,
1492
1523
  role: "separator",
1493
1524
  style: {
1494
1525
  flexBasis: "auto",
@@ -1501,13 +1532,13 @@ function xt({
1501
1532
  );
1502
1533
  }
1503
1534
  export {
1504
- pt as Group,
1505
- gt as Panel,
1506
- xt as Separator,
1507
- mt as useDefaultLayout,
1508
- ht as useGroupCallbackRef,
1509
- vt as useGroupRef,
1510
- yt as usePanelCallbackRef,
1511
- St as usePanelRef
1535
+ ht as Group,
1536
+ St as Panel,
1537
+ bt as Separator,
1538
+ vt as useDefaultLayout,
1539
+ gt as useGroupCallbackRef,
1540
+ yt as useGroupRef,
1541
+ xt as usePanelCallbackRef,
1542
+ zt as usePanelRef
1512
1543
  };
1513
1544
  //# sourceMappingURL=react-resizable-panels.js.map