@indxsearch/intrface 1.0.0 → 1.0.2

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