react-semaphor 0.1.399 → 0.1.401
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analytics-protocol/index.cjs +1 -1
- package/dist/analytics-protocol/index.js +1 -1
- package/dist/brand-studio/index.cjs +1 -1
- package/dist/brand-studio/index.js +2 -2
- package/dist/chunks/{analyze-result-contract-CUO5QmqV.js → analyze-result-contract-BUgK3759.js} +675 -639
- package/dist/chunks/analyze-result-contract-S8u7CcPL.js +1 -0
- package/dist/chunks/{calendar-preferences-dialog-9SvYDLp6.js → calendar-preferences-dialog-C5u8P3Aa.js} +3 -3
- package/dist/chunks/{calendar-preferences-dialog-B3fnFtJt.js → calendar-preferences-dialog-D619F0ag.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-D3R4R7ww.js → dashboard-briefing-launcher-B2SY8WLW.js} +2 -2
- package/dist/chunks/{dashboard-briefing-launcher-APVyc9al.js → dashboard-briefing-launcher-Dsg9gmkm.js} +20 -14
- package/dist/chunks/{dashboard-controls-CHDQlMZ9.js → dashboard-controls-BLWXaG2Q.js} +6 -6
- package/dist/chunks/{dashboard-controls-v7jslCXR.js → dashboard-controls-DsFznKZ0.js} +1 -1
- package/dist/chunks/{dashboard-json-L1Qo5xcX.js → dashboard-json-B7RYi1qg.js} +1 -1
- package/dist/chunks/{dashboard-json-DF_syvRu.js → dashboard-json-DouaaMpH.js} +3 -3
- package/dist/chunks/{date-formatter-CzcPZx39.js → date-formatter-BlhBftA9.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-DwfIWUe-.js → edit-dashboard-visual-BxON7Y6L.js} +4 -4
- package/dist/chunks/{edit-dashboard-visual-qdruQruO.js → edit-dashboard-visual-CAs6Lm2_.js} +1 -1
- package/dist/chunks/index-BG9NaVLs.js +1346 -0
- package/dist/chunks/{index-DFOb_6HB.js → index-CjzRe2su.js} +3 -3
- package/dist/chunks/{index-BdVymLVq.js → index-kFwHL6im.js} +33680 -33120
- package/dist/chunks/{switch-BiU6-YSY.js → switch-CXMExaSF.js} +2385 -2348
- package/dist/chunks/{switch-CYG3dY8r.js → switch-oim6Xl36.js} +26 -26
- package/dist/chunks/update-policy-BmtOqvbf.js +3 -0
- package/dist/chunks/update-policy-KImUg4Od.js +831 -0
- package/dist/chunks/{use-create-flow-overlay-state-qe7DHQKr.js → use-create-flow-overlay-state-BlxamUgq.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-CwUkhLBL.js → use-create-flow-overlay-state-Ze0cRQQC.js} +3 -3
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.cjs +1 -1
- package/dist/dashboard-authoring/index.js +1 -1
- package/dist/data-app-builder/index.cjs +1 -1
- package/dist/data-app-builder/index.js +2 -2
- package/dist/data-app-codegen/index.cjs +1 -0
- package/dist/data-app-codegen/index.js +22 -0
- package/dist/data-app-codegen-node/index.cjs +462 -0
- package/dist/data-app-codegen-node/index.js +1424 -0
- package/dist/data-app-sdk/index.cjs +1 -1
- package/dist/data-app-sdk/index.js +1 -1
- package/dist/data-app-sdk-adapters/index.cjs +1 -1
- package/dist/data-app-sdk-adapters/index.js +1 -1
- package/dist/data-app-sdk-validation/index.cjs +1 -1
- package/dist/data-app-sdk-validation/index.js +1 -1
- package/dist/format-utils/index.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +7 -7
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/dashboard-authoring.d.ts +10 -0
- package/dist/types/dashboard.d.ts +10 -0
- package/dist/types/data-app-codegen-node.d.ts +1165 -0
- package/dist/types/data-app-codegen.d.ts +1137 -0
- package/dist/types/main.d.ts +16 -2
- package/dist/types/shared.d.ts +10 -0
- package/dist/types/surfboard.d.ts +10 -0
- package/dist/types/types.d.ts +17 -7
- package/package.json +9 -1
- package/dist/chunks/analyze-result-contract-OqFtOCpZ.js +0 -1
- package/dist/chunks/index-DH7hOGQl.js +0 -1346
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("zod"),q={answerSummary:"string",responseDetail:"responseDetail",mode:"string",comparisonType:"string",executionResult:"executionResult",compiledQuery:"unknown",data:"unknown",resultSets:"record",analysisWarnings:"unknownArray",columns:"unknownArray",records:"recordArray",rowCount:"number",rowLimitExceeded:"boolean",output:"string",querySpec:"unknown",metadata:"record",validation:"validationResult",coverage:"coverage",diagnosticFeedback:"diagnosticFeedback",missingFields:"stringArray",warnings:"unknownArray",comparison:"unknown",population:"population",comparisons:"recordArray",fieldsUsed:"compactExecutionFieldArray",primary:"recordArray",contributors:"recordArray",segments:"recordArray",periodChanges:"recordArray",changes:"recordArray",largestNegativeChanges:"recordArray",largestPositiveChanges:"recordArray",drivers:"recordArray",absoluteDeltaDrivers:"recordArray",largestNegativeDrivers:"recordArray",largestPositiveDrivers:"recordArray",periodRows:"recordArray",sql:"unknown",omitted:"stringArray"},_="semaphor-data-app-codegen-summary/v1",Re="semaphor-data-app-codegen-summary-validator/v2",_e=new Set(["metric","records","matrix","analysis","sql_fallback"]),je=new Set(["semaphor.metric","semaphor.records","semaphor.matrix","semaphor.analysis","semaphor.sql"]),Ce=new Set(["absolute_delta","largest_negative","largest_positive","positive_and_negative","all"]),se=new Set(["source","id","label","measures","primaryMeasure","dateField","timeGrain","dimensions","comparison","orderBy","filters","relationshipHint","limit","derivedFields"]),qe=new Set([...se,"analysis","timeWindow","filters","driverMode","includePopulation","calendarContext","chartTitle","chartType"]),xe=new Set(["source","id","label","fields","dateField","timeGrain","timeWindow","filters","orderBy","relationshipHint","limit","pagination","totals","derivedFields"]),Ee=new Set(["source","id","label","filters","relationshipHint","rows","columns","values","totals","sort","expansion","layout","displayLimits"]),Fe=new Set(["source","id","label","sql","defaultParameters","pythonCode","fields","limit","pagination","rationale"]),Ne=new Set(["kpi","line_chart","bar_chart","stacked_bar_chart","pie_chart","donut_chart","area_chart","table","matrix","narrative","text_block","custom"]),De=new Set(["missing_measure","missing_dimension","missing_date","missing_relationship","missing_semantic_role","missing_current_app_state","unsupported_change_intent","ambiguous_field_grounding","invalid_ranker_output","latest_snapshot_selector_not_modeled","unsupported_grain","requires_sql_escape_hatch","unsupported_sdk_capability"]);function Te(i){return B(i).ok}function B(i){const o=[];if(!i||typeof i!="object")return{ok:!1,issues:["Summary must be an object."]};const t=i;return t.schemaVersion!==_&&o.push(`schemaVersion must be ${_}.`),(typeof t.title!="string"||!t.title.trim())&&o.push("title is required."),Array.isArray(t.sources)||o.push("sources must be an array."),Array.isArray(t.inputs)||o.push("inputs must be an array."),Array.isArray(t.views)||o.push("views must be an array."),Array.isArray(t.filterContracts)||o.push("filterContracts must be an array."),(!t.implementationChecklist||typeof t.implementationChecklist!="object")&&o.push("implementationChecklist must be an object."),t.implementationChecklist&&typeof t.implementationChecklist=="object"&&o.push(...Ke(t.implementationChecklist)),Array.isArray(t.sources)&&t.sources.forEach((s,r)=>{o.push(...$(s,`sources.${r}`))}),Array.isArray(t.inputs)&&t.inputs.forEach((s,r)=>{o.push(...Me(s,`inputs.${r}`))}),Array.isArray(t.views)&&t.views.forEach((s,r)=>{o.push(...Pe(s,`views.${r}`))}),Array.isArray(t.filterContracts)&&t.filterContracts.forEach((s,r)=>{o.push(...He(s,`filterContracts.${r}`))}),t.unsupportedInsights!==void 0&&(Array.isArray(t.unsupportedInsights)?t.unsupportedInsights.forEach((s,r)=>{o.push(...pt(s,`unsupportedInsights.${r}`))}):o.push("unsupportedInsights must be an array.")),o.push(...Oe(t)),{ok:o.length===0,issues:o}}function Oe(i){const o=Array.isArray(i.unsupportedInsights)&&i.unsupportedInsights.some(l=>{var u;return((u=a(l))==null?void 0:u.reason)==="missing_relationship"}),t=Array.isArray(i.views)&&i.views.some(l=>{var c;const u=a((c=a(l))==null?void 0:c.computation);return(u==null?void 0:u.kind)==="unsupported"&&u.reason==="missing_relationship"});if(!o&&!t)return[];const s=[],r=a(i.validation);(r==null?void 0:r.status)!=="blocked"&&s.push("validation.status must be blocked when missing_relationship gaps are present.");const n=a(i.nextRequiredTool);return(n==null?void 0:n.name)!=="semaphor_propose_semantic_model_change"&&s.push("nextRequiredTool.name must be semaphor_propose_semantic_model_change when missing_relationship gaps are present."),s}function $(i,o){const t=a(i);return t?t.kind==="semantic"?typeof t.domainId=="string"&&t.domainId.trim()&&typeof t.datasetName=="string"&&t.datasetName.trim()?[]:[`${o} must include sourceKey or a supported source identity.`]:typeof t.sourceKey=="string"&&t.sourceKey.trim()?[]:t.kind==="physical"&&typeof t.tableName=="string"&&t.tableName.trim()&&typeof t.connectionId=="string"&&t.connectionId.trim()?[]:t.kind==="sql"&&typeof t.connectionId=="string"&&t.connectionId.trim()?[]:[`${o} must include sourceKey or a supported source identity.`]:[`${o} must be an object.`]}function Ke(i){const o=a(i);if(!o)return["implementationChecklist must be an object."];const t=[],s=["requiredDevtools","requiredInputOptions","filterScopeByInput","bindingsByView","validationCommands","browserSmokeChecks"];for(const n of s)n in o||t.push(`implementationChecklist.${n} is required.`);const r=a(o.requiredDevtools);return r?typeof r.mountRootDevtools!="boolean"&&t.push("implementationChecklist.requiredDevtools.mountRootDevtools must be a boolean."):t.push("implementationChecklist.requiredDevtools must be an object."),Array.isArray(o.requiredInputOptions)||t.push("implementationChecklist.requiredInputOptions must be an array."),Array.isArray(o.filterScopeByInput)||t.push("implementationChecklist.filterScopeByInput must be an array."),a(o.bindingsByView)||t.push("implementationChecklist.bindingsByView must be an object."),g(o.validationCommands)||t.push("implementationChecklist.validationCommands must be an array of strings."),g(o.browserSmokeChecks)||t.push("implementationChecklist.browserSmokeChecks must be an array of strings."),t}function Me(i,o){const t=a(i);if(!t)return[`${o} must be an object.`];const s=[];return(typeof t.id!="string"||!t.id.trim())&&s.push(`${o}.id is required.`),t.fieldRef&&s.push(...p(t.fieldRef,`${o}.fieldRef`)),s.push(...ie(t.optionQuery,`${o}.optionQuery`)),g(t.appliesToViewIds)||s.push(`${o}.appliesToViewIds must be an array of strings.`),t.bindings!==void 0&&!Array.isArray(t.bindings)&&s.push(`${o}.bindings must be an array.`),Array.isArray(t.bindings)&&t.bindings.forEach((r,n)=>{const l=a(r);if(!l){s.push(`${o}.bindings.${n} must be an object.`);return}g(l.appliesToViewIds)||s.push(`${o}.bindings.${n}.appliesToViewIds must be an array of strings.`),s.push(...p(l.fieldRef,`${o}.bindings.${n}.fieldRef`))}),s}function Pe(i,o){const t=a(i);if(!t)return[`${o} must be an object.`];const s=[];if((typeof t.id!="string"||!t.id.trim())&&s.push(`${o}.id is required.`),t.visualSpec!==void 0&&s.push(...rt(t.visualSpec,`${o}.visualSpec`)),t.computation!==void 0&&s.push(...ct(t.computation,`${o}.computation`)),it(t))return s.push(...T(t,`${o}`)),t.fields!==void 0&&(Array.isArray(t.fields)?t.fields.forEach((n,l)=>{s.push(...p(n,`${o}.fields.${l}`))}):s.push(`${o}.fields must be an array.`)),t.queryKind!==void 0&&s.push(`${o}.queryKind is not allowed for non-executable views.`),t.sdkBuilder!==void 0&&s.push(`${o}.sdkBuilder is not allowed for non-executable views.`),t.sdkSpec!==void 0&&s.push(`${o}.sdkSpec is not allowed for non-executable views.`),s;if(!Array.isArray(t.fields))return s.push(`${o}.fields must be an array.`),(t.sdkSpec!==void 0||t.sdkBuilder!==void 0)&&s.push(`${o}.fields must be an array for executable views.`),s.push(...T(t,`${o}`)),s;t.fields.forEach((n,l)=>{s.push(...p(n,`${o}.fields.${l}`))}),v(t.queryKind)||s.push(`${o}.queryKind must be a supported codegen query kind.`),t.sdkBuilder!==void 0&&!ne(t.sdkBuilder)&&s.push(`${o}.sdkBuilder must be a supported SDK builder.`);const r=a(t.computation);return(r==null?void 0:r.kind)==="server_query"&&v(t.queryKind)&&v(r.queryKind)&&r.queryKind!==t.queryKind&&s.push(`${o}.computation.queryKind must match queryKind.`),s.push(...Qe({value:t.sdkSpec,path:`${o}.sdkSpec`,queryKind:typeof t.queryKind=="string"?t.queryKind:void 0,sdkBuilder:typeof t.sdkBuilder=="string"?t.sdkBuilder:void 0}),...T(t,`${o}`)),s}function T(i,o){var Z;const t=a((Z=a(i.visualSpec))==null?void 0:Z.tableBehavior),s=a(i.sdkSpec),r=a(s==null?void 0:s.spec),n=typeof(s==null?void 0:s.builder)=="string"?s.builder:void 0,l=n==="semaphor.records"?a(r==null?void 0:r.totals):void 0,u=[];if(!t)return l&&u.push(`${o}.sdkSpec.spec.totals is only allowed when tableBehavior.totals.mode is server.`),u;const c=a(t.totals);return c?(c.mode==="server"&&(n!=="semaphor.records"&&u.push(`${o}.visualSpec.tableBehavior.totals.mode server is only supported for semaphor.records views.`),!l||l.mode!=="server"?u.push(`${o}.sdkSpec.spec.totals.mode must be server when tableBehavior.totals.mode is server.`):u.push(...Be({left:c.measures,right:l.measures,leftPath:`${o}.visualSpec.tableBehavior.totals.measures`,rightPath:`${o}.sdkSpec.spec.totals.measures`}))),c.mode!=="server"&&l&&u.push(`${o}.sdkSpec.spec.totals is only allowed when tableBehavior.totals.mode is server.`),n==="semaphor.sql"&&c.mode!=="none"&&u.push(`${o}.visualSpec.tableBehavior.totals.mode must be none for semaphor.sql views.`),n==="semaphor.sql"&&a(r==null?void 0:r.totals)&&u.push(`${o}.sdkSpec.spec.totals is not supported for semaphor.sql.`),u):(l&&u.push(`${o}.sdkSpec.spec.totals is only allowed when tableBehavior.totals.mode is server.`),u)}function Be({left:i,right:o,leftPath:t,rightPath:s}){if(!Array.isArray(i)||!Array.isArray(o))return[`${s} must match ${t}.`];const r=[];return i.length!==o.length?(r.push(`${s} must match ${t}.`),r):(i.forEach((n,l)=>{Ve(a(n),a(o[l]))||r.push(`${s}.${l} must match ${t}.${l}.`)}),r)}function Ve(i,o){return!i||!o?!1:i.name===o.name&&(i.role||"measure")===(o.role||"measure")&&X(i)===X(o)&&Le(i,o)}function X(i){return typeof i.aggregate=="string"?i.aggregate.toUpperCase():"SUM"}function Le(i,o){const t=a(i.source),s=a(o.source);if(Ue(t,s))return!1;const r=J(i),n=J(o);if(r.size>0||n.size>0){for(const l of r)if(n.has(l))return!0;return!1}return!t||!s||t.kind!==s.kind?!1:t.kind==="semantic"?t.domainId===s.domainId&&t.datasetName===s.datasetName&&(t.datasetId===void 0||s.datasetId===void 0||t.datasetId===s.datasetId):t.kind==="physical"?t.connectionId===s.connectionId&&t.tableName===s.tableName:t.kind==="sql"?t.connectionId===s.connectionId:!1}function Ue(i,o){if(!i||!o||i.kind!=="semantic"||o.kind!=="semantic")return!1;const t=typeof i.datasetId=="string"?i.datasetId.trim():"",s=typeof o.datasetId=="string"?o.datasetId.trim():"";return!!(t&&s&&t!==s)}function J(i){const o=typeof i.sourceKey=="string"?i.sourceKey.trim():"";return o?new Set([o]):Ge(a(i.source))}function Ge(i){const o=new Set;if(!i)return o;const t=typeof i.sourceKey=="string"?i.sourceKey.trim():"";if(t&&o.add(t),i.kind==="semantic"){const s=typeof i.domainId=="string"?i.domainId:"",r=typeof i.datasetName=="string"?i.datasetName:"",n=typeof i.datasetId=="string"?i.datasetId:"";s&&n&&o.add(`semantic:${s}:datasetId:${n}`),s&&r&&o.add(`semantic:${s}:datasetName:${r}`)}if(i.kind==="physical"){const s=typeof i.connectionId=="string"?i.connectionId:"",r=typeof i.tableName=="string"?i.tableName:"",n=typeof i.databaseName=="string"?i.databaseName:"",l=typeof i.schemaName=="string"?i.schemaName:"";s&&r&&(o.add(["physical",s,n,l,r].join(":")),o.add(`physical:${s}:${r}`))}if(i.kind==="sql"){const s=typeof i.connectionId=="string"?i.connectionId:"",r=typeof i.dialect=="string"?i.dialect:"",n=typeof i.label=="string"?i.label:"";s&&(o.add(["sql",s,r,n].join(":")),o.add(`sql:${s}`))}return o}function He(i,o){const t=a(i);if(!t)return[`${o} must be an object.`];const s=[];if(t.fieldRef&&s.push(...p(t.fieldRef,`${o}.fieldRef`)),(typeof t.inputId!="string"||!t.inputId.trim())&&s.push(`${o}.inputId is required.`),s.push(...ie(t.optionQuery,`${o}.optionQuery`)),g(t.appliesToViewIds)||s.push(`${o}.appliesToViewIds must be an array of strings.`),g(t.notAppliedToViewIds)||s.push(`${o}.notAppliedToViewIds must be an array of strings.`),!Array.isArray(t.bindings))s.push(`${o}.bindings must be an array.`);else{const r=g(t.appliesToViewIds)?new Set(t.appliesToViewIds):void 0,n=g(t.notAppliedToViewIds)?new Set(t.notAppliedToViewIds):void 0;t.bindings.forEach((l,u)=>{const c=a(l);if(!c){s.push(`${o}.bindings.${u} must be an object.`);return}typeof c.viewId!="string"||!c.viewId?s.push(`${o}.bindings.${u}.viewId is required.`):(r&&!r.has(c.viewId)&&s.push(`${o}.bindings.${u}.viewId must be included in appliesToViewIds.`),n!=null&&n.has(c.viewId)&&s.push(`${o}.bindings.${u}.viewId must not be listed in notAppliedToViewIds.`)),s.push(...p(c.fieldRef,`${o}.bindings.${u}.fieldRef`))})}return s}function ie(i,o){if(i===void 0)return[];const t=a(i);if(!t)return[`${o} must be an object.`];const s=[...h(t.valueFieldRef,`${o}.valueFieldRef`),...h(t.labelFieldRef,`${o}.labelFieldRef`),...h(t.filterFieldRef,`${o}.filterFieldRef`)];return t.builder!=="semaphor.inputOptions"&&s.push(`${o}.builder must be semaphor.inputOptions.`),typeof t.sourceKey!="string"&&t.source===void 0&&s.push(`${o} must include source or sourceKey.`),t.source!==void 0&&s.push(...$(t.source,`${o}.source`)),a(t.valueFieldRef)||s.push(`${o}.valueFieldRef is required.`),a(t.labelFieldRef)||s.push(`${o}.labelFieldRef is required.`),t.limit!==void 0&&(typeof t.limit!="number"||!Number.isInteger(t.limit)||t.limit<=0)&&s.push(`${o}.limit must be a positive integer.`),s}function Qe(i){var r;const o=a(i.value);if(!o)return[`${i.path} is required for executable views.`];const t=[];if(!ne(o.builder))return t.push(`${i.path}.builder must be a supported SDK builder.`),t;i.sdkBuilder&&o.builder!==i.sdkBuilder&&t.push(`${i.path}.builder must match sdkBuilder.`),i.queryKind&&v(i.queryKind)&&o.builder!==st(i.queryKind)&&t.push(`${i.path}.builder must match queryKind.`);const s=a(o.spec);if(!s)return t.push(`${i.path}.spec must be an object.`),t;switch(o.builder){case"semaphor.metric":t.push(...S(s,se,`${i.path}.spec`),...A(s,i.path),...O(s.measures,`${i.path}.spec.measures`),...h(s.primaryMeasure,`${i.path}.spec.primaryMeasure`),...h(s.dateField,`${i.path}.spec.dateField`),...K(s.dimensions,`${i.path}.spec.dimensions`),...M(s.orderBy,`${i.path}.spec.orderBy`),...I(s.filters,`${i.path}.spec.filters`));break;case"semaphor.analysis":t.push(...S(s,qe,`${i.path}.spec`),...A(s,i.path),...O(s.measures,`${i.path}.spec.measures`),...h(s.primaryMeasure,`${i.path}.spec.primaryMeasure`),...h(s.dateField,`${i.path}.spec.dateField`),...K(s.dimensions,`${i.path}.spec.dimensions`),...M(s.orderBy,`${i.path}.spec.orderBy`),...I(s.filters,`${i.path}.spec.filters`),...Ye(s,`${i.path}.spec`));break;case"semaphor.records":t.push(...S(s,xe,`${i.path}.spec`),...A(s,i.path),...O(s.fields,`${i.path}.spec.fields`),...h(s.dateField,`${i.path}.spec.dateField`),...M(s.orderBy,`${i.path}.spec.orderBy`),...I(s.filters,`${i.path}.spec.filters`),...We(s.totals,`${i.path}.spec.totals`));break;case"semaphor.matrix":t.push(...S(s,Ee,`${i.path}.spec`),...Ze(s,i.path),...Xe(s.rows,`${i.path}.spec.rows`),...Je(s.columns,`${i.path}.spec.columns`),...et(s.values,`${i.path}.spec.values`),...tt(s.sort,`${i.path}.spec.sort`),...I(s.filters,`${i.path}.spec.filters`));break;case"semaphor.sql":t.push(...S(s,Fe,`${i.path}.spec`),...A(s,i.path)),((r=a(s.source))==null?void 0:r.kind)!=="sql"&&t.push(`${i.path}.spec.source.kind must be sql.`),(typeof s.sql!="string"||!s.sql.trim())&&t.push(`${i.path}.spec.sql is required.`),t.push(...K(s.fields,`${i.path}.spec.fields`));break}return t}function Ye(i,o){const t=[];if(i.driverMode!==void 0&&!Ce.has(i.driverMode)&&t.push(`${o}.driverMode must be a supported analysis driver mode.`),i.includePopulation!==void 0&&typeof i.includePopulation!="boolean"&&t.push(`${o}.includePopulation must be a boolean.`),i.calendarContext!==void 0){const s=a(i.calendarContext);if(!s)t.push(`${o}.calendarContext must be an object.`);else{s.tz!==void 0&&typeof s.tz!="string"&&t.push(`${o}.calendarContext.tz must be a string.`),s.weekStart!==void 0&&(typeof s.weekStart!="number"||!Number.isInteger(s.weekStart)||s.weekStart<0||s.weekStart>6)&&t.push(`${o}.calendarContext.weekStart must be an integer between 0 and 6.`);const r=s.anchor;if(r!==void 0&&r!=="now"){const n=a(r);(!n||typeof n.iso!="string"||!n.iso.trim())&&t.push(`${o}.calendarContext.anchor must be now or { iso }.`)}}}return t}function We(i,o){if(i===void 0)return[];const t=a(i);if(!t)return[`${o} must be an object.`];const s=[];return t.mode!=="server"&&s.push(`${o}.mode must be server.`),!Array.isArray(t.measures)||t.measures.length===0?s.push(`${o}.measures must include at least one measure.`):t.measures.forEach((r,n)=>{var l;s.push(...ae(r,`${o}.measures.${n}`)),((l=a(r))==null?void 0:l.role)!=="measure"&&s.push(`${o}.measures.${n}.role must be measure.`)}),s}function S(i,o,t){const s=[];return Object.keys(i).forEach(r=>{o.has(r)||s.push(`${t}.${r} is not supported for this SDK builder.`)}),s}function A(i,o){return a(i.source)?$(i.source,`${o}.spec.source`):[`${o}.spec.source must be an object.`]}function Ze(i,o){const t=a(i.source);if(!t)return[`${o}.spec.source must be an object.`];const s=$(i.source,`${o}.spec.source`);return t.kind!=="semantic"&&t.kind!=="physical"&&s.push(`${o}.spec.source.kind must be semantic or physical.`),s}function O(i,o){const t=V(i,o);return Array.isArray(i)&&i.forEach((s,r)=>{t.push(...p(s,`${o}.${r}`))}),t}function K(i,o){if(i===void 0)return[];if(!Array.isArray(i))return[`${o} must be an array.`];const t=[];return i.forEach((s,r)=>{t.push(...p(s,`${o}.${r}`))}),t}function M(i,o){if(i===void 0)return[];const t=a(i);return t?[...p(t.field,`${o}.field`),...re(t.direction,`${o}.direction`)]:[`${o} must be an object.`]}function Xe(i,o){const t=V(i,o);return Array.isArray(i)&&i.forEach((s,r)=>{const n=a(s);if(!n){t.push(`${o}.${r} must be an object.`);return}t.push(...p(n.field,`${o}.${r}.field`))}),t}function Je(i,o){if(i===void 0)return[];const t=[];return Array.isArray(i)?(i.forEach((s,r)=>{const n=a(s);if(!n){t.push(`${o}.${r} must be an object.`);return}t.push(...p(n.field,`${o}.${r}.field`))}),t):[`${o} must be an array.`]}function et(i,o){const t=V(i,o);return Array.isArray(i)&&i.forEach((s,r)=>{const n=a(s);if(!n){t.push(`${o}.${r} must be an object.`);return}t.push(...p(n.field,`${o}.${r}.field`))}),t}function tt(i,o){if(i===void 0)return[];if(!Array.isArray(i))return[`${o} must be an array.`];const t=[];return i.forEach((s,r)=>{const n=a(s);if(!n){t.push(`${o}.${r} must be an object.`);return}n.axis!=="row"&&n.axis!=="column"&&t.push(`${o}.${r}.axis must be row or column.`),t.push(...re(n.direction,`${o}.${r}.direction`),...ot(n.by,`${o}.${r}.by`))}),t}function ot(i,o){const t=a(i);if(!t)return[`${o} must be an object.`];switch(t.kind){case"label":return[];case"field":return p(t.field,`${o}.field`);case"value":return typeof t.valueId!="string"||!t.valueId.trim()?[`${o}.valueId is required.`]:[];default:return[`${o}.kind must be label, field, or value.`]}}function re(i,o){return i==="asc"||i==="desc"?[]:[`${o} must be asc or desc.`]}function I(i,o){if(i===void 0)return[];if(!Array.isArray(i))return[`${o} must be an array.`];const t=[];return i.forEach((s,r)=>{const n=a(s);if(!n){t.push(`${o}.${r} must be an object.`);return}t.push(...p(n.field,`${o}.${r}.field`))}),t}function V(i,o){return!Array.isArray(i)||i.length===0?[`${o} must be a non-empty array.`]:[]}function st(i){switch(i){case"metric":return"semaphor.metric";case"records":return"semaphor.records";case"matrix":return"semaphor.matrix";case"analysis":return"semaphor.analysis";case"sql_fallback":return"semaphor.sql"}}function it(i){const o=a(i.computation),t=a(i.visualSpec);return(o==null?void 0:o.kind)==="presentation_only"||(o==null?void 0:o.kind)==="derived"||(o==null?void 0:o.kind)==="unsupported"||i.visual==="text_block"||(t==null?void 0:t.visualType)==="text_block"}function rt(i,o){const t=a(i);if(!t)return[`${o} must be an object.`];const s=[];return Ne.has(t.visualType)||s.push(`${o}.visualType must be a supported visual type.`),t.limit!==void 0&&(typeof t.limit!="number"||!Number.isInteger(t.limit)||t.limit<=0)&&s.push(`${o}.limit must be a positive integer.`),t.tableBehavior!==void 0&&s.push(...nt(t.tableBehavior,`${o}.tableBehavior`)),s}function nt(i,o){const t=a(i);if(!t)return[`${o} must be an object.`];const s=[];return t.tableMode!=="bounded"&&t.tableMode!=="server_paginated"&&t.tableMode!=="server_windowed"&&s.push(`${o}.tableMode must be a supported table mode.`),s.push(...at(t.height,`${o}.height`),...lt(t.pagination,`${o}.pagination`),...ut(t.sorting,`${o}.sorting`),...dt(t.totals,`${o}.totals`)),typeof t.serverSideRequired!="boolean"&&s.push(`${o}.serverSideRequired must be a boolean.`),s}function at(i,o){const t=a(i);if(!t)return[`${o} must be an object.`];const s=[];return(typeof t.maxPx!="number"||!Number.isInteger(t.maxPx)||t.maxPx<=0)&&s.push(`${o}.maxPx must be a positive integer.`),t.scroll!=="vertical"&&t.scroll!=="both"&&s.push(`${o}.scroll must be vertical or both.`),typeof t.stickyHeader!="boolean"&&s.push(`${o}.stickyHeader must be a boolean.`),s}function lt(i,o){const t=a(i);if(!t)return[`${o} must be an object.`];const s=[];return t.mode!=="none"&&t.mode!=="server"&&t.mode!=="client_for_bounded_rows"&&s.push(`${o}.mode must be a supported pagination mode.`),t.pageSize!==void 0&&(typeof t.pageSize!="number"||!Number.isInteger(t.pageSize)||t.pageSize<=0)&&s.push(`${o}.pageSize must be a positive integer.`),t.readsFrom!==void 0&&t.readsFrom!=="result.pagination"&&s.push(`${o}.readsFrom must be result.pagination.`),s}function ut(i,o){const t=a(i);if(!t)return[`${o} must be an object.`];const s=[];return t.mode!=="server"&&t.mode!=="client_for_bounded_rows"&&s.push(`${o}.mode must be a supported sorting mode.`),t.defaultField!==void 0&&(typeof t.defaultField!="string"||!t.defaultField.trim())&&s.push(`${o}.defaultField must be a non-empty string.`),t.defaultDirection!==void 0&&t.defaultDirection!=="asc"&&t.defaultDirection!=="desc"&&s.push(`${o}.defaultDirection must be asc or desc.`),t.resetPageOnChange!==void 0&&typeof t.resetPageOnChange!="boolean"&&s.push(`${o}.resetPageOnChange must be a boolean.`),s}function dt(i,o){const t=a(i);if(!t)return[`${o} must be an object.`];const s=[];return t.mode!=="none"&&t.mode!=="server"&&t.mode!=="local"?(s.push(`${o}.mode must be none, server, or local.`),s):t.mode==="none"?(t.measures!==void 0&&s.push(`${o}.measures is not allowed when mode is none.`),t.label!==void 0&&s.push(`${o}.label is not allowed when mode is none.`),s):t.mode==="server"?(!Array.isArray(t.measures)||t.measures.length===0?s.push(`${o}.measures must include at least one measure when mode is server.`):t.measures.forEach((r,n)=>{var l;s.push(...ae(r,`${o}.measures.${n}`)),((l=a(r))==null?void 0:l.role)!=="measure"&&s.push(`${o}.measures.${n}.role must be measure.`)}),t.label!==void 0&&s.push(`${o}.label is not allowed when mode is server.`),s):(t.mode==="local"&&(t.label!=="Displayed rows"&&t.label!=="Current page"&&s.push(`${o}.label must be Displayed rows or Current page when mode is local.`),t.measures!==void 0&&s.push(`${o}.measures is not allowed when mode is local.`)),s)}function ct(i,o){const t=a(i);if(!t)return[`${o} must be an object.`];const s=[];switch(t.kind){case"server_query":v(t.queryKind)||s.push(`${o}.queryKind must be a supported codegen query kind.`),t.queryOwnership!==void 0&&t.queryOwnership!=="view_owned"&&t.queryOwnership!=="shared_query"&&s.push(`${o}.queryOwnership must be view_owned or shared_query.`),t.sourceKeys!==void 0&&!g(t.sourceKeys)&&s.push(`${o}.sourceKeys must be an array of strings.`),t.fieldNames!==void 0&&!g(t.fieldNames)&&s.push(`${o}.fieldNames must be an array of strings.`);break;case"derived":(typeof t.upstreamViewId!="string"||!t.upstreamViewId.trim())&&s.push(`${o}.upstreamViewId is required.`),(typeof t.derivation!="string"||!t.derivation.trim())&&s.push(`${o}.derivation is required.`);break;case"presentation_only":break;case"unsupported":(typeof t.reason!="string"||!t.reason.trim())&&s.push(`${o}.reason is required.`),(typeof t.suggestedModelingFix!="string"||!t.suggestedModelingFix.trim())&&s.push(`${o}.suggestedModelingFix is required.`);break;default:s.push(`${o}.kind must be a supported computation kind.`)}return s}function pt(i,o){const t=a(i);if(!t)return[`${o} must be an object.`];const s=[];for(const n of["title","requestedQuestion","suggestedModelingFix"])(typeof t[n]!="string"||!t[n].trim())&&s.push(`${o}.${n} is required.`);return De.has(t.reason)||s.push(`${o}.reason must be a supported unsupported insight reason.`),(t.relationshipCandidate!==void 0||t.nextRepairAction!==void 0)&&t.reason!=="missing_relationship"&&s.push(`${o} relationship repair metadata is only valid for missing_relationship unsupported insights.`),t.relationshipCandidate!==void 0&&s.push(...gt(t.relationshipCandidate,`${o}.relationshipCandidate`)),t.nextRepairAction!==void 0&&s.push(...mt(t.nextRepairAction,`${o}.nextRepairAction`)),s}function mt(i,o){const t=a(i);if(!t)return[`${o} must be an object.`];const s=[],r=new Set(["tool","reason"]);return Object.keys(t).forEach(n=>{r.has(n)||s.push(`${o}.${n} is not supported; repair actions support only tool and reason.`)}),t.tool!=="semaphor_propose_semantic_model_change"&&s.push(`${o}.tool must be semaphor_propose_semantic_model_change.`),t.reason!=="missing_relationship"&&s.push(`${o}.reason must be missing_relationship.`),s}function gt(i,o){const t=a(i);if(!t)return[`${o} must be an object.`];const s=[],r=new Set(["source","sourceFields","target","targetFields"]);Object.keys(t).forEach(n=>{r.has(n)||s.push(`${o}.${n} is not supported; relationship candidates support only source, sourceFields, target, and targetFields.`)}),s.push(...ee(t.source,`${o}.source`)),s.push(...ee(t.target,`${o}.target`));for(const n of["sourceFields","targetFields"]){const l=t[n];if(!Array.isArray(l)||l.length===0){s.push(`${o}.${n} must be a non-empty endpoint field array.`);continue}l.forEach((u,c)=>{s.push(...ht(u,`${o}.${n}.${c}`))})}return s}function ht(i,o){const t=a(i);if(!t)return[`${o} must be an object.`];const s=[],r=new Set(["name","label","role","dataType"]);return Object.keys(t).forEach(n=>{r.has(n)||s.push(`${o}.${n} is not supported; relationship candidate fields are scoped by their endpoint and support only name, label, role, and dataType.`)}),(typeof t.name!="string"||!t.name.trim())&&s.push(`${o}.name must be a non-empty string.`),t.role!==void 0&&(typeof t.role!="string"||!["dimension","measure","date","id","unknown"].includes(t.role))&&s.push(`${o}.role must be dimension, measure, date, id, or unknown.`),t.dataType!==void 0&&(typeof t.dataType!="string"||!["string","number","boolean","date","datetime","unknown"].includes(t.dataType))&&s.push(`${o}.dataType must be string, number, boolean, date, datetime, or unknown.`),s}function ee(i,o){const t=a(i);if(!t)return[`${o} must be an object.`];const s=[],r=new Set(["kind","domainId","datasetName","datasetId","label","sourceKey"]);return Object.keys(t).forEach(n=>{r.has(n)||s.push(`${o}.${n} is not supported; relationship candidate sources support only semantic identity fields.`)}),t.kind!=="semantic"&&s.push(`${o} must use semantic source identity.`),(typeof t.domainId!="string"||!t.domainId.trim()||typeof t.datasetName!="string"||!t.datasetName.trim())&&s.push(`${o} must include semantic domainId and datasetName.`),s}function v(i){return _e.has(i)}function ne(i){return je.has(i)}function h(i,o){return i===void 0?[]:p(i,o)}function p(i,o){const t=a(i);if(!t)return[`${o} must be an object.`];const s=[];return(typeof t.name!="string"||!t.name.trim())&&s.push(`${o}.name is required.`),!t.source&&typeof t.sourceKey!="string"&&s.push(`${o} must include source or sourceKey.`),s}function ae(i,o){const t=a(i),s=p(i,o);if(!t||typeof t.sourceKey=="string"&&t.sourceKey.trim())return s;if(t.source!==void 0){const n=$(t.source,`${o}.source`);return n.length===0||s.push(...n),s}return s.includes(`${o} must include source or sourceKey.`)||s.push(`${o} must include source or sourceKey.`),s}function a(i){return i&&typeof i=="object"&&!Array.isArray(i)?i:void 0}function g(i){return Array.isArray(i)&&i.every(o=>typeof o=="string")}const m=e.z.record(e.z.string(),e.z.unknown()),x=e.z.array(m),d=e.z.enum(["SUM","COUNT","AVG","MIN","MAX","MEDIAN","DISTINCT"]),E=e.z.enum(["postgres","mysql","mssql","snowflake","clickhouse","bigquery","redshift","duckdb","sqlite","unknown"]),le=e.z.enum(["hour","day","week","month","quarter","year"]),F=e.z.enum(["dimension","measure","date","id","unknown"]),N=e.z.enum(["string","number","boolean","date","datetime","unknown"]),ue=e.z.enum(["semantic_model","caller_override","default_sum"]),R=e.z.union([e.z.number(),e.z.string(),e.z.null()]),P=e.z.enum(["millisecond","second","minute","hour","day"]),de=e.z.union([e.z.object({type:e.z.enum(["number","currency","percent","percentage","scientific"]),locale:e.z.string().optional(),minimumFractionDigits:e.z.number().optional(),maximumFractionDigits:e.z.number().optional(),useGrouping:e.z.boolean().optional(),prefix:e.z.string().optional(),suffix:e.z.string().optional(),negativeStyle:e.z.enum(["minus","parentheses"]).optional(),compact:e.z.boolean().optional(),scale:e.z.number().optional(),currency:e.z.string().optional(),percentValueMode:e.z.enum(["fraction","whole"]).optional()}).passthrough(),e.z.object({type:e.z.enum(["date","datetime"]),locale:e.z.string().optional(),pattern:e.z.string().optional(),relative:e.z.boolean().optional(),timezone:e.z.string().optional(),sourceTimezone:e.z.string().optional(),prefix:e.z.string().optional(),suffix:e.z.string().optional()}).passthrough(),e.z.object({type:e.z.literal("duration"),inputUnit:P.optional(),outputStyle:e.z.enum(["compact","digital","long"]).optional(),largestUnit:P.optional(),smallestUnit:P.optional(),maxUnits:e.z.number().optional(),prefix:e.z.string().optional(),suffix:e.z.string().optional(),negativeStyle:e.z.enum(["minus","parentheses"]).optional()}).passthrough(),e.z.object({type:e.z.literal("string"),prefix:e.z.string().optional(),suffix:e.z.string().optional()}).passthrough()]),ft=e.z.union([e.z.object({kind:e.z.literal("defaultAggregate")}).passthrough(),e.z.object({kind:e.z.literal("blank")}).passthrough(),e.z.object({kind:e.z.literal("labelOnly"),label:e.z.string().optional()}).passthrough(),e.z.object({kind:e.z.literal("customAggregate"),aggregate:d}).passthrough(),e.z.object({kind:e.z.literal("percentOfParent")}).passthrough(),e.z.object({kind:e.z.literal("percentOfGrandTotal")}).passthrough(),e.z.object({kind:e.z.literal("customExpression"),expressionId:e.z.string()}).passthrough()]);function w(i,o){return e.z.object(i).passthrough().superRefine((t,s)=>{for(const r of o)Object.prototype.hasOwnProperty.call(t,r)||s.addIssue({code:"custom",path:[r],message:`Required field "${r}" is missing.`})})}const L=e.z.object({kind:e.z.literal("semantic"),domainId:e.z.string(),datasetName:e.z.string(),datasetId:e.z.string().optional(),label:e.z.string().optional(),connectionId:e.z.string().optional()}).passthrough(),ce=e.z.object({kind:e.z.literal("physical"),connectionId:e.z.string(),connectionType:e.z.string().optional(),tableName:e.z.string(),databaseName:e.z.string().optional(),schemaName:e.z.string().optional(),label:e.z.string().optional(),dialect:E.optional()}).passthrough(),pe=e.z.object({kind:e.z.literal("sql"),connectionId:e.z.string(),dialect:E.optional(),label:e.z.string().optional()}).passthrough(),b=e.z.union([L,ce,pe]),z=e.z.object({name:e.z.string(),label:e.z.string().optional(),role:F.optional(),dataType:N.optional(),source:b.optional(),aggregate:d.optional()}).passthrough(),zt=e.z.object({kind:e.z.literal("field"),field:z,aggregate:d.optional()}).passthrough(),U=e.z.object({kind:e.z.literal("derived_field"),name:e.z.string(),label:e.z.string(),description:e.z.string().optional(),resultRole:F,dataType:N,computeStage:e.z.enum(["row","aggregate"]),expression:e.z.string(),expressionLanguage:e.z.literal("semaphor_sql_template").optional(),inputs:e.z.record(zt),defaultAggregate:d.optional(),aggregationBehavior:e.z.enum(["additive","non_additive","ratio_of_sums","weighted","pre_aggregated","snapshot"]).optional(),aggregationStrategy:e.z.enum(["default","symmetric_aggregate","aggregate_then_join","weighted"]).optional(),format:de.optional(),tags:e.z.array(e.z.string()).optional()}).passthrough(),D=z.and(e.z.object({semanticAggregate:d.optional(),effectiveAggregate:d.optional(),aggregateSource:ue.optional(),derivedField:U.optional()}).passthrough()),bt=L,yt=e.z.object({kind:e.z.literal("physical"),connectionId:e.z.string().optional(),connectionType:e.z.string().optional(),tableName:e.z.string(),databaseName:e.z.string().optional(),schemaName:e.z.string().optional(),label:e.z.string().optional(),dialect:E.optional()}).passthrough(),St=e.z.object({kind:e.z.literal("sql"),connectionId:e.z.string().optional(),dialect:E.optional(),label:e.z.string().optional()}).passthrough(),vt=e.z.union([bt,yt,St]),$t=e.z.object({key:e.z.string().optional(),name:e.z.string(),label:e.z.string().optional(),role:F.optional(),dataType:N.optional(),source:vt.optional(),aggregate:d.optional(),semanticAggregate:d.optional(),effectiveAggregate:d.optional(),aggregateSource:ue.optional(),derivedField:e.z.never().optional()}).passthrough(),j=e.z.object({key:e.z.string(),name:e.z.string(),label:e.z.string(),role:F.optional(),dataType:N.optional(),aggregate:d.optional(),source:b.optional(),derivedField:U.optional()}).passthrough(),me=e.z.object({code:e.z.string(),message:e.z.string().optional(),invalidField:e.z.string().optional(),fieldRole:e.z.enum(["measure","date","dimension","input","source","sql"]).optional(),validMeasureCandidates:e.z.array(e.z.string()).optional(),validDateCandidates:e.z.array(e.z.string()).optional(),validDimensionCandidates:e.z.array(e.z.string()).optional(),recommendedNextStep:e.z.string()}).passthrough(),C=e.z.object({code:e.z.string(),message:e.z.string(),path:e.z.string().optional(),fieldRole:e.z.enum(["measure","date","dimension","input","source","sql"]).optional(),repairHint:me.optional()}).passthrough(),G=e.z.object({ok:e.z.boolean(),errors:e.z.array(C),warnings:e.z.array(C),repairHints:e.z.array(me)}).passthrough(),wt=e.z.object({page:e.z.number(),pageSize:e.z.number(),pageCount:e.z.number(),totalCount:e.z.number(),hasNextPage:e.z.boolean(),hasPrevPage:e.z.boolean()}).passthrough(),k={intentId:e.z.string().optional(),queryPath:e.z.enum(["query_spec","sql","sql_python"]),warnings:e.z.array(e.z.string()).optional(),rowCount:e.z.number().optional(),rowLimitExceeded:e.z.boolean().optional(),limit:e.z.number().optional(),pagination:wt.optional()},ge=e.z.object({...k,kind:e.z.literal("metric"),value:R,measures:e.z.record(R).optional(),comparison:e.z.object({kind:e.z.enum(["previous_period","previous_year","target"]),value:R.optional(),delta:e.z.union([e.z.number(),e.z.null()]).optional(),deltaPercent:e.z.union([e.z.number(),e.z.null()]).optional()}).passthrough().optional(),records:x.optional()}).passthrough(),he=e.z.object({...k,kind:e.z.literal("records"),columns:e.z.array(j),records:x,totals:e.z.object({mode:e.z.literal("server"),scope:e.z.literal("filtered_result"),row:e.z.record(e.z.string(),e.z.unknown()),columns:e.z.array(j).optional()}).passthrough().optional()}).passthrough(),fe=e.z.object({...k,kind:e.z.literal("inputOptions"),options:e.z.array(w({label:e.z.string(),value:e.z.unknown(),count:e.z.number().optional(),disambiguation:e.z.array(e.z.string()).optional()},["value"]))}).passthrough(),ze=e.z.object({...k,kind:e.z.literal("sql"),columns:e.z.array(j),records:x,sqlShape:e.z.object({statementType:e.z.string().optional(),explicitLimit:e.z.number().optional(),hasPythonCode:e.z.boolean().optional()}).passthrough().optional()}).passthrough(),kt=e.z.object({enabled:e.z.boolean().optional(),position:e.z.enum(["before","after"]).optional(),label:e.z.string().optional()}).passthrough(),te=e.z.object({id:e.z.enum(["rows","columns"]),levels:e.z.array(e.z.object({instanceId:e.z.string(),fieldKey:e.z.string(),label:e.z.string(),field:z,grain:le.optional(),subtotal:kt.optional()}).passthrough()),nodeIds:e.z.array(e.z.string())}).passthrough(),y=w({instanceId:e.z.string(),fieldKey:e.z.string(),value:e.z.unknown(),label:e.z.string()},["value"]),At=e.z.union([e.z.object({kind:e.z.literal("label")}).passthrough(),e.z.object({kind:e.z.literal("field"),field:z,aggregate:d.optional()}).passthrough(),e.z.object({kind:e.z.literal("value"),valueId:e.z.string(),rowPath:e.z.array(y).optional(),columnPath:e.z.array(y).optional()}).passthrough()]),It=e.z.enum(["present","presentNull","missing","densified"]),Rt=e.z.enum(["value","rowSubtotal","columnSubtotal","subtotalIntersection","rowGrandTotal","columnGrandTotal","matrixGrandTotal"]),_t=e.z.object({instanceId:e.z.string(),fieldKey:e.z.string(),field:z,role:e.z.enum(["row","column","measure","sort","filter"]),label:e.z.string().optional()}).passthrough(),jt=e.z.union([e.z.object({kind:e.z.literal("additive"),aggregate:d.optional()}).passthrough(),e.z.object({kind:e.z.literal("semiAdditive"),aggregate:d.optional(),grain:le.optional()}).passthrough(),e.z.object({kind:e.z.literal("nonAdditive"),aggregate:d.optional()}).passthrough(),e.z.object({kind:e.z.literal("ratio"),numeratorMeasureInstanceId:e.z.string().optional(),denominatorMeasureInstanceId:e.z.string().optional()}).passthrough(),e.z.object({kind:e.z.literal("custom"),expressionId:e.z.string().optional()}).passthrough()]),Ct=e.z.object({instanceId:e.z.string(),fieldKey:e.z.string(),label:e.z.string(),field:z,aggregate:d.optional(),format:de.optional(),totalBehavior:ft.optional(),semantics:jt}).passthrough(),qt=e.z.object({id:e.z.string(),measureId:e.z.string(),aggregate:d.optional(),label:e.z.string().optional(),source:e.z.enum(["measureDefault","rowSubtotal","columnSubtotal","subtotalIntersection","rowGrandTotal","columnGrandTotal","matrixGrandTotal","custom"]),scope:e.z.object({rowLevelId:e.z.string().optional(),columnLevelId:e.z.string().optional(),rowNodeId:e.z.string().optional(),columnNodeId:e.z.string().optional()}).passthrough().optional()}).passthrough(),xt=e.z.object({kind:e.z.string(),label:e.z.string().optional(),payload:e.z.record(e.z.string(),e.z.unknown()).optional()}).passthrough(),Et=w({id:e.z.string(),axis:e.z.enum(["row","column"]),path:e.z.array(y),level:e.z.number(),label:e.z.string(),value:e.z.unknown(),parentId:e.z.string().optional(),hasChildren:e.z.boolean(),isExpanded:e.z.boolean().optional(),isSubtotal:e.z.boolean().optional(),isGrandTotal:e.z.boolean().optional(),subtotalFunction:d.optional(),childCount:e.z.number().optional(),actions:e.z.array(xt).optional()},["value"]),Ft=e.z.object({rowHeaderLevels:e.z.array(e.z.object({id:e.z.string(),label:e.z.string(),fieldInstanceId:e.z.string()}).passthrough()),columnHeaderRows:e.z.array(e.z.object({id:e.z.string(),cells:e.z.array(e.z.object({id:e.z.string(),label:e.z.string(),role:e.z.enum(["rowHeader","columnHeader","measureHeader","subtotal","grandTotal"]),colSpan:e.z.number(),rowSpan:e.z.number(),columnPath:e.z.array(y),measureInstanceId:e.z.string().optional()}).passthrough())}).passthrough()),columns:e.z.array(e.z.object({id:e.z.string(),label:e.z.string(),columnNodeId:e.z.string().optional(),columnPath:e.z.array(y),measureInstanceId:e.z.string(),role:e.z.enum(["value","columnSubtotal","columnGrandTotal"])}).passthrough())}).passthrough(),Nt=w({rowId:e.z.string(),columnId:e.z.string().optional(),measureId:e.z.string(),value:e.z.unknown(),formattedValue:e.z.string().optional(),presence:It,role:Rt,calculationId:e.z.string().optional()},["value"]),Dt=e.z.object({rows:e.z.boolean().optional(),columns:e.z.boolean().optional(),grandTotal:e.z.union([e.z.boolean(),e.z.object({rows:e.z.boolean().optional(),columns:e.z.boolean().optional()}).passthrough()]).optional()}).passthrough(),Tt=w({id:e.z.string(),axis:e.z.enum(["row","column"]),targetInstanceId:e.z.string().optional(),direction:e.z.enum(["asc","desc"]),nulls:e.z.enum(["warehouseDefault","first","last"]).optional(),scope:e.z.enum(["global","withinParent"]).optional(),by:At},["by"]),Ot=e.z.object({rowOffset:e.z.number().optional(),rowLimit:e.z.number().optional(),columnOffset:e.z.number().optional(),columnLimit:e.z.number().optional(),hasMoreRows:e.z.boolean().optional(),hasMoreColumns:e.z.boolean().optional()}).passthrough(),Kt=e.z.object({axis:e.z.enum(["row","column"]),path:e.z.array(y),depth:e.z.number().optional()}).passthrough(),Mt=e.z.object({rowLazyLoading:e.z.boolean().optional(),columnLazyLoading:e.z.boolean().optional(),expandableRowNodeIds:e.z.array(e.z.string()).optional(),expandableColumnNodeIds:e.z.array(e.z.string()).optional(),nextRequests:e.z.array(Kt).optional()}).passthrough(),Pt=e.z.object({domains:e.z.record(e.z.object({min:e.z.number().optional(),max:e.z.number().optional()}).passthrough()).optional(),rules:e.z.array(e.z.record(e.z.string(),e.z.unknown())).optional()}).passthrough(),be=e.z.object({...k,kind:e.z.literal("matrix"),schemaVersion:e.z.literal(1),shape:e.z.enum(["hierarchical","pivot"]),capabilities:e.z.array(e.z.string()),executionMetadata:e.z.record(e.z.string(),e.z.unknown()),fieldsById:e.z.record(e.z.string(),_t),measuresById:e.z.record(e.z.string(),Ct),calculationsById:e.z.record(e.z.string(),qt).optional(),axes:e.z.object({rows:te,columns:te}).passthrough(),nodesById:e.z.record(e.z.string(),Et),layout:Ft,cells:e.z.array(Nt),totals:Dt,sort:e.z.array(Tt),formattingContext:Pt,pageInfo:Ot.optional(),expansion:Mt.optional()}).passthrough(),ye=e.z.union([ge,he,fe,ze,be]),Se=e.z.object({status:e.z.enum(["not_required","resolved","missing","ambiguous","fanout_risk","unknown"]),requiredSources:e.z.array(b).optional(),relationshipsUsed:e.z.array(e.z.string()).optional(),missingSources:e.z.array(e.z.string()).optional(),warnings:e.z.array(e.z.string()).optional(),message:e.z.string().optional(),recommendedNextStep:e.z.string().optional(),joinPlanSummary:e.z.object({baseSource:b.optional(),joinedSources:e.z.array(b).optional(),joinCount:e.z.number().optional()}).passthrough().optional(),fanoutRisk:e.z.object({status:e.z.enum(["none","warning","error","unknown"]),message:e.z.string().optional()}).passthrough().optional()}).passthrough(),oe=e.z.enum(["ambiguous_fields","empty_result","missing_grounded_fields","missing_relationship","no_grounded_query","partial_result","presentation_incomplete","query_validation_failed","unsafe_join"]),H=e.z.object({version:e.z.literal(1),status:e.z.enum(["answered","partial","blocked"]),summary:e.z.string(),answered:e.z.array(e.z.object({slotId:e.z.string().optional(),queryId:e.z.string().optional(),summary:e.z.string(),evidenceIds:e.z.array(e.z.string()).optional(),fieldsUsed:e.z.array(D).optional()}).passthrough()),blocked:e.z.array(e.z.object({slotId:e.z.string().optional(),queryId:e.z.string().optional(),reasonCode:oe,message:e.z.string(),missingFields:e.z.array(e.z.string()).optional(),availableFields:e.z.array(e.z.string()).optional(),ambiguousFields:e.z.array(e.z.string()).optional(),missingRelationships:e.z.array(e.z.string()).optional(),evidenceIds:e.z.array(e.z.string()).optional(),neededFromUser:e.z.array(e.z.string()).optional(),recommendedNextStep:e.z.string().optional()}).passthrough()),semanticModelRecommendations:e.z.array(e.z.object({reasonCode:oe,message:e.z.string(),recommendedNextStep:e.z.string().optional()}).passthrough()).optional()}).passthrough(),Q=e.z.object({scope:e.z.literal("filtered_query"),measures:e.z.record(R)}).passthrough(),Y=e.z.object({answeredObligations:e.z.array(e.z.string()),missingObligations:e.z.array(e.z.string()),warnings:e.z.array(C).optional()}).passthrough(),ve=e.z.object({intentId:e.z.string().optional(),queryId:e.z.string().optional(),status:e.z.enum(["answered","partial","failed"]),resultShape:e.z.enum(["metric","records","inputOptions","sql","matrix","period_change","analysis"]).optional(),intent:e.z.unknown().optional(),compiledQuery:e.z.unknown().optional(),fieldsUsed:e.z.array(D).optional(),result:ye.optional(),validation:G,coverage:Y.optional(),missingFields:e.z.array(e.z.string()).optional(),warnings:e.z.array(e.z.string()).optional(),relationshipDiagnostics:Se.optional(),diagnosticFeedback:H.optional(),population:Q.optional(),metadata:e.z.record(e.z.string(),e.z.unknown()).optional()}).passthrough();function Bt(i){switch(i){case"boolean":return e.z.boolean().optional();case"compactExecutionFieldArray":return e.z.array($t).optional();case"coverage":return Y.optional();case"diagnosticFeedback":return H.optional();case"executionFieldArray":return e.z.array(D).optional();case"executionResult":return ve.optional();case"number":return e.z.number().finite().optional();case"population":return Q.optional();case"record":return m.optional();case"recordArray":return x.optional();case"responseDetail":return e.z.enum(["compact","standard","debug"]).optional();case"string":return e.z.string().optional();case"stringArray":return e.z.array(e.z.string()).optional();case"unknown":return e.z.unknown().optional();case"unknownArray":return e.z.array(e.z.unknown()).optional();case"validationResult":return G.optional()}}const $e=Object.fromEntries(Object.entries(q).map(([i,o])=>[i,Bt(o)])),we=e.z.object($e).strict(),W=e.z.object({sourceKey:e.z.string().optional(),kind:e.z.enum(["semantic","physical","sql"]).optional(),domainId:e.z.string().optional(),datasetName:e.z.string().optional(),datasetId:e.z.string().optional(),connectionId:e.z.string().optional(),tableName:e.z.string().optional(),label:e.z.string().optional()}).passthrough(),f=e.z.object({name:e.z.string(),label:e.z.string().optional(),role:e.z.enum(["dimension","measure","date","id","unknown"]).optional(),dataType:e.z.enum(["string","number","boolean","date","datetime","unknown"]).optional(),aggregate:d.optional(),sourceKey:e.z.string().optional(),source:W.optional()}).passthrough(),ke=e.z.object({id:e.z.string().optional(),builder:e.z.literal("semaphor.inputOptions"),source:W.optional(),sourceKey:e.z.string().optional(),valueFieldRef:f,labelFieldRef:f,filterFieldRef:f.optional(),population:e.z.unknown().optional(),dependencies:e.z.unknown().optional(),limit:e.z.number().int().positive().optional(),spec:m.optional()}).passthrough(),Ae=e.z.object({appliesToViewIds:e.z.array(e.z.string()).optional(),viewId:e.z.string().optional(),fieldRef:f,relationshipHint:e.z.unknown().optional(),relationshipsUsed:e.z.array(m).optional()}).passthrough(),Vt=e.z.object({id:e.z.string(),label:e.z.string().optional(),type:e.z.string().optional(),serverSide:e.z.boolean().optional(),fieldRef:f.optional(),optionQuery:ke.optional(),bindings:e.z.array(Ae).optional(),appliesToViewIds:e.z.array(e.z.string()),relationshipHint:e.z.unknown().optional(),relationshipsUsed:e.z.array(m).optional()}).passthrough(),Lt=e.z.object({builder:e.z.enum(["semaphor.metric","semaphor.records","semaphor.matrix","semaphor.analysis","semaphor.sql"]),spec:m,fallbackReason:m.optional()}).passthrough(),Ut=e.z.object({id:e.z.string(),title:e.z.string().optional(),purpose:e.z.string().optional(),sourcePresentation:e.z.object({sourceKeys:e.z.array(e.z.string()).optional(),sourceLabels:e.z.array(e.z.string()).optional()}).passthrough().optional(),visual:e.z.string().optional(),visualSpec:m.optional(),queryKind:e.z.enum(["metric","records","matrix","analysis","sql_fallback"]).optional(),sdkBuilder:e.z.enum(["semaphor.metric","semaphor.records","semaphor.matrix","semaphor.analysis","semaphor.sql"]).optional(),sdkSpec:Lt.optional(),fields:e.z.array(f).optional(),computation:m.optional(),uxExpectations:e.z.array(e.z.string()).optional(),validation:m.optional()}).passthrough(),Gt=e.z.object({inputId:e.z.string(),label:e.z.string().optional(),type:e.z.string().optional(),serverSide:e.z.boolean().optional(),fieldRef:f.optional(),optionQuery:ke.optional(),bindings:e.z.array(Ae),appliesToViewIds:e.z.array(e.z.string()),notAppliedToViewIds:e.z.array(e.z.string())}).passthrough(),Ht=e.z.object({schemaVersion:e.z.literal(_),title:e.z.string(),purpose:e.z.string().optional(),userGoal:e.z.string().optional(),nextStep:e.z.string().optional(),sources:e.z.array(W),inputs:e.z.array(Vt),views:e.z.array(Ut),filterContracts:e.z.array(Gt),implementationChecklist:e.z.object({schemaVersion:e.z.string().optional(),requiredDevtools:e.z.object({mountRootDevtools:e.z.boolean(),providerDebugBridge:e.z.string().optional(),panelPosition:e.z.string().optional(),forbidden:e.z.array(e.z.string()).optional()}).passthrough(),requiredInputOptions:e.z.array(m),filterScopeByInput:e.z.array(m),bindingsByView:e.z.record(e.z.string(),e.z.array(m)),validationCommands:e.z.array(e.z.string()),browserSmokeChecks:e.z.array(e.z.string())}).passthrough(),nextRequiredTool:e.z.object({name:e.z.string(),reason:e.z.string().optional()}).optional(),unsupportedInsights:e.z.array(e.z.object({title:e.z.string(),requestedQuestion:e.z.string(),reason:e.z.string(),suggestedModelingFix:e.z.string()}).passthrough()).optional(),assumptions:e.z.array(e.z.string()).optional(),validation:m.optional()}).passthrough().superRefine((i,o)=>{const t=B(i);for(const s of t.issues)o.addIssue({code:e.z.ZodIssueCode.custom,message:s})}),Qt=new Set(Object.keys(q));function Yt(){return Object.keys(q)}function Ie(i){return Qt.has(i)}function Wt(i){if(!i||typeof i!="object"||Array.isArray(i))throw new Error("Semaphor analyze result must be an object.");const t=Object.keys(i).filter(s=>!Ie(s));if(t.length)throw new Error(`Semaphor analyze result contains unsupported top-level field(s): ${t.join(", ")}.`);return we.parse(i)}exports.SEMAPHOR_ANALYZE_RESULT_FIELD_CONTRACT=q;exports.SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_SCHEMA_VERSION=_;exports.SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_VALIDATOR_VERSION=Re;exports.getSemaphorAnalyzeResultFieldNames=Yt;exports.isSemaphorAnalyzeResultFieldName=Ie;exports.isSemaphorDataAppCodegenSummary=Te;exports.parseSemaphorAnalyzeResult=Wt;exports.semaphorAnalyticsCoverageSchema=Y;exports.semaphorAnalyticsDiagnosticFeedbackSchema=H;exports.semaphorAnalyticsExecutionResultSchema=ve;exports.semaphorAnalyticsPopulationSchema=Q;exports.semaphorAnalyticsResultSchema=ye;exports.semaphorAnalyticsValidationIssueSchema=C;exports.semaphorAnalyticsValidationResultSchema=G;exports.semaphorAnalyzeResultSchema=we;exports.semaphorAnalyzeResultShape=$e;exports.semaphorDataAppCodegenSummarySchema=Ht;exports.semaphorDerivedFieldDefinitionSchema=U;exports.semaphorExecutionFieldRefSchema=D;exports.semaphorFieldRefSchema=z;exports.semaphorInputOptionsResultSchema=fe;exports.semaphorMatrixResultSchema=be;exports.semaphorMetricResultSchema=ge;exports.semaphorPhysicalSourceRefSchema=ce;exports.semaphorRecordsResultSchema=he;exports.semaphorRelationshipDiagnosticsSchema=Se;exports.semaphorResultColumnSchema=j;exports.semaphorSemanticSourceRefSchema=L;exports.semaphorSourceRefSchema=b;exports.semaphorSqlResultSchema=ze;exports.semaphorSqlSourceRefSchema=pe;exports.validateSemaphorDataAppCodegenSummary=B;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as r, jsxs as s, Fragment as X } from "react/jsx-runtime";
|
|
2
2
|
import ee, { useState as h, useCallback as F, useEffect as ae, useMemo as H } from "react";
|
|
3
|
-
import { u as re, b as te, c as se, d as ne, e as le, f as oe, R as W, g as O, C as ie, h as ce, i as de, j as ue, k as me, l as _, m as R, n as fe, o as he, p as N } from "./index-
|
|
4
|
-
import { c as S, L as G, P as pe, a as ge, B as j, b as ve, d as V, e as be } from "./switch-
|
|
3
|
+
import { u as re, b as te, c as se, d as ne, e as le, f as oe, R as W, g as O, C as ie, h as ce, i as de, j as ue, k as me, l as _, m as R, n as fe, o as he, p as N } from "./index-kFwHL6im.js";
|
|
4
|
+
import { c as S, L as G, P as pe, a as ge, B as j, b as ve, d as V, e as be } from "./switch-CXMExaSF.js";
|
|
5
5
|
import "./x-CXDkqdur.js";
|
|
6
|
-
import "./analyze-result-contract-
|
|
6
|
+
import "./analyze-result-contract-BUgK3759.js";
|
|
7
7
|
function we(n = {}) {
|
|
8
8
|
var C, A, E, L;
|
|
9
9
|
const { authToken: c, tokenProps: e } = re(), p = n.enabled ?? !0, d = (c == null ? void 0 : c.accessToken) ?? null, u = (e == null ? void 0 : e.apiServiceUrl) ?? null, [I, k] = h(!1), [y, b] = h(!1), [m, g] = h(!1), [T, o] = h(null), [v, w] = h(null), P = v || {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),l=require("react"),t=require("./index-
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),l=require("react"),t=require("./index-BG9NaVLs.js"),o=require("./switch-oim6Xl36.js");require("./x-B6ghREd2.js");require("./analyze-result-contract-S8u7CcPL.js");function G(n={}){var y,P,z,A;const{authToken:d,tokenProps:a}=t.useSemaphorContext(),x=n.enabled??!0,m=(d==null?void 0:d.accessToken)??null,f=(a==null?void 0:a.apiServiceUrl)??null,[L,C]=l.useState(!1),[j,b]=l.useState(!1),[h,g]=l.useState(!1),[N,c]=l.useState(null),[v,S]=l.useState(null),k=v||{tz:((P=(y=a==null?void 0:a.params)==null?void 0:y.calendarContext)==null?void 0:P.tz)||null,weekStart:((A=(z=a==null?void 0:a.params)==null?void 0:z.calendarContext)==null?void 0:A.weekStart)??null},p=l.useCallback(async()=>{if(!(!x||!m||!f)){C(!0),c(null);try{const i=await fetch(`${f}/v1/user-preferences/calendar`,{method:"GET",headers:{Authorization:`Bearer ${m}`}});if(!i.ok){const u=await i.json().catch(()=>({}));throw new Error(u.error||"Failed to fetch preferences")}const r=await i.json();S({tz:r.tz,weekStart:r.weekStart,source:r.source,isInherited:r.isInherited,userHasPrefs:r.userHasPrefs,inherited:r.inherited})}catch(i){const r=i instanceof Error?i.message:"Unknown error";c(r)}finally{C(!1)}}},[m,f,x]);l.useEffect(()=>{x&&p()},[x,p]);const T=l.useCallback(async i=>{if(!m||!f)return c("Not authenticated"),!1;b(!0),c(null);try{const r=await fetch(`${f}/v1/user-preferences/calendar`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${m}`},body:JSON.stringify(i)});if(!r.ok){const u=await r.json().catch(()=>({}));throw new Error(u.error||"Failed to update preferences")}return await p(),!0}catch(r){const u=r instanceof Error?r.message:"Unknown error";return c(u),!1}finally{b(!1)}},[m,f,p]),w=l.useCallback(async()=>{if(!m||!f)return c("Not authenticated"),!1;g(!0),c(null);try{const i=await fetch(`${f}/v1/user-preferences/calendar`,{method:"DELETE",headers:{Authorization:`Bearer ${m}`}});if(!i.ok){const u=await i.json().catch(()=>({}));throw new Error(u.error||"Failed to clear preferences")}const r=await i.text();if(r)try{const u=JSON.parse(r);return S({tz:u.tz,weekStart:u.weekStart,source:u.source,isInherited:u.isInherited??!0,userHasPrefs:!1,inherited:u.inherited}),!0}catch{}return await p(),!0}catch(i){const r=i instanceof Error?i.message:"Unknown error";return c(r),!1}finally{g(!1)}},[m,f,p]);return{preferences:k,isLoading:L,isSaving:j,isClearing:h,error:N,updatePreferences:T,clearPreferences:w,refetch:p}}const E=[{value:"America/New_York",label:"Eastern Time (US & Canada)"},{value:"America/Chicago",label:"Central Time (US & Canada)"},{value:"America/Denver",label:"Mountain Time (US & Canada)"},{value:"America/Los_Angeles",label:"Pacific Time (US & Canada)"},{value:"America/Phoenix",label:"Arizona"},{value:"America/Anchorage",label:"Alaska"},{value:"Pacific/Honolulu",label:"Hawaii"},{value:"Europe/London",label:"London"},{value:"Europe/Paris",label:"Paris, Berlin, Rome"},{value:"Asia/Tokyo",label:"Tokyo"},{value:"Asia/Shanghai",label:"Beijing, Shanghai"},{value:"Asia/Kolkata",label:"Mumbai, New Delhi"},{value:"Australia/Sydney",label:"Sydney"},{value:"UTC",label:"UTC"}],M=[{value:0,label:"Sunday"},{value:1,label:"Monday"},{value:6,label:"Saturday"}],H="text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground";function W(){try{const n=Intl;if(n.supportedValuesOf)return n.supportedValuesOf("timeZone")}catch{}return E.map(n=>n.value)}function _(n){switch(n){case"tenant":return"tenant";case"organization":return"organization";case"system":return"system";default:return"default"}}function O(n){const d=E.find(a=>a.value===n);return d?d.label:n}function q(n){const d=M.find(a=>a.value===n);return d?d.label:String(n)}function V({open:n,onOpenChange:d}){var D,U,F;const{preferences:a,isLoading:x,isSaving:m,isClearing:f,updatePreferences:L,clearPreferences:C}=G({enabled:n}),j=a.tz||((D=a.inherited)==null?void 0:D.tz)||Intl.DateTimeFormat().resolvedOptions().timeZone,b=a.weekStart??((U=a.inherited)==null?void 0:U.weekStart)??1,[h,g]=l.useState(!a.userHasPrefs),[N,c]=l.useState(!1),[v,S]=l.useState(j),[k,p]=l.useState(b),[T,w]=l.useState(!1),y=l.useMemo(()=>W(),[]),P=l.useMemo(()=>y.filter(s=>!E.some(R=>R.value===s)),[y]),z=l.useMemo(()=>O(v),[v]),A=a.inherited?O(a.inherited.tz):"UTC",i=a.inherited?q(a.inherited.weekStart):"Monday",r=_((F=a.inherited)==null?void 0:F.source);l.useEffect(()=>{if(!n){c(!1);return}N||(a.userHasPrefs!==void 0&&g(!a.userHasPrefs),S(j),p(b))},[n,N,a.userHasPrefs,j,b]);const u=async()=>{if(x){t.ue.error("Preferences are still loading. Please try again.");return}h?await C()?(t.ue.success("Now using default settings. Please refresh the page to apply changes.",{duration:5e3}),d(!1)):t.ue.error("Failed to save preferences. Please try again."):await L({tz:v,weekStart:k})?(t.ue.success("Preferences saved. Please refresh the page to apply changes.",{duration:5e3}),d(!1)):t.ue.error("Failed to save preferences. Please try again.")},$=()=>{d(!1)},I=m||f,B=I||x;return e.jsx(t.Dialog,{open:n,onOpenChange:d,children:e.jsxs(t.DialogContent,{className:"rounded-control border-border/60 sm:max-w-[440px] sm:rounded-control",children:[e.jsxs(t.DialogHeader,{children:[e.jsx(t.DialogTitle,{className:"text-[15px]",children:"Calendar preferences"}),e.jsx(t.DialogDescription,{className:"text-[13px] leading-5",children:"Set your timezone and week-start for date calculations and displays."})]}),e.jsxs("div",{className:"space-y-4 py-1",children:[e.jsxs(t.RadioGroup,{value:h?"defaults":"custom",onValueChange:s=>{c(!0),g(s==="defaults")},className:"space-y-0.5",children:[e.jsxs("label",{htmlFor:"mode-defaults",className:o.cn("flex cursor-pointer items-start gap-2 rounded-control px-2 py-1.5 hover:bg-muted/50",h&&"bg-muted/50"),onClick:()=>{c(!0),g(!0)},children:[e.jsx(t.RadioGroupItem,{value:"defaults",id:"mode-defaults",className:"mt-0.5"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("p",{className:"text-[13px] font-medium text-foreground",children:["Use ",r," defaults"]}),e.jsxs("p",{className:"text-[12px] text-muted-foreground",children:[A,", week starts ",i]})]})]}),e.jsxs("label",{htmlFor:"mode-custom",className:o.cn("flex cursor-pointer items-start gap-2 rounded-control px-2 py-1.5 hover:bg-muted/50",!h&&"bg-muted/50"),onClick:()=>{c(!0),g(!1)},children:[e.jsx(t.RadioGroupItem,{value:"custom",id:"mode-custom",className:"mt-0.5"}),e.jsx("p",{className:"flex-1 text-[13px] font-medium text-foreground",children:"Use custom settings"})]})]}),e.jsxs("div",{className:o.cn("space-y-4 border-t border-border/60 pt-4 transition-opacity",h&&"pointer-events-none opacity-50"),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(o.Label,{className:H,children:"Timezone"}),e.jsxs(o.Popover,{open:T,onOpenChange:w,modal:!0,children:[e.jsx(o.PopoverTrigger,{asChild:!0,children:e.jsxs(o.Button,{variant:"outline",size:"xs",role:"combobox","aria-expanded":T,className:"w-full justify-between text-[12px] font-normal",disabled:h,children:[e.jsx("span",{className:"truncate",children:z}),e.jsx(t.ChevronsUpDown,{className:"ml-2 h-3.5 w-3.5 shrink-0 opacity-50"})]})}),e.jsx(o.PopoverContent,{className:"z-50 w-[--radix-popover-trigger-width] p-0",align:"start",children:e.jsxs(t.Command,{className:"overflow-visible",children:[e.jsx(t.CommandInput,{placeholder:"Search timezones…"}),e.jsxs(t.CommandList,{children:[e.jsx(t.CommandEmpty,{children:"No timezone found."}),e.jsx(t.CommandGroup,{heading:"Common",children:E.map(s=>e.jsxs(t.CommandItem,{value:`${s.value} ${s.label}`,onSelect:()=>{c(!0),S(s.value),w(!1)},children:[e.jsx(o.Check,{className:o.cn("h-3.5 w-3.5",v===s.value?"opacity-100":"opacity-0")}),e.jsx("span",{className:"flex-1",children:s.label}),e.jsx("span",{className:"text-[11px] text-muted-foreground",children:s.value})]},s.value))}),e.jsx(t.CommandSeparator,{}),e.jsx(t.CommandGroup,{heading:"All timezones",children:P.map(s=>e.jsxs(t.CommandItem,{value:s,onSelect:()=>{c(!0),S(s),w(!1)},children:[e.jsx(o.Check,{className:o.cn("h-3.5 w-3.5",v===s?"opacity-100":"opacity-0")}),s]},s))})]})]})})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(o.Label,{className:H,children:"Week starts on"}),e.jsx(t.RadioGroup,{value:String(k),onValueChange:s=>{c(!0),p(Number(s))},className:"flex gap-4",disabled:h,children:M.map(s=>e.jsxs("label",{htmlFor:`week-start-${s.value}`,className:o.cn("flex cursor-pointer items-center gap-2 text-[13px]",h&&"cursor-not-allowed"),children:[e.jsx(t.RadioGroupItem,{value:String(s.value),id:`week-start-${s.value}`,disabled:h}),s.label]},s.value))})]})]})]}),e.jsxs(t.DialogFooter,{children:[e.jsx(o.Button,{variant:"outline",size:"xs",onClick:$,disabled:I,children:"Cancel"}),e.jsx(o.Button,{size:"xs",onClick:u,disabled:B,children:I?e.jsxs(e.Fragment,{children:[e.jsx(o.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Saving…"]}):"Save"})]})]})})}exports.CalendarPreferencesDialog=V;
|