react-semaphor 0.1.375 → 0.1.377
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/analytics-protocol/index.cjs +1 -1
- package/dist/analytics-protocol/index.js +47 -43
- package/dist/brand-studio/index.cjs +4 -9
- package/dist/brand-studio/index.js +98 -108
- package/dist/chunks/{braces-C3-w6xDL.js → braces-C2uBgj3t.js} +1 -1
- package/dist/chunks/{braces-C8QqW4wu.js → braces-CkXyWzRh.js} +1 -1
- package/dist/chunks/{calendar-preferences-dialog-DXgi7q5u.js → calendar-preferences-dialog-C55VOTIy.js} +6 -5
- package/dist/chunks/calendar-preferences-dialog-DAukJOaP.js +1 -0
- package/dist/chunks/catalog-field-grounding-BGW0hnB9.js +1 -0
- package/dist/chunks/catalog-field-grounding-DHXEI7cW.js +199 -0
- package/dist/chunks/{chevrons-up-down-DSvLu4Ye.js → chevrons-up-down-BnzChFLU.js} +1 -1
- package/dist/chunks/{chevrons-up-down-CnCSGY02.js → chevrons-up-down-W0nzHzx0.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-Jwbmrcl_.js → dashboard-briefing-launcher-CUyeiL_T.js} +3141 -2372
- package/dist/chunks/dashboard-briefing-launcher-DMKfG_z3.js +111 -0
- package/dist/chunks/dashboard-controls-B4hxFc3Q.js +2279 -0
- package/dist/chunks/dashboard-controls-D4vI0wvU.js +52 -0
- package/dist/chunks/dashboard-json-DQnm6daE.js +1 -0
- package/dist/chunks/{dashboard-json-Cl1O3uh0.js → dashboard-json-pl1_mFqJ.js} +14 -13
- package/dist/chunks/{edit-dashboard-visual-B_0sbc43.js → edit-dashboard-visual-CF4aSsav.js} +4729 -4645
- package/dist/chunks/edit-dashboard-visual-CjTXY51a.js +178 -0
- package/dist/chunks/{index-BIks0ktd.js → index-B2kPleRS.js} +186 -181
- package/dist/chunks/{index-BSkBy5cH.js → index-Bn866BBY.js} +22824 -22664
- package/dist/chunks/layout-grid-BFmJ7vmH.js +16 -0
- package/dist/chunks/layout-grid-CTOW9oTg.js +6 -0
- package/dist/chunks/{palette-DUGktM-M.js → palette-DrhPeer-.js} +1 -1
- package/dist/chunks/{palette-D-f4-82S.js → palette-OFaniMPn.js} +1 -1
- package/dist/chunks/{save-D3YYinDz.js → save-BxWBiQv1.js} +1 -1
- package/dist/chunks/{save-kkBEBeLg.js → save-Dh6gSC4x.js} +1 -1
- package/dist/chunks/{switch-Dkx2qEOr.js → switch-C-fGjxjY.js} +2002 -1983
- package/dist/chunks/switch-D5xopzFD.js +168 -0
- package/dist/chunks/use-create-flow-overlay-state-Dg2ffpCE.js +21 -0
- package/dist/chunks/use-create-flow-overlay-state-DrKP0jWE.js +1968 -0
- package/dist/chunks/{validation-1V7bWmYw.js → validation-BHFaWDU-.js} +1 -1
- package/dist/chunks/{validation-DlrTIf1N.js → validation-bMedDBOo.js} +1 -1
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.cjs +1 -1
- package/dist/dashboard-authoring/index.js +1 -1
- package/dist/data-app-builder/index.cjs +18 -13
- package/dist/data-app-builder/index.js +141 -131
- package/dist/data-app-sdk/index.cjs +1 -1
- package/dist/data-app-sdk/index.js +22 -21
- package/dist/data-app-sdk-validation/index.cjs +1 -1
- package/dist/data-app-sdk-validation/index.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +151 -151
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/analytics-protocol.d.ts +84 -0
- package/dist/types/main.d.ts +8 -12
- package/package.json +1 -1
- package/dist/chunks/calendar-preferences-dialog-CsRzDpDs.js +0 -1
- package/dist/chunks/catalog-field-grounding-DoEBOXQd.js +0 -100
- package/dist/chunks/catalog-field-grounding-Du6mKDcF.js +0 -1
- package/dist/chunks/dashboard-briefing-launcher-C-G6vQTL.js +0 -106
- package/dist/chunks/dashboard-controls-DzGGNQxv.js +0 -2269
- package/dist/chunks/dashboard-controls-p7VKzWSb.js +0 -57
- package/dist/chunks/dashboard-json-CvPhMpbM.js +0 -1
- package/dist/chunks/edit-dashboard-visual-CSrdS10O.js +0 -178
- package/dist/chunks/resource-management-panel-IHbUOh2g.js +0 -6
- package/dist/chunks/resource-management-panel-tFjbtgPw.js +0 -1018
- package/dist/chunks/switch-fIkmwzUt.js +0 -168
- package/dist/chunks/use-create-flow-overlay-state-D-yGZTR3.js +0 -1647
- package/dist/chunks/use-create-flow-overlay-state-DbaUD5xc.js +0 -26
- package/dist/chunks/use-visual-utils-B5hwU_av.js +0 -1
- package/dist/chunks/use-visual-utils-Dj82r7DA.js +0 -340
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../chunks/validators-jpoYhpHh.js"),r=require("../chunks/catalog-field-grounding-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../chunks/validators-jpoYhpHh.js"),r=require("../chunks/catalog-field-grounding-BGW0hnB9.js"),l=require("../chunks/source-identity-C-xaeE_I.js");function c(e,a={}){const i=d(e),s={connectionId:a.connectionId,connectionType:e,path:["database","schema","table"],labels:{database:"Database",schema:"Schema",table:"Table"},prefixLevels:["database","schema","table"],dialect:"postgres",supportsFilterClause:!0};return i.includes("postgres")?{...s,prefixLevels:["schema","table"],dialect:"postgres"}:i.includes("mysql")?{...s,prefixLevels:["database","table"],dialect:"mysql",supportsFilterClause:!1}:i.includes("mssql")||i.includes("sqlserver")?{...s,dialect:"mssql",supportsFilterClause:!1}:i.includes("redshift")?{...s,prefixLevels:["schema","table"],dialect:"redshift"}:i.includes("snowflake")?{...s,dialect:"snowflake"}:i.includes("clickhouse")?{connectionId:a.connectionId,connectionType:e,path:["database","table"],labels:{database:"Database",table:"Table"},prefixLevels:["database","table"],dialect:"clickhouse",supportsFilterClause:!1}:i==="s3"||i==="api"?{connectionId:a.connectionId,connectionType:e,path:["table"],labels:{table:i==="api"?"API Table":"File Table"},prefixLevels:["table"],dialect:"duckdb",supportsFilterClause:!0}:i==="googlesheets"||i==="fileupload"?{connectionId:a.connectionId,connectionType:e,path:["table"],labels:{table:"Table"},prefixLevels:["table"],dialect:"postgres",supportsFilterClause:!0}:i==="s3tables"?{...s,labels:{database:"Database",schema:"Namespace",table:"Table"},dialect:"duckdb"}:i==="bigquery"?{...s,labels:{database:"Project",schema:"Dataset",table:"Table"},prefixLevels:["schema","table"],dialect:"bigquery",supportsFilterClause:!1}:s}function u(e){const a=d(e);switch(a){case"mysql":case"bigquery":case"redshift":case"snowflake":case"clickhouse":case"duckdb":case"sqlite":return a;case"mssql":case"sqlserver":return"mssql";case"postgres":case"postgresql":return"postgres";default:return"unknown"}}function m(e){return e.capabilities.prefixLevels.every(a=>!!o(e.source,a))}function p(e){const a=e.quoteIdentifier??b;return e.capabilities.prefixLevels.map(i=>o(e.source,i)).filter(i=>!!i).map(i=>a(i,e.capabilities.dialect)).join(".")}function o(e,a){return a==="database"?e.databaseName:a==="schema"?e.schemaName:e.tableName}function b(e,a){return a==="mysql"||a==="bigquery"||a==="clickhouse"||a==="duckdb"?`\`${e.replace(/`/g,"``")}\``:a==="mssql"?`[${e.replace(/]/g,"]]")}]`:`"${e.replace(/"/g,'""')}"`}function d(e){if(typeof e!="string")return"";const a=[];for(const i of e.trim().toLowerCase())h(i)&&a.push(i);return a.join("")}function h(e){const a=e.charCodeAt(0);return a>=48&&a<=57||a>=97&&a<=122}const n={kind:"semantic",domainId:"domain_sales",datasetName:"orders",connectionId:"conn_sales",label:"Orders"},f={revenueKpi:{version:1,kind:"metric",id:"revenue-kpi",label:"Revenue",source:n,metrics:[{name:"revenue",role:"measure"}],primaryMetric:{name:"revenue",role:"measure"},comparison:{kind:"previous_period"},limit:1},revenueTrend:{version:1,kind:"records",id:"revenue-trend",label:"Revenue trend",source:n,fields:[{name:"order_date",role:"date",dataType:"date",label:"Order Date"},{name:"revenue",role:"measure",dataType:"number"}],dateField:{name:"order_date",role:"date",dataType:"date"},timeGrain:"month",limit:100},topCustomersRecords:{version:1,kind:"records",id:"top-customers",label:"Top customers",source:n,fields:[{name:"customer_name",role:"dimension",dataType:"string"},{name:"segment",role:"dimension",dataType:"string"},{name:"revenue",role:"measure",dataType:"number"}],orderBy:{field:{name:"revenue",role:"measure"},direction:"desc"},limit:20},regionInputOptions:{version:1,kind:"inputOptions",id:"region-options",label:"Region options",source:n,field:{name:"region",role:"dimension",dataType:"string"},limit:100},previousPeriodRevenueComparison:{version:1,kind:"metric",id:"revenue-previous-period",label:"Revenue previous period comparison",source:n,metrics:[{name:"revenue",role:"measure"}],primaryMetric:{name:"revenue",role:"measure"},dateField:{name:"order_date",role:"date",dataType:"date"},timeGrain:"week",comparison:{kind:"previous_period"},limit:100},inboundSupplierConcentration:{version:1,kind:"metric",id:"inbound-supplier-concentration",label:"Inbound supplier concentration",source:n,metrics:[{name:"net_tons",role:"measure"},{name:"ticket_value",role:"measure"}],primaryMetric:{name:"net_tons",role:"measure"},dateField:{name:"ticket_date",role:"date",dataType:"date"},timeWindow:{unit:"month",value:6,anchor:"latest_available"},dimensions:[{name:"supplier_id",role:"dimension",dataType:"number"}],filters:[{field:{name:"direction",role:"dimension",dataType:"string"},operator:"=",values:["Inbound"]}],limit:15},boundedSqlRanking:{version:1,kind:"sql",id:"top-customer-ranking-sql",label:"Top customer ranking SQL",source:{kind:"sql",connectionId:"conn_sales",dialect:"postgres"},sql:"SELECT customer_name, SUM(revenue) AS revenue FROM public.orders GROUP BY customer_name ORDER BY revenue DESC LIMIT 20",limit:20,rationale:"Ranking is SQL-natural because it requires ordering grouped aggregate rows.",fields:[{name:"customer_name",role:"dimension",dataType:"string"},{name:"revenue",role:"measure",dataType:"number"}]}};exports.normalizeSemaphorAnalyticsFilterOperator=t.normalizeSemaphorAnalyticsFilterOperator;exports.normalizeSemaphorInputOperator=t.normalizeSemaphorInputOperator;exports.parseSemaphorIsoTimeWindowBoundary=t.parseSemaphorIsoTimeWindowBoundary;exports.validateSemaphorAnalyticsIntent=t.validateSemaphorAnalyticsIntent;exports.validateSemaphorAnalyticsRecoveryPlan=t.validateSemaphorAnalyticsRecoveryPlan;exports.validateSemaphorDashboardIntent=t.validateSemaphorDashboardIntent;exports.validateSemaphorDerivedFieldDefinition=t.validateSemaphorDerivedFieldDefinition;exports.validateSemaphorOperationIntent=t.validateSemaphorOperationIntent;exports.validateSemaphorResultCalculation=t.validateSemaphorResultCalculation;exports.SEMAPHOR_ANALYZE_RESULT_FIELD_CONTRACT=r.SEMAPHOR_ANALYZE_RESULT_FIELD_CONTRACT;exports.buildAnalyticsCatalogFieldSummary=r.buildAnalyticsCatalogFieldSummary;exports.getAnalyticsCatalogFieldCandidates=r.getAnalyticsCatalogFieldCandidates;exports.getAnalyticsCatalogFieldName=r.getAnalyticsCatalogFieldName;exports.getSemaphorAnalyzeResultFieldNames=r.getSemaphorAnalyzeResultFieldNames;exports.isAnalyticsCatalogDateField=r.isAnalyticsCatalogDateField;exports.isAnalyticsCatalogDimensionField=r.isAnalyticsCatalogDimensionField;exports.isAnalyticsCatalogMetricField=r.isAnalyticsCatalogMetricField;exports.isAnalyticsDateLikeDataType=r.isAnalyticsDateLikeDataType;exports.isAnalyticsMetricIdentifierField=r.isAnalyticsMetricIdentifierField;exports.isAnalyticsTechnicalIdentifierField=r.isAnalyticsTechnicalIdentifierField;exports.isSemaphorAnalyzeResultFieldName=r.isSemaphorAnalyzeResultFieldName;exports.normalizeAnalyticsCatalogDataType=r.normalizeAnalyticsCatalogDataType;exports.normalizeAnalyticsCatalogName=r.normalizeAnalyticsCatalogName;exports.parseSemaphorAnalyzeResult=r.parseSemaphorAnalyzeResult;exports.preferSemaphorFieldRefMetadata=l.preferSemaphorFieldRefMetadata;exports.preferSemaphorSourceMetadata=l.preferSemaphorSourceMetadata;exports.semaphorFieldRefsMatch=l.semaphorFieldRefsMatch;exports.semaphorSourceIdentityKey=l.semaphorSourceIdentityKey;exports.semaphorSourcesReferToSameDataset=l.semaphorSourcesReferToSameDataset;exports.SEMAPHOR_ANALYTICS_INTENT_FIXTURES=f;exports.buildSemaphorQualifiedSourcePath=p;exports.getSemaphorConnectionCapabilities=c;exports.normalizeSemaphorDialect=u;exports.semaphorSourceHasRequiredCoordinates=m;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as h, n as v, p as g, c as y, e as S, f as k, v as C, d as
|
|
2
|
-
import {
|
|
3
|
-
import { c as
|
|
1
|
+
import { a as h, n as v, p as g, c as y, e as S, f as k, v as C, d as T, b as I } from "../chunks/validators-CtNmgsvG.js";
|
|
2
|
+
import { S as F, l as q, b as R, a as _, g as L, e as D, k as N, j as x, d as M, h as O, f as z, i as E, c as w, n as P, p as B } from "../chunks/catalog-field-grounding-DHXEI7cW.js";
|
|
3
|
+
import { c as Q, p as U, b as Y, s as G, a as H } from "../chunks/source-identity-Dj3dryN9.js";
|
|
4
4
|
function d(e, a = {}) {
|
|
5
|
-
const r = n(e),
|
|
5
|
+
const r = n(e), s = {
|
|
6
6
|
connectionId: a.connectionId,
|
|
7
7
|
connectionType: e,
|
|
8
8
|
path: ["database", "schema", "table"],
|
|
@@ -16,24 +16,24 @@ function d(e, a = {}) {
|
|
|
16
16
|
supportsFilterClause: !0
|
|
17
17
|
};
|
|
18
18
|
return r.includes("postgres") ? {
|
|
19
|
-
...
|
|
19
|
+
...s,
|
|
20
20
|
prefixLevels: ["schema", "table"],
|
|
21
21
|
dialect: "postgres"
|
|
22
22
|
} : r.includes("mysql") ? {
|
|
23
|
-
...
|
|
23
|
+
...s,
|
|
24
24
|
prefixLevels: ["database", "table"],
|
|
25
25
|
dialect: "mysql",
|
|
26
26
|
supportsFilterClause: !1
|
|
27
27
|
} : r.includes("mssql") || r.includes("sqlserver") ? {
|
|
28
|
-
...
|
|
28
|
+
...s,
|
|
29
29
|
dialect: "mssql",
|
|
30
30
|
supportsFilterClause: !1
|
|
31
31
|
} : r.includes("redshift") ? {
|
|
32
|
-
...
|
|
32
|
+
...s,
|
|
33
33
|
prefixLevels: ["schema", "table"],
|
|
34
34
|
dialect: "redshift"
|
|
35
35
|
} : r.includes("snowflake") ? {
|
|
36
|
-
...
|
|
36
|
+
...s,
|
|
37
37
|
dialect: "snowflake"
|
|
38
38
|
} : r.includes("clickhouse") ? {
|
|
39
39
|
connectionId: a.connectionId,
|
|
@@ -67,7 +67,7 @@ function d(e, a = {}) {
|
|
|
67
67
|
dialect: "postgres",
|
|
68
68
|
supportsFilterClause: !0
|
|
69
69
|
} : r === "s3tables" ? {
|
|
70
|
-
...
|
|
70
|
+
...s,
|
|
71
71
|
labels: {
|
|
72
72
|
database: "Database",
|
|
73
73
|
schema: "Namespace",
|
|
@@ -75,7 +75,7 @@ function d(e, a = {}) {
|
|
|
75
75
|
},
|
|
76
76
|
dialect: "duckdb"
|
|
77
77
|
} : r === "bigquery" ? {
|
|
78
|
-
...
|
|
78
|
+
...s,
|
|
79
79
|
labels: {
|
|
80
80
|
database: "Project",
|
|
81
81
|
schema: "Dataset",
|
|
@@ -84,7 +84,7 @@ function d(e, a = {}) {
|
|
|
84
84
|
prefixLevels: ["schema", "table"],
|
|
85
85
|
dialect: "bigquery",
|
|
86
86
|
supportsFilterClause: !1
|
|
87
|
-
} :
|
|
87
|
+
} : s;
|
|
88
88
|
}
|
|
89
89
|
function c(e) {
|
|
90
90
|
const a = n(e);
|
|
@@ -109,17 +109,17 @@ function c(e) {
|
|
|
109
109
|
}
|
|
110
110
|
function u(e) {
|
|
111
111
|
return e.capabilities.prefixLevels.every(
|
|
112
|
-
(a) => !!
|
|
112
|
+
(a) => !!t(e.source, a)
|
|
113
113
|
);
|
|
114
114
|
}
|
|
115
115
|
function m(e) {
|
|
116
|
-
const a = e.quoteIdentifier ??
|
|
117
|
-
return e.capabilities.prefixLevels.map((r) =>
|
|
116
|
+
const a = e.quoteIdentifier ?? l;
|
|
117
|
+
return e.capabilities.prefixLevels.map((r) => t(e.source, r)).filter((r) => !!r).map((r) => a(r, e.capabilities.dialect)).join(".");
|
|
118
118
|
}
|
|
119
|
-
function
|
|
119
|
+
function t(e, a) {
|
|
120
120
|
return a === "database" ? e.databaseName : a === "schema" ? e.schemaName : e.tableName;
|
|
121
121
|
}
|
|
122
|
-
function
|
|
122
|
+
function l(e, a) {
|
|
123
123
|
return a === "mysql" || a === "bigquery" || a === "clickhouse" || a === "duckdb" ? `\`${e.replace(/`/g, "``")}\`` : a === "mssql" ? `[${e.replace(/]/g, "]]")}]` : `"${e.replace(/"/g, '""')}"`;
|
|
124
124
|
}
|
|
125
125
|
function n(e) {
|
|
@@ -127,14 +127,14 @@ function n(e) {
|
|
|
127
127
|
return "";
|
|
128
128
|
const a = [];
|
|
129
129
|
for (const r of e.trim().toLowerCase())
|
|
130
|
-
|
|
130
|
+
o(r) && a.push(r);
|
|
131
131
|
return a.join("");
|
|
132
132
|
}
|
|
133
|
-
function
|
|
133
|
+
function o(e) {
|
|
134
134
|
const a = e.charCodeAt(0);
|
|
135
135
|
return a >= 48 && a <= 57 || a >= 97 && a <= 122;
|
|
136
136
|
}
|
|
137
|
-
const
|
|
137
|
+
const i = {
|
|
138
138
|
kind: "semantic",
|
|
139
139
|
domainId: "domain_sales",
|
|
140
140
|
datasetName: "orders",
|
|
@@ -146,7 +146,7 @@ const t = {
|
|
|
146
146
|
kind: "metric",
|
|
147
147
|
id: "revenue-kpi",
|
|
148
148
|
label: "Revenue",
|
|
149
|
-
source:
|
|
149
|
+
source: i,
|
|
150
150
|
metrics: [{ name: "revenue", role: "measure" }],
|
|
151
151
|
primaryMetric: { name: "revenue", role: "measure" },
|
|
152
152
|
comparison: { kind: "previous_period" },
|
|
@@ -157,7 +157,7 @@ const t = {
|
|
|
157
157
|
kind: "records",
|
|
158
158
|
id: "revenue-trend",
|
|
159
159
|
label: "Revenue trend",
|
|
160
|
-
source:
|
|
160
|
+
source: i,
|
|
161
161
|
fields: [
|
|
162
162
|
{ name: "order_date", role: "date", dataType: "date", label: "Order Date" },
|
|
163
163
|
{ name: "revenue", role: "measure", dataType: "number" }
|
|
@@ -171,7 +171,7 @@ const t = {
|
|
|
171
171
|
kind: "records",
|
|
172
172
|
id: "top-customers",
|
|
173
173
|
label: "Top customers",
|
|
174
|
-
source:
|
|
174
|
+
source: i,
|
|
175
175
|
fields: [
|
|
176
176
|
{ name: "customer_name", role: "dimension", dataType: "string" },
|
|
177
177
|
{ name: "segment", role: "dimension", dataType: "string" },
|
|
@@ -185,7 +185,7 @@ const t = {
|
|
|
185
185
|
kind: "inputOptions",
|
|
186
186
|
id: "region-options",
|
|
187
187
|
label: "Region options",
|
|
188
|
-
source:
|
|
188
|
+
source: i,
|
|
189
189
|
field: { name: "region", role: "dimension", dataType: "string" },
|
|
190
190
|
limit: 100
|
|
191
191
|
},
|
|
@@ -194,7 +194,7 @@ const t = {
|
|
|
194
194
|
kind: "metric",
|
|
195
195
|
id: "revenue-previous-period",
|
|
196
196
|
label: "Revenue previous period comparison",
|
|
197
|
-
source:
|
|
197
|
+
source: i,
|
|
198
198
|
metrics: [{ name: "revenue", role: "measure" }],
|
|
199
199
|
primaryMetric: { name: "revenue", role: "measure" },
|
|
200
200
|
dateField: { name: "order_date", role: "date", dataType: "date" },
|
|
@@ -207,7 +207,7 @@ const t = {
|
|
|
207
207
|
kind: "metric",
|
|
208
208
|
id: "inbound-supplier-concentration",
|
|
209
209
|
label: "Inbound supplier concentration",
|
|
210
|
-
source:
|
|
210
|
+
source: i,
|
|
211
211
|
metrics: [
|
|
212
212
|
{ name: "net_tons", role: "measure" },
|
|
213
213
|
{ name: "ticket_value", role: "measure" }
|
|
@@ -246,33 +246,37 @@ const t = {
|
|
|
246
246
|
};
|
|
247
247
|
export {
|
|
248
248
|
p as SEMAPHOR_ANALYTICS_INTENT_FIXTURES,
|
|
249
|
-
F as
|
|
249
|
+
F as SEMAPHOR_ANALYZE_RESULT_FIELD_CONTRACT,
|
|
250
|
+
q as buildAnalyticsCatalogFieldSummary,
|
|
250
251
|
m as buildSemaphorQualifiedSourcePath,
|
|
251
|
-
|
|
252
|
+
R as getAnalyticsCatalogFieldCandidates,
|
|
252
253
|
_ as getAnalyticsCatalogFieldName,
|
|
254
|
+
L as getSemaphorAnalyzeResultFieldNames,
|
|
253
255
|
d as getSemaphorConnectionCapabilities,
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
w as
|
|
256
|
+
D as isAnalyticsCatalogDateField,
|
|
257
|
+
N as isAnalyticsCatalogDimensionField,
|
|
258
|
+
x as isAnalyticsCatalogMetricField,
|
|
259
|
+
M as isAnalyticsDateLikeDataType,
|
|
260
|
+
O as isAnalyticsMetricIdentifierField,
|
|
261
|
+
z as isAnalyticsTechnicalIdentifierField,
|
|
262
|
+
E as isSemaphorAnalyzeResultFieldName,
|
|
263
|
+
w as normalizeAnalyticsCatalogDataType,
|
|
264
|
+
P as normalizeAnalyticsCatalogName,
|
|
262
265
|
h as normalizeSemaphorAnalyticsFilterOperator,
|
|
263
266
|
c as normalizeSemaphorDialect,
|
|
264
267
|
v as normalizeSemaphorInputOperator,
|
|
268
|
+
B as parseSemaphorAnalyzeResult,
|
|
265
269
|
g as parseSemaphorIsoTimeWindowBoundary,
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
270
|
+
Q as preferSemaphorFieldRefMetadata,
|
|
271
|
+
U as preferSemaphorSourceMetadata,
|
|
272
|
+
Y as semaphorFieldRefsMatch,
|
|
269
273
|
u as semaphorSourceHasRequiredCoordinates,
|
|
270
|
-
|
|
271
|
-
|
|
274
|
+
G as semaphorSourceIdentityKey,
|
|
275
|
+
H as semaphorSourcesReferToSameDataset,
|
|
272
276
|
y as validateSemaphorAnalyticsIntent,
|
|
273
277
|
S as validateSemaphorAnalyticsRecoveryPlan,
|
|
274
278
|
k as validateSemaphorDashboardIntent,
|
|
275
279
|
C as validateSemaphorDerivedFieldDefinition,
|
|
276
|
-
|
|
277
|
-
|
|
280
|
+
T as validateSemaphorOperationIntent,
|
|
281
|
+
I as validateSemaphorResultCalculation
|
|
278
282
|
};
|
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("react"),d=require("../chunks/switch-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("react"),d=require("../chunks/switch-D5xopzFD.js"),A=require("../chunks/index-DRlMUglg.js");require("../chunks/index-BxM99sFL.js");require("../chunks/catalog-field-grounding-BGW0hnB9.js");const V=require("../chunks/palette-DrhPeer-.js"),ge=require("../chunks/braces-C2uBgj3t.js"),be=require("../chunks/save-BxWBiQv1.js"),fe=require("../chunks/layout-grid-CTOW9oTg.js");/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const
|
|
6
|
+
*/const me=d.createLucideIcon("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/**
|
|
7
7
|
* @license lucide-react v0.453.0 - ISC
|
|
8
8
|
*
|
|
9
9
|
* This source code is licensed under the ISC license.
|
|
10
10
|
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const
|
|
11
|
+
*/const xe=d.createLucideIcon("Clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]]);/**
|
|
12
12
|
* @license lucide-react v0.453.0 - ISC
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const xe=d.createLucideIcon("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/**
|
|
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 he=d.createLucideIcon("Pipette",[["path",{d:"m2 22 1-1h3l9-9",key:"1sre89"}],["path",{d:"M3 21v-3l9-9",key:"hpe2y6"}],["path",{d:"m15 6 3.4-3.4a2.1 2.1 0 1 1 3 3L18 9l.4.4a2.1 2.1 0 1 1-3 3l-3.8-3.8a2.1 2.1 0 1 1 3-3l.4.4Z",key:"196du1"}]]),W=[{id:"semaphor",name:"Semaphor",description:"Dense neutral system defaults for embedded analytics.",primary:"#18181b",accent:"#f4f4f5",light:{background:"#ffffff",foreground:"#18181b",muted:"#fafafa",mutedForeground:"#71717a",border:"#e4e4e7",primary:"#18181b",primaryForeground:"#ffffff",accent:"#f4f4f5",accentForeground:"#18181b",card:"#ffffff",cardForeground:"#18181b",chartPalette:["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#06b6d4"]},dark:{background:"#09090b",foreground:"#fafafa",muted:"#18181b",mutedForeground:"#a1a1aa",border:"#27272a",primary:"#fafafa",primaryForeground:"#09090b",accent:"#27272a",accentForeground:"#fafafa",card:"#09090b",cardForeground:"#fafafa",chartPalette:["#60a5fa","#34d399","#fbbf24","#f87171","#a78bfa","#22d3ee"]}},{id:"atlas-blue",name:"Atlas Blue",description:"Crisp enterprise blue with restrained neutral surfaces.",primary:"#2563eb",accent:"#dbeafe",light:{background:"#f8fafc",foreground:"#0f172a",muted:"#f1f5f9",mutedForeground:"#64748b",border:"#cbd5e1",primary:"#2563eb",primaryForeground:"#ffffff",accent:"#dbeafe",accentForeground:"#1e3a8a",card:"#ffffff",cardForeground:"#0f172a",chartPalette:["#2563eb","#0f766e","#ca8a04","#dc2626","#7c3aed","#0891b2"]},dark:{background:"#020617",foreground:"#e2e8f0",muted:"#0f172a",mutedForeground:"#94a3b8",border:"#1e293b",primary:"#60a5fa",primaryForeground:"#020617",accent:"#1e3a8a",accentForeground:"#dbeafe",card:"#0f172a",cardForeground:"#e2e8f0",chartPalette:["#60a5fa","#2dd4bf","#facc15","#f87171","#a78bfa","#22d3ee"]}},{id:"field-green",name:"Field Green",description:"Operational green accents with quiet, readable canvases.",primary:"#047857",accent:"#d1fae5",light:{background:"#fbfdfb",foreground:"#10231d",muted:"#f1f5f3",mutedForeground:"#64746d",border:"#d7ded9",primary:"#047857",primaryForeground:"#ffffff",accent:"#d1fae5",accentForeground:"#064e3b",card:"#ffffff",cardForeground:"#10231d",chartPalette:["#047857","#2563eb","#d97706","#dc2626","#7c3aed","#0891b2"]},dark:{background:"#071511",foreground:"#e7f4ef",muted:"#10231d",mutedForeground:"#92aaa1",border:"#244139",primary:"#34d399",primaryForeground:"#071511",accent:"#064e3b",accentForeground:"#d1fae5",card:"#0b1d17",cardForeground:"#e7f4ef",chartPalette:["#34d399","#60a5fa","#fbbf24","#f87171","#a78bfa","#22d3ee"]}}];function O(r){const n=A.resolveAppearance({organizationAppearance:r??void 0});return je(P(n))}function E(r){const n=P({version:A.APPEARANCE_SPEC_VERSION,mode:r.mode,schemes:r.schemes}),t=A.validateAppearanceSpec(n);if(!t.success){const u=t.issues[0];throw new Error(`Invalid Brand Studio appearance at ${u.path}: ${u.message}`)}return t.value}function re(r,n){const t=W.find(i=>i.id===n);if(!t)return r;const u=P(r);return Q(u.schemes.light,t.light),Q(u.schemes.dark,t.dark),u}function Q(r,n){r.tokens.color.background=n.background,r.tokens.color.foreground=n.foreground,r.tokens.color.muted=n.muted,r.tokens.color.mutedForeground=n.mutedForeground,r.tokens.color.border=n.border,r.tokens.color.input=n.border,r.tokens.color.primary=n.primary,r.tokens.color.primaryForeground=n.primaryForeground,r.tokens.color.accent=n.accent,r.tokens.color.accentForeground=n.accentForeground,r.tokens.color.card=n.card,r.tokens.color.cardForeground=n.cardForeground,r.components.dashboard.background=n.background,r.components.dashboard.foreground=n.foreground,r.components.dashboard.borderColor=n.border,r.components.card.background=n.card,r.components.card.foreground=n.cardForeground,r.components.card.borderColor=n.border,r.components.interactive.toolbarBackground=n.background,r.components.interactive.background=n.card,r.components.interactive.foreground=n.foreground,r.components.interactive.borderColor=n.border,r.components.chart.palette=[...n.chartPalette],r.components.chart.background=n.card,r.components.chart.foreground=n.foreground,r.components.chart.gridColor=n.border,r.components.chart.axisColor=n.mutedForeground,r.components.table.container.background=n.card,r.components.table.container.borderColor=n.border,r.components.table.header.background=n.muted,r.components.table.header.foreground=n.mutedForeground,r.components.table.header.dividerColor=n.border,r.components.table.row.dividerColor=n.border,r.components.table.row.zebraBackground=n.muted,r.components.table.pagination.background=n.card,r.components.table.pagination.foreground=n.foreground,r.components.table.pagination.borderColor=n.border,c(r,"aggregateTable"),c(r,"pivotTable")}function c(r,n){r.components[n]=P(r.components.table)}function ee(r,n,t){switch(r.tokens.color[n]=t,n){case"background":r.components.dashboard.background=t,r.components.interactive.toolbarBackground=t;break;case"foreground":r.components.dashboard.foreground=t,r.components.interactive.foreground=t,r.components.pagination.foreground=t,r.components.chart.foreground=t,r.components.table.pagination.foreground=t,r.components.table.subtotal.foreground=t,r.components.table.grandTotal.foreground=t,c(r,"aggregateTable"),c(r,"pivotTable");break;case"card":r.components.card.background=t,r.components.interactive.background=t,r.components.pagination.background=t,r.components.chart.background=t,r.components.table.container.background=t,r.components.table.pagination.background=t,c(r,"aggregateTable"),c(r,"pivotTable");break;case"cardForeground":r.components.card.foreground=t;break;case"muted":r.components.table.header.background=t,r.components.table.row.zebraBackground=t,r.components.table.subtotal.background=t,r.components.table.grandTotal.background=t,c(r,"aggregateTable"),c(r,"pivotTable");break;case"mutedForeground":r.components.table.header.foreground=t,r.components.chart.axisColor=t,c(r,"aggregateTable"),c(r,"pivotTable");break;case"border":r.tokens.color.input=t,r.components.dashboard.borderColor=t,r.components.card.borderColor=t,r.components.interactive.borderColor=t,r.components.pagination.borderColor=t,r.components.chart.gridColor=t,r.components.table.container.borderColor=t,r.components.table.header.dividerColor=t,r.components.table.row.dividerColor=t,r.components.table.grandTotal.borderColor=t,r.components.table.pagination.borderColor=t,c(r,"aggregateTable"),c(r,"pivotTable");break;case"accent":r.components.table.row.hoverBackground=t,r.components.table.row.selectedBackground=t,c(r,"aggregateTable"),c(r,"pivotTable");break}}function U(r,n,t){switch(r.tokens.radius[n]=t,n){case"control":r.components.interactive.borderRadius=t,r.components.pagination.borderRadius=t;break;case"card":r.components.card.borderRadius=t;break;case"table":r.components.table.container.borderRadius=t,c(r,"aggregateTable"),c(r,"pivotTable");break}}function je(r){var n,t;for(const u of["light","dark"]){const i=r.schemes[u],l=i.tokens,s=l.color,y=(n=i.components)==null?void 0:n.aggregateTable,j=(t=i.components)==null?void 0:t.pivotTable,N={fontFamily:"",headingFontFamily:"",monoFontFamily:"",baseFontSize:14,density:"comfortable"};l.typography={...N,...l.typography};const f={control:5,card:5,table:5,badge:999};l.radius={...f,...l.radius};const g={dashboardPadding:16,gridGap:12,cardPadding:16,controlGap:8,tableCellX:12,tableCellY:8};l.spacing={...g,...l.spacing};const w={card:"none",popover:"0 12px 32px rgba(15, 23, 42, 0.14)",focusRing:"0 0 0 2px rgba(37, 99, 235, 0.35)"};l.shadow={...w,...l.shadow};const T={dashboard:{background:s.background,foreground:s.foreground,borderColor:s.border,padding:l.spacing.dashboardPadding},card:{background:s.card,foreground:s.cardForeground,borderColor:s.border,borderRadius:l.radius.card,padding:l.spacing.cardPadding,shadow:l.shadow.card},interactive:{toolbarBackground:s.background,background:s.card,foreground:s.foreground,borderColor:s.border,borderRadius:l.radius.control},chart:{palette:[],background:s.card,foreground:s.foreground,gridColor:s.border,axisColor:s.mutedForeground},table:F(s,l),aggregateTable:F(s,l),pivotTable:F(s,l),pagination:{background:s.card,foreground:s.foreground,borderColor:s.border,borderRadius:l.radius.control}};i.components={...T,...i.components};const J={palette:[],background:s.card,foreground:s.foreground,gridColor:s.border,axisColor:s.mutedForeground};i.components.chart={...J,...i.components.chart},i.components.table={...F(s,l),...i.components.table},i.components.aggregateTable=y?{...F(s,l),...y}:P(i.components.table),i.components.pivotTable=j?{...F(s,l),...j}:P(i.components.table)}return r}function F(r,n){return{density:n.typography.density,container:{background:r.card,borderColor:r.border,borderRadius:n.radius.table,shadow:n.shadow.card},header:{background:r.muted,foreground:r.mutedForeground,dividerColor:r.border,fontWeight:600,uppercase:!0,sticky:!0},row:{height:32,dividerColor:r.border,zebra:!1,zebraBackground:r.muted,hoverBackground:r.accent,selectedBackground:r.accent},cell:{paddingX:n.spacing.tableCellX,paddingY:n.spacing.tableCellY,verticalAlign:"middle",wrap:"nowrap"},subtotal:{background:r.muted,foreground:r.foreground,fontWeight:600},grandTotal:{background:r.muted,foreground:r.foreground,fontWeight:700,borderColor:r.border},pagination:{background:r.card,foreground:r.foreground,borderColor:r.border}}}function P(r){return JSON.parse(JSON.stringify(r))}const ye=[["background","Canvas"],["foreground","Text"],["card","Card"],["cardForeground","Card text"],["primary","Primary"],["primaryForeground","Primary text"],["accent","Accent"],["accentForeground","Accent text"],["muted","Muted"],["mutedForeground","Muted text"],["border","Border"],["positive","Positive"],["negative","Negative"],["warning","Warning"],["info","Info"]],ke=[0,1,2,3,4,5],q=A.APPEARANCE_FONT_PRESETS,ve=["#ffffff","#f8fafc","#f4f4f5","#e4e4e7","#18181b","#09090b","#2563eb","#0f766e","#047857","#d97706","#dc2626","#7c3aed"];function Ce({appearance:r,previewTitle:n,isLoading:t=!1,isSaving:u=!1,error:i=null,className:l,onDraftChange:s,onSave:y,onClearConfig:j,onCancel:N}){const[f,g]=m.useState(null),[w,T]=m.useState("light"),[J,z]=m.useState(!1),[oe,B]=m.useState("idle"),[X,ae]=m.useState(!1),[I,$]=m.useState(""),[D,x]=m.useState(null),Y=m.useRef(null),L=m.useRef(s),R=m.useRef(!1);m.useEffect(()=>{L.current=s},[s]),m.useEffect(()=>{if(r===void 0){R.current=!0,g(null);return}const o=O(r);R.current=!0,g(o),T("light"),x(null)},[r]),m.useEffect(()=>{var o;if(f){if(R.current){R.current=!1;return}try{const a=E(f);(o=L.current)==null||o.call(L,a),x(null)}catch(a){x(a instanceof Error?a.message:"Appearance is invalid")}}},[f]);const p=f==null?void 0:f.schemes[w],_=u||J,ne=m.useMemo(()=>p?Te(p.tokens.radius.control):void 0,[p]),te=o=>{g(a=>{if(!a)return a;const h=Se(a);return o(h),h})},b=o=>{te(a=>{o(a.schemes[w])})},de=async()=>{if(!f||!y)return;let o;try{o=E(f)}catch(a){x(a instanceof Error?a.message:"Appearance is invalid");return}z(!0);try{await y(o)}finally{z(!1)}},se=()=>{const o=O(null);B("idle"),g(o)},ie=async()=>{if(j){z(!0),x(null),B("idle");try{await j(),R.current=!0,g(O(null)),T("light")}catch(o){x(o instanceof Error?o.message:"Unable to clear organization appearance")}finally{z(!1)}}},Z=m.useCallback(()=>f?JSON.stringify(E(f),null,2):"",[f]),ce=o=>{if(ae(o),o)try{$(Z()),x(null)}catch(a){x(a instanceof Error?a.message:"Appearance is invalid")}},le=async()=>{if(f)try{const o=X&&I?I:Z();await navigator.clipboard.writeText(o),x(null),B("copied")}catch(o){x(o instanceof Error?o.message:"Unable to copy brand spec")}},K=o=>{const a=JSON.parse(o),h=O(a),S=E(h);B("idle"),T("light"),g(h),$(JSON.stringify(S,null,2))},ue=()=>{try{K(I)}catch(o){x(o instanceof Error?o.message:"Brand spec must be valid JSON")}},pe=async o=>{var h;const a=(h=o.target.files)==null?void 0:h[0];if(o.target.value="",!!a)try{K(await Fe(a))}catch(S){x(S instanceof Error?S.message:"Uploaded file must be a valid brand spec")}};return e.jsxs("div",{className:d.cn("flex min-h-0 flex-1 flex-col bg-background text-foreground",l),style:ne,children:[e.jsxs("header",{className:"flex h-11 shrink-0 items-start gap-3 border-b border-border/60 px-4 pt-2",children:[e.jsx("div",{className:"mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-control border border-border/70",children:e.jsx(V.Palette,{className:"h-3.5 w-3.5"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h2",{className:"truncate text-[13px] font-semibold leading-tight",children:"Brand Studio"}),e.jsxs("p",{className:"truncate text-[11px] leading-tight text-muted-foreground",children:["Previewing ",n||"current dashboard"]})]}),e.jsxs(d.Popover,{open:X,onOpenChange:ce,children:[e.jsx(d.PopoverTrigger,{asChild:!0,children:e.jsxs(d.Button,{type:"button",size:"xs",variant:"ghost",disabled:!f,children:[e.jsx(ge.Braces,{className:"h-3.5 w-3.5"}),"Brand Spec"]})}),e.jsxs(d.PopoverContent,{align:"end",sideOffset:6,className:"z-[60] w-[min(520px,calc(100vw-24px))] rounded-control p-2",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[12px] font-medium",children:"Brand spec"}),e.jsx("div",{className:"text-[11px] text-muted-foreground",children:"Edit, apply, copy, or upload your brand spec."})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[e.jsxs(d.Button,{type:"button",size:"xs",variant:"ghost",onClick:le,children:[e.jsx(me,{className:"h-3.5 w-3.5"}),oe==="copied"?"Copied":"Copy"]}),e.jsxs(d.Button,{type:"button",size:"xs",variant:"ghost",onClick:()=>{var o;return(o=Y.current)==null?void 0:o.click()},children:[e.jsx(d.Upload,{className:"h-3.5 w-3.5"}),"Upload"]}),e.jsx(d.Button,{type:"button",size:"xs",onClick:ue,children:"Apply"})]})]}),e.jsx("div",{className:"h-[320px] overflow-hidden rounded-control border border-input",children:e.jsx(d.CodeEditor,{ariaLabel:"Brand spec",value:I,onValueChange:o=>{$(o),B("idle")},language:"json",embedded:!0,hideLineNumbers:!0,dense:!0})})]})]}),e.jsx("input",{ref:Y,"aria-label":"Upload brand spec",type:"file",accept:"application/json,.json",className:"sr-only",onChange:pe}),e.jsxs(d.Button,{type:"button",size:"xs",variant:"ghost",onClick:se,disabled:!f,children:[e.jsx(d.RotateCcw,{className:"h-3.5 w-3.5"}),"Reset"]}),j&&e.jsxs(d.Button,{type:"button",size:"xs",variant:"ghost",onClick:ie,disabled:_,children:[e.jsx(fe,{className:"h-3.5 w-3.5"}),"No config"]}),e.jsxs(d.Button,{type:"button",size:"xs",onClick:de,disabled:!f||_||!!D||!y,children:[_?e.jsx(d.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(be.Save,{className:"h-3.5 w-3.5"}),"Save"]}),N&&e.jsx("button",{type:"button","aria-label":"Close Brand Studio",className:"flex h-7 w-7 items-center justify-center rounded-control text-muted-foreground hover:bg-muted hover:text-foreground",onClick:N,children:e.jsx(d.X,{className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/60 px-4 py-2",children:[e.jsx("div",{className:"flex items-center gap-2 text-[12px] text-muted-foreground",children:D?e.jsxs(e.Fragment,{children:[e.jsx(d.SlidersHorizontal,{className:"h-3.5 w-3.5 text-destructive"}),"Preview keeps the last valid draft"]}):e.jsxs(e.Fragment,{children:[e.jsx(d.Check,{className:"h-3.5 w-3.5 text-emerald-500"}),"Draft is applied to the live dashboard preview"]})}),e.jsx("div",{className:"inline-flex h-7 items-center overflow-hidden rounded-control border border-border/70",children:["light","dark"].map(o=>e.jsx("button",{type:"button",className:d.cn("h-full px-2.5 text-[12px] capitalize transition-colors",w===o?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>T(o),children:o},o))})]}),D&&e.jsx("div",{className:"border-b border-destructive/20 bg-destructive/5 px-4 py-2 text-[12px] text-destructive",children:D}),t?e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsx(d.LoaderCircle,{className:"h-4 w-4 animate-spin text-muted-foreground"})}):i?e.jsx("div",{className:"p-4 text-[13px] text-muted-foreground",children:i}):f&&p?e.jsxs(d.Tabs,{defaultValue:"style",className:"flex min-h-0 flex-1 flex-col",children:[e.jsx("div",{className:"shrink-0 px-4 pt-3",children:e.jsxs(d.TabsList,{variant:"underline",className:"w-full gap-5",children:[e.jsx(d.TabsTrigger,{value:"style",children:"Style"}),e.jsx(d.TabsTrigger,{value:"surfaces",children:"Surfaces"}),e.jsx(d.TabsTrigger,{value:"data",children:"Data"})]})}),e.jsxs(d.ScrollArea,{className:"min-h-0 flex-1",children:[e.jsxs(d.TabsContent,{value:"style",className:"m-0 p-4",children:[e.jsx(v,{icon:V.Palette,title:"Presets",description:"Start from a full light and dark appearance.",children:e.jsx("div",{className:"grid grid-cols-1 gap-2",children:W.map(o=>e.jsxs("button",{type:"button",className:"flex items-center gap-3 rounded-control border border-border/70 px-3 py-2 text-left hover:bg-muted/60",onClick:()=>{const a=re(f,o.id);g(a)},children:[e.jsxs("div",{className:"flex h-7 w-10 overflow-hidden rounded-control border border-border/70",children:[e.jsx("span",{className:"h-full flex-1",style:{backgroundColor:o.primary}}),e.jsx("span",{className:"h-full flex-1",style:{backgroundColor:o.accent}})]}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block text-[13px] font-medium",children:o.name}),e.jsx("span",{className:"block truncate text-[12px] text-muted-foreground",children:o.description})]})]},o.id))})}),e.jsx(v,{icon:V.Palette,title:"Color",description:`Editing the ${w} scheme.`,children:e.jsx("div",{className:"grid grid-cols-2 gap-2",children:ye.map(([o,a])=>e.jsx(k,{label:a,value:p.tokens.color[o],onChange:h=>b(S=>{ee(S,o,h)})},o))})}),e.jsxs(v,{icon:d.Type,title:"Typography",description:"Fonts and density used by dashboard and workflow chrome.",children:[e.jsx(Ne,{value:p.tokens.typography.fontFamily,onChange:o=>b(a=>{a.tokens.typography.fontFamily=o,a.tokens.typography.headingFontFamily=o})}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(C,{label:"Base size",value:p.tokens.typography.baseFontSize,min:11,max:18,onChange:o=>b(a=>{a.tokens.typography.baseFontSize=o})}),e.jsx(G,{label:"Density",value:p.tokens.typography.density,options:[["compact","Compact"],["comfortable","Comfortable"],["spacious","Spacious"]],onChange:o=>b(a=>{a.tokens.typography.density=o,a.components.table.density=a.tokens.typography.density,c(a,"aggregateTable"),c(a,"pivotTable")})})]})]})]}),e.jsxs(d.TabsContent,{value:"surfaces",className:"m-0 p-4",children:[e.jsxs(v,{icon:xe,title:"Layout",description:"Canvas, grid, and card rhythm for embedded dashboards.",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsx(C,{label:"Canvas pad",tooltip:"Outer padding around the dashboard canvas before cards begin.",value:p.tokens.spacing.dashboardPadding,min:0,max:48,onChange:o=>b(a=>{a.tokens.spacing.dashboardPadding=o,a.components.dashboard.padding=o})}),e.jsx(C,{label:"Grid gap",tooltip:"Spacing between dashboard cards in the grid.",value:p.tokens.spacing.gridGap,min:0,max:32,onChange:o=>b(a=>{a.tokens.spacing.gridGap=o})}),e.jsx(C,{label:"Card pad",tooltip:"Inner padding inside card/widget frames around titles, controls, and visual content.",value:p.tokens.spacing.cardPadding,min:0,max:32,onChange:o=>b(a=>{a.tokens.spacing.cardPadding=o,a.components.card.padding=o})})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsx(C,{label:"Control radius",tooltip:"Corner radius for buttons, inputs, selects, checkboxes, segmented controls, and similar interactive controls.",value:p.tokens.radius.control,min:0,max:12,onChange:o=>b(a=>{U(a,"control",o)})}),e.jsx(C,{label:"Card/widget radius",tooltip:"Corner radius for dashboard card frames and widget containers.",value:p.tokens.radius.card,min:0,max:12,onChange:o=>b(a=>{U(a,"card",o)})}),e.jsx(C,{label:"Table radius",tooltip:"Corner radius for table containers, table chrome, and table pagination surfaces.",value:p.tokens.radius.table,min:0,max:12,onChange:o=>b(a=>{U(a,"table",o)})})]})]}),e.jsx(v,{icon:d.SlidersHorizontal,title:"Filters and Controls",description:"Dashboard filter/control toolbar, chip states, menus, and settings panels.",children:e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(k,{label:"Toolbar background",tooltip:"Background color for the dashboard filter/control toolbar strip. This is separate from chip state colors.",value:p.components.interactive.toolbarBackground||p.tokens.color.background,onChange:o=>b(a=>{a.components.interactive.toolbarBackground=o})}),e.jsx(k,{label:"Default state",tooltip:"Unselected filter/control chips plus the base surface for their menus, dialogs, and pagination fallback.",value:p.components.interactive.background||p.tokens.color.card,onChange:o=>b(a=>{a.components.interactive.background=o,a.components.pagination.background=o})}),e.jsx(k,{label:"Border",tooltip:"Border color for filter/control chips, runtime inputs, settings panels, and related popover chrome.",value:p.components.interactive.borderColor||p.tokens.color.border,onChange:o=>b(a=>{a.components.interactive.borderColor=o,a.components.pagination.borderColor=o})}),e.jsx(k,{label:"Selected state",tooltip:"Selected filter/control chips and hover feedback. This keeps a lighter default state and a stronger selected state.",value:p.tokens.color.accent,onChange:o=>b(a=>{ee(a,"accent",o)})})]})})]}),e.jsxs(d.TabsContent,{value:"data",className:"m-0 p-4",children:[e.jsxs(v,{icon:d.ChartColumn,title:"Charts",description:"Palette and semantic chart text/grid colors.",children:[e.jsx("div",{className:"grid grid-cols-3 gap-2",children:ke.map(o=>e.jsx(k,{label:`Series ${o+1}`,value:p.components.chart.palette[o]||"#000000",onChange:a=>b(h=>{h.components.chart.palette[o]=a})},o))}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(k,{label:"Grid",value:p.components.chart.gridColor,onChange:o=>b(a=>{a.components.chart.gridColor=o})}),e.jsx(k,{label:"Axis",value:p.components.chart.axisColor,onChange:o=>b(a=>{a.components.chart.axisColor=o})})]})]}),e.jsxs(v,{icon:d.Table2,title:"Tables",description:"Flat, aggregate, and pivot tables share this V1 table appearance.",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(G,{label:"Density",value:p.components.table.density,options:[["compact","Compact"],["comfortable","Comfortable"],["spacious","Spacious"]],onChange:o=>b(a=>{a.components.table.density=o,c(a,"aggregateTable"),c(a,"pivotTable")})}),e.jsx(G,{label:"Cell wrap",value:p.components.table.cell.wrap,options:[["nowrap","No wrap"],["wrap","Wrap"]],onChange:o=>b(a=>{a.components.table.cell.wrap=o,c(a,"aggregateTable"),c(a,"pivotTable")})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(k,{label:"Header",value:p.components.table.header.background,onChange:o=>b(a=>{a.components.table.header.background=o,c(a,"aggregateTable"),c(a,"pivotTable")})}),e.jsx(k,{label:"Divider",value:p.components.table.row.dividerColor,onChange:o=>b(a=>{a.components.table.row.dividerColor=o,a.components.table.header.dividerColor=o,c(a,"aggregateTable"),c(a,"pivotTable")})})]}),e.jsx(H,{label:"Zebra rows",checked:p.components.table.row.zebra,onCheckedChange:o=>b(a=>{a.components.table.row.zebra=o,c(a,"aggregateTable"),c(a,"pivotTable")})}),e.jsx(H,{label:"Sticky headers",checked:p.components.table.header.sticky,onCheckedChange:o=>b(a=>{a.components.table.header.sticky=o,c(a,"aggregateTable"),c(a,"pivotTable")})}),e.jsx(H,{label:"Uppercase headers",checked:p.components.table.header.uppercase,onCheckedChange:o=>b(a=>{a.components.table.header.uppercase=o,c(a,"aggregateTable"),c(a,"pivotTable")})})]})]})]})]}):null]})}function v({icon:r,title:n,description:t,children:u}){return e.jsxs("section",{className:"mb-6 last:mb-0",children:[e.jsxs("div",{className:"mb-3 flex items-start gap-2",children:[e.jsx("div",{className:"mt-0.5 flex h-5 w-5 items-center justify-center rounded-control border border-border/70",children:e.jsx(r,{className:"h-3 w-3 text-muted-foreground"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"text-[13px] font-semibold",children:n}),e.jsx("p",{className:"mt-0.5 text-[12px] leading-4 text-muted-foreground",children:t})]})]}),e.jsx("div",{className:"space-y-2",children:u}),e.jsx(d.Separator,{className:"mt-5 bg-border/60"})]})}function Ne({value:r,onChange:n}){var u;const t=(u=q.find(i=>i.value===r))==null?void 0:u.id;return e.jsxs("div",{children:[e.jsx(d.Label,{className:"mb-1 block text-[11px] font-normal text-muted-foreground",children:"Font family"}),e.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_150px] gap-2",children:[e.jsxs(d.Select,{value:t,onValueChange:i=>{const l=q.find(s=>s.id===i);l&&n(l.value)},children:[e.jsx(d.SelectTrigger,{size:"xs","aria-label":"Font family preset",children:e.jsx(d.SelectValue,{placeholder:"Select font"})}),e.jsx(d.SelectContent,{children:q.map(i=>e.jsx(d.SelectItem,{value:i.id,children:i.label},i.id))})]}),e.jsx("div",{className:"flex h-7 items-center rounded-control border border-border/60 bg-muted/30 px-2 text-[12px]",style:{fontFamily:r},children:"Aa 123"})]})]})}function k({label:r,tooltip:n,value:t,onChange:u}){const[i,l]=m.useState(!1),[s,y]=m.useState(t),j=we(t),N=t!==s,f=g=>{l(g),g&&y(t)};return e.jsxs("div",{className:"block",children:[e.jsxs("div",{className:"mb-1 flex items-center gap-1",children:[e.jsx(d.Label,{className:"text-[11px] font-normal text-muted-foreground",children:r}),n?e.jsx(d.TooltipProvider,{children:e.jsxs(d.Tooltip,{children:[e.jsx(d.TooltipTrigger,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`${r} details`,className:"inline-flex h-3.5 w-3.5 items-center justify-center rounded-control text-muted-foreground/70 transition-colors hover:bg-muted hover:text-foreground",children:e.jsx(d.Info,{className:"h-3 w-3"})})}),e.jsx(d.TooltipContent,{side:"top",className:"max-w-64",children:n})]})}):null]}),e.jsxs("div",{className:"flex h-7 items-center overflow-hidden rounded-control border border-input bg-background",children:[e.jsxs(d.Popover,{open:i,onOpenChange:f,children:[e.jsx(d.PopoverTrigger,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`Open ${r} color picker`,className:"ml-1 flex h-5 w-5 shrink-0 items-center justify-center rounded-control border border-border/70",style:{backgroundColor:t},children:e.jsx("span",{className:"sr-only",children:r})})}),e.jsxs(d.PopoverContent,{align:"start",sideOffset:6,className:"z-[60] w-64 rounded-control p-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("label",{className:"relative flex h-16 w-16 shrink-0 cursor-pointer items-center justify-center overflow-hidden rounded-control border border-border/70",style:{backgroundColor:t},children:[e.jsx("input",{"aria-label":`${r} native color picker`,type:"color",value:j,onChange:g=>u(g.target.value),className:"absolute inset-0 h-full w-full cursor-pointer opacity-0"}),e.jsx("span",{className:"rounded-control bg-black/45 p-1 text-white shadow-sm",children:e.jsx(he,{className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[e.jsx(d.Label,{className:"block text-[11px] font-normal text-muted-foreground",children:"Color value"}),e.jsx(d.TooltipProvider,{children:e.jsxs(d.Tooltip,{children:[e.jsx(d.TooltipTrigger,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`Reset ${r} color to previous value`,disabled:!N,className:"inline-flex h-5 w-5 items-center justify-center rounded-control text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-35",onClick:()=>u(s),children:e.jsx(d.RotateCcw,{className:"h-3 w-3"})})}),e.jsx(d.TooltipContent,{side:"top",children:"Reset to previous value"})]})})]}),e.jsx(d.Input,{size:"xs","aria-label":`${r} popover color value`,value:t,onChange:g=>u(g.target.value),className:"font-mono"})]})]}),e.jsx("div",{className:"mt-2 grid grid-cols-6 gap-1",children:ve.map(g=>e.jsx("button",{type:"button","aria-label":`Set ${r} to ${g}`,className:d.cn("h-6 rounded-control border border-border/70 shadow-sm",t.toLowerCase()===g&&"ring-2 ring-ring"),style:{backgroundColor:g},onClick:()=>u(g)},g))})]})]}),e.jsx(d.Input,{size:"xs","aria-label":`${r} color value`,value:t,onChange:g=>u(g.target.value),className:"h-full border-0 px-2 font-mono shadow-none focus-visible:border-0"})]})]})}function we(r){const n=A.parseAppearanceColor(r);return n?`#${M(n.r)}${M(n.g)}${M(n.b)}`:"#000000"}function M(r){return Math.round(r).toString(16).padStart(2,"0")}function C({label:r,tooltip:n,value:t,min:u,max:i,onChange:l}){const s=m.useId();return e.jsxs("div",{className:"block",children:[e.jsxs("div",{className:"mb-1 flex items-center gap-1",children:[e.jsx(d.Label,{htmlFor:s,className:"text-[11px] font-normal text-muted-foreground",children:r}),n?e.jsx(d.TooltipProvider,{children:e.jsxs(d.Tooltip,{children:[e.jsx(d.TooltipTrigger,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`${r} details`,className:"inline-flex h-3.5 w-3.5 items-center justify-center rounded-control text-muted-foreground/70 transition-colors hover:bg-muted hover:text-foreground",children:e.jsx(d.Info,{className:"h-3 w-3"})})}),e.jsx(d.TooltipContent,{side:"top",className:"max-w-56",children:n})]})}):null]}),e.jsx(d.Input,{id:s,size:"xs",type:"number",min:u,max:i,value:t,onChange:y=>{const j=Number(y.target.value);Number.isNaN(j)||l(j)}})]})}function G({label:r,value:n,options:t,onChange:u}){return e.jsxs("div",{children:[e.jsx(d.Label,{className:"mb-1 block text-[11px] font-normal text-muted-foreground",children:r}),e.jsxs(d.Select,{value:n,onValueChange:u,children:[e.jsx(d.SelectTrigger,{size:"xs",children:e.jsx(d.SelectValue,{})}),e.jsx(d.SelectContent,{children:t.map(([i,l])=>e.jsx(d.SelectItem,{value:i,children:l},i))})]})]})}function H({label:r,checked:n,onCheckedChange:t}){return e.jsxs("div",{className:"flex h-8 items-center justify-between rounded-control border border-border/60 px-2",children:[e.jsx("span",{className:"text-[12px]",children:r}),e.jsx(d.Switch,{size:"xs",checked:n,onCheckedChange:t})]})}function Te(r){const n=`${Number((r/16).toFixed(4))}rem`;return{"--semaphor-radius":n,"--semaphor-control-radius":n}}function Se(r){return JSON.parse(JSON.stringify(r))}function Fe(r){return typeof r.text=="function"?r.text():new Promise((n,t)=>{const u=new FileReader;u.onload=()=>n(String(u.result??"")),u.onerror=()=>t(u.error??new Error("Unable to read file")),u.readAsText(r)})}exports.BRAND_STUDIO_PRESETS=W;exports.BrandStudioEditor=Ce;exports.applyBrandStudioPreset=re;exports.buildAppearanceSpecFromDraft=E;exports.createBrandStudioDraft=O;exports.mirrorTableAppearance=c;
|
|
16
|
+
*/const he=d.createLucideIcon("Pipette",[["path",{d:"m2 22 1-1h3l9-9",key:"1sre89"}],["path",{d:"M3 21v-3l9-9",key:"hpe2y6"}],["path",{d:"m15 6 3.4-3.4a2.1 2.1 0 1 1 3 3L18 9l.4.4a2.1 2.1 0 1 1-3 3l-3.8-3.8a2.1 2.1 0 1 1 3-3l.4.4Z",key:"196du1"}]]),W=[{id:"semaphor",name:"Semaphor",description:"Dense neutral system defaults for embedded analytics.",primary:"#18181b",accent:"#f4f4f5",light:{background:"#ffffff",foreground:"#18181b",muted:"#fafafa",mutedForeground:"#71717a",border:"#e4e4e7",primary:"#18181b",primaryForeground:"#ffffff",accent:"#f4f4f5",accentForeground:"#18181b",card:"#ffffff",cardForeground:"#18181b",chartPalette:["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#06b6d4"]},dark:{background:"#09090b",foreground:"#fafafa",muted:"#18181b",mutedForeground:"#a1a1aa",border:"#27272a",primary:"#fafafa",primaryForeground:"#09090b",accent:"#27272a",accentForeground:"#fafafa",card:"#09090b",cardForeground:"#fafafa",chartPalette:["#60a5fa","#34d399","#fbbf24","#f87171","#a78bfa","#22d3ee"]}},{id:"atlas-blue",name:"Atlas Blue",description:"Crisp enterprise blue with restrained neutral surfaces.",primary:"#2563eb",accent:"#dbeafe",light:{background:"#f8fafc",foreground:"#0f172a",muted:"#f1f5f9",mutedForeground:"#64748b",border:"#cbd5e1",primary:"#2563eb",primaryForeground:"#ffffff",accent:"#dbeafe",accentForeground:"#1e3a8a",card:"#ffffff",cardForeground:"#0f172a",chartPalette:["#2563eb","#0f766e","#ca8a04","#dc2626","#7c3aed","#0891b2"]},dark:{background:"#020617",foreground:"#e2e8f0",muted:"#0f172a",mutedForeground:"#94a3b8",border:"#1e293b",primary:"#60a5fa",primaryForeground:"#020617",accent:"#1e3a8a",accentForeground:"#dbeafe",card:"#0f172a",cardForeground:"#e2e8f0",chartPalette:["#60a5fa","#2dd4bf","#facc15","#f87171","#a78bfa","#22d3ee"]}},{id:"field-green",name:"Field Green",description:"Operational green accents with quiet, readable canvases.",primary:"#047857",accent:"#d1fae5",light:{background:"#fbfdfb",foreground:"#10231d",muted:"#f1f5f3",mutedForeground:"#64746d",border:"#d7ded9",primary:"#047857",primaryForeground:"#ffffff",accent:"#d1fae5",accentForeground:"#064e3b",card:"#ffffff",cardForeground:"#10231d",chartPalette:["#047857","#2563eb","#d97706","#dc2626","#7c3aed","#0891b2"]},dark:{background:"#071511",foreground:"#e7f4ef",muted:"#10231d",mutedForeground:"#92aaa1",border:"#244139",primary:"#34d399",primaryForeground:"#071511",accent:"#064e3b",accentForeground:"#d1fae5",card:"#0b1d17",cardForeground:"#e7f4ef",chartPalette:["#34d399","#60a5fa","#fbbf24","#f87171","#a78bfa","#22d3ee"]}}];function O(r){const n=A.resolveAppearance({organizationAppearance:r??void 0});return je(P(n))}function E(r){const n=P({version:A.APPEARANCE_SPEC_VERSION,mode:r.mode,schemes:r.schemes}),t=A.validateAppearanceSpec(n);if(!t.success){const u=t.issues[0];throw new Error(`Invalid Brand Studio appearance at ${u.path}: ${u.message}`)}return t.value}function re(r,n){const t=W.find(i=>i.id===n);if(!t)return r;const u=P(r);return Q(u.schemes.light,t.light),Q(u.schemes.dark,t.dark),u}function Q(r,n){r.tokens.color.background=n.background,r.tokens.color.foreground=n.foreground,r.tokens.color.muted=n.muted,r.tokens.color.mutedForeground=n.mutedForeground,r.tokens.color.border=n.border,r.tokens.color.input=n.border,r.tokens.color.primary=n.primary,r.tokens.color.primaryForeground=n.primaryForeground,r.tokens.color.accent=n.accent,r.tokens.color.accentForeground=n.accentForeground,r.tokens.color.card=n.card,r.tokens.color.cardForeground=n.cardForeground,r.components.dashboard.background=n.background,r.components.dashboard.foreground=n.foreground,r.components.dashboard.borderColor=n.border,r.components.card.background=n.card,r.components.card.foreground=n.cardForeground,r.components.card.borderColor=n.border,r.components.interactive.toolbarBackground=n.background,r.components.interactive.background=n.card,r.components.interactive.foreground=n.foreground,r.components.interactive.borderColor=n.border,r.components.chart.palette=[...n.chartPalette],r.components.chart.background=n.card,r.components.chart.foreground=n.foreground,r.components.chart.gridColor=n.border,r.components.chart.axisColor=n.mutedForeground,r.components.table.container.background=n.card,r.components.table.container.borderColor=n.border,r.components.table.header.background=n.muted,r.components.table.header.foreground=n.mutedForeground,r.components.table.header.dividerColor=n.border,r.components.table.row.dividerColor=n.border,r.components.table.row.zebraBackground=n.muted,r.components.table.pagination.background=n.card,r.components.table.pagination.foreground=n.foreground,r.components.table.pagination.borderColor=n.border,c(r,"aggregateTable"),c(r,"pivotTable")}function c(r,n){r.components[n]=P(r.components.table)}function ee(r,n,t){switch(r.tokens.color[n]=t,n){case"background":r.components.dashboard.background=t,r.components.interactive.toolbarBackground=t;break;case"foreground":r.components.dashboard.foreground=t,r.components.interactive.foreground=t,r.components.pagination.foreground=t,r.components.chart.foreground=t,r.components.table.pagination.foreground=t,r.components.table.subtotal.foreground=t,r.components.table.grandTotal.foreground=t,c(r,"aggregateTable"),c(r,"pivotTable");break;case"card":r.components.card.background=t,r.components.interactive.background=t,r.components.pagination.background=t,r.components.chart.background=t,r.components.table.container.background=t,r.components.table.pagination.background=t,c(r,"aggregateTable"),c(r,"pivotTable");break;case"cardForeground":r.components.card.foreground=t;break;case"muted":r.components.table.header.background=t,r.components.table.row.zebraBackground=t,r.components.table.subtotal.background=t,r.components.table.grandTotal.background=t,c(r,"aggregateTable"),c(r,"pivotTable");break;case"mutedForeground":r.components.table.header.foreground=t,r.components.chart.axisColor=t,c(r,"aggregateTable"),c(r,"pivotTable");break;case"border":r.tokens.color.input=t,r.components.dashboard.borderColor=t,r.components.card.borderColor=t,r.components.interactive.borderColor=t,r.components.pagination.borderColor=t,r.components.chart.gridColor=t,r.components.table.container.borderColor=t,r.components.table.header.dividerColor=t,r.components.table.row.dividerColor=t,r.components.table.grandTotal.borderColor=t,r.components.table.pagination.borderColor=t,c(r,"aggregateTable"),c(r,"pivotTable");break;case"accent":r.components.table.row.hoverBackground=t,r.components.table.row.selectedBackground=t,c(r,"aggregateTable"),c(r,"pivotTable");break}}function U(r,n,t){switch(r.tokens.radius[n]=t,n){case"control":r.components.interactive.borderRadius=t,r.components.pagination.borderRadius=t;break;case"card":r.components.card.borderRadius=t;break;case"table":r.components.table.container.borderRadius=t,c(r,"aggregateTable"),c(r,"pivotTable");break}}function je(r){var n,t;for(const u of["light","dark"]){const i=r.schemes[u],l=i.tokens,s=l.color,k=(n=i.components)==null?void 0:n.aggregateTable,j=(t=i.components)==null?void 0:t.pivotTable,N={fontFamily:"",headingFontFamily:"",monoFontFamily:"",baseFontSize:14,density:"comfortable"};l.typography={...N,...l.typography};const f={control:5,card:5,table:5,badge:999};l.radius={...f,...l.radius};const g={dashboardPadding:16,gridGap:12,cardPadding:16,controlGap:8,tableCellX:12,tableCellY:8};l.spacing={...g,...l.spacing};const T={card:"none",popover:"0 12px 32px rgba(15, 23, 42, 0.14)",focusRing:"0 0 0 2px rgba(37, 99, 235, 0.35)"};l.shadow={...T,...l.shadow};const w={dashboard:{background:s.background,foreground:s.foreground,borderColor:s.border,padding:l.spacing.dashboardPadding},card:{background:s.card,foreground:s.cardForeground,borderColor:s.border,borderRadius:l.radius.card,padding:l.spacing.cardPadding,shadow:l.shadow.card},interactive:{toolbarBackground:s.background,background:s.card,foreground:s.foreground,borderColor:s.border,borderRadius:l.radius.control},chart:{palette:[],background:s.card,foreground:s.foreground,gridColor:s.border,axisColor:s.mutedForeground},table:F(s,l),aggregateTable:F(s,l),pivotTable:F(s,l),pagination:{background:s.card,foreground:s.foreground,borderColor:s.border,borderRadius:l.radius.control}};i.components={...w,...i.components};const J={palette:[],background:s.card,foreground:s.foreground,gridColor:s.border,axisColor:s.mutedForeground};i.components.chart={...J,...i.components.chart},i.components.table={...F(s,l),...i.components.table},i.components.aggregateTable=k?{...F(s,l),...k}:P(i.components.table),i.components.pivotTable=j?{...F(s,l),...j}:P(i.components.table)}return r}function F(r,n){return{density:n.typography.density,container:{background:r.card,borderColor:r.border,borderRadius:n.radius.table,shadow:n.shadow.card},header:{background:r.muted,foreground:r.mutedForeground,dividerColor:r.border,fontWeight:600,uppercase:!0,sticky:!0},row:{height:32,dividerColor:r.border,zebra:!1,zebraBackground:r.muted,hoverBackground:r.accent,selectedBackground:r.accent},cell:{paddingX:n.spacing.tableCellX,paddingY:n.spacing.tableCellY,verticalAlign:"middle",wrap:"nowrap"},subtotal:{background:r.muted,foreground:r.foreground,fontWeight:600},grandTotal:{background:r.muted,foreground:r.foreground,fontWeight:700,borderColor:r.border},pagination:{background:r.card,foreground:r.foreground,borderColor:r.border}}}function P(r){return JSON.parse(JSON.stringify(r))}const ke=[["background","Canvas"],["foreground","Text"],["card","Card"],["cardForeground","Card text"],["primary","Primary"],["primaryForeground","Primary text"],["accent","Accent"],["accentForeground","Accent text"],["muted","Muted"],["mutedForeground","Muted text"],["border","Border"],["positive","Positive"],["negative","Negative"],["warning","Warning"],["info","Info"]],ye=[0,1,2,3,4,5],q=A.APPEARANCE_FONT_PRESETS,ve=["#ffffff","#f8fafc","#f4f4f5","#e4e4e7","#18181b","#09090b","#2563eb","#0f766e","#047857","#d97706","#dc2626","#7c3aed"];function Ce({appearance:r,previewTitle:n,isLoading:t=!1,isSaving:u=!1,error:i=null,className:l,onDraftChange:s,onSave:k,onClearConfig:j,onCancel:N}){const[f,g]=m.useState(null),[T,w]=m.useState("light"),[J,z]=m.useState(!1),[oe,B]=m.useState("idle"),[X,ae]=m.useState(!1),[D,$]=m.useState(""),[I,x]=m.useState(null),Y=m.useRef(null),L=m.useRef(s),R=m.useRef(!1);m.useEffect(()=>{L.current=s},[s]),m.useEffect(()=>{if(r===void 0){R.current=!0,g(null);return}const o=O(r);R.current=!0,g(o),w("light"),x(null)},[r]),m.useEffect(()=>{var o;if(f){if(R.current){R.current=!1;return}try{const a=E(f);(o=L.current)==null||o.call(L,a),x(null)}catch(a){x(a instanceof Error?a.message:"Appearance is invalid")}}},[f]);const p=f==null?void 0:f.schemes[T],_=u||J,ne=m.useMemo(()=>p?we(p.tokens.radius.control):void 0,[p]),te=o=>{g(a=>{if(!a)return a;const h=Se(a);return o(h),h})},b=o=>{te(a=>{o(a.schemes[T])})},de=async()=>{if(!f||!k)return;let o;try{o=E(f)}catch(a){x(a instanceof Error?a.message:"Appearance is invalid");return}z(!0);try{await k(o)}finally{z(!1)}},se=()=>{const o=O(null);B("idle"),g(o)},ie=async()=>{if(j){z(!0),x(null),B("idle");try{await j(),R.current=!0,g(O(null)),w("light")}catch(o){x(o instanceof Error?o.message:"Unable to clear organization appearance")}finally{z(!1)}}},Z=m.useCallback(()=>f?JSON.stringify(E(f),null,2):"",[f]),ce=o=>{if(ae(o),o)try{$(Z()),x(null)}catch(a){x(a instanceof Error?a.message:"Appearance is invalid")}},le=async()=>{if(f)try{const o=X&&D?D:Z();await navigator.clipboard.writeText(o),x(null),B("copied")}catch(o){x(o instanceof Error?o.message:"Unable to copy brand spec")}},K=o=>{const a=JSON.parse(o),h=O(a),S=E(h);B("idle"),w("light"),g(h),$(JSON.stringify(S,null,2))},ue=()=>{try{K(D)}catch(o){x(o instanceof Error?o.message:"Brand spec must be valid JSON")}},pe=async o=>{var h;const a=(h=o.target.files)==null?void 0:h[0];if(o.target.value="",!!a)try{K(await Fe(a))}catch(S){x(S instanceof Error?S.message:"Uploaded file must be a valid brand spec")}};return e.jsxs("div",{className:d.cn("flex min-h-0 flex-1 flex-col bg-background text-foreground",l),style:ne,children:[e.jsxs("header",{className:"flex h-11 shrink-0 items-start gap-3 border-b border-border/60 px-4 pt-2",children:[e.jsx("div",{className:"mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-control border border-border/70",children:e.jsx(V.Palette,{className:"h-3.5 w-3.5"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h2",{className:"truncate text-[13px] font-semibold leading-tight",children:"Brand Studio"}),e.jsxs("p",{className:"truncate text-[11px] leading-tight text-muted-foreground",children:["Previewing ",n||"current dashboard"]})]}),e.jsxs(d.Popover,{open:X,onOpenChange:ce,children:[e.jsx(d.PopoverTrigger,{asChild:!0,children:e.jsxs(d.Button,{type:"button",size:"xs",variant:"ghost",disabled:!f,children:[e.jsx(ge.Braces,{className:"h-3.5 w-3.5"}),"Brand Spec"]})}),e.jsxs(d.PopoverContent,{align:"end",sideOffset:6,className:"z-[60] w-[min(520px,calc(100vw-24px))] rounded-control p-2",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[12px] font-medium",children:"Brand spec"}),e.jsx("div",{className:"text-[11px] text-muted-foreground",children:"Edit, apply, copy, or upload your brand spec."})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[e.jsxs(d.Button,{type:"button",size:"xs",variant:"ghost",onClick:le,children:[e.jsx(xe,{className:"h-3.5 w-3.5"}),oe==="copied"?"Copied":"Copy"]}),e.jsxs(d.Button,{type:"button",size:"xs",variant:"ghost",onClick:()=>{var o;return(o=Y.current)==null?void 0:o.click()},children:[e.jsx(d.Upload,{className:"h-3.5 w-3.5"}),"Upload"]}),e.jsx(d.Button,{type:"button",size:"xs",onClick:ue,children:"Apply"})]})]}),e.jsx("div",{className:"h-[320px] overflow-hidden rounded-control border border-input",children:e.jsx(d.CodeEditor,{ariaLabel:"Brand spec",value:D,onValueChange:o=>{$(o),B("idle")},language:"json",embedded:!0,hideLineNumbers:!0,dense:!0})})]})]}),e.jsx("input",{ref:Y,"aria-label":"Upload brand spec",type:"file",accept:"application/json,.json",className:"sr-only",onChange:pe}),e.jsxs(d.Button,{type:"button",size:"xs",variant:"ghost",onClick:se,disabled:!f,children:[e.jsx(d.RotateCcw,{className:"h-3.5 w-3.5"}),"Reset"]}),j&&e.jsxs(d.Button,{type:"button",size:"xs",variant:"ghost",onClick:ie,disabled:_,children:[e.jsx(me,{className:"h-3.5 w-3.5"}),"No config"]}),e.jsxs(d.Button,{type:"button",size:"xs",onClick:de,disabled:!f||_||!!I||!k,children:[_?e.jsx(d.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(be.Save,{className:"h-3.5 w-3.5"}),"Save"]}),N&&e.jsx("button",{type:"button","aria-label":"Close Brand Studio",className:"flex h-7 w-7 items-center justify-center rounded-control text-muted-foreground hover:bg-muted hover:text-foreground",onClick:N,children:e.jsx(d.X,{className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/60 px-4 py-2",children:[e.jsx("div",{className:"flex items-center gap-2 text-[12px] text-muted-foreground",children:I?e.jsxs(e.Fragment,{children:[e.jsx(d.SlidersHorizontal,{className:"h-3.5 w-3.5 text-destructive"}),"Preview keeps the last valid draft"]}):e.jsxs(e.Fragment,{children:[e.jsx(d.Check,{className:"h-3.5 w-3.5 text-emerald-500"}),"Draft is applied to the live dashboard preview"]})}),e.jsx("div",{className:"inline-flex h-7 items-center overflow-hidden rounded-control border border-border/70",children:["light","dark"].map(o=>e.jsx("button",{type:"button",className:d.cn("h-full px-2.5 text-[12px] capitalize transition-colors",T===o?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>w(o),children:o},o))})]}),I&&e.jsx("div",{className:"border-b border-destructive/20 bg-destructive/5 px-4 py-2 text-[12px] text-destructive",children:I}),t?e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsx(d.LoaderCircle,{className:"h-4 w-4 animate-spin text-muted-foreground"})}):i?e.jsx("div",{className:"p-4 text-[13px] text-muted-foreground",children:i}):f&&p?e.jsxs(d.Tabs,{defaultValue:"style",className:"flex min-h-0 flex-1 flex-col",children:[e.jsx("div",{className:"shrink-0 px-4 pt-3",children:e.jsxs(d.TabsList,{variant:"underline",className:"w-full gap-5",children:[e.jsx(d.TabsTrigger,{value:"style",children:"Style"}),e.jsx(d.TabsTrigger,{value:"surfaces",children:"Surfaces"}),e.jsx(d.TabsTrigger,{value:"data",children:"Data"})]})}),e.jsxs(d.ScrollArea,{className:"min-h-0 flex-1",children:[e.jsxs(d.TabsContent,{value:"style",className:"m-0 p-4",children:[e.jsx(v,{icon:V.Palette,title:"Presets",description:"Start from a full light and dark appearance.",children:e.jsx("div",{className:"grid grid-cols-1 gap-2",children:W.map(o=>e.jsxs("button",{type:"button",className:"flex items-center gap-3 rounded-control border border-border/70 px-3 py-2 text-left hover:bg-muted/60",onClick:()=>{const a=re(f,o.id);g(a)},children:[e.jsxs("div",{className:"flex h-7 w-10 overflow-hidden rounded-control border border-border/70",children:[e.jsx("span",{className:"h-full flex-1",style:{backgroundColor:o.primary}}),e.jsx("span",{className:"h-full flex-1",style:{backgroundColor:o.accent}})]}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block text-[13px] font-medium",children:o.name}),e.jsx("span",{className:"block truncate text-[12px] text-muted-foreground",children:o.description})]})]},o.id))})}),e.jsx(v,{icon:V.Palette,title:"Color",description:`Editing the ${T} scheme.`,children:e.jsx("div",{className:"grid grid-cols-2 gap-2",children:ke.map(([o,a])=>e.jsx(y,{label:a,value:p.tokens.color[o],onChange:h=>b(S=>{ee(S,o,h)})},o))})}),e.jsxs(v,{icon:d.Type,title:"Typography",description:"Fonts and density used by dashboard and workflow chrome.",children:[e.jsx(Ne,{value:p.tokens.typography.fontFamily,onChange:o=>b(a=>{a.tokens.typography.fontFamily=o,a.tokens.typography.headingFontFamily=o})}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(C,{label:"Base size",value:p.tokens.typography.baseFontSize,min:11,max:18,onChange:o=>b(a=>{a.tokens.typography.baseFontSize=o})}),e.jsx(G,{label:"Density",value:p.tokens.typography.density,options:[["compact","Compact"],["comfortable","Comfortable"],["spacious","Spacious"]],onChange:o=>b(a=>{a.tokens.typography.density=o,a.components.table.density=a.tokens.typography.density,c(a,"aggregateTable"),c(a,"pivotTable")})})]})]})]}),e.jsxs(d.TabsContent,{value:"surfaces",className:"m-0 p-4",children:[e.jsxs(v,{icon:fe.LayoutGrid,title:"Layout",description:"Canvas, grid, and card rhythm for embedded dashboards.",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsx(C,{label:"Canvas pad",tooltip:"Outer padding around the dashboard canvas before cards begin.",value:p.tokens.spacing.dashboardPadding,min:0,max:48,onChange:o=>b(a=>{a.tokens.spacing.dashboardPadding=o,a.components.dashboard.padding=o})}),e.jsx(C,{label:"Grid gap",tooltip:"Spacing between dashboard cards in the grid.",value:p.tokens.spacing.gridGap,min:0,max:32,onChange:o=>b(a=>{a.tokens.spacing.gridGap=o})}),e.jsx(C,{label:"Card pad",tooltip:"Inner padding inside card/widget frames around titles, controls, and visual content.",value:p.tokens.spacing.cardPadding,min:0,max:32,onChange:o=>b(a=>{a.tokens.spacing.cardPadding=o,a.components.card.padding=o})})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsx(C,{label:"Control radius",tooltip:"Corner radius for buttons, inputs, selects, checkboxes, segmented controls, and similar interactive controls.",value:p.tokens.radius.control,min:0,max:12,onChange:o=>b(a=>{U(a,"control",o)})}),e.jsx(C,{label:"Card/widget radius",tooltip:"Corner radius for dashboard card frames and widget containers.",value:p.tokens.radius.card,min:0,max:12,onChange:o=>b(a=>{U(a,"card",o)})}),e.jsx(C,{label:"Table radius",tooltip:"Corner radius for table containers, table chrome, and table pagination surfaces.",value:p.tokens.radius.table,min:0,max:12,onChange:o=>b(a=>{U(a,"table",o)})})]})]}),e.jsx(v,{icon:d.SlidersHorizontal,title:"Filters and Controls",description:"Dashboard filter/control toolbar, chip states, menus, and settings panels.",children:e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(y,{label:"Toolbar background",tooltip:"Background color for the dashboard filter/control toolbar strip. This is separate from chip state colors.",value:p.components.interactive.toolbarBackground||p.tokens.color.background,onChange:o=>b(a=>{a.components.interactive.toolbarBackground=o})}),e.jsx(y,{label:"Default state",tooltip:"Unselected filter/control chips plus the base surface for their menus, dialogs, and pagination fallback.",value:p.components.interactive.background||p.tokens.color.card,onChange:o=>b(a=>{a.components.interactive.background=o,a.components.pagination.background=o})}),e.jsx(y,{label:"Border",tooltip:"Border color for filter/control chips, runtime inputs, settings panels, and related popover chrome.",value:p.components.interactive.borderColor||p.tokens.color.border,onChange:o=>b(a=>{a.components.interactive.borderColor=o,a.components.pagination.borderColor=o})}),e.jsx(y,{label:"Selected state",tooltip:"Selected filter/control chips and hover feedback. This keeps a lighter default state and a stronger selected state.",value:p.tokens.color.accent,onChange:o=>b(a=>{ee(a,"accent",o)})})]})})]}),e.jsxs(d.TabsContent,{value:"data",className:"m-0 p-4",children:[e.jsxs(v,{icon:d.ChartColumn,title:"Charts",description:"Palette and semantic chart text/grid colors.",children:[e.jsx("div",{className:"grid grid-cols-3 gap-2",children:ye.map(o=>e.jsx(y,{label:`Series ${o+1}`,value:p.components.chart.palette[o]||"#000000",onChange:a=>b(h=>{h.components.chart.palette[o]=a})},o))}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(y,{label:"Grid",value:p.components.chart.gridColor,onChange:o=>b(a=>{a.components.chart.gridColor=o})}),e.jsx(y,{label:"Axis",value:p.components.chart.axisColor,onChange:o=>b(a=>{a.components.chart.axisColor=o})})]})]}),e.jsxs(v,{icon:d.Table2,title:"Tables",description:"Flat, aggregate, and pivot tables share this V1 table appearance.",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(G,{label:"Density",value:p.components.table.density,options:[["compact","Compact"],["comfortable","Comfortable"],["spacious","Spacious"]],onChange:o=>b(a=>{a.components.table.density=o,c(a,"aggregateTable"),c(a,"pivotTable")})}),e.jsx(G,{label:"Cell wrap",value:p.components.table.cell.wrap,options:[["nowrap","No wrap"],["wrap","Wrap"]],onChange:o=>b(a=>{a.components.table.cell.wrap=o,c(a,"aggregateTable"),c(a,"pivotTable")})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(y,{label:"Header",value:p.components.table.header.background,onChange:o=>b(a=>{a.components.table.header.background=o,c(a,"aggregateTable"),c(a,"pivotTable")})}),e.jsx(y,{label:"Divider",value:p.components.table.row.dividerColor,onChange:o=>b(a=>{a.components.table.row.dividerColor=o,a.components.table.header.dividerColor=o,c(a,"aggregateTable"),c(a,"pivotTable")})})]}),e.jsx(H,{label:"Zebra rows",checked:p.components.table.row.zebra,onCheckedChange:o=>b(a=>{a.components.table.row.zebra=o,c(a,"aggregateTable"),c(a,"pivotTable")})}),e.jsx(H,{label:"Sticky headers",checked:p.components.table.header.sticky,onCheckedChange:o=>b(a=>{a.components.table.header.sticky=o,c(a,"aggregateTable"),c(a,"pivotTable")})}),e.jsx(H,{label:"Uppercase headers",checked:p.components.table.header.uppercase,onCheckedChange:o=>b(a=>{a.components.table.header.uppercase=o,c(a,"aggregateTable"),c(a,"pivotTable")})})]})]})]})]}):null]})}function v({icon:r,title:n,description:t,children:u}){return e.jsxs("section",{className:"mb-6 last:mb-0",children:[e.jsxs("div",{className:"mb-3 flex items-start gap-2",children:[e.jsx("div",{className:"mt-0.5 flex h-5 w-5 items-center justify-center rounded-control border border-border/70",children:e.jsx(r,{className:"h-3 w-3 text-muted-foreground"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"text-[13px] font-semibold",children:n}),e.jsx("p",{className:"mt-0.5 text-[12px] leading-4 text-muted-foreground",children:t})]})]}),e.jsx("div",{className:"space-y-2",children:u}),e.jsx(d.Separator,{className:"mt-5 bg-border/60"})]})}function Ne({value:r,onChange:n}){var u;const t=(u=q.find(i=>i.value===r))==null?void 0:u.id;return e.jsxs("div",{children:[e.jsx(d.Label,{className:"mb-1 block text-[11px] font-normal text-muted-foreground",children:"Font family"}),e.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_150px] gap-2",children:[e.jsxs(d.Select,{value:t,onValueChange:i=>{const l=q.find(s=>s.id===i);l&&n(l.value)},children:[e.jsx(d.SelectTrigger,{size:"xs","aria-label":"Font family preset",children:e.jsx(d.SelectValue,{placeholder:"Select font"})}),e.jsx(d.SelectContent,{children:q.map(i=>e.jsx(d.SelectItem,{value:i.id,children:i.label},i.id))})]}),e.jsx("div",{className:"flex h-7 items-center rounded-control border border-border/60 bg-muted/30 px-2 text-[12px]",style:{fontFamily:r},children:"Aa 123"})]})]})}function y({label:r,tooltip:n,value:t,onChange:u}){const[i,l]=m.useState(!1),[s,k]=m.useState(t),j=Te(t),N=t!==s,f=g=>{l(g),g&&k(t)};return e.jsxs("div",{className:"block",children:[e.jsxs("div",{className:"mb-1 flex items-center gap-1",children:[e.jsx(d.Label,{className:"text-[11px] font-normal text-muted-foreground",children:r}),n?e.jsx(d.TooltipProvider,{children:e.jsxs(d.Tooltip,{children:[e.jsx(d.TooltipTrigger,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`${r} details`,className:"inline-flex h-3.5 w-3.5 items-center justify-center rounded-control text-muted-foreground/70 transition-colors hover:bg-muted hover:text-foreground",children:e.jsx(d.Info,{className:"h-3 w-3"})})}),e.jsx(d.TooltipContent,{side:"top",className:"max-w-64",children:n})]})}):null]}),e.jsxs("div",{className:"flex h-7 items-center overflow-hidden rounded-control border border-input bg-background",children:[e.jsxs(d.Popover,{open:i,onOpenChange:f,children:[e.jsx(d.PopoverTrigger,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`Open ${r} color picker`,className:"ml-1 flex h-5 w-5 shrink-0 items-center justify-center rounded-control border border-border/70",style:{backgroundColor:t},children:e.jsx("span",{className:"sr-only",children:r})})}),e.jsxs(d.PopoverContent,{align:"start",sideOffset:6,className:"z-[60] w-64 rounded-control p-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("label",{className:"relative flex h-16 w-16 shrink-0 cursor-pointer items-center justify-center overflow-hidden rounded-control border border-border/70",style:{backgroundColor:t},children:[e.jsx("input",{"aria-label":`${r} native color picker`,type:"color",value:j,onChange:g=>u(g.target.value),className:"absolute inset-0 h-full w-full cursor-pointer opacity-0"}),e.jsx("span",{className:"rounded-control bg-black/45 p-1 text-white shadow-sm",children:e.jsx(he,{className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[e.jsx(d.Label,{className:"block text-[11px] font-normal text-muted-foreground",children:"Color value"}),e.jsx(d.TooltipProvider,{children:e.jsxs(d.Tooltip,{children:[e.jsx(d.TooltipTrigger,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`Reset ${r} color to previous value`,disabled:!N,className:"inline-flex h-5 w-5 items-center justify-center rounded-control text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-35",onClick:()=>u(s),children:e.jsx(d.RotateCcw,{className:"h-3 w-3"})})}),e.jsx(d.TooltipContent,{side:"top",children:"Reset to previous value"})]})})]}),e.jsx(d.Input,{size:"xs","aria-label":`${r} popover color value`,value:t,onChange:g=>u(g.target.value),className:"font-mono"})]})]}),e.jsx("div",{className:"mt-2 grid grid-cols-6 gap-1",children:ve.map(g=>e.jsx("button",{type:"button","aria-label":`Set ${r} to ${g}`,className:d.cn("h-6 rounded-control border border-border/70 shadow-sm",t.toLowerCase()===g&&"ring-2 ring-ring"),style:{backgroundColor:g},onClick:()=>u(g)},g))})]})]}),e.jsx(d.Input,{size:"xs","aria-label":`${r} color value`,value:t,onChange:g=>u(g.target.value),className:"h-full border-0 px-2 font-mono shadow-none focus-visible:border-0"})]})]})}function Te(r){const n=A.parseAppearanceColor(r);return n?`#${M(n.r)}${M(n.g)}${M(n.b)}`:"#000000"}function M(r){return Math.round(r).toString(16).padStart(2,"0")}function C({label:r,tooltip:n,value:t,min:u,max:i,onChange:l}){const s=m.useId();return e.jsxs("div",{className:"block",children:[e.jsxs("div",{className:"mb-1 flex items-center gap-1",children:[e.jsx(d.Label,{htmlFor:s,className:"text-[11px] font-normal text-muted-foreground",children:r}),n?e.jsx(d.TooltipProvider,{children:e.jsxs(d.Tooltip,{children:[e.jsx(d.TooltipTrigger,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`${r} details`,className:"inline-flex h-3.5 w-3.5 items-center justify-center rounded-control text-muted-foreground/70 transition-colors hover:bg-muted hover:text-foreground",children:e.jsx(d.Info,{className:"h-3 w-3"})})}),e.jsx(d.TooltipContent,{side:"top",className:"max-w-56",children:n})]})}):null]}),e.jsx(d.Input,{id:s,size:"xs",type:"number",min:u,max:i,value:t,onChange:k=>{const j=Number(k.target.value);Number.isNaN(j)||l(j)}})]})}function G({label:r,value:n,options:t,onChange:u}){return e.jsxs("div",{children:[e.jsx(d.Label,{className:"mb-1 block text-[11px] font-normal text-muted-foreground",children:r}),e.jsxs(d.Select,{value:n,onValueChange:u,children:[e.jsx(d.SelectTrigger,{size:"xs",children:e.jsx(d.SelectValue,{})}),e.jsx(d.SelectContent,{children:t.map(([i,l])=>e.jsx(d.SelectItem,{value:i,children:l},i))})]})]})}function H({label:r,checked:n,onCheckedChange:t}){return e.jsxs("div",{className:"flex h-8 items-center justify-between rounded-control border border-border/60 px-2",children:[e.jsx("span",{className:"text-[12px]",children:r}),e.jsx(d.Switch,{size:"xs",checked:n,onCheckedChange:t})]})}function we(r){const n=`${Number((r/16).toFixed(4))}rem`;return{"--semaphor-radius":n,"--semaphor-control-radius":n}}function Se(r){return JSON.parse(JSON.stringify(r))}function Fe(r){return typeof r.text=="function"?r.text():new Promise((n,t)=>{const u=new FileReader;u.onload=()=>n(String(u.result??"")),u.onerror=()=>t(u.error??new Error("Unable to read file")),u.readAsText(r)})}exports.BRAND_STUDIO_PRESETS=W;exports.BrandStudioEditor=Ce;exports.applyBrandStudioPreset=re;exports.buildAppearanceSpecFromDraft=E;exports.createBrandStudioDraft=O;exports.mirrorTableAppearance=c;
|