@la-batcave/ui 3.1.2

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.
Files changed (107) hide show
  1. package/README.md +95 -0
  2. package/dist/Alert.d.ts +27 -0
  3. package/dist/Alert.js +56 -0
  4. package/dist/Avatar.d.ts +20 -0
  5. package/dist/Avatar.js +40 -0
  6. package/dist/Badge.d.ts +56 -0
  7. package/dist/Badge.js +74 -0
  8. package/dist/Button.d.ts +53 -0
  9. package/dist/Button.js +66 -0
  10. package/dist/Card.d.ts +18 -0
  11. package/dist/Card.js +98 -0
  12. package/dist/CodeBlock.d.ts +45 -0
  13. package/dist/CodeBlock.js +306 -0
  14. package/dist/Collapse.d.ts +58 -0
  15. package/dist/Collapse.js +89 -0
  16. package/dist/Combobox.d.ts +44 -0
  17. package/dist/Combobox.js +409 -0
  18. package/dist/DarkMode.d.ts +59 -0
  19. package/dist/DarkMode.js +56 -0
  20. package/dist/DatePicker.d.ts +48 -0
  21. package/dist/DatePicker.js +2954 -0
  22. package/dist/Dialog.d.ts +119 -0
  23. package/dist/Dialog.js +337 -0
  24. package/dist/Drawer.d.ts +28 -0
  25. package/dist/Drawer.js +1126 -0
  26. package/dist/Dropdown.d.ts +23 -0
  27. package/dist/Dropdown.js +247 -0
  28. package/dist/EasyForm.d.ts +138 -0
  29. package/dist/EasyForm.js +286 -0
  30. package/dist/HoverCard.d.ts +10 -0
  31. package/dist/HoverCard.js +195 -0
  32. package/dist/Input.d.ts +230 -0
  33. package/dist/Input.js +2216 -0
  34. package/dist/LogViewer.d.ts +57 -0
  35. package/dist/LogViewer.js +120 -0
  36. package/dist/Menubar.d.ts +32 -0
  37. package/dist/Menubar.js +398 -0
  38. package/dist/Navbar.d.ts +20 -0
  39. package/dist/Navbar.js +31 -0
  40. package/dist/Pagination.d.ts +78 -0
  41. package/dist/Pagination.js +106 -0
  42. package/dist/Popover.d.ts +11 -0
  43. package/dist/Popover.js +28 -0
  44. package/dist/ProgressBar.d.ts +35 -0
  45. package/dist/ProgressBar.js +210 -0
  46. package/dist/Resizable.d.ts +23 -0
  47. package/dist/Resizable.js +1532 -0
  48. package/dist/Separator.d.ts +4 -0
  49. package/dist/Separator.js +46 -0
  50. package/dist/Sheet.d.ts +29 -0
  51. package/dist/Sheet.js +104 -0
  52. package/dist/Sidebar.d.ts +117 -0
  53. package/dist/Sidebar.js +237 -0
  54. package/dist/Skeleton.d.ts +57 -0
  55. package/dist/Skeleton.js +47 -0
  56. package/dist/Table.d.ts +71 -0
  57. package/dist/Table.js +94 -0
  58. package/dist/Tabs.d.ts +76 -0
  59. package/dist/Tabs.js +202 -0
  60. package/dist/Toast.d.ts +54 -0
  61. package/dist/Toast.js +827 -0
  62. package/dist/Tooltip.d.ts +29 -0
  63. package/dist/Tooltip.js +352 -0
  64. package/dist/Typography.d.ts +101 -0
  65. package/dist/Typography.js +123 -0
  66. package/dist/Widget.d.ts +133 -0
  67. package/dist/Widget.js +207 -0
  68. package/dist/_shared/Combination-D_l4PLF_.js +676 -0
  69. package/dist/_shared/index-B03TCNO5.js +142 -0
  70. package/dist/_shared/index-B1f-hyuh.js +31 -0
  71. package/dist/_shared/index-BC7vfx-u.js +13 -0
  72. package/dist/_shared/index-BrLJJgkl.js +67 -0
  73. package/dist/_shared/index-C0gNQvxa.js +269 -0
  74. package/dist/_shared/index-C3aZemLI.js +268 -0
  75. package/dist/_shared/index-CXeb1OMI.js +198 -0
  76. package/dist/_shared/index-CukUn3R0.js +626 -0
  77. package/dist/_shared/index-DLcqcWxM.js +29 -0
  78. package/dist/_shared/index-DlSuDb9N.js +283 -0
  79. package/dist/_shared/index-V-Ajw7Ac.js +79 -0
  80. package/dist/_shared/index-uPOYJZpG.js +34 -0
  81. package/dist/_shared/index-uu9PT5Nu.js +1588 -0
  82. package/dist/_shared/utils-eGXXUFl7.js +2935 -0
  83. package/dist/backgrounds/Aurora.d.ts +7 -0
  84. package/dist/backgrounds/Aurora.js +126 -0
  85. package/dist/backgrounds/Iridescence.d.ts +7 -0
  86. package/dist/backgrounds/Iridescence.js +77 -0
  87. package/dist/backgrounds/Lightning.d.ts +8 -0
  88. package/dist/backgrounds/Lightning.js +75 -0
  89. package/dist/backgrounds/LiquidChrome.d.ts +9 -0
  90. package/dist/backgrounds/LiquidChrome.js +89 -0
  91. package/dist/backgrounds/Particles.d.ts +15 -0
  92. package/dist/backgrounds/Particles.js +137 -0
  93. package/dist/backgrounds/PixelSnow.d.ts +9 -0
  94. package/dist/backgrounds/PixelSnow.js +52 -0
  95. package/dist/backgrounds/Silk.d.ts +8 -0
  96. package/dist/backgrounds/Silk.js +92 -0
  97. package/dist/backgrounds/Squares.d.ts +9 -0
  98. package/dist/backgrounds/Squares.js +75 -0
  99. package/dist/backgrounds/Threads.d.ts +7 -0
  100. package/dist/backgrounds/Threads.js +110 -0
  101. package/dist/backgrounds/Waves.d.ts +14 -0
  102. package/dist/backgrounds/Waves.js +139 -0
  103. package/dist/fonts/inter-latin-wght-normal.woff2 +0 -0
  104. package/dist/index.css +1 -0
  105. package/dist/index.d.ts +2 -0
  106. package/dist/index.js +4 -0
  107. package/package.json +318 -0
