react-semaphor 0.1.603 → 0.1.605

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 (208) hide show
  1. package/dist/activity/index.js +1 -73
  2. package/dist/analytics-protocol/index.js +1 -1491
  3. package/dist/appearance/index.js +1 -12
  4. package/dist/appearance-runtime/index.js +1 -5
  5. package/dist/assistant-context/index.js +1 -11
  6. package/dist/assistant-protocol/index.js +1 -152
  7. package/dist/brand-studio/index.js +3 -1598
  8. package/dist/briefings/index.js +1 -70
  9. package/dist/chunks/add-to-dashboard-CEmZUf9o.js +12 -0
  10. package/dist/chunks/analytics-base-schemas-DMFrDqn_.js +1 -0
  11. package/dist/chunks/appearance-provider-CfoAVQuG.js +608 -0
  12. package/dist/chunks/appearance-runtime-provider-Bx8H-moR.js +1 -0
  13. package/dist/chunks/applied-constraints-CinevlKD.js +1 -0
  14. package/dist/chunks/assistant-chat-DgUaCE9k.js +51 -0
  15. package/dist/chunks/attachment-filter-line-C_zHMhGh.js +1 -0
  16. package/dist/chunks/attribution-BEFSsbNn.js +1 -0
  17. package/dist/chunks/availability-3AIOf6Z-.js +1 -0
  18. package/dist/chunks/bookmark-impact-BAtemeyK.js +1 -0
  19. package/dist/chunks/bookmark-state-DScd31KT.js +1 -0
  20. package/dist/chunks/brand-C9APUFaP.js +1 -0
  21. package/dist/chunks/card-filter-builder-ClWrXB7P.js +11 -0
  22. package/dist/chunks/column-bands-DwxbZ6UI.js +1 -0
  23. package/dist/chunks/comparison-window-caption-tguyN24S.js +1 -0
  24. package/dist/chunks/context-CntvtZwC.js +2 -0
  25. package/dist/chunks/conversation-JMK2kyTK.js +1 -0
  26. package/dist/chunks/dashboard-ChIcbVTx.js +1 -0
  27. package/dist/chunks/dashboard-briefing-launcher-CwMlhkxV.js +42 -0
  28. package/dist/chunks/dashboard-controls-UCSAFCGA.js +42 -0
  29. package/dist/chunks/dashboard-json-B120hYDa.js +1 -0
  30. package/dist/chunks/dashboard-temporal-snapshot-BFJKbp_6.js +1 -0
  31. package/dist/chunks/edit-dashboard-visual-DvHp03h_.js +73 -0
  32. package/dist/chunks/export-file-format-B-wQNHIn.js +4 -0
  33. package/dist/chunks/filter-line-WwUV5JzN.js +1 -0
  34. package/dist/chunks/filter-reach-preview-C5M5_hf_.js +1 -0
  35. package/dist/chunks/filter-value-text-DqTHe_vu.js +1 -0
  36. package/dist/chunks/index-DViPGDFj.js +1 -0
  37. package/dist/chunks/index-bkP6SnYu.js +1 -0
  38. package/dist/chunks/kpi-trend-rule-B87LNzcz.js +1 -0
  39. package/dist/chunks/layout-grid-CFzqJ7GC.js +6 -0
  40. package/dist/chunks/matrix-analytical-definition-5T-2euHZ.js +1 -0
  41. package/dist/chunks/matrix-member-presentation-vVAv-aqg.js +1 -0
  42. package/dist/chunks/matrix-operation-contract-CWvcEsQ0.js +1 -0
  43. package/dist/chunks/normalize-dashboard-for-dirty-check-ILKfqgL3.js +1 -0
  44. package/dist/chunks/numeric-range-options-C8tr-Bls.js +1 -0
  45. package/dist/chunks/palette-NvEIuXHN.js +6 -0
  46. package/dist/chunks/pivot-result-contract-expectations-BNWhS8mv.js +1 -0
  47. package/dist/chunks/pivot-result-identity-B0eWVMXg.js +1 -0
  48. package/dist/chunks/raw-temporal-value-BHQ-ldpW.js +1 -0
  49. package/dist/chunks/rendered-file-BbvwaU6z.js +1 -0
  50. package/dist/chunks/report-preferences-dialog-Bseb2Rlg.js +1 -0
  51. package/dist/chunks/report-runtime-context-Cd1b5pku.js +1 -0
  52. package/dist/chunks/resolve-dashboard-input-context-BDY7KwRe.js +8 -0
  53. package/dist/chunks/resolver-CjsW8Rz0.js +1 -0
  54. package/dist/chunks/saved-dashboard-context-C3lWc4Dx.js +1 -0
  55. package/dist/chunks/schema-O1Y3WTGF.js +4 -0
  56. package/dist/chunks/selection-filter-compiler-kYsRugss.js +1 -0
  57. package/dist/chunks/semaphor-ready-indicator-BQarSo6S.js +612 -0
  58. package/dist/chunks/set-6mOnfQeH.js +1 -0
  59. package/dist/chunks/slider-BPnHdMGq.js +4 -0
  60. package/dist/chunks/stored-dashboard-DfrxDLhR.js +1 -0
  61. package/dist/chunks/table-export-sheet-xaczzWZF.js +2 -0
  62. package/dist/chunks/token-types-1vzMWjI-.js +1 -0
  63. package/dist/chunks/validators-Dg2kyF4_.js +1 -0
  64. package/dist/chunks/variable-draft-B4_xqr4Y.js +1 -0
  65. package/dist/chunks/visual-choice-DgEFfkE-.js +1 -0
  66. package/dist/dashboard/index.js +1 -7
  67. package/dist/dashboard-authoring/index.js +1 -4614
  68. package/dist/format-utils/index.js +1 -425
  69. package/dist/index.js +1 -554
  70. package/dist/layouts/index.js +1 -7
  71. package/dist/live-channel/index.js +1 -124
  72. package/dist/pdf-export-policy/index.js +1 -92
  73. package/dist/pdf-table-layout/index.js +1 -993
  74. package/dist/report-runtime-context/index.js +1 -9
  75. package/dist/shared/index.js +1 -6
  76. package/dist/style.css +1 -1
  77. package/dist/surfboard/index.js +1 -9
  78. package/dist/types/brand-studio/brand-studio-draft.d.ts +45 -13
  79. package/dist/types/brand-studio/brand-studio-editor.d.ts +13 -2
  80. package/dist/types/components/index.d.ts +1 -0
  81. package/dist/types/components/visual/data-table/hooks/use-data-table-logic.d.ts +17 -6
  82. package/dist/types/components/visual/data-table/types/data-table.d.ts +52 -42
  83. package/dist/types/index.js +1 -88
  84. package/dist/types/lib/appearance/aliases.d.ts +3 -0
  85. package/dist/types/lib/appearance/index.d.ts +1 -0
  86. package/dist/types/lib/appearance/table-density.d.ts +18 -0
  87. package/dist/types/lib/appearance/types.d.ts +39 -1
  88. package/dist/types/lib/dashboard-viewer/column-header-actions.d.ts +100 -0
  89. package/dist/types/lib/dashboard-viewer/table-view-edit.d.ts +0 -27
  90. package/dist/types/lib/dashboard-viewer/table-view.d.ts +26 -2
  91. package/dist/types/lib/dashboard-viewer/use-table-view.d.ts +2 -0
  92. package/dist/types/lib/filter-values/build-card-filter-definition.d.ts +32 -0
  93. package/dist/types/lib/hooks/use-add-new-frame.d.ts +7 -0
  94. package/dist/types/lib/hooks/use-dashboard-card.d.ts +4 -0
  95. package/dist/types/lib/interactions/get-click-context-from-chartjs.d.ts +8 -0
  96. package/dist/types/lib/query-context/dashboard-filter-mapping-resolution.d.ts +9 -0
  97. package/dist/types/lib/stores/dashboard-store.d.ts +14 -2
  98. package/dist/types/lib/stores/explorer-actions.d.ts +7 -10
  99. package/dist/types/lib/types/common-types.d.ts +1 -2
  100. package/dist/types/lib/types/semantic-types.d.ts +6 -10
  101. package/dist/types/lib/utils/card-config-utils.d.ts +13 -0
  102. package/dist/types/lib/utils/field-placement.d.ts +17 -0
  103. package/dist/types/lib/utils/field-state-calculator.d.ts +7 -19
  104. package/dist/types/shared/analytics-protocol/analytics-refusal.d.ts +21 -1
  105. package/dist/types/shared/analytics-protocol/field-provenance.d.ts +7 -4
  106. package/dist/types/shared/dashboard-authoring/calculations/definition.d.ts +13 -0
  107. package/dist/types/shared/dashboard-authoring/card-data-source/card-base.d.ts +125 -0
  108. package/dist/types/shared/dashboard-authoring/card-data-source/card-field-folders.d.ts +55 -0
  109. package/dist/types/shared/dashboard-authoring/card-data-source/card-joins.d.ts +114 -0
  110. package/dist/types/shared/dashboard-authoring/card-data-source/card-prune.d.ts +12 -0
  111. package/dist/types/shared/dashboard-authoring/card-data-source/filter-field-catalog.d.ts +60 -0
  112. package/dist/types/shared/dashboard-authoring/card-data-source/filter-field-folders.d.ts +180 -0
  113. package/dist/types/shared/dashboard-authoring/card-data-source/index.d.ts +7 -0
  114. package/dist/types/shared/dashboard-authoring/card-data-source/join-reach.d.ts +42 -0
  115. package/dist/types/shared/dashboard-authoring/card-field-places.d.ts +28 -0
  116. package/dist/types/shared/dashboard-authoring/card-settings/card-display-write.d.ts +2 -8
  117. package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +1 -1
  118. package/dist/types/shared/dashboard-authoring/card-settings/column-display-values.d.ts +5 -0
  119. package/dist/types/shared/dashboard-authoring/card-settings/column-display.d.ts +52 -0
  120. package/dist/types/shared/dashboard-authoring/card-settings/index.d.ts +1 -0
  121. package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +9 -0
  122. package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +4 -0
  123. package/dist/types/shared/dashboard-authoring/card-settings/table-viewer-switches.d.ts +15 -0
  124. package/dist/types/shared/dashboard-authoring/card-settings/views.d.ts +5 -0
  125. package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +6 -0
  126. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +132 -3
  127. package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +3 -1
  128. package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +10 -10
  129. package/dist/types/shared/dashboard-authoring/conditional-formatting/store.d.ts +10 -1
  130. package/dist/types/shared/dashboard-authoring/field-aggregations.d.ts +9 -2
  131. package/dist/types/shared/dashboard-authoring/field-folders/field-folders.d.ts +116 -0
  132. package/dist/types/shared/dashboard-authoring/field-folders/index.d.ts +1 -0
  133. package/dist/types/shared/dashboard-authoring/filter-reach-decision.d.ts +11 -0
  134. package/dist/types/shared/dashboard-authoring/index.d.ts +7 -1
  135. package/dist/types/shared/dashboard-authoring/operations/card-operations.d.ts +2 -0
  136. package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +7 -2
  137. package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +6 -2
  138. package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +2 -0
  139. package/dist/types/shared/dashboard-authoring/see-records/result.d.ts +7 -22
  140. package/dist/types/shared/dashboard-authoring/sheet-kinds.d.ts +36 -0
  141. package/dist/types/shared/dashboard-authoring/table-sheet-shape.d.ts +140 -0
  142. package/dist/types/shared/dashboard-viewer/table-column-move.d.ts +15 -0
  143. package/dist/types/shared/dashboard-viewer/table-settings.d.ts +8 -2
  144. package/dist/types/shared/format-utils/types/format-types.d.ts +1 -1
  145. package/dist/usage-events/index.js +1 -285
  146. package/dist/value-format-preferences/index.js +1 -635
  147. package/package.json +5 -2
  148. package/dist/chunks/add-to-dashboard-CFF-wFU-.js +0 -291
  149. package/dist/chunks/analytics-base-schemas-DsUh5Q3C.js +0 -680
  150. package/dist/chunks/appearance-context-BwBp25ZG.js +0 -162
  151. package/dist/chunks/appearance-runtime-provider-BRHYELkC.js +0 -80
  152. package/dist/chunks/applied-constraints-DU-wndZ7.js +0 -47
  153. package/dist/chunks/assistant-chat-B6hNQI1t.js +0 -6115
  154. package/dist/chunks/attribution-BvoKvhcj.js +0 -32
  155. package/dist/chunks/availability-Bp5Gfu1I.js +0 -44
  156. package/dist/chunks/bookmark-impact-Ba2PLcGp.js +0 -76
  157. package/dist/chunks/bookmark-state-n7AaNzR_.js +0 -1667
  158. package/dist/chunks/brand-BoUV0iHF.js +0 -54
  159. package/dist/chunks/card-filter-builder-Y22HizVx.js +0 -4069
  160. package/dist/chunks/column-bands-RdM-kjDe.js +0 -47
  161. package/dist/chunks/comparison-window-caption-Ck2TIbnR.js +0 -741
  162. package/dist/chunks/context-UCQ7sere.js +0 -369
  163. package/dist/chunks/conversation-sQiWYUOb.js +0 -16
  164. package/dist/chunks/dashboard-BghI99oY.js +0 -14
  165. package/dist/chunks/dashboard-briefing-launcher-DtBAnGiH.js +0 -4875
  166. package/dist/chunks/dashboard-controls-CtFXlyjV.js +0 -2290
  167. package/dist/chunks/dashboard-json-DfGBUtCd.js +0 -66
  168. package/dist/chunks/dates-BnrXF4bb.js +0 -185
  169. package/dist/chunks/edit-9df1zOWe.js +0 -226
  170. package/dist/chunks/edit-dashboard-visual-oxt3x1wb.js +0 -18397
  171. package/dist/chunks/export-file-format-C-tJsxsf.js +0 -111
  172. package/dist/chunks/filter-line-Cy5YYqRL.js +0 -703
  173. package/dist/chunks/filter-reach-copy-CE_ZX147.js +0 -5111
  174. package/dist/chunks/filter-value-text-fWvSDwkl.js +0 -153
  175. package/dist/chunks/index-BVKzKl5d.js +0 -90
  176. package/dist/chunks/index-CV_Kzou0.js +0 -595
  177. package/dist/chunks/index-D5rxbtS4.js +0 -2795
  178. package/dist/chunks/layout-grid-9LndRoLa.js +0 -16
  179. package/dist/chunks/matrix-analytical-definition-CCp48UCw.js +0 -1233
  180. package/dist/chunks/matrix-member-presentation-zNehruXR.js +0 -391
  181. package/dist/chunks/matrix-operation-contract-DPBj69D8.js +0 -1413
  182. package/dist/chunks/metric-comparison-B0FR-Q8I.js +0 -600
  183. package/dist/chunks/normalize-dashboard-for-dirty-check-XKgH3GFX.js +0 -119
  184. package/dist/chunks/paintbrush-58FQYY-y.js +0 -27
  185. package/dist/chunks/palette-Be62Tkoa.js +0 -23
  186. package/dist/chunks/pickers-DkqmtnTL.js +0 -2403
  187. package/dist/chunks/pivot-result-contract-expectations-BYqAmG9n.js +0 -5092
  188. package/dist/chunks/pivot-result-identity-CAP4--iq.js +0 -77
  189. package/dist/chunks/raw-temporal-value-Dg_MTFF7.js +0 -3778
  190. package/dist/chunks/rendered-file-D8xEuVVx.js +0 -108
  191. package/dist/chunks/report-preferences-dialog-uJp9GBTM.js +0 -1651
  192. package/dist/chunks/report-runtime-context-c77_KF9v.js +0 -388
  193. package/dist/chunks/resolve-dashboard-input-context-Rtl1ffmE.js +0 -25324
  194. package/dist/chunks/resolver-DG_tfEpt.js +0 -156
  195. package/dist/chunks/save-C5A0JnEV.js +0 -21
  196. package/dist/chunks/saved-dashboard-context-tcyTU8jm.js +0 -618
  197. package/dist/chunks/schema-C9NPiIru.js +0 -2568
  198. package/dist/chunks/selection-filter-compiler-DNijjI5y.js +0 -150
  199. package/dist/chunks/semaphor-ready-indicator-FBvunj6S.js +0 -145603
  200. package/dist/chunks/shelf-drop-preview-context-QKStrcK9.js +0 -2466
  201. package/dist/chunks/stored-dashboard-CHozcAY9.js +0 -4075
  202. package/dist/chunks/style-sheet-parts-CDCG-8Ej.js +0 -8681
  203. package/dist/chunks/table-export-sheet-ZFIvs6Sj.js +0 -949
  204. package/dist/chunks/token-types-XbM6QByy.js +0 -8
  205. package/dist/chunks/upload-H15d7uHK.js +0 -15
  206. package/dist/chunks/validators-Baf3VIf5.js +0 -3686
  207. package/dist/chunks/variable-draft-C2y8Jp6Z.js +0 -242
  208. package/dist/chunks/visual-choice-DDfHfHvY.js +0 -172
