@indxsearch/intrface 1.0.2 → 1.0.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.
package/dist/index.es.js CHANGED
@@ -1,10 +1,10 @@
1
1
  var ht = Object.defineProperty;
2
- var ft = (r, a, d) => a in r ? ht(r, a, { enumerable: !0, configurable: !0, writable: !0, value: d }) : r[a] = d;
3
- var Ke = (r, a, d) => ft(r, typeof a != "symbol" ? a + "" : a, d);
2
+ var ft = (r, o, u) => o in r ? ht(r, o, { enumerable: !0, configurable: !0, writable: !0, value: u }) : r[o] = u;
3
+ var Ke = (r, o, u) => ft(r, typeof o != "symbol" ? o + "" : o, u);
4
4
  import "@indxsearch/systm/styles.css";
5
- import re, { createContext as gt, useRef as Ee, useState as X, useEffect as me, useCallback as te, useMemo as Be, useContext as mt, memo as ot, Component as pt } from "react";
6
- import { SearchField as vt, Button as be, FilterPanelBase as xe, ToggleSwitch as ie, Checkbox as et, Slider as at, InputField as Z, Select as xt, RadioButton as bt } from "@indxsearch/systm";
7
- var De = { exports: {} }, Oe = {};
5
+ import te, { createContext as gt, useRef as Re, useState as U, useEffect as me, useCallback as ee, useMemo as Be, useContext as mt, memo as ot, Component as pt } from "react";
6
+ import { SearchField as vt, Button as Se, FilterPanelBase as be, ToggleSwitch as ae, Checkbox as et, Slider as at, InputField as Z, Select as xt, RadioButton as bt } from "@indxsearch/systm";
7
+ var qe = { exports: {} }, Oe = {};
8
8
  /**
9
9
  * @license React
10
10
  * react-jsx-runtime.production.js
@@ -18,23 +18,23 @@ var tt;
18
18
  function St() {
19
19
  if (tt) return Oe;
20
20
  tt = 1;
21
- var r = Symbol.for("react.transitional.element"), a = Symbol.for("react.fragment");
22
- function d(i, c, p) {
23
- var F = null;
24
- if (p !== void 0 && (F = "" + p), c.key !== void 0 && (F = "" + c.key), "key" in c) {
25
- p = {};
26
- for (var v in c)
27
- v !== "key" && (p[v] = c[v]);
28
- } else p = c;
29
- return c = p.ref, {
21
+ var r = Symbol.for("react.transitional.element"), o = Symbol.for("react.fragment");
22
+ function u(i, c, m) {
23
+ var M = null;
24
+ if (m !== void 0 && (M = "" + m), c.key !== void 0 && (M = "" + c.key), "key" in c) {
25
+ m = {};
26
+ for (var p in c)
27
+ p !== "key" && (m[p] = c[p]);
28
+ } else m = c;
29
+ return c = m.ref, {
30
30
  $$typeof: r,
31
31
  type: i,
32
- key: F,
32
+ key: M,
33
33
  ref: c !== void 0 ? c : null,
34
- props: p
34
+ props: m
35
35
  };
36
36
  }
37
- return Oe.Fragment = a, Oe.jsx = d, Oe.jsxs = d, Oe;
37
+ return Oe.Fragment = o, Oe.jsx = u, Oe.jsxs = u, Oe;
38
38
  }
39
39
  var Pe = {};
40
40
  /**
@@ -48,121 +48,122 @@ var Pe = {};
48
48
  */
49
49
  var rt;
