react-semaphor 0.1.443 → 0.1.445

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 (133) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/analytics-protocol/index.cjs +1 -1
  3. package/dist/analytics-protocol/index.js +123 -107
  4. package/dist/appearance/index.cjs +1 -1
  5. package/dist/brand-studio/index.cjs +2 -2
  6. package/dist/brand-studio/index.js +5 -4
  7. package/dist/briefings/index.cjs +1 -1
  8. package/dist/briefings/index.js +526 -457
  9. package/dist/chunks/analyze-result-contract-BHb7sUUW.cjs +1 -0
  10. package/dist/chunks/analyze-result-contract-DUv3QnMl.js +29 -0
  11. package/dist/chunks/{braces-CbO-aIwH.js → braces-BKimshER.cjs} +1 -1
  12. package/dist/chunks/{code-editor-BpADiIlq.js → code-editor-B4gTfvc5.js} +6800 -6560
  13. package/dist/chunks/code-editor-BYVorgOf.cjs +138 -0
  14. package/dist/chunks/common-types-CQ6SHfLk.cjs +1 -0
  15. package/dist/chunks/{common-types-ClkOI-3O.js → common-types-DFsDdpH7.js} +22 -21
  16. package/dist/chunks/dashboard-CAiwJW3L.cjs +1397 -0
  17. package/dist/chunks/{dashboard-briefing-launcher-C60n8LqW.js → dashboard-briefing-launcher-2SLNOaTg.js} +26 -24
  18. package/dist/chunks/{dashboard-briefing-launcher-BYMLjZxG.js → dashboard-briefing-launcher-CHwjpUYz.cjs} +2 -2
  19. package/dist/chunks/{dashboard-controls-ti9Rcel2.js → dashboard-controls-BfL14aqO.js} +11 -9
  20. package/dist/chunks/{dashboard-controls-BH_fZYDU.js → dashboard-controls-BgGTg4yw.cjs} +2 -2
  21. package/dist/chunks/dashboard-date-comparison-definition-DZq0htjG.cjs +1 -0
  22. package/dist/chunks/dashboard-json-BOv8tCa9.cjs +1 -0
  23. package/dist/chunks/{dashboard-json-Bturr634.js → dashboard-json-BZwq3EcS.js} +14 -12
  24. package/dist/chunks/{dashboard-Bd1Quco-.js → dashboard-u61yfU6u.js} +50081 -47351
  25. package/dist/chunks/edit-dashboard-visual-BdVCH0DJ.cjs +182 -0
  26. package/dist/chunks/{edit-dashboard-visual-DglMds57.js → edit-dashboard-visual-njLPYip3.js} +6825 -6656
  27. package/dist/chunks/{editor-action-buttons-CRi0fhVW.js → editor-action-buttons-BhLX5Q6m.js} +24 -23
  28. package/dist/chunks/{editor-action-buttons-Cxo7_tNG.js → editor-action-buttons-CBVMFipA.cjs} +1 -1
  29. package/dist/chunks/{index-D7KJindZ.js → format-types-CSv0V7mm.cjs} +1 -1
  30. package/dist/chunks/{index-CnujJ3fa.js → format-types-CZH5w1lo.js} +23 -17
  31. package/dist/chunks/{layout-grid-B08pP7v6.js → layout-grid-3-HWzEwU.cjs} +1 -1
  32. package/dist/chunks/{metric-comparison-CPoDx56y.js → metric-comparison-BJ_Qu1ZF.js} +1 -1
  33. package/dist/chunks/metric-comparison-CUAJ8n4y.cjs +1 -0
  34. package/dist/chunks/{palette-C0yjT5Tv.js → palette-DW_l7Jr0.cjs} +1 -1
  35. package/dist/chunks/pivot-result-identity-B6QCWOSi.js +94 -0
  36. package/dist/chunks/pivot-result-identity-CDLRT-YG.cjs +1 -0
  37. package/dist/chunks/pivot-result-lifecycle-BM3Pl-D1.js +914 -0
  38. package/dist/chunks/pivot-result-lifecycle-DPc0ANwk.cjs +4 -0
  39. package/dist/chunks/presentation-execution-BTV-Q43g.cjs +1 -0
  40. package/dist/chunks/presentation-execution-CGlb7YZ6.js +637 -0
  41. package/dist/chunks/{report-preferences-dialog-TtwdAuNn.js → report-preferences-dialog-D_NJu2wU.js} +7 -6
  42. package/dist/chunks/report-preferences-dialog-r8QzOSFb.cjs +1 -0
  43. package/dist/chunks/report-runtime-context-C8LZFsqV.cjs +1 -0
  44. package/dist/chunks/report-runtime-context-Qzn11HQe.js +387 -0
  45. package/dist/chunks/{save-Xdc4pnys.js → save-4_uMnE6s.cjs} +1 -1
  46. package/dist/chunks/{search-Dcud9ajy.js → search-6ZmeMq55.cjs} +1 -1
  47. package/dist/chunks/temporal-bucket-BnPxGrAi.js +446 -0
  48. package/dist/chunks/temporal-bucket-authoring-BUZMuVca.js +205 -0
  49. package/dist/chunks/temporal-bucket-authoring-CPTwHzvs.cjs +1 -0
  50. package/dist/chunks/temporal-bucket-contract-B2bJ1oe4.js +108 -0
  51. package/dist/chunks/temporal-bucket-contract-ChDBWX8I.cjs +1 -0
  52. package/dist/chunks/temporal-bucket-pMnV-4Nj.cjs +1 -0
  53. package/dist/chunks/{comparison-document-migration-Dj6xZMCb.js → temporal-result-owner-Cb27SSG9.js} +152 -123
  54. package/dist/chunks/temporal-result-owner-f6-i65Fb.cjs +1 -0
  55. package/dist/chunks/token-types-BdQ8kHBm.cjs +1 -0
  56. package/dist/chunks/token-types-DLo91nOf.js +8 -0
  57. package/dist/chunks/{update-policy-DnF_74zC.js → update-policy-BxvYMYz0.cjs} +1 -1
  58. package/dist/chunks/{update-policy-De2NswtM.js → update-policy-eg59mQqv.js} +1 -1
  59. package/dist/chunks/validators-9D4KBqKD.cjs +1 -0
  60. package/dist/chunks/validators-wZ2WlNHc.js +4640 -0
  61. package/dist/dashboard/index.cjs +1 -1
  62. package/dist/dashboard/index.js +2 -2
  63. package/dist/dashboard-authoring/index.cjs +3 -3
  64. package/dist/dashboard-authoring/index.js +136 -126
  65. package/dist/data-app-builder/index.cjs +1 -1
  66. package/dist/data-app-builder/index.js +2 -2
  67. package/dist/data-app-codegen/index.cjs +1 -1
  68. package/dist/data-app-codegen/index.js +2 -2
  69. package/dist/data-app-codegen-node/index.cjs +1 -1
  70. package/dist/data-app-codegen-node/index.js +3 -3
  71. package/dist/data-app-sdk/index.cjs +2 -2
  72. package/dist/data-app-sdk/index.js +34 -35
  73. package/dist/data-app-sdk-adapters/index.cjs +1 -1
  74. package/dist/data-app-sdk-adapters/index.js +5 -5
  75. package/dist/data-app-sdk-validation/index.cjs +1 -1
  76. package/dist/data-app-sdk-validation/index.js +9 -10
  77. package/dist/format-utils/index.cjs +3 -3
  78. package/dist/format-utils/index.js +155 -176
  79. package/dist/index.cjs +1 -1
  80. package/dist/index.js +180 -174
  81. package/dist/report-runtime-context/index.cjs +1 -1
  82. package/dist/report-runtime-context/index.js +7 -392
  83. package/dist/shared/index.cjs +1 -1
  84. package/dist/style.css +1 -1
  85. package/dist/surfboard/index.cjs +1 -1
  86. package/dist/surfboard/index.js +3 -3
  87. package/dist/types/analytics-protocol.d.ts +257 -48
  88. package/dist/types/briefings.d.ts +138 -50
  89. package/dist/types/dashboard-assistant.d.ts +207 -52
  90. package/dist/types/dashboard-authoring.d.ts +182 -50
  91. package/dist/types/dashboard.d.ts +290 -48
  92. package/dist/types/data-app-builder.d.ts +48 -42
  93. package/dist/types/data-app-codegen-node.d.ts +50 -44
  94. package/dist/types/data-app-codegen.d.ts +50 -44
  95. package/dist/types/data-app-sdk-adapters.d.ts +48 -42
  96. package/dist/types/data-app-sdk-validation.d.ts +81 -43
  97. package/dist/types/data-app-sdk.d.ts +83 -45
  98. package/dist/types/format-utils.d.ts +645 -67
  99. package/dist/types/index.cjs +1 -1
  100. package/dist/types/index.js +19 -19
  101. package/dist/types/main.d.ts +298 -94
  102. package/dist/types/report-runtime-context.d.ts +3 -0
  103. package/dist/types/shared.d.ts +116 -41
  104. package/dist/types/surfboard.d.ts +290 -48
  105. package/dist/types/types.d.ts +455 -65
  106. package/package.json +3 -1
  107. package/dist/chunks/analyze-result-contract-BswhsmWT.js +0 -1
  108. package/dist/chunks/analyze-result-contract-CfOBEwaC.js +0 -1998
  109. package/dist/chunks/code-editor-M7HTUhdF.js +0 -138
  110. package/dist/chunks/common-types-C73-Ud1-.js +0 -1
  111. package/dist/chunks/comparison-document-migration-DbU_BTxR.js +0 -1
  112. package/dist/chunks/csv-utils-BZDvO2Fw.js +0 -376
  113. package/dist/chunks/csv-utils-Co0WxHke.js +0 -4
  114. package/dist/chunks/dashboard-cB3xmTNn.js +0 -1402
  115. package/dist/chunks/dashboard-date-comparison-definition-DGZr3m-b.js +0 -1
  116. package/dist/chunks/dashboard-json-Dw_55vSZ.js +0 -1
  117. package/dist/chunks/edit-dashboard-visual-BUc3NBQ4.js +0 -182
  118. package/dist/chunks/metric-comparison-DVy3fll_.js +0 -1
  119. package/dist/chunks/numeric-presentation-BJs5lSar.js +0 -517
  120. package/dist/chunks/numeric-presentation-Dlb-Dk4c.js +0 -1
  121. package/dist/chunks/report-preferences-dialog-CCvFqH4Q.js +0 -1
  122. package/dist/chunks/source-identity-5OPV4gvg.js +0 -92
  123. package/dist/chunks/source-identity-Cbo2LOHQ.js +0 -1
  124. package/dist/chunks/validators-B2vUAqTf.js +0 -1
  125. package/dist/chunks/validators-Bce_J7Vd.js +0 -2448
  126. /package/dist/chunks/{card-config-utils-15sRtebL.js → card-config-utils-15sRtebL.cjs} +0 -0
  127. /package/dist/chunks/{catalog-field-grounding-Bnx-3tE0.js → catalog-field-grounding-Bnx-3tE0.cjs} +0 -0
  128. /package/dist/chunks/{dashboard-input-contract-DV3cshjz.js → dashboard-input-contract-DV3cshjz.cjs} +0 -0
  129. /package/dist/chunks/{index-Dpm_VET4.js → index-Dpm_VET4.cjs} +0 -0
  130. /package/dist/chunks/{index-jSrCwPQz.js → index-jSrCwPQz.cjs} +0 -0
  131. /package/dist/chunks/{normalize-dashboard-for-dirty-check-BXRUMVb2.js → normalize-dashboard-for-dirty-check-BXRUMVb2.cjs} +0 -0
  132. /package/dist/chunks/{operators-DrTQsJXv.js → operators-DrTQsJXv.cjs} +0 -0
  133. /package/dist/chunks/{use-debounced-dirty-check-XHSwAefL.js → use-debounced-dirty-check-XHSwAefL.cjs} +0 -0
