react-semaphor 0.1.603 → 0.1.605
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.
- package/dist/activity/index.js +1 -73
- package/dist/analytics-protocol/index.js +1 -1491
- package/dist/appearance/index.js +1 -12
- package/dist/appearance-runtime/index.js +1 -5
- package/dist/assistant-context/index.js +1 -11
- package/dist/assistant-protocol/index.js +1 -152
- package/dist/brand-studio/index.js +3 -1598
- package/dist/briefings/index.js +1 -70
- package/dist/chunks/add-to-dashboard-CEmZUf9o.js +12 -0
- package/dist/chunks/analytics-base-schemas-DMFrDqn_.js +1 -0
- package/dist/chunks/appearance-provider-CfoAVQuG.js +608 -0
- package/dist/chunks/appearance-runtime-provider-Bx8H-moR.js +1 -0
- package/dist/chunks/applied-constraints-CinevlKD.js +1 -0
- package/dist/chunks/assistant-chat-DgUaCE9k.js +51 -0
- package/dist/chunks/attachment-filter-line-C_zHMhGh.js +1 -0
- package/dist/chunks/attribution-BEFSsbNn.js +1 -0
- package/dist/chunks/availability-3AIOf6Z-.js +1 -0
- package/dist/chunks/bookmark-impact-BAtemeyK.js +1 -0
- package/dist/chunks/bookmark-state-DScd31KT.js +1 -0
- package/dist/chunks/brand-C9APUFaP.js +1 -0
- package/dist/chunks/card-filter-builder-ClWrXB7P.js +11 -0
- package/dist/chunks/column-bands-DwxbZ6UI.js +1 -0
- package/dist/chunks/comparison-window-caption-tguyN24S.js +1 -0
- package/dist/chunks/context-CntvtZwC.js +2 -0
- package/dist/chunks/conversation-JMK2kyTK.js +1 -0
- package/dist/chunks/dashboard-ChIcbVTx.js +1 -0
- package/dist/chunks/dashboard-briefing-launcher-CwMlhkxV.js +42 -0
- package/dist/chunks/dashboard-controls-UCSAFCGA.js +42 -0
- package/dist/chunks/dashboard-json-B120hYDa.js +1 -0
- package/dist/chunks/dashboard-temporal-snapshot-BFJKbp_6.js +1 -0
- package/dist/chunks/edit-dashboard-visual-DvHp03h_.js +73 -0
- package/dist/chunks/export-file-format-B-wQNHIn.js +4 -0
- package/dist/chunks/filter-line-WwUV5JzN.js +1 -0
- package/dist/chunks/filter-reach-preview-C5M5_hf_.js +1 -0
- package/dist/chunks/filter-value-text-DqTHe_vu.js +1 -0
- package/dist/chunks/index-DViPGDFj.js +1 -0
- package/dist/chunks/index-bkP6SnYu.js +1 -0
- package/dist/chunks/kpi-trend-rule-B87LNzcz.js +1 -0
- package/dist/chunks/layout-grid-CFzqJ7GC.js +6 -0
- package/dist/chunks/matrix-analytical-definition-5T-2euHZ.js +1 -0
- package/dist/chunks/matrix-member-presentation-vVAv-aqg.js +1 -0
- package/dist/chunks/matrix-operation-contract-CWvcEsQ0.js +1 -0
- package/dist/chunks/normalize-dashboard-for-dirty-check-ILKfqgL3.js +1 -0
- package/dist/chunks/numeric-range-options-C8tr-Bls.js +1 -0
- package/dist/chunks/palette-NvEIuXHN.js +6 -0
- package/dist/chunks/pivot-result-contract-expectations-BNWhS8mv.js +1 -0
- package/dist/chunks/pivot-result-identity-B0eWVMXg.js +1 -0
- package/dist/chunks/raw-temporal-value-BHQ-ldpW.js +1 -0
- package/dist/chunks/rendered-file-BbvwaU6z.js +1 -0
- package/dist/chunks/report-preferences-dialog-Bseb2Rlg.js +1 -0
- package/dist/chunks/report-runtime-context-Cd1b5pku.js +1 -0
- package/dist/chunks/resolve-dashboard-input-context-BDY7KwRe.js +8 -0
- package/dist/chunks/resolver-CjsW8Rz0.js +1 -0
- package/dist/chunks/saved-dashboard-context-C3lWc4Dx.js +1 -0
- package/dist/chunks/schema-O1Y3WTGF.js +4 -0
- package/dist/chunks/selection-filter-compiler-kYsRugss.js +1 -0
- package/dist/chunks/semaphor-ready-indicator-BQarSo6S.js +612 -0
- package/dist/chunks/set-6mOnfQeH.js +1 -0
- package/dist/chunks/slider-BPnHdMGq.js +4 -0
- package/dist/chunks/stored-dashboard-DfrxDLhR.js +1 -0
- package/dist/chunks/table-export-sheet-xaczzWZF.js +2 -0
- package/dist/chunks/token-types-1vzMWjI-.js +1 -0
- package/dist/chunks/validators-Dg2kyF4_.js +1 -0
- package/dist/chunks/variable-draft-B4_xqr4Y.js +1 -0
- package/dist/chunks/visual-choice-DgEFfkE-.js +1 -0
- package/dist/dashboard/index.js +1 -7
- package/dist/dashboard-authoring/index.js +1 -4614
- package/dist/format-utils/index.js +1 -425
- package/dist/index.js +1 -554
- package/dist/layouts/index.js +1 -7
- package/dist/live-channel/index.js +1 -124
- package/dist/pdf-export-policy/index.js +1 -92
- package/dist/pdf-table-layout/index.js +1 -993
- package/dist/report-runtime-context/index.js +1 -9
- package/dist/shared/index.js +1 -6
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +1 -9
- package/dist/types/brand-studio/brand-studio-draft.d.ts +45 -13
- package/dist/types/brand-studio/brand-studio-editor.d.ts +13 -2
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/components/visual/data-table/hooks/use-data-table-logic.d.ts +17 -6
- package/dist/types/components/visual/data-table/types/data-table.d.ts +52 -42
- package/dist/types/index.js +1 -88
- package/dist/types/lib/appearance/aliases.d.ts +3 -0
- package/dist/types/lib/appearance/index.d.ts +1 -0
- package/dist/types/lib/appearance/table-density.d.ts +18 -0
- package/dist/types/lib/appearance/types.d.ts +39 -1
- package/dist/types/lib/dashboard-viewer/column-header-actions.d.ts +100 -0
- package/dist/types/lib/dashboard-viewer/table-view-edit.d.ts +0 -27
- package/dist/types/lib/dashboard-viewer/table-view.d.ts +26 -2
- package/dist/types/lib/dashboard-viewer/use-table-view.d.ts +2 -0
- package/dist/types/lib/filter-values/build-card-filter-definition.d.ts +32 -0
- package/dist/types/lib/hooks/use-add-new-frame.d.ts +7 -0
- package/dist/types/lib/hooks/use-dashboard-card.d.ts +4 -0
- package/dist/types/lib/interactions/get-click-context-from-chartjs.d.ts +8 -0
- package/dist/types/lib/query-context/dashboard-filter-mapping-resolution.d.ts +9 -0
- package/dist/types/lib/stores/dashboard-store.d.ts +14 -2
- package/dist/types/lib/stores/explorer-actions.d.ts +7 -10
- package/dist/types/lib/types/common-types.d.ts +1 -2
- package/dist/types/lib/types/semantic-types.d.ts +6 -10
- package/dist/types/lib/utils/card-config-utils.d.ts +13 -0
- package/dist/types/lib/utils/field-placement.d.ts +17 -0
- package/dist/types/lib/utils/field-state-calculator.d.ts +7 -19
- package/dist/types/shared/analytics-protocol/analytics-refusal.d.ts +21 -1
- package/dist/types/shared/analytics-protocol/field-provenance.d.ts +7 -4
- package/dist/types/shared/dashboard-authoring/calculations/definition.d.ts +13 -0
- package/dist/types/shared/dashboard-authoring/card-data-source/card-base.d.ts +125 -0
- package/dist/types/shared/dashboard-authoring/card-data-source/card-field-folders.d.ts +55 -0
- package/dist/types/shared/dashboard-authoring/card-data-source/card-joins.d.ts +114 -0
- package/dist/types/shared/dashboard-authoring/card-data-source/card-prune.d.ts +12 -0
- package/dist/types/shared/dashboard-authoring/card-data-source/filter-field-catalog.d.ts +60 -0
- package/dist/types/shared/dashboard-authoring/card-data-source/filter-field-folders.d.ts +180 -0
- package/dist/types/shared/dashboard-authoring/card-data-source/index.d.ts +7 -0
- package/dist/types/shared/dashboard-authoring/card-data-source/join-reach.d.ts +42 -0
- package/dist/types/shared/dashboard-authoring/card-field-places.d.ts +28 -0
- package/dist/types/shared/dashboard-authoring/card-settings/card-display-write.d.ts +2 -8
- package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +1 -1
- package/dist/types/shared/dashboard-authoring/card-settings/column-display-values.d.ts +5 -0
- package/dist/types/shared/dashboard-authoring/card-settings/column-display.d.ts +52 -0
- package/dist/types/shared/dashboard-authoring/card-settings/index.d.ts +1 -0
- package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +9 -0
- package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +4 -0
- package/dist/types/shared/dashboard-authoring/card-settings/table-viewer-switches.d.ts +15 -0
- package/dist/types/shared/dashboard-authoring/card-settings/views.d.ts +5 -0
- package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +6 -0
- package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +132 -3
- package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +3 -1
- package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +10 -10
- package/dist/types/shared/dashboard-authoring/conditional-formatting/store.d.ts +10 -1
- package/dist/types/shared/dashboard-authoring/field-aggregations.d.ts +9 -2
- package/dist/types/shared/dashboard-authoring/field-folders/field-folders.d.ts +116 -0
- package/dist/types/shared/dashboard-authoring/field-folders/index.d.ts +1 -0
- package/dist/types/shared/dashboard-authoring/filter-reach-decision.d.ts +11 -0
- package/dist/types/shared/dashboard-authoring/index.d.ts +7 -1
- package/dist/types/shared/dashboard-authoring/operations/card-operations.d.ts +2 -0
- package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +7 -2
- package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +6 -2
- package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +2 -0
- package/dist/types/shared/dashboard-authoring/see-records/result.d.ts +7 -22
- package/dist/types/shared/dashboard-authoring/sheet-kinds.d.ts +36 -0
- package/dist/types/shared/dashboard-authoring/table-sheet-shape.d.ts +140 -0
- package/dist/types/shared/dashboard-viewer/table-column-move.d.ts +15 -0
- package/dist/types/shared/dashboard-viewer/table-settings.d.ts +8 -2
- package/dist/types/shared/format-utils/types/format-types.d.ts +1 -1
- package/dist/usage-events/index.js +1 -285
- package/dist/value-format-preferences/index.js +1 -635
- package/package.json +5 -2
- package/dist/chunks/add-to-dashboard-CFF-wFU-.js +0 -291
- package/dist/chunks/analytics-base-schemas-DsUh5Q3C.js +0 -680
- package/dist/chunks/appearance-context-BwBp25ZG.js +0 -162
- package/dist/chunks/appearance-runtime-provider-BRHYELkC.js +0 -80
- package/dist/chunks/applied-constraints-DU-wndZ7.js +0 -47
- package/dist/chunks/assistant-chat-B6hNQI1t.js +0 -6115
- package/dist/chunks/attribution-BvoKvhcj.js +0 -32
- package/dist/chunks/availability-Bp5Gfu1I.js +0 -44
- package/dist/chunks/bookmark-impact-Ba2PLcGp.js +0 -76
- package/dist/chunks/bookmark-state-n7AaNzR_.js +0 -1667
- package/dist/chunks/brand-BoUV0iHF.js +0 -54
- package/dist/chunks/card-filter-builder-Y22HizVx.js +0 -4069
- package/dist/chunks/column-bands-RdM-kjDe.js +0 -47
- package/dist/chunks/comparison-window-caption-Ck2TIbnR.js +0 -741
- package/dist/chunks/context-UCQ7sere.js +0 -369
- package/dist/chunks/conversation-sQiWYUOb.js +0 -16
- package/dist/chunks/dashboard-BghI99oY.js +0 -14
- package/dist/chunks/dashboard-briefing-launcher-DtBAnGiH.js +0 -4875
- package/dist/chunks/dashboard-controls-CtFXlyjV.js +0 -2290
- package/dist/chunks/dashboard-json-DfGBUtCd.js +0 -66
- package/dist/chunks/dates-BnrXF4bb.js +0 -185
- package/dist/chunks/edit-9df1zOWe.js +0 -226
- package/dist/chunks/edit-dashboard-visual-oxt3x1wb.js +0 -18397
- package/dist/chunks/export-file-format-C-tJsxsf.js +0 -111
- package/dist/chunks/filter-line-Cy5YYqRL.js +0 -703
- package/dist/chunks/filter-reach-copy-CE_ZX147.js +0 -5111
- package/dist/chunks/filter-value-text-fWvSDwkl.js +0 -153
- package/dist/chunks/index-BVKzKl5d.js +0 -90
- package/dist/chunks/index-CV_Kzou0.js +0 -595
- package/dist/chunks/index-D5rxbtS4.js +0 -2795
- package/dist/chunks/layout-grid-9LndRoLa.js +0 -16
- package/dist/chunks/matrix-analytical-definition-CCp48UCw.js +0 -1233
- package/dist/chunks/matrix-member-presentation-zNehruXR.js +0 -391
- package/dist/chunks/matrix-operation-contract-DPBj69D8.js +0 -1413
- package/dist/chunks/metric-comparison-B0FR-Q8I.js +0 -600
- package/dist/chunks/normalize-dashboard-for-dirty-check-XKgH3GFX.js +0 -119
- package/dist/chunks/paintbrush-58FQYY-y.js +0 -27
- package/dist/chunks/palette-Be62Tkoa.js +0 -23
- package/dist/chunks/pickers-DkqmtnTL.js +0 -2403
- package/dist/chunks/pivot-result-contract-expectations-BYqAmG9n.js +0 -5092
- package/dist/chunks/pivot-result-identity-CAP4--iq.js +0 -77
- package/dist/chunks/raw-temporal-value-Dg_MTFF7.js +0 -3778
- package/dist/chunks/rendered-file-D8xEuVVx.js +0 -108
- package/dist/chunks/report-preferences-dialog-uJp9GBTM.js +0 -1651
- package/dist/chunks/report-runtime-context-c77_KF9v.js +0 -388
- package/dist/chunks/resolve-dashboard-input-context-Rtl1ffmE.js +0 -25324
- package/dist/chunks/resolver-DG_tfEpt.js +0 -156
- package/dist/chunks/save-C5A0JnEV.js +0 -21
- package/dist/chunks/saved-dashboard-context-tcyTU8jm.js +0 -618
- package/dist/chunks/schema-C9NPiIru.js +0 -2568
- package/dist/chunks/selection-filter-compiler-DNijjI5y.js +0 -150
- package/dist/chunks/semaphor-ready-indicator-FBvunj6S.js +0 -145603
- package/dist/chunks/shelf-drop-preview-context-QKStrcK9.js +0 -2466
- package/dist/chunks/stored-dashboard-CHozcAY9.js +0 -4075
- package/dist/chunks/style-sheet-parts-CDCG-8Ej.js +0 -8681
- package/dist/chunks/table-export-sheet-ZFIvs6Sj.js +0 -949
- package/dist/chunks/token-types-XbM6QByy.js +0 -8
- package/dist/chunks/upload-H15d7uHK.js +0 -15
- package/dist/chunks/validators-Baf3VIf5.js +0 -3686
- package/dist/chunks/variable-draft-C2y8Jp6Z.js +0 -242
- package/dist/chunks/visual-choice-DDfHfHvY.js +0 -172
|
@@ -1,4875 +0,0 @@
|
|
|
1
|
-
import { jsx as t, jsxs as s, Fragment as $ } from "react/jsx-runtime";
|
|
2
|
-
import la, { useState as E, useEffect as Ee, useCallback as ie, useMemo as Y, useLayoutEffect as $t, useRef as et, useContext as Va } from "react";
|
|
3
|
-
import { dP as it, bH as Le, bI as Ve, bK as Be, dQ as Ba, b8 as $e, b5 as ot, dR as Pa, dS as lt, dT as wt, an as dt, ak as ve, u as C, dU as _a, dV as Oa, bG as z, dW as za, am as oe, b3 as Ra, cV as Ma, dX as Ua, dY as $a, bV as da, bT as be, dd as ca, b_ as tt, w as ja, q as qa, dZ as Wa, dg as St, dh as kt, di as Dt, dj as At, dk as Ft, dl as Et, dm as It, dn as ua, bQ as Tt, d_ as Qa, dv as Ha, d5 as pt, d2 as je, d3 as qe, dI as ha, d4 as We, cS as re, de as Ka, d9 as at, d$ as Ga, cQ as Ya, e0 as ma, bu as ct, bJ as Lt, bL as ut, e1 as pa, bF as Xa, e2 as Ja, bv as Za, o as en, bY as tn, e3 as an, W as nn, P as fa, bp as rn, X as sn, G as on, e4 as ln, e5 as dn, e6 as cn, e7 as ga, e8 as un, e9 as hn, ea as Ne, eb as mn, R as ba, ec as pn, ed as fn, b0 as gn, ee as bn, ef as ge, eg as xn, aa as Vt, eh as vn, ei as ft, ej as yn, ek as jt, el as Cn, em as Nn, en as wn, eo as xa, c8 as Sn, ep as kn, eq as Dn, er as An, dC as Bt, bR as va, es as Fn, et as qt, eu as En, ev as In, ew as Tn, ex as Ln, b7 as Vn, bA as Bn, cU as ya, ey as Pn, ez as _n, eA as Xe, eB as On, eC as zn, eD as Rn, A as Mn, aR as Un, aS as $n, ax as jn, aw as qn, av as Wn, au as Qn, ar as Hn, ap as Kn, eE as Gn, eF as Yn, eG as Xn, eH as Jn, eI as Zn, aP as er } from "./semaphor-ready-indicator-FBvunj6S.js";
|
|
4
|
-
import { c as Ae, B as L, X as Qe, s as Me, x as xe, L as de, q as Pt, j as _t, p as tr, F as Ot, e as Ie, a8 as Ca, h as Te, f as nt, i as Na, g as Nt, y as we, z as Se, A as ke, D as De, E as fe, a9 as ar } from "./style-sheet-parts-CDCG-8Ej.js";
|
|
5
|
-
import { L as Ue } from "./layout-grid-9LndRoLa.js";
|
|
6
|
-
import { c as J } from "./pickers-DkqmtnTL.js";
|
|
7
|
-
import { T as nr } from "./validators-Baf3VIf5.js";
|
|
8
|
-
import "./matrix-operation-contract-DPBj69D8.js";
|
|
9
|
-
import "./analytics-base-schemas-DsUh5Q3C.js";
|
|
10
|
-
import "../value-format-preferences/index.js";
|
|
11
|
-
import { s as Je } from "./normalize-dashboard-for-dirty-check-XKgH3GFX.js";
|
|
12
|
-
import { cd as Wt, bM as Qt, fX as Ht, ic as rr, id as rt, ib as gt, ie as sr, q as He, ig as ir, B as or, ih as lr, ii as dr, ij as cr, di as ur, ik as hr, y as mr, hx as pr, il as fr, im as gr, e as zt, b9 as br, a8 as xr, cX as vr, io as yr, ip as Cr, d7 as Nr, iq as wr, ir as Kt, is as Sr } from "./resolve-dashboard-input-context-Rtl1ffmE.js";
|
|
13
|
-
import { S as wa } from "./save-C5A0JnEV.js";
|
|
14
|
-
import { V as kr, L as Dr, u as Sa, C as ka, F as Ar, a as Fr, A as Er, b as Ir } from "./card-filter-builder-Y22HizVx.js";
|
|
15
|
-
import { createPortal as Tr } from "react-dom";
|
|
16
|
-
import { b7 as Gt, aD as Lr } from "./pivot-result-contract-expectations-BYqAmG9n.js";
|
|
17
|
-
import { aD as Vr, as as Br, H as Pr, ad as st, U as _r } from "./bookmark-state-n7AaNzR_.js";
|
|
18
|
-
import "zod";
|
|
19
|
-
import "./schema-C9NPiIru.js";
|
|
20
|
-
import "./index-CV_Kzou0.js";
|
|
21
|
-
import "./context-UCQ7sere.js";
|
|
22
|
-
import { v as Or, J as zr } from "./filter-reach-copy-CE_ZX147.js";
|
|
23
|
-
import { a as Yt, d as Xt, c as Rr, i as Mr, b as Ur, e as $r, v as Jt, f as Zt, g as jr } from "./variable-draft-C2y8Jp6Z.js";
|
|
24
|
-
import { g as pe, d as qr, a as Wr } from "./index-D5rxbtS4.js";
|
|
25
|
-
/**
|
|
26
|
-
* @license lucide-react v0.453.0 - ISC
|
|
27
|
-
*
|
|
28
|
-
* This source code is licensed under the ISC license.
|
|
29
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
30
|
-
*/
|
|
31
|
-
const Qr = Ae("ArrowUpRight", [
|
|
32
|
-
["path", { d: "M7 7h10v10", key: "1tivn9" }],
|
|
33
|
-
["path", { d: "M7 17 17 7", key: "1vkiza" }]
|
|
34
|
-
]);
|
|
35
|
-
/**
|
|
36
|
-
* @license lucide-react v0.453.0 - ISC
|
|
37
|
-
*
|
|
38
|
-
* This source code is licensed under the ISC license.
|
|
39
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
40
|
-
*/
|
|
41
|
-
const ea = Ae("Bell", [
|
|
42
|
-
["path", { d: "M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9", key: "1qo2s2" }],
|
|
43
|
-
["path", { d: "M10.3 21a1.94 1.94 0 0 0 3.4 0", key: "qgo35s" }]
|
|
44
|
-
]);
|
|
45
|
-
/**
|
|
46
|
-
* @license lucide-react v0.453.0 - ISC
|
|
47
|
-
*
|
|
48
|
-
* This source code is licensed under the ISC license.
|
|
49
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
50
|
-
*/
|
|
51
|
-
const Hr = Ae("CodeXml", [
|
|
52
|
-
["path", { d: "m18 16 4-4-4-4", key: "1inbqp" }],
|
|
53
|
-
["path", { d: "m6 8-4 4 4 4", key: "15zrgr" }],
|
|
54
|
-
["path", { d: "m14.5 4-5 16", key: "e7oirm" }]
|
|
55
|
-
]);
|
|
56
|
-
/**
|
|
57
|
-
* @license lucide-react v0.453.0 - ISC
|
|
58
|
-
*
|
|
59
|
-
* This source code is licensed under the ISC license.
|
|
60
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
-
*/
|
|
62
|
-
const ta = Ae("MonitorSmartphone", [
|
|
63
|
-
["path", { d: "M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8", key: "10dyio" }],
|
|
64
|
-
["path", { d: "M10 19v-3.96 3.15", key: "1irgej" }],
|
|
65
|
-
["path", { d: "M7 19h5", key: "qswx4l" }],
|
|
66
|
-
["rect", { width: "6", height: "10", x: "16", y: "12", rx: "2", key: "1egngj" }]
|
|
67
|
-
]);
|
|
68
|
-
/**
|
|
69
|
-
* @license lucide-react v0.453.0 - ISC
|
|
70
|
-
*
|
|
71
|
-
* This source code is licensed under the ISC license.
|
|
72
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
73
|
-
*/
|
|
74
|
-
const Kr = Ae("MousePointer2", [
|
|
75
|
-
[
|
|
76
|
-
"path",
|
|
77
|
-
{
|
|
78
|
-
d: "M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",
|
|
79
|
-
key: "edeuup"
|
|
80
|
-
}
|
|
81
|
-
]
|
|
82
|
-
]);
|
|
83
|
-
/**
|
|
84
|
-
* @license lucide-react v0.453.0 - ISC
|
|
85
|
-
*
|
|
86
|
-
* This source code is licensed under the ISC license.
|
|
87
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
88
|
-
*/
|
|
89
|
-
const Gr = Ae("Newspaper", [
|
|
90
|
-
[
|
|
91
|
-
"path",
|
|
92
|
-
{
|
|
93
|
-
d: "M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2",
|
|
94
|
-
key: "7pis2x"
|
|
95
|
-
}
|
|
96
|
-
],
|
|
97
|
-
["path", { d: "M18 14h-8", key: "sponae" }],
|
|
98
|
-
["path", { d: "M15 18h-5", key: "95g1m2" }],
|
|
99
|
-
["path", { d: "M10 6h8v4h-8V6Z", key: "smlsk5" }]
|
|
100
|
-
]);
|
|
101
|
-
/**
|
|
102
|
-
* @license lucide-react v0.453.0 - ISC
|
|
103
|
-
*
|
|
104
|
-
* This source code is licensed under the ISC license.
|
|
105
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
106
|
-
*/
|
|
107
|
-
const Yr = Ae("Terminal", [
|
|
108
|
-
["polyline", { points: "4 17 10 11 4 5", key: "akl6gq" }],
|
|
109
|
-
["line", { x1: "12", x2: "20", y1: "19", y2: "19", key: "q2wloq" }]
|
|
110
|
-
]);
|
|
111
|
-
function Xr() {
|
|
112
|
-
return /* @__PURE__ */ t("div", { className: "space-y-1.5 py-1", children: [...Array(5)].map((e, a) => /* @__PURE__ */ s(
|
|
113
|
-
"div",
|
|
114
|
-
{
|
|
115
|
-
className: "flex animate-pulse items-start gap-3 rounded-xl border border-transparent px-2.5 py-2.5",
|
|
116
|
-
children: [
|
|
117
|
-
/* @__PURE__ */ t("div", { className: "mt-0.5 h-4 w-4 flex-shrink-0 rounded bg-muted/60" }),
|
|
118
|
-
/* @__PURE__ */ s("div", { className: "flex-1 space-y-1.5", children: [
|
|
119
|
-
/* @__PURE__ */ t("div", { className: "h-4 w-3/5 rounded bg-muted/60" }),
|
|
120
|
-
/* @__PURE__ */ t("div", { className: "h-3 w-4/5 rounded bg-muted/40" })
|
|
121
|
-
] })
|
|
122
|
-
]
|
|
123
|
-
},
|
|
124
|
-
a
|
|
125
|
-
)) });
|
|
126
|
-
}
|
|
127
|
-
function Jr({
|
|
128
|
-
open: e,
|
|
129
|
-
onOpenChange: a,
|
|
130
|
-
onSubmit: r,
|
|
131
|
-
isCreating: n
|
|
132
|
-
}) {
|
|
133
|
-
const i = it("interactive"), [o, l] = E(""), [h, d] = E("");
|
|
134
|
-
Ee(() => {
|
|
135
|
-
e || (l(""), d(""));
|
|
136
|
-
}, [e]);
|
|
137
|
-
const c = () => {
|
|
138
|
-
o.trim() && r({ title: o, description: h });
|
|
139
|
-
}, u = (p) => {
|
|
140
|
-
a(p);
|
|
141
|
-
};
|
|
142
|
-
return /* @__PURE__ */ t(Le, { open: e, onOpenChange: u, children: /* @__PURE__ */ s(
|
|
143
|
-
Ve,
|
|
144
|
-
{
|
|
145
|
-
showCloseButton: !1,
|
|
146
|
-
className: "flex max-w-lg grid-cols-none flex-col gap-0 overflow-hidden rounded-card border-border/60 p-0 shadow-lg sm:rounded-card",
|
|
147
|
-
style: i.dialogStyle,
|
|
148
|
-
children: [
|
|
149
|
-
/* @__PURE__ */ s("div", { className: "flex h-10 shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3", children: [
|
|
150
|
-
/* @__PURE__ */ s("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
151
|
-
/* @__PURE__ */ t(Ue, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
152
|
-
/* @__PURE__ */ s("div", { className: "flex min-w-0 items-baseline gap-2", children: [
|
|
153
|
-
/* @__PURE__ */ t(Be, { className: "truncate text-[13px] font-medium leading-none tracking-normal", children: "New library visual" }),
|
|
154
|
-
/* @__PURE__ */ t("span", { className: "shrink-0 text-[10px] font-medium uppercase leading-none tracking-[0.08em] text-muted-foreground", children: "Visual" })
|
|
155
|
-
] })
|
|
156
|
-
] }),
|
|
157
|
-
/* @__PURE__ */ t(
|
|
158
|
-
L,
|
|
159
|
-
{
|
|
160
|
-
size: "xs",
|
|
161
|
-
variant: "ghost",
|
|
162
|
-
className: "w-7 px-0 text-muted-foreground hover:text-foreground",
|
|
163
|
-
onClick: () => u(!1),
|
|
164
|
-
"aria-label": "Close",
|
|
165
|
-
disabled: n,
|
|
166
|
-
children: /* @__PURE__ */ t(Qe, { className: "h-3.5 w-3.5" })
|
|
167
|
-
}
|
|
168
|
-
)
|
|
169
|
-
] }),
|
|
170
|
-
/* @__PURE__ */ s("div", { className: "space-y-3 px-4 py-3", children: [
|
|
171
|
-
/* @__PURE__ */ t("p", { className: "text-[12px] text-muted-foreground", children: "Create a saved visual that can be reused across dashboards." }),
|
|
172
|
-
/* @__PURE__ */ s("div", { className: "space-y-1.5", children: [
|
|
173
|
-
/* @__PURE__ */ t(Me, { htmlFor: "visual-title", className: "text-[12px]", children: "Name" }),
|
|
174
|
-
/* @__PURE__ */ t(
|
|
175
|
-
xe,
|
|
176
|
-
{
|
|
177
|
-
id: "visual-title",
|
|
178
|
-
size: "sm",
|
|
179
|
-
placeholder: "Untitled visual",
|
|
180
|
-
value: o,
|
|
181
|
-
onChange: (p) => l(p.target.value),
|
|
182
|
-
disabled: n,
|
|
183
|
-
onKeyDown: (p) => {
|
|
184
|
-
p.key === "Enter" && !p.shiftKey && (p.preventDefault(), c());
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
)
|
|
188
|
-
] }),
|
|
189
|
-
/* @__PURE__ */ s("div", { className: "space-y-1.5", children: [
|
|
190
|
-
/* @__PURE__ */ t(Me, { htmlFor: "visual-description", className: "text-[12px]", children: "Description" }),
|
|
191
|
-
/* @__PURE__ */ t(
|
|
192
|
-
xe,
|
|
193
|
-
{
|
|
194
|
-
id: "visual-description",
|
|
195
|
-
size: "sm",
|
|
196
|
-
placeholder: "Optional",
|
|
197
|
-
value: h,
|
|
198
|
-
onChange: (p) => d(p.target.value),
|
|
199
|
-
disabled: n
|
|
200
|
-
}
|
|
201
|
-
)
|
|
202
|
-
] })
|
|
203
|
-
] }),
|
|
204
|
-
/* @__PURE__ */ s("div", { className: "flex shrink-0 justify-end gap-2 border-t border-border/60 px-4 py-2.5", children: [
|
|
205
|
-
/* @__PURE__ */ t(
|
|
206
|
-
L,
|
|
207
|
-
{
|
|
208
|
-
size: "xs",
|
|
209
|
-
variant: "outline",
|
|
210
|
-
onClick: () => u(!1),
|
|
211
|
-
disabled: n,
|
|
212
|
-
children: "Cancel"
|
|
213
|
-
}
|
|
214
|
-
),
|
|
215
|
-
/* @__PURE__ */ t(
|
|
216
|
-
L,
|
|
217
|
-
{
|
|
218
|
-
size: "xs",
|
|
219
|
-
onClick: c,
|
|
220
|
-
disabled: !o.trim() || n,
|
|
221
|
-
children: n ? /* @__PURE__ */ s($, { children: [
|
|
222
|
-
/* @__PURE__ */ t(de, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
223
|
-
"Creating..."
|
|
224
|
-
] }) : "Create library visual"
|
|
225
|
-
}
|
|
226
|
-
)
|
|
227
|
-
] })
|
|
228
|
-
]
|
|
229
|
-
}
|
|
230
|
-
) });
|
|
231
|
-
}
|
|
232
|
-
function Zr(e) {
|
|
233
|
-
const [a, r] = E(null), [n, i] = E(null), o = Ba();
|
|
234
|
-
return Ee(() => {
|
|
235
|
-
if (!e || e.trim() === "") {
|
|
236
|
-
r(null), i(null);
|
|
237
|
-
return;
|
|
238
|
-
}
|
|
239
|
-
if (!o)
|
|
240
|
-
return;
|
|
241
|
-
(async () => {
|
|
242
|
-
try {
|
|
243
|
-
if (!e.startsWith("http://") && !e.startsWith("https://"))
|
|
244
|
-
throw new Error(`Invalid URL format: ${e}`);
|
|
245
|
-
try {
|
|
246
|
-
new URL(e);
|
|
247
|
-
} catch {
|
|
248
|
-
throw new Error(`Invalid URL: ${e}`);
|
|
249
|
-
}
|
|
250
|
-
const d = `${e.endsWith("/") ? e : `${e}/`}index.js`;
|
|
251
|
-
try {
|
|
252
|
-
if (!(await fetch(d, { method: "HEAD" })).ok)
|
|
253
|
-
throw new Error(`Module not found at ${d}`);
|
|
254
|
-
} catch {
|
|
255
|
-
}
|
|
256
|
-
const c = await import(
|
|
257
|
-
/* @vite-ignore */
|
|
258
|
-
/* webpackIgnore: true */
|
|
259
|
-
d
|
|
260
|
-
);
|
|
261
|
-
if (typeof c.useChartStore != "function")
|
|
262
|
-
throw new Error("useChartStore is not a function");
|
|
263
|
-
r(() => c.useChartStore), i(null);
|
|
264
|
-
} catch (h) {
|
|
265
|
-
const d = h instanceof Error ? h.message : "Unknown error";
|
|
266
|
-
console.error("Failed to load remote chart store:", d), i(d), r(null);
|
|
267
|
-
}
|
|
268
|
-
})();
|
|
269
|
-
}, [e, o]), a;
|
|
270
|
-
}
|
|
271
|
-
function es(e, a) {
|
|
272
|
-
if (e.length === 0)
|
|
273
|
-
return "";
|
|
274
|
-
const r = e.find(
|
|
275
|
-
(n) => {
|
|
276
|
-
var i, o;
|
|
277
|
-
return ((i = n.customCardPreferences) == null ? void 0 : i.visualType) === "multiple" || !!((o = n.customCardPreferences) != null && o.dataInputCardIds);
|
|
278
|
-
}
|
|
279
|
-
);
|
|
280
|
-
if (r)
|
|
281
|
-
return r.id;
|
|
282
|
-
if (a) {
|
|
283
|
-
const n = e.find((i) => i.id === a);
|
|
284
|
-
if (n) {
|
|
285
|
-
const i = n.tabTitle;
|
|
286
|
-
if (i == "All__Header")
|
|
287
|
-
return e[0].id;
|
|
288
|
-
if (i && i.endsWith("__Header")) {
|
|
289
|
-
const l = i.split("__")[0], h = e.find(
|
|
290
|
-
(d) => d.tabTitle === l
|
|
291
|
-
);
|
|
292
|
-
return h ? h.id : e[0].id;
|
|
293
|
-
}
|
|
294
|
-
return a;
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
return e[0].id;
|
|
298
|
-
}
|
|
299
|
-
async function aa(e, a, r, n, i = "Opening library visual...") {
|
|
300
|
-
if (!a || !r)
|
|
301
|
-
throw new Error("Missing auth token or visual ID");
|
|
302
|
-
const o = ["resource-by-id", "visual", r], l = n.getQueryData(o);
|
|
303
|
-
if (l)
|
|
304
|
-
return console.log("Using cached visual data for:", r), { data: l, fromCache: !0 };
|
|
305
|
-
console.log("Fetching visual data from network for:", r);
|
|
306
|
-
const h = z.loading(i, {
|
|
307
|
-
position: "top-center"
|
|
308
|
-
});
|
|
309
|
-
try {
|
|
310
|
-
const d = await fetch(
|
|
311
|
-
`${e}/management/v1/visuals/${r}`,
|
|
312
|
-
{
|
|
313
|
-
headers: {
|
|
314
|
-
Authorization: `Bearer ${a}`
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
);
|
|
318
|
-
if (!d.ok)
|
|
319
|
-
throw new Error("Failed to load visual");
|
|
320
|
-
const c = await d.json();
|
|
321
|
-
return n.setQueryData(o, c), z.dismiss(h), { data: c, fromCache: !1 };
|
|
322
|
-
} catch (d) {
|
|
323
|
-
throw z.dismiss(h), d;
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
function Da(e) {
|
|
327
|
-
if (typeof e == "string")
|
|
328
|
-
return JSON.parse(e);
|
|
329
|
-
if (typeof e == "object")
|
|
330
|
-
return e;
|
|
331
|
-
throw new Error("Invalid frame object format");
|
|
332
|
-
}
|
|
333
|
-
function ts(e, a) {
|
|
334
|
-
var o, l;
|
|
335
|
-
const r = (e == null ? void 0 : e.frameObject) ?? ((o = e == null ? void 0 : e.visual) == null ? void 0 : o.frameObject);
|
|
336
|
-
if (!r)
|
|
337
|
-
return !1;
|
|
338
|
-
const n = Da(r);
|
|
339
|
-
if (!(n != null && n.cards) || n.cards.length === 0)
|
|
340
|
-
return !1;
|
|
341
|
-
const i = (l = n.cards) == null ? void 0 : l.find(
|
|
342
|
-
(h) => h.id === n.activeCardId
|
|
343
|
-
);
|
|
344
|
-
return i ? (za({
|
|
345
|
-
...a,
|
|
346
|
-
frame: n,
|
|
347
|
-
card: i,
|
|
348
|
-
visualId: (e == null ? void 0 : e.id) || n.visualId
|
|
349
|
-
}), !0) : !1;
|
|
350
|
-
}
|
|
351
|
-
function as() {
|
|
352
|
-
const e = oe(
|
|
353
|
-
(n) => {
|
|
354
|
-
var i;
|
|
355
|
-
return ((i = n.card.customCardPreferences) == null ? void 0 : i.url) || "";
|
|
356
|
-
}
|
|
357
|
-
), a = Zr(e);
|
|
358
|
-
return { getUpdatedFrame: ie(() => {
|
|
359
|
-
var w;
|
|
360
|
-
Ra();
|
|
361
|
-
const {
|
|
362
|
-
frame: n,
|
|
363
|
-
card: i,
|
|
364
|
-
isDevMode: o,
|
|
365
|
-
selectedSchemaName: l,
|
|
366
|
-
selectedDatabaseName: h,
|
|
367
|
-
selectedTableName: d,
|
|
368
|
-
selectedConnectionId: c
|
|
369
|
-
} = oe.getState(), u = i.sql, p = (w = a == null ? void 0 : a.getState()) == null ? void 0 : w.settings, m = Wt(i, {
|
|
370
|
-
isDevMode: o,
|
|
371
|
-
cardSql: u,
|
|
372
|
-
selectedSchemaName: l,
|
|
373
|
-
selectedDatabaseName: h,
|
|
374
|
-
selectedTableName: d,
|
|
375
|
-
selectedConnectionId: c,
|
|
376
|
-
remoteChartSettings: p,
|
|
377
|
-
stripConfig: Qt
|
|
378
|
-
}), f = n.cards.map((S) => {
|
|
379
|
-
if (S.id === i.id) return Ht({ before: i, after: m });
|
|
380
|
-
const V = rr(S) ? Wt(S, { isDevMode: !0, cardSql: S.sql, stripConfig: Qt }) : S;
|
|
381
|
-
return Ht({ before: S, after: V });
|
|
382
|
-
}), g = f.flatMap((S) => S.dropped);
|
|
383
|
-
g.length && z.info("Some conditional formatting rules were removed", {
|
|
384
|
-
description: `Their column isn't in the saved visual: ${g.map((S) => S.name || "an unnamed rule").join(", ")}.`
|
|
385
|
-
});
|
|
386
|
-
const y = f.map((S) => S.card);
|
|
387
|
-
return {
|
|
388
|
-
...n,
|
|
389
|
-
cards: y,
|
|
390
|
-
activeCardId: es(y, n.activeCardId)
|
|
391
|
-
};
|
|
392
|
-
}, [a]) };
|
|
393
|
-
}
|
|
394
|
-
function Pe() {
|
|
395
|
-
const { authToken: e, tokenProps: a } = $e(), r = ot(), n = Pa(), i = lt(), { selectVisual: o } = wt(), {
|
|
396
|
-
setFrame: l,
|
|
397
|
-
loadCard: h,
|
|
398
|
-
setIsDevMode: d,
|
|
399
|
-
initializeModeDrafts: c,
|
|
400
|
-
setActiveTabCardId: u,
|
|
401
|
-
updateDataSource: p,
|
|
402
|
-
setQueryResultColumns: m,
|
|
403
|
-
setSelectedConnectionId: f,
|
|
404
|
-
setSelectedDatabaseName: g,
|
|
405
|
-
setSelectedSchemaName: y,
|
|
406
|
-
setSelectedTableName: w,
|
|
407
|
-
setSelectedDatamodelId: S,
|
|
408
|
-
setInlineFilterValuesMap: V,
|
|
409
|
-
setApplyFilters: P,
|
|
410
|
-
clearEditorContext: D
|
|
411
|
-
} = dt(), {
|
|
412
|
-
setIsDashboardEditing: B,
|
|
413
|
-
setIsVisualEditing: k,
|
|
414
|
-
clearSelectedFrameId: v
|
|
415
|
-
} = ve(), b = C((O) => O.selectedSheetId), _ = C((O) => O.selectedFrameId), A = C((O) => O.dashboard), G = C(
|
|
416
|
-
(O) => O.inlineFilterValuesMap
|
|
417
|
-
), T = _a((i == null ? void 0 : i.id) || "", {
|
|
418
|
-
enabled: !!(i != null && i.id) && !!(e != null && e.accessToken)
|
|
419
|
-
}), M = ie(
|
|
420
|
-
async (O) => {
|
|
421
|
-
try {
|
|
422
|
-
o(O), v(), D();
|
|
423
|
-
const { data: te, fromCache: Z } = await aa(
|
|
424
|
-
a.apiServiceUrl,
|
|
425
|
-
(e == null ? void 0 : e.accessToken) || "",
|
|
426
|
-
O.id,
|
|
427
|
-
r,
|
|
428
|
-
"Opening library visual..."
|
|
429
|
-
);
|
|
430
|
-
if (!ts(te, {
|
|
431
|
-
setFrame: l,
|
|
432
|
-
loadCard: h,
|
|
433
|
-
setIsDevMode: d,
|
|
434
|
-
initializeModeDrafts: c,
|
|
435
|
-
setActiveTabCardId: u,
|
|
436
|
-
updateDataSource: p,
|
|
437
|
-
setQueryResultColumns: m,
|
|
438
|
-
setSelectedConnectionId: f,
|
|
439
|
-
setSelectedDatabaseName: g,
|
|
440
|
-
setSelectedSchemaName: y,
|
|
441
|
-
setSelectedTableName: w,
|
|
442
|
-
setSelectedDatamodelId: S,
|
|
443
|
-
setInlineFilterValuesMap: V,
|
|
444
|
-
setApplyFilters: P,
|
|
445
|
-
setIsDashboardEditing: B,
|
|
446
|
-
setIsVisualEditing: k,
|
|
447
|
-
dashboard: A,
|
|
448
|
-
selectedSheetId: b,
|
|
449
|
-
selectedFrameId: _,
|
|
450
|
-
inlineFilterValuesMap: G
|
|
451
|
-
}))
|
|
452
|
-
throw new Error("Failed to setup editor with visual data");
|
|
453
|
-
return { success: !0, fromCache: Z };
|
|
454
|
-
} catch (te) {
|
|
455
|
-
return console.error("Error editing visual:", te), { success: !1, error: "Failed to load visual for editing" };
|
|
456
|
-
}
|
|
457
|
-
},
|
|
458
|
-
[
|
|
459
|
-
e == null ? void 0 : e.accessToken,
|
|
460
|
-
a.apiServiceUrl,
|
|
461
|
-
r,
|
|
462
|
-
o,
|
|
463
|
-
l,
|
|
464
|
-
h,
|
|
465
|
-
B,
|
|
466
|
-
k,
|
|
467
|
-
d,
|
|
468
|
-
c,
|
|
469
|
-
u,
|
|
470
|
-
p,
|
|
471
|
-
m,
|
|
472
|
-
f,
|
|
473
|
-
g,
|
|
474
|
-
y,
|
|
475
|
-
w,
|
|
476
|
-
S,
|
|
477
|
-
V,
|
|
478
|
-
P,
|
|
479
|
-
D,
|
|
480
|
-
v,
|
|
481
|
-
A,
|
|
482
|
-
b,
|
|
483
|
-
_,
|
|
484
|
-
G
|
|
485
|
-
]
|
|
486
|
-
), X = ie(
|
|
487
|
-
async (O) => {
|
|
488
|
-
var Z;
|
|
489
|
-
const te = (K) => (z.error(K), { success: !1, error: K });
|
|
490
|
-
try {
|
|
491
|
-
if (o(O), !b)
|
|
492
|
-
return te("No sheet selected. Please select a sheet first.");
|
|
493
|
-
const { data: K, fromCache: I } = await aa(
|
|
494
|
-
a.apiServiceUrl,
|
|
495
|
-
(e == null ? void 0 : e.accessToken) || "",
|
|
496
|
-
O.id,
|
|
497
|
-
r,
|
|
498
|
-
"Adding visual to dashboard..."
|
|
499
|
-
), ae = (K == null ? void 0 : K.frameObject) ?? ((Z = K == null ? void 0 : K.visual) == null ? void 0 : Z.frameObject);
|
|
500
|
-
if (!ae)
|
|
501
|
-
return te("Visual has no frame data");
|
|
502
|
-
const q = Da(ae);
|
|
503
|
-
if (!(q != null && q.cards) || q.cards.length === 0)
|
|
504
|
-
return te("Visual frame is malformed");
|
|
505
|
-
const R = {
|
|
506
|
-
...Oa(q),
|
|
507
|
-
visualId: O.id
|
|
508
|
-
// Link this frame to the library visual
|
|
509
|
-
};
|
|
510
|
-
return await n(b, R), B(!0), { success: !0, fromCache: I };
|
|
511
|
-
} catch (K) {
|
|
512
|
-
return console.error("Error adding visual:", K), te(
|
|
513
|
-
K instanceof Error ? K.message : "Failed to add visual to dashboard"
|
|
514
|
-
);
|
|
515
|
-
}
|
|
516
|
-
},
|
|
517
|
-
[
|
|
518
|
-
e == null ? void 0 : e.accessToken,
|
|
519
|
-
a.apiServiceUrl,
|
|
520
|
-
r,
|
|
521
|
-
o,
|
|
522
|
-
b,
|
|
523
|
-
B,
|
|
524
|
-
n
|
|
525
|
-
]
|
|
526
|
-
);
|
|
527
|
-
return {
|
|
528
|
-
visual: T.data,
|
|
529
|
-
isLoading: T.isLoading,
|
|
530
|
-
isError: T.isError,
|
|
531
|
-
error: T.error,
|
|
532
|
-
handleEditLibraryVisual: M,
|
|
533
|
-
handleAddLibraryVisual: X,
|
|
534
|
-
getUpdatedFrame: as().getUpdatedFrame,
|
|
535
|
-
refetch: T.refetch
|
|
536
|
-
};
|
|
537
|
-
}
|
|
538
|
-
function Aa(e) {
|
|
539
|
-
return e ? new Date(e).toLocaleDateString("en-US", {
|
|
540
|
-
month: "short",
|
|
541
|
-
day: "numeric",
|
|
542
|
-
year: "numeric"
|
|
543
|
-
}) : "Unknown";
|
|
544
|
-
}
|
|
545
|
-
function Fa(e, a) {
|
|
546
|
-
var n;
|
|
547
|
-
const r = (n = e.ownership.createdBy) == null ? void 0 : n.type;
|
|
548
|
-
return r === "tenant" || r === "organization" && a;
|
|
549
|
-
}
|
|
550
|
-
function Rt(e, a) {
|
|
551
|
-
var r, n;
|
|
552
|
-
return Fa(e, a) ? ((r = e.ownership.createdBy) == null ? void 0 : r.name) || ((n = e.createdByTenantUserRel) == null ? void 0 : n.name) || e.lastModifiedBy || "Unknown" : "Organization";
|
|
553
|
-
}
|
|
554
|
-
function ns(e, a) {
|
|
555
|
-
return Rt(e, a).split(/\s+/).filter(Boolean).slice(0, 2).map((n) => n.charAt(0).toUpperCase()).join("") || "?";
|
|
556
|
-
}
|
|
557
|
-
function rs(e) {
|
|
558
|
-
const a = (e || "").toLowerCase();
|
|
559
|
-
return a.includes("table") ? Pt : a.includes("pie") || a.includes("donut") ? Qa : a.includes("line") ? Ha : a.includes("bar") ? tr : Ue;
|
|
560
|
-
}
|
|
561
|
-
function ss({ visual: e }) {
|
|
562
|
-
const a = e.ownership.status === "public" ? "Public" : e.ownership.status === "shared" || e.ownership.sharedCount > 0 ? "Shared" : "Private";
|
|
563
|
-
return /* @__PURE__ */ t("span", { className: "inline-flex items-center rounded-[4px] border border-border/60 px-1.5 py-px text-[11px] text-muted-foreground", children: a });
|
|
564
|
-
}
|
|
565
|
-
function qi({
|
|
566
|
-
open: e,
|
|
567
|
-
onOpenChange: a
|
|
568
|
-
}) {
|
|
569
|
-
const r = it("interactive"), [n, i] = E(""), [o, l] = E(/* @__PURE__ */ new Set()), [h, d] = E(!1), [c, u] = E(
|
|
570
|
-
null
|
|
571
|
-
), [p, m] = E(
|
|
572
|
-
null
|
|
573
|
-
), [f, g] = E(!1), [y, w] = E(null), [S, V] = E(null), P = () => {
|
|
574
|
-
l(/* @__PURE__ */ new Set()), u(null), m(null), g(!1), w(null);
|
|
575
|
-
}, D = () => {
|
|
576
|
-
a(!1), P();
|
|
577
|
-
}, { selectVisual: B } = wt(), { handleAddLibraryVisual: k, handleEditLibraryVisual: v } = Pe(), { isConsoleMode: b } = Ma(), {
|
|
578
|
-
resources: _,
|
|
579
|
-
isLoading: A,
|
|
580
|
-
isError: G,
|
|
581
|
-
createResource: T,
|
|
582
|
-
updateResource: M,
|
|
583
|
-
deleteResourceAsync: X,
|
|
584
|
-
duplicateResource: O,
|
|
585
|
-
isCreating: te,
|
|
586
|
-
isDeleting: Z
|
|
587
|
-
} = Ua(
|
|
588
|
-
void 0,
|
|
589
|
-
(N) => {
|
|
590
|
-
d(!1), N && (B(N), v(N), D());
|
|
591
|
-
}
|
|
592
|
-
), {
|
|
593
|
-
startUpdating: K,
|
|
594
|
-
stopUpdating: I,
|
|
595
|
-
isUpdating: ae
|
|
596
|
-
} = $a(), q = _, R = Y(() => {
|
|
597
|
-
const N = n.trim().toLowerCase();
|
|
598
|
-
return N ? q.filter(
|
|
599
|
-
(W) => {
|
|
600
|
-
var ee, me, Ce;
|
|
601
|
-
return ((ee = W.title) == null ? void 0 : ee.toLowerCase().includes(N)) || ((me = W.description) == null ? void 0 : me.toLowerCase().includes(N)) || ((Ce = W.kind) == null ? void 0 : Ce.toLowerCase().includes(N));
|
|
602
|
-
}
|
|
603
|
-
) : q;
|
|
604
|
-
}, [n, q]), ne = Y(
|
|
605
|
-
() => q.filter(
|
|
606
|
-
(N) => o.has(N.id)
|
|
607
|
-
),
|
|
608
|
-
[o, q]
|
|
609
|
-
), ue = ne.filter(
|
|
610
|
-
(N) => N.permissions.canDelete
|
|
611
|
-
), he = ne.filter(
|
|
612
|
-
(N) => N.permissions.canShare
|
|
613
|
-
), ye = R.length > 0 && R.every(
|
|
614
|
-
(N) => o.has(N.id)
|
|
615
|
-
), x = R.some(
|
|
616
|
-
(N) => o.has(N.id)
|
|
617
|
-
), U = (N) => {
|
|
618
|
-
const W = new Set(o);
|
|
619
|
-
N(W), l(W);
|
|
620
|
-
}, j = (N) => {
|
|
621
|
-
U((W) => {
|
|
622
|
-
W.has(N) ? W.delete(N) : W.add(N);
|
|
623
|
-
});
|
|
624
|
-
}, H = () => {
|
|
625
|
-
l((N) => {
|
|
626
|
-
const W = new Set(N);
|
|
627
|
-
return ye ? R.forEach(
|
|
628
|
-
(ee) => W.delete(ee.id)
|
|
629
|
-
) : R.forEach(
|
|
630
|
-
(ee) => W.add(ee.id)
|
|
631
|
-
), W;
|
|
632
|
-
});
|
|
633
|
-
}, le = async (N) => {
|
|
634
|
-
(await k(N)).success && D();
|
|
635
|
-
}, _e = async () => {
|
|
636
|
-
const N = ne;
|
|
637
|
-
if (N.length === 0) return;
|
|
638
|
-
let W = !1;
|
|
639
|
-
for (const ee of N)
|
|
640
|
-
if (!(await k(ee)).success) {
|
|
641
|
-
W = !0;
|
|
642
|
-
break;
|
|
643
|
-
}
|
|
644
|
-
W || D();
|
|
645
|
-
}, ht = (N) => {
|
|
646
|
-
v(N), D();
|
|
647
|
-
}, Fe = (N) => {
|
|
648
|
-
V(N), O(N, {
|
|
649
|
-
onSettled: () => V(null)
|
|
650
|
-
});
|
|
651
|
-
}, Ke = () => {
|
|
652
|
-
if (ue.length === 0) {
|
|
653
|
-
z.error("Select a visual you can delete");
|
|
654
|
-
return;
|
|
655
|
-
}
|
|
656
|
-
w(null), g(!0);
|
|
657
|
-
}, mt = async () => {
|
|
658
|
-
const N = y ? [y] : ue;
|
|
659
|
-
try {
|
|
660
|
-
for (const W of N)
|
|
661
|
-
await X(W.id);
|
|
662
|
-
l((W) => {
|
|
663
|
-
const ee = new Set(W);
|
|
664
|
-
return N.forEach(
|
|
665
|
-
(me) => ee.delete(me.id)
|
|
666
|
-
), ee;
|
|
667
|
-
}), g(!1), w(null);
|
|
668
|
-
} catch {
|
|
669
|
-
}
|
|
670
|
-
}, Oe = () => {
|
|
671
|
-
if (ne.length !== 1) {
|
|
672
|
-
z.error("Select one visual to share");
|
|
673
|
-
return;
|
|
674
|
-
}
|
|
675
|
-
const [N] = ne;
|
|
676
|
-
if (!N.permissions.canShare) {
|
|
677
|
-
z.error("You do not have permission to share this visual");
|
|
678
|
-
return;
|
|
679
|
-
}
|
|
680
|
-
u(N);
|
|
681
|
-
}, ze = ({
|
|
682
|
-
title: N,
|
|
683
|
-
description: W
|
|
684
|
-
}) => {
|
|
685
|
-
if (!p) return;
|
|
686
|
-
const ee = {};
|
|
687
|
-
if (N !== p.title && (ee.title = N), (p.description || "") !== W && (ee.description = W), Object.keys(ee).length === 0) {
|
|
688
|
-
m(null);
|
|
689
|
-
return;
|
|
690
|
-
}
|
|
691
|
-
const me = Object.keys(ee), Ce = me.length === 1 ? me[0] : void 0;
|
|
692
|
-
K(p.id, Ce), M(
|
|
693
|
-
{
|
|
694
|
-
resourceId: p.id,
|
|
695
|
-
data: ee
|
|
696
|
-
},
|
|
697
|
-
{
|
|
698
|
-
onSuccess: () => {
|
|
699
|
-
I(p.id, Ce), m(null);
|
|
700
|
-
},
|
|
701
|
-
onError: () => {
|
|
702
|
-
I(p.id, Ce);
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
);
|
|
706
|
-
}, ce = (N) => {
|
|
707
|
-
a(N), N || P();
|
|
708
|
-
}, Re = y ? 1 : ue.length;
|
|
709
|
-
return /* @__PURE__ */ s($, { children: [
|
|
710
|
-
/* @__PURE__ */ t(Le, { open: e, onOpenChange: ce, children: /* @__PURE__ */ s(
|
|
711
|
-
Ve,
|
|
712
|
-
{
|
|
713
|
-
showCloseButton: !1,
|
|
714
|
-
className: "flex max-h-[80vh] w-[min(72rem,calc(100vw-2rem))] max-w-none grid-cols-none flex-col gap-0 overflow-hidden rounded-card border-border/60 p-0 shadow-lg sm:rounded-card",
|
|
715
|
-
style: r.dialogStyle,
|
|
716
|
-
children: [
|
|
717
|
-
/* @__PURE__ */ s("div", { className: "flex h-10 shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3", children: [
|
|
718
|
-
/* @__PURE__ */ s("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
719
|
-
/* @__PURE__ */ t(Pt, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
720
|
-
/* @__PURE__ */ s("div", { className: "flex min-w-0 items-baseline gap-2", children: [
|
|
721
|
-
/* @__PURE__ */ t(Be, { className: "truncate text-[13px] font-medium leading-none tracking-normal", children: "Visuals library" }),
|
|
722
|
-
/* @__PURE__ */ t("span", { className: "shrink-0 text-[10px] font-medium uppercase leading-none tracking-[0.08em] text-muted-foreground", children: "Add to dashboard" })
|
|
723
|
-
] })
|
|
724
|
-
] }),
|
|
725
|
-
/* @__PURE__ */ t(
|
|
726
|
-
L,
|
|
727
|
-
{
|
|
728
|
-
size: "xs",
|
|
729
|
-
variant: "ghost",
|
|
730
|
-
className: "w-7 px-0 text-muted-foreground hover:text-foreground",
|
|
731
|
-
onClick: () => ce(!1),
|
|
732
|
-
"aria-label": "Close visuals library",
|
|
733
|
-
children: "×"
|
|
734
|
-
}
|
|
735
|
-
)
|
|
736
|
-
] }),
|
|
737
|
-
/* @__PURE__ */ s("div", { className: "flex shrink-0 items-center gap-2 border-b border-border/60 px-3 py-2", children: [
|
|
738
|
-
/* @__PURE__ */ s("div", { className: "relative min-w-[12rem] flex-1 md:max-w-md", children: [
|
|
739
|
-
/* @__PURE__ */ t(da, { className: "pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
|
|
740
|
-
/* @__PURE__ */ t(
|
|
741
|
-
"input",
|
|
742
|
-
{
|
|
743
|
-
autoFocus: !0,
|
|
744
|
-
value: n,
|
|
745
|
-
onChange: (N) => i(N.target.value),
|
|
746
|
-
placeholder: "Search visuals...",
|
|
747
|
-
className: "h-7 w-full rounded-control border border-input bg-background pl-7 pr-2 text-[12px] text-foreground placeholder:text-muted-foreground focus:border-ring focus:outline-none",
|
|
748
|
-
"aria-label": "Search visuals"
|
|
749
|
-
}
|
|
750
|
-
)
|
|
751
|
-
] }),
|
|
752
|
-
/* @__PURE__ */ s(
|
|
753
|
-
L,
|
|
754
|
-
{
|
|
755
|
-
size: "xs",
|
|
756
|
-
variant: "outline",
|
|
757
|
-
className: "ml-auto",
|
|
758
|
-
onClick: () => d(!0),
|
|
759
|
-
children: [
|
|
760
|
-
/* @__PURE__ */ t(be, { className: "h-3.5 w-3.5" }),
|
|
761
|
-
"New library visual"
|
|
762
|
-
]
|
|
763
|
-
}
|
|
764
|
-
)
|
|
765
|
-
] }),
|
|
766
|
-
/* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: A ? /* @__PURE__ */ t("div", { className: "p-3", children: /* @__PURE__ */ t(Xr, {}) }) : G ? /* @__PURE__ */ t("div", { className: "flex flex-col items-center gap-2 px-4 py-12 text-center", children: /* @__PURE__ */ t("p", { className: "text-[13px] text-destructive", children: "Failed to load visuals" }) }) : R.length === 0 ? /* @__PURE__ */ s("div", { className: "flex flex-col items-center gap-2 px-4 py-12 text-center", children: [
|
|
767
|
-
/* @__PURE__ */ t(Ue, { className: "h-5 w-5 text-muted-foreground/60" }),
|
|
768
|
-
/* @__PURE__ */ t("p", { className: "text-[13px] font-medium", children: n ? "No visuals found" : "No visuals yet" }),
|
|
769
|
-
/* @__PURE__ */ t("p", { className: "text-[12px] text-muted-foreground", children: n ? "Try a different search." : "Create a saved visual to add it here." })
|
|
770
|
-
] }) : /* @__PURE__ */ t(
|
|
771
|
-
is,
|
|
772
|
-
{
|
|
773
|
-
visuals: R,
|
|
774
|
-
selectedIds: o,
|
|
775
|
-
allFilteredSelected: ye,
|
|
776
|
-
someFilteredSelected: x,
|
|
777
|
-
onSelectAll: H,
|
|
778
|
-
onToggleSelection: j,
|
|
779
|
-
onAddVisual: le,
|
|
780
|
-
onOpenVisual: ht,
|
|
781
|
-
onEditDetails: m,
|
|
782
|
-
onShareVisual: u,
|
|
783
|
-
onDeleteVisual: (N) => {
|
|
784
|
-
w(N), g(!0);
|
|
785
|
-
},
|
|
786
|
-
onDuplicateVisual: Fe,
|
|
787
|
-
duplicatingId: S,
|
|
788
|
-
isDeleting: Z,
|
|
789
|
-
isConsoleMode: b
|
|
790
|
-
}
|
|
791
|
-
) }),
|
|
792
|
-
/* @__PURE__ */ s("div", { className: "flex shrink-0 items-center justify-between gap-2 border-t border-border/60 px-3 py-2", children: [
|
|
793
|
-
/* @__PURE__ */ t("div", { className: "flex min-w-0 items-center gap-1.5", children: o.size > 0 && /* @__PURE__ */ s($, { children: [
|
|
794
|
-
/* @__PURE__ */ s("span", { className: "text-[12px] text-muted-foreground", children: [
|
|
795
|
-
/* @__PURE__ */ t("span", { className: "font-medium tabular-nums text-foreground", children: o.size }),
|
|
796
|
-
" ",
|
|
797
|
-
"selected"
|
|
798
|
-
] }),
|
|
799
|
-
/* @__PURE__ */ t(
|
|
800
|
-
L,
|
|
801
|
-
{
|
|
802
|
-
size: "xs",
|
|
803
|
-
variant: "ghost",
|
|
804
|
-
onClick: () => l(/* @__PURE__ */ new Set()),
|
|
805
|
-
children: "Clear"
|
|
806
|
-
}
|
|
807
|
-
),
|
|
808
|
-
/* @__PURE__ */ s(
|
|
809
|
-
L,
|
|
810
|
-
{
|
|
811
|
-
size: "xs",
|
|
812
|
-
variant: "outline",
|
|
813
|
-
onClick: Oe,
|
|
814
|
-
disabled: ne.length !== 1 || he.length !== 1,
|
|
815
|
-
children: [
|
|
816
|
-
/* @__PURE__ */ t(ca, { className: "h-3.5 w-3.5" }),
|
|
817
|
-
"Share"
|
|
818
|
-
]
|
|
819
|
-
}
|
|
820
|
-
),
|
|
821
|
-
/* @__PURE__ */ s(
|
|
822
|
-
L,
|
|
823
|
-
{
|
|
824
|
-
size: "xs",
|
|
825
|
-
variant: "outline",
|
|
826
|
-
className: "text-destructive hover:text-destructive",
|
|
827
|
-
onClick: Ke,
|
|
828
|
-
disabled: ue.length === 0,
|
|
829
|
-
children: [
|
|
830
|
-
/* @__PURE__ */ t(tt, { className: "h-3.5 w-3.5" }),
|
|
831
|
-
"Delete ",
|
|
832
|
-
ue.length || o.size
|
|
833
|
-
]
|
|
834
|
-
}
|
|
835
|
-
)
|
|
836
|
-
] }) }),
|
|
837
|
-
/* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
|
|
838
|
-
/* @__PURE__ */ t(
|
|
839
|
-
L,
|
|
840
|
-
{
|
|
841
|
-
size: "xs",
|
|
842
|
-
variant: "outline",
|
|
843
|
-
onClick: () => ce(!1),
|
|
844
|
-
children: "Close"
|
|
845
|
-
}
|
|
846
|
-
),
|
|
847
|
-
/* @__PURE__ */ s(
|
|
848
|
-
L,
|
|
849
|
-
{
|
|
850
|
-
size: "xs",
|
|
851
|
-
onClick: _e,
|
|
852
|
-
disabled: o.size === 0,
|
|
853
|
-
children: [
|
|
854
|
-
/* @__PURE__ */ t(_t, { className: "h-3.5 w-3.5" }),
|
|
855
|
-
o.size === 0 ? "Add to dashboard" : `Add ${o.size} visual${o.size === 1 ? "" : "s"}`
|
|
856
|
-
]
|
|
857
|
-
}
|
|
858
|
-
)
|
|
859
|
-
] })
|
|
860
|
-
] })
|
|
861
|
-
]
|
|
862
|
-
}
|
|
863
|
-
) }),
|
|
864
|
-
/* @__PURE__ */ t(
|
|
865
|
-
Jr,
|
|
866
|
-
{
|
|
867
|
-
open: h,
|
|
868
|
-
onOpenChange: d,
|
|
869
|
-
onSubmit: T,
|
|
870
|
-
isCreating: te
|
|
871
|
-
}
|
|
872
|
-
),
|
|
873
|
-
c && /* @__PURE__ */ t(
|
|
874
|
-
ja,
|
|
875
|
-
{
|
|
876
|
-
resource: c,
|
|
877
|
-
resourceType: qa.VISUAL,
|
|
878
|
-
onClose: () => u(null)
|
|
879
|
-
}
|
|
880
|
-
),
|
|
881
|
-
p && /* @__PURE__ */ t(
|
|
882
|
-
Wa,
|
|
883
|
-
{
|
|
884
|
-
open: !!p,
|
|
885
|
-
resourceLabel: "Visual",
|
|
886
|
-
initialTitle: p.title || "",
|
|
887
|
-
initialDescription: p.description || "",
|
|
888
|
-
onClose: () => m(null),
|
|
889
|
-
onSave: ze,
|
|
890
|
-
isSaving: ae(p.id)
|
|
891
|
-
}
|
|
892
|
-
),
|
|
893
|
-
/* @__PURE__ */ t(
|
|
894
|
-
St,
|
|
895
|
-
{
|
|
896
|
-
open: f,
|
|
897
|
-
onOpenChange: (N) => {
|
|
898
|
-
!N && Z || (g(N), N || w(null));
|
|
899
|
-
},
|
|
900
|
-
children: /* @__PURE__ */ s(kt, { children: [
|
|
901
|
-
/* @__PURE__ */ s(Dt, { children: [
|
|
902
|
-
/* @__PURE__ */ s(At, { children: [
|
|
903
|
-
"Delete ",
|
|
904
|
-
Re,
|
|
905
|
-
" visual",
|
|
906
|
-
Re === 1 ? "" : "s",
|
|
907
|
-
"?"
|
|
908
|
-
] }),
|
|
909
|
-
/* @__PURE__ */ t(Ft, { children: "This cannot be undone. Visuals already added to dashboards may need to be removed from those dashboards separately." })
|
|
910
|
-
] }),
|
|
911
|
-
/* @__PURE__ */ s(Et, { children: [
|
|
912
|
-
/* @__PURE__ */ t(It, { disabled: Z, children: "Cancel" }),
|
|
913
|
-
/* @__PURE__ */ s(
|
|
914
|
-
ua,
|
|
915
|
-
{
|
|
916
|
-
onClick: (N) => {
|
|
917
|
-
N.preventDefault(), mt();
|
|
918
|
-
},
|
|
919
|
-
disabled: Z || Re === 0,
|
|
920
|
-
children: [
|
|
921
|
-
Z ? /* @__PURE__ */ t(de, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ t(tt, { className: "h-3.5 w-3.5" }),
|
|
922
|
-
Z ? "Deleting..." : "Delete"
|
|
923
|
-
]
|
|
924
|
-
}
|
|
925
|
-
)
|
|
926
|
-
] })
|
|
927
|
-
] })
|
|
928
|
-
}
|
|
929
|
-
)
|
|
930
|
-
] });
|
|
931
|
-
}
|
|
932
|
-
function is({
|
|
933
|
-
visuals: e,
|
|
934
|
-
selectedIds: a,
|
|
935
|
-
allFilteredSelected: r,
|
|
936
|
-
someFilteredSelected: n,
|
|
937
|
-
onSelectAll: i,
|
|
938
|
-
onToggleSelection: o,
|
|
939
|
-
onAddVisual: l,
|
|
940
|
-
onOpenVisual: h,
|
|
941
|
-
onEditDetails: d,
|
|
942
|
-
onShareVisual: c,
|
|
943
|
-
onDeleteVisual: u,
|
|
944
|
-
onDuplicateVisual: p,
|
|
945
|
-
duplicatingId: m,
|
|
946
|
-
isDeleting: f,
|
|
947
|
-
isConsoleMode: g
|
|
948
|
-
}) {
|
|
949
|
-
return /* @__PURE__ */ s("div", { className: "min-w-[48rem]", children: [
|
|
950
|
-
/* @__PURE__ */ s("div", { className: "grid h-9 grid-cols-[2.5rem_minmax(14rem,1.8fr)_minmax(10rem,1fr)_8rem_7rem_5rem_5.5rem] items-center border-b border-border/60 px-3 text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: [
|
|
951
|
-
/* @__PURE__ */ t(
|
|
952
|
-
Tt,
|
|
953
|
-
{
|
|
954
|
-
checked: r ? !0 : n ? "indeterminate" : !1,
|
|
955
|
-
onCheckedChange: i,
|
|
956
|
-
"aria-label": "Select all visuals"
|
|
957
|
-
}
|
|
958
|
-
),
|
|
959
|
-
/* @__PURE__ */ t("span", { children: "Name" }),
|
|
960
|
-
/* @__PURE__ */ t("span", { children: "Created by" }),
|
|
961
|
-
/* @__PURE__ */ t("span", { children: "Updated" }),
|
|
962
|
-
/* @__PURE__ */ t("span", { children: "Visibility" }),
|
|
963
|
-
/* @__PURE__ */ t("span", { className: "text-right", children: "Shared" }),
|
|
964
|
-
/* @__PURE__ */ t("span", { className: "text-right", children: "Actions" })
|
|
965
|
-
] }),
|
|
966
|
-
e.map((y) => /* @__PURE__ */ t(
|
|
967
|
-
os,
|
|
968
|
-
{
|
|
969
|
-
visual: y,
|
|
970
|
-
selected: a.has(y.id),
|
|
971
|
-
onToggleSelection: o,
|
|
972
|
-
onAddVisual: l,
|
|
973
|
-
onOpenVisual: h,
|
|
974
|
-
onEditDetails: d,
|
|
975
|
-
onShareVisual: c,
|
|
976
|
-
onDeleteVisual: u,
|
|
977
|
-
onDuplicateVisual: p,
|
|
978
|
-
duplicatingId: m,
|
|
979
|
-
isDeleting: f,
|
|
980
|
-
isConsoleMode: g
|
|
981
|
-
},
|
|
982
|
-
y.id
|
|
983
|
-
))
|
|
984
|
-
] });
|
|
985
|
-
}
|
|
986
|
-
function os({
|
|
987
|
-
visual: e,
|
|
988
|
-
selected: a,
|
|
989
|
-
onToggleSelection: r,
|
|
990
|
-
onAddVisual: n,
|
|
991
|
-
onOpenVisual: i,
|
|
992
|
-
onEditDetails: o,
|
|
993
|
-
onShareVisual: l,
|
|
994
|
-
onDeleteVisual: h,
|
|
995
|
-
onDuplicateVisual: d,
|
|
996
|
-
duplicatingId: c,
|
|
997
|
-
isDeleting: u,
|
|
998
|
-
isConsoleMode: p
|
|
999
|
-
}) {
|
|
1000
|
-
var g;
|
|
1001
|
-
const m = rs(e.kind), f = () => {
|
|
1002
|
-
n(e);
|
|
1003
|
-
};
|
|
1004
|
-
return /* @__PURE__ */ s(
|
|
1005
|
-
"div",
|
|
1006
|
-
{
|
|
1007
|
-
className: J(
|
|
1008
|
-
"group grid min-h-12 grid-cols-[2.5rem_minmax(14rem,1.8fr)_minmax(10rem,1fr)_8rem_7rem_5rem_5.5rem] items-center border-b border-border/50 px-3 text-[13px] hover:bg-muted/50",
|
|
1009
|
-
a && "bg-muted/70"
|
|
1010
|
-
),
|
|
1011
|
-
children: [
|
|
1012
|
-
/* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
|
|
1013
|
-
Tt,
|
|
1014
|
-
{
|
|
1015
|
-
checked: a,
|
|
1016
|
-
onCheckedChange: () => r(e.id),
|
|
1017
|
-
"aria-label": `Select ${e.title || "visual"}`
|
|
1018
|
-
}
|
|
1019
|
-
) }),
|
|
1020
|
-
/* @__PURE__ */ s(
|
|
1021
|
-
"button",
|
|
1022
|
-
{
|
|
1023
|
-
type: "button",
|
|
1024
|
-
className: "flex min-w-0 items-center gap-2 rounded-[4px] text-left outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
1025
|
-
onClick: f,
|
|
1026
|
-
"aria-label": `Add ${e.title || "visual"} to dashboard`,
|
|
1027
|
-
children: [
|
|
1028
|
-
/* @__PURE__ */ t(m, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
1029
|
-
/* @__PURE__ */ s("div", { className: "min-w-0", children: [
|
|
1030
|
-
/* @__PURE__ */ t(
|
|
1031
|
-
"div",
|
|
1032
|
-
{
|
|
1033
|
-
className: "truncate font-medium text-foreground",
|
|
1034
|
-
title: e.title || "Untitled Visual",
|
|
1035
|
-
children: e.title || "Untitled Visual"
|
|
1036
|
-
}
|
|
1037
|
-
),
|
|
1038
|
-
((g = e.description) == null ? void 0 : g.trim()) && /* @__PURE__ */ t(
|
|
1039
|
-
"div",
|
|
1040
|
-
{
|
|
1041
|
-
className: "truncate text-[11px] text-muted-foreground",
|
|
1042
|
-
title: e.description,
|
|
1043
|
-
children: e.description
|
|
1044
|
-
}
|
|
1045
|
-
)
|
|
1046
|
-
] })
|
|
1047
|
-
]
|
|
1048
|
-
}
|
|
1049
|
-
),
|
|
1050
|
-
/* @__PURE__ */ s("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
1051
|
-
/* @__PURE__ */ t("div", { className: "flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-muted text-[9px] font-medium text-muted-foreground", children: ns(e, p) }),
|
|
1052
|
-
/* @__PURE__ */ t("span", { className: "truncate text-muted-foreground", children: Rt(e, p) })
|
|
1053
|
-
] }),
|
|
1054
|
-
/* @__PURE__ */ t("span", { className: "text-muted-foreground", children: Aa(e.updatedAt) }),
|
|
1055
|
-
/* @__PURE__ */ t(ss, { visual: e }),
|
|
1056
|
-
/* @__PURE__ */ t("span", { className: "text-right tabular-nums text-muted-foreground", children: e.ownership.sharedCount > 0 ? e.ownership.sharedCount : "—" }),
|
|
1057
|
-
/* @__PURE__ */ t(
|
|
1058
|
-
ls,
|
|
1059
|
-
{
|
|
1060
|
-
visual: e,
|
|
1061
|
-
onOpenVisual: i,
|
|
1062
|
-
onEditDetails: o,
|
|
1063
|
-
onShareVisual: l,
|
|
1064
|
-
onDeleteVisual: h,
|
|
1065
|
-
onDuplicateVisual: d,
|
|
1066
|
-
duplicatingId: c,
|
|
1067
|
-
isDeleting: u,
|
|
1068
|
-
isConsoleMode: p
|
|
1069
|
-
}
|
|
1070
|
-
)
|
|
1071
|
-
]
|
|
1072
|
-
}
|
|
1073
|
-
);
|
|
1074
|
-
}
|
|
1075
|
-
function ls({
|
|
1076
|
-
visual: e,
|
|
1077
|
-
onOpenVisual: a,
|
|
1078
|
-
onEditDetails: r,
|
|
1079
|
-
onShareVisual: n,
|
|
1080
|
-
onDeleteVisual: i,
|
|
1081
|
-
onDuplicateVisual: o,
|
|
1082
|
-
duplicatingId: l,
|
|
1083
|
-
isDeleting: h,
|
|
1084
|
-
isConsoleMode: d
|
|
1085
|
-
}) {
|
|
1086
|
-
return /* @__PURE__ */ s(
|
|
1087
|
-
"div",
|
|
1088
|
-
{
|
|
1089
|
-
className: "flex items-center justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100",
|
|
1090
|
-
onClick: (c) => c.stopPropagation(),
|
|
1091
|
-
children: [
|
|
1092
|
-
/* @__PURE__ */ t(
|
|
1093
|
-
L,
|
|
1094
|
-
{
|
|
1095
|
-
size: "xs",
|
|
1096
|
-
variant: "ghost",
|
|
1097
|
-
className: "w-7 px-0",
|
|
1098
|
-
onClick: () => a(e),
|
|
1099
|
-
"aria-label": "Edit visual",
|
|
1100
|
-
children: /* @__PURE__ */ t(pt, { className: "h-3.5 w-3.5" })
|
|
1101
|
-
}
|
|
1102
|
-
),
|
|
1103
|
-
/* @__PURE__ */ s(je, { modal: !1, children: [
|
|
1104
|
-
/* @__PURE__ */ t(qe, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1105
|
-
L,
|
|
1106
|
-
{
|
|
1107
|
-
size: "xs",
|
|
1108
|
-
variant: "ghost",
|
|
1109
|
-
className: "w-7 px-0",
|
|
1110
|
-
"aria-label": "More actions",
|
|
1111
|
-
children: /* @__PURE__ */ t(ha, { className: "h-3.5 w-3.5" })
|
|
1112
|
-
}
|
|
1113
|
-
) }),
|
|
1114
|
-
/* @__PURE__ */ s(
|
|
1115
|
-
We,
|
|
1116
|
-
{
|
|
1117
|
-
align: "end",
|
|
1118
|
-
className: "z-[60] w-44 rounded-[6px] border-border/60 p-1 shadow-sm",
|
|
1119
|
-
children: [
|
|
1120
|
-
/* @__PURE__ */ s(re, { onClick: () => a(e), children: [
|
|
1121
|
-
/* @__PURE__ */ t(pt, { className: "h-3.5 w-3.5" }),
|
|
1122
|
-
"Edit visual"
|
|
1123
|
-
] }),
|
|
1124
|
-
/* @__PURE__ */ s(
|
|
1125
|
-
re,
|
|
1126
|
-
{
|
|
1127
|
-
onClick: () => o(e.id),
|
|
1128
|
-
disabled: l === e.id,
|
|
1129
|
-
children: [
|
|
1130
|
-
l === e.id ? /* @__PURE__ */ t(de, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ t(Ka, { className: "h-3.5 w-3.5" }),
|
|
1131
|
-
l === e.id ? "Duplicating..." : "Duplicate"
|
|
1132
|
-
]
|
|
1133
|
-
}
|
|
1134
|
-
),
|
|
1135
|
-
e.permissions.canEdit && /* @__PURE__ */ s(re, { onClick: () => r(e), children: [
|
|
1136
|
-
/* @__PURE__ */ t(pt, { className: "h-3.5 w-3.5" }),
|
|
1137
|
-
"Edit details"
|
|
1138
|
-
] }),
|
|
1139
|
-
e.permissions.canShare && /* @__PURE__ */ s(re, { onClick: () => n(e), children: [
|
|
1140
|
-
/* @__PURE__ */ t(ca, { className: "h-3.5 w-3.5" }),
|
|
1141
|
-
"Share"
|
|
1142
|
-
] }),
|
|
1143
|
-
e.permissions.canDelete && /* @__PURE__ */ s($, { children: [
|
|
1144
|
-
/* @__PURE__ */ t(at, {}),
|
|
1145
|
-
/* @__PURE__ */ s(
|
|
1146
|
-
re,
|
|
1147
|
-
{
|
|
1148
|
-
className: "text-destructive focus:bg-destructive/10 focus:text-destructive",
|
|
1149
|
-
onClick: () => i(e),
|
|
1150
|
-
disabled: h,
|
|
1151
|
-
children: [
|
|
1152
|
-
/* @__PURE__ */ t(tt, { className: "h-3.5 w-3.5" }),
|
|
1153
|
-
h ? "Deleting..." : "Delete"
|
|
1154
|
-
]
|
|
1155
|
-
}
|
|
1156
|
-
)
|
|
1157
|
-
] }),
|
|
1158
|
-
/* @__PURE__ */ t(at, {}),
|
|
1159
|
-
/* @__PURE__ */ s("div", { className: "space-y-1 px-2 py-1.5 text-[11px] text-muted-foreground", children: [
|
|
1160
|
-
Fa(e, d) && /* @__PURE__ */ s("div", { className: "flex items-center gap-1.5", children: [
|
|
1161
|
-
/* @__PURE__ */ t(Ga, { className: "h-3 w-3" }),
|
|
1162
|
-
/* @__PURE__ */ t("span", { className: "truncate", children: Rt(e, d) })
|
|
1163
|
-
] }),
|
|
1164
|
-
/* @__PURE__ */ s("div", { className: "flex items-center gap-1.5", children: [
|
|
1165
|
-
/* @__PURE__ */ t(Ya, { className: "h-3 w-3" }),
|
|
1166
|
-
/* @__PURE__ */ t("span", { children: Aa(e.updatedAt) })
|
|
1167
|
-
] })
|
|
1168
|
-
] })
|
|
1169
|
-
]
|
|
1170
|
-
}
|
|
1171
|
-
)
|
|
1172
|
-
] })
|
|
1173
|
-
]
|
|
1174
|
-
}
|
|
1175
|
-
);
|
|
1176
|
-
}
|
|
1177
|
-
function Wi(e, a, r = !1) {
|
|
1178
|
-
const n = C((u) => u.dashboard), i = C(
|
|
1179
|
-
(u) => u.isDashboardEditing
|
|
1180
|
-
), o = C((u) => u.isVisualEditing), l = C(
|
|
1181
|
-
(u) => u.onDashboardLifecycleEvent
|
|
1182
|
-
), h = ie(() => {
|
|
1183
|
-
const { dashboard: u, isVisualEditing: p } = C.getState();
|
|
1184
|
-
return a || !e || !u || u.id !== e.id ? !1 : p ? !0 : Je(u) !== Je(e);
|
|
1185
|
-
}, [e, a]);
|
|
1186
|
-
$t(() => (C.setState({ checkUnsavedDashboardChanges: h }), () => {
|
|
1187
|
-
C.getState().checkUnsavedDashboardChanges === h && C.setState({ checkUnsavedDashboardChanges: null });
|
|
1188
|
-
}), [h]);
|
|
1189
|
-
const d = Y(() => !r || a || !n || i && (!e || n.id !== e.id) ? null : {
|
|
1190
|
-
dashboardId: n.id,
|
|
1191
|
-
dirty: i && e ? o || Je(n) !== Je(e) : !1
|
|
1192
|
-
}, [
|
|
1193
|
-
i,
|
|
1194
|
-
o,
|
|
1195
|
-
a,
|
|
1196
|
-
r,
|
|
1197
|
-
e,
|
|
1198
|
-
n
|
|
1199
|
-
]), c = et(null);
|
|
1200
|
-
return $t(() => {
|
|
1201
|
-
if (!l || !d) {
|
|
1202
|
-
c.current = null;
|
|
1203
|
-
return;
|
|
1204
|
-
}
|
|
1205
|
-
const u = c.current;
|
|
1206
|
-
(u == null ? void 0 : u.callback) === l && u.dashboardId === d.dashboardId && u.dirty === d.dirty || (c.current = {
|
|
1207
|
-
callback: l,
|
|
1208
|
-
dashboardId: d.dashboardId,
|
|
1209
|
-
dirty: d.dirty
|
|
1210
|
-
}, l({
|
|
1211
|
-
type: "dashboard:dirty-state",
|
|
1212
|
-
dashboardId: d.dashboardId,
|
|
1213
|
-
payload: { dirty: d.dirty }
|
|
1214
|
-
}));
|
|
1215
|
-
}, [d, l]), h;
|
|
1216
|
-
}
|
|
1217
|
-
function Mt(e) {
|
|
1218
|
-
var a;
|
|
1219
|
-
for (const r of e.cards)
|
|
1220
|
-
if (r.type === "matrixTable" && !nr.safeParse((a = r.config) == null ? void 0 : a.matrix).success)
|
|
1221
|
-
return z.error("Matrix requires at least one row field, one metric, and valid settings."), !1;
|
|
1222
|
-
return !0;
|
|
1223
|
-
}
|
|
1224
|
-
function bt({
|
|
1225
|
-
className: e,
|
|
1226
|
-
variant: a = "outline"
|
|
1227
|
-
}) {
|
|
1228
|
-
const r = oe((o) => o.onSave), { getUpdatedFrame: n } = Pe();
|
|
1229
|
-
function i() {
|
|
1230
|
-
const o = n();
|
|
1231
|
-
Mt(o) && (r == null || r(o));
|
|
1232
|
-
}
|
|
1233
|
-
return /* @__PURE__ */ s(
|
|
1234
|
-
L,
|
|
1235
|
-
{
|
|
1236
|
-
onClick: i,
|
|
1237
|
-
className: e,
|
|
1238
|
-
size: "xs",
|
|
1239
|
-
variant: a,
|
|
1240
|
-
children: [
|
|
1241
|
-
/* @__PURE__ */ t(_t, { className: "h-3.5 w-3.5" }),
|
|
1242
|
-
"Done"
|
|
1243
|
-
]
|
|
1244
|
-
}
|
|
1245
|
-
);
|
|
1246
|
-
}
|
|
1247
|
-
function ds({
|
|
1248
|
-
className: e,
|
|
1249
|
-
variant: a = "default"
|
|
1250
|
-
}) {
|
|
1251
|
-
const r = ot(), [n, i] = E(!1), { setIsVisualEditing: o } = ve(), { getUpdatedFrame: l } = Pe(), h = lt(), d = oe((p) => p.frame), c = ma();
|
|
1252
|
-
return /* @__PURE__ */ t(
|
|
1253
|
-
L,
|
|
1254
|
-
{
|
|
1255
|
-
onClick: () => {
|
|
1256
|
-
const p = l();
|
|
1257
|
-
if (!Mt(p))
|
|
1258
|
-
return;
|
|
1259
|
-
const m = (d == null ? void 0 : d.visualId) || (h == null ? void 0 : h.id);
|
|
1260
|
-
if (!m) {
|
|
1261
|
-
z.error("No visual to save");
|
|
1262
|
-
return;
|
|
1263
|
-
}
|
|
1264
|
-
i(!0), c.mutate(
|
|
1265
|
-
{
|
|
1266
|
-
visualId: m,
|
|
1267
|
-
data: {
|
|
1268
|
-
frameObject: p
|
|
1269
|
-
}
|
|
1270
|
-
},
|
|
1271
|
-
{
|
|
1272
|
-
onSuccess: () => {
|
|
1273
|
-
i(!1), z.success("Visual updated successfully"), r.invalidateQueries({
|
|
1274
|
-
queryKey: ["resource-by-id", "visual", m],
|
|
1275
|
-
exact: !0
|
|
1276
|
-
});
|
|
1277
|
-
},
|
|
1278
|
-
onError: () => {
|
|
1279
|
-
i(!1), z.error("Failed to update visual");
|
|
1280
|
-
}
|
|
1281
|
-
}
|
|
1282
|
-
);
|
|
1283
|
-
},
|
|
1284
|
-
className: e,
|
|
1285
|
-
size: "xs",
|
|
1286
|
-
variant: a,
|
|
1287
|
-
children: n ? /* @__PURE__ */ s($, { children: [
|
|
1288
|
-
/* @__PURE__ */ t(de, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
1289
|
-
"Saving"
|
|
1290
|
-
] }) : /* @__PURE__ */ s($, { children: [
|
|
1291
|
-
/* @__PURE__ */ t(wa, { className: "h-3.5 w-3.5" }),
|
|
1292
|
-
"Save to Library"
|
|
1293
|
-
] })
|
|
1294
|
-
}
|
|
1295
|
-
);
|
|
1296
|
-
}
|
|
1297
|
-
function cs({
|
|
1298
|
-
className: e
|
|
1299
|
-
}) {
|
|
1300
|
-
const a = ot(), [r, n] = E(!1), i = lt(), o = oe((g) => g.frame), l = C((g) => g.selectedSheetId), h = C((g) => g.dashboard), { updateFrame: d, setIsVisualEditing: c } = ve(), { getUpdatedFrame: u } = Pe(), p = ma(), m = ct();
|
|
1301
|
-
return /* @__PURE__ */ t(
|
|
1302
|
-
L,
|
|
1303
|
-
{
|
|
1304
|
-
onClick: async () => {
|
|
1305
|
-
if (!l) {
|
|
1306
|
-
z.error("No sheet selected");
|
|
1307
|
-
return;
|
|
1308
|
-
}
|
|
1309
|
-
const g = (o == null ? void 0 : o.visualId) || (i == null ? void 0 : i.id);
|
|
1310
|
-
if (!g) {
|
|
1311
|
-
z.error("No visual to update");
|
|
1312
|
-
return;
|
|
1313
|
-
}
|
|
1314
|
-
n(!0);
|
|
1315
|
-
try {
|
|
1316
|
-
const y = u();
|
|
1317
|
-
if (!Mt(y)) {
|
|
1318
|
-
n(!1);
|
|
1319
|
-
return;
|
|
1320
|
-
}
|
|
1321
|
-
const w = {
|
|
1322
|
-
...y,
|
|
1323
|
-
visualId: g
|
|
1324
|
-
// Keep the link to library visual
|
|
1325
|
-
}, S = rt(h, w.id), V = await m(w, {
|
|
1326
|
-
previousFrame: S
|
|
1327
|
-
});
|
|
1328
|
-
await p.mutateAsync({
|
|
1329
|
-
visualId: g,
|
|
1330
|
-
data: {
|
|
1331
|
-
frameObject: y
|
|
1332
|
-
}
|
|
1333
|
-
}), d(l, w, {
|
|
1334
|
-
semanticExecutionPayload: V
|
|
1335
|
-
}), a.invalidateQueries({ queryKey: ["visuals"] }), a.invalidateQueries({ queryKey: ["visual", g] }), z.success("Saved to library and applied locally"), setTimeout(() => {
|
|
1336
|
-
c(!1);
|
|
1337
|
-
}, 300);
|
|
1338
|
-
} catch (y) {
|
|
1339
|
-
console.error("Failed to save and apply:", y), z.error(
|
|
1340
|
-
y instanceof Error ? y.message : "Failed to save and apply changes"
|
|
1341
|
-
);
|
|
1342
|
-
} finally {
|
|
1343
|
-
n(!1);
|
|
1344
|
-
}
|
|
1345
|
-
},
|
|
1346
|
-
className: e,
|
|
1347
|
-
size: "xs",
|
|
1348
|
-
variant: "default",
|
|
1349
|
-
disabled: r,
|
|
1350
|
-
children: r ? /* @__PURE__ */ s($, { children: [
|
|
1351
|
-
/* @__PURE__ */ t(de, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
1352
|
-
"Saving..."
|
|
1353
|
-
] }) : /* @__PURE__ */ s($, { children: [
|
|
1354
|
-
/* @__PURE__ */ t(wa, { className: "h-3.5 w-3.5" }),
|
|
1355
|
-
"Save & Apply"
|
|
1356
|
-
] })
|
|
1357
|
-
}
|
|
1358
|
-
);
|
|
1359
|
-
}
|
|
1360
|
-
function xt({ className: e }) {
|
|
1361
|
-
const { setTempQueryData: a, setSqlGen: r } = dt(), n = ot(), i = oe((h) => h.tempQueryData), o = oe((h) => h.onClose);
|
|
1362
|
-
function l() {
|
|
1363
|
-
if (i) {
|
|
1364
|
-
const { queryKey: h, queryData: d } = i;
|
|
1365
|
-
h && d && n.setQueryData(h, d);
|
|
1366
|
-
}
|
|
1367
|
-
r({}), o == null || o();
|
|
1368
|
-
}
|
|
1369
|
-
return /* @__PURE__ */ s(
|
|
1370
|
-
L,
|
|
1371
|
-
{
|
|
1372
|
-
onClick: l,
|
|
1373
|
-
className: e,
|
|
1374
|
-
size: "xs",
|
|
1375
|
-
variant: "outline",
|
|
1376
|
-
children: [
|
|
1377
|
-
/* @__PURE__ */ t(Qe, { className: "h-3.5 w-3.5" }),
|
|
1378
|
-
"Close"
|
|
1379
|
-
]
|
|
1380
|
-
}
|
|
1381
|
-
);
|
|
1382
|
-
}
|
|
1383
|
-
function us({
|
|
1384
|
-
open: e,
|
|
1385
|
-
onOpenChange: a,
|
|
1386
|
-
isLibraryVisual: r,
|
|
1387
|
-
currentVisualName: n,
|
|
1388
|
-
isSaving: i = !1,
|
|
1389
|
-
destinationMode: o = "both",
|
|
1390
|
-
onConfirm: l
|
|
1391
|
-
}) {
|
|
1392
|
-
const [h, d] = E(
|
|
1393
|
-
r && n ? `Copy of ${n}` : n || ""
|
|
1394
|
-
), [c, u] = E("");
|
|
1395
|
-
la.useEffect(() => {
|
|
1396
|
-
e && (d(
|
|
1397
|
-
r && n ? `Copy of ${n}` : n || ""
|
|
1398
|
-
), u(""));
|
|
1399
|
-
}, [e, r, n]);
|
|
1400
|
-
const p = !!h.trim(), m = o === "local" ? {
|
|
1401
|
-
saveToLibrary: !1,
|
|
1402
|
-
saveToCurrentDashboard: !0,
|
|
1403
|
-
badgeType: "local",
|
|
1404
|
-
description: "Creates a local copy on the current dashboard.",
|
|
1405
|
-
actionLabel: "Add to Dashboard (Local)"
|
|
1406
|
-
} : o === "library" ? {
|
|
1407
|
-
saveToLibrary: !0,
|
|
1408
|
-
saveToCurrentDashboard: !1,
|
|
1409
|
-
badgeType: "library",
|
|
1410
|
-
description: "Creates a reusable visual in Visual Library.",
|
|
1411
|
-
actionLabel: "Save as Library Visual"
|
|
1412
|
-
} : {
|
|
1413
|
-
saveToLibrary: !0,
|
|
1414
|
-
saveToCurrentDashboard: !0,
|
|
1415
|
-
badgeType: "linked",
|
|
1416
|
-
description: "Creates a new library visual and adds a linked copy to this dashboard.",
|
|
1417
|
-
actionLabel: "Save Copy as Linked Visual"
|
|
1418
|
-
}, f = () => {
|
|
1419
|
-
!p || i || l({
|
|
1420
|
-
name: h.trim(),
|
|
1421
|
-
description: c.trim() || void 0,
|
|
1422
|
-
saveToLibrary: m.saveToLibrary,
|
|
1423
|
-
saveToCurrentDashboard: m.saveToCurrentDashboard
|
|
1424
|
-
});
|
|
1425
|
-
};
|
|
1426
|
-
return /* @__PURE__ */ t(Le, { open: e, onOpenChange: a, children: /* @__PURE__ */ s(Ve, { className: "sm:max-w-[500px]", children: [
|
|
1427
|
-
/* @__PURE__ */ s(Lt, { children: [
|
|
1428
|
-
/* @__PURE__ */ s(Be, { className: "flex items-center gap-2", children: [
|
|
1429
|
-
/* @__PURE__ */ t("span", { children: "Save Visual As" }),
|
|
1430
|
-
m.badgeType !== "local" && /* @__PURE__ */ t(
|
|
1431
|
-
kr,
|
|
1432
|
-
{
|
|
1433
|
-
type: m.badgeType,
|
|
1434
|
-
showLabel: !0,
|
|
1435
|
-
className: "px-2 py-0.5"
|
|
1436
|
-
}
|
|
1437
|
-
)
|
|
1438
|
-
] }),
|
|
1439
|
-
/* @__PURE__ */ t(ut, { children: m.description })
|
|
1440
|
-
] }),
|
|
1441
|
-
/* @__PURE__ */ s("div", { className: "grid gap-4 py-4", children: [
|
|
1442
|
-
/* @__PURE__ */ s("div", { className: "grid gap-2", children: [
|
|
1443
|
-
/* @__PURE__ */ t(Me, { htmlFor: "name", children: "Name" }),
|
|
1444
|
-
/* @__PURE__ */ t(
|
|
1445
|
-
xe,
|
|
1446
|
-
{
|
|
1447
|
-
id: "name",
|
|
1448
|
-
value: h,
|
|
1449
|
-
onChange: (g) => d(g.target.value),
|
|
1450
|
-
placeholder: "Enter visual name",
|
|
1451
|
-
disabled: i
|
|
1452
|
-
}
|
|
1453
|
-
)
|
|
1454
|
-
] }),
|
|
1455
|
-
/* @__PURE__ */ s("div", { className: "grid gap-2", children: [
|
|
1456
|
-
/* @__PURE__ */ t(Me, { htmlFor: "description", children: "Description (optional)" }),
|
|
1457
|
-
/* @__PURE__ */ t(
|
|
1458
|
-
pa,
|
|
1459
|
-
{
|
|
1460
|
-
id: "description",
|
|
1461
|
-
value: c,
|
|
1462
|
-
onChange: (g) => u(g.target.value),
|
|
1463
|
-
placeholder: "Enter visual description",
|
|
1464
|
-
rows: 3,
|
|
1465
|
-
disabled: i
|
|
1466
|
-
}
|
|
1467
|
-
)
|
|
1468
|
-
] })
|
|
1469
|
-
] }),
|
|
1470
|
-
/* @__PURE__ */ s(Xa, { children: [
|
|
1471
|
-
/* @__PURE__ */ t(
|
|
1472
|
-
L,
|
|
1473
|
-
{
|
|
1474
|
-
variant: "outline",
|
|
1475
|
-
onClick: () => a(!1),
|
|
1476
|
-
disabled: i,
|
|
1477
|
-
children: "Cancel"
|
|
1478
|
-
}
|
|
1479
|
-
),
|
|
1480
|
-
/* @__PURE__ */ s(L, { onClick: f, disabled: !p || i, children: [
|
|
1481
|
-
i && /* @__PURE__ */ t(de, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
1482
|
-
m.actionLabel
|
|
1483
|
-
] })
|
|
1484
|
-
] })
|
|
1485
|
-
] }) });
|
|
1486
|
-
}
|
|
1487
|
-
function hs() {
|
|
1488
|
-
const [e, a] = E(!1), [r, n] = E(!1), [i, o] = E(null), [l, h] = E(null), d = oe((v) => v.frame), c = oe((v) => v.card), u = lt(), p = C((v) => v.selectedSheetId), m = C((v) => v.dashboard), { getUpdatedFrame: f } = Pe(), { selectVisual: g } = wt(), { addFrame: y, checkAddFrame: w, setIsVisualEditing: S } = ve(), V = ct(), P = !!(d != null && d.visualId), D = (() => {
|
|
1489
|
-
var v, b;
|
|
1490
|
-
return ((v = d == null ? void 0 : d.cards) == null ? void 0 : v.length) === 1 && ((b = d.cards[0]) != null && b.title) ? d.cards[0].title : u != null && u.title ? u.title : (c == null ? void 0 : c.title) || "Untitled Visual";
|
|
1491
|
-
})(), B = Ja((v) => {
|
|
1492
|
-
v != null && v.id && (g(v), r && i && l && p && (async () => {
|
|
1493
|
-
try {
|
|
1494
|
-
const b = {
|
|
1495
|
-
...i,
|
|
1496
|
-
id: gt(),
|
|
1497
|
-
visualId: v.id
|
|
1498
|
-
// Link to the newly created library visual
|
|
1499
|
-
};
|
|
1500
|
-
y(p, b, {
|
|
1501
|
-
semanticExecutionPayload: l,
|
|
1502
|
-
withEditorFieldChanges: !0
|
|
1503
|
-
}), n(!1), o(null), h(null), S(!1);
|
|
1504
|
-
} catch (b) {
|
|
1505
|
-
console.error(
|
|
1506
|
-
"Failed to promote semantic metadata for saved visual:",
|
|
1507
|
-
b
|
|
1508
|
-
), z.error(
|
|
1509
|
-
b instanceof Error ? b.message : "Failed to prepare semantic metadata for the saved visual"
|
|
1510
|
-
);
|
|
1511
|
-
}
|
|
1512
|
-
})(), a(!1));
|
|
1513
|
-
});
|
|
1514
|
-
return {
|
|
1515
|
-
saveAsDialogOpen: e,
|
|
1516
|
-
setSaveAsDialogOpen: a,
|
|
1517
|
-
handleSaveAs: async (v) => {
|
|
1518
|
-
if (!p) {
|
|
1519
|
-
z.error("No sheet selected");
|
|
1520
|
-
return;
|
|
1521
|
-
}
|
|
1522
|
-
const b = f(), A = b.cards.length === 1 ? {
|
|
1523
|
-
...b,
|
|
1524
|
-
cards: b.cards.map((G) => ({
|
|
1525
|
-
...G,
|
|
1526
|
-
title: v.name
|
|
1527
|
-
// Use visual name as card title
|
|
1528
|
-
}))
|
|
1529
|
-
} : b;
|
|
1530
|
-
if (v.saveToLibrary) {
|
|
1531
|
-
let G = null;
|
|
1532
|
-
if (v.saveToCurrentDashboard)
|
|
1533
|
-
try {
|
|
1534
|
-
G = await V(A, {
|
|
1535
|
-
previousFrame: rt(m, A.id)
|
|
1536
|
-
});
|
|
1537
|
-
} catch (M) {
|
|
1538
|
-
console.error(
|
|
1539
|
-
"Failed to prepare semantic metadata before saving visual:",
|
|
1540
|
-
M
|
|
1541
|
-
), z.error(
|
|
1542
|
-
M instanceof Error ? M.message : "Failed to prepare semantic metadata for the saved visual"
|
|
1543
|
-
);
|
|
1544
|
-
return;
|
|
1545
|
-
}
|
|
1546
|
-
if (v.saveToCurrentDashboard) {
|
|
1547
|
-
const M = w(p, { ...A, id: gt() }, { withEditorFieldChanges: !0 });
|
|
1548
|
-
if (!M.ok) {
|
|
1549
|
-
z.error(M.reason);
|
|
1550
|
-
return;
|
|
1551
|
-
}
|
|
1552
|
-
}
|
|
1553
|
-
n(v.saveToCurrentDashboard), o(A), h(G);
|
|
1554
|
-
const T = {
|
|
1555
|
-
title: v.name,
|
|
1556
|
-
description: v.description,
|
|
1557
|
-
frameObject: A,
|
|
1558
|
-
// Card title synced for single-card frames
|
|
1559
|
-
isPrivate: !1
|
|
1560
|
-
};
|
|
1561
|
-
B.mutate(T);
|
|
1562
|
-
} else if (v.saveToCurrentDashboard) {
|
|
1563
|
-
const G = {
|
|
1564
|
-
...A,
|
|
1565
|
-
// Card title already synced
|
|
1566
|
-
id: gt(),
|
|
1567
|
-
visualId: void 0
|
|
1568
|
-
// Explicitly no visualId for local visuals
|
|
1569
|
-
};
|
|
1570
|
-
try {
|
|
1571
|
-
const T = await V(A, {
|
|
1572
|
-
previousFrame: rt(m, A.id)
|
|
1573
|
-
});
|
|
1574
|
-
y(p, G, {
|
|
1575
|
-
semanticExecutionPayload: T,
|
|
1576
|
-
withEditorFieldChanges: !0
|
|
1577
|
-
}), z.success("Visual saved to dashboard"), a(!1), S(!1);
|
|
1578
|
-
} catch (T) {
|
|
1579
|
-
console.error("Failed to save visual to dashboard:", T), z.error(
|
|
1580
|
-
T instanceof Error ? T.message : "Failed to prepare semantic metadata for the visual"
|
|
1581
|
-
);
|
|
1582
|
-
}
|
|
1583
|
-
}
|
|
1584
|
-
},
|
|
1585
|
-
isLibraryVisual: P,
|
|
1586
|
-
currentVisualName: D,
|
|
1587
|
-
isSaving: B.isPending
|
|
1588
|
-
};
|
|
1589
|
-
}
|
|
1590
|
-
function Qi(e = {}) {
|
|
1591
|
-
const { isInspectionMode: a } = Za(), r = oe((T) => T.frame), n = oe((T) => T.editorContext), i = en((T) => T.selectedVisual), o = C((T) => T.selectedFrameId), l = C((T) => T.selectedSheetId), h = C((T) => T.dashboard), { setIsVisualEditing: d, updateFrame: c } = ve(), [u, p] = E(!1), [m, f] = E("both"), g = ct(), y = (n == null ? void 0 : n.type) === "documentSection", w = !!(r != null && r.visualId || i != null && i.id), S = !!(r != null && r.visualId && o), V = w && !S, {
|
|
1592
|
-
saveAsDialogOpen: P,
|
|
1593
|
-
setSaveAsDialogOpen: D,
|
|
1594
|
-
handleSaveAs: B,
|
|
1595
|
-
isLibraryVisual: k,
|
|
1596
|
-
currentVisualName: v,
|
|
1597
|
-
isSaving: b
|
|
1598
|
-
} = hs(), { getUpdatedFrame: _ } = Pe();
|
|
1599
|
-
if (a)
|
|
1600
|
-
return /* @__PURE__ */ s($, { children: [
|
|
1601
|
-
/* @__PURE__ */ t(
|
|
1602
|
-
bt,
|
|
1603
|
-
{
|
|
1604
|
-
className: "rounded-control",
|
|
1605
|
-
variant: "default"
|
|
1606
|
-
}
|
|
1607
|
-
),
|
|
1608
|
-
/* @__PURE__ */ t(xt, {})
|
|
1609
|
-
] });
|
|
1610
|
-
if (y)
|
|
1611
|
-
return /* @__PURE__ */ s($, { children: [
|
|
1612
|
-
/* @__PURE__ */ t(bt, { className: "rounded-control", variant: "default" }),
|
|
1613
|
-
/* @__PURE__ */ t(xt, {})
|
|
1614
|
-
] });
|
|
1615
|
-
const A = async () => {
|
|
1616
|
-
if (!l) {
|
|
1617
|
-
z.error("No sheet selected");
|
|
1618
|
-
return;
|
|
1619
|
-
}
|
|
1620
|
-
if (u) return;
|
|
1621
|
-
p(!0);
|
|
1622
|
-
const M = {
|
|
1623
|
-
..._(),
|
|
1624
|
-
visualId: void 0
|
|
1625
|
-
}, X = rt(h, M.id);
|
|
1626
|
-
try {
|
|
1627
|
-
const O = await g(M, {
|
|
1628
|
-
previousFrame: X
|
|
1629
|
-
});
|
|
1630
|
-
c(l, M, {
|
|
1631
|
-
semanticExecutionPayload: O
|
|
1632
|
-
});
|
|
1633
|
-
} catch (O) {
|
|
1634
|
-
console.error("Failed to apply local semantic metadata:", O), p(!1), z.error(
|
|
1635
|
-
O instanceof Error ? O.message : "Failed to prepare semantic metadata for this visual"
|
|
1636
|
-
);
|
|
1637
|
-
return;
|
|
1638
|
-
}
|
|
1639
|
-
setTimeout(() => {
|
|
1640
|
-
p(!1), z.success("Changes applied. Visual is now local to this dashboard"), d(!1);
|
|
1641
|
-
}, 300);
|
|
1642
|
-
}, G = (T) => {
|
|
1643
|
-
f(T), D(!0);
|
|
1644
|
-
};
|
|
1645
|
-
return /* @__PURE__ */ s($, { children: [
|
|
1646
|
-
/* @__PURE__ */ s("div", { className: "inline-flex items-center overflow-hidden rounded-control", children: [
|
|
1647
|
-
!w && /* @__PURE__ */ t(bt, { className: "!rounded-none", variant: "default" }),
|
|
1648
|
-
w && V && /* @__PURE__ */ t(ds, { className: "!rounded-none", variant: "default" }),
|
|
1649
|
-
w && S && /* @__PURE__ */ t(cs, { className: "!rounded-none" }),
|
|
1650
|
-
/* @__PURE__ */ s(je, { modal: !1, children: [
|
|
1651
|
-
/* @__PURE__ */ t(qe, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1652
|
-
L,
|
|
1653
|
-
{
|
|
1654
|
-
variant: "default",
|
|
1655
|
-
size: "xs",
|
|
1656
|
-
className: "w-7 !rounded-none border-l border-primary-foreground/20 px-0",
|
|
1657
|
-
"aria-label": "Open visual save options",
|
|
1658
|
-
disabled: b || u,
|
|
1659
|
-
children: /* @__PURE__ */ t(Ot, { className: "h-3.5 w-3.5" })
|
|
1660
|
-
}
|
|
1661
|
-
) }),
|
|
1662
|
-
/* @__PURE__ */ s(
|
|
1663
|
-
We,
|
|
1664
|
-
{
|
|
1665
|
-
align: "end",
|
|
1666
|
-
className: "min-w-[220px] rounded-control border border-border/60 p-1 shadow-sm",
|
|
1667
|
-
children: [
|
|
1668
|
-
S && /* @__PURE__ */ s($, { children: [
|
|
1669
|
-
/* @__PURE__ */ s(
|
|
1670
|
-
re,
|
|
1671
|
-
{
|
|
1672
|
-
onClick: A,
|
|
1673
|
-
disabled: u,
|
|
1674
|
-
children: [
|
|
1675
|
-
/* @__PURE__ */ t(_t, { className: "h-3.5 w-3.5" }),
|
|
1676
|
-
u ? "Applying..." : "Apply Locally"
|
|
1677
|
-
]
|
|
1678
|
-
}
|
|
1679
|
-
),
|
|
1680
|
-
/* @__PURE__ */ t(at, {})
|
|
1681
|
-
] }),
|
|
1682
|
-
/* @__PURE__ */ s(
|
|
1683
|
-
re,
|
|
1684
|
-
{
|
|
1685
|
-
onClick: () => G("local"),
|
|
1686
|
-
disabled: b,
|
|
1687
|
-
children: [
|
|
1688
|
-
/* @__PURE__ */ t(be, { className: "h-3.5 w-3.5" }),
|
|
1689
|
-
"Add to Dashboard (Local)"
|
|
1690
|
-
]
|
|
1691
|
-
}
|
|
1692
|
-
),
|
|
1693
|
-
/* @__PURE__ */ s(
|
|
1694
|
-
re,
|
|
1695
|
-
{
|
|
1696
|
-
onClick: () => G("library"),
|
|
1697
|
-
disabled: b,
|
|
1698
|
-
children: [
|
|
1699
|
-
/* @__PURE__ */ t(Dr, { className: "h-3.5 w-3.5" }),
|
|
1700
|
-
"Save as Library Visual"
|
|
1701
|
-
]
|
|
1702
|
-
}
|
|
1703
|
-
),
|
|
1704
|
-
/* @__PURE__ */ s(
|
|
1705
|
-
re,
|
|
1706
|
-
{
|
|
1707
|
-
onClick: () => G("both"),
|
|
1708
|
-
disabled: b,
|
|
1709
|
-
children: [
|
|
1710
|
-
/* @__PURE__ */ t(tn, { className: "h-3.5 w-3.5" }),
|
|
1711
|
-
"Save Copy as Linked Visual"
|
|
1712
|
-
]
|
|
1713
|
-
}
|
|
1714
|
-
)
|
|
1715
|
-
]
|
|
1716
|
-
}
|
|
1717
|
-
)
|
|
1718
|
-
] })
|
|
1719
|
-
] }),
|
|
1720
|
-
/* @__PURE__ */ t(xt, {}),
|
|
1721
|
-
/* @__PURE__ */ t(
|
|
1722
|
-
us,
|
|
1723
|
-
{
|
|
1724
|
-
open: P,
|
|
1725
|
-
onOpenChange: (T) => {
|
|
1726
|
-
b || D(T);
|
|
1727
|
-
},
|
|
1728
|
-
isLibraryVisual: k,
|
|
1729
|
-
currentVisualName: v,
|
|
1730
|
-
isSaving: b,
|
|
1731
|
-
destinationMode: m,
|
|
1732
|
-
onConfirm: B
|
|
1733
|
-
}
|
|
1734
|
-
)
|
|
1735
|
-
] });
|
|
1736
|
-
}
|
|
1737
|
-
function Hi({ className: e }) {
|
|
1738
|
-
const a = oe((u) => u.isDevMode), r = oe((u) => u.card.type), n = C((u) => u.isVisualEditing), { setIsDevMode: i } = dt(), { config: o } = Va(an).tokenProps, l = (o == null ? void 0 : o.showAdvancedMode) !== !1;
|
|
1739
|
-
if (!n || !l || !sr(r))
|
|
1740
|
-
return null;
|
|
1741
|
-
const h = a ? Kr : Hr, d = a ? "Visual editor" : "SQL editor", c = a ? "Switch to visual editor" : "Switch to SQL editor";
|
|
1742
|
-
return /* @__PURE__ */ s(
|
|
1743
|
-
"button",
|
|
1744
|
-
{
|
|
1745
|
-
type: "button",
|
|
1746
|
-
"aria-label": c,
|
|
1747
|
-
title: c,
|
|
1748
|
-
onClick: () => i(!a),
|
|
1749
|
-
className: J(
|
|
1750
|
-
"inline-flex h-7 items-center gap-1.5 rounded-control border border-input bg-background px-2 text-[12px] font-medium text-foreground transition-colors hover:bg-muted/40 focus-visible:border-ring focus-visible:outline-none",
|
|
1751
|
-
e
|
|
1752
|
-
),
|
|
1753
|
-
children: [
|
|
1754
|
-
/* @__PURE__ */ t(h, { className: "h-3 w-3 text-muted-foreground" }),
|
|
1755
|
-
d
|
|
1756
|
-
]
|
|
1757
|
-
}
|
|
1758
|
-
);
|
|
1759
|
-
}
|
|
1760
|
-
function Ki() {
|
|
1761
|
-
const e = nn() === "sm", a = C((d) => d.isDashboardEditing), r = C((d) => d.isVisualEditing), n = C((d) => {
|
|
1762
|
-
var u;
|
|
1763
|
-
const c = ((u = d.dashboard) == null ? void 0 : u.sheets) ?? [];
|
|
1764
|
-
return c.find((p) => p.id === d.selectedSheetId) ?? c[0];
|
|
1765
|
-
}), i = C((d) => d.actions.arrangeSheet), o = C((d) => d.actions.undoArrange);
|
|
1766
|
-
if (!a || r || !n || He(n)) return null;
|
|
1767
|
-
const l = !(n.frames ?? []).length, h = (d) => {
|
|
1768
|
-
const c = i(n.id, { keepOrder: d });
|
|
1769
|
-
if (!c.ok) {
|
|
1770
|
-
z.error(c.reason === "not_a_grid" ? "This sheet has no grid to arrange." : "The dashboard can't be arranged right now.");
|
|
1771
|
-
return;
|
|
1772
|
-
}
|
|
1773
|
-
z("Arranged", {
|
|
1774
|
-
// Long enough to reach Undo after looking at the result; the default 4 seconds isn't.
|
|
1775
|
-
duration: 1e4,
|
|
1776
|
-
description: d ? "Sizes and gaps fixed on every screen size, in your order." : "KPIs on top, charts in pairs, tables full width, on every screen size.",
|
|
1777
|
-
action: {
|
|
1778
|
-
label: "Undo",
|
|
1779
|
-
onClick: () => {
|
|
1780
|
-
const u = o();
|
|
1781
|
-
!u.ok && u.reason === "changed_since" && z.info("The dashboard changed after Arrange, so it can't be undone from here.");
|
|
1782
|
-
}
|
|
1783
|
-
}
|
|
1784
|
-
});
|
|
1785
|
-
};
|
|
1786
|
-
return /* @__PURE__ */ s("div", { className: "inline-flex h-7 items-stretch overflow-hidden rounded-control border border-input bg-background", children: [
|
|
1787
|
-
/* @__PURE__ */ s(
|
|
1788
|
-
L,
|
|
1789
|
-
{
|
|
1790
|
-
variant: "ghost",
|
|
1791
|
-
size: "xs",
|
|
1792
|
-
disabled: l,
|
|
1793
|
-
title: l ? "This sheet has no cards to arrange" : "Lay out the cards by kind on every screen size",
|
|
1794
|
-
onClick: () => h(!1),
|
|
1795
|
-
"aria-label": e ? "Arrange" : void 0,
|
|
1796
|
-
className: `h-full rounded-none border-0 shadow-none hover:bg-accent${e ? " w-7 px-0" : ""}`,
|
|
1797
|
-
children: [
|
|
1798
|
-
/* @__PURE__ */ t(Ue, { className: "h-3.5 w-3.5" }),
|
|
1799
|
-
!e && "Arrange"
|
|
1800
|
-
]
|
|
1801
|
-
}
|
|
1802
|
-
),
|
|
1803
|
-
/* @__PURE__ */ s(je, { modal: !1, children: [
|
|
1804
|
-
/* @__PURE__ */ t(qe, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1805
|
-
L,
|
|
1806
|
-
{
|
|
1807
|
-
variant: "ghost",
|
|
1808
|
-
size: "xs",
|
|
1809
|
-
disabled: l,
|
|
1810
|
-
className: "h-full w-7 rounded-none border-0 border-l border-border/60 px-0 shadow-none hover:bg-accent",
|
|
1811
|
-
"aria-label": "Open arrange options",
|
|
1812
|
-
children: /* @__PURE__ */ t(Ot, { className: "h-3.5 w-3.5" })
|
|
1813
|
-
}
|
|
1814
|
-
) }),
|
|
1815
|
-
/* @__PURE__ */ t(We, { align: "end", className: "z-[60] w-48 rounded-[6px] border-border/60 p-1 shadow-sm", children: /* @__PURE__ */ s(re, { onClick: () => h(!0), children: [
|
|
1816
|
-
/* @__PURE__ */ t(Ue, { className: "h-3.5 w-3.5" }),
|
|
1817
|
-
"Keep my order"
|
|
1818
|
-
] }) })
|
|
1819
|
-
] })
|
|
1820
|
-
] });
|
|
1821
|
-
}
|
|
1822
|
-
function Gi() {
|
|
1823
|
-
const e = C((i) => i.screenSizesOpen), a = C((i) => {
|
|
1824
|
-
var h, d;
|
|
1825
|
-
const o = ((h = i.dashboard) == null ? void 0 : h.sheets) ?? [], l = o.find((c) => c.id === i.selectedSheetId) ?? o[0];
|
|
1826
|
-
return !!l && !He(l) && !!((d = l.frames) != null && d.length);
|
|
1827
|
-
}), r = C((i) => i.actions.setScreenSizesOpen), n = fa(
|
|
1828
|
-
"screen-sizes",
|
|
1829
|
-
"lg",
|
|
1830
|
-
a ? {
|
|
1831
|
-
label: "Screen sizes",
|
|
1832
|
-
icon: /* @__PURE__ */ t(ta, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
|
|
1833
|
-
checked: e,
|
|
1834
|
-
order: 40,
|
|
1835
|
-
onSelect: () => r(!e)
|
|
1836
|
-
} : void 0
|
|
1837
|
-
);
|
|
1838
|
-
return !a || n.collapsed ? null : /* @__PURE__ */ t(
|
|
1839
|
-
L,
|
|
1840
|
-
{
|
|
1841
|
-
type: "button",
|
|
1842
|
-
size: "xs",
|
|
1843
|
-
variant: e ? "secondary" : "ghost",
|
|
1844
|
-
"aria-pressed": e,
|
|
1845
|
-
"aria-label": "Screen sizes",
|
|
1846
|
-
title: "Screen sizes",
|
|
1847
|
-
onClick: () => r(!e),
|
|
1848
|
-
className: "w-7 px-0",
|
|
1849
|
-
children: /* @__PURE__ */ t(ta, { className: "h-3.5 w-3.5", "aria-hidden": !0 })
|
|
1850
|
-
}
|
|
1851
|
-
);
|
|
1852
|
-
}
|
|
1853
|
-
function Yi({ dashboardId: e }) {
|
|
1854
|
-
const { openDashboardId: a, access: r, printMode: n, serverIsFavorite: i, fetchedAt: o } = C(
|
|
1855
|
-
rn((d) => {
|
|
1856
|
-
var c;
|
|
1857
|
-
return {
|
|
1858
|
-
openDashboardId: (c = d.dashboard) == null ? void 0 : c.id,
|
|
1859
|
-
access: d.viewer.access,
|
|
1860
|
-
printMode: d.viewer.printMode,
|
|
1861
|
-
serverIsFavorite: d.viewer.isFavorite,
|
|
1862
|
-
fetchedAt: d.viewer.fetchedAt
|
|
1863
|
-
};
|
|
1864
|
-
})
|
|
1865
|
-
), l = sn(), h = l.isFavorite(e, i, o);
|
|
1866
|
-
return a !== e || n || r === "session-only" ? null : /* @__PURE__ */ t(
|
|
1867
|
-
on,
|
|
1868
|
-
{
|
|
1869
|
-
variant: "toolbar",
|
|
1870
|
-
isFavorite: h,
|
|
1871
|
-
readOnly: r === "read-only",
|
|
1872
|
-
pending: l.isPending(e),
|
|
1873
|
-
onToggle: () => void l.setFavorite({ dashboardId: e, isFavorite: !h })
|
|
1874
|
-
}
|
|
1875
|
-
);
|
|
1876
|
-
}
|
|
1877
|
-
function Xi(e) {
|
|
1878
|
-
var d;
|
|
1879
|
-
const { authToken: a, tokenProps: r } = $e(), { data: n } = ln(), { mutate: i, isPending: o } = dn(), l = !!e && ((d = n == null ? void 0 : n.preference) == null ? void 0 : d.defaultDashboardId) === e, h = !n || o;
|
|
1880
|
-
return {
|
|
1881
|
-
available: !!e && !!(a != null && a.accessToken) && !!(r != null && r.apiServiceUrl),
|
|
1882
|
-
isDefault: l,
|
|
1883
|
-
disabled: h,
|
|
1884
|
-
toggle: () => {
|
|
1885
|
-
!e || h || i({ dashboardId: l ? null : e });
|
|
1886
|
-
}
|
|
1887
|
-
};
|
|
1888
|
-
}
|
|
1889
|
-
function Ji({
|
|
1890
|
-
open: e,
|
|
1891
|
-
onOpenChange: a,
|
|
1892
|
-
onSave: r,
|
|
1893
|
-
onDiscard: n,
|
|
1894
|
-
isSaving: i,
|
|
1895
|
-
title: o = "Unsaved changes",
|
|
1896
|
-
description: l = "You have unsaved changes to this dashboard. What would you like to do?",
|
|
1897
|
-
cancelLabel: h = "Cancel",
|
|
1898
|
-
discardLabel: d = "Discard changes",
|
|
1899
|
-
saveLabel: c = "Save"
|
|
1900
|
-
}) {
|
|
1901
|
-
return /* @__PURE__ */ t(St, { open: e, onOpenChange: (p) => {
|
|
1902
|
-
!p && i || a(p);
|
|
1903
|
-
}, children: /* @__PURE__ */ s(kt, { children: [
|
|
1904
|
-
/* @__PURE__ */ s(Dt, { children: [
|
|
1905
|
-
/* @__PURE__ */ t(At, { children: o }),
|
|
1906
|
-
/* @__PURE__ */ t(Ft, { children: l })
|
|
1907
|
-
] }),
|
|
1908
|
-
/* @__PURE__ */ s(Et, { children: [
|
|
1909
|
-
/* @__PURE__ */ t(
|
|
1910
|
-
L,
|
|
1911
|
-
{
|
|
1912
|
-
type: "button",
|
|
1913
|
-
size: "xs",
|
|
1914
|
-
onClick: n,
|
|
1915
|
-
disabled: i,
|
|
1916
|
-
variant: "outline",
|
|
1917
|
-
className: "mr-auto text-destructive hover:border-destructive/40 hover:bg-destructive/10 hover:text-destructive focus-visible:bg-destructive/10 focus-visible:text-destructive",
|
|
1918
|
-
children: d
|
|
1919
|
-
}
|
|
1920
|
-
),
|
|
1921
|
-
r ? /* @__PURE__ */ t(It, { disabled: i, children: h }) : (
|
|
1922
|
-
// Without Save, staying is the safe action: primary, and still
|
|
1923
|
-
// the dialog's Cancel so it takes the first focus, not Discard.
|
|
1924
|
-
/* @__PURE__ */ t(cn, { asChild: !0, children: /* @__PURE__ */ t(L, { type: "button", size: "xs", children: h }) })
|
|
1925
|
-
),
|
|
1926
|
-
r && /* @__PURE__ */ t(L, { type: "button", size: "xs", onClick: r, disabled: i, children: i ? /* @__PURE__ */ s($, { children: [
|
|
1927
|
-
/* @__PURE__ */ t(de, { className: "mr-2 h-3.5 w-3.5 animate-spin" }),
|
|
1928
|
-
"Saving..."
|
|
1929
|
-
] }) : c })
|
|
1930
|
-
] })
|
|
1931
|
-
] }) });
|
|
1932
|
-
}
|
|
1933
|
-
async function Zi(e) {
|
|
1934
|
-
var o, l;
|
|
1935
|
-
const a = (l = (o = C.getState()) == null ? void 0 : o.authToken) == null ? void 0 : l.accessToken;
|
|
1936
|
-
if (!a)
|
|
1937
|
-
return;
|
|
1938
|
-
const r = `${e}/v1/invalidate-token`, n = await fetch(r, {
|
|
1939
|
-
method: "POST",
|
|
1940
|
-
headers: {
|
|
1941
|
-
Authorization: `Bearer ${a}`
|
|
1942
|
-
}
|
|
1943
|
-
});
|
|
1944
|
-
if (!n.ok)
|
|
1945
|
-
throw new Error("Failed to invalidate token");
|
|
1946
|
-
const i = await n.json();
|
|
1947
|
-
return console.log("invalidateToken", i), i;
|
|
1948
|
-
}
|
|
1949
|
-
function ms(e) {
|
|
1950
|
-
var r;
|
|
1951
|
-
const a = e.item;
|
|
1952
|
-
return a.kind === "export" ? {
|
|
1953
|
-
title: a.title,
|
|
1954
|
-
status: a.status,
|
|
1955
|
-
startedAt: a.startedAt,
|
|
1956
|
-
finishedAt: a.finishedAt,
|
|
1957
|
-
running: bn(a.stage),
|
|
1958
|
-
finishedDetail: [
|
|
1959
|
-
a.totalRows !== null ? `${a.totalRows.toLocaleString("en-US")} rows` : null,
|
|
1960
|
-
a.fileSize ? gn(a.fileSize) : null
|
|
1961
|
-
].filter((n) => !!n),
|
|
1962
|
-
failure: ((r = a.failure) == null ? void 0 : r.kind) === "export" ? a.failure.message : a.status === "failed" ? Ne.failedFallback : null,
|
|
1963
|
-
note: null
|
|
1964
|
-
} : {
|
|
1965
|
-
title: a.title,
|
|
1966
|
-
status: a.status,
|
|
1967
|
-
startedAt: a.startedAt,
|
|
1968
|
-
finishedAt: a.finishedAt,
|
|
1969
|
-
running: { text: a.stageLabel ?? Ne.inProgress },
|
|
1970
|
-
finishedDetail: [],
|
|
1971
|
-
failure: null,
|
|
1972
|
-
note: a.omittedAttachmentCount > 0 ? ge.attachmentsLeftOut(a.omittedAttachmentCount) : null
|
|
1973
|
-
};
|
|
1974
|
-
}
|
|
1975
|
-
function na({ row: e, now: a, api: r }) {
|
|
1976
|
-
const [n, i] = E("idle"), o = hn(e, r), l = async () => {
|
|
1977
|
-
if (!o) return;
|
|
1978
|
-
i("working");
|
|
1979
|
-
const h = await xn(r, e, o);
|
|
1980
|
-
i(h === "done" ? "idle" : h);
|
|
1981
|
-
};
|
|
1982
|
-
return /* @__PURE__ */ t(
|
|
1983
|
-
Ea,
|
|
1984
|
-
{
|
|
1985
|
-
shown: ms(e),
|
|
1986
|
-
now: a,
|
|
1987
|
-
longRunningHint: e.item.kind === "export",
|
|
1988
|
-
action: o ? { label: ga[o], run: () => void l() } : null,
|
|
1989
|
-
working: n === "working",
|
|
1990
|
-
problem: n === "denied" || n === "blocked" ? n : null
|
|
1991
|
-
}
|
|
1992
|
-
);
|
|
1993
|
-
}
|
|
1994
|
-
function ps({ work: e, now: a }) {
|
|
1995
|
-
const r = e.stage === "preparing" ? e.cancel : null;
|
|
1996
|
-
return /* @__PURE__ */ t(
|
|
1997
|
-
Ea,
|
|
1998
|
-
{
|
|
1999
|
-
shown: {
|
|
2000
|
-
title: e.title,
|
|
2001
|
-
status: "running",
|
|
2002
|
-
startedAt: e.startedAt,
|
|
2003
|
-
finishedAt: null,
|
|
2004
|
-
running: un(e),
|
|
2005
|
-
finishedDetail: [],
|
|
2006
|
-
failure: null,
|
|
2007
|
-
note: null
|
|
2008
|
-
},
|
|
2009
|
-
now: a,
|
|
2010
|
-
longRunningHint: !1,
|
|
2011
|
-
action: r ? { label: ga.cancel, run: r } : null,
|
|
2012
|
-
working: !1,
|
|
2013
|
-
problem: null
|
|
2014
|
-
}
|
|
2015
|
-
);
|
|
2016
|
-
}
|
|
2017
|
-
function Ea({
|
|
2018
|
-
shown: e,
|
|
2019
|
-
now: a,
|
|
2020
|
-
longRunningHint: r,
|
|
2021
|
-
action: n,
|
|
2022
|
-
working: i,
|
|
2023
|
-
problem: o
|
|
2024
|
-
}) {
|
|
2025
|
-
const l = e.status === "ready" ? "bg-emerald-500" : e.status === "failed" ? "bg-destructive" : e.status === "cancelled" ? "bg-muted-foreground/40" : "animate-pulse bg-muted-foreground/60", h = e.status === "ready" ? Ne.ready : e.status === "failed" ? Ne.failed : e.status === "cancelled" ? Ne.cancelled : Ne.inProgress, d = Date.parse(e.startedAt), c = Gt(Date.parse(e.finishedAt ?? e.startedAt), a, { addSuffix: !0 }), u = e.status === "running" && r && a - d >= mn, p = /* @__PURE__ */ t("span", { className: "text-muted-foreground/50", children: "·" });
|
|
2026
|
-
return /* @__PURE__ */ s("div", { className: "group flex items-start gap-2.5 px-3 py-2 transition-colors hover:bg-muted/40 focus-within:bg-muted/40", children: [
|
|
2027
|
-
/* @__PURE__ */ t("span", { className: "flex h-5 shrink-0 items-center", "aria-hidden": "true", children: /* @__PURE__ */ t("span", { className: `h-1.5 w-1.5 rounded-full ${l}` }) }),
|
|
2028
|
-
/* @__PURE__ */ t("span", { className: "sr-only", children: h }),
|
|
2029
|
-
/* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
|
|
2030
|
-
/* @__PURE__ */ s("div", { className: "flex h-5 items-center gap-2", children: [
|
|
2031
|
-
/* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate text-[13px] font-medium leading-5", children: e.title }),
|
|
2032
|
-
n && i && /* @__PURE__ */ t("span", { role: "status", className: "inline-flex shrink-0 items-center gap-1.5 text-[12px] text-muted-foreground", children: /* @__PURE__ */ t(ba, { className: "h-3 w-3 animate-spin", strokeWidth: 1.75 }) }),
|
|
2033
|
-
n && !i && /* @__PURE__ */ t(
|
|
2034
|
-
"button",
|
|
2035
|
-
{
|
|
2036
|
-
type: "button",
|
|
2037
|
-
onClick: n.run,
|
|
2038
|
-
className: "shrink-0 text-[12px] font-medium text-foreground/80 underline-offset-2 hover:text-foreground hover:underline focus-visible:underline focus-visible:outline-none",
|
|
2039
|
-
children: n.label
|
|
2040
|
-
}
|
|
2041
|
-
)
|
|
2042
|
-
] }),
|
|
2043
|
-
e.status === "running" && e.running && /* @__PURE__ */ s("div", { className: "text-[12px] leading-4 text-muted-foreground", children: [
|
|
2044
|
-
/* @__PURE__ */ t("span", { className: "tabular-nums", children: e.running.text }),
|
|
2045
|
-
e.running.detail && /* @__PURE__ */ s($, { children: [
|
|
2046
|
-
" ",
|
|
2047
|
-
p,
|
|
2048
|
-
" ",
|
|
2049
|
-
/* @__PURE__ */ t("span", { className: "tabular-nums", children: e.running.detail })
|
|
2050
|
-
] }),
|
|
2051
|
-
" ",
|
|
2052
|
-
p,
|
|
2053
|
-
" ",
|
|
2054
|
-
/* @__PURE__ */ t("span", { children: Ne.started(Gt(d, a)) }),
|
|
2055
|
-
e.running.percent !== void 0 && /* @__PURE__ */ t(pn, { value: e.running.percent, className: "mt-1.5 h-1" }),
|
|
2056
|
-
u && /* @__PURE__ */ t("div", { className: "mt-1", children: Ne.longRunning })
|
|
2057
|
-
] }),
|
|
2058
|
-
e.status !== "running" && /* @__PURE__ */ s("div", { className: "flex items-center gap-1.5 text-[12px] leading-4 text-muted-foreground", children: [
|
|
2059
|
-
e.status === "ready" && e.finishedDetail.length > 0 ? (
|
|
2060
|
-
// Disclosed on hover or focus only; the time is what a reader scans.
|
|
2061
|
-
/* @__PURE__ */ s("span", { className: "hidden group-hover:contents group-focus-within:contents", children: [
|
|
2062
|
-
e.finishedDetail.map((m, f) => /* @__PURE__ */ s(la.Fragment, { children: [
|
|
2063
|
-
f > 0 && p,
|
|
2064
|
-
/* @__PURE__ */ t("span", { children: m })
|
|
2065
|
-
] }, f)),
|
|
2066
|
-
p
|
|
2067
|
-
] })
|
|
2068
|
-
) : e.status !== "ready" ? /* @__PURE__ */ s($, { children: [
|
|
2069
|
-
/* @__PURE__ */ t("span", { children: h }),
|
|
2070
|
-
p
|
|
2071
|
-
] }) : null,
|
|
2072
|
-
/* @__PURE__ */ t("span", { children: c })
|
|
2073
|
-
] }),
|
|
2074
|
-
e.note && /* @__PURE__ */ t("div", { className: "text-[12px] leading-4 text-muted-foreground", children: e.note }),
|
|
2075
|
-
e.status === "failed" && e.failure && /* @__PURE__ */ t("div", { className: "mt-1 whitespace-pre-wrap break-words text-[12px] leading-4 text-destructive", children: e.failure }),
|
|
2076
|
-
o && /* @__PURE__ */ t(fn, { problem: o, className: "mt-1" })
|
|
2077
|
-
] })
|
|
2078
|
-
] });
|
|
2079
|
-
}
|
|
2080
|
-
function eo({ variant: e }) {
|
|
2081
|
-
const { snapshot: a, markSeen: r } = Vt(), n = a.runningCount > 0 ? a.runningCount > 9 ? "9+" : String(a.runningCount) : a.hasUnseenFinished ? "" : null, i = fa("activity", "md", {
|
|
2082
|
-
label: ge.title,
|
|
2083
|
-
icon: /* @__PURE__ */ t(ea, { className: "h-3.5 w-3.5" }),
|
|
2084
|
-
hint: n || (n === "" ? "New" : void 0),
|
|
2085
|
-
order: 30,
|
|
2086
|
-
onOpen: r
|
|
2087
|
-
});
|
|
2088
|
-
return i.collapsed ? /* @__PURE__ */ s(
|
|
2089
|
-
Ie,
|
|
2090
|
-
{
|
|
2091
|
-
open: i.popoverOpen,
|
|
2092
|
-
onOpenChange: (o) => {
|
|
2093
|
-
i.setPopoverOpen(o), o && r();
|
|
2094
|
-
},
|
|
2095
|
-
children: [
|
|
2096
|
-
i.anchorSlot && Tr(
|
|
2097
|
-
/* @__PURE__ */ t(Ca, { asChild: !0, children: /* @__PURE__ */ t("span", { className: "absolute right-0 top-0 h-7 w-px" }) }),
|
|
2098
|
-
i.anchorSlot
|
|
2099
|
-
),
|
|
2100
|
-
/* @__PURE__ */ t(
|
|
2101
|
-
Te,
|
|
2102
|
-
{
|
|
2103
|
-
className: "w-80 p-0",
|
|
2104
|
-
align: "end",
|
|
2105
|
-
sideOffset: 8,
|
|
2106
|
-
onFocusOutside: (o) => o.preventDefault(),
|
|
2107
|
-
children: /* @__PURE__ */ t(ra, {})
|
|
2108
|
-
}
|
|
2109
|
-
)
|
|
2110
|
-
]
|
|
2111
|
-
}
|
|
2112
|
-
) : /* @__PURE__ */ s(Ie, { onOpenChange: (o) => {
|
|
2113
|
-
o && r();
|
|
2114
|
-
}, children: [
|
|
2115
|
-
/* @__PURE__ */ t(nt, { asChild: !0, children: /* @__PURE__ */ s(
|
|
2116
|
-
L,
|
|
2117
|
-
{
|
|
2118
|
-
variant: e ?? "ghost",
|
|
2119
|
-
size: "xs",
|
|
2120
|
-
className: "relative w-7 px-0",
|
|
2121
|
-
"aria-label": ge.title,
|
|
2122
|
-
title: ge.title,
|
|
2123
|
-
children: [
|
|
2124
|
-
/* @__PURE__ */ t(ea, { className: "h-3.5 w-3.5" }),
|
|
2125
|
-
n !== null && /* @__PURE__ */ t(
|
|
2126
|
-
"span",
|
|
2127
|
-
{
|
|
2128
|
-
className: `absolute flex items-center justify-center rounded-full bg-primary text-primary-foreground ${n ? "-right-0.5 -top-0.5 h-3.5 min-w-3.5 px-0.5 text-[9px] font-semibold" : "right-1 top-1 h-1.5 w-1.5"}`,
|
|
2129
|
-
children: n
|
|
2130
|
-
}
|
|
2131
|
-
)
|
|
2132
|
-
]
|
|
2133
|
-
}
|
|
2134
|
-
) }),
|
|
2135
|
-
/* @__PURE__ */ t(Te, { className: "w-80 p-0", align: "end", sideOffset: 8, children: /* @__PURE__ */ t(ra, {}) })
|
|
2136
|
-
] });
|
|
2137
|
-
}
|
|
2138
|
-
function ra() {
|
|
2139
|
-
const e = Vt(), a = vn(), { rows: r, browserRows: n, activeTruncated: i } = e.snapshot, o = r.some((c) => ft(c.item.status)), l = [
|
|
2140
|
-
...r.filter((c) => !ft(c.item.status)).map((c) => ({ startedAt: c.item.startedAt, row: c })),
|
|
2141
|
-
...n.map((c) => ({ startedAt: c.startedAt, work: c }))
|
|
2142
|
-
].sort((c, u) => u.startedAt.localeCompare(c.startedAt)), h = r.filter((c) => ft(c.item.status)), d = r.length + n.length;
|
|
2143
|
-
return d === 0 ? /* @__PURE__ */ s("div", { className: "flex flex-col items-center gap-1.5 px-6 py-8 text-center", children: [
|
|
2144
|
-
/* @__PURE__ */ t("span", { className: "flex h-8 w-8 items-center justify-center rounded-[6px] border border-border text-muted-foreground", children: /* @__PURE__ */ t(yn, { className: "h-3.5 w-3.5", strokeWidth: 1.75 }) }),
|
|
2145
|
-
/* @__PURE__ */ t("p", { className: "text-[13px] font-medium", children: ge.title }),
|
|
2146
|
-
/* @__PURE__ */ t("p", { className: "text-[12px] text-muted-foreground", children: ge.empty })
|
|
2147
|
-
] }) : /* @__PURE__ */ s("div", { className: "flex flex-col", children: [
|
|
2148
|
-
/* @__PURE__ */ s("div", { className: "flex h-8 items-center gap-2 border-b border-border px-3", children: [
|
|
2149
|
-
/* @__PURE__ */ t("span", { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: ge.title }),
|
|
2150
|
-
/* @__PURE__ */ t("span", { className: "text-[10px] tabular-nums text-muted-foreground/70", children: d }),
|
|
2151
|
-
/* @__PURE__ */ s("div", { className: "ml-auto flex items-center gap-0.5", children: [
|
|
2152
|
-
o && /* @__PURE__ */ t(
|
|
2153
|
-
L,
|
|
2154
|
-
{
|
|
2155
|
-
variant: "ghost",
|
|
2156
|
-
size: "xs",
|
|
2157
|
-
className: "h-6 px-1.5 text-[12px] text-muted-foreground hover:text-foreground",
|
|
2158
|
-
onClick: e.clearFinished,
|
|
2159
|
-
children: ge.clear
|
|
2160
|
-
}
|
|
2161
|
-
),
|
|
2162
|
-
/* @__PURE__ */ t(
|
|
2163
|
-
L,
|
|
2164
|
-
{
|
|
2165
|
-
variant: "ghost",
|
|
2166
|
-
size: "xs",
|
|
2167
|
-
className: "h-6 w-6 px-0 text-muted-foreground hover:text-foreground",
|
|
2168
|
-
onClick: e.refresh,
|
|
2169
|
-
title: "Refresh status",
|
|
2170
|
-
"aria-label": "Refresh status",
|
|
2171
|
-
children: /* @__PURE__ */ t(ba, { strokeWidth: 1.75, className: "h-3.5 w-3.5" })
|
|
2172
|
-
}
|
|
2173
|
-
)
|
|
2174
|
-
] })
|
|
2175
|
-
] }),
|
|
2176
|
-
i && /* @__PURE__ */ t("p", { className: "border-b border-border px-3 py-2 text-[12px] leading-4 text-muted-foreground", children: ge.truncated }),
|
|
2177
|
-
/* @__PURE__ */ t("div", { className: "max-h-[320px] overflow-y-auto", children: /* @__PURE__ */ s("div", { className: "divide-y divide-border/70", children: [
|
|
2178
|
-
l.map((c) => "work" in c ? /* @__PURE__ */ t(ps, { work: c.work, now: a }, c.work.id) : /* @__PURE__ */ t(na, { row: c.row, now: a, api: e }, jt(c.row))),
|
|
2179
|
-
h.map((c) => /* @__PURE__ */ t(na, { row: c, now: a, api: e }, jt(c)))
|
|
2180
|
-
] }) })
|
|
2181
|
-
] });
|
|
2182
|
-
}
|
|
2183
|
-
function fs(e) {
|
|
2184
|
-
if (e)
|
|
2185
|
-
return {
|
|
2186
|
-
renamed: e.type === "rename" ? { oldId: e.oldId, newId: e.newId } : void 0,
|
|
2187
|
-
removedControlId: e.type === "remove" ? e.controlId : void 0,
|
|
2188
|
-
cardBindingsById: e.type === "add" || e.type === "update" ? e.cardBindingsById : void 0,
|
|
2189
|
-
affectedBindingControlIds: e.type === "add" || e.type === "update" ? e.affectedBindingControlIds : void 0
|
|
2190
|
-
};
|
|
2191
|
-
}
|
|
2192
|
-
function gs({
|
|
2193
|
-
open: e,
|
|
2194
|
-
onOpenChange: a,
|
|
2195
|
-
trigger: r,
|
|
2196
|
-
showTrigger: n = !0,
|
|
2197
|
-
initialMode: i = "manage"
|
|
2198
|
-
}) {
|
|
2199
|
-
const o = i === "create", {
|
|
2200
|
-
forceClose: l,
|
|
2201
|
-
handleOpenChange: h,
|
|
2202
|
-
isCreateFlowActive: d,
|
|
2203
|
-
preventPassiveDismissDuringCreate: c,
|
|
2204
|
-
resolvedOpen: u,
|
|
2205
|
-
setIsCreateFlowActive: p
|
|
2206
|
-
} = Sa({
|
|
2207
|
-
open: e,
|
|
2208
|
-
onOpenChange: a,
|
|
2209
|
-
initialCreateFlowActive: i === "create",
|
|
2210
|
-
// Dialog mode renders a built-in X close button — allow explicit
|
|
2211
|
-
// closes through `handleOpenChange`. Popover mode has no X; its
|
|
2212
|
-
// only close-via-trigger path is a re-click that would silently
|
|
2213
|
-
// wipe the in-progress create flow, so block everything during
|
|
2214
|
-
// create and make consumers use `forceClose()` from a dedicated
|
|
2215
|
-
// button.
|
|
2216
|
-
dismissMode: n ? "passive" : "explicit-only"
|
|
2217
|
-
}), m = C((b) => b.dashboard), { setDashboardControlsModel: f } = ve(), { participants: g } = Cn(Vr(m)), y = Array.from(
|
|
2218
|
-
new Map(
|
|
2219
|
-
g.flatMap(
|
|
2220
|
-
(b) => b.fieldChoices.map((_) => {
|
|
2221
|
-
var A;
|
|
2222
|
-
return [
|
|
2223
|
-
_.value,
|
|
2224
|
-
{
|
|
2225
|
-
option: _,
|
|
2226
|
-
target: (A = b.fieldTargetMap) == null ? void 0 : A[_.value]
|
|
2227
|
-
}
|
|
2228
|
-
];
|
|
2229
|
-
})
|
|
2230
|
-
)
|
|
2231
|
-
).values()
|
|
2232
|
-
), w = Array.from(
|
|
2233
|
-
new Map(
|
|
2234
|
-
g.flatMap(
|
|
2235
|
-
(b) => b.metricChoices.map((_) => {
|
|
2236
|
-
var A;
|
|
2237
|
-
return [
|
|
2238
|
-
_.value,
|
|
2239
|
-
{
|
|
2240
|
-
option: _,
|
|
2241
|
-
target: (A = b.metricTargetMap) == null ? void 0 : A[_.value]
|
|
2242
|
-
}
|
|
2243
|
-
];
|
|
2244
|
-
})
|
|
2245
|
-
)
|
|
2246
|
-
).values()
|
|
2247
|
-
), S = ir({
|
|
2248
|
-
...m || {},
|
|
2249
|
-
controls: []
|
|
2250
|
-
}), V = Nn(m), P = (b, _, A) => {
|
|
2251
|
-
f(
|
|
2252
|
-
b,
|
|
2253
|
-
_,
|
|
2254
|
-
fs(A)
|
|
2255
|
-
);
|
|
2256
|
-
}, D = ie(() => {
|
|
2257
|
-
if (o) {
|
|
2258
|
-
l();
|
|
2259
|
-
return;
|
|
2260
|
-
}
|
|
2261
|
-
p(!1);
|
|
2262
|
-
}, [o, l, p]), B = /* @__PURE__ */ t(
|
|
2263
|
-
ka,
|
|
2264
|
-
{
|
|
2265
|
-
scope: "dashboard",
|
|
2266
|
-
controls: m.controls || [],
|
|
2267
|
-
reservedControlIds: S,
|
|
2268
|
-
defaultValues: m.defaultControlValues || {},
|
|
2269
|
-
usageByControlId: wn(m),
|
|
2270
|
-
availableFieldChoices: y,
|
|
2271
|
-
availableMetricChoices: w,
|
|
2272
|
-
structuralParticipants: g,
|
|
2273
|
-
structuralParticipantIdsByControlId: V,
|
|
2274
|
-
initialCreateFlow: i === "create",
|
|
2275
|
-
onCreateFlowActiveChange: p,
|
|
2276
|
-
onCreateFlowComplete: D,
|
|
2277
|
-
onChange: P,
|
|
2278
|
-
emptyMessage: "No dashboard controls yet."
|
|
2279
|
-
}
|
|
2280
|
-
), k = d ? "Add dashboard control" : "Dashboard Controls", v = /* @__PURE__ */ s($, { children: [
|
|
2281
|
-
/* @__PURE__ */ s("div", { className: "space-y-1", children: [
|
|
2282
|
-
/* @__PURE__ */ t("h4", { className: "text-sm font-medium", children: "Dashboard Controls" }),
|
|
2283
|
-
/* @__PURE__ */ t("p", { className: "text-xs text-muted-foreground", children: "Add shared controls viewers can use across the dashboard. Each card can decide how to respond to the same control." })
|
|
2284
|
-
] }),
|
|
2285
|
-
B
|
|
2286
|
-
] });
|
|
2287
|
-
return n ? /* @__PURE__ */ s(Ie, { open: u, onOpenChange: h, children: [
|
|
2288
|
-
/* @__PURE__ */ t(nt, { asChild: !0, children: r || /* @__PURE__ */ s(L, { variant: "outline", className: "h-7 px-2", size: "sm", children: [
|
|
2289
|
-
/* @__PURE__ */ t(Na, { className: "mr-2 h-4 w-4" }),
|
|
2290
|
-
"Controls"
|
|
2291
|
-
] }) }),
|
|
2292
|
-
/* @__PURE__ */ t(
|
|
2293
|
-
Te,
|
|
2294
|
-
{
|
|
2295
|
-
className: "w-[620px] max-w-[95vw] space-y-4",
|
|
2296
|
-
align: "end",
|
|
2297
|
-
onEscapeKeyDown: c,
|
|
2298
|
-
onPointerDownOutside: c,
|
|
2299
|
-
children: v
|
|
2300
|
-
}
|
|
2301
|
-
)
|
|
2302
|
-
] }) : /* @__PURE__ */ t(Le, { open: u, onOpenChange: h, children: /* @__PURE__ */ s(
|
|
2303
|
-
Ve,
|
|
2304
|
-
{
|
|
2305
|
-
className: "flex max-h-[88vh] flex-col overflow-hidden sm:max-w-[600px]",
|
|
2306
|
-
onEscapeKeyDown: c,
|
|
2307
|
-
onPointerDownOutside: c,
|
|
2308
|
-
children: [
|
|
2309
|
-
/* @__PURE__ */ s(
|
|
2310
|
-
Lt,
|
|
2311
|
-
{
|
|
2312
|
-
className: d ? "space-y-0" : void 0,
|
|
2313
|
-
children: [
|
|
2314
|
-
/* @__PURE__ */ t(Be, { className: "text-[15px]", children: k }),
|
|
2315
|
-
/* @__PURE__ */ t(
|
|
2316
|
-
ut,
|
|
2317
|
-
{
|
|
2318
|
-
className: d ? "sr-only" : "text-[13px]",
|
|
2319
|
-
children: d ? "Configure and add a shared dashboard control." : "Add shared controls viewers can use across the dashboard. Each card can decide how to respond to the same control."
|
|
2320
|
-
}
|
|
2321
|
-
)
|
|
2322
|
-
]
|
|
2323
|
-
}
|
|
2324
|
-
),
|
|
2325
|
-
/* @__PURE__ */ t("div", { className: "min-h-0 overflow-y-auto pr-1", children: B })
|
|
2326
|
-
]
|
|
2327
|
-
}
|
|
2328
|
-
) });
|
|
2329
|
-
}
|
|
2330
|
-
const bs = [
|
|
2331
|
-
"enum",
|
|
2332
|
-
"multi_enum",
|
|
2333
|
-
"text",
|
|
2334
|
-
"number",
|
|
2335
|
-
"boolean",
|
|
2336
|
-
"date"
|
|
2337
|
-
];
|
|
2338
|
-
function xs({
|
|
2339
|
-
open: e,
|
|
2340
|
-
onOpenChange: a,
|
|
2341
|
-
initialMode: r = "manage"
|
|
2342
|
-
}) {
|
|
2343
|
-
var v;
|
|
2344
|
-
const n = r === "create", {
|
|
2345
|
-
forceClose: i,
|
|
2346
|
-
handleOpenChange: o,
|
|
2347
|
-
isCreateFlowActive: l,
|
|
2348
|
-
preventPassiveDismissDuringCreate: h,
|
|
2349
|
-
resolvedOpen: d,
|
|
2350
|
-
setIsCreateFlowActive: c
|
|
2351
|
-
} = Sa({
|
|
2352
|
-
open: e,
|
|
2353
|
-
onOpenChange: a,
|
|
2354
|
-
initialCreateFlowActive: r === "create",
|
|
2355
|
-
dismissMode: "explicit-only"
|
|
2356
|
-
}), u = C((b) => b.dashboard), p = C((b) => b.selectedSheetId), { setDashboardInputs: m } = ve(), f = (v = u.sheets) == null ? void 0 : v.find(
|
|
2357
|
-
(b) => b.id === p
|
|
2358
|
-
), g = (f == null ? void 0 : f.kind) === "document" && !!f.document, y = Y(
|
|
2359
|
-
() => g && (f != null && f.document) ? or(u, f.id) : [],
|
|
2360
|
-
[u, g, f == null ? void 0 : f.document, f == null ? void 0 : f.id]
|
|
2361
|
-
), w = Y(
|
|
2362
|
-
() => y.filter(
|
|
2363
|
-
(b) => b.kind === "control"
|
|
2364
|
-
),
|
|
2365
|
-
[y]
|
|
2366
|
-
), S = Y(
|
|
2367
|
-
() => w.map((b) => b.control),
|
|
2368
|
-
[w]
|
|
2369
|
-
), V = Y(
|
|
2370
|
-
() => ys(S),
|
|
2371
|
-
[S]
|
|
2372
|
-
), P = Y(
|
|
2373
|
-
() => [
|
|
2374
|
-
...vs(u),
|
|
2375
|
-
...(u.variables ?? []).map((b) => b.name)
|
|
2376
|
-
],
|
|
2377
|
-
[u]
|
|
2378
|
-
), D = ie(() => {
|
|
2379
|
-
if (n) {
|
|
2380
|
-
i();
|
|
2381
|
-
return;
|
|
2382
|
-
}
|
|
2383
|
-
c(!1);
|
|
2384
|
-
}, [n, i, c]), B = ie(
|
|
2385
|
-
(b, _, A) => {
|
|
2386
|
-
!g || !(f != null && f.document) || m(
|
|
2387
|
-
Ns({
|
|
2388
|
-
dashboard: u,
|
|
2389
|
-
documentSheetId: f.id,
|
|
2390
|
-
currentDocumentInputs: y,
|
|
2391
|
-
nextControls: b,
|
|
2392
|
-
nextDefaultValues: _,
|
|
2393
|
-
change: A
|
|
2394
|
-
})
|
|
2395
|
-
);
|
|
2396
|
-
},
|
|
2397
|
-
[
|
|
2398
|
-
u,
|
|
2399
|
-
y,
|
|
2400
|
-
g,
|
|
2401
|
-
f,
|
|
2402
|
-
m
|
|
2403
|
-
]
|
|
2404
|
-
);
|
|
2405
|
-
return !g || !(f != null && f.document) ? null : /* @__PURE__ */ t(Le, { open: d, onOpenChange: o, children: /* @__PURE__ */ s(
|
|
2406
|
-
Ve,
|
|
2407
|
-
{
|
|
2408
|
-
className: "flex max-h-[88vh] flex-col overflow-hidden sm:max-w-[600px]",
|
|
2409
|
-
onEscapeKeyDown: h,
|
|
2410
|
-
onPointerDownOutside: h,
|
|
2411
|
-
children: [
|
|
2412
|
-
/* @__PURE__ */ s(Lt, { className: l ? "space-y-0" : void 0, children: [
|
|
2413
|
-
/* @__PURE__ */ t(Be, { className: "text-[15px]", children: l ? "Add document control" : "Document Controls" }),
|
|
2414
|
-
/* @__PURE__ */ t(
|
|
2415
|
-
ut,
|
|
2416
|
-
{
|
|
2417
|
-
className: l ? "sr-only" : "text-[13px]",
|
|
2418
|
-
children: l ? "Configure and add a document-local control input." : "Add document-local control inputs. They are stored on this document sheet and are not dashboard controls."
|
|
2419
|
-
}
|
|
2420
|
-
)
|
|
2421
|
-
] }),
|
|
2422
|
-
/* @__PURE__ */ t("div", { className: "min-h-0 overflow-y-auto pr-1", children: /* @__PURE__ */ t(
|
|
2423
|
-
ka,
|
|
2424
|
-
{
|
|
2425
|
-
scope: "dashboard",
|
|
2426
|
-
controls: S,
|
|
2427
|
-
reservedControlIds: P,
|
|
2428
|
-
defaultValues: V,
|
|
2429
|
-
usageByControlId: {},
|
|
2430
|
-
availableFieldChoices: [],
|
|
2431
|
-
availableMetricChoices: [],
|
|
2432
|
-
structuralParticipants: [],
|
|
2433
|
-
structuralParticipantIdsByControlId: {},
|
|
2434
|
-
allowedControlTypes: bs,
|
|
2435
|
-
initialCreateFlow: r === "create",
|
|
2436
|
-
onCreateFlowActiveChange: c,
|
|
2437
|
-
onCreateFlowComplete: D,
|
|
2438
|
-
onChange: B,
|
|
2439
|
-
emptyMessage: "No document controls yet."
|
|
2440
|
-
}
|
|
2441
|
-
) })
|
|
2442
|
-
]
|
|
2443
|
-
}
|
|
2444
|
-
) });
|
|
2445
|
-
}
|
|
2446
|
-
function vs(e) {
|
|
2447
|
-
return (e.controls || []).map((a) => a.id);
|
|
2448
|
-
}
|
|
2449
|
-
function ys(e) {
|
|
2450
|
-
const a = {};
|
|
2451
|
-
for (const r of e)
|
|
2452
|
-
r.defaultValue !== void 0 && (a[r.id] = r.defaultValue);
|
|
2453
|
-
return a;
|
|
2454
|
-
}
|
|
2455
|
-
function Cs(e, a) {
|
|
2456
|
-
return a ? Object.prototype.hasOwnProperty.call(a, e.id) ? {
|
|
2457
|
-
...e,
|
|
2458
|
-
defaultValue: a[e.id]
|
|
2459
|
-
} : e.defaultValue === void 0 ? e : { ...e, defaultValue: void 0 } : e.defaultValue === void 0 ? e : { ...e, defaultValue: void 0 };
|
|
2460
|
-
}
|
|
2461
|
-
function Ns({
|
|
2462
|
-
dashboard: e,
|
|
2463
|
-
documentSheetId: a,
|
|
2464
|
-
currentDocumentInputs: r,
|
|
2465
|
-
nextControls: n,
|
|
2466
|
-
nextDefaultValues: i,
|
|
2467
|
-
change: o
|
|
2468
|
-
}) {
|
|
2469
|
-
const l = new Map(
|
|
2470
|
-
n.map((f) => [
|
|
2471
|
-
f.id,
|
|
2472
|
-
Cs(f, i)
|
|
2473
|
-
])
|
|
2474
|
-
), h = (o == null ? void 0 : o.type) === "rename" ? { oldId: o.oldId, newId: o.newId } : null, d = /* @__PURE__ */ new Set(), c = [];
|
|
2475
|
-
for (const f of r) {
|
|
2476
|
-
if (f.kind !== "control") {
|
|
2477
|
-
c.push(f);
|
|
2478
|
-
continue;
|
|
2479
|
-
}
|
|
2480
|
-
const g = l.get(f.control.id) || ((h == null ? void 0 : h.oldId) === f.control.id ? l.get(h.newId) : void 0);
|
|
2481
|
-
if (!g)
|
|
2482
|
-
continue;
|
|
2483
|
-
d.add(g.id);
|
|
2484
|
-
const y = lr(
|
|
2485
|
-
e,
|
|
2486
|
-
{ name: g.id },
|
|
2487
|
-
{ exclude: { source: "input", inputId: f.id }, alsoTaken: c }
|
|
2488
|
-
), w = g.id === y ? g : { ...g, id: y };
|
|
2489
|
-
c.push({
|
|
2490
|
-
...f,
|
|
2491
|
-
label: w.label,
|
|
2492
|
-
variableName: y,
|
|
2493
|
-
requiredAtExecution: w.requiredAtExecution,
|
|
2494
|
-
control: w
|
|
2495
|
-
});
|
|
2496
|
-
}
|
|
2497
|
-
for (const f of l.values())
|
|
2498
|
-
d.has(f.id) || c.push(
|
|
2499
|
-
dr({
|
|
2500
|
-
control: f,
|
|
2501
|
-
dashboard: e,
|
|
2502
|
-
alsoTaken: c,
|
|
2503
|
-
sheetId: a
|
|
2504
|
-
})
|
|
2505
|
-
);
|
|
2506
|
-
const u = new Set(
|
|
2507
|
-
r.map((f) => f.id)
|
|
2508
|
-
);
|
|
2509
|
-
return [...(Array.isArray(e.inputs) ? e.inputs : []).filter(
|
|
2510
|
-
(f) => !u.has(f.id)
|
|
2511
|
-
), ...c];
|
|
2512
|
-
}
|
|
2513
|
-
function ws({
|
|
2514
|
-
showFilters: e,
|
|
2515
|
-
onShowFiltersChange: a,
|
|
2516
|
-
pickerContent: r,
|
|
2517
|
-
settingsContent: n,
|
|
2518
|
-
size: i = "default",
|
|
2519
|
-
className: o,
|
|
2520
|
-
primaryButtonClassName: l,
|
|
2521
|
-
secondaryButtonClassName: h,
|
|
2522
|
-
pickerContentClassName: d,
|
|
2523
|
-
settingsContentClassName: c
|
|
2524
|
-
}) {
|
|
2525
|
-
const u = i === "toolbar", [p, m] = E(!1), f = it("interactive");
|
|
2526
|
-
return /* @__PURE__ */ s(
|
|
2527
|
-
"div",
|
|
2528
|
-
{
|
|
2529
|
-
className: J(
|
|
2530
|
-
// Height lives on the shell so the outer border is part of the
|
|
2531
|
-
// h-7 box (matches regular `size="xs"` buttons). Inner triggers
|
|
2532
|
-
// stretch to fill via `h-full`.
|
|
2533
|
-
"relative inline-flex items-stretch overflow-hidden rounded-control border border-input bg-background",
|
|
2534
|
-
u ? "h-8" : "h-7",
|
|
2535
|
-
o
|
|
2536
|
-
),
|
|
2537
|
-
children: [
|
|
2538
|
-
/* @__PURE__ */ s(Ie, { open: e, onOpenChange: a, children: [
|
|
2539
|
-
/* @__PURE__ */ t(nt, { asChild: !0, children: /* @__PURE__ */ s(
|
|
2540
|
-
L,
|
|
2541
|
-
{
|
|
2542
|
-
variant: "ghost",
|
|
2543
|
-
size: "xs",
|
|
2544
|
-
className: J(
|
|
2545
|
-
"h-full rounded-none border-0 bg-transparent pl-2.5 pr-2 shadow-none hover:bg-accent/50 data-[state=open]:bg-accent/60",
|
|
2546
|
-
l
|
|
2547
|
-
),
|
|
2548
|
-
children: [
|
|
2549
|
-
e ? /* @__PURE__ */ t(Ar, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ t(xa, { className: "h-3.5 w-3.5" }),
|
|
2550
|
-
"Filter"
|
|
2551
|
-
]
|
|
2552
|
-
}
|
|
2553
|
-
) }),
|
|
2554
|
-
/* @__PURE__ */ t(
|
|
2555
|
-
Te,
|
|
2556
|
-
{
|
|
2557
|
-
align: "end",
|
|
2558
|
-
sideOffset: 6,
|
|
2559
|
-
className: J(
|
|
2560
|
-
"w-auto rounded-card border border-border/60 p-0 shadow-[0_10px_28px_rgba(0,0,0,0.14)] dark:shadow-[0_10px_28px_rgba(0,0,0,0.5)]",
|
|
2561
|
-
d
|
|
2562
|
-
),
|
|
2563
|
-
style: f.contentStyle,
|
|
2564
|
-
children: r
|
|
2565
|
-
}
|
|
2566
|
-
)
|
|
2567
|
-
] }),
|
|
2568
|
-
/* @__PURE__ */ s(Ie, { open: p, onOpenChange: m, children: [
|
|
2569
|
-
/* @__PURE__ */ t(nt, { asChild: !0, children: /* @__PURE__ */ t(
|
|
2570
|
-
L,
|
|
2571
|
-
{
|
|
2572
|
-
variant: "ghost",
|
|
2573
|
-
size: "xs",
|
|
2574
|
-
className: J(
|
|
2575
|
-
"h-full w-7 rounded-none border-0 border-l border-border/60 bg-transparent px-0 shadow-none hover:bg-accent/50 data-[state=open]:bg-accent/60",
|
|
2576
|
-
h
|
|
2577
|
-
),
|
|
2578
|
-
"aria-label": "Filter and control actions",
|
|
2579
|
-
children: /* @__PURE__ */ t(Ot, { className: "h-3.5 w-3.5" })
|
|
2580
|
-
}
|
|
2581
|
-
) }),
|
|
2582
|
-
/* @__PURE__ */ t(
|
|
2583
|
-
Te,
|
|
2584
|
-
{
|
|
2585
|
-
align: "end",
|
|
2586
|
-
sideOffset: 6,
|
|
2587
|
-
className: J(
|
|
2588
|
-
"w-auto rounded-card border border-border/60 p-0 shadow-[0_10px_28px_rgba(0,0,0,0.14)] dark:shadow-[0_10px_28px_rgba(0,0,0,0.5)]",
|
|
2589
|
-
c
|
|
2590
|
-
),
|
|
2591
|
-
style: f.contentStyle,
|
|
2592
|
-
children: n(() => m(!1))
|
|
2593
|
-
}
|
|
2594
|
-
)
|
|
2595
|
-
] })
|
|
2596
|
-
]
|
|
2597
|
-
}
|
|
2598
|
-
);
|
|
2599
|
-
}
|
|
2600
|
-
function Ss() {
|
|
2601
|
-
Fr();
|
|
2602
|
-
const e = C((d) => d.selectedSheetId), a = C((d) => d.selectedFrameId), r = C((d) => d.dashboard), n = C((d) => d.actions.getSelectedFrame), { setSelectedFrameId: i } = ve(), { setCard: o } = dt(), l = oe((d) => d.card.dataSource);
|
|
2603
|
-
return Ee(() => {
|
|
2604
|
-
var c, u;
|
|
2605
|
-
let d = n();
|
|
2606
|
-
if (!d) {
|
|
2607
|
-
const p = (c = r == null ? void 0 : r.sheets) == null ? void 0 : c.find((f) => f.id === e), m = (u = p == null ? void 0 : p.frames) == null ? void 0 : u[0];
|
|
2608
|
-
m && (i(m.id), d = m);
|
|
2609
|
-
}
|
|
2610
|
-
if (d) {
|
|
2611
|
-
const p = d.cards.find((m) => m.id === d.activeCardId);
|
|
2612
|
-
p && o(p);
|
|
2613
|
-
}
|
|
2614
|
-
}, [n, e, a, r, i, o]), {
|
|
2615
|
-
hasEntities: !!(l != null && l.selectedEntities && l.selectedEntities.length > 0)
|
|
2616
|
-
};
|
|
2617
|
-
}
|
|
2618
|
-
function ks() {
|
|
2619
|
-
const e = C((d) => d.dashboard), a = C(
|
|
2620
|
-
(d) => d.semanticExecutionPayload
|
|
2621
|
-
), r = C(
|
|
2622
|
-
(d) => d.actions.addFilterInput
|
|
2623
|
-
), { hasEntities: n } = Ss(), { isLoading: i } = Sn(), o = Y(
|
|
2624
|
-
() => cr(e, a),
|
|
2625
|
-
[e, a]
|
|
2626
|
-
), h = !ur(e) && o.hasEligibleCards && !i;
|
|
2627
|
-
return /* @__PURE__ */ s("div", { className: "flex h-[520px] w-[400px] flex-col", children: [
|
|
2628
|
-
h && /* @__PURE__ */ t("div", { className: "border-b border-border/60 p-2", children: /* @__PURE__ */ s(
|
|
2629
|
-
"button",
|
|
2630
|
-
{
|
|
2631
|
-
type: "button",
|
|
2632
|
-
onClick: () => r(hr(), {
|
|
2633
|
-
kind: "allSheets",
|
|
2634
|
-
sheetKinds: ["dashboard"]
|
|
2635
|
-
}),
|
|
2636
|
-
title: `Applies to ${o.eligibleCardCount} of ${o.totalCardCount} date-aware cards`,
|
|
2637
|
-
className: "flex w-full items-start gap-2 rounded-control px-2 py-1.5 text-left outline-none transition-colors hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-border",
|
|
2638
|
-
children: [
|
|
2639
|
-
/* @__PURE__ */ t(kn, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
2640
|
-
/* @__PURE__ */ s("span", { className: "flex min-w-0 flex-col", children: [
|
|
2641
|
-
/* @__PURE__ */ t("span", { className: "text-[12px] font-medium text-foreground", children: "Add global date filter" }),
|
|
2642
|
-
/* @__PURE__ */ t("span", { className: "text-[11px] leading-[1.4] text-muted-foreground", children: "One date range across all date-aware cards." })
|
|
2643
|
-
] })
|
|
2644
|
-
]
|
|
2645
|
-
}
|
|
2646
|
-
) }),
|
|
2647
|
-
!n && /* @__PURE__ */ s("div", { className: "flex flex-1 flex-col items-center justify-center px-6 py-8 text-center", children: [
|
|
2648
|
-
/* @__PURE__ */ t(Dn, { className: "mb-3 h-10 w-10 text-muted-foreground/50" }),
|
|
2649
|
-
/* @__PURE__ */ t("h3", { className: "mb-1 text-[13px] font-medium text-foreground", children: "No fields configured" }),
|
|
2650
|
-
/* @__PURE__ */ t("p", { className: "text-[11px] text-muted-foreground", children: "Configure a data source for this card to enable filtering." })
|
|
2651
|
-
] }),
|
|
2652
|
-
n && /* @__PURE__ */ t("div", { className: "flex flex-1 overflow-hidden", children: /* @__PURE__ */ t(An, { context: "filter" }) })
|
|
2653
|
-
] });
|
|
2654
|
-
}
|
|
2655
|
-
function Ds({
|
|
2656
|
-
onAddFilter: e,
|
|
2657
|
-
onAddControl: a,
|
|
2658
|
-
onManageControls: r,
|
|
2659
|
-
onDismiss: n
|
|
2660
|
-
}) {
|
|
2661
|
-
const i = C(
|
|
2662
|
-
(h) => h.dashboard.filterLayout
|
|
2663
|
-
), { setFilterLayout: o } = ve(), l = (i == null ? void 0 : i.toolbarWrap) ?? !1;
|
|
2664
|
-
return /* @__PURE__ */ s("div", { className: "w-[300px]", children: [
|
|
2665
|
-
/* @__PURE__ */ s("div", { className: "p-1", children: [
|
|
2666
|
-
/* @__PURE__ */ t(
|
|
2667
|
-
vt,
|
|
2668
|
-
{
|
|
2669
|
-
icon: xa,
|
|
2670
|
-
label: "Add filter",
|
|
2671
|
-
onClick: () => {
|
|
2672
|
-
e(), n();
|
|
2673
|
-
}
|
|
2674
|
-
}
|
|
2675
|
-
),
|
|
2676
|
-
/* @__PURE__ */ t(
|
|
2677
|
-
vt,
|
|
2678
|
-
{
|
|
2679
|
-
icon: Na,
|
|
2680
|
-
label: "Add control",
|
|
2681
|
-
onClick: () => {
|
|
2682
|
-
a(), n();
|
|
2683
|
-
}
|
|
2684
|
-
}
|
|
2685
|
-
),
|
|
2686
|
-
/* @__PURE__ */ t(
|
|
2687
|
-
vt,
|
|
2688
|
-
{
|
|
2689
|
-
icon: Bt,
|
|
2690
|
-
label: "Manage controls",
|
|
2691
|
-
onClick: () => {
|
|
2692
|
-
r(), n();
|
|
2693
|
-
}
|
|
2694
|
-
}
|
|
2695
|
-
)
|
|
2696
|
-
] }),
|
|
2697
|
-
/* @__PURE__ */ t("div", { className: "border-t border-border/60" }),
|
|
2698
|
-
/* @__PURE__ */ s("div", { className: "space-y-1 p-2", children: [
|
|
2699
|
-
/* @__PURE__ */ t("p", { className: "px-1 text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Display" }),
|
|
2700
|
-
/* @__PURE__ */ t(
|
|
2701
|
-
As,
|
|
2702
|
-
{
|
|
2703
|
-
id: "filter-display-wrap",
|
|
2704
|
-
label: "Wrap to multiple lines",
|
|
2705
|
-
checked: l,
|
|
2706
|
-
onCheckedChange: (h) => o({ toolbarWrap: h === !0 })
|
|
2707
|
-
}
|
|
2708
|
-
)
|
|
2709
|
-
] })
|
|
2710
|
-
] });
|
|
2711
|
-
}
|
|
2712
|
-
function vt({
|
|
2713
|
-
icon: e,
|
|
2714
|
-
label: a,
|
|
2715
|
-
onClick: r
|
|
2716
|
-
}) {
|
|
2717
|
-
return /* @__PURE__ */ s(
|
|
2718
|
-
"button",
|
|
2719
|
-
{
|
|
2720
|
-
type: "button",
|
|
2721
|
-
onClick: r,
|
|
2722
|
-
className: "flex w-full items-center gap-2 rounded-control px-2 py-1.5 text-left text-[13px] text-foreground outline-none transition-colors hover:bg-muted/40 focus-visible:bg-muted/40",
|
|
2723
|
-
children: [
|
|
2724
|
-
/* @__PURE__ */ t(e, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
2725
|
-
a
|
|
2726
|
-
]
|
|
2727
|
-
}
|
|
2728
|
-
);
|
|
2729
|
-
}
|
|
2730
|
-
function As({
|
|
2731
|
-
id: e,
|
|
2732
|
-
label: a,
|
|
2733
|
-
checked: r,
|
|
2734
|
-
onCheckedChange: n
|
|
2735
|
-
}) {
|
|
2736
|
-
return /* @__PURE__ */ s("div", { className: "flex items-center gap-2 rounded-control px-1 py-1 transition-colors hover:bg-muted/40 focus-within:bg-muted/40", children: [
|
|
2737
|
-
/* @__PURE__ */ t(Tt, { id: e, checked: r, onCheckedChange: n }),
|
|
2738
|
-
/* @__PURE__ */ t(
|
|
2739
|
-
Me,
|
|
2740
|
-
{
|
|
2741
|
-
htmlFor: e,
|
|
2742
|
-
className: "cursor-pointer text-[12px] font-normal leading-[1.3]",
|
|
2743
|
-
children: a
|
|
2744
|
-
}
|
|
2745
|
-
)
|
|
2746
|
-
] });
|
|
2747
|
-
}
|
|
2748
|
-
function to({
|
|
2749
|
-
size: e,
|
|
2750
|
-
className: a,
|
|
2751
|
-
primaryButtonClassName: r,
|
|
2752
|
-
secondaryButtonClassName: n,
|
|
2753
|
-
pickerContentClassName: i,
|
|
2754
|
-
settingsContentClassName: o
|
|
2755
|
-
}) {
|
|
2756
|
-
var B;
|
|
2757
|
-
const [l, h] = E(null), d = C((k) => k.dashboard), c = C((k) => k.selectedSheetId), u = C((k) => k.showFilters), p = C((k) => k.actions), { setDocumentPanelTarget: m, setShowFilters: f } = p, g = (B = d.sheets) == null ? void 0 : B.find(
|
|
2758
|
-
(k) => k.id === c
|
|
2759
|
-
), y = He(g), w = ie((k) => {
|
|
2760
|
-
window.setTimeout(() => {
|
|
2761
|
-
h(k);
|
|
2762
|
-
}, 0);
|
|
2763
|
-
}, []), S = ie(
|
|
2764
|
-
(k) => {
|
|
2765
|
-
if (y && c) {
|
|
2766
|
-
k && m(c, {
|
|
2767
|
-
kind: "document",
|
|
2768
|
-
group: "inputs"
|
|
2769
|
-
});
|
|
2770
|
-
return;
|
|
2771
|
-
}
|
|
2772
|
-
f(k);
|
|
2773
|
-
},
|
|
2774
|
-
[
|
|
2775
|
-
y,
|
|
2776
|
-
c,
|
|
2777
|
-
m,
|
|
2778
|
-
f
|
|
2779
|
-
]
|
|
2780
|
-
), V = ie(() => {
|
|
2781
|
-
S(!0);
|
|
2782
|
-
}, [S]), P = ie(() => {
|
|
2783
|
-
w("create");
|
|
2784
|
-
}, [w]), D = ie(() => {
|
|
2785
|
-
w("manage");
|
|
2786
|
-
}, [w]);
|
|
2787
|
-
return /* @__PURE__ */ s($, { children: [
|
|
2788
|
-
/* @__PURE__ */ t(
|
|
2789
|
-
ws,
|
|
2790
|
-
{
|
|
2791
|
-
showFilters: y ? !1 : u,
|
|
2792
|
-
onShowFiltersChange: S,
|
|
2793
|
-
pickerContent: /* @__PURE__ */ t(ks, {}),
|
|
2794
|
-
settingsContent: (k) => /* @__PURE__ */ t(
|
|
2795
|
-
Ds,
|
|
2796
|
-
{
|
|
2797
|
-
onAddFilter: V,
|
|
2798
|
-
onAddControl: P,
|
|
2799
|
-
onManageControls: D,
|
|
2800
|
-
onDismiss: k
|
|
2801
|
-
}
|
|
2802
|
-
),
|
|
2803
|
-
size: e,
|
|
2804
|
-
className: a,
|
|
2805
|
-
primaryButtonClassName: r,
|
|
2806
|
-
secondaryButtonClassName: n,
|
|
2807
|
-
pickerContentClassName: i,
|
|
2808
|
-
settingsContentClassName: o
|
|
2809
|
-
}
|
|
2810
|
-
),
|
|
2811
|
-
l ? y ? /* @__PURE__ */ t(
|
|
2812
|
-
xs,
|
|
2813
|
-
{
|
|
2814
|
-
open: !0,
|
|
2815
|
-
onOpenChange: (k) => {
|
|
2816
|
-
k || h(null);
|
|
2817
|
-
},
|
|
2818
|
-
initialMode: l
|
|
2819
|
-
}
|
|
2820
|
-
) : /* @__PURE__ */ t(
|
|
2821
|
-
gs,
|
|
2822
|
-
{
|
|
2823
|
-
open: !0,
|
|
2824
|
-
onOpenChange: (k) => {
|
|
2825
|
-
k || h(null);
|
|
2826
|
-
},
|
|
2827
|
-
showTrigger: !1,
|
|
2828
|
-
initialMode: l
|
|
2829
|
-
}
|
|
2830
|
-
) : null
|
|
2831
|
-
] });
|
|
2832
|
-
}
|
|
2833
|
-
function Fs(e, a) {
|
|
2834
|
-
return (e.variables ?? []).map((r) => {
|
|
2835
|
-
const n = Br(e, r.id);
|
|
2836
|
-
return {
|
|
2837
|
-
variable: r,
|
|
2838
|
-
question: Or(r),
|
|
2839
|
-
places: n,
|
|
2840
|
-
usedHere: !!a && n.some((i) => i.sheetId === a)
|
|
2841
|
-
};
|
|
2842
|
-
});
|
|
2843
|
-
}
|
|
2844
|
-
function Es(e, a) {
|
|
2845
|
-
const r = a ? e.places.filter((i) => i.sheetId === a).length : 0, n = e.places.length - r;
|
|
2846
|
-
return e.places.length ? r && n ? `Used here · ${n} elsewhere` : r ? "Used here" : `Used in ${n} ${n === 1 ? "place" : "places"}` : "Not used yet";
|
|
2847
|
-
}
|
|
2848
|
-
function Is({
|
|
2849
|
-
dashboard: e,
|
|
2850
|
-
sheetId: a,
|
|
2851
|
-
sheetTitle: r,
|
|
2852
|
-
onOpen: n,
|
|
2853
|
-
onNew: i
|
|
2854
|
-
}) {
|
|
2855
|
-
const [o, l] = E(""), h = Y(() => Fs(e, a), [e, a]), d = o.trim().toLowerCase(), c = h.filter(
|
|
2856
|
-
(m) => !d || m.variable.name.toLowerCase().includes(d) || (m.variable.label ?? "").toLowerCase().includes(d) || m.question.toLowerCase().includes(d)
|
|
2857
|
-
), u = c.filter((m) => m.usedHere), p = c.filter((m) => !m.usedHere);
|
|
2858
|
-
return /* @__PURE__ */ s("div", { className: "w-[380px] max-w-[calc(100vw-24px)] overflow-hidden", "data-testid": "variables-list", children: [
|
|
2859
|
-
/* @__PURE__ */ s("div", { className: "flex h-11 items-center justify-between gap-2 border-b border-border/60 px-3", children: [
|
|
2860
|
-
/* @__PURE__ */ s("span", { className: "flex items-center gap-2", children: [
|
|
2861
|
-
/* @__PURE__ */ t(Nt, { className: "h-3.5 w-3.5 text-muted-foreground", "aria-hidden": !0 }),
|
|
2862
|
-
/* @__PURE__ */ t("span", { className: "text-[13px] font-medium", children: "Data variables" }),
|
|
2863
|
-
h.length ? /* @__PURE__ */ t("span", { className: "rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium tabular-nums text-muted-foreground", children: h.length }) : null
|
|
2864
|
-
] }),
|
|
2865
|
-
h.length ? /* @__PURE__ */ s(L, { size: "xs", className: "gap-1", onClick: i, children: [
|
|
2866
|
-
/* @__PURE__ */ t(be, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
|
|
2867
|
-
" New variable"
|
|
2868
|
-
] }) : null
|
|
2869
|
-
] }),
|
|
2870
|
-
h.length ? /* @__PURE__ */ s($, { children: [
|
|
2871
|
-
/* @__PURE__ */ t("div", { className: "px-3 py-2", children: /* @__PURE__ */ s("div", { className: "flex h-7 items-center gap-1.5 rounded-control border border-border px-2 text-[12px] text-muted-foreground", children: [
|
|
2872
|
-
/* @__PURE__ */ t(da, { className: "h-3.5 w-3.5 shrink-0", "aria-hidden": !0 }),
|
|
2873
|
-
/* @__PURE__ */ t(
|
|
2874
|
-
"input",
|
|
2875
|
-
{
|
|
2876
|
-
value: o,
|
|
2877
|
-
onChange: (m) => l(m.target.value),
|
|
2878
|
-
placeholder: "Search variables",
|
|
2879
|
-
"aria-label": "Search variables",
|
|
2880
|
-
className: "w-full bg-transparent text-foreground outline-none placeholder:text-muted-foreground"
|
|
2881
|
-
}
|
|
2882
|
-
)
|
|
2883
|
-
] }) }),
|
|
2884
|
-
/* @__PURE__ */ s("div", { className: "max-h-[360px] overflow-y-auto", children: [
|
|
2885
|
-
u.length ? /* @__PURE__ */ t(sa, { children: r ? `On ${r}` : "On this tab" }) : null,
|
|
2886
|
-
u.map((m) => /* @__PURE__ */ t(ia, { row: m, sheetId: a, onOpen: n }, m.variable.id)),
|
|
2887
|
-
p.length ? /* @__PURE__ */ t(sa, { children: u.length ? "Elsewhere on this dashboard" : "On this dashboard" }) : null,
|
|
2888
|
-
p.map((m) => /* @__PURE__ */ t(ia, { row: m, sheetId: a, onOpen: n, muted: !!u.length }, m.variable.id)),
|
|
2889
|
-
c.length ? null : /* @__PURE__ */ t("p", { className: "px-4 py-6 text-center text-[12px] text-muted-foreground", children: "No variable matches." })
|
|
2890
|
-
] })
|
|
2891
|
-
] }) : /* @__PURE__ */ s("div", { className: "px-6 py-8 text-center", children: [
|
|
2892
|
-
/* @__PURE__ */ t("span", { className: "mx-auto flex h-8 w-8 items-center justify-center rounded-full bg-muted", children: /* @__PURE__ */ t(Nt, { className: "h-4 w-4 text-muted-foreground", "aria-hidden": !0 }) }),
|
|
2893
|
-
/* @__PURE__ */ t("p", { className: "mt-3 text-[13px] font-medium", children: "No variables yet" }),
|
|
2894
|
-
/* @__PURE__ */ t("p", { className: "mx-auto mt-1 max-w-[280px] text-[12px] leading-[1.5] text-muted-foreground", children: "A variable shows a value from your data in any text: a name or address in a header, the latest date in a footer." }),
|
|
2895
|
-
/* @__PURE__ */ s(L, { size: "xs", className: "mt-4 gap-1", onClick: i, children: [
|
|
2896
|
-
/* @__PURE__ */ t(be, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
|
|
2897
|
-
" New variable"
|
|
2898
|
-
] })
|
|
2899
|
-
] })
|
|
2900
|
-
] });
|
|
2901
|
-
}
|
|
2902
|
-
function sa({ children: e }) {
|
|
2903
|
-
return /* @__PURE__ */ t("p", { className: "border-y border-border/60 bg-muted/40 px-4 py-1 text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground first:border-t-0", children: e });
|
|
2904
|
-
}
|
|
2905
|
-
function ia({
|
|
2906
|
-
row: e,
|
|
2907
|
-
sheetId: a,
|
|
2908
|
-
onOpen: r,
|
|
2909
|
-
muted: n
|
|
2910
|
-
}) {
|
|
2911
|
-
return /* @__PURE__ */ s(
|
|
2912
|
-
"button",
|
|
2913
|
-
{
|
|
2914
|
-
type: "button",
|
|
2915
|
-
onClick: () => r(e.variable.id),
|
|
2916
|
-
className: "grid w-full grid-cols-[minmax(0,1fr)_132px] items-center gap-3 border-t border-border/60 px-4 py-2 text-left first:border-t-0 hover:bg-muted/50",
|
|
2917
|
-
children: [
|
|
2918
|
-
/* @__PURE__ */ s("span", { className: "min-w-0", children: [
|
|
2919
|
-
/* @__PURE__ */ t("span", { className: J("block truncate text-[12px] font-medium text-foreground", !e.variable.label && "font-mono"), children: e.variable.label || e.variable.name }),
|
|
2920
|
-
/* @__PURE__ */ t("span", { className: "mt-0.5 block truncate text-[11px] text-muted-foreground", children: e.question })
|
|
2921
|
-
] }),
|
|
2922
|
-
/* @__PURE__ */ t("span", { className: J("truncate text-right text-[11px]", n ? "text-muted-foreground/70" : "text-muted-foreground"), children: Es(e, a) })
|
|
2923
|
-
]
|
|
2924
|
-
}
|
|
2925
|
-
);
|
|
2926
|
-
}
|
|
2927
|
-
function ao() {
|
|
2928
|
-
const e = C((r) => {
|
|
2929
|
-
var n;
|
|
2930
|
-
return ((n = r.dashboard.variables) == null ? void 0 : n.length) ?? 0;
|
|
2931
|
-
}), a = C((r) => r.actions.setVariablesListOpen);
|
|
2932
|
-
return { label: "Data variables", count: e, open: () => a(!0) };
|
|
2933
|
-
}
|
|
2934
|
-
function no() {
|
|
2935
|
-
var d;
|
|
2936
|
-
const e = C((c) => c.variablesListOpen), a = C((c) => c.actions.setVariablesListOpen), r = C((c) => c.dashboard), n = C((c) => c.selectedSheetId), i = C((c) => c.actions.openVariableEditor), o = it("interactive"), l = (d = r.sheets) == null ? void 0 : d.find((c) => c.id === n), h = (c) => {
|
|
2937
|
-
a(!1), i(c);
|
|
2938
|
-
};
|
|
2939
|
-
return /* @__PURE__ */ s(Ie, { open: e, onOpenChange: a, children: [
|
|
2940
|
-
/* @__PURE__ */ t(Ca, { asChild: !0, children: /* @__PURE__ */ t("span", { "aria-hidden": !0, className: "pointer-events-none inline-block h-7 w-0 self-center" }) }),
|
|
2941
|
-
/* @__PURE__ */ t(
|
|
2942
|
-
Te,
|
|
2943
|
-
{
|
|
2944
|
-
align: "end",
|
|
2945
|
-
sideOffset: 6,
|
|
2946
|
-
collisionPadding: 12,
|
|
2947
|
-
onFocusOutside: (c) => c.preventDefault(),
|
|
2948
|
-
className: "z-50 w-auto rounded-card border border-border/60 p-0 shadow-[0_10px_28px_rgba(0,0,0,0.14)] dark:shadow-[0_10px_28px_rgba(0,0,0,0.5)]",
|
|
2949
|
-
style: o.contentStyle,
|
|
2950
|
-
children: /* @__PURE__ */ t(
|
|
2951
|
-
Is,
|
|
2952
|
-
{
|
|
2953
|
-
dashboard: r,
|
|
2954
|
-
sheetId: n ?? void 0,
|
|
2955
|
-
sheetTitle: l == null ? void 0 : l.title,
|
|
2956
|
-
onOpen: (c) => h({ kind: "edit", variableId: c }),
|
|
2957
|
-
onNew: () => h({ kind: "new" })
|
|
2958
|
-
}
|
|
2959
|
-
)
|
|
2960
|
-
}
|
|
2961
|
-
)
|
|
2962
|
-
] });
|
|
2963
|
-
}
|
|
2964
|
-
function Ts(e, a) {
|
|
2965
|
-
const r = mr(e);
|
|
2966
|
-
return new Set(
|
|
2967
|
-
(e.sheets ?? []).map((i) => {
|
|
2968
|
-
const o = { sheetId: i.id, cardId: a, sheetKind: He(i) ? "document" : "dashboard" };
|
|
2969
|
-
return r.filter((l) => Pr(l, o)).map((l) => l.runtimeScope === "shared" ? l.id : `${l.id}@${i.id}`).join(`
|
|
2970
|
-
`);
|
|
2971
|
-
})
|
|
2972
|
-
).size > 1;
|
|
2973
|
-
}
|
|
2974
|
-
const Ls = [];
|
|
2975
|
-
function yt(e) {
|
|
2976
|
-
return Object.fromEntries(
|
|
2977
|
-
Object.entries(e).filter(([, a]) => a != null)
|
|
2978
|
-
);
|
|
2979
|
-
}
|
|
2980
|
-
function Vs(e) {
|
|
2981
|
-
const a = e == null ? void 0 : e.type;
|
|
2982
|
-
return a === "dataset" || a === "model" || fr.includes(a);
|
|
2983
|
-
}
|
|
2984
|
-
function Bs(e, a) {
|
|
2985
|
-
return zr(
|
|
2986
|
-
e.map((r, n) => {
|
|
2987
|
-
var i, o;
|
|
2988
|
-
return {
|
|
2989
|
-
target: r,
|
|
2990
|
-
columns: (i = a[n]) == null ? void 0 : i.columns,
|
|
2991
|
-
calculatedFields: (o = a[n]) == null ? void 0 : o.calculatedFields
|
|
2992
|
-
};
|
|
2993
|
-
})
|
|
2994
|
-
).columns;
|
|
2995
|
-
}
|
|
2996
|
-
function Ps(e) {
|
|
2997
|
-
const { tokenProps: a } = $e(), r = C((m) => m.authToken), { connections: n } = va(), i = e == null ? void 0 : e.connectionId, o = n.find((m) => m.id === i), l = Y(
|
|
2998
|
-
() => ((e == null ? void 0 : e.selectedEntities) ?? []).filter(Vs),
|
|
2999
|
-
[e == null ? void 0 : e.selectedEntities]
|
|
3000
|
-
), h = (m) => {
|
|
3001
|
-
var g;
|
|
3002
|
-
if (!(r != null && r.accessToken)) return !1;
|
|
3003
|
-
if (m.type === "dataset") {
|
|
3004
|
-
const y = m;
|
|
3005
|
-
return !!(y.domainId && y.name);
|
|
3006
|
-
}
|
|
3007
|
-
if (m.type === "model") return !!(i && m.id);
|
|
3008
|
-
const f = ((g = o == null ? void 0 : o.capabilities) == null ? void 0 : g.path) || [];
|
|
3009
|
-
return !(!i || !m.name || f.includes("database") && !m.database || f.includes("schema") && !m.schema);
|
|
3010
|
-
}, d = ie(
|
|
3011
|
-
(m) => {
|
|
3012
|
-
var g, y;
|
|
3013
|
-
const f = Bs(
|
|
3014
|
-
l,
|
|
3015
|
-
m.map((w) => w.data)
|
|
3016
|
-
);
|
|
3017
|
-
return {
|
|
3018
|
-
fields: f.length ? f : Ls,
|
|
3019
|
-
isLoading: m.some((w) => w.isLoading),
|
|
3020
|
-
error: (y = (g = m.find((w) => w.error)) == null ? void 0 : g.error) == null ? void 0 : y.message
|
|
3021
|
-
};
|
|
3022
|
-
},
|
|
3023
|
-
[l]
|
|
3024
|
-
), { fields: c, isLoading: u, error: p } = Fn({
|
|
3025
|
-
queries: l.map((m) => ({
|
|
3026
|
-
queryKey: ["columns", i, m, (e == null ? void 0 : e.semanticDomainId) ?? null],
|
|
3027
|
-
queryFn: () => pr(
|
|
3028
|
-
`${a.apiServiceUrl}/v1/columns`,
|
|
3029
|
-
(r == null ? void 0 : r.accessToken) || "",
|
|
3030
|
-
m.type === "model" ? yt({
|
|
3031
|
-
connection_id: i,
|
|
3032
|
-
datamodel_id: m.id,
|
|
3033
|
-
database_name: "",
|
|
3034
|
-
schema_name: "",
|
|
3035
|
-
table_name: ""
|
|
3036
|
-
}) : m.type === "dataset" ? yt({
|
|
3037
|
-
connection_id: m.connectionId ?? i,
|
|
3038
|
-
domain_id: m.domainId,
|
|
3039
|
-
dataset_name: m.name,
|
|
3040
|
-
database_name: m.database,
|
|
3041
|
-
schema_name: m.schema,
|
|
3042
|
-
table_name: m.table
|
|
3043
|
-
}) : yt({
|
|
3044
|
-
connection_id: i,
|
|
3045
|
-
datamodel_id: "",
|
|
3046
|
-
database_name: m.database,
|
|
3047
|
-
schema_name: m.schema,
|
|
3048
|
-
table_name: m.name
|
|
3049
|
-
})
|
|
3050
|
-
),
|
|
3051
|
-
enabled: h(m),
|
|
3052
|
-
staleTime: 6e4
|
|
3053
|
-
})),
|
|
3054
|
-
combine: d
|
|
3055
|
-
});
|
|
3056
|
-
return { fields: c, isLoading: u, error: p };
|
|
3057
|
-
}
|
|
3058
|
-
function _s(e) {
|
|
3059
|
-
var r;
|
|
3060
|
-
const a = ((r = e.comparison) == null ? void 0 : r.mode) === "explicit" ? e.comparison.spec : void 0;
|
|
3061
|
-
return a && a.kind !== "target" ? { mode: "period", spec: a } : { mode: "off" };
|
|
3062
|
-
}
|
|
3063
|
-
function Os(e) {
|
|
3064
|
-
return e.mode === "period" ? br(e.spec) : void 0;
|
|
3065
|
-
}
|
|
3066
|
-
const Ut = "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", zs = {
|
|
3067
|
-
connectionId: "",
|
|
3068
|
-
connectionType: "",
|
|
3069
|
-
mode: "semanticDomain",
|
|
3070
|
-
selectedEntities: []
|
|
3071
|
-
};
|
|
3072
|
-
function se({
|
|
3073
|
-
label: e,
|
|
3074
|
-
hint: a,
|
|
3075
|
-
aside: r,
|
|
3076
|
-
children: n,
|
|
3077
|
-
className: i
|
|
3078
|
-
}) {
|
|
3079
|
-
return /* @__PURE__ */ s("div", { className: i, children: [
|
|
3080
|
-
/* @__PURE__ */ s("div", { className: "mb-1 flex min-h-5 items-center justify-between gap-2", children: [
|
|
3081
|
-
/* @__PURE__ */ t("p", { className: Ut, children: e }),
|
|
3082
|
-
r
|
|
3083
|
-
] }),
|
|
3084
|
-
n,
|
|
3085
|
-
a ? /* @__PURE__ */ t("p", { className: "mt-1 text-[11px] leading-4 text-muted-foreground", children: a }) : null
|
|
3086
|
-
] });
|
|
3087
|
-
}
|
|
3088
|
-
function Ct({
|
|
3089
|
-
muted: e,
|
|
3090
|
-
onClick: a,
|
|
3091
|
-
children: r,
|
|
3092
|
-
ariaLabel: n
|
|
3093
|
-
}) {
|
|
3094
|
-
return /* @__PURE__ */ t(
|
|
3095
|
-
"button",
|
|
3096
|
-
{
|
|
3097
|
-
type: "button",
|
|
3098
|
-
onClick: a,
|
|
3099
|
-
"aria-label": n,
|
|
3100
|
-
className: J(
|
|
3101
|
-
"flex h-7 w-full items-center gap-1.5 rounded-control border border-input bg-background px-2 text-left text-[12px] hover:bg-muted/50",
|
|
3102
|
-
e ? "text-muted-foreground" : "text-foreground"
|
|
3103
|
-
),
|
|
3104
|
-
children: r
|
|
3105
|
-
}
|
|
3106
|
-
);
|
|
3107
|
-
}
|
|
3108
|
-
function Rs(e) {
|
|
3109
|
-
var r;
|
|
3110
|
-
const a = (r = e == null ? void 0 : e.selectedEntities) == null ? void 0 : r[0];
|
|
3111
|
-
if (a)
|
|
3112
|
-
return a.label || a.name;
|
|
3113
|
-
}
|
|
3114
|
-
function Ms(e) {
|
|
3115
|
-
const a = zt(e);
|
|
3116
|
-
return a === "date" ? "date" : a === "string" ? "text" : a === "number" ? "number" : a === "boolean" ? "yes/no" : a;
|
|
3117
|
-
}
|
|
3118
|
-
const oa = "__new_calculated_field__";
|
|
3119
|
-
function Us({
|
|
3120
|
-
draft: e,
|
|
3121
|
-
onChange: a,
|
|
3122
|
-
handle: r,
|
|
3123
|
-
onCalculatedFieldOpenChange: n
|
|
3124
|
-
}) {
|
|
3125
|
-
var O, te, Z, K, I, ae, q, R, ne, ue, he, ye;
|
|
3126
|
-
const { tokenProps: i } = $e(), o = ((O = i.config) == null ? void 0 : O.showAdvancedMode) !== !1, l = ((te = i.config) == null ? void 0 : te.showDirectSource) !== !1, { connections: h } = va(), [d, c] = E(!1), [u, p] = E(!1), [m, f] = E(!1), g = (x) => {
|
|
3127
|
-
p(x), n == null || n(x);
|
|
3128
|
-
}, { fields: y, isLoading: w, error: S } = Ps(e.mode === "data" ? e.dataSource : void 0), V = [...e.calculatedFields ?? [], ...y], P = (x) => x && (V.find((U) => U.id === x.id) ?? V.find((U) => $s(U, x))), D = [
|
|
3129
|
-
...V,
|
|
3130
|
-
...[e.field, e.sortField].filter(
|
|
3131
|
-
(x) => !!x && !P(x) && !V.some((U) => U.id === x.id)
|
|
3132
|
-
)
|
|
3133
|
-
], B = ((Z = P(e.field)) == null ? void 0 : Z.id) ?? ((K = e.field) == null ? void 0 : K.id) ?? "", k = ((I = P(e.sortField ?? e.field)) == null ? void 0 : I.id) ?? ((ae = e.sortField ?? e.field) == null ? void 0 : ae.id) ?? "", v = (x) => a({ ...e, ...x }), b = Rs(e.dataSource), _ = ((q = e.dataSource) == null ? void 0 : q.mode) === "database" ? Pt : qt, A = "mt-1 inline-flex items-center gap-1 text-[11px] font-medium text-muted-foreground underline-offset-2 hover:text-foreground hover:underline", G = {
|
|
3134
|
-
connectionId: ((R = e.dataSource) == null ? void 0 : R.connectionId) || e.connectionId,
|
|
3135
|
-
dataSource: e.dataSource,
|
|
3136
|
-
config: e.conditions ? { filters: e.conditions } : {},
|
|
3137
|
-
cardType: "text"
|
|
3138
|
-
}, T = Yt(e.field), M = (ne = T.find((x) => x.value === e.get)) == null ? void 0 : ne.hint, X = (x) => {
|
|
3139
|
-
if (x === oa) {
|
|
3140
|
-
g(!0);
|
|
3141
|
-
return;
|
|
3142
|
-
}
|
|
3143
|
-
const U = D.find((H) => H.id === x);
|
|
3144
|
-
if (!U) return;
|
|
3145
|
-
const j = Yt(U).some((H) => H.value === e.get) && e.field !== void 0;
|
|
3146
|
-
v({ field: U, get: j ? e.get : Xt(U) });
|
|
3147
|
-
};
|
|
3148
|
-
return u ? /* @__PURE__ */ t(
|
|
3149
|
-
En,
|
|
3150
|
-
{
|
|
3151
|
-
inline: !0,
|
|
3152
|
-
open: !0,
|
|
3153
|
-
onOpenChange: g,
|
|
3154
|
-
availableFields: D,
|
|
3155
|
-
cardId: e.id,
|
|
3156
|
-
source: G,
|
|
3157
|
-
onSave: (x) => {
|
|
3158
|
-
const U = { ...x, fieldScope: x.fieldScope ?? "card" };
|
|
3159
|
-
v({
|
|
3160
|
-
calculatedFields: [...(e.calculatedFields ?? []).filter((j) => j.id !== U.id), U],
|
|
3161
|
-
field: U,
|
|
3162
|
-
get: Xt(U)
|
|
3163
|
-
}), g(!1);
|
|
3164
|
-
}
|
|
3165
|
-
}
|
|
3166
|
-
) : /* @__PURE__ */ s($, { children: [
|
|
3167
|
-
/* @__PURE__ */ t(
|
|
3168
|
-
se,
|
|
3169
|
-
{
|
|
3170
|
-
label: "Name",
|
|
3171
|
-
aside: /* @__PURE__ */ t(qs, { value: e.name, placeholder: r, editing: m, onEditing: f, onChange: (x) => v({ name: x }) }),
|
|
3172
|
-
hint: m ? "The key: what you type after {{, and what links and agents use. Letters, digits and underscores." : void 0,
|
|
3173
|
-
children: /* @__PURE__ */ t(
|
|
3174
|
-
xe,
|
|
3175
|
-
{
|
|
3176
|
-
size: "xs",
|
|
3177
|
-
value: e.label ?? "",
|
|
3178
|
-
onChange: (x) => v({ label: x.target.value }),
|
|
3179
|
-
placeholder: ((ue = e.field) == null ? void 0 : ue.label) || "Latest order date",
|
|
3180
|
-
"aria-label": "Variable name"
|
|
3181
|
-
}
|
|
3182
|
-
)
|
|
3183
|
-
}
|
|
3184
|
-
),
|
|
3185
|
-
e.mode === "sql" ? /* @__PURE__ */ s($, { children: [
|
|
3186
|
-
/* @__PURE__ */ s(se, { label: "Connection", children: [
|
|
3187
|
-
/* @__PURE__ */ s(
|
|
3188
|
-
we,
|
|
3189
|
-
{
|
|
3190
|
-
value: e.connectionId ?? "",
|
|
3191
|
-
onValueChange: (x) => v({ connectionId: x }),
|
|
3192
|
-
children: [
|
|
3193
|
-
/* @__PURE__ */ t(Se, { size: "xs", "aria-label": "Connection", children: /* @__PURE__ */ t(ke, { placeholder: "Choose a connection" }) }),
|
|
3194
|
-
/* @__PURE__ */ t(De, { children: h.map((x) => /* @__PURE__ */ t(fe, { value: x.id, children: x.name }, x.id)) })
|
|
3195
|
-
]
|
|
3196
|
-
}
|
|
3197
|
-
),
|
|
3198
|
-
/* @__PURE__ */ s("button", { type: "button", onClick: () => v({ mode: "data" }), className: A, children: [
|
|
3199
|
-
/* @__PURE__ */ t(qt, { className: "h-3 w-3", "aria-hidden": !0 }),
|
|
3200
|
-
" Use a dataset or table instead"
|
|
3201
|
-
] })
|
|
3202
|
-
] }),
|
|
3203
|
-
/* @__PURE__ */ t(
|
|
3204
|
-
se,
|
|
3205
|
-
{
|
|
3206
|
-
label: "SQL",
|
|
3207
|
-
hint: /* @__PURE__ */ t($, { children: "One row. Each column is a part; the first shows by default. Filters reach it where the SQL names them, as a SQL card's do." }),
|
|
3208
|
-
children: /* @__PURE__ */ t(
|
|
3209
|
-
pa,
|
|
3210
|
-
{
|
|
3211
|
-
size: "xs",
|
|
3212
|
-
value: e.sql,
|
|
3213
|
-
onChange: (x) => v({ sql: x.target.value }),
|
|
3214
|
-
placeholder: "select max(order_date) as latest_order_date from orders",
|
|
3215
|
-
className: "min-h-[96px] font-mono",
|
|
3216
|
-
"aria-label": "SQL"
|
|
3217
|
-
}
|
|
3218
|
-
)
|
|
3219
|
-
}
|
|
3220
|
-
),
|
|
3221
|
-
/* @__PURE__ */ t(se, { label: "Get", children: /* @__PURE__ */ s(
|
|
3222
|
-
we,
|
|
3223
|
-
{
|
|
3224
|
-
value: e.get === "first" ? "first" : "only",
|
|
3225
|
-
onValueChange: (x) => v({ get: x }),
|
|
3226
|
-
children: [
|
|
3227
|
-
/* @__PURE__ */ t(Se, { size: "xs", "aria-label": "Get", children: /* @__PURE__ */ t(ke, {}) }),
|
|
3228
|
-
/* @__PURE__ */ s(De, { children: [
|
|
3229
|
-
/* @__PURE__ */ t(fe, { value: "only", children: "The only row" }),
|
|
3230
|
-
/* @__PURE__ */ t(fe, { value: "first", children: "The first row" })
|
|
3231
|
-
] })
|
|
3232
|
-
]
|
|
3233
|
-
}
|
|
3234
|
-
) })
|
|
3235
|
-
] }) : /* @__PURE__ */ s($, { children: [
|
|
3236
|
-
/* @__PURE__ */ s(se, { label: "Source", children: [
|
|
3237
|
-
/* @__PURE__ */ t(Ct, { muted: !b, onClick: () => c(!0), ariaLabel: "Source", children: b ? /* @__PURE__ */ s($, { children: [
|
|
3238
|
-
/* @__PURE__ */ t(_, { className: "h-3.5 w-3.5 text-muted-foreground", "aria-hidden": !0 }),
|
|
3239
|
-
" ",
|
|
3240
|
-
b
|
|
3241
|
-
] }) : l ? "Choose a dataset or table" : "Choose a dataset" }),
|
|
3242
|
-
o ? /* @__PURE__ */ s("button", { type: "button", onClick: () => {
|
|
3243
|
-
var x;
|
|
3244
|
-
return v({ mode: "sql", connectionId: ((x = e.dataSource) == null ? void 0 : x.connectionId) || e.connectionId });
|
|
3245
|
-
}, className: A, children: [
|
|
3246
|
-
/* @__PURE__ */ t(Yr, { className: "h-3 w-3", "aria-hidden": !0 }),
|
|
3247
|
-
" Write SQL instead"
|
|
3248
|
-
] }) : null
|
|
3249
|
-
] }),
|
|
3250
|
-
/* @__PURE__ */ t(
|
|
3251
|
-
Er,
|
|
3252
|
-
{
|
|
3253
|
-
open: d,
|
|
3254
|
-
onOpenChange: c,
|
|
3255
|
-
dataSource: e.dataSource ?? zs,
|
|
3256
|
-
incomingSelectedEntities: ((he = e.dataSource) == null ? void 0 : he.selectedEntities) ?? [],
|
|
3257
|
-
onDataSourceChange: (x) => {
|
|
3258
|
-
var j;
|
|
3259
|
-
const U = JSON.stringify(x.selectedEntities) === JSON.stringify((j = e.dataSource) == null ? void 0 : j.selectedEntities);
|
|
3260
|
-
v(
|
|
3261
|
-
U ? { dataSource: x } : { dataSource: x, field: void 0, sortField: void 0, conditions: null, calculatedFields: void 0 }
|
|
3262
|
-
);
|
|
3263
|
-
}
|
|
3264
|
-
}
|
|
3265
|
-
),
|
|
3266
|
-
/* @__PURE__ */ s("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
3267
|
-
/* @__PURE__ */ t(se, { label: "Field", children: b ? /* @__PURE__ */ s(we, { value: B, onValueChange: X, disabled: w && !D.length, children: [
|
|
3268
|
-
/* @__PURE__ */ t(Se, { size: "xs", "aria-label": "Field", children: /* @__PURE__ */ t(ke, { placeholder: w ? "Loading fields…" : S ? "Fields unavailable" : "Choose a field" }) }),
|
|
3269
|
-
/* @__PURE__ */ s(De, { children: [
|
|
3270
|
-
D.map((x) => /* @__PURE__ */ t(fe, { value: x.id, children: /* @__PURE__ */ s("span", { className: "flex items-center gap-2", children: [
|
|
3271
|
-
/* @__PURE__ */ t("span", { children: x.label || x.name }),
|
|
3272
|
-
/* @__PURE__ */ t("span", { className: "text-muted-foreground", children: Ms(x.dataType) })
|
|
3273
|
-
] }) }, x.id)),
|
|
3274
|
-
/* @__PURE__ */ t(ar, {}),
|
|
3275
|
-
/* @__PURE__ */ t(fe, { value: oa, children: /* @__PURE__ */ s("span", { className: "flex items-center gap-1.5", children: [
|
|
3276
|
-
/* @__PURE__ */ t(be, { className: "h-3 w-3", "aria-hidden": !0 }),
|
|
3277
|
-
" New calculated field…"
|
|
3278
|
-
] }) })
|
|
3279
|
-
] })
|
|
3280
|
-
] }) : /* @__PURE__ */ t(Ct, { muted: !0, children: "Choose a source first" }) }),
|
|
3281
|
-
/* @__PURE__ */ t(se, { label: "Get", children: /* @__PURE__ */ s(
|
|
3282
|
-
we,
|
|
3283
|
-
{
|
|
3284
|
-
value: e.get,
|
|
3285
|
-
onValueChange: (x) => v({ get: x }),
|
|
3286
|
-
disabled: !e.field,
|
|
3287
|
-
children: [
|
|
3288
|
-
/* @__PURE__ */ t(Se, { size: "xs", "aria-label": "Get", children: /* @__PURE__ */ t(ke, {}) }),
|
|
3289
|
-
/* @__PURE__ */ t(De, { children: T.map((x) => /* @__PURE__ */ t(fe, { value: x.value, children: x.label }, x.value)) })
|
|
3290
|
-
]
|
|
3291
|
-
}
|
|
3292
|
-
) }),
|
|
3293
|
-
e.field && M ? /* @__PURE__ */ t("p", { className: "col-span-2 -mt-1.5 text-[11px] leading-4 text-muted-foreground", children: M }) : null,
|
|
3294
|
-
S ? /* @__PURE__ */ t("p", { className: "col-span-2 -mt-1.5 text-[11px] leading-4 text-destructive", children: S }) : null,
|
|
3295
|
-
Rr(e) ? /* @__PURE__ */ t(
|
|
3296
|
-
se,
|
|
3297
|
-
{
|
|
3298
|
-
label: "Compare with",
|
|
3299
|
-
className: "col-span-2",
|
|
3300
|
-
children: /* @__PURE__ */ t(
|
|
3301
|
-
In,
|
|
3302
|
-
{
|
|
3303
|
-
controlLabel: "Variable",
|
|
3304
|
-
selection: _s(e),
|
|
3305
|
-
onChange: (x) => v({ comparison: Os(x) })
|
|
3306
|
-
}
|
|
3307
|
-
)
|
|
3308
|
-
}
|
|
3309
|
-
) : null,
|
|
3310
|
-
e.field && !Mr(e.get) && e.get !== "only" ? /* @__PURE__ */ s("div", { className: J("col-span-2 grid gap-3", e.get === "list" ? "grid-cols-3" : "grid-cols-2"), children: [
|
|
3311
|
-
/* @__PURE__ */ t(se, { label: "Order by", children: /* @__PURE__ */ s(
|
|
3312
|
-
we,
|
|
3313
|
-
{
|
|
3314
|
-
value: `${k}|${e.sortDirection}`,
|
|
3315
|
-
onValueChange: (x) => {
|
|
3316
|
-
const U = x.lastIndexOf("|"), j = x.slice(0, U), H = x.slice(U + 1);
|
|
3317
|
-
v({ sortField: D.find((le) => le.id === j), sortDirection: H });
|
|
3318
|
-
},
|
|
3319
|
-
children: [
|
|
3320
|
-
/* @__PURE__ */ t(Se, { size: "xs", "aria-label": "Order by", children: /* @__PURE__ */ t(ke, {}) }),
|
|
3321
|
-
/* @__PURE__ */ t(De, { children: D.flatMap(
|
|
3322
|
-
(x) => ["asc", "desc"].map((U) => /* @__PURE__ */ s(fe, { value: `${x.id}|${U}`, children: [
|
|
3323
|
-
x.label || x.name,
|
|
3324
|
-
", ",
|
|
3325
|
-
js(x, U)
|
|
3326
|
-
] }, `${x.id}|${U}`))
|
|
3327
|
-
) })
|
|
3328
|
-
]
|
|
3329
|
-
}
|
|
3330
|
-
) }),
|
|
3331
|
-
e.get === "list" ? /* @__PURE__ */ s($, { children: [
|
|
3332
|
-
/* @__PURE__ */ t(se, { label: "Show up to", children: /* @__PURE__ */ t(
|
|
3333
|
-
xe,
|
|
3334
|
-
{
|
|
3335
|
-
size: "xs",
|
|
3336
|
-
type: "number",
|
|
3337
|
-
min: 1,
|
|
3338
|
-
max: st,
|
|
3339
|
-
value: e.listLimit ?? "",
|
|
3340
|
-
placeholder: "10",
|
|
3341
|
-
onChange: (x) => {
|
|
3342
|
-
const U = Number.parseInt(x.target.value, 10);
|
|
3343
|
-
v({ listLimit: Number.isFinite(U) && U > 0 ? Math.min(U, st) : void 0 });
|
|
3344
|
-
},
|
|
3345
|
-
"aria-label": "Show up to"
|
|
3346
|
-
}
|
|
3347
|
-
) }),
|
|
3348
|
-
/* @__PURE__ */ t(se, { label: "Separator", children: /* @__PURE__ */ t(
|
|
3349
|
-
xe,
|
|
3350
|
-
{
|
|
3351
|
-
size: "xs",
|
|
3352
|
-
value: e.listSeparator ?? ", ",
|
|
3353
|
-
maxLength: gr,
|
|
3354
|
-
onChange: (x) => v({ listSeparator: x.target.value }),
|
|
3355
|
-
className: "font-mono",
|
|
3356
|
-
"aria-label": "Separator"
|
|
3357
|
-
}
|
|
3358
|
-
) })
|
|
3359
|
-
] }) : null
|
|
3360
|
-
] }) : null
|
|
3361
|
-
] }),
|
|
3362
|
-
/* @__PURE__ */ t(se, { label: "Filters", children: b ? (
|
|
3363
|
-
// In place, not a dialog over the dialog: each edit is the draft's, and
|
|
3364
|
-
// Cancel or Done here keeps or drops it. A new source starts a new list.
|
|
3365
|
-
/* @__PURE__ */ t(
|
|
3366
|
-
Ir,
|
|
3367
|
-
{
|
|
3368
|
-
filters: e.conditions ?? null,
|
|
3369
|
-
availableFields: D,
|
|
3370
|
-
source: G,
|
|
3371
|
-
onChange: (x) => v({ conditions: x })
|
|
3372
|
-
},
|
|
3373
|
-
JSON.stringify(((ye = e.dataSource) == null ? void 0 : ye.selectedEntities) ?? null)
|
|
3374
|
-
)
|
|
3375
|
-
) : /* @__PURE__ */ t(Ct, { muted: !0, children: "Choose a source first" }) })
|
|
3376
|
-
] })
|
|
3377
|
-
] });
|
|
3378
|
-
}
|
|
3379
|
-
function $s(e, a) {
|
|
3380
|
-
return e.name === a.name && (e.qualifiedEntityName ?? e.entityName ?? "") === (a.qualifiedEntityName ?? a.entityName ?? "");
|
|
3381
|
-
}
|
|
3382
|
-
function js(e, a) {
|
|
3383
|
-
const r = zt(e.dataType);
|
|
3384
|
-
return r === "date" ? a === "asc" ? "earliest first" : "latest first" : r === "number" ? a === "asc" ? "lowest first" : "highest first" : a === "asc" ? "A to Z" : "Z to A";
|
|
3385
|
-
}
|
|
3386
|
-
function qs({
|
|
3387
|
-
value: e,
|
|
3388
|
-
placeholder: a,
|
|
3389
|
-
editing: r,
|
|
3390
|
-
onEditing: n,
|
|
3391
|
-
onChange: i
|
|
3392
|
-
}) {
|
|
3393
|
-
return r ? /* @__PURE__ */ t(
|
|
3394
|
-
xe,
|
|
3395
|
-
{
|
|
3396
|
-
size: "xs",
|
|
3397
|
-
autoFocus: !0,
|
|
3398
|
-
value: e,
|
|
3399
|
-
placeholder: a,
|
|
3400
|
-
onChange: (o) => i(o.target.value),
|
|
3401
|
-
onBlur: () => n(!1),
|
|
3402
|
-
onKeyDown: (o) => {
|
|
3403
|
-
(o.key === "Enter" || o.key === "Escape") && (o.preventDefault(), o.stopPropagation(), n(!1));
|
|
3404
|
-
},
|
|
3405
|
-
className: "h-6 w-44 font-mono text-[11px]",
|
|
3406
|
-
"aria-label": "Key"
|
|
3407
|
-
}
|
|
3408
|
-
) : /* @__PURE__ */ s(
|
|
3409
|
-
"button",
|
|
3410
|
-
{
|
|
3411
|
-
type: "button",
|
|
3412
|
-
onClick: () => n(!0),
|
|
3413
|
-
"aria-label": "Edit key",
|
|
3414
|
-
title: "The key: what you type after {{, and what links and agents use",
|
|
3415
|
-
className: "inline-flex h-5 items-center gap-1 rounded-[4px] px-1 font-mono text-[11px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",
|
|
3416
|
-
children: [
|
|
3417
|
-
`{{${e.trim() || a}}}`,
|
|
3418
|
-
/* @__PURE__ */ t(Bt, { className: "h-3 w-3", "aria-hidden": !0 })
|
|
3419
|
-
]
|
|
3420
|
-
}
|
|
3421
|
-
);
|
|
3422
|
-
}
|
|
3423
|
-
const Ws = [
|
|
3424
|
-
{ id: "data", label: "Data" },
|
|
3425
|
-
{ id: "filters", label: "Dashboard filters" },
|
|
3426
|
-
{ id: "display", label: "Display" }
|
|
3427
|
-
];
|
|
3428
|
-
function Qs(e) {
|
|
3429
|
-
const { name: a, label: r, presentation: n, emptyText: i, ...o } = e;
|
|
3430
|
-
return JSON.stringify(o);
|
|
3431
|
-
}
|
|
3432
|
-
function Hs({
|
|
3433
|
-
variable: e,
|
|
3434
|
-
onClose: a,
|
|
3435
|
-
onHoldEscape: r
|
|
3436
|
-
}) {
|
|
3437
|
-
var Z, K;
|
|
3438
|
-
const n = C((I) => I.dashboard), i = C((I) => I.selectedSheetId), o = C((I) => I.actions.saveVariableChange), [l, h] = E(
|
|
3439
|
-
() => e ? Ur(e) : $r()
|
|
3440
|
-
), [d, c] = E("data"), [u, p] = E(!1), m = (I) => {
|
|
3441
|
-
p(I), r == null || r(I);
|
|
3442
|
-
}, [f, g] = E([]), [y, w] = E(null), S = !e, V = Qs(l), P = Y(
|
|
3443
|
-
() => Jt({ ...JSON.parse(V), name: "" }, n),
|
|
3444
|
-
[V, n]
|
|
3445
|
-
), { name: D, label: B, presentation: k, emptyText: v } = l, b = Y(
|
|
3446
|
-
() => ({
|
|
3447
|
-
...P,
|
|
3448
|
-
name: Zt(n, { id: P.id, name: D, field: l.field, mode: l.mode, label: B }),
|
|
3449
|
-
...B != null && B.trim() ? { label: B.trim() } : {},
|
|
3450
|
-
...k ? { presentation: k } : {},
|
|
3451
|
-
...v != null && v.trim() ? { emptyText: v } : {}
|
|
3452
|
-
}),
|
|
3453
|
-
// The field and mode are inside the query key already.
|
|
3454
|
-
[P, n, D, B, k, v, l.field, l.mode]
|
|
3455
|
-
), _ = Y(
|
|
3456
|
-
() => ({
|
|
3457
|
-
...n,
|
|
3458
|
-
variables: [...(n.variables ?? []).filter((I) => I.id !== b.id), b]
|
|
3459
|
-
}),
|
|
3460
|
-
[n, b]
|
|
3461
|
-
), A = jr(l), G = ct(), T = C((I) => I.actions.mergeSemanticExecutionPayload), [M, X] = E(!1), O = async () => {
|
|
3462
|
-
const I = Jt(l, n);
|
|
3463
|
-
X(!0);
|
|
3464
|
-
let ae;
|
|
3465
|
-
try {
|
|
3466
|
-
const R = Nr(n, e ? { kind: "update", id: e.id, patch: I } : { kind: "add", variable: I });
|
|
3467
|
-
if (!R.ok) {
|
|
3468
|
-
X(!1), g(R.issues);
|
|
3469
|
-
return;
|
|
3470
|
-
}
|
|
3471
|
-
const [ne] = R.queryFrames;
|
|
3472
|
-
ae = ne ? await G(ne, e ? { previousFrame: wr(n, e) } : void 0) : { domainsById: {} };
|
|
3473
|
-
} catch (R) {
|
|
3474
|
-
X(!1), g([
|
|
3475
|
-
{
|
|
3476
|
-
code: "queryMissing",
|
|
3477
|
-
message: R instanceof Error && R.message ? R.message : "The data source's details could not be loaded.",
|
|
3478
|
-
fix: "Try again, or choose the source again."
|
|
3479
|
-
}
|
|
3480
|
-
]);
|
|
3481
|
-
return;
|
|
3482
|
-
}
|
|
3483
|
-
const q = o(
|
|
3484
|
-
S ? { kind: "add", variable: I } : { kind: "update", id: I.id, patch: Ks(I) }
|
|
3485
|
-
);
|
|
3486
|
-
if (X(!1), !q.ok) {
|
|
3487
|
-
g(q.issues);
|
|
3488
|
-
return;
|
|
3489
|
-
}
|
|
3490
|
-
T(ae), a();
|
|
3491
|
-
}, te = (I) => {
|
|
3492
|
-
if (!e) return;
|
|
3493
|
-
const ae = o({ kind: "remove", id: e.id, confirmed: I });
|
|
3494
|
-
if (!ae.ok) {
|
|
3495
|
-
const q = ae.issues.find((R) => R.code === "inUse");
|
|
3496
|
-
if (q && !I) {
|
|
3497
|
-
w(q);
|
|
3498
|
-
return;
|
|
3499
|
-
}
|
|
3500
|
-
g(ae.issues);
|
|
3501
|
-
return;
|
|
3502
|
-
}
|
|
3503
|
-
a();
|
|
3504
|
-
};
|
|
3505
|
-
return /* @__PURE__ */ s(
|
|
3506
|
-
"div",
|
|
3507
|
-
{
|
|
3508
|
-
className: "flex h-[600px] max-h-[85vh] w-[600px] max-w-[calc(100vw-24px)] flex-col overflow-hidden",
|
|
3509
|
-
"data-testid": "variable-editor",
|
|
3510
|
-
children: [
|
|
3511
|
-
/* @__PURE__ */ s("div", { className: "flex min-h-12 shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3 py-1.5", children: [
|
|
3512
|
-
/* @__PURE__ */ s("div", { className: "flex min-w-0 items-start gap-2", children: [
|
|
3513
|
-
/* @__PURE__ */ t(Nt, { className: "mt-1 h-3.5 w-3.5 shrink-0 text-muted-foreground", "aria-hidden": !0 }),
|
|
3514
|
-
/* @__PURE__ */ s("div", { className: "min-w-0", children: [
|
|
3515
|
-
/* @__PURE__ */ s("p", { className: "flex items-center gap-2", children: [
|
|
3516
|
-
/* @__PURE__ */ t("span", { className: "truncate text-[13px] font-medium text-foreground", children: S ? "New variable" : e.label || e.name }),
|
|
3517
|
-
/* @__PURE__ */ t("span", { className: Ut, children: "Variable from data" })
|
|
3518
|
-
] }),
|
|
3519
|
-
/* @__PURE__ */ t("p", { className: "mt-0.5 truncate text-[10px] leading-3 text-muted-foreground/70", children: "Available on every tab and Document of this dashboard" })
|
|
3520
|
-
] })
|
|
3521
|
-
] }),
|
|
3522
|
-
/* @__PURE__ */ t(
|
|
3523
|
-
"button",
|
|
3524
|
-
{
|
|
3525
|
-
type: "button",
|
|
3526
|
-
onClick: a,
|
|
3527
|
-
"aria-label": "Close",
|
|
3528
|
-
className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-control text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
3529
|
-
children: /* @__PURE__ */ t(Qe, { className: "h-3.5 w-3.5", "aria-hidden": !0 })
|
|
3530
|
-
}
|
|
3531
|
-
)
|
|
3532
|
-
] }),
|
|
3533
|
-
u ? null : /* @__PURE__ */ t("nav", { role: "tablist", "aria-label": "Variable settings sections", className: "flex h-9 shrink-0 items-stretch gap-4 border-b border-border/60 px-4", children: Ws.map((I) => /* @__PURE__ */ s(
|
|
3534
|
-
"button",
|
|
3535
|
-
{
|
|
3536
|
-
role: "tab",
|
|
3537
|
-
"aria-selected": d === I.id,
|
|
3538
|
-
onClick: () => c(I.id),
|
|
3539
|
-
className: J(
|
|
3540
|
-
"relative -mb-px inline-flex items-center text-[13px] transition-colors focus-visible:outline-none",
|
|
3541
|
-
d === I.id ? "font-medium text-foreground" : "text-muted-foreground hover:text-foreground"
|
|
3542
|
-
),
|
|
3543
|
-
children: [
|
|
3544
|
-
I.label,
|
|
3545
|
-
d === I.id ? /* @__PURE__ */ t("span", { className: "absolute inset-x-0 -bottom-px h-[2px] bg-foreground" }) : null
|
|
3546
|
-
]
|
|
3547
|
-
},
|
|
3548
|
-
I.id
|
|
3549
|
-
)) }),
|
|
3550
|
-
/* @__PURE__ */ s("div", { className: J("min-h-0 flex-1 overflow-y-auto", d === "filters" || u ? "" : "space-y-4 px-4 py-4"), children: [
|
|
3551
|
-
d === "data" ? /* @__PURE__ */ t(
|
|
3552
|
-
Us,
|
|
3553
|
-
{
|
|
3554
|
-
draft: l,
|
|
3555
|
-
onChange: h,
|
|
3556
|
-
handle: Zt(n, l),
|
|
3557
|
-
onCalculatedFieldOpenChange: m
|
|
3558
|
-
}
|
|
3559
|
-
) : null,
|
|
3560
|
-
d === "filters" ? /* @__PURE__ */ t(Gs, { draft: l, draftDashboard: _ }) : null,
|
|
3561
|
-
d === "display" ? /* @__PURE__ */ t(Js, { draft: l, onChange: h }) : null
|
|
3562
|
-
] }),
|
|
3563
|
-
u ? null : /* @__PURE__ */ s($, { children: [
|
|
3564
|
-
/* @__PURE__ */ t(
|
|
3565
|
-
Zs,
|
|
3566
|
-
{
|
|
3567
|
-
draft: l,
|
|
3568
|
-
draftVariable: b,
|
|
3569
|
-
draftDashboard: _,
|
|
3570
|
-
blocker: A,
|
|
3571
|
-
selectedSheetId: i ?? void 0
|
|
3572
|
-
}
|
|
3573
|
-
),
|
|
3574
|
-
f.length ? /* @__PURE__ */ t("div", { className: "shrink-0 border-t border-border/60 bg-destructive/5 px-4 py-2 text-[11px] leading-4 text-destructive", role: "alert", children: f.map((I) => /* @__PURE__ */ s("p", { children: [
|
|
3575
|
-
I.message,
|
|
3576
|
-
" ",
|
|
3577
|
-
I.fix
|
|
3578
|
-
] }, `${I.code}:${I.path ?? ""}`)) }) : null,
|
|
3579
|
-
y ? /* @__PURE__ */ s("div", { className: "shrink-0 border-t border-border/60 bg-amber-500/10 px-4 py-2 text-[11px] leading-4 text-amber-800 dark:text-amber-300", role: "alertdialog", children: [
|
|
3580
|
-
/* @__PURE__ */ s("p", { children: [
|
|
3581
|
-
y.message,
|
|
3582
|
-
" Used in ",
|
|
3583
|
-
((Z = y.places) == null ? void 0 : Z.length) ?? 0,
|
|
3584
|
-
" ",
|
|
3585
|
-
((K = y.places) == null ? void 0 : K.length) === 1 ? "place" : "places",
|
|
3586
|
-
". Its chips then read as missing."
|
|
3587
|
-
] }),
|
|
3588
|
-
/* @__PURE__ */ s("div", { className: "mt-1.5 flex gap-1.5", children: [
|
|
3589
|
-
/* @__PURE__ */ t(L, { variant: "outline", size: "xs", className: "h-6 px-2 text-[11px]", onClick: () => w(null), children: "Keep it" }),
|
|
3590
|
-
/* @__PURE__ */ t(L, { size: "xs", className: "h-6 px-2 text-[11px]", onClick: () => te(!0), children: "Remove anyway" })
|
|
3591
|
-
] })
|
|
3592
|
-
] }) : null,
|
|
3593
|
-
/* @__PURE__ */ s("div", { className: "flex shrink-0 items-center justify-between gap-2 border-t border-border/60 px-4 py-2.5", children: [
|
|
3594
|
-
S ? /* @__PURE__ */ t("span", {}) : /* @__PURE__ */ t(
|
|
3595
|
-
L,
|
|
3596
|
-
{
|
|
3597
|
-
variant: "outline",
|
|
3598
|
-
size: "xs",
|
|
3599
|
-
className: "text-destructive hover:border-destructive/40 hover:bg-destructive/10 hover:text-destructive",
|
|
3600
|
-
onClick: () => te(!1),
|
|
3601
|
-
children: "Delete"
|
|
3602
|
-
}
|
|
3603
|
-
),
|
|
3604
|
-
/* @__PURE__ */ s("span", { className: "flex items-center gap-1.5", children: [
|
|
3605
|
-
/* @__PURE__ */ t(L, { variant: "outline", size: "xs", onClick: a, children: "Cancel" }),
|
|
3606
|
-
/* @__PURE__ */ t(L, { size: "xs", disabled: !!A || M, title: A, onClick: () => void O(), children: S ? "Create" : "Done" })
|
|
3607
|
-
] })
|
|
3608
|
-
] })
|
|
3609
|
-
] })
|
|
3610
|
-
]
|
|
3611
|
-
}
|
|
3612
|
-
);
|
|
3613
|
-
}
|
|
3614
|
-
function Ks(e) {
|
|
3615
|
-
const { id: a, ...r } = e;
|
|
3616
|
-
return {
|
|
3617
|
-
...r,
|
|
3618
|
-
// Fields the draft cleared come back as `undefined`, so an update drops them.
|
|
3619
|
-
label: r.label,
|
|
3620
|
-
presentation: r.presentation,
|
|
3621
|
-
emptyText: r.emptyText
|
|
3622
|
-
};
|
|
3623
|
-
}
|
|
3624
|
-
function Gs({ draft: e, draftDashboard: a }) {
|
|
3625
|
-
const r = Y(() => xr(a), [a]), n = r.inputs.filter(
|
|
3626
|
-
(o) => r.reachedVariables({ inputId: o.input.id }).some((l) => l.variableId === e.id)
|
|
3627
|
-
), i = e.mode === "sql" && vr(e.sql);
|
|
3628
|
-
return n.length ? /* @__PURE__ */ s("div", { className: "divide-y divide-border/60", children: [
|
|
3629
|
-
/* @__PURE__ */ t("p", { className: "px-4 py-2 text-[11px] leading-4 text-muted-foreground", children: "How each filter applies here. Change a mapping on the filter's Cards tab, under Variables." }),
|
|
3630
|
-
n.map((o) => {
|
|
3631
|
-
var d;
|
|
3632
|
-
const l = (d = o.input.application) == null ? void 0 : d.cards.find((c) => c.cardId === e.id), h = i ? "Subscribes in SQL" : e.mode === "sql" ? "Not named in the SQL" : (l == null ? void 0 : l.kind) === "excluded" ? "Don't apply" : (l == null ? void 0 : l.kind) === "bound" ? `${l.target.kind === "field" ? "Field" : "Path"} · ${l.target.field.name}` : "Auto";
|
|
3633
|
-
return /* @__PURE__ */ s("div", { className: "flex items-center justify-between gap-3 px-4 py-2 text-[12px]", children: [
|
|
3634
|
-
/* @__PURE__ */ s("span", { className: "min-w-0", children: [
|
|
3635
|
-
/* @__PURE__ */ t("span", { className: "block truncate font-medium text-foreground", children: o.input.label || o.input.filter.title }),
|
|
3636
|
-
/* @__PURE__ */ t("span", { className: "block truncate text-[11px] text-muted-foreground", children: Ys(o.input.scope) })
|
|
3637
|
-
] }),
|
|
3638
|
-
/* @__PURE__ */ t("span", { className: J("shrink-0 text-[11px]", h === "Don't apply" || h === "Not named in the SQL" ? "text-muted-foreground" : "text-foreground"), children: h })
|
|
3639
|
-
] }, o.input.id);
|
|
3640
|
-
})
|
|
3641
|
-
] }) : /* @__PURE__ */ t("p", { className: "px-4 py-6 text-center text-[12px] text-muted-foreground", children: "No filter reaches this variable. A filter on the tabs or Documents where it is used reaches it; a variable used nowhere yet follows every tab's filters." });
|
|
3642
|
-
}
|
|
3643
|
-
function Ys(e) {
|
|
3644
|
-
switch (e.kind) {
|
|
3645
|
-
case "allSheets":
|
|
3646
|
-
return "On every tab";
|
|
3647
|
-
case "sheets":
|
|
3648
|
-
return "On chosen tabs";
|
|
3649
|
-
case "cards":
|
|
3650
|
-
return "On chosen cards and variables";
|
|
3651
|
-
default:
|
|
3652
|
-
return e.kind;
|
|
3653
|
-
}
|
|
3654
|
-
}
|
|
3655
|
-
const Xs = [
|
|
3656
|
-
{ value: "auto", label: "Automatic" },
|
|
3657
|
-
{ value: "short", label: "Short" },
|
|
3658
|
-
{ value: "medium", label: "Medium" },
|
|
3659
|
-
{ value: "long", label: "Long" },
|
|
3660
|
-
{ value: "pattern", label: "Custom pattern…" }
|
|
3661
|
-
];
|
|
3662
|
-
function Js({ draft: e, onChange: a }) {
|
|
3663
|
-
var h, d;
|
|
3664
|
-
const r = e.mode === "sql" ? "unknown" : zt((h = e.field) == null ? void 0 : h.dataType), n = (d = e.presentation) == null ? void 0 : d.temporal, i = n ? n.mode === "style" ? n.dateStyle : n.mode === "pattern" ? "pattern" : "auto" : "auto", o = (n == null ? void 0 : n.mode) === "pattern" ? Lr(n.pattern) : null, l = (c) => a({ ...e, presentation: c && Object.keys(c).length ? c : void 0 });
|
|
3665
|
-
return /* @__PURE__ */ s($, { children: [
|
|
3666
|
-
r === "date" || r === "unknown" ? /* @__PURE__ */ s(se, { label: "Dates read as", hint: "A chip can change this for itself.", children: [
|
|
3667
|
-
/* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
|
|
3668
|
-
/* @__PURE__ */ s(
|
|
3669
|
-
we,
|
|
3670
|
-
{
|
|
3671
|
-
value: i,
|
|
3672
|
-
onValueChange: (c) => l({
|
|
3673
|
-
...e.presentation,
|
|
3674
|
-
temporal: c === "auto" ? void 0 : c === "pattern" ? { mode: "pattern", dialect: "semaphor_tokens", pattern: (n == null ? void 0 : n.mode) === "pattern" ? n.pattern : "MMM D, YYYY" } : { mode: "style", dateStyle: c }
|
|
3675
|
-
}),
|
|
3676
|
-
children: [
|
|
3677
|
-
/* @__PURE__ */ t(Se, { size: "xs", className: "w-44", "aria-label": "Date style", children: /* @__PURE__ */ t(ke, {}) }),
|
|
3678
|
-
/* @__PURE__ */ t(De, { children: Xs.map((c) => /* @__PURE__ */ t(fe, { value: c.value, children: c.label }, c.value)) })
|
|
3679
|
-
]
|
|
3680
|
-
}
|
|
3681
|
-
),
|
|
3682
|
-
(n == null ? void 0 : n.mode) === "pattern" ? /* @__PURE__ */ t(
|
|
3683
|
-
xe,
|
|
3684
|
-
{
|
|
3685
|
-
size: "xs",
|
|
3686
|
-
value: n.pattern,
|
|
3687
|
-
onChange: (c) => l({ ...e.presentation, temporal: { mode: "pattern", dialect: "semaphor_tokens", pattern: c.target.value } }),
|
|
3688
|
-
className: "w-40 font-mono",
|
|
3689
|
-
"aria-label": "Date pattern"
|
|
3690
|
-
}
|
|
3691
|
-
) : null
|
|
3692
|
-
] }),
|
|
3693
|
-
o ? /* @__PURE__ */ t("p", { className: "mt-1 text-[11px] text-destructive", children: o }) : null
|
|
3694
|
-
] }) : null,
|
|
3695
|
-
r === "number" || r === "unknown" ? /* @__PURE__ */ t(se, { label: "Numbers read as", hint: "A chip can change any of these for itself.", children: /* @__PURE__ */ t(Tn, { value: e.presentation, onChange: l }) }) : null,
|
|
3696
|
-
/* @__PURE__ */ t(
|
|
3697
|
-
se,
|
|
3698
|
-
{
|
|
3699
|
-
label: "When there’s no value",
|
|
3700
|
-
hint: "Readers see this when nothing matches or more than one does. Leave it empty to show nothing.",
|
|
3701
|
-
children: /* @__PURE__ */ t(
|
|
3702
|
-
xe,
|
|
3703
|
-
{
|
|
3704
|
-
size: "xs",
|
|
3705
|
-
value: e.emptyText ?? "",
|
|
3706
|
-
maxLength: yr,
|
|
3707
|
-
onChange: (c) => a({ ...e, emptyText: c.target.value || void 0 }),
|
|
3708
|
-
placeholder: "Show nothing",
|
|
3709
|
-
className: "w-72",
|
|
3710
|
-
"aria-label": "Empty text"
|
|
3711
|
-
}
|
|
3712
|
-
)
|
|
3713
|
-
}
|
|
3714
|
-
)
|
|
3715
|
-
] });
|
|
3716
|
-
}
|
|
3717
|
-
function Zs({
|
|
3718
|
-
draft: e,
|
|
3719
|
-
draftVariable: a,
|
|
3720
|
-
draftDashboard: r,
|
|
3721
|
-
blocker: n,
|
|
3722
|
-
selectedSheetId: i
|
|
3723
|
-
}) {
|
|
3724
|
-
var v;
|
|
3725
|
-
const o = r.sheets ?? [], l = Y(() => Ts(r, a.id), [r, a.id]), [h, d] = E(void 0), c = (l ? h : void 0) ?? i ?? ((v = o[0]) == null ? void 0 : v.id), u = o.find((b) => b.id === c), p = C((b) => c ? b.documentSectionRuntimeBySheetId[c] : void 0), m = !!(u && He(u)), f = Y(
|
|
3726
|
-
() => c ? m ? p ? { kind: "document", sheetId: c, runtime: p } : void 0 : { kind: "sheet", sheetId: c } : void 0,
|
|
3727
|
-
[m, p, c]
|
|
3728
|
-
), g = Y(() => n || !f ? [] : [a], [n, a, f]), w = Ln({
|
|
3729
|
-
dashboard: r,
|
|
3730
|
-
place: f ?? { kind: "sheet", sheetId: c ?? "" },
|
|
3731
|
-
purpose: "preview",
|
|
3732
|
-
variables: g
|
|
3733
|
-
}).byId.get(a.id), S = Vn(), V = Bn(), P = Y(
|
|
3734
|
-
() => Cr({ preferences: S, calendar: V }),
|
|
3735
|
-
[V, S]
|
|
3736
|
-
);
|
|
3737
|
-
let D, B = "", k = null;
|
|
3738
|
-
if (n)
|
|
3739
|
-
D = /* @__PURE__ */ t("span", { className: "text-muted-foreground", children: e.mode === "sql" ? "Write the SQL to see a value." : "Choose a source and a field to see a value." });
|
|
3740
|
-
else if (!f)
|
|
3741
|
-
D = /* @__PURE__ */ t("span", { className: "text-muted-foreground", children: "Open this Document to preview here." });
|
|
3742
|
-
else if (!w || w.status === "loading")
|
|
3743
|
-
D = /* @__PURE__ */ t("span", { className: "text-muted-foreground", children: "Loading…" });
|
|
3744
|
-
else {
|
|
3745
|
-
const b = ei(a, w, P);
|
|
3746
|
-
if (D = b.body, B = b.meta, b.unavailable) {
|
|
3747
|
-
const _ = (u == null ? void 0 : u.title) || "this tab";
|
|
3748
|
-
k = /* @__PURE__ */ s("p", { className: "mt-1.5 flex gap-1.5 text-[11px] leading-4 text-amber-700 dark:text-amber-400", children: [
|
|
3749
|
-
/* @__PURE__ */ t(ya, { className: "mt-px h-3 w-3 shrink-0", "aria-hidden": !0 }),
|
|
3750
|
-
/* @__PURE__ */ s("span", { children: [
|
|
3751
|
-
"No change on ",
|
|
3752
|
-
_,
|
|
3753
|
-
". ",
|
|
3754
|
-
Pn(b.unavailable, "variable")
|
|
3755
|
-
] })
|
|
3756
|
-
] });
|
|
3757
|
-
}
|
|
3758
|
-
}
|
|
3759
|
-
return /* @__PURE__ */ s("div", { className: "shrink-0 border-t border-border/60 bg-muted/30 px-4 py-2.5", "data-testid": "variable-preview", children: [
|
|
3760
|
-
/* @__PURE__ */ s("div", { className: "flex items-center gap-3", children: [
|
|
3761
|
-
/* @__PURE__ */ t("span", { className: Ut, children: l ? "Preview on" : "Preview" }),
|
|
3762
|
-
l ? /* @__PURE__ */ s(we, { value: c ?? "", onValueChange: d, disabled: !!n, children: [
|
|
3763
|
-
/* @__PURE__ */ t(Se, { size: "xs", className: "h-6 w-auto gap-1.5 px-2 text-[12px]", "aria-label": "Preview place", children: /* @__PURE__ */ t(ke, {}) }),
|
|
3764
|
-
/* @__PURE__ */ t(De, { children: o.map((b) => /* @__PURE__ */ t(fe, { value: b.id, children: b.title || b.id }, b.id)) })
|
|
3765
|
-
] }) : null,
|
|
3766
|
-
/* @__PURE__ */ t("div", { className: "min-w-0 flex-1 truncate text-right text-[13px]", children: D })
|
|
3767
|
-
] }),
|
|
3768
|
-
B ? /* @__PURE__ */ t("p", { className: "mt-1 text-[11px] leading-4 text-muted-foreground", children: B }) : null,
|
|
3769
|
-
k
|
|
3770
|
-
] });
|
|
3771
|
-
}
|
|
3772
|
-
function ei(e, a, r) {
|
|
3773
|
-
const n = (u) => /* @__PURE__ */ t("span", { className: "font-medium text-foreground", children: u }), i = (u) => /* @__PURE__ */ s("span", { className: "inline-flex items-center gap-1.5 text-[12px] text-amber-700 dark:text-amber-400", children: [
|
|
3774
|
-
/* @__PURE__ */ t(ya, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
|
|
3775
|
-
" ",
|
|
3776
|
-
u
|
|
3777
|
-
] }), o = (u) => u === void 0 ? "" : u === "beyondCap" ? `more than ${st} match` : `${u} ${u === 1 ? "match" : "matches"}`, l = "filterReach" in a ? a.filterReach : [], h = l.filter((u) => u.status === "applied").length, d = l.length - h, c = l.length ? ` · ${h} ${h === 1 ? "filter" : "filters"} applied${d ? `, ${d} skipped` : ""}` : "";
|
|
3778
|
-
switch (a.status) {
|
|
3779
|
-
case "answered": {
|
|
3780
|
-
const u = _r(e, Object.keys(a.parts))[0], p = u ? a.parts[u] : void 0, m = p && Kt(p, e.presentation, r) || "(empty)", f = `${o(a.matched)}${c}`.replace(/^ · /, ""), g = Sr(e, a, r);
|
|
3781
|
-
return g && typeof g == "object" && "unavailable" in g ? { body: n(m), meta: f, unavailable: g.unavailable } : g === "noPrevious" ? { body: n(m), meta: `${f} · Nothing in the period before to compare with.`.replace(/^ · /, "") } : g ? {
|
|
3782
|
-
body: /* @__PURE__ */ s($, { children: [
|
|
3783
|
-
n(g.value),
|
|
3784
|
-
/* @__PURE__ */ s("span", { className: "text-muted-foreground", children: [
|
|
3785
|
-
" · was ",
|
|
3786
|
-
g.previous,
|
|
3787
|
-
" · "
|
|
3788
|
-
] }),
|
|
3789
|
-
n(g.change)
|
|
3790
|
-
] }),
|
|
3791
|
-
meta: f
|
|
3792
|
-
} : { body: n(m), meta: f };
|
|
3793
|
-
}
|
|
3794
|
-
case "listed": {
|
|
3795
|
-
const u = a.items.map((m) => Kt(m, e.presentation, r)), p = a.more === "beyondCap" ? " and more" : a.more ? ` and ${a.more} more` : "";
|
|
3796
|
-
return { body: n(`${u.join(e.get.kind === "list" ? e.get.separator ?? ", " : ", ")}${p}`), meta: `${o(a.matched)}${c}` };
|
|
3797
|
-
}
|
|
3798
|
-
case "none":
|
|
3799
|
-
return a.why === "moreThanOne" ? {
|
|
3800
|
-
body: i(`More than one matches${a.matched !== void 0 ? ` (${a.matched === "beyondCap" ? `${st}+` : a.matched})` : ""}. Readers see nothing.`),
|
|
3801
|
-
meta: "Keep a selection on a filter, add a condition, or choose First or List."
|
|
3802
|
-
} : { body: /* @__PURE__ */ t("span", { className: "text-muted-foreground", children: "No rows match." }), meta: c.slice(3) };
|
|
3803
|
-
case "held":
|
|
3804
|
-
return { body: /* @__PURE__ */ s("span", { className: "text-muted-foreground", children: [
|
|
3805
|
-
"Waiting for ",
|
|
3806
|
-
a.missingRequired.join(", "),
|
|
3807
|
-
"."
|
|
3808
|
-
] }), meta: "A required filter has no value here." };
|
|
3809
|
-
case "broken":
|
|
3810
|
-
return { body: i("The query no longer compiles against its mapping."), meta: "" };
|
|
3811
|
-
case "failed":
|
|
3812
|
-
return { body: i("The query failed."), meta: a.message };
|
|
3813
|
-
default:
|
|
3814
|
-
return { body: null, meta: "" };
|
|
3815
|
-
}
|
|
3816
|
-
}
|
|
3817
|
-
function ro() {
|
|
3818
|
-
const e = C((l) => l.variableEditor), a = C((l) => l.dashboard.variables), r = C((l) => l.actions.closeVariableEditor), n = et(!1), i = (e == null ? void 0 : e.kind) === "edit" ? a == null ? void 0 : a.find((l) => l.id === e.variableId) : void 0;
|
|
3819
|
-
return !(e && (e.kind === "new" || i)) ? null : /* @__PURE__ */ s(Le, { modal: !1, open: !0, onOpenChange: (l) => !l && r(), children: [
|
|
3820
|
-
/* @__PURE__ */ t("div", { className: "pointer-events-none fixed inset-0 z-40 bg-zinc-950/40 backdrop-blur-sm" }),
|
|
3821
|
-
/* @__PURE__ */ s(
|
|
3822
|
-
Ve,
|
|
3823
|
-
{
|
|
3824
|
-
className: "w-auto max-w-none gap-0 overflow-hidden p-0 [&>button:last-child]:hidden",
|
|
3825
|
-
onInteractOutside: (l) => l.preventDefault(),
|
|
3826
|
-
onEscapeKeyDown: (l) => {
|
|
3827
|
-
n.current ? l.preventDefault() : r();
|
|
3828
|
-
},
|
|
3829
|
-
children: [
|
|
3830
|
-
/* @__PURE__ */ t(Be, { className: "sr-only", children: "Variable from data" }),
|
|
3831
|
-
/* @__PURE__ */ t(ut, { className: "sr-only", children: "Define a value from your data to show in text." }),
|
|
3832
|
-
/* @__PURE__ */ t(
|
|
3833
|
-
Hs,
|
|
3834
|
-
{
|
|
3835
|
-
variable: i,
|
|
3836
|
-
onClose: r,
|
|
3837
|
-
onHoldEscape: (l) => {
|
|
3838
|
-
n.current = l;
|
|
3839
|
-
}
|
|
3840
|
-
},
|
|
3841
|
-
(e == null ? void 0 : e.kind) === "edit" ? e.variableId : "new"
|
|
3842
|
-
)
|
|
3843
|
-
]
|
|
3844
|
-
}
|
|
3845
|
-
)
|
|
3846
|
-
] });
|
|
3847
|
-
}
|
|
3848
|
-
function ti({
|
|
3849
|
-
disabled: e,
|
|
3850
|
-
briefingCount: a,
|
|
3851
|
-
className: r,
|
|
3852
|
-
onClick: n
|
|
3853
|
-
}) {
|
|
3854
|
-
const i = typeof a == "number" && a > 0;
|
|
3855
|
-
return /* @__PURE__ */ s(
|
|
3856
|
-
L,
|
|
3857
|
-
{
|
|
3858
|
-
type: "button",
|
|
3859
|
-
size: "xs",
|
|
3860
|
-
variant: "outline",
|
|
3861
|
-
disabled: e,
|
|
3862
|
-
className: J("gap-1.5", r),
|
|
3863
|
-
onClick: n,
|
|
3864
|
-
"aria-label": "Reports & briefings",
|
|
3865
|
-
children: [
|
|
3866
|
-
/* @__PURE__ */ t(Gr, { className: "h-3.5 w-3.5" }),
|
|
3867
|
-
"Reports & briefings",
|
|
3868
|
-
i ? /* @__PURE__ */ t("span", { className: "ml-0.5 rounded-control bg-muted px-1 text-[10px] tabular-nums text-foreground/70", children: a }) : null
|
|
3869
|
-
]
|
|
3870
|
-
}
|
|
3871
|
-
);
|
|
3872
|
-
}
|
|
3873
|
-
const ai = "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", Ia = "inline-flex h-7 items-center gap-1.5 rounded-control px-2 text-[12px] text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-50", Ze = "inline-flex h-7 items-center gap-1.5 rounded-control bg-primary px-3 text-[12px] font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50";
|
|
3874
|
-
function ni(e) {
|
|
3875
|
-
return e === "dashboard" ? "This dashboard" : "Project";
|
|
3876
|
-
}
|
|
3877
|
-
function ri(e) {
|
|
3878
|
-
if (!e) return "Never";
|
|
3879
|
-
const a = new Date(e);
|
|
3880
|
-
if (Number.isNaN(a.getTime())) return "Unknown";
|
|
3881
|
-
const r = Date.now() - a.getTime(), n = Math.round(r / 6e4);
|
|
3882
|
-
if (n < 1) return "now";
|
|
3883
|
-
if (n < 60) return `${n}m ago`;
|
|
3884
|
-
const i = Math.round(n / 60);
|
|
3885
|
-
if (i < 24) return `${i}h ago`;
|
|
3886
|
-
const o = Math.round(i / 24);
|
|
3887
|
-
if (o < 7) return `${o}d ago`;
|
|
3888
|
-
const l = Math.round(o / 7);
|
|
3889
|
-
return l < 5 ? `${l}w ago` : `${Math.round(o / 30)}mo ago`;
|
|
3890
|
-
}
|
|
3891
|
-
function si(e) {
|
|
3892
|
-
return e.scheduleExpr ? qr(
|
|
3893
|
-
e.scheduleExpr,
|
|
3894
|
-
e.timezone || "UTC"
|
|
3895
|
-
) ?? "Invalid schedule" : "On demand";
|
|
3896
|
-
}
|
|
3897
|
-
function ii(e) {
|
|
3898
|
-
if (e.lastRunStatus) {
|
|
3899
|
-
const a = e.lastRunStatus.toString().toUpperCase();
|
|
3900
|
-
return a === "SUCCESS" ? "Last run completed." : a === "FAILED" ? "Last run failed." : `Last run ${e.lastRunStatus.toString().toLowerCase()}`;
|
|
3901
|
-
}
|
|
3902
|
-
return null;
|
|
3903
|
-
}
|
|
3904
|
-
function Ta(e) {
|
|
3905
|
-
return e.hasActiveRun ? "Running" : e.lastRunStatus ? `Last run ${e.lastRunStatus.toString().toLowerCase()}` : "Idle";
|
|
3906
|
-
}
|
|
3907
|
-
function oi(e) {
|
|
3908
|
-
return e.source.type === "dashboard" ? "This dashboard" : "Project";
|
|
3909
|
-
}
|
|
3910
|
-
function li({
|
|
3911
|
-
activeView: e,
|
|
3912
|
-
onChange: a
|
|
3913
|
-
}) {
|
|
3914
|
-
return /* @__PURE__ */ t(
|
|
3915
|
-
"div",
|
|
3916
|
-
{
|
|
3917
|
-
className: "flex shrink-0 items-center gap-1 rounded-control bg-muted p-0.5",
|
|
3918
|
-
role: "tablist",
|
|
3919
|
-
"aria-label": "Briefing source view",
|
|
3920
|
-
children: ["dashboard", "project"].map((r) => {
|
|
3921
|
-
const n = e === r;
|
|
3922
|
-
return /* @__PURE__ */ t(
|
|
3923
|
-
"button",
|
|
3924
|
-
{
|
|
3925
|
-
type: "button",
|
|
3926
|
-
role: "tab",
|
|
3927
|
-
"aria-selected": n,
|
|
3928
|
-
onClick: () => a(r),
|
|
3929
|
-
className: J(
|
|
3930
|
-
"h-6 rounded-[3px] px-2 text-[11px] transition-colors",
|
|
3931
|
-
n ? "bg-background font-medium text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"
|
|
3932
|
-
),
|
|
3933
|
-
children: ni(r)
|
|
3934
|
-
},
|
|
3935
|
-
r
|
|
3936
|
-
);
|
|
3937
|
-
})
|
|
3938
|
-
}
|
|
3939
|
-
);
|
|
3940
|
-
}
|
|
3941
|
-
function di({
|
|
3942
|
-
briefings: e,
|
|
3943
|
-
dashboardLabel: a,
|
|
3944
|
-
sourceView: r,
|
|
3945
|
-
error: n,
|
|
3946
|
-
loading: i,
|
|
3947
|
-
onSourceViewChange: o,
|
|
3948
|
-
onClose: l,
|
|
3949
|
-
onEdit: h,
|
|
3950
|
-
onNew: d,
|
|
3951
|
-
canCreate: c,
|
|
3952
|
-
canCreateScheduledReport: u,
|
|
3953
|
-
analyticalBriefingsEnabled: p,
|
|
3954
|
-
onRunNow: m,
|
|
3955
|
-
onTogglePause: f,
|
|
3956
|
-
onDelete: g,
|
|
3957
|
-
selectingId: y,
|
|
3958
|
-
busyId: w,
|
|
3959
|
-
manageBriefingsHref: S,
|
|
3960
|
-
contentKind: V,
|
|
3961
|
-
hideHeader: P = !1
|
|
3962
|
-
}) {
|
|
3963
|
-
const D = e.length, B = e.filter((A) => A.status === "ACTIVE").length, k = V === "reports" ? D === 1 ? "report" : "reports" : V === "briefings" ? D === 1 ? "briefing" : "briefings" : D === 1 ? "item" : "items", v = e.find((A) => A.hasActiveRun) ?? null, b = V ?? "reports & briefings", _ = r === "dashboard" ? a : `Project ${b}`;
|
|
3964
|
-
return /* @__PURE__ */ s(
|
|
3965
|
-
"section",
|
|
3966
|
-
{
|
|
3967
|
-
"aria-label": `Dashboard ${b.replace("&", "and")}`,
|
|
3968
|
-
className: "flex h-full min-h-0 flex-col bg-background text-foreground",
|
|
3969
|
-
children: [
|
|
3970
|
-
P ? null : /* @__PURE__ */ s("header", { className: "flex items-start justify-between gap-3 border-b border-border px-4 py-3", children: [
|
|
3971
|
-
/* @__PURE__ */ s("div", { className: "min-w-0", children: [
|
|
3972
|
-
/* @__PURE__ */ t("div", { className: ai, children: b }),
|
|
3973
|
-
/* @__PURE__ */ t("h2", { className: "mt-0.5 truncate text-[14px] font-semibold leading-5", children: _ })
|
|
3974
|
-
] }),
|
|
3975
|
-
/* @__PURE__ */ t(
|
|
3976
|
-
"button",
|
|
3977
|
-
{
|
|
3978
|
-
type: "button",
|
|
3979
|
-
onClick: l,
|
|
3980
|
-
className: "rounded-control p-1 text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
3981
|
-
"aria-label": `Close ${b.replace("&", "and")} panel`,
|
|
3982
|
-
children: /* @__PURE__ */ t(Qe, { className: "h-3.5 w-3.5" })
|
|
3983
|
-
}
|
|
3984
|
-
)
|
|
3985
|
-
] }),
|
|
3986
|
-
/* @__PURE__ */ s("div", { className: "flex items-center justify-between gap-3 border-b border-border px-4 py-2", children: [
|
|
3987
|
-
/* @__PURE__ */ s("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
3988
|
-
/* @__PURE__ */ t(
|
|
3989
|
-
li,
|
|
3990
|
-
{
|
|
3991
|
-
activeView: r,
|
|
3992
|
-
onChange: o
|
|
3993
|
-
}
|
|
3994
|
-
),
|
|
3995
|
-
/* @__PURE__ */ t("div", { className: "flex min-w-0 items-center gap-1.5 text-[11px] text-muted-foreground", children: i && D === 0 ? /* @__PURE__ */ s("span", { children: [
|
|
3996
|
-
"Loading ",
|
|
3997
|
-
b,
|
|
3998
|
-
"…"
|
|
3999
|
-
] }) : D === 0 ? /* @__PURE__ */ s("span", { children: [
|
|
4000
|
-
"No ",
|
|
4001
|
-
b,
|
|
4002
|
-
" yet"
|
|
4003
|
-
] }) : /* @__PURE__ */ s($, { children: [
|
|
4004
|
-
/* @__PURE__ */ s("span", { className: "font-medium text-foreground/80", children: [
|
|
4005
|
-
D,
|
|
4006
|
-
" ",
|
|
4007
|
-
k
|
|
4008
|
-
] }),
|
|
4009
|
-
/* @__PURE__ */ t("span", { className: "text-border", children: "·" }),
|
|
4010
|
-
/* @__PURE__ */ s("span", { children: [
|
|
4011
|
-
B,
|
|
4012
|
-
" active"
|
|
4013
|
-
] })
|
|
4014
|
-
] }) })
|
|
4015
|
-
] }),
|
|
4016
|
-
/* @__PURE__ */ s("div", { className: "flex items-center gap-1.5", children: [
|
|
4017
|
-
i ? (
|
|
4018
|
-
// Auto-refresh on open; surface a quiet spinner near the count
|
|
4019
|
-
// when a manual reload is in flight, but don't show a separate
|
|
4020
|
-
// refresh button — close+reopen handles the rare "stale list"
|
|
4021
|
-
// case without crowding the toolbar.
|
|
4022
|
-
/* @__PURE__ */ t(de, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground" })
|
|
4023
|
-
) : null,
|
|
4024
|
-
D > 0 && c ? p && u ? /* @__PURE__ */ s(je, { children: [
|
|
4025
|
-
/* @__PURE__ */ t(qe, { asChild: !0, children: /* @__PURE__ */ s("button", { className: Ze, children: [
|
|
4026
|
-
/* @__PURE__ */ t(be, { className: "h-3 w-3" }),
|
|
4027
|
-
" New"
|
|
4028
|
-
] }) }),
|
|
4029
|
-
/* @__PURE__ */ s(We, { align: "end", children: [
|
|
4030
|
-
/* @__PURE__ */ t(re, { onClick: () => d("scheduled_report"), children: "Schedule a report" }),
|
|
4031
|
-
/* @__PURE__ */ t(
|
|
4032
|
-
re,
|
|
4033
|
-
{
|
|
4034
|
-
onClick: () => d("analytical_briefing"),
|
|
4035
|
-
children: "Create analytical briefing"
|
|
4036
|
-
}
|
|
4037
|
-
)
|
|
4038
|
-
] })
|
|
4039
|
-
] }) : u ? /* @__PURE__ */ s(
|
|
4040
|
-
"button",
|
|
4041
|
-
{
|
|
4042
|
-
onClick: () => d("scheduled_report"),
|
|
4043
|
-
className: Ze,
|
|
4044
|
-
children: [
|
|
4045
|
-
/* @__PURE__ */ t(be, { className: "h-3 w-3" }),
|
|
4046
|
-
" Schedule report"
|
|
4047
|
-
]
|
|
4048
|
-
}
|
|
4049
|
-
) : p ? /* @__PURE__ */ s(
|
|
4050
|
-
"button",
|
|
4051
|
-
{
|
|
4052
|
-
onClick: () => d("analytical_briefing"),
|
|
4053
|
-
className: Ze,
|
|
4054
|
-
children: [
|
|
4055
|
-
/* @__PURE__ */ t(be, { className: "h-3 w-3" }),
|
|
4056
|
-
" New briefing"
|
|
4057
|
-
]
|
|
4058
|
-
}
|
|
4059
|
-
) : null : null
|
|
4060
|
-
] })
|
|
4061
|
-
] }),
|
|
4062
|
-
v ? /* @__PURE__ */ s("div", { className: "flex items-center gap-2 border-b border-border bg-muted/60 px-4 py-2 text-[12px]", children: [
|
|
4063
|
-
/* @__PURE__ */ t(de, { className: "h-3 w-3 shrink-0 animate-spin text-muted-foreground" }),
|
|
4064
|
-
/* @__PURE__ */ t("span", { className: "font-medium text-foreground", children: v.name }),
|
|
4065
|
-
/* @__PURE__ */ t("span", { className: "text-border", children: "·" }),
|
|
4066
|
-
/* @__PURE__ */ t("span", { className: "truncate text-muted-foreground", children: Ta(v) })
|
|
4067
|
-
] }) : null,
|
|
4068
|
-
/* @__PURE__ */ s("div", { className: "flex-1 overflow-y-auto", children: [
|
|
4069
|
-
n ? /* @__PURE__ */ t("div", { className: "m-4 rounded-card border border-destructive/30 bg-destructive/10 px-3 py-2 text-[12px] text-destructive", children: n }) : null,
|
|
4070
|
-
!i && e.length === 0 && !n ? /* @__PURE__ */ t(
|
|
4071
|
-
ci,
|
|
4072
|
-
{
|
|
4073
|
-
onNew: d,
|
|
4074
|
-
canCreate: c,
|
|
4075
|
-
canCreateScheduledReport: u,
|
|
4076
|
-
analyticalBriefingsEnabled: p,
|
|
4077
|
-
contentKind: V
|
|
4078
|
-
}
|
|
4079
|
-
) : null,
|
|
4080
|
-
e.map((A) => /* @__PURE__ */ t(
|
|
4081
|
-
hi,
|
|
4082
|
-
{
|
|
4083
|
-
briefing: A,
|
|
4084
|
-
isOpening: y === A.id,
|
|
4085
|
-
isBusy: w === A.id,
|
|
4086
|
-
onOpen: () => h(A.id),
|
|
4087
|
-
onRunNow: () => m(A),
|
|
4088
|
-
onTogglePause: () => f(A),
|
|
4089
|
-
onDelete: () => g(A)
|
|
4090
|
-
},
|
|
4091
|
-
A.id
|
|
4092
|
-
))
|
|
4093
|
-
] }),
|
|
4094
|
-
S ? /* @__PURE__ */ t("div", { className: "border-t border-border px-4 py-2.5", children: /* @__PURE__ */ s(
|
|
4095
|
-
"a",
|
|
4096
|
-
{
|
|
4097
|
-
href: S,
|
|
4098
|
-
className: J(Ia, "h-6 px-1 text-[11px]"),
|
|
4099
|
-
children: [
|
|
4100
|
-
"Manage all reports & briefings",
|
|
4101
|
-
/* @__PURE__ */ t(Qr, { className: "h-3 w-3" })
|
|
4102
|
-
]
|
|
4103
|
-
}
|
|
4104
|
-
) }) : null
|
|
4105
|
-
]
|
|
4106
|
-
}
|
|
4107
|
-
);
|
|
4108
|
-
}
|
|
4109
|
-
function ci({
|
|
4110
|
-
onNew: e,
|
|
4111
|
-
canCreate: a,
|
|
4112
|
-
canCreateScheduledReport: r,
|
|
4113
|
-
analyticalBriefingsEnabled: n,
|
|
4114
|
-
contentKind: i
|
|
4115
|
-
}) {
|
|
4116
|
-
const o = i === "reports" ? {
|
|
4117
|
-
title: "No reports yet",
|
|
4118
|
-
description: "Schedule an emailed dashboard or visual report to see it here."
|
|
4119
|
-
} : i === "briefings" ? {
|
|
4120
|
-
title: "No briefings yet",
|
|
4121
|
-
description: "Create an analytical briefing to monitor this dashboard and brief your team."
|
|
4122
|
-
} : null;
|
|
4123
|
-
return /* @__PURE__ */ s("div", { className: "flex h-full flex-col items-center justify-center px-8 py-12 text-center", children: [
|
|
4124
|
-
/* @__PURE__ */ t(ui, { className: "mb-5 h-[88px] w-[112px] text-border" }),
|
|
4125
|
-
/* @__PURE__ */ t("div", { className: "text-[13px] font-medium text-foreground", children: (o == null ? void 0 : o.title) ?? "Have an analyst brief your team" }),
|
|
4126
|
-
/* @__PURE__ */ t("p", { className: "mt-1.5 max-w-[320px] text-[12px] leading-5 text-muted-foreground", children: (o == null ? void 0 : o.description) ?? "Describe what to watch. An analyst digs into this dashboard and the data behind it, then briefs your team on the cadence you choose." }),
|
|
4127
|
-
a ? /* @__PURE__ */ s("div", { className: "mt-4 flex flex-wrap justify-center gap-2", children: [
|
|
4128
|
-
r ? /* @__PURE__ */ s(
|
|
4129
|
-
"button",
|
|
4130
|
-
{
|
|
4131
|
-
onClick: () => e("scheduled_report"),
|
|
4132
|
-
className: Ze,
|
|
4133
|
-
children: [
|
|
4134
|
-
/* @__PURE__ */ t(be, { className: "h-3 w-3" }),
|
|
4135
|
-
" Schedule a report"
|
|
4136
|
-
]
|
|
4137
|
-
}
|
|
4138
|
-
) : null,
|
|
4139
|
-
n ? /* @__PURE__ */ t(
|
|
4140
|
-
"button",
|
|
4141
|
-
{
|
|
4142
|
-
onClick: () => e("analytical_briefing"),
|
|
4143
|
-
className: Ia,
|
|
4144
|
-
children: "Create analytical briefing"
|
|
4145
|
-
}
|
|
4146
|
-
) : null
|
|
4147
|
-
] }) : null
|
|
4148
|
-
] });
|
|
4149
|
-
}
|
|
4150
|
-
function ui({ className: e }) {
|
|
4151
|
-
return /* @__PURE__ */ s(
|
|
4152
|
-
"svg",
|
|
4153
|
-
{
|
|
4154
|
-
viewBox: "0 0 112 88",
|
|
4155
|
-
fill: "none",
|
|
4156
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
4157
|
-
role: "presentation",
|
|
4158
|
-
"aria-hidden": "true",
|
|
4159
|
-
className: e,
|
|
4160
|
-
children: [
|
|
4161
|
-
/* @__PURE__ */ t(
|
|
4162
|
-
"rect",
|
|
4163
|
-
{
|
|
4164
|
-
x: "22",
|
|
4165
|
-
y: "6",
|
|
4166
|
-
width: "60",
|
|
4167
|
-
height: "72",
|
|
4168
|
-
rx: "3",
|
|
4169
|
-
stroke: "currentColor",
|
|
4170
|
-
strokeWidth: "1.25"
|
|
4171
|
-
}
|
|
4172
|
-
),
|
|
4173
|
-
/* @__PURE__ */ t(
|
|
4174
|
-
"line",
|
|
4175
|
-
{
|
|
4176
|
-
x1: "30",
|
|
4177
|
-
y1: "16",
|
|
4178
|
-
x2: "64",
|
|
4179
|
-
y2: "16",
|
|
4180
|
-
stroke: "currentColor",
|
|
4181
|
-
strokeWidth: "1.5",
|
|
4182
|
-
strokeLinecap: "round"
|
|
4183
|
-
}
|
|
4184
|
-
),
|
|
4185
|
-
/* @__PURE__ */ t(
|
|
4186
|
-
"line",
|
|
4187
|
-
{
|
|
4188
|
-
x1: "30",
|
|
4189
|
-
y1: "21",
|
|
4190
|
-
x2: "52",
|
|
4191
|
-
y2: "21",
|
|
4192
|
-
stroke: "currentColor",
|
|
4193
|
-
strokeWidth: "1",
|
|
4194
|
-
strokeLinecap: "round",
|
|
4195
|
-
opacity: "0.5"
|
|
4196
|
-
}
|
|
4197
|
-
),
|
|
4198
|
-
/* @__PURE__ */ t("circle", { cx: "31", cy: "32", r: "1", fill: "currentColor", opacity: "0.6" }),
|
|
4199
|
-
/* @__PURE__ */ t(
|
|
4200
|
-
"line",
|
|
4201
|
-
{
|
|
4202
|
-
x1: "35",
|
|
4203
|
-
y1: "32",
|
|
4204
|
-
x2: "72",
|
|
4205
|
-
y2: "32",
|
|
4206
|
-
stroke: "currentColor",
|
|
4207
|
-
strokeWidth: "1",
|
|
4208
|
-
opacity: "0.4",
|
|
4209
|
-
strokeLinecap: "round"
|
|
4210
|
-
}
|
|
4211
|
-
),
|
|
4212
|
-
/* @__PURE__ */ t("circle", { cx: "31", cy: "38", r: "1", fill: "currentColor", opacity: "0.6" }),
|
|
4213
|
-
/* @__PURE__ */ t(
|
|
4214
|
-
"line",
|
|
4215
|
-
{
|
|
4216
|
-
x1: "35",
|
|
4217
|
-
y1: "38",
|
|
4218
|
-
x2: "68",
|
|
4219
|
-
y2: "38",
|
|
4220
|
-
stroke: "currentColor",
|
|
4221
|
-
strokeWidth: "1",
|
|
4222
|
-
opacity: "0.4",
|
|
4223
|
-
strokeLinecap: "round"
|
|
4224
|
-
}
|
|
4225
|
-
),
|
|
4226
|
-
/* @__PURE__ */ t("circle", { cx: "31", cy: "44", r: "1", fill: "currentColor", opacity: "0.6" }),
|
|
4227
|
-
/* @__PURE__ */ t(
|
|
4228
|
-
"line",
|
|
4229
|
-
{
|
|
4230
|
-
x1: "35",
|
|
4231
|
-
y1: "44",
|
|
4232
|
-
x2: "74",
|
|
4233
|
-
y2: "44",
|
|
4234
|
-
stroke: "currentColor",
|
|
4235
|
-
strokeWidth: "1",
|
|
4236
|
-
opacity: "0.4",
|
|
4237
|
-
strokeLinecap: "round"
|
|
4238
|
-
}
|
|
4239
|
-
),
|
|
4240
|
-
/* @__PURE__ */ t(
|
|
4241
|
-
"rect",
|
|
4242
|
-
{
|
|
4243
|
-
x: "30",
|
|
4244
|
-
y: "64",
|
|
4245
|
-
width: "5",
|
|
4246
|
-
height: "8",
|
|
4247
|
-
rx: "0.5",
|
|
4248
|
-
fill: "currentColor",
|
|
4249
|
-
opacity: "0.55"
|
|
4250
|
-
}
|
|
4251
|
-
),
|
|
4252
|
-
/* @__PURE__ */ t(
|
|
4253
|
-
"rect",
|
|
4254
|
-
{
|
|
4255
|
-
x: "38",
|
|
4256
|
-
y: "60",
|
|
4257
|
-
width: "5",
|
|
4258
|
-
height: "12",
|
|
4259
|
-
rx: "0.5",
|
|
4260
|
-
fill: "currentColor",
|
|
4261
|
-
opacity: "0.7"
|
|
4262
|
-
}
|
|
4263
|
-
),
|
|
4264
|
-
/* @__PURE__ */ t(
|
|
4265
|
-
"rect",
|
|
4266
|
-
{
|
|
4267
|
-
x: "46",
|
|
4268
|
-
y: "56",
|
|
4269
|
-
width: "5",
|
|
4270
|
-
height: "16",
|
|
4271
|
-
rx: "0.5",
|
|
4272
|
-
fill: "currentColor",
|
|
4273
|
-
opacity: "0.85"
|
|
4274
|
-
}
|
|
4275
|
-
),
|
|
4276
|
-
/* @__PURE__ */ t(
|
|
4277
|
-
"rect",
|
|
4278
|
-
{
|
|
4279
|
-
x: "54",
|
|
4280
|
-
y: "62",
|
|
4281
|
-
width: "5",
|
|
4282
|
-
height: "10",
|
|
4283
|
-
rx: "0.5",
|
|
4284
|
-
fill: "currentColor",
|
|
4285
|
-
opacity: "0.6"
|
|
4286
|
-
}
|
|
4287
|
-
),
|
|
4288
|
-
/* @__PURE__ */ t(
|
|
4289
|
-
"rect",
|
|
4290
|
-
{
|
|
4291
|
-
x: "62",
|
|
4292
|
-
y: "58",
|
|
4293
|
-
width: "5",
|
|
4294
|
-
height: "14",
|
|
4295
|
-
rx: "0.5",
|
|
4296
|
-
fill: "currentColor",
|
|
4297
|
-
opacity: "0.75"
|
|
4298
|
-
}
|
|
4299
|
-
),
|
|
4300
|
-
/* @__PURE__ */ t(
|
|
4301
|
-
"circle",
|
|
4302
|
-
{
|
|
4303
|
-
cx: "86",
|
|
4304
|
-
cy: "62",
|
|
4305
|
-
r: "10",
|
|
4306
|
-
className: "fill-background",
|
|
4307
|
-
stroke: "currentColor",
|
|
4308
|
-
strokeWidth: "1.25"
|
|
4309
|
-
}
|
|
4310
|
-
),
|
|
4311
|
-
/* @__PURE__ */ t(
|
|
4312
|
-
"line",
|
|
4313
|
-
{
|
|
4314
|
-
x1: "93.5",
|
|
4315
|
-
y1: "69.5",
|
|
4316
|
-
x2: "100",
|
|
4317
|
-
y2: "76",
|
|
4318
|
-
stroke: "currentColor",
|
|
4319
|
-
strokeWidth: "1.5",
|
|
4320
|
-
strokeLinecap: "round"
|
|
4321
|
-
}
|
|
4322
|
-
)
|
|
4323
|
-
]
|
|
4324
|
-
}
|
|
4325
|
-
);
|
|
4326
|
-
}
|
|
4327
|
-
function hi({
|
|
4328
|
-
briefing: e,
|
|
4329
|
-
isOpening: a,
|
|
4330
|
-
isBusy: r,
|
|
4331
|
-
onOpen: n,
|
|
4332
|
-
onRunNow: i,
|
|
4333
|
-
onTogglePause: o,
|
|
4334
|
-
onDelete: l
|
|
4335
|
-
}) {
|
|
4336
|
-
const h = e.status === "PAUSED", d = e.hasActiveRun, c = ii(e), u = ri(e.lastRunAt), p = e.lastRunStatus, m = pe(e), f = p === "SUCCESS" ? Xe.success.dot : p === "FAILED" ? Xe.danger.dot : p ? Xe.warning.dot : Xe.neutral.dot;
|
|
4337
|
-
return /* @__PURE__ */ s(
|
|
4338
|
-
"div",
|
|
4339
|
-
{
|
|
4340
|
-
className: J(
|
|
4341
|
-
"group relative border-b border-border/60 px-4 py-3 transition-colors hover:bg-muted/60",
|
|
4342
|
-
h && "opacity-70"
|
|
4343
|
-
),
|
|
4344
|
-
children: [
|
|
4345
|
-
/* @__PURE__ */ s(
|
|
4346
|
-
"div",
|
|
4347
|
-
{
|
|
4348
|
-
role: "button",
|
|
4349
|
-
tabIndex: 0,
|
|
4350
|
-
onClick: n,
|
|
4351
|
-
onKeyDown: (g) => {
|
|
4352
|
-
(g.key === "Enter" || g.key === " ") && (g.preventDefault(), n());
|
|
4353
|
-
},
|
|
4354
|
-
className: "cursor-pointer pr-8",
|
|
4355
|
-
children: [
|
|
4356
|
-
/* @__PURE__ */ s("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
4357
|
-
/* @__PURE__ */ t("span", { className: "truncate text-[13px] font-medium text-foreground", children: e.name }),
|
|
4358
|
-
h ? /* @__PURE__ */ t("span", { className: "shrink-0 text-[11px] text-muted-foreground", children: "· Paused" }) : null
|
|
4359
|
-
] }),
|
|
4360
|
-
/* @__PURE__ */ s("div", { className: "mt-1 flex flex-wrap items-center gap-x-1.5 text-[11px] text-muted-foreground", children: [
|
|
4361
|
-
/* @__PURE__ */ t("span", { children: m.typeLabel }),
|
|
4362
|
-
/* @__PURE__ */ t("span", { className: "text-border", children: "·" }),
|
|
4363
|
-
/* @__PURE__ */ t("span", { children: oi(e) }),
|
|
4364
|
-
/* @__PURE__ */ t("span", { className: "text-border", children: "·" }),
|
|
4365
|
-
/* @__PURE__ */ t(_n, { className: "h-3 w-3" }),
|
|
4366
|
-
/* @__PURE__ */ t("span", { className: "truncate", children: si(e) }),
|
|
4367
|
-
e.lastRunAt ? /* @__PURE__ */ s($, { children: [
|
|
4368
|
-
/* @__PURE__ */ t("span", { className: "text-border", children: "·" }),
|
|
4369
|
-
/* @__PURE__ */ s("span", { children: [
|
|
4370
|
-
"Last run ",
|
|
4371
|
-
u
|
|
4372
|
-
] })
|
|
4373
|
-
] }) : null
|
|
4374
|
-
] }),
|
|
4375
|
-
c || d ? /* @__PURE__ */ s("div", { className: "mt-1.5 flex items-center gap-1.5 text-[12px] leading-[1.5] text-foreground/80", children: [
|
|
4376
|
-
d ? /* @__PURE__ */ t(de, { className: "h-3 w-3 shrink-0 animate-spin text-muted-foreground/70" }) : /* @__PURE__ */ t(
|
|
4377
|
-
"span",
|
|
4378
|
-
{
|
|
4379
|
-
className: J(
|
|
4380
|
-
"inline-block h-1.5 w-1.5 shrink-0 rounded-full",
|
|
4381
|
-
f
|
|
4382
|
-
)
|
|
4383
|
-
}
|
|
4384
|
-
),
|
|
4385
|
-
/* @__PURE__ */ t("span", { className: "truncate", children: d ? Ta(e) : c })
|
|
4386
|
-
] }) : null
|
|
4387
|
-
]
|
|
4388
|
-
}
|
|
4389
|
-
),
|
|
4390
|
-
/* @__PURE__ */ t("div", { className: "absolute right-3 top-3", children: r ? /* @__PURE__ */ t(de, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground/70" }) : a ? /* @__PURE__ */ t(de, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground/70" }) : /* @__PURE__ */ s(je, { children: [
|
|
4391
|
-
/* @__PURE__ */ t(qe, { asChild: !0, children: /* @__PURE__ */ t(
|
|
4392
|
-
"button",
|
|
4393
|
-
{
|
|
4394
|
-
type: "button",
|
|
4395
|
-
onClick: (g) => g.stopPropagation(),
|
|
4396
|
-
className: "inline-flex h-6 w-6 items-center justify-center rounded-control text-muted-foreground/70 opacity-60 hover:bg-muted hover:text-foreground/80 focus-visible:opacity-100 group-hover:opacity-100",
|
|
4397
|
-
"aria-label": `${m.noun === "report" ? "Report" : "Briefing"} actions`,
|
|
4398
|
-
children: /* @__PURE__ */ t(ha, { className: "h-3.5 w-3.5" })
|
|
4399
|
-
}
|
|
4400
|
-
) }),
|
|
4401
|
-
/* @__PURE__ */ s(We, { align: "end", className: "w-44", children: [
|
|
4402
|
-
/* @__PURE__ */ s(re, { onClick: n, children: [
|
|
4403
|
-
/* @__PURE__ */ t(Bt, { className: "h-3.5 w-3.5" }),
|
|
4404
|
-
"Edit ",
|
|
4405
|
-
m.noun
|
|
4406
|
-
] }),
|
|
4407
|
-
/* @__PURE__ */ s(
|
|
4408
|
-
re,
|
|
4409
|
-
{
|
|
4410
|
-
onClick: (g) => {
|
|
4411
|
-
g.preventDefault(), i();
|
|
4412
|
-
},
|
|
4413
|
-
children: [
|
|
4414
|
-
/* @__PURE__ */ t(On, { className: "h-3.5 w-3.5" }),
|
|
4415
|
-
"Run now"
|
|
4416
|
-
]
|
|
4417
|
-
}
|
|
4418
|
-
),
|
|
4419
|
-
e.scheduleExpr ? /* @__PURE__ */ t(
|
|
4420
|
-
re,
|
|
4421
|
-
{
|
|
4422
|
-
onClick: (g) => {
|
|
4423
|
-
g.preventDefault(), o();
|
|
4424
|
-
},
|
|
4425
|
-
children: h ? /* @__PURE__ */ s($, { children: [
|
|
4426
|
-
/* @__PURE__ */ t(zn, { className: "h-3.5 w-3.5" }),
|
|
4427
|
-
"Resume"
|
|
4428
|
-
] }) : /* @__PURE__ */ s($, { children: [
|
|
4429
|
-
/* @__PURE__ */ t(Rn, { className: "h-3.5 w-3.5" }),
|
|
4430
|
-
"Pause"
|
|
4431
|
-
] })
|
|
4432
|
-
}
|
|
4433
|
-
) : null,
|
|
4434
|
-
/* @__PURE__ */ t(at, {}),
|
|
4435
|
-
/* @__PURE__ */ s(
|
|
4436
|
-
re,
|
|
4437
|
-
{
|
|
4438
|
-
onClick: (g) => {
|
|
4439
|
-
g.preventDefault(), l();
|
|
4440
|
-
},
|
|
4441
|
-
className: "text-destructive focus:bg-destructive/10 focus:text-destructive",
|
|
4442
|
-
children: [
|
|
4443
|
-
/* @__PURE__ */ t(tt, { className: "h-3.5 w-3.5" }),
|
|
4444
|
-
"Delete ",
|
|
4445
|
-
m.noun
|
|
4446
|
-
]
|
|
4447
|
-
}
|
|
4448
|
-
)
|
|
4449
|
-
] })
|
|
4450
|
-
] }) })
|
|
4451
|
-
]
|
|
4452
|
-
}
|
|
4453
|
-
);
|
|
4454
|
-
}
|
|
4455
|
-
function mi(e) {
|
|
4456
|
-
return (e == null ? void 0 : e.trim()) || "This dashboard";
|
|
4457
|
-
}
|
|
4458
|
-
function pi(e) {
|
|
4459
|
-
return e === "This dashboard" ? "Watch this dashboard" : `Watch ${e}`;
|
|
4460
|
-
}
|
|
4461
|
-
function fi(e, a, r) {
|
|
4462
|
-
return a !== "dashboard" ? e : e.filter(
|
|
4463
|
-
(n) => n.source.type === "dashboard" && n.source.dashboardId === r
|
|
4464
|
-
);
|
|
4465
|
-
}
|
|
4466
|
-
async function gi(e) {
|
|
4467
|
-
const r = [];
|
|
4468
|
-
let n = 1, i = 0, o = Number.POSITIVE_INFINITY;
|
|
4469
|
-
for (; i < o; ) {
|
|
4470
|
-
const l = await e.apiClient.listBriefings(
|
|
4471
|
-
e.apiServiceUrl,
|
|
4472
|
-
e.token,
|
|
4473
|
-
{ scope: "organization", page: n, pageSize: 100 }
|
|
4474
|
-
);
|
|
4475
|
-
if (r.push(...l.briefings), i += l.briefings.length, o = l.total, l.briefings.length === 0 || i >= o) break;
|
|
4476
|
-
n += 1;
|
|
4477
|
-
}
|
|
4478
|
-
return r;
|
|
4479
|
-
}
|
|
4480
|
-
const bi = {
|
|
4481
|
-
listBriefings: Kn,
|
|
4482
|
-
getBriefing: Hn,
|
|
4483
|
-
pauseBriefing: Qn,
|
|
4484
|
-
resumeBriefing: Wn,
|
|
4485
|
-
deleteBriefing: qn,
|
|
4486
|
-
runBriefingNow: jn
|
|
4487
|
-
};
|
|
4488
|
-
function so(e) {
|
|
4489
|
-
return /* @__PURE__ */ t(Mn, { authToken: e.token ? { accessToken: e.token } : void 0, children: /* @__PURE__ */ t(Un, { children: /* @__PURE__ */ t(xi, { ...e }) }) });
|
|
4490
|
-
}
|
|
4491
|
-
function xi({
|
|
4492
|
-
dashboardId: e,
|
|
4493
|
-
dashboardTitle: a,
|
|
4494
|
-
apiServiceUrl: r,
|
|
4495
|
-
token: n,
|
|
4496
|
-
disabled: i,
|
|
4497
|
-
className: o,
|
|
4498
|
-
manageBriefingsHref: l,
|
|
4499
|
-
open: h,
|
|
4500
|
-
onOpenChange: d,
|
|
4501
|
-
hideTrigger: c = !1,
|
|
4502
|
-
workflowIntent: u,
|
|
4503
|
-
openRun: p,
|
|
4504
|
-
client: m
|
|
4505
|
-
}) {
|
|
4506
|
-
const { authToken: f, tokenProps: g } = $e(), y = $n(), w = !u || y.canCreate && (u === "scheduled_report" || y.analyticalBriefingsEnabled), [S, V] = E(!1), P = h ?? S, D = (F) => {
|
|
4507
|
-
h === void 0 && V(F), d == null || d(F);
|
|
4508
|
-
}, [B, k] = E(
|
|
4509
|
-
u ? "author" : "list"
|
|
4510
|
-
), [v, b] = E(
|
|
4511
|
-
u ?? "analytical_briefing"
|
|
4512
|
-
), [_, A] = E("dashboard"), [G, T] = E(
|
|
4513
|
-
[]
|
|
4514
|
-
), [M, X] = E(null), O = u && !w && !M ? "list" : B, [te, Z] = E(!1), [K, I] = E(null), [ae, q] = E(null), [R, ne] = E(
|
|
4515
|
-
null
|
|
4516
|
-
), [ue, he] = E(null), ye = et(null), x = et(P);
|
|
4517
|
-
Ee(() => {
|
|
4518
|
-
const F = P && !x.current;
|
|
4519
|
-
x.current = P, !(!F || !u) && (X(null), A("dashboard"), b(u), k("author"), he(null));
|
|
4520
|
-
}, [P, u]);
|
|
4521
|
-
const U = Vt(), j = r ?? (g == null ? void 0 : g.apiServiceUrl), H = n ?? (f == null ? void 0 : f.accessToken), le = Y(() => ({ ...bi, ...m }), [m]), [_e, ht] = E(null);
|
|
4522
|
-
Ee(() => {
|
|
4523
|
-
if (!p || !j || !H) return;
|
|
4524
|
-
let F = !0;
|
|
4525
|
-
return le.getBriefing(j, H, p.briefingId).then(({ briefing: Q }) => {
|
|
4526
|
-
F && (X(Q), ht(p), k("author"));
|
|
4527
|
-
}, (Q) => {
|
|
4528
|
-
F && z.error(Q instanceof Error ? Q.message : "Could not open the run.");
|
|
4529
|
-
}), () => {
|
|
4530
|
-
F = !1;
|
|
4531
|
-
};
|
|
4532
|
-
}, [p, j, H, le]);
|
|
4533
|
-
const Fe = mi(a), Ke = Y(() => {
|
|
4534
|
-
const F = fi(
|
|
4535
|
-
G,
|
|
4536
|
-
_,
|
|
4537
|
-
e
|
|
4538
|
-
);
|
|
4539
|
-
if (!u)
|
|
4540
|
-
return F;
|
|
4541
|
-
const Q = u === "scheduled_report" ? "report" : "briefing";
|
|
4542
|
-
return F.filter(
|
|
4543
|
-
(Ge) => pe(Ge).noun === Q
|
|
4544
|
-
);
|
|
4545
|
-
}, [e, G, _, u]), mt = Y(() => _ === "dashboard" ? {
|
|
4546
|
-
source: { type: "dashboard", dashboardId: e },
|
|
4547
|
-
label: Fe,
|
|
4548
|
-
detail: pi(Fe)
|
|
4549
|
-
} : {
|
|
4550
|
-
source: { type: "project" },
|
|
4551
|
-
label: "This project",
|
|
4552
|
-
detail: "Use any data in this project."
|
|
4553
|
-
}, [e, Fe, _]), Oe = !!(j && H), ze = Wr({
|
|
4554
|
-
canCreate: y.canCreate,
|
|
4555
|
-
analyticalBriefingsEnabled: y.analyticalBriefingsEnabled,
|
|
4556
|
-
scheduledReportAvailable: _ === "dashboard"
|
|
4557
|
-
}), ce = ie(async () => {
|
|
4558
|
-
if (!(!j || !H)) {
|
|
4559
|
-
Z(!0), he(null);
|
|
4560
|
-
try {
|
|
4561
|
-
T(
|
|
4562
|
-
await gi({
|
|
4563
|
-
apiClient: le,
|
|
4564
|
-
apiServiceUrl: j,
|
|
4565
|
-
token: H
|
|
4566
|
-
})
|
|
4567
|
-
);
|
|
4568
|
-
} catch (F) {
|
|
4569
|
-
he(
|
|
4570
|
-
F instanceof Error ? F.message : "Could not load briefings."
|
|
4571
|
-
);
|
|
4572
|
-
} finally {
|
|
4573
|
-
Z(!1);
|
|
4574
|
-
}
|
|
4575
|
-
}
|
|
4576
|
-
}, [le, j, H]);
|
|
4577
|
-
Ee(() => {
|
|
4578
|
-
!P || O !== "list" || !Oe || ce();
|
|
4579
|
-
}, [Oe, O, ce, P]);
|
|
4580
|
-
const Re = () => {
|
|
4581
|
-
X(null), A("dashboard"), k("list"), D(!0);
|
|
4582
|
-
}, N = (F) => {
|
|
4583
|
-
X(null), b(F), k("author");
|
|
4584
|
-
}, W = async (F) => {
|
|
4585
|
-
if (!(!j || !H)) {
|
|
4586
|
-
I(F), he(null);
|
|
4587
|
-
try {
|
|
4588
|
-
const Q = await le.getBriefing(
|
|
4589
|
-
j,
|
|
4590
|
-
H,
|
|
4591
|
-
F
|
|
4592
|
-
);
|
|
4593
|
-
X(Q.briefing), k("author");
|
|
4594
|
-
} catch (Q) {
|
|
4595
|
-
he(
|
|
4596
|
-
Q instanceof Error ? Q.message : "Could not open briefing."
|
|
4597
|
-
);
|
|
4598
|
-
} finally {
|
|
4599
|
-
I(null);
|
|
4600
|
-
}
|
|
4601
|
-
}
|
|
4602
|
-
}, ee = async (F) => {
|
|
4603
|
-
if (!(!j || !H)) {
|
|
4604
|
-
q(F.id);
|
|
4605
|
-
try {
|
|
4606
|
-
const Q = await le.runBriefingNow(
|
|
4607
|
-
j,
|
|
4608
|
-
H,
|
|
4609
|
-
F.id,
|
|
4610
|
-
{ requestId: vi() }
|
|
4611
|
-
);
|
|
4612
|
-
U.track({ kind: "briefing", id: Q.run.id, title: F.name, briefingId: F.id }), ce();
|
|
4613
|
-
} catch (Q) {
|
|
4614
|
-
z.error(
|
|
4615
|
-
Q instanceof Error ? Q.message : "Could not start the run."
|
|
4616
|
-
);
|
|
4617
|
-
} finally {
|
|
4618
|
-
q(null);
|
|
4619
|
-
}
|
|
4620
|
-
}
|
|
4621
|
-
}, me = async (F) => {
|
|
4622
|
-
if (!j || !H) return;
|
|
4623
|
-
const { noun: Q } = pe(F), Ge = Q === "report" ? "Report" : "Briefing";
|
|
4624
|
-
q(F.id);
|
|
4625
|
-
try {
|
|
4626
|
-
const Ye = F.status === "PAUSED" ? await le.resumeBriefing(
|
|
4627
|
-
j,
|
|
4628
|
-
H,
|
|
4629
|
-
F.id
|
|
4630
|
-
) : await le.pauseBriefing(
|
|
4631
|
-
j,
|
|
4632
|
-
H,
|
|
4633
|
-
F.id
|
|
4634
|
-
);
|
|
4635
|
-
z.success(
|
|
4636
|
-
Ye.briefing.status === "PAUSED" ? `${Ge} paused` : `${Ge} resumed`
|
|
4637
|
-
), ce();
|
|
4638
|
-
} catch (Ye) {
|
|
4639
|
-
z.error(
|
|
4640
|
-
Ye instanceof Error ? Ye.message : `Could not update the ${Q} status.`
|
|
4641
|
-
);
|
|
4642
|
-
} finally {
|
|
4643
|
-
q(null);
|
|
4644
|
-
}
|
|
4645
|
-
}, Ce = async () => {
|
|
4646
|
-
if (!R || !j || !H) return;
|
|
4647
|
-
const F = R;
|
|
4648
|
-
q(F.id);
|
|
4649
|
-
try {
|
|
4650
|
-
await le.deleteBriefing(
|
|
4651
|
-
j,
|
|
4652
|
-
H,
|
|
4653
|
-
F.id
|
|
4654
|
-
);
|
|
4655
|
-
const { noun: Q } = pe(F);
|
|
4656
|
-
z.success(`${Q === "report" ? "Report" : "Briefing"} deleted`), ne(null), ce();
|
|
4657
|
-
} catch (Q) {
|
|
4658
|
-
z.error(
|
|
4659
|
-
Q instanceof Error ? Q.message : "Could not delete the briefing."
|
|
4660
|
-
);
|
|
4661
|
-
} finally {
|
|
4662
|
-
q(null);
|
|
4663
|
-
}
|
|
4664
|
-
}, La = Ke.length;
|
|
4665
|
-
return y.surfaceVisible ? /* @__PURE__ */ s(Gn, { open: P, onOpenChange: D, children: [
|
|
4666
|
-
c ? null : /* @__PURE__ */ t(
|
|
4667
|
-
ti,
|
|
4668
|
-
{
|
|
4669
|
-
disabled: i || !Oe,
|
|
4670
|
-
briefingCount: La,
|
|
4671
|
-
className: o,
|
|
4672
|
-
onClick: Re
|
|
4673
|
-
}
|
|
4674
|
-
),
|
|
4675
|
-
/* @__PURE__ */ s(
|
|
4676
|
-
Yn,
|
|
4677
|
-
{
|
|
4678
|
-
ref: ye,
|
|
4679
|
-
side: "right",
|
|
4680
|
-
hideClose: !0,
|
|
4681
|
-
className: "flex h-full w-full flex-col overflow-hidden p-0 outline-none sm:max-w-[560px]",
|
|
4682
|
-
onOpenAutoFocus: (F) => {
|
|
4683
|
-
var Q;
|
|
4684
|
-
F.preventDefault(), (Q = ye.current) == null || Q.focus({ preventScroll: !0 });
|
|
4685
|
-
},
|
|
4686
|
-
children: [
|
|
4687
|
-
/* @__PURE__ */ s(Xn, { className: "sr-only", children: [
|
|
4688
|
-
/* @__PURE__ */ t(Jn, { children: "Reports & briefings" }),
|
|
4689
|
-
/* @__PURE__ */ t(Zn, { children: "Manage reports and briefings for this dashboard." })
|
|
4690
|
-
] }),
|
|
4691
|
-
u ? /* @__PURE__ */ s("div", { className: "flex shrink-0 items-start justify-between gap-3 border-b border-border pl-4 pr-3 pt-2", children: [
|
|
4692
|
-
/* @__PURE__ */ s(
|
|
4693
|
-
"div",
|
|
4694
|
-
{
|
|
4695
|
-
className: "flex items-center gap-5",
|
|
4696
|
-
role: "tablist",
|
|
4697
|
-
"aria-label": u === "scheduled_report" ? "Email report workflow" : "Analytical briefing workflow",
|
|
4698
|
-
children: [
|
|
4699
|
-
/* @__PURE__ */ t(
|
|
4700
|
-
"button",
|
|
4701
|
-
{
|
|
4702
|
-
type: "button",
|
|
4703
|
-
role: "tab",
|
|
4704
|
-
"aria-selected": O === "author",
|
|
4705
|
-
disabled: !w,
|
|
4706
|
-
className: J(
|
|
4707
|
-
"-mb-px border-b-2 px-0.5 pb-2 text-[12px] transition-colors",
|
|
4708
|
-
O === "author" ? "border-foreground font-medium text-foreground" : "border-transparent text-muted-foreground hover:text-foreground",
|
|
4709
|
-
!w && "cursor-not-allowed opacity-50"
|
|
4710
|
-
),
|
|
4711
|
-
onClick: () => {
|
|
4712
|
-
w && (X(null), b(u), A("dashboard"), k("author"));
|
|
4713
|
-
},
|
|
4714
|
-
children: M ? `Edit ${pe(M).noun}` : u === "scheduled_report" ? "Schedule report" : "Create briefing"
|
|
4715
|
-
}
|
|
4716
|
-
),
|
|
4717
|
-
/* @__PURE__ */ t(
|
|
4718
|
-
"button",
|
|
4719
|
-
{
|
|
4720
|
-
type: "button",
|
|
4721
|
-
role: "tab",
|
|
4722
|
-
"aria-selected": O === "list",
|
|
4723
|
-
className: J(
|
|
4724
|
-
"-mb-px border-b-2 px-0.5 pb-2 text-[12px] transition-colors",
|
|
4725
|
-
O === "list" ? "border-foreground font-medium text-foreground" : "border-transparent text-muted-foreground hover:text-foreground"
|
|
4726
|
-
),
|
|
4727
|
-
onClick: () => k("list"),
|
|
4728
|
-
children: u === "scheduled_report" ? "Manage reports" : "Manage briefings"
|
|
4729
|
-
}
|
|
4730
|
-
)
|
|
4731
|
-
]
|
|
4732
|
-
}
|
|
4733
|
-
),
|
|
4734
|
-
/* @__PURE__ */ t(
|
|
4735
|
-
"button",
|
|
4736
|
-
{
|
|
4737
|
-
type: "button",
|
|
4738
|
-
onClick: () => D(!1),
|
|
4739
|
-
className: "rounded-control p-1 text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
4740
|
-
"aria-label": u === "scheduled_report" ? "Close email report workflow" : "Close analytical briefing workflow",
|
|
4741
|
-
children: /* @__PURE__ */ t(Qe, { className: "h-3.5 w-3.5" })
|
|
4742
|
-
}
|
|
4743
|
-
)
|
|
4744
|
-
] }) : null,
|
|
4745
|
-
O === "list" ? /* @__PURE__ */ t(
|
|
4746
|
-
di,
|
|
4747
|
-
{
|
|
4748
|
-
briefings: Ke,
|
|
4749
|
-
dashboardLabel: Fe,
|
|
4750
|
-
sourceView: _,
|
|
4751
|
-
error: ue,
|
|
4752
|
-
loading: te,
|
|
4753
|
-
onSourceViewChange: A,
|
|
4754
|
-
onClose: () => D(!1),
|
|
4755
|
-
onEdit: (F) => {
|
|
4756
|
-
W(F);
|
|
4757
|
-
},
|
|
4758
|
-
onNew: N,
|
|
4759
|
-
canCreate: !u && ze.length > 0,
|
|
4760
|
-
canCreateScheduledReport: ze.includes(
|
|
4761
|
-
"scheduled_report"
|
|
4762
|
-
),
|
|
4763
|
-
analyticalBriefingsEnabled: ze.includes(
|
|
4764
|
-
"analytical_briefing"
|
|
4765
|
-
),
|
|
4766
|
-
onRunNow: (F) => {
|
|
4767
|
-
ee(F);
|
|
4768
|
-
},
|
|
4769
|
-
onTogglePause: (F) => {
|
|
4770
|
-
me(F);
|
|
4771
|
-
},
|
|
4772
|
-
onDelete: (F) => ne(F),
|
|
4773
|
-
selectingId: K,
|
|
4774
|
-
busyId: ae,
|
|
4775
|
-
manageBriefingsHref: l,
|
|
4776
|
-
contentKind: u === "scheduled_report" ? "reports" : u === "analytical_briefing" ? "briefings" : void 0,
|
|
4777
|
-
hideHeader: !!u
|
|
4778
|
-
}
|
|
4779
|
-
) : /* @__PURE__ */ t(
|
|
4780
|
-
er,
|
|
4781
|
-
{
|
|
4782
|
-
apiServiceUrl: j,
|
|
4783
|
-
token: H,
|
|
4784
|
-
briefing: M,
|
|
4785
|
-
initialRunId: _e && (M == null ? void 0 : M.id) === _e.briefingId ? _e.runId : void 0,
|
|
4786
|
-
intent: v,
|
|
4787
|
-
sourceContext: M ? void 0 : mt,
|
|
4788
|
-
title: M ? `Edit ${pe(M).noun}` : v === "scheduled_report" ? "Schedule report" : "Create analytical briefing",
|
|
4789
|
-
hideHeader: !!u,
|
|
4790
|
-
className: "h-full min-h-0 max-w-none border-0 shadow-none",
|
|
4791
|
-
onBack: u ? void 0 : () => k("list"),
|
|
4792
|
-
onCancel: () => D(!1),
|
|
4793
|
-
onDeleted: () => {
|
|
4794
|
-
const F = M ? pe(M).noun : "briefing";
|
|
4795
|
-
z.success(`${F === "report" ? "Report" : "Briefing"} deleted`), X(null), k("list"), ce();
|
|
4796
|
-
},
|
|
4797
|
-
onRunStarted: () => {
|
|
4798
|
-
},
|
|
4799
|
-
onSaved: (F) => {
|
|
4800
|
-
X(F), ce();
|
|
4801
|
-
},
|
|
4802
|
-
onMinimizeRun: () => {
|
|
4803
|
-
D(!1);
|
|
4804
|
-
}
|
|
4805
|
-
}
|
|
4806
|
-
)
|
|
4807
|
-
]
|
|
4808
|
-
}
|
|
4809
|
-
),
|
|
4810
|
-
/* @__PURE__ */ t(
|
|
4811
|
-
St,
|
|
4812
|
-
{
|
|
4813
|
-
open: !!R,
|
|
4814
|
-
onOpenChange: (F) => {
|
|
4815
|
-
F || ne(null);
|
|
4816
|
-
},
|
|
4817
|
-
children: /* @__PURE__ */ s(kt, { children: [
|
|
4818
|
-
/* @__PURE__ */ s(Dt, { children: [
|
|
4819
|
-
/* @__PURE__ */ s(At, { children: [
|
|
4820
|
-
"Delete",
|
|
4821
|
-
" ",
|
|
4822
|
-
R ? pe(R).noun : "briefing",
|
|
4823
|
-
"?"
|
|
4824
|
-
] }),
|
|
4825
|
-
/* @__PURE__ */ s(Ft, { children: [
|
|
4826
|
-
"This permanently deletes ",
|
|
4827
|
-
/* @__PURE__ */ t("strong", { children: R == null ? void 0 : R.name }),
|
|
4828
|
-
". Recipients will stop receiving it."
|
|
4829
|
-
] })
|
|
4830
|
-
] }),
|
|
4831
|
-
/* @__PURE__ */ s(Et, { children: [
|
|
4832
|
-
/* @__PURE__ */ t(It, { children: "Cancel" }),
|
|
4833
|
-
/* @__PURE__ */ s(
|
|
4834
|
-
ua,
|
|
4835
|
-
{
|
|
4836
|
-
className: "bg-destructive/90 hover:bg-destructive",
|
|
4837
|
-
onClick: Ce,
|
|
4838
|
-
children: [
|
|
4839
|
-
"Delete",
|
|
4840
|
-
" ",
|
|
4841
|
-
R ? pe(R).noun : "briefing"
|
|
4842
|
-
]
|
|
4843
|
-
}
|
|
4844
|
-
)
|
|
4845
|
-
] })
|
|
4846
|
-
] })
|
|
4847
|
-
}
|
|
4848
|
-
)
|
|
4849
|
-
] }) : null;
|
|
4850
|
-
}
|
|
4851
|
-
function vi() {
|
|
4852
|
-
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `briefing-run-now-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
4853
|
-
}
|
|
4854
|
-
export {
|
|
4855
|
-
Hi as A,
|
|
4856
|
-
Yi as D,
|
|
4857
|
-
Gi as S,
|
|
4858
|
-
Ji as U,
|
|
4859
|
-
qi as V,
|
|
4860
|
-
ti as W,
|
|
4861
|
-
Qi as a,
|
|
4862
|
-
Ki as b,
|
|
4863
|
-
Xi as c,
|
|
4864
|
-
eo as d,
|
|
4865
|
-
gs as e,
|
|
4866
|
-
xs as f,
|
|
4867
|
-
ws as g,
|
|
4868
|
-
to as h,
|
|
4869
|
-
Zi as i,
|
|
4870
|
-
no as j,
|
|
4871
|
-
ao as k,
|
|
4872
|
-
ro as l,
|
|
4873
|
-
so as m,
|
|
4874
|
-
Wi as u
|
|
4875
|
-
};
|