react-semaphor 0.1.516 → 0.1.518

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 (77) hide show
  1. package/dist/brand-studio/index.cjs +1 -1
  2. package/dist/brand-studio/index.js +2 -2
  3. package/dist/briefings/index.cjs +1 -1
  4. package/dist/briefings/index.js +3 -3
  5. package/dist/chunks/{calculated-field-identity-DzJBs2J8.js → calculated-field-identity-Dy_WpDdo.js} +1 -1
  6. package/dist/chunks/{card-config-utils-Cxnq2R6z.js → card-config-utils-CAyjC5Tp.js} +2 -2
  7. package/dist/chunks/{dashboard-briefing-launcher-BCEHJ_eD.js → dashboard-briefing-launcher-D5HGRwtb.js} +7 -7
  8. package/dist/chunks/{dashboard-briefing-launcher-CjZ4aE34.cjs → dashboard-briefing-launcher-RpT4b0d5.cjs} +1 -1
  9. package/dist/chunks/{dashboard-controls-DFfit5KH.js → dashboard-controls-C0Aw74JP.js} +9 -9
  10. package/dist/chunks/{dashboard-controls-f9aJ70Zu.cjs → dashboard-controls-DidqEx0U.cjs} +1 -1
  11. package/dist/chunks/{dashboard-json-DVtcA02f.js → dashboard-json-B5LLO49G.js} +5 -5
  12. package/dist/chunks/{dashboard-json-deqQC-UR.cjs → dashboard-json-rY4lTftA.cjs} +1 -1
  13. package/dist/chunks/{edit-dashboard-visual-lJ6rDH3w.js → edit-dashboard-visual-D3TrgFMg.js} +364 -361
  14. package/dist/chunks/{edit-dashboard-visual-DK6lSC_p.cjs → edit-dashboard-visual-NABO8NBr.cjs} +3 -3
  15. package/dist/chunks/{editor-action-buttons-Bnxxa439.js → editor-action-buttons-BfWg6DdZ.js} +4 -4
  16. package/dist/chunks/{editor-action-buttons-CmDaQbPN.cjs → editor-action-buttons-xQ5aj-0q.cjs} +1 -1
  17. package/dist/chunks/{field-aggregations-Dl2A3rbV.js → field-aggregations-BQjogiI1.js} +1 -1
  18. package/dist/chunks/{index-ylOpKRDu.js → index-B0KwXM6P.js} +117 -116
  19. package/dist/chunks/index-CapO5Uw9.cjs +4 -0
  20. package/dist/chunks/{index-UNKSfi7s.cjs → index-Dgv9vzT0.cjs} +230 -230
  21. package/dist/chunks/{index-BVVl2JDK.js → index-DqTelnri.js} +27499 -27198
  22. package/dist/chunks/{matrix-control-sources-KbZe1gj_.js → matrix-control-sources-B1K7x0SL.js} +2 -2
  23. package/dist/chunks/matrix-formatter-Qk8xsR05.cjs +1 -0
  24. package/dist/chunks/{matrix-formatter-CCXNRt3s.js → matrix-formatter-WBgtebUT.js} +8 -8
  25. package/dist/chunks/numeric-presentation-VhMUHfrJ.js +537 -0
  26. package/dist/chunks/numeric-presentation-mY6wJMdB.cjs +1 -0
  27. package/dist/chunks/{pivot-header-presentation-BSZhB1g-.js → pivot-header-presentation-CGtudHo7.js} +4 -4
  28. package/dist/chunks/{pivot-header-presentation-EoUS5ze5.cjs → pivot-header-presentation-DV2aBB6p.cjs} +2 -2
  29. package/dist/chunks/{pivot-result-lifecycle-kRhiJkzg.js → pivot-result-lifecycle-BFO354lk.js} +7 -7
  30. package/dist/chunks/pivot-result-lifecycle-OXAgoIYm.cjs +1 -0
  31. package/dist/chunks/raw-temporal-7bFbXd2a.js +930 -0
  32. package/dist/chunks/raw-temporal-CYdOOyR5.cjs +1 -0
  33. package/dist/chunks/{report-preferences-dialog-CHXPEl7v.js → report-preferences-dialog-BzxqfcF8.js} +3 -3
  34. package/dist/chunks/{report-preferences-dialog-Cto0vDwI.cjs → report-preferences-dialog-DLnhOXXg.cjs} +1 -1
  35. package/dist/chunks/{semantic-format-DwqGYx4V.js → semantic-format-Baqp8kD_.js} +1 -1
  36. package/dist/chunks/semantic-format-Bd7HmLG_.cjs +1 -0
  37. package/dist/chunks/{switch-DNbWXEOP.cjs → switch-C0520nRt.cjs} +24 -24
  38. package/dist/chunks/{switch-DNv-hVmt.js → switch-evlnTA4t.js} +3180 -3092
  39. package/dist/chunks/{temporal-bucket-DlFuhCnT.js → temporal-bucket-PcLFSYWX.js} +6 -6
  40. package/dist/chunks/temporal-input-presentation-2RJrvmYL.js +222 -0
  41. package/dist/chunks/temporal-input-presentation-BIOSVWCL.cjs +1 -0
  42. package/dist/dashboard/index.cjs +1 -1
  43. package/dist/dashboard/index.js +1 -1
  44. package/dist/dashboard-authoring/index.js +6 -6
  45. package/dist/data-app-builder/index.cjs +1 -1
  46. package/dist/data-app-builder/index.js +2 -2
  47. package/dist/data-app-sdk/index.cjs +1 -1
  48. package/dist/data-app-sdk/index.js +1 -1
  49. package/dist/format-utils/index.cjs +3 -3
  50. package/dist/format-utils/index.js +77 -73
  51. package/dist/index.cjs +1 -1
  52. package/dist/index.js +10 -10
  53. package/dist/style.css +1 -1
  54. package/dist/surfboard/index.cjs +1 -1
  55. package/dist/surfboard/index.js +2 -2
  56. package/dist/types/components/editor/editor-main/dashboard-variable-node.d.ts +7 -3
  57. package/dist/types/components/editor/editor-main/text-card-rich-editor.d.ts +4 -1
  58. package/dist/types/lib/charts/chart-availability.d.ts +6 -0
  59. package/dist/types/lib/dashboard-inputs/dashboard-input-display.d.ts +11 -0
  60. package/dist/types/lib/dashboard-inputs/dashboard-input-text.d.ts +2 -1
  61. package/dist/types/lib/dashboard-inputs/text-card-rich-content.d.ts +3 -2
  62. package/dist/types/lib/dashboard-inputs/text-variable-options.d.ts +5 -4
  63. package/dist/types/lib/document/document-variables.d.ts +8 -4
  64. package/dist/types/lib/text-variables/temporal-input-text.d.ts +28 -0
  65. package/dist/types/lib/text-variables/text-variable-types.d.ts +17 -1
  66. package/dist/types/lib/types/common-types.d.ts +11 -1
  67. package/dist/types/shared/format-utils/index.d.ts +1 -0
  68. package/dist/types/shared/format-utils/temporal-input-presentation.d.ts +46 -0
  69. package/package.json +1 -1
  70. package/dist/chunks/index-C8w91oj4.js +0 -328
  71. package/dist/chunks/index-Cw2ypaFl.cjs +0 -1
  72. package/dist/chunks/index-DfqMtR9S.cjs +0 -4
  73. package/dist/chunks/matrix-formatter-BJTO8ky9.cjs +0 -1
  74. package/dist/chunks/pivot-result-lifecycle-gl9cBfB-.cjs +0 -1
  75. package/dist/chunks/raw-temporal-BqOfk-xN.js +0 -1137
  76. package/dist/chunks/raw-temporal-eJXecCyJ.cjs +0 -1
  77. package/dist/chunks/semantic-format-mVI32OJH.cjs +0 -1