@@ -0,0 +1,637 @@
1
+ import { b as C } from "./report-runtime-context-Qzn11HQe.js";
2
+ import { canonicalizeSupportedLocale as F, canonicalizeSupportedCurrencyCode as y } from "../value-format-preferences/index.js";
3
+ import { p as M } from "./temporal-bucket-BnPxGrAi.js";
4
+ function I(r) {
5
+ if (!r) return !1;
6
+ const e = r.toLowerCase().replace("_", "-");
7
+ return e === "en-in" || e.startsWith("en-in-");
8
+ }
9
+ function $(r, e) {
10
+ const i = Math.abs(r);
11
+ return i >= 1e12 ? { divisor: 1e12, suffix: "T" } : i >= 1e9 ? { divisor: 1e9, suffix: "B" } : I(e) && i >= 1e7 ? { divisor: 1e7, suffix: "Cr" } : i >= 1e6 ? { divisor: 1e6, suffix: "M" } : I(e) && i >= 1e5 ? { divisor: 1e5, suffix: "L" } : i >= 1e3 ? { divisor: 1e3, suffix: "K" } : { divisor: 1, suffix: "" };
12
+ }
13
+ function h(r, e) {
14
+ try {
15
+ const i = d(e);
16
+ return $(r, i);
17
+ } catch {
18
+ return $(r, "en-US");
19
+ }
20
+ }
21
+ function P(r) {
22
+ try {
23
+ return new Intl.NumberFormat(r), !0;
24
+ } catch {
25
+ return !1;
26
+ }
27
+ }
28
+ function d(r) {
29
+ return r && P(r) ? r : "en-US";
30
+ }
31
+ function v(r, e) {
32
+ if (r == null || isNaN(r))
33
+ return "";
34
+ const i = d(e == null ? void 0 : e.locale);
35
+ let a = r;
36
+ if (e != null && e.multiplyBy && (a *= e.multiplyBy), e != null && e.useSuffix) {
37
+ const { divisor: t, suffix: s } = h(a, i);
38
+ a = a / t;
39
+ const n = new Intl.NumberFormat(i, {
40
+ minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
41
+ maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2,
42
+ useGrouping: (e == null ? void 0 : e.useGrouping) ?? !0
43
+ }).format(a);
44
+ return `${(e == null ? void 0 : e.prefix) ?? ""}${n}${s}${(e == null ? void 0 : e.suffix) ?? ""}`;
45
+ }
46
+ const c = new Intl.NumberFormat(i, {
47
+ minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
48
+ maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2,
49
+ useGrouping: (e == null ? void 0 : e.useGrouping) ?? !0
50
+ }).format(a);
51
+ if (e != null && e.negativeInParentheses && a < 0) {
52
+ const t = c.replace("-", "");
53
+ return `(${(e == null ? void 0 : e.prefix) ?? ""}${t}${(e == null ? void 0 : e.suffix) ?? ""})`;
54
+ }
55
+ return `${(e == null ? void 0 : e.prefix) ?? ""}${c}${(e == null ? void 0 : e.suffix) ?? ""}`;
56
+ }
57
+ function k(r, e) {
58
+ if (r == null || isNaN(r))
59
+ return "";
60
+ const i = d(e == null ? void 0 : e.locale), a = (e == null ? void 0 : e.currency) || "USD", c = r < 0, t = !!(e != null && e.negativeInParentheses && c), s = t ? Math.abs(r) : r;
61
+ try {
62
+ if (e != null && e.useSuffix) {
63
+ const { divisor: u, suffix: l } = h(s, i), m = s / u, D = `${new Intl.NumberFormat(i, {
64
+ style: "currency",
65
+ currency: a,
66
+ minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
67
+ maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2,
68
+ useGrouping: (e == null ? void 0 : e.useGrouping) ?? !0
69
+ }).format(m)}${l}`;
70
+ return t ? `(${D})` : D;
71
+ }
72
+ const n = new Intl.NumberFormat(i, {
73
+ style: "currency",
74
+ currency: a,
75
+ minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
76
+ maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2,
77
+ useGrouping: (e == null ? void 0 : e.useGrouping) ?? !0
78
+ }).format(s);
79
+ return t ? `(${n})` : n;
80
+ } catch {
81
+ const n = Math.abs(r), u = e != null && e.useSuffix ? h(n, i) : { divisor: 1, suffix: "" }, l = v(
82
+ n / u.divisor,
83
+ {
84
+ locale: i,
85
+ minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
86
+ maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2,
87
+ useGrouping: (e == null ? void 0 : e.useGrouping) ?? !0
88
+ }
89
+ ), m = `${a} ${l}${u.suffix}`;
90
+ return c ? e != null && e.negativeInParentheses ? `(${m})` : `-${m}` : m;
91
+ }
92
+ }
93
+ function S(r, e) {
94
+ if (r == null || isNaN(r))
95
+ return "";
96
+ const i = d(e == null ? void 0 : e.locale), c = (e == null ? void 0 : e.alreadyPercent) ?? (e == null ? void 0 : e.percentValueMode) === "whole" ? r / 100 : r;
97
+ return new Intl.NumberFormat(i, {
98
+ style: "percent",
99
+ minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
100
+ maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2,
101
+ useGrouping: (e == null ? void 0 : e.useGrouping) ?? !0
102
+ }).format(c);
103
+ }
104
+ function E(r, e) {
105
+ if (r == null || isNaN(r))
106
+ return "";
107
+ const i = d(e == null ? void 0 : e.locale);
108
+ return new Intl.NumberFormat(i, {
109
+ notation: "scientific",
110
+ minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
111
+ maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2
112
+ }).format(r);
113
+ }
114
+ function G(r, e) {
115
+ if (r == null || Number.isNaN(r))
116
+ return "";
117
+ const i = e.scale === void 0 ? r : r * e.scale, a = e.negativeStyle === "parentheses" && i < 0, c = a ? Math.abs(i) : i, t = {
118
+ style: e.type === "number" ? "decimal" : e.type,
119
+ locale: e.locale,
120
+ currency: e.currency,
121
+ minimumFractionDigits: e.minimumFractionDigits,
122
+ maximumFractionDigits: e.maximumFractionDigits,
123
+ useGrouping: e.useGrouping,
124
+ percentValueMode: e.percentValueMode,
125
+ useSuffix: e.compact
126
+ };
127
+ let s;
128
+ switch (e.type) {
129
+ case "currency":
130
+ s = k(c, t);
131
+ break;
132
+ case "percent":
133
+ s = S(c, t);
134
+ break;
135
+ case "scientific":
136
+ s = E(c, t);
137
+ break;
138
+ default:
139
+ s = v(c, t);
140
+ break;
141
+ }
142
+ const n = `${e.prefix ?? ""}${s}${e.suffix ?? ""}`;
143
+ return a ? `(${n})` : n;
144
+ }
145
+ function J(r, e, i = "en-US") {
146
+ if (r == null || isNaN(r))
147
+ return "";
148
+ const a = d((e == null ? void 0 : e.locale) || i), c = (e == null ? void 0 : e.style) || "decimal", t = c === "decimal" ? "number" : c;
149
+ return t === "currency" && new Intl.NumberFormat(a, {
150
+ style: "currency",
151
+ currency: (e == null ? void 0 : e.currency) || "USD"
152
+ }), G(r, {
153
+ type: t,
154
+ locale: a,
155
+ currency: t === "currency" ? (e == null ? void 0 : e.currency) || "USD" : void 0,
156
+ minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
157
+ maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2,
158
+ useGrouping: (e == null ? void 0 : e.useGrouping) ?? !0,
159
+ percentValueMode: t === "percent" ? (e == null ? void 0 : e.percentValueMode) ?? "whole" : void 0,
160
+ scale: e == null ? void 0 : e.scale,
161
+ compact: e == null ? void 0 : e.compact,
162
+ negativeStyle: e == null ? void 0 : e.negativeStyle,
163
+ prefix: e == null ? void 0 : e.prefix,
164
+ suffix: e == null ? void 0 : e.suffix
165
+ });
166
+ }
167
+ function Y(r, e, i) {
168
+ const a = {
169
+ style: e === "currency" ? "currency" : e === "percent" ? "percent" : "decimal",
170
+ locale: i == null ? void 0 : i.locale,
171
+ currency: i == null ? void 0 : i.currency,
172
+ minimumFractionDigits: i == null ? void 0 : i.decimalPlaces,
173
+ maximumFractionDigits: i == null ? void 0 : i.decimalPlaces,
174
+ useSuffix: i == null ? void 0 : i.useSuffix,
175
+ prefix: i == null ? void 0 : i.prefix,
176
+ suffix: i == null ? void 0 : i.suffix,
177
+ negativeInParentheses: i == null ? void 0 : i.negativeInParentheses,
178
+ multiplyBy: i == null ? void 0 : i.multiplyBy
179
+ };
180
+ switch (e) {
181
+ case "currency":
182
+ return k(r, a);
183
+ case "percent":
184
+ return S(r, a);
185
+ case "scientific":
186
+ return E(r, a);
187
+ default:
188
+ return v(r, a);
189
+ }
190
+ }
191
+ const V = [
192
+ "type",
193
+ "locale",
194
+ "minimumFractionDigits",
195
+ "maximumFractionDigits",
196
+ "useGrouping",
197
+ "prefix",
198
+ "suffix",
199
+ "negativeStyle",
200
+ "compact",
201
+ "scale",
202
+ "currency",
203
+ "percentValueMode"
204
+ ];
205
+ function j(r) {
206
+ if (r === null || typeof r != "object" || Array.isArray(r))
207
+ return !1;
208
+ const e = Object.getPrototypeOf(r);
209
+ return e === null || e === Object.prototype;
210
+ }
211
+ function K(r) {
212
+ if (!j(r))
213
+ return {
214
+ ok: !1,
215
+ issues: [{ path: "$", message: "Numeric format must be an object." }]
216
+ };
217
+ const e = [], i = new Set(V);
218
+ Object.keys(r).filter((t) => !i.has(t)).forEach(
219
+ (t) => e.push({ path: t, message: `Unknown property "${t}".` })
220
+ ), r.type !== "number" && r.type !== "currency" && r.type !== "percent" && r.type !== "scientific" && e.push({
221
+ path: "type",
222
+ message: "Expected number, currency, percent, or scientific."
223
+ });
224
+ const a = r.locale === void 0 ? void 0 : F(r.locale);
225
+ r.locale !== void 0 && !a && e.push({ path: "locale", message: "Expected a supported BCP 47 locale." });
226
+ const c = r.currency === void 0 ? void 0 : y(r.currency);
227
+ r.currency !== void 0 && !c && e.push({
228
+ path: "currency",
229
+ message: "Expected a supported ISO 4217 currency code."
230
+ });
231
+ for (const t of ["minimumFractionDigits", "maximumFractionDigits"]) {
232
+ const s = r[t];
233
+ s !== void 0 && (!Number.isInteger(s) || typeof s != "number" || s < 0 || s > 20) && e.push({
234
+ path: t,
235
+ message: "Expected an integer from 0 to 20."
236
+ });
237
+ }
238
+ typeof r.minimumFractionDigits == "number" && typeof r.maximumFractionDigits == "number" && r.minimumFractionDigits > r.maximumFractionDigits && e.push({
239
+ path: "maximumFractionDigits",
240
+ message: "Must be greater than or equal to minimumFractionDigits."
241
+ });
242
+ for (const t of ["useGrouping", "compact"])
243
+ r[t] !== void 0 && typeof r[t] != "boolean" && e.push({ path: t, message: "Expected a boolean." });
244
+ for (const t of ["prefix", "suffix"])
245
+ r[t] !== void 0 && typeof r[t] != "string" && e.push({ path: t, message: "Expected a string." });
246
+ return r.negativeStyle !== void 0 && r.negativeStyle !== "minus" && r.negativeStyle !== "parentheses" && e.push({
247
+ path: "negativeStyle",
248
+ message: "Expected minus or parentheses."
249
+ }), r.percentValueMode !== void 0 && r.percentValueMode !== "fraction" && r.percentValueMode !== "whole" && e.push({
250
+ path: "percentValueMode",
251
+ message: "Expected fraction or whole."
252
+ }), r.scale !== void 0 && (typeof r.scale != "number" || !Number.isFinite(r.scale)) && e.push({ path: "scale", message: "Expected a finite number." }), e.length > 0 ? { ok: !1, issues: e } : {
253
+ ok: !0,
254
+ value: {
255
+ type: r.type,
256
+ ...a ? { locale: a } : {},
257
+ ...r.minimumFractionDigits !== void 0 ? { minimumFractionDigits: r.minimumFractionDigits } : {},
258
+ ...r.maximumFractionDigits !== void 0 ? { maximumFractionDigits: r.maximumFractionDigits } : {},
259
+ ...r.useGrouping !== void 0 ? { useGrouping: r.useGrouping } : {},
260
+ ...r.prefix !== void 0 ? { prefix: r.prefix } : {},
261
+ ...r.suffix !== void 0 ? { suffix: r.suffix } : {},
262
+ ...r.negativeStyle !== void 0 ? {
263
+ negativeStyle: r.negativeStyle
264
+ } : {},
265
+ ...r.compact !== void 0 ? { compact: r.compact } : {},
266
+ ...r.scale !== void 0 ? { scale: r.scale } : {},
267
+ ...c ? { currency: c } : {},
268
+ ...r.percentValueMode !== void 0 ? {
269
+ percentValueMode: r.percentValueMode
270
+ } : {}
271
+ }
272
+ };
273
+ }
274
+ function R(r) {
275
+ const e = K(r);
276
+ if (!e.ok)
277
+ return e;
278
+ const i = [];
279
+ return e.value.locale || i.push({
280
+ path: "locale",
281
+ message: "Resolved numeric formats require an explicit locale."
282
+ }), e.value.minimumFractionDigits === void 0 && i.push({
283
+ path: "minimumFractionDigits",
284
+ message: "Resolved numeric formats require minimumFractionDigits."
285
+ }), e.value.maximumFractionDigits === void 0 && i.push({
286
+ path: "maximumFractionDigits",
287
+ message: "Resolved numeric formats require maximumFractionDigits."
288
+ }), e.value.type === "currency" && !e.value.currency && i.push({
289
+ path: "currency",
290
+ message: "Resolved currency formats require an explicit currency."
291
+ }), i.length > 0 ? { ok: !1, issues: i } : e;
292
+ }
293
+ function H(r) {
294
+ var a;
295
+ const e = /* @__PURE__ */ new Set();
296
+ if (r.snapshot.resolvedFormats.forEach((c, t) => {
297
+ if (c.format.type !== "temporal_bucket") {
298
+ if (c.scope.attachmentIndex !== void 0)
299
+ throw new Error(
300
+ `resolvedFormats.${t}.scope.attachmentIndex is not valid for a card export`
301
+ );
302
+ if (c.scope.dashboardId !== r.expectedScope.dashboardId || c.scope.cardId !== r.expectedScope.cardId)
303
+ throw new Error(
304
+ `resolvedFormats.${t}.scope must match the executing dashboard/card`
305
+ );
306
+ if (c.target.kind !== "column")
307
+ throw new Error(
308
+ `resolvedFormats.${t}.target must identify an export column`
309
+ );
310
+ if (e.has(c.target.columnKey))
311
+ throw new Error(
312
+ `resolvedFormats.${t} duplicates export column "${c.target.columnKey}"`
313
+ );
314
+ e.add(c.target.columnKey);
315
+ }
316
+ }), !r.useFormattedValues)
317
+ return;
318
+ if (!((a = r.visibleColumns) != null && a.length))
319
+ throw new Error(
320
+ "visibleColumns must identify every formatted export column"
321
+ );
322
+ const i = r.visibleColumns.find(
323
+ (c) => !e.has(c)
324
+ );
325
+ if (i)
326
+ throw new Error(
327
+ `resolvedFormats is missing visible export column "${i}"`
328
+ );
329
+ }
330
+ function O(r, e) {
331
+ const i = new Intl.NumberFormat(r, {
332
+ style: "currency",
333
+ currency: e
334
+ }).resolvedOptions();
335
+ return {
336
+ minimumFractionDigits: i.minimumFractionDigits,
337
+ maximumFractionDigits: i.maximumFractionDigits
338
+ };
339
+ }
340
+ function _(r) {
341
+ if (r.minimumFractionDigits !== void 0 || r.maximumFractionDigits !== void 0) {
342
+ const i = r.minimumFractionDigits ?? 0;
343
+ return {
344
+ minimumFractionDigits: i,
345
+ maximumFractionDigits: r.maximumFractionDigits ?? Math.max(i, 2)
346
+ };
347
+ }
348
+ const e = r.type === "percent" ? 1 : r.type === "scientific" ? 2 : 0;
349
+ return {
350
+ minimumFractionDigits: e,
351
+ maximumFractionDigits: e
352
+ };
353
+ }
354
+ function Q(r, e, i) {
355
+ const a = F(r.locale) ?? e.locale, c = r.type === "number" || r.type === "currency" ? y(i) : void 0;
356
+ if (!(r.type === "currency" || c !== void 0))
357
+ return {
358
+ ...r,
359
+ locale: a,
360
+ ..._(r)
361
+ };
362
+ const s = c ?? y(r.currency) ?? e.defaultCurrency, n = O(
363
+ a,
364
+ s
365
+ ), u = n.minimumFractionDigits ?? 0, l = n.maximumFractionDigits ?? u, m = r.minimumFractionDigits ?? Math.min(
366
+ u,
367
+ r.maximumFractionDigits ?? u
368
+ ), w = r.maximumFractionDigits ?? Math.max(
369
+ m,
370
+ l
371
+ );
372
+ return {
373
+ ...r,
374
+ type: "currency",
375
+ locale: a,
376
+ currency: s,
377
+ minimumFractionDigits: m,
378
+ maximumFractionDigits: w
379
+ };
380
+ }
381
+ function f(r) {
382
+ if (r === null || typeof r != "object" || Array.isArray(r))
383
+ return !1;
384
+ const e = Object.getPrototypeOf(r);
385
+ return e === null || e === Object.prototype;
386
+ }
387
+ function g(r, e, i) {
388
+ const a = new Set(e), c = Object.keys(r).find((t) => !a.has(t));
389
+ if (c)
390
+ throw new Error(`${i} contains unknown property "${c}"`);
391
+ }
392
+ function T(r, e = "scope") {
393
+ if (!f(r))
394
+ throw new Error(`${e} must be an object`);
395
+ g(
396
+ r,
397
+ ["dashboardId", "cardId", "attachmentIndex"],
398
+ e
399
+ );
400
+ const i = typeof r.dashboardId == "string" ? r.dashboardId.trim() : "";
401
+ if (!i)
402
+ throw new Error(`${e}.dashboardId is required`);
403
+ const a = typeof r.cardId == "string" ? r.cardId.trim() : void 0;
404
+ if (r.cardId !== void 0 && !a)
405
+ throw new Error(`${e}.cardId must be a non-empty string`);
406
+ const c = r.attachmentIndex;
407
+ if (c !== void 0 && (typeof c != "number" || !Number.isInteger(c) || c < 0))
408
+ throw new Error(
409
+ `${e}.attachmentIndex must be a non-negative integer`
410
+ );
411
+ return {
412
+ dashboardId: i,
413
+ ...a ? { cardId: a } : {},
414
+ ...typeof c == "number" ? { attachmentIndex: c } : {}
415
+ };
416
+ }
417
+ function o(r, e, i, a) {
418
+ if (r.kind !== e) return;
419
+ g(r, ["kind", i], a);
420
+ const c = typeof r[i] == "string" ? r[i].trim() : "";
421
+ if (!c)
422
+ throw new Error(`${a}.${i} is required`);
423
+ return c;
424
+ }
425
+ function B(r, e) {
426
+ if (!f(r))
427
+ throw new Error(`${e} must be an object`);
428
+ const i = o(r, "metric", "metricId", e);
429
+ if (i) return { kind: "metric", metricId: i };
430
+ const a = o(r, "column", "columnKey", e);
431
+ if (a) return { kind: "column", columnKey: a };
432
+ const c = o(
433
+ r,
434
+ "matrix_measure",
435
+ "measureId",
436
+ e
437
+ );
438
+ if (c) return { kind: "matrix_measure", measureId: c };
439
+ throw new Error(`${e} is not a valid numeric presentation target`);
440
+ }
441
+ function U(r, e) {
442
+ if (!f(r))
443
+ throw new Error(`${e} must be an object`);
444
+ if (r.kind === "field") {
445
+ g(r, ["kind", "fieldId", "role"], e);
446
+ const c = typeof r.fieldId == "string" ? r.fieldId.trim() : "";
447
+ if (!c)
448
+ throw new Error(`${e}.fieldId is required`);
449
+ const t = r.role;
450
+ if (t !== void 0 && t !== "groupby" && t !== "pivotby")
451
+ throw new Error(`${e}.role must be groupby or pivotby`);
452
+ return {
453
+ kind: "field",
454
+ fieldId: c,
455
+ ...t ? { role: t } : {}
456
+ };
457
+ }
458
+ const i = o(r, "column", "columnKey", e);
459
+ if (i) return { kind: "column", columnKey: i };
460
+ const a = o(
461
+ r,
462
+ "matrix_axis",
463
+ "axisInstanceId",
464
+ e
465
+ );
466
+ if (a) return { kind: "matrix_axis", axisInstanceId: a };
467
+ throw new Error(`${e} is not a valid temporal bucket presentation target`);
468
+ }
469
+ function q(r) {
470
+ return [
471
+ r.dashboardId,
472
+ r.cardId ?? null,
473
+ r.attachmentIndex ?? null
474
+ ];
475
+ }
476
+ function x(r) {
477
+ switch (r.kind) {
478
+ case "metric":
479
+ return [r.kind, r.metricId];
480
+ case "column":
481
+ return [r.kind, r.columnKey];
482
+ case "matrix_measure":
483
+ return [r.kind, r.measureId];
484
+ case "field":
485
+ return [r.kind, r.fieldId, r.role ?? ""];
486
+ case "matrix_axis":
487
+ return [r.kind, r.axisInstanceId];
488
+ }
489
+ }
490
+ function N(r, e) {
491
+ return r.dashboardId === e.dashboardId && r.cardId === e.cardId && r.attachmentIndex === e.attachmentIndex;
492
+ }
493
+ function b(r, e) {
494
+ const i = x(r), a = x(e);
495
+ return i.length === a.length && i.every((c, t) => c === a[t]);
496
+ }
497
+ function A(r) {
498
+ if (!Array.isArray(r))
499
+ throw new Error("resolvedFormats must be an array");
500
+ const e = /* @__PURE__ */ new Set();
501
+ return r.map((i, a) => {
502
+ var u, l;
503
+ const c = `resolvedFormats.${a}`;
504
+ if (!f(i))
505
+ throw new Error(`${c} must be an object`);
506
+ g(i, ["scope", "target", "format"], c);
507
+ const t = T(i.scope, `${c}.scope`);
508
+ if (!f(i.format))
509
+ throw new Error(`${c}.format must be an object`);
510
+ let s;
511
+ if (i.format.type === "temporal_bucket") {
512
+ const m = M(i.format);
513
+ if (!m.ok)
514
+ throw new Error(
515
+ `${c}.format is invalid: ${((u = m.issues[0]) == null ? void 0 : u.message) ?? "invalid value"}`
516
+ );
517
+ s = {
518
+ scope: t,
519
+ target: U(i.target, `${c}.target`),
520
+ format: m.value
521
+ };
522
+ } else {
523
+ const m = R(i.format);
524
+ if (!m.ok)
525
+ throw new Error(
526
+ `${c}.format is invalid: ${((l = m.issues[0]) == null ? void 0 : l.message) ?? "invalid value"}`
527
+ );
528
+ s = {
529
+ scope: t,
530
+ target: B(i.target, `${c}.target`),
531
+ format: m.value
532
+ };
533
+ }
534
+ const n = JSON.stringify([
535
+ ...q(s.scope),
536
+ ...x(s.target)
537
+ ]);
538
+ if (e.has(n))
539
+ throw new Error(
540
+ `${c} duplicates a scoped presentation target`
541
+ );
542
+ return e.add(n), s;
543
+ });
544
+ }
545
+ function X(r) {
546
+ if (!f(r))
547
+ throw new Error("presentation execution snapshot must be an object");
548
+ g(
549
+ r,
550
+ ["reportContext", "resolvedFormats"],
551
+ "presentation execution snapshot"
552
+ );
553
+ const e = C(r.reportContext);
554
+ if (!e.ok) {
555
+ const i = e.issues[0];
556
+ throw new Error(
557
+ `presentation execution snapshot reportContext is invalid: ${i != null && i.path && i.path !== "$" ? `${i.path}: ` : ""}${(i == null ? void 0 : i.message) ?? "invalid value"}`
558
+ );
559
+ }
560
+ return {
561
+ reportContext: e.value,
562
+ resolvedFormats: A(r.resolvedFormats)
563
+ };
564
+ }
565
+ function Z(r) {
566
+ const e = r.snapshot.resolvedFormats.find(
567
+ (i) => i.format.type !== "temporal_bucket" && N(i.scope, r.scope) && b(i.target, r.target)
568
+ );
569
+ return e == null ? void 0 : e.format;
570
+ }
571
+ function p(r) {
572
+ const e = r.snapshot.resolvedFormats.find(
573
+ (i) => i.format.type === "temporal_bucket" && N(i.scope, r.scope) && b(i.target, r.target)
574
+ );
575
+ return e == null ? void 0 : e.format;
576
+ }
577
+ function ee(r) {
578
+ var c;
579
+ const e = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
580
+ if (r.snapshot.resolvedFormats.forEach((t, s) => {
581
+ if (t.scope.attachmentIndex !== void 0)
582
+ throw new Error(
583
+ `resolvedFormats.${s}.scope.attachmentIndex is not valid for a card export`
584
+ );
585
+ if (t.scope.dashboardId !== r.expectedScope.dashboardId || t.scope.cardId !== r.expectedScope.cardId)
586
+ throw new Error(
587
+ `resolvedFormats.${s}.scope must match the executing dashboard/card`
588
+ );
589
+ if (t.target.kind === "field" && t.format.type === "temporal_bucket") {
590
+ const n = JSON.stringify(x(t.target));
591
+ if (i.has(n))
592
+ throw new Error(
593
+ `resolvedFormats.${s} duplicates export field "${t.target.fieldId}"`
594
+ );
595
+ i.add(n);
596
+ return;
597
+ }
598
+ if (t.target.kind !== "column")
599
+ throw new Error(
600
+ `resolvedFormats.${s}.target must identify an export column or temporal pivot field`
601
+ );
602
+ if (e.has(t.target.columnKey))
603
+ throw new Error(
604
+ `resolvedFormats.${s} duplicates export column "${t.target.columnKey}"`
605
+ );
606
+ e.add(t.target.columnKey);
607
+ }), !r.useFormattedValues) return;
608
+ if (!((c = r.visibleColumns) != null && c.length))
609
+ throw new Error("visibleColumns must identify every formatted export column");
610
+ const a = r.visibleColumns.find(
611
+ (t) => !e.has(t)
612
+ );
613
+ if (a)
614
+ throw new Error(
615
+ `resolvedFormats is missing visible export column "${a}"`
616
+ );
617
+ }
618
+ export {
619
+ Z as a,
620
+ G as b,
621
+ p as c,
622
+ k as d,
623
+ v as e,
624
+ J as f,
625
+ Y as g,
626
+ S as h,
627
+ E as i,
628
+ X as j,
629
+ T as k,
630
+ R as l,
631
+ A as m,
632
+ Q as n,
633
+ ee as o,
634
+ K as p,
635
+ O as r,
636
+ H as v
637
+ };
@@ -1,10 +1,11 @@
1
1
  import { jsxs as l, Fragment as R, jsx as a } from "react/jsx-runtime";
