react-semaphor 0.1.537 → 0.1.538

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 (173) hide show
  1. package/dist/analytics-protocol/index.js +352 -341
  2. package/dist/assistant-context/index.js +10 -0
  3. package/dist/assistant-protocol/index.js +104 -0
  4. package/dist/brand-studio/index.js +35 -31
  5. package/dist/briefings/index.js +46 -45
  6. package/dist/chunks/_commonjsHelpers-BkfeUUK-.js +28 -0
  7. package/dist/chunks/add-to-dashboard-CxtTfISD.js +56 -0
  8. package/dist/chunks/aggregate-table-row-presentation-Qgpv6_G8.js +979 -0
  9. package/dist/chunks/analytics-base-schemas-BFAoRlkU.js +472 -0
  10. package/dist/chunks/apply-dashboard-operations-C-iahGka.js +402 -0
  11. package/dist/chunks/assistant-chat-BAqUIFp5.js +7966 -0
  12. package/dist/chunks/availability-Bp5Gfu1I.js +44 -0
  13. package/dist/chunks/{bookmark-state-B-I9BDD0.js → bookmark-state-k7y5SNGf.js} +9 -9
  14. package/dist/chunks/{braces-8TRlDwDw.js → braces-o9UiRQes.js} +1 -1
  15. package/dist/chunks/calculated-field-identity-DcBS2NPP.js +2161 -0
  16. package/dist/chunks/calendar-day-equality-Bpl15IBo.js +487 -0
  17. package/dist/chunks/class-utils-Df1OVOT1.js +2315 -0
  18. package/dist/chunks/{field-dependencies-CpRUwr9J.js → common-types-CUf03Htv.js} +65 -58
  19. package/dist/chunks/context-HD9usB1P.js +349 -0
  20. package/dist/chunks/conversation-sQiWYUOb.js +16 -0
  21. package/dist/chunks/csv-utils-GUfKyT1J.js +56 -0
  22. package/dist/chunks/custom-visual-inputs-BrUOIwln.js +3288 -0
  23. package/dist/chunks/{dashboard-BPJo-Fnd.js → dashboard-DTDDFQsS.js} +1 -1
  24. package/dist/chunks/{dashboard-briefing-launcher-A2uVpHCp.js → dashboard-briefing-launcher-Bb2QUqOa.js} +764 -740
  25. package/dist/chunks/{dashboard-controls-DxTuVis_.js → dashboard-controls-FpONU8QV.js} +683 -686
  26. package/dist/chunks/{common-types-g7yS12Cg.js → dashboard-filter-value-compatibility-D95O4nd7.js} +18 -24
  27. package/dist/chunks/dashboard-json-DazPhBU_.js +69 -0
  28. package/dist/chunks/document-dashboard-inputs-D96rlU7S.js +10678 -0
  29. package/dist/chunks/document-sheet-utils-C1eEldxs.js +1076 -0
  30. package/dist/chunks/{edit-dashboard-visual-ByV0OwSp.js → edit-dashboard-visual-CIhZodVH.js} +4744 -4746
  31. package/dist/chunks/editor-draft-sync-BN5qYHPF.js +15 -0
  32. package/dist/chunks/filter-value-text-BhWugPWE.js +163 -0
  33. package/dist/chunks/index-CqMiAkay.js +3164 -0
  34. package/dist/chunks/index-CuHybtft.js +51 -0
  35. package/dist/chunks/layout-grid-Bgzth8vd.js +16 -0
  36. package/dist/chunks/{matrix-analytical-definition-CgBTD6H8.js → matrix-analytical-definition-bcprSe4u.js} +1 -1
  37. package/dist/chunks/{matrix-card-CAdizkUl.js → matrix-card-CJn1hB5V.js} +13 -12
  38. package/dist/chunks/matrix-definition-DQDI2okF.js +206 -0
  39. package/dist/chunks/{matrix-formatter-DJCk8Znf.js → matrix-formatter-Bgw32tb3.js} +648 -457
  40. package/dist/chunks/matrix-member-presentation-BNPSDKBG.js +105 -0
  41. package/dist/chunks/{matrix-operation-contract-BKupLHXL.js → matrix-operation-contract-B8PBF1Gd.js} +134 -133
  42. package/dist/chunks/{metric-comparison-BKHyvnAy.js → metric-comparison-CojWeLqx.js} +1 -1
  43. package/dist/chunks/{palette-Cp1hqZtm.js → palette-D10o_yYX.js} +1 -1
  44. package/dist/chunks/pivot-header-presentation-MkcKnjn3.js +42 -0
  45. package/dist/chunks/{pivot-result-identity-Bs4tLtLo.js → pivot-result-identity-D6hhcRXi.js} +1 -1
  46. package/dist/chunks/pivot-result-lifecycle-8qCDmpKc.js +804 -0
  47. package/dist/chunks/raw-temporal-D61lr48Y.js +1464 -0
  48. package/dist/chunks/{raw-temporal-contract-mLFS-9wk.js → raw-temporal-contract-C51YG48G.js} +1 -1
  49. package/dist/chunks/report-preferences-dialog-BCGs4-AE.js +1808 -0
  50. package/dist/chunks/{report-runtime-context-CG_I0PPW.js → report-runtime-context-B984Nq1E.js} +8 -7
  51. package/dist/chunks/save-CfJpQQ68.js +21 -0
  52. package/dist/chunks/saved-dashboard-context-BrTkjcod.js +566 -0
  53. package/dist/chunks/{selection-reducer-CiDEtmAq.js → selection-reducer-vKIb_jS6.js} +2 -2
  54. package/dist/chunks/{semaphor-ready-indicator-CHu1L-lo.js → semaphor-ready-indicator-CHHoWhil.js} +65586 -62749
  55. package/dist/chunks/{shelf-drop-preview-context-i-H6DFyU.js → shelf-drop-preview-context-EsayECEC.js} +199 -196
  56. package/dist/chunks/{source-entity-resolution-C-oNyYMp.js → source-entity-resolution-CVA1a85c.js} +8 -8
  57. package/dist/chunks/switch-CvItuC1Q.js +8199 -0
  58. package/dist/chunks/{temporal-bucket-DlFuhCnT.js → temporal-bucket-D8JF7zKz.js} +86 -71
  59. package/dist/chunks/{temporal-bucket-contract-D2OuaVZ7.js → temporal-bucket-contract-DaOajRC7.js} +1 -1
  60. package/dist/chunks/{token-types-DtSJOUjh.js → token-types-bxUxXDX2.js} +1 -1
  61. package/dist/chunks/{upload-CAIpsti1.js → upload-BFX7apKV.js} +1 -1
  62. package/dist/chunks/{use-create-flow-overlay-state-Bj63WwHc.js → use-create-flow-overlay-state-BqA92GkX.js} +331 -339
  63. package/dist/chunks/{validators-DMSH81OM.js → validators-Ej1DdCXa.js} +1050 -1510
  64. package/dist/chunks/visual-choice-JiJ-_3bi.js +204 -0
  65. package/dist/chunks/x-4f5U2XwU.js +100 -0
  66. package/dist/chunks/{zoned-wall-clock-1qlWCE20.js → zoned-wall-clock-MulfA26h.js} +2 -2
  67. package/dist/dashboard/index.js +2 -2
  68. package/dist/dashboard-authoring/index.js +823 -661
  69. package/dist/data-app-sdk/index.js +32 -30
  70. package/dist/data-app-sdk-adapters/index.js +23 -22
  71. package/dist/data-app-sdk-validation/index.js +23 -22
  72. package/dist/format-utils/index.js +173 -168
  73. package/dist/index.js +267 -258
  74. package/dist/layouts/index.js +236 -24
  75. package/dist/report-runtime-context/index.js +2 -2
  76. package/dist/style.css +1 -1
  77. package/dist/surfboard/index.js +2 -2
  78. package/dist/types/assistant-context.d.ts +2 -0
  79. package/dist/types/assistant-protocol.d.ts +2 -0
  80. package/dist/types/components/assistant/assistant-entry-points.d.ts +18 -0
  81. package/dist/types/components/assistant/assistant-provider.d.ts +19 -0
  82. package/dist/types/components/assistant/assistant-store.d.ts +52 -0
  83. package/dist/types/components/assistant/use-assistant.d.ts +38 -0
  84. package/dist/types/components/index.d.ts +5 -1
  85. package/dist/types/components/surfboard/filter/types.d.ts +5 -2
  86. package/dist/types/index.js +50 -51
  87. package/dist/types/lib/api/invalidate-token.d.ts +7 -0
  88. package/dist/types/lib/charts/cartesian-fields.d.ts +64 -0
  89. package/dist/types/lib/charts/types.d.ts +7 -0
  90. package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-storage-transition.d.ts +14 -2
  91. package/dist/types/lib/dashboard-inputs/dashboard-input-target-context.d.ts +5 -6
  92. package/dist/types/lib/dashboard-inputs/dashboard-input-values.d.ts +8 -3
  93. package/dist/types/lib/dashboard-inputs/resolve-dashboard-input-context.d.ts +11 -6
  94. package/dist/types/lib/dashboard-pagination/dashboard-card-pagination.d.ts +7 -0
  95. package/dist/types/lib/dashboard-viewer/compatibility-input-storage.d.ts +79 -0
  96. package/dist/types/lib/dashboard-viewer/viewer-state.d.ts +3 -2
  97. package/dist/types/lib/document/document-table-data-policy.d.ts +15 -0
  98. package/dist/types/lib/filter-values/filter-mode.d.ts +22 -0
  99. package/dist/types/lib/hooks/use-calendar-context.d.ts +5 -0
  100. package/dist/types/lib/hooks/use-text-filter.d.ts +7 -0
  101. package/dist/types/lib/print/print-inputs.d.ts +4 -2
  102. package/dist/types/lib/query-context/build-card-query-context.d.ts +12 -4
  103. package/dist/types/lib/query-context/build-dashboard-execution-snapshot.d.ts +93 -0
  104. package/dist/types/lib/query-context/card-server-request.d.ts +72 -0
  105. package/dist/types/lib/query-context/compile-dashboard-card-filters.d.ts +7 -0
  106. package/dist/types/lib/query-context/describe-card-execution-snapshot.d.ts +56 -0
  107. package/dist/types/lib/query-context/document-section-card-query.d.ts +45 -0
  108. package/dist/types/lib/query-context/resolve-runtime-card-filters.d.ts +17 -2
  109. package/dist/types/lib/stores/dashboard-store.d.ts +34 -11
  110. package/dist/types/lib/stores/editor-store.d.ts +4 -2
  111. package/dist/types/lib/types/token-types.d.ts +11 -0
  112. package/dist/types/lib/utils/card-type-change.d.ts +30 -0
  113. package/dist/types/lib/utils/comparison-window-caption.d.ts +12 -0
  114. package/dist/types/lib/utils/filter-default-value-utils.d.ts +13 -2
  115. package/dist/types/shared/analytics-protocol/applied-constraints.d.ts +74 -0
  116. package/dist/types/shared/analytics-protocol/contracts.d.ts +3 -0
  117. package/dist/types/shared/analytics-protocol/filter-field-ownership.d.ts +43 -0
  118. package/dist/types/shared/analytics-protocol/index.d.ts +3 -0
  119. package/dist/types/shared/analytics-protocol/matrix-window-contract.d.ts +1 -1
  120. package/dist/types/shared/analytics-protocol/visual-choice.d.ts +75 -0
  121. package/dist/types/shared/assistant-context/index.d.ts +9 -0
  122. package/dist/types/shared/assistant-context/project-context.d.ts +55 -0
  123. package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +130 -0
  124. package/dist/types/shared/assistant-protocol/add-to-dashboard.d.ts +17 -0
  125. package/dist/types/shared/assistant-protocol/artifact.d.ts +63 -0
  126. package/dist/types/shared/assistant-protocol/availability.d.ts +39 -0
  127. package/dist/types/shared/assistant-protocol/context.d.ts +952 -0
  128. package/dist/types/shared/assistant-protocol/conversation.d.ts +38 -0
  129. package/dist/types/shared/assistant-protocol/index.d.ts +16 -0
  130. package/dist/types/shared/assistant-protocol/limits.d.ts +53 -0
  131. package/dist/types/shared/assistant-protocol/parts.d.ts +131 -0
  132. package/dist/types/shared/assistant-protocol/request.d.ts +77 -0
  133. package/dist/types/shared/assistant-protocol/sources.d.ts +27 -0
  134. package/dist/types/shared/assistant-protocol/token-config.d.ts +32 -0
  135. package/dist/types/shared/assistant-protocol/transcript.d.ts +40 -0
  136. package/dist/types/shared/dashboard-authoring/card-query-request.d.ts +112 -0
  137. package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +1794 -0
  138. package/dist/types/shared/dashboard-authoring/index.d.ts +5 -0
  139. package/dist/types/shared/dashboard-authoring/new-card.d.ts +10 -0
  140. package/dist/types/shared/dashboard-authoring/operations/apply-dashboard-operations.d.ts +40 -0
  141. package/dist/types/shared/dashboard-authoring/resolved-primary-date-field-validation.d.ts +16 -0
  142. package/dist/types/shared/format-utils/filter-detail.d.ts +70 -0
  143. package/dist/types/shared/format-utils/filter-value-text.d.ts +15 -0
  144. package/dist/types/shared/format-utils/index.d.ts +3 -0
  145. package/dist/types/shared/format-utils/raw-temporal.d.ts +7 -0
  146. package/dist/types/shared/format-utils/temporal-bucket.d.ts +7 -0
  147. package/dist/types/shared/layouts/frame-layouts.d.ts +23 -0
  148. package/dist/types/shared/layouts/index.d.ts +1 -0
  149. package/package.json +12 -2
  150. package/dist/chunks/calculated-field-identity-BptYhyOP.js +0 -1326
  151. package/dist/chunks/calendar-day-equality-BRjN1S9h.js +0 -383
  152. package/dist/chunks/card-config-utils-BOM1dxCk.js +0 -1150
  153. package/dist/chunks/constants-DNWVy8Y3.js +0 -9
  154. package/dist/chunks/dashboard-json-B1dEQu98.js +0 -65
  155. package/dist/chunks/field-aggregations-CoLzYHeL.js +0 -1229
  156. package/dist/chunks/index-DTcTAGGM.js +0 -4101
  157. package/dist/chunks/matrix-continuation-C4sRcjZU.js +0 -72
  158. package/dist/chunks/matrix-control-sources-DTqcA2_L.js +0 -636
  159. package/dist/chunks/matrix-definition-D9iShKZI.js +0 -87
  160. package/dist/chunks/matrix-member-presentation-Ct8GuxHt.js +0 -209
  161. package/dist/chunks/numeric-presentation-CWu3gunq.js +0 -537
  162. package/dist/chunks/pivot-header-presentation-CHs2GFrM.js +0 -753
  163. package/dist/chunks/pivot-result-lifecycle-DQz_gjGu.js +0 -789
  164. package/dist/chunks/raw-temporal-iMXRK-Qz.js +0 -930
  165. package/dist/chunks/report-preferences-dialog-DXPjteCU.js +0 -1623
  166. package/dist/chunks/save-kO6cIaob.js +0 -34
  167. package/dist/chunks/semantic-format-DiqYeKwU.js +0 -192
  168. package/dist/chunks/switch-DO8a0EfJ.js +0 -25004
  169. package/dist/chunks/temporal-input-presentation-BD7YNUzu.js +0 -195
  170. package/dist/chunks/x-CXDkqdur.js +0 -149
  171. package/dist/types/lib/class-utils.d.ts +0 -2
  172. package/dist/types/lib/document/document-input-runtime.d.ts +0 -26
  173. package/dist/types/lib/utils.d.ts +0 -51
