react-semaphor 0.1.559 → 0.1.561

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 (168) hide show
  1. package/dist/analytics-protocol/index.js +389 -378
  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-CB3oFAXk.js +658 -0
  7. package/dist/chunks/{assistant-chat-B_4bVE6I.js → assistant-chat-DiVHY3Hw.js} +209 -211
  8. package/dist/chunks/bookmark-impact-CR09dpkn.js +75 -0
  9. package/dist/chunks/bookmark-state-BusLpkb7.js +743 -0
  10. package/dist/chunks/{braces-Rdxa3H-s.js → braces-u8VorWJc.js} +1 -1
  11. package/dist/chunks/{comparison-window-caption-CKzQ5LcF.js → comparison-window-caption-DDsIWJYT.js} +201 -201
  12. package/dist/chunks/{context-DVy4HOU0.js → context-TUjw9eqr.js} +1 -1
  13. package/dist/chunks/{custom-visual-inputs-zVa9wX_o.js → custom-visual-inputs-DfolidZ9.js} +1 -1
  14. package/dist/chunks/{dashboard-BziwOVpZ.js → dashboard-BRdZBPqr.js} +1 -1
  15. package/dist/chunks/{dashboard-briefing-launcher-CbeNR-YI.js → dashboard-briefing-launcher-CgvTLndW.js} +1163 -1178
  16. package/dist/chunks/{dashboard-controls-RD6UJs1r.js → dashboard-controls-B4vfSzTF.js} +877 -941
  17. package/dist/chunks/{dashboard-json-DGpv17vL.js → dashboard-json-Y3MF59g7.js} +5 -5
  18. package/dist/chunks/document-dashboard-inputs-CvBbFTUA.js +1718 -0
  19. package/dist/chunks/{edit-dashboard-visual-AQ2pQkFp.js → edit-dashboard-visual-DwjZcxj-.js} +9080 -9354
  20. package/dist/chunks/filter-reach-copy-bijwf_-b.js +3596 -0
  21. package/dist/chunks/{filter-value-text-B4l-xqJT.js → filter-value-text-DFnhwuEW.js} +3 -3
  22. package/dist/chunks/global-date-filter-utils-BXgCpvQM.js +15142 -0
  23. package/dist/chunks/{index-B1Xr7W24.js → index-ClwbY3BL.js} +648 -674
  24. package/dist/chunks/{layout-grid-Bbz3zKif.js → layout-grid-CtvCBfOm.js} +1 -1
  25. package/dist/chunks/{list-filter-3sbH0Uy1.js → list-filter-BklYgciR.js} +1 -1
  26. package/dist/chunks/{matrix-analytical-definition-CEe3PGEo.js → matrix-analytical-definition-pU51-JmY.js} +4 -4
  27. package/dist/chunks/{matrix-card-BRNGb1C4.js → matrix-card-CUorIB7Q.js} +3 -3
  28. package/dist/chunks/{matrix-member-presentation-CEegvTqg.js → matrix-member-presentation-Df5UgCGN.js} +1 -1
  29. package/dist/chunks/{matrix-operation-contract-COxrfQTS.js → matrix-operation-contract-BSiGEXVC.js} +221 -214
  30. package/dist/chunks/{metric-comparison-DQx-uX__.js → metric-comparison-95aC0uEO.js} +6 -6
  31. package/dist/chunks/{model-change-CJEj3ZD6.js → model-change-B5wQhg5G.js} +1 -1
  32. package/dist/chunks/{palette-DMJtp3Vn.js → palette-DTnMhipt.js} +1 -1
  33. package/dist/chunks/pivot-result-contract-expectations-Bo-86vwS.js +56 -0
  34. package/dist/chunks/{pivot-result-identity-CAj8SiRL.js → pivot-result-identity-olvXJoB9.js} +1 -1
  35. package/dist/chunks/{report-preferences-dialog-0sc8B1lh.js → report-preferences-dialog-C2YUIwKG.js} +55 -55
  36. package/dist/chunks/{report-runtime-context-bYoExeWr.js → report-runtime-context-DoIUr3MP.js} +2 -2
  37. package/dist/chunks/resolve-dashboard-input-context-q_iiNXE1.js +6503 -0
  38. package/dist/chunks/{save-DSb1jTtG.js → save-DH4RyrnG.js} +1 -1
  39. package/dist/chunks/{saved-dashboard-context-BQWM3ldX.js → saved-dashboard-context-8jqfI7hI.js} +59 -59
  40. package/dist/chunks/{selection-reducer-DSzMWb4x.js → selection-reducer-CV7K4FI6.js} +1 -1
  41. package/dist/chunks/{semaphor-ready-indicator-Bz14Oma5.js → semaphor-ready-indicator-E2XWyibu.js} +40105 -41658
  42. package/dist/chunks/{shelf-drop-preview-context-DBHAkgch.js → shelf-drop-preview-context-C29EUzDp.js} +570 -570
  43. package/dist/chunks/{source-entity-resolution-BOrmNCEM.js → source-entity-resolution-BXI3nQ5Z.js} +1 -1
  44. package/dist/chunks/{switch-Dq8XPFpT.js → switch-balDSHc7.js} +3 -3
  45. package/dist/chunks/{table-export-sheet-C_RvEUyO.js → table-export-sheet-CK8tvh4d.js} +1 -1
  46. package/dist/chunks/temporal-input-presentation-B77JsAzU.js +5002 -0
  47. package/dist/chunks/{token-types-LCYMJ3pa.js → token-types-DhYH5YKb.js} +1 -1
  48. package/dist/chunks/{upload-Dr_WAxHQ.js → upload-Ufj8vjyn.js} +1 -1
  49. package/dist/chunks/{use-create-flow-overlay-state-BK3YFkfc.js → use-create-flow-overlay-state-9WsnzEO5.js} +6 -6
  50. package/dist/chunks/{validators-C87JPd-_.js → validators-BtaCFIEB.js} +1206 -1579
  51. package/dist/chunks/{zoned-wall-clock-E35Frf9v.js → zoned-wall-clock-CGLVI40Q.js} +1 -1
  52. package/dist/dashboard/index.js +2 -2
  53. package/dist/dashboard-authoring/index.js +2713 -1459
  54. package/dist/data-app-sdk/index.js +20 -20
  55. package/dist/data-app-sdk-adapters/index.js +3 -3
  56. package/dist/data-app-sdk-validation/index.js +10 -10
  57. package/dist/format-utils/index.js +262 -256
  58. package/dist/index.js +214 -215
  59. package/dist/report-runtime-context/index.js +2 -2
  60. package/dist/style.css +1 -1
  61. package/dist/surfboard/index.js +2 -2
  62. package/dist/types/components/dashboard/summary-number-formatter.d.ts +6 -0
  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 +50 -51
  66. package/dist/types/lib/formatters/canonical-format-adapter.d.ts +2 -29
  67. package/dist/types/lib/formatters/kpi-number-formatter.d.ts +41 -0
  68. package/dist/types/lib/formatters/raw-temporal-presentation.d.ts +0 -2
  69. package/dist/types/lib/formatters/table-column-settings.d.ts +47 -0
  70. package/dist/types/lib/matrix-table/matrix-card-adapter.d.ts +10 -188
  71. package/dist/types/lib/matrix-table/matrix-delivery-policy.d.ts +1 -1
  72. package/dist/types/lib/matrix-table/matrix-delivery.d.ts +16 -372
  73. package/dist/types/lib/stores/dashboard-store.d.ts +0 -1
  74. package/dist/types/lib/stores/editor-store.d.ts +48 -10
  75. package/dist/types/lib/stores/table-actions.d.ts +9 -5
  76. package/dist/types/lib/table-formatting/index.d.ts +0 -2
  77. package/dist/types/lib/table-formatting/table-conditional-formatting-range-source.d.ts +3 -2
  78. package/dist/types/lib/table-formatting/table-conditional-formatting-range.d.ts +3 -2
  79. package/dist/types/lib/table-formatting/table-formatting-normalize.d.ts +1 -2
  80. package/dist/types/lib/table-formatting/table-formatting-render-model.d.ts +9 -0
  81. package/dist/types/lib/table-formatting/table-formatting-types.d.ts +5 -95
  82. package/dist/types/lib/table-formatting/table-presentation-fields.d.ts +35 -0
  83. package/dist/types/lib/types/common-types.d.ts +40 -47
  84. package/dist/types/lib/types/explorer-types.d.ts +11 -43
  85. package/dist/types/lib/utils/card-config-utils.d.ts +8 -0
  86. package/dist/types/lib/utils/card-definition.d.ts +9 -187
  87. package/dist/types/shared/analytics-protocol/analytics-base-schemas.d.ts +169 -513
  88. package/dist/types/shared/analytics-protocol/contracts.d.ts +32 -9
  89. package/dist/types/shared/analytics-protocol/execution-input-schemas.d.ts +108 -980
  90. package/dist/types/shared/analytics-protocol/field-validation.d.ts +1 -0
  91. package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +281 -4624
  92. package/dist/types/shared/analytics-protocol/matrix-operation-contract.d.ts +20 -20
  93. package/dist/types/shared/analytics-protocol/matrix-operation-request.d.ts +18 -18
  94. package/dist/types/shared/analytics-protocol/matrix-path-contract.d.ts +40 -40
  95. package/dist/types/shared/analytics-protocol/matrix-window-contract.d.ts +3 -203
  96. package/dist/types/shared/analytics-protocol/measure-aggregation-profile.d.ts +12 -0
  97. package/dist/types/shared/analytics-protocol/scalar-value.d.ts +8 -8
  98. package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +8 -0
  99. package/dist/types/shared/assistant-protocol/context.d.ts +69 -69
  100. package/dist/types/shared/dashboard-authoring/canonical-result-keys.d.ts +13 -0
  101. package/dist/types/shared/dashboard-authoring/card-export-request.d.ts +4 -1
  102. package/dist/types/shared/dashboard-authoring/card-formats/sql-date-pattern.d.ts +10 -0
  103. package/dist/types/shared/dashboard-authoring/card-formats/upgrade-card-formats.d.ts +57 -0
  104. package/dist/types/shared/dashboard-authoring/card-settings/apply-card-settings.d.ts +11 -0
  105. package/dist/types/shared/dashboard-authoring/card-settings/card-display-write.d.ts +52 -0
  106. package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +14 -0
  107. package/dist/types/shared/dashboard-authoring/card-settings/carry-column-settings.d.ts +3 -0
  108. package/dist/types/shared/dashboard-authoring/card-settings/column-format-write.d.ts +8 -0
  109. package/dist/types/shared/dashboard-authoring/card-settings/column-names.d.ts +51 -0
  110. package/dist/types/shared/dashboard-authoring/card-settings/column-sources.d.ts +14 -0
  111. package/dist/types/shared/dashboard-authoring/card-settings/confirm-class.d.ts +9 -0
  112. package/dist/types/shared/dashboard-authoring/card-settings/highlight-inputs.d.ts +19 -0
  113. package/dist/types/shared/dashboard-authoring/card-settings/index.d.ts +15 -0
  114. package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +102 -0
  115. package/dist/types/shared/dashboard-authoring/card-settings/read-card-settings.d.ts +10 -0
  116. package/dist/types/shared/dashboard-authoring/card-settings/resolve-card-highlights.d.ts +14 -0
  117. package/dist/types/shared/dashboard-authoring/card-settings/resolve-card-settings.d.ts +59 -0
  118. package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +40 -0
  119. package/dist/types/shared/dashboard-authoring/card-settings/views.d.ts +28 -0
  120. package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +6 -0
  121. package/dist/types/shared/dashboard-authoring/changes/card-types.d.ts +32 -0
  122. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +555 -38
  123. package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +27 -8
  124. package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-changes.d.ts +25 -1
  125. package/dist/types/shared/dashboard-authoring/conditional-formatting/editable.d.ts +14 -0
  126. package/dist/types/shared/dashboard-authoring/conditional-formatting/evaluate.d.ts +16 -0
  127. package/dist/types/shared/dashboard-authoring/conditional-formatting/index.d.ts +9 -0
  128. package/dist/types/shared/dashboard-authoring/conditional-formatting/kpi.d.ts +7 -0
  129. package/dist/types/shared/dashboard-authoring/conditional-formatting/resolve-card-column-ref.d.ts +17 -0
  130. package/dist/types/shared/dashboard-authoring/conditional-formatting/retain.d.ts +14 -0
  131. package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +4499 -0
  132. package/dist/types/shared/dashboard-authoring/conditional-formatting/store.d.ts +12 -0
  133. package/dist/types/shared/dashboard-authoring/conditional-formatting/types.d.ts +151 -0
  134. package/dist/types/shared/dashboard-authoring/conditional-formatting/upgrade.d.ts +35 -0
  135. package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +62 -62
  136. package/dist/types/shared/dashboard-authoring/index.d.ts +8 -0
  137. package/dist/types/shared/dashboard-authoring/kpi-figure.d.ts +123 -0
  138. package/dist/types/shared/dashboard-authoring/matrix-authoring.d.ts +4 -5
  139. package/dist/types/shared/dashboard-authoring/matrix-delivery.d.ts +24 -736
  140. package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +21 -1
  141. package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +10 -4
  142. package/dist/types/shared/dashboard-authoring/retired-presentation-fields.d.ts +31 -0
  143. package/dist/types/shared/dashboard-authoring/upgrade-card-presentation.d.ts +14 -0
  144. package/dist/types/shared/dashboard-viewer/bookmark-impact.d.ts +33 -0
  145. package/dist/types/shared/format-utils/formatters/matrix-formatter.d.ts +13 -2
  146. package/dist/types/shared/format-utils/formatters/number-formatter.d.ts +16 -0
  147. package/dist/types/shared/format-utils/index.d.ts +2 -0
  148. package/dist/types/shared/format-utils/matrix-export-presentation.d.ts +10 -366
  149. package/dist/types/shared/format-utils/raw-temporal.d.ts +31 -1
  150. package/dist/types/shared/format-utils/resolve-column-format.d.ts +43 -0
  151. package/dist/types/shared/format-utils/retired-format-adapters.d.ts +68 -0
  152. package/dist/types/shared/format-utils/semantic-format.d.ts +5 -1
  153. package/dist/types/shared/format-utils/stored-value-format.d.ts +16 -0
  154. package/dist/types/shared/format-utils/types/format-types.d.ts +10 -12
  155. package/package.json +2 -2
  156. package/dist/chunks/analytics-base-schemas-BUFUoO6G.js +0 -472
  157. package/dist/chunks/bookmark-state-ssqrs5oP.js +0 -111
  158. package/dist/chunks/document-dashboard-inputs-ChVkcBuu.js +0 -3010
  159. package/dist/chunks/editor-draft-sync-BN5qYHPF.js +0 -15
  160. package/dist/chunks/filter-reach-copy-B5Y7FHzg.js +0 -3411
  161. package/dist/chunks/global-date-filter-utils-DBzEOX9M.js +0 -12222
  162. package/dist/chunks/pivot-result-contract-expectations-DOYhqeZb.js +0 -1926
  163. package/dist/chunks/raw-temporal-presentation-BmT7z6NH.js +0 -584
  164. package/dist/chunks/resolve-dashboard-input-context-B_C_VAJH.js +0 -5520
  165. package/dist/chunks/table-settings-DXj_zXwS.js +0 -637
  166. package/dist/chunks/temporal-input-presentation-AhLSkGPf.js +0 -2939
  167. package/dist/types/lib/table-formatting/table-conditional-formatting-evaluator.d.ts +0 -9
  168. package/dist/types/lib/table-formatting/table-formatting-validation.d.ts +0 -12
