react-semaphor 0.1.537 → 0.1.539

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 (174) hide show
  1. package/dist/analytics-protocol/index.js +352 -341
  2. package/dist/assistant-context/index.js +10 -0
  3. package/dist/assistant-protocol/index.js +104 -0
  4. package/dist/brand-studio/index.js +35 -31
  5. package/dist/briefings/index.js +46 -45
  6. package/dist/chunks/_commonjsHelpers-BkfeUUK-.js +28 -0
  7. package/dist/chunks/add-to-dashboard-CxtTfISD.js +56 -0
  8. package/dist/chunks/aggregate-table-row-presentation-BjK9YfMI.js +979 -0
  9. package/dist/chunks/analytics-base-schemas-BFAoRlkU.js +472 -0
  10. package/dist/chunks/apply-dashboard-operations-C-iahGka.js +402 -0
  11. package/dist/chunks/assistant-chat-DgiSuFT4.js +8083 -0
  12. package/dist/chunks/availability-Bp5Gfu1I.js +44 -0
  13. package/dist/chunks/{bookmark-state-B-I9BDD0.js → bookmark-state-k7y5SNGf.js} +9 -9
  14. package/dist/chunks/{braces-8TRlDwDw.js → braces-o9UiRQes.js} +1 -1
  15. package/dist/chunks/calculated-field-identity-DcBS2NPP.js +2161 -0
  16. package/dist/chunks/calendar-day-equality-Bpl15IBo.js +487 -0
  17. package/dist/chunks/class-utils-Df1OVOT1.js +2315 -0
  18. package/dist/chunks/{field-dependencies-CpRUwr9J.js → common-types-CUf03Htv.js} +65 -58
  19. package/dist/chunks/context-HD9usB1P.js +349 -0
  20. package/dist/chunks/conversation-sQiWYUOb.js +16 -0
  21. package/dist/chunks/csv-utils-GUfKyT1J.js +56 -0
  22. package/dist/chunks/custom-visual-inputs-BrUOIwln.js +3288 -0
  23. package/dist/chunks/{dashboard-briefing-launcher-A2uVpHCp.js → dashboard-briefing-launcher-Bl3gCeBR.js} +580 -556
  24. package/dist/chunks/{dashboard-controls-DxTuVis_.js → dashboard-controls-0EX0HiJt.js} +683 -686
  25. package/dist/chunks/{common-types-g7yS12Cg.js → dashboard-filter-value-compatibility-D95O4nd7.js} +18 -24
  26. package/dist/chunks/dashboard-json-6X_2BDiL.js +69 -0
  27. package/dist/chunks/{dashboard-BPJo-Fnd.js → dashboard-y5BwcvzT.js} +1 -1
  28. package/dist/chunks/document-dashboard-inputs-BrYYlRVo.js +10678 -0
  29. package/dist/chunks/document-sheet-utils-C1eEldxs.js +1076 -0
  30. package/dist/chunks/{edit-dashboard-visual-ByV0OwSp.js → edit-dashboard-visual-Bzchfgga.js} +4744 -4746
  31. package/dist/chunks/editor-draft-sync-BN5qYHPF.js +15 -0
  32. package/dist/chunks/filter-value-text-BhWugPWE.js +163 -0
  33. package/dist/chunks/index-CqMiAkay.js +3164 -0
  34. package/dist/chunks/index-CuHybtft.js +51 -0
  35. package/dist/chunks/layout-grid-Bgzth8vd.js +16 -0
  36. package/dist/chunks/{matrix-analytical-definition-CgBTD6H8.js → matrix-analytical-definition-bcprSe4u.js} +1 -1
  37. package/dist/chunks/{matrix-card-CAdizkUl.js → matrix-card-CJn1hB5V.js} +13 -12
  38. package/dist/chunks/matrix-definition-DQDI2okF.js +206 -0
  39. package/dist/chunks/{matrix-formatter-DJCk8Znf.js → matrix-formatter-DQ8avoIQ.js} +648 -457
  40. package/dist/chunks/matrix-member-presentation-BNPSDKBG.js +105 -0
  41. package/dist/chunks/{matrix-operation-contract-BKupLHXL.js → matrix-operation-contract-B8PBF1Gd.js} +134 -133
  42. package/dist/chunks/{metric-comparison-BKHyvnAy.js → metric-comparison-CojWeLqx.js} +1 -1
  43. package/dist/chunks/{palette-Cp1hqZtm.js → palette-D10o_yYX.js} +1 -1
  44. package/dist/chunks/pivot-header-presentation-MkcKnjn3.js +42 -0
  45. package/dist/chunks/{pivot-result-identity-Bs4tLtLo.js → pivot-result-identity-D6hhcRXi.js} +1 -1
  46. package/dist/chunks/pivot-result-lifecycle-8qCDmpKc.js +804 -0
  47. package/dist/chunks/raw-temporal-D61lr48Y.js +1464 -0
  48. package/dist/chunks/{raw-temporal-contract-mLFS-9wk.js → raw-temporal-contract-C51YG48G.js} +1 -1
  49. package/dist/chunks/report-preferences-dialog-CWhSbc5_.js +1808 -0
  50. package/dist/chunks/{report-runtime-context-CG_I0PPW.js → report-runtime-context-B984Nq1E.js} +8 -7
  51. package/dist/chunks/save-CfJpQQ68.js +21 -0
  52. package/dist/chunks/saved-dashboard-context-Dqve2jlB.js +566 -0
  53. package/dist/chunks/{selection-reducer-CiDEtmAq.js → selection-reducer-vKIb_jS6.js} +2 -2
  54. package/dist/chunks/{semaphor-ready-indicator-CHu1L-lo.js → semaphor-ready-indicator-ldcwmLoY.js} +65803 -62954
  55. package/dist/chunks/{shelf-drop-preview-context-i-H6DFyU.js → shelf-drop-preview-context-BWxunXTq.js} +199 -196
  56. package/dist/chunks/{source-entity-resolution-C-oNyYMp.js → source-entity-resolution-CVA1a85c.js} +8 -8
  57. package/dist/chunks/switch-CvItuC1Q.js +8199 -0
  58. package/dist/chunks/{temporal-bucket-DlFuhCnT.js → temporal-bucket-D8JF7zKz.js} +86 -71
  59. package/dist/chunks/{temporal-bucket-contract-D2OuaVZ7.js → temporal-bucket-contract-DaOajRC7.js} +1 -1
  60. package/dist/chunks/{token-types-DtSJOUjh.js → token-types-bxUxXDX2.js} +1 -1
  61. package/dist/chunks/{upload-CAIpsti1.js → upload-BFX7apKV.js} +1 -1
  62. package/dist/chunks/{use-create-flow-overlay-state-Bj63WwHc.js → use-create-flow-overlay-state-RHgzVfcz.js} +331 -339
  63. package/dist/chunks/{validators-DMSH81OM.js → validators-Ej1DdCXa.js} +1050 -1510
  64. package/dist/chunks/visual-choice-JiJ-_3bi.js +204 -0
  65. package/dist/chunks/x-4f5U2XwU.js +100 -0
  66. package/dist/chunks/{zoned-wall-clock-1qlWCE20.js → zoned-wall-clock-MulfA26h.js} +2 -2
  67. package/dist/dashboard/index.js +2 -2
  68. package/dist/dashboard-authoring/index.js +823 -661
  69. package/dist/data-app-sdk/index.js +32 -30
  70. package/dist/data-app-sdk-adapters/index.js +23 -22
  71. package/dist/data-app-sdk-validation/index.js +23 -22
  72. package/dist/format-utils/index.js +173 -168
  73. package/dist/index.js +267 -258
  74. package/dist/layouts/index.js +236 -24
  75. package/dist/report-runtime-context/index.js +2 -2
  76. package/dist/style.css +1 -1
  77. package/dist/surfboard/index.js +2 -2
  78. package/dist/types/assistant-context.d.ts +2 -0
  79. package/dist/types/assistant-protocol.d.ts +2 -0
  80. package/dist/types/components/assistant/assistant-entry-points.d.ts +18 -0
  81. package/dist/types/components/assistant/assistant-provider.d.ts +19 -0
  82. package/dist/types/components/assistant/assistant-store.d.ts +52 -0
  83. package/dist/types/components/assistant/use-assistant.d.ts +38 -0
  84. package/dist/types/components/index.d.ts +5 -1
  85. package/dist/types/components/surfboard/filter/types.d.ts +5 -2
  86. package/dist/types/index.js +50 -51
  87. package/dist/types/lib/api/invalidate-token.d.ts +7 -0
  88. package/dist/types/lib/charts/cartesian-fields.d.ts +64 -0
  89. package/dist/types/lib/charts/types.d.ts +7 -0
  90. package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-storage-transition.d.ts +14 -2
  91. package/dist/types/lib/dashboard-inputs/dashboard-input-target-context.d.ts +5 -6
  92. package/dist/types/lib/dashboard-inputs/dashboard-input-values.d.ts +8 -3
  93. package/dist/types/lib/dashboard-inputs/resolve-dashboard-input-context.d.ts +11 -6
  94. package/dist/types/lib/dashboard-pagination/dashboard-card-pagination.d.ts +7 -0
  95. package/dist/types/lib/dashboard-viewer/compatibility-input-storage.d.ts +79 -0
  96. package/dist/types/lib/dashboard-viewer/viewer-state.d.ts +3 -2
  97. package/dist/types/lib/document/document-table-data-policy.d.ts +15 -0
  98. package/dist/types/lib/filter-values/filter-mode.d.ts +22 -0
  99. package/dist/types/lib/hooks/use-calendar-context.d.ts +5 -0
  100. package/dist/types/lib/hooks/use-filter-option-browse.d.ts +5 -0
  101. package/dist/types/lib/hooks/use-text-filter.d.ts +9 -0
  102. package/dist/types/lib/print/print-inputs.d.ts +4 -2
  103. package/dist/types/lib/query-context/build-card-query-context.d.ts +12 -4
  104. package/dist/types/lib/query-context/build-dashboard-execution-snapshot.d.ts +93 -0
  105. package/dist/types/lib/query-context/card-server-request.d.ts +72 -0
  106. package/dist/types/lib/query-context/compile-dashboard-card-filters.d.ts +7 -0
  107. package/dist/types/lib/query-context/describe-card-execution-snapshot.d.ts +56 -0
  108. package/dist/types/lib/query-context/document-section-card-query.d.ts +45 -0
  109. package/dist/types/lib/query-context/resolve-runtime-card-filters.d.ts +17 -2
  110. package/dist/types/lib/stores/dashboard-store.d.ts +34 -11
  111. package/dist/types/lib/stores/editor-store.d.ts +4 -2
  112. package/dist/types/lib/types/token-types.d.ts +11 -0
  113. package/dist/types/lib/utils/card-type-change.d.ts +30 -0
  114. package/dist/types/lib/utils/comparison-window-caption.d.ts +12 -0
  115. package/dist/types/lib/utils/filter-default-value-utils.d.ts +13 -2
  116. package/dist/types/shared/analytics-protocol/applied-constraints.d.ts +74 -0
  117. package/dist/types/shared/analytics-protocol/contracts.d.ts +3 -0
  118. package/dist/types/shared/analytics-protocol/filter-field-ownership.d.ts +43 -0
  119. package/dist/types/shared/analytics-protocol/index.d.ts +3 -0
  120. package/dist/types/shared/analytics-protocol/matrix-window-contract.d.ts +1 -1
  121. package/dist/types/shared/analytics-protocol/visual-choice.d.ts +75 -0
  122. package/dist/types/shared/assistant-context/index.d.ts +9 -0
  123. package/dist/types/shared/assistant-context/project-context.d.ts +55 -0
  124. package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +130 -0
  125. package/dist/types/shared/assistant-protocol/add-to-dashboard.d.ts +17 -0
  126. package/dist/types/shared/assistant-protocol/artifact.d.ts +63 -0
  127. package/dist/types/shared/assistant-protocol/availability.d.ts +39 -0
  128. package/dist/types/shared/assistant-protocol/context.d.ts +952 -0
  129. package/dist/types/shared/assistant-protocol/conversation.d.ts +38 -0
  130. package/dist/types/shared/assistant-protocol/index.d.ts +16 -0
  131. package/dist/types/shared/assistant-protocol/limits.d.ts +53 -0
  132. package/dist/types/shared/assistant-protocol/parts.d.ts +140 -0
  133. package/dist/types/shared/assistant-protocol/request.d.ts +77 -0
  134. package/dist/types/shared/assistant-protocol/sources.d.ts +27 -0
  135. package/dist/types/shared/assistant-protocol/token-config.d.ts +32 -0
  136. package/dist/types/shared/assistant-protocol/transcript.d.ts +40 -0
  137. package/dist/types/shared/dashboard-authoring/card-query-request.d.ts +112 -0
  138. package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +1794 -0
  139. package/dist/types/shared/dashboard-authoring/index.d.ts +5 -0
  140. package/dist/types/shared/dashboard-authoring/new-card.d.ts +10 -0
  141. package/dist/types/shared/dashboard-authoring/operations/apply-dashboard-operations.d.ts +40 -0
  142. package/dist/types/shared/dashboard-authoring/resolved-primary-date-field-validation.d.ts +16 -0
  143. package/dist/types/shared/format-utils/filter-detail.d.ts +70 -0
  144. package/dist/types/shared/format-utils/filter-value-text.d.ts +15 -0
  145. package/dist/types/shared/format-utils/index.d.ts +3 -0
  146. package/dist/types/shared/format-utils/raw-temporal.d.ts +7 -0
  147. package/dist/types/shared/format-utils/temporal-bucket.d.ts +7 -0
  148. package/dist/types/shared/layouts/frame-layouts.d.ts +23 -0
  149. package/dist/types/shared/layouts/index.d.ts +1 -0
  150. package/package.json +12 -2
  151. package/dist/chunks/calculated-field-identity-BptYhyOP.js +0 -1326
  152. package/dist/chunks/calendar-day-equality-BRjN1S9h.js +0 -383
  153. package/dist/chunks/card-config-utils-BOM1dxCk.js +0 -1150
  154. package/dist/chunks/constants-DNWVy8Y3.js +0 -9
  155. package/dist/chunks/dashboard-json-B1dEQu98.js +0 -65
  156. package/dist/chunks/field-aggregations-CoLzYHeL.js +0 -1229
  157. package/dist/chunks/index-DTcTAGGM.js +0 -4101
  158. package/dist/chunks/matrix-continuation-C4sRcjZU.js +0 -72
  159. package/dist/chunks/matrix-control-sources-DTqcA2_L.js +0 -636
  160. package/dist/chunks/matrix-definition-D9iShKZI.js +0 -87
  161. package/dist/chunks/matrix-member-presentation-Ct8GuxHt.js +0 -209
  162. package/dist/chunks/numeric-presentation-CWu3gunq.js +0 -537
  163. package/dist/chunks/pivot-header-presentation-CHs2GFrM.js +0 -753
  164. package/dist/chunks/pivot-result-lifecycle-DQz_gjGu.js +0 -789
  165. package/dist/chunks/raw-temporal-iMXRK-Qz.js +0 -930
  166. package/dist/chunks/report-preferences-dialog-DXPjteCU.js +0 -1623
  167. package/dist/chunks/save-kO6cIaob.js +0 -34
  168. package/dist/chunks/semantic-format-DiqYeKwU.js +0 -192
  169. package/dist/chunks/switch-DO8a0EfJ.js +0 -25004
  170. package/dist/chunks/temporal-input-presentation-BD7YNUzu.js +0 -195
  171. package/dist/chunks/x-CXDkqdur.js +0 -149
  172. package/dist/types/lib/class-utils.d.ts +0 -2
  173. package/dist/types/lib/document/document-input-runtime.d.ts +0 -26
  174. package/dist/types/lib/utils.d.ts +0 -51
