react-semaphor 0.1.559 → 0.1.560

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/dist/analytics-protocol/index.js +368 -361
  2. package/dist/assistant-context/index.js +1 -1
  3. package/dist/assistant-protocol/index.js +5 -5
  4. package/dist/brand-studio/index.js +9 -9
  5. package/dist/briefings/index.js +5 -5
  6. package/dist/chunks/analytics-base-schemas-CHLxsPfX.js +630 -0
  7. package/dist/chunks/{assistant-chat-B_4bVE6I.js → assistant-chat-Bu2fFm_I.js} +206 -207
  8. package/dist/chunks/{bookmark-state-ssqrs5oP.js → bookmark-state-BFY9oNmr.js} +3 -3
  9. package/dist/chunks/{braces-Rdxa3H-s.js → braces-Da41xfUd.js} +1 -1
  10. package/dist/chunks/{comparison-window-caption-CKzQ5LcF.js → comparison-window-caption-4FNkMrzE.js} +166 -166
  11. package/dist/chunks/{context-DVy4HOU0.js → context-BgPDzLHZ.js} +1 -1
  12. package/dist/chunks/{custom-visual-inputs-zVa9wX_o.js → custom-visual-inputs-Dz-enUNR.js} +1 -1
  13. package/dist/chunks/{dashboard-BziwOVpZ.js → dashboard-_MeBuy67.js} +1 -1
  14. package/dist/chunks/{dashboard-briefing-launcher-CbeNR-YI.js → dashboard-briefing-launcher-CEi4Pr_v.js} +1152 -1166
  15. package/dist/chunks/{dashboard-controls-RD6UJs1r.js → dashboard-controls-Bi7fyG-4.js} +98 -98
  16. package/dist/chunks/{dashboard-json-DGpv17vL.js → dashboard-json-B1mU_OMa.js} +5 -5
  17. package/dist/chunks/{document-dashboard-inputs-ChVkcBuu.js → document-dashboard-inputs-CkWfDB8c.js} +64 -64
  18. package/dist/chunks/{edit-dashboard-visual-AQ2pQkFp.js → edit-dashboard-visual-0CJN31Y3.js} +8375 -8615
  19. package/dist/chunks/filter-reach-copy-BF4w4kI2.js +3738 -0
  20. package/dist/chunks/{filter-value-text-B4l-xqJT.js → filter-value-text-CRC-K_l_.js} +3 -3
  21. package/dist/chunks/{global-date-filter-utils-DBzEOX9M.js → global-date-filter-utils-D8365uPH.js} +4068 -3401
  22. package/dist/chunks/{index-B1Xr7W24.js → index-DtHidOPV.js} +579 -604
  23. package/dist/chunks/{layout-grid-Bbz3zKif.js → layout-grid-BvsH4RY2.js} +1 -1
  24. package/dist/chunks/{list-filter-3sbH0Uy1.js → list-filter-Dg0otx5E.js} +1 -1
  25. package/dist/chunks/{matrix-analytical-definition-CEe3PGEo.js → matrix-analytical-definition-CM18W8w6.js} +4 -4
  26. package/dist/chunks/{matrix-card-BRNGb1C4.js → matrix-card-HPskLaPy.js} +3 -3
  27. package/dist/chunks/{matrix-member-presentation-CEegvTqg.js → matrix-member-presentation-Bbrfrke4.js} +1 -1
  28. package/dist/chunks/{matrix-operation-contract-COxrfQTS.js → matrix-operation-contract-WPv4R-H_.js} +110 -110
  29. package/dist/chunks/{metric-comparison-DQx-uX__.js → metric-comparison-ljMKYZKa.js} +2 -2
  30. package/dist/chunks/{model-change-CJEj3ZD6.js → model-change-Ccn1zaxl.js} +1 -1
  31. package/dist/chunks/{palette-DMJtp3Vn.js → palette-Bsh376zO.js} +1 -1
  32. package/dist/chunks/{pivot-result-contract-expectations-DOYhqeZb.js → pivot-result-contract-expectations-Bl5suy4-.js} +602 -696
  33. package/dist/chunks/{pivot-result-identity-CAj8SiRL.js → pivot-result-identity-vS9TSh4f.js} +1 -1
  34. package/dist/chunks/{raw-temporal-presentation-BmT7z6NH.js → raw-temporal-presentation-BHm7s-hz.js} +230 -274
  35. package/dist/chunks/{report-preferences-dialog-0sc8B1lh.js → report-preferences-dialog-BV8L0SeS.js} +55 -55
  36. package/dist/chunks/{report-runtime-context-bYoExeWr.js → report-runtime-context-BZQh9ywy.js} +2 -2
  37. package/dist/chunks/{resolve-dashboard-input-context-B_C_VAJH.js → resolve-dashboard-input-context-CAMiWvyR.js} +1749 -1989
  38. package/dist/chunks/{save-DSb1jTtG.js → save-B5EAsgQF.js} +1 -1
  39. package/dist/chunks/{saved-dashboard-context-BQWM3ldX.js → saved-dashboard-context-n2Wn11cV.js} +57 -57
  40. package/dist/chunks/{selection-reducer-DSzMWb4x.js → selection-reducer-D0YnaAD9.js} +1 -1
  41. package/dist/chunks/{semaphor-ready-indicator-Bz14Oma5.js → semaphor-ready-indicator-XLBLOJ2V.js} +38374 -39104
  42. package/dist/chunks/{shelf-drop-preview-context-DBHAkgch.js → shelf-drop-preview-context-DHMa54a-.js} +570 -570
  43. package/dist/chunks/{source-entity-resolution-BOrmNCEM.js → source-entity-resolution-dUG5VWRm.js} +1 -1
  44. package/dist/chunks/{switch-Dq8XPFpT.js → switch-ByxH4M7t.js} +3 -3
  45. package/dist/chunks/{table-export-sheet-C_RvEUyO.js → table-export-sheet-C_GdeTYU.js} +1 -1
  46. package/dist/chunks/{table-settings-DXj_zXwS.js → table-settings-Imz0FgWi.js} +6 -6
  47. package/dist/chunks/{temporal-input-presentation-AhLSkGPf.js → temporal-input-presentation-uvNK_tM0.js} +1109 -820
  48. package/dist/chunks/{token-types-LCYMJ3pa.js → token-types-CQtXUVMy.js} +1 -1
  49. package/dist/chunks/{upload-Dr_WAxHQ.js → upload-wbR-NVzq.js} +1 -1
  50. package/dist/chunks/{use-create-flow-overlay-state-BK3YFkfc.js → use-create-flow-overlay-state-CEBaLOKC.js} +6 -6
  51. package/dist/chunks/{validators-C87JPd-_.js → validators-CXTneCA4.js} +1206 -1579
  52. package/dist/chunks/{zoned-wall-clock-E35Frf9v.js → zoned-wall-clock-B1n_WjW3.js} +1 -1
  53. package/dist/dashboard/index.js +2 -2
  54. package/dist/dashboard-authoring/index.js +2207 -1497
  55. package/dist/data-app-sdk/index.js +5 -5
  56. package/dist/data-app-sdk-adapters/index.js +3 -3
  57. package/dist/data-app-sdk-validation/index.js +6 -6
  58. package/dist/format-utils/index.js +181 -176
  59. package/dist/index.js +22 -22
  60. package/dist/report-runtime-context/index.js +2 -2
  61. package/dist/style.css +1 -1
  62. package/dist/surfboard/index.js +2 -2
  63. package/dist/types/components/editor/editor-aside/utils.d.ts +1 -1
  64. package/dist/types/components/visual/data-table/types/data-table.d.ts +5 -20
  65. package/dist/types/index.js +6 -6
  66. package/dist/types/lib/formatters/canonical-format-adapter.d.ts +2 -29
  67. package/dist/types/lib/formatters/raw-temporal-presentation.d.ts +0 -2
  68. package/dist/types/lib/formatters/table-column-settings.d.ts +47 -0
  69. package/dist/types/lib/matrix-table/matrix-card-adapter.d.ts +10 -188
  70. package/dist/types/lib/matrix-table/matrix-delivery-policy.d.ts +1 -1
  71. package/dist/types/lib/matrix-table/matrix-delivery.d.ts +16 -372
  72. package/dist/types/lib/stores/dashboard-store.d.ts +0 -1
  73. package/dist/types/lib/stores/editor-store.d.ts +39 -9
  74. package/dist/types/lib/stores/table-actions.d.ts +9 -3
  75. package/dist/types/lib/table-formatting/index.d.ts +0 -2
  76. package/dist/types/lib/table-formatting/table-conditional-formatting-range-source.d.ts +3 -2
  77. package/dist/types/lib/table-formatting/table-conditional-formatting-range.d.ts +3 -2
  78. package/dist/types/lib/table-formatting/table-formatting-normalize.d.ts +1 -2
  79. package/dist/types/lib/table-formatting/table-formatting-render-model.d.ts +9 -0
  80. package/dist/types/lib/table-formatting/table-formatting-types.d.ts +5 -95
  81. package/dist/types/lib/table-formatting/table-presentation-fields.d.ts +35 -0
  82. package/dist/types/lib/types/common-types.d.ts +40 -47
  83. package/dist/types/lib/types/explorer-types.d.ts +11 -43
  84. package/dist/types/lib/utils/card-config-utils.d.ts +8 -0
  85. package/dist/types/lib/utils/card-definition.d.ts +9 -187
  86. package/dist/types/shared/analytics-protocol/analytics-base-schemas.d.ts +159 -513
  87. package/dist/types/shared/analytics-protocol/contracts.d.ts +32 -9
  88. package/dist/types/shared/analytics-protocol/execution-input-schemas.d.ts +108 -980
  89. package/dist/types/shared/analytics-protocol/field-validation.d.ts +1 -0
  90. package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +281 -4624
  91. package/dist/types/shared/analytics-protocol/matrix-operation-contract.d.ts +20 -20
  92. package/dist/types/shared/analytics-protocol/matrix-operation-request.d.ts +18 -18
  93. package/dist/types/shared/analytics-protocol/matrix-path-contract.d.ts +40 -40
  94. package/dist/types/shared/analytics-protocol/matrix-window-contract.d.ts +3 -203
  95. package/dist/types/shared/analytics-protocol/scalar-value.d.ts +8 -8
  96. package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +8 -0
  97. package/dist/types/shared/assistant-protocol/context.d.ts +69 -69
  98. package/dist/types/shared/dashboard-authoring/canonical-result-keys.d.ts +13 -0
  99. package/dist/types/shared/dashboard-authoring/card-export-request.d.ts +4 -1
  100. package/dist/types/shared/dashboard-authoring/card-formats/sql-date-pattern.d.ts +10 -0
  101. package/dist/types/shared/dashboard-authoring/card-formats/upgrade-card-formats.d.ts +57 -0
  102. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +24 -24
  103. package/dist/types/shared/dashboard-authoring/conditional-formatting/editable.d.ts +14 -0
  104. package/dist/types/shared/dashboard-authoring/conditional-formatting/evaluate.d.ts +16 -0
  105. package/dist/types/shared/dashboard-authoring/conditional-formatting/index.d.ts +9 -0
  106. package/dist/types/shared/dashboard-authoring/conditional-formatting/kpi.d.ts +14 -0
  107. package/dist/types/shared/dashboard-authoring/conditional-formatting/resolve-card-column-ref.d.ts +17 -0
  108. package/dist/types/shared/dashboard-authoring/conditional-formatting/retain.d.ts +14 -0
  109. package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +4499 -0
  110. package/dist/types/shared/dashboard-authoring/conditional-formatting/store.d.ts +12 -0
  111. package/dist/types/shared/dashboard-authoring/conditional-formatting/types.d.ts +151 -0
  112. package/dist/types/shared/dashboard-authoring/conditional-formatting/upgrade.d.ts +35 -0
  113. package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +62 -62
  114. package/dist/types/shared/dashboard-authoring/index.d.ts +5 -0
  115. package/dist/types/shared/dashboard-authoring/matrix-authoring.d.ts +4 -5
  116. package/dist/types/shared/dashboard-authoring/matrix-delivery.d.ts +24 -736
  117. package/dist/types/shared/dashboard-authoring/retired-presentation-fields.d.ts +31 -0
  118. package/dist/types/shared/dashboard-authoring/upgrade-card-presentation.d.ts +14 -0
  119. package/dist/types/shared/format-utils/formatters/matrix-formatter.d.ts +5 -1
  120. package/dist/types/shared/format-utils/formatters/number-formatter.d.ts +16 -0
  121. package/dist/types/shared/format-utils/index.d.ts +2 -0
  122. package/dist/types/shared/format-utils/matrix-export-presentation.d.ts +10 -366
  123. package/dist/types/shared/format-utils/raw-temporal.d.ts +15 -1
  124. package/dist/types/shared/format-utils/resolve-column-format.d.ts +43 -0
  125. package/dist/types/shared/format-utils/retired-format-adapters.d.ts +68 -0
  126. package/dist/types/shared/format-utils/semantic-format.d.ts +5 -1
  127. package/dist/types/shared/format-utils/stored-value-format.d.ts +16 -0
  128. package/dist/types/shared/format-utils/types/format-types.d.ts +10 -12
  129. package/package.json +1 -1
  130. package/dist/chunks/analytics-base-schemas-BUFUoO6G.js +0 -472
  131. package/dist/chunks/editor-draft-sync-BN5qYHPF.js +0 -15
  132. package/dist/chunks/filter-reach-copy-B5Y7FHzg.js +0 -3411
  133. package/dist/types/lib/table-formatting/table-conditional-formatting-evaluator.d.ts +0 -9
  134. package/dist/types/lib/table-formatting/table-formatting-validation.d.ts +0 -12
