react-semaphor 0.1.449 → 0.1.453

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/dist/analytics-protocol/index.cjs +1 -1
  2. package/dist/analytics-protocol/index.js +115 -109
  3. package/dist/appearance/index.cjs +1 -1
  4. package/dist/appearance/index.js +1 -1
  5. package/dist/brand-studio/index.cjs +4 -4
  6. package/dist/brand-studio/index.js +15 -13
  7. package/dist/briefings/index.cjs +1 -1
  8. package/dist/briefings/index.js +39 -2131
  9. package/dist/chunks/{analyze-result-contract-BHb7sUUW.cjs → analyze-result-contract-Dxw66nUG.cjs} +1 -1
  10. package/dist/chunks/{analyze-result-contract-T-0Ntzys.js → analyze-result-contract-GHKFwThg.js} +1 -1
  11. package/dist/chunks/canonical-result-keys-Drc2x-lf.cjs +1 -0
  12. package/dist/chunks/canonical-result-keys-KLk__J_O.js +466 -0
  13. package/dist/chunks/color-CJvdlFM_.js +2162 -0
  14. package/dist/chunks/color-CyB5o13F.cjs +4 -0
  15. package/dist/chunks/{common-types-CQ6SHfLk.cjs → common-types-Ci66eflG.cjs} +1 -1
  16. package/dist/chunks/{common-types-B7Jk3Rtj.js → common-types-F6qk6PPS.js} +1 -1
  17. package/dist/chunks/contracts-CoCOpd_i.js +11 -0
  18. package/dist/chunks/contracts-CtB2VONT.cjs +1 -0
  19. package/dist/chunks/{dashboard-briefing-launcher-DCHiEkLE.js → dashboard-briefing-launcher-CFpX0WX3.js} +86 -84
  20. package/dist/chunks/dashboard-briefing-launcher-mUXWuiOZ.cjs +26 -0
  21. package/dist/chunks/{dashboard-controls-DwRFCcHV.js → dashboard-controls-BeYAmOJc.js} +15 -13
  22. package/dist/chunks/{dashboard-controls-CaFioayc.cjs → dashboard-controls-SoNubIu1.cjs} +1 -1
  23. package/dist/chunks/dashboard-json-BublPnQ4.cjs +1 -0
  24. package/dist/chunks/{dashboard-json-WoILbfTe.js → dashboard-json-DeLUagVV.js} +25 -23
  25. package/dist/chunks/edit-dashboard-visual-CrvPcO7A.cjs +172 -0
  26. package/dist/chunks/{edit-dashboard-visual-ciFhxqaI.js → edit-dashboard-visual-Go0h82DR.js} +6925 -6947
  27. package/dist/chunks/editor-action-buttons-1Lo0fIh7.cjs +16 -0
  28. package/dist/chunks/{editor-action-buttons-BPo_45pM.js → editor-action-buttons-BFNtjFzO.js} +41 -39
  29. package/dist/chunks/format-types-CFHQoIuk.js +1350 -0
  30. package/dist/chunks/format-types-PSZZ7hG8.cjs +1 -0
  31. package/dist/chunks/index-B3ZugihZ.js +3713 -0
  32. package/dist/chunks/{index-CPuawpXJ.js → index-BsH32bn1.js} +47472 -47845
  33. package/dist/chunks/index-ByFbacH7.cjs +1 -0
  34. package/dist/chunks/index-CACdoqu3.js +318 -0
  35. package/dist/chunks/index-DSKR3nKn.js +421 -0
  36. package/dist/chunks/index-DjiIh_9n.cjs +4 -0
  37. package/dist/chunks/index-F25jnH0p.cjs +1 -0
  38. package/dist/chunks/index-q12_nNUS.cjs +1392 -0
  39. package/dist/chunks/{metric-comparison-97zHGEx5.js → metric-comparison-D0T0MKRK.js} +1 -1
  40. package/dist/chunks/{metric-comparison-CUAJ8n4y.cjs → metric-comparison-DYR3RXam.cjs} +1 -1
  41. package/dist/chunks/pivot-header-presentation-DcfPaCiy.cjs +4 -0
  42. package/dist/chunks/pivot-header-presentation-nk604qc1.js +557 -0
  43. package/dist/chunks/{pivot-result-identity-CwJWpKI7.js → pivot-result-identity-C43Ai5Kr.js} +1 -1
  44. package/dist/chunks/{pivot-result-identity-CDLRT-YG.cjs → pivot-result-identity-CRUokNgm.cjs} +1 -1
  45. package/dist/chunks/pivot-result-lifecycle-4kSe0Hk1.js +1642 -0
  46. package/dist/chunks/pivot-result-lifecycle-BiJepH5S.cjs +1 -0
  47. package/dist/chunks/raw-temporal-contract-BF7PjBY9.js +64 -0
  48. package/dist/chunks/raw-temporal-contract-CxbRFwnd.cjs +1 -0
  49. package/dist/chunks/report-preferences-dialog-BEVZAE3m.cjs +1 -0
  50. package/dist/chunks/report-preferences-dialog-BNV7qXYH.js +723 -0
  51. package/dist/chunks/{report-runtime-context-bCy3CVzK.js → report-runtime-context-BJQDu2fV.js} +1 -1
  52. package/dist/chunks/{report-runtime-context-C8LZFsqV.cjs → report-runtime-context-DjYqLV-c.cjs} +1 -1
  53. package/dist/chunks/saved-temporal-bucket-format-DiZdQXOL.js +924 -0
  54. package/dist/chunks/saved-temporal-bucket-format-Gfbh4IiP.cjs +1 -0
  55. package/dist/chunks/switch-CjJ6FHYJ.cjs +138 -0
  56. package/dist/chunks/{switch-BXet-Sno.js → switch-DgLwr7O-.js} +4352 -5249
  57. package/dist/chunks/temporal-bucket-Dnj8qT9l.cjs +1 -0
  58. package/dist/chunks/temporal-bucket-FBZGrDCe.js +560 -0
  59. package/dist/chunks/temporal-bucket-authoring-7hv2laOG.cjs +1 -0
  60. package/dist/chunks/temporal-bucket-authoring-FIRnJz0e.js +221 -0
  61. package/dist/chunks/{temporal-bucket-contract-_F6vNhhH.js → temporal-bucket-contract-BQOj6Frl.js} +1 -1
  62. package/dist/chunks/{temporal-bucket-contract-ChDBWX8I.cjs → temporal-bucket-contract-anl4h-vg.cjs} +1 -1
  63. package/dist/chunks/{token-types-BHR58aTy.js → token-types-CRpQJ4kv.js} +1 -1
  64. package/dist/chunks/{token-types-BdQ8kHBm.cjs → token-types-D0i0IUX3.cjs} +1 -1
  65. package/dist/chunks/{update-policy-BxvYMYz0.cjs → update-policy-C1i9bgsy.cjs} +1 -1
  66. package/dist/chunks/{update-policy-g0rCQ9BM.js → update-policy-CaJz9aPG.js} +1 -1
  67. package/dist/chunks/{validators-Cs74WVie.js → validators-DeMXwRON.js} +253 -233
  68. package/dist/chunks/validators-Dm7Kpz6p.cjs +1 -0
  69. package/dist/dashboard/index.cjs +1 -1
  70. package/dist/dashboard/index.js +2 -2
  71. package/dist/dashboard-authoring/index.cjs +3 -3
  72. package/dist/dashboard-authoring/index.js +32 -29
  73. package/dist/data-app-builder/index.cjs +1 -1
  74. package/dist/data-app-builder/index.js +2 -2
  75. package/dist/data-app-codegen/index.cjs +1 -1
  76. package/dist/data-app-codegen/index.js +2 -2
  77. package/dist/data-app-codegen-node/index.cjs +1 -1
  78. package/dist/data-app-codegen-node/index.js +3 -3
  79. package/dist/data-app-sdk/index.cjs +1 -1
  80. package/dist/data-app-sdk/index.js +3 -3
  81. package/dist/data-app-sdk-adapters/index.cjs +1 -1
  82. package/dist/data-app-sdk-adapters/index.js +2 -2
  83. package/dist/data-app-sdk-validation/index.cjs +1 -1
  84. package/dist/data-app-sdk-validation/index.js +3 -3
  85. package/dist/format-utils/index.cjs +3 -3
  86. package/dist/format-utils/index.js +162 -145
  87. package/dist/index.cjs +1 -1
  88. package/dist/index.js +157 -155
  89. package/dist/report-runtime-context/index.cjs +1 -1
  90. package/dist/report-runtime-context/index.js +2 -2
  91. package/dist/style.css +1 -1
  92. package/dist/surfboard/index.cjs +1 -1
  93. package/dist/surfboard/index.js +3 -3
  94. package/dist/types/analytics-protocol.d.ts +37 -0
  95. package/dist/types/briefings.d.ts +718 -7
  96. package/dist/types/dashboard-assistant.d.ts +18 -0
  97. package/dist/types/dashboard-authoring.d.ts +52 -2
  98. package/dist/types/dashboard.d.ts +128 -0
  99. package/dist/types/data-app-sdk-validation.d.ts +13 -0
  100. package/dist/types/data-app-sdk.d.ts +13 -0
  101. package/dist/types/format-utils.d.ts +190 -3
  102. package/dist/types/index.cjs +1 -1
  103. package/dist/types/index.js +4 -4
  104. package/dist/types/main.d.ts +103 -12
  105. package/dist/types/shared.d.ts +5 -0
  106. package/dist/types/surfboard.d.ts +129 -1
  107. package/dist/types/types.d.ts +98 -6
  108. package/dist/types/value-format-preferences.d.ts +3 -0
  109. package/package.json +2 -1
  110. package/dist/chunks/card-config-utils-15sRtebL.cjs +0 -1
  111. package/dist/chunks/card-config-utils-BYZ5MJOh.js +0 -16
  112. package/dist/chunks/dashboard-briefing-launcher-DDgDr2s3.cjs +0 -26
  113. package/dist/chunks/dashboard-json-CYtvwtvj.cjs +0 -1
  114. package/dist/chunks/edit-dashboard-visual-DwKcvlsF.cjs +0 -177
  115. package/dist/chunks/editor-action-buttons-BVmsk0Aj.cjs +0 -16
  116. package/dist/chunks/format-types-CSv0V7mm.cjs +0 -1
  117. package/dist/chunks/format-types-DZGgYj39.js +0 -1663
  118. package/dist/chunks/index-CJdxSyQq.js +0 -2578
  119. package/dist/chunks/index-DPv8_Ild.cjs +0 -1395
  120. package/dist/chunks/index-DRlMUglg.cjs +0 -4
  121. package/dist/chunks/pivot-result-lifecycle-BBabQ_da.js +0 -914
  122. package/dist/chunks/pivot-result-lifecycle-DPc0ANwk.cjs +0 -4
  123. package/dist/chunks/presentation-execution-BLfPTGX_.js +0 -637
  124. package/dist/chunks/presentation-execution-BTV-Q43g.cjs +0 -1
  125. package/dist/chunks/report-preferences-dialog-D9ZCGh9l.js +0 -691
  126. package/dist/chunks/report-preferences-dialog-DaqTEcac.cjs +0 -1
  127. package/dist/chunks/switch-Cjk6G06r.cjs +0 -138
  128. package/dist/chunks/temporal-bucket-BnPxGrAi.js +0 -446
  129. package/dist/chunks/temporal-bucket-authoring-CPTwHzvs.cjs +0 -1
  130. package/dist/chunks/temporal-bucket-authoring-CgOuakGW.js +0 -205
  131. package/dist/chunks/temporal-bucket-pMnV-4Nj.cjs +0 -1
  132. package/dist/chunks/temporal-result-owner-6peubmhU.js +0 -443
  133. package/dist/chunks/temporal-result-owner-f6-i65Fb.cjs +0 -1
  134. package/dist/chunks/validators-9D4KBqKD.cjs +0 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/validators-9D4KBqKD.cjs"),A=require("../chunks/operators-DrTQsJXv.cjs"),R=require("../chunks/analyze-result-contract-BHb7sUUW.cjs"),n=require("../chunks/catalog-field-grounding-Bnx-3tE0.cjs"),l=require("../chunks/metric-comparison-CUAJ8n4y.cjs"),u=require("../chunks/dashboard-date-comparison-definition-DZq0htjG.cjs"),p=require("../chunks/dashboard-input-contract-DV3cshjz.cjs"),C=require("../chunks/temporal-bucket-contract-ChDBWX8I.cjs");function g(a,t={}){const i=b(a),r={connectionId:t.connectionId,connectionType:a,path:["database","schema","table"],labels:{database:"Database",schema:"Schema",table:"Table"},prefixLevels:["database","schema","table"],dialect:"postgres",supportsFilterClause:!0};return i.includes("postgres")?{...r,prefixLevels:["schema","table"],dialect:"postgres"}:i.includes("mysql")?{...r,prefixLevels:["database","table"],dialect:"mysql",supportsFilterClause:!1}:i.includes("mssql")||i.includes("sqlserver")?{...r,dialect:"mssql",supportsFilterClause:!1}:i.includes("redshift")?{...r,prefixLevels:["schema","table"],dialect:"redshift"}:i.includes("snowflake")?{...r,dialect:"snowflake"}:i.includes("clickhouse")?{connectionId:t.connectionId,connectionType:a,path:["database","table"],labels:{database:"Database",table:"Table"},prefixLevels:["database","table"],dialect:"clickhouse",supportsFilterClause:!1}:i==="s3"||i==="api"?{connectionId:t.connectionId,connectionType:a,path:["table"],labels:{table:i==="api"?"API Table":"File Table"},prefixLevels:["table"],dialect:"duckdb",supportsFilterClause:!0}:i==="googlesheets"||i==="fileupload"?{connectionId:t.connectionId,connectionType:a,path:["table"],labels:{table:"Table"},prefixLevels:["table"],dialect:"postgres",supportsFilterClause:!0}:i==="s3tables"?{...r,labels:{database:"Database",schema:"Namespace",table:"Table"},dialect:"duckdb"}:i==="bigquery"?{...r,labels:{database:"Project",schema:"Dataset",table:"Table"},prefixLevels:["schema","table"],dialect:"bigquery",supportsFilterClause:!1}:r}function y(a){const t=b(a);switch(t){case"mysql":case"bigquery":case"redshift":case"snowflake":case"clickhouse":case"duckdb":case"sqlite":return t;case"mssql":case"sqlserver":return"mssql";case"postgres":case"postgresql":return"postgres";default:return"unknown"}}function T(a){return a.capabilities.prefixLevels.every(t=>!!f(a.source,t))}function v(a){const t=a.quoteIdentifier??_;return a.capabilities.prefixLevels.map(i=>f(a.source,i)).filter(i=>!!i).map(i=>t(i,a.capabilities.dialect)).join(".")}function f(a,t){return t==="database"?a.databaseName:t==="schema"?a.schemaName:a.tableName}function _(a,t){return t==="mysql"||t==="bigquery"||t==="clickhouse"||t==="duckdb"?`\`${a.replace(/`/g,"``")}\``:t==="mssql"?`[${a.replace(/]/g,"]]")}]`:`"${a.replace(/"/g,'""')}"`}function b(a){if(typeof a!="string")return"";const t=[];for(const i of a.trim().toLowerCase())I(i)&&t.push(i);return t.join("")}function I(a){const t=a.charCodeAt(0);return t>=48&&t<=57||t>=97&&t<=122}const c={kind:"semantic",domainId:"domain_sales",datasetName:"orders",connectionId:"conn_sales",label:"Orders"},D={revenueKpi:{version:1,kind:"metric",id:"revenue-kpi",label:"Revenue",source:c,measures:[{name:"revenue",role:"measure"}],primaryMeasure:{name:"revenue",role:"measure"},comparison:{kind:"previous_period"},limit:1},revenueTrend:{version:1,kind:"records",id:"revenue-trend",label:"Revenue trend",source:c,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:c,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",inputId:"region",source:c,labelField:{name:"region",role:"dimension",dataType:"string"},valueField:{name:"region",role:"dimension",dataType:"string"},limit:100},previousPeriodRevenueComparison:{version:1,kind:"metric",id:"revenue-previous-period",label:"Revenue previous period comparison",source:c,measures:[{name:"revenue",role:"measure"}],primaryMeasure:{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:c,measures:[{name:"net_tons",role:"measure"},{name:"ticket_value",role:"measure"}],primaryMeasure:{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"}]}},M={visibleAxis:{source:{kind:"semantic",domainId:"commerce",datasetName:"orders"},field:{name:"order_date",label:"Order date",dataType:"timestamp with time zone"},expected:{status:"resolved",bindingSource:"visible_axis",name:"order_date",dataType:"datetime"}},invalidSource:{source:{kind:"semantic",datasetName:"orders"},field:{name:"order_date",label:"Order date",dataType:"date"},expected:{status:"unavailable",reason:"temporal_binding_invalid"}}};function S(a){return!!(a.name.trim()&&e.hasCompleteSemaphorSourceIdentity(a.source)&&(a.role==="date"||a.dataType==="date"||a.dataType==="datetime"))}function h(a){return a.filter((t,i)=>a.findIndex(r=>e.semaphorFieldRefsMatch(t.field,r.field))===i)}function E(a){return new Set(a.map(e.semaphorSourceIdentityKey).filter(Boolean)).size}function F(a){const t=h(a.candidates.filter(o=>o.kind==="visible_axis")),i=h(a.candidates.filter(o=>o.kind==="explicit_hidden"));if([...t,...i].some(o=>!S(o.field)))return"invalid";if(t.length>1||i.length>1)return"ambiguous";const r=t[0],m=i[0];if(r)return m&&!e.semaphorFieldRefsMatch(r.field,m.field)?"invalid":r;if(m)return m;if(E(a.querySources??[])>1)return"ambiguous";const d=h(a.candidates.filter(o=>o.kind==="semantic_primary"));return d.some(o=>!S(o.field))?"invalid":d.length>1?"ambiguous":d[0]??"missing"}function O(a){const t=new Date(a.startInclusive),i=new Date(a.endExclusive);return a.timezone.trim()?Number.isFinite(t.getTime())&&Number.isFinite(i.getTime())&&t.getTime()<i.getTime():!1}function P(a){const t=a.ranges??[];if(a.rawSql)return{status:"unavailable",reason:"unsupported_raw_sql",constraints:t};if((a.querySources??[]).some(s=>!e.hasCompleteSemaphorSourceIdentity(s))||t.some(s=>!S(s.field)))return{status:"unavailable",reason:"temporal_binding_invalid",constraints:t};const i=F(a);if(typeof i=="string")return{status:"unavailable",reason:`temporal_binding_${i}`,constraints:t};const r=t.filter(s=>e.semaphorFieldRefsMatch(s.field,i.field));if(r.some(s=>!O(s.window)))return{status:"unavailable",reason:"temporal_binding_invalid",constraints:t};const m=r.filter(s=>s.source==="global_date"),d=r.filter(s=>s.source==="card");if(m.length>1||m.length===0&&d.length>1)return{status:"unavailable",reason:"temporal_binding_ambiguous",constraints:t};const o=m[0]??d[0];return{status:"resolved",field:i.field,bindingSource:i.kind,...o?{currentWindow:o.window,governingWindowSource:o.source,governingRangeId:o.id}:{},constraints:t.filter(s=>s.id!==(o==null?void 0:o.id))}}exports.SEMAPHOR_ANALYZE_RESULT_FIELD_CONTRACT=e.SEMAPHOR_ANALYZE_RESULT_FIELD_CONTRACT;exports.SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_SCHEMA_VERSION=e.SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_SCHEMA_VERSION;exports.SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_VALIDATOR_VERSION=e.SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_VALIDATOR_VERSION;exports.SEMAPHOR_GENERATED_COUNT_METRIC_ID=e.SEMAPHOR_GENERATED_COUNT_METRIC_ID;exports.SEMAPHOR_MATRIX_TIME_GRAINS=e.SEMAPHOR_MATRIX_TIME_GRAINS;exports.SEMAPHOR_TIME_GRAINS=e.SEMAPHOR_TIME_GRAINS;exports.TEMPORAL_BUCKET_CONTRACT_ERROR_CODES=e.TEMPORAL_BUCKET_CONTRACT_ERROR_CODES;exports.TEMPORAL_BUCKET_PRESETS=e.TEMPORAL_BUCKET_PRESETS;exports.canonicalDashboardRecordsPayloadSchema=e.canonicalDashboardRecordsPayloadSchema;exports.dashboardRecordsPayloadSchema=e.dashboardRecordsPayloadSchema;exports.hasCompleteSemaphorSourceIdentity=e.hasCompleteSemaphorSourceIdentity;exports.isSemaphorDataAppCodegenSummary=e.isSemaphorDataAppCodegenSummary;exports.isSemaphorMatrixTimeGrain=e.isSemaphorMatrixTimeGrain;exports.isSemaphorTimeGrain=e.isSemaphorTimeGrain;exports.mergeSemaphorSourcesByIdentity=e.mergeSemaphorSourcesByIdentity;exports.parseSemaphorIsoInstant=e.parseSemaphorIsoInstant;exports.parseSemaphorIsoTimeWindowBoundary=e.parseSemaphorIsoTimeWindowBoundary;exports.preferSemaphorFieldRefMetadata=e.preferSemaphorFieldRefMetadata;exports.preferSemaphorSourceMetadata=e.preferSemaphorSourceMetadata;exports.semaphorAnalyticsCoverageSchema=e.semaphorAnalyticsCoverageSchema;exports.semaphorAnalyticsDiagnosticFeedbackSchema=e.semaphorAnalyticsDiagnosticFeedbackSchema;exports.semaphorAnalyticsExecutionResultSchema=e.semaphorAnalyticsExecutionResultSchema;exports.semaphorAnalyticsPopulationSchema=e.semaphorAnalyticsPopulationSchema;exports.semaphorAnalyticsResultSchema=e.semaphorAnalyticsResultSchema;exports.semaphorAnalyticsValidationIssueSchema=e.semaphorAnalyticsValidationIssueSchema;exports.semaphorAnalyticsValidationResultSchema=e.semaphorAnalyticsValidationResultSchema;exports.semaphorAnalyzeResultSchema=e.semaphorAnalyzeResultSchema;exports.semaphorAnalyzeResultShape=e.semaphorAnalyzeResultShape;exports.semaphorDataAppCodegenSummarySchema=e.semaphorDataAppCodegenSummarySchema;exports.semaphorDerivedFieldDefinitionSchema=e.semaphorDerivedFieldDefinitionSchema;exports.semaphorExecutionFieldRefSchema=e.semaphorExecutionFieldRefSchema;exports.semaphorFieldRefSchema=e.semaphorFieldRefSchema;exports.semaphorFieldRefsMatch=e.semaphorFieldRefsMatch;exports.semaphorInputOptionsResultSchema=e.semaphorInputOptionsResultSchema;exports.semaphorMatrixResultSchema=e.semaphorMatrixResultSchema;exports.semaphorMetricAggregate=e.semaphorMetricAggregate;exports.semaphorMetricMeasureBindingKey=e.semaphorMetricMeasureBindingKey;exports.semaphorMetricResultSchema=e.semaphorMetricResultSchema;exports.semaphorPhysicalSourceRefSchema=e.semaphorPhysicalSourceRefSchema;exports.semaphorRecordsResultSchema=e.semaphorRecordsResultSchema;exports.semaphorRelationshipDiagnosticsSchema=e.semaphorRelationshipDiagnosticsSchema;exports.semaphorResultColumnSchema=e.semaphorResultColumnSchema;exports.semaphorSemanticSourceRefSchema=e.semaphorSemanticSourceRefSchema;exports.semaphorSourceIdentityKey=e.semaphorSourceIdentityKey;exports.semaphorSourceRefSchema=e.semaphorSourceRefSchema;exports.semaphorSourcesReferToSameDataset=e.semaphorSourcesReferToSameDataset;exports.semaphorSqlResultSchema=e.semaphorSqlResultSchema;exports.semaphorSqlSourceRefSchema=e.semaphorSqlSourceRefSchema;exports.semaphorTimeGrainSchema=e.semaphorTimeGrainSchema;exports.temporalBucketDataTypeForGrain=e.temporalBucketDataTypeForGrain;exports.temporalBucketFormatSchema=e.temporalBucketFormatSchema;exports.temporalBucketMetadataSchema=e.temporalBucketMetadataSchema;exports.validateSemaphorAnalyticsIntent=e.validateSemaphorAnalyticsIntent;exports.validateSemaphorAnalyticsRecoveryPlan=e.validateSemaphorAnalyticsRecoveryPlan;exports.validateSemaphorDashboardIntent=e.validateSemaphorDashboardIntent;exports.validateSemaphorDataAppCodegenSummary=e.validateSemaphorDataAppCodegenSummary;exports.validateSemaphorDerivedFieldDefinition=e.validateSemaphorDerivedFieldDefinition;exports.validateSemaphorOperationIntent=e.validateSemaphorOperationIntent;exports.validateSemaphorResultCalculation=e.validateSemaphorResultCalculation;exports.normalizeSemaphorAnalyticsFilterOperator=A.normalizeSemaphorAnalyticsFilterOperator;exports.normalizeSemaphorInputOperator=A.normalizeSemaphorInputOperator;exports.getSemaphorAnalyzeResultFieldNames=R.getSemaphorAnalyzeResultFieldNames;exports.isSemaphorAnalyzeResultFieldName=R.isSemaphorAnalyzeResultFieldName;exports.parseSemaphorAnalyzeResult=R.parseSemaphorAnalyzeResult;exports.buildAnalyticsCatalogFieldSummary=n.buildAnalyticsCatalogFieldSummary;exports.getAnalyticsCatalogFieldCandidates=n.getAnalyticsCatalogFieldCandidates;exports.getAnalyticsCatalogFieldName=n.getAnalyticsCatalogFieldName;exports.isAnalyticsCatalogDateField=n.isAnalyticsCatalogDateField;exports.isAnalyticsCatalogDimensionField=n.isAnalyticsCatalogDimensionField;exports.isAnalyticsCatalogMetricField=n.isAnalyticsCatalogMetricField;exports.isAnalyticsDateLikeDataType=n.isAnalyticsDateLikeDataType;exports.isAnalyticsMetricIdentifierField=n.isAnalyticsMetricIdentifierField;exports.isAnalyticsTechnicalIdentifierField=n.isAnalyticsTechnicalIdentifierField;exports.normalizeAnalyticsCatalogDataType=n.normalizeAnalyticsCatalogDataType;exports.normalizeAnalyticsCatalogName=n.normalizeAnalyticsCatalogName;exports.COMPARISON_PRESENTATION_DEFAULTS=l.COMPARISON_PRESENTATION_DEFAULTS;exports.DEFAULT_METRIC_COMPARISON_POLARITY=l.DEFAULT_METRIC_COMPARISON_POLARITY;exports.evaluateMetricComparison=l.evaluateMetricComparison;exports.resolveMetricComparisonRequest=l.resolveMetricComparisonRequest;exports.resolveMetricResultAlias=l.resolveMetricResultAlias;exports.validateComparisonPresentationSpec=l.validateComparisonPresentationSpec;exports.validateGlobalDateComparisonContext=l.validateGlobalDateComparisonContext;exports.validateGlobalDateComparisonSelection=l.validateGlobalDateComparisonSelection;exports.validateMetricComparisonConfig=l.validateMetricComparisonConfig;exports.validateMetricComparisonPolarity=l.validateMetricComparisonPolarity;exports.validateMetricComparisonSpec=l.validateMetricComparisonSpec;exports.isComparisonCapableDashboardDateInputDefinition=u.isComparisonCapableDashboardDateInputDefinition;exports.resolveDashboardDateComparisonFilterDefinition=u.resolveDashboardDateComparisonFilterDefinition;exports.resolveDashboardDateComparisonInputDefinition=u.resolveDashboardDateComparisonInputDefinition;exports.semanticDatasetMatchesFieldCoordinates=u.semanticDatasetMatchesFieldCoordinates;exports.getCardControlCompatInputId=p.getCardControlCompatInputId;exports.getCardInlineFilterCompatInputId=p.getCardInlineFilterCompatInputId;exports.getDashboardControlCompatInputId=p.getDashboardControlCompatInputId;exports.getDashboardFilterCompatInputId=p.getDashboardFilterCompatInputId;exports.validateActivatedTemporalBucketResultColumns=C.validateActivatedTemporalBucketResultColumns;exports.validateTemporalBucketMetadata=C.validateTemporalBucketMetadata;exports.validateTemporalBucketResultColumn=C.validateTemporalBucketResultColumn;exports.SEMAPHOR_ANALYTICS_INTENT_FIXTURES=D;exports.TEMPORAL_CONTEXT_ADAPTER_PARITY_FIXTURES=M;exports.buildSemaphorQualifiedSourcePath=v;exports.getSemaphorConnectionCapabilities=g;exports.normalizeSemaphorDialect=y;exports.resolveTemporalContext=P;exports.semaphorSourceHasRequiredCoordinates=T;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/validators-Dm7Kpz6p.cjs"),f=require("../chunks/operators-DrTQsJXv.cjs"),R=require("../chunks/analyze-result-contract-Dxw66nUG.cjs"),n=require("../chunks/catalog-field-grounding-Bnx-3tE0.cjs"),l=require("../chunks/metric-comparison-DYR3RXam.cjs"),u=require("../chunks/dashboard-date-comparison-definition-DZq0htjG.cjs"),p=require("../chunks/dashboard-input-contract-DV3cshjz.cjs"),C=require("../chunks/temporal-bucket-contract-anl4h-vg.cjs"),A=require("../chunks/raw-temporal-contract-CxbRFwnd.cjs");function g(a,t={}){const r=T(a),i={connectionId:t.connectionId,connectionType:a,path:["database","schema","table"],labels:{database:"Database",schema:"Schema",table:"Table"},prefixLevels:["database","schema","table"],dialect:"postgres",supportsFilterClause:!0};return r.includes("postgres")?{...i,prefixLevels:["schema","table"],dialect:"postgres"}:r.includes("mysql")?{...i,prefixLevels:["database","table"],dialect:"mysql",supportsFilterClause:!1}:r.includes("mssql")||r.includes("sqlserver")?{...i,dialect:"mssql",supportsFilterClause:!1}:r.includes("redshift")?{...i,prefixLevels:["schema","table"],dialect:"redshift"}:r.includes("snowflake")?{...i,dialect:"snowflake"}:r.includes("clickhouse")?{connectionId:t.connectionId,connectionType:a,path:["database","table"],labels:{database:"Database",table:"Table"},prefixLevels:["database","table"],dialect:"clickhouse",supportsFilterClause:!1}:r==="s3"||r==="api"?{connectionId:t.connectionId,connectionType:a,path:["table"],labels:{table:r==="api"?"API Table":"File Table"},prefixLevels:["table"],dialect:"duckdb",supportsFilterClause:!0}:r==="googlesheets"||r==="fileupload"?{connectionId:t.connectionId,connectionType:a,path:["table"],labels:{table:"Table"},prefixLevels:["table"],dialect:"postgres",supportsFilterClause:!0}:r==="s3tables"?{...i,labels:{database:"Database",schema:"Namespace",table:"Table"},dialect:"duckdb"}:r==="bigquery"?{...i,labels:{database:"Project",schema:"Dataset",table:"Table"},prefixLevels:["schema","table"],dialect:"bigquery",supportsFilterClause:!1}:i}function y(a){const t=T(a);switch(t){case"mysql":case"bigquery":case"redshift":case"snowflake":case"clickhouse":case"duckdb":case"sqlite":return t;case"mssql":case"sqlserver":return"mssql";case"postgres":case"postgresql":return"postgres";default:return"unknown"}}function _(a){return a.capabilities.prefixLevels.every(t=>!!b(a.source,t))}function v(a){const t=a.quoteIdentifier??I;return a.capabilities.prefixLevels.map(r=>b(a.source,r)).filter(r=>!!r).map(r=>t(r,a.capabilities.dialect)).join(".")}function b(a,t){return t==="database"?a.databaseName:t==="schema"?a.schemaName:a.tableName}function I(a,t){return t==="mysql"||t==="bigquery"||t==="clickhouse"||t==="duckdb"?`\`${a.replace(/`/g,"``")}\``:t==="mssql"?`[${a.replace(/]/g,"]]")}]`:`"${a.replace(/"/g,'""')}"`}function T(a){if(typeof a!="string")return"";const t=[];for(const r of a.trim().toLowerCase())D(r)&&t.push(r);return t.join("")}function D(a){const t=a.charCodeAt(0);return t>=48&&t<=57||t>=97&&t<=122}const c={kind:"semantic",domainId:"domain_sales",datasetName:"orders",connectionId:"conn_sales",label:"Orders"},M={revenueKpi:{version:1,kind:"metric",id:"revenue-kpi",label:"Revenue",source:c,measures:[{name:"revenue",role:"measure"}],primaryMeasure:{name:"revenue",role:"measure"},comparison:{kind:"previous_period"},limit:1},revenueTrend:{version:1,kind:"records",id:"revenue-trend",label:"Revenue trend",source:c,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:c,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",inputId:"region",source:c,labelField:{name:"region",role:"dimension",dataType:"string"},valueField:{name:"region",role:"dimension",dataType:"string"},limit:100},previousPeriodRevenueComparison:{version:1,kind:"metric",id:"revenue-previous-period",label:"Revenue previous period comparison",source:c,measures:[{name:"revenue",role:"measure"}],primaryMeasure:{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:c,measures:[{name:"net_tons",role:"measure"},{name:"ticket_value",role:"measure"}],primaryMeasure:{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"}]}},E={visibleAxis:{source:{kind:"semantic",domainId:"commerce",datasetName:"orders"},field:{name:"order_date",label:"Order date",dataType:"timestamp with time zone"},expected:{status:"resolved",bindingSource:"visible_axis",name:"order_date",dataType:"datetime"}},invalidSource:{source:{kind:"semantic",datasetName:"orders"},field:{name:"order_date",label:"Order date",dataType:"date"},expected:{status:"unavailable",reason:"temporal_binding_invalid"}}};function S(a){return!!(a.name.trim()&&e.hasCompleteSemaphorSourceIdentity(a.source)&&(a.role==="date"||a.dataType==="date"||a.dataType==="datetime"))}function h(a){return a.filter((t,r)=>a.findIndex(i=>e.semaphorFieldRefsMatch(t.field,i.field))===r)}function F(a){return new Set(a.map(e.semaphorSourceIdentityKey).filter(Boolean)).size}function O(a){const t=h(a.candidates.filter(o=>o.kind==="visible_axis")),r=h(a.candidates.filter(o=>o.kind==="explicit_hidden"));if([...t,...r].some(o=>!S(o.field)))return"invalid";if(t.length>1||r.length>1)return"ambiguous";const i=t[0],m=r[0];if(i)return m&&!e.semaphorFieldRefsMatch(i.field,m.field)?"invalid":i;if(m)return m;if(F(a.querySources??[])>1)return"ambiguous";const d=h(a.candidates.filter(o=>o.kind==="semantic_primary"));return d.some(o=>!S(o.field))?"invalid":d.length>1?"ambiguous":d[0]??"missing"}function P(a){const t=new Date(a.startInclusive),r=new Date(a.endExclusive);return a.timezone.trim()?Number.isFinite(t.getTime())&&Number.isFinite(r.getTime())&&t.getTime()<r.getTime():!1}function N(a){const t=a.ranges??[];if(a.rawSql)return{status:"unavailable",reason:"unsupported_raw_sql",constraints:t};if((a.querySources??[]).some(s=>!e.hasCompleteSemaphorSourceIdentity(s))||t.some(s=>!S(s.field)))return{status:"unavailable",reason:"temporal_binding_invalid",constraints:t};const r=O(a);if(typeof r=="string")return{status:"unavailable",reason:`temporal_binding_${r}`,constraints:t};const i=t.filter(s=>e.semaphorFieldRefsMatch(s.field,r.field));if(i.some(s=>!P(s.window)))return{status:"unavailable",reason:"temporal_binding_invalid",constraints:t};const m=i.filter(s=>s.source==="global_date"),d=i.filter(s=>s.source==="card");if(m.length>1||m.length===0&&d.length>1)return{status:"unavailable",reason:"temporal_binding_ambiguous",constraints:t};const o=m[0]??d[0];return{status:"resolved",field:r.field,bindingSource:r.kind,...o?{currentWindow:o.window,governingWindowSource:o.source,governingRangeId:o.id}:{},constraints:t.filter(s=>s.id!==(o==null?void 0:o.id))}}exports.RAW_TEMPORAL_CONTRACT_ERROR_CODES=e.RAW_TEMPORAL_CONTRACT_ERROR_CODES;exports.SEMAPHOR_ANALYZE_RESULT_FIELD_CONTRACT=e.SEMAPHOR_ANALYZE_RESULT_FIELD_CONTRACT;exports.SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_SCHEMA_VERSION=e.SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_SCHEMA_VERSION;exports.SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_VALIDATOR_VERSION=e.SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_VALIDATOR_VERSION;exports.SEMAPHOR_GENERATED_COUNT_METRIC_ID=e.SEMAPHOR_GENERATED_COUNT_METRIC_ID;exports.SEMAPHOR_MATRIX_TIME_GRAINS=e.SEMAPHOR_MATRIX_TIME_GRAINS;exports.SEMAPHOR_TIME_GRAINS=e.SEMAPHOR_TIME_GRAINS;exports.TEMPORAL_BUCKET_CONTRACT_ERROR_CODES=e.TEMPORAL_BUCKET_CONTRACT_ERROR_CODES;exports.TEMPORAL_BUCKET_PRESETS=e.TEMPORAL_BUCKET_PRESETS;exports.canonicalDashboardRecordsPayloadSchema=e.canonicalDashboardRecordsPayloadSchema;exports.dashboardRecordsPayloadSchema=e.dashboardRecordsPayloadSchema;exports.hasCompleteSemaphorSourceIdentity=e.hasCompleteSemaphorSourceIdentity;exports.isSemaphorDataAppCodegenSummary=e.isSemaphorDataAppCodegenSummary;exports.isSemaphorMatrixTimeGrain=e.isSemaphorMatrixTimeGrain;exports.isSemaphorTimeGrain=e.isSemaphorTimeGrain;exports.mergeSemaphorSourcesByIdentity=e.mergeSemaphorSourcesByIdentity;exports.parseSemaphorIsoInstant=e.parseSemaphorIsoInstant;exports.parseSemaphorIsoTimeWindowBoundary=e.parseSemaphorIsoTimeWindowBoundary;exports.preferSemaphorFieldRefMetadata=e.preferSemaphorFieldRefMetadata;exports.preferSemaphorSourceMetadata=e.preferSemaphorSourceMetadata;exports.rawTemporalValueMetadataSchema=e.rawTemporalValueMetadataSchema;exports.semaphorAnalyticsCoverageSchema=e.semaphorAnalyticsCoverageSchema;exports.semaphorAnalyticsDiagnosticFeedbackSchema=e.semaphorAnalyticsDiagnosticFeedbackSchema;exports.semaphorAnalyticsExecutionResultSchema=e.semaphorAnalyticsExecutionResultSchema;exports.semaphorAnalyticsPopulationSchema=e.semaphorAnalyticsPopulationSchema;exports.semaphorAnalyticsResultSchema=e.semaphorAnalyticsResultSchema;exports.semaphorAnalyticsValidationIssueSchema=e.semaphorAnalyticsValidationIssueSchema;exports.semaphorAnalyticsValidationResultSchema=e.semaphorAnalyticsValidationResultSchema;exports.semaphorAnalyzeResultSchema=e.semaphorAnalyzeResultSchema;exports.semaphorAnalyzeResultShape=e.semaphorAnalyzeResultShape;exports.semaphorDataAppCodegenSummarySchema=e.semaphorDataAppCodegenSummarySchema;exports.semaphorDerivedFieldDefinitionSchema=e.semaphorDerivedFieldDefinitionSchema;exports.semaphorExecutionFieldRefSchema=e.semaphorExecutionFieldRefSchema;exports.semaphorFieldRefSchema=e.semaphorFieldRefSchema;exports.semaphorFieldRefsMatch=e.semaphorFieldRefsMatch;exports.semaphorInputOptionsResultSchema=e.semaphorInputOptionsResultSchema;exports.semaphorMatrixResultSchema=e.semaphorMatrixResultSchema;exports.semaphorMetricAggregate=e.semaphorMetricAggregate;exports.semaphorMetricMeasureBindingKey=e.semaphorMetricMeasureBindingKey;exports.semaphorMetricResultSchema=e.semaphorMetricResultSchema;exports.semaphorPhysicalSourceRefSchema=e.semaphorPhysicalSourceRefSchema;exports.semaphorRecordsResultSchema=e.semaphorRecordsResultSchema;exports.semaphorRelationshipDiagnosticsSchema=e.semaphorRelationshipDiagnosticsSchema;exports.semaphorResultColumnSchema=e.semaphorResultColumnSchema;exports.semaphorSemanticSourceRefSchema=e.semaphorSemanticSourceRefSchema;exports.semaphorSourceIdentityKey=e.semaphorSourceIdentityKey;exports.semaphorSourceRefSchema=e.semaphorSourceRefSchema;exports.semaphorSourcesReferToSameDataset=e.semaphorSourcesReferToSameDataset;exports.semaphorSqlResultSchema=e.semaphorSqlResultSchema;exports.semaphorSqlSourceRefSchema=e.semaphorSqlSourceRefSchema;exports.semaphorTimeGrainSchema=e.semaphorTimeGrainSchema;exports.temporalBucketDataTypeForGrain=e.temporalBucketDataTypeForGrain;exports.temporalBucketFormatSchema=e.temporalBucketFormatSchema;exports.temporalBucketMetadataSchema=e.temporalBucketMetadataSchema;exports.validateSemaphorAnalyticsIntent=e.validateSemaphorAnalyticsIntent;exports.validateSemaphorAnalyticsRecoveryPlan=e.validateSemaphorAnalyticsRecoveryPlan;exports.validateSemaphorDashboardIntent=e.validateSemaphorDashboardIntent;exports.validateSemaphorDataAppCodegenSummary=e.validateSemaphorDataAppCodegenSummary;exports.validateSemaphorDerivedFieldDefinition=e.validateSemaphorDerivedFieldDefinition;exports.validateSemaphorOperationIntent=e.validateSemaphorOperationIntent;exports.validateSemaphorResultCalculation=e.validateSemaphorResultCalculation;exports.normalizeSemaphorAnalyticsFilterOperator=f.normalizeSemaphorAnalyticsFilterOperator;exports.normalizeSemaphorInputOperator=f.normalizeSemaphorInputOperator;exports.getSemaphorAnalyzeResultFieldNames=R.getSemaphorAnalyzeResultFieldNames;exports.isSemaphorAnalyzeResultFieldName=R.isSemaphorAnalyzeResultFieldName;exports.parseSemaphorAnalyzeResult=R.parseSemaphorAnalyzeResult;exports.buildAnalyticsCatalogFieldSummary=n.buildAnalyticsCatalogFieldSummary;exports.getAnalyticsCatalogFieldCandidates=n.getAnalyticsCatalogFieldCandidates;exports.getAnalyticsCatalogFieldName=n.getAnalyticsCatalogFieldName;exports.isAnalyticsCatalogDateField=n.isAnalyticsCatalogDateField;exports.isAnalyticsCatalogDimensionField=n.isAnalyticsCatalogDimensionField;exports.isAnalyticsCatalogMetricField=n.isAnalyticsCatalogMetricField;exports.isAnalyticsDateLikeDataType=n.isAnalyticsDateLikeDataType;exports.isAnalyticsMetricIdentifierField=n.isAnalyticsMetricIdentifierField;exports.isAnalyticsTechnicalIdentifierField=n.isAnalyticsTechnicalIdentifierField;exports.normalizeAnalyticsCatalogDataType=n.normalizeAnalyticsCatalogDataType;exports.normalizeAnalyticsCatalogName=n.normalizeAnalyticsCatalogName;exports.COMPARISON_PRESENTATION_DEFAULTS=l.COMPARISON_PRESENTATION_DEFAULTS;exports.DEFAULT_METRIC_COMPARISON_POLARITY=l.DEFAULT_METRIC_COMPARISON_POLARITY;exports.evaluateMetricComparison=l.evaluateMetricComparison;exports.resolveMetricComparisonRequest=l.resolveMetricComparisonRequest;exports.resolveMetricResultAlias=l.resolveMetricResultAlias;exports.validateComparisonPresentationSpec=l.validateComparisonPresentationSpec;exports.validateGlobalDateComparisonContext=l.validateGlobalDateComparisonContext;exports.validateGlobalDateComparisonSelection=l.validateGlobalDateComparisonSelection;exports.validateMetricComparisonConfig=l.validateMetricComparisonConfig;exports.validateMetricComparisonPolarity=l.validateMetricComparisonPolarity;exports.validateMetricComparisonSpec=l.validateMetricComparisonSpec;exports.isComparisonCapableDashboardDateInputDefinition=u.isComparisonCapableDashboardDateInputDefinition;exports.resolveDashboardDateComparisonFilterDefinition=u.resolveDashboardDateComparisonFilterDefinition;exports.resolveDashboardDateComparisonInputDefinition=u.resolveDashboardDateComparisonInputDefinition;exports.semanticDatasetMatchesFieldCoordinates=u.semanticDatasetMatchesFieldCoordinates;exports.getCardControlCompatInputId=p.getCardControlCompatInputId;exports.getCardInlineFilterCompatInputId=p.getCardInlineFilterCompatInputId;exports.getDashboardControlCompatInputId=p.getDashboardControlCompatInputId;exports.getDashboardFilterCompatInputId=p.getDashboardFilterCompatInputId;exports.validateActivatedTemporalBucketResultColumns=C.validateActivatedTemporalBucketResultColumns;exports.validateTemporalBucketMetadata=C.validateTemporalBucketMetadata;exports.validateTemporalBucketResultColumn=C.validateTemporalBucketResultColumn;exports.RawTemporalMetadataContractError=A.RawTemporalMetadataContractError;exports.parseRawTemporalValueMetadata=A.parseRawTemporalValueMetadata;exports.validateRawTemporalResultColumn=A.validateRawTemporalResultColumn;exports.SEMAPHOR_ANALYTICS_INTENT_FIXTURES=M;exports.TEMPORAL_CONTEXT_ADAPTER_PARITY_FIXTURES=E;exports.buildSemaphorQualifiedSourcePath=v;exports.getSemaphorConnectionCapabilities=g;exports.normalizeSemaphorDialect=y;exports.resolveTemporalContext=N;exports.semaphorSourceHasRequiredCoordinates=_;
