@indxsearch/intrface 3.13.2 β 3.15.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 +36 -0
- package/dist/components/AskPanel.d.ts +4 -0
- package/dist/components/QuickAnswer.d.ts +20 -0
- package/dist/components/SearchInput.d.ts +14 -8
- package/dist/context/SearchContext.d.ts +4 -0
- package/dist/hooks/useAsk.d.ts +3 -1
- package/dist/hooks/useSearchOrAsk.d.ts +44 -2
- package/dist/index.cjs.js +3 -3
- package/dist/index.d.ts +3 -1
- package/dist/index.es.js +1017 -828
- package/dist/intrface.css +1 -1
- package/dist/utils/searchOrAsk.d.ts +23 -3
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -2,10 +2,10 @@ import "@indxsearch/systm/styles.css";
|
|
|
2
2
|
import e, { Component as t, createContext as n, memo as r, useCallback as i, useContext as a, useEffect as o, useMemo as s, useRef as c, useState as l } from "react";
|
|
3
3
|
import { SystemState as u } from "@indxsearch/indx-types";
|
|
4
4
|
import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
5
|
-
import { Alert as m, AlertDescription as h, AlertTitle as g, AnswerActions as _, AssistantMessage as v, Button as y, Checkbox as b, Chip as x, CitationList as S, CitationRef as C, Composer as w, FilterPanelBase as T, InputField as E, Kbd as D,
|
|
6
|
-
import { Ai_agent as
|
|
7
|
-
|
|
8
|
-
var
|
|
5
|
+
import { Alert as m, AlertDescription as h, AlertTitle as g, AnswerActions as _, AssistantMessage as v, Button as y, Checkbox as b, Chip as x, CitationList as S, CitationRef as C, Composer as w, FilterPanelBase as T, InputField as E, Kbd as D, Popover as O, RadioButton as k, SearchField as A, Select as j, ShimmerText as M, Skeleton as N, Slider as P, StreamStatus as F, ToggleSwitch as I, Tooltip as L, UserMessage as R } from "@indxsearch/systm";
|
|
6
|
+
import { Ai_agent as z, ArrowDown as B, ArrowRight as V, Cloud as H, Filter as U, Fuzzy_search as W, Hour_glass as ee, Indx as G, Key as te, Lock as K, Refresh as ne, Search as re, Speedometer as ie, Warning as q, X_or_error as J } from "@indxsearch/pixl";
|
|
7
|
+
// src/context/IndxApiError.ts
|
|
8
|
+
var Y = class e extends Error {
|
|
9
9
|
status;
|
|
10
10
|
code;
|
|
11
11
|
problem;
|
|
@@ -29,14 +29,14 @@ var q = class e extends Error {
|
|
|
29
29
|
let i = n.headers?.get?.("Retry-After"), a = i != null && /^\d+$/.test(i) ? Number(i) : void 0;
|
|
30
30
|
return new e(t, n.status, r, a);
|
|
31
31
|
}
|
|
32
|
-
},
|
|
32
|
+
}, X = class extends Error {
|
|
33
33
|
constructor(e) {
|
|
34
34
|
super(e), this.name = "SearchSetupError";
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
function ae(e, t) {
|
|
38
38
|
let n = e instanceof Error ? e.message : String(e);
|
|
39
|
-
if (e instanceof
|
|
39
|
+
if (e instanceof X) return {
|
|
40
40
|
kind: "setup",
|
|
41
41
|
message: n,
|
|
42
42
|
technical: n,
|
|
@@ -48,7 +48,7 @@ function ae(e, t) {
|
|
|
48
48
|
technical: "Network error: no response from the server. Check that it is running and that the url is right.",
|
|
49
49
|
retryable: !0
|
|
50
50
|
};
|
|
51
|
-
if (e instanceof
|
|
51
|
+
if (e instanceof Y) {
|
|
52
52
|
let r = {
|
|
53
53
|
message: n,
|
|
54
54
|
status: e.status,
|
|
@@ -113,17 +113,16 @@ function ae(e, t) {
|
|
|
113
113
|
retryable: !0
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
|
-
|
|
117
|
-
//#region src/context/useIndxAuth.ts
|
|
116
|
+
// src/context/useIndxAuth.ts
|
|
118
117
|
function oe({ url: e, team: t, dataset: n, preAuthenticatedToken: r, enableDebugLogs: i = !1 }) {
|
|
119
118
|
let [a, s] = l(null), [c, d] = l(!0), [f, p] = l([]), [m, h] = l([]), [g, _] = l([]), [v, y] = l({}), [b, x] = l({}), [S, C] = l({}), [w, T] = l(0), [E, D] = l(null), [O, k] = l(null), [A, j] = l(0);
|
|
120
119
|
return o(() => {
|
|
121
120
|
(async () => {
|
|
122
121
|
D(null), k(null), d(!0);
|
|
123
122
|
try {
|
|
124
|
-
if (!r) throw console.error("[Auth] β Missing bearer token"), console.error("[Auth] π‘ Pass preAuthenticatedToken to SearchProvider (create a token on the Indx Dashboard)"), new
|
|
125
|
-
if (!e) throw console.error("[Auth] β Missing INDX server URL"), console.error("[Auth] π‘ Pass a url to SearchProvider"), new
|
|
126
|
-
if (!n) throw console.error("[Auth] β Missing dataset name"), console.error("[Auth] π‘ Pass dataset=\"your-dataset-name\" to SearchProvider"), new
|
|
123
|
+
if (!r) throw console.error("[Auth] β Missing bearer token"), console.error("[Auth] π‘ Pass preAuthenticatedToken to SearchProvider (create a token on the Indx Dashboard)"), new X("A bearer token is required. Check console for instructions.");
|
|
124
|
+
if (!e) throw console.error("[Auth] β Missing INDX server URL"), console.error("[Auth] π‘ Pass a url to SearchProvider"), new X("INDX server URL is required. Check console for instructions.");
|
|
125
|
+
if (!n) throw console.error("[Auth] β Missing dataset name"), console.error("[Auth] π‘ Pass dataset=\"your-dataset-name\" to SearchProvider"), new X("Dataset name is required. Check console for instructions.");
|
|
127
126
|
i && console.log("[Auth] β
Using bearer token");
|
|
128
127
|
let a = r, o = (e) => fetch(e, {
|
|
129
128
|
method: "GET",
|
|
@@ -134,7 +133,7 @@ function oe({ url: e, team: t, dataset: n, preAuthenticatedToken: r, enableDebug
|
|
|
134
133
|
});
|
|
135
134
|
i && console.log("[Auth] π Checking dataset status...");
|
|
136
135
|
let c = await o(`${e}/api/teams/${t}/datasets/${n}/status`);
|
|
137
|
-
if (!c.ok) throw c.status === 401 ? (console.error("[Auth] β Authentication failed (401 Unauthorized)"), console.error("[Auth] π‘ Your token may be expired or invalid"), console.error("[Auth] π‘ Create or refresh your token on the Indx Dashboard"), await
|
|
136
|
+
if (!c.ok) throw c.status === 401 ? (console.error("[Auth] β Authentication failed (401 Unauthorized)"), console.error("[Auth] π‘ Your token may be expired or invalid"), console.error("[Auth] π‘ Create or refresh your token on the Indx Dashboard"), await Y.fromResponse("Dataset status", c)) : c.status === 404 ? (console.error("[Auth] β Dataset \"" + n + "\" not found (404)"), console.error("[Auth] π‘ Available datasets can be checked with: curl -X GET \"" + e + "/api/me/datasets\" -H \"Authorization: Bearer YOUR_TOKEN\""), console.error("[Auth] π‘ Make sure you spelled the dataset name correctly"), await Y.fromResponse("Dataset status", c)) : (console.error("[Auth] β Failed to get dataset status:", c.status), await Y.fromResponse("Dataset status", c));
|
|
138
137
|
let l = await c.json();
|
|
139
138
|
i && console.log("[Auth] π Dataset status:", l), s(a), i && console.log("[Auth] β
Dataset session established"), l.systemState !== void 0 && l.systemState !== u.Ready && (console.warn("[Auth] β οΈ Dataset is not ready yet. Current state:", u[l.systemState]), console.warn("[Auth] π‘ Wait for indexing to complete before searching"));
|
|
140
139
|
let d = l.documentCount ?? l.numberOfRecords ?? 0;
|
|
@@ -145,9 +144,9 @@ function oe({ url: e, team: t, dataset: n, preAuthenticatedToken: r, enableDebug
|
|
|
145
144
|
o(`${e}/api/teams/${t}/datasets/${n}/fields/sortable`),
|
|
146
145
|
o(`${e}/api/teams/${t}/datasets/${n}/fields/configuration`).catch(() => null)
|
|
147
146
|
]);
|
|
148
|
-
if (!f.ok) throw console.error("[Auth] β GetFilterableFields failed:", f.status), await
|
|
149
|
-
if (!m.ok) throw console.error("[Auth] β GetFacetableFields failed:", m.status), await
|
|
150
|
-
if (!g.ok) throw console.error("[Auth] β GetSortableFields failed:", g.status), await
|
|
147
|
+
if (!f.ok) throw console.error("[Auth] β GetFilterableFields failed:", f.status), await Y.fromResponse("Filterable fields", f);
|
|
148
|
+
if (!m.ok) throw console.error("[Auth] β GetFacetableFields failed:", m.status), await Y.fromResponse("Facetable fields", m);
|
|
149
|
+
if (!g.ok) throw console.error("[Auth] β GetSortableFields failed:", g.status), await Y.fromResponse("Sortable fields", g);
|
|
151
150
|
let [b, S, w] = await Promise.all([
|
|
152
151
|
f.json().catch((e) => (console.error("Failed to parse GetFilterableFields response:", e), [])),
|
|
153
152
|
m.json().catch((e) => (console.error("Failed to parse GetFacetableFields response:", e), [])),
|
|
@@ -220,15 +219,14 @@ function oe({ url: e, team: t, dataset: n, preAuthenticatedToken: r, enableDebug
|
|
|
220
219
|
totalDocumentCount: w
|
|
221
220
|
};
|
|
222
221
|
}
|
|
223
|
-
|
|
224
|
-
//#region src/context/buildFilterProxy.ts
|
|
222
|
+
// src/context/buildFilterProxy.ts
|
|
225
223
|
async function se(e, t, n, r, i, a, o) {
|
|
226
224
|
let s = await o(`${r}/api/teams/${i}/datasets/${a}/filters/${e}`, {
|
|
227
225
|
method: "POST",
|
|
228
226
|
headers: { "Content-Type": "application/json" },
|
|
229
227
|
body: JSON.stringify(t)
|
|
230
228
|
});
|
|
231
|
-
if (!s.ok) throw await
|
|
229
|
+
if (!s.ok) throw await Y.fromResponse(n, s);
|
|
232
230
|
let c = await s.json();
|
|
233
231
|
if (!c || typeof c.hashString != "string") throw Error(`${n} failed: server returned no filter token`);
|
|
234
232
|
return c;
|
|
@@ -269,8 +267,7 @@ async function le(e, t, n, r, i, a, o = {}, s = {}, c = {}) {
|
|
|
269
267
|
...g
|
|
270
268
|
], "and", n, r, i, a);
|
|
271
269
|
}
|
|
272
|
-
|
|
273
|
-
//#region src/context/useSearchExecution.ts
|
|
270
|
+
// src/context/useSearchExecution.ts
|
|
274
271
|
function ue(e, t) {
|
|
275
272
|
let n, r = (...r) => {
|
|
276
273
|
clearTimeout(n), n = setTimeout(() => e(...r), t);
|
|
@@ -313,7 +310,7 @@ function de({ state: e, setState: t, authenticatedFetch: n, auth: r, url: a, tea
|
|
|
313
310
|
i = !0;
|
|
314
311
|
}
|
|
315
312
|
try {
|
|
316
|
-
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([le(e.filters, e.rangeFilters, a, s, u, n, e.valueMatch, e.bucketFilters, e.fieldTypes), ...c.map((t) => le({
|
|
313
|
+
let c = i ? Array.from(/* @__PURE__ */ 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([le(e.filters, e.rangeFilters, a, s, u, n, e.valueMatch, e.bucketFilters, e.fieldTypes), ...c.map((t) => le({
|
|
317
314
|
...e.filters,
|
|
318
315
|
[t]: []
|
|
319
316
|
}, e.rangeFilters, a, s, u, n, e.valueMatch, {
|
|
@@ -348,11 +345,11 @@ function de({ state: e, setState: t, authenticatedFetch: n, auth: r, url: a, tea
|
|
|
348
345
|
enableFacets: !0,
|
|
349
346
|
...e ? { filter: e } : {}
|
|
350
347
|
}))]);
|
|
351
|
-
if (!V.ok) throw await
|
|
348
|
+
if (!V.ok) throw await Y.fromResponse("Search", V);
|
|
352
349
|
let U = await V.json(), W = V.headers.get("Indx-Query-Id") ?? void 0, ee = U.truncationIndex ?? -1, G = {};
|
|
353
350
|
for (let e = 0; e < c.length; e++) {
|
|
354
351
|
let t = c[e];
|
|
355
|
-
if (!H[e].ok) throw await
|
|
352
|
+
if (!H[e].ok) throw await Y.fromResponse(`Facets for '${t}'`, H[e]);
|
|
356
353
|
let n = await H[e].json();
|
|
357
354
|
n.facets?.[t] !== void 0 && (G[t] = n.facets[t]);
|
|
358
355
|
}
|
|
@@ -363,7 +360,7 @@ function de({ state: e, setState: t, authenticatedFetch: n, auth: r, url: a, tea
|
|
|
363
360
|
headers: { "Content-Type": "application/json" },
|
|
364
361
|
body: JSON.stringify(K)
|
|
365
362
|
});
|
|
366
|
-
if (!e.ok) throw await
|
|
363
|
+
if (!e.ok) throw await Y.fromResponse("Document lookup", e);
|
|
367
364
|
re = (await e.json()).map((e, t) => ({
|
|
368
365
|
document: e,
|
|
369
366
|
documentKey: K[t],
|
|
@@ -381,14 +378,14 @@ function de({ state: e, setState: t, authenticatedFetch: n, auth: r, url: a, tea
|
|
|
381
378
|
}
|
|
382
379
|
}
|
|
383
380
|
if (o !== S.current) return;
|
|
384
|
-
let
|
|
385
|
-
if (
|
|
381
|
+
let q = b !== D, J = b !== k, X = e.facetStats ?? {};
|
|
382
|
+
if (q ? (X = {
|
|
386
383
|
...r.initialFacetStats,
|
|
387
384
|
...ie
|
|
388
|
-
}, E(
|
|
385
|
+
}, E(X), O(b)) : X = {
|
|
389
386
|
...T,
|
|
390
387
|
...ie
|
|
391
|
-
},
|
|
388
|
+
}, J && i) {
|
|
392
389
|
let n = { ...e.rangeBounds };
|
|
393
390
|
for (let [e, t] of Object.entries(ie)) n[e] = t;
|
|
394
391
|
t((e) => ({
|
|
@@ -396,33 +393,33 @@ function de({ state: e, setState: t, authenticatedFetch: n, auth: r, url: a, tea
|
|
|
396
393
|
rangeBounds: n
|
|
397
394
|
})), A(b);
|
|
398
395
|
}
|
|
399
|
-
let
|
|
396
|
+
let ae = Object.keys(G).length > 0 ? {
|
|
400
397
|
...U.facets ?? {},
|
|
401
398
|
...G
|
|
402
399
|
} : U.facets;
|
|
403
|
-
if (i && (!
|
|
404
|
-
|
|
405
|
-
for (let [e, t] of Object.entries(r.initialFacetKeys))
|
|
400
|
+
if (i && (!ae || Object.keys(ae).length === 0)) {
|
|
401
|
+
ae = {};
|
|
402
|
+
for (let [e, t] of Object.entries(r.initialFacetKeys)) ae[e] = t.map((e) => ({
|
|
406
403
|
key: e,
|
|
407
404
|
value: null
|
|
408
405
|
}));
|
|
409
406
|
}
|
|
410
|
-
let
|
|
407
|
+
let oe = re.filter((e) => {
|
|
411
408
|
let t = b.trim();
|
|
412
|
-
return t === "" || t.length === 1
|
|
409
|
+
return t === "" || t.length === 1 || e.score >= F;
|
|
413
410
|
}).map((e, t) => ({
|
|
414
411
|
...e,
|
|
415
412
|
position: t + 1
|
|
416
413
|
}));
|
|
417
414
|
t((e) => ({
|
|
418
415
|
...e,
|
|
419
|
-
results:
|
|
416
|
+
results: oe,
|
|
420
417
|
error: void 0,
|
|
421
418
|
errorInfo: void 0,
|
|
422
419
|
resultsSuppressed: !m,
|
|
423
420
|
...i ? {
|
|
424
|
-
facets:
|
|
425
|
-
facetStats:
|
|
421
|
+
facets: ae,
|
|
422
|
+
facetStats: X
|
|
426
423
|
} : {},
|
|
427
424
|
isLoading: !1,
|
|
428
425
|
truncationIndex: ee,
|
|
@@ -494,14 +491,11 @@ function de({ state: e, setState: t, authenticatedFetch: n, auth: r, url: a, tea
|
|
|
494
491
|
]), o(() => {
|
|
495
492
|
if (!r.token || !w.current) return;
|
|
496
493
|
let n = b.trim(), i = n === "" && d;
|
|
497
|
-
if (n === "" && !d) {
|
|
498
|
-
e
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
return;
|
|
503
|
-
}
|
|
504
|
-
return i ? (B.current?.cancel(), C.current?.({ enableFacets: f })) : f ? (p && console.log("Search fired"), C.current?.({ enableFacets: !1 }), B.current?.()) : C.current?.({ enableFacets: !1 }), () => {
|
|
494
|
+
if (n === "" && !d) e.resultsSuppressed || t((e) => ({
|
|
495
|
+
...e,
|
|
496
|
+
resultsSuppressed: !0
|
|
497
|
+
}));
|
|
498
|
+
else return i ? (B.current?.cancel(), C.current?.({ enableFacets: f })) : f ? (p && console.log("Search fired"), C.current?.({ enableFacets: !1 }), B.current?.()) : C.current?.({ enableFacets: !1 }), () => {
|
|
505
499
|
B.current?.cancel();
|
|
506
500
|
};
|
|
507
501
|
}, [
|
|
@@ -511,11 +505,11 @@ function de({ state: e, setState: t, authenticatedFetch: n, auth: r, url: a, tea
|
|
|
511
505
|
]), o(() => {
|
|
512
506
|
if (!w.current || !r.token || e.filterRevision === 0) return;
|
|
513
507
|
let t = b.trim();
|
|
514
|
-
|
|
508
|
+
(d || t !== "") && C.current?.({ enableFacets: f });
|
|
515
509
|
}, [e.filterRevision]), o(() => {
|
|
516
510
|
if (!w.current || !r.token) return;
|
|
517
511
|
let e = b.trim();
|
|
518
|
-
|
|
512
|
+
(d || e !== "") && C.current?.({ enableFacets: f });
|
|
519
513
|
}, [L, R]);
|
|
520
514
|
let V = c(!0), H = c(b);
|
|
521
515
|
return o(() => {
|
|
@@ -529,7 +523,7 @@ function de({ state: e, setState: t, authenticatedFetch: n, auth: r, url: a, tea
|
|
|
529
523
|
return;
|
|
530
524
|
}
|
|
531
525
|
let e = b.trim();
|
|
532
|
-
|
|
526
|
+
(d || e !== "") && C.current?.({ enableFacets: f });
|
|
533
527
|
}, [
|
|
534
528
|
j,
|
|
535
529
|
M,
|
|
@@ -547,8 +541,7 @@ function fe() {
|
|
|
547
541
|
if (typeof document < "u" && document.documentElement.lang) return document.documentElement.lang;
|
|
548
542
|
if (typeof navigator < "u" && navigator.language) return navigator.language;
|
|
549
543
|
}
|
|
550
|
-
|
|
551
|
-
//#region src/context/SearchContext.tsx
|
|
544
|
+
// src/context/SearchContext.tsx
|
|
552
545
|
function pe() {
|
|
553
546
|
let e = globalThis.crypto;
|
|
554
547
|
return e?.randomUUID ? e.randomUUID() : Math.random().toString(36).slice(2) + Date.now().toString(36);
|
|
@@ -632,21 +625,51 @@ var me = "Type to search", he = n(void 0), ge = ({ children: e, url: t, team: n,
|
|
|
632
625
|
searchTextOf: k
|
|
633
626
|
}), R = c(void 0);
|
|
634
627
|
R.current = M.queryId;
|
|
635
|
-
let z = i(async (e) => {
|
|
636
|
-
if (F.token)
|
|
637
|
-
|
|
628
|
+
let z = c(/* @__PURE__ */ new Map()), B = i(async (e) => {
|
|
629
|
+
if (F.token) {
|
|
630
|
+
z.current.set(e.documentKey, R.current);
|
|
631
|
+
try {
|
|
632
|
+
let i = await I(`${t}/api/teams/${n}/datasets/${r}/events/select`, {
|
|
633
|
+
method: "POST",
|
|
634
|
+
headers: { "Content-Type": "application/json" },
|
|
635
|
+
body: JSON.stringify({
|
|
636
|
+
queryId: R.current,
|
|
637
|
+
documentKey: e.documentKey,
|
|
638
|
+
position: e.position,
|
|
639
|
+
...x ? {} : { count: !1 }
|
|
640
|
+
})
|
|
641
|
+
});
|
|
642
|
+
_ && (i.ok ? console.log(`[select] document ${e.documentKey} at position ${e.position}`) : console.warn(`[select] not recorded: ${i.status}`));
|
|
643
|
+
} catch (e) {
|
|
644
|
+
_ && console.warn("[select] failed:", e);
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
}, [
|
|
648
|
+
F.token,
|
|
649
|
+
I,
|
|
650
|
+
t,
|
|
651
|
+
n,
|
|
652
|
+
r,
|
|
653
|
+
_,
|
|
654
|
+
x
|
|
655
|
+
]), V = i(async (e, i, a) => {
|
|
656
|
+
if (!F.token || !i.trim()) return;
|
|
657
|
+
let o = a?.queryId ?? z.current.get(e) ?? R.current;
|
|
658
|
+
try {
|
|
659
|
+
let s = await I(`${t}/api/teams/${n}/datasets/${r}/events/convert`, {
|
|
638
660
|
method: "POST",
|
|
639
661
|
headers: { "Content-Type": "application/json" },
|
|
640
662
|
body: JSON.stringify({
|
|
641
|
-
queryId:
|
|
642
|
-
documentKey: e
|
|
643
|
-
|
|
663
|
+
queryId: o,
|
|
664
|
+
documentKey: e,
|
|
665
|
+
type: i.trim(),
|
|
666
|
+
...a?.quantity == null ? {} : { quantity: a.quantity },
|
|
644
667
|
...x ? {} : { count: !1 }
|
|
645
668
|
})
|
|
646
669
|
});
|
|
647
|
-
_ && (
|
|
670
|
+
_ && (s.ok ? console.log(`[convert] ${i} on document ${e}`) : console.warn(`[convert] not recorded: ${s.status}`));
|
|
648
671
|
} catch (e) {
|
|
649
|
-
_ && console.warn("[
|
|
672
|
+
_ && console.warn("[convert] failed:", e);
|
|
650
673
|
}
|
|
651
674
|
}, [
|
|
652
675
|
F.token,
|
|
@@ -656,7 +679,7 @@ var me = "Type to search", he = n(void 0), ge = ({ children: e, url: t, team: n,
|
|
|
656
679
|
r,
|
|
657
680
|
_,
|
|
658
681
|
x
|
|
659
|
-
]),
|
|
682
|
+
]), H = i((e) => {
|
|
660
683
|
N((t) => {
|
|
661
684
|
let n = Object.keys(t.filters).length > 0, r = Object.keys(t.rangeFilters).length > 0, i = Object.keys(t.bucketFilters).length > 0;
|
|
662
685
|
return {
|
|
@@ -671,26 +694,26 @@ var me = "Type to search", he = n(void 0), ge = ({ children: e, url: t, team: n,
|
|
|
671
694
|
}
|
|
672
695
|
};
|
|
673
696
|
});
|
|
674
|
-
}, []),
|
|
697
|
+
}, []), U = i((e) => {
|
|
675
698
|
N((t) => ({
|
|
676
699
|
...t,
|
|
677
700
|
facetDebounceDelayMillis: e
|
|
678
701
|
}));
|
|
679
|
-
}, []),
|
|
702
|
+
}, []), W = i((e) => {
|
|
680
703
|
typeof e.maxNumberOfRecordsToReturn == "number" && (j.current = e.maxNumberOfRecordsToReturn), N((t) => {
|
|
681
704
|
let n = {
|
|
682
705
|
...t.searchSettings,
|
|
683
706
|
...e
|
|
684
707
|
};
|
|
685
|
-
return "coverageSetup" in e ? e.coverageSetup ?
|
|
708
|
+
return n.coverageSetup = "coverageSetup" in e ? e.coverageSetup ? {
|
|
686
709
|
...t.searchSettings.coverageSetup,
|
|
687
710
|
...e.coverageSetup
|
|
688
|
-
} :
|
|
711
|
+
} : {} : t.searchSettings.coverageSetup, {
|
|
689
712
|
...t,
|
|
690
713
|
searchSettings: n
|
|
691
714
|
};
|
|
692
715
|
});
|
|
693
|
-
}, []),
|
|
716
|
+
}, []), ee = i((e) => {
|
|
694
717
|
C.current = !0, N((t) => ({
|
|
695
718
|
...t,
|
|
696
719
|
searchSettings: {
|
|
@@ -698,7 +721,7 @@ var me = "Type to search", he = n(void 0), ge = ({ children: e, url: t, team: n,
|
|
|
698
721
|
maxNumberOfRecordsToReturn: e
|
|
699
722
|
}
|
|
700
723
|
}));
|
|
701
|
-
}, []),
|
|
724
|
+
}, []), G = i((e, t, n = !1) => {
|
|
702
725
|
N((r) => {
|
|
703
726
|
let i = { ...r.filters }, a = i[e] || [], o = a.includes(t) ? a.filter((e) => e !== t) : n ? [t] : [...a, t];
|
|
704
727
|
return o.length ? i[e] = o : delete i[e], {
|
|
@@ -707,7 +730,7 @@ var me = "Type to search", he = n(void 0), ge = ({ children: e, url: t, team: n,
|
|
|
707
730
|
filterRevision: r.filterRevision + 1
|
|
708
731
|
};
|
|
709
732
|
});
|
|
710
|
-
}, []),
|
|
733
|
+
}, []), te = i((e, t) => {
|
|
711
734
|
N((n) => n.valueMatch[e] === t ? n : {
|
|
712
735
|
...n,
|
|
713
736
|
valueMatch: {
|
|
@@ -715,7 +738,7 @@ var me = "Type to search", he = n(void 0), ge = ({ children: e, url: t, team: n,
|
|
|
715
738
|
[e]: t
|
|
716
739
|
}
|
|
717
740
|
});
|
|
718
|
-
}, []),
|
|
741
|
+
}, []), K = i((e, t, n) => {
|
|
719
742
|
N((r) => ({
|
|
720
743
|
...r,
|
|
721
744
|
rangeFilters: {
|
|
@@ -727,7 +750,7 @@ var me = "Type to search", he = n(void 0), ge = ({ children: e, url: t, team: n,
|
|
|
727
750
|
},
|
|
728
751
|
filterRevision: r.filterRevision + 1
|
|
729
752
|
}));
|
|
730
|
-
}, []),
|
|
753
|
+
}, []), ne = i(() => {
|
|
731
754
|
N((e) => ({
|
|
732
755
|
...e,
|
|
733
756
|
filters: {},
|
|
@@ -735,7 +758,7 @@ var me = "Type to search", he = n(void 0), ge = ({ children: e, url: t, team: n,
|
|
|
735
758
|
bucketFilters: {},
|
|
736
759
|
filterRevision: e.filterRevision + 1
|
|
737
760
|
}));
|
|
738
|
-
}, []),
|
|
761
|
+
}, []), re = i((e, t, n = !0) => {
|
|
739
762
|
N((r) => {
|
|
740
763
|
let i = { ...r.filters }, a = (i[e] || []).filter((e) => e !== t);
|
|
741
764
|
return a.length > 0 ? i[e] = a : delete i[e], {
|
|
@@ -744,7 +767,7 @@ var me = "Type to search", he = n(void 0), ge = ({ children: e, url: t, team: n,
|
|
|
744
767
|
filterRevision: r.filterRevision + +!!n
|
|
745
768
|
};
|
|
746
769
|
});
|
|
747
|
-
}, []),
|
|
770
|
+
}, []), ie = i((e, t = !0) => {
|
|
748
771
|
N((n) => {
|
|
749
772
|
if (!(e in n.rangeFilters)) return n;
|
|
750
773
|
let r = { ...n.rangeFilters };
|
|
@@ -754,25 +777,25 @@ var me = "Type to search", he = n(void 0), ge = ({ children: e, url: t, team: n,
|
|
|
754
777
|
filterRevision: n.filterRevision + +!!t
|
|
755
778
|
};
|
|
756
779
|
});
|
|
757
|
-
}, []),
|
|
780
|
+
}, []), q = (e, t) => e.min === t.min && e.max === t.max, J = i((e, t, n = !1) => {
|
|
758
781
|
N((r) => {
|
|
759
|
-
let i = r.bucketFilters[e] ?? [], a = i.some((e) =>
|
|
782
|
+
let i = r.bucketFilters[e] ?? [], a = i.some((e) => q(e, t)) ? i.filter((e) => !q(e, t)) : n ? [t] : [...i, t], o = { ...r.bucketFilters };
|
|
760
783
|
return a.length > 0 ? o[e] = a : delete o[e], {
|
|
761
784
|
...r,
|
|
762
785
|
bucketFilters: o,
|
|
763
786
|
filterRevision: r.filterRevision + 1
|
|
764
787
|
};
|
|
765
788
|
});
|
|
766
|
-
}, []),
|
|
789
|
+
}, []), Y = i((e, t, n = !0) => {
|
|
767
790
|
N((r) => {
|
|
768
|
-
let i = { ...r.bucketFilters }, a = t ? (i[e] ?? []).filter((e) => !
|
|
791
|
+
let i = { ...r.bucketFilters }, a = t ? (i[e] ?? []).filter((e) => !q(e, t)) : [];
|
|
769
792
|
return a.length > 0 ? i[e] = a : delete i[e], {
|
|
770
793
|
...r,
|
|
771
794
|
bucketFilters: i,
|
|
772
795
|
filterRevision: r.filterRevision + +!!n
|
|
773
796
|
};
|
|
774
797
|
});
|
|
775
|
-
}, []),
|
|
798
|
+
}, []), X = i((e, t) => {
|
|
776
799
|
N((n) => ({
|
|
777
800
|
...n,
|
|
778
801
|
sortBy: e || void 0,
|
|
@@ -793,20 +816,21 @@ var me = "Type to search", he = n(void 0), ge = ({ children: e, url: t, team: n,
|
|
|
793
816
|
team: n,
|
|
794
817
|
dataset: r,
|
|
795
818
|
authenticatedFetch: I,
|
|
796
|
-
setQuery:
|
|
797
|
-
toggleFilter:
|
|
798
|
-
setValueMatch:
|
|
799
|
-
setRangeFilter:
|
|
800
|
-
resetFilters:
|
|
801
|
-
resetSingleFilter:
|
|
802
|
-
resetRangeFilter:
|
|
803
|
-
toggleBucketFilter:
|
|
804
|
-
resetBucketFilter:
|
|
805
|
-
setSort:
|
|
806
|
-
setDebounceDelay:
|
|
807
|
-
setSearchSettings:
|
|
808
|
-
fetchMoreResults:
|
|
809
|
-
selectResult:
|
|
819
|
+
setQuery: H,
|
|
820
|
+
toggleFilter: G,
|
|
821
|
+
setValueMatch: te,
|
|
822
|
+
setRangeFilter: K,
|
|
823
|
+
resetFilters: ne,
|
|
824
|
+
resetSingleFilter: re,
|
|
825
|
+
resetRangeFilter: ie,
|
|
826
|
+
toggleBucketFilter: J,
|
|
827
|
+
resetBucketFilter: Y,
|
|
828
|
+
setSort: X,
|
|
829
|
+
setDebounceDelay: U,
|
|
830
|
+
setSearchSettings: W,
|
|
831
|
+
fetchMoreResults: ee,
|
|
832
|
+
selectResult: B,
|
|
833
|
+
convertResult: V,
|
|
810
834
|
sessionId: w,
|
|
811
835
|
source: y,
|
|
812
836
|
count: x,
|
|
@@ -816,50 +840,59 @@ var me = "Type to search", he = n(void 0), ge = ({ children: e, url: t, team: n,
|
|
|
816
840
|
},
|
|
817
841
|
children: e
|
|
818
842
|
});
|
|
819
|
-
},
|
|
843
|
+
}, _e = () => {
|
|
820
844
|
let e = a(he);
|
|
821
845
|
if (!e) throw Error("useSearchContext must be used within a SearchProvider");
|
|
822
846
|
return e;
|
|
823
|
-
}
|
|
847
|
+
};
|
|
848
|
+
// src/utils/searchOrAsk.ts
|
|
849
|
+
function ve(e, t) {
|
|
850
|
+
return t ? t === "proactive" && e !== "proactive" ? "inviting" : t : e;
|
|
851
|
+
}
|
|
852
|
+
var ye = {
|
|
824
853
|
strong: .65,
|
|
825
854
|
strongHide: .45,
|
|
826
855
|
invite: .4,
|
|
827
|
-
inviteHide: .3
|
|
828
|
-
|
|
829
|
-
|
|
856
|
+
inviteHide: .3,
|
|
857
|
+
hint: .31,
|
|
858
|
+
finished: .5
|
|
859
|
+
}, be = /^[\d\s\-_.:/]+$|^\w+\.\w+|^[A-Za-z]*[a-z][A-Z]\w*$|^[A-Za-z]+[-_]?\d[\w-]*$/;
|
|
860
|
+
function xe(e) {
|
|
830
861
|
let t = e.trim();
|
|
831
|
-
return t.length > 0 && !t.includes(" ") &&
|
|
862
|
+
return t.length > 0 && !t.includes(" ") && be.test(t);
|
|
832
863
|
}
|
|
833
|
-
function
|
|
864
|
+
function Se(e) {
|
|
834
865
|
let t = e.trim();
|
|
835
|
-
|
|
836
|
-
let n = t.split(/\s+/);
|
|
837
|
-
return t.endsWith("?") || n.length > 1 && ve.has(n[0].toLowerCase()) || n.length >= 3 ? !0 : t.length >= 4;
|
|
866
|
+
return !!t && !xe(t) && (t.endsWith("?") || t.split(/\s+/).length >= 3);
|
|
838
867
|
}
|
|
839
|
-
function
|
|
868
|
+
function Ce(e, t = 4) {
|
|
869
|
+
let n = e.trim();
|
|
870
|
+
return !n || xe(n) ? !1 : Se(n) || n.length >= t;
|
|
871
|
+
}
|
|
872
|
+
function we(e, t, n = ye) {
|
|
840
873
|
return t >= n.strong || e === "strong" && t >= n.strongHide ? "strong" : t >= n.invite || e !== "none" && t >= n.inviteHide ? "invite" : "none";
|
|
841
874
|
}
|
|
842
|
-
var
|
|
875
|
+
var Te = {
|
|
843
876
|
shareOfTop: .5,
|
|
844
877
|
topFloor: .2
|
|
845
|
-
},
|
|
878
|
+
}, Ee = {
|
|
846
879
|
coverFuzzyWords: !1,
|
|
847
880
|
coverPrefixSuffix: !1,
|
|
848
881
|
coverJoinedWords: !1,
|
|
849
882
|
minWordSize: 3
|
|
850
|
-
},
|
|
851
|
-
function
|
|
883
|
+
}, De = 65535;
|
|
884
|
+
function Oe(e, t, n, r = Te) {
|
|
852
885
|
if (!n || e.length === 0) return e;
|
|
853
886
|
let i = e[0].score;
|
|
854
887
|
if (i < r.topFloor * 65535) return [];
|
|
855
888
|
let a = t == null ? e : t < 0 ? [] : e.slice(0, t + 1), o = r.shareOfTop * i, s = a.findIndex((e) => e.score < o);
|
|
856
889
|
return s < 0 ? a : a.slice(0, s);
|
|
857
890
|
}
|
|
858
|
-
function
|
|
891
|
+
function ke(e) {
|
|
859
892
|
let t = e.trim();
|
|
860
893
|
return t.includes(" ") || t.endsWith("?");
|
|
861
894
|
}
|
|
862
|
-
async function*
|
|
895
|
+
async function* Ae(e) {
|
|
863
896
|
let t = e.getReader(), n = new TextDecoder(), r = "";
|
|
864
897
|
try {
|
|
865
898
|
for (;;) {
|
|
@@ -882,36 +915,35 @@ async function* Oe(e) {
|
|
|
882
915
|
t.releaseLock();
|
|
883
916
|
}
|
|
884
917
|
}
|
|
885
|
-
function
|
|
918
|
+
function je(e) {
|
|
886
919
|
let t = new URLSearchParams();
|
|
887
920
|
e.state.queryId && t.set("queryId", e.state.queryId), e.sessionId && t.set("session", e.sessionId), e.source && t.set("source", e.source), e.count === !1 && t.set("count", "false");
|
|
888
921
|
let n = t.toString();
|
|
889
922
|
return n ? `?${n}` : "";
|
|
890
923
|
}
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
function Ne(e, t) {
|
|
924
|
+
// src/utils/askPhrases.ts
|
|
925
|
+
var Me = (e) => e.toLowerCase().replace(/β/g, "'").split(/\s+/).filter(Boolean), Ne = /[?!.,]+$/, Pe = 2;
|
|
926
|
+
function Fe(e, t) {
|
|
895
927
|
let n = 0;
|
|
896
928
|
for (let r of t) {
|
|
897
|
-
let t =
|
|
898
|
-
t.length > n && t.length <= e.length && t.every((n, r) => e[e.length - t.length + r].replace(
|
|
929
|
+
let t = Me(r);
|
|
930
|
+
t.length > n && t.length <= e.length && t.every((n, r) => e[e.length - t.length + r].replace(Ne, "") === n) && (n = t.length);
|
|
899
931
|
}
|
|
900
932
|
return n;
|
|
901
933
|
}
|
|
902
|
-
function
|
|
934
|
+
function Ie(e, t, n) {
|
|
903
935
|
let r = 0;
|
|
904
936
|
for (let i of n) {
|
|
905
|
-
let n =
|
|
906
|
-
n.length > r && t + n.length <= e.length && n.every((n, r) => e[t + r].replace(
|
|
937
|
+
let n = Me(i);
|
|
938
|
+
n.length > r && t + n.length <= e.length && n.every((n, r) => e[t + r].replace(Ne, "") === n) && (r = n.length);
|
|
907
939
|
}
|
|
908
940
|
return r;
|
|
909
941
|
}
|
|
910
|
-
function
|
|
911
|
-
let n = e.trim().split(/\s+/).filter(Boolean), r =
|
|
912
|
-
let t =
|
|
942
|
+
function Le(e, t) {
|
|
943
|
+
let n = e.trim().split(/\s+/).filter(Boolean), r = Me(e), i = 0, a = [], o = (e) => {
|
|
944
|
+
let t = Ie(r, i, e);
|
|
913
945
|
return t && (a.push(n.slice(i, i + t).join(" ")), i += t), t > 0;
|
|
914
|
-
}, s =
|
|
946
|
+
}, s = Ie(r, 0, t.leadIns), c = o(t.leadIns), l = o(t.frames), u = o(t.links);
|
|
915
947
|
if (!(c && (s > 1 || l) || l && u)) return {
|
|
916
948
|
text: e,
|
|
917
949
|
taken: []
|
|
@@ -922,8 +954,8 @@ function Fe(e, t) {
|
|
|
922
954
|
text: e,
|
|
923
955
|
taken: []
|
|
924
956
|
};
|
|
925
|
-
let f = d.split(/\s+/).filter(Boolean), p =
|
|
926
|
-
if (p > 0 && f.length - p >=
|
|
957
|
+
let f = d.split(/\s+/).filter(Boolean), p = Fe(Me(d), t.frames);
|
|
958
|
+
if (p > 0 && f.length - p >= Pe) {
|
|
927
959
|
let e = f.slice(0, f.length - p).join(" ");
|
|
928
960
|
if (/\p{L}{3,}/u.test(e)) return {
|
|
929
961
|
text: e,
|
|
@@ -935,9 +967,16 @@ function Fe(e, t) {
|
|
|
935
967
|
taken: a
|
|
936
968
|
};
|
|
937
969
|
}
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
970
|
+
// src/hooks/useSearchOrAsk.ts
|
|
971
|
+
function Re(e) {
|
|
972
|
+
return {
|
|
973
|
+
...ye,
|
|
974
|
+
...e,
|
|
975
|
+
hint: e?.hint ?? ye.hint,
|
|
976
|
+
finished: e?.finished ?? ye.finished
|
|
977
|
+
};
|
|
978
|
+
}
|
|
979
|
+
var ze = {
|
|
941
980
|
available: !1,
|
|
942
981
|
offer: "none",
|
|
943
982
|
p: null,
|
|
@@ -946,286 +985,543 @@ var Ie = {
|
|
|
946
985
|
criteria: null,
|
|
947
986
|
describes: !1,
|
|
948
987
|
cutResults: !1,
|
|
949
|
-
cutRule:
|
|
988
|
+
cutRule: Te,
|
|
950
989
|
strictCoverage: !1,
|
|
951
990
|
filtersWhileTyping: "off",
|
|
991
|
+
mode: "soft",
|
|
992
|
+
askAnytime: !1,
|
|
993
|
+
finished: null,
|
|
994
|
+
answerNow: null,
|
|
995
|
+
quick: "none",
|
|
952
996
|
stands: !1
|
|
953
997
|
};
|
|
954
|
-
function
|
|
955
|
-
let { enabled: t = !0, pauseMs: n = 300 } = e,
|
|
956
|
-
|
|
957
|
-
let
|
|
958
|
-
k.current =
|
|
959
|
-
let
|
|
998
|
+
function Be(e = {}) {
|
|
999
|
+
let { enabled: t = !0, pauseMs: n = 300, prefetch: r = !0, mode: i, answerAfterMs: a = 1e3 } = e, s = _e(), { url: u, team: d, dataset: f, authenticatedFetch: p, isFetchingInitial: m, authError: h, state: g } = s, _ = c(s);
|
|
1000
|
+
_.current = s;
|
|
1001
|
+
let v = (e.text ?? g.query).trim(), [y, b] = l(!1), [x, S] = l(ze), C = c(ye), w = c(!0), T = c(Te), E = c(!0), D = c("off"), O = c("soft"), k = c(i);
|
|
1002
|
+
k.current = i;
|
|
1003
|
+
let A = { get current() {
|
|
1004
|
+
return ve(O.current, k.current);
|
|
1005
|
+
} }, j = c(null), M = c(!0), N = c(!0), P = c(null), F = c("none"), I = c(""), L = c(0), R = c(0);
|
|
1006
|
+
F.current = x.offer;
|
|
1007
|
+
let z = c(null), B = c(/* @__PURE__ */ new Set()), V = c(0), H = c(v);
|
|
1008
|
+
H.current = v;
|
|
1009
|
+
let U = c(!1);
|
|
1010
|
+
U.current = y;
|
|
1011
|
+
let W = `${u}/api/teams/${d}/datasets/${f}/search-or-ask`, ee = () => A.current === "inviting" || A.current === "proactive" ? 3 : 4, G = (e) => e != null && e >= (C.current.finished ?? .5), te = (e) => A.current !== "proactive" && F.current === "strong" && !!I.current && e.startsWith(I.current), K = t && !m && !h;
|
|
960
1012
|
o(() => {
|
|
961
|
-
if (
|
|
1013
|
+
if (b(!1), !K) return;
|
|
962
1014
|
let e = !1;
|
|
963
1015
|
return (async () => {
|
|
964
1016
|
try {
|
|
965
|
-
let t = await
|
|
1017
|
+
let t = await p(W);
|
|
966
1018
|
if (!t.ok) return;
|
|
967
1019
|
let n = await t.json();
|
|
968
1020
|
if (e || !n.available || !n.settings?.enabled) return;
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
},
|
|
973
|
-
shareOfTop: n.settings.cutShareOfTop ?? Ce.shareOfTop,
|
|
974
|
-
topFloor: n.settings.cutTopFloor ?? Ce.topFloor
|
|
975
|
-
}, _(!0);
|
|
1021
|
+
j.current = n.effective?.askPhrases ?? null, M.current = n.settings.refocusWhileTyping ?? !0, N.current = n.settings.inviteOnAskPhrase ?? !0, D.current = n.settings.filtersWhileTyping ?? "off", O.current = n.settings.mode ?? "soft", C.current = Re(n.settings.thresholds), w.current = n.settings.cutWhileAsking ?? !0, E.current = n.settings.strictCoverageWhileAsking ?? !0, T.current = {
|
|
1022
|
+
shareOfTop: n.settings.cutShareOfTop ?? Te.shareOfTop,
|
|
1023
|
+
topFloor: n.settings.cutTopFloor ?? Te.topFloor
|
|
1024
|
+
}, b(!0);
|
|
976
1025
|
} catch {}
|
|
977
1026
|
})(), () => {
|
|
978
1027
|
e = !0;
|
|
979
1028
|
};
|
|
980
1029
|
}, [
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
])
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
1030
|
+
K,
|
|
1031
|
+
W,
|
|
1032
|
+
p
|
|
1033
|
+
]);
|
|
1034
|
+
let ne = c(() => {});
|
|
1035
|
+
ne.current = (e) => {
|
|
1036
|
+
if (!r || !U.current || z.current || !e || !Ce(e, ee()) || B.current.has(e) || te(e) || Date.now() < R.current || Date.now() < V.current) return;
|
|
1037
|
+
let t = (async () => {
|
|
1038
|
+
try {
|
|
1039
|
+
let t = await p(`${W}/intent`, {
|
|
1040
|
+
method: "POST",
|
|
1041
|
+
headers: { "Content-Type": "application/json" },
|
|
1042
|
+
body: JSON.stringify({
|
|
1043
|
+
text: e,
|
|
1044
|
+
prefetch: !0
|
|
1045
|
+
})
|
|
1046
|
+
});
|
|
1047
|
+
if (t.status === 429) {
|
|
1048
|
+
let e = Number(t.headers.get("Retry-After"));
|
|
1049
|
+
V.current = Date.now() + (Number.isFinite(e) && e > 0 ? e : 60) * 1e3;
|
|
1050
|
+
return;
|
|
1051
|
+
}
|
|
1052
|
+
t.ok && (B.current.size > 200 && B.current.clear(), B.current.add(e));
|
|
1053
|
+
} catch {}
|
|
1054
|
+
})();
|
|
1055
|
+
z.current = {
|
|
1056
|
+
text: e,
|
|
1057
|
+
done: t
|
|
1058
|
+
}, t.then(() => {
|
|
1059
|
+
z.current?.done === t && (z.current = null), H.current !== e && ne.current(H.current);
|
|
1060
|
+
});
|
|
1061
|
+
}, o(() => {
|
|
1062
|
+
let { setSearchRewrite: e } = _.current, t = j.current;
|
|
1063
|
+
if (y && t && M.current && e) return e((e) => Le(e, t).text), () => e(null);
|
|
1064
|
+
}, [y]), o(() => {
|
|
1065
|
+
if (!y) {
|
|
1066
|
+
S(ze);
|
|
990
1067
|
return;
|
|
991
1068
|
}
|
|
992
|
-
if (!
|
|
993
|
-
|
|
994
|
-
...
|
|
995
|
-
available:
|
|
1069
|
+
if (!v) {
|
|
1070
|
+
I.current = "", S({
|
|
1071
|
+
...ze,
|
|
1072
|
+
available: y
|
|
996
1073
|
});
|
|
997
1074
|
return;
|
|
998
1075
|
}
|
|
999
|
-
if (!
|
|
1000
|
-
|
|
1076
|
+
if (!Ce(v, ee())) {
|
|
1077
|
+
xe(v) && S((e) => ({
|
|
1001
1078
|
...e,
|
|
1002
|
-
available:
|
|
1079
|
+
available: y,
|
|
1003
1080
|
offer: "none",
|
|
1004
|
-
text:
|
|
1081
|
+
text: v
|
|
1005
1082
|
}));
|
|
1006
1083
|
return;
|
|
1007
1084
|
}
|
|
1008
|
-
|
|
1085
|
+
A.current !== "strict" && N.current && j.current && Le(v, j.current).taken.length > 0 && S((e) => e.offer === "none" ? {
|
|
1009
1086
|
...e,
|
|
1010
|
-
available:
|
|
1087
|
+
available: y,
|
|
1011
1088
|
offer: "invite",
|
|
1012
|
-
text:
|
|
1013
|
-
} : e);
|
|
1014
|
-
let e = setTimeout(async () => {
|
|
1015
|
-
if (
|
|
1016
|
-
|
|
1089
|
+
text: v
|
|
1090
|
+
} : e), ne.current(v);
|
|
1091
|
+
let e = !1, t = setTimeout(async () => {
|
|
1092
|
+
if (te(v)) {
|
|
1093
|
+
S((e) => ({
|
|
1017
1094
|
...e,
|
|
1018
|
-
text:
|
|
1095
|
+
text: v
|
|
1019
1096
|
}));
|
|
1020
1097
|
return;
|
|
1021
1098
|
}
|
|
1022
|
-
if (Date.now() <
|
|
1023
|
-
let
|
|
1024
|
-
|
|
1099
|
+
if (Date.now() < R.current || (z.current?.text === v && await z.current.done, e)) return;
|
|
1100
|
+
let t = ++L.current;
|
|
1101
|
+
I.current = v;
|
|
1025
1102
|
try {
|
|
1026
|
-
let
|
|
1103
|
+
let e = await p(`${W}/intent${je(_.current)}`, {
|
|
1027
1104
|
method: "POST",
|
|
1028
1105
|
headers: { "Content-Type": "application/json" },
|
|
1029
|
-
body: JSON.stringify({ text:
|
|
1106
|
+
body: JSON.stringify({ text: v })
|
|
1030
1107
|
});
|
|
1031
|
-
if (
|
|
1032
|
-
let
|
|
1033
|
-
|
|
1108
|
+
if (e.status === 429) {
|
|
1109
|
+
let t = Number(e.headers.get("Retry-After"));
|
|
1110
|
+
R.current = Date.now() + (Number.isFinite(t) && t > 0 ? t : 60) * 1e3;
|
|
1034
1111
|
return;
|
|
1035
1112
|
}
|
|
1036
|
-
if (
|
|
1037
|
-
|
|
1113
|
+
if (e.status === 409) {
|
|
1114
|
+
b(!1);
|
|
1038
1115
|
return;
|
|
1039
1116
|
}
|
|
1040
|
-
if (!
|
|
1041
|
-
let { p: n, answerable: r, criteria: i,
|
|
1042
|
-
if (
|
|
1043
|
-
|
|
1044
|
-
shareOfTop:
|
|
1045
|
-
topFloor:
|
|
1046
|
-
}),
|
|
1047
|
-
let t =
|
|
1117
|
+
if (!e.ok) return;
|
|
1118
|
+
let { p: n, answerable: r, criteria: i, finished: a, thresholds: o, cutWhileAsking: s, cutShareOfTop: c, cutTopFloor: l, strictCoverageWhileAsking: u, filtersWhileTyping: d, mode: f } = await e.json();
|
|
1119
|
+
if (d != null && (D.current = d), t !== L.current) return;
|
|
1120
|
+
s != null && (w.current = s), u != null && (E.current = u), f != null && (O.current = f), o && (C.current = Re(o)), c != null && l != null && (T.current = {
|
|
1121
|
+
shareOfTop: c,
|
|
1122
|
+
topFloor: l
|
|
1123
|
+
}), S((e) => {
|
|
1124
|
+
let t = we(e.offer, n, C.current), o = i ?? null, s = o != null && o >= C.current.strong, c = t === "strong" && !ke(v) ? "invite" : t, l = s ? "strong" : c, u = A.current === "strict" && l === "invite" ? "none" : l, d = u === "strong" && !(s && o > n);
|
|
1048
1125
|
return {
|
|
1049
1126
|
available: !0,
|
|
1050
|
-
offer:
|
|
1127
|
+
offer: u,
|
|
1051
1128
|
p: n,
|
|
1052
1129
|
answerable: r ?? null,
|
|
1053
|
-
text:
|
|
1054
|
-
criteria:
|
|
1055
|
-
describes:
|
|
1056
|
-
cutResults:
|
|
1057
|
-
cutRule:
|
|
1058
|
-
strictCoverage:
|
|
1059
|
-
filtersWhileTyping:
|
|
1130
|
+
text: v,
|
|
1131
|
+
criteria: o,
|
|
1132
|
+
describes: s,
|
|
1133
|
+
cutResults: w.current && d,
|
|
1134
|
+
cutRule: T.current,
|
|
1135
|
+
strictCoverage: E.current && d,
|
|
1136
|
+
filtersWhileTyping: D.current,
|
|
1137
|
+
mode: A.current,
|
|
1138
|
+
askAnytime: !1,
|
|
1139
|
+
quick: "none",
|
|
1140
|
+
finished: a ?? null,
|
|
1141
|
+
answerNow: A.current === "proactive" && u === "strong" && G(a) ? v : null,
|
|
1060
1142
|
stands: !0
|
|
1061
1143
|
};
|
|
1062
1144
|
});
|
|
1063
1145
|
} catch {}
|
|
1064
1146
|
}, n);
|
|
1065
|
-
return () =>
|
|
1147
|
+
return () => {
|
|
1148
|
+
e = !0, clearTimeout(t);
|
|
1149
|
+
};
|
|
1066
1150
|
}, [
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1151
|
+
v,
|
|
1152
|
+
y,
|
|
1153
|
+
W,
|
|
1154
|
+
p,
|
|
1071
1155
|
n
|
|
1072
1156
|
]);
|
|
1073
|
-
let
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1157
|
+
let [re, ie] = l(null);
|
|
1158
|
+
o(() => {
|
|
1159
|
+
ie(null);
|
|
1160
|
+
let e = x.answerNow;
|
|
1161
|
+
if (!e || e !== v) return;
|
|
1162
|
+
let t = setTimeout(() => ie(e), Math.max(0, a - n));
|
|
1163
|
+
return () => clearTimeout(t);
|
|
1164
|
+
}, [
|
|
1165
|
+
x.answerNow,
|
|
1166
|
+
v,
|
|
1167
|
+
a,
|
|
1168
|
+
n
|
|
1169
|
+
]);
|
|
1170
|
+
let q = y && x.strictCoverage;
|
|
1171
|
+
if (o(() => {
|
|
1172
|
+
let { setSearchSettings: e, state: t } = _.current;
|
|
1173
|
+
if (q) {
|
|
1174
|
+
if (P.current) return;
|
|
1078
1175
|
let n = t.searchSettings.coverageSetup ?? {};
|
|
1079
|
-
|
|
1080
|
-
} else
|
|
1081
|
-
}, [
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1176
|
+
P.current = Object.fromEntries(Object.keys(Ee).map((e) => [e, n[e]])), e({ coverageSetup: { ...Ee } });
|
|
1177
|
+
} else P.current &&= (e({ coverageSetup: { ...P.current } }), null);
|
|
1178
|
+
}, [q]), !y) return ze;
|
|
1179
|
+
let J = A.current, Y = !!x.text && v.startsWith(x.text), X = J === "inviting" || J === "proactive", ae = X && !!v && (Y && x.p != null && x.p >= (C.current.hint ?? 1) || Se(v)), oe = v ? Y && x.offer === "strong" ? J === "proactive" ? G(x.finished) ? "thinking" : "hint" : "ready" : Y && x.offer === "invite" ? X ? "hint" : "invite" : ae ? "hint" : "none" : "none";
|
|
1180
|
+
return {
|
|
1181
|
+
...x,
|
|
1182
|
+
mode: J,
|
|
1183
|
+
askAnytime: J === "open" || X,
|
|
1184
|
+
answerNow: re !== null && re === v && x.answerNow === v ? re : null,
|
|
1185
|
+
text: oe === "hint" && !Y ? v : x.text,
|
|
1186
|
+
quick: oe,
|
|
1187
|
+
stands: Y
|
|
1188
|
+
};
|
|
1189
|
+
}
|
|
1190
|
+
var Ve = {
|
|
1191
|
+
row: "_row_epo6h_3",
|
|
1192
|
+
icon: "_icon_epo6h_17",
|
|
1193
|
+
line: "_line_epo6h_24",
|
|
1194
|
+
text: "_text_epo6h_41",
|
|
1195
|
+
question: "_question_epo6h_43",
|
|
1196
|
+
actions: "_actions_epo6h_52",
|
|
1197
|
+
enter: "_enter_epo6h_59"
|
|
1198
|
+
}, He = {
|
|
1199
|
+
invite: "Ask about this",
|
|
1200
|
+
hint: "For a quick answer, type a bit more",
|
|
1201
|
+
ready: "Ask the assistant",
|
|
1202
|
+
thinking: "Thinking"
|
|
1203
|
+
}, Ue = ({ searchOrAsk: e, onAsk: t, labels: n, className: r = "" }) => {
|
|
1204
|
+
let i = {
|
|
1205
|
+
...He,
|
|
1206
|
+
...n
|
|
1207
|
+
}, a = e.text.trim();
|
|
1208
|
+
if (!e.available || e.quick === "none" || !a) return null;
|
|
1209
|
+
let o = () => t(a);
|
|
1210
|
+
return /* @__PURE__ */ p("div", {
|
|
1211
|
+
className: `${Ve.row} ${Ve[e.quick]} ${r}`,
|
|
1212
|
+
"aria-live": "polite",
|
|
1213
|
+
children: [
|
|
1214
|
+
/* @__PURE__ */ f("span", {
|
|
1215
|
+
className: Ve.icon,
|
|
1216
|
+
"aria-hidden": "true",
|
|
1217
|
+
children: /* @__PURE__ */ f(z, {
|
|
1218
|
+
size: 14,
|
|
1219
|
+
color: "currentColor"
|
|
1220
|
+
})
|
|
1221
|
+
}),
|
|
1222
|
+
e.quick === "thinking" && /* @__PURE__ */ f(M, {
|
|
1223
|
+
className: Ve.text,
|
|
1224
|
+
children: i.thinking
|
|
1225
|
+
}),
|
|
1226
|
+
e.quick === "hint" && /* @__PURE__ */ f("button", {
|
|
1227
|
+
type: "button",
|
|
1228
|
+
className: Ve.line,
|
|
1229
|
+
onClick: o,
|
|
1230
|
+
children: /* @__PURE__ */ f(M, { children: i.hint })
|
|
1231
|
+
}),
|
|
1232
|
+
e.quick === "invite" && /* @__PURE__ */ f("button", {
|
|
1233
|
+
type: "button",
|
|
1234
|
+
className: Ve.line,
|
|
1235
|
+
onClick: o,
|
|
1236
|
+
children: i.invite
|
|
1237
|
+
}),
|
|
1238
|
+
e.quick === "ready" && /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("span", {
|
|
1239
|
+
className: Ve.question,
|
|
1240
|
+
children: a
|
|
1241
|
+
}), /* @__PURE__ */ p("span", {
|
|
1242
|
+
className: Ve.actions,
|
|
1243
|
+
children: [/* @__PURE__ */ p("span", {
|
|
1244
|
+
className: Ve.enter,
|
|
1245
|
+
children: [/* @__PURE__ */ f(D, { children: "β΅" }), " to ask"]
|
|
1246
|
+
}), /* @__PURE__ */ f(y, {
|
|
1247
|
+
variant: "primary",
|
|
1248
|
+
size: "micro",
|
|
1249
|
+
onClick: o,
|
|
1250
|
+
children: i.ready
|
|
1251
|
+
})]
|
|
1252
|
+
})] })
|
|
1253
|
+
]
|
|
1254
|
+
});
|
|
1255
|
+
}, We = {
|
|
1256
|
+
grid: "_grid_1xjna_2",
|
|
1257
|
+
chip: "_chip_1xjna_21",
|
|
1258
|
+
chipLabel: "_chipLabel_1xjna_32"
|
|
1259
|
+
}, Ge = r(({ field: e, value: t, onReset: n }) => /* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(y, {
|
|
1260
|
+
onClick: n,
|
|
1261
|
+
iconRight: /* @__PURE__ */ f(J, {}),
|
|
1262
|
+
variant: "primary",
|
|
1263
|
+
size: "micro",
|
|
1264
|
+
className: We.chip,
|
|
1265
|
+
title: `${e}: ${t}`,
|
|
1266
|
+
children: /* @__PURE__ */ p("span", {
|
|
1267
|
+
className: We.chipLabel,
|
|
1268
|
+
children: [
|
|
1269
|
+
e,
|
|
1270
|
+
": ",
|
|
1271
|
+
t
|
|
1272
|
+
]
|
|
1273
|
+
})
|
|
1274
|
+
}) })), Ke = r(({ field: e, min: t, max: n, onReset: r }) => /* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(y, {
|
|
1275
|
+
onClick: r,
|
|
1276
|
+
iconRight: /* @__PURE__ */ f(J, {}),
|
|
1277
|
+
variant: "primary",
|
|
1278
|
+
size: "micro",
|
|
1279
|
+
className: We.chip,
|
|
1280
|
+
title: `${e}: ${t} β ${n}`,
|
|
1281
|
+
children: /* @__PURE__ */ p("span", {
|
|
1282
|
+
className: We.chipLabel,
|
|
1283
|
+
children: [
|
|
1284
|
+
e,
|
|
1285
|
+
": ",
|
|
1286
|
+
t,
|
|
1287
|
+
" β ",
|
|
1288
|
+
n
|
|
1289
|
+
]
|
|
1290
|
+
})
|
|
1291
|
+
}) })), qe = r(({ field: e, label: t, onReset: n }) => /* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(y, {
|
|
1292
|
+
onClick: n,
|
|
1293
|
+
iconRight: /* @__PURE__ */ f(J, {}),
|
|
1294
|
+
variant: "primary",
|
|
1295
|
+
size: "micro",
|
|
1296
|
+
className: We.chip,
|
|
1297
|
+
title: `${e}: ${t}`,
|
|
1298
|
+
children: /* @__PURE__ */ p("span", {
|
|
1299
|
+
className: We.chipLabel,
|
|
1300
|
+
children: [
|
|
1301
|
+
e,
|
|
1302
|
+
": ",
|
|
1303
|
+
t
|
|
1304
|
+
]
|
|
1305
|
+
})
|
|
1306
|
+
}) }));
|
|
1307
|
+
function Je() {
|
|
1308
|
+
let { state: { filters: e, rangeFilters: t, bucketFilters: n }, resetFilters: r, resetSingleFilter: i, resetRangeFilter: a, resetBucketFilter: o } = _e(), c = s(() => Object.entries(e).map(([e, t]) => t.map((t) => ({
|
|
1309
|
+
field: e,
|
|
1310
|
+
value: t
|
|
1311
|
+
}))).flat(), [e]), l = s(() => Object.entries(t).map(([e, { min: t, max: n }]) => ({
|
|
1312
|
+
field: e,
|
|
1313
|
+
min: t,
|
|
1314
|
+
max: n
|
|
1315
|
+
})), [t]), u = s(() => Object.entries(n).flatMap(([e, t]) => t.map((t) => ({
|
|
1316
|
+
field: e,
|
|
1317
|
+
range: t,
|
|
1318
|
+
label: `${t.min}-${t.max}`
|
|
1319
|
+
}))), [n]);
|
|
1320
|
+
return s(() => Object.keys(e).length > 0 || Object.keys(t).length > 0 || u.length > 0, [
|
|
1321
|
+
e,
|
|
1322
|
+
t,
|
|
1323
|
+
u
|
|
1324
|
+
]) ? /* @__PURE__ */ f(T, {
|
|
1325
|
+
collapsible: !1,
|
|
1326
|
+
title: "Active filters",
|
|
1327
|
+
children: /* @__PURE__ */ p("ul", {
|
|
1328
|
+
className: We.grid,
|
|
1329
|
+
children: [
|
|
1330
|
+
c.map(({ field: e, value: t }) => /* @__PURE__ */ f(Ge, {
|
|
1331
|
+
field: e,
|
|
1332
|
+
value: t,
|
|
1333
|
+
onReset: () => i(e, t)
|
|
1334
|
+
}, `${e}-${t}`)),
|
|
1335
|
+
l.map(({ field: e, min: t, max: n }) => /* @__PURE__ */ f(Ke, {
|
|
1336
|
+
field: e,
|
|
1337
|
+
min: t,
|
|
1338
|
+
max: n,
|
|
1339
|
+
onReset: () => a(e)
|
|
1340
|
+
}, e)),
|
|
1341
|
+
u.map(({ field: e, range: t, label: n }) => /* @__PURE__ */ f(qe, {
|
|
1342
|
+
field: e,
|
|
1343
|
+
label: n,
|
|
1344
|
+
onReset: () => o(e, t)
|
|
1345
|
+
}, `${e}-${t.min}-${t.max}`)),
|
|
1346
|
+
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(y, {
|
|
1347
|
+
onClick: r,
|
|
1348
|
+
size: "micro",
|
|
1349
|
+
variant: "ghost",
|
|
1350
|
+
children: "Reset"
|
|
1351
|
+
}) })
|
|
1352
|
+
]
|
|
1353
|
+
})
|
|
1354
|
+
}) : null;
|
|
1085
1355
|
}
|
|
1086
|
-
var
|
|
1087
|
-
withOffer: "
|
|
1088
|
-
offerRow: "
|
|
1089
|
-
offerHint: "
|
|
1090
|
-
kbd: "
|
|
1091
|
-
askStrong: "
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1356
|
+
var Ye = {
|
|
1357
|
+
withOffer: "_withOffer_1zrln_2",
|
|
1358
|
+
offerRow: "_offerRow_1zrln_10",
|
|
1359
|
+
offerHint: "_offerHint_1zrln_18",
|
|
1360
|
+
kbd: "_kbd_1zrln_27",
|
|
1361
|
+
askStrong: "_askStrong_1zrln_42",
|
|
1362
|
+
thinking: "_thinking_1zrln_45",
|
|
1363
|
+
offerQuick: "_offerQuick_1zrln_56",
|
|
1364
|
+
filterChip: "_filterChip_1zrln_59",
|
|
1365
|
+
filtersPopover: "_filtersPopover_1zrln_63"
|
|
1366
|
+
}, Xe = ({ className: t = "", autoFocus: n = !1, inputSize: r = "default", showClear: i = !0, showFocus: a = !1, showStatus: o = !0, onAsk: s, searchOrAsk: c, askOffer: l = "chip", onKeyDown: u, ...d }) => {
|
|
1367
|
+
let { state: { query: m, filters: h, rangeFilters: g, bucketFilters: _, results: v, truncationIndex: b, searchSettings: S }, setQuery: C, resetFilters: w } = _e(), T = Object.values(h).reduce((e, t) => e + t.length, 0) + Object.keys(g).length + Object.values(_ ?? {}).reduce((e, t) => e + t.length, 0), E = m.length > 0, k = E && v !== null && v.length === 0, j = E && S.enableCoverage && v !== null && v.length > 0 && b === -1, N = Be({ enabled: !!s && !c }), P = c ?? N, F = P.quick === "ready" || P.askAnytime, I = e.useRef(null);
|
|
1368
|
+
e.useEffect(() => {
|
|
1369
|
+
let e = P.answerNow;
|
|
1370
|
+
s && e && e === m.trim() && I.current !== e && (I.current = e, s(e, { proactive: !0 }));
|
|
1371
|
+
}, [
|
|
1372
|
+
P.answerNow,
|
|
1373
|
+
m,
|
|
1374
|
+
s
|
|
1375
|
+
]);
|
|
1376
|
+
let R = I.current !== null && I.current === m.trim(), B = !s || !E || R ? "none" : P.quick === "none" ? P.askAnytime ? "ask" : "none" : P.quick, V = P.available && S.placeholderText === "Type to search" ? "Search or ask" : S.placeholderText, H = (e) => {
|
|
1377
|
+
u?.(e), !e.defaultPrevented && e.key === "Enter" && s && F && m.trim() && (e.preventDefault(), K());
|
|
1378
|
+
}, [ee, G] = e.useState(!1);
|
|
1379
|
+
e.useEffect(() => {
|
|
1380
|
+
T === 0 && G(!1);
|
|
1381
|
+
}, [T]);
|
|
1382
|
+
let te = () => {
|
|
1096
1383
|
C(""), T > 0 && w();
|
|
1097
|
-
},
|
|
1384
|
+
}, K = () => {
|
|
1385
|
+
I.current = m.trim(), s(m.trim());
|
|
1386
|
+
}, ne = /* @__PURE__ */ p(A, {
|
|
1098
1387
|
type: "text",
|
|
1099
1388
|
value: m,
|
|
1100
1389
|
onChange: (e) => C(e.target.value),
|
|
1101
|
-
placeholder:
|
|
1102
|
-
autoFocus:
|
|
1103
|
-
className:
|
|
1390
|
+
placeholder: V,
|
|
1391
|
+
autoFocus: n,
|
|
1392
|
+
className: t,
|
|
1104
1393
|
showSearchIcon: !0,
|
|
1105
|
-
inputSize:
|
|
1106
|
-
showFocusBorder:
|
|
1394
|
+
inputSize: r,
|
|
1395
|
+
showFocusBorder: a,
|
|
1107
1396
|
clearable: !1,
|
|
1108
|
-
onKeyDown:
|
|
1109
|
-
...
|
|
1397
|
+
onKeyDown: H,
|
|
1398
|
+
...d,
|
|
1110
1399
|
children: [
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1400
|
+
l === "chip" && B === "thinking" && /* @__PURE__ */ p("span", {
|
|
1401
|
+
className: Ye.thinking,
|
|
1402
|
+
"aria-live": "polite",
|
|
1403
|
+
children: [/* @__PURE__ */ f(z, {}), /* @__PURE__ */ f(M, { children: "Thinking" })]
|
|
1404
|
+
}),
|
|
1405
|
+
l === "chip" && (B === "ready" || B === "invite" || B === "hint" || B === "ask") && /* @__PURE__ */ f(y, {
|
|
1406
|
+
variant: B === "ready" ? "primary" : "ghost",
|
|
1407
|
+
className: B === "ready" ? Ye.askStrong : void 0,
|
|
1114
1408
|
size: "micro",
|
|
1115
|
-
iconLeft: /* @__PURE__ */ f(
|
|
1116
|
-
iconRight:
|
|
1117
|
-
onClick:
|
|
1118
|
-
title:
|
|
1119
|
-
children:
|
|
1409
|
+
iconLeft: /* @__PURE__ */ f(z, {}),
|
|
1410
|
+
iconRight: B === "ready" ? /* @__PURE__ */ f(D, { children: "Enter β΅" }) : void 0,
|
|
1411
|
+
onClick: K,
|
|
1412
|
+
title: F ? "Enter asks" : void 0,
|
|
1413
|
+
children: B === "ready" ? "Ask" : B === "hint" ? /* @__PURE__ */ f(M, { children: "For a quick answer, type a bit more" }) : B === "invite" ? "Ask about this" : "Ask"
|
|
1120
1414
|
}),
|
|
1121
|
-
|
|
1122
|
-
|
|
1415
|
+
o && k && /* @__PURE__ */ f(x, { children: "No results" }),
|
|
1416
|
+
o && j && /* @__PURE__ */ f(L, {
|
|
1123
1417
|
content: "No direct match. Showing the nearest results.",
|
|
1124
1418
|
children: /* @__PURE__ */ f("span", { children: /* @__PURE__ */ f(x, {
|
|
1125
|
-
icon: /* @__PURE__ */ f(
|
|
1419
|
+
icon: /* @__PURE__ */ f(W, {}),
|
|
1126
1420
|
children: "Nearest"
|
|
1127
1421
|
}) })
|
|
1128
1422
|
}),
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1423
|
+
o && T > 0 && /* @__PURE__ */ f(O, {
|
|
1424
|
+
open: ee,
|
|
1425
|
+
onOpenChange: G,
|
|
1426
|
+
align: "end",
|
|
1427
|
+
sideOffset: 6,
|
|
1428
|
+
className: Ye.filtersPopover,
|
|
1429
|
+
"aria-label": "Active filters",
|
|
1430
|
+
trigger: /* @__PURE__ */ f(y, {
|
|
1431
|
+
variant: "ghost",
|
|
1432
|
+
size: "micro",
|
|
1433
|
+
className: Ye.filterChip,
|
|
1434
|
+
"aria-label": `${T} filter${T === 1 ? "" : "s"} active: show them`,
|
|
1435
|
+
title: `${T} filter${T === 1 ? "" : "s"} active`,
|
|
1436
|
+
children: /* @__PURE__ */ f(x, {
|
|
1437
|
+
icon: /* @__PURE__ */ f(U, {}),
|
|
1438
|
+
color: "var(--CLightBlue)",
|
|
1439
|
+
textColor: "#080809",
|
|
1440
|
+
children: T
|
|
1441
|
+
})
|
|
1442
|
+
}),
|
|
1443
|
+
children: /* @__PURE__ */ f(Je, {})
|
|
1137
1444
|
}),
|
|
1138
|
-
|
|
1445
|
+
i && (E || T > 0) && /* @__PURE__ */ f(y, {
|
|
1139
1446
|
variant: "ghost",
|
|
1140
1447
|
size: "micro",
|
|
1141
|
-
onClick:
|
|
1448
|
+
onClick: te,
|
|
1142
1449
|
"aria-label": T > 0 ? "Clear search and filters" : "Clear search",
|
|
1143
1450
|
children: "Clear"
|
|
1144
1451
|
})
|
|
1145
1452
|
]
|
|
1146
1453
|
});
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
className: U ? Re.askStrong : void 0,
|
|
1157
|
-
iconLeft: /* @__PURE__ */ f(L, {}),
|
|
1158
|
-
onClick: z,
|
|
1159
|
-
children: U ? "Ask the assistant" : "Ask about this"
|
|
1160
|
-
}), U && /* @__PURE__ */ p("span", {
|
|
1161
|
-
className: Re.offerHint,
|
|
1162
|
-
children: [/* @__PURE__ */ f("kbd", {
|
|
1163
|
-
className: Re.kbd,
|
|
1164
|
-
children: "β΅"
|
|
1165
|
-
}), " to ask"]
|
|
1166
|
-
})] })
|
|
1454
|
+
return l !== "below" || !s || !P.available ? ne : /* @__PURE__ */ p("div", {
|
|
1455
|
+
className: Ye.withOffer,
|
|
1456
|
+
children: [ne, /* @__PURE__ */ f("div", {
|
|
1457
|
+
className: Ye.offerRow,
|
|
1458
|
+
children: !R && /* @__PURE__ */ f(Ue, {
|
|
1459
|
+
searchOrAsk: P,
|
|
1460
|
+
onAsk: K,
|
|
1461
|
+
className: Ye.offerQuick
|
|
1462
|
+
})
|
|
1167
1463
|
})]
|
|
1168
1464
|
});
|
|
1169
|
-
},
|
|
1465
|
+
}, Ze = {
|
|
1170
1466
|
message: "_message_1mgfk_1",
|
|
1171
1467
|
icon: "_icon_1mgfk_10",
|
|
1172
1468
|
title: "_title_1mgfk_15",
|
|
1173
1469
|
detail: "_detail_1mgfk_20",
|
|
1174
1470
|
technical: "_technical_1mgfk_25",
|
|
1175
1471
|
button: "_button_1mgfk_33"
|
|
1176
|
-
},
|
|
1472
|
+
}, Qe = {
|
|
1177
1473
|
unreachable: {
|
|
1178
|
-
icon:
|
|
1474
|
+
icon: H,
|
|
1179
1475
|
title: "Search is unavailable",
|
|
1180
1476
|
detail: "The search server canβt be reached right now."
|
|
1181
1477
|
},
|
|
1182
1478
|
unauthorized: {
|
|
1183
|
-
icon:
|
|
1479
|
+
icon: te,
|
|
1184
1480
|
title: "Search is unavailable",
|
|
1185
1481
|
detail: "The search key was not accepted."
|
|
1186
1482
|
},
|
|
1187
1483
|
forbidden: {
|
|
1188
|
-
icon:
|
|
1484
|
+
icon: K,
|
|
1189
1485
|
title: "Search is unavailable",
|
|
1190
1486
|
detail: "This search key doesnβt have access to these results."
|
|
1191
1487
|
},
|
|
1192
1488
|
notFound: {
|
|
1193
|
-
icon:
|
|
1489
|
+
icon: re,
|
|
1194
1490
|
title: "Nothing to search here",
|
|
1195
1491
|
detail: "The collection this page searches doesnβt exist."
|
|
1196
1492
|
},
|
|
1197
1493
|
notReady: {
|
|
1198
|
-
icon:
|
|
1494
|
+
icon: ee,
|
|
1199
1495
|
title: "Search is getting ready",
|
|
1200
1496
|
detail: "Results will appear in a moment."
|
|
1201
1497
|
},
|
|
1202
1498
|
unavailable: {
|
|
1203
|
-
icon:
|
|
1499
|
+
icon: q,
|
|
1204
1500
|
title: "Search is unavailable",
|
|
1205
1501
|
detail: "The collection canβt be searched right now."
|
|
1206
1502
|
},
|
|
1207
1503
|
rateLimited: {
|
|
1208
|
-
icon:
|
|
1504
|
+
icon: ie,
|
|
1209
1505
|
title: "Too many searches",
|
|
1210
1506
|
detail: "Wait a moment, then try again."
|
|
1211
1507
|
},
|
|
1212
1508
|
server: {
|
|
1213
|
-
icon:
|
|
1509
|
+
icon: q,
|
|
1214
1510
|
title: "Something went wrong",
|
|
1215
1511
|
detail: "The search server ran into a problem."
|
|
1216
1512
|
},
|
|
1217
1513
|
setup: {
|
|
1218
|
-
icon:
|
|
1514
|
+
icon: q,
|
|
1219
1515
|
title: "Search isnβt set up",
|
|
1220
1516
|
detail: "This page is missing part of its search setup."
|
|
1221
1517
|
},
|
|
1222
1518
|
unknown: {
|
|
1223
|
-
icon:
|
|
1519
|
+
icon: q,
|
|
1224
1520
|
title: "Something went wrong",
|
|
1225
1521
|
detail: "The search couldnβt be completed."
|
|
1226
1522
|
}
|
|
1227
|
-
},
|
|
1228
|
-
let { icon: r, title: i, detail: a } =
|
|
1523
|
+
}, $e = ({ error: e, onRetry: t, hideTechnical: n = !1 }) => {
|
|
1524
|
+
let { icon: r, title: i, detail: a } = Qe[e.kind];
|
|
1229
1525
|
o(() => {
|
|
1230
1526
|
if (e.kind !== "notReady" || !t) return;
|
|
1231
1527
|
let n = setTimeout(t, (e.retryAfterSeconds ?? 2) * 1e3);
|
|
@@ -1233,65 +1529,65 @@ var Re = {
|
|
|
1233
1529
|
}, [e, t]);
|
|
1234
1530
|
let s = e.retryable && e.kind !== "notReady" && t;
|
|
1235
1531
|
return /* @__PURE__ */ p("div", {
|
|
1236
|
-
className:
|
|
1532
|
+
className: Ze.message,
|
|
1237
1533
|
role: "alert",
|
|
1238
1534
|
children: [
|
|
1239
1535
|
/* @__PURE__ */ f("span", {
|
|
1240
|
-
className:
|
|
1536
|
+
className: Ze.icon,
|
|
1241
1537
|
children: /* @__PURE__ */ f(r, {
|
|
1242
1538
|
size: 70,
|
|
1243
1539
|
color: "var(--lv4)"
|
|
1244
1540
|
})
|
|
1245
1541
|
}),
|
|
1246
1542
|
/* @__PURE__ */ f("div", {
|
|
1247
|
-
className:
|
|
1543
|
+
className: Ze.title,
|
|
1248
1544
|
children: i
|
|
1249
1545
|
}),
|
|
1250
1546
|
/* @__PURE__ */ f("div", {
|
|
1251
|
-
className:
|
|
1547
|
+
className: Ze.detail,
|
|
1252
1548
|
children: a
|
|
1253
1549
|
}),
|
|
1254
1550
|
!n && /* @__PURE__ */ f("code", {
|
|
1255
|
-
className:
|
|
1551
|
+
className: Ze.technical,
|
|
1256
1552
|
children: e.technical
|
|
1257
1553
|
}),
|
|
1258
1554
|
s && /* @__PURE__ */ f(y, {
|
|
1259
1555
|
variant: "secondary",
|
|
1260
1556
|
size: "micro",
|
|
1261
|
-
className:
|
|
1557
|
+
className: Ze.button,
|
|
1262
1558
|
onClick: t,
|
|
1263
1559
|
children: "Try again"
|
|
1264
1560
|
})
|
|
1265
1561
|
]
|
|
1266
1562
|
});
|
|
1267
|
-
},
|
|
1563
|
+
}, et = {
|
|
1268
1564
|
placeholder: "_placeholder_1qr5o_1",
|
|
1269
1565
|
invalid: "_invalid_1qr5o_11",
|
|
1270
1566
|
searchedFor: "_searchedFor_1qr5o_17"
|
|
1271
|
-
},
|
|
1567
|
+
}, tt = {
|
|
1272
1568
|
row: "_row_11svi_1",
|
|
1273
1569
|
content: "_content_11svi_22",
|
|
1274
1570
|
indexNumber: "_indexNumber_11svi_36",
|
|
1275
1571
|
scoreNumber: "_scoreNumber_11svi_44",
|
|
1276
1572
|
skeletonBars: "_skeletonBars_11svi_53"
|
|
1277
|
-
},
|
|
1278
|
-
className:
|
|
1573
|
+
}, nt = ({ skeleton: e = !1, index: t, score: n, showScore: r = !1, children: i, skeletonDelay: a = 0, skeletonWidths: o = [62, 38] }) => /* @__PURE__ */ p("div", {
|
|
1574
|
+
className: tt.row,
|
|
1279
1575
|
children: [
|
|
1280
1576
|
t !== void 0 && /* @__PURE__ */ f("div", {
|
|
1281
|
-
className:
|
|
1577
|
+
className: tt.indexNumber,
|
|
1282
1578
|
children: t
|
|
1283
1579
|
}),
|
|
1284
1580
|
/* @__PURE__ */ f("div", {
|
|
1285
|
-
className:
|
|
1581
|
+
className: tt.content,
|
|
1286
1582
|
children: e ? /* @__PURE__ */ p("div", {
|
|
1287
|
-
className:
|
|
1288
|
-
children: [/* @__PURE__ */ f(
|
|
1583
|
+
className: tt.skeletonBars,
|
|
1584
|
+
children: [/* @__PURE__ */ f(N, {
|
|
1289
1585
|
level: 3,
|
|
1290
1586
|
height: 12,
|
|
1291
1587
|
width: `${o[0]}%`,
|
|
1292
1588
|
delay: a,
|
|
1293
1589
|
appear: !1
|
|
1294
|
-
}), /* @__PURE__ */ f(
|
|
1590
|
+
}), /* @__PURE__ */ f(N, {
|
|
1295
1591
|
level: 3,
|
|
1296
1592
|
height: 8,
|
|
1297
1593
|
width: `${o[1]}%`,
|
|
@@ -1301,14 +1597,14 @@ var Re = {
|
|
|
1301
1597
|
}) : i
|
|
1302
1598
|
}),
|
|
1303
1599
|
r && n !== void 0 && /* @__PURE__ */ f("div", {
|
|
1304
|
-
className:
|
|
1600
|
+
className: tt.scoreNumber,
|
|
1305
1601
|
children: n
|
|
1306
1602
|
})
|
|
1307
1603
|
]
|
|
1308
|
-
}),
|
|
1604
|
+
}), rt = {
|
|
1309
1605
|
wrapper: "_wrapper_f970z_6",
|
|
1310
1606
|
skeletonAppear: "_skeletonAppear_f970z_1"
|
|
1311
|
-
},
|
|
1607
|
+
}, it = [
|
|
1312
1608
|
[62, 38],
|
|
1313
1609
|
[75, 45],
|
|
1314
1610
|
[58, 33],
|
|
@@ -1317,28 +1613,28 @@ var Re = {
|
|
|
1317
1613
|
[55, 35],
|
|
1318
1614
|
[72, 40],
|
|
1319
1615
|
[60, 30]
|
|
1320
|
-
],
|
|
1321
|
-
className:
|
|
1322
|
-
children: Array.from({ length: e }).map((e, t) => /* @__PURE__ */ f(
|
|
1616
|
+
], at = ({ rows: e = 6 }) => /* @__PURE__ */ f("div", {
|
|
1617
|
+
className: rt.wrapper,
|
|
1618
|
+
children: Array.from({ length: e }).map((e, t) => /* @__PURE__ */ f(nt, {
|
|
1323
1619
|
skeleton: !0,
|
|
1324
1620
|
skeletonDelay: t * .1,
|
|
1325
|
-
skeletonWidths:
|
|
1621
|
+
skeletonWidths: it[t % it.length]
|
|
1326
1622
|
}, t))
|
|
1327
|
-
}),
|
|
1328
|
-
function
|
|
1623
|
+
}), ot = /^\[\s*(?:'[^']*'(?:\s*,\s*'[^']*')*)?\s*\]$/;
|
|
1624
|
+
function st(e) {
|
|
1329
1625
|
let t = e.trim();
|
|
1330
1626
|
if (!t.startsWith("[") || !t.endsWith("]")) return;
|
|
1331
1627
|
try {
|
|
1332
1628
|
let e = JSON.parse(t);
|
|
1333
1629
|
if (Array.isArray(e)) return e.map((e) => String(e));
|
|
1334
1630
|
} catch {}
|
|
1335
|
-
if (!
|
|
1631
|
+
if (!ot.test(t)) return;
|
|
1336
1632
|
let n = [], r = /'([^']*)'/g, i;
|
|
1337
1633
|
for (; (i = r.exec(t)) !== null;) n.push(i[1]);
|
|
1338
1634
|
return n;
|
|
1339
1635
|
}
|
|
1340
|
-
var
|
|
1341
|
-
let { state: { results: s, resultsSuppressed: u, searchSettings: m, truncationIndex: h, query: g, error: _, errorInfo: v }, isFetchingInitial: b, authError: x, authErrorInfo: S, retry: C, allowEmptySearch: w, fetchMoreResults: T, selectResult: E, searchText: D, searchAsTyped: O } =
|
|
1636
|
+
var ct = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk: r, showScore: i, children: a }) => {
|
|
1637
|
+
let { state: { results: s, resultsSuppressed: u, searchSettings: m, truncationIndex: h, query: g, error: _, errorInfo: v }, isFetchingInitial: b, authError: x, authErrorInfo: S, retry: C, allowEmptySearch: w, fetchMoreResults: T, selectResult: E, searchText: D, searchAsTyped: O } = _e(), k = t ?? 30, [A, j] = l(k), M = c(0), N = c("");
|
|
1342
1638
|
o(() => {
|
|
1343
1639
|
let e = g !== N.current;
|
|
1344
1640
|
(!s || s.length < M.current || e) && j(k), M.current = s?.length ?? 0, N.current = g;
|
|
@@ -1347,19 +1643,19 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1347
1643
|
k,
|
|
1348
1644
|
g
|
|
1349
1645
|
]);
|
|
1350
|
-
let P = s ?
|
|
1646
|
+
let P = s ? Oe(s, h, !!r?.cutResults, r?.cutRule) : [], F = D != null && D.trim() !== g.trim() ? D : null, I = s && P.length > A, L = () => {
|
|
1351
1647
|
let e = A + k;
|
|
1352
1648
|
j(e), s && e >= s.length && (!h || h === -1 || h > s.length) && T(s.length + k);
|
|
1353
1649
|
};
|
|
1354
|
-
if (b) return w ? /* @__PURE__ */ f(
|
|
1355
|
-
className:
|
|
1356
|
-
children: /* @__PURE__ */ f(
|
|
1650
|
+
if (b) return w ? /* @__PURE__ */ f(at, { rows: k }) : /* @__PURE__ */ f("div", {
|
|
1651
|
+
className: et.placeholder,
|
|
1652
|
+
children: /* @__PURE__ */ f(G, {
|
|
1357
1653
|
size: 200,
|
|
1358
1654
|
color: "var(--lv5)"
|
|
1359
1655
|
})
|
|
1360
1656
|
});
|
|
1361
1657
|
let R = x ?? _;
|
|
1362
|
-
return R ? /* @__PURE__ */ f(
|
|
1658
|
+
return R ? /* @__PURE__ */ f($e, {
|
|
1363
1659
|
error: (x ? S : v) ?? {
|
|
1364
1660
|
kind: "unknown",
|
|
1365
1661
|
message: R,
|
|
@@ -1368,14 +1664,14 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1368
1664
|
},
|
|
1369
1665
|
onRetry: C
|
|
1370
1666
|
}) : u || s === null ? /* @__PURE__ */ f("div", {
|
|
1371
|
-
className:
|
|
1372
|
-
children: /* @__PURE__ */ f(
|
|
1667
|
+
className: et.placeholder,
|
|
1668
|
+
children: /* @__PURE__ */ f(G, {
|
|
1373
1669
|
size: 200,
|
|
1374
1670
|
color: "var(--lv5)"
|
|
1375
1671
|
})
|
|
1376
1672
|
}) : P.length === 0 ? null : /* @__PURE__ */ p(d, { children: [
|
|
1377
1673
|
F && /* @__PURE__ */ p("div", {
|
|
1378
|
-
className:
|
|
1674
|
+
className: et.searchedFor,
|
|
1379
1675
|
"aria-live": "polite",
|
|
1380
1676
|
children: [/* @__PURE__ */ p("span", { children: ["Searching for ", /* @__PURE__ */ f("strong", { children: F })] }), O && /* @__PURE__ */ f(y, {
|
|
1381
1677
|
variant: "ghost",
|
|
@@ -1390,7 +1686,7 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1390
1686
|
c = typeof o == "string" ? JSON.parse(o) : o;
|
|
1391
1687
|
} catch {
|
|
1392
1688
|
return /* @__PURE__ */ f("div", {
|
|
1393
|
-
className:
|
|
1689
|
+
className: et.invalid,
|
|
1394
1690
|
children: /* @__PURE__ */ f("p", { children: "Invalid JSON" })
|
|
1395
1691
|
}, r);
|
|
1396
1692
|
}
|
|
@@ -1402,11 +1698,11 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1402
1698
|
if (n) for (let e in l) {
|
|
1403
1699
|
let t = l[e];
|
|
1404
1700
|
if (typeof t == "string") {
|
|
1405
|
-
let n =
|
|
1701
|
+
let n = st(t);
|
|
1406
1702
|
n && (l[e] = n);
|
|
1407
1703
|
}
|
|
1408
1704
|
}
|
|
1409
|
-
return /* @__PURE__ */ f(
|
|
1705
|
+
return /* @__PURE__ */ f(nt, {
|
|
1410
1706
|
index: r,
|
|
1411
1707
|
score: s,
|
|
1412
1708
|
showScore: i ?? m.showScore,
|
|
@@ -1429,18 +1725,18 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1429
1725
|
})
|
|
1430
1726
|
})
|
|
1431
1727
|
] });
|
|
1432
|
-
},
|
|
1728
|
+
}, lt = {
|
|
1433
1729
|
row: "_row_ujwhc_1",
|
|
1434
1730
|
title: "_title_ujwhc_8"
|
|
1435
|
-
},
|
|
1436
|
-
className: [
|
|
1731
|
+
}, ut = ({ variant: e = "default", children: t }) => /* @__PURE__ */ f("div", {
|
|
1732
|
+
className: [lt.row, e === "title" ? lt.title : ""].filter(Boolean).join(" "),
|
|
1437
1733
|
children: t
|
|
1438
|
-
}),
|
|
1734
|
+
}), dt = {
|
|
1439
1735
|
listRows: "_listRows_13obt_2",
|
|
1440
1736
|
sliderArea: "_sliderArea_13obt_8",
|
|
1441
1737
|
inputRow: "_inputRow_13obt_15",
|
|
1442
1738
|
histogramRow: "_histogramRow_13obt_22"
|
|
1443
|
-
},
|
|
1739
|
+
}, ft = [
|
|
1444
1740
|
65,
|
|
1445
1741
|
80,
|
|
1446
1742
|
55,
|
|
@@ -1449,22 +1745,22 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1449
1745
|
75,
|
|
1450
1746
|
50,
|
|
1451
1747
|
68
|
|
1452
|
-
],
|
|
1748
|
+
], pt = ({ title: e, rows: t = 5, variant: n = "list", withHistogram: r = !1, collapsible: i = !0, startCollapsed: a = !1 }) => /* @__PURE__ */ f(T, {
|
|
1453
1749
|
title: e,
|
|
1454
1750
|
collapsible: i,
|
|
1455
1751
|
collapsed: a,
|
|
1456
1752
|
children: n === "slider" ? /* @__PURE__ */ p("div", {
|
|
1457
|
-
className:
|
|
1753
|
+
className: dt.sliderArea,
|
|
1458
1754
|
children: [
|
|
1459
|
-
r && /* @__PURE__ */ f("div", { className:
|
|
1460
|
-
/* @__PURE__ */ f(
|
|
1755
|
+
r && /* @__PURE__ */ f("div", { className: dt.histogramRow }),
|
|
1756
|
+
/* @__PURE__ */ f(N, { height: 6 }),
|
|
1461
1757
|
/* @__PURE__ */ p("div", {
|
|
1462
|
-
className:
|
|
1463
|
-
children: [/* @__PURE__ */ f(
|
|
1758
|
+
className: dt.inputRow,
|
|
1759
|
+
children: [/* @__PURE__ */ f(N, {
|
|
1464
1760
|
width: 40,
|
|
1465
1761
|
height: 20,
|
|
1466
1762
|
delay: .1
|
|
1467
|
-
}), /* @__PURE__ */ f(
|
|
1763
|
+
}), /* @__PURE__ */ f(N, {
|
|
1468
1764
|
width: 40,
|
|
1469
1765
|
height: 20,
|
|
1470
1766
|
delay: .15
|
|
@@ -1472,13 +1768,13 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1472
1768
|
})
|
|
1473
1769
|
]
|
|
1474
1770
|
}) : /* @__PURE__ */ f("div", {
|
|
1475
|
-
className:
|
|
1476
|
-
children: Array.from({ length: t }).map((e, t) => /* @__PURE__ */ f(
|
|
1477
|
-
width: `${
|
|
1771
|
+
className: dt.listRows,
|
|
1772
|
+
children: Array.from({ length: t }).map((e, t) => /* @__PURE__ */ f(N, {
|
|
1773
|
+
width: `${ft[t % ft.length]}%`,
|
|
1478
1774
|
delay: t * .05
|
|
1479
1775
|
}, t))
|
|
1480
1776
|
})
|
|
1481
|
-
}),
|
|
1777
|
+
}), Z = {
|
|
1482
1778
|
list: "_list_18vbb_2",
|
|
1483
1779
|
count: "_count_18vbb_7",
|
|
1484
1780
|
countValue: "_countValue_18vbb_17",
|
|
@@ -1486,10 +1782,10 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1486
1782
|
chipLabel: "_chipLabel_18vbb_32",
|
|
1487
1783
|
grid: "_grid_18vbb_40",
|
|
1488
1784
|
active: "_active_18vbb_54"
|
|
1489
|
-
},
|
|
1785
|
+
}, mt = {
|
|
1490
1786
|
notice: "_notice_4sel0_1",
|
|
1491
1787
|
technical: "_technical_4sel0_9"
|
|
1492
|
-
},
|
|
1788
|
+
}, ht = ({ label: e, field: t, missing: n }) => {
|
|
1493
1789
|
let r = n.map((e) => e[0].toUpperCase() + e.slice(1)).join(" and ");
|
|
1494
1790
|
return o(() => {
|
|
1495
1791
|
console.warn(`[intrface] The panel for "${t}" is hidden: the field is not ${r}. Mark it ${r} in the dataset's field configuration (web console β Fields).`);
|
|
@@ -1497,9 +1793,9 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1497
1793
|
title: e ?? t,
|
|
1498
1794
|
collapsible: !1,
|
|
1499
1795
|
children: /* @__PURE__ */ p("div", {
|
|
1500
|
-
className:
|
|
1796
|
+
className: mt.notice,
|
|
1501
1797
|
children: [/* @__PURE__ */ f("span", { children: "Not available" }), /* @__PURE__ */ p("code", {
|
|
1502
|
-
className:
|
|
1798
|
+
className: mt.technical,
|
|
1503
1799
|
children: [
|
|
1504
1800
|
t,
|
|
1505
1801
|
": not ",
|
|
@@ -1508,8 +1804,8 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1508
1804
|
})]
|
|
1509
1805
|
})
|
|
1510
1806
|
});
|
|
1511
|
-
},
|
|
1512
|
-
let { state: { facets: w, filterableFields: E, facetableFields: D, filters:
|
|
1807
|
+
}, gt = ({ 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: m, layout: h = "list", showActivePanel: g = !1, showCount: _ = !0, showNull: v = !1, match: x = "all", displayIfEmptyQuery: S = !0, displayCondition: C = (e) => !0 }) => {
|
|
1808
|
+
let { state: { facets: w, filterableFields: E, facetableFields: D, filters: O, query: A }, toggleFilter: j, setValueMatch: M, authError: N, isFetchingInitial: P, allowEmptySearch: F } = _e(), L = d ?? m ?? "checkbox", R = L === "radio" ? "any" : x;
|
|
1513
1809
|
o(() => {
|
|
1514
1810
|
M(e, R);
|
|
1515
1811
|
}, [
|
|
@@ -1520,11 +1816,11 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1520
1816
|
let z = c(null), [B, V] = l(a);
|
|
1521
1817
|
if (o(() => {
|
|
1522
1818
|
V(a);
|
|
1523
|
-
}, [w?.[e], a]), !
|
|
1524
|
-
if (
|
|
1819
|
+
}, [w?.[e], a]), !F && !A || N) return null;
|
|
1820
|
+
if (P || !w) return L === "toggle" ? /* @__PURE__ */ f(pt, {
|
|
1525
1821
|
rows: 1,
|
|
1526
1822
|
collapsible: !1
|
|
1527
|
-
}) : /* @__PURE__ */ f(
|
|
1823
|
+
}) : /* @__PURE__ */ f(pt, {
|
|
1528
1824
|
title: t,
|
|
1529
1825
|
rows: Math.min(a, 6),
|
|
1530
1826
|
collapsible: s,
|
|
@@ -1532,12 +1828,12 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1532
1828
|
});
|
|
1533
1829
|
if (!C({
|
|
1534
1830
|
query: A ?? "",
|
|
1535
|
-
filters:
|
|
1831
|
+
filters: O,
|
|
1536
1832
|
facets: w
|
|
1537
|
-
}) || !S && !A && Object.keys(
|
|
1833
|
+
}) || !S && !A && Object.keys(O).length < 1) return null;
|
|
1538
1834
|
if (!E?.includes(e) || !D?.includes(e)) {
|
|
1539
1835
|
let n = [];
|
|
1540
|
-
return E?.includes(e) || n.push("filterable"), D?.includes(e) || n.push("facetable"), /* @__PURE__ */ f(
|
|
1836
|
+
return E?.includes(e) || n.push("filterable"), D?.includes(e) || n.push("facetable"), /* @__PURE__ */ f(ht, {
|
|
1541
1837
|
label: t,
|
|
1542
1838
|
field: e,
|
|
1543
1839
|
missing: n
|
|
@@ -1545,7 +1841,7 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1545
1841
|
}
|
|
1546
1842
|
let H = w?.[e] ?? (L === "toggle" ? [] : void 0);
|
|
1547
1843
|
if (!H || !Array.isArray(H)) return null;
|
|
1548
|
-
let U =
|
|
1844
|
+
let U = O?.[e] ?? [];
|
|
1549
1845
|
n && !z.current && H.length > 0 && (z.current = H.reduce((e, t) => (e[t.key] = t.value, e), {}));
|
|
1550
1846
|
let W = /* @__PURE__ */ new Map();
|
|
1551
1847
|
n && z.current && Object.keys(z.current).forEach((e) => {
|
|
@@ -1553,7 +1849,7 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1553
1849
|
}), H.forEach((e) => {
|
|
1554
1850
|
W.set(e.key, e.value);
|
|
1555
1851
|
});
|
|
1556
|
-
let ee = new Set([
|
|
1852
|
+
let ee = /* @__PURE__ */ new Set([
|
|
1557
1853
|
"true",
|
|
1558
1854
|
"false",
|
|
1559
1855
|
"null"
|
|
@@ -1565,8 +1861,8 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1565
1861
|
if (L === "toggle" && !te) return /* @__PURE__ */ f(T, {
|
|
1566
1862
|
collapsible: !1,
|
|
1567
1863
|
children: /* @__PURE__ */ f("div", {
|
|
1568
|
-
className:
|
|
1569
|
-
children: /* @__PURE__ */ f(
|
|
1864
|
+
className: Z.count,
|
|
1865
|
+
children: /* @__PURE__ */ f(I, {
|
|
1570
1866
|
label: t,
|
|
1571
1867
|
checked: !1,
|
|
1572
1868
|
onChange: () => {},
|
|
@@ -1579,9 +1875,9 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1579
1875
|
return /* @__PURE__ */ f(T, {
|
|
1580
1876
|
collapsible: !1,
|
|
1581
1877
|
children: /* @__PURE__ */ p("div", {
|
|
1582
|
-
className:
|
|
1878
|
+
className: Z.count,
|
|
1583
1879
|
children: [
|
|
1584
|
-
/* @__PURE__ */ f(
|
|
1880
|
+
/* @__PURE__ */ f(I, {
|
|
1585
1881
|
label: t,
|
|
1586
1882
|
checked: i,
|
|
1587
1883
|
onChange: () => j(e, "true"),
|
|
@@ -1595,37 +1891,39 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1595
1891
|
}
|
|
1596
1892
|
let K = Array.from(W.entries());
|
|
1597
1893
|
if (v || (K = K.filter(([e]) => e !== "null")), K.length === 0 && !n) return null;
|
|
1598
|
-
if (!r)
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
let
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1894
|
+
if (!r) {
|
|
1895
|
+
if (i === "alphabetical") {
|
|
1896
|
+
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));
|
|
1897
|
+
K = [...e, ...t];
|
|
1898
|
+
} else if (i === "numeric") {
|
|
1899
|
+
let e = (e, t) => {
|
|
1900
|
+
let n = Number(e), r = Number(t);
|
|
1901
|
+
return !isNaN(n) && !isNaN(r) ? n - r : e.localeCompare(t);
|
|
1902
|
+
}, t = K.filter(([, e]) => typeof e == "number" && e > 0).sort(([t], [n]) => e(t, n)), n = K.filter(([, e]) => e === 0 || e === null).sort(([t], [n]) => e(t, n));
|
|
1903
|
+
K = [...t, ...n];
|
|
1904
|
+
} else {
|
|
1905
|
+
let e = K.filter(([, e]) => typeof e == "number" && e > 0), t = K.filter(([, e]) => e === 0 || e === null);
|
|
1906
|
+
K = [...e, ...t];
|
|
1907
|
+
}
|
|
1610
1908
|
}
|
|
1611
1909
|
let ne = typeof a == "number" && K.length > a, re = ne ? K.slice(0, B) : K, ie = (t, n) => {
|
|
1612
1910
|
let r = U.includes(t), i = n === 0, a = _ && (n ?? 0) > 0 ? ` (${n})` : "", o = _ && (n ?? 0) > 0 ? n : "", s = () => j(e, t, L === "radio");
|
|
1613
1911
|
switch (L) {
|
|
1614
1912
|
case "button": return h === "list" ? /* @__PURE__ */ p("div", {
|
|
1615
|
-
className:
|
|
1913
|
+
className: Z.count,
|
|
1616
1914
|
children: [/* @__PURE__ */ f(y, {
|
|
1617
1915
|
variant: r ? "primary" : "secondary",
|
|
1618
1916
|
onClick: s,
|
|
1619
1917
|
disabled: i,
|
|
1620
1918
|
size: "micro",
|
|
1621
|
-
className:
|
|
1919
|
+
className: Z.chip,
|
|
1622
1920
|
title: t,
|
|
1623
1921
|
children: /* @__PURE__ */ f("span", {
|
|
1624
|
-
className:
|
|
1922
|
+
className: Z.chipLabel,
|
|
1625
1923
|
children: t
|
|
1626
1924
|
})
|
|
1627
1925
|
}), /* @__PURE__ */ f("span", {
|
|
1628
|
-
className:
|
|
1926
|
+
className: Z.countValue,
|
|
1629
1927
|
children: o
|
|
1630
1928
|
})]
|
|
1631
1929
|
}) : /* @__PURE__ */ f(y, {
|
|
@@ -1633,21 +1931,21 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1633
1931
|
onClick: s,
|
|
1634
1932
|
disabled: i,
|
|
1635
1933
|
size: "micro",
|
|
1636
|
-
className:
|
|
1934
|
+
className: Z.chip,
|
|
1637
1935
|
title: `${t}${a}`,
|
|
1638
1936
|
children: /* @__PURE__ */ f("span", {
|
|
1639
|
-
className:
|
|
1937
|
+
className: Z.chipLabel,
|
|
1640
1938
|
children: `${t}${a}`
|
|
1641
1939
|
})
|
|
1642
1940
|
});
|
|
1643
|
-
case "toggle": return /* @__PURE__ */ f(
|
|
1941
|
+
case "toggle": return /* @__PURE__ */ f(I, {
|
|
1644
1942
|
label: t,
|
|
1645
1943
|
checked: r,
|
|
1646
1944
|
onChange: s,
|
|
1647
1945
|
disabled: i
|
|
1648
1946
|
});
|
|
1649
1947
|
case "radio": {
|
|
1650
|
-
let n = /* @__PURE__ */ f(
|
|
1948
|
+
let n = /* @__PURE__ */ f(k, {
|
|
1651
1949
|
id: `${e}-${t}`,
|
|
1652
1950
|
name: e,
|
|
1653
1951
|
value: t,
|
|
@@ -1657,15 +1955,15 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1657
1955
|
disabled: i
|
|
1658
1956
|
});
|
|
1659
1957
|
return h === "list" ? /* @__PURE__ */ p("div", {
|
|
1660
|
-
className:
|
|
1958
|
+
className: Z.count,
|
|
1661
1959
|
children: [n, /* @__PURE__ */ f("span", {
|
|
1662
|
-
className:
|
|
1960
|
+
className: Z.countValue,
|
|
1663
1961
|
children: o
|
|
1664
1962
|
})]
|
|
1665
1963
|
}) : n;
|
|
1666
1964
|
}
|
|
1667
1965
|
default: return h === "list" ? /* @__PURE__ */ p("div", {
|
|
1668
|
-
className:
|
|
1966
|
+
className: Z.count,
|
|
1669
1967
|
children: [/* @__PURE__ */ f(b, {
|
|
1670
1968
|
label: t,
|
|
1671
1969
|
score: "",
|
|
@@ -1673,7 +1971,7 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1673
1971
|
onChange: s,
|
|
1674
1972
|
disabled: i
|
|
1675
1973
|
}), /* @__PURE__ */ f("span", {
|
|
1676
|
-
className:
|
|
1974
|
+
className: Z.countValue,
|
|
1677
1975
|
children: o
|
|
1678
1976
|
})]
|
|
1679
1977
|
}) : /* @__PURE__ */ f(b, {
|
|
@@ -1689,9 +1987,9 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1689
1987
|
title: t,
|
|
1690
1988
|
collapsible: s,
|
|
1691
1989
|
collapsed: s ? u : !1,
|
|
1692
|
-
className: g && U.length > 0 ?
|
|
1990
|
+
className: g && U.length > 0 ? Z.active : void 0,
|
|
1693
1991
|
children: /* @__PURE__ */ p("ul", {
|
|
1694
|
-
className: h === "grid" ?
|
|
1992
|
+
className: h === "grid" ? Z.grid : Z.list,
|
|
1695
1993
|
style: {
|
|
1696
1994
|
listStyle: "none",
|
|
1697
1995
|
padding: 0,
|
|
@@ -1700,7 +1998,7 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1700
1998
|
children: [re.map(([e, t]) => /* @__PURE__ */ f("li", { children: ie(e, t) }, e)), ne && B < K.length && (() => {
|
|
1701
1999
|
let e = K.length - B, t = Math.min(50, e);
|
|
1702
2000
|
return /* @__PURE__ */ f("li", {
|
|
1703
|
-
className:
|
|
2001
|
+
className: Z.toggleItem,
|
|
1704
2002
|
children: /* @__PURE__ */ f(y, {
|
|
1705
2003
|
variant: "ghost",
|
|
1706
2004
|
size: "micro",
|
|
@@ -1711,7 +2009,7 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1711
2009
|
})()]
|
|
1712
2010
|
})
|
|
1713
2011
|
});
|
|
1714
|
-
},
|
|
2012
|
+
}, Q = {
|
|
1715
2013
|
disabledMessage: "_disabledMessage_adany_1",
|
|
1716
2014
|
histogram: "_histogram_adany_6",
|
|
1717
2015
|
histogramLayer: "_histogramLayer_adany_14",
|
|
@@ -1723,39 +2021,37 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1723
2021
|
histogramSeparator: "_histogramSeparator_adany_48",
|
|
1724
2022
|
active: "_active_adany_76"
|
|
1725
2023
|
};
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
function ot(e) {
|
|
2024
|
+
// src/utils/numeric.ts
|
|
2025
|
+
function _t(e) {
|
|
1729
2026
|
if (!Number.isFinite(e)) return 0;
|
|
1730
2027
|
let t = String(e), n = t.indexOf(".");
|
|
1731
2028
|
return n === -1 ? 0 : Math.min(6, t.length - n - 1);
|
|
1732
2029
|
}
|
|
1733
|
-
function
|
|
2030
|
+
function vt(e) {
|
|
1734
2031
|
let t = 0;
|
|
1735
|
-
for (let n of e) t = Math.max(t,
|
|
2032
|
+
for (let n of e) t = Math.max(t, _t(n));
|
|
1736
2033
|
return t === 0 ? 1 : Number((10 ** -t).toFixed(t));
|
|
1737
2034
|
}
|
|
1738
|
-
function
|
|
1739
|
-
return Number(e.toFixed(
|
|
2035
|
+
function yt(e, t) {
|
|
2036
|
+
return Number(e.toFixed(_t(t)));
|
|
1740
2037
|
}
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
function ct(e, t, n) {
|
|
2038
|
+
// src/components/RangeFilterPanel.tsx
|
|
2039
|
+
function bt(e, t, n) {
|
|
1744
2040
|
let r = t + Math.round((e - t) / n) * n;
|
|
1745
|
-
return Number(r.toFixed(
|
|
2041
|
+
return Number(r.toFixed(_t(n)));
|
|
1746
2042
|
}
|
|
1747
|
-
function
|
|
2043
|
+
function xt(e, t, n) {
|
|
1748
2044
|
let r = Math.ceil(Number(((e - t) / n).toFixed(6)));
|
|
1749
|
-
return Number((t + r * n).toFixed(
|
|
2045
|
+
return Number((t + r * n).toFixed(_t(n)));
|
|
1750
2046
|
}
|
|
1751
|
-
var
|
|
1752
|
-
let { state: { rangeFilters: g, rangeBounds: _, facetStats: v, facets: y, filterableFields: b, facetableFields: x, query: S, facetDebounceDelayMillis: C }, setRangeFilter: w, resetRangeFilter: D, allowEmptySearch: O, authError: k, isFetchingInitial: A } =
|
|
2047
|
+
var St = ({ 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 }) => {
|
|
2048
|
+
let { state: { rangeFilters: g, rangeBounds: _, facetStats: v, facets: y, filterableFields: b, facetableFields: x, query: S, facetDebounceDelayMillis: C }, setRangeFilter: w, resetRangeFilter: D, allowEmptySearch: O, authError: k, isFetchingInitial: A } = _e(), j = a ?? o ?? "input", M = _?.[t] !== void 0, N = _?.[t] ?? {
|
|
1753
2049
|
min: r,
|
|
1754
2050
|
max: i
|
|
1755
|
-
}, F =
|
|
2051
|
+
}, F = N.min, I = N.max, L = v?.[t] ?? N, R = Math.max(F, Math.min(I, L.min)), z = Math.max(F, Math.min(I, L.max)), B = e.useMemo(() => {
|
|
1756
2052
|
if (m) return m;
|
|
1757
|
-
let e = Math.max(
|
|
1758
|
-
if (Array.isArray(n)) for (let t of n) e = Math.max(e,
|
|
2053
|
+
let e = Math.max(_t(F), _t(I)), n = y?.[t];
|
|
2054
|
+
if (Array.isArray(n)) for (let t of n) e = Math.max(e, _t(Number(t.key)));
|
|
1759
2055
|
return e === 0 ? 1 : Number((10 ** -e).toFixed(e));
|
|
1760
2056
|
}, [
|
|
1761
2057
|
m,
|
|
@@ -1763,20 +2059,20 @@ var ut = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
1763
2059
|
I,
|
|
1764
2060
|
y,
|
|
1765
2061
|
t
|
|
1766
|
-
]), V =
|
|
1767
|
-
let e =
|
|
1768
|
-
return { width: `calc(${Math.max(3, F.toFixed(e).length, I.toFixed(e).length,
|
|
2062
|
+
]), V = M && F === I, H = V ? r : F, U = V ? i : I, W = xt(U + B, H, B), ee = (e) => Math.min(W, Math.max(H, e)), G = g?.[t], te = s && G !== void 0 ? Q.active : void 0, K = G ? G.min : F, ne = G ? G.max : I, re = G !== void 0, ie = R !== F || z !== I, [q, J] = e.useState([K, ne]), [Y, X] = e.useState(!1), [ae, oe] = e.useState(!1), [se, ce] = e.useState(String(K)), [le, ue] = e.useState(String(ne)), de = e.useMemo(() => {
|
|
2063
|
+
let e = _t(B);
|
|
2064
|
+
return { width: `calc(${Math.max(3, F.toFixed(e).length, I.toFixed(e).length, se.length, le.length) + 1}ch + 20px)` };
|
|
1769
2065
|
}, [
|
|
1770
2066
|
B,
|
|
1771
2067
|
F,
|
|
1772
2068
|
I,
|
|
1773
|
-
|
|
1774
|
-
|
|
2069
|
+
se,
|
|
2070
|
+
le
|
|
1775
2071
|
]);
|
|
1776
2072
|
e.useEffect(() => {
|
|
1777
|
-
|
|
2073
|
+
ce(String(q[0])), ue(String(q[1]));
|
|
1778
2074
|
}, [q]);
|
|
1779
|
-
let { finalMin:
|
|
2075
|
+
let { finalMin: fe, finalMax: pe, isValidMin: me, isValidMax: he } = e.useMemo(() => {
|
|
1780
2076
|
let [e, t] = q, n = Math.max(F, Math.min(I, e)), r = Math.max(F, Math.min(I, t)), i = Math.min(n, r), a = Math.max(n, r);
|
|
1781
2077
|
return {
|
|
1782
2078
|
finalMin: i,
|
|
@@ -1792,22 +2088,22 @@ var ut = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
1792
2088
|
e.useEffect(() => {
|
|
1793
2089
|
if (V) return;
|
|
1794
2090
|
if (q[0] === F && q[1] === I) {
|
|
1795
|
-
|
|
2091
|
+
X(!1), oe(!1);
|
|
1796
2092
|
return;
|
|
1797
2093
|
}
|
|
1798
2094
|
let e = C ?? 500, n = setTimeout(() => {
|
|
1799
|
-
|
|
2095
|
+
X(!me), oe(!he);
|
|
1800
2096
|
}, 300), r = setTimeout(() => {
|
|
1801
|
-
|
|
2097
|
+
me && he && (fe === F && pe === I ? D(t, !1) : w(t, fe, pe));
|
|
1802
2098
|
}, e);
|
|
1803
2099
|
return () => {
|
|
1804
2100
|
clearTimeout(n), clearTimeout(r);
|
|
1805
2101
|
};
|
|
1806
2102
|
}, [
|
|
2103
|
+
fe,
|
|
2104
|
+
pe,
|
|
1807
2105
|
me,
|
|
1808
2106
|
he,
|
|
1809
|
-
ge,
|
|
1810
|
-
_e,
|
|
1811
2107
|
F,
|
|
1812
2108
|
I,
|
|
1813
2109
|
t,
|
|
@@ -1816,48 +2112,48 @@ var ut = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
1816
2112
|
C,
|
|
1817
2113
|
V
|
|
1818
2114
|
]), e.useEffect(() => {
|
|
1819
|
-
J([K, ne]),
|
|
2115
|
+
J([K, ne]), X(!1), oe(!1);
|
|
1820
2116
|
}, [
|
|
1821
2117
|
K,
|
|
1822
2118
|
ne,
|
|
1823
2119
|
t
|
|
1824
2120
|
]);
|
|
1825
|
-
let
|
|
1826
|
-
let t =
|
|
1827
|
-
return [t,
|
|
1828
|
-
}, [B]),
|
|
2121
|
+
let ge = e.useCallback((e) => {
|
|
2122
|
+
let t = yt(Math.min(e[0], e[1] - B), B);
|
|
2123
|
+
return [t, yt(Math.max(e[1] - B, t), B)];
|
|
2124
|
+
}, [B]), ve = e.useCallback((e) => {
|
|
1829
2125
|
if (V) return;
|
|
1830
|
-
let [t, n] =
|
|
2126
|
+
let [t, n] = ge(e);
|
|
1831
2127
|
J([Math.max(F, Math.min(z, t)), Math.max(R, Math.min(I, n))]);
|
|
1832
2128
|
}, [
|
|
1833
2129
|
V,
|
|
1834
|
-
|
|
2130
|
+
ge,
|
|
1835
2131
|
F,
|
|
1836
2132
|
I,
|
|
1837
2133
|
R,
|
|
1838
2134
|
z
|
|
1839
|
-
]),
|
|
2135
|
+
]), ye = e.useCallback((e) => {
|
|
1840
2136
|
if (V) return;
|
|
1841
|
-
let [n, r] =
|
|
2137
|
+
let [n, r] = ge(e), i = Math.max(F, Math.min(z, n)), a = Math.max(R, Math.min(I, r));
|
|
1842
2138
|
i === F && a === I ? (J([F, I]), D(t, !0)) : J([i, a]);
|
|
1843
2139
|
}, [
|
|
1844
2140
|
V,
|
|
1845
|
-
|
|
2141
|
+
ge,
|
|
1846
2142
|
F,
|
|
1847
2143
|
I,
|
|
1848
2144
|
R,
|
|
1849
2145
|
z,
|
|
1850
2146
|
t,
|
|
1851
2147
|
D
|
|
1852
|
-
]),
|
|
2148
|
+
]), be = e.useRef(null), xe = e.useCallback((e, n) => {
|
|
1853
2149
|
if (V) return;
|
|
1854
|
-
let r =
|
|
2150
|
+
let r = be.current;
|
|
1855
2151
|
if (G && r && r.start === e && r.last === n) {
|
|
1856
|
-
|
|
2152
|
+
be.current = null, J([F, I]), D(t, !0);
|
|
1857
2153
|
return;
|
|
1858
2154
|
}
|
|
1859
|
-
let i =
|
|
1860
|
-
|
|
2155
|
+
let i = bt(Math.max(F, R, e), F, B), a = Math.max(i, bt(Math.min(I, z, n), F, B));
|
|
2156
|
+
be.current = {
|
|
1861
2157
|
start: e,
|
|
1862
2158
|
last: n
|
|
1863
2159
|
}, J([i, a]);
|
|
@@ -1871,50 +2167,50 @@ var ut = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
1871
2167
|
B,
|
|
1872
2168
|
t,
|
|
1873
2169
|
D
|
|
1874
|
-
]),
|
|
2170
|
+
]), Se = e.useCallback(() => {
|
|
1875
2171
|
if (V) return;
|
|
1876
|
-
let e =
|
|
2172
|
+
let e = se.trim(), t = e === "" ? NaN : Number(e);
|
|
1877
2173
|
if (isNaN(t)) {
|
|
1878
|
-
|
|
2174
|
+
ce(String(q[0]));
|
|
1879
2175
|
return;
|
|
1880
2176
|
}
|
|
1881
2177
|
let n = Math.max(F, Math.min(z, t));
|
|
1882
|
-
n < q[1] ? J([n, q[1]]) : J([F, q[1]]),
|
|
2178
|
+
n < q[1] ? J([n, q[1]]) : J([F, q[1]]), ce(String(n < q[1] ? n : F));
|
|
1883
2179
|
}, [
|
|
1884
2180
|
V,
|
|
1885
|
-
|
|
2181
|
+
se,
|
|
1886
2182
|
q,
|
|
1887
2183
|
F,
|
|
1888
2184
|
z
|
|
1889
|
-
]),
|
|
2185
|
+
]), Ce = e.useCallback(() => {
|
|
1890
2186
|
if (V) return;
|
|
1891
|
-
let e =
|
|
2187
|
+
let e = le.trim(), t = e === "" ? NaN : Number(e);
|
|
1892
2188
|
if (isNaN(t)) {
|
|
1893
|
-
|
|
2189
|
+
ue(String(q[1]));
|
|
1894
2190
|
return;
|
|
1895
2191
|
}
|
|
1896
2192
|
let n = Math.max(R, Math.min(I, t));
|
|
1897
|
-
n > q[0] ? J([q[0], n]) : J([q[0], I]),
|
|
2193
|
+
n > q[0] ? J([q[0], n]) : J([q[0], I]), ue(String(n > q[0] ? n : I));
|
|
1898
2194
|
}, [
|
|
1899
2195
|
V,
|
|
1900
|
-
|
|
2196
|
+
le,
|
|
1901
2197
|
q,
|
|
1902
2198
|
R,
|
|
1903
2199
|
I
|
|
1904
|
-
]),
|
|
2200
|
+
]), we = (e) => (t) => {
|
|
1905
2201
|
t.key === "Enter" && e();
|
|
1906
|
-
}, [
|
|
2202
|
+
}, [Te, Ee] = e.useState(null), De = e.useRef(null);
|
|
1907
2203
|
e.useEffect(() => {
|
|
1908
2204
|
if (!u) return;
|
|
1909
2205
|
let e = `${F}:${I}`;
|
|
1910
|
-
if (e ===
|
|
2206
|
+
if (e === De.current && De.current !== null) return;
|
|
1911
2207
|
let n = y?.[t];
|
|
1912
2208
|
if (!Array.isArray(n) || n.length === 0) return;
|
|
1913
2209
|
let r = n.filter((e) => e.value != null && !isNaN(Number(e.key))).map((e) => ({
|
|
1914
2210
|
key: e.key,
|
|
1915
2211
|
value: e.value
|
|
1916
2212
|
}));
|
|
1917
|
-
r.length > 0 && (
|
|
2213
|
+
r.length > 0 && (De.current = e, Ee(r));
|
|
1918
2214
|
}, [
|
|
1919
2215
|
F,
|
|
1920
2216
|
I,
|
|
@@ -1922,22 +2218,22 @@ var ut = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
1922
2218
|
t,
|
|
1923
2219
|
u
|
|
1924
2220
|
]);
|
|
1925
|
-
let
|
|
1926
|
-
if (!u || !
|
|
2221
|
+
let Oe = e.useMemo(() => {
|
|
2222
|
+
if (!u || !Te || Te.length === 0) return [];
|
|
1927
2223
|
let e = I - F;
|
|
1928
2224
|
if (e <= 0) return [];
|
|
1929
|
-
let t = d ?? Math.max(B,
|
|
2225
|
+
let t = d ?? Math.max(B, yt(Math.ceil(e / 20 / B) * B, B)), n = Math.ceil(e / t);
|
|
1930
2226
|
return Array.from({ length: n }, (e, r) => {
|
|
1931
|
-
let i = F + r * t, a = F + (r + 1) * t, o = r === n - 1, s =
|
|
2227
|
+
let i = F + r * t, a = F + (r + 1) * t, o = r === n - 1, s = Te.filter((e) => {
|
|
1932
2228
|
let t = Number(e.key);
|
|
1933
2229
|
return t >= i && (t < a || o && t <= I);
|
|
1934
|
-
}).reduce((e, t) => e + t.value, 0), c = o ? I :
|
|
2230
|
+
}).reduce((e, t) => e + t.value, 0), c = o ? I : yt(a - B, B);
|
|
1935
2231
|
return {
|
|
1936
2232
|
bucketStart: i,
|
|
1937
2233
|
bucketEnd: a,
|
|
1938
2234
|
count: s,
|
|
1939
2235
|
last: c,
|
|
1940
|
-
barEnd:
|
|
2236
|
+
barEnd: yt(c + B, B)
|
|
1941
2237
|
};
|
|
1942
2238
|
}).map((e, t, n) => ({
|
|
1943
2239
|
...e,
|
|
@@ -1945,14 +2241,14 @@ var ut = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
1945
2241
|
}));
|
|
1946
2242
|
}, [
|
|
1947
2243
|
u,
|
|
1948
|
-
|
|
2244
|
+
Te,
|
|
1949
2245
|
F,
|
|
1950
2246
|
I,
|
|
1951
2247
|
d,
|
|
1952
2248
|
B,
|
|
1953
2249
|
W
|
|
1954
|
-
]),
|
|
1955
|
-
return u && !A && !x?.includes(t) && console.warn(`RangeFilterPanel: showHistogram=true but field "${t}" is not facetable. Add .Facetable = true to this field.`), k ? null : A ? /* @__PURE__ */ f(
|
|
2250
|
+
]), ke = e.useMemo(() => Math.max(...Oe.map((e) => e.count), 1), [Oe]);
|
|
2251
|
+
return u && !A && !x?.includes(t) && console.warn(`RangeFilterPanel: showHistogram=true but field "${t}" is not facetable. Add .Facetable = true to this field.`), k ? null : A ? /* @__PURE__ */ f(pt, {
|
|
1956
2252
|
title: n,
|
|
1957
2253
|
variant: "slider",
|
|
1958
2254
|
withHistogram: u,
|
|
@@ -1965,72 +2261,72 @@ var ut = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
1965
2261
|
className: te,
|
|
1966
2262
|
children: [
|
|
1967
2263
|
V && /* @__PURE__ */ p("div", {
|
|
1968
|
-
className:
|
|
2264
|
+
className: Q.disabledMessage,
|
|
1969
2265
|
children: [
|
|
1970
2266
|
"No adjustable range (all results have the same value: ",
|
|
1971
2267
|
F,
|
|
1972
2268
|
")."
|
|
1973
2269
|
]
|
|
1974
2270
|
}),
|
|
1975
|
-
u &&
|
|
1976
|
-
u &&
|
|
1977
|
-
let [e, t] = z > R && (R > F || z < I) ? [R, z] : [H, U], n = Math.max(
|
|
2271
|
+
u && Oe.length === 0 && /* @__PURE__ */ f("div", { className: Q.histogram }),
|
|
2272
|
+
u && Oe.length > 0 && (() => {
|
|
2273
|
+
let [e, t] = z > R && (R > F || z < I) ? [R, z] : [H, U], n = Math.max(fe, e), r = Math.min(pe, 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 = Oe.slice(1).map((e) => u((e.bucketStart - H) / a)), _ = Oe.map((e) => ({
|
|
1978
2274
|
...e,
|
|
1979
|
-
height: Math.max(1, Math.ceil(e.count /
|
|
2275
|
+
height: Math.max(1, Math.ceil(e.count / ke * 20))
|
|
1980
2276
|
}));
|
|
1981
2277
|
return /* @__PURE__ */ p("div", {
|
|
1982
|
-
className:
|
|
2278
|
+
className: Q.histogram,
|
|
1983
2279
|
children: [
|
|
1984
2280
|
/* @__PURE__ */ f("div", {
|
|
1985
|
-
className:
|
|
2281
|
+
className: Q.histogramLayer,
|
|
1986
2282
|
children: _.map((e, t) => /* @__PURE__ */ f("button", {
|
|
1987
2283
|
type: "button",
|
|
1988
|
-
className:
|
|
2284
|
+
className: Q.histogramBar,
|
|
1989
2285
|
style: { flexGrow: e.span },
|
|
1990
2286
|
"data-testid": "histogram-bar",
|
|
1991
2287
|
disabled: V || h(e),
|
|
1992
2288
|
"aria-label": `${e.bucketStart} to ${e.last}: ${e.count}`,
|
|
1993
2289
|
title: `${e.bucketStart} to ${e.last}: ${e.count}`,
|
|
1994
|
-
onClick: () =>
|
|
2290
|
+
onClick: () => xe(e.bucketStart, e.last),
|
|
1995
2291
|
children: /* @__PURE__ */ f("span", {
|
|
1996
|
-
className:
|
|
2292
|
+
className: Q.histogramFill,
|
|
1997
2293
|
style: { height: `${e.height}px` }
|
|
1998
2294
|
})
|
|
1999
2295
|
}, t))
|
|
2000
2296
|
}),
|
|
2001
2297
|
/* @__PURE__ */ f("div", {
|
|
2002
|
-
className: `${
|
|
2298
|
+
className: `${Q.histogramLayer} ${Q.histogramLive}`,
|
|
2003
2299
|
"aria-hidden": "true",
|
|
2004
2300
|
"data-testid": "histogram-live",
|
|
2005
2301
|
style: { clipPath: m },
|
|
2006
2302
|
children: _.map((e, t) => /* @__PURE__ */ f("span", {
|
|
2007
|
-
className:
|
|
2303
|
+
className: Q.histogramBar,
|
|
2008
2304
|
style: { flexGrow: e.span },
|
|
2009
2305
|
children: /* @__PURE__ */ f("span", {
|
|
2010
|
-
className:
|
|
2306
|
+
className: Q.histogramFill,
|
|
2011
2307
|
style: { height: `${e.height}px` }
|
|
2012
2308
|
})
|
|
2013
2309
|
}, t))
|
|
2014
2310
|
}),
|
|
2015
2311
|
/* @__PURE__ */ f("div", {
|
|
2016
|
-
className: `${
|
|
2312
|
+
className: `${Q.histogramLayer} ${Q.histogramLit}`,
|
|
2017
2313
|
"aria-hidden": "true",
|
|
2018
2314
|
"data-testid": "histogram-lit",
|
|
2019
2315
|
style: { clipPath: d },
|
|
2020
2316
|
children: _.map((e, t) => /* @__PURE__ */ f("span", {
|
|
2021
|
-
className:
|
|
2317
|
+
className: Q.histogramBar,
|
|
2022
2318
|
style: { flexGrow: e.span },
|
|
2023
2319
|
children: /* @__PURE__ */ f("span", {
|
|
2024
|
-
className:
|
|
2320
|
+
className: Q.histogramFill,
|
|
2025
2321
|
style: { height: `${e.height}px` }
|
|
2026
2322
|
})
|
|
2027
2323
|
}, t))
|
|
2028
2324
|
}),
|
|
2029
2325
|
/* @__PURE__ */ f("div", {
|
|
2030
|
-
className:
|
|
2326
|
+
className: Q.histogramSeparators,
|
|
2031
2327
|
"aria-hidden": "true",
|
|
2032
2328
|
children: g.map((e, t) => /* @__PURE__ */ f("span", {
|
|
2033
|
-
className:
|
|
2329
|
+
className: Q.histogramSeparator,
|
|
2034
2330
|
style: { left: e }
|
|
2035
2331
|
}, t))
|
|
2036
2332
|
})
|
|
@@ -2039,18 +2335,18 @@ var ut = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
2039
2335
|
})(),
|
|
2040
2336
|
/* @__PURE__ */ f("div", {
|
|
2041
2337
|
style: { padding: "10px 10px 20px 10px" },
|
|
2042
|
-
children: /* @__PURE__ */ f(
|
|
2338
|
+
children: /* @__PURE__ */ f(P, {
|
|
2043
2339
|
min: H,
|
|
2044
2340
|
max: W,
|
|
2045
2341
|
step: B,
|
|
2046
2342
|
stepMarks: h,
|
|
2047
|
-
value: V ? [H, W] : [ee(
|
|
2343
|
+
value: V ? [H, W] : [ee(bt(fe, H, B)), ee(bt(pe + B, H, B))],
|
|
2048
2344
|
isRange: !0,
|
|
2049
|
-
onChange: (e) =>
|
|
2050
|
-
onFinalChange: (e) =>
|
|
2345
|
+
onChange: (e) => ve(e),
|
|
2346
|
+
onFinalChange: (e) => ye(e),
|
|
2051
2347
|
disabled: V,
|
|
2052
2348
|
activeMin: R,
|
|
2053
|
-
activeMax: ee(
|
|
2349
|
+
activeMax: ee(yt(z + B, B)),
|
|
2054
2350
|
isFaceted: ie,
|
|
2055
2351
|
highlightFaceted: re,
|
|
2056
2352
|
"aria-label": n || `Filter by ${t}`
|
|
@@ -2066,27 +2362,27 @@ var ut = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
2066
2362
|
children: [/* @__PURE__ */ f(E, {
|
|
2067
2363
|
label: "Min:",
|
|
2068
2364
|
type: "number",
|
|
2069
|
-
style:
|
|
2070
|
-
value: V ? String(F) :
|
|
2365
|
+
style: de,
|
|
2366
|
+
value: V ? String(F) : se,
|
|
2071
2367
|
min: F,
|
|
2072
|
-
max:
|
|
2073
|
-
onChange: (e) =>
|
|
2074
|
-
onBlur:
|
|
2075
|
-
onKeyDown:
|
|
2368
|
+
max: yt(Math.min(z, q[1] - B), B),
|
|
2369
|
+
onChange: (e) => ce(e.target.value),
|
|
2370
|
+
onBlur: Se,
|
|
2371
|
+
onKeyDown: we(Se),
|
|
2076
2372
|
disabled: V,
|
|
2077
|
-
isValid: V || !
|
|
2373
|
+
isValid: V || !Y
|
|
2078
2374
|
}), /* @__PURE__ */ f(E, {
|
|
2079
2375
|
label: "Max:",
|
|
2080
2376
|
type: "number",
|
|
2081
|
-
style:
|
|
2082
|
-
value: V ? String(I) :
|
|
2083
|
-
min:
|
|
2377
|
+
style: de,
|
|
2378
|
+
value: V ? String(I) : le,
|
|
2379
|
+
min: yt(Math.max(R, q[0] + B), B),
|
|
2084
2380
|
max: I,
|
|
2085
|
-
onChange: (e) =>
|
|
2086
|
-
onBlur:
|
|
2087
|
-
onKeyDown:
|
|
2381
|
+
onChange: (e) => ue(e.target.value),
|
|
2382
|
+
onBlur: Ce,
|
|
2383
|
+
onKeyDown: we(Ce),
|
|
2088
2384
|
disabled: V,
|
|
2089
|
-
isValid: V || !
|
|
2385
|
+
isValid: V || !ae
|
|
2090
2386
|
})]
|
|
2091
2387
|
})
|
|
2092
2388
|
]
|
|
@@ -2094,7 +2390,7 @@ var ut = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
2094
2390
|
title: n,
|
|
2095
2391
|
className: te,
|
|
2096
2392
|
children: [V && /* @__PURE__ */ p("div", {
|
|
2097
|
-
className:
|
|
2393
|
+
className: Q.disabledMessage,
|
|
2098
2394
|
children: [
|
|
2099
2395
|
"No adjustable range (all results have the same value: ",
|
|
2100
2396
|
F,
|
|
@@ -2109,35 +2405,35 @@ var ut = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
2109
2405
|
children: [/* @__PURE__ */ f(E, {
|
|
2110
2406
|
label: "Min:",
|
|
2111
2407
|
type: "number",
|
|
2112
|
-
style:
|
|
2113
|
-
value: V ? String(F) :
|
|
2408
|
+
style: de,
|
|
2409
|
+
value: V ? String(F) : se,
|
|
2114
2410
|
min: F,
|
|
2115
|
-
max:
|
|
2116
|
-
onChange: (e) =>
|
|
2117
|
-
onBlur:
|
|
2118
|
-
onKeyDown:
|
|
2411
|
+
max: yt(Math.min(z, q[1] - B), B),
|
|
2412
|
+
onChange: (e) => ce(e.target.value),
|
|
2413
|
+
onBlur: Se,
|
|
2414
|
+
onKeyDown: we(Se),
|
|
2119
2415
|
disabled: V,
|
|
2120
|
-
isValid: V || !
|
|
2416
|
+
isValid: V || !Y
|
|
2121
2417
|
}), /* @__PURE__ */ f(E, {
|
|
2122
2418
|
label: "Max:",
|
|
2123
2419
|
type: "number",
|
|
2124
|
-
style:
|
|
2125
|
-
value: V ? String(I) :
|
|
2126
|
-
min:
|
|
2420
|
+
style: de,
|
|
2421
|
+
value: V ? String(I) : le,
|
|
2422
|
+
min: yt(Math.max(R, q[0] + B), B),
|
|
2127
2423
|
max: I,
|
|
2128
|
-
onChange: (e) =>
|
|
2129
|
-
onBlur:
|
|
2130
|
-
onKeyDown:
|
|
2424
|
+
onChange: (e) => ue(e.target.value),
|
|
2425
|
+
onBlur: Ce,
|
|
2426
|
+
onKeyDown: we(Ce),
|
|
2131
2427
|
disabled: V,
|
|
2132
|
-
isValid: V || !
|
|
2428
|
+
isValid: V || !ae
|
|
2133
2429
|
})]
|
|
2134
2430
|
})]
|
|
2135
|
-
}) : /* @__PURE__ */ f(
|
|
2431
|
+
}) : /* @__PURE__ */ f(ht, {
|
|
2136
2432
|
label: n,
|
|
2137
2433
|
field: t,
|
|
2138
2434
|
missing: ["filterable"]
|
|
2139
2435
|
});
|
|
2140
|
-
},
|
|
2436
|
+
}, Ct = {
|
|
2141
2437
|
list: "_list_9je85_2",
|
|
2142
2438
|
grid: "_grid_9je85_9",
|
|
2143
2439
|
count: "_count_9je85_22",
|
|
@@ -2145,29 +2441,28 @@ var ut = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
2145
2441
|
chip: "_chip_9je85_35",
|
|
2146
2442
|
active: "_active_9je85_41"
|
|
2147
2443
|
};
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
function ft(e, t) {
|
|
2444
|
+
// src/components/BucketFilterPanel.tsx
|
|
2445
|
+
function wt(e, t) {
|
|
2151
2446
|
if (!t) return null;
|
|
2152
2447
|
let n = 0, r = !1;
|
|
2153
2448
|
for (let i of t) {
|
|
2154
2449
|
let t = Number(i.key);
|
|
2155
|
-
if (!
|
|
2450
|
+
if (!Number.isNaN(t) && e.contains(t)) {
|
|
2156
2451
|
if (typeof i.value != "number") return null;
|
|
2157
2452
|
n += i.value, r = !0;
|
|
2158
2453
|
}
|
|
2159
2454
|
}
|
|
2160
2455
|
return r ? n : 0;
|
|
2161
2456
|
}
|
|
2162
|
-
var
|
|
2163
|
-
let { state: { facets: v, filterableFields: x, facetableFields: S, bucketFilters: C, rangeBounds: w, facetStats: E, query: D }, toggleBucketFilter:
|
|
2457
|
+
var Tt = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a, layout: c = "list", showCount: u = !0, showEmpty: d = !1, limit: m, showActivePanel: h = !1, collapsible: g = !0, startCollapsed: _ = !1 }) => {
|
|
2458
|
+
let { state: { facets: v, filterableFields: x, facetableFields: S, bucketFilters: C, rangeBounds: w, facetStats: E, query: D }, toggleBucketFilter: O, authError: A, isFetchingInitial: j, allowEmptySearch: M } = _e(), N = i ?? a ?? "checkbox", P = v?.[e], F = C[e] ?? [], [I, L] = l(m ?? Infinity);
|
|
2164
2459
|
o(() => {
|
|
2165
2460
|
L(m ?? Infinity);
|
|
2166
2461
|
}, [m, P]);
|
|
2167
2462
|
let R = w?.[e] ?? E?.[e], z = s(() => {
|
|
2168
2463
|
let e = [];
|
|
2169
2464
|
if (R && e.push(R.min, R.max), Array.isArray(P)) for (let t of P) e.push(Number(t.key));
|
|
2170
|
-
return
|
|
2465
|
+
return vt(e.filter(Number.isFinite));
|
|
2171
2466
|
}, [R, P]), B = s(() => {
|
|
2172
2467
|
let e = R?.min ?? -Number.MAX_VALUE, t = R?.max ?? Number.MAX_VALUE, i = (n, r, i) => ({
|
|
2173
2468
|
label: i ?? (n === void 0 ? `up to ${r}` : r === void 0 ? `${n} and up` : `${n}-${r}`),
|
|
@@ -2180,12 +2475,12 @@ var pt = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2180
2475
|
if (r && r.length > 0) return r.map((e) => i(e.min, e.max, e.label));
|
|
2181
2476
|
if (Array.isArray(n)) {
|
|
2182
2477
|
let e = [...n].sort((e, t) => e - t), t = [];
|
|
2183
|
-
for (let n = 0; n < e.length - 1; n++) t.push(i(e[n],
|
|
2478
|
+
for (let n = 0; n < e.length - 1; n++) t.push(i(e[n], yt(e[n + 1] - z, z)));
|
|
2184
2479
|
return t;
|
|
2185
2480
|
}
|
|
2186
2481
|
if (typeof n == "number" && n > 0 && R) {
|
|
2187
2482
|
let e = [], t = Math.floor(R.min / n) * n;
|
|
2188
|
-
for (let r = t; r <= R.max; r =
|
|
2483
|
+
for (let r = t; r <= R.max; r = yt(r + n, z)) e.push(i(yt(r, z), yt(r + n - z, z)));
|
|
2189
2484
|
return e;
|
|
2190
2485
|
}
|
|
2191
2486
|
return [];
|
|
@@ -2196,27 +2491,27 @@ var pt = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2196
2491
|
z
|
|
2197
2492
|
]);
|
|
2198
2493
|
if (A) return null;
|
|
2199
|
-
if (j || !v) return /* @__PURE__ */ f(
|
|
2494
|
+
if (j || !v) return /* @__PURE__ */ f(pt, {
|
|
2200
2495
|
title: t,
|
|
2201
2496
|
rows: Math.max(1, Math.min(B.length || 5, 8)),
|
|
2202
2497
|
collapsible: g,
|
|
2203
2498
|
startCollapsed: _
|
|
2204
2499
|
});
|
|
2205
2500
|
if (!M && !D) return null;
|
|
2206
|
-
if (!x?.includes(e)) return /* @__PURE__ */ f(
|
|
2501
|
+
if (!x?.includes(e)) return /* @__PURE__ */ f(ht, {
|
|
2207
2502
|
label: t,
|
|
2208
2503
|
field: e,
|
|
2209
2504
|
missing: ["filterable"]
|
|
2210
2505
|
});
|
|
2211
2506
|
let V = S?.includes(e) && Array.isArray(P), H = (e) => F.some((t) => t.min === e.range.min && t.max === e.range.max), U = B.map((e) => ({
|
|
2212
2507
|
bucket: e,
|
|
2213
|
-
count: V ?
|
|
2508
|
+
count: V ? wt(e, P) : null
|
|
2214
2509
|
}));
|
|
2215
2510
|
if (d || (U = U.filter((e) => e.count !== 0 || H(e.bucket))), U.length === 0) return null;
|
|
2216
2511
|
let W = U.slice(0, I), ee = (t, n) => {
|
|
2217
|
-
let r = H(t), i = n === 0 && !r, a = u && (n ?? 0) > 0 ? `${n}` : "", o = () =>
|
|
2512
|
+
let r = H(t), i = n === 0 && !r, a = u && (n ?? 0) > 0 ? `${n}` : "", o = () => O(e, t.range, N === "radio");
|
|
2218
2513
|
if (N === "radio") {
|
|
2219
|
-
let n = /* @__PURE__ */ f(
|
|
2514
|
+
let n = /* @__PURE__ */ f(k, {
|
|
2220
2515
|
id: `${e}-${t.range.min}-${t.range.max}`,
|
|
2221
2516
|
name: e,
|
|
2222
2517
|
value: t.label,
|
|
@@ -2226,9 +2521,9 @@ var pt = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2226
2521
|
disabled: i
|
|
2227
2522
|
});
|
|
2228
2523
|
return c === "list" ? /* @__PURE__ */ p("div", {
|
|
2229
|
-
className:
|
|
2524
|
+
className: Ct.count,
|
|
2230
2525
|
children: [n, /* @__PURE__ */ f("span", {
|
|
2231
|
-
className:
|
|
2526
|
+
className: Ct.countValue,
|
|
2232
2527
|
children: a
|
|
2233
2528
|
})]
|
|
2234
2529
|
}) : n;
|
|
@@ -2239,19 +2534,19 @@ var pt = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2239
2534
|
onClick: o,
|
|
2240
2535
|
disabled: i,
|
|
2241
2536
|
size: "micro",
|
|
2242
|
-
className:
|
|
2537
|
+
className: Ct.chip,
|
|
2243
2538
|
children: c === "grid" && a ? `${t.label} (${a})` : t.label
|
|
2244
2539
|
});
|
|
2245
2540
|
return c === "list" ? /* @__PURE__ */ p("div", {
|
|
2246
|
-
className:
|
|
2541
|
+
className: Ct.count,
|
|
2247
2542
|
children: [e, /* @__PURE__ */ f("span", {
|
|
2248
|
-
className:
|
|
2543
|
+
className: Ct.countValue,
|
|
2249
2544
|
children: a
|
|
2250
2545
|
})]
|
|
2251
2546
|
}) : e;
|
|
2252
2547
|
}
|
|
2253
2548
|
return c === "list" ? /* @__PURE__ */ p("div", {
|
|
2254
|
-
className:
|
|
2549
|
+
className: Ct.count,
|
|
2255
2550
|
children: [/* @__PURE__ */ f(b, {
|
|
2256
2551
|
label: t.label,
|
|
2257
2552
|
score: "",
|
|
@@ -2259,7 +2554,7 @@ var pt = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2259
2554
|
onChange: o,
|
|
2260
2555
|
disabled: i
|
|
2261
2556
|
}), /* @__PURE__ */ f("span", {
|
|
2262
|
-
className:
|
|
2557
|
+
className: Ct.countValue,
|
|
2263
2558
|
children: a
|
|
2264
2559
|
})]
|
|
2265
2560
|
}) : /* @__PURE__ */ f(b, {
|
|
@@ -2274,9 +2569,9 @@ var pt = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2274
2569
|
title: t,
|
|
2275
2570
|
collapsible: g,
|
|
2276
2571
|
collapsed: g ? _ : !1,
|
|
2277
|
-
className: h && F.length > 0 ?
|
|
2572
|
+
className: h && F.length > 0 ? Ct.active : void 0,
|
|
2278
2573
|
children: /* @__PURE__ */ p("ul", {
|
|
2279
|
-
className: c === "grid" ?
|
|
2574
|
+
className: c === "grid" ? Ct.grid : Ct.list,
|
|
2280
2575
|
style: {
|
|
2281
2576
|
listStyle: "none",
|
|
2282
2577
|
padding: 0,
|
|
@@ -2290,113 +2585,12 @@ var pt = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2290
2585
|
}) })]
|
|
2291
2586
|
})
|
|
2292
2587
|
});
|
|
2293
|
-
},
|
|
2294
|
-
grid: "_grid_1xjna_2",
|
|
2295
|
-
chip: "_chip_1xjna_21",
|
|
2296
|
-
chipLabel: "_chipLabel_1xjna_32"
|
|
2297
|
-
}, ht = r(({ field: e, value: t, onReset: n }) => /* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(y, {
|
|
2298
|
-
onClick: n,
|
|
2299
|
-
iconRight: /* @__PURE__ */ f(ie, {}),
|
|
2300
|
-
variant: "primary",
|
|
2301
|
-
size: "micro",
|
|
2302
|
-
className: mt.chip,
|
|
2303
|
-
title: `${e}: ${t}`,
|
|
2304
|
-
children: /* @__PURE__ */ p("span", {
|
|
2305
|
-
className: mt.chipLabel,
|
|
2306
|
-
children: [
|
|
2307
|
-
e,
|
|
2308
|
-
": ",
|
|
2309
|
-
t
|
|
2310
|
-
]
|
|
2311
|
-
})
|
|
2312
|
-
}) })), gt = r(({ field: e, min: t, max: n, onReset: r }) => /* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(y, {
|
|
2313
|
-
onClick: r,
|
|
2314
|
-
iconRight: /* @__PURE__ */ f(ie, {}),
|
|
2315
|
-
variant: "primary",
|
|
2316
|
-
size: "micro",
|
|
2317
|
-
className: mt.chip,
|
|
2318
|
-
title: `${e}: ${t} β ${n}`,
|
|
2319
|
-
children: /* @__PURE__ */ p("span", {
|
|
2320
|
-
className: mt.chipLabel,
|
|
2321
|
-
children: [
|
|
2322
|
-
e,
|
|
2323
|
-
": ",
|
|
2324
|
-
t,
|
|
2325
|
-
" β ",
|
|
2326
|
-
n
|
|
2327
|
-
]
|
|
2328
|
-
})
|
|
2329
|
-
}) })), _t = r(({ field: e, label: t, onReset: n }) => /* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(y, {
|
|
2330
|
-
onClick: n,
|
|
2331
|
-
iconRight: /* @__PURE__ */ f(ie, {}),
|
|
2332
|
-
variant: "primary",
|
|
2333
|
-
size: "micro",
|
|
2334
|
-
className: mt.chip,
|
|
2335
|
-
title: `${e}: ${t}`,
|
|
2336
|
-
children: /* @__PURE__ */ p("span", {
|
|
2337
|
-
className: mt.chipLabel,
|
|
2338
|
-
children: [
|
|
2339
|
-
e,
|
|
2340
|
-
": ",
|
|
2341
|
-
t
|
|
2342
|
-
]
|
|
2343
|
-
})
|
|
2344
|
-
}) }));
|
|
2345
|
-
function vt() {
|
|
2346
|
-
let { state: { filters: e, rangeFilters: t, bucketFilters: n }, resetFilters: r, resetSingleFilter: i, resetRangeFilter: a, resetBucketFilter: o } = Y(), c = s(() => Object.entries(e).map(([e, t]) => t.map((t) => ({
|
|
2347
|
-
field: e,
|
|
2348
|
-
value: t
|
|
2349
|
-
}))).flat(), [e]), l = s(() => Object.entries(t).map(([e, { min: t, max: n }]) => ({
|
|
2350
|
-
field: e,
|
|
2351
|
-
min: t,
|
|
2352
|
-
max: n
|
|
2353
|
-
})), [t]), u = s(() => Object.entries(n).flatMap(([e, t]) => t.map((t) => ({
|
|
2354
|
-
field: e,
|
|
2355
|
-
range: t,
|
|
2356
|
-
label: `${t.min}-${t.max}`
|
|
2357
|
-
}))), [n]);
|
|
2358
|
-
return s(() => Object.keys(e).length > 0 || Object.keys(t).length > 0 || u.length > 0, [
|
|
2359
|
-
e,
|
|
2360
|
-
t,
|
|
2361
|
-
u
|
|
2362
|
-
]) ? /* @__PURE__ */ f(T, {
|
|
2363
|
-
collapsible: !1,
|
|
2364
|
-
title: "Active filters",
|
|
2365
|
-
children: /* @__PURE__ */ p("ul", {
|
|
2366
|
-
className: mt.grid,
|
|
2367
|
-
children: [
|
|
2368
|
-
c.map(({ field: e, value: t }) => /* @__PURE__ */ f(ht, {
|
|
2369
|
-
field: e,
|
|
2370
|
-
value: t,
|
|
2371
|
-
onReset: () => i(e, t)
|
|
2372
|
-
}, `${e}-${t}`)),
|
|
2373
|
-
l.map(({ field: e, min: t, max: n }) => /* @__PURE__ */ f(gt, {
|
|
2374
|
-
field: e,
|
|
2375
|
-
min: t,
|
|
2376
|
-
max: n,
|
|
2377
|
-
onReset: () => a(e)
|
|
2378
|
-
}, e)),
|
|
2379
|
-
u.map(({ field: e, range: t, label: n }) => /* @__PURE__ */ f(_t, {
|
|
2380
|
-
field: e,
|
|
2381
|
-
label: n,
|
|
2382
|
-
onReset: () => o(e, t)
|
|
2383
|
-
}, `${e}-${t.min}-${t.max}`)),
|
|
2384
|
-
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(y, {
|
|
2385
|
-
onClick: r,
|
|
2386
|
-
size: "micro",
|
|
2387
|
-
variant: "ghost",
|
|
2388
|
-
children: "Reset"
|
|
2389
|
-
}) })
|
|
2390
|
-
]
|
|
2391
|
-
})
|
|
2392
|
-
}) : null;
|
|
2393
|
-
}
|
|
2394
|
-
var yt = {
|
|
2588
|
+
}, Et = {
|
|
2395
2589
|
select: "_select_nwf7i_1",
|
|
2396
2590
|
radioGroup: "_radioGroup_nwf7i_6"
|
|
2397
|
-
},
|
|
2398
|
-
let o = n ?? (r === "radio" ? "radio" : "select"), { state: { sortableFields: s, sortBy: c, sortAscending: l }, setSort: u, isFetchingInitial: d } =
|
|
2399
|
-
if (d) return /* @__PURE__ */ f(
|
|
2591
|
+
}, Dt = ({ options: e, noneLabel: t = "None", control: n, displayType: r, collapsible: i = !0, startCollapsed: a = !1 }) => {
|
|
2592
|
+
let o = n ?? (r === "radio" ? "radio" : "select"), { state: { sortableFields: s, sortBy: c, sortAscending: l }, setSort: u, isFetchingInitial: d } = _e();
|
|
2593
|
+
if (d) return /* @__PURE__ */ f(pt, {
|
|
2400
2594
|
title: "Sort by",
|
|
2401
2595
|
rows: o === "radio" ? 3 : 1,
|
|
2402
2596
|
collapsible: i,
|
|
@@ -2426,15 +2620,15 @@ var yt = {
|
|
|
2426
2620
|
title: "Sort by",
|
|
2427
2621
|
collapsible: i,
|
|
2428
2622
|
collapsed: i ? a : !1,
|
|
2429
|
-
children: o === "select" ? /* @__PURE__ */ f(
|
|
2623
|
+
children: o === "select" ? /* @__PURE__ */ f(j, {
|
|
2430
2624
|
value: p,
|
|
2431
2625
|
onValueChange: g,
|
|
2432
2626
|
options: h,
|
|
2433
2627
|
placeholder: "Select sort...",
|
|
2434
2628
|
"aria-label": "Sort by"
|
|
2435
2629
|
}) : /* @__PURE__ */ f("div", {
|
|
2436
|
-
className:
|
|
2437
|
-
children: h.map((e) => /* @__PURE__ */ f(
|
|
2630
|
+
className: Et.radioGroup,
|
|
2631
|
+
children: h.map((e) => /* @__PURE__ */ f(k, {
|
|
2438
2632
|
id: `sort-${e.value}`,
|
|
2439
2633
|
name: "sort-by",
|
|
2440
2634
|
value: e.value,
|
|
@@ -2444,7 +2638,7 @@ var yt = {
|
|
|
2444
2638
|
}, e.value))
|
|
2445
2639
|
})
|
|
2446
2640
|
});
|
|
2447
|
-
},
|
|
2641
|
+
}, Ot = { list: "_list_1y4fk_1" }, kt = {
|
|
2448
2642
|
coverageDepth: 500,
|
|
2449
2643
|
coverWholeQuery: !0,
|
|
2450
2644
|
coverWholeWords: !0,
|
|
@@ -2459,8 +2653,8 @@ var yt = {
|
|
|
2459
2653
|
truncateWordHitTolerance: 0,
|
|
2460
2654
|
truncationScore: 65024
|
|
2461
2655
|
};
|
|
2462
|
-
function
|
|
2463
|
-
let { state: { searchSettings: e }, setSearchSettings: t, url: n, team: r, dataset: i, authenticatedFetch: a } =
|
|
2656
|
+
function At() {
|
|
2657
|
+
let { state: { searchSettings: e }, setSearchSettings: t, url: n, team: r, dataset: i, authenticatedFetch: a } = _e(), [s, c] = l(!1), [u, m] = l(null);
|
|
2464
2658
|
o(() => {
|
|
2465
2659
|
let e = !0;
|
|
2466
2660
|
try {
|
|
@@ -2477,7 +2671,7 @@ function Ct() {
|
|
|
2477
2671
|
i,
|
|
2478
2672
|
a
|
|
2479
2673
|
]);
|
|
2480
|
-
let h = e.coverageSetup, g = (e) => h[e] !== void 0 && h[e] !== null, _ = (e) => h[e] ?? u?.coverageSetup?.[e] ??
|
|
2674
|
+
let h = e.coverageSetup, g = (e) => h[e] !== void 0 && h[e] !== null, _ = (e) => h[e] ?? u?.coverageSetup?.[e] ?? kt[e], v = e.coverageDepth ?? u?.coverageDepth ?? kt.coverageDepth, b = u ? "dataset" : "default", x = (e, t) => t ? e : `${e} (${b})`, S = e.coverageDepth !== void 0 || Object.keys(h).some((e) => g(e)), C = (e, n) => {
|
|
2481
2675
|
let r = parseInt(n, 10);
|
|
2482
2676
|
isNaN(r) || t({ [e]: r });
|
|
2483
2677
|
}, w = (e, n) => {
|
|
@@ -2498,7 +2692,7 @@ function Ct() {
|
|
|
2498
2692
|
collapsed: !0,
|
|
2499
2693
|
title: "Settings",
|
|
2500
2694
|
children: /* @__PURE__ */ p("ul", {
|
|
2501
|
-
className:
|
|
2695
|
+
className: Ot.list,
|
|
2502
2696
|
children: [
|
|
2503
2697
|
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(E, {
|
|
2504
2698
|
label: "Max Results",
|
|
@@ -2524,7 +2718,7 @@ function Ct() {
|
|
|
2524
2718
|
}
|
|
2525
2719
|
}), /* @__PURE__ */ f("div", {
|
|
2526
2720
|
style: { padding: "10px 10px 20px 10px" },
|
|
2527
|
-
children: /* @__PURE__ */ f(
|
|
2721
|
+
children: /* @__PURE__ */ f(P, {
|
|
2528
2722
|
min: 0,
|
|
2529
2723
|
max: 65535,
|
|
2530
2724
|
step: 1,
|
|
@@ -2543,17 +2737,17 @@ function Ct() {
|
|
|
2543
2737
|
t({ placeholderText: e.target.value });
|
|
2544
2738
|
}
|
|
2545
2739
|
}) }),
|
|
2546
|
-
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(
|
|
2740
|
+
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(I, {
|
|
2547
2741
|
label: "Show score",
|
|
2548
2742
|
checked: e.showScore,
|
|
2549
2743
|
onChange: (e) => w("showScore", e)
|
|
2550
2744
|
}) }),
|
|
2551
|
-
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(
|
|
2745
|
+
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(I, {
|
|
2552
2746
|
label: "Enable Coverage",
|
|
2553
2747
|
checked: e.enableCoverage,
|
|
2554
2748
|
onChange: (e) => w("enableCoverage", e)
|
|
2555
2749
|
}) }),
|
|
2556
|
-
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(
|
|
2750
|
+
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(I, {
|
|
2557
2751
|
label: "Remove Duplicates",
|
|
2558
2752
|
checked: e.removeDuplicates,
|
|
2559
2753
|
onChange: (e) => w("removeDuplicates", e)
|
|
@@ -2561,42 +2755,42 @@ function Ct() {
|
|
|
2561
2755
|
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(y, {
|
|
2562
2756
|
variant: "ghost",
|
|
2563
2757
|
size: "micro",
|
|
2564
|
-
iconRight: f(s ?
|
|
2758
|
+
iconRight: f(s ? B : V, {}),
|
|
2565
2759
|
onClick: () => c((e) => !e),
|
|
2566
2760
|
children: s ? "Hide Coverage Setup" : "Show Coverage Setup"
|
|
2567
2761
|
}) }),
|
|
2568
2762
|
s && /* @__PURE__ */ p(d, { children: [
|
|
2569
|
-
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(
|
|
2763
|
+
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(I, {
|
|
2570
2764
|
label: x("Cover Whole Query", g("coverWholeQuery")),
|
|
2571
2765
|
checked: _("coverWholeQuery"),
|
|
2572
2766
|
onChange: (e) => O("coverWholeQuery", e)
|
|
2573
2767
|
}) }),
|
|
2574
|
-
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(
|
|
2768
|
+
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(I, {
|
|
2575
2769
|
label: x("Cover Whole Words", g("coverWholeWords")),
|
|
2576
2770
|
checked: _("coverWholeWords"),
|
|
2577
2771
|
onChange: (e) => O("coverWholeWords", e)
|
|
2578
2772
|
}) }),
|
|
2579
|
-
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(
|
|
2773
|
+
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(I, {
|
|
2580
2774
|
label: x("Cover Fuzzy Words", g("coverFuzzyWords")),
|
|
2581
2775
|
checked: _("coverFuzzyWords"),
|
|
2582
2776
|
onChange: (e) => O("coverFuzzyWords", e)
|
|
2583
2777
|
}) }),
|
|
2584
|
-
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(
|
|
2778
|
+
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(I, {
|
|
2585
2779
|
label: x("Cover Joined Words", g("coverJoinedWords")),
|
|
2586
2780
|
checked: _("coverJoinedWords"),
|
|
2587
2781
|
onChange: (e) => O("coverJoinedWords", e)
|
|
2588
2782
|
}) }),
|
|
2589
|
-
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(
|
|
2783
|
+
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(I, {
|
|
2590
2784
|
label: x("Cover Prefix Suffix", g("coverPrefixSuffix")),
|
|
2591
2785
|
checked: _("coverPrefixSuffix"),
|
|
2592
2786
|
onChange: (e) => O("coverPrefixSuffix", e)
|
|
2593
2787
|
}) }),
|
|
2594
|
-
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(
|
|
2788
|
+
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(I, {
|
|
2595
2789
|
label: x("Truncate", g("truncate")),
|
|
2596
2790
|
checked: _("truncate"),
|
|
2597
2791
|
onChange: (e) => O("truncate", e)
|
|
2598
2792
|
}) }),
|
|
2599
|
-
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(
|
|
2793
|
+
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(I, {
|
|
2600
2794
|
label: x("Include Pattern Matches", g("includePatternMatches")),
|
|
2601
2795
|
checked: _("includePatternMatches"),
|
|
2602
2796
|
onChange: (e) => O("includePatternMatches", e)
|
|
@@ -2639,9 +2833,8 @@ function Ct() {
|
|
|
2639
2833
|
})
|
|
2640
2834
|
});
|
|
2641
2835
|
}
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
var wt = class extends t {
|
|
2836
|
+
// src/components/SearchErrorBoundary.tsx
|
|
2837
|
+
var jt = class extends t {
|
|
2645
2838
|
constructor(e) {
|
|
2646
2839
|
super(e), this.state = {
|
|
2647
2840
|
hasError: !1,
|
|
@@ -2721,10 +2914,9 @@ var wt = class extends t {
|
|
|
2721
2914
|
}) : this.props.children;
|
|
2722
2915
|
}
|
|
2723
2916
|
};
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
let { url: n, team: r, dataset: a, authenticatedFetch: o } = Y(), [s, c] = l(null), [u, d] = l(!1), [f, p] = l(void 0);
|
|
2917
|
+
// src/hooks/useVectorSearch.ts
|
|
2918
|
+
function Mt(e, t) {
|
|
2919
|
+
let { url: n, team: r, dataset: a, authenticatedFetch: o } = _e(), [s, c] = l(null), [u, d] = l(!1), [f, p] = l(void 0);
|
|
2728
2920
|
return {
|
|
2729
2921
|
results: s,
|
|
2730
2922
|
isLoading: u,
|
|
@@ -2743,7 +2935,7 @@ function Tt(e, t) {
|
|
|
2743
2935
|
headers: { "Content-Type": "application/json" },
|
|
2744
2936
|
body: JSON.stringify(l)
|
|
2745
2937
|
});
|
|
2746
|
-
if (!u.ok) throw await
|
|
2938
|
+
if (!u.ok) throw await Y.fromResponse("VectorSearch", u);
|
|
2747
2939
|
let d = await u.json();
|
|
2748
2940
|
if (d.length === 0) {
|
|
2749
2941
|
c([]);
|
|
@@ -2754,8 +2946,9 @@ function Tt(e, t) {
|
|
|
2754
2946
|
headers: { "Content-Type": "application/json" },
|
|
2755
2947
|
body: JSON.stringify(f)
|
|
2756
2948
|
});
|
|
2757
|
-
if (!p.ok) throw await
|
|
2758
|
-
|
|
2949
|
+
if (!p.ok) throw await Y.fromResponse("GetJson", p);
|
|
2950
|
+
let m = await p.json();
|
|
2951
|
+
c(m.map((e, t) => ({
|
|
2759
2952
|
document: e,
|
|
2760
2953
|
documentKey: f[t],
|
|
2761
2954
|
score: d[t].score
|
|
@@ -2777,10 +2970,9 @@ function Tt(e, t) {
|
|
|
2777
2970
|
])
|
|
2778
2971
|
};
|
|
2779
2972
|
}
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
let { url: n, team: r, dataset: a, authenticatedFetch: o } = Y(), [s, c] = l(null), [u, d] = l(!1), [f, p] = l(void 0);
|
|
2973
|
+
// src/hooks/useHybridSearch.ts
|
|
2974
|
+
function Nt(e, t) {
|
|
2975
|
+
let { url: n, team: r, dataset: a, authenticatedFetch: o } = _e(), [s, c] = l(null), [u, d] = l(!1), [f, p] = l(void 0);
|
|
2784
2976
|
return {
|
|
2785
2977
|
results: s,
|
|
2786
2978
|
isLoading: u,
|
|
@@ -2801,7 +2993,7 @@ function Et(e, t) {
|
|
|
2801
2993
|
headers: { "Content-Type": "application/json" },
|
|
2802
2994
|
body: JSON.stringify(l)
|
|
2803
2995
|
});
|
|
2804
|
-
if (!u.ok) throw await
|
|
2996
|
+
if (!u.ok) throw await Y.fromResponse("HybridSearch", u);
|
|
2805
2997
|
let d = await u.json();
|
|
2806
2998
|
if (d.length === 0) {
|
|
2807
2999
|
c([]);
|
|
@@ -2812,8 +3004,9 @@ function Et(e, t) {
|
|
|
2812
3004
|
headers: { "Content-Type": "application/json" },
|
|
2813
3005
|
body: JSON.stringify(f)
|
|
2814
3006
|
});
|
|
2815
|
-
if (!p.ok) throw await
|
|
2816
|
-
|
|
3007
|
+
if (!p.ok) throw await Y.fromResponse("GetJson", p);
|
|
3008
|
+
let m = await p.json();
|
|
3009
|
+
c(m.map((e, t) => ({
|
|
2817
3010
|
document: e,
|
|
2818
3011
|
documentKey: f[t],
|
|
2819
3012
|
score: d[t].score
|
|
@@ -2837,16 +3030,15 @@ function Et(e, t) {
|
|
|
2837
3030
|
])
|
|
2838
3031
|
};
|
|
2839
3032
|
}
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
function Dt(e) {
|
|
3033
|
+
// src/hooks/useFilterSuggestion.ts
|
|
3034
|
+
function Pt(e) {
|
|
2843
3035
|
let t = e.trim().toLowerCase();
|
|
2844
3036
|
return t === "true" || t === "false" || t !== "" && !Number.isNaN(Number(t));
|
|
2845
3037
|
}
|
|
2846
|
-
function
|
|
3038
|
+
function Ft(e, t) {
|
|
2847
3039
|
if (!t) return null;
|
|
2848
3040
|
let n = [];
|
|
2849
|
-
for (let [e, r] of Object.entries(t)) for (let t of r ?? []) t?.key && t.key.trim().length >= 2 && !
|
|
3041
|
+
for (let [e, r] of Object.entries(t)) for (let t of r ?? []) t?.key && t.key.trim().length >= 2 && !Pt(t.key) && n.push({
|
|
2850
3042
|
field: e,
|
|
2851
3043
|
value: t.key
|
|
2852
3044
|
});
|
|
@@ -2865,14 +3057,14 @@ function Ot(e, t) {
|
|
|
2865
3057
|
sort: null
|
|
2866
3058
|
};
|
|
2867
3059
|
}
|
|
2868
|
-
function
|
|
2869
|
-
let t =
|
|
3060
|
+
function It(e = {}) {
|
|
3061
|
+
let t = _e(), { url: n, team: r, dataset: a, authenticatedFetch: s, setQuery: u, toggleFilter: d, setRangeFilter: f, setSort: p } = t, { auto: m } = e, h = c(t);
|
|
2870
3062
|
h.current = t;
|
|
2871
3063
|
let [g, _] = l(null), [v, y] = l(""), [b, x] = l(!1), S = c(0), C = i(async (e) => {
|
|
2872
3064
|
let t = ++S.current;
|
|
2873
3065
|
x(!0);
|
|
2874
3066
|
try {
|
|
2875
|
-
let i = await s(`${n}/api/teams/${r}/datasets/${a}/search-or-ask/filters${
|
|
3067
|
+
let i = await s(`${n}/api/teams/${r}/datasets/${a}/search-or-ask/filters${je(h.current)}`, {
|
|
2876
3068
|
method: "POST",
|
|
2877
3069
|
headers: { "Content-Type": "application/json" },
|
|
2878
3070
|
body: JSON.stringify({ text: e })
|
|
@@ -2911,7 +3103,7 @@ function kt(e = {}) {
|
|
|
2911
3103
|
return o(() => {
|
|
2912
3104
|
if (!A || !j || P || E.current.has(j)) return;
|
|
2913
3105
|
E.current.add(j);
|
|
2914
|
-
let e =
|
|
3106
|
+
let e = Ft(j, N);
|
|
2915
3107
|
if (e && (E.current.add(e.text), w(e), O(j)), k !== "model") return;
|
|
2916
3108
|
let t = e ? e.text : j;
|
|
2917
3109
|
if (!t) return;
|
|
@@ -2920,7 +3112,7 @@ function kt(e = {}) {
|
|
|
2920
3112
|
let o = ++S.current;
|
|
2921
3113
|
x(!0);
|
|
2922
3114
|
try {
|
|
2923
|
-
let c = await s(`${n}/api/teams/${r}/datasets/${a}/search-or-ask/filters${
|
|
3115
|
+
let c = await s(`${n}/api/teams/${r}/datasets/${a}/search-or-ask/filters${je(h.current)}`, {
|
|
2924
3116
|
method: "POST",
|
|
2925
3117
|
headers: { "Content-Type": "application/json" },
|
|
2926
3118
|
body: JSON.stringify({ text: t })
|
|
@@ -2957,42 +3149,41 @@ function kt(e = {}) {
|
|
|
2957
3149
|
appliedText: D
|
|
2958
3150
|
};
|
|
2959
3151
|
}
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
var At = {
|
|
3152
|
+
// src/hooks/useAsk.ts
|
|
3153
|
+
var Lt = {
|
|
2963
3154
|
question: "",
|
|
2964
3155
|
status: "idle",
|
|
2965
3156
|
answer: "",
|
|
2966
3157
|
sources: [],
|
|
2967
3158
|
steps: []
|
|
2968
3159
|
};
|
|
2969
|
-
function
|
|
2970
|
-
let e =
|
|
3160
|
+
function Rt() {
|
|
3161
|
+
let e = _e(), { url: t, team: n, dataset: r, authenticatedFetch: a } = e, s = c(e);
|
|
2971
3162
|
s.current = e;
|
|
2972
|
-
let [u, d] = l(
|
|
3163
|
+
let [u, d] = l(Lt), f = c(u);
|
|
2973
3164
|
f.current = u;
|
|
2974
|
-
let p = c(null), m = i(async (e, i = []) => {
|
|
2975
|
-
let
|
|
2976
|
-
if (!
|
|
3165
|
+
let p = c(null), m = i(async (e, i = [], o = {}) => {
|
|
3166
|
+
let c = e.trim();
|
|
3167
|
+
if (!c) return;
|
|
2977
3168
|
p.current?.abort();
|
|
2978
|
-
let
|
|
2979
|
-
p.current =
|
|
2980
|
-
question:
|
|
3169
|
+
let l = new AbortController();
|
|
3170
|
+
p.current = l, d({
|
|
3171
|
+
question: c,
|
|
2981
3172
|
status: "searching",
|
|
2982
3173
|
answer: "",
|
|
2983
3174
|
sources: [],
|
|
2984
3175
|
steps: []
|
|
2985
3176
|
});
|
|
2986
|
-
let
|
|
2987
|
-
|
|
2988
|
-
let e =
|
|
3177
|
+
let u = "", f = null, m = () => {
|
|
3178
|
+
f = null;
|
|
3179
|
+
let e = u;
|
|
2989
3180
|
d((t) => t.answer === e ? t : {
|
|
2990
3181
|
...t,
|
|
2991
3182
|
answer: e
|
|
2992
3183
|
});
|
|
2993
|
-
},
|
|
2994
|
-
|
|
2995
|
-
},
|
|
3184
|
+
}, h = () => {
|
|
3185
|
+
f !== null && (cancelAnimationFrame(f), f = null), m();
|
|
3186
|
+
}, g = (e, t) => d((n) => ({
|
|
2996
3187
|
...n,
|
|
2997
3188
|
status: "error",
|
|
2998
3189
|
error: {
|
|
@@ -3001,17 +3192,18 @@ function jt() {
|
|
|
3001
3192
|
}
|
|
3002
3193
|
}));
|
|
3003
3194
|
try {
|
|
3004
|
-
let e = await a(`${t}/api/teams/${n}/datasets/${r}/search-or-ask/ask${
|
|
3195
|
+
let e = await a(`${t}/api/teams/${n}/datasets/${r}/search-or-ask/ask${je(s.current)}`, {
|
|
3005
3196
|
method: "POST",
|
|
3006
3197
|
headers: {
|
|
3007
3198
|
"Content-Type": "application/json",
|
|
3008
3199
|
Accept: "text/event-stream"
|
|
3009
3200
|
},
|
|
3010
|
-
body: JSON.stringify(
|
|
3011
|
-
question:
|
|
3012
|
-
history: i
|
|
3013
|
-
|
|
3014
|
-
|
|
3201
|
+
body: JSON.stringify({
|
|
3202
|
+
question: c,
|
|
3203
|
+
...i.length ? { history: i } : {},
|
|
3204
|
+
...o.proactive ? { proactive: !0 } : {}
|
|
3205
|
+
}),
|
|
3206
|
+
signal: l.signal
|
|
3015
3207
|
});
|
|
3016
3208
|
if (e.status === 429) {
|
|
3017
3209
|
let t = await e.json().catch(() => ({})), n = Number(e.headers.get("Retry-After"));
|
|
@@ -3028,10 +3220,10 @@ function jt() {
|
|
|
3028
3220
|
askId: p
|
|
3029
3221
|
})), !e.ok || !e.body) {
|
|
3030
3222
|
let t = await e.json().catch(() => ({}));
|
|
3031
|
-
|
|
3223
|
+
g(t.code ?? `http${e.status}`, t.detail ?? "The question could not be asked.");
|
|
3032
3224
|
return;
|
|
3033
3225
|
}
|
|
3034
|
-
for await (let { event: t, data: n } of
|
|
3226
|
+
for await (let { event: t, data: n } of Ae(e.body)) switch (t) {
|
|
3035
3227
|
case "status": {
|
|
3036
3228
|
let e = n.step;
|
|
3037
3229
|
e && d((t) => ({
|
|
@@ -3054,33 +3246,33 @@ function jt() {
|
|
|
3054
3246
|
}));
|
|
3055
3247
|
break;
|
|
3056
3248
|
case "text":
|
|
3057
|
-
|
|
3249
|
+
u += n.delta, f ??= requestAnimationFrame(m);
|
|
3058
3250
|
break;
|
|
3059
3251
|
case "done":
|
|
3060
|
-
|
|
3252
|
+
h(), d((e) => ({
|
|
3061
3253
|
...e,
|
|
3062
3254
|
status: "answered"
|
|
3063
3255
|
}));
|
|
3064
3256
|
return;
|
|
3065
3257
|
case "error": {
|
|
3066
|
-
|
|
3258
|
+
h();
|
|
3067
3259
|
let e = n;
|
|
3068
|
-
|
|
3260
|
+
g(e.code, e.message);
|
|
3069
3261
|
return;
|
|
3070
3262
|
}
|
|
3071
3263
|
}
|
|
3072
|
-
|
|
3264
|
+
h(), l.signal.aborted || g("dropped", "The connection dropped while the answer was being written.");
|
|
3073
3265
|
} catch (e) {
|
|
3074
|
-
if (p.current !==
|
|
3075
|
-
|
|
3266
|
+
if (p.current !== l) return;
|
|
3267
|
+
h(), e.name === "AbortError" ? d((e) => e.answer ? {
|
|
3076
3268
|
...e,
|
|
3077
3269
|
status: "answered"
|
|
3078
3270
|
} : {
|
|
3079
3271
|
...e,
|
|
3080
3272
|
status: "idle"
|
|
3081
|
-
}) :
|
|
3273
|
+
}) : g("dropped", "The connection dropped while the answer was being written.");
|
|
3082
3274
|
} finally {
|
|
3083
|
-
p.current ===
|
|
3275
|
+
p.current === l && (p.current = null);
|
|
3084
3276
|
}
|
|
3085
3277
|
}, [
|
|
3086
3278
|
t,
|
|
@@ -3107,7 +3299,7 @@ function jt() {
|
|
|
3107
3299
|
r,
|
|
3108
3300
|
a
|
|
3109
3301
|
]), g = i(() => p.current?.abort(), []), _ = i(() => {
|
|
3110
|
-
p.current?.abort(), d(
|
|
3302
|
+
p.current?.abort(), d(Lt);
|
|
3111
3303
|
}, []);
|
|
3112
3304
|
return o(() => () => p.current?.abort(), []), {
|
|
3113
3305
|
...u,
|
|
@@ -3134,18 +3326,18 @@ var $ = {
|
|
|
3134
3326
|
searchedLabel: "_searchedLabel_gjc13_23",
|
|
3135
3327
|
steps: "_steps_gjc13_26",
|
|
3136
3328
|
stepDone: "_stepDone_gjc13_27"
|
|
3137
|
-
},
|
|
3138
|
-
function
|
|
3329
|
+
}, zt = /(`[^`\n]+`)|(\*\*[^*\n]+\*\*)|(\*[^*\n]+\*|_[^_\n]+_)|(\[[^\]\n]+\]\(https?:\/\/[^)\s]+\))|(\[\d+\])/g;
|
|
3330
|
+
function Bt(t, n, r) {
|
|
3139
3331
|
let i = [], a = 0, o = 0;
|
|
3140
|
-
for (let s of t.matchAll(
|
|
3332
|
+
for (let s of t.matchAll(zt)) {
|
|
3141
3333
|
s.index > a && i.push(t.slice(a, s.index));
|
|
3142
3334
|
let c = `${r}-${o++}`, [l, u, d, p, m, h] = s;
|
|
3143
3335
|
if (u) i.push(/* @__PURE__ */ f("code", {
|
|
3144
3336
|
className: $.inlineCode,
|
|
3145
3337
|
children: u.slice(1, -1)
|
|
3146
3338
|
}, c));
|
|
3147
|
-
else if (d) i.push(/* @__PURE__ */ f("strong", { children:
|
|
3148
|
-
else if (p) i.push(/* @__PURE__ */ f("em", { children:
|
|
3339
|
+
else if (d) i.push(/* @__PURE__ */ f("strong", { children: Bt(d.slice(2, -2), n, c) }, c));
|
|
3340
|
+
else if (p) i.push(/* @__PURE__ */ f("em", { children: Bt(p.slice(1, -1), n, c) }, c));
|
|
3149
3341
|
else if (m) {
|
|
3150
3342
|
let [, e, t] = /^\[([^\]]+)\]\(([^)]+)\)$/.exec(m);
|
|
3151
3343
|
i.push(/* @__PURE__ */ f("a", {
|
|
@@ -3159,7 +3351,7 @@ function Nt(t, n, r) {
|
|
|
3159
3351
|
}
|
|
3160
3352
|
return a < t.length && i.push(t.slice(a)), i;
|
|
3161
3353
|
}
|
|
3162
|
-
function
|
|
3354
|
+
function Vt(e) {
|
|
3163
3355
|
let t = e.replace(/\r\n/g, "\n").split("\n"), n = [], r = [], i = () => {
|
|
3164
3356
|
r.length && (n.push({
|
|
3165
3357
|
kind: "paragraph",
|
|
@@ -3204,16 +3396,12 @@ function Pt(e) {
|
|
|
3204
3396
|
continue;
|
|
3205
3397
|
}
|
|
3206
3398
|
let l = n[n.length - 1];
|
|
3207
|
-
|
|
3208
|
-
l.items[l.items.length - 1] += " " + a.trim();
|
|
3209
|
-
continue;
|
|
3210
|
-
}
|
|
3211
|
-
r.push(a.trim());
|
|
3399
|
+
r.length === 0 && l?.kind === "list" && /^\s{2,}\S/.test(a) ? l.items[l.items.length - 1] += " " + a.trim() : r.push(a.trim());
|
|
3212
3400
|
}
|
|
3213
3401
|
return i(), n;
|
|
3214
3402
|
}
|
|
3215
|
-
function
|
|
3216
|
-
return
|
|
3403
|
+
function Ht(e, t) {
|
|
3404
|
+
return Vt(e).map((e, n) => {
|
|
3217
3405
|
let r = `b${n}`;
|
|
3218
3406
|
switch (e.kind) {
|
|
3219
3407
|
case "code": return /* @__PURE__ */ f("pre", {
|
|
@@ -3223,61 +3411,63 @@ function Ft(e, t) {
|
|
|
3223
3411
|
}, r);
|
|
3224
3412
|
case "heading": return /* @__PURE__ */ f("p", {
|
|
3225
3413
|
className: $.heading,
|
|
3226
|
-
children:
|
|
3227
|
-
}, r);
|
|
3228
|
-
case "list": return /* @__PURE__ */ f(e.ordered ? "ol" : "ul", {
|
|
3229
|
-
className: $.list,
|
|
3230
|
-
children: e.items.map((e, n) => /* @__PURE__ */ f("li", { children: Nt(e, t, `${r}-${n}`) }, n))
|
|
3414
|
+
children: Bt(e.text, t, r)
|
|
3231
3415
|
}, r);
|
|
3416
|
+
case "list": {
|
|
3417
|
+
let n = e.ordered ? "ol" : "ul";
|
|
3418
|
+
return /* @__PURE__ */ f(n, {
|
|
3419
|
+
className: $.list,
|
|
3420
|
+
children: e.items.map((e, n) => /* @__PURE__ */ f("li", { children: Bt(e, t, `${r}-${n}`) }, n))
|
|
3421
|
+
}, r);
|
|
3422
|
+
}
|
|
3232
3423
|
default: return /* @__PURE__ */ f("p", {
|
|
3233
3424
|
className: $.paragraph,
|
|
3234
|
-
children:
|
|
3425
|
+
children: Bt(e.text, t, r)
|
|
3235
3426
|
}, r);
|
|
3236
3427
|
}
|
|
3237
3428
|
});
|
|
3238
3429
|
}
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
function Lt(e) {
|
|
3430
|
+
// src/components/AskPanel.tsx
|
|
3431
|
+
var Ut = /\[(\d+)\]/g;
|
|
3432
|
+
function Wt(e) {
|
|
3243
3433
|
let t = e.field.split(".")[0];
|
|
3244
3434
|
return e.value === "true" ? t : e.value === "false" ? `not ${t}` : e.value == null ? e.min != null && e.max != null ? e.min === e.max ? `${t} ${e.min}` : `${t} ${e.min}β${e.max}` : e.min == null ? `${t} β€ ${e.max}` : `${t} β₯ ${e.min}` : e.value;
|
|
3245
3435
|
}
|
|
3246
|
-
var
|
|
3247
|
-
let
|
|
3436
|
+
var Gt = ({ question: e, proactive: t = !1, followUps: n = !1, onSourceClick: r, label: i = "Answer", renderAnswer: a = Ht, onFollowUp: s, onStatusChange: u, onFilters: d, filterLabel: b = Wt, fill: T = !1, className: E = "" }) => {
|
|
3437
|
+
let D = Rt(), { ask: O, reset: k, stop: A, status: j, openSource: M } = D, [N, P] = l(!1), [I, L] = l([]), [z, B] = l(""), V = c([]), H = c(null), U = c(null), W = c(!0);
|
|
3248
3438
|
o(() => {
|
|
3249
|
-
L([]),
|
|
3439
|
+
L([]), V.current = [], e?.trim() ? O(e, [], { proactive: t }) : k();
|
|
3250
3440
|
}, [
|
|
3251
3441
|
e,
|
|
3252
|
-
|
|
3253
|
-
|
|
3442
|
+
O,
|
|
3443
|
+
k
|
|
3254
3444
|
]), o(() => {
|
|
3255
|
-
|
|
3256
|
-
}, [
|
|
3257
|
-
let
|
|
3445
|
+
u?.(j);
|
|
3446
|
+
}, [j, u]);
|
|
3447
|
+
let ee = c(void 0);
|
|
3258
3448
|
o(() => {
|
|
3259
|
-
|
|
3260
|
-
}, [
|
|
3261
|
-
let e =
|
|
3262
|
-
|
|
3449
|
+
D.filters && D.filters !== ee.current && (ee.current = D.filters, d?.(D.filters));
|
|
3450
|
+
}, [D.filters, d]), o(() => {
|
|
3451
|
+
let e = U.current;
|
|
3452
|
+
T && e && W.current && (e.scrollTop = e.scrollHeight);
|
|
3263
3453
|
}, [
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3454
|
+
T,
|
|
3455
|
+
D.answer,
|
|
3456
|
+
D.steps.length,
|
|
3457
|
+
j,
|
|
3458
|
+
I.length
|
|
3269
3459
|
]);
|
|
3270
|
-
let
|
|
3271
|
-
let e =
|
|
3272
|
-
e && (
|
|
3273
|
-
},
|
|
3460
|
+
let G = () => {
|
|
3461
|
+
let e = U.current;
|
|
3462
|
+
e && (W.current = e.scrollHeight - e.scrollTop - e.clientHeight < 40);
|
|
3463
|
+
}, te = (e) => e && /* @__PURE__ */ p("div", {
|
|
3274
3464
|
className: $.searched,
|
|
3275
3465
|
children: [
|
|
3276
3466
|
/* @__PURE__ */ p("span", {
|
|
3277
3467
|
className: $.searchedLabel,
|
|
3278
3468
|
children: [e.more ? `${e.found}+` : e.found, " found"]
|
|
3279
3469
|
}),
|
|
3280
|
-
e.filters.map((e, t) => /* @__PURE__ */ f(x, { children:
|
|
3470
|
+
e.filters.map((e, t) => /* @__PURE__ */ f(x, { children: b(e) }, t)),
|
|
3281
3471
|
e.text && /* @__PURE__ */ p("span", {
|
|
3282
3472
|
className: $.searchedLabel,
|
|
3283
3473
|
children: [
|
|
@@ -3298,39 +3488,39 @@ var Rt = ({ question: e, followUps: t = !1, onSourceClick: n, label: r = "Answer
|
|
|
3298
3488
|
})
|
|
3299
3489
|
]
|
|
3300
3490
|
});
|
|
3301
|
-
if (
|
|
3302
|
-
let K = (e, t) => (
|
|
3303
|
-
|
|
3304
|
-
},
|
|
3305
|
-
let i = e.find((e) => e.n ===
|
|
3491
|
+
if (j === "idle" && I.length === 0) return null;
|
|
3492
|
+
let K = (e, t) => (n) => {
|
|
3493
|
+
n.preventDefault(), M(e, t), r?.(e);
|
|
3494
|
+
}, re = (e, t) => (n) => {
|
|
3495
|
+
let i = e.find((e) => e.n === n);
|
|
3306
3496
|
return /* @__PURE__ */ f(C, {
|
|
3307
|
-
n
|
|
3497
|
+
n,
|
|
3308
3498
|
title: i?.title,
|
|
3309
|
-
onClick: i &&
|
|
3499
|
+
onClick: i && r ? K(i, t) : void 0
|
|
3310
3500
|
});
|
|
3311
|
-
},
|
|
3312
|
-
let r = new Set([...e.matchAll(
|
|
3501
|
+
}, ie = (e, t, n) => {
|
|
3502
|
+
let r = new Set([...e.matchAll(Ut)].map((e) => Number(e[1])));
|
|
3313
3503
|
return n && r.size > 0 ? t.filter((e) => r.has(e.n)) : t.slice(0, 3);
|
|
3314
|
-
},
|
|
3315
|
-
let a =
|
|
3504
|
+
}, q = (e, t, n, i) => {
|
|
3505
|
+
let a = ie(e, t, n);
|
|
3316
3506
|
return a.length > 0 && /* @__PURE__ */ f(S, { items: a.map((e) => ({
|
|
3317
3507
|
n: e.n,
|
|
3318
3508
|
title: e.title,
|
|
3319
|
-
onClick:
|
|
3509
|
+
onClick: r ? K(e, i) : void 0
|
|
3320
3510
|
})) });
|
|
3321
|
-
},
|
|
3322
|
-
navigator.clipboard?.writeText(
|
|
3323
|
-
},
|
|
3324
|
-
if (!
|
|
3325
|
-
if (
|
|
3511
|
+
}, J = () => {
|
|
3512
|
+
navigator.clipboard?.writeText(D.answer.replace(Ut, "")).catch(() => {}), P(!0), setTimeout(() => P(!1), 2e3);
|
|
3513
|
+
}, Y = (e) => {
|
|
3514
|
+
if (!D.busy && e.trim()) {
|
|
3515
|
+
if (j === "answered" && D.answer) {
|
|
3326
3516
|
let e = {
|
|
3327
|
-
question:
|
|
3328
|
-
answer:
|
|
3329
|
-
sources:
|
|
3330
|
-
askId:
|
|
3331
|
-
filters:
|
|
3517
|
+
question: D.question,
|
|
3518
|
+
answer: D.answer,
|
|
3519
|
+
sources: D.sources,
|
|
3520
|
+
askId: D.askId,
|
|
3521
|
+
filters: D.filters
|
|
3332
3522
|
};
|
|
3333
|
-
L((t) => [...t, e]),
|
|
3523
|
+
L((t) => [...t, e]), V.current = [...V.current, {
|
|
3334
3524
|
question: e.question,
|
|
3335
3525
|
answer: e.answer,
|
|
3336
3526
|
...e.filters ? { shown: {
|
|
@@ -3340,99 +3530,98 @@ var Rt = ({ question: e, followUps: t = !1, onSourceClick: n, label: r = "Answer
|
|
|
3340
3530
|
} } : {}
|
|
3341
3531
|
}];
|
|
3342
3532
|
}
|
|
3343
|
-
|
|
3533
|
+
B(""), O(e, V.current);
|
|
3344
3534
|
}
|
|
3345
|
-
},
|
|
3535
|
+
}, X = n ? () => H.current?.focus() : s;
|
|
3346
3536
|
return /* @__PURE__ */ p("div", {
|
|
3347
|
-
className: `${$.panel} ${
|
|
3537
|
+
className: `${$.panel} ${T ? $.fill : ""} ${E}`,
|
|
3348
3538
|
"aria-live": "polite",
|
|
3349
|
-
"aria-busy":
|
|
3539
|
+
"aria-busy": D.busy,
|
|
3350
3540
|
children: [/* @__PURE__ */ p("div", {
|
|
3351
|
-
ref:
|
|
3541
|
+
ref: U,
|
|
3352
3542
|
className: $.thread,
|
|
3353
|
-
onScroll:
|
|
3354
|
-
children: [
|
|
3543
|
+
onScroll: T ? G : void 0,
|
|
3544
|
+
children: [I.map((e, t) => /* @__PURE__ */ p("div", {
|
|
3355
3545
|
className: $.turn,
|
|
3356
|
-
children: [/* @__PURE__ */ f(
|
|
3357
|
-
label:
|
|
3546
|
+
children: [/* @__PURE__ */ f(R, { children: e.question }), /* @__PURE__ */ p(v, {
|
|
3547
|
+
label: i,
|
|
3358
3548
|
children: [
|
|
3359
|
-
|
|
3549
|
+
te(e.filters),
|
|
3360
3550
|
/* @__PURE__ */ f("div", {
|
|
3361
3551
|
className: $.answer,
|
|
3362
|
-
children:
|
|
3552
|
+
children: a(e.answer, re(e.sources, e.askId))
|
|
3363
3553
|
}),
|
|
3364
|
-
|
|
3554
|
+
q(e.answer, e.sources, !0, e.askId)
|
|
3365
3555
|
]
|
|
3366
3556
|
})]
|
|
3367
|
-
}, t)),
|
|
3557
|
+
}, t)), j !== "idle" && /* @__PURE__ */ p("div", {
|
|
3368
3558
|
className: $.turn,
|
|
3369
|
-
children: [/* @__PURE__ */ f(
|
|
3370
|
-
label:
|
|
3559
|
+
children: [/* @__PURE__ */ f(R, { children: D.question }), /* @__PURE__ */ p(v, {
|
|
3560
|
+
label: i,
|
|
3371
3561
|
children: [
|
|
3372
|
-
|
|
3373
|
-
|
|
3562
|
+
te(D.filters),
|
|
3563
|
+
D.answer && /* @__PURE__ */ f("div", {
|
|
3374
3564
|
className: $.answer,
|
|
3375
|
-
children:
|
|
3565
|
+
children: a(D.answer, re(D.sources))
|
|
3376
3566
|
}),
|
|
3377
|
-
|
|
3567
|
+
j === "searching" && D.steps.length > 0 && /* @__PURE__ */ p("div", {
|
|
3378
3568
|
className: $.steps,
|
|
3379
|
-
children: [
|
|
3569
|
+
children: [D.steps.slice(0, -1).map((e, t) => /* @__PURE__ */ f("span", {
|
|
3380
3570
|
className: $.stepDone,
|
|
3381
3571
|
children: e
|
|
3382
|
-
}, t)), /* @__PURE__ */ p(
|
|
3572
|
+
}, t)), /* @__PURE__ */ p(F, { children: [D.steps[D.steps.length - 1], "β¦"] })]
|
|
3383
3573
|
}),
|
|
3384
|
-
|
|
3385
|
-
|
|
3574
|
+
j === "searching" && D.steps.length === 0 && /* @__PURE__ */ f(F, { children: "Searchingβ¦" }),
|
|
3575
|
+
j === "writing" && /* @__PURE__ */ f(F, {
|
|
3386
3576
|
spinner: "grow",
|
|
3387
3577
|
children: "Writingβ¦"
|
|
3388
3578
|
}),
|
|
3389
|
-
|
|
3579
|
+
j === "error" && /* @__PURE__ */ p(m, {
|
|
3390
3580
|
variant: "default",
|
|
3391
3581
|
icon: null,
|
|
3392
3582
|
children: [
|
|
3393
|
-
/* @__PURE__ */ f(g, { children:
|
|
3394
|
-
/* @__PURE__ */ f(h, { children:
|
|
3395
|
-
|
|
3583
|
+
/* @__PURE__ */ f(g, { children: D.error?.code === "nothingFound" ? "Nothing to answer from" : "The answer did not come through" }),
|
|
3584
|
+
/* @__PURE__ */ f(h, { children: D.error?.code === "nothingFound" ? "The search found no records about this. Try other words, or search instead." : D.error?.message }),
|
|
3585
|
+
D.error?.code !== "nothingFound" && /* @__PURE__ */ f("div", {
|
|
3396
3586
|
className: $.action,
|
|
3397
3587
|
children: /* @__PURE__ */ f(y, {
|
|
3398
3588
|
variant: "secondary",
|
|
3399
3589
|
size: "micro",
|
|
3400
|
-
iconLeft: /* @__PURE__ */ f(
|
|
3401
|
-
onClick: () => D
|
|
3590
|
+
iconLeft: /* @__PURE__ */ f(ne, {}),
|
|
3591
|
+
onClick: () => O(D.question, V.current),
|
|
3402
3592
|
children: "Try again"
|
|
3403
3593
|
})
|
|
3404
3594
|
})
|
|
3405
3595
|
]
|
|
3406
3596
|
}),
|
|
3407
|
-
|
|
3597
|
+
j === "limited" && /* @__PURE__ */ p(m, {
|
|
3408
3598
|
variant: "default",
|
|
3409
3599
|
icon: null,
|
|
3410
3600
|
children: [/* @__PURE__ */ f(g, { children: "Too many questions for now" }), /* @__PURE__ */ p(h, { children: [
|
|
3411
3601
|
"You can ask again in about ",
|
|
3412
|
-
|
|
3602
|
+
D.retryAfterSeconds && D.retryAfterSeconds > 90 ? `${Math.ceil(D.retryAfterSeconds / 60)} minutes` : "a minute",
|
|
3413
3603
|
". Search still works in the meantime."
|
|
3414
3604
|
] })]
|
|
3415
3605
|
}),
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
onCopy:
|
|
3419
|
-
copied:
|
|
3420
|
-
onFollowUp:
|
|
3606
|
+
j !== "error" && j !== "limited" && q(D.answer, D.sources, j === "answered"),
|
|
3607
|
+
j === "answered" && /* @__PURE__ */ f(_, {
|
|
3608
|
+
onCopy: J,
|
|
3609
|
+
copied: N,
|
|
3610
|
+
onFollowUp: X
|
|
3421
3611
|
})
|
|
3422
3612
|
]
|
|
3423
3613
|
})]
|
|
3424
3614
|
})]
|
|
3425
|
-
}),
|
|
3426
|
-
ref:
|
|
3427
|
-
value:
|
|
3428
|
-
onChange:
|
|
3429
|
-
onSend:
|
|
3430
|
-
onStop:
|
|
3431
|
-
streaming:
|
|
3615
|
+
}), n && /* @__PURE__ */ f(w, {
|
|
3616
|
+
ref: H,
|
|
3617
|
+
value: z,
|
|
3618
|
+
onChange: B,
|
|
3619
|
+
onSend: Y,
|
|
3620
|
+
onStop: A,
|
|
3621
|
+
streaming: D.busy,
|
|
3432
3622
|
placeholder: "Ask a follow-upβ¦",
|
|
3433
3623
|
"aria-label": "Ask a follow-up"
|
|
3434
3624
|
})]
|
|
3435
3625
|
});
|
|
3436
3626
|
};
|
|
3437
|
-
|
|
3438
|
-
export { vt as ActiveFiltersPanel, Rt as AskPanel, pt as BucketFilterPanel, Ce as DEFAULT_CUT, _e as DEFAULT_THRESHOLDS, nt as FilterPanelSkeleton, q as IndxApiError, ut as RangeFilterPanel, Te as SCORE_SCALE, we as STRICT_COVERAGE, he as SearchContext, wt as SearchErrorBoundary, ze as SearchInput, ge as SearchProvider, Ge as SearchResult, $e as SearchResultRow, Ze as SearchResults, He as SearchResultsMessage, Je as SearchResultsSkeleton, Ct as SearchSettingsPanel, J as SearchSetupError, bt as SortByPanel, at as ValueFilterPanel, ae as describeSearchError, be as isIdentifier, Ot as localFilters, Se as nextOffer, Fe as stripAskPhrases, xe as triggers, jt as useAsk, kt as useFilterSuggestion, Et as useHybridSearch, Y as useSearch, Y as useSearchContext, Le as useSearchOrAsk, Tt as useVectorSearch, Ee as visibleResults };
|
|
3627
|
+
export { Je as ActiveFiltersPanel, Gt as AskPanel, Tt as BucketFilterPanel, Te as DEFAULT_CUT, ye as DEFAULT_THRESHOLDS, pt as FilterPanelSkeleton, Y as IndxApiError, Ue as QuickAnswer, St as RangeFilterPanel, De as SCORE_SCALE, Ee as STRICT_COVERAGE, he as SearchContext, jt as SearchErrorBoundary, Xe as SearchInput, ge as SearchProvider, nt as SearchResult, ut as SearchResultRow, ct as SearchResults, $e as SearchResultsMessage, at as SearchResultsSkeleton, At as SearchSettingsPanel, X as SearchSetupError, Dt as SortByPanel, gt as ValueFilterPanel, ae as describeSearchError, xe as isIdentifier, Ft as localFilters, we as nextOffer, Le as stripAskPhrases, Ce as triggers, Rt as useAsk, It as useFilterSuggestion, Nt as useHybridSearch, _e as useSearch, _e as useSearchContext, Be as useSearchOrAsk, Mt as useVectorSearch, Oe as visibleResults };
|