@astrato-io/visualizations 0.0.0-stage → 0.6.4

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 (145) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/LICENSE +93 -0
  3. package/README.md +843 -2
  4. package/THIRD_PARTY_NOTICES.md +8387 -0
  5. package/VISUALIZATION_DEFINITIONS.md +2378 -0
  6. package/chunks/LinearProgress-CUZ0D8_t.js +253 -0
  7. package/chunks/Radio-Ciu-F4CU.js +957 -0
  8. package/chunks/ToggleButton-BCJc3Jlc.js +153 -0
  9. package/chunks/_baseFlatten-DPXPOrea.js +7076 -0
  10. package/chunks/accessors-DemrDevR.js +128 -0
  11. package/chunks/app-filter-bar.compiler-j_CVoWTa.js +55 -0
  12. package/chunks/bar.compiler-oqaPzIut.js +370 -0
  13. package/chunks/color-settings-ZIvgNTq1.js +10 -0
  14. package/chunks/coloring-C16AUZEi.js +663 -0
  15. package/chunks/data-item-resolution-1lvYB5ln.js +53 -0
  16. package/chunks/debounce-fn-CUixuz45.js +7 -0
  17. package/chunks/escobar-BGqT1EsE.js +34580 -0
  18. package/chunks/event-bus-KiSiCJrC.js +2683 -0
  19. package/chunks/events-WZut5Ow6.js +4 -0
  20. package/chunks/extend-BKUkc4_i.js +37 -0
  21. package/chunks/filter.compiler-CuLtc_02.js +60 -0
  22. package/chunks/filtering-Yq4DEa0t.js +953 -0
  23. package/chunks/gauge-target-type-BkKXAqkX.js +4 -0
  24. package/chunks/grouping-type-BX_9Ix5q.js +3 -0
  25. package/chunks/interfaces-VUY4_yVO.js +8742 -0
  26. package/chunks/line-settings-DfYTUyPz.js +4 -0
  27. package/chunks/line.compiler-BpA_6Tc7.js +188 -0
  28. package/chunks/metadata-CPXdYoln.js +28 -0
  29. package/chunks/number.compiler-DbkWcG4S.js +44 -0
  30. package/chunks/pie-uv42Eqal.js +10 -0
  31. package/chunks/range-DrzdfBX4.js +22 -0
  32. package/chunks/registry-CExpGJ1N.js +920 -0
  33. package/chunks/requirements-DNhuShLS.js +6 -0
  34. package/chunks/rolldown-runtime-DleVn1XH.js +28 -0
  35. package/chunks/set-coloring-datafield-B3uIS1Pe.js +8 -0
  36. package/chunks/shared-CKDL4hx9.js +1171 -0
  37. package/chunks/src-BC7cGcJ-.js +2024 -0
  38. package/chunks/src-BOS6SqkZ.js +67 -0
  39. package/chunks/src-C0LgoUWY.js +26105 -0
  40. package/chunks/src-Cum_2NLV.js +12145 -0
  41. package/chunks/src-D9XogOrc.js +422 -0
  42. package/chunks/src-Dun_jXtz.js +10295 -0
  43. package/chunks/src-DvX5LU9T.js +14742 -0
  44. package/chunks/standalone-87YV_m9n.js +687 -0
  45. package/chunks/standalone-BDCwI6Hn.js +4619 -0
  46. package/chunks/standalone-BH5NqDwp.js +1763 -0
  47. package/chunks/standalone-BLVAWLNJ.js +385 -0
  48. package/chunks/standalone-BPomtAVs.js +2 -0
  49. package/chunks/standalone-BXyBcUOQ.js +2 -0
  50. package/chunks/standalone-BYm1UjLr.js +140 -0
  51. package/chunks/standalone-BllF4rDp.js +383 -0
  52. package/chunks/standalone-BmfMt74U.js +726 -0
  53. package/chunks/standalone-BqWyrnZI.js +281 -0
  54. package/chunks/standalone-C85u7U6I.js +340 -0
  55. package/chunks/standalone-CCNtaJ7s.js +741 -0
  56. package/chunks/standalone-CDQnr6qT.js +345 -0
  57. package/chunks/standalone-CNyNHKVx.js +674 -0
  58. package/chunks/standalone-CY57qwZ-.js +1129 -0
  59. package/chunks/standalone-CZynjFG7.js +12979 -0
  60. package/chunks/standalone-D5vnf-9y.js +3943 -0
  61. package/chunks/standalone-DFPva_ku.js +299 -0
  62. package/chunks/standalone-DQxxNwF8.js +675 -0
  63. package/chunks/standalone-DS9T0FZ-.js +830 -0
  64. package/chunks/standalone-Dx3MLlrO.js +512 -0
  65. package/chunks/standalone-DzixzZAL.js +411 -0
  66. package/chunks/standalone-QJ1kKMnO.js +6 -0
  67. package/chunks/standalone-jiz0L2Dg.js +3855 -0
  68. package/chunks/standalone-lBm9hQ-q.js +179 -0
  69. package/chunks/standalone-rJ45Zfl1.js +68 -0
  70. package/chunks/stroke-dash-UgMEcCS4.js +6 -0
  71. package/chunks/table.compiler-BrXkm4Fz.js +213 -0
  72. package/chunks/toInteger-DVZr-D1j.js +11 -0
  73. package/chunks/treemap-x_zmJoG7.js +23 -0
  74. package/chunks/typeof-CJDtcySz.js +13 -0
  75. package/chunks/types-dVVCsDWD.js +4 -0
  76. package/chunks/ui-D1HQNIBy.js +54039 -0
  77. package/chunks/url-utils-B17gj_mr.js +5501 -0
  78. package/chunks/useFieldName-oqQ3bvnO.js +7 -0
  79. package/chunks/utils-Ba9T0TqC.js +31097 -0
  80. package/chunks/view-CLqWMV7Z.js +156 -0
  81. package/definitions.js +3 -0
  82. package/docs/operations/astrato-app-filter-bar.md +161 -0
  83. package/docs/operations/bar.md +7050 -0
  84. package/docs/operations/combo.md +5825 -0
  85. package/docs/operations/date-picker.md +644 -0
  86. package/docs/operations/distribution-gauge.md +3218 -0
  87. package/docs/operations/dot.md +5662 -0
  88. package/docs/operations/filter.md +1507 -0
  89. package/docs/operations/gauge.md +3452 -0
  90. package/docs/operations/heatMap.md +6026 -0
  91. package/docs/operations/histogram.md +1870 -0
  92. package/docs/operations/iframe.md +56 -0
  93. package/docs/operations/image.md +177 -0
  94. package/docs/operations/index.md +46 -0
  95. package/docs/operations/line.md +6468 -0
  96. package/docs/operations/number.md +3969 -0
  97. package/docs/operations/pie.md +6089 -0
  98. package/docs/operations/radar.md +4646 -0
  99. package/docs/operations/sankey.md +3210 -0
  100. package/docs/operations/scatter.md +6075 -0
  101. package/docs/operations/shape.md +315 -0
  102. package/docs/operations/simpleTextObject.md +706 -0
  103. package/docs/operations/slider.md +230 -0
  104. package/docs/operations/table.md +8790 -0
  105. package/docs/operations/tree.md +2874 -0
  106. package/docs/operations/treemap.md +3619 -0
  107. package/docs/operations/waterfall.md +2938 -0
  108. package/docs/operations/word-cloud.md +3071 -0
  109. package/getters.js +18 -0
  110. package/index.js +1183 -0
  111. package/metadata.js +20 -0
  112. package/operations.js +64 -0
  113. package/package.json +191 -4
  114. package/src/definitions/index.d.ts +2 -0
  115. package/src/definitions/shared/index.d.ts +5 -0
  116. package/src/definitions/shared/lib/available-fields.d.ts +36 -0
  117. package/src/definitions/shared/lib/compilers/index.d.ts +7 -0
  118. package/src/definitions/shared/lib/registry/compile.d.ts +2 -0
  119. package/src/definitions/shared/lib/registry/descriptor-registry.d.ts +587 -0
  120. package/src/definitions/shared/lib/registry/index.d.ts +3 -0
  121. package/src/definitions/shared/lib/registry/validation.d.ts +3 -0
  122. package/src/definitions/shared/lib/schemas/app-filter-bar.schema.d.ts +22 -0
  123. package/src/definitions/shared/lib/schemas/bar.schema.d.ts +73 -0
  124. package/src/definitions/shared/lib/schemas/broad-chart.schema.d.ts +68 -0
  125. package/src/definitions/shared/lib/schemas/common.schema.d.ts +304 -0
  126. package/src/definitions/shared/lib/schemas/filter.schema.d.ts +22 -0
  127. package/src/definitions/shared/lib/schemas/index.d.ts +9 -0
  128. package/src/definitions/shared/lib/schemas/line.schema.d.ts +72 -0
  129. package/src/definitions/shared/lib/schemas/number.schema.d.ts +21 -0
  130. package/src/definitions/shared/lib/schemas/object.schema.d.ts +215 -0
  131. package/src/definitions/shared/lib/schemas/table.schema.d.ts +458 -0
  132. package/src/definitions/shared/lib/types/compilation.types.d.ts +36 -0
  133. package/src/definitions/shared/lib/types/definition.types.d.ts +2 -0
  134. package/src/definitions/shared/lib/types/descriptor.types.d.ts +39 -0
  135. package/src/definitions/shared/lib/types/index.d.ts +3 -0
  136. package/src/getters/index.d.ts +30 -0
  137. package/src/index.d.ts +4 -0
  138. package/src/metadata/index.d.ts +4 -0
  139. package/src/operations/index.d.ts +30 -0
  140. package/src/registry/index.d.ts +6 -0
  141. package/src/runtime/index.d.ts +2 -0
  142. package/src/types.d.ts +307 -0
  143. package/src/visualization-catalog.d.ts +82 -0
  144. package/src/web-components/index.d.ts +12 -0
  145. package/styles.css +2 -0
