react-resizable-panels 4.0.0-alpha.3 → 4.0.0-alpha.4

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