react-semaphor 0.1.545 → 0.1.546

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 (141) hide show
  1. package/dist/analytics-protocol/index.js +405 -442
  2. package/dist/assistant-context/index.js +1 -1
  3. package/dist/assistant-protocol/index.js +100 -76
  4. package/dist/brand-studio/index.js +4 -4
  5. package/dist/briefings/index.js +6 -6
  6. package/dist/chunks/{add-to-dashboard-BuAqfA2Y.js → add-to-dashboard-BQRAAnc3.js} +55 -33
  7. package/dist/chunks/{analytics-base-schemas-BFAoRlkU.js → analytics-base-schemas-BKs3flFS.js} +2 -2
  8. package/dist/chunks/{assistant-chat-D7sWTypJ.js → assistant-chat-BPXhulAx.js} +2826 -2595
  9. package/dist/chunks/{bookmark-state-CXw7lZ50.js → bookmark-state-C4vetoa0.js} +7 -8
  10. package/dist/chunks/column-catalog-BYnochWQ.js +3363 -0
  11. package/dist/chunks/comparison-window-caption-C2xF-eWw.js +1433 -0
  12. package/dist/chunks/{context-ClREvqCZ.js → context-BerEBuFR.js} +11 -6
  13. package/dist/chunks/custom-visual-inputs-CkJW9pBS.js +295 -0
  14. package/dist/chunks/{dashboard-B1tMju0u.js → dashboard-C3CoKbGY.js} +1 -1
  15. package/dist/chunks/dashboard-briefing-launcher-Be4h-7My.js +3734 -0
  16. package/dist/chunks/dashboard-controls-bxPrlSyp.js +2307 -0
  17. package/dist/chunks/{dashboard-json-CoYRPqxx.js → dashboard-json-BrjxIiRt.js} +5 -5
  18. package/dist/chunks/{document-dashboard-inputs-BesAHZvB.js → document-dashboard-inputs-CRVHpIHp.js} +872 -974
  19. package/dist/chunks/{edit-dashboard-visual-JPtNfJRb.js → edit-dashboard-visual-DYYYDjY6.js} +2361 -2447
  20. package/dist/chunks/{filter-value-text-ff7osJr7.js → filter-value-text-Ddf55Ku1.js} +9 -9
  21. package/dist/chunks/global-date-filter-utils-9d6m9-FE.js +11859 -0
  22. package/dist/chunks/index-CtoK1Lgu.js +586 -0
  23. package/dist/chunks/{index-DRWiuqyd.js → index-DkQkMKa1.js} +80 -79
  24. package/dist/chunks/list-filter-DsaTbM3J.js +15 -0
  25. package/dist/chunks/matrix-analytical-definition-B9vW-osb.js +717 -0
  26. package/dist/chunks/{matrix-card-DjwWcCo8.js → matrix-card-LiMEipvq.js} +3 -3
  27. package/dist/chunks/{matrix-formatter-DnCyRXJE.js → matrix-formatter-DWEeC0_c.js} +44 -44
  28. package/dist/chunks/{matrix-member-presentation-CQGdVks6.js → matrix-member-presentation-DqzG-UhQ.js} +1 -1
  29. package/dist/chunks/{matrix-operation-contract-8OIO4gob.js → matrix-operation-contract-D6vYkZK4.js} +72 -72
  30. package/dist/chunks/{metric-comparison-DEwi9uc2.js → metric-comparison-zpGw4lD6.js} +2 -2
  31. package/dist/chunks/normalize-dashboard-for-dirty-check-XKgH3GFX.js +119 -0
  32. package/dist/chunks/{pivot-header-presentation-DHcx1XGQ.js → pivot-header-presentation-CQnIDtUv.js} +1 -1
  33. package/dist/chunks/{pivot-result-identity-DJhXXcns.js → pivot-result-identity-C-Q1j1Wb.js} +1 -1
  34. package/dist/chunks/{pivot-result-lifecycle-DM4CyGKs.js → pivot-result-lifecycle-pwq3b7LC.js} +571 -380
  35. package/dist/chunks/{raw-temporal-contract-C51YG48G.js → raw-temporal-contract-WuXA8jBP.js} +1 -1
  36. package/dist/chunks/{raw-temporal-presentation-C3mUgnEx.js → raw-temporal-presentation-CBzrDOjM.js} +8 -8
  37. package/dist/chunks/{report-preferences-dialog-DUtuUL_5.js → report-preferences-dialog-4QEZWe5U.js} +111 -112
  38. package/dist/chunks/{report-runtime-context-Dq8XyODK.js → report-runtime-context-hWiTCzFV.js} +2 -2
  39. package/dist/chunks/resolve-dashboard-input-context-UpK_LBpL.js +5677 -0
  40. package/dist/chunks/{saved-dashboard-context-LrF_kW0l.js → saved-dashboard-context-D_I3Lxk0.js} +34 -34
  41. package/dist/chunks/{selection-reducer-Dj_8xD69.js → selection-reducer-CJzkTZio.js} +15 -15
  42. package/dist/chunks/{semaphor-ready-indicator-BxF96Yhv.js → semaphor-ready-indicator-4zpRHE-X.js} +45823 -47304
  43. package/dist/chunks/{shelf-drop-preview-context-CNaM_Gmh.js → shelf-drop-preview-context-Cfw7TRAx.js} +84 -84
  44. package/dist/chunks/{source-entity-resolution-BYn9giz3.js → source-entity-resolution-BIGRvtbG.js} +13 -13
  45. package/dist/chunks/{switch-uDtPgQlQ.js → switch-CEBOR4n7.js} +3 -3
  46. package/dist/chunks/{table-export-sheet-YzMioA7Y.js → table-export-sheet-4X9mAG3V.js} +1 -1
  47. package/dist/chunks/table-settings-CunhoDUi.js +605 -0
  48. package/dist/chunks/{temporal-bucket-D7NBrrtL.js → temporal-bucket-CQOSbv9-.js} +26 -26
  49. package/dist/chunks/{token-types-DBbZVQsm.js → token-types-BMqRmT-C.js} +1 -1
  50. package/dist/chunks/{use-create-flow-overlay-state-CjB7ig1o.js → use-create-flow-overlay-state-DZBZiiD-.js} +101 -101
  51. package/dist/chunks/{validators-DMHTpf7a.js → validators-C-aOQlTB.js} +713 -658
  52. package/dist/chunks/{relative-date-label-Bk2j94pA.js → zoned-wall-clock-MulfA26h.js} +64 -21
  53. package/dist/dashboard/index.js +2 -2
  54. package/dist/dashboard-authoring/index.js +1802 -1149
  55. package/dist/data-app-sdk/index.js +6 -6
  56. package/dist/data-app-sdk-adapters/index.js +3 -3
  57. package/dist/data-app-sdk-validation/index.js +14 -14
  58. package/dist/format-utils/index.js +133 -133
  59. package/dist/index.js +192 -186
  60. package/dist/layouts/index.js +5 -242
  61. package/dist/report-runtime-context/index.js +2 -2
  62. package/dist/shared/index.js +4 -5
  63. package/dist/style.css +1 -1
  64. package/dist/surfboard/index.js +2 -2
  65. package/dist/types/components/index.d.ts +2 -0
  66. package/dist/types/components/surfboard/arrange-layout-button.d.ts +8 -0
  67. package/dist/types/components/surfboard/screen-size-preview-button.d.ts +7 -0
  68. package/dist/types/index.js +6 -6
  69. package/dist/types/lib/charts/table-chart-types.d.ts +4 -0
  70. package/dist/types/lib/charts/types.d.ts +2 -2
  71. package/dist/types/lib/dashboard-inputs/dashboard-input-values.d.ts +6 -0
  72. package/dist/types/lib/dashboard-inputs/filter-settings.d.ts +2 -0
  73. package/dist/types/lib/dashboard-inputs/prepare-loaded-dashboard.d.ts +15 -0
  74. package/dist/types/lib/matrix-table/matrix-editor.d.ts +52 -0
  75. package/dist/types/lib/query-context/dashboard-filter-mapping-resolution.d.ts +69 -0
  76. package/dist/types/lib/stores/dashboard-store.d.ts +125 -6
  77. package/dist/types/lib/types/common-types.d.ts +8 -0
  78. package/dist/types/lib/types/explorer-types.d.ts +10 -0
  79. package/dist/types/lib/types/semantic-types.d.ts +84 -0
  80. package/dist/types/lib/utils/build-saved-editor-card.d.ts +20 -0
  81. package/dist/types/lib/utils/card-type-change.d.ts +16 -0
  82. package/dist/types/lib/utils/field-availability-context.d.ts +25 -0
  83. package/dist/types/lib/utils/field-placement.d.ts +96 -0
  84. package/dist/types/lib/utils/field-state-calculator.d.ts +161 -0
  85. package/dist/types/lib/utils/qualified-entity-name.d.ts +2 -0
  86. package/dist/types/shared/analytics-protocol/field-provenance.d.ts +89 -0
  87. package/dist/types/shared/analytics-protocol/index.d.ts +2 -0
  88. package/dist/types/shared/analytics-protocol/query-policies.d.ts +52 -0
  89. package/dist/types/shared/analytics-protocol/time-window-schema.d.ts +1 -1
  90. package/dist/types/shared/analytics-protocol/time-window.d.ts +40 -1
  91. package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +4 -1
  92. package/dist/types/shared/assistant-protocol/answer-text.d.ts +20 -0
  93. package/dist/types/shared/assistant-protocol/context.d.ts +21 -21
  94. package/dist/types/shared/assistant-protocol/index.d.ts +1 -0
  95. package/dist/types/shared/assistant-protocol/limits.d.ts +6 -1
  96. package/dist/types/shared/assistant-protocol/parts.d.ts +43 -3
  97. package/dist/types/shared/assistant-protocol/request.d.ts +14 -2
  98. package/dist/types/shared/dashboard-authoring/calculated-field-identity.d.ts +3 -0
  99. package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +487 -0
  100. package/dist/types/shared/dashboard-authoring/changes/card-types.d.ts +34 -0
  101. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +7886 -0
  102. package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +43 -0
  103. package/dist/types/shared/dashboard-authoring/changes/read-card-query.d.ts +54 -0
  104. package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-changes.d.ts +89 -0
  105. package/dist/types/shared/dashboard-authoring/column-catalog.d.ts +32 -0
  106. package/dist/types/shared/dashboard-authoring/contracts.d.ts +0 -55
  107. package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +24 -14
  108. package/dist/types/shared/dashboard-authoring/dashboard-card-source-index.d.ts +9 -1
  109. package/dist/types/shared/dashboard-authoring/dashboard-input-scope.d.ts +26 -0
  110. package/dist/types/shared/dashboard-authoring/filter-applicability.d.ts +75 -0
  111. package/dist/types/shared/dashboard-authoring/index.d.ts +18 -2
  112. package/dist/types/shared/dashboard-authoring/operations/apply-dashboard-operations.d.ts +10 -37
  113. package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +189 -0
  114. package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +94 -0
  115. package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +78 -0
  116. package/dist/types/shared/dashboard-authoring/validators.d.ts +1 -2
  117. package/dist/types/shared/layouts/engine/grid.d.ts +25 -0
  118. package/dist/types/shared/layouts/engine/index.d.ts +4 -0
  119. package/dist/types/shared/layouts/engine/sheet-layout.d.ts +7 -0
  120. package/dist/types/shared/layouts/engine/types.d.ts +125 -0
  121. package/dist/types/shared/layouts/index.d.ts +1 -2
  122. package/package.json +2 -2
  123. package/dist/chunks/apply-dashboard-operations-CZEMsx8E.js +0 -2080
  124. package/dist/chunks/calendar-day-equality-dvoQp1xW.js +0 -410
  125. package/dist/chunks/comparison-window-caption-D4E6IHPD.js +0 -1624
  126. package/dist/chunks/custom-visual-inputs-DLCD9Y5V.js +0 -329
  127. package/dist/chunks/dashboard-briefing-launcher-CePgIu0Z.js +0 -3720
  128. package/dist/chunks/dashboard-controls-Cq05n3e0.js +0 -2315
  129. package/dist/chunks/dashboard-filter-value-compatibility-CwQ_iSNb.js +0 -108
  130. package/dist/chunks/matrix-analytical-definition-C7Gb0e12.js +0 -117
  131. package/dist/chunks/normalize-dashboard-for-dirty-check-Bk3VYv_q.js +0 -67
  132. package/dist/chunks/numeric-presentation-7X_IrD58.js +0 -5226
  133. package/dist/chunks/resolve-dashboard-input-context-DJ2tICwz.js +0 -9415
  134. package/dist/chunks/stable-serialize-CfqXeiBP.js +0 -6
  135. package/dist/chunks/table-settings-CLZocegs.js +0 -501
  136. package/dist/chunks/use-debounced-dirty-check-BwAbnX_5.js +0 -59
  137. package/dist/chunks/zoned-wall-clock-BkxV9jS2.js +0 -46
  138. package/dist/types/shared/dashboard-authoring/change-compiler.d.ts +0 -7
  139. package/dist/types/shared/dashboard-authoring/layout-compiler.d.ts +0 -2
  140. package/dist/types/shared/layouts/create-frame-layouts.d.ts +0 -27
  141. package/dist/types/shared/layouts/frame-layouts.d.ts +0 -23