@@ -0,0 +1,487 @@
1
+ import { r as W } from "./metric-comparison-CojWeLqx.js";
2
+ import { l as M } from "./validators-Ej1DdCXa.js";
3
+ import { b as j, w as y, z as A } from "./zoned-wall-clock-MulfA26h.js";
4
+ function P(t, e) {
5
+ return W({ ...t, role: e });
6
+ }
7
+ function rt(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 }) => P(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 x(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, u) => a === o[u + r]);
34
+ }
35
+ function R(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 && x(
38
+ n.join("."),
39
+ i.join(".")
40
+ ));
41
+ }
42
+ function L(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) => x(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 k(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 N(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 Q(t, e) {
70
+ return t.every(
71
+ (n, i) => t.slice(i + 1).every((s) => e(n, s))
72
+ );
73
+ }
74
+ function J(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 K(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), u = !!(r || a), l = u ? s.filter(
86
+ (I) => J(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 (u && s.length > 0 && l.length === 0)
94
+ return { status: "unresolved", reason: "divergent_source_identity" };
95
+ const c = l[0], f = d(c == null ? void 0 : c.domainId), v = d(c == null ? void 0 : c.id), h = d(c == null ? void 0 : c.name);
96
+ if (f && f !== i)
97
+ return { status: "unresolved", reason: "divergent_source_identity" };
98
+ const F = v, q = h || a;
99
+ return q ? {
100
+ status: "resolved",
101
+ source: {
102
+ kind: "semantic",
103
+ domainId: i,
104
+ datasetName: q,
105
+ ...F ? { datasetId: F } : {}
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("."), u = N(t.qualifiedTableName), l = N(
114
+ r == null ? void 0 : r.qualifiedEntityName
115
+ ), c = [
116
+ u,
117
+ l,
118
+ a
119
+ ].filter(Boolean), f = L(c);
120
+ return !f && c.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 G(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 = k(
127
+ n == null ? void 0 : n.qualifiedFieldName
128
+ ), o = typeof t.column == "string" ? t.column.trim() : "", r = k(o), a = typeof t.qualifiedTableName == "string" ? t.qualifiedTableName.trim() : "", u = N(
129
+ t.qualifiedTableName
130
+ );
131
+ if (i && !s || e && a && !u || o.includes(".") && !r)
132
+ return { status: "unresolved", reason: "incomplete_field_identity" };
133
+ const l = r.split("."), c = r ? l[l.length - 1] : o, f = e && u && c ? `${u}.${c}` : "", v = [
134
+ s,
135
+ r,
136
+ f
137
+ ].filter(Boolean);
138
+ if (!Q(
139
+ v,
140
+ R
141
+ ))
142
+ return { status: "unresolved", reason: "divergent_field_identity" };
143
+ const h = r || s || f;
144
+ return h ? { status: "resolved", qualifiedFieldName: h } : { status: "unresolved", reason: "incomplete_field_identity" };
145
+ }
146
+ function H(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 = M(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 = M(
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 = K(t), o = G(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 V(t) {
175
+ if (!m(t) || t.kind !== "filter" || !m(t.filter))
176
+ return { status: "ineligible", reason: "invalid_input" };
177
+ const e = H(
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 at(t) {
183
+ return V(t).status === "eligible";
184
+ }
185
+ function ut(t) {
186
+ return `compat-filter:${t}`;
187
+ }
188
+ function ct(t) {
189
+ return `compat-control:${t}`;
190
+ }
191
+ function dt(t, e) {
192
+ return `compat-inline-filter:${t}:${e}`;
193
+ }
194
+ function lt(t, e) {
195
+ return `compat-card-control:${t}:${e}`;
196
+ }
197
+ function D(t) {
198
+ var e;
199
+ return JSON.stringify([
200
+ ((e = t.field) == null ? void 0 : e.id) ?? "",
201
+ t.operator,
202
+ t.value ?? null,
203
+ t.temporalBucket ?? null
204
+ ]);
205
+ }
206
+ function X(t) {
207
+ return JSON.stringify(t.map(D).sort());
208
+ }
209
+ function U(t) {
210
+ const e = /* @__PURE__ */ new Map();
211
+ for (const n of t)
212
+ for (const i of n.tuples) {
213
+ const s = i.conditions.filter(
214
+ (a) => {
215
+ var u;
216
+ return (u = a.field) == null ? void 0 : u.id;
217
+ }
218
+ );
219
+ if (s.length === 0) continue;
220
+ let o = e.get(n.sourceCardId);
221
+ o || (o = /* @__PURE__ */ new Map(), e.set(n.sourceCardId, o));
222
+ const r = [...s].sort(
223
+ (a, u) => D(a).localeCompare(D(u))
224
+ );
225
+ o.set(X(r), r);
226
+ }
227
+ return [...e.entries()].sort(([n], [i]) => n.localeCompare(i)).map(([n, i]) => ({
228
+ sourceCardId: n,
229
+ tuples: [...i.entries()].sort(([s], [o]) => s.localeCompare(o)).map(([, s]) => ({ conditions: s }))
230
+ }));
231
+ }
232
+ function mt(t) {
233
+ const e = U(t);
234
+ if (e.length !== 0)
235
+ return {
236
+ id: "selection",
237
+ logicalOperator: "AND",
238
+ negate: !1,
239
+ conditions: [],
240
+ groups: e.map((n) => {
241
+ const i = `selection:${n.sourceCardId}`;
242
+ return {
243
+ id: i,
244
+ logicalOperator: "OR",
245
+ negate: !1,
246
+ conditions: [],
247
+ groups: n.tuples.map((s, o) => {
248
+ const r = `${i}:${o}`;
249
+ return {
250
+ id: r,
251
+ logicalOperator: "AND",
252
+ negate: !1,
253
+ conditions: s.conditions.map((a, u) => ({
254
+ ...a,
255
+ id: `${r}:${u}`
256
+ })),
257
+ groups: []
258
+ };
259
+ })
260
+ };
261
+ })
262
+ };
263
+ }
264
+ function ft(t) {
265
+ return JSON.stringify(
266
+ U(t).map((e) => [
267
+ e.sourceCardId,
268
+ e.tuples.map((n) => n.conditions.map(D))
269
+ ])
270
+ );
271
+ }
272
+ const T = 864e5, E = {
273
+ second: 1e3,
274
+ minute: 6e4,
275
+ hour: 36e5
276
+ };
277
+ function S(t, e) {
278
+ return {
279
+ ...A(t, e),
280
+ millisecond: (t.getTime() % 1e3 + 1e3) % 1e3
281
+ };
282
+ }
283
+ function p(t, e) {
284
+ return j(t, e);
285
+ }
286
+ function _(t) {
287
+ const e = new Date(t);
288
+ return {
289
+ year: e.getUTCFullYear(),
290
+ month: e.getUTCMonth() + 1,
291
+ day: e.getUTCDate(),
292
+ hour: e.getUTCHours(),
293
+ minute: e.getUTCMinutes(),
294
+ second: e.getUTCSeconds(),
295
+ millisecond: e.getUTCMilliseconds()
296
+ };
297
+ }
298
+ function B(t, e) {
299
+ const n = /* @__PURE__ */ new Date(0);
300
+ return n.setUTCFullYear(t, e, 0), n.getUTCDate();
301
+ }
302
+ function C(t, e) {
303
+ const n = t.year * 12 + (t.month - 1) + e, i = Math.floor(n / 12), s = n - i * 12 + 1;
304
+ return { ...t, year: i, month: s, day: Math.min(t.day, B(i, s)) };
305
+ }
306
+ function g(t, e, n) {
307
+ if (e === 0) return t;
308
+ switch (n) {
309
+ case "second":
310
+ case "minute":
311
+ case "hour":
312
+ return _(
313
+ y(t) + e * E[n]
314
+ );
315
+ case "day":
316
+ return _(y(t) + e * T);
317
+ case "week":
318
+ return _(y(t) + e * 7 * T);
319
+ case "month":
320
+ return C(t, e);
321
+ case "quarter":
322
+ return C(t, e * 3);
323
+ case "year":
324
+ return C(t, e * 12);
325
+ }
326
+ }
327
+ function Z(t) {
328
+ return new Date(
329
+ y({ ...t, hour: 0, minute: 0, second: 0 })
330
+ ).getUTCDay();
331
+ }
332
+ function $(t) {
333
+ var n;
334
+ const e = (n = t.fiscalCalendar) == null ? void 0 : n.yearStartMonth;
335
+ return e && e >= 1 && e <= 12 ? e : 1;
336
+ }
337
+ function tt(t, e, n) {
338
+ const i = { ...t, hour: 0, minute: 0, second: 0, millisecond: 0 };
339
+ switch (e) {
340
+ case "day":
341
+ return i;
342
+ case "week":
343
+ return g(
344
+ i,
345
+ -((Z(t) - n.weekStart + 7) % 7),
346
+ "day"
347
+ );
348
+ case "month":
349
+ return { ...i, day: 1 };
350
+ case "quarter": {
351
+ const s = (t.month - $(n) + 12) % 12;
352
+ return C({ ...i, day: 1 }, -(s % 3));
353
+ }
354
+ case "year": {
355
+ const s = $(n);
356
+ return {
357
+ ...i,
358
+ year: t.month >= s ? t.year : t.year - 1,
359
+ month: s,
360
+ day: 1
361
+ };
362
+ }
363
+ }
364
+ }
365
+ function b(t, e, n, i = 0) {
366
+ const s = E[e];
367
+ if (s !== void 0) {
368
+ const a = S(t, n.tz), u = a.millisecond + (e === "second" ? 0 : a.second * 1e3) + (e === "hour" ? a.minute * 6e4 : 0), l = t.getTime() - u + i * s;
369
+ return { start: new Date(l), endExclusive: new Date(l + s) };
370
+ }
371
+ const o = e, r = g(
372
+ tt(S(t, n.tz), o, n),
373
+ i,
374
+ e
375
+ );
376
+ return {
377
+ start: p(r, n.tz),
378
+ endExclusive: p(g(r, 1, e), n.tz)
379
+ };
380
+ }
381
+ function z(t, e, n) {
382
+ return b(t, e, n).start;
383
+ }
384
+ function w(t, e, n) {
385
+ return new Date(b(t, e, n).endExclusive.getTime() - 1);
386
+ }
387
+ function et(t, e, n, i) {
388
+ return e === 0 ? t : p(
389
+ g(S(t, i.tz), e, n),
390
+ i.tz
391
+ );
392
+ }
393
+ function yt(t, e, n) {
394
+ const i = (s) => {
395
+ const { year: o, month: r, day: a } = A(s, n);
396
+ return y({ year: o, month: r, day: a, hour: 0, minute: 0, second: 0 });
397
+ };
398
+ return Math.round((i(e) - i(t)) / T);
399
+ }
400
+ const nt = /^(\d{4})-(\d{2})-(\d{2})$/;
401
+ function pt(t, e) {
402
+ const { year: n, month: i, day: s } = A(t, e);
403
+ return `${String(n).padStart(4, "0")}-${String(i).padStart(2, "0")}-${String(s).padStart(2, "0")}`;
404
+ }
405
+ function O(t) {
406
+ const e = nt.exec(t);
407
+ if (!e) return null;
408
+ const n = Number(e[1]), i = Number(e[2]), s = Number(e[3]);
409
+ return i < 1 || i > 12 || s < 1 || s > B(n, i) ? null : { year: n, month: i, day: s };
410
+ }
411
+ function gt(t, e) {
412
+ const n = O(t);
413
+ if (!n) return null;
414
+ const i = { ...n, hour: 0, minute: 0, second: 0, millisecond: 0 };
415
+ return {
416
+ start: p(i, e),
417
+ endExclusive: p(g(i, 1, "day"), e)
418
+ };
419
+ }
420
+ function ht(t, e, n) {
421
+ const i = (o) => new Date(b(n, t.unit, e, o).endExclusive.getTime() - 1), s = (o) => b(n, t.unit, e, o).start;
422
+ switch (t.mode) {
423
+ case "last":
424
+ return t.unit === "minute" || t.unit === "hour" ? {
425
+ start: new Date(
426
+ n.getTime() - t.n * E[t.unit]
427
+ ),
428
+ end: n
429
+ } : t.complete ? { start: s(-t.n), end: i(-1) } : { start: et(n, -t.n, t.unit, e), end: n };
430
+ case "this": {
431
+ if (t.boundary && t.unit === "month") {
432
+ const o = t.boundary === "first_day" ? z(n, "month", e) : w(n, "month", e);
433
+ return {
434
+ start: z(o, "day", e),
435
+ end: w(o, "day", e)
436
+ };
437
+ }
438
+ return { start: s(0), end: t.toDate ? n : i(0) };
439
+ }
440
+ case "previous":
441
+ return { start: s(-1), end: i(-1) };
442
+ case "between":
443
+ return { start: s(t.from), end: i(t.to) };
444
+ }
445
+ }
446
+ function It(t) {
447
+ const { operation: e, values: n, temporalPrecision: i } = t;
448
+ if (e !== "=" && e !== "!=" || i === "minute")
449
+ return null;
450
+ const s = Array.isArray(n) ? n : [n];
451
+ if (s.length !== 1 || typeof s[0] != "string") return null;
452
+ const o = s[0].trim();
453
+ return O(o) ? { operation: e, day: o } : null;
454
+ }
455
+ export {
456
+ It as A,
457
+ L as B,
458
+ R as C,
459
+ x as D,
460
+ E,
461
+ P as a,
462
+ J as b,
463
+ V as c,
464
+ ct as d,
465
+ dt as e,
466
+ rt as f,
467
+ ut as g,
468
+ lt as h,
469
+ at as i,
470
+ mt as j,
471
+ ft as k,
472
+ p as l,
473
+ B as m,
474
+ g as n,
475
+ Z as o,
476
+ b as p,
477
+ z as q,
478
+ H as r,
479
+ et as s,
480
+ w as t,
481
+ yt as u,
482
+ pt as v,
483
+ S as w,
484
+ O as x,
485
+ gt as y,
486
+ ht as z
487
+ };