ics-ui-kit 0.1.20 → 0.1.21

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