react-semaphor 0.1.543 → 0.1.545

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