2
2
  import le, { useState as C, useRef as Y, useEffect as U, useCallback as A, useMemo as _ } from "react";
3
- import { az as Q, aA as ce, aB as B, aC as $, aD as oe, h as ie, i as ue, j as de, k as fe, l as M, m as W, aE as me, aF as V, aG as z, a as he, aH as pe, aI as ve, aJ as ye, aK as ge, aL as be } from "./dashboard-Bd1Quco-.js";
4
- import { u as X, c as F, O as q, P as we, a as Ce, B as L, b as Se, d as G, L as ee, T as ke, F as Te, G as H, I as K } from "./code-editor-BpADiIlq.js";
5
- import { parseCalendarPreferencesResponse as xe } from "../report-runtime-context/index.js";
3
+ import { az as Q, aA as ce, aB as B, aC as $, aD as oe, h as ie, i as ue, j as de, k as fe, l as M, m as W, aE as me, aF as V, aG as z, a as he, aH as pe, aI as ve, aJ as ye, aK as ge, aL as be } from "./dashboard-u61yfU6u.js";
4
+ import { u as X, c as F, O as q, P as we, a as Ce, B as L, b as Se, d as G, L as ee, T as ke, F as Te, G as H, I as K } from "./code-editor-B4gTfvc5.js";
5
+ import { a as xe } from "./report-runtime-context-Qzn11HQe.js";
6
6
  import "./index-xHCrHprY.js";
7
- import "./analyze-result-contract-CfOBEwaC.js";
7
+ import "./validators-wZ2WlNHc.js";
8
+ import "./analyze-result-contract-DUv3QnMl.js";
8
9
  import { parseValueFormatPreferencesResponse as Ne, canonicalizeSupportedLocale as Pe, canonicalizeSupportedCurrencyCode as Ee } from "../value-format-preferences/index.js";
9
10
  function Ae(r = {}) {
10
11
  const { authToken: c, tokenProps: e } = Q(), m = X(
@@ -653,7 +654,7 @@ function Ue({
653
654
  ] })
654
655
  ] });
655
656
  }
656
- function qe({
657
+ function Ge({
657
658
  open: r,
658
659
  onOpenChange: c
659
660
  }) {
@@ -686,5 +687,5 @@ function qe({
686
687
  ] }) });
687
688
  }
688
689
  export {
689
- qe as R
690
+ Ge as R
690
691
  };