@@ -0,0 +1,1532 @@
1
+ "use client";
2
+ import { jsx as we } from "react/jsx-runtime";
3
+ import { GripVertical as Rn } from "lucide-react";
4
+ import * as Ln from "react";
5
+ import { createContext as An, forwardRef as en, createElement as de, useContext as nn, useRef as F, useImperativeHandle as tn, useState as ue, useEffect as te, useCallback as T, useMemo as Dn, useLayoutEffect as Mn } from "react";
6
+ import { c as rn } from "./_shared/utils-eGXXUFl7.js";
7
+ const Re = An(null);
8
+ Re.displayName = "PanelGroupContext";
9
+ const A = {
10
+ group: "data-panel-group",
11
+ groupDirection: "data-panel-group-direction",
12
+ groupId: "data-panel-group-id",
13
+ panel: "data-panel",
14
+ panelCollapsible: "data-panel-collapsible",
15
+ panelId: "data-panel-id",
16
+ panelSize: "data-panel-size",
17
+ resizeHandle: "data-resize-handle",
18
+ resizeHandleActive: "data-resize-handle-active",
19
+ resizeHandleEnabled: "data-panel-resize-handle-enabled",
20
+ resizeHandleId: "data-panel-resize-handle-id",
21
+ resizeHandleState: "data-resize-handle-state"
22
+ }, Te = 10, re = Mn, Oe = Ln.useId, Hn = typeof Oe == "function" ? Oe : () => null;
23
+ let Nn = 0;
24
+ function Fe(e = null) {
25
+ const n = Hn(), t = F(e || n || null);
26
+ return t.current === null && (t.current = "" + Nn++), e ?? t.current;
27
+ }
28
+ function on({
29
+ children: e,
30
+ className: n = "",
31
+ collapsedSize: t,
32
+ collapsible: r,
33
+ defaultSize: i,
34
+ forwardedRef: o,
35
+ id: l,
36
+ maxSize: a,
37
+ minSize: s,
38
+ onCollapse: m,
39
+ onExpand: P,
40
+ onResize: f,
41
+ order: u,
42
+ style: v,
43
+ tagName: h = "div",
44
+ ...I
45
+ }) {
46
+ const w = nn(Re);
47
+ if (w === null)
48
+ throw Error("Panel components must be rendered within a PanelGroup container");
49
+ const {
50
+ collapsePanel: S,
51
+ expandPanel: R,
52
+ getPanelSize: M,
53
+ getPanelStyle: N,
54
+ groupId: q,
55
+ isPanelCollapsed: C,
56
+ reevaluatePanelConstraints: b,
57
+ registerPanel: K,
58
+ resizePanel: J,
59
+ unregisterPanel: V
60
+ } = w, _ = Fe(l), D = F({
61
+ callbacks: {
62
+ onCollapse: m,
63
+ onExpand: P,
64
+ onResize: f
65
+ },
66
+ constraints: {
67
+ collapsedSize: t,
68
+ collapsible: r,
69
+ defaultSize: i,
70
+ maxSize: a,
71
+ minSize: s
72
+ },
73
+ id: _,
74
+ idIsFromProps: l !== void 0,
75
+ order: u
76
+ });
77
+ F({
78
+ didLogMissingDefaultSizeWarning: !1
79
+ }), re(() => {
80
+ const {
81
+ callbacks: k,
82
+ constraints: $
83
+ } = D.current, G = {
84
+ ...$
85
+ };
86
+ D.current.id = _, D.current.idIsFromProps = l !== void 0, D.current.order = u, k.onCollapse = m, k.onExpand = P, k.onResize = f, $.collapsedSize = t, $.collapsible = r, $.defaultSize = i, $.maxSize = a, $.minSize = s, (G.collapsedSize !== $.collapsedSize || G.collapsible !== $.collapsible || G.maxSize !== $.maxSize || G.minSize !== $.minSize) && b(D.current, G);
87
+ }), re(() => {
88
+ const k = D.current;
89
+ return K(k), () => {
90
+ V(k);
91
+ };
92
+ }, [u, _, K, V]), tn(o, () => ({
93
+ collapse: () => {
94
+ S(D.current);
95
+ },
96
+ expand: (k) => {
97
+ R(D.current, k);
98
+ },
99
+ getId() {
100
+ return _;
101
+ },
102
+ getSize() {
103
+ return M(D.current);
104
+ },
105
+ isCollapsed() {
106
+ return C(D.current);
107
+ },
108
+ isExpanded() {
109
+ return !C(D.current);
110
+ },
111
+ resize: (k) => {
112
+ J(D.current, k);
113
+ }
114
+ }), [S, R, M, C, _, J]);
115
+ const Q = N(D.current, i);
116
+ return de(h, {
117
+ ...I,
118
+ children: e,
119
+ className: n,
120
+ id: _,
121
+ style: {
122
+ ...Q,
123
+ ...v
124
+ },
125
+ // CSS selectors
126
+ [A.groupId]: q,
127
+ [A.panel]: "",
128
+ [A.panelCollapsible]: r || void 0,
129
+ [A.panelId]: _,
130
+ [A.panelSize]: parseFloat("" + Q.flexGrow).toFixed(1)
131
+ });
132
+ }
133
+ const ln = en((e, n) => de(on, {
134
+ ...e,
135
+ forwardedRef: n
136
+ }));
137
+ on.displayName = "Panel";
138
+ ln.displayName = "forwardRef(Panel)";
139
+ let Be = null, Ie = -1, Z = null;
140
+ function $n(e, n) {
141
+ if (n) {
142
+ const t = (n & dn) !== 0, r = (n & fn) !== 0, i = (n & pn) !== 0, o = (n & gn) !== 0;
143
+ if (t)
144
+ return i ? "se-resize" : o ? "ne-resize" : "e-resize";
145
+ if (r)
146
+ return i ? "sw-resize" : o ? "nw-resize" : "w-resize";
147
+ if (i)
148
+ return "s-resize";
149
+ if (o)
150
+ return "n-resize";
151
+ }
152
+ switch (e) {
153
+ case "horizontal":
154
+ return "ew-resize";
155
+ case "intersection":
156
+ return "move";
157
+ case "vertical":
158
+ return "ns-resize";
159
+ }
160
+ }
161
+ function kn() {
162
+ Z !== null && (document.head.removeChild(Z), Be = null, Z = null, Ie = -1);
163
+ }
164
+ function Ne(e, n) {
165
+ var t, r;
166
+ const i = $n(e, n);
167
+ if (Be !== i) {
168
+ if (Be = i, Z === null && (Z = document.createElement("style"), document.head.appendChild(Z)), Ie >= 0) {
169
+ var o;
170
+ (o = Z.sheet) === null || o === void 0 || o.removeRule(Ie);
171
+ }
172
+ Ie = (t = (r = Z.sheet) === null || r === void 0 ? void 0 : r.insertRule(`*{cursor: ${i} !important;}`)) !== null && t !== void 0 ? t : -1;
173
+ }
174
+ }
175
+ function an(e) {
176
+ return e.type === "keydown";
177
+ }
178
+ function sn(e) {
179
+ return e.type.startsWith("pointer");
180
+ }
181
+ function un(e) {
182
+ return e.type.startsWith("mouse");
183
+ }
184
+ function Le(e) {
185
+ if (sn(e)) {
186
+ if (e.isPrimary)
187
+ return {
188
+ x: e.clientX,
189
+ y: e.clientY
190
+ };
191
+ } else if (un(e))
192
+ return {
193
+ x: e.clientX,
194
+ y: e.clientY
195
+ };
196
+ return {
197
+ x: 1 / 0,
198
+ y: 1 / 0
199
+ };
200
+ }
201
+ function _n() {
202
+ if (typeof matchMedia == "function")
203
+ return matchMedia("(pointer:coarse)").matches ? "coarse" : "fine";
204
+ }
205
+ function Gn(e, n, t) {
206
+ return e.x < n.x + n.width && e.x + e.width > n.x && e.y < n.y + n.height && e.y + e.height > n.y;
207
+ }
208
+ function Bn(e, n) {
209
+ if (e === n) throw new Error("Cannot compare node with itself");
210
+ const t = {
211
+ a: je(e),
212
+ b: je(n)
213
+ };
214
+ let r;
215
+ for (; t.a.at(-1) === t.b.at(-1); )
216
+ e = t.a.pop(), n = t.b.pop(), r = e;
217
+ y(r, "Stacking order can only be calculated for elements with a common ancestor");
218
+ const i = {
219
+ a: Xe(qe(t.a)),
220
+ b: Xe(qe(t.b))
221
+ };
222
+ if (i.a === i.b) {
223
+ const o = r.childNodes, l = {
224
+ a: t.a.at(-1),
225
+ b: t.b.at(-1)
226
+ };
227
+ let a = o.length;
228
+ for (; a--; ) {
229
+ const s = o[a];
230
+ if (s === l.a) return 1;
231
+ if (s === l.b) return -1;
232
+ }
233
+ }
234
+ return Math.sign(i.a - i.b);
235
+ }
236
+ const Tn = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
237
+ function Fn(e) {
238
+ var n;
239
+ const t = getComputedStyle((n = cn(e)) !== null && n !== void 0 ? n : e).display;
240
+ return t === "flex" || t === "inline-flex";
241
+ }
242
+ function Vn(e) {
243
+ const n = getComputedStyle(e);
244
+ return !!(n.position === "fixed" || n.zIndex !== "auto" && (n.position !== "static" || Fn(e)) || +n.opacity < 1 || "transform" in n && n.transform !== "none" || "webkitTransform" in n && n.webkitTransform !== "none" || "mixBlendMode" in n && n.mixBlendMode !== "normal" || "filter" in n && n.filter !== "none" || "webkitFilter" in n && n.webkitFilter !== "none" || "isolation" in n && n.isolation === "isolate" || Tn.test(n.willChange) || n.webkitOverflowScrolling === "touch");
245
+ }
246
+ function qe(e) {
247
+ let n = e.length;
248
+ for (; n--; ) {
249
+ const t = e[n];
250
+ if (y(t, "Missing node"), Vn(t)) return t;
251
+ }
252
+ return null;
253
+ }
254
+ function Xe(e) {
255
+ return e && Number(getComputedStyle(e).zIndex) || 0;
256
+ }
257
+ function je(e) {
258
+ const n = [];
259
+ for (; e; )
260
+ n.push(e), e = cn(e);
261
+ return n;
262
+ }
263
+ function cn(e) {
264
+ const {
265
+ parentNode: n
266
+ } = e;
267
+ return n && n instanceof ShadowRoot ? n.host : n;
268
+ }
269
+ const dn = 1, fn = 2, pn = 4, gn = 8, Wn = _n() === "coarse";
270
+ let O = [], ce = !1, ne = /* @__PURE__ */ new Map(), Ae = /* @__PURE__ */ new Map();
271
+ const xe = /* @__PURE__ */ new Set();
272
+ function Kn(e, n, t, r, i) {
273
+ var o;
274
+ const {
275
+ ownerDocument: l
276
+ } = n, a = {
277
+ direction: t,
278
+ element: n,
279
+ hitAreaMargins: r,
280
+ setResizeHandlerState: i
281
+ }, s = (o = ne.get(l)) !== null && o !== void 0 ? o : 0;
282
+ return ne.set(l, s + 1), xe.add(a), Ee(), function() {
283
+ var P;
284
+ Ae.delete(e), xe.delete(a);
285
+ const f = (P = ne.get(l)) !== null && P !== void 0 ? P : 1;
286
+ if (ne.set(l, f - 1), Ee(), f === 1 && ne.delete(l), O.includes(a)) {
287
+ const u = O.indexOf(a);
288
+ u >= 0 && O.splice(u, 1), We(), i("up", !0, null);
289
+ }
290
+ };
291
+ }
292
+ function Un(e) {
293
+ const {
294
+ target: n
295
+ } = e, {
296
+ x: t,
297
+ y: r
298
+ } = Le(e);
299
+ ce = !0, Ve({
300
+ target: n,
301
+ x: t,
302
+ y: r
303
+ }), Ee(), O.length > 0 && (Ce("down", e), e.preventDefault(), mn(n) || e.stopImmediatePropagation());
304
+ }
305
+ function $e(e) {
306
+ const {
307
+ x: n,
308
+ y: t
309
+ } = Le(e);
310
+ if (ce && e.buttons === 0 && (ce = !1, Ce("up", e)), !ce) {
311
+ const {
312
+ target: r
313
+ } = e;
314
+ Ve({
315
+ target: r,
316
+ x: n,
317
+ y: t
318
+ });
319
+ }
320
+ Ce("move", e), We(), O.length > 0 && e.preventDefault();
321
+ }
322
+ function ke(e) {
323
+ const {
324
+ target: n
325
+ } = e, {
326
+ x: t,
327
+ y: r
328
+ } = Le(e);
329
+ Ae.clear(), ce = !1, O.length > 0 && (e.preventDefault(), mn(n) || e.stopImmediatePropagation()), Ce("up", e), Ve({
330
+ target: n,
331
+ x: t,
332
+ y: r
333
+ }), We(), Ee();
334
+ }
335
+ function mn(e) {
336
+ let n = e;
337
+ for (; n; ) {
338
+ if (n.hasAttribute(A.resizeHandle))
339
+ return !0;
340
+ n = n.parentElement;
341
+ }
342
+ return !1;
343
+ }
344
+ function Ve({
345
+ target: e,
346
+ x: n,
347
+ y: t
348
+ }) {
349
+ O.splice(0);
350
+ let r = null;
351
+ (e instanceof HTMLElement || e instanceof SVGElement) && (r = e), xe.forEach((i) => {
352
+ const {
353
+ element: o,
354
+ hitAreaMargins: l
355
+ } = i, a = o.getBoundingClientRect(), {
356
+ bottom: s,
357
+ left: m,
358
+ right: P,
359
+ top: f
360
+ } = a, u = Wn ? l.coarse : l.fine;
361
+ if (n >= m - u && n <= P + u && t >= f - u && t <= s + u) {
362
+ if (r !== null && document.contains(r) && o !== r && !o.contains(r) && !r.contains(o) && // Calculating stacking order has a cost, so we should avoid it if possible
363
+ // That is why we only check potentially intersecting handles,
364
+ // and why we skip if the event target is within the handle's DOM
365
+ Bn(r, o) > 0) {
366
+ let h = r, I = !1;
367
+ for (; h && !h.contains(o); ) {
368
+ if (Gn(h.getBoundingClientRect(), a)) {
369
+ I = !0;
370
+ break;
371
+ }
372
+ h = h.parentElement;
373
+ }
374
+ if (I)
375
+ return;
376
+ }
377
+ O.push(i);
378
+ }
379
+ });
380
+ }
381
+ function _e(e, n) {
382
+ Ae.set(e, n);
383
+ }
384
+ function We() {
385
+ let e = !1, n = !1;
386
+ O.forEach((r) => {
387
+ const {
388
+ direction: i
389
+ } = r;
390
+ i === "horizontal" ? e = !0 : n = !0;
391
+ });
392
+ let t = 0;
393
+ Ae.forEach((r) => {
394
+ t |= r;
395
+ }), e && n ? Ne("intersection", t) : e ? Ne("horizontal", t) : n ? Ne("vertical", t) : kn();
396
+ }
397
+ let Ge = new AbortController();
398
+ function Ee() {
399
+ Ge.abort(), Ge = new AbortController();
400
+ const e = {
401
+ capture: !0,
402
+ signal: Ge.signal
403
+ };
404
+ xe.size && (ce ? (O.length > 0 && ne.forEach((n, t) => {
405
+ const {
406
+ body: r
407
+ } = t;
408
+ n > 0 && (r.addEventListener("contextmenu", ke, e), r.addEventListener("pointerleave", $e, e), r.addEventListener("pointermove", $e, e));
409
+ }), window.addEventListener("pointerup", ke, e), window.addEventListener("pointercancel", ke, e)) : ne.forEach((n, t) => {
410
+ const {
411
+ body: r
412
+ } = t;
413
+ n > 0 && (r.addEventListener("pointerdown", Un, e), r.addEventListener("pointermove", $e, e));
414
+ }));
415
+ }
416
+ function Ce(e, n) {
417
+ xe.forEach((t) => {
418
+ const {
419
+ setResizeHandlerState: r
420
+ } = t, i = O.includes(t);
421
+ r(e, i, n);
422
+ });
423
+ }
424
+ function On() {
425
+ const [e, n] = ue(0);
426
+ return T(() => n((t) => t + 1), []);
427
+ }
428
+ function y(e, n) {
429
+ if (!e)
430
+ throw console.error(n), Error(n);
431
+ }
432
+ function oe(e, n, t = Te) {
433
+ return e.toFixed(t) === n.toFixed(t) ? 0 : e > n ? 1 : -1;
434
+ }
435
+ function Y(e, n, t = Te) {
436
+ return oe(e, n, t) === 0;
437
+ }
438
+ function W(e, n, t) {
439
+ return oe(e, n, t) === 0;
440
+ }
441
+ function qn(e, n, t) {
442
+ if (e.length !== n.length)
443
+ return !1;
444
+ for (let r = 0; r < e.length; r++) {
445
+ const i = e[r], o = n[r];
446
+ if (!W(i, o, t))
447
+ return !1;
448
+ }
449
+ return !0;
450
+ }
451
+ function se({
452
+ panelConstraints: e,
453
+ panelIndex: n,
454
+ size: t
455
+ }) {
456
+ const r = e[n];
457
+ y(r != null, `Panel constraints not found for index ${n}`);
458
+ let {
459
+ collapsedSize: i = 0,
460
+ collapsible: o,
461
+ maxSize: l = 100,
462
+ minSize: a = 0
463
+ } = r;
464
+ if (oe(t, a) < 0)
465
+ if (o) {
466
+ const s = (i + a) / 2;
467
+ oe(t, s) < 0 ? t = i : t = a;
468
+ } else
469
+ t = a;
470
+ return t = Math.min(l, t), t = parseFloat(t.toFixed(Te)), t;
471
+ }
472
+ function ye({
473
+ delta: e,
474
+ initialLayout: n,
475
+ panelConstraints: t,
476
+ pivotIndices: r,
477
+ prevLayout: i,
478
+ trigger: o
479
+ }) {
480
+ if (W(e, 0))
481
+ return n;
482
+ const l = [...n], [a, s] = r;
483
+ y(a != null, "Invalid first pivot index"), y(s != null, "Invalid second pivot index");
484
+ let m = 0;
485
+ if (o === "keyboard") {
486
+ {
487
+ const f = e < 0 ? s : a, u = t[f];
488
+ y(u, `Panel constraints not found for index ${f}`);
489
+ const {
490
+ collapsedSize: v = 0,
491
+ collapsible: h,
492
+ minSize: I = 0
493
+ } = u;
494
+ if (h) {
495
+ const w = n[f];
496
+ if (y(w != null, `Previous layout not found for panel index ${f}`), W(w, v)) {
497
+ const S = I - w;
498
+ oe(S, Math.abs(e)) > 0 && (e = e < 0 ? 0 - S : S);
499
+ }
500
+ }
501
+ }
502
+ {
503
+ const f = e < 0 ? a : s, u = t[f];
504
+ y(u, `No panel constraints found for index ${f}`);
505
+ const {
506
+ collapsedSize: v = 0,
507
+ collapsible: h,
508
+ minSize: I = 0
509
+ } = u;
510
+ if (h) {
511
+ const w = n[f];
512
+ if (y(w != null, `Previous layout not found for panel index ${f}`), W(w, I)) {
513
+ const S = w - v;
514
+ oe(S, Math.abs(e)) > 0 && (e = e < 0 ? 0 - S : S);
515
+ }
516
+ }
517
+ }
518
+ }
519
+ {
520
+ const f = e < 0 ? 1 : -1;
521
+ let u = e < 0 ? s : a, v = 0;
522
+ for (; ; ) {
523
+ const I = n[u];
524
+ y(I != null, `Previous layout not found for panel index ${u}`);
525
+ const S = se({
526
+ panelConstraints: t,
527
+ panelIndex: u,
528
+ size: 100
529
+ }) - I;
530
+ if (v += S, u += f, u < 0 || u >= t.length)
531
+ break;
532
+ }
533
+ const h = Math.min(Math.abs(e), Math.abs(v));
534
+ e = e < 0 ? 0 - h : h;
535
+ }
536
+ {
537
+ let u = e < 0 ? a : s;
538
+ for (; u >= 0 && u < t.length; ) {
539
+ const v = Math.abs(e) - Math.abs(m), h = n[u];
540
+ y(h != null, `Previous layout not found for panel index ${u}`);
541
+ const I = h - v, w = se({
542
+ panelConstraints: t,
543
+ panelIndex: u,
544
+ size: I
545
+ });
546
+ if (!W(h, w) && (m += h - w, l[u] = w, m.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3), void 0, {
547
+ numeric: !0
548
+ }) >= 0))
549
+ break;
550
+ e < 0 ? u-- : u++;
551
+ }
552
+ }
553
+ if (qn(i, l))
554
+ return i;
555
+ {
556
+ const f = e < 0 ? s : a, u = n[f];
557
+ y(u != null, `Previous layout not found for panel index ${f}`);
558
+ const v = u + m, h = se({
559
+ panelConstraints: t,
560
+ panelIndex: f,
561
+ size: v
562
+ });
563
+ if (l[f] = h, !W(h, v)) {
564
+ let I = v - h, S = e < 0 ? s : a;
565
+ for (; S >= 0 && S < t.length; ) {
566
+ const R = l[S];
567
+ y(R != null, `Previous layout not found for panel index ${S}`);
568
+ const M = R + I, N = se({
569
+ panelConstraints: t,
570
+ panelIndex: S,
571
+ size: M
572
+ });
573
+ if (W(R, N) || (I -= N - R, l[S] = N), W(I, 0))
574
+ break;
575
+ e > 0 ? S-- : S++;
576
+ }
577
+ }
578
+ }
579
+ const P = l.reduce((f, u) => u + f, 0);
580
+ return W(P, 100) ? l : i;
581
+ }
582
+ function Xn({
583
+ layout: e,
584
+ panelsArray: n,
585
+ pivotIndices: t
586
+ }) {
587
+ let r = 0, i = 100, o = 0, l = 0;
588
+ const a = t[0];
589
+ y(a != null, "No pivot index found"), n.forEach((f, u) => {
590
+ const {
591
+ constraints: v
592
+ } = f, {
593
+ maxSize: h = 100,
594
+ minSize: I = 0
595
+ } = v;
596
+ u === a ? (r = I, i = h) : (o += I, l += h);
597
+ });
598
+ const s = Math.min(i, 100 - o), m = Math.max(r, 100 - l), P = e[a];
599
+ return {
600
+ valueMax: s,
601
+ valueMin: m,
602
+ valueNow: P
603
+ };
604
+ }
605
+ function Se(e, n = document) {
606
+ return Array.from(n.querySelectorAll(`[${A.resizeHandleId}][data-panel-group-id="${e}"]`));
607
+ }
608
+ function hn(e, n, t = document) {
609
+ const i = Se(e, t).findIndex((o) => o.getAttribute(A.resizeHandleId) === n);
610
+ return i ?? null;
611
+ }
612
+ function zn(e, n, t) {
613
+ const r = hn(e, n, t);
614
+ return r != null ? [r, r + 1] : [-1, -1];
615
+ }
616
+ function yn(e, n = document) {
617
+ var t;
618
+ if (n instanceof HTMLElement && (n == null || (t = n.dataset) === null || t === void 0 ? void 0 : t.panelGroupId) == e)
619
+ return n;
620
+ const r = n.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);
621
+ return r || null;
622
+ }
623
+ function De(e, n = document) {
624
+ const t = n.querySelector(`[${A.resizeHandleId}="${e}"]`);
625
+ return t || null;
626
+ }
627
+ function jn(e, n, t, r = document) {
628
+ var i, o, l, a;
629
+ const s = De(n, r), m = Se(e, r), P = s ? m.indexOf(s) : -1, f = (i = (o = t[P]) === null || o === void 0 ? void 0 : o.id) !== null && i !== void 0 ? i : null, u = (l = (a = t[P + 1]) === null || a === void 0 ? void 0 : a.id) !== null && l !== void 0 ? l : null;
630
+ return [f, u];
631
+ }
632
+ function Jn({
633
+ committedValuesRef: e,
634
+ eagerValuesRef: n,
635
+ groupId: t,
636
+ layout: r,
637
+ panelDataArray: i,
638
+ panelGroupElement: o,
639
+ setLayout: l
640
+ }) {
641
+ F({
642
+ didWarnAboutMissingResizeHandle: !1
643
+ }), re(() => {
644
+ if (!o)
645
+ return;
646
+ const a = Se(t, o);
647
+ for (let s = 0; s < i.length - 1; s++) {
648
+ const {
649
+ valueMax: m,
650
+ valueMin: P,
651
+ valueNow: f
652
+ } = Xn({
653
+ layout: r,
654
+ panelsArray: i,
655
+ pivotIndices: [s, s + 1]
656
+ }), u = a[s];
657
+ if (u != null) {
658
+ const v = i[s];
659
+ y(v, `No panel data found for index "${s}"`), u.setAttribute("aria-controls", v.id), u.setAttribute("aria-valuemax", "" + Math.round(m)), u.setAttribute("aria-valuemin", "" + Math.round(P)), u.setAttribute("aria-valuenow", f != null ? "" + Math.round(f) : "");
660
+ }
661
+ }
662
+ return () => {
663
+ a.forEach((s, m) => {
664
+ s.removeAttribute("aria-controls"), s.removeAttribute("aria-valuemax"), s.removeAttribute("aria-valuemin"), s.removeAttribute("aria-valuenow");
665
+ });
666
+ };
667
+ }, [t, r, i, o]), te(() => {
668
+ if (!o)
669
+ return;
670
+ const a = n.current;
671
+ y(a, "Eager values not found");
672
+ const {
673
+ panelDataArray: s
674
+ } = a, m = yn(t, o);
675
+ y(m != null, `No group found for id "${t}"`);
676
+ const P = Se(t, o);
677
+ y(P, `No resize handles found for group id "${t}"`);
678
+ const f = P.map((u) => {
679
+ const v = u.getAttribute(A.resizeHandleId);
680
+ y(v, "Resize handle element has no handle id attribute");
681
+ const [h, I] = jn(t, v, s, o);
682
+ if (h == null || I == null)
683
+ return () => {
684
+ };
685
+ const w = (S) => {
686
+ if (!S.defaultPrevented)
687
+ switch (S.key) {
688
+ case "Enter": {
689
+ S.preventDefault();
690
+ const R = s.findIndex((M) => M.id === h);
691
+ if (R >= 0) {
692
+ const M = s[R];
693
+ y(M, `No panel data found for index ${R}`);
694
+ const N = r[R], {
695
+ collapsedSize: q = 0,
696
+ collapsible: C,
697
+ minSize: b = 0
698
+ } = M.constraints;
699
+ if (N != null && C) {
700
+ const K = ye({
701
+ delta: W(N, q) ? b - q : q - N,
702
+ initialLayout: r,
703
+ panelConstraints: s.map((J) => J.constraints),
704
+ pivotIndices: zn(t, v, o),
705
+ prevLayout: r,
706
+ trigger: "keyboard"
707
+ });
708
+ r !== K && l(K);
709
+ }
710
+ }
711
+ break;
712
+ }
713
+ }
714
+ };
715
+ return u.addEventListener("keydown", w), () => {
716
+ u.removeEventListener("keydown", w);
717
+ };
718
+ });
719
+ return () => {
720
+ f.forEach((u) => u());
721
+ };
722
+ }, [o, e, n, t, r, i, l]);
723
+ }
724
+ function Je(e, n) {
725
+ if (e.length !== n.length)
726
+ return !1;
727
+ for (let t = 0; t < e.length; t++)
728
+ if (e[t] !== n[t])
729
+ return !1;
730
+ return !0;
731
+ }
732
+ function vn(e, n) {
733
+ const t = e === "horizontal", {
734
+ x: r,
735
+ y: i
736
+ } = Le(n);
737
+ return t ? r : i;
738
+ }
739
+ function Yn(e, n, t, r, i) {
740
+ const o = t === "horizontal", l = De(n, i);
741
+ y(l, `No resize handle element found for id "${n}"`);
742
+ const a = l.getAttribute(A.groupId);
743
+ y(a, "Resize handle element has no group id attribute");
744
+ let {
745
+ initialCursorPosition: s
746
+ } = r;
747
+ const m = vn(t, e), P = yn(a, i);
748
+ y(P, `No group element found for id "${a}"`);
749
+ const f = P.getBoundingClientRect(), u = o ? f.width : f.height;
750
+ return (m - s) / u * 100;
751
+ }
752
+ function Zn(e, n, t, r, i, o) {
753
+ if (an(e)) {
754
+ const l = t === "horizontal";
755
+ let a = 0;
756
+ e.shiftKey ? a = 100 : i != null ? a = i : a = 10;
757
+ let s = 0;
758
+ switch (e.key) {
759
+ case "ArrowDown":
760
+ s = l ? 0 : a;
761
+ break;
762
+ case "ArrowLeft":
763
+ s = l ? -a : 0;
764
+ break;
765
+ case "ArrowRight":
766
+ s = l ? a : 0;
767
+ break;
768
+ case "ArrowUp":
769
+ s = l ? 0 : -a;
770
+ break;
771
+ case "End":
772
+ s = 100;
773
+ break;
774
+ case "Home":
775
+ s = -100;
776
+ break;
777
+ }
778
+ return s;
779
+ } else
780
+ return r == null ? 0 : Yn(e, n, t, r, o);
781
+ }
782
+ function Qn({
783
+ panelDataArray: e
784
+ }) {
785
+ const n = Array(e.length), t = e.map((o) => o.constraints);
786
+ let r = 0, i = 100;
787
+ for (let o = 0; o < e.length; o++) {
788
+ const l = t[o];
789
+ y(l, `Panel constraints not found for index ${o}`);
790
+ const {
791
+ defaultSize: a
792
+ } = l;
793
+ a != null && (r++, n[o] = a, i -= a);
794
+ }
795
+ for (let o = 0; o < e.length; o++) {
796
+ const l = t[o];
797
+ y(l, `Panel constraints not found for index ${o}`);
798
+ const {
799
+ defaultSize: a
800
+ } = l;
801
+ if (a != null)
802
+ continue;
803
+ const s = e.length - r, m = i / s;
804
+ r++, n[o] = m, i -= m;
805
+ }
806
+ return n;
807
+ }
808
+ function le(e, n, t) {
809
+ n.forEach((r, i) => {
810
+ const o = e[i];
811
+ y(o, `Panel data not found for index ${i}`);
812
+ const {
813
+ callbacks: l,
814
+ constraints: a,
815
+ id: s
816
+ } = o, {
817
+ collapsedSize: m = 0,
818
+ collapsible: P
819
+ } = a, f = t[s];
820
+ if (f == null || r !== f) {
821
+ t[s] = r;
822
+ const {
823
+ onCollapse: u,
824
+ onExpand: v,
825
+ onResize: h
826
+ } = l;
827
+ h && h(r, f), P && (u || v) && (v && (f == null || Y(f, m)) && !Y(r, m) && v(), u && (f == null || !Y(f, m)) && Y(r, m) && u());
828
+ }
829
+ });
830
+ }
831
+ function Pe(e, n) {
832
+ if (e.length !== n.length)
833
+ return !1;
834
+ for (let t = 0; t < e.length; t++)
835
+ if (e[t] != n[t])
836
+ return !1;
837
+ return !0;
838
+ }
839
+ function et({
840
+ defaultSize: e,
841
+ dragState: n,
842
+ layout: t,
843
+ panelData: r,
844
+ panelIndex: i,
845
+ precision: o = 3
846
+ }) {
847
+ const l = t[i];
848
+ let a;
849
+ return l == null ? a = e != null ? e.toPrecision(o) : "1" : r.length === 1 ? a = "1" : a = l.toPrecision(o), {
850
+ flexBasis: 0,
851
+ flexGrow: a,
852
+ flexShrink: 1,
853
+ // Without this, Panel sizes may be unintentionally overridden by their content
854
+ overflow: "hidden",
855
+ // Disable pointer events inside of a panel during resize
856
+ // This avoid edge cases like nested iframes
857
+ pointerEvents: n !== null ? "none" : void 0
858
+ };
859
+ }
860
+ function nt(e, n = 10) {
861
+ let t = null;
862
+ return (...i) => {
863
+ t !== null && clearTimeout(t), t = setTimeout(() => {
864
+ e(...i);
865
+ }, n);
866
+ };
867
+ }
868
+ function Ye(e) {
869
+ try {
870
+ if (typeof localStorage < "u")
871
+ e.getItem = (n) => localStorage.getItem(n), e.setItem = (n, t) => {
872
+ localStorage.setItem(n, t);
873
+ };
874
+ else
875
+ throw new Error("localStorage not supported in this environment");
876
+ } catch (n) {
877
+ console.error(n), e.getItem = () => null, e.setItem = () => {
878
+ };
879
+ }
880
+ }
881
+ function xn(e) {
882
+ return `react-resizable-panels:${e}`;
883
+ }
884
+ function Sn(e) {
885
+ return e.map((n) => {
886
+ const {
887
+ constraints: t,
888
+ id: r,
889
+ idIsFromProps: i,
890
+ order: o
891
+ } = n;
892
+ return i ? r : o ? `${o}:${JSON.stringify(t)}` : JSON.stringify(t);
893
+ }).sort((n, t) => n.localeCompare(t)).join(",");
894
+ }
895
+ function bn(e, n) {
896
+ try {
897
+ const t = xn(e), r = n.getItem(t);
898
+ if (r) {
899
+ const i = JSON.parse(r);
900
+ if (typeof i == "object" && i != null)
901
+ return i;
902
+ }
903
+ } catch {
904
+ }
905
+ return null;
906
+ }
907
+ function tt(e, n, t) {
908
+ var r, i;
909
+ const o = (r = bn(e, t)) !== null && r !== void 0 ? r : {}, l = Sn(n);
910
+ return (i = o[l]) !== null && i !== void 0 ? i : null;
911
+ }
912
+ function rt(e, n, t, r, i) {
913
+ var o;
914
+ const l = xn(e), a = Sn(n), s = (o = bn(e, i)) !== null && o !== void 0 ? o : {};
915
+ s[a] = {
916
+ expandToSizes: Object.fromEntries(t.entries()),
917
+ layout: r
918
+ };
919
+ try {
920
+ i.setItem(l, JSON.stringify(s));
921
+ } catch (m) {
922
+ console.error(m);
923
+ }
924
+ }
925
+ function Ze({
926
+ layout: e,
927
+ panelConstraints: n
928
+ }) {
929
+ const t = [...e], r = t.reduce((o, l) => o + l, 0);
930
+ if (t.length !== n.length)
931
+ throw Error(`Invalid ${n.length} panel layout: ${t.map((o) => `${o}%`).join(", ")}`);
932
+ if (!W(r, 100) && t.length > 0)
933
+ for (let o = 0; o < n.length; o++) {
934
+ const l = t[o];
935
+ y(l != null, `No layout data found for index ${o}`);
936
+ const a = 100 / r * l;
937
+ t[o] = a;
938
+ }
939
+ let i = 0;
940
+ for (let o = 0; o < n.length; o++) {
941
+ const l = t[o];
942
+ y(l != null, `No layout data found for index ${o}`);
943
+ const a = se({
944
+ panelConstraints: n,
945
+ panelIndex: o,
946
+ size: l
947
+ });
948
+ l != a && (i += l - a, t[o] = a);
949
+ }
950
+ if (!W(i, 0))
951
+ for (let o = 0; o < n.length; o++) {
952
+ const l = t[o];
953
+ y(l != null, `No layout data found for index ${o}`);
954
+ const a = l + i, s = se({
955
+ panelConstraints: n,
956
+ panelIndex: o,
957
+ size: a
958
+ });
959
+ if (l !== s && (i -= s - l, t[o] = s, W(i, 0)))
960
+ break;
961
+ }
962
+ return t;
963
+ }
964
+ const ot = 100, ve = {
965
+ getItem: (e) => (Ye(ve), ve.getItem(e)),
966
+ setItem: (e, n) => {
967
+ Ye(ve), ve.setItem(e, n);
968
+ }
969
+ }, Qe = {};
970
+ function Pn({
971
+ autoSaveId: e = null,
972
+ children: n,
973
+ className: t = "",
974
+ direction: r,
975
+ forwardedRef: i,
976
+ id: o = null,
977
+ onLayout: l = null,
978
+ keyboardResizeBy: a = null,
979
+ storage: s = ve,
980
+ style: m,
981
+ tagName: P = "div",
982
+ ...f
983
+ }) {
984
+ const u = Fe(o), v = F(null), [h, I] = ue(null), [w, S] = ue([]), R = On(), M = F({}), N = F(/* @__PURE__ */ new Map()), q = F(0), C = F({
985
+ autoSaveId: e,
986
+ direction: r,
987
+ dragState: h,
988
+ id: u,
989
+ keyboardResizeBy: a,
990
+ onLayout: l,
991
+ storage: s
992
+ }), b = F({
993
+ layout: w,
994
+ panelDataArray: [],
995
+ panelDataArrayChanged: !1
996
+ });
997
+ F({
998
+ didLogIdAndOrderWarning: !1,
999
+ didLogPanelConstraintsWarning: !1,
1000
+ prevPanelIds: []
1001
+ }), tn(i, () => ({
1002
+ getId: () => C.current.id,
1003
+ getLayout: () => {
1004
+ const {
1005
+ layout: c
1006
+ } = b.current;
1007
+ return c;
1008
+ },
1009
+ setLayout: (c) => {
1010
+ const {
1011
+ onLayout: g
1012
+ } = C.current, {
1013
+ layout: x,
1014
+ panelDataArray: p
1015
+ } = b.current, d = Ze({
1016
+ layout: c,
1017
+ panelConstraints: p.map((z) => z.constraints)
1018
+ });
1019
+ Je(x, d) || (S(d), b.current.layout = d, g && g(d), le(p, d, M.current));
1020
+ }
1021
+ }), []), re(() => {
1022
+ C.current.autoSaveId = e, C.current.direction = r, C.current.dragState = h, C.current.id = u, C.current.onLayout = l, C.current.storage = s;
1023
+ }), Jn({
1024
+ committedValuesRef: C,
1025
+ eagerValuesRef: b,
1026
+ groupId: u,
1027
+ layout: w,
1028
+ panelDataArray: b.current.panelDataArray,
1029
+ setLayout: S,
1030
+ panelGroupElement: v.current
1031
+ }), te(() => {
1032
+ const {
1033
+ panelDataArray: c
1034
+ } = b.current;
1035
+ if (e) {
1036
+ if (w.length === 0 || w.length !== c.length)
1037
+ return;
1038
+ let g = Qe[e];
1039
+ g == null && (g = nt(rt, ot), Qe[e] = g);
1040
+ const x = [...c], p = new Map(N.current);
1041
+ g(e, x, p, w, s);
1042
+ }
1043
+ }, [e, w, s]), te(() => {
1044
+ });
1045
+ const K = T((c) => {
1046
+ const {
1047
+ onLayout: g
1048
+ } = C.current, {
1049
+ layout: x,
1050
+ panelDataArray: p
1051
+ } = b.current;
1052
+ if (c.constraints.collapsible) {
1053
+ const d = p.map((X) => X.constraints), {
1054
+ collapsedSize: z = 0,
1055
+ panelSize: E,
1056
+ pivotIndices: H
1057
+ } = ee(p, c, x);
1058
+ if (y(E != null, `Panel size not found for panel "${c.id}"`), !Y(E, z)) {
1059
+ N.current.set(c.id, E);
1060
+ const j = ae(p, c) === p.length - 1 ? E - z : z - E, L = ye({
1061
+ delta: j,
1062
+ initialLayout: x,
1063
+ panelConstraints: d,
1064
+ pivotIndices: H,
1065
+ prevLayout: x,
1066
+ trigger: "imperative-api"
1067
+ });
1068
+ Pe(x, L) || (S(L), b.current.layout = L, g && g(L), le(p, L, M.current));
1069
+ }
1070
+ }
1071
+ }, []), J = T((c, g) => {
1072
+ const {
1073
+ onLayout: x
1074
+ } = C.current, {
1075
+ layout: p,
1076
+ panelDataArray: d
1077
+ } = b.current;
1078
+ if (c.constraints.collapsible) {
1079
+ const z = d.map((U) => U.constraints), {
1080
+ collapsedSize: E = 0,
1081
+ panelSize: H = 0,
1082
+ minSize: X = 0,
1083
+ pivotIndices: j
1084
+ } = ee(d, c, p), L = g ?? X;
1085
+ if (Y(H, E)) {
1086
+ const U = N.current.get(c.id), he = U != null && U >= L ? U : L, He = ae(d, c) === d.length - 1 ? H - he : he - H, B = ye({
1087
+ delta: He,
1088
+ initialLayout: p,
1089
+ panelConstraints: z,
1090
+ pivotIndices: j,
1091
+ prevLayout: p,
1092
+ trigger: "imperative-api"
1093
+ });
1094
+ Pe(p, B) || (S(B), b.current.layout = B, x && x(B), le(d, B, M.current));
1095
+ }
1096
+ }
1097
+ }, []), V = T((c) => {
1098
+ const {
1099
+ layout: g,
1100
+ panelDataArray: x
1101
+ } = b.current, {
1102
+ panelSize: p
1103
+ } = ee(x, c, g);
1104
+ return y(p != null, `Panel size not found for panel "${c.id}"`), p;
1105
+ }, []), _ = T((c, g) => {
1106
+ const {
1107
+ panelDataArray: x
1108
+ } = b.current, p = ae(x, c);
1109
+ return et({
1110
+ defaultSize: g,
1111
+ dragState: h,
1112
+ layout: w,
1113
+ panelData: x,
1114
+ panelIndex: p
1115
+ });
1116
+ }, [h, w]), D = T((c) => {
1117
+ const {
1118
+ layout: g,
1119
+ panelDataArray: x
1120
+ } = b.current, {
1121
+ collapsedSize: p = 0,
1122
+ collapsible: d,
1123
+ panelSize: z
1124
+ } = ee(x, c, g);
1125
+ return y(z != null, `Panel size not found for panel "${c.id}"`), d === !0 && Y(z, p);
1126
+ }, []), Q = T((c) => {
1127
+ const {
1128
+ layout: g,
1129
+ panelDataArray: x
1130
+ } = b.current, {
1131
+ collapsedSize: p = 0,
1132
+ collapsible: d,
1133
+ panelSize: z
1134
+ } = ee(x, c, g);
1135
+ return y(z != null, `Panel size not found for panel "${c.id}"`), !d || oe(z, p) > 0;
1136
+ }, []), k = T((c) => {
1137
+ const {
1138
+ panelDataArray: g
1139
+ } = b.current;
1140
+ g.push(c), g.sort((x, p) => {
1141
+ const d = x.order, z = p.order;
1142
+ return d == null && z == null ? 0 : d == null ? -1 : z == null ? 1 : d - z;
1143
+ }), b.current.panelDataArrayChanged = !0, R();
1144
+ }, [R]);
1145
+ re(() => {
1146
+ if (b.current.panelDataArrayChanged) {
1147
+ b.current.panelDataArrayChanged = !1;
1148
+ const {
1149
+ autoSaveId: c,
1150
+ onLayout: g,
1151
+ storage: x
1152
+ } = C.current, {
1153
+ layout: p,
1154
+ panelDataArray: d
1155
+ } = b.current;
1156
+ let z = null;
1157
+ if (c) {
1158
+ const H = tt(c, d, x);
1159
+ H && (N.current = new Map(Object.entries(H.expandToSizes)), z = H.layout);
1160
+ }
1161
+ z == null && (z = Qn({
1162
+ panelDataArray: d
1163
+ }));
1164
+ const E = Ze({
1165
+ layout: z,
1166
+ panelConstraints: d.map((H) => H.constraints)
1167
+ });
1168
+ Je(p, E) || (S(E), b.current.layout = E, g && g(E), le(d, E, M.current));
1169
+ }
1170
+ }), re(() => {
1171
+ const c = b.current;
1172
+ return () => {
1173
+ c.layout = [];
1174
+ };
1175
+ }, []);
1176
+ const $ = T((c) => {
1177
+ let g = !1;
1178
+ const x = v.current;
1179
+ return x && window.getComputedStyle(x, null).getPropertyValue("direction") === "rtl" && (g = !0), function(d) {
1180
+ d.preventDefault();
1181
+ const z = v.current;
1182
+ if (!z)
1183
+ return () => null;
1184
+ const {
1185
+ direction: E,
1186
+ dragState: H,
1187
+ id: X,
1188
+ keyboardResizeBy: j,
1189
+ onLayout: L
1190
+ } = C.current, {
1191
+ layout: U,
1192
+ panelDataArray: he
1193
+ } = b.current, {
1194
+ initialLayout: be
1195
+ } = H ?? {}, He = zn(X, c, z);
1196
+ let B = Zn(d, c, E, H, j, z);
1197
+ const Ke = E === "horizontal";
1198
+ Ke && g && (B = -B);
1199
+ const En = he.map((Cn) => Cn.constraints), ze = ye({
1200
+ delta: B,
1201
+ initialLayout: be ?? U,
1202
+ panelConstraints: En,
1203
+ pivotIndices: He,
1204
+ prevLayout: U,
1205
+ trigger: an(d) ? "keyboard" : "mouse-or-touch"
1206
+ }), Ue = !Pe(U, ze);
1207
+ (sn(d) || un(d)) && q.current != B && (q.current = B, !Ue && B !== 0 ? Ke ? _e(c, B < 0 ? dn : fn) : _e(c, B < 0 ? pn : gn) : _e(c, 0)), Ue && (S(ze), b.current.layout = ze, L && L(ze), le(he, ze, M.current));
1208
+ };
1209
+ }, []), G = T((c, g) => {
1210
+ const {
1211
+ onLayout: x
1212
+ } = C.current, {
1213
+ layout: p,
1214
+ panelDataArray: d
1215
+ } = b.current, z = d.map((U) => U.constraints), {
1216
+ panelSize: E,
1217
+ pivotIndices: H
1218
+ } = ee(d, c, p);
1219
+ y(E != null, `Panel size not found for panel "${c.id}"`);
1220
+ const j = ae(d, c) === d.length - 1 ? E - g : g - E, L = ye({
1221
+ delta: j,
1222
+ initialLayout: p,
1223
+ panelConstraints: z,
1224
+ pivotIndices: H,
1225
+ prevLayout: p,
1226
+ trigger: "imperative-api"
1227
+ });
1228
+ Pe(p, L) || (S(L), b.current.layout = L, x && x(L), le(d, L, M.current));
1229
+ }, []), fe = T((c, g) => {
1230
+ const {
1231
+ layout: x,
1232
+ panelDataArray: p
1233
+ } = b.current, {
1234
+ collapsedSize: d = 0,
1235
+ collapsible: z
1236
+ } = g, {
1237
+ collapsedSize: E = 0,
1238
+ collapsible: H,
1239
+ maxSize: X = 100,
1240
+ minSize: j = 0
1241
+ } = c.constraints, {
1242
+ panelSize: L
1243
+ } = ee(p, c, x);
1244
+ L != null && (z && H && Y(L, d) ? Y(d, E) || G(c, E) : L < j ? G(c, j) : L > X && G(c, X));
1245
+ }, [G]), pe = T((c, g) => {
1246
+ const {
1247
+ direction: x
1248
+ } = C.current, {
1249
+ layout: p
1250
+ } = b.current;
1251
+ if (!v.current)
1252
+ return;
1253
+ const d = De(c, v.current);
1254
+ y(d, `Drag handle element not found for id "${c}"`);
1255
+ const z = vn(x, g);
1256
+ I({
1257
+ dragHandleId: c,
1258
+ dragHandleRect: d.getBoundingClientRect(),
1259
+ initialCursorPosition: z,
1260
+ initialLayout: p
1261
+ });
1262
+ }, []), ge = T(() => {
1263
+ I(null);
1264
+ }, []), Me = T((c) => {
1265
+ const {
1266
+ panelDataArray: g
1267
+ } = b.current, x = ae(g, c);
1268
+ x >= 0 && (g.splice(x, 1), delete M.current[c.id], b.current.panelDataArrayChanged = !0, R());
1269
+ }, [R]), ie = Dn(() => ({
1270
+ collapsePanel: K,
1271
+ direction: r,
1272
+ dragState: h,
1273
+ expandPanel: J,
1274
+ getPanelSize: V,
1275
+ getPanelStyle: _,
1276
+ groupId: u,
1277
+ isPanelCollapsed: D,
1278
+ isPanelExpanded: Q,
1279
+ reevaluatePanelConstraints: fe,
1280
+ registerPanel: k,
1281
+ registerResizeHandle: $,
1282
+ resizePanel: G,
1283
+ startDragging: pe,
1284
+ stopDragging: ge,
1285
+ unregisterPanel: Me,
1286
+ panelGroupElement: v.current
1287
+ }), [K, h, r, J, V, _, u, D, Q, fe, k, $, G, pe, ge, Me]), me = {
1288
+ display: "flex",
1289
+ flexDirection: r === "horizontal" ? "row" : "column",
1290
+ height: "100%",
1291
+ overflow: "hidden",
1292
+ width: "100%"
1293
+ };
1294
+ return de(Re.Provider, {
1295
+ value: ie
1296
+ }, de(P, {
1297
+ ...f,
1298
+ children: n,
1299
+ className: t,
1300
+ id: o,
1301
+ ref: v,
1302
+ style: {
1303
+ ...me,
1304
+ ...m
1305
+ },
1306
+ // CSS selectors
1307
+ [A.group]: "",
1308
+ [A.groupDirection]: r,
1309
+ [A.groupId]: u
1310
+ }));
1311
+ }
1312
+ const wn = en((e, n) => de(Pn, {
1313
+ ...e,
1314
+ forwardedRef: n
1315
+ }));
1316
+ Pn.displayName = "PanelGroup";
1317
+ wn.displayName = "forwardRef(PanelGroup)";
1318
+ function ae(e, n) {
1319
+ return e.findIndex((t) => t === n || t.id === n.id);
1320
+ }
1321
+ function ee(e, n, t) {
1322
+ const r = ae(e, n), o = r === e.length - 1 ? [r - 1, r] : [r, r + 1], l = t[r];
1323
+ return {
1324
+ ...n.constraints,
1325
+ panelSize: l,
1326
+ pivotIndices: o
1327
+ };
1328
+ }
1329
+ function it({
1330
+ disabled: e,
1331
+ handleId: n,
1332
+ resizeHandler: t,
1333
+ panelGroupElement: r
1334
+ }) {
1335
+ te(() => {
1336
+ if (e || t == null || r == null)
1337
+ return;
1338
+ const i = De(n, r);
1339
+ if (i == null)
1340
+ return;
1341
+ const o = (l) => {
1342
+ if (!l.defaultPrevented)
1343
+ switch (l.key) {
1344
+ case "ArrowDown":
1345
+ case "ArrowLeft":
1346
+ case "ArrowRight":
1347
+ case "ArrowUp":
1348
+ case "End":
1349
+ case "Home": {
1350
+ l.preventDefault(), t(l);
1351
+ break;
1352
+ }
1353
+ case "F6": {
1354
+ l.preventDefault();
1355
+ const a = i.getAttribute(A.groupId);
1356
+ y(a, `No group element found for id "${a}"`);
1357
+ const s = Se(a, r), m = hn(a, n, r);
1358
+ y(m !== null, `No resize element found for id "${n}"`);
1359
+ const P = l.shiftKey ? m > 0 ? m - 1 : s.length - 1 : m + 1 < s.length ? m + 1 : 0;
1360
+ s[P].focus();
1361
+ break;
1362
+ }
1363
+ }
1364
+ };
1365
+ return i.addEventListener("keydown", o), () => {
1366
+ i.removeEventListener("keydown", o);
1367
+ };
1368
+ }, [r, e, n, t]);
1369
+ }
1370
+ function In({
1371
+ children: e = null,
1372
+ className: n = "",
1373
+ disabled: t = !1,
1374
+ hitAreaMargins: r,
1375
+ id: i,
1376
+ onBlur: o,
1377
+ onClick: l,
1378
+ onDragging: a,
1379
+ onFocus: s,
1380
+ onPointerDown: m,
1381
+ onPointerUp: P,
1382
+ style: f = {},
1383
+ tabIndex: u = 0,
1384
+ tagName: v = "div",
1385
+ ...h
1386
+ }) {
1387
+ var I, w;
1388
+ const S = F(null), R = F({
1389
+ onClick: l,
1390
+ onDragging: a,
1391
+ onPointerDown: m,
1392
+ onPointerUp: P
1393
+ });
1394
+ te(() => {
1395
+ R.current.onClick = l, R.current.onDragging = a, R.current.onPointerDown = m, R.current.onPointerUp = P;
1396
+ });
1397
+ const M = nn(Re);
1398
+ if (M === null)
1399
+ throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");
1400
+ const {
1401
+ direction: N,
1402
+ groupId: q,
1403
+ registerResizeHandle: C,
1404
+ startDragging: b,
1405
+ stopDragging: K,
1406
+ panelGroupElement: J
1407
+ } = M, V = Fe(i), [_, D] = ue("inactive"), [Q, k] = ue(!1), [$, G] = ue(null), fe = F({
1408
+ state: _
1409
+ });
1410
+ re(() => {
1411
+ fe.current.state = _;
1412
+ }), te(() => {
1413
+ if (t)
1414
+ G(null);
1415
+ else {
1416
+ const ie = C(V);
1417
+ G(() => ie);
1418
+ }
1419
+ }, [t, V, C]);
1420
+ const pe = (I = r?.coarse) !== null && I !== void 0 ? I : 15, ge = (w = r?.fine) !== null && w !== void 0 ? w : 5;
1421
+ return te(() => {
1422
+ if (t || $ == null)
1423
+ return;
1424
+ const ie = S.current;
1425
+ y(ie, "Element ref not attached");
1426
+ let me = !1;
1427
+ return Kn(V, ie, N, {
1428
+ coarse: pe,
1429
+ fine: ge
1430
+ }, (g, x, p) => {
1431
+ if (!x) {
1432
+ D("inactive");
1433
+ return;
1434
+ }
1435
+ switch (g) {
1436
+ case "down": {
1437
+ D("drag"), me = !1, y(p, 'Expected event to be defined for "down" action'), b(V, p);
1438
+ const {
1439
+ onDragging: d,
1440
+ onPointerDown: z
1441
+ } = R.current;
1442
+ d?.(!0), z?.();
1443
+ break;
1444
+ }
1445
+ case "move": {
1446
+ const {
1447
+ state: d
1448
+ } = fe.current;
1449
+ me = !0, d !== "drag" && D("hover"), y(p, 'Expected event to be defined for "move" action'), $(p);
1450
+ break;
1451
+ }
1452
+ case "up": {
1453
+ D("hover"), K();
1454
+ const {
1455
+ onClick: d,
1456
+ onDragging: z,
1457
+ onPointerUp: E
1458
+ } = R.current;
1459
+ z?.(!1), E?.(), me || d?.();
1460
+ break;
1461
+ }
1462
+ }
1463
+ });
1464
+ }, [pe, N, t, ge, C, V, $, b, K]), it({
1465
+ disabled: t,
1466
+ handleId: V,
1467
+ resizeHandler: $,
1468
+ panelGroupElement: J
1469
+ }), de(v, {
1470
+ ...h,
1471
+ children: e,
1472
+ className: n,
1473
+ id: i,
1474
+ onBlur: () => {
1475
+ k(!1), o?.();
1476
+ },
1477
+ onFocus: () => {
1478
+ k(!0), s?.();
1479
+ },
1480
+ ref: S,
1481
+ role: "separator",
1482
+ style: {
1483
+ ...{
1484
+ touchAction: "none",
1485
+ userSelect: "none"
1486
+ },
1487
+ ...f
1488
+ },
1489
+ tabIndex: u,
1490
+ // CSS selectors
1491
+ [A.groupDirection]: N,
1492
+ [A.groupId]: q,
1493
+ [A.resizeHandle]: "",
1494
+ [A.resizeHandleActive]: _ === "drag" ? "pointer" : Q ? "keyboard" : void 0,
1495
+ [A.resizeHandleEnabled]: !t,
1496
+ [A.resizeHandleId]: V,
1497
+ [A.resizeHandleState]: _
1498
+ });
1499
+ }
1500
+ In.displayName = "PanelResizeHandle";
1501
+ const ct = ({
1502
+ className: e,
1503
+ ...n
1504
+ }) => /* @__PURE__ */ we(
1505
+ wn,
1506
+ {
1507
+ className: rn(
1508
+ "flex h-full w-full data-[panel-group-direction=vertical]:flex-col",
1509
+ e
1510
+ ),
1511
+ ...n
1512
+ }
1513
+ ), dt = ln, ft = ({
1514
+ withHandle: e,
1515
+ className: n,
1516
+ ...t
1517
+ }) => /* @__PURE__ */ we(
1518
+ In,
1519
+ {
1520
+ className: rn(
1521
+ "relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",
1522
+ n
1523
+ ),
1524
+ ...t,
1525
+ children: e && /* @__PURE__ */ we("div", { className: "z-10 flex h-4 w-3 items-center justify-center rounded-sm border border-border bg-card", children: /* @__PURE__ */ we(Rn, { className: "h-2.5 w-2.5 text-muted-foreground" }) })
1526
+ }
1527
+ );
1528
+ export {
1529
+ ft as ResizableHandle,
1530
+ dt as ResizablePanel,
1531
+ ct as ResizablePanelGroup
1532
+ };