react-semaphor 0.1.208 → 0.1.209

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 (36) hide show
  1. package/dist/chunks/{dashboard-controls-yOzrvYwI.js → dashboard-controls-BNTI4r0_.js} +30 -30
  2. package/dist/chunks/{dashboard-controls-K5zNLdtH.js → dashboard-controls-Dcpx9_an.js} +1 -1
  3. package/dist/chunks/{dashboard-json-DqChvVCF.js → dashboard-json-BjOqpGbW.js} +1 -1
  4. package/dist/chunks/{dashboard-json-BuLoVNV4.js → dashboard-json-kIoBtmBF.js} +1 -1
  5. package/dist/chunks/{dashboard-summary-settings-dialog-tJueBNph.js → dashboard-summary-settings-dialog-BoX18wiA.js} +1 -1
  6. package/dist/chunks/{dashboard-summary-settings-dialog-DmccX33N.js → dashboard-summary-settings-dialog-CO1SwHHD.js} +1 -1
  7. package/dist/chunks/{edit-dashboard-visual-CKNlwaCO.js → edit-dashboard-visual-B9HuGExj.js} +1 -1
  8. package/dist/chunks/{edit-dashboard-visual-CV4JsCTg.js → edit-dashboard-visual-DG4VLoJF.js} +2 -2
  9. package/dist/chunks/editor-action-buttons-CDTIx_Jc.js +11 -0
  10. package/dist/chunks/editor-action-buttons-CszdZ4Fw.js +345 -0
  11. package/dist/chunks/{index-CBcPi9pm.js → index-D0TdW88i.js} +24289 -23875
  12. package/dist/chunks/index-DSA80lEg.js +1104 -0
  13. package/dist/chunks/{notification-bell-DyzIftQU.js → notification-bell-D2V1-ARa.js} +1 -1
  14. package/dist/chunks/{notification-bell-B-OVf20Q.js → notification-bell-DFiRaeJQ.js} +52 -52
  15. package/dist/chunks/resource-management-panel-BhiWNPcw.js +6 -0
  16. package/dist/chunks/resource-management-panel-DS_WEv1x.js +902 -0
  17. package/dist/chunks/{use-role-aware-display-preferences-B4QJkliF.js → use-role-aware-display-preferences-D8j5_cnK.js} +1 -1
  18. package/dist/chunks/{use-role-aware-display-preferences-DTSpe_ZT.js → use-role-aware-display-preferences-DfihB5pN.js} +1 -1
  19. package/dist/chunks/{use-visual-utils-CCT3ABI5.js → use-visual-utils-BfLXO_vi.js} +34 -34
  20. package/dist/chunks/{use-visual-utils-ChR-Jti8.js → use-visual-utils-CzcVz3zB.js} +1 -1
  21. package/dist/dashboard/index.cjs +1 -1
  22. package/dist/dashboard/index.js +1 -1
  23. package/dist/index.cjs +1 -1
  24. package/dist/index.js +5 -5
  25. package/dist/surfboard/index.cjs +1 -1
  26. package/dist/surfboard/index.js +2 -2
  27. package/dist/types/dashboard.d.ts +12 -1
  28. package/dist/types/main.d.ts +13 -1
  29. package/dist/types/surfboard.d.ts +12 -1
  30. package/dist/types/types.d.ts +12 -1
  31. package/package.json +1 -1
  32. package/dist/chunks/editor-action-buttons-CAjqJiT_.js +0 -340
  33. package/dist/chunks/editor-action-buttons-DQVh7L5i.js +0 -11
  34. package/dist/chunks/index-DQOwJyRp.js +0 -1104
  35. package/dist/chunks/resource-management-panel-D_mSi7Cm.js +0 -914
  36. package/dist/chunks/resource-management-panel-NqaNfAq3.js +0 -6
@@ -1,13 +1,13 @@
1
1
  import { jsxs as a, jsx as e, Fragment as M } from "react/jsx-runtime";
2
- import { bI as se, cU as ia, u as x, b$ as _e, c0 as Ge, B as C, c2 as Re, c3 as Z, cV as Pe, bs as ds, l as q, m as Ue, cW as la, c4 as Fe, n as qe, o as je, p as Ve, q as us, L as Ce, Q as ee, G as ca, a2 as F, cX as da, c8 as ua, cY as ma, cZ as rs, c_ as ms, c as ae, c$ as hs, bP as me, d0 as he, I as L, d1 as ps, cF as ha, d2 as pa, H as V, c7 as z, d3 as ze, d4 as fa, d5 as ga, d6 as Le, d7 as va, d8 as ba, d9 as fs, da as gs, db as de, dc as ue, cC as Ee, ce as Ae, dd as Me, c9 as vs, de as ke, cG as bs, e as ys, df as ya, ch as Ns, ci as Ss, cj as ws, ck as xs, cl as Ds, cm as Cs, cn as Ls, co as Oe, bZ as Na, dg as Sa, bu as wa, bA as ns, bE as le, dh as xa, bF as Da, ag as we, cy as Ca, cq as La, di as Ea, dj as Aa, dk as Ma, dl as ka, cr as Oa, cs as Ia, ct as Ta, cu as _a, cv as Ga, c5 as Ra, aO as Pa, dm as Ua, dn as Fa, dp as qa, dq as ja, dr as Va, c1 as za, cb as $a, ds as Ha, ai as Ba, am as Ka } from "./index-CBcPi9pm.js";
2
+ import { bP as se, cR as ia, u as x, b_ as _e, b$ as Ge, B as C, c1 as Re, c2 as Z, cS as Pe, bs as ds, l as j, m as Ue, cT as la, c3 as Fe, n as je, o as qe, p as Ve, q as us, L as Ce, Q as ee, G as ca, a2 as F, cU as da, c7 as ua, cV as ma, cW as rs, cX as ms, c as ae, cY as hs, bJ as me, cZ as he, I as L, c_ as ps, cC as ha, c$ as pa, H as V, c6 as z, d0 as ze, d1 as fa, d2 as ga, d3 as Le, d4 as va, d5 as ba, d6 as fs, d7 as gs, d8 as de, d9 as ue, cu as Ee, cd as Ae, da as Me, c8 as vs, db as ke, cD as bs, e as ys, dc as ya, cg as Ns, ch as Ss, ci as ws, cj as xs, ck as Ds, cl as Cs, cm as Ls, cn as Oe, bZ as Na, dd as Sa, bu as wa, bA as ns, bE as le, de as xa, bF as Da, ag as we, df as Ca, dg as La, dh as Ea, di as Aa, dj as Ma, dk as ka, cw as Oa, cx as Ia, cy as Ta, dl as _a, cz as Ga, c4 as Ra, aO as Pa, dm as Ua, dn as Fa, dp as ja, dq as qa, dr as Va, c0 as za, ca as $a, ds as Ha, ai as Ba, am as Ka } from "./index-D0TdW88i.js";
3
3
  import * as _ from "react";
4
4
  import Es, { useState as S, useMemo as ce, useEffect as Qa } from "react";
5
5
  import "react-dom";
6
- import { b as Wa, u as Ja, c as Xa, A as Ya, V as Za, S as et, N as st, U as at } from "./notification-bell-B-OVf20Q.js";
7
- import { u as tt } from "./use-role-aware-display-preferences-DTSpe_ZT.js";
6
+ import { b as Wa, u as Ja, c as Xa, A as Ya, V as Za, S as et, N as st, U as at } from "./notification-bell-DFiRaeJQ.js";
7
+ import { u as tt } from "./use-role-aware-display-preferences-DfihB5pN.js";
8
8
  import { d as rt } from "./date-formatter-Y8Za1ib3.js";