@@ -1,410 +0,0 @@
1
- import { r as B } from "./metric-comparison-DEwi9uc2.js";
2
- import { l as F } from "./validators-DMHTpf7a.js";
3
- import { a as W, w as y, z as S } from "./zoned-wall-clock-BkxV9jS2.js";
4
- function j(t, e) {
5
- return B({ ...t, role: e });
6
- }
7
- function it(t, e) {
8
- if (e.id) {
9
- const n = [];
10
- t.forEach(
11
- ({ fields: s }, o) => s.forEach((r, a) => {
12
- r.id === e.id && n.push({ group: o, index: a });
13
- })
14
- );
15
- const i = e.alias ? n.find(
16
- ({ group: s, index: o }) => j(t[s].fields[o], t[s].role) === e.alias
17
- ) : void 0;
18
- if (i) return i;
19
- if (n.length === 1) return n[0];
20
- }
21
- for (let n = 0; n < t.length; n += 1) {
22
- const i = t[n].fields.findIndex(
23
- (s) => s.name === e.name && s.entityName === e.entityName && (s.alias === e.alias || !e.alias)
24
- );
25
- if (i !== -1) return { group: n, index: i };
26
- }
27
- }
28
- function w(t, e) {
29
- const n = t.split(".").map((a) => a.trim()), i = e.split(".").map((a) => a.trim());
30
- if (n.length === 0 || i.length === 0 || n.some((a) => !a) || i.some((a) => !a))
31
- return !1;
32
- const [s, o] = n.length <= i.length ? [n, i] : [i, n], r = o.length - s.length;
33
- return s.every((a, c) => a === o[c + r]);
34
- }
35
- function P(t, e) {
36
- const n = t.split("."), i = e.split("."), s = n.pop(), o = i.pop();
37
- return !!(s && s === o && n.length > 0 && i.length > 0 && w(
38
- n.join("."),
39
- i.join(".")
40
- ));
41
- }
42
- function R(t) {
43
- const e = t.map((i) => i.trim()).filter(Boolean);
44
- if (e.every(
45
- (i, s) => e.slice(s + 1).every(
46
- (o) => w(i, o)
47
- )
48
- ))
49
- return [...e].sort(
50
- (i, s) => s.split(".").length - i.split(".").length
51
- )[0];
52
- }
53
- function m(t) {
54
- return typeof t == "object" && t !== null && !Array.isArray(t);
55
- }
56
- function M(t) {
57
- if (typeof t != "string") return "";
58
- const e = t.split(".").map((n) => n.trim());
59
- return e.length > 1 && e.every(Boolean) ? e.join(".") : "";
60
- }
61
- function _(t) {
62
- if (typeof t != "string") return "";
63
- const e = t.split(".").map((n) => n.trim());
64
- return e.length > 0 && e.every(Boolean) ? e.join(".") : "";
65
- }
66
- function d(t) {
67
- return typeof t == "string" ? t.trim() : "";
68
- }
69
- function L(t, e) {
70
- return t.every(
71
- (n, i) => t.slice(i + 1).every((s) => e(n, s))
72
- );
73
- }
74
- function O(t, e) {
75
- const n = d(t.id), i = d(t.name), s = d(e.entityId), o = d(e.entityName);
76
- return !i || !s && !o ? !1 : (!s || s === n || s === i) && (!o || o === i);
77
- }
78
- function Q(t) {
79
- const e = m(t.semanticContext) ? t.semanticContext : void 0, n = m(t.fieldMeta) ? t.fieldMeta : void 0, i = d(e == null ? void 0 : e.semanticDomainId), s = Array.isArray(e == null ? void 0 : e.selectedEntities) ? e.selectedEntities.filter(
80
- (I) => m(I) && I.type === "dataset"
81
- ) : [];
82
- if (!!!(i || s.length > 0 || (n == null ? void 0 : n.entityType) === "dataset")) return;
83
- if (!i)
84
- return { status: "unresolved", reason: "incomplete_source_identity" };
85
- const r = d(n == null ? void 0 : n.entityId), a = d(n == null ? void 0 : n.entityName), c = !!(r || a), l = c ? s.filter(
86
- (I) => O(I, {
87
- entityId: r,
88
- entityName: a
89
- })
90
- ) : s;
91
- if (l.length > 1)
92
- return { status: "unresolved", reason: "incomplete_source_identity" };
93
- if (c && s.length > 0 && l.length === 0)
94
- return { status: "unresolved", reason: "divergent_source_identity" };
95
- const u = l[0], f = d(u == null ? void 0 : u.domainId), D = d(u == null ? void 0 : u.id), p = d(u == null ? void 0 : u.name);
96
- if (f && f !== i)
97
- return { status: "unresolved", reason: "divergent_source_identity" };
98
- const q = D, A = p || a;
99
- return A ? {
100
- status: "resolved",
101
- source: {
102
- kind: "semantic",
103
- domainId: i,
104
- datasetName: A,
105
- ...q ? { datasetId: q } : {}
106
- }
107
- } : { status: "unresolved", reason: "incomplete_source_identity" };
108
- }
109
- function Y(t, e) {
110
- const n = d(t.connectionId), i = m(t.semanticContext) ? t.semanticContext : void 0, s = d(i == null ? void 0 : i.connectionId);
111
- if (n && s && n !== s)
112
- return { status: "unresolved", reason: "divergent_source_identity" };
113
- const o = n || s, r = m(t.fieldMeta) ? t.fieldMeta : void 0, a = e.split(".").slice(0, -1).join("."), c = _(t.qualifiedTableName), l = _(
114
- r == null ? void 0 : r.qualifiedEntityName
115
- ), u = [
116
- c,
117
- l,
118
- a
119
- ].filter(Boolean), f = R(u);
120
- return !f && u.length > 0 ? { status: "unresolved", reason: "divergent_source_identity" } : !o || !f ? { status: "unresolved", reason: "incomplete_source_identity" } : {
121
- status: "resolved",
122
- source: { kind: "physical", connectionId: o, tableName: f }
123
- };
124
- }
125
- function H(t, e) {
126
- const n = m(t.fieldMeta) ? t.fieldMeta : void 0, i = typeof (n == null ? void 0 : n.qualifiedFieldName) == "string" ? n.qualifiedFieldName.trim() : "", s = M(
127
- n == null ? void 0 : n.qualifiedFieldName
128
- ), o = typeof t.column == "string" ? t.column.trim() : "", r = M(o), a = typeof t.qualifiedTableName == "string" ? t.qualifiedTableName.trim() : "", c = _(
129
- t.qualifiedTableName
130
- );
131
- if (i && !s || e && a && !c || o.includes(".") && !r)
132
- return { status: "unresolved", reason: "incomplete_field_identity" };
133
- const l = r.split("."), u = r ? l[l.length - 1] : o, f = e && c && u ? `${c}.${u}` : "", D = [
134
- s,
135
- r,
136
- f
137
- ].filter(Boolean);
138
- if (!L(
139
- D,
140
- P
141
- ))
142
- return { status: "unresolved", reason: "divergent_field_identity" };
143
- const p = r || s || f;
144
- return p ? { status: "resolved", qualifiedFieldName: p } : { status: "unresolved", reason: "incomplete_field_identity" };
145
- }
146
- function G(t) {
147
- if (!m(t))
148
- return { status: "ineligible", reason: "invalid_input" };
149
- if (t.kind === "global-date")
150
- return { status: "eligible", kind: "global_date" };
151
- const e = F(t.dataType);
152
- if (e !== "date" && e !== "datetime")
153
- return { status: "ineligible", reason: "non_date_filter" };
154
- const n = m(t.fieldMeta) ? t.fieldMeta : void 0, i = F(
155
- n == null ? void 0 : n.dataType
156
- );
157
- if ((n == null ? void 0 : n.dataType) !== void 0 && i !== "date" && i !== "datetime")
158
- return { status: "ineligible", reason: "non_date_filter" };
159
- if (t.customFilterPreferences)
160
- return { status: "ineligible", reason: "custom_filter" };
161
- if (t.targetColumns !== void 0 && (!Array.isArray(t.targetColumns) || t.targetColumns.length > 0))
162
- return { status: "ineligible", reason: "multi_target_filter" };
163
- const s = Q(t), o = H(t, s === void 0);
164
- if (o.status === "unresolved")
165
- return { status: "ineligible", reason: o.reason };
166
- const r = s || Y(t, o.qualifiedFieldName);
167
- return r.status === "resolved" ? {
168
- status: "eligible",
169
- kind: "field_date",
170
- qualifiedFieldName: o.qualifiedFieldName,
171
- source: r.source
172
- } : { status: "ineligible", reason: r.reason };
173
- }
174
- function J(t) {
175
- if (!m(t) || t.kind !== "filter" || !m(t.filter))
176
- return { status: "ineligible", reason: "invalid_input" };
177
- const e = G(
178
- t.filter
179
- );
180
- return e.status === "ineligible" ? e : e.kind === "field_date" && m(t.compatibility) && t.compatibility.source === "cardInlineFilter" ? { status: "ineligible", reason: "card_inline_filter" } : e;
181
- }
182
- function st(t) {
183
- return J(t).status === "eligible";
184
- }
185
- function ot(t) {
186
- return `compat-filter:${t}`;
187
- }
188
- function rt(t) {
189
- return `compat-control:${t}`;
190
- }
191
- function at(t, e) {
192
- return `compat-inline-filter:${t}:${e}`;
193
- }
194
- function ut(t, e) {
195
- return `compat-card-control:${t}:${e}`;
196
- }
197
- const T = 864e5, E = {
198
- second: 1e3,
199
- minute: 6e4,
200
- hour: 36e5
201
- };
202
- function N(t, e) {
203
- return {
204
- ...S(t, e),
205
- millisecond: (t.getTime() % 1e3 + 1e3) % 1e3
206
- };
207
- }
208
- function g(t, e) {
209
- return W(t, e);
210
- }
211
- function v(t) {
212
- const e = new Date(t);
213
- return {
214
- year: e.getUTCFullYear(),
215
- month: e.getUTCMonth() + 1,
216
- day: e.getUTCDate(),
217
- hour: e.getUTCHours(),
218
- minute: e.getUTCMinutes(),
219
- second: e.getUTCSeconds(),
220
- millisecond: e.getUTCMilliseconds()
221
- };
222
- }
223
- function U(t, e) {
224
- const n = /* @__PURE__ */ new Date(0);
225
- return n.setUTCFullYear(t, e, 0), n.getUTCDate();
226
- }
227
- function C(t, e) {
228
- const n = t.year * 12 + (t.month - 1) + e, i = Math.floor(n / 12), s = n - i * 12 + 1;
229
- return { ...t, year: i, month: s, day: Math.min(t.day, U(i, s)) };
230
- }
231
- function h(t, e, n) {
232
- if (e === 0) return t;
233
- switch (n) {
234
- case "second":
235
- case "minute":
236
- case "hour":
237
- return v(
238
- y(t) + e * E[n]
239
- );
240
- case "day":
241
- return v(y(t) + e * T);
242
- case "week":
243
- return v(y(t) + e * 7 * T);
244
- case "month":
245
- return C(t, e);
246
- case "quarter":
247
- return C(t, e * 3);
248
- case "year":
249
- return C(t, e * 12);
250
- }
251
- }
252
- function K(t) {
253
- return new Date(
254
- y({ ...t, hour: 0, minute: 0, second: 0 })
255
- ).getUTCDay();
256
- }
257
- function k(t) {
258
- var n;
259
- const e = (n = t.fiscalCalendar) == null ? void 0 : n.yearStartMonth;
260
- return e && e >= 1 && e <= 12 ? e : 1;
261
- }
262
- function V(t, e, n) {
263
- const i = { ...t, hour: 0, minute: 0, second: 0, millisecond: 0 };
264
- switch (e) {
265
- case "day":
266
- return i;
267
- case "week":
268
- return h(
269
- i,
270
- -((K(t) - n.weekStart + 7) % 7),
271
- "day"
272
- );
273
- case "month":
274
- return { ...i, day: 1 };
275
- case "quarter": {
276
- const s = (t.month - k(n) + 12) % 12;
277
- return C({ ...i, day: 1 }, -(s % 3));
278
- }
279
- case "year": {
280
- const s = k(n);
281
- return {
282
- ...i,
283
- year: t.month >= s ? t.year : t.year - 1,
284
- month: s,
285
- day: 1
286
- };
287
- }
288
- }
289
- }
290
- function b(t, e, n, i = 0) {
291
- const s = E[e];
292
- if (s !== void 0) {
293
- const a = N(t, n.tz), c = a.millisecond + (e === "second" ? 0 : a.second * 1e3) + (e === "hour" ? a.minute * 6e4 : 0), l = t.getTime() - c + i * s;
294
- return { start: new Date(l), endExclusive: new Date(l + s) };
295
- }
296
- const o = e, r = h(
297
- V(N(t, n.tz), o, n),
298
- i,
299
- e
300
- );
301
- return {
302
- start: g(r, n.tz),
303
- endExclusive: g(h(r, 1, e), n.tz)
304
- };
305
- }
306
- function x(t, e, n) {
307
- return b(t, e, n).start;
308
- }
309
- function z(t, e, n) {
310
- return new Date(b(t, e, n).endExclusive.getTime() - 1);
311
- }
312
- function X(t, e, n, i) {
313
- return e === 0 ? t : g(
314
- h(N(t, i.tz), e, n),
315
- i.tz
316
- );
317
- }
318
- function ct(t, e, n) {
319
- const i = (s) => {
320
- const { year: o, month: r, day: a } = S(s, n);
321
- return y({ year: o, month: r, day: a, hour: 0, minute: 0, second: 0 });
322
- };
323
- return Math.round((i(e) - i(t)) / T);
324
- }
325
- const Z = /^(\d{4})-(\d{2})-(\d{2})$/;
326
- function dt(t, e) {
327
- const { year: n, month: i, day: s } = S(t, e);
328
- return `${String(n).padStart(4, "0")}-${String(i).padStart(2, "0")}-${String(s).padStart(2, "0")}`;
329
- }
330
- function $(t) {
331
- const e = Z.exec(t);
332
- if (!e) return null;
333
- const n = Number(e[1]), i = Number(e[2]), s = Number(e[3]);
334
- return i < 1 || i > 12 || s < 1 || s > U(n, i) ? null : { year: n, month: i, day: s };
335
- }
336
- function lt(t, e) {
337
- const n = $(t);
338
- if (!n) return null;
339
- const i = { ...n, hour: 0, minute: 0, second: 0, millisecond: 0 };
340
- return {
341
- start: g(i, e),
342
- endExclusive: g(h(i, 1, "day"), e)
343
- };
344
- }
345
- function mt(t, e, n) {
346
- const i = (o) => new Date(b(n, t.unit, e, o).endExclusive.getTime() - 1), s = (o) => b(n, t.unit, e, o).start;
347
- switch (t.mode) {
348
- case "last":
349
- return t.unit === "minute" || t.unit === "hour" ? {
350
- start: new Date(
351
- n.getTime() - t.n * E[t.unit]
352
- ),
353
- end: n
354
- } : t.complete ? { start: s(-t.n), end: i(-1) } : { start: X(n, -t.n, t.unit, e), end: n };
355
- case "this": {
356
- if (t.boundary && t.unit === "month") {
357
- const o = t.boundary === "first_day" ? x(n, "month", e) : z(n, "month", e);
358
- return {
359
- start: x(o, "day", e),
360
- end: z(o, "day", e)
361
- };
362
- }
363
- return { start: s(0), end: t.toDate ? n : i(0) };
364
- }
365
- case "previous":
366
- return { start: s(-1), end: i(-1) };
367
- case "between":
368
- return { start: s(t.from), end: i(t.to) };
369
- }
370
- }
371
- function ft(t) {
372
- const { operation: e, values: n, temporalPrecision: i } = t;
373
- if (e !== "=" && e !== "!=" || i === "minute")
374
- return null;
375
- const s = Array.isArray(n) ? n : [n];
376
- if (s.length !== 1 || typeof s[0] != "string") return null;
377
- const o = s[0].trim();
378
- return $(o) ? { operation: e, day: o } : null;
379
- }
380
- export {
381
- P as A,
382
- w as B,
383
- E,
384
- j as a,
385
- O as b,
386
- J as c,
387
- rt as d,
388
- at as e,
389
- it as f,
390
- ot as g,
391
- ut as h,
392
- st as i,
393
- g as j,
394
- U as k,
395
- h as l,
396
- K as m,
397
- x as n,
398
- z as o,
399
- b as p,
400
- ct as q,
401
- G as r,
402
- X as s,
403
- dt as t,
404
- $ as u,
405
- lt as v,
406
- N as w,
407
- mt as x,
408
- ft as y,
409
- R as z
410
- };