react-semaphor 0.1.534 → 0.1.535

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 (42) hide show
  1. package/dist/brand-studio/index.js +25 -25
  2. package/dist/briefings/index.js +1 -1
  3. package/dist/chunks/{calculated-field-identity-Cz1ZU_UL.js → calculated-field-identity-BptYhyOP.js} +4 -4
  4. package/dist/chunks/{card-config-utils-BlIiFn0O.js → card-config-utils-C-QfuqEy.js} +50 -51
  5. package/dist/chunks/{dashboard-CCK80YKL.js → dashboard-B7y_WeF2.js} +1 -1
  6. package/dist/chunks/dashboard-briefing-launcher-DwSxDtgZ.js +4224 -0
  7. package/dist/chunks/{dashboard-controls-CoiTGnEr.js → dashboard-controls-CzTh9J0s.js} +862 -873
  8. package/dist/chunks/{dashboard-json-BRGozO--.js → dashboard-json-o6tOjNhH.js} +1 -1
  9. package/dist/chunks/{edit-dashboard-visual-CZFnhGZQ.js → edit-dashboard-visual-Lp_iKRGH.js} +8983 -8749
  10. package/dist/chunks/{index-BQl5rC54.js → index-P5aUuGF1.js} +1 -1
  11. package/dist/chunks/{matrix-control-sources-Tls-h3AN.js → matrix-control-sources-DTqcA2_L.js} +1 -1
  12. package/dist/chunks/report-preferences-dialog-BaUr346O.js +1623 -0
  13. package/dist/chunks/{layout-grid-CiubineE.js → save-kO6cIaob.js} +20 -2
  14. package/dist/chunks/{semaphor-ready-indicator-z4SNdxiC.js → semaphor-ready-indicator-B017OW6t.js} +61957 -76531
  15. package/dist/chunks/slider-CrLoCpsr.js +2383 -0
  16. package/dist/chunks/{switch-BR3Xgbqr.js → switch-ojmMsFMO.js} +4355 -4779
  17. package/dist/chunks/upload-CAIpsti1.js +15 -0
  18. package/dist/chunks/use-create-flow-overlay-state-BbwQ0gpQ.js +1457 -0
  19. package/dist/dashboard/index.js +1 -1
  20. package/dist/dashboard-authoring/index.js +4 -4
  21. package/dist/index.js +221 -220
  22. package/dist/style.css +1 -1
  23. package/dist/surfboard/index.js +1 -1
  24. package/dist/types/components/surfboard/controls/dashboard-filter-controls-launcher.d.ts +0 -1
  25. package/dist/types/lib/hooks/use-dashboard-query.d.ts +0 -2
  26. package/dist/types/lib/hooks/use-dashboard.d.ts +0 -1
  27. package/dist/types/lib/stores/dashboard-store.d.ts +1 -11
  28. package/dist/types/lib/stores/editor-store.d.ts +1 -10
  29. package/dist/types/lib/types/ai-context-types.d.ts +20 -0
  30. package/dist/types/lib/types/common-types.d.ts +1 -20
  31. package/dist/types/lib/types/token-types.d.ts +0 -7
  32. package/dist/types/lib/utils.d.ts +0 -2
  33. package/package.json +1 -7
  34. package/dist/chunks/dashboard-briefing-launcher-B9Fq2Rf3.js +0 -3489
  35. package/dist/chunks/editor-action-buttons-CVtSO3I3.js +0 -2067
  36. package/dist/chunks/report-preferences-dialog-CWdTlWsr.js +0 -1231
  37. package/dist/chunks/save-DgMfP0j8.js +0 -21
  38. package/dist/chunks/slider-DbwmuVB-.js +0 -875
  39. package/dist/dashboard-assistant/index.js +0 -11
  40. package/dist/types/dashboard-assistant/index.d.ts +0 -80
  41. package/dist/types/dashboard-assistant.d.ts +0 -2
  42. package/dist/types/lib/types/assistant-types.d.ts +0 -127
