react-semaphor 0.1.210 → 0.1.211

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 (32) hide show
  1. package/dist/chunks/{dashboard-controls-C08300Wi.js → dashboard-controls-7KpXzAWL.js} +592 -585
  2. package/dist/chunks/dashboard-controls-CnDq9Uh_.js +42 -0
  3. package/dist/chunks/{dashboard-json-GjDBGO26.js → dashboard-json-dqey5VK0.js} +1 -1
  4. package/dist/chunks/{dashboard-json-DlEE5-WA.js → dashboard-json-stWvjp2O.js} +1 -1
  5. package/dist/chunks/{dashboard-summary-settings-dialog-THx-gjnG.js → dashboard-summary-settings-dialog-DPEe6XBC.js} +1 -1
  6. package/dist/chunks/{dashboard-summary-settings-dialog-QUuhhXU9.js → dashboard-summary-settings-dialog-DuxhidK1.js} +1 -1
  7. package/dist/chunks/{edit-dashboard-visual-Bsmow1Pa.js → edit-dashboard-visual-CQAk_UsI.js} +483 -484
  8. package/dist/chunks/{edit-dashboard-visual-PfWJXb2-.js → edit-dashboard-visual-D_XPr8f8.js} +2 -2
  9. package/dist/chunks/{editor-action-buttons-FPyaC09X.js → editor-action-buttons-CH7W6KdH.js} +1 -1
  10. package/dist/chunks/{editor-action-buttons-DNbp_ZWy.js → editor-action-buttons-D34_GSZu.js} +27 -27
  11. package/dist/chunks/{index-CAVrkf9d.js → index-BDS2sWhv.js} +27718 -27508
  12. package/dist/chunks/index-BfiIPyeS.js +1109 -0
  13. package/dist/chunks/{notification-bell-C3a7wC1u.js → notification-bell-Cu3qDd9V.js} +251 -285
  14. package/dist/chunks/notification-bell-hijGST9g.js +6 -0
  15. package/dist/chunks/{resource-management-panel-BVTgbma8.js → resource-management-panel-BvHqslqC.js} +73 -73
  16. package/dist/chunks/{resource-management-panel-C5NjrVsA.js → resource-management-panel-gK3a6OEj.js} +1 -1
  17. package/dist/chunks/{use-role-aware-display-preferences-l7NFLYnn.js → use-role-aware-display-preferences-BlR29aKQ.js} +1 -1
  18. package/dist/chunks/{use-role-aware-display-preferences-DxCPoCgr.js → use-role-aware-display-preferences-a5FH9Y0k.js} +1 -1
  19. package/dist/chunks/{use-visual-utils-B82Q-Ytl.js → use-visual-utils-B11AA2fd.js} +1 -1
  20. package/dist/chunks/{use-visual-utils-D9IJz9R0.js → use-visual-utils-ptPsQ3nC.js} +23 -23
  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 +251 -216
  25. package/dist/style.css +1 -1
  26. package/dist/surfboard/index.cjs +1 -1
  27. package/dist/surfboard/index.js +2 -2
  28. package/dist/types/main.d.ts +49 -0
  29. package/package.json +1 -1
  30. package/dist/chunks/dashboard-controls-BAOrAMV9.js +0 -42
  31. package/dist/chunks/index-CXKjmjfB.js +0 -1104
  32. package/dist/chunks/notification-bell-BqvKQSw9.js +0 -6