50
50
  function yt() {
51
- return rt || (rt = 1, process.env.NODE_ENV !== "production" && function() {
51
+ return rt || (rt = 1, process.env.NODE_ENV !== "production" && (function() {
52
52
  function r(t) {
53
53
  if (t == null) return null;
54
54
  if (typeof t == "function")
55
- return t.$$typeof === U ? null : t.displayName || t.name || null;
55
+ return t.$$typeof === he ? null : t.displayName || t.name || null;
56
56
  if (typeof t == "string") return t;
57
57
  switch (t) {
58
- case W:
58
+ case x:
59
59
  return "Fragment";
60
- case A:
60
+ case f:
61
61
  return "Profiler";
62
- case x:
62
+ case A:
63
63
  return "StrictMode";
64
- case M:
64
+ case W:
65
65
  return "Suspense";
66
- case $:
66
+ case g:
67
67
  return "SuspenseList";
68
- case Se:
68
+ case z:
69
69
  return "Activity";
70
70
  }
71
71
  if (typeof t == "object")
72
72
  switch (typeof t.tag == "number" && console.error(
73
73
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
74
74
  ), t.$$typeof) {
75
- case K:
75
+ case D:
76
76
  return "Portal";
77
+ case C:
78
+ return t.displayName || "Context";
77
79
  case s:
78
- return (t.displayName || "Context") + ".Provider";
79
- case g:
80
80
  return (t._context.displayName || "Context") + ".Consumer";
81
- case w:
82
- var o = t.render;
83
- return t = t.displayName, t || (t = o.displayName || o.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
84
- case m:
85
- return o = t.displayName || null, o !== null ? o : r(t.type) || "Memo";
86
- case L:
87
- o = t._payload, t = t._init;
81
+ case N:
82
+ var a = t.render;
83
+ return t = t.displayName, t || (t = a.displayName || a.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
84
+ case G:
85
+ return a = t.displayName || null, a !== null ? a : r(t.type) || "Memo";
86
+ case de:
87
+ a = t._payload, t = t._init;
88
88
  try {
89
- return r(t(o));
89
+ return r(t(a));
90
90
  } catch {
91
91
  }
92
92
  }
93
93
  return null;
94
94
  }
95
- function a(t) {
95
+ function o(t) {
96
96
  return "" + t;
97
97
  }
98
- function d(t) {
98
+ function u(t) {
99
99
  try {
100
- a(t);
101
- var o = !1;
100
+ o(t);
101
+ var a = !1;
102
102
  } catch {
103
- o = !0;
103
+ a = !0;
104
104
  }
105
- if (o) {
106
- o = console;
107
- var h = o.error, C = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
108
- return h.call(
109
- o,
105
+ if (a) {
106
+ a = console;
107
+ var v = a.error, k = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
108
+ return v.call(
109
+ a,
110
110
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
111
- C
112
- ), a(t);
111
+ k
112
+ ), o(t);
113
113
  }
114
114
  }
115
115
  function i(t) {
116
- if (t === W) return "<>";
117
- if (typeof t == "object" && t !== null && t.$$typeof === L)
116
+ if (t === x) return "<>";
117
+ if (typeof t == "object" && t !== null && t.$$typeof === de)
118
118
  return "<...>";
119
119
  try {
120
- var o = r(t);
121
- return o ? "<" + o + ">" : "<...>";
120
+ var a = r(t);
121
+ return a ? "<" + a + ">" : "<...>";
122
122
  } catch {
123
123
  return "<...>";
124
124
  }
125
125
  }
126
126
  function c() {
127
- var t = se.A;
127
+ var t = T.A;
128
128
  return t === null ? null : t.getOwner();
129
129
  }
130
- function p() {
130
+ function m() {
131
131
  return Error("react-stack-top-frame");
132
132
  }
133
- function F(t) {
134
- if (_.call(t, "key")) {
135
- var o = Object.getOwnPropertyDescriptor(t, "key").get;
136
- if (o && o.isReactWarning) return !1;
133
+ function M(t) {
134
+ if (pe.call(t, "key")) {
135
+ var a = Object.getOwnPropertyDescriptor(t, "key").get;
136
+ if (a && a.isReactWarning) return !1;
137
137
  }
138
138
  return t.key !== void 0;
139
139
  }
140
- function v(t, o) {
141
- function h() {
142
- y || (y = !0, console.error(
140
+ function p(t, a) {
141
+ function v() {
142
+ B || (B = !0, console.error(
143
143
  "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
144
- o
144
+ a
145
145
  ));
146
146
  }
147
- h.isReactWarning = !0, Object.defineProperty(t, "key", {
148
- get: h,
147
+ v.isReactWarning = !0, Object.defineProperty(t, "key", {
148
+ get: v,
149
149
  configurable: !0
150
150
  });
151
151
  }
152
152
  function n() {
153
153
  var t = r(this.type);
154
- return B[t] || (B[t] = !0, console.error(
154
+ return ve[t] || (ve[t] = !0, console.error(
155
155
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
156
156
  )), t = this.props.ref, t !== void 0 ? t : null;
157
157
  }
158
- function S(t, o, h, C, q, z, ve, le) {
159
- return h = z.ref, t = {
160
- $$typeof: j,
158
+ function j(t, a, v, k, ie, xe) {
159
+ var _ = v.ref;
160
+ return t = {
161
+ $$typeof: Y,
161
162
  type: t,
162
- key: o,
163
- props: z,
164
- _owner: q
165
- }, (h !== void 0 ? h : null) !== null ? Object.defineProperty(t, "ref", {
163
+ key: a,
164
+ props: v,
165
+ _owner: k
166
+ }, (_ !== void 0 ? _ : null) !== null ? Object.defineProperty(t, "ref", {
166
167
  enumerable: !1,
167
168
  get: n
168
169
  }) : Object.defineProperty(t, "ref", { enumerable: !1, value: null }), t._store = {}, Object.defineProperty(t._store, "validated", {
@@ -179,151 +180,148 @@ function yt() {
179
180
  configurable: !1,
180
181
  enumerable: !1,
181
182
  writable: !0,
182
- value: ve
183
+ value: ie
183
184
  }), Object.defineProperty(t, "_debugTask", {
184
185
  configurable: !1,
185
186
  enumerable: !1,
186
187
  writable: !0,
187
- value: le
188
+ value: xe
188
189
  }), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
189
190
  }
190
- function I(t, o, h, C, q, z, ve, le) {
191
- var V = o.children;
192
- if (V !== void 0)
193
- if (C)
194
- if (ye(V)) {
195
- for (C = 0; C < V.length; C++)
196
- R(V[C]);
197
- Object.freeze && Object.freeze(V);
191
+ function I(t, a, v, k, ie, xe) {
192
+ var _ = a.children;
193
+ if (_ !== void 0)
194
+ if (k)
195
+ if (V(_)) {
196
+ for (k = 0; k < _.length; k++)
197
+ E(_[k]);
198
+ Object.freeze && Object.freeze(_);
198
199
  } else
199
200
  console.error(
200
201
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
201
202
  );
202
- else R(V);
203
- if (_.call(o, "key")) {
204
- V = r(t);
205
- var ce = Object.keys(o).filter(function(T) {
206
- return T !== "key";
203
+ else E(_);
204
+ if (pe.call(a, "key")) {
205
+ _ = r(t);
206
+ var re = Object.keys(a).filter(function(Fe) {
207
+ return Fe !== "key";
207
208
  });
208
- C = 0 < ce.length ? "{key: someKey, " + ce.join(": ..., ") + ": ...}" : "{key: someKey}", f[V + C] || (ce = 0 < ce.length ? "{" + ce.join(": ..., ") + ": ...}" : "{}", console.error(
209
+ k = 0 < re.length ? "{key: someKey, " + re.join(": ..., ") + ": ...}" : "{key: someKey}", w[_ + k] || (re = 0 < re.length ? "{" + re.join(": ..., ") + ": ...}" : "{}", console.error(
209
210
  `A props object containing a "key" prop is being spread into JSX:
210
211
  let props = %s;
211
212
  <%s {...props} />
212
213
  React keys must be passed directly to JSX without using spread:
213
214
  let props = %s;
214
215
  <%s key={someKey} {...props} />`,
215
- C,
216
- V,
217
- ce,
218
- V
219
- ), f[V + C] = !0);
216
+ k,
217
+ _,
218
+ re,
219
+ _
220
+ ), w[_ + k] = !0);
220
221
  }
221
- if (V = null, h !== void 0 && (d(h), V = "" + h), F(o) && (d(o.key), V = "" + o.key), "key" in o) {
222
- h = {};
223
- for (var je in o)
224
- je !== "key" && (h[je] = o[je]);
225
- } else h = o;
226
- return V && v(
227
- h,
222
+ if (_ = null, v !== void 0 && (u(v), _ = "" + v), M(a) && (u(a.key), _ = "" + a.key), "key" in a) {
223
+ v = {};
224
+ for (var ye in a)
225
+ ye !== "key" && (v[ye] = a[ye]);
226
+ } else v = a;
227
+ return _ && p(
228
+ v,
228
229
  typeof t == "function" ? t.displayName || t.name || "Unknown" : t
229
- ), S(
230
+ ), j(
230
231
  t,
231
- V,
232
- z,
233
- q,
232
+ _,
233
+ v,
234
234
  c(),
235
- h,
236
- ve,
237
- le
235
+ ie,
236
+ xe
238
237
  );
239
238
  }
240
- function R(t) {
241
- typeof t == "object" && t !== null && t.$$typeof === j && t._store && (t._store.validated = 1);
239
+ function E(t) {
240
+ q(t) ? t._store && (t._store.validated = 1) : typeof t == "object" && t !== null && t.$$typeof === de && (t._payload.status === "fulfilled" ? q(t._payload.value) && t._payload.value._store && (t._payload.value._store.validated = 1) : t._store && (t._store.validated = 1));
242
241
  }
243
- var D = re, j = Symbol.for("react.transitional.element"), K = Symbol.for("react.portal"), W = Symbol.for("react.fragment"), x = Symbol.for("react.strict_mode"), A = Symbol.for("react.profiler"), g = Symbol.for("react.consumer"), s = Symbol.for("react.context"), w = Symbol.for("react.forward_ref"), M = Symbol.for("react.suspense"), $ = Symbol.for("react.suspense_list"), m = Symbol.for("react.memo"), L = Symbol.for("react.lazy"), Se = Symbol.for("react.activity"), U = Symbol.for("react.client.reference"), se = D.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, _ = Object.prototype.hasOwnProperty, ye = Array.isArray, N = console.createTask ? console.createTask : function() {
242
+ function q(t) {
243
+ return typeof t == "object" && t !== null && t.$$typeof === Y;
244
+ }
245
+ var S = te, Y = Symbol.for("react.transitional.element"), D = Symbol.for("react.portal"), x = Symbol.for("react.fragment"), A = Symbol.for("react.strict_mode"), f = Symbol.for("react.profiler"), s = Symbol.for("react.consumer"), C = Symbol.for("react.context"), N = Symbol.for("react.forward_ref"), W = Symbol.for("react.suspense"), g = Symbol.for("react.suspense_list"), G = Symbol.for("react.memo"), de = Symbol.for("react.lazy"), z = Symbol.for("react.activity"), he = Symbol.for("react.client.reference"), T = S.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, pe = Object.prototype.hasOwnProperty, V = Array.isArray, y = console.createTask ? console.createTask : function() {
244
246
  return null;
245
247
  };
246
- D = {
247
- "react-stack-bottom-frame": function(t) {
248
+ S = {
249
+ react_stack_bottom_frame: function(t) {
248
250
  return t();
249
251
  }
250
252
  };
251
- var y, B = {}, pe = D["react-stack-bottom-frame"].bind(
252
- D,
253
- p
254
- )(), fe = N(i(p)), f = {};
255
- Pe.Fragment = W, Pe.jsx = function(t, o, h, C, q) {
256
- var z = 1e4 > se.recentlyCreatedOwnerStacks++;
253
+ var B, ve = {}, fe = S.react_stack_bottom_frame.bind(
254
+ S,
255
+ m
256
+ )(), h = y(i(m)), w = {};
257
+ Pe.Fragment = x, Pe.jsx = function(t, a, v) {
258
+ var k = 1e4 > T.recentlyCreatedOwnerStacks++;
257
259
  return I(
258
260
  t,
259
- o,
260
- h,
261
+ a,
262
+ v,
261
263
  !1,
262
- C,
263
- q,
264
- z ? Error("react-stack-top-frame") : pe,
265
- z ? N(i(t)) : fe
264
+ k ? Error("react-stack-top-frame") : fe,
265
+ k ? y(i(t)) : h
266
266
  );
267
- }, Pe.jsxs = function(t, o, h, C, q) {
268
- var z = 1e4 > se.recentlyCreatedOwnerStacks++;
267
+ }, Pe.jsxs = function(t, a, v) {
268
+ var k = 1e4 > T.recentlyCreatedOwnerStacks++;
269
269
  return I(
270
270
  t,
271
- o,
272
- h,
271
+ a,
272
+ v,
273
273
  !0,
274
- C,
275
- q,
276
- z ? Error("react-stack-top-frame") : pe,
277
- z ? N(i(t)) : fe
274
+ k ? Error("react-stack-top-frame") : fe,
275
+ k ? y(i(t)) : h
278
276
  );
279
277
  };
280
- }()), Pe;
278
+ })()), Pe;
281
279
  }
282
280
  var st;
283
281
  function jt() {
284
- return st || (st = 1, process.env.NODE_ENV === "production" ? De.exports = St() : De.exports = yt()), De.exports;
282
+ return st || (st = 1, process.env.NODE_ENV === "production" ? qe.exports = St() : qe.exports = yt()), qe.exports;
285
283
  }
286
284
  var e = jt();
287
285
  const it = gt(void 0);
288
- function Ct(r, a) {
289
- let d;
286
+ function Ct(r, o) {
287
+ let u;
290
288
  const i = (...c) => {
291
- clearTimeout(d), d = setTimeout(() => r(...c), a);
289
+ clearTimeout(u), u = setTimeout(() => r(...c), o);
292
290
  };
293
- return i.cancel = () => clearTimeout(d), i;
291
+ return i.cancel = () => clearTimeout(u), i;
294
292
  }
295
293
  const Xt = ({
296
294
  children: r,
297
- email: a,
298
- password: d,
295
+ email: o,
296
+ password: u,
299
297
  url: i,
300
298
  dataset: c,
301
- allowEmptySearch: p = !1,
302
- maxResults: F = 10,
303
- facetDebounceDelayMillis: v = 500,
299
+ allowEmptySearch: m = !1,
300
+ maxResults: M = 10,
301
+ facetDebounceDelayMillis: p = 500,
304
302
  // debounce faceted searches only
305
303
  enableFacets: n = !0,
306
- coverageDepth: S = 500,
304
+ coverageDepth: j = 500,
307
305
  removeDuplicates: I = !0,
308
- enableCoverage: R = !0,
309
- initialCoverageSetup: D = {},
310
- enableDebugLogs: j = !1,
311
- preAuthenticatedToken: K
306
+ enableCoverage: E = !0,
307
+ initialCoverageSetup: q = {},
308
+ enableDebugLogs: S = !1,
309
+ preAuthenticatedToken: Y
312
310
  }) => {
313
- const W = Ee(0), x = Ee(void 0), A = Ee(!1), g = Ee(!1), [s, w] = X({
311
+ const D = Re(0), x = Re(void 0), A = Re(!1), f = Re(!1), [s, C] = U({
314
312
  query: "",
315
313
  results: null,
316
314
  isLoading: !1,
317
- resultsSuppressed: !p,
315
+ resultsSuppressed: !m,
318
316
  // Show placeholder if empty search not allowed
319
- facetDebounceDelayMillis: v,
317
+ facetDebounceDelayMillis: p,
320
318
  filters: {},
321
319
  rangeFilters: {},
322
320
  facetStats: {},
323
321
  searchSettings: {
324
- maxNumberOfRecordsToReturn: F,
325
- coverageDepth: S,
326
- enableCoverage: R,
322
+ maxNumberOfRecordsToReturn: M,
323
+ coverageDepth: j,
324
+ enableCoverage: E,
327
325
  removeDuplicates: I,
328
326
  minimumScore: 0,
329
327
  showScore: !0,
@@ -342,117 +340,117 @@ const Xt = ({
342
340
  coverJoinedWords: !0,
343
341
  coverPrefixSuffix: !0,
344
342
  truncate: !0,
345
- ...D
343
+ ...q
346
344
  // Allow prop-based override
347
345
  }
348
346
  }
349
347
  });
350
348
  me(() => {
351
- j && console.log("SearchContext mounted on client");
352
- }, [j]), me(() => {
353
- w((l) => ({
349
+ S && console.log("SearchContext mounted on client");
350
+ }, [S]), me(() => {
351
+ C((l) => ({
354
352
  ...l,
355
- facetDebounceDelayMillis: v
353
+ facetDebounceDelayMillis: p
356
354
  }));
357
- }, [v]);
358
- const [M, $] = X(null), [m] = X(n), L = te((l, u = {}) => {
359
- if (!M)
355
+ }, [p]);
356
+ const [N, W] = U(null), [g] = U(n), G = ee((l, d = {}) => {
357
+ if (!N)
360
358
  throw new Error("No authentication token available");
361
359
  return fetch(l, {
362
- ...u,
360
+ ...d,
363
361
  credentials: "include",
364
362
  headers: {
365
- ...u.headers,
366
- Authorization: `Bearer ${M}`
363
+ ...d.headers,
364
+ Authorization: `Bearer ${N}`
367
365
  }
368
366
  });
369
- }, [M]), [Se, U] = X([]), [se, _] = X([]), [ye, N] = X([]), [y, B] = X(!0), [pe, fe] = X({}), [f, t] = X({}), [o, h] = X({}), [C, q] = X(""), [z, ve] = X(""), [le, V] = X({}), ce = Ee(null), je = te((l) => {
370
- w((u) => ({
371
- ...u,
367
+ }, [N]), [de, z] = U([]), [he, T] = U([]), [pe, V] = U([]), [y, B] = U(!0), [ve, fe] = U({}), [h, w] = U({}), [t, a] = U({}), [v, k] = U(""), [ie, xe] = U(""), [_, re] = U({}), ye = Re(null), Fe = ee((l) => {
368
+ C((d) => ({
369
+ ...d,
372
370
  query: l,
373
371
  filters: {},
374
372
  rangeFilters: {}
375
373
  }));
376
- }, []), T = te((l) => {
377
- w((u) => ({
378
- ...u,
374
+ }, []), O = ee((l) => {
375
+ C((d) => ({
376
+ ...d,
379
377
  facetDebounceDelayMillis: l
380
378
  }));
381
- }, []), O = te((l) => {
382
- w((u) => ({
383
- ...u,
379
+ }, []), P = ee((l) => {
380
+ C((d) => ({
381
+ ...d,
384
382
  searchSettings: {
385
- ...u.searchSettings,
383
+ ...d.searchSettings,
386
384
  ...l,
387
385
  coverageSetup: {
388
- ...u.searchSettings.coverageSetup,
386
+ ...d.searchSettings.coverageSetup,
389
387
  ...l.coverageSetup || {}
390
388
  }
391
389
  }
392
390
  }));
393
- }, []), J = te((l, u) => {
394
- w((b) => {
395
- const E = { ...b.filters }, P = E[l] || [], Q = P.includes(u) ? P.filter((G) => G !== u) : [...P, u];
396
- return Q.length ? E[l] = Q : delete E[l], {
391
+ }, []), X = ee((l, d) => {
392
+ C((b) => {
393
+ const F = { ...b.filters }, H = F[l] || [], J = H.includes(d) ? H.filter((L) => L !== d) : [...H, d];
394
+ return J.length ? F[l] = J : delete F[l], {
397
395
  ...b,
398
- filters: E
396
+ filters: F
399
397
  };
400
398
  });
401
- }, []), Me = te((l, u, b) => {
402
- w((E) => ({
403
- ...E,
399
+ }, []), Me = ee((l, d, b) => {
400
+ C((F) => ({
401
+ ...F,
404
402
  rangeFilters: {
405
- ...E.rangeFilters,
406
- [l]: { min: u, max: b }
403
+ ...F.rangeFilters,
404
+ [l]: { min: d, max: b }
407
405
  }
408
406
  }));
409
- }, []), Ne = te(() => {
410
- w((l) => ({
407
+ }, []), Ne = ee(() => {
408
+ C((l) => ({
411
409
  ...l,
412
410
  filters: {},
413
411
  rangeFilters: {}
414
412
  }));
415
- }, []), Te = te((l, u) => {
416
- w((b) => {
417
- const E = { ...b.filters }, P = { ...b.rangeFilters };
418
- if (u !== void 0) {
419
- const G = (E[l] || []).filter((de) => de !== u);
420
- G.length > 0 ? E[l] = G : delete E[l];
413
+ }, []), _e = ee((l, d) => {
414
+ C((b) => {
415
+ const F = { ...b.filters }, H = { ...b.rangeFilters };
416
+ if (d !== void 0) {
417
+ const L = (F[l] || []).filter((ce) => ce !== d);
418
+ L.length > 0 ? F[l] = L : delete F[l];
421
419
  } else
422
- delete P[l];
420
+ delete H[l];
423
421
  return {
424
422
  ...b,
425
- filters: E,
426
- rangeFilters: P
423
+ filters: F,
424
+ rangeFilters: H
427
425
  };
428
426
  });
429
- }, []), ze = te((l, u) => {
430
- w((b) => ({
427
+ }, []), ze = ee((l, d) => {
428
+ C((b) => ({
431
429
  ...b,
432
430
  sortBy: l || void 0,
433
- sortAscending: l ? u : void 0
431
+ sortAscending: l ? d : void 0
434
432
  }));
435
- }, []), He = te(async (l, u, b) => {
433
+ }, []), He = ee(async (l, d, b) => {
436
434
  if (l.length === 0) return null;
437
435
  if (l.length === 1) return l[0];
438
- let E = l[0];
439
- for (let P = 1; P < l.length; P++) {
440
- const Q = await L(`${u}/api/CombineFilters/${b}`, {
436
+ let F = l[0];
437
+ for (let H = 1; H < l.length; H++) {
438
+ const J = await G(`${d}/api/CombineFilters/${b}`, {
441
439
  // Combine the current filter with the next filter
442
440
  method: "PUT",
443
441
  headers: {
444
442
  "Content-Type": "application/json"
445
443
  },
446
- body: JSON.stringify({ A: E, B: l[P], useAndOperation: !0 })
444
+ body: JSON.stringify({ A: F, B: l[H], useAndOperation: !0 })
447
445
  });
448
- if (!Q.ok) {
449
- const G = await Q.json();
450
- throw console.error("CombineFilters failed:", G), new Error("CombineFilters failed");
446
+ if (!J.ok) {
447
+ const L = await J.json();
448
+ throw console.error("CombineFilters failed:", L), new Error("CombineFilters failed");
451
449
  }
452
- E = await Q.json();
450
+ F = await J.json();
453
451
  }
454
- return E;
455
- }, [L]), Le = s.searchSettings.maxNumberOfRecordsToReturn, Ue = s.searchSettings.enableCoverage, Ge = s.searchSettings.removeDuplicates, Xe = s.searchSettings.coverageDepth, Je = s.searchSettings.minimumScore, Ie = s.sortBy, $e = s.sortAscending, Qe = Be(() => s.searchSettings.coverageSetup, [
452
+ return F;
453
+ }, [G]), Le = s.searchSettings.maxNumberOfRecordsToReturn, Ue = s.searchSettings.enableCoverage, Ge = s.searchSettings.removeDuplicates, Xe = s.searchSettings.coverageDepth, Je = s.searchSettings.minimumScore, $e = s.sortBy, Ie = s.sortAscending, Qe = Be(() => s.searchSettings.coverageSetup, [
456
454
  s.searchSettings.coverageSetup.levenshteinMaxWordSize,
457
455
  s.searchSettings.coverageSetup.minWordSize,
458
456
  s.searchSettings.coverageSetup.coverageMinWordHitsAbs,
@@ -465,117 +463,117 @@ const Xt = ({
465
463
  s.searchSettings.coverageSetup.coverJoinedWords,
466
464
  s.searchSettings.coverageSetup.coverPrefixSuffix,
467
465
  s.searchSettings.coverageSetup.truncate
468
- ]), Ye = te(
466
+ ]), Ye = ee(
469
467
  async ({ enableFacets: l }) => {
470
- if (!M) return;
471
- const u = ++W.current;
472
- w((b) => ({ ...b, isLoading: !0 }));
468
+ if (!N) return;
469
+ const d = ++D.current;
470
+ C((b) => ({ ...b, isLoading: !0 }));
473
471
  try {
474
- const b = Object.entries(s.filters ?? {}), P = (await Promise.all(
472
+ const b = Object.entries(s.filters ?? {}), H = (await Promise.all(
475
473
  b.map(
476
- async ([H, Y]) => Promise.all(
477
- Y.map(
478
- (ee) => L(`${i}/api/CreateValueFilter/${c}`, {
474
+ async ([$, Q]) => Promise.all(
475
+ Q.map(
476
+ (K) => G(`${i}/api/CreateValueFilter/${c}`, {
479
477
  method: "PUT",
480
478
  headers: {
481
479
  "Content-Type": "application/json"
482
480
  },
483
- body: JSON.stringify({ FieldName: H, Value: ee })
481
+ body: JSON.stringify({ FieldName: $, Value: K })
484
482
  }).then((ge) => ge.json())
485
483
  )
486
484
  )
487
485
  )
488
- )).flat(), Q = Object.entries(s.rangeFilters ?? {}), G = await Promise.all(
489
- Q.map(
490
- ([H, { min: Y, max: ee }]) => L(`${i}/api/CreateRangeFilter/${c}`, {
486
+ )).flat(), J = Object.entries(s.rangeFilters ?? {}), L = await Promise.all(
487
+ J.map(
488
+ ([$, { min: Q, max: K }]) => G(`${i}/api/CreateRangeFilter/${c}`, {
491
489
  method: "PUT",
492
490
  headers: {
493
491
  "Content-Type": "application/json"
494
492
  },
495
- body: JSON.stringify({ FieldName: H, LowerLimit: Y, UpperLimit: ee })
493
+ body: JSON.stringify({ FieldName: $, LowerLimit: Q, UpperLimit: K })
496
494
  }).then((ge) => ge.json())
497
495
  )
498
- ), de = [...P, ...G].filter(
499
- (H) => H && typeof H.hashString == "string"
500
- ), ne = await He(de, i, c), _e = p || s.query.trim() !== "", We = {
496
+ ), ce = [...H, ...L].filter(
497
+ ($) => $ && typeof $.hashString == "string"
498
+ ), se = await He(ce, i, c), Ae = m || s.query.trim() !== "", We = {
501
499
  text: s.query,
502
- maxNumberOfRecordsToReturn: _e ? Le : 0,
500
+ maxNumberOfRecordsToReturn: Ae ? Le : 0,
503
501
  enableFacets: l,
504
- ...ne ? { filter: ne } : {},
505
- ...Ie ? { sortBy: Ie } : {},
506
- ...$e !== void 0 ? { sortAscending: $e } : {},
502
+ ...se ? { filter: se } : {},
503
+ ...$e ? { sortBy: $e } : {},
504
+ ...Ie !== void 0 ? { sortAscending: Ie } : {},
507
505
  enableCoverage: Ue,
508
506
  removeDuplicates: Ge,
509
507
  coverageDepth: Xe,
510
508
  coverageSetup: Qe
511
509
  };
512
- j && console.log("[performSearch] request body:", JSON.stringify(We, null, 2));
513
- const oe = await (await L(`${i}/api/Search/${c}`, {
510
+ S && console.log("[performSearch] request body:", JSON.stringify(We, null, 2));
511
+ const ne = await (await G(`${i}/api/Search/${c}`, {
514
512
  method: "POST",
515
513
  headers: {
516
514
  "Content-Type": "application/json"
517
515
  },
518
516
  body: JSON.stringify(We)
519
- })).json(), we = oe.truncationIndex ?? -1, Ae = oe.records || [], k = Ae.map((H) => H.documentKey), he = Ae.map((H) => H.score);
520
- let ae = [];
521
- _e && k.length > 0 && (ae = (await (await L(`${i}/api/GetJson/${c}`, {
517
+ })).json(), Ce = ne.truncationIndex ?? -1, Te = ne.records || [], R = Te.map(($) => $.documentKey), ue = Te.map(($) => $.score);
518
+ let oe = [];
519
+ Ae && R.length > 0 && (oe = (await (await G(`${i}/api/GetJson/${c}`, {
522
520
  method: "POST",
523
521
  headers: {
524
522
  "Content-Type": "application/json"
525
523
  },
526
- body: JSON.stringify(k)
527
- })).json()).map((ee, ge) => ({
528
- document: ee,
529
- documentKey: k[ge],
530
- score: he[ge]
524
+ body: JSON.stringify(R)
525
+ })).json()).map((K, ge) => ({
526
+ document: K,
527
+ documentKey: R[ge],
528
+ score: ue[ge]
531
529
  })));
532
- let Ce = {};
533
- if (l && oe.facets) {
534
- for (const [H, Y] of Object.entries(oe.facets))
535
- if (Array.isArray(Y) && Y.length > 0) {
536
- const ee = Y.map((ge) => Number(ge.key)).filter((ge) => !isNaN(ge));
537
- ee.length > 0 && (Ce[H] = {
538
- min: Math.min(...ee),
539
- max: Math.max(...ee)
530
+ let je = {};
531
+ if (l && ne.facets) {
532
+ for (const [$, Q] of Object.entries(ne.facets))
533
+ if (Array.isArray(Q) && Q.length > 0) {
534
+ const K = Q.map((ge) => Number(ge.key)).filter((ge) => !isNaN(ge));
535
+ K.length > 0 && (je[$] = {
536
+ min: Math.min(...K),
537
+ max: Math.max(...K)
540
538
  });
541
539
  }
542
540
  }
543
- const ct = s.query !== C, ut = s.query !== z;
544
- let qe = s.facetStats ?? {};
545
- if (ct ? (qe = { ...pe, ...Ce }, h(qe), q(s.query)) : qe = { ...o, ...Ce }, ut && l) {
546
- const H = { ...le };
547
- for (const [Y, ee] of Object.entries(Ce))
548
- H[Y] = ee;
549
- V(H), ve(s.query);
541
+ const ct = s.query !== v, ut = s.query !== ie;
542
+ let De = s.facetStats ?? {};
543
+ if (ct ? (De = { ...ve, ...je }, a(De), k(s.query)) : De = { ...t, ...je }, ut && l) {
544
+ const $ = { ..._ };
545
+ for (const [Q, K] of Object.entries(je))
546
+ $[Q] = K;
547
+ re($), xe(s.query);
550
548
  }
551
- let Ve = oe.facets;
549
+ let Ve = ne.facets;
552
550
  if (l && (!Ve || Object.keys(Ve).length === 0)) {
553
551
  Ve = {};
554
- for (const [H, Y] of Object.entries(f))
555
- Ve[H] = Y.map((ee) => ({ key: ee, value: null }));
552
+ for (const [$, Q] of Object.entries(h))
553
+ Ve[$] = Q.map((K) => ({ key: K, value: null }));
556
554
  }
557
- if (u !== W.current)
555
+ if (d !== D.current)
558
556
  return;
559
- const dt = ae.filter((H) => {
560
- const Y = s.query.trim();
561
- return Y === "" || Y.length === 1 ? !0 : H.score >= Je;
557
+ const dt = oe.filter(($) => {
558
+ const Q = s.query.trim();
559
+ return Q === "" || Q.length === 1 ? !0 : $.score >= Je;
562
560
  });
563
- w((H) => ({
564
- ...H,
561
+ C(($) => ({
562
+ ...$,
565
563
  results: dt,
566
- resultsSuppressed: !_e,
564
+ resultsSuppressed: !Ae,
567
565
  ...l ? {
568
566
  facets: Ve,
569
- facetStats: qe
567
+ facetStats: De
570
568
  } : {},
571
569
  isLoading: !1,
572
- truncationIndex: we
570
+ truncationIndex: Ce
573
571
  }));
574
572
  } catch (b) {
575
- if (console.error("[Search] ❌ Search failed:", b), b instanceof TypeError && b.message.includes("fetch") ? (console.error("[Search] ❌ Network error - cannot reach INDX server"), console.error("[Search] 💡 Check if server is running at:", i)) : b instanceof Error && (b.message.includes("401") ? (console.error("[Search] ❌ Authentication failed"), console.error("[Search] 💡 Your token may have expired. Get a fresh token with:"), console.error('[Search] 💡 curl -X POST "' + i + `/api/Login" -H "Content-Type: application/json" -d '{"userEmail":"your@email.com","userPassWord":"yourpassword"}'`)) : b.message.includes("404") ? (console.error("[Search] ❌ Dataset not found"), console.error('[Search] 💡 Check that dataset "' + c + '" exists')) : console.error("[Search] 💡 Error:", b.message)), u !== W.current)
573
+ if (console.error("[Search] ❌ Search failed:", b), b instanceof TypeError && b.message.includes("fetch") ? (console.error("[Search] ❌ Network error - cannot reach INDX server"), console.error("[Search] 💡 Check if server is running at:", i)) : b instanceof Error && (b.message.includes("401") ? (console.error("[Search] ❌ Authentication failed"), console.error("[Search] 💡 Your token may have expired. Get a fresh token with:"), console.error('[Search] 💡 curl -X POST "' + i + `/api/Login" -H "Content-Type: application/json" -d '{"userEmail":"your@email.com","userPassWord":"yourpassword"}'`)) : b.message.includes("404") ? (console.error("[Search] ❌ Dataset not found"), console.error('[Search] 💡 Check that dataset "' + c + '" exists')) : console.error("[Search] 💡 Error:", b.message)), d !== D.current)
576
574
  return;
577
- w((E) => ({
578
- ...E,
575
+ C((F) => ({
576
+ ...F,
579
577
  results: null,
580
578
  isLoading: !1,
581
579
  resultsSuppressed: !1,
@@ -587,94 +585,92 @@ const Xt = ({
587
585
  s.query,
588
586
  s.filters,
589
587
  s.rangeFilters,
590
- Ie,
591
588
  $e,
589
+ Ie,
592
590
  Le,
593
591
  Ue,
594
592
  Ge,
595
593
  Xe,
596
594
  Qe,
597
595
  Je,
598
- L,
596
+ G,
599
597
  He,
600
598
  i,
601
599
  c,
602
- p,
603
- M
600
+ m,
601
+ N
604
602
  ]
605
603
  );
606
604
  me(() => {
607
605
  x.current = Ye;
608
- }, [Ye]), te(() => {
606
+ }, [Ye]), ee(() => {
609
607
  var l;
610
- j && console.log("Search fired"), (l = x.current) == null || l.call(x, { enableFacets: !1 });
608
+ S && console.log("Search fired"), (l = x.current) == null || l.call(x, { enableFacets: !1 });
611
609
  }, []);
612
- const ue = Ee(null);
610
+ const le = Re(null);
613
611
  return me(() => {
614
612
  var l;
615
- return (l = ue.current) == null || l.cancel(), ue.current = Ct(() => {
616
- var u;
617
- j && console.log("Debounced searchWithFacets fired"), (u = x.current) == null || u.call(x, { enableFacets: !0 });
613
+ return (l = le.current) == null || l.cancel(), le.current = Ct(() => {
614
+ var d;
615
+ S && console.log("Debounced searchWithFacets fired"), (d = x.current) == null || d.call(x, { enableFacets: !0 });
618
616
  }, s.facetDebounceDelayMillis ?? 500), () => {
619
- var u;
620
- (u = ue.current) == null || u.cancel();
617
+ var d;
618
+ (d = le.current) == null || d.cancel();
621
619
  };
622
- }, [s.facetDebounceDelayMillis]), te(() => {
620
+ }, [s.facetDebounceDelayMillis]), ee(() => {
623
621
  var l;
624
- (l = ue.current) == null || l.call(ue);
622
+ (l = le.current) == null || l.call(le);
625
623
  }, []), me(() => {
626
624
  var l;
627
- !y && M && !A.current && (p && ((l = x.current) == null || l.call(x, { enableFacets: m })), A.current = !0);
628
- }, [y, M, p, m]), me(() => {
629
- var E, P, Q, G, de;
630
- if (!M || !A.current) return;
631
- const l = s.query.trim(), u = l === "" && p;
632
- if (l === "" && !p) {
633
- s.resultsSuppressed || w((ne) => ({
634
- ...ne,
625
+ !y && N && !A.current && (m && ((l = x.current) == null || l.call(x, { enableFacets: g })), A.current = !0);
626
+ }, [y, N, m, g]), me(() => {
627
+ var F, H, J, L, ce;
628
+ if (!N || !A.current) return;
629
+ const l = s.query.trim(), d = l === "" && m;
630
+ if (l === "" && !m) {
631
+ s.resultsSuppressed || C((se) => ({
632
+ ...se,
635
633
  resultsSuppressed: !0
636
634
  }));
637
635
  return;
638
636
  }
639
- return u ? ((E = ue.current) == null || E.cancel(), (P = x.current) == null || P.call(x, { enableFacets: m })) : m ? (j && console.log("Search fired"), (Q = x.current) == null || Q.call(x, { enableFacets: !1 }), (G = ue.current) == null || G.call(ue)) : (de = x.current) == null || de.call(x, { enableFacets: !1 }), () => {
640
- var ne;
641
- (ne = ue.current) == null || ne.cancel();
637
+ return d ? ((F = le.current) == null || F.cancel(), (H = x.current) == null || H.call(x, { enableFacets: g })) : g ? (S && console.log("Search fired"), (J = x.current) == null || J.call(x, { enableFacets: !1 }), (L = le.current) == null || L.call(le)) : (ce = x.current) == null || ce.call(x, { enableFacets: !1 }), () => {
638
+ var se;
639
+ (se = le.current) == null || se.cancel();
642
640
  };
643
- }, [s.query, p, m]), me(() => {
641
+ }, [s.query, m, g]), me(() => {
644
642
  var b;
645
- if (!A.current || !M) return;
646
- if (!g.current) {
647
- g.current = !0, j && console.log("[Filter effect] First run, skipping");
643
+ if (!A.current || !N) return;
644
+ if (!f.current) {
645
+ f.current = !0, S && console.log("[Filter effect] First run, skipping");
648
646
  return;
649
647
  }
650
- if (s.query !== C) {
651
- j && console.log("[Filter effect] Skipping because query changed");
648
+ if (s.query !== v) {
649
+ S && console.log("[Filter effect] Skipping because query changed");
652
650
  return;
653
651
  }
654
652
  const l = s.query.trim();
655
- m && !(!p && l === "") && (j && console.log("[Filter effect] Firing search"), (b = x.current) == null || b.call(x, { enableFacets: !0 }));
653
+ g && !(!m && l === "") && (S && console.log("[Filter effect] Firing search"), (b = x.current) == null || b.call(x, { enableFacets: !0 }));
656
654
  }, [s.filters, s.rangeFilters]), me(() => {
657
655
  var b;
658
- if (!A.current || !M) return;
656
+ if (!A.current || !N) return;
659
657
  const l = s.query.trim();
660
- m && !(!p && l === "") && ((b = x.current) == null || b.call(x, { enableFacets: !0 }));
661
- }, [Ie, $e]), me(() => {
658
+ g && !(!m && l === "") && ((b = x.current) == null || b.call(x, { enableFacets: !0 }));
659
+ }, [$e, Ie]), me(() => {
662
660
  (async () => {
663
661
  try {
664
- let u;
665
- if (K)
666
- j && console.log("[Auth] ✅ Using pre-authenticated token"), u = K, $(K);
662
+ let d;
663
+ if (Y)
664
+ S && console.log("[Auth] ✅ Using pre-authenticated token"), d = Y, W(Y);
667
665
  else {
668
- if (!a)
669
- throw console.error("[Auth] ❌ Missing email"), console.error('[Auth] 💡 Pass email="your@email.com" to SearchProvider'), new Error("Email is required. Check console for instructions.");
670
- if (!d)
671
- throw console.error("[Auth] ❌ Missing password"), console.error('[Auth] 💡 Pass password="yourpassword" to SearchProvider'), new Error("Password is required. Check console for instructions.");
666
+ if (!o || !u)
667
+ throw console.error("[Auth] ❌ Missing credentials"), o || (console.error("[Auth] ❌ Missing email"), console.error('[Auth] 💡 Pass email="your@email.com" to SearchProvider')), u || (console.error("[Auth] ❌ Missing password"), console.error('[Auth] 💡 Pass password="yourpassword" to SearchProvider')), new Error("Email and password are required. Check console for instructions.");
672
668
  if (!i)
673
669
  throw console.error("[Auth] ❌ Missing INDX server URL"), console.error("[Auth] 💡 Add NEXT_PUBLIC_INDX_URL to your .env.local file"), new Error("INDX server URL is required. Check console for instructions.");
674
670
  if (!c)
675
671
  throw console.error("[Auth] ❌ Missing dataset name"), console.error('[Auth] 💡 Pass dataset="your-dataset-name" to SearchProvider'), new Error("Dataset name is required. Check console for instructions.");
676
- j && console.log("[Auth] 🔐 Logging in to get session token...");
677
- const k = await fetch(`${i}/api/Login`, {
672
+ S && console.log("[Auth] 🔐 Logging in to get session token...");
673
+ const R = await fetch(`${i}/api/Login`, {
678
674
  method: "POST",
679
675
  headers: {
680
676
  "Content-Type": "application/json",
@@ -682,165 +678,165 @@ const Xt = ({
682
678
  },
683
679
  credentials: "include",
684
680
  body: JSON.stringify({
685
- userEmail: a,
686
- userPassWord: d
681
+ userEmail: o,
682
+ userPassWord: u
687
683
  })
688
684
  });
689
- if (!k.ok)
690
- throw console.error("[Auth] ❌ Login failed:", k.status, await k.text()), new Error("Login failed. Check your email and password.");
691
- if (u = (await k.json()).token, !u)
685
+ if (!R.ok)
686
+ throw console.error("[Auth] ❌ Login failed:", R.status, await R.text()), new Error("Login failed. Check your email and password.");
687
+ if (d = (await R.json()).token, !d)
692
688
  throw console.error("[Auth] ❌ No token received from login response"), new Error("No token received from login.");
693
- j && console.log("[Auth] ✅ Login successful, token received (length:", u.length, ")"), $(u), j && console.log("[Auth] 🔓 Opening dataset session...");
694
- const ae = await fetch(`${i}/api/CreateOrOpen/${c}/400`, {
689
+ S && console.log("[Auth] ✅ Login successful, token received (length:", d.length, ")"), W(d), S && console.log("[Auth] 🔓 Opening dataset session...");
690
+ const oe = await fetch(`${i}/api/CreateOrOpen/${c}/400`, {
695
691
  method: "PUT",
696
692
  headers: {
697
693
  "Content-Type": "application/json",
698
- Authorization: `Bearer ${u}`
694
+ Authorization: `Bearer ${d}`
699
695
  },
700
696
  credentials: "include",
701
697
  body: '""'
702
698
  });
703
- if (!ae.ok)
704
- throw console.error("[Auth] ❌ CreateOrOpen failed:", ae.status, await ae.text()), new Error("Failed to open dataset session.");
705
- j && console.log("[Auth] ✅ Dataset session established");
699
+ if (!oe.ok)
700
+ throw console.error("[Auth] ❌ CreateOrOpen failed:", oe.status, await oe.text()), new Error("Failed to open dataset session.");
701
+ S && console.log("[Auth] ✅ Dataset session established");
706
702
  }
707
- const b = (k) => fetch(k, {
703
+ const b = (R) => fetch(R, {
708
704
  method: "GET",
709
705
  headers: {
710
706
  accept: "text/plain",
711
- Authorization: `Bearer ${u}`
707
+ Authorization: `Bearer ${d}`
712
708
  },
713
709
  credentials: "include"
714
710
  });
715
- j && console.log("[Auth] 🔍 Checking dataset status...");
716
- const E = await b(`${i}/api/GetStatus/${c}`);
717
- if (!E.ok) {
718
- if (E.status === 401)
711
+ S && console.log("[Auth] 🔍 Checking dataset status...");
712
+ const F = await b(`${i}/api/GetStatus/${c}`);
713
+ if (!F.ok) {
714
+ if (F.status === 401)
719
715
  throw console.error("[Auth] ❌ Authentication failed (401 Unauthorized)"), console.error("[Auth] 💡 Your token may be expired or invalid"), console.error('[Auth] 💡 Get a fresh token with: curl -X POST "' + i + `/api/Login" -H "Content-Type: application/json" -d '{"userEmail":"your@email.com","userPassWord":"yourpassword"}'`), new Error("Authentication failed (401). Token may be expired. Check console for instructions.");
720
- if (E.status === 404)
716
+ if (F.status === 404)
721
717
  throw console.error('[Auth] ❌ Dataset "' + c + '" not found (404)'), console.error('[Auth] 💡 Available datasets can be checked with: curl -X GET "' + i + '/api/GetUserDataSets" -H "Authorization: Bearer YOUR_TOKEN"'), console.error("[Auth] 💡 Make sure you spelled the dataset name correctly"), new Error('Dataset "' + c + '" not found. Check console for instructions.');
722
718
  {
723
- const k = await E.text();
724
- throw console.error("[Auth] ❌ Failed to get dataset status:", E.status, k), console.error("[Auth] 💡 Check if your INDX server is running at:", i), new Error("Failed to connect to INDX server. Check console for details.");
719
+ const R = await F.text();
720
+ throw console.error("[Auth] ❌ Failed to get dataset status:", F.status, R), console.error("[Auth] 💡 Check if your INDX server is running at:", i), new Error("Failed to connect to INDX server. Check console for details.");
725
721
  }
726
722
  }
727
- const P = await E.json();
728
- j && console.log("[Auth] 📊 Dataset status:", P), P.state && P.state !== "Ready" && (console.warn("[Auth] ⚠️ Dataset is not ready yet. Current state:", P.state), console.warn("[Auth] 💡 Wait for indexing to complete before searching"));
729
- const Q = P.documentCount ?? P.numberOfRecords ?? 0;
730
- Q === 0 ? (console.warn('[Auth] ⚠️ Dataset "' + c + '" is empty (0 records)'), console.warn("[Auth] 💡 Add documents to your dataset before searching"), console.warn("[Auth] 💡 Search will work but return no results")) : j && console.log("[Auth] ✅ Dataset has", Q, "records");
731
- const [G, de, ne] = await Promise.all([
723
+ const H = await F.json();
724
+ S && console.log("[Auth] 📊 Dataset status:", H), H.state && H.state !== "Ready" && (console.warn("[Auth] ⚠️ Dataset is not ready yet. Current state:", H.state), console.warn("[Auth] 💡 Wait for indexing to complete before searching"));
725
+ const J = H.documentCount ?? H.numberOfRecords ?? 0;
726
+ J === 0 ? (console.warn('[Auth] ⚠️ Dataset "' + c + '" is empty (0 records)'), console.warn("[Auth] 💡 Add documents to your dataset before searching"), console.warn("[Auth] 💡 Search will work but return no results")) : S && console.log("[Auth] ✅ Dataset has", J, "records");
727
+ const [L, ce, se] = await Promise.all([
732
728
  b(`${i}/api/GetFilterableFields/${c}`),
733
729
  b(`${i}/api/GetFacetableFields/${c}`),
734
730
  b(`${i}/api/GetSortableFields/${c}`)
735
731
  ]);
736
- if (!G.ok)
737
- throw console.error("[Auth] ❌ GetFilterableFields failed:", G.status, await G.text()), new Error("Failed to get filterable fields. Check console for details.");
738
- if (!de.ok)
739
- throw console.error("[Auth] ❌ GetFacetableFields failed:", de.status, await de.text()), new Error("Failed to get facetable fields. Check console for details.");
740
- if (!ne.ok)
741
- throw console.error("[Auth] ❌ GetSortableFields failed:", ne.status, await ne.text()), new Error("Failed to get sortable fields. Check console for details.");
742
- const _e = await G.json().catch((k) => (console.error("Failed to parse GetFilterableFields response:", k), [])), We = await de.json().catch((k) => (console.error("Failed to parse GetFacetableFields response:", k), [])), Ze = await ne.json().catch((k) => (console.error("Failed to parse GetSortableFields response:", k), []));
743
- U(_e || []), _(We || []), N(Ze || []);
744
- let oe = { facets: {} };
732
+ if (!L.ok)
733
+ throw console.error("[Auth] ❌ GetFilterableFields failed:", L.status, await L.text()), new Error("Failed to get filterable fields. Check console for details.");
734
+ if (!ce.ok)
735
+ throw console.error("[Auth] ❌ GetFacetableFields failed:", ce.status, await ce.text()), new Error("Failed to get facetable fields. Check console for details.");
736
+ if (!se.ok)
737
+ throw console.error("[Auth] ❌ GetSortableFields failed:", se.status, await se.text()), new Error("Failed to get sortable fields. Check console for details.");
738
+ const Ae = await L.json().catch((R) => (console.error("Failed to parse GetFilterableFields response:", R), [])), We = await ce.json().catch((R) => (console.error("Failed to parse GetFacetableFields response:", R), [])), Ze = await se.json().catch((R) => (console.error("Failed to parse GetSortableFields response:", R), []));
739
+ z(Ae || []), T(We || []), V(Ze || []);
740
+ let ne = { facets: {} };
745
741
  try {
746
- const k = await fetch(`${i}/api/Search/${c}`, {
742
+ const R = await fetch(`${i}/api/Search/${c}`, {
747
743
  method: "POST",
748
744
  headers: {
749
745
  "Content-Type": "application/json",
750
- Authorization: `Bearer ${u}`
746
+ Authorization: `Bearer ${d}`
751
747
  },
752
748
  credentials: "include",
753
749
  body: JSON.stringify({ text: "", maxNumberOfRecordsToReturn: 0, enableFacets: !0 })
754
750
  });
755
- k.ok ? oe = await k.json().catch((he) => (console.warn("Failed to parse blank search response:", he), { facets: {} })) : (console.warn("Blank search failed:", k.status, k.statusText), console.warn("Continuing without initial facet data - facets will be populated after first search"));
756
- } catch (k) {
757
- console.warn("Blank search error:", k), console.warn("Continuing without initial facet data - facets will be populated after first search");
751
+ R.ok ? ne = await R.json().catch((ue) => (console.warn("Failed to parse blank search response:", ue), { facets: {} })) : (console.warn("Blank search failed:", R.status, R.statusText), console.warn("Continuing without initial facet data - facets will be populated after first search"));
752
+ } catch (R) {
753
+ console.warn("Blank search error:", R), console.warn("Continuing without initial facet data - facets will be populated after first search");
758
754
  }
759
- const we = {};
760
- if (oe.facets) {
761
- for (const [k, he] of Object.entries(oe.facets))
762
- if (Array.isArray(he) && he.length > 0) {
763
- const ae = he.map((Ce) => Number(Ce.key)).filter((Ce) => !isNaN(Ce));
764
- ae.length > 0 && (we[k] = {
765
- min: Math.min(...ae),
766
- max: Math.max(...ae)
755
+ const Ce = {};
756
+ if (ne.facets) {
757
+ for (const [R, ue] of Object.entries(ne.facets))
758
+ if (Array.isArray(ue) && ue.length > 0) {
759
+ const oe = ue.map((je) => Number(je.key)).filter((je) => !isNaN(je));
760
+ oe.length > 0 && (Ce[R] = {
761
+ min: Math.min(...oe),
762
+ max: Math.max(...oe)
767
763
  });
768
764
  }
769
765
  }
770
- const Ae = {};
771
- if (oe.facets)
772
- for (const [k, he] of Object.entries(oe.facets))
773
- Array.isArray(he) && (Ae[k] = he.map((ae) => ae.key));
774
- ce.current = {
775
- facets: oe.facets,
776
- facetStats: we,
777
- facetKeys: Ae
778
- }, fe(we), t(Ae), V(we), w((k) => ({
779
- ...k,
780
- facetStats: we
781
- })), j && console.log("[Auth] ✅ Initialization complete");
782
- } catch (u) {
783
- throw console.error("[Auth] ❌ Initialization failed:", u), (u instanceof Error || typeof u == "object" && u !== null && "message" in u) && console.error("[Auth] 💡 Error:", u.message), u instanceof TypeError && u.message.includes("fetch") && (console.error("[Auth] ❌ Network error - cannot connect to INDX server"), console.error("[Auth] 💡 Check if the server is running at:", i), console.error("[Auth] 💡 Check your NEXT_PUBLIC_INDX_URL in .env.local"), console.error("[Auth] 💡 For local development, it should be: http://localhost:38171")), u;
766
+ const Te = {};
767
+ if (ne.facets)
768
+ for (const [R, ue] of Object.entries(ne.facets))
769
+ Array.isArray(ue) && (Te[R] = ue.map((oe) => oe.key));
770
+ ye.current = {
771
+ facets: ne.facets,
772
+ facetStats: Ce,
773
+ facetKeys: Te
774
+ }, fe(Ce), w(Te), re(Ce), C((R) => ({
775
+ ...R,
776
+ facetStats: Ce
777
+ })), S && console.log("[Auth] ✅ Initialization complete");
778
+ } catch (d) {
779
+ throw console.error("[Auth] ❌ Initialization failed:", d), (d instanceof Error || typeof d == "object" && d !== null && "message" in d) && console.error("[Auth] 💡 Error:", d.message), d instanceof TypeError && d.message.includes("fetch") && (console.error("[Auth] ❌ Network error - cannot connect to INDX server"), console.error("[Auth] 💡 Check if the server is running at:", i), console.error("[Auth] 💡 Check your NEXT_PUBLIC_INDX_URL in .env.local"), console.error("[Auth] 💡 For local development, it should be: http://localhost:38171")), d;
784
780
  } finally {
785
781
  B(!1);
786
782
  }
787
783
  })();
788
- }, [a, d, i, c]), /* @__PURE__ */ e.jsx(
784
+ }, [o, u, i, c]), /* @__PURE__ */ e.jsx(
789
785
  it.Provider,
790
786
  {
791
787
  value: {
792
788
  state: {
793
789
  ...s,
794
- filterableFields: Se,
795
- facetableFields: se,
796
- sortableFields: ye,
797
- rangeBounds: le
790
+ filterableFields: de,
791
+ facetableFields: he,
792
+ sortableFields: pe,
793
+ rangeBounds: _
798
794
  },
799
795
  isFetchingInitial: y,
800
- allowEmptySearch: p,
801
- setQuery: je,
802
- toggleFilter: J,
796
+ allowEmptySearch: m,
797
+ setQuery: Fe,
798
+ toggleFilter: X,
803
799
  setRangeFilter: Me,
804
800
  resetFilters: Ne,
805
- resetSingleFilter: Te,
801
+ resetSingleFilter: _e,
806
802
  setSort: ze,
807
- setDebounceDelay: T,
808
- setSearchSettings: O
803
+ setDebounceDelay: O,
804
+ setSearchSettings: P
809
805
  },
810
806
  children: r
811
807
  }
812
808
  );
813
- }, Fe = () => {
809
+ }, Ee = () => {
814
810
  const r = mt(it);
815
811
  if (!r)
816
812
  throw new Error("useSearchContext must be used within a SearchProvider");
817
813
  return r;
818
814
  }, Jt = ({
819
815
  className: r = "",
820
- autoFocus: a = !1,
821
- inputSize: d = "default",
816
+ autoFocus: o = !1,
817
+ inputSize: u = "default",
822
818
  showClear: i = !0,
823
819
  showFocus: c = !1,
824
- ...p
820
+ ...m
825
821
  }) => {
826
- const { state: { query: F, filters: v, rangeFilters: n, searchSettings: S }, setQuery: I } = Fe();
827
- Object.keys(v).length > 0 || Object.keys(n).length > 0;
828
- const R = F.length > 0;
822
+ const { state: { query: M, filters: p, rangeFilters: n, searchSettings: j }, setQuery: I } = Ee();
823
+ Object.keys(p).length > 0 || Object.keys(n).length > 0;
824
+ const E = M.length > 0;
829
825
  return /* @__PURE__ */ e.jsx(
830
826
  vt,
831
827
  {
832
828
  type: "text",
833
- value: F,
834
- onChange: (D) => I(D.target.value),
835
- placeholder: S.placeholderText,
836
- autoFocus: a,
829
+ value: M,
830
+ onChange: (q) => I(q.target.value),
831
+ placeholder: j.placeholderText,
832
+ autoFocus: o,
837
833
  className: r,
838
834
  showSearchIcon: !0,
839
- inputSize: d,
835
+ inputSize: u,
840
836
  showFocusBorder: c,
841
- ...p,
842
- children: i && R && /* @__PURE__ */ e.jsx(
843
- be,
837
+ ...m,
838
+ children: i && E && /* @__PURE__ */ e.jsx(
839
+ Se,
844
840
  {
845
841
  variant: "ghost",
846
842
  size: "micro",
@@ -851,261 +847,261 @@ const Xt = ({
851
847
  )
852
848
  }
853
849
  );
854
- }, wt = "_placeholder_bcpqa_1", kt = "_invalid_bcpqa_10", Rt = "_row_bcpqa_14", Et = "_indexNumber_bcpqa_42", Ft = "_scoreNumber_bcpqa_49", ke = {
850
+ }, wt = "_placeholder_bcpqa_1", kt = "_invalid_bcpqa_10", Rt = "_row_bcpqa_14", Et = "_indexNumber_bcpqa_42", Ft = "_scoreNumber_bcpqa_49", we = {
855
851
  placeholder: wt,
856
852
  invalid: kt,
857
853
  row: Rt,
858
854
  indexNumber: Et,
859
855
  scoreNumber: Ft
860
- }, Mt = ({ color: r = "black", size: a = 21 }) => {
861
- const d = 0.7142857142857143, i = a, c = typeof a == "number" ? a * d : `calc(${a} * 0.7142857142857143)`;
856
+ }, Mt = ({ color: r = "black", size: o = 21 }) => {
857
+ const u = 0.7142857142857143, i = o, c = typeof o == "number" ? o * u : `calc(${o} * 0.7142857142857143)`;
862
858
  return e.jsx("svg", { width: i, height: c, viewBox: "0 0 7 5", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: e.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M4 0H3V1V2V3H2V2H1V3H2V4H3V5H4V4H5V3H6V2H5V3H4V2V1V0ZM4 3V4H3V3H4Z", fill: r }) });
863
- }, Nt = ({ color: r = "black", size: a = 21 }) => {
864
- const d = 0.7142857142857143, i = a, c = typeof a == "number" ? a * d : `calc(${a} * 0.7142857142857143)`;
859
+ }, Nt = ({ color: r = "black", size: o = 21 }) => {
860
+ const u = 0.7142857142857143, i = o, c = typeof o == "number" ? o * u : `calc(${o} * 0.7142857142857143)`;
865
861
  return e.jsx("svg", { width: i, height: c, viewBox: "0 0 7 5", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: e.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M5 0H4V1H5V2H4H3H2H1V3H2H3H4H5V4H4V5H5V4H6V3H7V2H6V1H5V0ZM6 2H5V3H6V2Z", fill: r }) });
866
- }, Tt = ({ color: r = "black", size: a = 21 }) => {
867
- const d = 0.7142857142857143, i = a, c = typeof a == "number" ? a * d : `calc(${a} * 0.7142857142857143)`;
862
+ }, _t = ({ color: r = "black", size: o = 21 }) => {
863
+ const u = 0.7142857142857143, i = o, c = typeof o == "number" ? o * u : `calc(${o} * 0.7142857142857143)`;
868
864
  return e.jsx("svg", { width: i, height: c, viewBox: "0 0 7 5", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: e.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M5 0H6V1H5V0ZM6 1H7V2H6V1ZM0 1H1V2H0V1ZM1 1V0H2V1H1ZM6 3H7V4H6V3ZM6 4V5H5V4H6ZM1 4H2V5H1V4ZM1 4H0V3H1V4ZM2 2H5V3H2V2Z", fill: r }) });
869
- }, lt = ({ color: r = "black", size: a = 21 }) => {
870
- const d = 0.7142857142857143, i = a, c = typeof a == "number" ? a * d : `calc(${a} * 0.7142857142857143)`;
865
+ }, lt = ({ color: r = "black", size: o = 21 }) => {
866
+ const u = 0.7142857142857143, i = o, c = typeof o == "number" ? o * u : `calc(${o} * 0.7142857142857143)`;
871
867
  return e.jsx("svg", { width: i, height: c, viewBox: "0 0 7 5", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: e.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M1 0H2V1H1V0ZM3 2H2V1H3V2ZM4 2H3V3H2V4H1V5H2V4H3V3H4V4H5V5H6V4H5V3H4V2ZM5 1V2H4V1H5ZM5 1V0H6V1H5Z", fill: r }) });
872
- }, Qt = ({ fields: r, resultsPerPage: a, children: d }) => {
868
+ }, Qt = ({ fields: r, resultsPerPage: o, children: u }) => {
873
869
  const {
874
- state: { results: i, resultsSuppressed: c, searchSettings: p, truncationIndex: F },
875
- isFetchingInitial: v
876
- } = Fe(), n = a ?? 30, [S, I] = X(n);
870
+ state: { results: i, resultsSuppressed: c, searchSettings: m, truncationIndex: M },
871
+ isFetchingInitial: p
872
+ } = Ee(), n = o ?? 30, [j, I] = U(n);
877
873
  me(() => {
878
874
  I(n);
879
875
  }, [i]);
880
- const R = i && i.length > S, D = () => {
881
- I((j) => j + n);
876
+ const E = i && i.length > j, q = () => {
877
+ I((S) => S + n);
882
878
  };
883
- return v || c ? /* @__PURE__ */ e.jsx("div", { className: ke.placeholder, children: /* @__PURE__ */ e.jsx(Tt, { size: 350, color: "var(--lv5)" }) }) : !i || i.length === 0 ? /* @__PURE__ */ e.jsx("div", { className: ke.invalid, children: /* @__PURE__ */ e.jsx("p", { children: "No results found." }) }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
884
- /* @__PURE__ */ e.jsx("div", { className: ke.container, children: (i ?? []).slice(0, S).map((j, K) => {
885
- const W = j.document, x = j.score;
879
+ return p || c ? /* @__PURE__ */ e.jsx("div", { className: we.placeholder, children: /* @__PURE__ */ e.jsx(_t, { size: 350, color: "var(--lv5)" }) }) : !i || i.length === 0 ? /* @__PURE__ */ e.jsx("div", { className: we.invalid, children: /* @__PURE__ */ e.jsx("p", { children: "No results found." }) }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
880
+ /* @__PURE__ */ e.jsx("div", { className: we.container, children: (i ?? []).slice(0, j).map((S, Y) => {
881
+ const D = S.document, x = S.score;
886
882
  let A;
887
883
  try {
888
- A = typeof W == "string" ? JSON.parse(W) : W;
884
+ A = typeof D == "string" ? JSON.parse(D) : D;
889
885
  } catch {
890
- return /* @__PURE__ */ e.jsx("div", { className: ke.invalid, children: /* @__PURE__ */ e.jsx("p", { children: "Invalid JSON" }) }, K);
886
+ return /* @__PURE__ */ e.jsx("div", { className: we.invalid, children: /* @__PURE__ */ e.jsx("p", { children: "Invalid JSON" }) }, Y);
891
887
  }
892
- let g;
888
+ let f;
893
889
  if (r && r.length > 0) {
894
- g = {};
890
+ f = {};
895
891
  for (const s of r)
896
- s in A && (g[s] = A[s]);
892
+ s in A && (f[s] = A[s]);
897
893
  } else
898
- g = { ...A };
899
- for (const s in g) {
900
- const w = g[s];
901
- if (typeof w == "string" && w.startsWith("[") && w.endsWith("]")) {
902
- const $ = w.replace(/^\[|\]$/g, "").split(",").map((m) => m.trim().replace(/^'|'$/g, "")).filter((m) => m.length > 0);
903
- g[s] = $;
894
+ f = { ...A };
895
+ for (const s in f) {
896
+ const C = f[s];
897
+ if (typeof C == "string" && C.startsWith("[") && C.endsWith("]")) {
898
+ const W = C.replace(/^\[|\]$/g, "").split(",").map((g) => g.trim().replace(/^'|'$/g, "")).filter((g) => g.length > 0);
899
+ f[s] = W;
904
900
  }
905
901
  }
906
- return /* @__PURE__ */ e.jsxs("div", { className: ke.row, children: [
907
- /* @__PURE__ */ e.jsx("div", { className: ke.indexNumber, children: K }),
908
- d(g),
909
- p.showScore && /* @__PURE__ */ e.jsx("div", { className: ke.scoreNumber, children: x })
910
- ] }, K);
902
+ return /* @__PURE__ */ e.jsxs("div", { className: we.row, children: [
903
+ /* @__PURE__ */ e.jsx("div", { className: we.indexNumber, children: Y }),
904
+ u(f),
905
+ m.showScore && /* @__PURE__ */ e.jsx("div", { className: we.scoreNumber, children: x })
906
+ ] }, Y);
911
907
  }) }),
912
- R && /* @__PURE__ */ e.jsx("div", { style: { textAlign: "center", marginTop: "20px" }, children: /* @__PURE__ */ e.jsxs(
913
- be,
908
+ E && /* @__PURE__ */ e.jsx("div", { style: { textAlign: "center", marginTop: "20px" }, children: /* @__PURE__ */ e.jsxs(
909
+ Se,
914
910
  {
915
911
  variant: "secondary",
916
912
  size: "micro",
917
- onClick: D,
913
+ onClick: q,
918
914
  children: [
919
915
  "Load more ",
920
- F
916
+ M
921
917
  ]
922
918
  }
923
919
  ) })
924
920
  ] });
925
- }, At = "_list_mwzqq_2", _t = "_count_mwzqq_7", Vt = "_grid_mwzqq_16", Re = {
926
- list: At,
927
- count: _t,
921
+ }, Tt = "_list_mwzqq_2", At = "_count_mwzqq_7", Vt = "_grid_mwzqq_16", ke = {
922
+ list: Tt,
923
+ count: At,
928
924
  grid: Vt
929
925
  }, Yt = ({
930
926
  field: r,
931
- label: a,
932
- preserveBlankFacetState: d = !1,
927
+ label: o,
928
+ preserveBlankFacetState: u = !1,
933
929
  preserveBlankFacetStateOrder: i = !1,
934
930
  sortFacetsBy: c = "histogram",
935
- limit: p = 10,
936
- collapsible: F = !0,
937
- startCollapsed: v = !1,
931
+ limit: m = 10,
932
+ collapsible: M = !0,
933
+ startCollapsed: p = !1,
938
934
  displayType: n = "checkbox",
939
- layout: S = "list",
935
+ layout: j = "list",
940
936
  showActivePanel: I = !1,
941
- showCount: R = !0,
942
- showNull: D = !1,
943
- displayIfEmptyQuery: j = !0,
944
- displayCondition: K = (W) => !0
937
+ showCount: E = !0,
938
+ showNull: q = !1,
939
+ displayIfEmptyQuery: S = !0,
940
+ displayCondition: Y = (D) => !0
945
941
  }) => {
946
942
  const {
947
- state: { facets: W, filterableFields: x, facetableFields: A, filters: g, query: s },
948
- toggleFilter: w,
949
- isFetchingInitial: M,
950
- allowEmptySearch: $
951
- } = Fe(), m = Ee(null), [L, Se] = X(!1);
952
- if (!$ && !s || M || !W || !K({ query: s ?? "", filters: g, facets: W }) || !j && !s && Object.keys(g).length < 1)
943
+ state: { facets: D, filterableFields: x, facetableFields: A, filters: f, query: s },
944
+ toggleFilter: C,
945
+ isFetchingInitial: N,
946
+ allowEmptySearch: W
947
+ } = Ee(), g = Re(null), [G, de] = U(!1);
948
+ if (!W && !s || N || !D || !Y({ query: s ?? "", filters: f, facets: D }) || !S && !s && Object.keys(f).length < 1)
953
949
  return null;
954
950
  if (!(x != null && x.includes(r)) || !(A != null && A.includes(r))) {
955
- const f = [];
956
- return x != null && x.includes(r) || f.push("filterable"), A != null && A.includes(r) || f.push("facetable"), /* @__PURE__ */ e.jsx(xe, { collapsible: !1, children: /* @__PURE__ */ e.jsxs("div", { style: { color: "red", fontSize: "12px" }, children: [
951
+ const h = [];
952
+ return x != null && x.includes(r) || h.push("filterable"), A != null && A.includes(r) || h.push("facetable"), /* @__PURE__ */ e.jsx(be, { collapsible: !1, children: /* @__PURE__ */ e.jsxs("div", { style: { color: "red", fontSize: "12px" }, children: [
957
953
  'Cannot render filter for "',
958
954
  r,
959
955
  '": missing ',
960
- f.join(" and "),
956
+ h.join(" and "),
961
957
  "."
962
958
  ] }) });
963
959
  }
964
- const U = W == null ? void 0 : W[r];
965
- if (!U || !Array.isArray(U)) return null;
966
- const se = (g == null ? void 0 : g[r]) ?? [];
967
- d && !m.current && U.length > 0 && (m.current = U.reduce(
968
- (f, t) => (f[t.key] = t.value, f),
960
+ const z = D == null ? void 0 : D[r];
961
+ if (!z || !Array.isArray(z)) return null;
962
+ const he = (f == null ? void 0 : f[r]) ?? [];
963
+ u && !g.current && z.length > 0 && (g.current = z.reduce(
964
+ (h, w) => (h[w.key] = w.value, h),
969
965
  {}
970
966
  ));
971
- const _ = /* @__PURE__ */ new Map();
972
- d && m.current ? (Object.keys(m.current).forEach((f) => {
973
- _.set(f, 0);
974
- }), U.forEach((f) => {
975
- _.set(f.key, f.value);
976
- })) : U.forEach((f) => {
977
- _.set(f.key, f.value);
967
+ const T = /* @__PURE__ */ new Map();
968
+ u && g.current ? (Object.keys(g.current).forEach((h) => {
969
+ T.set(h, 0);
970
+ }), z.forEach((h) => {
971
+ T.set(h.key, h.value);
972
+ })) : z.forEach((h) => {
973
+ T.set(h.key, h.value);
978
974
  });
979
- const ye = n === "toggle" && _.size === 2 && _.has("true") && (_.has("false") || _.has("null"));
980
- if (_.has("null")) {
981
- const f = _.get("null") ?? 0, t = _.get("false") ?? 0;
982
- _.set("false", (t ?? 0) + f), _.delete("null");
975
+ const pe = n === "toggle" && T.size === 2 && T.has("true") && (T.has("false") || T.has("null"));
976
+ if (T.has("null")) {
977
+ const h = T.get("null") ?? 0, w = T.get("false") ?? 0;
978
+ T.set("false", (w ?? 0) + h), T.delete("null");
983
979
  }
984
- if (n === "toggle" && !ye)
985
- return /* @__PURE__ */ e.jsx(xe, { collapsible: !1, children: /* @__PURE__ */ e.jsx("div", { className: Re.count, children: /* @__PURE__ */ e.jsx(
986
- ie,
980
+ if (n === "toggle" && !pe)
981
+ return /* @__PURE__ */ e.jsx(be, { collapsible: !1, children: /* @__PURE__ */ e.jsx("div", { className: ke.count, children: /* @__PURE__ */ e.jsx(
982
+ ae,
987
983
  {
988
- label: a,
984
+ label: o,
989
985
  checked: !1,
990
986
  onChange: () => {
991
987
  },
992
988
  disabled: !0
993
989
  }
994
990
  ) }) });
995
- if (ye) {
996
- const f = _.get("true"), t = typeof f == "number" ? f : null, o = se.includes("true"), h = t === 0, C = R && (t ?? 0) > 0 ? `${t}` : "";
997
- return /* @__PURE__ */ e.jsx(xe, { collapsible: !1, children: /* @__PURE__ */ e.jsxs("div", { className: Re.count, children: [
991
+ if (pe) {
992
+ const h = T.get("true"), w = typeof h == "number" ? h : null, t = he.includes("true"), a = w === 0, v = E && (w ?? 0) > 0 ? `${w}` : "";
993
+ return /* @__PURE__ */ e.jsx(be, { collapsible: !1, children: /* @__PURE__ */ e.jsxs("div", { className: ke.count, children: [
998
994
  /* @__PURE__ */ e.jsx(
999
- ie,
995
+ ae,
1000
996
  {
1001
- label: a,
1002
- checked: o,
1003
- onChange: () => w(r, "true"),
1004
- disabled: h
997
+ label: o,
998
+ checked: t,
999
+ onChange: () => C(r, "true"),
1000
+ disabled: a
1005
1001
  }
1006
1002
  ),
1007
1003
  " ",
1008
- C
1004
+ v
1009
1005
  ] }) });
1010
1006
  }
1011
- let N = Array.from(_.entries());
1012
- if (D || (N = N.filter(([f]) => f !== "null")), N.length === 0 && !d)
1007
+ let V = Array.from(T.entries());
1008
+ if (q || (V = V.filter(([h]) => h !== "null")), V.length === 0 && !u)
1013
1009
  return null;
1014
1010
  if (!i) if (c === "alphabetical") {
1015
- const f = N.filter(([, o]) => typeof o == "number" && o > 0).sort(([o], [h]) => o.localeCompare(h)), t = N.filter(([, o]) => o === 0 || o === null).sort(([o], [h]) => o.localeCompare(h));
1016
- N = [...f, ...t];
1011
+ const h = V.filter(([, t]) => typeof t == "number" && t > 0).sort(([t], [a]) => t.localeCompare(a)), w = V.filter(([, t]) => t === 0 || t === null).sort(([t], [a]) => t.localeCompare(a));
1012
+ V = [...h, ...w];
1017
1013
  } else if (c === "numeric") {
1018
- const f = (h, C) => {
1019
- const q = Number(h), z = Number(C), ve = !isNaN(q), le = !isNaN(z);
1020
- return ve && le ? q - z : h.localeCompare(C);
1021
- }, t = N.filter(([, h]) => typeof h == "number" && h > 0).sort(([h], [C]) => f(h, C)), o = N.filter(([, h]) => h === 0 || h === null).sort(([h], [C]) => f(h, C));
1022
- N = [...t, ...o];
1014
+ const h = (a, v) => {
1015
+ const k = Number(a), ie = Number(v), xe = !isNaN(k), _ = !isNaN(ie);
1016
+ return xe && _ ? k - ie : a.localeCompare(v);
1017
+ }, w = V.filter(([, a]) => typeof a == "number" && a > 0).sort(([a], [v]) => h(a, v)), t = V.filter(([, a]) => a === 0 || a === null).sort(([a], [v]) => h(a, v));
1018
+ V = [...w, ...t];
1023
1019
  } else {
1024
- const f = N.filter(([, o]) => typeof o == "number" && o > 0), t = N.filter(([, o]) => o === 0 || o === null);
1025
- N = [...f, ...t];
1020
+ const h = V.filter(([, t]) => typeof t == "number" && t > 0), w = V.filter(([, t]) => t === 0 || t === null);
1021
+ V = [...h, ...w];
1026
1022
  }
1027
- const y = typeof p == "number" && N.length > p, B = y && !L ? N.slice(0, p) : N, pe = (f, t) => {
1028
- const o = se.includes(f), h = t === 0, C = R && (t ?? 0) > 0 ? ` (${t})` : "", q = R && (t ?? 0) > 0 ? t : "";
1023
+ const y = typeof m == "number" && V.length > m, B = y && !G ? V.slice(0, m) : V, ve = (h, w) => {
1024
+ const t = he.includes(h), a = w === 0, v = E && (w ?? 0) > 0 ? ` (${w})` : "", k = E && (w ?? 0) > 0 ? w : "";
1029
1025
  switch (n) {
1030
1026
  case "button":
1031
- return S === "list" ? /* @__PURE__ */ e.jsxs("div", { className: Re.count, children: [
1027
+ return j === "list" ? /* @__PURE__ */ e.jsxs("div", { className: ke.count, children: [
1032
1028
  /* @__PURE__ */ e.jsx(
1033
- be,
1029
+ Se,
1034
1030
  {
1035
- variant: o ? "primary" : "secondary",
1036
- onClick: () => w(r, f),
1037
- disabled: h,
1031
+ variant: t ? "primary" : "secondary",
1032
+ onClick: () => C(r, h),
1033
+ disabled: a,
1038
1034
  size: "micro",
1039
- children: f
1035
+ children: h
1040
1036
  }
1041
1037
  ),
1042
- /* @__PURE__ */ e.jsx("span", { children: q })
1038
+ /* @__PURE__ */ e.jsx("span", { children: k })
1043
1039
  ] }) : /* @__PURE__ */ e.jsx(
1044
- be,
1040
+ Se,
1045
1041
  {
1046
- variant: o ? "primary" : "secondary",
1047
- onClick: () => w(r, f),
1048
- disabled: h,
1042
+ variant: t ? "primary" : "secondary",
1043
+ onClick: () => C(r, h),
1044
+ disabled: a,
1049
1045
  size: "micro",
1050
- children: `${f}${C}`
1046
+ children: `${h}${v}`
1051
1047
  }
1052
1048
  );
1053
1049
  case "toggle":
1054
1050
  return /* @__PURE__ */ e.jsx(
1055
- ie,
1051
+ ae,
1056
1052
  {
1057
- label: f,
1058
- checked: o,
1059
- onChange: () => w(r, f),
1060
- disabled: h
1053
+ label: h,
1054
+ checked: t,
1055
+ onChange: () => C(r, h),
1056
+ disabled: a
1061
1057
  }
1062
1058
  );
1063
1059
  case "checkbox":
1064
1060
  default:
1065
- return S === "list" ? /* @__PURE__ */ e.jsxs("div", { className: Re.count, children: [
1061
+ return j === "list" ? /* @__PURE__ */ e.jsxs("div", { className: ke.count, children: [
1066
1062
  /* @__PURE__ */ e.jsx(
1067
1063
  et,
1068
1064
  {
1069
- label: f,
1065
+ label: h,
1070
1066
  score: "",
1071
- checked: o,
1072
- onChange: () => w(r, f),
1073
- disabled: h
1067
+ checked: t,
1068
+ onChange: () => C(r, h),
1069
+ disabled: a
1074
1070
  }
1075
1071
  ),
1076
- /* @__PURE__ */ e.jsx("span", { children: q })
1072
+ /* @__PURE__ */ e.jsx("span", { children: k })
1077
1073
  ] }) : /* @__PURE__ */ e.jsx(
1078
1074
  et,
1079
1075
  {
1080
- label: f,
1081
- score: C,
1082
- checked: o,
1083
- onChange: () => w(r, f),
1084
- disabled: h
1076
+ label: h,
1077
+ score: v,
1078
+ checked: t,
1079
+ onChange: () => C(r, h),
1080
+ disabled: a
1085
1081
  }
1086
1082
  );
1087
1083
  }
1088
- }, fe = F ? v : !1;
1084
+ }, fe = M ? p : !1;
1089
1085
  return /* @__PURE__ */ e.jsx(
1090
- xe,
1086
+ be,
1091
1087
  {
1092
- title: a,
1093
- collapsible: F,
1088
+ title: o,
1089
+ collapsible: M,
1094
1090
  collapsed: fe,
1095
1091
  children: /* @__PURE__ */ e.jsxs(
1096
1092
  "ul",
1097
1093
  {
1098
- className: S === "grid" ? Re.grid : Re.list,
1094
+ className: j === "grid" ? ke.grid : ke.list,
1099
1095
  style: { listStyle: "none", padding: 0, margin: 0 },
1100
1096
  children: [
1101
- B.map(([f, t]) => /* @__PURE__ */ e.jsx("li", { children: pe(f, t) }, f)),
1102
- y && /* @__PURE__ */ e.jsx("li", { className: Re.toggleItem, children: /* @__PURE__ */ e.jsx(
1103
- be,
1097
+ B.map(([h, w]) => /* @__PURE__ */ e.jsx("li", { children: ve(h, w) }, h)),
1098
+ y && /* @__PURE__ */ e.jsx("li", { className: ke.toggleItem, children: /* @__PURE__ */ e.jsx(
1099
+ Se,
1104
1100
  {
1105
1101
  variant: "ghost",
1106
1102
  size: "micro",
1107
- onClick: () => Se((f) => !f),
1108
- children: L ? "Show less" : `Show ${N.length - (p ?? 0)} more`
1103
+ onClick: () => de((h) => !h),
1104
+ children: G ? "Show less" : `Show ${V.length - (m ?? 0)} more`
1109
1105
  }
1110
1106
  ) })
1111
1107
  ]
@@ -1117,93 +1113,93 @@ const Xt = ({
1117
1113
  disabledMessage: Ot
1118
1114
  }, Zt = ({
1119
1115
  field: r,
1120
- label: a,
1121
- expectedMin: d = 0,
1116
+ label: o,
1117
+ expectedMin: u = 0,
1122
1118
  expectedMax: i = 1e3,
1123
1119
  displayType: c = "input",
1124
- collapsible: p = !0,
1125
- startCollapsed: F = !1
1120
+ collapsible: m = !0,
1121
+ startCollapsed: M = !1
1126
1122
  }) => {
1127
1123
  const {
1128
- state: { rangeFilters: v, rangeBounds: n, facetStats: S, query: I, facetDebounceDelayMillis: R },
1129
- setRangeFilter: D,
1130
- resetSingleFilter: j,
1131
- allowEmptySearch: K,
1132
- isFetchingInitial: W
1133
- } = Fe(), x = (n == null ? void 0 : n[r]) !== void 0, A = (n == null ? void 0 : n[r]) ?? { min: d, max: i }, g = A.min, s = A.max, w = (S == null ? void 0 : S[r]) ?? A, M = w.min, $ = w.max, m = x && g === s, L = m ? d : g, Se = m ? i : s, U = v == null ? void 0 : v[r], se = U ? U.min : g, _ = U ? U.max : s, ye = U !== void 0, N = M !== g || $ !== s, [y, B] = re.useState([
1134
- se,
1135
- _
1136
- ]), [pe, fe] = re.useState(!1), [f, t] = re.useState(!1), { finalMin: o, finalMax: h, isValidMin: C, isValidMax: q } = re.useMemo(() => {
1137
- const [T, O] = y, J = Math.max(g, Math.min(s, T)), Me = Math.max(g, Math.min(s, O)), Ne = Math.min(J, Me), Te = Math.max(J, Me), ze = Ne >= g && Ne < Te, He = Te <= s && Te > Ne;
1138
- return { finalMin: Ne, finalMax: Te, isValidMin: ze, isValidMax: He };
1139
- }, [y, g, s]);
1140
- re.useEffect(() => {
1141
- if (m)
1124
+ state: { rangeFilters: p, rangeBounds: n, facetStats: j, query: I, facetDebounceDelayMillis: E },
1125
+ setRangeFilter: q,
1126
+ resetSingleFilter: S,
1127
+ allowEmptySearch: Y,
1128
+ isFetchingInitial: D
1129
+ } = Ee(), x = (n == null ? void 0 : n[r]) !== void 0, A = (n == null ? void 0 : n[r]) ?? { min: u, max: i }, f = A.min, s = A.max, C = (j == null ? void 0 : j[r]) ?? A, N = C.min, W = C.max, g = x && f === s, G = g ? u : f, de = g ? i : s, z = p == null ? void 0 : p[r], he = z ? z.min : f, T = z ? z.max : s, pe = z !== void 0, V = N !== f || W !== s, [y, B] = te.useState([
1130
+ he,
1131
+ T
1132
+ ]), [ve, fe] = te.useState(!1), [h, w] = te.useState(!1), { finalMin: t, finalMax: a, isValidMin: v, isValidMax: k } = te.useMemo(() => {
1133
+ const [O, P] = y, X = Math.max(f, Math.min(s, O)), Me = Math.max(f, Math.min(s, P)), Ne = Math.min(X, Me), _e = Math.max(X, Me), ze = Ne >= f && Ne < _e, He = _e <= s && _e > Ne;
1134
+ return { finalMin: Ne, finalMax: _e, isValidMin: ze, isValidMax: He };
1135
+ }, [y, f, s]);
1136
+ te.useEffect(() => {
1137
+ if (g)
1142
1138
  return;
1143
- if (y[0] === g && y[1] === s) {
1144
- fe(!1), t(!1);
1139
+ if (y[0] === f && y[1] === s) {
1140
+ fe(!1), w(!1);
1145
1141
  return;
1146
1142
  }
1147
- const O = R ?? 500, J = setTimeout(() => {
1148
- fe(!C), t(!q);
1143
+ const P = E ?? 500, X = setTimeout(() => {
1144
+ fe(!v), w(!k);
1149
1145
  }, 300), Me = setTimeout(() => {
1150
- C && q && (o === g && h === s ? j(r) : D(r, o, h));
1151
- }, O);
1146
+ v && k && (t === f && a === s ? S(r) : q(r, t, a));
1147
+ }, P);
1152
1148
  return () => {
1153
- clearTimeout(J), clearTimeout(Me);
1149
+ clearTimeout(X), clearTimeout(Me);
1154
1150
  };
1155
- }, [o, h, C, q, g, s, r, j, D, R, m]), re.useEffect(() => {
1156
- B([se, _]), fe(!1), t(!1);
1157
- }, [se, _, r]);
1158
- const z = re.useCallback((T) => {
1159
- if (m) return;
1160
- const O = Math.max(g, Math.min($, T[0])), J = Math.max(M, Math.min(s, T[1]));
1161
- B([O, J]);
1162
- }, [m, g, s, M, $]), ve = re.useCallback((T) => {
1163
- if (m) return;
1164
- const O = Math.max(g, Math.min($, T[0])), J = Math.max(M, Math.min(s, T[1]));
1165
- O === g && J === s ? (B([g, s]), j(r)) : B([O, J]);
1166
- }, [m, g, s, M, $, r, j]), le = re.useCallback((T) => {
1167
- if (m) return;
1168
- const O = Number(T.target.value);
1169
- if (!isNaN(O)) {
1170
- const J = Math.max(g, Math.min($, O));
1171
- B([J, y[1]]);
1151
+ }, [t, a, v, k, f, s, r, S, q, E, g]), te.useEffect(() => {
1152
+ B([he, T]), fe(!1), w(!1);
1153
+ }, [he, T, r]);
1154
+ const ie = te.useCallback((O) => {
1155
+ if (g) return;
1156
+ const P = Math.max(f, Math.min(W, O[0])), X = Math.max(N, Math.min(s, O[1]));
1157
+ B([P, X]);
1158
+ }, [g, f, s, N, W]), xe = te.useCallback((O) => {
1159
+ if (g) return;
1160
+ const P = Math.max(f, Math.min(W, O[0])), X = Math.max(N, Math.min(s, O[1]));
1161
+ P === f && X === s ? (B([f, s]), S(r)) : B([P, X]);
1162
+ }, [g, f, s, N, W, r, S]), _ = te.useCallback((O) => {
1163
+ if (g) return;
1164
+ const P = Number(O.target.value);
1165
+ if (!isNaN(P)) {
1166
+ const X = Math.max(f, Math.min(W, P));
1167
+ B([X, y[1]]);
1172
1168
  }
1173
- }, [m, y, g, $]), V = re.useCallback((T) => {
1174
- if (m) return;
1175
- const O = Number(T.target.value);
1176
- if (!isNaN(O)) {
1177
- const J = Math.max(M, Math.min(s, O));
1178
- B([y[0], J]);
1169
+ }, [g, y, f, W]), re = te.useCallback((O) => {
1170
+ if (g) return;
1171
+ const P = Number(O.target.value);
1172
+ if (!isNaN(P)) {
1173
+ const X = Math.max(N, Math.min(s, P));
1174
+ B([y[0], X]);
1179
1175
  }
1180
- }, [m, y, M, s]), ce = re.useCallback(() => {
1181
- const T = y[0], O = Math.max(g, Math.min($, T));
1182
- O < y[1] ? B([O, y[1]]) : B([g, y[1]]);
1183
- }, [y, g, $]), je = re.useCallback(() => {
1184
- const T = y[1], O = Math.max(M, Math.min(s, T));
1185
- O > y[0] ? B([y[0], O]) : B([y[0], s]);
1186
- }, [y, M, s]);
1187
- return W || !K && !I ? null : c === "slider" ? /* @__PURE__ */ e.jsxs(xe, { title: a, collapsed: F, collapsible: p, children: [
1188
- m && /* @__PURE__ */ e.jsxs("div", { className: nt.disabledMessage, children: [
1176
+ }, [g, y, N, s]), ye = te.useCallback(() => {
1177
+ const O = y[0], P = Math.max(f, Math.min(W, O));
1178
+ P < y[1] ? B([P, y[1]]) : B([f, y[1]]);
1179
+ }, [y, f, W]), Fe = te.useCallback(() => {
1180
+ const O = y[1], P = Math.max(N, Math.min(s, O));
1181
+ P > y[0] ? B([y[0], P]) : B([y[0], s]);
1182
+ }, [y, N, s]);
1183
+ return D || !Y && !I ? null : c === "slider" ? /* @__PURE__ */ e.jsxs(be, { title: o, collapsed: M, collapsible: m, children: [
1184
+ g && /* @__PURE__ */ e.jsxs("div", { className: nt.disabledMessage, children: [
1189
1185
  "No adjustable range (all results have the same value: ",
1190
- g,
1186
+ f,
1191
1187
  ")."
1192
1188
  ] }),
1193
1189
  /* @__PURE__ */ e.jsx("div", { style: { padding: "10px 10px 20px 10px" }, children: /* @__PURE__ */ e.jsx(
1194
1190
  at,
1195
1191
  {
1196
- min: L,
1197
- max: Se,
1198
- value: m ? [L, Se] : [o, h],
1192
+ min: G,
1193
+ max: de,
1194
+ value: g ? [G, de] : [t, a],
1199
1195
  isRange: !0,
1200
- onChange: (T) => z(T),
1201
- onFinalChange: (T) => ve(T),
1202
- disabled: m,
1203
- activeMin: M,
1204
- activeMax: $,
1205
- isFaceted: N,
1206
- highlightFaceted: ye
1196
+ onChange: (O) => ie(O),
1197
+ onFinalChange: (O) => xe(O),
1198
+ disabled: g,
1199
+ activeMin: N,
1200
+ activeMax: W,
1201
+ isFaceted: V,
1202
+ highlightFaceted: pe
1207
1203
  }
1208
1204
  ) }),
1209
1205
  /* @__PURE__ */ e.jsxs(
@@ -1221,35 +1217,35 @@ const Xt = ({
1221
1217
  Z,
1222
1218
  {
1223
1219
  type: "number",
1224
- value: m ? g : y[0],
1225
- min: g,
1226
- max: Math.min($, y[1] - 1),
1227
- onChange: le,
1228
- onBlur: ce,
1229
- disabled: m,
1230
- isValid: m || !pe
1220
+ value: g ? f : y[0],
1221
+ min: f,
1222
+ max: Math.min(W, y[1] - 1),
1223
+ onChange: _,
1224
+ onBlur: ye,
1225
+ disabled: g,
1226
+ isValid: g || !ve
1231
1227
  }
1232
1228
  ),
1233
1229
  /* @__PURE__ */ e.jsx(
1234
1230
  Z,
1235
1231
  {
1236
1232
  type: "number",
1237
- value: m ? s : y[1],
1238
- min: Math.max(M, y[0] + 1),
1233
+ value: g ? s : y[1],
1234
+ min: Math.max(N, y[0] + 1),
1239
1235
  max: s,
1240
- onChange: V,
1241
- onBlur: je,
1242
- disabled: m,
1243
- isValid: m || !f
1236
+ onChange: re,
1237
+ onBlur: Fe,
1238
+ disabled: g,
1239
+ isValid: g || !h
1244
1240
  }
1245
1241
  )
1246
1242
  ]
1247
1243
  }
1248
1244
  )
1249
- ] }) : /* @__PURE__ */ e.jsxs(xe, { title: a, children: [
1250
- m && /* @__PURE__ */ e.jsxs("div", { className: nt.disabledMessage, children: [
1245
+ ] }) : /* @__PURE__ */ e.jsxs(be, { title: o, children: [
1246
+ g && /* @__PURE__ */ e.jsxs("div", { className: nt.disabledMessage, children: [
1251
1247
  "No adjustable range (all results have the same value: ",
1252
- g,
1248
+ f,
1253
1249
  ")."
1254
1250
  ] }),
1255
1251
  /* @__PURE__ */ e.jsxs("div", { style: { display: "flex", gap: "10px", alignItems: "flex-start" }, children: [
@@ -1258,13 +1254,13 @@ const Xt = ({
1258
1254
  {
1259
1255
  label: "Min:",
1260
1256
  type: "number",
1261
- value: m ? g : y[0],
1262
- min: g,
1263
- max: Math.min($, y[1] - 1),
1264
- onChange: le,
1265
- onBlur: ce,
1266
- disabled: m,
1267
- isValid: m || !pe
1257
+ value: g ? f : y[0],
1258
+ min: f,
1259
+ max: Math.min(W, y[1] - 1),
1260
+ onChange: _,
1261
+ onBlur: ye,
1262
+ disabled: g,
1263
+ isValid: g || !ve
1268
1264
  }
1269
1265
  ),
1270
1266
  /* @__PURE__ */ e.jsx(
@@ -1272,34 +1268,34 @@ const Xt = ({
1272
1268
  {
1273
1269
  label: "Max:",
1274
1270
  type: "number",
1275
- value: m ? s : y[1],
1276
- min: Math.max(M, y[0] + 1),
1271
+ value: g ? s : y[1],
1272
+ min: Math.max(N, y[0] + 1),
1277
1273
  max: s,
1278
- onChange: V,
1279
- onBlur: je,
1280
- disabled: m,
1281
- isValid: m || !f
1274
+ onChange: re,
1275
+ onBlur: Fe,
1276
+ disabled: g,
1277
+ isValid: g || !h
1282
1278
  }
1283
1279
  )
1284
1280
  ] })
1285
1281
  ] });
1286
1282
  }, Pt = "_grid_nvpmn_2", Ht = {
1287
1283
  grid: Pt
1288
- }, It = ot(({ field: r, value: a, onReset: d }) => /* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsxs(
1289
- be,
1284
+ }, $t = ot(({ field: r, value: o, onReset: u }) => /* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsxs(
1285
+ Se,
1290
1286
  {
1291
- onClick: d,
1287
+ onClick: u,
1292
1288
  iconRight: /* @__PURE__ */ e.jsx(lt, {}),
1293
1289
  variant: "primary",
1294
1290
  size: "micro",
1295
1291
  children: [
1296
1292
  r,
1297
1293
  ": ",
1298
- a
1294
+ o
1299
1295
  ]
1300
1296
  }
1301
- ) })), $t = ot(({ field: r, min: a, max: d, onReset: i }) => /* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsxs(
1302
- be,
1297
+ ) })), It = ot(({ field: r, min: o, max: u, onReset: i }) => /* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsxs(
1298
+ Se,
1303
1299
  {
1304
1300
  onClick: i,
1305
1301
  iconRight: /* @__PURE__ */ e.jsx(lt, {}),
@@ -1308,53 +1304,53 @@ const Xt = ({
1308
1304
  children: [
1309
1305
  r,
1310
1306
  ": ",
1311
- a,
1307
+ o,
1312
1308
  " – ",
1313
- d
1309
+ u
1314
1310
  ]
1315
1311
  }
1316
1312
  ) }));
1317
1313
  function Kt() {
1318
1314
  const {
1319
- state: { filters: r, rangeFilters: a },
1320
- resetFilters: d,
1315
+ state: { filters: r, rangeFilters: o },
1316
+ resetFilters: u,
1321
1317
  resetSingleFilter: i
1322
- } = Fe(), c = Be(
1318
+ } = Ee(), c = Be(
1323
1319
  () => Object.entries(r).map(
1324
- ([v, n]) => n.map((S) => ({ field: v, value: S }))
1320
+ ([p, n]) => n.map((j) => ({ field: p, value: j }))
1325
1321
  ).flat(),
1326
1322
  [r]
1327
- ), p = Be(
1328
- () => Object.entries(a).map(([v, { min: n, max: S }]) => ({ field: v, min: n, max: S })),
1329
- [a]
1323
+ ), m = Be(
1324
+ () => Object.entries(o).map(([p, { min: n, max: j }]) => ({ field: p, min: n, max: j })),
1325
+ [o]
1330
1326
  );
1331
1327
  return Be(
1332
- () => Object.keys(r).length > 0 || Object.keys(a).length > 0,
1333
- [r, a]
1334
- ) ? /* @__PURE__ */ e.jsx(xe, { collapsible: !1, title: "Active filters", children: /* @__PURE__ */ e.jsxs("ul", { className: Ht.grid, children: [
1335
- c.map(({ field: v, value: n }) => /* @__PURE__ */ e.jsx(
1336
- It,
1328
+ () => Object.keys(r).length > 0 || Object.keys(o).length > 0,
1329
+ [r, o]
1330
+ ) ? /* @__PURE__ */ e.jsx(be, { collapsible: !1, title: "Active filters", children: /* @__PURE__ */ e.jsxs("ul", { className: Ht.grid, children: [
1331
+ c.map(({ field: p, value: n }) => /* @__PURE__ */ e.jsx(
1332
+ $t,
1337
1333
  {
1338
- field: v,
1334
+ field: p,
1339
1335
  value: n,
1340
- onReset: () => i(v, n)
1336
+ onReset: () => i(p, n)
1341
1337
  },
1342
- `${v}-${n}`
1338
+ `${p}-${n}`
1343
1339
  )),
1344
- p.map(({ field: v, min: n, max: S }) => /* @__PURE__ */ e.jsx(
1345
- $t,
1340
+ m.map(({ field: p, min: n, max: j }) => /* @__PURE__ */ e.jsx(
1341
+ It,
1346
1342
  {
1347
- field: v,
1343
+ field: p,
1348
1344
  min: n,
1349
- max: S,
1350
- onReset: () => i(v)
1345
+ max: j,
1346
+ onReset: () => i(p)
1351
1347
  },
1352
- v
1348
+ p
1353
1349
  )),
1354
1350
  /* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(
1355
- be,
1351
+ Se,
1356
1352
  {
1357
- onClick: d,
1353
+ onClick: u,
1358
1354
  size: "micro",
1359
1355
  variant: "ghost",
1360
1356
  children: "Reset"
@@ -1362,89 +1358,89 @@ function Kt() {
1362
1358
  ) })
1363
1359
  ] }) }) : null;
1364
1360
  }
1365
- const Wt = "_radioGroup_nwf7i_6", qt = {
1361
+ const Wt = "_radioGroup_nwf7i_6", Dt = {
1366
1362
  radioGroup: Wt
1367
- }, er = ({ displayType: r = "dropdown", collapsible: a = !0, startCollapsed: d = !1 }) => {
1363
+ }, er = ({ displayType: r = "dropdown", collapsible: o = !0, startCollapsed: u = !1 }) => {
1368
1364
  const {
1369
- state: { sortableFields: i, sortBy: c, sortAscending: p },
1370
- setSort: F
1371
- } = Fe();
1365
+ state: { sortableFields: i, sortBy: c, sortAscending: m },
1366
+ setSort: M
1367
+ } = Ee();
1372
1368
  if (!i || i.length === 0) return null;
1373
- const v = c ? `${c}:${p ? "asc" : "desc"}` : "none", n = [
1369
+ const p = c ? `${c}:${m ? "asc" : "desc"}` : "none", n = [
1374
1370
  { label: "None", value: "none" },
1375
- ...i.flatMap((R) => [
1376
- { label: `${R} (asc)`, value: `${R}:asc` },
1377
- { label: `${R} (desc)`, value: `${R}:desc` }
1371
+ ...i.flatMap((E) => [
1372
+ { label: `${E} (asc)`, value: `${E}:asc` },
1373
+ { label: `${E} (desc)`, value: `${E}:desc` }
1378
1374
  ])
1379
- ], S = (R) => {
1380
- if (R === "none" || R === "")
1381
- F(null, !0);
1375
+ ], j = (E) => {
1376
+ if (E === "none" || E === "")
1377
+ M(null, !0);
1382
1378
  else {
1383
- const [D, j] = R.split(":");
1384
- F(D, j === "asc");
1379
+ const [q, S] = E.split(":");
1380
+ M(q, S === "asc");
1385
1381
  }
1386
- }, I = a ? d : !1;
1382
+ }, I = o ? u : !1;
1387
1383
  return /* @__PURE__ */ e.jsx(
1388
- xe,
1384
+ be,
1389
1385
  {
1390
1386
  title: "Sort by",
1391
- collapsible: a,
1387
+ collapsible: o,
1392
1388
  collapsed: I,
1393
1389
  children: r === "dropdown" ? /* @__PURE__ */ e.jsx(
1394
1390
  xt,
1395
1391
  {
1396
- value: v,
1397
- onValueChange: S,
1392
+ value: p,
1393
+ onValueChange: j,
1398
1394
  options: n,
1399
1395
  placeholder: "Select sort..."
1400
1396
  }
1401
- ) : /* @__PURE__ */ e.jsx("div", { className: qt.radioGroup, children: n.map((R) => /* @__PURE__ */ e.jsx(
1397
+ ) : /* @__PURE__ */ e.jsx("div", { className: Dt.radioGroup, children: n.map((E) => /* @__PURE__ */ e.jsx(
1402
1398
  bt,
1403
1399
  {
1404
- id: `sort-${R.value}`,
1400
+ id: `sort-${E.value}`,
1405
1401
  name: "sort-by",
1406
- value: R.value,
1407
- label: R.label,
1408
- checked: v === R.value,
1409
- onChange: (D) => S(D.target.value)
1402
+ value: E.value,
1403
+ label: E.label,
1404
+ checked: p === E.value,
1405
+ onChange: (q) => j(q.target.value)
1410
1406
  },
1411
- R.value
1407
+ E.value
1412
1408
  )) })
1413
1409
  }
1414
1410
  );
1415
- }, Dt = "_list_1y4fk_1", Bt = {
1416
- list: Dt
1411
+ }, qt = "_list_1y4fk_1", Bt = {
1412
+ list: qt
1417
1413
  };
1418
1414
  function tr() {
1419
1415
  const {
1420
1416
  state: { searchSettings: r },
1421
- setSearchSettings: a
1422
- } = Fe(), [d, i] = X(!1), c = (n, S) => {
1423
- const I = parseInt(S, 10);
1424
- isNaN(I) || a({
1417
+ setSearchSettings: o
1418
+ } = Ee(), [u, i] = U(!1), c = (n, j) => {
1419
+ const I = parseInt(j, 10);
1420
+ isNaN(I) || o({
1425
1421
  [n]: I
1426
1422
  });
1427
- }, p = (n, S) => {
1428
- a({
1429
- [n]: S
1423
+ }, m = (n, j) => {
1424
+ o({
1425
+ [n]: j
1430
1426
  });
1431
- }, F = (n, S) => {
1432
- const I = parseInt(S, 10);
1433
- isNaN(I) || a({
1427
+ }, M = (n, j) => {
1428
+ const I = parseInt(j, 10);
1429
+ isNaN(I) || o({
1434
1430
  coverageSetup: {
1435
1431
  ...r.coverageSetup,
1436
1432
  [n]: I
1437
1433
  }
1438
1434
  });
1439
- }, v = (n, S) => {
1440
- a({
1435
+ }, p = (n, j) => {
1436
+ o({
1441
1437
  coverageSetup: {
1442
1438
  ...r.coverageSetup,
1443
- [n]: S
1439
+ [n]: j
1444
1440
  }
1445
1441
  });
1446
1442
  };
1447
- return /* @__PURE__ */ e.jsx(xe, { collapsed: !0, title: "Settings", children: /* @__PURE__ */ e.jsxs("ul", { className: Bt.list, children: [
1443
+ return /* @__PURE__ */ e.jsx(be, { collapsed: !0, title: "Settings", children: /* @__PURE__ */ e.jsxs("ul", { className: Bt.list, children: [
1448
1444
  /* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(
1449
1445
  Z,
1450
1446
  {
@@ -1471,8 +1467,8 @@ function tr() {
1471
1467
  type: "number",
1472
1468
  value: r.minimumScore.toString(),
1473
1469
  onChange: (n) => {
1474
- const S = parseFloat(n.target.value);
1475
- isNaN(S) || a({ minimumScore: S });
1470
+ const j = parseFloat(n.target.value);
1471
+ isNaN(j) || o({ minimumScore: j });
1476
1472
  }
1477
1473
  }
1478
1474
  ),
@@ -1484,7 +1480,7 @@ function tr() {
1484
1480
  step: 1,
1485
1481
  value: r.minimumScore,
1486
1482
  onChange: (n) => {
1487
- a({ minimumScore: n });
1483
+ o({ minimumScore: n });
1488
1484
  }
1489
1485
  }
1490
1486
  ) })
@@ -1496,82 +1492,82 @@ function tr() {
1496
1492
  type: "text",
1497
1493
  value: r.placeholderText,
1498
1494
  onChange: (n) => {
1499
- a({ placeholderText: n.target.value });
1495
+ o({ placeholderText: n.target.value });
1500
1496
  }
1501
1497
  }
1502
1498
  ) }),
1503
1499
  /* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(
1504
- ie,
1500
+ ae,
1505
1501
  {
1506
1502
  label: "Show score",
1507
1503
  checked: r.showScore,
1508
- onChange: (n) => p("showScore", n)
1504
+ onChange: (n) => m("showScore", n)
1509
1505
  }
1510
1506
  ) }),
1511
1507
  /* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(
1512
- ie,
1508
+ ae,
1513
1509
  {
1514
1510
  label: "Enable Coverage",
1515
1511
  checked: r.enableCoverage,
1516
- onChange: (n) => p("enableCoverage", n)
1512
+ onChange: (n) => m("enableCoverage", n)
1517
1513
  }
1518
1514
  ) }),
1519
1515
  /* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(
1520
- ie,
1516
+ ae,
1521
1517
  {
1522
1518
  label: "Remove Duplicates",
1523
1519
  checked: r.removeDuplicates,
1524
- onChange: (n) => p("removeDuplicates", n)
1520
+ onChange: (n) => m("removeDuplicates", n)
1525
1521
  }
1526
1522
  ) }),
1527
- /* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(be, { variant: "ghost", size: "micro", iconRight: d ? /* @__PURE__ */ e.jsx(Mt, {}) : /* @__PURE__ */ e.jsx(Nt, {}), onClick: () => i((n) => !n), children: d ? "Hide Coverage Setup" : "Show Coverage Setup" }) }),
1528
- d && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1523
+ /* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(Se, { variant: "ghost", size: "micro", iconRight: u ? /* @__PURE__ */ e.jsx(Mt, {}) : /* @__PURE__ */ e.jsx(Nt, {}), onClick: () => i((n) => !n), children: u ? "Hide Coverage Setup" : "Show Coverage Setup" }) }),
1524
+ u && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1529
1525
  /* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(
1530
- ie,
1526
+ ae,
1531
1527
  {
1532
1528
  label: "Cover Whole Query",
1533
1529
  checked: r.coverageSetup.coverWholeQuery,
1534
- onChange: (n) => v("coverWholeQuery", n)
1530
+ onChange: (n) => p("coverWholeQuery", n)
1535
1531
  }
1536
1532
  ) }),
1537
1533
  /* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(
1538
- ie,
1534
+ ae,
1539
1535
  {
1540
1536
  label: "Cover Whole Words",
1541
1537
  checked: r.coverageSetup.coverWholeWords,
1542
- onChange: (n) => v("coverWholeWords", n)
1538
+ onChange: (n) => p("coverWholeWords", n)
1543
1539
  }
1544
1540
  ) }),
1545
1541
  /* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(
1546
- ie,
1542
+ ae,
1547
1543
  {
1548
1544
  label: "Cover Fuzzy Words",
1549
1545
  checked: r.coverageSetup.coverFuzzyWords,
1550
- onChange: (n) => v("coverFuzzyWords", n)
1546
+ onChange: (n) => p("coverFuzzyWords", n)
1551
1547
  }
1552
1548
  ) }),
1553
1549
  /* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(
1554
- ie,
1550
+ ae,
1555
1551
  {
1556
1552
  label: "Cover Joined Words",
1557
1553
  checked: r.coverageSetup.coverJoinedWords,
1558
- onChange: (n) => v("coverJoinedWords", n)
1554
+ onChange: (n) => p("coverJoinedWords", n)
1559
1555
  }
1560
1556
  ) }),
1561
1557
  /* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(
1562
- ie,
1558
+ ae,
1563
1559
  {
1564
1560
  label: "Cover Prefix Suffix",
1565
1561
  checked: r.coverageSetup.coverPrefixSuffix,
1566
- onChange: (n) => v("coverPrefixSuffix", n)
1562
+ onChange: (n) => p("coverPrefixSuffix", n)
1567
1563
  }
1568
1564
  ) }),
1569
1565
  /* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(
1570
- ie,
1566
+ ae,
1571
1567
  {
1572
1568
  label: "Truncate list",
1573
1569
  checked: r.coverageSetup.truncate,
1574
- onChange: (n) => v("truncate", n)
1570
+ onChange: (n) => p("truncate", n)
1575
1571
  }
1576
1572
  ) }),
1577
1573
  /* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(
@@ -1580,7 +1576,7 @@ function tr() {
1580
1576
  label: "Levenshtein Max Word Size",
1581
1577
  type: "number",
1582
1578
  value: r.coverageSetup.levenshteinMaxWordSize.toString(),
1583
- onChange: (n) => F("levenshteinMaxWordSize", n.target.value)
1579
+ onChange: (n) => M("levenshteinMaxWordSize", n.target.value)
1584
1580
  }
1585
1581
  ) }),
1586
1582
  /* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(
@@ -1589,7 +1585,7 @@ function tr() {
1589
1585
  label: "Min Word Size",
1590
1586
  type: "number",
1591
1587
  value: r.coverageSetup.minWordSize.toString(),
1592
- onChange: (n) => F("minWordSize", n.target.value)
1588
+ onChange: (n) => M("minWordSize", n.target.value)
1593
1589
  }
1594
1590
  ) }),
1595
1591
  /* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(
@@ -1598,7 +1594,7 @@ function tr() {
1598
1594
  label: "Coverage Min Word Hits Abs",
1599
1595
  type: "number",
1600
1596
  value: r.coverageSetup.coverageMinWordHitsAbs.toString(),
1601
- onChange: (n) => F("coverageMinWordHitsAbs", n.target.value)
1597
+ onChange: (n) => M("coverageMinWordHitsAbs", n.target.value)
1602
1598
  }
1603
1599
  ) }),
1604
1600
  /* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(
@@ -1607,7 +1603,7 @@ function tr() {
1607
1603
  label: "Coverage Min Word Hits Relative",
1608
1604
  type: "number",
1609
1605
  value: r.coverageSetup.coverageMinWordHitsRelative.toString(),
1610
- onChange: (n) => F("coverageMinWordHitsRelative", n.target.value)
1606
+ onChange: (n) => M("coverageMinWordHitsRelative", n.target.value)
1611
1607
  }
1612
1608
  ) }),
1613
1609
  /* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(
@@ -1616,7 +1612,7 @@ function tr() {
1616
1612
  label: "Coverage Q Limit For Error Tolerance",
1617
1613
  type: "number",
1618
1614
  value: r.coverageSetup.coverageQLimitForErrorTolerance.toString(),
1619
- onChange: (n) => F("coverageQLimitForErrorTolerance", n.target.value)
1615
+ onChange: (n) => M("coverageQLimitForErrorTolerance", n.target.value)
1620
1616
  }
1621
1617
  ) }),
1622
1618
  /* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsx(
@@ -1625,25 +1621,25 @@ function tr() {
1625
1621
  label: "Coverage LCS Error Tolerance Relative Q",
1626
1622
  type: "number",
1627
1623
  value: r.coverageSetup.coverageLcsErrorToleranceRelativeq.toString(),
1628
- onChange: (n) => F("coverageLcsErrorToleranceRelativeq", n.target.value)
1624
+ onChange: (n) => M("coverageLcsErrorToleranceRelativeq", n.target.value)
1629
1625
  }
1630
1626
  ) })
1631
1627
  ] })
1632
1628
  ] }) });
1633
1629
  }
1634
1630
  class rr extends pt {
1635
- constructor(d) {
1636
- super(d);
1631
+ constructor(u) {
1632
+ super(u);
1637
1633
  Ke(this, "reset", () => {
1638
1634
  this.setState({ hasError: !1, error: null });
1639
1635
  });
1640
1636
  this.state = { hasError: !1, error: null };
1641
1637
  }
1642
- static getDerivedStateFromError(d) {
1643
- return { hasError: !0, error: d };
1638
+ static getDerivedStateFromError(u) {
1639
+ return { hasError: !0, error: u };
1644
1640
  }
1645
- componentDidCatch(d, i) {
1646
- console.error("[SearchErrorBoundary] Caught error:", d, i);
1641
+ componentDidCatch(u, i) {
1642
+ console.error("[SearchErrorBoundary] Caught error:", u, i);
1647
1643
  }
1648
1644
  render() {
1649
1645
  return this.state.hasError && this.state.error ? this.props.fallback ? this.props.fallback(this.state.error, this.reset) : /* @__PURE__ */ e.jsxs("div", { style: {
@@ -1705,6 +1701,6 @@ export {
1705
1701
  tr as SearchSettingsPanel,
1706
1702
  er as SortByPanel,
1707
1703
  Yt as ValueFilterPanel,
1708
- Fe as useSearch,
1709
- Fe as useSearchContext
1704
+ Ee as useSearch,
1705
+ Ee as useSearchContext
1710
1706
  };