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