react-semaphor 0.1.534 → 0.1.535

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/brand-studio/index.js +25 -25
  2. package/dist/briefings/index.js +1 -1
  3. package/dist/chunks/{calculated-field-identity-Cz1ZU_UL.js → calculated-field-identity-BptYhyOP.js} +4 -4
  4. package/dist/chunks/{card-config-utils-BlIiFn0O.js → card-config-utils-C-QfuqEy.js} +50 -51
  5. package/dist/chunks/{dashboard-CCK80YKL.js → dashboard-B7y_WeF2.js} +1 -1
  6. package/dist/chunks/dashboard-briefing-launcher-DwSxDtgZ.js +4224 -0
  7. package/dist/chunks/{dashboard-controls-CoiTGnEr.js → dashboard-controls-CzTh9J0s.js} +862 -873
  8. package/dist/chunks/{dashboard-json-BRGozO--.js → dashboard-json-o6tOjNhH.js} +1 -1
  9. package/dist/chunks/{edit-dashboard-visual-CZFnhGZQ.js → edit-dashboard-visual-Lp_iKRGH.js} +8983 -8749
  10. package/dist/chunks/{index-BQl5rC54.js → index-P5aUuGF1.js} +1 -1
  11. package/dist/chunks/{matrix-control-sources-Tls-h3AN.js → matrix-control-sources-DTqcA2_L.js} +1 -1
  12. package/dist/chunks/report-preferences-dialog-BaUr346O.js +1623 -0
  13. package/dist/chunks/{layout-grid-CiubineE.js → save-kO6cIaob.js} +20 -2
  14. package/dist/chunks/{semaphor-ready-indicator-z4SNdxiC.js → semaphor-ready-indicator-B017OW6t.js} +61957 -76531
  15. package/dist/chunks/slider-CrLoCpsr.js +2383 -0
  16. package/dist/chunks/{switch-BR3Xgbqr.js → switch-ojmMsFMO.js} +4355 -4779
  17. package/dist/chunks/upload-CAIpsti1.js +15 -0
  18. package/dist/chunks/use-create-flow-overlay-state-BbwQ0gpQ.js +1457 -0
  19. package/dist/dashboard/index.js +1 -1
  20. package/dist/dashboard-authoring/index.js +4 -4
  21. package/dist/index.js +221 -220
  22. package/dist/style.css +1 -1
  23. package/dist/surfboard/index.js +1 -1
  24. package/dist/types/components/surfboard/controls/dashboard-filter-controls-launcher.d.ts +0 -1
  25. package/dist/types/lib/hooks/use-dashboard-query.d.ts +0 -2
  26. package/dist/types/lib/hooks/use-dashboard.d.ts +0 -1
  27. package/dist/types/lib/stores/dashboard-store.d.ts +1 -11
  28. package/dist/types/lib/stores/editor-store.d.ts +1 -10
  29. package/dist/types/lib/types/ai-context-types.d.ts +20 -0
  30. package/dist/types/lib/types/common-types.d.ts +1 -20
  31. package/dist/types/lib/types/token-types.d.ts +0 -7
  32. package/dist/types/lib/utils.d.ts +0 -2
  33. package/package.json +1 -7
  34. package/dist/chunks/dashboard-briefing-launcher-B9Fq2Rf3.js +0 -3489
  35. package/dist/chunks/editor-action-buttons-CVtSO3I3.js +0 -2067
  36. package/dist/chunks/report-preferences-dialog-CWdTlWsr.js +0 -1231
  37. package/dist/chunks/save-DgMfP0j8.js +0 -21
  38. package/dist/chunks/slider-DbwmuVB-.js +0 -875
  39. package/dist/dashboard-assistant/index.js +0 -11
  40. package/dist/types/dashboard-assistant/index.d.ts +0 -80
  41. package/dist/types/dashboard-assistant.d.ts +0 -2
  42. package/dist/types/lib/types/assistant-types.d.ts +0 -127
