react-semaphor 0.1.555 → 0.1.557
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/DATA_APP_SDK.md +6 -29
- package/dist/analytics-protocol/index.js +20 -21
- package/dist/assistant-context/index.js +1 -1
- package/dist/assistant-protocol/index.js +5 -5
- package/dist/brand-studio/index.js +426 -444
- package/dist/briefings/index.js +56 -57
- package/dist/chunks/{analytics-base-schemas-BKs3flFS.js → analytics-base-schemas-BUFUoO6G.js} +2 -2
- package/dist/chunks/{assistant-chat-8NZP6m-u.js → assistant-chat-WMTpYirZ.js} +79 -81
- package/dist/chunks/{bookmark-state-BAeGKd3s.js → bookmark-state-PjQpxbG7.js} +3 -3
- package/dist/chunks/{braces-o9UiRQes.js → braces-BOErQVyi.js} +1 -1
- package/dist/chunks/comparison-window-caption-Dc7BaCMz.js +1218 -0
- package/dist/chunks/{context-BerEBuFR.js → context-DVy4HOU0.js} +1 -1
- package/dist/chunks/{custom-visual-inputs-Gw-Ggg3O.js → custom-visual-inputs-CxYI-gFa.js} +31 -33
- package/dist/chunks/{dashboard-Ds68ckO3.js → dashboard-4D8Vy4pL.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-DlTr-VGc.js → dashboard-briefing-launcher-C4EmOfxs.js} +149 -151
- package/dist/chunks/{dashboard-controls-oNXJZN6x.js → dashboard-controls-DBWykmvL.js} +171 -173
- package/dist/chunks/{dashboard-json-CW7Q_efH.js → dashboard-json-DiX-p0F7.js} +21 -22
- package/dist/chunks/{document-dashboard-inputs-C21mL3ib.js → document-dashboard-inputs-DP5hquBR.js} +32 -32
- package/dist/chunks/{edit-dashboard-visual-BnnT_oKR.js → edit-dashboard-visual-n1jLV_7V.js} +5842 -5955
- package/dist/chunks/{filter-reach-copy-DlNPHbE-.js → filter-reach-copy-BB9iakLA.js} +915 -986
- package/dist/chunks/{filter-value-text-DMrpj4h9.js → filter-value-text-CUBpotVN.js} +5 -5
- package/dist/chunks/{global-date-filter-utils-7OboTgrM.js → global-date-filter-utils-Cc5tqkoW.js} +2908 -3112
- package/dist/chunks/{index-B2k6KtUN.js → index-CgjhzkKM.js} +72 -80
- package/dist/chunks/{index-CtoK1Lgu.js → index-dIV-Gdsb.js} +159 -161
- package/dist/chunks/{layout-grid-Bgzth8vd.js → layout-grid-CcNklCwL.js} +1 -1
- package/dist/chunks/{list-filter-DsaTbM3J.js → list-filter-Ds_4UTpD.js} +1 -1
- package/dist/chunks/{matrix-analytical-definition-DPVGg1mU.js → matrix-analytical-definition-4GTUDheD.js} +22 -22
- package/dist/chunks/{matrix-card-D9bsdAye.js → matrix-card-fS_4O7zA.js} +3 -3
- package/dist/chunks/{matrix-member-presentation-DRWcJ8Mi.js → matrix-member-presentation-Dj7HaAHC.js} +1 -1
- package/dist/chunks/{matrix-operation-contract--lMaLlpV.js → matrix-operation-contract-CpgLZ7E5.js} +52 -52
- package/dist/chunks/{metric-comparison-CYIt2F5X.js → metric-comparison-C8LY7GG5.js} +4 -4
- package/dist/chunks/{model-change-B0rAK-5w.js → model-change-CJEj3ZD6.js} +1 -1
- package/dist/chunks/{palette-D10o_yYX.js → palette-DMkIhagj.js} +1 -1
- package/dist/chunks/{matrix-formatter-K2OVPJQI.js → pivot-result-contract-expectations-DMk-mKhG.js} +451 -402
- package/dist/chunks/pivot-result-identity-CrQ54Xbj.js +77 -0
- package/dist/chunks/{raw-temporal-presentation-CivONfcO.js → raw-temporal-presentation-DdEpgPRB.js} +25 -26
- package/dist/chunks/report-preferences-dialog-CFg5VFLk.js +2109 -0
- package/dist/chunks/{report-runtime-context-BaIKSaja.js → report-runtime-context-CohdtiMg.js} +2 -2
- package/dist/chunks/{resolve-dashboard-input-context-CIm9A8_j.js → resolve-dashboard-input-context-Djl3kCFL.js} +1396 -1550
- package/dist/chunks/{save-CfJpQQ68.js → save-D1EpMcwT.js} +1 -1
- package/dist/chunks/{saved-dashboard-context-akb9JfOL.js → saved-dashboard-context-umlQFevH.js} +9 -9
- package/dist/chunks/selection-reducer-_d6aKJnj.js +46 -0
- package/dist/chunks/{semaphor-ready-indicator-Ba7dwP5_.js → semaphor-ready-indicator-4cOp6sla.js} +54479 -63899
- package/dist/chunks/{shelf-drop-preview-context-5rg3pJHW.js → shelf-drop-preview-context-DAtRuvR7.js} +7 -7
- package/dist/chunks/{source-entity-resolution-CGymm5td.js → source-entity-resolution-DXW1HpKf.js} +1 -1
- package/dist/chunks/{switch-B-UTI6v-.js → switch-9CJt5EF_.js} +1431 -1342
- package/dist/chunks/{table-export-sheet-CgO6gaSM.js → table-export-sheet-CTCTA_bd.js} +1 -1
- package/dist/chunks/{table-settings-DOT_Bv1m.js → table-settings-DF1gdVQR.js} +3 -3
- package/dist/chunks/temporal-input-presentation-DoSniQj1.js +2939 -0
- package/dist/chunks/{token-types-DYECHYGH.js → token-types-DFyLflLY.js} +1 -1
- package/dist/chunks/{upload-BFX7apKV.js → upload-LSNKpt0w.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-BHNs0wl7.js → use-create-flow-overlay-state-esyMT9vU.js} +125 -127
- package/dist/chunks/{validators-ClKLGDGZ.js → validators-hmfNNQz8.js} +305 -307
- package/dist/chunks/zoned-wall-clock-E35Frf9v.js +191 -0
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +168 -169
- package/dist/data-app-sdk/index.js +789 -4154
- package/dist/data-app-sdk-adapters/index.js +3 -3
- package/dist/data-app-sdk-validation/index.js +6 -6
- package/dist/format-utils/index.js +234 -253
- package/dist/index.js +233 -235
- package/dist/layouts/index.js +1 -1
- package/dist/pdf-export-policy/index.js +9 -11
- package/dist/report-runtime-context/index.js +2 -2
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/brand-studio/brand-studio-draft.d.ts +0 -3
- package/dist/types/brand-studio/index.d.ts +1 -1
- package/dist/types/components/visual/data-table/types/data-table.d.ts +0 -1
- package/dist/types/components/visual/shared/utils/table-column-order.d.ts +0 -6
- package/dist/types/data-app-sdk/contracts.d.ts +0 -146
- package/dist/types/data-app-sdk/index.d.ts +0 -2
- package/dist/types/index.js +27 -28
- package/dist/types/lib/api/exports-api.d.ts +1 -1
- package/dist/types/lib/charts/table-chart-types.d.ts +1 -1
- package/dist/types/lib/charts/types.d.ts +2 -2
- package/dist/types/lib/dashboard-viewer/export-table-view.d.ts +0 -3
- package/dist/types/lib/document/document-edits.d.ts +1 -1
- package/dist/types/lib/document/document-section-kinds.d.ts +2 -4
- package/dist/types/lib/document/document-table-data-policy.d.ts +1 -2
- package/dist/types/lib/formatters/grouped-temporal-activation.d.ts +3 -3
- package/dist/types/lib/formatters/grouped-temporal-presentation.d.ts +0 -6
- package/dist/types/lib/query-context/card-server-request.d.ts +0 -1
- package/dist/types/lib/table-formatting/table-formatting-types.d.ts +1 -1
- package/dist/types/lib/types/common-types.d.ts +0 -7
- package/dist/types/lib/types/explorer-types.d.ts +1 -14
- package/dist/types/lib/utils/card-config-utils.d.ts +11 -1
- package/dist/types/shared/dashboard-authoring/card-export-request.d.ts +1 -2
- package/dist/types/shared/dashboard-authoring/filter-model/filter-definitions.d.ts +1 -7
- package/dist/types/shared/dashboard-authoring/legacy-table-routing.d.ts +9 -4
- package/dist/types/shared/format-utils/grouped-table-presentation.d.ts +0 -14
- package/dist/types/shared/format-utils/index.d.ts +0 -2
- package/dist/types/shared/format-utils/pdf-export-policy.d.ts +1 -1
- package/dist/types/shared/format-utils/pivot-result-contract-expectations.d.ts +2 -20
- package/dist/types/shared/format-utils/pivot-result-identity.d.ts +0 -20
- package/dist/types/shared/format-utils/table-export/prepare-table-export.d.ts +0 -1
- package/dist/types/shared/format-utils/table-export/table-export-result.d.ts +0 -4
- package/package.json +2 -4
- package/src/data-app-sdk/README.md +7 -31
- package/dist/chunks/comparison-window-caption-C2WNTlxK.js +0 -1433
- package/dist/chunks/pivot-header-presentation-CX4fkRuG.js +0 -42
- package/dist/chunks/pivot-result-identity-BHJGZwIc.js +0 -94
- package/dist/chunks/pivot-result-lifecycle-BygCpOhk.js +0 -1238
- package/dist/chunks/raw-temporal-contract-WuXA8jBP.js +0 -64
- package/dist/chunks/report-preferences-dialog-D_KyuEFx.js +0 -2261
- package/dist/chunks/selection-reducer-yw_JgICP.js +0 -111
- package/dist/chunks/temporal-bucket-C4rqmwaQ.js +0 -2071
- package/dist/chunks/x-4f5U2XwU.js +0 -100
- package/dist/chunks/zoned-wall-clock-MulfA26h.js +0 -129
- package/dist/types/components/visual/pivot-table/types.d.ts +0 -80
- package/dist/types/data-app-sdk/devtools/index.d.ts +0 -49
- package/dist/types/data-app-sdk/devtools.d.ts +0 -1
- package/dist/types/shared/format-utils/aggregate-table-row-presentation.d.ts +0 -85
- package/dist/types/shared/format-utils/pivot-result-lifecycle.d.ts +0 -55
|
@@ -1,2261 +0,0 @@
|
|
|
1
|
-
import { jsxs as h, jsx as i, Fragment as te } from "react/jsx-runtime";
|
|
2
|
-
import * as v from "react";
|
|
3
|
-
import jt, { useRef as U, useState as z, useCallback as j, useEffect as H, useMemo as J, createContext as $t, useContext as He, lazy as Ee, Suspense as Se, useLayoutEffect as Ie, Activity as Vt, useId as ce } from "react";
|
|
4
|
-
import { u as _, bh as Kt, bi as Ht, bj as gt, a4 as qt, bk as Gt, bl as Xt, bm as Jt, b as Yt, b5 as qe, bn as Zt, bo as Qt, bp as yt, x as ea, bq as ta, br as aa, bs as ra, bt as na, bu as ge, bv as wt, bw as tt, bx as sa, Z as ye, Y as la, by as ia, bz as oa, _ as at, $ as da, bA as ca, E as ua, F as fa, S as ma, B as ha, a as pa, U as ba, bB as va, D as ga, A as ya, C as wa, bC as Sa, bD as xa, bE as Ia, bF as Ca, bG as rt, bH as ke, bI as Ea, bJ as Ge, bK as X, bL as Na, bM as Ta, bN as ka, bO as Aa, bP as Da } from "./semaphor-ready-indicator-Ba7dwP5_.js";
|
|
5
|
-
import "./validators-ClKLGDGZ.js";
|
|
6
|
-
import "./matrix-operation-contract--lMaLlpV.js";
|
|
7
|
-
import "./analytics-base-schemas-BKs3flFS.js";
|
|
8
|
-
import "zod";
|
|
9
|
-
import { Y as Ra, cW as _a, bs as Pa, bt as Oa, as as Fa, s as La } from "./global-date-filter-utils-7OboTgrM.js";
|
|
10
|
-
import { j as za } from "./index-CuHybtft.js";
|
|
11
|
-
import { parseValueFormatPreferencesResponse as Ma, canonicalizeSupportedLocale as St, getSupportedCurrencyCodes as Ua, canonicalizeSupportedCurrencyCode as Wa } from "../value-format-preferences/index.js";
|
|
12
|
-
import { c as W } from "./_commonjsHelpers-DimLPMtv.js";
|
|
13
|
-
import "./index-CtoK1Lgu.js";
|
|
14
|
-
import "./pivot-result-lifecycle-BygCpOhk.js";
|
|
15
|
-
import { I as Ba } from "./table-settings-DOT_Bv1m.js";
|
|
16
|
-
import { l as oe, B as q, N as ja, O as $a, Q as Va, U as Ka, V as Ha, W as qa, X as ie, z as ee, Y as pe, P as Ga, a as Xa, b as Ja, c as nt, L as xt, r as Le, s as ze, t as Me, u as Ue, v as Z, T as Ya, d as Za, e as st, g as lt } from "./switch-B-UTI6v-.js";
|
|
17
|
-
import { X as Qa } from "./x-4f5U2XwU.js";
|
|
18
|
-
import { r as er, a as It } from "./availability-Bp5Gfu1I.js";
|
|
19
|
-
import { a as tr } from "./filter-reach-copy-DlNPHbE-.js";
|
|
20
|
-
import { S as ar } from "./selection-reducer-yw_JgICP.js";
|
|
21
|
-
import { a as rr } from "./report-runtime-context-BaIKSaja.js";
|
|
22
|
-
import { r as we, M as ue } from "./temporal-bucket-C4rqmwaQ.js";
|
|
23
|
-
function nr(e = []) {
|
|
24
|
-
const a = U(null), t = U(null), n = U(null), [r, l] = z(), s = j(() => {
|
|
25
|
-
var u, g, b;
|
|
26
|
-
const o = ((u = a.current) == null ? void 0 : u.clientWidth) ?? 0, m = ((g = n.current) == null ? void 0 : g.offsetWidth) ?? 0, c = ((b = t.current) == null ? void 0 : b.offsetWidth) ?? 0, d = o - m - c - 8, p = Math.max(d, 0);
|
|
27
|
-
l((y) => y === p ? y : p);
|
|
28
|
-
}, []);
|
|
29
|
-
return H(() => {
|
|
30
|
-
const o = a.current;
|
|
31
|
-
if (!o || typeof ResizeObserver > "u") return;
|
|
32
|
-
const m = new ResizeObserver(() => s());
|
|
33
|
-
return m.observe(o), s(), () => m.disconnect();
|
|
34
|
-
}, [s, ...e]), {
|
|
35
|
-
headerRef: a,
|
|
36
|
-
leftActionsRef: t,
|
|
37
|
-
rightActionsRef: n,
|
|
38
|
-
titleMaxWidth: r,
|
|
39
|
-
updateAvailableWidth: s
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
function sr({ filter: e }) {
|
|
43
|
-
var y;
|
|
44
|
-
const a = _(
|
|
45
|
-
(w) => w.isDashboardEditing
|
|
46
|
-
), { preferences: t } = Kt(), n = Ht((y = t == null ? void 0 : t.cardDisplay) == null ? void 0 : y.mode), r = _((w) => w.dashboard), l = _(
|
|
47
|
-
(w) => w.dashboardInputValues
|
|
48
|
-
), s = _((w) => w.selectedSheetId), o = gt(), m = J(() => {
|
|
49
|
-
var O;
|
|
50
|
-
const w = (O = Ra(r).findFilterInput({
|
|
51
|
-
filterId: e.id
|
|
52
|
-
})) == null ? void 0 : O.input;
|
|
53
|
-
if (!w) return !1;
|
|
54
|
-
const D = _a({
|
|
55
|
-
dashboard: r,
|
|
56
|
-
input: w,
|
|
57
|
-
runtimeValues: l,
|
|
58
|
-
target: { sheetId: s },
|
|
59
|
-
calendar: o
|
|
60
|
-
});
|
|
61
|
-
return (D == null ? void 0 : D.status) === "set";
|
|
62
|
-
}, [o, r, l, e.id, s]), { removeFilterInput: c, saveFilterSettings: S } = qt(), {
|
|
63
|
-
headerRef: d,
|
|
64
|
-
leftActionsRef: p,
|
|
65
|
-
rightActionsRef: u,
|
|
66
|
-
titleMaxWidth: g,
|
|
67
|
-
updateAvailableWidth: b
|
|
68
|
-
} = nr([
|
|
69
|
-
a,
|
|
70
|
-
m,
|
|
71
|
-
n
|
|
72
|
-
]);
|
|
73
|
-
return H(() => {
|
|
74
|
-
b();
|
|
75
|
-
}, [e.title, b]), /* @__PURE__ */ h(
|
|
76
|
-
"div",
|
|
77
|
-
{
|
|
78
|
-
ref: d,
|
|
79
|
-
className: "group mb-1 flex h-5 items-center justify-between",
|
|
80
|
-
children: [
|
|
81
|
-
/* @__PURE__ */ h("div", { className: "flex grow items-center gap-2 min-w-0", children: [
|
|
82
|
-
/* @__PURE__ */ i(
|
|
83
|
-
"div",
|
|
84
|
-
{
|
|
85
|
-
className: "min-w-0 flex-1",
|
|
86
|
-
style: g !== void 0 ? { maxWidth: g } : void 0,
|
|
87
|
-
children: /* @__PURE__ */ i(oe, { className: "my-1 block w-full text-sm", children: /* @__PURE__ */ i(
|
|
88
|
-
Gt,
|
|
89
|
-
{
|
|
90
|
-
value: e.title || e.column,
|
|
91
|
-
onSave: (w) => S(
|
|
92
|
-
{ filterId: e.id },
|
|
93
|
-
{ definition: { ...e, title: w } }
|
|
94
|
-
),
|
|
95
|
-
isEditable: a,
|
|
96
|
-
placeholder: "Filter",
|
|
97
|
-
displayClassName: "text-sm truncate",
|
|
98
|
-
inputClassName: "text-sm"
|
|
99
|
-
}
|
|
100
|
-
) })
|
|
101
|
-
}
|
|
102
|
-
),
|
|
103
|
-
/* @__PURE__ */ h(
|
|
104
|
-
"div",
|
|
105
|
-
{
|
|
106
|
-
className: "flex shrink-0 items-center gap-1.5",
|
|
107
|
-
ref: p,
|
|
108
|
-
children: [
|
|
109
|
-
a && /* @__PURE__ */ i(
|
|
110
|
-
Xt,
|
|
111
|
-
{
|
|
112
|
-
filter: e,
|
|
113
|
-
isEditing: a,
|
|
114
|
-
filterRef: { filterId: e.id }
|
|
115
|
-
}
|
|
116
|
-
),
|
|
117
|
-
a && /* @__PURE__ */ i(
|
|
118
|
-
"button",
|
|
119
|
-
{
|
|
120
|
-
onClick: () => {
|
|
121
|
-
c({ filterId: e.id });
|
|
122
|
-
},
|
|
123
|
-
className: "text-muted-foreground hover:text-foreground",
|
|
124
|
-
children: /* @__PURE__ */ i(Qa, { className: "size-3.5" })
|
|
125
|
-
}
|
|
126
|
-
)
|
|
127
|
-
]
|
|
128
|
-
}
|
|
129
|
-
)
|
|
130
|
-
] }),
|
|
131
|
-
/* @__PURE__ */ i("div", { className: "hidden", ref: u })
|
|
132
|
-
]
|
|
133
|
-
}
|
|
134
|
-
);
|
|
135
|
-
}
|
|
136
|
-
function lr() {
|
|
137
|
-
const e = _((r) => r.dashboard), a = _((r) => r.selectedSheetId), t = _((r) => r.theme), n = J(
|
|
138
|
-
() => Pa(e, a, "dashboard").filter(({ input: r }) => Oa(r)).map(({ input: r }) => r.filter),
|
|
139
|
-
[e, a]
|
|
140
|
-
);
|
|
141
|
-
return n.length ? /* @__PURE__ */ i(
|
|
142
|
-
"div",
|
|
143
|
-
{
|
|
144
|
-
className: W("mb-1 flex items-center gap-2 border-y px-0.5 pb-0.5", {
|
|
145
|
-
"bg-[repeating-linear-gradient(45deg,_#ffffff_0_3px,_#f3f3f3_3px_6px)]": t === "light",
|
|
146
|
-
"bg-[repeating-linear-gradient(45deg,_#18171d_0_3px,_#272729_3px_6px)]": t === "dark"
|
|
147
|
-
}),
|
|
148
|
-
children: n.map((r) => /* @__PURE__ */ h(
|
|
149
|
-
"div",
|
|
150
|
-
{
|
|
151
|
-
className: "flex min-w-[250px] max-w-fit flex-col gap-1 p-2",
|
|
152
|
-
children: [
|
|
153
|
-
/* @__PURE__ */ i(sr, { filter: r }),
|
|
154
|
-
/* @__PURE__ */ i(Jt, { filter: r })
|
|
155
|
-
]
|
|
156
|
-
},
|
|
157
|
-
r.id
|
|
158
|
-
))
|
|
159
|
-
}
|
|
160
|
-
) : null;
|
|
161
|
-
}
|
|
162
|
-
function ir() {
|
|
163
|
-
var l;
|
|
164
|
-
const e = _((s) => s.dashboard), a = _((s) => s.selectedSheetId), t = _(
|
|
165
|
-
(s) => s.isDashboardEditing
|
|
166
|
-
), n = (l = e.sheets) == null ? void 0 : l.find(
|
|
167
|
-
(s) => s.id === a
|
|
168
|
-
), r = Fa(n);
|
|
169
|
-
return /* @__PURE__ */ i(
|
|
170
|
-
"div",
|
|
171
|
-
{
|
|
172
|
-
role: "dashboard-plus-main",
|
|
173
|
-
className: "flex min-h-0 grow basis-0 overflow-hidden",
|
|
174
|
-
children: /* @__PURE__ */ h("section", { className: "flex min-h-0 grow basis-0 flex-col overflow-hidden", children: [
|
|
175
|
-
t && !r && /* @__PURE__ */ i(lr, {}),
|
|
176
|
-
/* @__PURE__ */ i(Yt, {})
|
|
177
|
-
] })
|
|
178
|
-
}
|
|
179
|
-
);
|
|
180
|
-
}
|
|
181
|
-
const or = /* @__PURE__ */ new Set(["iat", "exp", "nbf", "jti"]);
|
|
182
|
-
function dr(e) {
|
|
183
|
-
return La(
|
|
184
|
-
Object.fromEntries(
|
|
185
|
-
Object.entries(e ?? {}).filter(([a]) => !or.has(a))
|
|
186
|
-
)
|
|
187
|
-
);
|
|
188
|
-
}
|
|
189
|
-
function cr(e) {
|
|
190
|
-
var t;
|
|
191
|
-
const a = e == null ? void 0 : e.config;
|
|
192
|
-
return er({
|
|
193
|
-
features: ((t = a == null ? void 0 : a.projectFeatures) == null ? void 0 : t.features) ?? {},
|
|
194
|
-
config: { enabled: It(a).enabled },
|
|
195
|
-
identity: {
|
|
196
|
-
orgUserId: e == null ? void 0 : e.orgUserId,
|
|
197
|
-
tenantId: e == null ? void 0 : e.tenantId,
|
|
198
|
-
endUserId: e == null ? void 0 : e.endUserId
|
|
199
|
-
},
|
|
200
|
-
modelConfigured: !0
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
let it = 0;
|
|
204
|
-
function ot(e, a) {
|
|
205
|
-
it += 1;
|
|
206
|
-
const { name: t, layout: n } = It(a == null ? void 0 : a.config);
|
|
207
|
-
return { ...Qt(n), id: it, callerKey: e, assistantName: t };
|
|
208
|
-
}
|
|
209
|
-
function ur({
|
|
210
|
-
children: e,
|
|
211
|
-
authToken: a
|
|
212
|
-
}) {
|
|
213
|
-
const t = qe(), n = J(
|
|
214
|
-
() => a === void 0 ? t.tokenProps : mr(a),
|
|
215
|
-
[a, t.tokenProps]
|
|
216
|
-
), r = J(() => dr(n), [n]), l = J(
|
|
217
|
-
() => cr(n).available,
|
|
218
|
-
[n]
|
|
219
|
-
), [s, o] = z(() => ot(r, n));
|
|
220
|
-
s.callerKey !== r && o(ot(r, n)), hr(s);
|
|
221
|
-
const m = J(() => ({ instance: s, available: l }), [s, l]);
|
|
222
|
-
return /* @__PURE__ */ i(Zt.Provider, { value: m, children: e });
|
|
223
|
-
}
|
|
224
|
-
function fr({ children: e }) {
|
|
225
|
-
return yt() ? /* @__PURE__ */ i(te, { children: e }) : /* @__PURE__ */ i(ur, { children: e });
|
|
226
|
-
}
|
|
227
|
-
function mr(e) {
|
|
228
|
-
if (!(e != null && e.accessToken)) return {};
|
|
229
|
-
try {
|
|
230
|
-
return za(e.accessToken);
|
|
231
|
-
} catch {
|
|
232
|
-
return {};
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
function hr(e) {
|
|
236
|
-
H(() => {
|
|
237
|
-
const a = (n, r) => {
|
|
238
|
-
const l = e.store.getState().focus;
|
|
239
|
-
l && !pr(l, n, r) && e.clearFocus();
|
|
240
|
-
}, t = _.getState();
|
|
241
|
-
return a(t.selectedSheetId, t.dashboard), _.subscribe((n, r) => {
|
|
242
|
-
(n.selectedSheetId !== r.selectedSheetId || n.dashboard !== r.dashboard) && a(n.selectedSheetId, n.dashboard), n.isVisualEditing && !r.isVisualEditing && e.leaveBeside();
|
|
243
|
-
});
|
|
244
|
-
}, [e]);
|
|
245
|
-
}
|
|
246
|
-
function pr(e, a, t) {
|
|
247
|
-
if ((a ?? null) !== e.sheetId) return !1;
|
|
248
|
-
const n = t ? Ba(t, e.cardId) : void 0;
|
|
249
|
-
return !!n && n.sheet.id === e.sheetId;
|
|
250
|
-
}
|
|
251
|
-
const br = 640, vr = 960;
|
|
252
|
-
function gr(e) {
|
|
253
|
-
return e >= vr ? "lg" : e >= br ? "md" : "sm";
|
|
254
|
-
}
|
|
255
|
-
function yr(e, a) {
|
|
256
|
-
return e === "always" ? !0 : e === "menu" ? !1 : e === "md" ? a !== "sm" : a === "lg";
|
|
257
|
-
}
|
|
258
|
-
const wr = {
|
|
259
|
-
width: "lg",
|
|
260
|
-
hasOverflowMenu: !1,
|
|
261
|
-
overflowItems: [],
|
|
262
|
-
register: () => () => {
|
|
263
|
-
},
|
|
264
|
-
openOverflowId: null,
|
|
265
|
-
setOpenOverflowId: () => {
|
|
266
|
-
},
|
|
267
|
-
anchorSlot: null,
|
|
268
|
-
setAnchorSlot: () => {
|
|
269
|
-
}
|
|
270
|
-
}, Xe = $t(wr);
|
|
271
|
-
function qn() {
|
|
272
|
-
const [e, a] = z("lg"), t = U(null);
|
|
273
|
-
return { measure: j((r) => {
|
|
274
|
-
var s;
|
|
275
|
-
if ((s = t.current) == null || s.disconnect(), t.current = null, !r || typeof ResizeObserver > "u") return;
|
|
276
|
-
const l = (o) => a(gr(o));
|
|
277
|
-
l(r.getBoundingClientRect().width), t.current = new ResizeObserver(([o]) => {
|
|
278
|
-
o && l(o.contentRect.width);
|
|
279
|
-
}), t.current.observe(r);
|
|
280
|
-
}, []), width: e };
|
|
281
|
-
}
|
|
282
|
-
function Sr() {
|
|
283
|
-
return He(Xe).width;
|
|
284
|
-
}
|
|
285
|
-
function Gn() {
|
|
286
|
-
return He(Xe).overflowItems;
|
|
287
|
-
}
|
|
288
|
-
function Xn(e, a, t) {
|
|
289
|
-
const n = He(Xe), r = n.hasOverflowMenu && !yr(a, n.width), { register: l, setOpenOverflowId: s } = n, o = t == null ? void 0 : t.label, m = t == null ? void 0 : t.hint, c = t == null ? void 0 : t.checked, S = (t == null ? void 0 : t.order) ?? 0, d = U(t == null ? void 0 : t.icon);
|
|
290
|
-
d.current = t == null ? void 0 : t.icon;
|
|
291
|
-
const p = U(t == null ? void 0 : t.onSelect);
|
|
292
|
-
p.current = t == null ? void 0 : t.onSelect;
|
|
293
|
-
const u = U(t == null ? void 0 : t.onOpen);
|
|
294
|
-
return u.current = t == null ? void 0 : t.onOpen, H(() => {
|
|
295
|
-
if (!(!r || o === void 0))
|
|
296
|
-
return l({
|
|
297
|
-
id: e,
|
|
298
|
-
label: o,
|
|
299
|
-
icon: d.current,
|
|
300
|
-
hint: m,
|
|
301
|
-
checked: c,
|
|
302
|
-
order: S,
|
|
303
|
-
onSelect: () => {
|
|
304
|
-
if (p.current) return p.current();
|
|
305
|
-
window.setTimeout(() => {
|
|
306
|
-
var g;
|
|
307
|
-
s(e), (g = u.current) == null || g.call(u);
|
|
308
|
-
}, 0);
|
|
309
|
-
}
|
|
310
|
-
});
|
|
311
|
-
}, [c, r, m, e, o, S, l, s]), {
|
|
312
|
-
collapsed: r,
|
|
313
|
-
popoverOpen: n.openOverflowId === e,
|
|
314
|
-
setPopoverOpen: (g) => s(g ? e : null),
|
|
315
|
-
anchorSlot: n.anchorSlot
|
|
316
|
-
};
|
|
317
|
-
}
|
|
318
|
-
const xr = Ee(() => import("./assistant-chat-8NZP6m-u.js"));
|
|
319
|
-
function Jn() {
|
|
320
|
-
const e = ea(), a = Sr();
|
|
321
|
-
if (!e.available) return null;
|
|
322
|
-
const t = a !== "lg";
|
|
323
|
-
return /* @__PURE__ */ h(
|
|
324
|
-
q,
|
|
325
|
-
{
|
|
326
|
-
variant: e.isOpen ? "secondary" : "outline",
|
|
327
|
-
size: "xs",
|
|
328
|
-
"aria-pressed": e.isOpen,
|
|
329
|
-
"aria-label": e.assistantName,
|
|
330
|
-
title: t ? e.assistantName : void 0,
|
|
331
|
-
onClick: e.toggle,
|
|
332
|
-
className: t ? "w-7 px-0" : void 0,
|
|
333
|
-
children: [
|
|
334
|
-
/* @__PURE__ */ i(ta, { className: "h-3.5 w-3.5" }),
|
|
335
|
-
!t && e.assistantName
|
|
336
|
-
]
|
|
337
|
-
}
|
|
338
|
-
);
|
|
339
|
-
}
|
|
340
|
-
const Ir = {
|
|
341
|
-
// Docked widths are the viewer's (the resize handle), applied as a style.
|
|
342
|
-
"docked-right": "relative shrink-0 border-l border-border",
|
|
343
|
-
"docked-left": "relative order-first shrink-0 border-r border-border",
|
|
344
|
-
centered: "absolute left-1/2 top-1/2 z-30 h-[min(80%,760px)] w-[min(640px,calc(100%-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-card border border-border shadow-lg",
|
|
345
|
-
"full-page": "absolute inset-0 z-30"
|
|
346
|
-
}, Cr = "absolute left-0 top-0 z-30 max-h-[var(--assistant-beside-max-h)] max-w-[var(--assistant-beside-max-w)] rounded-card border border-border shadow-lg", Er = 640, he = 8;
|
|
347
|
-
function Nr({ surface: e = "dashboard" } = {}) {
|
|
348
|
-
const a = yt(), { isOpen: t, mounted: n, storedLayout: r, width: l, beside: s, besideSize: o, focusCardId: m, askCount: c } = aa(
|
|
349
|
-
(a == null ? void 0 : a.instance.store) ?? na,
|
|
350
|
-
ra((y) => {
|
|
351
|
-
var w;
|
|
352
|
-
return {
|
|
353
|
-
isOpen: y.isOpen,
|
|
354
|
-
mounted: y.mounted,
|
|
355
|
-
storedLayout: y.layout,
|
|
356
|
-
width: y.width,
|
|
357
|
-
beside: y.beside,
|
|
358
|
-
besideSize: y.besideSize,
|
|
359
|
-
focusCardId: (w = y.focus) == null ? void 0 : w.cardId,
|
|
360
|
-
askCount: y.askCount
|
|
361
|
-
};
|
|
362
|
-
})
|
|
363
|
-
), S = e === "none", d = _(
|
|
364
|
-
(y) => s && t && m && !S ? Tr(y.dashboard, y.selectedSheetId, m) : void 0
|
|
365
|
-
), p = kr(d, c);
|
|
366
|
-
if (!(a != null && a.available) || !n && !S) return null;
|
|
367
|
-
const u = S ? "full-page" : p.shown ? "beside-card" : r, g = S || t, b = u === "docked-right" || u === "docked-left";
|
|
368
|
-
return /* @__PURE__ */ h(
|
|
369
|
-
"aside",
|
|
370
|
-
{
|
|
371
|
-
ref: p.setFloating,
|
|
372
|
-
"aria-label": a.instance.assistantName,
|
|
373
|
-
"data-testid": "assistant-panel",
|
|
374
|
-
"data-layout": u,
|
|
375
|
-
"data-beside-frame": u === "beside-card" ? d : void 0,
|
|
376
|
-
"data-beside-side": u === "beside-card" ? p.side : void 0,
|
|
377
|
-
className: W(
|
|
378
|
-
"flex-col bg-background",
|
|
379
|
-
u === "beside-card" ? Cr : Ir[u],
|
|
380
|
-
g ? "flex" : "hidden"
|
|
381
|
-
),
|
|
382
|
-
style: u === "beside-card" ? { ...p.style, width: o.width, height: o.height } : (
|
|
383
|
-
// The saved width, never more than the share of the dashboard's area the
|
|
384
|
-
// handle allows, however the area is sized now or later (P4-10).
|
|
385
|
-
b ? { width: l, maxWidth: `${Ct * 100}%` } : void 0
|
|
386
|
-
),
|
|
387
|
-
onKeyDown: u === "beside-card" ? (y) => {
|
|
388
|
-
if (y.key !== "Escape" || y.defaultPrevented || !(y.target instanceof Node) || !y.currentTarget.contains(y.target)) return;
|
|
389
|
-
y.preventDefault();
|
|
390
|
-
const w = p.cardActions();
|
|
391
|
-
a.instance.close(), w == null || w.focus();
|
|
392
|
-
} : void 0,
|
|
393
|
-
children: [
|
|
394
|
-
b ? /* @__PURE__ */ i(Rr, { instance: a.instance, side: u === "docked-left" ? "right" : "left", width: l }) : null,
|
|
395
|
-
u === "beside-card" ? /* @__PURE__ */ i(Dr, { instance: a.instance, size: o, side: p.handleSide }) : null,
|
|
396
|
-
/* @__PURE__ */ i(Se, { fallback: null, children: /* @__PURE__ */ i(xr, { instance: a.instance, surface: e, placement: u }, a.instance.id) })
|
|
397
|
-
]
|
|
398
|
-
}
|
|
399
|
-
);
|
|
400
|
-
}
|
|
401
|
-
function Tr(e, a, t) {
|
|
402
|
-
var r, l, s;
|
|
403
|
-
const n = (r = e.sheets) == null ? void 0 : r.find((o) => o.id === a);
|
|
404
|
-
return (s = (l = n == null ? void 0 : n.frames) == null ? void 0 : l.find((o) => {
|
|
405
|
-
var m;
|
|
406
|
-
return (m = o.cards) == null ? void 0 : m.some((c) => c.id === t);
|
|
407
|
-
})) == null ? void 0 : s.id;
|
|
408
|
-
}
|
|
409
|
-
function kr(e, a) {
|
|
410
|
-
var g;
|
|
411
|
-
const [t, n] = z(void 0), [r, l] = z(void 0), s = U(a);
|
|
412
|
-
Ie(() => {
|
|
413
|
-
s.current = a;
|
|
414
|
-
});
|
|
415
|
-
const o = r === a ? null : t, { refs: m, elements: c, floatingStyles: S, middlewareData: d, isPositioned: p } = ja({
|
|
416
|
-
strategy: "absolute",
|
|
417
|
-
placement: o ?? "right-start",
|
|
418
|
-
middleware: [
|
|
419
|
-
$a(he),
|
|
420
|
-
Va({ padding: he }),
|
|
421
|
-
Ka({
|
|
422
|
-
padding: he,
|
|
423
|
-
apply: ({ availableWidth: b, availableHeight: y, elements: w }) => {
|
|
424
|
-
w.floating.style.setProperty("--assistant-beside-max-w", `${Math.max(0, b)}px`), w.floating.style.setProperty("--assistant-beside-max-h", `${Math.max(0, y)}px`);
|
|
425
|
-
}
|
|
426
|
-
}),
|
|
427
|
-
Ha()
|
|
428
|
-
],
|
|
429
|
-
whileElementsMounted: (b, y, w) => qa(b, y, () => {
|
|
430
|
-
const D = Ar(b, y);
|
|
431
|
-
n(D), D === null && l(s.current), w();
|
|
432
|
-
})
|
|
433
|
-
}), u = c.floating;
|
|
434
|
-
return Ie(() => {
|
|
435
|
-
m.setReference(e ? dt(u == null ? void 0 : u.parentElement, e) : null);
|
|
436
|
-
}, [e, u, m]), {
|
|
437
|
-
shown: e !== void 0 && o !== null && c.reference !== null,
|
|
438
|
-
setFloating: m.setFloating,
|
|
439
|
-
style: {
|
|
440
|
-
...S,
|
|
441
|
-
// Not before it is placed (its side is chosen first): never a flash at
|
|
442
|
-
// the row's corner. With the card wholly out of view, it goes with the card.
|
|
443
|
-
...!p || (g = d.hide) != null && g.referenceHidden ? { visibility: "hidden" } : {}
|
|
444
|
-
},
|
|
445
|
-
/** The side the conversation took; the size handle sits on the corner away from the card. */
|
|
446
|
-
side: o ?? void 0,
|
|
447
|
-
handleSide: o === "left-start" ? "left" : "right",
|
|
448
|
-
/** The card's ··· menu, where Ask lives and focus returns on Escape. */
|
|
449
|
-
cardActions: () => {
|
|
450
|
-
var b;
|
|
451
|
-
return e ? (b = dt(u == null ? void 0 : u.parentElement, e)) == null ? void 0 : b.querySelector("[data-card-actions]") : null;
|
|
452
|
-
}
|
|
453
|
-
};
|
|
454
|
-
}
|
|
455
|
-
function dt(e, a) {
|
|
456
|
-
return e ? Array.from(e.querySelectorAll("[data-frame-id]")).find((t) => t.dataset.frameId === a) ?? null : null;
|
|
457
|
-
}
|
|
458
|
-
function Ar(e, a) {
|
|
459
|
-
const t = a.parentElement;
|
|
460
|
-
if (!t || !e.isConnected) return null;
|
|
461
|
-
const n = t.getBoundingClientRect();
|
|
462
|
-
if (n.width < Er) return null;
|
|
463
|
-
const r = e.getBoundingClientRect(), { min: l } = wt, s = (o, m) => o >= l.width + 2 * he && m >= l.height + 2 * he;
|
|
464
|
-
return s(n.right - r.right, n.height) ? "right-start" : s(r.left - n.left, n.height) ? "left-start" : s(n.width, n.bottom - r.bottom) ? "bottom-start" : null;
|
|
465
|
-
}
|
|
466
|
-
function Dr({
|
|
467
|
-
instance: e,
|
|
468
|
-
size: a,
|
|
469
|
-
side: t
|
|
470
|
-
}) {
|
|
471
|
-
const n = U(void 0), r = t === "left" ? -1 : 1, l = (s) => {
|
|
472
|
-
const o = n.current;
|
|
473
|
-
return {
|
|
474
|
-
width: o.start.width + r * (s.clientX - o.x),
|
|
475
|
-
height: o.start.height + (s.clientY - o.y)
|
|
476
|
-
};
|
|
477
|
-
};
|
|
478
|
-
return /* @__PURE__ */ i(
|
|
479
|
-
"div",
|
|
480
|
-
{
|
|
481
|
-
role: "separator",
|
|
482
|
-
"aria-label": "Resize assistant",
|
|
483
|
-
tabIndex: 0,
|
|
484
|
-
title: "Drag to resize. Double-click to reset.",
|
|
485
|
-
onPointerDown: (s) => {
|
|
486
|
-
var o, m;
|
|
487
|
-
s.preventDefault(), (m = (o = s.currentTarget).setPointerCapture) == null || m.call(o, s.pointerId), n.current = { x: s.clientX, y: s.clientY, start: a };
|
|
488
|
-
},
|
|
489
|
-
onPointerMove: (s) => {
|
|
490
|
-
n.current && e.setBesideSize(l(s));
|
|
491
|
-
},
|
|
492
|
-
onPointerUp: (s) => {
|
|
493
|
-
n.current && (e.setBesideSize(l(s), { save: !0 }), n.current = void 0);
|
|
494
|
-
},
|
|
495
|
-
onPointerCancel: () => {
|
|
496
|
-
n.current = void 0;
|
|
497
|
-
},
|
|
498
|
-
onKeyDown: (s) => {
|
|
499
|
-
const o = {
|
|
500
|
-
ArrowLeft: { width: -r * le, height: 0 },
|
|
501
|
-
ArrowRight: { width: r * le, height: 0 },
|
|
502
|
-
ArrowUp: { width: 0, height: -le },
|
|
503
|
-
ArrowDown: { width: 0, height: le }
|
|
504
|
-
}[s.key];
|
|
505
|
-
o && (s.preventDefault(), e.setBesideSize({ width: a.width + o.width, height: a.height + o.height }, { save: !0 }));
|
|
506
|
-
},
|
|
507
|
-
onDoubleClick: () => e.setBesideSize(wt.default, { save: !0 }),
|
|
508
|
-
className: W(
|
|
509
|
-
"absolute bottom-0 z-10 h-3 w-3 touch-none outline-none hover:bg-primary/30 focus-visible:bg-primary/40",
|
|
510
|
-
t === "left" ? "left-0 cursor-nesw-resize rounded-bl-card" : "right-0 cursor-nwse-resize rounded-br-card"
|
|
511
|
-
)
|
|
512
|
-
}
|
|
513
|
-
);
|
|
514
|
-
}
|
|
515
|
-
const le = 16, Ct = 0.6;
|
|
516
|
-
function Rr({ instance: e, side: a, width: t }) {
|
|
517
|
-
const n = U(void 0), r = (d) => {
|
|
518
|
-
var u, g;
|
|
519
|
-
const p = (g = (u = d.closest("aside")) == null ? void 0 : u.parentElement) == null ? void 0 : g.clientWidth;
|
|
520
|
-
return p ? p * Ct : ge.max;
|
|
521
|
-
}, l = (d) => {
|
|
522
|
-
var p;
|
|
523
|
-
return ((p = d.closest("aside")) == null ? void 0 : p.getBoundingClientRect().width) || t;
|
|
524
|
-
}, s = (d) => {
|
|
525
|
-
const p = n.current;
|
|
526
|
-
if (!p) return t;
|
|
527
|
-
const u = d - p.startX;
|
|
528
|
-
return tt(p.startWidth + (a === "left" ? -u : u), p.maxForArea);
|
|
529
|
-
}, o = (d) => {
|
|
530
|
-
var p, u;
|
|
531
|
-
d.preventDefault(), (u = (p = d.currentTarget).setPointerCapture) == null || u.call(p, d.pointerId), n.current = { startX: d.clientX, startWidth: l(d.currentTarget), maxForArea: r(d.currentTarget) };
|
|
532
|
-
}, m = (d) => {
|
|
533
|
-
n.current && e.setWidth(s(d.clientX));
|
|
534
|
-
}, c = (d) => {
|
|
535
|
-
n.current && (e.setWidth(s(d.clientX), { save: !0 }), n.current = void 0);
|
|
536
|
-
}, S = (d) => {
|
|
537
|
-
if (d.key !== "ArrowLeft" && d.key !== "ArrowRight") return;
|
|
538
|
-
d.preventDefault();
|
|
539
|
-
const p = d.key === "ArrowLeft" == (a === "left");
|
|
540
|
-
e.setWidth(tt(l(d.currentTarget) + (p ? le : -le), r(d.currentTarget)), { save: !0 });
|
|
541
|
-
};
|
|
542
|
-
return /* @__PURE__ */ i(
|
|
543
|
-
"div",
|
|
544
|
-
{
|
|
545
|
-
role: "separator",
|
|
546
|
-
"aria-orientation": "vertical",
|
|
547
|
-
"aria-label": "Resize assistant",
|
|
548
|
-
"aria-valuenow": t,
|
|
549
|
-
"aria-valuemin": ge.min,
|
|
550
|
-
"aria-valuemax": ge.max,
|
|
551
|
-
tabIndex: 0,
|
|
552
|
-
title: "Drag to resize. Double-click to reset.",
|
|
553
|
-
onPointerDown: o,
|
|
554
|
-
onPointerMove: m,
|
|
555
|
-
onPointerUp: c,
|
|
556
|
-
onPointerCancel: c,
|
|
557
|
-
onKeyDown: S,
|
|
558
|
-
onDoubleClick: () => e.setWidth(ge.default, { save: !0 }),
|
|
559
|
-
className: W(
|
|
560
|
-
"absolute inset-y-0 z-10 w-1.5 cursor-col-resize touch-none outline-none hover:bg-primary/30 focus-visible:bg-primary/40",
|
|
561
|
-
a === "left" ? "-left-[3px]" : "-right-[3px]"
|
|
562
|
-
)
|
|
563
|
-
}
|
|
564
|
-
);
|
|
565
|
-
}
|
|
566
|
-
function _r(e) {
|
|
567
|
-
const a = sa();
|
|
568
|
-
return j(
|
|
569
|
-
async (t, n) => {
|
|
570
|
-
const r = _.getState();
|
|
571
|
-
if (r.isVisualEditing)
|
|
572
|
-
return { ok: !1, reason: "not_editable", message: ye.not_editable };
|
|
573
|
-
if (!e()) return { ok: !1, reason: "not_editable", message: ye.no_save };
|
|
574
|
-
if (r.dashboard !== t.basedOn)
|
|
575
|
-
return { ok: !1, reason: "dashboard_changed", message: ye.dashboard_changed };
|
|
576
|
-
const l = tr(t.basedOn, t.operations, t.context);
|
|
577
|
-
if (!l.ok) return { ok: !1, reason: "refused", message: l.failedAt.message };
|
|
578
|
-
const s = { domainsById: {} };
|
|
579
|
-
for (const o of Pr(t.basedOn, l.dashboard)) {
|
|
580
|
-
const m = await a(o, { reuseLoaded: !0 }).catch((c) => {
|
|
581
|
-
console.warn("Applying the change without refreshed semantic metadata:", c);
|
|
582
|
-
});
|
|
583
|
-
la(s, m);
|
|
584
|
-
}
|
|
585
|
-
return n != null && n.stillWanted && !n.stillWanted() ? { ok: !1, reason: "dropped" } : e() ? _.getState().actions.applyProposal({ ...t, semanticExecutionPayload: s }) : { ok: !1, reason: "not_editable", message: ye.no_save };
|
|
586
|
-
},
|
|
587
|
-
[e, a]
|
|
588
|
-
);
|
|
589
|
-
}
|
|
590
|
-
function Pr(e, a) {
|
|
591
|
-
const t = new Set((e.sheets ?? []).flatMap((n) => n.frames ?? []));
|
|
592
|
-
return (a.sheets ?? []).flatMap((n) => (n.frames ?? []).filter((r) => !t.has(r)));
|
|
593
|
-
}
|
|
594
|
-
function Or(e) {
|
|
595
|
-
const { canEditDashboard: a, isInspectionMode: t } = ia(), n = oa(), r = _(at), l = e && n && a === !0 && !t, s = U(l);
|
|
596
|
-
Ie(() => {
|
|
597
|
-
s.current = l;
|
|
598
|
-
});
|
|
599
|
-
const o = j(
|
|
600
|
-
() => s.current && at(_.getState()),
|
|
601
|
-
[]
|
|
602
|
-
);
|
|
603
|
-
return { canChange: l && r, canChangeNow: o };
|
|
604
|
-
}
|
|
605
|
-
const Et = {
|
|
606
|
-
dashboard_changed: "Not applied: the dashboard on screen changed after this change was prepared.",
|
|
607
|
-
not_editable: "Not applied: the dashboard can't be changed on screen right now (the editor is open, or Save isn't shown).",
|
|
608
|
-
expired: "Not applied: it arrived after the time it had to land.",
|
|
609
|
-
refused: "Not applied: the change no longer fits the dashboard."
|
|
610
|
-
}, fe = {
|
|
611
|
-
changed: "Changed by your assistant",
|
|
612
|
-
undo: "Undo",
|
|
613
|
-
changedSince: "Changed since. Cancel discards every unsaved change.",
|
|
614
|
-
closeEditorToUndo: "Close the editor to undo."
|
|
615
|
-
};
|
|
616
|
-
function Fr({
|
|
617
|
-
port: e,
|
|
618
|
-
onLifecycleEvent: a
|
|
619
|
-
}) {
|
|
620
|
-
const { canChange: t, canChangeNow: n } = Or(!0), r = _((u) => {
|
|
621
|
-
var g;
|
|
622
|
-
return (g = u.dashboard) == null ? void 0 : g.id;
|
|
623
|
-
}), l = _r(n), [s, o] = z(null), m = U(/* @__PURE__ */ new Map()), c = U(/* @__PURE__ */ new Map()), S = U(Promise.resolve()), d = U({ apply: l, onLifecycleEvent: a });
|
|
624
|
-
Ie(() => {
|
|
625
|
-
d.current = { apply: l, onLifecycleEvent: a };
|
|
626
|
-
}), H(() => {
|
|
627
|
-
e.setScreenState({ eligible: t, ...r ? { dashboardId: r } : {} });
|
|
628
|
-
}, [e, t, r]), H(
|
|
629
|
-
() => _.subscribe((u, g) => {
|
|
630
|
-
if (u.editSessionEpoch !== g.editSessionEpoch) {
|
|
631
|
-
m.current.clear(), o(null);
|
|
632
|
-
return;
|
|
633
|
-
}
|
|
634
|
-
if (u.dashboard !== g.dashboard)
|
|
635
|
-
for (const [b, y] of m.current)
|
|
636
|
-
y !== u.dashboard && m.current.delete(b);
|
|
637
|
-
}),
|
|
638
|
-
[]
|
|
639
|
-
), H(() => {
|
|
640
|
-
const u = (b) => {
|
|
641
|
-
const y = _.getState().dashboard;
|
|
642
|
-
if (!y || y.id !== b.dashboardId) return;
|
|
643
|
-
const w = Mr();
|
|
644
|
-
m.current.set(w, y), e.answerCopyRequest({
|
|
645
|
-
kind: "uploaded",
|
|
646
|
-
screenId: e.screenId,
|
|
647
|
-
requestId: b.requestId,
|
|
648
|
-
revisionId: w,
|
|
649
|
-
dashboard: y
|
|
650
|
-
});
|
|
651
|
-
}, g = async (b, y) => {
|
|
652
|
-
var x, E, R;
|
|
653
|
-
const w = c.current.get(b.deliveryId);
|
|
654
|
-
if (w) {
|
|
655
|
-
e.reportOutcome({ screenId: e.screenId, deliveryId: b.deliveryId, outcome: w });
|
|
656
|
-
return;
|
|
657
|
-
}
|
|
658
|
-
const D = m.current.get(b.revisionId), O = () => !D || m.current.get(b.revisionId) !== D ? "dashboard_changed" : performance.now() < y + b.applyWithinMs ? null : "expired", M = O();
|
|
659
|
-
let F;
|
|
660
|
-
if (M || !D)
|
|
661
|
-
F = xe(M ?? "dashboard_changed");
|
|
662
|
-
else {
|
|
663
|
-
let C = "expired";
|
|
664
|
-
const G = await d.current.apply(
|
|
665
|
-
{ proposalId: b.proposalId, operations: b.operations, context: b.context, basedOn: D },
|
|
666
|
-
{
|
|
667
|
-
stillWanted: () => {
|
|
668
|
-
const V = O();
|
|
669
|
-
return V && (C = V), V === null;
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
);
|
|
673
|
-
F = zr(G, C);
|
|
674
|
-
}
|
|
675
|
-
if (c.current.set(b.deliveryId, F), e.reportOutcome({ screenId: e.screenId, deliveryId: b.deliveryId, outcome: F }), F.status !== "applied") return;
|
|
676
|
-
const N = ((x = _.getState().dashboard) == null ? void 0 : x.id) ?? "";
|
|
677
|
-
o({ deliveryId: b.deliveryId, proposalId: b.proposalId, summary: b.summary, dashboardId: N, words: null }), (R = (E = d.current).onLifecycleEvent) == null || R.call(E, {
|
|
678
|
-
type: "dashboard:change-applied",
|
|
679
|
-
dashboardId: N,
|
|
680
|
-
payload: { deliveryId: b.deliveryId, summary: b.summary }
|
|
681
|
-
});
|
|
682
|
-
};
|
|
683
|
-
return e.subscribe((b) => {
|
|
684
|
-
if (b.type === "copy_request") {
|
|
685
|
-
u(b);
|
|
686
|
-
return;
|
|
687
|
-
}
|
|
688
|
-
const y = performance.now();
|
|
689
|
-
S.current = S.current.then(
|
|
690
|
-
() => g(b, y).catch((w) => console.error("[live-screen] a delivery failed", w))
|
|
691
|
-
);
|
|
692
|
-
});
|
|
693
|
-
}, [e]);
|
|
694
|
-
const p = j(() => {
|
|
695
|
-
var g, b;
|
|
696
|
-
if (!s) return;
|
|
697
|
-
const u = _.getState().actions.undoProposal(s.proposalId);
|
|
698
|
-
u.ok ? ((b = (g = d.current).onLifecycleEvent) == null || b.call(g, {
|
|
699
|
-
type: "dashboard:change-undone",
|
|
700
|
-
dashboardId: s.dashboardId,
|
|
701
|
-
payload: { deliveryId: s.deliveryId, summary: s.summary }
|
|
702
|
-
}), o(null)) : u.reason === "changed_since" ? o({ ...s, words: "changed_since" }) : u.reason === "not_editable" ? o({ ...s, words: "not_editable" }) : o(null);
|
|
703
|
-
}, [s]);
|
|
704
|
-
return s ? /* @__PURE__ */ i(Lr, { note: s, onUndo: p }) : null;
|
|
705
|
-
}
|
|
706
|
-
function Lr({ note: e, onUndo: a }) {
|
|
707
|
-
const t = _((s) => da(s, e.proposalId)), n = _((s) => s.isVisualEditing);
|
|
708
|
-
if (t === "none" && e.words === null) return null;
|
|
709
|
-
const r = e.words === "changed_since" || t === "changed_since", l = r ? "changed_since" : e.words === "not_editable" ? "not_editable" : t;
|
|
710
|
-
return /* @__PURE__ */ h(
|
|
711
|
-
"div",
|
|
712
|
-
{
|
|
713
|
-
className: "flex min-h-8 items-center gap-2 border-b border-border bg-muted/40 px-3 py-1 text-xs text-muted-foreground",
|
|
714
|
-
"data-testid": "live-change-note",
|
|
715
|
-
"data-note-state": l,
|
|
716
|
-
role: "status",
|
|
717
|
-
children: [
|
|
718
|
-
/* @__PURE__ */ h("span", { className: "truncate", title: e.summary.join(" "), children: [
|
|
719
|
-
fe.changed,
|
|
720
|
-
r ? `. ${fe.changedSince}` : e.words === "not_editable" ? `. ${fe.closeEditorToUndo}` : ""
|
|
721
|
-
] }),
|
|
722
|
-
!r && t === "undoable" ? /* @__PURE__ */ h(te, { children: [
|
|
723
|
-
/* @__PURE__ */ i("span", { "aria-hidden": "true", children: "·" }),
|
|
724
|
-
/* @__PURE__ */ h(
|
|
725
|
-
q,
|
|
726
|
-
{
|
|
727
|
-
variant: "outline",
|
|
728
|
-
size: "xs",
|
|
729
|
-
className: "h-6 gap-1 px-2 text-[11.5px]",
|
|
730
|
-
disabled: n,
|
|
731
|
-
title: n ? fe.closeEditorToUndo : void 0,
|
|
732
|
-
onClick: a,
|
|
733
|
-
children: [
|
|
734
|
-
/* @__PURE__ */ i(ca, { className: "h-3 w-3" }),
|
|
735
|
-
fe.undo
|
|
736
|
-
]
|
|
737
|
-
}
|
|
738
|
-
)
|
|
739
|
-
] }) : null
|
|
740
|
-
]
|
|
741
|
-
}
|
|
742
|
-
);
|
|
743
|
-
}
|
|
744
|
-
function zr(e, a) {
|
|
745
|
-
if (e.ok) return { status: "applied" };
|
|
746
|
-
switch (e.reason) {
|
|
747
|
-
case "dashboard_changed":
|
|
748
|
-
case "not_editable":
|
|
749
|
-
return xe(e.reason);
|
|
750
|
-
case "refused":
|
|
751
|
-
return { status: "not_applied", reason: "refused", message: (e.message || Et.refused).slice(0, 500) };
|
|
752
|
-
case "dropped":
|
|
753
|
-
return xe(a);
|
|
754
|
-
case "previous_not_applied":
|
|
755
|
-
return xe("refused");
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
function xe(e) {
|
|
759
|
-
return { status: "not_applied", reason: e, message: Et[e] };
|
|
760
|
-
}
|
|
761
|
-
function Mr() {
|
|
762
|
-
return globalThis.crypto.randomUUID();
|
|
763
|
-
}
|
|
764
|
-
const Ur = Ee(() => import("./dashboard-controls-oNXJZN6x.js")), Wr = Ee(
|
|
765
|
-
() => import("./edit-dashboard-visual-BnnT_oKR.js")
|
|
766
|
-
), Br = Ee(() => import("./dashboard-json-CW7Q_efH.js"));
|
|
767
|
-
function Yn({
|
|
768
|
-
showControls: e = !1,
|
|
769
|
-
showFooter: a = !0,
|
|
770
|
-
liveScreen: t,
|
|
771
|
-
...n
|
|
772
|
-
}) {
|
|
773
|
-
const r = _((m) => m.isVisualEditing), l = _(
|
|
774
|
-
(m) => m.showDashboardJSON
|
|
775
|
-
), { appearance: s, preferences: o } = n;
|
|
776
|
-
return /* @__PURE__ */ i(ua, { FallbackComponent: fa, children: /* @__PURE__ */ i(ma, { dashboardProps: n, children: /* @__PURE__ */ h(ha, { children: [
|
|
777
|
-
/* @__PURE__ */ i(pa, { componentType: "surfboard", componentId: n.id }),
|
|
778
|
-
/* @__PURE__ */ h(ba, { appearance: s, children: [
|
|
779
|
-
/* @__PURE__ */ i(
|
|
780
|
-
va,
|
|
781
|
-
{
|
|
782
|
-
toastOptions: {
|
|
783
|
-
classNames: {
|
|
784
|
-
toast: "max-w-[calc(100vw-2rem)] overflow-x-hidden !items-start [--toast-close-button-end:0.5rem] [--toast-close-button-start:auto] [--toast-close-button-transform:translate(0,0)] sm:max-w-[44rem]",
|
|
785
|
-
content: "min-w-0 flex-1",
|
|
786
|
-
icon: "mt-0.5 shrink-0",
|
|
787
|
-
title: "max-w-full break-words pr-8",
|
|
788
|
-
description: "max-w-full break-words",
|
|
789
|
-
closeButton: "!top-2 h-6 w-6 rounded-md border-border bg-background text-muted-foreground hover:bg-muted hover:text-foreground"
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
}
|
|
793
|
-
),
|
|
794
|
-
/* @__PURE__ */ h(ga, { preferences: o, children: [
|
|
795
|
-
l && /* @__PURE__ */ i(Se, { fallback: null, children: /* @__PURE__ */ i(Br, {}) }),
|
|
796
|
-
/* @__PURE__ */ i(ya, { children: /* @__PURE__ */ i(fr, { children: /* @__PURE__ */ h("main", { className: "relative flex h-full w-full flex-col overflow-hidden", children: [
|
|
797
|
-
e && /* @__PURE__ */ i(Se, { fallback: null, children: /* @__PURE__ */ i(Ur, {}) }),
|
|
798
|
-
t && /* @__PURE__ */ i(Fr, { port: t, onLifecycleEvent: n.onDashboardLifecycleEvent }),
|
|
799
|
-
/* @__PURE__ */ h("div", { className: "relative flex grow overflow-hidden", children: [
|
|
800
|
-
/* @__PURE__ */ i("div", { className: "flex min-w-0 flex-1", children: /* @__PURE__ */ h(wa, { ...n, type: "dashboard", children: [
|
|
801
|
-
r && /* @__PURE__ */ i(Se, { fallback: null, children: /* @__PURE__ */ i(Wr, {}) }),
|
|
802
|
-
/* @__PURE__ */ i(Vt, { mode: r ? "hidden" : "visible", children: /* @__PURE__ */ i(ir, {}) })
|
|
803
|
-
] }) }),
|
|
804
|
-
/* @__PURE__ */ i(Nr, {})
|
|
805
|
-
] })
|
|
806
|
-
] }) }) })
|
|
807
|
-
] })
|
|
808
|
-
] })
|
|
809
|
-
] }) }) });
|
|
810
|
-
}
|
|
811
|
-
var ct = 1, jr = 0.9, $r = 0.8, Vr = 0.17, Ae = 0.1, De = 0.999, Kr = 0.9999, Hr = 0.99, qr = /[\\\/_+.#"@\[\(\{&]/, Gr = /[\\\/_+.#"@\[\(\{&]/g, Xr = /[\s-]/, Nt = /[\s-]/g;
|
|
812
|
-
function We(e, a, t, n, r, l, s) {
|
|
813
|
-
if (l === a.length) return r === e.length ? ct : Hr;
|
|
814
|
-
var o = `${r},${l}`;
|
|
815
|
-
if (s[o] !== void 0) return s[o];
|
|
816
|
-
for (var m = n.charAt(l), c = t.indexOf(m, r), S = 0, d, p, u, g; c >= 0; ) d = We(e, a, t, n, c + 1, l + 1, s), d > S && (c === r ? d *= ct : qr.test(e.charAt(c - 1)) ? (d *= $r, u = e.slice(r, c - 1).match(Gr), u && r > 0 && (d *= Math.pow(De, u.length))) : Xr.test(e.charAt(c - 1)) ? (d *= jr, g = e.slice(r, c - 1).match(Nt), g && r > 0 && (d *= Math.pow(De, g.length))) : (d *= Vr, r > 0 && (d *= Math.pow(De, c - r))), e.charAt(c) !== a.charAt(l) && (d *= Kr)), (d < Ae && t.charAt(c - 1) === n.charAt(l + 1) || n.charAt(l + 1) === n.charAt(l) && t.charAt(c - 1) !== n.charAt(l)) && (p = We(e, a, t, n, c + 1, l + 2, s), p * Ae > d && (d = p * Ae)), d > S && (S = d), c = t.indexOf(m, c + 1);
|
|
817
|
-
return s[o] = S, S;
|
|
818
|
-
}
|
|
819
|
-
function ut(e) {
|
|
820
|
-
return e.toLowerCase().replace(Nt, " ");
|
|
821
|
-
}
|
|
822
|
-
function Jr(e, a, t) {
|
|
823
|
-
return e = t && t.length > 0 ? `${e + " " + t.join(" ")}` : e, We(e, a, ut(e), ut(a), 0, 0, {});
|
|
824
|
-
}
|
|
825
|
-
var me = '[cmdk-group=""]', Re = '[cmdk-group-items=""]', Yr = '[cmdk-group-heading=""]', Tt = '[cmdk-item=""]', ft = `${Tt}:not([aria-disabled="true"])`, Be = "cmdk-item-select", ne = "data-value", Zr = (e, a, t) => Jr(e, a, t), kt = v.createContext(void 0), be = () => v.useContext(kt), At = v.createContext(void 0), Je = () => v.useContext(At), Dt = v.createContext(void 0), Rt = v.forwardRef((e, a) => {
|
|
826
|
-
let t = se(() => {
|
|
827
|
-
var f, T;
|
|
828
|
-
return { search: "", value: (T = (f = e.value) != null ? f : e.defaultValue) != null ? T : "", selectedItemId: void 0, filtered: { count: 0, items: /* @__PURE__ */ new Map(), groups: /* @__PURE__ */ new Set() } };
|
|
829
|
-
}), n = se(() => /* @__PURE__ */ new Set()), r = se(() => /* @__PURE__ */ new Map()), l = se(() => /* @__PURE__ */ new Map()), s = se(() => /* @__PURE__ */ new Set()), o = _t(e), { label: m, children: c, value: S, onValueChange: d, filter: p, shouldFilter: u, loop: g, disablePointerSelection: b = !1, vimBindings: y = !0, ...w } = e, D = ie(), O = ie(), M = ie(), F = v.useRef(null), N = cn();
|
|
830
|
-
ae(() => {
|
|
831
|
-
if (S !== void 0) {
|
|
832
|
-
let f = S.trim();
|
|
833
|
-
t.current.value = f, x.emit();
|
|
834
|
-
}
|
|
835
|
-
}, [S]), ae(() => {
|
|
836
|
-
N(6, re);
|
|
837
|
-
}, []);
|
|
838
|
-
let x = v.useMemo(() => ({ subscribe: (f) => (s.current.add(f), () => s.current.delete(f)), snapshot: () => t.current, setState: (f, T, A) => {
|
|
839
|
-
var I, P, L, K;
|
|
840
|
-
if (!Object.is(t.current[f], T)) {
|
|
841
|
-
if (t.current[f] = T, f === "search") V(), C(), N(1, G);
|
|
842
|
-
else if (f === "value") {
|
|
843
|
-
if (document.activeElement.hasAttribute("cmdk-input") || document.activeElement.hasAttribute("cmdk-root")) {
|
|
844
|
-
let B = document.getElementById(M);
|
|
845
|
-
B ? B.focus() : (I = document.getElementById(D)) == null || I.focus();
|
|
846
|
-
}
|
|
847
|
-
if (N(7, () => {
|
|
848
|
-
var B;
|
|
849
|
-
t.current.selectedItemId = (B = Y()) == null ? void 0 : B.id, x.emit();
|
|
850
|
-
}), A || N(5, re), ((P = o.current) == null ? void 0 : P.value) !== void 0) {
|
|
851
|
-
let B = T ?? "";
|
|
852
|
-
(K = (L = o.current).onValueChange) == null || K.call(L, B);
|
|
853
|
-
return;
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
x.emit();
|
|
857
|
-
}
|
|
858
|
-
}, emit: () => {
|
|
859
|
-
s.current.forEach((f) => f());
|
|
860
|
-
} }), []), E = v.useMemo(() => ({ value: (f, T, A) => {
|
|
861
|
-
var I;
|
|
862
|
-
T !== ((I = l.current.get(f)) == null ? void 0 : I.value) && (l.current.set(f, { value: T, keywords: A }), t.current.filtered.items.set(f, R(T, A)), N(2, () => {
|
|
863
|
-
C(), x.emit();
|
|
864
|
-
}));
|
|
865
|
-
}, item: (f, T) => (n.current.add(f), T && (r.current.has(T) ? r.current.get(T).add(f) : r.current.set(T, /* @__PURE__ */ new Set([f]))), N(3, () => {
|
|
866
|
-
V(), C(), t.current.value || G(), x.emit();
|
|
867
|
-
}), () => {
|
|
868
|
-
l.current.delete(f), n.current.delete(f), t.current.filtered.items.delete(f);
|
|
869
|
-
let A = Y();
|
|
870
|
-
N(4, () => {
|
|
871
|
-
V(), (A == null ? void 0 : A.getAttribute("id")) === f && G(), x.emit();
|
|
872
|
-
});
|
|
873
|
-
}), group: (f) => (r.current.has(f) || r.current.set(f, /* @__PURE__ */ new Set()), () => {
|
|
874
|
-
l.current.delete(f), r.current.delete(f);
|
|
875
|
-
}), filter: () => o.current.shouldFilter, label: m || e["aria-label"], getDisablePointerSelection: () => o.current.disablePointerSelection, listId: D, inputId: M, labelId: O, listInnerRef: F }), []);
|
|
876
|
-
function R(f, T) {
|
|
877
|
-
var A, I;
|
|
878
|
-
let P = (I = (A = o.current) == null ? void 0 : A.filter) != null ? I : Zr;
|
|
879
|
-
return f ? P(f, t.current.search, T) : 0;
|
|
880
|
-
}
|
|
881
|
-
function C() {
|
|
882
|
-
if (!t.current.search || o.current.shouldFilter === !1) return;
|
|
883
|
-
let f = t.current.filtered.items, T = [];
|
|
884
|
-
t.current.filtered.groups.forEach((I) => {
|
|
885
|
-
let P = r.current.get(I), L = 0;
|
|
886
|
-
P.forEach((K) => {
|
|
887
|
-
let B = f.get(K);
|
|
888
|
-
L = Math.max(B, L);
|
|
889
|
-
}), T.push([I, L]);
|
|
890
|
-
});
|
|
891
|
-
let A = F.current;
|
|
892
|
-
k().sort((I, P) => {
|
|
893
|
-
var L, K;
|
|
894
|
-
let B = I.getAttribute("id"), ve = P.getAttribute("id");
|
|
895
|
-
return ((L = f.get(ve)) != null ? L : 0) - ((K = f.get(B)) != null ? K : 0);
|
|
896
|
-
}).forEach((I) => {
|
|
897
|
-
let P = I.closest(Re);
|
|
898
|
-
P ? P.appendChild(I.parentElement === P ? I : I.closest(`${Re} > *`)) : A.appendChild(I.parentElement === A ? I : I.closest(`${Re} > *`));
|
|
899
|
-
}), T.sort((I, P) => P[1] - I[1]).forEach((I) => {
|
|
900
|
-
var P;
|
|
901
|
-
let L = (P = F.current) == null ? void 0 : P.querySelector(`${me}[${ne}="${encodeURIComponent(I[0])}"]`);
|
|
902
|
-
L == null || L.parentElement.appendChild(L);
|
|
903
|
-
});
|
|
904
|
-
}
|
|
905
|
-
function G() {
|
|
906
|
-
let f = k().find((A) => A.getAttribute("aria-disabled") !== "true"), T = f == null ? void 0 : f.getAttribute(ne);
|
|
907
|
-
x.setState("value", T || void 0);
|
|
908
|
-
}
|
|
909
|
-
function V() {
|
|
910
|
-
var f, T, A, I;
|
|
911
|
-
if (!t.current.search || o.current.shouldFilter === !1) {
|
|
912
|
-
t.current.filtered.count = n.current.size;
|
|
913
|
-
return;
|
|
914
|
-
}
|
|
915
|
-
t.current.filtered.groups = /* @__PURE__ */ new Set();
|
|
916
|
-
let P = 0;
|
|
917
|
-
for (let L of n.current) {
|
|
918
|
-
let K = (T = (f = l.current.get(L)) == null ? void 0 : f.value) != null ? T : "", B = (I = (A = l.current.get(L)) == null ? void 0 : A.keywords) != null ? I : [], ve = R(K, B);
|
|
919
|
-
t.current.filtered.items.set(L, ve), ve > 0 && P++;
|
|
920
|
-
}
|
|
921
|
-
for (let [L, K] of r.current) for (let B of K) if (t.current.filtered.items.get(B) > 0) {
|
|
922
|
-
t.current.filtered.groups.add(L);
|
|
923
|
-
break;
|
|
924
|
-
}
|
|
925
|
-
t.current.filtered.count = P;
|
|
926
|
-
}
|
|
927
|
-
function re() {
|
|
928
|
-
var f, T, A;
|
|
929
|
-
let I = Y();
|
|
930
|
-
I && (((f = I.parentElement) == null ? void 0 : f.firstChild) === I && ((A = (T = I.closest(me)) == null ? void 0 : T.querySelector(Yr)) == null || A.scrollIntoView({ block: "nearest" })), I.scrollIntoView({ block: "nearest" }));
|
|
931
|
-
}
|
|
932
|
-
function Y() {
|
|
933
|
-
var f;
|
|
934
|
-
return (f = F.current) == null ? void 0 : f.querySelector(`${Tt}[aria-selected="true"]`);
|
|
935
|
-
}
|
|
936
|
-
function k() {
|
|
937
|
-
var f;
|
|
938
|
-
return Array.from(((f = F.current) == null ? void 0 : f.querySelectorAll(ft)) || []);
|
|
939
|
-
}
|
|
940
|
-
function de(f) {
|
|
941
|
-
let T = k()[f];
|
|
942
|
-
T && x.setState("value", T.getAttribute(ne));
|
|
943
|
-
}
|
|
944
|
-
function Te(f) {
|
|
945
|
-
var T;
|
|
946
|
-
let A = Y(), I = k(), P = I.findIndex((K) => K === A), L = I[P + f];
|
|
947
|
-
(T = o.current) != null && T.loop && (L = P + f < 0 ? I[I.length - 1] : P + f === I.length ? I[0] : I[P + f]), L && x.setState("value", L.getAttribute(ne));
|
|
948
|
-
}
|
|
949
|
-
function Ye(f) {
|
|
950
|
-
let T = Y(), A = T == null ? void 0 : T.closest(me), I;
|
|
951
|
-
for (; A && !I; ) A = f > 0 ? on(A, me) : dn(A, me), I = A == null ? void 0 : A.querySelector(ft);
|
|
952
|
-
I ? x.setState("value", I.getAttribute(ne)) : Te(f);
|
|
953
|
-
}
|
|
954
|
-
let Ze = () => de(k().length - 1), Qe = (f) => {
|
|
955
|
-
f.preventDefault(), f.metaKey ? Ze() : f.altKey ? Ye(1) : Te(1);
|
|
956
|
-
}, et = (f) => {
|
|
957
|
-
f.preventDefault(), f.metaKey ? de(0) : f.altKey ? Ye(-1) : Te(-1);
|
|
958
|
-
};
|
|
959
|
-
return v.createElement(ee.div, { ref: a, tabIndex: -1, ...w, "cmdk-root": "", onKeyDown: (f) => {
|
|
960
|
-
var T;
|
|
961
|
-
(T = w.onKeyDown) == null || T.call(w, f);
|
|
962
|
-
let A = f.nativeEvent.isComposing || f.keyCode === 229;
|
|
963
|
-
if (!(f.defaultPrevented || A)) switch (f.key) {
|
|
964
|
-
case "n":
|
|
965
|
-
case "j": {
|
|
966
|
-
y && f.ctrlKey && Qe(f);
|
|
967
|
-
break;
|
|
968
|
-
}
|
|
969
|
-
case "ArrowDown": {
|
|
970
|
-
Qe(f);
|
|
971
|
-
break;
|
|
972
|
-
}
|
|
973
|
-
case "p":
|
|
974
|
-
case "k": {
|
|
975
|
-
y && f.ctrlKey && et(f);
|
|
976
|
-
break;
|
|
977
|
-
}
|
|
978
|
-
case "ArrowUp": {
|
|
979
|
-
et(f);
|
|
980
|
-
break;
|
|
981
|
-
}
|
|
982
|
-
case "Home": {
|
|
983
|
-
f.preventDefault(), de(0);
|
|
984
|
-
break;
|
|
985
|
-
}
|
|
986
|
-
case "End": {
|
|
987
|
-
f.preventDefault(), Ze();
|
|
988
|
-
break;
|
|
989
|
-
}
|
|
990
|
-
case "Enter": {
|
|
991
|
-
f.preventDefault();
|
|
992
|
-
let I = Y();
|
|
993
|
-
if (I) {
|
|
994
|
-
let P = new Event(Be);
|
|
995
|
-
I.dispatchEvent(P);
|
|
996
|
-
}
|
|
997
|
-
}
|
|
998
|
-
}
|
|
999
|
-
} }, v.createElement("label", { "cmdk-label": "", htmlFor: E.inputId, id: E.labelId, style: fn }, m), Ne(e, (f) => v.createElement(At.Provider, { value: x }, v.createElement(kt.Provider, { value: E }, f))));
|
|
1000
|
-
}), Qr = v.forwardRef((e, a) => {
|
|
1001
|
-
var t, n;
|
|
1002
|
-
let r = ie(), l = v.useRef(null), s = v.useContext(Dt), o = be(), m = _t(e), c = (n = (t = m.current) == null ? void 0 : t.forceMount) != null ? n : s == null ? void 0 : s.forceMount;
|
|
1003
|
-
ae(() => {
|
|
1004
|
-
if (!c) return o.item(r, s == null ? void 0 : s.id);
|
|
1005
|
-
}, [c]);
|
|
1006
|
-
let S = Pt(r, l, [e.value, e.children, l], e.keywords), d = Je(), p = Q((N) => N.value && N.value === S.current), u = Q((N) => c || o.filter() === !1 ? !0 : N.search ? N.filtered.items.get(r) > 0 : !0);
|
|
1007
|
-
v.useEffect(() => {
|
|
1008
|
-
let N = l.current;
|
|
1009
|
-
if (!(!N || e.disabled)) return N.addEventListener(Be, g), () => N.removeEventListener(Be, g);
|
|
1010
|
-
}, [u, e.onSelect, e.disabled]);
|
|
1011
|
-
function g() {
|
|
1012
|
-
var N, x;
|
|
1013
|
-
b(), (x = (N = m.current).onSelect) == null || x.call(N, S.current);
|
|
1014
|
-
}
|
|
1015
|
-
function b() {
|
|
1016
|
-
d.setState("value", S.current, !0);
|
|
1017
|
-
}
|
|
1018
|
-
if (!u) return null;
|
|
1019
|
-
let { disabled: y, value: w, onSelect: D, forceMount: O, keywords: M, ...F } = e;
|
|
1020
|
-
return v.createElement(ee.div, { ref: pe(l, a), ...F, id: r, "cmdk-item": "", role: "option", "aria-disabled": !!y, "aria-selected": !!p, "data-disabled": !!y, "data-selected": !!p, onPointerMove: y || o.getDisablePointerSelection() ? void 0 : b, onClick: y ? void 0 : g }, e.children);
|
|
1021
|
-
}), en = v.forwardRef((e, a) => {
|
|
1022
|
-
let { heading: t, children: n, forceMount: r, ...l } = e, s = ie(), o = v.useRef(null), m = v.useRef(null), c = ie(), S = be(), d = Q((u) => r || S.filter() === !1 ? !0 : u.search ? u.filtered.groups.has(s) : !0);
|
|
1023
|
-
ae(() => S.group(s), []), Pt(s, o, [e.value, e.heading, m]);
|
|
1024
|
-
let p = v.useMemo(() => ({ id: s, forceMount: r }), [r]);
|
|
1025
|
-
return v.createElement(ee.div, { ref: pe(o, a), ...l, "cmdk-group": "", role: "presentation", hidden: d ? void 0 : !0 }, t && v.createElement("div", { ref: m, "cmdk-group-heading": "", "aria-hidden": !0, id: c }, t), Ne(e, (u) => v.createElement("div", { "cmdk-group-items": "", role: "group", "aria-labelledby": t ? c : void 0 }, v.createElement(Dt.Provider, { value: p }, u))));
|
|
1026
|
-
}), tn = v.forwardRef((e, a) => {
|
|
1027
|
-
let { alwaysRender: t, ...n } = e, r = v.useRef(null), l = Q((s) => !s.search);
|
|
1028
|
-
return !t && !l ? null : v.createElement(ee.div, { ref: pe(r, a), ...n, "cmdk-separator": "", role: "separator" });
|
|
1029
|
-
}), an = v.forwardRef((e, a) => {
|
|
1030
|
-
let { onValueChange: t, ...n } = e, r = e.value != null, l = Je(), s = Q((c) => c.search), o = Q((c) => c.selectedItemId), m = be();
|
|
1031
|
-
return v.useEffect(() => {
|
|
1032
|
-
e.value != null && l.setState("search", e.value);
|
|
1033
|
-
}, [e.value]), v.createElement(ee.input, { ref: a, ...n, "cmdk-input": "", autoComplete: "off", autoCorrect: "off", spellCheck: !1, "aria-autocomplete": "list", role: "combobox", "aria-expanded": !0, "aria-controls": m.listId, "aria-labelledby": m.labelId, "aria-activedescendant": o, id: m.inputId, type: "text", value: r ? e.value : s, onChange: (c) => {
|
|
1034
|
-
r || l.setState("search", c.target.value), t == null || t(c.target.value);
|
|
1035
|
-
} });
|
|
1036
|
-
}), rn = v.forwardRef((e, a) => {
|
|
1037
|
-
let { children: t, label: n = "Suggestions", ...r } = e, l = v.useRef(null), s = v.useRef(null), o = Q((c) => c.selectedItemId), m = be();
|
|
1038
|
-
return v.useEffect(() => {
|
|
1039
|
-
if (s.current && l.current) {
|
|
1040
|
-
let c = s.current, S = l.current, d, p = new ResizeObserver(() => {
|
|
1041
|
-
d = requestAnimationFrame(() => {
|
|
1042
|
-
let u = c.offsetHeight;
|
|
1043
|
-
S.style.setProperty("--cmdk-list-height", u.toFixed(1) + "px");
|
|
1044
|
-
});
|
|
1045
|
-
});
|
|
1046
|
-
return p.observe(c), () => {
|
|
1047
|
-
cancelAnimationFrame(d), p.unobserve(c);
|
|
1048
|
-
};
|
|
1049
|
-
}
|
|
1050
|
-
}, []), v.createElement(ee.div, { ref: pe(l, a), ...r, "cmdk-list": "", role: "listbox", tabIndex: -1, "aria-activedescendant": o, "aria-label": n, id: m.listId }, Ne(e, (c) => v.createElement("div", { ref: pe(s, m.listInnerRef), "cmdk-list-sizer": "" }, c)));
|
|
1051
|
-
}), nn = v.forwardRef((e, a) => {
|
|
1052
|
-
let { open: t, onOpenChange: n, overlayClassName: r, contentClassName: l, container: s, ...o } = e;
|
|
1053
|
-
return v.createElement(Sa, { open: t, onOpenChange: n }, v.createElement(xa, { container: s }, v.createElement(Ia, { "cmdk-overlay": "", className: r }), v.createElement(Ca, { "aria-label": e.label, "cmdk-dialog": "", className: l }, v.createElement(Rt, { ref: a, ...o }))));
|
|
1054
|
-
}), sn = v.forwardRef((e, a) => Q((t) => t.filtered.count === 0) ? v.createElement(ee.div, { ref: a, ...e, "cmdk-empty": "", role: "presentation" }) : null), ln = v.forwardRef((e, a) => {
|
|
1055
|
-
let { progress: t, children: n, label: r = "Loading...", ...l } = e;
|
|
1056
|
-
return v.createElement(ee.div, { ref: a, ...l, "cmdk-loading": "", role: "progressbar", "aria-valuenow": t, "aria-valuemin": 0, "aria-valuemax": 100, "aria-label": r }, Ne(e, (s) => v.createElement("div", { "aria-hidden": !0 }, s)));
|
|
1057
|
-
}), $ = Object.assign(Rt, { List: rn, Item: Qr, Input: an, Group: en, Separator: tn, Dialog: nn, Empty: sn, Loading: ln });
|
|
1058
|
-
function on(e, a) {
|
|
1059
|
-
let t = e.nextElementSibling;
|
|
1060
|
-
for (; t; ) {
|
|
1061
|
-
if (t.matches(a)) return t;
|
|
1062
|
-
t = t.nextElementSibling;
|
|
1063
|
-
}
|
|
1064
|
-
}
|
|
1065
|
-
function dn(e, a) {
|
|
1066
|
-
let t = e.previousElementSibling;
|
|
1067
|
-
for (; t; ) {
|
|
1068
|
-
if (t.matches(a)) return t;
|
|
1069
|
-
t = t.previousElementSibling;
|
|
1070
|
-
}
|
|
1071
|
-
}
|
|
1072
|
-
function _t(e) {
|
|
1073
|
-
let a = v.useRef(e);
|
|
1074
|
-
return ae(() => {
|
|
1075
|
-
a.current = e;
|
|
1076
|
-
}), a;
|
|
1077
|
-
}
|
|
1078
|
-
var ae = typeof window > "u" ? v.useEffect : v.useLayoutEffect;
|
|
1079
|
-
function se(e) {
|
|
1080
|
-
let a = v.useRef();
|
|
1081
|
-
return a.current === void 0 && (a.current = e()), a;
|
|
1082
|
-
}
|
|
1083
|
-
function Q(e) {
|
|
1084
|
-
let a = Je(), t = () => e(a.snapshot());
|
|
1085
|
-
return v.useSyncExternalStore(a.subscribe, t, t);
|
|
1086
|
-
}
|
|
1087
|
-
function Pt(e, a, t, n = []) {
|
|
1088
|
-
let r = v.useRef(), l = be();
|
|
1089
|
-
return ae(() => {
|
|
1090
|
-
var s;
|
|
1091
|
-
let o = (() => {
|
|
1092
|
-
var c;
|
|
1093
|
-
for (let S of t) {
|
|
1094
|
-
if (typeof S == "string") return S.trim();
|
|
1095
|
-
if (typeof S == "object" && "current" in S) return S.current ? (c = S.current.textContent) == null ? void 0 : c.trim() : r.current;
|
|
1096
|
-
}
|
|
1097
|
-
})(), m = n.map((c) => c.trim());
|
|
1098
|
-
l.value(e, o, m), (s = a.current) == null || s.setAttribute(ne, o), r.current = o;
|
|
1099
|
-
}), r;
|
|
1100
|
-
}
|
|
1101
|
-
var cn = () => {
|
|
1102
|
-
let [e, a] = v.useState(), t = se(() => /* @__PURE__ */ new Map());
|
|
1103
|
-
return ae(() => {
|
|
1104
|
-
t.current.forEach((n) => n()), t.current = /* @__PURE__ */ new Map();
|
|
1105
|
-
}, [e]), (n, r) => {
|
|
1106
|
-
t.current.set(n, r), a({});
|
|
1107
|
-
};
|
|
1108
|
-
};
|
|
1109
|
-
function un(e) {
|
|
1110
|
-
let a = e.type;
|
|
1111
|
-
return typeof a == "function" ? a(e.props) : "render" in a ? a.render(e.props) : e;
|
|
1112
|
-
}
|
|
1113
|
-
function Ne({ asChild: e, children: a }, t) {
|
|
1114
|
-
return e && v.isValidElement(a) ? v.cloneElement(un(a), { ref: a.ref }, t(a.props.children)) : t(a);
|
|
1115
|
-
}
|
|
1116
|
-
var fn = { position: "absolute", width: "1px", height: "1px", padding: "0", margin: "-1px", overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0" };
|
|
1117
|
-
const Ot = v.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ i(
|
|
1118
|
-
$,
|
|
1119
|
-
{
|
|
1120
|
-
ref: t,
|
|
1121
|
-
className: W(
|
|
1122
|
-
"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
|
|
1123
|
-
e
|
|
1124
|
-
),
|
|
1125
|
-
...a
|
|
1126
|
-
}
|
|
1127
|
-
));
|
|
1128
|
-
Ot.displayName = $.displayName;
|
|
1129
|
-
const Ft = v.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ h("div", { className: "flex items-center border-b px-3", "cmdk-input-wrapper": "", children: [
|
|
1130
|
-
/* @__PURE__ */ i(ar, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
|
|
1131
|
-
/* @__PURE__ */ i(
|
|
1132
|
-
$.Input,
|
|
1133
|
-
{
|
|
1134
|
-
ref: t,
|
|
1135
|
-
className: W(
|
|
1136
|
-
"flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-[hsl(var(--semaphor-placeholder-foreground))] disabled:cursor-not-allowed disabled:opacity-50",
|
|
1137
|
-
e
|
|
1138
|
-
),
|
|
1139
|
-
...a
|
|
1140
|
-
}
|
|
1141
|
-
)
|
|
1142
|
-
] }));
|
|
1143
|
-
Ft.displayName = $.Input.displayName;
|
|
1144
|
-
const Lt = v.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ i(
|
|
1145
|
-
$.List,
|
|
1146
|
-
{
|
|
1147
|
-
ref: t,
|
|
1148
|
-
className: W("max-h-[300px] overflow-y-auto overflow-x-hidden", e),
|
|
1149
|
-
...a
|
|
1150
|
-
}
|
|
1151
|
-
));
|
|
1152
|
-
Lt.displayName = $.List.displayName;
|
|
1153
|
-
const zt = v.forwardRef((e, a) => /* @__PURE__ */ i(
|
|
1154
|
-
$.Empty,
|
|
1155
|
-
{
|
|
1156
|
-
ref: a,
|
|
1157
|
-
className: "py-6 text-center text-sm",
|
|
1158
|
-
...e
|
|
1159
|
-
}
|
|
1160
|
-
));
|
|
1161
|
-
zt.displayName = $.Empty.displayName;
|
|
1162
|
-
const je = v.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ i(
|
|
1163
|
-
$.Group,
|
|
1164
|
-
{
|
|
1165
|
-
ref: t,
|
|
1166
|
-
className: W(
|
|
1167
|
-
"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
|
|
1168
|
-
e
|
|
1169
|
-
),
|
|
1170
|
-
...a
|
|
1171
|
-
}
|
|
1172
|
-
));
|
|
1173
|
-
je.displayName = $.Group.displayName;
|
|
1174
|
-
const Mt = v.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ i(
|
|
1175
|
-
$.Separator,
|
|
1176
|
-
{
|
|
1177
|
-
ref: t,
|
|
1178
|
-
className: W("-mx-1 h-px bg-border", e),
|
|
1179
|
-
...a
|
|
1180
|
-
}
|
|
1181
|
-
));
|
|
1182
|
-
Mt.displayName = $.Separator.displayName;
|
|
1183
|
-
const $e = v.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ i(
|
|
1184
|
-
$.Item,
|
|
1185
|
-
{
|
|
1186
|
-
ref: t,
|
|
1187
|
-
className: W(
|
|
1188
|
-
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50",
|
|
1189
|
-
e
|
|
1190
|
-
),
|
|
1191
|
-
...a
|
|
1192
|
-
}
|
|
1193
|
-
));
|
|
1194
|
-
$e.displayName = $.Item.displayName;
|
|
1195
|
-
function mn(e = {}) {
|
|
1196
|
-
const { authToken: a, tokenProps: t } = qe(), n = _(
|
|
1197
|
-
(N) => N.actions.applyResolvedCalendarPreferences
|
|
1198
|
-
), r = e.enabled ?? !0, l = (a == null ? void 0 : a.accessToken) ?? null, s = (t == null ? void 0 : t.apiServiceUrl) ?? null, [o, m] = z(!1), [c, S] = z(!1), [d, p] = z(!1), [u, g] = z(null), [b, y] = z(null), w = U(l);
|
|
1199
|
-
w.current = l, H(() => {
|
|
1200
|
-
y(null), g(null), m(!1), S(!1), p(!1);
|
|
1201
|
-
}, [l]);
|
|
1202
|
-
const D = j(async (N) => {
|
|
1203
|
-
const x = rr(await N.json());
|
|
1204
|
-
if (!x.ok)
|
|
1205
|
-
throw new Error("Calendar preferences response is invalid");
|
|
1206
|
-
return x.value;
|
|
1207
|
-
}, []), O = j(async () => {
|
|
1208
|
-
if (!r || !l || !s) return;
|
|
1209
|
-
const N = l;
|
|
1210
|
-
m(!0), g(null);
|
|
1211
|
-
try {
|
|
1212
|
-
const x = await fetch(
|
|
1213
|
-
`${s}/v1/user-preferences/calendar`,
|
|
1214
|
-
{
|
|
1215
|
-
method: "GET",
|
|
1216
|
-
headers: { Authorization: `Bearer ${l}` }
|
|
1217
|
-
}
|
|
1218
|
-
);
|
|
1219
|
-
if (!x.ok) {
|
|
1220
|
-
const R = await x.json().catch(() => ({}));
|
|
1221
|
-
throw new Error(R.error || "Failed to fetch preferences");
|
|
1222
|
-
}
|
|
1223
|
-
const E = await D(x);
|
|
1224
|
-
w.current === N && y(E);
|
|
1225
|
-
} catch (x) {
|
|
1226
|
-
w.current === N && g(x instanceof Error ? x.message : "Unknown error");
|
|
1227
|
-
} finally {
|
|
1228
|
-
w.current === N && m(!1);
|
|
1229
|
-
}
|
|
1230
|
-
}, [l, s, r, D]);
|
|
1231
|
-
H(() => {
|
|
1232
|
-
r && O();
|
|
1233
|
-
}, [r, O]);
|
|
1234
|
-
const M = j(
|
|
1235
|
-
async (N) => {
|
|
1236
|
-
if (!l || !s)
|
|
1237
|
-
return g("Not authenticated"), !1;
|
|
1238
|
-
const x = l;
|
|
1239
|
-
S(!0), g(null);
|
|
1240
|
-
try {
|
|
1241
|
-
const E = await fetch(
|
|
1242
|
-
`${s}/v1/user-preferences/calendar`,
|
|
1243
|
-
{
|
|
1244
|
-
method: "PATCH",
|
|
1245
|
-
headers: {
|
|
1246
|
-
"Content-Type": "application/json",
|
|
1247
|
-
Authorization: `Bearer ${l}`
|
|
1248
|
-
},
|
|
1249
|
-
body: JSON.stringify(N)
|
|
1250
|
-
}
|
|
1251
|
-
);
|
|
1252
|
-
if (!E.ok) {
|
|
1253
|
-
const C = await E.json().catch(() => ({}));
|
|
1254
|
-
throw new Error(C.error || "Failed to update preferences");
|
|
1255
|
-
}
|
|
1256
|
-
const R = await D(E);
|
|
1257
|
-
return w.current !== x ? !1 : (y(R), n(R.resolved, R.sources), !0);
|
|
1258
|
-
} catch (E) {
|
|
1259
|
-
return w.current === x && g(E instanceof Error ? E.message : "Unknown error"), !1;
|
|
1260
|
-
} finally {
|
|
1261
|
-
w.current === x && S(!1);
|
|
1262
|
-
}
|
|
1263
|
-
},
|
|
1264
|
-
[
|
|
1265
|
-
l,
|
|
1266
|
-
s,
|
|
1267
|
-
n,
|
|
1268
|
-
D
|
|
1269
|
-
]
|
|
1270
|
-
), F = j(async () => {
|
|
1271
|
-
if (!l || !s)
|
|
1272
|
-
return g("Not authenticated"), !1;
|
|
1273
|
-
const N = l;
|
|
1274
|
-
p(!0), g(null);
|
|
1275
|
-
try {
|
|
1276
|
-
const x = await fetch(
|
|
1277
|
-
`${s}/v1/user-preferences/calendar`,
|
|
1278
|
-
{
|
|
1279
|
-
method: "DELETE",
|
|
1280
|
-
headers: { Authorization: `Bearer ${l}` }
|
|
1281
|
-
}
|
|
1282
|
-
);
|
|
1283
|
-
if (!x.ok) {
|
|
1284
|
-
const R = await x.json().catch(() => ({}));
|
|
1285
|
-
throw new Error(R.error || "Failed to clear preferences");
|
|
1286
|
-
}
|
|
1287
|
-
const E = await D(x);
|
|
1288
|
-
return w.current !== N ? !1 : (y(E), n(E.resolved, E.sources), !0);
|
|
1289
|
-
} catch (x) {
|
|
1290
|
-
return w.current === N && g(x instanceof Error ? x.message : "Unknown error"), !1;
|
|
1291
|
-
} finally {
|
|
1292
|
-
w.current === N && p(!1);
|
|
1293
|
-
}
|
|
1294
|
-
}, [
|
|
1295
|
-
l,
|
|
1296
|
-
s,
|
|
1297
|
-
n,
|
|
1298
|
-
D
|
|
1299
|
-
]);
|
|
1300
|
-
return {
|
|
1301
|
-
preferences: b,
|
|
1302
|
-
isLoading: o,
|
|
1303
|
-
isSaving: c,
|
|
1304
|
-
isClearing: d,
|
|
1305
|
-
error: u,
|
|
1306
|
-
updatePreferences: M,
|
|
1307
|
-
clearPreferences: F,
|
|
1308
|
-
refetch: O
|
|
1309
|
-
};
|
|
1310
|
-
}
|
|
1311
|
-
const Ce = [
|
|
1312
|
-
{ value: "America/New_York", label: "Eastern Time (US & Canada)" },
|
|
1313
|
-
{ value: "America/Chicago", label: "Central Time (US & Canada)" },
|
|
1314
|
-
{ value: "America/Denver", label: "Mountain Time (US & Canada)" },
|
|
1315
|
-
{ value: "America/Los_Angeles", label: "Pacific Time (US & Canada)" },
|
|
1316
|
-
{ value: "America/Phoenix", label: "Arizona" },
|
|
1317
|
-
{ value: "America/Anchorage", label: "Alaska" },
|
|
1318
|
-
{ value: "Pacific/Honolulu", label: "Hawaii" },
|
|
1319
|
-
{ value: "Europe/London", label: "London" },
|
|
1320
|
-
{ value: "Europe/Paris", label: "Paris, Berlin, Rome" },
|
|
1321
|
-
{ value: "Asia/Tokyo", label: "Tokyo" },
|
|
1322
|
-
{ value: "Asia/Shanghai", label: "Beijing, Shanghai" },
|
|
1323
|
-
{ value: "Asia/Kolkata", label: "Mumbai, New Delhi" },
|
|
1324
|
-
{ value: "Australia/Sydney", label: "Sydney" },
|
|
1325
|
-
{ value: "UTC", label: "UTC" }
|
|
1326
|
-
], Ut = [
|
|
1327
|
-
{ value: 0, label: "Sunday" },
|
|
1328
|
-
{ value: 1, label: "Monday" },
|
|
1329
|
-
{ value: 6, label: "Saturday" }
|
|
1330
|
-
], mt = "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground";
|
|
1331
|
-
function hn() {
|
|
1332
|
-
try {
|
|
1333
|
-
const e = Intl;
|
|
1334
|
-
if (e.supportedValuesOf)
|
|
1335
|
-
return e.supportedValuesOf("timeZone");
|
|
1336
|
-
} catch {
|
|
1337
|
-
}
|
|
1338
|
-
return Ce.map((e) => e.value);
|
|
1339
|
-
}
|
|
1340
|
-
function pn(e) {
|
|
1341
|
-
if (!e) return "default";
|
|
1342
|
-
if (e.tz !== e.weekStart) return "inherited";
|
|
1343
|
-
switch (e.tz) {
|
|
1344
|
-
case "viewer_tenant":
|
|
1345
|
-
return "tenant";
|
|
1346
|
-
case "viewer_organization":
|
|
1347
|
-
return "organization";
|
|
1348
|
-
case "system_default":
|
|
1349
|
-
return "system";
|
|
1350
|
-
case "session_initial":
|
|
1351
|
-
return "embedded";
|
|
1352
|
-
default:
|
|
1353
|
-
return "default";
|
|
1354
|
-
}
|
|
1355
|
-
}
|
|
1356
|
-
function ht(e) {
|
|
1357
|
-
const a = Ce.find((t) => t.value === e);
|
|
1358
|
-
return a ? a.label : e;
|
|
1359
|
-
}
|
|
1360
|
-
function bn(e) {
|
|
1361
|
-
const a = Ut.find((t) => t.value === e);
|
|
1362
|
-
return a ? a.label : String(e);
|
|
1363
|
-
}
|
|
1364
|
-
function vn({
|
|
1365
|
-
active: e,
|
|
1366
|
-
onClose: a
|
|
1367
|
-
}) {
|
|
1368
|
-
const {
|
|
1369
|
-
preferences: t,
|
|
1370
|
-
isLoading: n,
|
|
1371
|
-
isSaving: r,
|
|
1372
|
-
isClearing: l,
|
|
1373
|
-
updatePreferences: s,
|
|
1374
|
-
clearPreferences: o
|
|
1375
|
-
} = mn({ enabled: e }), m = gt(), c = (t == null ? void 0 : t.resolved.tz) || (m == null ? void 0 : m.tz) || "UTC", S = (t == null ? void 0 : t.resolved.weekStart) ?? (m == null ? void 0 : m.weekStart) ?? 1, [d, p] = z((t == null ? void 0 : t.stored) === null), [u, g] = z(!1), [b, y] = z(
|
|
1376
|
-
c
|
|
1377
|
-
), [w, D] = z(
|
|
1378
|
-
S
|
|
1379
|
-
), [O, M] = z(!1), F = J(() => hn(), []), N = J(
|
|
1380
|
-
() => F.filter(
|
|
1381
|
-
(k) => !Ce.some((de) => de.value === k)
|
|
1382
|
-
),
|
|
1383
|
-
[F]
|
|
1384
|
-
), x = J(() => ht(b), [b]), E = t != null && t.inherited ? ht(t.inherited.tz) : "UTC", R = t != null && t.inherited ? bn(t.inherited.weekStart) : "Monday", C = pn(
|
|
1385
|
-
t == null ? void 0 : t.inheritedSources
|
|
1386
|
-
);
|
|
1387
|
-
jt.useEffect(() => {
|
|
1388
|
-
if (!e) {
|
|
1389
|
-
g(!1);
|
|
1390
|
-
return;
|
|
1391
|
-
}
|
|
1392
|
-
u || (t && p(t.stored === null), y(c), D(S));
|
|
1393
|
-
}, [
|
|
1394
|
-
e,
|
|
1395
|
-
u,
|
|
1396
|
-
t,
|
|
1397
|
-
c,
|
|
1398
|
-
S
|
|
1399
|
-
]);
|
|
1400
|
-
const G = async () => {
|
|
1401
|
-
if (n) {
|
|
1402
|
-
X.error("Preferences are still loading. Please try again.");
|
|
1403
|
-
return;
|
|
1404
|
-
}
|
|
1405
|
-
d ? await o() ? (X.success("Now using default settings."), a()) : X.error("Failed to save preferences. Please try again.") : await s({
|
|
1406
|
-
tz: b,
|
|
1407
|
-
weekStart: w
|
|
1408
|
-
}) ? (X.success("Preferences saved."), a()) : X.error("Failed to save preferences. Please try again.");
|
|
1409
|
-
}, V = () => {
|
|
1410
|
-
a();
|
|
1411
|
-
}, re = r || l, Y = re || n;
|
|
1412
|
-
return /* @__PURE__ */ h(te, { children: [
|
|
1413
|
-
/* @__PURE__ */ h("div", { className: "space-y-4 py-1", children: [
|
|
1414
|
-
/* @__PURE__ */ h(
|
|
1415
|
-
rt,
|
|
1416
|
-
{
|
|
1417
|
-
value: d ? "defaults" : "custom",
|
|
1418
|
-
onValueChange: (k) => {
|
|
1419
|
-
g(!0), p(k === "defaults");
|
|
1420
|
-
},
|
|
1421
|
-
className: "space-y-0.5",
|
|
1422
|
-
children: [
|
|
1423
|
-
/* @__PURE__ */ h(
|
|
1424
|
-
"label",
|
|
1425
|
-
{
|
|
1426
|
-
htmlFor: "mode-defaults",
|
|
1427
|
-
className: W(
|
|
1428
|
-
"flex cursor-pointer items-start gap-2 rounded-control px-2 py-1.5 hover:bg-muted/50",
|
|
1429
|
-
d && "bg-muted/50"
|
|
1430
|
-
),
|
|
1431
|
-
onClick: () => {
|
|
1432
|
-
g(!0), p(!0);
|
|
1433
|
-
},
|
|
1434
|
-
children: [
|
|
1435
|
-
/* @__PURE__ */ i(
|
|
1436
|
-
ke,
|
|
1437
|
-
{
|
|
1438
|
-
value: "defaults",
|
|
1439
|
-
id: "mode-defaults",
|
|
1440
|
-
className: "mt-0.5"
|
|
1441
|
-
}
|
|
1442
|
-
),
|
|
1443
|
-
/* @__PURE__ */ h("div", { className: "flex-1 min-w-0", children: [
|
|
1444
|
-
/* @__PURE__ */ h("p", { className: "text-[13px] font-medium text-foreground", children: [
|
|
1445
|
-
"Use ",
|
|
1446
|
-
C,
|
|
1447
|
-
" defaults"
|
|
1448
|
-
] }),
|
|
1449
|
-
/* @__PURE__ */ h("p", { className: "text-[12px] text-muted-foreground", children: [
|
|
1450
|
-
E,
|
|
1451
|
-
", week starts ",
|
|
1452
|
-
R
|
|
1453
|
-
] })
|
|
1454
|
-
] })
|
|
1455
|
-
]
|
|
1456
|
-
}
|
|
1457
|
-
),
|
|
1458
|
-
/* @__PURE__ */ h(
|
|
1459
|
-
"label",
|
|
1460
|
-
{
|
|
1461
|
-
htmlFor: "mode-custom",
|
|
1462
|
-
className: W(
|
|
1463
|
-
"flex cursor-pointer items-start gap-2 rounded-control px-2 py-1.5 hover:bg-muted/50",
|
|
1464
|
-
!d && "bg-muted/50"
|
|
1465
|
-
),
|
|
1466
|
-
onClick: () => {
|
|
1467
|
-
g(!0), p(!1);
|
|
1468
|
-
},
|
|
1469
|
-
children: [
|
|
1470
|
-
/* @__PURE__ */ i(
|
|
1471
|
-
ke,
|
|
1472
|
-
{
|
|
1473
|
-
value: "custom",
|
|
1474
|
-
id: "mode-custom",
|
|
1475
|
-
className: "mt-0.5"
|
|
1476
|
-
}
|
|
1477
|
-
),
|
|
1478
|
-
/* @__PURE__ */ i("p", { className: "flex-1 text-[13px] font-medium text-foreground", children: "Use custom settings" })
|
|
1479
|
-
]
|
|
1480
|
-
}
|
|
1481
|
-
)
|
|
1482
|
-
]
|
|
1483
|
-
}
|
|
1484
|
-
),
|
|
1485
|
-
/* @__PURE__ */ h(
|
|
1486
|
-
"div",
|
|
1487
|
-
{
|
|
1488
|
-
className: W(
|
|
1489
|
-
"space-y-4 border-t border-border/60 pt-4 transition-opacity",
|
|
1490
|
-
d && "pointer-events-none opacity-50"
|
|
1491
|
-
),
|
|
1492
|
-
children: [
|
|
1493
|
-
/* @__PURE__ */ h("div", { className: "space-y-1.5", children: [
|
|
1494
|
-
/* @__PURE__ */ i(oe, { className: mt, children: "Timezone" }),
|
|
1495
|
-
/* @__PURE__ */ h(
|
|
1496
|
-
Ga,
|
|
1497
|
-
{
|
|
1498
|
-
open: O,
|
|
1499
|
-
onOpenChange: M,
|
|
1500
|
-
modal: !0,
|
|
1501
|
-
children: [
|
|
1502
|
-
/* @__PURE__ */ i(Xa, { asChild: !0, children: /* @__PURE__ */ h(
|
|
1503
|
-
q,
|
|
1504
|
-
{
|
|
1505
|
-
variant: "outline",
|
|
1506
|
-
size: "xs",
|
|
1507
|
-
role: "combobox",
|
|
1508
|
-
"aria-expanded": O,
|
|
1509
|
-
className: "w-full justify-between text-[12px] font-normal",
|
|
1510
|
-
disabled: d,
|
|
1511
|
-
children: [
|
|
1512
|
-
/* @__PURE__ */ i("span", { className: "truncate", children: x }),
|
|
1513
|
-
/* @__PURE__ */ i(Ea, { className: "ml-2 h-3.5 w-3.5 shrink-0 opacity-50" })
|
|
1514
|
-
]
|
|
1515
|
-
}
|
|
1516
|
-
) }),
|
|
1517
|
-
/* @__PURE__ */ i(
|
|
1518
|
-
Ja,
|
|
1519
|
-
{
|
|
1520
|
-
className: "z-50 w-[--radix-popover-trigger-width] p-0",
|
|
1521
|
-
align: "start",
|
|
1522
|
-
children: /* @__PURE__ */ h(Ot, { className: "overflow-visible", children: [
|
|
1523
|
-
/* @__PURE__ */ i(Ft, { placeholder: "Search timezones…" }),
|
|
1524
|
-
/* @__PURE__ */ h(Lt, { children: [
|
|
1525
|
-
/* @__PURE__ */ i(zt, { children: "No timezone found." }),
|
|
1526
|
-
/* @__PURE__ */ i(je, { heading: "Common", children: Ce.map((k) => /* @__PURE__ */ h(
|
|
1527
|
-
$e,
|
|
1528
|
-
{
|
|
1529
|
-
value: `${k.value} ${k.label}`,
|
|
1530
|
-
onSelect: () => {
|
|
1531
|
-
g(!0), y(k.value), M(!1);
|
|
1532
|
-
},
|
|
1533
|
-
children: [
|
|
1534
|
-
/* @__PURE__ */ i(
|
|
1535
|
-
nt,
|
|
1536
|
-
{
|
|
1537
|
-
className: W(
|
|
1538
|
-
"h-3.5 w-3.5",
|
|
1539
|
-
b === k.value ? "opacity-100" : "opacity-0"
|
|
1540
|
-
)
|
|
1541
|
-
}
|
|
1542
|
-
),
|
|
1543
|
-
/* @__PURE__ */ i("span", { className: "flex-1", children: k.label }),
|
|
1544
|
-
/* @__PURE__ */ i("span", { className: "text-[11px] text-muted-foreground", children: k.value })
|
|
1545
|
-
]
|
|
1546
|
-
},
|
|
1547
|
-
k.value
|
|
1548
|
-
)) }),
|
|
1549
|
-
/* @__PURE__ */ i(Mt, {}),
|
|
1550
|
-
/* @__PURE__ */ i(je, { heading: "All timezones", children: N.map((k) => /* @__PURE__ */ h(
|
|
1551
|
-
$e,
|
|
1552
|
-
{
|
|
1553
|
-
value: k,
|
|
1554
|
-
onSelect: () => {
|
|
1555
|
-
g(!0), y(k), M(!1);
|
|
1556
|
-
},
|
|
1557
|
-
children: [
|
|
1558
|
-
/* @__PURE__ */ i(
|
|
1559
|
-
nt,
|
|
1560
|
-
{
|
|
1561
|
-
className: W(
|
|
1562
|
-
"h-3.5 w-3.5",
|
|
1563
|
-
b === k ? "opacity-100" : "opacity-0"
|
|
1564
|
-
)
|
|
1565
|
-
}
|
|
1566
|
-
),
|
|
1567
|
-
k
|
|
1568
|
-
]
|
|
1569
|
-
},
|
|
1570
|
-
k
|
|
1571
|
-
)) })
|
|
1572
|
-
] })
|
|
1573
|
-
] })
|
|
1574
|
-
}
|
|
1575
|
-
)
|
|
1576
|
-
]
|
|
1577
|
-
}
|
|
1578
|
-
)
|
|
1579
|
-
] }),
|
|
1580
|
-
/* @__PURE__ */ h("div", { className: "space-y-1.5", children: [
|
|
1581
|
-
/* @__PURE__ */ i(oe, { className: mt, children: "Week starts on" }),
|
|
1582
|
-
/* @__PURE__ */ i(
|
|
1583
|
-
rt,
|
|
1584
|
-
{
|
|
1585
|
-
value: String(w),
|
|
1586
|
-
onValueChange: (k) => {
|
|
1587
|
-
g(!0), D(Number(k));
|
|
1588
|
-
},
|
|
1589
|
-
className: "flex gap-4",
|
|
1590
|
-
disabled: d,
|
|
1591
|
-
children: Ut.map((k) => /* @__PURE__ */ h(
|
|
1592
|
-
"label",
|
|
1593
|
-
{
|
|
1594
|
-
htmlFor: `week-start-${k.value}`,
|
|
1595
|
-
className: W(
|
|
1596
|
-
"flex cursor-pointer items-center gap-2 text-[13px]",
|
|
1597
|
-
d && "cursor-not-allowed"
|
|
1598
|
-
),
|
|
1599
|
-
children: [
|
|
1600
|
-
/* @__PURE__ */ i(
|
|
1601
|
-
ke,
|
|
1602
|
-
{
|
|
1603
|
-
value: String(k.value),
|
|
1604
|
-
id: `week-start-${k.value}`,
|
|
1605
|
-
disabled: d
|
|
1606
|
-
}
|
|
1607
|
-
),
|
|
1608
|
-
k.label
|
|
1609
|
-
]
|
|
1610
|
-
},
|
|
1611
|
-
k.value
|
|
1612
|
-
))
|
|
1613
|
-
}
|
|
1614
|
-
)
|
|
1615
|
-
] })
|
|
1616
|
-
]
|
|
1617
|
-
}
|
|
1618
|
-
)
|
|
1619
|
-
] }),
|
|
1620
|
-
/* @__PURE__ */ h(Ge, { children: [
|
|
1621
|
-
/* @__PURE__ */ i(
|
|
1622
|
-
q,
|
|
1623
|
-
{
|
|
1624
|
-
variant: "outline",
|
|
1625
|
-
size: "xs",
|
|
1626
|
-
onClick: V,
|
|
1627
|
-
disabled: re,
|
|
1628
|
-
children: "Cancel"
|
|
1629
|
-
}
|
|
1630
|
-
),
|
|
1631
|
-
/* @__PURE__ */ i(q, { size: "xs", onClick: G, disabled: Y, children: re ? /* @__PURE__ */ h(te, { children: [
|
|
1632
|
-
/* @__PURE__ */ i(xt, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
1633
|
-
"Saving…"
|
|
1634
|
-
] }) : "Save" })
|
|
1635
|
-
] })
|
|
1636
|
-
] });
|
|
1637
|
-
}
|
|
1638
|
-
function gn(e = {}) {
|
|
1639
|
-
const { authToken: a, tokenProps: t } = qe(), n = _(
|
|
1640
|
-
(x) => x.actions.applyResolvedValueFormatPreferences
|
|
1641
|
-
), r = e.enabled ?? !0, l = (a == null ? void 0 : a.accessToken) ?? null, s = (t == null ? void 0 : t.apiServiceUrl) ?? null, o = U(l);
|
|
1642
|
-
o.current = l;
|
|
1643
|
-
const [m, c] = z(null), [S, d] = z(!1), [p, u] = z(!1), [g, b] = z(!1), [y, w] = z(null);
|
|
1644
|
-
H(() => {
|
|
1645
|
-
c(null), w(null), d(!1), u(!1), b(!1);
|
|
1646
|
-
}, [l]);
|
|
1647
|
-
const D = j(async (x) => {
|
|
1648
|
-
const E = Ma(await x.json());
|
|
1649
|
-
if (!E.ok)
|
|
1650
|
-
throw new Error("Value format preferences response is invalid");
|
|
1651
|
-
return E.value;
|
|
1652
|
-
}, []), O = j(
|
|
1653
|
-
async (x, E) => {
|
|
1654
|
-
if (!l || !s)
|
|
1655
|
-
throw new Error("Not authenticated");
|
|
1656
|
-
const R = await fetch(
|
|
1657
|
-
`${s}/v1/user-preferences/value-format`,
|
|
1658
|
-
{
|
|
1659
|
-
method: x,
|
|
1660
|
-
headers: {
|
|
1661
|
-
Authorization: `Bearer ${l}`,
|
|
1662
|
-
...E ? { "Content-Type": "application/json" } : {}
|
|
1663
|
-
},
|
|
1664
|
-
body: E ? JSON.stringify(E) : void 0
|
|
1665
|
-
}
|
|
1666
|
-
);
|
|
1667
|
-
if (!R.ok) {
|
|
1668
|
-
const C = await R.json().catch(() => ({}));
|
|
1669
|
-
throw new Error(C.error || "Failed to update preferences");
|
|
1670
|
-
}
|
|
1671
|
-
return D(R);
|
|
1672
|
-
},
|
|
1673
|
-
[l, s, D]
|
|
1674
|
-
), M = j(async () => {
|
|
1675
|
-
if (!r || !l || !s) return;
|
|
1676
|
-
const x = l;
|
|
1677
|
-
d(!0), w(null);
|
|
1678
|
-
try {
|
|
1679
|
-
const E = await O("GET");
|
|
1680
|
-
o.current === x && c(E);
|
|
1681
|
-
} catch (E) {
|
|
1682
|
-
o.current === x && w(E instanceof Error ? E.message : "Unknown error");
|
|
1683
|
-
} finally {
|
|
1684
|
-
o.current === x && d(!1);
|
|
1685
|
-
}
|
|
1686
|
-
}, [l, s, r, O]);
|
|
1687
|
-
H(() => {
|
|
1688
|
-
r && M();
|
|
1689
|
-
}, [r, M]);
|
|
1690
|
-
const F = j(
|
|
1691
|
-
async (x) => {
|
|
1692
|
-
const E = l;
|
|
1693
|
-
u(!0), w(null);
|
|
1694
|
-
try {
|
|
1695
|
-
const R = await O("PATCH", x);
|
|
1696
|
-
return o.current !== E ? !1 : (c(R), n(R.resolved, R.sources), !0);
|
|
1697
|
-
} catch (R) {
|
|
1698
|
-
return o.current === E && w(R instanceof Error ? R.message : "Unknown error"), !1;
|
|
1699
|
-
} finally {
|
|
1700
|
-
o.current === E && u(!1);
|
|
1701
|
-
}
|
|
1702
|
-
},
|
|
1703
|
-
[l, n, O]
|
|
1704
|
-
), N = j(async () => {
|
|
1705
|
-
const x = l;
|
|
1706
|
-
b(!0), w(null);
|
|
1707
|
-
try {
|
|
1708
|
-
const E = await O("DELETE");
|
|
1709
|
-
return o.current !== x ? !1 : (c(E), n(E.resolved, E.sources), !0);
|
|
1710
|
-
} catch (E) {
|
|
1711
|
-
return o.current === x && w(E instanceof Error ? E.message : "Unknown error"), !1;
|
|
1712
|
-
} finally {
|
|
1713
|
-
o.current === x && b(!1);
|
|
1714
|
-
}
|
|
1715
|
-
}, [l, n, O]);
|
|
1716
|
-
return {
|
|
1717
|
-
preferences: m,
|
|
1718
|
-
isLoading: S,
|
|
1719
|
-
isSaving: p,
|
|
1720
|
-
isClearing: g,
|
|
1721
|
-
error: y,
|
|
1722
|
-
updatePreferences: F,
|
|
1723
|
-
clearPreferences: N,
|
|
1724
|
-
refetch: M
|
|
1725
|
-
};
|
|
1726
|
-
}
|
|
1727
|
-
const Ve = [
|
|
1728
|
-
{ value: "en-US", label: "English (United States)" },
|
|
1729
|
-
{ value: "en-GB", label: "English (United Kingdom)" },
|
|
1730
|
-
{ value: "de-DE", label: "German (Germany)" },
|
|
1731
|
-
{ value: "fr-FR", label: "French (France)" },
|
|
1732
|
-
{ value: "es-ES", label: "Spanish (Spain)" },
|
|
1733
|
-
{ value: "it-IT", label: "Italian (Italy)" },
|
|
1734
|
-
{ value: "nl-NL", label: "Dutch (Netherlands)" },
|
|
1735
|
-
{ value: "pt-BR", label: "Portuguese (Brazil)" },
|
|
1736
|
-
{ value: "ja-JP", label: "Japanese (Japan)" },
|
|
1737
|
-
{ value: "en-IN", label: "English (India)" },
|
|
1738
|
-
{ value: "en-NZ", label: "English (New Zealand)" },
|
|
1739
|
-
{ value: "mi-NZ", label: "Māori (New Zealand)" }
|
|
1740
|
-
], Wt = /* @__PURE__ */ new Set([
|
|
1741
|
-
"USD",
|
|
1742
|
-
"EUR",
|
|
1743
|
-
"GBP",
|
|
1744
|
-
"CAD",
|
|
1745
|
-
"AUD",
|
|
1746
|
-
"JPY",
|
|
1747
|
-
"CHF",
|
|
1748
|
-
"INR",
|
|
1749
|
-
"BRL",
|
|
1750
|
-
"KWD"
|
|
1751
|
-
]), yn = Ua(), wn = yn.filter(
|
|
1752
|
-
(e) => !Wt.has(e)
|
|
1753
|
-
), Bt = [
|
|
1754
|
-
{ value: "short", label: "Short" },
|
|
1755
|
-
{ value: "medium", label: "Medium" },
|
|
1756
|
-
{ value: "long", label: "Long" }
|
|
1757
|
-
], pt = "2026-07-31", _e = "2026-07-31T14:30:45";
|
|
1758
|
-
function Ke(e) {
|
|
1759
|
-
switch (e) {
|
|
1760
|
-
case "viewer_user":
|
|
1761
|
-
return "user";
|
|
1762
|
-
case "viewer_tenant_user":
|
|
1763
|
-
return "tenant user";
|
|
1764
|
-
case "viewer_tenant":
|
|
1765
|
-
return "tenant";
|
|
1766
|
-
case "viewer_organization":
|
|
1767
|
-
return "organization";
|
|
1768
|
-
case "session_initial":
|
|
1769
|
-
return "embedded session";
|
|
1770
|
-
case "system_default":
|
|
1771
|
-
return "system";
|
|
1772
|
-
default:
|
|
1773
|
-
return "another preference level";
|
|
1774
|
-
}
|
|
1775
|
-
}
|
|
1776
|
-
function Pe(e) {
|
|
1777
|
-
var a;
|
|
1778
|
-
return ((a = Bt.find((t) => t.value === e)) == null ? void 0 : a.label) ?? e;
|
|
1779
|
-
}
|
|
1780
|
-
function Sn(e) {
|
|
1781
|
-
const a = Ve.find((t) => t.value === e);
|
|
1782
|
-
return a ? `${a.label} — ${a.value}` : e;
|
|
1783
|
-
}
|
|
1784
|
-
function Oe(e) {
|
|
1785
|
-
return {
|
|
1786
|
-
short: e("short"),
|
|
1787
|
-
medium: e("medium"),
|
|
1788
|
-
long: e("long")
|
|
1789
|
-
};
|
|
1790
|
-
}
|
|
1791
|
-
function Fe({
|
|
1792
|
-
id: e,
|
|
1793
|
-
label: a,
|
|
1794
|
-
value: t,
|
|
1795
|
-
inherited: n,
|
|
1796
|
-
inheritedSource: r,
|
|
1797
|
-
examples: l,
|
|
1798
|
-
disabled: s,
|
|
1799
|
-
onValueChange: o
|
|
1800
|
-
}) {
|
|
1801
|
-
const m = t === void 0 ? `Inherited · ${Pe(n)}` : Pe(t);
|
|
1802
|
-
return /* @__PURE__ */ h("div", { className: "space-y-1.5", children: [
|
|
1803
|
-
/* @__PURE__ */ i(oe, { htmlFor: e, className: "text-[11px] text-muted-foreground", children: a }),
|
|
1804
|
-
/* @__PURE__ */ h(
|
|
1805
|
-
Le,
|
|
1806
|
-
{
|
|
1807
|
-
value: t ?? "inherit",
|
|
1808
|
-
disabled: s,
|
|
1809
|
-
onValueChange: o,
|
|
1810
|
-
children: [
|
|
1811
|
-
/* @__PURE__ */ i(ze, { id: e, size: "xs", children: /* @__PURE__ */ i(Me, { children: m }) }),
|
|
1812
|
-
/* @__PURE__ */ h(Ue, { children: [
|
|
1813
|
-
/* @__PURE__ */ i(Z, { value: "inherit", className: "[&>span:last-child]:w-full", children: /* @__PURE__ */ h("span", { className: "flex w-full min-w-0 items-center justify-between gap-4", children: [
|
|
1814
|
-
/* @__PURE__ */ h("span", { children: [
|
|
1815
|
-
"Inherited from ",
|
|
1816
|
-
Ke(r),
|
|
1817
|
-
" ·",
|
|
1818
|
-
" ",
|
|
1819
|
-
Pe(n)
|
|
1820
|
-
] }),
|
|
1821
|
-
/* @__PURE__ */ i("span", { className: "shrink-0 tabular-nums text-muted-foreground", children: l[n] })
|
|
1822
|
-
] }) }),
|
|
1823
|
-
Bt.map((c) => /* @__PURE__ */ i(
|
|
1824
|
-
Z,
|
|
1825
|
-
{
|
|
1826
|
-
value: c.value,
|
|
1827
|
-
className: "[&>span:last-child]:w-full",
|
|
1828
|
-
children: /* @__PURE__ */ h("span", { className: "flex w-full min-w-0 items-center justify-between gap-4", children: [
|
|
1829
|
-
/* @__PURE__ */ i("span", { children: c.label }),
|
|
1830
|
-
/* @__PURE__ */ i("span", { className: "shrink-0 tabular-nums text-muted-foreground", children: l[c.value] })
|
|
1831
|
-
] })
|
|
1832
|
-
},
|
|
1833
|
-
c.value
|
|
1834
|
-
))
|
|
1835
|
-
] })
|
|
1836
|
-
]
|
|
1837
|
-
}
|
|
1838
|
-
)
|
|
1839
|
-
] });
|
|
1840
|
-
}
|
|
1841
|
-
function xn({
|
|
1842
|
-
value: e,
|
|
1843
|
-
inherited: a,
|
|
1844
|
-
inheritedSources: t,
|
|
1845
|
-
onChange: n,
|
|
1846
|
-
disabled: r
|
|
1847
|
-
}) {
|
|
1848
|
-
var N, x, E, R;
|
|
1849
|
-
const l = ce(), s = ce(), o = ce(), m = ce(), c = ce(), d = (e.locale === void 0 ? void 0 : St(e.locale)) ?? a.locale, p = e.defaultCurrency ?? a.defaultCurrency, u = {
|
|
1850
|
-
locale: d,
|
|
1851
|
-
dateStyle: e.dateStyle ?? a.dateStyle,
|
|
1852
|
-
dateTime: {
|
|
1853
|
-
dateStyle: ((N = e.dateTime) == null ? void 0 : N.dateStyle) ?? a.dateTime.dateStyle,
|
|
1854
|
-
timeStyle: ((x = e.dateTime) == null ? void 0 : x.timeStyle) ?? a.dateTime.timeStyle
|
|
1855
|
-
},
|
|
1856
|
-
defaultCurrency: p
|
|
1857
|
-
}, g = new Intl.NumberFormat(d, {
|
|
1858
|
-
style: "currency",
|
|
1859
|
-
currency: p
|
|
1860
|
-
}).format(1e3), b = we({
|
|
1861
|
-
preferences: u,
|
|
1862
|
-
calendar: { tz: "UTC" }
|
|
1863
|
-
}), y = ue({
|
|
1864
|
-
value: pt,
|
|
1865
|
-
metadata: { kind: "raw_temporal", valueKind: "date" },
|
|
1866
|
-
format: b
|
|
1867
|
-
}).text, w = ue({
|
|
1868
|
-
value: _e,
|
|
1869
|
-
metadata: { kind: "raw_temporal", valueKind: "wall_datetime" },
|
|
1870
|
-
format: b
|
|
1871
|
-
}).text, D = Oe(
|
|
1872
|
-
(C) => ue({
|
|
1873
|
-
value: pt,
|
|
1874
|
-
metadata: { kind: "raw_temporal", valueKind: "date" },
|
|
1875
|
-
format: we({
|
|
1876
|
-
preferences: { ...u, dateStyle: C },
|
|
1877
|
-
calendar: { tz: "UTC" }
|
|
1878
|
-
})
|
|
1879
|
-
}).text
|
|
1880
|
-
), O = Oe(
|
|
1881
|
-
(C) => ue({
|
|
1882
|
-
value: _e,
|
|
1883
|
-
metadata: { kind: "raw_temporal", valueKind: "wall_datetime" },
|
|
1884
|
-
format: we({
|
|
1885
|
-
preferences: {
|
|
1886
|
-
...u,
|
|
1887
|
-
dateTime: { ...u.dateTime, dateStyle: C }
|
|
1888
|
-
},
|
|
1889
|
-
calendar: { tz: "UTC" }
|
|
1890
|
-
})
|
|
1891
|
-
}).text
|
|
1892
|
-
), M = Oe(
|
|
1893
|
-
(C) => ue({
|
|
1894
|
-
value: _e,
|
|
1895
|
-
metadata: { kind: "raw_temporal", valueKind: "wall_datetime" },
|
|
1896
|
-
format: we({
|
|
1897
|
-
preferences: {
|
|
1898
|
-
...u,
|
|
1899
|
-
dateTime: { ...u.dateTime, timeStyle: C }
|
|
1900
|
-
},
|
|
1901
|
-
calendar: { tz: "UTC" }
|
|
1902
|
-
})
|
|
1903
|
-
}).text
|
|
1904
|
-
), F = (C, G) => {
|
|
1905
|
-
const V = {
|
|
1906
|
-
...e.dateTime,
|
|
1907
|
-
[C]: G === "inherit" ? void 0 : G
|
|
1908
|
-
};
|
|
1909
|
-
n({
|
|
1910
|
-
...e,
|
|
1911
|
-
dateTime: V.dateStyle === void 0 && V.timeStyle === void 0 ? void 0 : V
|
|
1912
|
-
});
|
|
1913
|
-
};
|
|
1914
|
-
return /* @__PURE__ */ h("div", { className: "space-y-4", children: [
|
|
1915
|
-
/* @__PURE__ */ h("div", { className: "space-y-1.5", children: [
|
|
1916
|
-
/* @__PURE__ */ i(
|
|
1917
|
-
oe,
|
|
1918
|
-
{
|
|
1919
|
-
htmlFor: l,
|
|
1920
|
-
className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",
|
|
1921
|
-
children: "Locale"
|
|
1922
|
-
}
|
|
1923
|
-
),
|
|
1924
|
-
/* @__PURE__ */ h(
|
|
1925
|
-
Le,
|
|
1926
|
-
{
|
|
1927
|
-
value: e.locale ?? "inherit",
|
|
1928
|
-
disabled: r,
|
|
1929
|
-
onValueChange: (C) => n({
|
|
1930
|
-
...e,
|
|
1931
|
-
locale: C === "inherit" ? void 0 : C
|
|
1932
|
-
}),
|
|
1933
|
-
children: [
|
|
1934
|
-
/* @__PURE__ */ i(ze, { id: l, size: "xs", children: /* @__PURE__ */ i(Me, { children: e.locale === void 0 ? `Inherited · ${a.locale}` : Sn(e.locale) }) }),
|
|
1935
|
-
/* @__PURE__ */ h(Ue, { children: [
|
|
1936
|
-
/* @__PURE__ */ h(Z, { value: "inherit", children: [
|
|
1937
|
-
"Inherited from ",
|
|
1938
|
-
Ke(t.locale),
|
|
1939
|
-
" ·",
|
|
1940
|
-
" ",
|
|
1941
|
-
a.locale
|
|
1942
|
-
] }),
|
|
1943
|
-
e.locale && !Ve.some(
|
|
1944
|
-
(C) => C.value === e.locale
|
|
1945
|
-
) && /* @__PURE__ */ i(Z, { value: e.locale, children: e.locale }),
|
|
1946
|
-
Ve.map((C) => /* @__PURE__ */ h(Z, { value: C.value, children: [
|
|
1947
|
-
C.label,
|
|
1948
|
-
" — ",
|
|
1949
|
-
C.value
|
|
1950
|
-
] }, C.value))
|
|
1951
|
-
] })
|
|
1952
|
-
]
|
|
1953
|
-
}
|
|
1954
|
-
)
|
|
1955
|
-
] }),
|
|
1956
|
-
/* @__PURE__ */ h("fieldset", { className: "space-y-2", children: [
|
|
1957
|
-
/* @__PURE__ */ i("legend", { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Date values" }),
|
|
1958
|
-
/* @__PURE__ */ i(
|
|
1959
|
-
Fe,
|
|
1960
|
-
{
|
|
1961
|
-
id: o,
|
|
1962
|
-
label: "Format",
|
|
1963
|
-
value: e.dateStyle,
|
|
1964
|
-
inherited: a.dateStyle,
|
|
1965
|
-
inheritedSource: t.dateStyle,
|
|
1966
|
-
examples: D,
|
|
1967
|
-
disabled: r,
|
|
1968
|
-
onValueChange: (C) => n({
|
|
1969
|
-
...e,
|
|
1970
|
-
dateStyle: C === "inherit" ? void 0 : C
|
|
1971
|
-
})
|
|
1972
|
-
}
|
|
1973
|
-
)
|
|
1974
|
-
] }),
|
|
1975
|
-
/* @__PURE__ */ h("fieldset", { className: "space-y-2", children: [
|
|
1976
|
-
/* @__PURE__ */ i("legend", { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Date & time values" }),
|
|
1977
|
-
/* @__PURE__ */ i(
|
|
1978
|
-
Fe,
|
|
1979
|
-
{
|
|
1980
|
-
id: m,
|
|
1981
|
-
label: "Date",
|
|
1982
|
-
value: (E = e.dateTime) == null ? void 0 : E.dateStyle,
|
|
1983
|
-
inherited: a.dateTime.dateStyle,
|
|
1984
|
-
inheritedSource: t.dateTime.dateStyle,
|
|
1985
|
-
examples: O,
|
|
1986
|
-
disabled: r,
|
|
1987
|
-
onValueChange: (C) => F("dateStyle", C)
|
|
1988
|
-
}
|
|
1989
|
-
),
|
|
1990
|
-
/* @__PURE__ */ i(
|
|
1991
|
-
Fe,
|
|
1992
|
-
{
|
|
1993
|
-
id: c,
|
|
1994
|
-
label: "Time",
|
|
1995
|
-
value: (R = e.dateTime) == null ? void 0 : R.timeStyle,
|
|
1996
|
-
inherited: a.dateTime.timeStyle,
|
|
1997
|
-
inheritedSource: t.dateTime.timeStyle,
|
|
1998
|
-
examples: M,
|
|
1999
|
-
disabled: r,
|
|
2000
|
-
onValueChange: (C) => F("timeStyle", C)
|
|
2001
|
-
}
|
|
2002
|
-
)
|
|
2003
|
-
] }),
|
|
2004
|
-
/* @__PURE__ */ h("div", { className: "space-y-1.5", children: [
|
|
2005
|
-
/* @__PURE__ */ i(
|
|
2006
|
-
oe,
|
|
2007
|
-
{
|
|
2008
|
-
htmlFor: s,
|
|
2009
|
-
className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",
|
|
2010
|
-
children: "Default currency"
|
|
2011
|
-
}
|
|
2012
|
-
),
|
|
2013
|
-
/* @__PURE__ */ h(
|
|
2014
|
-
Le,
|
|
2015
|
-
{
|
|
2016
|
-
value: e.defaultCurrency ?? "inherit",
|
|
2017
|
-
disabled: r,
|
|
2018
|
-
onValueChange: (C) => n({
|
|
2019
|
-
...e,
|
|
2020
|
-
defaultCurrency: C === "inherit" ? void 0 : C
|
|
2021
|
-
}),
|
|
2022
|
-
children: [
|
|
2023
|
-
/* @__PURE__ */ i(ze, { id: s, size: "xs", children: /* @__PURE__ */ i(Me, { children: e.defaultCurrency === void 0 ? `Inherited · ${a.defaultCurrency}` : e.defaultCurrency }) }),
|
|
2024
|
-
/* @__PURE__ */ h(Ue, { children: [
|
|
2025
|
-
/* @__PURE__ */ h(Z, { value: "inherit", children: [
|
|
2026
|
-
"Inherited from ",
|
|
2027
|
-
Ke(t.defaultCurrency),
|
|
2028
|
-
" ·",
|
|
2029
|
-
" ",
|
|
2030
|
-
a.defaultCurrency
|
|
2031
|
-
] }),
|
|
2032
|
-
[...Wt].map((C) => /* @__PURE__ */ i(Z, { value: C, children: C }, C)),
|
|
2033
|
-
wn.map((C) => /* @__PURE__ */ i(Z, { value: C, children: C }, C))
|
|
2034
|
-
] })
|
|
2035
|
-
]
|
|
2036
|
-
}
|
|
2037
|
-
)
|
|
2038
|
-
] }),
|
|
2039
|
-
/* @__PURE__ */ h("div", { className: "rounded-control border border-border/60 bg-muted/30 px-3 py-2", children: [
|
|
2040
|
-
/* @__PURE__ */ i("p", { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Preview" }),
|
|
2041
|
-
/* @__PURE__ */ h("dl", { className: "mt-1.5 space-y-1 text-[12px]", children: [
|
|
2042
|
-
/* @__PURE__ */ h("div", { className: "flex items-baseline justify-between gap-4", children: [
|
|
2043
|
-
/* @__PURE__ */ i("dt", { className: "text-muted-foreground", children: "Date" }),
|
|
2044
|
-
/* @__PURE__ */ i("dd", { className: "text-right font-medium text-foreground", children: y })
|
|
2045
|
-
] }),
|
|
2046
|
-
/* @__PURE__ */ h("div", { className: "flex items-baseline justify-between gap-4", children: [
|
|
2047
|
-
/* @__PURE__ */ i("dt", { className: "text-muted-foreground", children: "Date & time" }),
|
|
2048
|
-
/* @__PURE__ */ i("dd", { className: "text-right font-medium text-foreground", children: w })
|
|
2049
|
-
] }),
|
|
2050
|
-
/* @__PURE__ */ h("div", { className: "flex items-baseline justify-between gap-4", children: [
|
|
2051
|
-
/* @__PURE__ */ i("dt", { className: "text-muted-foreground", children: "Currency" }),
|
|
2052
|
-
/* @__PURE__ */ i("dd", { className: "text-right font-medium text-foreground", children: g })
|
|
2053
|
-
] })
|
|
2054
|
-
] })
|
|
2055
|
-
] }),
|
|
2056
|
-
/* @__PURE__ */ i("p", { className: "text-[11px] text-muted-foreground", children: "Currency values are not converted. Date examples use a fixed reference value and the Gregorian calendar." })
|
|
2057
|
-
] });
|
|
2058
|
-
}
|
|
2059
|
-
const bt = [
|
|
2060
|
-
"locale",
|
|
2061
|
-
"dateStyle",
|
|
2062
|
-
"dateTime.dateStyle",
|
|
2063
|
-
"dateTime.timeStyle",
|
|
2064
|
-
"defaultCurrency"
|
|
2065
|
-
];
|
|
2066
|
-
function vt(e, a) {
|
|
2067
|
-
var t, n;
|
|
2068
|
-
switch (a) {
|
|
2069
|
-
case "locale":
|
|
2070
|
-
return e == null ? void 0 : e.locale;
|
|
2071
|
-
case "dateStyle":
|
|
2072
|
-
return e == null ? void 0 : e.dateStyle;
|
|
2073
|
-
case "dateTime.dateStyle":
|
|
2074
|
-
return (t = e == null ? void 0 : e.dateTime) == null ? void 0 : t.dateStyle;
|
|
2075
|
-
case "dateTime.timeStyle":
|
|
2076
|
-
return (n = e == null ? void 0 : e.dateTime) == null ? void 0 : n.timeStyle;
|
|
2077
|
-
case "defaultCurrency":
|
|
2078
|
-
return e == null ? void 0 : e.defaultCurrency;
|
|
2079
|
-
}
|
|
2080
|
-
}
|
|
2081
|
-
function In(e) {
|
|
2082
|
-
var n, r;
|
|
2083
|
-
const a = (n = e == null ? void 0 : e.dateTime) == null ? void 0 : n.dateStyle, t = (r = e == null ? void 0 : e.dateTime) == null ? void 0 : r.timeStyle;
|
|
2084
|
-
return {
|
|
2085
|
-
locale: e == null ? void 0 : e.locale,
|
|
2086
|
-
dateStyle: e == null ? void 0 : e.dateStyle,
|
|
2087
|
-
dateTime: a === void 0 && t === void 0 ? void 0 : { dateStyle: a, timeStyle: t },
|
|
2088
|
-
defaultCurrency: e == null ? void 0 : e.defaultCurrency
|
|
2089
|
-
};
|
|
2090
|
-
}
|
|
2091
|
-
function Cn({
|
|
2092
|
-
active: e,
|
|
2093
|
-
onClose: a
|
|
2094
|
-
}) {
|
|
2095
|
-
var o, m, c, S, d, p, u;
|
|
2096
|
-
const { preferences: t, isLoading: n, isSaving: r, updatePreferences: l } = gn({ enabled: e });
|
|
2097
|
-
if (!e) return null;
|
|
2098
|
-
if (!t)
|
|
2099
|
-
return /* @__PURE__ */ h(te, { children: [
|
|
2100
|
-
/* @__PURE__ */ i("div", { className: "py-2", children: /* @__PURE__ */ i("div", { className: "flex min-h-36 items-center justify-center text-[12px] text-muted-foreground", children: n ? "Loading preferences…" : "Preferences unavailable." }) }),
|
|
2101
|
-
/* @__PURE__ */ h(Ge, { className: "justify-between sm:justify-between", children: [
|
|
2102
|
-
/* @__PURE__ */ i(q, { variant: "ghost", size: "xs", disabled: !0, children: "Reset display formats" }),
|
|
2103
|
-
/* @__PURE__ */ h("div", { className: "flex gap-2", children: [
|
|
2104
|
-
/* @__PURE__ */ i(q, { variant: "outline", size: "xs", onClick: a, children: "Cancel" }),
|
|
2105
|
-
/* @__PURE__ */ i(q, { size: "xs", disabled: !0, children: "Save" })
|
|
2106
|
-
] })
|
|
2107
|
-
] })
|
|
2108
|
-
] });
|
|
2109
|
-
const s = [
|
|
2110
|
-
((o = t.stored) == null ? void 0 : o.locale) ?? "",
|
|
2111
|
-
((m = t.stored) == null ? void 0 : m.dateStyle) ?? "",
|
|
2112
|
-
((S = (c = t.stored) == null ? void 0 : c.dateTime) == null ? void 0 : S.dateStyle) ?? "",
|
|
2113
|
-
((p = (d = t.stored) == null ? void 0 : d.dateTime) == null ? void 0 : p.timeStyle) ?? "",
|
|
2114
|
-
((u = t.stored) == null ? void 0 : u.defaultCurrency) ?? ""
|
|
2115
|
-
].join(":");
|
|
2116
|
-
return /* @__PURE__ */ i(
|
|
2117
|
-
En,
|
|
2118
|
-
{
|
|
2119
|
-
preferences: t,
|
|
2120
|
-
isSaving: r,
|
|
2121
|
-
updatePreferences: l,
|
|
2122
|
-
onClose: a
|
|
2123
|
-
},
|
|
2124
|
-
s
|
|
2125
|
-
);
|
|
2126
|
-
}
|
|
2127
|
-
function En({
|
|
2128
|
-
preferences: e,
|
|
2129
|
-
isSaving: a,
|
|
2130
|
-
updatePreferences: t,
|
|
2131
|
-
onClose: n
|
|
2132
|
-
}) {
|
|
2133
|
-
var c, S;
|
|
2134
|
-
const [r, l] = z(
|
|
2135
|
-
() => In(e.stored)
|
|
2136
|
-
), s = (r.locale === void 0 || St(r.locale) !== void 0) && (r.defaultCurrency === void 0 || Wa(r.defaultCurrency) !== void 0) && (r.dateStyle === void 0 || ["short", "medium", "long"].includes(r.dateStyle)) && (((c = r.dateTime) == null ? void 0 : c.dateStyle) === void 0 || ["short", "medium", "long"].includes(r.dateTime.dateStyle)) && (((S = r.dateTime) == null ? void 0 : S.timeStyle) === void 0 || ["short", "medium", "long"].includes(r.dateTime.timeStyle)), o = async () => {
|
|
2137
|
-
const d = {
|
|
2138
|
-
...r.locale !== void 0 ? { locale: r.locale } : {},
|
|
2139
|
-
...r.dateStyle !== void 0 ? { dateStyle: r.dateStyle } : {},
|
|
2140
|
-
...r.dateTime ? { dateTime: { ...r.dateTime } } : {},
|
|
2141
|
-
...r.defaultCurrency !== void 0 ? { defaultCurrency: r.defaultCurrency } : {}
|
|
2142
|
-
}, p = bt.filter(
|
|
2143
|
-
(b) => vt(r, b) === void 0 && vt(e.stored, b) !== void 0
|
|
2144
|
-
), u = {
|
|
2145
|
-
...Object.keys(d).length > 0 ? { set: d } : {},
|
|
2146
|
-
...p.length > 0 ? { clear: p } : {}
|
|
2147
|
-
};
|
|
2148
|
-
(Object.keys(u).length === 0 ? !0 : await t(u)) ? (X.success("Display format preferences saved."), n()) : X.error("Failed to save preferences. Please try again.");
|
|
2149
|
-
}, m = async () => {
|
|
2150
|
-
await t({
|
|
2151
|
-
clear: [...bt]
|
|
2152
|
-
}) ? (X.success("Display format preferences reset."), n()) : X.error(
|
|
2153
|
-
"Failed to reset display format preferences. Please try again."
|
|
2154
|
-
);
|
|
2155
|
-
};
|
|
2156
|
-
return /* @__PURE__ */ h(te, { children: [
|
|
2157
|
-
/* @__PURE__ */ i("div", { className: "py-2", children: /* @__PURE__ */ i(
|
|
2158
|
-
xn,
|
|
2159
|
-
{
|
|
2160
|
-
value: r,
|
|
2161
|
-
inherited: e.inherited,
|
|
2162
|
-
inheritedSources: e.inheritedSources,
|
|
2163
|
-
onChange: l,
|
|
2164
|
-
disabled: a
|
|
2165
|
-
}
|
|
2166
|
-
) }),
|
|
2167
|
-
/* @__PURE__ */ h(Ge, { className: "justify-between sm:justify-between", children: [
|
|
2168
|
-
/* @__PURE__ */ i(
|
|
2169
|
-
q,
|
|
2170
|
-
{
|
|
2171
|
-
variant: "ghost",
|
|
2172
|
-
size: "xs",
|
|
2173
|
-
onClick: m,
|
|
2174
|
-
disabled: a || e.stored === null,
|
|
2175
|
-
children: "Reset display formats"
|
|
2176
|
-
}
|
|
2177
|
-
),
|
|
2178
|
-
/* @__PURE__ */ h("div", { className: "flex gap-2", children: [
|
|
2179
|
-
/* @__PURE__ */ i(
|
|
2180
|
-
q,
|
|
2181
|
-
{
|
|
2182
|
-
variant: "outline",
|
|
2183
|
-
size: "xs",
|
|
2184
|
-
onClick: n,
|
|
2185
|
-
disabled: a,
|
|
2186
|
-
children: "Cancel"
|
|
2187
|
-
}
|
|
2188
|
-
),
|
|
2189
|
-
/* @__PURE__ */ i(
|
|
2190
|
-
q,
|
|
2191
|
-
{
|
|
2192
|
-
size: "xs",
|
|
2193
|
-
onClick: o,
|
|
2194
|
-
disabled: a || !s,
|
|
2195
|
-
children: a ? /* @__PURE__ */ h(te, { children: [
|
|
2196
|
-
/* @__PURE__ */ i(xt, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
2197
|
-
"Saving…"
|
|
2198
|
-
] }) : "Save"
|
|
2199
|
-
}
|
|
2200
|
-
)
|
|
2201
|
-
] })
|
|
2202
|
-
] })
|
|
2203
|
-
] });
|
|
2204
|
-
}
|
|
2205
|
-
function Zn({
|
|
2206
|
-
open: e,
|
|
2207
|
-
onOpenChange: a
|
|
2208
|
-
}) {
|
|
2209
|
-
const [t, n] = z("display"), r = () => a(!1);
|
|
2210
|
-
return /* @__PURE__ */ i(Na, { open: e, onOpenChange: a, children: /* @__PURE__ */ h(Ta, { className: "rounded-control border-border/60 sm:max-w-[440px] sm:rounded-control", children: [
|
|
2211
|
-
/* @__PURE__ */ h(ka, { children: [
|
|
2212
|
-
/* @__PURE__ */ i(Aa, { className: "text-[15px]", children: "Report preferences" }),
|
|
2213
|
-
/* @__PURE__ */ i(Da, { className: "text-[13px] leading-5", children: "Set how values and Calendar periods appear for you." })
|
|
2214
|
-
] }),
|
|
2215
|
-
/* @__PURE__ */ h(Ya, { value: t, onValueChange: n, children: [
|
|
2216
|
-
/* @__PURE__ */ h(Za, { variant: "underline", className: "w-full justify-start", children: [
|
|
2217
|
-
/* @__PURE__ */ i(st, { value: "display", children: "Display formats" }),
|
|
2218
|
-
/* @__PURE__ */ i(st, { value: "calendar", children: "Calendar" })
|
|
2219
|
-
] }),
|
|
2220
|
-
/* @__PURE__ */ i(lt, { value: "display", children: /* @__PURE__ */ i(
|
|
2221
|
-
Cn,
|
|
2222
|
-
{
|
|
2223
|
-
active: e && t === "display",
|
|
2224
|
-
onClose: r
|
|
2225
|
-
}
|
|
2226
|
-
) }),
|
|
2227
|
-
/* @__PURE__ */ i(lt, { value: "calendar", children: /* @__PURE__ */ i(
|
|
2228
|
-
vn,
|
|
2229
|
-
{
|
|
2230
|
-
active: e && t === "calendar",
|
|
2231
|
-
onClose: r
|
|
2232
|
-
}
|
|
2233
|
-
) })
|
|
2234
|
-
] })
|
|
2235
|
-
] }) });
|
|
2236
|
-
}
|
|
2237
|
-
export {
|
|
2238
|
-
ur as A,
|
|
2239
|
-
Ot as C,
|
|
2240
|
-
Yn as D,
|
|
2241
|
-
Zn as R,
|
|
2242
|
-
vr as T,
|
|
2243
|
-
xn as a,
|
|
2244
|
-
Ft as b,
|
|
2245
|
-
Lt as c,
|
|
2246
|
-
zt as d,
|
|
2247
|
-
je as e,
|
|
2248
|
-
$e as f,
|
|
2249
|
-
Nr as g,
|
|
2250
|
-
Jn as h,
|
|
2251
|
-
br as i,
|
|
2252
|
-
yr as j,
|
|
2253
|
-
Xn as k,
|
|
2254
|
-
Gn as l,
|
|
2255
|
-
Sr as m,
|
|
2256
|
-
Xe as n,
|
|
2257
|
-
Or as o,
|
|
2258
|
-
_r as p,
|
|
2259
|
-
gr as t,
|
|
2260
|
-
qn as u
|
|
2261
|
-
};
|