react-semaphor 0.1.293 → 0.1.294

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 (40) hide show
  1. package/dist/chunks/{braces-C7GP95Fp.js → braces-DR-GdaLC.js} +1 -1
  2. package/dist/chunks/{braces-BwW2HFlB.js → braces-DfDQiR3J.js} +1 -1
  3. package/dist/chunks/{dashboard-controls-jrkoCSY_.js → dashboard-controls-C3Z9bpYE.js} +504 -472
  4. package/dist/chunks/{dashboard-controls-DgUc38Tn.js → dashboard-controls-DGEVXgP5.js} +9 -9
  5. package/dist/chunks/dashboard-filter-controls-button-BIYT1ucX.js +11 -0
  6. package/dist/chunks/dashboard-filter-controls-button-DxgGUl00.js +1152 -0
  7. package/dist/chunks/{dashboard-json-COjT-zjQ.js → dashboard-json-BvTeHePu.js} +1 -1
  8. package/dist/chunks/{dashboard-json-C0NiRL-A.js → dashboard-json-DQW8TN0I.js} +1 -1
  9. package/dist/chunks/{dashboard-summary-settings-dialog-CXqaN_zj.js → dashboard-summary-settings-dialog-BsmKiGud.js} +1 -1
  10. package/dist/chunks/{dashboard-summary-settings-dialog-CGuFl7Xe.js → dashboard-summary-settings-dialog-q7fx3YAK.js} +1 -1
  11. package/dist/chunks/edit-dashboard-visual-ChKj-Lzr.js +183 -0
  12. package/dist/chunks/{edit-dashboard-visual-ppdXk86H.js → edit-dashboard-visual-RVl9nbDZ.js} +2175 -2160
  13. package/dist/chunks/index-BlspGR07.js +1435 -0
  14. package/dist/chunks/{index-9z-jMqN8.js → index-DerPpfv0.js} +32720 -31308
  15. package/dist/chunks/{resource-management-panel-CP8cegZP.js → resource-management-panel-DnZ1rw1A.js} +64 -64
  16. package/dist/chunks/{resource-management-panel-os6AuEKT.js → resource-management-panel-epydPwyM.js} +1 -1
  17. package/dist/chunks/use-create-flow-overlay-state-Bcg4EgoD.js +21 -0
  18. package/dist/chunks/{use-create-flow-overlay-state-wpuqRZX5.js → use-create-flow-overlay-state-C5vdfXhM.js} +430 -425
  19. package/dist/chunks/use-visual-utils-D9Kknvjl.js +337 -0
  20. package/dist/chunks/use-visual-utils-Dw_yw9zU.js +1 -0
  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 +258 -253
  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/dashboard.d.ts +28 -0
  29. package/dist/types/main.d.ts +42 -4
  30. package/dist/types/shared.d.ts +3 -0
  31. package/dist/types/surfboard.d.ts +28 -0
  32. package/dist/types/types.d.ts +28 -0
  33. package/package.json +1 -1
  34. package/dist/chunks/dashboard-filter-controls-button-B19UWmsK.js +0 -11
  35. package/dist/chunks/dashboard-filter-controls-button-DGH4DxJ8.js +0 -1109
  36. package/dist/chunks/edit-dashboard-visual-CDOz4LWO.js +0 -183
  37. package/dist/chunks/index-K25f5Rqr.js +0 -1435
  38. package/dist/chunks/use-create-flow-overlay-state-CecnMS_v.js +0 -21
  39. package/dist/chunks/use-visual-utils-BTfG-ppd.js +0 -1
  40. package/dist/chunks/use-visual-utils-BhRKGJql.js +0 -334
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../chunks/index-K25f5Rqr.js"),e=require("../types/index.cjs"),r=require("../chunks/dashboard-summary-settings-dialog-CXqaN_zj.js");exports.Surfboard=a.DashboardPlus;exports.CONTROL_CARD_DEFAULT_VALUE=e.CONTROL_CARD_DEFAULT_VALUE;exports.EMPTY_SELECTION=e.EMPTY_SELECTION;exports.CalendarPreferencesDialog=r.CalendarPreferencesDialog;exports.DashboardSummarySettingsDialog=r.DashboardSummarySettingsDialog;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../chunks/index-BlspGR07.js"),e=require("../types/index.cjs"),r=require("../chunks/dashboard-summary-settings-dialog-BsmKiGud.js");exports.Surfboard=a.DashboardPlus;exports.CONTROL_CARD_DEFAULT_VALUE=e.CONTROL_CARD_DEFAULT_VALUE;exports.EMPTY_SELECTION=e.EMPTY_SELECTION;exports.CalendarPreferencesDialog=r.CalendarPreferencesDialog;exports.DashboardSummarySettingsDialog=r.DashboardSummarySettingsDialog;
@@ -1,6 +1,6 @@
1
- import { a as o } from "../chunks/index-9z-jMqN8.js";
1
+ import { a as o } from "../chunks/index-DerPpfv0.js";
2
2
  import { CONTROL_CARD_DEFAULT_VALUE as s, EMPTY_SELECTION as D } from "../types/index.js";
