react-semaphor 0.1.544 → 0.1.546
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/analytics-protocol/index.js +405 -441
- package/dist/assistant-context/index.js +1 -1
- package/dist/assistant-protocol/index.js +100 -76
- package/dist/brand-studio/index.js +5 -5
- package/dist/briefings/index.js +55 -52
- package/dist/chunks/{class-utils-Df1OVOT1.js → _commonjsHelpers-DimLPMtv.js} +124 -98
- package/dist/chunks/{add-to-dashboard-BuAqfA2Y.js → add-to-dashboard-BQRAAnc3.js} +55 -33
- package/dist/chunks/{analytics-base-schemas-BFAoRlkU.js → analytics-base-schemas-BKs3flFS.js} +2 -2
- package/dist/chunks/{assistant-chat-BNLkCDml.js → assistant-chat-BPXhulAx.js} +2792 -2562
- package/dist/chunks/{bookmark-state-CXw7lZ50.js → bookmark-state-C4vetoa0.js} +7 -8
- package/dist/chunks/column-catalog-BYnochWQ.js +3363 -0
- package/dist/chunks/comparison-window-caption-C2xF-eWw.js +1433 -0
- package/dist/chunks/{context-ClREvqCZ.js → context-BerEBuFR.js} +11 -6
- package/dist/chunks/custom-visual-inputs-CkJW9pBS.js +295 -0
- package/dist/chunks/{dashboard-g5a4DKWq.js → dashboard-C3CoKbGY.js} +1 -1
- package/dist/chunks/dashboard-briefing-launcher-Be4h-7My.js +3734 -0
- package/dist/chunks/dashboard-controls-bxPrlSyp.js +2307 -0
- package/dist/chunks/{dashboard-json-7qT9jmfL.js → dashboard-json-BrjxIiRt.js} +6 -6
- package/dist/chunks/document-dashboard-inputs-CRVHpIHp.js +3010 -0
- package/dist/chunks/{edit-dashboard-visual-BfJwnRIZ.js → edit-dashboard-visual-DYYYDjY6.js} +5986 -6063
- package/dist/chunks/{filter-value-text-CYsVYPuD.js → filter-value-text-Ddf55Ku1.js} +8 -8
- package/dist/chunks/global-date-filter-utils-9d6m9-FE.js +11859 -0
- package/dist/chunks/index-CtoK1Lgu.js +586 -0
- package/dist/chunks/{index-DkAyQvC6.js → index-DkQkMKa1.js} +385 -339
- package/dist/chunks/list-filter-DsaTbM3J.js +15 -0
- package/dist/chunks/matrix-analytical-definition-B9vW-osb.js +717 -0
- package/dist/chunks/{matrix-card-DjwWcCo8.js → matrix-card-LiMEipvq.js} +3 -3
- package/dist/chunks/{matrix-formatter-CxJLkztA.js → matrix-formatter-DWEeC0_c.js} +55 -55
- package/dist/chunks/{matrix-member-presentation-CQGdVks6.js → matrix-member-presentation-DqzG-UhQ.js} +1 -1
- package/dist/chunks/{matrix-operation-contract-8OIO4gob.js → matrix-operation-contract-D6vYkZK4.js} +72 -72
- package/dist/chunks/{metric-comparison-DEwi9uc2.js → metric-comparison-zpGw4lD6.js} +2 -2
- package/dist/chunks/normalize-dashboard-for-dirty-check-XKgH3GFX.js +119 -0
- package/dist/chunks/{pivot-header-presentation-DHcx1XGQ.js → pivot-header-presentation-CQnIDtUv.js} +1 -1
- package/dist/chunks/{pivot-result-identity-DJhXXcns.js → pivot-result-identity-C-Q1j1Wb.js} +1 -1
- package/dist/chunks/{pivot-result-lifecycle-DM4CyGKs.js → pivot-result-lifecycle-pwq3b7LC.js} +571 -380
- package/dist/chunks/{raw-temporal-contract-C51YG48G.js → raw-temporal-contract-WuXA8jBP.js} +1 -1
- package/dist/chunks/{raw-temporal-presentation-CLiVi90c.js → raw-temporal-presentation-CBzrDOjM.js} +8 -8
- package/dist/chunks/rendered-file-D8xEuVVx.js +108 -0
- package/dist/chunks/{report-preferences-dialog-Df7VpRVW.js → report-preferences-dialog-4QEZWe5U.js} +637 -610
- package/dist/chunks/{report-runtime-context-Dq8XyODK.js → report-runtime-context-hWiTCzFV.js} +2 -2
- package/dist/chunks/resolve-dashboard-input-context-UpK_LBpL.js +5677 -0
- package/dist/chunks/{saved-dashboard-context-B-mQ--nV.js → saved-dashboard-context-D_I3Lxk0.js} +184 -212
- package/dist/chunks/selection-filter-compiler-BKXmyLrS.js +79 -0
- package/dist/chunks/{selection-reducer-Dj_8xD69.js → selection-reducer-CJzkTZio.js} +15 -15
- package/dist/chunks/{semaphor-ready-indicator-DDAxk8us.js → semaphor-ready-indicator-4zpRHE-X.js} +56832 -59068
- package/dist/chunks/{shelf-drop-preview-context-BSRPwaED.js → shelf-drop-preview-context-Cfw7TRAx.js} +890 -871
- package/dist/chunks/{source-entity-resolution-BYn9giz3.js → source-entity-resolution-BIGRvtbG.js} +13 -13
- package/dist/chunks/{switch-C3jLxlG0.js → switch-CEBOR4n7.js} +47 -48
- package/dist/chunks/{table-export-sheet-CPfGAQ9X.js → table-export-sheet-4X9mAG3V.js} +1 -1
- package/dist/chunks/table-settings-CunhoDUi.js +605 -0
- package/dist/chunks/{temporal-bucket-D7NBrrtL.js → temporal-bucket-CQOSbv9-.js} +26 -26
- package/dist/chunks/{token-types-DBbZVQsm.js → token-types-BMqRmT-C.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-BxzFviM-.js → use-create-flow-overlay-state-DZBZiiD-.js} +83 -83
- package/dist/chunks/{validators-DMHTpf7a.js → validators-C-aOQlTB.js} +713 -658
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +1800 -1135
- package/dist/data-app-sdk/index.js +6 -6
- package/dist/data-app-sdk-adapters/index.js +3 -3
- package/dist/data-app-sdk-validation/index.js +14 -14
- package/dist/format-utils/index.js +198 -187
- package/dist/index.js +359 -325
- package/dist/layouts/index.js +5 -242
- package/dist/report-runtime-context/index.js +2 -2
- package/dist/shared/index.js +4 -5
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/briefings/attachment-outcomes.d.ts +1 -1
- package/dist/types/briefings/attachments.d.ts +33 -6
- package/dist/types/briefings/index.d.ts +6 -5
- package/dist/types/components/index.d.ts +2 -0
- package/dist/types/components/surfboard/arrange-layout-button.d.ts +8 -0
- package/dist/types/components/surfboard/filter/types.d.ts +0 -14
- package/dist/types/components/surfboard/screen-size-preview-button.d.ts +7 -0
- package/dist/types/index.js +6 -6
- package/dist/types/lib/charts/table-chart-types.d.ts +4 -0
- package/dist/types/lib/charts/types.d.ts +2 -2
- package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-authoring.d.ts +68 -82
- package/dist/types/lib/dashboard-inputs/dashboard-input-target-context.d.ts +0 -8
- package/dist/types/lib/dashboard-inputs/dashboard-input-values.d.ts +41 -1
- package/dist/types/lib/dashboard-inputs/filter-settings.d.ts +201 -0
- package/dist/types/lib/dashboard-inputs/prepare-loaded-dashboard.d.ts +15 -0
- package/dist/types/lib/dashboard-inputs/resolve-dashboard-input-context.d.ts +7 -2
- package/dist/types/lib/dashboard-inputs/resolve-selection-input.d.ts +1 -1
- package/dist/types/lib/dashboard-viewer/captured-runtime-values.d.ts +40 -0
- package/dist/types/lib/dashboard-viewer/compatibility-input-storage.d.ts +16 -16
- package/dist/types/lib/dashboard-viewer/viewer-state.d.ts +11 -9
- package/dist/types/lib/download-pdf.d.ts +75 -1
- package/dist/types/lib/hooks/use-date-filter.d.ts +5 -0
- package/dist/types/lib/hooks/use-text-filter.d.ts +5 -0
- package/dist/types/lib/matrix-table/matrix-delivery-policy.d.ts +5 -4
- package/dist/types/lib/matrix-table/matrix-editor.d.ts +52 -0
- package/dist/types/lib/query-context/assemble-card-query.d.ts +158 -0
- package/dist/types/lib/query-context/build-card-query-context.d.ts +3 -3
- package/dist/types/lib/query-context/build-dashboard-card-query-contract.d.ts +15 -6
- package/dist/types/lib/query-context/build-dashboard-execution-snapshot.d.ts +11 -13
- package/dist/types/lib/query-context/compile-dashboard-card-filters.d.ts +22 -12
- package/dist/types/lib/query-context/dashboard-filter-mapping-resolution.d.ts +69 -0
- package/dist/types/lib/stores/dashboard-store.d.ts +159 -56
- package/dist/types/lib/stores/editor-store.d.ts +0 -3
- package/dist/types/lib/types/common-types.d.ts +29 -6
- package/dist/types/lib/types/explorer-types.d.ts +10 -0
- package/dist/types/lib/types/semantic-types.d.ts +84 -0
- package/dist/types/lib/utils/build-saved-editor-card.d.ts +20 -0
- package/dist/types/lib/utils/card-type-change.d.ts +16 -0
- package/dist/types/lib/utils/field-availability-context.d.ts +25 -0
- package/dist/types/lib/utils/field-placement.d.ts +96 -0
- package/dist/types/lib/utils/field-state-calculator.d.ts +161 -0
- package/dist/types/lib/utils/qualified-entity-name.d.ts +2 -0
- package/dist/types/shared/analytics-protocol/field-provenance.d.ts +89 -0
- package/dist/types/shared/analytics-protocol/index.d.ts +2 -0
- package/dist/types/shared/analytics-protocol/query-policies.d.ts +52 -0
- package/dist/types/shared/analytics-protocol/time-window-schema.d.ts +1 -1
- package/dist/types/shared/analytics-protocol/time-window.d.ts +40 -1
- package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +8 -12
- package/dist/types/shared/assistant-protocol/answer-text.d.ts +20 -0
- package/dist/types/shared/assistant-protocol/context.d.ts +21 -21
- package/dist/types/shared/assistant-protocol/index.d.ts +1 -0
- package/dist/types/shared/assistant-protocol/limits.d.ts +6 -1
- package/dist/types/shared/assistant-protocol/parts.d.ts +43 -3
- package/dist/types/shared/assistant-protocol/request.d.ts +14 -2
- package/dist/types/shared/dashboard-authoring/calculated-field-identity.d.ts +3 -0
- package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +487 -0
- package/dist/types/shared/dashboard-authoring/changes/card-types.d.ts +34 -0
- package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +7886 -0
- package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +43 -0
- package/dist/types/shared/dashboard-authoring/changes/read-card-query.d.ts +54 -0
- package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-changes.d.ts +89 -0
- package/dist/types/shared/dashboard-authoring/column-catalog.d.ts +32 -0
- package/dist/types/shared/dashboard-authoring/contracts.d.ts +0 -55
- package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +16 -6
- package/dist/types/shared/dashboard-authoring/dashboard-card-source-index.d.ts +9 -1
- package/dist/types/shared/dashboard-authoring/dashboard-filter-mapping-contract.d.ts +7 -0
- package/dist/types/shared/dashboard-authoring/dashboard-input-scope.d.ts +118 -0
- package/dist/types/shared/dashboard-authoring/filter-applicability.d.ts +75 -0
- package/dist/types/shared/dashboard-authoring/filter-model/ad-hoc-filter-values.d.ts +10 -0
- package/dist/types/shared/dashboard-authoring/filter-model/filter-definitions.d.ts +29 -0
- package/dist/types/shared/dashboard-authoring/filter-model/filter-values.d.ts +58 -0
- package/dist/types/shared/dashboard-authoring/filter-model/index.d.ts +7 -0
- package/dist/types/shared/dashboard-authoring/filter-model/prototype-document-inputs.d.ts +15 -0
- package/dist/types/shared/dashboard-authoring/filter-model/read-dashboard-filter-model.d.ts +78 -0
- package/dist/types/shared/dashboard-authoring/filter-model/stored-dashboard.d.ts +18 -0
- package/dist/types/shared/dashboard-authoring/filter-model/toolbar-filter-reach.d.ts +23 -0
- package/dist/types/shared/dashboard-authoring/index.d.ts +20 -2
- package/dist/types/shared/dashboard-authoring/operations/apply-dashboard-operations.d.ts +10 -37
- package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +189 -0
- package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +94 -0
- package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +78 -0
- package/dist/types/shared/dashboard-authoring/validators.d.ts +1 -2
- package/dist/types/shared/format-utils/exporters/index.d.ts +2 -0
- package/dist/types/shared/format-utils/exporters/rendered-file.d.ts +106 -0
- package/dist/types/shared/layouts/engine/grid.d.ts +25 -0
- package/dist/types/shared/layouts/engine/index.d.ts +4 -0
- package/dist/types/shared/layouts/engine/sheet-layout.d.ts +7 -0
- package/dist/types/shared/layouts/engine/types.d.ts +125 -0
- package/dist/types/shared/layouts/index.d.ts +1 -2
- package/package.json +2 -2
- package/dist/chunks/_commonjsHelpers-BkfeUUK-.js +0 -28
- package/dist/chunks/apply-dashboard-operations-Bz4n1Lq6.js +0 -2260
- package/dist/chunks/calendar-day-equality-BmJAWduY.js +0 -460
- package/dist/chunks/comparison-window-caption-BTkrN3W4.js +0 -1623
- package/dist/chunks/custom-visual-inputs-DUtpYZOk.js +0 -323
- package/dist/chunks/dashboard-briefing-launcher-DQ_8O_e2.js +0 -3725
- package/dist/chunks/dashboard-controls-8RyBTQUO.js +0 -2315
- package/dist/chunks/dashboard-filter-value-compatibility-CwQ_iSNb.js +0 -108
- package/dist/chunks/document-dashboard-inputs-BC6p-ESg.js +0 -8087
- package/dist/chunks/document-sheet-utils-Duo9uLoH.js +0 -3619
- package/dist/chunks/matrix-analytical-definition-C7Gb0e12.js +0 -117
- package/dist/chunks/normalize-dashboard-for-dirty-check-Bk3VYv_q.js +0 -67
- package/dist/chunks/numeric-presentation-DESvLiu9.js +0 -5227
- package/dist/chunks/sort-target-MT1WK1vX.js +0 -29
- package/dist/chunks/stable-serialize-CfqXeiBP.js +0 -6
- package/dist/chunks/table-settings-CLZocegs.js +0 -501
- package/dist/chunks/use-debounced-dirty-check-BwAbnX_5.js +0 -59
- package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-storage-transition.d.ts +0 -88
- package/dist/types/lib/dashboard-inputs/dashboard-input-scope.d.ts +0 -10
- package/dist/types/shared/dashboard-authoring/change-compiler.d.ts +0 -7
- package/dist/types/shared/dashboard-authoring/layout-compiler.d.ts +0 -2
- package/dist/types/shared/layouts/create-frame-layouts.d.ts +0 -27
- package/dist/types/shared/layouts/frame-layouts.d.ts +0 -23
|
@@ -0,0 +1,3734 @@
|
|
|
1
|
+
import { jsx as e, jsxs as n, Fragment as _ } from "react/jsx-runtime";
|
|
2
|
+
import Et, { useState as D, useEffect as be, useCallback as ae, useMemo as re, useLayoutEffect as kt, useRef as nt, useContext as Kt } from "react";
|
|
3
|
+
import { cC as ot, bE as Fe, bF as Ee, bH as Ie, cD as Xt, b2 as It, b0 as Qe, cE as Yt, cF as Ge, cG as it, a4 as Ke, a1 as de, u as C, cH as Zt, cI as Jt, bD as F, cJ as ea, a3 as ee, be as ta, cK as aa, cL as ra, aX as xe, cr as Lt, aO as Oe, o as na, k as sa, cM as oa, cu as lt, cv as dt, cw as ct, cx as ut, cy as ht, cz as mt, cA as pt, cB as Vt, aM as ft, cN as ia, cO as la, cj as et, cg as Le, ch as Ve, cP as Tt, ci as Te, c0 as X, cs as da, cq as je, cQ as ca, b_ as ua, bG as gt, bI as bt, cR as ha, bC as ma, cS as Bt, cT as xt, cU as pa, c4 as fa, i as ga, cV as ba, cW as xa, cX as K, cY as va, R as Pt, cZ as ya, c_ as Ca, c$ as wa, d0 as Na, aJ as Sa, d1 as he, d2 as ka, P as vt, d3 as Da, d4 as Aa, d5 as Fa, d6 as Ea, d7 as Ia, d8 as La, d9 as Va, da as Mt, db as Ta, dc as Ba, dd as Pa, de as Ut, df as Ma, dg as Re, dh as Ua, di as Ra, dj as za, A as _a, ay as Oa, az as ja, ae as $a, ad as Wa, ac as qa, ab as Ha, a8 as Qa, a6 as Ga, dk as Ka, dl as Xa, dm as Ya, dn as Za, dp as Ja, aw as er } from "./semaphor-ready-indicator-4zpRHE-X.js";
|
|
4
|
+
import { B as L, l as De, q as st, L as ne, j as Rt, c as yt, i as tr, P as $e, a as We, b as qe, S as zt } from "./switch-CEBOR4n7.js";
|
|
5
|
+
import { L as Ae } from "./layout-grid-Bgzth8vd.js";
|
|
6
|
+
import { c as fe, X as Xe, C as Ct } from "./x-4f5U2XwU.js";
|
|
7
|
+
import "./index-CuHybtft.js";
|
|
8
|
+
import { o as ar } from "./validators-C-aOQlTB.js";
|
|
9
|
+
import "./matrix-operation-contract-D6vYkZK4.js";
|
|
10
|
+
import "./analytics-base-schemas-BKs3flFS.js";
|
|
11
|
+
import "zod";
|
|
12
|
+
import "../value-format-preferences/index.js";
|
|
13
|
+
import { c as J } from "./_commonjsHelpers-DimLPMtv.js";
|
|
14
|
+
import { S as rr } from "./selection-reducer-CJzkTZio.js";
|
|
15
|
+
import { s as ze } from "./normalize-dashboard-for-dirty-check-XKgH3GFX.js";
|
|
16
|
+
import { aJ as nr, ax as sr, dW as He, v as Dt, dX as or, ar as wt, dY as ir, di as lr, d5 as dr, bk as cr, dZ as ur } from "./global-date-filter-utils-9d6m9-FE.js";
|
|
17
|
+
import { f as hr } from "./editor-draft-sync-BN5qYHPF.js";
|
|
18
|
+
import "react-dom";
|
|
19
|
+
import "./pivot-result-lifecycle-pwq3b7LC.js";
|
|
20
|
+
import "./index-CtoK1Lgu.js";
|
|
21
|
+
import { I as mr } from "./table-settings-CunhoDUi.js";
|
|
22
|
+
import { S as _t } from "./save-CfJpQQ68.js";
|
|
23
|
+
import { V as pr, L as fr, a as gr, u as Ot, C as jt, F as br, b as xr } from "./use-create-flow-overlay-state-DZBZiiD-.js";
|
|
24
|
+
import { q as At } from "./matrix-formatter-DWEeC0_c.js";
|
|
25
|
+
import { g as vr, f as yr } from "./document-dashboard-inputs-CRVHpIHp.js";
|
|
26
|
+
import { g as le, d as Cr, a as wr } from "./index-DkQkMKa1.js";
|
|
27
|
+
/**
|
|
28
|
+
* @license lucide-react v0.453.0 - ISC
|
|
29
|
+
*
|
|
30
|
+
* This source code is licensed under the ISC license.
|
|
31
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
32
|
+
*/
|
|
33
|
+
const Nr = fe("ArrowUpRight", [
|
|
34
|
+
["path", { d: "M7 7h10v10", key: "1tivn9" }],
|
|
35
|
+
["path", { d: "M7 17 17 7", key: "1vkiza" }]
|
|
36
|
+
]);
|
|
37
|
+
/**
|
|
38
|
+
* @license lucide-react v0.453.0 - ISC
|
|
39
|
+
*
|
|
40
|
+
* This source code is licensed under the ISC license.
|
|
41
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
42
|
+
*/
|
|
43
|
+
const Sr = fe("Bell", [
|
|
44
|
+
["path", { d: "M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9", key: "1qo2s2" }],
|
|
45
|
+
["path", { d: "M10.3 21a1.94 1.94 0 0 0 3.4 0", key: "qgo35s" }]
|
|
46
|
+
]);
|
|
47
|
+
/**
|
|
48
|
+
* @license lucide-react v0.453.0 - ISC
|
|
49
|
+
*
|
|
50
|
+
* This source code is licensed under the ISC license.
|
|
51
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
52
|
+
*/
|
|
53
|
+
const kr = fe("CalendarRange", [
|
|
54
|
+
["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
|
|
55
|
+
["path", { d: "M16 2v4", key: "4m81vk" }],
|
|
56
|
+
["path", { d: "M3 10h18", key: "8toen8" }],
|
|
57
|
+
["path", { d: "M8 2v4", key: "1cmpym" }],
|
|
58
|
+
["path", { d: "M17 14h-6", key: "bkmgh3" }],
|
|
59
|
+
["path", { d: "M13 18H7", key: "bb0bb7" }],
|
|
60
|
+
["path", { d: "M7 14h.01", key: "1qa3f1" }],
|
|
61
|
+
["path", { d: "M17 18h.01", key: "1bdyru" }]
|
|
62
|
+
]);
|
|
63
|
+
/**
|
|
64
|
+
* @license lucide-react v0.453.0 - ISC
|
|
65
|
+
*
|
|
66
|
+
* This source code is licensed under the ISC license.
|
|
67
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
68
|
+
*/
|
|
69
|
+
const Dr = fe("CodeXml", [
|
|
70
|
+
["path", { d: "m18 16 4-4-4-4", key: "1inbqp" }],
|
|
71
|
+
["path", { d: "m6 8-4 4 4 4", key: "15zrgr" }],
|
|
72
|
+
["path", { d: "m14.5 4-5 16", key: "e7oirm" }]
|
|
73
|
+
]);
|
|
74
|
+
/**
|
|
75
|
+
* @license lucide-react v0.453.0 - ISC
|
|
76
|
+
*
|
|
77
|
+
* This source code is licensed under the ISC license.
|
|
78
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
79
|
+
*/
|
|
80
|
+
const Ar = fe("MonitorSmartphone", [
|
|
81
|
+
["path", { d: "M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8", key: "10dyio" }],
|
|
82
|
+
["path", { d: "M10 19v-3.96 3.15", key: "1irgej" }],
|
|
83
|
+
["path", { d: "M7 19h5", key: "qswx4l" }],
|
|
84
|
+
["rect", { width: "6", height: "10", x: "16", y: "12", rx: "2", key: "1egngj" }]
|
|
85
|
+
]);
|
|
86
|
+
/**
|
|
87
|
+
* @license lucide-react v0.453.0 - ISC
|
|
88
|
+
*
|
|
89
|
+
* This source code is licensed under the ISC license.
|
|
90
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
91
|
+
*/
|
|
92
|
+
const Fr = fe("MousePointer2", [
|
|
93
|
+
[
|
|
94
|
+
"path",
|
|
95
|
+
{
|
|
96
|
+
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",
|
|
97
|
+
key: "edeuup"
|
|
98
|
+
}
|
|
99
|
+
]
|
|
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 Er = fe("Newspaper", [
|
|
108
|
+
[
|
|
109
|
+
"path",
|
|
110
|
+
{
|
|
111
|
+
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",
|
|
112
|
+
key: "7pis2x"
|
|
113
|
+
}
|
|
114
|
+
],
|
|
115
|
+
["path", { d: "M18 14h-8", key: "sponae" }],
|
|
116
|
+
["path", { d: "M15 18h-5", key: "95g1m2" }],
|
|
117
|
+
["path", { d: "M10 6h8v4h-8V6Z", key: "smlsk5" }]
|
|
118
|
+
]);
|
|
119
|
+
function Ir() {
|
|
120
|
+
return /* @__PURE__ */ e("div", { className: "space-y-1.5 py-1", children: [...Array(5)].map((t, r) => /* @__PURE__ */ n(
|
|
121
|
+
"div",
|
|
122
|
+
{
|
|
123
|
+
className: "flex animate-pulse items-start gap-3 rounded-xl border border-transparent px-2.5 py-2.5",
|
|
124
|
+
children: [
|
|
125
|
+
/* @__PURE__ */ e("div", { className: "mt-0.5 h-4 w-4 flex-shrink-0 rounded bg-muted/60" }),
|
|
126
|
+
/* @__PURE__ */ n("div", { className: "flex-1 space-y-1.5", children: [
|
|
127
|
+
/* @__PURE__ */ e("div", { className: "h-4 w-3/5 rounded bg-muted/60" }),
|
|
128
|
+
/* @__PURE__ */ e("div", { className: "h-3 w-4/5 rounded bg-muted/40" })
|
|
129
|
+
] })
|
|
130
|
+
]
|
|
131
|
+
},
|
|
132
|
+
r
|
|
133
|
+
)) });
|
|
134
|
+
}
|
|
135
|
+
function Lr({
|
|
136
|
+
open: t,
|
|
137
|
+
onOpenChange: r,
|
|
138
|
+
onSubmit: o,
|
|
139
|
+
isCreating: s
|
|
140
|
+
}) {
|
|
141
|
+
const i = ot("interactive"), [a, c] = D(""), [d, l] = D("");
|
|
142
|
+
be(() => {
|
|
143
|
+
t || (c(""), l(""));
|
|
144
|
+
}, [t]);
|
|
145
|
+
const u = () => {
|
|
146
|
+
a.trim() && o({ title: a, description: d });
|
|
147
|
+
}, h = (m) => {
|
|
148
|
+
r(m);
|
|
149
|
+
};
|
|
150
|
+
return /* @__PURE__ */ e(Fe, { open: t, onOpenChange: h, children: /* @__PURE__ */ n(
|
|
151
|
+
Ee,
|
|
152
|
+
{
|
|
153
|
+
showCloseButton: !1,
|
|
154
|
+
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",
|
|
155
|
+
style: i.dialogStyle,
|
|
156
|
+
children: [
|
|
157
|
+
/* @__PURE__ */ n("div", { className: "flex h-10 shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3", children: [
|
|
158
|
+
/* @__PURE__ */ n("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
159
|
+
/* @__PURE__ */ e(Ae, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
160
|
+
/* @__PURE__ */ n("div", { className: "flex min-w-0 items-baseline gap-2", children: [
|
|
161
|
+
/* @__PURE__ */ e(Ie, { className: "truncate text-[13px] font-medium leading-none tracking-normal", children: "New library visual" }),
|
|
162
|
+
/* @__PURE__ */ e("span", { className: "shrink-0 text-[10px] font-medium uppercase leading-none tracking-[0.08em] text-muted-foreground", children: "Visual" })
|
|
163
|
+
] })
|
|
164
|
+
] }),
|
|
165
|
+
/* @__PURE__ */ e(
|
|
166
|
+
L,
|
|
167
|
+
{
|
|
168
|
+
size: "xs",
|
|
169
|
+
variant: "ghost",
|
|
170
|
+
className: "w-7 px-0 text-muted-foreground hover:text-foreground",
|
|
171
|
+
onClick: () => h(!1),
|
|
172
|
+
"aria-label": "Close",
|
|
173
|
+
disabled: s,
|
|
174
|
+
children: /* @__PURE__ */ e(Xe, { className: "h-3.5 w-3.5" })
|
|
175
|
+
}
|
|
176
|
+
)
|
|
177
|
+
] }),
|
|
178
|
+
/* @__PURE__ */ n("div", { className: "space-y-3 px-4 py-3", children: [
|
|
179
|
+
/* @__PURE__ */ e("p", { className: "text-[12px] text-muted-foreground", children: "Create a saved visual that can be reused across dashboards." }),
|
|
180
|
+
/* @__PURE__ */ n("div", { className: "space-y-1.5", children: [
|
|
181
|
+
/* @__PURE__ */ e(De, { htmlFor: "visual-title", className: "text-[12px]", children: "Name" }),
|
|
182
|
+
/* @__PURE__ */ e(
|
|
183
|
+
st,
|
|
184
|
+
{
|
|
185
|
+
id: "visual-title",
|
|
186
|
+
size: "sm",
|
|
187
|
+
placeholder: "Untitled visual",
|
|
188
|
+
value: a,
|
|
189
|
+
onChange: (m) => c(m.target.value),
|
|
190
|
+
disabled: s,
|
|
191
|
+
onKeyDown: (m) => {
|
|
192
|
+
m.key === "Enter" && !m.shiftKey && (m.preventDefault(), u());
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
)
|
|
196
|
+
] }),
|
|
197
|
+
/* @__PURE__ */ n("div", { className: "space-y-1.5", children: [
|
|
198
|
+
/* @__PURE__ */ e(De, { htmlFor: "visual-description", className: "text-[12px]", children: "Description" }),
|
|
199
|
+
/* @__PURE__ */ e(
|
|
200
|
+
st,
|
|
201
|
+
{
|
|
202
|
+
id: "visual-description",
|
|
203
|
+
size: "sm",
|
|
204
|
+
placeholder: "Optional",
|
|
205
|
+
value: d,
|
|
206
|
+
onChange: (m) => l(m.target.value),
|
|
207
|
+
disabled: s
|
|
208
|
+
}
|
|
209
|
+
)
|
|
210
|
+
] })
|
|
211
|
+
] }),
|
|
212
|
+
/* @__PURE__ */ n("div", { className: "flex shrink-0 justify-end gap-2 border-t border-border/60 px-4 py-2.5", children: [
|
|
213
|
+
/* @__PURE__ */ e(
|
|
214
|
+
L,
|
|
215
|
+
{
|
|
216
|
+
size: "xs",
|
|
217
|
+
variant: "outline",
|
|
218
|
+
onClick: () => h(!1),
|
|
219
|
+
disabled: s,
|
|
220
|
+
children: "Cancel"
|
|
221
|
+
}
|
|
222
|
+
),
|
|
223
|
+
/* @__PURE__ */ e(
|
|
224
|
+
L,
|
|
225
|
+
{
|
|
226
|
+
size: "xs",
|
|
227
|
+
onClick: u,
|
|
228
|
+
disabled: !a.trim() || s,
|
|
229
|
+
children: s ? /* @__PURE__ */ n(_, { children: [
|
|
230
|
+
/* @__PURE__ */ e(ne, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
231
|
+
"Creating..."
|
|
232
|
+
] }) : "Create library visual"
|
|
233
|
+
}
|
|
234
|
+
)
|
|
235
|
+
] })
|
|
236
|
+
]
|
|
237
|
+
}
|
|
238
|
+
) });
|
|
239
|
+
}
|
|
240
|
+
function Vr(t) {
|
|
241
|
+
const [r, o] = D(null), [s, i] = D(null), a = Xt();
|
|
242
|
+
return be(() => {
|
|
243
|
+
if (!t || t.trim() === "") {
|
|
244
|
+
o(null), i(null);
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
if (!a)
|
|
248
|
+
return;
|
|
249
|
+
(async () => {
|
|
250
|
+
try {
|
|
251
|
+
if (!t.startsWith("http://") && !t.startsWith("https://"))
|
|
252
|
+
throw new Error(`Invalid URL format: ${t}`);
|
|
253
|
+
try {
|
|
254
|
+
new URL(t);
|
|
255
|
+
} catch {
|
|
256
|
+
throw new Error(`Invalid URL: ${t}`);
|
|
257
|
+
}
|
|
258
|
+
const l = `${t.endsWith("/") ? t : `${t}/`}index.js`;
|
|
259
|
+
try {
|
|
260
|
+
if (!(await fetch(l, { method: "HEAD" })).ok)
|
|
261
|
+
throw new Error(`Module not found at ${l}`);
|
|
262
|
+
} catch {
|
|
263
|
+
}
|
|
264
|
+
const u = await import(
|
|
265
|
+
/* @vite-ignore */
|
|
266
|
+
/* webpackIgnore: true */
|
|
267
|
+
l
|
|
268
|
+
);
|
|
269
|
+
if (typeof u.useChartStore != "function")
|
|
270
|
+
throw new Error("useChartStore is not a function");
|
|
271
|
+
o(() => u.useChartStore), i(null);
|
|
272
|
+
} catch (d) {
|
|
273
|
+
const l = d instanceof Error ? d.message : "Unknown error";
|
|
274
|
+
console.error("Failed to load remote chart store:", l), i(l), o(null);
|
|
275
|
+
}
|
|
276
|
+
})();
|
|
277
|
+
}, [t, a]), r;
|
|
278
|
+
}
|
|
279
|
+
function Tr(t, r) {
|
|
280
|
+
if (t.length === 0)
|
|
281
|
+
return "";
|
|
282
|
+
const o = t.find(
|
|
283
|
+
(s) => {
|
|
284
|
+
var i, a;
|
|
285
|
+
return ((i = s.customCardPreferences) == null ? void 0 : i.visualType) === "multiple" || !!((a = s.customCardPreferences) != null && a.dataInputCardIds);
|
|
286
|
+
}
|
|
287
|
+
);
|
|
288
|
+
if (o)
|
|
289
|
+
return o.id;
|
|
290
|
+
if (r) {
|
|
291
|
+
const s = t.find((i) => i.id === r);
|
|
292
|
+
if (s) {
|
|
293
|
+
const i = s.tabTitle;
|
|
294
|
+
if (i == "All__Header")
|
|
295
|
+
return t[0].id;
|
|
296
|
+
if (i && i.endsWith("__Header")) {
|
|
297
|
+
const c = i.split("__")[0], d = t.find(
|
|
298
|
+
(l) => l.tabTitle === c
|
|
299
|
+
);
|
|
300
|
+
return d ? d.id : t[0].id;
|
|
301
|
+
}
|
|
302
|
+
return r;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
return t[0].id;
|
|
306
|
+
}
|
|
307
|
+
async function Ft(t, r, o, s, i = "Opening library visual...") {
|
|
308
|
+
if (!r || !o)
|
|
309
|
+
throw new Error("Missing auth token or visual ID");
|
|
310
|
+
const a = ["resource-by-id", "visual", o], c = s.getQueryData(a);
|
|
311
|
+
if (c)
|
|
312
|
+
return console.log("Using cached visual data for:", o), { data: c, fromCache: !0 };
|
|
313
|
+
console.log("Fetching visual data from network for:", o);
|
|
314
|
+
const d = F.loading(i, {
|
|
315
|
+
position: "top-center"
|
|
316
|
+
});
|
|
317
|
+
try {
|
|
318
|
+
const l = await fetch(
|
|
319
|
+
`${t}/management/v1/visuals/${o}`,
|
|
320
|
+
{
|
|
321
|
+
headers: {
|
|
322
|
+
Authorization: `Bearer ${r}`
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
);
|
|
326
|
+
if (!l.ok)
|
|
327
|
+
throw new Error("Failed to load visual");
|
|
328
|
+
const u = await l.json();
|
|
329
|
+
return s.setQueryData(a, u), F.dismiss(d), { data: u, fromCache: !1 };
|
|
330
|
+
} catch (l) {
|
|
331
|
+
throw F.dismiss(d), l;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
function $t(t) {
|
|
335
|
+
if (typeof t == "string")
|
|
336
|
+
return JSON.parse(t);
|
|
337
|
+
if (typeof t == "object")
|
|
338
|
+
return t;
|
|
339
|
+
throw new Error("Invalid frame object format");
|
|
340
|
+
}
|
|
341
|
+
function Br(t, r) {
|
|
342
|
+
var a, c;
|
|
343
|
+
const o = (t == null ? void 0 : t.frameObject) ?? ((a = t == null ? void 0 : t.visual) == null ? void 0 : a.frameObject);
|
|
344
|
+
if (!o)
|
|
345
|
+
return !1;
|
|
346
|
+
const s = $t(o);
|
|
347
|
+
if (!(s != null && s.cards) || s.cards.length === 0)
|
|
348
|
+
return !1;
|
|
349
|
+
const i = (c = s.cards) == null ? void 0 : c.find(
|
|
350
|
+
(d) => d.id === s.activeCardId
|
|
351
|
+
);
|
|
352
|
+
return i ? (ea({
|
|
353
|
+
...r,
|
|
354
|
+
frame: s,
|
|
355
|
+
card: i,
|
|
356
|
+
visualId: (t == null ? void 0 : t.id) || s.visualId
|
|
357
|
+
}), !0) : !1;
|
|
358
|
+
}
|
|
359
|
+
function Pr() {
|
|
360
|
+
const t = ee(
|
|
361
|
+
(s) => {
|
|
362
|
+
var i;
|
|
363
|
+
return ((i = s.card.customCardPreferences) == null ? void 0 : i.url) || "";
|
|
364
|
+
}
|
|
365
|
+
), r = Vr(t);
|
|
366
|
+
return { getUpdatedFrame: ae(() => {
|
|
367
|
+
var f;
|
|
368
|
+
hr();
|
|
369
|
+
const {
|
|
370
|
+
frame: s,
|
|
371
|
+
card: i,
|
|
372
|
+
isDevMode: a,
|
|
373
|
+
selectedSchemaName: c,
|
|
374
|
+
selectedDatabaseName: d,
|
|
375
|
+
selectedTableName: l,
|
|
376
|
+
selectedConnectionId: u
|
|
377
|
+
} = ee.getState(), h = i.sql, m = (f = r == null ? void 0 : r.getState()) == null ? void 0 : f.settings, p = nr(i, {
|
|
378
|
+
isDevMode: a,
|
|
379
|
+
cardSql: h,
|
|
380
|
+
selectedSchemaName: c,
|
|
381
|
+
selectedDatabaseName: d,
|
|
382
|
+
selectedTableName: l,
|
|
383
|
+
selectedConnectionId: u,
|
|
384
|
+
remoteChartSettings: m,
|
|
385
|
+
stripConfig: sr
|
|
386
|
+
}), g = s.cards.map(
|
|
387
|
+
(v) => v.id === i.id ? p : v
|
|
388
|
+
);
|
|
389
|
+
return {
|
|
390
|
+
...s,
|
|
391
|
+
cards: g,
|
|
392
|
+
activeCardId: Tr(g, s.activeCardId)
|
|
393
|
+
};
|
|
394
|
+
}, [r]) };
|
|
395
|
+
}
|
|
396
|
+
function ve() {
|
|
397
|
+
const { authToken: t, tokenProps: r } = It(), o = Qe(), s = Yt(), i = Ge(), { selectVisual: a } = it(), {
|
|
398
|
+
setFrame: c,
|
|
399
|
+
setCard: d,
|
|
400
|
+
setIsDevMode: l,
|
|
401
|
+
initializeModeDrafts: u,
|
|
402
|
+
setActiveTabCardId: h,
|
|
403
|
+
updateDataSource: m,
|
|
404
|
+
setQueryResultColumns: p,
|
|
405
|
+
setSelectedConnectionId: g,
|
|
406
|
+
setSelectedDatabaseName: f,
|
|
407
|
+
setSelectedSchemaName: v,
|
|
408
|
+
setSelectedTableName: k,
|
|
409
|
+
setSelectedDatamodelId: V,
|
|
410
|
+
setInlineFilterValuesMap: M,
|
|
411
|
+
setApplyFilters: U,
|
|
412
|
+
clearEditorContext: A
|
|
413
|
+
} = Ke(), {
|
|
414
|
+
setIsDashboardEditing: z,
|
|
415
|
+
setIsVisualEditing: w,
|
|
416
|
+
setSelectedFrameId: N,
|
|
417
|
+
clearSelectedFrameId: x
|
|
418
|
+
} = de(), E = C((H) => H.selectedSheetId), S = C((H) => H.selectedFrameId), j = C((H) => H.dashboard), I = C(
|
|
419
|
+
(H) => H.inlineFilterValuesMap
|
|
420
|
+
), T = Zt((i == null ? void 0 : i.id) || "", {
|
|
421
|
+
enabled: !!(i != null && i.id) && !!(t != null && t.accessToken)
|
|
422
|
+
}), Z = ae(
|
|
423
|
+
async (H) => {
|
|
424
|
+
try {
|
|
425
|
+
a(H), x(), A();
|
|
426
|
+
const { data: Q, fromCache: ce } = await Ft(
|
|
427
|
+
r.apiServiceUrl,
|
|
428
|
+
(t == null ? void 0 : t.accessToken) || "",
|
|
429
|
+
H.id,
|
|
430
|
+
o,
|
|
431
|
+
"Opening library visual..."
|
|
432
|
+
);
|
|
433
|
+
if (!Br(Q, {
|
|
434
|
+
setFrame: c,
|
|
435
|
+
setCard: d,
|
|
436
|
+
setIsDevMode: l,
|
|
437
|
+
initializeModeDrafts: u,
|
|
438
|
+
setActiveTabCardId: h,
|
|
439
|
+
updateDataSource: m,
|
|
440
|
+
setQueryResultColumns: p,
|
|
441
|
+
setSelectedConnectionId: g,
|
|
442
|
+
setSelectedDatabaseName: f,
|
|
443
|
+
setSelectedSchemaName: v,
|
|
444
|
+
setSelectedTableName: k,
|
|
445
|
+
setSelectedDatamodelId: V,
|
|
446
|
+
setInlineFilterValuesMap: M,
|
|
447
|
+
setApplyFilters: U,
|
|
448
|
+
setIsDashboardEditing: z,
|
|
449
|
+
setIsVisualEditing: w,
|
|
450
|
+
dashboard: j,
|
|
451
|
+
selectedSheetId: E,
|
|
452
|
+
selectedFrameId: S,
|
|
453
|
+
inlineFilterValuesMap: I
|
|
454
|
+
}))
|
|
455
|
+
throw new Error("Failed to setup editor with visual data");
|
|
456
|
+
return { success: !0, fromCache: ce };
|
|
457
|
+
} catch (Q) {
|
|
458
|
+
return console.error("Error editing visual:", Q), { success: !1, error: "Failed to load visual for editing" };
|
|
459
|
+
}
|
|
460
|
+
},
|
|
461
|
+
[
|
|
462
|
+
t == null ? void 0 : t.accessToken,
|
|
463
|
+
r.apiServiceUrl,
|
|
464
|
+
o,
|
|
465
|
+
a,
|
|
466
|
+
c,
|
|
467
|
+
d,
|
|
468
|
+
z,
|
|
469
|
+
w,
|
|
470
|
+
l,
|
|
471
|
+
u,
|
|
472
|
+
h,
|
|
473
|
+
m,
|
|
474
|
+
p,
|
|
475
|
+
g,
|
|
476
|
+
f,
|
|
477
|
+
v,
|
|
478
|
+
k,
|
|
479
|
+
V,
|
|
480
|
+
M,
|
|
481
|
+
U,
|
|
482
|
+
A,
|
|
483
|
+
x,
|
|
484
|
+
j,
|
|
485
|
+
E,
|
|
486
|
+
S,
|
|
487
|
+
I
|
|
488
|
+
]
|
|
489
|
+
), G = ae(
|
|
490
|
+
async (H) => {
|
|
491
|
+
var ce;
|
|
492
|
+
const Q = (O) => (F.error(O), { success: !1, error: O });
|
|
493
|
+
try {
|
|
494
|
+
if (a(H), !E)
|
|
495
|
+
return Q("No sheet selected. Please select a sheet first.");
|
|
496
|
+
const { data: O, fromCache: ye } = await Ft(
|
|
497
|
+
r.apiServiceUrl,
|
|
498
|
+
(t == null ? void 0 : t.accessToken) || "",
|
|
499
|
+
H.id,
|
|
500
|
+
o,
|
|
501
|
+
"Adding visual to dashboard..."
|
|
502
|
+
), Y = (O == null ? void 0 : O.frameObject) ?? ((ce = O == null ? void 0 : O.visual) == null ? void 0 : ce.frameObject);
|
|
503
|
+
if (!Y)
|
|
504
|
+
return Q("Visual has no frame data");
|
|
505
|
+
const R = $t(Y);
|
|
506
|
+
if (!(R != null && R.cards) || R.cards.length === 0)
|
|
507
|
+
return Q("Visual frame is malformed");
|
|
508
|
+
const te = {
|
|
509
|
+
...Jt(R),
|
|
510
|
+
visualId: H.id
|
|
511
|
+
// Link this frame to the library visual
|
|
512
|
+
};
|
|
513
|
+
return await s(E, te), z(!0), N(te.id), { success: !0, fromCache: ye };
|
|
514
|
+
} catch (O) {
|
|
515
|
+
return console.error("Error adding visual:", O), Q(
|
|
516
|
+
O instanceof Error ? O.message : "Failed to add visual to dashboard"
|
|
517
|
+
);
|
|
518
|
+
}
|
|
519
|
+
},
|
|
520
|
+
[
|
|
521
|
+
t == null ? void 0 : t.accessToken,
|
|
522
|
+
r.apiServiceUrl,
|
|
523
|
+
o,
|
|
524
|
+
a,
|
|
525
|
+
E,
|
|
526
|
+
z,
|
|
527
|
+
N,
|
|
528
|
+
s
|
|
529
|
+
]
|
|
530
|
+
);
|
|
531
|
+
return {
|
|
532
|
+
visual: T.data,
|
|
533
|
+
isLoading: T.isLoading,
|
|
534
|
+
isError: T.isError,
|
|
535
|
+
error: T.error,
|
|
536
|
+
handleEditLibraryVisual: Z,
|
|
537
|
+
handleAddLibraryVisual: G,
|
|
538
|
+
getUpdatedFrame: Pr().getUpdatedFrame,
|
|
539
|
+
refetch: T.refetch
|
|
540
|
+
};
|
|
541
|
+
}
|
|
542
|
+
function Wt(t) {
|
|
543
|
+
return t ? new Date(t).toLocaleDateString("en-US", {
|
|
544
|
+
month: "short",
|
|
545
|
+
day: "numeric",
|
|
546
|
+
year: "numeric"
|
|
547
|
+
}) : "Unknown";
|
|
548
|
+
}
|
|
549
|
+
function qt(t, r) {
|
|
550
|
+
var s;
|
|
551
|
+
const o = (s = t.ownership.createdBy) == null ? void 0 : s.type;
|
|
552
|
+
return o === "tenant" || o === "organization" && r;
|
|
553
|
+
}
|
|
554
|
+
function Nt(t, r) {
|
|
555
|
+
var o, s;
|
|
556
|
+
return qt(t, r) ? ((o = t.ownership.createdBy) == null ? void 0 : o.name) || ((s = t.createdByTenantUserRel) == null ? void 0 : s.name) || t.lastModifiedBy || "Unknown" : "Organization";
|
|
557
|
+
}
|
|
558
|
+
function Mr(t, r) {
|
|
559
|
+
return Nt(t, r).split(/\s+/).filter(Boolean).slice(0, 2).map((s) => s.charAt(0).toUpperCase()).join("") || "?";
|
|
560
|
+
}
|
|
561
|
+
function Ur(t) {
|
|
562
|
+
const r = (t || "").toLowerCase();
|
|
563
|
+
return r.includes("table") ? Rt : r.includes("pie") || r.includes("donut") ? ia : r.includes("line") ? la : r.includes("bar") ? tr : Ae;
|
|
564
|
+
}
|
|
565
|
+
function Rr({ visual: t }) {
|
|
566
|
+
const r = t.ownership.status === "public" ? "Public" : t.ownership.status === "shared" || t.ownership.sharedCount > 0 ? "Shared" : "Private";
|
|
567
|
+
return /* @__PURE__ */ e("span", { className: "inline-flex items-center rounded-[4px] border border-border/60 px-1.5 py-px text-[11px] text-muted-foreground", children: r });
|
|
568
|
+
}
|
|
569
|
+
function ts({
|
|
570
|
+
open: t,
|
|
571
|
+
onOpenChange: r
|
|
572
|
+
}) {
|
|
573
|
+
const o = ot("interactive"), [s, i] = D(""), [a, c] = D(/* @__PURE__ */ new Set()), [d, l] = D(!1), [u, h] = D(
|
|
574
|
+
null
|
|
575
|
+
), [m, p] = D(
|
|
576
|
+
null
|
|
577
|
+
), [g, f] = D(!1), [v, k] = D(null), [V, M] = D(null), U = () => {
|
|
578
|
+
c(/* @__PURE__ */ new Set()), h(null), p(null), f(!1), k(null);
|
|
579
|
+
}, A = () => {
|
|
580
|
+
r(!1), U();
|
|
581
|
+
}, { selectVisual: z } = it(), { handleAddLibraryVisual: w, handleEditLibraryVisual: N } = ve(), { isConsoleMode: x } = ta(), {
|
|
582
|
+
resources: E,
|
|
583
|
+
isLoading: S,
|
|
584
|
+
isError: j,
|
|
585
|
+
createResource: I,
|
|
586
|
+
updateResource: T,
|
|
587
|
+
deleteResourceAsync: Z,
|
|
588
|
+
duplicateResource: G,
|
|
589
|
+
isCreating: H,
|
|
590
|
+
isDeleting: Q
|
|
591
|
+
} = aa(
|
|
592
|
+
void 0,
|
|
593
|
+
(b) => {
|
|
594
|
+
l(!1), b && (z(b), N(b), A());
|
|
595
|
+
}
|
|
596
|
+
), {
|
|
597
|
+
startUpdating: ce,
|
|
598
|
+
stopUpdating: O,
|
|
599
|
+
isUpdating: ye
|
|
600
|
+
} = ra(), Y = E, R = re(() => {
|
|
601
|
+
const b = s.trim().toLowerCase();
|
|
602
|
+
return b ? Y.filter(
|
|
603
|
+
(B) => {
|
|
604
|
+
var q, ie, ue;
|
|
605
|
+
return ((q = B.title) == null ? void 0 : q.toLowerCase().includes(b)) || ((ie = B.description) == null ? void 0 : ie.toLowerCase().includes(b)) || ((ue = B.kind) == null ? void 0 : ue.toLowerCase().includes(b));
|
|
606
|
+
}
|
|
607
|
+
) : Y;
|
|
608
|
+
}, [s, Y]), te = re(
|
|
609
|
+
() => Y.filter(
|
|
610
|
+
(b) => a.has(b.id)
|
|
611
|
+
),
|
|
612
|
+
[a, Y]
|
|
613
|
+
), me = te.filter(
|
|
614
|
+
(b) => b.permissions.canDelete
|
|
615
|
+
), pe = te.filter(
|
|
616
|
+
(b) => b.permissions.canShare
|
|
617
|
+
), Ce = R.length > 0 && R.every(
|
|
618
|
+
(b) => a.has(b.id)
|
|
619
|
+
), Be = R.some(
|
|
620
|
+
(b) => a.has(b.id)
|
|
621
|
+
), Ye = (b) => {
|
|
622
|
+
const B = new Set(a);
|
|
623
|
+
b(B), c(B);
|
|
624
|
+
}, $ = (b) => {
|
|
625
|
+
Ye((B) => {
|
|
626
|
+
B.has(b) ? B.delete(b) : B.add(b);
|
|
627
|
+
});
|
|
628
|
+
}, W = () => {
|
|
629
|
+
c((b) => {
|
|
630
|
+
const B = new Set(b);
|
|
631
|
+
return Ce ? R.forEach(
|
|
632
|
+
(q) => B.delete(q.id)
|
|
633
|
+
) : R.forEach(
|
|
634
|
+
(q) => B.add(q.id)
|
|
635
|
+
), B;
|
|
636
|
+
});
|
|
637
|
+
}, se = async (b) => {
|
|
638
|
+
(await w(b)).success && A();
|
|
639
|
+
}, we = async () => {
|
|
640
|
+
const b = te;
|
|
641
|
+
if (b.length === 0) return;
|
|
642
|
+
let B = !1;
|
|
643
|
+
for (const q of b)
|
|
644
|
+
if (!(await w(q)).success) {
|
|
645
|
+
B = !0;
|
|
646
|
+
break;
|
|
647
|
+
}
|
|
648
|
+
B || A();
|
|
649
|
+
}, Ze = (b) => {
|
|
650
|
+
N(b), A();
|
|
651
|
+
}, ge = (b) => {
|
|
652
|
+
M(b), G(b, {
|
|
653
|
+
onSettled: () => M(null)
|
|
654
|
+
});
|
|
655
|
+
}, Pe = () => {
|
|
656
|
+
if (me.length === 0) {
|
|
657
|
+
F.error("Select a visual you can delete");
|
|
658
|
+
return;
|
|
659
|
+
}
|
|
660
|
+
k(null), f(!0);
|
|
661
|
+
}, Je = async () => {
|
|
662
|
+
const b = v ? [v] : me;
|
|
663
|
+
try {
|
|
664
|
+
for (const B of b)
|
|
665
|
+
await Z(B.id);
|
|
666
|
+
c((B) => {
|
|
667
|
+
const q = new Set(B);
|
|
668
|
+
return b.forEach(
|
|
669
|
+
(ie) => q.delete(ie.id)
|
|
670
|
+
), q;
|
|
671
|
+
}), f(!1), k(null);
|
|
672
|
+
} catch {
|
|
673
|
+
}
|
|
674
|
+
}, Ne = () => {
|
|
675
|
+
if (te.length !== 1) {
|
|
676
|
+
F.error("Select one visual to share");
|
|
677
|
+
return;
|
|
678
|
+
}
|
|
679
|
+
const [b] = te;
|
|
680
|
+
if (!b.permissions.canShare) {
|
|
681
|
+
F.error("You do not have permission to share this visual");
|
|
682
|
+
return;
|
|
683
|
+
}
|
|
684
|
+
h(b);
|
|
685
|
+
}, Se = ({
|
|
686
|
+
title: b,
|
|
687
|
+
description: B
|
|
688
|
+
}) => {
|
|
689
|
+
if (!m) return;
|
|
690
|
+
const q = {};
|
|
691
|
+
if (b !== m.title && (q.title = b), (m.description || "") !== B && (q.description = B), Object.keys(q).length === 0) {
|
|
692
|
+
p(null);
|
|
693
|
+
return;
|
|
694
|
+
}
|
|
695
|
+
const ie = Object.keys(q), ue = ie.length === 1 ? ie[0] : void 0;
|
|
696
|
+
ce(m.id, ue), T(
|
|
697
|
+
{
|
|
698
|
+
resourceId: m.id,
|
|
699
|
+
data: q
|
|
700
|
+
},
|
|
701
|
+
{
|
|
702
|
+
onSuccess: () => {
|
|
703
|
+
O(m.id, ue), p(null);
|
|
704
|
+
},
|
|
705
|
+
onError: () => {
|
|
706
|
+
O(m.id, ue);
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
);
|
|
710
|
+
}, oe = (b) => {
|
|
711
|
+
r(b), b || U();
|
|
712
|
+
}, ke = v ? 1 : me.length;
|
|
713
|
+
return /* @__PURE__ */ n(_, { children: [
|
|
714
|
+
/* @__PURE__ */ e(Fe, { open: t, onOpenChange: oe, children: /* @__PURE__ */ n(
|
|
715
|
+
Ee,
|
|
716
|
+
{
|
|
717
|
+
showCloseButton: !1,
|
|
718
|
+
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",
|
|
719
|
+
style: o.dialogStyle,
|
|
720
|
+
children: [
|
|
721
|
+
/* @__PURE__ */ n("div", { className: "flex h-10 shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3", children: [
|
|
722
|
+
/* @__PURE__ */ n("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
723
|
+
/* @__PURE__ */ e(Rt, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
724
|
+
/* @__PURE__ */ n("div", { className: "flex min-w-0 items-baseline gap-2", children: [
|
|
725
|
+
/* @__PURE__ */ e(Ie, { className: "truncate text-[13px] font-medium leading-none tracking-normal", children: "Visuals library" }),
|
|
726
|
+
/* @__PURE__ */ e("span", { className: "shrink-0 text-[10px] font-medium uppercase leading-none tracking-[0.08em] text-muted-foreground", children: "Add to dashboard" })
|
|
727
|
+
] })
|
|
728
|
+
] }),
|
|
729
|
+
/* @__PURE__ */ e(
|
|
730
|
+
L,
|
|
731
|
+
{
|
|
732
|
+
size: "xs",
|
|
733
|
+
variant: "ghost",
|
|
734
|
+
className: "w-7 px-0 text-muted-foreground hover:text-foreground",
|
|
735
|
+
onClick: () => oe(!1),
|
|
736
|
+
"aria-label": "Close visuals library",
|
|
737
|
+
children: "×"
|
|
738
|
+
}
|
|
739
|
+
)
|
|
740
|
+
] }),
|
|
741
|
+
/* @__PURE__ */ n("div", { className: "flex shrink-0 items-center gap-2 border-b border-border/60 px-3 py-2", children: [
|
|
742
|
+
/* @__PURE__ */ n("div", { className: "relative min-w-[12rem] flex-1 md:max-w-md", children: [
|
|
743
|
+
/* @__PURE__ */ e(rr, { className: "pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
|
|
744
|
+
/* @__PURE__ */ e(
|
|
745
|
+
"input",
|
|
746
|
+
{
|
|
747
|
+
autoFocus: !0,
|
|
748
|
+
value: s,
|
|
749
|
+
onChange: (b) => i(b.target.value),
|
|
750
|
+
placeholder: "Search visuals...",
|
|
751
|
+
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",
|
|
752
|
+
"aria-label": "Search visuals"
|
|
753
|
+
}
|
|
754
|
+
)
|
|
755
|
+
] }),
|
|
756
|
+
/* @__PURE__ */ n(
|
|
757
|
+
L,
|
|
758
|
+
{
|
|
759
|
+
size: "xs",
|
|
760
|
+
variant: "outline",
|
|
761
|
+
className: "ml-auto",
|
|
762
|
+
onClick: () => l(!0),
|
|
763
|
+
children: [
|
|
764
|
+
/* @__PURE__ */ e(xe, { className: "h-3.5 w-3.5" }),
|
|
765
|
+
"New library visual"
|
|
766
|
+
]
|
|
767
|
+
}
|
|
768
|
+
)
|
|
769
|
+
] }),
|
|
770
|
+
/* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-auto", children: S ? /* @__PURE__ */ e("div", { className: "p-3", children: /* @__PURE__ */ e(Ir, {}) }) : j ? /* @__PURE__ */ e("div", { className: "flex flex-col items-center gap-2 px-4 py-12 text-center", children: /* @__PURE__ */ e("p", { className: "text-[13px] text-destructive", children: "Failed to load visuals" }) }) : R.length === 0 ? /* @__PURE__ */ n("div", { className: "flex flex-col items-center gap-2 px-4 py-12 text-center", children: [
|
|
771
|
+
/* @__PURE__ */ e(Ae, { className: "h-5 w-5 text-muted-foreground/60" }),
|
|
772
|
+
/* @__PURE__ */ e("p", { className: "text-[13px] font-medium", children: s ? "No visuals found" : "No visuals yet" }),
|
|
773
|
+
/* @__PURE__ */ e("p", { className: "text-[12px] text-muted-foreground", children: s ? "Try a different search." : "Create a saved visual to add it here." })
|
|
774
|
+
] }) : /* @__PURE__ */ e(
|
|
775
|
+
zr,
|
|
776
|
+
{
|
|
777
|
+
visuals: R,
|
|
778
|
+
selectedIds: a,
|
|
779
|
+
allFilteredSelected: Ce,
|
|
780
|
+
someFilteredSelected: Be,
|
|
781
|
+
onSelectAll: W,
|
|
782
|
+
onToggleSelection: $,
|
|
783
|
+
onAddVisual: se,
|
|
784
|
+
onOpenVisual: Ze,
|
|
785
|
+
onEditDetails: p,
|
|
786
|
+
onShareVisual: h,
|
|
787
|
+
onDeleteVisual: (b) => {
|
|
788
|
+
k(b), f(!0);
|
|
789
|
+
},
|
|
790
|
+
onDuplicateVisual: ge,
|
|
791
|
+
duplicatingId: V,
|
|
792
|
+
isDeleting: Q,
|
|
793
|
+
isConsoleMode: x
|
|
794
|
+
}
|
|
795
|
+
) }),
|
|
796
|
+
/* @__PURE__ */ n("div", { className: "flex shrink-0 items-center justify-between gap-2 border-t border-border/60 px-3 py-2", children: [
|
|
797
|
+
/* @__PURE__ */ e("div", { className: "flex min-w-0 items-center gap-1.5", children: a.size > 0 && /* @__PURE__ */ n(_, { children: [
|
|
798
|
+
/* @__PURE__ */ n("span", { className: "text-[12px] text-muted-foreground", children: [
|
|
799
|
+
/* @__PURE__ */ e("span", { className: "font-medium tabular-nums text-foreground", children: a.size }),
|
|
800
|
+
" ",
|
|
801
|
+
"selected"
|
|
802
|
+
] }),
|
|
803
|
+
/* @__PURE__ */ e(
|
|
804
|
+
L,
|
|
805
|
+
{
|
|
806
|
+
size: "xs",
|
|
807
|
+
variant: "ghost",
|
|
808
|
+
onClick: () => c(/* @__PURE__ */ new Set()),
|
|
809
|
+
children: "Clear"
|
|
810
|
+
}
|
|
811
|
+
),
|
|
812
|
+
/* @__PURE__ */ n(
|
|
813
|
+
L,
|
|
814
|
+
{
|
|
815
|
+
size: "xs",
|
|
816
|
+
variant: "outline",
|
|
817
|
+
onClick: Ne,
|
|
818
|
+
disabled: te.length !== 1 || pe.length !== 1,
|
|
819
|
+
children: [
|
|
820
|
+
/* @__PURE__ */ e(Lt, { className: "h-3.5 w-3.5" }),
|
|
821
|
+
"Share"
|
|
822
|
+
]
|
|
823
|
+
}
|
|
824
|
+
),
|
|
825
|
+
/* @__PURE__ */ n(
|
|
826
|
+
L,
|
|
827
|
+
{
|
|
828
|
+
size: "xs",
|
|
829
|
+
variant: "outline",
|
|
830
|
+
className: "text-destructive hover:text-destructive",
|
|
831
|
+
onClick: Pe,
|
|
832
|
+
disabled: me.length === 0,
|
|
833
|
+
children: [
|
|
834
|
+
/* @__PURE__ */ e(Oe, { className: "h-3.5 w-3.5" }),
|
|
835
|
+
"Delete ",
|
|
836
|
+
me.length || a.size
|
|
837
|
+
]
|
|
838
|
+
}
|
|
839
|
+
)
|
|
840
|
+
] }) }),
|
|
841
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
|
|
842
|
+
/* @__PURE__ */ e(
|
|
843
|
+
L,
|
|
844
|
+
{
|
|
845
|
+
size: "xs",
|
|
846
|
+
variant: "outline",
|
|
847
|
+
onClick: () => oe(!1),
|
|
848
|
+
children: "Close"
|
|
849
|
+
}
|
|
850
|
+
),
|
|
851
|
+
/* @__PURE__ */ n(
|
|
852
|
+
L,
|
|
853
|
+
{
|
|
854
|
+
size: "xs",
|
|
855
|
+
onClick: we,
|
|
856
|
+
disabled: a.size === 0,
|
|
857
|
+
children: [
|
|
858
|
+
/* @__PURE__ */ e(yt, { className: "h-3.5 w-3.5" }),
|
|
859
|
+
a.size === 0 ? "Add to dashboard" : `Add ${a.size} visual${a.size === 1 ? "" : "s"}`
|
|
860
|
+
]
|
|
861
|
+
}
|
|
862
|
+
)
|
|
863
|
+
] })
|
|
864
|
+
] })
|
|
865
|
+
]
|
|
866
|
+
}
|
|
867
|
+
) }),
|
|
868
|
+
/* @__PURE__ */ e(
|
|
869
|
+
Lr,
|
|
870
|
+
{
|
|
871
|
+
open: d,
|
|
872
|
+
onOpenChange: l,
|
|
873
|
+
onSubmit: I,
|
|
874
|
+
isCreating: H
|
|
875
|
+
}
|
|
876
|
+
),
|
|
877
|
+
u && /* @__PURE__ */ e(
|
|
878
|
+
na,
|
|
879
|
+
{
|
|
880
|
+
resource: u,
|
|
881
|
+
resourceType: sa.VISUAL,
|
|
882
|
+
onClose: () => h(null)
|
|
883
|
+
}
|
|
884
|
+
),
|
|
885
|
+
m && /* @__PURE__ */ e(
|
|
886
|
+
oa,
|
|
887
|
+
{
|
|
888
|
+
open: !!m,
|
|
889
|
+
resourceLabel: "Visual",
|
|
890
|
+
initialTitle: m.title || "",
|
|
891
|
+
initialDescription: m.description || "",
|
|
892
|
+
onClose: () => p(null),
|
|
893
|
+
onSave: Se,
|
|
894
|
+
isSaving: ye(m.id)
|
|
895
|
+
}
|
|
896
|
+
),
|
|
897
|
+
/* @__PURE__ */ e(
|
|
898
|
+
lt,
|
|
899
|
+
{
|
|
900
|
+
open: g,
|
|
901
|
+
onOpenChange: (b) => {
|
|
902
|
+
!b && Q || (f(b), b || k(null));
|
|
903
|
+
},
|
|
904
|
+
children: /* @__PURE__ */ n(dt, { children: [
|
|
905
|
+
/* @__PURE__ */ n(ct, { children: [
|
|
906
|
+
/* @__PURE__ */ n(ut, { children: [
|
|
907
|
+
"Delete ",
|
|
908
|
+
ke,
|
|
909
|
+
" visual",
|
|
910
|
+
ke === 1 ? "" : "s",
|
|
911
|
+
"?"
|
|
912
|
+
] }),
|
|
913
|
+
/* @__PURE__ */ e(ht, { children: "This cannot be undone. Visuals already added to dashboards may need to be removed from those dashboards separately." })
|
|
914
|
+
] }),
|
|
915
|
+
/* @__PURE__ */ n(mt, { children: [
|
|
916
|
+
/* @__PURE__ */ e(pt, { disabled: Q, children: "Cancel" }),
|
|
917
|
+
/* @__PURE__ */ n(
|
|
918
|
+
Vt,
|
|
919
|
+
{
|
|
920
|
+
onClick: (b) => {
|
|
921
|
+
b.preventDefault(), Je();
|
|
922
|
+
},
|
|
923
|
+
disabled: Q || ke === 0,
|
|
924
|
+
children: [
|
|
925
|
+
Q ? /* @__PURE__ */ e(ne, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(Oe, { className: "h-3.5 w-3.5" }),
|
|
926
|
+
Q ? "Deleting..." : "Delete"
|
|
927
|
+
]
|
|
928
|
+
}
|
|
929
|
+
)
|
|
930
|
+
] })
|
|
931
|
+
] })
|
|
932
|
+
}
|
|
933
|
+
)
|
|
934
|
+
] });
|
|
935
|
+
}
|
|
936
|
+
function zr({
|
|
937
|
+
visuals: t,
|
|
938
|
+
selectedIds: r,
|
|
939
|
+
allFilteredSelected: o,
|
|
940
|
+
someFilteredSelected: s,
|
|
941
|
+
onSelectAll: i,
|
|
942
|
+
onToggleSelection: a,
|
|
943
|
+
onAddVisual: c,
|
|
944
|
+
onOpenVisual: d,
|
|
945
|
+
onEditDetails: l,
|
|
946
|
+
onShareVisual: u,
|
|
947
|
+
onDeleteVisual: h,
|
|
948
|
+
onDuplicateVisual: m,
|
|
949
|
+
duplicatingId: p,
|
|
950
|
+
isDeleting: g,
|
|
951
|
+
isConsoleMode: f
|
|
952
|
+
}) {
|
|
953
|
+
return /* @__PURE__ */ n("div", { className: "min-w-[48rem]", children: [
|
|
954
|
+
/* @__PURE__ */ n("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: [
|
|
955
|
+
/* @__PURE__ */ e(
|
|
956
|
+
ft,
|
|
957
|
+
{
|
|
958
|
+
checked: o ? !0 : s ? "indeterminate" : !1,
|
|
959
|
+
onCheckedChange: i,
|
|
960
|
+
"aria-label": "Select all visuals"
|
|
961
|
+
}
|
|
962
|
+
),
|
|
963
|
+
/* @__PURE__ */ e("span", { children: "Name" }),
|
|
964
|
+
/* @__PURE__ */ e("span", { children: "Created by" }),
|
|
965
|
+
/* @__PURE__ */ e("span", { children: "Updated" }),
|
|
966
|
+
/* @__PURE__ */ e("span", { children: "Visibility" }),
|
|
967
|
+
/* @__PURE__ */ e("span", { className: "text-right", children: "Shared" }),
|
|
968
|
+
/* @__PURE__ */ e("span", { className: "text-right", children: "Actions" })
|
|
969
|
+
] }),
|
|
970
|
+
t.map((v) => /* @__PURE__ */ e(
|
|
971
|
+
_r,
|
|
972
|
+
{
|
|
973
|
+
visual: v,
|
|
974
|
+
selected: r.has(v.id),
|
|
975
|
+
onToggleSelection: a,
|
|
976
|
+
onAddVisual: c,
|
|
977
|
+
onOpenVisual: d,
|
|
978
|
+
onEditDetails: l,
|
|
979
|
+
onShareVisual: u,
|
|
980
|
+
onDeleteVisual: h,
|
|
981
|
+
onDuplicateVisual: m,
|
|
982
|
+
duplicatingId: p,
|
|
983
|
+
isDeleting: g,
|
|
984
|
+
isConsoleMode: f
|
|
985
|
+
},
|
|
986
|
+
v.id
|
|
987
|
+
))
|
|
988
|
+
] });
|
|
989
|
+
}
|
|
990
|
+
function _r({
|
|
991
|
+
visual: t,
|
|
992
|
+
selected: r,
|
|
993
|
+
onToggleSelection: o,
|
|
994
|
+
onAddVisual: s,
|
|
995
|
+
onOpenVisual: i,
|
|
996
|
+
onEditDetails: a,
|
|
997
|
+
onShareVisual: c,
|
|
998
|
+
onDeleteVisual: d,
|
|
999
|
+
onDuplicateVisual: l,
|
|
1000
|
+
duplicatingId: u,
|
|
1001
|
+
isDeleting: h,
|
|
1002
|
+
isConsoleMode: m
|
|
1003
|
+
}) {
|
|
1004
|
+
var f;
|
|
1005
|
+
const p = Ur(t.kind), g = () => {
|
|
1006
|
+
s(t);
|
|
1007
|
+
};
|
|
1008
|
+
return /* @__PURE__ */ n(
|
|
1009
|
+
"div",
|
|
1010
|
+
{
|
|
1011
|
+
className: J(
|
|
1012
|
+
"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",
|
|
1013
|
+
r && "bg-muted/70"
|
|
1014
|
+
),
|
|
1015
|
+
children: [
|
|
1016
|
+
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
|
|
1017
|
+
ft,
|
|
1018
|
+
{
|
|
1019
|
+
checked: r,
|
|
1020
|
+
onCheckedChange: () => o(t.id),
|
|
1021
|
+
"aria-label": `Select ${t.title || "visual"}`
|
|
1022
|
+
}
|
|
1023
|
+
) }),
|
|
1024
|
+
/* @__PURE__ */ n(
|
|
1025
|
+
"button",
|
|
1026
|
+
{
|
|
1027
|
+
type: "button",
|
|
1028
|
+
className: "flex min-w-0 items-center gap-2 rounded-[4px] text-left outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
1029
|
+
onClick: g,
|
|
1030
|
+
"aria-label": `Add ${t.title || "visual"} to dashboard`,
|
|
1031
|
+
children: [
|
|
1032
|
+
/* @__PURE__ */ e(p, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
1033
|
+
/* @__PURE__ */ n("div", { className: "min-w-0", children: [
|
|
1034
|
+
/* @__PURE__ */ e(
|
|
1035
|
+
"div",
|
|
1036
|
+
{
|
|
1037
|
+
className: "truncate font-medium text-foreground",
|
|
1038
|
+
title: t.title || "Untitled Visual",
|
|
1039
|
+
children: t.title || "Untitled Visual"
|
|
1040
|
+
}
|
|
1041
|
+
),
|
|
1042
|
+
((f = t.description) == null ? void 0 : f.trim()) && /* @__PURE__ */ e(
|
|
1043
|
+
"div",
|
|
1044
|
+
{
|
|
1045
|
+
className: "truncate text-[11px] text-muted-foreground",
|
|
1046
|
+
title: t.description,
|
|
1047
|
+
children: t.description
|
|
1048
|
+
}
|
|
1049
|
+
)
|
|
1050
|
+
] })
|
|
1051
|
+
]
|
|
1052
|
+
}
|
|
1053
|
+
),
|
|
1054
|
+
/* @__PURE__ */ n("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
1055
|
+
/* @__PURE__ */ e("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: Mr(t, m) }),
|
|
1056
|
+
/* @__PURE__ */ e("span", { className: "truncate text-muted-foreground", children: Nt(t, m) })
|
|
1057
|
+
] }),
|
|
1058
|
+
/* @__PURE__ */ e("span", { className: "text-muted-foreground", children: Wt(t.updatedAt) }),
|
|
1059
|
+
/* @__PURE__ */ e(Rr, { visual: t }),
|
|
1060
|
+
/* @__PURE__ */ e("span", { className: "text-right tabular-nums text-muted-foreground", children: t.ownership.sharedCount > 0 ? t.ownership.sharedCount : "—" }),
|
|
1061
|
+
/* @__PURE__ */ e(
|
|
1062
|
+
Or,
|
|
1063
|
+
{
|
|
1064
|
+
visual: t,
|
|
1065
|
+
onOpenVisual: i,
|
|
1066
|
+
onEditDetails: a,
|
|
1067
|
+
onShareVisual: c,
|
|
1068
|
+
onDeleteVisual: d,
|
|
1069
|
+
onDuplicateVisual: l,
|
|
1070
|
+
duplicatingId: u,
|
|
1071
|
+
isDeleting: h,
|
|
1072
|
+
isConsoleMode: m
|
|
1073
|
+
}
|
|
1074
|
+
)
|
|
1075
|
+
]
|
|
1076
|
+
}
|
|
1077
|
+
);
|
|
1078
|
+
}
|
|
1079
|
+
function Or({
|
|
1080
|
+
visual: t,
|
|
1081
|
+
onOpenVisual: r,
|
|
1082
|
+
onEditDetails: o,
|
|
1083
|
+
onShareVisual: s,
|
|
1084
|
+
onDeleteVisual: i,
|
|
1085
|
+
onDuplicateVisual: a,
|
|
1086
|
+
duplicatingId: c,
|
|
1087
|
+
isDeleting: d,
|
|
1088
|
+
isConsoleMode: l
|
|
1089
|
+
}) {
|
|
1090
|
+
return /* @__PURE__ */ n(
|
|
1091
|
+
"div",
|
|
1092
|
+
{
|
|
1093
|
+
className: "flex items-center justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100",
|
|
1094
|
+
onClick: (u) => u.stopPropagation(),
|
|
1095
|
+
children: [
|
|
1096
|
+
/* @__PURE__ */ e(
|
|
1097
|
+
L,
|
|
1098
|
+
{
|
|
1099
|
+
size: "xs",
|
|
1100
|
+
variant: "ghost",
|
|
1101
|
+
className: "w-7 px-0",
|
|
1102
|
+
onClick: () => r(t),
|
|
1103
|
+
"aria-label": "Edit visual",
|
|
1104
|
+
children: /* @__PURE__ */ e(et, { className: "h-3.5 w-3.5" })
|
|
1105
|
+
}
|
|
1106
|
+
),
|
|
1107
|
+
/* @__PURE__ */ n(Le, { modal: !1, children: [
|
|
1108
|
+
/* @__PURE__ */ e(Ve, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1109
|
+
L,
|
|
1110
|
+
{
|
|
1111
|
+
size: "xs",
|
|
1112
|
+
variant: "ghost",
|
|
1113
|
+
className: "w-7 px-0",
|
|
1114
|
+
"aria-label": "More actions",
|
|
1115
|
+
children: /* @__PURE__ */ e(Tt, { className: "h-3.5 w-3.5" })
|
|
1116
|
+
}
|
|
1117
|
+
) }),
|
|
1118
|
+
/* @__PURE__ */ n(
|
|
1119
|
+
Te,
|
|
1120
|
+
{
|
|
1121
|
+
align: "end",
|
|
1122
|
+
className: "z-[60] w-44 rounded-[6px] border-border/60 p-1 shadow-sm",
|
|
1123
|
+
children: [
|
|
1124
|
+
/* @__PURE__ */ n(X, { onClick: () => r(t), children: [
|
|
1125
|
+
/* @__PURE__ */ e(et, { className: "h-3.5 w-3.5" }),
|
|
1126
|
+
"Edit visual"
|
|
1127
|
+
] }),
|
|
1128
|
+
/* @__PURE__ */ n(
|
|
1129
|
+
X,
|
|
1130
|
+
{
|
|
1131
|
+
onClick: () => a(t.id),
|
|
1132
|
+
disabled: c === t.id,
|
|
1133
|
+
children: [
|
|
1134
|
+
c === t.id ? /* @__PURE__ */ e(ne, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(da, { className: "h-3.5 w-3.5" }),
|
|
1135
|
+
c === t.id ? "Duplicating..." : "Duplicate"
|
|
1136
|
+
]
|
|
1137
|
+
}
|
|
1138
|
+
),
|
|
1139
|
+
t.permissions.canEdit && /* @__PURE__ */ n(X, { onClick: () => o(t), children: [
|
|
1140
|
+
/* @__PURE__ */ e(et, { className: "h-3.5 w-3.5" }),
|
|
1141
|
+
"Edit details"
|
|
1142
|
+
] }),
|
|
1143
|
+
t.permissions.canShare && /* @__PURE__ */ n(X, { onClick: () => s(t), children: [
|
|
1144
|
+
/* @__PURE__ */ e(Lt, { className: "h-3.5 w-3.5" }),
|
|
1145
|
+
"Share"
|
|
1146
|
+
] }),
|
|
1147
|
+
t.permissions.canDelete && /* @__PURE__ */ n(_, { children: [
|
|
1148
|
+
/* @__PURE__ */ e(je, {}),
|
|
1149
|
+
/* @__PURE__ */ n(
|
|
1150
|
+
X,
|
|
1151
|
+
{
|
|
1152
|
+
className: "text-destructive focus:bg-destructive/10 focus:text-destructive",
|
|
1153
|
+
onClick: () => i(t),
|
|
1154
|
+
disabled: d,
|
|
1155
|
+
children: [
|
|
1156
|
+
/* @__PURE__ */ e(Oe, { className: "h-3.5 w-3.5" }),
|
|
1157
|
+
d ? "Deleting..." : "Delete"
|
|
1158
|
+
]
|
|
1159
|
+
}
|
|
1160
|
+
)
|
|
1161
|
+
] }),
|
|
1162
|
+
/* @__PURE__ */ e(je, {}),
|
|
1163
|
+
/* @__PURE__ */ n("div", { className: "space-y-1 px-2 py-1.5 text-[11px] text-muted-foreground", children: [
|
|
1164
|
+
qt(t, l) && /* @__PURE__ */ n("div", { className: "flex items-center gap-1.5", children: [
|
|
1165
|
+
/* @__PURE__ */ e(ca, { className: "h-3 w-3" }),
|
|
1166
|
+
/* @__PURE__ */ e("span", { className: "truncate", children: Nt(t, l) })
|
|
1167
|
+
] }),
|
|
1168
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-1.5", children: [
|
|
1169
|
+
/* @__PURE__ */ e(ua, { className: "h-3 w-3" }),
|
|
1170
|
+
/* @__PURE__ */ e("span", { children: Wt(t.updatedAt) })
|
|
1171
|
+
] })
|
|
1172
|
+
] })
|
|
1173
|
+
]
|
|
1174
|
+
}
|
|
1175
|
+
)
|
|
1176
|
+
] })
|
|
1177
|
+
]
|
|
1178
|
+
}
|
|
1179
|
+
);
|
|
1180
|
+
}
|
|
1181
|
+
function as(t, r, o = !1) {
|
|
1182
|
+
const s = C((u) => u.dashboard), i = C(
|
|
1183
|
+
(u) => u.isDashboardEditing
|
|
1184
|
+
), a = C(
|
|
1185
|
+
(u) => u.onDashboardLifecycleEvent
|
|
1186
|
+
), c = ae(() => {
|
|
1187
|
+
const u = C.getState().dashboard;
|
|
1188
|
+
return r || !t || !u || u.id !== t.id ? !1 : ze(u) !== ze(t);
|
|
1189
|
+
}, [t, r]);
|
|
1190
|
+
kt(() => (C.setState({ checkUnsavedDashboardChanges: c }), () => {
|
|
1191
|
+
C.getState().checkUnsavedDashboardChanges === c && C.setState({ checkUnsavedDashboardChanges: null });
|
|
1192
|
+
}), [c]);
|
|
1193
|
+
const d = re(() => !o || r || !s || i && (!t || s.id !== t.id) ? null : {
|
|
1194
|
+
dashboardId: s.id,
|
|
1195
|
+
dirty: i && t ? ze(s) !== ze(t) : !1
|
|
1196
|
+
}, [
|
|
1197
|
+
i,
|
|
1198
|
+
r,
|
|
1199
|
+
o,
|
|
1200
|
+
t,
|
|
1201
|
+
s
|
|
1202
|
+
]), l = nt(null);
|
|
1203
|
+
return kt(() => {
|
|
1204
|
+
if (!a || !d) {
|
|
1205
|
+
l.current = null;
|
|
1206
|
+
return;
|
|
1207
|
+
}
|
|
1208
|
+
const u = l.current;
|
|
1209
|
+
(u == null ? void 0 : u.callback) === a && u.dashboardId === d.dashboardId && u.dirty === d.dirty || (l.current = {
|
|
1210
|
+
callback: a,
|
|
1211
|
+
dashboardId: d.dashboardId,
|
|
1212
|
+
dirty: d.dirty
|
|
1213
|
+
}, a({
|
|
1214
|
+
type: "dashboard:dirty-state",
|
|
1215
|
+
dashboardId: d.dashboardId,
|
|
1216
|
+
payload: { dirty: d.dirty }
|
|
1217
|
+
}));
|
|
1218
|
+
}, [d, a]), c;
|
|
1219
|
+
}
|
|
1220
|
+
function jr({
|
|
1221
|
+
open: t,
|
|
1222
|
+
onOpenChange: r,
|
|
1223
|
+
isLibraryVisual: o,
|
|
1224
|
+
currentVisualName: s,
|
|
1225
|
+
isSaving: i = !1,
|
|
1226
|
+
destinationMode: a = "both",
|
|
1227
|
+
onConfirm: c
|
|
1228
|
+
}) {
|
|
1229
|
+
const [d, l] = D(
|
|
1230
|
+
o && s ? `Copy of ${s}` : s || ""
|
|
1231
|
+
), [u, h] = D("");
|
|
1232
|
+
Et.useEffect(() => {
|
|
1233
|
+
t && (l(
|
|
1234
|
+
o && s ? `Copy of ${s}` : s || ""
|
|
1235
|
+
), h(""));
|
|
1236
|
+
}, [t, o, s]);
|
|
1237
|
+
const m = !!d.trim(), p = a === "local" ? {
|
|
1238
|
+
saveToLibrary: !1,
|
|
1239
|
+
saveToCurrentDashboard: !0,
|
|
1240
|
+
badgeType: "local",
|
|
1241
|
+
description: "Creates a local copy on the current dashboard.",
|
|
1242
|
+
actionLabel: "Add to Dashboard (Local)"
|
|
1243
|
+
} : a === "library" ? {
|
|
1244
|
+
saveToLibrary: !0,
|
|
1245
|
+
saveToCurrentDashboard: !1,
|
|
1246
|
+
badgeType: "library",
|
|
1247
|
+
description: "Creates a reusable visual in Visual Library.",
|
|
1248
|
+
actionLabel: "Save as Library Visual"
|
|
1249
|
+
} : {
|
|
1250
|
+
saveToLibrary: !0,
|
|
1251
|
+
saveToCurrentDashboard: !0,
|
|
1252
|
+
badgeType: "linked",
|
|
1253
|
+
description: "Creates a new library visual and adds a linked copy to this dashboard.",
|
|
1254
|
+
actionLabel: "Save Copy as Linked Visual"
|
|
1255
|
+
}, g = () => {
|
|
1256
|
+
!m || i || c({
|
|
1257
|
+
name: d.trim(),
|
|
1258
|
+
description: u.trim() || void 0,
|
|
1259
|
+
saveToLibrary: p.saveToLibrary,
|
|
1260
|
+
saveToCurrentDashboard: p.saveToCurrentDashboard
|
|
1261
|
+
});
|
|
1262
|
+
};
|
|
1263
|
+
return /* @__PURE__ */ e(Fe, { open: t, onOpenChange: r, children: /* @__PURE__ */ n(Ee, { className: "sm:max-w-[500px]", children: [
|
|
1264
|
+
/* @__PURE__ */ n(gt, { children: [
|
|
1265
|
+
/* @__PURE__ */ n(Ie, { className: "flex items-center gap-2", children: [
|
|
1266
|
+
/* @__PURE__ */ e("span", { children: "Save Visual As" }),
|
|
1267
|
+
p.badgeType !== "local" && /* @__PURE__ */ e(
|
|
1268
|
+
pr,
|
|
1269
|
+
{
|
|
1270
|
+
type: p.badgeType,
|
|
1271
|
+
showLabel: !0,
|
|
1272
|
+
className: "px-2 py-0.5"
|
|
1273
|
+
}
|
|
1274
|
+
)
|
|
1275
|
+
] }),
|
|
1276
|
+
/* @__PURE__ */ e(bt, { children: p.description })
|
|
1277
|
+
] }),
|
|
1278
|
+
/* @__PURE__ */ n("div", { className: "grid gap-4 py-4", children: [
|
|
1279
|
+
/* @__PURE__ */ n("div", { className: "grid gap-2", children: [
|
|
1280
|
+
/* @__PURE__ */ e(De, { htmlFor: "name", children: "Name" }),
|
|
1281
|
+
/* @__PURE__ */ e(
|
|
1282
|
+
st,
|
|
1283
|
+
{
|
|
1284
|
+
id: "name",
|
|
1285
|
+
value: d,
|
|
1286
|
+
onChange: (f) => l(f.target.value),
|
|
1287
|
+
placeholder: "Enter visual name",
|
|
1288
|
+
disabled: i
|
|
1289
|
+
}
|
|
1290
|
+
)
|
|
1291
|
+
] }),
|
|
1292
|
+
/* @__PURE__ */ n("div", { className: "grid gap-2", children: [
|
|
1293
|
+
/* @__PURE__ */ e(De, { htmlFor: "description", children: "Description (optional)" }),
|
|
1294
|
+
/* @__PURE__ */ e(
|
|
1295
|
+
ha,
|
|
1296
|
+
{
|
|
1297
|
+
id: "description",
|
|
1298
|
+
value: u,
|
|
1299
|
+
onChange: (f) => h(f.target.value),
|
|
1300
|
+
placeholder: "Enter visual description",
|
|
1301
|
+
rows: 3,
|
|
1302
|
+
disabled: i
|
|
1303
|
+
}
|
|
1304
|
+
)
|
|
1305
|
+
] })
|
|
1306
|
+
] }),
|
|
1307
|
+
/* @__PURE__ */ n(ma, { children: [
|
|
1308
|
+
/* @__PURE__ */ e(
|
|
1309
|
+
L,
|
|
1310
|
+
{
|
|
1311
|
+
variant: "outline",
|
|
1312
|
+
onClick: () => r(!1),
|
|
1313
|
+
disabled: i,
|
|
1314
|
+
children: "Cancel"
|
|
1315
|
+
}
|
|
1316
|
+
),
|
|
1317
|
+
/* @__PURE__ */ n(L, { onClick: g, disabled: !m || i, children: [
|
|
1318
|
+
i && /* @__PURE__ */ e(ne, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
1319
|
+
p.actionLabel
|
|
1320
|
+
] })
|
|
1321
|
+
] })
|
|
1322
|
+
] }) });
|
|
1323
|
+
}
|
|
1324
|
+
function St(t) {
|
|
1325
|
+
var r;
|
|
1326
|
+
for (const o of t.cards)
|
|
1327
|
+
if (o.type === "matrixTable" && !ar.safeParse((r = o.config) == null ? void 0 : r.matrix).success)
|
|
1328
|
+
return F.error("Matrix requires at least one row field, one metric, and valid settings."), !1;
|
|
1329
|
+
return !0;
|
|
1330
|
+
}
|
|
1331
|
+
function tt({
|
|
1332
|
+
className: t,
|
|
1333
|
+
variant: r = "outline"
|
|
1334
|
+
}) {
|
|
1335
|
+
const o = ee((a) => a.onSave), { getUpdatedFrame: s } = ve();
|
|
1336
|
+
function i() {
|
|
1337
|
+
const a = s();
|
|
1338
|
+
St(a) && (o == null || o(a));
|
|
1339
|
+
}
|
|
1340
|
+
return /* @__PURE__ */ n(
|
|
1341
|
+
L,
|
|
1342
|
+
{
|
|
1343
|
+
onClick: i,
|
|
1344
|
+
className: t,
|
|
1345
|
+
size: "xs",
|
|
1346
|
+
variant: r,
|
|
1347
|
+
children: [
|
|
1348
|
+
/* @__PURE__ */ e(yt, { className: "h-3.5 w-3.5" }),
|
|
1349
|
+
"Done"
|
|
1350
|
+
]
|
|
1351
|
+
}
|
|
1352
|
+
);
|
|
1353
|
+
}
|
|
1354
|
+
function $r({
|
|
1355
|
+
className: t,
|
|
1356
|
+
variant: r = "default"
|
|
1357
|
+
}) {
|
|
1358
|
+
const o = Qe(), [s, i] = D(!1), { setIsVisualEditing: a } = de(), { getUpdatedFrame: c } = ve(), d = Ge(), l = ee((m) => m.frame), u = Bt();
|
|
1359
|
+
return /* @__PURE__ */ e(
|
|
1360
|
+
L,
|
|
1361
|
+
{
|
|
1362
|
+
onClick: () => {
|
|
1363
|
+
const m = c();
|
|
1364
|
+
if (!St(m))
|
|
1365
|
+
return;
|
|
1366
|
+
const p = (l == null ? void 0 : l.visualId) || (d == null ? void 0 : d.id);
|
|
1367
|
+
if (!p) {
|
|
1368
|
+
F.error("No visual to save");
|
|
1369
|
+
return;
|
|
1370
|
+
}
|
|
1371
|
+
i(!0), u.mutate(
|
|
1372
|
+
{
|
|
1373
|
+
visualId: p,
|
|
1374
|
+
data: {
|
|
1375
|
+
frameObject: m
|
|
1376
|
+
}
|
|
1377
|
+
},
|
|
1378
|
+
{
|
|
1379
|
+
onSuccess: () => {
|
|
1380
|
+
i(!1), F.success("Visual updated successfully"), o.invalidateQueries({
|
|
1381
|
+
queryKey: ["resource-by-id", "visual", p],
|
|
1382
|
+
exact: !0
|
|
1383
|
+
});
|
|
1384
|
+
},
|
|
1385
|
+
onError: () => {
|
|
1386
|
+
i(!1), F.error("Failed to update visual");
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
);
|
|
1390
|
+
},
|
|
1391
|
+
className: t,
|
|
1392
|
+
size: "xs",
|
|
1393
|
+
variant: r,
|
|
1394
|
+
children: s ? /* @__PURE__ */ n(_, { children: [
|
|
1395
|
+
/* @__PURE__ */ e(ne, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
1396
|
+
"Saving"
|
|
1397
|
+
] }) : /* @__PURE__ */ n(_, { children: [
|
|
1398
|
+
/* @__PURE__ */ e(_t, { className: "h-3.5 w-3.5" }),
|
|
1399
|
+
"Save to Library"
|
|
1400
|
+
] })
|
|
1401
|
+
}
|
|
1402
|
+
);
|
|
1403
|
+
}
|
|
1404
|
+
function Wr({
|
|
1405
|
+
className: t
|
|
1406
|
+
}) {
|
|
1407
|
+
const r = Qe(), [o, s] = D(!1), i = Ge(), a = ee((f) => f.frame), c = C((f) => f.selectedSheetId), d = C((f) => f.dashboard), { updateFrame: l, setIsVisualEditing: u } = de(), { getUpdatedFrame: h } = ve(), m = Bt(), p = xt();
|
|
1408
|
+
return /* @__PURE__ */ e(
|
|
1409
|
+
L,
|
|
1410
|
+
{
|
|
1411
|
+
onClick: async () => {
|
|
1412
|
+
if (!c) {
|
|
1413
|
+
F.error("No sheet selected");
|
|
1414
|
+
return;
|
|
1415
|
+
}
|
|
1416
|
+
const f = (a == null ? void 0 : a.visualId) || (i == null ? void 0 : i.id);
|
|
1417
|
+
if (!f) {
|
|
1418
|
+
F.error("No visual to update");
|
|
1419
|
+
return;
|
|
1420
|
+
}
|
|
1421
|
+
s(!0);
|
|
1422
|
+
try {
|
|
1423
|
+
const v = h();
|
|
1424
|
+
if (!St(v)) {
|
|
1425
|
+
s(!1);
|
|
1426
|
+
return;
|
|
1427
|
+
}
|
|
1428
|
+
const k = {
|
|
1429
|
+
...v,
|
|
1430
|
+
visualId: f
|
|
1431
|
+
// Keep the link to library visual
|
|
1432
|
+
}, V = He(d, k.id), M = await p(k, {
|
|
1433
|
+
previousFrame: V
|
|
1434
|
+
});
|
|
1435
|
+
await m.mutateAsync({
|
|
1436
|
+
visualId: f,
|
|
1437
|
+
data: {
|
|
1438
|
+
frameObject: v
|
|
1439
|
+
}
|
|
1440
|
+
}), l(c, k, {
|
|
1441
|
+
semanticExecutionPayload: M
|
|
1442
|
+
}), r.invalidateQueries({ queryKey: ["visuals"] }), r.invalidateQueries({ queryKey: ["visual", f] }), F.success("Saved to library and applied locally"), setTimeout(() => {
|
|
1443
|
+
u(!1);
|
|
1444
|
+
}, 300);
|
|
1445
|
+
} catch (v) {
|
|
1446
|
+
console.error("Failed to save and apply:", v), F.error(
|
|
1447
|
+
v instanceof Error ? v.message : "Failed to save and apply changes"
|
|
1448
|
+
);
|
|
1449
|
+
} finally {
|
|
1450
|
+
s(!1);
|
|
1451
|
+
}
|
|
1452
|
+
},
|
|
1453
|
+
className: t,
|
|
1454
|
+
size: "xs",
|
|
1455
|
+
variant: "default",
|
|
1456
|
+
disabled: o,
|
|
1457
|
+
children: o ? /* @__PURE__ */ n(_, { children: [
|
|
1458
|
+
/* @__PURE__ */ e(ne, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
1459
|
+
"Saving..."
|
|
1460
|
+
] }) : /* @__PURE__ */ n(_, { children: [
|
|
1461
|
+
/* @__PURE__ */ e(_t, { className: "h-3.5 w-3.5" }),
|
|
1462
|
+
"Save & Apply"
|
|
1463
|
+
] })
|
|
1464
|
+
}
|
|
1465
|
+
);
|
|
1466
|
+
}
|
|
1467
|
+
function at({ className: t }) {
|
|
1468
|
+
const { setTempQueryData: r, setSqlGen: o } = Ke(), s = Qe(), i = ee((d) => d.tempQueryData), a = ee((d) => d.onClose);
|
|
1469
|
+
function c() {
|
|
1470
|
+
if (i) {
|
|
1471
|
+
const { queryKey: d, queryData: l } = i;
|
|
1472
|
+
d && l && s.setQueryData(d, l);
|
|
1473
|
+
}
|
|
1474
|
+
o({}), a == null || a();
|
|
1475
|
+
}
|
|
1476
|
+
return /* @__PURE__ */ n(
|
|
1477
|
+
L,
|
|
1478
|
+
{
|
|
1479
|
+
onClick: c,
|
|
1480
|
+
className: t,
|
|
1481
|
+
size: "xs",
|
|
1482
|
+
variant: "outline",
|
|
1483
|
+
children: [
|
|
1484
|
+
/* @__PURE__ */ e(Xe, { className: "h-3.5 w-3.5" }),
|
|
1485
|
+
"Close"
|
|
1486
|
+
]
|
|
1487
|
+
}
|
|
1488
|
+
);
|
|
1489
|
+
}
|
|
1490
|
+
function qr() {
|
|
1491
|
+
const [t, r] = D(!1), [o, s] = D(!1), [i, a] = D(null), [c, d] = D(null), l = ee((N) => N.frame), u = ee((N) => N.card), h = Ge(), m = C((N) => N.selectedSheetId), p = C((N) => N.dashboard), { getUpdatedFrame: g } = ve(), { selectVisual: f } = it(), { addFrame: v, setSelectedFrameId: k, setIsVisualEditing: V } = de(), M = xt(), U = !!(l != null && l.visualId), A = (() => {
|
|
1492
|
+
var N, x;
|
|
1493
|
+
return ((N = l == null ? void 0 : l.cards) == null ? void 0 : N.length) === 1 && ((x = l.cards[0]) != null && x.title) ? l.cards[0].title : h != null && h.title ? h.title : (u == null ? void 0 : u.title) || "Untitled Visual";
|
|
1494
|
+
})(), z = pa((N) => {
|
|
1495
|
+
N != null && N.id && (f(N), o && i && c && m && (async () => {
|
|
1496
|
+
try {
|
|
1497
|
+
const x = {
|
|
1498
|
+
...i,
|
|
1499
|
+
id: Dt(),
|
|
1500
|
+
visualId: N.id
|
|
1501
|
+
// Link to the newly created library visual
|
|
1502
|
+
};
|
|
1503
|
+
v(m, x, {
|
|
1504
|
+
semanticExecutionPayload: c
|
|
1505
|
+
}), k(x.id), s(!1), a(null), d(null), V(!1);
|
|
1506
|
+
} catch (x) {
|
|
1507
|
+
console.error(
|
|
1508
|
+
"Failed to promote semantic metadata for saved visual:",
|
|
1509
|
+
x
|
|
1510
|
+
), F.error(
|
|
1511
|
+
x instanceof Error ? x.message : "Failed to prepare semantic metadata for the saved visual"
|
|
1512
|
+
);
|
|
1513
|
+
}
|
|
1514
|
+
})(), r(!1));
|
|
1515
|
+
});
|
|
1516
|
+
return {
|
|
1517
|
+
saveAsDialogOpen: t,
|
|
1518
|
+
setSaveAsDialogOpen: r,
|
|
1519
|
+
handleSaveAs: async (N) => {
|
|
1520
|
+
if (!m) {
|
|
1521
|
+
F.error("No sheet selected");
|
|
1522
|
+
return;
|
|
1523
|
+
}
|
|
1524
|
+
const x = g(), S = x.cards.length === 1 ? {
|
|
1525
|
+
...x,
|
|
1526
|
+
cards: x.cards.map((j) => ({
|
|
1527
|
+
...j,
|
|
1528
|
+
title: N.name
|
|
1529
|
+
// Use visual name as card title
|
|
1530
|
+
}))
|
|
1531
|
+
} : x;
|
|
1532
|
+
if (N.saveToLibrary) {
|
|
1533
|
+
let j = null;
|
|
1534
|
+
if (N.saveToCurrentDashboard)
|
|
1535
|
+
try {
|
|
1536
|
+
j = await M(S, {
|
|
1537
|
+
previousFrame: He(p, S.id)
|
|
1538
|
+
});
|
|
1539
|
+
} catch (T) {
|
|
1540
|
+
console.error(
|
|
1541
|
+
"Failed to prepare semantic metadata before saving visual:",
|
|
1542
|
+
T
|
|
1543
|
+
), F.error(
|
|
1544
|
+
T instanceof Error ? T.message : "Failed to prepare semantic metadata for the saved visual"
|
|
1545
|
+
);
|
|
1546
|
+
return;
|
|
1547
|
+
}
|
|
1548
|
+
s(N.saveToCurrentDashboard), a(S), d(j);
|
|
1549
|
+
const I = {
|
|
1550
|
+
title: N.name,
|
|
1551
|
+
description: N.description,
|
|
1552
|
+
frameObject: S,
|
|
1553
|
+
// Card title synced for single-card frames
|
|
1554
|
+
isPrivate: !1
|
|
1555
|
+
};
|
|
1556
|
+
z.mutate(I);
|
|
1557
|
+
} else if (N.saveToCurrentDashboard) {
|
|
1558
|
+
const j = {
|
|
1559
|
+
...S,
|
|
1560
|
+
// Card title already synced
|
|
1561
|
+
id: Dt(),
|
|
1562
|
+
visualId: void 0
|
|
1563
|
+
// Explicitly no visualId for local visuals
|
|
1564
|
+
};
|
|
1565
|
+
try {
|
|
1566
|
+
const I = await M(S, {
|
|
1567
|
+
previousFrame: He(p, S.id)
|
|
1568
|
+
});
|
|
1569
|
+
v(m, j, {
|
|
1570
|
+
semanticExecutionPayload: I
|
|
1571
|
+
}), k(j.id), F.success("Visual saved to dashboard"), r(!1), V(!1);
|
|
1572
|
+
} catch (I) {
|
|
1573
|
+
console.error("Failed to save visual to dashboard:", I), F.error(
|
|
1574
|
+
I instanceof Error ? I.message : "Failed to prepare semantic metadata for the visual"
|
|
1575
|
+
);
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
},
|
|
1579
|
+
isLibraryVisual: U,
|
|
1580
|
+
currentVisualName: A,
|
|
1581
|
+
isSaving: z.isPending
|
|
1582
|
+
};
|
|
1583
|
+
}
|
|
1584
|
+
function rs(t = {}) {
|
|
1585
|
+
const { isInspectionMode: r } = fa(), o = ee((I) => I.frame), s = ee((I) => I.editorContext), i = ga((I) => I.selectedVisual), a = C((I) => I.selectedFrameId), c = C((I) => I.selectedSheetId), d = C((I) => I.dashboard), { setIsVisualEditing: l, updateFrame: u } = de(), [h, m] = D(!1), [p, g] = D("both"), f = xt(), v = (s == null ? void 0 : s.type) === "documentSection", k = !!(o != null && o.visualId || i != null && i.id), V = !!(o != null && o.visualId && a), M = k && !V, {
|
|
1586
|
+
saveAsDialogOpen: U,
|
|
1587
|
+
setSaveAsDialogOpen: A,
|
|
1588
|
+
handleSaveAs: z,
|
|
1589
|
+
isLibraryVisual: w,
|
|
1590
|
+
currentVisualName: N,
|
|
1591
|
+
isSaving: x
|
|
1592
|
+
} = qr(), { getUpdatedFrame: E } = ve();
|
|
1593
|
+
if (r)
|
|
1594
|
+
return /* @__PURE__ */ n(_, { children: [
|
|
1595
|
+
/* @__PURE__ */ e(
|
|
1596
|
+
tt,
|
|
1597
|
+
{
|
|
1598
|
+
className: "rounded-control",
|
|
1599
|
+
variant: "default"
|
|
1600
|
+
}
|
|
1601
|
+
),
|
|
1602
|
+
/* @__PURE__ */ e(at, {})
|
|
1603
|
+
] });
|
|
1604
|
+
if (v)
|
|
1605
|
+
return /* @__PURE__ */ n(_, { children: [
|
|
1606
|
+
/* @__PURE__ */ e(tt, { className: "rounded-control", variant: "default" }),
|
|
1607
|
+
/* @__PURE__ */ e(at, {})
|
|
1608
|
+
] });
|
|
1609
|
+
const S = async () => {
|
|
1610
|
+
if (!c) {
|
|
1611
|
+
F.error("No sheet selected");
|
|
1612
|
+
return;
|
|
1613
|
+
}
|
|
1614
|
+
if (h) return;
|
|
1615
|
+
m(!0);
|
|
1616
|
+
const T = {
|
|
1617
|
+
...E(),
|
|
1618
|
+
visualId: void 0
|
|
1619
|
+
}, Z = He(d, T.id);
|
|
1620
|
+
try {
|
|
1621
|
+
const G = await f(T, {
|
|
1622
|
+
previousFrame: Z
|
|
1623
|
+
});
|
|
1624
|
+
u(c, T, {
|
|
1625
|
+
semanticExecutionPayload: G
|
|
1626
|
+
});
|
|
1627
|
+
} catch (G) {
|
|
1628
|
+
console.error("Failed to apply local semantic metadata:", G), m(!1), F.error(
|
|
1629
|
+
G instanceof Error ? G.message : "Failed to prepare semantic metadata for this visual"
|
|
1630
|
+
);
|
|
1631
|
+
return;
|
|
1632
|
+
}
|
|
1633
|
+
setTimeout(() => {
|
|
1634
|
+
m(!1), F.success("Changes applied. Visual is now local to this dashboard"), l(!1);
|
|
1635
|
+
}, 300);
|
|
1636
|
+
}, j = (I) => {
|
|
1637
|
+
g(I), A(!0);
|
|
1638
|
+
};
|
|
1639
|
+
return /* @__PURE__ */ n(_, { children: [
|
|
1640
|
+
/* @__PURE__ */ n("div", { className: "inline-flex items-center overflow-hidden rounded-control", children: [
|
|
1641
|
+
!k && /* @__PURE__ */ e(tt, { className: "!rounded-none", variant: "default" }),
|
|
1642
|
+
k && M && /* @__PURE__ */ e($r, { className: "!rounded-none", variant: "default" }),
|
|
1643
|
+
k && V && /* @__PURE__ */ e(Wr, { className: "!rounded-none" }),
|
|
1644
|
+
/* @__PURE__ */ n(Le, { modal: !1, children: [
|
|
1645
|
+
/* @__PURE__ */ e(Ve, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1646
|
+
L,
|
|
1647
|
+
{
|
|
1648
|
+
variant: "default",
|
|
1649
|
+
size: "xs",
|
|
1650
|
+
className: "w-7 !rounded-none border-l border-primary-foreground/20 px-0",
|
|
1651
|
+
"aria-label": "Open visual save options",
|
|
1652
|
+
disabled: x || h,
|
|
1653
|
+
children: /* @__PURE__ */ e(Ct, { className: "h-3.5 w-3.5" })
|
|
1654
|
+
}
|
|
1655
|
+
) }),
|
|
1656
|
+
/* @__PURE__ */ n(
|
|
1657
|
+
Te,
|
|
1658
|
+
{
|
|
1659
|
+
align: "end",
|
|
1660
|
+
className: "min-w-[220px] rounded-control border border-border/60 p-1 shadow-sm",
|
|
1661
|
+
children: [
|
|
1662
|
+
V && /* @__PURE__ */ n(_, { children: [
|
|
1663
|
+
/* @__PURE__ */ n(
|
|
1664
|
+
X,
|
|
1665
|
+
{
|
|
1666
|
+
onClick: S,
|
|
1667
|
+
disabled: h,
|
|
1668
|
+
children: [
|
|
1669
|
+
/* @__PURE__ */ e(yt, { className: "h-3.5 w-3.5" }),
|
|
1670
|
+
h ? "Applying..." : "Apply Locally"
|
|
1671
|
+
]
|
|
1672
|
+
}
|
|
1673
|
+
),
|
|
1674
|
+
/* @__PURE__ */ e(je, {})
|
|
1675
|
+
] }),
|
|
1676
|
+
/* @__PURE__ */ n(
|
|
1677
|
+
X,
|
|
1678
|
+
{
|
|
1679
|
+
onClick: () => j("local"),
|
|
1680
|
+
disabled: x,
|
|
1681
|
+
children: [
|
|
1682
|
+
/* @__PURE__ */ e(xe, { className: "h-3.5 w-3.5" }),
|
|
1683
|
+
"Add to Dashboard (Local)"
|
|
1684
|
+
]
|
|
1685
|
+
}
|
|
1686
|
+
),
|
|
1687
|
+
/* @__PURE__ */ n(
|
|
1688
|
+
X,
|
|
1689
|
+
{
|
|
1690
|
+
onClick: () => j("library"),
|
|
1691
|
+
disabled: x,
|
|
1692
|
+
children: [
|
|
1693
|
+
/* @__PURE__ */ e(fr, { className: "h-3.5 w-3.5" }),
|
|
1694
|
+
"Save as Library Visual"
|
|
1695
|
+
]
|
|
1696
|
+
}
|
|
1697
|
+
),
|
|
1698
|
+
/* @__PURE__ */ n(
|
|
1699
|
+
X,
|
|
1700
|
+
{
|
|
1701
|
+
onClick: () => j("both"),
|
|
1702
|
+
disabled: x,
|
|
1703
|
+
children: [
|
|
1704
|
+
/* @__PURE__ */ e(gr, { className: "h-3.5 w-3.5" }),
|
|
1705
|
+
"Save Copy as Linked Visual"
|
|
1706
|
+
]
|
|
1707
|
+
}
|
|
1708
|
+
)
|
|
1709
|
+
]
|
|
1710
|
+
}
|
|
1711
|
+
)
|
|
1712
|
+
] })
|
|
1713
|
+
] }),
|
|
1714
|
+
/* @__PURE__ */ e(at, {}),
|
|
1715
|
+
/* @__PURE__ */ e(
|
|
1716
|
+
jr,
|
|
1717
|
+
{
|
|
1718
|
+
open: U,
|
|
1719
|
+
onOpenChange: (I) => {
|
|
1720
|
+
x || A(I);
|
|
1721
|
+
},
|
|
1722
|
+
isLibraryVisual: w,
|
|
1723
|
+
currentVisualName: N,
|
|
1724
|
+
isSaving: x,
|
|
1725
|
+
destinationMode: p,
|
|
1726
|
+
onConfirm: z
|
|
1727
|
+
}
|
|
1728
|
+
)
|
|
1729
|
+
] });
|
|
1730
|
+
}
|
|
1731
|
+
function ns({ className: t }) {
|
|
1732
|
+
const r = ee((h) => h.isDevMode), o = ee((h) => h.card.type), s = C((h) => h.isVisualEditing), { setIsDevMode: i } = Ke(), { config: a } = Kt(ba).tokenProps, c = (a == null ? void 0 : a.showAdvancedMode) !== !1;
|
|
1733
|
+
if (!s || !c || !or(o))
|
|
1734
|
+
return null;
|
|
1735
|
+
const d = r ? Fr : Dr, l = r ? "Visual editor" : "SQL editor", u = r ? "Switch to visual editor" : "Switch to SQL editor";
|
|
1736
|
+
return /* @__PURE__ */ n(
|
|
1737
|
+
"button",
|
|
1738
|
+
{
|
|
1739
|
+
type: "button",
|
|
1740
|
+
"aria-label": u,
|
|
1741
|
+
title: u,
|
|
1742
|
+
onClick: () => i(!r),
|
|
1743
|
+
className: J(
|
|
1744
|
+
"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",
|
|
1745
|
+
t
|
|
1746
|
+
),
|
|
1747
|
+
children: [
|
|
1748
|
+
/* @__PURE__ */ e(d, { className: "h-3 w-3 text-muted-foreground" }),
|
|
1749
|
+
l
|
|
1750
|
+
]
|
|
1751
|
+
}
|
|
1752
|
+
);
|
|
1753
|
+
}
|
|
1754
|
+
function ss() {
|
|
1755
|
+
const t = C((d) => d.isDashboardEditing), r = C((d) => d.isVisualEditing), o = C((d) => {
|
|
1756
|
+
var u;
|
|
1757
|
+
const l = ((u = d.dashboard) == null ? void 0 : u.sheets) ?? [];
|
|
1758
|
+
return l.find((h) => h.id === d.selectedSheetId) ?? l[0];
|
|
1759
|
+
}), s = C((d) => d.actions.arrangeSheet), i = C((d) => d.actions.undoArrange);
|
|
1760
|
+
if (!t || r || !o || wt(o)) return null;
|
|
1761
|
+
const a = !(o.frames ?? []).length, c = (d) => {
|
|
1762
|
+
const l = s(o.id, { keepOrder: d });
|
|
1763
|
+
if (!l.ok) {
|
|
1764
|
+
F.error(l.reason === "not_a_grid" ? "This sheet has no grid to arrange." : "The dashboard can't be arranged right now.");
|
|
1765
|
+
return;
|
|
1766
|
+
}
|
|
1767
|
+
F("Arranged", {
|
|
1768
|
+
// Long enough to reach Undo after looking at the result; the default 4 seconds isn't.
|
|
1769
|
+
duration: 1e4,
|
|
1770
|
+
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.",
|
|
1771
|
+
action: {
|
|
1772
|
+
label: "Undo",
|
|
1773
|
+
onClick: () => {
|
|
1774
|
+
const u = i();
|
|
1775
|
+
!u.ok && u.reason === "changed_since" && F.info("The dashboard changed after Arrange, so it can't be undone from here.");
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
});
|
|
1779
|
+
};
|
|
1780
|
+
return /* @__PURE__ */ n("div", { className: "inline-flex h-7 items-stretch overflow-hidden rounded-control border border-input bg-background", children: [
|
|
1781
|
+
/* @__PURE__ */ n(
|
|
1782
|
+
L,
|
|
1783
|
+
{
|
|
1784
|
+
variant: "ghost",
|
|
1785
|
+
size: "xs",
|
|
1786
|
+
disabled: a,
|
|
1787
|
+
title: a ? "This sheet has no cards to arrange" : "Lay out the cards by kind on every screen size",
|
|
1788
|
+
onClick: () => c(!1),
|
|
1789
|
+
className: "h-full rounded-none border-0 shadow-none hover:bg-accent",
|
|
1790
|
+
children: [
|
|
1791
|
+
/* @__PURE__ */ e(Ae, { className: "h-3.5 w-3.5" }),
|
|
1792
|
+
"Arrange"
|
|
1793
|
+
]
|
|
1794
|
+
}
|
|
1795
|
+
),
|
|
1796
|
+
/* @__PURE__ */ n(Le, { modal: !1, children: [
|
|
1797
|
+
/* @__PURE__ */ e(Ve, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1798
|
+
L,
|
|
1799
|
+
{
|
|
1800
|
+
variant: "ghost",
|
|
1801
|
+
size: "xs",
|
|
1802
|
+
disabled: a,
|
|
1803
|
+
className: "h-full w-7 rounded-none border-0 border-l border-border/60 px-0 shadow-none hover:bg-accent",
|
|
1804
|
+
"aria-label": "Open arrange options",
|
|
1805
|
+
children: /* @__PURE__ */ e(Ct, { className: "h-3.5 w-3.5" })
|
|
1806
|
+
}
|
|
1807
|
+
) }),
|
|
1808
|
+
/* @__PURE__ */ e(Te, { align: "end", className: "z-[60] w-48 rounded-[6px] border-border/60 p-1 shadow-sm", children: /* @__PURE__ */ n(X, { onClick: () => c(!0), children: [
|
|
1809
|
+
/* @__PURE__ */ e(Ae, { className: "h-3.5 w-3.5" }),
|
|
1810
|
+
"Keep my order"
|
|
1811
|
+
] }) })
|
|
1812
|
+
] })
|
|
1813
|
+
] });
|
|
1814
|
+
}
|
|
1815
|
+
function os() {
|
|
1816
|
+
const t = C((a) => a.isDashboardEditing), r = C((a) => a.layoutPreviewBreakpoint), o = C((a) => a.currentBreakpoint), s = C((a) => {
|
|
1817
|
+
var l, u;
|
|
1818
|
+
const c = ((l = a.dashboard) == null ? void 0 : l.sheets) ?? [], d = c.find((h) => h.id === a.selectedSheetId) ?? c[0];
|
|
1819
|
+
return !!d && !wt(d) && !!((u = d.frames) != null && u.length);
|
|
1820
|
+
}), i = C((a) => a.actions.setLayoutPreviewBreakpoint);
|
|
1821
|
+
return t || !s ? null : /* @__PURE__ */ e(
|
|
1822
|
+
L,
|
|
1823
|
+
{
|
|
1824
|
+
type: "button",
|
|
1825
|
+
size: "xs",
|
|
1826
|
+
variant: r ? "secondary" : "ghost",
|
|
1827
|
+
"aria-pressed": !!r,
|
|
1828
|
+
"aria-label": "Preview screen sizes",
|
|
1829
|
+
title: "Preview screen sizes",
|
|
1830
|
+
onClick: () => i(r ? null : o),
|
|
1831
|
+
className: "px-1.5",
|
|
1832
|
+
children: /* @__PURE__ */ e(Ar, { className: "h-3.5 w-3.5", "aria-hidden": !0 })
|
|
1833
|
+
}
|
|
1834
|
+
);
|
|
1835
|
+
}
|
|
1836
|
+
function is({
|
|
1837
|
+
open: t,
|
|
1838
|
+
onOpenChange: r,
|
|
1839
|
+
onSave: o,
|
|
1840
|
+
onDiscard: s,
|
|
1841
|
+
isSaving: i,
|
|
1842
|
+
title: a = "Unsaved changes",
|
|
1843
|
+
description: c = "You have unsaved changes to this dashboard. What would you like to do?",
|
|
1844
|
+
cancelLabel: d = "Cancel",
|
|
1845
|
+
discardLabel: l = "Discard changes",
|
|
1846
|
+
saveLabel: u = "Save"
|
|
1847
|
+
}) {
|
|
1848
|
+
return /* @__PURE__ */ e(lt, { open: t, onOpenChange: (m) => {
|
|
1849
|
+
!m && i || r(m);
|
|
1850
|
+
}, children: /* @__PURE__ */ n(dt, { children: [
|
|
1851
|
+
/* @__PURE__ */ n(ct, { children: [
|
|
1852
|
+
/* @__PURE__ */ e(ut, { children: a }),
|
|
1853
|
+
/* @__PURE__ */ e(ht, { children: c })
|
|
1854
|
+
] }),
|
|
1855
|
+
/* @__PURE__ */ n(mt, { children: [
|
|
1856
|
+
/* @__PURE__ */ e(
|
|
1857
|
+
L,
|
|
1858
|
+
{
|
|
1859
|
+
type: "button",
|
|
1860
|
+
size: "xs",
|
|
1861
|
+
onClick: s,
|
|
1862
|
+
disabled: i,
|
|
1863
|
+
variant: "outline",
|
|
1864
|
+
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",
|
|
1865
|
+
children: l
|
|
1866
|
+
}
|
|
1867
|
+
),
|
|
1868
|
+
/* @__PURE__ */ e(pt, { disabled: i, children: d }),
|
|
1869
|
+
/* @__PURE__ */ e(L, { type: "button", size: "xs", onClick: o, disabled: i, children: i ? /* @__PURE__ */ n(_, { children: [
|
|
1870
|
+
/* @__PURE__ */ e(ne, { className: "mr-2 h-3.5 w-3.5 animate-spin" }),
|
|
1871
|
+
"Saving..."
|
|
1872
|
+
] }) : u })
|
|
1873
|
+
] })
|
|
1874
|
+
] }) });
|
|
1875
|
+
}
|
|
1876
|
+
async function ls(t) {
|
|
1877
|
+
var a, c;
|
|
1878
|
+
const r = (c = (a = C.getState()) == null ? void 0 : a.authToken) == null ? void 0 : c.accessToken;
|
|
1879
|
+
if (!r)
|
|
1880
|
+
return;
|
|
1881
|
+
const o = `${t}/v1/invalidate-token`, s = await fetch(o, {
|
|
1882
|
+
method: "POST",
|
|
1883
|
+
headers: {
|
|
1884
|
+
Authorization: `Bearer ${r}`
|
|
1885
|
+
}
|
|
1886
|
+
});
|
|
1887
|
+
if (!s.ok)
|
|
1888
|
+
throw new Error("Failed to invalidate token");
|
|
1889
|
+
const i = await s.json();
|
|
1890
|
+
return console.log("invalidateToken", i), i;
|
|
1891
|
+
}
|
|
1892
|
+
function Hr(t) {
|
|
1893
|
+
switch (t == null ? void 0 : t.kind) {
|
|
1894
|
+
case "queued":
|
|
1895
|
+
return { text: K.queued };
|
|
1896
|
+
case "preparing":
|
|
1897
|
+
return { text: K.preparing };
|
|
1898
|
+
case "fetching":
|
|
1899
|
+
return { text: K.fetchingRows(t.rowsProcessed) };
|
|
1900
|
+
case "finalizing":
|
|
1901
|
+
return { text: K.finalizing };
|
|
1902
|
+
case "processing":
|
|
1903
|
+
return t.percent === null ? { text: K.processing } : { text: K.processing, detail: K.percentComplete(t.percent), bar: t.percent };
|
|
1904
|
+
default:
|
|
1905
|
+
return { text: K.inProgress };
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
function Qr(t) {
|
|
1909
|
+
var o;
|
|
1910
|
+
const r = t.item;
|
|
1911
|
+
return r.kind === "export" ? {
|
|
1912
|
+
title: r.title,
|
|
1913
|
+
status: r.status,
|
|
1914
|
+
startedAt: r.startedAt,
|
|
1915
|
+
finishedAt: r.finishedAt,
|
|
1916
|
+
running: Hr(r.stage),
|
|
1917
|
+
finishedDetail: [
|
|
1918
|
+
r.totalRows !== null ? `${r.totalRows.toLocaleString("en-US")} rows` : null,
|
|
1919
|
+
r.fileSize ? Sa(r.fileSize) : null
|
|
1920
|
+
].filter((s) => !!s),
|
|
1921
|
+
failure: ((o = r.failure) == null ? void 0 : o.kind) === "export" ? r.failure.message : r.status === "failed" ? K.failedFallback : null,
|
|
1922
|
+
note: null
|
|
1923
|
+
} : {
|
|
1924
|
+
title: r.title,
|
|
1925
|
+
status: r.status,
|
|
1926
|
+
startedAt: r.startedAt,
|
|
1927
|
+
finishedAt: r.finishedAt,
|
|
1928
|
+
running: { text: r.stageLabel ?? K.inProgress },
|
|
1929
|
+
finishedDetail: [],
|
|
1930
|
+
failure: null,
|
|
1931
|
+
note: r.omittedAttachmentCount > 0 ? he.attachmentsLeftOut(r.omittedAttachmentCount) : null
|
|
1932
|
+
};
|
|
1933
|
+
}
|
|
1934
|
+
function Gr({ row: t, now: r, api: o }) {
|
|
1935
|
+
const [s, i] = D("idle"), a = Qr(t), c = xa(t, o), d = async () => {
|
|
1936
|
+
if (!c) return;
|
|
1937
|
+
i("working");
|
|
1938
|
+
const f = await ka(o, t, c);
|
|
1939
|
+
i(f === "done" ? "idle" : f);
|
|
1940
|
+
}, l = a.status === "ready" ? "bg-emerald-500" : a.status === "failed" ? "bg-destructive" : a.status === "cancelled" ? "bg-muted-foreground/40" : "animate-pulse bg-muted-foreground/60", u = a.status === "ready" ? K.ready : a.status === "failed" ? K.failed : a.status === "cancelled" ? K.cancelled : K.inProgress, h = Date.parse(a.startedAt), m = At(Date.parse(a.finishedAt ?? a.startedAt), r, { addSuffix: !0 }), p = a.status === "running" && t.item.kind === "export" && r - h >= va, g = /* @__PURE__ */ e("span", { className: "text-muted-foreground/50", children: "·" });
|
|
1941
|
+
return /* @__PURE__ */ n("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: [
|
|
1942
|
+
/* @__PURE__ */ e("span", { className: "flex h-5 shrink-0 items-center", "aria-hidden": "true", children: /* @__PURE__ */ e("span", { className: `h-1.5 w-1.5 rounded-full ${l}` }) }),
|
|
1943
|
+
/* @__PURE__ */ e("span", { className: "sr-only", children: u }),
|
|
1944
|
+
/* @__PURE__ */ n("div", { className: "min-w-0 flex-1", children: [
|
|
1945
|
+
/* @__PURE__ */ n("div", { className: "flex h-5 items-center gap-2", children: [
|
|
1946
|
+
/* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[13px] font-medium leading-5", children: a.title }),
|
|
1947
|
+
c && s === "working" && /* @__PURE__ */ e("span", { role: "status", className: "inline-flex shrink-0 items-center gap-1.5 text-[12px] text-muted-foreground", children: /* @__PURE__ */ e(Pt, { className: "h-3 w-3 animate-spin", strokeWidth: 1.75 }) }),
|
|
1948
|
+
c && s !== "working" && /* @__PURE__ */ e(
|
|
1949
|
+
"button",
|
|
1950
|
+
{
|
|
1951
|
+
type: "button",
|
|
1952
|
+
onClick: () => void d(),
|
|
1953
|
+
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",
|
|
1954
|
+
children: ya[c]
|
|
1955
|
+
}
|
|
1956
|
+
)
|
|
1957
|
+
] }),
|
|
1958
|
+
a.status === "running" && a.running && /* @__PURE__ */ n("div", { className: "text-[12px] leading-4 text-muted-foreground", children: [
|
|
1959
|
+
/* @__PURE__ */ e("span", { className: "tabular-nums", children: a.running.text }),
|
|
1960
|
+
a.running.detail && /* @__PURE__ */ n(_, { children: [
|
|
1961
|
+
" ",
|
|
1962
|
+
g,
|
|
1963
|
+
" ",
|
|
1964
|
+
/* @__PURE__ */ e("span", { className: "tabular-nums", children: a.running.detail })
|
|
1965
|
+
] }),
|
|
1966
|
+
" ",
|
|
1967
|
+
g,
|
|
1968
|
+
" ",
|
|
1969
|
+
/* @__PURE__ */ e("span", { children: K.started(At(h, r)) }),
|
|
1970
|
+
a.running.bar !== void 0 && /* @__PURE__ */ e(Ca, { value: a.running.bar, className: "mt-1.5 h-1" }),
|
|
1971
|
+
p && /* @__PURE__ */ e("div", { className: "mt-1", children: K.longRunning })
|
|
1972
|
+
] }),
|
|
1973
|
+
a.status !== "running" && /* @__PURE__ */ n("div", { className: "flex items-center gap-1.5 text-[12px] leading-4 text-muted-foreground", children: [
|
|
1974
|
+
a.status === "ready" && a.finishedDetail.length > 0 ? (
|
|
1975
|
+
// Disclosed on hover or focus only; the time is what a reader scans.
|
|
1976
|
+
/* @__PURE__ */ n("span", { className: "hidden group-hover:contents group-focus-within:contents", children: [
|
|
1977
|
+
a.finishedDetail.map((f, v) => /* @__PURE__ */ n(Et.Fragment, { children: [
|
|
1978
|
+
v > 0 && g,
|
|
1979
|
+
/* @__PURE__ */ e("span", { children: f })
|
|
1980
|
+
] }, v)),
|
|
1981
|
+
g
|
|
1982
|
+
] })
|
|
1983
|
+
) : a.status !== "ready" ? /* @__PURE__ */ n(_, { children: [
|
|
1984
|
+
/* @__PURE__ */ e("span", { children: u }),
|
|
1985
|
+
g
|
|
1986
|
+
] }) : null,
|
|
1987
|
+
/* @__PURE__ */ e("span", { children: m })
|
|
1988
|
+
] }),
|
|
1989
|
+
a.note && /* @__PURE__ */ e("div", { className: "text-[12px] leading-4 text-muted-foreground", children: a.note }),
|
|
1990
|
+
a.status === "failed" && a.failure && /* @__PURE__ */ e("div", { className: "mt-1 whitespace-pre-wrap break-words text-[12px] leading-4 text-destructive", children: a.failure }),
|
|
1991
|
+
(s === "denied" || s === "blocked") && /* @__PURE__ */ n("div", { role: "alert", className: "mt-1 flex items-start gap-1.5 text-[12px] leading-4 text-foreground", children: [
|
|
1992
|
+
/* @__PURE__ */ e(wa, { className: "mt-0.5 h-3 w-3 shrink-0 text-destructive", strokeWidth: 1.75 }),
|
|
1993
|
+
/* @__PURE__ */ e("span", { children: Na(s) })
|
|
1994
|
+
] })
|
|
1995
|
+
] })
|
|
1996
|
+
] });
|
|
1997
|
+
}
|
|
1998
|
+
function ds({ variant: t }) {
|
|
1999
|
+
const { snapshot: r, markSeen: o } = vt(), s = r.runningCount > 0 ? r.runningCount > 9 ? "9+" : String(r.runningCount) : r.hasUnseenFinished ? "" : null;
|
|
2000
|
+
return /* @__PURE__ */ n($e, { onOpenChange: (i) => {
|
|
2001
|
+
i && o();
|
|
2002
|
+
}, children: [
|
|
2003
|
+
/* @__PURE__ */ e(We, { asChild: !0, children: /* @__PURE__ */ n(
|
|
2004
|
+
L,
|
|
2005
|
+
{
|
|
2006
|
+
variant: t ?? "ghost",
|
|
2007
|
+
size: "xs",
|
|
2008
|
+
className: "relative w-7 px-0 text-muted-foreground hover:text-foreground",
|
|
2009
|
+
"aria-label": he.title,
|
|
2010
|
+
title: he.title,
|
|
2011
|
+
children: [
|
|
2012
|
+
/* @__PURE__ */ e(Sr, { className: "h-3.5 w-3.5" }),
|
|
2013
|
+
s !== null && /* @__PURE__ */ e(
|
|
2014
|
+
"span",
|
|
2015
|
+
{
|
|
2016
|
+
className: `absolute flex items-center justify-center rounded-full bg-primary text-primary-foreground ${s ? "-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"}`,
|
|
2017
|
+
children: s
|
|
2018
|
+
}
|
|
2019
|
+
)
|
|
2020
|
+
]
|
|
2021
|
+
}
|
|
2022
|
+
) }),
|
|
2023
|
+
/* @__PURE__ */ e(qe, { className: "w-80 p-0", align: "end", sideOffset: 8, children: /* @__PURE__ */ e(Kr, {}) })
|
|
2024
|
+
] });
|
|
2025
|
+
}
|
|
2026
|
+
function Kr() {
|
|
2027
|
+
const t = vt(), r = Da(), { rows: o, activeTruncated: s } = t.snapshot, i = o.some((a) => Aa(a.item.status));
|
|
2028
|
+
return o.length === 0 ? /* @__PURE__ */ n("div", { className: "flex flex-col items-center gap-1.5 px-6 py-8 text-center", children: [
|
|
2029
|
+
/* @__PURE__ */ e("span", { className: "flex h-8 w-8 items-center justify-center rounded-[6px] border border-border text-muted-foreground", children: /* @__PURE__ */ e(Fa, { className: "h-3.5 w-3.5", strokeWidth: 1.75 }) }),
|
|
2030
|
+
/* @__PURE__ */ e("p", { className: "text-[13px] font-medium", children: he.title }),
|
|
2031
|
+
/* @__PURE__ */ e("p", { className: "text-[12px] text-muted-foreground", children: he.empty })
|
|
2032
|
+
] }) : /* @__PURE__ */ n("div", { className: "flex flex-col", children: [
|
|
2033
|
+
/* @__PURE__ */ n("div", { className: "flex h-8 items-center gap-2 border-b border-border px-3", children: [
|
|
2034
|
+
/* @__PURE__ */ e("span", { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: he.title }),
|
|
2035
|
+
/* @__PURE__ */ e("span", { className: "text-[10px] tabular-nums text-muted-foreground/70", children: o.length }),
|
|
2036
|
+
/* @__PURE__ */ n("div", { className: "ml-auto flex items-center gap-0.5", children: [
|
|
2037
|
+
i && /* @__PURE__ */ e(
|
|
2038
|
+
L,
|
|
2039
|
+
{
|
|
2040
|
+
variant: "ghost",
|
|
2041
|
+
size: "xs",
|
|
2042
|
+
className: "h-6 px-1.5 text-[12px] text-muted-foreground hover:text-foreground",
|
|
2043
|
+
onClick: t.clearFinished,
|
|
2044
|
+
children: he.clear
|
|
2045
|
+
}
|
|
2046
|
+
),
|
|
2047
|
+
/* @__PURE__ */ e(
|
|
2048
|
+
L,
|
|
2049
|
+
{
|
|
2050
|
+
variant: "ghost",
|
|
2051
|
+
size: "xs",
|
|
2052
|
+
className: "h-6 w-6 px-0 text-muted-foreground hover:text-foreground",
|
|
2053
|
+
onClick: t.refresh,
|
|
2054
|
+
title: "Refresh status",
|
|
2055
|
+
"aria-label": "Refresh status",
|
|
2056
|
+
children: /* @__PURE__ */ e(Pt, { strokeWidth: 1.75, className: "h-3.5 w-3.5" })
|
|
2057
|
+
}
|
|
2058
|
+
)
|
|
2059
|
+
] })
|
|
2060
|
+
] }),
|
|
2061
|
+
s && /* @__PURE__ */ e("p", { className: "border-b border-border px-3 py-2 text-[12px] leading-4 text-muted-foreground", children: he.truncated }),
|
|
2062
|
+
/* @__PURE__ */ e("div", { className: "max-h-[320px] overflow-y-auto", children: /* @__PURE__ */ e("div", { className: "divide-y divide-border/70", children: o.map((a) => /* @__PURE__ */ e(Gr, { row: a, now: r, api: t }, Ea(a))) }) })
|
|
2063
|
+
] });
|
|
2064
|
+
}
|
|
2065
|
+
function Xr(t) {
|
|
2066
|
+
if (t)
|
|
2067
|
+
return {
|
|
2068
|
+
renamed: t.type === "rename" ? { oldId: t.oldId, newId: t.newId } : void 0,
|
|
2069
|
+
removedControlId: t.type === "remove" ? t.controlId : void 0,
|
|
2070
|
+
cardBindingsById: t.type === "add" || t.type === "update" ? t.cardBindingsById : void 0,
|
|
2071
|
+
affectedBindingControlIds: t.type === "add" || t.type === "update" ? t.affectedBindingControlIds : void 0
|
|
2072
|
+
};
|
|
2073
|
+
}
|
|
2074
|
+
function Yr({
|
|
2075
|
+
open: t,
|
|
2076
|
+
onOpenChange: r,
|
|
2077
|
+
trigger: o,
|
|
2078
|
+
showTrigger: s = !0,
|
|
2079
|
+
initialMode: i = "manage"
|
|
2080
|
+
}) {
|
|
2081
|
+
const a = i === "create", {
|
|
2082
|
+
forceClose: c,
|
|
2083
|
+
handleOpenChange: d,
|
|
2084
|
+
isCreateFlowActive: l,
|
|
2085
|
+
preventPassiveDismissDuringCreate: u,
|
|
2086
|
+
resolvedOpen: h,
|
|
2087
|
+
setIsCreateFlowActive: m
|
|
2088
|
+
} = Ot({
|
|
2089
|
+
open: t,
|
|
2090
|
+
onOpenChange: r,
|
|
2091
|
+
initialCreateFlowActive: i === "create",
|
|
2092
|
+
// Dialog mode renders a built-in X close button — allow explicit
|
|
2093
|
+
// closes through `handleOpenChange`. Popover mode has no X; its
|
|
2094
|
+
// only close-via-trigger path is a re-click that would silently
|
|
2095
|
+
// wipe the in-progress create flow, so block everything during
|
|
2096
|
+
// create and make consumers use `forceClose()` from a dedicated
|
|
2097
|
+
// button.
|
|
2098
|
+
dismissMode: s ? "passive" : "explicit-only"
|
|
2099
|
+
}), p = C((x) => x.dashboard), { setDashboardControlsModel: g } = de(), { participants: f } = Ia(mr(p)), v = Array.from(
|
|
2100
|
+
new Map(
|
|
2101
|
+
f.flatMap(
|
|
2102
|
+
(x) => x.fieldChoices.map((E) => {
|
|
2103
|
+
var S;
|
|
2104
|
+
return [
|
|
2105
|
+
E.value,
|
|
2106
|
+
{
|
|
2107
|
+
option: E,
|
|
2108
|
+
target: (S = x.fieldTargetMap) == null ? void 0 : S[E.value]
|
|
2109
|
+
}
|
|
2110
|
+
];
|
|
2111
|
+
})
|
|
2112
|
+
)
|
|
2113
|
+
).values()
|
|
2114
|
+
), k = Array.from(
|
|
2115
|
+
new Map(
|
|
2116
|
+
f.flatMap(
|
|
2117
|
+
(x) => x.metricChoices.map((E) => {
|
|
2118
|
+
var S;
|
|
2119
|
+
return [
|
|
2120
|
+
E.value,
|
|
2121
|
+
{
|
|
2122
|
+
option: E,
|
|
2123
|
+
target: (S = x.metricTargetMap) == null ? void 0 : S[E.value]
|
|
2124
|
+
}
|
|
2125
|
+
];
|
|
2126
|
+
})
|
|
2127
|
+
)
|
|
2128
|
+
).values()
|
|
2129
|
+
), V = ir({
|
|
2130
|
+
...p || {},
|
|
2131
|
+
controls: []
|
|
2132
|
+
}), M = La(p), U = (x, E, S) => {
|
|
2133
|
+
g(
|
|
2134
|
+
x,
|
|
2135
|
+
E,
|
|
2136
|
+
Xr(S)
|
|
2137
|
+
);
|
|
2138
|
+
}, A = ae(() => {
|
|
2139
|
+
if (a) {
|
|
2140
|
+
c();
|
|
2141
|
+
return;
|
|
2142
|
+
}
|
|
2143
|
+
m(!1);
|
|
2144
|
+
}, [a, c, m]), z = /* @__PURE__ */ e(
|
|
2145
|
+
jt,
|
|
2146
|
+
{
|
|
2147
|
+
scope: "dashboard",
|
|
2148
|
+
controls: p.controls || [],
|
|
2149
|
+
reservedControlIds: V,
|
|
2150
|
+
defaultValues: p.defaultControlValues || {},
|
|
2151
|
+
usageByControlId: Va(p),
|
|
2152
|
+
availableFieldChoices: v,
|
|
2153
|
+
availableMetricChoices: k,
|
|
2154
|
+
structuralParticipants: f,
|
|
2155
|
+
structuralParticipantIdsByControlId: M,
|
|
2156
|
+
initialCreateFlow: i === "create",
|
|
2157
|
+
onCreateFlowActiveChange: m,
|
|
2158
|
+
onCreateFlowComplete: A,
|
|
2159
|
+
onChange: U,
|
|
2160
|
+
emptyMessage: "No dashboard controls yet."
|
|
2161
|
+
}
|
|
2162
|
+
), w = l ? "Add dashboard control" : "Dashboard Controls", N = /* @__PURE__ */ n(_, { children: [
|
|
2163
|
+
/* @__PURE__ */ n("div", { className: "space-y-1", children: [
|
|
2164
|
+
/* @__PURE__ */ e("h4", { className: "text-sm font-medium", children: "Dashboard Controls" }),
|
|
2165
|
+
/* @__PURE__ */ e("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." })
|
|
2166
|
+
] }),
|
|
2167
|
+
z
|
|
2168
|
+
] });
|
|
2169
|
+
return s ? /* @__PURE__ */ n($e, { open: h, onOpenChange: d, children: [
|
|
2170
|
+
/* @__PURE__ */ e(We, { asChild: !0, children: o || /* @__PURE__ */ n(L, { variant: "outline", className: "h-7 px-2", size: "sm", children: [
|
|
2171
|
+
/* @__PURE__ */ e(zt, { className: "mr-2 h-4 w-4" }),
|
|
2172
|
+
"Controls"
|
|
2173
|
+
] }) }),
|
|
2174
|
+
/* @__PURE__ */ e(
|
|
2175
|
+
qe,
|
|
2176
|
+
{
|
|
2177
|
+
className: "w-[620px] max-w-[95vw] space-y-4",
|
|
2178
|
+
align: "end",
|
|
2179
|
+
onEscapeKeyDown: u,
|
|
2180
|
+
onPointerDownOutside: u,
|
|
2181
|
+
children: N
|
|
2182
|
+
}
|
|
2183
|
+
)
|
|
2184
|
+
] }) : /* @__PURE__ */ e(Fe, { open: h, onOpenChange: d, children: /* @__PURE__ */ n(
|
|
2185
|
+
Ee,
|
|
2186
|
+
{
|
|
2187
|
+
className: "flex max-h-[88vh] flex-col overflow-hidden sm:max-w-[600px]",
|
|
2188
|
+
onEscapeKeyDown: u,
|
|
2189
|
+
onPointerDownOutside: u,
|
|
2190
|
+
children: [
|
|
2191
|
+
/* @__PURE__ */ n(
|
|
2192
|
+
gt,
|
|
2193
|
+
{
|
|
2194
|
+
className: l ? "space-y-0" : void 0,
|
|
2195
|
+
children: [
|
|
2196
|
+
/* @__PURE__ */ e(Ie, { className: "text-[15px]", children: w }),
|
|
2197
|
+
/* @__PURE__ */ e(
|
|
2198
|
+
bt,
|
|
2199
|
+
{
|
|
2200
|
+
className: l ? "sr-only" : "text-[13px]",
|
|
2201
|
+
children: l ? "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."
|
|
2202
|
+
}
|
|
2203
|
+
)
|
|
2204
|
+
]
|
|
2205
|
+
}
|
|
2206
|
+
),
|
|
2207
|
+
/* @__PURE__ */ e("div", { className: "min-h-0 overflow-y-auto pr-1", children: z })
|
|
2208
|
+
]
|
|
2209
|
+
}
|
|
2210
|
+
) });
|
|
2211
|
+
}
|
|
2212
|
+
const Zr = [
|
|
2213
|
+
"enum",
|
|
2214
|
+
"multi_enum",
|
|
2215
|
+
"text",
|
|
2216
|
+
"number",
|
|
2217
|
+
"boolean",
|
|
2218
|
+
"date"
|
|
2219
|
+
];
|
|
2220
|
+
function Jr({
|
|
2221
|
+
open: t,
|
|
2222
|
+
onOpenChange: r,
|
|
2223
|
+
initialMode: o = "manage"
|
|
2224
|
+
}) {
|
|
2225
|
+
var N;
|
|
2226
|
+
const s = o === "create", {
|
|
2227
|
+
forceClose: i,
|
|
2228
|
+
handleOpenChange: a,
|
|
2229
|
+
isCreateFlowActive: c,
|
|
2230
|
+
preventPassiveDismissDuringCreate: d,
|
|
2231
|
+
resolvedOpen: l,
|
|
2232
|
+
setIsCreateFlowActive: u
|
|
2233
|
+
} = Ot({
|
|
2234
|
+
open: t,
|
|
2235
|
+
onOpenChange: r,
|
|
2236
|
+
initialCreateFlowActive: o === "create",
|
|
2237
|
+
dismissMode: "explicit-only"
|
|
2238
|
+
}), h = C((x) => x.dashboard), m = C((x) => x.selectedSheetId), { setDashboardInputs: p } = de(), g = (N = h.sheets) == null ? void 0 : N.find(
|
|
2239
|
+
(x) => x.id === m
|
|
2240
|
+
), f = (g == null ? void 0 : g.kind) === "document" && !!g.document, v = re(
|
|
2241
|
+
() => f && (g != null && g.document) ? vr(h, g.id) : [],
|
|
2242
|
+
[h, f, g == null ? void 0 : g.document, g == null ? void 0 : g.id]
|
|
2243
|
+
), k = re(
|
|
2244
|
+
() => v.filter(
|
|
2245
|
+
(x) => x.kind === "control"
|
|
2246
|
+
),
|
|
2247
|
+
[v]
|
|
2248
|
+
), V = re(
|
|
2249
|
+
() => k.map((x) => x.control),
|
|
2250
|
+
[k]
|
|
2251
|
+
), M = re(
|
|
2252
|
+
() => tn(V),
|
|
2253
|
+
[V]
|
|
2254
|
+
), U = re(
|
|
2255
|
+
() => en(h),
|
|
2256
|
+
[h]
|
|
2257
|
+
), A = ae(() => {
|
|
2258
|
+
if (s) {
|
|
2259
|
+
i();
|
|
2260
|
+
return;
|
|
2261
|
+
}
|
|
2262
|
+
u(!1);
|
|
2263
|
+
}, [s, i, u]), z = ae(
|
|
2264
|
+
(x, E, S) => {
|
|
2265
|
+
!f || !(g != null && g.document) || p(
|
|
2266
|
+
rn({
|
|
2267
|
+
allInputs: h.inputs || [],
|
|
2268
|
+
documentSheetId: g.id,
|
|
2269
|
+
currentDocumentInputs: v,
|
|
2270
|
+
nextControls: x,
|
|
2271
|
+
nextDefaultValues: E,
|
|
2272
|
+
change: S
|
|
2273
|
+
})
|
|
2274
|
+
);
|
|
2275
|
+
},
|
|
2276
|
+
[
|
|
2277
|
+
h.inputs,
|
|
2278
|
+
v,
|
|
2279
|
+
f,
|
|
2280
|
+
g,
|
|
2281
|
+
p
|
|
2282
|
+
]
|
|
2283
|
+
);
|
|
2284
|
+
return !f || !(g != null && g.document) ? null : /* @__PURE__ */ e(Fe, { open: l, onOpenChange: a, children: /* @__PURE__ */ n(
|
|
2285
|
+
Ee,
|
|
2286
|
+
{
|
|
2287
|
+
className: "flex max-h-[88vh] flex-col overflow-hidden sm:max-w-[600px]",
|
|
2288
|
+
onEscapeKeyDown: d,
|
|
2289
|
+
onPointerDownOutside: d,
|
|
2290
|
+
children: [
|
|
2291
|
+
/* @__PURE__ */ n(gt, { className: c ? "space-y-0" : void 0, children: [
|
|
2292
|
+
/* @__PURE__ */ e(Ie, { className: "text-[15px]", children: c ? "Add document control" : "Document Controls" }),
|
|
2293
|
+
/* @__PURE__ */ e(
|
|
2294
|
+
bt,
|
|
2295
|
+
{
|
|
2296
|
+
className: c ? "sr-only" : "text-[13px]",
|
|
2297
|
+
children: c ? "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."
|
|
2298
|
+
}
|
|
2299
|
+
)
|
|
2300
|
+
] }),
|
|
2301
|
+
/* @__PURE__ */ e("div", { className: "min-h-0 overflow-y-auto pr-1", children: /* @__PURE__ */ e(
|
|
2302
|
+
jt,
|
|
2303
|
+
{
|
|
2304
|
+
scope: "dashboard",
|
|
2305
|
+
controls: V,
|
|
2306
|
+
reservedControlIds: U,
|
|
2307
|
+
defaultValues: M,
|
|
2308
|
+
usageByControlId: {},
|
|
2309
|
+
availableFieldChoices: [],
|
|
2310
|
+
availableMetricChoices: [],
|
|
2311
|
+
structuralParticipants: [],
|
|
2312
|
+
structuralParticipantIdsByControlId: {},
|
|
2313
|
+
allowedControlTypes: Zr,
|
|
2314
|
+
initialCreateFlow: o === "create",
|
|
2315
|
+
onCreateFlowActiveChange: u,
|
|
2316
|
+
onCreateFlowComplete: A,
|
|
2317
|
+
onChange: z,
|
|
2318
|
+
emptyMessage: "No document controls yet."
|
|
2319
|
+
}
|
|
2320
|
+
) })
|
|
2321
|
+
]
|
|
2322
|
+
}
|
|
2323
|
+
) });
|
|
2324
|
+
}
|
|
2325
|
+
function en(t) {
|
|
2326
|
+
return (t.controls || []).map((r) => r.id);
|
|
2327
|
+
}
|
|
2328
|
+
function tn(t) {
|
|
2329
|
+
const r = {};
|
|
2330
|
+
for (const o of t)
|
|
2331
|
+
o.defaultValue !== void 0 && (r[o.id] = o.defaultValue);
|
|
2332
|
+
return r;
|
|
2333
|
+
}
|
|
2334
|
+
function an(t, r) {
|
|
2335
|
+
return r ? Object.prototype.hasOwnProperty.call(r, t.id) ? {
|
|
2336
|
+
...t,
|
|
2337
|
+
defaultValue: r[t.id]
|
|
2338
|
+
} : t.defaultValue === void 0 ? t : { ...t, defaultValue: void 0 } : t.defaultValue === void 0 ? t : { ...t, defaultValue: void 0 };
|
|
2339
|
+
}
|
|
2340
|
+
function rn({
|
|
2341
|
+
allInputs: t,
|
|
2342
|
+
documentSheetId: r,
|
|
2343
|
+
currentDocumentInputs: o,
|
|
2344
|
+
nextControls: s,
|
|
2345
|
+
nextDefaultValues: i,
|
|
2346
|
+
change: a
|
|
2347
|
+
}) {
|
|
2348
|
+
const c = new Map(
|
|
2349
|
+
s.map((p) => [
|
|
2350
|
+
p.id,
|
|
2351
|
+
an(p, i)
|
|
2352
|
+
])
|
|
2353
|
+
), d = (a == null ? void 0 : a.type) === "rename" ? { oldId: a.oldId, newId: a.newId } : null, l = /* @__PURE__ */ new Set(), u = [];
|
|
2354
|
+
for (const p of o) {
|
|
2355
|
+
if (p.kind !== "control") {
|
|
2356
|
+
u.push(p);
|
|
2357
|
+
continue;
|
|
2358
|
+
}
|
|
2359
|
+
const g = c.get(p.control.id) || ((d == null ? void 0 : d.oldId) === p.control.id ? c.get(d.newId) : void 0);
|
|
2360
|
+
if (!g)
|
|
2361
|
+
continue;
|
|
2362
|
+
l.add(g.id);
|
|
2363
|
+
const f = lr(
|
|
2364
|
+
g.id,
|
|
2365
|
+
[...t, ...u].filter(
|
|
2366
|
+
(k) => k.id !== p.id
|
|
2367
|
+
)
|
|
2368
|
+
), v = g.id === f ? g : { ...g, id: f };
|
|
2369
|
+
u.push({
|
|
2370
|
+
...p,
|
|
2371
|
+
label: v.label,
|
|
2372
|
+
variableName: f,
|
|
2373
|
+
requiredAtExecution: v.requiredAtExecution,
|
|
2374
|
+
control: v
|
|
2375
|
+
});
|
|
2376
|
+
}
|
|
2377
|
+
for (const p of c.values())
|
|
2378
|
+
l.has(p.id) || u.push(
|
|
2379
|
+
yr({
|
|
2380
|
+
control: p,
|
|
2381
|
+
existingInputs: [...t, ...u],
|
|
2382
|
+
sheetId: r
|
|
2383
|
+
})
|
|
2384
|
+
);
|
|
2385
|
+
const h = new Set(
|
|
2386
|
+
o.map((p) => p.id)
|
|
2387
|
+
);
|
|
2388
|
+
return [...t.filter(
|
|
2389
|
+
(p) => !h.has(p.id)
|
|
2390
|
+
), ...u];
|
|
2391
|
+
}
|
|
2392
|
+
function nn({
|
|
2393
|
+
showFilters: t,
|
|
2394
|
+
onShowFiltersChange: r,
|
|
2395
|
+
pickerContent: o,
|
|
2396
|
+
settingsContent: s,
|
|
2397
|
+
size: i = "default",
|
|
2398
|
+
className: a,
|
|
2399
|
+
primaryButtonClassName: c,
|
|
2400
|
+
secondaryButtonClassName: d,
|
|
2401
|
+
pickerContentClassName: l,
|
|
2402
|
+
settingsContentClassName: u
|
|
2403
|
+
}) {
|
|
2404
|
+
const h = i === "toolbar", [m, p] = D(!1), g = ot("interactive");
|
|
2405
|
+
return /* @__PURE__ */ n(
|
|
2406
|
+
"div",
|
|
2407
|
+
{
|
|
2408
|
+
className: J(
|
|
2409
|
+
// Height lives on the shell so the outer border is part of the
|
|
2410
|
+
// h-7 box (matches regular `size="xs"` buttons). Inner triggers
|
|
2411
|
+
// stretch to fill via `h-full`.
|
|
2412
|
+
"relative inline-flex items-stretch overflow-hidden rounded-control border border-input bg-background",
|
|
2413
|
+
h ? "h-8" : "h-7",
|
|
2414
|
+
a
|
|
2415
|
+
),
|
|
2416
|
+
children: [
|
|
2417
|
+
/* @__PURE__ */ n($e, { open: t, onOpenChange: r, children: [
|
|
2418
|
+
/* @__PURE__ */ e(We, { asChild: !0, children: /* @__PURE__ */ n(
|
|
2419
|
+
L,
|
|
2420
|
+
{
|
|
2421
|
+
variant: "ghost",
|
|
2422
|
+
size: "xs",
|
|
2423
|
+
className: J(
|
|
2424
|
+
"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",
|
|
2425
|
+
c
|
|
2426
|
+
),
|
|
2427
|
+
children: [
|
|
2428
|
+
t ? /* @__PURE__ */ e(br, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ e(Mt, { className: "h-3.5 w-3.5" }),
|
|
2429
|
+
"Filter"
|
|
2430
|
+
]
|
|
2431
|
+
}
|
|
2432
|
+
) }),
|
|
2433
|
+
/* @__PURE__ */ e(
|
|
2434
|
+
qe,
|
|
2435
|
+
{
|
|
2436
|
+
align: "end",
|
|
2437
|
+
sideOffset: 6,
|
|
2438
|
+
className: J(
|
|
2439
|
+
"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)]",
|
|
2440
|
+
l
|
|
2441
|
+
),
|
|
2442
|
+
style: g.contentStyle,
|
|
2443
|
+
children: o
|
|
2444
|
+
}
|
|
2445
|
+
)
|
|
2446
|
+
] }),
|
|
2447
|
+
/* @__PURE__ */ n($e, { open: m, onOpenChange: p, children: [
|
|
2448
|
+
/* @__PURE__ */ e(We, { asChild: !0, children: /* @__PURE__ */ e(
|
|
2449
|
+
L,
|
|
2450
|
+
{
|
|
2451
|
+
variant: "ghost",
|
|
2452
|
+
size: "xs",
|
|
2453
|
+
className: J(
|
|
2454
|
+
"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",
|
|
2455
|
+
d
|
|
2456
|
+
),
|
|
2457
|
+
"aria-label": "Filter and control actions",
|
|
2458
|
+
children: /* @__PURE__ */ e(Ct, { className: "h-3.5 w-3.5" })
|
|
2459
|
+
}
|
|
2460
|
+
) }),
|
|
2461
|
+
/* @__PURE__ */ e(
|
|
2462
|
+
qe,
|
|
2463
|
+
{
|
|
2464
|
+
align: "end",
|
|
2465
|
+
sideOffset: 6,
|
|
2466
|
+
className: J(
|
|
2467
|
+
"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)]",
|
|
2468
|
+
u
|
|
2469
|
+
),
|
|
2470
|
+
style: g.contentStyle,
|
|
2471
|
+
children: s(() => p(!1))
|
|
2472
|
+
}
|
|
2473
|
+
)
|
|
2474
|
+
] })
|
|
2475
|
+
]
|
|
2476
|
+
}
|
|
2477
|
+
);
|
|
2478
|
+
}
|
|
2479
|
+
function sn() {
|
|
2480
|
+
xr();
|
|
2481
|
+
const t = C((l) => l.selectedSheetId), r = C((l) => l.selectedFrameId), o = C((l) => l.dashboard), s = C((l) => l.actions.getSelectedFrame), { setSelectedFrameId: i } = de(), { setCard: a } = Ke(), c = ee((l) => l.card.dataSource);
|
|
2482
|
+
return be(() => {
|
|
2483
|
+
var u, h;
|
|
2484
|
+
let l = s();
|
|
2485
|
+
if (!l) {
|
|
2486
|
+
const m = (u = o == null ? void 0 : o.sheets) == null ? void 0 : u.find((g) => g.id === t), p = (h = m == null ? void 0 : m.frames) == null ? void 0 : h[0];
|
|
2487
|
+
p && (i(p.id), l = p);
|
|
2488
|
+
}
|
|
2489
|
+
if (l) {
|
|
2490
|
+
const m = l.cards.find((p) => p.id === l.activeCardId);
|
|
2491
|
+
m && a(m);
|
|
2492
|
+
}
|
|
2493
|
+
}, [s, t, r, o, i, a]), {
|
|
2494
|
+
hasEntities: !!(c != null && c.selectedEntities && c.selectedEntities.length > 0)
|
|
2495
|
+
};
|
|
2496
|
+
}
|
|
2497
|
+
function on() {
|
|
2498
|
+
const t = C((l) => l.dashboard), r = C(
|
|
2499
|
+
(l) => l.semanticExecutionPayload
|
|
2500
|
+
), o = C(
|
|
2501
|
+
(l) => l.actions.addFilterInput
|
|
2502
|
+
), { hasEntities: s } = sn(), { isLoading: i } = Ta(), a = re(
|
|
2503
|
+
() => dr(t, r),
|
|
2504
|
+
[t, r]
|
|
2505
|
+
), d = !cr(t) && a.hasEligibleCards && !i;
|
|
2506
|
+
return /* @__PURE__ */ n("div", { className: "flex h-[520px] w-[400px] flex-col", children: [
|
|
2507
|
+
d && /* @__PURE__ */ e("div", { className: "border-b border-border/60 p-2", children: /* @__PURE__ */ n(
|
|
2508
|
+
"button",
|
|
2509
|
+
{
|
|
2510
|
+
type: "button",
|
|
2511
|
+
onClick: () => o(ur(), {
|
|
2512
|
+
kind: "allSheets",
|
|
2513
|
+
sheetKinds: ["dashboard"]
|
|
2514
|
+
}),
|
|
2515
|
+
title: `Applies to ${a.eligibleCardCount} of ${a.totalCardCount} date-aware cards`,
|
|
2516
|
+
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",
|
|
2517
|
+
children: [
|
|
2518
|
+
/* @__PURE__ */ e(kr, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
2519
|
+
/* @__PURE__ */ n("span", { className: "flex min-w-0 flex-col", children: [
|
|
2520
|
+
/* @__PURE__ */ e("span", { className: "text-[12px] font-medium text-foreground", children: "Add global date filter" }),
|
|
2521
|
+
/* @__PURE__ */ e("span", { className: "text-[11px] leading-[1.4] text-muted-foreground", children: "One date range across all date-aware cards." })
|
|
2522
|
+
] })
|
|
2523
|
+
]
|
|
2524
|
+
}
|
|
2525
|
+
) }),
|
|
2526
|
+
!s && /* @__PURE__ */ n("div", { className: "flex flex-1 flex-col items-center justify-center px-6 py-8 text-center", children: [
|
|
2527
|
+
/* @__PURE__ */ e(Ba, { className: "mb-3 h-10 w-10 text-muted-foreground/50" }),
|
|
2528
|
+
/* @__PURE__ */ e("h3", { className: "mb-1 text-[13px] font-medium text-foreground", children: "No fields configured" }),
|
|
2529
|
+
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: "Configure a data source for this card to enable filtering." })
|
|
2530
|
+
] }),
|
|
2531
|
+
s && /* @__PURE__ */ e("div", { className: "flex flex-1 overflow-hidden", children: /* @__PURE__ */ e(Pa, { context: "filter" }) })
|
|
2532
|
+
] });
|
|
2533
|
+
}
|
|
2534
|
+
function ln({
|
|
2535
|
+
onAddFilter: t,
|
|
2536
|
+
onAddControl: r,
|
|
2537
|
+
onManageControls: o,
|
|
2538
|
+
onDismiss: s
|
|
2539
|
+
}) {
|
|
2540
|
+
const i = C(
|
|
2541
|
+
(d) => d.dashboard.filterLayout
|
|
2542
|
+
), { setFilterLayout: a } = de(), c = (i == null ? void 0 : i.toolbarWrap) ?? !1;
|
|
2543
|
+
return /* @__PURE__ */ n("div", { className: "w-[300px]", children: [
|
|
2544
|
+
/* @__PURE__ */ n("div", { className: "p-1", children: [
|
|
2545
|
+
/* @__PURE__ */ e(
|
|
2546
|
+
rt,
|
|
2547
|
+
{
|
|
2548
|
+
icon: Mt,
|
|
2549
|
+
label: "Add filter",
|
|
2550
|
+
onClick: () => {
|
|
2551
|
+
t(), s();
|
|
2552
|
+
}
|
|
2553
|
+
}
|
|
2554
|
+
),
|
|
2555
|
+
/* @__PURE__ */ e(
|
|
2556
|
+
rt,
|
|
2557
|
+
{
|
|
2558
|
+
icon: zt,
|
|
2559
|
+
label: "Add control",
|
|
2560
|
+
onClick: () => {
|
|
2561
|
+
r(), s();
|
|
2562
|
+
}
|
|
2563
|
+
}
|
|
2564
|
+
),
|
|
2565
|
+
/* @__PURE__ */ e(
|
|
2566
|
+
rt,
|
|
2567
|
+
{
|
|
2568
|
+
icon: Ut,
|
|
2569
|
+
label: "Manage controls",
|
|
2570
|
+
onClick: () => {
|
|
2571
|
+
o(), s();
|
|
2572
|
+
}
|
|
2573
|
+
}
|
|
2574
|
+
)
|
|
2575
|
+
] }),
|
|
2576
|
+
/* @__PURE__ */ e("div", { className: "border-t border-border/60" }),
|
|
2577
|
+
/* @__PURE__ */ n("div", { className: "space-y-1 p-2", children: [
|
|
2578
|
+
/* @__PURE__ */ e("p", { className: "px-1 text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Display" }),
|
|
2579
|
+
/* @__PURE__ */ e(
|
|
2580
|
+
dn,
|
|
2581
|
+
{
|
|
2582
|
+
id: "filter-display-wrap",
|
|
2583
|
+
label: "Wrap to multiple lines",
|
|
2584
|
+
checked: c,
|
|
2585
|
+
onCheckedChange: (d) => a({ toolbarWrap: d === !0 })
|
|
2586
|
+
}
|
|
2587
|
+
)
|
|
2588
|
+
] })
|
|
2589
|
+
] });
|
|
2590
|
+
}
|
|
2591
|
+
function rt({
|
|
2592
|
+
icon: t,
|
|
2593
|
+
label: r,
|
|
2594
|
+
onClick: o
|
|
2595
|
+
}) {
|
|
2596
|
+
return /* @__PURE__ */ n(
|
|
2597
|
+
"button",
|
|
2598
|
+
{
|
|
2599
|
+
type: "button",
|
|
2600
|
+
onClick: o,
|
|
2601
|
+
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",
|
|
2602
|
+
children: [
|
|
2603
|
+
/* @__PURE__ */ e(t, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
2604
|
+
r
|
|
2605
|
+
]
|
|
2606
|
+
}
|
|
2607
|
+
);
|
|
2608
|
+
}
|
|
2609
|
+
function dn({
|
|
2610
|
+
id: t,
|
|
2611
|
+
label: r,
|
|
2612
|
+
checked: o,
|
|
2613
|
+
onCheckedChange: s
|
|
2614
|
+
}) {
|
|
2615
|
+
return /* @__PURE__ */ n("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: [
|
|
2616
|
+
/* @__PURE__ */ e(ft, { id: t, checked: o, onCheckedChange: s }),
|
|
2617
|
+
/* @__PURE__ */ e(
|
|
2618
|
+
De,
|
|
2619
|
+
{
|
|
2620
|
+
htmlFor: t,
|
|
2621
|
+
className: "cursor-pointer text-[12px] font-normal leading-[1.3]",
|
|
2622
|
+
children: r
|
|
2623
|
+
}
|
|
2624
|
+
)
|
|
2625
|
+
] });
|
|
2626
|
+
}
|
|
2627
|
+
function cs({
|
|
2628
|
+
size: t,
|
|
2629
|
+
className: r,
|
|
2630
|
+
primaryButtonClassName: o,
|
|
2631
|
+
secondaryButtonClassName: s,
|
|
2632
|
+
pickerContentClassName: i,
|
|
2633
|
+
settingsContentClassName: a
|
|
2634
|
+
}) {
|
|
2635
|
+
var z;
|
|
2636
|
+
const [c, d] = D(null), l = C((w) => w.dashboard), u = C((w) => w.selectedSheetId), h = C((w) => w.showFilters), m = C((w) => w.actions), { setDocumentPanelTarget: p, setShowFilters: g } = m, f = (z = l.sheets) == null ? void 0 : z.find(
|
|
2637
|
+
(w) => w.id === u
|
|
2638
|
+
), v = wt(f), k = ae((w) => {
|
|
2639
|
+
window.setTimeout(() => {
|
|
2640
|
+
d(w);
|
|
2641
|
+
}, 0);
|
|
2642
|
+
}, []), V = ae(
|
|
2643
|
+
(w) => {
|
|
2644
|
+
if (v && u) {
|
|
2645
|
+
w && p(u, {
|
|
2646
|
+
kind: "document",
|
|
2647
|
+
group: "inputs"
|
|
2648
|
+
});
|
|
2649
|
+
return;
|
|
2650
|
+
}
|
|
2651
|
+
g(w);
|
|
2652
|
+
},
|
|
2653
|
+
[
|
|
2654
|
+
v,
|
|
2655
|
+
u,
|
|
2656
|
+
p,
|
|
2657
|
+
g
|
|
2658
|
+
]
|
|
2659
|
+
), M = ae(() => {
|
|
2660
|
+
V(!0);
|
|
2661
|
+
}, [V]), U = ae(() => {
|
|
2662
|
+
k("create");
|
|
2663
|
+
}, [k]), A = ae(() => {
|
|
2664
|
+
k("manage");
|
|
2665
|
+
}, [k]);
|
|
2666
|
+
return /* @__PURE__ */ n(_, { children: [
|
|
2667
|
+
/* @__PURE__ */ e(
|
|
2668
|
+
nn,
|
|
2669
|
+
{
|
|
2670
|
+
showFilters: v ? !1 : h,
|
|
2671
|
+
onShowFiltersChange: V,
|
|
2672
|
+
pickerContent: /* @__PURE__ */ e(on, {}),
|
|
2673
|
+
settingsContent: (w) => /* @__PURE__ */ e(
|
|
2674
|
+
ln,
|
|
2675
|
+
{
|
|
2676
|
+
onAddFilter: M,
|
|
2677
|
+
onAddControl: U,
|
|
2678
|
+
onManageControls: A,
|
|
2679
|
+
onDismiss: w
|
|
2680
|
+
}
|
|
2681
|
+
),
|
|
2682
|
+
size: t,
|
|
2683
|
+
className: r,
|
|
2684
|
+
primaryButtonClassName: o,
|
|
2685
|
+
secondaryButtonClassName: s,
|
|
2686
|
+
pickerContentClassName: i,
|
|
2687
|
+
settingsContentClassName: a
|
|
2688
|
+
}
|
|
2689
|
+
),
|
|
2690
|
+
c ? v ? /* @__PURE__ */ e(
|
|
2691
|
+
Jr,
|
|
2692
|
+
{
|
|
2693
|
+
open: !0,
|
|
2694
|
+
onOpenChange: (w) => {
|
|
2695
|
+
w || d(null);
|
|
2696
|
+
},
|
|
2697
|
+
initialMode: c
|
|
2698
|
+
}
|
|
2699
|
+
) : /* @__PURE__ */ e(
|
|
2700
|
+
Yr,
|
|
2701
|
+
{
|
|
2702
|
+
open: !0,
|
|
2703
|
+
onOpenChange: (w) => {
|
|
2704
|
+
w || d(null);
|
|
2705
|
+
},
|
|
2706
|
+
showTrigger: !1,
|
|
2707
|
+
initialMode: c
|
|
2708
|
+
}
|
|
2709
|
+
) : null
|
|
2710
|
+
] });
|
|
2711
|
+
}
|
|
2712
|
+
function cn({
|
|
2713
|
+
disabled: t,
|
|
2714
|
+
briefingCount: r,
|
|
2715
|
+
className: o,
|
|
2716
|
+
onClick: s
|
|
2717
|
+
}) {
|
|
2718
|
+
const i = typeof r == "number" && r > 0;
|
|
2719
|
+
return /* @__PURE__ */ n(
|
|
2720
|
+
L,
|
|
2721
|
+
{
|
|
2722
|
+
type: "button",
|
|
2723
|
+
size: "xs",
|
|
2724
|
+
variant: "outline",
|
|
2725
|
+
disabled: t,
|
|
2726
|
+
className: J("gap-1.5", o),
|
|
2727
|
+
onClick: s,
|
|
2728
|
+
"aria-label": "Reports & briefings",
|
|
2729
|
+
children: [
|
|
2730
|
+
/* @__PURE__ */ e(Er, { className: "h-3.5 w-3.5" }),
|
|
2731
|
+
"Reports & briefings",
|
|
2732
|
+
i ? /* @__PURE__ */ e("span", { className: "ml-0.5 rounded-control bg-muted px-1 text-[10px] tabular-nums text-foreground/70", children: r }) : null
|
|
2733
|
+
]
|
|
2734
|
+
}
|
|
2735
|
+
);
|
|
2736
|
+
}
|
|
2737
|
+
const un = "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", Ht = "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", _e = "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";
|
|
2738
|
+
function hn(t) {
|
|
2739
|
+
return t === "dashboard" ? "This dashboard" : "Project";
|
|
2740
|
+
}
|
|
2741
|
+
function mn(t) {
|
|
2742
|
+
if (!t) return "Never";
|
|
2743
|
+
const r = new Date(t);
|
|
2744
|
+
if (Number.isNaN(r.getTime())) return "Unknown";
|
|
2745
|
+
const o = Date.now() - r.getTime(), s = Math.round(o / 6e4);
|
|
2746
|
+
if (s < 1) return "now";
|
|
2747
|
+
if (s < 60) return `${s}m ago`;
|
|
2748
|
+
const i = Math.round(s / 60);
|
|
2749
|
+
if (i < 24) return `${i}h ago`;
|
|
2750
|
+
const a = Math.round(i / 24);
|
|
2751
|
+
if (a < 7) return `${a}d ago`;
|
|
2752
|
+
const c = Math.round(a / 7);
|
|
2753
|
+
return c < 5 ? `${c}w ago` : `${Math.round(a / 30)}mo ago`;
|
|
2754
|
+
}
|
|
2755
|
+
function pn(t) {
|
|
2756
|
+
return t.scheduleExpr ? Cr(
|
|
2757
|
+
t.scheduleExpr,
|
|
2758
|
+
t.timezone || "UTC"
|
|
2759
|
+
) ?? "Invalid schedule" : "On demand";
|
|
2760
|
+
}
|
|
2761
|
+
function fn(t) {
|
|
2762
|
+
if (t.lastRunStatus) {
|
|
2763
|
+
const r = t.lastRunStatus.toString().toUpperCase();
|
|
2764
|
+
return r === "SUCCESS" ? "Last run completed." : r === "FAILED" ? "Last run failed." : `Last run ${t.lastRunStatus.toString().toLowerCase()}`;
|
|
2765
|
+
}
|
|
2766
|
+
return null;
|
|
2767
|
+
}
|
|
2768
|
+
function Qt(t) {
|
|
2769
|
+
return t.hasActiveRun ? "Running" : t.lastRunStatus ? `Last run ${t.lastRunStatus.toString().toLowerCase()}` : "Idle";
|
|
2770
|
+
}
|
|
2771
|
+
function gn(t) {
|
|
2772
|
+
return t.source.type === "dashboard" ? "This dashboard" : "Project";
|
|
2773
|
+
}
|
|
2774
|
+
function bn({
|
|
2775
|
+
activeView: t,
|
|
2776
|
+
onChange: r
|
|
2777
|
+
}) {
|
|
2778
|
+
return /* @__PURE__ */ e(
|
|
2779
|
+
"div",
|
|
2780
|
+
{
|
|
2781
|
+
className: "flex shrink-0 items-center gap-1 rounded-control bg-muted p-0.5",
|
|
2782
|
+
role: "tablist",
|
|
2783
|
+
"aria-label": "Briefing source view",
|
|
2784
|
+
children: ["dashboard", "project"].map((o) => {
|
|
2785
|
+
const s = t === o;
|
|
2786
|
+
return /* @__PURE__ */ e(
|
|
2787
|
+
"button",
|
|
2788
|
+
{
|
|
2789
|
+
type: "button",
|
|
2790
|
+
role: "tab",
|
|
2791
|
+
"aria-selected": s,
|
|
2792
|
+
onClick: () => r(o),
|
|
2793
|
+
className: J(
|
|
2794
|
+
"h-6 rounded-[3px] px-2 text-[11px] transition-colors",
|
|
2795
|
+
s ? "bg-background font-medium text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"
|
|
2796
|
+
),
|
|
2797
|
+
children: hn(o)
|
|
2798
|
+
},
|
|
2799
|
+
o
|
|
2800
|
+
);
|
|
2801
|
+
})
|
|
2802
|
+
}
|
|
2803
|
+
);
|
|
2804
|
+
}
|
|
2805
|
+
function xn({
|
|
2806
|
+
briefings: t,
|
|
2807
|
+
dashboardLabel: r,
|
|
2808
|
+
sourceView: o,
|
|
2809
|
+
error: s,
|
|
2810
|
+
loading: i,
|
|
2811
|
+
onSourceViewChange: a,
|
|
2812
|
+
onClose: c,
|
|
2813
|
+
onEdit: d,
|
|
2814
|
+
onNew: l,
|
|
2815
|
+
canCreate: u,
|
|
2816
|
+
canCreateScheduledReport: h,
|
|
2817
|
+
analyticalBriefingsEnabled: m,
|
|
2818
|
+
onRunNow: p,
|
|
2819
|
+
onTogglePause: g,
|
|
2820
|
+
onDelete: f,
|
|
2821
|
+
selectingId: v,
|
|
2822
|
+
busyId: k,
|
|
2823
|
+
manageBriefingsHref: V,
|
|
2824
|
+
contentKind: M,
|
|
2825
|
+
hideHeader: U = !1
|
|
2826
|
+
}) {
|
|
2827
|
+
const A = t.length, z = t.filter((S) => S.status === "ACTIVE").length, w = M === "reports" ? A === 1 ? "report" : "reports" : M === "briefings" ? A === 1 ? "briefing" : "briefings" : A === 1 ? "item" : "items", N = t.find((S) => S.hasActiveRun) ?? null, x = M ?? "reports & briefings", E = o === "dashboard" ? r : `Project ${x}`;
|
|
2828
|
+
return /* @__PURE__ */ n(
|
|
2829
|
+
"section",
|
|
2830
|
+
{
|
|
2831
|
+
"aria-label": `Dashboard ${x.replace("&", "and")}`,
|
|
2832
|
+
className: "flex h-full min-h-0 flex-col bg-background text-foreground",
|
|
2833
|
+
children: [
|
|
2834
|
+
U ? null : /* @__PURE__ */ n("header", { className: "flex items-start justify-between gap-3 border-b border-border px-4 py-3", children: [
|
|
2835
|
+
/* @__PURE__ */ n("div", { className: "min-w-0", children: [
|
|
2836
|
+
/* @__PURE__ */ e("div", { className: un, children: x }),
|
|
2837
|
+
/* @__PURE__ */ e("h2", { className: "mt-0.5 truncate text-[14px] font-semibold leading-5", children: E })
|
|
2838
|
+
] }),
|
|
2839
|
+
/* @__PURE__ */ e(
|
|
2840
|
+
"button",
|
|
2841
|
+
{
|
|
2842
|
+
type: "button",
|
|
2843
|
+
onClick: c,
|
|
2844
|
+
className: "rounded-control p-1 text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
2845
|
+
"aria-label": `Close ${x.replace("&", "and")} panel`,
|
|
2846
|
+
children: /* @__PURE__ */ e(Xe, { className: "h-3.5 w-3.5" })
|
|
2847
|
+
}
|
|
2848
|
+
)
|
|
2849
|
+
] }),
|
|
2850
|
+
/* @__PURE__ */ n("div", { className: "flex items-center justify-between gap-3 border-b border-border px-4 py-2", children: [
|
|
2851
|
+
/* @__PURE__ */ n("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
2852
|
+
/* @__PURE__ */ e(
|
|
2853
|
+
bn,
|
|
2854
|
+
{
|
|
2855
|
+
activeView: o,
|
|
2856
|
+
onChange: a
|
|
2857
|
+
}
|
|
2858
|
+
),
|
|
2859
|
+
/* @__PURE__ */ e("div", { className: "flex min-w-0 items-center gap-1.5 text-[11px] text-muted-foreground", children: i && A === 0 ? /* @__PURE__ */ n("span", { children: [
|
|
2860
|
+
"Loading ",
|
|
2861
|
+
x,
|
|
2862
|
+
"…"
|
|
2863
|
+
] }) : A === 0 ? /* @__PURE__ */ n("span", { children: [
|
|
2864
|
+
"No ",
|
|
2865
|
+
x,
|
|
2866
|
+
" yet"
|
|
2867
|
+
] }) : /* @__PURE__ */ n(_, { children: [
|
|
2868
|
+
/* @__PURE__ */ n("span", { className: "font-medium text-foreground/80", children: [
|
|
2869
|
+
A,
|
|
2870
|
+
" ",
|
|
2871
|
+
w
|
|
2872
|
+
] }),
|
|
2873
|
+
/* @__PURE__ */ e("span", { className: "text-border", children: "·" }),
|
|
2874
|
+
/* @__PURE__ */ n("span", { children: [
|
|
2875
|
+
z,
|
|
2876
|
+
" active"
|
|
2877
|
+
] })
|
|
2878
|
+
] }) })
|
|
2879
|
+
] }),
|
|
2880
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-1.5", children: [
|
|
2881
|
+
i ? (
|
|
2882
|
+
// Auto-refresh on open; surface a quiet spinner near the count
|
|
2883
|
+
// when a manual reload is in flight, but don't show a separate
|
|
2884
|
+
// refresh button — close+reopen handles the rare "stale list"
|
|
2885
|
+
// case without crowding the toolbar.
|
|
2886
|
+
/* @__PURE__ */ e(ne, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground" })
|
|
2887
|
+
) : null,
|
|
2888
|
+
A > 0 && u ? m && h ? /* @__PURE__ */ n(Le, { children: [
|
|
2889
|
+
/* @__PURE__ */ e(Ve, { asChild: !0, children: /* @__PURE__ */ n("button", { className: _e, children: [
|
|
2890
|
+
/* @__PURE__ */ e(xe, { className: "h-3 w-3" }),
|
|
2891
|
+
" New"
|
|
2892
|
+
] }) }),
|
|
2893
|
+
/* @__PURE__ */ n(Te, { align: "end", children: [
|
|
2894
|
+
/* @__PURE__ */ e(X, { onClick: () => l("scheduled_report"), children: "Schedule a report" }),
|
|
2895
|
+
/* @__PURE__ */ e(
|
|
2896
|
+
X,
|
|
2897
|
+
{
|
|
2898
|
+
onClick: () => l("analytical_briefing"),
|
|
2899
|
+
children: "Create analytical briefing"
|
|
2900
|
+
}
|
|
2901
|
+
)
|
|
2902
|
+
] })
|
|
2903
|
+
] }) : h ? /* @__PURE__ */ n(
|
|
2904
|
+
"button",
|
|
2905
|
+
{
|
|
2906
|
+
onClick: () => l("scheduled_report"),
|
|
2907
|
+
className: _e,
|
|
2908
|
+
children: [
|
|
2909
|
+
/* @__PURE__ */ e(xe, { className: "h-3 w-3" }),
|
|
2910
|
+
" Schedule report"
|
|
2911
|
+
]
|
|
2912
|
+
}
|
|
2913
|
+
) : m ? /* @__PURE__ */ n(
|
|
2914
|
+
"button",
|
|
2915
|
+
{
|
|
2916
|
+
onClick: () => l("analytical_briefing"),
|
|
2917
|
+
className: _e,
|
|
2918
|
+
children: [
|
|
2919
|
+
/* @__PURE__ */ e(xe, { className: "h-3 w-3" }),
|
|
2920
|
+
" New briefing"
|
|
2921
|
+
]
|
|
2922
|
+
}
|
|
2923
|
+
) : null : null
|
|
2924
|
+
] })
|
|
2925
|
+
] }),
|
|
2926
|
+
N ? /* @__PURE__ */ n("div", { className: "flex items-center gap-2 border-b border-border bg-muted/60 px-4 py-2 text-[12px]", children: [
|
|
2927
|
+
/* @__PURE__ */ e(ne, { className: "h-3 w-3 shrink-0 animate-spin text-muted-foreground" }),
|
|
2928
|
+
/* @__PURE__ */ e("span", { className: "font-medium text-foreground", children: N.name }),
|
|
2929
|
+
/* @__PURE__ */ e("span", { className: "text-border", children: "·" }),
|
|
2930
|
+
/* @__PURE__ */ e("span", { className: "truncate text-muted-foreground", children: Qt(N) })
|
|
2931
|
+
] }) : null,
|
|
2932
|
+
/* @__PURE__ */ n("div", { className: "flex-1 overflow-y-auto", children: [
|
|
2933
|
+
s ? /* @__PURE__ */ e("div", { className: "m-4 rounded-card border border-destructive/30 bg-destructive/10 px-3 py-2 text-[12px] text-destructive", children: s }) : null,
|
|
2934
|
+
!i && t.length === 0 && !s ? /* @__PURE__ */ e(
|
|
2935
|
+
vn,
|
|
2936
|
+
{
|
|
2937
|
+
onNew: l,
|
|
2938
|
+
canCreate: u,
|
|
2939
|
+
canCreateScheduledReport: h,
|
|
2940
|
+
analyticalBriefingsEnabled: m,
|
|
2941
|
+
contentKind: M
|
|
2942
|
+
}
|
|
2943
|
+
) : null,
|
|
2944
|
+
t.map((S) => /* @__PURE__ */ e(
|
|
2945
|
+
Cn,
|
|
2946
|
+
{
|
|
2947
|
+
briefing: S,
|
|
2948
|
+
isOpening: v === S.id,
|
|
2949
|
+
isBusy: k === S.id,
|
|
2950
|
+
onOpen: () => d(S.id),
|
|
2951
|
+
onRunNow: () => p(S),
|
|
2952
|
+
onTogglePause: () => g(S),
|
|
2953
|
+
onDelete: () => f(S)
|
|
2954
|
+
},
|
|
2955
|
+
S.id
|
|
2956
|
+
))
|
|
2957
|
+
] }),
|
|
2958
|
+
V ? /* @__PURE__ */ e("div", { className: "border-t border-border px-4 py-2.5", children: /* @__PURE__ */ n(
|
|
2959
|
+
"a",
|
|
2960
|
+
{
|
|
2961
|
+
href: V,
|
|
2962
|
+
className: J(Ht, "h-6 px-1 text-[11px]"),
|
|
2963
|
+
children: [
|
|
2964
|
+
"Manage all reports & briefings",
|
|
2965
|
+
/* @__PURE__ */ e(Nr, { className: "h-3 w-3" })
|
|
2966
|
+
]
|
|
2967
|
+
}
|
|
2968
|
+
) }) : null
|
|
2969
|
+
]
|
|
2970
|
+
}
|
|
2971
|
+
);
|
|
2972
|
+
}
|
|
2973
|
+
function vn({
|
|
2974
|
+
onNew: t,
|
|
2975
|
+
canCreate: r,
|
|
2976
|
+
canCreateScheduledReport: o,
|
|
2977
|
+
analyticalBriefingsEnabled: s,
|
|
2978
|
+
contentKind: i
|
|
2979
|
+
}) {
|
|
2980
|
+
const a = i === "reports" ? {
|
|
2981
|
+
title: "No reports yet",
|
|
2982
|
+
description: "Schedule an emailed dashboard or visual report to see it here."
|
|
2983
|
+
} : i === "briefings" ? {
|
|
2984
|
+
title: "No briefings yet",
|
|
2985
|
+
description: "Create an analytical briefing to monitor this dashboard and brief your team."
|
|
2986
|
+
} : null;
|
|
2987
|
+
return /* @__PURE__ */ n("div", { className: "flex h-full flex-col items-center justify-center px-8 py-12 text-center", children: [
|
|
2988
|
+
/* @__PURE__ */ e(yn, { className: "mb-5 h-[88px] w-[112px] text-border" }),
|
|
2989
|
+
/* @__PURE__ */ e("div", { className: "text-[13px] font-medium text-foreground", children: (a == null ? void 0 : a.title) ?? "Have an analyst brief your team" }),
|
|
2990
|
+
/* @__PURE__ */ e("p", { className: "mt-1.5 max-w-[320px] text-[12px] leading-5 text-muted-foreground", children: (a == null ? void 0 : a.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." }),
|
|
2991
|
+
r ? /* @__PURE__ */ n("div", { className: "mt-4 flex flex-wrap justify-center gap-2", children: [
|
|
2992
|
+
o ? /* @__PURE__ */ n(
|
|
2993
|
+
"button",
|
|
2994
|
+
{
|
|
2995
|
+
onClick: () => t("scheduled_report"),
|
|
2996
|
+
className: _e,
|
|
2997
|
+
children: [
|
|
2998
|
+
/* @__PURE__ */ e(xe, { className: "h-3 w-3" }),
|
|
2999
|
+
" Schedule a report"
|
|
3000
|
+
]
|
|
3001
|
+
}
|
|
3002
|
+
) : null,
|
|
3003
|
+
s ? /* @__PURE__ */ e(
|
|
3004
|
+
"button",
|
|
3005
|
+
{
|
|
3006
|
+
onClick: () => t("analytical_briefing"),
|
|
3007
|
+
className: Ht,
|
|
3008
|
+
children: "Create analytical briefing"
|
|
3009
|
+
}
|
|
3010
|
+
) : null
|
|
3011
|
+
] }) : null
|
|
3012
|
+
] });
|
|
3013
|
+
}
|
|
3014
|
+
function yn({ className: t }) {
|
|
3015
|
+
return /* @__PURE__ */ n(
|
|
3016
|
+
"svg",
|
|
3017
|
+
{
|
|
3018
|
+
viewBox: "0 0 112 88",
|
|
3019
|
+
fill: "none",
|
|
3020
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3021
|
+
role: "presentation",
|
|
3022
|
+
"aria-hidden": "true",
|
|
3023
|
+
className: t,
|
|
3024
|
+
children: [
|
|
3025
|
+
/* @__PURE__ */ e(
|
|
3026
|
+
"rect",
|
|
3027
|
+
{
|
|
3028
|
+
x: "22",
|
|
3029
|
+
y: "6",
|
|
3030
|
+
width: "60",
|
|
3031
|
+
height: "72",
|
|
3032
|
+
rx: "3",
|
|
3033
|
+
stroke: "currentColor",
|
|
3034
|
+
strokeWidth: "1.25"
|
|
3035
|
+
}
|
|
3036
|
+
),
|
|
3037
|
+
/* @__PURE__ */ e(
|
|
3038
|
+
"line",
|
|
3039
|
+
{
|
|
3040
|
+
x1: "30",
|
|
3041
|
+
y1: "16",
|
|
3042
|
+
x2: "64",
|
|
3043
|
+
y2: "16",
|
|
3044
|
+
stroke: "currentColor",
|
|
3045
|
+
strokeWidth: "1.5",
|
|
3046
|
+
strokeLinecap: "round"
|
|
3047
|
+
}
|
|
3048
|
+
),
|
|
3049
|
+
/* @__PURE__ */ e(
|
|
3050
|
+
"line",
|
|
3051
|
+
{
|
|
3052
|
+
x1: "30",
|
|
3053
|
+
y1: "21",
|
|
3054
|
+
x2: "52",
|
|
3055
|
+
y2: "21",
|
|
3056
|
+
stroke: "currentColor",
|
|
3057
|
+
strokeWidth: "1",
|
|
3058
|
+
strokeLinecap: "round",
|
|
3059
|
+
opacity: "0.5"
|
|
3060
|
+
}
|
|
3061
|
+
),
|
|
3062
|
+
/* @__PURE__ */ e("circle", { cx: "31", cy: "32", r: "1", fill: "currentColor", opacity: "0.6" }),
|
|
3063
|
+
/* @__PURE__ */ e(
|
|
3064
|
+
"line",
|
|
3065
|
+
{
|
|
3066
|
+
x1: "35",
|
|
3067
|
+
y1: "32",
|
|
3068
|
+
x2: "72",
|
|
3069
|
+
y2: "32",
|
|
3070
|
+
stroke: "currentColor",
|
|
3071
|
+
strokeWidth: "1",
|
|
3072
|
+
opacity: "0.4",
|
|
3073
|
+
strokeLinecap: "round"
|
|
3074
|
+
}
|
|
3075
|
+
),
|
|
3076
|
+
/* @__PURE__ */ e("circle", { cx: "31", cy: "38", r: "1", fill: "currentColor", opacity: "0.6" }),
|
|
3077
|
+
/* @__PURE__ */ e(
|
|
3078
|
+
"line",
|
|
3079
|
+
{
|
|
3080
|
+
x1: "35",
|
|
3081
|
+
y1: "38",
|
|
3082
|
+
x2: "68",
|
|
3083
|
+
y2: "38",
|
|
3084
|
+
stroke: "currentColor",
|
|
3085
|
+
strokeWidth: "1",
|
|
3086
|
+
opacity: "0.4",
|
|
3087
|
+
strokeLinecap: "round"
|
|
3088
|
+
}
|
|
3089
|
+
),
|
|
3090
|
+
/* @__PURE__ */ e("circle", { cx: "31", cy: "44", r: "1", fill: "currentColor", opacity: "0.6" }),
|
|
3091
|
+
/* @__PURE__ */ e(
|
|
3092
|
+
"line",
|
|
3093
|
+
{
|
|
3094
|
+
x1: "35",
|
|
3095
|
+
y1: "44",
|
|
3096
|
+
x2: "74",
|
|
3097
|
+
y2: "44",
|
|
3098
|
+
stroke: "currentColor",
|
|
3099
|
+
strokeWidth: "1",
|
|
3100
|
+
opacity: "0.4",
|
|
3101
|
+
strokeLinecap: "round"
|
|
3102
|
+
}
|
|
3103
|
+
),
|
|
3104
|
+
/* @__PURE__ */ e(
|
|
3105
|
+
"rect",
|
|
3106
|
+
{
|
|
3107
|
+
x: "30",
|
|
3108
|
+
y: "64",
|
|
3109
|
+
width: "5",
|
|
3110
|
+
height: "8",
|
|
3111
|
+
rx: "0.5",
|
|
3112
|
+
fill: "currentColor",
|
|
3113
|
+
opacity: "0.55"
|
|
3114
|
+
}
|
|
3115
|
+
),
|
|
3116
|
+
/* @__PURE__ */ e(
|
|
3117
|
+
"rect",
|
|
3118
|
+
{
|
|
3119
|
+
x: "38",
|
|
3120
|
+
y: "60",
|
|
3121
|
+
width: "5",
|
|
3122
|
+
height: "12",
|
|
3123
|
+
rx: "0.5",
|
|
3124
|
+
fill: "currentColor",
|
|
3125
|
+
opacity: "0.7"
|
|
3126
|
+
}
|
|
3127
|
+
),
|
|
3128
|
+
/* @__PURE__ */ e(
|
|
3129
|
+
"rect",
|
|
3130
|
+
{
|
|
3131
|
+
x: "46",
|
|
3132
|
+
y: "56",
|
|
3133
|
+
width: "5",
|
|
3134
|
+
height: "16",
|
|
3135
|
+
rx: "0.5",
|
|
3136
|
+
fill: "currentColor",
|
|
3137
|
+
opacity: "0.85"
|
|
3138
|
+
}
|
|
3139
|
+
),
|
|
3140
|
+
/* @__PURE__ */ e(
|
|
3141
|
+
"rect",
|
|
3142
|
+
{
|
|
3143
|
+
x: "54",
|
|
3144
|
+
y: "62",
|
|
3145
|
+
width: "5",
|
|
3146
|
+
height: "10",
|
|
3147
|
+
rx: "0.5",
|
|
3148
|
+
fill: "currentColor",
|
|
3149
|
+
opacity: "0.6"
|
|
3150
|
+
}
|
|
3151
|
+
),
|
|
3152
|
+
/* @__PURE__ */ e(
|
|
3153
|
+
"rect",
|
|
3154
|
+
{
|
|
3155
|
+
x: "62",
|
|
3156
|
+
y: "58",
|
|
3157
|
+
width: "5",
|
|
3158
|
+
height: "14",
|
|
3159
|
+
rx: "0.5",
|
|
3160
|
+
fill: "currentColor",
|
|
3161
|
+
opacity: "0.75"
|
|
3162
|
+
}
|
|
3163
|
+
),
|
|
3164
|
+
/* @__PURE__ */ e(
|
|
3165
|
+
"circle",
|
|
3166
|
+
{
|
|
3167
|
+
cx: "86",
|
|
3168
|
+
cy: "62",
|
|
3169
|
+
r: "10",
|
|
3170
|
+
fill: "var(--background, white)",
|
|
3171
|
+
stroke: "currentColor",
|
|
3172
|
+
strokeWidth: "1.25"
|
|
3173
|
+
}
|
|
3174
|
+
),
|
|
3175
|
+
/* @__PURE__ */ e(
|
|
3176
|
+
"line",
|
|
3177
|
+
{
|
|
3178
|
+
x1: "93.5",
|
|
3179
|
+
y1: "69.5",
|
|
3180
|
+
x2: "100",
|
|
3181
|
+
y2: "76",
|
|
3182
|
+
stroke: "currentColor",
|
|
3183
|
+
strokeWidth: "1.5",
|
|
3184
|
+
strokeLinecap: "round"
|
|
3185
|
+
}
|
|
3186
|
+
)
|
|
3187
|
+
]
|
|
3188
|
+
}
|
|
3189
|
+
);
|
|
3190
|
+
}
|
|
3191
|
+
function Cn({
|
|
3192
|
+
briefing: t,
|
|
3193
|
+
isOpening: r,
|
|
3194
|
+
isBusy: o,
|
|
3195
|
+
onOpen: s,
|
|
3196
|
+
onRunNow: i,
|
|
3197
|
+
onTogglePause: a,
|
|
3198
|
+
onDelete: c
|
|
3199
|
+
}) {
|
|
3200
|
+
const d = t.status === "PAUSED", l = t.hasActiveRun, u = fn(t), h = mn(t.lastRunAt), m = t.lastRunStatus, p = le(t), g = m === "SUCCESS" ? Re.success.dot : m === "FAILED" ? Re.danger.dot : m ? Re.warning.dot : Re.neutral.dot;
|
|
3201
|
+
return /* @__PURE__ */ n(
|
|
3202
|
+
"div",
|
|
3203
|
+
{
|
|
3204
|
+
className: J(
|
|
3205
|
+
"group relative border-b border-border/60 px-4 py-3 transition-colors hover:bg-muted/60",
|
|
3206
|
+
d && "opacity-70"
|
|
3207
|
+
),
|
|
3208
|
+
children: [
|
|
3209
|
+
/* @__PURE__ */ n(
|
|
3210
|
+
"div",
|
|
3211
|
+
{
|
|
3212
|
+
role: "button",
|
|
3213
|
+
tabIndex: 0,
|
|
3214
|
+
onClick: s,
|
|
3215
|
+
onKeyDown: (f) => {
|
|
3216
|
+
(f.key === "Enter" || f.key === " ") && (f.preventDefault(), s());
|
|
3217
|
+
},
|
|
3218
|
+
className: "cursor-pointer pr-8",
|
|
3219
|
+
children: [
|
|
3220
|
+
/* @__PURE__ */ n("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
3221
|
+
/* @__PURE__ */ e("span", { className: "truncate text-[13px] font-medium text-foreground", children: t.name }),
|
|
3222
|
+
d ? /* @__PURE__ */ e("span", { className: "shrink-0 text-[11px] text-muted-foreground", children: "· Paused" }) : null
|
|
3223
|
+
] }),
|
|
3224
|
+
/* @__PURE__ */ n("div", { className: "mt-1 flex flex-wrap items-center gap-x-1.5 text-[11px] text-muted-foreground", children: [
|
|
3225
|
+
/* @__PURE__ */ e("span", { children: p.typeLabel }),
|
|
3226
|
+
/* @__PURE__ */ e("span", { className: "text-border", children: "·" }),
|
|
3227
|
+
/* @__PURE__ */ e("span", { children: gn(t) }),
|
|
3228
|
+
/* @__PURE__ */ e("span", { className: "text-border", children: "·" }),
|
|
3229
|
+
/* @__PURE__ */ e(Ma, { className: "h-3 w-3" }),
|
|
3230
|
+
/* @__PURE__ */ e("span", { className: "truncate", children: pn(t) }),
|
|
3231
|
+
t.lastRunAt ? /* @__PURE__ */ n(_, { children: [
|
|
3232
|
+
/* @__PURE__ */ e("span", { className: "text-border", children: "·" }),
|
|
3233
|
+
/* @__PURE__ */ n("span", { children: [
|
|
3234
|
+
"Last run ",
|
|
3235
|
+
h
|
|
3236
|
+
] })
|
|
3237
|
+
] }) : null
|
|
3238
|
+
] }),
|
|
3239
|
+
u || l ? /* @__PURE__ */ n("div", { className: "mt-1.5 flex items-center gap-1.5 text-[12px] leading-[1.5] text-foreground/80", children: [
|
|
3240
|
+
l ? /* @__PURE__ */ e(ne, { className: "h-3 w-3 shrink-0 animate-spin text-muted-foreground/70" }) : /* @__PURE__ */ e(
|
|
3241
|
+
"span",
|
|
3242
|
+
{
|
|
3243
|
+
className: J(
|
|
3244
|
+
"inline-block h-1.5 w-1.5 shrink-0 rounded-full",
|
|
3245
|
+
g
|
|
3246
|
+
)
|
|
3247
|
+
}
|
|
3248
|
+
),
|
|
3249
|
+
/* @__PURE__ */ e("span", { className: "truncate", children: l ? Qt(t) : u })
|
|
3250
|
+
] }) : null
|
|
3251
|
+
]
|
|
3252
|
+
}
|
|
3253
|
+
),
|
|
3254
|
+
/* @__PURE__ */ e("div", { className: "absolute right-3 top-3", children: o ? /* @__PURE__ */ e(ne, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground/70" }) : r ? /* @__PURE__ */ e(ne, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground/70" }) : /* @__PURE__ */ n(Le, { children: [
|
|
3255
|
+
/* @__PURE__ */ e(Ve, { asChild: !0, children: /* @__PURE__ */ e(
|
|
3256
|
+
"button",
|
|
3257
|
+
{
|
|
3258
|
+
type: "button",
|
|
3259
|
+
onClick: (f) => f.stopPropagation(),
|
|
3260
|
+
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",
|
|
3261
|
+
"aria-label": `${p.noun === "report" ? "Report" : "Briefing"} actions`,
|
|
3262
|
+
children: /* @__PURE__ */ e(Tt, { className: "h-3.5 w-3.5" })
|
|
3263
|
+
}
|
|
3264
|
+
) }),
|
|
3265
|
+
/* @__PURE__ */ n(Te, { align: "end", className: "w-44", children: [
|
|
3266
|
+
/* @__PURE__ */ n(X, { onClick: s, children: [
|
|
3267
|
+
/* @__PURE__ */ e(Ut, { className: "h-3.5 w-3.5" }),
|
|
3268
|
+
"Edit ",
|
|
3269
|
+
p.noun
|
|
3270
|
+
] }),
|
|
3271
|
+
/* @__PURE__ */ n(
|
|
3272
|
+
X,
|
|
3273
|
+
{
|
|
3274
|
+
onClick: (f) => {
|
|
3275
|
+
f.preventDefault(), i();
|
|
3276
|
+
},
|
|
3277
|
+
children: [
|
|
3278
|
+
/* @__PURE__ */ e(Ua, { className: "h-3.5 w-3.5" }),
|
|
3279
|
+
"Run now"
|
|
3280
|
+
]
|
|
3281
|
+
}
|
|
3282
|
+
),
|
|
3283
|
+
t.scheduleExpr ? /* @__PURE__ */ e(
|
|
3284
|
+
X,
|
|
3285
|
+
{
|
|
3286
|
+
onClick: (f) => {
|
|
3287
|
+
f.preventDefault(), a();
|
|
3288
|
+
},
|
|
3289
|
+
children: d ? /* @__PURE__ */ n(_, { children: [
|
|
3290
|
+
/* @__PURE__ */ e(Ra, { className: "h-3.5 w-3.5" }),
|
|
3291
|
+
"Resume"
|
|
3292
|
+
] }) : /* @__PURE__ */ n(_, { children: [
|
|
3293
|
+
/* @__PURE__ */ e(za, { className: "h-3.5 w-3.5" }),
|
|
3294
|
+
"Pause"
|
|
3295
|
+
] })
|
|
3296
|
+
}
|
|
3297
|
+
) : null,
|
|
3298
|
+
/* @__PURE__ */ e(je, {}),
|
|
3299
|
+
/* @__PURE__ */ n(
|
|
3300
|
+
X,
|
|
3301
|
+
{
|
|
3302
|
+
onClick: (f) => {
|
|
3303
|
+
f.preventDefault(), c();
|
|
3304
|
+
},
|
|
3305
|
+
className: "text-destructive focus:bg-destructive/10 focus:text-destructive",
|
|
3306
|
+
children: [
|
|
3307
|
+
/* @__PURE__ */ e(Oe, { className: "h-3.5 w-3.5" }),
|
|
3308
|
+
"Delete ",
|
|
3309
|
+
p.noun
|
|
3310
|
+
]
|
|
3311
|
+
}
|
|
3312
|
+
)
|
|
3313
|
+
] })
|
|
3314
|
+
] }) })
|
|
3315
|
+
]
|
|
3316
|
+
}
|
|
3317
|
+
);
|
|
3318
|
+
}
|
|
3319
|
+
function wn(t) {
|
|
3320
|
+
return (t == null ? void 0 : t.trim()) || "This dashboard";
|
|
3321
|
+
}
|
|
3322
|
+
function Nn(t) {
|
|
3323
|
+
return t === "This dashboard" ? "Watch this dashboard" : `Watch ${t}`;
|
|
3324
|
+
}
|
|
3325
|
+
function Sn(t, r, o) {
|
|
3326
|
+
return r !== "dashboard" ? t : t.filter(
|
|
3327
|
+
(s) => s.source.type === "dashboard" && s.source.dashboardId === o
|
|
3328
|
+
);
|
|
3329
|
+
}
|
|
3330
|
+
async function kn(t) {
|
|
3331
|
+
const o = [];
|
|
3332
|
+
let s = 1, i = 0, a = Number.POSITIVE_INFINITY;
|
|
3333
|
+
for (; i < a; ) {
|
|
3334
|
+
const c = await t.apiClient.listBriefings(
|
|
3335
|
+
t.apiServiceUrl,
|
|
3336
|
+
t.token,
|
|
3337
|
+
{ scope: "organization", page: s, pageSize: 100 }
|
|
3338
|
+
);
|
|
3339
|
+
if (o.push(...c.briefings), i += c.briefings.length, a = c.total, c.briefings.length === 0 || i >= a) break;
|
|
3340
|
+
s += 1;
|
|
3341
|
+
}
|
|
3342
|
+
return o;
|
|
3343
|
+
}
|
|
3344
|
+
const Dn = {
|
|
3345
|
+
listBriefings: Ga,
|
|
3346
|
+
getBriefing: Qa,
|
|
3347
|
+
pauseBriefing: Ha,
|
|
3348
|
+
resumeBriefing: qa,
|
|
3349
|
+
deleteBriefing: Wa,
|
|
3350
|
+
runBriefingNow: $a
|
|
3351
|
+
};
|
|
3352
|
+
function us(t) {
|
|
3353
|
+
return /* @__PURE__ */ e(_a, { authToken: t.token ? { accessToken: t.token } : void 0, children: /* @__PURE__ */ e(Oa, { children: /* @__PURE__ */ e(An, { ...t }) }) });
|
|
3354
|
+
}
|
|
3355
|
+
function An({
|
|
3356
|
+
dashboardId: t,
|
|
3357
|
+
dashboardTitle: r,
|
|
3358
|
+
apiServiceUrl: o,
|
|
3359
|
+
token: s,
|
|
3360
|
+
disabled: i,
|
|
3361
|
+
className: a,
|
|
3362
|
+
manageBriefingsHref: c,
|
|
3363
|
+
open: d,
|
|
3364
|
+
onOpenChange: l,
|
|
3365
|
+
hideTrigger: u = !1,
|
|
3366
|
+
workflowIntent: h,
|
|
3367
|
+
openRun: m,
|
|
3368
|
+
client: p
|
|
3369
|
+
}) {
|
|
3370
|
+
const { authToken: g, tokenProps: f } = It(), v = ja(), k = !h || v.canCreate && (h === "scheduled_report" || v.analyticalBriefingsEnabled), [V, M] = D(!1), U = d ?? V, A = (y) => {
|
|
3371
|
+
d === void 0 && M(y), l == null || l(y);
|
|
3372
|
+
}, [z, w] = D(
|
|
3373
|
+
h ? "author" : "list"
|
|
3374
|
+
), [N, x] = D(
|
|
3375
|
+
h ?? "analytical_briefing"
|
|
3376
|
+
), [E, S] = D("dashboard"), [j, I] = D(
|
|
3377
|
+
[]
|
|
3378
|
+
), [T, Z] = D(null), G = h && !k && !T ? "list" : z, [H, Q] = D(!1), [ce, O] = D(null), [ye, Y] = D(null), [R, te] = D(
|
|
3379
|
+
null
|
|
3380
|
+
), [me, pe] = D(null), Ce = nt(null), Be = nt(U);
|
|
3381
|
+
be(() => {
|
|
3382
|
+
const y = U && !Be.current;
|
|
3383
|
+
Be.current = U, !(!y || !h) && (Z(null), S("dashboard"), x(h), w("author"), pe(null));
|
|
3384
|
+
}, [U, h]);
|
|
3385
|
+
const Ye = vt(), $ = o ?? (f == null ? void 0 : f.apiServiceUrl), W = s ?? (g == null ? void 0 : g.accessToken), se = re(() => ({ ...Dn, ...p }), [p]), [we, Ze] = D(null);
|
|
3386
|
+
be(() => {
|
|
3387
|
+
if (!m || !$ || !W) return;
|
|
3388
|
+
let y = !0;
|
|
3389
|
+
return se.getBriefing($, W, m.briefingId).then(({ briefing: P }) => {
|
|
3390
|
+
y && (Z(P), Ze(m), w("author"));
|
|
3391
|
+
}, (P) => {
|
|
3392
|
+
y && F.error(P instanceof Error ? P.message : "Could not open the run.");
|
|
3393
|
+
}), () => {
|
|
3394
|
+
y = !1;
|
|
3395
|
+
};
|
|
3396
|
+
}, [m, $, W, se]);
|
|
3397
|
+
const ge = wn(r), Pe = re(() => {
|
|
3398
|
+
const y = Sn(
|
|
3399
|
+
j,
|
|
3400
|
+
E,
|
|
3401
|
+
t
|
|
3402
|
+
);
|
|
3403
|
+
if (!h)
|
|
3404
|
+
return y;
|
|
3405
|
+
const P = h === "scheduled_report" ? "report" : "briefing";
|
|
3406
|
+
return y.filter(
|
|
3407
|
+
(Me) => le(Me).noun === P
|
|
3408
|
+
);
|
|
3409
|
+
}, [t, j, E, h]), Je = re(() => E === "dashboard" ? {
|
|
3410
|
+
source: { type: "dashboard", dashboardId: t },
|
|
3411
|
+
label: ge,
|
|
3412
|
+
detail: Nn(ge)
|
|
3413
|
+
} : {
|
|
3414
|
+
source: { type: "project" },
|
|
3415
|
+
label: "This project",
|
|
3416
|
+
detail: "Use any data in this project."
|
|
3417
|
+
}, [t, ge, E]), Ne = !!($ && W), Se = wr({
|
|
3418
|
+
canCreate: v.canCreate,
|
|
3419
|
+
analyticalBriefingsEnabled: v.analyticalBriefingsEnabled,
|
|
3420
|
+
scheduledReportAvailable: E === "dashboard"
|
|
3421
|
+
}), oe = ae(async () => {
|
|
3422
|
+
if (!(!$ || !W)) {
|
|
3423
|
+
Q(!0), pe(null);
|
|
3424
|
+
try {
|
|
3425
|
+
I(
|
|
3426
|
+
await kn({
|
|
3427
|
+
apiClient: se,
|
|
3428
|
+
apiServiceUrl: $,
|
|
3429
|
+
token: W
|
|
3430
|
+
})
|
|
3431
|
+
);
|
|
3432
|
+
} catch (y) {
|
|
3433
|
+
pe(
|
|
3434
|
+
y instanceof Error ? y.message : "Could not load briefings."
|
|
3435
|
+
);
|
|
3436
|
+
} finally {
|
|
3437
|
+
Q(!1);
|
|
3438
|
+
}
|
|
3439
|
+
}
|
|
3440
|
+
}, [se, $, W]);
|
|
3441
|
+
be(() => {
|
|
3442
|
+
!U || G !== "list" || !Ne || oe();
|
|
3443
|
+
}, [Ne, G, oe, U]);
|
|
3444
|
+
const ke = () => {
|
|
3445
|
+
Z(null), S("dashboard"), w("list"), A(!0);
|
|
3446
|
+
}, b = (y) => {
|
|
3447
|
+
Z(null), x(y), w("author");
|
|
3448
|
+
}, B = async (y) => {
|
|
3449
|
+
if (!(!$ || !W)) {
|
|
3450
|
+
O(y), pe(null);
|
|
3451
|
+
try {
|
|
3452
|
+
const P = await se.getBriefing(
|
|
3453
|
+
$,
|
|
3454
|
+
W,
|
|
3455
|
+
y
|
|
3456
|
+
);
|
|
3457
|
+
Z(P.briefing), w("author");
|
|
3458
|
+
} catch (P) {
|
|
3459
|
+
pe(
|
|
3460
|
+
P instanceof Error ? P.message : "Could not open briefing."
|
|
3461
|
+
);
|
|
3462
|
+
} finally {
|
|
3463
|
+
O(null);
|
|
3464
|
+
}
|
|
3465
|
+
}
|
|
3466
|
+
}, q = async (y) => {
|
|
3467
|
+
if (!(!$ || !W)) {
|
|
3468
|
+
Y(y.id);
|
|
3469
|
+
try {
|
|
3470
|
+
const P = await se.runBriefingNow(
|
|
3471
|
+
$,
|
|
3472
|
+
W,
|
|
3473
|
+
y.id,
|
|
3474
|
+
{ requestId: Fn() }
|
|
3475
|
+
);
|
|
3476
|
+
Ye.track({ kind: "briefing", id: P.run.id, title: y.name, briefingId: y.id }), oe();
|
|
3477
|
+
} catch (P) {
|
|
3478
|
+
F.error(
|
|
3479
|
+
P instanceof Error ? P.message : "Could not start the run."
|
|
3480
|
+
);
|
|
3481
|
+
} finally {
|
|
3482
|
+
Y(null);
|
|
3483
|
+
}
|
|
3484
|
+
}
|
|
3485
|
+
}, ie = async (y) => {
|
|
3486
|
+
if (!$ || !W) return;
|
|
3487
|
+
const { noun: P } = le(y), Me = P === "report" ? "Report" : "Briefing";
|
|
3488
|
+
Y(y.id);
|
|
3489
|
+
try {
|
|
3490
|
+
const Ue = y.status === "PAUSED" ? await se.resumeBriefing(
|
|
3491
|
+
$,
|
|
3492
|
+
W,
|
|
3493
|
+
y.id
|
|
3494
|
+
) : await se.pauseBriefing(
|
|
3495
|
+
$,
|
|
3496
|
+
W,
|
|
3497
|
+
y.id
|
|
3498
|
+
);
|
|
3499
|
+
F.success(
|
|
3500
|
+
Ue.briefing.status === "PAUSED" ? `${Me} paused` : `${Me} resumed`
|
|
3501
|
+
), oe();
|
|
3502
|
+
} catch (Ue) {
|
|
3503
|
+
F.error(
|
|
3504
|
+
Ue instanceof Error ? Ue.message : `Could not update the ${P} status.`
|
|
3505
|
+
);
|
|
3506
|
+
} finally {
|
|
3507
|
+
Y(null);
|
|
3508
|
+
}
|
|
3509
|
+
}, ue = async () => {
|
|
3510
|
+
if (!R || !$ || !W) return;
|
|
3511
|
+
const y = R;
|
|
3512
|
+
Y(y.id);
|
|
3513
|
+
try {
|
|
3514
|
+
await se.deleteBriefing(
|
|
3515
|
+
$,
|
|
3516
|
+
W,
|
|
3517
|
+
y.id
|
|
3518
|
+
);
|
|
3519
|
+
const { noun: P } = le(y);
|
|
3520
|
+
F.success(`${P === "report" ? "Report" : "Briefing"} deleted`), te(null), oe();
|
|
3521
|
+
} catch (P) {
|
|
3522
|
+
F.error(
|
|
3523
|
+
P instanceof Error ? P.message : "Could not delete the briefing."
|
|
3524
|
+
);
|
|
3525
|
+
} finally {
|
|
3526
|
+
Y(null);
|
|
3527
|
+
}
|
|
3528
|
+
}, Gt = Pe.length;
|
|
3529
|
+
return v.surfaceVisible ? /* @__PURE__ */ n(Ka, { open: U, onOpenChange: A, children: [
|
|
3530
|
+
u ? null : /* @__PURE__ */ e(
|
|
3531
|
+
cn,
|
|
3532
|
+
{
|
|
3533
|
+
disabled: i || !Ne,
|
|
3534
|
+
briefingCount: Gt,
|
|
3535
|
+
className: a,
|
|
3536
|
+
onClick: ke
|
|
3537
|
+
}
|
|
3538
|
+
),
|
|
3539
|
+
/* @__PURE__ */ n(
|
|
3540
|
+
Xa,
|
|
3541
|
+
{
|
|
3542
|
+
ref: Ce,
|
|
3543
|
+
side: "right",
|
|
3544
|
+
hideClose: !0,
|
|
3545
|
+
className: "flex h-full w-full flex-col overflow-hidden p-0 outline-none sm:max-w-[560px]",
|
|
3546
|
+
onOpenAutoFocus: (y) => {
|
|
3547
|
+
var P;
|
|
3548
|
+
y.preventDefault(), (P = Ce.current) == null || P.focus({ preventScroll: !0 });
|
|
3549
|
+
},
|
|
3550
|
+
children: [
|
|
3551
|
+
/* @__PURE__ */ n(Ya, { className: "sr-only", children: [
|
|
3552
|
+
/* @__PURE__ */ e(Za, { children: "Reports & briefings" }),
|
|
3553
|
+
/* @__PURE__ */ e(Ja, { children: "Manage reports and briefings for this dashboard." })
|
|
3554
|
+
] }),
|
|
3555
|
+
h ? /* @__PURE__ */ n("div", { className: "flex shrink-0 items-start justify-between gap-3 border-b border-border pl-4 pr-3 pt-2", children: [
|
|
3556
|
+
/* @__PURE__ */ n(
|
|
3557
|
+
"div",
|
|
3558
|
+
{
|
|
3559
|
+
className: "flex items-center gap-5",
|
|
3560
|
+
role: "tablist",
|
|
3561
|
+
"aria-label": h === "scheduled_report" ? "Email report workflow" : "Analytical briefing workflow",
|
|
3562
|
+
children: [
|
|
3563
|
+
/* @__PURE__ */ e(
|
|
3564
|
+
"button",
|
|
3565
|
+
{
|
|
3566
|
+
type: "button",
|
|
3567
|
+
role: "tab",
|
|
3568
|
+
"aria-selected": G === "author",
|
|
3569
|
+
disabled: !k,
|
|
3570
|
+
className: J(
|
|
3571
|
+
"-mb-px border-b-2 px-0.5 pb-2 text-[12px] transition-colors",
|
|
3572
|
+
G === "author" ? "border-foreground font-medium text-foreground" : "border-transparent text-muted-foreground hover:text-foreground",
|
|
3573
|
+
!k && "cursor-not-allowed opacity-50"
|
|
3574
|
+
),
|
|
3575
|
+
onClick: () => {
|
|
3576
|
+
k && (Z(null), x(h), S("dashboard"), w("author"));
|
|
3577
|
+
},
|
|
3578
|
+
children: T ? `Edit ${le(T).noun}` : h === "scheduled_report" ? "Schedule report" : "Create briefing"
|
|
3579
|
+
}
|
|
3580
|
+
),
|
|
3581
|
+
/* @__PURE__ */ e(
|
|
3582
|
+
"button",
|
|
3583
|
+
{
|
|
3584
|
+
type: "button",
|
|
3585
|
+
role: "tab",
|
|
3586
|
+
"aria-selected": G === "list",
|
|
3587
|
+
className: J(
|
|
3588
|
+
"-mb-px border-b-2 px-0.5 pb-2 text-[12px] transition-colors",
|
|
3589
|
+
G === "list" ? "border-foreground font-medium text-foreground" : "border-transparent text-muted-foreground hover:text-foreground"
|
|
3590
|
+
),
|
|
3591
|
+
onClick: () => w("list"),
|
|
3592
|
+
children: h === "scheduled_report" ? "Manage reports" : "Manage briefings"
|
|
3593
|
+
}
|
|
3594
|
+
)
|
|
3595
|
+
]
|
|
3596
|
+
}
|
|
3597
|
+
),
|
|
3598
|
+
/* @__PURE__ */ e(
|
|
3599
|
+
"button",
|
|
3600
|
+
{
|
|
3601
|
+
type: "button",
|
|
3602
|
+
onClick: () => A(!1),
|
|
3603
|
+
className: "rounded-control p-1 text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
3604
|
+
"aria-label": h === "scheduled_report" ? "Close email report workflow" : "Close analytical briefing workflow",
|
|
3605
|
+
children: /* @__PURE__ */ e(Xe, { className: "h-3.5 w-3.5" })
|
|
3606
|
+
}
|
|
3607
|
+
)
|
|
3608
|
+
] }) : null,
|
|
3609
|
+
G === "list" ? /* @__PURE__ */ e(
|
|
3610
|
+
xn,
|
|
3611
|
+
{
|
|
3612
|
+
briefings: Pe,
|
|
3613
|
+
dashboardLabel: ge,
|
|
3614
|
+
sourceView: E,
|
|
3615
|
+
error: me,
|
|
3616
|
+
loading: H,
|
|
3617
|
+
onSourceViewChange: S,
|
|
3618
|
+
onClose: () => A(!1),
|
|
3619
|
+
onEdit: (y) => {
|
|
3620
|
+
B(y);
|
|
3621
|
+
},
|
|
3622
|
+
onNew: b,
|
|
3623
|
+
canCreate: !h && Se.length > 0,
|
|
3624
|
+
canCreateScheduledReport: Se.includes(
|
|
3625
|
+
"scheduled_report"
|
|
3626
|
+
),
|
|
3627
|
+
analyticalBriefingsEnabled: Se.includes(
|
|
3628
|
+
"analytical_briefing"
|
|
3629
|
+
),
|
|
3630
|
+
onRunNow: (y) => {
|
|
3631
|
+
q(y);
|
|
3632
|
+
},
|
|
3633
|
+
onTogglePause: (y) => {
|
|
3634
|
+
ie(y);
|
|
3635
|
+
},
|
|
3636
|
+
onDelete: (y) => te(y),
|
|
3637
|
+
selectingId: ce,
|
|
3638
|
+
busyId: ye,
|
|
3639
|
+
manageBriefingsHref: c,
|
|
3640
|
+
contentKind: h === "scheduled_report" ? "reports" : h === "analytical_briefing" ? "briefings" : void 0,
|
|
3641
|
+
hideHeader: !!h
|
|
3642
|
+
}
|
|
3643
|
+
) : /* @__PURE__ */ e(
|
|
3644
|
+
er,
|
|
3645
|
+
{
|
|
3646
|
+
apiServiceUrl: $,
|
|
3647
|
+
token: W,
|
|
3648
|
+
briefing: T,
|
|
3649
|
+
initialRunId: we && (T == null ? void 0 : T.id) === we.briefingId ? we.runId : void 0,
|
|
3650
|
+
intent: N,
|
|
3651
|
+
sourceContext: T ? void 0 : Je,
|
|
3652
|
+
title: T ? `Edit ${le(T).noun}` : N === "scheduled_report" ? "Schedule report" : "Create analytical briefing",
|
|
3653
|
+
hideHeader: !!h,
|
|
3654
|
+
className: "h-full min-h-0 max-w-none border-0 shadow-none",
|
|
3655
|
+
onBack: h ? void 0 : () => w("list"),
|
|
3656
|
+
onCancel: () => A(!1),
|
|
3657
|
+
onDeleted: () => {
|
|
3658
|
+
const y = T ? le(T).noun : "briefing";
|
|
3659
|
+
F.success(`${y === "report" ? "Report" : "Briefing"} deleted`), Z(null), w("list"), oe();
|
|
3660
|
+
},
|
|
3661
|
+
onRunStarted: () => {
|
|
3662
|
+
},
|
|
3663
|
+
onSaved: (y) => {
|
|
3664
|
+
Z(y), oe();
|
|
3665
|
+
},
|
|
3666
|
+
onMinimizeRun: () => {
|
|
3667
|
+
A(!1);
|
|
3668
|
+
}
|
|
3669
|
+
}
|
|
3670
|
+
)
|
|
3671
|
+
]
|
|
3672
|
+
}
|
|
3673
|
+
),
|
|
3674
|
+
/* @__PURE__ */ e(
|
|
3675
|
+
lt,
|
|
3676
|
+
{
|
|
3677
|
+
open: !!R,
|
|
3678
|
+
onOpenChange: (y) => {
|
|
3679
|
+
y || te(null);
|
|
3680
|
+
},
|
|
3681
|
+
children: /* @__PURE__ */ n(dt, { children: [
|
|
3682
|
+
/* @__PURE__ */ n(ct, { children: [
|
|
3683
|
+
/* @__PURE__ */ n(ut, { children: [
|
|
3684
|
+
"Delete",
|
|
3685
|
+
" ",
|
|
3686
|
+
R ? le(R).noun : "briefing",
|
|
3687
|
+
"?"
|
|
3688
|
+
] }),
|
|
3689
|
+
/* @__PURE__ */ n(ht, { children: [
|
|
3690
|
+
"This permanently deletes ",
|
|
3691
|
+
/* @__PURE__ */ e("strong", { children: R == null ? void 0 : R.name }),
|
|
3692
|
+
". Recipients will stop receiving it."
|
|
3693
|
+
] })
|
|
3694
|
+
] }),
|
|
3695
|
+
/* @__PURE__ */ n(mt, { children: [
|
|
3696
|
+
/* @__PURE__ */ e(pt, { children: "Cancel" }),
|
|
3697
|
+
/* @__PURE__ */ n(
|
|
3698
|
+
Vt,
|
|
3699
|
+
{
|
|
3700
|
+
className: "bg-destructive/90 hover:bg-destructive",
|
|
3701
|
+
onClick: ue,
|
|
3702
|
+
children: [
|
|
3703
|
+
"Delete",
|
|
3704
|
+
" ",
|
|
3705
|
+
R ? le(R).noun : "briefing"
|
|
3706
|
+
]
|
|
3707
|
+
}
|
|
3708
|
+
)
|
|
3709
|
+
] })
|
|
3710
|
+
] })
|
|
3711
|
+
}
|
|
3712
|
+
)
|
|
3713
|
+
] }) : null;
|
|
3714
|
+
}
|
|
3715
|
+
function Fn() {
|
|
3716
|
+
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `briefing-run-now-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
3717
|
+
}
|
|
3718
|
+
export {
|
|
3719
|
+
ns as A,
|
|
3720
|
+
Yr as D,
|
|
3721
|
+
os as S,
|
|
3722
|
+
is as U,
|
|
3723
|
+
ts as V,
|
|
3724
|
+
cn as W,
|
|
3725
|
+
rs as a,
|
|
3726
|
+
ss as b,
|
|
3727
|
+
ds as c,
|
|
3728
|
+
Jr as d,
|
|
3729
|
+
nn as e,
|
|
3730
|
+
cs as f,
|
|
3731
|
+
us as g,
|
|
3732
|
+
ls as i,
|
|
3733
|
+
as as u
|
|
3734
|
+
};
|