@@ -1,584 +0,0 @@
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";
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) {
12
- if (t && (a === "groupby" || a === "pivotby"))
13
- return t;
14
- if (a === "metric" && e.name === "*" && !e.expression)
15
- return e.alias || "count";
16
- if (e.alias) return e.alias;
17
- const r = e.entityName && e.entityName !== $ ? e.entityName : void 0;
18
- if (e.role === "metric") {
19
- let o = e.aggregate || "metric";
20
- if (e.expression) {
21
- const n = e.expression.match(
22
- /^(COUNT|SUM|AVG|MIN|MAX|MEDIAN|DISTINCT)\s*\(/i
23
- );
24
- o = n ? n[1].toLowerCase() : "expr";
25
- } else
26
- o = o.toLowerCase();
27
- return r && r !== e.name ? `${r}_${e.name}_${o}` : `${e.name}_${o}`;
28
- }
29
- return r && r !== e.name ? `${r}_${e.name}` : e.name;
30
- }
31
- function ne(e) {
32
- return j(e, "detail");
33
- }
34
- function se(e) {
35
- const a = e.label;
36
- return a && e.labelCount === 1 && (a === e.rawKey || !e.rawKeys.has(a)) ? a : e.rawKey;
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";
41
- }
42
- }
43
- function k() {
44
- return { type: "raw_temporal", presentation: { mode: "auto" } };
45
- }
46
- function N(e) {
47
- if (e.locale || e.relative || e.timezone && e.timezone !== "auto" || e.sourceTimezone && e.sourceTimezone !== "auto" || e.prefix || e.suffix)
48
- throw new m(
49
- "invalid_raw_temporal_format",
50
- "Activated raw temporal presentation contains unsupported locale, relative-time, timezone, prefix, or suffix settings."
51
- );
52
- }
53
- function U(e) {
54
- 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
- };
64
- if (a)
65
- throw new m(
66
- "invalid_raw_temporal_format",
67
- `Raw temporal detail field "${e.id}" has an incompatible authored format.`,
68
- { fieldId: e.id }
69
- );
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();
94
- }
95
- function D(e) {
96
- var s;
97
- 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(
101
- "invalid_raw_temporal_format",
102
- "Declared SQL temporal presentation selects a custom pattern but has no customFormat.",
103
- { reason: "missing_declared_sql_custom_date_format" }
104
- );
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"
107
- };
108
- return a ? {
109
- type: "raw_temporal",
110
- ...o,
111
- ...n,
112
- presentation: {
113
- mode: "pattern",
114
- dialect: "date_fns",
115
- pattern: a
116
- }
117
- } : {
118
- type: "raw_temporal",
119
- ...o,
120
- ...n,
121
- presentation: { mode: "auto" }
122
- };
123
- }
124
- function le(e) {
125
- return e === "instant" ? "yyyy-MM-dd'T'HH:mm:ssXXX" : e === "wall_datetime" ? "yyyy-MM-dd'T'HH:mm:ss" : "yyyy-MM-dd";
126
- }
127
- function ie(e) {
128
- L({
129
- dialect: "date_fns",
130
- pattern: e.pattern,
131
- valueKind: e.valueKind
132
- });
133
- }
134
- function V(e) {
135
- const a = D(e.settings);
136
- if (!a)
137
- throw new m(
138
- "invalid_raw_temporal_format",
139
- "Relative-time SQL presentation does not have an absolute date preview."
140
- );
141
- const t = e.valueKind ?? (a.presentation.mode === "pattern" ? "instant" : "date"), r = {
142
- kind: "raw_temporal",
143
- 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,
146
- format: b({
147
- format: a,
148
- preferences: e.preferences,
149
- calendar: { tz: e.calendarTimezone }
150
- })
151
- })(o);
152
- if (!n.ok)
153
- throw new m(
154
- "invalid_raw_temporal_format",
155
- n.diagnostic.message
156
- );
157
- return n.text;
158
- }
159
- function me(e) {
160
- try {
161
- return { ok: !0, text: V(e) };
162
- } catch (a) {
163
- return {
164
- ok: !1,
165
- message: a instanceof Error ? a.message : "Invalid SQL temporal presentation."
166
- };
167
- }
168
- }
169
- function I(e) {
170
- var t;
171
- 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
- };
215
- }
216
- function B() {
217
- return {
218
- activatedColumnKeys: /* @__PURE__ */ new Set(),
219
- byColumnKey: /* @__PURE__ */ new Map(),
220
- byFieldId: /* @__PURE__ */ new Map()
221
- };
222
- }
223
- function T(e, a) {
224
- return e === void 0 ? { kind: "invalid", error: a } : {
225
- kind: "invalid",
226
- error: e instanceof m ? e : e instanceof z ? new m(
227
- e.code,
228
- e.message,
229
- a.context
230
- ) : new m(
231
- a.code,
232
- e instanceof Error ? e.message : a.message,
233
- a.context
234
- )
235
- };
236
- }
237
- function H(e) {
238
- var o;
239
- if (e.cardType !== "detailTable" || e.resultOwner !== "config")
240
- return { kind: "inactive" };
241
- 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)
244
- return T(
245
- void 0,
246
- new m(
247
- "missing_raw_temporal_result_contract",
248
- "Activated raw temporal detail results require records, columns, and columnKeyMap atomically."
249
- )
250
- );
251
- try {
252
- const n = t.filter((d) => d.rawTemporal);
253
- if (n.length === 0) return { kind: "inactive" };
254
- const s = new Map(
255
- (((o = e.effectiveCardConfig) == null ? void 0 : o.detailColumns) || []).map((d) => [
256
- d.id,
257
- d
258
- ])
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,
266
- "detail"
267
- );
268
- return C && C.role === "detail" && (C.outputKey ?? C.rawKey) === d.key ? [{ field: x, binding: C }] : [];
269
- }
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(
273
- "missing_raw_temporal_column_binding",
274
- `Raw temporal result column "${d.key}" does not have one valid exact detail result binding.`,
275
- { columnKey: d.key }
276
- );
277
- const { field: u, binding: h } = c, f = h.outputKey ?? h.rawKey, w = S(d, {
278
- metadataRequired: !0
279
- });
280
- if (!w)
281
- throw new m(
282
- "invalid_raw_temporal_metadata",
283
- `Raw temporal result column "${f}" has no metadata.`,
284
- { fieldId: u.id, columnKey: f }
285
- );
286
- const y = b({
287
- format: U(u),
288
- preferences: e.preferences,
289
- calendar: e.calendar
290
- }), F = {
291
- fieldId: u.id,
292
- columnKey: f,
293
- metadata: w,
294
- format: y,
295
- formatValue: g({ metadata: w, format: y })
296
- };
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(
300
- "missing_raw_temporal_result_contract",
301
- `Raw temporal result row ${v} is missing column "${f}".`,
302
- { fieldId: u.id, columnKey: f }
303
- );
304
- l.set(f, F), p.set(u.id, F);
305
- }
306
- const i = {
307
- activatedColumnKeys: new Set(l.keys()),
308
- byColumnKey: l,
309
- byFieldId: p
310
- };
311
- return a.length === 0 ? { kind: "loaded_empty", presentation: i } : { kind: "loaded_valid", presentation: i };
312
- } catch (n) {
313
- return T(
314
- n,
315
- new m(
316
- "invalid_raw_temporal_metadata",
317
- "Activated raw temporal result metadata is invalid."
318
- )
319
- );
320
- }
321
- }
322
- function X(e) {
323
- var r, o, n;
324
- const a = e.effectiveCardConfig ?? e.card.config, t = R(
325
- e.card,
326
- a
327
- );
328
- 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 ? {
331
- kind: "invalid",
332
- error: new m(
333
- "missing_raw_temporal_result_contract",
334
- "Activated raw temporal detail results require records, columns, and columnKeyMap atomically."
335
- )
336
- } : e.records !== void 0 && !s ? { kind: "inactive" } : K(
337
- H({
338
- cardType: e.card.type,
339
- resultOwner: t,
340
- effectiveCardConfig: a,
341
- result: e.records === void 0 || !e.columns || !e.columnKeyMap ? void 0 : {
342
- records: e.records,
343
- columns: e.columns,
344
- columnKeyMap: e.columnKeyMap
345
- },
346
- preferences: e.preferences,
347
- calendar: e.calendar
348
- }),
349
- e
350
- );
351
- }
352
- return K(
353
- G({
354
- resultOwner: t,
355
- sql: e.card.sql,
356
- normalizedPython: M(
357
- e.card.python || ""
358
- ),
359
- records: e.records,
360
- columns: e.columns,
361
- columnSettings: (n = (o = e.card.preferences) == null ? void 0 : o.tablePrefs) == null ? void 0 : n.columnSettingsMap,
362
- preferences: e.preferences,
363
- calendar: e.calendar
364
- }),
365
- e
366
- );
367
- }
368
- function de(e) {
369
- var r, o, n;
370
- const a = e.effectiveCardConfig ?? e.card.config, t = R(
371
- e.card,
372
- a
373
- );
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) || {}
376
- ).some(
377
- (s) => {
378
- var l;
379
- return s.type === "date" && !((l = s.dateFormat) != null && l.useRelativeTime);
380
- }
381
- ) : !1;
382
- }
383
- function K(e, a) {
384
- if (!a.executionSnapshot || e.kind === "inactive" || e.kind === "loading" || e.kind === "invalid")
385
- return e;
386
- if (!a.dashboardId)
387
- return {
388
- kind: "invalid",
389
- error: new m(
390
- "missing_raw_temporal_result_contract",
391
- "A dashboard ID is required to resolve the captured raw temporal presentation."
392
- )
393
- };
394
- const t = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
395
- for (const o of e.presentation.activatedColumnKeys) {
396
- const n = E({
397
- snapshot: a.executionSnapshot,
398
- scope: {
399
- dashboardId: a.dashboardId,
400
- cardId: a.card.id,
401
- ...a.attachmentIndex !== void 0 ? { attachmentIndex: a.attachmentIndex } : {}
402
- },
403
- target: { kind: "column", columnKey: o }
404
- });
405
- if (!n)
406
- return {
407
- kind: "invalid",
408
- error: new O(o)
409
- };
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
418
- })
419
- };
420
- t.set(s.columnKey, l), s.fieldId && r.set(s.fieldId, l);
421
- }
422
- return {
423
- ...e,
424
- presentation: {
425
- activatedColumnKeys: e.presentation.activatedColumnKeys,
426
- byColumnKey: t,
427
- byFieldId: r
428
- }
429
- };
430
- }
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())
434
- return { kind: "inactive" };
435
- const a = Object.entries(
436
- e.columnSettings || {}
437
- ).filter(
438
- ([, o]) => {
439
- var n;
440
- return o.type === "date" && !((n = o.dateFormat) != null && n.useRelativeTime);
441
- }
442
- );
443
- if (a.length === 0) return { kind: "inactive" };
444
- if (!e.records) return { kind: "loading" };
445
- 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) {
450
- const _ = D(
451
- d.dateFormat
452
- );
453
- 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(
459
- "missing_raw_temporal_result_contract",
460
- `Declared SQL temporal column "${i}" is absent from a physical result row.`,
461
- { columnKey: i }
462
- );
463
- const y = w[i];
464
- return y === null || typeof y == "string" ? y : String(y);
465
- })
466
- });
467
- if (s.set(i, c), c.status !== "classified") continue;
468
- let u = l.findIndex(
469
- (w) => w.key === i
470
- );
471
- if (e.columns && u < 0)
472
- throw new m(
473
- "missing_raw_temporal_result_contract",
474
- `Classified SQL temporal column "${i}" is absent from result columns.`,
475
- { columnKey: i }
476
- );
477
- u < 0 && (u = l.length, l.push({
478
- key: i,
479
- name: i,
480
- label: i,
481
- role: "dimension",
482
- dataType: "string"
483
- }));
484
- const h = {
485
- ...l[u],
486
- role: "date",
487
- dataType: c.metadata.valueKind === "date" ? "date" : "datetime",
488
- rawTemporal: c.metadata
489
- };
490
- S(h, {
491
- metadataRequired: !0
492
- }), l[u] = h;
493
- const f = b({
494
- format: _,
495
- preferences: e.preferences,
496
- calendar: e.calendar
497
- });
498
- o.set(i, {
499
- columnKey: i,
500
- metadata: c.metadata,
501
- format: f,
502
- formatValue: g({
503
- metadata: c.metadata,
504
- format: f
505
- })
506
- });
507
- }
508
- const p = {
509
- ...B(),
510
- activatedColumnKeys: n,
511
- byColumnKey: o
512
- };
513
- return e.records.length === 0 ? {
514
- kind: "loaded_empty",
515
- presentation: p,
516
- adaptedColumns: l,
517
- sqlClassifications: s
518
- } : {
519
- kind: "loaded_valid",
520
- presentation: p,
521
- adaptedColumns: l,
522
- sqlClassifications: s
523
- };
524
- } catch (o) {
525
- return T(
526
- o,
527
- new m(
528
- "invalid_raw_temporal_format",
529
- "Declared SQL raw temporal presentation is invalid."
530
- )
531
- );
532
- }
533
- }
534
- function ue(e) {
535
- if (e.value !== null && typeof e.value != "string")
536
- return {
537
- value: e.value,
538
- label: String(e.value),
539
- result: {
540
- ok: !1,
541
- text: String(e.value),
542
- diagnostic: {
543
- code: "invalid_raw_temporal_value",
544
- message: `Raw temporal column "${e.presentation.columnKey}" must contain a string or null.`
545
- }
546
- }
547
- };
548
- const a = e.presentation.formatValue(e.value);
549
- return { value: e.value, label: a.text, result: a };
550
- }
551
- function fe(e) {
552
- if (!e.result || typeof e.result != "object") return !1;
553
- const a = e.result;
554
- if (e.expectedResultOwner !== void 0 && a.resultOwner !== e.expectedResultOwner || !Array.isArray(a.records)) return !1;
555
- const t = X({
556
- card: e.card,
557
- effectiveCardConfig: e.effectiveCardConfig,
558
- records: a.records,
559
- columns: a.columns,
560
- columnKeyMap: a.columnKeyMap,
561
- preferences: A,
562
- calendar: { tz: "UTC" }
563
- });
564
- return t.kind === "inactive" || t.kind === "loaded_empty" || t.kind === "loaded_valid";
565
- }
566
- 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
584
- };