@@ -0,0 +1,930 @@
1
+ var B = Object.defineProperty;
2
+ var ee = (e, t, r) => t in e ? B(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var b = (e, t, r) => ee(e, typeof t != "symbol" ? t + "" : t, r);
4
+ import { i as g } from "./validators-CsdOtZI6.js";
5
+ import { p as te } from "./raw-temporal-contract-BQZIJ1fn.js";
6
+ import { canonicalizeSupportedLocale as ne } from "../value-format-preferences/index.js";
7
+ import { i as h, t as U } from "./temporal-bucket-PcLFSYWX.js";
8
+ function re(e) {
9
+ if (!e || typeof e != "object") return !1;
10
+ const t = e.type;
11
+ return t === "number" || t === "currency" || t === "percent" || t === "scientific";
12
+ }
13
+ function We(e) {
14
+ return re(e) || !!e && typeof e == "object" && e.type === "duration";
15
+ }
16
+ function ae(e, t) {
17
+ const r = ue(t);
18
+ return "formatToParts" in r ? se(r, e) : ie(r, e);
19
+ }
20
+ const oe = {
21
+ year: 0,
22
+ month: 1,
23
+ day: 2,
24
+ hour: 3,
25
+ minute: 4,
26
+ second: 5
27
+ };
28
+ function se(e, t) {
29
+ try {
30
+ const r = e.formatToParts(t), n = [];
31
+ for (let o = 0; o < r.length; o++) {
32
+ const a = oe[r[o].type];
33
+ a !== void 0 && (n[a] = parseInt(r[o].value, 10));
34
+ }
35
+ return n;
36
+ } catch (r) {
37
+ if (r instanceof RangeError)
38
+ return [NaN];
39
+ throw r;
40
+ }
41
+ }
42
+ function ie(e, t) {
43
+ const r = e.format(t), n = /(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(r);
44
+ return [
45
+ parseInt(n[3], 10),
46
+ parseInt(n[1], 10),
47
+ parseInt(n[2], 10),
48
+ parseInt(n[4], 10),
49
+ parseInt(n[5], 10),
50
+ parseInt(n[6], 10)
51
+ ];
52
+ }
53
+ const D = {}, k = new Intl.DateTimeFormat("en-US", {
54
+ hourCycle: "h23",
55
+ timeZone: "America/New_York",
56
+ year: "numeric",
57
+ month: "2-digit",
58
+ day: "2-digit",
59
+ hour: "2-digit",
60
+ minute: "2-digit",
61
+ second: "2-digit"
62
+ }).format(/* @__PURE__ */ new Date("2014-06-25T04:00:00.123Z")), ce = k === "06/25/2014, 00:00:00" || k === "‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00";
63
+ function ue(e) {
64
+ return D[e] || (D[e] = ce ? new Intl.DateTimeFormat("en-US", {
65
+ hourCycle: "h23",
66
+ timeZone: e,
67
+ year: "numeric",
68
+ month: "numeric",
69
+ day: "2-digit",
70
+ hour: "2-digit",
71
+ minute: "2-digit",
72
+ second: "2-digit"
73
+ }) : new Intl.DateTimeFormat("en-US", {
74
+ hour12: !1,
75
+ timeZone: e,
76
+ year: "numeric",
77
+ month: "numeric",
78
+ day: "2-digit",
79
+ hour: "2-digit",
80
+ minute: "2-digit",
81
+ second: "2-digit"
82
+ })), D[e];
83
+ }
84
+ function Y(e, t, r, n, o, a, s) {
85
+ const i = /* @__PURE__ */ new Date(0);
86
+ return i.setUTCFullYear(e, t, r), i.setUTCHours(n, o, a, s), i;
87
+ }
88
+ const F = 36e5, le = 6e4, N = {
89
+ timezoneZ: /^(Z)$/,
90
+ timezoneHH: /^([+-]\d{2})$/,
91
+ timezoneHHMM: /^([+-])(\d{2}):?(\d{2})$/
92
+ };
93
+ function P(e, t, r) {
94
+ if (!e)
95
+ return 0;
96
+ let n = N.timezoneZ.exec(e);
97
+ if (n)
98
+ return 0;
99
+ let o, a;
100
+ if (n = N.timezoneHH.exec(e), n)
101
+ return o = parseInt(n[1], 10), A(o) ? -(o * F) : NaN;
102
+ if (n = N.timezoneHHMM.exec(e), n) {
103
+ o = parseInt(n[2], 10);
104
+ const s = parseInt(n[3], 10);
105
+ return A(o, s) ? (a = Math.abs(o) * F + s * le, n[1] === "+" ? -a : a) : NaN;
106
+ }
107
+ if (de(e)) {
108
+ t = new Date(t || Date.now());
109
+ const s = r ? t : me(t), i = I(s, e);
110
+ return -(r ? i : fe(t, i, e));
111
+ }
112
+ return NaN;
113
+ }
114
+ function me(e) {
115
+ return Y(e.getFullYear(), e.getMonth(), e.getDate(), e.getHours(), e.getMinutes(), e.getSeconds(), e.getMilliseconds());
116
+ }
117
+ function I(e, t) {
118
+ const r = ae(e, t), n = Y(r[0], r[1] - 1, r[2], r[3] % 24, r[4], r[5], 0).getTime();
119
+ let o = e.getTime();
120
+ const a = o % 1e3;
121
+ return o -= a >= 0 ? a : 1e3 + a, n - o;
122
+ }
123
+ function fe(e, t, r) {
124
+ let o = e.getTime() - t;
125
+ const a = I(new Date(o), r);
126
+ if (t === a)
127
+ return t;
128
+ o -= a - t;
129
+ const s = I(new Date(o), r);
130
+ return a === s ? a : Math.max(a, s);
131
+ }
132
+ function A(e, t) {
133
+ return -23 <= e && e <= 23 && (t == null || 0 <= t && t <= 59);
134
+ }
135
+ const C = {};
136
+ function de(e) {
137
+ if (C[e])
138
+ return !0;
139
+ try {
140
+ return new Intl.DateTimeFormat(void 0, { timeZone: e }), C[e] = !0, !0;
141
+ } catch {
142
+ return !1;
143
+ }
144
+ }
145
+ function O(e) {
146
+ const t = new Date(Date.UTC(e.getFullYear(), e.getMonth(), e.getDate(), e.getHours(), e.getMinutes(), e.getSeconds(), e.getMilliseconds()));
147
+ return t.setUTCFullYear(e.getFullYear()), +e - +t;
148
+ }
149
+ const Z = /(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/, _ = 36e5, E = 6e4, pe = 2, d = {
150
+ dateTimePattern: /^([0-9W+-]+)(T| )(.*)/,
151
+ datePattern: /^([0-9W+-]+)(.*)/,
152
+ // year tokens
153
+ YY: /^(\d{2})$/,
154
+ YYY: [
155
+ /^([+-]\d{2})$/,
156
+ // 0 additional digits
157
+ /^([+-]\d{3})$/,
158
+ // 1 additional digit
159
+ /^([+-]\d{4})$/
160
+ // 2 additional digits
161
+ ],
162
+ YYYY: /^(\d{4})/,
163
+ YYYYY: [
164
+ /^([+-]\d{4})/,
165
+ // 0 additional digits
166
+ /^([+-]\d{5})/,
167
+ // 1 additional digit
168
+ /^([+-]\d{6})/
169
+ // 2 additional digits
170
+ ],
171
+ // date tokens
172
+ MM: /^-(\d{2})$/,
173
+ DDD: /^-?(\d{3})$/,
174
+ MMDD: /^-?(\d{2})-?(\d{2})$/,
175
+ Www: /^-?W(\d{2})$/,
176
+ WwwD: /^-?W(\d{2})-?(\d{1})$/,
177
+ HH: /^(\d{2}([.,]\d*)?)$/,
178
+ HHMM: /^(\d{2}):?(\d{2}([.,]\d*)?)$/,
179
+ HHMMSS: /^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,
180
+ // time zone tokens (to identify the presence of a tz)
181
+ timeZone: Z
182
+ };
183
+ function $(e, t = {}) {
184
+ if (arguments.length < 1)
185
+ throw new TypeError("1 argument required, but only " + arguments.length + " present");
186
+ if (e === null)
187
+ return /* @__PURE__ */ new Date(NaN);
188
+ const r = t.additionalDigits == null ? pe : Number(t.additionalDigits);
189
+ if (r !== 2 && r !== 1 && r !== 0)
190
+ throw new RangeError("additionalDigits must be 0, 1 or 2");
191
+ if (e instanceof Date || typeof e == "object" && Object.prototype.toString.call(e) === "[object Date]")
192
+ return new Date(e.getTime());
193
+ if (typeof e == "number" || Object.prototype.toString.call(e) === "[object Number]")
194
+ return new Date(e);
195
+ if (Object.prototype.toString.call(e) !== "[object String]")
196
+ return /* @__PURE__ */ new Date(NaN);
197
+ const n = Te(e), { year: o, restDateString: a } = he(n.date, r), s = ye(a, o);
198
+ if (s === null || isNaN(s.getTime()))
199
+ return /* @__PURE__ */ new Date(NaN);
200
+ if (s) {
201
+ const i = s.getTime();
202
+ let m = 0, u;
203
+ if (n.time && (m = we(n.time), m === null || isNaN(m)))
204
+ return /* @__PURE__ */ new Date(NaN);
205
+ if (n.timeZone || t.timeZone) {
206
+ if (u = P(n.timeZone || t.timeZone, new Date(i + m)), isNaN(u))
207
+ return /* @__PURE__ */ new Date(NaN);
208
+ } else
209
+ u = O(new Date(i + m)), u = O(new Date(i + m + u));
210
+ return new Date(i + m + u);
211
+ } else
212
+ return /* @__PURE__ */ new Date(NaN);
213
+ }
214
+ function Te(e) {
215
+ const t = {};
216
+ let r = d.dateTimePattern.exec(e), n;
217
+ if (r ? (t.date = r[1], n = r[3]) : (r = d.datePattern.exec(e), r ? (t.date = r[1], n = r[2]) : (t.date = null, n = e)), n) {
218
+ const o = d.timeZone.exec(n);
219
+ o ? (t.time = n.replace(o[1], ""), t.timeZone = o[1].trim()) : t.time = n;
220
+ }
221
+ return t;
222
+ }
223
+ function he(e, t) {
224
+ if (e) {
225
+ const r = d.YYY[t], n = d.YYYYY[t];
226
+ let o = d.YYYY.exec(e) || n.exec(e);
227
+ if (o) {
228
+ const a = o[1];
229
+ return {
230
+ year: parseInt(a, 10),
231
+ restDateString: e.slice(a.length)
232
+ };
233
+ }
234
+ if (o = d.YY.exec(e) || r.exec(e), o) {
235
+ const a = o[1];
236
+ return {
237
+ year: parseInt(a, 10) * 100,
238
+ restDateString: e.slice(a.length)
239
+ };
240
+ }
241
+ }
242
+ return {
243
+ year: null
244
+ };
245
+ }
246
+ function ye(e, t) {
247
+ if (t === null)
248
+ return null;
249
+ let r, n, o;
250
+ if (!e || !e.length)
251
+ return r = /* @__PURE__ */ new Date(0), r.setUTCFullYear(t), r;
252
+ let a = d.MM.exec(e);
253
+ if (a)
254
+ return r = /* @__PURE__ */ new Date(0), n = parseInt(a[1], 10) - 1, H(t, n) ? (r.setUTCFullYear(t, n), r) : /* @__PURE__ */ new Date(NaN);
255
+ if (a = d.DDD.exec(e), a) {
256
+ r = /* @__PURE__ */ new Date(0);
257
+ const s = parseInt(a[1], 10);
258
+ return De(t, s) ? (r.setUTCFullYear(t, 0, s), r) : /* @__PURE__ */ new Date(NaN);
259
+ }
260
+ if (a = d.MMDD.exec(e), a) {
261
+ r = /* @__PURE__ */ new Date(0), n = parseInt(a[1], 10) - 1;
262
+ const s = parseInt(a[2], 10);
263
+ return H(t, n, s) ? (r.setUTCFullYear(t, n, s), r) : /* @__PURE__ */ new Date(NaN);
264
+ }
265
+ if (a = d.Www.exec(e), a)
266
+ return o = parseInt(a[1], 10) - 1, L(o) ? x(t, o) : /* @__PURE__ */ new Date(NaN);
267
+ if (a = d.WwwD.exec(e), a) {
268
+ o = parseInt(a[1], 10) - 1;
269
+ const s = parseInt(a[2], 10) - 1;
270
+ return L(o, s) ? x(t, o, s) : /* @__PURE__ */ new Date(NaN);
271
+ }
272
+ return null;
273
+ }
274
+ function we(e) {
275
+ let t, r, n = d.HH.exec(e);
276
+ if (n)
277
+ return t = parseFloat(n[1].replace(",", ".")), v(t) ? t % 24 * _ : NaN;
278
+ if (n = d.HHMM.exec(e), n)
279
+ return t = parseInt(n[1], 10), r = parseFloat(n[2].replace(",", ".")), v(t, r) ? t % 24 * _ + r * E : NaN;
280
+ if (n = d.HHMMSS.exec(e), n) {
281
+ t = parseInt(n[1], 10), r = parseInt(n[2], 10);
282
+ const o = parseFloat(n[3].replace(",", "."));
283
+ return v(t, r, o) ? t % 24 * _ + r * E + o * 1e3 : NaN;
284
+ }
285
+ return null;
286
+ }
287
+ function x(e, t, r) {
288
+ t = t || 0, r = r || 0;
289
+ const n = /* @__PURE__ */ new Date(0);
290
+ n.setUTCFullYear(e, 0, 4);
291
+ const o = n.getUTCDay() || 7, a = t * 7 + r + 1 - o;
292
+ return n.setUTCDate(n.getUTCDate() + a), n;
293
+ }
294
+ const Se = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], ge = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
295
+ function K(e) {
296
+ return e % 400 === 0 || e % 4 === 0 && e % 100 !== 0;
297
+ }
298
+ function H(e, t, r) {
299
+ if (t < 0 || t > 11)
300
+ return !1;
301
+ if (r != null) {
302
+ if (r < 1)
303
+ return !1;
304
+ const n = K(e);
305
+ if (n && r > ge[t] || !n && r > Se[t])
306
+ return !1;
307
+ }
308
+ return !0;
309
+ }
310
+ function De(e, t) {
311
+ if (t < 1)
312
+ return !1;
313
+ const r = K(e);
314
+ return !(r && t > 366 || !r && t > 365);
315
+ }
316
+ function L(e, t) {
317
+ return !(e < 0 || e > 52 || t != null && (t < 0 || t > 6));
318
+ }
319
+ function v(e, t, r) {
320
+ return !(e < 0 || e >= 25 || t != null && (t < 0 || t >= 60) || r != null && (r < 0 || r >= 60));
321
+ }
322
+ function Ne(e, t, r) {
323
+ if (typeof e == "string" && !e.match(Z))
324
+ return $(e, { ...r, timeZone: t });
325
+ e = $(e, r);
326
+ const n = Y(e.getFullYear(), e.getMonth(), e.getDate(), e.getHours(), e.getMinutes(), e.getSeconds(), e.getMilliseconds()).getTime(), o = P(t, new Date(n));
327
+ return new Date(n + o);
328
+ }
329
+ class y extends Error {
330
+ constructor(r, n) {
331
+ super(n);
332
+ b(this, "code");
333
+ this.name = "RawTemporalFormatContractError", this.code = r;
334
+ }
335
+ }
336
+ const _e = [
337
+ "SSSSSSSSS",
338
+ "SSSSSSSS",
339
+ "SSSSSSS",
340
+ "SSSSSS",
341
+ "SSSSS",
342
+ "SSSS",
343
+ "SSS",
344
+ "SS",
345
+ "S"
346
+ ], j = /^(\d{4})-(\d{2})-(\d{2})$/, W = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,9}))?)?$/, q = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,9}))?)?(Z|[+-]\d{2}:\d{2})$/, ve = [
347
+ "yyyy",
348
+ "MMMM",
349
+ "LLLL",
350
+ "zzz",
351
+ "XXX",
352
+ "MMM",
353
+ "LLL",
354
+ "yy",
355
+ "MM",
356
+ "dd",
357
+ "HH",
358
+ "hh",
359
+ "mm",
360
+ "ss",
361
+ "M",
362
+ "d",
363
+ "H",
364
+ "h",
365
+ "m",
366
+ "s",
367
+ "a"
368
+ ], ze = /* @__PURE__ */ new Set([
369
+ "HH",
370
+ "H",
371
+ "hh",
372
+ "h",
373
+ "mm",
374
+ "m",
375
+ "ss",
376
+ "s",
377
+ "a",
378
+ ..._e
379
+ ]), Ie = /* @__PURE__ */ new Set(["zzz", "XXX"]), z = /* @__PURE__ */ new Set(["short", "medium", "long"]);
380
+ function T(e, t) {
381
+ return Object.keys(e).length === t.length && t.every((n) => n in e);
382
+ }
383
+ function c(e) {
384
+ throw new y(
385
+ "invalid_raw_temporal_format",
386
+ e
387
+ );
388
+ }
389
+ function X(e) {
390
+ if (!e || e.trim() !== e || e.length > 256)
391
+ return c(
392
+ "date_fns patterns must be non-empty, trimmed, and at most 256 characters."
393
+ );
394
+ const t = [], r = (o) => {
395
+ const a = t[t.length - 1];
396
+ (a == null ? void 0 : a.kind) === "literal" ? a.value += o : t.push({ kind: "literal", value: o });
397
+ };
398
+ let n = 0;
399
+ for (; n < e.length; ) {
400
+ if (e[n] === "'") {
401
+ if (e[n + 1] === "'") {
402
+ r("'"), n += 2;
403
+ continue;
404
+ }
405
+ let s = "", i = !1;
406
+ for (n += 1; n < e.length; ) {
407
+ if (e[n] === "'") {
408
+ if (e[n + 1] === "'") {
409
+ s += "'", n += 2;
410
+ continue;
411
+ }
412
+ i = !0, n += 1;
413
+ break;
414
+ }
415
+ s += e[n], n += 1;
416
+ }
417
+ if (!i)
418
+ return c("date_fns pattern has an unclosed quote.");
419
+ r(s);
420
+ continue;
421
+ }
422
+ if (e[n] === "S") {
423
+ let s = n + 1;
424
+ for (; e[s] === "S"; ) s += 1;
425
+ const i = e.slice(n, s);
426
+ if (i.length > 9)
427
+ return c(
428
+ "date_fns fractional-second tokens support at most nine digits."
429
+ );
430
+ t.push({
431
+ kind: "token",
432
+ value: i
433
+ }), n = s;
434
+ continue;
435
+ }
436
+ const o = ve.find(
437
+ (s) => e.startsWith(s, n)
438
+ );
439
+ if (o) {
440
+ t.push({ kind: "token", value: o }), n += o.length;
441
+ continue;
442
+ }
443
+ const a = e[n];
444
+ if (/[A-Za-z]/.test(a))
445
+ return c(
446
+ `Unsupported date_fns pattern token beginning at "${e.slice(n)}".`
447
+ );
448
+ r(a), n += 1;
449
+ }
450
+ return t.some((o) => o.kind === "token") ? t : c("date_fns patterns must contain at least one token.");
451
+ }
452
+ function V(e, t) {
453
+ if (e === "semaphor_tokens") {
454
+ const r = U(t);
455
+ r.ok || c(r.message);
456
+ return;
457
+ }
458
+ X(t);
459
+ }
460
+ function Me(e) {
461
+ return !h(e) || !T(e, ["dateStyle", "dateTime"]) ? c("Automatic raw temporal styles are incomplete.") : z.has(e.dateStyle) ? !h(e.dateTime) || !T(e.dateTime, ["dateStyle", "timeStyle"]) || !z.has(e.dateTime.dateStyle) || !z.has(e.dateTime.timeStyle) ? c(
462
+ "Automatic dateTime styles are incomplete or invalid."
463
+ ) : {
464
+ dateStyle: e.dateStyle,
465
+ dateTime: {
466
+ dateStyle: e.dateTime.dateStyle,
467
+ timeStyle: e.dateTime.timeStyle
468
+ }
469
+ } : c("Automatic dateStyle is invalid.");
470
+ }
471
+ function G(e) {
472
+ const t = ["type", "locale", "calendarTimezone", "presentation"], r = [...t, "sourceTimezone"];
473
+ if (!h(e) || !T(e, t) && !T(e, r) || e.type !== "raw_temporal")
474
+ return c("Resolved raw temporal format has an invalid shape.");
475
+ const n = ne(e.locale);
476
+ return n ? typeof e.calendarTimezone != "string" || !g(e.calendarTimezone) ? c(
477
+ "Raw temporal calendarTimezone must be a valid IANA timezone."
478
+ ) : e.sourceTimezone !== void 0 && (typeof e.sourceTimezone != "string" || !g(e.sourceTimezone)) ? c(
479
+ "Raw temporal sourceTimezone must be a valid IANA timezone."
480
+ ) : h(e.presentation) ? e.presentation.mode === "auto" ? T(e.presentation, ["mode", "styles"]) ? {
481
+ type: "raw_temporal",
482
+ locale: n,
483
+ calendarTimezone: e.calendarTimezone,
484
+ ...e.sourceTimezone ? { sourceTimezone: e.sourceTimezone } : {},
485
+ presentation: {
486
+ mode: "auto",
487
+ styles: Me(e.presentation.styles)
488
+ }
489
+ } : c(
490
+ "Automatic raw temporal presentation has unknown fields."
491
+ ) : e.presentation.mode !== "pattern" || !T(e.presentation, ["mode", "dialect", "pattern"]) || e.presentation.dialect !== "semaphor_tokens" && e.presentation.dialect !== "date_fns" || typeof e.presentation.pattern != "string" ? c(
492
+ "Pattern raw temporal presentation has an invalid shape."
493
+ ) : (V(e.presentation.dialect, e.presentation.pattern), {
494
+ type: "raw_temporal",
495
+ locale: n,
496
+ calendarTimezone: e.calendarTimezone,
497
+ ...e.sourceTimezone ? { sourceTimezone: e.sourceTimezone } : {},
498
+ presentation: {
499
+ mode: "pattern",
500
+ dialect: e.presentation.dialect,
501
+ pattern: e.presentation.pattern
502
+ }
503
+ }) : c("Raw temporal presentation must be an object.") : c("Raw temporal locale is invalid or unsupported.");
504
+ }
505
+ function qe(e) {
506
+ var i, m, u;
507
+ if (e.format) {
508
+ if (!h(e.format))
509
+ return c(
510
+ "Authored raw temporal format has an invalid shape."
511
+ );
512
+ const l = Object.keys(e.format);
513
+ if (!l.includes("type") || !l.includes("presentation") || l.some(
514
+ (p) => p !== "type" && p !== "presentation" && p !== "timezone" && p !== "sourceTimezone"
515
+ ) || e.format.type !== "raw_temporal" || !h(e.format.presentation))
516
+ return c(
517
+ "Authored raw temporal format has an invalid shape."
518
+ );
519
+ const f = e.format.presentation;
520
+ if (f.mode === "auto") {
521
+ if (!T(f, ["mode"]))
522
+ return c(
523
+ "Automatic authored raw temporal format has unknown fields."
524
+ );
525
+ } else {
526
+ if (f.mode !== "pattern" || !T(f, ["mode", "dialect", "pattern"]) || f.dialect !== "semaphor_tokens" && f.dialect !== "date_fns" || typeof f.pattern != "string")
527
+ return c(
528
+ "Authored raw temporal pattern has an invalid shape."
529
+ );
530
+ V(f.dialect, f.pattern);
531
+ }
532
+ }
533
+ const t = (i = e.format) == null ? void 0 : i.timezone, r = (m = e.format) == null ? void 0 : m.sourceTimezone, n = t && t !== "auto" ? t : e.calendar.tz, o = r && r !== "auto" ? r === "local" ? Intl.DateTimeFormat().resolvedOptions().timeZone : r : void 0;
534
+ if (t !== void 0 && t !== "auto" && !g(n) || o !== void 0 && !g(o))
535
+ return c("Authored raw temporal timezone is invalid.");
536
+ const a = ((u = e.format) == null ? void 0 : u.presentation) ?? { mode: "auto" }, s = {
537
+ type: "raw_temporal",
538
+ locale: e.preferences.locale,
539
+ calendarTimezone: n,
540
+ ...o ? { sourceTimezone: o } : {},
541
+ presentation: a.mode === "pattern" ? { ...a } : {
542
+ mode: "auto",
543
+ styles: {
544
+ dateStyle: e.preferences.dateStyle,
545
+ dateTime: { ...e.preferences.dateTime }
546
+ }
547
+ }
548
+ };
549
+ return G(s);
550
+ }
551
+ function Ye(e) {
552
+ if (j.test(e)) return "date";
553
+ if (q.test(e)) return "instant";
554
+ if (W.test(e)) return "wall_datetime";
555
+ }
556
+ function Xe(e) {
557
+ const t = /* @__PURE__ */ new Set();
558
+ let r = !1;
559
+ for (const n of e.values) {
560
+ if (n === null) continue;
561
+ r = !0;
562
+ const o = Ye(n);
563
+ o && t.add(o);
564
+ }
565
+ if (!r) return { status: "empty" };
566
+ if (t.size === 0) return { status: "invalid_only" };
567
+ if (t.size > 1)
568
+ throw new y(
569
+ "mixed_sql_temporal_semantics",
570
+ `Declared SQL temporal column "${e.columnKey}" mixes date, wall-datetime, or instant semantics. Normalize it to one kind.`
571
+ );
572
+ return {
573
+ status: "classified",
574
+ metadata: {
575
+ kind: "raw_temporal",
576
+ valueKind: [...t][0]
577
+ }
578
+ };
579
+ }
580
+ function Ve(e) {
581
+ return {
582
+ version: 1,
583
+ columns: Object.fromEntries(
584
+ [...e].map(([t, r]) => [
585
+ t,
586
+ r.status === "classified" ? r.metadata.valueKind : r.status
587
+ ])
588
+ )
589
+ };
590
+ }
591
+ function be(e) {
592
+ if (!h(e) || e.version !== 1 || !h(e.columns) || Object.keys(e).some((n) => n !== "version" && n !== "columns"))
593
+ throw new y(
594
+ "invalid_raw_temporal_format",
595
+ "Raw temporal chunk classification evidence is malformed."
596
+ );
597
+ const t = {}, r = /* @__PURE__ */ new Set([
598
+ "empty",
599
+ "invalid_only",
600
+ "date",
601
+ "wall_datetime",
602
+ "instant"
603
+ ]);
604
+ for (const [n, o] of Object.entries(e.columns)) {
605
+ if (!n.trim() || !r.has(o))
606
+ throw new y(
607
+ "invalid_raw_temporal_format",
608
+ "Raw temporal chunk classification evidence contains an invalid column or status."
609
+ );
610
+ t[n] = o;
611
+ }
612
+ return { version: 1, columns: t };
613
+ }
614
+ function Ge(e) {
615
+ if (e.length === 0) return;
616
+ const t = e.map(be), r = Object.keys(t[0].columns).sort();
617
+ for (let n = 1; n < t.length; n += 1) {
618
+ const o = Object.keys(t[n].columns).sort();
619
+ if (o.length !== r.length || o.some((a, s) => a !== r[s]))
620
+ throw new y(
621
+ "invalid_raw_temporal_format",
622
+ "Raw temporal chunk classification evidence has inconsistent columns."
623
+ );
624
+ }
625
+ for (const n of r)
626
+ if (new Set(
627
+ t.map((a) => a.columns[n]).filter(
628
+ (a) => a !== "empty" && a !== "invalid_only"
629
+ )
630
+ ).size > 1)
631
+ throw new y(
632
+ "mixed_sql_temporal_semantics",
633
+ `Declared SQL temporal column "${n}" has inconsistent semantics across export chunks. Normalize it to one kind.`
634
+ );
635
+ }
636
+ function ke(e) {
637
+ return e % 4 === 0 && (e % 100 !== 0 || e % 400 === 0);
638
+ }
639
+ function Fe(e, t) {
640
+ return t === 2 ? ke(e) ? 29 : 28 : [4, 6, 9, 11].includes(t) ? 30 : 31;
641
+ }
642
+ function Ae(e) {
643
+ return e.year >= 1 && e.year <= 9999 && e.month >= 1 && e.month <= 12 && e.day >= 1 && e.day <= Fe(e.year, e.month) && e.hour >= 0 && e.hour <= 23 && e.minute >= 0 && e.minute <= 59 && e.second >= 0 && e.second <= 59;
644
+ }
645
+ function Ce(e) {
646
+ return {
647
+ year: Number(e[1]),
648
+ month: Number(e[2]),
649
+ day: Number(e[3]),
650
+ hour: Number(e[4] ?? 0),
651
+ minute: Number(e[5] ?? 0),
652
+ second: Number(e[6] ?? 0),
653
+ fraction: e[7] ?? ""
654
+ };
655
+ }
656
+ function Oe(e, t) {
657
+ const r = t === "date" ? e.match(j) : t === "wall_datetime" ? e.match(W) : e.match(q);
658
+ if (!r) return { status: "invalid_shape" };
659
+ const n = Ce(r);
660
+ if (!Ae(n)) return { status: "out_of_range" };
661
+ if (t === "instant") {
662
+ const o = r[8];
663
+ if (o && o !== "Z") {
664
+ const [s, i] = o.slice(1).split(":").map(Number);
665
+ if (s > 23 || i > 59) return { status: "out_of_range" };
666
+ }
667
+ const a = new Date(e.replace(" ", "T"));
668
+ return Number.isNaN(a.getTime()) ? { status: "out_of_range" } : { status: "valid", fields: n, instant: a };
669
+ }
670
+ return { status: "valid", fields: n };
671
+ }
672
+ function M(e) {
673
+ const t = /* @__PURE__ */ new Date(0);
674
+ return t.setUTCFullYear(e.year, e.month - 1, e.day), t.setUTCHours(e.hour, e.minute, e.second, 0), t;
675
+ }
676
+ function J(e, t) {
677
+ const r = e.fraction ? `.${e.fraction.padEnd(3, "0").slice(0, 3)}` : "";
678
+ return Ne(
679
+ `${String(e.year).padStart(4, "0")}-${String(e.month).padStart(2, "0")}-${String(e.day).padStart(2, "0")}T${String(e.hour).padStart(2, "0")}:${String(e.minute).padStart(2, "0")}:${String(e.second).padStart(2, "0")}${r}`,
680
+ t
681
+ );
682
+ }
683
+ function Ee(e, t) {
684
+ const r = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
685
+ let o, a, s, i;
686
+ return {
687
+ number(m, u = 1) {
688
+ let l = r.get(u);
689
+ return l || (l = new Intl.NumberFormat(e, {
690
+ useGrouping: !1,
691
+ minimumIntegerDigits: u,
692
+ maximumFractionDigits: 0
693
+ }), r.set(u, l)), l.format(m);
694
+ },
695
+ month(m, u, l) {
696
+ var w;
697
+ const f = `${u}:${l ? "standalone" : "contextual"}`;
698
+ let p = n.get(f);
699
+ if (!p) {
700
+ const S = {
701
+ calendar: "gregory",
702
+ timeZone: "UTC",
703
+ month: u
704
+ };
705
+ l || (S.day = "numeric"), p = new Intl.DateTimeFormat(e, S), n.set(f, p);
706
+ }
707
+ return ((w = p.formatToParts(m).find((S) => S.type === "month")) == null ? void 0 : w.value) ?? "";
708
+ },
709
+ dayPeriod(m) {
710
+ var u;
711
+ return o ?? (o = new Intl.DateTimeFormat(e, {
712
+ calendar: "gregory",
713
+ timeZone: "UTC",
714
+ hour: "numeric",
715
+ hour12: !0
716
+ })), ((u = o.formatToParts(m).find((l) => l.type === "dayPeriod")) == null ? void 0 : u.value) ?? "";
717
+ },
718
+ instantFields(m) {
719
+ a ?? (a = new Intl.DateTimeFormat("en-CA", {
720
+ calendar: "gregory",
721
+ numberingSystem: "latn",
722
+ timeZone: t,
723
+ year: "numeric",
724
+ month: "2-digit",
725
+ day: "2-digit",
726
+ hour: "2-digit",
727
+ minute: "2-digit",
728
+ second: "2-digit",
729
+ hourCycle: "h23"
730
+ }));
731
+ const u = a.formatToParts(m), l = (f) => {
732
+ var p;
733
+ return Number((p = u.find((w) => w.type === f)) == null ? void 0 : p.value);
734
+ };
735
+ return {
736
+ year: l("year"),
737
+ month: l("month"),
738
+ day: l("day"),
739
+ hour: l("hour"),
740
+ minute: l("minute"),
741
+ second: l("second"),
742
+ fraction: ""
743
+ };
744
+ },
745
+ timezoneName(m) {
746
+ var u;
747
+ return s ?? (s = new Intl.DateTimeFormat(e, {
748
+ calendar: "gregory",
749
+ timeZone: t,
750
+ timeZoneName: "short"
751
+ })), ((u = s.formatToParts(m).find((l) => l.type === "timeZoneName")) == null ? void 0 : u.value) ?? "";
752
+ },
753
+ timezoneOffset(m) {
754
+ var f;
755
+ i ?? (i = new Intl.DateTimeFormat("en-US", {
756
+ calendar: "gregory",
757
+ timeZone: t,
758
+ timeZoneName: "longOffset"
759
+ }));
760
+ const u = (f = i.formatToParts(m).find((p) => p.type === "timeZoneName")) == null ? void 0 : f.value;
761
+ if (!u)
762
+ return c("Unable to resolve the instant timezone offset.");
763
+ const l = u.replace(/^GMT/, "");
764
+ return l === "" || /^[+-]00:00$/.test(l) ? "Z" : l;
765
+ }
766
+ };
767
+ }
768
+ function $e(e, t, r, n, o) {
769
+ if (/^S{1,9}$/.test(e)) {
770
+ const a = t.fraction.padEnd(e.length, "0").slice(0, e.length);
771
+ return n.number(Number(a), e.length);
772
+ }
773
+ switch (e) {
774
+ case "YYYY":
775
+ case "yyyy":
776
+ return n.number(t.year, 4);
777
+ case "YY":
778
+ case "yy":
779
+ return n.number(t.year % 100, 2);
780
+ case "MMMM":
781
+ return n.month(r, "long", !1);
782
+ case "LLLL":
783
+ return n.month(r, "long", !0);
784
+ case "MMM":
785
+ return n.month(r, "short", !1);
786
+ case "LLL":
787
+ return n.month(r, "short", !0);
788
+ case "MM":
789
+ return n.number(t.month, 2);
790
+ case "M":
791
+ return n.number(t.month);
792
+ case "DD":
793
+ case "dd":
794
+ return n.number(t.day, 2);
795
+ case "d":
796
+ return n.number(t.day);
797
+ case "HH":
798
+ return n.number(t.hour, 2);
799
+ case "H":
800
+ return n.number(t.hour);
801
+ case "hh":
802
+ return n.number(t.hour % 12 || 12, 2);
803
+ case "h":
804
+ return n.number(t.hour % 12 || 12);
805
+ case "mm":
806
+ return n.number(t.minute, 2);
807
+ case "m":
808
+ return n.number(t.minute);
809
+ case "ss":
810
+ return n.number(t.second, 2);
811
+ case "s":
812
+ return n.number(t.second);
813
+ case "a":
814
+ return n.dayPeriod(r);
815
+ case "zzz":
816
+ return o ? n.timezoneName(o) : c(
817
+ "Timezone pattern tokens require an instant value."
818
+ );
819
+ case "XXX":
820
+ return o ? n.timezoneOffset(o) : c(
821
+ "Timezone pattern tokens require an instant value."
822
+ );
823
+ default:
824
+ return c(
825
+ `Unsupported raw temporal pattern token "${e}".`
826
+ );
827
+ }
828
+ }
829
+ function xe(e, t, r, n) {
830
+ const o = M(t);
831
+ return e.map(
832
+ (a) => a.kind === "literal" ? a.value : $e(a.value, t, o, r, n)
833
+ ).join("");
834
+ }
835
+ function Q(e, t, r) {
836
+ const n = t === "date_fns" ? X(r) : (() => {
837
+ const a = U(r);
838
+ return a.ok ? a.segments : c(a.message);
839
+ })(), o = n.filter((a) => a.kind === "token").map((a) => a.value);
840
+ return e === "date" && o.some((a) => ze.has(a)) ? c("Date patterns cannot contain time tokens.") : e !== "instant" && o.some((a) => Ie.has(a)) ? c("Timezone pattern tokens require an instant value.") : n;
841
+ }
842
+ function Je(e) {
843
+ Q(
844
+ e.valueKind ?? "instant",
845
+ e.dialect,
846
+ e.pattern
847
+ );
848
+ }
849
+ function He(e, t, r, n) {
850
+ const o = Q(
851
+ e.valueKind,
852
+ r,
853
+ n
854
+ ), a = Ee(t.locale, t.calendarTimezone);
855
+ return (s) => {
856
+ const i = e.valueKind === "wall_datetime" && t.sourceTimezone ? J(s.fields, t.sourceTimezone) : void 0, m = e.valueKind === "instant" ? {
857
+ ...a.instantFields(s.instant),
858
+ fraction: s.fields.fraction
859
+ } : i ? {
860
+ ...a.instantFields(i),
861
+ fraction: s.fields.fraction
862
+ } : s.fields;
863
+ return xe(o, m, a, s.instant ?? i);
864
+ };
865
+ }
866
+ function Le(e, t) {
867
+ const r = t.presentation.mode === "auto" ? t.presentation.styles : c("Automatic raw temporal formatting requires styles.");
868
+ if (e.valueKind === "date") {
869
+ const s = new Intl.DateTimeFormat(t.locale, {
870
+ calendar: "gregory",
871
+ timeZone: "UTC",
872
+ dateStyle: r.dateStyle
873
+ });
874
+ return (i) => s.format(M(i.fields));
875
+ }
876
+ const n = e.valueKind === "instant", o = !n && r.dateTime.timeStyle === "long" ? "medium" : r.dateTime.timeStyle, a = new Intl.DateTimeFormat(t.locale, {
877
+ calendar: "gregory",
878
+ timeZone: n || e.valueKind === "wall_datetime" && t.sourceTimezone ? t.calendarTimezone : "UTC",
879
+ dateStyle: r.dateTime.dateStyle,
880
+ timeStyle: o
881
+ });
882
+ return (s) => n ? a.format(s.instant) : e.valueKind === "wall_datetime" && t.sourceTimezone ? a.format(J(s.fields, t.sourceTimezone)) : a.format(M(s.fields));
883
+ }
884
+ function R(e, t, r) {
885
+ return {
886
+ ok: !1,
887
+ text: e,
888
+ diagnostic: {
889
+ code: r,
890
+ message: `Raw temporal ${t.valueKind} value is ${r === "invalid_raw_temporal_value" ? "malformed" : "out of range"}.`
891
+ }
892
+ };
893
+ }
894
+ function Re(e) {
895
+ const t = te(e.metadata), r = G(e.format), n = r.presentation.mode === "auto" ? Le(t, r) : He(
896
+ t,
897
+ r,
898
+ r.presentation.dialect,
899
+ r.presentation.pattern
900
+ );
901
+ return (o) => {
902
+ if (o === null)
903
+ return { ok: !0, text: "", status: "empty" };
904
+ const a = Oe(o, t.valueKind);
905
+ return a.status === "invalid_shape" ? R(o, t, "invalid_raw_temporal_value") : a.status === "out_of_range" ? R(o, t, "out_of_range_raw_temporal_value") : { ok: !0, text: n(a), status: "formatted" };
906
+ };
907
+ }
908
+ function Qe(e) {
909
+ return Re({
910
+ metadata: e.metadata,
911
+ format: e.format
912
+ })(e.value);
913
+ }
914
+ export {
915
+ y as R,
916
+ Qe as a,
917
+ We as b,
918
+ Xe as c,
919
+ Ve as d,
920
+ be as e,
921
+ Ne as f,
922
+ Ge as g,
923
+ Re as h,
924
+ re as i,
925
+ $ as j,
926
+ G as p,
927
+ qe as r,
928
+ P as t,
929
+ Je as v
930
+ };