@@ -1,13 +1,14 @@
1
- import { h as u, s as c, j as f } from "../chunks/validators-Cs74WVie.js";
2
- import { f as k, S as O, a as q, q as N, m as x, k as P, T as L, o as w, M as B, L as z, i as G, n as U, l as H, a4 as Y, e as V, r as K, p as W, a3 as j, _ as Q, Y as X, $, Z, W as J, N as ee, O as ae, g as se, a0 as re, a1 as te, I as ie, J as ne, H as oe, R as le, V as de, c as me, a5 as ce, P as ue, E as pe, Q as he, X as fe, K as be, D as Se, G as ge, a2 as ve, U as Ce, F as Re, B as _e, d as ye, C as Te, t as Ae, x as Ie, z as De, A as Ee, v as Me, u as Fe, y as ke, w as Oe } from "../chunks/validators-Cs74WVie.js";
3
- import { a as Ne, n as xe } from "../chunks/operators-C8TxpM4C.js";
4
- import { g as Le, i as we, p as Be } from "../chunks/analyze-result-contract-T-0Ntzys.js";
5
- import { j as Ge, b as Ue, g as He, c as Ye, h as Ve, f as Ke, i as We, e as je, d as Qe, n as Xe, a as $e } from "../chunks/catalog-field-grounding-S2jKwKGD.js";
6
- import { C as Je, D as ea, g as aa, r as sa, a as ra, f as ta, d as ia, c as na, b as oa, e as la, v as da } from "../chunks/metric-comparison-97zHGEx5.js";
7
- import { i as ca, r as ua, a as pa, s as ha } from "../chunks/dashboard-date-comparison-definition-Ba-clViK.js";
8
- import { c as ba, b as Sa, a as ga, g as va } from "../chunks/dashboard-input-contract-DSt8dGzP.js";
9
- import { b as Ra, v as _a, a as ya } from "../chunks/temporal-bucket-contract-_F6vNhhH.js";
10
- function _(e, a = {}) {
1
+ import { h as u, s as c, j as f } from "../chunks/validators-DeMXwRON.js";
2
+ import { R as k, f as O, S as q, a as N, q as x, m as P, k as L, T as w, o as B, N as z, M as G, i as U, n as H, l as V, a6 as Y, e as W, r as K, p as j, a5 as Q, D as X, a0 as $, _ as Z, a1 as J, $ as ee, Y as ae, O as se, P as re, g as te, a2 as ie, a3 as ne, J as oe, K as le, I as de, V as me, X as ce, c as ue, a7 as pe, Q as he, F as fe, U as be, Z as Se, L as ge, E as ve, H as Re, a4 as Ce, W as Te, G as _e, B as ye, d as Ae, C as Ie, t as De, x as Ee, z as Me, A as Fe, v as ke, u as Oe, y as qe, w as Ne } from "../chunks/validators-DeMXwRON.js";
3
+ import { a as Pe, n as Le } from "../chunks/operators-C8TxpM4C.js";
4
+ import { g as Be, i as ze, p as Ge } from "../chunks/analyze-result-contract-GHKFwThg.js";
5
+ import { j as He, b as Ve, g as Ye, c as We, h as Ke, f as je, i as Qe, e as Xe, d as $e, n as Ze, a as Je } from "../chunks/catalog-field-grounding-S2jKwKGD.js";
6
+ import { C as aa, D as sa, g as ra, r as ta, a as ia, f as na, d as oa, c as la, b as da, e as ma, v as ca } from "../chunks/metric-comparison-D0T0MKRK.js";
7
+ import { i as pa, r as ha, a as fa, s as ba } from "../chunks/dashboard-date-comparison-definition-Ba-clViK.js";
8
+ import { c as ga, b as va, a as Ra, g as Ca } from "../chunks/dashboard-input-contract-DSt8dGzP.js";
9
+ import { b as _a, v as ya, a as Aa } from "../chunks/temporal-bucket-contract-BQOj6Frl.js";
10
+ import { R as Da, p as Ea, v as Ma } from "../chunks/raw-temporal-contract-BF7PjBY9.js";
11
+ function T(e, a = {}) {
11
12
  const s = h(e), r = {
12
13
  connectionId: a.connectionId,
13
14
  connectionType: e,
@@ -92,7 +93,7 @@ function _(e, a = {}) {
92
93
  supportsFilterClause: !1
93
94
  } : r;
94
95
  }
95
- function y(e) {
96
+ function _(e) {
96
97
  const a = h(e);
97
98
  switch (a) {
98
99
  case "mysql":
@@ -113,7 +114,7 @@ function y(e) {
113
114
  return "unknown";
114
115
  }
115
116
  }
116
- function T(e) {
117
+ function y(e) {
117
118
  return e.capabilities.prefixLevels.every(
118
119
  (a) => !!p(e.source, a)
119
120
  );
@@ -322,7 +323,7 @@ function v(e) {
322
323
  );
323
324
  return o.some((t) => !m(t.field)) ? "invalid" : o.length > 1 ? "ambiguous" : o[0] ?? "missing";
324
325
  }
325
- function C(e) {
326
+ function R(e) {
326
327
  const a = new Date(e.startInclusive), s = new Date(e.endExclusive);
327
328
  return e.timezone.trim() ? Number.isFinite(a.getTime()) && Number.isFinite(s.getTime()) && a.getTime() < s.getTime() : !1;
328
329
  }
@@ -352,7 +353,7 @@ function E(e) {
352
353
  const r = a.filter(
353
354
  (i) => c(i.field, s.field)
354
355
  );
355
- if (r.some((i) => !C(i.window)))
356
+ if (r.some((i) => !R(i.window)))
356
357
  return {
357
358
  status: "unavailable",
358
359
  reason: "temporal_binding_invalid",
@@ -381,108 +382,113 @@ function E(e) {
381
382
  };
382
383
  }
383
384
  export {
384
- Je as COMPARISON_PRESENTATION_DEFAULTS,
385
- ea as DEFAULT_METRIC_COMPARISON_POLARITY,
385
+ aa as COMPARISON_PRESENTATION_DEFAULTS,
386
+ sa as DEFAULT_METRIC_COMPARISON_POLARITY,
387
+ k as RAW_TEMPORAL_CONTRACT_ERROR_CODES,
388
+ Da as RawTemporalMetadataContractError,
386
389
  I as SEMAPHOR_ANALYTICS_INTENT_FIXTURES,
387
- k as SEMAPHOR_ANALYZE_RESULT_FIELD_CONTRACT,
388
- O as SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_SCHEMA_VERSION,
389
- q as SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_VALIDATOR_VERSION,
390
- N as SEMAPHOR_GENERATED_COUNT_METRIC_ID,
391
- x as SEMAPHOR_MATRIX_TIME_GRAINS,
392
- P as SEMAPHOR_TIME_GRAINS,
393
- L as TEMPORAL_BUCKET_CONTRACT_ERROR_CODES,
394
- w as TEMPORAL_BUCKET_PRESETS,
390
+ O as SEMAPHOR_ANALYZE_RESULT_FIELD_CONTRACT,
391
+ q as SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_SCHEMA_VERSION,
392
+ N as SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_VALIDATOR_VERSION,
393
+ x as SEMAPHOR_GENERATED_COUNT_METRIC_ID,
394
+ P as SEMAPHOR_MATRIX_TIME_GRAINS,
395
+ L as SEMAPHOR_TIME_GRAINS,
396
+ w as TEMPORAL_BUCKET_CONTRACT_ERROR_CODES,
397
+ B as TEMPORAL_BUCKET_PRESETS,
395
398
  D as TEMPORAL_CONTEXT_ADAPTER_PARITY_FIXTURES,
396
- Ge as buildAnalyticsCatalogFieldSummary,
399
+ He as buildAnalyticsCatalogFieldSummary,
397
400
  A as buildSemaphorQualifiedSourcePath,
398
- B as canonicalDashboardRecordsPayloadSchema,
399
- z as dashboardRecordsPayloadSchema,
400
- aa as evaluateMetricComparison,
401
- Ue as getAnalyticsCatalogFieldCandidates,
402
- He as getAnalyticsCatalogFieldName,
403
- ba as getCardControlCompatInputId,
404
- Sa as getCardInlineFilterCompatInputId,
405
- ga as getDashboardControlCompatInputId,
406
- va as getDashboardFilterCompatInputId,
407
- Le as getSemaphorAnalyzeResultFieldNames,
408
- _ as getSemaphorConnectionCapabilities,
401
+ z as canonicalDashboardRecordsPayloadSchema,
402
+ G as dashboardRecordsPayloadSchema,
403
+ ra as evaluateMetricComparison,
404
+ Ve as getAnalyticsCatalogFieldCandidates,
405
+ Ye as getAnalyticsCatalogFieldName,
406
+ ga as getCardControlCompatInputId,
407
+ va as getCardInlineFilterCompatInputId,
408
+ Ra as getDashboardControlCompatInputId,
409
+ Ca as getDashboardFilterCompatInputId,
410
+ Be as getSemaphorAnalyzeResultFieldNames,
411
+ T as getSemaphorConnectionCapabilities,
409
412
  u as hasCompleteSemaphorSourceIdentity,
410
- Ye as isAnalyticsCatalogDateField,
411
- Ve as isAnalyticsCatalogDimensionField,
412
- Ke as isAnalyticsCatalogMetricField,
413
- We as isAnalyticsDateLikeDataType,
414
- je as isAnalyticsMetricIdentifierField,
415
- Qe as isAnalyticsTechnicalIdentifierField,
416
- ca as isComparisonCapableDashboardDateInputDefinition,
417
- we as isSemaphorAnalyzeResultFieldName,
418
- G as isSemaphorDataAppCodegenSummary,
419
- U as isSemaphorMatrixTimeGrain,
420
- H as isSemaphorTimeGrain,
413
+ We as isAnalyticsCatalogDateField,
414
+ Ke as isAnalyticsCatalogDimensionField,
415
+ je as isAnalyticsCatalogMetricField,
416
+ Qe as isAnalyticsDateLikeDataType,
417
+ Xe as isAnalyticsMetricIdentifierField,
418
+ $e as isAnalyticsTechnicalIdentifierField,
419
+ pa as isComparisonCapableDashboardDateInputDefinition,
420
+ ze as isSemaphorAnalyzeResultFieldName,
421
+ U as isSemaphorDataAppCodegenSummary,
422
+ H as isSemaphorMatrixTimeGrain,
423
+ V as isSemaphorTimeGrain,
421
424
  Y as mergeSemaphorSourcesByIdentity,
422
- Xe as normalizeAnalyticsCatalogDataType,
423
- $e as normalizeAnalyticsCatalogName,
424
- Ne as normalizeSemaphorAnalyticsFilterOperator,
425
- y as normalizeSemaphorDialect,
426
- xe as normalizeSemaphorInputOperator,
427
- Be as parseSemaphorAnalyzeResult,
428
- V as parseSemaphorIsoInstant,
425
+ Ze as normalizeAnalyticsCatalogDataType,
426
+ Je as normalizeAnalyticsCatalogName,
427
+ Pe as normalizeSemaphorAnalyticsFilterOperator,
428
+ _ as normalizeSemaphorDialect,
429
+ Le as normalizeSemaphorInputOperator,
430
+ Ea as parseRawTemporalValueMetadata,
431
+ Ge as parseSemaphorAnalyzeResult,
432
+ W as parseSemaphorIsoInstant,
429
433
  K as parseSemaphorIsoTimeWindowBoundary,
430
- W as preferSemaphorFieldRefMetadata,
431
- j as preferSemaphorSourceMetadata,
432
- ua as resolveDashboardDateComparisonFilterDefinition,
433
- pa as resolveDashboardDateComparisonInputDefinition,
434
- sa as resolveMetricComparisonRequest,
435
- ra as resolveMetricResultAlias,
434
+ j as preferSemaphorFieldRefMetadata,
435
+ Q as preferSemaphorSourceMetadata,
436
+ X as rawTemporalValueMetadataSchema,
437
+ ha as resolveDashboardDateComparisonFilterDefinition,
438
+ fa as resolveDashboardDateComparisonInputDefinition,
439
+ ta as resolveMetricComparisonRequest,
440
+ ia as resolveMetricResultAlias,
436
441
  E as resolveTemporalContext,
437
- ha as semanticDatasetMatchesFieldCoordinates,
438
- Q as semaphorAnalyticsCoverageSchema,
439
- X as semaphorAnalyticsDiagnosticFeedbackSchema,
440
- $ as semaphorAnalyticsExecutionResultSchema,
441
- Z as semaphorAnalyticsPopulationSchema,
442
- J as semaphorAnalyticsResultSchema,
443
- ee as semaphorAnalyticsValidationIssueSchema,
444
- ae as semaphorAnalyticsValidationResultSchema,
445
- se as semaphorAnalyzeResultSchema,
446
- re as semaphorAnalyzeResultShape,
447
- te as semaphorDataAppCodegenSummarySchema,
448
- ie as semaphorDerivedFieldDefinitionSchema,
449
- ne as semaphorExecutionFieldRefSchema,
450
- oe as semaphorFieldRefSchema,
442
+ ba as semanticDatasetMatchesFieldCoordinates,
443
+ $ as semaphorAnalyticsCoverageSchema,
444
+ Z as semaphorAnalyticsDiagnosticFeedbackSchema,
445
+ J as semaphorAnalyticsExecutionResultSchema,
446
+ ee as semaphorAnalyticsPopulationSchema,
447
+ ae as semaphorAnalyticsResultSchema,
448
+ se as semaphorAnalyticsValidationIssueSchema,
449
+ re as semaphorAnalyticsValidationResultSchema,
450
+ te as semaphorAnalyzeResultSchema,
451
+ ie as semaphorAnalyzeResultShape,
452
+ ne as semaphorDataAppCodegenSummarySchema,
453
+ oe as semaphorDerivedFieldDefinitionSchema,
454
+ le as semaphorExecutionFieldRefSchema,
455
+ de as semaphorFieldRefSchema,
451
456
  c as semaphorFieldRefsMatch,
452
- le as semaphorInputOptionsResultSchema,
453
- de as semaphorMatrixResultSchema,
454
- me as semaphorMetricAggregate,
455
- ce as semaphorMetricMeasureBindingKey,
456
- ue as semaphorMetricResultSchema,
457
- pe as semaphorPhysicalSourceRefSchema,
458
- he as semaphorRecordsResultSchema,
459
- fe as semaphorRelationshipDiagnosticsSchema,
460
- be as semaphorResultColumnSchema,
461
- Se as semaphorSemanticSourceRefSchema,
462
- T as semaphorSourceHasRequiredCoordinates,
457
+ me as semaphorInputOptionsResultSchema,
458
+ ce as semaphorMatrixResultSchema,
459
+ ue as semaphorMetricAggregate,
460
+ pe as semaphorMetricMeasureBindingKey,
461
+ he as semaphorMetricResultSchema,
462
+ fe as semaphorPhysicalSourceRefSchema,
463
+ be as semaphorRecordsResultSchema,
464
+ Se as semaphorRelationshipDiagnosticsSchema,
465
+ ge as semaphorResultColumnSchema,
466
+ ve as semaphorSemanticSourceRefSchema,
467
+ y as semaphorSourceHasRequiredCoordinates,
463
468
  f as semaphorSourceIdentityKey,
464
- ge as semaphorSourceRefSchema,
465
- ve as semaphorSourcesReferToSameDataset,
466
- Ce as semaphorSqlResultSchema,
467
- Re as semaphorSqlSourceRefSchema,
468
- _e as semaphorTimeGrainSchema,
469
- ye as temporalBucketDataTypeForGrain,
470
- Te as temporalBucketFormatSchema,
471
- Ae as temporalBucketMetadataSchema,
472
- Ra as validateActivatedTemporalBucketResultColumns,
473
- ta as validateComparisonPresentationSpec,
474
- ia as validateGlobalDateComparisonContext,
475
- na as validateGlobalDateComparisonSelection,
476
- oa as validateMetricComparisonConfig,
477
- la as validateMetricComparisonPolarity,
478
- da as validateMetricComparisonSpec,
479
- Ie as validateSemaphorAnalyticsIntent,
480
- De as validateSemaphorAnalyticsRecoveryPlan,
481
- Ee as validateSemaphorDashboardIntent,
482
- Me as validateSemaphorDataAppCodegenSummary,
483
- Fe as validateSemaphorDerivedFieldDefinition,
484
- ke as validateSemaphorOperationIntent,
485
- Oe as validateSemaphorResultCalculation,
486
- _a as validateTemporalBucketMetadata,
487
- ya as validateTemporalBucketResultColumn
469
+ Re as semaphorSourceRefSchema,
470
+ Ce as semaphorSourcesReferToSameDataset,
471
+ Te as semaphorSqlResultSchema,
472
+ _e as semaphorSqlSourceRefSchema,
473
+ ye as semaphorTimeGrainSchema,
474
+ Ae as temporalBucketDataTypeForGrain,
475
+ Ie as temporalBucketFormatSchema,
476
+ De as temporalBucketMetadataSchema,
477
+ _a as validateActivatedTemporalBucketResultColumns,
478
+ na as validateComparisonPresentationSpec,
479
+ oa as validateGlobalDateComparisonContext,
480
+ la as validateGlobalDateComparisonSelection,
481
+ da as validateMetricComparisonConfig,
482
+ ma as validateMetricComparisonPolarity,
483
+ ca as validateMetricComparisonSpec,
484
+ Ma as validateRawTemporalResultColumn,
485
+ Ee as validateSemaphorAnalyticsIntent,
486
+ Me as validateSemaphorAnalyticsRecoveryPlan,
487
+ Fe as validateSemaphorDashboardIntent,
488
+ ke as validateSemaphorDataAppCodegenSummary,
489
+ Oe as validateSemaphorDerivedFieldDefinition,
490
+ qe as validateSemaphorOperationIntent,
491
+ Ne as validateSemaphorResultCalculation,
492
+ ya as validateTemporalBucketMetadata,
493
+ Aa as validateTemporalBucketResultColumn
488
494
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-DRlMUglg.cjs");exports.APPEARANCE_SPEC_VERSION=e.APPEARANCE_SPEC_VERSION;exports.assertValidAppearanceSpec=e.assertValidAppearanceSpec;exports.mergeAppearanceSpecs=e.mergeAppearanceSpecs;exports.normalizeAppearanceSpec=e.normalizeAppearanceSpec;exports.resolveAppearance=e.resolveAppearance;exports.validateAppearanceSpec=e.validateAppearanceSpec;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-ByFbacH7.cjs");exports.APPEARANCE_SPEC_VERSION=e.APPEARANCE_SPEC_VERSION;exports.assertValidAppearanceSpec=e.assertValidAppearanceSpec;exports.mergeAppearanceSpecs=e.mergeAppearanceSpecs;exports.normalizeAppearanceSpec=e.normalizeAppearanceSpec;exports.resolveAppearance=e.resolveAppearance;exports.validateAppearanceSpec=e.validateAppearanceSpec;
@@ -1,4 +1,4 @@
1
- import { A as p, f as r, m as s, n as c, r as A, v as n } from "../chunks/index-CJdxSyQq.js";
1
+ import { A as p, b as r, m as s, n as c, r as A, v as n } from "../chunks/index-DSKR3nKn.js";
2
2
  export {
3
3
  p as APPEARANCE_SPEC_VERSION,
4
4
  r as assertValidAppearanceSpec,
@@ -1,16 +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-Cjk6G06r.cjs"),A=require("../chunks/index-DRlMUglg.cjs"),J=require("../chunks/x-B6ghREd2.cjs");require("../chunks/validators-9D4KBqKD.cjs");require("../chunks/analyze-result-contract-BHb7sUUW.cjs");require("../value-format-preferences/index.cjs");const q=require("../chunks/palette-BN-jYtaK.cjs"),be=require("../chunks/braces-v55uLCAK.cjs"),fe=require("../chunks/save-3dYRmehL.cjs"),me=require("../chunks/layout-grid-xm8pqtx0.cjs");/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("react"),d=require("../chunks/switch-CjJ6FHYJ.cjs"),oe=require("../chunks/color-CyB5o13F.cjs"),L=require("../chunks/x-B6ghREd2.cjs");require("../chunks/saved-temporal-bucket-format-Gfbh4IiP.cjs");require("../chunks/validators-Dm7Kpz6p.cjs");require("../chunks/analyze-result-contract-Dxw66nUG.cjs");require("../value-format-preferences/index.cjs");const W=require("../chunks/index-ByFbacH7.cjs"),_=require("../chunks/palette-BN-jYtaK.cjs"),fe=require("../chunks/braces-v55uLCAK.cjs"),me=require("../chunks/save-3dYRmehL.cjs"),xe=require("../chunks/layout-grid-xm8pqtx0.cjs");/**
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 xe=J.createLucideIcon("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/**
6
+ */const he=L.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 he=J.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"}]]);/**
11
+ */const je=L.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 je=J.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"}]]),X=[{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 ke(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 oe(r,n){const t=X.find(i=>i.id===n);if(!t)return r;const u=P(r);return ee(u.schemes.light,t.light),ee(u.schemes.dark,t.dark),u}function ee(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 re(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 ke(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 $={palette:[],background:s.card,foreground:s.foreground,gridColor:s.border,axisColor:s.mutedForeground};i.components.chart={...$,...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 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"]],ve=[0,1,2,3,4,5],M=A.APPEARANCE_FONT_PRESETS,Ce=["#ffffff","#f8fafc","#f4f4f5","#e4e4e7","#18181b","#09090b","#2563eb","#0f766e","#047857","#d97706","#dc2626","#7c3aed"];function Ne({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"),[$,z]=m.useState(!1),[ae,B]=m.useState("idle"),[Y,ne]=m.useState(!1),[D,_]=m.useState(""),[I,x]=m.useState(null),Z=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],V=u||$,te=m.useMemo(()=>p?Se(p.tokens.radius.control):void 0,[p]),de=o=>{g(a=>{if(!a)return a;const h=Fe(a);return o(h),h})},b=o=>{de(a=>{o(a.schemes[T])})},se=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)}},ie=()=>{const o=O(null);B("idle"),g(o)},ce=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)}}},K=m.useCallback(()=>f?JSON.stringify(E(f),null,2):"",[f]),le=o=>{if(ne(o),o)try{_(K()),x(null)}catch(a){x(a instanceof Error?a.message:"Appearance is invalid")}},ue=async()=>{if(f)try{const o=Y&&D?D:K();await navigator.clipboard.writeText(o),x(null),B("copied")}catch(o){x(o instanceof Error?o.message:"Unable to copy brand spec")}},Q=o=>{const a=JSON.parse(o),h=O(a),S=E(h);B("idle"),w("light"),g(h),_(JSON.stringify(S,null,2))},pe=()=>{try{Q(D)}catch(o){x(o instanceof Error?o.message:"Brand spec must be valid JSON")}},ge=async o=>{var h;const a=(h=o.target.files)==null?void 0:h[0];if(o.target.value="",!!a)try{Q(await Pe(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:te,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(q.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:Y,onOpenChange:le,children:[e.jsx(d.PopoverTrigger,{asChild:!0,children:e.jsxs(d.Button,{type:"button",size:"xs",variant:"ghost",disabled:!f,children:[e.jsx(be.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:ue,children:[e.jsx(he,{className:"h-3.5 w-3.5"}),ae==="copied"?"Copied":"Copy"]}),e.jsxs(d.Button,{type:"button",size:"xs",variant:"ghost",onClick:()=>{var o;return(o=Z.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:pe,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:Z,"aria-label":"Upload brand spec",type:"file",accept:"application/json,.json",className:"sr-only",onChange:ge}),e.jsxs(d.Button,{type:"button",size:"xs",variant:"ghost",onClick:ie,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:ce,disabled:V,children:[e.jsx(xe,{className:"h-3.5 w-3.5"}),"No config"]}),e.jsxs(d.Button,{type:"button",size:"xs",onClick:se,disabled:!f||V||!!I||!k,children:[V?e.jsx(d.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(fe.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(J.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:q.Palette,title:"Presets",description:"Start from a full light and dark appearance.",children:e.jsx("div",{className:"grid grid-cols-1 gap-2",children:X.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=oe(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:q.Palette,title:"Color",description:`Editing the ${T} scheme.`,children:e.jsx("div",{className:"grid grid-cols-2 gap-2",children:ye.map(([o,a])=>e.jsx(y,{label:a,value:p.tokens.color[o],onChange:h=>b(S=>{re(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(Te,{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(H,{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:me.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=>{re(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:ve.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(H,{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(H,{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(W,{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(W,{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(W,{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 Te({value:r,onChange:n}){var u;const t=(u=M.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=M.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:M.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=we(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(je,{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:Ce.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?`#${G(n.r)}${G(n.g)}${G(n.b)}`:"#000000"}function G(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 H({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 W({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 Se(r){const n=`${Number((r/16).toFixed(4))}rem`;return{"--semaphor-radius":n,"--semaphor-control-radius":n}}function Fe(r){return JSON.parse(JSON.stringify(r))}function Pe(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=X;exports.BrandStudioEditor=Ne;exports.applyBrandStudioPreset=oe;exports.buildAppearanceSpecFromDraft=E;exports.createBrandStudioDraft=O;exports.mirrorTableAppearance=c;
16
+ */const ke=L.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"}]]),X=[{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=W.resolveAppearance({organizationAppearance:r??void 0});return ye(P(n))}function E(r){const n=P({version:W.APPEARANCE_SPEC_VERSION,mode:r.mode,schemes:r.schemes}),t=W.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 ae(r,n){const t=X.find(i=>i.id===n);if(!t)return r;const u=P(r);return ee(u.schemes.light,t.light),ee(u.schemes.dark,t.dark),u}function ee(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 re(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 V(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 ye(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 ve=[["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"]],Ce=[0,1,2,3,4,5],U=oe.APPEARANCE_FONT_PRESETS,Ne=["#ffffff","#f8fafc","#f4f4f5","#e4e4e7","#18181b","#09090b","#2563eb","#0f766e","#047857","#d97706","#dc2626","#7c3aed"];function Te({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,A]=m.useState(!1),[ne,B]=m.useState("idle"),[Y,te]=m.useState(!1),[z,$]=m.useState(""),[D,x]=m.useState(null),Z=m.useRef(null),I=m.useRef(s),R=m.useRef(!1);m.useEffect(()=>{I.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=I.current)==null||o.call(I,a),x(null)}catch(a){x(a instanceof Error?a.message:"Appearance is invalid")}}},[f]);const p=f==null?void 0:f.schemes[T],q=u||J,de=m.useMemo(()=>p?Fe(p.tokens.radius.control):void 0,[p]),se=o=>{g(a=>{if(!a)return a;const h=Pe(a);return o(h),h})},b=o=>{se(a=>{o(a.schemes[T])})},ie=async()=>{if(!f||!k)return;let o;try{o=E(f)}catch(a){x(a instanceof Error?a.message:"Appearance is invalid");return}A(!0);try{await k(o)}finally{A(!1)}},ce=()=>{const o=O(null);B("idle"),g(o)},le=async()=>{if(j){A(!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{A(!1)}}},K=m.useCallback(()=>f?JSON.stringify(E(f),null,2):"",[f]),ue=o=>{if(te(o),o)try{$(K()),x(null)}catch(a){x(a instanceof Error?a.message:"Appearance is invalid")}},pe=async()=>{if(f)try{const o=Y&&z?z:K();await navigator.clipboard.writeText(o),x(null),B("copied")}catch(o){x(o instanceof Error?o.message:"Unable to copy brand spec")}},Q=o=>{const a=JSON.parse(o),h=O(a),S=E(h);B("idle"),w("light"),g(h),$(JSON.stringify(S,null,2))},ge=()=>{try{Q(z)}catch(o){x(o instanceof Error?o.message:"Brand spec must be valid JSON")}},be=async o=>{var h;const a=(h=o.target.files)==null?void 0:h[0];if(o.target.value="",!!a)try{Q(await Be(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:de,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(_.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:Y,onOpenChange:ue,children:[e.jsx(d.PopoverTrigger,{asChild:!0,children:e.jsxs(d.Button,{type:"button",size:"xs",variant:"ghost",disabled:!f,children:[e.jsx(fe.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:pe,children:[e.jsx(je,{className:"h-3.5 w-3.5"}),ne==="copied"?"Copied":"Copy"]}),e.jsxs(d.Button,{type:"button",size:"xs",variant:"ghost",onClick:()=>{var o;return(o=Z.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:ge,children:"Apply"})]})]}),e.jsx("div",{className:"h-[320px] overflow-hidden rounded-control border border-input",children:e.jsx(d.CodeEditor,{ariaLabel:"Brand spec",value:z,onValueChange:o=>{$(o),B("idle")},language:"json",embedded:!0,hideLineNumbers:!0,dense:!0})})]})]}),e.jsx("input",{ref:Z,"aria-label":"Upload brand spec",type:"file",accept:"application/json,.json",className:"sr-only",onChange:be}),e.jsxs(d.Button,{type:"button",size:"xs",variant:"ghost",onClick:ce,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:le,disabled:q,children:[e.jsx(he,{className:"h-3.5 w-3.5"}),"No config"]}),e.jsxs(d.Button,{type:"button",size:"xs",onClick:ie,disabled:!f||q||!!D||!k,children:[q?e.jsx(d.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(me.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(L.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",T===o?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>w(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:_.Palette,title:"Presets",description:"Start from a full light and dark appearance.",children:e.jsx("div",{className:"grid grid-cols-1 gap-2",children:X.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=ae(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:_.Palette,title:"Color",description:`Editing the ${T} scheme.`,children:e.jsx("div",{className:"grid grid-cols-2 gap-2",children:ve.map(([o,a])=>e.jsx(y,{label:a,value:p.tokens.color[o],onChange:h=>b(S=>{re(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(we,{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.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=>{V(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=>{V(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=>{V(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=>{re(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:Ce.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 we({value:r,onChange:n}){var u;const t=(u=U.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=U.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:U.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=Se(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(ke,{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:Ne.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 Se(r){const n=oe.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 Fe(r){const n=`${Number((r/16).toFixed(4))}rem`;return{"--semaphor-radius":n,"--semaphor-control-radius":n}}function Pe(r){return JSON.parse(JSON.stringify(r))}function Be(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=X;exports.BrandStudioEditor=Te;exports.applyBrandStudioPreset=ae;exports.buildAppearanceSpecFromDraft=E;exports.createBrandStudioDraft=O;exports.mirrorTableAppearance=c;