react-semaphor 0.1.467 → 0.1.469

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 (70) hide show
  1. package/dist/analytics-protocol/index.cjs +1 -1
  2. package/dist/analytics-protocol/index.js +158 -285
  3. package/dist/brand-studio/index.cjs +1 -1
  4. package/dist/brand-studio/index.js +4 -4
  5. package/dist/briefings/index.js +4 -4
  6. package/dist/chunks/{analyze-result-contract-CMZDRRwo.js → analyze-result-contract-kaCNxjA7.js} +1 -1
  7. package/dist/chunks/{common-types-Co766x6t.js → common-types-BgI-ymBp.js} +30 -23
  8. package/dist/chunks/common-types-tRK8fhXV.cjs +1 -0
  9. package/dist/chunks/{dashboard-briefing-launcher-FbEIrobt.cjs → dashboard-briefing-launcher-BqxcYhO2.cjs} +1 -1
  10. package/dist/chunks/{dashboard-briefing-launcher-Ctu63_Di.js → dashboard-briefing-launcher-kKSBCRLE.js} +9 -9
  11. package/dist/chunks/{dashboard-controls-DeDCphnd.js → dashboard-controls-DP2rftVR.js} +9 -9
  12. package/dist/chunks/{dashboard-controls-BKm3JIEo.cjs → dashboard-controls-Z8ow3GV6.cjs} +1 -1
  13. package/dist/chunks/{dashboard-filter-value-compatibility-B8ynE_O1.js → dashboard-filter-value-compatibility-Ce7jUVh-.js} +8 -8
  14. package/dist/chunks/{dashboard-filter-value-compatibility-Bnl2lsng.cjs → dashboard-filter-value-compatibility-iCPBcrRS.cjs} +1 -1
  15. package/dist/chunks/{dashboard-input-contract-Px64VWBL.js → dashboard-input-contract-Ciboc347.js} +6 -6
  16. package/dist/chunks/{dashboard-json-BygDylH8.js → dashboard-json-3qT123Xa.js} +7 -7
  17. package/dist/chunks/{dashboard-json-BV6wbV2p.cjs → dashboard-json-CPq7IMvR.cjs} +1 -1
  18. package/dist/chunks/edit-dashboard-visual-7eUCTZnx.cjs +172 -0
  19. package/dist/chunks/{edit-dashboard-visual-CYOtYa4w.js → edit-dashboard-visual-Clz6LQOX.js} +7164 -7298
  20. package/dist/chunks/{editor-action-buttons-Baks5RYd.js → editor-action-buttons-CFbMRQSE.js} +6 -6
  21. package/dist/chunks/{editor-action-buttons-CRRjegRd.cjs → editor-action-buttons-WJFWflfs.cjs} +1 -1
  22. package/dist/chunks/{index-B31RKKGb.js → index-8Cm77joZ.js} +29054 -28935
  23. package/dist/chunks/{index-yJRh4x9j.cjs → index-DKaQRhKm.cjs} +179 -167
  24. package/dist/chunks/{index-BlCnNcaB.js → index-DO4BESNy.js} +9 -9
  25. package/dist/chunks/matrix-result-contract-ClC6Pd_g.js +822 -0
  26. package/dist/chunks/matrix-result-contract-DF-qt0jx.cjs +1 -0
  27. package/dist/chunks/{pivot-header-presentation-CSf6CyOt.js → pivot-header-presentation-OpY8xzdT.js} +2 -2
  28. package/dist/chunks/{pivot-result-identity-BvT51Nog.js → pivot-result-identity-CCMpd8ZA.js} +1 -1
  29. package/dist/chunks/{pivot-result-lifecycle--NNNPUtG.js → pivot-result-lifecycle-B38AZx4a.js} +19 -19
  30. package/dist/chunks/{raw-temporal-contract-BqVMduCs.js → raw-temporal-contract-r_EMdR85.js} +1 -1
  31. package/dist/chunks/{report-preferences-dialog-CRNoMzNj.cjs → report-preferences-dialog-C5UOCTwt.cjs} +1 -1
  32. package/dist/chunks/{report-preferences-dialog-CZPqG-em.js → report-preferences-dialog-D-NDYRrk.js} +6 -6
  33. package/dist/chunks/{report-runtime-context-CrTzKt0C.js → report-runtime-context-CcXUjpb-.js} +7 -7
  34. package/dist/chunks/{saved-temporal-bucket-format-DfqnCGCz.js → saved-temporal-bucket-format-hylaofsQ.js} +29 -29
  35. package/dist/chunks/{switch-B6rFVSdw.js → switch-BagpmPNw.js} +24 -9
  36. package/dist/chunks/{switch-BghC7eOM.cjs → switch-DyE2_OmQ.cjs} +2 -2
  37. package/dist/chunks/{temporal-bucket-DFYIkexB.js → temporal-bucket-Cc9fmx8s.js} +12 -12
  38. package/dist/chunks/{temporal-bucket-authoring-ZxFzhTmL.js → temporal-bucket-authoring-DjPFtRSF.js} +3 -3
  39. package/dist/chunks/{temporal-bucket-contract-COPPwwbi.js → temporal-bucket-contract-DT4kU0VY.js} +1 -1
  40. package/dist/chunks/{token-types-p1M3SA2G.js → token-types-Z889rD6g.js} +1 -1
  41. package/dist/chunks/{update-policy-BKOA5S76.js → update-policy-Bu5Tw43R.js} +1 -1
  42. package/dist/chunks/{validators-CCpBY1e0.js → validators-DhTaCK1O.js} +50 -50
  43. package/dist/dashboard/index.cjs +1 -1
  44. package/dist/dashboard/index.js +2 -2
  45. package/dist/dashboard-authoring/index.cjs +1 -1
  46. package/dist/dashboard-authoring/index.js +4 -4
  47. package/dist/data-app-builder/index.cjs +1 -1
  48. package/dist/data-app-builder/index.js +2 -2
  49. package/dist/data-app-codegen/index.js +2 -2
  50. package/dist/data-app-codegen-node/index.js +3 -3
  51. package/dist/data-app-sdk/index.js +3 -3
  52. package/dist/data-app-sdk-adapters/index.js +2 -2
  53. package/dist/data-app-sdk-validation/index.js +9 -9
  54. package/dist/format-utils/index.js +10 -10
  55. package/dist/index.cjs +1 -1
  56. package/dist/index.js +117 -115
  57. package/dist/report-runtime-context/index.js +2 -2
  58. package/dist/style.css +1 -1
  59. package/dist/surfboard/index.cjs +1 -1
  60. package/dist/surfboard/index.js +3 -3
  61. package/dist/types/analytics-protocol.d.ts +74 -0
  62. package/dist/types/index.cjs +1 -1
  63. package/dist/types/index.js +18 -16
  64. package/dist/types/main.d.ts +10 -0
  65. package/dist/types/types.d.ts +9 -0
  66. package/package.json +1 -1
  67. package/dist/chunks/common-types-o3LJcrpg.cjs +0 -1
  68. package/dist/chunks/edit-dashboard-visual-DWN052a9.cjs +0 -172
  69. package/dist/chunks/matrix-result-contract-DQ9_UadF.js +0 -421
  70. package/dist/chunks/matrix-result-contract-DiHDIyQk.cjs +0 -1
@@ -1,7 +1,7 @@
1
1
  var j = Object.defineProperty;
2
2
  var Y = (e, r, t) => r in e ? j(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
3
3
  var T = (e, r, t) => Y(e, typeof r != "symbol" ? r + "" : r, t);
4
- import { h as L, an as O, am as R, al as U } from "./validators-CCpBY1e0.js";
4
+ import { g as L, an as O, am as R, al as U } from "./validators-DhTaCK1O.js";
5
5
  import { canonicalizeSupportedLocale as I } from "../value-format-preferences/index.js";
6
6
  const q = "higher_is_better", fe = {
7
7
  displayMode: "difference",
@@ -26,7 +26,7 @@ function pe(e) {
26
26
  };
27
27
  }
28
28
  }