@@ -1,1231 +0,0 @@
1
- import { jsxs as l, jsx as a, Fragment as B } from "react/jsx-runtime";
2
- import Pe, { useRef as W, useState as C, useCallback as I, useEffect as U, lazy as ie, Suspense as J, Activity as De, useMemo as q, useId as V } from "react";
3
- import { ay as Ae, az as Ie, aA as Re, aB as _e, aC as Fe, b as Le, E as ze, F as Ue, S as Oe, B as je, a as Ve, U as Me, D as We, C as Be, aD as Se, aE as $e, aF as ce, aG as Z, aH as He, f as Ge, g as Ke, h as Je, i as qe, j as de, k as ue, aI as Ze, aJ as oe, aK as Ye, aL as Xe, aM as Qe, aN as ea, aO as aa } from "./semaphor-ready-indicator-z4SNdxiC.js";
4
- import { u as A, a0 as ta, m as O, c as z, a4 as ra, a5 as la, P as na, a as sa, B as F, b as ia, d as me, L as xe, a6 as _, s as ae, t as te, v as re, w as le, x as L, T as oa, e as ca, f as fe, h as he } from "./switch-BR3Xgbqr.js";
5
- import { X as da } from "./x-CXDkqdur.js";
6
- import "./validators-DMSH81OM.js";
7
- import "./matrix-operation-contract-BKupLHXL.js";
8
- import "zod";
9
- import { parseValueFormatPreferencesResponse as ua, canonicalizeSupportedLocale as we, getSupportedCurrencyCodes as ma, canonicalizeSupportedCurrencyCode as fa } from "../value-format-preferences/index.js";
10
- import { a as ha } from "./report-runtime-context-CG_I0PPW.js";
11
- import { r as H, g as M } from "./raw-temporal-iMXRK-Qz.js";
12
- function va(e = []) {
13
- const r = W(null), t = W(null), s = W(null), [n, i] = C(), o = I(() => {
14
- var g, v, p;
15
- const m = ((g = r.current) == null ? void 0 : g.clientWidth) ?? 0, h = ((v = s.current) == null ? void 0 : v.offsetWidth) ?? 0, y = ((p = t.current) == null ? void 0 : p.offsetWidth) ?? 0, f = m - h - y - 8, S = Math.max(f, 0);
16
- i((k) => k === S ? k : S);
17
- }, []);
18
- return U(() => {
19
- const m = r.current;
20
- if (!m || typeof ResizeObserver > "u") return;
21
- const h = new ResizeObserver(() => o());
22
- return h.observe(m), o(), () => h.disconnect();
23
- }, [o, ...e]), {
24
- headerRef: r,
25
- leftActionsRef: t,
26
- rightActionsRef: s,
27
- titleMaxWidth: n,
28
- updateAvailableWidth: o
29
- };
30
- }
31
- function pa({ filter: e }) {
32
- var v;
33
- const r = A(
34
- (p) => p.isDashboardEditing
35
- ), { preferences: t } = Ae(), s = Ie((v = t == null ? void 0 : t.cardDisplay) == null ? void 0 : v.mode), n = A((p) => p.filterValues), i = n == null ? void 0 : n.some(
36
- (p) => p.filterId === e.id
37
- ), { removeFilterValues: o, removeFilter: m, updateFilter: h } = ta(), {
38
- headerRef: y,
39
- leftActionsRef: N,
40
- rightActionsRef: f,
41
- titleMaxWidth: S,
42
- updateAvailableWidth: g
43
- } = va([
44
- r,
45
- i,
46
- s
47
- ]);
48
- return U(() => {
49
- g();
50
- }, [e.title, g]), /* @__PURE__ */ l(
51
- "div",
52
- {
53
- ref: y,
54
- className: "group mb-1 flex h-5 items-center justify-between",
55
- children: [
56
- /* @__PURE__ */ l("div", { className: "flex grow items-center gap-2 min-w-0", children: [
57
- /* @__PURE__ */ a(
58
- "div",
59
- {
60
- className: "min-w-0 flex-1",
61
- style: S !== void 0 ? { maxWidth: S } : void 0,
62
- children: /* @__PURE__ */ a(O, { className: "my-1 block w-full text-sm", children: /* @__PURE__ */ a(
63
- Re,
64
- {
65
- value: e.title || e.column,
66
- onSave: (p) => h({ ...e, title: p }),
67
- isEditable: r,
68
- placeholder: "Filter",
69
- displayClassName: "text-sm truncate",
70
- inputClassName: "text-sm"
71
- }
72
- ) })
73
- }
74
- ),
75
- /* @__PURE__ */ l(
76
- "div",
77
- {
78
- className: "flex shrink-0 items-center gap-1.5",
79
- ref: N,
80
- children: [
81
- r && /* @__PURE__ */ a(_e, { filter: e, isEditing: r }),
82
- r && /* @__PURE__ */ a(
83
- "button",
84
- {
85
- onClick: () => {
86
- o(e.id), m(e.id);
87
- },
88
- className: "text-muted-foreground hover:text-foreground",
89
- children: /* @__PURE__ */ a(da, { className: "size-3.5" })
90
- }
91
- )
92
- ]
93
- }
94
- )
95
- ] }),
96
- /* @__PURE__ */ a("div", { className: "hidden", ref: f })
97
- ]
98
- }
99
- );
100
- }
101
- function ya() {
102
- const e = A((s) => s.dashboard.filters), r = A((s) => s.theme), t = e == null ? void 0 : e.filter((s) => s.hide);
103
- return t != null && t.length ? /* @__PURE__ */ a(
104
- "div",
105
- {
106
- className: z("mb-1 flex items-center gap-2 border-y px-0.5 pb-0.5", {
107
- "bg-[repeating-linear-gradient(45deg,_#ffffff_0_3px,_#f3f3f3_3px_6px)]": r === "light",
108
- "bg-[repeating-linear-gradient(45deg,_#18171d_0_3px,_#272729_3px_6px)]": r === "dark"
109
- }),
110
- children: t == null ? void 0 : t.map((s) => /* @__PURE__ */ l(
111
- "div",
112
- {
113
- className: "flex min-w-[250px] max-w-fit flex-col gap-1 p-2",
114
- children: [
115
- /* @__PURE__ */ a(pa, { filter: s }),
116
- /* @__PURE__ */ a(Fe, { filter: s })
117
- ]
118
- },
119
- s.id
120
- ))
121
- }
122
- ) : null;
123
- }
124
- function ga() {
125
- var i;
126
- const e = A((o) => o.dashboard), r = A((o) => o.selectedSheetId), t = A(
127
- (o) => o.isDashboardEditing
128
- ), s = (i = e.sheets) == null ? void 0 : i.find(
129
- (o) => o.id === r
130
- ), n = ra(s);
131
- return /* @__PURE__ */ a(
132
- "div",
133
- {
134
- role: "dashboard-plus-main",
135
- className: "flex min-h-0 grow basis-0 overflow-hidden",
136
- children: /* @__PURE__ */ l("section", { className: "flex min-h-0 grow basis-0 flex-col overflow-hidden", children: [
137
- t && !n && /* @__PURE__ */ a(ya, {}),
138
- /* @__PURE__ */ a(Le, {})
139
- ] })
140
- }
141
- );
142
- }
143
- const ba = ie(() => import("./dashboard-controls-CoiTGnEr.js")), Sa = ie(
144
- () => import("./edit-dashboard-visual-CZFnhGZQ.js")
145
- ), xa = ie(() => import("./dashboard-json-BRGozO--.js"));
146
- function Ga({
147
- showControls: e = !1,
148
- showFooter: r = !0,
149
- ...t
150
- }) {
151
- const s = A((m) => m.isVisualEditing), n = A(
152
- (m) => m.showDashboardJSON
153
- ), { appearance: i, preferences: o } = t;
154
- return /* @__PURE__ */ a(ze, { FallbackComponent: Ue, children: /* @__PURE__ */ a(Oe, { dashboardProps: t, children: /* @__PURE__ */ l(je, { children: [
155
- /* @__PURE__ */ a(Ve, { componentType: "surfboard", componentId: t.id }),
156
- /* @__PURE__ */ l(Me, { appearance: i, children: [
157
- /* @__PURE__ */ a(
158
- la,
159
- {
160
- toastOptions: {
161
- classNames: {
162
- 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]",
163
- content: "min-w-0 flex-1",
164
- icon: "mt-0.5 shrink-0",
165
- title: "max-w-full break-words pr-8",
166
- description: "max-w-full break-words",
167
- closeButton: "!top-2 h-6 w-6 rounded-md border-border bg-background text-muted-foreground hover:bg-muted hover:text-foreground"
168
- }
169
- }
170
- }
171
- ),
172
- /* @__PURE__ */ l(We, { preferences: o, children: [
173
- n && /* @__PURE__ */ a(J, { fallback: null, children: /* @__PURE__ */ a(xa, {}) }),
174
- /* @__PURE__ */ l("main", { className: "relative flex h-full w-full flex-col overflow-hidden", children: [
175
- e && /* @__PURE__ */ a(J, { fallback: null, children: /* @__PURE__ */ a(ba, {}) }),
176
- /* @__PURE__ */ a("div", { className: "flex grow overflow-hidden", children: /* @__PURE__ */ a("div", { className: "flex min-w-0 flex-1", children: /* @__PURE__ */ l(Be, { ...t, type: "dashboard", children: [
177
- s && /* @__PURE__ */ a(J, { fallback: null, children: /* @__PURE__ */ a(Sa, {}) }),
178
- /* @__PURE__ */ a(De, { mode: s ? "hidden" : "visible", children: /* @__PURE__ */ a(ga, {}) })
179
- ] }) }) })
180
- ] })
181
- ] })
182
- ] })
183
- ] }) }) });
184
- }
185
- function wa(e = {}) {
186
- const { authToken: r, tokenProps: t } = Se(), s = A(
187
- (T) => T.actions.applyResolvedCalendarPreferences
188
- ), n = e.enabled ?? !0, i = (r == null ? void 0 : r.accessToken) ?? null, o = (t == null ? void 0 : t.apiServiceUrl) ?? null, [m, h] = C(!1), [y, N] = C(!1), [f, S] = C(!1), [g, v] = C(null), [p, k] = C(null), x = W(i);
189
- x.current = i, U(() => {
190
- k(null), v(null), h(!1), N(!1), S(!1);
191
- }, [i]);
192
- const P = I(async (T) => {
193
- const c = ha(await T.json());
194
- if (!c.ok)
195
- throw new Error("Calendar preferences response is invalid");
196
- return c.value;
197
- }, []), E = I(async () => {
198
- if (!n || !i || !o) return;
199
- const T = i;
200
- h(!0), v(null);
201
- try {
202
- const c = await fetch(
203
- `${o}/v1/user-preferences/calendar`,
204
- {
205
- method: "GET",
206
- headers: { Authorization: `Bearer ${i}` }
207
- }
208
- );
209
- if (!c.ok) {
210
- const w = await c.json().catch(() => ({}));
211
- throw new Error(w.error || "Failed to fetch preferences");
212
- }
213
- const u = await P(c);
214
- x.current === T && k(u);
215
- } catch (c) {
216
- x.current === T && v(c instanceof Error ? c.message : "Unknown error");
217
- } finally {
218
- x.current === T && h(!1);
219
- }
220
- }, [i, o, n, P]);
221
- U(() => {
222
- n && E();
223
- }, [n, E]);
224
- const D = I(
225
- async (T) => {
226
- if (!i || !o)
227
- return v("Not authenticated"), !1;
228
- const c = i;
229
- N(!0), v(null);
230
- try {
231
- const u = await fetch(
232
- `${o}/v1/user-preferences/calendar`,
233
- {
234
- method: "PATCH",
235
- headers: {
236
- "Content-Type": "application/json",
237
- Authorization: `Bearer ${i}`
238
- },
239
- body: JSON.stringify(T)
240
- }
241
- );
242
- if (!u.ok) {
243
- const d = await u.json().catch(() => ({}));
244
- throw new Error(d.error || "Failed to update preferences");
245
- }
246
- const w = await P(u);
247
- return x.current !== c ? !1 : (k(w), s(w.resolved, w.sources), !0);
248
- } catch (u) {
249
- return x.current === c && v(u instanceof Error ? u.message : "Unknown error"), !1;
250
- } finally {
251
- x.current === c && N(!1);
252
- }
253
- },
254
- [
255
- i,
256
- o,
257
- s,
258
- P
259
- ]
260
- ), R = I(async () => {
261
- if (!i || !o)
262
- return v("Not authenticated"), !1;
263
- const T = i;
264
- S(!0), v(null);
265
- try {
266
- const c = await fetch(
267
- `${o}/v1/user-preferences/calendar`,
268
- {
269
- method: "DELETE",
270
- headers: { Authorization: `Bearer ${i}` }
271
- }
272
- );
273
- if (!c.ok) {
274
- const w = await c.json().catch(() => ({}));
275
- throw new Error(w.error || "Failed to clear preferences");
276
- }
277
- const u = await P(c);
278
- return x.current !== T ? !1 : (k(u), s(u.resolved, u.sources), !0);
279
- } catch (c) {
280
- return x.current === T && v(c instanceof Error ? c.message : "Unknown error"), !1;
281
- } finally {
282
- x.current === T && S(!1);
283
- }
284
- }, [
285
- i,
286
- o,
287
- s,
288
- P
289
- ]);
290
- return {
291
- preferences: p,
292
- isLoading: m,
293
- isSaving: y,
294
- isClearing: f,
295
- error: g,
296
- updatePreferences: D,
297
- clearPreferences: R,
298
- refetch: E
299
- };
300
- }
301
- const G = [
302
- { value: "America/New_York", label: "Eastern Time (US & Canada)" },
303
- { value: "America/Chicago", label: "Central Time (US & Canada)" },
304
- { value: "America/Denver", label: "Mountain Time (US & Canada)" },
305
- { value: "America/Los_Angeles", label: "Pacific Time (US & Canada)" },
306
- { value: "America/Phoenix", label: "Arizona" },
307
- { value: "America/Anchorage", label: "Alaska" },
308
- { value: "Pacific/Honolulu", label: "Hawaii" },
309
- { value: "Europe/London", label: "London" },
310
- { value: "Europe/Paris", label: "Paris, Berlin, Rome" },
311
- { value: "Asia/Tokyo", label: "Tokyo" },
312
- { value: "Asia/Shanghai", label: "Beijing, Shanghai" },
313
- { value: "Asia/Kolkata", label: "Mumbai, New Delhi" },
314
- { value: "Australia/Sydney", label: "Sydney" },
315
- { value: "UTC", label: "UTC" }
316
- ], Te = [
317
- { value: 0, label: "Sunday" },
318
- { value: 1, label: "Monday" },
319
- { value: 6, label: "Saturday" }
320
- ], ve = "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground";
321
- function Ta() {
322
- try {
323
- const e = Intl;
324
- if (e.supportedValuesOf)
325
- return e.supportedValuesOf("timeZone");
326
- } catch {
327
- }
328
- return G.map((e) => e.value);
329
- }
330
- function Na(e) {
331
- if (!e) return "default";
332
- if (e.tz !== e.weekStart) return "inherited";
333
- switch (e.tz) {
334
- case "viewer_tenant":
335
- return "tenant";
336
- case "viewer_organization":
337
- return "organization";
338
- case "system_default":
339
- return "system";
340
- case "session_initial":
341
- return "embedded";
342
- default:
343
- return "default";
344
- }
345
- }
346
- function pe(e) {
347
- const r = G.find((t) => t.value === e);
348
- return r ? r.label : e;
349
- }
350
- function Ca(e) {
351
- const r = Te.find((t) => t.value === e);
352
- return r ? r.label : String(e);
353
- }
354
- function ka({
355
- active: e,
356
- onClose: r
357
- }) {
358
- const {
359
- preferences: t,
360
- isLoading: s,
361
- isSaving: n,
362
- isClearing: i,
363
- updatePreferences: o,
364
- clearPreferences: m
365
- } = wa({ enabled: e }), h = $e(), y = (t == null ? void 0 : t.resolved.tz) || (h == null ? void 0 : h.tz) || "UTC", N = (t == null ? void 0 : t.resolved.weekStart) ?? (h == null ? void 0 : h.weekStart) ?? 1, [f, S] = C((t == null ? void 0 : t.stored) === null), [g, v] = C(!1), [p, k] = C(
366
- y
367
- ), [x, P] = C(
368
- N
369
- ), [E, D] = C(!1), R = q(() => Ta(), []), T = q(
370
- () => R.filter(
371
- (b) => !G.some((Ee) => Ee.value === b)
372
- ),
373
- [R]
374
- ), c = q(() => pe(p), [p]), u = t != null && t.inherited ? pe(t.inherited.tz) : "UTC", w = t != null && t.inherited ? Ca(t.inherited.weekStart) : "Monday", d = Na(
375
- t == null ? void 0 : t.inheritedSources
376
- );
377
- Pe.useEffect(() => {
378
- if (!e) {
379
- v(!1);
380
- return;
381
- }
382
- g || (t && S(t.stored === null), k(y), P(N));
383
- }, [
384
- e,
385
- g,
386
- t,
387
- y,
388
- N
389
- ]);
390
- const $ = async () => {
391
- if (s) {
392
- _.error("Preferences are still loading. Please try again.");
393
- return;
394
- }
395
- f ? await m() ? (_.success("Now using default settings."), r()) : _.error("Failed to save preferences. Please try again.") : await o({
396
- tz: p,
397
- weekStart: x
398
- }) ? (_.success("Preferences saved."), r()) : _.error("Failed to save preferences. Please try again.");
399
- }, j = () => {
400
- r();
401
- }, K = n || i, ke = K || s;
402
- return /* @__PURE__ */ l(B, { children: [
403
- /* @__PURE__ */ l("div", { className: "space-y-4 py-1", children: [
404
- /* @__PURE__ */ l(
405
- ce,
406
- {
407
- value: f ? "defaults" : "custom",
408
- onValueChange: (b) => {
409
- v(!0), S(b === "defaults");
410
- },
411
- className: "space-y-0.5",
412
- children: [
413
- /* @__PURE__ */ l(
414
- "label",
415
- {
416
- htmlFor: "mode-defaults",
417
- className: z(
418
- "flex cursor-pointer items-start gap-2 rounded-control px-2 py-1.5 hover:bg-muted/50",
419
- f && "bg-muted/50"
420
- ),
421
- onClick: () => {
422
- v(!0), S(!0);
423
- },
424
- children: [
425
- /* @__PURE__ */ a(
426
- Z,
427
- {
428
- value: "defaults",
429
- id: "mode-defaults",
430
- className: "mt-0.5"
431
- }
432
- ),
433
- /* @__PURE__ */ l("div", { className: "flex-1 min-w-0", children: [
434
- /* @__PURE__ */ l("p", { className: "text-[13px] font-medium text-foreground", children: [
435
- "Use ",
436
- d,
437
- " defaults"
438
- ] }),
439
- /* @__PURE__ */ l("p", { className: "text-[12px] text-muted-foreground", children: [
440
- u,
441
- ", week starts ",
442
- w
443
- ] })
444
- ] })
445
- ]
446
- }
447
- ),
448
- /* @__PURE__ */ l(
449
- "label",
450
- {
451
- htmlFor: "mode-custom",
452
- className: z(
453
- "flex cursor-pointer items-start gap-2 rounded-control px-2 py-1.5 hover:bg-muted/50",
454
- !f && "bg-muted/50"
455
- ),
456
- onClick: () => {
457
- v(!0), S(!1);
458
- },
459
- children: [
460
- /* @__PURE__ */ a(
461
- Z,
462
- {
463
- value: "custom",
464
- id: "mode-custom",
465
- className: "mt-0.5"
466
- }
467
- ),
468
- /* @__PURE__ */ a("p", { className: "flex-1 text-[13px] font-medium text-foreground", children: "Use custom settings" })
469
- ]
470
- }
471
- )
472
- ]
473
- }
474
- ),
475
- /* @__PURE__ */ l(
476
- "div",
477
- {
478
- className: z(
479
- "space-y-4 border-t border-border/60 pt-4 transition-opacity",
480
- f && "pointer-events-none opacity-50"
481
- ),
482
- children: [
483
- /* @__PURE__ */ l("div", { className: "space-y-1.5", children: [
484
- /* @__PURE__ */ a(O, { className: ve, children: "Timezone" }),
485
- /* @__PURE__ */ l(
486
- na,
487
- {
488
- open: E,
489
- onOpenChange: D,
490
- modal: !0,
491
- children: [
492
- /* @__PURE__ */ a(sa, { asChild: !0, children: /* @__PURE__ */ l(
493
- F,
494
- {
495
- variant: "outline",
496
- size: "xs",
497
- role: "combobox",
498
- "aria-expanded": E,
499
- className: "w-full justify-between text-[12px] font-normal",
500
- disabled: f,
501
- children: [
502
- /* @__PURE__ */ a("span", { className: "truncate", children: c }),
503
- /* @__PURE__ */ a(He, { className: "ml-2 h-3.5 w-3.5 shrink-0 opacity-50" })
504
- ]
505
- }
506
- ) }),
507
- /* @__PURE__ */ a(
508
- ia,
509
- {
510
- className: "z-50 w-[--radix-popover-trigger-width] p-0",
511
- align: "start",
512
- children: /* @__PURE__ */ l(Ge, { className: "overflow-visible", children: [
513
- /* @__PURE__ */ a(Ke, { placeholder: "Search timezones…" }),
514
- /* @__PURE__ */ l(Je, { children: [
515
- /* @__PURE__ */ a(qe, { children: "No timezone found." }),
516
- /* @__PURE__ */ a(de, { heading: "Common", children: G.map((b) => /* @__PURE__ */ l(
517
- ue,
518
- {
519
- value: `${b.value} ${b.label}`,
520
- onSelect: () => {
521
- v(!0), k(b.value), D(!1);
522
- },
523
- children: [
524
- /* @__PURE__ */ a(
525
- me,
526
- {
527
- className: z(
528
- "h-3.5 w-3.5",
529
- p === b.value ? "opacity-100" : "opacity-0"
530
- )
531
- }
532
- ),
533
- /* @__PURE__ */ a("span", { className: "flex-1", children: b.label }),
534
- /* @__PURE__ */ a("span", { className: "text-[11px] text-muted-foreground", children: b.value })
535
- ]
536
- },
537
- b.value
538
- )) }),
539
- /* @__PURE__ */ a(Ze, {}),
540
- /* @__PURE__ */ a(de, { heading: "All timezones", children: T.map((b) => /* @__PURE__ */ l(
541
- ue,
542
- {
543
- value: b,
544
- onSelect: () => {
545
- v(!0), k(b), D(!1);
546
- },
547
- children: [
548
- /* @__PURE__ */ a(
549
- me,
550
- {
551
- className: z(
552
- "h-3.5 w-3.5",
553
- p === b ? "opacity-100" : "opacity-0"
554
- )
555
- }
556
- ),
557
- b
558
- ]
559
- },
560
- b
561
- )) })
562
- ] })
563
- ] })
564
- }
565
- )
566
- ]
567
- }
568
- )
569
- ] }),
570
- /* @__PURE__ */ l("div", { className: "space-y-1.5", children: [
571
- /* @__PURE__ */ a(O, { className: ve, children: "Week starts on" }),
572
- /* @__PURE__ */ a(
573
- ce,
574
- {
575
- value: String(x),
576
- onValueChange: (b) => {
577
- v(!0), P(Number(b));
578
- },
579
- className: "flex gap-4",
580
- disabled: f,
581
- children: Te.map((b) => /* @__PURE__ */ l(
582
- "label",
583
- {
584
- htmlFor: `week-start-${b.value}`,
585
- className: z(
586
- "flex cursor-pointer items-center gap-2 text-[13px]",
587
- f && "cursor-not-allowed"
588
- ),
589
- children: [
590
- /* @__PURE__ */ a(
591
- Z,
592
- {
593
- value: String(b.value),
594
- id: `week-start-${b.value}`,
595
- disabled: f
596
- }
597
- ),
598
- b.label
599
- ]
600
- },
601
- b.value
602
- ))
603
- }
604
- )
605
- ] })
606
- ]
607
- }
608
- )
609
- ] }),
610
- /* @__PURE__ */ l(oe, { children: [
611
- /* @__PURE__ */ a(
612
- F,
613
- {
614
- variant: "outline",
615
- size: "xs",
616
- onClick: j,
617
- disabled: K,
618
- children: "Cancel"
619
- }
620
- ),
621
- /* @__PURE__ */ a(F, { size: "xs", onClick: $, disabled: ke, children: K ? /* @__PURE__ */ l(B, { children: [
622
- /* @__PURE__ */ a(xe, { className: "h-3.5 w-3.5 animate-spin" }),
623
- "Saving…"
624
- ] }) : "Save" })
625
- ] })
626
- ] });
627
- }
628
- function Ea(e = {}) {
629
- const { authToken: r, tokenProps: t } = Se(), s = A(
630
- (c) => c.actions.applyResolvedValueFormatPreferences
631
- ), n = e.enabled ?? !0, i = (r == null ? void 0 : r.accessToken) ?? null, o = (t == null ? void 0 : t.apiServiceUrl) ?? null, m = W(i);
632
- m.current = i;
633
- const [h, y] = C(null), [N, f] = C(!1), [S, g] = C(!1), [v, p] = C(!1), [k, x] = C(null);
634
- U(() => {
635
- y(null), x(null), f(!1), g(!1), p(!1);
636
- }, [i]);
637
- const P = I(async (c) => {
638
- const u = ua(await c.json());
639
- if (!u.ok)
640
- throw new Error("Value format preferences response is invalid");
641
- return u.value;
642
- }, []), E = I(
643
- async (c, u) => {
644
- if (!i || !o)
645
- throw new Error("Not authenticated");
646
- const w = await fetch(
647
- `${o}/v1/user-preferences/value-format`,
648
- {
649
- method: c,
650
- headers: {
651
- Authorization: `Bearer ${i}`,
652
- ...u ? { "Content-Type": "application/json" } : {}
653
- },
654
- body: u ? JSON.stringify(u) : void 0
655
- }
656
- );
657
- if (!w.ok) {
658
- const d = await w.json().catch(() => ({}));
659
- throw new Error(d.error || "Failed to update preferences");
660
- }
661
- return P(w);
662
- },
663
- [i, o, P]
664
- ), D = I(async () => {
665
- if (!n || !i || !o) return;
666
- const c = i;
667
- f(!0), x(null);
668
- try {
669
- const u = await E("GET");
670
- m.current === c && y(u);
671
- } catch (u) {
672
- m.current === c && x(u instanceof Error ? u.message : "Unknown error");
673
- } finally {
674
- m.current === c && f(!1);
675
- }
676
- }, [i, o, n, E]);
677
- U(() => {
678
- n && D();
679
- }, [n, D]);
680
- const R = I(
681
- async (c) => {
682
- const u = i;
683
- g(!0), x(null);
684
- try {
685
- const w = await E("PATCH", c);
686
- return m.current !== u ? !1 : (y(w), s(w.resolved, w.sources), !0);
687
- } catch (w) {
688
- return m.current === u && x(w instanceof Error ? w.message : "Unknown error"), !1;
689
- } finally {
690
- m.current === u && g(!1);
691
- }
692
- },
693
- [i, s, E]
694
- ), T = I(async () => {
695
- const c = i;
696
- p(!0), x(null);
697
- try {
698
- const u = await E("DELETE");
699
- return m.current !== c ? !1 : (y(u), s(u.resolved, u.sources), !0);
700
- } catch (u) {
701
- return m.current === c && x(u instanceof Error ? u.message : "Unknown error"), !1;
702
- } finally {
703
- m.current === c && p(!1);
704
- }
705
- }, [i, s, E]);
706
- return {
707
- preferences: h,
708
- isLoading: N,
709
- isSaving: S,
710
- isClearing: v,
711
- error: k,
712
- updatePreferences: R,
713
- clearPreferences: T,
714
- refetch: D
715
- };
716
- }
717
- const ne = [
718
- { value: "en-US", label: "English (United States)" },
719
- { value: "en-GB", label: "English (United Kingdom)" },
720
- { value: "de-DE", label: "German (Germany)" },
721
- { value: "fr-FR", label: "French (France)" },
722
- { value: "es-ES", label: "Spanish (Spain)" },
723
- { value: "it-IT", label: "Italian (Italy)" },
724
- { value: "nl-NL", label: "Dutch (Netherlands)" },
725
- { value: "pt-BR", label: "Portuguese (Brazil)" },
726
- { value: "ja-JP", label: "Japanese (Japan)" },
727
- { value: "en-IN", label: "English (India)" },
728
- { value: "en-NZ", label: "English (New Zealand)" },
729
- { value: "mi-NZ", label: "Māori (New Zealand)" }
730
- ], Ne = /* @__PURE__ */ new Set([
731
- "USD",
732
- "EUR",
733
- "GBP",
734
- "CAD",
735
- "AUD",
736
- "JPY",
737
- "CHF",
738
- "INR",
739
- "BRL",
740
- "KWD"
741
- ]), Pa = ma(), Da = Pa.filter(
742
- (e) => !Ne.has(e)
743
- ), Ce = [
744
- { value: "short", label: "Short" },
745
- { value: "medium", label: "Medium" },
746
- { value: "long", label: "Long" }
747
- ], ye = "2026-07-31", Y = "2026-07-31T14:30:45";
748
- function se(e) {
749
- switch (e) {
750
- case "viewer_user":
751
- return "user";
752
- case "viewer_tenant_user":
753
- return "tenant user";
754
- case "viewer_tenant":
755
- return "tenant";
756
- case "viewer_organization":
757
- return "organization";
758
- case "session_initial":
759
- return "embedded session";
760
- case "system_default":
761
- return "system";
762
- default:
763
- return "another preference level";
764
- }
765
- }
766
- function X(e) {
767
- var r;
768
- return ((r = Ce.find((t) => t.value === e)) == null ? void 0 : r.label) ?? e;
769
- }
770
- function Aa(e) {
771
- const r = ne.find((t) => t.value === e);
772
- return r ? `${r.label} — ${r.value}` : e;
773
- }
774
- function Q(e) {
775
- return {
776
- short: e("short"),
777
- medium: e("medium"),
778
- long: e("long")
779
- };
780
- }
781
- function ee({
782
- id: e,
783
- label: r,
784
- value: t,
785
- inherited: s,
786
- inheritedSource: n,
787
- examples: i,
788
- disabled: o,
789
- onValueChange: m
790
- }) {
791
- const h = t === void 0 ? `Inherited · ${X(s)}` : X(t);
792
- return /* @__PURE__ */ l("div", { className: "space-y-1.5", children: [
793
- /* @__PURE__ */ a(O, { htmlFor: e, className: "text-[11px] text-muted-foreground", children: r }),
794
- /* @__PURE__ */ l(
795
- ae,
796
- {
797
- value: t ?? "inherit",
798
- disabled: o,
799
- onValueChange: m,
800
- children: [
801
- /* @__PURE__ */ a(te, { id: e, size: "xs", children: /* @__PURE__ */ a(re, { children: h }) }),
802
- /* @__PURE__ */ l(le, { children: [
803
- /* @__PURE__ */ a(L, { value: "inherit", className: "[&>span:last-child]:w-full", children: /* @__PURE__ */ l("span", { className: "flex w-full min-w-0 items-center justify-between gap-4", children: [
804
- /* @__PURE__ */ l("span", { children: [
805
- "Inherited from ",
806
- se(n),
807
- " ·",
808
- " ",
809
- X(s)
810
- ] }),
811
- /* @__PURE__ */ a("span", { className: "shrink-0 tabular-nums text-muted-foreground", children: i[s] })
812
- ] }) }),
813
- Ce.map((y) => /* @__PURE__ */ a(
814
- L,
815
- {
816
- value: y.value,
817
- className: "[&>span:last-child]:w-full",
818
- children: /* @__PURE__ */ l("span", { className: "flex w-full min-w-0 items-center justify-between gap-4", children: [
819
- /* @__PURE__ */ a("span", { children: y.label }),
820
- /* @__PURE__ */ a("span", { className: "shrink-0 tabular-nums text-muted-foreground", children: i[y.value] })
821
- ] })
822
- },
823
- y.value
824
- ))
825
- ] })
826
- ]
827
- }
828
- )
829
- ] });
830
- }
831
- function Ia({
832
- value: e,
833
- inherited: r,
834
- inheritedSources: t,
835
- onChange: s,
836
- disabled: n
837
- }) {
838
- var T, c, u, w;
839
- const i = V(), o = V(), m = V(), h = V(), y = V(), f = (e.locale === void 0 ? void 0 : we(e.locale)) ?? r.locale, S = e.defaultCurrency ?? r.defaultCurrency, g = {
840
- locale: f,
841
- dateStyle: e.dateStyle ?? r.dateStyle,
842
- dateTime: {
843
- dateStyle: ((T = e.dateTime) == null ? void 0 : T.dateStyle) ?? r.dateTime.dateStyle,
844
- timeStyle: ((c = e.dateTime) == null ? void 0 : c.timeStyle) ?? r.dateTime.timeStyle
845
- },
846
- defaultCurrency: S
847
- }, v = new Intl.NumberFormat(f, {
848
- style: "currency",
849
- currency: S
850
- }).format(1e3), p = H({
851
- preferences: g,
852
- calendar: { tz: "UTC" }
853
- }), k = M({
854
- value: ye,
855
- metadata: { kind: "raw_temporal", valueKind: "date" },
856
- format: p
857
- }).text, x = M({
858
- value: Y,
859
- metadata: { kind: "raw_temporal", valueKind: "wall_datetime" },
860
- format: p
861
- }).text, P = Q(
862
- (d) => M({
863
- value: ye,
864
- metadata: { kind: "raw_temporal", valueKind: "date" },
865
- format: H({
866
- preferences: { ...g, dateStyle: d },
867
- calendar: { tz: "UTC" }
868
- })
869
- }).text
870
- ), E = Q(
871
- (d) => M({
872
- value: Y,
873
- metadata: { kind: "raw_temporal", valueKind: "wall_datetime" },
874
- format: H({
875
- preferences: {
876
- ...g,
877
- dateTime: { ...g.dateTime, dateStyle: d }
878
- },
879
- calendar: { tz: "UTC" }
880
- })
881
- }).text
882
- ), D = Q(
883
- (d) => M({
884
- value: Y,
885
- metadata: { kind: "raw_temporal", valueKind: "wall_datetime" },
886
- format: H({
887
- preferences: {
888
- ...g,
889
- dateTime: { ...g.dateTime, timeStyle: d }
890
- },
891
- calendar: { tz: "UTC" }
892
- })
893
- }).text
894
- ), R = (d, $) => {
895
- const j = {
896
- ...e.dateTime,
897
- [d]: $ === "inherit" ? void 0 : $
898
- };
899
- s({
900
- ...e,
901
- dateTime: j.dateStyle === void 0 && j.timeStyle === void 0 ? void 0 : j
902
- });
903
- };
904
- return /* @__PURE__ */ l("div", { className: "space-y-4", children: [
905
- /* @__PURE__ */ l("div", { className: "space-y-1.5", children: [
906
- /* @__PURE__ */ a(
907
- O,
908
- {
909
- htmlFor: i,
910
- className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",
911
- children: "Locale"
912
- }
913
- ),
914
- /* @__PURE__ */ l(
915
- ae,
916
- {
917
- value: e.locale ?? "inherit",
918
- disabled: n,
919
- onValueChange: (d) => s({
920
- ...e,
921
- locale: d === "inherit" ? void 0 : d
922
- }),
923
- children: [
924
- /* @__PURE__ */ a(te, { id: i, size: "xs", children: /* @__PURE__ */ a(re, { children: e.locale === void 0 ? `Inherited · ${r.locale}` : Aa(e.locale) }) }),
925
- /* @__PURE__ */ l(le, { children: [
926
- /* @__PURE__ */ l(L, { value: "inherit", children: [
927
- "Inherited from ",
928
- se(t.locale),
929
- " ·",
930
- " ",
931
- r.locale
932
- ] }),
933
- e.locale && !ne.some(
934
- (d) => d.value === e.locale
935
- ) && /* @__PURE__ */ a(L, { value: e.locale, children: e.locale }),
936
- ne.map((d) => /* @__PURE__ */ l(L, { value: d.value, children: [
937
- d.label,
938
- " — ",
939
- d.value
940
- ] }, d.value))
941
- ] })
942
- ]
943
- }
944
- )
945
- ] }),
946
- /* @__PURE__ */ l("fieldset", { className: "space-y-2", children: [
947
- /* @__PURE__ */ a("legend", { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Date values" }),
948
- /* @__PURE__ */ a(
949
- ee,
950
- {
951
- id: m,
952
- label: "Format",
953
- value: e.dateStyle,
954
- inherited: r.dateStyle,
955
- inheritedSource: t.dateStyle,
956
- examples: P,
957
- disabled: n,
958
- onValueChange: (d) => s({
959
- ...e,
960
- dateStyle: d === "inherit" ? void 0 : d
961
- })
962
- }
963
- )
964
- ] }),
965
- /* @__PURE__ */ l("fieldset", { className: "space-y-2", children: [
966
- /* @__PURE__ */ a("legend", { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Date & time values" }),
967
- /* @__PURE__ */ a(
968
- ee,
969
- {
970
- id: h,
971
- label: "Date",
972
- value: (u = e.dateTime) == null ? void 0 : u.dateStyle,
973
- inherited: r.dateTime.dateStyle,
974
- inheritedSource: t.dateTime.dateStyle,
975
- examples: E,
976
- disabled: n,
977
- onValueChange: (d) => R("dateStyle", d)
978
- }
979
- ),
980
- /* @__PURE__ */ a(
981
- ee,
982
- {
983
- id: y,
984
- label: "Time",
985
- value: (w = e.dateTime) == null ? void 0 : w.timeStyle,
986
- inherited: r.dateTime.timeStyle,
987
- inheritedSource: t.dateTime.timeStyle,
988
- examples: D,
989
- disabled: n,
990
- onValueChange: (d) => R("timeStyle", d)
991
- }
992
- )
993
- ] }),
994
- /* @__PURE__ */ l("div", { className: "space-y-1.5", children: [
995
- /* @__PURE__ */ a(
996
- O,
997
- {
998
- htmlFor: o,
999
- className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",
1000
- children: "Default currency"
1001
- }
1002
- ),
1003
- /* @__PURE__ */ l(
1004
- ae,
1005
- {
1006
- value: e.defaultCurrency ?? "inherit",
1007
- disabled: n,
1008
- onValueChange: (d) => s({
1009
- ...e,
1010
- defaultCurrency: d === "inherit" ? void 0 : d
1011
- }),
1012
- children: [
1013
- /* @__PURE__ */ a(te, { id: o, size: "xs", children: /* @__PURE__ */ a(re, { children: e.defaultCurrency === void 0 ? `Inherited · ${r.defaultCurrency}` : e.defaultCurrency }) }),
1014
- /* @__PURE__ */ l(le, { children: [
1015
- /* @__PURE__ */ l(L, { value: "inherit", children: [
1016
- "Inherited from ",
1017
- se(t.defaultCurrency),
1018
- " ·",
1019
- " ",
1020
- r.defaultCurrency
1021
- ] }),
1022
- [...Ne].map((d) => /* @__PURE__ */ a(L, { value: d, children: d }, d)),
1023
- Da.map((d) => /* @__PURE__ */ a(L, { value: d, children: d }, d))
1024
- ] })
1025
- ]
1026
- }
1027
- )
1028
- ] }),
1029
- /* @__PURE__ */ l("div", { className: "rounded-control border border-border/60 bg-muted/30 px-3 py-2", children: [
1030
- /* @__PURE__ */ a("p", { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Preview" }),
1031
- /* @__PURE__ */ l("dl", { className: "mt-1.5 space-y-1 text-[12px]", children: [
1032
- /* @__PURE__ */ l("div", { className: "flex items-baseline justify-between gap-4", children: [
1033
- /* @__PURE__ */ a("dt", { className: "text-muted-foreground", children: "Date" }),
1034
- /* @__PURE__ */ a("dd", { className: "text-right font-medium text-foreground", children: k })
1035
- ] }),
1036
- /* @__PURE__ */ l("div", { className: "flex items-baseline justify-between gap-4", children: [
1037
- /* @__PURE__ */ a("dt", { className: "text-muted-foreground", children: "Date & time" }),
1038
- /* @__PURE__ */ a("dd", { className: "text-right font-medium text-foreground", children: x })
1039
- ] }),
1040
- /* @__PURE__ */ l("div", { className: "flex items-baseline justify-between gap-4", children: [
1041
- /* @__PURE__ */ a("dt", { className: "text-muted-foreground", children: "Currency" }),
1042
- /* @__PURE__ */ a("dd", { className: "text-right font-medium text-foreground", children: v })
1043
- ] })
1044
- ] })
1045
- ] }),
1046
- /* @__PURE__ */ a("p", { className: "text-[11px] text-muted-foreground", children: "Currency values are not converted. Date examples use a fixed reference value and the Gregorian calendar." })
1047
- ] });
1048
- }
1049
- const ge = [
1050
- "locale",
1051
- "dateStyle",
1052
- "dateTime.dateStyle",
1053
- "dateTime.timeStyle",
1054
- "defaultCurrency"
1055
- ];
1056
- function be(e, r) {
1057
- var t, s;
1058
- switch (r) {
1059
- case "locale":
1060
- return e == null ? void 0 : e.locale;
1061
- case "dateStyle":
1062
- return e == null ? void 0 : e.dateStyle;
1063
- case "dateTime.dateStyle":
1064
- return (t = e == null ? void 0 : e.dateTime) == null ? void 0 : t.dateStyle;
1065
- case "dateTime.timeStyle":
1066
- return (s = e == null ? void 0 : e.dateTime) == null ? void 0 : s.timeStyle;
1067
- case "defaultCurrency":
1068
- return e == null ? void 0 : e.defaultCurrency;
1069
- }
1070
- }
1071
- function Ra(e) {
1072
- var s, n;
1073
- const r = (s = e == null ? void 0 : e.dateTime) == null ? void 0 : s.dateStyle, t = (n = e == null ? void 0 : e.dateTime) == null ? void 0 : n.timeStyle;
1074
- return {
1075
- locale: e == null ? void 0 : e.locale,
1076
- dateStyle: e == null ? void 0 : e.dateStyle,
1077
- dateTime: r === void 0 && t === void 0 ? void 0 : { dateStyle: r, timeStyle: t },
1078
- defaultCurrency: e == null ? void 0 : e.defaultCurrency
1079
- };
1080
- }
1081
- function _a({
1082
- active: e,
1083
- onClose: r
1084
- }) {
1085
- var m, h, y, N, f, S, g;
1086
- const { preferences: t, isLoading: s, isSaving: n, updatePreferences: i } = Ea({ enabled: e });
1087
- if (!e) return null;
1088
- if (!t)
1089
- return /* @__PURE__ */ l(B, { children: [
1090
- /* @__PURE__ */ a("div", { className: "py-2", children: /* @__PURE__ */ a("div", { className: "flex min-h-36 items-center justify-center text-[12px] text-muted-foreground", children: s ? "Loading preferences…" : "Preferences unavailable." }) }),
1091
- /* @__PURE__ */ l(oe, { className: "justify-between sm:justify-between", children: [
1092
- /* @__PURE__ */ a(F, { variant: "ghost", size: "xs", disabled: !0, children: "Reset display formats" }),
1093
- /* @__PURE__ */ l("div", { className: "flex gap-2", children: [
1094
- /* @__PURE__ */ a(F, { variant: "outline", size: "xs", onClick: r, children: "Cancel" }),
1095
- /* @__PURE__ */ a(F, { size: "xs", disabled: !0, children: "Save" })
1096
- ] })
1097
- ] })
1098
- ] });
1099
- const o = [
1100
- ((m = t.stored) == null ? void 0 : m.locale) ?? "",
1101
- ((h = t.stored) == null ? void 0 : h.dateStyle) ?? "",
1102
- ((N = (y = t.stored) == null ? void 0 : y.dateTime) == null ? void 0 : N.dateStyle) ?? "",
1103
- ((S = (f = t.stored) == null ? void 0 : f.dateTime) == null ? void 0 : S.timeStyle) ?? "",
1104
- ((g = t.stored) == null ? void 0 : g.defaultCurrency) ?? ""
1105
- ].join(":");
1106
- return /* @__PURE__ */ a(
1107
- Fa,
1108
- {
1109
- preferences: t,
1110
- isSaving: n,
1111
- updatePreferences: i,
1112
- onClose: r
1113
- },
1114
- o
1115
- );
1116
- }
1117
- function Fa({
1118
- preferences: e,
1119
- isSaving: r,
1120
- updatePreferences: t,
1121
- onClose: s
1122
- }) {
1123
- var y, N;
1124
- const [n, i] = C(
1125
- () => Ra(e.stored)
1126
- ), o = (n.locale === void 0 || we(n.locale) !== void 0) && (n.defaultCurrency === void 0 || fa(n.defaultCurrency) !== void 0) && (n.dateStyle === void 0 || ["short", "medium", "long"].includes(n.dateStyle)) && (((y = n.dateTime) == null ? void 0 : y.dateStyle) === void 0 || ["short", "medium", "long"].includes(n.dateTime.dateStyle)) && (((N = n.dateTime) == null ? void 0 : N.timeStyle) === void 0 || ["short", "medium", "long"].includes(n.dateTime.timeStyle)), m = async () => {
1127
- const f = {
1128
- ...n.locale !== void 0 ? { locale: n.locale } : {},
1129
- ...n.dateStyle !== void 0 ? { dateStyle: n.dateStyle } : {},
1130
- ...n.dateTime ? { dateTime: { ...n.dateTime } } : {},
1131
- ...n.defaultCurrency !== void 0 ? { defaultCurrency: n.defaultCurrency } : {}
1132
- }, S = ge.filter(
1133
- (p) => be(n, p) === void 0 && be(e.stored, p) !== void 0
1134
- ), g = {
1135
- ...Object.keys(f).length > 0 ? { set: f } : {},
1136
- ...S.length > 0 ? { clear: S } : {}
1137
- };
1138
- (Object.keys(g).length === 0 ? !0 : await t(g)) ? (_.success("Display format preferences saved."), s()) : _.error("Failed to save preferences. Please try again.");
1139
- }, h = async () => {
1140
- await t({
1141
- clear: [...ge]
1142
- }) ? (_.success("Display format preferences reset."), s()) : _.error(
1143
- "Failed to reset display format preferences. Please try again."
1144
- );
1145
- };
1146
- return /* @__PURE__ */ l(B, { children: [
1147
- /* @__PURE__ */ a("div", { className: "py-2", children: /* @__PURE__ */ a(
1148
- Ia,
1149
- {
1150
- value: n,
1151
- inherited: e.inherited,
1152
- inheritedSources: e.inheritedSources,
1153
- onChange: i,
1154
- disabled: r
1155
- }
1156
- ) }),
1157
- /* @__PURE__ */ l(oe, { className: "justify-between sm:justify-between", children: [
1158
- /* @__PURE__ */ a(
1159
- F,
1160
- {
1161
- variant: "ghost",
1162
- size: "xs",
1163
- onClick: h,
1164
- disabled: r || e.stored === null,
1165
- children: "Reset display formats"
1166
- }
1167
- ),
1168
- /* @__PURE__ */ l("div", { className: "flex gap-2", children: [
1169
- /* @__PURE__ */ a(
1170
- F,
1171
- {
1172
- variant: "outline",
1173
- size: "xs",
1174
- onClick: s,
1175
- disabled: r,
1176
- children: "Cancel"
1177
- }
1178
- ),
1179
- /* @__PURE__ */ a(
1180
- F,
1181
- {
1182
- size: "xs",
1183
- onClick: m,
1184
- disabled: r || !o,
1185
- children: r ? /* @__PURE__ */ l(B, { children: [
1186
- /* @__PURE__ */ a(xe, { className: "h-3.5 w-3.5 animate-spin" }),
1187
- "Saving…"
1188
- ] }) : "Save"
1189
- }
1190
- )
1191
- ] })
1192
- ] })
1193
- ] });
1194
- }
1195
- function Ka({
1196
- open: e,
1197
- onOpenChange: r
1198
- }) {
1199
- const [t, s] = C("display"), n = () => r(!1);
1200
- return /* @__PURE__ */ a(Ye, { open: e, onOpenChange: r, children: /* @__PURE__ */ l(Xe, { className: "rounded-control border-border/60 sm:max-w-[440px] sm:rounded-control", children: [
1201
- /* @__PURE__ */ l(Qe, { children: [
1202
- /* @__PURE__ */ a(ea, { className: "text-[15px]", children: "Report preferences" }),
1203
- /* @__PURE__ */ a(aa, { className: "text-[13px] leading-5", children: "Set how values and Calendar periods appear for you." })
1204
- ] }),
1205
- /* @__PURE__ */ l(oa, { value: t, onValueChange: s, children: [
1206
- /* @__PURE__ */ l(ca, { variant: "underline", className: "w-full justify-start", children: [
1207
- /* @__PURE__ */ a(fe, { value: "display", children: "Display formats" }),
1208
- /* @__PURE__ */ a(fe, { value: "calendar", children: "Calendar" })
1209
- ] }),
1210
- /* @__PURE__ */ a(he, { value: "display", children: /* @__PURE__ */ a(
1211
- _a,
1212
- {
1213
- active: e && t === "display",
1214
- onClose: n
1215
- }
1216
- ) }),
1217
- /* @__PURE__ */ a(he, { value: "calendar", children: /* @__PURE__ */ a(
1218
- ka,
1219
- {
1220
- active: e && t === "calendar",
1221
- onClose: n
1222
- }
1223
- ) })
1224
- ] })
1225
- ] }) });
1226
- }
1227
- export {
1228
- Ga as D,
1229
- Ka as R,
1230
- Ia as a
1231
- };