react-resizable-panels 4.3.2 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,33 +1,33 @@
1
1
  "use client";
2
- import { jsx as B } from "react/jsx-runtime";
3
- import { useState as K, useCallback as Pe, useId as Ue, useLayoutEffect as We, useEffect as Re, useRef as k, createContext as Be, useImperativeHandle as Ce, useMemo as ae, useSyncExternalStore as Ke, useContext as Xe } from "react";
4
- function z(e, t = "Assertion error") {
2
+ import { jsx as q } from "react/jsx-runtime";
3
+ import { useState as Y, useCallback as K, useId as qe, useLayoutEffect as Me, useEffect as Ee, useRef as k, createContext as Ye, useImperativeHandle as ke, useMemo as Ge, useSyncExternalStore as Je, useContext as Ze } from "react";
4
+ function b(e, t = "Assertion error") {
5
5
  if (!e)
6
6
  throw Error(t);
7
7
  }
8
- function V({
8
+ function U({
9
9
  group: e
10
10
  }) {
11
11
  const { orientation: t, panels: n } = e;
12
12
  return n.reduce((o, i) => (o += t === "horizontal" ? i.element.offsetWidth : i.element.offsetHeight, o), 0);
13
13
  }
14
- function le(e, t) {
14
+ function ce(e, t) {
15
15
  return t.sort(
16
- e === "horizontal" ? qe : Ye
16
+ e === "horizontal" ? Qe : et
17
17
  );
18
18
  }
19
- function qe(e, t) {
19
+ function Qe(e, t) {
20
20
  const n = e.element.offsetLeft - t.element.offsetLeft;
21
21
  return n !== 0 ? n : e.element.offsetWidth - t.element.offsetWidth;
22
22
  }
23
- function Ye(e, t) {
23
+ function et(e, t) {
24
24
  const n = e.element.offsetTop - t.element.offsetTop;
25
25
  return n !== 0 ? n : e.element.offsetHeight - t.element.offsetHeight;
26
26
  }
27
- function Me(e) {
27
+ function Ie(e) {
28
28
  return e !== null && typeof e == "object" && "nodeType" in e && e.nodeType === Node.ELEMENT_NODE;
29
29
  }
30
- function Ee(e, t) {
30
+ function De(e, t) {
31
31
  return {
32
32
  x: e.x >= t.left && e.x <= t.right ? 0 : Math.min(
33
33
  Math.abs(e.x - t.left),
@@ -39,7 +39,7 @@ function Ee(e, t) {
39
39
  )
40
40
  };
41
41
  }
42
- function Je({
42
+ function tt({
43
43
  orientation: e,
44
44
  rects: t,
45
45
  targetRect: n
@@ -50,107 +50,107 @@ function Je({
50
50
  };
51
51
  let i, a = Number.MAX_VALUE;
52
52
  for (const l of t) {
53
- const { x: r, y: s } = Ee(o, l), u = e === "horizontal" ? r : s;
53
+ const { x: r, y: s } = De(o, l), u = e === "horizontal" ? r : s;
54
54
  u < a && (a = u, i = l);
55
55
  }
56
- return z(i, "No rect found"), i;
56
+ return b(i, "No rect found"), i;
57
57
  }
58
- function ke(e) {
59
- const { element: t, orientation: n, panels: o, separators: i } = e, a = le(
58
+ function Oe(e) {
59
+ const { element: t, orientation: n, panels: o, separators: i } = e, a = ce(
60
60
  n,
61
- Array.from(t.children).filter(Me).map((f) => ({ element: f }))
62
- ).map(({ element: f }) => f), l = [];
61
+ Array.from(t.children).filter(Ie).map((c) => ({ element: c }))
62
+ ).map(({ element: c }) => c), l = [];
63
63
  let r = !1, s, u = [];
64
- for (const f of a)
65
- if (f.hasAttribute("data-panel")) {
66
- const p = o.find(
67
- (h) => h.element === f
64
+ for (const c of a)
65
+ if (c.hasAttribute("data-panel")) {
66
+ const h = o.find(
67
+ (m) => m.element === c
68
68
  );
69
- if (p) {
69
+ if (h) {
70
70
  if (s) {
71
- const h = s.element.getBoundingClientRect(), m = f.getBoundingClientRect();
72
- let c;
71
+ const m = s.element.getBoundingClientRect(), p = c.getBoundingClientRect();
72
+ let f;
73
73
  if (r) {
74
- const d = n === "horizontal" ? new DOMRect(h.right, h.top, 0, h.height) : new DOMRect(
75
- h.left,
76
- h.bottom,
77
- h.width,
74
+ const d = n === "horizontal" ? new DOMRect(m.right, m.top, 0, m.height) : new DOMRect(
75
+ m.left,
76
+ m.bottom,
77
+ m.width,
78
78
  0
79
- ), S = n === "horizontal" ? new DOMRect(m.left, m.top, 0, m.height) : new DOMRect(m.left, m.top, m.width, 0);
79
+ ), y = n === "horizontal" ? new DOMRect(p.left, p.top, 0, p.height) : new DOMRect(p.left, p.top, p.width, 0);
80
80
  switch (u.length) {
81
81
  case 0: {
82
- c = [
82
+ f = [
83
83
  d,
84
- S
84
+ y
85
85
  ];
86
86
  break;
87
87
  }
88
88
  case 1: {
89
- const y = u[0], v = Je({
89
+ const S = u[0], v = tt({
90
90
  orientation: n,
91
- rects: [h, m],
92
- targetRect: y.element.getBoundingClientRect()
91
+ rects: [m, p],
92
+ targetRect: S.element.getBoundingClientRect()
93
93
  });
94
- c = [
95
- y,
96
- v === h ? S : d
94
+ f = [
95
+ S,
96
+ v === m ? y : d
97
97
  ];
98
98
  break;
99
99
  }
100
100
  default: {
101
- c = u;
101
+ f = u;
102
102
  break;
103
103
  }
104
104
  }
105
105
  } else
106
- u.length ? c = u : c = [
106
+ u.length ? f = u : f = [
107
107
  n === "horizontal" ? new DOMRect(
108
- h.right,
109
- m.top,
110
- m.left - h.right,
111
- m.height
108
+ m.right,
109
+ p.top,
110
+ p.left - m.right,
111
+ p.height
112
112
  ) : new DOMRect(
113
- m.left,
114
- h.bottom,
115
- m.width,
116
- m.top - h.bottom
113
+ p.left,
114
+ m.bottom,
115
+ p.width,
116
+ p.top - m.bottom
117
117
  )
118
118
  ];
119
- for (const d of c)
119
+ for (const d of f)
120
120
  l.push({
121
121
  group: e,
122
- groupSize: V({ group: e }),
123
- panels: [s, p],
122
+ groupSize: U({ group: e }),
123
+ panels: [s, h],
124
124
  separator: "width" in d ? void 0 : d,
125
125
  rect: "width" in d ? d : d.element.getBoundingClientRect()
126
126
  });
127
127
  }
128
- r = !1, s = p, u = [];
128
+ r = !1, s = h, u = [];
129
129
  }
130
- } else if (f.hasAttribute("data-separator")) {
131
- const p = i.find(
132
- (h) => h.element === f
130
+ } else if (c.hasAttribute("data-separator")) {
131
+ const h = i.find(
132
+ (m) => m.element === c
133
133
  );
134
- p ? u.push(p) : (s = void 0, u = []);
134
+ h ? u.push(h) : (s = void 0, u = []);
135
135
  } else
136
136
  r = !0;
137
137
  return l;
138
138
  }
139
- function Ze(e, t) {
139
+ function nt(e, t) {
140
140
  const n = getComputedStyle(e), o = parseFloat(n.fontSize);
141
141
  return t * o;
142
142
  }
143
- function Qe(e, t) {
143
+ function ot(e, t) {
144
144
  const n = getComputedStyle(e.ownerDocument.body), o = parseFloat(n.fontSize);
145
145
  return t * o;
146
146
  }
147
- function et(e) {
147
+ function rt(e) {
148
148
  return e / 100 * window.innerHeight;
149
149
  }
150
- function tt(e) {
150
+ function it(e) {
151
151
  return e / 100 * window.innerWidth;
152
152
  }
153
- function nt(e) {
153
+ function st(e) {
154
154
  switch (typeof e) {
155
155
  case "number":
156
156
  return [e, "px"];
@@ -160,13 +160,13 @@ function nt(e) {
160
160
  }
161
161
  }
162
162
  }
163
- function Z({
163
+ function oe({
164
164
  groupSize: e,
165
165
  panelElement: t,
166
166
  styleProp: n
167
167
  }) {
168
168
  let o;
169
- const [i, a] = nt(n);
169
+ const [i, a] = st(n);
170
170
  switch (a) {
171
171
  case "%": {
172
172
  o = i / 100 * e;
@@ -177,29 +177,29 @@ function Z({
177
177
  break;
178
178
  }
179
179
  case "rem": {
180
- o = Qe(t, i);
180
+ o = ot(t, i);
181
181
  break;
182
182
  }
183
183
  case "em": {
184
- o = Ze(t, i);
184
+ o = nt(t, i);
185
185
  break;
186
186
  }
187
187
  case "vh": {
188
- o = et(i);
188
+ o = rt(i);
189
189
  break;
190
190
  }
191
191
  case "vw": {
192
- o = tt(i);
192
+ o = it(i);
193
193
  break;
194
194
  }
195
195
  }
196
196
  return o;
197
197
  }
198
- function G(e) {
198
+ function D(e) {
199
199
  return parseFloat(e.toFixed(3));
200
200
  }
201
- function pe(e) {
202
- const { panels: t } = e, n = V({ group: e });
201
+ function ye(e) {
202
+ const { panels: t } = e, n = U({ group: e });
203
203
  return n === 0 ? t.map((o) => ({
204
204
  collapsedSize: 0,
205
205
  collapsible: o.panelConstraints.collapsible === !0,
@@ -211,39 +211,39 @@ function pe(e) {
211
211
  const { element: i, panelConstraints: a } = o;
212
212
  let l = 0;
213
213
  if (a.collapsedSize) {
214
- const f = Z({
214
+ const c = oe({
215
215
  groupSize: n,
216
216
  panelElement: i,
217
217
  styleProp: a.collapsedSize
218
218
  });
219
- l = G(f / n * 100);
219
+ l = D(c / n * 100);
220
220
  }
221
221
  let r;
222
222
  if (a.defaultSize) {
223
- const f = Z({
223
+ const c = oe({
224
224
  groupSize: n,
225
225
  panelElement: i,
226
226
  styleProp: a.defaultSize
227
227
  });
228
- r = G(f / n * 100);
228
+ r = D(c / n * 100);
229
229
  }
230
230
  let s = 0;
231
231
  if (a.minSize) {
232
- const f = Z({
232
+ const c = oe({
233
233
  groupSize: n,
234
234
  panelElement: i,
235
235
  styleProp: a.minSize
236
236
  });
237
- s = G(f / n * 100);
237
+ s = D(c / n * 100);
238
238
  }
239
239
  let u = 100;
240
240
  if (a.maxSize) {
241
- const f = Z({
241
+ const c = oe({
242
242
  groupSize: n,
243
243
  panelElement: i,
244
244
  styleProp: a.maxSize
245
245
  });
246
- u = G(f / n * 100);
246
+ u = D(c / n * 100);
247
247
  }
248
248
  return {
249
249
  collapsedSize: l,
@@ -255,7 +255,7 @@ function pe(e) {
255
255
  };
256
256
  });
257
257
  }
258
- class ot {
258
+ class at {
259
259
  #e = {};
260
260
  addListener(t, n) {
261
261
  const o = this.#e[t];
@@ -294,37 +294,37 @@ class ot {
294
294
  }
295
295
  }
296
296
  }
297
- function M(e, t, n = 0) {
298
- return Math.abs(G(e) - G(t)) <= n;
297
+ function C(e, t, n = 0) {
298
+ return Math.abs(D(e) - D(t)) <= n;
299
299
  }
300
- let E = {
300
+ let G = {
301
301
  cursorFlags: 0,
302
302
  interactionState: {
303
303
  state: "inactive"
304
304
  },
305
305
  mountedGroups: /* @__PURE__ */ new Map()
306
306
  };
307
- const A = new ot();
308
- function D() {
309
- return E;
310
- }
311
- function I(e) {
312
- const t = typeof e == "function" ? e(E) : e;
313
- if (E === t)
314
- return E;
315
- const n = E;
316
- return E = {
317
- ...E,
307
+ const N = new at();
308
+ function I() {
309
+ return G;
310
+ }
311
+ function E(e) {
312
+ const t = typeof e == "function" ? e(G) : e;
313
+ if (G === t)
314
+ return G;
315
+ const n = G;
316
+ return G = {
317
+ ...G,
318
318
  ...t
319
- }, t.cursorFlags !== void 0 && A.emit("cursorFlagsChange", E.cursorFlags), t.interactionState !== void 0 && A.emit("interactionStateChange", E.interactionState), t.mountedGroups !== void 0 && (E.mountedGroups.forEach((o, i) => {
319
+ }, t.cursorFlags !== void 0 && N.emit("cursorFlagsChange", G.cursorFlags), t.interactionState !== void 0 && N.emit("interactionStateChange", G.interactionState), t.mountedGroups !== void 0 && (G.mountedGroups.forEach((o, i) => {
320
320
  o.derivedPanelConstraints.forEach((a) => {
321
321
  if (a.collapsible) {
322
322
  const { layout: l } = n.mountedGroups.get(i) ?? {};
323
323
  if (l) {
324
- const r = M(
324
+ const r = C(
325
325
  a.collapsedSize,
326
326
  o.layout[a.panelId]
327
- ), s = M(
327
+ ), s = C(
328
328
  a.collapsedSize,
329
329
  l[a.panelId]
330
330
  );
@@ -332,9 +332,9 @@ function I(e) {
332
332
  }
333
333
  }
334
334
  });
335
- }), A.emit("mountedGroupsChange", E.mountedGroups)), E;
335
+ }), N.emit("mountedGroupsChange", G.mountedGroups)), G;
336
336
  }
337
- function rt(e, t) {
337
+ function lt(e, t) {
338
338
  if (e.length !== t.length)
339
339
  return !1;
340
340
  for (let n = 0; n < e.length; n++)
@@ -342,10 +342,10 @@ function rt(e, t) {
342
342
  return !1;
343
343
  return !0;
344
344
  }
345
- function X(e, t) {
346
- return M(e, t) ? 0 : e > t ? 1 : -1;
345
+ function J(e, t) {
346
+ return C(e, t) ? 0 : e > t ? 1 : -1;
347
347
  }
348
- function H({
348
+ function V({
349
349
  panelConstraints: e,
350
350
  size: t
351
351
  }) {
@@ -355,15 +355,15 @@ function H({
355
355
  maxSize: i = 100,
356
356
  minSize: a = 0
357
357
  } = e;
358
- if (X(t, a) < 0)
358
+ if (J(t, a) < 0)
359
359
  if (o) {
360
360
  const l = (n + a) / 2;
361
- X(t, l) < 0 ? t = n : t = a;
361
+ J(t, l) < 0 ? t = n : t = a;
362
362
  } else
363
363
  t = a;
364
- return t = Math.min(i, t), t = G(t), t;
364
+ return t = Math.min(i, t), t = D(t), t;
365
365
  }
366
- function q({
366
+ function Z({
367
367
  delta: e,
368
368
  initialLayout: t,
369
369
  panelConstraints: n,
@@ -371,136 +371,136 @@ function q({
371
371
  prevLayout: i,
372
372
  trigger: a
373
373
  }) {
374
- if (M(e, 0))
374
+ if (C(e, 0))
375
375
  return t;
376
- const l = Object.values(t), r = Object.values(i), s = [...l], [u, f] = o;
377
- z(u != null, "Invalid first pivot index"), z(f != null, "Invalid second pivot index");
378
- let p = 0;
376
+ const l = Object.values(t), r = Object.values(i), s = [...l], [u, c] = o;
377
+ b(u != null, "Invalid first pivot index"), b(c != null, "Invalid second pivot index");
378
+ let h = 0;
379
379
  if (a === "keyboard") {
380
380
  {
381
- const c = e < 0 ? f : u, d = n[c];
382
- z(
381
+ const f = e < 0 ? c : u, d = n[f];
382
+ b(
383
383
  d,
384
- `Panel constraints not found for index ${c}`
384
+ `Panel constraints not found for index ${f}`
385
385
  );
386
386
  const {
387
- collapsedSize: S = 0,
388
- collapsible: y,
387
+ collapsedSize: y = 0,
388
+ collapsible: S,
389
389
  minSize: v = 0
390
390
  } = d;
391
- if (y) {
392
- const x = l[c];
393
- if (z(
391
+ if (S) {
392
+ const x = l[f];
393
+ if (b(
394
394
  x != null,
395
- `Previous layout not found for panel index ${c}`
396
- ), M(x, S)) {
395
+ `Previous layout not found for panel index ${f}`
396
+ ), C(x, y)) {
397
397
  const g = v - x;
398
- X(g, Math.abs(e)) > 0 && (e = e < 0 ? 0 - g : g);
398
+ J(g, Math.abs(e)) > 0 && (e = e < 0 ? 0 - g : g);
399
399
  }
400
400
  }
401
401
  }
402
402
  {
403
- const c = e < 0 ? u : f, d = n[c];
404
- z(
403
+ const f = e < 0 ? u : c, d = n[f];
404
+ b(
405
405
  d,
406
- `No panel constraints found for index ${c}`
406
+ `No panel constraints found for index ${f}`
407
407
  );
408
408
  const {
409
- collapsedSize: S = 0,
410
- collapsible: y,
409
+ collapsedSize: y = 0,
410
+ collapsible: S,
411
411
  minSize: v = 0
412
412
  } = d;
413
- if (y) {
414
- const x = l[c];
415
- if (z(
413
+ if (S) {
414
+ const x = l[f];
415
+ if (b(
416
416
  x != null,
417
- `Previous layout not found for panel index ${c}`
418
- ), M(x, v)) {
419
- const g = x - S;
420
- X(g, Math.abs(e)) > 0 && (e = e < 0 ? 0 - g : g);
417
+ `Previous layout not found for panel index ${f}`
418
+ ), C(x, v)) {
419
+ const g = x - y;
420
+ J(g, Math.abs(e)) > 0 && (e = e < 0 ? 0 - g : g);
421
421
  }
422
422
  }
423
423
  }
424
424
  }
425
425
  {
426
- const c = e < 0 ? 1 : -1;
427
- let d = e < 0 ? f : u, S = 0;
426
+ const f = e < 0 ? 1 : -1;
427
+ let d = e < 0 ? c : u, y = 0;
428
428
  for (; ; ) {
429
429
  const v = l[d];
430
- z(
430
+ b(
431
431
  v != null,
432
432
  `Previous layout not found for panel index ${d}`
433
433
  );
434
- const g = H({
434
+ const g = V({
435
435
  panelConstraints: n[d],
436
436
  size: 100
437
437
  }) - v;
438
- if (S += g, d += c, d < 0 || d >= n.length)
438
+ if (y += g, d += f, d < 0 || d >= n.length)
439
439
  break;
440
440
  }
441
- const y = Math.min(Math.abs(e), Math.abs(S));
442
- e = e < 0 ? 0 - y : y;
441
+ const S = Math.min(Math.abs(e), Math.abs(y));
442
+ e = e < 0 ? 0 - S : S;
443
443
  }
444
444
  {
445
- let d = e < 0 ? u : f;
445
+ let d = e < 0 ? u : c;
446
446
  for (; d >= 0 && d < n.length; ) {
447
- const S = Math.abs(e) - Math.abs(p), y = l[d];
448
- z(
449
- y != null,
447
+ const y = Math.abs(e) - Math.abs(h), S = l[d];
448
+ b(
449
+ S != null,
450
450
  `Previous layout not found for panel index ${d}`
451
451
  );
452
- const v = y - S, x = H({
452
+ const v = S - y, x = V({
453
453
  panelConstraints: n[d],
454
454
  size: v
455
455
  });
456
- if (!M(y, x) && (p += y - x, s[d] = x, p.toFixed(3).localeCompare(Math.abs(e).toFixed(3), void 0, {
456
+ if (!C(S, x) && (h += S - x, s[d] = x, h.toFixed(3).localeCompare(Math.abs(e).toFixed(3), void 0, {
457
457
  numeric: !0
458
458
  }) >= 0))
459
459
  break;
460
460
  e < 0 ? d-- : d++;
461
461
  }
462
462
  }
463
- if (rt(r, s))
463
+ if (lt(r, s))
464
464
  return i;
465
465
  {
466
- const c = e < 0 ? f : u, d = l[c];
467
- z(
466
+ const f = e < 0 ? c : u, d = l[f];
467
+ b(
468
468
  d != null,
469
- `Previous layout not found for panel index ${c}`
469
+ `Previous layout not found for panel index ${f}`
470
470
  );
471
- const S = d + p, y = H({
472
- panelConstraints: n[c],
473
- size: S
471
+ const y = d + h, S = V({
472
+ panelConstraints: n[f],
473
+ size: y
474
474
  });
475
- if (s[c] = y, !M(y, S)) {
476
- let v = S - y, g = e < 0 ? f : u;
475
+ if (s[f] = S, !C(S, y)) {
476
+ let v = y - S, g = e < 0 ? c : u;
477
477
  for (; g >= 0 && g < n.length; ) {
478
478
  const L = s[g];
479
- z(
479
+ b(
480
480
  L != null,
481
481
  `Previous layout not found for panel index ${g}`
482
482
  );
483
- const P = L + v, R = H({
483
+ const P = L + v, R = V({
484
484
  panelConstraints: n[g],
485
485
  size: P
486
486
  });
487
- if (M(L, R) || (v -= R - L, s[g] = R), M(v, 0))
487
+ if (C(L, R) || (v -= R - L, s[g] = R), C(v, 0))
488
488
  break;
489
489
  e > 0 ? g-- : g++;
490
490
  }
491
491
  }
492
492
  }
493
- const h = Object.values(s).reduce(
494
- (c, d) => d + c,
493
+ const m = Object.values(s).reduce(
494
+ (f, d) => d + f,
495
495
  0
496
496
  );
497
- if (!M(h, 100, 0.1))
497
+ if (!C(m, 100, 0.1))
498
498
  return i;
499
- const m = Object.keys(i);
500
- return s.reduce((c, d, S) => (c[m[S]] = d, c), {});
499
+ const p = Object.keys(i);
500
+ return s.reduce((f, d, y) => (f[p[y]] = d, f), {});
501
501
  }
502
- function ee(e) {
503
- const { mountedGroups: t } = D();
502
+ function ie(e) {
503
+ const { mountedGroups: t } = I();
504
504
  for (const [n] of t)
505
505
  if (n.separators.some(
506
506
  (o) => o.element === e
@@ -508,15 +508,15 @@ function ee(e) {
508
508
  return n;
509
509
  throw Error("Could not find parent Group for separator element");
510
510
  }
511
- function U(e, t) {
511
+ function _(e, t) {
512
512
  if (Object.keys(e).length !== Object.keys(t).length)
513
513
  return !1;
514
514
  for (const n in e)
515
- if (t[n] === void 0 || X(e[n], t[n]) !== 0)
515
+ if (t[n] === void 0 || J(e[n], t[n]) !== 0)
516
516
  return !1;
517
517
  return !0;
518
518
  }
519
- function F({
519
+ function A({
520
520
  layout: e,
521
521
  panelConstraints: t
522
522
  }) {
@@ -528,42 +528,42 @@ function F({
528
528
  throw Error(
529
529
  `Invalid ${t.length} panel layout: ${o.map((r) => `${r}%`).join(", ")}`
530
530
  );
531
- if (!M(i, 100) && o.length > 0)
531
+ if (!C(i, 100) && o.length > 0)
532
532
  for (let r = 0; r < t.length; r++) {
533
533
  const s = o[r];
534
- z(s != null, `No layout data found for index ${r}`);
534
+ b(s != null, `No layout data found for index ${r}`);
535
535
  const u = 100 / i * s;
536
536
  o[r] = u;
537
537
  }
538
538
  let a = 0;
539
539
  for (let r = 0; r < t.length; r++) {
540
540
  const s = o[r];
541
- z(s != null, `No layout data found for index ${r}`);
542
- const u = H({
541
+ b(s != null, `No layout data found for index ${r}`);
542
+ const u = V({
543
543
  panelConstraints: t[r],
544
544
  size: s
545
545
  });
546
546
  s != u && (a += s - u, o[r] = u);
547
547
  }
548
- if (!M(a, 0))
548
+ if (!C(a, 0))
549
549
  for (let r = 0; r < t.length; r++) {
550
550
  const s = o[r];
551
- z(s != null, `No layout data found for index ${r}`);
552
- const u = s + a, f = H({
551
+ b(s != null, `No layout data found for index ${r}`);
552
+ const u = s + a, c = V({
553
553
  panelConstraints: t[r],
554
554
  size: u
555
555
  });
556
- if (s !== f && (a -= f - s, o[r] = f, M(a, 0)))
556
+ if (s !== c && (a -= c - s, o[r] = c, C(a, 0)))
557
557
  break;
558
558
  }
559
559
  const l = Object.keys(e);
560
560
  return o.reduce((r, s, u) => (r[l[u]] = s, r), {});
561
561
  }
562
- function Ie({
562
+ function Te({
563
563
  groupId: e
564
564
  }) {
565
565
  const t = () => {
566
- const { mountedGroups: n } = D();
566
+ const { mountedGroups: n } = I();
567
567
  for (const [o, i] of n)
568
568
  if (o.id === e)
569
569
  return { group: o, ...i };
@@ -581,11 +581,11 @@ function Ie({
581
581
  group: a,
582
582
  layout: l,
583
583
  separatorToPanels: r
584
- } = t(), s = F({
584
+ } = t(), s = A({
585
585
  layout: n,
586
586
  panelConstraints: i
587
587
  });
588
- return o ? l : (U(l, s) || I((u) => ({
588
+ return o ? l : (_(l, s) || E((u) => ({
589
589
  mountedGroups: new Map(u.mountedGroups).set(a, {
590
590
  defaultLayoutDeferred: o,
591
591
  derivedPanelConstraints: i,
@@ -596,110 +596,110 @@ function Ie({
596
596
  }
597
597
  };
598
598
  }
599
- function Ge(e) {
600
- const { mountedGroups: t } = D(), n = t.get(e);
601
- return z(n, `Mounted Group ${e.id} not found`), n;
599
+ function Ne(e) {
600
+ const { mountedGroups: t } = I(), n = t.get(e);
601
+ return b(n, `Mounted Group ${e.id} not found`), n;
602
602
  }
603
- function _(e, t) {
604
- const n = ee(e), o = Ge(n), i = n.separators.find(
605
- (p) => p.element === e
603
+ function T(e, t) {
604
+ const n = ie(e), o = Ne(n), i = n.separators.find(
605
+ (h) => h.element === e
606
606
  );
607
- z(i, "Matching separator not found");
607
+ b(i, "Matching separator not found");
608
608
  const a = o.separatorToPanels.get(i);
609
- z(a, "Matching panels not found");
610
- const l = a.map((p) => n.panels.indexOf(p)), s = Ie({ groupId: n.id }).getLayout(), u = q({
609
+ b(a, "Matching panels not found");
610
+ const l = a.map((h) => n.panels.indexOf(h)), s = Te({ groupId: n.id }).getLayout(), u = Z({
611
611
  delta: t,
612
612
  initialLayout: s,
613
613
  panelConstraints: o.derivedPanelConstraints,
614
614
  pivotIndices: l,
615
615
  prevLayout: s,
616
616
  trigger: "keyboard"
617
- }), f = F({
617
+ }), c = A({
618
618
  layout: u,
619
619
  panelConstraints: o.derivedPanelConstraints
620
620
  });
621
- U(s, f) || I((p) => ({
622
- mountedGroups: new Map(p.mountedGroups).set(n, {
621
+ _(s, c) || E((h) => ({
622
+ mountedGroups: new Map(h.mountedGroups).set(n, {
623
623
  defaultLayoutDeferred: o.defaultLayoutDeferred,
624
624
  derivedPanelConstraints: o.derivedPanelConstraints,
625
- layout: f,
625
+ layout: c,
626
626
  separatorToPanels: o.separatorToPanels
627
627
  })
628
628
  }));
629
629
  }
630
- function he(e) {
630
+ function ge(e) {
631
631
  if (e.defaultPrevented)
632
632
  return;
633
- const t = e.currentTarget, n = ee(t);
633
+ const t = e.currentTarget, n = ie(t);
634
634
  if (!n.disabled)
635
635
  switch (e.key) {
636
636
  case "ArrowDown": {
637
- e.preventDefault(), n.orientation === "vertical" && _(t, 5);
637
+ e.preventDefault(), n.orientation === "vertical" && T(t, 5);
638
638
  break;
639
639
  }
640
640
  case "ArrowLeft": {
641
- e.preventDefault(), n.orientation === "horizontal" && _(t, -5);
641
+ e.preventDefault(), n.orientation === "horizontal" && T(t, -5);
642
642
  break;
643
643
  }
644
644
  case "ArrowRight": {
645
- e.preventDefault(), n.orientation === "horizontal" && _(t, 5);
645
+ e.preventDefault(), n.orientation === "horizontal" && T(t, 5);
646
646
  break;
647
647
  }
648
648
  case "ArrowUp": {
649
- e.preventDefault(), n.orientation === "vertical" && _(t, -5);
649
+ e.preventDefault(), n.orientation === "vertical" && T(t, -5);
650
650
  break;
651
651
  }
652
652
  case "End": {
653
- e.preventDefault(), _(t, 100);
653
+ e.preventDefault(), T(t, 100);
654
654
  break;
655
655
  }
656
656
  case "Enter": {
657
657
  e.preventDefault();
658
- const o = ee(t), { derivedPanelConstraints: i, layout: a, separatorToPanels: l } = Ge(o), r = o.separators.find(
659
- (p) => p.element === t
658
+ const o = ie(t), { derivedPanelConstraints: i, layout: a, separatorToPanels: l } = Ne(o), r = o.separators.find(
659
+ (h) => h.element === t
660
660
  );
661
- z(r, "Matching separator not found");
661
+ b(r, "Matching separator not found");
662
662
  const s = l.get(r);
663
- z(s, "Matching panels not found");
664
- const u = s[0], f = i.find(
665
- (p) => p.panelId === u.id
663
+ b(s, "Matching panels not found");
664
+ const u = s[0], c = i.find(
665
+ (h) => h.panelId === u.id
666
666
  );
667
- if (z(f, "Panel metadata not found"), f.collapsible) {
668
- const p = a[u.id], h = f.collapsedSize === p ? o.inMemoryLastExpandedPanelSizes[u.id] ?? f.minSize : f.collapsedSize;
669
- _(t, h - p);
667
+ if (b(c, "Panel metadata not found"), c.collapsible) {
668
+ const h = a[u.id], m = c.collapsedSize === h ? o.inMemoryLastExpandedPanelSizes[u.id] ?? c.minSize : c.collapsedSize;
669
+ T(t, m - h);
670
670
  }
671
671
  break;
672
672
  }
673
673
  case "F6": {
674
674
  e.preventDefault();
675
- const i = ee(t).separators.map(
675
+ const i = ie(t).separators.map(
676
676
  (s) => s.element
677
677
  ), a = Array.from(i).findIndex(
678
678
  (s) => s === e.currentTarget
679
679
  );
680
- z(a !== null, "Index not found");
680
+ b(a !== null, "Index not found");
681
681
  const l = e.shiftKey ? a > 0 ? a - 1 : i.length - 1 : a + 1 < i.length ? a + 1 : 0;
682
682
  i[l].focus();
683
683
  break;
684
684
  }
685
685
  case "Home": {
686
- e.preventDefault(), _(t, -100);
686
+ e.preventDefault(), T(t, -100);
687
687
  break;
688
688
  }
689
689
  }
690
690
  }
691
- const it = (e) => e, ie = () => {
692
- }, De = 1, Oe = 2, Te = 4, Ne = 8, me = {
691
+ const ut = (e) => e, le = () => {
692
+ }, _e = 1, Ae = 2, Fe = 4, $e = 8, Se = {
693
693
  coarse: 10,
694
694
  precise: 5
695
695
  };
696
- function st(e, t, n) {
696
+ function ct(e, t, n) {
697
697
  let o, i = {
698
698
  x: 1 / 0,
699
699
  y: 1 / 0
700
700
  };
701
701
  for (const a of t) {
702
- const l = Ee(n, a.rect);
702
+ const l = De(n, a.rect);
703
703
  switch (e) {
704
704
  case "horizontal": {
705
705
  l.x <= i.x && (o = a, i = l);
@@ -716,29 +716,29 @@ function st(e, t, n) {
716
716
  hitRegion: o
717
717
  } : void 0;
718
718
  }
719
- let Q;
720
- function at() {
721
- return Q === void 0 && (typeof matchMedia == "function" ? Q = !!matchMedia("(pointer:coarse)").matches : Q = !1), Q;
719
+ let re;
720
+ function ft() {
721
+ return re === void 0 && (typeof matchMedia == "function" ? re = !!matchMedia("(pointer:coarse)").matches : re = !1), re;
722
722
  }
723
- function lt(e) {
723
+ function dt(e) {
724
724
  return e !== null && typeof e == "object" && "nodeType" in e && e.nodeType === Node.DOCUMENT_FRAGMENT_NODE;
725
725
  }
726
- function ut(e, t) {
726
+ function pt(e, t) {
727
727
  if (e === t) throw new Error("Cannot compare node with itself");
728
728
  const n = {
729
- a: Se(e),
730
- b: Se(t)
729
+ a: ze(e),
730
+ b: ze(t)
731
731
  };
732
732
  let o;
733
733
  for (; n.a.at(-1) === n.b.at(-1); )
734
734
  e = n.a.pop(), t = n.b.pop(), o = e;
735
- z(
735
+ b(
736
736
  o,
737
737
  "Stacking order can only be calculated for elements with a common ancestor"
738
738
  );
739
739
  const i = {
740
- a: ge(ye(n.a)),
741
- b: ge(ye(n.b))
740
+ a: xe(ve(n.a)),
741
+ b: xe(ve(n.b))
742
742
  };
743
743
  if (i.a === i.b) {
744
744
  const a = o.childNodes, l = {
@@ -754,88 +754,88 @@ function ut(e, t) {
754
754
  }
755
755
  return Math.sign(i.a - i.b);
756
756
  }
757
- const ct = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
758
- function ft(e) {
759
- const t = getComputedStyle(_e(e) ?? e).display;
757
+ const ht = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
758
+ function mt(e) {
759
+ const t = getComputedStyle(je(e) ?? e).display;
760
760
  return t === "flex" || t === "inline-flex";
761
761
  }
762
- function dt(e) {
762
+ function yt(e) {
763
763
  const t = getComputedStyle(e);
764
- return !!(t.position === "fixed" || t.zIndex !== "auto" && (t.position !== "static" || ft(e)) || +t.opacity < 1 || "transform" in t && t.transform !== "none" || "webkitTransform" in t && t.webkitTransform !== "none" || "mixBlendMode" in t && t.mixBlendMode !== "normal" || "filter" in t && t.filter !== "none" || "webkitFilter" in t && t.webkitFilter !== "none" || "isolation" in t && t.isolation === "isolate" || ct.test(t.willChange) || t.webkitOverflowScrolling === "touch");
764
+ return !!(t.position === "fixed" || t.zIndex !== "auto" && (t.position !== "static" || mt(e)) || +t.opacity < 1 || "transform" in t && t.transform !== "none" || "webkitTransform" in t && t.webkitTransform !== "none" || "mixBlendMode" in t && t.mixBlendMode !== "normal" || "filter" in t && t.filter !== "none" || "webkitFilter" in t && t.webkitFilter !== "none" || "isolation" in t && t.isolation === "isolate" || ht.test(t.willChange) || t.webkitOverflowScrolling === "touch");
765
765
  }
766
- function ye(e) {
766
+ function ve(e) {
767
767
  let t = e.length;
768
768
  for (; t--; ) {
769
769
  const n = e[t];
770
- if (z(n, "Missing node"), dt(n)) return n;
770
+ if (b(n, "Missing node"), yt(n)) return n;
771
771
  }
772
772
  return null;
773
773
  }
774
- function ge(e) {
774
+ function xe(e) {
775
775
  return e && Number(getComputedStyle(e).zIndex) || 0;
776
776
  }
777
- function Se(e) {
777
+ function ze(e) {
778
778
  const t = [];
779
779
  for (; e; )
780
- t.push(e), e = _e(e);
780
+ t.push(e), e = je(e);
781
781
  return t;
782
782
  }
783
- function _e(e) {
783
+ function je(e) {
784
784
  const { parentNode: t } = e;
785
- return lt(t) ? t.host : t;
785
+ return dt(t) ? t.host : t;
786
786
  }
787
- function pt(e, t) {
787
+ function gt(e, t) {
788
788
  return e.x < t.x + t.width && e.x + e.width > t.x && e.y < t.y + t.height && e.y + e.height > t.y;
789
789
  }
790
- function ht({
790
+ function St({
791
791
  groupElement: e,
792
792
  hitRegion: t,
793
793
  pointerEventTarget: n
794
794
  }) {
795
- if (!Me(n) || n.contains(e) || e.contains(n))
795
+ if (!Ie(n) || n.contains(e) || e.contains(n))
796
796
  return !0;
797
- if (ut(n, e) > 0) {
797
+ if (pt(n, e) > 0) {
798
798
  let o = n;
799
799
  for (; o; ) {
800
800
  if (o.contains(e))
801
801
  return !0;
802
- if (pt(o.getBoundingClientRect(), t))
802
+ if (gt(o.getBoundingClientRect(), t))
803
803
  return !1;
804
804
  o = o.parentElement;
805
805
  }
806
806
  }
807
807
  return !0;
808
808
  }
809
- function Ae(e, t) {
809
+ function He(e, t) {
810
810
  const n = [];
811
811
  return t.forEach((o, i) => {
812
812
  if (i.disabled)
813
813
  return;
814
- const a = at() ? me.coarse : me.precise, l = ke(i), r = st(i.orientation, l, {
814
+ const a = ft() ? Se.coarse : Se.precise, l = Oe(i), r = ct(i.orientation, l, {
815
815
  x: e.clientX,
816
816
  y: e.clientY
817
817
  });
818
- r && r.distance.x <= a && r.distance.y <= a && ht({
818
+ r && r.distance.x <= a && r.distance.y <= a && St({
819
819
  groupElement: i.element,
820
820
  hitRegion: r.hitRegion.rect,
821
821
  pointerEventTarget: e.target
822
822
  }) && n.push(r.hitRegion);
823
823
  }), n;
824
824
  }
825
- function ve(e) {
825
+ function be(e) {
826
826
  if (e.defaultPrevented)
827
827
  return;
828
828
  if (e.pointerType === "mouse" && e.button > 0)
829
829
  return;
830
- const { mountedGroups: t } = D(), n = Ae(e, t), o = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Map();
830
+ const { mountedGroups: t } = I(), n = He(e, t), o = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Map();
831
831
  let r = !1;
832
832
  n.forEach((s) => {
833
- o.add(s.group), s.panels.forEach((f) => {
834
- i.add(f);
833
+ o.add(s.group), s.panels.forEach((c) => {
834
+ i.add(c);
835
835
  }), s.separator && (a.add(s.separator), r || (r = !0, s.separator.element.focus()));
836
836
  const u = t.get(s.group);
837
837
  u && l.set(s.group, u.layout);
838
- }), I({
838
+ }), E({
839
839
  interactionState: {
840
840
  hitRegions: n,
841
841
  initialLayoutMap: l,
@@ -844,7 +844,7 @@ function ve(e) {
844
844
  }
845
845
  }), n.length && e.preventDefault();
846
846
  }
847
- function mt({
847
+ function vt({
848
848
  cursorFlags: e,
849
849
  groups: t,
850
850
  state: n
@@ -871,7 +871,7 @@ function mt({
871
871
  return null;
872
872
  switch (n) {
873
873
  case "active": {
874
- const a = (e & De) !== 0, l = (e & Oe) !== 0, r = (e & Te) !== 0, s = (e & Ne) !== 0;
874
+ const a = (e & _e) !== 0, l = (e & Ae) !== 0, r = (e & Fe) !== 0, s = (e & $e) !== 0;
875
875
  if (e) {
876
876
  if (a)
877
877
  return r ? "se-resize" : s ? "ne-resize" : "e-resize";
@@ -887,17 +887,17 @@ function mt({
887
887
  }
888
888
  return o > 0 && i > 0 ? "move" : o > 0 ? "ew-resize" : "ns-resize";
889
889
  }
890
- const xe = /* @__PURE__ */ new WeakMap();
891
- function ue(e) {
890
+ const we = /* @__PURE__ */ new WeakMap();
891
+ function fe(e) {
892
892
  if (e.defaultView === null || e.defaultView === void 0)
893
893
  return;
894
- let { prevStyle: t, styleSheet: n } = xe.get(e) ?? {};
894
+ let { prevStyle: t, styleSheet: n } = we.get(e) ?? {};
895
895
  n === void 0 && (n = new e.defaultView.CSSStyleSheet(), e.adoptedStyleSheets = [n]);
896
- const { cursorFlags: o, interactionState: i } = D();
896
+ const { cursorFlags: o, interactionState: i } = I();
897
897
  switch (i.state) {
898
898
  case "active":
899
899
  case "hover": {
900
- const a = mt({
900
+ const a = vt({
901
901
  cursorFlags: o,
902
902
  groups: i.hitRegions.map((r) => r.group),
903
903
  state: i.state
@@ -912,12 +912,12 @@ function ue(e) {
912
912
  break;
913
913
  }
914
914
  }
915
- xe.set(e, {
915
+ we.set(e, {
916
916
  prevStyle: t,
917
917
  styleSheet: n
918
918
  });
919
919
  }
920
- function Fe({
920
+ function Ve({
921
921
  document: e,
922
922
  event: t,
923
923
  hitRegions: n,
@@ -928,40 +928,40 @@ function Fe({
928
928
  let l = 0;
929
929
  const r = new Map(i);
930
930
  n.forEach((s) => {
931
- const { group: u, groupSize: f } = s, { disableCursor: p, orientation: h, panels: m } = u;
932
- let c = 0;
933
- a ? h === "horizontal" ? c = (t.clientX - a.x) / f * 100 : c = (t.clientY - a.y) / f * 100 : h === "horizontal" ? c = t.clientX < 0 ? -100 : 100 : c = t.clientY < 0 ? -100 : 100;
931
+ const { group: u, groupSize: c } = s, { disableCursor: h, orientation: m, panels: p } = u;
932
+ let f = 0;
933
+ a ? m === "horizontal" ? f = (t.clientX - a.x) / c * 100 : f = (t.clientY - a.y) / c * 100 : m === "horizontal" ? f = t.clientX < 0 ? -100 : 100 : f = t.clientY < 0 ? -100 : 100;
934
934
  const d = o.get(u), {
935
- defaultLayoutDeferred: S,
936
- derivedPanelConstraints: y,
935
+ defaultLayoutDeferred: y,
936
+ derivedPanelConstraints: S,
937
937
  layout: v,
938
938
  separatorToPanels: x
939
939
  } = i.get(u) ?? { defaultLayoutDeferred: !1 };
940
- if (y && d && v && x) {
941
- const g = q({
942
- delta: c,
940
+ if (S && d && v && x) {
941
+ const g = Z({
942
+ delta: f,
943
943
  initialLayout: d,
944
- panelConstraints: y,
945
- pivotIndices: s.panels.map((L) => m.indexOf(L)),
944
+ panelConstraints: S,
945
+ pivotIndices: s.panels.map((L) => p.indexOf(L)),
946
946
  prevLayout: v,
947
947
  trigger: "mouse-or-touch"
948
948
  });
949
- if (U(g, v)) {
950
- if (c !== 0 && !p)
951
- switch (h) {
949
+ if (_(g, v)) {
950
+ if (f !== 0 && !h)
951
+ switch (m) {
952
952
  case "horizontal": {
953
- l |= c < 0 ? De : Oe;
953
+ l |= f < 0 ? _e : Ae;
954
954
  break;
955
955
  }
956
956
  case "vertical": {
957
- l |= c < 0 ? Te : Ne;
957
+ l |= f < 0 ? Fe : $e;
958
958
  break;
959
959
  }
960
960
  }
961
961
  } else {
962
962
  r.set(s.group, {
963
- defaultLayoutDeferred: S,
964
- derivedPanelConstraints: y,
963
+ defaultLayoutDeferred: y,
964
+ derivedPanelConstraints: S,
965
965
  layout: g,
966
966
  separatorToPanels: x
967
967
  });
@@ -969,16 +969,16 @@ function Fe({
969
969
  s.group.inMemoryLayouts[L] = g;
970
970
  }
971
971
  }
972
- }), I({
972
+ }), E({
973
973
  cursorFlags: l,
974
974
  mountedGroups: r
975
- }), ue(e);
975
+ }), fe(e);
976
976
  }
977
- function ze(e) {
978
- const { interactionState: t, mountedGroups: n } = D();
977
+ function Le(e) {
978
+ const { interactionState: t, mountedGroups: n } = I();
979
979
  switch (t.state) {
980
980
  case "active":
981
- Fe({
981
+ Ve({
982
982
  document: e.currentTarget,
983
983
  event: e,
984
984
  hitRegions: t.hitRegions,
@@ -987,27 +987,27 @@ function ze(e) {
987
987
  });
988
988
  }
989
989
  }
990
- function be(e) {
990
+ function Pe(e) {
991
991
  if (e.defaultPrevented)
992
992
  return;
993
- const { interactionState: t, mountedGroups: n } = D();
993
+ const { interactionState: t, mountedGroups: n } = I();
994
994
  switch (t.state) {
995
995
  case "active": {
996
996
  if (
997
997
  // Skip this check for "pointerleave" events, else Firefox triggers a false positive (see #514)
998
998
  e.buttons === 0
999
999
  ) {
1000
- I(
1000
+ E(
1001
1001
  (o) => o.interactionState.state === "inactive" ? o : {
1002
1002
  cursorFlags: 0,
1003
- interactionState: {
1004
- state: "inactive"
1005
- }
1003
+ interactionState: { state: "inactive" }
1006
1004
  }
1007
- );
1005
+ ), E((o) => ({
1006
+ mountedGroups: new Map(o.mountedGroups)
1007
+ }));
1008
1008
  return;
1009
1009
  }
1010
- Fe({
1010
+ Ve({
1011
1011
  document: e.currentTarget,
1012
1012
  event: e,
1013
1013
  hitRegions: t.hitRegions,
@@ -1018,67 +1018,70 @@ function be(e) {
1018
1018
  break;
1019
1019
  }
1020
1020
  default: {
1021
- const o = Ae(e, n);
1022
- o.length === 0 ? t.state !== "inactive" && I({
1023
- interactionState: { state: "inactive" }
1024
- }) : I({
1021
+ const o = He(e, n);
1022
+ o.length === 0 ? t.state !== "inactive" && E({
1023
+ interactionState: {
1024
+ state: "inactive"
1025
+ }
1026
+ }) : E({
1025
1027
  interactionState: {
1026
1028
  hitRegions: o,
1027
1029
  state: "hover"
1028
1030
  }
1029
- }), ue(e.currentTarget);
1031
+ }), fe(e.currentTarget);
1030
1032
  break;
1031
1033
  }
1032
1034
  }
1033
1035
  }
1034
- function we(e) {
1036
+ function Ce(e) {
1035
1037
  if (e.defaultPrevented)
1036
1038
  return;
1037
1039
  if (e.pointerType === "mouse" && e.button > 0)
1038
1040
  return;
1039
- e.preventDefault();
1040
- const { interactionState: t } = D();
1041
+ const { interactionState: t } = I();
1041
1042
  switch (t.state) {
1042
1043
  case "active":
1043
- I({
1044
+ E({
1044
1045
  cursorFlags: 0,
1045
1046
  interactionState: {
1046
1047
  state: "inactive"
1047
1048
  }
1048
- }), ue(e.currentTarget);
1049
+ }), t.hitRegions.length > 0 && (fe(e.currentTarget), E((n) => ({
1050
+ mountedGroups: new Map(n.mountedGroups)
1051
+ })), e.preventDefault());
1049
1052
  }
1050
1053
  }
1051
- function Le(e) {
1054
+ function Re(e) {
1052
1055
  let t = 0, n = 0;
1053
1056
  const o = {};
1054
1057
  for (const a of e)
1055
1058
  if (a.defaultSize !== void 0) {
1056
1059
  t++;
1057
- const l = G(a.defaultSize);
1060
+ const l = D(a.defaultSize);
1058
1061
  n += l, o[a.panelId] = l;
1059
1062
  } else
1060
1063
  o[a.panelId] = void 0;
1061
1064
  const i = e.length - t;
1062
1065
  if (i !== 0) {
1063
- const a = G((100 - n) / i);
1066
+ const a = D((100 - n) / i);
1064
1067
  for (const l of e)
1065
1068
  l.defaultSize === void 0 && (o[l.panelId] = a);
1066
1069
  }
1067
1070
  return o;
1068
1071
  }
1069
- function yt(e, t, n) {
1072
+ function xt(e, t, n) {
1070
1073
  if (!n[0])
1071
1074
  return;
1072
1075
  const i = e.panels.find((u) => u.element === t);
1073
1076
  if (!i || !i.onResize)
1074
1077
  return;
1075
- const a = V({ group: e }), l = e.orientation === "horizontal" ? i.element.offsetWidth : i.element.offsetHeight, r = i.mutableValues.prevSize, s = {
1076
- asPercentage: G(l / a * 100),
1078
+ const a = U({ group: e }), l = e.orientation === "horizontal" ? i.element.offsetWidth : i.element.offsetHeight, r = i.mutableValues.prevSize, s = {
1079
+ asPercentage: D(l / a * 100),
1077
1080
  inPixels: l
1078
1081
  };
1079
1082
  i.mutableValues.prevSize = s, i.onResize(s, i.id, r);
1080
1083
  }
1081
- function gt(e, t) {
1084
+ function zt(e, t) {
1082
1085
  if (Object.keys(e).length !== Object.keys(t).length)
1083
1086
  return !1;
1084
1087
  for (const o in e)
@@ -1086,7 +1089,7 @@ function gt(e, t) {
1086
1089
  return !1;
1087
1090
  return !0;
1088
1091
  }
1089
- function St(e, t) {
1092
+ function bt(e, t) {
1090
1093
  const n = e.map((i) => i.id), o = Object.keys(t);
1091
1094
  if (n.length !== o.length)
1092
1095
  return !1;
@@ -1095,28 +1098,28 @@ function St(e, t) {
1095
1098
  return !1;
1096
1099
  return !0;
1097
1100
  }
1098
- const j = /* @__PURE__ */ new Map();
1099
- function vt(e) {
1101
+ const H = /* @__PURE__ */ new Map();
1102
+ function wt(e) {
1100
1103
  let t = !0;
1101
- z(
1104
+ b(
1102
1105
  e.element.ownerDocument.defaultView,
1103
1106
  "Cannot register an unmounted Group"
1104
1107
  );
1105
- const n = e.element.ownerDocument.defaultView.ResizeObserver, o = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = new n((c) => {
1106
- for (const d of c) {
1107
- const { borderBoxSize: S, target: y } = d;
1108
- if (y === e.element) {
1108
+ const n = e.element.ownerDocument.defaultView.ResizeObserver, o = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = new n((f) => {
1109
+ for (const d of f) {
1110
+ const { borderBoxSize: y, target: S } = d;
1111
+ if (S === e.element) {
1109
1112
  if (t) {
1110
- if (V({ group: e }) === 0)
1113
+ if (U({ group: e }) === 0)
1111
1114
  return;
1112
- I((x) => {
1115
+ E((x) => {
1113
1116
  const g = x.mountedGroups.get(e);
1114
1117
  if (g) {
1115
- const L = pe(e), P = g.defaultLayoutDeferred ? Le(L) : g.layout, R = F({
1118
+ const L = ye(e), P = g.defaultLayoutDeferred ? Re(L) : g.layout, R = A({
1116
1119
  layout: P,
1117
1120
  panelConstraints: L
1118
1121
  });
1119
- return !g.defaultLayoutDeferred && U(P, R) && gt(
1122
+ return !g.defaultLayoutDeferred && _(P, R) && zt(
1120
1123
  g.derivedPanelConstraints,
1121
1124
  L
1122
1125
  ) ? x : {
@@ -1132,78 +1135,78 @@ function vt(e) {
1132
1135
  });
1133
1136
  }
1134
1137
  } else
1135
- yt(e, y, S);
1138
+ xt(e, S, y);
1136
1139
  }
1137
1140
  });
1138
- a.observe(e.element), e.panels.forEach((c) => {
1139
- z(
1140
- !o.has(c.id),
1141
- `Panel ids must be unique; id "${c.id}" was used more than once`
1142
- ), o.add(c.id), c.onResize && a.observe(c.element);
1141
+ a.observe(e.element), e.panels.forEach((f) => {
1142
+ b(
1143
+ !o.has(f.id),
1144
+ `Panel ids must be unique; id "${f.id}" was used more than once`
1145
+ ), o.add(f.id), f.onResize && a.observe(f.element);
1143
1146
  });
1144
- const l = V({ group: e }), r = pe(e), s = e.panels.map(({ id: c }) => c).join(",");
1147
+ const l = U({ group: e }), r = ye(e), s = e.panels.map(({ id: f }) => f).join(",");
1145
1148
  let u = e.defaultLayout;
1146
- u && (St(e.panels, u) || (u = void 0));
1147
- const f = e.inMemoryLayouts[s] ?? u ?? Le(r), p = F({
1148
- layout: f,
1149
+ u && (bt(e.panels, u) || (u = void 0));
1150
+ const c = e.inMemoryLayouts[s] ?? u ?? Re(r), h = A({
1151
+ layout: c,
1149
1152
  panelConstraints: r
1150
- }), h = ke(e), m = e.element.ownerDocument;
1151
- return I((c) => {
1153
+ }), m = Oe(e), p = e.element.ownerDocument;
1154
+ return E((f) => {
1152
1155
  const d = /* @__PURE__ */ new Map();
1153
- return j.set(
1154
- m,
1155
- (j.get(m) ?? 0) + 1
1156
- ), h.forEach((S) => {
1157
- S.separator && d.set(S.separator, S.panels);
1156
+ return H.set(
1157
+ p,
1158
+ (H.get(p) ?? 0) + 1
1159
+ ), m.forEach((y) => {
1160
+ y.separator && d.set(y.separator, y.panels);
1158
1161
  }), {
1159
- mountedGroups: new Map(c.mountedGroups).set(e, {
1162
+ mountedGroups: new Map(f.mountedGroups).set(e, {
1160
1163
  defaultLayoutDeferred: l === 0,
1161
1164
  derivedPanelConstraints: r,
1162
- layout: p,
1165
+ layout: h,
1163
1166
  separatorToPanels: d
1164
1167
  })
1165
1168
  };
1166
- }), e.separators.forEach((c) => {
1167
- z(
1168
- !i.has(c.id),
1169
- `Separator ids must be unique; id "${c.id}" was used more than once`
1170
- ), i.add(c.id), c.element.addEventListener("keydown", he);
1171
- }), j.get(m) === 1 && (m.addEventListener("pointerdown", ve, !0), m.addEventListener("pointerleave", ze), m.addEventListener("pointermove", be), m.addEventListener("pointerup", we, !0)), function() {
1172
- t = !1, j.set(
1173
- m,
1174
- Math.max(0, (j.get(m) ?? 0) - 1)
1175
- ), I((d) => {
1176
- const S = new Map(d.mountedGroups);
1177
- return S.delete(e), { mountedGroups: S };
1169
+ }), e.separators.forEach((f) => {
1170
+ b(
1171
+ !i.has(f.id),
1172
+ `Separator ids must be unique; id "${f.id}" was used more than once`
1173
+ ), i.add(f.id), f.element.addEventListener("keydown", ge);
1174
+ }), H.get(p) === 1 && (p.addEventListener("pointerdown", be, !0), p.addEventListener("pointerleave", Le), p.addEventListener("pointermove", Pe), p.addEventListener("pointerup", Ce, !0)), function() {
1175
+ t = !1, H.set(
1176
+ p,
1177
+ Math.max(0, (H.get(p) ?? 0) - 1)
1178
+ ), E((d) => {
1179
+ const y = new Map(d.mountedGroups);
1180
+ return y.delete(e), { mountedGroups: y };
1178
1181
  }), e.separators.forEach((d) => {
1179
- d.element.removeEventListener("keydown", he);
1180
- }), j.get(m) || (m.removeEventListener(
1182
+ d.element.removeEventListener("keydown", ge);
1183
+ }), H.get(p) || (p.removeEventListener(
1181
1184
  "pointerdown",
1182
- ve,
1185
+ be,
1183
1186
  !0
1184
- ), m.removeEventListener("pointerleave", ze), m.removeEventListener("pointermove", be), m.removeEventListener("pointerup", we, !0)), a.disconnect();
1187
+ ), p.removeEventListener("pointerleave", Le), p.removeEventListener("pointermove", Pe), p.removeEventListener("pointerup", Ce, !0)), a.disconnect();
1185
1188
  };
1186
1189
  }
1187
- function $e() {
1188
- const [e, t] = K({}), n = Pe(() => t({}), []);
1190
+ function Ue() {
1191
+ const [e, t] = Y({}), n = K(() => t({}), []);
1189
1192
  return [e, n];
1190
1193
  }
1191
- function ce(e) {
1192
- const t = Ue();
1194
+ function de(e) {
1195
+ const t = qe();
1193
1196
  return `${e ?? t}`;
1194
1197
  }
1195
- const $ = typeof window < "u" ? We : Re;
1196
- function te(e) {
1198
+ const F = typeof window < "u" ? Me : Ee;
1199
+ function X(e) {
1197
1200
  const t = k(e);
1198
- return $(() => {
1201
+ return F(() => {
1199
1202
  t.current = e;
1200
- }, [e]), Pe(
1203
+ }, [e]), K(
1201
1204
  (...n) => t.current?.(...n),
1202
1205
  [t]
1203
1206
  );
1204
1207
  }
1205
- function fe(...e) {
1206
- return te((t) => {
1208
+ function pe(...e) {
1209
+ return X((t) => {
1207
1210
  e.forEach((n) => {
1208
1211
  if (n)
1209
1212
  switch (typeof n) {
@@ -1219,27 +1222,27 @@ function fe(...e) {
1219
1222
  });
1220
1223
  });
1221
1224
  }
1222
- function xt(e) {
1225
+ function Lt(e) {
1223
1226
  const t = k({ ...e });
1224
- return $(() => {
1227
+ return F(() => {
1225
1228
  for (const n in e)
1226
1229
  t.current[n] = e[n];
1227
1230
  }, [e]), t.current;
1228
1231
  }
1229
- const je = Be(null);
1230
- function zt(e, t) {
1232
+ const We = Ye(null);
1233
+ function Pt(e, t) {
1231
1234
  const n = k({
1232
1235
  getLayout: () => ({}),
1233
- setLayout: it
1236
+ setLayout: ut
1234
1237
  });
1235
- Ce(t, () => n.current, []), $(() => {
1238
+ ke(t, () => n.current, []), F(() => {
1236
1239
  Object.assign(
1237
1240
  n.current,
1238
- Ie({ groupId: e })
1241
+ Te({ groupId: e })
1239
1242
  );
1240
1243
  });
1241
1244
  }
1242
- function bt({
1245
+ function Ct({
1243
1246
  children: e,
1244
1247
  className: t,
1245
1248
  defaultLayout: n,
@@ -1249,38 +1252,44 @@ function bt({
1249
1252
  groupRef: l,
1250
1253
  id: r,
1251
1254
  onLayoutChange: s,
1252
- orientation: u = "horizontal",
1253
- style: f,
1254
- ...p
1255
+ onLayoutChanged: u,
1256
+ orientation: c = "horizontal",
1257
+ style: h,
1258
+ ...m
1255
1259
  }) {
1256
- const h = k({}), m = te((b) => {
1257
- U(h.current, b) || (h.current = b, s?.(b));
1258
- }), c = ce(r), d = k(null), [S, y] = $e(), v = k({
1260
+ const p = k({
1261
+ onLayoutChange: {},
1262
+ onLayoutChanged: {}
1263
+ }), f = X((z) => {
1264
+ _(p.current.onLayoutChange, z) || (p.current.onLayoutChange = z, s?.(z));
1265
+ }), d = X((z) => {
1266
+ _(p.current.onLayoutChanged, z) || (p.current.onLayoutChanged = z, u?.(z));
1267
+ }), y = de(r), S = k(null), [v, x] = Ue(), g = k({
1259
1268
  lastExpandedPanelSizes: {},
1260
1269
  layouts: {},
1261
1270
  panels: [],
1262
1271
  separators: []
1263
- }), x = fe(d, a);
1264
- zt(c, l);
1265
- const g = te(
1266
- (b, w) => {
1267
- const { interactionState: C, mountedGroups: O } = D();
1268
- for (const T of O.keys())
1269
- if (T.id === b) {
1270
- const N = O.get(T);
1271
- if (N) {
1272
- let Y = !1;
1273
- switch (C.state) {
1272
+ }), L = pe(S, a);
1273
+ Pt(y, l);
1274
+ const P = X(
1275
+ (z, w) => {
1276
+ const { interactionState: M, mountedGroups: j } = I();
1277
+ for (const Q of j.keys())
1278
+ if (Q.id === z) {
1279
+ const W = j.get(Q);
1280
+ if (W) {
1281
+ let ee = !1;
1282
+ switch (M.state) {
1274
1283
  case "active": {
1275
- Y = C.hitRegions.some(
1276
- (ne) => ne.group === T
1284
+ ee = M.hitRegions.some(
1285
+ (se) => se.group === Q
1277
1286
  );
1278
1287
  break;
1279
1288
  }
1280
1289
  }
1281
1290
  return {
1282
- flexGrow: N.layout[w] ?? 1,
1283
- pointerEvents: Y ? "none" : void 0
1291
+ flexGrow: W.layout[w] ?? 1,
1292
+ pointerEvents: ee ? "none" : void 0
1284
1293
  };
1285
1294
  }
1286
1295
  }
@@ -1288,201 +1297,222 @@ function bt({
1288
1297
  flexGrow: n?.[w] ?? 1
1289
1298
  };
1290
1299
  }
1291
- ), L = ae(
1300
+ ), R = Ge(
1292
1301
  () => ({
1293
- getPanelStyles: g,
1294
- id: c,
1295
- orientation: u,
1296
- registerPanel: (b) => {
1297
- const w = v.current;
1298
- return w.panels = le(u, [
1302
+ getPanelStyles: P,
1303
+ id: y,
1304
+ orientation: c,
1305
+ registerPanel: (z) => {
1306
+ const w = g.current;
1307
+ return w.panels = ce(c, [
1299
1308
  ...w.panels,
1300
- b
1301
- ]), y(), () => {
1309
+ z
1310
+ ]), x(), () => {
1302
1311
  w.panels = w.panels.filter(
1303
- (C) => C !== b
1304
- ), y();
1312
+ (M) => M !== z
1313
+ ), x();
1305
1314
  };
1306
1315
  },
1307
- registerSeparator: (b) => {
1308
- const w = v.current;
1309
- return w.separators = le(u, [
1316
+ registerSeparator: (z) => {
1317
+ const w = g.current;
1318
+ return w.separators = ce(c, [
1310
1319
  ...w.separators,
1311
- b
1312
- ]), y(), () => {
1320
+ z
1321
+ ]), x(), () => {
1313
1322
  w.separators = w.separators.filter(
1314
- (C) => C !== b
1315
- ), y();
1323
+ (M) => M !== z
1324
+ ), x();
1316
1325
  };
1317
1326
  }
1318
1327
  }),
1319
- [g, c, y, u]
1320
- ), P = xt({
1328
+ [P, y, x, c]
1329
+ ), O = Lt({
1321
1330
  defaultLayout: n,
1322
1331
  disableCursor: o
1323
- }), R = k(null);
1324
- return $(() => {
1325
- const b = d.current;
1326
- if (b === null)
1332
+ }), $ = k(null);
1333
+ return F(() => {
1334
+ const z = S.current;
1335
+ if (z === null)
1327
1336
  return;
1328
- const w = v.current, C = {
1329
- defaultLayout: P.defaultLayout,
1330
- disableCursor: !!P.disableCursor,
1337
+ const w = g.current, M = {
1338
+ defaultLayout: O.defaultLayout,
1339
+ disableCursor: !!O.disableCursor,
1331
1340
  disabled: !!i,
1332
- element: b,
1333
- id: c,
1334
- inMemoryLastExpandedPanelSizes: v.current.lastExpandedPanelSizes,
1335
- inMemoryLayouts: v.current.layouts,
1336
- orientation: u,
1341
+ element: z,
1342
+ id: y,
1343
+ inMemoryLastExpandedPanelSizes: g.current.lastExpandedPanelSizes,
1344
+ inMemoryLayouts: g.current.layouts,
1345
+ orientation: c,
1337
1346
  panels: w.panels,
1338
1347
  separators: w.separators
1339
1348
  };
1340
- R.current = C;
1341
- const O = vt(C), N = D().mountedGroups.get(C);
1342
- if (N) {
1343
- const { defaultLayoutDeferred: W, derivedPanelConstraints: J, layout: oe } = N;
1344
- !W && J.length > 0 && (m?.(oe), w.panels.forEach((re) => {
1345
- re.scheduleUpdate();
1349
+ $.current = M;
1350
+ const j = wt(M), W = I().mountedGroups.get(M);
1351
+ if (W) {
1352
+ const { defaultLayoutDeferred: B, derivedPanelConstraints: te, layout: ne } = W;
1353
+ !B && te.length > 0 && (f(ne), d(ne), w.panels.forEach((ae) => {
1354
+ ae.scheduleUpdate();
1346
1355
  }));
1347
1356
  }
1348
- const Y = A.addListener(
1357
+ const ee = N.addListener(
1349
1358
  "interactionStateChange",
1350
1359
  () => {
1351
- w.panels.forEach((W) => {
1352
- W.scheduleUpdate();
1360
+ w.panels.forEach((B) => {
1361
+ B.scheduleUpdate();
1353
1362
  });
1354
1363
  }
1355
- ), ne = A.addListener(
1364
+ ), se = N.addListener(
1356
1365
  "mountedGroupsChange",
1357
- (W) => {
1358
- const J = W.get(C);
1359
- if (J) {
1360
- const { defaultLayoutDeferred: oe, derivedPanelConstraints: re, layout: He } = J;
1361
- if (oe || re.length === 0)
1366
+ (B) => {
1367
+ const te = B.get(M);
1368
+ if (te) {
1369
+ const { defaultLayoutDeferred: ne, derivedPanelConstraints: ae, layout: me } = te;
1370
+ if (ne || ae.length === 0)
1362
1371
  return;
1363
- m?.(He), w.panels.forEach((Ve) => {
1364
- Ve.scheduleUpdate();
1372
+ const { interactionState: Be } = I(), Ke = Be.state !== "active";
1373
+ f(me), Ke && d(me), w.panels.forEach((Xe) => {
1374
+ Xe.scheduleUpdate();
1365
1375
  });
1366
1376
  }
1367
1377
  }
1368
1378
  );
1369
1379
  return () => {
1370
- R.current = null, O(), Y(), ne();
1380
+ $.current = null, j(), ee(), se();
1371
1381
  };
1372
1382
  }, [
1373
1383
  i,
1384
+ y,
1385
+ d,
1386
+ f,
1374
1387
  c,
1375
- m,
1376
- u,
1377
- S,
1378
- P
1379
- ]), Re(() => {
1380
- const b = R.current;
1381
- b && (b.defaultLayout = n, b.disableCursor = !!o);
1382
- }), /* @__PURE__ */ B(je.Provider, { value: L, children: /* @__PURE__ */ B(
1388
+ v,
1389
+ O
1390
+ ]), Ee(() => {
1391
+ const z = $.current;
1392
+ z && (z.defaultLayout = n, z.disableCursor = !!o);
1393
+ }), /* @__PURE__ */ q(We.Provider, { value: R, children: /* @__PURE__ */ q(
1383
1394
  "div",
1384
1395
  {
1385
- ...p,
1386
- "aria-orientation": u,
1396
+ ...m,
1397
+ "aria-orientation": c,
1387
1398
  className: t,
1388
1399
  "data-group": !0,
1389
- "data-testid": c,
1390
- id: c,
1391
- ref: x,
1400
+ "data-testid": y,
1401
+ id: y,
1402
+ ref: L,
1392
1403
  style: {
1393
1404
  height: "100%",
1394
1405
  width: "100%",
1395
1406
  overflow: "hidden",
1396
- ...f,
1407
+ ...h,
1397
1408
  display: "flex",
1398
- flexDirection: u === "horizontal" ? "row" : "column",
1409
+ flexDirection: c === "horizontal" ? "row" : "column",
1399
1410
  flexWrap: "nowrap"
1400
1411
  },
1401
1412
  children: e
1402
1413
  }
1403
1414
  ) });
1404
1415
  }
1405
- bt.displayName = "Group";
1406
- function wt(e, t = 10) {
1407
- let n = null;
1408
- return (o) => {
1409
- n !== null && clearTimeout(n), n = setTimeout(() => {
1410
- e(o);
1411
- }, t);
1412
- };
1413
- }
1414
- function se(e, t) {
1416
+ Ct.displayName = "Group";
1417
+ function ue(e, t) {
1415
1418
  return `react-resizable-panels:${[e, ...t].join(":")}`;
1416
1419
  }
1417
- function Dt({
1420
+ function Nt({
1418
1421
  debounceSaveMs: e = 100,
1419
1422
  panelIds: t,
1420
1423
  storage: n = localStorage,
1421
1424
  ...o
1422
1425
  }) {
1423
- const i = t !== void 0, a = "id" in o ? o.id : o.groupId, l = se(a, t ?? []), r = Ke(
1424
- Lt,
1426
+ const i = t !== void 0, a = "id" in o ? o.id : o.groupId, l = ue(a, t ?? []), r = Je(
1427
+ Rt,
1425
1428
  () => n.getItem(l),
1426
1429
  () => n.getItem(l)
1427
- ), s = ae(
1430
+ ), s = Ge(
1428
1431
  () => r ? JSON.parse(r) : void 0,
1429
1432
  [r]
1430
- ), u = ae(() => {
1431
- const f = (p) => {
1432
- let h;
1433
- i ? h = se(a, Object.keys(p)) : h = se(a, []);
1433
+ ), u = k(null), c = K(() => {
1434
+ const p = u.current;
1435
+ p && (u.current = null, clearTimeout(p));
1436
+ }, []);
1437
+ Me(() => () => {
1438
+ c();
1439
+ }, [c]);
1440
+ const h = K(
1441
+ (p) => {
1442
+ c();
1443
+ let f;
1444
+ i ? f = ue(a, Object.keys(p)) : f = ue(a, []);
1434
1445
  try {
1435
- n.setItem(h, JSON.stringify(p));
1436
- } catch (m) {
1437
- console.error(m);
1446
+ n.setItem(f, JSON.stringify(p));
1447
+ } catch (d) {
1448
+ console.error(d);
1438
1449
  }
1439
- };
1440
- return e > 0 ? wt(f, e) : f;
1441
- }, [e, i, a, n]);
1450
+ },
1451
+ [c, i, a, n]
1452
+ ), m = K(
1453
+ (p) => {
1454
+ c(), e === 0 ? h(p) : u.current = setTimeout(() => {
1455
+ h(p);
1456
+ }, e);
1457
+ },
1458
+ [c, e, h]
1459
+ );
1442
1460
  return {
1461
+ /**
1462
+ * Pass this value to `Group` as the `defaultLayout` prop.
1463
+ */
1443
1464
  defaultLayout: s,
1444
- onLayoutChange: u
1465
+ /**
1466
+ * Attach this callback on the `Group` as the `onLayoutChange` prop.
1467
+ *
1468
+ * @deprecated Use the {@link onLayoutChanged} prop instead.
1469
+ */
1470
+ onLayoutChange: m,
1471
+ /**
1472
+ * Attach this callback on the `Group` as the `onLayoutChanged` prop.
1473
+ */
1474
+ onLayoutChanged: h
1445
1475
  };
1446
1476
  }
1447
- function Lt() {
1477
+ function Rt() {
1448
1478
  return function() {
1449
1479
  };
1450
1480
  }
1451
- function Ot() {
1452
- return K(null);
1481
+ function _t() {
1482
+ return Y(null);
1453
1483
  }
1454
- function Tt() {
1484
+ function At() {
1455
1485
  return k(null);
1456
1486
  }
1457
- function de() {
1458
- const e = Xe(je);
1459
- return z(
1487
+ function he() {
1488
+ const e = Ze(We);
1489
+ return b(
1460
1490
  e,
1461
1491
  "Group Context not found; did you render a Panel or Separator outside of a Group?"
1462
1492
  ), e;
1463
1493
  }
1464
- function Pt({
1494
+ function Mt({
1465
1495
  groupId: e,
1466
1496
  panelId: t
1467
1497
  }) {
1468
1498
  const n = () => {
1469
- const { mountedGroups: r } = D();
1499
+ const { mountedGroups: r } = I();
1470
1500
  for (const [
1471
1501
  s,
1472
1502
  {
1473
1503
  defaultLayoutDeferred: u,
1474
- derivedPanelConstraints: f,
1475
- layout: p,
1476
- separatorToPanels: h
1504
+ derivedPanelConstraints: c,
1505
+ layout: h,
1506
+ separatorToPanels: m
1477
1507
  }
1478
1508
  ] of r)
1479
1509
  if (s.id === e)
1480
1510
  return {
1481
1511
  defaultLayoutDeferred: u,
1482
- derivedPanelConstraints: f,
1512
+ derivedPanelConstraints: c,
1483
1513
  group: s,
1484
- layout: p,
1485
- separatorToPanels: h
1514
+ layout: h,
1515
+ separatorToPanels: m
1486
1516
  };
1487
1517
  throw Error(`Group ${e} not found`);
1488
1518
  }, o = () => {
@@ -1508,60 +1538,60 @@ function Pt({
1508
1538
  return;
1509
1539
  const {
1510
1540
  defaultLayoutDeferred: u,
1511
- derivedPanelConstraints: f,
1512
- group: p,
1513
- layout: h,
1514
- separatorToPanels: m
1515
- } = n(), c = p.panels.findIndex((v) => v.id === t), d = c === p.panels.length - 1, S = q({
1541
+ derivedPanelConstraints: c,
1542
+ group: h,
1543
+ layout: m,
1544
+ separatorToPanels: p
1545
+ } = n(), f = h.panels.findIndex((v) => v.id === t), d = f === h.panels.length - 1, y = Z({
1516
1546
  delta: d ? s - r : r - s,
1517
- initialLayout: h,
1518
- panelConstraints: f,
1519
- pivotIndices: d ? [c - 1, c] : [c, c + 1],
1520
- prevLayout: h,
1547
+ initialLayout: m,
1548
+ panelConstraints: c,
1549
+ pivotIndices: d ? [f - 1, f] : [f, f + 1],
1550
+ prevLayout: m,
1521
1551
  trigger: "imperative-api"
1522
- }), y = F({
1523
- layout: S,
1524
- panelConstraints: f
1552
+ }), S = A({
1553
+ layout: y,
1554
+ panelConstraints: c
1525
1555
  });
1526
- U(h, y) || I((v) => ({
1527
- mountedGroups: new Map(v.mountedGroups).set(p, {
1556
+ _(m, S) || E((v) => ({
1557
+ mountedGroups: new Map(v.mountedGroups).set(h, {
1528
1558
  defaultLayoutDeferred: u,
1529
- derivedPanelConstraints: f,
1530
- layout: y,
1531
- separatorToPanels: m
1559
+ derivedPanelConstraints: c,
1560
+ layout: S,
1561
+ separatorToPanels: p
1532
1562
  })
1533
1563
  }));
1534
1564
  };
1535
1565
  return {
1536
1566
  collapse: () => {
1537
- const { collapsible: r, collapsedSize: s } = o(), { mutableValues: u } = i(), f = a();
1538
- r && f !== s && (u.expandToSize = f, l(s));
1567
+ const { collapsible: r, collapsedSize: s } = o(), { mutableValues: u } = i(), c = a();
1568
+ r && c !== s && (u.expandToSize = c, l(s));
1539
1569
  },
1540
1570
  expand: () => {
1541
- const { collapsible: r, collapsedSize: s, minSize: u } = o(), { mutableValues: f } = i(), p = a();
1542
- if (r && p === s) {
1543
- let h = f.expandToSize ?? u;
1544
- h === 0 && (h = 1), l(h);
1571
+ const { collapsible: r, collapsedSize: s, minSize: u } = o(), { mutableValues: c } = i(), h = a();
1572
+ if (r && h === s) {
1573
+ let m = c.expandToSize ?? u;
1574
+ m === 0 && (m = 1), l(m);
1545
1575
  }
1546
1576
  },
1547
1577
  getSize: () => {
1548
- const { group: r } = n(), s = a(), { element: u } = i(), f = r.orientation === "horizontal" ? u.offsetWidth : u.offsetHeight;
1578
+ const { group: r } = n(), s = a(), { element: u } = i(), c = r.orientation === "horizontal" ? u.offsetWidth : u.offsetHeight;
1549
1579
  return {
1550
1580
  asPercentage: s,
1551
- inPixels: f
1581
+ inPixels: c
1552
1582
  };
1553
1583
  },
1554
1584
  isCollapsed: () => {
1555
1585
  const { collapsible: r, collapsedSize: s } = o(), u = a();
1556
- return r && M(s, u);
1586
+ return r && C(s, u);
1557
1587
  },
1558
1588
  resize: (r) => {
1559
1589
  if (a() !== r) {
1560
1590
  let u;
1561
1591
  switch (typeof r) {
1562
1592
  case "number": {
1563
- const { group: f } = n(), p = V({ group: f });
1564
- u = G(r / p * 100);
1593
+ const { group: c } = n(), h = U({ group: c });
1594
+ u = D(r / h * 100);
1565
1595
  break;
1566
1596
  }
1567
1597
  case "string": {
@@ -1574,25 +1604,25 @@ function Pt({
1574
1604
  }
1575
1605
  };
1576
1606
  }
1577
- function Rt(e, t) {
1578
- const { id: n } = de(), o = k({
1579
- collapse: ie,
1580
- expand: ie,
1607
+ function Et(e, t) {
1608
+ const { id: n } = he(), o = k({
1609
+ collapse: le,
1610
+ expand: le,
1581
1611
  getSize: () => ({
1582
1612
  asPercentage: 0,
1583
1613
  inPixels: 0
1584
1614
  }),
1585
1615
  isCollapsed: () => !1,
1586
- resize: ie
1616
+ resize: le
1587
1617
  });
1588
- Ce(t, () => o.current, []), $(() => {
1618
+ ke(t, () => o.current, []), F(() => {
1589
1619
  Object.assign(
1590
1620
  o.current,
1591
- Pt({ groupId: n, panelId: e })
1621
+ Mt({ groupId: n, panelId: e })
1592
1622
  );
1593
1623
  });
1594
1624
  }
1595
- function Ct({
1625
+ function kt({
1596
1626
  children: e,
1597
1627
  className: t,
1598
1628
  collapsedSize: n = "0%",
@@ -1603,22 +1633,22 @@ function Ct({
1603
1633
  maxSize: r = "100%",
1604
1634
  minSize: s = "0%",
1605
1635
  onResize: u,
1606
- panelRef: f,
1607
- style: p,
1608
- ...h
1636
+ panelRef: c,
1637
+ style: h,
1638
+ ...m
1609
1639
  }) {
1610
- const m = !!l, c = ce(l), d = k(null), S = fe(d, a), [, y] = $e(), { getPanelStyles: v, id: x, registerPanel: g } = de(), L = u !== null, P = te(
1611
- (b, w, C) => {
1612
- u?.(b, l, C);
1640
+ const p = !!l, f = de(l), d = k(null), y = pe(d, a), [, S] = Ue(), { getPanelStyles: v, id: x, registerPanel: g } = he(), L = u !== null, P = X(
1641
+ (O, $, z) => {
1642
+ u?.(O, l, z);
1613
1643
  }
1614
1644
  );
1615
- $(() => {
1616
- const b = d.current;
1617
- if (b !== null)
1645
+ F(() => {
1646
+ const O = d.current;
1647
+ if (O !== null)
1618
1648
  return g({
1619
- element: b,
1620
- id: c,
1621
- idIsStable: m,
1649
+ element: O,
1650
+ id: f,
1651
+ idIsStable: p,
1622
1652
  mutableValues: {
1623
1653
  expandToSize: void 0,
1624
1654
  prevSize: void 0
@@ -1631,46 +1661,46 @@ function Ct({
1631
1661
  maxSize: r,
1632
1662
  minSize: s
1633
1663
  },
1634
- scheduleUpdate: y
1664
+ scheduleUpdate: S
1635
1665
  });
1636
1666
  }, [
1637
1667
  n,
1638
1668
  o,
1639
1669
  i,
1640
- y,
1670
+ S,
1641
1671
  L,
1642
- c,
1643
- m,
1672
+ f,
1673
+ p,
1644
1674
  r,
1645
1675
  s,
1646
1676
  P,
1647
1677
  g
1648
- ]), Rt(c, f);
1649
- const R = v(x, c);
1650
- return /* @__PURE__ */ B(
1678
+ ]), Et(f, c);
1679
+ const R = v(x, f);
1680
+ return /* @__PURE__ */ q(
1651
1681
  "div",
1652
1682
  {
1653
- ...h,
1683
+ ...m,
1654
1684
  "data-panel": !0,
1655
- "data-testid": c,
1656
- id: c,
1657
- ref: S,
1685
+ "data-testid": f,
1686
+ id: f,
1687
+ ref: y,
1658
1688
  style: {
1659
- ...Mt,
1689
+ ...Gt,
1660
1690
  flexBasis: 0,
1661
1691
  flexShrink: 1,
1662
1692
  // Prevent Panel content from interfering with panel size
1663
1693
  overflow: "hidden",
1664
1694
  ...R
1665
1695
  },
1666
- children: /* @__PURE__ */ B(
1696
+ children: /* @__PURE__ */ q(
1667
1697
  "div",
1668
1698
  {
1669
1699
  className: t,
1670
1700
  style: {
1671
1701
  width: "100%",
1672
1702
  height: "100%",
1673
- ...p
1703
+ ...h
1674
1704
  },
1675
1705
  children: e
1676
1706
  }
@@ -1678,8 +1708,8 @@ function Ct({
1678
1708
  }
1679
1709
  );
1680
1710
  }
1681
- Ct.displayName = "Panel";
1682
- const Mt = {
1711
+ kt.displayName = "Panel";
1712
+ const Gt = {
1683
1713
  minHeight: 0,
1684
1714
  maxHeight: "100%",
1685
1715
  height: "auto",
@@ -1691,13 +1721,13 @@ const Mt = {
1691
1721
  padding: 0,
1692
1722
  margin: 0
1693
1723
  };
1694
- function Nt() {
1695
- return K(null);
1724
+ function Ft() {
1725
+ return Y(null);
1696
1726
  }
1697
- function _t() {
1727
+ function $t() {
1698
1728
  return k(null);
1699
1729
  }
1700
- function Et({
1730
+ function It({
1701
1731
  layout: e,
1702
1732
  panelConstraints: t,
1703
1733
  panelId: n,
@@ -1708,23 +1738,23 @@ function Et({
1708
1738
  (s) => s.panelId === n
1709
1739
  );
1710
1740
  if (r) {
1711
- const s = r.maxSize, u = a = r.collapsible ? r.collapsedSize : r.minSize, f = [o, o + 1];
1712
- a = F({
1713
- layout: q({
1741
+ const s = r.maxSize, u = a = r.collapsible ? r.collapsedSize : r.minSize, c = [o, o + 1];
1742
+ a = A({
1743
+ layout: Z({
1714
1744
  delta: u - l,
1715
1745
  initialLayout: e,
1716
1746
  panelConstraints: t,
1717
- pivotIndices: f,
1747
+ pivotIndices: c,
1718
1748
  prevLayout: e,
1719
1749
  trigger: "keyboard"
1720
1750
  }),
1721
1751
  panelConstraints: t
1722
- })[n], i = F({
1723
- layout: q({
1752
+ })[n], i = A({
1753
+ layout: Z({
1724
1754
  delta: s - l,
1725
1755
  initialLayout: e,
1726
1756
  panelConstraints: t,
1727
- pivotIndices: f,
1757
+ pivotIndices: c,
1728
1758
  prevLayout: e,
1729
1759
  trigger: "keyboard"
1730
1760
  }),
@@ -1738,7 +1768,7 @@ function Et({
1738
1768
  valueNow: l
1739
1769
  };
1740
1770
  }
1741
- function kt({
1771
+ function Dt({
1742
1772
  children: e,
1743
1773
  className: t,
1744
1774
  elementRef: n,
@@ -1746,41 +1776,41 @@ function kt({
1746
1776
  style: i,
1747
1777
  ...a
1748
1778
  }) {
1749
- const l = ce(o), [r, s] = K({}), [u, f] = K("inactive"), p = k(null), h = fe(p, n), {
1750
- id: m,
1751
- orientation: c,
1779
+ const l = de(o), [r, s] = Y({}), [u, c] = Y("inactive"), h = k(null), m = pe(h, n), {
1780
+ id: p,
1781
+ orientation: f,
1752
1782
  registerSeparator: d
1753
- } = de(), S = c === "horizontal" ? "vertical" : "horizontal";
1754
- return $(() => {
1755
- const y = p.current;
1756
- if (y !== null) {
1783
+ } = he(), y = f === "horizontal" ? "vertical" : "horizontal";
1784
+ return F(() => {
1785
+ const S = h.current;
1786
+ if (S !== null) {
1757
1787
  const v = {
1758
- element: y,
1788
+ element: S,
1759
1789
  id: l
1760
- }, x = d(v), g = A.addListener(
1790
+ }, x = d(v), g = N.addListener(
1761
1791
  "interactionStateChange",
1762
1792
  (P) => {
1763
- f(
1793
+ c(
1764
1794
  P.state !== "inactive" && P.hitRegions.some(
1765
1795
  (R) => R.separator === v
1766
1796
  ) ? P.state : "inactive"
1767
1797
  );
1768
1798
  }
1769
- ), L = A.addListener(
1799
+ ), L = N.addListener(
1770
1800
  "mountedGroupsChange",
1771
1801
  (P) => {
1772
1802
  P.forEach(
1773
- ({ derivedPanelConstraints: R, layout: b, separatorToPanels: w }, C) => {
1774
- if (C.id === m) {
1775
- const O = w.get(v);
1776
- if (O) {
1777
- const T = O[0], N = C.panels.indexOf(T);
1803
+ ({ derivedPanelConstraints: R, layout: O, separatorToPanels: $ }, z) => {
1804
+ if (z.id === p) {
1805
+ const w = $.get(v);
1806
+ if (w) {
1807
+ const M = w[0], j = z.panels.indexOf(M);
1778
1808
  s(
1779
- Et({
1780
- layout: b,
1809
+ It({
1810
+ layout: O,
1781
1811
  panelConstraints: R,
1782
- panelId: T.id,
1783
- panelIndex: N
1812
+ panelId: M.id,
1813
+ panelIndex: j
1784
1814
  })
1785
1815
  );
1786
1816
  }
@@ -1793,12 +1823,12 @@ function kt({
1793
1823
  g(), L(), x();
1794
1824
  };
1795
1825
  }
1796
- }, [m, l, d]), /* @__PURE__ */ B(
1826
+ }, [p, l, d]), /* @__PURE__ */ q(
1797
1827
  "div",
1798
1828
  {
1799
1829
  ...a,
1800
1830
  "aria-controls": r.valueControls,
1801
- "aria-orientation": S,
1831
+ "aria-orientation": y,
1802
1832
  "aria-valuemax": r.valueMax,
1803
1833
  "aria-valuemin": r.valueMin,
1804
1834
  "aria-valuenow": r.valueNow,
@@ -1807,7 +1837,7 @@ function kt({
1807
1837
  "data-separator": u,
1808
1838
  "data-testid": l,
1809
1839
  id: l,
1810
- ref: h,
1840
+ ref: m,
1811
1841
  role: "separator",
1812
1842
  style: {
1813
1843
  flexBasis: "auto",
@@ -1819,15 +1849,15 @@ function kt({
1819
1849
  }
1820
1850
  );
1821
1851
  }
1822
- kt.displayName = "Separator";
1852
+ Dt.displayName = "Separator";
1823
1853
  export {
1824
- bt as Group,
1825
- Ct as Panel,
1826
- kt as Separator,
1827
- Dt as useDefaultLayout,
1828
- Ot as useGroupCallbackRef,
1829
- Tt as useGroupRef,
1830
- Nt as usePanelCallbackRef,
1831
- _t as usePanelRef
1854
+ Ct as Group,
1855
+ kt as Panel,
1856
+ Dt as Separator,
1857
+ Nt as useDefaultLayout,
1858
+ _t as useGroupCallbackRef,
1859
+ At as useGroupRef,
1860
+ Ft as usePanelCallbackRef,
1861
+ $t as usePanelRef
1832
1862
  };
1833
1863
  //# sourceMappingURL=react-resizable-panels.js.map