@@ -0,0 +1,4619 @@
1
+ import { o as e, t } from "./rolldown-runtime-DleVn1XH.js";
2
+ import { Eo as n, ds as r, ja as i, nc as a, oc as o, qs as s, sc as c } from "./interfaces-VUY4_yVO.js";
3
+ import { Ai as l, Di as u, Ei as d, Ki as f, Mn as p, Nn as m, Oi as h, Pn as g, Qn as _, Ti as v, Ui as y, Z as b, _ as x, d as ee, ji as S, ki as C, wi as w, xn as te } from "./utils-Ba9T0TqC.js";
4
+ import { P as ne, a as re, c as ie, d as ae, i as T, l as oe, o as E, s as D, u as O } from "./ui-D1HQNIBy.js";
5
+ import { t as k } from "./typeof-CJDtcySz.js";
6
+ var A = /* @__PURE__ */ t(((e, t) => {
7
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.default = n;
8
+ function n(e, t) {
9
+ if (t.length < e) throw TypeError(e + " argument" + (e > 1 ? "s" : "") + " required, but only " + t.length + " present");
10
+ }
11
+ t.exports = e.default;
12
+ })), j = /* @__PURE__ */ t(((e, t) => {
13
+ var n = b().default;
14
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.default = a;
15
+ var r = n(k()), i = n(A());
16
+ function a(e) {
17
+ return (0, i.default)(1, arguments), e instanceof Date || (0, r.default)(e) === "object" && Object.prototype.toString.call(e) === "[object Date]";
18
+ }
19
+ t.exports = e.default;
20
+ })), M = /* @__PURE__ */ t(((e, t) => {
21
+ var n = b().default;
22
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.default = a;
23
+ var r = n(k()), i = n(A());
24
+ function a(e) {
25
+ (0, i.default)(1, arguments);
26
+ var t = Object.prototype.toString.call(e);
27
+ return e instanceof Date || (0, r.default)(e) === "object" && t === "[object Date]" ? new Date(e.getTime()) : typeof e == "number" || t === "[object Number]" ? new Date(e) : ((typeof e == "string" || t === "[object String]") && typeof console < "u" && (console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"), console.warn((/* @__PURE__ */ Error()).stack)), /* @__PURE__ */ new Date(NaN));
28
+ }
29
+ t.exports = e.default;
30
+ })), N = /* @__PURE__ */ t(((e, t) => {
31
+ var n = b().default;
32
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.default = o;
33
+ var r = n(j()), i = n(M()), a = n(A());
34
+ function o(e) {
35
+ if ((0, a.default)(1, arguments), !(0, r.default)(e) && typeof e != "number") return !1;
36
+ var t = (0, i.default)(e);
37
+ return !isNaN(Number(t));
38
+ }
39
+ t.exports = e.default;
40
+ })), se = /* @__PURE__ */ t(((e, t) => {
41
+ var n = b().default;
42
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.default = o;
43
+ var r = n(C()), i = n(M()), a = n(A());
44
+ function o(e, t) {
45
+ (0, a.default)(2, arguments);
46
+ var n = (0, i.default)(e).getTime(), o = (0, r.default)(t);
47
+ return new Date(n + o);
48
+ }
49
+ t.exports = e.default;
50
+ })), ce = /* @__PURE__ */ t(((e, t) => {
51
+ var n = b().default;
52
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.default = o;
53
+ var r = n(se()), i = n(A()), a = n(C());
54
+ function o(e, t) {
55
+ (0, i.default)(2, arguments);
56
+ var n = (0, a.default)(t);
57
+ return (0, r.default)(e, -n);
58
+ }
59
+ t.exports = e.default;
60
+ })), P = /* @__PURE__ */ t(((e, t) => {
61
+ var n = b().default;
62
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.default = o;
63
+ var r = n(M()), i = n(A()), a = 864e5;
64
+ function o(e) {
65
+ (0, i.default)(1, arguments);
66
+ var t = (0, r.default)(e), n = t.getTime();
67
+ t.setUTCMonth(0, 1), t.setUTCHours(0, 0, 0, 0);
68
+ var o = n - t.getTime();
69
+ return Math.floor(o / a) + 1;
70
+ }
71
+ t.exports = e.default;
72
+ })), F = /* @__PURE__ */ t(((e, t) => {
73
+ var n = b().default;
74
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.default = a;
75
+ var r = n(M()), i = n(A());
76
+ function a(e) {
77
+ (0, i.default)(1, arguments);
78
+ var t = 1, n = (0, r.default)(e), a = n.getUTCDay(), o = (a < t ? 7 : 0) + a - t;
79
+ return n.setUTCDate(n.getUTCDate() - o), n.setUTCHours(0, 0, 0, 0), n;
80
+ }
81
+ t.exports = e.default;
82
+ })), le = /* @__PURE__ */ t(((e, t) => {
83
+ var n = b().default;
84
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.default = o;
85
+ var r = n(M()), i = n(A()), a = n(F());
86
+ function o(e) {
87
+ (0, i.default)(1, arguments);
88
+ var t = (0, r.default)(e), n = t.getUTCFullYear(), o = /* @__PURE__ */ new Date(0);
89
+ o.setUTCFullYear(n + 1, 0, 4), o.setUTCHours(0, 0, 0, 0);
90
+ var s = (0, a.default)(o), c = /* @__PURE__ */ new Date(0);
91
+ c.setUTCFullYear(n, 0, 4), c.setUTCHours(0, 0, 0, 0);
92
+ var l = (0, a.default)(c);
93
+ return t.getTime() >= s.getTime() ? n + 1 : t.getTime() >= l.getTime() ? n : n - 1;
94
+ }
95
+ t.exports = e.default;
96
+ })), I = /* @__PURE__ */ t(((e, t) => {
97
+ var n = b().default;
98
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.default = o;
99
+ var r = n(le()), i = n(F()), a = n(A());
100
+ function o(e) {
101
+ (0, a.default)(1, arguments);
102
+ var t = (0, r.default)(e), n = /* @__PURE__ */ new Date(0);
103
+ return n.setUTCFullYear(t, 0, 4), n.setUTCHours(0, 0, 0, 0), (0, i.default)(n);
104
+ }
105
+ t.exports = e.default;
106
+ })), L = /* @__PURE__ */ t(((e, t) => {
107
+ var n = b().default;
108
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.default = c;
109
+ var r = n(M()), i = n(F()), a = n(I()), o = n(A()), s = 6048e5;
110
+ function c(e) {
111
+ (0, o.default)(1, arguments);
112
+ var t = (0, r.default)(e), n = (0, i.default)(t).getTime() - (0, a.default)(t).getTime();
113
+ return Math.round(n / s) + 1;
114
+ }
115
+ t.exports = e.default;
116
+ })), R = /* @__PURE__ */ t(((e) => {
117
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.getDefaultOptions = n, e.setDefaultOptions = r;
118
+ var t = {};
119
+ function n() {
120
+ return t;
121
+ }
122
+ function r(e) {
123
+ t = e;
124
+ }
125
+ })), z = /* @__PURE__ */ t(((e, t) => {
126
+ var n = b().default;
127
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.default = s;
128
+ var r = n(M()), i = n(A()), a = n(C()), o = R();
129
+ function s(e, t) {
130
+ var n;
131
+ (0, i.default)(1, arguments);
132
+ var s = (0, o.getDefaultOptions)(), c = (0, a.default)(t?.weekStartsOn ?? (t == null || (n = t.locale) == null ? void 0 : n.options?.weekStartsOn) ?? s.weekStartsOn ?? s.locale?.options?.weekStartsOn ?? 0);
133
+ if (!(c >= 0 && c <= 6)) throw RangeError("weekStartsOn must be between 0 and 6 inclusively");
134
+ var l = (0, r.default)(e), u = l.getUTCDay(), d = (u < c ? 7 : 0) + u - c;
135
+ return l.setUTCDate(l.getUTCDate() - d), l.setUTCHours(0, 0, 0, 0), l;
136
+ }
137
+ t.exports = e.default;
138
+ })), ue = /* @__PURE__ */ t(((e, t) => {
139
+ var n = b().default;
140
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.default = c;
141
+ var r = n(M()), i = n(A()), a = n(z()), o = n(C()), s = R();
142
+ function c(e, t) {
143
+ var n;
144
+ (0, i.default)(1, arguments);
145
+ var c = (0, r.default)(e), l = c.getUTCFullYear(), u = (0, s.getDefaultOptions)(), d = (0, o.default)(t?.firstWeekContainsDate ?? (t == null || (n = t.locale) == null ? void 0 : n.options?.firstWeekContainsDate) ?? u.firstWeekContainsDate ?? u.locale?.options?.firstWeekContainsDate ?? 1);
146
+ if (!(d >= 1 && d <= 7)) throw RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");
147
+ var f = /* @__PURE__ */ new Date(0);
148
+ f.setUTCFullYear(l + 1, 0, d), f.setUTCHours(0, 0, 0, 0);
149
+ var p = (0, a.default)(f, t), m = /* @__PURE__ */ new Date(0);
150
+ m.setUTCFullYear(l, 0, d), m.setUTCHours(0, 0, 0, 0);
151
+ var h = (0, a.default)(m, t);
152
+ return c.getTime() >= p.getTime() ? l + 1 : c.getTime() >= h.getTime() ? l : l - 1;
153
+ }
154
+ t.exports = e.default;
155
+ })), de = /* @__PURE__ */ t(((e, t) => {
156
+ var n = b().default;
157
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.default = c;
158
+ var r = n(ue()), i = n(A()), a = n(z()), o = n(C()), s = R();
159
+ function c(e, t) {
160
+ var n;
161
+ (0, i.default)(1, arguments);
162
+ var c = (0, s.getDefaultOptions)(), l = (0, o.default)(t?.firstWeekContainsDate ?? (t == null || (n = t.locale) == null ? void 0 : n.options?.firstWeekContainsDate) ?? c.firstWeekContainsDate ?? c.locale?.options?.firstWeekContainsDate ?? 1), u = (0, r.default)(e, t), d = /* @__PURE__ */ new Date(0);
163
+ return d.setUTCFullYear(u, 0, l), d.setUTCHours(0, 0, 0, 0), (0, a.default)(d, t);
164
+ }
165
+ t.exports = e.default;
166
+ })), fe = /* @__PURE__ */ t(((e, t) => {
167
+ var n = b().default;
168
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.default = c;
169
+ var r = n(M()), i = n(z()), a = n(de()), o = n(A()), s = 6048e5;
170
+ function c(e, t) {
171
+ (0, o.default)(1, arguments);
172
+ var n = (0, r.default)(e), c = (0, i.default)(n, t).getTime() - (0, a.default)(n, t).getTime();
173
+ return Math.round(c / s) + 1;
174
+ }
175
+ t.exports = e.default;
176
+ })), pe = /* @__PURE__ */ t(((e, t) => {
177
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.default = n;
178
+ function n(e, t) {
179
+ for (var n = e < 0 ? "-" : "", r = Math.abs(e).toString(); r.length < t;) r = "0" + r;
180
+ return n + r;
181
+ }
182
+ t.exports = e.default;
183
+ })), me = /* @__PURE__ */ t(((e, t) => {
184
+ var n = b().default;
185
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.default = void 0;
186
+ var r = n(pe());
187
+ e.default = {
188
+ y: function(e, t) {
189
+ var n = e.getUTCFullYear(), i = n > 0 ? n : 1 - n;
190
+ return (0, r.default)(t === "yy" ? i % 100 : i, t.length);
191
+ },
192
+ M: function(e, t) {
193
+ var n = e.getUTCMonth();
194
+ return t === "M" ? String(n + 1) : (0, r.default)(n + 1, 2);
195
+ },
196
+ d: function(e, t) {
197
+ return (0, r.default)(e.getUTCDate(), t.length);
198
+ },
199
+ a: function(e, t) {
200
+ var n = e.getUTCHours() / 12 >= 1 ? "pm" : "am";
201
+ switch (t) {
202
+ case "a":
203
+ case "aa": return n.toUpperCase();
204
+ case "aaa": return n;
205
+ case "aaaaa": return n[0];
206
+ default: return n === "am" ? "a.m." : "p.m.";
207
+ }
208
+ },
209
+ h: function(e, t) {
210
+ return (0, r.default)(e.getUTCHours() % 12 || 12, t.length);
211
+ },
212
+ H: function(e, t) {
213
+ return (0, r.default)(e.getUTCHours(), t.length);
214
+ },
215
+ m: function(e, t) {
216
+ return (0, r.default)(e.getUTCMinutes(), t.length);
217
+ },
218
+ s: function(e, t) {
219
+ return (0, r.default)(e.getUTCSeconds(), t.length);
220
+ },
221
+ S: function(e, t) {
222
+ var n = t.length, i = e.getUTCMilliseconds(), a = Math.floor(i * 10 ** (n - 3));
223
+ return (0, r.default)(a, t.length);
224
+ }
225
+ }, t.exports = e.default;
226
+ })), he = /* @__PURE__ */ t(((e, t) => {
227
+ var n = b().default;
228
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.default = void 0;
229
+ var r = n(P()), i = n(L()), a = n(le()), o = n(fe()), s = n(ue()), c = n(pe()), l = n(me()), u = {
230
+ am: "am",
231
+ pm: "pm",
232
+ midnight: "midnight",
233
+ noon: "noon",
234
+ morning: "morning",
235
+ afternoon: "afternoon",
236
+ evening: "evening",
237
+ night: "night"
238
+ }, d = {
239
+ G: function(e, t, n) {
240
+ var r = +(e.getUTCFullYear() > 0);
241
+ switch (t) {
242
+ case "G":
243
+ case "GG":
244
+ case "GGG": return n.era(r, { width: "abbreviated" });
245
+ case "GGGGG": return n.era(r, { width: "narrow" });
246
+ default: return n.era(r, { width: "wide" });
247
+ }
248
+ },
249
+ y: function(e, t, n) {
250
+ if (t === "yo") {
251
+ var r = e.getUTCFullYear(), i = r > 0 ? r : 1 - r;
252
+ return n.ordinalNumber(i, { unit: "year" });
253
+ }
254
+ return l.default.y(e, t);
255
+ },
256
+ Y: function(e, t, n, r) {
257
+ var i = (0, s.default)(e, r), a = i > 0 ? i : 1 - i;
258
+ if (t === "YY") {
259
+ var o = a % 100;
260
+ return (0, c.default)(o, 2);
261
+ }
262
+ return t === "Yo" ? n.ordinalNumber(a, { unit: "year" }) : (0, c.default)(a, t.length);
263
+ },
264
+ R: function(e, t) {
265
+ var n = (0, a.default)(e);
266
+ return (0, c.default)(n, t.length);
267
+ },
268
+ u: function(e, t) {
269
+ var n = e.getUTCFullYear();
270
+ return (0, c.default)(n, t.length);
271
+ },
272
+ Q: function(e, t, n) {
273
+ var r = Math.ceil((e.getUTCMonth() + 1) / 3);
274
+ switch (t) {
275
+ case "Q": return String(r);
276
+ case "QQ": return (0, c.default)(r, 2);
277
+ case "Qo": return n.ordinalNumber(r, { unit: "quarter" });
278
+ case "QQQ": return n.quarter(r, {
279
+ width: "abbreviated",
280
+ context: "formatting"
281
+ });
282
+ case "QQQQQ": return n.quarter(r, {
283
+ width: "narrow",
284
+ context: "formatting"
285
+ });
286
+ default: return n.quarter(r, {
287
+ width: "wide",
288
+ context: "formatting"
289
+ });
290
+ }
291
+ },
292
+ q: function(e, t, n) {
293
+ var r = Math.ceil((e.getUTCMonth() + 1) / 3);
294
+ switch (t) {
295
+ case "q": return String(r);
296
+ case "qq": return (0, c.default)(r, 2);
297
+ case "qo": return n.ordinalNumber(r, { unit: "quarter" });
298
+ case "qqq": return n.quarter(r, {
299
+ width: "abbreviated",
300
+ context: "standalone"
301
+ });
302
+ case "qqqqq": return n.quarter(r, {
303
+ width: "narrow",
304
+ context: "standalone"
305
+ });
306
+ default: return n.quarter(r, {
307
+ width: "wide",
308
+ context: "standalone"
309
+ });
310
+ }
311
+ },
312
+ M: function(e, t, n) {
313
+ var r = e.getUTCMonth();
314
+ switch (t) {
315
+ case "M":
316
+ case "MM": return l.default.M(e, t);
317
+ case "Mo": return n.ordinalNumber(r + 1, { unit: "month" });
318
+ case "MMM": return n.month(r, {
319
+ width: "abbreviated",
320
+ context: "formatting"
321
+ });
322
+ case "MMMMM": return n.month(r, {
323
+ width: "narrow",
324
+ context: "formatting"
325
+ });
326
+ default: return n.month(r, {
327
+ width: "wide",
328
+ context: "formatting"
329
+ });
330
+ }
331
+ },
332
+ L: function(e, t, n) {
333
+ var r = e.getUTCMonth();
334
+ switch (t) {
335
+ case "L": return String(r + 1);
336
+ case "LL": return (0, c.default)(r + 1, 2);
337
+ case "Lo": return n.ordinalNumber(r + 1, { unit: "month" });
338
+ case "LLL": return n.month(r, {
339
+ width: "abbreviated",
340
+ context: "standalone"
341
+ });
342
+ case "LLLLL": return n.month(r, {
343
+ width: "narrow",
344
+ context: "standalone"
345
+ });
346
+ default: return n.month(r, {
347
+ width: "wide",
348
+ context: "standalone"
349
+ });
350
+ }
351
+ },
352
+ w: function(e, t, n, r) {
353
+ var i = (0, o.default)(e, r);
354
+ return t === "wo" ? n.ordinalNumber(i, { unit: "week" }) : (0, c.default)(i, t.length);
355
+ },
356
+ I: function(e, t, n) {
357
+ var r = (0, i.default)(e);
358
+ return t === "Io" ? n.ordinalNumber(r, { unit: "week" }) : (0, c.default)(r, t.length);
359
+ },
360
+ d: function(e, t, n) {
361
+ return t === "do" ? n.ordinalNumber(e.getUTCDate(), { unit: "date" }) : l.default.d(e, t);
362
+ },
363
+ D: function(e, t, n) {
364
+ var i = (0, r.default)(e);
365
+ return t === "Do" ? n.ordinalNumber(i, { unit: "dayOfYear" }) : (0, c.default)(i, t.length);
366
+ },
367
+ E: function(e, t, n) {
368
+ var r = e.getUTCDay();
369
+ switch (t) {
370
+ case "E":
371
+ case "EE":
372
+ case "EEE": return n.day(r, {
373
+ width: "abbreviated",
374
+ context: "formatting"
375
+ });
376
+ case "EEEEE": return n.day(r, {
377
+ width: "narrow",
378
+ context: "formatting"
379
+ });
380
+ case "EEEEEE": return n.day(r, {
381
+ width: "short",
382
+ context: "formatting"
383
+ });
384
+ default: return n.day(r, {
385
+ width: "wide",
386
+ context: "formatting"
387
+ });
388
+ }
389
+ },
390
+ e: function(e, t, n, r) {
391
+ var i = e.getUTCDay(), a = (i - r.weekStartsOn + 8) % 7 || 7;
392
+ switch (t) {
393
+ case "e": return String(a);
394
+ case "ee": return (0, c.default)(a, 2);
395
+ case "eo": return n.ordinalNumber(a, { unit: "day" });
396
+ case "eee": return n.day(i, {
397
+ width: "abbreviated",
398
+ context: "formatting"
399
+ });
400
+ case "eeeee": return n.day(i, {
401
+ width: "narrow",
402
+ context: "formatting"
403
+ });
404
+ case "eeeeee": return n.day(i, {
405
+ width: "short",
406
+ context: "formatting"
407
+ });
408
+ default: return n.day(i, {
409
+ width: "wide",
410
+ context: "formatting"
411
+ });
412
+ }
413
+ },
414
+ c: function(e, t, n, r) {
415
+ var i = e.getUTCDay(), a = (i - r.weekStartsOn + 8) % 7 || 7;
416
+ switch (t) {
417
+ case "c": return String(a);
418
+ case "cc": return (0, c.default)(a, t.length);
419
+ case "co": return n.ordinalNumber(a, { unit: "day" });
420
+ case "ccc": return n.day(i, {
421
+ width: "abbreviated",
422
+ context: "standalone"
423
+ });
424
+ case "ccccc": return n.day(i, {
425
+ width: "narrow",
426
+ context: "standalone"
427
+ });
428
+ case "cccccc": return n.day(i, {
429
+ width: "short",
430
+ context: "standalone"
431
+ });
432
+ default: return n.day(i, {
433
+ width: "wide",
434
+ context: "standalone"
435
+ });
436
+ }
437
+ },
438
+ i: function(e, t, n) {
439
+ var r = e.getUTCDay(), i = r === 0 ? 7 : r;
440
+ switch (t) {
441
+ case "i": return String(i);
442
+ case "ii": return (0, c.default)(i, t.length);
443
+ case "io": return n.ordinalNumber(i, { unit: "day" });
444
+ case "iii": return n.day(r, {
445
+ width: "abbreviated",
446
+ context: "formatting"
447
+ });
448
+ case "iiiii": return n.day(r, {
449
+ width: "narrow",
450
+ context: "formatting"
451
+ });
452
+ case "iiiiii": return n.day(r, {
453
+ width: "short",
454
+ context: "formatting"
455
+ });
456
+ default: return n.day(r, {
457
+ width: "wide",
458
+ context: "formatting"
459
+ });
460
+ }
461
+ },
462
+ a: function(e, t, n) {
463
+ var r = e.getUTCHours() / 12 >= 1 ? "pm" : "am";
464
+ switch (t) {
465
+ case "a":
466
+ case "aa": return n.dayPeriod(r, {
467
+ width: "abbreviated",
468
+ context: "formatting"
469
+ });
470
+ case "aaa": return n.dayPeriod(r, {
471
+ width: "abbreviated",
472
+ context: "formatting"
473
+ }).toLowerCase();
474
+ case "aaaaa": return n.dayPeriod(r, {
475
+ width: "narrow",
476
+ context: "formatting"
477
+ });
478
+ default: return n.dayPeriod(r, {
479
+ width: "wide",
480
+ context: "formatting"
481
+ });
482
+ }
483
+ },
484
+ b: function(e, t, n) {
485
+ var r = e.getUTCHours(), i = r === 12 ? u.noon : r === 0 ? u.midnight : r / 12 >= 1 ? "pm" : "am";
486
+ switch (t) {
487
+ case "b":
488
+ case "bb": return n.dayPeriod(i, {
489
+ width: "abbreviated",
490
+ context: "formatting"
491
+ });
492
+ case "bbb": return n.dayPeriod(i, {
493
+ width: "abbreviated",
494
+ context: "formatting"
495
+ }).toLowerCase();
496
+ case "bbbbb": return n.dayPeriod(i, {
497
+ width: "narrow",
498
+ context: "formatting"
499
+ });
500
+ default: return n.dayPeriod(i, {
501
+ width: "wide",
502
+ context: "formatting"
503
+ });
504
+ }
505
+ },
506
+ B: function(e, t, n) {
507
+ var r = e.getUTCHours(), i = r >= 17 ? u.evening : r >= 12 ? u.afternoon : r >= 4 ? u.morning : u.night;
508
+ switch (t) {
509
+ case "B":
510
+ case "BB":
511
+ case "BBB": return n.dayPeriod(i, {
512
+ width: "abbreviated",
513
+ context: "formatting"
514
+ });
515
+ case "BBBBB": return n.dayPeriod(i, {
516
+ width: "narrow",
517
+ context: "formatting"
518
+ });
519
+ default: return n.dayPeriod(i, {
520
+ width: "wide",
521
+ context: "formatting"
522
+ });
523
+ }
524
+ },
525
+ h: function(e, t, n) {
526
+ if (t === "ho") {
527
+ var r = e.getUTCHours() % 12;
528
+ return r === 0 && (r = 12), n.ordinalNumber(r, { unit: "hour" });
529
+ }
530
+ return l.default.h(e, t);
531
+ },
532
+ H: function(e, t, n) {
533
+ return t === "Ho" ? n.ordinalNumber(e.getUTCHours(), { unit: "hour" }) : l.default.H(e, t);
534
+ },
535
+ K: function(e, t, n) {
536
+ var r = e.getUTCHours() % 12;
537
+ return t === "Ko" ? n.ordinalNumber(r, { unit: "hour" }) : (0, c.default)(r, t.length);
538
+ },
539
+ k: function(e, t, n) {
540
+ var r = e.getUTCHours();
541
+ return r === 0 && (r = 24), t === "ko" ? n.ordinalNumber(r, { unit: "hour" }) : (0, c.default)(r, t.length);
542
+ },
543
+ m: function(e, t, n) {
544
+ return t === "mo" ? n.ordinalNumber(e.getUTCMinutes(), { unit: "minute" }) : l.default.m(e, t);
545
+ },
546
+ s: function(e, t, n) {
547
+ return t === "so" ? n.ordinalNumber(e.getUTCSeconds(), { unit: "second" }) : l.default.s(e, t);
548
+ },
549
+ S: function(e, t) {
550
+ return l.default.S(e, t);
551
+ },
552
+ X: function(e, t, n, r) {
553
+ var i = (r._originalDate || e).getTimezoneOffset();
554
+ if (i === 0) return "Z";
555
+ switch (t) {
556
+ case "X": return p(i);
557
+ case "XXXX":
558
+ case "XX": return m(i);
559
+ default: return m(i, ":");
560
+ }
561
+ },
562
+ x: function(e, t, n, r) {
563
+ var i = (r._originalDate || e).getTimezoneOffset();
564
+ switch (t) {
565
+ case "x": return p(i);
566
+ case "xxxx":
567
+ case "xx": return m(i);
568
+ default: return m(i, ":");
569
+ }
570
+ },
571
+ O: function(e, t, n, r) {
572
+ var i = (r._originalDate || e).getTimezoneOffset();
573
+ switch (t) {
574
+ case "O":
575
+ case "OO":
576
+ case "OOO": return "GMT" + f(i, ":");
577
+ default: return "GMT" + m(i, ":");
578
+ }
579
+ },
580
+ z: function(e, t, n, r) {
581
+ var i = (r._originalDate || e).getTimezoneOffset();
582
+ switch (t) {
583
+ case "z":
584
+ case "zz":
585
+ case "zzz": return "GMT" + f(i, ":");
586
+ default: return "GMT" + m(i, ":");
587
+ }
588
+ },
589
+ t: function(e, t, n, r) {
590
+ var i = r._originalDate || e, a = Math.floor(i.getTime() / 1e3);
591
+ return (0, c.default)(a, t.length);
592
+ },
593
+ T: function(e, t, n, r) {
594
+ var i = (r._originalDate || e).getTime();
595
+ return (0, c.default)(i, t.length);
596
+ }
597
+ };
598
+ function f(e, t) {
599
+ var n = e > 0 ? "-" : "+", r = Math.abs(e), i = Math.floor(r / 60), a = r % 60;
600
+ if (a === 0) return n + String(i);
601
+ var o = t || "";
602
+ return n + String(i) + o + (0, c.default)(a, 2);
603
+ }
604
+ function p(e, t) {
605
+ return e % 60 == 0 ? (e > 0 ? "-" : "+") + (0, c.default)(Math.abs(e) / 60, 2) : m(e, t);
606
+ }
607
+ function m(e, t) {
608
+ var n = t || "", r = e > 0 ? "-" : "+", i = Math.abs(e), a = (0, c.default)(Math.floor(i / 60), 2), o = (0, c.default)(i % 60, 2);
609
+ return r + a + n + o;
610
+ }
611
+ e.default = d, t.exports = e.default;
612
+ })), ge = /* @__PURE__ */ t(((e, t) => {
613
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.default = void 0;
614
+ var n = function(e, t) {
615
+ switch (e) {
616
+ case "P": return t.date({ width: "short" });
617
+ case "PP": return t.date({ width: "medium" });
618
+ case "PPP": return t.date({ width: "long" });
619
+ default: return t.date({ width: "full" });
620
+ }
621
+ }, r = function(e, t) {
622
+ switch (e) {
623
+ case "p": return t.time({ width: "short" });
624
+ case "pp": return t.time({ width: "medium" });
625
+ case "ppp": return t.time({ width: "long" });
626
+ default: return t.time({ width: "full" });
627
+ }
628
+ };
629
+ e.default = {
630
+ p: r,
631
+ P: function(e, t) {
632
+ var i = e.match(/(P+)(p+)?/) || [], a = i[1], o = i[2];
633
+ if (!o) return n(e, t);
634
+ var s;
635
+ switch (a) {
636
+ case "P":
637
+ s = t.dateTime({ width: "short" });
638
+ break;
639
+ case "PP":
640
+ s = t.dateTime({ width: "medium" });
641
+ break;
642
+ case "PPP":
643
+ s = t.dateTime({ width: "long" });
644
+ break;
645
+ default:
646
+ s = t.dateTime({ width: "full" });
647
+ break;
648
+ }
649
+ return s.replace("{{date}}", n(a, t)).replace("{{time}}", r(o, t));
650
+ }
651
+ }, t.exports = e.default;
652
+ })), B = /* @__PURE__ */ t(((e) => {
653
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.isProtectedDayOfYearToken = r, e.isProtectedWeekYearToken = i, e.throwProtectedError = a;
654
+ var t = ["D", "DD"], n = ["YY", "YYYY"];
655
+ function r(e) {
656
+ return t.indexOf(e) !== -1;
657
+ }
658
+ function i(e) {
659
+ return n.indexOf(e) !== -1;
660
+ }
661
+ function a(e, t, n) {
662
+ if (e === "YYYY") throw RangeError(`Use \`yyyy\` instead of \`YYYY\` (in \`${t}\`) for formatting years to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`);
663
+ if (e === "YY") throw RangeError(`Use \`yy\` instead of \`YY\` (in \`${t}\`) for formatting years to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`);
664
+ if (e === "D") throw RangeError(`Use \`d\` instead of \`D\` (in \`${t}\`) for formatting days of the month to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`);
665
+ if (e === "DD") throw RangeError(`Use \`dd\` instead of \`DD\` (in \`${t}\`) for formatting days of the month to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`);
666
+ }
667
+ })), _e = /* @__PURE__ */ t(((e, t) => {
668
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.default = void 0;
669
+ var n = {
670
+ lessThanXSeconds: {
671
+ one: "less than a second",
672
+ other: "less than {{count}} seconds"
673
+ },
674
+ xSeconds: {
675
+ one: "1 second",
676
+ other: "{{count}} seconds"
677
+ },
678
+ halfAMinute: "half a minute",
679
+ lessThanXMinutes: {
680
+ one: "less than a minute",
681
+ other: "less than {{count}} minutes"
682
+ },
683
+ xMinutes: {
684
+ one: "1 minute",
685
+ other: "{{count}} minutes"
686
+ },
687
+ aboutXHours: {
688
+ one: "about 1 hour",
689
+ other: "about {{count}} hours"
690
+ },
691
+ xHours: {
692
+ one: "1 hour",
693
+ other: "{{count}} hours"
694
+ },
695
+ xDays: {
696
+ one: "1 day",
697
+ other: "{{count}} days"
698
+ },
699
+ aboutXWeeks: {
700
+ one: "about 1 week",
701
+ other: "about {{count}} weeks"
702
+ },
703
+ xWeeks: {
704
+ one: "1 week",
705
+ other: "{{count}} weeks"
706
+ },
707
+ aboutXMonths: {
708
+ one: "about 1 month",
709
+ other: "about {{count}} months"
710
+ },
711
+ xMonths: {
712
+ one: "1 month",
713
+ other: "{{count}} months"
714
+ },
715
+ aboutXYears: {
716
+ one: "about 1 year",
717
+ other: "about {{count}} years"
718
+ },
719
+ xYears: {
720
+ one: "1 year",
721
+ other: "{{count}} years"
722
+ },
723
+ overXYears: {
724
+ one: "over 1 year",
725
+ other: "over {{count}} years"
726
+ },
727
+ almostXYears: {
728
+ one: "almost 1 year",
729
+ other: "almost {{count}} years"
730
+ }
731
+ };
732
+ e.default = function(e, t, r) {
733
+ var i, a = n[e];
734
+ return i = typeof a == "string" ? a : t === 1 ? a.one : a.other.replace("{{count}}", t.toString()), r != null && r.addSuffix ? r.comparison && r.comparison > 0 ? "in " + i : i + " ago" : i;
735
+ }, t.exports = e.default;
736
+ })), ve = /* @__PURE__ */ t(((e, t) => {
737
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.default = n;
738
+ function n(e) {
739
+ return function() {
740
+ var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, n = t.width ? String(t.width) : e.defaultWidth;
741
+ return e.formats[n] || e.formats[e.defaultWidth];
742
+ };
743
+ }
744
+ t.exports = e.default;
745
+ })), V = /* @__PURE__ */ t(((e, t) => {
746
+ var n = b().default;
747
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.default = void 0;
748
+ var r = n(ve());
749
+ e.default = {
750
+ date: (0, r.default)({
751
+ formats: {
752
+ full: "EEEE, MMMM do, y",
753
+ long: "MMMM do, y",
754
+ medium: "MMM d, y",
755
+ short: "MM/dd/yyyy"
756
+ },
757
+ defaultWidth: "full"
758
+ }),
759
+ time: (0, r.default)({
760
+ formats: {
761
+ full: "h:mm:ss a zzzz",
762
+ long: "h:mm:ss a z",
763
+ medium: "h:mm:ss a",
764
+ short: "h:mm a"
765
+ },
766
+ defaultWidth: "full"
767
+ }),
768
+ dateTime: (0, r.default)({
769
+ formats: {
770
+ full: "{{date}} 'at' {{time}}",
771
+ long: "{{date}} 'at' {{time}}",
772
+ medium: "{{date}}, {{time}}",
773
+ short: "{{date}}, {{time}}"
774
+ },
775
+ defaultWidth: "full"
776
+ })
777
+ }, t.exports = e.default;
778
+ })), ye = /* @__PURE__ */ t(((e, t) => {
779
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.default = void 0;
780
+ var n = {
781
+ lastWeek: "'last' eeee 'at' p",
782
+ yesterday: "'yesterday at' p",
783
+ today: "'today at' p",
784
+ tomorrow: "'tomorrow at' p",
785
+ nextWeek: "eeee 'at' p",
786
+ other: "P"
787
+ };
788
+ e.default = function(e, t, r, i) {
789
+ return n[e];
790
+ }, t.exports = e.default;
791
+ })), be = /* @__PURE__ */ t(((e, t) => {
792
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.default = n;
793
+ function n(e) {
794
+ return function(t, n) {
795
+ var r = n != null && n.context ? String(n.context) : "standalone", i;
796
+ if (r === "formatting" && e.formattingValues) {
797
+ var a = e.defaultFormattingWidth || e.defaultWidth, o = n != null && n.width ? String(n.width) : a;
798
+ i = e.formattingValues[o] || e.formattingValues[a];
799
+ } else {
800
+ var s = e.defaultWidth, c = n != null && n.width ? String(n.width) : e.defaultWidth;
801
+ i = e.values[c] || e.values[s];
802
+ }
803
+ var l = e.argumentCallback ? e.argumentCallback(t) : t;
804
+ return i[l];
805
+ };
806
+ }
807
+ t.exports = e.default;
808
+ })), H = /* @__PURE__ */ t(((e, t) => {
809
+ var n = b().default;
810
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.default = void 0;
811
+ var r = n(be());
812
+ e.default = {
813
+ ordinalNumber: function(e, t) {
814
+ var n = Number(e), r = n % 100;
815
+ if (r > 20 || r < 10) switch (r % 10) {
816
+ case 1: return n + "st";
817
+ case 2: return n + "nd";
818
+ case 3: return n + "rd";
819
+ }
820
+ return n + "th";
821
+ },
822
+ era: (0, r.default)({
823
+ values: {
824
+ narrow: ["B", "A"],
825
+ abbreviated: ["BC", "AD"],
826
+ wide: ["Before Christ", "Anno Domini"]
827
+ },
828
+ defaultWidth: "wide"
829
+ }),
830
+ quarter: (0, r.default)({
831
+ values: {
832
+ narrow: [
833
+ "1",
834
+ "2",
835
+ "3",
836
+ "4"
837
+ ],
838
+ abbreviated: [
839
+ "Q1",
840
+ "Q2",
841
+ "Q3",
842
+ "Q4"
843
+ ],
844
+ wide: [
845
+ "1st quarter",
846
+ "2nd quarter",
847
+ "3rd quarter",
848
+ "4th quarter"
849
+ ]
850
+ },
851
+ defaultWidth: "wide",
852
+ argumentCallback: function(e) {
853
+ return e - 1;
854
+ }
855
+ }),
856
+ month: (0, r.default)({
857
+ values: {
858
+ narrow: [
859
+ "J",
860
+ "F",
861
+ "M",
862
+ "A",
863
+ "M",
864
+ "J",
865
+ "J",
866
+ "A",
867
+ "S",
868
+ "O",
869
+ "N",
870
+ "D"
871
+ ],
872
+ abbreviated: [
873
+ "Jan",
874
+ "Feb",
875
+ "Mar",
876
+ "Apr",
877
+ "May",
878
+ "Jun",
879
+ "Jul",
880
+ "Aug",
881
+ "Sep",
882
+ "Oct",
883
+ "Nov",
884
+ "Dec"
885
+ ],
886
+ wide: [
887
+ "January",
888
+ "February",
889
+ "March",
890
+ "April",
891
+ "May",
892
+ "June",
893
+ "July",
894
+ "August",
895
+ "September",
896
+ "October",
897
+ "November",
898
+ "December"
899
+ ]
900
+ },
901
+ defaultWidth: "wide"
902
+ }),
903
+ day: (0, r.default)({
904
+ values: {
905
+ narrow: [
906
+ "S",
907
+ "M",
908
+ "T",
909
+ "W",
910
+ "T",
911
+ "F",
912
+ "S"
913
+ ],
914
+ short: [
915
+ "Su",
916
+ "Mo",
917
+ "Tu",
918
+ "We",
919
+ "Th",
920
+ "Fr",
921
+ "Sa"
922
+ ],
923
+ abbreviated: [
924
+ "Sun",
925
+ "Mon",
926
+ "Tue",
927
+ "Wed",
928
+ "Thu",
929
+ "Fri",
930
+ "Sat"
931
+ ],
932
+ wide: [
933
+ "Sunday",
934
+ "Monday",
935
+ "Tuesday",
936
+ "Wednesday",
937
+ "Thursday",
938
+ "Friday",
939
+ "Saturday"
940
+ ]
941
+ },
942
+ defaultWidth: "wide"
943
+ }),
944
+ dayPeriod: (0, r.default)({
945
+ values: {
946
+ narrow: {
947
+ am: "a",
948
+ pm: "p",
949
+ midnight: "mi",
950
+ noon: "n",
951
+ morning: "morning",
952
+ afternoon: "afternoon",
953
+ evening: "evening",
954
+ night: "night"
955
+ },
956
+ abbreviated: {
957
+ am: "AM",
958
+ pm: "PM",
959
+ midnight: "midnight",
960
+ noon: "noon",
961
+ morning: "morning",
962
+ afternoon: "afternoon",
963
+ evening: "evening",
964
+ night: "night"
965
+ },
966
+ wide: {
967
+ am: "a.m.",
968
+ pm: "p.m.",
969
+ midnight: "midnight",
970
+ noon: "noon",
971
+ morning: "morning",
972
+ afternoon: "afternoon",
973
+ evening: "evening",
974
+ night: "night"
975
+ }
976
+ },
977
+ defaultWidth: "wide",
978
+ formattingValues: {
979
+ narrow: {
980
+ am: "a",
981
+ pm: "p",
982
+ midnight: "mi",
983
+ noon: "n",
984
+ morning: "in the morning",
985
+ afternoon: "in the afternoon",
986
+ evening: "in the evening",
987
+ night: "at night"
988
+ },
989
+ abbreviated: {
990
+ am: "AM",
991
+ pm: "PM",
992
+ midnight: "midnight",
993
+ noon: "noon",
994
+ morning: "in the morning",
995
+ afternoon: "in the afternoon",
996
+ evening: "in the evening",
997
+ night: "at night"
998
+ },
999
+ wide: {
1000
+ am: "a.m.",
1001
+ pm: "p.m.",
1002
+ midnight: "midnight",
1003
+ noon: "noon",
1004
+ morning: "in the morning",
1005
+ afternoon: "in the afternoon",
1006
+ evening: "in the evening",
1007
+ night: "at night"
1008
+ }
1009
+ },
1010
+ defaultFormattingWidth: "wide"
1011
+ })
1012
+ }, t.exports = e.default;
1013
+ })), xe = /* @__PURE__ */ t(((e, t) => {
1014
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.default = n;
1015
+ function n(e) {
1016
+ return function(t) {
1017
+ var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, a = n.width, o = a && e.matchPatterns[a] || e.matchPatterns[e.defaultMatchWidth], s = t.match(o);
1018
+ if (!s) return null;
1019
+ var c = s[0], l = a && e.parsePatterns[a] || e.parsePatterns[e.defaultParseWidth], u = Array.isArray(l) ? i(l, function(e) {
1020
+ return e.test(c);
1021
+ }) : r(l, function(e) {
1022
+ return e.test(c);
1023
+ }), d = e.valueCallback ? e.valueCallback(u) : u;
1024
+ d = n.valueCallback ? n.valueCallback(d) : d;
1025
+ var f = t.slice(c.length);
1026
+ return {
1027
+ value: d,
1028
+ rest: f
1029
+ };
1030
+ };
1031
+ }
1032
+ function r(e, t) {
1033
+ for (var n in e) if (e.hasOwnProperty(n) && t(e[n])) return n;
1034
+ }
1035
+ function i(e, t) {
1036
+ for (var n = 0; n < e.length; n++) if (t(e[n])) return n;
1037
+ }
1038
+ t.exports = e.default;
1039
+ })), Se = /* @__PURE__ */ t(((e, t) => {
1040
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.default = n;
1041
+ function n(e) {
1042
+ return function(t) {
1043
+ var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r = t.match(e.matchPattern);
1044
+ if (!r) return null;
1045
+ var i = r[0], a = t.match(e.parsePattern);
1046
+ if (!a) return null;
1047
+ var o = e.valueCallback ? e.valueCallback(a[0]) : a[0];
1048
+ o = n.valueCallback ? n.valueCallback(o) : o;
1049
+ var s = t.slice(i.length);
1050
+ return {
1051
+ value: o,
1052
+ rest: s
1053
+ };
1054
+ };
1055
+ }
1056
+ t.exports = e.default;
1057
+ })), Ce = /* @__PURE__ */ t(((e, t) => {
1058
+ var n = b().default;
1059
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.default = void 0;
1060
+ var r = n(xe());
1061
+ e.default = {
1062
+ ordinalNumber: (0, n(Se()).default)({
1063
+ matchPattern: /^(\d+)(th|st|nd|rd)?/i,
1064
+ parsePattern: /\d+/i,
1065
+ valueCallback: function(e) {
1066
+ return parseInt(e, 10);
1067
+ }
1068
+ }),
1069
+ era: (0, r.default)({
1070
+ matchPatterns: {
1071
+ narrow: /^(b|a)/i,
1072
+ abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
1073
+ wide: /^(before christ|before common era|anno domini|common era)/i
1074
+ },
1075
+ defaultMatchWidth: "wide",
1076
+ parsePatterns: { any: [/^b/i, /^(a|c)/i] },
1077
+ defaultParseWidth: "any"
1078
+ }),
1079
+ quarter: (0, r.default)({
1080
+ matchPatterns: {
1081
+ narrow: /^[1234]/i,
1082
+ abbreviated: /^q[1234]/i,
1083
+ wide: /^[1234](th|st|nd|rd)? quarter/i
1084
+ },
1085
+ defaultMatchWidth: "wide",
1086
+ parsePatterns: { any: [
1087
+ /1/i,
1088
+ /2/i,
1089
+ /3/i,
1090
+ /4/i
1091
+ ] },
1092
+ defaultParseWidth: "any",
1093
+ valueCallback: function(e) {
1094
+ return e + 1;
1095
+ }
1096
+ }),
1097
+ month: (0, r.default)({
1098
+ matchPatterns: {
1099
+ narrow: /^[jfmasond]/i,
1100
+ abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
1101
+ wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
1102
+ },
1103
+ defaultMatchWidth: "wide",
1104
+ parsePatterns: {
1105
+ narrow: [
1106
+ /^j/i,
1107
+ /^f/i,
1108
+ /^m/i,
1109
+ /^a/i,
1110
+ /^m/i,
1111
+ /^j/i,
1112
+ /^j/i,
1113
+ /^a/i,
1114
+ /^s/i,
1115
+ /^o/i,
1116
+ /^n/i,
1117
+ /^d/i
1118
+ ],
1119
+ any: [
1120
+ /^ja/i,
1121
+ /^f/i,
1122
+ /^mar/i,
1123
+ /^ap/i,
1124
+ /^may/i,
1125
+ /^jun/i,
1126
+ /^jul/i,
1127
+ /^au/i,
1128
+ /^s/i,
1129
+ /^o/i,
1130
+ /^n/i,
1131
+ /^d/i
1132
+ ]
1133
+ },
1134
+ defaultParseWidth: "any"
1135
+ }),
1136
+ day: (0, r.default)({
1137
+ matchPatterns: {
1138
+ narrow: /^[smtwf]/i,
1139
+ short: /^(su|mo|tu|we|th|fr|sa)/i,
1140
+ abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
1141
+ wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
1142
+ },
1143
+ defaultMatchWidth: "wide",
1144
+ parsePatterns: {
1145
+ narrow: [
1146
+ /^s/i,
1147
+ /^m/i,
1148
+ /^t/i,
1149
+ /^w/i,
1150
+ /^t/i,
1151
+ /^f/i,
1152
+ /^s/i
1153
+ ],
1154
+ any: [
1155
+ /^su/i,
1156
+ /^m/i,
1157
+ /^tu/i,
1158
+ /^w/i,
1159
+ /^th/i,
1160
+ /^f/i,
1161
+ /^sa/i
1162
+ ]
1163
+ },
1164
+ defaultParseWidth: "any"
1165
+ }),
1166
+ dayPeriod: (0, r.default)({
1167
+ matchPatterns: {
1168
+ narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
1169
+ any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
1170
+ },
1171
+ defaultMatchWidth: "any",
1172
+ parsePatterns: { any: {
1173
+ am: /^a/i,
1174
+ pm: /^p/i,
1175
+ midnight: /^mi/i,
1176
+ noon: /^no/i,
1177
+ morning: /morning/i,
1178
+ afternoon: /afternoon/i,
1179
+ evening: /evening/i,
1180
+ night: /night/i
1181
+ } },
1182
+ defaultParseWidth: "any"
1183
+ })
1184
+ }, t.exports = e.default;
1185
+ })), we = /* @__PURE__ */ t(((e, t) => {
1186
+ var n = b().default;
1187
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.default = void 0;
1188
+ var r = n(_e()), i = n(V()), a = n(ye()), o = n(H()), s = n(Ce());
1189
+ e.default = {
1190
+ code: "en-US",
1191
+ formatDistance: r.default,
1192
+ formatLong: i.default,
1193
+ formatRelative: a.default,
1194
+ localize: o.default,
1195
+ match: s.default,
1196
+ options: {
1197
+ weekStartsOn: 0,
1198
+ firstWeekContainsDate: 1
1199
+ }
1200
+ }, t.exports = e.default;
1201
+ })), Te = /* @__PURE__ */ t(((e, t) => {
1202
+ var n = b().default;
1203
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.default = void 0, e.default = n(we()).default, t.exports = e.default;
1204
+ })), Ee = /* @__PURE__ */ t(((e, t) => {
1205
+ var n = b().default;
1206
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.default = x;
1207
+ var r = n(N()), i = n(ce()), a = n(M()), o = n(he()), s = n(ge()), c = n(h()), l = B(), u = n(C()), d = n(A()), f = R(), p = n(Te()), m = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, g = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, _ = /^'([^]*?)'?$/, v = /''/g, y = /[a-zA-Z]/;
1208
+ function x(e, t, n) {
1209
+ var h, _;
1210
+ (0, d.default)(2, arguments);
1211
+ var v = String(t), b = (0, f.getDefaultOptions)(), x = n?.locale ?? b.locale ?? p.default, S = (0, u.default)(n?.firstWeekContainsDate ?? (n == null || (h = n.locale) == null ? void 0 : h.options?.firstWeekContainsDate) ?? b.firstWeekContainsDate ?? b.locale?.options?.firstWeekContainsDate ?? 1);
1212
+ if (!(S >= 1 && S <= 7)) throw RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");
1213
+ var C = (0, u.default)(n?.weekStartsOn ?? (n == null || (_ = n.locale) == null ? void 0 : _.options?.weekStartsOn) ?? b.weekStartsOn ?? b.locale?.options?.weekStartsOn ?? 0);
1214
+ if (!(C >= 0 && C <= 6)) throw RangeError("weekStartsOn must be between 0 and 6 inclusively");
1215
+ if (!x.localize) throw RangeError("locale must contain localize property");
1216
+ if (!x.formatLong) throw RangeError("locale must contain formatLong property");
1217
+ var w = (0, a.default)(e);
1218
+ if (!(0, r.default)(w)) throw RangeError("Invalid time value");
1219
+ var te = (0, c.default)(w), ne = (0, i.default)(w, te), re = {
1220
+ firstWeekContainsDate: S,
1221
+ weekStartsOn: C,
1222
+ locale: x,
1223
+ _originalDate: w
1224
+ };
1225
+ return v.match(g).map(function(e) {
1226
+ var t = e[0];
1227
+ if (t === "p" || t === "P") {
1228
+ var n = s.default[t];
1229
+ return n(e, x.formatLong);
1230
+ }
1231
+ return e;
1232
+ }).join("").match(m).map(function(r) {
1233
+ if (r === "''") return "'";
1234
+ var i = r[0];
1235
+ if (i === "'") return ee(r);
1236
+ var a = o.default[i];
1237
+ if (a) return !(n != null && n.useAdditionalWeekYearTokens) && (0, l.isProtectedWeekYearToken)(r) && (0, l.throwProtectedError)(r, t, String(e)), !(n != null && n.useAdditionalDayOfYearTokens) && (0, l.isProtectedDayOfYearToken)(r) && (0, l.throwProtectedError)(r, t, String(e)), a(ne, r, x.localize, re);
1238
+ if (i.match(y)) throw RangeError("Format string contains an unescaped latin alphabet character `" + i + "`");
1239
+ return r;
1240
+ }).join("");
1241
+ }
1242
+ function ee(e) {
1243
+ var t = e.match(_);
1244
+ return t ? t[1].replace(v, "'") : e;
1245
+ }
1246
+ t.exports = e.default;
1247
+ }));
1248
+ function De(e, t, n) {
1249
+ var r = Ae(e, n.timeZone, n.locale);
1250
+ return r.formatToParts ? Oe(r, t) : ke(r, t);
1251
+ }
1252
+ function Oe(e, t) {
1253
+ for (var n = e.formatToParts(t), r = n.length - 1; r >= 0; --r) if (n[r].type === "timeZoneName") return n[r].value;
1254
+ }
1255
+ function ke(e, t) {
1256
+ var n = e.format(t).replace(/\u200E/g, ""), r = / [\w-+ ]+$/.exec(n);
1257
+ return r ? r[0].substr(1) : "";
1258
+ }
1259
+ function Ae(e, t, n) {
1260
+ if (n && !n.code) throw Error("date-fns-tz error: Please set a language code on the locale object imported from date-fns, e.g. `locale.code = 'en-US'`");
1261
+ return new Intl.DateTimeFormat(n ? [n.code, "en-US"] : void 0, {
1262
+ timeZone: t,
1263
+ timeZoneName: e
1264
+ });
1265
+ }
1266
+ var je = 60 * 1e3, Me = {
1267
+ X: function(e, t, n, r) {
1268
+ var i = Ne(r.timeZone, e);
1269
+ if (i === 0) return "Z";
1270
+ switch (t) {
1271
+ case "X": return Ie(i);
1272
+ case "XXXX":
1273
+ case "XX": return Fe(i);
1274
+ default: return Fe(i, ":");
1275
+ }
1276
+ },
1277
+ x: function(e, t, n, r) {
1278
+ var i = Ne(r.timeZone, e);
1279
+ switch (t) {
1280
+ case "x": return Ie(i);
1281
+ case "xxxx":
1282
+ case "xx": return Fe(i);
1283
+ default: return Fe(i, ":");
1284
+ }
1285
+ },
1286
+ O: function(e, t, n, r) {
1287
+ var i = Ne(r.timeZone, e);
1288
+ switch (t) {
1289
+ case "O":
1290
+ case "OO":
1291
+ case "OOO": return "GMT" + Le(i, ":");
1292
+ default: return "GMT" + Fe(i, ":");
1293
+ }
1294
+ },
1295
+ z: function(e, t, n, r) {
1296
+ switch (t) {
1297
+ case "z":
1298
+ case "zz":
1299
+ case "zzz": return De("short", e, r);
1300
+ default: return De("long", e, r);
1301
+ }
1302
+ }
1303
+ };
1304
+ function Ne(e, t) {
1305
+ var n = e ? l(e, t, !0) / je : t.getTimezoneOffset();
1306
+ if (Number.isNaN(n)) throw RangeError("Invalid time zone specified: " + e);
1307
+ return n;
1308
+ }
1309
+ function Pe(e, t) {
1310
+ for (var n = e < 0 ? "-" : "", r = Math.abs(e).toString(); r.length < t;) r = "0" + r;
1311
+ return n + r;
1312
+ }
1313
+ function Fe(e, t) {
1314
+ var n = t || "", r = e > 0 ? "-" : "+", i = Math.abs(e), a = Pe(Math.floor(i / 60), 2), o = Pe(Math.floor(i % 60), 2);
1315
+ return r + a + n + o;
1316
+ }
1317
+ function Ie(e, t) {
1318
+ return e % 60 == 0 ? (e > 0 ? "-" : "+") + Pe(Math.abs(e) / 60, 2) : Fe(e, t);
1319
+ }
1320
+ function Le(e, t) {
1321
+ var n = e > 0 ? "-" : "+", r = Math.abs(e), i = Math.floor(r / 60), a = r % 60;
1322
+ if (a === 0) return n + String(i);
1323
+ var o = t || "";
1324
+ return n + String(i) + o + Pe(a, 2);
1325
+ }
1326
+ var Re = /* @__PURE__ */ e(Ee()), ze = /([xXOz]+)|''|'(''|[^'])+('|$)/g;
1327
+ function Be(e, t, n) {
1328
+ var r = String(t), i = n || {}, a = r.match(ze);
1329
+ if (a) {
1330
+ var o = d(i.originalDate || e, i);
1331
+ r = a.reduce(function(e, t) {
1332
+ if (t[0] === "'") return e;
1333
+ var n = e.indexOf(t), r = e[n - 1] === "'", a = e.replace(t, "'" + Me[t[0]](o, t, null, i) + "'");
1334
+ return r ? a.substring(0, n - 1) + a.substring(n + 1) : a;
1335
+ }, r);
1336
+ }
1337
+ return (0, Re.default)(e, r, i);
1338
+ }
1339
+ var Ve = /* @__PURE__ */ t(((e, t) => {
1340
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.default = n;
1341
+ function n(e, t) {
1342
+ if (e == null) throw TypeError("assign requires that input parameter not be null or undefined");
1343
+ for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
1344
+ return e;
1345
+ }
1346
+ t.exports = e.default;
1347
+ })), He = /* @__PURE__ */ e((/* @__PURE__ */ t(((e, t) => {
1348
+ var n = b().default;
1349
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.default = i;
1350
+ var r = n(Ve());
1351
+ function i(e) {
1352
+ return (0, r.default)({}, e);
1353
+ }
1354
+ t.exports = e.default;
1355
+ })))());
1356
+ function Ue(e, t, n, r) {
1357
+ var i = (0, He.default)(r);
1358
+ return i.timeZone = t, i.originalDate = e, Be(v(e, t), n, i);
1359
+ }
1360
+ function We(e, t, n) {
1361
+ if (typeof e == "string" && !e.match(u)) {
1362
+ var r = (0, He.default)(n);
1363
+ return r.timeZone = t, d(e, r);
1364
+ }
1365
+ var i = d(e, n), a = S(i.getFullYear(), i.getMonth(), i.getDate(), i.getHours(), i.getMinutes(), i.getSeconds(), i.getMilliseconds()).getTime(), o = l(t, new Date(a));
1366
+ return new Date(a + o);
1367
+ }
1368
+ var U = /* @__PURE__ */ e(f()), W = r(), G = (e) => typeof e == "object" && !!e && !Array.isArray(e), Ge = (e) => G(e) && G(e.associativeListFilter), K = (e) => {
1369
+ if (!G(e)) return;
1370
+ if (typeof e.fieldKey == "string") return e.fieldKey;
1371
+ let t = e.field;
1372
+ if (!(!G(t) || typeof t.name != "string" || typeof t.view != "string")) return `[${t.view}].[${t.name}]`;
1373
+ }, Ke = (e) => {
1374
+ if (Ge(e)) return JSON.stringify(["associative", K(e) ?? ""]);
1375
+ let t = G(e) ? e : {};
1376
+ return JSON.stringify([
1377
+ "value",
1378
+ K(e) ?? "",
1379
+ t.dateLevel ?? null,
1380
+ t.datePart ?? null,
1381
+ t.operator
1382
+ ]);
1383
+ }, q = (e) => {
1384
+ if (Ge(e)) return JSON.stringify(["associative", K(e) ?? ""]);
1385
+ let t = G(e) ? e : {};
1386
+ return JSON.stringify([
1387
+ "value",
1388
+ K(e) ?? "",
1389
+ t.dateLevel ?? null,
1390
+ t.datePart ?? null
1391
+ ]);
1392
+ }, qe = (e) => {
1393
+ let t = G(e) ? e : {};
1394
+ return {
1395
+ applied: $e(t.applied),
1396
+ pending: $e(t.pending)
1397
+ };
1398
+ }, Je = (e) => {
1399
+ let t = /* @__PURE__ */ new Map();
1400
+ for (let n of e.applied) {
1401
+ let e = Ke(n);
1402
+ t.set(e, {
1403
+ identity: e,
1404
+ applied: n
1405
+ });
1406
+ }
1407
+ for (let n of e.pending) {
1408
+ let e = Ke(n), r = t.get(e);
1409
+ t.set(e, {
1410
+ ...r,
1411
+ identity: e,
1412
+ pending: n
1413
+ });
1414
+ }
1415
+ return [...t.values()];
1416
+ }, Ye = (e) => Je(e).flatMap(({ identity: e, applied: t, pending: n }) => {
1417
+ let r = n ?? t;
1418
+ return r ? [{
1419
+ id: e,
1420
+ filter: r,
1421
+ applied: t,
1422
+ pending: n
1423
+ }] : [];
1424
+ }), Xe = (e, t = (e) => e === null ? "∅" : String(e)) => {
1425
+ if (Ge(e)) return {
1426
+ isAssociative: !0,
1427
+ isEmpty: !nt(e.associativeListFilter),
1428
+ valueCount: 0,
1429
+ text: "Related records"
1430
+ };
1431
+ let n = Array.isArray(e.values) ? e.values : [], r = ut(e), i = n.length, a = e.operator === W.FilterOperator.Set || e.operator === W.FilterOperator.NotSet, o = n.slice(0, 3).map((e) => G(e) ? typeof e.dataType == "string" ? `${e.dataType} filter` : "Value" : t(e));
1432
+ return {
1433
+ isAssociative: !1,
1434
+ isEmpty: !r && !a && i === 0,
1435
+ valueCount: i,
1436
+ text: a ? "Has value" : r ? "Dynamic date" : `${o.join(", ")}${i > 3 ? ` +${i - 3}` : ""}`
1437
+ };
1438
+ }, Ze = (e) => Ge(e) ? nt(e.associativeListFilter) : e.operator === W.FilterOperator.Set || e.operator === W.FilterOperator.NotSet || ut(e) ? !0 : !Array.isArray(e.values) || e.values.length === 0 ? !1 : e.operator === W.FilterOperator.Between || e.operator === W.FilterOperator.NotBetween ? e.values.length === 2 && st(e.values[0]) && st(e.values[1]) : e.operator === W.FilterOperator.Like || e.operator === W.FilterOperator.NotLike ? e.values.length === 1 && typeof e.values[0] == "string" && e.values[0].trim().length > 0 : [W.FilterOperator.InList, W.FilterOperator.NotInList].includes(e.operator) ? e.values.every(ot) : e.operator === W.FilterOperator.GeoIntersect ? e.values.length === 1 && ct(e.values[0]) : e.values.length === 1 && ot(e.values[0]), J = Ze, Qe = Xe, $e = (e) => Array.isArray(e) ? e.flatMap((e) => {
1439
+ if (!G(e)) return [];
1440
+ if (G(e.associativeListFilter)) {
1441
+ let t = K(e);
1442
+ return t ? [{
1443
+ ...e,
1444
+ fieldKey: t,
1445
+ associativeListFilter: tt(e.associativeListFilter)
1446
+ }] : [];
1447
+ }
1448
+ let t = K(e);
1449
+ if (!t || typeof e.operator != "string") return [];
1450
+ let n = {
1451
+ ...e,
1452
+ fieldKey: t
1453
+ };
1454
+ return Array.isArray(e.values) && (n.values = e.values.map(et)), [n];
1455
+ }) : [], et = (e) => {
1456
+ if (e === null || typeof e == "string" || typeof e == "number" || typeof e == "boolean") return e;
1457
+ if (!G(e) || e.isNull === !0 || "value" in e && e.value === null) return null;
1458
+ if ("value" in e && (typeof e.value == "string" || typeof e.value == "number" || typeof e.value == "boolean")) return e.value;
1459
+ let t = e;
1460
+ return "valueBoolean" in t && t.valueBoolean !== void 0 ? t.valueBoolean : "valueInt" in t && t.valueInt !== void 0 ? t.valueInt : "valueFloat" in t && t.valueFloat !== void 0 ? t.valueFloat : "valueMillisec" in t && t.valueMillisec !== void 0 ? t.valueMillisec : "valueString" in t && t.valueString !== void 0 ? t.valueString : "valueDate" in t && t.valueDate !== void 0 ? t.valueDate : "valueTime" in t && t.valueTime !== void 0 ? t.valueTime : "valueTimeTZ" in t && t.valueTimeTZ !== void 0 ? t.valueTimeTZ : "valueDatetime" in t && t.valueDatetime !== void 0 ? t.valueDatetime : "valueDatetimeTZ" in t && t.valueDatetimeTZ !== void 0 ? t.valueDatetimeTZ : typeof e.dataType == "string" ? e : null;
1461
+ }, tt = (e) => {
1462
+ let t = (e) => !G(e) || !G(e.filterGroup) ? e : {
1463
+ ...e,
1464
+ filterGroup: n(e.filterGroup)
1465
+ }, n = (e) => ({
1466
+ ...e,
1467
+ ...Array.isArray(e.filters) ? { filters: e.filters.map((e) => {
1468
+ if (!G(e)) return e;
1469
+ let t = { ...e };
1470
+ return Array.isArray(e.values) && (t.values = e.values.map(et)), t;
1471
+ }) } : {},
1472
+ ...Array.isArray(e.filterGroups) ? { filterGroups: e.filterGroups.map((e) => G(e) ? n(e) : e) } : {}
1473
+ });
1474
+ return {
1475
+ ...e,
1476
+ ...Array.isArray(e.intersectFilters) ? { intersectFilters: e.intersectFilters.map(t) } : {},
1477
+ ...Array.isArray(e.unionFilters) ? { unionFilters: e.unionFilters.map(t) } : {}
1478
+ };
1479
+ }, nt = (e) => {
1480
+ if (!G(e) || typeof e.view != "string") return !1;
1481
+ let t = [e.intersectFilters, e.unionFilters].filter(Array.isArray).flatMap((e) => e);
1482
+ return t.length > 0 && t.every(rt);
1483
+ }, rt = (e) => !G(e) || !G(e.filterGroup) ? !1 : it(e.filterGroup), it = (e) => {
1484
+ let t = Array.isArray(e.filters) ? e.filters : [], n = Array.isArray(e.filterGroups) ? e.filterGroups : [], r = [...t, ...n];
1485
+ return r.length > 0 && r.every(at);
1486
+ }, at = (e) => G(e) ? G(e.filterGroup) ? it(e.filterGroup) : Array.isArray(e.filters) || Array.isArray(e.filterGroups) ? it(e) : typeof e.fieldKey == "string" && typeof e.operator == "string" && Ze(e) : !1, ot = (e) => e === null || typeof e == "boolean" ? !0 : typeof e == "number" ? Number.isFinite(e) : typeof e == "string" ? e.trim().length > 0 : G(e) && typeof e.dataType == "string", st = (e) => e !== null && ot(e), ct = (e) => G(e) && e.dataType === "geography" && lt(e.valueGeoMinPoint) && lt(e.valueGeoMaxPoint), lt = (e) => {
1487
+ if (typeof e != "string") return !1;
1488
+ let t = e.trim().split(/[ ,]+/).map(Number);
1489
+ if (t.length !== 2 || !t.every(Number.isFinite)) return !1;
1490
+ let [n, r] = t;
1491
+ return n >= -180 && n <= 180 && r >= -90 && r <= 90;
1492
+ }, ut = (e) => {
1493
+ let t = [
1494
+ "year",
1495
+ "quarter",
1496
+ "month",
1497
+ "week",
1498
+ "day",
1499
+ "hour",
1500
+ "minute",
1501
+ "second"
1502
+ ], n = e.dynamicDate;
1503
+ if (n && Number.isFinite(n.offset) && t.includes(n.part)) return !0;
1504
+ let r = e.dynamicDateRange;
1505
+ if (r && Number.isFinite(r.offsetBegin) && Number.isFinite(r.offsetEnd) && t.includes(r.part)) return !0;
1506
+ let i = e.dynamicDateCalc;
1507
+ if (i && Object.values(W.DynamicDateCalcType).includes(i.type)) return !0;
1508
+ let a = e.dynamicDateCalcRange;
1509
+ return !!(a && Object.values(W.DynamicDateCalcRangeType).includes(a.type));
1510
+ }, dt = (e) => e.dataType === W.FieldType.GEOGRAPHY ? {
1511
+ fieldKey: e.key,
1512
+ operator: W.FilterOperator.GeoIntersect,
1513
+ values: [{
1514
+ dataType: W.FilterValueDataType.Geography,
1515
+ valueGeoMinPoint: "",
1516
+ valueGeoMaxPoint: ""
1517
+ }]
1518
+ } : {
1519
+ fieldKey: e.key,
1520
+ operator: W.FilterOperator.InList,
1521
+ values: []
1522
+ }, ft = (e, t) => t ? [e[0] ?? null] : [e[0] ?? null, e[1] ?? null], pt = (e, t) => {
1523
+ let n = typeof e == "string" && /\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?\s*(?:Z|[+-]\d{2}(?::?\d{2})?)$/i.test(e);
1524
+ return typeof e == "string" && !n ? We(e.replace(" ", "T"), t) : new Date(e);
1525
+ }, mt = (e, t, n) => {
1526
+ if (e == null || e === "" || typeof e != "number" && typeof e != "string") return "";
1527
+ if (t === W.FieldType.TIME) {
1528
+ let t = typeof e == "string" && /^(\d{1,2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?$/.exec(e), n = typeof e == "number" ? e : t ? (Number(t[1]) * 3600 + Number(t[2]) * 60 + Number(t[3] ?? 0)) * 1e3 + Number((t[4] ?? "").padEnd(3, "0")) : Date.parse(String(e));
1529
+ if (!Number.isFinite(n)) return "";
1530
+ let r = Math.max(0, Math.floor(n)), i = Math.floor(r / 1e3);
1531
+ return `${String(Math.floor(i / 3600) % 24).padStart(2, "0")}:${String(Math.floor(i % 3600 / 60)).padStart(2, "0")}:${String(i % 60).padStart(2, "0")}.${String(r % 1e3).padStart(3, "0")}`;
1532
+ }
1533
+ if (t === W.FieldType.DATE) {
1534
+ let t = new Date(typeof e == "string" && /^\d{4}-\d{2}-\d{2}$/.test(e) ? `${e}T00:00:00.000Z` : e);
1535
+ return Number.isFinite(t.getTime()) ? t.toISOString().slice(0, 10) : "";
1536
+ }
1537
+ let r = pt(e, n);
1538
+ return Number.isFinite(r.getTime()) ? Ue(r, n, "yyyy-MM-dd'T'HH:mm:ss.SSS") : "";
1539
+ }, ht = (e, t, n) => {
1540
+ if (!e) return null;
1541
+ if (t === W.FieldType.TIME) {
1542
+ let [t = "0", n = "0", r = "0"] = e.split(":"), [i = "0", a = "0"] = r.split(".");
1543
+ return (Number(t) * 3600 + Number(n) * 60 + Number(i)) * 1e3 + Number(a.padEnd(3, "0").slice(0, 3));
1544
+ }
1545
+ if (t === W.FieldType.DATE) {
1546
+ let t = /* @__PURE__ */ new Date(`${e}T00:00:00.000Z`);
1547
+ return Number.isFinite(t.getTime()) ? t.getTime() : null;
1548
+ }
1549
+ try {
1550
+ return We(e, n).getTime();
1551
+ } catch {
1552
+ return null;
1553
+ }
1554
+ }, gt = (e, t, n) => {
1555
+ let r = e.flatMap((e) => {
1556
+ if (typeof e != "number" && (typeof e != "string" || !e.trim())) return [];
1557
+ let r;
1558
+ if (typeof e == "number") r = e;
1559
+ else if (t === W.FieldType.DATE) r = Date.parse(e);
1560
+ else if (t === W.FieldType.TIMESTAMP || t === W.FieldType.TIMESTAMP_TZ) r = pt(e, n).getTime();
1561
+ else if (t === W.FieldType.TIME) {
1562
+ let i = ht(mt(e, t, n), t, n);
1563
+ r = typeof i == "number" ? i : NaN;
1564
+ } else r = Number(e);
1565
+ return Number.isFinite(r) ? [{
1566
+ value: e,
1567
+ order: r
1568
+ }] : [];
1569
+ }).sort((e, t) => e.order - t.order);
1570
+ return r.length ? [r[0].value, r[r.length - 1].value] : [];
1571
+ }, _t = (e) => [
1572
+ W.FieldType.INT,
1573
+ W.FieldType.REAL,
1574
+ W.FieldType.FLOAT,
1575
+ W.FieldType.DECIMAL
1576
+ ].includes(e), Y = (e) => [
1577
+ W.FieldType.DATE,
1578
+ W.FieldType.TIME,
1579
+ W.FieldType.TIMESTAMP,
1580
+ W.FieldType.TIMESTAMP_TZ
1581
+ ].includes(e), vt = (e, t) => t.operator === W.FilterOperator.GeoIntersect ? "geo" : [W.FilterOperator.Set, W.FilterOperator.NotSet].includes(t.operator) ? "null" : [W.FilterOperator.Contains, W.FilterOperator.NotContains].includes(t.operator) ? "text" : Y(e) && (t.dynamicDate || t.dynamicDateCalc || [W.FilterOperator.Equals, W.FilterOperator.NotEquals].includes(t.operator)) ? "date" : t.operator === W.FilterOperator.Like || t.operator === W.FilterOperator.NotLike ? "text" : t.operator === W.FilterOperator.Between || t.operator === W.FilterOperator.NotBetween || t.dynamicDateRange || t.dynamicDateCalcRange ? Y(e) ? "date" : "range" : [W.FilterOperator.InList, W.FilterOperator.NotInList].includes(t.operator) ? "list" : [W.FilterOperator.Equals, W.FilterOperator.NotEquals].includes(t.operator) && Y(e) ? "date" : "scalar", yt = (e) => {
1582
+ if (e === W.FieldType.GEOGRAPHY) return [W.FilterOperator.GeoIntersect];
1583
+ if (e === W.FieldType.BOOLEAN) return [
1584
+ W.FilterOperator.Equals,
1585
+ W.FilterOperator.NotEquals,
1586
+ W.FilterOperator.Set,
1587
+ W.FilterOperator.NotSet
1588
+ ];
1589
+ let t = [
1590
+ W.FilterOperator.Equals,
1591
+ W.FilterOperator.NotEquals,
1592
+ W.FilterOperator.InList,
1593
+ W.FilterOperator.NotInList,
1594
+ W.FilterOperator.Set,
1595
+ W.FilterOperator.NotSet
1596
+ ];
1597
+ return _t(e) || Y(e) ? [
1598
+ ...t,
1599
+ W.FilterOperator.GT,
1600
+ W.FilterOperator.GTE,
1601
+ W.FilterOperator.LT,
1602
+ W.FilterOperator.LTE,
1603
+ W.FilterOperator.Between,
1604
+ W.FilterOperator.NotBetween
1605
+ ] : [
1606
+ ...t,
1607
+ W.FilterOperator.Like,
1608
+ W.FilterOperator.NotLike,
1609
+ W.FilterOperator.Contains,
1610
+ W.FilterOperator.NotContains
1611
+ ];
1612
+ }, X = (e) => {
1613
+ let t = { ...e };
1614
+ return delete t.dynamicDate, delete t.dynamicDateCalc, delete t.dynamicDateRange, delete t.dynamicDateCalcRange, t;
1615
+ }, bt = (e, t) => ({
1616
+ ...X(e),
1617
+ values: t
1618
+ }), Z = (e) => Array.isArray(e.values) ? e.values : [], Q = (e) => `${typeof e}:${typeof e == "object" && e ? JSON.stringify(e) : String(e)}`, xt = (e) => Array.isArray(e.data) ? e.data.map((e) => e[0]) : Object.values(e.data).map((e) => e[0]), St = (e, t, n) => {
1619
+ let r = [W.FilterOperator.Contains, W.FilterOperator.NotContains].includes(t.operator), i = [W.FilterOperator.Like, W.FilterOperator.NotLike].includes(t.operator);
1620
+ if (!(!r && !i)) return {
1621
+ dimensions: [{ fieldKey: e }],
1622
+ measures: [],
1623
+ filters: [{
1624
+ fieldKey: e,
1625
+ operator: r ? W.FilterOperator.Contains : W.FilterOperator.Like,
1626
+ values: [String(Z(t)[0] ?? "").trim()],
1627
+ dateLevel: t.dateLevel,
1628
+ datePart: t.datePart
1629
+ }],
1630
+ limit: n
1631
+ };
1632
+ }, Ct = (e) => e === W.FieldType.DATE ? "date" : e === W.FieldType.TIME ? "time" : "datetime-local", wt = (e) => e.dynamicDateCalcRange ? "preset" : e.dynamicDateRange ? "relative" : e.dynamicDateCalc ? "dynamic-calc" : e.dynamicDate ? "dynamic" : [W.FilterOperator.Equals, W.FilterOperator.NotEquals].includes(e.operator) ? "single" : "fixed", Tt = (e, t) => {
1633
+ let n = X(e), r = [W.FilterOperator.NotEquals, W.FilterOperator.NotBetween].includes(e.operator), i = [
1634
+ W.FilterOperator.Equals,
1635
+ W.FilterOperator.NotEquals,
1636
+ W.FilterOperator.GT,
1637
+ W.FilterOperator.GTE,
1638
+ W.FilterOperator.LT,
1639
+ W.FilterOperator.LTE
1640
+ ].includes(e.operator) ? e.operator : r ? W.FilterOperator.NotEquals : W.FilterOperator.Equals;
1641
+ return t === "single" ? {
1642
+ ...n,
1643
+ operator: r ? W.FilterOperator.NotEquals : W.FilterOperator.Equals,
1644
+ values: [null]
1645
+ } : t === "dynamic" ? {
1646
+ ...n,
1647
+ operator: i,
1648
+ values: [],
1649
+ dynamicDate: {
1650
+ offset: 0,
1651
+ part: "day"
1652
+ }
1653
+ } : t === "dynamic-calc" ? {
1654
+ ...n,
1655
+ operator: i,
1656
+ values: [],
1657
+ dynamicDateCalc: { type: W.DynamicDateCalcType.Today }
1658
+ } : t === "preset" ? {
1659
+ ...n,
1660
+ operator: r ? W.FilterOperator.NotBetween : W.FilterOperator.Between,
1661
+ values: [],
1662
+ dynamicDateCalcRange: { type: W.DynamicDateCalcRangeType.Today }
1663
+ } : t === "relative" ? {
1664
+ ...n,
1665
+ operator: r ? W.FilterOperator.NotBetween : W.FilterOperator.Between,
1666
+ values: [],
1667
+ dynamicDateRange: {
1668
+ offsetBegin: 0,
1669
+ offsetEnd: 1,
1670
+ part: "day"
1671
+ }
1672
+ } : {
1673
+ ...n,
1674
+ operator: r ? W.FilterOperator.NotBetween : W.FilterOperator.Between,
1675
+ values: [null, null]
1676
+ };
1677
+ }, $ = w();
1678
+ function Et({ filter: e, disabledControls: t, update: n }) {
1679
+ let r = Z(e), i = r[0], a = (i?.valueGeoMinPoint ?? "").split(/[ ,]+/), o = (i?.valueGeoMaxPoint ?? "").split(/[ ,]+/), s = (t, i, s) => {
1680
+ let c = t === "min" ? a : o;
1681
+ c[i] = s;
1682
+ let l = `${c[0] ?? ""} ${c[1] ?? ""}`.trim(), u = r[0], d = {
1683
+ ...u && typeof u == "object" ? u : {},
1684
+ dataType: W.FilterValueDataType.Geography,
1685
+ [t === "min" ? "valueGeoMinPoint" : "valueGeoMaxPoint"]: l
1686
+ };
1687
+ n({
1688
+ ...e,
1689
+ operator: W.FilterOperator.GeoIntersect,
1690
+ values: [d]
1691
+ });
1692
+ };
1693
+ return /* @__PURE__ */ (0, $.jsx)("div", {
1694
+ className: "astrato-app-filter-bar__fieldset",
1695
+ "aria-label": "Geographic bounding box",
1696
+ children: ["min", "max"].map((e) => {
1697
+ let n = e === "min" ? a : o;
1698
+ return /* @__PURE__ */ (0, $.jsxs)("div", {
1699
+ className: "astrato-app-filter-bar__row",
1700
+ children: [/* @__PURE__ */ (0, $.jsxs)("label", {
1701
+ className: "astrato-app-filter-bar__label",
1702
+ children: [e === "min" ? "Minimum longitude" : "Maximum longitude", /* @__PURE__ */ (0, $.jsx)(E, {
1703
+ className: "astrato-app-filter-bar__control",
1704
+ type: "number",
1705
+ value: n[0] ?? "",
1706
+ disabled: t,
1707
+ onChange: (t) => s(e, 0, t.currentTarget.value)
1708
+ })]
1709
+ }), /* @__PURE__ */ (0, $.jsxs)("label", {
1710
+ className: "astrato-app-filter-bar__label",
1711
+ children: [e === "min" ? "Minimum latitude" : "Maximum latitude", /* @__PURE__ */ (0, $.jsx)(E, {
1712
+ className: "astrato-app-filter-bar__control",
1713
+ type: "number",
1714
+ value: n[1] ?? "",
1715
+ disabled: t,
1716
+ onChange: (t) => s(e, 1, t.currentTarget.value)
1717
+ })]
1718
+ })]
1719
+ }, e);
1720
+ })
1721
+ });
1722
+ }
1723
+ var Dt = Object.values(W.DynamicDateCalcRangeType).map((e) => ({
1724
+ value: e,
1725
+ label: i[e] ?? e
1726
+ })), Ot = Object.values(W.DynamicDateCalcType).map((e) => ({
1727
+ value: e,
1728
+ label: i[e] ?? e
1729
+ })), kt = [
1730
+ {
1731
+ value: "list",
1732
+ label: "Pick values",
1733
+ icon: "values"
1734
+ },
1735
+ {
1736
+ value: "text",
1737
+ label: "Match text",
1738
+ icon: "textMatch"
1739
+ },
1740
+ {
1741
+ value: "range",
1742
+ label: "Number range",
1743
+ icon: "range"
1744
+ },
1745
+ {
1746
+ value: "date",
1747
+ label: "Date range",
1748
+ icon: "dateRange"
1749
+ },
1750
+ {
1751
+ value: "scalar",
1752
+ label: "Single value",
1753
+ icon: "singleValue"
1754
+ },
1755
+ {
1756
+ value: "null",
1757
+ label: "Null check",
1758
+ icon: "nullCheck"
1759
+ },
1760
+ {
1761
+ value: "geo",
1762
+ label: "Geographic bounds",
1763
+ icon: "geography"
1764
+ }
1765
+ ], At = {
1766
+ [W.FilterOperator.Equals]: "Equals",
1767
+ [W.FilterOperator.NotEquals]: "Does not equal",
1768
+ [W.FilterOperator.InList]: "In list",
1769
+ [W.FilterOperator.NotInList]: "Excluded from list",
1770
+ [W.FilterOperator.GT]: "Greater than",
1771
+ [W.FilterOperator.GTE]: "Greater than or equal",
1772
+ [W.FilterOperator.LT]: "Less than",
1773
+ [W.FilterOperator.LTE]: "Less than or equal",
1774
+ [W.FilterOperator.Set]: "Is set",
1775
+ [W.FilterOperator.NotSet]: "Is not set",
1776
+ [W.FilterOperator.Between]: "Between",
1777
+ [W.FilterOperator.NotBetween]: "Not between",
1778
+ [W.FilterOperator.Like]: "Like",
1779
+ [W.FilterOperator.NotLike]: "Not like",
1780
+ [W.FilterOperator.Contains]: "Contains",
1781
+ [W.FilterOperator.NotContains]: "Does not contain",
1782
+ [W.FilterOperator.GeoIntersect]: "Intersects bounding box"
1783
+ };
1784
+ function jt({ field: e, filter: t, editor: n }) {
1785
+ let { editorMode: r, disabledControls: i, update: a, valueList: { searchInput: o, setSearchInput: s } } = n, c = Z(t);
1786
+ return r === "list" ? /* @__PURE__ */ (0, $.jsx)(oe, {
1787
+ value: o,
1788
+ disabled: i,
1789
+ placeholder: "Search values…",
1790
+ "aria-label": `Search ${e.name} values`,
1791
+ onChange: (e) => s(e.currentTarget.value)
1792
+ }) : r === "text" ? /* @__PURE__ */ (0, $.jsx)(E, {
1793
+ className: "astrato-app-filter-bar__control astrato-app-filter-bar__text-query",
1794
+ type: "search",
1795
+ placeholder: "Match text…",
1796
+ "aria-label": `Match ${e.name} text`,
1797
+ value: String(c[0] ?? ""),
1798
+ disabled: i,
1799
+ onChange: (e) => a({
1800
+ ...X(t),
1801
+ values: [e.currentTarget.value]
1802
+ })
1803
+ }) : null;
1804
+ }
1805
+ function Mt({ field: e, filter: t, editor: n, showAdvancedOperators: r }) {
1806
+ let { editorMode: i, disabledControls: a, isSingleSelect: o, isChangingMode: s, switchMode: c, changeOperator: l, changeExclude: u } = n, d = t.operator === W.FilterOperator.NotInList || t.operator === W.FilterOperator.NotLike || t.operator === W.FilterOperator.NotBetween || t.operator === W.FilterOperator.NotEquals || t.operator === W.FilterOperator.NotContains, f = kt.filter(({ value: t }) => t === "list" || t === i ? !0 : o ? !1 : t === "text" ? e.dataType !== W.FieldType.BOOLEAN && e.dataType !== W.FieldType.GEOGRAPHY : t === "range" ? _t(e.dataType) : t === "date" && Y(e.dataType)), p = kt.find(({ value: e }) => e === i) ?? kt[0], m = f[(f.findIndex(({ value: e }) => e === i) + 1) % f.length], h = f.length > 1 ? `Filter type: ${p.label}. Switch to ${m.label}` : `Filter type: ${p.label}`, g = i === "list" || i === "text" ? /* @__PURE__ */ (0, $.jsx)(jt, {
1807
+ field: e,
1808
+ filter: t,
1809
+ editor: n
1810
+ }) : null;
1811
+ return /* @__PURE__ */ (0, $.jsx)("header", {
1812
+ className: "astrato-app-filter-bar__editor-options",
1813
+ children: r ? /* @__PURE__ */ (0, $.jsx)(O, {
1814
+ className: "astrato-app-filter-bar__control",
1815
+ "aria-label": "Filter operator",
1816
+ value: t.operator,
1817
+ disabled: a,
1818
+ onChange: (e) => l(e.currentTarget.value),
1819
+ children: yt(e.dataType).map((e) => /* @__PURE__ */ (0, $.jsx)("option", {
1820
+ value: e,
1821
+ children: At[e] ?? e
1822
+ }, e))
1823
+ }) : /* @__PURE__ */ (0, $.jsxs)($.Fragment, { children: [
1824
+ /* @__PURE__ */ (0, $.jsx)(T, {
1825
+ className: "astrato-app-filter-bar__mode-toggle",
1826
+ "data-variant": "ghost",
1827
+ "data-icon-only": "true",
1828
+ "data-mode": i,
1829
+ title: h,
1830
+ "aria-label": h,
1831
+ disabled: a || f.length < 2,
1832
+ "aria-disabled": s || void 0,
1833
+ "aria-busy": s,
1834
+ onClick: () => void c(m.value),
1835
+ children: /* @__PURE__ */ (0, $.jsx)(_, { name: p.icon })
1836
+ }),
1837
+ g ?? /* @__PURE__ */ (0, $.jsx)("span", {
1838
+ className: "astrato-app-filter-bar__mode-label",
1839
+ children: p.label
1840
+ }),
1841
+ /* @__PURE__ */ (0, $.jsxs)("label", {
1842
+ className: "astrato-app-filter-bar__exclude",
1843
+ "data-active": d,
1844
+ children: [/* @__PURE__ */ (0, $.jsx)(E, {
1845
+ type: "checkbox",
1846
+ checked: d,
1847
+ disabled: a || o && i === "list",
1848
+ onChange: (e) => u(e.currentTarget.checked)
1849
+ }), "Exclude"]
1850
+ })
1851
+ ] })
1852
+ });
1853
+ }
1854
+ function Nt({ filter: e, disabledControls: t, update: n }) {
1855
+ let r = (t) => n(Tt(e, t));
1856
+ return /* @__PURE__ */ (0, $.jsxs)("div", {
1857
+ className: "astrato-app-filter-bar__fieldset",
1858
+ children: [
1859
+ /* @__PURE__ */ (0, $.jsxs)("label", {
1860
+ className: "astrato-app-filter-bar__label",
1861
+ children: ["Date mode", /* @__PURE__ */ (0, $.jsxs)(O, {
1862
+ className: "astrato-app-filter-bar__control",
1863
+ value: wt(e),
1864
+ disabled: t,
1865
+ onChange: (e) => r(e.currentTarget.value),
1866
+ children: [
1867
+ /* @__PURE__ */ (0, $.jsx)("option", {
1868
+ value: "fixed",
1869
+ children: "Fixed range"
1870
+ }),
1871
+ /* @__PURE__ */ (0, $.jsx)("option", {
1872
+ value: "single",
1873
+ children: "Specific date"
1874
+ }),
1875
+ /* @__PURE__ */ (0, $.jsx)("option", {
1876
+ value: "dynamic",
1877
+ children: "Dynamic date"
1878
+ }),
1879
+ /* @__PURE__ */ (0, $.jsx)("option", {
1880
+ value: "dynamic-calc",
1881
+ children: "Dynamic date preset"
1882
+ }),
1883
+ /* @__PURE__ */ (0, $.jsx)("option", {
1884
+ value: "preset",
1885
+ children: "Predefined period"
1886
+ }),
1887
+ /* @__PURE__ */ (0, $.jsx)("option", {
1888
+ value: "relative",
1889
+ children: "Relative range"
1890
+ })
1891
+ ]
1892
+ })]
1893
+ }),
1894
+ e.dynamicDateCalcRange && /* @__PURE__ */ (0, $.jsxs)("label", {
1895
+ className: "astrato-app-filter-bar__label",
1896
+ children: ["Period", /* @__PURE__ */ (0, $.jsx)(O, {
1897
+ className: "astrato-app-filter-bar__control",
1898
+ value: e.dynamicDateCalcRange.type,
1899
+ disabled: t,
1900
+ onChange: (t) => n({
1901
+ ...e,
1902
+ dynamicDateCalcRange: { type: t.currentTarget.value }
1903
+ }),
1904
+ children: Dt.map(({ value: e, label: t }) => /* @__PURE__ */ (0, $.jsx)("option", {
1905
+ value: e,
1906
+ children: t
1907
+ }, e))
1908
+ })]
1909
+ }),
1910
+ e.dynamicDateCalc && /* @__PURE__ */ (0, $.jsxs)("label", {
1911
+ className: "astrato-app-filter-bar__label",
1912
+ children: ["Dynamic date", /* @__PURE__ */ (0, $.jsx)(O, {
1913
+ className: "astrato-app-filter-bar__control",
1914
+ value: e.dynamicDateCalc.type,
1915
+ disabled: t,
1916
+ onChange: (t) => n({
1917
+ ...e,
1918
+ dynamicDateCalc: { type: t.currentTarget.value }
1919
+ }),
1920
+ children: Ot.map(({ value: e, label: t }) => /* @__PURE__ */ (0, $.jsx)("option", {
1921
+ value: e,
1922
+ children: t
1923
+ }, e))
1924
+ })]
1925
+ }),
1926
+ e.dynamicDate && /* @__PURE__ */ (0, $.jsxs)("div", {
1927
+ className: "astrato-app-filter-bar__row",
1928
+ children: [/* @__PURE__ */ (0, $.jsxs)("label", {
1929
+ className: "astrato-app-filter-bar__label",
1930
+ children: ["Offset", /* @__PURE__ */ (0, $.jsx)(E, {
1931
+ className: "astrato-app-filter-bar__control",
1932
+ type: "number",
1933
+ value: e.dynamicDate.offset,
1934
+ disabled: t,
1935
+ onChange: (t) => n({
1936
+ ...e,
1937
+ dynamicDate: {
1938
+ ...e.dynamicDate,
1939
+ offset: Number(t.currentTarget.value)
1940
+ }
1941
+ })
1942
+ })]
1943
+ }), /* @__PURE__ */ (0, $.jsxs)("label", {
1944
+ className: "astrato-app-filter-bar__label",
1945
+ children: ["Unit", /* @__PURE__ */ (0, $.jsx)(O, {
1946
+ className: "astrato-app-filter-bar__control",
1947
+ value: e.dynamicDate.part,
1948
+ disabled: t,
1949
+ onChange: (t) => n({
1950
+ ...e,
1951
+ dynamicDate: {
1952
+ ...e.dynamicDate,
1953
+ part: t.currentTarget.value
1954
+ }
1955
+ }),
1956
+ children: [
1957
+ "year",
1958
+ "quarter",
1959
+ "month",
1960
+ "week",
1961
+ "day",
1962
+ "hour",
1963
+ "minute",
1964
+ "second"
1965
+ ].map((e) => /* @__PURE__ */ (0, $.jsx)("option", {
1966
+ value: e,
1967
+ children: e
1968
+ }, e))
1969
+ })]
1970
+ })]
1971
+ }),
1972
+ e.dynamicDateRange && /* @__PURE__ */ (0, $.jsxs)("div", {
1973
+ className: "astrato-app-filter-bar__row",
1974
+ children: [
1975
+ /* @__PURE__ */ (0, $.jsxs)("label", {
1976
+ className: "astrato-app-filter-bar__label",
1977
+ children: ["Start offset", /* @__PURE__ */ (0, $.jsx)(E, {
1978
+ className: "astrato-app-filter-bar__control",
1979
+ type: "number",
1980
+ value: e.dynamicDateRange.offsetBegin,
1981
+ disabled: t,
1982
+ onChange: (t) => n({
1983
+ ...e,
1984
+ dynamicDateRange: {
1985
+ ...e.dynamicDateRange,
1986
+ offsetBegin: Number(t.currentTarget.value)
1987
+ }
1988
+ })
1989
+ })]
1990
+ }),
1991
+ /* @__PURE__ */ (0, $.jsxs)("label", {
1992
+ className: "astrato-app-filter-bar__label",
1993
+ children: ["End offset", /* @__PURE__ */ (0, $.jsx)(E, {
1994
+ className: "astrato-app-filter-bar__control",
1995
+ type: "number",
1996
+ value: e.dynamicDateRange.offsetEnd,
1997
+ disabled: t,
1998
+ onChange: (t) => n({
1999
+ ...e,
2000
+ dynamicDateRange: {
2001
+ ...e.dynamicDateRange,
2002
+ offsetEnd: Number(t.currentTarget.value)
2003
+ }
2004
+ })
2005
+ })]
2006
+ }),
2007
+ /* @__PURE__ */ (0, $.jsxs)("label", {
2008
+ className: "astrato-app-filter-bar__label",
2009
+ children: ["Unit", /* @__PURE__ */ (0, $.jsx)(O, {
2010
+ className: "astrato-app-filter-bar__control",
2011
+ value: e.dynamicDateRange.part,
2012
+ disabled: t,
2013
+ onChange: (t) => n({
2014
+ ...e,
2015
+ dynamicDateRange: {
2016
+ ...e.dynamicDateRange,
2017
+ part: t.currentTarget.value
2018
+ }
2019
+ }),
2020
+ children: [
2021
+ "year",
2022
+ "quarter",
2023
+ "month",
2024
+ "week",
2025
+ "day",
2026
+ "hour",
2027
+ "minute",
2028
+ "second"
2029
+ ].map((e) => /* @__PURE__ */ (0, $.jsx)("option", {
2030
+ value: e,
2031
+ children: e
2032
+ }, e))
2033
+ })]
2034
+ })
2035
+ ]
2036
+ })
2037
+ ]
2038
+ });
2039
+ }
2040
+ function Pt(e) {
2041
+ let { field: t, filter: n, editorMode: r, timeZone: i, disabledControls: a, update: o } = e, s = Z(n);
2042
+ return /* @__PURE__ */ (0, $.jsxs)("div", {
2043
+ className: "astrato-app-filter-bar__values",
2044
+ children: [r === "date" && /* @__PURE__ */ (0, $.jsx)(Nt, { ...e }), !n.dynamicDateCalcRange && !n.dynamicDateRange && !n.dynamicDate && !n.dynamicDateCalc && /* @__PURE__ */ (0, $.jsx)("div", {
2045
+ className: "astrato-app-filter-bar__row astrato-app-filter-bar__range-inputs",
2046
+ children: ([W.FilterOperator.Equals, W.FilterOperator.NotEquals].includes(n.operator) ? [0] : [0, 1]).map((e) => /* @__PURE__ */ (0, $.jsxs)("label", {
2047
+ className: "astrato-app-filter-bar__label",
2048
+ children: [[W.FilterOperator.Equals, W.FilterOperator.NotEquals].includes(n.operator) ? "Date" : e === 0 ? "From" : "To", /* @__PURE__ */ (0, $.jsx)(E, {
2049
+ className: "astrato-app-filter-bar__control",
2050
+ type: r === "date" ? Ct(t.dataType) : "number",
2051
+ step: r === "date" && t.dataType !== W.FieldType.DATE ? "0.001" : void 0,
2052
+ value: r === "date" ? mt(s[e], t.dataType, i) : String(s[e] ?? ""),
2053
+ disabled: a,
2054
+ onChange: (a) => {
2055
+ let c = [s[0] ?? null, s[1] ?? null];
2056
+ c[e] = r === "date" ? ht(a.currentTarget.value, t.dataType, i) : a.currentTarget.value === "" ? null : Number(a.currentTarget.value), o({
2057
+ ...X(n),
2058
+ values: ft(c, [W.FilterOperator.Equals, W.FilterOperator.NotEquals].includes(n.operator))
2059
+ });
2060
+ }
2061
+ })]
2062
+ }, e))
2063
+ })]
2064
+ });
2065
+ }
2066
+ function Ft({ field: e, filter: t, timeZone: n, disabledControls: r, update: i }) {
2067
+ let a = Z(t);
2068
+ return /* @__PURE__ */ (0, $.jsxs)("label", {
2069
+ className: "astrato-app-filter-bar__label",
2070
+ children: ["Value", e.dataType === W.FieldType.BOOLEAN ? /* @__PURE__ */ (0, $.jsxs)(O, {
2071
+ className: "astrato-app-filter-bar__control",
2072
+ value: a[0] == null ? "" : String(a[0]),
2073
+ disabled: r,
2074
+ onChange: (e) => i({
2075
+ ...X(t),
2076
+ values: [e.currentTarget.value === "" ? null : e.currentTarget.value === "true"]
2077
+ }),
2078
+ children: [
2079
+ /* @__PURE__ */ (0, $.jsx)("option", {
2080
+ value: "",
2081
+ children: "Choose a value"
2082
+ }),
2083
+ /* @__PURE__ */ (0, $.jsx)("option", {
2084
+ value: "true",
2085
+ children: "True"
2086
+ }),
2087
+ /* @__PURE__ */ (0, $.jsx)("option", {
2088
+ value: "false",
2089
+ children: "False"
2090
+ })
2091
+ ]
2092
+ }) : /* @__PURE__ */ (0, $.jsx)(E, {
2093
+ className: "astrato-app-filter-bar__control",
2094
+ type: Y(e.dataType) ? Ct(e.dataType) : _t(e.dataType) ? "number" : "text",
2095
+ step: Y(e.dataType) && e.dataType !== W.FieldType.DATE ? "0.001" : void 0,
2096
+ value: Y(e.dataType) ? mt(a[0], e.dataType, n) : String(a[0] ?? ""),
2097
+ disabled: r,
2098
+ onChange: (r) => i({
2099
+ ...X(t),
2100
+ values: [Y(e.dataType) ? ht(r.currentTarget.value, e.dataType, n) : _t(e.dataType) ? r.currentTarget.value === "" ? null : Number(r.currentTarget.value) : r.currentTarget.value]
2101
+ })
2102
+ })]
2103
+ });
2104
+ }
2105
+ function It({ field: e, filter: t, editor: r, showAdvancedOperators: i }) {
2106
+ let a = (0, U.useId)(), { update: o, valuesSelected: s, isSingleSelect: c, disabledControls: l, valueList: u } = r, { values: d, availableValues: f, availableSelectedValues: p, searchQuery: m, hasConnectedFilters: h, showAllValues: g, setShowAllValues: v, sortDirection: y, toggleSortDirection: b, isRefreshingValues: x, isLoadingMore: ee, loadMoreError: S, canLoadMore: C, loadMore: w, valueListRef: te, nextPageRef: ne } = u, re = /* @__PURE__ */ (0, $.jsx)(jt, {
2107
+ field: e,
2108
+ filter: t,
2109
+ editor: r
2110
+ }), ae = (e) => {
2111
+ let n = Z(t), r = Q(e), i = s.has(r) ? n.filter((e) => Q(e) !== r) : [...n, e];
2112
+ o(bt(t, c ? [e] : i));
2113
+ }, oe = () => {
2114
+ let e = new Set(d.map(Q)), n = Z(t).filter((t) => !e.has(Q(t)));
2115
+ o(bt(t, [...n, ...d]));
2116
+ }, O = () => {
2117
+ let e = new Set(d.map(Q));
2118
+ o(bt(t, Z(t).filter((t) => !e.has(Q(t)))));
2119
+ }, k = () => {
2120
+ let e = new Set(d.map(Q)), n = Z(t).filter((t) => !e.has(Q(t)));
2121
+ n.push(...d.filter((e) => !s.has(Q(e)))), o(bt(t, n));
2122
+ }, A = () => o(bt(t, f)), j = Z(t), M = m ? d : [...new Map([...d, ...j].map((e) => [Q(e), e])).values()], N = new Set([...f, ...p].map(Q));
2123
+ return /* @__PURE__ */ (0, $.jsxs)("div", {
2124
+ className: "astrato-app-filter-bar__list-editor",
2125
+ children: [
2126
+ i && /* @__PURE__ */ (0, $.jsx)("div", {
2127
+ className: "astrato-app-filter-bar__search-row",
2128
+ children: re
2129
+ }),
2130
+ /* @__PURE__ */ (0, $.jsxs)("div", {
2131
+ className: "astrato-app-filter-bar__selection-toolbar",
2132
+ children: [
2133
+ /* @__PURE__ */ (0, $.jsxs)("span", {
2134
+ className: "astrato-app-filter-bar__muted",
2135
+ role: "status",
2136
+ children: [j.length, " selected"]
2137
+ }),
2138
+ /* @__PURE__ */ (0, $.jsx)(T, {
2139
+ "data-variant": "ghost",
2140
+ "data-icon-only": "true",
2141
+ disabled: l,
2142
+ "aria-label": y === n.Asc ? "Sort descending" : "Sort ascending",
2143
+ title: y === n.Asc ? "Sorted ascending. Switch to descending." : "Sorted descending. Switch to ascending.",
2144
+ onClick: b,
2145
+ children: /* @__PURE__ */ (0, $.jsx)(_, { name: y === n.Asc ? "sortAsc" : "sortDesc" })
2146
+ }),
2147
+ /* @__PURE__ */ (0, $.jsx)(T, {
2148
+ "data-variant": "ghost",
2149
+ "aria-label": "Select loaded values",
2150
+ title: "Select all values currently loaded in this list",
2151
+ disabled: l || c || x || !d.length,
2152
+ onClick: oe,
2153
+ children: "Select all"
2154
+ }),
2155
+ /* @__PURE__ */ (0, $.jsx)(ie, { actions: [
2156
+ {
2157
+ label: "Deselect loaded values",
2158
+ onSelect: O,
2159
+ disabled: l || c || x || !d.length
2160
+ },
2161
+ {
2162
+ label: "Invert loaded selection",
2163
+ onSelect: k,
2164
+ disabled: l || c || x || !d.length
2165
+ },
2166
+ {
2167
+ label: "Select loaded available values",
2168
+ onSelect: A,
2169
+ disabled: l || c || x || !f.length
2170
+ },
2171
+ {
2172
+ label: "Clear values",
2173
+ onSelect: () => o(bt(t, [])),
2174
+ disabled: l || c || !j.length
2175
+ }
2176
+ ] })
2177
+ ]
2178
+ }),
2179
+ h && /* @__PURE__ */ (0, $.jsxs)("label", {
2180
+ className: "astrato-app-filter-bar__availability",
2181
+ children: [/* @__PURE__ */ (0, $.jsx)(E, {
2182
+ type: "checkbox",
2183
+ checked: g,
2184
+ disabled: l || x,
2185
+ onChange: (e) => v(e.currentTarget.checked)
2186
+ }), "Include unavailable values"]
2187
+ }),
2188
+ /* @__PURE__ */ (0, $.jsxs)("div", {
2189
+ className: "astrato-app-filter-bar__value-viewport",
2190
+ "data-loading": x,
2191
+ children: [/* @__PURE__ */ (0, $.jsxs)("div", {
2192
+ className: "astrato-app-filter-bar__value-list",
2193
+ ref: te,
2194
+ "aria-busy": x,
2195
+ children: [
2196
+ M.map((e) => {
2197
+ let t = Q(e);
2198
+ return /* @__PURE__ */ (0, $.jsxs)("label", {
2199
+ className: "astrato-app-filter-bar__value",
2200
+ "data-selected": s.has(t),
2201
+ "data-excluded": h && !N.has(t),
2202
+ children: [/* @__PURE__ */ (0, $.jsx)(E, {
2203
+ type: c ? "radio" : "checkbox",
2204
+ name: c ? a : void 0,
2205
+ checked: s.has(t),
2206
+ disabled: l || x,
2207
+ onChange: () => ae(e)
2208
+ }), /* @__PURE__ */ (0, $.jsx)("span", { children: e == null ? "Null" : typeof e == "object" ? "value" in e ? String(e.value) : JSON.stringify(e) : String(e) })]
2209
+ }, t);
2210
+ }),
2211
+ !M.length && !x && /* @__PURE__ */ (0, $.jsx)("div", {
2212
+ className: "astrato-app-filter-bar__empty",
2213
+ children: "No matching values"
2214
+ }),
2215
+ C && /* @__PURE__ */ (0, $.jsxs)("div", {
2216
+ className: "astrato-app-filter-bar__next-page",
2217
+ ref: ne,
2218
+ children: [ee && /* @__PURE__ */ (0, $.jsx)(D, { label: "Loading more values" }), S && /* @__PURE__ */ (0, $.jsxs)($.Fragment, { children: [/* @__PURE__ */ (0, $.jsx)("span", {
2219
+ role: "alert",
2220
+ className: "astrato-app-filter-bar__error",
2221
+ children: S
2222
+ }), /* @__PURE__ */ (0, $.jsx)(T, {
2223
+ "data-variant": "ghost",
2224
+ disabled: l,
2225
+ onClick: () => void w(),
2226
+ children: "Retry loading values"
2227
+ })] })]
2228
+ })
2229
+ ]
2230
+ }), x && /* @__PURE__ */ (0, $.jsx)(D, { label: "Loading values" })]
2231
+ })
2232
+ ]
2233
+ });
2234
+ }
2235
+ var Lt = (e, t) => {
2236
+ let n = e.getSelection(), r = Bt(e, n, t), i = n.applied.find(Ge), a = i ? K(i) : void 0;
2237
+ return {
2238
+ connectedFilters: r,
2239
+ associativeListFilter: i && a && (a === t || e.areFieldsConnected(t, a)) ? i.associativeListFilter : void 0
2240
+ };
2241
+ }, Rt = async (e, t, r, i) => {
2242
+ let a = qt(Kt(i));
2243
+ if (!a.length) return [];
2244
+ let { connectedFilters: o, associativeListFilter: s } = Lt(e, t.key), c = Ht(t.key, 0, a.length, n.Asc, [...o, {
2245
+ fieldKey: t.key,
2246
+ ...r.dateLevel ? { dateLevel: r.dateLevel } : {},
2247
+ ...r.datePart ? { datePart: r.datePart } : {},
2248
+ operator: W.FilterOperator.InList,
2249
+ values: a
2250
+ }], r.dateLevel, r.datePart, s);
2251
+ return Gt((await e.query(c)).data);
2252
+ }, zt = async (e, t, n, r) => {
2253
+ let { searchQuery: i = null, sortDirection: a, offset: o, limit: s } = r, c = r.availableOffset ?? 0, { connectedFilters: l, associativeListFilter: u } = Lt(e, t.key), d = l.length > 0 || !!u, f = i ? [Ut(t, i)] : [], p = Ht(t.key, o, s, a, f, n.dateLevel, n.datePart), m = Gt((await e.query(p)).data), h = [], g = [], _ = !1;
2254
+ if (d) {
2255
+ let r = Ht(t.key, c, s, a, [...l, ...f], n.dateLevel, n.datePart, u);
2256
+ if (h = Gt((await e.query(r)).data), _ = h.length >= s, o === 0) {
2257
+ let r = qt(Kt(n.values));
2258
+ if (r.length > 0) {
2259
+ let i = await Rt(e, t, n, r);
2260
+ g = r.filter((e) => !i.some((t) => Jt(e, t)));
2261
+ }
2262
+ }
2263
+ }
2264
+ return {
2265
+ values: m,
2266
+ availableValues: h,
2267
+ selectedExcluded: g,
2268
+ hasMore: m.length >= s,
2269
+ hasMoreAvailable: _,
2270
+ hasConnectedFilters: d
2271
+ };
2272
+ }, Bt = (e, t, n) => t.applied.filter(Vt).filter((t) => t.fieldKey !== n && e.areFieldsConnected(n, t.fieldKey)), Vt = (e) => "operator" in e && "values" in e && typeof e.fieldKey == "string", Ht = (e, t, n, r, i, a, o, s) => ({
2273
+ dimensions: [{
2274
+ fieldKey: e,
2275
+ ...a ? { dateLevel: a } : {},
2276
+ ...o ? { datePart: o } : {}
2277
+ }],
2278
+ offset: t,
2279
+ filters: i,
2280
+ ...s ? { associativeListFilter: s } : {},
2281
+ limit: n,
2282
+ measures: [],
2283
+ orders: [{
2284
+ direction: r,
2285
+ columnIdx: 0
2286
+ }]
2287
+ }), Ut = (e, t) => {
2288
+ if (t.includes(" ")) {
2289
+ let n = t.split(" ").filter((e) => e !== ""), r = Wt(e.dataType) ? n.map(Number).filter((e) => Number.isFinite(e)) : n;
2290
+ if (r.length > 0) return {
2291
+ fieldKey: e.key,
2292
+ operator: W.FilterOperator.InList,
2293
+ values: r
2294
+ };
2295
+ }
2296
+ return {
2297
+ fieldKey: e.key,
2298
+ operator: W.FilterOperator.Like,
2299
+ values: [t.toLocaleLowerCase()]
2300
+ };
2301
+ }, Wt = (e) => [
2302
+ W.FieldType.DECIMAL,
2303
+ W.FieldType.FLOAT,
2304
+ W.FieldType.INT,
2305
+ W.FieldType.REAL
2306
+ ].includes(e), Gt = (e) => Array.isArray(e) ? e.map((e) => e[0]) : Object.values(e).map((e) => e[0]), Kt = (e) => Array.isArray(e) ? e.filter((e) => e === null || typeof e == "string" || typeof e == "number" || typeof e == "boolean") : [], qt = (e) => [...new Set(e)], Jt = (e, t) => e === t || JSON.stringify(e) === JSON.stringify(t);
2307
+ function Yt({ field: e, filter: t, services: r, editorMode: i, disabledControls: a, onError: o }) {
2308
+ let [s, c] = (0, U.useState)(""), [l, u] = (0, U.useState)(""), [d, f] = (0, U.useState)([]), [p, m] = (0, U.useState)([]), [h, g] = (0, U.useState)([]), [_, v] = (0, U.useState)(!1), [y, b] = (0, U.useState)(!1), [x, ee] = (0, U.useState)(!1), [S, C] = (0, U.useState)(!1), [w, te] = (0, U.useState)(0), [ne, re] = (0, U.useState)(!0), [ie, ae] = (0, U.useState)(!1), [T, oe] = (0, U.useState)(null), [E, D] = (0, U.useState)(n.Asc), [, O] = (0, U.useState)(0), [k, A] = (0, U.useState)(null), j = (0, U.useRef)(/* @__PURE__ */ new Map()), M = (0, U.useRef)(0), N = (0, U.useRef)(null), se = (0, U.useRef)(null), ce = (0, U.useRef)(null), P = (0, U.useRef)({
2309
+ field: e,
2310
+ filter: t,
2311
+ searchQuery: l,
2312
+ sortDirection: E,
2313
+ showAllValues: S
2314
+ });
2315
+ P.current = {
2316
+ field: e,
2317
+ filter: t,
2318
+ searchQuery: l,
2319
+ sortDirection: E,
2320
+ showAllValues: S
2321
+ };
2322
+ let F = JSON.stringify([
2323
+ e.key,
2324
+ e.dataType,
2325
+ t.dateLevel,
2326
+ t.datePart,
2327
+ l,
2328
+ E,
2329
+ S,
2330
+ Lt(r, e.key)
2331
+ ]), le = JSON.stringify(Z(t)), I = ne || s !== l, L = x && !S ? y : _;
2332
+ (0, U.useEffect)(() => {
2333
+ let e = setTimeout(() => u(s), 300);
2334
+ return () => clearTimeout(e);
2335
+ }, [s]), (0, U.useEffect)(() => r.subscribe(() => O((e) => e + 1)), [r]), (0, U.useEffect)(() => {
2336
+ if (i !== "list") return;
2337
+ let { field: e, filter: t, searchQuery: n, sortDirection: a, showAllValues: s } = P.current, c = ++M.current;
2338
+ return N.current = null, re(!0), ae(!1), oe(null), o(null), A(null), j.current.clear(), zt(r, e, t, {
2339
+ searchQuery: n,
2340
+ sortDirection: a,
2341
+ offset: 0,
2342
+ availableOffset: 0,
2343
+ limit: 100
2344
+ }).then((e) => {
2345
+ if (M.current !== c) return;
2346
+ let r = e.hasConnectedFilters && !s ? [...e.availableValues, ...e.selectedExcluded] : e.values, i = n ? [] : Z(t);
2347
+ f([...new Map([...i, ...r].map((e) => [Q(e), e])).values()]), m(e.availableValues);
2348
+ let a = new Set(e.selectedExcluded.map(Q)), o = Z(t).filter((e) => !a.has(Q(e)));
2349
+ g(o), e.availableValues.forEach((e) => j.current.set(Q(e), !0)), Z(t).forEach((e) => j.current.set(Q(e), !a.has(Q(e)))), v(e.hasMore), b(e.hasMoreAvailable), ee(e.hasConnectedFilters), te(e.values.length), A(F), se.current && (se.current.scrollTop = 0);
2350
+ }).catch((e) => {
2351
+ M.current === c && o(e instanceof Error ? e.message : "Could not load filter values.");
2352
+ }).finally(() => {
2353
+ M.current === c && re(!1);
2354
+ }), () => {
2355
+ M.current++, N.current = null;
2356
+ };
2357
+ }, [
2358
+ i,
2359
+ r,
2360
+ F,
2361
+ o
2362
+ ]), (0, U.useEffect)(() => {
2363
+ if (i !== "list" || k !== F || !x) return;
2364
+ let { field: e, filter: t } = P.current, n = Z(t).filter((e) => !j.current.has(Q(e)));
2365
+ if (!n.length) return;
2366
+ let a = !0;
2367
+ return Rt(r, e, t, n).then((e) => {
2368
+ if (!a) return;
2369
+ let t = new Set(e.map(Q));
2370
+ n.forEach((e) => j.current.set(Q(e), t.has(Q(e)))), g((t) => [...new Map([...t, ...e].map((e) => [Q(e), e])).values()]);
2371
+ }).catch((e) => {
2372
+ a && o(e instanceof Error ? e.message : "Could not check selected value availability.");
2373
+ }), () => {
2374
+ a = !1;
2375
+ };
2376
+ }, [
2377
+ i,
2378
+ r,
2379
+ F,
2380
+ k,
2381
+ x,
2382
+ le,
2383
+ o
2384
+ ]);
2385
+ let R = (0, U.useCallback)(async () => {
2386
+ if (i !== "list" || a || I || !L || k !== F || N.current !== null) return;
2387
+ let n = ++M.current;
2388
+ N.current = n, ae(!0), oe(null);
2389
+ try {
2390
+ let i = await zt(r, e, t, {
2391
+ searchQuery: l,
2392
+ sortDirection: E,
2393
+ offset: w,
2394
+ availableOffset: p.length,
2395
+ limit: 100
2396
+ });
2397
+ if (M.current !== n) return;
2398
+ f((e) => {
2399
+ let t = i.hasConnectedFilters && !S ? i.availableValues : i.values;
2400
+ return [...e, ...t.filter((t) => !e.some((e) => Q(e) === Q(t)))];
2401
+ }), m((e) => [...e, ...i.availableValues.filter((t) => !e.some((e) => Q(e) === Q(t)))]), i.availableValues.forEach((e) => j.current.set(Q(e), !0)), v(i.hasMore), b(i.hasMoreAvailable), te((e) => e + i.values.length);
2402
+ } catch (e) {
2403
+ if (M.current !== n) return;
2404
+ oe(e instanceof Error ? e.message : "Could not load more filter values.");
2405
+ } finally {
2406
+ N.current === n && (N.current = null, ae(!1));
2407
+ }
2408
+ }, [
2409
+ i,
2410
+ a,
2411
+ I,
2412
+ L,
2413
+ k,
2414
+ F,
2415
+ r,
2416
+ e,
2417
+ t,
2418
+ l,
2419
+ E,
2420
+ w,
2421
+ p.length,
2422
+ S
2423
+ ]);
2424
+ return (0, U.useEffect)(() => {
2425
+ let e = se.current, t = ce.current;
2426
+ if (!e || !t || !L || T || I) return;
2427
+ let n = new IntersectionObserver((e) => {
2428
+ e.some((e) => e.isIntersecting) && R();
2429
+ }, {
2430
+ root: e,
2431
+ rootMargin: "0px 0px 120px 0px"
2432
+ });
2433
+ return n.observe(t), () => n.disconnect();
2434
+ }, [
2435
+ L,
2436
+ T,
2437
+ I,
2438
+ R
2439
+ ]), {
2440
+ searchInput: s,
2441
+ searchQuery: l,
2442
+ setSearchInput: c,
2443
+ resetSearch: () => {
2444
+ c(""), u("");
2445
+ },
2446
+ values: d,
2447
+ availableValues: p,
2448
+ availableSelectedValues: h,
2449
+ hasConnectedFilters: x,
2450
+ showAllValues: S,
2451
+ setShowAllValues: C,
2452
+ sortDirection: E,
2453
+ toggleSortDirection: () => D((e) => e === n.Asc ? n.Desc : n.Asc),
2454
+ isRefreshingValues: I,
2455
+ isLoadingMore: ie,
2456
+ loadMoreError: T,
2457
+ canLoadMore: L,
2458
+ loadMore: R,
2459
+ valueListRef: se,
2460
+ nextPageRef: ce
2461
+ };
2462
+ }
2463
+ function Xt({ field: e, filter: t, services: n, onChange: r, disabled: i = !1 }) {
2464
+ let [a, o] = (0, U.useState)(null), [s, c] = (0, U.useState)(!1), l = (0, U.useRef)(0), u = vt(e.dataType, t), d = n.getTimeZone() ?? "UTC", f = i || n.isLocked(e.key), p = (0, U.useMemo)(() => new Set(Z(t).map(Q)), [t.values]), m = n.isSingleSelect(e.key), h = Yt({
2465
+ field: e,
2466
+ filter: t,
2467
+ services: n,
2468
+ editorMode: u,
2469
+ disabledControls: f,
2470
+ onError: o
2471
+ });
2472
+ (0, U.useEffect)(() => {
2473
+ l.current++;
2474
+ }, [e.key, t]), (0, U.useEffect)(() => () => {
2475
+ l.current++;
2476
+ }, []);
2477
+ let g = (e) => {
2478
+ f || r(e);
2479
+ }, _ = async (r, i) => {
2480
+ let a = ++l.current;
2481
+ o(null);
2482
+ let s = Z(t), c = i ?? t.operator, f = [
2483
+ W.FilterOperator.NotInList,
2484
+ W.FilterOperator.NotLike,
2485
+ W.FilterOperator.NotBetween,
2486
+ W.FilterOperator.NotEquals,
2487
+ W.FilterOperator.NotContains
2488
+ ].includes(c);
2489
+ if (r === "list") {
2490
+ if (t.dynamicDate || t.dynamicDateCalc) {
2491
+ try {
2492
+ let r = await n.query({
2493
+ dimensions: [{ fieldKey: e.key }],
2494
+ measures: [],
2495
+ filters: [{
2496
+ ...t,
2497
+ fieldKey: e.key
2498
+ }],
2499
+ limit: 501
2500
+ });
2501
+ if (l.current !== a) return;
2502
+ let i = xt(r);
2503
+ if ((r.meta?.rows ?? i.length) > 500) {
2504
+ o("There are too many values in this dynamic date selection to choose individually. Keep the dynamic date filter or narrow it first.");
2505
+ return;
2506
+ }
2507
+ g({
2508
+ ...X(t),
2509
+ operator: W.FilterOperator.InList,
2510
+ values: i
2511
+ });
2512
+ } catch (e) {
2513
+ l.current === a && o(e instanceof Error ? e.message : "Could not convert the dynamic date to values.");
2514
+ }
2515
+ return;
2516
+ }
2517
+ if (t.dynamicDateCalcRange || t.dynamicDateRange) {
2518
+ try {
2519
+ let r = await n.query({
2520
+ dimensions: [{ fieldKey: e.key }],
2521
+ measures: [],
2522
+ filters: [{
2523
+ ...t,
2524
+ fieldKey: e.key,
2525
+ operator: W.FilterOperator.Between
2526
+ }],
2527
+ limit: 501
2528
+ });
2529
+ if (l.current !== a) return;
2530
+ let i = xt(r);
2531
+ if ((r.meta?.rows ?? i.length) > 500) {
2532
+ o("There are too many values in this dynamic period to select individually. Keep the period filter or narrow it first.");
2533
+ return;
2534
+ }
2535
+ h.resetSearch(), g({
2536
+ ...X(t),
2537
+ operator: f ? W.FilterOperator.NotInList : W.FilterOperator.InList,
2538
+ values: i
2539
+ });
2540
+ } catch (e) {
2541
+ l.current === a && o(e instanceof Error ? e.message : "Could not convert the dynamic period to values.");
2542
+ }
2543
+ return;
2544
+ }
2545
+ let r = St(e.key, t, 501);
2546
+ if (r) {
2547
+ if (!String(s[0] ?? "").trim()) {
2548
+ g({
2549
+ ...X(t),
2550
+ operator: f ? W.FilterOperator.NotInList : W.FilterOperator.InList,
2551
+ values: []
2552
+ });
2553
+ return;
2554
+ }
2555
+ try {
2556
+ let e = await n.query(r);
2557
+ if (l.current !== a) return;
2558
+ let i = xt(e);
2559
+ if ((e.meta?.rows ?? i.length) > 500) {
2560
+ o("There are too many matching values to convert. The text filter was kept unchanged.");
2561
+ return;
2562
+ }
2563
+ g({
2564
+ ...X(t),
2565
+ operator: f ? W.FilterOperator.NotInList : W.FilterOperator.InList,
2566
+ values: i
2567
+ });
2568
+ } catch (e) {
2569
+ l.current === a && o(e instanceof Error ? e.message : "Could not convert the text match to values.");
2570
+ }
2571
+ return;
2572
+ }
2573
+ if ([W.FilterOperator.Between, W.FilterOperator.NotBetween].includes(t.operator)) {
2574
+ try {
2575
+ let r = {
2576
+ ...t,
2577
+ operator: W.FilterOperator.Between,
2578
+ fieldKey: e.key
2579
+ }, i = await n.query({
2580
+ dimensions: [{ fieldKey: e.key }],
2581
+ measures: [],
2582
+ filters: [r],
2583
+ limit: 501
2584
+ });
2585
+ if (l.current !== a) return;
2586
+ let s = xt(i);
2587
+ if ((i.meta?.rows ?? s.length) > 500) {
2588
+ o("There are too many range values to select individually. Keep the range filter or narrow it first.");
2589
+ return;
2590
+ }
2591
+ g({
2592
+ ...X(t),
2593
+ operator: f ? W.FilterOperator.NotInList : W.FilterOperator.InList,
2594
+ values: s
2595
+ });
2596
+ } catch (e) {
2597
+ l.current === a && o(e instanceof Error ? e.message : "Could not convert the range to values.");
2598
+ }
2599
+ return;
2600
+ }
2601
+ g({
2602
+ ...X(t),
2603
+ operator: i ?? (f ? W.FilterOperator.NotInList : W.FilterOperator.InList),
2604
+ values: s
2605
+ });
2606
+ return;
2607
+ }
2608
+ if (r === "text") {
2609
+ let e = s[0], n = h.searchInput || (e == null ? "" : String(e));
2610
+ h.resetSearch(), g({
2611
+ ...X(t),
2612
+ operator: i ?? (f ? W.FilterOperator.NotLike : W.FilterOperator.Like),
2613
+ values: [n]
2614
+ });
2615
+ return;
2616
+ }
2617
+ if (r === "null") {
2618
+ g({
2619
+ ...X(t),
2620
+ operator: i ?? W.FilterOperator.Set,
2621
+ values: null
2622
+ });
2623
+ return;
2624
+ }
2625
+ if (r === "geo") {
2626
+ g({
2627
+ ...X(t),
2628
+ operator: W.FilterOperator.GeoIntersect,
2629
+ values: [null]
2630
+ });
2631
+ return;
2632
+ }
2633
+ if (r === "scalar") {
2634
+ g({
2635
+ ...X(t),
2636
+ operator: i ?? W.FilterOperator.Equals,
2637
+ values: [s[0] ?? null]
2638
+ });
2639
+ return;
2640
+ }
2641
+ if (r === "range" || r === "date") {
2642
+ let r = i ?? (f ? W.FilterOperator.NotBetween : W.FilterOperator.Between), c = [];
2643
+ if (s.length >= 2 && (u === "list" || u === "range" || u === "date") && (c = gt(s, e.dataType, d)), c.length !== 2 || c[0] == null || c[1] == null) try {
2644
+ let t = await n.query({
2645
+ dimensions: [],
2646
+ measures: [{
2647
+ fieldKeys: [e.key],
2648
+ aggregation: "MIN",
2649
+ filters: []
2650
+ }, {
2651
+ fieldKeys: [e.key],
2652
+ aggregation: "MAX",
2653
+ filters: []
2654
+ }]
2655
+ });
2656
+ if (l.current !== a) return;
2657
+ let r = Array.isArray(t.data) ? t.data[0] : Object.values(t.data)[0];
2658
+ Array.isArray(r) && r.length >= 2 && r[0] != null && r[1] != null && (c = [r[0], r[1]]);
2659
+ } catch (e) {
2660
+ l.current === a && o(e instanceof Error ? e.message : "Could not load the field range.");
2661
+ return;
2662
+ }
2663
+ g({
2664
+ ...X(t),
2665
+ operator: r,
2666
+ values: c.length === 2 ? c : [null, null]
2667
+ });
2668
+ return;
2669
+ }
2670
+ };
2671
+ return {
2672
+ editorMode: u,
2673
+ timeZone: d,
2674
+ disabledControls: f,
2675
+ valuesSelected: p,
2676
+ isSingleSelect: m,
2677
+ isChangingMode: s,
2678
+ error: a,
2679
+ valueList: h,
2680
+ update: g,
2681
+ switchMode: async (e) => {
2682
+ if (!s) {
2683
+ c(!0);
2684
+ try {
2685
+ await _(e);
2686
+ } finally {
2687
+ c(!1);
2688
+ }
2689
+ }
2690
+ },
2691
+ changeExclude: (e) => {
2692
+ let n = t.operator;
2693
+ u === "list" ? n = e ? W.FilterOperator.NotInList : W.FilterOperator.InList : u === "text" ? n = [W.FilterOperator.Contains, W.FilterOperator.NotContains].includes(t.operator) ? e ? W.FilterOperator.NotContains : W.FilterOperator.Contains : e ? W.FilterOperator.NotLike : W.FilterOperator.Like : u === "scalar" ? n = e ? W.FilterOperator.NotEquals : W.FilterOperator.Equals : (u === "range" || u === "date") && (n = u === "date" && [W.FilterOperator.Equals, W.FilterOperator.NotEquals].includes(t.operator) ? e ? W.FilterOperator.NotEquals : W.FilterOperator.Equals : e ? W.FilterOperator.NotBetween : W.FilterOperator.Between), g({
2694
+ ...t,
2695
+ operator: n
2696
+ });
2697
+ },
2698
+ changeOperator: (n) => {
2699
+ [W.FilterOperator.Set, W.FilterOperator.NotSet].includes(n) ? _("null", n) : n === W.FilterOperator.GeoIntersect ? _("geo", n) : [W.FilterOperator.InList, W.FilterOperator.NotInList].includes(n) ? _("list", n) : [W.FilterOperator.Between, W.FilterOperator.NotBetween].includes(n) ? Y(e.dataType) && (t.dynamicDateRange || t.dynamicDateCalcRange) ? g({
2700
+ ...t,
2701
+ operator: n
2702
+ }) : _(Y(e.dataType) ? "date" : "range", n) : [
2703
+ W.FilterOperator.Like,
2704
+ W.FilterOperator.NotLike,
2705
+ W.FilterOperator.Contains,
2706
+ W.FilterOperator.NotContains
2707
+ ].includes(n) ? _("text", n) : [W.FilterOperator.Equals, W.FilterOperator.NotEquals].includes(n) && Y(e.dataType) ? t.dynamicDate || t.dynamicDateCalc ? g({
2708
+ ...t,
2709
+ operator: n,
2710
+ values: []
2711
+ }) : g({
2712
+ ...X(t),
2713
+ operator: n,
2714
+ values: [Z(t)[0] ?? null]
2715
+ }) : Y(e.dataType) && (t.dynamicDate || t.dynamicDateCalc) ? g({
2716
+ ...t,
2717
+ operator: n,
2718
+ values: []
2719
+ }) : _("scalar", n);
2720
+ }
2721
+ };
2722
+ }
2723
+ function Zt({ showAdvancedOperators: e = !1, ...t }) {
2724
+ let n = Xt(t), { editorMode: r, timeZone: i, disabledControls: a, update: o, error: s } = n, { field: c, filter: l } = t, u = {
2725
+ field: c,
2726
+ filter: l,
2727
+ timeZone: i,
2728
+ disabledControls: a,
2729
+ update: o
2730
+ };
2731
+ return /* @__PURE__ */ (0, $.jsxs)("section", {
2732
+ className: "astrato-app-filter-bar__editor",
2733
+ "aria-label": `Filter ${c.name}`,
2734
+ children: [
2735
+ /* @__PURE__ */ (0, $.jsx)(Mt, {
2736
+ field: c,
2737
+ filter: l,
2738
+ editor: n,
2739
+ showAdvancedOperators: e
2740
+ }),
2741
+ r === "list" && /* @__PURE__ */ (0, $.jsx)(It, {
2742
+ field: c,
2743
+ filter: l,
2744
+ editor: n,
2745
+ showAdvancedOperators: e
2746
+ }),
2747
+ r === "text" && e && /* @__PURE__ */ (0, $.jsxs)("label", {
2748
+ className: "astrato-app-filter-bar__label",
2749
+ children: ["Match text", /* @__PURE__ */ (0, $.jsx)(jt, {
2750
+ field: c,
2751
+ filter: l,
2752
+ editor: n
2753
+ })]
2754
+ }),
2755
+ r === "scalar" && /* @__PURE__ */ (0, $.jsx)(Ft, { ...u }),
2756
+ r === "null" && /* @__PURE__ */ (0, $.jsx)("p", {
2757
+ className: "astrato-app-filter-bar__muted",
2758
+ children: "This operator matches whether the field has a value."
2759
+ }),
2760
+ r === "geo" && /* @__PURE__ */ (0, $.jsx)(Et, { ...u }),
2761
+ (r === "range" || r === "date") && /* @__PURE__ */ (0, $.jsx)(Pt, {
2762
+ ...u,
2763
+ editorMode: r
2764
+ }),
2765
+ s && /* @__PURE__ */ (0, $.jsx)("p", {
2766
+ className: "astrato-app-filter-bar__error",
2767
+ role: "alert",
2768
+ children: s
2769
+ })
2770
+ ]
2771
+ });
2772
+ }
2773
+ var Qt = (e) => !!e && typeof e == "object" && "fieldKey" in e && "operator" in e, $t = (e) => !!e.fieldKey && J(e), en = (e) => {
2774
+ let t = e.filters ?? [], n = t.filter(Qt), r = e.filterGroups ?? [];
2775
+ return [...t, ...r].length > 0 && t.length === n.length && n.every($t) && r.every(en);
2776
+ }, tn = (e = []) => ({
2777
+ filters: [e[0] ? dt(e[0]) : {
2778
+ fieldKey: "",
2779
+ operator: W.FilterOperator.InList,
2780
+ values: []
2781
+ }],
2782
+ filterGroups: [],
2783
+ or: !1
2784
+ }), nn = (e, t, n) => e.map((e, r) => r === t ? n(e) : e);
2785
+ function rn({ group: e, fields: t, services: n, onChange: r, disabled: i }) {
2786
+ let a = (t) => r(t(e)), o = (e, t) => {
2787
+ a((n) => ({
2788
+ ...n,
2789
+ filters: (n.filters ?? []).map((n, r) => r === e ? t : n)
2790
+ }));
2791
+ }, s = (e) => {
2792
+ a((t) => ({
2793
+ ...t,
2794
+ filters: (t.filters ?? []).filter((t, n) => n !== e)
2795
+ }));
2796
+ }, c = () => {
2797
+ a((e) => ({
2798
+ ...e,
2799
+ filters: [...e.filters ?? [], t[0] ? dt(t[0]) : {
2800
+ fieldKey: "",
2801
+ operator: W.FilterOperator.InList,
2802
+ values: []
2803
+ }]
2804
+ }));
2805
+ }, l = () => {
2806
+ a((e) => ({
2807
+ ...e,
2808
+ filterGroups: [...e.filterGroups ?? [], tn(t)]
2809
+ }));
2810
+ }, u = (e) => {
2811
+ a((t) => ({
2812
+ ...t,
2813
+ filterGroups: (t.filterGroups ?? []).filter((t, n) => n !== e)
2814
+ }));
2815
+ };
2816
+ return /* @__PURE__ */ (0, $.jsxs)("div", {
2817
+ className: "astrato-app-filter-bar__group",
2818
+ "data-operator": e.or ? "or" : "and",
2819
+ children: [
2820
+ /* @__PURE__ */ (0, $.jsxs)("div", {
2821
+ className: "astrato-app-filter-bar__row",
2822
+ children: [
2823
+ /* @__PURE__ */ (0, $.jsxs)("label", {
2824
+ className: "astrato-app-filter-bar__label",
2825
+ children: ["Match", /* @__PURE__ */ (0, $.jsxs)(O, {
2826
+ className: "astrato-app-filter-bar__control",
2827
+ value: e.or ? "or" : "and",
2828
+ disabled: i,
2829
+ onChange: (e) => a((t) => ({
2830
+ ...t,
2831
+ or: e.currentTarget.value === "or"
2832
+ })),
2833
+ children: [/* @__PURE__ */ (0, $.jsx)("option", {
2834
+ value: "and",
2835
+ children: "All conditions (AND)"
2836
+ }), /* @__PURE__ */ (0, $.jsx)("option", {
2837
+ value: "or",
2838
+ children: "Any condition (OR)"
2839
+ })]
2840
+ })]
2841
+ }),
2842
+ /* @__PURE__ */ (0, $.jsx)(T, {
2843
+ disabled: i,
2844
+ onClick: c,
2845
+ children: "Add condition"
2846
+ }),
2847
+ /* @__PURE__ */ (0, $.jsx)(T, {
2848
+ disabled: i,
2849
+ onClick: l,
2850
+ children: "Add nested group"
2851
+ })
2852
+ ]
2853
+ }),
2854
+ (e.filters ?? []).map((e, r) => {
2855
+ let a = t.find((t) => t.key === e.fieldKey);
2856
+ return /* @__PURE__ */ (0, $.jsxs)("div", {
2857
+ className: "astrato-app-filter-bar__condition",
2858
+ children: [/* @__PURE__ */ (0, $.jsxs)("div", {
2859
+ className: "astrato-app-filter-bar__row",
2860
+ children: [/* @__PURE__ */ (0, $.jsxs)("label", {
2861
+ className: "astrato-app-filter-bar__label",
2862
+ children: ["Field", /* @__PURE__ */ (0, $.jsxs)(O, {
2863
+ className: "astrato-app-filter-bar__control",
2864
+ value: e.fieldKey,
2865
+ disabled: i || !t.length,
2866
+ onChange: (e) => {
2867
+ let n = t.find((t) => t.key === e.currentTarget.value);
2868
+ n && o(r, dt(n));
2869
+ },
2870
+ children: [/* @__PURE__ */ (0, $.jsx)("option", {
2871
+ value: "",
2872
+ children: "Choose a field"
2873
+ }), t.map((e) => /* @__PURE__ */ (0, $.jsx)("option", {
2874
+ value: e.key,
2875
+ children: e.name
2876
+ }, e.key))]
2877
+ })]
2878
+ }), /* @__PURE__ */ (0, $.jsx)(T, {
2879
+ disabled: i,
2880
+ "aria-label": "Remove condition",
2881
+ onClick: () => s(r),
2882
+ children: "Remove"
2883
+ })]
2884
+ }), a && /* @__PURE__ */ (0, $.jsx)(Zt, {
2885
+ field: a,
2886
+ filter: e,
2887
+ services: n,
2888
+ disabled: i,
2889
+ showAdvancedOperators: !0,
2890
+ onChange: (e) => o(r, e)
2891
+ })]
2892
+ }, `filter-${r}`);
2893
+ }),
2894
+ (e.filterGroups ?? []).map((e, r) => /* @__PURE__ */ (0, $.jsxs)("div", {
2895
+ className: "astrato-app-filter-bar__nested-group",
2896
+ children: [/* @__PURE__ */ (0, $.jsxs)("div", {
2897
+ className: "astrato-app-filter-bar__row",
2898
+ children: [/* @__PURE__ */ (0, $.jsx)("span", {
2899
+ className: "astrato-app-filter-bar__muted",
2900
+ children: "Nested group"
2901
+ }), /* @__PURE__ */ (0, $.jsx)(T, {
2902
+ disabled: i,
2903
+ "aria-label": "Remove nested group",
2904
+ onClick: () => u(r),
2905
+ children: "Remove group"
2906
+ })]
2907
+ }), /* @__PURE__ */ (0, $.jsx)(rn, {
2908
+ group: e,
2909
+ fields: t,
2910
+ services: n,
2911
+ disabled: i,
2912
+ onChange: (e) => a((t) => ({
2913
+ ...t,
2914
+ filterGroups: (t.filterGroups ?? []).map((t, n) => n === r ? e : t)
2915
+ }))
2916
+ })]
2917
+ }, `group-${r}`))
2918
+ ]
2919
+ });
2920
+ }
2921
+ function an({ filter: e, fields: t, targetFields: n, services: r, onChange: i, disabled: a = !1 }) {
2922
+ let [o, s] = (0, U.useState)(e), [c, l] = (0, U.useState)([]), [u, d] = (0, U.useState)(null), f = n.find((e) => e.key === o.fieldKey), p = o.associativeListFilter;
2923
+ (0, U.useEffect)(() => s(e), [e]), (0, U.useEffect)(() => {
2924
+ let e = !0;
2925
+ return l([]), o.fieldKey ? (d(null), r.getAssociatedViews(o.fieldKey).then((t) => {
2926
+ e && l(t);
2927
+ }).catch((t) => {
2928
+ e && d(t instanceof Error ? t.message : "Could not load associated views.");
2929
+ }), () => {
2930
+ e = !1;
2931
+ }) : () => {
2932
+ e = !1;
2933
+ };
2934
+ }, [o.fieldKey, r]);
2935
+ let m = (0, U.useMemo)(() => t.filter((e) => c.includes(e.view ?? "")), [t, c]), h = (e, t) => s((n) => ({
2936
+ ...n,
2937
+ associativeListFilter: {
2938
+ ...n.associativeListFilter,
2939
+ view: f?.view ?? n.associativeListFilter.view,
2940
+ [e]: t
2941
+ }
2942
+ })), g = (e, t, n) => {
2943
+ let r = [...p[e] ?? []];
2944
+ r[t] = {
2945
+ ...r[t],
2946
+ filterGroup: n
2947
+ }, h(e, r);
2948
+ }, _ = (e) => {
2949
+ let t = { filterGroup: tn(m) };
2950
+ h(e, [...p[e] ?? [], t]);
2951
+ }, v = (e, t) => {
2952
+ let n = e === "intersectFilters" ? "unionFilters" : "intersectFilters", r = p[e]?.[t];
2953
+ r && s((i) => ({
2954
+ ...i,
2955
+ associativeListFilter: {
2956
+ ...i.associativeListFilter,
2957
+ [e]: (i.associativeListFilter[e] ?? []).filter((e, n) => n !== t),
2958
+ [n]: [...i.associativeListFilter[n] ?? [], r]
2959
+ }
2960
+ }));
2961
+ }, y = (e, t) => {
2962
+ h(e, (p[e] ?? []).filter((e, n) => n !== t));
2963
+ }, b = () => i({
2964
+ ...o,
2965
+ associativeListFilter: {
2966
+ ...p,
2967
+ view: f?.view ?? p.view
2968
+ }
2969
+ }), x = !!(p.intersectFilters?.length || p.unionFilters?.length), ee = [...p.intersectFilters ?? [], ...p.unionFilters ?? []], S = !!(o.fieldKey && ee.length && m.length && !u) && ee.every((e) => en(e.filterGroup)), C = (e, t) => /* @__PURE__ */ (0, $.jsxs)("section", {
2970
+ className: "astrato-app-filter-bar__association-list",
2971
+ "aria-label": t,
2972
+ children: [/* @__PURE__ */ (0, $.jsxs)("div", {
2973
+ className: "astrato-app-filter-bar__row",
2974
+ children: [/* @__PURE__ */ (0, $.jsx)("h4", {
2975
+ className: "astrato-app-filter-bar__field",
2976
+ children: t
2977
+ }), /* @__PURE__ */ (0, $.jsxs)(T, {
2978
+ disabled: a || !m.length,
2979
+ onClick: () => _(e),
2980
+ children: ["Add ", e === "intersectFilters" ? "intersection" : "union"]
2981
+ })]
2982
+ }), (p[e] ?? []).map((t, n) => /* @__PURE__ */ (0, $.jsxs)("article", {
2983
+ className: "astrato-app-filter-bar__association",
2984
+ "data-negative": t.isNegativeAssociation === !0,
2985
+ children: [/* @__PURE__ */ (0, $.jsxs)("div", {
2986
+ className: "astrato-app-filter-bar__row",
2987
+ children: [
2988
+ /* @__PURE__ */ (0, $.jsxs)("label", {
2989
+ className: "astrato-app-filter-bar__muted",
2990
+ children: [/* @__PURE__ */ (0, $.jsx)("input", {
2991
+ type: "checkbox",
2992
+ checked: t.isNegativeAssociation === !0,
2993
+ disabled: a,
2994
+ onChange: (t) => {
2995
+ let r = t.currentTarget.checked;
2996
+ h(e, nn(p[e] ?? [], n, (e) => ({
2997
+ ...e,
2998
+ isNegativeAssociation: r
2999
+ })));
3000
+ }
3001
+ }), "Exclude this association"]
3002
+ }),
3003
+ /* @__PURE__ */ (0, $.jsxs)(T, {
3004
+ disabled: a,
3005
+ onClick: () => v(e, n),
3006
+ children: ["Move to ", e === "intersectFilters" ? "union" : "intersection"]
3007
+ }),
3008
+ /* @__PURE__ */ (0, $.jsx)(T, {
3009
+ disabled: a,
3010
+ onClick: () => y(e, n),
3011
+ children: "Remove"
3012
+ })
3013
+ ]
3014
+ }), /* @__PURE__ */ (0, $.jsx)(rn, {
3015
+ group: t.filterGroup,
3016
+ fields: m,
3017
+ services: r,
3018
+ disabled: a,
3019
+ onChange: (t) => g(e, n, t)
3020
+ })]
3021
+ }, `${e}-${n}`))]
3022
+ });
3023
+ return /* @__PURE__ */ (0, $.jsxs)("section", {
3024
+ className: "astrato-app-filter-bar__editor",
3025
+ "aria-label": "Associative filter",
3026
+ children: [
3027
+ /* @__PURE__ */ (0, $.jsxs)("div", {
3028
+ className: "astrato-app-filter-bar__fieldset",
3029
+ children: [/* @__PURE__ */ (0, $.jsxs)("label", {
3030
+ className: "astrato-app-filter-bar__label",
3031
+ children: ["Associate from field", /* @__PURE__ */ (0, $.jsxs)(O, {
3032
+ className: "astrato-app-filter-bar__control",
3033
+ value: o.fieldKey,
3034
+ disabled: a || x,
3035
+ onChange: (e) => {
3036
+ let t = e.currentTarget.value, r = n.find((e) => e.key === t);
3037
+ s({
3038
+ ...o,
3039
+ fieldKey: t,
3040
+ associativeListFilter: {
3041
+ ...p,
3042
+ view: r?.view ?? ""
3043
+ }
3044
+ });
3045
+ },
3046
+ children: [/* @__PURE__ */ (0, $.jsx)("option", {
3047
+ value: "",
3048
+ children: "Choose a field"
3049
+ }), n.map((e) => /* @__PURE__ */ (0, $.jsx)("option", {
3050
+ value: e.key,
3051
+ children: e.name
3052
+ }, e.key))]
3053
+ })]
3054
+ }), /* @__PURE__ */ (0, $.jsx)("p", {
3055
+ className: "astrato-app-filter-bar__muted",
3056
+ children: f?.view ? `Conditions apply to associated fields from ${f.view}.` : "Choose a field to load its associated views."
3057
+ })]
3058
+ }),
3059
+ u && /* @__PURE__ */ (0, $.jsx)("p", {
3060
+ className: "astrato-app-filter-bar__error",
3061
+ role: "alert",
3062
+ children: u
3063
+ }),
3064
+ o.fieldKey && c.length === 0 && !u && /* @__PURE__ */ (0, $.jsx)("p", {
3065
+ className: "astrato-app-filter-bar__muted",
3066
+ children: "This field has no associated views."
3067
+ }),
3068
+ C("intersectFilters", "Intersections"),
3069
+ C("unionFilters", "Unions"),
3070
+ /* @__PURE__ */ (0, $.jsxs)("div", {
3071
+ className: "astrato-app-filter-bar__toolbar",
3072
+ children: [/* @__PURE__ */ (0, $.jsx)(T, {
3073
+ disabled: a,
3074
+ onClick: () => s(e),
3075
+ children: "Cancel"
3076
+ }), /* @__PURE__ */ (0, $.jsx)(T, {
3077
+ "data-primary": "true",
3078
+ disabled: a || !S,
3079
+ onClick: b,
3080
+ children: "Update filter"
3081
+ })]
3082
+ })
3083
+ ]
3084
+ });
3085
+ }
3086
+ var on = (e, t, n, r) => {
3087
+ let i = (e) => Math.max(8, Math.min(e, n.width - t.width - 8)), a = (e) => Math.max(8, Math.min(e, n.height - t.height - 8));
3088
+ if (r === "side") {
3089
+ let r = e.right + 8, i = e.left - t.width - 8;
3090
+ if (r + t.width <= n.width - 8) return {
3091
+ left: r,
3092
+ top: a(e.top)
3093
+ };
3094
+ if (i >= 8) return {
3095
+ left: i,
3096
+ top: a(e.top)
3097
+ };
3098
+ }
3099
+ let o = e.bottom + 8, s = o + t.height <= n.height - 8 ? o : e.top - t.height - 8;
3100
+ return {
3101
+ left: i(e.left),
3102
+ top: a(s)
3103
+ };
3104
+ };
3105
+ function sn(e, t, n) {
3106
+ let r = (0, U.useRef)(null), i = (0, U.useRef)(n);
3107
+ return i.current = n, (0, U.useLayoutEffect)(() => {
3108
+ let n = r.current;
3109
+ if (!n) return;
3110
+ let a = n.ownerDocument, o = a.defaultView;
3111
+ if (!o) return;
3112
+ let s = e.closest(".astrato-app-filter-bar"), c = t === "side" ? s : null, l = e.getBoundingClientRect(), u = () => {
3113
+ e.isConnected && (l = e.getBoundingClientRect());
3114
+ let r = n.getBoundingClientRect(), i = c?.getBoundingClientRect(), { left: a, top: s } = on(i ? {
3115
+ left: i.left,
3116
+ right: i.right,
3117
+ top: l.top,
3118
+ bottom: l.bottom
3119
+ } : l, r, {
3120
+ width: o.innerWidth,
3121
+ height: o.innerHeight
3122
+ }, t);
3123
+ n.style.left = `${a}px`, n.style.top = `${s}px`;
3124
+ }, d = (t) => {
3125
+ let r = t.composedPath();
3126
+ !r.includes(n) && !r.includes(e) && i.current();
3127
+ }, f = (e) => {
3128
+ "newState" in e && e.newState === "closed" && i.current();
3129
+ };
3130
+ n.setAttribute("popover", "auto"), typeof n.showPopover == "function" && n.showPopover(), u(), (n.querySelector("input[type=\"search\"]:not(:disabled)") ?? n.querySelector("input:not(:disabled),select:not(:disabled)") ?? n.querySelector("button:not(:disabled)"))?.focus(), n.addEventListener("toggle", f), a.addEventListener("pointerdown", d, !0), o.addEventListener("resize", u), o.addEventListener("scroll", u, !0);
3131
+ let p = typeof ResizeObserver > "u" ? void 0 : new ResizeObserver(u);
3132
+ return p?.observe(n), c && p?.observe(c), () => {
3133
+ n.removeEventListener("toggle", f), a.removeEventListener("pointerdown", d, !0), o.removeEventListener("resize", u), o.removeEventListener("scroll", u, !0), p?.disconnect();
3134
+ let t = n.getRootNode();
3135
+ if (n.contains(t.activeElement) || t.activeElement === a.body) {
3136
+ let t = e.isConnected && o.getComputedStyle(e).visibility !== "hidden", r = Array.from(s?.querySelectorAll("button:not(:disabled)") ?? []).find((e) => !n.contains(e) && e.getClientRects().length > 0 && o.getComputedStyle(e).visibility !== "hidden") ?? s;
3137
+ (t ? e : r)?.focus();
3138
+ }
3139
+ typeof n.hidePopover == "function" && n.matches(":popover-open") && n.hidePopover();
3140
+ };
3141
+ }, [e, t]), r;
3142
+ }
3143
+ function cn({ id: e, anchor: t, title: n, subtitle: r, icon: i, className: a = "", placement: o = "bottom", children: s, onClose: c }) {
3144
+ return /* @__PURE__ */ (0, $.jsxs)("div", {
3145
+ ref: sn(t, o, c),
3146
+ id: e,
3147
+ role: "dialog",
3148
+ tabIndex: -1,
3149
+ "aria-label": n,
3150
+ className: `astrato-app-filter-bar__popover ${a}`,
3151
+ onKeyDown: (e) => {
3152
+ ae(e), e.key === "Escape" && (e.preventDefault(), c());
3153
+ },
3154
+ children: [/* @__PURE__ */ (0, $.jsxs)("div", {
3155
+ className: "astrato-app-filter-bar__popover-header",
3156
+ children: [
3157
+ /* @__PURE__ */ (0, $.jsx)("span", {
3158
+ className: "astrato-app-filter-bar__heading-icon",
3159
+ "aria-hidden": "true",
3160
+ children: i ?? /* @__PURE__ */ (0, $.jsx)(_, { name: "filter" })
3161
+ }),
3162
+ /* @__PURE__ */ (0, $.jsxs)("div", {
3163
+ className: "astrato-app-filter-bar__heading",
3164
+ children: [/* @__PURE__ */ (0, $.jsx)("strong", { children: n }), r && /* @__PURE__ */ (0, $.jsx)("span", {
3165
+ className: "astrato-app-filter-bar__muted",
3166
+ children: r
3167
+ })]
3168
+ }),
3169
+ /* @__PURE__ */ (0, $.jsx)(T, {
3170
+ "data-variant": "ghost",
3171
+ "data-icon-only": "true",
3172
+ "aria-label": "Close filter editor",
3173
+ onClick: c,
3174
+ children: /* @__PURE__ */ (0, $.jsx)(_, { name: "close" })
3175
+ })
3176
+ ]
3177
+ }), s]
3178
+ });
3179
+ }
3180
+ var ln = (e, t, n, r) => {
3181
+ if (e.reduce((e, t) => e + t, 0) + Math.max(0, e.length - 1) * n <= t) return e.length;
3182
+ let i = 0, a = 0;
3183
+ for (let o = 0; o < e.length; o++) o > 0 && (i += e[o - 1] + n), i + r[e.length - o - 1] <= t && (a = o);
3184
+ return a;
3185
+ }, un = (e, t, n = 480, r = 960) => e !== "collapse-button" && e !== "wrap-collapse-button" ? e : t < n ? "button" : e === "wrap-collapse-button" && t >= Math.max(n, r) ? "wrap" : "collapse";
3186
+ function dn(e, t, n) {
3187
+ let r = (0, U.useRef)(null), [i, a] = (0, U.useState)(0);
3188
+ return (0, U.useLayoutEffect)(() => {
3189
+ let t = r.current;
3190
+ if (!t || !e) return;
3191
+ let n = t.ownerDocument.defaultView;
3192
+ if (!n) return;
3193
+ let i = Array.from(t.querySelectorAll(":scope > .astrato-app-filter-bar__chip")), o = Array.from(t.querySelectorAll("[data-overflow-count]")), s = () => {
3194
+ let e = Number.parseFloat(n.getComputedStyle(t).columnGap) || 0;
3195
+ a(ln(i.map((e) => e.getBoundingClientRect().width), t.clientWidth, e, o.map((e) => e.getBoundingClientRect().width)));
3196
+ };
3197
+ s();
3198
+ let c = new n.ResizeObserver(s);
3199
+ return c.observe(t), [...i, ...o].forEach((e) => c.observe(e)), () => c.disconnect();
3200
+ }, [
3201
+ e,
3202
+ t,
3203
+ n
3204
+ ]), {
3205
+ chipsRef: r,
3206
+ visibleCount: e ? Math.min(i, n) : n
3207
+ };
3208
+ }
3209
+ function fn(e, t) {
3210
+ let n = (0, U.useRef)(null), [r, i] = (0, U.useState)({
3211
+ width: 0,
3212
+ buttonBreakpoint: 480,
3213
+ collapseBreakpoint: 960
3214
+ });
3215
+ return (0, U.useLayoutEffect)(() => {
3216
+ let e = n.current, r = e?.ownerDocument.defaultView;
3217
+ if (!e || !r || !t) return;
3218
+ let a = () => {
3219
+ let t = r.getComputedStyle(e), n = {
3220
+ width: e.getBoundingClientRect().width,
3221
+ buttonBreakpoint: Number.parseFloat(t.getPropertyValue("--afb-button-breakpoint")) || 480,
3222
+ collapseBreakpoint: Number.parseFloat(t.getPropertyValue("--afb-collapse-breakpoint")) || 960
3223
+ };
3224
+ i((e) => e.width === n.width && e.buttonBreakpoint === n.buttonBreakpoint && e.collapseBreakpoint === n.collapseBreakpoint ? e : n);
3225
+ };
3226
+ a();
3227
+ let o = new r.ResizeObserver(a);
3228
+ return o.observe(e), () => o.disconnect();
3229
+ }, [t, e]), {
3230
+ barRef: n,
3231
+ overflow: un(e, r.width, r.buttonBreakpoint, r.collapseBreakpoint)
3232
+ };
3233
+ }
3234
+ var pn = "grouped-dimension-level-changed", mn = (e, t, n) => e.flatMap((e, n) => t.has(e) ? [n] : []).indexOf(n), hn = (e, t, n) => e.flatMap((e, n) => t.has(e) ? [n] : [])[n], gn = (e) => {
3235
+ let t = () => {
3236
+ let t = e.engine;
3237
+ if (!t) return [];
3238
+ let n = y(null, t), r = new Map(n.filter(c).map((e) => [e.key, e])), i = /* @__PURE__ */ new Map();
3239
+ for (let e of n) {
3240
+ if (c(e)) {
3241
+ i.set(e.key, {
3242
+ key: e.key,
3243
+ name: e.name,
3244
+ view: e.view,
3245
+ dataType: e.dataType
3246
+ });
3247
+ continue;
3248
+ }
3249
+ if (!o(e) || !e.dimension?.fieldKey) continue;
3250
+ let t = e.dimension.fieldKey, n = r.get(t);
3251
+ if (!i.has(t)) {
3252
+ let r = n?.dataType ?? a(e);
3253
+ if (!r) continue;
3254
+ i.set(t, {
3255
+ key: t,
3256
+ name: e.name,
3257
+ view: n?.view ?? e.dimension.view,
3258
+ dataType: r
3259
+ });
3260
+ }
3261
+ }
3262
+ return [...i.values()];
3263
+ }, n = () => {
3264
+ let t = e.selection.getActiveSelection(W.FilterType.ALL);
3265
+ if (typeof t != "object" || !t) return {
3266
+ applied: [],
3267
+ pending: []
3268
+ };
3269
+ let n = t;
3270
+ return {
3271
+ applied: Array.isArray(n.applied) ? n.applied : [],
3272
+ pending: Array.isArray(n.pending) ? n.pending : []
3273
+ };
3274
+ }, r = () => qe(n()), i = (e) => {
3275
+ let n = t().find((t) => t.key === e);
3276
+ return n?.view ? {
3277
+ name: n.name,
3278
+ view: n.view,
3279
+ fieldKey: e
3280
+ } : void 0;
3281
+ }, s = (e) => {
3282
+ let n = t().find((t) => t.key === e);
3283
+ return {
3284
+ fieldKey: e,
3285
+ name: n?.name ?? "",
3286
+ view: n?.view ?? ""
3287
+ };
3288
+ }, l = (t) => e.selection.isFieldLocked(s(t)), u = (t) => e.selection.getSingleSelectedFields().some((e) => K(e) === t), d = (t, n) => {
3289
+ e.selection.setNewSelectionState(t, n);
3290
+ }, f = /* @__PURE__ */ new Set(), p = [], m = /* @__PURE__ */ new Map(), h = () => f.forEach((e) => e()), g = () => {
3291
+ let n = t(), i = new Map(n.map((e) => [e.key, e])), a = r(), o = /* @__PURE__ */ new Set([
3292
+ ...n.map((e) => e.key),
3293
+ ...a.applied.map((e) => K(e)).filter((e) => !!e),
3294
+ ...a.pending.map((e) => K(e)).filter((e) => !!e)
3295
+ ]);
3296
+ for (let t of o) {
3297
+ if (m.has(t)) continue;
3298
+ let n = i.get(t), r = e.selection.isFieldLocked$({
3299
+ fieldKey: t,
3300
+ name: n?.name ?? "",
3301
+ view: n?.view ?? ""
3302
+ }).subscribe(h);
3303
+ m.set(t, r);
3304
+ }
3305
+ }, _ = () => {
3306
+ p.forEach((e) => e.unsubscribe()), p = [], m.forEach((e) => e.unsubscribe()), m.clear();
3307
+ }, v = (t) => {
3308
+ let n = () => t();
3309
+ if (f.add(n), f.size === 1) try {
3310
+ p.push(e.selection.onActiveSelectionChange.subscribe(() => {
3311
+ g(), h();
3312
+ }));
3313
+ let t = e.selection.singleSelectFields$?.subscribe(h);
3314
+ t && p.push(t);
3315
+ let n = e.selection.lockedFields$?.subscribe(h);
3316
+ n && p.push(n), p.push(e.getEvents({ type: pn }).subscribe(h)), g();
3317
+ } catch (e) {
3318
+ throw f.delete(n), _(), e;
3319
+ }
3320
+ return () => {
3321
+ f.delete(n), f.size === 0 && _();
3322
+ };
3323
+ }, b = (e, t) => {
3324
+ let r = K(e);
3325
+ if (!r || l(r)) return;
3326
+ let i = t === "inherit" ? S() : t, a = n(), o = qe(a), s = q(e);
3327
+ if (!Ge(e) && !J(e) && u(r) && [...o.applied, ...o.pending].some((e) => q(e) === s && J(e))) return;
3328
+ if (i === "auto") {
3329
+ if (!J(e)) {
3330
+ let e = {
3331
+ applied: a.applied.filter((e) => q(e) !== s),
3332
+ pending: a.pending.filter((e) => q(e) !== s)
3333
+ };
3334
+ d(e, W.FilterType.ALL);
3335
+ return;
3336
+ }
3337
+ let t = {
3338
+ applied: [...a.applied.filter((e) => q(e) !== s), e],
3339
+ pending: a.pending.filter((e) => q(e) !== s)
3340
+ };
3341
+ d(t, W.FilterType.ALL);
3342
+ return;
3343
+ }
3344
+ let c = {
3345
+ applied: a.applied,
3346
+ pending: [...a.pending.filter((e) => q(e) !== s), e]
3347
+ };
3348
+ d(c, W.FilterType.ALL);
3349
+ }, x = (e) => {
3350
+ let t = K(e);
3351
+ if (!t || l(t) || u(t)) return;
3352
+ let r = Ke(e), i = n(), a = {
3353
+ applied: i.applied.filter((e) => Ke(e) !== r),
3354
+ pending: i.pending.filter((e) => Ke(e) !== r)
3355
+ };
3356
+ d(a, W.FilterType.ALL);
3357
+ }, ee = () => {
3358
+ let n = e.engine;
3359
+ if (!n) return [];
3360
+ let r = t(), i = new Map(r.map((e) => [e.key, e])), a = n.getGroupedDimensions();
3361
+ return y(null, n).flatMap((e) => {
3362
+ if (!o(e) || !e.dimension?.group?.fieldKeys.length) return [];
3363
+ let t = e.dimension.group.fieldKeys.map((e) => i.get(e)).filter((e) => !!e);
3364
+ if (t.length === 0) return [];
3365
+ let n = a[e.id] ?? e.dimension.group.fieldKeys.indexOf(e.dimension.fieldKey), r = mn(e.dimension.group.fieldKeys, new Set(i.keys()), n), s = r >= 0 ? r : Math.max(0, t.findIndex((t) => t.key === e.dimension.fieldKey));
3366
+ return [{
3367
+ id: e.id,
3368
+ name: e.name,
3369
+ fields: t,
3370
+ selectedIndex: s
3371
+ }];
3372
+ });
3373
+ }, S = () => e.selection.getSelectionMode?.() === "manual" ? "manual" : "auto", C = () => {
3374
+ try {
3375
+ return e.engine?.capabilities?.associativeFiltering === !0;
3376
+ } catch {
3377
+ return !1;
3378
+ }
3379
+ }, w = async (t) => {
3380
+ let n = e.engine;
3381
+ if (!n) return [];
3382
+ if (n.getAssociatedViews) return n.getAssociatedViews(t);
3383
+ let { viewStates: r = [] } = await n.buildQuery({
3384
+ dimensions: [{ fieldKey: t }],
3385
+ measures: [],
3386
+ filters: []
3387
+ }), i = r.some((e) => typeof e.alfStatus == "string");
3388
+ return r.filter((e) => i ? e.alfStatus === "nonVia" : e.compatibleTypeFlags?.associativeListFilter).map((e) => e.view);
3389
+ };
3390
+ return {
3391
+ getFields: t,
3392
+ getSelection: r,
3393
+ subscribe: v,
3394
+ select: b,
3395
+ remove: x,
3396
+ apply: () => {
3397
+ let t = n().pending;
3398
+ e.selection.confirmSelectionAll(t, {
3399
+ overrideValues: !0,
3400
+ overrideOperator: !0
3401
+ });
3402
+ },
3403
+ cancel: () => {
3404
+ let e = n();
3405
+ d({
3406
+ applied: e.applied,
3407
+ pending: []
3408
+ }, W.FilterType.ALL);
3409
+ },
3410
+ clear: () => e.selection.clearAllSelection(),
3411
+ isLocked: l,
3412
+ isSingleSelect: (t) => e.selection.getSingleSelectedFields().some((e) => K(e) === t),
3413
+ canLock: e.selection.canLock === !0,
3414
+ toggleLock: (t) => {
3415
+ e.selection.toggleFieldLocked(s(t));
3416
+ },
3417
+ query: async (t) => {
3418
+ if (!e.engine) throw Error("Cannot query filter values without an engine");
3419
+ return await e.engine.getData(t);
3420
+ },
3421
+ areFieldsConnected: (t, n) => {
3422
+ let r = i(t), a = i(n);
3423
+ return r && a ? e.engine?.areFieldsConnected(r, a) ?? !1 : !1;
3424
+ },
3425
+ get supportsAssociativeFiltering() {
3426
+ return C();
3427
+ },
3428
+ getAssociativeFields: async (e, t) => {
3429
+ if (!C() || t.aborted) return [];
3430
+ let n = e.filter((e) => e.view), r = new Set(n.map((e) => e.view)), i = /* @__PURE__ */ new Set(), a = 0;
3431
+ return await Promise.all(Array.from({ length: Math.min(4, n.length) }, async () => {
3432
+ for (; !t.aborted && a < n.length;) {
3433
+ let e = n[a++];
3434
+ try {
3435
+ (await w(e.key)).some((e) => r.has(e)) && i.add(e.key);
3436
+ } catch {}
3437
+ }
3438
+ })), t.aborted || !C() ? [] : n.filter((e) => i.has(e.key));
3439
+ },
3440
+ getAssociatedViews: w,
3441
+ getSelectionMode: S,
3442
+ getTimeZone: () => e.engine?.localeSettings?.timezone,
3443
+ getDimensionGroups: ee,
3444
+ setDimensionGroup: (n, r) => {
3445
+ let i = e.engine;
3446
+ if (!i || r < 0) return;
3447
+ let a = y(null, i).find((e) => o(e) && e.id === n && e.dimension?.group?.fieldKeys), s = a && o(a) ? a.dimension?.group?.fieldKeys : void 0, c = new Map(t().map((e) => [e.key, e])), l = s ? hn(s, new Set(c.keys()), r) : void 0;
3448
+ l !== void 0 && e.emitEvent(pn, {
3449
+ ...i.getGroupedDimensions(),
3450
+ [n]: l
3451
+ });
3452
+ }
3453
+ };
3454
+ }, _n = {
3455
+ overflow: "auto",
3456
+ overscrollBehavior: "contain",
3457
+ scrollbarWidth: "thin",
3458
+ scrollbarColor: "var(--afb-scrollbar-thumb, var(--afb-border, #e4e4e7)) var(--afb-scrollbar-track, transparent)"
3459
+ }, vn = {
3460
+ boxSizing: "border-box",
3461
+ display: "flex",
3462
+ alignItems: "center",
3463
+ flexWrap: "wrap",
3464
+ gap: "var(--afb-gap, 8px)",
3465
+ minHeight: "var(--afb-height, 48px)",
3466
+ padding: "var(--afb-padding, 8px 12px)",
3467
+ background: "var(--afb-surface, #fff)",
3468
+ color: "var(--afb-text, #27272a)",
3469
+ border: "var(--afb-border-width, 1px) solid var(--afb-border, #e4e4e7)",
3470
+ borderRadius: "var(--afb-radius, 10px)",
3471
+ fontFamily: "var(--afb-font-family, system-ui, sans-serif)",
3472
+ fontSize: "var(--afb-font-size, 13px)",
3473
+ lineHeight: 1.5,
3474
+ "& *, & *::before, & *::after": { boxSizing: "border-box" },
3475
+ "& .astrato-app-filter-bar__icon": {
3476
+ flexShrink: 0,
3477
+ verticalAlign: "middle"
3478
+ },
3479
+ "& .astrato-app-filter-bar__button": {
3480
+ appearance: "none",
3481
+ display: "inline-flex",
3482
+ alignItems: "center",
3483
+ justifyContent: "center",
3484
+ gap: 6,
3485
+ minHeight: "var(--afb-control-height, 32px)",
3486
+ padding: "var(--afb-button-padding, 5px 10px)",
3487
+ border: "1px solid var(--afb-border, #e4e4e7)",
3488
+ borderRadius: "var(--afb-control-radius, 7px)",
3489
+ background: "var(--afb-control-surface, #fff)",
3490
+ color: "var(--afb-text, #27272a)",
3491
+ font: "inherit",
3492
+ fontWeight: 500,
3493
+ cursor: "pointer",
3494
+ whiteSpace: "nowrap",
3495
+ "&:hover:not(:disabled)": { background: "var(--afb-hover, #f4f4f5)" },
3496
+ "&:disabled": {
3497
+ opacity: .4,
3498
+ cursor: "not-allowed"
3499
+ },
3500
+ "&[data-variant=\"ghost\"]": {
3501
+ background: "transparent",
3502
+ borderColor: "transparent",
3503
+ color: "var(--afb-muted, #71717a)"
3504
+ },
3505
+ "&[data-variant=\"ghost\"]:hover:not(:disabled)": {
3506
+ background: "var(--afb-hover, #f4f4f5)",
3507
+ color: "var(--afb-text, #27272a)"
3508
+ },
3509
+ "&[data-icon-only=\"true\"]": {
3510
+ width: "var(--afb-control-height, 32px)",
3511
+ padding: 4,
3512
+ flexShrink: 0
3513
+ },
3514
+ "&[data-primary=\"true\"]": {
3515
+ background: "var(--afb-accent, #3f3f46)",
3516
+ color: "var(--afb-on-accent, #fff)",
3517
+ borderColor: "var(--afb-accent, #3f3f46)",
3518
+ "&:hover:not(:disabled)": { background: "var(--afb-accent-hover, color-mix(in srgb, var(--afb-accent, #3f3f46) 90%, #000))" }
3519
+ }
3520
+ },
3521
+ "& button:focus-visible, & input:focus-visible, & select:focus-visible, & summary:focus-visible": {
3522
+ outline: "2px solid var(--afb-focus, #71717a)",
3523
+ outlineOffset: 2
3524
+ },
3525
+ "& .astrato-app-filter-bar__chips, & .astrato-app-filter-bar__actions": {
3526
+ display: "flex",
3527
+ alignItems: "center",
3528
+ flexWrap: "wrap",
3529
+ gap: "var(--afb-gap, 8px)"
3530
+ },
3531
+ "& .astrato-app-filter-bar__chips": {
3532
+ flex: "1 1 auto",
3533
+ minWidth: 0
3534
+ },
3535
+ "& .astrato-app-filter-bar__chip": {
3536
+ display: "inline-flex",
3537
+ maxWidth: "min(100%, var(--afb-chip-max-width, 320px))",
3538
+ alignItems: "center",
3539
+ borderRadius: "var(--afb-chip-radius, 8px)",
3540
+ background: "var(--afb-chip-surface, #f4f4f5)",
3541
+ border: "1px solid var(--afb-chip-border, #e4e4e7)",
3542
+ "&[data-pending=\"true\"]": {
3543
+ borderColor: "var(--afb-pending, #a16207)",
3544
+ borderStyle: "dashed"
3545
+ },
3546
+ "&[data-excluded=\"true\"]": { color: "var(--afb-excluded, #b45309)" },
3547
+ "& .astrato-app-filter-bar__button": {
3548
+ background: "transparent",
3549
+ border: 0,
3550
+ color: "inherit",
3551
+ minWidth: 0
3552
+ }
3553
+ },
3554
+ "& .astrato-app-filter-bar__chip-label": {
3555
+ overflow: "hidden",
3556
+ textOverflow: "ellipsis",
3557
+ whiteSpace: "nowrap",
3558
+ fontWeight: 400
3559
+ },
3560
+ "& .astrato-app-filter-bar__chip-label strong": { fontWeight: 600 },
3561
+ "& .astrato-app-filter-bar__chip-divider": {
3562
+ paddingInline: 6,
3563
+ opacity: .5
3564
+ },
3565
+ "&[data-orientation=\"horizontal\"][data-overflow=\"collapse\"]": {
3566
+ flexWrap: "nowrap",
3567
+ height: "var(--afb-height, 48px)",
3568
+ minHeight: 0,
3569
+ position: "relative",
3570
+ "& > .astrato-app-filter-bar__button, & > .astrato-app-filter-bar__actions": { flexShrink: 0 },
3571
+ "& > .astrato-app-filter-bar__actions": { flexWrap: "nowrap" },
3572
+ "& > .astrato-app-filter-bar__chips": {
3573
+ position: "relative",
3574
+ flex: "1 1 0",
3575
+ flexWrap: "nowrap",
3576
+ "& > .astrato-app-filter-bar__chip": { flexShrink: 0 }
3577
+ },
3578
+ "& > .astrato-app-filter-bar__error": {
3579
+ position: "absolute",
3580
+ top: "100%",
3581
+ insetInline: 0,
3582
+ zIndex: "var(--afb-z-index, 1400)",
3583
+ background: "var(--afb-surface, #fff)"
3584
+ }
3585
+ },
3586
+ "&[data-overflow=\"button\"]": {
3587
+ height: "auto",
3588
+ minHeight: 0,
3589
+ padding: 0,
3590
+ border: 0,
3591
+ borderRadius: 0,
3592
+ background: "transparent",
3593
+ flexWrap: "nowrap",
3594
+ "& > .astrato-app-filter-bar__trigger": {
3595
+ width: "100%",
3596
+ minWidth: 0,
3597
+ minHeight: "var(--afb-trigger-height, var(--afb-height, 48px))",
3598
+ padding: "var(--afb-trigger-padding, var(--afb-button-padding, 5px 10px))",
3599
+ justifyContent: "var(--afb-trigger-align, center)",
3600
+ gap: "var(--afb-trigger-gap, 6px)",
3601
+ fontWeight: "var(--afb-trigger-font-weight, 500)",
3602
+ background: "var(--afb-trigger-surface, var(--afb-overflow-surface, var(--afb-chip-surface, #f4f4f5)))",
3603
+ color: "var(--afb-trigger-text, var(--afb-overflow-text, var(--afb-text, #27272a)))",
3604
+ borderColor: "var(--afb-trigger-border, var(--afb-overflow-border, var(--afb-chip-border, #e4e4e7)))",
3605
+ borderWidth: "var(--afb-trigger-border-width, 1px)",
3606
+ borderRadius: "var(--afb-trigger-radius, var(--afb-overflow-radius, var(--afb-chip-radius, 8px)))",
3607
+ boxShadow: "var(--afb-trigger-shadow, none)",
3608
+ "&:hover:not(:disabled)": { background: "var(--afb-trigger-hover, var(--afb-overflow-hover, var(--afb-hover, #f4f4f5)))" },
3609
+ "&[aria-expanded=\"true\"]": { background: "var(--afb-trigger-open-surface, var(--afb-overflow-open-surface, var(--afb-selected-surface, var(--afb-hover, #f4f4f5))))" },
3610
+ "&[data-pending=\"true\"]": { borderColor: "var(--afb-pending, #a16207)" },
3611
+ "@media (forced-colors: active)": {
3612
+ borderColor: "ButtonText",
3613
+ "&[data-pending=\"true\"]": { borderColor: "Highlight" }
3614
+ }
3615
+ }
3616
+ },
3617
+ "& [data-overflow-hidden=\"true\"]": {
3618
+ position: "absolute",
3619
+ visibility: "hidden",
3620
+ pointerEvents: "none"
3621
+ },
3622
+ "& .astrato-app-filter-bar__overflow": {
3623
+ flexShrink: 0,
3624
+ position: "relative",
3625
+ background: "var(--afb-overflow-surface, var(--afb-chip-surface, #f4f4f5))",
3626
+ color: "var(--afb-overflow-text, var(--afb-text, #27272a))",
3627
+ borderColor: "var(--afb-overflow-border, var(--afb-chip-border, #e4e4e7))",
3628
+ borderRadius: "var(--afb-overflow-radius, var(--afb-chip-radius, 8px))",
3629
+ "&:hover:not(:disabled)": { background: "var(--afb-overflow-hover, var(--afb-hover, #f4f4f5))" },
3630
+ "&[aria-expanded=\"true\"]": { background: "var(--afb-overflow-open-surface, var(--afb-selected-surface, var(--afb-hover, #f4f4f5)))" },
3631
+ "&[data-pending=\"true\"]": {
3632
+ borderColor: "var(--afb-pending, #a16207)",
3633
+ borderStyle: "dashed",
3634
+ "&::after": {
3635
+ content: "\"\"",
3636
+ position: "absolute",
3637
+ width: "var(--afb-overflow-badge-size, 6px)",
3638
+ height: "var(--afb-overflow-badge-size, 6px)",
3639
+ top: -3,
3640
+ insetInlineEnd: -3,
3641
+ borderRadius: "50%",
3642
+ background: "var(--afb-pending, #a16207)"
3643
+ }
3644
+ },
3645
+ "@media (forced-colors: active)": {
3646
+ borderColor: "ButtonText",
3647
+ "&[data-pending=\"true\"]": {
3648
+ borderColor: "Highlight",
3649
+ "&::after": { background: "Highlight" }
3650
+ }
3651
+ }
3652
+ },
3653
+ "& .astrato-app-filter-bar__overflow-probes": {
3654
+ position: "absolute",
3655
+ visibility: "hidden",
3656
+ pointerEvents: "none",
3657
+ display: "flex",
3658
+ width: "max-content"
3659
+ },
3660
+ "& .astrato-app-filter-bar__overflow-list": {
3661
+ ..._n,
3662
+ padding: 4,
3663
+ display: "flex",
3664
+ flexDirection: "column",
3665
+ alignItems: "stretch",
3666
+ gap: "var(--afb-gap, 8px)",
3667
+ maxHeight: "var(--afb-overflow-list-height, var(--afb-list-height, 260px))",
3668
+ "& > .astrato-app-filter-bar__chip": {
3669
+ maxWidth: "100%",
3670
+ flexShrink: 0,
3671
+ "& > button:first-of-type": {
3672
+ flex: 1,
3673
+ justifyContent: "flex-start"
3674
+ }
3675
+ }
3676
+ },
3677
+ "&[data-orientation=\"vertical\"]": {
3678
+ width: "100%",
3679
+ flexDirection: "column",
3680
+ flexWrap: "nowrap",
3681
+ alignItems: "stretch",
3682
+ "& > .astrato-app-filter-bar__button": { justifyContent: "flex-start" },
3683
+ "& > .astrato-app-filter-bar__chips": {
3684
+ flexDirection: "column",
3685
+ alignItems: "stretch",
3686
+ flex: "0 1 auto"
3687
+ },
3688
+ "& > .astrato-app-filter-bar__chips > .astrato-app-filter-bar__chip": {
3689
+ boxSizing: "border-box",
3690
+ width: "100%",
3691
+ maxWidth: "none",
3692
+ "& > button:first-of-type": {
3693
+ flex: 1,
3694
+ justifyContent: "flex-start",
3695
+ padding: "var(--afb-vertical-chip-padding, 9px 10px)",
3696
+ textAlign: "start"
3697
+ },
3698
+ "& .astrato-app-filter-bar__chip-label": {
3699
+ flex: 1,
3700
+ minWidth: 0,
3701
+ whiteSpace: "normal"
3702
+ },
3703
+ "& .astrato-app-filter-bar__chip-label strong": {
3704
+ display: "block",
3705
+ overflowWrap: "anywhere"
3706
+ },
3707
+ "& .astrato-app-filter-bar__chip-divider": { display: "none" },
3708
+ "& .astrato-app-filter-bar__chip-summary": {
3709
+ display: "block",
3710
+ color: "inherit",
3711
+ opacity: .8,
3712
+ fontSize: "0.92em",
3713
+ overflow: "hidden",
3714
+ textOverflow: "ellipsis",
3715
+ whiteSpace: "nowrap"
3716
+ }
3717
+ },
3718
+ "& > .astrato-app-filter-bar__actions": {
3719
+ justifyContent: "flex-end",
3720
+ paddingTop: 8,
3721
+ borderTop: "1px solid var(--afb-border, #e4e4e7)",
3722
+ "&:empty": { display: "none" }
3723
+ },
3724
+ "& .astrato-app-filter-bar__empty-bar": {
3725
+ paddingBlock: 12,
3726
+ whiteSpace: "normal"
3727
+ },
3728
+ "& > .astrato-app-filter-bar__error": { flexBasis: "auto" }
3729
+ },
3730
+ "& .astrato-app-filter-bar__muted": { color: "var(--afb-muted, #71717a)" },
3731
+ "& .astrato-app-filter-bar__empty-bar": {
3732
+ display: "inline-flex",
3733
+ alignItems: "center",
3734
+ gap: 7,
3735
+ color: "var(--afb-muted, #71717a)",
3736
+ paddingInline: 4
3737
+ },
3738
+ "& .astrato-app-filter-bar__error": {
3739
+ color: "var(--afb-error, #b91c1c)",
3740
+ whiteSpace: "normal",
3741
+ margin: "8px 0",
3742
+ flexBasis: "100%"
3743
+ }
3744
+ }, yn = {
3745
+ "& .astrato-app-filter-bar__modal": {
3746
+ ..._n,
3747
+ inset: 0,
3748
+ margin: "auto",
3749
+ width: "var(--afb-modal-width, 560px)",
3750
+ maxWidth: "calc(100vw - 32px)",
3751
+ maxHeight: "calc(100dvh - 32px)",
3752
+ padding: "var(--afb-popup-padding, 16px)",
3753
+ border: "1px solid var(--afb-border, #e4e4e7)",
3754
+ borderRadius: "var(--afb-popup-radius, 12px)",
3755
+ background: "var(--afb-popup-surface, var(--afb-surface, #fff))",
3756
+ color: "var(--afb-text, #27272a)",
3757
+ boxShadow: "var(--afb-popup-shadow, 0 16px 48px #0002, 0 2px 8px #0001)",
3758
+ font: "inherit",
3759
+ "&::backdrop": { background: "var(--afb-modal-backdrop, #0006)" },
3760
+ "& > .astrato-app-filter-bar__popover-header": { justifyContent: "space-between" },
3761
+ "& > .astrato-app-filter-bar": {
3762
+ border: 0,
3763
+ padding: 0,
3764
+ background: "transparent"
3765
+ }
3766
+ },
3767
+ "& .astrato-app-filter-bar__popover": {
3768
+ ..._n,
3769
+ position: "fixed",
3770
+ inset: "auto",
3771
+ margin: 0,
3772
+ width: "var(--afb-popup-width, 360px)",
3773
+ maxWidth: "calc(100vw - 16px)",
3774
+ maxHeight: "calc(100dvh - 32px)",
3775
+ padding: "var(--afb-popup-padding, 16px)",
3776
+ zIndex: "var(--afb-z-index, 1400)",
3777
+ border: "1px solid var(--afb-border, #e4e4e7)",
3778
+ borderRadius: "var(--afb-popup-radius, 12px)",
3779
+ background: "var(--afb-popup-surface, var(--afb-surface, #fff))",
3780
+ color: "var(--afb-text, #27272a)",
3781
+ boxShadow: "var(--afb-popup-shadow, 0 16px 48px #0002, 0 2px 8px #0001)",
3782
+ font: "inherit",
3783
+ "&::backdrop": { background: "transparent" }
3784
+ },
3785
+ "& .astrato-app-filter-bar__popover-header": {
3786
+ display: "flex",
3787
+ alignItems: "center",
3788
+ gap: 10,
3789
+ paddingBottom: 14,
3790
+ marginBottom: 14,
3791
+ borderBottom: "1px solid var(--afb-border, #e4e4e7)"
3792
+ },
3793
+ "& .astrato-app-filter-bar__heading-icon, & .astrato-app-filter-bar__field-icon": {
3794
+ display: "inline-flex",
3795
+ alignItems: "center",
3796
+ justifyContent: "center",
3797
+ flexShrink: 0,
3798
+ width: 32,
3799
+ height: 32,
3800
+ borderRadius: "var(--afb-control-radius, 7px)",
3801
+ background: "var(--afb-chip-surface, #f4f4f5)",
3802
+ color: "var(--afb-muted, #71717a)",
3803
+ "& svg": {
3804
+ width: 16,
3805
+ height: 16
3806
+ }
3807
+ },
3808
+ "& .astrato-app-filter-bar__heading": {
3809
+ display: "flex",
3810
+ flexDirection: "column",
3811
+ flex: 1,
3812
+ minWidth: 0,
3813
+ overflowWrap: "anywhere",
3814
+ "& strong": {
3815
+ fontSize: "1.08em",
3816
+ fontWeight: 600
3817
+ },
3818
+ "& > span": { fontSize: "0.9em" }
3819
+ }
3820
+ }, bn = {
3821
+ "& .astrato-app-filter-bar__row, & .astrato-app-filter-bar__toolbar": {
3822
+ display: "flex",
3823
+ flexWrap: "wrap",
3824
+ alignItems: "center",
3825
+ gap: "var(--afb-gap, 8px)",
3826
+ marginBlock: 8
3827
+ },
3828
+ "& .astrato-app-filter-bar__field": {
3829
+ display: "flex",
3830
+ flexDirection: "column",
3831
+ gap: 4,
3832
+ minWidth: 0,
3833
+ flex: "1 1 120px"
3834
+ },
3835
+ "& .astrato-app-filter-bar__label": {
3836
+ fontWeight: 500,
3837
+ display: "block",
3838
+ marginBottom: 8
3839
+ },
3840
+ "& .astrato-app-filter-bar__range-inputs": {
3841
+ display: "grid",
3842
+ gridTemplateColumns: "minmax(0, 1fr)",
3843
+ "& > .astrato-app-filter-bar__label": { minWidth: 0 }
3844
+ },
3845
+ "& .astrato-app-filter-bar__label > input, & .astrato-app-filter-bar__label > select": { marginTop: 4 },
3846
+ "& .astrato-app-filter-bar__input, & .astrato-app-filter-bar__select": {
3847
+ boxSizing: "border-box",
3848
+ minHeight: "var(--afb-control-height, 32px)",
3849
+ width: "100%",
3850
+ minWidth: 0,
3851
+ padding: "6px 10px",
3852
+ border: "1px solid var(--afb-border, #e4e4e7)",
3853
+ borderRadius: "var(--afb-control-radius, 7px)",
3854
+ background: "var(--afb-control-surface, #fff)",
3855
+ color: "var(--afb-text, #27272a)",
3856
+ font: "inherit",
3857
+ accentColor: "var(--afb-accent, #3f3f46)",
3858
+ "&::placeholder": { color: "var(--afb-muted, #71717a)" },
3859
+ "&:disabled": { opacity: .5 },
3860
+ "&[type=\"checkbox\"], &[type=\"radio\"]": {
3861
+ width: 15,
3862
+ height: 15,
3863
+ minHeight: 15,
3864
+ flexShrink: 0,
3865
+ margin: 0
3866
+ },
3867
+ "&[type=\"range\"]": {
3868
+ border: 0,
3869
+ padding: 0
3870
+ }
3871
+ },
3872
+ "& .astrato-app-filter-bar__editor-options": {
3873
+ display: "flex",
3874
+ alignItems: "center",
3875
+ gap: 6,
3876
+ marginBottom: 8,
3877
+ "& > select": { flex: 1 },
3878
+ "& > .astrato-app-filter-bar__exclude": {
3879
+ flexShrink: 0,
3880
+ marginInlineStart: 2,
3881
+ fontSize: "0.92em"
3882
+ },
3883
+ "& > .astrato-app-filter-bar__text-query": {
3884
+ flex: 1,
3885
+ minWidth: 0
3886
+ }
3887
+ },
3888
+ "& .astrato-app-filter-bar__mode-label": {
3889
+ flex: 1,
3890
+ minWidth: 0,
3891
+ fontWeight: 500
3892
+ },
3893
+ "& .astrato-app-filter-bar__mode-toggle": {
3894
+ flexShrink: 0,
3895
+ "&[aria-disabled=\"true\"]": {
3896
+ opacity: .4,
3897
+ cursor: "progress"
3898
+ }
3899
+ },
3900
+ "& .astrato-app-filter-bar__exclude, & .astrato-app-filter-bar__availability": {
3901
+ display: "flex",
3902
+ alignItems: "center",
3903
+ gap: 7,
3904
+ color: "var(--afb-muted, #71717a)",
3905
+ cursor: "pointer",
3906
+ "&[data-active=\"true\"]": { color: "var(--afb-excluded, #b45309)" }
3907
+ },
3908
+ "& .astrato-app-filter-bar__availability": {
3909
+ fontSize: "0.92em",
3910
+ marginBottom: 8
3911
+ },
3912
+ "& .astrato-app-filter-bar__search-row": {
3913
+ display: "flex",
3914
+ alignItems: "center",
3915
+ gap: 6
3916
+ },
3917
+ "& .astrato-app-filter-bar__search": {
3918
+ position: "relative",
3919
+ flex: 1,
3920
+ minWidth: 0,
3921
+ "& > svg": {
3922
+ position: "absolute",
3923
+ left: 10,
3924
+ top: "50%",
3925
+ transform: "translateY(-50%)",
3926
+ color: "var(--afb-muted, #71717a)",
3927
+ pointerEvents: "none"
3928
+ },
3929
+ "& > input": { paddingLeft: 33 }
3930
+ },
3931
+ "& .astrato-app-filter-bar__selection-toolbar": {
3932
+ display: "flex",
3933
+ alignItems: "center",
3934
+ gap: 2,
3935
+ marginBlock: 4,
3936
+ fontSize: "0.92em",
3937
+ "& > span": { flex: 1 },
3938
+ "& .astrato-app-filter-bar__button": {
3939
+ minHeight: 28,
3940
+ padding: "3px 7px"
3941
+ }
3942
+ }
3943
+ }, xn = {
3944
+ "& .astrato-app-filter-bar__menu": {
3945
+ position: "relative",
3946
+ "& > summary": {
3947
+ boxSizing: "border-box",
3948
+ listStyle: "none",
3949
+ borderColor: "transparent",
3950
+ background: "transparent",
3951
+ color: "var(--afb-muted, #71717a)",
3952
+ "&::-webkit-details-marker": { display: "none" }
3953
+ },
3954
+ "&[open] > summary": { background: "var(--afb-hover, #f4f4f5)" },
3955
+ "& > summary[aria-disabled=\"true\"]": {
3956
+ opacity: .4,
3957
+ cursor: "not-allowed"
3958
+ },
3959
+ "&[data-align=\"start\"] > .astrato-app-filter-bar__menu-items": {
3960
+ left: 0,
3961
+ right: "auto"
3962
+ }
3963
+ },
3964
+ "& .astrato-app-filter-bar__menu-items": {
3965
+ boxSizing: "border-box",
3966
+ position: "absolute",
3967
+ right: 0,
3968
+ top: "calc(100% + 4px)",
3969
+ zIndex: 1,
3970
+ width: "var(--afb-menu-width, 220px)",
3971
+ maxWidth: "calc(100vw - 64px)",
3972
+ padding: 4,
3973
+ background: "var(--afb-popup-surface, var(--afb-surface, #fff))",
3974
+ border: "1px solid var(--afb-border, #e4e4e7)",
3975
+ borderRadius: "var(--afb-control-radius, 7px)",
3976
+ boxShadow: "var(--afb-popup-shadow, 0 8px 24px #0002)",
3977
+ "& .astrato-app-filter-bar__button": {
3978
+ boxSizing: "border-box",
3979
+ width: "100%",
3980
+ justifyContent: "flex-start",
3981
+ whiteSpace: "normal",
3982
+ textAlign: "left",
3983
+ border: 0,
3984
+ padding: "7px 9px",
3985
+ background: "transparent",
3986
+ "&[aria-checked=\"true\"]": { background: "var(--afb-selected-surface, #f4f4f5)" },
3987
+ "&:hover:not(:disabled)": { background: "var(--afb-hover, #f4f4f5)" }
3988
+ }
3989
+ },
3990
+ "& .astrato-app-filter-bar__menu-label": {
3991
+ display: "flex",
3992
+ flexDirection: "column",
3993
+ flex: 1,
3994
+ minWidth: 0,
3995
+ "& small": {
3996
+ color: "var(--afb-muted, #71717a)",
3997
+ fontSize: "0.85em",
3998
+ fontWeight: 400
3999
+ }
4000
+ }
4001
+ }, Sn = {
4002
+ "& .astrato-app-filter-bar__values, & .astrato-app-filter-bar__value-list": {
4003
+ maxHeight: "var(--afb-list-height, 260px)",
4004
+ overflowY: "auto",
4005
+ overscrollBehavior: "contain",
4006
+ scrollbarWidth: "thin",
4007
+ marginBlock: 8
4008
+ },
4009
+ "& .astrato-app-filter-bar__value-viewport": {
4010
+ position: "relative",
4011
+ display: "flex",
4012
+ flexDirection: "column",
4013
+ height: "var(--afb-list-height, 260px)",
4014
+ marginBlock: 8,
4015
+ "& > .astrato-app-filter-bar__value-list": {
4016
+ flex: 1,
4017
+ minHeight: 0,
4018
+ marginBlock: 0
4019
+ },
4020
+ "&[data-loading=\"true\"] > .astrato-app-filter-bar__value-list": { opacity: .5 }
4021
+ },
4022
+ "& .astrato-app-filter-bar__next-page": {
4023
+ position: "relative",
4024
+ display: "flex",
4025
+ flexDirection: "column",
4026
+ alignItems: "center",
4027
+ minHeight: 36
4028
+ },
4029
+ "& .astrato-app-filter-bar__loader": {
4030
+ position: "absolute",
4031
+ inset: 0,
4032
+ display: "grid",
4033
+ placeItems: "center",
4034
+ pointerEvents: "none"
4035
+ },
4036
+ "& .astrato-app-filter-bar__spinner": {
4037
+ boxSizing: "border-box",
4038
+ width: "var(--afb-spinner-size, 16px)",
4039
+ height: "var(--afb-spinner-size, 16px)",
4040
+ border: "2px solid var(--afb-border, #e4e4e7)",
4041
+ borderTopColor: "var(--afb-spinner-color, var(--afb-muted, #71717a))",
4042
+ borderRadius: "50%",
4043
+ background: "var(--afb-popup-surface, var(--afb-surface, #fff))",
4044
+ boxShadow: "0 0 0 6px var(--afb-popup-surface, var(--afb-surface, #fff))",
4045
+ animation: `${g({ to: { transform: "rotate(360deg)" } })} 750ms linear infinite`,
4046
+ "@media (prefers-reduced-motion: reduce)": { animation: "none" }
4047
+ },
4048
+ "& .astrato-app-filter-bar__sr-only": {
4049
+ position: "absolute",
4050
+ width: 1,
4051
+ height: 1,
4052
+ padding: 0,
4053
+ margin: -1,
4054
+ overflow: "hidden",
4055
+ clipPath: "inset(50%)",
4056
+ whiteSpace: "nowrap",
4057
+ border: 0
4058
+ },
4059
+ "& .astrato-app-filter-bar__value": {
4060
+ display: "flex",
4061
+ alignItems: "center",
4062
+ gap: "var(--afb-gap, 8px)",
4063
+ padding: "7px 9px",
4064
+ minHeight: 34,
4065
+ cursor: "pointer",
4066
+ width: "100%",
4067
+ justifyContent: "flex-start",
4068
+ whiteSpace: "normal",
4069
+ textAlign: "left",
4070
+ overflowWrap: "anywhere",
4071
+ border: "1px solid transparent",
4072
+ borderRadius: "var(--afb-control-radius, 7px)",
4073
+ marginBlock: 2,
4074
+ "&:hover": { background: "var(--afb-hover, #f4f4f5)" },
4075
+ "&[data-selected=\"true\"]": {
4076
+ background: "var(--afb-selected-surface, #f4f4f5)",
4077
+ fontWeight: 500
4078
+ },
4079
+ "&[data-excluded=\"true\"]": { color: "var(--afb-excluded, #b45309)" },
4080
+ "&:has(input:disabled)": {
4081
+ cursor: "not-allowed",
4082
+ opacity: .6
4083
+ }
4084
+ }
4085
+ }, Cn = {
4086
+ "& .astrato-app-filter-bar__field-option": {
4087
+ border: 0,
4088
+ background: "transparent",
4089
+ minHeight: "var(--afb-field-row-height, 36px)",
4090
+ padding: "4px 6px",
4091
+ marginBlock: 0,
4092
+ "& > svg": { color: "var(--afb-muted, #71717a)" }
4093
+ },
4094
+ "& .astrato-app-filter-bar__field-icon": {
4095
+ width: "var(--afb-field-icon-size, 24px)",
4096
+ height: "var(--afb-field-icon-size, 24px)"
4097
+ },
4098
+ "& .astrato-app-filter-bar__field-name": {
4099
+ display: "flex",
4100
+ alignItems: "center",
4101
+ gap: 8,
4102
+ minWidth: 0,
4103
+ flex: 1,
4104
+ "& small": {
4105
+ fontWeight: 400,
4106
+ fontSize: "0.9em",
4107
+ maxWidth: "35%",
4108
+ overflow: "hidden",
4109
+ textOverflow: "ellipsis",
4110
+ whiteSpace: "nowrap"
4111
+ }
4112
+ },
4113
+ "& .astrato-app-filter-bar__field-label": {
4114
+ flex: 1,
4115
+ minWidth: 0,
4116
+ overflow: "hidden",
4117
+ textOverflow: "ellipsis",
4118
+ whiteSpace: "nowrap"
4119
+ },
4120
+ "& .astrato-app-filter-bar__field-picker": {
4121
+ width: "var(--afb-popup-width, 340px)",
4122
+ padding: "var(--afb-popup-padding, 12px)",
4123
+ "& .astrato-app-filter-bar__popover-header": {
4124
+ gap: 8,
4125
+ paddingBottom: 8,
4126
+ marginBottom: 10
4127
+ },
4128
+ "& .astrato-app-filter-bar__heading-icon": {
4129
+ width: 24,
4130
+ height: 24,
4131
+ background: "transparent"
4132
+ },
4133
+ "& .astrato-app-filter-bar__values": {
4134
+ maxHeight: "var(--afb-list-height, 224px)",
4135
+ marginBlock: 6
4136
+ }
4137
+ },
4138
+ "& .astrato-app-filter-bar__empty": {
4139
+ padding: "28px 8px",
4140
+ textAlign: "center",
4141
+ color: "var(--afb-muted, #71717a)"
4142
+ },
4143
+ "& .astrato-app-filter-bar__association-action": {
4144
+ width: "100%",
4145
+ marginTop: 4
4146
+ }
4147
+ }, wn = {
4148
+ "& .astrato-app-filter-bar__editor-footer": {
4149
+ display: "flex",
4150
+ flexWrap: "wrap",
4151
+ alignItems: "center",
4152
+ gap: 8,
4153
+ paddingTop: 12,
4154
+ marginTop: 12,
4155
+ borderTop: "1px solid var(--afb-border, #e4e4e7)",
4156
+ "& > .astrato-app-filter-bar__actions": {
4157
+ marginLeft: "auto",
4158
+ gap: 4
4159
+ }
4160
+ },
4161
+ "& input[type=\"checkbox\"], & input[type=\"radio\"]": { accentColor: "var(--afb-accent, #3f3f46)" },
4162
+ "& .astrato-app-filter-bar__group": {
4163
+ border: "1px solid var(--afb-border, #e4e4e7)",
4164
+ borderRadius: "var(--afb-control-radius, 7px)",
4165
+ padding: 10,
4166
+ marginBlock: 8,
4167
+ minWidth: 0
4168
+ }
4169
+ }, Tn = p({
4170
+ ...vn,
4171
+ ...yn,
4172
+ ...bn,
4173
+ ...xn,
4174
+ ...Sn,
4175
+ ...Cn,
4176
+ ...wn
4177
+ }), En = /* @__PURE__ */ new Set([
4178
+ W.FilterOperator.NotInList,
4179
+ W.FilterOperator.NotBetween,
4180
+ W.FilterOperator.NotLike,
4181
+ W.FilterOperator.NotEquals,
4182
+ W.FilterOperator.NotContains,
4183
+ W.FilterOperator.NotSet
4184
+ ]), Dn = (e, t) => [...e.pending, ...e.applied].find((e) => q(e) === q(t));
4185
+ function On() {
4186
+ return /* @__PURE__ */ (0, $.jsx)(kn, {});
4187
+ }
4188
+ function kn({ isExpanded: e = !1 }) {
4189
+ let t = te(), n = x()((e) => e.vSpec), r = ee(), i = (0, U.useMemo)(() => gn(t), [t]), [a, o] = (0, U.useState)({
4190
+ applied: [],
4191
+ pending: []
4192
+ }), [c, l] = (0, U.useState)(0), [u, d] = (0, U.useState)(), [f, p] = (0, U.useState)(), [h, g] = (0, U.useState)(), [v, y] = (0, U.useState)(), b = (0, U.useRef)(), [S, C] = (0, U.useState)(""), w = (0, U.useId)(), ie = (0, U.useId)(), [ae, E] = (0, U.useState)(!1), D = n?.appFilterBarSettings ?? {}, k = () => {
4193
+ o(i.getSelection()), l((e) => e + 1);
4194
+ }, A = (e) => {
4195
+ try {
4196
+ e(), k(), d(void 0);
4197
+ } catch (e) {
4198
+ d(e instanceof Error ? e.message : "Could not update filters.");
4199
+ }
4200
+ };
4201
+ (0, U.useEffect)(() => {
4202
+ let e;
4203
+ try {
4204
+ k(), e = i.subscribe(k);
4205
+ } catch (e) {
4206
+ d(e instanceof Error ? e.message : "Could not connect to the selection service.");
4207
+ }
4208
+ return () => e?.();
4209
+ }, [i]), (0, U.useEffect)(() => {
4210
+ !e && n?.type === s.AppFilterBar && r();
4211
+ }, [
4212
+ n,
4213
+ r,
4214
+ e
4215
+ ]), (0, U.useEffect)(() => {
4216
+ if (!h) return;
4217
+ let e = Dn(a, h), t = JSON.stringify(e);
4218
+ t !== b.current && (b.current = t, e ? g(structuredClone(e)) : (g(void 0), p(void 0)));
4219
+ }, [a, h]);
4220
+ let j = (0, U.useMemo)(() => i.getFields(), [i, c]), M = (0, U.useMemo)(() => D.showChartBreakdown === !0 ? i.getDimensionGroups().filter((e) => e.fields.length > 1) : [], [
4221
+ i,
4222
+ c,
4223
+ D.showChartBreakdown
4224
+ ]), N = (0, U.useMemo)(() => new Map(j.map((e) => [e.key, e])), [j]), se = D.selectableFieldKeys?.length ? new Set(D.selectableFieldKeys) : void 0, ce = j.filter((e) => !se || se.has(e.key)), P = JSON.stringify(ce), F = i.supportsAssociativeFiltering, le = D.enableAssociativeFilter !== !1 && F, I = f?.kind === "fields", L = F && v?.services === i && v.fieldMetadata === P ? v.fields : [];
4225
+ (0, U.useEffect)(() => {
4226
+ if (!I || !le) return;
4227
+ let e = new AbortController();
4228
+ y(void 0);
4229
+ let t = JSON.parse(P);
4230
+ return i.getAssociativeFields(t, e.signal).then((t) => {
4231
+ e.signal.aborted || y({
4232
+ services: i,
4233
+ fieldMetadata: P,
4234
+ fields: t
4235
+ });
4236
+ }), () => e.abort();
4237
+ }, [
4238
+ i,
4239
+ P,
4240
+ le,
4241
+ I
4242
+ ]);
4243
+ let R = ce.filter((e) => `${e.name} ${e.view ?? ""}`.toLocaleLowerCase().includes(S.toLocaleLowerCase().trim())), z = Ye(a), ue = e ? "vertical" : D.orientation ?? "horizontal", { barRef: de, overflow: fe } = fn(!e && D.overflow === "button" ? "button" : ue === "vertical" ? "wrap" : D.overflow ?? "wrap", !!n);
4244
+ (0, U.useEffect)(() => {
4245
+ fe !== "button" && E(!1), p(void 0), g(void 0);
4246
+ }, [fe]);
4247
+ let { chipsRef: pe, visibleCount: me } = dn(fe === "collapse", JSON.stringify(z), z.length), he = z.length - me, ge = z.slice(me).some((e) => e.pending), B = a.pending.length > 0, _e = B && a.pending.every(J) && (!h || J(h)), ve = a.applied.length > 0 || B, V = () => {
4248
+ p(void 0), g(void 0), b.current = void 0;
4249
+ }, ye = () => A(() => {
4250
+ i.cancel(), V();
4251
+ }), be = () => A(() => {
4252
+ i.apply(), V();
4253
+ }), H = (e) => N.get(e.fieldKey) ?? {
4254
+ key: e.fieldKey,
4255
+ name: e.fieldKey,
4256
+ dataType: W.FieldType.STRING
4257
+ }, xe = (e, t, n = !1) => {
4258
+ b.current = JSON.stringify(Dn(a, e)), g(structuredClone(e)), p({
4259
+ kind: "filter",
4260
+ anchor: t,
4261
+ fromOverflow: n
4262
+ });
4263
+ }, Se = (e) => {
4264
+ if (!f) return;
4265
+ let t = a.pending.find((t) => t.fieldKey === e.key && !("associativeListFilter" in t)) ?? a.applied.find((t) => t.fieldKey === e.key && !("associativeListFilter" in t));
4266
+ xe(t ?? dt(e), f.anchor);
4267
+ }, Ce = (e) => {
4268
+ g(e);
4269
+ let t = D.selectionMode ?? "inherit", n = t === "inherit" ? i.getSelectionMode() : t, r = !!Dn(i.getSelection(), e), a = "operator" in e && ([W.FilterOperator.InList, W.FilterOperator.NotInList].includes(e.operator) && !e.values?.length || [W.FilterOperator.Like, W.FilterOperator.NotLike].includes(e.operator) && !String(e.values?.[0] ?? "").trim());
4270
+ (J(e) || r && (n === "manual" || a)) && A(() => i.select(e, t)), b.current = JSON.stringify(Dn(i.getSelection(), e));
4271
+ }, we = (e, t, n = !1) => {
4272
+ let { id: r, filter: a, pending: o } = e, s = H(a), c = i.isLocked(a.fieldKey), l = i.isSingleSelect(a.fieldKey), u = Qe(a, (e) => [
4273
+ W.FieldType.DATE,
4274
+ W.FieldType.TIME,
4275
+ W.FieldType.TIMESTAMP,
4276
+ W.FieldType.TIMESTAMP_TZ
4277
+ ].includes(s.dataType) && "operator" in a && !a.datePart && (typeof e == "number" || typeof e == "string") ? mt(e, s.dataType, i.getTimeZone() ?? "UTC").replace("T", " ") || String(e) : e === null ? "Null" : String(e)), d = "operator" in a && En.has(a.operator), p = f?.kind === "filter" && h && Ke(h) === r;
4278
+ return /* @__PURE__ */ (0, $.jsxs)("div", {
4279
+ className: "astrato-app-filter-bar__chip",
4280
+ "data-overflow-hidden": !n && t >= me,
4281
+ "aria-hidden": !n && t >= me || void 0,
4282
+ "data-pending": !!o,
4283
+ "data-excluded": d,
4284
+ "data-locked": c,
4285
+ children: [/* @__PURE__ */ (0, $.jsxs)(T, {
4286
+ "aria-haspopup": "dialog",
4287
+ "aria-controls": w,
4288
+ "aria-expanded": !!p,
4289
+ "aria-label": `${d ? "Not " : ""}${s.name}: ${u.text || "Choose values"}${c ? ", locked" : ""}`,
4290
+ onClick: (e) => xe(a, n && f ? f.anchor : e.currentTarget, n),
4291
+ title: `${s.name}: ${u.text}`,
4292
+ children: [
4293
+ /* @__PURE__ */ (0, $.jsx)(_, { name: "filter" }),
4294
+ /* @__PURE__ */ (0, $.jsxs)("span", {
4295
+ className: "astrato-app-filter-bar__chip-label",
4296
+ children: [
4297
+ /* @__PURE__ */ (0, $.jsx)("strong", { children: d ? `Not ${s.name}` : s.name }),
4298
+ /* @__PURE__ */ (0, $.jsx)("span", {
4299
+ className: "astrato-app-filter-bar__chip-divider",
4300
+ "aria-hidden": "true",
4301
+ children: "·"
4302
+ }),
4303
+ /* @__PURE__ */ (0, $.jsx)("span", {
4304
+ className: "astrato-app-filter-bar__chip-summary",
4305
+ children: u.text || "Choose values"
4306
+ })
4307
+ ]
4308
+ }),
4309
+ c && /* @__PURE__ */ (0, $.jsx)("span", {
4310
+ "aria-label": "Locked",
4311
+ children: /* @__PURE__ */ (0, $.jsx)(_, { name: "lock" })
4312
+ })
4313
+ ]
4314
+ }), /* @__PURE__ */ (0, $.jsx)(T, {
4315
+ "data-icon-only": "true",
4316
+ "aria-label": `Remove ${s.name} filter`,
4317
+ disabled: c || l,
4318
+ onClick: (e) => {
4319
+ let t = e.currentTarget.closest(".astrato-app-filter-bar__chip"), n = (t?.nextElementSibling ?? t?.previousElementSibling)?.querySelector("button:not(:disabled)") ?? t?.closest("[role=\"dialog\"], dialog")?.querySelector("button:not(:disabled)");
4320
+ A(() => {
4321
+ i.remove(a), p ? V() : n?.focus();
4322
+ });
4323
+ },
4324
+ children: /* @__PURE__ */ (0, $.jsx)(_, { name: "close" })
4325
+ })]
4326
+ }, r);
4327
+ };
4328
+ return n ? fe === "button" ? /* @__PURE__ */ (0, $.jsxs)("div", {
4329
+ ref: de,
4330
+ className: m("astrato-app-filter-bar", Tn),
4331
+ "data-overflow": "button",
4332
+ role: "region",
4333
+ "aria-label": "Filters",
4334
+ children: [/* @__PURE__ */ (0, $.jsxs)(T, {
4335
+ className: "astrato-app-filter-bar__overflow astrato-app-filter-bar__trigger",
4336
+ "data-pending": B,
4337
+ "aria-label": `Filters (${z.length})${B ? ", pending changes" : ""}`,
4338
+ "aria-haspopup": "dialog",
4339
+ "aria-expanded": ae,
4340
+ "aria-controls": ie,
4341
+ onClick: () => E(!0),
4342
+ children: [
4343
+ /* @__PURE__ */ (0, $.jsx)(_, { name: "filter" }),
4344
+ " Filters (",
4345
+ z.length,
4346
+ ")"
4347
+ ]
4348
+ }), ae && /* @__PURE__ */ (0, $.jsxs)(re, {
4349
+ id: ie,
4350
+ className: "astrato-app-filter-bar__modal",
4351
+ "aria-labelledby": `${ie}-title`,
4352
+ onCloseDialog: () => E(!1),
4353
+ children: [/* @__PURE__ */ (0, $.jsxs)("div", {
4354
+ className: "astrato-app-filter-bar__popover-header",
4355
+ children: [/* @__PURE__ */ (0, $.jsxs)("strong", {
4356
+ id: `${ie}-title`,
4357
+ children: [
4358
+ "Filters (",
4359
+ z.length,
4360
+ ")"
4361
+ ]
4362
+ }), /* @__PURE__ */ (0, $.jsx)(T, {
4363
+ "data-icon-only": "true",
4364
+ "data-variant": "ghost",
4365
+ "aria-label": "Close filters",
4366
+ onClick: () => E(!1),
4367
+ children: /* @__PURE__ */ (0, $.jsx)(_, { name: "close" })
4368
+ })]
4369
+ }), /* @__PURE__ */ (0, $.jsx)(kn, { isExpanded: !0 })]
4370
+ })]
4371
+ }) : /* @__PURE__ */ (0, $.jsxs)("div", {
4372
+ ref: de,
4373
+ className: m("astrato-app-filter-bar", Tn),
4374
+ role: "region",
4375
+ tabIndex: -1,
4376
+ "aria-label": "Filters",
4377
+ "data-selection-mode": D.selectionMode ?? "inherit",
4378
+ "data-overflow": fe,
4379
+ "data-orientation": ue,
4380
+ children: [
4381
+ D.enableAddingNewFilters !== !1 && /* @__PURE__ */ (0, $.jsxs)(T, {
4382
+ "aria-expanded": f?.kind === "fields",
4383
+ "aria-controls": w,
4384
+ "aria-haspopup": "dialog",
4385
+ onClick: (e) => {
4386
+ C(""), g(void 0), p({
4387
+ kind: "fields",
4388
+ anchor: e.currentTarget
4389
+ });
4390
+ },
4391
+ children: [/* @__PURE__ */ (0, $.jsx)(_, { name: "plus" }), " New filter"]
4392
+ }),
4393
+ M.length > 0 && /* @__PURE__ */ (0, $.jsxs)(T, {
4394
+ "aria-haspopup": "dialog",
4395
+ "aria-controls": w,
4396
+ "aria-expanded": f?.kind === "groups",
4397
+ onClick: (e) => p({
4398
+ kind: "groups",
4399
+ anchor: e.currentTarget
4400
+ }),
4401
+ children: [/* @__PURE__ */ (0, $.jsx)(_, { name: "dimensions" }), " Chart breakdown"]
4402
+ }),
4403
+ /* @__PURE__ */ (0, $.jsxs)("div", {
4404
+ ref: pe,
4405
+ className: "astrato-app-filter-bar__chips",
4406
+ "aria-live": "polite",
4407
+ "aria-relevant": "additions removals",
4408
+ children: [
4409
+ z.map((e, t) => we(e, t)),
4410
+ fe === "collapse" && z.length > 0 && /* @__PURE__ */ (0, $.jsxs)($.Fragment, { children: [/* @__PURE__ */ (0, $.jsx)("div", {
4411
+ className: "astrato-app-filter-bar__overflow-probes",
4412
+ "aria-hidden": "true",
4413
+ children: z.map((e, t) => /* @__PURE__ */ (0, $.jsxs)("span", {
4414
+ className: "astrato-app-filter-bar__button astrato-app-filter-bar__overflow",
4415
+ "data-overflow-count": t + 1,
4416
+ children: ["+", t + 1]
4417
+ }, e.id))
4418
+ }), /* @__PURE__ */ (0, $.jsxs)(T, {
4419
+ className: "astrato-app-filter-bar__overflow",
4420
+ "data-overflow-hidden": he === 0,
4421
+ "data-pending": ge,
4422
+ "aria-hidden": he === 0 || void 0,
4423
+ "aria-label": `${he} hidden filters${ge ? ", pending changes" : ""}`,
4424
+ "aria-haspopup": "dialog",
4425
+ "aria-controls": w,
4426
+ "aria-expanded": f?.kind === "overflow" || !!f?.fromOverflow,
4427
+ onClick: (e) => {
4428
+ g(void 0), p({
4429
+ kind: "overflow",
4430
+ anchor: e.currentTarget
4431
+ });
4432
+ },
4433
+ children: ["+", he]
4434
+ })] }),
4435
+ !z.length && /* @__PURE__ */ (0, $.jsxs)("span", {
4436
+ className: "astrato-app-filter-bar__empty-bar",
4437
+ children: [/* @__PURE__ */ (0, $.jsx)(_, { name: "filter" }), "No active filters"]
4438
+ })
4439
+ ]
4440
+ }),
4441
+ /* @__PURE__ */ (0, $.jsxs)("div", {
4442
+ className: "astrato-app-filter-bar__actions",
4443
+ children: [B && /* @__PURE__ */ (0, $.jsxs)($.Fragment, { children: [/* @__PURE__ */ (0, $.jsx)(T, {
4444
+ onClick: ye,
4445
+ "data-variant": "ghost",
4446
+ children: "Cancel"
4447
+ }), /* @__PURE__ */ (0, $.jsxs)(T, {
4448
+ "data-primary": "true",
4449
+ disabled: !_e,
4450
+ onClick: be,
4451
+ children: [/* @__PURE__ */ (0, $.jsx)(_, { name: "check" }), " Apply"]
4452
+ })] }), D.showClearAll !== !1 && ve && /* @__PURE__ */ (0, $.jsxs)(T, {
4453
+ "data-variant": "ghost",
4454
+ onClick: () => A(() => {
4455
+ i.clear(), V();
4456
+ }),
4457
+ children: [/* @__PURE__ */ (0, $.jsx)(_, { name: "reset" }), " Clear all"]
4458
+ })]
4459
+ }),
4460
+ u && /* @__PURE__ */ (0, $.jsx)("div", {
4461
+ className: "astrato-app-filter-bar__error",
4462
+ role: "alert",
4463
+ children: u
4464
+ }),
4465
+ f && (f.kind !== "groups" || M.length > 0) && /* @__PURE__ */ (0, $.jsxs)(cn, {
4466
+ id: w,
4467
+ anchor: f.anchor,
4468
+ placement: ue === "vertical" ? "side" : "bottom",
4469
+ className: f.kind === "fields" ? "astrato-app-filter-bar__field-picker" : f.kind === "overflow" ? "astrato-app-filter-bar__overflow-popover" : void 0,
4470
+ onClose: V,
4471
+ subtitle: f.kind === "groups" ? "Choose the fields shown in your charts" : f.kind === "filter" && h ? H(h).view : void 0,
4472
+ icon: f.kind === "filter" && h ? /* @__PURE__ */ (0, $.jsx)(ne, {
4473
+ fieldType: H(h).dataType,
4474
+ fill: "currentColor"
4475
+ }) : /* @__PURE__ */ (0, $.jsx)(_, { name: f.kind === "groups" ? "dimensions" : "filter" }),
4476
+ title: f.kind === "fields" ? "Add filter" : f.kind === "groups" ? "Chart breakdown" : f.kind === "overflow" ? `Filters (${z.length})` : h ? H(h).name : "Filter",
4477
+ children: [
4478
+ f.kind === "overflow" && /* @__PURE__ */ (0, $.jsxs)($.Fragment, { children: [/* @__PURE__ */ (0, $.jsxs)("div", {
4479
+ className: "astrato-app-filter-bar__overflow-list",
4480
+ children: [z.map((e, t) => we(e, t, !0)), !z.length && /* @__PURE__ */ (0, $.jsx)("p", {
4481
+ className: "astrato-app-filter-bar__muted",
4482
+ children: "No active filters"
4483
+ })]
4484
+ }), B && /* @__PURE__ */ (0, $.jsxs)("div", {
4485
+ className: "astrato-app-filter-bar__editor-footer",
4486
+ children: [/* @__PURE__ */ (0, $.jsx)(T, {
4487
+ "data-variant": "ghost",
4488
+ onClick: ye,
4489
+ children: "Cancel"
4490
+ }), /* @__PURE__ */ (0, $.jsxs)(T, {
4491
+ "data-primary": "true",
4492
+ disabled: !_e,
4493
+ onClick: be,
4494
+ children: [/* @__PURE__ */ (0, $.jsx)(_, { name: "check" }), " Apply"]
4495
+ })]
4496
+ })] }),
4497
+ f.kind === "fields" && /* @__PURE__ */ (0, $.jsxs)($.Fragment, { children: [
4498
+ /* @__PURE__ */ (0, $.jsx)(oe, {
4499
+ "aria-label": "Search fields",
4500
+ placeholder: "Search fields…",
4501
+ value: S,
4502
+ onChange: (e) => C(e.target.value)
4503
+ }),
4504
+ /* @__PURE__ */ (0, $.jsxs)("div", {
4505
+ className: "astrato-app-filter-bar__values",
4506
+ children: [R.map((e) => /* @__PURE__ */ (0, $.jsxs)(T, {
4507
+ className: "astrato-app-filter-bar__value astrato-app-filter-bar__field-option",
4508
+ disabled: i.isLocked(e.key),
4509
+ title: e.view ? `${e.name} · ${e.view}` : e.name,
4510
+ onClick: () => Se(e),
4511
+ children: [
4512
+ /* @__PURE__ */ (0, $.jsx)("span", {
4513
+ className: "astrato-app-filter-bar__field-icon",
4514
+ "aria-hidden": "true",
4515
+ children: /* @__PURE__ */ (0, $.jsx)(ne, {
4516
+ fieldType: e.dataType,
4517
+ fill: "currentColor"
4518
+ })
4519
+ }),
4520
+ /* @__PURE__ */ (0, $.jsxs)("span", {
4521
+ className: "astrato-app-filter-bar__field-name",
4522
+ children: [/* @__PURE__ */ (0, $.jsx)("span", {
4523
+ className: "astrato-app-filter-bar__field-label",
4524
+ children: e.name
4525
+ }), /* @__PURE__ */ (0, $.jsx)("small", {
4526
+ className: "astrato-app-filter-bar__muted",
4527
+ children: e.view
4528
+ })]
4529
+ }),
4530
+ /* @__PURE__ */ (0, $.jsx)(_, { name: "chevronRight" })
4531
+ ]
4532
+ }, e.key)), !R.length && /* @__PURE__ */ (0, $.jsx)("p", {
4533
+ className: "astrato-app-filter-bar__muted",
4534
+ children: "No matching fields"
4535
+ })]
4536
+ }),
4537
+ le && L.length > 0 && /* @__PURE__ */ (0, $.jsxs)(T, {
4538
+ className: "astrato-app-filter-bar__association-action",
4539
+ "data-variant": "ghost",
4540
+ onClick: () => xe({
4541
+ fieldKey: L[0].key,
4542
+ associativeListFilter: {
4543
+ view: L[0].view ?? "",
4544
+ intersectFilters: [],
4545
+ unionFilters: []
4546
+ }
4547
+ }, f.anchor),
4548
+ children: [/* @__PURE__ */ (0, $.jsx)(_, { name: "association" }), " New associative filter"]
4549
+ })
4550
+ ] }),
4551
+ f.kind === "groups" && M.map((e) => /* @__PURE__ */ (0, $.jsxs)("label", {
4552
+ className: "astrato-app-filter-bar__field",
4553
+ children: [e.name, /* @__PURE__ */ (0, $.jsx)(O, {
4554
+ value: e.selectedIndex,
4555
+ onChange: (t) => A(() => i.setDimensionGroup(e.id, Number(t.target.value))),
4556
+ children: e.fields.map((e, t) => /* @__PURE__ */ (0, $.jsx)("option", {
4557
+ value: t,
4558
+ children: e.name
4559
+ }, e.key))
4560
+ })]
4561
+ }, e.id)),
4562
+ f.kind === "filter" && h && /* @__PURE__ */ (0, $.jsxs)($.Fragment, { children: ["associativeListFilter" in h ? F ? /* @__PURE__ */ (0, $.jsx)(an, {
4563
+ filter: h,
4564
+ fields: ce,
4565
+ targetFields: L.some((e) => e.key === h.fieldKey) ? L : [H(h), ...L],
4566
+ services: i,
4567
+ onChange: Ce,
4568
+ disabled: i.isLocked(h.fieldKey)
4569
+ }) : /* @__PURE__ */ (0, $.jsx)("p", {
4570
+ className: "astrato-app-filter-bar__muted",
4571
+ children: "Associative filter editing is unavailable in this app."
4572
+ }) : /* @__PURE__ */ (0, $.jsx)(Zt, {
4573
+ field: H(h),
4574
+ filter: h,
4575
+ services: i,
4576
+ onChange: Ce,
4577
+ disabled: i.isLocked(h.fieldKey)
4578
+ }), /* @__PURE__ */ (0, $.jsxs)("div", {
4579
+ className: "astrato-app-filter-bar__editor-footer",
4580
+ children: [
4581
+ f.fromOverflow && /* @__PURE__ */ (0, $.jsx)(T, {
4582
+ "data-variant": "ghost",
4583
+ onClick: () => {
4584
+ g(void 0), p({
4585
+ kind: "overflow",
4586
+ anchor: f.anchor
4587
+ });
4588
+ },
4589
+ children: "All filters"
4590
+ }),
4591
+ i.canLock && /* @__PURE__ */ (0, $.jsxs)(T, {
4592
+ "data-variant": "ghost",
4593
+ onClick: () => A(() => i.toggleLock(h.fieldKey)),
4594
+ children: [/* @__PURE__ */ (0, $.jsx)(_, { name: i.isLocked(h.fieldKey) ? "lock" : "unlock" }), i.isLocked(h.fieldKey) ? "Unlock field" : "Lock field"]
4595
+ }),
4596
+ /* @__PURE__ */ (0, $.jsx)("div", {
4597
+ className: "astrato-app-filter-bar__actions",
4598
+ children: B ? /* @__PURE__ */ (0, $.jsxs)($.Fragment, { children: [/* @__PURE__ */ (0, $.jsx)(T, {
4599
+ "data-variant": "ghost",
4600
+ onClick: ye,
4601
+ children: "Cancel"
4602
+ }), /* @__PURE__ */ (0, $.jsxs)(T, {
4603
+ "data-primary": "true",
4604
+ disabled: !_e,
4605
+ onClick: be,
4606
+ children: [/* @__PURE__ */ (0, $.jsx)(_, { name: "check" }), " Apply"]
4607
+ })] }) : /* @__PURE__ */ (0, $.jsx)(T, {
4608
+ onClick: V,
4609
+ children: "Done"
4610
+ })
4611
+ })
4612
+ ]
4613
+ })] })
4614
+ ]
4615
+ }, `${f.kind}:${h?.fieldKey ?? ""}`)
4616
+ ]
4617
+ }) : null;
4618
+ }
4619
+ export { On as AppFilterBar };