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
@@ -1,2407 +0,0 @@
1
- import { jsxs as De, jsx as _, Fragment as ft } from "react/jsx-runtime";
2
- import * as k from "react";
3
- import xn, { forwardRef as $e, createElement as xe, useContext as nt, createContext as xt, useRef as B, useLayoutEffect as zn, useImperativeHandle as zt, useEffect as Z, useState as ue, useCallback as O, useMemo as U, memo as Pn, Suspense as wn, useSyncExternalStore as Cn } from "react";
4
- import { aS as En, Z as te, aT as Pt, _ as wt, aU as rt, aV as Ct, aW as In, aX as Rn, aY as Dn, aZ as An, u as Ge, a_ as Mn, a$ as Nn, b0 as Ln, b1 as _n, b2 as kn, b3 as Tn, b4 as Hn, b5 as $n } from "./semaphor-ready-indicator-CN2AHm2x.js";
5
- import { C as Et, y as It, z as ze, A as pe, D as Vn, E as Fn, F as Kn, G as Pe, H as Bn, J as Rt, K as qn, M as On } from "./switch-C3jLxlG0.js";
6
- import { f as Gn, r as Dt } from "./editor-draft-sync-BN5qYHPF.js";
7
- import { a4 as Un, a5 as Wn, a6 as Xn } from "./document-dashboard-inputs-OwqCbrVp.js";
8
- import { f as Yn, r as At, g as Mt, a as Qe, c as _e, n as jn, b as Qn } from "./custom-visual-inputs-DUtpYZOk.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 ot } from "./class-utils-Df1OVOT1.js";
16
- import { u as Jn } from "./appearance-context-DEYtWinQ.js";
17
- const bo = xn.memo(function({
18
- context: t = "editor"
19
- } = {}) {
20
- return /* @__PURE__ */ De(
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__ */ _(En, { context: t }),
28
- " "
29
- ]
30
- }
31
- );
32
- }), Ve = xt(null);
33
- Ve.displayName = "PanelGroupContext";
34
- const K = {
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 = zn, pt = k.useId, Zn = typeof pt == "function" ? pt : () => null;
48
- let er = 0;
49
- function st(e = null) {
50
- const t = Zn(), n = B(e || t || null);
51
- return n.current === null && (n.current = "" + er++), e ?? n.current;
52
- }
53
- function Nt({
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: f,
64
- onExpand: p,
65
- onResize: u,
66
- order: c,
67
- style: h,
68
- tagName: m = "div",
69
- ...y
70
- }) {
71
- const S = nt(Ve);
72
- if (S === null)
73
- throw Error("Panel components must be rendered within a PanelGroup container");
74
- const {
75
- collapsePanel: v,
76
- expandPanel: D,
77
- getPanelSize: x,
78
- getPanelStyle: I,
79
- groupId: R,
80
- isPanelCollapsed: M,
81
- reevaluatePanelConstraints: w,
82
- registerPanel: X,
83
- resizePanel: j,
84
- unregisterPanel: $
85
- } = S, A = st(s), N = B({
86
- callbacks: {
87
- onCollapse: f,
88
- onExpand: p,
89
- onResize: u
90
- },
91
- constraints: {
92
- collapsedSize: n,
93
- collapsible: r,
94
- defaultSize: i,
95
- maxSize: l,
96
- minSize: a
97
- },
98
- id: A,
99
- idIsFromProps: s !== void 0,
100
- order: c
101
- });
102
- B({
103
- didLogMissingDefaultSizeWarning: !1
104
- }), me(() => {
105
- const {
106
- callbacks: V,
107
- constraints: T
108
- } = N.current, H = {
109
- ...T
110
- };
111
- N.current.id = A, N.current.idIsFromProps = s !== void 0, N.current.order = c, V.onCollapse = f, V.onExpand = p, V.onResize = u, T.collapsedSize = n, T.collapsible = r, T.defaultSize = i, T.maxSize = l, T.minSize = a, (H.collapsedSize !== T.collapsedSize || H.collapsible !== T.collapsible || H.maxSize !== T.maxSize || H.minSize !== T.minSize) && w(N.current, H);
112
- }), me(() => {
113
- const V = N.current;
114
- return X(V), () => {
115
- $(V);
116
- };
117
- }, [c, A, X, $]), zt(o, () => ({
118
- collapse: () => {
119
- v(N.current);
120
- },
121
- expand: (V) => {
122
- D(N.current, V);
123
- },
124
- getId() {
125
- return A;
126
- },
127
- getSize() {
128
- return x(N.current);
129
- },
130
- isCollapsed() {
131
- return M(N.current);
132
- },
133
- isExpanded() {
134
- return !M(N.current);
135
- },
136
- resize: (V) => {
137
- j(N.current, V);
138
- }
139
- }), [v, D, x, M, A, j]);
140
- const W = I(N.current, i);
141
- return xe(m, {
142
- ...y,
143
- children: e,
144
- className: t,
145
- id: A,
146
- style: {
147
- ...W,
148
- ...h
149
- },
150
- // CSS selectors
151
- [K.groupId]: R,
152
- [K.panel]: "",
153
- [K.panelCollapsible]: r || void 0,
154
- [K.panelId]: A,
155
- [K.panelSize]: parseFloat("" + W.flexGrow).toFixed(1)
156
- });
157
- }
158
- const tr = $e((e, t) => xe(Nt, {
159
- ...e,
160
- forwardedRef: t
161
- }));
162
- Nt.displayName = "Panel";
163
- tr.displayName = "forwardRef(Panel)";
164
- let Je = null, ke = -1, ce = null;
165
- function nr(e, t) {
166
- if (t) {
167
- const n = (t & Ht) !== 0, r = (t & $t) !== 0, i = (t & Vt) !== 0, o = (t & Ft) !== 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
- ce !== null && (document.head.removeChild(ce), Je = null, ce = null, ke = -1);
188
- }
189
- function Ue(e, t) {
190
- var n, r;
191
- const i = nr(e, t);
192
- if (Je !== i) {
193
- if (Je = i, ce === null && (ce = document.createElement("style"), document.head.appendChild(ce)), ke >= 0) {
194
- var o;
195
- (o = ce.sheet) === null || o === void 0 || o.removeRule(ke);
196
- }
197
- ke = (n = (r = ce.sheet) === null || r === void 0 ? void 0 : r.insertRule(`*{cursor: ${i} !important;}`)) !== null && n !== void 0 ? n : -1;
198
- }
199
- }
200
- function Lt(e) {
201
- return e.type === "keydown";
202
- }
203
- function _t(e) {
204
- return e.type.startsWith("pointer");
205
- }
206
- function kt(e) {
207
- return e.type.startsWith("mouse");
208
- }
209
- function Fe(e) {
210
- if (_t(e)) {
211
- if (e.isPrimary)
212
- return {
213
- x: e.clientX,
214
- y: e.clientY
215
- };
216
- } else if (kt(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
- E(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 = Tt(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 (E(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 = Tt(e);
286
- return t;
287
- }
288
- function Tt(e) {
289
- const {
290
- parentNode: t
291
- } = e;
292
- return t && t instanceof ShadowRoot ? t.host : t;
293
- }
294
- const Ht = 1, $t = 2, Vt = 4, Ft = 8, ur = or() === "coarse";
295
- let ne = [], be = !1, fe = /* @__PURE__ */ new Map(), Ke = /* @__PURE__ */ new Map();
296
- const Ae = /* @__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), Ae.add(l), Te(), function() {
308
- var p;
309
- Ke.delete(e), Ae.delete(l);
310
- const u = (p = fe.get(s)) !== null && p !== void 0 ? p : 1;
311
- if (fe.set(s, u - 1), Te(), u === 1 && fe.delete(s), ne.includes(l)) {
312
- const c = ne.indexOf(l);
313
- c >= 0 && ne.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
- } = Fe(e);
324
- be = !0, lt({
325
- target: t,
326
- x: n,
327
- y: r
328
- }), Te(), ne.length > 0 && (He("down", e), e.preventDefault(), Kt(t) || e.stopImmediatePropagation());
329
- }
330
- function We(e) {
331
- const {
332
- x: t,
333
- y: n
334
- } = Fe(e);
335
- if (be && e.buttons === 0 && (be = !1, He("up", e)), !be) {
336
- const {
337
- target: r
338
- } = e;
339
- lt({
340
- target: r,
341
- x: t,
342
- y: n
343
- });
344
- }
345
- He("move", e), at(), ne.length > 0 && e.preventDefault();
346
- }
347
- function Xe(e) {
348
- const {
349
- target: t
350
- } = e, {
351
- x: n,
352
- y: r
353
- } = Fe(e);
354
- Ke.clear(), be = !1, ne.length > 0 && (e.preventDefault(), Kt(t) || e.stopImmediatePropagation()), He("up", e), lt({
355
- target: t,
356
- x: n,
357
- y: r
358
- }), at(), Te();
359
- }
360
- function Kt(e) {
361
- let t = e;
362
- for (; t; ) {
363
- if (t.hasAttribute(K.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
- ne.splice(0);
375
- let r = null;
376
- (e instanceof HTMLElement || e instanceof SVGElement) && (r = e), Ae.forEach((i) => {
377
- const {
378
- element: o,
379
- hitAreaMargins: s
380
- } = i, l = o.getBoundingClientRect(), {
381
- bottom: a,
382
- left: f,
383
- right: p,
384
- top: u
385
- } = l, c = ur ? s.coarse : s.fine;
386
- if (t >= f - c && t <= p + 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 m = r, y = !1;
392
- for (; m && !m.contains(o); ) {
393
- if (ir(m.getBoundingClientRect(), l)) {
394
- y = !0;
395
- break;
396
- }
397
- m = m.parentElement;
398
- }
399
- if (y)
400
- return;
401
- }
402
- ne.push(i);
403
- }
404
- });
405
- }
406
- function Ye(e, t) {
407
- Ke.set(e, t);
408
- }
409
- function at() {
410
- let e = !1, t = !1;
411
- ne.forEach((r) => {
412
- const {
413
- direction: i
414
- } = r;
415
- i === "horizontal" ? e = !0 : t = !0;
416
- });
417
- let n = 0;
418
- Ke.forEach((r) => {
419
- n |= r;
420
- }), e && t ? Ue("intersection", n) : e ? Ue("horizontal", n) : t ? Ue("vertical", n) : rr();
421
- }
422
- let je = new AbortController();
423
- function Te() {
424
- je.abort(), je = new AbortController();
425
- const e = {
426
- capture: !0,
427
- signal: je.signal
428
- };
429
- Ae.size && (be ? (ne.length > 0 && fe.forEach((t, n) => {
430
- const {
431
- body: r
432
- } = n;
433
- t > 0 && (r.addEventListener("contextmenu", Xe, e), r.addEventListener("pointerleave", We, e), r.addEventListener("pointermove", We, e));
434
- }), window.addEventListener("pointerup", Xe, e), window.addEventListener("pointercancel", Xe, e)) : fe.forEach((t, n) => {
435
- const {
436
- body: r
437
- } = n;
438
- t > 0 && (r.addEventListener("pointerdown", fr, e), r.addEventListener("pointermove", We, e));
439
- }));
440
- }
441
- function He(e, t) {
442
- Ae.forEach((n) => {
443
- const {
444
- setResizeHandlerState: r
445
- } = n, i = ne.includes(n);
446
- r(e, i, t);
447
- });
448
- }
449
- function pr() {
450
- const [e, t] = ue(0);
451
- return O(() => t((n) => n + 1), []);
452
- }
453
- function E(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 J(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 (!J(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
- E(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 Ie({
498
- delta: e,
499
- initialLayout: t,
500
- panelConstraints: n,
501
- pivotIndices: r,
502
- prevLayout: i,
503
- trigger: o
504
- }) {
505
- if (J(e, 0))
506
- return t;
507
- const s = [...t], [l, a] = r;
508
- E(l != null, "Invalid first pivot index"), E(a != null, "Invalid second pivot index");
509
- let f = 0;
510
- if (o === "keyboard") {
511
- {
512
- const u = e < 0 ? a : l, c = n[u];
513
- E(c, `Panel constraints not found for index ${u}`);
514
- const {
515
- collapsedSize: h = 0,
516
- collapsible: m,
517
- minSize: y = 0
518
- } = c;
519
- if (m) {
520
- const S = t[u];
521
- if (E(S != null, `Previous layout not found for panel index ${u}`), J(S, h)) {
522
- const v = y - S;
523
- ge(v, Math.abs(e)) > 0 && (e = e < 0 ? 0 - v : v);
524
- }
525
- }
526
- }
527
- {
528
- const u = e < 0 ? l : a, c = n[u];
529
- E(c, `No panel constraints found for index ${u}`);
530
- const {
531
- collapsedSize: h = 0,
532
- collapsible: m,
533
- minSize: y = 0
534
- } = c;
535
- if (m) {
536
- const S = t[u];
537
- if (E(S != null, `Previous layout not found for panel index ${u}`), J(S, y)) {
538
- const v = S - h;
539
- ge(v, Math.abs(e)) > 0 && (e = e < 0 ? 0 - v : v);
540
- }
541
- }
542
- }
543
- }
544
- {
545
- const u = e < 0 ? 1 : -1;
546
- let c = e < 0 ? a : l, h = 0;
547
- for (; ; ) {
548
- const y = t[c];
549
- E(y != null, `Previous layout not found for panel index ${c}`);
550
- const v = Se({
551
- panelConstraints: n,
552
- panelIndex: c,
553
- size: 100
554
- }) - y;
555
- if (h += v, c += u, c < 0 || c >= n.length)
556
- break;
557
- }
558
- const m = Math.min(Math.abs(e), Math.abs(h));
559
- e = e < 0 ? 0 - m : m;
560
- }
561
- {
562
- let c = e < 0 ? l : a;
563
- for (; c >= 0 && c < n.length; ) {
564
- const h = Math.abs(e) - Math.abs(f), m = t[c];
565
- E(m != null, `Previous layout not found for panel index ${c}`);
566
- const y = m - h, S = Se({
567
- panelConstraints: n,
568
- panelIndex: c,
569
- size: y
570
- });
571
- if (!J(m, S) && (f += m - S, s[c] = S, f.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
- E(c != null, `Previous layout not found for panel index ${u}`);
583
- const h = c + f, m = Se({
584
- panelConstraints: n,
585
- panelIndex: u,
586
- size: h
587
- });
588
- if (s[u] = m, !J(m, h)) {
589
- let y = h - m, v = e < 0 ? a : l;
590
- for (; v >= 0 && v < n.length; ) {
591
- const D = s[v];
592
- E(D != null, `Previous layout not found for panel index ${v}`);
593
- const x = D + y, I = Se({
594
- panelConstraints: n,
595
- panelIndex: v,
596
- size: x
597
- });
598
- if (J(D, I) || (y -= I - D, s[v] = I), J(y, 0))
599
- break;
600
- e > 0 ? v-- : v++;
601
- }
602
- }
603
- }
604
- const p = s.reduce((u, c) => c + u, 0);
605
- return J(p, 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
- E(l != null, "No pivot index found"), t.forEach((u, c) => {
615
- const {
616
- constraints: h
617
- } = u, {
618
- maxSize: m = 100,
619
- minSize: y = 0
620
- } = h;
621
- c === l ? (r = y, i = m) : (o += y, s += m);
622
- });
623
- const a = Math.min(i, 100 - o), f = Math.max(r, 100 - s), p = e[l];
624
- return {
625
- valueMax: a,
626
- valueMin: f,
627
- valueNow: p
628
- };
629
- }
630
- function Me(e, t = document) {
631
- return Array.from(t.querySelectorAll(`[${K.resizeHandleId}][data-panel-group-id="${e}"]`));
632
- }
633
- function Bt(e, t, n = document) {
634
- const i = Me(e, n).findIndex((o) => o.getAttribute(K.resizeHandleId) === t);
635
- return i ?? null;
636
- }
637
- function qt(e, t, n) {
638
- const r = Bt(e, t, n);
639
- return r != null ? [r, r + 1] : [-1, -1];
640
- }
641
- function Ot(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 Be(e, t = document) {
649
- const n = t.querySelector(`[${K.resizeHandleId}="${e}"]`);
650
- return n || null;
651
- }
652
- function hr(e, t, n, r = document) {
653
- var i, o, s, l;
654
- const a = Be(t, r), f = Me(e, r), p = a ? f.indexOf(a) : -1, u = (i = (o = n[p]) === null || o === void 0 ? void 0 : o.id) !== null && i !== void 0 ? i : null, c = (s = (l = n[p + 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
- B({
667
- didWarnAboutMissingResizeHandle: !1
668
- }), me(() => {
669
- if (!o)
670
- return;
671
- const l = Me(n, o);
672
- for (let a = 0; a < i.length - 1; a++) {
673
- const {
674
- valueMax: f,
675
- valueMin: p,
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 h = i[a];
684
- E(h, `No panel data found for index "${a}"`), 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) : "");
685
- }
686
- }
687
- return () => {
688
- l.forEach((a, f) => {
689
- a.removeAttribute("aria-controls"), a.removeAttribute("aria-valuemax"), a.removeAttribute("aria-valuemin"), a.removeAttribute("aria-valuenow");
690
- });
691
- };
692
- }, [n, r, i, o]), Z(() => {
693
- if (!o)
694
- return;
695
- const l = t.current;
696
- E(l, "Eager values not found");
697
- const {
698
- panelDataArray: a
699
- } = l, f = Ot(n, o);
700
- E(f != null, `No group found for id "${n}"`);
701
- const p = Me(n, o);
702
- E(p, `No resize handles found for group id "${n}"`);
703
- const u = p.map((c) => {
704
- const h = c.getAttribute(K.resizeHandleId);
705
- E(h, "Resize handle element has no handle id attribute");
706
- const [m, y] = hr(n, h, a, o);
707
- if (m == null || y == null)
708
- return () => {
709
- };
710
- const S = (v) => {
711
- if (!v.defaultPrevented)
712
- switch (v.key) {
713
- case "Enter": {
714
- v.preventDefault();
715
- const D = a.findIndex((x) => x.id === m);
716
- if (D >= 0) {
717
- const x = a[D];
718
- E(x, `No panel data found for index ${D}`);
719
- const I = r[D], {
720
- collapsedSize: R = 0,
721
- collapsible: M,
722
- minSize: w = 0
723
- } = x.constraints;
724
- if (I != null && M) {
725
- const X = Ie({
726
- delta: J(I, R) ? w - R : R - I,
727
- initialLayout: r,
728
- panelConstraints: a.map((j) => j.constraints),
729
- pivotIndices: qt(n, h, 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", S), () => {
741
- c.removeEventListener("keydown", S);
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 Gt(e, t) {
758
- const n = e === "horizontal", {
759
- x: r,
760
- y: i
761
- } = Fe(t);
762
- return n ? r : i;
763
- }
764
- function vr(e, t, n, r, i) {
765
- const o = n === "horizontal", s = Be(t, i);
766
- E(s, `No resize handle element found for id "${t}"`);
767
- const l = s.getAttribute(K.groupId);
768
- E(l, "Resize handle element has no group id attribute");
769
- let {
770
- initialCursorPosition: a
771
- } = r;
772
- const f = Gt(n, e), p = Ot(l, i);
773
- E(p, `No group element found for id "${l}"`);
774
- const u = p.getBoundingClientRect(), c = o ? u.width : u.height;
775
- return (f - a) / c * 100;
776
- }
777
- function Sr(e, t, n, r, i, o) {
778
- if (Lt(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
- E(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
- E(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, f = i / a;
829
- r++, t[o] = f, i -= f;
830
- }
831
- return t;
832
- }
833
- function ye(e, t, n) {
834
- t.forEach((r, i) => {
835
- const o = e[i];
836
- E(o, `Panel data not found for index ${i}`);
837
- const {
838
- callbacks: s,
839
- constraints: l,
840
- id: a
841
- } = o, {
842
- collapsedSize: f = 0,
843
- collapsible: p
844
- } = l, u = n[a];
845
- if (u == null || r !== u) {
846
- n[a] = r;
847
- const {
848
- onCollapse: c,
849
- onExpand: h,
850
- onResize: m
851
- } = s;
852
- m && m(r, u), p && (c || h) && (h && (u == null || le(u, f)) && !le(r, f) && h(), c && (u == null || !le(u, f)) && le(r, f) && c());
853
- }
854
- });
855
- }
856
- function Le(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 Ut(e) {
907
- return `react-resizable-panels:${e}`;
908
- }
909
- function Wt(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 Xt(e, t) {
921
- try {
922
- const n = Ut(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 = Xt(e, n)) !== null && r !== void 0 ? r : {}, s = Wt(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 = Ut(e), l = Wt(t), a = (o = Xt(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 (f) {
947
- console.error(f);
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 (!J(r, 100) && n.length > 0)
958
- for (let o = 0; o < t.length; o++) {
959
- const s = n[o];
960
- E(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
- E(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 (!J(i, 0))
976
- for (let o = 0; o < t.length; o++) {
977
- const s = n[o];
978
- E(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, J(i, 0)))
985
- break;
986
- }
987
- return n;
988
- }
989
- const Cr = 100, Re = {
990
- getItem: (e) => (vt(Re), Re.getItem(e)),
991
- setItem: (e, t) => {
992
- vt(Re), Re.setItem(e, t);
993
- }
994
- }, bt = {};
995
- function Yt({
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 = Re,
1005
- style: f,
1006
- tagName: p = "div",
1007
- ...u
1008
- }) {
1009
- const c = st(o), h = B(null), [m, y] = ue(null), [S, v] = ue([]), D = pr(), x = B({}), I = B(/* @__PURE__ */ new Map()), R = B(0), M = B({
1010
- autoSaveId: e,
1011
- direction: r,
1012
- dragState: m,
1013
- id: c,
1014
- keyboardResizeBy: l,
1015
- onLayout: s,
1016
- storage: a
1017
- }), w = B({
1018
- layout: S,
1019
- panelDataArray: [],
1020
- panelDataArrayChanged: !1
1021
- });
1022
- B({
1023
- didLogIdAndOrderWarning: !1,
1024
- didLogPanelConstraintsWarning: !1,
1025
- prevPanelIds: []
1026
- }), zt(i, () => ({
1027
- getId: () => M.current.id,
1028
- getLayout: () => {
1029
- const {
1030
- layout: b
1031
- } = w.current;
1032
- return b;
1033
- },
1034
- setLayout: (b) => {
1035
- const {
1036
- onLayout: z
1037
- } = M.current, {
1038
- layout: C,
1039
- panelDataArray: d
1040
- } = w.current, g = St({
1041
- layout: b,
1042
- panelConstraints: d.map((P) => P.constraints)
1043
- });
1044
- yt(C, g) || (v(g), w.current.layout = g, z && z(g), ye(d, g, x.current));
1045
- }
1046
- }), []), me(() => {
1047
- M.current.autoSaveId = e, M.current.direction = r, M.current.dragState = m, M.current.id = c, M.current.onLayout = s, M.current.storage = a;
1048
- }), yr({
1049
- committedValuesRef: M,
1050
- eagerValuesRef: w,
1051
- groupId: c,
1052
- layout: S,
1053
- panelDataArray: w.current.panelDataArray,
1054
- setLayout: v,
1055
- panelGroupElement: h.current
1056
- }), Z(() => {
1057
- const {
1058
- panelDataArray: b
1059
- } = w.current;
1060
- if (e) {
1061
- if (S.length === 0 || S.length !== b.length)
1062
- return;
1063
- let z = bt[e];
1064
- z == null && (z = zr(wr, Cr), bt[e] = z);
1065
- const C = [...b], d = new Map(I.current);
1066
- z(e, C, d, S, a);
1067
- }
1068
- }, [e, S, a]), Z(() => {
1069
- });
1070
- const X = O((b) => {
1071
- const {
1072
- onLayout: z
1073
- } = M.current, {
1074
- layout: C,
1075
- panelDataArray: d
1076
- } = w.current;
1077
- if (b.constraints.collapsible) {
1078
- const g = d.map((oe) => oe.constraints), {
1079
- collapsedSize: P = 0,
1080
- panelSize: L,
1081
- pivotIndices: q
1082
- } = de(d, b, C);
1083
- if (E(L != null, `Panel size not found for panel "${b.id}"`), !le(L, P)) {
1084
- I.current.set(b.id, L);
1085
- const ie = ve(d, b) === d.length - 1 ? L - P : P - L, F = Ie({
1086
- delta: ie,
1087
- initialLayout: C,
1088
- panelConstraints: g,
1089
- pivotIndices: q,
1090
- prevLayout: C,
1091
- trigger: "imperative-api"
1092
- });
1093
- Le(C, F) || (v(F), w.current.layout = F, z && z(F), ye(d, F, x.current));
1094
- }
1095
- }
1096
- }, []), j = O((b, z) => {
1097
- const {
1098
- onLayout: C
1099
- } = M.current, {
1100
- layout: d,
1101
- panelDataArray: g
1102
- } = w.current;
1103
- if (b.constraints.collapsible) {
1104
- const P = g.map((ee) => ee.constraints), {
1105
- collapsedSize: L = 0,
1106
- panelSize: q = 0,
1107
- minSize: oe = 0,
1108
- pivotIndices: ie
1109
- } = de(g, b, d), F = z ?? oe;
1110
- if (le(q, L)) {
1111
- const ee = I.current.get(b.id), Ce = ee != null && ee >= F ? ee : F, Oe = ve(g, b) === g.length - 1 ? q - Ce : Ce - q, Q = Ie({
1112
- delta: Oe,
1113
- initialLayout: d,
1114
- panelConstraints: P,
1115
- pivotIndices: ie,
1116
- prevLayout: d,
1117
- trigger: "imperative-api"
1118
- });
1119
- Le(d, Q) || (v(Q), w.current.layout = Q, C && C(Q), ye(g, Q, x.current));
1120
- }
1121
- }
1122
- }, []), $ = O((b) => {
1123
- const {
1124
- layout: z,
1125
- panelDataArray: C
1126
- } = w.current, {
1127
- panelSize: d
1128
- } = de(C, b, z);
1129
- return E(d != null, `Panel size not found for panel "${b.id}"`), d;
1130
- }, []), A = O((b, z) => {
1131
- const {
1132
- panelDataArray: C
1133
- } = w.current, d = ve(C, b);
1134
- return xr({
1135
- defaultSize: z,
1136
- dragState: m,
1137
- layout: S,
1138
- panelData: C,
1139
- panelIndex: d
1140
- });
1141
- }, [m, S]), N = O((b) => {
1142
- const {
1143
- layout: z,
1144
- panelDataArray: C
1145
- } = w.current, {
1146
- collapsedSize: d = 0,
1147
- collapsible: g,
1148
- panelSize: P
1149
- } = de(C, b, z);
1150
- return E(P != null, `Panel size not found for panel "${b.id}"`), g === !0 && le(P, d);
1151
- }, []), W = O((b) => {
1152
- const {
1153
- layout: z,
1154
- panelDataArray: C
1155
- } = w.current, {
1156
- collapsedSize: d = 0,
1157
- collapsible: g,
1158
- panelSize: P
1159
- } = de(C, b, z);
1160
- return E(P != null, `Panel size not found for panel "${b.id}"`), !g || ge(P, d) > 0;
1161
- }, []), V = O((b) => {
1162
- const {
1163
- panelDataArray: z
1164
- } = w.current;
1165
- z.push(b), z.sort((C, d) => {
1166
- const g = C.order, P = d.order;
1167
- return g == null && P == null ? 0 : g == null ? -1 : P == null ? 1 : g - P;
1168
- }), w.current.panelDataArrayChanged = !0, D();
1169
- }, [D]);
1170
- me(() => {
1171
- if (w.current.panelDataArrayChanged) {
1172
- w.current.panelDataArrayChanged = !1;
1173
- const {
1174
- autoSaveId: b,
1175
- onLayout: z,
1176
- storage: C
1177
- } = M.current, {
1178
- layout: d,
1179
- panelDataArray: g
1180
- } = w.current;
1181
- let P = null;
1182
- if (b) {
1183
- const q = Pr(b, g, C);
1184
- q && (I.current = new Map(Object.entries(q.expandToSizes)), P = q.layout);
1185
- }
1186
- P == null && (P = br({
1187
- panelDataArray: g
1188
- }));
1189
- const L = St({
1190
- layout: P,
1191
- panelConstraints: g.map((q) => q.constraints)
1192
- });
1193
- yt(d, L) || (v(L), w.current.layout = L, z && z(L), ye(g, L, x.current));
1194
- }
1195
- }), me(() => {
1196
- const b = w.current;
1197
- return () => {
1198
- b.layout = [];
1199
- };
1200
- }, []);
1201
- const T = O((b) => {
1202
- let z = !1;
1203
- const C = h.current;
1204
- return C && window.getComputedStyle(C, null).getPropertyValue("direction") === "rtl" && (z = !0), function(g) {
1205
- g.preventDefault();
1206
- const P = h.current;
1207
- if (!P)
1208
- return () => null;
1209
- const {
1210
- direction: L,
1211
- dragState: q,
1212
- id: oe,
1213
- keyboardResizeBy: ie,
1214
- onLayout: F
1215
- } = M.current, {
1216
- layout: ee,
1217
- panelDataArray: Ce
1218
- } = w.current, {
1219
- initialLayout: Ne
1220
- } = q ?? {}, Oe = qt(oe, b, P);
1221
- let Q = Sr(g, b, L, q, ie, P);
1222
- const ut = L === "horizontal";
1223
- ut && z && (Q = -Q);
1224
- const Sn = Ce.map((bn) => bn.constraints), Ee = Ie({
1225
- delta: Q,
1226
- initialLayout: Ne ?? ee,
1227
- panelConstraints: Sn,
1228
- pivotIndices: Oe,
1229
- prevLayout: ee,
1230
- trigger: Lt(g) ? "keyboard" : "mouse-or-touch"
1231
- }), dt = !Le(ee, Ee);
1232
- (_t(g) || kt(g)) && R.current != Q && (R.current = Q, !dt && Q !== 0 ? ut ? Ye(b, Q < 0 ? Ht : $t) : Ye(b, Q < 0 ? Vt : Ft) : Ye(b, 0)), dt && (v(Ee), w.current.layout = Ee, F && F(Ee), ye(Ce, Ee, x.current));
1233
- };
1234
- }, []), H = O((b, z) => {
1235
- const {
1236
- onLayout: C
1237
- } = M.current, {
1238
- layout: d,
1239
- panelDataArray: g
1240
- } = w.current, P = g.map((ee) => ee.constraints), {
1241
- panelSize: L,
1242
- pivotIndices: q
1243
- } = de(g, b, d);
1244
- E(L != null, `Panel size not found for panel "${b.id}"`);
1245
- const ie = ve(g, b) === g.length - 1 ? L - z : z - L, F = Ie({
1246
- delta: ie,
1247
- initialLayout: d,
1248
- panelConstraints: P,
1249
- pivotIndices: q,
1250
- prevLayout: d,
1251
- trigger: "imperative-api"
1252
- });
1253
- Le(d, F) || (v(F), w.current.layout = F, C && C(F), ye(g, F, x.current));
1254
- }, []), Y = O((b, z) => {
1255
- const {
1256
- layout: C,
1257
- panelDataArray: d
1258
- } = w.current, {
1259
- collapsedSize: g = 0,
1260
- collapsible: P
1261
- } = z, {
1262
- collapsedSize: L = 0,
1263
- collapsible: q,
1264
- maxSize: oe = 100,
1265
- minSize: ie = 0
1266
- } = b.constraints, {
1267
- panelSize: F
1268
- } = de(d, b, C);
1269
- F != null && (P && q && le(F, g) ? le(g, L) || H(b, L) : F < ie ? H(b, ie) : F > oe && H(b, oe));
1270
- }, [H]), G = O((b, z) => {
1271
- const {
1272
- direction: C
1273
- } = M.current, {
1274
- layout: d
1275
- } = w.current;
1276
- if (!h.current)
1277
- return;
1278
- const g = Be(b, h.current);
1279
- E(g, `Drag handle element not found for id "${b}"`);
1280
- const P = Gt(C, z);
1281
- y({
1282
- dragHandleId: b,
1283
- dragHandleRect: g.getBoundingClientRect(),
1284
- initialCursorPosition: P,
1285
- initialLayout: d
1286
- });
1287
- }, []), re = O(() => {
1288
- y(null);
1289
- }, []), he = O((b) => {
1290
- const {
1291
- panelDataArray: z
1292
- } = w.current, C = ve(z, b);
1293
- C >= 0 && (z.splice(C, 1), delete x.current[b.id], w.current.panelDataArrayChanged = !0, D());
1294
- }, [D]), se = U(() => ({
1295
- collapsePanel: X,
1296
- direction: r,
1297
- dragState: m,
1298
- expandPanel: j,
1299
- getPanelSize: $,
1300
- getPanelStyle: A,
1301
- groupId: c,
1302
- isPanelCollapsed: N,
1303
- isPanelExpanded: W,
1304
- reevaluatePanelConstraints: Y,
1305
- registerPanel: V,
1306
- registerResizeHandle: T,
1307
- resizePanel: H,
1308
- startDragging: G,
1309
- stopDragging: re,
1310
- unregisterPanel: he,
1311
- panelGroupElement: h.current
1312
- }), [X, m, r, j, $, A, c, N, W, Y, V, T, H, G, re, he]), ae = {
1313
- display: "flex",
1314
- flexDirection: r === "horizontal" ? "row" : "column",
1315
- height: "100%",
1316
- overflow: "hidden",
1317
- width: "100%"
1318
- };
1319
- return xe(Ve.Provider, {
1320
- value: se
1321
- }, xe(p, {
1322
- ...u,
1323
- children: t,
1324
- className: n,
1325
- id: o,
1326
- ref: h,
1327
- style: {
1328
- ...ae,
1329
- ...f
1330
- },
1331
- // CSS selectors
1332
- [K.group]: "",
1333
- [K.groupDirection]: r,
1334
- [K.groupId]: c
1335
- }));
1336
- }
1337
- const Er = $e((e, t) => xe(Yt, {
1338
- ...e,
1339
- forwardedRef: t
1340
- }));
1341
- Yt.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
- Z(() => {
1361
- if (e || n == null || r == null)
1362
- return;
1363
- const i = Be(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(K.groupId);
1381
- E(l, `No group element found for id "${l}"`);
1382
- const a = Me(l, r), f = Bt(l, t, r);
1383
- E(f !== null, `No resize element found for id "${t}"`);
1384
- const p = s.shiftKey ? f > 0 ? f - 1 : a.length - 1 : f + 1 < a.length ? f + 1 : 0;
1385
- a[p].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: f,
1406
- onPointerUp: p,
1407
- style: u = {},
1408
- tabIndex: c = 0,
1409
- tagName: h = "div",
1410
- ...m
1411
- }) {
1412
- var y, S;
1413
- const v = B(null), D = B({
1414
- onClick: s,
1415
- onDragging: l,
1416
- onPointerDown: f,
1417
- onPointerUp: p
1418
- });
1419
- Z(() => {
1420
- D.current.onClick = s, D.current.onDragging = l, D.current.onPointerDown = f, D.current.onPointerUp = p;
1421
- });
1422
- const x = nt(Ve);
1423
- if (x === null)
1424
- throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");
1425
- const {
1426
- direction: I,
1427
- groupId: R,
1428
- registerResizeHandle: M,
1429
- startDragging: w,
1430
- stopDragging: X,
1431
- panelGroupElement: j
1432
- } = x, $ = st(i), [A, N] = ue("inactive"), [W, V] = ue(!1), [T, H] = ue(null), Y = B({
1433
- state: A
1434
- });
1435
- me(() => {
1436
- Y.current.state = A;
1437
- }), Z(() => {
1438
- if (n)
1439
- H(null);
1440
- else {
1441
- const se = M($);
1442
- H(() => se);
1443
- }
1444
- }, [n, $, M]);
1445
- 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;
1446
- return Z(() => {
1447
- if (n || T == null)
1448
- return;
1449
- const se = v.current;
1450
- E(se, "Element ref not attached");
1451
- let ae = !1;
1452
- return dr($, se, I, {
1453
- coarse: G,
1454
- fine: re
1455
- }, (z, C, d) => {
1456
- if (!C) {
1457
- N("inactive");
1458
- return;
1459
- }
1460
- switch (z) {
1461
- case "down": {
1462
- N("drag"), ae = !1, E(d, 'Expected event to be defined for "down" action'), w($, d);
1463
- const {
1464
- onDragging: g,
1465
- onPointerDown: P
1466
- } = D.current;
1467
- g == null || g(!0), P == null || P();
1468
- break;
1469
- }
1470
- case "move": {
1471
- const {
1472
- state: g
1473
- } = Y.current;
1474
- ae = !0, g !== "drag" && N("hover"), E(d, 'Expected event to be defined for "move" action'), T(d);
1475
- break;
1476
- }
1477
- case "up": {
1478
- N("hover"), X();
1479
- const {
1480
- onClick: g,
1481
- onDragging: P,
1482
- onPointerUp: L
1483
- } = D.current;
1484
- P == null || P(!1), L == null || L(), ae || g == null || g();
1485
- break;
1486
- }
1487
- }
1488
- });
1489
- }, [G, I, n, re, M, $, T, w, X]), Ir({
1490
- disabled: n,
1491
- handleId: $,
1492
- resizeHandler: T,
1493
- panelGroupElement: j
1494
- }), xe(h, {
1495
- ...m,
1496
- children: e,
1497
- className: t,
1498
- id: i,
1499
- onBlur: () => {
1500
- V(!1), o == null || o();
1501
- },
1502
- onFocus: () => {
1503
- V(!0), a == null || a();
1504
- },
1505
- ref: v,
1506
- role: "separator",
1507
- style: {
1508
- ...{
1509
- touchAction: "none",
1510
- userSelect: "none"
1511
- },
1512
- ...u
1513
- },
1514
- tabIndex: c,
1515
- // CSS selectors
1516
- [K.groupDirection]: I,
1517
- [K.groupId]: R,
1518
- [K.resizeHandle]: "",
1519
- [K.resizeHandleActive]: A === "drag" ? "pointer" : W ? "keyboard" : void 0,
1520
- [K.resizeHandleEnabled]: !n,
1521
- [K.resizeHandleId]: $,
1522
- [K.resizeHandleState]: A
1523
- });
1524
- }
1525
- Rr.displayName = "PanelResizeHandle";
1526
- function jt() {
1527
- var a, f;
1528
- const e = te((p) => p.card), t = te((p) => p.frame), n = U(
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 = U(
1534
- () => {
1535
- var p;
1536
- return (p = r == null ? void 0 : r.visuals) == null ? void 0 : p.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, (f = n == null ? void 0 : n.customCardPreferences) == null ? void 0 : f.componentName]
1544
- ), o = At(n, i), s = U(
1545
- () => Mt({
1546
- frame: t,
1547
- configCard: n,
1548
- isMultiInputVisual: o === "multiple"
1549
- }),
1550
- [t, n, o]
1551
- ), l = U(() => {
1552
- const p = s.findIndex(
1553
- (u) => (u == null ? void 0 : u.id) === e.id
1554
- );
1555
- return p < 0 ? -1 : Qe(e, p);
1556
- }, [s, e]);
1557
- return U(() => !n || o !== "multiple" || l < 0 ? e.type : _e(
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 Qt({
1564
- storeValue: e,
1565
- defaultValue: t = "",
1566
- onStoreUpdate: n,
1567
- delay: r = 300
1568
- }) {
1569
- const [i, o] = ue(e ?? t), s = B(null), l = B(i), a = B(e), f = B(!1), p = O(() => {
1570
- s.current && (clearTimeout(s.current), s.current = null), f.current && l.current !== (a.current ?? t) && (n(l.current), a.current = l.current);
1571
- }, [t, n]);
1572
- Z(() => {
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, f.current = !1;
1577
- }
1578
- }, [e, t]), Z(() => {
1579
- if (f.current)
1580
- return s.current = setTimeout(() => {
1581
- p();
1582
- }, r), () => {
1583
- s.current && (clearTimeout(s.current), s.current = null);
1584
- };
1585
- }, [r, p, i]), Z(() => () => {
1586
- s.current && clearTimeout(s.current);
1587
- }, []);
1588
- const u = O(
1589
- (c) => {
1590
- const h = c ?? t;
1591
- f.current = !0, l.current = h, o(h);
1592
- },
1593
- [t]
1594
- );
1595
- return { value: i, onChange: u, flush: p };
1596
- }
1597
- function Jt({
1598
- queryClient: e,
1599
- readQueryKey: t,
1600
- setRunSql: n
1601
- }) {
1602
- Gn(), 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 = te((x) => x.card.sql), r = te((x) => x.sqlGen), i = te((x) => x.card), o = jt(), { setCardSql: s, setSqlGen: l, setRunSql: a } = wt(), f = U(() => o !== i.type ? { ...i, type: o } : i, [i, o]), { queryKey: p } = rt(f), u = Ct(), c = B(p);
1609
- c.current = p;
1610
- const h = B(r);
1611
- h.current = r;
1612
- const m = O(
1613
- (x) => {
1614
- s(x);
1615
- },
1616
- [s]
1617
- ), {
1618
- value: y,
1619
- onChange: S,
1620
- flush: v
1621
- } = Qt({
1622
- storeValue: n,
1623
- defaultValue: "",
1624
- onStoreUpdate: m,
1625
- delay: Dr
1626
- });
1627
- Z(() => Dt(v), [v]);
1628
- function D(x) {
1629
- S(x), Un(h.current) || l({});
1630
- }
1631
- return /* @__PURE__ */ _("div", { className: "relative h-full w-full", children: /* @__PURE__ */ _(
1632
- Et,
1633
- {
1634
- ref: t,
1635
- value: y ?? "",
1636
- onValueChange: D,
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(), Jt({
1645
- queryClient: u,
1646
- readQueryKey: () => c.current,
1647
- setRunSql: a
1648
- }));
1649
- }
1650
- }
1651
- ) });
1652
- }
1653
- const xo = $e(Ar), Mr = 300, Nr = `# '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 = te((m) => m.card.python), r = te((m) => m.card), i = jt(), { setCardPython: o, setRunSql: s } = wt(), l = U(() => i !== r.type ? { ...r, type: i } : r, [r, i]), { queryKey: a } = rt(l), f = Ct(), p = B(a);
1659
- p.current = a;
1660
- const { value: u, onChange: c, flush: h } = Qt({
1661
- storeValue: n,
1662
- onStoreUpdate: o,
1663
- delay: Mr
1664
- });
1665
- return Z(() => Dt(h), [h]), /* @__PURE__ */ _(
1666
- Et,
1667
- {
1668
- ref: t,
1669
- value: u ?? "",
1670
- onValueChange: c,
1671
- language: "python",
1672
- placeholder: Nr,
1673
- ariaLabel: "Python code",
1674
- embedded: !0,
1675
- hideLineNumbers: !0,
1676
- wrapLines: !0,
1677
- className: ot(
1678
- "[&_.code-editor-pre]:!pt-2 [&_.code-editor-textarea]:!pt-2",
1679
- e
1680
- ),
1681
- onKeyDown: (m) => {
1682
- m.key === "Enter" && m.shiftKey && (m.preventDefault(), Jt({
1683
- queryClient: f,
1684
- readQueryKey: () => p.current,
1685
- setRunSql: s
1686
- }));
1687
- }
1688
- }
1689
- );
1690
- }
1691
- const zo = $e(Lr);
1692
- function _r({ card: e }) {
1693
- var se, ae, b, z, C;
1694
- const t = In(), [n, r] = ue({}), { authToken: i } = Rn(), o = Wn(i == null ? void 0 : i.accessToken), { compiledAppearance: s } = Jn(), l = U(
1695
- () => Dn(s),
1696
- [s]
1697
- ), a = te((d) => d.frame), f = te(
1698
- (d) => d.inlineFilterValuesMap[e.id]
1699
- ), p = te(
1700
- (d) => d.actions.setCardInlineFilterValue
1701
- ), u = te(
1702
- (d) => d.actions.removeCardInlineFilterValue
1703
- ), c = e, { getCard: h, manifest: m } = Pt(
1704
- ((se = c.customCardPreferences) == null ? void 0 : se.url) || ""
1705
- ), y = (ae = m == null ? void 0 : m.visuals) == null ? void 0 : ae.find(
1706
- (d) => {
1707
- var g;
1708
- return d.name === ((g = c.customCardPreferences) == null ? void 0 : g.componentName);
1709
- }
1710
- ), S = At(c, y) ?? "single", v = U(
1711
- () => Mt({
1712
- frame: a,
1713
- configCard: c,
1714
- isMultiInputVisual: S === "multiple"
1715
- }),
1716
- [a, c, S]
1717
- ), D = U(() => {
1718
- const d = v.findIndex(
1719
- (g) => (g == null ? void 0 : g.id) === e.id
1720
- );
1721
- return d < 0 ? -1 : Qe(e, d);
1722
- }, [v, e]), x = U(() => S !== "multiple" || D < 0 ? e.type : _e(
1723
- e,
1724
- D,
1725
- y == null ? void 0 : y.slots
1726
- ) ?? e.type, [S, D, e, y == null ? void 0 : y.slots]), I = U(() => S === "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, S]), { data: R, effectiveCardConfig: M } = rt(I), w = An(), X = Ge((d) => d.dashboard.filters), j = Ge((d) => d.filterValues), $ = Ge((d) => d.selectedSheetId), A = U(
1735
- () => Mn({
1736
- card: e,
1737
- sheetId: $ || "",
1738
- inlineFilterValues: f,
1739
- setInlineFilterValue: (d) => p(e.id, d),
1740
- removeInlineFilterValue: (d) => u(e.id, d)
1741
- }),
1742
- [
1743
- e,
1744
- $,
1745
- f,
1746
- p,
1747
- u
1748
- ]
1749
- ), { cardFilters: N, cardFilterValues: W } = U(
1750
- () => Xn({
1751
- card: e,
1752
- transientContexts: w,
1753
- filters: X,
1754
- filterValues: j,
1755
- selectedSheetId: $
1756
- }),
1757
- [
1758
- e,
1759
- w,
1760
- X,
1761
- j,
1762
- $
1763
- ]
1764
- ), V = O(
1765
- (d, g) => {
1766
- const P = jn(g);
1767
- r((L) => ({
1768
- ...L,
1769
- [d]: P
1770
- }));
1771
- },
1772
- []
1773
- ), T = (b = c.customCardPreferences) == null ? void 0 : b.componentName, H = T ? h(T) : null, Y = Nn(
1774
- (z = c.customCardPreferences) == null ? void 0 : z.settings,
1775
- c
1776
- ), G = U(
1777
- () => Qn(v),
1778
- [v]
1779
- ), re = U(
1780
- () => G.map(
1781
- (d, g) => _e(
1782
- d,
1783
- g,
1784
- y == null ? void 0 : y.slots
1785
- )
1786
- ),
1787
- [G, y == null ? void 0 : y.slots]
1788
- ), he = U(
1789
- () => Ln(
1790
- S === "multiple" ? _n({
1791
- slotOrderedCards: G,
1792
- multiInputData: n,
1793
- valueFormatPreferences: t
1794
- }) : [
1795
- {
1796
- card: e,
1797
- cardConfig: M,
1798
- columns: R == null ? void 0 : R.columns,
1799
- columnKeyMap: R == null ? void 0 : R.columnKeyMap,
1800
- valueFormatPreferences: t
1801
- }
1802
- ]
1803
- ),
1804
- [
1805
- e,
1806
- R == null ? void 0 : R.columnKeyMap,
1807
- R == null ? void 0 : R.columns,
1808
- M,
1809
- n,
1810
- G,
1811
- S,
1812
- t
1813
- ]
1814
- );
1815
- return T ? /* @__PURE__ */ _("div", { className: "semaphor-custom mb-3 flex grow basis-0 flex-col space-y-2 overflow-y-auto", children: /* @__PURE__ */ De(
1816
- wn,
1817
- {
1818
- fallback: /* @__PURE__ */ _(ft, {}),
1819
- children: [
1820
- H && S === "single" && /* @__PURE__ */ _(
1821
- H,
1822
- {
1823
- editing: !0,
1824
- params: o,
1825
- theme: l,
1826
- settings: Y,
1827
- cardMetadata: kn({
1828
- card: e,
1829
- dataMetadata: R == null ? void 0 : R.metadata
1830
- }),
1831
- onDataChange: V,
1832
- data: (R == null ? void 0 : R.records) || [],
1833
- columns: (R == null ? void 0 : R.columns) || [],
1834
- formatTemporalBucketValue: he,
1835
- filters: N,
1836
- filterValues: [
1837
- ...W || [],
1838
- ...f || []
1839
- ],
1840
- inlineFilters: A
1841
- }
1842
- ),
1843
- H && S === "multiple" && /* @__PURE__ */ De(ft, { children: [
1844
- v.map((d, g) => {
1845
- if (!d) return null;
1846
- const P = Qe(d, g), L = _e(
1847
- d,
1848
- P,
1849
- y == null ? void 0 : y.slots
1850
- );
1851
- return /* @__PURE__ */ _(
1852
- Tn,
1853
- {
1854
- onDataChange: V,
1855
- card: d,
1856
- effectiveCardType: L
1857
- },
1858
- `${d.id}-${P}`
1859
- );
1860
- }),
1861
- /* @__PURE__ */ _("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ _(
1862
- H,
1863
- {
1864
- editing: !0,
1865
- onDataChange: V,
1866
- ...Hn({
1867
- configCard: c,
1868
- slotOrderedCards: G,
1869
- slotTypes: re,
1870
- multiInputData: n,
1871
- params: o,
1872
- theme: l,
1873
- chartSettings: Y,
1874
- filters: N,
1875
- filterValues: [
1876
- ...W || [],
1877
- ...f || []
1878
- ],
1879
- inlineFilters: A,
1880
- formatTemporalBucketValue: he
1881
- })
1882
- }
1883
- ) })
1884
- ] })
1885
- ]
1886
- },
1887
- (C = c.customCardPreferences) == null ? void 0 : C.componentName
1888
- ) }) : null;
1889
- }
1890
- const Po = Pn(_r);
1891
- var Zt = "Toggle", en = k.forwardRef((e, t) => {
1892
- const { pressed: n, defaultPressed: r, onPressedChange: i, ...o } = e, [s, l] = It({
1893
- prop: n,
1894
- onChange: i,
1895
- defaultProp: r ?? !1,
1896
- caller: Zt
1897
- });
1898
- return /* @__PURE__ */ _(
1899
- ze.button,
1900
- {
1901
- type: "button",
1902
- "aria-pressed": s,
1903
- "data-state": s ? "on" : "off",
1904
- "data-disabled": e.disabled ? "" : void 0,
1905
- ...o,
1906
- ref: t,
1907
- onClick: pe(e.onClick, () => {
1908
- e.disabled || l(!s);
1909
- })
1910
- }
1911
- );
1912
- });
1913
- en.displayName = Zt;
1914
- var tn = en;
1915
- const kr = Vn(
1916
- "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",
1917
- {
1918
- variants: {
1919
- variant: {
1920
- default: "bg-transparent",
1921
- outline: "border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"
1922
- },
1923
- size: {
1924
- default: "h-10 px-3",
1925
- sm: "h-9 px-2.5",
1926
- lg: "h-11 px-5"
1927
- }
1928
- },
1929
- defaultVariants: {
1930
- variant: "default",
1931
- size: "default"
1932
- }
1933
- }
1934
- ), Tr = k.forwardRef(({ className: e, variant: t, size: n, ...r }, i) => /* @__PURE__ */ _(
1935
- tn,
1936
- {
1937
- ref: i,
1938
- className: ot(kr({ variant: t, size: n, className: e })),
1939
- ...r
1940
- }
1941
- ));
1942
- Tr.displayName = tn.displayName;
1943
- var nn = ["PageUp", "PageDown"], rn = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], on = {
1944
- "from-left": ["Home", "PageDown", "ArrowDown", "ArrowLeft"],
1945
- "from-right": ["Home", "PageDown", "ArrowDown", "ArrowRight"],
1946
- "from-bottom": ["Home", "PageDown", "ArrowDown", "ArrowLeft"],
1947
- "from-top": ["Home", "PageDown", "ArrowUp", "ArrowLeft"]
1948
- }, we = "Slider", [Ze, Hr, $r] = Kn(we), [sn] = Fn(we, [
1949
- $r
1950
- ]), [Vr, qe] = sn(we), ln = k.forwardRef(
1951
- (e, t) => {
1952
- const {
1953
- name: n,
1954
- min: r = 0,
1955
- max: i = 100,
1956
- step: o = 1,
1957
- orientation: s = "horizontal",
1958
- disabled: l = !1,
1959
- minStepsBetweenThumbs: a = 0,
1960
- defaultValue: f = [r],
1961
- value: p,
1962
- onValueChange: u = () => {
1963
- },
1964
- onValueCommit: c = () => {
1965
- },
1966
- inverted: h = !1,
1967
- form: m,
1968
- ...y
1969
- } = e, S = k.useRef(/* @__PURE__ */ new Set()), v = k.useRef(0), x = s === "horizontal" ? Fr : Kr, [I = [], R] = It({
1970
- prop: p,
1971
- defaultProp: f,
1972
- onChange: (A) => {
1973
- var W;
1974
- (W = [...S.current][v.current]) == null || W.focus(), u(A);
1975
- }
1976
- }), M = k.useRef(I);
1977
- function w(A) {
1978
- const N = Ur(I, A);
1979
- $(A, N);
1980
- }
1981
- function X(A) {
1982
- $(A, v.current);
1983
- }
1984
- function j() {
1985
- const A = M.current[v.current];
1986
- I[v.current] !== A && c(I);
1987
- }
1988
- function $(A, N, { commit: W } = { commit: !1 }) {
1989
- const V = jr(o), T = Qr(Math.round((A - r) / o) * o + r, V), H = Rt(T, [r, i]);
1990
- R((Y = []) => {
1991
- const G = Or(Y, H, N);
1992
- if (Yr(G, a * o)) {
1993
- v.current = G.indexOf(H);
1994
- const re = String(G) !== String(Y);
1995
- return re && W && c(G), re ? G : Y;
1996
- } else
1997
- return Y;
1998
- });
1999
- }
2000
- return /* @__PURE__ */ _(
2001
- Vr,
2002
- {
2003
- scope: e.__scopeSlider,
2004
- name: n,
2005
- disabled: l,
2006
- min: r,
2007
- max: i,
2008
- valueIndexToChangeRef: v,
2009
- thumbs: S.current,
2010
- values: I,
2011
- orientation: s,
2012
- form: m,
2013
- children: /* @__PURE__ */ _(Ze.Provider, { scope: e.__scopeSlider, children: /* @__PURE__ */ _(Ze.Slot, { scope: e.__scopeSlider, children: /* @__PURE__ */ _(
2014
- x,
2015
- {
2016
- "aria-disabled": l,
2017
- "data-disabled": l ? "" : void 0,
2018
- ...y,
2019
- ref: t,
2020
- onPointerDown: pe(y.onPointerDown, () => {
2021
- l || (M.current = I);
2022
- }),
2023
- min: r,
2024
- max: i,
2025
- inverted: h,
2026
- onSlideStart: l ? void 0 : w,
2027
- onSlideMove: l ? void 0 : X,
2028
- onSlideEnd: l ? void 0 : j,
2029
- onHomeKeyDown: () => !l && $(r, 0, { commit: !0 }),
2030
- onEndKeyDown: () => !l && $(i, I.length - 1, { commit: !0 }),
2031
- onStepKeyDown: ({ event: A, direction: N }) => {
2032
- if (!l) {
2033
- const T = nn.includes(A.key) || A.shiftKey && rn.includes(A.key) ? 10 : 1, H = v.current, Y = I[H], G = o * T * N;
2034
- $(Y + G, H, { commit: !0 });
2035
- }
2036
- }
2037
- }
2038
- ) }) })
2039
- }
2040
- );
2041
- }
2042
- );
2043
- ln.displayName = we;
2044
- var [an, cn] = sn(we, {
2045
- startEdge: "left",
2046
- endEdge: "right",
2047
- size: "width",
2048
- direction: 1
2049
- }), Fr = k.forwardRef(
2050
- (e, t) => {
2051
- const {
2052
- min: n,
2053
- max: r,
2054
- dir: i,
2055
- inverted: o,
2056
- onSlideStart: s,
2057
- onSlideMove: l,
2058
- onSlideEnd: a,
2059
- onStepKeyDown: f,
2060
- ...p
2061
- } = e, [u, c] = k.useState(null), h = Pe(t, (x) => c(x)), m = k.useRef(void 0), y = Bn(i), S = y === "ltr", v = S && !o || !S && o;
2062
- function D(x) {
2063
- const I = m.current || u.getBoundingClientRect(), R = [0, I.width], w = ct(R, v ? [n, r] : [r, n]);
2064
- return m.current = I, w(x - I.left);
2065
- }
2066
- return /* @__PURE__ */ _(
2067
- an,
2068
- {
2069
- scope: e.__scopeSlider,
2070
- startEdge: v ? "left" : "right",
2071
- endEdge: v ? "right" : "left",
2072
- direction: v ? 1 : -1,
2073
- size: "width",
2074
- children: /* @__PURE__ */ _(
2075
- un,
2076
- {
2077
- dir: y,
2078
- "data-orientation": "horizontal",
2079
- ...p,
2080
- ref: h,
2081
- style: {
2082
- ...p.style,
2083
- "--radix-slider-thumb-transform": "translateX(-50%)"
2084
- },
2085
- onSlideStart: (x) => {
2086
- const I = D(x.clientX);
2087
- s == null || s(I);
2088
- },
2089
- onSlideMove: (x) => {
2090
- const I = D(x.clientX);
2091
- l == null || l(I);
2092
- },
2093
- onSlideEnd: () => {
2094
- m.current = void 0, a == null || a();
2095
- },
2096
- onStepKeyDown: (x) => {
2097
- const R = on[v ? "from-left" : "from-right"].includes(x.key);
2098
- f == null || f({ event: x, direction: R ? -1 : 1 });
2099
- }
2100
- }
2101
- )
2102
- }
2103
- );
2104
- }
2105
- ), Kr = k.forwardRef(
2106
- (e, t) => {
2107
- const {
2108
- min: n,
2109
- max: r,
2110
- inverted: i,
2111
- onSlideStart: o,
2112
- onSlideMove: s,
2113
- onSlideEnd: l,
2114
- onStepKeyDown: a,
2115
- ...f
2116
- } = e, p = k.useRef(null), u = Pe(t, p), c = k.useRef(void 0), h = !i;
2117
- function m(y) {
2118
- const S = c.current || p.current.getBoundingClientRect(), v = [0, S.height], x = ct(v, h ? [r, n] : [n, r]);
2119
- return c.current = S, x(y - S.top);
2120
- }
2121
- return /* @__PURE__ */ _(
2122
- an,
2123
- {
2124
- scope: e.__scopeSlider,
2125
- startEdge: h ? "bottom" : "top",
2126
- endEdge: h ? "top" : "bottom",
2127
- size: "height",
2128
- direction: h ? 1 : -1,
2129
- children: /* @__PURE__ */ _(
2130
- un,
2131
- {
2132
- "data-orientation": "vertical",
2133
- ...f,
2134
- ref: u,
2135
- style: {
2136
- ...f.style,
2137
- "--radix-slider-thumb-transform": "translateY(50%)"
2138
- },
2139
- onSlideStart: (y) => {
2140
- const S = m(y.clientY);
2141
- o == null || o(S);
2142
- },
2143
- onSlideMove: (y) => {
2144
- const S = m(y.clientY);
2145
- s == null || s(S);
2146
- },
2147
- onSlideEnd: () => {
2148
- c.current = void 0, l == null || l();
2149
- },
2150
- onStepKeyDown: (y) => {
2151
- const v = on[h ? "from-bottom" : "from-top"].includes(y.key);
2152
- a == null || a({ event: y, direction: v ? -1 : 1 });
2153
- }
2154
- }
2155
- )
2156
- }
2157
- );
2158
- }
2159
- ), un = k.forwardRef(
2160
- (e, t) => {
2161
- const {
2162
- __scopeSlider: n,
2163
- onSlideStart: r,
2164
- onSlideMove: i,
2165
- onSlideEnd: o,
2166
- onHomeKeyDown: s,
2167
- onEndKeyDown: l,
2168
- onStepKeyDown: a,
2169
- ...f
2170
- } = e, p = qe(we, n);
2171
- return /* @__PURE__ */ _(
2172
- ze.span,
2173
- {
2174
- ...f,
2175
- ref: t,
2176
- onKeyDown: pe(e.onKeyDown, (u) => {
2177
- u.key === "Home" ? (s(u), u.preventDefault()) : u.key === "End" ? (l(u), u.preventDefault()) : nn.concat(rn).includes(u.key) && (a(u), u.preventDefault());
2178
- }),
2179
- onPointerDown: pe(e.onPointerDown, (u) => {
2180
- const c = u.target;
2181
- c.setPointerCapture(u.pointerId), u.preventDefault(), p.thumbs.has(c) ? c.focus() : r(u);
2182
- }),
2183
- onPointerMove: pe(e.onPointerMove, (u) => {
2184
- u.target.hasPointerCapture(u.pointerId) && i(u);
2185
- }),
2186
- onPointerUp: pe(e.onPointerUp, (u) => {
2187
- const c = u.target;
2188
- c.hasPointerCapture(u.pointerId) && (c.releasePointerCapture(u.pointerId), o(u));
2189
- })
2190
- }
2191
- );
2192
- }
2193
- ), dn = "SliderTrack", fn = k.forwardRef(
2194
- (e, t) => {
2195
- const { __scopeSlider: n, ...r } = e, i = qe(dn, n);
2196
- return /* @__PURE__ */ _(
2197
- ze.span,
2198
- {
2199
- "data-disabled": i.disabled ? "" : void 0,
2200
- "data-orientation": i.orientation,
2201
- ...r,
2202
- ref: t
2203
- }
2204
- );
2205
- }
2206
- );
2207
- fn.displayName = dn;
2208
- var et = "SliderRange", pn = k.forwardRef(
2209
- (e, t) => {
2210
- const { __scopeSlider: n, ...r } = e, i = qe(et, n), o = cn(et, n), s = k.useRef(null), l = Pe(t, s), a = i.values.length, f = i.values.map(
2211
- (c) => hn(c, i.min, i.max)
2212
- ), p = a > 1 ? Math.min(...f) : 0, u = 100 - Math.max(...f);
2213
- return /* @__PURE__ */ _(
2214
- ze.span,
2215
- {
2216
- "data-orientation": i.orientation,
2217
- "data-disabled": i.disabled ? "" : void 0,
2218
- ...r,
2219
- ref: l,
2220
- style: {
2221
- ...e.style,
2222
- [o.startEdge]: p + "%",
2223
- [o.endEdge]: u + "%"
2224
- }
2225
- }
2226
- );
2227
- }
2228
- );
2229
- pn.displayName = et;
2230
- var tt = "SliderThumb", mn = k.forwardRef(
2231
- (e, t) => {
2232
- const n = Hr(e.__scopeSlider), [r, i] = k.useState(null), o = Pe(t, (l) => i(l)), s = k.useMemo(
2233
- () => r ? n().findIndex((l) => l.ref.current === r) : -1,
2234
- [n, r]
2235
- );
2236
- return /* @__PURE__ */ _(Br, { ...e, ref: o, index: s });
2237
- }
2238
- ), Br = k.forwardRef(
2239
- (e, t) => {
2240
- const { __scopeSlider: n, index: r, name: i, ...o } = e, s = qe(tt, n), l = cn(tt, n), [a, f] = k.useState(null), p = Pe(t, (D) => f(D)), u = a ? s.form || !!a.closest("form") : !0, c = qn(a), h = s.values[r], m = h === void 0 ? 0 : hn(h, s.min, s.max), y = Gr(r, s.values.length), S = c == null ? void 0 : c[l.size], v = S ? Wr(S, m, l.direction) : 0;
2241
- return k.useEffect(() => {
2242
- if (a)
2243
- return s.thumbs.add(a), () => {
2244
- s.thumbs.delete(a);
2245
- };
2246
- }, [a, s.thumbs]), /* @__PURE__ */ De(
2247
- "span",
2248
- {
2249
- style: {
2250
- transform: "var(--radix-slider-thumb-transform)",
2251
- position: "absolute",
2252
- [l.startEdge]: `calc(${m}% + ${v}px)`
2253
- },
2254
- children: [
2255
- /* @__PURE__ */ _(Ze.ItemSlot, { scope: e.__scopeSlider, children: /* @__PURE__ */ _(
2256
- ze.span,
2257
- {
2258
- role: "slider",
2259
- "aria-label": e["aria-label"] || y,
2260
- "aria-valuemin": s.min,
2261
- "aria-valuenow": h,
2262
- "aria-valuemax": s.max,
2263
- "aria-orientation": s.orientation,
2264
- "data-orientation": s.orientation,
2265
- "data-disabled": s.disabled ? "" : void 0,
2266
- tabIndex: s.disabled ? void 0 : 0,
2267
- ...o,
2268
- ref: p,
2269
- style: h === void 0 ? { display: "none" } : e.style,
2270
- onFocus: pe(e.onFocus, () => {
2271
- s.valueIndexToChangeRef.current = r;
2272
- })
2273
- }
2274
- ) }),
2275
- u && /* @__PURE__ */ _(
2276
- gn,
2277
- {
2278
- name: i ?? (s.name ? s.name + (s.values.length > 1 ? "[]" : "") : void 0),
2279
- form: s.form,
2280
- value: h
2281
- },
2282
- r
2283
- )
2284
- ]
2285
- }
2286
- );
2287
- }
2288
- );
2289
- mn.displayName = tt;
2290
- var qr = "RadioBubbleInput", gn = k.forwardRef(
2291
- ({ __scopeSlider: e, value: t, ...n }, r) => {
2292
- const i = k.useRef(null), o = Pe(i, r), s = On(t);
2293
- return k.useEffect(() => {
2294
- const l = i.current;
2295
- if (!l) return;
2296
- const a = window.HTMLInputElement.prototype, p = Object.getOwnPropertyDescriptor(a, "value").set;
2297
- if (s !== t && p) {
2298
- const u = new Event("input", { bubbles: !0 });
2299
- p.call(l, t), l.dispatchEvent(u);
2300
- }
2301
- }, [s, t]), /* @__PURE__ */ _(
2302
- ze.input,
2303
- {
2304
- style: { display: "none" },
2305
- ...n,
2306
- ref: o,
2307
- defaultValue: t
2308
- }
2309
- );
2310
- }
2311
- );
2312
- gn.displayName = qr;
2313
- function Or(e = [], t, n) {
2314
- const r = [...e];
2315
- return r[n] = t, r.sort((i, o) => i - o);
2316
- }
2317
- function hn(e, t, n) {
2318
- const o = 100 / (n - t) * (e - t);
2319
- return Rt(o, [0, 100]);
2320
- }
2321
- function Gr(e, t) {
2322
- return t > 2 ? `Value ${e + 1} of ${t}` : t === 2 ? ["Minimum", "Maximum"][e] : void 0;
2323
- }
2324
- function Ur(e, t) {
2325
- if (e.length === 1) return 0;
2326
- const n = e.map((i) => Math.abs(i - t)), r = Math.min(...n);
2327
- return n.indexOf(r);
2328
- }
2329
- function Wr(e, t, n) {
2330
- const r = e / 2, o = ct([0, 50], [0, r]);
2331
- return (r - o(t) * n) * n;
2332
- }
2333
- function Xr(e) {
2334
- return e.slice(0, -1).map((t, n) => e[n + 1] - t);
2335
- }
2336
- function Yr(e, t) {
2337
- if (t > 0) {
2338
- const n = Xr(e);
2339
- return Math.min(...n) >= t;
2340
- }
2341
- return !0;
2342
- }
2343
- function ct(e, t) {
2344
- return (n) => {
2345
- if (e[0] === e[1] || t[0] === t[1]) return t[0];
2346
- const r = (t[1] - t[0]) / (e[1] - e[0]);
2347
- return t[0] + r * (n - e[0]);
2348
- };
2349
- }
2350
- function jr(e) {
2351
- return (String(e).split(".")[1] || "").length;
2352
- }
2353
- function Qr(e, t) {
2354
- const n = Math.pow(10, t);
2355
- return Math.round(e * n) / n;
2356
- }
2357
- var yn = ln, Jr = fn, Zr = pn, eo = mn;
2358
- const to = k.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ De(
2359
- yn,
2360
- {
2361
- ref: n,
2362
- className: ot(
2363
- "relative flex w-full touch-none select-none items-center",
2364
- e
2365
- ),
2366
- ...t,
2367
- children: [
2368
- /* @__PURE__ */ _(Jr, { className: "relative h-2 w-full grow overflow-hidden rounded-full bg-secondary", children: /* @__PURE__ */ _(Zr, { className: "absolute h-full bg-primary" }) }),
2369
- /* @__PURE__ */ _(eo, { 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" })
2370
- ]
2371
- }
2372
- ));
2373
- to.displayName = yn.displayName;
2374
- const no = xt(null), ro = $n();
2375
- function vn(e) {
2376
- const t = nt(no) ?? ro;
2377
- return Cn(t.subscribe, () => e(t.get()), () => e(null));
2378
- }
2379
- function wo(e) {
2380
- return vn(
2381
- O((t) => (t == null ? void 0 : t.slot.zone) === e ? t.outcome : null, [e])
2382
- );
2383
- }
2384
- function Co(e, t, n) {
2385
- return vn(
2386
- O(
2387
- (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,
2388
- [e, t, n]
2389
- )
2390
- );
2391
- }
2392
- export {
2393
- Po as E,
2394
- bo as F,
2395
- tr as P,
2396
- xo as S,
2397
- Tr as T,
2398
- Er as a,
2399
- Rr as b,
2400
- zo as c,
2401
- to as d,
2402
- wo as e,
2403
- Co as f,
2404
- no as g,
2405
- Jt as r,
2406
- jt as u
2407
- };