react-semaphor 0.1.453 → 0.1.455

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 (115) hide show
  1. package/dist/analytics-protocol/index.cjs +1 -1
  2. package/dist/analytics-protocol/index.js +100 -99
  3. package/dist/brand-studio/index.cjs +1 -1
  4. package/dist/brand-studio/index.js +4 -4
  5. package/dist/briefings/index.cjs +1 -1
  6. package/dist/briefings/index.js +4 -4
  7. package/dist/chunks/{analyze-result-contract-GHKFwThg.js → analyze-result-contract-BbRJ-C06.js} +1 -1
  8. package/dist/chunks/{analyze-result-contract-Dxw66nUG.cjs → analyze-result-contract-LPDNldic.cjs} +1 -1
  9. package/dist/chunks/canonical-result-keys-BA0HCP4e.cjs +1 -0
  10. package/dist/chunks/{canonical-result-keys-KLk__J_O.js → canonical-result-keys-D6avdjpA.js} +14 -13
  11. package/dist/chunks/{common-types-Ci66eflG.cjs → common-types-C57kJ59w.cjs} +1 -1
  12. package/dist/chunks/{common-types-F6qk6PPS.js → common-types-H51FLKB7.js} +1 -1
  13. package/dist/chunks/{dashboard-briefing-launcher-CFpX0WX3.js → dashboard-briefing-launcher-BgBMjAVe.js} +10 -10
  14. package/dist/chunks/{dashboard-briefing-launcher-mUXWuiOZ.cjs → dashboard-briefing-launcher-BmEHYblf.cjs} +1 -1
  15. package/dist/chunks/{dashboard-controls-SoNubIu1.cjs → dashboard-controls-BLNG_zHC.cjs} +1 -1
  16. package/dist/chunks/{dashboard-controls-BeYAmOJc.js → dashboard-controls-C-23EDdr.js} +10 -10
  17. package/dist/chunks/dashboard-date-comparison-definition-Ces4alFm.cjs +1 -0
  18. package/dist/chunks/{dashboard-date-comparison-definition-Ba-clViK.js → dashboard-date-comparison-definition-DC3ekV2S.js} +1 -1
  19. package/dist/chunks/{dashboard-json-BublPnQ4.cjs → dashboard-json-BJ_Z9EaL.cjs} +1 -1
  20. package/dist/chunks/{dashboard-json-DeLUagVV.js → dashboard-json-BTF-1Iwa.js} +8 -8
  21. package/dist/chunks/{edit-dashboard-visual-CrvPcO7A.cjs → edit-dashboard-visual-CR832BJc.cjs} +1 -1
  22. package/dist/chunks/{edit-dashboard-visual-Go0h82DR.js → edit-dashboard-visual-Mw-ZE7P7.js} +12 -12
  23. package/dist/chunks/{editor-action-buttons-1Lo0fIh7.cjs → editor-action-buttons-BVigIMg0.cjs} +1 -1
  24. package/dist/chunks/{editor-action-buttons-BFNtjFzO.js → editor-action-buttons-BxbFCerU.js} +6 -6
  25. package/dist/chunks/{index-BsH32bn1.js → index-B5Oy1eLv.js} +35305 -34883
  26. package/dist/chunks/index-C99Ow35Y.cjs +4 -0
  27. package/dist/chunks/{index-q12_nNUS.cjs → index-DIWJALWL.cjs} +231 -231
  28. package/dist/chunks/{index-B3ZugihZ.js → index-DrYILnh0.js} +799 -808
  29. package/dist/chunks/matrix-result-contract-CofATICL.js +437 -0
  30. package/dist/chunks/matrix-result-contract-zamd9euI.cjs +1 -0
  31. package/dist/chunks/{pivot-header-presentation-DcfPaCiy.cjs → pivot-header-presentation-DhyQXxKq.cjs} +1 -1
  32. package/dist/chunks/{pivot-header-presentation-nk604qc1.js → pivot-header-presentation-ckYOQ4aZ.js} +2 -2
  33. package/dist/chunks/{pivot-result-identity-CRUokNgm.cjs → pivot-result-identity-Bb4EixVN.cjs} +1 -1
  34. package/dist/chunks/{pivot-result-identity-C43Ai5Kr.js → pivot-result-identity-DU1v-5Xk.js} +1 -1
  35. package/dist/chunks/pivot-result-lifecycle-DmcF1ris.cjs +1 -0
  36. package/dist/chunks/{pivot-result-lifecycle-4kSe0Hk1.js → pivot-result-lifecycle-sjzIOpvp.js} +57 -58
  37. package/dist/chunks/{raw-temporal-contract-CxbRFwnd.cjs → raw-temporal-contract-BtjH_G-d.cjs} +1 -1
  38. package/dist/chunks/{raw-temporal-contract-BF7PjBY9.js → raw-temporal-contract-CxncLze5.js} +1 -1
  39. package/dist/chunks/{report-preferences-dialog-BEVZAE3m.cjs → report-preferences-dialog-BgE3Gzsp.cjs} +1 -1
  40. package/dist/chunks/{report-preferences-dialog-BNV7qXYH.js → report-preferences-dialog-CFenWkcH.js} +6 -6
  41. package/dist/chunks/{report-runtime-context-DjYqLV-c.cjs → report-runtime-context-DqxS4wbi.cjs} +1 -1
  42. package/dist/chunks/{report-runtime-context-BJQDu2fV.js → report-runtime-context-SM6YO61_.js} +5 -5
  43. package/dist/chunks/saved-temporal-bucket-format-CFfWXRl9.cjs +1 -0
  44. package/dist/chunks/{saved-temporal-bucket-format-DiZdQXOL.js → saved-temporal-bucket-format-SGAV0ivR.js} +33 -35
  45. package/dist/chunks/{switch-DgLwr7O-.js → switch-BeZW-HnS.js} +367 -369
  46. package/dist/chunks/{switch-CjJ6FHYJ.cjs → switch-D-CCcfhc.cjs} +28 -28
  47. package/dist/chunks/temporal-bucket-5UYEotyQ.js +810 -0
  48. package/dist/chunks/temporal-bucket-DHY1y9lq.cjs +1 -0
  49. package/dist/chunks/{temporal-bucket-authoring-FIRnJz0e.js → temporal-bucket-authoring-K1kE6R_z.js} +28 -27
  50. package/dist/chunks/temporal-bucket-authoring-o3Emn05L.cjs +1 -0
  51. package/dist/chunks/{temporal-bucket-contract-anl4h-vg.cjs → temporal-bucket-contract-D2-93DGr.cjs} +1 -1
  52. package/dist/chunks/{temporal-bucket-contract-BQOj6Frl.js → temporal-bucket-contract-D5d-xEl3.js} +1 -1
  53. package/dist/chunks/{token-types-D0i0IUX3.cjs → token-types-D7CaaI80.cjs} +1 -1
  54. package/dist/chunks/{token-types-CRpQJ4kv.js → token-types-GbxRUozo.js} +1 -1
  55. package/dist/chunks/{update-policy-C1i9bgsy.cjs → update-policy-BmiOd0PB.cjs} +1 -1
  56. package/dist/chunks/{update-policy-CaJz9aPG.js → update-policy-hednMF-0.js} +1 -1
  57. package/dist/chunks/validators-BDYprKI9.cjs +1 -0
  58. package/dist/chunks/{validators-DeMXwRON.js → validators-DEmd8Sin.js} +1544 -1200
  59. package/dist/dashboard/index.cjs +1 -1
  60. package/dist/dashboard/index.js +2 -2
  61. package/dist/dashboard-authoring/index.cjs +3 -3
  62. package/dist/dashboard-authoring/index.js +7 -7
  63. package/dist/data-app-builder/index.cjs +1 -1
  64. package/dist/data-app-builder/index.js +2 -2
  65. package/dist/data-app-codegen/index.cjs +1 -1
  66. package/dist/data-app-codegen/index.js +2 -2
  67. package/dist/data-app-codegen-node/index.cjs +1 -1
  68. package/dist/data-app-codegen-node/index.js +3 -3
  69. package/dist/data-app-sdk/index.cjs +1 -1
  70. package/dist/data-app-sdk/index.js +78 -77
  71. package/dist/data-app-sdk-adapters/index.cjs +1 -1
  72. package/dist/data-app-sdk-adapters/index.js +29 -30
  73. package/dist/data-app-sdk-validation/index.cjs +1 -1
  74. package/dist/data-app-sdk-validation/index.js +21 -21
  75. package/dist/format-utils/index.cjs +3 -3
  76. package/dist/format-utils/index.js +39 -40
  77. package/dist/index.cjs +1 -1
  78. package/dist/index.js +15 -15
  79. package/dist/report-runtime-context/index.cjs +1 -1
  80. package/dist/report-runtime-context/index.js +2 -2
  81. package/dist/surfboard/index.cjs +1 -1
  82. package/dist/surfboard/index.js +3 -3
  83. package/dist/types/analytics-protocol.d.ts +44 -11
  84. package/dist/types/briefings.d.ts +9 -17
  85. package/dist/types/dashboard-assistant.d.ts +19 -22
  86. package/dist/types/dashboard-authoring.d.ts +9 -17
  87. package/dist/types/dashboard.d.ts +9 -17
  88. package/dist/types/data-app-builder.d.ts +28 -2
  89. package/dist/types/data-app-codegen-node.d.ts +29 -3
  90. package/dist/types/data-app-codegen.d.ts +29 -3
  91. package/dist/types/data-app-sdk-adapters.d.ts +28 -2
  92. package/dist/types/data-app-sdk-validation.d.ts +38 -7
  93. package/dist/types/data-app-sdk.d.ts +42 -10
  94. package/dist/types/index.cjs +1 -1
  95. package/dist/types/index.js +4 -4
  96. package/dist/types/main.d.ts +25 -26
  97. package/dist/types/shared.d.ts +9 -17
  98. package/dist/types/surfboard.d.ts +9 -17
  99. package/dist/types/types.d.ts +19 -22
  100. package/package.json +1 -1
  101. package/dist/chunks/canonical-result-keys-Drc2x-lf.cjs +0 -1
  102. package/dist/chunks/catalog-field-grounding-Bnx-3tE0.cjs +0 -1
  103. package/dist/chunks/catalog-field-grounding-S2jKwKGD.js +0 -100
  104. package/dist/chunks/dashboard-date-comparison-definition-DZq0htjG.cjs +0 -1
  105. package/dist/chunks/dashboard-input-contract-DSt8dGzP.js +0 -18
  106. package/dist/chunks/dashboard-input-contract-DV3cshjz.cjs +0 -1
  107. package/dist/chunks/index-DjiIh_9n.cjs +0 -4
  108. package/dist/chunks/metric-comparison-D0T0MKRK.js +0 -387
  109. package/dist/chunks/metric-comparison-DYR3RXam.cjs +0 -1
  110. package/dist/chunks/pivot-result-lifecycle-BiJepH5S.cjs +0 -1
  111. package/dist/chunks/saved-temporal-bucket-format-Gfbh4IiP.cjs +0 -1
  112. package/dist/chunks/temporal-bucket-Dnj8qT9l.cjs +0 -1
  113. package/dist/chunks/temporal-bucket-FBZGrDCe.js +0 -560
  114. package/dist/chunks/temporal-bucket-authoring-7hv2laOG.cjs +0 -1
  115. package/dist/chunks/validators-Dm7Kpz6p.cjs +0 -1
