react-semaphor 0.1.260 → 0.1.262
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/dashboard-controls-AFlpiHtC.js +42 -0
- package/dist/chunks/dashboard-controls-Cq2fQ7bv.js +1979 -0
- package/dist/chunks/dashboard-filter-controls-button-Cedz-YZx.js +11 -0
- package/dist/chunks/dashboard-filter-controls-button-udrHABi3.js +1066 -0
- package/dist/chunks/{dashboard-json-BUrApiYl.js → dashboard-json-BU6cvmRP.js} +1 -1
- package/dist/chunks/{dashboard-json-U7VmojaR.js → dashboard-json-RKwWONKm.js} +1 -1
- package/dist/chunks/dashboard-summary-settings-dialog-Bl-XplTR.js +1 -0
- package/dist/chunks/dashboard-summary-settings-dialog-DDxHxKjp.js +535 -0
- package/dist/chunks/{edit-dashboard-visual-N2r5ObJ_.js → edit-dashboard-visual-B1r0Ho9B.js} +5970 -5492
- package/dist/chunks/edit-dashboard-visual-BwDFI3hI.js +188 -0
- package/dist/chunks/{index-BNdZjo5d.js → index-BtbNfaQD.js} +50751 -47206
- package/dist/chunks/index-DZ93VE76.js +1114 -0
- package/dist/chunks/{normalize-dashboard-for-dirty-check-Bn27S0PN.js → normalize-dashboard-for-dirty-check-5KpZN8xr.js} +20 -19
- package/dist/chunks/normalize-dashboard-for-dirty-check-BXRUMVb2.js +1 -0
- package/dist/chunks/{resource-management-panel-C_ZqsVMH.js → resource-management-panel-Cz7MYBC7.js} +1 -1
- package/dist/chunks/{resource-management-panel-zF23gLOJ.js → resource-management-panel-DxG6-naG.js} +70 -70
- package/dist/chunks/use-create-flow-overlay-state-BcMrPzMc.js +1445 -0
- package/dist/chunks/use-create-flow-overlay-state-D13D1vB_.js +21 -0
- package/dist/chunks/{use-visual-utils-BBTQGDdB.js → use-visual-utils-DScc5-p_.js} +1 -1
- package/dist/chunks/{use-visual-utils-K1k39w2U.js → use-visual-utils-DmxEKpor.js} +1 -1
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +5 -4
- package/dist/index.cjs +1 -1
- package/dist/index.js +102 -99
- package/dist/shared/index.cjs +1 -1
- package/dist/shared/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +5 -4
- package/dist/types/dashboard.d.ts +105 -0
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.js +4 -3
- package/dist/types/main.d.ts +175 -1
- package/dist/types/shared.d.ts +89 -0
- package/dist/types/surfboard.d.ts +105 -0
- package/dist/types/types.d.ts +113 -0
- package/package.json +1 -1
- package/dist/chunks/dashboard-controls-CIdYp98a.js +0 -47
- package/dist/chunks/dashboard-controls-DOqBYrkB.js +0 -1847
- package/dist/chunks/dashboard-summary-settings-dialog-CaxmCNyy.js +0 -1
- package/dist/chunks/dashboard-summary-settings-dialog-DlVBUQmC.js +0 -544
- package/dist/chunks/edit-dashboard-visual-uA-0wLnR.js +0 -193
- package/dist/chunks/editor-action-buttons-B6lABkRB.js +0 -412
- package/dist/chunks/editor-action-buttons-Dh7Xndgk.js +0 -21
- package/dist/chunks/index-DOeggx0V.js +0 -1109
- package/dist/chunks/normalize-dashboard-for-dirty-check-B7NQDI1H.js +0 -1
- package/dist/chunks/notification-bell-BxyeaeRc.js +0 -839
- package/dist/chunks/notification-bell-tJRds5JJ.js +0 -6
|
@@ -316,6 +316,78 @@ export declare type ConnectionPolicy = {
|
|
|
316
316
|
|
|
317
317
|
declare type ConnectionType = 'GoogleSheets' | 'FileUpload' | 'MySQL' | 'MSSQL' | 'PostgreSQL' | 'BigQuery' | 'Redshift' | 'Snowflake' | 'S3' | 'clickhouse' | 'S3Tables' | 'API' | 'none';
|
|
318
318
|
|
|
319
|
+
export declare const CONTROL_CARD_DEFAULT_VALUE: "__card_default__";
|
|
320
|
+
|
|
321
|
+
export declare type ControlBinding = {
|
|
322
|
+
controlId: string;
|
|
323
|
+
target: 'sql_param';
|
|
324
|
+
paramId: string;
|
|
325
|
+
} | {
|
|
326
|
+
controlId: string;
|
|
327
|
+
target: 'config_metric_selector';
|
|
328
|
+
mapping: Record<string, StructuralMetricSelectorTarget>;
|
|
329
|
+
} | {
|
|
330
|
+
controlId: string;
|
|
331
|
+
target: 'config_field_selector';
|
|
332
|
+
mapping: Record<string, StructuralFieldSelectorTarget>;
|
|
333
|
+
} | {
|
|
334
|
+
controlId: string;
|
|
335
|
+
target: 'config_aggregation';
|
|
336
|
+
mapping: Record<string, string>;
|
|
337
|
+
} | {
|
|
338
|
+
controlId: string;
|
|
339
|
+
target: 'config_grain';
|
|
340
|
+
mapping: Record<string, string>;
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
export declare type ControlDefinition = {
|
|
344
|
+
id: string;
|
|
345
|
+
label: string;
|
|
346
|
+
scope: ControlScope;
|
|
347
|
+
type: ControlType;
|
|
348
|
+
source: ControlSource;
|
|
349
|
+
initialValueStrategy: ControlInitialValueStrategy;
|
|
350
|
+
defaultValue?: unknown;
|
|
351
|
+
requiredAtExecution: boolean;
|
|
352
|
+
hidden?: boolean;
|
|
353
|
+
locked?: boolean;
|
|
354
|
+
helpText?: string;
|
|
355
|
+
placement?: 'toolbar' | 'card_header' | 'advanced';
|
|
356
|
+
showLabel?: boolean;
|
|
357
|
+
toolbarWidth?: number;
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
export declare type ControlInitialValueStrategy = 'saved_default' | 'builtin' | 'embed_required' | 'schedule_snapshot';
|
|
361
|
+
|
|
362
|
+
export declare type ControlOption = {
|
|
363
|
+
value: string;
|
|
364
|
+
label: string;
|
|
365
|
+
presentation?: {
|
|
366
|
+
granularity?: TimeGranularity;
|
|
367
|
+
dateFormat?: DateFormatValue;
|
|
368
|
+
customFormat?: string;
|
|
369
|
+
};
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
export declare type ControlScope = 'dashboard' | 'card';
|
|
373
|
+
|
|
374
|
+
export declare type ControlSource = {
|
|
375
|
+
kind: 'manual';
|
|
376
|
+
options: ControlOption[];
|
|
377
|
+
} | {
|
|
378
|
+
kind: 'dataset_values';
|
|
379
|
+
fieldId: string;
|
|
380
|
+
connectionId?: string;
|
|
381
|
+
} | {
|
|
382
|
+
kind: 'field_allowlist';
|
|
383
|
+
fieldIds: string[];
|
|
384
|
+
} | {
|
|
385
|
+
kind: 'metric_allowlist';
|
|
386
|
+
metricIds: string[];
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
export declare type ControlType = 'enum' | 'multi_enum' | 'text' | 'number' | 'boolean' | 'date' | 'field_selector' | 'metric_selector' | 'aggregation_selector' | 'grain_selector';
|
|
390
|
+
|
|
319
391
|
export declare type CustomCard = CardWithContent | CardWithFooter;
|
|
320
392
|
|
|
321
393
|
declare type DashboardAIContext = AIContext & {
|
|
@@ -370,6 +442,20 @@ export declare type DashboardProps = {
|
|
|
370
442
|
* Default filter values for the dashboard. The dashboard will be filtered by these values when the user loads the dashboard.
|
|
371
443
|
*/
|
|
372
444
|
defaultFilterValues?: TFilterValue[];
|
|
445
|
+
/**
|
|
446
|
+
* Default runtime control values for the dashboard. Used by print/render flows
|
|
447
|
+
* and other external entry points that need deterministic control state.
|
|
448
|
+
*/
|
|
449
|
+
defaultControlValues?: Record<string, unknown>;
|
|
450
|
+
/**
|
|
451
|
+
* Optional control contract override used by print/replay entry points that
|
|
452
|
+
* need to execute against a saved card/dashboard control contract snapshot.
|
|
453
|
+
*/
|
|
454
|
+
controlContractOverrides?: {
|
|
455
|
+
controlDefinitions?: ControlDefinition[];
|
|
456
|
+
cardControlDefinitions?: ControlDefinition[];
|
|
457
|
+
controlBindings?: ControlBinding[];
|
|
458
|
+
};
|
|
373
459
|
customStyle?: TStyle;
|
|
374
460
|
currentTheme?: Theme;
|
|
375
461
|
version?: string;
|
|
@@ -819,6 +905,11 @@ export declare type FilterLayoutSettings = {
|
|
|
819
905
|
* Useful when embedding Dashboard component without Surfboard's controls
|
|
820
906
|
*/
|
|
821
907
|
showDownloadButton?: boolean;
|
|
908
|
+
/**
|
|
909
|
+
* Mixed toolbar item order for dashboard-level filter and control chips.
|
|
910
|
+
* Values use prefixed ids like `filter:<id>` and `control:<id>`.
|
|
911
|
+
*/
|
|
912
|
+
toolbarItemOrder?: string[];
|
|
822
913
|
};
|
|
823
914
|
|
|
824
915
|
declare type FilterLocation = 'dashboard' | 'frame' | 'sheet' | undefined;
|
|
@@ -1225,6 +1316,10 @@ declare type StringOptions = {
|
|
|
1225
1316
|
maxLength?: number;
|
|
1226
1317
|
};
|
|
1227
1318
|
|
|
1319
|
+
export declare type StructuralFieldSelectorTarget = GroupByField;
|
|
1320
|
+
|
|
1321
|
+
export declare type StructuralMetricSelectorTarget = MetricField;
|
|
1322
|
+
|
|
1228
1323
|
/**
|
|
1229
1324
|
* Style propeerites for the dashboard
|
|
1230
1325
|
*/
|
|
@@ -1450,6 +1545,14 @@ export declare type TCard = {
|
|
|
1450
1545
|
* Configured by editors via the visual editor settings.
|
|
1451
1546
|
*/
|
|
1452
1547
|
inlineFilters?: TInlineFilter[];
|
|
1548
|
+
/**
|
|
1549
|
+
* Card-scoped control definitions for this card.
|
|
1550
|
+
*/
|
|
1551
|
+
controls?: ControlDefinition[];
|
|
1552
|
+
/**
|
|
1553
|
+
* Per-card bindings that connect dashboard or card controls to this card's runtime targets.
|
|
1554
|
+
*/
|
|
1555
|
+
controlBindings?: ControlBinding[];
|
|
1453
1556
|
};
|
|
1454
1557
|
|
|
1455
1558
|
export declare type TCardContext = {
|
|
@@ -1666,6 +1769,8 @@ export declare type TDashboard = {
|
|
|
1666
1769
|
globalCacheConfig?: CacheConfig;
|
|
1667
1770
|
emailSettings?: EmailSettings;
|
|
1668
1771
|
defaultFilterValues?: TFilterValue[];
|
|
1772
|
+
controls?: ControlDefinition[];
|
|
1773
|
+
defaultControlValues?: Record<string, unknown>;
|
|
1669
1774
|
filterLayout?: FilterLayoutSettings;
|
|
1670
1775
|
};
|
|
1671
1776
|
|
package/dist/types/types.d.ts
CHANGED
|
@@ -72,6 +72,10 @@ export declare interface AlertDeliverablePreview {
|
|
|
72
72
|
|
|
73
73
|
export declare type AlertDeliveryChannel = 'EMAIL' | 'WEBHOOK' | 'SLACK' | 'IN_APP' | 'TELEGRAM';
|
|
74
74
|
|
|
75
|
+
export declare type AlertExecutionControlContext = {
|
|
76
|
+
values: Record<string, unknown>;
|
|
77
|
+
};
|
|
78
|
+
|
|
75
79
|
export declare type AlertExecutionFilterContext = {
|
|
76
80
|
active_filters: TFilterValue[];
|
|
77
81
|
};
|
|
@@ -182,6 +186,10 @@ export declare type AlertSource = {
|
|
|
182
186
|
executionSnapshot: {
|
|
183
187
|
queryConfig: AlertExecutionQueryConfig;
|
|
184
188
|
filterContext: AlertExecutionFilterContext;
|
|
189
|
+
controlContext?: AlertExecutionControlContext;
|
|
190
|
+
controlDefinitions?: ControlDefinition[];
|
|
191
|
+
cardControlDefinitions?: ControlDefinition[];
|
|
192
|
+
controlBindings?: ControlBinding[];
|
|
185
193
|
connectionId: string;
|
|
186
194
|
calendarContext?: {
|
|
187
195
|
tz: string;
|
|
@@ -545,6 +553,78 @@ export declare type ContextSource = {
|
|
|
545
553
|
outputAs?: string;
|
|
546
554
|
};
|
|
547
555
|
|
|
556
|
+
export declare const CONTROL_CARD_DEFAULT_VALUE: "__card_default__";
|
|
557
|
+
|
|
558
|
+
export declare type ControlBinding = {
|
|
559
|
+
controlId: string;
|
|
560
|
+
target: 'sql_param';
|
|
561
|
+
paramId: string;
|
|
562
|
+
} | {
|
|
563
|
+
controlId: string;
|
|
564
|
+
target: 'config_metric_selector';
|
|
565
|
+
mapping: Record<string, StructuralMetricSelectorTarget>;
|
|
566
|
+
} | {
|
|
567
|
+
controlId: string;
|
|
568
|
+
target: 'config_field_selector';
|
|
569
|
+
mapping: Record<string, StructuralFieldSelectorTarget>;
|
|
570
|
+
} | {
|
|
571
|
+
controlId: string;
|
|
572
|
+
target: 'config_aggregation';
|
|
573
|
+
mapping: Record<string, string>;
|
|
574
|
+
} | {
|
|
575
|
+
controlId: string;
|
|
576
|
+
target: 'config_grain';
|
|
577
|
+
mapping: Record<string, string>;
|
|
578
|
+
};
|
|
579
|
+
|
|
580
|
+
export declare type ControlDefinition = {
|
|
581
|
+
id: string;
|
|
582
|
+
label: string;
|
|
583
|
+
scope: ControlScope;
|
|
584
|
+
type: ControlType;
|
|
585
|
+
source: ControlSource;
|
|
586
|
+
initialValueStrategy: ControlInitialValueStrategy;
|
|
587
|
+
defaultValue?: unknown;
|
|
588
|
+
requiredAtExecution: boolean;
|
|
589
|
+
hidden?: boolean;
|
|
590
|
+
locked?: boolean;
|
|
591
|
+
helpText?: string;
|
|
592
|
+
placement?: 'toolbar' | 'card_header' | 'advanced';
|
|
593
|
+
showLabel?: boolean;
|
|
594
|
+
toolbarWidth?: number;
|
|
595
|
+
};
|
|
596
|
+
|
|
597
|
+
export declare type ControlInitialValueStrategy = 'saved_default' | 'builtin' | 'embed_required' | 'schedule_snapshot';
|
|
598
|
+
|
|
599
|
+
export declare type ControlOption = {
|
|
600
|
+
value: string;
|
|
601
|
+
label: string;
|
|
602
|
+
presentation?: {
|
|
603
|
+
granularity?: TimeGranularity;
|
|
604
|
+
dateFormat?: DateFormatValue;
|
|
605
|
+
customFormat?: string;
|
|
606
|
+
};
|
|
607
|
+
};
|
|
608
|
+
|
|
609
|
+
export declare type ControlScope = 'dashboard' | 'card';
|
|
610
|
+
|
|
611
|
+
export declare type ControlSource = {
|
|
612
|
+
kind: 'manual';
|
|
613
|
+
options: ControlOption[];
|
|
614
|
+
} | {
|
|
615
|
+
kind: 'dataset_values';
|
|
616
|
+
fieldId: string;
|
|
617
|
+
connectionId?: string;
|
|
618
|
+
} | {
|
|
619
|
+
kind: 'field_allowlist';
|
|
620
|
+
fieldIds: string[];
|
|
621
|
+
} | {
|
|
622
|
+
kind: 'metric_allowlist';
|
|
623
|
+
metricIds: string[];
|
|
624
|
+
};
|
|
625
|
+
|
|
626
|
+
export declare type ControlType = 'enum' | 'multi_enum' | 'text' | 'number' | 'boolean' | 'date' | 'field_selector' | 'metric_selector' | 'aggregation_selector' | 'grain_selector';
|
|
627
|
+
|
|
548
628
|
export declare interface CreateAlertRequest {
|
|
549
629
|
kind?: 'ALERT';
|
|
550
630
|
name: string;
|
|
@@ -614,6 +694,20 @@ export declare type DashboardProps = {
|
|
|
614
694
|
* Default filter values for the dashboard. The dashboard will be filtered by these values when the user loads the dashboard.
|
|
615
695
|
*/
|
|
616
696
|
defaultFilterValues?: TFilterValue[];
|
|
697
|
+
/**
|
|
698
|
+
* Default runtime control values for the dashboard. Used by print/render flows
|
|
699
|
+
* and other external entry points that need deterministic control state.
|
|
700
|
+
*/
|
|
701
|
+
defaultControlValues?: Record<string, unknown>;
|
|
702
|
+
/**
|
|
703
|
+
* Optional control contract override used by print/replay entry points that
|
|
704
|
+
* need to execute against a saved card/dashboard control contract snapshot.
|
|
705
|
+
*/
|
|
706
|
+
controlContractOverrides?: {
|
|
707
|
+
controlDefinitions?: ControlDefinition[];
|
|
708
|
+
cardControlDefinitions?: ControlDefinition[];
|
|
709
|
+
controlBindings?: ControlBinding[];
|
|
710
|
+
};
|
|
617
711
|
customStyle?: TStyle;
|
|
618
712
|
currentTheme?: Theme;
|
|
619
713
|
version?: string;
|
|
@@ -1080,6 +1174,11 @@ export declare type FilterLayoutSettings = {
|
|
|
1080
1174
|
* Useful when embedding Dashboard component without Surfboard's controls
|
|
1081
1175
|
*/
|
|
1082
1176
|
showDownloadButton?: boolean;
|
|
1177
|
+
/**
|
|
1178
|
+
* Mixed toolbar item order for dashboard-level filter and control chips.
|
|
1179
|
+
* Values use prefixed ids like `filter:<id>` and `control:<id>`.
|
|
1180
|
+
*/
|
|
1181
|
+
toolbarItemOrder?: string[];
|
|
1083
1182
|
};
|
|
1084
1183
|
|
|
1085
1184
|
declare type FilterLocation = 'dashboard' | 'frame' | 'sheet' | undefined;
|
|
@@ -1547,6 +1646,10 @@ declare type StringOptions = {
|
|
|
1547
1646
|
maxLength?: number;
|
|
1548
1647
|
};
|
|
1549
1648
|
|
|
1649
|
+
export declare type StructuralFieldSelectorTarget = GroupByField;
|
|
1650
|
+
|
|
1651
|
+
export declare type StructuralMetricSelectorTarget = MetricField;
|
|
1652
|
+
|
|
1550
1653
|
/**
|
|
1551
1654
|
* Style propeerites for the dashboard
|
|
1552
1655
|
*/
|
|
@@ -1770,6 +1873,14 @@ export declare type TCard = {
|
|
|
1770
1873
|
* Configured by editors via the visual editor settings.
|
|
1771
1874
|
*/
|
|
1772
1875
|
inlineFilters?: TInlineFilter[];
|
|
1876
|
+
/**
|
|
1877
|
+
* Card-scoped control definitions for this card.
|
|
1878
|
+
*/
|
|
1879
|
+
controls?: ControlDefinition[];
|
|
1880
|
+
/**
|
|
1881
|
+
* Per-card bindings that connect dashboard or card controls to this card's runtime targets.
|
|
1882
|
+
*/
|
|
1883
|
+
controlBindings?: ControlBinding[];
|
|
1773
1884
|
};
|
|
1774
1885
|
|
|
1775
1886
|
export declare type TCardContext = {
|
|
@@ -1986,6 +2097,8 @@ export declare type TDashboard = {
|
|
|
1986
2097
|
globalCacheConfig?: CacheConfig;
|
|
1987
2098
|
emailSettings?: EmailSettings;
|
|
1988
2099
|
defaultFilterValues?: TFilterValue[];
|
|
2100
|
+
controls?: ControlDefinition[];
|
|
2101
|
+
defaultControlValues?: Record<string, unknown>;
|
|
1989
2102
|
filterLayout?: FilterLayoutSettings;
|
|
1990
2103
|
};
|
|
1991
2104
|
|
package/package.json
CHANGED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-DOeggx0V.js"),b=require("react");require("react-dom");const R=require("./notification-bell-tJRds5JJ.js"),As=require("./date-formatter-CqXdM6JO.js"),Ve=require("./dashboard-summary-settings-dialog-CaxmCNyy.js"),Es=require("./use-debounced-dirty-check-XHSwAefL.js"),be=require("./normalize-dashboard-for-dirty-check-B7NQDI1H.js"),$e=require("./editor-action-buttons-Dh7Xndgk.js");function Is(t){const o=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(o,a,r.get?r:{enumerable:!0,get:()=>t[a]})}}return o.default=t,Object.freeze(o)}const w=Is(b);/**
|
|
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 ks=s.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"}]]);/**
|
|
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 Ts=s.createLucideIcon("Glasses",[["circle",{cx:"6",cy:"15",r:"4",key:"vux9w4"}],["circle",{cx:"18",cy:"15",r:"4",key:"18o8ve"}],["path",{d:"M14 15a2 2 0 0 0-2-2 2 2 0 0 0-2 2",key:"1ag4bs"}],["path",{d:"M2.5 13 5 7c.7-1.3 1.4-2 3-2",key:"1hm1gs"}],["path",{d:"M21.5 13 19 7c-.7-1.3-1.5-2-3-2",key:"1r31ai"}]]);/**
|
|
12
|
-
* @license lucide-react v0.453.0 - ISC
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the ISC license.
|
|
15
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const Os=s.createLucideIcon("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
|
|
17
|
-
* @license lucide-react v0.453.0 - ISC
|
|
18
|
-
*
|
|
19
|
-
* This source code is licensed under the ISC license.
|
|
20
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const Ps=s.createLucideIcon("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
|
|
22
|
-
* @license lucide-react v0.453.0 - ISC
|
|
23
|
-
*
|
|
24
|
-
* This source code is licensed under the ISC license.
|
|
25
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/const _s=s.createLucideIcon("ShieldX",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]);/**
|
|
27
|
-
* @license lucide-react v0.453.0 - ISC
|
|
28
|
-
*
|
|
29
|
-
* This source code is licensed under the ISC license.
|
|
30
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/const Us=s.createLucideIcon("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);var ye={exports:{}},je={};/**
|
|
32
|
-
* @license React
|
|
33
|
-
* use-sync-external-store-shim.production.js
|
|
34
|
-
*
|
|
35
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
36
|
-
*
|
|
37
|
-
* This source code is licensed under the MIT license found in the
|
|
38
|
-
* LICENSE file in the root directory of this source tree.
|
|
39
|
-
*/var Ke;function Fs(){if(Ke)return je;Ke=1;var t=b;function o(n,u){return n===u&&(n!==0||1/n===1/u)||n!==n&&u!==u}var a=typeof Object.is=="function"?Object.is:o,r=t.useState,l=t.useEffect,c=t.useLayoutEffect,d=t.useDebugValue;function m(n,u){var p=u(),f=r({inst:{value:p,getSnapshot:u}}),v=f[0].inst,S=f[1];return c(function(){v.value=p,v.getSnapshot=u,h(v)&&S({inst:v})},[n,p,u]),l(function(){return h(v)&&S({inst:v}),n(function(){h(v)&&S({inst:v})})},[n]),d(p),p}function h(n){var u=n.getSnapshot;n=n.value;try{var p=u();return!a(n,p)}catch{return!0}}function j(n,u){return u()}var x=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?j:m;return je.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:x,je}var Se={};/**
|
|
40
|
-
* @license React
|
|
41
|
-
* use-sync-external-store-shim.development.js
|
|
42
|
-
*
|
|
43
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
44
|
-
*
|
|
45
|
-
* This source code is licensed under the MIT license found in the
|
|
46
|
-
* LICENSE file in the root directory of this source tree.
|
|
47
|
-
*/var Qe;function Rs(){return Qe||(Qe=1,process.env.NODE_ENV!=="production"&&function(){function t(p,f){return p===f&&(p!==0||1/p===1/f)||p!==p&&f!==f}function o(p,f){x||l.startTransition===void 0||(x=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var v=f();if(!n){var S=f();c(v,S)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),n=!0)}S=d({inst:{value:v,getSnapshot:f}});var D=S[0].inst,I=S[1];return h(function(){D.value=v,D.getSnapshot=f,a(D)&&I({inst:D})},[p,v,f]),m(function(){return a(D)&&I({inst:D}),p(function(){a(D)&&I({inst:D})})},[p]),j(v),v}function a(p){var f=p.getSnapshot;p=p.value;try{var v=f();return!c(p,v)}catch{return!0}}function r(p,f){return f()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var l=b,c=typeof Object.is=="function"?Object.is:t,d=l.useState,m=l.useEffect,h=l.useLayoutEffect,j=l.useDebugValue,x=!1,n=!1,u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:o;Se.useSyncExternalStore=l.useSyncExternalStore!==void 0?l.useSyncExternalStore:u,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Se}process.env.NODE_ENV==="production"?ye.exports=Fs():ye.exports=Rs();var Gs=ye.exports;function Bs(){const{setTheme:t}=s.useTheme(),o=s.useDashboardStore(a=>a.actions.setDashboardTheme);return e.jsxs(s.DropdownMenu,{children:[e.jsx(s.DropdownMenuTrigger,{asChild:!0,children:e.jsxs(s.Button,{className:"h-7 p-2",variant:"ghost",size:"sm",children:[e.jsx(Us,{strokeWidth:1.5,className:"h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),e.jsx(Ps,{strokeWidth:1.5,className:"absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),e.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),e.jsxs(s.DropdownMenuContent,{align:"end",children:[e.jsx(s.DropdownMenuItem,{onClick:()=>{t("light"),o("light")},children:"Light"}),e.jsx(s.DropdownMenuItem,{onClick:()=>{t("dark"),o("dark")},children:"Dark"}),e.jsx(s.DropdownMenuItem,{onClick:()=>{t("system"),o("system")},children:"System"})]})]})}async function qs(t,o,a,r,l){if(!l)return null;const c=JSON.stringify(a),d=`${t}/v1/lens`;return await s.postRequest(d,l,{name:o,template:c,filterValues:r,operation:"create"})}async function De(t,o,a){if(!a)return null;const{id:r,template:l,filterValues:c,isDefault:d,shared:m}=o,h=`${t}/v1/lens`;return await s.postRequest(h,a,{lensId:r,template:l,filterValues:c,isDefault:d,shared:m,operation:"update"})}async function Hs(t,o,a){if(!a)return null;const r=`${t}/v1/lens`;return await s.postRequest(r,a,{operation:"delete",lensId:o})}function zs(){const[t,o]=b.useState(""),[a,r]=b.useState(!1),l=s.useDashboardStore(S=>S.lenses),{setLenses:c,setSelectedLensId:d}=s.useDashboardActions(),[m,h]=b.useState(!1),[j,x]=b.useState(!1),n=s.useDashboardStore(S=>S.dashboard),u=s.useDashboardStore(S=>S.filterValues),{authToken:p,tokenProps:f}=s.useSemaphorContext();async function v(){h(!0);const S=await qs(f.apiServiceUrl,t,n,u,p==null?void 0:p.accessToken);S&&(c([...l||[],S]),d(S.id),x(!1)),h(!1)}return e.jsxs(s.Dialog,{open:j,onOpenChange:x,children:[e.jsx(s.DialogTrigger,{asChild:!0,children:e.jsxs(s.Button,{variant:"secondary",className:"h-7 p-2",size:"sm",children:[e.jsx(s.Plus,{className:"mr-2 h-4 w-4"}),"Lens"]})}),e.jsxs(s.DialogContent,{className:"sm:max-w-[425px]",children:[e.jsxs(s.DialogHeader,{children:[e.jsx(s.DialogTitle,{children:"Create Lens"}),e.jsx(s.DialogDescription,{children:"Lenses are private by default and are only visible to you."})]}),e.jsx("div",{className:"grid gap-4 py-4",children:e.jsxs("div",{className:"grid grid-cols-8 items-center gap-4",children:[e.jsx(s.Label,{className:"text-right",children:"Name"}),e.jsx(s.Input,{value:t,onChange:S=>{o(S.target.value)},id:"name",className:"col-span-7 focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0"})]})}),a&&e.jsx("p",{className:"text-sm",children:"The lens name already exists. Use a differnet name."}),e.jsx(s.DialogFooter,{children:e.jsx(s.Button,{size:"sm",variant:"outline",type:"submit",onClick:v,disabled:m,children:m?"Creating...":"Add"})})]})]})}function Vs(){const[t,o]=b.useState(!1),a=s.useDashboardStore(n=>n.lenses),r=s.useDashboardStore(n=>n.selectedLensId),{setLenses:l,setSelectedLensId:c}=s.useDashboardActions(),{authToken:d,tokenProps:m}=s.useSemaphorContext();async function h(n){c(n)}async function j(n){if(await Hs(m.apiServiceUrl,n,d==null?void 0:d.accessToken)){const p=a==null?void 0:a.filter(f=>f.id!==n);l(p||[]),c("original")}}async function x(n){const u=a==null?void 0:a.map(v=>v.id===n.id?{...v,isDefault:!n.isDefault}:{...v,isDefault:!1});l(u||[]);const p={...n,isDefault:!n.isDefault};await De(m.apiServiceUrl,p,d==null?void 0:d.accessToken);const f=a==null?void 0:a.find(v=>v.isDefault);if(f&&f.id!==n.id){const v={...f,isDefault:!1};await De(m.apiServiceUrl,v,d==null?void 0:d.accessToken)}}return e.jsxs(s.DropdownMenu,{open:t,onOpenChange:o,children:[e.jsx(s.DropdownMenuTrigger,{asChild:!0,children:e.jsx(s.IconButton,{tooltip:"Lenses",className:"h-7 p-2",children:e.jsx(Ts,{className:"h-4 w-4"})})}),e.jsxs(s.DropdownMenuContent,{align:"end",className:"w-60",children:[e.jsx(s.DropdownMenuLabel,{className:"px-3",children:"Lenses"}),e.jsx(s.DropdownMenuSeparator,{}),e.jsxs(s.DropdownMenuRadioGroup,{value:r,onValueChange:h,children:[e.jsx(s.DropdownMenuRadioItem,{value:"original",children:"Original"}),a==null?void 0:a.map(n=>e.jsxs(s.DropdownMenuRadioItem,{className:"group flex justify-between gap-2",value:n.id,children:[e.jsx("p",{children:n.name}),e.jsxs("span",{className:"flex items-center gap-3",children:[e.jsx(s.House,{onClick:u=>{u.preventDefault(),x(n)},className:s.cn("size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",{invisible:!n.isDefault,"text-green-500":n.isDefault}),strokeWidth:1.5}),e.jsx(s.Cross2Icon,{onClick:u=>{u.preventDefault(),j(n.id)},className:"invisible size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",strokeWidth:1.5})]})]},n.id))]})]})]})}function $s(){const{displayPreferences:t,shouldShowElement:o}=s.useDisplayPreferences(),{currentUser:a,userContext:r}=s.useCurrentUserInfo(),l=b.useMemo(()=>s.getRoleBasedDisplayOverrides(a),[a]),c=b.useMemo(()=>m=>l&&l[m]!==void 0&&l[m]===!1?!1:o(m),[l,o,t]),d=b.useMemo(()=>{var m,h,j,x,n;return{canEdit:((m=r==null?void 0:r.permissions)==null?void 0:m.canEdit)??s.canUserEdit(a),canUseFilters:((h=r==null?void 0:r.permissions)==null?void 0:h.canEdit)??s.canUserUseFilters(a),canManageDashboards:((j=r==null?void 0:r.permissions)==null?void 0:j.canCreateDashboard)??s.canUserManageDashboards(a),canCreateDashboards:((x=r==null?void 0:r.permissions)==null?void 0:x.canCreateDashboard)??s.canUserCreateDashboards(a),canAccessVisuals:((n=r==null?void 0:r.permissions)==null?void 0:n.canEdit)??s.canUserAccessVisuals(a)}},[a,r]);return{displayPreferences:t,shouldShowElement:c,permissions:d,currentUser:a}}const Ks=async(t,o,a)=>{const r=`${t}/management/v1/groups`;return await s.postRequestRegular(r,o,a)},Qs=async(t,o,a)=>{const r=`${t}/management/v1/groups/${a}`,l=await fetch(r,{method:"DELETE",headers:{Authorization:`Bearer ${o}`}});if(!l.ok){const c=await l.text();throw new Error(c||"Failed to delete group")}},Ws=async(t,o,a,r)=>{const l=`${t}/management/v1/groups/${a}/members`;return await s.postRequestRegular(l,o,r)},Js=async(t,o,a,r)=>{const l=`${t}/management/v1/groups/${a}/members`,c=await fetch(l,{method:"DELETE",headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`},body:JSON.stringify(r)});if(!c.ok){const d=await c.text();throw new Error(d||"Failed to remove group members")}};function Xs(){const{authToken:t,tokenProps:o}=s.useSemaphorContext(),a=s.useQueryClient();return s.useMutation({mutationFn:r=>Ks(o.apiServiceUrl,(t==null?void 0:t.accessToken)||"",r),onSuccess:()=>{a.invalidateQueries({queryKey:["groups"]}),s.ue.success("Group created successfully")},onError:r=>{console.error("Failed to create group:",r),s.ue.error("Failed to create group",{description:r.message})}})}function Ys(){const{authToken:t,tokenProps:o}=s.useSemaphorContext(),a=s.useQueryClient();return s.useMutation({mutationFn:r=>Qs(o.apiServiceUrl,(t==null?void 0:t.accessToken)||"",r),onSuccess:(r,l)=>{a.invalidateQueries({queryKey:["groups"]}),a.removeQueries({queryKey:["group",l]}),s.ue.success("Group deleted successfully")},onError:r=>{console.error("Failed to delete group:",r),s.ue.error("Failed to delete group",{description:r.message})}})}function Zs(){const{authToken:t,tokenProps:o}=s.useSemaphorContext(),a=s.useQueryClient();return s.useMutation({mutationFn:({groupId:r,data:l})=>Ws(o.apiServiceUrl,(t==null?void 0:t.accessToken)||"",r,l),onSuccess:(r,l)=>{a.invalidateQueries({queryKey:["group",l.groupId]}),a.invalidateQueries({queryKey:["group-members",l.groupId]}),a.invalidateQueries({queryKey:["groups"]}),s.ue.success("Members added successfully")},onError:r=>{console.error("Failed to add group members:",r),s.ue.error("Failed to add members",{description:r.message})}})}function et(){const{authToken:t,tokenProps:o}=s.useSemaphorContext(),a=s.useQueryClient();return s.useMutation({mutationFn:({groupId:r,data:l})=>Js(o.apiServiceUrl,(t==null?void 0:t.accessToken)||"",r,l),onSuccess:(r,l)=>{a.invalidateQueries({queryKey:["group",l.groupId]}),a.invalidateQueries({queryKey:["group-members",l.groupId]}),a.invalidateQueries({queryKey:["groups"]}),s.ue.success("Members removed successfully")},onError:r=>{console.error("Failed to remove group members:",r),s.ue.error("Failed to remove members",{description:r.message})}})}function st({onSuccess:t,tenantId:o,isTenantUser:a}){const[r,l]=b.useState(""),[c,d]=b.useState(""),[m,h]=b.useState({}),j=Xs(),x=()=>{const u={};return r.trim()?r.length<3?u.name="Group name must be at least 3 characters":r.length>50&&(u.name="Group name must be less than 50 characters"):u.name="Group name is required",c&&c.length>200&&(u.description="Description must be less than 200 characters"),h(u),Object.keys(u).length===0},n=async u=>{if(u.preventDefault(),!x())return;const p={name:r.trim(),description:c.trim()||void 0,type:a?"TENANT_GROUP":"ORG_GROUP",...a&&o?{tenantId:o}:{}};try{await j.mutateAsync(p),l(""),d(""),h({}),t()}catch(f){console.error("Failed to create group:",f)}};return e.jsxs("form",{onSubmit:n,className:"space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(s.Label,{htmlFor:"group-name",children:["Group Name ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(s.Input,{id:"group-name",placeholder:"e.g., Marketing Team, Engineering Squad",value:r,onChange:u=>{l(u.target.value),m.name&&h(p=>({...p,name:""}))},className:m.name?"border-destructive":"",disabled:j.isPending}),m.name&&e.jsx("p",{className:"text-sm text-destructive",children:m.name})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(s.Label,{htmlFor:"group-description",children:["Description",e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:"(optional)"})]}),e.jsx(s.Textarea,{id:"group-description",placeholder:"Describe the purpose of this group...",value:c,onChange:u=>{d(u.target.value),m.description&&h(p=>({...p,description:""}))},className:m.description?"border-destructive":"",disabled:j.isPending,rows:3}),m.description&&e.jsx("p",{className:"text-sm text-destructive",children:m.description}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[c.length,"/200 characters"]})]}),e.jsx("div",{className:"rounded-lg border bg-muted/50 p-4",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx(s.CircleAlert,{className:"h-4 w-4 mt-0.5 text-muted-foreground"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"This group will be accessible to users in your workspace. You can add members after creating the group."})]})})]}),e.jsxs("div",{className:"flex justify-end gap-3",children:[e.jsx(s.Button,{type:"button",variant:"outline",onClick:()=>{l(""),d(""),h({})},disabled:j.isPending,children:"Clear"}),e.jsx(s.Button,{type:"submit",disabled:j.isPending||!r.trim(),children:j.isPending?e.jsxs(e.Fragment,{children:[e.jsx(s.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(s.Users,{className:"mr-2 h-4 w-4"}),"Create Group"]})})]})]})}function tt(t,o=[]){let a=[];function r(c,d){const m=w.createContext(d);m.displayName=c+"Context";const h=a.length;a=[...a,d];const j=n=>{var D;const{scope:u,children:p,...f}=n,v=((D=u==null?void 0:u[t])==null?void 0:D[h])||m,S=w.useMemo(()=>f,Object.values(f));return e.jsx(v.Provider,{value:S,children:p})};j.displayName=c+"Provider";function x(n,u){var v;const p=((v=u==null?void 0:u[t])==null?void 0:v[h])||m,f=w.useContext(p);if(f)return f;if(d!==void 0)return d;throw new Error(`\`${n}\` must be used within \`${c}\``)}return[j,x]}const l=()=>{const c=a.map(d=>w.createContext(d));return function(m){const h=(m==null?void 0:m[t])||c;return w.useMemo(()=>({[`__scope${t}`]:{...m,[t]:h}}),[m,h])}};return l.scopeName=t,[r,at(l,...o)]}function at(...t){const o=t[0];if(t.length===1)return o;const a=()=>{const r=t.map(l=>({useScope:l(),scopeName:l.scopeName}));return function(c){const d=r.reduce((m,{useScope:h,scopeName:j})=>{const n=h(c)[`__scope${j}`];return{...m,...n}},{});return w.useMemo(()=>({[`__scope${o.scopeName}`]:d}),[d])}};return a.scopeName=o.scopeName,a}var rt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ne=rt.reduce((t,o)=>{const a=s.createSlot(`Primitive.${o}`),r=w.forwardRef((l,c)=>{const{asChild:d,...m}=l,h=d?a:o;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),e.jsx(h,{...m,ref:c})});return r.displayName=`Primitive.${o}`,{...t,[o]:r}},{});function nt(){return Gs.useSyncExternalStore(ot,()=>!0,()=>!1)}function ot(){return()=>{}}var we="Avatar",[it]=tt(we),[lt,Je]=it(we),Xe=w.forwardRef((t,o)=>{const{__scopeAvatar:a,...r}=t,[l,c]=w.useState("idle");return e.jsx(lt,{scope:a,imageLoadingStatus:l,onImageLoadingStatusChange:c,children:e.jsx(Ne.span,{...r,ref:o})})});Xe.displayName=we;var Ye="AvatarImage",Ze=w.forwardRef((t,o)=>{const{__scopeAvatar:a,src:r,onLoadingStatusChange:l=()=>{},...c}=t,d=Je(Ye,a),m=ct(r,c),h=s.useCallbackRef(j=>{l(j),d.onImageLoadingStatusChange(j)});return s.useLayoutEffect2(()=>{m!=="idle"&&h(m)},[m,h]),m==="loaded"?e.jsx(Ne.img,{...c,ref:o,src:r}):null});Ze.displayName=Ye;var es="AvatarFallback",ss=w.forwardRef((t,o)=>{const{__scopeAvatar:a,delayMs:r,...l}=t,c=Je(es,a),[d,m]=w.useState(r===void 0);return w.useEffect(()=>{if(r!==void 0){const h=window.setTimeout(()=>m(!0),r);return()=>window.clearTimeout(h)}},[r]),d&&c.imageLoadingStatus!=="loaded"?e.jsx(Ne.span,{...l,ref:o}):null});ss.displayName=es;function We(t,o){return t?o?(t.src!==o&&(t.src=o),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function ct(t,{referrerPolicy:o,crossOrigin:a}){const r=nt(),l=w.useRef(null),c=r?(l.current||(l.current=new window.Image),l.current):null,[d,m]=w.useState(()=>We(c,t));return s.useLayoutEffect2(()=>{m(We(c,t))},[c,t]),s.useLayoutEffect2(()=>{const h=n=>()=>{m(n)};if(!c)return;const j=h("loaded"),x=h("error");return c.addEventListener("load",j),c.addEventListener("error",x),o&&(c.referrerPolicy=o),typeof a=="string"&&(c.crossOrigin=a),()=>{c.removeEventListener("load",j),c.removeEventListener("error",x)}},[c,a,o]),d}var ts=Xe,as=Ze,rs=ss;const Ce=w.forwardRef(({className:t,...o},a)=>e.jsx(ts,{ref:a,className:s.cn("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...o}));Ce.displayName=ts.displayName;const dt=w.forwardRef(({className:t,...o},a)=>e.jsx(as,{ref:a,className:s.cn("aspect-square h-full w-full",t),...o}));dt.displayName=as.displayName;const Me=w.forwardRef(({className:t,...o},a)=>e.jsx(rs,{ref:a,className:s.cn("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...o}));Me.displayName=rs.displayName;function ut({open:t,onOpenChange:o,group:a,onUpdate:r}){const[l,c]=b.useState("members"),[d,m]=b.useState(""),[h,j]=b.useState([]),[x,n]=b.useState([]),{data:u,isLoading:p,refetch:f}=s.useGroupMembers(a.id),v=a.type==="TENANT_GROUP"?"tenant":"organization",{users:S,isLoading:D}=s.useUnifiedUsers({type:v,tenantId:a.tenantId||void 0,active:!0,limit:100}),I=Zs(),k=et(),A=(u==null?void 0:u.members)||[],O=b.useMemo(()=>new Set(A.map(g=>g.userId)),[A]),P=b.useMemo(()=>S.filter(g=>!O.has(g.id)),[S,O]),_=b.useMemo(()=>{if(!d)return P;const g=d.toLowerCase();return P.filter(C=>{var M,F;return((M=C.name)==null?void 0:M.toLowerCase().includes(g))||((F=C.email)==null?void 0:F.toLowerCase().includes(g))})},[P,d]),y=b.useMemo(()=>{if(!d)return A;const g=d.toLowerCase();return A.filter(C=>{var M,F,W,J;return((F=(M=C.user)==null?void 0:M.name)==null?void 0:F.toLowerCase().includes(g))||((J=(W=C.user)==null?void 0:W.email)==null?void 0:J.toLowerCase().includes(g))})},[A,d]),U=async()=>{if(h.length!==0)try{await I.mutateAsync({groupId:a.id,data:{userIds:h,userType:v==="tenant"?"tenant":"org"}}),j([]),c("members"),f(),r==null||r()}catch(g){console.error("Failed to add members:",g)}},re=async()=>{if(x.length!==0)try{await k.mutateAsync({groupId:a.id,data:{userIds:x}}),n([]),f(),r==null||r()}catch(g){console.error("Failed to remove members:",g)}},G=g=>{j(C=>C.includes(g)?C.filter(M=>M!==g):[...C,g])},B=g=>{n(C=>C.includes(g)?C.filter(M=>M!==g):[...C,g])};return e.jsx(e.Fragment,{children:e.jsx(s.Dialog,{open:t,onOpenChange:o,children:e.jsxs(s.DialogContent,{className:"max-w-3xl max-h-[80vh]","aria-describedby":"group-members-description",children:[e.jsxs(s.DialogHeader,{children:[e.jsx(s.DialogTitle,{children:a.name}),e.jsx("div",{className:"flex items-center gap-2 mt-1",children:e.jsxs("p",{className:"text-sm text-muted-foreground",children:[A.length," ",A.length===1?"member":"members"]})}),e.jsxs("p",{id:"group-members-description",className:"sr-only",children:["Add or remove members from the ",a.name," group"]})]}),e.jsxs(s.Tabs,{value:l,onValueChange:g=>{c(g),m(""),n([])},className:"mt-4",children:[e.jsxs(s.TabsList,{className:"grid w-full grid-cols-2",children:[e.jsx(s.TabsTrigger,{value:"members",children:"Current Members"}),e.jsx(s.TabsTrigger,{value:"add",children:"Add Members"})]}),e.jsxs(s.TabsContent,{value:"members",className:"mt-4 space-y-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx(s.Search,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(s.Input,{placeholder:"Search members...",value:d,onChange:g=>m(g.target.value),className:"pl-10"})]}),e.jsx(s.ScrollArea,{className:x.length>0?"h-[300px]":"h-[350px]",children:p?e.jsx("div",{className:"space-y-2",children:[1,2,3].map(g=>e.jsx(s.Skeleton,{className:"h-16 w-full"},g))}):y.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[e.jsx(s.Users,{className:"h-12 w-12 mb-3 opacity-50"}),e.jsx("p",{className:"text-sm font-medium",children:d?"No members found":"No members yet"}),e.jsx("p",{className:"text-xs mt-1",children:d?"Try a different search":'Switch to the "Add Members" tab to add people to this group'})]}):e.jsx("div",{className:"space-y-2",children:y.map(g=>e.jsx(mt,{member:g,selected:x.includes(g.userId),onToggle:()=>B(g.userId)},g.id))})}),x.length>0&&e.jsxs("div",{className:"flex items-center justify-between pt-4 border-t",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:[x.length," member",x.length!==1?"s":""," selected"]}),e.jsx(s.Button,{variant:"destructive",size:"sm",onClick:re,disabled:k.isPending,children:k.isPending?e.jsxs(e.Fragment,{children:[e.jsx(s.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Removing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(s.Trash2,{className:"mr-2 h-4 w-4"}),"Remove Selected"]})})]})]}),e.jsxs(s.TabsContent,{value:"add",className:"mt-4 space-y-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx(s.Search,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(s.Input,{placeholder:"Search users to add...",value:d,onChange:g=>m(g.target.value),className:"pl-10"})]}),e.jsx(s.ScrollArea,{className:"h-[300px]",children:D?e.jsx("div",{className:"space-y-2",children:[1,2,3].map(g=>e.jsx(s.Skeleton,{className:"h-16 w-full"},g))}):_.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[e.jsx(s.UserPlus,{className:"h-12 w-12 mb-3 opacity-50"}),e.jsx("p",{className:"text-sm font-medium",children:"No available users"}),e.jsx("p",{className:"text-xs mt-1",children:d?"Try a different search":"All eligible users are already members"})]}):e.jsx("div",{className:"space-y-2",children:_.map(g=>e.jsx(ht,{user:g,selected:h.includes(g.id),onToggle:()=>G(g.id)},g.id))})}),h.length>0&&e.jsxs("div",{className:"flex items-center justify-between pt-4 border-t",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:[h.length," user",h.length!==1?"s":""," selected"]}),e.jsx(s.Button,{onClick:U,disabled:I.isPending,children:I.isPending?e.jsxs(e.Fragment,{children:[e.jsx(s.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Adding..."]}):e.jsxs(e.Fragment,{children:[e.jsx(s.UserPlus,{className:"mr-2 h-4 w-4"}),"Add Members"]})})]})]})]})]})})})}function mt({member:t,selected:o,onToggle:a}){var l,c,d,m;const r=((c=(l=t.user)==null?void 0:l.name)==null?void 0:c.split(" ").map(h=>h[0]).join("").toUpperCase())||"?";return e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg border bg-card hover:bg-muted/50 cursor-pointer",onClick:a,children:[e.jsx(s.Checkbox,{checked:o}),e.jsx(Ce,{className:"h-8 w-8",children:e.jsx(Me,{className:"text-xs",children:r})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium",children:((d=t.user)==null?void 0:d.name)||"Unknown User"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:(m=t.user)==null?void 0:m.email})]})]})}function ht({user:t,selected:o,onToggle:a}){var l;const r=((l=t.name)==null?void 0:l.split(" ").map(c=>c[0]).join("").toUpperCase())||"?";return e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg border bg-card hover:bg-muted/50 cursor-pointer",onClick:a,children:[e.jsx(s.Checkbox,{checked:o}),e.jsx(Ce,{className:"h-8 w-8",children:e.jsx(Me,{className:"text-xs",children:r})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium",children:t.name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t.email})]})]})}function pt({open:t,onOpenChange:o}){const[a,r]=b.useState("groups"),[l,c]=b.useState(""),[d,m]=b.useState(null),[h,j]=b.useState(!1),[x,n]=b.useState(null),{tokenProps:u}=s.useSemaphorContext(),{currentUser:p}=s.useCurrentUserInfo(),f=Ys(),v=(p==null?void 0:p.type)==="tenant",S=u==null?void 0:u.tenantId,{groups:D,isLoading:I,refetch:k}=s.useGroups({type:v?"TENANT_GROUP":"all",tenantId:v?S:void 0,includeMembers:!1}),A=D.filter(y=>{var U;return y.name.toLowerCase().includes(l.toLowerCase())||((U=y.description)==null?void 0:U.toLowerCase().includes(l.toLowerCase()))}),O=async()=>{if(x)try{await f.mutateAsync(x.id),n(null),k()}catch(y){console.error("Failed to delete group:",y)}},P=y=>{m(y),j(!0)},_=()=>{r("groups"),k()};return e.jsxs(e.Fragment,{children:[e.jsx(s.Dialog,{open:t,onOpenChange:o,children:e.jsxs(s.DialogContent,{className:"max-w-4xl max-h-[80vh]",children:[e.jsxs(s.DialogHeader,{children:[e.jsxs(s.DialogTitle,{className:"flex items-center gap-2",children:[e.jsx(s.Users,{className:"h-5 w-5"}),"Group Management"]}),e.jsx(s.DialogDescription,{children:"Manage your groups, create new groups, and control group membership"})]}),e.jsxs(s.Tabs,{value:a,onValueChange:r,className:"mt-4",children:[e.jsxs(s.TabsList,{className:"grid w-full grid-cols-2",children:[e.jsxs(s.TabsTrigger,{value:"groups",className:"flex items-center gap-2",children:[e.jsx(s.Users,{className:"h-4 w-4"}),"Groups"]}),e.jsxs(s.TabsTrigger,{value:"create",className:"flex items-center gap-2",children:[e.jsx(s.Plus,{className:"h-4 w-4"}),"Create Group"]})]}),e.jsx(s.TabsContent,{value:"groups",className:"mt-4",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx(s.Search,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(s.Input,{placeholder:"Search groups...",value:l,onChange:y=>c(y.target.value),className:"pl-10"})]}),e.jsx(s.ScrollArea,{className:"h-[400px]",children:I?e.jsx("div",{className:"space-y-3",children:[1,2,3].map(y=>e.jsx(s.Skeleton,{className:"h-24 w-full"},y))}):A.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[e.jsx(s.Users,{className:"h-12 w-12 mb-3 opacity-50"}),e.jsx("p",{className:"text-sm font-medium",children:"No groups found"}),e.jsx("p",{className:"text-xs mt-1",children:l?"Try a different search":"Create your first group to get started"})]}):e.jsx("div",{className:"space-y-3",children:A.map(y=>e.jsx(xt,{group:y,onManageMembers:()=>P(y),onDelete:()=>n(y),currentUserId:p==null?void 0:p.id},y.id))})})]})}),e.jsx(s.TabsContent,{value:"create",className:"mt-4",children:e.jsx(st,{onSuccess:_,tenantId:S,isTenantUser:v})})]})]})}),d&&e.jsx(ut,{open:h,onOpenChange:j,group:d,onUpdate:()=>k()}),e.jsx(s.AlertDialog,{open:!!x,onOpenChange:()=>n(null),children:e.jsxs(s.AlertDialogContent,{children:[e.jsxs(s.AlertDialogHeader,{children:[e.jsx(s.AlertDialogTitle,{children:"Delete Group"}),e.jsxs(s.AlertDialogDescription,{children:['Are you sure you want to delete "',x==null?void 0:x.name,'"? This action cannot be undone and will remove all members from the group.']})]}),e.jsxs(s.AlertDialogFooter,{children:[e.jsx(s.AlertDialogCancel,{children:"Cancel"}),e.jsx(s.AlertDialogAction,{onClick:O,disabled:f.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:f.isPending?e.jsxs(e.Fragment,{children:[e.jsx(s.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Deleting..."]}):"Delete Group"})]})]})})]})}function xt({group:t,onManageMembers:o,onDelete:a,currentUserId:r}){const l=t.createdBy===r;return e.jsx("div",{className:"rounded-lg border bg-card p-4 transition-colors hover:bg-muted/50",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium",children:t.name}),t.description&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t.description})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(s.Users,{className:"h-3 w-3"}),t.memberCount," ",t.memberCount===1?"member":"members"]}),e.jsxs("span",{children:["Created ",As.format(new Date(t.createdAt),"MMM d, yyyy")]})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(s.Button,{variant:"ghost",size:"sm",onClick:o,title:"Manage members",children:e.jsx(s.UserPlus,{className:"h-4 w-4"})}),l&&e.jsx(s.Button,{variant:"ghost",size:"sm",onClick:a,title:"Delete group",className:"text-destructive hover:text-destructive",children:e.jsx(s.Trash2,{className:"h-4 w-4"})})]})]})})}function gt(){var Ue,Fe,Re,Ge;R.useExportRecovery(),R.useExportPolling();const{authToken:t,tokenProps:o,id:a}=s.useSemaphorContext(),{isLocalDev:r}=s.useDashboardPreferences(),{permissions:l}=$s(),c=s.useHasDashboardId(),{isLoading:d}=s.useDashboardQuery();s.useDashboardStore(i=>i.theme);const m=s.useDashboardStore(i=>i.dashboardAssistantDraftScopeKey),h=s.useDashboardStore(i=>i.lenses),j=s.useDashboardStore(i=>i.selectedLensId),x=h==null?void 0:h.find(i=>i.id===j),n=s.useDashboardStore(i=>i.dashboard);s.useDashboardStore(i=>i.selectedSheetId);const u=s.useDashboardStore(i=>i.isDashboardEditing),{setDashboardTitle:p}=s.useDashboardStore(i=>i.actions),[f,v]=b.useState(!1),[S,D]=b.useState(!1),[I,k]=b.useState(!1),[A,O]=b.useState(!1),[P,_]=b.useState(!1),[y,U]=b.useState(!1),[re,G]=b.useState(!1),[B,g]=b.useState(null),[C,M]=b.useState(!1),F=s.useDashboardStore(i=>i.isDashboardPanelOpen),W=s.useDashboardStore(i=>i.actions.setIsDashboardPanelOpen),J=s.useDashboardStore(i=>i.filterValues),N=s.useDashboardStore(i=>i.isVisualEditing);s.useEditorStore(i=>i.card);const H=s.useManagementStore(i=>i.selectedDashboard),X=s.useManagementStore(i=>i.initialDashboard);s.useManagementStore(i=>i.selectedVisual),s.useDashboardStore(i=>i.selectedFrameId),s.useEditorStore(i=>i.frame);const Y=H?(Fe=H==null?void 0:H.permissions)==null?void 0:Fe.canEdit:(Ue=X==null?void 0:X.permissions)==null?void 0:Ue.canEdit,ne=s.useDashboardStore(i=>i.showFilters),ns=s.useAssistantLayoutStore(i=>i.setPanelOpen),os=s.useDashboardStore(i=>i.showDashboardJSON),oe=s.useDashboardStore(i=>i.onSaveFunction),is=s.useDashboardStore(i=>i.actions.setShowFilters),{setIsDashboardEditing:Le,setShowDashboardJSON:Ae}=s.useDashboardStore(i=>i.actions),{setInitialDashboard:Ee,clearSelectedDashboard:ie}=s.useManagementStore(i=>i.actions),{resources:Z}=s.useResourceManagement(s.ResourceType.DASHBOARD),{data:le}=s.useUserPreferences(),ls=((Re=le==null?void 0:le.preference)==null?void 0:Re.defaultDashboardId)||null,{mutate:cs,isPending:ds}=s.useDefaultDashboardMutation(),{currentUser:us}=s.useCurrentUserInfo(),ms=s.canUserManageGroups(us),q=H||X,Ie=q?{id:q.id,title:(n==null?void 0:n.title)||q.title||"Dashboard"}:null,{handleAddNewFrame:hs}=s.useAddNewFrame(),[ce,de]=b.useState(!1),[ps,z]=b.useState(!1),[ue,ee]=b.useState("close"),V=s.useUpdateResource(s.ResourceType.DASHBOARD),[T,me]=b.useState(null),xs=async(i,L)=>{if(!(n!=null&&n.id)){console.log("No dashboard ID found");return}console.log("Updating dashboard title:",{dashboardId:n.id,newTitle:i,previousTitle:L}),V.mutate({resourceId:n.id,data:{title:i}},{onSuccess:()=>{console.log("Dashboard title updated successfully"),s.ue.success("Dashboard title updated")},onError:Q=>{console.error("Failed to update dashboard title:",Q),s.ue.error("Failed to update dashboard title"),p(L)}})};b.useEffect(()=>{if(Z&&Z.length>0){const i=n==null?void 0:n.id;if(i){const L=Z.find(Q=>Q.id===i);L&&Ee(L)}}},[Z,n==null?void 0:n.id,Ee]);const se=o.orgUserId||o.tenantId,ke=u&&!N&&se&&Y,{setDashboard:he}=s.useDashboardStore(i=>i.actions),gs=()=>{Le(!0)},pe=()=>{Le(!1),Ae(!1),me(null)};R.usePristineSnapshotInitializer(u,n,T,i=>me(i));const{isDirty:Te,isDirtyPending:fs,resetDirty:te}=Es.useDebouncedDirtyCheck(n,T,300,1e3,be.serializeDashboardForDirtyCheck),Oe=b.useCallback(()=>T?be.serializeDashboardForDirtyCheck(n)!==be.serializeDashboardForDirtyCheck(T):!1,[n,T]),xe=Te||fs,$=ce||V.isPending,vs=()=>{Oe()?(ee("close"),z(!0)):(pe(),te())},bs=async()=>{await ge({closeAfterSave:!0,navigateHomeAfterSave:ue==="home"})},js=()=>{T&&he(T),pe(),ue==="home"&&ie(),ee("close"),z(!1),te()},Ss=()=>{T&&(he(T),te())},ys=()=>{if(u&&Oe()){ee("home"),z(!0);return}ie()};async function ge(i){const L=(i==null?void 0:i.closeAfterSave)??C,Q=(i==null?void 0:i.navigateHomeAfterSave)??!1;M(L),L&&z(!1);const Ms=s.cloneDeep(n);G(!0),g(null),de(!0);const Ls={template:n};V.mutate({resourceId:n.id,data:Ls},{onSuccess:E=>{var qe,He,ze;const Be=(E==null?void 0:E.id)||((qe=E==null?void 0:E.dashboard)==null?void 0:qe.id)||((He=E==null?void 0:E.resource)==null?void 0:He.id)||((ze=E==null?void 0:E.template)==null?void 0:ze.id)||null;if(!n.id&&Be){const ve=s.useAIInteractionStore.getState(),ae=ve.pendingDashboardDraftMigration;(ae==null?void 0:ae.scopeKey)===m?ve.actions.setPendingDashboardDraftMigrationExpectedDashboardId(Be):ae&&ve.actions.clearPendingDashboardDraftMigration()}de(!1),s.ue.success("Dashboard saved!"),me(Ms),G(!1),M(!1),L&&(pe(),te(),Q&&ie()),ee("close")},onError:()=>{de(!1),g("Failed to save dashboard. Please try again."),s.ue.error("Failed to save dashboard")}})}async function Ds(){if(v(!0),!j||!x)return;const i=JSON.stringify(n),L={...x,template:i,filterValues:J};await De(o.apiServiceUrl,L,t==null?void 0:t.accessToken),s.ue.success("Lens saved"),oe==null||oe(n),v(!1)}const Pe=(x==null?void 0:x.name)||n.title;V.isPending&&console.log("Title during update:",{title:Pe,dashboardStateTitle:n.title,dashboardId:n==null?void 0:n.id,currentLensName:x==null?void 0:x.name});const _e=o.orgUserId||o.tenantId&&o.endUserId&&o.endUserEmail,Ns=!!_e&&!!(t!=null&&t.accessToken)&&!!(o!=null&&o.apiServiceUrl),ws=c,K=(n==null?void 0:n.id)||null,fe=!!K&&ls===K,Cs=()=>{K&&cs({dashboardId:fe?null:K})};return e.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between gap-2 overflow-x-auto border-b px-4 py-2",role:"dashboard-controls",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[_e&&e.jsxs(e.Fragment,{children:[e.jsx(s.IconButton,{"aria-label":"Manage Dashboards",tooltip:"Manage Dashboards",onClick:()=>{W(!F)},className:"h-7 p-2",children:e.jsx(Os,{className:"h-4 w-4"})}),ws&&!N&&e.jsx(s.IconButton,{"aria-label":"Dashboard Hub",tooltip:"Dashboard Hub",onClick:ys,className:"h-7 p-2",children:e.jsx(s.House,{className:"h-4 w-4"})})]}),!N&&c&&(d?e.jsx("div",{className:"h-4 w-28 rounded-md bg-muted/70 animate-pulse","aria-label":"Loading dashboard title",role:"status",children:e.jsx("span",{className:"sr-only",children:"Loading dashboard title"})}):e.jsxs(e.Fragment,{children:[e.jsx(s.EditableText,{value:Pe||"Untitled Dashboard",onSave:i=>{console.log("EditableText onSave called:",{newTitle:i,canEditDashboard:Y,dashboardId:n==null?void 0:n.id});const L=(n==null?void 0:n.title)||"";p(i),xs(i,L)},isEditable:Y&&!x,displayClassName:"text-sm font-medium",inputClassName:"text-sm font-medium",placeholder:"Dashboard Title",isPending:V.isPending}),Ns&&K&&e.jsx(s.TooltipProvider,{children:e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsx(s.Button,{variant:"ghost",size:"icon",onClick:Cs,disabled:ds||!(t!=null&&t.accessToken)||!(o!=null&&o.apiServiceUrl),className:"h-7 w-7",children:e.jsx(s.Star,{className:s.cn("h-4 w-4 transition-colors",fe?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-400")})})}),e.jsx(s.TooltipContent,{children:e.jsx("p",{children:fe?"Remove as default dashboard":"Make this a default dashboard"})})]})})]}))]}),e.jsxs("div",{className:"flex items-center gap-2",children:[N&&e.jsxs(e.Fragment,{children:[e.jsx(R.AdvancedModeToggle,{className:"mr-2"}),e.jsx(R.VisualEditingControls,{className:"h-7"})]}),r&&!N&&e.jsxs(e.Fragment,{children:[e.jsx(s.IconButton,{tooltip:"Copy Token",onClick:()=>{var i;t!=null&&t.accessToken&&((i=navigator==null?void 0:navigator.clipboard)!=null&&i.writeText?navigator.clipboard.writeText(t.accessToken).then(()=>s.ue.success("Token copied to clipboard")).catch(()=>s.ue.error("Unable to copy token")):s.ue.error("Clipboard not available"))},className:"h-7 p-2",children:e.jsx(s.Copy,{className:"h-4 w-4"})}),e.jsx(s.IconButton,{tooltip:"Invalidate Token",onClick:()=>s.invalidateToken(o.apiServiceUrl),className:"h-7 p-2",children:e.jsx(_s,{className:"h-4 w-4"})})]}),!N&&c&&e.jsx(s.DownloadPdf,{}),!N&&c&&e.jsx(R.NotificationBell,{}),!N&&c&&((Ge=q==null?void 0:q.permissions)==null?void 0:Ge.canShare)&&e.jsx(s.IconButton,{tooltip:"Share Dashboard",onClick:()=>D(!0),className:"h-7 p-2",children:e.jsx(s.Share2,{className:"h-4 w-4"})}),!N&&u&&l.canUseFilters&&c&&e.jsxs(s.Button,{className:"h-7 px-2",variant:"outline",onClick:()=>{ne||ns("dashboard",!1),is(!ne)},size:"sm",children:[ne?e.jsx(ks,{className:"mr-2 h-4 w-4"}):e.jsx(s.Filter,{className:"mr-2 h-4 w-4"}),"Filter"]}),u&&!N&&se&&r&&c&&e.jsx(zs,{}),!N&&se&&r&&c&&e.jsx(Vs,{}),u&&!N&&se&&x&&r&&c&&e.jsxs(s.Button,{className:"h-7 p-2",variant:"secondary",disabled:f,onClick:Ds,size:"sm",children:[e.jsx($e.Save,{className:"mr-2 h-4 w-4"}),"Save Lens"]}),u&&!N&&c&&e.jsxs(s.Button,{variant:"outline",className:"h-7 p-2",size:"sm",disabled:!u,onClick:()=>hs(),children:[e.jsx(s.Plus,{className:"mr-2 h-4 w-4"}),"Visual"]}),!N&&!u&&Y&&c&&e.jsxs(s.Button,{variant:"outline",className:"h-7 p-2",onClick:gs,size:"sm",children:[e.jsx(s.Pencil,{className:"mr-2 h-4 w-4"}),"Edit"]}),ke&&c&&Te&&e.jsxs(s.Button,{variant:"outline",className:"h-7 p-2",onClick:Ss,size:"sm",disabled:$,children:[e.jsx(s.Undo2,{className:"mr-2 h-4 w-4"}),"Undo"]}),ke&&c&&e.jsxs("div",{className:"relative inline-flex",children:[e.jsxs(s.Button,{className:s.cn("h-7 p-2",!xe&&"opacity-60"),disabled:$||!xe,onClick:()=>ge(),size:"sm",children:[$?e.jsx(s.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx($e.Save,{className:"mr-2 h-4 w-4"}),$?"Saving...":"Save"]}),xe&&!$&&e.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute -right-1 -top-1 h-2.5 w-2.5 rounded-full bg-orange-500 ring-2 ring-background"})]}),!N&&u&&r&&c&&e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(s.Button,{className:"h-7 p-2",onClick:()=>Ae(!os),size:"sm",variant:"ghost",children:e.jsx(s.Code,{className:"h-4 w-4"})})}),!N&&r&&e.jsx(Bs,{}),u&&!N&&c&&e.jsxs(s.Button,{variant:"outline",className:"h-7 p-2",onClick:vs,children:[e.jsx(s.Cross2Icon,{className:"mr-2 h-4 w-4"}),"Close"]}),!N&&c&&e.jsxs(s.DropdownMenu,{children:[e.jsx(s.DropdownMenuTrigger,{asChild:!0,children:e.jsx(s.IconButton,{tooltip:"More Options",className:"h-8 w-8 rounded-md border border-transparent p-0 text-muted-foreground hover:bg-muted/50 hover:text-foreground",buttonProps:{"aria-label":"More dashboard options"},children:e.jsx(s.EllipsisVertical,{className:"h-4 w-4"})})}),e.jsxs(s.DropdownMenuContent,{align:"end",className:"w-56 rounded-xl border border-border/60 p-1 shadow-sm",children:[e.jsx(s.DropdownMenuLabel,{className:"px-2.5 text-xs font-medium text-muted-foreground",children:"Automation"}),e.jsxs(s.DropdownMenuItem,{onClick:()=>O(!0),className:"flex items-center gap-2",children:[e.jsx(s.Clock,{className:"mr-2 h-4 w-4"}),"Schedule Dashboard"]}),e.jsx(s.DropdownMenuSeparator,{}),ms&&e.jsxs(e.Fragment,{children:[e.jsx(s.DropdownMenuLabel,{className:"px-2.5 text-xs font-medium text-muted-foreground",children:"Access"}),e.jsxs(s.DropdownMenuItem,{onClick:()=>k(!0),className:"flex items-center gap-2",children:[e.jsx(s.Users,{className:"mr-2 h-4 w-4"}),"Manage Groups"]}),e.jsx(s.DropdownMenuSeparator,{})]}),e.jsx(s.DropdownMenuLabel,{className:"px-2.5 text-xs font-medium text-muted-foreground",children:"Preferences"}),e.jsxs(s.DropdownMenuItem,{onClick:()=>_(!0),className:"flex items-center gap-2",children:[e.jsx(s.Calendar,{className:"mr-2 h-4 w-4"}),"Calendar Preferences"]}),e.jsxs(s.DropdownMenuItem,{onClick:()=>U(!0),className:"flex items-center gap-2",children:[e.jsx(s.FileText,{className:"mr-2 h-4 w-4"}),"Summary Settings"]})]})]}),S&&Ie&&e.jsx(s.ShareDialog,{resource:Ie,resourceType:s.ResourceType.DASHBOARD,onClose:()=>D(!1)}),e.jsx(pt,{open:I,onOpenChange:k}),(n==null?void 0:n.id)&&e.jsx(s.EmailScheduleDialog,{open:A,onOpenChange:O,dashboardId:n.id,dashboardName:n==null?void 0:n.title}),e.jsx(Ve.CalendarPreferencesDialog,{open:P,onOpenChange:_}),e.jsx(Ve.DashboardSummarySettingsDialog,{open:y,onOpenChange:U,dashboard:n,disabled:!u,onApply:i=>he({...n,summary:i})}),e.jsx(s.AlertDialog,{open:re,onOpenChange:i=>{!i&&ce&&!B||(G(i),i||(g(null),M(!1)))},children:e.jsxs(s.AlertDialogContent,{className:"max-w-sm",children:[e.jsxs(s.AlertDialogHeader,{children:[e.jsx(s.AlertDialogTitle,{children:B?"Save failed":"Saving dashboard"}),e.jsx(s.AlertDialogDescription,{className:"pt-2",children:B?"We could not save the dashboard. Please try again.":"Please wait while we save your changes."})]}),e.jsx(s.AlertDialogFooter,{className:"flex-col gap-2 sm:flex-row sm:justify-end",children:B?e.jsxs(e.Fragment,{children:[e.jsx(s.AlertDialogCancel,{onClick:()=>{G(!1),g(null),M(!1)},className:"m-0",children:"Close"}),e.jsx(s.AlertDialogAction,{onClick:()=>ge({closeAfterSave:C,navigateHomeAfterSave:ue==="home"}),className:"m-0",children:"Retry"})]}):e.jsxs(s.AlertDialogAction,{disabled:!0,className:"m-0 cursor-default",children:[e.jsx(s.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]})})]})}),e.jsx(R.UnsavedChangesAlert,{open:ps,onOpenChange:i=>{z(i)},onSave:bs,onDiscard:js,isSaving:ce,saveLabel:"Save",discardLabel:"Discard"})]})]})}exports.default=gt;
|