@@ -1,164 +1,163 @@
1
- import "./analytics-base-schemas-BUFUoO6G.js";
2
- import { r as P } from "./pivot-result-identity-CAj8SiRL.js";
3
- import { r as R, n as M } from "./global-date-filter-utils-DBzEOX9M.js";
4
- import "./validators-C87JPd-_.js";
5
- import "./matrix-operation-contract-COxrfQTS.js";
6
- import { v as S } from "./zoned-wall-clock-E35Frf9v.js";
1
+ import { r as R, n as S, a as k } from "./global-date-filter-utils-D8365uPH.js";
2
+ import "./analytics-base-schemas-CHLxsPfX.js";
3
+ import { r as E } from "./pivot-result-identity-vS9TSh4f.js";
4
+ import "./validators-CXTneCA4.js";
5
+ import "./matrix-operation-contract-WPv4R-H_.js";
6
+ import { v as x } from "./zoned-wall-clock-B1n_WjW3.js";
7
7
  import "zod";
8
- import { DEFAULT_RESOLVED_VALUE_FORMAT_PREFERENCES as A } from "../value-format-preferences/index.js";
9
- import { f as E, M as O, p as g, r as b, c as q, R as z, v as L } from "./temporal-input-presentation-AhLSkGPf.js";
10
- const $ = "SEMAPHOR_CALCULATED_FIELD";
11
- function j(e, a, t) {
8
+ import { DEFAULT_RESOLVED_VALUE_FORMAT_PREFERENCES as O } from "../value-format-preferences/index.js";
9
+ import { f as P, M as q, p as h, r as b, c as z, R as L, s as $, v as N } from "./temporal-input-presentation-uvNK_tM0.js";
10
+ const j = "SEMAPHOR_CALCULATED_FIELD";
11
+ function F(e, a, t) {
12
12
  if (t && (a === "groupby" || a === "pivotby"))
13
13
  return t;
14
14
  if (a === "metric" && e.name === "*" && !e.expression)
15
15
  return e.alias || "count";
16
16
  if (e.alias) return e.alias;
17
- const r = e.entityName && e.entityName !== $ ? e.entityName : void 0;
17
+ const n = e.entityName && e.entityName !== j ? e.entityName : void 0;
18
18
  if (e.role === "metric") {
19
19
  let o = e.aggregate || "metric";
20
20
  if (e.expression) {
21
- const n = e.expression.match(
21
+ const r = e.expression.match(
22
22
  /^(COUNT|SUM|AVG|MIN|MAX|MEDIAN|DISTINCT)\s*\(/i
23
23
  );
24
- o = n ? n[1].toLowerCase() : "expr";
24
+ o = r ? r[1].toLowerCase() : "expr";
25
25
  } else
26
26
  o = o.toLowerCase();
27
- return r && r !== e.name ? `${r}_${e.name}_${o}` : `${e.name}_${o}`;
27
+ return n && n !== e.name ? `${n}_${e.name}_${o}` : `${e.name}_${o}`;
28
28
  }
29
- return r && r !== e.name ? `${r}_${e.name}` : e.name;
30
- }
31
- function ne(e) {
32
- return j(e, "detail");
29
+ return n && n !== e.name ? `${n}_${e.name}` : e.name;
33
30
  }
34
31
  function se(e) {
32
+ return F(e, "detail");
33
+ }
34
+ function B(e) {
35
35
  const a = e.label;
36
36
  return a && e.labelCount === 1 && (a === e.rawKey || !e.rawKeys.has(a)) ? a : e.rawKey;
37
37
  }
38
- class m extends Error {
39
- constructor(a, t, r) {
40
- super(`${a}: ${t}`), this.code = a, this.context = r, Object.setPrototypeOf(this, m.prototype), this.name = "RawTemporalPresentationBoundaryError";
38
+ function ie(e) {
39
+ const a = [
40
+ ...(e.groupByColumns ?? []).map((r) => ({ field: r, role: "groupby" })),
41
+ ...(e.metricColumns ?? []).map((r) => ({ field: r, role: "metric" })),
42
+ ...(e.pivotByColumns ?? []).map((r) => ({ field: r, role: "pivotby" })),
43
+ ...(e.detailColumns ?? []).map((r) => ({ field: r, role: "detail" }))
44
+ ], t = new Map(a.map(({ field: r, role: i }) => [r, F(r, i)])), n = new Set(t.values()), o = /* @__PURE__ */ new Map();
45
+ for (const { field: r } of a)
46
+ r.label && o.set(r.label, (o.get(r.label) ?? 0) + 1);
47
+ return new Map(
48
+ a.map(({ field: r }) => [
49
+ r,
50
+ B({
51
+ label: r.label,
52
+ labelCount: r.label ? o.get(r.label) ?? 0 : 0,
53
+ rawKey: t.get(r),
54
+ rawKeys: n
55
+ })
56
+ ])
57
+ );
58
+ }
59
+ class l extends Error {
60
+ constructor(a, t, n) {
61
+ super(`${a}: ${t}`), this.code = a, this.context = n, Object.setPrototypeOf(this, l.prototype), this.name = "RawTemporalPresentationBoundaryError";
41
62
  }
42
63
  }
43
- function k() {
64
+ function I() {
44
65
  return { type: "raw_temporal", presentation: { mode: "auto" } };
45
66
  }
46
- function N(e) {
67
+ function U(e) {
47
68
  if (e.locale || e.relative || e.timezone && e.timezone !== "auto" || e.sourceTimezone && e.sourceTimezone !== "auto" || e.prefix || e.suffix)
48
- throw new m(
69
+ throw new l(
49
70
  "invalid_raw_temporal_format",
50
71
  "Activated raw temporal presentation contains unsupported locale, relative-time, timezone, prefix, or suffix settings."
51
72
  );
52
73
  }
53
- function U(e) {
74
+ function V(e) {
54
75
  const a = e.format;
55
- if ((a == null ? void 0 : a.type) === "date" && (N(a), a.pattern))
56
- return {
57
- type: "raw_temporal",
58
- presentation: {
59
- mode: "pattern",
60
- dialect: "semaphor_tokens",
61
- pattern: a.pattern
62
- }
63
- };
76
+ if ((a == null ? void 0 : a.type) === "date") {
77
+ U(a);
78
+ const t = $(a);
79
+ if (t.mode !== "auto") return { type: "raw_temporal", presentation: t };
80
+ }
64
81
  if (a)
65
- throw new m(
82
+ throw new l(
66
83
  "invalid_raw_temporal_format",
67
84
  `Raw temporal detail field "${e.id}" has an incompatible authored format.`,
68
85
  { fieldId: e.id }
69
86
  );
70
- if (e.dateFormat === "custom") {
71
- if (!e.customFormat)
72
- throw new m(
73
- "invalid_raw_temporal_format",
74
- `Raw temporal detail field "${e.id}" selects a custom pattern but has no customFormat.`,
75
- { fieldId: e.id }
76
- );
77
- return {
78
- type: "raw_temporal",
79
- presentation: {
80
- mode: "pattern",
81
- dialect: "semaphor_tokens",
82
- pattern: e.customFormat
83
- }
84
- };
85
- }
86
- return e.dateFormat ? {
87
- type: "raw_temporal",
88
- presentation: {
89
- mode: "pattern",
90
- dialect: "semaphor_tokens",
91
- pattern: e.dateFormat
92
- }
93
- } : k();
87
+ return I();
94
88
  }
95
89
  function D(e) {
96
- var s;
90
+ var i;
97
91
  if (e != null && e.useRelativeTime) return;
98
- if (!e) return k();
99
- if (e.useCustomFormat && !((s = e.customFormat) != null && s.trim()))
100
- throw new m(
92
+ if (!e) return I();
93
+ if (e.useCustomFormat && !((i = e.customFormat) != null && i.trim()))
94
+ throw new l(
101
95
  "invalid_raw_temporal_format",
102
96
  "Declared SQL temporal presentation selects a custom pattern but has no customFormat.",
103
97
  { reason: "missing_declared_sql_custom_date_format" }
104
98
  );
105
- const a = e.useCustomFormat && e.customFormat ? e.customFormat : e.format, t = e.timezone, r = e.sourceTimezone, o = t && t !== "auto" ? { timezone: t } : void 0, n = {
106
- sourceTimezone: r && r !== "auto" ? r : "UTC"
99
+ const a = e.useCustomFormat && e.customFormat ? e.customFormat : e.format, t = e.timezone, n = e.sourceTimezone, o = t && t !== "auto" ? { timezone: t } : void 0, r = {
100
+ sourceTimezone: n && n !== "auto" ? n : "UTC"
107
101
  };
108
- return a ? {
102
+ return !a && e.preset ? {
103
+ type: "raw_temporal",
104
+ ...o,
105
+ ...r,
106
+ presentation: { mode: "preset", preset: e.preset }
107
+ } : a ? {
109
108
  type: "raw_temporal",
110
109
  ...o,
111
- ...n,
110
+ ...r,
112
111
  presentation: {
113
112
  mode: "pattern",
114
- dialect: "date_fns",
113
+ dialect: e.useCustomFormat ? "date_fns" : e.dialect ?? "date_fns",
115
114
  pattern: a
116
115
  }
117
116
  } : {
118
117
  type: "raw_temporal",
119
118
  ...o,
120
- ...n,
119
+ ...r,
121
120
  presentation: { mode: "auto" }
122
121
  };
123
122
  }
124
- function le(e) {
123
+ function ce(e) {
125
124
  return e === "instant" ? "yyyy-MM-dd'T'HH:mm:ssXXX" : e === "wall_datetime" ? "yyyy-MM-dd'T'HH:mm:ss" : "yyyy-MM-dd";
126
125
  }
127
- function ie(e) {
128
- L({
126
+ function me(e) {
127
+ N({
129
128
  dialect: "date_fns",
130
129
  pattern: e.pattern,
131
130
  valueKind: e.valueKind
132
131
  });
133
132
  }
134
- function V(e) {
133
+ function Q(e) {
135
134
  const a = D(e.settings);
136
135
  if (!a)
137
- throw new m(
136
+ throw new l(
138
137
  "invalid_raw_temporal_format",
139
138
  "Relative-time SQL presentation does not have an absolute date preview."
140
139
  );
141
- const t = e.valueKind ?? (a.presentation.mode === "pattern" ? "instant" : "date"), r = {
140
+ const t = e.valueKind ?? (a.presentation.mode === "pattern" ? "instant" : "date"), n = {
142
141
  kind: "raw_temporal",
143
142
  valueKind: t
144
- }, o = e.value ?? (t === "date" ? "2023-05-15" : t === "wall_datetime" ? "2023-05-15T14:30:45" : "2023-05-15T14:30:45Z"), n = g({
145
- metadata: r,
143
+ }, o = e.value ?? (t === "date" ? "2023-05-15" : t === "wall_datetime" ? "2023-05-15T14:30:45" : "2023-05-15T14:30:45Z"), r = h({
144
+ metadata: n,
146
145
  format: b({
147
146
  format: a,
148
147
  preferences: e.preferences,
149
148
  calendar: { tz: e.calendarTimezone }
150
149
  })
151
150
  })(o);
152
- if (!n.ok)
153
- throw new m(
151
+ if (!r.ok)
152
+ throw new l(
154
153
  "invalid_raw_temporal_format",
155
- n.diagnostic.message
154
+ r.diagnostic.message
156
155
  );
157
- return n.text;
156
+ return r.text;
158
157
  }
159
- function me(e) {
158
+ function de(e) {
160
159
  try {
161
- return { ok: !0, text: V(e) };
160
+ return { ok: !0, text: Q(e) };
162
161
  } catch (a) {
163
162
  return {
164
163
  ok: !1,
@@ -166,54 +165,12 @@ function me(e) {
166
165
  };
167
166
  }
168
167
  }
169
- function I(e) {
168
+ function H(e) {
170
169
  var t;
171
170
  const a = e.effectiveCardConfig ?? e.card.config;
172
- return R(e.card, a) === "freeform" && !!((t = e.card.sql) != null && t.trim()) && !M(e.card.python || "").trim();
173
- }
174
- function Q(e) {
175
- var a, t;
176
- return e.type !== "table" && e.type !== "detailTable" || !I({ card: e }) ? !1 : Object.values(
177
- ((t = (a = e.preferences) == null ? void 0 : a.tablePrefs) == null ? void 0 : t.columnSettingsMap) || {}
178
- ).some(
179
- (r) => {
180
- var o, n, s;
181
- return r.type === "date" && ((o = r.dateFormat) == null ? void 0 : o.useRelativeTime) !== !0 && ((n = r.dateFormat) == null ? void 0 : n.useCustomFormat) === !0 && !((s = r.dateFormat.customFormat) != null && s.trim());
182
- }
183
- );
184
- }
185
- function ce(e) {
186
- var t, r, o;
187
- if (!Q(e)) return e;
188
- const a = ((r = (t = e.preferences) == null ? void 0 : t.tablePrefs) == null ? void 0 : r.columnSettingsMap) || {};
189
- return {
190
- ...e,
191
- preferences: {
192
- ...e.preferences,
193
- tablePrefs: {
194
- ...(o = e.preferences) == null ? void 0 : o.tablePrefs,
195
- columnSettingsMap: Object.fromEntries(
196
- Object.entries(a).map(([n, s]) => {
197
- var l, p, i;
198
- return [
199
- n,
200
- s.type === "date" && ((l = s.dateFormat) == null ? void 0 : l.useRelativeTime) !== !0 && ((p = s.dateFormat) == null ? void 0 : p.useCustomFormat) === !0 && !((i = s.dateFormat.customFormat) != null && i.trim()) ? {
201
- ...s,
202
- dateFormat: {
203
- ...s.dateFormat,
204
- format: "",
205
- useCustomFormat: !1,
206
- customFormat: ""
207
- }
208
- } : s
209
- ];
210
- })
211
- )
212
- }
213
- }
214
- };
171
+ return R(e.card, a) === "freeform" && !!((t = e.card.sql) != null && t.trim()) && !S(e.card.python || "").trim();
215
172
  }
216
- function B() {
173
+ function X() {
217
174
  return {
218
175
  activatedColumnKeys: /* @__PURE__ */ new Set(),
219
176
  byColumnKey: /* @__PURE__ */ new Map(),
@@ -223,118 +180,118 @@ function B() {
223
180
  function T(e, a) {
224
181
  return e === void 0 ? { kind: "invalid", error: a } : {
225
182
  kind: "invalid",
226
- error: e instanceof m ? e : e instanceof z ? new m(
183
+ error: e instanceof l ? e : e instanceof L ? new l(
227
184
  e.code,
228
185
  e.message,
229
186
  a.context
230
- ) : new m(
187
+ ) : new l(
231
188
  a.code,
232
189
  e instanceof Error ? e.message : a.message,
233
190
  a.context
234
191
  )
235
192
  };
236
193
  }
237
- function H(e) {
194
+ function G(e) {
238
195
  var o;
239
196
  if (e.cardType !== "detailTable" || e.resultOwner !== "config")
240
197
  return { kind: "inactive" };
241
198
  if (!e.result) return { kind: "loading" };
242
- const { records: a, columns: t, columnKeyMap: r } = e.result;
243
- if (!Array.isArray(a) || !Array.isArray(t) || !r)
199
+ const { records: a, columns: t, columnKeyMap: n } = e.result;
200
+ if (!Array.isArray(a) || !Array.isArray(t) || !n)
244
201
  return T(
245
202
  void 0,
246
- new m(
203
+ new l(
247
204
  "missing_raw_temporal_result_contract",
248
205
  "Activated raw temporal detail results require records, columns, and columnKeyMap atomically."
249
206
  )
250
207
  );
251
208
  try {
252
- const n = t.filter((d) => d.rawTemporal);
253
- if (n.length === 0) return { kind: "inactive" };
254
- const s = new Map(
209
+ const r = t.filter((d) => d.rawTemporal);
210
+ if (r.length === 0) return { kind: "inactive" };
211
+ const i = new Map(
255
212
  (((o = e.effectiveCardConfig) == null ? void 0 : o.detailColumns) || []).map((d) => [
256
213
  d.id,
257
214
  d
258
215
  ])
259
- ), l = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map();
260
- for (const d of n) {
261
- const _ = Array.from(s).flatMap(
262
- ([v, x]) => {
263
- const C = P(
264
- r,
265
- v,
216
+ ), c = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map();
217
+ for (const d of r) {
218
+ const _ = Array.from(i).flatMap(
219
+ ([y, A]) => {
220
+ const g = E(
221
+ n,
222
+ y,
266
223
  "detail"
267
224
  );
268
- return C && C.role === "detail" && (C.outputKey ?? C.rawKey) === d.key ? [{ field: x, binding: C }] : [];
225
+ return g && g.role === "detail" && (g.outputKey ?? g.rawKey) === d.key ? [{ field: A, binding: g }] : [];
269
226
  }
270
- ), c = _.length === 1 ? _[0] : null;
271
- if (!c || typeof c.binding.rawKey != "string" || c.binding.rawKey.trim().length === 0 || c.binding.outputKey !== void 0 && (typeof c.binding.outputKey != "string" || c.binding.outputKey.trim().length === 0))
272
- throw new m(
227
+ ), m = _.length === 1 ? _[0] : null;
228
+ if (!m || typeof m.binding.rawKey != "string" || m.binding.rawKey.trim().length === 0 || m.binding.outputKey !== void 0 && (typeof m.binding.outputKey != "string" || m.binding.outputKey.trim().length === 0))
229
+ throw new l(
273
230
  "missing_raw_temporal_column_binding",
274
231
  `Raw temporal result column "${d.key}" does not have one valid exact detail result binding.`,
275
232
  { columnKey: d.key }
276
233
  );
277
- const { field: u, binding: h } = c, f = h.outputKey ?? h.rawKey, w = S(d, {
234
+ const { field: u, binding: C } = m, f = C.outputKey ?? C.rawKey, p = x(d, {
278
235
  metadataRequired: !0
279
236
  });
280
- if (!w)
281
- throw new m(
237
+ if (!p)
238
+ throw new l(
282
239
  "invalid_raw_temporal_metadata",
283
240
  `Raw temporal result column "${f}" has no metadata.`,
284
241
  { fieldId: u.id, columnKey: f }
285
242
  );
286
- const y = b({
287
- format: U(u),
243
+ const w = b({
244
+ format: V(u),
288
245
  preferences: e.preferences,
289
246
  calendar: e.calendar
290
- }), F = {
247
+ }), K = {
291
248
  fieldId: u.id,
292
249
  columnKey: f,
293
- metadata: w,
294
- format: y,
295
- formatValue: g({ metadata: w, format: y })
250
+ metadata: p,
251
+ format: w,
252
+ formatValue: h({ metadata: p, format: w })
296
253
  };
297
- for (let v = 0; v < a.length; v += 1)
298
- if (!Object.prototype.hasOwnProperty.call(a[v], f) || a[v][f] === void 0)
299
- throw new m(
254
+ for (let y = 0; y < a.length; y += 1)
255
+ if (!Object.prototype.hasOwnProperty.call(a[y], f) || a[y][f] === void 0)
256
+ throw new l(
300
257
  "missing_raw_temporal_result_contract",
301
- `Raw temporal result row ${v} is missing column "${f}".`,
258
+ `Raw temporal result row ${y} is missing column "${f}".`,
302
259
  { fieldId: u.id, columnKey: f }
303
260
  );
304
- l.set(f, F), p.set(u.id, F);
261
+ c.set(f, K), v.set(u.id, K);
305
262
  }
306
- const i = {
307
- activatedColumnKeys: new Set(l.keys()),
308
- byColumnKey: l,
309
- byFieldId: p
263
+ const s = {
264
+ activatedColumnKeys: new Set(c.keys()),
265
+ byColumnKey: c,
266
+ byFieldId: v
310
267
  };
311
- return a.length === 0 ? { kind: "loaded_empty", presentation: i } : { kind: "loaded_valid", presentation: i };
312
- } catch (n) {
268
+ return a.length === 0 ? { kind: "loaded_empty", presentation: s } : { kind: "loaded_valid", presentation: s };
269
+ } catch (r) {
313
270
  return T(
314
- n,
315
- new m(
271
+ r,
272
+ new l(
316
273
  "invalid_raw_temporal_metadata",
317
274
  "Activated raw temporal result metadata is invalid."
318
275
  )
319
276
  );
320
277
  }
321
278
  }
322
- function X(e) {
323
- var r, o, n;
279
+ function Y(e) {
280
+ var n;
324
281
  const a = e.effectiveCardConfig ?? e.card.config, t = R(
325
282
  e.card,
326
283
  a
327
284
  );
328
285
  if (e.card.type === "detailTable" && t === "config") {
329
- const s = !!((r = e.columns) != null && r.some((l) => l.rawTemporal));
330
- return s && e.records !== void 0 && !e.columnKeyMap ? {
286
+ const o = !!((n = e.columns) != null && n.some((r) => r.rawTemporal));
287
+ return o && e.records !== void 0 && !e.columnKeyMap ? {
331
288
  kind: "invalid",
332
- error: new m(
289
+ error: new l(
333
290
  "missing_raw_temporal_result_contract",
334
291
  "Activated raw temporal detail results require records, columns, and columnKeyMap atomically."
335
292
  )
336
- } : e.records !== void 0 && !s ? { kind: "inactive" } : K(
337
- H({
293
+ } : e.records !== void 0 && !o ? { kind: "inactive" } : M(
294
+ G({
338
295
  cardType: e.card.type,
339
296
  resultOwner: t,
340
297
  effectiveCardConfig: a,
@@ -349,51 +306,51 @@ function X(e) {
349
306
  e
350
307
  );
351
308
  }
352
- return K(
353
- G({
309
+ return M(
310
+ Z({
354
311
  resultOwner: t,
355
312
  sql: e.card.sql,
356
- normalizedPython: M(
313
+ normalizedPython: S(
357
314
  e.card.python || ""
358
315
  ),
359
316
  records: e.records,
360
317
  columns: e.columns,
361
- columnSettings: (n = (o = e.card.preferences) == null ? void 0 : o.tablePrefs) == null ? void 0 : n.columnSettingsMap,
318
+ columnSettings: k(e.card),
362
319
  preferences: e.preferences,
363
320
  calendar: e.calendar
364
321
  }),
365
322
  e
366
323
  );
367
324
  }
368
- function de(e) {
369
- var r, o, n;
325
+ function ue(e) {
326
+ var n;
370
327
  const a = e.effectiveCardConfig ?? e.card.config, t = R(
371
328
  e.card,
372
329
  a
373
330
  );
374
- return e.card.type === "detailTable" && t === "config" ? !!((r = e.columns) != null && r.some((s) => s.rawTemporal)) : I(e) ? Object.values(
375
- ((n = (o = e.card.preferences) == null ? void 0 : o.tablePrefs) == null ? void 0 : n.columnSettingsMap) || {}
331
+ return e.card.type === "detailTable" && t === "config" ? !!((n = e.columns) != null && n.some((o) => o.rawTemporal)) : H(e) ? Object.values(
332
+ k(e.card)
376
333
  ).some(
377
- (s) => {
378
- var l;
379
- return s.type === "date" && !((l = s.dateFormat) != null && l.useRelativeTime);
334
+ (o) => {
335
+ var r;
336
+ return o.type === "date" && !((r = o.dateFormat) != null && r.useRelativeTime);
380
337
  }
381
338
  ) : !1;
382
339
  }
383
- function K(e, a) {
340
+ function M(e, a) {
384
341
  if (!a.executionSnapshot || e.kind === "inactive" || e.kind === "loading" || e.kind === "invalid")
385
342
  return e;
386
343
  if (!a.dashboardId)
387
344
  return {
388
345
  kind: "invalid",
389
- error: new m(
346
+ error: new l(
390
347
  "missing_raw_temporal_result_contract",
391
348
  "A dashboard ID is required to resolve the captured raw temporal presentation."
392
349
  )
393
350
  };
394
- const t = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
351
+ const t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
395
352
  for (const o of e.presentation.activatedColumnKeys) {
396
- const n = E({
353
+ const r = P({
397
354
  snapshot: a.executionSnapshot,
398
355
  scope: {
399
356
  dashboardId: a.dashboardId,
@@ -402,136 +359,136 @@ function K(e, a) {
402
359
  },
403
360
  target: { kind: "column", columnKey: o }
404
361
  });
405
- if (!n)
362
+ if (!r)
406
363
  return {
407
364
  kind: "invalid",
408
- error: new O(o)
365
+ error: new q(o)
409
366
  };
410
- const s = e.presentation.byColumnKey.get(o);
411
- if (!s) continue;
412
- const l = {
413
- ...s,
414
- format: n,
415
- formatValue: g({
416
- metadata: s.metadata,
417
- format: n
367
+ const i = e.presentation.byColumnKey.get(o);
368
+ if (!i) continue;
369
+ const c = {
370
+ ...i,
371
+ format: r,
372
+ formatValue: h({
373
+ metadata: i.metadata,
374
+ format: r
418
375
  })
419
376
  };
420
- t.set(s.columnKey, l), s.fieldId && r.set(s.fieldId, l);
377
+ t.set(i.columnKey, c), i.fieldId && n.set(i.fieldId, c);
421
378
  }
422
379
  return {
423
380
  ...e,
424
381
  presentation: {
425
382
  activatedColumnKeys: e.presentation.activatedColumnKeys,
426
383
  byColumnKey: t,
427
- byFieldId: r
384
+ byFieldId: n
428
385
  }
429
386
  };
430
387
  }
431
- function G(e) {
432
- var t, r;
433
- if (e.resultOwner !== "freeform" || !((t = e.sql) != null && t.trim()) || (r = e.normalizedPython) != null && r.trim())
388
+ function Z(e) {
389
+ var t, n;
390
+ if (e.resultOwner !== "freeform" || !((t = e.sql) != null && t.trim()) || (n = e.normalizedPython) != null && n.trim())
434
391
  return { kind: "inactive" };
435
392
  const a = Object.entries(
436
393
  e.columnSettings || {}
437
394
  ).filter(
438
395
  ([, o]) => {
439
- var n;
440
- return o.type === "date" && !((n = o.dateFormat) != null && n.useRelativeTime);
396
+ var r;
397
+ return o.type === "date" && !((r = o.dateFormat) != null && r.useRelativeTime);
441
398
  }
442
399
  );
443
400
  if (a.length === 0) return { kind: "inactive" };
444
401
  if (!e.records) return { kind: "loading" };
445
402
  try {
446
- const o = /* @__PURE__ */ new Map(), n = new Set(
447
- a.map(([i]) => i)
448
- ), s = /* @__PURE__ */ new Map(), l = [...e.columns || []];
449
- for (const [i, d] of a) {
403
+ const o = /* @__PURE__ */ new Map(), r = new Set(
404
+ a.map(([s]) => s)
405
+ ), i = /* @__PURE__ */ new Map(), c = [...e.columns || []];
406
+ for (const [s, d] of a) {
450
407
  const _ = D(
451
408
  d.dateFormat
452
409
  );
453
410
  if (!_) continue;
454
- const c = q({
455
- columnKey: i,
456
- values: e.records.map((w) => {
457
- if (!Object.prototype.hasOwnProperty.call(w, i))
458
- throw new m(
411
+ const m = z({
412
+ columnKey: s,
413
+ values: e.records.map((p) => {
414
+ if (!Object.prototype.hasOwnProperty.call(p, s))
415
+ throw new l(
459
416
  "missing_raw_temporal_result_contract",
460
- `Declared SQL temporal column "${i}" is absent from a physical result row.`,
461
- { columnKey: i }
417
+ `Declared SQL temporal column "${s}" is absent from a physical result row.`,
418
+ { columnKey: s }
462
419
  );
463
- const y = w[i];
464
- return y === null || typeof y == "string" ? y : String(y);
420
+ const w = p[s];
421
+ return w === null || typeof w == "string" ? w : String(w);
465
422
  })
466
423
  });
467
- if (s.set(i, c), c.status !== "classified") continue;
468
- let u = l.findIndex(
469
- (w) => w.key === i
424
+ if (i.set(s, m), m.status !== "classified") continue;
425
+ let u = c.findIndex(
426
+ (p) => p.key === s
470
427
  );
471
428
  if (e.columns && u < 0)
472
- throw new m(
429
+ throw new l(
473
430
  "missing_raw_temporal_result_contract",
474
- `Classified SQL temporal column "${i}" is absent from result columns.`,
475
- { columnKey: i }
431
+ `Classified SQL temporal column "${s}" is absent from result columns.`,
432
+ { columnKey: s }
476
433
  );
477
- u < 0 && (u = l.length, l.push({
478
- key: i,
479
- name: i,
480
- label: i,
434
+ u < 0 && (u = c.length, c.push({
435
+ key: s,
436
+ name: s,
437
+ label: s,
481
438
  role: "dimension",
482
439
  dataType: "string"
483
440
  }));
484
- const h = {
485
- ...l[u],
441
+ const C = {
442
+ ...c[u],
486
443
  role: "date",
487
- dataType: c.metadata.valueKind === "date" ? "date" : "datetime",
488
- rawTemporal: c.metadata
444
+ dataType: m.metadata.valueKind === "date" ? "date" : "datetime",
445
+ rawTemporal: m.metadata
489
446
  };
490
- S(h, {
447
+ x(C, {
491
448
  metadataRequired: !0
492
- }), l[u] = h;
449
+ }), c[u] = C;
493
450
  const f = b({
494
451
  format: _,
495
452
  preferences: e.preferences,
496
453
  calendar: e.calendar
497
454
  });
498
- o.set(i, {
499
- columnKey: i,
500
- metadata: c.metadata,
455
+ o.set(s, {
456
+ columnKey: s,
457
+ metadata: m.metadata,
501
458
  format: f,
502
- formatValue: g({
503
- metadata: c.metadata,
459
+ formatValue: h({
460
+ metadata: m.metadata,
504
461
  format: f
505
462
  })
506
463
  });
507
464
  }
508
- const p = {
509
- ...B(),
510
- activatedColumnKeys: n,
465
+ const v = {
466
+ ...X(),
467
+ activatedColumnKeys: r,
511
468
  byColumnKey: o
512
469
  };
513
470
  return e.records.length === 0 ? {
514
471
  kind: "loaded_empty",
515
- presentation: p,
516
- adaptedColumns: l,
517
- sqlClassifications: s
472
+ presentation: v,
473
+ adaptedColumns: c,
474
+ sqlClassifications: i
518
475
  } : {
519
476
  kind: "loaded_valid",
520
- presentation: p,
521
- adaptedColumns: l,
522
- sqlClassifications: s
477
+ presentation: v,
478
+ adaptedColumns: c,
479
+ sqlClassifications: i
523
480
  };
524
481
  } catch (o) {
525
482
  return T(
526
483
  o,
527
- new m(
484
+ new l(
528
485
  "invalid_raw_temporal_format",
529
486
  "Declared SQL raw temporal presentation is invalid."
530
487
  )
531
488
  );
532
489
  }
533
490
  }
534
- function ue(e) {
491
+ function fe(e) {
535
492
  if (e.value !== null && typeof e.value != "string")
536
493
  return {
537
494
  value: e.value,
@@ -548,37 +505,36 @@ function ue(e) {
548
505
  const a = e.presentation.formatValue(e.value);
549
506
  return { value: e.value, label: a.text, result: a };
550
507
  }
551
- function fe(e) {
508
+ function pe(e) {
552
509
  if (!e.result || typeof e.result != "object") return !1;
553
510
  const a = e.result;
554
511
  if (e.expectedResultOwner !== void 0 && a.resultOwner !== e.expectedResultOwner || !Array.isArray(a.records)) return !1;
555
- const t = X({
512
+ const t = Y({
556
513
  card: e.card,
557
514
  effectiveCardConfig: e.effectiveCardConfig,
558
515
  records: a.records,
559
516
  columns: a.columns,
560
517
  columnKeyMap: a.columnKeyMap,
561
- preferences: A,
518
+ preferences: O,
562
519
  calendar: { tz: "UTC" }
563
520
  });
564
521
  return t.kind === "inactive" || t.kind === "loaded_empty" || t.kind === "loaded_valid";
565
522
  }
566
523
  export {
567
- m as R,
568
- ne as a,
569
- se as b,
570
- U as c,
571
- D as d,
572
- H as e,
573
- X as f,
574
- de as g,
575
- le as h,
576
- fe as i,
577
- me as j,
578
- I as k,
579
- ce as l,
580
- Q as m,
581
- ue as p,
582
- j as r,
583
- ie as v
524
+ l as R,
525
+ V as a,
526
+ D as b,
527
+ F as c,
528
+ se as d,
529
+ B as e,
530
+ G as f,
531
+ Y as g,
532
+ ue as h,
533
+ pe as i,
534
+ ce as j,
535
+ de as k,
536
+ H as l,
537
+ fe as p,
538
+ ie as r,
539
+ me as v
584
540
  };