3
- import { C as m, D as t } from "../chunks/dashboard-summary-settings-dialog-CGuFl7Xe.js";
3
+ import { C as m, D as t } from "../chunks/dashboard-summary-settings-dialog-q7fx3YAK.js";
4
4
  export {
5
5
  s as CONTROL_CARD_DEFAULT_VALUE,
6
6
  m as CalendarPreferencesDialog,
@@ -875,6 +875,8 @@ declare interface FilterGroup {
875
875
  groups: FilterGroup[];
876
876
  }
877
877
 
878
+ declare type FilterKind = 'field' | 'global-date';
879
+
878
880
  /**
879
881
  * Filter layout settings for controlling how dashboard filters are displayed
880
882
  */
@@ -964,6 +966,7 @@ export declare type GetDashboardResponse = {
964
966
  filterValues?: TFilterValue[];
965
967
  defaultLensId?: string;
966
968
  assistantProfileId?: string;
969
+ semanticExecutionPayload: SemanticExecutionPayload;
967
970
  };
968
971
 
969
972
  export declare type GetPluginsResponse = {
@@ -1286,10 +1289,34 @@ declare type RelativeDateFilter = {
1286
1289
  to: number;
1287
1290
  };
1288
1291
 
1292
+ declare type ResolvedPrimaryDateField = {
1293
+ sourceDataset: string;
1294
+ sourceField: string;
1295
+ name: string;
1296
+ qualifiedFieldName: string;
1297
+ qualifiedEntityName?: string;
1298
+ entityId: string;
1299
+ entityName: string;
1300
+ entityType: string;
1301
+ dataType: string;
1302
+ dateFormat?: string;
1303
+ customFormat?: string;
1304
+ defaultGranularity?: TimeGranularity;
1305
+ supportedGranularities?: TimeGranularity[];
1306
+ } | null;
1307
+
1289
1308
  declare type SelectedEntities = Array<DatabaseEntityReference | DataModelEntityReference | DatasetEntityReference | FileEntityReference>;
1290
1309
 
1291
1310
  export declare type SelectionState = Record<Level, string | null>;
1292
1311
 
1312
+ declare type SemanticExecutionPayload = {
1313
+ domainsById: Record<string, {
1314
+ datasetsByName: Record<string, {
1315
+ primaryDateField: ResolvedPrimaryDateField;
1316
+ }>;
1317
+ }>;
1318
+ };
1319
+
1293
1320
  declare interface SortByField extends Field {
1294
1321
  role: 'sortby';
1295
1322
  direction: 'asc' | 'desc';
@@ -1896,6 +1923,7 @@ export declare type TEvent = {
1896
1923
  };
1897
1924
 
1898
1925
  declare type TFilter = {
1926
+ kind?: FilterKind;
1899
1927
  type?: 'single' | 'multiple';
1900
1928
  uiType?: 'radio' | 'dropdown' | 'tabs';
1901
1929
  dateSelectionMode?: DateSelectionMode;
@@ -60,11 +60,15 @@ declare type Actions_2 = {
60
60
  setCustomCards: (customCards: CustomCard[]) => void;
61
61
  setAuthToken: (authToken: AuthToken) => void;
62
62
  setThemeStyle: (themeStyle: StyleProps) => void;
63
- setDashboard: (dashboard: TDashboard) => void;
63
+ setDashboard: (dashboard: TDashboard, options?: {
64
+ semanticExecutionPayload?: SemanticExecutionPayload;
65
+ }) => void;
64
66
  setDashboardWithFilterValues: (dashboard: TDashboard, filterValues: TFilterValue[], runtimeOverrides?: Record<string, unknown>, options?: {
65
67
  selectedSheetId?: string | null;
68
+ semanticExecutionPayload?: SemanticExecutionPayload;
66
69
  }) => void;
67
70
  hydrateRuntimeControlValues: (dashboard: TDashboard, runtimeOverrides?: Record<string, unknown>) => void;
71
+ mergeSemanticExecutionPayload: (semanticExecutionPayload: SemanticExecutionPayload) => void;
68
72
  setDashboardTheme: (theme: 'light' | 'dark' | 'system') => void;
69
73
  setDashboardTitle: (title: string) => void;
70
74
  setDashboardDescription: (description: string) => void;
@@ -104,7 +108,9 @@ declare type Actions_2 = {
104
108
  setCardInlineFilterMode: (sheetId: string, cardId: string, filterId: string, filterMode: 'include' | 'exclude') => void;
105
109
  setCardInlineFilterDefaultValues: (sheetId: string, cardId: string, filterId: string, defaultValues: (string | number)[] | undefined) => void;
106
110
  addFrame: (sheetId: string, frame: TFrame, positionOrOptions?: 'start' | 'end' | AddFrameOptions) => void;
107
- updateFrame: (sheetId: string, frame: TFrame) => void;
111
+ updateFrame: (sheetId: string, frame: TFrame, options?: {
112
+ semanticExecutionPayload?: SemanticExecutionPayload;
113
+ }) => void;
108
114
  updateSheetCalculatedFields: (sheetId: string, calculatedFields: Field[]) => void;
109
115
  setVisualEditPendingFrameRewrites: (sheetId: string, frames: TFrame[]) => void;
110
116
  setVisualEditPendingFilterRewrites: (sheetId: string, filters: TFilter[]) => void;
@@ -304,6 +310,7 @@ declare type AddFrameOptions = {
304
310
  position?: 'start' | 'end';
305
311
  insertAfterFrameId?: string;
306
312
  copyLayoutFromFrameId?: string;
313
+ semanticExecutionPayload?: SemanticExecutionPayload;
307
314
  };
308
315
 
309
316
  /**
@@ -1288,6 +1295,7 @@ export declare interface CreateExportRequest {
1288
1295
  controlDefinitions?: ControlDefinition[];
1289
1296
  cardControlDefinitions?: ControlDefinition[];
1290
1297
  controlBindings?: ControlBinding[];
1298
+ resolvedPrimaryDateField?: ResolvedPrimaryDateField;
1291
1299
  timezone?: string;
1292
1300
  totalRows: number;
1293
1301
  format: ExportFormat;
@@ -1493,6 +1501,7 @@ export declare type DashboardStore = {
1493
1501
  controlValues: Record<string, unknown>;
1494
1502
  /** Runtime-only card-scoped control values, keyed by cardId then controlId. */
1495
1503
  cardControlValuesMap: Record<string, Record<string, unknown>>;
1504
+ semanticExecutionPayload: SemanticExecutionPayload;
1496
1505
  isDashboardPanelOpen: boolean;
1497
1506
  drillHistory: Array<{
1498
1507
  sourceDashboardId: string;
@@ -2046,7 +2055,7 @@ export declare type EditorStore = {
2046
2055
  onDatabaseChange?: (databaseName: string) => void;
2047
2056
  onTableChange?: (tableName: string) => void;
2048
2057
  onSchemaChange?: (schemaName: string) => void;
2049
- onSave?: (card: TFrame) => void;
2058
+ onSave?: (card: TFrame) => void | Promise<void>;
2050
2059
  onClose?: () => void;
2051
2060
  /** Draft slots for mode switching - preserves work when toggling between dev/standard */
2052
2061
  modeDrafts: ModeDrafts;
@@ -2397,6 +2406,8 @@ export declare interface FilterGroup {
2397
2406
  groups: FilterGroup[];
2398
2407
  }
2399
2408
 
2409
+ declare type FilterKind = 'field' | 'global-date';
2410
+
2400
2411
  /**
2401
2412
  * Filter layout settings for controlling how dashboard filters are displayed
2402
2413
  */
@@ -2537,6 +2548,7 @@ export declare type GetDashboardResponse = {
2537
2548
  filterValues?: TFilterValue[];
2538
2549
  defaultLensId?: string;
2539
2550
  assistantProfileId?: string;
2551
+ semanticExecutionPayload: SemanticExecutionPayload;
2540
2552
  };
2541
2553
 
2542
2554
  /**
@@ -3190,6 +3202,22 @@ export declare function resolveDatamodelName(datamodelName: string): string;
3190
3202
 
3191
3203
  export declare const resolveDataType: (value: any) => string;
3192
3204
 
3205
+ declare type ResolvedPrimaryDateField = {
3206
+ sourceDataset: string;
3207
+ sourceField: string;
3208
+ name: string;
3209
+ qualifiedFieldName: string;
3210
+ qualifiedEntityName?: string;
3211
+ entityId: string;
3212
+ entityName: string;
3213
+ entityType: string;
3214
+ dataType: string;
3215
+ dateFormat?: string;
3216
+ customFormat?: string;
3217
+ defaultGranularity?: TimeGranularity;
3218
+ supportedGranularities?: TimeGranularity[];
3219
+ } | null;
3220
+
3193
3221
  /**
3194
3222
  * Parameters in JWT payload (after backend resolution).
3195
3223
  * The backend ALWAYS includes calendarContext, even if customer didn't provide it.
@@ -3290,6 +3318,14 @@ export declare type SemanticDomainAccessRequest = {
3290
3318
  domains?: string[];
3291
3319
  };
3292
3320
 
3321
+ declare type SemanticExecutionPayload = {
3322
+ domainsById: Record<string, {
3323
+ datasetsByName: Record<string, {
3324
+ primaryDateField: ResolvedPrimaryDateField;
3325
+ }>;
3326
+ }>;
3327
+ };
3328
+
3293
3329
  export declare const SemaphorContextProvider: ({ children, dashboardProps, }: {
3294
3330
  children: React.ReactNode;
3295
3331
  dashboardProps: DashboardProps;
@@ -4051,6 +4087,7 @@ export declare type TEvent = {
4051
4087
  };
4052
4088
 
4053
4089
  export declare type TFilter = {
4090
+ kind?: FilterKind;
4054
4091
  type?: 'single' | 'multiple';
4055
4092
  uiType?: 'radio' | 'dropdown' | 'tabs';
4056
4093
  dateSelectionMode?: DateSelectionMode;
@@ -4654,7 +4691,7 @@ export declare function useAddNewFrame(): {
4654
4691
  handleAddNewFrame: (options?: {
4655
4692
  openVisualEditor?: boolean;
4656
4693
  sheetId?: string;
4657
- }) => TFrame | undefined;
4694
+ }) => Promise<TFrame | undefined>;
4658
4695
  canAddFrame: boolean;
4659
4696
  };
4660
4697
 
@@ -5100,6 +5137,7 @@ export declare function useCard(cardId: string): {
5100
5137
  queryKey: string[];
5101
5138
  pagination: PaginationMetadata | undefined;
5102
5139
  comparisonMetadata: ComparisonMetadataMap | undefined;
5140
+ resolvedPrimaryDateField: ResolvedPrimaryDateField | undefined;
5103
5141
  };
5104
5142
 
5105
5143
  export declare const useCardAlertMap: () => Map<string, string[]>;
@@ -755,6 +755,8 @@ declare interface FilterGroup {
755
755
  groups: FilterGroup[];
756
756
  }
757
757
 
758
+ declare type FilterKind = 'field' | 'global-date';
759
+
758
760
  /**
759
761
  * Filter layout settings for controlling how dashboard filters are displayed
760
762
  */
@@ -1704,6 +1706,7 @@ declare type TDynamicVisualIntent = {
1704
1706
  };
1705
1707
 
1706
1708
  declare type TFilter = {
1709
+ kind?: FilterKind;
1707
1710
  type?: 'single' | 'multiple';
1708
1711
  uiType?: 'radio' | 'dropdown' | 'tabs';
1709
1712
  dateSelectionMode?: DateSelectionMode;
@@ -895,6 +895,8 @@ declare interface FilterGroup {
895
895
  groups: FilterGroup[];
896
896
  }
897
897
 
898
+ declare type FilterKind = 'field' | 'global-date';
899
+
898
900
  /**
899
901
  * Filter layout settings for controlling how dashboard filters are displayed
900
902
  */
@@ -984,6 +986,7 @@ export declare type GetDashboardResponse = {
984
986
  filterValues?: TFilterValue[];
985
987
  defaultLensId?: string;
986
988
  assistantProfileId?: string;
989
+ semanticExecutionPayload: SemanticExecutionPayload;
987
990
  };
988
991
 
989
992
  export declare type GetPluginsResponse = {
@@ -1306,10 +1309,34 @@ declare type RelativeDateFilter = {
1306
1309
  to: number;
1307
1310
  };
1308
1311
 
1312
+ declare type ResolvedPrimaryDateField = {
1313
+ sourceDataset: string;
1314
+ sourceField: string;
1315
+ name: string;
1316
+ qualifiedFieldName: string;
1317
+ qualifiedEntityName?: string;
1318
+ entityId: string;
1319
+ entityName: string;
1320
+ entityType: string;
1321
+ dataType: string;
1322
+ dateFormat?: string;
1323
+ customFormat?: string;
1324
+ defaultGranularity?: TimeGranularity;
1325
+ supportedGranularities?: TimeGranularity[];
1326
+ } | null;
1327
+
1309
1328
  declare type SelectedEntities = Array<DatabaseEntityReference | DataModelEntityReference | DatasetEntityReference | FileEntityReference>;
1310
1329
 
1311
1330
  export declare type SelectionState = Record<Level, string | null>;
1312
1331
 
1332
+ declare type SemanticExecutionPayload = {
1333
+ domainsById: Record<string, {
1334
+ datasetsByName: Record<string, {
1335
+ primaryDateField: ResolvedPrimaryDateField;
1336
+ }>;
1337
+ }>;
1338
+ };
1339
+
1313
1340
  declare interface SortByField extends Field {
1314
1341
  role: 'sortby';
1315
1342
  direction: 'asc' | 'desc';
@@ -1918,6 +1945,7 @@ export declare type TEvent = {
1918
1945
  };
1919
1946
 
1920
1947
  declare type TFilter = {
1948
+ kind?: FilterKind;
1921
1949
  type?: 'single' | 'multiple';
1922
1950
  uiType?: 'radio' | 'dropdown' | 'tabs';
1923
1951
  dateSelectionMode?: DateSelectionMode;
@@ -1164,6 +1164,8 @@ declare interface FilterGroup {
1164
1164
  groups: FilterGroup[];
1165
1165
  }
1166
1166
 
1167
+ declare type FilterKind = 'field' | 'global-date';
1168
+
1167
1169
  /**
1168
1170
  * Filter layout settings for controlling how dashboard filters are displayed
1169
1171
  */
@@ -1255,6 +1257,7 @@ export declare type GetDashboardResponse = {
1255
1257
  filterValues?: TFilterValue[];
1256
1258
  defaultLensId?: string;
1257
1259
  assistantProfileId?: string;
1260
+ semanticExecutionPayload: SemanticExecutionPayload;
1258
1261
  };
1259
1262
 
1260
1263
  export declare type GetPluginsResponse = {
@@ -1592,6 +1595,22 @@ declare type RelativeDateFilter = {
1592
1595
  to: number;
1593
1596
  };
1594
1597
 
1598
+ declare type ResolvedPrimaryDateField = {
1599
+ sourceDataset: string;
1600
+ sourceField: string;
1601
+ name: string;
1602
+ qualifiedFieldName: string;
1603
+ qualifiedEntityName?: string;
1604
+ entityId: string;
1605
+ entityName: string;
1606
+ entityType: string;
1607
+ dataType: string;
1608
+ dateFormat?: string;
1609
+ customFormat?: string;
1610
+ defaultGranularity?: TimeGranularity;
1611
+ supportedGranularities?: TimeGranularity[];
1612
+ } | null;
1613
+
1595
1614
  /**
1596
1615
  * Parameters in JWT payload (after backend resolution).
1597
1616
  * The backend ALWAYS includes calendarContext, even if customer didn't provide it.
@@ -1632,6 +1651,14 @@ export declare type SemanticDomainAccessRequest = {
1632
1651
  domains?: string[];
1633
1652
  };
1634
1653
 
1654
+ declare type SemanticExecutionPayload = {
1655
+ domainsById: Record<string, {
1656
+ datasetsByName: Record<string, {
1657
+ primaryDateField: ResolvedPrimaryDateField;
1658
+ }>;
1659
+ }>;
1660
+ };
1661
+
1635
1662
  export declare type SensitivityPreset = 'low_noise' | 'standard' | 'early_warning';
1636
1663
 
1637
1664
  declare interface SortByField extends Field {
@@ -2246,6 +2273,7 @@ export declare type TEvent = {
2246
2273
  };
2247
2274
 
2248
2275
  declare type TFilter = {
2276
+ kind?: FilterKind;
2249
2277
  type?: 'single' | 'multiple';
2250
2278
  uiType?: 'radio' | 'dropdown' | 'tabs';
2251
2279
  dateSelectionMode?: DateSelectionMode;
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.1.293",
8
+ "version": "0.1.294",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",
@@ -1,11 +0,0 @@
1
- "use strict";const g=require("react"),e=require("./index-K25f5Rqr.js"),t=require("react/jsx-runtime"),I=require("./use-create-flow-overlay-state-CecnMS_v.js"),M=require("./use-visual-utils-BTfG-ppd.js"),L=require("./date-formatter-CqXdM6JO.js");/**
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 T=e.createLucideIcon("FileDown",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]]);/**
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 P=e.createLucideIcon("FilterX",[["path",{d:"M13.013 3H2l8 9.46V19l4 2v-8.54l.9-1.055",key:"1fi1da"}],["path",{d:"m22 3-5 5",key:"12jva0"}],["path",{d:"m17 3 5 5",key:"k36vhe"}]]),V=1e4,z=15e3,O=3e4,R=3e4,H=12e4,k=2*60*60*1e3;function $(s){const r=Date.now()-s.getTime();return r<R?V:r<H?z:O}function _(){const{authToken:s,tokenProps:r}=e.useSemaphorContext(),m=e.useExportStore(p=>p.activeExports),[d,l]=g.useState(typeof document<"u"?!document.hidden:!0),h=g.useRef(null),o=g.useRef(!1),c=g.useRef(void 0),u=r==null?void 0:r.apiServiceUrl,n=s==null?void 0:s.accessToken,f=g.useCallback(()=>{const p=e.useExportStore.getState().activeExports;return Array.from(p.values()).filter(C=>e.isExportInProgress(C.status))},[]);g.useEffect(()=>{if(typeof document>"u")return;const p=()=>{l(!document.hidden)};return document.addEventListener("visibilitychange",p),()=>{document.removeEventListener("visibilitychange",p)}},[]);const b=g.useCallback(async()=>{if(!u||!n){o.current=!1;return}const p=f();if(p.length===0){o.current=!1;return}const C=Date.now(),D=p.filter(a=>C-a.startedAt.getTime()>k);if(D.length>0){const{updateExport:a}=e.useExportStore.getState().actions;for(const i of D)a(i.id,{status:"failed",error:"Export timed out. Please try again or contact support.",lastUpdatedAt:new Date})}const x=p.filter(a=>C-a.startedAt.getTime()<=k);if(x.length===0){o.current=!1;return}const j=await Promise.allSettled(x.map(async a=>{try{const i=await e.getExportStatus(u,n,a.id);let v;if(i.status==="completed")try{v=await e.getDownloadUrl(u,n,a.id)}catch(A){console.error(`[useExportPolling] Failed to get download URL for ${a.id}:`,A)}return{id:a.id,status:i.status,progress:i.progress,completedChunks:i.completedChunks,completedAt:i.completedAt?new Date(i.completedAt):void 0,lastUpdatedAt:new Date,fileSize:i.fileSize,error:i.error,downloadUrl:v}}catch(i){return console.error(`[useExportPolling] Failed to poll export ${a.id}:`,i),null}})),{updateExport:E}=e.useExportStore.getState().actions;for(const a of j)a.status==="fulfilled"&&a.value&&E(a.value.id,a.value);const w=f();if(w.length>0&&!document.hidden){const a=w.reduce((v,A)=>A.startedAt<v?A.startedAt:v,w[0].startedAt),i=$(a);h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{var v;(v=c.current)==null||v.call(c)},i)}else o.current=!1},[u,n,f]);return g.useEffect(()=>{c.current=b},[b]),g.useEffect(()=>{var C;f().length>0&&d&&!o.current&&(o.current=!0,(C=c.current)==null||C.call(c))},[m,d,f]),g.useEffect(()=>{var C;const p=f();d&&p.length>0&&!o.current&&(o.current=!0,(C=c.current)==null||C.call(c))},[d,f]),g.useEffect(()=>{!d&&h.current&&(clearTimeout(h.current),h.current=null,o.current=!1)},[d]),g.useEffect(()=>()=>{h.current&&(clearTimeout(h.current),h.current=null)},[]),{isPolling:o.current,isTabVisible:d,inProgressCount:f().length}}function q(){const{authToken:s,tokenProps:r}=e.useSemaphorContext(),m=e.useExportStore(c=>c.activeExports),{addExport:d}=e.useExportActions(),l=g.useRef(!1),h=r==null?void 0:r.apiServiceUrl,o=s==null?void 0:s.accessToken;g.useEffect(()=>{if(l.current||!h||!o)return;(async()=>{try{const{exports:u}=await e.getExports(h,o,{status:["pending","processing","chunking","compacting","completed","failed"],limit:20});for(const n of u){if(m.has(n.id))continue;const f=n.totalChunks?Math.round(n.completedChunks/n.totalChunks*100):0;let b;if(n.status==="completed")try{b=await e.getDownloadUrl(h,o,n.id)}catch(C){console.error(`[useExportRecovery] Failed to get download URL for ${n.id}:`,C)}const p={id:n.id,status:n.status,progress:f,title:X(n),totalRows:n.totalRows,totalChunks:n.totalChunks,completedChunks:n.completedChunks,startedAt:new Date(n.createdAt),lastUpdatedAt:new Date,completedAt:n.completedAt?new Date(n.completedAt):void 0,fileSize:n.fileSize,error:n.error,expiresAt:new Date(n.expiresAt),downloadUrl:b};d(p)}l.current=!0}catch(u){console.error("[useExportRecovery] Failed to recover exports:",u),l.current=!0}})()},[h,o,d,m])}function X(s){return s.title?s.title:e.isExportInProgress(s.status)?"Export in progress...":s.status==="completed"?"Export completed":s.status==="failed"?"Export failed":"Export"}function G({open:s,onOpenChange:r,isLibraryVisual:m,currentVisualName:d,isSaving:l=!1,destinationMode:h="both",onConfirm:o}){const[c,u]=g.useState(m&&d?`Copy of ${d}`:d||""),[n,f]=g.useState("");g.useEffect(()=>{s&&(u(m&&d?`Copy of ${d}`:d||""),f(""))},[s,m,d]);const b=!!c.trim(),p=h==="local"?{saveToLibrary:!1,saveToCurrentDashboard:!0,badgeType:"local",description:"Creates a local copy on the current dashboard.",actionLabel:"Add to Dashboard (Local)"}:h==="library"?{saveToLibrary:!0,saveToCurrentDashboard:!1,badgeType:"library",description:"Creates a reusable visual in Visual Library.",actionLabel:"Save as Library Visual"}:{saveToLibrary:!0,saveToCurrentDashboard:!0,badgeType:"linked",description:"Creates a new library visual and adds a linked copy to this dashboard.",actionLabel:"Save Copy as Linked Visual"},C=()=>{!b||l||o({name:c.trim(),description:n.trim()||void 0,saveToLibrary:p.saveToLibrary,saveToCurrentDashboard:p.saveToCurrentDashboard})};return t.jsx(e.Dialog,{open:s,onOpenChange:r,children:t.jsxs(e.DialogContent,{className:"sm:max-w-[500px]",children:[t.jsxs(e.DialogHeader,{children:[t.jsxs(e.DialogTitle,{className:"flex items-center gap-2",children:[t.jsx("span",{children:"Save Visual As"}),p.badgeType!=="local"&&t.jsx(I.VisualBadge,{type:p.badgeType,showLabel:!0,className:"px-2 py-0.5"})]}),t.jsx(e.DialogDescription,{children:p.description})]}),t.jsxs("div",{className:"grid gap-4 py-4",children:[t.jsxs("div",{className:"grid gap-2",children:[t.jsx(e.Label,{htmlFor:"name",children:"Name"}),t.jsx(e.Input,{id:"name",value:c,onChange:D=>u(D.target.value),placeholder:"Enter visual name",disabled:l})]}),t.jsxs("div",{className:"grid gap-2",children:[t.jsx(e.Label,{htmlFor:"description",children:"Description (optional)"}),t.jsx(e.Textarea,{id:"description",value:n,onChange:D=>f(D.target.value),placeholder:"Enter visual description",rows:3,disabled:l})]})]}),t.jsxs(e.DialogFooter,{children:[t.jsx(e.Button,{variant:"outline",onClick:()=>r(!1),disabled:l,children:"Cancel"}),t.jsxs(e.Button,{onClick:C,disabled:!b||l,children:[l&&t.jsx(e.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),p.actionLabel]})]})]})})}function K(){const[s,r]=g.useState(!1),[m,d]=g.useState(!1),[l,h]=g.useState(null),o=e.useEditorStore(i=>i.frame),c=e.useEditorStore(i=>i.card),u=e.useSelectedVisual(),n=e.useDashboardStore(i=>i.selectedSheetId),f=e.useDashboardStore(i=>i.actions.setIsDashboardPanelOpen),{getUpdatedFrame:b}=M.useVisualUtils(),{selectVisual:p}=e.useManagementActions(),{addFrame:C,setSelectedFrameId:D,setIsVisualEditing:x}=e.useDashboardActions(),j=!!(o!=null&&o.visualId),E=(()=>{var i,v;return((i=o==null?void 0:o.cards)==null?void 0:i.length)===1&&((v=o.cards[0])!=null&&v.title)?o.cards[0].title:u!=null&&u.title?u.title:(c==null?void 0:c.title)||"Untitled Visual"})(),w=e.useCreateVisualWithFrame(i=>{if(i!=null&&i.id){if(p(i),m&&l&&n){const v={...l,id:e.v4(),visualId:i.id};C(n,v,"end"),D(v.id),d(!1),h(null),x(!1)}f(!0),r(!1)}});return{saveAsDialogOpen:s,setSaveAsDialogOpen:r,handleSaveAs:async i=>{if(!n){e.ue.error("No sheet selected");return}const v=b(),A=e.getDynamicFrameSaveIssue(v);if(A){e.ue.error(A);return}const N=v.cards.length===1?{...v,cards:v.cards.map(y=>({...y,title:i.name}))}:v;if(i.saveToLibrary){d(i.saveToCurrentDashboard),h(N);const y={title:i.name,description:i.description,frameObject:N,isPrivate:!1};w.mutate(y)}else if(i.saveToCurrentDashboard){const y={...N,id:e.v4(),visualId:void 0};C(n,y,"end"),D(y.id),e.ue.success("Visual saved to dashboard"),r(!1),x(!1)}},isLibraryVisual:j,currentVisualName:E,isSaving:w.isPending}}function Q(s={}){const r=e.useEditorStore(S=>S.frame),m=e.useManagementStore(S=>S.selectedVisual),d=e.useDashboardStore(S=>S.selectedFrameId),l=e.useDashboardStore(S=>S.selectedSheetId),{setIsVisualEditing:h,updateFrame:o}=e.useDashboardActions(),[c,u]=g.useState(!1),[n,f]=g.useState("both"),b=!!(r!=null&&r.visualId||m!=null&&m.id),p=!!(r!=null&&r.visualId&&d),C=b&&!p,{saveAsDialogOpen:D,setSaveAsDialogOpen:x,handleSaveAs:j,isLibraryVisual:E,currentVisualName:w,isSaving:a}=K(),{getUpdatedFrame:i}=M.useVisualUtils(),v=()=>{if(!l){e.ue.error("No sheet selected");return}if(c)return;u(!0);const S=i(),N=e.getDynamicFrameSaveIssue(S);if(N){u(!1),e.ue.error(N);return}const y={...S,visualId:void 0};o(l,y),setTimeout(()=>{u(!1),e.ue.success("Changes applied. Visual is now local to this dashboard"),h(!1)},300)},A=S=>{f(S),x(!0)};return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"inline-flex items-center overflow-hidden rounded-[5px]",children:[!b&&t.jsx(I.EditorAcceptButton,{className:"rounded-none",variant:"default"}),b&&C&&t.jsx(I.VisualSaveButton,{className:"rounded-none",variant:"default"}),b&&p&&t.jsx(I.VisualSaveAndApplyButton,{className:"rounded-none"}),t.jsxs(e.DropdownMenu,{modal:!1,children:[t.jsx(e.DropdownMenuTrigger,{asChild:!0,children:t.jsx(e.Button,{variant:"default",size:"xs",className:"w-7 rounded-none border-l border-primary-foreground/20 px-0","aria-label":"Open visual save options",disabled:a||c,children:t.jsx(e.ChevronDown,{className:"h-3.5 w-3.5"})})}),t.jsxs(e.DropdownMenuContent,{align:"end",className:"min-w-[220px] rounded-[6px] border border-border/60 p-1 shadow-sm",children:[p&&t.jsxs(t.Fragment,{children:[t.jsxs(e.DropdownMenuItem,{onClick:v,disabled:c,children:[t.jsx(e.Check,{className:"h-3.5 w-3.5"}),c?"Applying...":"Apply Locally"]}),t.jsx(e.DropdownMenuSeparator,{})]}),t.jsxs(e.DropdownMenuItem,{onClick:()=>A("local"),disabled:a,children:[t.jsx(e.Plus,{className:"h-3.5 w-3.5"}),"Add to Dashboard (Local)"]}),t.jsxs(e.DropdownMenuItem,{onClick:()=>A("library"),disabled:a,children:[t.jsx(I.Library,{className:"h-3.5 w-3.5"}),"Save as Library Visual"]}),t.jsxs(e.DropdownMenuItem,{onClick:()=>A("both"),disabled:a,children:[t.jsx(I.Link2,{className:"h-3.5 w-3.5"}),"Save Copy as Linked Visual"]})]})]})]}),t.jsx(I.EditorCancelButton,{}),t.jsx(G,{open:D,onOpenChange:S=>{a||x(S)},isLibraryVisual:E,currentVisualName:w,isSaving:a,destinationMode:n,onConfirm:j})]})}function W({className:s}){const r=e.useEditorStore(u=>u.isDevMode),m=e.useDashboardStore(u=>u.isVisualEditing),{setIsDevMode:d}=e.useEditorActions(),{config:l}=g.useContext(e.SemaphorContext).tokenProps,h=(l==null?void 0:l.showAdvancedMode)!==!1;if(!m||!h)return null;const o="h-full rounded-none border-0 bg-transparent px-2.5 shadow-none text-muted-foreground hover:bg-accent/50 hover:text-foreground",c="bg-muted text-foreground hover:bg-muted";return t.jsxs("div",{role:"radiogroup","aria-label":"Editor mode",className:e.cn("inline-flex h-7 items-stretch overflow-hidden rounded-[5px] border border-input bg-background",s),children:[t.jsxs(e.Button,{type:"button",variant:"ghost",size:"xs",role:"radio","aria-checked":!r,className:e.cn(o,!r&&c),onClick:()=>d(!1),children:[t.jsx(e.SlidersHorizontal,{className:"h-3.5 w-3.5"}),"Drag & drop"]}),t.jsxs(e.Button,{type:"button",variant:"ghost",size:"xs",role:"radio","aria-checked":r,className:e.cn(o,"border-l border-border/60",r&&c),onClick:()=>d(!0),children:[t.jsx(e.CodeXml,{className:"h-3.5 w-3.5"}),"SQL"]})]})}function Y({open:s,onOpenChange:r,onSave:m,onDiscard:d,isSaving:l,title:h="Unsaved changes",description:o="You have unsaved changes to this dashboard. What would you like to do?",cancelLabel:c="Cancel",discardLabel:u="Discard",saveLabel:n="Save"}){const f=b=>{!b&&l||r(b)};return t.jsx(e.AlertDialog,{open:s,onOpenChange:f,children:t.jsxs(e.AlertDialogContent,{children:[t.jsxs(e.AlertDialogHeader,{children:[t.jsx(e.AlertDialogTitle,{children:h}),t.jsx(e.AlertDialogDescription,{children:o})]}),t.jsxs(e.AlertDialogFooter,{children:[t.jsx(e.Button,{type:"button",size:"xs",onClick:d,disabled:l,variant:"ghost",className:"mr-auto text-muted-foreground hover:bg-destructive/10 hover:text-destructive focus-visible:bg-destructive/10 focus-visible:text-destructive",children:u}),t.jsx(e.AlertDialogCancel,{disabled:l,children:c}),t.jsx(e.Button,{type:"button",size:"xs",onClick:m,disabled:l,children:l?t.jsxs(t.Fragment,{children:[t.jsx(e.LoaderCircle,{className:"mr-2 h-3.5 w-3.5 animate-spin"}),"Saving..."]}):n})]})]})})}function Z(s,r,m,d){g.useEffect(()=>{s&&!m&&r&&d(e.cloneDeep(r))},[s,m,r,d])}function B({export:s,onRemove:r}){const m=()=>{s.downloadUrl&&window.open(s.downloadUrl,"_blank")},d=c=>{c.stopPropagation(),r==null||r(s.id)},l=()=>{switch(s.status){case"completed":return t.jsx(e.CircleCheck,{className:"mt-0.5 h-5 w-5 shrink-0 text-green-600"});case"failed":return t.jsx(I.CircleX,{className:"mt-0.5 h-5 w-5 shrink-0 text-destructive"});default:return t.jsx(e.LoaderCircle,{className:"text-foreground-muted mt-0.5 h-5 w-5 shrink-0 animate-spin"})}},h=e.isExportInProgress(s.status),o=(()=>{switch(s.status){case"pending":return"Queued...";case"processing":return"Processing...";case"chunking":return"Processing...";case"compacting":return"Finalizing...";default:return"Processing..."}})();return t.jsxs("div",{className:"group p-4 transition-colors hover:bg-muted/50",children:[t.jsxs("div",{className:"mb-2 flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-3",children:[l(),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("h4",{className:"mb-1 truncate text-sm font-medium",children:s.title}),s.status==="completed"&&t.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[t.jsxs("span",{children:[s.totalRows.toLocaleString()," rows"]}),s.fileSize&&t.jsxs(t.Fragment,{children:[t.jsx("span",{children:"•"}),t.jsx("span",{children:e.formatFileSize(s.fileSize)})]})]}),h&&t.jsx("div",{className:"text-xs text-muted-foreground",children:o}),s.status==="failed"&&t.jsx("div",{className:"line-clamp-2 text-xs text-destructive",children:s.error||"Export failed"})]})]}),t.jsx(e.Button,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100",onClick:d,"aria-label":"Remove notification",children:t.jsx(e.X,{className:"h-4 w-4"})})]}),t.jsxs("div",{className:"ml-8",children:[s.status==="completed"&&t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:L.formatDistanceToNow(s.startedAt,{addSuffix:!0})}),s.downloadUrl&&t.jsxs(e.Button,{size:"sm",variant:"outline",className:"h-8 bg-transparent",onClick:m,children:[t.jsx(e.Download,{className:"mr-1.5 h-3.5 w-3.5"}),"Download"]})]}),h&&t.jsxs("div",{children:[t.jsx(e.Progress,{value:s.progress,className:"h-1.5"}),t.jsxs("span",{className:"mt-1 block text-xs text-muted-foreground",children:[s.progress,"% complete"]})]}),s.status==="failed"&&t.jsx("span",{className:"text-xs text-muted-foreground",children:L.formatDistanceToNow(s.startedAt,{addSuffix:!0})})]})]})}function U(){const{authToken:s,tokenProps:r}=e.useSemaphorContext(),m=e.useExportStore(x=>x.activeExports),{clearCompleted:d,removeExport:l,updateExport:h}=e.useExportActions(),[o,c]=g.useState(!1),[u,n]=g.useState(!1),f=Array.from(m.values()).sort((x,j)=>j.startedAt.getTime()-x.startedAt.getTime()),b=f.some(x=>x.status==="completed"||x.status==="failed"),p=g.useCallback(async()=>{const x=r==null?void 0:r.apiServiceUrl,j=s==null?void 0:s.accessToken;if(!(!x||!j)){c(!0);try{const E=Array.from(m.values());await Promise.all(E.map(async w=>{try{const a=await e.getExportStatus(x,j,w.id);let i;if(a.status==="completed")try{i=await e.getDownloadUrl(x,j,w.id)}catch(v){console.error(`Failed to get download URL for ${w.id}:`,v)}h(w.id,{status:a.status,progress:a.progress,completedChunks:a.completedChunks,completedAt:a.completedAt?new Date(a.completedAt):void 0,lastUpdatedAt:new Date,fileSize:a.fileSize,error:a.error,downloadUrl:i})}catch(a){console.error(`Failed to refresh export ${w.id}:`,a)}}))}finally{c(!1)}}},[m,s==null?void 0:s.accessToken,r==null?void 0:r.apiServiceUrl,h]),C=g.useCallback(async()=>{const x=r==null?void 0:r.apiServiceUrl,j=s==null?void 0:s.accessToken;if(!x||!j){d();return}n(!0);try{const E=f.filter(a=>a.status==="completed"||a.status==="failed"),w=await Promise.allSettled(E.map(async a=>(await e.cancelExport(x,j,a.id),a.id)));for(const a of w)a.status==="fulfilled"?l(a.value):console.error("Failed to delete export:",a.reason)}finally{n(!1)}},[f,r==null?void 0:r.apiServiceUrl,s==null?void 0:s.accessToken,d,l]),D=g.useCallback(async x=>{const j=r==null?void 0:r.apiServiceUrl,E=s==null?void 0:s.accessToken;if(j&&E)try{await e.cancelExport(j,E,x),l(x);return}catch(w){console.error(`Failed to cancel export ${x}:`,w)}l(x)},[r==null?void 0:r.apiServiceUrl,s==null?void 0:s.accessToken,l]);return f.length===0?t.jsxs("div",{className:"p-6 text-center",children:[t.jsx(T,{className:"mx-auto mb-2 h-8 w-8 text-muted-foreground"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"No active exports"}),t.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Large exports will appear here"})]}):t.jsxs("div",{className:"flex flex-col",children:[t.jsxs("div",{className:"flex items-center justify-between border-b px-4 py-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(T,{className:"h-5 w-5 text-muted-foreground"}),t.jsx("h4",{className:"font-semibold",children:"Exports"})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(e.Button,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:p,disabled:o,title:"Refresh status",children:t.jsx(e.RefreshCw,{className:`h-4 w-4 ${o?"animate-spin":""}`})}),b&&t.jsx(e.Button,{variant:"ghost",size:"sm",className:"h-7 px-2 text-sm",onClick:C,disabled:u,children:u?"Clearing...":"Clear all"})]})]}),t.jsx("div",{className:"max-h-[350px] overflow-y-auto",children:t.jsx("div",{className:"divide-y",children:f.map(x=>t.jsx(B,{export:x,onRemove:D},x.id))})})]})}function J({variant:s}){const r=e.useExportStore(u=>u.activeExports),m=e.useInProgressExportsCount(),d=r.size>0,l=Array.from(r.values()).some(u=>u.status==="completed"||u.status==="failed"),o=m>0?m>9?"9+":String(m):null,c=d;return t.jsxs(e.Popover,{children:[t.jsx(e.PopoverTrigger,{asChild:!0,children:t.jsxs(e.Button,{variant:s??"ghost",size:"xs",className:"relative w-7 px-0 text-muted-foreground hover:text-foreground","aria-label":"Export notifications",children:[t.jsx(e.Bell,{className:"h-3.5 w-3.5"}),c&&t.jsx("span",{className:`absolute flex items-center justify-center rounded-full bg-primary text-primary-foreground ${o?"-right-0.5 -top-0.5 h-3.5 min-w-3.5 px-0.5 text-[9px] font-semibold":"right-1 top-1 h-1.5 w-1.5"}`,children:o})]})}),t.jsx(e.PopoverContent,{className:"w-80 p-0",align:"end",sideOffset:8,children:t.jsx(U,{})})]})}function ee(s){if(s)return{renamed:s.type==="rename"?{oldId:s.oldId,newId:s.newId}:void 0,removedControlId:s.type==="remove"?s.controlId:void 0,cardBindingsById:s.type==="add"||s.type==="update"?s.cardBindingsById:void 0,affectedBindingControlIds:s.type==="add"||s.type==="update"?s.affectedBindingControlIds:void 0}}function te({open:s,onOpenChange:r,trigger:m,showTrigger:d=!0,initialMode:l="manage"}){const h=l==="create",{forceClose:o,handleOpenChange:c,isCreateFlowActive:u,preventPassiveDismissDuringCreate:n,resolvedOpen:f,setIsCreateFlowActive:b}=I.useCreateFlowOverlayState({open:s,onOpenChange:r,initialCreateFlowActive:l==="create",dismissMode:d?"passive":"explicit-only"}),p=e.useDashboardStore(N=>N.dashboard),{setDashboardControlsModel:C}=e.useDashboardActions(),{participants:D}=e.useDashboardStructuralParticipants(e.getDashboardCards(p)),x=Array.from(new Map(D.flatMap(N=>N.fieldChoices.map(y=>{var F;return[y.value,{option:y,target:(F=N.fieldTargetMap)==null?void 0:F[y.value]}]}))).values()),j=Array.from(new Map(D.flatMap(N=>N.metricChoices.map(y=>{var F;return[y.value,{option:y,target:(F=N.metricTargetMap)==null?void 0:F[y.value]}]}))).values()),E=e.collectDashboardControlIds({...p||{},controls:[]}),w=e.buildDashboardStructuralParticipantIdsByControlId(p),a=(N,y,F)=>{C(N,y,ee(F))},i=g.useCallback(()=>{if(h){o();return}b(!1)},[h,o,b]),v=t.jsx(I.ControlDefinitionListEditor,{scope:"dashboard",controls:p.controls||[],reservedControlIds:E,defaultValues:p.defaultControlValues||{},usageByControlId:e.buildDashboardControlUsageById(p),availableFieldChoices:x,availableMetricChoices:j,structuralParticipants:D,structuralParticipantIdsByControlId:w,initialCreateFlow:l==="create",onCreateFlowActiveChange:b,onCreateFlowComplete:i,onChange:a,emptyMessage:"No dashboard controls yet."}),A=u?"Add dashboard control":"Dashboard Controls",S=t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx("h4",{className:"text-sm font-medium",children:"Dashboard Controls"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Add shared controls viewers can use across the dashboard. Each card can decide how to respond to the same control."})]}),v]});return d?t.jsxs(e.Popover,{open:f,onOpenChange:c,children:[t.jsx(e.PopoverTrigger,{asChild:!0,children:m||t.jsxs(e.Button,{variant:"outline",className:"h-7 px-2",size:"sm",children:[t.jsx(e.SlidersHorizontal,{className:"mr-2 h-4 w-4"}),"Controls"]})}),t.jsx(e.PopoverContent,{className:"w-[620px] max-w-[95vw] space-y-4",align:"end",onEscapeKeyDown:n,onPointerDownOutside:n,children:S})]}):t.jsx(e.Dialog,{open:f,onOpenChange:c,children:t.jsxs(e.DialogContent,{className:"flex max-h-[88vh] flex-col overflow-hidden sm:max-w-[600px]",onEscapeKeyDown:n,onPointerDownOutside:n,children:[t.jsxs(e.DialogHeader,{className:u?"space-y-0":void 0,children:[t.jsx(e.DialogTitle,{className:"text-[15px]",children:A}),t.jsx(e.DialogDescription,{className:u?"sr-only":"text-[13px]",children:u?"Configure and add a shared dashboard control.":"Add shared controls viewers can use across the dashboard. Each card can decide how to respond to the same control."})]}),t.jsx("div",{className:"min-h-0 overflow-y-auto pr-1",children:v})]})})}function se({showFilters:s,onToggleFilters:r,onAddFilter:m,onAddControl:d,onManageControls:l,size:h="default",className:o,primaryButtonClassName:c,secondaryButtonClassName:u,dropdownContentClassName:n}){const f=h==="toolbar";return t.jsxs("div",{className:e.cn("relative inline-flex items-stretch overflow-hidden rounded-[5px] border border-input bg-background",f?"h-8":"h-7",o),children:[t.jsxs(e.Button,{variant:"ghost",size:"xs",className:e.cn("h-full rounded-none border-0 bg-transparent pl-2.5 pr-2 shadow-none hover:bg-accent/50",c),onClick:r,children:[s?t.jsx(P,{className:"h-3.5 w-3.5"}):t.jsx(e.Filter,{className:"h-3.5 w-3.5"}),"Filter"]}),t.jsxs(e.DropdownMenu,{children:[t.jsx(e.DropdownMenuTrigger,{asChild:!0,children:t.jsx(e.Button,{variant:"ghost",size:"xs",className:e.cn("h-full w-7 rounded-none border-0 border-l border-border/60 bg-transparent px-0 shadow-none hover:bg-accent/50",u),"aria-label":"Filter and control actions",children:t.jsx(e.ChevronDown,{className:"h-3.5 w-3.5"})})}),t.jsxs(e.DropdownMenuContent,{align:"start",className:e.cn("min-w-[180px] rounded-[6px] border border-border/60 p-1 shadow-sm",n),children:[t.jsxs(e.DropdownMenuItem,{onSelect:m,children:[t.jsx(e.Filter,{className:"h-3.5 w-3.5"}),"Add filter"]}),t.jsxs(e.DropdownMenuItem,{onSelect:d,children:[t.jsx(e.SlidersHorizontal,{className:"h-3.5 w-3.5"}),"Add control"]}),t.jsxs(e.DropdownMenuItem,{onSelect:l,children:[t.jsx(e.Pencil,{className:"h-3.5 w-3.5"}),"Manage controls"]})]})]})]})}exports.AdvancedModeToggle=W;exports.DashboardControlsSettings=te;exports.DashboardFilterControlsButton=se;exports.ExportNotificationItem=B;exports.ExportNotificationList=U;exports.NotificationBell=J;exports.UnsavedChangesAlert=Y;exports.VisualEditingControls=Q;exports.useExportPolling=_;exports.useExportRecovery=q;exports.usePristineSnapshotInitializer=Z;