@@ -0,0 +1,2383 @@
1
+ import { jsxs as De, jsx as _, Fragment as dt } from "react/jsx-runtime";
2
+ import * as k from "react";
3
+ import Sn, { forwardRef as $e, createElement as be, useContext as xt, createContext as xn, useRef as B, useLayoutEffect as bn, useImperativeHandle as bt, useEffect as Z, useState as ue, useCallback as O, useMemo as U, memo as zn, Suspense as Pn } from "react";
4
+ import { aF as wn, aG as zt, aH as nt, aI as Pt, aJ as Cn, aK as En, aL as In, aM as Rn, aN as Dn, aO as An, aP as Mn, aQ as Ln, aR as Nn, aS as _n, aT as kn, aU as Tn } from "./semaphor-ready-indicator-B017OW6t.js";
5
+ import { a1 as te, a2 as wt, C as Ct, ax as Hn, c as rt, ay as $n, u as Oe, az as Et, aA as ze, aB as pe, aC as Vn, aD as Fn, aE as Kn, aF as Pe, aG as Bn, aH as It, aI as qn, aJ as Gn } from "./switch-ojmMsFMO.js";
6
+ import { f as On, r as Rt } from "./use-create-flow-overlay-state-BbwQ0gpQ.js";
7
+ import { f as Un, r as Dt, g as At, a as Qe, b as _e, n as Wn, c as Xn } from "./index-P5aUuGF1.js";
8
+ import "./x-CXDkqdur.js";
9
+ import "./validators-DMSH81OM.js";
10
+ import "./matrix-operation-contract-BKupLHXL.js";
11
+ import "zod";
12
+ import "../value-format-preferences/index.js";
13
+ import { u as Yn } from "./appearance-context-DEYtWinQ.js";
14
+ const fo = Sn.memo(function({
15
+ context: t = "editor"
16
+ } = {}) {
17
+ return /* @__PURE__ */ De(
18
+ "div",
19
+ {
20
+ "data-content": "fields-section",
21
+ className: "flex h-full grow flex-col items-center overflow-hidden",
22
+ children: [
23
+ " ",
24
+ /* @__PURE__ */ _(wn, { context: t }),
25
+ " "
26
+ ]
27
+ }
28
+ );
29
+ }), Ve = xn(null);
30
+ Ve.displayName = "PanelGroupContext";
31
+ const K = {
32
+ group: "data-panel-group",
33
+ groupDirection: "data-panel-group-direction",
34
+ groupId: "data-panel-group-id",
35
+ panel: "data-panel",
36
+ panelCollapsible: "data-panel-collapsible",
37
+ panelId: "data-panel-id",
38
+ panelSize: "data-panel-size",
39
+ resizeHandle: "data-resize-handle",
40
+ resizeHandleActive: "data-resize-handle-active",
41
+ resizeHandleEnabled: "data-panel-resize-handle-enabled",
42
+ resizeHandleId: "data-panel-resize-handle-id",
43
+ resizeHandleState: "data-resize-handle-state"
44
+ }, ot = 10, me = bn, ft = k.useId, jn = typeof ft == "function" ? ft : () => null;
45
+ let Qn = 0;
46
+ function it(e = null) {
47
+ const t = jn(), n = B(e || t || null);
48
+ return n.current === null && (n.current = "" + Qn++), e ?? n.current;
49
+ }
50
+ function Mt({
51
+ children: e,
52
+ className: t = "",
53
+ collapsedSize: n,
54
+ collapsible: r,
55
+ defaultSize: i,
56
+ forwardedRef: o,
57
+ id: s,
58
+ maxSize: a,
59
+ minSize: l,
60
+ onCollapse: f,
61
+ onExpand: p,
62
+ onResize: u,
63
+ order: c,
64
+ style: h,
65
+ tagName: m = "div",
66
+ ...y
67
+ }) {
68
+ const S = xt(Ve);
69
+ if (S === null)
70
+ throw Error("Panel components must be rendered within a PanelGroup container");
71
+ const {
72
+ collapsePanel: v,
73
+ expandPanel: D,
74
+ getPanelSize: b,
75
+ getPanelStyle: I,
76
+ groupId: R,
77
+ isPanelCollapsed: M,
78
+ reevaluatePanelConstraints: w,
79
+ registerPanel: X,
80
+ resizePanel: j,
81
+ unregisterPanel: $
82
+ } = S, A = it(s), L = B({
83
+ callbacks: {
84
+ onCollapse: f,
85
+ onExpand: p,
86
+ onResize: u
87
+ },
88
+ constraints: {
89
+ collapsedSize: n,
90
+ collapsible: r,
91
+ defaultSize: i,
92
+ maxSize: a,
93
+ minSize: l
94
+ },
95
+ id: A,
96
+ idIsFromProps: s !== void 0,
97
+ order: c
98
+ });
99
+ B({
100
+ didLogMissingDefaultSizeWarning: !1
101
+ }), me(() => {
102
+ const {
103
+ callbacks: V,
104
+ constraints: T
105
+ } = L.current, H = {
106
+ ...T
107
+ };
108
+ L.current.id = A, L.current.idIsFromProps = s !== void 0, L.current.order = c, V.onCollapse = f, V.onExpand = p, V.onResize = u, T.collapsedSize = n, T.collapsible = r, T.defaultSize = i, T.maxSize = a, T.minSize = l, (H.collapsedSize !== T.collapsedSize || H.collapsible !== T.collapsible || H.maxSize !== T.maxSize || H.minSize !== T.minSize) && w(L.current, H);
109
+ }), me(() => {
110
+ const V = L.current;
111
+ return X(V), () => {
112
+ $(V);
113
+ };
114
+ }, [c, A, X, $]), bt(o, () => ({
115
+ collapse: () => {
116
+ v(L.current);
117
+ },
118
+ expand: (V) => {
119
+ D(L.current, V);
120
+ },
121
+ getId() {
122
+ return A;
123
+ },
124
+ getSize() {
125
+ return b(L.current);
126
+ },
127
+ isCollapsed() {
128
+ return M(L.current);
129
+ },
130
+ isExpanded() {
131
+ return !M(L.current);
132
+ },
133
+ resize: (V) => {
134
+ j(L.current, V);
135
+ }
136
+ }), [v, D, b, M, A, j]);
137
+ const W = I(L.current, i);
138
+ return be(m, {
139
+ ...y,
140
+ children: e,
141
+ className: t,
142
+ id: A,
143
+ style: {
144
+ ...W,
145
+ ...h
146
+ },
147
+ // CSS selectors
148
+ [K.groupId]: R,
149
+ [K.panel]: "",
150
+ [K.panelCollapsible]: r || void 0,
151
+ [K.panelId]: A,
152
+ [K.panelSize]: parseFloat("" + W.flexGrow).toFixed(1)
153
+ });
154
+ }
155
+ const Jn = $e((e, t) => be(Mt, {
156
+ ...e,
157
+ forwardedRef: t
158
+ }));
159
+ Mt.displayName = "Panel";
160
+ Jn.displayName = "forwardRef(Panel)";
161
+ let Je = null, ke = -1, ce = null;
162
+ function Zn(e, t) {
163
+ if (t) {
164
+ const n = (t & Tt) !== 0, r = (t & Ht) !== 0, i = (t & $t) !== 0, o = (t & Vt) !== 0;
165
+ if (n)
166
+ return i ? "se-resize" : o ? "ne-resize" : "e-resize";
167
+ if (r)
168
+ return i ? "sw-resize" : o ? "nw-resize" : "w-resize";
169
+ if (i)
170
+ return "s-resize";
171
+ if (o)
172
+ return "n-resize";
173
+ }
174
+ switch (e) {
175
+ case "horizontal":
176
+ return "ew-resize";
177
+ case "intersection":
178
+ return "move";
179
+ case "vertical":
180
+ return "ns-resize";
181
+ }
182
+ }
183
+ function er() {
184
+ ce !== null && (document.head.removeChild(ce), Je = null, ce = null, ke = -1);
185
+ }
186
+ function Ue(e, t) {
187
+ var n, r;
188
+ const i = Zn(e, t);
189
+ if (Je !== i) {
190
+ if (Je = i, ce === null && (ce = document.createElement("style"), document.head.appendChild(ce)), ke >= 0) {
191
+ var o;
192
+ (o = ce.sheet) === null || o === void 0 || o.removeRule(ke);
193
+ }
194
+ ke = (n = (r = ce.sheet) === null || r === void 0 ? void 0 : r.insertRule(`*{cursor: ${i} !important;}`)) !== null && n !== void 0 ? n : -1;
195
+ }
196
+ }
197
+ function Lt(e) {
198
+ return e.type === "keydown";
199
+ }
200
+ function Nt(e) {
201
+ return e.type.startsWith("pointer");
202
+ }
203
+ function _t(e) {
204
+ return e.type.startsWith("mouse");
205
+ }
206
+ function Fe(e) {
207
+ if (Nt(e)) {
208
+ if (e.isPrimary)
209
+ return {
210
+ x: e.clientX,
211
+ y: e.clientY
212
+ };
213
+ } else if (_t(e))
214
+ return {
215
+ x: e.clientX,
216
+ y: e.clientY
217
+ };
218
+ return {
219
+ x: 1 / 0,
220
+ y: 1 / 0
221
+ };
222
+ }
223
+ function tr() {
224
+ if (typeof matchMedia == "function")
225
+ return matchMedia("(pointer:coarse)").matches ? "coarse" : "fine";
226
+ }
227
+ function nr(e, t, n) {
228
+ return e.x < t.x + t.width && e.x + e.width > t.x && e.y < t.y + t.height && e.y + e.height > t.y;
229
+ }
230
+ function rr(e, t) {
231
+ if (e === t) throw new Error("Cannot compare node with itself");
232
+ const n = {
233
+ a: gt(e),
234
+ b: gt(t)
235
+ };
236
+ let r;
237
+ for (; n.a.at(-1) === n.b.at(-1); )
238
+ e = n.a.pop(), t = n.b.pop(), r = e;
239
+ E(r, "Stacking order can only be calculated for elements with a common ancestor");
240
+ const i = {
241
+ a: mt(pt(n.a)),
242
+ b: mt(pt(n.b))
243
+ };
244
+ if (i.a === i.b) {
245
+ const o = r.childNodes, s = {
246
+ a: n.a.at(-1),
247
+ b: n.b.at(-1)
248
+ };
249
+ let a = o.length;
250
+ for (; a--; ) {
251
+ const l = o[a];
252
+ if (l === s.a) return 1;
253
+ if (l === s.b) return -1;
254
+ }
255
+ }
256
+ return Math.sign(i.a - i.b);
257
+ }
258
+ const or = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
259
+ function ir(e) {
260
+ var t;
261
+ const n = getComputedStyle((t = kt(e)) !== null && t !== void 0 ? t : e).display;
262
+ return n === "flex" || n === "inline-flex";
263
+ }
264
+ function sr(e) {
265
+ const t = getComputedStyle(e);
266
+ return !!(t.position === "fixed" || t.zIndex !== "auto" && (t.position !== "static" || ir(e)) || +t.opacity < 1 || "transform" in t && t.transform !== "none" || "webkitTransform" in t && t.webkitTransform !== "none" || "mixBlendMode" in t && t.mixBlendMode !== "normal" || "filter" in t && t.filter !== "none" || "webkitFilter" in t && t.webkitFilter !== "none" || "isolation" in t && t.isolation === "isolate" || or.test(t.willChange) || t.webkitOverflowScrolling === "touch");
267
+ }
268
+ function pt(e) {
269
+ let t = e.length;
270
+ for (; t--; ) {
271
+ const n = e[t];
272
+ if (E(n, "Missing node"), sr(n)) return n;
273
+ }
274
+ return null;
275
+ }
276
+ function mt(e) {
277
+ return e && Number(getComputedStyle(e).zIndex) || 0;
278
+ }
279
+ function gt(e) {
280
+ const t = [];
281
+ for (; e; )
282
+ t.push(e), e = kt(e);
283
+ return t;
284
+ }
285
+ function kt(e) {
286
+ const {
287
+ parentNode: t
288
+ } = e;
289
+ return t && t instanceof ShadowRoot ? t.host : t;
290
+ }
291
+ const Tt = 1, Ht = 2, $t = 4, Vt = 8, ar = tr() === "coarse";
292
+ let ne = [], xe = !1, fe = /* @__PURE__ */ new Map(), Ke = /* @__PURE__ */ new Map();
293
+ const Ae = /* @__PURE__ */ new Set();
294
+ function lr(e, t, n, r, i) {
295
+ var o;
296
+ const {
297
+ ownerDocument: s
298
+ } = t, a = {
299
+ direction: n,
300
+ element: t,
301
+ hitAreaMargins: r,
302
+ setResizeHandlerState: i
303
+ }, l = (o = fe.get(s)) !== null && o !== void 0 ? o : 0;
304
+ return fe.set(s, l + 1), Ae.add(a), Te(), function() {
305
+ var p;
306
+ Ke.delete(e), Ae.delete(a);
307
+ const u = (p = fe.get(s)) !== null && p !== void 0 ? p : 1;
308
+ if (fe.set(s, u - 1), Te(), u === 1 && fe.delete(s), ne.includes(a)) {
309
+ const c = ne.indexOf(a);
310
+ c >= 0 && ne.splice(c, 1), at(), i("up", !0, null);
311
+ }
312
+ };
313
+ }
314
+ function cr(e) {
315
+ const {
316
+ target: t
317
+ } = e, {
318
+ x: n,
319
+ y: r
320
+ } = Fe(e);
321
+ xe = !0, st({
322
+ target: t,
323
+ x: n,
324
+ y: r
325
+ }), Te(), ne.length > 0 && (He("down", e), e.preventDefault(), Ft(t) || e.stopImmediatePropagation());
326
+ }
327
+ function We(e) {
328
+ const {
329
+ x: t,
330
+ y: n
331
+ } = Fe(e);
332
+ if (xe && e.buttons === 0 && (xe = !1, He("up", e)), !xe) {
333
+ const {
334
+ target: r
335
+ } = e;
336
+ st({
337
+ target: r,
338
+ x: t,
339
+ y: n
340
+ });
341
+ }
342
+ He("move", e), at(), ne.length > 0 && e.preventDefault();
343
+ }
344
+ function Xe(e) {
345
+ const {
346
+ target: t
347
+ } = e, {
348
+ x: n,
349
+ y: r
350
+ } = Fe(e);
351
+ Ke.clear(), xe = !1, ne.length > 0 && (e.preventDefault(), Ft(t) || e.stopImmediatePropagation()), He("up", e), st({
352
+ target: t,
353
+ x: n,
354
+ y: r
355
+ }), at(), Te();
356
+ }
357
+ function Ft(e) {
358
+ let t = e;
359
+ for (; t; ) {
360
+ if (t.hasAttribute(K.resizeHandle))
361
+ return !0;
362
+ t = t.parentElement;
363
+ }
364
+ return !1;
365
+ }
366
+ function st({
367
+ target: e,
368
+ x: t,
369
+ y: n
370
+ }) {
371
+ ne.splice(0);
372
+ let r = null;
373
+ (e instanceof HTMLElement || e instanceof SVGElement) && (r = e), Ae.forEach((i) => {
374
+ const {
375
+ element: o,
376
+ hitAreaMargins: s
377
+ } = i, a = o.getBoundingClientRect(), {
378
+ bottom: l,
379
+ left: f,
380
+ right: p,
381
+ top: u
382
+ } = a, c = ar ? s.coarse : s.fine;
383
+ if (t >= f - c && t <= p + c && n >= u - c && n <= l + c) {
384
+ 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
385
+ // That is why we only check potentially intersecting handles,
386
+ // and why we skip if the event target is within the handle's DOM
387
+ rr(r, o) > 0) {
388
+ let m = r, y = !1;
389
+ for (; m && !m.contains(o); ) {
390
+ if (nr(m.getBoundingClientRect(), a)) {
391
+ y = !0;
392
+ break;
393
+ }
394
+ m = m.parentElement;
395
+ }
396
+ if (y)
397
+ return;
398
+ }
399
+ ne.push(i);
400
+ }
401
+ });
402
+ }
403
+ function Ye(e, t) {
404
+ Ke.set(e, t);
405
+ }
406
+ function at() {
407
+ let e = !1, t = !1;
408
+ ne.forEach((r) => {
409
+ const {
410
+ direction: i
411
+ } = r;
412
+ i === "horizontal" ? e = !0 : t = !0;
413
+ });
414
+ let n = 0;
415
+ Ke.forEach((r) => {
416
+ n |= r;
417
+ }), e && t ? Ue("intersection", n) : e ? Ue("horizontal", n) : t ? Ue("vertical", n) : er();
418
+ }
419
+ let je = new AbortController();
420
+ function Te() {
421
+ je.abort(), je = new AbortController();
422
+ const e = {
423
+ capture: !0,
424
+ signal: je.signal
425
+ };
426
+ Ae.size && (xe ? (ne.length > 0 && fe.forEach((t, n) => {
427
+ const {
428
+ body: r
429
+ } = n;
430
+ t > 0 && (r.addEventListener("contextmenu", Xe, e), r.addEventListener("pointerleave", We, e), r.addEventListener("pointermove", We, e));
431
+ }), window.addEventListener("pointerup", Xe, e), window.addEventListener("pointercancel", Xe, e)) : fe.forEach((t, n) => {
432
+ const {
433
+ body: r
434
+ } = n;
435
+ t > 0 && (r.addEventListener("pointerdown", cr, e), r.addEventListener("pointermove", We, e));
436
+ }));
437
+ }
438
+ function He(e, t) {
439
+ Ae.forEach((n) => {
440
+ const {
441
+ setResizeHandlerState: r
442
+ } = n, i = ne.includes(n);
443
+ r(e, i, t);
444
+ });
445
+ }
446
+ function ur() {
447
+ const [e, t] = ue(0);
448
+ return O(() => t((n) => n + 1), []);
449
+ }
450
+ function E(e, t) {
451
+ if (!e)
452
+ throw console.error(t), Error(t);
453
+ }
454
+ function ge(e, t, n = ot) {
455
+ return e.toFixed(n) === t.toFixed(n) ? 0 : e > t ? 1 : -1;
456
+ }
457
+ function ae(e, t, n = ot) {
458
+ return ge(e, t, n) === 0;
459
+ }
460
+ function J(e, t, n) {
461
+ return ge(e, t, n) === 0;
462
+ }
463
+ function dr(e, t, n) {
464
+ if (e.length !== t.length)
465
+ return !1;
466
+ for (let r = 0; r < e.length; r++) {
467
+ const i = e[r], o = t[r];
468
+ if (!J(i, o, n))
469
+ return !1;
470
+ }
471
+ return !0;
472
+ }
473
+ function Se({
474
+ panelConstraints: e,
475
+ panelIndex: t,
476
+ size: n
477
+ }) {
478
+ const r = e[t];
479
+ E(r != null, `Panel constraints not found for index ${t}`);
480
+ let {
481
+ collapsedSize: i = 0,
482
+ collapsible: o,
483
+ maxSize: s = 100,
484
+ minSize: a = 0
485
+ } = r;
486
+ if (ge(n, a) < 0)
487
+ if (o) {
488
+ const l = (i + a) / 2;
489
+ ge(n, l) < 0 ? n = i : n = a;
490
+ } else
491
+ n = a;
492
+ return n = Math.min(s, n), n = parseFloat(n.toFixed(ot)), n;
493
+ }
494
+ function Ie({
495
+ delta: e,
496
+ initialLayout: t,
497
+ panelConstraints: n,
498
+ pivotIndices: r,
499
+ prevLayout: i,
500
+ trigger: o
501
+ }) {
502
+ if (J(e, 0))
503
+ return t;
504
+ const s = [...t], [a, l] = r;
505
+ E(a != null, "Invalid first pivot index"), E(l != null, "Invalid second pivot index");
506
+ let f = 0;
507
+ if (o === "keyboard") {
508
+ {
509
+ const u = e < 0 ? l : a, c = n[u];
510
+ E(c, `Panel constraints not found for index ${u}`);
511
+ const {
512
+ collapsedSize: h = 0,
513
+ collapsible: m,
514
+ minSize: y = 0
515
+ } = c;
516
+ if (m) {
517
+ const S = t[u];
518
+ if (E(S != null, `Previous layout not found for panel index ${u}`), J(S, h)) {
519
+ const v = y - S;
520
+ ge(v, Math.abs(e)) > 0 && (e = e < 0 ? 0 - v : v);
521
+ }
522
+ }
523
+ }
524
+ {
525
+ const u = e < 0 ? a : l, c = n[u];
526
+ E(c, `No panel constraints found for index ${u}`);
527
+ const {
528
+ collapsedSize: h = 0,
529
+ collapsible: m,
530
+ minSize: y = 0
531
+ } = c;
532
+ if (m) {
533
+ const S = t[u];
534
+ if (E(S != null, `Previous layout not found for panel index ${u}`), J(S, y)) {
535
+ const v = S - h;
536
+ ge(v, Math.abs(e)) > 0 && (e = e < 0 ? 0 - v : v);
537
+ }
538
+ }
539
+ }
540
+ }
541
+ {
542
+ const u = e < 0 ? 1 : -1;
543
+ let c = e < 0 ? l : a, h = 0;
544
+ for (; ; ) {
545
+ const y = t[c];
546
+ E(y != null, `Previous layout not found for panel index ${c}`);
547
+ const v = Se({
548
+ panelConstraints: n,
549
+ panelIndex: c,
550
+ size: 100
551
+ }) - y;
552
+ if (h += v, c += u, c < 0 || c >= n.length)
553
+ break;
554
+ }
555
+ const m = Math.min(Math.abs(e), Math.abs(h));
556
+ e = e < 0 ? 0 - m : m;
557
+ }
558
+ {
559
+ let c = e < 0 ? a : l;
560
+ for (; c >= 0 && c < n.length; ) {
561
+ const h = Math.abs(e) - Math.abs(f), m = t[c];
562
+ E(m != null, `Previous layout not found for panel index ${c}`);
563
+ const y = m - h, S = Se({
564
+ panelConstraints: n,
565
+ panelIndex: c,
566
+ size: y
567
+ });
568
+ if (!J(m, S) && (f += m - S, s[c] = S, f.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3), void 0, {
569
+ numeric: !0
570
+ }) >= 0))
571
+ break;
572
+ e < 0 ? c-- : c++;
573
+ }
574
+ }
575
+ if (dr(i, s))
576
+ return i;
577
+ {
578
+ const u = e < 0 ? l : a, c = t[u];
579
+ E(c != null, `Previous layout not found for panel index ${u}`);
580
+ const h = c + f, m = Se({
581
+ panelConstraints: n,
582
+ panelIndex: u,
583
+ size: h
584
+ });
585
+ if (s[u] = m, !J(m, h)) {
586
+ let y = h - m, v = e < 0 ? l : a;
587
+ for (; v >= 0 && v < n.length; ) {
588
+ const D = s[v];
589
+ E(D != null, `Previous layout not found for panel index ${v}`);
590
+ const b = D + y, I = Se({
591
+ panelConstraints: n,
592
+ panelIndex: v,
593
+ size: b
594
+ });
595
+ if (J(D, I) || (y -= I - D, s[v] = I), J(y, 0))
596
+ break;
597
+ e > 0 ? v-- : v++;
598
+ }
599
+ }
600
+ }
601
+ const p = s.reduce((u, c) => c + u, 0);
602
+ return J(p, 100) ? s : i;
603
+ }
604
+ function fr({
605
+ layout: e,
606
+ panelsArray: t,
607
+ pivotIndices: n
608
+ }) {
609
+ let r = 0, i = 100, o = 0, s = 0;
610
+ const a = n[0];
611
+ E(a != null, "No pivot index found"), t.forEach((u, c) => {
612
+ const {
613
+ constraints: h
614
+ } = u, {
615
+ maxSize: m = 100,
616
+ minSize: y = 0
617
+ } = h;
618
+ c === a ? (r = y, i = m) : (o += y, s += m);
619
+ });
620
+ const l = Math.min(i, 100 - o), f = Math.max(r, 100 - s), p = e[a];
621
+ return {
622
+ valueMax: l,
623
+ valueMin: f,
624
+ valueNow: p
625
+ };
626
+ }
627
+ function Me(e, t = document) {
628
+ return Array.from(t.querySelectorAll(`[${K.resizeHandleId}][data-panel-group-id="${e}"]`));
629
+ }
630
+ function Kt(e, t, n = document) {
631
+ const i = Me(e, n).findIndex((o) => o.getAttribute(K.resizeHandleId) === t);
632
+ return i ?? null;
633
+ }
634
+ function Bt(e, t, n) {
635
+ const r = Kt(e, t, n);
636
+ return r != null ? [r, r + 1] : [-1, -1];
637
+ }
638
+ function qt(e, t = document) {
639
+ var n;
640
+ if (t instanceof HTMLElement && (t == null || (n = t.dataset) === null || n === void 0 ? void 0 : n.panelGroupId) == e)
641
+ return t;
642
+ const r = t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);
643
+ return r || null;
644
+ }
645
+ function Be(e, t = document) {
646
+ const n = t.querySelector(`[${K.resizeHandleId}="${e}"]`);
647
+ return n || null;
648
+ }
649
+ function pr(e, t, n, r = document) {
650
+ var i, o, s, a;
651
+ const l = Be(t, r), f = Me(e, r), p = l ? f.indexOf(l) : -1, u = (i = (o = n[p]) === null || o === void 0 ? void 0 : o.id) !== null && i !== void 0 ? i : null, c = (s = (a = n[p + 1]) === null || a === void 0 ? void 0 : a.id) !== null && s !== void 0 ? s : null;
652
+ return [u, c];
653
+ }
654
+ function mr({
655
+ committedValuesRef: e,
656
+ eagerValuesRef: t,
657
+ groupId: n,
658
+ layout: r,
659
+ panelDataArray: i,
660
+ panelGroupElement: o,
661
+ setLayout: s
662
+ }) {
663
+ B({
664
+ didWarnAboutMissingResizeHandle: !1
665
+ }), me(() => {
666
+ if (!o)
667
+ return;
668
+ const a = Me(n, o);
669
+ for (let l = 0; l < i.length - 1; l++) {
670
+ const {
671
+ valueMax: f,
672
+ valueMin: p,
673
+ valueNow: u
674
+ } = fr({
675
+ layout: r,
676
+ panelsArray: i,
677
+ pivotIndices: [l, l + 1]
678
+ }), c = a[l];
679
+ if (c != null) {
680
+ const h = i[l];
681
+ E(h, `No panel data found for index "${l}"`), c.setAttribute("aria-controls", h.id), c.setAttribute("aria-valuemax", "" + Math.round(f)), c.setAttribute("aria-valuemin", "" + Math.round(p)), c.setAttribute("aria-valuenow", u != null ? "" + Math.round(u) : "");
682
+ }
683
+ }
684
+ return () => {
685
+ a.forEach((l, f) => {
686
+ l.removeAttribute("aria-controls"), l.removeAttribute("aria-valuemax"), l.removeAttribute("aria-valuemin"), l.removeAttribute("aria-valuenow");
687
+ });
688
+ };
689
+ }, [n, r, i, o]), Z(() => {
690
+ if (!o)
691
+ return;
692
+ const a = t.current;
693
+ E(a, "Eager values not found");
694
+ const {
695
+ panelDataArray: l
696
+ } = a, f = qt(n, o);
697
+ E(f != null, `No group found for id "${n}"`);
698
+ const p = Me(n, o);
699
+ E(p, `No resize handles found for group id "${n}"`);
700
+ const u = p.map((c) => {
701
+ const h = c.getAttribute(K.resizeHandleId);
702
+ E(h, "Resize handle element has no handle id attribute");
703
+ const [m, y] = pr(n, h, l, o);
704
+ if (m == null || y == null)
705
+ return () => {
706
+ };
707
+ const S = (v) => {
708
+ if (!v.defaultPrevented)
709
+ switch (v.key) {
710
+ case "Enter": {
711
+ v.preventDefault();
712
+ const D = l.findIndex((b) => b.id === m);
713
+ if (D >= 0) {
714
+ const b = l[D];
715
+ E(b, `No panel data found for index ${D}`);
716
+ const I = r[D], {
717
+ collapsedSize: R = 0,
718
+ collapsible: M,
719
+ minSize: w = 0
720
+ } = b.constraints;
721
+ if (I != null && M) {
722
+ const X = Ie({
723
+ delta: J(I, R) ? w - R : R - I,
724
+ initialLayout: r,
725
+ panelConstraints: l.map((j) => j.constraints),
726
+ pivotIndices: Bt(n, h, o),
727
+ prevLayout: r,
728
+ trigger: "keyboard"
729
+ });
730
+ r !== X && s(X);
731
+ }
732
+ }
733
+ break;
734
+ }
735
+ }
736
+ };
737
+ return c.addEventListener("keydown", S), () => {
738
+ c.removeEventListener("keydown", S);
739
+ };
740
+ });
741
+ return () => {
742
+ u.forEach((c) => c());
743
+ };
744
+ }, [o, e, t, n, r, i, s]);
745
+ }
746
+ function ht(e, t) {
747
+ if (e.length !== t.length)
748
+ return !1;
749
+ for (let n = 0; n < e.length; n++)
750
+ if (e[n] !== t[n])
751
+ return !1;
752
+ return !0;
753
+ }
754
+ function Gt(e, t) {
755
+ const n = e === "horizontal", {
756
+ x: r,
757
+ y: i
758
+ } = Fe(t);
759
+ return n ? r : i;
760
+ }
761
+ function gr(e, t, n, r, i) {
762
+ const o = n === "horizontal", s = Be(t, i);
763
+ E(s, `No resize handle element found for id "${t}"`);
764
+ const a = s.getAttribute(K.groupId);
765
+ E(a, "Resize handle element has no group id attribute");
766
+ let {
767
+ initialCursorPosition: l
768
+ } = r;
769
+ const f = Gt(n, e), p = qt(a, i);
770
+ E(p, `No group element found for id "${a}"`);
771
+ const u = p.getBoundingClientRect(), c = o ? u.width : u.height;
772
+ return (f - l) / c * 100;
773
+ }
774
+ function hr(e, t, n, r, i, o) {
775
+ if (Lt(e)) {
776
+ const s = n === "horizontal";
777
+ let a = 0;
778
+ e.shiftKey ? a = 100 : i != null ? a = i : a = 10;
779
+ let l = 0;
780
+ switch (e.key) {
781
+ case "ArrowDown":
782
+ l = s ? 0 : a;
783
+ break;
784
+ case "ArrowLeft":
785
+ l = s ? -a : 0;
786
+ break;
787
+ case "ArrowRight":
788
+ l = s ? a : 0;
789
+ break;
790
+ case "ArrowUp":
791
+ l = s ? 0 : -a;
792
+ break;
793
+ case "End":
794
+ l = 100;
795
+ break;
796
+ case "Home":
797
+ l = -100;
798
+ break;
799
+ }
800
+ return l;
801
+ } else
802
+ return r == null ? 0 : gr(e, t, n, r, o);
803
+ }
804
+ function yr({
805
+ panelDataArray: e
806
+ }) {
807
+ const t = Array(e.length), n = e.map((o) => o.constraints);
808
+ let r = 0, i = 100;
809
+ for (let o = 0; o < e.length; o++) {
810
+ const s = n[o];
811
+ E(s, `Panel constraints not found for index ${o}`);
812
+ const {
813
+ defaultSize: a
814
+ } = s;
815
+ a != null && (r++, t[o] = a, i -= a);
816
+ }
817
+ for (let o = 0; o < e.length; o++) {
818
+ const s = n[o];
819
+ E(s, `Panel constraints not found for index ${o}`);
820
+ const {
821
+ defaultSize: a
822
+ } = s;
823
+ if (a != null)
824
+ continue;
825
+ const l = e.length - r, f = i / l;
826
+ r++, t[o] = f, i -= f;
827
+ }
828
+ return t;
829
+ }
830
+ function ye(e, t, n) {
831
+ t.forEach((r, i) => {
832
+ const o = e[i];
833
+ E(o, `Panel data not found for index ${i}`);
834
+ const {
835
+ callbacks: s,
836
+ constraints: a,
837
+ id: l
838
+ } = o, {
839
+ collapsedSize: f = 0,
840
+ collapsible: p
841
+ } = a, u = n[l];
842
+ if (u == null || r !== u) {
843
+ n[l] = r;
844
+ const {
845
+ onCollapse: c,
846
+ onExpand: h,
847
+ onResize: m
848
+ } = s;
849
+ m && m(r, u), p && (c || h) && (h && (u == null || ae(u, f)) && !ae(r, f) && h(), c && (u == null || !ae(u, f)) && ae(r, f) && c());
850
+ }
851
+ });
852
+ }
853
+ function Ne(e, t) {
854
+ if (e.length !== t.length)
855
+ return !1;
856
+ for (let n = 0; n < e.length; n++)
857
+ if (e[n] != t[n])
858
+ return !1;
859
+ return !0;
860
+ }
861
+ function vr({
862
+ defaultSize: e,
863
+ dragState: t,
864
+ layout: n,
865
+ panelData: r,
866
+ panelIndex: i,
867
+ precision: o = 3
868
+ }) {
869
+ const s = n[i];
870
+ let a;
871
+ return s == null ? a = e != null ? e.toPrecision(o) : "1" : r.length === 1 ? a = "1" : a = s.toPrecision(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: t !== null ? "none" : void 0
880
+ };
881
+ }
882
+ function Sr(e, t = 10) {
883
+ let n = null;
884
+ return (...i) => {
885
+ n !== null && clearTimeout(n), n = setTimeout(() => {
886
+ e(...i);
887
+ }, t);
888
+ };
889
+ }
890
+ function yt(e) {
891
+ try {
892
+ if (typeof localStorage < "u")
893
+ e.getItem = (t) => localStorage.getItem(t), e.setItem = (t, n) => {
894
+ localStorage.setItem(t, n);
895
+ };
896
+ else
897
+ throw new Error("localStorage not supported in this environment");
898
+ } catch (t) {
899
+ console.error(t), e.getItem = () => null, e.setItem = () => {
900
+ };
901
+ }
902
+ }
903
+ function Ot(e) {
904
+ return `react-resizable-panels:${e}`;
905
+ }
906
+ function Ut(e) {
907
+ return e.map((t) => {
908
+ const {
909
+ constraints: n,
910
+ id: r,
911
+ idIsFromProps: i,
912
+ order: o
913
+ } = t;
914
+ return i ? r : o ? `${o}:${JSON.stringify(n)}` : JSON.stringify(n);
915
+ }).sort((t, n) => t.localeCompare(n)).join(",");
916
+ }
917
+ function Wt(e, t) {
918
+ try {
919
+ const n = Ot(e), r = t.getItem(n);
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 xr(e, t, n) {
930
+ var r, i;
931
+ const o = (r = Wt(e, n)) !== null && r !== void 0 ? r : {}, s = Ut(t);
932
+ return (i = o[s]) !== null && i !== void 0 ? i : null;
933
+ }
934
+ function br(e, t, n, r, i) {
935
+ var o;
936
+ const s = Ot(e), a = Ut(t), l = (o = Wt(e, i)) !== null && o !== void 0 ? o : {};
937
+ l[a] = {
938
+ expandToSizes: Object.fromEntries(n.entries()),
939
+ layout: r
940
+ };
941
+ try {
942
+ i.setItem(s, JSON.stringify(l));
943
+ } catch (f) {
944
+ console.error(f);
945
+ }
946
+ }
947
+ function vt({
948
+ layout: e,
949
+ panelConstraints: t
950
+ }) {
951
+ const n = [...e], r = n.reduce((o, s) => o + s, 0);
952
+ if (n.length !== t.length)
953
+ throw Error(`Invalid ${t.length} panel layout: ${n.map((o) => `${o}%`).join(", ")}`);
954
+ if (!J(r, 100) && n.length > 0)
955
+ for (let o = 0; o < t.length; o++) {
956
+ const s = n[o];
957
+ E(s != null, `No layout data found for index ${o}`);
958
+ const a = 100 / r * s;
959
+ n[o] = a;
960
+ }
961
+ let i = 0;
962
+ for (let o = 0; o < t.length; o++) {
963
+ const s = n[o];
964
+ E(s != null, `No layout data found for index ${o}`);
965
+ const a = Se({
966
+ panelConstraints: t,
967
+ panelIndex: o,
968
+ size: s
969
+ });
970
+ s != a && (i += s - a, n[o] = a);
971
+ }
972
+ if (!J(i, 0))
973
+ for (let o = 0; o < t.length; o++) {
974
+ const s = n[o];
975
+ E(s != null, `No layout data found for index ${o}`);
976
+ const a = s + i, l = Se({
977
+ panelConstraints: t,
978
+ panelIndex: o,
979
+ size: a
980
+ });
981
+ if (s !== l && (i -= l - s, n[o] = l, J(i, 0)))
982
+ break;
983
+ }
984
+ return n;
985
+ }
986
+ const zr = 100, Re = {
987
+ getItem: (e) => (yt(Re), Re.getItem(e)),
988
+ setItem: (e, t) => {
989
+ yt(Re), Re.setItem(e, t);
990
+ }
991
+ }, St = {};
992
+ function Xt({
993
+ autoSaveId: e = null,
994
+ children: t,
995
+ className: n = "",
996
+ direction: r,
997
+ forwardedRef: i,
998
+ id: o = null,
999
+ onLayout: s = null,
1000
+ keyboardResizeBy: a = null,
1001
+ storage: l = Re,
1002
+ style: f,
1003
+ tagName: p = "div",
1004
+ ...u
1005
+ }) {
1006
+ const c = it(o), h = B(null), [m, y] = ue(null), [S, v] = ue([]), D = ur(), b = B({}), I = B(/* @__PURE__ */ new Map()), R = B(0), M = B({
1007
+ autoSaveId: e,
1008
+ direction: r,
1009
+ dragState: m,
1010
+ id: c,
1011
+ keyboardResizeBy: a,
1012
+ onLayout: s,
1013
+ storage: l
1014
+ }), w = B({
1015
+ layout: S,
1016
+ panelDataArray: [],
1017
+ panelDataArrayChanged: !1
1018
+ });
1019
+ B({
1020
+ didLogIdAndOrderWarning: !1,
1021
+ didLogPanelConstraintsWarning: !1,
1022
+ prevPanelIds: []
1023
+ }), bt(i, () => ({
1024
+ getId: () => M.current.id,
1025
+ getLayout: () => {
1026
+ const {
1027
+ layout: x
1028
+ } = w.current;
1029
+ return x;
1030
+ },
1031
+ setLayout: (x) => {
1032
+ const {
1033
+ onLayout: z
1034
+ } = M.current, {
1035
+ layout: C,
1036
+ panelDataArray: d
1037
+ } = w.current, g = vt({
1038
+ layout: x,
1039
+ panelConstraints: d.map((P) => P.constraints)
1040
+ });
1041
+ ht(C, g) || (v(g), w.current.layout = g, z && z(g), ye(d, g, b.current));
1042
+ }
1043
+ }), []), me(() => {
1044
+ M.current.autoSaveId = e, M.current.direction = r, M.current.dragState = m, M.current.id = c, M.current.onLayout = s, M.current.storage = l;
1045
+ }), mr({
1046
+ committedValuesRef: M,
1047
+ eagerValuesRef: w,
1048
+ groupId: c,
1049
+ layout: S,
1050
+ panelDataArray: w.current.panelDataArray,
1051
+ setLayout: v,
1052
+ panelGroupElement: h.current
1053
+ }), Z(() => {
1054
+ const {
1055
+ panelDataArray: x
1056
+ } = w.current;
1057
+ if (e) {
1058
+ if (S.length === 0 || S.length !== x.length)
1059
+ return;
1060
+ let z = St[e];
1061
+ z == null && (z = Sr(br, zr), St[e] = z);
1062
+ const C = [...x], d = new Map(I.current);
1063
+ z(e, C, d, S, l);
1064
+ }
1065
+ }, [e, S, l]), Z(() => {
1066
+ });
1067
+ const X = O((x) => {
1068
+ const {
1069
+ onLayout: z
1070
+ } = M.current, {
1071
+ layout: C,
1072
+ panelDataArray: d
1073
+ } = w.current;
1074
+ if (x.constraints.collapsible) {
1075
+ const g = d.map((oe) => oe.constraints), {
1076
+ collapsedSize: P = 0,
1077
+ panelSize: N,
1078
+ pivotIndices: q
1079
+ } = de(d, x, C);
1080
+ if (E(N != null, `Panel size not found for panel "${x.id}"`), !ae(N, P)) {
1081
+ I.current.set(x.id, N);
1082
+ const ie = ve(d, x) === d.length - 1 ? N - P : P - N, F = Ie({
1083
+ delta: ie,
1084
+ initialLayout: C,
1085
+ panelConstraints: g,
1086
+ pivotIndices: q,
1087
+ prevLayout: C,
1088
+ trigger: "imperative-api"
1089
+ });
1090
+ Ne(C, F) || (v(F), w.current.layout = F, z && z(F), ye(d, F, b.current));
1091
+ }
1092
+ }
1093
+ }, []), j = O((x, z) => {
1094
+ const {
1095
+ onLayout: C
1096
+ } = M.current, {
1097
+ layout: d,
1098
+ panelDataArray: g
1099
+ } = w.current;
1100
+ if (x.constraints.collapsible) {
1101
+ const P = g.map((ee) => ee.constraints), {
1102
+ collapsedSize: N = 0,
1103
+ panelSize: q = 0,
1104
+ minSize: oe = 0,
1105
+ pivotIndices: ie
1106
+ } = de(g, x, d), F = z ?? oe;
1107
+ if (ae(q, N)) {
1108
+ const ee = I.current.get(x.id), Ce = ee != null && ee >= F ? ee : F, Ge = ve(g, x) === g.length - 1 ? q - Ce : Ce - q, Q = Ie({
1109
+ delta: Ge,
1110
+ initialLayout: d,
1111
+ panelConstraints: P,
1112
+ pivotIndices: ie,
1113
+ prevLayout: d,
1114
+ trigger: "imperative-api"
1115
+ });
1116
+ Ne(d, Q) || (v(Q), w.current.layout = Q, C && C(Q), ye(g, Q, b.current));
1117
+ }
1118
+ }
1119
+ }, []), $ = O((x) => {
1120
+ const {
1121
+ layout: z,
1122
+ panelDataArray: C
1123
+ } = w.current, {
1124
+ panelSize: d
1125
+ } = de(C, x, z);
1126
+ return E(d != null, `Panel size not found for panel "${x.id}"`), d;
1127
+ }, []), A = O((x, z) => {
1128
+ const {
1129
+ panelDataArray: C
1130
+ } = w.current, d = ve(C, x);
1131
+ return vr({
1132
+ defaultSize: z,
1133
+ dragState: m,
1134
+ layout: S,
1135
+ panelData: C,
1136
+ panelIndex: d
1137
+ });
1138
+ }, [m, S]), L = O((x) => {
1139
+ const {
1140
+ layout: z,
1141
+ panelDataArray: C
1142
+ } = w.current, {
1143
+ collapsedSize: d = 0,
1144
+ collapsible: g,
1145
+ panelSize: P
1146
+ } = de(C, x, z);
1147
+ return E(P != null, `Panel size not found for panel "${x.id}"`), g === !0 && ae(P, d);
1148
+ }, []), W = O((x) => {
1149
+ const {
1150
+ layout: z,
1151
+ panelDataArray: C
1152
+ } = w.current, {
1153
+ collapsedSize: d = 0,
1154
+ collapsible: g,
1155
+ panelSize: P
1156
+ } = de(C, x, z);
1157
+ return E(P != null, `Panel size not found for panel "${x.id}"`), !g || ge(P, d) > 0;
1158
+ }, []), V = O((x) => {
1159
+ const {
1160
+ panelDataArray: z
1161
+ } = w.current;
1162
+ z.push(x), z.sort((C, d) => {
1163
+ const g = C.order, P = d.order;
1164
+ return g == null && P == null ? 0 : g == null ? -1 : P == null ? 1 : g - P;
1165
+ }), w.current.panelDataArrayChanged = !0, D();
1166
+ }, [D]);
1167
+ me(() => {
1168
+ if (w.current.panelDataArrayChanged) {
1169
+ w.current.panelDataArrayChanged = !1;
1170
+ const {
1171
+ autoSaveId: x,
1172
+ onLayout: z,
1173
+ storage: C
1174
+ } = M.current, {
1175
+ layout: d,
1176
+ panelDataArray: g
1177
+ } = w.current;
1178
+ let P = null;
1179
+ if (x) {
1180
+ const q = xr(x, g, C);
1181
+ q && (I.current = new Map(Object.entries(q.expandToSizes)), P = q.layout);
1182
+ }
1183
+ P == null && (P = yr({
1184
+ panelDataArray: g
1185
+ }));
1186
+ const N = vt({
1187
+ layout: P,
1188
+ panelConstraints: g.map((q) => q.constraints)
1189
+ });
1190
+ ht(d, N) || (v(N), w.current.layout = N, z && z(N), ye(g, N, b.current));
1191
+ }
1192
+ }), me(() => {
1193
+ const x = w.current;
1194
+ return () => {
1195
+ x.layout = [];
1196
+ };
1197
+ }, []);
1198
+ const T = O((x) => {
1199
+ let z = !1;
1200
+ const C = h.current;
1201
+ return C && window.getComputedStyle(C, null).getPropertyValue("direction") === "rtl" && (z = !0), function(g) {
1202
+ g.preventDefault();
1203
+ const P = h.current;
1204
+ if (!P)
1205
+ return () => null;
1206
+ const {
1207
+ direction: N,
1208
+ dragState: q,
1209
+ id: oe,
1210
+ keyboardResizeBy: ie,
1211
+ onLayout: F
1212
+ } = M.current, {
1213
+ layout: ee,
1214
+ panelDataArray: Ce
1215
+ } = w.current, {
1216
+ initialLayout: Le
1217
+ } = q ?? {}, Ge = Bt(oe, x, P);
1218
+ let Q = hr(g, x, N, q, ie, P);
1219
+ const ct = N === "horizontal";
1220
+ ct && z && (Q = -Q);
1221
+ const yn = Ce.map((vn) => vn.constraints), Ee = Ie({
1222
+ delta: Q,
1223
+ initialLayout: Le ?? ee,
1224
+ panelConstraints: yn,
1225
+ pivotIndices: Ge,
1226
+ prevLayout: ee,
1227
+ trigger: Lt(g) ? "keyboard" : "mouse-or-touch"
1228
+ }), ut = !Ne(ee, Ee);
1229
+ (Nt(g) || _t(g)) && R.current != Q && (R.current = Q, !ut && Q !== 0 ? ct ? Ye(x, Q < 0 ? Tt : Ht) : Ye(x, Q < 0 ? $t : Vt) : Ye(x, 0)), ut && (v(Ee), w.current.layout = Ee, F && F(Ee), ye(Ce, Ee, b.current));
1230
+ };
1231
+ }, []), H = O((x, z) => {
1232
+ const {
1233
+ onLayout: C
1234
+ } = M.current, {
1235
+ layout: d,
1236
+ panelDataArray: g
1237
+ } = w.current, P = g.map((ee) => ee.constraints), {
1238
+ panelSize: N,
1239
+ pivotIndices: q
1240
+ } = de(g, x, d);
1241
+ E(N != null, `Panel size not found for panel "${x.id}"`);
1242
+ const ie = ve(g, x) === g.length - 1 ? N - z : z - N, F = Ie({
1243
+ delta: ie,
1244
+ initialLayout: d,
1245
+ panelConstraints: P,
1246
+ pivotIndices: q,
1247
+ prevLayout: d,
1248
+ trigger: "imperative-api"
1249
+ });
1250
+ Ne(d, F) || (v(F), w.current.layout = F, C && C(F), ye(g, F, b.current));
1251
+ }, []), Y = O((x, z) => {
1252
+ const {
1253
+ layout: C,
1254
+ panelDataArray: d
1255
+ } = w.current, {
1256
+ collapsedSize: g = 0,
1257
+ collapsible: P
1258
+ } = z, {
1259
+ collapsedSize: N = 0,
1260
+ collapsible: q,
1261
+ maxSize: oe = 100,
1262
+ minSize: ie = 0
1263
+ } = x.constraints, {
1264
+ panelSize: F
1265
+ } = de(d, x, C);
1266
+ F != null && (P && q && ae(F, g) ? ae(g, N) || H(x, N) : F < ie ? H(x, ie) : F > oe && H(x, oe));
1267
+ }, [H]), G = O((x, z) => {
1268
+ const {
1269
+ direction: C
1270
+ } = M.current, {
1271
+ layout: d
1272
+ } = w.current;
1273
+ if (!h.current)
1274
+ return;
1275
+ const g = Be(x, h.current);
1276
+ E(g, `Drag handle element not found for id "${x}"`);
1277
+ const P = Gt(C, z);
1278
+ y({
1279
+ dragHandleId: x,
1280
+ dragHandleRect: g.getBoundingClientRect(),
1281
+ initialCursorPosition: P,
1282
+ initialLayout: d
1283
+ });
1284
+ }, []), re = O(() => {
1285
+ y(null);
1286
+ }, []), he = O((x) => {
1287
+ const {
1288
+ panelDataArray: z
1289
+ } = w.current, C = ve(z, x);
1290
+ C >= 0 && (z.splice(C, 1), delete b.current[x.id], w.current.panelDataArrayChanged = !0, D());
1291
+ }, [D]), se = U(() => ({
1292
+ collapsePanel: X,
1293
+ direction: r,
1294
+ dragState: m,
1295
+ expandPanel: j,
1296
+ getPanelSize: $,
1297
+ getPanelStyle: A,
1298
+ groupId: c,
1299
+ isPanelCollapsed: L,
1300
+ isPanelExpanded: W,
1301
+ reevaluatePanelConstraints: Y,
1302
+ registerPanel: V,
1303
+ registerResizeHandle: T,
1304
+ resizePanel: H,
1305
+ startDragging: G,
1306
+ stopDragging: re,
1307
+ unregisterPanel: he,
1308
+ panelGroupElement: h.current
1309
+ }), [X, m, r, j, $, A, c, L, W, Y, V, T, H, G, re, he]), le = {
1310
+ display: "flex",
1311
+ flexDirection: r === "horizontal" ? "row" : "column",
1312
+ height: "100%",
1313
+ overflow: "hidden",
1314
+ width: "100%"
1315
+ };
1316
+ return be(Ve.Provider, {
1317
+ value: se
1318
+ }, be(p, {
1319
+ ...u,
1320
+ children: t,
1321
+ className: n,
1322
+ id: o,
1323
+ ref: h,
1324
+ style: {
1325
+ ...le,
1326
+ ...f
1327
+ },
1328
+ // CSS selectors
1329
+ [K.group]: "",
1330
+ [K.groupDirection]: r,
1331
+ [K.groupId]: c
1332
+ }));
1333
+ }
1334
+ const Pr = $e((e, t) => be(Xt, {
1335
+ ...e,
1336
+ forwardedRef: t
1337
+ }));
1338
+ Xt.displayName = "PanelGroup";
1339
+ Pr.displayName = "forwardRef(PanelGroup)";
1340
+ function ve(e, t) {
1341
+ return e.findIndex((n) => n === t || n.id === t.id);
1342
+ }
1343
+ function de(e, t, n) {
1344
+ const r = ve(e, t), o = r === e.length - 1 ? [r - 1, r] : [r, r + 1], s = n[r];
1345
+ return {
1346
+ ...t.constraints,
1347
+ panelSize: s,
1348
+ pivotIndices: o
1349
+ };
1350
+ }
1351
+ function wr({
1352
+ disabled: e,
1353
+ handleId: t,
1354
+ resizeHandler: n,
1355
+ panelGroupElement: r
1356
+ }) {
1357
+ Z(() => {
1358
+ if (e || n == null || r == null)
1359
+ return;
1360
+ const i = Be(t, r);
1361
+ if (i == null)
1362
+ return;
1363
+ const o = (s) => {
1364
+ if (!s.defaultPrevented)
1365
+ switch (s.key) {
1366
+ case "ArrowDown":
1367
+ case "ArrowLeft":
1368
+ case "ArrowRight":
1369
+ case "ArrowUp":
1370
+ case "End":
1371
+ case "Home": {
1372
+ s.preventDefault(), n(s);
1373
+ break;
1374
+ }
1375
+ case "F6": {
1376
+ s.preventDefault();
1377
+ const a = i.getAttribute(K.groupId);
1378
+ E(a, `No group element found for id "${a}"`);
1379
+ const l = Me(a, r), f = Kt(a, t, r);
1380
+ E(f !== null, `No resize element found for id "${t}"`);
1381
+ const p = s.shiftKey ? f > 0 ? f - 1 : l.length - 1 : f + 1 < l.length ? f + 1 : 0;
1382
+ l[p].focus();
1383
+ break;
1384
+ }
1385
+ }
1386
+ };
1387
+ return i.addEventListener("keydown", o), () => {
1388
+ i.removeEventListener("keydown", o);
1389
+ };
1390
+ }, [r, e, t, n]);
1391
+ }
1392
+ function Cr({
1393
+ children: e = null,
1394
+ className: t = "",
1395
+ disabled: n = !1,
1396
+ hitAreaMargins: r,
1397
+ id: i,
1398
+ onBlur: o,
1399
+ onClick: s,
1400
+ onDragging: a,
1401
+ onFocus: l,
1402
+ onPointerDown: f,
1403
+ onPointerUp: p,
1404
+ style: u = {},
1405
+ tabIndex: c = 0,
1406
+ tagName: h = "div",
1407
+ ...m
1408
+ }) {
1409
+ var y, S;
1410
+ const v = B(null), D = B({
1411
+ onClick: s,
1412
+ onDragging: a,
1413
+ onPointerDown: f,
1414
+ onPointerUp: p
1415
+ });
1416
+ Z(() => {
1417
+ D.current.onClick = s, D.current.onDragging = a, D.current.onPointerDown = f, D.current.onPointerUp = p;
1418
+ });
1419
+ const b = xt(Ve);
1420
+ if (b === null)
1421
+ throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");
1422
+ const {
1423
+ direction: I,
1424
+ groupId: R,
1425
+ registerResizeHandle: M,
1426
+ startDragging: w,
1427
+ stopDragging: X,
1428
+ panelGroupElement: j
1429
+ } = b, $ = it(i), [A, L] = ue("inactive"), [W, V] = ue(!1), [T, H] = ue(null), Y = B({
1430
+ state: A
1431
+ });
1432
+ me(() => {
1433
+ Y.current.state = A;
1434
+ }), Z(() => {
1435
+ if (n)
1436
+ H(null);
1437
+ else {
1438
+ const se = M($);
1439
+ H(() => se);
1440
+ }
1441
+ }, [n, $, M]);
1442
+ const G = (y = r == null ? void 0 : r.coarse) !== null && y !== void 0 ? y : 15, re = (S = r == null ? void 0 : r.fine) !== null && S !== void 0 ? S : 5;
1443
+ return Z(() => {
1444
+ if (n || T == null)
1445
+ return;
1446
+ const se = v.current;
1447
+ E(se, "Element ref not attached");
1448
+ let le = !1;
1449
+ return lr($, se, I, {
1450
+ coarse: G,
1451
+ fine: re
1452
+ }, (z, C, d) => {
1453
+ if (!C) {
1454
+ L("inactive");
1455
+ return;
1456
+ }
1457
+ switch (z) {
1458
+ case "down": {
1459
+ L("drag"), le = !1, E(d, 'Expected event to be defined for "down" action'), w($, d);
1460
+ const {
1461
+ onDragging: g,
1462
+ onPointerDown: P
1463
+ } = D.current;
1464
+ g == null || g(!0), P == null || P();
1465
+ break;
1466
+ }
1467
+ case "move": {
1468
+ const {
1469
+ state: g
1470
+ } = Y.current;
1471
+ le = !0, g !== "drag" && L("hover"), E(d, 'Expected event to be defined for "move" action'), T(d);
1472
+ break;
1473
+ }
1474
+ case "up": {
1475
+ L("hover"), X();
1476
+ const {
1477
+ onClick: g,
1478
+ onDragging: P,
1479
+ onPointerUp: N
1480
+ } = D.current;
1481
+ P == null || P(!1), N == null || N(), le || g == null || g();
1482
+ break;
1483
+ }
1484
+ }
1485
+ });
1486
+ }, [G, I, n, re, M, $, T, w, X]), wr({
1487
+ disabled: n,
1488
+ handleId: $,
1489
+ resizeHandler: T,
1490
+ panelGroupElement: j
1491
+ }), be(h, {
1492
+ ...m,
1493
+ children: e,
1494
+ className: t,
1495
+ id: i,
1496
+ onBlur: () => {
1497
+ V(!1), o == null || o();
1498
+ },
1499
+ onFocus: () => {
1500
+ V(!0), l == null || l();
1501
+ },
1502
+ ref: v,
1503
+ role: "separator",
1504
+ style: {
1505
+ ...{
1506
+ touchAction: "none",
1507
+ userSelect: "none"
1508
+ },
1509
+ ...u
1510
+ },
1511
+ tabIndex: c,
1512
+ // CSS selectors
1513
+ [K.groupDirection]: I,
1514
+ [K.groupId]: R,
1515
+ [K.resizeHandle]: "",
1516
+ [K.resizeHandleActive]: A === "drag" ? "pointer" : W ? "keyboard" : void 0,
1517
+ [K.resizeHandleEnabled]: !n,
1518
+ [K.resizeHandleId]: $,
1519
+ [K.resizeHandleState]: A
1520
+ });
1521
+ }
1522
+ Cr.displayName = "PanelResizeHandle";
1523
+ function Yt() {
1524
+ var l, f;
1525
+ const e = te((p) => p.card), t = te((p) => p.frame), n = U(
1526
+ () => Un(t, e),
1527
+ [t, e]
1528
+ ), { manifest: r } = zt(
1529
+ ((l = n == null ? void 0 : n.customCardPreferences) == null ? void 0 : l.url) || ""
1530
+ ), i = U(
1531
+ () => {
1532
+ var p;
1533
+ return (p = r == null ? void 0 : r.visuals) == null ? void 0 : p.find(
1534
+ (u) => {
1535
+ var c;
1536
+ return u.name === ((c = n == null ? void 0 : n.customCardPreferences) == null ? void 0 : c.componentName);
1537
+ }
1538
+ );
1539
+ },
1540
+ [r, (f = n == null ? void 0 : n.customCardPreferences) == null ? void 0 : f.componentName]
1541
+ ), o = Dt(n, i), s = U(
1542
+ () => At({
1543
+ frame: t,
1544
+ configCard: n,
1545
+ isMultiInputVisual: o === "multiple"
1546
+ }),
1547
+ [t, n, o]
1548
+ ), a = U(() => {
1549
+ const p = s.findIndex(
1550
+ (u) => (u == null ? void 0 : u.id) === e.id
1551
+ );
1552
+ return p < 0 ? -1 : Qe(e, p);
1553
+ }, [s, e]);
1554
+ return U(() => !n || o !== "multiple" || a < 0 ? e.type : _e(
1555
+ e,
1556
+ a,
1557
+ i == null ? void 0 : i.slots
1558
+ ) ?? e.type, [n, o, a, e, i == null ? void 0 : i.slots]);
1559
+ }
1560
+ function jt({
1561
+ storeValue: e,
1562
+ defaultValue: t = "",
1563
+ onStoreUpdate: n,
1564
+ delay: r = 300
1565
+ }) {
1566
+ const [i, o] = ue(e ?? t), s = B(null), a = B(i), l = B(e), f = B(!1), p = O(() => {
1567
+ s.current && (clearTimeout(s.current), s.current = null), f.current && a.current !== (l.current ?? t) && (n(a.current), l.current = a.current);
1568
+ }, [t, n]);
1569
+ Z(() => {
1570
+ if (e !== l.current) {
1571
+ s.current && (clearTimeout(s.current), s.current = null);
1572
+ const c = e ?? t;
1573
+ o(c), a.current = c, l.current = e, f.current = !1;
1574
+ }
1575
+ }, [e, t]), Z(() => {
1576
+ if (f.current)
1577
+ return s.current = setTimeout(() => {
1578
+ p();
1579
+ }, r), () => {
1580
+ s.current && (clearTimeout(s.current), s.current = null);
1581
+ };
1582
+ }, [r, p, i]), Z(() => () => {
1583
+ s.current && clearTimeout(s.current);
1584
+ }, []);
1585
+ const u = O(
1586
+ (c) => {
1587
+ const h = c ?? t;
1588
+ f.current = !0, a.current = h, o(h);
1589
+ },
1590
+ [t]
1591
+ );
1592
+ return { value: i, onChange: u, flush: p };
1593
+ }
1594
+ function Qt({
1595
+ queryClient: e,
1596
+ readQueryKey: t,
1597
+ setRunSql: n
1598
+ }) {
1599
+ On(), setTimeout(() => {
1600
+ e.resetQueries({ queryKey: t(), exact: !0 }), n(!0);
1601
+ }, 0);
1602
+ }
1603
+ const Er = 300;
1604
+ function Ir({ className: e }, t) {
1605
+ const n = te((b) => b.card.sql), r = te((b) => b.sqlGen), i = te((b) => b.card), o = Yt(), { setCardSql: s, setSqlGen: a, setRunSql: l } = wt(), f = U(() => o !== i.type ? { ...i, type: o } : i, [i, o]), { queryKey: p } = nt(f), u = Pt(), c = B(p);
1606
+ c.current = p;
1607
+ const h = B(r);
1608
+ h.current = r;
1609
+ const m = O(
1610
+ (b) => {
1611
+ s(b);
1612
+ },
1613
+ [s]
1614
+ ), {
1615
+ value: y,
1616
+ onChange: S,
1617
+ flush: v
1618
+ } = jt({
1619
+ storeValue: n,
1620
+ defaultValue: "",
1621
+ onStoreUpdate: m,
1622
+ delay: Er
1623
+ });
1624
+ Z(() => Rt(v), [v]);
1625
+ function D(b) {
1626
+ S(b), Hn(h.current) || a({});
1627
+ }
1628
+ return /* @__PURE__ */ _("div", { className: "relative h-full w-full", children: /* @__PURE__ */ _(
1629
+ Ct,
1630
+ {
1631
+ ref: t,
1632
+ value: y ?? "",
1633
+ onValueChange: D,
1634
+ language: "sql-jinja",
1635
+ embedded: !0,
1636
+ hideLineNumbers: !0,
1637
+ wrapLines: !0,
1638
+ placeholder: "Write your SQL here",
1639
+ className: e,
1640
+ onKeyDown: (b) => {
1641
+ b.key === "Enter" && b.shiftKey && (b.preventDefault(), Qt({
1642
+ queryClient: u,
1643
+ readQueryKey: () => c.current,
1644
+ setRunSql: l
1645
+ }));
1646
+ }
1647
+ }
1648
+ ) });
1649
+ }
1650
+ const po = $e(Ir), Rr = 300, Dr = `# 'data' holds the SQL result.
1651
+ # Set 'result' to a list of dicts to replace it, for example:
1652
+ # import pandas as pd
1653
+ # result = pd.DataFrame(data).to_dict('records')`;
1654
+ function Ar({ className: e }, t) {
1655
+ const n = te((m) => m.card.python), r = te((m) => m.card), i = Yt(), { setCardPython: o, setRunSql: s } = wt(), a = U(() => i !== r.type ? { ...r, type: i } : r, [r, i]), { queryKey: l } = nt(a), f = Pt(), p = B(l);
1656
+ p.current = l;
1657
+ const { value: u, onChange: c, flush: h } = jt({
1658
+ storeValue: n,
1659
+ onStoreUpdate: o,
1660
+ delay: Rr
1661
+ });
1662
+ return Z(() => Rt(h), [h]), /* @__PURE__ */ _(
1663
+ Ct,
1664
+ {
1665
+ ref: t,
1666
+ value: u ?? "",
1667
+ onValueChange: c,
1668
+ language: "python",
1669
+ placeholder: Dr,
1670
+ ariaLabel: "Python code",
1671
+ embedded: !0,
1672
+ hideLineNumbers: !0,
1673
+ wrapLines: !0,
1674
+ className: rt(
1675
+ "[&_.code-editor-pre]:!pt-2 [&_.code-editor-textarea]:!pt-2",
1676
+ e
1677
+ ),
1678
+ onKeyDown: (m) => {
1679
+ m.key === "Enter" && m.shiftKey && (m.preventDefault(), Qt({
1680
+ queryClient: f,
1681
+ readQueryKey: () => p.current,
1682
+ setRunSql: s
1683
+ }));
1684
+ }
1685
+ }
1686
+ );
1687
+ }
1688
+ const mo = $e(Ar);
1689
+ function Mr({ card: e }) {
1690
+ var se, le, x, z, C;
1691
+ const t = Cn(), [n, r] = ue({}), { authToken: i } = En(), o = $n(i == null ? void 0 : i.accessToken), { compiledAppearance: s } = Yn(), a = U(
1692
+ () => In(s),
1693
+ [s]
1694
+ ), l = te((d) => d.frame), f = te(
1695
+ (d) => d.inlineFilterValuesMap[e.id]
1696
+ ), p = te(
1697
+ (d) => d.actions.setCardInlineFilterValue
1698
+ ), u = te(
1699
+ (d) => d.actions.removeCardInlineFilterValue
1700
+ ), c = e, { getCard: h, manifest: m } = zt(
1701
+ ((se = c.customCardPreferences) == null ? void 0 : se.url) || ""
1702
+ ), y = (le = m == null ? void 0 : m.visuals) == null ? void 0 : le.find(
1703
+ (d) => {
1704
+ var g;
1705
+ return d.name === ((g = c.customCardPreferences) == null ? void 0 : g.componentName);
1706
+ }
1707
+ ), S = Dt(c, y) ?? "single", v = U(
1708
+ () => At({
1709
+ frame: l,
1710
+ configCard: c,
1711
+ isMultiInputVisual: S === "multiple"
1712
+ }),
1713
+ [l, c, S]
1714
+ ), D = U(() => {
1715
+ const d = v.findIndex(
1716
+ (g) => (g == null ? void 0 : g.id) === e.id
1717
+ );
1718
+ return d < 0 ? -1 : Qe(e, d);
1719
+ }, [v, e]), b = U(() => S !== "multiple" || D < 0 ? e.type : _e(
1720
+ e,
1721
+ D,
1722
+ y == null ? void 0 : y.slots
1723
+ ) ?? e.type, [S, D, e, y == null ? void 0 : y.slots]), I = U(() => S === "multiple" ? {
1724
+ ...e,
1725
+ connectionId: void 0,
1726
+ dataSource: void 0,
1727
+ sql: "",
1728
+ python: "",
1729
+ config: void 0,
1730
+ queryConfig: void 0
1731
+ } : b !== e.type ? { ...e, type: b } : e, [e, b, S]), { data: R, effectiveCardConfig: M } = nt(I), w = Rn(), X = Oe((d) => d.dashboard.filters), j = Oe((d) => d.filterValues), $ = Oe((d) => d.selectedSheetId), A = U(
1732
+ () => Dn({
1733
+ card: e,
1734
+ sheetId: $ || "",
1735
+ inlineFilterValues: f,
1736
+ setInlineFilterValue: (d) => p(e.id, d),
1737
+ removeInlineFilterValue: (d) => u(e.id, d)
1738
+ }),
1739
+ [
1740
+ e,
1741
+ $,
1742
+ f,
1743
+ p,
1744
+ u
1745
+ ]
1746
+ ), { cardFilters: L, cardFilterValues: W } = U(
1747
+ () => An({
1748
+ card: e,
1749
+ transientContexts: w,
1750
+ filters: X,
1751
+ filterValues: j,
1752
+ selectedSheetId: $
1753
+ }),
1754
+ [
1755
+ e,
1756
+ w,
1757
+ X,
1758
+ j,
1759
+ $
1760
+ ]
1761
+ ), V = O(
1762
+ (d, g) => {
1763
+ const P = Wn(g);
1764
+ r((N) => ({
1765
+ ...N,
1766
+ [d]: P
1767
+ }));
1768
+ },
1769
+ []
1770
+ ), T = (x = c.customCardPreferences) == null ? void 0 : x.componentName, H = T ? h(T) : null, Y = Mn(
1771
+ (z = c.customCardPreferences) == null ? void 0 : z.settings,
1772
+ c
1773
+ ), G = U(
1774
+ () => Xn(v),
1775
+ [v]
1776
+ ), re = U(
1777
+ () => G.map(
1778
+ (d, g) => _e(
1779
+ d,
1780
+ g,
1781
+ y == null ? void 0 : y.slots
1782
+ )
1783
+ ),
1784
+ [G, y == null ? void 0 : y.slots]
1785
+ ), he = U(
1786
+ () => Ln(
1787
+ S === "multiple" ? Nn({
1788
+ slotOrderedCards: G,
1789
+ multiInputData: n,
1790
+ valueFormatPreferences: t
1791
+ }) : [
1792
+ {
1793
+ card: e,
1794
+ cardConfig: M,
1795
+ columns: R == null ? void 0 : R.columns,
1796
+ columnKeyMap: R == null ? void 0 : R.columnKeyMap,
1797
+ valueFormatPreferences: t
1798
+ }
1799
+ ]
1800
+ ),
1801
+ [
1802
+ e,
1803
+ R == null ? void 0 : R.columnKeyMap,
1804
+ R == null ? void 0 : R.columns,
1805
+ M,
1806
+ n,
1807
+ G,
1808
+ S,
1809
+ t
1810
+ ]
1811
+ );
1812
+ return T ? /* @__PURE__ */ _("div", { className: "semaphor-custom mb-3 flex grow basis-0 flex-col space-y-2 overflow-y-auto", children: /* @__PURE__ */ De(
1813
+ Pn,
1814
+ {
1815
+ fallback: /* @__PURE__ */ _(dt, {}),
1816
+ children: [
1817
+ H && S === "single" && /* @__PURE__ */ _(
1818
+ H,
1819
+ {
1820
+ editing: !0,
1821
+ params: o,
1822
+ theme: a,
1823
+ settings: Y,
1824
+ cardMetadata: _n({
1825
+ card: e,
1826
+ dataMetadata: R == null ? void 0 : R.metadata
1827
+ }),
1828
+ onDataChange: V,
1829
+ data: (R == null ? void 0 : R.records) || [],
1830
+ columns: (R == null ? void 0 : R.columns) || [],
1831
+ formatTemporalBucketValue: he,
1832
+ filters: L,
1833
+ filterValues: [
1834
+ ...W || [],
1835
+ ...f || []
1836
+ ],
1837
+ inlineFilters: A
1838
+ }
1839
+ ),
1840
+ H && S === "multiple" && /* @__PURE__ */ De(dt, { children: [
1841
+ v.map((d, g) => {
1842
+ if (!d) return null;
1843
+ const P = Qe(d, g), N = _e(
1844
+ d,
1845
+ P,
1846
+ y == null ? void 0 : y.slots
1847
+ );
1848
+ return /* @__PURE__ */ _(
1849
+ kn,
1850
+ {
1851
+ onDataChange: V,
1852
+ card: d,
1853
+ effectiveCardType: N
1854
+ },
1855
+ `${d.id}-${P}`
1856
+ );
1857
+ }),
1858
+ /* @__PURE__ */ _("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ _(
1859
+ H,
1860
+ {
1861
+ editing: !0,
1862
+ onDataChange: V,
1863
+ ...Tn({
1864
+ configCard: c,
1865
+ slotOrderedCards: G,
1866
+ slotTypes: re,
1867
+ multiInputData: n,
1868
+ params: o,
1869
+ theme: a,
1870
+ chartSettings: Y,
1871
+ filters: L,
1872
+ filterValues: [
1873
+ ...W || [],
1874
+ ...f || []
1875
+ ],
1876
+ inlineFilters: A,
1877
+ formatTemporalBucketValue: he
1878
+ })
1879
+ }
1880
+ ) })
1881
+ ] })
1882
+ ]
1883
+ },
1884
+ (C = c.customCardPreferences) == null ? void 0 : C.componentName
1885
+ ) }) : null;
1886
+ }
1887
+ const go = zn(Mr);
1888
+ var Jt = "Toggle", Zt = k.forwardRef((e, t) => {
1889
+ const { pressed: n, defaultPressed: r, onPressedChange: i, ...o } = e, [s, a] = Et({
1890
+ prop: n,
1891
+ onChange: i,
1892
+ defaultProp: r ?? !1,
1893
+ caller: Jt
1894
+ });
1895
+ return /* @__PURE__ */ _(
1896
+ ze.button,
1897
+ {
1898
+ type: "button",
1899
+ "aria-pressed": s,
1900
+ "data-state": s ? "on" : "off",
1901
+ "data-disabled": e.disabled ? "" : void 0,
1902
+ ...o,
1903
+ ref: t,
1904
+ onClick: pe(e.onClick, () => {
1905
+ e.disabled || a(!s);
1906
+ })
1907
+ }
1908
+ );
1909
+ });
1910
+ Zt.displayName = Jt;
1911
+ var en = Zt;
1912
+ const Lr = Vn(
1913
+ "inline-flex items-center justify-center rounded-control text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",
1914
+ {
1915
+ variants: {
1916
+ variant: {
1917
+ default: "bg-transparent",
1918
+ outline: "border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"
1919
+ },
1920
+ size: {
1921
+ default: "h-10 px-3",
1922
+ sm: "h-9 px-2.5",
1923
+ lg: "h-11 px-5"
1924
+ }
1925
+ },
1926
+ defaultVariants: {
1927
+ variant: "default",
1928
+ size: "default"
1929
+ }
1930
+ }
1931
+ ), Nr = k.forwardRef(({ className: e, variant: t, size: n, ...r }, i) => /* @__PURE__ */ _(
1932
+ en,
1933
+ {
1934
+ ref: i,
1935
+ className: rt(Lr({ variant: t, size: n, className: e })),
1936
+ ...r
1937
+ }
1938
+ ));
1939
+ Nr.displayName = en.displayName;
1940
+ var tn = ["PageUp", "PageDown"], nn = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], rn = {
1941
+ "from-left": ["Home", "PageDown", "ArrowDown", "ArrowLeft"],
1942
+ "from-right": ["Home", "PageDown", "ArrowDown", "ArrowRight"],
1943
+ "from-bottom": ["Home", "PageDown", "ArrowDown", "ArrowLeft"],
1944
+ "from-top": ["Home", "PageDown", "ArrowUp", "ArrowLeft"]
1945
+ }, we = "Slider", [Ze, _r, kr] = Kn(we), [on] = Fn(we, [
1946
+ kr
1947
+ ]), [Tr, qe] = on(we), sn = k.forwardRef(
1948
+ (e, t) => {
1949
+ const {
1950
+ name: n,
1951
+ min: r = 0,
1952
+ max: i = 100,
1953
+ step: o = 1,
1954
+ orientation: s = "horizontal",
1955
+ disabled: a = !1,
1956
+ minStepsBetweenThumbs: l = 0,
1957
+ defaultValue: f = [r],
1958
+ value: p,
1959
+ onValueChange: u = () => {
1960
+ },
1961
+ onValueCommit: c = () => {
1962
+ },
1963
+ inverted: h = !1,
1964
+ form: m,
1965
+ ...y
1966
+ } = e, S = k.useRef(/* @__PURE__ */ new Set()), v = k.useRef(0), b = s === "horizontal" ? Hr : $r, [I = [], R] = Et({
1967
+ prop: p,
1968
+ defaultProp: f,
1969
+ onChange: (A) => {
1970
+ var W;
1971
+ (W = [...S.current][v.current]) == null || W.focus(), u(A);
1972
+ }
1973
+ }), M = k.useRef(I);
1974
+ function w(A) {
1975
+ const L = qr(I, A);
1976
+ $(A, L);
1977
+ }
1978
+ function X(A) {
1979
+ $(A, v.current);
1980
+ }
1981
+ function j() {
1982
+ const A = M.current[v.current];
1983
+ I[v.current] !== A && c(I);
1984
+ }
1985
+ function $(A, L, { commit: W } = { commit: !1 }) {
1986
+ const V = Wr(o), T = Xr(Math.round((A - r) / o) * o + r, V), H = It(T, [r, i]);
1987
+ R((Y = []) => {
1988
+ const G = Kr(Y, H, L);
1989
+ if (Ur(G, l * o)) {
1990
+ v.current = G.indexOf(H);
1991
+ const re = String(G) !== String(Y);
1992
+ return re && W && c(G), re ? G : Y;
1993
+ } else
1994
+ return Y;
1995
+ });
1996
+ }
1997
+ return /* @__PURE__ */ _(
1998
+ Tr,
1999
+ {
2000
+ scope: e.__scopeSlider,
2001
+ name: n,
2002
+ disabled: a,
2003
+ min: r,
2004
+ max: i,
2005
+ valueIndexToChangeRef: v,
2006
+ thumbs: S.current,
2007
+ values: I,
2008
+ orientation: s,
2009
+ form: m,
2010
+ children: /* @__PURE__ */ _(Ze.Provider, { scope: e.__scopeSlider, children: /* @__PURE__ */ _(Ze.Slot, { scope: e.__scopeSlider, children: /* @__PURE__ */ _(
2011
+ b,
2012
+ {
2013
+ "aria-disabled": a,
2014
+ "data-disabled": a ? "" : void 0,
2015
+ ...y,
2016
+ ref: t,
2017
+ onPointerDown: pe(y.onPointerDown, () => {
2018
+ a || (M.current = I);
2019
+ }),
2020
+ min: r,
2021
+ max: i,
2022
+ inverted: h,
2023
+ onSlideStart: a ? void 0 : w,
2024
+ onSlideMove: a ? void 0 : X,
2025
+ onSlideEnd: a ? void 0 : j,
2026
+ onHomeKeyDown: () => !a && $(r, 0, { commit: !0 }),
2027
+ onEndKeyDown: () => !a && $(i, I.length - 1, { commit: !0 }),
2028
+ onStepKeyDown: ({ event: A, direction: L }) => {
2029
+ if (!a) {
2030
+ const T = tn.includes(A.key) || A.shiftKey && nn.includes(A.key) ? 10 : 1, H = v.current, Y = I[H], G = o * T * L;
2031
+ $(Y + G, H, { commit: !0 });
2032
+ }
2033
+ }
2034
+ }
2035
+ ) }) })
2036
+ }
2037
+ );
2038
+ }
2039
+ );
2040
+ sn.displayName = we;
2041
+ var [an, ln] = on(we, {
2042
+ startEdge: "left",
2043
+ endEdge: "right",
2044
+ size: "width",
2045
+ direction: 1
2046
+ }), Hr = k.forwardRef(
2047
+ (e, t) => {
2048
+ const {
2049
+ min: n,
2050
+ max: r,
2051
+ dir: i,
2052
+ inverted: o,
2053
+ onSlideStart: s,
2054
+ onSlideMove: a,
2055
+ onSlideEnd: l,
2056
+ onStepKeyDown: f,
2057
+ ...p
2058
+ } = e, [u, c] = k.useState(null), h = Pe(t, (b) => c(b)), m = k.useRef(void 0), y = Bn(i), S = y === "ltr", v = S && !o || !S && o;
2059
+ function D(b) {
2060
+ const I = m.current || u.getBoundingClientRect(), R = [0, I.width], w = lt(R, v ? [n, r] : [r, n]);
2061
+ return m.current = I, w(b - I.left);
2062
+ }
2063
+ return /* @__PURE__ */ _(
2064
+ an,
2065
+ {
2066
+ scope: e.__scopeSlider,
2067
+ startEdge: v ? "left" : "right",
2068
+ endEdge: v ? "right" : "left",
2069
+ direction: v ? 1 : -1,
2070
+ size: "width",
2071
+ children: /* @__PURE__ */ _(
2072
+ cn,
2073
+ {
2074
+ dir: y,
2075
+ "data-orientation": "horizontal",
2076
+ ...p,
2077
+ ref: h,
2078
+ style: {
2079
+ ...p.style,
2080
+ "--radix-slider-thumb-transform": "translateX(-50%)"
2081
+ },
2082
+ onSlideStart: (b) => {
2083
+ const I = D(b.clientX);
2084
+ s == null || s(I);
2085
+ },
2086
+ onSlideMove: (b) => {
2087
+ const I = D(b.clientX);
2088
+ a == null || a(I);
2089
+ },
2090
+ onSlideEnd: () => {
2091
+ m.current = void 0, l == null || l();
2092
+ },
2093
+ onStepKeyDown: (b) => {
2094
+ const R = rn[v ? "from-left" : "from-right"].includes(b.key);
2095
+ f == null || f({ event: b, direction: R ? -1 : 1 });
2096
+ }
2097
+ }
2098
+ )
2099
+ }
2100
+ );
2101
+ }
2102
+ ), $r = k.forwardRef(
2103
+ (e, t) => {
2104
+ const {
2105
+ min: n,
2106
+ max: r,
2107
+ inverted: i,
2108
+ onSlideStart: o,
2109
+ onSlideMove: s,
2110
+ onSlideEnd: a,
2111
+ onStepKeyDown: l,
2112
+ ...f
2113
+ } = e, p = k.useRef(null), u = Pe(t, p), c = k.useRef(void 0), h = !i;
2114
+ function m(y) {
2115
+ const S = c.current || p.current.getBoundingClientRect(), v = [0, S.height], b = lt(v, h ? [r, n] : [n, r]);
2116
+ return c.current = S, b(y - S.top);
2117
+ }
2118
+ return /* @__PURE__ */ _(
2119
+ an,
2120
+ {
2121
+ scope: e.__scopeSlider,
2122
+ startEdge: h ? "bottom" : "top",
2123
+ endEdge: h ? "top" : "bottom",
2124
+ size: "height",
2125
+ direction: h ? 1 : -1,
2126
+ children: /* @__PURE__ */ _(
2127
+ cn,
2128
+ {
2129
+ "data-orientation": "vertical",
2130
+ ...f,
2131
+ ref: u,
2132
+ style: {
2133
+ ...f.style,
2134
+ "--radix-slider-thumb-transform": "translateY(50%)"
2135
+ },
2136
+ onSlideStart: (y) => {
2137
+ const S = m(y.clientY);
2138
+ o == null || o(S);
2139
+ },
2140
+ onSlideMove: (y) => {
2141
+ const S = m(y.clientY);
2142
+ s == null || s(S);
2143
+ },
2144
+ onSlideEnd: () => {
2145
+ c.current = void 0, a == null || a();
2146
+ },
2147
+ onStepKeyDown: (y) => {
2148
+ const v = rn[h ? "from-bottom" : "from-top"].includes(y.key);
2149
+ l == null || l({ event: y, direction: v ? -1 : 1 });
2150
+ }
2151
+ }
2152
+ )
2153
+ }
2154
+ );
2155
+ }
2156
+ ), cn = k.forwardRef(
2157
+ (e, t) => {
2158
+ const {
2159
+ __scopeSlider: n,
2160
+ onSlideStart: r,
2161
+ onSlideMove: i,
2162
+ onSlideEnd: o,
2163
+ onHomeKeyDown: s,
2164
+ onEndKeyDown: a,
2165
+ onStepKeyDown: l,
2166
+ ...f
2167
+ } = e, p = qe(we, n);
2168
+ return /* @__PURE__ */ _(
2169
+ ze.span,
2170
+ {
2171
+ ...f,
2172
+ ref: t,
2173
+ onKeyDown: pe(e.onKeyDown, (u) => {
2174
+ u.key === "Home" ? (s(u), u.preventDefault()) : u.key === "End" ? (a(u), u.preventDefault()) : tn.concat(nn).includes(u.key) && (l(u), u.preventDefault());
2175
+ }),
2176
+ onPointerDown: pe(e.onPointerDown, (u) => {
2177
+ const c = u.target;
2178
+ c.setPointerCapture(u.pointerId), u.preventDefault(), p.thumbs.has(c) ? c.focus() : r(u);
2179
+ }),
2180
+ onPointerMove: pe(e.onPointerMove, (u) => {
2181
+ u.target.hasPointerCapture(u.pointerId) && i(u);
2182
+ }),
2183
+ onPointerUp: pe(e.onPointerUp, (u) => {
2184
+ const c = u.target;
2185
+ c.hasPointerCapture(u.pointerId) && (c.releasePointerCapture(u.pointerId), o(u));
2186
+ })
2187
+ }
2188
+ );
2189
+ }
2190
+ ), un = "SliderTrack", dn = k.forwardRef(
2191
+ (e, t) => {
2192
+ const { __scopeSlider: n, ...r } = e, i = qe(un, n);
2193
+ return /* @__PURE__ */ _(
2194
+ ze.span,
2195
+ {
2196
+ "data-disabled": i.disabled ? "" : void 0,
2197
+ "data-orientation": i.orientation,
2198
+ ...r,
2199
+ ref: t
2200
+ }
2201
+ );
2202
+ }
2203
+ );
2204
+ dn.displayName = un;
2205
+ var et = "SliderRange", fn = k.forwardRef(
2206
+ (e, t) => {
2207
+ const { __scopeSlider: n, ...r } = e, i = qe(et, n), o = ln(et, n), s = k.useRef(null), a = Pe(t, s), l = i.values.length, f = i.values.map(
2208
+ (c) => gn(c, i.min, i.max)
2209
+ ), p = l > 1 ? Math.min(...f) : 0, u = 100 - Math.max(...f);
2210
+ return /* @__PURE__ */ _(
2211
+ ze.span,
2212
+ {
2213
+ "data-orientation": i.orientation,
2214
+ "data-disabled": i.disabled ? "" : void 0,
2215
+ ...r,
2216
+ ref: a,
2217
+ style: {
2218
+ ...e.style,
2219
+ [o.startEdge]: p + "%",
2220
+ [o.endEdge]: u + "%"
2221
+ }
2222
+ }
2223
+ );
2224
+ }
2225
+ );
2226
+ fn.displayName = et;
2227
+ var tt = "SliderThumb", pn = k.forwardRef(
2228
+ (e, t) => {
2229
+ const n = _r(e.__scopeSlider), [r, i] = k.useState(null), o = Pe(t, (a) => i(a)), s = k.useMemo(
2230
+ () => r ? n().findIndex((a) => a.ref.current === r) : -1,
2231
+ [n, r]
2232
+ );
2233
+ return /* @__PURE__ */ _(Vr, { ...e, ref: o, index: s });
2234
+ }
2235
+ ), Vr = k.forwardRef(
2236
+ (e, t) => {
2237
+ const { __scopeSlider: n, index: r, name: i, ...o } = e, s = qe(tt, n), a = ln(tt, n), [l, f] = k.useState(null), p = Pe(t, (D) => f(D)), u = l ? s.form || !!l.closest("form") : !0, c = qn(l), h = s.values[r], m = h === void 0 ? 0 : gn(h, s.min, s.max), y = Br(r, s.values.length), S = c == null ? void 0 : c[a.size], v = S ? Gr(S, m, a.direction) : 0;
2238
+ return k.useEffect(() => {
2239
+ if (l)
2240
+ return s.thumbs.add(l), () => {
2241
+ s.thumbs.delete(l);
2242
+ };
2243
+ }, [l, s.thumbs]), /* @__PURE__ */ De(
2244
+ "span",
2245
+ {
2246
+ style: {
2247
+ transform: "var(--radix-slider-thumb-transform)",
2248
+ position: "absolute",
2249
+ [a.startEdge]: `calc(${m}% + ${v}px)`
2250
+ },
2251
+ children: [
2252
+ /* @__PURE__ */ _(Ze.ItemSlot, { scope: e.__scopeSlider, children: /* @__PURE__ */ _(
2253
+ ze.span,
2254
+ {
2255
+ role: "slider",
2256
+ "aria-label": e["aria-label"] || y,
2257
+ "aria-valuemin": s.min,
2258
+ "aria-valuenow": h,
2259
+ "aria-valuemax": s.max,
2260
+ "aria-orientation": s.orientation,
2261
+ "data-orientation": s.orientation,
2262
+ "data-disabled": s.disabled ? "" : void 0,
2263
+ tabIndex: s.disabled ? void 0 : 0,
2264
+ ...o,
2265
+ ref: p,
2266
+ style: h === void 0 ? { display: "none" } : e.style,
2267
+ onFocus: pe(e.onFocus, () => {
2268
+ s.valueIndexToChangeRef.current = r;
2269
+ })
2270
+ }
2271
+ ) }),
2272
+ u && /* @__PURE__ */ _(
2273
+ mn,
2274
+ {
2275
+ name: i ?? (s.name ? s.name + (s.values.length > 1 ? "[]" : "") : void 0),
2276
+ form: s.form,
2277
+ value: h
2278
+ },
2279
+ r
2280
+ )
2281
+ ]
2282
+ }
2283
+ );
2284
+ }
2285
+ );
2286
+ pn.displayName = tt;
2287
+ var Fr = "RadioBubbleInput", mn = k.forwardRef(
2288
+ ({ __scopeSlider: e, value: t, ...n }, r) => {
2289
+ const i = k.useRef(null), o = Pe(i, r), s = Gn(t);
2290
+ return k.useEffect(() => {
2291
+ const a = i.current;
2292
+ if (!a) return;
2293
+ const l = window.HTMLInputElement.prototype, p = Object.getOwnPropertyDescriptor(l, "value").set;
2294
+ if (s !== t && p) {
2295
+ const u = new Event("input", { bubbles: !0 });
2296
+ p.call(a, t), a.dispatchEvent(u);
2297
+ }
2298
+ }, [s, t]), /* @__PURE__ */ _(
2299
+ ze.input,
2300
+ {
2301
+ style: { display: "none" },
2302
+ ...n,
2303
+ ref: o,
2304
+ defaultValue: t
2305
+ }
2306
+ );
2307
+ }
2308
+ );
2309
+ mn.displayName = Fr;
2310
+ function Kr(e = [], t, n) {
2311
+ const r = [...e];
2312
+ return r[n] = t, r.sort((i, o) => i - o);
2313
+ }
2314
+ function gn(e, t, n) {
2315
+ const o = 100 / (n - t) * (e - t);
2316
+ return It(o, [0, 100]);
2317
+ }
2318
+ function Br(e, t) {
2319
+ return t > 2 ? `Value ${e + 1} of ${t}` : t === 2 ? ["Minimum", "Maximum"][e] : void 0;
2320
+ }
2321
+ function qr(e, t) {
2322
+ if (e.length === 1) return 0;
2323
+ const n = e.map((i) => Math.abs(i - t)), r = Math.min(...n);
2324
+ return n.indexOf(r);
2325
+ }
2326
+ function Gr(e, t, n) {
2327
+ const r = e / 2, o = lt([0, 50], [0, r]);
2328
+ return (r - o(t) * n) * n;
2329
+ }
2330
+ function Or(e) {
2331
+ return e.slice(0, -1).map((t, n) => e[n + 1] - t);
2332
+ }
2333
+ function Ur(e, t) {
2334
+ if (t > 0) {
2335
+ const n = Or(e);
2336
+ return Math.min(...n) >= t;
2337
+ }
2338
+ return !0;
2339
+ }
2340
+ function lt(e, t) {
2341
+ return (n) => {
2342
+ if (e[0] === e[1] || t[0] === t[1]) return t[0];
2343
+ const r = (t[1] - t[0]) / (e[1] - e[0]);
2344
+ return t[0] + r * (n - e[0]);
2345
+ };
2346
+ }
2347
+ function Wr(e) {
2348
+ return (String(e).split(".")[1] || "").length;
2349
+ }
2350
+ function Xr(e, t) {
2351
+ const n = Math.pow(10, t);
2352
+ return Math.round(e * n) / n;
2353
+ }
2354
+ var hn = sn, Yr = dn, jr = fn, Qr = pn;
2355
+ const Jr = k.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ De(
2356
+ hn,
2357
+ {
2358
+ ref: n,
2359
+ className: rt(
2360
+ "relative flex w-full touch-none select-none items-center",
2361
+ e
2362
+ ),
2363
+ ...t,
2364
+ children: [
2365
+ /* @__PURE__ */ _(Yr, { className: "relative h-2 w-full grow overflow-hidden rounded-full bg-secondary", children: /* @__PURE__ */ _(jr, { className: "absolute h-full bg-primary" }) }),
2366
+ /* @__PURE__ */ _(Qr, { className: "block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50" })
2367
+ ]
2368
+ }
2369
+ ));
2370
+ Jr.displayName = hn.displayName;
2371
+ export {
2372
+ go as E,
2373
+ fo as F,
2374
+ Jn as P,
2375
+ po as S,
2376
+ Nr as T,
2377
+ Pr as a,
2378
+ Cr as b,
2379
+ mo as c,
2380
+ Jr as d,
2381
+ Qt as r,
2382
+ Yt as u
2383
+ };