@@ -1,6 +1,6 @@
1
- import { l as A } from "./validators-DMSH81OM.js";
2
- const D = 8, v = 6, p = Object.freeze([]);
3
- function q(e) {
1
+ import { k as _ } from "./validators-Ej1DdCXa.js";
2
+ const S = 8, v = 6, p = Object.freeze([]);
3
+ function w(e) {
4
4
  switch (e.type) {
5
5
  case "table":
6
6
  case "chart":
@@ -11,7 +11,7 @@ function q(e) {
11
11
  return p;
12
12
  }
13
13
  }
14
- function T(e, t) {
14
+ function $(e, t) {
15
15
  switch (e.type) {
16
16
  case "table":
17
17
  case "chart": {
@@ -45,7 +45,7 @@ function K(e) {
45
45
  card: r
46
46
  });
47
47
  for (const n of ((a = i.document) == null ? void 0 : a.sections) || [])
48
- for (const r of q(n))
48
+ for (const r of w(n))
49
49
  t.push({
50
50
  kind: "documentSectionCard",
51
51
  sheetId: s,
@@ -59,7 +59,7 @@ function K(e) {
59
59
  function y(e) {
60
60
  return !!e && typeof e == "object" && !Array.isArray(e);
61
61
  }
62
- function Q(e) {
62
+ function L(e) {
63
63
  if (!y(e))
64
64
  return [{ path: "", message: "must be an object." }];
65
65
  const t = [];
@@ -68,9 +68,9 @@ function Q(e) {
68
68
  if (!Array.isArray(a))
69
69
  t.push({ path: "cards", message: "must be an array of KPI cards." });
70
70
  else {
71
- (a.length < 1 || a.length > D) && t.push({
71
+ (a.length < 1 || a.length > S) && t.push({
72
72
  path: "cards",
73
- message: `must hold 1 to ${D} KPI cards.`
73
+ message: `must hold 1 to ${S} KPI cards.`
74
74
  });
75
75
  const s = /* @__PURE__ */ new Set();
76
76
  a.forEach((n, r) => {
@@ -111,12 +111,12 @@ function k(e) {
111
111
  label: e.label
112
112
  };
113
113
  }
114
- function O(e) {
114
+ function C(e) {
115
115
  var a;
116
116
  const t = k(e.source);
117
117
  return t ? `${(a = e.source) == null ? void 0 : a.kind}:${t.qualifiedEntityName || t.entityName}` : "";
118
118
  }
119
- function C(e) {
119
+ function O(e) {
120
120
  return [
121
121
  e.id,
122
122
  e.qualifiedEntityName,
@@ -126,38 +126,38 @@ function C(e) {
126
126
  e.name,
127
127
  // Source-only fields from different datasets can otherwise share a key
128
128
  // and the second dataset would be silently dropped.
129
- O(e)
129
+ C(e)
130
130
  ].join("|");
131
131
  }
132
- function _(e) {
132
+ function q(e) {
133
133
  return [e.entityName, e.qualifiedEntityName || "", e.entityId || ""].join("|");
134
134
  }
135
135
  function P(e) {
136
136
  return e.entityName || e.qualifiedEntityName || "";
137
137
  }
138
- function j(e) {
138
+ function T(e) {
139
139
  var t, a;
140
140
  return !!(e.expression || e.derivedField || (a = (t = e.calculatedFormula) == null ? void 0 : t.inputFields) != null && a.length);
141
141
  }
142
- function $(e) {
143
- return A(e) ? !0 : e.entityName || e.qualifiedEntityName ? !1 : !e.source || j(e);
142
+ function j(e) {
143
+ return _(e) ? !0 : e.entityName || e.qualifiedEntityName ? !1 : !e.source || T(e);
144
144
  }
145
145
  function h(e, t) {
146
- const a = _(t);
146
+ const a = q(t);
147
147
  e.found.has(a) || e.found.set(a, t);
148
148
  }
149
149
  function l(e, t) {
150
- var F, b, g;
150
+ var I, b, F;
151
151
  if (!e) return;
152
- const a = C(e);
152
+ const a = O(e);
153
153
  if (t.visitedFields.has(a)) return;
154
154
  t.visitedFields.add(a);
155
- const i = $(e);
155
+ const i = j(e);
156
156
  if (!i) {
157
- const c = !e.entityName && !e.qualifiedEntityName ? k(e.source) : void 0;
157
+ const d = !e.entityName && !e.qualifiedEntityName ? k(e.source) : void 0;
158
158
  h(
159
159
  t,
160
- c || {
160
+ d || {
161
161
  // May be empty for qualified-only metadata; identity then comes from
162
162
  // `qualifiedEntityName` (see `identityFor` and the calculator).
163
163
  entityName: e.entityName || "",
@@ -167,20 +167,20 @@ function l(e, t) {
167
167
  }
168
168
  );
169
169
  }
170
- t.includeMetricFilterDatasets && "parameters" in e && ((F = e.parameters) != null && F.filters) && N(e.parameters.filters, t);
170
+ t.includeMetricFilterDatasets && "parameters" in e && ((I = e.parameters) != null && I.filters) && N(e.parameters.filters, t);
171
171
  const s = (b = e.calculatedFormula) == null ? void 0 : b.inputFields, n = !!(s && s.length > 0);
172
- n && s.forEach((c) => l(c, t));
173
- let r = !1, d = !1;
174
- const u = n || (g = e.derivedField) == null ? void 0 : g.inputs;
172
+ n && s.forEach((d) => l(d, t));
173
+ let r = !1, c = !1;
174
+ const u = n || (F = e.derivedField) == null ? void 0 : F.inputs;
175
175
  if (u && Object.keys(u).length > 0)
176
- for (const c of Object.values(u)) {
177
- const o = c.field.source;
176
+ for (const d of Object.values(u)) {
177
+ const o = d.field.source;
178
178
  if (!o) {
179
- n || (d = !0);
179
+ n || (c = !0);
180
180
  continue;
181
181
  }
182
182
  if (o.kind === "sql") {
183
- d = !0;
183
+ c = !0;
184
184
  continue;
185
185
  }
186
186
  if (o.kind === "semantic")
@@ -190,16 +190,16 @@ function l(e, t) {
190
190
  label: o.label
191
191
  });
192
192
  else {
193
- const E = [o.databaseName, o.schemaName, o.tableName].filter((S) => !!(S && S.trim())).join(".");
193
+ const g = [o.databaseName, o.schemaName, o.tableName].filter((D) => !!(D && D.trim())).join(".");
194
194
  h(t, {
195
195
  entityName: o.tableName,
196
- qualifiedEntityName: E.includes(".") ? E : void 0,
196
+ qualifiedEntityName: g.includes(".") ? g : void 0,
197
197
  label: o.label
198
198
  });
199
199
  }
200
200
  r = !0;
201
201
  }
202
- d && (t.complete = !1), i && !n && !r && (t.complete = !1);
202
+ c && (t.complete = !1), i && !n && !r && (t.complete = !1);
203
203
  }
204
204
  function N(e, t) {
205
205
  if (e && !t.visitedGroups.has(e.id)) {
@@ -219,63 +219,70 @@ function m(e, t = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set()) {
219
219
  includeMetricFilterDatasets: e
220
220
  };
221
221
  }
222
- function I(e, t) {
222
+ function E(e, t) {
223
223
  var i;
224
224
  const a = (i = e.qualifiedEntityName) != null && i.includes(".") ? e.qualifiedEntityName : void 0;
225
225
  return t === "qualifiedOnly" ? a : t === "preferQualified" ? a || e.entityName || void 0 : e.entityName || void 0;
226
226
  }
227
- function x(e) {
227
+ function Q(e) {
228
228
  const t = m(!1);
229
229
  return l(e, t), { datasets: Array.from(t.found.values()), complete: t.complete };
230
230
  }
231
- function w(e, t, a = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), s = f) {
231
+ function A(e, t, a = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), s = f) {
232
232
  const n = { ...f, ...s }, r = m(n.includeMetricFilterDatasets, a, i);
233
- l(e, r), r.found.forEach((d) => {
234
- const u = I(d, n.preferQualifiedIdentity ? "preferQualified" : "name");
233
+ l(e, r), r.found.forEach((c) => {
234
+ const u = E(c, n.preferQualifiedIdentity ? "preferQualified" : "name");
235
235
  u && t.add(u);
236
236
  });
237
237
  }
238
- function L(e, t) {
239
- w(e, t, /* @__PURE__ */ new Set(), /* @__PURE__ */ new Set(), {
238
+ function R(e, t) {
239
+ A(e, t, /* @__PURE__ */ new Set(), /* @__PURE__ */ new Set(), {
240
240
  preferQualifiedIdentity: !0
241
241
  });
242
242
  }
243
- function B(e, t, a = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set()) {
243
+ function U(e, t, a = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set()) {
244
244
  const s = m(!0, a, i);
245
245
  l(e, s), s.found.forEach((n) => {
246
- const r = I(n, "qualifiedOnly");
246
+ const r = E(n, "qualifiedOnly");
247
247
  r && t.add(r);
248
248
  });
249
249
  }
250
- function G(e, t, a = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set()) {
251
- w(e, t, a, i, {
250
+ function x(e, t, a = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set()) {
251
+ A(e, t, a, i, {
252
252
  includeMetricFilterDatasets: !1
253
253
  });
254
254
  }
255
- function R(e, t, a = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), s = f) {
255
+ function B(e, t, a = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), s = f) {
256
256
  const n = { ...f, ...s }, r = m(n.includeMetricFilterDatasets, a, i);
257
- N(e, r), r.found.forEach((d) => {
258
- const u = I(d, n.preferQualifiedIdentity ? "preferQualified" : "name");
257
+ N(e, r), r.found.forEach((c) => {
258
+ const u = E(c, n.preferQualifiedIdentity ? "preferQualified" : "name");
259
259
  u && t.add(u);
260
260
  });
261
261
  }
262
- function U(e, t) {
262
+ function G(e, t) {
263
263
  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, (i) => i.toUpperCase());
264
264
  }
265
+ const z = {
266
+ database: null,
267
+ schema: null,
268
+ table: null
269
+ }, V = "__card_default__";
265
270
  export {
266
- D,
271
+ V as C,
272
+ S as D,
273
+ z as E,
267
274
  P as a,
268
- L as b,
269
- w as c,
275
+ R as b,
276
+ A as c,
270
277
  k as d,
271
- B as e,
272
- G as f,
273
- R as g,
274
- U as h,
278
+ U as e,
279
+ x as f,
280
+ B as g,
281
+ G as h,
275
282
  v as i,
276
- q as j,
277
- Q as k,
283
+ w as j,
284
+ L as k,
278
285
  K as l,
279
- T as m,
280
- x as r
286
+ $ as m,
287
+ Q as r
281
288
  };
@@ -0,0 +1,349 @@
1
+ var T = Object.defineProperty;
2
+ var q = (e, a, i) => a in e ? T(e, a, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[a] = i;
3
+ var S = (e, a, i) => q(e, typeof a != "symbol" ? a + "" : a, i);
4
+ import { z as t } from "zod";
5
+ import { s as k } from "./analytics-base-schemas-BFAoRlkU.js";
6
+ const Z = 1;
7
+ function y(e) {
8
+ return `You've used ${e === void 0 ? "today's questions" : `today's ${e} questions`}. They reset tomorrow. To keep going, contact your administrator.`;
9
+ }
10
+ function W(e, a = {}) {
11
+ return e === "daily_limit_reached" ? y(a.dailyLimit) : v[e];
12
+ }
13
+ const v = {
14
+ assistant_unavailable: "The assistant is not available here.",
15
+ context_invalid: "Something on this page changed. Try again.",
16
+ context_too_large: "There is too much on this page to send with your question. Ask about one card, or clear some filters.",
17
+ conversation_not_found: "This conversation has ended. Start a new one.",
18
+ conversation_full: "This conversation is full. Start a new one.",
19
+ turn_in_progress: "Still answering your last question.",
20
+ daily_limit_reached: y(),
21
+ budget_exhausted: "This question needed more steps than one answer allows. Try asking for less at once.",
22
+ not_permitted: "You do not have access to the data this needs.",
23
+ no_data_found: "No data matched this question.",
24
+ model_unavailable: "The assistant could not answer right now. Try again."
25
+ }, j = {
26
+ messageChars: 4e3,
27
+ /** The whole serialized AssistantContext, in UTF-8 bytes. */
28
+ contextBytes: 48 * 1024,
29
+ /** The whole request body (context, message, added sources), in UTF-8 bytes. */
30
+ requestBytes: 128 * 1024,
31
+ summaryCards: 30,
32
+ // AssistantContext.cards
33
+ otherSheets: 50,
34
+ activeInputs: 50,
35
+ /** Values listed for one input, or in one filter's text. */
36
+ inputValues: 50,
37
+ addedSources: 50,
38
+ cardFields: 60,
39
+ cardFilters: 40,
40
+ cardControls: 40,
41
+ drillSteps: 10,
42
+ sqlChars: 2e4,
43
+ sqlParameters: 40,
44
+ idChars: 200,
45
+ labelChars: 500,
46
+ /** One filter, control or SQL parameter description. */
47
+ textChars: 4e3,
48
+ turnsPerConversation: 40,
49
+ conversationBytes: 1024 * 1024,
50
+ toolCallsPerTurn: 12,
51
+ secondsPerTurn: 120,
52
+ artifactRecords: 200,
53
+ // rows kept on an artifact (D4-6: several fit in a conversation's 1 MB)
54
+ conversationTtlSeconds: 24 * 60 * 60
55
+ };
56
+ function J(e) {
57
+ return new TextEncoder().encode(JSON.stringify(e)).length;
58
+ }
59
+ function U(e, a) {
60
+ if (e.length <= a) return e;
61
+ const i = (r) => ` [${r} more characters not shown]`, s = a - i(e.length).length;
62
+ return `${e.slice(0, s)}${i(e.length - s)}`;
63
+ }
64
+ class Y extends Error {
65
+ constructor(i) {
66
+ super(v.context_too_large);
67
+ S(this, "code", "context_too_large");
68
+ this.bytes = i, this.name = "AssistantContextTooLargeError";
69
+ }
70
+ }
71
+ const A = 1, d = j, p = t.string().min(1).max(d.idChars), h = t.string().max(d.labelChars), u = t.string().max(d.textChars), b = t.number().int().positive(), I = t.string().min(1).max(100), $ = t.object({ id: p, title: h }).strict(), N = t.object({
72
+ inputId: p,
73
+ label: h,
74
+ value: t.discriminatedUnion("kind", [
75
+ t.object({
76
+ kind: t.literal("set"),
77
+ text: u,
78
+ omittedValues: b.optional(),
79
+ notApplied: t.literal("opened_from_another_dashboard").optional(),
80
+ fingerprint: I
81
+ }).strict(),
82
+ t.object({ kind: t.literal("varies") }).strict()
83
+ ]),
84
+ globalDate: t.literal(!0).optional()
85
+ }).strict(), _ = {
86
+ id: p,
87
+ title: h,
88
+ visualType: t.string().max(100),
89
+ source: k.optional()
90
+ }, E = t.object(_).strict(), w = (e) => t.object(Object.fromEntries(e.map((a) => [a, b.optional()]))).strict().optional(), L = t.discriminatedUnion("status", [
91
+ t.object({
92
+ status: t.literal("described"),
93
+ fields: t.array(
94
+ t.object({
95
+ role: t.enum(["row", "column", "measure", "detail"]),
96
+ label: h,
97
+ name: h,
98
+ aggregate: t.string().max(40).optional(),
99
+ granularity: t.string().max(40).optional()
100
+ }).strict()
101
+ ).max(d.cardFields),
102
+ filters: t.array(
103
+ t.object({
104
+ origin: t.enum(["dashboard_input", "card_input", "card", "drill", "selection"]),
105
+ text: u,
106
+ omittedValues: b.optional()
107
+ }).strict()
108
+ ).max(d.cardFilters),
109
+ controls: t.array(t.object({ label: h, valueText: u }).strict()).max(d.cardControls),
110
+ drillPath: t.array(u).max(d.drillSteps),
111
+ sql: t.object({
112
+ text: t.string().max(d.sqlChars),
113
+ parameters: t.array(t.object({ name: h, valueText: u }).strict()).max(d.sqlParameters)
114
+ }).strict().optional(),
115
+ comparisons: t.array(u).max(d.cardFields).optional(),
116
+ omitted: w(["fields", "filters", "controls", "drillSteps", "sqlParameters", "comparisons"])
117
+ }).strict(),
118
+ t.object({
119
+ status: t.literal("not_described"),
120
+ reason: t.enum(["matrix", "custom_visual", "python", "snapshot_blocked", "snapshot_pending"]),
121
+ message: u.optional()
122
+ }).strict()
123
+ ]), P = t.object({
124
+ ..._,
125
+ fingerprint: I,
126
+ description: L
127
+ }).strict(), z = t.object({
128
+ version: t.literal(A),
129
+ surface: t.enum(["dashboard", "editor", "none"]),
130
+ dashboard: t.object({
131
+ id: p,
132
+ title: h,
133
+ unsavedEdits: t.boolean()
134
+ }).strict().optional(),
135
+ sheet: $.optional(),
136
+ otherSheets: t.array($).max(d.otherSheets),
137
+ activeInputs: t.array(N).max(d.activeInputs),
138
+ cards: t.array(E).max(d.summaryCards),
139
+ selectedCard: P.optional(),
140
+ editing: t.object({ mode: t.enum(["visual", "sql"]) }).strict().optional(),
141
+ omitted: w(["otherSheets", "activeInputs", "cards"]),
142
+ timeZone: t.string().min(1).max(100)
143
+ }).strict().superRefine((e, a) => {
144
+ e.surface !== "none" && !e.dashboard && a.addIssue({
145
+ code: t.ZodIssueCode.custom,
146
+ path: ["dashboard"],
147
+ message: `required on the ${e.surface} surface`
148
+ }), e.selectedCard && e.surface === "none" && a.addIssue({
149
+ code: t.ZodIssueCode.custom,
150
+ path: ["selectedCard"],
151
+ message: "only on the dashboard and editor surfaces"
152
+ }), e.surface === "editor" != !!e.editing && a.addIssue({
153
+ code: t.ZodIssueCode.custom,
154
+ path: ["editing"],
155
+ message: "required on the editor surface, and only there"
156
+ });
157
+ });
158
+ function G(e, a) {
159
+ if (!e) return [];
160
+ const i = [];
161
+ e.surface !== a.surface && i.push({
162
+ kind: "surface_changed",
163
+ from: e.surface,
164
+ to: a.surface
165
+ }), e.sheet && a.sheet && e.sheet.id !== a.sheet.id && i.push({
166
+ kind: "sheet_changed",
167
+ fromSheetId: e.sheet.id,
168
+ toSheetId: a.sheet.id
169
+ });
170
+ const s = e.selectedCard, r = a.selectedCard;
171
+ (s == null ? void 0 : s.id) !== (r == null ? void 0 : r.id) ? i.push({
172
+ kind: "selection_changed",
173
+ ...s ? { fromCardId: s.id } : {},
174
+ ...r ? { toCardId: r.id } : {}
175
+ }) : s && r && s.fingerprint !== r.fingerprint && i.push({ kind: "card_changed", cardId: r.id });
176
+ const l = R(
177
+ e.activeInputs ?? [],
178
+ a.activeInputs
179
+ );
180
+ return l.length > 0 && i.push({ kind: "inputs_changed", inputIds: l }), i;
181
+ }
182
+ function R(e, a) {
183
+ const i = (o) => o ? o.value.kind === "set" ? o.value.fingerprint : "varies" : void 0, s = new Map(e.map((o) => [o.inputId, o])), r = new Map(a.map((o) => [o.inputId, o]));
184
+ return [.../* @__PURE__ */ new Set([...s.keys(), ...r.keys()])].filter(
185
+ (o) => i(s.get(o)) !== i(r.get(o))
186
+ );
187
+ }
188
+ function H(e, a, i) {
189
+ var r, l, o;
190
+ const s = [];
191
+ if (e.surface === "none" || !e.dashboard)
192
+ s.push(
193
+ "The user is not looking at a dashboard. Answer from the sources they added; if none fit, find the data with the discovery tools or ask which data to use."
194
+ );
195
+ else {
196
+ const n = e.surface === "editor" ? "editing a visual on" : "looking at";
197
+ s.push(
198
+ `The user is ${n} the dashboard ${c(e.dashboard.title)} (id ${e.dashboard.id})${e.dashboard.unsavedEdits ? ", which has unsaved edits" : ""}.`
199
+ ), e.sheet && s.push(
200
+ `Current sheet: ${c(e.sheet.title)} (id ${e.sheet.id}).`
201
+ ), e.otherSheets.length > 0 && s.push(
202
+ `Other sheets: ${e.otherSheets.map((f) => c(f.title)).join(", ")}${m((r = e.omitted) == null ? void 0 : r.otherSheets, "sheets")}.`
203
+ );
204
+ }
205
+ if (e.activeInputs.length > 0) {
206
+ s.push(
207
+ "",
208
+ "Dashboard inputs with a value (which of them a card applies is in that card's description when the user asks about it):"
209
+ );
210
+ for (const n of e.activeInputs)
211
+ s.push(`- ${x(n)}`);
212
+ (l = e.omitted) != null && l.activeInputs && s.push(`- ${e.omitted.activeInputs} more inputs are not listed.`);
213
+ }
214
+ if (e.cards.length > 0) {
215
+ s.push("", "Cards on this sheet:");
216
+ for (const n of e.cards)
217
+ s.push(`- ${g(n)}`);
218
+ (o = e.omitted) != null && o.cards && s.push(`- ${e.omitted.cards} more cards are not listed.`);
219
+ }
220
+ if (e.selectedCard && s.push("", ...B(e.selectedCard, e.editing)), i.length > 0) {
221
+ s.push("", "Sources the user added:");
222
+ for (const n of i)
223
+ s.push(`- ${C(n)}`);
224
+ }
225
+ if (a.length > 0) {
226
+ s.push("", "Since the last question:");
227
+ for (const n of a)
228
+ s.push(`- ${D(n, e)}`);
229
+ }
230
+ return s.push("", `The user's time zone is ${e.timeZone}.`), s.join(`
231
+ `);
232
+ }
233
+ function c(e) {
234
+ return JSON.stringify(e);
235
+ }
236
+ function m(e, a) {
237
+ return e ? `, and ${e} more ${a}` : "";
238
+ }
239
+ function g(e) {
240
+ return `${c(e.title)} (card id ${e.id}, ${e.visualType})${e.source ? ` from ${C(e.source)}` : ""}`;
241
+ }
242
+ function x(e) {
243
+ const { value: a } = e;
244
+ return a.kind === "varies" ? `${c(e.label)}: differs by card; ask about a card to see its value` : a.notApplied ? `${a.text} (not applied in this view: it was opened from another dashboard without this dashboard's own filters)` : `${a.text}${e.globalDate ? ", applied to each card's own date field, on cards that have one" : ""}`;
245
+ }
246
+ const F = {
247
+ matrix: "it is a Matrix card",
248
+ custom_visual: "it is a custom visual",
249
+ python: "it is computed with Python",
250
+ snapshot_blocked: "the dashboard could not compile it",
251
+ snapshot_pending: "it was still loading when the question was sent"
252
+ }, O = {
253
+ dashboard_input: "dashboard input",
254
+ card_input: "the card's own input",
255
+ card: "the card's own filter",
256
+ drill: "drill",
257
+ selection: "selection on another card"
258
+ };
259
+ function B(e, a) {
260
+ var l;
261
+ const i = a ? [
262
+ `The user is editing the visual ${g(e)} in ${a.mode === "sql" ? "SQL" : "visual"} mode. What follows is their draft as it is on screen, which may not be saved: fromCard on this card runs the draft, and its rows are the draft's, not the saved card's. You cannot change the visual; to help change it, explain the steps in the editor or write SQL for them to paste.`
263
+ ] : [`The user is asking about the card ${g(e)}.`], s = e.description;
264
+ if (s.status === "not_described")
265
+ return i.push(
266
+ `How this card is built is not available to you: ${F[s.reason]}${s.message ? ` (${s.message})` : ""}. Answer with the tools, and say that you could not read the card's definition.`
267
+ ), i;
268
+ const r = s.omitted ?? {};
269
+ if (i.push(a ? "What the draft runs, as the editor compiled it:" : "What the card runs, as the dashboard compiled it:"), s.fields.length > 0) {
270
+ const o = s.fields.map((n) => {
271
+ const f = [
272
+ n.name,
273
+ n.aggregate,
274
+ n.granularity ? `by ${n.granularity}` : void 0
275
+ ].filter(Boolean);
276
+ return `${n.role} ${c(n.label)} (${f.join(", ")})`;
277
+ });
278
+ i.push(`- Fields: ${o.join("; ")}${m(r.fields, "fields not listed")}.`);
279
+ } else
280
+ i.push("- Fields: none.");
281
+ if (s.filters.length > 0) {
282
+ i.push("- Filters, all applied together:");
283
+ for (const o of s.filters)
284
+ i.push(` - ${O[o.origin]}: ${o.text}`);
285
+ r.filters && i.push(` - ${r.filters} more filters are not listed.`);
286
+ } else
287
+ i.push("- Filters: none.");
288
+ if (s.drillPath.length > 0 && i.push(
289
+ `- Drilled into: ${s.drillPath.join(", then ")}${m(r.drillSteps, "steps")}.`
290
+ ), s.controls.length > 0) {
291
+ i.push("- Controls:");
292
+ for (const o of s.controls)
293
+ i.push(` - ${c(o.label)}: ${o.valueText}`);
294
+ r.controls && i.push(` - ${r.controls} more controls are not listed.`);
295
+ }
296
+ if (s.sql && (i.push("- SQL:", "```sql", s.sql.text, "```"), s.sql.parameters.length > 0 && i.push(
297
+ `- SQL parameters: ${s.sql.parameters.map((o) => `${o.name} = ${o.valueText}`).join("; ")}${m(r.sqlParameters, "parameters")}.`
298
+ )), (l = s.comparisons) != null && l.length) {
299
+ i.push("- Comparisons (the windows are known only once a query runs):");
300
+ for (const o of s.comparisons) i.push(` - ${o}`);
301
+ r.comparisons && i.push(` - ${r.comparisons} more comparisons are not listed.`);
302
+ }
303
+ return i.push(
304
+ "This lists the card's fields, filters, drill path, controls, SQL and comparisons; it does not include the card's sorting, row limit or calculated-field formulas. A query you build yourself can differ from the card."
305
+ ), i;
306
+ }
307
+ function C(e) {
308
+ switch (e.kind) {
309
+ case "semantic":
310
+ return `dataset ${c(e.label ?? e.datasetName)} (domainId ${e.domainId}, datasetName ${e.datasetName})`;
311
+ case "physical":
312
+ return `table ${[e.databaseName, e.schemaName, e.tableName].filter(Boolean).join(".")} (connectionId ${e.connectionId})`;
313
+ case "sql":
314
+ return `SQL on ${e.label ? c(e.label) : "a connection"} (connectionId ${e.connectionId})`;
315
+ }
316
+ }
317
+ function D(e, a) {
318
+ var i;
319
+ switch (e.kind) {
320
+ case "surface_changed":
321
+ return `the user moved from the ${e.from} view to the ${e.to} view.`;
322
+ case "sheet_changed":
323
+ return `the user switched sheets (now ${c(((i = a.sheet) == null ? void 0 : i.title) ?? e.toSheetId)}).`;
324
+ case "selection_changed":
325
+ return e.toCardId ? `the user is now asking about card ${e.toCardId}.` : "the user is no longer asking about a specific card.";
326
+ case "card_changed":
327
+ return `card ${e.cardId} now runs differently (its fields, filters, controls or SQL changed).`;
328
+ case "inputs_changed":
329
+ return `these dashboard inputs changed: ${e.inputIds.map((r) => {
330
+ const l = a.activeInputs.find((o) => o.inputId === r);
331
+ return l ? c(l.label) : `input ${r} (now cleared)`;
332
+ }).join(", ")}.`;
333
+ }
334
+ }
335
+ export {
336
+ j as A,
337
+ z as a,
338
+ J as b,
339
+ Y as c,
340
+ A as d,
341
+ G as e,
342
+ U as f,
343
+ C as g,
344
+ Z as h,
345
+ y as i,
346
+ W as j,
347
+ v as k,
348
+ H as r
349
+ };
@@ -0,0 +1,16 @@
1
+ const t = [
2
+ "docked-right",
3
+ "docked-left",
4
+ "centered",
5
+ "full-page"
6
+ ];
7
+ function A(s) {
8
+ return typeof s == "string" && t.includes(s);
9
+ }
10
+ const n = "Assistant", S = 40;
11
+ export {
12
+ t as A,
13
+ n as D,
14
+ S as a,
15
+ A as i
16
+ };
@@ -0,0 +1,56 @@
1
+ const c = ["utf-8-bom", "utf-8"], o = "utf-8-bom", i = [",", ";", " "], f = `\r
2
+ `, g = "text/csv; charset=utf-8";
3
+ function m(n) {
4
+ return n == null || typeof n == "string" || typeof n == "number" ? n : typeof n == "object" ? JSON.stringify(n) : String(n);
5
+ }
6
+ const d = "\uFEFF";
7
+ function e(n) {
8
+ return c.find((r) => r === n);
9
+ }
10
+ function p(n) {
11
+ return i.find((r) => r === n);
12
+ }
13
+ function R(n) {
14
+ return e(n.requested) ?? e(n.dashboardDefault) ?? o;
15
+ }
16
+ function a(n) {
17
+ return n === "utf-8-bom" ? d : "";
18
+ }
19
+ function _(n) {
20
+ const r = n.trimStart().charAt(0);
21
+ return ["=", "+", "-", "@"].includes(r) || [" ", "\r", `
22
+ `].includes(n.charAt(0)) ? `'${n}` : n;
23
+ }
24
+ function u(n, r = ",") {
25
+ if (n == null)
26
+ return "";
27
+ const t = String(n);
28
+ return t.includes(r) || t.includes('"') || t.includes(`
29
+ `) || t.includes("\r") ? `"${t.replace(/"/g, '""')}"` : t;
30
+ }
31
+ function s(n, r) {
32
+ return n.map((t) => u(t, r)).join(r) + f;
33
+ }
34
+ function C(n, r) {
35
+ return n.map((t) => s(t, r)).join("");
36
+ }
37
+ function l(n) {
38
+ return a(n.encoding) + (n.header ? s(n.header, n.delimiter) : "") + C(n.rows, n.delimiter);
39
+ }
40
+ export {
41
+ c as C,
42
+ o as D,
43
+ i as a,
44
+ f as b,
45
+ s as c,
46
+ g as d,
47
+ p as e,
48
+ a as f,
49
+ u as g,
50
+ _ as h,
51
+ C as i,
52
+ l as j,
53
+ e as p,
54
+ R as r,
55
+ m as t
56
+ };