@@ -1,618 +0,0 @@
1
- var Z = Object.defineProperty;
2
- var G = (e, t, a) => t in e ? Z(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a;
3
- var F = (e, t, a) => G(e, typeof t != "symbol" ? t + "" : t, a);
4
- import { D as S, H as Q, I as U, F as K } from "./bookmark-state-n7AaNzR_.js";
5
- import { s as W, t as X, u as Y, v as ee, w as te, x as ae, y as ne, z as re, A as se, q as oe, B as L, C as ie, D as de, E as le } from "./resolve-dashboard-input-context-Rtl1ffmE.js";
6
- import { c as ce, e as j, b as ue, d as me, p as $, f as fe, g as he, r as w, i as O, j as pe, m as be, k as ge } from "./stored-dashboard-CHozcAY9.js";
7
- import { f as g, A as P, c as Ce, d as Ie, e as A } from "./context-UCQ7sere.js";
8
- import { a as ye, T as ve, P as xe, o as I, d as B, b as D } from "./filter-value-text-fWvSDwkl.js";
9
- import { k as Ve, a9 as Se } from "./validators-Baf3VIf5.js";
10
- import { aI as qe, d as ke } from "./pivot-result-contract-expectations-BYqAmG9n.js";
11
- import { h as $e } from "./metric-comparison-B0FR-Q8I.js";
12
- import { i as we } from "./matrix-analytical-definition-CCp48UCw.js";
13
- function De(e) {
14
- const t = e.qualifiedFieldName || e.name;
15
- return e.label && e.label !== t ? `${e.label} (field ${t})` : t;
16
- }
17
- function _e(e, t = {}) {
18
- if (!e) return [];
19
- const a = N(e, t);
20
- return a.length === 0 ? [] : e.logicalOperator === "AND" && !e.negate ? a : [z(e, a)];
21
- }
22
- function N(e, t) {
23
- const a = e.groups.flatMap((n) => {
24
- const r = N(n, t);
25
- if (r.length === 0) return [];
26
- const s = z(n, r);
27
- return [r.length > 1 && !n.negate ? { ...s, text: `(${s.text})` } : s];
28
- });
29
- return [...e.conditions.map((n) => Fe(n, t)), ...a];
30
- }
31
- function z(e, t) {
32
- const a = t.map((n) => n.text).join(e.logicalOperator === "OR" ? " or " : " and ");
33
- return {
34
- text: e.negate ? `not (${a})` : a,
35
- omittedValues: t.reduce((n, r) => n + r.omittedValues, 0)
36
- };
37
- }
38
- function Fe(e, t) {
39
- const a = Array.isArray(e.value) ? e.value : [e.value];
40
- return ye({
41
- subject: De(e.field),
42
- operator: e.operator,
43
- values: a,
44
- reading: Ae(e),
45
- relative: Ve(e.relativeMeta),
46
- latestValue: e.latestValue,
47
- shownAs: e.label
48
- }, t);
49
- }
50
- function Ae(e) {
51
- return e.temporalBucket ? { kind: "bucket", bucket: e.temporalBucket } : Se(e.field.dataType) ? ve : xe;
52
- }
53
- function k(e) {
54
- const t = W(e) ?? "undefined";
55
- return `${M(t, 2654435769).toString(16)}${M(t, 2246822507).toString(16)}`;
56
- }
57
- function M(e, t) {
58
- let a = 3735928559 ^ t, n = 1103547991 ^ t;
59
- for (let r = 0; r < e.length; r++) {
60
- const s = e.charCodeAt(r);
61
- a = Math.imul(a ^ s, 2654435761), n = Math.imul(n ^ s, 1597334677);
62
- }
63
- return a = Math.imul(a ^ a >>> 16, 2246822507) ^ Math.imul(n ^ n >>> 13, 3266489909), n = Math.imul(n ^ n >>> 16, 2246822507) ^ Math.imul(a ^ a >>> 13, 3266489909), 4294967296 * (2097151 & n) + (a >>> 0);
64
- }
65
- const h = P;
66
- function Me(e, t, a) {
67
- var y;
68
- const n = t !== "pending" && (t == null ? void 0 : t.status) === "ready" ? t : void 0, r = Re(e, t);
69
- if (r) {
70
- const v = t !== "pending" && (t == null ? void 0 : t.status) === "blocked" ? Te(t) : void 0, q = v ? g(v, h.textChars) : void 0;
71
- return {
72
- // A card that runs but is not described still changes when it runs differently.
73
- fingerprint: k(n ? R(n, a.calendar) : { reason: r, message: q }),
74
- description: { status: "not_described", reason: r, ...q ? { message: q } : {} }
75
- };
76
- }
77
- const s = n, l = s.queryContext, m = Le(s), o = Pe(s, a), c = Ne(s), i = je(s), u = l.drillSteps.map((v) => g(
78
- `${JSON.stringify(v.label)} (then by ${v.toField.label || v.toField.name})`,
79
- h.textChars
80
- )), d = (y = s.card.sql) == null ? void 0 : y.trim(), b = d ? ze(s) : [], f = {
81
- fields: I(m.length, h.cardFields),
82
- filters: I(o.length, h.cardFilters),
83
- controls: I(c.length, h.cardControls),
84
- drillSteps: I(u.length, h.drillSteps),
85
- sqlParameters: I(b.length, h.sqlParameters),
86
- comparisons: I(i.length, h.cardFields)
87
- }, p = Object.fromEntries(Object.entries(f).filter(([, v]) => v > 0));
88
- return {
89
- fingerprint: k(R(s, a.calendar)),
90
- description: {
91
- status: "described",
92
- fields: m.slice(0, h.cardFields),
93
- filters: o.slice(0, h.cardFilters),
94
- controls: c.slice(0, h.cardControls),
95
- drillPath: u.slice(0, h.drillSteps),
96
- ...d ? {
97
- sql: {
98
- text: g(d, h.sqlChars),
99
- parameters: b.slice(0, h.sqlParameters)
100
- }
101
- } : {},
102
- ...i.length ? { comparisons: i.slice(0, h.cardFields) } : {},
103
- ...Object.keys(p).length ? { omitted: p } : {}
104
- }
105
- };
106
- }
107
- function Re(e, t) {
108
- if (e.type === "matrixTable") return "matrix";
109
- if (e.type === "custom" || X(e)) return "custom_visual";
110
- if (Y(e.python ?? "").trim()) return "python";
111
- if (t === "pending") return "snapshot_pending";
112
- if ((t == null ? void 0 : t.status) !== "ready") return "snapshot_blocked";
113
- }
114
- function Te(e) {
115
- if (e.message) return e.message;
116
- const t = e.mappingDispositions.flatMap((a) => a.status === "block" ? [`${a.inputId} (${a.reason})`] : []);
117
- return t.length ? `dashboard inputs that cannot apply to this card: ${t.join(", ")}` : void 0;
118
- }
119
- function R(e, t) {
120
- return ce(e.card, e.queryContext, t).queryInputIdentity;
121
- }
122
- const Ee = [
123
- ["row", "rows"],
124
- ["column", "columns"],
125
- ["measure", "metrics"],
126
- ["detail", "details"]
127
- ];
128
- function Le(e) {
129
- const { fields: t } = ee({
130
- type: e.card.type,
131
- config: e.queryContext.finalConfig
132
- });
133
- return Ee.flatMap(([a, n]) => t[n].map((r) => {
134
- const s = r.aggregate, l = r.grainMode ?? r.granularity;
135
- return {
136
- role: a,
137
- label: g(r.label || r.name, h.labelChars),
138
- name: g(r.name, h.labelChars),
139
- ...s ? { aggregate: s } : {},
140
- ...l ? { granularity: l } : {}
141
- };
142
- }));
143
- }
144
- function je(e) {
145
- const t = e.queryContext;
146
- return (t.finalConfig.metricColumns ?? []).flatMap((a) => {
147
- const n = $e({
148
- metricComparison: a.comparison,
149
- globalDateComparison: t.globalDateComparison
150
- });
151
- return n ? [g(qe(Oe(a.label || a.name), n), h.textChars)] : [];
152
- });
153
- }
154
- function Oe(e) {
155
- return JSON.stringify(e);
156
- }
157
- function Pe(e, { calendar: t }) {
158
- const a = e.queryContext, n = { maxListedValues: h.inputValues, timeZone: t.tz }, r = te(e.card), s = new Set(r.map((i) => i.id)), l = new Map(
159
- [...a.queryFilterDefinitions, ...r].map((i) => [i.id, i.title])
160
- ), m = a.cardFilterValues.map((i) => {
161
- const u = l.get(i.filterId) || i.name, d = i.dateOwner === "global_date" ? `${u} (the dashboard date, on this card's field ${i.name})` : `${u} (field ${i.name})`, b = B(i, d, n);
162
- return {
163
- // A click that reaches the card through relationships is the click it
164
- // is, not an input (click relationship reach CR-D15).
165
- origin: we(i.filterId) ? "selection" : s.has(i.filterId) ? "card_input" : "dashboard_input",
166
- text: g(b.text, h.textChars),
167
- ...b.omittedValues ? { omittedValues: b.omittedValues } : {}
168
- };
169
- }), o = a.resolvedFilterParts, c = [["card", o.authored], ["drill", o.drill], ["selection", o.selections]].flatMap(([i, u]) => _e(u, n).map((d) => ({
170
- origin: i,
171
- text: g(d.text, h.textChars),
172
- ...d.omittedValues ? { omittedValues: d.omittedValues } : {}
173
- })));
174
- return [...m, ...c];
175
- }
176
- function Be(e) {
177
- const t = e.queryContext, a = j({
178
- sql: e.card.sql,
179
- controlBindings: t.controlBindings
180
- });
181
- return [.../* @__PURE__ */ new Set([
182
- ...t.controlBindings.map((r) => r.controlId),
183
- ...a.map((r) => r.controlId)
184
- ])].map((r) => ({
185
- id: r,
186
- bindings: t.controlBindings.filter((s) => s.controlId === r),
187
- sqlParameterIds: a.filter((s) => s.controlId === r).map((s) => s.paramId)
188
- }));
189
- }
190
- function Ne(e) {
191
- const t = e.queryContext, a = new Map(
192
- [...t.controlDefinitions, ...t.cardControlDefinitions].map((n) => [n.id, n])
193
- );
194
- return Be(e).map(({ id: n, bindings: r, sqlParameterIds: s }) => {
195
- var o;
196
- const l = t.controlValues[n], m = /* @__PURE__ */ new Set([
197
- ...r.filter((c) => c.target !== "sql_param").map((c) => He(c, l)),
198
- ...s.map((c) => `SQL parameter ${c}`)
199
- ]);
200
- return {
201
- label: g(((o = a.get(n)) == null ? void 0 : o.label) || n, h.labelChars),
202
- valueText: g(
203
- `${D(l, { maxListedValues: h.inputValues }).text}${m.size ? `; ${[...m].join("; ")}` : ""}`,
204
- h.textChars
205
- )
206
- };
207
- });
208
- }
209
- function ze(e) {
210
- const t = e.queryContext;
211
- return j({ sql: e.card.sql, controlBindings: t.controlBindings }).map((a) => ({
212
- name: g(a.paramId, h.labelChars),
213
- valueText: g(
214
- D(t.controlValues[a.controlId], { maxListedValues: h.inputValues }).text,
215
- h.textChars
216
- )
217
- }));
218
- }
219
- function He(e, t) {
220
- const a = typeof t == "string" || typeof t == "number" || typeof t == "boolean" ? String(t) : void 0;
221
- switch (e.target) {
222
- case "sql_param":
223
- return `SQL parameter ${e.paramId}`;
224
- case "presentation_currency":
225
- return "display currency only";
226
- case "config_aggregation":
227
- return `sets the aggregation${a && e.mapping[a] ? ` to ${e.mapping[a]}` : ""}`;
228
- case "config_grain":
229
- return `sets the time grain${a && e.mapping[a] ? ` to ${e.mapping[a]}` : ""}`;
230
- case "config_field_selector":
231
- case "config_metric_selector": {
232
- const n = a ? e.mapping[a] : void 0, r = e.target === "config_field_selector" ? "field" : "measure";
233
- if (!n) return `chooses the ${r}`;
234
- const s = "kind" in n ? `Matrix ${n.id}` : `${n.label || n.name}${"aggregate" in n && n.aggregate ? ` (${n.aggregate})` : ""}`;
235
- return `chooses the ${r} ${JSON.stringify(s)}`;
236
- }
237
- }
238
- }
239
- class V extends Error {
240
- constructor(a, n) {
241
- super(n);
242
- F(this, "code");
243
- this.name = "AssistantContextSourceError", this.code = a;
244
- }
245
- }
246
- const C = P, Je = "Untitled";
247
- function Ze(e) {
248
- var f;
249
- if (e.surface === "none")
250
- return T({
251
- version: A,
252
- surface: "none",
253
- otherSheets: [],
254
- activeInputs: [],
255
- cards: [],
256
- timeZone: e.timeZone
257
- });
258
- const { dashboard: t, sheetId: a, calendar: n } = e, r = t.sheets ?? [], s = r.find((p) => p.id === a);
259
- if (a !== null && !s)
260
- throw new V("sheet_not_found", `sheet ${a} is not on dashboard ${t.id}`);
261
- const l = r.filter((p) => p.id !== a), m = s ? S(t).filter((p) => p.sheetId === a) : [], o = m.slice(0, C.summaryCards), c = e.selectedCard ? m.find((p) => p.cardId === e.selectedCard.cardId) : void 0, i = ((f = e.selectedCard) == null ? void 0 : f.card) ?? (c == null ? void 0 : c.card);
262
- if (e.selectedCard && !i)
263
- throw new V(
264
- "card_not_on_sheet",
265
- `card ${e.selectedCard.cardId} is not on sheet ${a}`
266
- );
267
- const u = s ? Ue(e, s, m) : [], d = {
268
- otherSheets: I(l.length, C.otherSheets),
269
- activeInputs: I(u.length, C.activeInputs),
270
- cards: I(m.length, C.summaryCards)
271
- }, b = Object.fromEntries(Object.entries(d).filter(([, p]) => p > 0));
272
- return T({
273
- version: A,
274
- surface: e.editing ? "editor" : "dashboard",
275
- dashboard: {
276
- id: t.id,
277
- title: x(t.title),
278
- unsavedEdits: e.unsavedEdits
279
- },
280
- ...s ? { sheet: { id: s.id, title: x(s.title) } } : {},
281
- otherSheets: l.slice(0, C.otherSheets).map((p) => ({ id: p.id, title: x(p.title) })),
282
- activeInputs: u.slice(0, C.activeInputs),
283
- cards: o.map((p) => H(p.card)),
284
- ...i && e.selectedCard ? { selectedCard: Ge(i, e.selectedCard.snapshot, n) } : {},
285
- ...e.editing ? { editing: e.editing } : {},
286
- ...Object.keys(b).length ? { omitted: b } : {},
287
- timeZone: n.tz
288
- });
289
- }
290
- function Ge(e, t, a) {
291
- return { ...H(e), ...Me(e, t, { calendar: a }) };
292
- }
293
- function T(e) {
294
- const t = Ce(e);
295
- if (t > C.contextBytes) throw new Ie(t);
296
- return e;
297
- }
298
- function x(e) {
299
- return g((e == null ? void 0 : e.trim()) || Je, C.labelChars);
300
- }
301
- function H(e) {
302
- const t = Qe(e);
303
- return {
304
- id: e.id,
305
- title: x(e.title),
306
- visualType: e.type,
307
- ...t ? { source: t } : {}
308
- };
309
- }
310
- function Qe(e) {
311
- var a;
312
- const t = se(e);
313
- if (t.kind === "config")
314
- return t.executableSources.length === 1 ? t.executableSources[0] : void 0;
315
- if (t.kind === "sql") {
316
- const n = ((a = e.dataSource) == null ? void 0 : a.connectionId) || e.connectionId;
317
- return n ? { kind: "sql", connectionId: n } : void 0;
318
- }
319
- }
320
- function Ue(e, t, a) {
321
- const { dashboard: n } = e, r = t.kind === "document" ? "document" : "dashboard", s = r === "document" ? void 0 : e.transientContexts, { shouldApplyDashboardFilters: l } = ue(s), m = (u, d) => ae({
322
- dashboard: n,
323
- sheetId: t.id,
324
- card: u,
325
- sectionId: d,
326
- runtimeValues: e.runtimeValues,
327
- transientContexts: s,
328
- calendar: e.calendar
329
- }), o = /* @__PURE__ */ new Map(), c = (u) => {
330
- u.inputs.forEach((d, b) => {
331
- if (E(d)) return;
332
- const f = u.resolvedInputs[b], p = o.get(d.id) ?? { input: d };
333
- !p.resolved && f && Ke(f) && (p.resolved = f), o.set(d.id, p);
334
- });
335
- };
336
- c(m(null));
337
- let i = ne(n).filter((u) => {
338
- var d;
339
- return !E(u) && !((d = o.get(u.id)) != null && d.resolved);
340
- });
341
- for (const u of a) {
342
- if (i.length === 0) break;
343
- const d = u.kind === "documentSectionCard" ? u.sectionId : void 0, b = { sheetId: t.id, sheetKind: r, cardId: u.cardId, sectionId: d };
344
- if (i.some((f) => Q(f, b))) {
345
- try {
346
- c(m(u.card, d));
347
- } catch {
348
- continue;
349
- }
350
- i = i.filter((f) => {
351
- var p;
352
- return !((p = o.get(f.id)) != null && p.resolved);
353
- });
354
- }
355
- }
356
- return [...o.values()].flatMap((u) => {
357
- if (!u.resolved) return [];
358
- const d = u.input.kind === "filter" && !l && !U(u.input), b = We(u, e.calendar.tz, d);
359
- return b ? [b] : [];
360
- });
361
- }
362
- function E(e) {
363
- var a;
364
- const t = (a = e.compatibility) == null ? void 0 : a.source;
365
- return t === "cardInlineFilter" || t === "cardControl";
366
- }
367
- function Ke(e) {
368
- if (e.kind === "filter") return !!e.filterValue;
369
- const t = e.controlValue;
370
- return t == null ? !1 : typeof t == "string" ? t.trim().length > 0 : Array.isArray(t) ? t.length > 0 : !0;
371
- }
372
- function We(e, t, a) {
373
- const { input: n, resolved: r } = e, s = x(n.label), l = {
374
- inputId: n.id,
375
- label: s,
376
- ...n.kind === "filter" && re(n.filter) ? { globalDate: !0 } : {}
377
- };
378
- if (n.runtimeScope === "perCard" || n.runtimeScope === "perDocumentSection")
379
- return { ...l, value: { kind: "varies" } };
380
- const m = { maxListedValues: C.inputValues, timeZone: t };
381
- let o;
382
- if ((r == null ? void 0 : r.kind) === "filter" && r.filterValue)
383
- o = B(r.filterValue, s, m);
384
- else if ((r == null ? void 0 : r.kind) === "control") {
385
- const i = D(r.controlValue, m);
386
- o = { text: `${s} is set to ${i.text}`, omittedValues: i.omittedValues };
387
- }
388
- if (!o) return;
389
- const c = (r == null ? void 0 : r.kind) === "filter" ? r.comparisonSelection : void 0;
390
- return (c == null ? void 0 : c.mode) === "period" && (o = { ...o, text: `${o.text}; compared with ${ke(c.spec).sentence}` }), {
391
- ...l,
392
- value: {
393
- kind: "set",
394
- text: g(o.text, C.textChars),
395
- ...o.omittedValues ? { omittedValues: o.omittedValues } : {},
396
- ...a ? { notApplied: "opened_from_another_dashboard" } : {},
397
- // The resolved value itself, with any date comparison on it and whether
398
- // the view applies it, so any change counts, shown or not.
399
- fingerprint: k(
400
- (r == null ? void 0 : r.kind) === "filter" ? { filter: r.filterValue, comparison: r.comparisonSelection ?? null, notApplied: a } : { control: r == null ? void 0 : r.controlValue }
401
- )
402
- }
403
- };
404
- }
405
- function ft(e) {
406
- return Xe(e).context;
407
- }
408
- function Xe(e) {
409
- const { place: t, calendar: a } = e, n = $(e.dashboard), r = pe({ dashboard: n, host: {}, calendar: a, materializeInputs: !1 }), s = {
410
- ...w({ dashboard: n, capture: {}, calendar: a }).runtimeValues,
411
- cardViewState: t.cardViewState ?? {}
412
- }, l = t.cardId ? et(n, t.cardId) : void 0, m = l ? J({
413
- dashboard: n,
414
- location: l,
415
- runtimeValues: s,
416
- semanticExecutionPayload: e.semanticExecutionPayload,
417
- calendar: a,
418
- withRequest: !0
419
- }) : void 0, o = Ze({
420
- surface: "dashboard",
421
- dashboard: n,
422
- // A sheet that does not hold the card is refused by the projection.
423
- sheetId: t.sheetId ?? (l == null ? void 0 : l.sheetId) ?? r.selectedSheetId,
424
- unsavedEdits: !1,
425
- runtimeValues: s,
426
- transientContexts: void 0,
427
- ...l && m !== void 0 ? { selectedCard: { cardId: l.cardId, snapshot: m } } : {},
428
- calendar: a
429
- });
430
- return {
431
- context: o,
432
- openDashboard: n,
433
- ...o.selectedCard && m !== void 0 ? { cardReplay: Ye({ dashboard: n, cardId: o.selectedCard.id, snapshot: m }) } : {}
434
- };
435
- }
436
- function Ye(e) {
437
- const t = e.dashboard ? S(e.dashboard).find((n) => n.cardId === e.cardId) : void 0, a = _({
438
- card: e.card ?? (t == null ? void 0 : t.card),
439
- snapshot: e.snapshot,
440
- documentSection: (t == null ? void 0 : t.kind) === "documentSectionCard"
441
- });
442
- return a.status === "ready" ? { selectedCardRequest: a.request } : {
443
- selectedCardUnavailable: {
444
- cardId: e.cardId,
445
- reason: a.reason,
446
- ...a.message ? { message: a.message } : {}
447
- }
448
- };
449
- }
450
- function et(e, t) {
451
- const a = S(e).find((n) => n.cardId === t);
452
- if (!a)
453
- throw new V("card_not_found", `card ${t} is not on dashboard ${e.id}`);
454
- return a;
455
- }
456
- function J(e) {
457
- const { dashboard: t, location: a, runtimeValues: n } = e, r = a.kind === "documentSectionCard" ? tt(t, a) : void 0;
458
- return O({
459
- dashboard: t,
460
- cardId: a.cardId,
461
- cardOverride: a.card,
462
- sheetId: a.sheetId,
463
- transientContexts: e.transientContexts,
464
- cardViewStates: n.cardViewState,
465
- viewerTableSettings: void 0,
466
- adHocFilterValues: n.adHocFilterValues,
467
- inlineFilterValuesMap: n.inlineFilterValuesMap,
468
- dashboardControlValues: n.controlValues,
469
- cardControlValuesMap: n.cardControlValuesMap,
470
- dashboardInputValues: n.dashboardInputValues,
471
- semanticExecutionPayload: e.semanticExecutionPayload,
472
- calendar: e.calendar,
473
- ...r ? { documentSection: r } : {},
474
- ...e.withRequest ? { withRequest: !0 } : {}
475
- });
476
- }
477
- function _(e) {
478
- var a;
479
- const { snapshot: t } = e;
480
- if (e.documentSection) return { status: "unavailable", reason: "document_section" };
481
- if (((a = e.card) == null ? void 0 : a.type) === "matrixTable") return { status: "unavailable", reason: "matrix" };
482
- if (t === "pending") return { status: "unavailable", reason: "pending" };
483
- if (!t || t.status !== "ready")
484
- return {
485
- status: "unavailable",
486
- reason: "blocked",
487
- ...t != null && t.message ? { message: t.message } : {}
488
- };
489
- if (t.matrix) return { status: "unavailable", reason: "matrix" };
490
- if (!t.request) return { status: "unavailable", reason: "no_query" };
491
- try {
492
- const { connectionId: n, requestPayloadBase: r } = me(t.card, t.request);
493
- return { status: "ready", request: { cardId: t.card.id, connectionId: n, payload: r } };
494
- } catch {
495
- return { status: "unavailable", reason: "no_query" };
496
- }
497
- }
498
- function ht(e) {
499
- const { calendar: t } = e, a = e.host ?? {}, n = $(
500
- a.controlContract ? fe(he(e.dashboard), {
501
- controlContractOverrides: a.controlContract,
502
- cardId: e.cardId
503
- }) : e.dashboard
504
- ), r = S(n).find((c) => c.cardId === e.cardId);
505
- if (!r) return { status: "refused", reason: "card_not_found" };
506
- if (r.kind === "documentSectionCard") return { status: "refused", reason: "document_section" };
507
- const { runtimeValues: s, transientContexts: l } = w({
508
- dashboard: n,
509
- capture: a,
510
- calendar: t
511
- }), m = J({
512
- dashboard: n,
513
- location: r,
514
- runtimeValues: s,
515
- semanticExecutionPayload: e.semanticExecutionPayload,
516
- calendar: t,
517
- transientContexts: l,
518
- withRequest: !0
519
- });
520
- if (!m) return { status: "refused", reason: "card_not_found" };
521
- const o = _({ card: r.card, snapshot: m, documentSection: !1 });
522
- return o.status === "ready" ? { ...o, renderConfig: m.queryContext.finalConfig } : o.reason === "pending" ? { status: "refused", reason: "blocked" } : {
523
- status: "refused",
524
- reason: o.reason,
525
- ...o.message ? { message: o.message } : {}
526
- };
527
- }
528
- function tt(e, t) {
529
- var n, r, s;
530
- const a = (n = e.sheets) == null ? void 0 : n.find((l) => l.id === t.sheetId);
531
- if ((s = (r = a == null ? void 0 : a.document) == null ? void 0 : r.inputs) != null && s.length && L(e, t.sheetId).length === 0)
532
- throw new V(
533
- "document_inputs_not_built",
534
- `card ${t.cardId} runs with the document's own inputs on sheet ${t.sheetId}, which only the page builds`
535
- );
536
- return {
537
- sheetId: t.sheetId,
538
- sectionId: t.sectionId,
539
- documentFilterValues: [],
540
- documentControlDefinitions: [],
541
- documentControlValues: {}
542
- };
543
- }
544
- function pt(e) {
545
- const { calendar: t } = e, a = $(e.dashboard), n = a.variables ?? [], r = n.find((f) => f.name === e.name) ?? n.find((f) => f.id === e.name);
546
- if (!r)
547
- return { status: "refused", reason: "variable_unknown", message: `No variable named ${e.name} on this dashboard.`, available: n.map((f) => f.name) };
548
- const s = (a.sheets ?? []).find((f) => f.id === e.sheetId);
549
- if (!s)
550
- return {
551
- status: "refused",
552
- reason: "place_unknown",
553
- message: `No sheet ${e.sheetId} on this dashboard; a variable is derived at a tab or a Document.`,
554
- available: (a.sheets ?? []).map((f) => f.id)
555
- };
556
- const l = K(a, r.id);
557
- if ((l == null ? void 0 : l.kind) !== "variable") return { status: "refused", reason: "broken", message: `${r.name} has no card to run.` };
558
- const m = oe(s) && s.document ? s.document : void 0, o = at(a, s.id, !!m, e.inputs ?? {}, t);
559
- if (!o.ok) return { status: "refused", reason: "broken", message: o.message };
560
- const { runtimeValues: c, transientContexts: i } = w({ dashboard: a, capture: o.capture, calendar: t }), u = m ? { sheetId: s.id, sectionId: void 0, documentFilterValues: [], documentControlDefinitions: [], documentControlValues: {} } : void 0, d = O({
561
- dashboard: a,
562
- cardId: r.id,
563
- cardOverride: l.card,
564
- sheetId: s.id,
565
- transientContexts: i,
566
- cardViewStates: c.cardViewState,
567
- viewerTableSettings: void 0,
568
- adHocFilterValues: c.adHocFilterValues,
569
- inlineFilterValuesMap: c.inlineFilterValuesMap,
570
- dashboardControlValues: c.controlValues,
571
- cardControlValuesMap: c.cardControlValuesMap,
572
- dashboardInputValues: c.dashboardInputValues,
573
- semanticExecutionPayload: e.semanticExecutionPayload,
574
- calendar: t,
575
- ...u ? { documentSection: u } : {},
576
- withRequest: !0
577
- });
578
- if ((d == null ? void 0 : d.status) === "blocked")
579
- return d.reason === "requiredInput" ? { status: "refused", reason: "held", message: `${r.name} waits for ${d.missingRequiredLabels.join(", ")}.`, missingRequired: d.missingRequiredLabels } : { status: "refused", reason: "broken", message: d.message ?? `${r.name} can't run until its filter mapping is resolved.` };
580
- const b = _({ card: l.card, snapshot: d, documentSection: !1 });
581
- return b.status !== "ready" ? { status: "refused", reason: "broken", message: b.message ?? `${r.name} has no query to run.` } : { status: "ready", variable: r, place: m ? "document" : "sheet", request: b.request };
582
- }
583
- function at(e, t, a, n, r) {
584
- const s = Object.keys(n);
585
- if (!s.length) return { ok: !0, capture: {} };
586
- if (!a) return { ok: !1, message: "Values are given for a Document's inputs; at a tab the variable runs with the saved defaults." };
587
- const l = L(e, t), m = new Map(l.map((i) => [i.variableName, i])), o = s.filter((i) => !m.has(i));
588
- if (o.length)
589
- return { ok: !1, message: `This Document has no input named ${o.join(", ")}; its inputs are ${[...m.keys()].join(", ") || "none"}.` };
590
- let c = be(e, { adHocFilterValues: [], controlOverrides: void 0, dashboardInputValues: {} }, r);
591
- for (const [i, u] of Object.entries(n)) {
592
- const d = m.get(i);
593
- let b;
594
- if (d.kind === "control")
595
- b = le(u);
596
- else {
597
- const f = Array.isArray(u) ? u : [u];
598
- if (!f.every((y) => typeof y == "string" || typeof y == "number" || typeof y == "boolean"))
599
- return { ok: !1, message: `${i} takes a value or a list of values.` };
600
- const p = f.every((y) => typeof y == "number") ? f : f.map(String);
601
- b = ie(ge(d.filter, { filterId: d.filter.id, values: p }, r));
602
- }
603
- if (!b) return { ok: !1, message: `${i} has no usable value.` };
604
- c = de(c, d, { sheetId: t }, b);
605
- }
606
- return { ok: !0, capture: { dashboardInputExecutionSnapshot: { mode: "document", sheetId: t, dashboardInputValues: c } } };
607
- }
608
- export {
609
- V as A,
610
- Ye as a,
611
- ht as b,
612
- pt as c,
613
- _ as d,
614
- ft as e,
615
- Xe as f,
616
- J as g,
617
- Ze as p
618
- };