@@ -1,560 +0,0 @@
1
- var x = Object.defineProperty;
2
- var C = (e, t, r) => t in e ? x(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var w = (e, t, r) => C(e, typeof t != "symbol" ? t + "" : t, r);
4
- import { canonicalizeSupportedLocale as E } from "../value-format-preferences/index.js";
5
- const N = [
6
- "YYYY",
7
- "MMMM",
8
- "MMM",
9
- "YY",
10
- "MM",
11
- "DD",
12
- "HH",
13
- "mm",
14
- "ss"
15
- ], H = /* @__PURE__ */ new Set([" ", "-", "/", ":", ".", ",", "T"]), P = {
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 j(e) {
24
- return typeof e == "string" && Object.prototype.hasOwnProperty.call(P, e);
25
- }
26
- function B(e, t) {
27
- return N.find(
28
- (r) => e.startsWith(r, t)
29
- );
30
- }
31
- function M(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 s = B(e, r);
43
- if (s) {
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: s }), r += s.length, n = !0;
51
- continue;
52
- }
53
- const o = e[r];
54
- if (!H.has(o))
55
- return {
56
- ok: !1,
57
- code: "invalid_temporal_bucket_pattern",
58
- message: `Unsupported temporal bucket pattern character "${o}".`
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 i = t[t.length - 1];
67
- i.kind === "literal" ? i.value += o : t.push({ kind: "literal", value: o }), 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 U(e) {
76
- return e.flatMap(
77
- (t) => t.kind === "token" ? [t.value] : []
78
- );
79
- }
80
- function v(e, t) {
81
- return e.filter((r) => t.includes(r)).length === 1;
82
- }
83
- function y(e, t) {
84
- return e.some((r) => t.includes(r));
85
- }
86
- function R(e) {
87
- return new Set(e).size !== e.length;
88
- }
89
- function I(e, t) {
90
- if (R(e)) return !1;
91
- const r = ["YYYY", "YY"], n = ["MMMM", "MMM", "MM"], a = ["HH", "mm", "ss"], s = v(e, r), o = v(e, n), i = e.includes("DD"), u = y(e, a);
92
- switch (t) {
93
- case "second":
94
- return e.includes("HH") && e.includes("mm") && e.includes("ss") && (!y(e, [...r, ...n, "DD"]) || s && o && i);
95
- case "minute":
96
- return e.includes("HH") && e.includes("mm") && (!y(e, [...r, ...n, "DD"]) || s && o && i);
97
- case "hour":
98
- return e.includes("HH") && (!y(e, [...r, ...n, "DD"]) || s && o && i);
99
- case "day":
100
- case "week":
101
- return s && o && i && !u;
102
- case "month":
103
- return s && o && !i && !u;
104
- case "quarter":
105
- return !1;
106
- case "year":
107
- return s && !o && !i && !u;
108
- }
109
- }
110
- function O(e, t) {
111
- if (e.presentation.mode === "auto")
112
- return { ok: !0 };
113
- if (e.presentation.mode === "preset") {
114
- const n = P[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 = M(e.presentation.pattern);
122
- return r.ok ? I(
123
- U(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 ce(e, t) {
132
- if (!(!e || !t))
133
- return O(e, t).ok ? e : void 0;
134
- }
135
- function f(e) {
136
- if (e === null || typeof e != "object" || Array.isArray(e))
137
- return !1;
138
- const t = Object.getPrototypeOf(e);
139
- if (t === null || t === Object.prototype) return !0;
140
- const r = Object.prototype.hasOwnProperty.call(
141
- t,
142
- "constructor"
143
- ) ? t.constructor : void 0;
144
- return typeof r == "function" && Function.prototype.toString.call(r) === Function.prototype.toString.call(Object);
145
- }
146
- const L = {
147
- dateStyle: "short",
148
- dateTime: { dateStyle: "short", timeStyle: "short" }
149
- };
150
- class h extends Error {
151
- constructor(r, n) {
152
- super(n);
153
- w(this, "code");
154
- this.name = "TemporalBucketContractError", this.code = r;
155
- }
156
- }
157
- const J = [
158
- "Jan",
159
- "Feb",
160
- "Mar",
161
- "Apr",
162
- "May",
163
- "Jun",
164
- "Jul",
165
- "Aug",
166
- "Sep",
167
- "Oct",
168
- "Nov",
169
- "Dec"
170
- ], z = [
171
- "January",
172
- "February",
173
- "March",
174
- "April",
175
- "May",
176
- "June",
177
- "July",
178
- "August",
179
- "September",
180
- "October",
181
- "November",
182
- "December"
183
- ];
184
- function b(e) {
185
- return {
186
- ok: !1,
187
- error: { code: "invalid_temporal_bucket_value", message: e }
188
- };
189
- }
190
- function Z(e) {
191
- return e % 4 === 0 && (e % 100 !== 0 || e % 400 === 0);
192
- }
193
- function W(e, t) {
194
- return t === 2 ? Z(e) ? 29 : 28 : [4, 6, 9, 11].includes(t) ? 30 : 31;
195
- }
196
- function G(e, t, r) {
197
- const n = [0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4], a = t < 3 ? e - 1 : e;
198
- return (a + Math.floor(a / 4) - Math.floor(a / 100) + Math.floor(a / 400) + n[t - 1] + r) % 7;
199
- }
200
- function S(e) {
201
- var t;
202
- return (t = e.calendar.fiscalCalendar) == null ? void 0 : t.yearStartMonth;
203
- }
204
- function K(e, t) {
205
- return (e - t + 12) % 12 % 3 === 0;
206
- }
207
- function Q(e, t) {
208
- const { granularity: r } = t, n = S(t) ?? 1;
209
- switch (r) {
210
- case "second":
211
- return !0;
212
- case "minute":
213
- return e.second === 0;
214
- case "hour":
215
- return e.minute === 0 && e.second === 0;
216
- case "day":
217
- return !0;
218
- case "week":
219
- return G(e.year, e.month, e.day) === t.calendar.weekStart;
220
- case "month":
221
- return e.day === 1;
222
- case "quarter":
223
- return e.day === 1 && K(e.month, n);
224
- case "year":
225
- return e.day === 1 && e.month === n;
226
- }
227
- }
228
- function V(e, t) {
229
- if (e === null) return { ok: !0, value: null };
230
- 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);
231
- if (!n)
232
- return b(
233
- `Expected ${r ? "YYYY-MM-DDTHH:mm:ss" : "YYYY-MM-DD"} for ${t.granularity} granularity.`
234
- );
235
- const a = {
236
- year: Number(n[1]),
237
- month: Number(n[2]),
238
- day: Number(n[3]),
239
- hour: r ? Number(n[4]) : 0,
240
- minute: r ? Number(n[5]) : 0,
241
- second: r ? Number(n[6]) : 0
242
- };
243
- return a.year < 1 || a.month < 1 || a.month > 12 || a.day < 1 || a.day > W(a.year, a.month) || a.hour > 23 || a.minute > 59 || a.second > 59 ? b(`Invalid canonical ${t.granularity} bucket value ${e}.`) : Q(a, t) ? { ok: !0, value: a } : b(
244
- `Canonical value ${e} is not aligned to ${t.granularity} granularity and its governed Calendar.`
245
- );
246
- }
247
- function X(e) {
248
- if (!f(e))
249
- return {
250
- ok: !1,
251
- issues: [{ path: "$", message: "Resolved temporal bucket format must be an object." }]
252
- };
253
- const t = [], r = /* @__PURE__ */ new Set(["type", "presentation", "locale"]);
254
- for (const o of Object.keys(e))
255
- r.has(o) || t.push({ path: o, message: `Unknown property "${o}".` });
256
- e.type !== "temporal_bucket" && t.push({ path: "type", message: "Expected temporal_bucket." });
257
- const n = e.presentation;
258
- if (!f(n))
259
- t.push({ path: "presentation", message: "Expected a presentation object." });
260
- else {
261
- const o = n.mode, i = o === "preset" ? /* @__PURE__ */ new Set(["mode", "preset"]) : o === "pattern" ? /* @__PURE__ */ new Set(["mode", "pattern"]) : o === "auto" ? /* @__PURE__ */ new Set(["mode", "styles"]) : /* @__PURE__ */ new Set(["mode"]);
262
- for (const u of Object.keys(n))
263
- i.has(u) || t.push({
264
- path: `presentation.${u}`,
265
- message: `Unknown property "${u}".`
266
- });
267
- if (o === "preset")
268
- j(n.preset) || t.push({ path: "presentation.preset", message: "Expected a supported preset." });
269
- else if (o === "pattern")
270
- if (typeof n.pattern != "string" || !n.pattern)
271
- t.push({ path: "presentation.pattern", message: "Expected a non-empty pattern." });
272
- else {
273
- const u = M(n.pattern);
274
- u.ok || t.push({
275
- path: "presentation.pattern",
276
- message: u.message
277
- });
278
- }
279
- else if (o === "auto") {
280
- const u = n.styles;
281
- (!f(u) || !["short", "medium", "long"].includes(String(u.dateStyle)) || !f(u.dateTime) || !["short", "medium", "long"].includes(
282
- String(u.dateTime.dateStyle)
283
- ) || !["short", "medium", "long"].includes(
284
- String(u.dateTime.timeStyle)
285
- ) || Object.keys(u).some(
286
- (c) => c !== "dateStyle" && c !== "dateTime"
287
- ) || Object.keys(u.dateTime).some(
288
- (c) => c !== "dateStyle" && c !== "timeStyle"
289
- )) && t.push({
290
- path: "presentation.styles",
291
- message: "Expected complete resolved date and datetime styles."
292
- });
293
- } else
294
- t.push({ path: "presentation.mode", message: "Expected auto, preset, or pattern." });
295
- }
296
- const a = E(e.locale);
297
- if (a || t.push({ path: "locale", message: "Expected a supported base BCP 47 locale." }), t.length > 0 || !a || !f(n))
298
- return { ok: !1, issues: t };
299
- if (n.mode === "auto") {
300
- const o = n.styles;
301
- return {
302
- ok: !0,
303
- value: {
304
- type: "temporal_bucket",
305
- locale: a,
306
- presentation: {
307
- mode: "auto",
308
- styles: {
309
- dateStyle: o.dateStyle,
310
- dateTime: {
311
- dateStyle: o.dateTime.dateStyle,
312
- timeStyle: o.dateTime.timeStyle
313
- }
314
- }
315
- }
316
- }
317
- };
318
- }
319
- return {
320
- ok: !0,
321
- value: {
322
- type: "temporal_bucket",
323
- presentation: n.mode === "preset" ? {
324
- mode: "preset",
325
- preset: n.preset
326
- } : {
327
- mode: "pattern",
328
- pattern: n.pattern
329
- },
330
- locale: a
331
- }
332
- };
333
- }
334
- function ee(e, t) {
335
- const r = !!t.calendar.fiscalCalendar;
336
- return e === "fiscal_quarter_short" || e === "fiscal_year" ? r : e === "quarter_short" || e === "quarter_long" ? !r : !0;
337
- }
338
- function F(e, t) {
339
- return O(e, t.granularity).ok ? e.presentation.mode === "preset" ? ee(e.presentation.preset, t) : !(e.presentation.mode === "pattern" && t.calendar.fiscalCalendar && (t.granularity === "quarter" || t.granularity === "year")) : !1;
340
- }
341
- function Y(e, t) {
342
- if (!(!e || e.presentation.mode === "auto"))
343
- return F(e, t) ? { type: "temporal_bucket", presentation: e.presentation } : void 0;
344
- }
345
- function le(e) {
346
- var a;
347
- const t = E(e.locale);
348
- if (!t)
349
- throw new h(
350
- "invalid_temporal_bucket_format",
351
- "Temporal bucket locale must be a supported base BCP 47 locale."
352
- );
353
- const r = Y(e.cardFormat, e.metadata);
354
- if (r)
355
- return { format: { ...r, locale: t }, source: "card" };
356
- const n = ((a = e.semanticFormat) == null ? void 0 : a.granularity) === e.metadata.granularity ? Y(e.semanticFormat.format, e.metadata) : void 0;
357
- return n ? { format: { ...n, locale: t }, source: "semantic" } : {
358
- format: {
359
- type: "temporal_bucket",
360
- locale: t,
361
- presentation: {
362
- mode: "auto",
363
- styles: e.styles ?? L
364
- }
365
- },
366
- source: "automatic"
367
- };
368
- }
369
- function m(e, t = 2) {
370
- return String(e).padStart(t, "0");
371
- }
372
- function k(e, t, r) {
373
- if (t === "en-US")
374
- return (r === "short" ? J : z)[e - 1];
375
- const n = new Date(Date.UTC(2e3, e - 1, 15));
376
- return new Intl.DateTimeFormat(t, {
377
- calendar: "gregory",
378
- month: r,
379
- timeZone: "UTC"
380
- }).format(n);
381
- }
382
- function te(e, t, r) {
383
- return t.map((n) => {
384
- if (n.kind === "literal") return n.value;
385
- switch (n.value) {
386
- case "YYYY":
387
- return m(e.year, 4);
388
- case "YY":
389
- return m(e.year % 100);
390
- case "MMMM":
391
- return k(e.month, r, "long");
392
- case "MMM":
393
- return k(e.month, r, "short");
394
- case "MM":
395
- return m(e.month);
396
- case "DD":
397
- return m(e.day);
398
- case "HH":
399
- return m(e.hour);
400
- case "mm":
401
- return m(e.minute);
402
- case "ss":
403
- return m(e.second);
404
- }
405
- }).join("");
406
- }
407
- const $ = /* @__PURE__ */ new Map();
408
- function p(e, t) {
409
- const r = `${e}:${JSON.stringify(t)}`, n = $.get(r);
410
- if (n) return n;
411
- const a = new Intl.DateTimeFormat(e, t);
412
- return $.set(r, a), a;
413
- }
414
- function g(e) {
415
- const t = /* @__PURE__ */ new Date(0);
416
- return t.setUTCFullYear(e.year, e.month - 1, e.day), t.setUTCHours(e.hour, e.minute, e.second, 0), t;
417
- }
418
- function D(e, t, r) {
419
- return p(t, {
420
- calendar: "gregory",
421
- dateStyle: r,
422
- timeZone: "UTC"
423
- }).format(g(e));
424
- }
425
- function re(e, t, r) {
426
- return p(t, {
427
- calendar: "gregory",
428
- dateStyle: r.dateStyle,
429
- // Grouped buckets are civil values, not instants. Long time styles would
430
- // append a zone label that the canonical value does not semantically own.
431
- timeStyle: r.timeStyle === "long" ? "medium" : r.timeStyle,
432
- timeZone: "UTC"
433
- }).format(g(e));
434
- }
435
- function ne(e, t, r) {
436
- var a;
437
- if (r === "short") {
438
- const s = g(e), o = p(t, {
439
- calendar: "gregory",
440
- dateStyle: "short",
441
- timeZone: "UTC"
442
- }).formatToParts(s), i = o.findIndex((l) => l.type === "month"), u = o.findIndex((l) => l.type === "year"), c = (a = p(t, {
443
- calendar: "gregory",
444
- timeZone: "UTC",
445
- year: "numeric"
446
- }).formatToParts(s).find((l) => l.type === "year")) == null ? void 0 : a.value;
447
- if (i >= 0 && u >= 0 && c) {
448
- const l = Math.min(i, u), q = Math.max(i, u);
449
- let _ = !1;
450
- return o.slice(l, q + 1).filter((d) => d.type === "day" ? (_ = !0, !1) : _ && d.type === "literal" ? (_ = !1, !1) : !0).map((d) => d.type === "year" ? c : d.value).join("");
451
- }
452
- }
453
- return p(t, {
454
- calendar: "gregory",
455
- month: r === "short" ? "numeric" : r === "medium" ? "short" : "long",
456
- timeZone: "UTC",
457
- year: "numeric"
458
- }).format(g(e));
459
- }
460
- function ae(e, t) {
461
- return Math.floor((e.month - t + 12) % 12 / 3) + 1;
462
- }
463
- function A(e, t) {
464
- return t === 1 || e.month < t ? e.year : e.year + 1;
465
- }
466
- function oe(e) {
467
- return e === 1 ? "1st" : e === 2 ? "2nd" : e === 3 ? "3rd" : `${e}th`;
468
- }
469
- function T(e, t, r, n) {
470
- const a = S(n) ?? 1, s = ae(e, a);
471
- switch (t) {
472
- case "week_of_short":
473
- return `Week of ${k(e.month, r, "short")} ${e.day}, ${e.year}`;
474
- case "week_of_long":
475
- return `Week of ${k(e.month, r, "long")} ${e.day}, ${e.year}`;
476
- case "quarter_short":
477
- return `Q${s} ${e.year}`;
478
- case "quarter_long":
479
- return `${oe(s)} Quarter ${e.year}`;
480
- case "fiscal_quarter_short":
481
- return `Q${s} FY${A(e, a)}`;
482
- case "fiscal_year":
483
- return `FY${A(e, a)}`;
484
- }
485
- }
486
- function se(e, t, r, n) {
487
- const a = S(t);
488
- switch (t.granularity) {
489
- case "second":
490
- case "minute":
491
- case "hour":
492
- return re(e, r, n.dateTime);
493
- case "day":
494
- return D(e, r, n.dateStyle);
495
- case "week":
496
- return `Week of ${D(e, r, n.dateStyle)}`;
497
- case "month":
498
- return ne(e, r, n.dateStyle);
499
- case "quarter":
500
- return T(
501
- e,
502
- a ? "fiscal_quarter_short" : "quarter_short",
503
- r,
504
- t
505
- );
506
- case "year":
507
- return a ? T(e, "fiscal_year", r, t) : String(e.year);
508
- }
509
- }
510
- function me(e) {
511
- const t = X(e.format);
512
- if (!t.ok || !F(t.value, e.metadata))
513
- throw new h(
514
- "invalid_temporal_bucket_format",
515
- "Resolved temporal bucket format is invalid or inapplicable to its metadata."
516
- );
517
- const r = V(e.value, e.metadata);
518
- if (!r.ok)
519
- throw new h(
520
- r.error.code,
521
- r.error.message
522
- );
523
- if (r.value === null) return "(Blank)";
524
- const { presentation: n, locale: a } = t.value;
525
- if (n.mode === "auto")
526
- return se(
527
- r.value,
528
- e.metadata,
529
- a,
530
- n.styles
531
- );
532
- if (n.mode === "preset")
533
- return T(
534
- r.value,
535
- n.preset,
536
- a,
537
- e.metadata
538
- );
539
- const s = M(n.pattern);
540
- if (!s.ok)
541
- throw new h(
542
- "invalid_temporal_bucket_format",
543
- s.message
544
- );
545
- return te(r.value, s.segments, a);
546
- }
547
- export {
548
- L as D,
549
- N as T,
550
- h as a,
551
- X as b,
552
- le as c,
553
- f as d,
554
- me as f,
555
- j as i,
556
- V as p,
557
- ce as r,
558
- M as t,
559
- O as v
560
- };
@@ -1 +0,0 @@
1
- "use strict";const M=require("./temporal-bucket-Dnj8qT9l.cjs"),d=require("../value-format-preferences/index.cjs"),l={type:"temporal_bucket",presentation:{mode:"auto"}},m={value:"auto",label:"Automatic",format:l};function r(t,e){return{value:`pattern:${t}`,label:e,format:{type:"temporal_bucket",presentation:{mode:"pattern",pattern:t}}}}function c(t,e){return{value:`preset:${t}`,label:e,format:{type:"temporal_bucket",presentation:{mode:"preset",preset:t}}}}function p(t){return{...r(t,"Custom format…"),value:"custom",custom:!0}}const D={second:[m,r("HH:mm:ss","14:30:45 (HH:mm:ss)"),r("YYYY-MM-DD HH:mm:ss","2024-01-15 14:30:45 (YYYY-MM-DD HH:mm:ss)"),p("DD/MM/YYYY HH:mm:ss")],minute:[m,r("HH:mm","14:30 (HH:mm)"),r("YYYY-MM-DD HH:mm","2024-01-15 14:30 (YYYY-MM-DD HH:mm)"),p("DD/MM/YYYY HH:mm")],hour:[m,r("HH","14 (HH)"),r("YYYY-MM-DD HH","2024-01-15 14 (YYYY-MM-DD HH)"),p("DD/MM/YYYY HH")],day:[m,r("YYYY-MM-DD","2024-01-15 (YYYY-MM-DD)"),r("MM/DD/YYYY","01/15/2024 (MM/DD/YYYY)"),r("DD/MM/YYYY","15/01/2024 (DD/MM/YYYY)"),r("MMM DD, YYYY","Jan 15, 2024 (MMM DD, YYYY)"),r("MMMM DD, YYYY","January 15, 2024 (MMMM DD, YYYY)"),p("YYYY/MM/DD")],week:[m,c("week_of_short","Week of Jan 15, 2024"),c("week_of_long","Week of January 15, 2024"),r("YYYY-MM-DD","2024-01-15 (YYYY-MM-DD)"),p("YYYY/MM/DD")],month:[m,r("MMM YYYY","Jan 2024 (MMM YYYY)"),r("MMMM YYYY","January 2024 (MMMM YYYY)"),r("YYYY-MM","2024-01 (YYYY-MM)"),r("MM/YYYY","01/2024 (MM/YYYY)"),r("YYYY MMM","2024 Jan (YYYY MMM)"),p("YYYY/MM")],quarter:[m,c("quarter_short","Q1 2024"),c("quarter_long","1st Quarter 2024")],year:[m,r("YYYY","2024 (YYYY)"),r("YY","24 (YY)")]},T={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 k(t,e,Y=d.DEFAULT_RESOLVED_VALUE_FORMAT_PREFERENCES){return M.formatTemporalBucket({value:T[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.presentation.mode==="auto"?{type:"temporal_bucket",locale:Y.locale,presentation:{mode:"auto",styles:{dateStyle:Y.dateStyle,dateTime:{...Y.dateTime}}}}:{type:"temporal_bucket",locale:Y.locale,presentation:t.presentation}})}function _(t,e,Y=d.DEFAULT_RESOLVED_VALUE_FORMAT_PREFERENCES){const n=D[t],o=(e==null?void 0:e.presentation.mode)==="preset"?e.presentation.preset:void 0,s=o&&e&&M.validateTemporalBucketFormatApplicability(e,t).ok&&!n.some(a=>{var i;return((i=a.format)==null?void 0:i.presentation.mode)==="preset"&&a.format.presentation.preset===o})?c(o,o):void 0;return(s?[...n,s]:n).map(a=>{if(!a.format||a.custom)return a;const i=k(a.format,t,Y);return a.format.presentation.mode==="pattern"?{...a,label:`${i} (${a.format.presentation.pattern})`}:a.format.presentation.mode==="auto"?{...a,label:`Automatic (${i})`}:{...a,label:i}})}function A(t,e){const Y=D[e];if(t.presentation.mode==="pattern"){const n=t.presentation.pattern,o=Y.find(s=>{var u;return((u=s.format)==null?void 0:u.presentation.mode)==="pattern"&&s.format.presentation.pattern===n});return{value:(o==null?void 0:o.value)??"custom",customPattern:o!=null&&o.custom||!o?n:"",format:t}}if(t.presentation.mode==="preset"){const n=t.presentation.preset,o=Y.find(u=>{var a;return((a=u.format)==null?void 0:a.presentation.mode)==="preset"&&u.format.presentation.preset===n}),s=M.validateTemporalBucketFormatApplicability(t,e).ok;return o?{value:o.value,customPattern:"",format:t}:s?{value:`preset:${n}`,customPattern:"",format:t}:{value:"auto",customPattern:"",format:l}}return{value:"auto",customPattern:"",format:t}}function f(t,e,Y=""){var u;const n=D[t].find(a=>a.value===e),o=e.startsWith("preset:")?e.slice(7):void 0,s=e==="custom"?{type:"temporal_bucket",presentation:{mode:"pattern",pattern:Y.trim()||(((u=n==null?void 0:n.format)==null?void 0:u.presentation.mode)==="pattern"?n.format.presentation.pattern:"")}}:(n==null?void 0:n.format)??(o&&M.isTemporalBucketPreset(o)?{type:"temporal_bucket",presentation:{mode:"preset",preset:o}}:void 0);return!s||!M.validateTemporalBucketFormatApplicability(s,t).ok?l:s}function H(t,e){return M.validateTemporalBucketFormatApplicability(t,e).ok?t:l}exports.AUTOMATIC_TEMPORAL_BUCKET_FORMAT=l;exports.getTemporalBucketAuthoringOptions=_;exports.getTemporalBucketAuthoringSelection=A;exports.previewTemporalBucketAuthoringFormat=k;exports.reconcileTemporalBucketAuthoringFormat=H;exports.resolveTemporalBucketAuthoringFormat=f;