9
- import { C as nt, D as ot } from "./dashboard-summary-settings-dialog-DmccX33N.js";
10
- import { S as os } from "./editor-action-buttons-CAjqJiT_.js";
9
+ import { C as nt, D as ot } from "./dashboard-summary-settings-dialog-CO1SwHHD.js";
10
+ import { S as os } from "./editor-action-buttons-CszdZ4Fw.js";
11
11
  /**
12
12
  * @license lucide-react v0.453.0 - ISC
13
13
  *
@@ -278,7 +278,7 @@ async function vt(s, n, t) {
278
278
  });
279
279
  }
280
280
  function bt() {
281
- const [s, n] = S(""), [t, r] = S(!1), l = x((N) => N.lenses), { setLenses: i, setSelectedLensId: u } = ds(), [p, g] = S(!1), [v, c] = S(!1), d = x((N) => N.dashboard), m = x((N) => N.filterValues), { authToken: h, tokenProps: b } = q();
281
+ const [s, n] = S(""), [t, r] = S(!1), l = x((N) => N.lenses), { setLenses: i, setSelectedLensId: u } = ds(), [p, g] = S(!1), [v, c] = S(!1), d = x((N) => N.dashboard), m = x((N) => N.filterValues), { authToken: h, tokenProps: b } = j();
282
282
  async function y() {
283
283
  g(!0);
284
284
  const N = await gt(
@@ -303,8 +303,8 @@ function bt() {
303
303
  ]
304
304
  }
305
305
  ) }),
306
- /* @__PURE__ */ a(qe, { className: "sm:max-w-[425px]", children: [
307
- /* @__PURE__ */ a(je, { children: [
306
+ /* @__PURE__ */ a(je, { className: "sm:max-w-[425px]", children: [
307
+ /* @__PURE__ */ a(qe, { children: [
308
308
  /* @__PURE__ */ e(Ve, { children: "Create Lens" }),
309
309
  /* @__PURE__ */ e(us, { children: "Lenses are private by default and are only visible to you." })
310
310
  ] }),
@@ -338,7 +338,7 @@ function bt() {
338
338
  ] });
339
339
  }
340
340
  function yt() {
341
- const [s, n] = S(!1), t = x((d) => d.lenses), r = x((d) => d.selectedLensId), { setLenses: l, setSelectedLensId: i } = ds(), { authToken: u, tokenProps: p } = q();
341
+ const [s, n] = S(!1), t = x((d) => d.lenses), r = x((d) => d.selectedLensId), { setLenses: l, setSelectedLensId: i } = ds(), { authToken: u, tokenProps: p } = j();
342
342
  async function g(d) {
343
343
  i(d);
344
344
  }
@@ -460,7 +460,7 @@ const Nt = async (s, n, t) => {
460
460
  }
461
461
  };
462
462
  function Dt() {
463
- const { authToken: s, tokenProps: n } = q(), t = me();
463
+ const { authToken: s, tokenProps: n } = j(), t = me();
464
464
  return he({
465
465
  mutationFn: (r) => Nt(n.apiServiceUrl, (s == null ? void 0 : s.accessToken) || "", r),
466
466
  onSuccess: () => {
@@ -474,7 +474,7 @@ function Dt() {
474
474
  });
475
475
  }
476
476
  function Ct() {
477
- const { authToken: s, tokenProps: n } = q(), t = me();
477
+ const { authToken: s, tokenProps: n } = j(), t = me();
478
478
  return he({
479
479
  mutationFn: (r) => St(n.apiServiceUrl, (s == null ? void 0 : s.accessToken) || "", r),
480
480
  onSuccess: (r, l) => {
@@ -488,7 +488,7 @@ function Ct() {
488
488
  });
489
489
  }
490
490
  function Lt() {
491
- const { authToken: s, tokenProps: n } = q(), t = me();
491
+ const { authToken: s, tokenProps: n } = j(), t = me();
492
492
  return he({
493
493
  mutationFn: ({
494
494
  groupId: r,
@@ -507,7 +507,7 @@ function Lt() {
507
507
  });
508
508
  }
509
509
  function Et() {
510
- const { authToken: s, tokenProps: n } = q(), t = me();
510
+ const { authToken: s, tokenProps: n } = j(), t = me();
511
511
  return he({
512
512
  mutationFn: ({
513
513
  groupId: r,
@@ -758,8 +758,8 @@ function Gt({
758
758
  const f = u.toLowerCase();
759
759
  return k.filter(
760
760
  (E) => {
761
- var T, w, U, j;
762
- return ((w = (T = E.user) == null ? void 0 : T.name) == null ? void 0 : w.toLowerCase().includes(f)) || ((j = (U = E.user) == null ? void 0 : U.email) == null ? void 0 : j.toLowerCase().includes(f));
761
+ var T, w, U, q;
762
+ return ((w = (T = E.user) == null ? void 0 : T.name) == null ? void 0 : w.toLowerCase().includes(f)) || ((q = (U = E.user) == null ? void 0 : U.email) == null ? void 0 : q.toLowerCase().includes(f));
763
763
  }
764
764
  );
765
765
  }, [k, u]), R = async () => {
@@ -796,8 +796,8 @@ function Gt({
796
796
  (E) => E.includes(f) ? E.filter((T) => T !== f) : [...E, f]
797
797
  );
798
798
  };
799
- return /* @__PURE__ */ e(M, { children: /* @__PURE__ */ e(Ue, { open: s, onOpenChange: n, children: /* @__PURE__ */ a(qe, { className: "max-w-3xl max-h-[80vh]", "aria-describedby": "group-members-description", children: [
800
- /* @__PURE__ */ a(je, { children: [
799
+ return /* @__PURE__ */ e(M, { children: /* @__PURE__ */ e(Ue, { open: s, onOpenChange: n, children: /* @__PURE__ */ a(je, { className: "max-w-3xl max-h-[80vh]", "aria-describedby": "group-members-description", children: [
800
+ /* @__PURE__ */ a(qe, { children: [
801
801
  /* @__PURE__ */ e(Ve, { children: t.name }),
802
802
  /* @__PURE__ */ e("div", { className: "flex items-center gap-2 mt-1", children: /* @__PURE__ */ a("p", { className: "text-sm text-muted-foreground", children: [
803
803
  k.length,
@@ -970,7 +970,7 @@ function Ut({
970
970
  open: s,
971
971
  onOpenChange: n
972
972
  }) {
973
- const [t, r] = S("groups"), [l, i] = S(""), [u, p] = S(null), [g, v] = S(!1), [c, d] = S(null), { tokenProps: m } = q(), { currentUser: h } = ys(), b = Ct(), y = (h == null ? void 0 : h.type) === "tenant", N = m == null ? void 0 : m.tenantId, { groups: A, isLoading: I, refetch: G } = ya({
973
+ const [t, r] = S("groups"), [l, i] = S(""), [u, p] = S(null), [g, v] = S(!1), [c, d] = S(null), { tokenProps: m } = j(), { currentUser: h } = ys(), b = Ct(), y = (h == null ? void 0 : h.type) === "tenant", N = m == null ? void 0 : m.tenantId, { groups: A, isLoading: I, refetch: G } = ya({
974
974
  type: y ? "TENANT_GROUP" : "all",
975
975
  tenantId: y ? N : void 0,
976
976
  includeMembers: !1
@@ -992,8 +992,8 @@ function Ut({
992
992
  r("groups"), G();
993
993
  };
994
994
  return /* @__PURE__ */ a(M, { children: [
995
- /* @__PURE__ */ e(Ue, { open: s, onOpenChange: n, children: /* @__PURE__ */ a(qe, { className: "max-w-4xl max-h-[80vh]", children: [
996
- /* @__PURE__ */ a(je, { children: [
995
+ /* @__PURE__ */ e(Ue, { open: s, onOpenChange: n, children: /* @__PURE__ */ a(je, { className: "max-w-4xl max-h-[80vh]", children: [
996
+ /* @__PURE__ */ a(qe, { children: [
997
997
  /* @__PURE__ */ a(Ve, { className: "flex items-center gap-2", children: [
998
998
  /* @__PURE__ */ e(z, { className: "h-5 w-5" }),
999
999
  "Group Management"
@@ -1150,7 +1150,7 @@ function Wt() {
1150
1150
  authToken: s,
1151
1151
  tokenProps: n,
1152
1152
  id: t
1153
- } = q(), { isLocalDev: r } = Na(), { permissions: l } = tt(), i = Sa(), { isLoading: u } = wa();
1153
+ } = j(), { isLocalDev: r } = Na(), { permissions: l } = tt(), i = Sa(), { isLoading: u } = wa();
1154
1154
  x((o) => o.theme);
1155
1155
  const p = x((o) => o.lenses), g = x((o) => o.selectedLensId), v = p == null ? void 0 : p.find((o) => o.id === g), c = x((o) => o.dashboard);
1156
1156
  x((o) => o.selectedSheetId);
@@ -1162,19 +1162,19 @@ function Wt() {
1162
1162
  ns((o) => o.card);
1163
1163
  const U = le(
1164
1164
  (o) => o.selectedDashboard
1165
- ), j = le(
1165
+ ), q = le(
1166
1166
  (o) => o.initialDashboard
1167
1167
  );
1168
1168
  le((o) => o.selectedVisual), x((o) => o.selectedFrameId), ns((o) => o.frame);
1169
- const te = U ? (ss = U == null ? void 0 : U.permissions) == null ? void 0 : ss.canEdit : (es = j == null ? void 0 : j.permissions) == null ? void 0 : es.canEdit, Ps = x((o) => o.showFilters), Us = xa((o) => o.setPanelOpen), Fs = x(
1169
+ const te = U ? (ss = U == null ? void 0 : U.permissions) == null ? void 0 : ss.canEdit : (es = q == null ? void 0 : q.permissions) == null ? void 0 : es.canEdit, Ps = x((o) => o.showFilters), Us = xa((o) => o.setPanelOpen), Fs = x(
1170
1170
  (o) => o.showDashboardJSON
1171
- ), fe = x((o) => o.onSaveFunction), qs = x(
1171
+ ), fe = x((o) => o.onSaveFunction), js = x(
1172
1172
  (o) => o.actions.setShowFilters
1173
1173
  ), { setIsDashboardEditing: Ke, setShowDashboardJSON: Qe } = x(
1174
1174
  (o) => o.actions
1175
- ), { setInitialDashboard: We, clearSelectedDashboard: js } = le(
1175
+ ), { setInitialDashboard: We, clearSelectedDashboard: qs } = le(
1176
1176
  (o) => o.actions
1177
- ), { resources: re } = Da(we.DASHBOARD), { data: ge } = Ca(), Vs = ((as = ge == null ? void 0 : ge.preference) == null ? void 0 : as.defaultDashboardId) || null, { mutate: zs, isPending: $s } = La(), { currentUser: Hs } = ys(), Bs = Ea(Hs), Q = U || j, Je = Q ? {
1177
+ ), { resources: re } = Da(we.DASHBOARD), { data: ge } = Ca(), Vs = ((as = ge == null ? void 0 : ge.preference) == null ? void 0 : as.defaultDashboardId) || null, { mutate: zs, isPending: $s } = La(), { currentUser: Hs } = ys(), Bs = Ea(Hs), Q = U || q, Je = Q ? {
1178
1178
  id: Q.id,
1179
1179
  title: (c == null ? void 0 : c.title) || Q.title || "Dashboard"
1180
1180
  } : null, { handleAddNewFrame: Ks } = Aa(), [W, ve] = S(!1), [Qs, ne] = S(!1), oe = Ma(we.DASHBOARD), [J, be] = S(
@@ -1305,7 +1305,7 @@ function Wt() {
1305
1305
  {
1306
1306
  "aria-label": "Dashboard Hub",
1307
1307
  tooltip: "Dashboard Hub",
1308
- onClick: () => js(),
1308
+ onClick: () => qs(),
1309
1309
  className: "h-7 p-2",
1310
1310
  children: /* @__PURE__ */ e(ms, { className: "h-4 w-4" })
1311
1311
  }
@@ -1414,10 +1414,10 @@ function Wt() {
1414
1414
  className: "h-7 p-2",
1415
1415
  variant: "outline",
1416
1416
  onClick: () => {
1417
- Us("dashboard", !1), qs(!0);
1417
+ Us("dashboard", !1), js(!0);
1418
1418
  },
1419
1419
  size: "sm",
1420
- children: /* @__PURE__ */ e(qa, { className: "h-4 w-4" })
1420
+ children: /* @__PURE__ */ e(ja, { className: "h-4 w-4" })
1421
1421
  }
1422
1422
  ),
1423
1423
  d && !w && ie && r && i && /* @__PURE__ */ e(bt, {}),
@@ -1458,7 +1458,7 @@ function Wt() {
1458
1458
  onClick: Xs,
1459
1459
  size: "sm",
1460
1460
  children: [
1461
- /* @__PURE__ */ e(ja, { className: "mr-2 h-4 w-4" }),
1461
+ /* @__PURE__ */ e(qa, { className: "mr-2 h-4 w-4" }),
1462
1462
  "Edit"
1463
1463
  ]
1464
1464
  }
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-DQOwJyRp.js"),b=require("react");require("react-dom");const _=require("./notification-bell-DyzIftQU.js"),is=require("./use-role-aware-display-preferences-B4QJkliF.js"),ls=require("./date-formatter-Sz6QDaM8.js"),Ne=require("./dashboard-summary-settings-dialog-tJueBNph.js"),De=require("./editor-action-buttons-DQVh7L5i.js");function cs(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const r=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(n,a,r.get?r:{enumerable:!0,get:()=>t[a]})}}return n.default=t,Object.freeze(n)}const E=cs(b);/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-DSA80lEg.js"),b=require("react");require("react-dom");const _=require("./notification-bell-D2V1-ARa.js"),is=require("./use-role-aware-display-preferences-D8j5_cnK.js"),ls=require("./date-formatter-Sz6QDaM8.js"),Ne=require("./dashboard-summary-settings-dialog-BoX18wiA.js"),De=require("./editor-action-buttons-CDTIx_Jc.js");function cs(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const r=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(n,a,r.get?r:{enumerable:!0,get:()=>t[a]})}}return n.default=t,Object.freeze(n)}const E=cs(b);/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,5 +1,5 @@
1
1
  import { jsxs as o, jsx as r } from "react/jsx-runtime";
2
- import { u as s, B as l, X as h, d, c } from "./index-CBcPi9pm.js";
2
+ import { u as s, B as l, X as h, d, c } from "./index-D0TdW88i.js";
3
3
  import "react";
4
4
  import "react-dom";
5
5
  function N() {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),a=require("./index-DQOwJyRp.js");require("react");require("react-dom");function i(){const o=a.useDashboardStore(e=>e.dashboard),r=a.useDashboardStore(e=>e.actions.setDashboard),t=a.useDashboardStore(e=>e.showDashboardJSON),n=a.useDashboardStore(e=>e.actions.setShowDashboardJSON);return s.jsxs("div",{className:a.cn("relative p-2",{hidden:!t}),children:[s.jsxs(a.Button,{variant:"secondary",size:"sm",className:"absolute right-2 top-2 z-10 h-8",onClick:()=>n(!1),children:[s.jsx(a.X,{className:"mr-2 h-4 w-4"}),"Close"]}),s.jsx(a.de,{onChange:e=>{if(e)try{JSON.parse(e),r(JSON.parse(e))}catch{}},defaultLanguage:"json",className:"h-[550px] overflow-y-auto",value:JSON.stringify(o,null,2),options:{minimap:{enabled:!1},glyphMargin:!1,wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:12,renderLineHighlight:"none"}})]})}exports.default=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),a=require("./index-DSA80lEg.js");require("react");require("react-dom");function i(){const o=a.useDashboardStore(e=>e.dashboard),r=a.useDashboardStore(e=>e.actions.setDashboard),t=a.useDashboardStore(e=>e.showDashboardJSON),n=a.useDashboardStore(e=>e.actions.setShowDashboardJSON);return s.jsxs("div",{className:a.cn("relative p-2",{hidden:!t}),children:[s.jsxs(a.Button,{variant:"secondary",size:"sm",className:"absolute right-2 top-2 z-10 h-8",onClick:()=>n(!1),children:[s.jsx(a.X,{className:"mr-2 h-4 w-4"}),"Close"]}),s.jsx(a.de,{onChange:e=>{if(e)try{JSON.parse(e),r(JSON.parse(e))}catch{}},defaultLanguage:"json",className:"h-[550px] overflow-y-auto",value:JSON.stringify(o,null,2),options:{minimap:{enabled:!1},glyphMargin:!1,wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:12,renderLineHighlight:"none"}})]})}exports.default=i;
@@ -1 +1 @@
1
- "use strict";const e=require("react/jsx-runtime"),l=require("react"),a=require("./index-DQOwJyRp.js");function W(){var N,C,T,y;const{authToken:s,tokenProps:r}=a.useSemaphorContext(),[i,S]=l.useState(!1),[x,v]=l.useState(!1),[j,b]=l.useState(!1),[p,u]=l.useState(null),[m,n]=l.useState(null),g=m||{tz:((C=(N=r==null?void 0:r.params)==null?void 0:N.calendarContext)==null?void 0:C.tz)||null,weekStart:((y=(T=r==null?void 0:r.params)==null?void 0:T.calendarContext)==null?void 0:y.weekStart)??null},d=l.useCallback(async()=>{if(!(!(s!=null&&s.accessToken)||!(r!=null&&r.apiServiceUrl))){S(!0),u(null);try{const c=await fetch(`${r.apiServiceUrl}/v1/user-preferences/calendar`,{method:"GET",headers:{Authorization:`Bearer ${s.accessToken}`}});if(!c.ok){const h=await c.json().catch(()=>({}));throw new Error(h.error||"Failed to fetch preferences")}const o=await c.json();n({tz:o.tz,weekStart:o.weekStart,source:o.source,isInherited:o.isInherited,userHasPrefs:o.userHasPrefs,inherited:o.inherited})}catch(c){const o=c instanceof Error?c.message:"Unknown error";u(o)}finally{S(!1)}}},[s,r]);l.useEffect(()=>{d()},[d]);const f=l.useCallback(async c=>{if(!(s!=null&&s.accessToken)||!(r!=null&&r.apiServiceUrl))return u("Not authenticated"),!1;v(!0),u(null);try{const o=await fetch(`${r.apiServiceUrl}/v1/user-preferences/calendar`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${s.accessToken}`},body:JSON.stringify(c)});if(!o.ok){const h=await o.json().catch(()=>({}));throw new Error(h.error||"Failed to update preferences")}return await d(),!0}catch(o){const h=o instanceof Error?o.message:"Unknown error";return u(h),!1}finally{v(!1)}},[s,r,d]),w=l.useCallback(async()=>{if(!(s!=null&&s.accessToken)||!(r!=null&&r.apiServiceUrl))return u("Not authenticated"),!1;b(!0),u(null);try{const c=await fetch(`${r.apiServiceUrl}/v1/user-preferences/calendar`,{method:"DELETE",headers:{Authorization:`Bearer ${s.accessToken}`}});if(!c.ok){const h=await c.json().catch(()=>({}));throw new Error(h.error||"Failed to clear preferences")}const o=await c.text();if(o)try{const h=JSON.parse(o);return n({tz:h.tz,weekStart:h.weekStart,source:h.source,isInherited:h.isInherited??!0,userHasPrefs:!1,inherited:h.inherited}),!0}catch{}return await d(),!0}catch(c){const o=c instanceof Error?c.message:"Unknown error";return u(o),!1}finally{b(!1)}},[s,r,d]);return{preferences:g,isLoading:i,isSaving:x,isClearing:j,error:p,updatePreferences:f,clearPreferences:w,refetch:d}}const I=[{value:"America/New_York",label:"Eastern Time (US & Canada)"},{value:"America/Chicago",label:"Central Time (US & Canada)"},{value:"America/Denver",label:"Mountain Time (US & Canada)"},{value:"America/Los_Angeles",label:"Pacific Time (US & Canada)"},{value:"America/Phoenix",label:"Arizona"},{value:"America/Anchorage",label:"Alaska"},{value:"Pacific/Honolulu",label:"Hawaii"},{value:"Europe/London",label:"London"},{value:"Europe/Paris",label:"Paris, Berlin, Rome"},{value:"Asia/Tokyo",label:"Tokyo"},{value:"Asia/Shanghai",label:"Beijing, Shanghai"},{value:"Asia/Kolkata",label:"Mumbai, New Delhi"},{value:"Australia/Sydney",label:"Sydney"},{value:"UTC",label:"UTC"}],M=[{value:0,label:"Sunday"},{value:1,label:"Monday"},{value:6,label:"Saturday"}];function G(){try{const s=Intl;if(s.supportedValuesOf)return s.supportedValuesOf("timeZone")}catch{}return I.map(s=>s.value)}function V(s){switch(s){case"tenant":return"tenant";case"organization":return"organization";case"system":return"system";default:return"default"}}function L(s){const r=I.find(i=>i.value===s);return r?r.label:s}function X(s){const r=M.find(i=>i.value===s);return r?r.label:String(s)}function q({open:s,onOpenChange:r}){var E,P,A;const{preferences:i,isLoading:S,isSaving:x,isClearing:v,updatePreferences:j,clearPreferences:b}=W(),p=i.tz||((E=i.inherited)==null?void 0:E.tz)||Intl.DateTimeFormat().resolvedOptions().timeZone,u=i.weekStart??((P=i.inherited)==null?void 0:P.weekStart)??1,[m,n]=l.useState(!i.userHasPrefs),[g,d]=l.useState(!1),[f,w]=l.useState(p),[N,C]=l.useState(u),[T,y]=l.useState(!1),c=l.useMemo(()=>G(),[]),o=l.useMemo(()=>c.filter(t=>!I.some(R=>R.value===t)),[c]),h=l.useMemo(()=>L(f),[f]),F=i.inherited?L(i.inherited.tz):"UTC",H=i.inherited?X(i.inherited.weekStart):"Monday",B=V((A=i.inherited)==null?void 0:A.source);l.useEffect(()=>{if(!s){d(!1);return}g||(i.userHasPrefs!==void 0&&n(!i.userHasPrefs),w(p),C(u))},[s,g,i.userHasPrefs,p,u]);const _=async()=>{if(S){a.ue.error("Preferences are still loading. Please try again.");return}m?await b()?(a.ue.success("Now using default settings. Please refresh the page to apply changes.",{duration:5e3}),r(!1)):a.ue.error("Failed to save preferences. Please try again."):await j({tz:f,weekStart:N})?(a.ue.success("Preferences saved. Please refresh the page to apply changes.",{duration:5e3}),r(!1)):a.ue.error("Failed to save preferences. Please try again.")},$=()=>{r(!1)},D=x||v,O=D||S;return e.jsx(a.Dialog,{open:s,onOpenChange:r,children:e.jsxs(a.DialogContent,{className:"sm:max-w-[425px]",children:[e.jsxs(a.DialogHeader,{children:[e.jsx(a.DialogTitle,{children:"Calendar Preferences"}),e.jsx(a.DialogDescription,{children:"Set your timezone and week start preferences for date calculations and displays."})]}),e.jsxs("div",{className:"space-y-6 py-4",children:[e.jsxs(a.RadioGroup,{value:m?"defaults":"custom",onValueChange:t=>{d(!0),n(t==="defaults")},className:"space-y-3",children:[e.jsxs("div",{className:a.cn("flex items-start space-x-3 rounded-lg border p-4 cursor-pointer transition-colors",m?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/50"),onClick:()=>{d(!0),n(!0)},children:[e.jsx(a.RadioGroupItem,{value:"defaults",id:"mode-defaults"}),e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsxs(a.Label,{htmlFor:"mode-defaults",className:"cursor-pointer font-medium",children:["Use ",B," defaults"]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[F,", Week starts ",H]})]})]}),e.jsxs("div",{className:a.cn("flex items-start space-x-3 rounded-lg border p-4 cursor-pointer transition-colors",m?"border-border hover:border-muted-foreground/50":"border-primary bg-primary/5"),onClick:()=>{d(!0),n(!1)},children:[e.jsx(a.RadioGroupItem,{value:"custom",id:"mode-custom"}),e.jsx(a.Label,{htmlFor:"mode-custom",className:"cursor-pointer font-medium",children:"Use custom settings"})]})]}),e.jsxs("div",{className:a.cn("space-y-6 transition-opacity",m&&"opacity-50 pointer-events-none"),children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(a.Label,{children:"Timezone"}),e.jsxs(a.Popover,{open:T,onOpenChange:y,modal:!0,children:[e.jsx(a.PopoverTrigger,{asChild:!0,children:e.jsxs(a.Button,{variant:"outline",role:"combobox","aria-expanded":T,className:"w-full justify-between",disabled:m,children:[h,e.jsx(a.ChevronsUpDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(a.PopoverContent,{className:"z-50 w-[--radix-popover-trigger-width] p-0",align:"start",children:e.jsxs(a.Command,{className:"overflow-visible",children:[e.jsx(a.CommandInput,{placeholder:"Search timezones..."}),e.jsxs(a.CommandList,{children:[e.jsx(a.CommandEmpty,{children:"No timezone found."}),e.jsx(a.CommandGroup,{heading:"Common",children:I.map(t=>e.jsxs(a.CommandItem,{value:`${t.value} ${t.label}`,onSelect:()=>{d(!0),w(t.value),y(!1)},children:[e.jsx(a.Check,{className:a.cn("mr-2 h-4 w-4",f===t.value?"opacity-100":"opacity-0")}),e.jsx("span",{className:"flex-1",children:t.label}),e.jsx("span",{className:"text-xs text-muted-foreground",children:t.value})]},t.value))}),e.jsx(a.CommandSeparator,{}),e.jsx(a.CommandGroup,{heading:"All Timezones",children:o.map(t=>e.jsxs(a.CommandItem,{value:t,onSelect:()=>{d(!0),w(t),y(!1)},children:[e.jsx(a.Check,{className:a.cn("mr-2 h-4 w-4",f===t?"opacity-100":"opacity-0")}),t]},t))})]})]})})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(a.Label,{children:"Week Starts On"}),e.jsx(a.RadioGroup,{value:String(N),onValueChange:t=>{d(!0),C(Number(t))},className:"flex gap-4",disabled:m,children:M.map(t=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(a.RadioGroupItem,{value:String(t.value),id:`week-start-${t.value}`,disabled:m}),e.jsx(a.Label,{htmlFor:`week-start-${t.value}`,className:a.cn("cursor-pointer font-normal",m&&"cursor-not-allowed"),children:t.label})]},t.value))})]})]})]}),e.jsxs(a.DialogFooter,{children:[e.jsx(a.Button,{variant:"outline",onClick:$,disabled:D,children:"Cancel"}),e.jsx(a.Button,{onClick:_,disabled:O,children:D?e.jsxs(e.Fragment,{children:[e.jsx(a.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):"Save"})]})]})})}const k=6,z=1,U=20;function Z(s){return Number.isNaN(s)?k:Math.min(U,Math.max(z,s))}function J({open:s,onOpenChange:r,dashboard:i,onApply:S,disabled:x=!1}){const[v,j]=l.useState(!1),[b,p]=l.useState("top"),[u,m]=l.useState(String(k)),n=i.summary;l.useEffect(()=>{s&&(j((n==null?void 0:n.enabled)===!0),p((n==null?void 0:n.position)==="bottom"?"bottom":"top"),m(String((n==null?void 0:n.maxItems)??k)))},[s,n==null?void 0:n.enabled,n==null?void 0:n.position,n==null?void 0:n.maxItems]);const g=l.useMemo(()=>Z(Number.parseInt(u||`${k}`,10)),[u]),d=()=>{S({enabled:v,position:b,maxItems:g}),r(!1)};return e.jsx(a.Dialog,{open:s,onOpenChange:r,children:e.jsxs(a.DialogContent,{className:"sm:max-w-[420px]",children:[e.jsxs(a.DialogHeader,{children:[e.jsx(a.DialogTitle,{children:"Summary Settings"}),e.jsx(a.DialogDescription,{children:"Configure dashboard-level summary display. Card-level summary settings still control which cards contribute."})]}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(a.Label,{htmlFor:"dashboard-summary-enabled",children:"Enable Dashboard Summary"}),e.jsx(a.SmallSwitch,{id:"dashboard-summary-enabled",checked:v,disabled:x,onCheckedChange:j})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(a.Label,{htmlFor:"dashboard-summary-position",children:"Position"}),e.jsxs(a.Select,{value:b,disabled:x,onValueChange:f=>p(f),children:[e.jsx(a.SelectTrigger,{id:"dashboard-summary-position",children:e.jsx(a.SelectValue,{placeholder:"Select position"})}),e.jsxs(a.SelectContent,{children:[e.jsx(a.SelectItem,{value:"top",children:"Top"}),e.jsx(a.SelectItem,{value:"bottom",children:"Bottom"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(a.Label,{htmlFor:"dashboard-summary-max-items",children:"Max Items"}),e.jsx(a.Input,{id:"dashboard-summary-max-items",type:"number",min:z,max:U,disabled:x,value:u,onChange:f=>m(f.target.value),onBlur:()=>m(String(g))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Display limit only. Computation is unchanged."})]}),x&&e.jsx("p",{className:"text-xs text-amber-700",children:"Enter dashboard edit mode to modify summary settings."})]}),e.jsxs(a.DialogFooter,{children:[e.jsx(a.Button,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),e.jsx(a.Button,{onClick:d,disabled:x,children:"Apply"})]})]})})}exports.CalendarPreferencesDialog=q;exports.DashboardSummarySettingsDialog=J;
1
+ "use strict";const e=require("react/jsx-runtime"),l=require("react"),a=require("./index-DSA80lEg.js");function W(){var N,C,T,y;const{authToken:s,tokenProps:r}=a.useSemaphorContext(),[i,S]=l.useState(!1),[x,v]=l.useState(!1),[j,b]=l.useState(!1),[p,u]=l.useState(null),[m,n]=l.useState(null),g=m||{tz:((C=(N=r==null?void 0:r.params)==null?void 0:N.calendarContext)==null?void 0:C.tz)||null,weekStart:((y=(T=r==null?void 0:r.params)==null?void 0:T.calendarContext)==null?void 0:y.weekStart)??null},d=l.useCallback(async()=>{if(!(!(s!=null&&s.accessToken)||!(r!=null&&r.apiServiceUrl))){S(!0),u(null);try{const c=await fetch(`${r.apiServiceUrl}/v1/user-preferences/calendar`,{method:"GET",headers:{Authorization:`Bearer ${s.accessToken}`}});if(!c.ok){const h=await c.json().catch(()=>({}));throw new Error(h.error||"Failed to fetch preferences")}const o=await c.json();n({tz:o.tz,weekStart:o.weekStart,source:o.source,isInherited:o.isInherited,userHasPrefs:o.userHasPrefs,inherited:o.inherited})}catch(c){const o=c instanceof Error?c.message:"Unknown error";u(o)}finally{S(!1)}}},[s,r]);l.useEffect(()=>{d()},[d]);const f=l.useCallback(async c=>{if(!(s!=null&&s.accessToken)||!(r!=null&&r.apiServiceUrl))return u("Not authenticated"),!1;v(!0),u(null);try{const o=await fetch(`${r.apiServiceUrl}/v1/user-preferences/calendar`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${s.accessToken}`},body:JSON.stringify(c)});if(!o.ok){const h=await o.json().catch(()=>({}));throw new Error(h.error||"Failed to update preferences")}return await d(),!0}catch(o){const h=o instanceof Error?o.message:"Unknown error";return u(h),!1}finally{v(!1)}},[s,r,d]),w=l.useCallback(async()=>{if(!(s!=null&&s.accessToken)||!(r!=null&&r.apiServiceUrl))return u("Not authenticated"),!1;b(!0),u(null);try{const c=await fetch(`${r.apiServiceUrl}/v1/user-preferences/calendar`,{method:"DELETE",headers:{Authorization:`Bearer ${s.accessToken}`}});if(!c.ok){const h=await c.json().catch(()=>({}));throw new Error(h.error||"Failed to clear preferences")}const o=await c.text();if(o)try{const h=JSON.parse(o);return n({tz:h.tz,weekStart:h.weekStart,source:h.source,isInherited:h.isInherited??!0,userHasPrefs:!1,inherited:h.inherited}),!0}catch{}return await d(),!0}catch(c){const o=c instanceof Error?c.message:"Unknown error";return u(o),!1}finally{b(!1)}},[s,r,d]);return{preferences:g,isLoading:i,isSaving:x,isClearing:j,error:p,updatePreferences:f,clearPreferences:w,refetch:d}}const I=[{value:"America/New_York",label:"Eastern Time (US & Canada)"},{value:"America/Chicago",label:"Central Time (US & Canada)"},{value:"America/Denver",label:"Mountain Time (US & Canada)"},{value:"America/Los_Angeles",label:"Pacific Time (US & Canada)"},{value:"America/Phoenix",label:"Arizona"},{value:"America/Anchorage",label:"Alaska"},{value:"Pacific/Honolulu",label:"Hawaii"},{value:"Europe/London",label:"London"},{value:"Europe/Paris",label:"Paris, Berlin, Rome"},{value:"Asia/Tokyo",label:"Tokyo"},{value:"Asia/Shanghai",label:"Beijing, Shanghai"},{value:"Asia/Kolkata",label:"Mumbai, New Delhi"},{value:"Australia/Sydney",label:"Sydney"},{value:"UTC",label:"UTC"}],M=[{value:0,label:"Sunday"},{value:1,label:"Monday"},{value:6,label:"Saturday"}];function G(){try{const s=Intl;if(s.supportedValuesOf)return s.supportedValuesOf("timeZone")}catch{}return I.map(s=>s.value)}function V(s){switch(s){case"tenant":return"tenant";case"organization":return"organization";case"system":return"system";default:return"default"}}function L(s){const r=I.find(i=>i.value===s);return r?r.label:s}function X(s){const r=M.find(i=>i.value===s);return r?r.label:String(s)}function q({open:s,onOpenChange:r}){var E,P,A;const{preferences:i,isLoading:S,isSaving:x,isClearing:v,updatePreferences:j,clearPreferences:b}=W(),p=i.tz||((E=i.inherited)==null?void 0:E.tz)||Intl.DateTimeFormat().resolvedOptions().timeZone,u=i.weekStart??((P=i.inherited)==null?void 0:P.weekStart)??1,[m,n]=l.useState(!i.userHasPrefs),[g,d]=l.useState(!1),[f,w]=l.useState(p),[N,C]=l.useState(u),[T,y]=l.useState(!1),c=l.useMemo(()=>G(),[]),o=l.useMemo(()=>c.filter(t=>!I.some(R=>R.value===t)),[c]),h=l.useMemo(()=>L(f),[f]),F=i.inherited?L(i.inherited.tz):"UTC",H=i.inherited?X(i.inherited.weekStart):"Monday",B=V((A=i.inherited)==null?void 0:A.source);l.useEffect(()=>{if(!s){d(!1);return}g||(i.userHasPrefs!==void 0&&n(!i.userHasPrefs),w(p),C(u))},[s,g,i.userHasPrefs,p,u]);const _=async()=>{if(S){a.ue.error("Preferences are still loading. Please try again.");return}m?await b()?(a.ue.success("Now using default settings. Please refresh the page to apply changes.",{duration:5e3}),r(!1)):a.ue.error("Failed to save preferences. Please try again."):await j({tz:f,weekStart:N})?(a.ue.success("Preferences saved. Please refresh the page to apply changes.",{duration:5e3}),r(!1)):a.ue.error("Failed to save preferences. Please try again.")},$=()=>{r(!1)},D=x||v,O=D||S;return e.jsx(a.Dialog,{open:s,onOpenChange:r,children:e.jsxs(a.DialogContent,{className:"sm:max-w-[425px]",children:[e.jsxs(a.DialogHeader,{children:[e.jsx(a.DialogTitle,{children:"Calendar Preferences"}),e.jsx(a.DialogDescription,{children:"Set your timezone and week start preferences for date calculations and displays."})]}),e.jsxs("div",{className:"space-y-6 py-4",children:[e.jsxs(a.RadioGroup,{value:m?"defaults":"custom",onValueChange:t=>{d(!0),n(t==="defaults")},className:"space-y-3",children:[e.jsxs("div",{className:a.cn("flex items-start space-x-3 rounded-lg border p-4 cursor-pointer transition-colors",m?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/50"),onClick:()=>{d(!0),n(!0)},children:[e.jsx(a.RadioGroupItem,{value:"defaults",id:"mode-defaults"}),e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsxs(a.Label,{htmlFor:"mode-defaults",className:"cursor-pointer font-medium",children:["Use ",B," defaults"]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[F,", Week starts ",H]})]})]}),e.jsxs("div",{className:a.cn("flex items-start space-x-3 rounded-lg border p-4 cursor-pointer transition-colors",m?"border-border hover:border-muted-foreground/50":"border-primary bg-primary/5"),onClick:()=>{d(!0),n(!1)},children:[e.jsx(a.RadioGroupItem,{value:"custom",id:"mode-custom"}),e.jsx(a.Label,{htmlFor:"mode-custom",className:"cursor-pointer font-medium",children:"Use custom settings"})]})]}),e.jsxs("div",{className:a.cn("space-y-6 transition-opacity",m&&"opacity-50 pointer-events-none"),children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(a.Label,{children:"Timezone"}),e.jsxs(a.Popover,{open:T,onOpenChange:y,modal:!0,children:[e.jsx(a.PopoverTrigger,{asChild:!0,children:e.jsxs(a.Button,{variant:"outline",role:"combobox","aria-expanded":T,className:"w-full justify-between",disabled:m,children:[h,e.jsx(a.ChevronsUpDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(a.PopoverContent,{className:"z-50 w-[--radix-popover-trigger-width] p-0",align:"start",children:e.jsxs(a.Command,{className:"overflow-visible",children:[e.jsx(a.CommandInput,{placeholder:"Search timezones..."}),e.jsxs(a.CommandList,{children:[e.jsx(a.CommandEmpty,{children:"No timezone found."}),e.jsx(a.CommandGroup,{heading:"Common",children:I.map(t=>e.jsxs(a.CommandItem,{value:`${t.value} ${t.label}`,onSelect:()=>{d(!0),w(t.value),y(!1)},children:[e.jsx(a.Check,{className:a.cn("mr-2 h-4 w-4",f===t.value?"opacity-100":"opacity-0")}),e.jsx("span",{className:"flex-1",children:t.label}),e.jsx("span",{className:"text-xs text-muted-foreground",children:t.value})]},t.value))}),e.jsx(a.CommandSeparator,{}),e.jsx(a.CommandGroup,{heading:"All Timezones",children:o.map(t=>e.jsxs(a.CommandItem,{value:t,onSelect:()=>{d(!0),w(t),y(!1)},children:[e.jsx(a.Check,{className:a.cn("mr-2 h-4 w-4",f===t?"opacity-100":"opacity-0")}),t]},t))})]})]})})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(a.Label,{children:"Week Starts On"}),e.jsx(a.RadioGroup,{value:String(N),onValueChange:t=>{d(!0),C(Number(t))},className:"flex gap-4",disabled:m,children:M.map(t=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(a.RadioGroupItem,{value:String(t.value),id:`week-start-${t.value}`,disabled:m}),e.jsx(a.Label,{htmlFor:`week-start-${t.value}`,className:a.cn("cursor-pointer font-normal",m&&"cursor-not-allowed"),children:t.label})]},t.value))})]})]})]}),e.jsxs(a.DialogFooter,{children:[e.jsx(a.Button,{variant:"outline",onClick:$,disabled:D,children:"Cancel"}),e.jsx(a.Button,{onClick:_,disabled:O,children:D?e.jsxs(e.Fragment,{children:[e.jsx(a.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):"Save"})]})]})})}const k=6,z=1,U=20;function Z(s){return Number.isNaN(s)?k:Math.min(U,Math.max(z,s))}function J({open:s,onOpenChange:r,dashboard:i,onApply:S,disabled:x=!1}){const[v,j]=l.useState(!1),[b,p]=l.useState("top"),[u,m]=l.useState(String(k)),n=i.summary;l.useEffect(()=>{s&&(j((n==null?void 0:n.enabled)===!0),p((n==null?void 0:n.position)==="bottom"?"bottom":"top"),m(String((n==null?void 0:n.maxItems)??k)))},[s,n==null?void 0:n.enabled,n==null?void 0:n.position,n==null?void 0:n.maxItems]);const g=l.useMemo(()=>Z(Number.parseInt(u||`${k}`,10)),[u]),d=()=>{S({enabled:v,position:b,maxItems:g}),r(!1)};return e.jsx(a.Dialog,{open:s,onOpenChange:r,children:e.jsxs(a.DialogContent,{className:"sm:max-w-[420px]",children:[e.jsxs(a.DialogHeader,{children:[e.jsx(a.DialogTitle,{children:"Summary Settings"}),e.jsx(a.DialogDescription,{children:"Configure dashboard-level summary display. Card-level summary settings still control which cards contribute."})]}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(a.Label,{htmlFor:"dashboard-summary-enabled",children:"Enable Dashboard Summary"}),e.jsx(a.SmallSwitch,{id:"dashboard-summary-enabled",checked:v,disabled:x,onCheckedChange:j})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(a.Label,{htmlFor:"dashboard-summary-position",children:"Position"}),e.jsxs(a.Select,{value:b,disabled:x,onValueChange:f=>p(f),children:[e.jsx(a.SelectTrigger,{id:"dashboard-summary-position",children:e.jsx(a.SelectValue,{placeholder:"Select position"})}),e.jsxs(a.SelectContent,{children:[e.jsx(a.SelectItem,{value:"top",children:"Top"}),e.jsx(a.SelectItem,{value:"bottom",children:"Bottom"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(a.Label,{htmlFor:"dashboard-summary-max-items",children:"Max Items"}),e.jsx(a.Input,{id:"dashboard-summary-max-items",type:"number",min:z,max:U,disabled:x,value:u,onChange:f=>m(f.target.value),onBlur:()=>m(String(g))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Display limit only. Computation is unchanged."})]}),x&&e.jsx("p",{className:"text-xs text-amber-700",children:"Enter dashboard edit mode to modify summary settings."})]}),e.jsxs(a.DialogFooter,{children:[e.jsx(a.Button,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),e.jsx(a.Button,{onClick:d,disabled:x,children:"Apply"})]})]})})}exports.CalendarPreferencesDialog=q;exports.DashboardSummarySettingsDialog=J;
@@ -1,6 +1,6 @@
1
1
  import { jsx as e, jsxs as s, Fragment as oe } from "react/jsx-runtime";
2
2
  import de, { useState as h, useCallback as L, useEffect as G, useMemo as z } from "react";
3
- import { l as ue, m as X, n as J, o as K, p as Z, q, R as j, r as F, L as b, c as C, P as me, s as he, B as P, C as fe, t as pe, v as ve, w as be, x as Se, y as ge, z as O, A as B, E as W, F as ye, G as Q, H as we, I as A, S as xe, J as Ne, K as Ce, M as Te, N as ke, O as R, Q as Ie } from "./index-CBcPi9pm.js";
3
+ import { l as ue, m as X, n as J, o as K, p as Z, q, R as j, r as F, L as b, c as C, P as me, s as he, B as P, C as fe, t as pe, v as ve, w as be, x as Se, y as ge, z as O, A as B, E as W, F as ye, G as Q, H as we, I as A, S as xe, J as Ne, K as Ce, M as Te, N as ke, O as R, Q as Ie } from "./index-D0TdW88i.js";
4
4
  function Ee() {
5
5
  var k, I, E, N;
6
6
  const { authToken: a, tokenProps: r } = ue(), [l, S] = h(!1), [p, g] = h(!1), [x, y] = h(!1), [v, o] = h(null), [u, n] = h(null), w = u || {
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-DQOwJyRp.js"),I=require("react"),ye=require("./editor-action-buttons-DQVh7L5i.js"),Lt=require("react-dom");function Mt(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const r=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(n,a,r.get?r:{enumerable:!0,get:()=>t[a]})}}return n.default=t,Object.freeze(n)}const as=Mt(I);/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-DSA80lEg.js"),I=require("react"),ye=require("./editor-action-buttons-CDTIx_Jc.js"),Lt=require("react-dom");function Mt(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const r=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(n,a,r.get?r:{enumerable:!0,get:()=>t[a]})}}return n.default=t,Object.freeze(n)}const as=Mt(I);/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,8 +1,8 @@
1
1
  import { jsxs as a, jsx as e, Fragment as fe } from "react/jsx-runtime";
2
- import { bI as ke, dt as Nr, I as Tt, by as de, bA as E, du as Na, dv as Cr, L as P, J as Q, K as X, M as Z, N as ee, O as K, dw as Ie, B as Y, c4 as dt, dx as $a, dy as Zs, dz as el, dA as tl, dB as al, dC as ja, a1 as vt, X as Be, dD as Dn, c9 as In, m as Ht, n as Yt, o as Wt, p as Qt, q as xa, bS as nt, cv as He, cr as Ye, cs as Ge, ct as Ue, dE as Ns, dF as En, u as Ne, G as yn, dG as Xt, ce as da, cG as tt, dH as nl, c as ae, bZ as sl, dI as wr, dJ as Sr, dK as kr, dL as ga, dM as Tr, dN as ll, dO as Ar, cU as rl, dP as Dr, dQ as il, dR as Ir, dS as Mn, dT as Er, dU as Et, dV as Nt, dW as On, bP as Mr, dX as Or, bJ as ua, bK as Kt, bL as Gt, bM as Ca, bN as bt, bO as _t, dY as vn, dZ as zt, d_ as Ze, d$ as $t, H as Zt, e0 as Fr, e1 as Ra, e2 as La, e3 as Pa, e4 as Fn, dp as ea, cJ as wa, e5 as Rr, R as Sa, e6 as Rn, e7 as ma, cf as Ln, e8 as ol, r as Mt, bE as Lr, e9 as Pr, cN as Vr, ea as yt, eb as At, ec as Br, ed as Dt, e as Pn, cK as Vn, bs as cl, ee as Bn, ef as zr, eg as dl, eh as ul, ei as xt, dl as nn, ej as $r, ek as jr, el as ml, aa as hl, em as pl, en as qr, eo as Kr, ep as Gr, eq as qa, er as Ur, es as _r, et as Cs, eu as Jr, T as Ka, $ as zn, ev as Hr, ew as $n, cW as Yr, a2 as We, ex as Wr, ey as Qr, d9 as jn, da as qn, db as Vt, dc as Ma, ez as Xr, cu as Zr, eA as fl, eB as ei, eC as ti, cC as Ga, cA as et, eD as ai, eE as ni, eF as ws, eG as si, P as ut, s as mt, t as ht, b$ as Kn, c0 as Gn, c2 as Un, cX as gl, c8 as Ut, eH as Ct, eI as jt, eJ as qt, eK as Ot, eL as ta, eM as li, av as ri, eN as ii, eO as oi, eP as ci, eQ as di, cI as Jt, eR as ui, eS as xl, eT as mi, eU as hi, l as ka, eV as pi, eW as bl, eX as fi, eY as gi, eZ as xi, e_ as bi, e$ as yi, f0 as vi, f1 as Nn, f2 as Ni, f3 as Ci, f4 as wi, f5 as Cn, f6 as Ss, f7 as Si, f8 as ki, f9 as Ti, fa as Ai, fb as Di, fc as yl, fd as _n, Q as Me, fe as ba, ff as Va, fg as Ii, fh as aa, fi as Te, fj as Ae, fk as De, fl as Ei, fm as Mi, fn as Oi, fo as Fi, fp as wt, fq as Ia, fr as ks, fs as Ri, dq as vl, S as Ee, ft as Li, fu as Pi, fv as Vi, v as na, w as sa, x as la, y as ra, z as ia, A as oa, fw as Bi, fx as zi, fy as Ts, fz as $i, E as ha, fA as ji, fB as sn, fC as As, fD as it, fE as qi, fF as Ki, fG as Gi, fH as Ui, fI as Ta, fJ as _i, fK as ln, fL as Nl, fM as Ji, fN as Hi, fO as Yi, fP as Ba, fQ as Wi, fR as Qi, fS as Bt, b_ as Jn, fT as Hn, fU as Cl, fV as Xi, cz as wl, fW as Zi, fX as Ua, ds as eo, fY as Le, fZ as Ds, bz as to, bu as ao, f_ as no, f$ as so, g0 as lo, g1 as ro, g2 as io, b1 as Is, g3 as Es, g4 as oo, g5 as co, g6 as Sl, g7 as uo, g8 as kl, g9 as mo, ga as ho, gb as po, gc as fo, gd as go, ge as xo, gf as bo, gg as yo, gh as vo, gi as No, gj as Tl, gk as Co, gl as wo, gm as So, gn as ko, go as To, gp as Ao, gq as Do, gr as Al, c1 as Io, gs as Eo, gt as Mo, gu as Oo, gv as Fo, gw as Ro, gx as Dl, gy as Lo, d1 as Il, gz as _a, gA as El, gB as Ml, aS as Ea, gC as Ja, gD as Po, gE as Ol, gF as Ms, cD as Vo, gG as Os, gH as Bo, gI as zo, gJ as $o, gK as Oa, gL as jo, gM as Yn, gN as Fa, gO as qo, gP as Ko, gQ as za, gR as Go, C as Uo, gS as _o, gT as ya, gU as St, gV as wn, gW as Sn, gX as va, gY as Fl, gZ as ca, a8 as Jo, g_ as Ho, g$ as rn, h0 as Yo, h1 as on, h2 as Wo, h3 as Fs, h4 as Qo, h5 as Xo, h6 as Zo, h7 as ec, c3 as rt, h8 as tc, h9 as ac, ha as nc, hb as Ha, cb as Ya, hc as Rs, hd as Rl, dh as cn, he as sc, hf as lc, hg as rc, U as ic } from "./index-CBcPi9pm.js";
2
+ import { bP as ke, dt as Nr, I as Tt, by as de, bA as E, du as Na, dv as Cr, L as P, J as Q, K as X, M as Z, N as ee, O as K, dw as Ie, B as Y, c3 as dt, dx as $a, dy as Zs, dz as el, dA as tl, dB as al, dC as ja, a1 as vt, X as Be, dD as Dn, c8 as In, m as Ht, n as Yt, o as Wt, p as Qt, q as xa, bX as nt, cz as He, cw as Ye, cx as Ge, cy as Ue, dE as Ns, dF as En, u as Ne, G as yn, dG as Xt, cd as da, cD as tt, dH as nl, c as ae, bZ as sl, dI as wr, dJ as Sr, dK as kr, dL as ga, dM as Tr, dN as ll, dO as Ar, cR as rl, dP as Dr, dQ as il, dR as Ir, dS as Mn, dT as Er, dU as Et, dV as Nt, dW as On, bJ as Mr, dX as Or, bQ as ua, bR as Kt, bS as Gt, bT as Ca, bU as bt, bV as _t, dY as vn, dZ as zt, d_ as Ze, d$ as $t, H as Zt, e0 as Fr, e1 as Ra, e2 as La, e3 as Pa, e4 as Fn, dp as ea, cG as wa, e5 as Rr, R as Sa, e6 as Rn, e7 as ma, ce as Ln, e8 as ol, r as Mt, bE as Lr, e9 as Pr, cK as Vr, ea as yt, eb as At, ec as Br, ed as Dt, e as Pn, cH as Vn, bs as cl, ee as Bn, ef as zr, eg as dl, eh as ul, ei as xt, dk as nn, ej as $r, ek as jr, el as ml, aa as hl, em as pl, en as qr, eo as Kr, ep as Gr, eq as qa, er as Ur, es as _r, et as Cs, eu as Jr, T as Ka, $ as zn, ev as Hr, ew as $n, cT as Yr, a2 as We, ex as Wr, ey as Qr, d6 as jn, d7 as qn, d8 as Vt, d9 as Ma, ez as Xr, dl as Zr, eA as fl, eB as ei, eC as ti, cu as Ga, cs as et, eD as ai, eE as ni, eF as ws, eG as si, P as ut, s as mt, t as ht, b_ as Kn, b$ as Gn, c1 as Un, cU as gl, c7 as Ut, eH as Ct, eI as jt, eJ as qt, eK as Ot, eL as ta, eM as li, av as ri, eN as ii, eO as oi, eP as ci, eQ as di, cF as Jt, eR as ui, eS as xl, eT as mi, eU as hi, l as ka, eV as pi, eW as bl, eX as fi, eY as gi, eZ as xi, e_ as bi, e$ as yi, f0 as vi, f1 as Nn, f2 as Ni, f3 as Ci, f4 as wi, f5 as Cn, f6 as Ss, f7 as Si, f8 as ki, f9 as Ti, fa as Ai, fb as Di, fc as yl, fd as _n, Q as Me, fe as ba, ff as Va, fg as Ii, fh as aa, fi as Te, fj as Ae, fk as De, fl as Ei, fm as Mi, fn as Oi, fo as Fi, fp as wt, fq as Ia, fr as ks, fs as Ri, dq as vl, S as Ee, ft as Li, fu as Pi, fv as Vi, v as na, w as sa, x as la, y as ra, z as ia, A as oa, fw as Bi, fx as zi, fy as Ts, fz as $i, E as ha, fA as ji, fB as sn, fC as As, fD as it, fE as qi, fF as Ki, fG as Gi, fH as Ui, fI as Ta, fJ as _i, fK as ln, fL as Nl, fM as Ji, fN as Hi, fO as Yi, fP as Ba, fQ as Wi, fR as Qi, fS as Bt, fT as Jn, fU as Hn, fV as Cl, fW as Xi, cr as wl, fX as Zi, fY as Ua, ds as eo, fZ as Le, f_ as Ds, bz as to, bu as ao, f$ as no, g0 as so, g1 as lo, g2 as ro, g3 as io, b1 as Is, g4 as Es, g5 as oo, g6 as co, g7 as Sl, g8 as uo, g9 as kl, ga as mo, gb as ho, gc as po, gd as fo, ge as go, gf as xo, gg as bo, gh as yo, gi as vo, gj as No, gk as Tl, gl as Co, gm as wo, gn as So, go as ko, gp as To, gq as Ao, gr as Do, gs as Al, c0 as Io, gt as Eo, gu as Mo, gv as Oo, gw as Fo, gx as Ro, gy as Dl, gz as Lo, c_ as Il, gA as _a, gB as El, gC as Ml, aS as Ea, gD as Ja, gE as Po, gF as Ol, gG as Ms, cA as Vo, gH as Os, gI as Bo, gJ as zo, gK as $o, gL as Oa, gM as jo, gN as Yn, gO as Fa, gP as qo, gQ as Ko, gR as za, gS as Go, C as Uo, gT as _o, gU as ya, gV as St, gW as wn, gX as Sn, gY as va, gZ as Fl, g_ as ca, a8 as Jo, g$ as Ho, h0 as rn, h1 as Yo, h2 as on, h3 as Wo, h4 as Fs, h5 as Qo, h6 as Xo, h7 as Zo, h8 as ec, c2 as rt, h9 as tc, ha as ac, hb as nc, hc as Ha, ca as Ya, hd as Rs, he as Rl, de as cn, hf as sc, hg as lc, hh as rc, U as ic } from "./index-D0TdW88i.js";
3
3
  import * as kn from "react";
4
4
  import Tn, { useState as _, useRef as at, useEffect as be, useCallback as Ke, useMemo as ie, useContext as Wn, Suspense as oc } from "react";
5
- import { C as cc, d as Qn, u as st } from "./editor-action-buttons-CAjqJiT_.js";
5
+ import { C as cc, d as Qn, u as st } from "./editor-action-buttons-CszdZ4Fw.js";
6
6
  import { createPortal as dc } from "react-dom";
7
7
  /**
8
8
  * @license lucide-react v0.453.0 - ISC
@@ -0,0 +1,11 @@
1
+ "use strict";const e=require("./index-DSA80lEg.js"),r=require("react/jsx-runtime"),h=require("./use-visual-utils-CzcVz3zB.js"),v=require("react");/**
2
+ * @license lucide-react v0.453.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const k=e.createLucideIcon("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
7
+ * @license lucide-react v0.453.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const x=e.createLucideIcon("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);function g(){var t,y;const o=e.useEditorStore(p=>p.card),u=e.useEditorStore(p=>p.frame),s=v.useMemo(()=>e.findCustomVisualConfigCard(u,o),[u,o]),{manifest:n}=e.useCustomVisual(((t=s==null?void 0:s.customCardPreferences)==null?void 0:t.url)||""),a=v.useMemo(()=>{var p;return(p=n==null?void 0:n.visuals)==null?void 0:p.find(l=>{var d;return l.name===((d=s==null?void 0:s.customCardPreferences)==null?void 0:d.componentName)})},[n,(y=s==null?void 0:s.customCardPreferences)==null?void 0:y.componentName]),i=e.resolveMultiInputType(s,a),c=v.useMemo(()=>e.getCustomVisualInputCards({frame:u,configCard:s,isMultiInputVisual:i==="multiple"}),[u,s,i]),m=v.useMemo(()=>{const p=c.findIndex(l=>(l==null?void 0:l.id)===o.id);return p<0?-1:e.getSlotIndexForCard(o,p)},[c,o]);return v.useMemo(()=>!s||i!=="multiple"||m<0?o.type:e.getEffectiveCardTypeForSlot(o,m,a==null?void 0:a.slots)??o.type,[s,i,m,o,a==null?void 0:a.slots])}function P(o,u){return{...o,sql:"",python:"",config:void 0,customCfg:"",preferences:{},interactionConfig:void 0,linkedInteractionTargetOverrides:void 0,customCardPreferences:u?o.customCardPreferences:void 0,type:u?o.type:"bar"}}function U({className:o,variant:u="outline"}){var m;const{setCardSql:s}=e.useEditorActions();e.useEditorStore(t=>t.frame);const n=e.useEditorStore(t=>t.card);h.useRemoteChartStore(((m=n.customCardPreferences)==null?void 0:m.url)||""),e.useEditorStore(t=>t.selectedSchemaName),e.useEditorStore(t=>t.selectedDatamodelId),e.useEditorStore(t=>t.selectedDatabaseName),e.useEditorStore(t=>t.selectedTableName),e.useEditorStore(t=>t.selectedConnectionId),e.useEditorStore(t=>t.isShowingVisual),n.sql;const a=e.useEditorStore(t=>t.onSave),{getUpdatedFrame:i}=h.useVisualUtils();function c(){const t=i();a==null||a(t)}return r.jsxs(e.Button,{onClick:c,className:e.cn("h-8",o),size:"sm",variant:u,children:[r.jsx(e.Check,{className:"mr-2 size-4 font-bold"}),"Accept"]})}function L({className:o,variant:u="default"}){const s=e.useQueryClient(),[n,a]=v.useState(!1),i=e.useDashboardStore(d=>d.actions.setIsDashboardPanelOpen),{setIsVisualEditing:c}=e.useDashboardActions(),{getUpdatedFrame:m}=h.useVisualUtils(),t=e.useSelectedVisual(),y=e.useEditorStore(d=>d.frame),p=e.useUpdateVisualMutation(),l=()=>{const d=m(),S=(y==null?void 0:y.visualId)||(t==null?void 0:t.id);if(!S){e.ue.error("No visual to save");return}a(!0),p.mutate({visualId:S,data:{frameObject:d}},{onSuccess:()=>{a(!1),i(!0),e.ue.success("Visual updated successfully"),s.invalidateQueries({queryKey:["resource-by-id","visual",S],exact:!0})},onError:()=>{a(!1),e.ue.error("Failed to update visual")}})};return r.jsxs(e.Button,{onClick:l,className:e.cn("h-8",o),size:"sm",variant:u,children:[n&&r.jsxs(r.Fragment,{children:[r.jsx(e.LoaderCircle,{className:"mr-2 size-4 animate-spin font-bold"})," Saving"]}),!n&&r.jsxs(r.Fragment,{children:[r.jsx(x,{className:"mr-2 size-4 font-bold"}),"Save to Library"]})]})}function K({className:o}){const u=e.useQueryClient(),[s,n]=v.useState(!1),a=e.useSelectedVisual(),i=e.useEditorStore(d=>d.frame),c=e.useDashboardStore(d=>d.selectedSheetId),{updateFrame:m,setIsVisualEditing:t}=e.useDashboardActions(),{getUpdatedFrame:y}=h.useVisualUtils(),p=e.useUpdateVisualMutation(),l=async()=>{if(!c){e.ue.error("No sheet selected");return}const d=(i==null?void 0:i.visualId)||(a==null?void 0:a.id);if(!d){e.ue.error("No visual to update");return}n(!0);try{const S=y();await p.mutateAsync({visualId:d,data:{frameObject:S}});const I={...S,visualId:d};m(c,I),u.invalidateQueries({queryKey:["visuals"]}),u.invalidateQueries({queryKey:["visual",d]}),e.ue.success("Saved to library and applied locally"),setTimeout(()=>{t(!1)},300)}catch(S){console.error("Failed to save and apply:",S),e.ue.error("Failed to save and apply changes")}finally{n(!1)}};return r.jsx(e.Button,{onClick:l,className:e.cn("h-8",o),size:"sm",variant:"default",disabled:s,children:s?r.jsxs(r.Fragment,{children:[r.jsx(e.LoaderCircle,{className:"mr-2 size-4 animate-spin font-bold"})," Saving..."]}):r.jsxs(r.Fragment,{children:[r.jsx(x,{className:"mr-2 size-4 font-bold"}),"Save & Apply"]})})}function O({className:o}){const{getUpdatedFrame:u}=h.useVisualUtils();e.useEditorStore(t=>t.frame);const s=e.useDashboardStore(t=>t.selectedSheetId),{updateFrame:n,setIsVisualEditing:a}=e.useDashboardActions(),[i,c]=v.useState(!1),m=()=>{if(!s){e.ue.error("No sheet selected");return}c(!0);const y={...u(),visualId:void 0};n(s,y),setTimeout(()=>{c(!1),e.ue.success("Changes applied. Visual is now local to this dashboard"),a(!1)},300)};return r.jsxs(e.Button,{onClick:m,className:e.cn("h-8",o),size:"sm",variant:"outline",children:[i&&r.jsxs(r.Fragment,{children:[r.jsx(e.LoaderCircle,{className:"mr-2 size-4 animate-spin font-bold"})," Applying"]}),!i&&r.jsxs(r.Fragment,{children:[r.jsx(e.Check,{className:"mr-2 size-4 font-bold"}),"Apply Locally"]})]})}function X({className:o}){const{setTempQueryData:u,setSqlGen:s}=e.useEditorActions(),n=e.useQueryClient(),a=e.useEditorStore(l=>l.tempQueryData),i=e.useEditorStore(l=>l.onClose),c=e.useEditorStore(l=>l.card),m=g(),t=v.useMemo(()=>m!==c.type?{...c,type:m}:c,[c,m]),{queryKey:y}=e.useDashboardCardQuery(t);function p(){if(a){const{queryKey:l,queryData:d}=a;l&&d&&n.setQueryData(l,d)}s({}),i==null||i()}return r.jsxs(e.Button,{onClick:p,className:e.cn("h-8",o),size:"sm",variant:"outline",children:[r.jsx(e.X,{className:"mr-2 size-4"}),"Close"]})}function w(){const{setTempQueryData:o}=e.useEditorActions(),u=e.useQueryClient();e.useEditorStore(C=>C.isDevMode);const s=e.useEditorStore(C=>C.tempQueryData),n=e.useEditorStore(C=>C.card),a=g(),i=v.useMemo(()=>a!==n.type?{...n,type:a}:n,[n,a]),{queryKey:c}=e.useDashboardCardQuery(i),{setCardSql:m,setSqlGen:t,setCardPython:y,setCardCustomCfg:p,setCardPreferences:l,updateDataSource:d,clearQueryConfig:S,setCardConfig:I,setCardType:z,setFrame:B,setCard:Q,setActiveTabCardId:M}=e.useEditorActions();function T(){var A,F,j,D;const C=u.getQueryData(c);s!=null&&s.queryData||o({queryKey:c,queryData:C}),u.setQueryData(c,null),u.removeQueries({queryKey:c,exact:!0}),m(""),t({}),S(),I(void 0),y(""),p(""),l({});const b=e.useEditorStore.getState().frame,V=e.useEditorStore.getState().card,f=e.findCustomVisualConfigCard(b,V),q=((A=f==null?void 0:f.customCardPreferences)==null?void 0:A.visualType)==="multiple"||!!((F=f==null?void 0:f.customCardPreferences)!=null&&F.dataInputCardIds)||(((j=f==null?void 0:f.customCardPreferences)==null?void 0:j.minInputs)||0)>1||(((D=f==null?void 0:f.customCardPreferences)==null?void 0:D.maxInputs)||0)>1,E=P(V,q);B({...b,cards:b.cards.map(N=>N.id===E.id?E:N)}),M(E.id),Q(E),q||z("bar")}return r.jsxs(e.Button,{onClick:T,className:"h-8",size:"sm",variant:"secondary",children:[r.jsx(e.X,{className:"mr-2 size-3.5"}),"Clear"]})}exports.CircleX=k;exports.EditorAcceptButton=U;exports.EditorCancelButton=X;exports.EditorClearButton=w;exports.Save=x;exports.VisualApplyLocalButton=O;exports.VisualSaveAndApplyButton=K;exports.VisualSaveButton=L;exports.useEffectiveEditorCardType=g;