29
- function be(e) {
29
+ function ge(e) {
30
30
  if (e.alias) return e.alias;
31
31
  const r = e.entityName && e.entityName !== "SEMAPHOR_CALCULATED_FIELD" ? e.entityName : void 0, t = r && r !== e.name ? `${r}_` : "";
32
32
  if (e.role !== "metric") return `${t}${e.name}`;
@@ -117,7 +117,7 @@ function P(e, r = "comparison") {
117
117
  warnings: []
118
118
  };
119
119
  }
120
- function ge(e, r = "comparison") {
120
+ function be(e, r = "comparison") {
121
121
  if (!d(e))
122
122
  return {
123
123
  ok: !1,
@@ -376,7 +376,7 @@ function we(e) {
376
376
  sentiment: H(c, o)
377
377
  };
378
378
  }
379
- function g(e) {
379
+ function b(e) {
380
380
  if (e === null || typeof e != "object" || Array.isArray(e))
381
381
  return !1;
382
382
  const r = Object.getPrototypeOf(e);
@@ -489,7 +489,7 @@ function re(e, r) {
489
489
  );
490
490
  }
491
491
  function te(e) {
492
- if (!g(e))
492
+ if (!b(e))
493
493
  return {
494
494
  ok: !1,
495
495
  issues: [{ path: "$", message: "Resolved temporal bucket format must be an object." }]
@@ -499,7 +499,7 @@ function te(e) {
499
499
  t.has(s) || r.push({ path: s, message: `Unknown property "${s}".` });
500
500
  e.type !== "temporal_bucket" && r.push({ path: "type", message: "Expected temporal_bucket." });
501
501
  const o = e.presentation;
502
- if (!g(o))
502
+ if (!b(o))
503
503
  r.push({ path: "presentation", message: "Expected a presentation object." });
504
504
  else {
505
505
  const s = o.mode, l = s === "preset" ? /* @__PURE__ */ new Set(["mode", "preset"]) : s === "pattern" ? /* @__PURE__ */ new Set(["mode", "pattern"]) : s === "auto" ? /* @__PURE__ */ new Set(["mode", "styles"]) : /* @__PURE__ */ new Set(["mode"]);
@@ -522,7 +522,7 @@ function te(e) {
522
522
  }
523
523
  else if (s === "auto") {
524
524
  const c = o.styles;
525
- (!g(c) || !["short", "medium", "long"].includes(String(c.dateStyle)) || !g(c.dateTime) || !["short", "medium", "long"].includes(
525
+ (!b(c) || !["short", "medium", "long"].includes(String(c.dateStyle)) || !b(c.dateTime) || !["short", "medium", "long"].includes(
526
526
  String(c.dateTime.dateStyle)
527
527
  ) || !["short", "medium", "long"].includes(
528
528
  String(c.dateTime.timeStyle)
@@ -538,7 +538,7 @@ function te(e) {
538
538
  r.push({ path: "presentation.mode", message: "Expected auto, preset, or pattern." });
539
539
  }
540
540
  const n = I(e.locale);
541
- if (n || r.push({ path: "locale", message: "Expected a supported base BCP 47 locale." }), r.length > 0 || !n || !g(o))
541
+ if (n || r.push({ path: "locale", message: "Expected a supported base BCP 47 locale." }), r.length > 0 || !n || !b(o))
542
542
  return { ok: !1, issues: r };
543
543
  if (o.mode === "auto") {
544
544
  const s = o.styles;
@@ -691,7 +691,7 @@ function ie(e, r, t) {
691
691
  if (l >= 0 && c >= 0 && u) {
692
692
  const f = Math.min(l, c), x = Math.max(l, c);
693
693
  let C = !1;
694
- return s.slice(f, x + 1).filter((b) => b.type === "day" ? (C = !0, !1) : C && b.type === "literal" ? (C = !1, !1) : !0).map((b) => b.type === "year" ? u : b.value).join("");
694
+ return s.slice(f, x + 1).filter((g) => g.type === "day" ? (C = !0, !1) : C && g.type === "literal" ? (C = !1, !1) : !0).map((g) => g.type === "year" ? u : g.value).join("");
695
695
  }
696
696
  }
697
697
  return y(r, {
@@ -792,8 +792,8 @@ export {
792
792
  fe as C,
793
793
  q as D,
794
794
  _ as T,
795
- be as a,
796
- ge as b,
795
+ ge as a,
796
+ be as b,
797
797
  V as c,
798
798
  ye as d,
799
799
  _e as e,
@@ -803,7 +803,7 @@ export {
803
803
  J as i,
804
804
  te as j,
805
805
  Ce as k,
806
- g as l,
806
+ b as l,
807
807
  re as p,
808
808
  pe as r,
809
809
  P as v
@@ -1,6 +1,6 @@
1
- import { al as O, am as N } from "./validators-CCpBY1e0.js";
2
- import "./analyze-result-contract-CMZDRRwo.js";
3
- import { f as R, C as j, h as x } from "./temporal-bucket-DFYIkexB.js";
1
+ import { al as O, am as N } from "./validators-DhTaCK1O.js";
2
+ import "./analyze-result-contract-kaCNxjA7.js";
3
+ import { f as R, C as j, h as x } from "./temporal-bucket-Cc9fmx8s.js";
4
4
  import { DEFAULT_RESOLVED_VALUE_FORMAT_PREFERENCES as B } from "../value-format-preferences/index.js";
5
5
  const M = /* @__PURE__ */ new Set([
6
6
  "previous_period",
@@ -1,4 +1,4 @@
1
- import { t as i, T as l, e as u } from "./validators-CCpBY1e0.js";
1
+ import { t as i, T as l, d as u } from "./validators-DhTaCK1O.js";
2
2
  function c(e) {
3
3
  const r = i.safeParse(e);
4
4
  return r.success ? { ok: !0, value: r.data } : {
@@ -1,5 +1,5 @@
1
1
  import "../value-format-preferences/index.js";
2
- import "./validators-CCpBY1e0.js";
2
+ import "./validators-DhTaCK1O.js";
3
3
  const A = {
4
4
  mode: "all"
5
5
  };
@@ -1,4 +1,4 @@
1
- import { S as W, a as X, v as Z } from "./validators-CCpBY1e0.js";
1
+ import { S as W, a as X, v as Z } from "./validators-DhTaCK1O.js";
2
2
  import { toSemaphorInputOptionsIntent as ee, toSemaphorAnalysisQueryOptions as te, toSemaphorAnalysisIntent as re, toSemaphorMetricIntent as ne, toSemaphorRecordsIntent as ae, toSemaphorMatrixIntent as se, toSemaphorSqlIntent as ie } from "../data-app-sdk-adapters/index.js";
3
3
  const Je = W, x = X, G = "semaphor-generated-data-app-contract/v1", T = "semaphor-generated-data-app-contract-manifest/v1";
4
4
  function P(e) {
@@ -5023,42 +5023,42 @@ function Qn(e) {
5023
5023
  return { ok: i.length === 0, errors: i, warnings: t };
5024
5024
  }
5025
5025
  export {
5026
- On as $,
5027
- Yn as A,
5028
- Qn as B,
5029
- $e as C,
5030
- ka as D,
5031
- Ia as E,
5032
- Se as F,
5033
- Ta as G,
5034
- pi as H,
5035
- mi as I,
5036
- De as J,
5037
- gi as K,
5038
- Vn as L,
5039
- Ln as M,
5040
- jt as N,
5041
- re as O,
5042
- Dt as P,
5043
- ai as Q,
5026
+ Pn as $,
5027
+ Qn as A,
5028
+ $e as B,
5029
+ ka as C,
5030
+ Ia as D,
5031
+ Se as E,
5032
+ Ta as F,
5033
+ pi as G,
5034
+ mi as H,
5035
+ De as I,
5036
+ gi as J,
5037
+ Vn as K,
5038
+ Ln as L,
5039
+ jt as M,
5040
+ re as N,
5041
+ Dt as O,
5042
+ ai as P,
5043
+ qt as Q,
5044
5044
  Tn as R,
5045
5045
  se as S,
5046
5046
  jn as T,
5047
- qt as U,
5048
- Ot as V,
5049
- D as W,
5050
- T as X,
5051
- ni as Y,
5052
- _e as Z,
5053
- q as _,
5047
+ Ot as U,
5048
+ D as V,
5049
+ T as W,
5050
+ ni as X,
5051
+ _e as Y,
5052
+ q as Z,
5053
+ On as _,
5054
5054
  Nn as a,
5055
- Pn as a0,
5056
- de as a1,
5057
- oi as a2,
5058
- Gt as a3,
5059
- zt as a4,
5060
- Yt as a5,
5061
- Qt as a6,
5055
+ de as a0,
5056
+ oi as a1,
5057
+ Gt as a2,
5058
+ zt as a3,
5059
+ Yt as a4,
5060
+ Qt as a5,
5061
+ fa as a6,
5062
5062
  ga as a7,
5063
5063
  ha as a8,
5064
5064
  ri as a9,
@@ -5080,27 +5080,27 @@ export {
5080
5080
  Un as ap,
5081
5081
  Ei as b,
5082
5082
  ye as c,
5083
- fa as d,
5084
- ji as e,
5085
- Ci as f,
5086
- Bn as g,
5087
- Gn as h,
5083
+ ji as d,
5084
+ Ci as e,
5085
+ Bn as f,
5086
+ Gn as g,
5087
+ Cn as h,
5088
5088
  qn as i,
5089
- Cn as j,
5090
- ne as k,
5091
- P as l,
5092
- Ri as m,
5093
- ge as n,
5094
- Mi as o,
5089
+ ne as j,
5090
+ P as k,
5091
+ Ri as l,
5092
+ ge as m,
5093
+ Mi as n,
5094
+ Ti as o,
5095
5095
  Dn as p,
5096
- Ti as q,
5097
- En as r,
5096
+ En as q,
5097
+ ce as r,
5098
5098
  Di as s,
5099
5099
  le as t,
5100
- ce as u,
5100
+ kn as u,
5101
5101
  Ye as v,
5102
- kn as w,
5103
- zn as x,
5104
- xi as y,
5105
- xn as z
5102
+ zn as w,
5103
+ xi as x,
5104
+ xn as y,
5105
+ Yn as z
5106
5106
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../chunks/index-yJRh4x9j.cjs"),e=require("../chunks/common-types-o3LJcrpg.cjs");exports.Dashboard=o.Dashboard;exports.CONTROL_CARD_DEFAULT_VALUE=e.CONTROL_CARD_DEFAULT_VALUE;exports.EMPTY_SELECTION=e.EMPTY_SELECTION;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../chunks/index-DKaQRhKm.cjs"),e=require("../chunks/common-types-tRK8fhXV.cjs");exports.Dashboard=o.Dashboard;exports.CONTROL_CARD_DEFAULT_VALUE=e.CONTROL_CARD_DEFAULT_VALUE;exports.EMPTY_SELECTION=e.EMPTY_SELECTION;
@@ -1,5 +1,5 @@
1
- import { D as o } from "../chunks/index-B31RKKGb.js";
2
- import { C as s, E as C } from "../chunks/common-types-Co766x6t.js";
1
+ import { D as o } from "../chunks/index-8Cm77joZ.js";
2
+ import { C as s, E as C } from "../chunks/common-types-BgI-ymBp.js";
3
3
  export {
4
4
  s as CONTROL_CARD_DEFAULT_VALUE,
5
5
  o as Dashboard,
@@ -1,3 +1,3 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("../chunks/contracts-CtB2VONT.cjs"),A=require("../chunks/temporal-bucket-authoring-C6sZAVqS.cjs"),w=require("../chunks/validators-DO-YuzgO.cjs");require("../chunks/analyze-result-contract-CMwVg9w2.cjs");require("../value-format-preferences/index.cjs");const Te=require("../chunks/operators-DrTQsJXv.cjs"),X=require("../chunks/canonical-result-keys-Cb96edol.cjs"),m=require("../chunks/dashboard-filter-value-compatibility-Bnl2lsng.cjs");function S(e){return e&&typeof e=="object"?e:null}function T(e){return typeof e=="string"?e:null}function de(e){var t,r,a;return!!(e&&typeof e=="object")&&(((t=S(e))==null?void 0:t.kind)==="semantic"||((r=S(e))==null?void 0:r.kind)==="physical"||((a=S(e))==null?void 0:a.kind)==="sql")}function M(e){return de(e)?e.kind==="semantic"?!!(e.domainId&&e.datasetName):e.kind==="physical"?!!(e.connectionId&&e.tableName):!1:!1}function Fe(e){return w.semaphorSourceIdentityKey(e)}function Y(e,t){return w.semaphorSourcesReferToSameDataset(e,t)}function ce(e,t){return w.preferSemaphorSourceMetadata(e,t)}function B(e){const t=[];for(const r of e){const a=t.findIndex(o=>Y(o,r));a===-1?t.push(r):t[a]=ce(t[a],r)}return t}function ke(e){return B(e)[0]}function K(e,t){return e.kind!=="semantic"||e.connectionId||(t==null?void 0:t.kind)!=="semantic"||!w.semaphorSourcesReferToSameDataset(e,t)||!t.connectionId?e:{...e,connectionId:t.connectionId}}function U(e){return M(e)?e:void 0}function oe(e,t){if(!(e.kind!=="semantic"||e.connectionId))return t.find(r=>(r==null?void 0:r.kind)==="semantic"&&w.semaphorSourcesReferToSameDataset(e,r)&&!!r.connectionId)}function v(e,t){const r=U(e==null?void 0:e.source);return r?K(r,t):void 0}function le({explicitSource:e,field:t,defaultSource:r,fallbackSources:a}){const o=[r,...a||[]],n=U(e),i=n?K(n,oe(n,o)):void 0;if(i)return i;if(e!==void 0)return;const d=v(t,r),s=d?K(d,oe(d,o)):void 0;if(s)return s;if((t==null?void 0:t.source)===void 0)return U(r)}function xe(e,t){if(!(e!=null&&e.name)||!(t!=null&&t.name)||e.name!==t.name)return!1;const r=v(e),a=v(t);return!r||!a?!0:Y(r,a)}function x(e){var t;return T((t=S(e))==null?void 0:t.kind)}function ue(e){var t,r;return x(e)!=="semantic"?null:((r=T((t=S(e))==null?void 0:t.domainId))==null?void 0:r.trim())||null}function Re(e){var t;return x(e)!=="semantic"?null:T((t=S(e))==null?void 0:t.datasetName)}function Me(e){var t;return x(e)!=="semantic"?null:T((t=S(e))==null?void 0:t.datasetId)}function Ne(e){var t;return x(e)!=="physical"?null:T((t=S(e))==null?void 0:t.connectionId)}function Oe(e){var t;return x(e)!=="physical"?null:T((t=S(e))==null?void 0:t.tableName)}function Be(e){var t;return x(e)!=="physical"?"":T((t=S(e))==null?void 0:t.databaseName)||""}function $e(e){var t;return x(e)!=="physical"?"":T((t=S(e))==null?void 0:t.schemaName)||""}function fe(e){if(e.analyticsIntent&&typeof e.analyticsIntent=="object"&&"source"in e.analyticsIntent)return e.analyticsIntent.source}function pe({datasets:e,requireAtLeastOne:t}){if(t&&e.length<1)return{ok:!1,issue:"invalid_dataset_count"};if(e.length<=1)return{ok:!0};const r=e.map(ue),a=new Set(r.filter(Boolean));return r.some(o=>!o)||a.size!==1?{ok:!1,issue:"invalid_multi_dataset_scope"}:{ok:!0}}function z(e,t){if(!t)return!1;if(t.kind==="semantic"){const r=Me(e);return ue(e)===t.domainId?r&&t.datasetId?r===t.datasetId:Re(e)===t.datasetName:!1}return t.kind==="physical"?Ne(e)===t.connectionId&&Oe(e)===t.tableName&&Be(e)===(t.databaseName||"")&&$e(e)===(t.schemaName||""):!1}function Pe(e,t){return e.find(r=>z(r,t))}function p(e,t,r){return r?{code:e,message:t,cardId:r}:{code:e,message:t}}function E(e){const t=new Set;for(const r of e){if(t.has(r))return r;t.add(r)}return null}function he({card:e,datasets:t,errors:r}){if(e.type==="text")return;const a=fe(e);if(!a){if(t.length<=1)return;r.push(p("missing_card_analytics_source","Multi-dataset dashboard cards must include analytics intent with a source so the materializer can choose the correct dataset.",e.id));return}t.some(o=>z(o,a))||r.push(p("invalid_card_analytics_source","Dashboard cards with an explicit analytics source must use one of the selected datasets.",e.id))}function q(e){return e.map(t=>t==null?void 0:t.source).filter(t=>!!t)}function L(e){return Array.isArray(e)?e.filter(t=>!!(t&&typeof t=="object")):[]}function se(e){return Array.isArray(e)?e.filter(t=>!!(t&&typeof t=="object")):[]}function Ee(e){var r,a;if(!e)return[];const t=[e.source];return e.kind==="metric"?t.push(...q([...L(e.measures),e.primaryMeasure,e.dateField,...L(e.dimensions),...se(e.filters).map(o=>o.field)])):e.kind==="records"?t.push(...q([...L(e.fields),e.dateField,(r=e.orderBy)==null?void 0:r.field,...se(e.filters).map(o=>o.field)])):e.kind==="inputOptions"?(((a=e.population)==null?void 0:a.kind)==="related_population"&&t.push(e.population.baseSource),t.push(...q([e.labelField,e.valueField,e.searchField,...e.disambiguationFields||[]]))):e.kind==="sql"&&t.push(...q(e.fields||[])),t}function me({card:e,datasets:t,errors:r}){if(e.type!=="text"){for(const a of Ee(e.analyticsIntent))if(a&&!t.some(o=>z(o,a))){r.push(p("invalid_card_query_source","Dashboard card query field references must use one of the selected datasets.",e.id));return}}}function be({card:e,errors:t}){if(e.type==="text"||!e.analyticsIntent)return;const r=w.validateSemaphorAnalyticsIntent(e.analyticsIntent);if(!r.ok)for(const a of r.errors)t.push(p(a.code,a.path?`${a.path}: ${a.message}`:a.message,e.id))}function ge({datasets:e,errors:t,requireAtLeastOne:r}){const a=pe({datasets:e,requireAtLeastOne:r});if(!a.ok){if(a.issue==="invalid_dataset_count"){t.push(p("invalid_dataset_count","Dashboard authoring requires at least one selected dataset."));return}t.push(p("invalid_multi_dataset_scope","Multi-dataset dashboard authoring is limited to semantic datasets from one domain."))}}function Ie({input:e,errors:t}){var r;(r=e.filter.sql)!=null&&r.trim()&&t.push(p("generated_filter_sql_out_of_scope",`Generated dashboard filter "${e.label}" must use grounded filter configuration; custom SQL is outside the dashboard-authoring contract.`))}function ye(e){var f,g;const t=[];if(!e||typeof e!="object")return{ok:!1,errors:[p("invalid_plan","Dashboard plan must be a structured object.")],warnings:[]};const r=e,a=[...r.warnings||[]];r.version!==1&&t.push(p("invalid_version","Dashboard plan version must be 1.")),(f=r.title)!=null&&f.trim()||t.push(p("missing_title","Dashboard plan needs a title."));const o=Array.isArray(r.datasets)?r.datasets:[],n=Array.isArray(r.sheets)?r.sheets:[];ge({datasets:o,errors:t,requireAtLeastOne:!0}),n.length!==1&&t.push(p("invalid_sheet_count","MVP dashboard authoring creates exactly one dashboard sheet."));const i=n[0];i&&i.kind!=="dashboard"&&t.push(p("invalid_sheet_kind",'Generated sheet must use kind "dashboard".'));const d=(i==null?void 0:i.cards)||[];d.length>k.DASHBOARD_AUTHORING_MAX_GENERATED_CARDS&&t.push(p("too_many_cards",`Generated dashboards can contain at most ${k.DASHBOARD_AUTHORING_MAX_GENERATED_CARDS} cards.`));const s=E(d.map(l=>l.id));s&&t.push(p("duplicate_card_id",`Duplicate generated card id: ${s}.`));const u=E(d.map(l=>l.frameId));u&&t.push(p("duplicate_frame_id",`Duplicate generated frame id: ${u}.`));for(const l of d)(g=l.title)!=null&&g.trim()||t.push(p("missing_card_title","Card title is required.",l.id)),l.type==="custom"&&t.push(p("custom_visual_out_of_scope","Whole-dashboard authoring supports built-in visual types only.",l.id)),l.type!=="text"&&!l.analyticsIntent&&a.push(p("missing_analytics_intent","Non-text card has no analytics intent and may be skipped by the app layer.",l.id)),he({card:l,datasets:o,errors:t}),be({card:l,errors:t}),me({card:l,datasets:o,errors:t});const h=Array.isArray(r.filterInputs)?r.filterInputs:[],y=h.map(l=>l.id),D=E(y);D&&t.push(p("duplicate_input_id",`Duplicate dashboard input id: ${D}.`));const C=h.map(l=>l.variableName).filter(Boolean)||[],_=E(C);_&&t.push(p("duplicate_input_variable",`Duplicate dashboard input variable name: ${_}.`));for(const l of h)Ie({input:l,errors:t});const c=Array.isArray(r.calculatedFields)?r.calculatedFields:[];for(const l of c)l.scope==="domain"&&l.reuseOnly!==!0&&t.push(p("domain_calculated_field_create_out_of_scope",`Creating domain calculated field "${l.name}" is outside MVP.`));return{ok:t.length===0,errors:t,warnings:a}}function _e(e){var i;const t=[];if(!e||typeof e!="object")return{ok:!1,errors:[p("invalid_change_plan","Dashboard change plan must be a structured object.")],warnings:[]};const r=e,a=[...r.warnings||[]];r.version!==1&&t.push(p("invalid_version","Dashboard change plan version must be 1.")),(i=r.dashboardId)!=null&&i.trim()||t.push(p("missing_dashboard_id","Dashboard change plan needs a dashboard id."));const o=Array.isArray(r.datasets)?r.datasets:[],n=Array.isArray(r.operations)?r.operations:[];ge({datasets:o,errors:t,requireAtLeastOne:!1});for(const d of n){if(d.kind==="unsupported"){a.push(p("unsupported_operation",d.reason||d.requestedAction));continue}d.kind==="addCard"&&d.card.type==="custom"&&t.push(p("custom_visual_out_of_scope","Whole-dashboard authoring supports built-in visual types only.",d.card.id)),d.kind==="addCard"&&(he({card:d.card,datasets:o,errors:t}),be({card:d.card,errors:t}),me({card:d.card,datasets:o,errors:t})),d.kind==="addFilterInput"&&Ie({input:d.input,errors:t}),d.kind==="addCalculatedField"&&d.field.scope==="domain"&&d.field.reuseOnly!==!0&&t.push(p("domain_calculated_field_create_out_of_scope",`Creating domain calculated field "${d.field.name}" is outside MVP.`))}return{ok:t.length===0,errors:t,warnings:a}}const qe={lg:48,md:36,sm:24,xs:12,xxs:6};function ze(e,t){let r=0,a=0,o=0;return e.map(n=>{const i=Math.min(n.w,t);r>0&&r+i>t&&(r=0,a+=o,o=0);const d={i:n.frameId,x:r,y:a,w:i,h:n.h,minW:Math.min(n.minW,t),minH:n.minH,static:!1};return r+=i,o=Math.max(o,n.h),d})}function He(e){const t=[...e].sort((s,u)=>s.priority-u.priority),r=t.filter(s=>s.role==="kpi"),a=t.filter(s=>s.role==="chart"),o=t.filter(s=>s.role==="table"),n=t.filter(s=>s.role==="text"),i=n.slice(0,1),d=n.slice(i.length);return{kpis:r,introText:i,charts:a,tables:o,supportingText:d}}function Ve(e,t,r){return t==="xxs"||t==="xs"?r:t==="sm"?Math.min(12,r):t==="md"?e<=1||e===2?18:12:e<=1||e===2?24:e===3?16:12}function Le(e,t,r,a){return r==="xxs"||r==="xs"||r==="sm"||r==="md"||t===1||t%2===1&&e===0?a:a/2}function je(e){const{item:t,band:r,index:a,bandCount:o,breakpoint:n,columns:i}=e;return r==="kpi"?{...t,band:r,w:Ve(o,n,i),h:15,minW:Math.min(6,i),minH:12}:r==="table"?{...t,band:r,w:i,h:n==="xxs"||n==="xs"?34:38,minW:Math.min(12,i),minH:18}:r==="introText"?{...t,band:r,w:i,h:n==="xxs"||n==="xs"?12:10,minW:Math.min(12,i),minH:8}:r==="supportingText"?{...t,band:r,w:n==="lg"?i/2:i,h:n==="xxs"||n==="xs"?12:10,minW:Math.min(12,i),minH:8}:{...t,band:r,w:Le(a,o,n,i),h:n==="xxs"||n==="xs"?28:30,minW:Math.min(12,i),minH:16}}function N(e,t,r,a){return e.map((o,n)=>je({item:o,band:t,index:n,bandCount:e.length,breakpoint:r,columns:a}))}function H(e){const t=He(e);return Object.fromEntries(k.DASHBOARD_AUTHORING_BREAKPOINTS.map(r=>{const a=qe[r],o=[...N(t.introText,"introText",r,a),...N(t.kpis,"kpi",r,a),...N(t.charts,"chart",r,a),...N(t.tables,"table",r,a),...N(t.supportingText,"supportingText",r,a)];return[r,ze(o,a)]}))}function Ge(e){const t=w.normalizeAnalyticsCatalogDataType(e);return t==="datetime"?"date":t==="unknown"?"string":t}function Ke(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function Ue(e){return Ke(e)&&typeof e.filterId=="string"&&typeof e.operation=="string"&&Array.isArray(e.values)}function We(e){return e.filter(t=>typeof t=="string"||typeof t=="number")}function Xe(e){return e.filter(t=>t instanceof Date||typeof t=="string")}function Q(e,t){if(t===void 0)return;const r=Ge(e.dataType),a=e.operation||"in";if(Ue(t))return{...t,filterId:e.id,name:t.name||e.column,valueType:r,dataType:e.dataType,fieldMeta:e.fieldMeta,semanticContext:e.semanticContext};if(a==="is null"||a==="is not null")return{filterId:e.id,name:e.column,operation:a,valueType:r,values:[],dataType:e.dataType,fieldMeta:e.fieldMeta,semanticContext:e.semanticContext};const o=Array.isArray(t)?t:[t],n=r==="date"?Xe(o):We(o);if(n.length!==0&&!((a==="between"||a==="not between")&&n.length<2))return{filterId:e.id,name:e.column,operation:a,valueType:r,values:n,dataType:e.dataType,fieldMeta:e.fieldMeta,semanticContext:e.semanticContext}}function Se(e,t,r){return r?{code:e,message:t,cardId:r}:{code:e,message:t}}function Ye(e,t,r){const a=(t||[]).filter(o=>o.scope==="card"&&o.targetCardId===r).map(o=>o.field).filter(Boolean);return a.length===0?e:{...e,calculatedFields:[...e.calculatedFields||[],...a]}}function W(e,t){return Array.from(new Set((e||[]).map(r=>t.get(r)).filter(r=>!!r)))}function Qe(e,t){if((e==null?void 0:e.kind)!=="cards")return e;const r=W(e.cardIds,t);return r.length>0?{...e,cardIds:r}:null}function Je(e,t){return!e.applyToCardIds&&!e.excludeCardIds?e:{...e,...e.applyToCardIds?{applyToCardIds:W(e.applyToCardIds,t)}:{},...e.excludeCardIds?{excludeCardIds:W(e.excludeCardIds,t)}:{}}}function Ze(e,t){const r={},a=[];return{inputs:(e.filterInputs||[]).flatMap((n,i)=>{const d=Qe(n.scope,t);if(d===null)return a.push(Se("filter_input_scope_empty",`Filter input "${n.label}" was skipped because all scoped cards were skipped during query validation.`)),[];const s=Q(n.filter,n.defaultValue);return s&&(r.shared??(r.shared={}),r.shared[n.id]={status:"set",value:{kind:"filter",filterValue:s}}),[{id:n.id,kind:"filter",label:n.label,variableName:n.variableName,scope:d||{kind:"allSheets",sheetKinds:["dashboard"]},runtimeScope:"shared",presentation:{placement:"toolbar",order:i},exports:["label","value","start","end","range"],filter:Je(n.filter,t)}]}),warnings:a,defaultInputValues:r.shared&&Object.keys(r.shared).length>0?r:void 0}}function et(e){var C,_;const t=ye(e.plan);if(!t.ok)throw new Error(t.errors.map(c=>c.message).join(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("../chunks/contracts-CtB2VONT.cjs"),A=require("../chunks/temporal-bucket-authoring-C6sZAVqS.cjs"),w=require("../chunks/validators-DO-YuzgO.cjs");require("../chunks/analyze-result-contract-CMwVg9w2.cjs");require("../value-format-preferences/index.cjs");const Te=require("../chunks/operators-DrTQsJXv.cjs"),X=require("../chunks/canonical-result-keys-Cb96edol.cjs"),m=require("../chunks/dashboard-filter-value-compatibility-iCPBcrRS.cjs");function S(e){return e&&typeof e=="object"?e:null}function T(e){return typeof e=="string"?e:null}function de(e){var t,r,a;return!!(e&&typeof e=="object")&&(((t=S(e))==null?void 0:t.kind)==="semantic"||((r=S(e))==null?void 0:r.kind)==="physical"||((a=S(e))==null?void 0:a.kind)==="sql")}function M(e){return de(e)?e.kind==="semantic"?!!(e.domainId&&e.datasetName):e.kind==="physical"?!!(e.connectionId&&e.tableName):!1:!1}function Fe(e){return w.semaphorSourceIdentityKey(e)}function Y(e,t){return w.semaphorSourcesReferToSameDataset(e,t)}function ce(e,t){return w.preferSemaphorSourceMetadata(e,t)}function B(e){const t=[];for(const r of e){const a=t.findIndex(o=>Y(o,r));a===-1?t.push(r):t[a]=ce(t[a],r)}return t}function ke(e){return B(e)[0]}function K(e,t){return e.kind!=="semantic"||e.connectionId||(t==null?void 0:t.kind)!=="semantic"||!w.semaphorSourcesReferToSameDataset(e,t)||!t.connectionId?e:{...e,connectionId:t.connectionId}}function U(e){return M(e)?e:void 0}function oe(e,t){if(!(e.kind!=="semantic"||e.connectionId))return t.find(r=>(r==null?void 0:r.kind)==="semantic"&&w.semaphorSourcesReferToSameDataset(e,r)&&!!r.connectionId)}function v(e,t){const r=U(e==null?void 0:e.source);return r?K(r,t):void 0}function le({explicitSource:e,field:t,defaultSource:r,fallbackSources:a}){const o=[r,...a||[]],n=U(e),i=n?K(n,oe(n,o)):void 0;if(i)return i;if(e!==void 0)return;const d=v(t,r),s=d?K(d,oe(d,o)):void 0;if(s)return s;if((t==null?void 0:t.source)===void 0)return U(r)}function xe(e,t){if(!(e!=null&&e.name)||!(t!=null&&t.name)||e.name!==t.name)return!1;const r=v(e),a=v(t);return!r||!a?!0:Y(r,a)}function x(e){var t;return T((t=S(e))==null?void 0:t.kind)}function ue(e){var t,r;return x(e)!=="semantic"?null:((r=T((t=S(e))==null?void 0:t.domainId))==null?void 0:r.trim())||null}function Re(e){var t;return x(e)!=="semantic"?null:T((t=S(e))==null?void 0:t.datasetName)}function Me(e){var t;return x(e)!=="semantic"?null:T((t=S(e))==null?void 0:t.datasetId)}function Ne(e){var t;return x(e)!=="physical"?null:T((t=S(e))==null?void 0:t.connectionId)}function Oe(e){var t;return x(e)!=="physical"?null:T((t=S(e))==null?void 0:t.tableName)}function Be(e){var t;return x(e)!=="physical"?"":T((t=S(e))==null?void 0:t.databaseName)||""}function $e(e){var t;return x(e)!=="physical"?"":T((t=S(e))==null?void 0:t.schemaName)||""}function fe(e){if(e.analyticsIntent&&typeof e.analyticsIntent=="object"&&"source"in e.analyticsIntent)return e.analyticsIntent.source}function pe({datasets:e,requireAtLeastOne:t}){if(t&&e.length<1)return{ok:!1,issue:"invalid_dataset_count"};if(e.length<=1)return{ok:!0};const r=e.map(ue),a=new Set(r.filter(Boolean));return r.some(o=>!o)||a.size!==1?{ok:!1,issue:"invalid_multi_dataset_scope"}:{ok:!0}}function z(e,t){if(!t)return!1;if(t.kind==="semantic"){const r=Me(e);return ue(e)===t.domainId?r&&t.datasetId?r===t.datasetId:Re(e)===t.datasetName:!1}return t.kind==="physical"?Ne(e)===t.connectionId&&Oe(e)===t.tableName&&Be(e)===(t.databaseName||"")&&$e(e)===(t.schemaName||""):!1}function Pe(e,t){return e.find(r=>z(r,t))}function p(e,t,r){return r?{code:e,message:t,cardId:r}:{code:e,message:t}}function E(e){const t=new Set;for(const r of e){if(t.has(r))return r;t.add(r)}return null}function he({card:e,datasets:t,errors:r}){if(e.type==="text")return;const a=fe(e);if(!a){if(t.length<=1)return;r.push(p("missing_card_analytics_source","Multi-dataset dashboard cards must include analytics intent with a source so the materializer can choose the correct dataset.",e.id));return}t.some(o=>z(o,a))||r.push(p("invalid_card_analytics_source","Dashboard cards with an explicit analytics source must use one of the selected datasets.",e.id))}function q(e){return e.map(t=>t==null?void 0:t.source).filter(t=>!!t)}function L(e){return Array.isArray(e)?e.filter(t=>!!(t&&typeof t=="object")):[]}function se(e){return Array.isArray(e)?e.filter(t=>!!(t&&typeof t=="object")):[]}function Ee(e){var r,a;if(!e)return[];const t=[e.source];return e.kind==="metric"?t.push(...q([...L(e.measures),e.primaryMeasure,e.dateField,...L(e.dimensions),...se(e.filters).map(o=>o.field)])):e.kind==="records"?t.push(...q([...L(e.fields),e.dateField,(r=e.orderBy)==null?void 0:r.field,...se(e.filters).map(o=>o.field)])):e.kind==="inputOptions"?(((a=e.population)==null?void 0:a.kind)==="related_population"&&t.push(e.population.baseSource),t.push(...q([e.labelField,e.valueField,e.searchField,...e.disambiguationFields||[]]))):e.kind==="sql"&&t.push(...q(e.fields||[])),t}function me({card:e,datasets:t,errors:r}){if(e.type!=="text"){for(const a of Ee(e.analyticsIntent))if(a&&!t.some(o=>z(o,a))){r.push(p("invalid_card_query_source","Dashboard card query field references must use one of the selected datasets.",e.id));return}}}function be({card:e,errors:t}){if(e.type==="text"||!e.analyticsIntent)return;const r=w.validateSemaphorAnalyticsIntent(e.analyticsIntent);if(!r.ok)for(const a of r.errors)t.push(p(a.code,a.path?`${a.path}: ${a.message}`:a.message,e.id))}function ge({datasets:e,errors:t,requireAtLeastOne:r}){const a=pe({datasets:e,requireAtLeastOne:r});if(!a.ok){if(a.issue==="invalid_dataset_count"){t.push(p("invalid_dataset_count","Dashboard authoring requires at least one selected dataset."));return}t.push(p("invalid_multi_dataset_scope","Multi-dataset dashboard authoring is limited to semantic datasets from one domain."))}}function Ie({input:e,errors:t}){var r;(r=e.filter.sql)!=null&&r.trim()&&t.push(p("generated_filter_sql_out_of_scope",`Generated dashboard filter "${e.label}" must use grounded filter configuration; custom SQL is outside the dashboard-authoring contract.`))}function ye(e){var f,g;const t=[];if(!e||typeof e!="object")return{ok:!1,errors:[p("invalid_plan","Dashboard plan must be a structured object.")],warnings:[]};const r=e,a=[...r.warnings||[]];r.version!==1&&t.push(p("invalid_version","Dashboard plan version must be 1.")),(f=r.title)!=null&&f.trim()||t.push(p("missing_title","Dashboard plan needs a title."));const o=Array.isArray(r.datasets)?r.datasets:[],n=Array.isArray(r.sheets)?r.sheets:[];ge({datasets:o,errors:t,requireAtLeastOne:!0}),n.length!==1&&t.push(p("invalid_sheet_count","MVP dashboard authoring creates exactly one dashboard sheet."));const i=n[0];i&&i.kind!=="dashboard"&&t.push(p("invalid_sheet_kind",'Generated sheet must use kind "dashboard".'));const d=(i==null?void 0:i.cards)||[];d.length>k.DASHBOARD_AUTHORING_MAX_GENERATED_CARDS&&t.push(p("too_many_cards",`Generated dashboards can contain at most ${k.DASHBOARD_AUTHORING_MAX_GENERATED_CARDS} cards.`));const s=E(d.map(l=>l.id));s&&t.push(p("duplicate_card_id",`Duplicate generated card id: ${s}.`));const u=E(d.map(l=>l.frameId));u&&t.push(p("duplicate_frame_id",`Duplicate generated frame id: ${u}.`));for(const l of d)(g=l.title)!=null&&g.trim()||t.push(p("missing_card_title","Card title is required.",l.id)),l.type==="custom"&&t.push(p("custom_visual_out_of_scope","Whole-dashboard authoring supports built-in visual types only.",l.id)),l.type!=="text"&&!l.analyticsIntent&&a.push(p("missing_analytics_intent","Non-text card has no analytics intent and may be skipped by the app layer.",l.id)),he({card:l,datasets:o,errors:t}),be({card:l,errors:t}),me({card:l,datasets:o,errors:t});const h=Array.isArray(r.filterInputs)?r.filterInputs:[],y=h.map(l=>l.id),D=E(y);D&&t.push(p("duplicate_input_id",`Duplicate dashboard input id: ${D}.`));const C=h.map(l=>l.variableName).filter(Boolean)||[],_=E(C);_&&t.push(p("duplicate_input_variable",`Duplicate dashboard input variable name: ${_}.`));for(const l of h)Ie({input:l,errors:t});const c=Array.isArray(r.calculatedFields)?r.calculatedFields:[];for(const l of c)l.scope==="domain"&&l.reuseOnly!==!0&&t.push(p("domain_calculated_field_create_out_of_scope",`Creating domain calculated field "${l.name}" is outside MVP.`));return{ok:t.length===0,errors:t,warnings:a}}function _e(e){var i;const t=[];if(!e||typeof e!="object")return{ok:!1,errors:[p("invalid_change_plan","Dashboard change plan must be a structured object.")],warnings:[]};const r=e,a=[...r.warnings||[]];r.version!==1&&t.push(p("invalid_version","Dashboard change plan version must be 1.")),(i=r.dashboardId)!=null&&i.trim()||t.push(p("missing_dashboard_id","Dashboard change plan needs a dashboard id."));const o=Array.isArray(r.datasets)?r.datasets:[],n=Array.isArray(r.operations)?r.operations:[];ge({datasets:o,errors:t,requireAtLeastOne:!1});for(const d of n){if(d.kind==="unsupported"){a.push(p("unsupported_operation",d.reason||d.requestedAction));continue}d.kind==="addCard"&&d.card.type==="custom"&&t.push(p("custom_visual_out_of_scope","Whole-dashboard authoring supports built-in visual types only.",d.card.id)),d.kind==="addCard"&&(he({card:d.card,datasets:o,errors:t}),be({card:d.card,errors:t}),me({card:d.card,datasets:o,errors:t})),d.kind==="addFilterInput"&&Ie({input:d.input,errors:t}),d.kind==="addCalculatedField"&&d.field.scope==="domain"&&d.field.reuseOnly!==!0&&t.push(p("domain_calculated_field_create_out_of_scope",`Creating domain calculated field "${d.field.name}" is outside MVP.`))}return{ok:t.length===0,errors:t,warnings:a}}const qe={lg:48,md:36,sm:24,xs:12,xxs:6};function ze(e,t){let r=0,a=0,o=0;return e.map(n=>{const i=Math.min(n.w,t);r>0&&r+i>t&&(r=0,a+=o,o=0);const d={i:n.frameId,x:r,y:a,w:i,h:n.h,minW:Math.min(n.minW,t),minH:n.minH,static:!1};return r+=i,o=Math.max(o,n.h),d})}function He(e){const t=[...e].sort((s,u)=>s.priority-u.priority),r=t.filter(s=>s.role==="kpi"),a=t.filter(s=>s.role==="chart"),o=t.filter(s=>s.role==="table"),n=t.filter(s=>s.role==="text"),i=n.slice(0,1),d=n.slice(i.length);return{kpis:r,introText:i,charts:a,tables:o,supportingText:d}}function Ve(e,t,r){return t==="xxs"||t==="xs"?r:t==="sm"?Math.min(12,r):t==="md"?e<=1||e===2?18:12:e<=1||e===2?24:e===3?16:12}function Le(e,t,r,a){return r==="xxs"||r==="xs"||r==="sm"||r==="md"||t===1||t%2===1&&e===0?a:a/2}function je(e){const{item:t,band:r,index:a,bandCount:o,breakpoint:n,columns:i}=e;return r==="kpi"?{...t,band:r,w:Ve(o,n,i),h:15,minW:Math.min(6,i),minH:12}:r==="table"?{...t,band:r,w:i,h:n==="xxs"||n==="xs"?34:38,minW:Math.min(12,i),minH:18}:r==="introText"?{...t,band:r,w:i,h:n==="xxs"||n==="xs"?12:10,minW:Math.min(12,i),minH:8}:r==="supportingText"?{...t,band:r,w:n==="lg"?i/2:i,h:n==="xxs"||n==="xs"?12:10,minW:Math.min(12,i),minH:8}:{...t,band:r,w:Le(a,o,n,i),h:n==="xxs"||n==="xs"?28:30,minW:Math.min(12,i),minH:16}}function N(e,t,r,a){return e.map((o,n)=>je({item:o,band:t,index:n,bandCount:e.length,breakpoint:r,columns:a}))}function H(e){const t=He(e);return Object.fromEntries(k.DASHBOARD_AUTHORING_BREAKPOINTS.map(r=>{const a=qe[r],o=[...N(t.introText,"introText",r,a),...N(t.kpis,"kpi",r,a),...N(t.charts,"chart",r,a),...N(t.tables,"table",r,a),...N(t.supportingText,"supportingText",r,a)];return[r,ze(o,a)]}))}function Ge(e){const t=w.normalizeAnalyticsCatalogDataType(e);return t==="datetime"?"date":t==="unknown"?"string":t}function Ke(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function Ue(e){return Ke(e)&&typeof e.filterId=="string"&&typeof e.operation=="string"&&Array.isArray(e.values)}function We(e){return e.filter(t=>typeof t=="string"||typeof t=="number")}function Xe(e){return e.filter(t=>t instanceof Date||typeof t=="string")}function Q(e,t){if(t===void 0)return;const r=Ge(e.dataType),a=e.operation||"in";if(Ue(t))return{...t,filterId:e.id,name:t.name||e.column,valueType:r,dataType:e.dataType,fieldMeta:e.fieldMeta,semanticContext:e.semanticContext};if(a==="is null"||a==="is not null")return{filterId:e.id,name:e.column,operation:a,valueType:r,values:[],dataType:e.dataType,fieldMeta:e.fieldMeta,semanticContext:e.semanticContext};const o=Array.isArray(t)?t:[t],n=r==="date"?Xe(o):We(o);if(n.length!==0&&!((a==="between"||a==="not between")&&n.length<2))return{filterId:e.id,name:e.column,operation:a,valueType:r,values:n,dataType:e.dataType,fieldMeta:e.fieldMeta,semanticContext:e.semanticContext}}function Se(e,t,r){return r?{code:e,message:t,cardId:r}:{code:e,message:t}}function Ye(e,t,r){const a=(t||[]).filter(o=>o.scope==="card"&&o.targetCardId===r).map(o=>o.field).filter(Boolean);return a.length===0?e:{...e,calculatedFields:[...e.calculatedFields||[],...a]}}function W(e,t){return Array.from(new Set((e||[]).map(r=>t.get(r)).filter(r=>!!r)))}function Qe(e,t){if((e==null?void 0:e.kind)!=="cards")return e;const r=W(e.cardIds,t);return r.length>0?{...e,cardIds:r}:null}function Je(e,t){return!e.applyToCardIds&&!e.excludeCardIds?e:{...e,...e.applyToCardIds?{applyToCardIds:W(e.applyToCardIds,t)}:{},...e.excludeCardIds?{excludeCardIds:W(e.excludeCardIds,t)}:{}}}function Ze(e,t){const r={},a=[];return{inputs:(e.filterInputs||[]).flatMap((n,i)=>{const d=Qe(n.scope,t);if(d===null)return a.push(Se("filter_input_scope_empty",`Filter input "${n.label}" was skipped because all scoped cards were skipped during query validation.`)),[];const s=Q(n.filter,n.defaultValue);return s&&(r.shared??(r.shared={}),r.shared[n.id]={status:"set",value:{kind:"filter",filterValue:s}}),[{id:n.id,kind:"filter",label:n.label,variableName:n.variableName,scope:d||{kind:"allSheets",sheetKinds:["dashboard"]},runtimeScope:"shared",presentation:{placement:"toolbar",order:i},exports:["label","value","start","end","range"],filter:Je(n.filter,t)}]}),warnings:a,defaultInputValues:r.shared&&Object.keys(r.shared).length>0?r:void 0}}function et(e){var C,_;const t=ye(e.plan);if(!t.ok)throw new Error(t.errors.map(c=>c.message).join(`
2
2
  `)||"Dashboard plan is invalid.");const r=e.plan.sheets[0],a=[...t.warnings],o=[],n=new Map(e.cardArtifacts.map(c=>[c.planCardId,c])),i=new Map(e.cardArtifacts.map(c=>[c.planCardId,c.card.id])),d=[];for(const c of r.cards){const f=n.get(c.id);if(!f){const l=Se("missing_card_artifact",`Card "${c.title}" was skipped because no generated artifact was supplied.`,c.id);o.push(l);continue}a.push(...f.warnings||[]);const g=Ye(f.card,e.plan.calculatedFields,c.id);d.push({id:c.frameId,cards:[g],activeCardId:g.id})}if(d.length===0)throw new Error("Dashboard plan did not produce any persistable cards.");const{inputs:s,defaultInputValues:u,warnings:h}=Ze(e.plan,i);a.push(...h);const y=H(r.cards.filter(c=>d.some(f=>f.id===c.frameId)).map(c=>({frameId:c.frameId,priority:c.priority,role:c.role})));return{dashboard:{id:e.dashboardId,title:e.plan.title,description:e.plan.description||"",sheets:[{id:r.id,kind:"dashboard",title:r.title,description:r.description,frames:d,layouts:y,calculatedFields:(C=e.plan.calculatedFields)==null?void 0:C.filter(c=>c.scope==="sheet"&&c.field).map(c=>c.field)}],calculatedFields:(_=e.plan.calculatedFields)==null?void 0:_.filter(c=>c.scope==="dashboard"&&c.field).map(c=>c.field),inputs:s,...u?{defaultInputValues:u}:{}},warnings:a,skippedOperations:o}}function R(e,t,r){return r?{code:e,message:t,cardId:r}:{code:e,message:t}}function tt(e){return JSON.parse(JSON.stringify(e))}function rt(e){var t;return(t=e.sheets)==null?void 0:t.find(r=>(r.kind||"dashboard")==="dashboard")}function j(e,t){var r;for(const a of e.sheets||[])for(const o of a.frames||[]){const n=(r=o.cards)==null?void 0:r.find(i=>i.id===t);if(n)return{sheet:a,frame:o,card:n}}return null}function Ae(e){var r,a;const t=(a=(r=e.cards)==null?void 0:r[0])==null?void 0:a.type;return t==="kpi"?"kpi":t==="table"||t==="detailTable"||t==="pivotTable"?"table":t==="text"?"text":"chart"}function at(e){var t;return new Map((((t=e.layouts)==null?void 0:t.lg)||[]).map((r,a)=>[r.i,a]))}function De(e,t=new Map){const r=at(e),a=Math.max(r.size,t.size),o=(e.frames||[]).map((n,i)=>({frameId:n.id,role:Ae(n),priority:t.get(n.id)??r.get(n.id)??a+i}));e.layouts=H(o)}function nt(e){return Object.values(e.layouts||{}).some(t=>t.length>0)}function it(e,t){if(!nt(e)){De(e);return}const r=H([{frameId:t.id,role:Ae(t),priority:0}]);e.layouts??(e.layouts={});for(const[a,o]of Object.entries(r)){const n=e.layouts[a]||[];if(n.some(s=>s.i===t.id))continue;const i=o[0];if(!i)continue;const d=n.reduce((s,u)=>Math.max(s,u.y+u.h),0);e.layouts[a]=[...n,{...i,y:d}]}}function ot(e,t){var a;const r=Q(t.filter,t.defaultValue);r&&(e.defaultInputValues??(e.defaultInputValues={}),(a=e.defaultInputValues).shared??(a.shared={}),e.defaultInputValues.shared[t.id]={status:"set",value:{kind:"filter",filterValue:r}})}function st(e){var d;const t=_e(e.changePlan);if(!t.ok)throw new Error(t.errors.map(s=>s.message).join(`
3
3
  `)||"Dashboard change plan is invalid.");const r=tt(e.dashboard),a=[...t.warnings],o=[],n=new Map(e.cardArtifacts.map(s=>[s.planCardId,s])),i=rt(r);if(!i)throw new Error("Dashboard has no editable dashboard sheet.");i.frames??(i.frames=[]);for(const s of e.changePlan.operations)switch(s.kind){case"addCard":{if((i.frames||[]).reduce((D,C)=>{var _;return D+(((_=C.cards)==null?void 0:_.length)||0)},0)>=k.DASHBOARD_AUTHORING_MAX_GENERATED_CARDS){o.push(R("generated_card_limit_reached",`AI refinement is capped at ${k.DASHBOARD_AUTHORING_MAX_GENERATED_CARDS} cards.`,s.card.id));break}const h=n.get(s.card.id);if(!h){o.push(R("missing_card_artifact",`Card "${s.card.title}" was skipped because no generated artifact was supplied.`,s.card.id));break}const y={id:s.card.frameId,cards:[h.card],activeCardId:h.card.id};i.frames.push(y),it(i,y);break}case"addFilterInput":{r.inputs??(r.inputs=[]);const u={id:s.input.id,kind:"filter",label:s.input.label,variableName:s.input.variableName,scope:s.input.scope||{kind:"allSheets",sheetKinds:["dashboard"]},runtimeScope:"shared",presentation:{placement:"toolbar",order:r.inputs.length},exports:["label","value","start","end","range"],filter:s.input.filter};r.inputs.push(u),ot(r,s.input);break}case"addCalculatedField":{if(s.field.scope==="dashboard"&&s.field.field)r.calculatedFields??(r.calculatedFields=[]),r.calculatedFields.push(s.field.field);else if(s.field.scope==="sheet"&&s.field.field)i.calculatedFields??(i.calculatedFields=[]),i.calculatedFields.push(s.field.field);else if(s.field.scope==="card"&&s.field.field){const u=s.field.targetCardId?j(r,s.field.targetCardId):null;u?((d=u.card).calculatedFields??(d.calculatedFields=[]),u.card.calculatedFields.push(s.field.field)):o.push(R("missing_calculated_field_target",`Calculated field "${s.field.name}" needs a valid target card.`))}break}case"renameCard":{const u=j(r,s.cardId);if(!u){o.push(R("card_not_found",`Card "${s.cardId}" could not be renamed because it was not found.`,s.cardId));break}u.card.title=s.title,s.description!==void 0&&(u.card.description=s.description);break}case"reorderCards":{const u=new Map;for(let h=0;h<s.cardIds.length;h+=1){const y=s.cardIds[h],D=j(r,y);D&&u.set(D.frame.id,h)}De(i,u);break}case"reuseCalculatedField":a.push(R("reused_calculated_field",`Calculated field "${s.fieldId}" is reused by reference.`));break;case"unsupported":o.push(R("unsupported_operation",s.reason||s.requestedAction));break}return{dashboard:r,warnings:a,skippedOperations:o}}function I(e,t,r){return r?{code:e,message:t,cardId:r}:{code:e,message:t}}function O(e,t){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||t}function Ce(e,t){if(!t.has(e))return t.add(e),e;let r=2,a=`${e}-${r}`;for(;t.has(a);)r+=1,a=`${e}-${r}`;return t.add(a),a}function $(e){return!!(e&&typeof e=="object")}function ve(e){return Array.isArray(e.inputs)?e.inputs.filter(t=>$(t)&&typeof t.id=="string"):[]}function J(e){return Array.isArray(e.sections)?e.sections.filter(t=>$(t)):[]}function Z(e){return Array.isArray(e.views)?e.views.filter(t=>$(t)):[]}function F(e){if(!Array.isArray(e))return[];const t=[];for(const r of e){const a=v(r);a&&t.push(a)}return t}function dt(e){var a,o,n;if(!e)return[];const t=[];if(M(e.source)&&t.push(e.source),e.kind==="metric"){t.push(...F(e.measures));const i=v(e.dateField);i&&t.push(i),t.push(...F(e.dimensions)),t.push(...F((a=e.filters)==null?void 0:a.map(d=>d.field)))}else if(e.kind==="records"){const i=v(e.dateField);i&&t.push(i),t.push(...F(e.fields)),t.push(...F((o=e.filters)==null?void 0:o.map(d=>d.field)))}else e.kind==="inputOptions"?(((n=e.population)==null?void 0:n.kind)==="related_population"&&M(e.population.baseSource)&&t.push(e.population.baseSource),t.push(...F([e.labelField,e.valueField,e.searchField,...e.disambiguationFields||[]].filter(i=>!!i)))):e.kind==="sql"&&t.push(...F(e.fields));const r="inputs"in e&&Array.isArray(e.inputs)?e.inputs:[];for(const i of r){const d=v(i.field);d&&t.push(d)}return t}function ct(e){const t=[];for(const r of ve(e)){const a=v(r.field);a&&t.push(a)}for(const r of J(e))for(const a of Z(r))t.push(...dt(a.analytics));return t}function lt(e){var r;const t=[];for(const a of J(e))for(const o of Z(a))M((r=o.analytics)==null?void 0:r.source)&&t.push(o.analytics.source);return t}function ut(e,t){const r=B(e).filter(M);if(r.length===0)return t.push(I("missing_materializable_dataset","No semantic or physical source could be converted into the current dashboard authoring dataset reference.")),[];const a=r.every(n=>n.kind==="semantic"),o=Array.from(new Set(r.filter(n=>n.kind==="semantic").map(n=>n.domainId)));return r.length>1&&(!a||o.length!==1)?(t.push(I("multiple_datasets_out_of_scope","The dashboard authoring compiler supports multiple datasets only within one semantic domain; using the first source and deferring the rest.")),[r[0]]):r}function ft(e,t){const r=J(e),a=ve(e),o=B(ct(e)),n=B(lt(e));return{sections:r,inputs:a,sources:o,primarySources:n,defaultSource:n.length===1?n[0]:void 0,datasets:ut(o,t)}}function pt(e){return e&&w.validateSemaphorAnalyticsIntent(e).ok?e:void 0}function ht(e){var t;switch((t=e.presentation)==null?void 0:t.kind){case"kpi":return"kpi";case"lineChart":return"line";case"barChart":return"bar";case"areaChart":return"area";case"table":return"table";case"text":return"text";default:return null}}function mt(e){var t,r,a;return((t=e.presentation)==null?void 0:t.kind)==="kpi"?"kpi":((r=e.presentation)==null?void 0:r.kind)==="table"?"table":((a=e.presentation)==null?void 0:a.kind)==="text"?"text":"chart"}function bt(e){const t=Te.normalizeSemaphorInputOperator(e);switch(t){case"not_in":return"not in";case"not_between":return"not between";case"contains":return"like";case"not_contains":return"not like";default:return t||"in"}}function gt(e){return $(e.field)?e.field.dataType==="datetime"?"date":e.field.dataType||"string":"string"}function It(e){if(!(!e||e.kind!=="physical"))return[e.databaseName,e.schemaName,e.tableName].filter(Boolean).join(".")}function yt(e,t,r,a,o,n){if(e.kind!=="filter")return n.push(I("control_inputs_deferred",`Control input "${e.label}" is represented in the protocol but not yet materialized by the dashboard authoring adapter.`)),null;if(!$(e.field)||typeof e.field.name!="string")return n.push(I("filter_requires_field",`Filter "${e.label||e.id}" needs a field before the dashboard compiler can materialize it.`)),null;const i=le({explicitSource:void 0,field:e.field,defaultSource:t,fallbackSources:r}),d=(i==null?void 0:i.kind)==="semantic"||(i==null?void 0:i.kind)==="physical"?i.connectionId:void 0;if(!d)return n.push(I("filter_requires_connection_id",`Filter "${e.label}" needs a source connectionId before the dashboard compiler can materialize it.`)),null;const h={id:`filter-${Ce(O(e.id,e.field.name),o)}`,variableName:e.id,connectionId:d,title:e.label,column:e.field.name,dataType:gt(e),qualifiedTableName:It(i),sql:"",operation:bt(e.operator),type:e.multi===!1?"single":"multiple",location:"dashboard",displayMode:"toolbar",fieldMeta:(i==null?void 0:i.kind)==="semantic"?{name:e.field.name,qualifiedFieldName:e.field.name,dataType:e.field.dataType,role:e.field.role==="measure"?"metric":"groupby"}:void 0,semanticContext:(i==null?void 0:i.kind)==="semantic"?{semanticDomainId:i.domainId,connectionId:i.connectionId}:void 0};return{id:e.id,label:e.label,variableName:e.id,scope:a,filter:h,defaultValue:Q(h,e.defaultValue)}}function G(e){const t=[],r=[];for(const a of e.viewIds){const o=e.viewIdToCardId.get(a);o?t.push(o):r.push(a)}return r.length>0&&e.warnings.push(I("input_scope_view_not_found",`Filter "${e.inputLabel}" referenced unknown view ids: ${r.join(", ")}.`)),Array.from(new Set(t))}function _t(e){var a,o;if(!e.protocolScope){const n=Array.from(new Set(e.boundCardIds));return n.length>0&&n.length<e.allCardIds.length?{kind:"cards",cardIds:n}:void 0}if(e.protocolScope.level==="dashboard"){if(!((a=e.protocolScope.excludeViewIds)!=null&&a.length))return;const n=new Set(G({inputLabel:e.inputLabel,viewIds:e.protocolScope.excludeViewIds,viewIdToCardId:e.viewIdToCardId,warnings:e.warnings}));return{kind:"cards",cardIds:e.allCardIds.filter(i=>!n.has(i))}}if(e.protocolScope.level==="view"){const n=G({inputLabel:e.inputLabel,viewIds:e.protocolScope.viewIds,viewIdToCardId:e.viewIdToCardId,warnings:e.warnings});return n.length===0?(e.warnings.push(I("input_scope_has_no_materialized_cards",`Filter "${e.inputLabel}" was deferred because its view scope does not match any materialized cards.`)),null):{kind:"cards",cardIds:n}}const t=e.sectionIdToCardIds.get(e.protocolScope.sectionId)||[];if(t.length===0)return e.warnings.push(I("input_scope_section_not_found",`Filter "${e.inputLabel}" was deferred because section "${e.protocolScope.sectionId}" does not match any materialized cards.`)),null;if(!((o=e.protocolScope.excludeViewIds)!=null&&o.length))return{kind:"cards",cardIds:t};const r=new Set(G({inputLabel:e.inputLabel,viewIds:e.protocolScope.excludeViewIds,viewIdToCardId:e.viewIdToCardId,warnings:e.warnings}));return{kind:"cards",cardIds:t.filter(n=>!r.has(n))}}function St(e){var C,_,c;const t=[],r=w.validateSemaphorDashboardIntent(e);for(const f of r.warnings)t.push(I(f.code,f.message));for(const f of r.errors)t.push(I(f.code,f.message));const a=ft(e,t),o=[],n=new Map,i=new Map,d=new Map,s=new Set,u=new Set;let h=0;for(const[f,g]of a.sections.entries()){const l=typeof g.title=="string"?g.title:`Section ${f+1}`,ee=g.id||O(l,`section-${f+1}`);i.set(ee,[]);for(const[te,b]of Z(g).entries()){const re=ht(b),V=O(b.id||`${l}-${b.title||`View ${te+1}`}`,`card-${f+1}-${te+1}`);if(!re){t.push(I("unsupported_presentation",`Dashboard presentation "${((C=b.presentation)==null?void 0:C.kind)||"unknown"}" is not supported by the dashboard authoring adapter.`,`card-${V}`));continue}if(((_=b.analytics)==null?void 0:_.kind)==="sql"){t.push(I("sql_intent_deferred","SQL analytics intent is valid protocol, but the current dashboard authoring adapter only materializes semantic and physical config-card intents.",`card-${V}`));continue}const ae=Ce(V,s),P=`card-${ae}`;b.id&&n.set(b.id,P),(c=i.get(ee))==null||c.push(P);const we=b.analytics&&"inputs"in b.analytics?b.analytics.inputs:void 0;for(const ne of we||[]){const ie=d.get(ne.inputId)||[];ie.push(P),d.set(ne.inputId,ie)}o.push({id:P,frameId:`frame-${ae}`,title:b.title,description:b.description,type:re,role:mt(b),priority:h,section:l,analyticsIntent:pt(b.analytics),text:b.text}),h+=1}}const y=a.inputs.map(f=>{const g=_t({protocolScope:f.scope,inputLabel:f.label,allCardIds:o.map(l=>l.id),boundCardIds:d.get(f.id)||[],viewIdToCardId:n,sectionIdToCardIds:i,warnings:t});return g===null?null:yt(f,a.defaultSource,a.sources,g,u,t)}).filter(f=>!!f);return{plan:{version:1,id:`plan-${O(e.title,"dashboard")}`,title:e.title,description:e.description,datasets:a.datasets,sheets:[{id:`sheet-${O(e.title,"dashboard")}`,title:e.title,description:e.description,kind:"dashboard",cards:o}],filterInputs:y.length?y:void 0,warnings:t.length?t:void 0,unresolvedRequests:r.ok?void 0:r.errors.map(f=>f.message)},warnings:t}}exports.DASHBOARD_AUTHORING_BREAKPOINTS=k.DASHBOARD_AUTHORING_BREAKPOINTS;exports.DASHBOARD_AUTHORING_MAX_GENERATED_CARDS=k.DASHBOARD_AUTHORING_MAX_GENERATED_CARDS;exports.AUTOMATIC_TEMPORAL_BUCKET_FORMAT=A.AUTOMATIC_TEMPORAL_BUCKET_FORMAT;exports.SEMAPHOR_CARTESIAN_CHART_TYPES=A.SEMAPHOR_CARTESIAN_CHART_TYPES;exports.getTemporalBucketAuthoringOptions=A.getTemporalBucketAuthoringOptions;exports.getTemporalBucketAuthoringSelection=A.getTemporalBucketAuthoringSelection;exports.isSemaphorCartesianChartType=A.isSemaphorCartesianChartType;exports.previewTemporalBucketAuthoringFormat=A.previewTemporalBucketAuthoringFormat;exports.reconcileTemporalBucketAuthoringFormat=A.reconcileTemporalBucketAuthoringFormat;exports.resolveTemporalBucketAuthoringFormat=A.resolveTemporalBucketAuthoringFormat;exports.resolveTemporalResultOwner=A.resolveTemporalResultOwner;exports.supportsCanonicalDashboardTemporalResult=A.supportsCanonicalDashboardTemporalResult;exports.transformComparisonDocument=A.transformComparisonDocument;exports.resolveCanonicalDetailResultRawKey=X.resolveCanonicalDetailResultRawKey;exports.resolveCanonicalResultOutputKey=X.resolveCanonicalResultOutputKey;exports.resolveCanonicalResultRawKey=X.resolveCanonicalResultRawKey;exports.DashboardFilterMappingContractError=m.DashboardFilterMappingContractError;exports.buildDashboardCardSourceIndex=m.buildDashboardCardSourceIndex;exports.createDashboardFilterBindingId=m.createDashboardFilterBindingId;exports.dashboardCardFilterSourceInventoryContains=m.dashboardCardFilterSourceInventoryContains;exports.dashboardFilterTargetMatchesLogicalValue=m.dashboardFilterTargetMatchesLogicalValue;exports.dashboardFilterValueTypeForDataType=m.dashboardFilterValueTypeForDataType;exports.findDashboardCardExecutableSource=m.findDashboardCardExecutableSource;exports.findDashboardCardPinnedCatalogSource=m.findDashboardCardPinnedCatalogSource;exports.findDashboardSqlPinnedCatalogSource=m.findDashboardSqlPinnedCatalogSource;exports.getDashboardFilterSubscriptionHint=m.getDashboardFilterSubscriptionHint;exports.hasDashboardFilterSubscription=m.hasDashboardFilterSubscription;exports.isDashboardFilterOperationCompatible=m.isDashboardFilterOperationCompatible;exports.normalizeDashboardInputs=m.normalizeDashboardInputs;exports.requireNormalizedDashboardInputs=m.requireNormalizedDashboardInputs;exports.resolveDashboardFilterAutomaticTarget=m.resolveDashboardFilterAutomaticTarget;exports.resolveDashboardFilterInheritedTarget=m.resolveDashboardFilterInheritedTarget;exports.resolveDashboardSqlFilterTarget=m.resolveDashboardSqlFilterTarget;exports.applyDashboardChangePlan=st;exports.compileDashboardFromPlan=et;exports.compileResponsiveDashboardLayouts=H;exports.dashboardAuthoringDatasetMatchesSource=z;exports.dashboardAuthoringFieldsReferToSameTarget=xe;exports.dashboardAuthoringSourceFromField=v;exports.dashboardAuthoringSourceKey=Fe;exports.dashboardAuthoringSourcesReferToSameDataset=Y;exports.dashboardPlanFromSemaphorDashboardIntent=St;exports.findDashboardAuthoringDatasetForSource=Pe;exports.getDashboardAuthoringCardSource=fe;exports.isMaterializableDashboardAuthoringSource=M;exports.isSemaphorSourceRef=de;exports.mergeDashboardAuthoringSources=B;exports.preferDashboardAuthoringSourceMetadata=ce;exports.preferredDashboardAuthoringSource=ke;exports.resolveDashboardAuthoringSource=le;exports.validateDashboardAuthoringDatasetScope=pe;exports.validateDashboardChangePlan=_e;exports.validateDashboardPlan=ye;
@@ -1,11 +1,11 @@
1
1
  import { D as R, a as Ie } from "../chunks/contracts-CoCOpd_i.js";
2
- import { A as Mt, S as Nt, g as Bt, a as Rt, i as Pt, p as Ot, c as zt, b as qt, r as Vt, s as Lt, t as jt } from "../chunks/temporal-bucket-authoring-ZxFzhTmL.js";
3
- import { k as ye, ah as H, ai as _e, y as ae, F as we, B as ve } from "../chunks/validators-CCpBY1e0.js";
4
- import "../chunks/analyze-result-contract-CMZDRRwo.js";
2
+ import { A as Mt, S as Nt, g as Bt, a as Rt, i as Pt, p as Ot, c as zt, b as qt, r as Vt, s as Lt, t as jt } from "../chunks/temporal-bucket-authoring-DjPFtRSF.js";
3
+ import { j as ye, ah as H, ai as _e, x as ae, E as we, A as ve } from "../chunks/validators-DhTaCK1O.js";
4
+ import "../chunks/analyze-result-contract-kaCNxjA7.js";
5
5
  import "../value-format-preferences/index.js";
6
6
  import { n as Se } from "../chunks/operators-C8TxpM4C.js";
7
7
  import { a as Ht, b as Wt, r as Kt } from "../chunks/canonical-result-keys-CEQefvdO.js";
8
- import { D as Ut, b as Qt, l as Yt, d as Jt, e as Xt, m as Zt, f as er, a as tr, c as rr, i as nr, h as ar, o as ir, n as or, k as sr, r as dr, g as cr, j as lr } from "../chunks/dashboard-filter-value-compatibility-B8ynE_O1.js";
8
+ import { D as Ut, b as Qt, l as Yt, d as Jt, e as Xt, m as Zt, f as er, a as tr, c as rr, i as nr, h as ar, o as ir, n as or, k as sr, r as dr, g as cr, j as lr } from "../chunks/dashboard-filter-value-compatibility-Ce7jUVh-.js";
9
9
  function _(e) {
10
10
  return e && typeof e == "object" ? e : null;
11
11
  }
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),p=require("react"),An=require("react-dom/client"),k=require("../chunks/index-yJRh4x9j.cjs"),w=require("../chunks/switch-BghC7eOM.cjs"),Ze=require("../data-app-builder-browser-runtime/index.cjs"),te=require("../chunks/x-B6ghREd2.cjs"),Cn=require("../chunks/save-3dYRmehL.cjs"),Rn=require("../chunks/mouse-pointer-2-DX4A_XZw.cjs"),tt=require("../chunks/search-BqqhaMx9.cjs");function Tr(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const d=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(s,a,d.get?d:{enumerable:!0,get:()=>t[a]})}}return s.default=t,Object.freeze(s)}const Bn=Tr(p),Dn=Tr(An);/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),p=require("react"),An=require("react-dom/client"),k=require("../chunks/index-DKaQRhKm.cjs"),w=require("../chunks/switch-DyE2_OmQ.cjs"),Ze=require("../data-app-builder-browser-runtime/index.cjs"),te=require("../chunks/x-B6ghREd2.cjs"),Cn=require("../chunks/save-3dYRmehL.cjs"),Rn=require("../chunks/mouse-pointer-2-DX4A_XZw.cjs"),tt=require("../chunks/search-BqqhaMx9.cjs");function Tr(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const d=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(s,a,d.get?d:{enumerable:!0,get:()=>t[a]})}}return s.default=t,Object.freeze(s)}const Bn=Tr(p),Dn=Tr(An);/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -2,8 +2,8 @@ import { jsx as r, jsxs as c, Fragment as re } from "react/jsx-runtime";
2
2
  import * as Zn from "react";
3
3
  import { useContext as qn, useState as x, useRef as oe, useMemo as je, useEffect as W, useCallback as Ot } from "react";
4
4
  import * as Xn from "react-dom/client";
5
- import { aM as ea, aN as ta, aO as Ir, aP as jr, aQ as zr, aR as ra, aS as Wr, aT as Hr, aU as Jr, aV as Vr, aW as _r, aX as Ur, aY as Gr, aZ as na, a_ as aa, a$ as oa, b0 as Ht, b1 as on, R as Kr, b2 as sa, b3 as Vt, b4 as sn, b5 as ia, b6 as la } from "../chunks/index-B31RKKGb.js";
6
- import { B as H, P as it, a as lt, b as dt, _ as da, $ as ca, a0 as ua, a1 as pa, a2 as ha, L as me, R as ma, d as _t } from "../chunks/switch-B6rFVSdw.js";
5
+ import { aM as ea, aN as ta, aO as Ir, aP as jr, aQ as zr, aR as ra, aS as Wr, aT as Hr, aU as Jr, aV as Vr, aW as _r, aX as Ur, aY as Gr, aZ as na, a_ as aa, a$ as oa, b0 as Ht, b1 as on, R as Kr, b2 as sa, b3 as Vt, b4 as sn, b5 as ia, b6 as la } from "../chunks/index-8Cm77joZ.js";
6
+ import { B as H, P as it, a as lt, b as dt, _ as da, $ as ca, a0 as ua, a1 as pa, a2 as ha, L as me, R as ma, d as _t } from "../chunks/switch-BagpmPNw.js";
7
7
  import { loadSemaphorBrowserRuntime as ot } from "../data-app-builder-browser-runtime/index.js";
8
8
  import { c as Ve, X as He } from "../chunks/x-CXDkqdur.js";
9
9
  import { S as fa } from "../chunks/save-DgMfP0j8.js";
@@ -1,5 +1,5 @@
1
- import { S as E, a as S, i as A, v as t } from "../chunks/validators-CCpBY1e0.js";
2
- import { C as R, a as r, b as s, G as C, e as o, R as p, c as d, f as O, g as i, h as m, i as n, j as N, v as T, d as I } from "../chunks/update-policy-BKOA5S76.js";
1
+ import { S as E, a as S, i as A, v as t } from "../chunks/validators-DhTaCK1O.js";
2
+ import { C as R, a as r, b as s, G as C, e as o, R as p, c as d, f as O, g as i, h as m, i as n, j as N, v as T, d as I } from "../chunks/update-policy-Bu5Tw43R.js";
3
3
  export {
4
4
  R as CODEGEN_SUMMARY_SCHEMA_VERSION,
5
5
  r as CODEGEN_SUMMARY_VALIDATOR_VERSION,
@@ -1,6 +1,6 @@
1
- import { S as Vn, a as Fn, i as bn, v as kn } from "../chunks/validators-CCpBY1e0.js";
2
- import { c as ke, G as fe, a as Re, b as Me } from "../chunks/update-policy-BKOA5S76.js";
3
- import { C as Mn, e as Cn, R as On, f as xn, g as Gn, h as Nn, i as En, j as An, v as jn, d as vn } from "../chunks/update-policy-BKOA5S76.js";
1
+ import { S as Vn, a as Fn, i as bn, v as kn } from "../chunks/validators-DhTaCK1O.js";
2
+ import { c as ke, G as fe, a as Re, b as Me } from "../chunks/update-policy-Bu5Tw43R.js";
3
+ import { C as Mn, e as Cn, R as On, f as xn, g as Gn, h as Nn, i as En, j as An, v as jn, d as vn } from "../chunks/update-policy-Bu5Tw43R.js";
4
4
  import { createHash as ye } from "node:crypto";
5
5
  const wn = "src/semaphor/generated", v = `// Generated by Semaphor Agent Plugin. Do not hand-edit analytics wiring here.
6
6
  // Regenerate from the accepted semaphor_plan_data_app codegenSummary when the plan changes.
@@ -1,9 +1,9 @@
1
1
  import { toSemaphorInputSnapshots as jr, toSemaphorInputBinding as Hr, toSemaphorActiveInputSnapshots as X, toSemaphorMatrixIntent as Pr, toSemaphorSqlIntent as Vr, toSemaphorInputOptionsIntent as Qr, toSemaphorRecordsIntent as Ur, toSemaphorAnalysisQueryOptions as Gr, toSemaphorAnalysisIntent as Jr, toSemaphorMetricIntent as Yr, hasSemaphorInputValue as ue, normalizeSemaphorInputOptions as hr, toSemaphorInputSpec as br } from "../data-app-sdk-adapters/index.js";
2
2
  import { jsxs as p, Fragment as vr, jsx as a } from "react/jsx-runtime";
3
3
  import { createContext as Ie, useContext as Q, useState as z, useRef as E, useEffect as B, useMemo as I, Fragment as Xr, useId as Sr, useCallback as D, useReducer as Zr } from "react";
4
- import { k as et, aj as rt, y as tt } from "../chunks/validators-CCpBY1e0.js";
5
- import { c as lo, ak as uo } from "../chunks/validators-CCpBY1e0.js";
6
- import "../chunks/analyze-result-contract-CMZDRRwo.js";
4
+ import { j as et, aj as rt, x as tt } from "../chunks/validators-DhTaCK1O.js";
5
+ import { c as lo, ak as uo } from "../chunks/validators-DhTaCK1O.js";
6
+ import "../chunks/analyze-result-contract-kaCNxjA7.js";
7
7
  import "../value-format-preferences/index.js";
8
8
  import { M as nt, a as it, S as ot, E as st, C as at } from "../chunks/search-BHsQIWBV.js";
9
9
  import { X as lt, C as dt, j as ut } from "../chunks/x-CXDkqdur.js";
@@ -1,6 +1,6 @@
1
- import { s as m, p as I, c as p } from "../chunks/validators-CCpBY1e0.js";
1
+ import { s as m, p as I, c as p } from "../chunks/validators-DhTaCK1O.js";
2
2
  import { n as c } from "../chunks/operators-C8TxpM4C.js";
3
- import "../chunks/analyze-result-contract-CMZDRRwo.js";
3
+ import "../chunks/analyze-result-contract-kaCNxjA7.js";
4
4
  import "../value-format-preferences/index.js";
5
5
  function F(i) {
6
6
  var n, e, a;
@@ -1,7 +1,7 @@
1
- import { C as H, F as O, s as K, ah as q, y as Q } from "../chunks/validators-CCpBY1e0.js";
2
- import "../chunks/analyze-result-contract-CMZDRRwo.js";
1
+ import { B as H, E as O, s as K, ah as q, x as Q } from "../chunks/validators-DhTaCK1O.js";
2
+ import "../chunks/analyze-result-contract-kaCNxjA7.js";
3
3
  import "../value-format-preferences/index.js";
4
- import { p as E } from "../chunks/report-runtime-context-CrTzKt0C.js";
4
+ import { p as E } from "../chunks/report-runtime-context-CcXUjpb-.js";
5
5
  import { toSemaphorMetricIntent as J, toSemaphorAnalysisIntent as U, toSemaphorRecordsIntent as W, toSemaphorSqlIntent as L, toSemaphorMatrixIntent as V, toSemaphorInputOptionsIntent as G } from "../data-app-sdk-adapters/index.js";
6
6
  function X({
7
7
  intent: e,
@@ -58,7 +58,7 @@ function m(e, r) {
58
58
  }
59
59
  function u(e, r) {
60
60
  return e.find(
61
- (o) => B(o, r)
61
+ (o) => j(o, r)
62
62
  );
63
63
  }
64
64
  function k(e) {
@@ -256,17 +256,17 @@ function $(e) {
256
256
  function M(e) {
257
257
  const r = [...e.fields];
258
258
  return e.dateField && !r.some(
259
- (o) => j(o, e.dateField)
259
+ (o) => B(o, e.dateField)
260
260
  ) && r.push({ ...e.dateField, role: "date" }), r;
261
261
  }
262
262
  function se(e, r) {
263
- return B(e.field, r.field) && e.allowedRelatedRoles.join("|") === r.allowedRelatedRoles.join("|") && (e.unsupportedRelatedRoleMessage || "") === (r.unsupportedRelatedRoleMessage || "") && (e.recommendedNextStep || "") === (r.recommendedNextStep || "");
263
+ return j(e.field, r.field) && e.allowedRelatedRoles.join("|") === r.allowedRelatedRoles.join("|") && (e.unsupportedRelatedRoleMessage || "") === (r.unsupportedRelatedRoleMessage || "") && (e.recommendedNextStep || "") === (r.recommendedNextStep || "");
264
264
  }
265
- function j(e, r) {
265
+ function B(e, r) {
266
266
  return K(e, r);
267
267
  }
268
- function B(e, r) {
269
- return j(e, r) && ne(
268
+ function j(e, r) {
269
+ return B(e, r) && ne(
270
270
  f(e),
271
271
  f(r)
272
272
  );
@@ -1,12 +1,12 @@
1
1
  import { i as _ } from "../chunks/format-types-CFHQoIuk.js";
2
- import { f as w, a as y, b as R } from "../chunks/pivot-result-lifecycle--NNNPUtG.js";
3
- import { M as L, E as G, P as H, R as K, z as U, w as W, G as Q, n as F, x as Y, C as J, D as X, o as Z, q as ee, d as re, c as oe, h as te, e as se, B as ne, g as le, F as ae, p as ie, m as ue, k as me, y as ce, i as fe, l as pe, t as be, A as Te, r as we, j as he, u as Ee, v as ye, s as Re } from "../chunks/pivot-result-lifecycle--NNNPUtG.js";
4
- import { f as C, a as v, b as p, e as h } from "../chunks/pivot-header-presentation-CSf6CyOt.js";
5
- import { A as ve, P as Ae, i as Se, m as Pe, q as de, s as ge, l as $e, c as Ve, d as ke, g as xe, h as Me, j as Be, o as Ie, p as Ne, n as je, t as ze, k as Oe, r as qe } from "../chunks/pivot-header-presentation-CSf6CyOt.js";
6
- import { r as De, ao as Le, am as Ge, ap as He, an as Ke, al as Ue } from "../chunks/validators-CCpBY1e0.js";
7
- import { i as Qe, T as Fe, h as Ye, j as Je, p as Xe, a as Ze, k as er } from "../chunks/temporal-bucket-DFYIkexB.js";
8
- import { P as or, b as tr, i as sr, c as nr, d as lr, r as ar, a as ir } from "../chunks/pivot-result-identity-BvT51Nog.js";
9
- import { p as mr, v as cr } from "../chunks/raw-temporal-contract-BqVMduCs.js";
2
+ import { f as w, a as y, b as R } from "../chunks/pivot-result-lifecycle-B38AZx4a.js";
3
+ import { M as L, E as G, P as H, R as K, z as U, w as W, G as Q, n as F, x as Y, C as J, D as X, o as Z, q as ee, d as re, c as oe, h as te, e as se, B as ne, g as le, F as ae, p as ie, m as ue, k as me, y as ce, i as fe, l as pe, t as be, A as Te, r as we, j as he, u as Ee, v as ye, s as Re } from "../chunks/pivot-result-lifecycle-B38AZx4a.js";
4
+ import { f as C, a as v, b as p, e as h } from "../chunks/pivot-header-presentation-OpY8xzdT.js";
5
+ import { A as ve, P as Ae, i as Se, m as Pe, q as de, s as ge, l as $e, c as Ve, d as ke, g as xe, h as Me, j as Be, o as Ie, p as Ne, n as je, t as ze, k as qe, r as Oe } from "../chunks/pivot-header-presentation-OpY8xzdT.js";
6
+ import { q as De, ao as Le, am as Ge, ap as He, an as Ke, al as Ue } from "../chunks/validators-DhTaCK1O.js";
7
+ import { i as Qe, T as Fe, h as Ye, j as Je, p as Xe, a as Ze, k as er } from "../chunks/temporal-bucket-Cc9fmx8s.js";
8
+ import { P as or, b as tr, i as sr, c as nr, d as lr, r as ar, a as ir } from "../chunks/pivot-result-identity-CCMpd8ZA.js";
9
+ import { p as mr, v as cr } from "../chunks/raw-temporal-contract-r_EMdR85.js";
10
10
  function A(r, e, t, o) {
11
11
  const s = r instanceof Date ? r.toISOString() : String(r), l = (o == null ? void 0 : o.browserTimezone) || t, n = (o == null ? void 0 : o.isSqlCard) ?? !1;
12
12
  if (e != null && e.useRelativeTime)
@@ -347,7 +347,7 @@ export {
347
347
  ze as presentPivotHeader,
348
348
  nr as requirePivotHeaderMembers,
349
349
  lr as requirePivotResultColumnIdentities,
350
- Oe as resolveAggregateTablePresentationContext,
350
+ qe as resolveAggregateTablePresentationContext,
351
351
  He as resolveApplicableTemporalBucketFormat,
352
352
  we as resolveCurrencyFractionDigits,
353
353
  Ze as resolveMetricResultAlias,
@@ -355,7 +355,7 @@ export {
355
355
  ar as resolveQueryColumnKeyMapEntry,
356
356
  Ee as resolveRawTemporalFormat,
357
357
  er as resolveTemporalBucketPresentation,
358
- qe as resolveTimezone,
358
+ Oe as resolveTimezone,
359
359
  ir as resolveUniqueQueryColumnKeyMapEntry,
360
360
  Ke as tokenizeTemporalBucketPattern,
361
361
  ye as validateCardExportNumericPresentationSnapshot,