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,637 +0,0 @@
1
- import { k as P, u as j, aj as B } from "./validators-C87JPd-_.js";
2
- import "./matrix-operation-contract-COxrfQTS.js";
3
- import "./analytics-base-schemas-BUFUoO6G.js";
4
- import { z as f } from "zod";
5
- const T = 8, A = 6, E = Object.freeze([]);
6
- function z(e) {
7
- switch (e.type) {
8
- case "table":
9
- case "chart":
10
- return e.card ? [e.card] : E;
11
- case "kpi":
12
- return Array.isArray(e.cards) ? e.cards : E;
13
- default:
14
- return E;
15
- }
16
- }
17
- function K(e, t) {
18
- switch (e.type) {
19
- case "table":
20
- case "chart": {
21
- if (!e.card) return e;
22
- const n = t(e.card);
23
- return n === e.card ? e : { ...e, card: n };
24
- }
25
- case "kpi": {
26
- if (!Array.isArray(e.cards)) return e;
27
- const n = e.cards.map(t);
28
- return n.every((r, a) => r === e.cards[a]) ? e : { ...e, cards: n };
29
- }
30
- default:
31
- return e;
32
- }
33
- }
34
- function $(e) {
35
- var n;
36
- const t = [];
37
- for (const r of e.sheets || []) {
38
- const a = r.id;
39
- for (const i of r.cards || [])
40
- t.push({ kind: "sheetCard", sheetId: a, cardId: i.id, card: i });
41
- for (const i of r.frames || [])
42
- for (const s of i.cards || [])
43
- t.push({
44
- kind: "frameCard",
45
- sheetId: a,
46
- frameId: i.id,
47
- cardId: s.id,
48
- card: s
49
- });
50
- for (const i of ((n = r.document) == null ? void 0 : n.sections) || [])
51
- for (const s of z(i))
52
- t.push({
53
- kind: "documentSectionCard",
54
- sheetId: a,
55
- sectionId: i.id,
56
- cardId: s.id,
57
- card: s
58
- });
59
- }
60
- return t;
61
- }
62
- function pe(e, t) {
63
- const n = (a, i) => {
64
- const s = a.map((o) => t(o, i(o)));
65
- return s.every((o, u) => o === a[u]) ? a : s;
66
- }, r = (e.sheets || []).map((a) => {
67
- var h, p, c;
68
- const i = a.id, s = a.cards && n(a.cards, (d) => ({ kind: "sheetCard", sheetId: i, cardId: d.id, card: d })), o = (h = a.frames) == null ? void 0 : h.map((d) => {
69
- if (!d.cards) return d;
70
- const l = n(d.cards, (F) => ({ kind: "frameCard", sheetId: i, frameId: d.id, cardId: F.id, card: F }));
71
- return l === d.cards ? d : { ...d, cards: l };
72
- }), u = (c = (p = a.document) == null ? void 0 : p.sections) == null ? void 0 : c.map(
73
- (d) => K(d, (l) => t(l, { kind: "documentSectionCard", sheetId: i, sectionId: d.id, cardId: l.id, card: l }))
74
- ), m = !!o && o.some((d, l) => d !== a.frames[l]), y = !!u && u.some((d, l) => d !== a.document.sections[l]);
75
- return s === a.cards && !m && !y ? a : {
76
- ...a,
77
- ...s === a.cards ? {} : { cards: s },
78
- ...m ? { frames: o } : {},
79
- ...y ? { document: { ...a.document, sections: u } } : {}
80
- };
81
- });
82
- return r.every((a, i) => a === e.sheets[i]) ? e : { ...e, sheets: r };
83
- }
84
- function N(e) {
85
- return !!e && typeof e == "object" && !Array.isArray(e);
86
- }
87
- function ye(e) {
88
- if (!N(e))
89
- return [{ path: "", message: "must be an object." }];
90
- const t = [];
91
- e.title !== void 0 && typeof e.title != "string" && t.push({ path: "title", message: "must be a string." });
92
- const n = e.cards;
93
- if (!Array.isArray(n))
94
- t.push({ path: "cards", message: "must be an array of KPI cards." });
95
- else {
96
- (n.length < 1 || n.length > T) && t.push({
97
- path: "cards",
98
- message: `must hold 1 to ${T} KPI cards.`
99
- });
100
- const a = /* @__PURE__ */ new Set();
101
- n.forEach((i, s) => {
102
- if (!N(i)) {
103
- t.push({ path: `cards[${s}]`, message: "must be a card." });
104
- return;
105
- }
106
- typeof i.id != "string" || !i.id ? t.push({
107
- path: `cards[${s}].id`,
108
- message: "must be a non-empty string."
109
- }) : a.has(i.id) ? t.push({
110
- path: `cards[${s}].id`,
111
- message: `duplicates card id '${i.id}'.`
112
- }) : a.add(i.id), i.type !== "kpi" && t.push({ path: `cards[${s}].type`, message: "must be 'kpi'." });
113
- });
114
- }
115
- const r = e.kpi;
116
- return N(r) ? (r.layout !== "tiles" && r.layout !== "lines" ? t.push({
117
- path: "kpi.layout",
118
- message: "must be 'tiles' or 'lines'."
119
- }) : r.layout === "tiles" && Array.isArray(n) && n.length > A && t.push({
120
- path: "kpi.layout",
121
- message: `must be 'lines' for more than ${A} KPI cards.`
122
- }), r.columns !== void 0 && r.columns !== 1 && r.columns !== 2 && t.push({ path: "kpi.columns", message: "must be 1 or 2." })) : t.push({ path: "kpi", message: "must be an object." }), t;
123
- }
124
- const U = ["new", "edit", "delete", "create", "update", "remove"];
125
- function M(e, t) {
126
- return (e.sheets || []).flatMap(
127
- (n) => $({ sheets: [n] }).filter(t).map((r) => ({
128
- card: r.card,
129
- sheet: n,
130
- ...r.kind === "frameCard" && { frameId: r.frameId },
131
- ...r.kind === "documentSectionCard" && {
132
- sectionId: r.sectionId
133
- }
134
- }))
135
- );
136
- }
137
- function b(e) {
138
- return M(e, (t) => t.kind !== "documentSectionCard");
139
- }
140
- function he(e) {
141
- return [
142
- ...b(e),
143
- ...M(e, (t) => t.kind === "documentSectionCard")
144
- ];
145
- }
146
- function be(e) {
147
- return b(e).map((t) => t.card);
148
- }
149
- function Ie(e, t, n) {
150
- return n && t === n ? !0 : !$(e).some(
151
- (r) => r.cardId === t
152
- );
153
- }
154
- function ge(e) {
155
- return !e || e.trim().length === 0 ? { isValid: !1, error: "Card ID cannot be empty" } : e.length < 3 ? { isValid: !1, error: "Card ID must be at least 3 characters" } : e.length > 50 ? { isValid: !1, error: "Card ID must be less than 50 characters" } : /^[a-zA-Z0-9-_]+$/.test(e) ? /^[a-zA-Z0-9]/.test(e) ? U.includes(e.toLowerCase()) ? {
156
- isValid: !1,
157
- error: `"${e}" is a reserved keyword and cannot be used`
158
- } : { isValid: !0 } : {
159
- isValid: !1,
160
- error: "Card ID must start with a letter or number"
161
- } : {
162
- isValid: !1,
163
- error: "Card ID can only contain letters, numbers, hyphens, and underscores"
164
- };
165
- }
166
- function Se(e, t) {
167
- var n;
168
- return (n = Q(e, t)) == null ? void 0 : n.card;
169
- }
170
- function Q(e, t) {
171
- for (const n of b(e))
172
- if (n.card.id === t)
173
- return n;
174
- }
175
- function Ce(e, t) {
176
- for (const n of e.sheets || [])
177
- for (const r of n.frames || [])
178
- for (const a of r.cards || [])
179
- if (a.id === t)
180
- return { card: a, sheet: n };
181
- }
182
- const S = {
183
- includeMetricFilterDatasets: !0,
184
- preferQualifiedIdentity: !1
185
- };
186
- function V(e) {
187
- if (!e) return;
188
- if (e.kind === "semantic")
189
- return { entityName: e.datasetName, entityId: e.datasetId, label: e.label };
190
- const t = [e.databaseName, e.schemaName, e.tableName].filter((n) => !!(n && n.trim())).join(".");
191
- return {
192
- entityName: e.tableName,
193
- qualifiedEntityName: t.includes(".") ? t : void 0,
194
- label: e.label
195
- };
196
- }
197
- function G(e) {
198
- var n;
199
- const t = V(e.source);
200
- return t ? `${(n = e.source) == null ? void 0 : n.kind}:${t.qualifiedEntityName || t.entityName}` : "";
201
- }
202
- function Y(e) {
203
- return [
204
- e.id,
205
- e.qualifiedEntityName,
206
- e.entityId,
207
- e.entityName,
208
- e.qualifiedFieldName,
209
- e.name,
210
- // Source-only fields from different datasets can otherwise share a key
211
- // and the second dataset would be silently dropped.
212
- G(e)
213
- ].join("|");
214
- }
215
- function W(e) {
216
- return [e.entityName, e.qualifiedEntityName || "", e.entityId || ""].join("|");
217
- }
218
- function Ee(e) {
219
- return e.entityName || e.qualifiedEntityName || "";
220
- }
221
- function J(e) {
222
- var t, n;
223
- return !!(e.expression || e.derivedField || (n = (t = e.calculatedFormula) == null ? void 0 : t.inputFields) != null && n.length);
224
- }
225
- function Z(e) {
226
- return P(e) ? !0 : e.entityName || e.qualifiedEntityName ? !1 : !e.source || J(e);
227
- }
228
- function w(e, t) {
229
- const n = W(t);
230
- e.found.has(n) || e.found.set(n, t);
231
- }
232
- function I(e, t) {
233
- var m, y, h;
234
- if (!e) return;
235
- const n = Y(e);
236
- if (t.visitedFields.has(n)) return;
237
- t.visitedFields.add(n);
238
- const r = Z(e);
239
- if (!r) {
240
- const p = !e.entityName && !e.qualifiedEntityName ? V(e.source) : void 0;
241
- w(
242
- t,
243
- p || {
244
- // May be empty for qualified-only metadata; identity then comes from
245
- // `qualifiedEntityName` (see `identityFor` and the calculator).
246
- entityName: e.entityName || "",
247
- entityId: e.entityId,
248
- qualifiedEntityName: e.qualifiedEntityName,
249
- label: e.source && e.source.kind === "semantic" ? e.source.label : void 0
250
- }
251
- );
252
- }
253
- t.includeMetricFilterDatasets && "parameters" in e && ((m = e.parameters) != null && m.filters) && D(e.parameters.filters, t);
254
- const a = (y = e.calculatedFormula) == null ? void 0 : y.inputFields, i = !!(a && a.length > 0);
255
- i && a.forEach((p) => I(p, t));
256
- let s = !1, o = !1;
257
- const u = i || (h = e.derivedField) == null ? void 0 : h.inputs;
258
- if (u && Object.keys(u).length > 0)
259
- for (const p of Object.values(u)) {
260
- const c = p.field.source;
261
- if (!c) {
262
- i || (o = !0);
263
- continue;
264
- }
265
- if (c.kind === "sql") {
266
- o = !0;
267
- continue;
268
- }
269
- if (c.kind === "semantic")
270
- w(t, {
271
- entityName: c.datasetName,
272
- entityId: c.datasetId,
273
- label: c.label
274
- });
275
- else {
276
- const d = [c.databaseName, c.schemaName, c.tableName].filter((l) => !!(l && l.trim())).join(".");
277
- w(t, {
278
- entityName: c.tableName,
279
- qualifiedEntityName: d.includes(".") ? d : void 0,
280
- label: c.label
281
- });
282
- }
283
- s = !0;
284
- }
285
- o && (t.complete = !1), r && !i && !s && (t.complete = !1);
286
- }
287
- function D(e, t) {
288
- if (e && !t.visitedGroups.has(e.id)) {
289
- t.visitedGroups.add(e.id);
290
- for (const n of e.conditions || [])
291
- I(n.field, t);
292
- for (const n of e.groups || [])
293
- D(n, t);
294
- }
295
- }
296
- function C(e, t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set()) {
297
- return {
298
- found: /* @__PURE__ */ new Map(),
299
- complete: !0,
300
- visitedFields: t,
301
- visitedGroups: n,
302
- includeMetricFilterDatasets: e
303
- };
304
- }
305
- function v(e, t) {
306
- var r;
307
- const n = (r = e.qualifiedEntityName) != null && r.includes(".") ? e.qualifiedEntityName : void 0;
308
- return t === "qualifiedOnly" ? n : t === "preferQualified" ? n || e.entityName || void 0 : e.entityName || void 0;
309
- }
310
- function Ne(e) {
311
- const t = C(!1);
312
- return I(e, t), { datasets: Array.from(t.found.values()), complete: t.complete };
313
- }
314
- function L(e, t, n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), a = S) {
315
- const i = { ...S, ...a }, s = C(i.includeMetricFilterDatasets, n, r);
316
- I(e, s), s.found.forEach((o) => {
317
- const u = v(o, i.preferQualifiedIdentity ? "preferQualified" : "name");
318
- u && t.add(u);
319
- });
320
- }
321
- function we(e, t) {
322
- L(e, t, /* @__PURE__ */ new Set(), /* @__PURE__ */ new Set(), {
323
- preferQualifiedIdentity: !0
324
- });
325
- }
326
- function ke(e, t, n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set()) {
327
- const a = C(!0, n, r);
328
- I(e, a), a.found.forEach((i) => {
329
- const s = v(i, "qualifiedOnly");
330
- s && t.add(s);
331
- });
332
- }
333
- function De(e, t, n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set()) {
334
- L(e, t, n, r, {
335
- includeMetricFilterDatasets: !1
336
- });
337
- }
338
- function ve(e, t, n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), a = S) {
339
- const i = { ...S, ...a }, s = C(i.includeMetricFilterDatasets, n, r);
340
- D(e, s), s.found.forEach((o) => {
341
- const u = v(o, i.preferQualifiedIdentity ? "preferQualified" : "name");
342
- u && t.add(u);
343
- });
344
- }
345
- function Fe(e, t) {
346
- return t != null && t[e] ? t[e] : (e.includes(".") ? e.slice(e.lastIndexOf(".") + 1) : e).replace(/[_-]+/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\s+/g, " ").trim().replace(/\b\w/g, (r) => r.toUpperCase());
347
- }
348
- const H = {
349
- date: /* @__PURE__ */ new Set([
350
- "between",
351
- "not between",
352
- "=",
353
- "!=",
354
- ">",
355
- ">=",
356
- "<",
357
- "<=",
358
- "is null",
359
- "is not null"
360
- ]),
361
- number: /* @__PURE__ */ new Set([
362
- "between",
363
- "not between",
364
- "=",
365
- "!=",
366
- ">",
367
- ">=",
368
- "<",
369
- "<=",
370
- "in",
371
- "not in",
372
- "is null",
373
- "is not null"
374
- ]),
375
- string: /* @__PURE__ */ new Set([
376
- "=",
377
- "!=",
378
- "in",
379
- "not in",
380
- "like",
381
- "not like",
382
- "is null",
383
- "is not null"
384
- ]),
385
- boolean: /* @__PURE__ */ new Set(["=", "!=", "in", "not in", "is null", "is not null"])
386
- };
387
- function X(e) {
388
- const t = B(e);
389
- return t === "number" || t === "boolean" ? t : t === "date" || t === "datetime" ? "date" : "string";
390
- }
391
- function Te(e, t) {
392
- return typeof t != "string" ? !1 : H[X(e)].has(t);
393
- }
394
- const Ae = /* @__PURE__ */ new Set([
395
- "=",
396
- ">",
397
- "<",
398
- ">=",
399
- "<=",
400
- "!=",
401
- "in",
402
- "not in",
403
- "like",
404
- "not like",
405
- "between",
406
- "not between",
407
- "is null",
408
- "is not null"
409
- ]);
410
- function ee(e, t) {
411
- return t === "number" ? typeof e == "number" && Number.isFinite(e) : t === "boolean" ? typeof e == "boolean" : t === "date" ? e instanceof Date || typeof e == "string" && e.trim().length > 0 : typeof e == "string" || typeof e == "number" || typeof e == "boolean";
412
- }
413
- function _e(e, t, n, r) {
414
- if (j(e.relativeMeta)) {
415
- r.push(
416
- `${n}.relativeMeta counts back from the latest data; a dashboard filter's dates run to now. Use a period counted back from today.`
417
- );
418
- return;
419
- }
420
- te(e.operation, e.values, t, `${n}.values`, r);
421
- }
422
- function te(e, t, n, r, a) {
423
- if (e === "is null" || e === "is not null") {
424
- t.length !== 0 && a.push(`${r} must be empty for null filter operations.`);
425
- return;
426
- }
427
- if (e === "between" || e === "not between") {
428
- if (t.length !== 2) {
429
- a.push(
430
- `${r} must contain exactly two values for between operations.`
431
- );
432
- return;
433
- }
434
- } else if (e === "in" || e === "not in") {
435
- if (t.length === 0) {
436
- a.push(
437
- `${r} must contain at least one value for set operations.`
438
- );
439
- return;
440
- }
441
- } else if (t.length !== 1) {
442
- a.push(
443
- `${r} must contain exactly one value for '${String(e)}' operations.`
444
- );
445
- return;
446
- }
447
- for (const i of t)
448
- if (!ee(i, n)) {
449
- a.push(
450
- `${r} contains a value that is incompatible with valueType '${n}'.`
451
- );
452
- return;
453
- }
454
- }
455
- const Oe = {
456
- database: null,
457
- schema: null,
458
- table: null
459
- }, $e = "__card_default__", q = {
460
- bookmarksPerViewerPerDashboard: 20,
461
- bookmarkNameMaxChars: 100,
462
- columnLabelMaxChars: 120,
463
- tableSettingsMaxBytes: 65536,
464
- rememberedTableSettingsMaxBytes: 262144,
465
- bookmarkStateMaxBytes: 65536
466
- }, ne = 1;
467
- function Me(e) {
468
- return new TextEncoder().encode(JSON.stringify(e ?? null)).length;
469
- }
470
- function re(e) {
471
- const t = encodeURIComponent;
472
- switch (e.kind) {
473
- case "dimension":
474
- return `dim:${e.role}:${t(e.fieldId)}`;
475
- case "metric":
476
- return `metric:${t(e.metricId)}:${t(
477
- e.metricAlias
478
- )}`;
479
- case "result":
480
- return `result:${t(e.key)}`;
481
- }
482
- }
483
- function g(e) {
484
- if (e)
485
- try {
486
- return decodeURIComponent(e);
487
- } catch {
488
- return;
489
- }
490
- }
491
- function ae(e) {
492
- if (typeof e != "string") return;
493
- const t = e.split(":");
494
- let n;
495
- if (t[0] === "dim" && t.length === 3) {
496
- const r = t[1], a = g(t[2]);
497
- (r === "detail" || r === "groupby") && a && (n = { kind: "dimension", role: r, fieldId: a });
498
- } else if (t[0] === "metric" && t.length === 3) {
499
- const r = g(t[1]), a = g(t[2]);
500
- r && a && (n = { kind: "metric", metricId: r, metricAlias: a });
501
- } else if (t[0] === "result" && t.length === 2) {
502
- const r = g(t[1]);
503
- r && (n = { kind: "result", key: r });
504
- }
505
- return n && re(n) === e ? n : void 0;
506
- }
507
- function k(e) {
508
- return typeof e == "string" && ae(e) !== void 0;
509
- }
510
- const _ = f.array(f.string()).max(2e3), ie = f.object({
511
- order: _.optional(),
512
- hidden: _.optional(),
513
- labels: f.record(f.string(), f.string().max(q.columnLabelMaxChars)).optional(),
514
- sort: f.array(
515
- f.object({
516
- columnId: f.string(),
517
- direction: f.enum(["asc", "desc"])
518
- }).strict()
519
- ).max(2e3).optional()
520
- }).strict();
521
- function O(e) {
522
- const t = /* @__PURE__ */ new Set(), n = [];
523
- for (const r of e)
524
- !k(r) || t.has(r) || (t.add(r), n.push(r));
525
- return n;
526
- }
527
- function x(e) {
528
- if (!e) return;
529
- const t = e.order ? O(e.order) : void 0, n = e.hidden ? O(e.hidden) : void 0, r = Object.entries(e.labels ?? {}).flatMap(
530
- ([o, u]) => {
531
- const m = typeof u == "string" ? u.trim() : "";
532
- return k(o) && m ? [
533
- [
534
- o,
535
- m.slice(0, q.columnLabelMaxChars)
536
- ]
537
- ] : [];
538
- }
539
- ), a = /* @__PURE__ */ new Set(), i = e.sort ? e.sort.filter((o) => !k(o.columnId) || a.has(o.columnId) ? !1 : (a.add(o.columnId), !0)) : void 0, s = {};
540
- return t != null && t.length && (s.order = t), n != null && n.length && (s.hidden = n), r.length && (s.labels = Object.fromEntries(r)), i && (s.sort = i.map(({ columnId: o, direction: u }) => ({
541
- columnId: o,
542
- direction: u
543
- }))), Object.keys(s).length ? s : void 0;
544
- }
545
- function se(e) {
546
- return x(e) === void 0;
547
- }
548
- function oe(e, t) {
549
- if (t !== ne)
550
- return {
551
- ok: !1,
552
- error: `Unsupported table settings version ${t}.`
553
- };
554
- const n = ie.safeParse(e);
555
- return n.success ? {
556
- ok: !0,
557
- value: x(n.data) ?? {}
558
- } : { ok: !1, error: "Table settings are invalid." };
559
- }
560
- function Ve(e, t, n) {
561
- if (!e || typeof e != "object" || Array.isArray(e)) return {};
562
- const r = {};
563
- for (const [a, i] of Object.entries(
564
- e
565
- )) {
566
- if (!n.has(a)) continue;
567
- const s = oe(i, t);
568
- s.ok && !se(s.value) && (r[a] = s.value);
569
- }
570
- return r;
571
- }
572
- const ue = /* @__PURE__ */ new Set([
573
- "table",
574
- "detailTable"
575
- ]);
576
- function R(e) {
577
- return ue.has(e.type);
578
- }
579
- function de(e) {
580
- var t, n;
581
- return R(e) && ((n = (t = e.preferences) == null ? void 0 : t.tablePrefs) == null ? void 0 : n.allowViewerColumnCustomization) !== !1;
582
- }
583
- function Le(e) {
584
- return new Set(
585
- b(e).filter(({ card: t }) => R(t)).map(({ card: t }) => t.id)
586
- );
587
- }
588
- function qe(e) {
589
- return new Set(
590
- b(e).filter(({ card: t }) => de(t)).map(({ card: t }) => t.id)
591
- );
592
- }
593
- export {
594
- K as A,
595
- pe as B,
596
- $e as C,
597
- Ae as D,
598
- Oe as E,
599
- ye as F,
600
- X as G,
601
- Te as H,
602
- Q as I,
603
- be as J,
604
- b as K,
605
- Se as L,
606
- he as M,
607
- Ie as N,
608
- ge as O,
609
- Ce as P,
610
- q as V,
611
- Ee as a,
612
- we as b,
613
- L as c,
614
- V as d,
615
- ke as e,
616
- De as f,
617
- ve as g,
618
- Fe as h,
619
- ne as i,
620
- se as j,
621
- oe as k,
622
- Ve as l,
623
- Me as m,
624
- x as n,
625
- R as o,
626
- ae as p,
627
- de as q,
628
- Ne as r,
629
- Le as s,
630
- re as t,
631
- qe as u,
632
- _e as v,
633
- $ as w,
634
- T as x,
635
- A as y,
636
- z
637
- };