@indxsearch/intrface 3.9.1 → 3.11.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/CHANGELOG.md +19 -0
- package/README.md +20 -0
- package/dist/components/SortByPanel.d.ts +14 -0
- package/dist/context/SearchContext.d.ts +4 -3
- package/dist/context/useSearchExecution.d.ts +3 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +612 -571
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -162,7 +162,7 @@ async function A(e, t, n, r, i, a) {
|
|
|
162
162
|
}, "CombineFilters", n, r, i, a);
|
|
163
163
|
return o;
|
|
164
164
|
}
|
|
165
|
-
async function
|
|
165
|
+
async function j(e, t, n, r, i, a, o = {}, s = {}, c = {}) {
|
|
166
166
|
let l = Object.entries(e ?? {}).filter(([, e]) => e.length > 0), u = Object.entries(t ?? {}), d = Object.entries(s ?? {}).filter(([, e]) => e.length > 0), f = (e, { min: t, max: o }) => k("range", {
|
|
167
167
|
fieldName: e,
|
|
168
168
|
lowerLimit: t,
|
|
@@ -189,14 +189,14 @@ async function ee(e, t, n, r, i, a, o = {}, s = {}, c = {}) {
|
|
|
189
189
|
}
|
|
190
190
|
//#endregion
|
|
191
191
|
//#region src/context/useSearchExecution.ts
|
|
192
|
-
function
|
|
192
|
+
function M(e, t) {
|
|
193
193
|
let n, r = (...r) => {
|
|
194
194
|
clearTimeout(n), n = setTimeout(() => e(...r), t);
|
|
195
195
|
};
|
|
196
196
|
return r.cancel = () => clearTimeout(n), r;
|
|
197
197
|
}
|
|
198
|
-
function
|
|
199
|
-
let
|
|
198
|
+
function N({ state: e, setState: t, authenticatedFetch: n, auth: r, url: a, team: s, dataset: u, allowEmptySearch: d, facetsEnabled: f, enableDebugLogs: p, shouldFetchMore: m, sessionId: h, source: g, count: _ }) {
|
|
199
|
+
let v = c(0), y = c(void 0), b = c(!1), [x, S] = l({}), [C, w] = l(""), [T, E] = l("");
|
|
200
200
|
o(() => {
|
|
201
201
|
r.isFetchingInitial || t((e) => ({
|
|
202
202
|
...e,
|
|
@@ -218,9 +218,9 @@ function M({ state: e, setState: t, authenticatedFetch: n, auth: r, url: a, team
|
|
|
218
218
|
r.sortableFields,
|
|
219
219
|
t
|
|
220
220
|
]);
|
|
221
|
-
let
|
|
221
|
+
let D = e.searchSettings.maxNumberOfRecordsToReturn, k = e.searchSettings.enableCoverage, A = e.searchSettings.removeDuplicates, N = e.searchSettings.coverageDepth, P = e.searchSettings.minimumScore, F = e.searchSettings.coverageSetup, I = e.sortBy, L = e.sortAscending, R = i(async ({ enableFacets: i }) => {
|
|
222
222
|
if (!r.token) return;
|
|
223
|
-
let o = ++
|
|
223
|
+
let o = ++v.current;
|
|
224
224
|
if (t((e) => ({
|
|
225
225
|
...e,
|
|
226
226
|
isLoading: !0
|
|
@@ -229,118 +229,120 @@ function M({ state: e, setState: t, authenticatedFetch: n, auth: r, url: a, team
|
|
|
229
229
|
i = !0;
|
|
230
230
|
}
|
|
231
231
|
try {
|
|
232
|
-
let c = i ? Array.from(new Set([...Object.keys(e.filters).filter((t) => e.valueMatch[t] === "any" && (e.filters[t]?.length ?? 0) > 0), ...Object.keys(e.bucketFilters).filter((t) => (e.bucketFilters[t]?.length ?? 0) > 0)])) : [], [l, ...f] = await Promise.all([
|
|
232
|
+
let c = i ? Array.from(new Set([...Object.keys(e.filters).filter((t) => e.valueMatch[t] === "any" && (e.filters[t]?.length ?? 0) > 0), ...Object.keys(e.bucketFilters).filter((t) => (e.bucketFilters[t]?.length ?? 0) > 0)])) : [], [l, ...f] = await Promise.all([j(e.filters, e.rangeFilters, a, s, u, n, e.valueMatch, e.bucketFilters, e.fieldTypes), ...c.map((t) => j({
|
|
233
233
|
...e.filters,
|
|
234
234
|
[t]: []
|
|
235
235
|
}, e.rangeFilters, a, s, u, n, e.valueMatch, {
|
|
236
236
|
...e.bucketFilters,
|
|
237
237
|
[t]: []
|
|
238
|
-
}, e.fieldTypes))]), m = d || e.query.trim() !== "",
|
|
238
|
+
}, e.fieldTypes))]), m = d || e.query.trim() !== "", y = {
|
|
239
239
|
text: e.query,
|
|
240
|
-
enableCoverage:
|
|
241
|
-
removeDuplicates:
|
|
242
|
-
coverageDepth:
|
|
243
|
-
coverageSetup:
|
|
244
|
-
},
|
|
245
|
-
...
|
|
246
|
-
maxNumberOfRecordsToReturn: m ?
|
|
240
|
+
enableCoverage: k,
|
|
241
|
+
removeDuplicates: A,
|
|
242
|
+
coverageDepth: N,
|
|
243
|
+
coverageSetup: F
|
|
244
|
+
}, b = {
|
|
245
|
+
...y,
|
|
246
|
+
maxNumberOfRecordsToReturn: m ? D : 0,
|
|
247
247
|
enableFacets: i,
|
|
248
248
|
...l ? { filter: l } : {},
|
|
249
|
-
...
|
|
250
|
-
...
|
|
249
|
+
...I ? { sortBy: I } : {},
|
|
250
|
+
...L === void 0 ? {} : { sortAscending: L }
|
|
251
251
|
};
|
|
252
|
-
p && console.log("[performSearch] request body:", JSON.stringify(
|
|
253
|
-
let
|
|
252
|
+
p && console.log("[performSearch] request body:", JSON.stringify(b, null, 2));
|
|
253
|
+
let M = new URLSearchParams({ session: h });
|
|
254
|
+
g && M.set("source", g), _ || M.set("count", "false");
|
|
255
|
+
let R = (e) => n(`${a}/api/teams/${s}/datasets/${u}/search?${M}`, {
|
|
254
256
|
method: "POST",
|
|
255
257
|
headers: { "Content-Type": "application/json" },
|
|
256
258
|
body: JSON.stringify(e)
|
|
257
|
-
}), [
|
|
258
|
-
...
|
|
259
|
+
}), [z, ...B] = await Promise.all([R(b), ...f.map((e) => R({
|
|
260
|
+
...y,
|
|
259
261
|
maxNumberOfRecordsToReturn: 0,
|
|
260
262
|
enableFacets: !0,
|
|
261
263
|
...e ? { filter: e } : {}
|
|
262
264
|
}))]);
|
|
263
|
-
if (!
|
|
264
|
-
let
|
|
265
|
+
if (!z.ok) throw await O.fromResponse("Search", z);
|
|
266
|
+
let V = await z.json(), H = z.headers.get("Indx-Query-Id") ?? void 0, U = V.truncationIndex ?? -1, W = {};
|
|
265
267
|
for (let e = 0; e < c.length; e++) {
|
|
266
268
|
let t = c[e];
|
|
267
|
-
if (!
|
|
268
|
-
let n = await
|
|
269
|
-
n.facets?.[t] !== void 0 && (
|
|
269
|
+
if (!B[e].ok) throw await O.fromResponse(`Facets for '${t}'`, B[e]);
|
|
270
|
+
let n = await B[e].json();
|
|
271
|
+
n.facets?.[t] !== void 0 && (W[t] = n.facets[t]);
|
|
270
272
|
}
|
|
271
|
-
let
|
|
272
|
-
if (m &&
|
|
273
|
+
let ee = V.records || [], G = ee.map((e) => e.documentKey), te = ee.map((e) => e.score), K = [];
|
|
274
|
+
if (m && G.length > 0) {
|
|
273
275
|
let e = await n(`${a}/api/teams/${s}/datasets/${u}/documents/lookup`, {
|
|
274
276
|
method: "POST",
|
|
275
277
|
headers: { "Content-Type": "application/json" },
|
|
276
|
-
body: JSON.stringify(
|
|
278
|
+
body: JSON.stringify(G)
|
|
277
279
|
});
|
|
278
280
|
if (!e.ok) throw await O.fromResponse("Document lookup", e);
|
|
279
|
-
|
|
281
|
+
K = (await e.json()).map((e, t) => ({
|
|
280
282
|
document: e,
|
|
281
|
-
documentKey:
|
|
282
|
-
score:
|
|
283
|
+
documentKey: G[t],
|
|
284
|
+
score: te[t]
|
|
283
285
|
}));
|
|
284
286
|
}
|
|
285
|
-
let
|
|
286
|
-
if (i &&
|
|
287
|
-
for (let [e, t] of Object.entries(
|
|
287
|
+
let q = {};
|
|
288
|
+
if (i && V.facets) {
|
|
289
|
+
for (let [e, t] of Object.entries(V.facets)) if (Array.isArray(t) && t.length > 0) {
|
|
288
290
|
let n = t.map((e) => Number(e.key)).filter((e) => !isNaN(e));
|
|
289
|
-
n.length > 0 && (
|
|
291
|
+
n.length > 0 && (q[e] = {
|
|
290
292
|
min: Math.min(...n),
|
|
291
293
|
max: Math.max(...n)
|
|
292
294
|
});
|
|
293
295
|
}
|
|
294
296
|
}
|
|
295
|
-
if (o !==
|
|
296
|
-
let
|
|
297
|
-
if (
|
|
297
|
+
if (o !== v.current) return;
|
|
298
|
+
let ne = e.query !== C, re = e.query !== T, ie = e.facetStats ?? {};
|
|
299
|
+
if (ne ? (ie = {
|
|
298
300
|
...r.initialFacetStats,
|
|
299
|
-
...
|
|
300
|
-
},
|
|
301
|
-
...
|
|
302
|
-
...
|
|
303
|
-
},
|
|
301
|
+
...q
|
|
302
|
+
}, S(ie), w(e.query)) : ie = {
|
|
303
|
+
...x,
|
|
304
|
+
...q
|
|
305
|
+
}, re && i) {
|
|
304
306
|
let n = { ...e.rangeBounds };
|
|
305
|
-
for (let [e, t] of Object.entries(
|
|
307
|
+
for (let [e, t] of Object.entries(q)) n[e] = t;
|
|
306
308
|
t((e) => ({
|
|
307
309
|
...e,
|
|
308
310
|
rangeBounds: n
|
|
309
|
-
})),
|
|
311
|
+
})), E(e.query);
|
|
310
312
|
}
|
|
311
|
-
let
|
|
312
|
-
...
|
|
313
|
-
...
|
|
314
|
-
} :
|
|
315
|
-
if (i && (!
|
|
316
|
-
|
|
317
|
-
for (let [e, t] of Object.entries(r.initialFacetKeys))
|
|
313
|
+
let J = Object.keys(W).length > 0 ? {
|
|
314
|
+
...V.facets ?? {},
|
|
315
|
+
...W
|
|
316
|
+
} : V.facets;
|
|
317
|
+
if (i && (!J || Object.keys(J).length === 0)) {
|
|
318
|
+
J = {};
|
|
319
|
+
for (let [e, t] of Object.entries(r.initialFacetKeys)) J[e] = t.map((e) => ({
|
|
318
320
|
key: e,
|
|
319
321
|
value: null
|
|
320
322
|
}));
|
|
321
323
|
}
|
|
322
|
-
let
|
|
324
|
+
let Y = K.filter((t) => {
|
|
323
325
|
let n = e.query.trim();
|
|
324
|
-
return n === "" || n.length === 1 ? !0 : t.score >=
|
|
326
|
+
return n === "" || n.length === 1 ? !0 : t.score >= P;
|
|
325
327
|
}).map((e, t) => ({
|
|
326
328
|
...e,
|
|
327
329
|
position: t + 1
|
|
328
330
|
}));
|
|
329
331
|
t((e) => ({
|
|
330
332
|
...e,
|
|
331
|
-
results:
|
|
333
|
+
results: Y,
|
|
332
334
|
error: void 0,
|
|
333
335
|
resultsSuppressed: !m,
|
|
334
336
|
...i ? {
|
|
335
|
-
facets:
|
|
336
|
-
facetStats:
|
|
337
|
+
facets: J,
|
|
338
|
+
facetStats: ie
|
|
337
339
|
} : {},
|
|
338
340
|
isLoading: !1,
|
|
339
|
-
truncationIndex:
|
|
340
|
-
queryId:
|
|
341
|
+
truncationIndex: U,
|
|
342
|
+
queryId: H
|
|
341
343
|
}));
|
|
342
344
|
} catch (e) {
|
|
343
|
-
if (console.error("[Search] ❌ Search failed:", e), e instanceof TypeError && e.message.includes("fetch") ? (console.error("[Search] ❌ Network error - cannot reach INDX server"), console.error("[Search] 💡 Check if server is running at:", a)) : e instanceof Error && (e.message.includes("401") ? (console.error("[Search] ❌ Authentication failed"), console.error("[Search] 💡 Your token may have expired. Create or refresh it on the Indx Dashboard.")) : e.message.includes("404") ? (console.error("[Search] ❌ Dataset not found"), console.error("[Search] 💡 Check that dataset \"" + u + "\" exists")) : console.error("[Search] 💡 Error:", e.message)), o !==
|
|
345
|
+
if (console.error("[Search] ❌ Search failed:", e), e instanceof TypeError && e.message.includes("fetch") ? (console.error("[Search] ❌ Network error - cannot reach INDX server"), console.error("[Search] 💡 Check if server is running at:", a)) : e instanceof Error && (e.message.includes("401") ? (console.error("[Search] ❌ Authentication failed"), console.error("[Search] 💡 Your token may have expired. Create or refresh it on the Indx Dashboard.")) : e.message.includes("404") ? (console.error("[Search] ❌ Dataset not found"), console.error("[Search] 💡 Check that dataset \"" + u + "\" exists")) : console.error("[Search] 💡 Error:", e.message)), o !== v.current) return;
|
|
344
346
|
t((t) => ({
|
|
345
347
|
...t,
|
|
346
348
|
results: null,
|
|
@@ -356,46 +358,49 @@ function M({ state: e, setState: t, authenticatedFetch: n, auth: r, url: a, team
|
|
|
356
358
|
e.rangeFilters,
|
|
357
359
|
e.bucketFilters,
|
|
358
360
|
e.facetStats,
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
T,
|
|
362
|
-
E,
|
|
361
|
+
I,
|
|
362
|
+
L,
|
|
363
363
|
D,
|
|
364
364
|
k,
|
|
365
|
-
M,
|
|
366
365
|
A,
|
|
366
|
+
N,
|
|
367
|
+
F,
|
|
368
|
+
P,
|
|
367
369
|
n,
|
|
368
370
|
r.initialFacetStats,
|
|
369
371
|
r.initialFacetKeys,
|
|
370
372
|
r.token,
|
|
371
|
-
y,
|
|
372
373
|
x,
|
|
373
374
|
C,
|
|
375
|
+
T,
|
|
374
376
|
e.rangeBounds,
|
|
375
377
|
a,
|
|
376
378
|
s,
|
|
377
379
|
u,
|
|
378
380
|
d,
|
|
379
381
|
p,
|
|
380
|
-
t
|
|
382
|
+
t,
|
|
383
|
+
h,
|
|
384
|
+
g,
|
|
385
|
+
_
|
|
381
386
|
]);
|
|
382
387
|
o(() => {
|
|
383
|
-
|
|
384
|
-
}, [
|
|
385
|
-
let
|
|
386
|
-
o(() => (
|
|
387
|
-
p && console.log("Debounced searchWithFacets fired"),
|
|
388
|
+
y.current = R;
|
|
389
|
+
}, [R]);
|
|
390
|
+
let z = c(null);
|
|
391
|
+
o(() => (z.current?.cancel(), z.current = M(() => {
|
|
392
|
+
p && console.log("Debounced searchWithFacets fired"), y.current?.({ enableFacets: !0 });
|
|
388
393
|
}, e.facetDebounceDelayMillis ?? 500), () => {
|
|
389
|
-
|
|
394
|
+
z.current?.cancel();
|
|
390
395
|
}), [e.facetDebounceDelayMillis]), o(() => {
|
|
391
|
-
!r.isFetchingInitial && r.token && !
|
|
396
|
+
!r.isFetchingInitial && r.token && !b.current && (d && y.current?.({ enableFacets: f }), b.current = !0);
|
|
392
397
|
}, [
|
|
393
398
|
r.isFetchingInitial,
|
|
394
399
|
r.token,
|
|
395
400
|
d,
|
|
396
401
|
f
|
|
397
402
|
]), o(() => {
|
|
398
|
-
if (!r.token || !
|
|
403
|
+
if (!r.token || !b.current) return;
|
|
399
404
|
let n = e.query.trim(), i = n === "" && d;
|
|
400
405
|
if (n === "" && !d) {
|
|
401
406
|
e.resultsSuppressed || t((e) => ({
|
|
@@ -404,54 +409,54 @@ function M({ state: e, setState: t, authenticatedFetch: n, auth: r, url: a, team
|
|
|
404
409
|
}));
|
|
405
410
|
return;
|
|
406
411
|
}
|
|
407
|
-
return i ? (
|
|
408
|
-
|
|
412
|
+
return i ? (z.current?.cancel(), y.current?.({ enableFacets: f })) : f ? (p && console.log("Search fired"), y.current?.({ enableFacets: !1 }), z.current?.()) : y.current?.({ enableFacets: !1 }), () => {
|
|
413
|
+
z.current?.cancel();
|
|
409
414
|
};
|
|
410
415
|
}, [
|
|
411
416
|
e.query,
|
|
412
417
|
d,
|
|
413
418
|
f
|
|
414
419
|
]), o(() => {
|
|
415
|
-
if (!
|
|
420
|
+
if (!b.current || !r.token || e.filterRevision === 0) return;
|
|
416
421
|
let t = e.query.trim();
|
|
417
|
-
!d && t === "" ||
|
|
422
|
+
!d && t === "" || y.current?.({ enableFacets: f });
|
|
418
423
|
}, [e.filterRevision]), o(() => {
|
|
419
|
-
if (!
|
|
424
|
+
if (!b.current || !r.token) return;
|
|
420
425
|
let t = e.query.trim();
|
|
421
|
-
!d && t === "" ||
|
|
422
|
-
}, [
|
|
423
|
-
let
|
|
426
|
+
!d && t === "" || y.current?.({ enableFacets: f });
|
|
427
|
+
}, [I, L]);
|
|
428
|
+
let B = c(!0), V = c(e.query);
|
|
424
429
|
o(() => {
|
|
425
|
-
if (
|
|
426
|
-
|
|
430
|
+
if (B.current) {
|
|
431
|
+
B.current = !1;
|
|
427
432
|
return;
|
|
428
433
|
}
|
|
429
|
-
if (
|
|
434
|
+
if (V.current !== e.query || !b.current || !r.token) return;
|
|
430
435
|
if (m.current) {
|
|
431
|
-
m.current = !1,
|
|
436
|
+
m.current = !1, y.current?.({ enableFacets: !1 });
|
|
432
437
|
return;
|
|
433
438
|
}
|
|
434
439
|
let t = e.query.trim();
|
|
435
|
-
!d && t === "" ||
|
|
440
|
+
!d && t === "" || y.current?.({ enableFacets: f });
|
|
436
441
|
}, [
|
|
437
|
-
T,
|
|
438
|
-
E,
|
|
439
442
|
D,
|
|
440
443
|
k,
|
|
441
|
-
|
|
442
|
-
|
|
444
|
+
A,
|
|
445
|
+
N,
|
|
446
|
+
F,
|
|
447
|
+
P
|
|
443
448
|
]), o(() => {
|
|
444
|
-
|
|
449
|
+
V.current = e.query;
|
|
445
450
|
}, [e.query]);
|
|
446
451
|
}
|
|
447
452
|
//#endregion
|
|
448
453
|
//#region src/context/SearchContext.tsx
|
|
449
|
-
function
|
|
454
|
+
function P() {
|
|
450
455
|
let e = globalThis.crypto;
|
|
451
456
|
return e?.randomUUID ? e.randomUUID() : Math.random().toString(36).slice(2) + Date.now().toString(36);
|
|
452
457
|
}
|
|
453
|
-
var
|
|
454
|
-
let
|
|
458
|
+
var F = n(void 0), I = ({ children: e, url: t, team: n, dataset: r, allowEmptySearch: a = !1, maxResults: s = 10, facetDebounceDelayMillis: u = 500, enableFacets: d = !0, coverageDepth: p, removeDuplicates: m = !0, enableCoverage: h = !0, initialCoverageSetup: g = {}, enableDebugLogs: _ = !1, preAuthenticatedToken: v, source: y, count: b = !0 }) => {
|
|
459
|
+
let x = c(!1), S = c(P()).current, C = c(s), [w, T] = l({
|
|
455
460
|
query: "",
|
|
456
461
|
results: null,
|
|
457
462
|
isLoading: !1,
|
|
@@ -477,72 +482,61 @@ var P = n(void 0), F = ({ children: e, url: t, team: n, dataset: r, allowEmptySe
|
|
|
477
482
|
minimumScore: 0,
|
|
478
483
|
showScore: !0,
|
|
479
484
|
placeholderText: "Type to search",
|
|
480
|
-
coverageSetup: {
|
|
481
|
-
coverWholeQuery: !0,
|
|
482
|
-
coverWholeWords: !0,
|
|
483
|
-
coverFuzzyWords: !0,
|
|
484
|
-
coverJoinedWords: !0,
|
|
485
|
-
coverPrefixSuffix: !0,
|
|
486
|
-
truncate: !0,
|
|
487
|
-
includePatternMatches: !0,
|
|
488
|
-
minWordSize: 2,
|
|
489
|
-
levenshteinMaxWordSize: 20,
|
|
490
|
-
truncateWordHitLimit: 1,
|
|
491
|
-
truncateWordHitTolerance: 0,
|
|
492
|
-
truncationScore: 65024,
|
|
493
|
-
...g
|
|
494
|
-
}
|
|
485
|
+
coverageSetup: { ...g }
|
|
495
486
|
}
|
|
496
487
|
});
|
|
497
488
|
o(() => {
|
|
498
489
|
_ && console.log("SearchContext mounted on client");
|
|
499
490
|
}, [_]), o(() => {
|
|
500
|
-
|
|
491
|
+
T((e) => ({
|
|
501
492
|
...e,
|
|
502
493
|
facetDebounceDelayMillis: u
|
|
503
494
|
}));
|
|
504
495
|
}, [u]);
|
|
505
|
-
let [
|
|
496
|
+
let [E] = l(d), O = D({
|
|
506
497
|
url: t,
|
|
507
498
|
team: n,
|
|
508
499
|
dataset: r,
|
|
509
500
|
preAuthenticatedToken: v,
|
|
510
501
|
enableDebugLogs: _
|
|
511
|
-
}),
|
|
512
|
-
if (!
|
|
502
|
+
}), k = i((e, t = {}) => {
|
|
503
|
+
if (!O.token) throw Error("No authentication token available");
|
|
513
504
|
return fetch(e, {
|
|
514
505
|
...t,
|
|
515
506
|
headers: {
|
|
516
507
|
...t.headers,
|
|
517
|
-
Authorization: `Bearer ${
|
|
508
|
+
Authorization: `Bearer ${O.token}`
|
|
518
509
|
}
|
|
519
510
|
});
|
|
520
|
-
}, [
|
|
521
|
-
|
|
522
|
-
state:
|
|
523
|
-
setState:
|
|
524
|
-
authenticatedFetch:
|
|
525
|
-
auth:
|
|
511
|
+
}, [O.token]);
|
|
512
|
+
N({
|
|
513
|
+
state: w,
|
|
514
|
+
setState: T,
|
|
515
|
+
authenticatedFetch: k,
|
|
516
|
+
auth: O,
|
|
526
517
|
url: t,
|
|
527
518
|
team: n,
|
|
528
519
|
dataset: r,
|
|
529
520
|
allowEmptySearch: a,
|
|
530
|
-
facetsEnabled:
|
|
521
|
+
facetsEnabled: E,
|
|
531
522
|
enableDebugLogs: _,
|
|
532
|
-
shouldFetchMore:
|
|
533
|
-
sessionId:
|
|
523
|
+
shouldFetchMore: x,
|
|
524
|
+
sessionId: S,
|
|
525
|
+
source: y,
|
|
526
|
+
count: b
|
|
534
527
|
});
|
|
535
|
-
let
|
|
536
|
-
|
|
537
|
-
let
|
|
538
|
-
if (
|
|
539
|
-
let i = await
|
|
528
|
+
let A = c(void 0);
|
|
529
|
+
A.current = w.queryId;
|
|
530
|
+
let j = i(async (e) => {
|
|
531
|
+
if (O.token) try {
|
|
532
|
+
let i = await k(`${t}/api/teams/${n}/datasets/${r}/events/select`, {
|
|
540
533
|
method: "POST",
|
|
541
534
|
headers: { "Content-Type": "application/json" },
|
|
542
535
|
body: JSON.stringify({
|
|
543
|
-
queryId:
|
|
536
|
+
queryId: A.current,
|
|
544
537
|
documentKey: e.documentKey,
|
|
545
|
-
position: e.position
|
|
538
|
+
position: e.position,
|
|
539
|
+
...b ? {} : { count: !1 }
|
|
546
540
|
})
|
|
547
541
|
});
|
|
548
542
|
_ && (i.ok ? console.log(`[select] document ${e.documentKey} at position ${e.position}`) : console.warn(`[select] not recorded: ${i.status}`));
|
|
@@ -550,14 +544,15 @@ var P = n(void 0), F = ({ children: e, url: t, team: n, dataset: r, allowEmptySe
|
|
|
550
544
|
_ && console.warn("[select] failed:", e);
|
|
551
545
|
}
|
|
552
546
|
}, [
|
|
553
|
-
|
|
554
|
-
|
|
547
|
+
O.token,
|
|
548
|
+
k,
|
|
555
549
|
t,
|
|
556
550
|
n,
|
|
557
551
|
r,
|
|
558
|
-
_
|
|
559
|
-
|
|
560
|
-
|
|
552
|
+
_,
|
|
553
|
+
b
|
|
554
|
+
]), M = i((e) => {
|
|
555
|
+
T((t) => {
|
|
561
556
|
let n = Object.keys(t.filters).length > 0, r = Object.keys(t.rangeFilters).length > 0, i = Object.keys(t.bucketFilters).length > 0;
|
|
562
557
|
return {
|
|
563
558
|
...t,
|
|
@@ -567,39 +562,39 @@ var P = n(void 0), F = ({ children: e, url: t, team: n, dataset: r, allowEmptySe
|
|
|
567
562
|
bucketFilters: i ? {} : t.bucketFilters,
|
|
568
563
|
searchSettings: {
|
|
569
564
|
...t.searchSettings,
|
|
570
|
-
maxNumberOfRecordsToReturn:
|
|
565
|
+
maxNumberOfRecordsToReturn: C.current
|
|
571
566
|
}
|
|
572
567
|
};
|
|
573
568
|
});
|
|
574
|
-
}, []),
|
|
575
|
-
|
|
569
|
+
}, []), I = i((e) => {
|
|
570
|
+
T((t) => ({
|
|
576
571
|
...t,
|
|
577
572
|
facetDebounceDelayMillis: e
|
|
578
573
|
}));
|
|
579
|
-
}, []),
|
|
580
|
-
typeof e.maxNumberOfRecordsToReturn == "number" && (
|
|
574
|
+
}, []), L = i((e) => {
|
|
575
|
+
typeof e.maxNumberOfRecordsToReturn == "number" && (C.current = e.maxNumberOfRecordsToReturn), T((t) => {
|
|
581
576
|
let n = {
|
|
582
577
|
...t.searchSettings,
|
|
583
578
|
...e
|
|
584
579
|
};
|
|
585
|
-
return e.coverageSetup ? n.coverageSetup = {
|
|
580
|
+
return "coverageSetup" in e ? e.coverageSetup ? n.coverageSetup = {
|
|
586
581
|
...t.searchSettings.coverageSetup,
|
|
587
582
|
...e.coverageSetup
|
|
588
|
-
} : n.coverageSetup = t.searchSettings.coverageSetup, {
|
|
583
|
+
} : n.coverageSetup = {} : n.coverageSetup = t.searchSettings.coverageSetup, {
|
|
589
584
|
...t,
|
|
590
585
|
searchSettings: n
|
|
591
586
|
};
|
|
592
587
|
});
|
|
593
|
-
}, []),
|
|
594
|
-
|
|
588
|
+
}, []), R = i((e) => {
|
|
589
|
+
x.current = !0, T((t) => ({
|
|
595
590
|
...t,
|
|
596
591
|
searchSettings: {
|
|
597
592
|
...t.searchSettings,
|
|
598
593
|
maxNumberOfRecordsToReturn: e
|
|
599
594
|
}
|
|
600
595
|
}));
|
|
601
|
-
}, []),
|
|
602
|
-
|
|
596
|
+
}, []), z = i((e, t, n = !1) => {
|
|
597
|
+
T((r) => {
|
|
603
598
|
let i = { ...r.filters }, a = i[e] || [], o = a.includes(t) ? a.filter((e) => e !== t) : n ? [t] : [...a, t];
|
|
604
599
|
return o.length ? i[e] = o : delete i[e], {
|
|
605
600
|
...r,
|
|
@@ -607,16 +602,16 @@ var P = n(void 0), F = ({ children: e, url: t, team: n, dataset: r, allowEmptySe
|
|
|
607
602
|
filterRevision: r.filterRevision + 1
|
|
608
603
|
};
|
|
609
604
|
});
|
|
610
|
-
}, []),
|
|
611
|
-
|
|
605
|
+
}, []), B = i((e, t) => {
|
|
606
|
+
T((n) => n.valueMatch[e] === t ? n : {
|
|
612
607
|
...n,
|
|
613
608
|
valueMatch: {
|
|
614
609
|
...n.valueMatch,
|
|
615
610
|
[e]: t
|
|
616
611
|
}
|
|
617
612
|
});
|
|
618
|
-
}, []),
|
|
619
|
-
|
|
613
|
+
}, []), V = i((e, t, n) => {
|
|
614
|
+
T((r) => ({
|
|
620
615
|
...r,
|
|
621
616
|
rangeFilters: {
|
|
622
617
|
...r.rangeFilters,
|
|
@@ -627,16 +622,16 @@ var P = n(void 0), F = ({ children: e, url: t, team: n, dataset: r, allowEmptySe
|
|
|
627
622
|
},
|
|
628
623
|
filterRevision: r.filterRevision + 1
|
|
629
624
|
}));
|
|
630
|
-
}, []),
|
|
631
|
-
|
|
625
|
+
}, []), H = i(() => {
|
|
626
|
+
T((e) => ({
|
|
632
627
|
...e,
|
|
633
628
|
filters: {},
|
|
634
629
|
rangeFilters: {},
|
|
635
630
|
bucketFilters: {},
|
|
636
631
|
filterRevision: e.filterRevision + 1
|
|
637
632
|
}));
|
|
638
|
-
}, []),
|
|
639
|
-
|
|
633
|
+
}, []), U = i((e, t, n = !0) => {
|
|
634
|
+
T((r) => {
|
|
640
635
|
let i = { ...r.filters }, a = (i[e] || []).filter((e) => e !== t);
|
|
641
636
|
return a.length > 0 ? i[e] = a : delete i[e], {
|
|
642
637
|
...r,
|
|
@@ -644,8 +639,8 @@ var P = n(void 0), F = ({ children: e, url: t, team: n, dataset: r, allowEmptySe
|
|
|
644
639
|
filterRevision: r.filterRevision + +!!n
|
|
645
640
|
};
|
|
646
641
|
});
|
|
647
|
-
}, []),
|
|
648
|
-
|
|
642
|
+
}, []), W = i((e, t = !0) => {
|
|
643
|
+
T((n) => {
|
|
649
644
|
if (!(e in n.rangeFilters)) return n;
|
|
650
645
|
let r = { ...n.rangeFilters };
|
|
651
646
|
return delete r[e], {
|
|
@@ -654,9 +649,9 @@ var P = n(void 0), F = ({ children: e, url: t, team: n, dataset: r, allowEmptySe
|
|
|
654
649
|
filterRevision: n.filterRevision + +!!t
|
|
655
650
|
};
|
|
656
651
|
});
|
|
657
|
-
}, []),
|
|
658
|
-
|
|
659
|
-
let i = r.bucketFilters[e] ?? [], a = i.some((e) =>
|
|
652
|
+
}, []), ee = (e, t) => e.min === t.min && e.max === t.max, G = i((e, t, n = !1) => {
|
|
653
|
+
T((r) => {
|
|
654
|
+
let i = r.bucketFilters[e] ?? [], a = i.some((e) => ee(e, t)) ? i.filter((e) => !ee(e, t)) : n ? [t] : [...i, t], o = { ...r.bucketFilters };
|
|
660
655
|
return a.length > 0 ? o[e] = a : delete o[e], {
|
|
661
656
|
...r,
|
|
662
657
|
bucketFilters: o,
|
|
@@ -664,55 +659,55 @@ var P = n(void 0), F = ({ children: e, url: t, team: n, dataset: r, allowEmptySe
|
|
|
664
659
|
};
|
|
665
660
|
});
|
|
666
661
|
}, []), te = i((e, t, n = !0) => {
|
|
667
|
-
|
|
668
|
-
let i = { ...r.bucketFilters }, a = t ? (i[e] ?? []).filter((e) => !
|
|
662
|
+
T((r) => {
|
|
663
|
+
let i = { ...r.bucketFilters }, a = t ? (i[e] ?? []).filter((e) => !ee(e, t)) : [];
|
|
669
664
|
return a.length > 0 ? i[e] = a : delete i[e], {
|
|
670
665
|
...r,
|
|
671
666
|
bucketFilters: i,
|
|
672
667
|
filterRevision: r.filterRevision + +!!n
|
|
673
668
|
};
|
|
674
669
|
});
|
|
675
|
-
}, []),
|
|
676
|
-
|
|
670
|
+
}, []), K = i((e, t) => {
|
|
671
|
+
T((n) => ({
|
|
677
672
|
...n,
|
|
678
673
|
sortBy: e || void 0,
|
|
679
674
|
sortAscending: e ? t : void 0
|
|
680
675
|
}));
|
|
681
676
|
}, []);
|
|
682
|
-
return /* @__PURE__ */ f(
|
|
677
|
+
return /* @__PURE__ */ f(F.Provider, {
|
|
683
678
|
value: {
|
|
684
|
-
state:
|
|
685
|
-
isFetchingInitial:
|
|
686
|
-
authError:
|
|
679
|
+
state: w,
|
|
680
|
+
isFetchingInitial: O.isFetchingInitial || !w.fieldsSeeded,
|
|
681
|
+
authError: O.authError ?? void 0,
|
|
687
682
|
allowEmptySearch: a,
|
|
688
683
|
url: t,
|
|
689
684
|
team: n,
|
|
690
685
|
dataset: r,
|
|
691
|
-
authenticatedFetch:
|
|
692
|
-
setQuery:
|
|
693
|
-
toggleFilter:
|
|
694
|
-
setValueMatch:
|
|
695
|
-
setRangeFilter:
|
|
696
|
-
resetFilters:
|
|
697
|
-
resetSingleFilter:
|
|
698
|
-
resetRangeFilter:
|
|
699
|
-
toggleBucketFilter:
|
|
686
|
+
authenticatedFetch: k,
|
|
687
|
+
setQuery: M,
|
|
688
|
+
toggleFilter: z,
|
|
689
|
+
setValueMatch: B,
|
|
690
|
+
setRangeFilter: V,
|
|
691
|
+
resetFilters: H,
|
|
692
|
+
resetSingleFilter: U,
|
|
693
|
+
resetRangeFilter: W,
|
|
694
|
+
toggleBucketFilter: G,
|
|
700
695
|
resetBucketFilter: te,
|
|
701
|
-
setSort:
|
|
702
|
-
setDebounceDelay:
|
|
703
|
-
setSearchSettings:
|
|
704
|
-
fetchMoreResults:
|
|
705
|
-
selectResult:
|
|
706
|
-
sessionId:
|
|
696
|
+
setSort: K,
|
|
697
|
+
setDebounceDelay: I,
|
|
698
|
+
setSearchSettings: L,
|
|
699
|
+
fetchMoreResults: R,
|
|
700
|
+
selectResult: j,
|
|
701
|
+
sessionId: S
|
|
707
702
|
},
|
|
708
703
|
children: e
|
|
709
704
|
});
|
|
710
|
-
},
|
|
711
|
-
let e = a(
|
|
705
|
+
}, L = () => {
|
|
706
|
+
let e = a(F);
|
|
712
707
|
if (!e) throw Error("useSearchContext must be used within a SearchProvider");
|
|
713
708
|
return e;
|
|
714
|
-
},
|
|
715
|
-
let { state: { query: o, filters: s, rangeFilters: c, searchSettings: l }, setQuery: u } =
|
|
709
|
+
}, R = ({ className: e = "", autoFocus: t = !1, inputSize: n = "default", showClear: r = !0, showFocus: i = !1, ...a }) => {
|
|
710
|
+
let { state: { query: o, filters: s, rangeFilters: c, searchSettings: l }, setQuery: u } = L();
|
|
716
711
|
Object.keys(s).length > 0 || Object.keys(c).length;
|
|
717
712
|
let d = o.length > 0;
|
|
718
713
|
return /* @__PURE__ */ f(y, {
|
|
@@ -734,10 +729,10 @@ var P = n(void 0), F = ({ children: e, url: t, team: n, dataset: r, allowEmptySe
|
|
|
734
729
|
children: "Clear"
|
|
735
730
|
})
|
|
736
731
|
});
|
|
737
|
-
},
|
|
732
|
+
}, z = {
|
|
738
733
|
placeholder: "_placeholder_ee9qi_1",
|
|
739
734
|
invalid: "_invalid_ee9qi_11"
|
|
740
|
-
},
|
|
735
|
+
}, B = {
|
|
741
736
|
row: "_row_1i201_1",
|
|
742
737
|
content: "_content_1i201_19",
|
|
743
738
|
indexNumber: "_indexNumber_1i201_31",
|
|
@@ -746,25 +741,25 @@ var P = n(void 0), F = ({ children: e, url: t, team: n, dataset: r, allowEmptySe
|
|
|
746
741
|
skeletonBarLg: "_skeletonBarLg_1i201_59",
|
|
747
742
|
fade: "_fade_1i201_1",
|
|
748
743
|
skeletonBarSm: "_skeletonBarSm_1i201_66"
|
|
749
|
-
},
|
|
750
|
-
className:
|
|
744
|
+
}, V = ({ skeleton: e = !1, index: t, score: n, showScore: r = !1, children: i, skeletonDelay: a = 0, skeletonWidths: o = [62, 38] }) => /* @__PURE__ */ p("div", {
|
|
745
|
+
className: B.row,
|
|
751
746
|
children: [
|
|
752
747
|
t !== void 0 && /* @__PURE__ */ f("div", {
|
|
753
|
-
className:
|
|
748
|
+
className: B.indexNumber,
|
|
754
749
|
children: t
|
|
755
750
|
}),
|
|
756
751
|
/* @__PURE__ */ f("div", {
|
|
757
|
-
className:
|
|
752
|
+
className: B.content,
|
|
758
753
|
children: e ? /* @__PURE__ */ p("div", {
|
|
759
|
-
className:
|
|
754
|
+
className: B.skeletonBars,
|
|
760
755
|
children: [/* @__PURE__ */ f("div", {
|
|
761
|
-
className:
|
|
756
|
+
className: B.skeletonBarLg,
|
|
762
757
|
style: {
|
|
763
758
|
width: `${o[0]}%`,
|
|
764
759
|
animationDelay: `${a}s`
|
|
765
760
|
}
|
|
766
761
|
}), /* @__PURE__ */ f("div", {
|
|
767
|
-
className:
|
|
762
|
+
className: B.skeletonBarSm,
|
|
768
763
|
style: {
|
|
769
764
|
width: `${o[1]}%`,
|
|
770
765
|
animationDelay: `${a + .05}s`
|
|
@@ -773,14 +768,14 @@ var P = n(void 0), F = ({ children: e, url: t, team: n, dataset: r, allowEmptySe
|
|
|
773
768
|
}) : i
|
|
774
769
|
}),
|
|
775
770
|
r && n !== void 0 && /* @__PURE__ */ f("div", {
|
|
776
|
-
className:
|
|
771
|
+
className: B.scoreNumber,
|
|
777
772
|
children: n
|
|
778
773
|
})
|
|
779
774
|
]
|
|
780
|
-
}),
|
|
775
|
+
}), H = {
|
|
781
776
|
wrapper: "_wrapper_81m3c_6",
|
|
782
777
|
skeletonAppear: "_skeletonAppear_81m3c_1"
|
|
783
|
-
},
|
|
778
|
+
}, U = [
|
|
784
779
|
[62, 38],
|
|
785
780
|
[75, 45],
|
|
786
781
|
[58, 33],
|
|
@@ -789,28 +784,28 @@ var P = n(void 0), F = ({ children: e, url: t, team: n, dataset: r, allowEmptySe
|
|
|
789
784
|
[55, 35],
|
|
790
785
|
[72, 40],
|
|
791
786
|
[60, 30]
|
|
792
|
-
],
|
|
793
|
-
className:
|
|
794
|
-
children: Array.from({ length: e }).map((e, t) => /* @__PURE__ */ f(
|
|
787
|
+
], W = ({ rows: e = 6 }) => /* @__PURE__ */ f("div", {
|
|
788
|
+
className: H.wrapper,
|
|
789
|
+
children: Array.from({ length: e }).map((e, t) => /* @__PURE__ */ f(V, {
|
|
795
790
|
skeleton: !0,
|
|
796
791
|
skeletonDelay: t * .1,
|
|
797
|
-
skeletonWidths:
|
|
792
|
+
skeletonWidths: U[t % U.length]
|
|
798
793
|
}, t))
|
|
799
|
-
}),
|
|
800
|
-
function
|
|
794
|
+
}), ee = /^\[\s*(?:'[^']*'(?:\s*,\s*'[^']*')*)?\s*\]$/;
|
|
795
|
+
function G(e) {
|
|
801
796
|
let t = e.trim();
|
|
802
797
|
if (!t.startsWith("[") || !t.endsWith("]")) return;
|
|
803
798
|
try {
|
|
804
799
|
let e = JSON.parse(t);
|
|
805
800
|
if (Array.isArray(e)) return e.map((e) => String(e));
|
|
806
801
|
} catch {}
|
|
807
|
-
if (!
|
|
802
|
+
if (!ee.test(t)) return;
|
|
808
803
|
let n = [], r = /'([^']*)'/g, i;
|
|
809
804
|
for (; (i = r.exec(t)) !== null;) n.push(i[1]);
|
|
810
805
|
return n;
|
|
811
806
|
}
|
|
812
|
-
var
|
|
813
|
-
let { state: { results: i, resultsSuppressed: a, searchSettings: s, truncationIndex: u, query: h, error: g }, isFetchingInitial: _, authError: v, allowEmptySearch: y, fetchMoreResults: b, selectResult: x } =
|
|
807
|
+
var te = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, children: r }) => {
|
|
808
|
+
let { state: { results: i, resultsSuppressed: a, searchSettings: s, truncationIndex: u, query: h, error: g }, isFetchingInitial: _, authError: v, allowEmptySearch: y, fetchMoreResults: b, selectResult: x } = L(), S = t ?? 30, [C, w] = l(S), E = c(0), D = c("");
|
|
814
809
|
o(() => {
|
|
815
810
|
let e = h !== D.current;
|
|
816
811
|
(!i || i.length < E.current || e) && w(S), E.current = i?.length ?? 0, D.current = h;
|
|
@@ -823,8 +818,8 @@ var G = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, children: r
|
|
|
823
818
|
let e = C + S;
|
|
824
819
|
w(e), i && e >= i.length && (!u || u === -1 || u > i.length) && b(i.length + S);
|
|
825
820
|
};
|
|
826
|
-
if (_) return y ? /* @__PURE__ */ f(
|
|
827
|
-
className:
|
|
821
|
+
if (_) return y ? /* @__PURE__ */ f(W, { rows: S }) : /* @__PURE__ */ f("div", {
|
|
822
|
+
className: z.placeholder,
|
|
828
823
|
children: /* @__PURE__ */ f(T, {
|
|
829
824
|
size: 200,
|
|
830
825
|
color: "var(--lv5)"
|
|
@@ -832,17 +827,17 @@ var G = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, children: r
|
|
|
832
827
|
});
|
|
833
828
|
let A = v ?? g;
|
|
834
829
|
return A ? /* @__PURE__ */ f("div", {
|
|
835
|
-
className:
|
|
830
|
+
className: z.invalid,
|
|
836
831
|
role: "alert",
|
|
837
832
|
children: /* @__PURE__ */ f("p", { children: A })
|
|
838
833
|
}) : a || i === null ? /* @__PURE__ */ f("div", {
|
|
839
|
-
className:
|
|
834
|
+
className: z.placeholder,
|
|
840
835
|
children: /* @__PURE__ */ f(T, {
|
|
841
836
|
size: 200,
|
|
842
837
|
color: "var(--lv5)"
|
|
843
838
|
})
|
|
844
839
|
}) : i.length === 0 ? /* @__PURE__ */ f("div", {
|
|
845
|
-
className:
|
|
840
|
+
className: z.invalid,
|
|
846
841
|
children: /* @__PURE__ */ f("p", { children: "No results found." })
|
|
847
842
|
}) : /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("div", { children: (i ?? []).slice(0, C).map((t, i) => {
|
|
848
843
|
let a = t.document, o = t.score, c;
|
|
@@ -850,7 +845,7 @@ var G = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, children: r
|
|
|
850
845
|
c = typeof a == "string" ? JSON.parse(a) : a;
|
|
851
846
|
} catch {
|
|
852
847
|
return /* @__PURE__ */ f("div", {
|
|
853
|
-
className:
|
|
848
|
+
className: z.invalid,
|
|
854
849
|
children: /* @__PURE__ */ f("p", { children: "Invalid JSON" })
|
|
855
850
|
}, i);
|
|
856
851
|
}
|
|
@@ -862,11 +857,11 @@ var G = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, children: r
|
|
|
862
857
|
if (n) for (let e in l) {
|
|
863
858
|
let t = l[e];
|
|
864
859
|
if (typeof t == "string") {
|
|
865
|
-
let n =
|
|
860
|
+
let n = G(t);
|
|
866
861
|
n && (l[e] = n);
|
|
867
862
|
}
|
|
868
863
|
}
|
|
869
|
-
return /* @__PURE__ */ f(
|
|
864
|
+
return /* @__PURE__ */ f(V, {
|
|
870
865
|
index: i,
|
|
871
866
|
score: o,
|
|
872
867
|
showScore: s.showScore,
|
|
@@ -890,10 +885,10 @@ var G = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, children: r
|
|
|
890
885
|
}, K = {
|
|
891
886
|
row: "_row_ujwhc_1",
|
|
892
887
|
title: "_title_ujwhc_8"
|
|
893
|
-
},
|
|
888
|
+
}, q = ({ variant: e = "default", children: t }) => /* @__PURE__ */ f("div", {
|
|
894
889
|
className: [K.row, e === "title" ? K.title : ""].filter(Boolean).join(" "),
|
|
895
890
|
children: t
|
|
896
|
-
}),
|
|
891
|
+
}), ne = {
|
|
897
892
|
bar: "_bar_4nxla_12",
|
|
898
893
|
skeletonAppear: "_skeletonAppear_4nxla_1",
|
|
899
894
|
fade: "_fade_4nxla_1",
|
|
@@ -903,7 +898,7 @@ var G = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, children: r
|
|
|
903
898
|
inputRow: "_inputRow_4nxla_40",
|
|
904
899
|
inputBar: "_inputBar_4nxla_45",
|
|
905
900
|
histogramRow: "_histogramRow_4nxla_55"
|
|
906
|
-
},
|
|
901
|
+
}, re = [
|
|
907
902
|
65,
|
|
908
903
|
80,
|
|
909
904
|
55,
|
|
@@ -912,37 +907,37 @@ var G = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, children: r
|
|
|
912
907
|
75,
|
|
913
908
|
50,
|
|
914
909
|
68
|
|
915
|
-
],
|
|
910
|
+
], ie = ({ title: e, rows: t = 5, variant: n = "list", withHistogram: r = !1, collapsible: i = !0, startCollapsed: a = !1 }) => /* @__PURE__ */ f(g, {
|
|
916
911
|
title: e,
|
|
917
912
|
collapsible: i,
|
|
918
913
|
collapsed: a,
|
|
919
914
|
children: n === "slider" ? /* @__PURE__ */ p("div", {
|
|
920
|
-
className:
|
|
915
|
+
className: ne.sliderArea,
|
|
921
916
|
children: [
|
|
922
|
-
r && /* @__PURE__ */ f("div", { className:
|
|
923
|
-
/* @__PURE__ */ f("div", { className:
|
|
917
|
+
r && /* @__PURE__ */ f("div", { className: ne.histogramRow }),
|
|
918
|
+
/* @__PURE__ */ f("div", { className: ne.sliderTrack }),
|
|
924
919
|
/* @__PURE__ */ p("div", {
|
|
925
|
-
className:
|
|
920
|
+
className: ne.inputRow,
|
|
926
921
|
children: [/* @__PURE__ */ f("div", {
|
|
927
|
-
className:
|
|
922
|
+
className: ne.inputBar,
|
|
928
923
|
style: { animationDelay: "0.1s" }
|
|
929
924
|
}), /* @__PURE__ */ f("div", {
|
|
930
|
-
className:
|
|
925
|
+
className: ne.inputBar,
|
|
931
926
|
style: { animationDelay: "0.15s" }
|
|
932
927
|
})]
|
|
933
928
|
})
|
|
934
929
|
]
|
|
935
930
|
}) : /* @__PURE__ */ f("div", {
|
|
936
|
-
className:
|
|
931
|
+
className: ne.listRows,
|
|
937
932
|
children: Array.from({ length: t }).map((e, t) => /* @__PURE__ */ f("div", {
|
|
938
|
-
className:
|
|
933
|
+
className: ne.bar,
|
|
939
934
|
style: {
|
|
940
|
-
width: `${
|
|
935
|
+
width: `${re[t % re.length]}%`,
|
|
941
936
|
animationDelay: `${t * .05}s`
|
|
942
937
|
}
|
|
943
938
|
}, t))
|
|
944
939
|
})
|
|
945
|
-
}),
|
|
940
|
+
}), J = {
|
|
946
941
|
list: "_list_18vbb_2",
|
|
947
942
|
count: "_count_18vbb_7",
|
|
948
943
|
countValue: "_countValue_18vbb_17",
|
|
@@ -950,33 +945,33 @@ var G = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, children: r
|
|
|
950
945
|
chipLabel: "_chipLabel_18vbb_32",
|
|
951
946
|
grid: "_grid_18vbb_40",
|
|
952
947
|
active: "_active_18vbb_54"
|
|
953
|
-
},
|
|
954
|
-
let { state: { facets: D, filterableFields: O, facetableFields: k, filters: A, query:
|
|
948
|
+
}, Y = ({ field: e, label: t, preserveBlankFacetState: n = !1, preserveBlankFacetStateOrder: r = !1, sortFacetsBy: i = "histogram", limit: a = 10, collapsible: s = !0, startCollapsed: u = !1, control: d, displayType: _, layout: y = "list", showActivePanel: b = !1, showCount: x = !0, showNull: C = !1, match: w = "all", displayIfEmptyQuery: T = !0, displayCondition: E = (e) => !0 }) => {
|
|
949
|
+
let { state: { facets: D, filterableFields: O, facetableFields: k, filters: A, query: j }, toggleFilter: M, setValueMatch: N, isFetchingInitial: P, allowEmptySearch: F } = L(), I = d ?? _ ?? "checkbox", R = I === "radio" ? "any" : w;
|
|
955
950
|
o(() => {
|
|
956
|
-
|
|
951
|
+
N(e, R);
|
|
957
952
|
}, [
|
|
958
953
|
e,
|
|
959
|
-
|
|
960
|
-
|
|
954
|
+
R,
|
|
955
|
+
N
|
|
961
956
|
]);
|
|
962
|
-
let
|
|
957
|
+
let z = c(null), [B, V] = l(a);
|
|
963
958
|
if (o(() => {
|
|
964
|
-
|
|
965
|
-
}, [D?.[e], a]), !
|
|
966
|
-
if (
|
|
959
|
+
V(a);
|
|
960
|
+
}, [D?.[e], a]), !F && !j) return null;
|
|
961
|
+
if (P || !D) return I === "toggle" ? /* @__PURE__ */ f(ie, {
|
|
967
962
|
rows: 1,
|
|
968
963
|
collapsible: !1
|
|
969
|
-
}) : /* @__PURE__ */ f(
|
|
964
|
+
}) : /* @__PURE__ */ f(ie, {
|
|
970
965
|
title: t,
|
|
971
966
|
rows: Math.min(a, 6),
|
|
972
967
|
collapsible: s,
|
|
973
968
|
startCollapsed: u
|
|
974
969
|
});
|
|
975
970
|
if (!E({
|
|
976
|
-
query:
|
|
971
|
+
query: j ?? "",
|
|
977
972
|
filters: A,
|
|
978
973
|
facets: D
|
|
979
|
-
}) || !T && !
|
|
974
|
+
}) || !T && !j && Object.keys(A).length < 1) return null;
|
|
980
975
|
if (!O?.includes(e) || !k?.includes(e)) {
|
|
981
976
|
let t = [];
|
|
982
977
|
return O?.includes(e) || t.push("filterable"), k?.includes(e) || t.push("facetable"), /* @__PURE__ */ f(g, {
|
|
@@ -996,29 +991,29 @@ var G = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, children: r
|
|
|
996
991
|
})
|
|
997
992
|
});
|
|
998
993
|
}
|
|
999
|
-
let
|
|
1000
|
-
if (!
|
|
1001
|
-
let
|
|
1002
|
-
n && !
|
|
1003
|
-
let
|
|
1004
|
-
n &&
|
|
1005
|
-
|
|
1006
|
-
}),
|
|
1007
|
-
|
|
994
|
+
let H = D?.[e] ?? (I === "toggle" ? [] : void 0);
|
|
995
|
+
if (!H || !Array.isArray(H)) return null;
|
|
996
|
+
let U = A?.[e] ?? [];
|
|
997
|
+
n && !z.current && H.length > 0 && (z.current = H.reduce((e, t) => (e[t.key] = t.value, e), {}));
|
|
998
|
+
let W = /* @__PURE__ */ new Map();
|
|
999
|
+
n && z.current && Object.keys(z.current).forEach((e) => {
|
|
1000
|
+
W.set(e, 0);
|
|
1001
|
+
}), H.forEach((e) => {
|
|
1002
|
+
W.set(e.key, e.value);
|
|
1008
1003
|
});
|
|
1009
|
-
let
|
|
1004
|
+
let ee = new Set([
|
|
1010
1005
|
"true",
|
|
1011
1006
|
"false",
|
|
1012
1007
|
"null"
|
|
1013
|
-
]),
|
|
1014
|
-
if (
|
|
1015
|
-
let e =
|
|
1016
|
-
|
|
1008
|
+
]), G = Array.from(W.keys()), te = I === "toggle" && (G.length > 0 && G.every((e) => ee.has(e)) || G.length === 0 && U.length > 0);
|
|
1009
|
+
if (te && W.has("null")) {
|
|
1010
|
+
let e = W.get("null") ?? 0, t = W.get("false") ?? 0;
|
|
1011
|
+
W.set("false", t + e), W.delete("null");
|
|
1017
1012
|
}
|
|
1018
|
-
if (
|
|
1013
|
+
if (I === "toggle" && !te) return /* @__PURE__ */ f(g, {
|
|
1019
1014
|
collapsible: !1,
|
|
1020
1015
|
children: /* @__PURE__ */ f("div", {
|
|
1021
|
-
className:
|
|
1016
|
+
className: J.count,
|
|
1022
1017
|
children: /* @__PURE__ */ f(S, {
|
|
1023
1018
|
label: t,
|
|
1024
1019
|
checked: !1,
|
|
@@ -1027,17 +1022,17 @@ var G = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, children: r
|
|
|
1027
1022
|
})
|
|
1028
1023
|
})
|
|
1029
1024
|
});
|
|
1030
|
-
if (
|
|
1031
|
-
let n =
|
|
1025
|
+
if (te) {
|
|
1026
|
+
let n = W.get("true"), r = typeof n == "number" ? n : null, i = U.includes("true"), a = r === 0 && !i, o = x && (r ?? 0) > 0 ? `${r}` : "";
|
|
1032
1027
|
return /* @__PURE__ */ f(g, {
|
|
1033
1028
|
collapsible: !1,
|
|
1034
1029
|
children: /* @__PURE__ */ p("div", {
|
|
1035
|
-
className:
|
|
1030
|
+
className: J.count,
|
|
1036
1031
|
children: [
|
|
1037
1032
|
/* @__PURE__ */ f(S, {
|
|
1038
1033
|
label: t,
|
|
1039
1034
|
checked: i,
|
|
1040
|
-
onChange: () =>
|
|
1035
|
+
onChange: () => M(e, "true"),
|
|
1041
1036
|
disabled: a
|
|
1042
1037
|
}),
|
|
1043
1038
|
" ",
|
|
@@ -1046,7 +1041,7 @@ var G = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, children: r
|
|
|
1046
1041
|
})
|
|
1047
1042
|
});
|
|
1048
1043
|
}
|
|
1049
|
-
let K = Array.from(
|
|
1044
|
+
let K = Array.from(W.entries());
|
|
1050
1045
|
if (C || (K = K.filter(([e]) => e !== "null")), K.length === 0 && !n) return null;
|
|
1051
1046
|
if (!r) if (i === "alphabetical") {
|
|
1052
1047
|
let e = K.filter(([, e]) => typeof e == "number" && e > 0).sort(([e], [t]) => e.localeCompare(t)), t = K.filter(([, e]) => e === 0 || e === null).sort(([e], [t]) => e.localeCompare(t));
|
|
@@ -1061,24 +1056,24 @@ var G = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, children: r
|
|
|
1061
1056
|
let e = K.filter(([, e]) => typeof e == "number" && e > 0), t = K.filter(([, e]) => e === 0 || e === null);
|
|
1062
1057
|
K = [...e, ...t];
|
|
1063
1058
|
}
|
|
1064
|
-
let
|
|
1065
|
-
let r =
|
|
1066
|
-
switch (
|
|
1059
|
+
let q = typeof a == "number" && K.length > a, ne = q ? K.slice(0, B) : K, re = (t, n) => {
|
|
1060
|
+
let r = U.includes(t), i = n === 0, a = x && (n ?? 0) > 0 ? ` (${n})` : "", o = x && (n ?? 0) > 0 ? n : "", s = () => M(e, t, I === "radio");
|
|
1061
|
+
switch (I) {
|
|
1067
1062
|
case "button": return y === "list" ? /* @__PURE__ */ p("div", {
|
|
1068
|
-
className:
|
|
1063
|
+
className: J.count,
|
|
1069
1064
|
children: [/* @__PURE__ */ f(m, {
|
|
1070
1065
|
variant: r ? "primary" : "secondary",
|
|
1071
1066
|
onClick: s,
|
|
1072
1067
|
disabled: i,
|
|
1073
1068
|
size: "micro",
|
|
1074
|
-
className:
|
|
1069
|
+
className: J.chip,
|
|
1075
1070
|
title: t,
|
|
1076
1071
|
children: /* @__PURE__ */ f("span", {
|
|
1077
|
-
className:
|
|
1072
|
+
className: J.chipLabel,
|
|
1078
1073
|
children: t
|
|
1079
1074
|
})
|
|
1080
1075
|
}), /* @__PURE__ */ f("span", {
|
|
1081
|
-
className:
|
|
1076
|
+
className: J.countValue,
|
|
1082
1077
|
children: o
|
|
1083
1078
|
})]
|
|
1084
1079
|
}) : /* @__PURE__ */ f(m, {
|
|
@@ -1086,10 +1081,10 @@ var G = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, children: r
|
|
|
1086
1081
|
onClick: s,
|
|
1087
1082
|
disabled: i,
|
|
1088
1083
|
size: "micro",
|
|
1089
|
-
className:
|
|
1084
|
+
className: J.chip,
|
|
1090
1085
|
title: `${t}${a}`,
|
|
1091
1086
|
children: /* @__PURE__ */ f("span", {
|
|
1092
|
-
className:
|
|
1087
|
+
className: J.chipLabel,
|
|
1093
1088
|
children: `${t}${a}`
|
|
1094
1089
|
})
|
|
1095
1090
|
});
|
|
@@ -1110,15 +1105,15 @@ var G = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, children: r
|
|
|
1110
1105
|
disabled: i
|
|
1111
1106
|
});
|
|
1112
1107
|
return y === "list" ? /* @__PURE__ */ p("div", {
|
|
1113
|
-
className:
|
|
1108
|
+
className: J.count,
|
|
1114
1109
|
children: [n, /* @__PURE__ */ f("span", {
|
|
1115
|
-
className:
|
|
1110
|
+
className: J.countValue,
|
|
1116
1111
|
children: o
|
|
1117
1112
|
})]
|
|
1118
1113
|
}) : n;
|
|
1119
1114
|
}
|
|
1120
1115
|
default: return y === "list" ? /* @__PURE__ */ p("div", {
|
|
1121
|
-
className:
|
|
1116
|
+
className: J.count,
|
|
1122
1117
|
children: [/* @__PURE__ */ f(h, {
|
|
1123
1118
|
label: t,
|
|
1124
1119
|
score: "",
|
|
@@ -1126,7 +1121,7 @@ var G = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, children: r
|
|
|
1126
1121
|
onChange: s,
|
|
1127
1122
|
disabled: i
|
|
1128
1123
|
}), /* @__PURE__ */ f("span", {
|
|
1129
|
-
className:
|
|
1124
|
+
className: J.countValue,
|
|
1130
1125
|
children: o
|
|
1131
1126
|
})]
|
|
1132
1127
|
}) : /* @__PURE__ */ f(h, {
|
|
@@ -1142,22 +1137,22 @@ var G = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, children: r
|
|
|
1142
1137
|
title: t,
|
|
1143
1138
|
collapsible: s,
|
|
1144
1139
|
collapsed: s ? u : !1,
|
|
1145
|
-
className: b &&
|
|
1140
|
+
className: b && U.length > 0 ? J.active : void 0,
|
|
1146
1141
|
children: /* @__PURE__ */ p("ul", {
|
|
1147
|
-
className: y === "grid" ?
|
|
1142
|
+
className: y === "grid" ? J.grid : J.list,
|
|
1148
1143
|
style: {
|
|
1149
1144
|
listStyle: "none",
|
|
1150
1145
|
padding: 0,
|
|
1151
1146
|
margin: 0
|
|
1152
1147
|
},
|
|
1153
|
-
children: [
|
|
1154
|
-
let e = K.length -
|
|
1148
|
+
children: [ne.map(([e, t]) => /* @__PURE__ */ f("li", { children: re(e, t) }, e)), q && B < K.length && (() => {
|
|
1149
|
+
let e = K.length - B, t = Math.min(50, e);
|
|
1155
1150
|
return /* @__PURE__ */ f("li", {
|
|
1156
|
-
className:
|
|
1151
|
+
className: J.toggleItem,
|
|
1157
1152
|
children: /* @__PURE__ */ f(m, {
|
|
1158
1153
|
variant: "ghost",
|
|
1159
1154
|
size: "micro",
|
|
1160
|
-
onClick: () =>
|
|
1155
|
+
onClick: () => V((e) => e + 50),
|
|
1161
1156
|
children: `Show ${t} more of ${K.length} total`
|
|
1162
1157
|
})
|
|
1163
1158
|
});
|
|
@@ -1197,234 +1192,239 @@ function se(e, t, n) {
|
|
|
1197
1192
|
let r = t + Math.round((e - t) / n) * n;
|
|
1198
1193
|
return Number(r.toFixed(ae(n)));
|
|
1199
1194
|
}
|
|
1200
|
-
|
|
1201
|
-
let
|
|
1195
|
+
function ce(e, t, n) {
|
|
1196
|
+
let r = Math.ceil(Number(((e - t) / n).toFixed(6)));
|
|
1197
|
+
return Number((t + r * n).toFixed(ae(n)));
|
|
1198
|
+
}
|
|
1199
|
+
var le = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, control: a, displayType: o, showActivePanel: s = !1, collapsible: c = !0, startCollapsed: l = !1, showHistogram: u = !1, resolution: d, step: m, stepMarks: h }) => {
|
|
1200
|
+
let { state: { rangeFilters: v, rangeBounds: y, facetStats: b, facets: S, filterableFields: C, facetableFields: w, query: T, facetDebounceDelayMillis: E }, setRangeFilter: D, resetRangeFilter: O, allowEmptySearch: k, isFetchingInitial: A } = L(), j = a ?? o ?? "input", M = y?.[t] !== void 0, N = y?.[t] ?? {
|
|
1202
1201
|
min: r,
|
|
1203
1202
|
max: i
|
|
1204
|
-
},
|
|
1203
|
+
}, P = N.min, F = N.max, I = b?.[t] ?? N, R = Math.max(P, Math.min(F, I.min)), z = Math.max(P, Math.min(F, I.max)), B = e.useMemo(() => {
|
|
1205
1204
|
if (m) return m;
|
|
1206
|
-
let e = Math.max(ae(
|
|
1205
|
+
let e = Math.max(ae(P), ae(F)), n = S?.[t];
|
|
1207
1206
|
if (Array.isArray(n)) for (let t of n) e = Math.max(e, ae(Number(t.key)));
|
|
1208
1207
|
return e === 0 ? 1 : Number((10 ** -e).toFixed(e));
|
|
1209
1208
|
}, [
|
|
1210
1209
|
m,
|
|
1211
|
-
N,
|
|
1212
1210
|
P,
|
|
1211
|
+
F,
|
|
1213
1212
|
S,
|
|
1214
1213
|
t
|
|
1215
|
-
]),
|
|
1216
|
-
let e = ae(
|
|
1217
|
-
return { width: `calc(${Math.max(3,
|
|
1214
|
+
]), V = M && P === F, H = V ? r : P, U = V ? i : F, W = ce(U + B, H, B), ee = (e) => Math.min(W, Math.max(H, e)), G = v?.[t], te = s && G !== void 0 ? X.active : void 0, K = G ? G.min : P, q = G ? G.max : F, ne = G !== void 0, re = R !== P || z !== F, [J, Y] = e.useState([K, q]), [oe, le] = e.useState(!1), [Q, ue] = e.useState(!1), [de, $] = e.useState(String(K)), [fe, pe] = e.useState(String(q)), me = e.useMemo(() => {
|
|
1215
|
+
let e = ae(B);
|
|
1216
|
+
return { width: `calc(${Math.max(3, P.toFixed(e).length, F.toFixed(e).length, de.length, fe.length) + 1}ch + 20px)` };
|
|
1218
1217
|
}, [
|
|
1219
|
-
|
|
1220
|
-
N,
|
|
1218
|
+
B,
|
|
1221
1219
|
P,
|
|
1222
|
-
|
|
1223
|
-
|
|
1220
|
+
F,
|
|
1221
|
+
de,
|
|
1222
|
+
fe
|
|
1224
1223
|
]);
|
|
1225
1224
|
e.useEffect(() => {
|
|
1226
|
-
|
|
1227
|
-
}, [
|
|
1228
|
-
let { finalMin:
|
|
1229
|
-
let [e, t] =
|
|
1225
|
+
$(String(J[0])), pe(String(J[1]));
|
|
1226
|
+
}, [J]);
|
|
1227
|
+
let { finalMin: he, finalMax: ge, isValidMin: _e, isValidMax: ve } = e.useMemo(() => {
|
|
1228
|
+
let [e, t] = J, n = Math.max(P, Math.min(F, e)), r = Math.max(P, Math.min(F, t)), i = Math.min(n, r), a = Math.max(n, r);
|
|
1230
1229
|
return {
|
|
1231
1230
|
finalMin: i,
|
|
1232
1231
|
finalMax: a,
|
|
1233
|
-
isValidMin: i >=
|
|
1234
|
-
isValidMax: a <=
|
|
1232
|
+
isValidMin: i >= P && i <= a,
|
|
1233
|
+
isValidMax: a <= F && a >= i
|
|
1235
1234
|
};
|
|
1236
1235
|
}, [
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1236
|
+
J,
|
|
1237
|
+
P,
|
|
1238
|
+
F
|
|
1240
1239
|
]);
|
|
1241
1240
|
e.useEffect(() => {
|
|
1242
|
-
if (
|
|
1243
|
-
if (
|
|
1244
|
-
|
|
1241
|
+
if (V) return;
|
|
1242
|
+
if (J[0] === P && J[1] === F) {
|
|
1243
|
+
le(!1), ue(!1);
|
|
1245
1244
|
return;
|
|
1246
1245
|
}
|
|
1247
1246
|
let e = E ?? 500, n = setTimeout(() => {
|
|
1248
|
-
|
|
1247
|
+
le(!_e), ue(!ve);
|
|
1249
1248
|
}, 300), r = setTimeout(() => {
|
|
1250
|
-
|
|
1249
|
+
_e && ve && (he === P && ge === F ? O(t, !1) : D(t, he, ge));
|
|
1251
1250
|
}, e);
|
|
1252
1251
|
return () => {
|
|
1253
1252
|
clearTimeout(n), clearTimeout(r);
|
|
1254
1253
|
};
|
|
1255
1254
|
}, [
|
|
1256
|
-
fe,
|
|
1257
|
-
pe,
|
|
1258
|
-
me,
|
|
1259
1255
|
he,
|
|
1260
|
-
|
|
1256
|
+
ge,
|
|
1257
|
+
_e,
|
|
1258
|
+
ve,
|
|
1261
1259
|
P,
|
|
1260
|
+
F,
|
|
1262
1261
|
t,
|
|
1263
1262
|
O,
|
|
1264
1263
|
D,
|
|
1265
1264
|
E,
|
|
1266
|
-
|
|
1265
|
+
V
|
|
1267
1266
|
]), e.useEffect(() => {
|
|
1268
|
-
|
|
1267
|
+
Y([K, q]), le(!1), ue(!1);
|
|
1269
1268
|
}, [
|
|
1270
|
-
|
|
1271
|
-
|
|
1269
|
+
K,
|
|
1270
|
+
q,
|
|
1272
1271
|
t
|
|
1273
1272
|
]);
|
|
1274
|
-
let
|
|
1275
|
-
let t = Z(Math.min(e[0], e[1] -
|
|
1276
|
-
return [t, Z(Math.max(e[1] -
|
|
1277
|
-
}, [
|
|
1278
|
-
if (
|
|
1279
|
-
let [t, n] =
|
|
1280
|
-
|
|
1273
|
+
let ye = e.useCallback((e) => {
|
|
1274
|
+
let t = Z(Math.min(e[0], e[1] - B), B);
|
|
1275
|
+
return [t, Z(Math.max(e[1] - B, t), B)];
|
|
1276
|
+
}, [B]), be = e.useCallback((e) => {
|
|
1277
|
+
if (V) return;
|
|
1278
|
+
let [t, n] = ye(e);
|
|
1279
|
+
Y([Math.max(P, Math.min(z, t)), Math.max(R, Math.min(F, n))]);
|
|
1281
1280
|
}, [
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
N,
|
|
1281
|
+
V,
|
|
1282
|
+
ye,
|
|
1285
1283
|
P,
|
|
1286
|
-
|
|
1287
|
-
R
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1284
|
+
F,
|
|
1285
|
+
R,
|
|
1286
|
+
z
|
|
1287
|
+
]), xe = e.useCallback((e) => {
|
|
1288
|
+
if (V) return;
|
|
1289
|
+
let [n, r] = ye(e), i = Math.max(P, Math.min(z, n)), a = Math.max(R, Math.min(F, r));
|
|
1290
|
+
i === P && a === F ? (Y([P, F]), O(t, !0)) : Y([i, a]);
|
|
1292
1291
|
}, [
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
N,
|
|
1292
|
+
V,
|
|
1293
|
+
ye,
|
|
1296
1294
|
P,
|
|
1297
|
-
|
|
1295
|
+
F,
|
|
1298
1296
|
R,
|
|
1297
|
+
z,
|
|
1299
1298
|
t,
|
|
1300
1299
|
O
|
|
1301
|
-
]),
|
|
1302
|
-
if (
|
|
1303
|
-
let r =
|
|
1304
|
-
if (
|
|
1305
|
-
|
|
1300
|
+
]), Se = e.useRef(null), Ce = e.useCallback((e, n) => {
|
|
1301
|
+
if (V) return;
|
|
1302
|
+
let r = Se.current;
|
|
1303
|
+
if (G && r && r.start === e && r.last === n) {
|
|
1304
|
+
Se.current = null, Y([P, F]), O(t, !0);
|
|
1306
1305
|
return;
|
|
1307
1306
|
}
|
|
1308
|
-
let i = se(Math.max(
|
|
1309
|
-
|
|
1307
|
+
let i = se(Math.max(P, R, e), P, B), a = Math.max(i, se(Math.min(F, z, n), P, B));
|
|
1308
|
+
Se.current = {
|
|
1310
1309
|
start: e,
|
|
1311
1310
|
last: n
|
|
1312
|
-
},
|
|
1311
|
+
}, Y([i, a]);
|
|
1313
1312
|
}, [
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
N,
|
|
1313
|
+
V,
|
|
1314
|
+
G,
|
|
1317
1315
|
P,
|
|
1318
|
-
|
|
1316
|
+
F,
|
|
1319
1317
|
R,
|
|
1320
1318
|
z,
|
|
1319
|
+
B,
|
|
1321
1320
|
t,
|
|
1322
1321
|
O
|
|
1323
|
-
]),
|
|
1324
|
-
if (
|
|
1325
|
-
let e =
|
|
1322
|
+
]), we = e.useCallback(() => {
|
|
1323
|
+
if (V) return;
|
|
1324
|
+
let e = de.trim(), t = e === "" ? NaN : Number(e);
|
|
1326
1325
|
if (isNaN(t)) {
|
|
1327
|
-
|
|
1326
|
+
$(String(J[0]));
|
|
1328
1327
|
return;
|
|
1329
1328
|
}
|
|
1330
|
-
let n = Math.max(
|
|
1331
|
-
n <
|
|
1329
|
+
let n = Math.max(P, Math.min(z, t));
|
|
1330
|
+
n < J[1] ? Y([n, J[1]]) : Y([P, J[1]]), $(String(n < J[1] ? n : P));
|
|
1332
1331
|
}, [
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
]),
|
|
1339
|
-
if (
|
|
1340
|
-
let e =
|
|
1332
|
+
V,
|
|
1333
|
+
de,
|
|
1334
|
+
J,
|
|
1335
|
+
P,
|
|
1336
|
+
z
|
|
1337
|
+
]), Te = e.useCallback(() => {
|
|
1338
|
+
if (V) return;
|
|
1339
|
+
let e = fe.trim(), t = e === "" ? NaN : Number(e);
|
|
1341
1340
|
if (isNaN(t)) {
|
|
1342
|
-
|
|
1341
|
+
pe(String(J[1]));
|
|
1343
1342
|
return;
|
|
1344
1343
|
}
|
|
1345
|
-
let n = Math.max(
|
|
1346
|
-
n >
|
|
1344
|
+
let n = Math.max(R, Math.min(F, t));
|
|
1345
|
+
n > J[0] ? Y([J[0], n]) : Y([J[0], F]), pe(String(n > J[0] ? n : F));
|
|
1347
1346
|
}, [
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
]),
|
|
1347
|
+
V,
|
|
1348
|
+
fe,
|
|
1349
|
+
J,
|
|
1350
|
+
R,
|
|
1351
|
+
F
|
|
1352
|
+
]), Ee = (e) => (t) => {
|
|
1354
1353
|
t.key === "Enter" && e();
|
|
1355
|
-
}, [
|
|
1354
|
+
}, [De, Oe] = e.useState(null), ke = e.useRef(null);
|
|
1356
1355
|
e.useEffect(() => {
|
|
1357
1356
|
if (!u) return;
|
|
1358
|
-
let e = `${
|
|
1359
|
-
if (e ===
|
|
1357
|
+
let e = `${P}:${F}`;
|
|
1358
|
+
if (e === ke.current && ke.current !== null) return;
|
|
1360
1359
|
let n = S?.[t];
|
|
1361
1360
|
if (!Array.isArray(n) || n.length === 0) return;
|
|
1362
1361
|
let r = n.filter((e) => e.value != null && !isNaN(Number(e.key))).map((e) => ({
|
|
1363
1362
|
key: e.key,
|
|
1364
1363
|
value: e.value
|
|
1365
1364
|
}));
|
|
1366
|
-
r.length > 0 && (
|
|
1365
|
+
r.length > 0 && (ke.current = e, Oe(r));
|
|
1367
1366
|
}, [
|
|
1368
|
-
N,
|
|
1369
1367
|
P,
|
|
1368
|
+
F,
|
|
1370
1369
|
S,
|
|
1371
1370
|
t,
|
|
1372
1371
|
u
|
|
1373
1372
|
]);
|
|
1374
|
-
let
|
|
1375
|
-
if (!u || !
|
|
1376
|
-
let e =
|
|
1373
|
+
let Ae = e.useMemo(() => {
|
|
1374
|
+
if (!u || !De || De.length === 0) return [];
|
|
1375
|
+
let e = F - P;
|
|
1377
1376
|
if (e <= 0) return [];
|
|
1378
|
-
let t = d ?? (Math.ceil(e / 20)
|
|
1377
|
+
let t = d ?? Math.max(B, Z(Math.ceil(e / 20 / B) * B, B)), n = Math.ceil(e / t);
|
|
1379
1378
|
return Array.from({ length: n }, (e, r) => {
|
|
1380
|
-
let i =
|
|
1379
|
+
let i = P + r * t, a = P + (r + 1) * t, o = r === n - 1, s = De.filter((e) => {
|
|
1381
1380
|
let t = Number(e.key);
|
|
1382
|
-
return t >= i && (t < a || o && t <=
|
|
1383
|
-
}).reduce((e, t) => e + t.value, 0), c = o ?
|
|
1381
|
+
return t >= i && (t < a || o && t <= F);
|
|
1382
|
+
}).reduce((e, t) => e + t.value, 0), c = o ? F : Z(a - B, B);
|
|
1384
1383
|
return {
|
|
1385
1384
|
bucketStart: i,
|
|
1386
1385
|
bucketEnd: a,
|
|
1387
1386
|
count: s,
|
|
1388
1387
|
last: c,
|
|
1389
|
-
barEnd: Z(c +
|
|
1388
|
+
barEnd: Z(c + B, B)
|
|
1390
1389
|
};
|
|
1391
1390
|
}).map((e, t, n) => ({
|
|
1392
1391
|
...e,
|
|
1393
|
-
span: (t + 1 < n.length ? n[t + 1].bucketStart : e.barEnd) - e.bucketStart
|
|
1392
|
+
span: (t + 1 < n.length ? n[t + 1].bucketStart : Math.max(e.barEnd, W)) - e.bucketStart
|
|
1394
1393
|
}));
|
|
1395
1394
|
}, [
|
|
1396
1395
|
u,
|
|
1397
|
-
|
|
1398
|
-
N,
|
|
1396
|
+
De,
|
|
1399
1397
|
P,
|
|
1398
|
+
F,
|
|
1400
1399
|
d,
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1400
|
+
B,
|
|
1401
|
+
W
|
|
1402
|
+
]), je = e.useMemo(() => Math.max(...Ae.map((e) => e.count), 1), [Ae]);
|
|
1403
|
+
return u && !A && !w?.includes(t) && console.warn(`RangeFilterPanel: showHistogram=true but field "${t}" is not facetable. Add .Facetable = true to this field.`), A ? /* @__PURE__ */ f(ie, {
|
|
1404
1404
|
title: n,
|
|
1405
1405
|
variant: "slider",
|
|
1406
1406
|
withHistogram: u,
|
|
1407
1407
|
collapsible: c,
|
|
1408
1408
|
startCollapsed: l
|
|
1409
|
-
}) : !k && !T ? null : C?.includes(t) ?
|
|
1409
|
+
}) : !k && !T ? null : C?.includes(t) ? j === "slider" ? /* @__PURE__ */ p(g, {
|
|
1410
1410
|
title: n,
|
|
1411
1411
|
collapsed: l,
|
|
1412
1412
|
collapsible: c,
|
|
1413
1413
|
className: te,
|
|
1414
1414
|
children: [
|
|
1415
|
-
|
|
1415
|
+
V && /* @__PURE__ */ p("div", {
|
|
1416
1416
|
className: X.disabledMessage,
|
|
1417
1417
|
children: [
|
|
1418
1418
|
"No adjustable range (all results have the same value: ",
|
|
1419
|
-
|
|
1419
|
+
P,
|
|
1420
1420
|
")."
|
|
1421
1421
|
]
|
|
1422
1422
|
}),
|
|
1423
|
-
u &&
|
|
1424
|
-
u &&
|
|
1425
|
-
let [e, t] =
|
|
1423
|
+
u && Ae.length === 0 && /* @__PURE__ */ f("div", { className: X.histogram }),
|
|
1424
|
+
u && Ae.length > 0 && (() => {
|
|
1425
|
+
let [e, t] = z > R && (R > P || z < F) ? [R, z] : [H, U], n = Math.max(he, e), r = Math.min(ge, t), i = W, a = i - H || 1, o = (e) => Math.max(0, Math.min(1, (e - H) / a)), s = (e) => e >= U ? 0 : Math.max(0, Math.min(1, (i - (e + B)) / a)), c = o(n), l = r < n ? 1 - c : s(r), u = (e) => `calc(10px + (100% - 20px) * ${e})`, d = `inset(0 ${u(l)} 0 ${u(c)})`, m = `inset(0 ${u(s(t))} 0 ${u(o(e))})`, h = (n) => n.last < e || n.bucketStart > t, g = Ae.slice(1).map((e) => u((e.bucketStart - H) / a)), _ = Ae.map((e) => ({
|
|
1426
1426
|
...e,
|
|
1427
|
-
height: Math.max(1, Math.ceil(e.count /
|
|
1427
|
+
height: Math.max(1, Math.ceil(e.count / je * 20))
|
|
1428
1428
|
}));
|
|
1429
1429
|
return /* @__PURE__ */ p("div", {
|
|
1430
1430
|
className: X.histogram,
|
|
@@ -1436,10 +1436,10 @@ var ce = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
1436
1436
|
className: X.histogramBar,
|
|
1437
1437
|
style: { flexGrow: e.span },
|
|
1438
1438
|
"data-testid": "histogram-bar",
|
|
1439
|
-
disabled:
|
|
1439
|
+
disabled: V || h(e),
|
|
1440
1440
|
"aria-label": `${e.bucketStart} to ${e.last}: ${e.count}`,
|
|
1441
1441
|
title: `${e.bucketStart} to ${e.last}: ${e.count}`,
|
|
1442
|
-
onClick: () =>
|
|
1442
|
+
onClick: () => Ce(e.bucketStart, e.last),
|
|
1443
1443
|
children: /* @__PURE__ */ f("span", {
|
|
1444
1444
|
className: X.histogramFill,
|
|
1445
1445
|
style: { height: `${e.height}px` }
|
|
@@ -1488,19 +1488,19 @@ var ce = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
1488
1488
|
/* @__PURE__ */ f("div", {
|
|
1489
1489
|
style: { padding: "10px 10px 20px 10px" },
|
|
1490
1490
|
children: /* @__PURE__ */ f(x, {
|
|
1491
|
-
min:
|
|
1492
|
-
max:
|
|
1493
|
-
step:
|
|
1491
|
+
min: H,
|
|
1492
|
+
max: W,
|
|
1493
|
+
step: B,
|
|
1494
1494
|
stepMarks: h,
|
|
1495
|
-
value:
|
|
1495
|
+
value: V ? [H, W] : [ee(se(he, H, B)), ee(se(ge + B, H, B))],
|
|
1496
1496
|
isRange: !0,
|
|
1497
|
-
onChange: (e) =>
|
|
1498
|
-
onFinalChange: (e) =>
|
|
1499
|
-
disabled:
|
|
1500
|
-
activeMin:
|
|
1501
|
-
activeMax: Z(
|
|
1502
|
-
isFaceted:
|
|
1503
|
-
highlightFaceted:
|
|
1497
|
+
onChange: (e) => be(e),
|
|
1498
|
+
onFinalChange: (e) => xe(e),
|
|
1499
|
+
disabled: V,
|
|
1500
|
+
activeMin: R,
|
|
1501
|
+
activeMax: ee(Z(z + B, B)),
|
|
1502
|
+
isFaceted: re,
|
|
1503
|
+
highlightFaceted: ne,
|
|
1504
1504
|
"aria-label": n || `Filter by ${t}`
|
|
1505
1505
|
})
|
|
1506
1506
|
}),
|
|
@@ -1514,38 +1514,38 @@ var ce = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
1514
1514
|
children: [/* @__PURE__ */ f(_, {
|
|
1515
1515
|
label: "Min:",
|
|
1516
1516
|
type: "number",
|
|
1517
|
-
style:
|
|
1518
|
-
value:
|
|
1519
|
-
min:
|
|
1520
|
-
max: Z(Math.min(
|
|
1521
|
-
onChange: (e) =>
|
|
1522
|
-
onBlur:
|
|
1523
|
-
onKeyDown:
|
|
1524
|
-
disabled:
|
|
1525
|
-
isValid:
|
|
1517
|
+
style: me,
|
|
1518
|
+
value: V ? String(P) : de,
|
|
1519
|
+
min: P,
|
|
1520
|
+
max: Z(Math.min(z, J[1] - B), B),
|
|
1521
|
+
onChange: (e) => $(e.target.value),
|
|
1522
|
+
onBlur: we,
|
|
1523
|
+
onKeyDown: Ee(we),
|
|
1524
|
+
disabled: V,
|
|
1525
|
+
isValid: V || !oe
|
|
1526
1526
|
}), /* @__PURE__ */ f(_, {
|
|
1527
1527
|
label: "Max:",
|
|
1528
1528
|
type: "number",
|
|
1529
|
-
style:
|
|
1530
|
-
value:
|
|
1531
|
-
min: Z(Math.max(
|
|
1532
|
-
max:
|
|
1533
|
-
onChange: (e) =>
|
|
1534
|
-
onBlur:
|
|
1535
|
-
onKeyDown:
|
|
1536
|
-
disabled:
|
|
1537
|
-
isValid:
|
|
1529
|
+
style: me,
|
|
1530
|
+
value: V ? String(F) : fe,
|
|
1531
|
+
min: Z(Math.max(R, J[0] + B), B),
|
|
1532
|
+
max: F,
|
|
1533
|
+
onChange: (e) => pe(e.target.value),
|
|
1534
|
+
onBlur: Te,
|
|
1535
|
+
onKeyDown: Ee(Te),
|
|
1536
|
+
disabled: V,
|
|
1537
|
+
isValid: V || !Q
|
|
1538
1538
|
})]
|
|
1539
1539
|
})
|
|
1540
1540
|
]
|
|
1541
1541
|
}) : /* @__PURE__ */ p(g, {
|
|
1542
1542
|
title: n,
|
|
1543
1543
|
className: te,
|
|
1544
|
-
children: [
|
|
1544
|
+
children: [V && /* @__PURE__ */ p("div", {
|
|
1545
1545
|
className: X.disabledMessage,
|
|
1546
1546
|
children: [
|
|
1547
1547
|
"No adjustable range (all results have the same value: ",
|
|
1548
|
-
|
|
1548
|
+
P,
|
|
1549
1549
|
")."
|
|
1550
1550
|
]
|
|
1551
1551
|
}), /* @__PURE__ */ p("div", {
|
|
@@ -1557,27 +1557,27 @@ var ce = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
1557
1557
|
children: [/* @__PURE__ */ f(_, {
|
|
1558
1558
|
label: "Min:",
|
|
1559
1559
|
type: "number",
|
|
1560
|
-
style:
|
|
1561
|
-
value:
|
|
1562
|
-
min:
|
|
1563
|
-
max: Z(Math.min(
|
|
1564
|
-
onChange: (e) =>
|
|
1565
|
-
onBlur:
|
|
1566
|
-
onKeyDown:
|
|
1567
|
-
disabled:
|
|
1568
|
-
isValid:
|
|
1560
|
+
style: me,
|
|
1561
|
+
value: V ? String(P) : de,
|
|
1562
|
+
min: P,
|
|
1563
|
+
max: Z(Math.min(z, J[1] - B), B),
|
|
1564
|
+
onChange: (e) => $(e.target.value),
|
|
1565
|
+
onBlur: we,
|
|
1566
|
+
onKeyDown: Ee(we),
|
|
1567
|
+
disabled: V,
|
|
1568
|
+
isValid: V || !oe
|
|
1569
1569
|
}), /* @__PURE__ */ f(_, {
|
|
1570
1570
|
label: "Max:",
|
|
1571
1571
|
type: "number",
|
|
1572
|
-
style:
|
|
1573
|
-
value:
|
|
1574
|
-
min: Z(Math.max(
|
|
1575
|
-
max:
|
|
1576
|
-
onChange: (e) =>
|
|
1577
|
-
onBlur:
|
|
1578
|
-
onKeyDown:
|
|
1579
|
-
disabled:
|
|
1580
|
-
isValid:
|
|
1572
|
+
style: me,
|
|
1573
|
+
value: V ? String(F) : fe,
|
|
1574
|
+
min: Z(Math.max(R, J[0] + B), B),
|
|
1575
|
+
max: F,
|
|
1576
|
+
onChange: (e) => pe(e.target.value),
|
|
1577
|
+
onBlur: Te,
|
|
1578
|
+
onKeyDown: Ee(Te),
|
|
1579
|
+
disabled: V,
|
|
1580
|
+
isValid: V || !Q
|
|
1581
1581
|
})]
|
|
1582
1582
|
})]
|
|
1583
1583
|
}) : /* @__PURE__ */ f(g, {
|
|
@@ -1605,7 +1605,7 @@ var ce = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
1605
1605
|
};
|
|
1606
1606
|
//#endregion
|
|
1607
1607
|
//#region src/components/BucketFilterPanel.tsx
|
|
1608
|
-
function
|
|
1608
|
+
function ue(e, t) {
|
|
1609
1609
|
if (!t) return null;
|
|
1610
1610
|
let n = 0, r = !1;
|
|
1611
1611
|
for (let i of t) {
|
|
@@ -1617,17 +1617,17 @@ function le(e, t) {
|
|
|
1617
1617
|
}
|
|
1618
1618
|
return r ? n : 0;
|
|
1619
1619
|
}
|
|
1620
|
-
var
|
|
1621
|
-
let { state: { facets: S, filterableFields: C, facetableFields: w, bucketFilters: T, rangeBounds: E, facetStats: D, query: O }, toggleBucketFilter: k, isFetchingInitial: A, allowEmptySearch:
|
|
1620
|
+
var de = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a, layout: c = "list", showCount: u = !0, showEmpty: d = !1, limit: _, showActivePanel: y = !1, collapsible: b = !0, startCollapsed: x = !1 }) => {
|
|
1621
|
+
let { state: { facets: S, filterableFields: C, facetableFields: w, bucketFilters: T, rangeBounds: E, facetStats: D, query: O }, toggleBucketFilter: k, isFetchingInitial: A, allowEmptySearch: j } = L(), M = i ?? a ?? "checkbox", N = S?.[e], P = T[e] ?? [], [F, I] = l(_ ?? Infinity);
|
|
1622
1622
|
o(() => {
|
|
1623
|
-
|
|
1624
|
-
}, [_,
|
|
1625
|
-
let
|
|
1623
|
+
I(_ ?? Infinity);
|
|
1624
|
+
}, [_, N]);
|
|
1625
|
+
let R = E?.[e] ?? D?.[e], z = s(() => {
|
|
1626
1626
|
let e = [];
|
|
1627
|
-
if (
|
|
1627
|
+
if (R && e.push(R.min, R.max), Array.isArray(N)) for (let t of N) e.push(Number(t.key));
|
|
1628
1628
|
return oe(e.filter(Number.isFinite));
|
|
1629
|
-
}, [
|
|
1630
|
-
let e =
|
|
1629
|
+
}, [R, N]), B = s(() => {
|
|
1630
|
+
let e = R?.min ?? -Number.MAX_VALUE, t = R?.max ?? Number.MAX_VALUE, i = (n, r, i) => ({
|
|
1631
1631
|
label: i ?? (n === void 0 ? `up to ${r}` : r === void 0 ? `${n} and up` : `${n}-${r}`),
|
|
1632
1632
|
range: {
|
|
1633
1633
|
min: n ?? e,
|
|
@@ -1638,28 +1638,28 @@ var ue = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
1638
1638
|
if (r && r.length > 0) return r.map((e) => i(e.min, e.max, e.label));
|
|
1639
1639
|
if (Array.isArray(n)) {
|
|
1640
1640
|
let e = [...n].sort((e, t) => e - t), t = [];
|
|
1641
|
-
for (let n = 0; n < e.length - 1; n++) t.push(i(e[n], Z(e[n + 1] -
|
|
1641
|
+
for (let n = 0; n < e.length - 1; n++) t.push(i(e[n], Z(e[n + 1] - z, z)));
|
|
1642
1642
|
return t;
|
|
1643
1643
|
}
|
|
1644
|
-
if (typeof n == "number" && n > 0 &&
|
|
1645
|
-
let e = [], t = Math.floor(
|
|
1646
|
-
for (let r = t; r <=
|
|
1644
|
+
if (typeof n == "number" && n > 0 && R) {
|
|
1645
|
+
let e = [], t = Math.floor(R.min / n) * n;
|
|
1646
|
+
for (let r = t; r <= R.max; r = Z(r + n, z)) e.push(i(Z(r, z), Z(r + n - z, z)));
|
|
1647
1647
|
return e;
|
|
1648
1648
|
}
|
|
1649
1649
|
return [];
|
|
1650
1650
|
}, [
|
|
1651
1651
|
r,
|
|
1652
1652
|
n,
|
|
1653
|
-
|
|
1654
|
-
|
|
1653
|
+
R,
|
|
1654
|
+
z
|
|
1655
1655
|
]);
|
|
1656
|
-
if (A || !S) return /* @__PURE__ */ f(
|
|
1656
|
+
if (A || !S) return /* @__PURE__ */ f(ie, {
|
|
1657
1657
|
title: t,
|
|
1658
|
-
rows: Math.max(1, Math.min(
|
|
1658
|
+
rows: Math.max(1, Math.min(B.length || 5, 8)),
|
|
1659
1659
|
collapsible: b,
|
|
1660
1660
|
startCollapsed: x
|
|
1661
1661
|
});
|
|
1662
|
-
if (!
|
|
1662
|
+
if (!j && !O) return null;
|
|
1663
1663
|
if (!C?.includes(e)) return /* @__PURE__ */ f(g, {
|
|
1664
1664
|
collapsible: !1,
|
|
1665
1665
|
children: /* @__PURE__ */ p("div", {
|
|
@@ -1671,14 +1671,14 @@ var ue = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
1671
1671
|
]
|
|
1672
1672
|
})
|
|
1673
1673
|
});
|
|
1674
|
-
let
|
|
1674
|
+
let V = w?.includes(e) && Array.isArray(N), H = (e) => P.some((t) => t.min === e.range.min && t.max === e.range.max), U = B.map((e) => ({
|
|
1675
1675
|
bucket: e,
|
|
1676
|
-
count:
|
|
1676
|
+
count: V ? ue(e, N) : null
|
|
1677
1677
|
}));
|
|
1678
|
-
if (d || (
|
|
1679
|
-
let
|
|
1680
|
-
let r =
|
|
1681
|
-
if (
|
|
1678
|
+
if (d || (U = U.filter((e) => e.count !== 0 || H(e.bucket))), U.length === 0) return null;
|
|
1679
|
+
let W = U.slice(0, F), ee = (t, n) => {
|
|
1680
|
+
let r = H(t), i = n === 0 && !r, a = u && (n ?? 0) > 0 ? `${n}` : "", o = () => k(e, t.range, M === "radio");
|
|
1681
|
+
if (M === "radio") {
|
|
1682
1682
|
let n = /* @__PURE__ */ f(v, {
|
|
1683
1683
|
id: `${e}-${t.range.min}-${t.range.max}`,
|
|
1684
1684
|
name: e,
|
|
@@ -1696,7 +1696,7 @@ var ue = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
1696
1696
|
})]
|
|
1697
1697
|
}) : n;
|
|
1698
1698
|
}
|
|
1699
|
-
if (
|
|
1699
|
+
if (M === "button") {
|
|
1700
1700
|
let e = /* @__PURE__ */ f(m, {
|
|
1701
1701
|
variant: r ? "primary" : "secondary",
|
|
1702
1702
|
onClick: o,
|
|
@@ -1737,7 +1737,7 @@ var ue = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
1737
1737
|
title: t,
|
|
1738
1738
|
collapsible: b,
|
|
1739
1739
|
collapsed: b ? x : !1,
|
|
1740
|
-
className: y &&
|
|
1740
|
+
className: y && P.length > 0 ? Q.active : void 0,
|
|
1741
1741
|
children: /* @__PURE__ */ p("ul", {
|
|
1742
1742
|
className: c === "grid" ? Q.grid : Q.list,
|
|
1743
1743
|
style: {
|
|
@@ -1745,11 +1745,11 @@ var ue = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
1745
1745
|
padding: 0,
|
|
1746
1746
|
margin: 0
|
|
1747
1747
|
},
|
|
1748
|
-
children: [
|
|
1748
|
+
children: [W.map(({ bucket: e, count: t }) => /* @__PURE__ */ f("li", { children: ee(e, t) }, `${e.range.min}-${e.range.max}`)), W.length < U.length && /* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(m, {
|
|
1749
1749
|
variant: "ghost",
|
|
1750
1750
|
size: "micro",
|
|
1751
|
-
onClick: () =>
|
|
1752
|
-
children: `Show ${
|
|
1751
|
+
onClick: () => I(U.length),
|
|
1752
|
+
children: `Show ${U.length - W.length} more of ${U.length} total`
|
|
1753
1753
|
}) })]
|
|
1754
1754
|
})
|
|
1755
1755
|
});
|
|
@@ -1757,7 +1757,7 @@ var ue = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
1757
1757
|
grid: "_grid_1xjna_2",
|
|
1758
1758
|
chip: "_chip_1xjna_21",
|
|
1759
1759
|
chipLabel: "_chipLabel_1xjna_32"
|
|
1760
|
-
},
|
|
1760
|
+
}, fe = r(({ field: e, value: t, onReset: n }) => /* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(m, {
|
|
1761
1761
|
onClick: n,
|
|
1762
1762
|
iconRight: /* @__PURE__ */ f(E, {}),
|
|
1763
1763
|
variant: "primary",
|
|
@@ -1772,7 +1772,7 @@ var ue = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
1772
1772
|
t
|
|
1773
1773
|
]
|
|
1774
1774
|
})
|
|
1775
|
-
}) })),
|
|
1775
|
+
}) })), pe = r(({ field: e, min: t, max: n, onReset: r }) => /* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(m, {
|
|
1776
1776
|
onClick: r,
|
|
1777
1777
|
iconRight: /* @__PURE__ */ f(E, {}),
|
|
1778
1778
|
variant: "primary",
|
|
@@ -1789,7 +1789,7 @@ var ue = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
1789
1789
|
n
|
|
1790
1790
|
]
|
|
1791
1791
|
})
|
|
1792
|
-
}) })),
|
|
1792
|
+
}) })), me = r(({ field: e, label: t, onReset: n }) => /* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(m, {
|
|
1793
1793
|
onClick: n,
|
|
1794
1794
|
iconRight: /* @__PURE__ */ f(E, {}),
|
|
1795
1795
|
variant: "primary",
|
|
@@ -1805,8 +1805,8 @@ var ue = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
1805
1805
|
]
|
|
1806
1806
|
})
|
|
1807
1807
|
}) }));
|
|
1808
|
-
function
|
|
1809
|
-
let { state: { filters: e, rangeFilters: t, bucketFilters: n }, resetFilters: r, resetSingleFilter: i, resetRangeFilter: a, resetBucketFilter: o } =
|
|
1808
|
+
function he() {
|
|
1809
|
+
let { state: { filters: e, rangeFilters: t, bucketFilters: n }, resetFilters: r, resetSingleFilter: i, resetRangeFilter: a, resetBucketFilter: o } = L(), c = s(() => Object.entries(e).map(([e, t]) => t.map((t) => ({
|
|
1810
1810
|
field: e,
|
|
1811
1811
|
value: t
|
|
1812
1812
|
}))).flat(), [e]), l = s(() => Object.entries(t).map(([e, { min: t, max: n }]) => ({
|
|
@@ -1828,18 +1828,18 @@ function me() {
|
|
|
1828
1828
|
children: /* @__PURE__ */ p("ul", {
|
|
1829
1829
|
className: $.grid,
|
|
1830
1830
|
children: [
|
|
1831
|
-
c.map(({ field: e, value: t }) => /* @__PURE__ */ f(
|
|
1831
|
+
c.map(({ field: e, value: t }) => /* @__PURE__ */ f(fe, {
|
|
1832
1832
|
field: e,
|
|
1833
1833
|
value: t,
|
|
1834
1834
|
onReset: () => i(e, t)
|
|
1835
1835
|
}, `${e}-${t}`)),
|
|
1836
|
-
l.map(({ field: e, min: t, max: n }) => /* @__PURE__ */ f(
|
|
1836
|
+
l.map(({ field: e, min: t, max: n }) => /* @__PURE__ */ f(pe, {
|
|
1837
1837
|
field: e,
|
|
1838
1838
|
min: t,
|
|
1839
1839
|
max: n,
|
|
1840
1840
|
onReset: () => a(e)
|
|
1841
1841
|
}, e)),
|
|
1842
|
-
u.map(({ field: e, range: t, label: n }) => /* @__PURE__ */ f(
|
|
1842
|
+
u.map(({ field: e, range: t, label: n }) => /* @__PURE__ */ f(me, {
|
|
1843
1843
|
field: e,
|
|
1844
1844
|
label: n,
|
|
1845
1845
|
onReset: () => o(e, t)
|
|
@@ -1854,72 +1854,104 @@ function me() {
|
|
|
1854
1854
|
})
|
|
1855
1855
|
}) : null;
|
|
1856
1856
|
}
|
|
1857
|
-
var
|
|
1857
|
+
var ge = {
|
|
1858
1858
|
select: "_select_nwf7i_1",
|
|
1859
1859
|
radioGroup: "_radioGroup_nwf7i_6"
|
|
1860
|
-
},
|
|
1861
|
-
let
|
|
1862
|
-
if (
|
|
1860
|
+
}, _e = ({ options: e, noneLabel: t = "None", control: n, displayType: r, collapsible: i = !0, startCollapsed: a = !1 }) => {
|
|
1861
|
+
let o = n ?? (r === "radio" ? "radio" : "select"), { state: { sortableFields: s, sortBy: c, sortAscending: l }, setSort: u, isFetchingInitial: d } = L();
|
|
1862
|
+
if (d) return /* @__PURE__ */ f(ie, {
|
|
1863
1863
|
title: "Sort by",
|
|
1864
|
-
rows:
|
|
1865
|
-
collapsible:
|
|
1866
|
-
startCollapsed:
|
|
1864
|
+
rows: o === "radio" ? 3 : 1,
|
|
1865
|
+
collapsible: i,
|
|
1866
|
+
startCollapsed: a
|
|
1867
1867
|
});
|
|
1868
|
-
if (!
|
|
1869
|
-
let
|
|
1870
|
-
label:
|
|
1871
|
-
value: "
|
|
1872
|
-
}
|
|
1868
|
+
if (!s || s.length === 0) return null;
|
|
1869
|
+
let p = c ? `${c}:${l ? "asc" : "desc"}` : "none", m = e ? e.filter((e) => s.includes(e.field) ? !0 : (console.warn(`[SortByPanel] '${e.field}' is not sortable, so "${e.label}" is left out. Mark the field Sortable in the dataset's field configuration.`), !1)).map((e) => ({
|
|
1870
|
+
label: e.label,
|
|
1871
|
+
value: `${e.field}:${e.ascending ? "asc" : "desc"}`
|
|
1872
|
+
})) : s.flatMap((e) => [{
|
|
1873
1873
|
label: `${e} (asc)`,
|
|
1874
1874
|
value: `${e}:asc`
|
|
1875
1875
|
}, {
|
|
1876
1876
|
label: `${e} (desc)`,
|
|
1877
1877
|
value: `${e}:desc`
|
|
1878
|
-
}])
|
|
1879
|
-
|
|
1878
|
+
}]), h = t === null ? m : [{
|
|
1879
|
+
label: t,
|
|
1880
|
+
value: "none"
|
|
1881
|
+
}, ...m], _ = (e) => {
|
|
1882
|
+
if (e === "none" || e === "") u(null, !0);
|
|
1880
1883
|
else {
|
|
1881
1884
|
let [t, n] = e.split(":");
|
|
1882
|
-
|
|
1885
|
+
u(t, n === "asc");
|
|
1883
1886
|
}
|
|
1884
1887
|
};
|
|
1885
1888
|
return /* @__PURE__ */ f(g, {
|
|
1886
1889
|
title: "Sort by",
|
|
1887
|
-
collapsible:
|
|
1888
|
-
collapsed:
|
|
1889
|
-
children:
|
|
1890
|
-
value:
|
|
1891
|
-
onValueChange:
|
|
1892
|
-
options:
|
|
1890
|
+
collapsible: i,
|
|
1891
|
+
collapsed: i ? a : !1,
|
|
1892
|
+
children: o === "select" ? /* @__PURE__ */ f(b, {
|
|
1893
|
+
value: p,
|
|
1894
|
+
onValueChange: _,
|
|
1895
|
+
options: h,
|
|
1893
1896
|
placeholder: "Select sort...",
|
|
1894
1897
|
"aria-label": "Sort by"
|
|
1895
1898
|
}) : /* @__PURE__ */ f("div", {
|
|
1896
|
-
className:
|
|
1897
|
-
children:
|
|
1899
|
+
className: ge.radioGroup,
|
|
1900
|
+
children: h.map((e) => /* @__PURE__ */ f(v, {
|
|
1898
1901
|
id: `sort-${e.value}`,
|
|
1899
1902
|
name: "sort-by",
|
|
1900
1903
|
value: e.value,
|
|
1901
1904
|
label: e.label,
|
|
1902
|
-
checked:
|
|
1903
|
-
onChange: (e) =>
|
|
1905
|
+
checked: p === e.value,
|
|
1906
|
+
onChange: (e) => _(e.target.value)
|
|
1904
1907
|
}, e.value))
|
|
1905
1908
|
})
|
|
1906
1909
|
});
|
|
1907
|
-
},
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1910
|
+
}, ve = { list: "_list_1y4fk_1" }, ye = {
|
|
1911
|
+
coverageDepth: 500,
|
|
1912
|
+
coverWholeQuery: !0,
|
|
1913
|
+
coverWholeWords: !0,
|
|
1914
|
+
coverFuzzyWords: !0,
|
|
1915
|
+
coverJoinedWords: !0,
|
|
1916
|
+
coverPrefixSuffix: !0,
|
|
1917
|
+
truncate: !0,
|
|
1918
|
+
includePatternMatches: !0,
|
|
1919
|
+
minWordSize: 2,
|
|
1920
|
+
levenshteinMaxWordSize: 20,
|
|
1921
|
+
truncateWordHitLimit: 1,
|
|
1922
|
+
truncateWordHitTolerance: 0,
|
|
1923
|
+
truncationScore: 65024
|
|
1924
|
+
};
|
|
1925
|
+
function be() {
|
|
1926
|
+
let { state: { searchSettings: e }, setSearchSettings: t, url: n, team: r, dataset: i, authenticatedFetch: a } = L(), [s, c] = l(!1), [u, h] = l(null);
|
|
1927
|
+
o(() => {
|
|
1928
|
+
let e = !0;
|
|
1929
|
+
try {
|
|
1930
|
+
a(`${n}/api/teams/${r}/datasets/${i}/query-parameters`).then((e) => e.ok ? e.json() : null).then((t) => {
|
|
1931
|
+
e && t?.effective && h(t.effective);
|
|
1932
|
+
}).catch(() => {});
|
|
1933
|
+
} catch {}
|
|
1934
|
+
return () => {
|
|
1935
|
+
e = !1;
|
|
1936
|
+
};
|
|
1937
|
+
}, [
|
|
1938
|
+
n,
|
|
1939
|
+
r,
|
|
1940
|
+
i,
|
|
1941
|
+
a
|
|
1942
|
+
]);
|
|
1943
|
+
let v = e.coverageSetup, y = (e) => v[e] !== void 0 && v[e] !== null, b = (e) => v[e] ?? u?.coverageSetup?.[e] ?? ye[e], T = e.coverageDepth ?? u?.coverageDepth ?? ye.coverageDepth, E = u ? "dataset" : "default", D = (e, t) => t ? e : `${e} (${E})`, O = e.coverageDepth !== void 0 || Object.keys(v).some((e) => y(e)), k = (e, n) => {
|
|
1912
1944
|
let r = parseInt(n, 10);
|
|
1913
1945
|
isNaN(r) || t({ [e]: r });
|
|
1914
|
-
},
|
|
1946
|
+
}, A = (e, n) => {
|
|
1915
1947
|
t({ [e]: n });
|
|
1916
|
-
},
|
|
1948
|
+
}, j = (n, r) => {
|
|
1917
1949
|
let i = parseInt(r, 10);
|
|
1918
1950
|
isNaN(i) || t({ coverageSetup: {
|
|
1919
1951
|
...e.coverageSetup,
|
|
1920
1952
|
[n]: i
|
|
1921
1953
|
} });
|
|
1922
|
-
},
|
|
1954
|
+
}, M = (n, r) => {
|
|
1923
1955
|
t({ coverageSetup: {
|
|
1924
1956
|
...e.coverageSetup,
|
|
1925
1957
|
[n]: r
|
|
@@ -1929,19 +1961,19 @@ function ve() {
|
|
|
1929
1961
|
collapsed: !0,
|
|
1930
1962
|
title: "Settings",
|
|
1931
1963
|
children: /* @__PURE__ */ p("ul", {
|
|
1932
|
-
className:
|
|
1964
|
+
className: ve.list,
|
|
1933
1965
|
children: [
|
|
1934
1966
|
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(_, {
|
|
1935
1967
|
label: "Max Results",
|
|
1936
1968
|
type: "number",
|
|
1937
1969
|
value: e.maxNumberOfRecordsToReturn.toString(),
|
|
1938
|
-
onChange: (e) =>
|
|
1970
|
+
onChange: (e) => k("maxNumberOfRecordsToReturn", e.target.value)
|
|
1939
1971
|
}) }),
|
|
1940
1972
|
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(_, {
|
|
1941
|
-
label: "Coverage Depth",
|
|
1973
|
+
label: D("Coverage Depth", e.coverageDepth !== void 0),
|
|
1942
1974
|
type: "number",
|
|
1943
|
-
value:
|
|
1944
|
-
onChange: (e) =>
|
|
1975
|
+
value: T.toString(),
|
|
1976
|
+
onChange: (e) => k("coverageDepth", e.target.value)
|
|
1945
1977
|
}) }),
|
|
1946
1978
|
/* @__PURE__ */ p("li", { children: [/* @__PURE__ */ f(_, {
|
|
1947
1979
|
label: "Minimum Score (16 bit)",
|
|
@@ -1977,84 +2009,93 @@ function ve() {
|
|
|
1977
2009
|
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(S, {
|
|
1978
2010
|
label: "Show score",
|
|
1979
2011
|
checked: e.showScore,
|
|
1980
|
-
onChange: (e) =>
|
|
2012
|
+
onChange: (e) => A("showScore", e)
|
|
1981
2013
|
}) }),
|
|
1982
2014
|
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(S, {
|
|
1983
2015
|
label: "Enable Coverage",
|
|
1984
2016
|
checked: e.enableCoverage,
|
|
1985
|
-
onChange: (e) =>
|
|
2017
|
+
onChange: (e) => A("enableCoverage", e)
|
|
1986
2018
|
}) }),
|
|
1987
2019
|
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(S, {
|
|
1988
2020
|
label: "Remove Duplicates",
|
|
1989
2021
|
checked: e.removeDuplicates,
|
|
1990
|
-
onChange: (e) =>
|
|
2022
|
+
onChange: (e) => A("removeDuplicates", e)
|
|
1991
2023
|
}) }),
|
|
1992
2024
|
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(m, {
|
|
1993
2025
|
variant: "ghost",
|
|
1994
2026
|
size: "micro",
|
|
1995
|
-
iconRight: f(
|
|
1996
|
-
onClick: () =>
|
|
1997
|
-
children:
|
|
2027
|
+
iconRight: f(s ? C : w, {}),
|
|
2028
|
+
onClick: () => c((e) => !e),
|
|
2029
|
+
children: s ? "Hide Coverage Setup" : "Show Coverage Setup"
|
|
1998
2030
|
}) }),
|
|
1999
|
-
|
|
2031
|
+
s && /* @__PURE__ */ p(d, { children: [
|
|
2000
2032
|
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(S, {
|
|
2001
|
-
label: "Cover Whole Query",
|
|
2002
|
-
checked:
|
|
2003
|
-
onChange: (e) =>
|
|
2033
|
+
label: D("Cover Whole Query", y("coverWholeQuery")),
|
|
2034
|
+
checked: b("coverWholeQuery"),
|
|
2035
|
+
onChange: (e) => M("coverWholeQuery", e)
|
|
2004
2036
|
}) }),
|
|
2005
2037
|
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(S, {
|
|
2006
|
-
label: "Cover Whole Words",
|
|
2007
|
-
checked:
|
|
2008
|
-
onChange: (e) =>
|
|
2038
|
+
label: D("Cover Whole Words", y("coverWholeWords")),
|
|
2039
|
+
checked: b("coverWholeWords"),
|
|
2040
|
+
onChange: (e) => M("coverWholeWords", e)
|
|
2009
2041
|
}) }),
|
|
2010
2042
|
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(S, {
|
|
2011
|
-
label: "Cover Fuzzy Words",
|
|
2012
|
-
checked:
|
|
2013
|
-
onChange: (e) =>
|
|
2043
|
+
label: D("Cover Fuzzy Words", y("coverFuzzyWords")),
|
|
2044
|
+
checked: b("coverFuzzyWords"),
|
|
2045
|
+
onChange: (e) => M("coverFuzzyWords", e)
|
|
2014
2046
|
}) }),
|
|
2015
2047
|
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(S, {
|
|
2016
|
-
label: "Cover Joined Words",
|
|
2017
|
-
checked:
|
|
2018
|
-
onChange: (e) =>
|
|
2048
|
+
label: D("Cover Joined Words", y("coverJoinedWords")),
|
|
2049
|
+
checked: b("coverJoinedWords"),
|
|
2050
|
+
onChange: (e) => M("coverJoinedWords", e)
|
|
2019
2051
|
}) }),
|
|
2020
2052
|
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(S, {
|
|
2021
|
-
label: "Cover Prefix Suffix",
|
|
2022
|
-
checked:
|
|
2023
|
-
onChange: (e) =>
|
|
2053
|
+
label: D("Cover Prefix Suffix", y("coverPrefixSuffix")),
|
|
2054
|
+
checked: b("coverPrefixSuffix"),
|
|
2055
|
+
onChange: (e) => M("coverPrefixSuffix", e)
|
|
2024
2056
|
}) }),
|
|
2025
2057
|
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(S, {
|
|
2026
|
-
label: "Truncate",
|
|
2027
|
-
checked:
|
|
2028
|
-
onChange: (e) =>
|
|
2058
|
+
label: D("Truncate", y("truncate")),
|
|
2059
|
+
checked: b("truncate"),
|
|
2060
|
+
onChange: (e) => M("truncate", e)
|
|
2029
2061
|
}) }),
|
|
2030
2062
|
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(S, {
|
|
2031
|
-
label: "Include Pattern Matches",
|
|
2032
|
-
checked:
|
|
2033
|
-
onChange: (e) =>
|
|
2063
|
+
label: D("Include Pattern Matches", y("includePatternMatches")),
|
|
2064
|
+
checked: b("includePatternMatches"),
|
|
2065
|
+
onChange: (e) => M("includePatternMatches", e)
|
|
2034
2066
|
}) }),
|
|
2035
2067
|
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(_, {
|
|
2036
|
-
label: "Levenshtein Max Word Size",
|
|
2068
|
+
label: D("Levenshtein Max Word Size", y("levenshteinMaxWordSize")),
|
|
2037
2069
|
type: "number",
|
|
2038
|
-
value:
|
|
2039
|
-
onChange: (e) =>
|
|
2070
|
+
value: b("levenshteinMaxWordSize").toString(),
|
|
2071
|
+
onChange: (e) => j("levenshteinMaxWordSize", e.target.value)
|
|
2040
2072
|
}) }),
|
|
2041
2073
|
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(_, {
|
|
2042
|
-
label: "Min Word Size",
|
|
2074
|
+
label: D("Min Word Size", y("minWordSize")),
|
|
2043
2075
|
type: "number",
|
|
2044
|
-
value:
|
|
2045
|
-
onChange: (e) =>
|
|
2076
|
+
value: b("minWordSize").toString(),
|
|
2077
|
+
onChange: (e) => j("minWordSize", e.target.value)
|
|
2046
2078
|
}) }),
|
|
2047
2079
|
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(_, {
|
|
2048
|
-
label: "Truncate Word Hit Limit",
|
|
2080
|
+
label: D("Truncate Word Hit Limit", y("truncateWordHitLimit")),
|
|
2049
2081
|
type: "number",
|
|
2050
|
-
value:
|
|
2051
|
-
onChange: (e) =>
|
|
2082
|
+
value: b("truncateWordHitLimit").toString(),
|
|
2083
|
+
onChange: (e) => j("truncateWordHitLimit", e.target.value)
|
|
2052
2084
|
}) }),
|
|
2053
2085
|
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(_, {
|
|
2054
|
-
label: "Truncate Word Hit Tolerance",
|
|
2086
|
+
label: D("Truncate Word Hit Tolerance", y("truncateWordHitTolerance")),
|
|
2055
2087
|
type: "number",
|
|
2056
|
-
value:
|
|
2057
|
-
onChange: (e) =>
|
|
2088
|
+
value: b("truncateWordHitTolerance").toString(),
|
|
2089
|
+
onChange: (e) => j("truncateWordHitTolerance", e.target.value)
|
|
2090
|
+
}) }),
|
|
2091
|
+
O && /* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(m, {
|
|
2092
|
+
variant: "ghost",
|
|
2093
|
+
size: "micro",
|
|
2094
|
+
onClick: () => t({
|
|
2095
|
+
coverageSetup: void 0,
|
|
2096
|
+
coverageDepth: void 0
|
|
2097
|
+
}),
|
|
2098
|
+
children: "Use the dataset's values"
|
|
2058
2099
|
}) })
|
|
2059
2100
|
] })
|
|
2060
2101
|
]
|
|
@@ -2063,7 +2104,7 @@ function ve() {
|
|
|
2063
2104
|
}
|
|
2064
2105
|
//#endregion
|
|
2065
2106
|
//#region src/components/SearchErrorBoundary.tsx
|
|
2066
|
-
var
|
|
2107
|
+
var xe = class extends t {
|
|
2067
2108
|
constructor(e) {
|
|
2068
2109
|
super(e), this.state = {
|
|
2069
2110
|
hasError: !1,
|
|
@@ -2145,8 +2186,8 @@ var ye = class extends t {
|
|
|
2145
2186
|
};
|
|
2146
2187
|
//#endregion
|
|
2147
2188
|
//#region src/hooks/useVectorSearch.ts
|
|
2148
|
-
function
|
|
2149
|
-
let { url: n, team: r, dataset: a, authenticatedFetch: o } =
|
|
2189
|
+
function Se(e, t) {
|
|
2190
|
+
let { url: n, team: r, dataset: a, authenticatedFetch: o } = L(), [s, c] = l(null), [u, d] = l(!1), [f, p] = l(void 0);
|
|
2150
2191
|
return {
|
|
2151
2192
|
results: s,
|
|
2152
2193
|
isLoading: u,
|
|
@@ -2201,8 +2242,8 @@ function be(e, t) {
|
|
|
2201
2242
|
}
|
|
2202
2243
|
//#endregion
|
|
2203
2244
|
//#region src/hooks/useHybridSearch.ts
|
|
2204
|
-
function
|
|
2205
|
-
let { url: n, team: r, dataset: a, authenticatedFetch: o } =
|
|
2245
|
+
function Ce(e, t) {
|
|
2246
|
+
let { url: n, team: r, dataset: a, authenticatedFetch: o } = L(), [s, c] = l(null), [u, d] = l(!1), [f, p] = l(void 0);
|
|
2206
2247
|
return {
|
|
2207
2248
|
results: s,
|
|
2208
2249
|
isLoading: u,
|
|
@@ -2260,4 +2301,4 @@ function xe(e, t) {
|
|
|
2260
2301
|
};
|
|
2261
2302
|
}
|
|
2262
2303
|
//#endregion
|
|
2263
|
-
export {
|
|
2304
|
+
export { he as ActiveFiltersPanel, de as BucketFilterPanel, ie as FilterPanelSkeleton, O as IndxApiError, le as RangeFilterPanel, F as SearchContext, xe as SearchErrorBoundary, R as SearchInput, I as SearchProvider, V as SearchResult, q as SearchResultRow, te as SearchResults, W as SearchResultsSkeleton, be as SearchSettingsPanel, _e as SortByPanel, Y as ValueFilterPanel, Ce as useHybridSearch, L as useSearch, L as useSearchContext, Se as useVectorSearch };
|