@@ -1,5 +1,5 @@
1
- import { bI as G, l as J, bJ as K, bK as Y, bL as X, by as _, bs as Z, u as v, bM as q, bN as ee, I as V, bO as te, bA as f } from "./index-CAVrkf9d.js";
2
- import { useState as j, useEffect as re, useCallback as A } from "react";
1
+ import { T as G, l as Y, U as J, V as K, W as Z, Y as _, Z as X, u as v, _ as q, $ as ee, I as V, a0 as te, a1 as f } from "./index-BDS2sWhv.js";
2
+ import { useState as j, useEffect as re, useCallback as D } from "react";
3
3
  function se(e) {
4
4
  const a = e.toUpperCase().indexOf("WHERE"), t = e.toUpperCase().indexOf("GROUP BY"), r = e.toUpperCase().indexOf("LIMIT"), s = e.toUpperCase().indexOf("ORDER BY");
5
5
  let n = e.length;
@@ -154,7 +154,7 @@ function ie() {
154
154
  ), d = f((c) => c.selectedTableName), m = f(
155
155
  (c) => c.selectedConnectionId
156
156
  ), h = f((c) => c.isShowingVisual), p = t.sql;
157
- return { getUpdatedFrame: A(() => {
157
+ return { getUpdatedFrame: D(() => {
158
158
  var I;
159
159
  let c = p;
160
160
  p && !p.includes("{{") && (c = se(p), e(c));
@@ -204,7 +204,7 @@ function ie() {
204
204
  ]) };
205
205
  }
206
206
  function ue() {
207
- const { authToken: e, tokenProps: a } = J(), t = K(), r = Y(), { selectVisual: s } = X(), {
207
+ const { authToken: e, tokenProps: a } = Y(), t = J(), r = K(), { selectVisual: s } = Z(), {
208
208
  setFrame: n,
209
209
  setCard: i,
210
210
  setIsDevMode: o,
@@ -221,17 +221,17 @@ function ue() {
221
221
  setApplyFilters: I
222
222
  } = _(), {
223
223
  setIsDashboardEditing: b,
224
- setIsVisualEditing: D,
225
- setSelectedFrameId: N,
226
- clearSelectedFrameId: O,
227
- addFrame: M,
228
- setIsDashboardPanelOpen: T
229
- } = Z(), y = v((l) => l.selectedSheetId), x = v((l) => l.selectedFrameId), B = v((l) => l.dashboard), L = v((l) => l.filterValues), E = q((r == null ? void 0 : r.id) || "", {
224
+ setIsVisualEditing: T,
225
+ setSelectedFrameId: A,
226
+ clearSelectedFrameId: N,
227
+ addFrame: O,
228
+ setIsDashboardPanelOpen: W
229
+ } = X(), y = v((l) => l.selectedSheetId), x = v((l) => l.selectedFrameId), B = v((l) => l.dashboard), M = v((l) => l.filterValues), E = q((r == null ? void 0 : r.id) || "", {
230
230
  enabled: !!(r != null && r.id) && !!(e != null && e.accessToken)
231
- }), Q = A(
231
+ }), Q = D(
232
232
  async (l) => {
233
233
  try {
234
- s(l), O();
234
+ s(l), N();
235
235
  const { data: g, fromCache: u } = await k(
236
236
  a.apiServiceUrl,
237
237
  (e == null ? void 0 : e.accessToken) || "",
@@ -254,11 +254,11 @@ function ue() {
254
254
  setFilterValues: w,
255
255
  setApplyFilters: I,
256
256
  setIsDashboardEditing: b,
257
- setIsVisualEditing: D,
257
+ setIsVisualEditing: T,
258
258
  dashboard: B,
259
259
  selectedSheetId: y,
260
260
  selectedFrameId: x,
261
- filterValues: L
261
+ filterValues: M
262
262
  }))
263
263
  throw new Error("Failed to setup editor with visual data");
264
264
  return { success: !0, fromCache: u };
@@ -274,7 +274,7 @@ function ue() {
274
274
  n,
275
275
  i,
276
276
  b,
277
- D,
277
+ T,
278
278
  o,
279
279
  d,
280
280
  m,
@@ -287,13 +287,13 @@ function ue() {
287
287
  U,
288
288
  w,
289
289
  I,
290
- O,
290
+ N,
291
291
  B,
292
292
  y,
293
293
  x,
294
- L
294
+ M
295
295
  ]
296
- ), z = A(
296
+ ), z = D(
297
297
  async (l) => {
298
298
  var g;
299
299
  try {
@@ -313,12 +313,12 @@ function ue() {
313
313
  const F = H(R);
314
314
  if (!(F != null && F.cards) || F.cards.length === 0)
315
315
  return { success: !1, error: "Visual frame is malformed" };
316
- const W = {
316
+ const L = {
317
317
  ...ee(F),
318
318
  visualId: l.id
319
319
  // Link this frame to the library visual
320
320
  };
321
- return M(y, W, "end"), b(!0), N(W.id), T(!1), { success: !0, fromCache: P };
321
+ return O(y, L, "end"), b(!0), A(L.id), W(!1), { success: !0, fromCache: P };
322
322
  } catch (u) {
323
323
  return console.error("Error adding visual:", u), { success: !1, error: "Failed to add visual to dashboard" };
324
324
  }
@@ -329,10 +329,10 @@ function ue() {
329
329
  t,
330
330
  s,
331
331
  y,
332
- M,
332
+ O,
333
333
  b,
334
- N,
335
- T
334
+ A,
335
+ W
336
336
  ]
337
337
  );
338
338
  return {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-CXKjmjfB.js"),o=require("../chunks/common-types-CfJLrTJd.js");exports.Dashboard=e.Dashboard;exports.EMPTY_SELECTION=o.EMPTY_SELECTION;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-BfiIPyeS.js"),o=require("../chunks/common-types-CfJLrTJd.js");exports.Dashboard=e.Dashboard;exports.EMPTY_SELECTION=o.EMPTY_SELECTION;
@@ -1,4 +1,4 @@
1
- import { D as a } from "../chunks/index-CAVrkf9d.js";
1
+ import { D as a } from "../chunks/index-BDS2sWhv.js";
2
2
  import { E as s } from "../chunks/common-types-DhqlRVrq.js";
3
3
  export {
4
4
  a as Dashboard,
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-CXKjmjfB.js"),v=require("./chunks/common-types-CfJLrTJd.js"),E=require("./chunks/dashboard-summary-settings-dialog-QUuhhXU9.js"),t=require("react/jsx-runtime"),C=require("react"),N=require("./chunks/resource-management-panel-C5NjrVsA.js"),P=require("./types/index.cjs"),D=require("./chunks/normalize-dashboard-for-dirty-check-D9x96J2F.js");require("react-dom");const c=require("./chunks/notification-bell-BqvKQSw9.js");function M(r){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const o in r)if(o!=="default"){const i=Object.getOwnPropertyDescriptor(r,o);Object.defineProperty(a,o,i.get?i:{enumerable:!0,get:()=>r[o]})}}return a.default=r,Object.freeze(a)}const A=M(C);function _(r){const{displayPreferences:a,...o}=r,i={...o,id:r.dashboardId};return t.jsx(e.ErrorBoundary,{FallbackComponent:e.Fallback,children:t.jsxs(e.SemaphorContextProvider,{dashboardProps:i,children:[t.jsx(e.SemaphorReadyIndicator,{componentType:"visual",componentId:r.cardId}),t.jsx(e.UXProvider,{children:t.jsx(e.DisplayPreferencesProvider,{displayPreferences:a,children:t.jsx(e.Container,{type:"visual",...i,children:t.jsx(I,{cardId:r.cardId})})})})]})})}function I({cardId:r}){const a=e.useDashboardStore(n=>{var l;return(l=n.dashboard)==null?void 0:l.sheets}),{card:o,frame:i}=C.useMemo(()=>{const n=a==null?void 0:a.flatMap(s=>s.frames),l=n==null?void 0:n.flatMap(s=>s==null?void 0:s.cards),x=l==null?void 0:l.find(s=>(s==null?void 0:s.id)===r),u=n==null?void 0:n.find(s=>{var p;return(p=s==null?void 0:s.cards)==null?void 0:p.find(m=>(m==null?void 0:m.id)===r)});return{card:x,frame:u}},[a,r]);return!o||!i?t.jsx(e.FallbackVisual,{error:new Error("Card not found"),resetErrorBoundary:()=>{},customerFacingMessage:`Card not found with ID: ${r}`}):t.jsx("main",{className:"flex h-full grow flex-col",children:t.jsx(e.ErrorBoundary,{FallbackComponent:({error:n,resetErrorBoundary:l})=>t.jsx(e.FallbackVisual,{error:n,resetErrorBoundary:l,customerFacingMessage:"Error creating visual. Please try again."}),children:t.jsx(e.DashboardCard,{card:o,frame:i})})})}function R({name:r,items:a,value:o,onChange:i,isLoading:n,isError:l,refetch:x,className:u,icon:s,showNone:p=!1}){const m=A.useRef(null),[f,y]=A.useState(!1),[S,b]=A.useState("100%"),g=p?[...a||[],{id:"none",name:"None"}]:a;A.useLayoutEffect(()=>{m.current&&b(m.current.offsetWidth)},[]);function T(){var d;return n?"Loading...":l?"Error":o?(d=a==null?void 0:a.find(h=>h.id===o))==null?void 0:d.name:`Select ${r}`}function j(d,h){i(h),y(!1)}return t.jsxs(e.Popover,{open:f,onOpenChange:y,children:[t.jsx(e.PopoverTrigger,{asChild:!0,children:t.jsxs(e.Button,{ref:m,variant:"outline",role:"combobox","aria-expanded":f,className:e.cn("flex h-9 w-full justify-between",u),children:[t.jsxs("div",{className:"flex items-center gap-2",children:[s&&t.jsx("div",{className:"mr-2",children:s}),t.jsx("span",{className:"max-w-[150px] overflow-hidden truncate text-ellipsis whitespace-nowrap",children:T()})]}),t.jsx(e.ChevronDown,{className:"size-4 opacity-50"})]})}),t.jsx(e.PopoverContent,{className:"w-full p-0",style:{minWidth:S},children:t.jsxs(e.Command,{children:[t.jsxs("div",{className:"flex h-9 items-center justify-between border-b pr-1",children:[t.jsx(e.CommandInput,{className:"h-9",placeholder:"Search..."}),t.jsx(e.IconButton,{className:"h-7",onClick:x,children:t.jsx(e.RefreshCw,{className:e.cn("size-3.5 opacity-50",n&&"animate-spin")})})]}),t.jsxs(e.CommandList,{children:[t.jsxs(e.CommandEmpty,{children:["No ",r==null?void 0:r.toLowerCase()," found."]}),t.jsx(e.CommandGroup,{children:g==null?void 0:g.map(d=>t.jsx(e.CommandItem,{className:"overflow-x-auto",value:d.name,onSelect:h=>j(h,d.id),children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(e.Check,{className:e.cn("size-4",o===d.id?"opacity-100":"opacity-0")}),t.jsx("div",{title:d.name,children:d.name})]})},d.id))})]})]})})]})}function F(r,a){C.useEffect(()=>(r&&a&&(window.__SEMAPHOR_PRINT_STATE__={...a}),()=>{r&&window.__SEMAPHOR_PRINT_STATE__&&delete window.__SEMAPHOR_PRINT_STATE__}),[r,a])}function w(){var l,x;const{quotasQuery:r,usageQuery:a}=e.useAlertQuotas(),o=((l=r.data)==null?void 0:l.quotas)||[],i=((x=a.data)==null?void 0:x.usage)||[],n=new Map(i.map(u=>[u.tenantId||"org",u]));return t.jsxs("div",{className:"space-y-4 p-4",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h2",{className:"text-xl font-semibold",children:"Alert Quotas"}),t.jsx(e.Button,{variant:"outline",size:"sm",onClick:()=>{r.refetch(),a.refetch()},children:"Refresh"})]}),r.isLoading||a.isLoading?t.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading quota usage..."}):null,t.jsx("div",{className:"overflow-hidden rounded-lg border",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{className:"bg-muted/40",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Tenant"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Active Alerts"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Max Active"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Min Cadence"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Max Context Sources"})]})}),t.jsx("tbody",{children:o.map(u=>{const s=u.tenantId||"org",p=n.get(s);return t.jsxs("tr",{className:"border-t",children:[t.jsx("td",{className:"px-3 py-2",children:s}),t.jsx("td",{className:"px-3 py-2",children:(p==null?void 0:p.activeAlerts)??0}),t.jsx("td",{className:"px-3 py-2",children:u.policy.maxActiveAlerts}),t.jsxs("td",{className:"px-3 py-2",children:[u.policy.minCadenceMinutes," min"]}),t.jsx("td",{className:"px-3 py-2",children:u.policy.maxContextSources})]},s)})})]})})]})}exports.AlertCreationDialog=e.AlertCreationDialog;exports.AlertManagementPage=e.AlertManagementPage;exports.AlertsApiError=e.AlertsApiError;exports.CALCULATED_FIELD_ENTITY_MARKER=e.CALCULATED_FIELD_ENTITY_MARKER;exports.CardAlertIndicator=e.CardAlertIndicator;exports.CardSummary=e.CardSummary;exports.DATE_FORMAT_VALUES=e.DATE_FORMAT_VALUES;exports.Dashboard=e.Dashboard;exports.DashboardExportDialog=e.DashboardExportDialog;exports.DashboardWC=e.DashboardWC;exports.ExportError=e.ExportError;exports.PivotMarkerEnum=e.PivotMarkerEnum;exports.ResourceType=e.ResourceType;exports.SemaphorContextProvider=e.SemaphorContextProvider;exports.SemaphorDataProvider=e.SemaphorQueryClient;exports.SemaphorQueryClient=e.SemaphorQueryClient;exports.ShareDialog=e.ShareDialog;exports.SummaryCard=e.SummaryCard;exports.Surfboard=e.DashboardPlus;exports.backtestAlert=e.backtestAlert;exports.cancelExport=e.cancelExport;exports.cloneDeep=e.cloneDeep;exports.createAlert=e.createAlert;exports.createEmptyKpiConfig=e.createEmptyKpiConfig;exports.createExport=e.createExport;exports.createSqlGenConfig=e.createSqlGenConfig;exports.deleteAlert=e.deleteAlert;exports.downloadPdf=e.downloadPdf;exports.emitDashboardLoad=e.emitDashboardLoad;exports.emitDashboardUnload=e.emitDashboardUnload;exports.fmt=e.fmt;exports.formatFileSize=e.formatFileSize;exports.getAlert=e.getAlert;exports.getAlertContextSources=e.getAlertContextSources;exports.getAlertHistory=e.getAlertHistory;exports.getAlertQuotaUsage=e.getAlertQuotaUsage;exports.getAlertRunDeliveries=e.getAlertRunDeliveries;exports.getAlertRunSteps=e.getAlertRunSteps;exports.getAlertRuns=e.getAlertRuns;exports.getAlertState=e.getAlertState;exports.getColumnDataType=e.getColumnDataType;exports.getDownloadUrl=e.getDownloadUrl;exports.getExportStatus=e.getExportStatus;exports.getExports=e.getExports;exports.getFilterValueType=e.getFilterValueType;exports.getFormattedTableNameForQuery=e.getFormattedTableNameForQuery;exports.getQualifiedTableName=e.getQualifiedTableName;exports.getSql=e.getSql;exports.interpretAlertContext=e.interpretAlertContext;exports.invalidateToken=e.invalidateToken;exports.isBooleanDataType=e.isBooleanDataType;exports.isCalculatedDimension=e.isCalculatedDimension;exports.isCalculatedField=e.isCalculatedField;exports.isCalculatedMetric=e.isCalculatedMetric;exports.isColumnInSqlGen=e.isColumnInSqlGen;exports.isDateDataType=e.isDateDataType;exports.isExportComplete=e.isExportComplete;exports.isExportInProgress=e.isExportInProgress;exports.isNumberDataType=e.isNumberDataType;exports.isTextDataType=e.isTextDataType;exports.listAlertQuotas=e.listAlertQuotas;exports.listAlerts=e.listAlerts;exports.previewAlertDeliverable=e.previewAlertDeliverable;exports.resolveDataType=e.resolveDataType;exports.resolveDatamodelName=e.resolveDatamodelName;exports.triggerAlertNow=e.triggerAlertNow;exports.updateAlert=e.updateAlert;exports.updateAlertContextSources=e.updateAlertContextSources;exports.updateAlertQuota=e.updateAlertQuota;exports.useActiveExports=e.useActiveExports;exports.useAlertActions=e.useAlertActions;exports.useAlertBacktest=e.useAlertBacktest;exports.useAlertContextBuilder=e.useAlertContextBuilder;exports.useAlertDeliveries=e.useAlertDeliveries;exports.useAlertDetail=e.useAlertDetail;exports.useAlertDraft=e.useAlertDraft;exports.useAlertFilters=e.useAlertFilters;exports.useAlertHistory=e.useAlertHistory;exports.useAlertQuotas=e.useAlertQuotas;exports.useAlertRuns=e.useAlertRuns;exports.useAlertState=e.useAlertState;exports.useAlertStore=e.useAlertStore;exports.useAlerts=e.useAlerts;exports.useAlertsBootstrap=e.useAlertsBootstrap;exports.useAlertsById=e.useAlertsById;exports.useAlertsForCard=e.useAlertsForCard;exports.useCard=e.useCard;exports.useCardAlertMap=e.useCardAlertMap;exports.useCardSummary=e.useCardSummary;exports.useCurrentActiveCard=e.useCurrentActiveCard;exports.useCurrentCardConfig=e.useCurrentCardConfig;exports.useCurrentSheetActiveCards=e.useCurrentSheetActiveCards;exports.useDashboardActions=e.useDashboardActions;exports.useDashboardById=e.useDashboardById;exports.useDashboardQuery=e.useDashboardQuery;exports.useDashboardStore=e.useDashboardStore;exports.useDashboardSummary=e.useDashboardSummary;exports.useDataColumns=e.useDataColumns;exports.useDateFilterHook=e.useDateFilterHook;exports.useEditorActions=e.useEditorActions;exports.useEditorAside=e.useEditorAside;exports.useEditorStore=e.useEditorStore;exports.useExportActions=e.useExportActions;exports.useExportStore=e.useExportStore;exports.useInProgressExportsCount=e.useInProgressExportsCount;exports.useManagementStore=e.useManagementStore;exports.useResourceManagement=e.useResourceManagement;exports.useSelectedAlertId=e.useSelectedAlertId;exports.useTextFilterHook=e.useTextFilterHook;exports.EMPTY_SELECTION=v.EMPTY_SELECTION;exports.CalendarPreferencesDialog=E.CalendarPreferencesDialog;exports.DashboardSummarySettingsDialog=E.DashboardSummarySettingsDialog;exports.ResourceManagementPanel=N.ResourceManagementPanel;exports.DEFAULT_CALENDAR_CONTEXT=P.DEFAULT_CALENDAR_CONTEXT;exports.normalizeDashboardForDirtyCheck=D.normalizeDashboardForDirtyCheck;exports.serializeDashboardForDirtyCheck=D.serializeDashboardForDirtyCheck;exports.useDebouncedDirtyCheck=D.useDebouncedDirtyCheck;exports.AdvancedModeToggle=c.AdvancedModeToggle;exports.ExportNotificationItem=c.ExportNotificationItem;exports.ExportNotificationList=c.ExportNotificationList;exports.NotificationBell=c.NotificationBell;exports.ScheduleDashboard=c.ScheduleDashboard;exports.UnsavedChangesAlert=c.UnsavedChangesAlert;exports.VisualEditingControls=c.VisualEditingControls;exports.useExportPolling=c.useExportPolling;exports.useExportRecovery=c.useExportRecovery;exports.usePristineSnapshotInitializer=c.usePristineSnapshotInitializer;exports.Combobox=R;exports.TenantQuotaPage=w;exports.Visual=_;exports.useExposePrintState=F;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-BfiIPyeS.js"),T=require("./chunks/common-types-CfJLrTJd.js"),E=require("./chunks/dashboard-summary-settings-dialog-DuxhidK1.js"),t=require("react/jsx-runtime"),g=require("react"),v=require("./chunks/resource-management-panel-gK3a6OEj.js"),P=require("./types/index.cjs"),D=require("./chunks/normalize-dashboard-for-dirty-check-D9x96J2F.js");require("react-dom");const m=require("./chunks/notification-bell-hijGST9g.js");function M(r){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const n in r)if(n!=="default"){const i=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(a,n,i.get?i:{enumerable:!0,get:()=>r[n]})}}return a.default=r,Object.freeze(a)}const A=M(g);function I(r){const{displayPreferences:a,...n}=r,i={...n,id:r.dashboardId};return t.jsx(e.ErrorBoundary,{FallbackComponent:e.Fallback,children:t.jsxs(e.SemaphorContextProvider,{dashboardProps:i,children:[t.jsx(e.SemaphorReadyIndicator,{componentType:"visual",componentId:r.cardId}),t.jsx(e.UXProvider,{children:t.jsx(e.DisplayPreferencesProvider,{displayPreferences:a,children:t.jsx(e.Container,{type:"visual",...i,children:t.jsx(_,{cardId:r.cardId})})})})]})})}function _({cardId:r}){const a=e.useDashboardStore(o=>{var u;return(u=o.dashboard)==null?void 0:u.sheets}),{card:n,frame:i}=g.useMemo(()=>{const o=a==null?void 0:a.flatMap(s=>s.frames),u=o==null?void 0:o.flatMap(s=>s==null?void 0:s.cards),d=u==null?void 0:u.find(s=>(s==null?void 0:s.id)===r),l=o==null?void 0:o.find(s=>{var p;return(p=s==null?void 0:s.cards)==null?void 0:p.find(h=>(h==null?void 0:h.id)===r)});return{card:d,frame:l}},[a,r]);return!n||!i?t.jsx(e.FallbackVisual,{error:new Error("Card not found"),resetErrorBoundary:()=>{},customerFacingMessage:`Card not found with ID: ${r}`}):t.jsx("main",{className:"flex h-full grow flex-col",children:t.jsx(e.ErrorBoundary,{FallbackComponent:({error:o,resetErrorBoundary:u})=>t.jsx(e.FallbackVisual,{error:o,resetErrorBoundary:u,customerFacingMessage:"Error creating visual. Please try again."}),children:t.jsx(e.DashboardCard,{card:n,frame:i})})})}function F({name:r,items:a,value:n,onChange:i,isLoading:o,isError:u,refetch:d,className:l,icon:s,showNone:p=!1}){const h=A.useRef(null),[f,y]=A.useState(!1),[S,b]=A.useState("100%"),C=p?[...a||[],{id:"none",name:"None"}]:a;A.useLayoutEffect(()=>{h.current&&b(h.current.offsetWidth)},[]);function N(){var c;return o?"Loading...":u?"Error":n?(c=a==null?void 0:a.find(x=>x.id===n))==null?void 0:c.name:`Select ${r}`}function j(c,x){i(x),y(!1)}return t.jsxs(e.Popover,{open:f,onOpenChange:y,children:[t.jsx(e.PopoverTrigger,{asChild:!0,children:t.jsxs(e.Button,{ref:h,variant:"outline",role:"combobox","aria-expanded":f,className:e.cn("flex h-9 w-full justify-between",l),children:[t.jsxs("div",{className:"flex items-center gap-2",children:[s&&t.jsx("div",{className:"mr-2",children:s}),t.jsx("span",{className:"max-w-[150px] overflow-hidden truncate text-ellipsis whitespace-nowrap",children:N()})]}),t.jsx(e.ChevronDown,{className:"size-4 opacity-50"})]})}),t.jsx(e.PopoverContent,{className:"w-full p-0",style:{minWidth:S},children:t.jsxs(e.Command,{children:[t.jsxs("div",{className:"flex h-9 items-center justify-between border-b pr-1",children:[t.jsx(e.CommandInput,{className:"h-9",placeholder:"Search..."}),t.jsx(e.IconButton,{className:"h-7",onClick:d,children:t.jsx(e.RefreshCw,{className:e.cn("size-3.5 opacity-50",o&&"animate-spin")})})]}),t.jsxs(e.CommandList,{children:[t.jsxs(e.CommandEmpty,{children:["No ",r==null?void 0:r.toLowerCase()," found."]}),t.jsx(e.CommandGroup,{children:C==null?void 0:C.map(c=>t.jsx(e.CommandItem,{className:"overflow-x-auto",value:c.name,onSelect:x=>j(x,c.id),children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(e.Check,{className:e.cn("size-4",n===c.id?"opacity-100":"opacity-0")}),t.jsx("div",{title:c.name,children:c.name})]})},c.id))})]})]})})]})}function R({triggerButtonClassName:r,variant:a="ghost"}){const[n,i]=g.useState(!1),o=e.useDashboardStore(d=>{var l;return(l=d.dashboard)==null?void 0:l.id}),u=e.useDashboardStore(d=>{var l;return(l=d.dashboard)==null?void 0:l.title});return o?t.jsxs(t.Fragment,{children:[t.jsx(e.IconButton,{tooltip:"Schedule Dashboard",className:e.cn("h-7 p-2",r),buttonProps:{variant:a},onClick:()=>i(!0),children:t.jsx(e.Clock,{className:"size-4"})}),t.jsx(e.EmailScheduleDialog,{open:n,onOpenChange:i,dashboardId:o,dashboardName:u})]}):null}function w(r,a){g.useEffect(()=>(r&&a&&(window.__SEMAPHOR_PRINT_STATE__={...a}),()=>{r&&window.__SEMAPHOR_PRINT_STATE__&&delete window.__SEMAPHOR_PRINT_STATE__}),[r,a])}function k(){var u,d;const{quotasQuery:r,usageQuery:a}=e.useAlertQuotas(),n=((u=r.data)==null?void 0:u.quotas)||[],i=((d=a.data)==null?void 0:d.usage)||[],o=new Map(i.map(l=>[l.tenantId||"org",l]));return t.jsxs("div",{className:"space-y-4 p-4",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h2",{className:"text-xl font-semibold",children:"Alert Quotas"}),t.jsx(e.Button,{variant:"outline",size:"sm",onClick:()=>{r.refetch(),a.refetch()},children:"Refresh"})]}),r.isLoading||a.isLoading?t.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading quota usage..."}):null,t.jsx("div",{className:"overflow-hidden rounded-lg border",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{className:"bg-muted/40",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Tenant"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Active Alerts"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Max Active"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Min Cadence"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Max Context Sources"})]})}),t.jsx("tbody",{children:n.map(l=>{const s=l.tenantId||"org",p=o.get(s);return t.jsxs("tr",{className:"border-t",children:[t.jsx("td",{className:"px-3 py-2",children:s}),t.jsx("td",{className:"px-3 py-2",children:(p==null?void 0:p.activeAlerts)??0}),t.jsx("td",{className:"px-3 py-2",children:l.policy.maxActiveAlerts}),t.jsxs("td",{className:"px-3 py-2",children:[l.policy.minCadenceMinutes," min"]}),t.jsx("td",{className:"px-3 py-2",children:l.policy.maxContextSources})]},s)})})]})})]})}exports.AlertCreationDialog=e.AlertCreationDialog;exports.AlertManagementPage=e.AlertManagementPage;exports.AlertsApiError=e.AlertsApiError;exports.CALCULATED_FIELD_ENTITY_MARKER=e.CALCULATED_FIELD_ENTITY_MARKER;exports.CardAlertIndicator=e.CardAlertIndicator;exports.CardSummary=e.CardSummary;exports.DATE_FORMAT_VALUES=e.DATE_FORMAT_VALUES;exports.Dashboard=e.Dashboard;exports.DashboardExportDialog=e.DashboardExportDialog;exports.DashboardWC=e.DashboardWC;exports.EmailScheduleDialog=e.EmailScheduleDialog;exports.ExportError=e.ExportError;exports.PivotMarkerEnum=e.PivotMarkerEnum;exports.ResourceType=e.ResourceType;exports.SemaphorContextProvider=e.SemaphorContextProvider;exports.SemaphorDataProvider=e.SemaphorQueryClient;exports.SemaphorQueryClient=e.SemaphorQueryClient;exports.ShareDialog=e.ShareDialog;exports.SummaryCard=e.SummaryCard;exports.Surfboard=e.DashboardPlus;exports.backtestAlert=e.backtestAlert;exports.cancelExport=e.cancelExport;exports.cloneDeep=e.cloneDeep;exports.createAlert=e.createAlert;exports.createEmptyKpiConfig=e.createEmptyKpiConfig;exports.createExport=e.createExport;exports.createSqlGenConfig=e.createSqlGenConfig;exports.deleteAlert=e.deleteAlert;exports.downloadPdf=e.downloadPdf;exports.emitDashboardLoad=e.emitDashboardLoad;exports.emitDashboardUnload=e.emitDashboardUnload;exports.fmt=e.fmt;exports.formatFileSize=e.formatFileSize;exports.getAlert=e.getAlert;exports.getAlertContextSources=e.getAlertContextSources;exports.getAlertHistory=e.getAlertHistory;exports.getAlertQuotaUsage=e.getAlertQuotaUsage;exports.getAlertRunDeliveries=e.getAlertRunDeliveries;exports.getAlertRunSteps=e.getAlertRunSteps;exports.getAlertRuns=e.getAlertRuns;exports.getAlertState=e.getAlertState;exports.getColumnDataType=e.getColumnDataType;exports.getDownloadUrl=e.getDownloadUrl;exports.getExportStatus=e.getExportStatus;exports.getExports=e.getExports;exports.getFilterValueType=e.getFilterValueType;exports.getFormattedTableNameForQuery=e.getFormattedTableNameForQuery;exports.getQualifiedTableName=e.getQualifiedTableName;exports.getSql=e.getSql;exports.interpretAlertContext=e.interpretAlertContext;exports.invalidateToken=e.invalidateToken;exports.isBooleanDataType=e.isBooleanDataType;exports.isCalculatedDimension=e.isCalculatedDimension;exports.isCalculatedField=e.isCalculatedField;exports.isCalculatedMetric=e.isCalculatedMetric;exports.isColumnInSqlGen=e.isColumnInSqlGen;exports.isDateDataType=e.isDateDataType;exports.isExportComplete=e.isExportComplete;exports.isExportInProgress=e.isExportInProgress;exports.isNumberDataType=e.isNumberDataType;exports.isTextDataType=e.isTextDataType;exports.listAlertQuotas=e.listAlertQuotas;exports.listAlerts=e.listAlerts;exports.previewAlertDeliverable=e.previewAlertDeliverable;exports.resolveDataType=e.resolveDataType;exports.resolveDatamodelName=e.resolveDatamodelName;exports.triggerAlertNow=e.triggerAlertNow;exports.updateAlert=e.updateAlert;exports.updateAlertContextSources=e.updateAlertContextSources;exports.updateAlertQuota=e.updateAlertQuota;exports.useActiveExports=e.useActiveExports;exports.useAddNewFrame=e.useAddNewFrame;exports.useAlertActions=e.useAlertActions;exports.useAlertBacktest=e.useAlertBacktest;exports.useAlertContextBuilder=e.useAlertContextBuilder;exports.useAlertDeliveries=e.useAlertDeliveries;exports.useAlertDetail=e.useAlertDetail;exports.useAlertDraft=e.useAlertDraft;exports.useAlertFilters=e.useAlertFilters;exports.useAlertHistory=e.useAlertHistory;exports.useAlertQuotas=e.useAlertQuotas;exports.useAlertRuns=e.useAlertRuns;exports.useAlertState=e.useAlertState;exports.useAlertStore=e.useAlertStore;exports.useAlerts=e.useAlerts;exports.useAlertsBootstrap=e.useAlertsBootstrap;exports.useAlertsById=e.useAlertsById;exports.useAlertsForCard=e.useAlertsForCard;exports.useCard=e.useCard;exports.useCardAlertMap=e.useCardAlertMap;exports.useCardSummary=e.useCardSummary;exports.useCurrentActiveCard=e.useCurrentActiveCard;exports.useCurrentCardConfig=e.useCurrentCardConfig;exports.useCurrentSheetActiveCards=e.useCurrentSheetActiveCards;exports.useDashboardActions=e.useDashboardActions;exports.useDashboardById=e.useDashboardById;exports.useDashboardQuery=e.useDashboardQuery;exports.useDashboardStore=e.useDashboardStore;exports.useDashboardSummary=e.useDashboardSummary;exports.useDataColumns=e.useDataColumns;exports.useDateFilterHook=e.useDateFilterHook;exports.useEditorActions=e.useEditorActions;exports.useEditorAside=e.useEditorAside;exports.useEditorStore=e.useEditorStore;exports.useExportActions=e.useExportActions;exports.useExportStore=e.useExportStore;exports.useInProgressExportsCount=e.useInProgressExportsCount;exports.useManagementStore=e.useManagementStore;exports.useResourceManagement=e.useResourceManagement;exports.useSelectedAlertId=e.useSelectedAlertId;exports.useTextFilterHook=e.useTextFilterHook;exports.EMPTY_SELECTION=T.EMPTY_SELECTION;exports.CalendarPreferencesDialog=E.CalendarPreferencesDialog;exports.DashboardSummarySettingsDialog=E.DashboardSummarySettingsDialog;exports.ResourceManagementPanel=v.ResourceManagementPanel;exports.DEFAULT_CALENDAR_CONTEXT=P.DEFAULT_CALENDAR_CONTEXT;exports.normalizeDashboardForDirtyCheck=D.normalizeDashboardForDirtyCheck;exports.serializeDashboardForDirtyCheck=D.serializeDashboardForDirtyCheck;exports.useDebouncedDirtyCheck=D.useDebouncedDirtyCheck;exports.AdvancedModeToggle=m.AdvancedModeToggle;exports.ExportNotificationItem=m.ExportNotificationItem;exports.ExportNotificationList=m.ExportNotificationList;exports.NotificationBell=m.NotificationBell;exports.UnsavedChangesAlert=m.UnsavedChangesAlert;exports.VisualEditingControls=m.VisualEditingControls;exports.useExportPolling=m.useExportPolling;exports.useExportRecovery=m.useExportRecovery;exports.usePristineSnapshotInitializer=m.usePristineSnapshotInitializer;exports.Combobox=F;exports.ScheduleDashboard=R;exports.TenantQuotaPage=k;exports.Visual=I;exports.useExposePrintState=w;