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,446 @@
1
+ var D = Object.defineProperty;
2
+ var E = (e, t, r) => t in e ? D(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var _ = (e, t, r) => E(e, typeof t != "symbol" ? t + "" : t, r);
4
+ import { canonicalizeSupportedLocale as w } from "../value-format-preferences/index.js";
5
+ const q = [
6
+ "YYYY",
7
+ "MMMM",
8
+ "MMM",
9
+ "YY",
10
+ "MM",
11
+ "DD",
12
+ "HH",
13
+ "mm",
14
+ "ss"
15
+ ], P = /* @__PURE__ */ new Set([" ", "-", "/", ":", ".", ",", "T"]), v = {
16
+ week_of_short: "week",
17
+ week_of_long: "week",
18
+ quarter_short: "quarter",
19
+ quarter_long: "quarter",
20
+ fiscal_quarter_short: "quarter",
21
+ fiscal_year: "year"
22
+ };
23
+ function O(e) {
24
+ return typeof e == "string" && Object.prototype.hasOwnProperty.call(v, e);
25
+ }
26
+ function N(e, t) {
27
+ return q.find(
28
+ (r) => e.startsWith(r, t)
29
+ );
30
+ }
31
+ function k(e) {
32
+ var a;
33
+ if (!e || e.trim() !== e)
34
+ return {
35
+ ok: !1,
36
+ code: "invalid_temporal_bucket_pattern",
37
+ message: "Temporal bucket patterns must be non-empty and trimmed."
38
+ };
39
+ const t = [];
40
+ let r = 0, n = !1;
41
+ for (; r < e.length; ) {
42
+ const o = N(e, r);
43
+ if (o) {
44
+ if (n)
45
+ return {
46
+ ok: !1,
47
+ code: "invalid_temporal_bucket_pattern",
48
+ message: "Adjacent temporal bucket tokens require a separator."
49
+ };
50
+ t.push({ kind: "token", value: o }), r += o.length, n = !0;
51
+ continue;
52
+ }
53
+ const u = e[r];
54
+ if (!P.has(u))
55
+ return {
56
+ ok: !1,
57
+ code: "invalid_temporal_bucket_pattern",
58
+ message: `Unsupported temporal bucket pattern character "${u}".`
59
+ };
60
+ if (t.length === 0)
61
+ return {
62
+ ok: !1,
63
+ code: "invalid_temporal_bucket_pattern",
64
+ message: "Temporal bucket patterns cannot begin with a separator."
65
+ };
66
+ const s = t[t.length - 1];
67
+ s.kind === "literal" ? s.value += u : t.push({ kind: "literal", value: u }), r += 1, n = !1;
68
+ }
69
+ return ((a = t[t.length - 1]) == null ? void 0 : a.kind) !== "token" ? {
70
+ ok: !1,
71
+ code: "invalid_temporal_bucket_pattern",
72
+ message: "Temporal bucket patterns cannot end with a separator."
73
+ } : { ok: !0, segments: t };
74
+ }
75
+ function F(e) {
76
+ return e.flatMap(
77
+ (t) => t.kind === "token" ? [t.value] : []
78
+ );
79
+ }
80
+ function b(e, t) {
81
+ return e.filter((r) => t.includes(r)).length === 1;
82
+ }
83
+ function l(e, t) {
84
+ return e.some((r) => t.includes(r));
85
+ }
86
+ function H(e) {
87
+ return new Set(e).size !== e.length;
88
+ }
89
+ function B(e, t) {
90
+ if (H(e)) return !1;
91
+ const r = ["YYYY", "YY"], n = ["MMMM", "MMM", "MM"], a = ["HH", "mm", "ss"], o = b(e, r), u = b(e, n), s = e.includes("DD"), d = l(e, a);
92
+ switch (t) {
93
+ case "second":
94
+ return e.includes("HH") && e.includes("mm") && e.includes("ss") && (!l(e, [...r, ...n, "DD"]) || o && u && s);
95
+ case "minute":
96
+ return e.includes("HH") && e.includes("mm") && (!l(e, [...r, ...n, "DD"]) || o && u && s);
97
+ case "hour":
98
+ return e.includes("HH") && (!l(e, [...r, ...n, "DD"]) || o && u && s);
99
+ case "day":
100
+ case "week":
101
+ return o && u && s && !d;
102
+ case "month":
103
+ return o && u && !s && !d;
104
+ case "quarter":
105
+ return !1;
106
+ case "year":
107
+ return o && !u && !s && !d;
108
+ }
109
+ }
110
+ function Y(e, t) {
111
+ if (e.presentation.mode === "auto")
112
+ return { ok: !0 };
113
+ if (e.presentation.mode === "preset") {
114
+ const n = v[e.presentation.preset];
115
+ return n === t ? { ok: !0 } : {
116
+ ok: !1,
117
+ code: "incompatible_temporal_bucket_preset",
118
+ message: `Preset ${e.presentation.preset} requires ${n} granularity.`
119
+ };
120
+ }
121
+ const r = k(e.presentation.pattern);
122
+ return r.ok ? B(
123
+ F(r.segments),
124
+ t
125
+ ) ? { ok: !0, segments: r.segments } : {
126
+ ok: !1,
127
+ code: "incompatible_temporal_bucket_pattern",
128
+ message: `Pattern ${e.presentation.pattern} is not compatible with ${t} granularity.`
129
+ } : r;
130
+ }
131
+ function ee(e, t) {
132
+ if (!(!e || !t))
133
+ return Y(e, t).ok ? e : void 0;
134
+ }
135
+ class m extends Error {
136
+ constructor(r, n) {
137
+ super(n);
138
+ _(this, "code");
139
+ this.name = "TemporalBucketContractError", this.code = r;
140
+ }
141
+ }
142
+ const x = {
143
+ type: "temporal_bucket",
144
+ presentation: { mode: "auto" }
145
+ }, A = [
146
+ "Jan",
147
+ "Feb",
148
+ "Mar",
149
+ "Apr",
150
+ "May",
151
+ "Jun",
152
+ "Jul",
153
+ "Aug",
154
+ "Sep",
155
+ "Oct",
156
+ "Nov",
157
+ "Dec"
158
+ ], C = [
159
+ "January",
160
+ "February",
161
+ "March",
162
+ "April",
163
+ "May",
164
+ "June",
165
+ "July",
166
+ "August",
167
+ "September",
168
+ "October",
169
+ "November",
170
+ "December"
171
+ ];
172
+ function p(e) {
173
+ return {
174
+ ok: !1,
175
+ error: { code: "invalid_temporal_bucket_value", message: e }
176
+ };
177
+ }
178
+ function R(e) {
179
+ return e % 4 === 0 && (e % 100 !== 0 || e % 400 === 0);
180
+ }
181
+ function j(e, t) {
182
+ return t === 2 ? R(e) ? 29 : 28 : [4, 6, 9, 11].includes(t) ? 30 : 31;
183
+ }
184
+ function U(e, t, r) {
185
+ const n = [0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4], a = t < 3 ? e - 1 : e;
186
+ return (a + Math.floor(a / 4) - Math.floor(a / 100) + Math.floor(a / 400) + n[t - 1] + r) % 7;
187
+ }
188
+ function y(e) {
189
+ var t;
190
+ return (t = e.calendar.fiscalCalendar) == null ? void 0 : t.yearStartMonth;
191
+ }
192
+ function z(e, t) {
193
+ return (e - t + 12) % 12 % 3 === 0;
194
+ }
195
+ function J(e, t) {
196
+ const { granularity: r } = t, n = y(t) ?? 1;
197
+ switch (r) {
198
+ case "second":
199
+ return !0;
200
+ case "minute":
201
+ return e.second === 0;
202
+ case "hour":
203
+ return e.minute === 0 && e.second === 0;
204
+ case "day":
205
+ return !0;
206
+ case "week":
207
+ return U(e.year, e.month, e.day) === t.calendar.weekStart;
208
+ case "month":
209
+ return e.day === 1;
210
+ case "quarter":
211
+ return e.day === 1 && z(e.month, n);
212
+ case "year":
213
+ return e.day === 1 && e.month === n;
214
+ }
215
+ }
216
+ function L(e, t) {
217
+ if (e === null) return { ok: !0, value: null };
218
+ const r = t.granularity === "second" || t.granularity === "minute" || t.granularity === "hour", n = r ? /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})$/.exec(e) : /^(\d{4})-(\d{2})-(\d{2})$/.exec(e);
219
+ if (!n)
220
+ return p(
221
+ `Expected ${r ? "YYYY-MM-DDTHH:mm:ss" : "YYYY-MM-DD"} for ${t.granularity} granularity.`
222
+ );
223
+ const a = {
224
+ year: Number(n[1]),
225
+ month: Number(n[2]),
226
+ day: Number(n[3]),
227
+ hour: r ? Number(n[4]) : 0,
228
+ minute: r ? Number(n[5]) : 0,
229
+ second: r ? Number(n[6]) : 0
230
+ };
231
+ return a.year < 1 || a.month < 1 || a.month > 12 || a.day < 1 || a.day > j(a.year, a.month) || a.hour > 23 || a.minute > 59 || a.second > 59 ? p(`Invalid canonical ${t.granularity} bucket value ${e}.`) : J(a, t) ? { ok: !0, value: a } : p(
232
+ `Canonical value ${e} is not aligned to ${t.granularity} granularity and its governed Calendar.`
233
+ );
234
+ }
235
+ function g(e) {
236
+ if (e === null || typeof e != "object" || Array.isArray(e))
237
+ return !1;
238
+ const t = Object.getPrototypeOf(e);
239
+ return t === null || t === Object.prototype;
240
+ }
241
+ function I(e) {
242
+ if (!g(e))
243
+ return {
244
+ ok: !1,
245
+ issues: [{ path: "$", message: "Resolved temporal bucket format must be an object." }]
246
+ };
247
+ const t = [], r = /* @__PURE__ */ new Set(["type", "presentation", "locale"]);
248
+ for (const o of Object.keys(e))
249
+ r.has(o) || t.push({ path: o, message: `Unknown property "${o}".` });
250
+ e.type !== "temporal_bucket" && t.push({ path: "type", message: "Expected temporal_bucket." });
251
+ const n = e.presentation;
252
+ if (!g(n))
253
+ t.push({ path: "presentation", message: "Expected a presentation object." });
254
+ else {
255
+ const o = n.mode, u = o === "preset" ? /* @__PURE__ */ new Set(["mode", "preset"]) : o === "pattern" ? /* @__PURE__ */ new Set(["mode", "pattern"]) : /* @__PURE__ */ new Set(["mode"]);
256
+ for (const s of Object.keys(n))
257
+ u.has(s) || t.push({
258
+ path: `presentation.${s}`,
259
+ message: `Unknown property "${s}".`
260
+ });
261
+ if (o === "preset")
262
+ O(n.preset) || t.push({ path: "presentation.preset", message: "Expected a supported preset." });
263
+ else if (o === "pattern")
264
+ if (typeof n.pattern != "string" || !n.pattern)
265
+ t.push({ path: "presentation.pattern", message: "Expected a non-empty pattern." });
266
+ else {
267
+ const s = k(n.pattern);
268
+ s.ok || t.push({
269
+ path: "presentation.pattern",
270
+ message: s.message
271
+ });
272
+ }
273
+ else o !== "auto" && t.push({ path: "presentation.mode", message: "Expected auto, preset, or pattern." });
274
+ }
275
+ const a = w(e.locale);
276
+ return a || t.push({ path: "locale", message: "Expected a supported base BCP 47 locale." }), t.length > 0 || !a ? { ok: !1, issues: t } : {
277
+ ok: !0,
278
+ value: {
279
+ type: "temporal_bucket",
280
+ presentation: n,
281
+ locale: a
282
+ }
283
+ };
284
+ }
285
+ function G(e, t) {
286
+ const r = !!t.calendar.fiscalCalendar;
287
+ return e === "fiscal_quarter_short" || e === "fiscal_year" ? r : e === "quarter_short" || e === "quarter_long" ? !r : !0;
288
+ }
289
+ function S(e, t) {
290
+ return Y(e, t.granularity).ok ? e.presentation.mode === "preset" ? G(e.presentation.preset, t) : !(e.presentation.mode === "pattern" && t.calendar.fiscalCalendar && (t.granularity === "quarter" || t.granularity === "year")) : !1;
291
+ }
292
+ function M(e, t) {
293
+ if (!(!e || e.presentation.mode === "auto"))
294
+ return S(e, t) ? e : void 0;
295
+ }
296
+ function te(e) {
297
+ var a;
298
+ const t = w(e.locale);
299
+ if (!t)
300
+ throw new m(
301
+ "invalid_temporal_bucket_format",
302
+ "Temporal bucket locale must be a supported base BCP 47 locale."
303
+ );
304
+ const r = M(e.cardFormat, e.metadata);
305
+ if (r)
306
+ return { format: { ...r, locale: t }, source: "card" };
307
+ const n = ((a = e.semanticFormat) == null ? void 0 : a.granularity) === e.metadata.granularity ? M(e.semanticFormat.format, e.metadata) : void 0;
308
+ return n ? { format: { ...n, locale: t }, source: "semantic" } : { format: { ...x, locale: t }, source: "automatic" };
309
+ }
310
+ function c(e, t = 2) {
311
+ return String(e).padStart(t, "0");
312
+ }
313
+ function i(e, t, r) {
314
+ if (t === "en-US")
315
+ return (r === "short" ? A : C)[e - 1];
316
+ const n = new Date(Date.UTC(2e3, e - 1, 15));
317
+ return new Intl.DateTimeFormat(t, { month: r, timeZone: "UTC" }).format(
318
+ n
319
+ );
320
+ }
321
+ function K(e, t, r) {
322
+ return t.map((n) => {
323
+ if (n.kind === "literal") return n.value;
324
+ switch (n.value) {
325
+ case "YYYY":
326
+ return c(e.year, 4);
327
+ case "YY":
328
+ return c(e.year % 100);
329
+ case "MMMM":
330
+ return i(e.month, r, "long");
331
+ case "MMM":
332
+ return i(e.month, r, "short");
333
+ case "MM":
334
+ return c(e.month);
335
+ case "DD":
336
+ return c(e.day);
337
+ case "HH":
338
+ return c(e.hour);
339
+ case "mm":
340
+ return c(e.minute);
341
+ case "ss":
342
+ return c(e.second);
343
+ }
344
+ }).join("");
345
+ }
346
+ function T(e, t) {
347
+ return `${e.hour % 12 || 12}:${c(e.minute)}${t ? `:${c(e.second)}` : ""} ${e.hour < 12 ? "AM" : "PM"}`;
348
+ }
349
+ function h(e) {
350
+ return `${A[e.month - 1]} ${e.day}, ${e.year}`;
351
+ }
352
+ function Q(e, t) {
353
+ return Math.floor((e.month - t + 12) % 12 / 3) + 1;
354
+ }
355
+ function $(e, t) {
356
+ return t === 1 || e.month < t ? e.year : e.year + 1;
357
+ }
358
+ function W(e) {
359
+ return e === 1 ? "1st" : e === 2 ? "2nd" : e === 3 ? "3rd" : `${e}th`;
360
+ }
361
+ function f(e, t, r, n) {
362
+ const a = y(n) ?? 1, o = Q(e, a);
363
+ switch (t) {
364
+ case "week_of_short":
365
+ return `Week of ${i(e.month, r, "short")} ${e.day}, ${e.year}`;
366
+ case "week_of_long":
367
+ return `Week of ${i(e.month, r, "long")} ${e.day}, ${e.year}`;
368
+ case "quarter_short":
369
+ return `Q${o} ${e.year}`;
370
+ case "quarter_long":
371
+ return `${W(o)} Quarter ${e.year}`;
372
+ case "fiscal_quarter_short":
373
+ return `Q${o} FY${$(e, a)}`;
374
+ case "fiscal_year":
375
+ return `FY${$(e, a)}`;
376
+ }
377
+ }
378
+ function V(e, t, r) {
379
+ const n = y(t);
380
+ switch (t.granularity) {
381
+ case "second":
382
+ return `${h(e)}, ${T(e, !0)}`;
383
+ case "minute":
384
+ case "hour":
385
+ return `${h(e)}, ${T(e, !1)}`;
386
+ case "day":
387
+ return h(e);
388
+ case "week":
389
+ return f(e, "week_of_short", r, t);
390
+ case "month":
391
+ return `${i(e.month, r, "short")} ${e.year}`;
392
+ case "quarter":
393
+ return f(
394
+ e,
395
+ n ? "fiscal_quarter_short" : "quarter_short",
396
+ r,
397
+ t
398
+ );
399
+ case "year":
400
+ return n ? f(e, "fiscal_year", r, t) : String(e.year);
401
+ }
402
+ }
403
+ function re(e) {
404
+ const t = I(e.format);
405
+ if (!t.ok || !S(t.value, e.metadata))
406
+ throw new m(
407
+ "invalid_temporal_bucket_format",
408
+ "Resolved temporal bucket format is invalid or inapplicable to its metadata."
409
+ );
410
+ const r = L(e.value, e.metadata);
411
+ if (!r.ok)
412
+ throw new m(
413
+ r.error.code,
414
+ r.error.message
415
+ );
416
+ if (r.value === null) return "(Blank)";
417
+ const { presentation: n, locale: a } = t.value;
418
+ if (n.mode === "auto")
419
+ return V(r.value, e.metadata, a);
420
+ if (n.mode === "preset")
421
+ return f(
422
+ r.value,
423
+ n.preset,
424
+ a,
425
+ e.metadata
426
+ );
427
+ const o = k(n.pattern);
428
+ if (!o.ok)
429
+ throw new m(
430
+ "invalid_temporal_bucket_format",
431
+ o.message
432
+ );
433
+ return K(r.value, o.segments, a);
434
+ }
435
+ export {
436
+ q as T,
437
+ m as a,
438
+ L as b,
439
+ te as c,
440
+ re as f,
441
+ O as i,
442
+ I as p,
443
+ ee as r,
444
+ k as t,
445
+ Y as v
446
+ };
@@ -0,0 +1,205 @@
1
+ import { v as i, f as l, i as f } from "./temporal-bucket-BnPxGrAi.js";
2
+ const c = {
3
+ type: "temporal_bucket",
4
+ presentation: { mode: "auto" }
5
+ }, m = {
6
+ value: "auto",
7
+ label: "Automatic",
8
+ format: c
9
+ };
10
+ function r(t, e) {
11
+ return {
12
+ value: `pattern:${t}`,
13
+ label: e,
14
+ format: {
15
+ type: "temporal_bucket",
16
+ presentation: { mode: "pattern", pattern: t }
17
+ }
18
+ };
19
+ }
20
+ function p(t, e) {
21
+ return {
22
+ value: `preset:${t}`,
23
+ label: e,
24
+ format: {
25
+ type: "temporal_bucket",
26
+ presentation: { mode: "preset", preset: t }
27
+ }
28
+ };
29
+ }
30
+ function u(t) {
31
+ return {
32
+ ...r(t, "Custom format…"),
33
+ value: "custom",
34
+ custom: !0
35
+ };
36
+ }
37
+ const D = {
38
+ second: [
39
+ m,
40
+ r("HH:mm:ss", "14:30:45 (HH:mm:ss)"),
41
+ r(
42
+ "YYYY-MM-DD HH:mm:ss",
43
+ "2024-01-15 14:30:45 (YYYY-MM-DD HH:mm:ss)"
44
+ ),
45
+ u("DD/MM/YYYY HH:mm:ss")
46
+ ],
47
+ minute: [
48
+ m,
49
+ r("HH:mm", "14:30 (HH:mm)"),
50
+ r("YYYY-MM-DD HH:mm", "2024-01-15 14:30 (YYYY-MM-DD HH:mm)"),
51
+ u("DD/MM/YYYY HH:mm")
52
+ ],
53
+ hour: [
54
+ m,
55
+ r("HH", "14 (HH)"),
56
+ r("YYYY-MM-DD HH", "2024-01-15 14 (YYYY-MM-DD HH)"),
57
+ u("DD/MM/YYYY HH")
58
+ ],
59
+ day: [
60
+ m,
61
+ r("YYYY-MM-DD", "2024-01-15 (YYYY-MM-DD)"),
62
+ r("MM/DD/YYYY", "01/15/2024 (MM/DD/YYYY)"),
63
+ r("DD/MM/YYYY", "15/01/2024 (DD/MM/YYYY)"),
64
+ r("MMM DD, YYYY", "Jan 15, 2024 (MMM DD, YYYY)"),
65
+ r("MMMM DD, YYYY", "January 15, 2024 (MMMM DD, YYYY)"),
66
+ u("YYYY/MM/DD")
67
+ ],
68
+ week: [
69
+ m,
70
+ p("week_of_short", "Week of Jan 15, 2024"),
71
+ p("week_of_long", "Week of January 15, 2024"),
72
+ r("YYYY-MM-DD", "2024-01-15 (YYYY-MM-DD)"),
73
+ u("YYYY/MM/DD")
74
+ ],
75
+ month: [
76
+ m,
77
+ r("MMM YYYY", "Jan 2024 (MMM YYYY)"),
78
+ r("MMMM YYYY", "January 2024 (MMMM YYYY)"),
79
+ r("YYYY-MM", "2024-01 (YYYY-MM)"),
80
+ r("MM/YYYY", "01/2024 (MM/YYYY)"),
81
+ r("YYYY MMM", "2024 Jan (YYYY MMM)"),
82
+ u("YYYY/MM")
83
+ ],
84
+ quarter: [
85
+ m,
86
+ p("quarter_short", "Q1 2024"),
87
+ p("quarter_long", "1st Quarter 2024")
88
+ ],
89
+ year: [
90
+ m,
91
+ r("YYYY", "2024 (YYYY)"),
92
+ r("YY", "24 (YY)")
93
+ ]
94
+ }, H = {
95
+ second: "2026-07-31T14:05:09",
96
+ minute: "2026-07-31T14:05:00",
97
+ hour: "2026-07-31T14:00:00",
98
+ day: "2026-07-31",
99
+ week: "2026-07-27",
100
+ month: "2026-07-01",
101
+ quarter: "2026-07-01",
102
+ year: "2026-01-01"
103
+ };
104
+ function d(t, e) {
105
+ return l({
106
+ value: H[e],
107
+ metadata: {
108
+ kind: "temporal_bucket",
109
+ granularity: e,
110
+ calendar: {
111
+ tz: "UTC",
112
+ weekStart: 1,
113
+ ...t.presentation.mode === "preset" && (t.presentation.preset === "fiscal_quarter_short" || t.presentation.preset === "fiscal_year") ? {
114
+ fiscalCalendar: {
115
+ kind: "month_aligned",
116
+ yearStartMonth: 7
117
+ }
118
+ } : {}
119
+ }
120
+ },
121
+ format: { ...t, locale: "en-US" }
122
+ });
123
+ }
124
+ function _(t, e) {
125
+ const M = D[t], n = (e == null ? void 0 : e.presentation.mode) === "preset" ? e.presentation.preset : void 0, a = n && e && i(e, t).ok && !M.some(
126
+ (Y) => {
127
+ var o;
128
+ return ((o = Y.format) == null ? void 0 : o.presentation.mode) === "preset" && Y.format.presentation.preset === n;
129
+ }
130
+ ) ? p(n, n) : void 0;
131
+ return (a ? [...M, a] : M).map((Y) => {
132
+ if (!Y.format || Y.custom) return Y;
133
+ const o = d(
134
+ Y.format,
135
+ t
136
+ );
137
+ return Y.format.presentation.mode === "pattern" ? {
138
+ ...Y,
139
+ label: `${o} (${Y.format.presentation.pattern})`
140
+ } : Y.format.presentation.mode === "auto" ? { ...Y, label: `Automatic (${o})` } : { ...Y, label: o };
141
+ });
142
+ }
143
+ function T(t, e) {
144
+ const M = D[e];
145
+ if (t.presentation.mode === "pattern") {
146
+ const n = t.presentation.pattern, a = M.find(
147
+ (s) => {
148
+ var Y;
149
+ return ((Y = s.format) == null ? void 0 : Y.presentation.mode) === "pattern" && s.format.presentation.pattern === n;
150
+ }
151
+ );
152
+ return {
153
+ value: (a == null ? void 0 : a.value) ?? "custom",
154
+ customPattern: a != null && a.custom || !a ? n : "",
155
+ format: t
156
+ };
157
+ }
158
+ if (t.presentation.mode === "preset") {
159
+ const n = t.presentation.preset, a = M.find(
160
+ (Y) => {
161
+ var o;
162
+ return ((o = Y.format) == null ? void 0 : o.presentation.mode) === "preset" && Y.format.presentation.preset === n;
163
+ }
164
+ ), s = i(
165
+ t,
166
+ e
167
+ ).ok;
168
+ return a ? { value: a.value, customPattern: "", format: t } : s ? {
169
+ value: `preset:${n}`,
170
+ customPattern: "",
171
+ format: t
172
+ } : { value: "auto", customPattern: "", format: c };
173
+ }
174
+ return { value: "auto", customPattern: "", format: t };
175
+ }
176
+ function h(t, e, M = "") {
177
+ var Y;
178
+ const n = D[t].find(
179
+ (o) => o.value === e
180
+ ), a = e.startsWith("preset:") ? e.slice(7) : void 0, s = e === "custom" ? {
181
+ type: "temporal_bucket",
182
+ presentation: {
183
+ mode: "pattern",
184
+ pattern: M.trim() || (((Y = n == null ? void 0 : n.format) == null ? void 0 : Y.presentation.mode) === "pattern" ? n.format.presentation.pattern : "")
185
+ }
186
+ } : (n == null ? void 0 : n.format) ?? (a && f(a) ? {
187
+ type: "temporal_bucket",
188
+ presentation: {
189
+ mode: "preset",
190
+ preset: a
191
+ }
192
+ } : void 0);
193
+ return !s || !i(s, t).ok ? c : s;
194
+ }
195
+ function A(t, e) {
196
+ return i(t, e).ok ? t : c;
197
+ }
198
+ export {
199
+ c as A,
200
+ T as a,
201
+ h as b,
202
+ _ as g,
203
+ d as p,
204
+ A as r
205
+ };
@@ -0,0 +1 @@
1
+ "use strict";const p=require("./temporal-bucket-pMnV-4Nj.cjs"),c={type:"temporal_bucket",presentation:{mode:"auto"}},m={value:"auto",label:"Automatic",format:c};function o(t,e){return{value:`pattern:${t}`,label:e,format:{type:"temporal_bucket",presentation:{mode:"pattern",pattern:t}}}}function i(t,e){return{value:`preset:${t}`,label:e,format:{type:"temporal_bucket",presentation:{mode:"preset",preset:t}}}}function M(t){return{...o(t,"Custom format…"),value:"custom",custom:!0}}const l={second:[m,o("HH:mm:ss","14:30:45 (HH:mm:ss)"),o("YYYY-MM-DD HH:mm:ss","2024-01-15 14:30:45 (YYYY-MM-DD HH:mm:ss)"),M("DD/MM/YYYY HH:mm:ss")],minute:[m,o("HH:mm","14:30 (HH:mm)"),o("YYYY-MM-DD HH:mm","2024-01-15 14:30 (YYYY-MM-DD HH:mm)"),M("DD/MM/YYYY HH:mm")],hour:[m,o("HH","14 (HH)"),o("YYYY-MM-DD HH","2024-01-15 14 (YYYY-MM-DD HH)"),M("DD/MM/YYYY HH")],day:[m,o("YYYY-MM-DD","2024-01-15 (YYYY-MM-DD)"),o("MM/DD/YYYY","01/15/2024 (MM/DD/YYYY)"),o("DD/MM/YYYY","15/01/2024 (DD/MM/YYYY)"),o("MMM DD, YYYY","Jan 15, 2024 (MMM DD, YYYY)"),o("MMMM DD, YYYY","January 15, 2024 (MMMM DD, YYYY)"),M("YYYY/MM/DD")],week:[m,i("week_of_short","Week of Jan 15, 2024"),i("week_of_long","Week of January 15, 2024"),o("YYYY-MM-DD","2024-01-15 (YYYY-MM-DD)"),M("YYYY/MM/DD")],month:[m,o("MMM YYYY","Jan 2024 (MMM YYYY)"),o("MMMM YYYY","January 2024 (MMMM YYYY)"),o("YYYY-MM","2024-01 (YYYY-MM)"),o("MM/YYYY","01/2024 (MM/YYYY)"),o("YYYY MMM","2024 Jan (YYYY MMM)"),M("YYYY/MM")],quarter:[m,i("quarter_short","Q1 2024"),i("quarter_long","1st Quarter 2024")],year:[m,o("YYYY","2024 (YYYY)"),o("YY","24 (YY)")]},k={second:"2026-07-31T14:05:09",minute:"2026-07-31T14:05:00",hour:"2026-07-31T14:00:00",day:"2026-07-31",week:"2026-07-27",month:"2026-07-01",quarter:"2026-07-01",year:"2026-01-01"};function D(t,e){return p.formatTemporalBucket({value:k[e],metadata:{kind:"temporal_bucket",granularity:e,calendar:{tz:"UTC",weekStart:1,...t.presentation.mode==="preset"&&(t.presentation.preset==="fiscal_quarter_short"||t.presentation.preset==="fiscal_year")?{fiscalCalendar:{kind:"month_aligned",yearStartMonth:7}}:{}}},format:{...t,locale:"en-US"}})}function f(t,e){const u=l[t],Y=(e==null?void 0:e.presentation.mode)==="preset"?e.presentation.preset:void 0,n=Y&&e&&p.validateTemporalBucketFormatApplicability(e,t).ok&&!u.some(r=>{var a;return((a=r.format)==null?void 0:a.presentation.mode)==="preset"&&r.format.presentation.preset===Y})?i(Y,Y):void 0;return(n?[...u,n]:u).map(r=>{if(!r.format||r.custom)return r;const a=D(r.format,t);return r.format.presentation.mode==="pattern"?{...r,label:`${a} (${r.format.presentation.pattern})`}:r.format.presentation.mode==="auto"?{...r,label:`Automatic (${a})`}:{...r,label:a}})}function d(t,e){const u=l[e];if(t.presentation.mode==="pattern"){const Y=t.presentation.pattern,n=u.find(s=>{var r;return((r=s.format)==null?void 0:r.presentation.mode)==="pattern"&&s.format.presentation.pattern===Y});return{value:(n==null?void 0:n.value)??"custom",customPattern:n!=null&&n.custom||!n?Y:"",format:t}}if(t.presentation.mode==="preset"){const Y=t.presentation.preset,n=u.find(r=>{var a;return((a=r.format)==null?void 0:a.presentation.mode)==="preset"&&r.format.presentation.preset===Y}),s=p.validateTemporalBucketFormatApplicability(t,e).ok;return n?{value:n.value,customPattern:"",format:t}:s?{value:`preset:${Y}`,customPattern:"",format:t}:{value:"auto",customPattern:"",format:c}}return{value:"auto",customPattern:"",format:t}}function T(t,e,u=""){var r;const Y=l[t].find(a=>a.value===e),n=e.startsWith("preset:")?e.slice(7):void 0,s=e==="custom"?{type:"temporal_bucket",presentation:{mode:"pattern",pattern:u.trim()||(((r=Y==null?void 0:Y.format)==null?void 0:r.presentation.mode)==="pattern"?Y.format.presentation.pattern:"")}}:(Y==null?void 0:Y.format)??(n&&p.isTemporalBucketPreset(n)?{type:"temporal_bucket",presentation:{mode:"preset",preset:n}}:void 0);return!s||!p.validateTemporalBucketFormatApplicability(s,t).ok?c:s}function H(t,e){return p.validateTemporalBucketFormatApplicability(t,e).ok?t:c}exports.AUTOMATIC_TEMPORAL_BUCKET_FORMAT=c;exports.getTemporalBucketAuthoringOptions=f;exports.getTemporalBucketAuthoringSelection=d;exports.previewTemporalBucketAuthoringFormat=D;exports.reconcileTemporalBucketAuthoringFormat=H;exports.resolveTemporalBucketAuthoringFormat=T;