@indxsearch/intrface 3.14.0 β 3.15.1
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 +26 -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/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 +984 -787
- package/dist/intrface.css +1 -1
- package/dist/utils/searchOrAsk.d.ts +23 -3
- package/package.json +3 -3
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
|
|
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
7
|
// src/context/IndxApiError.ts
|
|
8
|
-
var
|
|
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,
|
|
@@ -120,9 +120,9 @@ function oe({ url: e, team: t, dataset: n, preAuthenticatedToken: r, enableDebug
|
|
|
120
120
|
(async () => {
|
|
121
121
|
D(null), k(null), d(!0);
|
|
122
122
|
try {
|
|
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
|
|
124
|
-
if (!e) throw console.error("[Auth] β Missing INDX server URL"), console.error("[Auth] π‘ Pass a url to SearchProvider"), new
|
|
125
|
-
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.");
|
|
126
126
|
i && console.log("[Auth] β
Using bearer token");
|
|
127
127
|
let a = r, o = (e) => fetch(e, {
|
|
128
128
|
method: "GET",
|
|
@@ -133,7 +133,7 @@ function oe({ url: e, team: t, dataset: n, preAuthenticatedToken: r, enableDebug
|
|
|
133
133
|
});
|
|
134
134
|
i && console.log("[Auth] π Checking dataset status...");
|
|
135
135
|
let c = await o(`${e}/api/teams/${t}/datasets/${n}/status`);
|
|
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
|
|
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));
|
|
137
137
|
let l = await c.json();
|
|
138
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"));
|
|
139
139
|
let d = l.documentCount ?? l.numberOfRecords ?? 0;
|
|
@@ -144,9 +144,9 @@ function oe({ url: e, team: t, dataset: n, preAuthenticatedToken: r, enableDebug
|
|
|
144
144
|
o(`${e}/api/teams/${t}/datasets/${n}/fields/sortable`),
|
|
145
145
|
o(`${e}/api/teams/${t}/datasets/${n}/fields/configuration`).catch(() => null)
|
|
146
146
|
]);
|
|
147
|
-
if (!f.ok) throw console.error("[Auth] β GetFilterableFields failed:", f.status), await
|
|
148
|
-
if (!m.ok) throw console.error("[Auth] β GetFacetableFields failed:", m.status), await
|
|
149
|
-
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);
|
|
150
150
|
let [b, S, w] = await Promise.all([
|
|
151
151
|
f.json().catch((e) => (console.error("Failed to parse GetFilterableFields response:", e), [])),
|
|
152
152
|
m.json().catch((e) => (console.error("Failed to parse GetFacetableFields response:", e), [])),
|
|
@@ -226,7 +226,7 @@ async function se(e, t, n, r, i, a, o) {
|
|
|
226
226
|
headers: { "Content-Type": "application/json" },
|
|
227
227
|
body: JSON.stringify(t)
|
|
228
228
|
});
|
|
229
|
-
if (!s.ok) throw await
|
|
229
|
+
if (!s.ok) throw await Y.fromResponse(n, s);
|
|
230
230
|
let c = await s.json();
|
|
231
231
|
if (!c || typeof c.hashString != "string") throw Error(`${n} failed: server returned no filter token`);
|
|
232
232
|
return c;
|
|
@@ -301,16 +301,15 @@ function de({ state: e, setState: t, authenticatedFetch: n, auth: r, url: a, tea
|
|
|
301
301
|
]);
|
|
302
302
|
let j = e.searchSettings.maxNumberOfRecordsToReturn, M = e.searchSettings.enableCoverage, N = e.searchSettings.removeDuplicates, P = e.searchSettings.coverageDepth, F = e.searchSettings.minimumScore, I = e.searchSettings.coverageSetup, L = e.sortBy, R = e.sortAscending, z = i(async ({ enableFacets: i }) => {
|
|
303
303
|
if (!r.token) return;
|
|
304
|
-
let o =
|
|
305
|
-
if (
|
|
304
|
+
let o = b.trim() === "";
|
|
305
|
+
if (o && !d) return;
|
|
306
|
+
let c = ++S.current;
|
|
307
|
+
t((e) => ({
|
|
306
308
|
...e,
|
|
307
309
|
isLoading: !0
|
|
308
|
-
})),
|
|
309
|
-
if (!d) return;
|
|
310
|
-
i = !0;
|
|
311
|
-
}
|
|
310
|
+
})), o && (i = !0);
|
|
312
311
|
try {
|
|
313
|
-
let
|
|
312
|
+
let o = 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), ...o.map((t) => le({
|
|
314
313
|
...e.filters,
|
|
315
314
|
[t]: []
|
|
316
315
|
}, e.rangeFilters, a, s, u, n, e.valueMatch, {
|
|
@@ -345,11 +344,11 @@ function de({ state: e, setState: t, authenticatedFetch: n, auth: r, url: a, tea
|
|
|
345
344
|
enableFacets: !0,
|
|
346
345
|
...e ? { filter: e } : {}
|
|
347
346
|
}))]);
|
|
348
|
-
if (!V.ok) throw await
|
|
347
|
+
if (!V.ok) throw await Y.fromResponse("Search", V);
|
|
349
348
|
let U = await V.json(), W = V.headers.get("Indx-Query-Id") ?? void 0, ee = U.truncationIndex ?? -1, G = {};
|
|
350
|
-
for (let e = 0; e <
|
|
351
|
-
let t =
|
|
352
|
-
if (!H[e].ok) throw await
|
|
349
|
+
for (let e = 0; e < o.length; e++) {
|
|
350
|
+
let t = o[e];
|
|
351
|
+
if (!H[e].ok) throw await Y.fromResponse(`Facets for '${t}'`, H[e]);
|
|
353
352
|
let n = await H[e].json();
|
|
354
353
|
n.facets?.[t] !== void 0 && (G[t] = n.facets[t]);
|
|
355
354
|
}
|
|
@@ -360,7 +359,7 @@ function de({ state: e, setState: t, authenticatedFetch: n, auth: r, url: a, tea
|
|
|
360
359
|
headers: { "Content-Type": "application/json" },
|
|
361
360
|
body: JSON.stringify(K)
|
|
362
361
|
});
|
|
363
|
-
if (!e.ok) throw await
|
|
362
|
+
if (!e.ok) throw await Y.fromResponse("Document lookup", e);
|
|
364
363
|
re = (await e.json()).map((e, t) => ({
|
|
365
364
|
document: e,
|
|
366
365
|
documentKey: K[t],
|
|
@@ -377,15 +376,15 @@ function de({ state: e, setState: t, authenticatedFetch: n, auth: r, url: a, tea
|
|
|
377
376
|
});
|
|
378
377
|
}
|
|
379
378
|
}
|
|
380
|
-
if (
|
|
381
|
-
let
|
|
382
|
-
if (
|
|
379
|
+
if (c !== S.current) return;
|
|
380
|
+
let q = b !== D, J = b !== k, X = e.facetStats ?? {};
|
|
381
|
+
if (q ? (X = {
|
|
383
382
|
...r.initialFacetStats,
|
|
384
383
|
...ie
|
|
385
|
-
}, E(
|
|
384
|
+
}, E(X), O(b)) : X = {
|
|
386
385
|
...T,
|
|
387
386
|
...ie
|
|
388
|
-
},
|
|
387
|
+
}, J && i) {
|
|
389
388
|
let n = { ...e.rangeBounds };
|
|
390
389
|
for (let [e, t] of Object.entries(ie)) n[e] = t;
|
|
391
390
|
t((e) => ({
|
|
@@ -393,18 +392,18 @@ function de({ state: e, setState: t, authenticatedFetch: n, auth: r, url: a, tea
|
|
|
393
392
|
rangeBounds: n
|
|
394
393
|
})), A(b);
|
|
395
394
|
}
|
|
396
|
-
let
|
|
395
|
+
let ae = Object.keys(G).length > 0 ? {
|
|
397
396
|
...U.facets ?? {},
|
|
398
397
|
...G
|
|
399
398
|
} : U.facets;
|
|
400
|
-
if (i && (!
|
|
401
|
-
|
|
402
|
-
for (let [e, t] of Object.entries(r.initialFacetKeys))
|
|
399
|
+
if (i && (!ae || Object.keys(ae).length === 0)) {
|
|
400
|
+
ae = {};
|
|
401
|
+
for (let [e, t] of Object.entries(r.initialFacetKeys)) ae[e] = t.map((e) => ({
|
|
403
402
|
key: e,
|
|
404
403
|
value: null
|
|
405
404
|
}));
|
|
406
405
|
}
|
|
407
|
-
let
|
|
406
|
+
let oe = re.filter((e) => {
|
|
408
407
|
let t = b.trim();
|
|
409
408
|
return t === "" || t.length === 1 || e.score >= F;
|
|
410
409
|
}).map((e, t) => ({
|
|
@@ -413,20 +412,20 @@ function de({ state: e, setState: t, authenticatedFetch: n, auth: r, url: a, tea
|
|
|
413
412
|
}));
|
|
414
413
|
t((e) => ({
|
|
415
414
|
...e,
|
|
416
|
-
results:
|
|
415
|
+
results: oe,
|
|
417
416
|
error: void 0,
|
|
418
417
|
errorInfo: void 0,
|
|
419
418
|
resultsSuppressed: !m,
|
|
420
419
|
...i ? {
|
|
421
|
-
facets:
|
|
422
|
-
facetStats:
|
|
420
|
+
facets: ae,
|
|
421
|
+
facetStats: X
|
|
423
422
|
} : {},
|
|
424
423
|
isLoading: !1,
|
|
425
424
|
truncationIndex: ee,
|
|
426
425
|
queryId: W
|
|
427
426
|
}));
|
|
428
427
|
} catch (e) {
|
|
429
|
-
if (console.error("[Search] β Search failed:", e), e instanceof TypeError && e.message.includes("fetch") ? (console.error("[Search] β Network error - cannot reach INDX server"), console.error("[Search] π‘ Check if server is running at:", a)) : e instanceof Error && (e.message.includes("401") ? (console.error("[Search] β Authentication failed"), console.error("[Search] π‘ Your token may have expired. Create or refresh it on the Indx Dashboard.")) : e.message.includes("404") ? (console.error("[Search] β Dataset not found"), console.error("[Search] π‘ Check that dataset \"" + u + "\" exists")) : console.error("[Search] π‘ Error:", e.message)),
|
|
428
|
+
if (console.error("[Search] β Search failed:", e), e instanceof TypeError && e.message.includes("fetch") ? (console.error("[Search] β Network error - cannot reach INDX server"), console.error("[Search] π‘ Check if server is running at:", a)) : e instanceof Error && (e.message.includes("401") ? (console.error("[Search] β Authentication failed"), console.error("[Search] π‘ Your token may have expired. Create or refresh it on the Indx Dashboard.")) : e.message.includes("404") ? (console.error("[Search] β Dataset not found"), console.error("[Search] π‘ Check that dataset \"" + u + "\" exists")) : console.error("[Search] π‘ Error:", e.message)), c !== S.current) return;
|
|
430
429
|
t((t) => ({
|
|
431
430
|
...t,
|
|
432
431
|
results: null,
|
|
@@ -482,7 +481,7 @@ function de({ state: e, setState: t, authenticatedFetch: n, auth: r, url: a, tea
|
|
|
482
481
|
}, e.facetDebounceDelayMillis ?? 500), () => {
|
|
483
482
|
B.current?.cancel();
|
|
484
483
|
}), [e.facetDebounceDelayMillis]), o(() => {
|
|
485
|
-
!r.isFetchingInitial && r.token && !w.current && (d && C.current?.({ enableFacets: f }), w.current = !0);
|
|
484
|
+
!r.isFetchingInitial && r.token && !w.current && ((d || b.trim() !== "") && C.current?.({ enableFacets: f }), w.current = !0);
|
|
486
485
|
}, [
|
|
487
486
|
r.isFetchingInitial,
|
|
488
487
|
r.token,
|
|
@@ -490,12 +489,13 @@ function de({ state: e, setState: t, authenticatedFetch: n, auth: r, url: a, tea
|
|
|
490
489
|
f
|
|
491
490
|
]), o(() => {
|
|
492
491
|
if (!r.token || !w.current) return;
|
|
493
|
-
let
|
|
494
|
-
if (
|
|
492
|
+
let e = b.trim(), n = e === "" && d;
|
|
493
|
+
if (e === "" && !d) S.current++, B.current?.cancel(), t((e) => e.resultsSuppressed && !e.isLoading ? e : {
|
|
495
494
|
...e,
|
|
496
|
-
resultsSuppressed: !0
|
|
497
|
-
|
|
498
|
-
|
|
495
|
+
resultsSuppressed: !0,
|
|
496
|
+
isLoading: !1
|
|
497
|
+
});
|
|
498
|
+
else return n ? (B.current?.cancel(), C.current?.({ enableFacets: f })) : f ? (p && console.log("Search fired"), C.current?.({ enableFacets: !1 }), B.current?.()) : C.current?.({ enableFacets: !1 }), () => {
|
|
499
499
|
B.current?.cancel();
|
|
500
500
|
};
|
|
501
501
|
}, [
|
|
@@ -786,7 +786,7 @@ var me = "Type to search", he = n(void 0), ge = ({ children: e, url: t, team: n,
|
|
|
786
786
|
filterRevision: r.filterRevision + 1
|
|
787
787
|
};
|
|
788
788
|
});
|
|
789
|
-
}, []),
|
|
789
|
+
}, []), Y = i((e, t, n = !0) => {
|
|
790
790
|
N((r) => {
|
|
791
791
|
let i = { ...r.bucketFilters }, a = t ? (i[e] ?? []).filter((e) => !q(e, t)) : [];
|
|
792
792
|
return a.length > 0 ? i[e] = a : delete i[e], {
|
|
@@ -795,7 +795,7 @@ var me = "Type to search", he = n(void 0), ge = ({ children: e, url: t, team: n,
|
|
|
795
795
|
filterRevision: r.filterRevision + +!!n
|
|
796
796
|
};
|
|
797
797
|
});
|
|
798
|
-
}, []),
|
|
798
|
+
}, []), X = i((e, t) => {
|
|
799
799
|
N((n) => ({
|
|
800
800
|
...n,
|
|
801
801
|
sortBy: e || void 0,
|
|
@@ -824,8 +824,8 @@ var me = "Type to search", he = n(void 0), ge = ({ children: e, url: t, team: n,
|
|
|
824
824
|
resetSingleFilter: re,
|
|
825
825
|
resetRangeFilter: ie,
|
|
826
826
|
toggleBucketFilter: J,
|
|
827
|
-
resetBucketFilter:
|
|
828
|
-
setSort:
|
|
827
|
+
resetBucketFilter: Y,
|
|
828
|
+
setSort: X,
|
|
829
829
|
setDebounceDelay: U,
|
|
830
830
|
setSearchSettings: W,
|
|
831
831
|
fetchMoreResults: ee,
|
|
@@ -840,50 +840,59 @@ var me = "Type to search", he = n(void 0), ge = ({ children: e, url: t, team: n,
|
|
|
840
840
|
},
|
|
841
841
|
children: e
|
|
842
842
|
});
|
|
843
|
-
},
|
|
843
|
+
}, _e = () => {
|
|
844
844
|
let e = a(he);
|
|
845
845
|
if (!e) throw Error("useSearchContext must be used within a SearchProvider");
|
|
846
846
|
return e;
|
|
847
|
-
}
|
|
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 = {
|
|
848
853
|
strong: .65,
|
|
849
854
|
strongHide: .45,
|
|
850
855
|
invite: .4,
|
|
851
|
-
inviteHide: .3
|
|
852
|
-
|
|
853
|
-
|
|
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) {
|
|
854
861
|
let t = e.trim();
|
|
855
|
-
return t.length > 0 && !t.includes(" ") &&
|
|
862
|
+
return t.length > 0 && !t.includes(" ") && be.test(t);
|
|
856
863
|
}
|
|
857
|
-
function
|
|
864
|
+
function Se(e) {
|
|
858
865
|
let t = e.trim();
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
866
|
+
return !!t && !xe(t) && (t.endsWith("?") || t.split(/\s+/).length >= 3);
|
|
867
|
+
}
|
|
868
|
+
function Ce(e, t = 4) {
|
|
869
|
+
let n = e.trim();
|
|
870
|
+
return !n || xe(n) ? !1 : Se(n) || n.length >= t;
|
|
862
871
|
}
|
|
863
|
-
function
|
|
872
|
+
function we(e, t, n = ye) {
|
|
864
873
|
return t >= n.strong || e === "strong" && t >= n.strongHide ? "strong" : t >= n.invite || e !== "none" && t >= n.inviteHide ? "invite" : "none";
|
|
865
874
|
}
|
|
866
|
-
var
|
|
875
|
+
var Te = {
|
|
867
876
|
shareOfTop: .5,
|
|
868
877
|
topFloor: .2
|
|
869
|
-
},
|
|
878
|
+
}, Ee = {
|
|
870
879
|
coverFuzzyWords: !1,
|
|
871
880
|
coverPrefixSuffix: !1,
|
|
872
881
|
coverJoinedWords: !1,
|
|
873
882
|
minWordSize: 3
|
|
874
|
-
},
|
|
875
|
-
function
|
|
883
|
+
}, De = 65535;
|
|
884
|
+
function Oe(e, t, n, r = Te) {
|
|
876
885
|
if (!n || e.length === 0) return e;
|
|
877
886
|
let i = e[0].score;
|
|
878
887
|
if (i < r.topFloor * 65535) return [];
|
|
879
888
|
let a = t == null ? e : t < 0 ? [] : e.slice(0, t + 1), o = r.shareOfTop * i, s = a.findIndex((e) => e.score < o);
|
|
880
889
|
return s < 0 ? a : a.slice(0, s);
|
|
881
890
|
}
|
|
882
|
-
function
|
|
891
|
+
function ke(e) {
|
|
883
892
|
let t = e.trim();
|
|
884
893
|
return t.includes(" ") || t.endsWith("?");
|
|
885
894
|
}
|
|
886
|
-
async function*
|
|
895
|
+
async function* Ae(e) {
|
|
887
896
|
let t = e.getReader(), n = new TextDecoder(), r = "";
|
|
888
897
|
try {
|
|
889
898
|
for (;;) {
|
|
@@ -906,35 +915,35 @@ async function* Oe(e) {
|
|
|
906
915
|
t.releaseLock();
|
|
907
916
|
}
|
|
908
917
|
}
|
|
909
|
-
function
|
|
918
|
+
function je(e) {
|
|
910
919
|
let t = new URLSearchParams();
|
|
911
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");
|
|
912
921
|
let n = t.toString();
|
|
913
922
|
return n ? `?${n}` : "";
|
|
914
923
|
}
|
|
915
924
|
// src/utils/askPhrases.ts
|
|
916
|
-
var
|
|
917
|
-
function
|
|
925
|
+
var Me = (e) => e.toLowerCase().replace(/β/g, "'").split(/\s+/).filter(Boolean), Ne = /[?!.,]+$/, Pe = 2;
|
|
926
|
+
function Fe(e, t) {
|
|
918
927
|
let n = 0;
|
|
919
928
|
for (let r of t) {
|
|
920
|
-
let t =
|
|
921
|
-
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);
|
|
922
931
|
}
|
|
923
932
|
return n;
|
|
924
933
|
}
|
|
925
|
-
function
|
|
934
|
+
function Ie(e, t, n) {
|
|
926
935
|
let r = 0;
|
|
927
936
|
for (let i of n) {
|
|
928
|
-
let n =
|
|
929
|
-
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);
|
|
930
939
|
}
|
|
931
940
|
return r;
|
|
932
941
|
}
|
|
933
|
-
function
|
|
934
|
-
let n = e.trim().split(/\s+/).filter(Boolean), r =
|
|
935
|
-
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);
|
|
936
945
|
return t && (a.push(n.slice(i, i + t).join(" ")), i += t), t > 0;
|
|
937
|
-
}, s =
|
|
946
|
+
}, s = Ie(r, 0, t.leadIns), c = o(t.leadIns), l = o(t.frames), u = o(t.links);
|
|
938
947
|
if (!(c && (s > 1 || l) || l && u)) return {
|
|
939
948
|
text: e,
|
|
940
949
|
taken: []
|
|
@@ -945,8 +954,8 @@ function Fe(e, t) {
|
|
|
945
954
|
text: e,
|
|
946
955
|
taken: []
|
|
947
956
|
};
|
|
948
|
-
let f = d.split(/\s+/).filter(Boolean), p =
|
|
949
|
-
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) {
|
|
950
959
|
let e = f.slice(0, f.length - p).join(" ");
|
|
951
960
|
if (/\p{L}{3,}/u.test(e)) return {
|
|
952
961
|
text: e,
|
|
@@ -959,7 +968,15 @@ function Fe(e, t) {
|
|
|
959
968
|
};
|
|
960
969
|
}
|
|
961
970
|
// src/hooks/useSearchOrAsk.ts
|
|
962
|
-
|
|
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 = {
|
|
963
980
|
available: !1,
|
|
964
981
|
offer: "none",
|
|
965
982
|
p: null,
|
|
@@ -968,286 +985,543 @@ var Ie = {
|
|
|
968
985
|
criteria: null,
|
|
969
986
|
describes: !1,
|
|
970
987
|
cutResults: !1,
|
|
971
|
-
cutRule:
|
|
988
|
+
cutRule: Te,
|
|
972
989
|
strictCoverage: !1,
|
|
973
990
|
filtersWhileTyping: "off",
|
|
991
|
+
mode: "soft",
|
|
992
|
+
askAnytime: !1,
|
|
993
|
+
finished: null,
|
|
994
|
+
answerNow: null,
|
|
995
|
+
quick: "none",
|
|
974
996
|
stands: !1
|
|
975
997
|
};
|
|
976
|
-
function
|
|
977
|
-
let { enabled: t = !0, pauseMs: n = 300 } = e,
|
|
978
|
-
|
|
979
|
-
let
|
|
980
|
-
k.current =
|
|
981
|
-
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;
|
|
982
1012
|
o(() => {
|
|
983
|
-
if (
|
|
1013
|
+
if (b(!1), !K) return;
|
|
984
1014
|
let e = !1;
|
|
985
1015
|
return (async () => {
|
|
986
1016
|
try {
|
|
987
|
-
let t = await
|
|
1017
|
+
let t = await p(W);
|
|
988
1018
|
if (!t.ok) return;
|
|
989
1019
|
let n = await t.json();
|
|
990
1020
|
if (e || !n.available || !n.settings?.enabled) return;
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
},
|
|
995
|
-
shareOfTop: n.settings.cutShareOfTop ?? Ce.shareOfTop,
|
|
996
|
-
topFloor: n.settings.cutTopFloor ?? Ce.topFloor
|
|
997
|
-
}, _(!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);
|
|
998
1025
|
} catch {}
|
|
999
1026
|
})(), () => {
|
|
1000
1027
|
e = !0;
|
|
1001
1028
|
};
|
|
1002
1029
|
}, [
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
])
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
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);
|
|
1012
1067
|
return;
|
|
1013
1068
|
}
|
|
1014
|
-
if (!
|
|
1015
|
-
|
|
1016
|
-
...
|
|
1017
|
-
available:
|
|
1069
|
+
if (!v) {
|
|
1070
|
+
I.current = "", S({
|
|
1071
|
+
...ze,
|
|
1072
|
+
available: y
|
|
1018
1073
|
});
|
|
1019
1074
|
return;
|
|
1020
1075
|
}
|
|
1021
|
-
if (!
|
|
1022
|
-
|
|
1076
|
+
if (!Ce(v, ee())) {
|
|
1077
|
+
xe(v) && S((e) => ({
|
|
1023
1078
|
...e,
|
|
1024
|
-
available:
|
|
1079
|
+
available: y,
|
|
1025
1080
|
offer: "none",
|
|
1026
|
-
text:
|
|
1081
|
+
text: v
|
|
1027
1082
|
}));
|
|
1028
1083
|
return;
|
|
1029
1084
|
}
|
|
1030
|
-
|
|
1085
|
+
A.current !== "strict" && N.current && j.current && Le(v, j.current).taken.length > 0 && S((e) => e.offer === "none" ? {
|
|
1031
1086
|
...e,
|
|
1032
|
-
available:
|
|
1087
|
+
available: y,
|
|
1033
1088
|
offer: "invite",
|
|
1034
|
-
text:
|
|
1035
|
-
} : e);
|
|
1036
|
-
let e = setTimeout(async () => {
|
|
1037
|
-
if (
|
|
1038
|
-
|
|
1089
|
+
text: v
|
|
1090
|
+
} : e), ne.current(v);
|
|
1091
|
+
let e = !1, t = setTimeout(async () => {
|
|
1092
|
+
if (te(v)) {
|
|
1093
|
+
S((e) => ({
|
|
1039
1094
|
...e,
|
|
1040
|
-
text:
|
|
1095
|
+
text: v
|
|
1041
1096
|
}));
|
|
1042
1097
|
return;
|
|
1043
1098
|
}
|
|
1044
|
-
if (Date.now() <
|
|
1045
|
-
let
|
|
1046
|
-
|
|
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;
|
|
1047
1102
|
try {
|
|
1048
|
-
let
|
|
1103
|
+
let e = await p(`${W}/intent${je(_.current)}`, {
|
|
1049
1104
|
method: "POST",
|
|
1050
1105
|
headers: { "Content-Type": "application/json" },
|
|
1051
|
-
body: JSON.stringify({ text:
|
|
1106
|
+
body: JSON.stringify({ text: v })
|
|
1052
1107
|
});
|
|
1053
|
-
if (
|
|
1054
|
-
let
|
|
1055
|
-
|
|
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;
|
|
1056
1111
|
return;
|
|
1057
1112
|
}
|
|
1058
|
-
if (
|
|
1059
|
-
|
|
1113
|
+
if (e.status === 409) {
|
|
1114
|
+
b(!1);
|
|
1060
1115
|
return;
|
|
1061
1116
|
}
|
|
1062
|
-
if (!
|
|
1063
|
-
let { p: n, answerable: r, criteria: i,
|
|
1064
|
-
if (
|
|
1065
|
-
|
|
1066
|
-
shareOfTop:
|
|
1067
|
-
topFloor:
|
|
1068
|
-
}),
|
|
1069
|
-
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);
|
|
1070
1125
|
return {
|
|
1071
1126
|
available: !0,
|
|
1072
|
-
offer:
|
|
1127
|
+
offer: u,
|
|
1073
1128
|
p: n,
|
|
1074
1129
|
answerable: r ?? null,
|
|
1075
|
-
text:
|
|
1076
|
-
criteria:
|
|
1077
|
-
describes:
|
|
1078
|
-
cutResults:
|
|
1079
|
-
cutRule:
|
|
1080
|
-
strictCoverage:
|
|
1081
|
-
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,
|
|
1082
1142
|
stands: !0
|
|
1083
1143
|
};
|
|
1084
1144
|
});
|
|
1085
1145
|
} catch {}
|
|
1086
1146
|
}, n);
|
|
1087
|
-
return () =>
|
|
1147
|
+
return () => {
|
|
1148
|
+
e = !0, clearTimeout(t);
|
|
1149
|
+
};
|
|
1088
1150
|
}, [
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1151
|
+
v,
|
|
1152
|
+
y,
|
|
1153
|
+
W,
|
|
1154
|
+
p,
|
|
1093
1155
|
n
|
|
1094
1156
|
]);
|
|
1095
|
-
let
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
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;
|
|
1100
1175
|
let n = t.searchSettings.coverageSetup ?? {};
|
|
1101
|
-
|
|
1102
|
-
} else
|
|
1103
|
-
}, [
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
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
|
+
};
|
|
1107
1189
|
}
|
|
1108
|
-
var
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
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;
|
|
1355
|
+
}
|
|
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 = () => {
|
|
1118
1383
|
C(""), T > 0 && w();
|
|
1119
|
-
},
|
|
1384
|
+
}, K = () => {
|
|
1385
|
+
I.current = m.trim(), s(m.trim());
|
|
1386
|
+
}, ne = /* @__PURE__ */ p(A, {
|
|
1120
1387
|
type: "text",
|
|
1121
1388
|
value: m,
|
|
1122
1389
|
onChange: (e) => C(e.target.value),
|
|
1123
|
-
placeholder:
|
|
1124
|
-
autoFocus:
|
|
1125
|
-
className:
|
|
1390
|
+
placeholder: V,
|
|
1391
|
+
autoFocus: n,
|
|
1392
|
+
className: t,
|
|
1126
1393
|
showSearchIcon: !0,
|
|
1127
|
-
inputSize:
|
|
1128
|
-
showFocusBorder:
|
|
1394
|
+
inputSize: r,
|
|
1395
|
+
showFocusBorder: a,
|
|
1129
1396
|
clearable: !1,
|
|
1130
|
-
onKeyDown:
|
|
1131
|
-
...
|
|
1397
|
+
onKeyDown: H,
|
|
1398
|
+
...d,
|
|
1132
1399
|
children: [
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
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,
|
|
1136
1408
|
size: "micro",
|
|
1137
|
-
iconLeft: /* @__PURE__ */ f(
|
|
1138
|
-
iconRight:
|
|
1139
|
-
onClick:
|
|
1140
|
-
title:
|
|
1141
|
-
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"
|
|
1142
1414
|
}),
|
|
1143
|
-
|
|
1144
|
-
|
|
1415
|
+
o && k && /* @__PURE__ */ f(x, { children: "No results" }),
|
|
1416
|
+
o && j && /* @__PURE__ */ f(L, {
|
|
1145
1417
|
content: "No direct match. Showing the nearest results.",
|
|
1146
1418
|
children: /* @__PURE__ */ f("span", { children: /* @__PURE__ */ f(x, {
|
|
1147
|
-
icon: /* @__PURE__ */ f(
|
|
1419
|
+
icon: /* @__PURE__ */ f(W, {}),
|
|
1148
1420
|
children: "Nearest"
|
|
1149
1421
|
}) })
|
|
1150
1422
|
}),
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
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, {})
|
|
1159
1444
|
}),
|
|
1160
|
-
|
|
1445
|
+
i && (E || T > 0) && /* @__PURE__ */ f(y, {
|
|
1161
1446
|
variant: "ghost",
|
|
1162
1447
|
size: "micro",
|
|
1163
|
-
onClick:
|
|
1448
|
+
onClick: te,
|
|
1164
1449
|
"aria-label": T > 0 ? "Clear search and filters" : "Clear search",
|
|
1165
1450
|
children: "Clear"
|
|
1166
1451
|
})
|
|
1167
1452
|
]
|
|
1168
1453
|
});
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
className: U ? Re.askStrong : void 0,
|
|
1179
|
-
iconLeft: /* @__PURE__ */ f(L, {}),
|
|
1180
|
-
onClick: z,
|
|
1181
|
-
children: U ? "Ask the assistant" : "Ask about this"
|
|
1182
|
-
}), U && /* @__PURE__ */ p("span", {
|
|
1183
|
-
className: Re.offerHint,
|
|
1184
|
-
children: [/* @__PURE__ */ f("kbd", {
|
|
1185
|
-
className: Re.kbd,
|
|
1186
|
-
children: "β΅"
|
|
1187
|
-
}), " to ask"]
|
|
1188
|
-
})] })
|
|
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
|
+
})
|
|
1189
1463
|
})]
|
|
1190
1464
|
});
|
|
1191
|
-
},
|
|
1465
|
+
}, Ze = {
|
|
1192
1466
|
message: "_message_1mgfk_1",
|
|
1193
1467
|
icon: "_icon_1mgfk_10",
|
|
1194
1468
|
title: "_title_1mgfk_15",
|
|
1195
1469
|
detail: "_detail_1mgfk_20",
|
|
1196
1470
|
technical: "_technical_1mgfk_25",
|
|
1197
1471
|
button: "_button_1mgfk_33"
|
|
1198
|
-
},
|
|
1472
|
+
}, Qe = {
|
|
1199
1473
|
unreachable: {
|
|
1200
|
-
icon:
|
|
1474
|
+
icon: H,
|
|
1201
1475
|
title: "Search is unavailable",
|
|
1202
1476
|
detail: "The search server canβt be reached right now."
|
|
1203
1477
|
},
|
|
1204
1478
|
unauthorized: {
|
|
1205
|
-
icon:
|
|
1479
|
+
icon: te,
|
|
1206
1480
|
title: "Search is unavailable",
|
|
1207
1481
|
detail: "The search key was not accepted."
|
|
1208
1482
|
},
|
|
1209
1483
|
forbidden: {
|
|
1210
|
-
icon:
|
|
1484
|
+
icon: K,
|
|
1211
1485
|
title: "Search is unavailable",
|
|
1212
1486
|
detail: "This search key doesnβt have access to these results."
|
|
1213
1487
|
},
|
|
1214
1488
|
notFound: {
|
|
1215
|
-
icon:
|
|
1489
|
+
icon: re,
|
|
1216
1490
|
title: "Nothing to search here",
|
|
1217
1491
|
detail: "The collection this page searches doesnβt exist."
|
|
1218
1492
|
},
|
|
1219
1493
|
notReady: {
|
|
1220
|
-
icon:
|
|
1494
|
+
icon: ee,
|
|
1221
1495
|
title: "Search is getting ready",
|
|
1222
1496
|
detail: "Results will appear in a moment."
|
|
1223
1497
|
},
|
|
1224
1498
|
unavailable: {
|
|
1225
|
-
icon:
|
|
1499
|
+
icon: q,
|
|
1226
1500
|
title: "Search is unavailable",
|
|
1227
1501
|
detail: "The collection canβt be searched right now."
|
|
1228
1502
|
},
|
|
1229
1503
|
rateLimited: {
|
|
1230
|
-
icon:
|
|
1504
|
+
icon: ie,
|
|
1231
1505
|
title: "Too many searches",
|
|
1232
1506
|
detail: "Wait a moment, then try again."
|
|
1233
1507
|
},
|
|
1234
1508
|
server: {
|
|
1235
|
-
icon:
|
|
1509
|
+
icon: q,
|
|
1236
1510
|
title: "Something went wrong",
|
|
1237
1511
|
detail: "The search server ran into a problem."
|
|
1238
1512
|
},
|
|
1239
1513
|
setup: {
|
|
1240
|
-
icon:
|
|
1514
|
+
icon: q,
|
|
1241
1515
|
title: "Search isnβt set up",
|
|
1242
1516
|
detail: "This page is missing part of its search setup."
|
|
1243
1517
|
},
|
|
1244
1518
|
unknown: {
|
|
1245
|
-
icon:
|
|
1519
|
+
icon: q,
|
|
1246
1520
|
title: "Something went wrong",
|
|
1247
1521
|
detail: "The search couldnβt be completed."
|
|
1248
1522
|
}
|
|
1249
|
-
},
|
|
1250
|
-
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];
|
|
1251
1525
|
o(() => {
|
|
1252
1526
|
if (e.kind !== "notReady" || !t) return;
|
|
1253
1527
|
let n = setTimeout(t, (e.retryAfterSeconds ?? 2) * 1e3);
|
|
@@ -1255,65 +1529,65 @@ var Re = {
|
|
|
1255
1529
|
}, [e, t]);
|
|
1256
1530
|
let s = e.retryable && e.kind !== "notReady" && t;
|
|
1257
1531
|
return /* @__PURE__ */ p("div", {
|
|
1258
|
-
className:
|
|
1532
|
+
className: Ze.message,
|
|
1259
1533
|
role: "alert",
|
|
1260
1534
|
children: [
|
|
1261
1535
|
/* @__PURE__ */ f("span", {
|
|
1262
|
-
className:
|
|
1536
|
+
className: Ze.icon,
|
|
1263
1537
|
children: /* @__PURE__ */ f(r, {
|
|
1264
1538
|
size: 70,
|
|
1265
1539
|
color: "var(--lv4)"
|
|
1266
1540
|
})
|
|
1267
1541
|
}),
|
|
1268
1542
|
/* @__PURE__ */ f("div", {
|
|
1269
|
-
className:
|
|
1543
|
+
className: Ze.title,
|
|
1270
1544
|
children: i
|
|
1271
1545
|
}),
|
|
1272
1546
|
/* @__PURE__ */ f("div", {
|
|
1273
|
-
className:
|
|
1547
|
+
className: Ze.detail,
|
|
1274
1548
|
children: a
|
|
1275
1549
|
}),
|
|
1276
1550
|
!n && /* @__PURE__ */ f("code", {
|
|
1277
|
-
className:
|
|
1551
|
+
className: Ze.technical,
|
|
1278
1552
|
children: e.technical
|
|
1279
1553
|
}),
|
|
1280
1554
|
s && /* @__PURE__ */ f(y, {
|
|
1281
1555
|
variant: "secondary",
|
|
1282
1556
|
size: "micro",
|
|
1283
|
-
className:
|
|
1557
|
+
className: Ze.button,
|
|
1284
1558
|
onClick: t,
|
|
1285
1559
|
children: "Try again"
|
|
1286
1560
|
})
|
|
1287
1561
|
]
|
|
1288
1562
|
});
|
|
1289
|
-
},
|
|
1563
|
+
}, et = {
|
|
1290
1564
|
placeholder: "_placeholder_1qr5o_1",
|
|
1291
1565
|
invalid: "_invalid_1qr5o_11",
|
|
1292
1566
|
searchedFor: "_searchedFor_1qr5o_17"
|
|
1293
|
-
},
|
|
1567
|
+
}, tt = {
|
|
1294
1568
|
row: "_row_11svi_1",
|
|
1295
1569
|
content: "_content_11svi_22",
|
|
1296
1570
|
indexNumber: "_indexNumber_11svi_36",
|
|
1297
1571
|
scoreNumber: "_scoreNumber_11svi_44",
|
|
1298
1572
|
skeletonBars: "_skeletonBars_11svi_53"
|
|
1299
|
-
},
|
|
1300
|
-
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,
|
|
1301
1575
|
children: [
|
|
1302
1576
|
t !== void 0 && /* @__PURE__ */ f("div", {
|
|
1303
|
-
className:
|
|
1577
|
+
className: tt.indexNumber,
|
|
1304
1578
|
children: t
|
|
1305
1579
|
}),
|
|
1306
1580
|
/* @__PURE__ */ f("div", {
|
|
1307
|
-
className:
|
|
1581
|
+
className: tt.content,
|
|
1308
1582
|
children: e ? /* @__PURE__ */ p("div", {
|
|
1309
|
-
className:
|
|
1310
|
-
children: [/* @__PURE__ */ f(
|
|
1583
|
+
className: tt.skeletonBars,
|
|
1584
|
+
children: [/* @__PURE__ */ f(N, {
|
|
1311
1585
|
level: 3,
|
|
1312
1586
|
height: 12,
|
|
1313
1587
|
width: `${o[0]}%`,
|
|
1314
1588
|
delay: a,
|
|
1315
1589
|
appear: !1
|
|
1316
|
-
}), /* @__PURE__ */ f(
|
|
1590
|
+
}), /* @__PURE__ */ f(N, {
|
|
1317
1591
|
level: 3,
|
|
1318
1592
|
height: 8,
|
|
1319
1593
|
width: `${o[1]}%`,
|
|
@@ -1323,14 +1597,14 @@ var Re = {
|
|
|
1323
1597
|
}) : i
|
|
1324
1598
|
}),
|
|
1325
1599
|
r && n !== void 0 && /* @__PURE__ */ f("div", {
|
|
1326
|
-
className:
|
|
1600
|
+
className: tt.scoreNumber,
|
|
1327
1601
|
children: n
|
|
1328
1602
|
})
|
|
1329
1603
|
]
|
|
1330
|
-
}),
|
|
1604
|
+
}), rt = {
|
|
1331
1605
|
wrapper: "_wrapper_f970z_6",
|
|
1332
1606
|
skeletonAppear: "_skeletonAppear_f970z_1"
|
|
1333
|
-
},
|
|
1607
|
+
}, it = [
|
|
1334
1608
|
[62, 38],
|
|
1335
1609
|
[75, 45],
|
|
1336
1610
|
[58, 33],
|
|
@@ -1339,28 +1613,28 @@ var Re = {
|
|
|
1339
1613
|
[55, 35],
|
|
1340
1614
|
[72, 40],
|
|
1341
1615
|
[60, 30]
|
|
1342
|
-
],
|
|
1343
|
-
className:
|
|
1344
|
-
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, {
|
|
1345
1619
|
skeleton: !0,
|
|
1346
1620
|
skeletonDelay: t * .1,
|
|
1347
|
-
skeletonWidths:
|
|
1621
|
+
skeletonWidths: it[t % it.length]
|
|
1348
1622
|
}, t))
|
|
1349
|
-
}),
|
|
1350
|
-
function
|
|
1623
|
+
}), ot = /^\[\s*(?:'[^']*'(?:\s*,\s*'[^']*')*)?\s*\]$/;
|
|
1624
|
+
function st(e) {
|
|
1351
1625
|
let t = e.trim();
|
|
1352
1626
|
if (!t.startsWith("[") || !t.endsWith("]")) return;
|
|
1353
1627
|
try {
|
|
1354
1628
|
let e = JSON.parse(t);
|
|
1355
1629
|
if (Array.isArray(e)) return e.map((e) => String(e));
|
|
1356
1630
|
} catch {}
|
|
1357
|
-
if (!
|
|
1631
|
+
if (!ot.test(t)) return;
|
|
1358
1632
|
let n = [], r = /'([^']*)'/g, i;
|
|
1359
1633
|
for (; (i = r.exec(t)) !== null;) n.push(i[1]);
|
|
1360
1634
|
return n;
|
|
1361
1635
|
}
|
|
1362
|
-
var
|
|
1363
|
-
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("");
|
|
1364
1638
|
o(() => {
|
|
1365
1639
|
let e = g !== N.current;
|
|
1366
1640
|
(!s || s.length < M.current || e) && j(k), M.current = s?.length ?? 0, N.current = g;
|
|
@@ -1369,35 +1643,35 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1369
1643
|
k,
|
|
1370
1644
|
g
|
|
1371
1645
|
]);
|
|
1372
|
-
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 && !r?.cutResults && s.length >= m.maxNumberOfRecordsToReturn && (!h || h === -1 || h > s.length), L = !!s && (P.length > A || I), R = () => {
|
|
1373
1647
|
let e = A + k;
|
|
1374
|
-
j(e), s && e >= s.length &&
|
|
1648
|
+
j(e), s && e >= s.length && I && T(s.length + k);
|
|
1375
1649
|
};
|
|
1376
|
-
if (b) return w ? /* @__PURE__ */ f(
|
|
1377
|
-
className:
|
|
1378
|
-
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, {
|
|
1379
1653
|
size: 200,
|
|
1380
1654
|
color: "var(--lv5)"
|
|
1381
1655
|
})
|
|
1382
1656
|
});
|
|
1383
|
-
let
|
|
1384
|
-
return
|
|
1657
|
+
let z = x ?? _;
|
|
1658
|
+
return z ? /* @__PURE__ */ f($e, {
|
|
1385
1659
|
error: (x ? S : v) ?? {
|
|
1386
1660
|
kind: "unknown",
|
|
1387
|
-
message:
|
|
1388
|
-
technical:
|
|
1661
|
+
message: z,
|
|
1662
|
+
technical: z,
|
|
1389
1663
|
retryable: !1
|
|
1390
1664
|
},
|
|
1391
1665
|
onRetry: C
|
|
1392
1666
|
}) : u || s === null ? /* @__PURE__ */ f("div", {
|
|
1393
|
-
className:
|
|
1394
|
-
children: /* @__PURE__ */ f(
|
|
1667
|
+
className: et.placeholder,
|
|
1668
|
+
children: /* @__PURE__ */ f(G, {
|
|
1395
1669
|
size: 200,
|
|
1396
1670
|
color: "var(--lv5)"
|
|
1397
1671
|
})
|
|
1398
1672
|
}) : P.length === 0 ? null : /* @__PURE__ */ p(d, { children: [
|
|
1399
1673
|
F && /* @__PURE__ */ p("div", {
|
|
1400
|
-
className:
|
|
1674
|
+
className: et.searchedFor,
|
|
1401
1675
|
"aria-live": "polite",
|
|
1402
1676
|
children: [/* @__PURE__ */ p("span", { children: ["Searching for ", /* @__PURE__ */ f("strong", { children: F })] }), O && /* @__PURE__ */ f(y, {
|
|
1403
1677
|
variant: "ghost",
|
|
@@ -1412,7 +1686,7 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1412
1686
|
c = typeof o == "string" ? JSON.parse(o) : o;
|
|
1413
1687
|
} catch {
|
|
1414
1688
|
return /* @__PURE__ */ f("div", {
|
|
1415
|
-
className:
|
|
1689
|
+
className: et.invalid,
|
|
1416
1690
|
children: /* @__PURE__ */ f("p", { children: "Invalid JSON" })
|
|
1417
1691
|
}, r);
|
|
1418
1692
|
}
|
|
@@ -1424,11 +1698,11 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1424
1698
|
if (n) for (let e in l) {
|
|
1425
1699
|
let t = l[e];
|
|
1426
1700
|
if (typeof t == "string") {
|
|
1427
|
-
let n =
|
|
1701
|
+
let n = st(t);
|
|
1428
1702
|
n && (l[e] = n);
|
|
1429
1703
|
}
|
|
1430
1704
|
}
|
|
1431
|
-
return /* @__PURE__ */ f(
|
|
1705
|
+
return /* @__PURE__ */ f(nt, {
|
|
1432
1706
|
index: r,
|
|
1433
1707
|
score: s,
|
|
1434
1708
|
showScore: i ?? m.showScore,
|
|
@@ -1438,7 +1712,7 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1438
1712
|
})
|
|
1439
1713
|
}, r);
|
|
1440
1714
|
}) }),
|
|
1441
|
-
|
|
1715
|
+
L && /* @__PURE__ */ f("div", {
|
|
1442
1716
|
style: {
|
|
1443
1717
|
textAlign: "center",
|
|
1444
1718
|
marginTop: "20px"
|
|
@@ -1446,23 +1720,23 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1446
1720
|
children: /* @__PURE__ */ f(y, {
|
|
1447
1721
|
variant: "secondary",
|
|
1448
1722
|
size: "micro",
|
|
1449
|
-
onClick:
|
|
1723
|
+
onClick: R,
|
|
1450
1724
|
children: g.trim() === "" ? "Load more" : h !== -1 && h !== void 0 && h > 0 ? `Load results ${A + 1}-${Math.min(A + k, s.length, h)} of ${h}` : "Load more"
|
|
1451
1725
|
})
|
|
1452
1726
|
})
|
|
1453
1727
|
] });
|
|
1454
|
-
},
|
|
1728
|
+
}, lt = {
|
|
1455
1729
|
row: "_row_ujwhc_1",
|
|
1456
1730
|
title: "_title_ujwhc_8"
|
|
1457
|
-
},
|
|
1458
|
-
className: [
|
|
1731
|
+
}, ut = ({ variant: e = "default", children: t }) => /* @__PURE__ */ f("div", {
|
|
1732
|
+
className: [lt.row, e === "title" ? lt.title : ""].filter(Boolean).join(" "),
|
|
1459
1733
|
children: t
|
|
1460
|
-
}),
|
|
1734
|
+
}), dt = {
|
|
1461
1735
|
listRows: "_listRows_13obt_2",
|
|
1462
1736
|
sliderArea: "_sliderArea_13obt_8",
|
|
1463
1737
|
inputRow: "_inputRow_13obt_15",
|
|
1464
1738
|
histogramRow: "_histogramRow_13obt_22"
|
|
1465
|
-
},
|
|
1739
|
+
}, ft = [
|
|
1466
1740
|
65,
|
|
1467
1741
|
80,
|
|
1468
1742
|
55,
|
|
@@ -1471,22 +1745,22 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1471
1745
|
75,
|
|
1472
1746
|
50,
|
|
1473
1747
|
68
|
|
1474
|
-
],
|
|
1748
|
+
], pt = ({ title: e, rows: t = 5, variant: n = "list", withHistogram: r = !1, collapsible: i = !0, startCollapsed: a = !1 }) => /* @__PURE__ */ f(T, {
|
|
1475
1749
|
title: e,
|
|
1476
1750
|
collapsible: i,
|
|
1477
1751
|
collapsed: a,
|
|
1478
1752
|
children: n === "slider" ? /* @__PURE__ */ p("div", {
|
|
1479
|
-
className:
|
|
1753
|
+
className: dt.sliderArea,
|
|
1480
1754
|
children: [
|
|
1481
|
-
r && /* @__PURE__ */ f("div", { className:
|
|
1482
|
-
/* @__PURE__ */ f(
|
|
1755
|
+
r && /* @__PURE__ */ f("div", { className: dt.histogramRow }),
|
|
1756
|
+
/* @__PURE__ */ f(N, { height: 6 }),
|
|
1483
1757
|
/* @__PURE__ */ p("div", {
|
|
1484
|
-
className:
|
|
1485
|
-
children: [/* @__PURE__ */ f(
|
|
1758
|
+
className: dt.inputRow,
|
|
1759
|
+
children: [/* @__PURE__ */ f(N, {
|
|
1486
1760
|
width: 40,
|
|
1487
1761
|
height: 20,
|
|
1488
1762
|
delay: .1
|
|
1489
|
-
}), /* @__PURE__ */ f(
|
|
1763
|
+
}), /* @__PURE__ */ f(N, {
|
|
1490
1764
|
width: 40,
|
|
1491
1765
|
height: 20,
|
|
1492
1766
|
delay: .15
|
|
@@ -1494,13 +1768,13 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1494
1768
|
})
|
|
1495
1769
|
]
|
|
1496
1770
|
}) : /* @__PURE__ */ f("div", {
|
|
1497
|
-
className:
|
|
1498
|
-
children: Array.from({ length: t }).map((e, t) => /* @__PURE__ */ f(
|
|
1499
|
-
width: `${
|
|
1771
|
+
className: dt.listRows,
|
|
1772
|
+
children: Array.from({ length: t }).map((e, t) => /* @__PURE__ */ f(N, {
|
|
1773
|
+
width: `${ft[t % ft.length]}%`,
|
|
1500
1774
|
delay: t * .05
|
|
1501
1775
|
}, t))
|
|
1502
1776
|
})
|
|
1503
|
-
}),
|
|
1777
|
+
}), Z = {
|
|
1504
1778
|
list: "_list_18vbb_2",
|
|
1505
1779
|
count: "_count_18vbb_7",
|
|
1506
1780
|
countValue: "_countValue_18vbb_17",
|
|
@@ -1508,10 +1782,10 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1508
1782
|
chipLabel: "_chipLabel_18vbb_32",
|
|
1509
1783
|
grid: "_grid_18vbb_40",
|
|
1510
1784
|
active: "_active_18vbb_54"
|
|
1511
|
-
},
|
|
1785
|
+
}, mt = {
|
|
1512
1786
|
notice: "_notice_4sel0_1",
|
|
1513
1787
|
technical: "_technical_4sel0_9"
|
|
1514
|
-
},
|
|
1788
|
+
}, ht = ({ label: e, field: t, missing: n }) => {
|
|
1515
1789
|
let r = n.map((e) => e[0].toUpperCase() + e.slice(1)).join(" and ");
|
|
1516
1790
|
return o(() => {
|
|
1517
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).`);
|
|
@@ -1519,9 +1793,9 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1519
1793
|
title: e ?? t,
|
|
1520
1794
|
collapsible: !1,
|
|
1521
1795
|
children: /* @__PURE__ */ p("div", {
|
|
1522
|
-
className:
|
|
1796
|
+
className: mt.notice,
|
|
1523
1797
|
children: [/* @__PURE__ */ f("span", { children: "Not available" }), /* @__PURE__ */ p("code", {
|
|
1524
|
-
className:
|
|
1798
|
+
className: mt.technical,
|
|
1525
1799
|
children: [
|
|
1526
1800
|
t,
|
|
1527
1801
|
": not ",
|
|
@@ -1530,8 +1804,8 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1530
1804
|
})]
|
|
1531
1805
|
})
|
|
1532
1806
|
});
|
|
1533
|
-
},
|
|
1534
|
-
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;
|
|
1535
1809
|
o(() => {
|
|
1536
1810
|
M(e, R);
|
|
1537
1811
|
}, [
|
|
@@ -1542,11 +1816,11 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1542
1816
|
let z = c(null), [B, V] = l(a);
|
|
1543
1817
|
if (o(() => {
|
|
1544
1818
|
V(a);
|
|
1545
|
-
}, [w?.[e], a]), !
|
|
1546
|
-
if (
|
|
1819
|
+
}, [w?.[e], a]), !F && !A || N) return null;
|
|
1820
|
+
if (P || !w) return L === "toggle" ? /* @__PURE__ */ f(pt, {
|
|
1547
1821
|
rows: 1,
|
|
1548
1822
|
collapsible: !1
|
|
1549
|
-
}) : /* @__PURE__ */ f(
|
|
1823
|
+
}) : /* @__PURE__ */ f(pt, {
|
|
1550
1824
|
title: t,
|
|
1551
1825
|
rows: Math.min(a, 6),
|
|
1552
1826
|
collapsible: s,
|
|
@@ -1554,12 +1828,12 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1554
1828
|
});
|
|
1555
1829
|
if (!C({
|
|
1556
1830
|
query: A ?? "",
|
|
1557
|
-
filters:
|
|
1831
|
+
filters: O,
|
|
1558
1832
|
facets: w
|
|
1559
|
-
}) || !S && !A && Object.keys(
|
|
1833
|
+
}) || !S && !A && Object.keys(O).length < 1) return null;
|
|
1560
1834
|
if (!E?.includes(e) || !D?.includes(e)) {
|
|
1561
1835
|
let n = [];
|
|
1562
|
-
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, {
|
|
1563
1837
|
label: t,
|
|
1564
1838
|
field: e,
|
|
1565
1839
|
missing: n
|
|
@@ -1567,7 +1841,7 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1567
1841
|
}
|
|
1568
1842
|
let H = w?.[e] ?? (L === "toggle" ? [] : void 0);
|
|
1569
1843
|
if (!H || !Array.isArray(H)) return null;
|
|
1570
|
-
let U =
|
|
1844
|
+
let U = O?.[e] ?? [];
|
|
1571
1845
|
n && !z.current && H.length > 0 && (z.current = H.reduce((e, t) => (e[t.key] = t.value, e), {}));
|
|
1572
1846
|
let W = /* @__PURE__ */ new Map();
|
|
1573
1847
|
n && z.current && Object.keys(z.current).forEach((e) => {
|
|
@@ -1587,8 +1861,8 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1587
1861
|
if (L === "toggle" && !te) return /* @__PURE__ */ f(T, {
|
|
1588
1862
|
collapsible: !1,
|
|
1589
1863
|
children: /* @__PURE__ */ f("div", {
|
|
1590
|
-
className:
|
|
1591
|
-
children: /* @__PURE__ */ f(
|
|
1864
|
+
className: Z.count,
|
|
1865
|
+
children: /* @__PURE__ */ f(I, {
|
|
1592
1866
|
label: t,
|
|
1593
1867
|
checked: !1,
|
|
1594
1868
|
onChange: () => {},
|
|
@@ -1601,9 +1875,9 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1601
1875
|
return /* @__PURE__ */ f(T, {
|
|
1602
1876
|
collapsible: !1,
|
|
1603
1877
|
children: /* @__PURE__ */ p("div", {
|
|
1604
|
-
className:
|
|
1878
|
+
className: Z.count,
|
|
1605
1879
|
children: [
|
|
1606
|
-
/* @__PURE__ */ f(
|
|
1880
|
+
/* @__PURE__ */ f(I, {
|
|
1607
1881
|
label: t,
|
|
1608
1882
|
checked: i,
|
|
1609
1883
|
onChange: () => j(e, "true"),
|
|
@@ -1636,20 +1910,20 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1636
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");
|
|
1637
1911
|
switch (L) {
|
|
1638
1912
|
case "button": return h === "list" ? /* @__PURE__ */ p("div", {
|
|
1639
|
-
className:
|
|
1913
|
+
className: Z.count,
|
|
1640
1914
|
children: [/* @__PURE__ */ f(y, {
|
|
1641
1915
|
variant: r ? "primary" : "secondary",
|
|
1642
1916
|
onClick: s,
|
|
1643
1917
|
disabled: i,
|
|
1644
1918
|
size: "micro",
|
|
1645
|
-
className:
|
|
1919
|
+
className: Z.chip,
|
|
1646
1920
|
title: t,
|
|
1647
1921
|
children: /* @__PURE__ */ f("span", {
|
|
1648
|
-
className:
|
|
1922
|
+
className: Z.chipLabel,
|
|
1649
1923
|
children: t
|
|
1650
1924
|
})
|
|
1651
1925
|
}), /* @__PURE__ */ f("span", {
|
|
1652
|
-
className:
|
|
1926
|
+
className: Z.countValue,
|
|
1653
1927
|
children: o
|
|
1654
1928
|
})]
|
|
1655
1929
|
}) : /* @__PURE__ */ f(y, {
|
|
@@ -1657,21 +1931,21 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1657
1931
|
onClick: s,
|
|
1658
1932
|
disabled: i,
|
|
1659
1933
|
size: "micro",
|
|
1660
|
-
className:
|
|
1934
|
+
className: Z.chip,
|
|
1661
1935
|
title: `${t}${a}`,
|
|
1662
1936
|
children: /* @__PURE__ */ f("span", {
|
|
1663
|
-
className:
|
|
1937
|
+
className: Z.chipLabel,
|
|
1664
1938
|
children: `${t}${a}`
|
|
1665
1939
|
})
|
|
1666
1940
|
});
|
|
1667
|
-
case "toggle": return /* @__PURE__ */ f(
|
|
1941
|
+
case "toggle": return /* @__PURE__ */ f(I, {
|
|
1668
1942
|
label: t,
|
|
1669
1943
|
checked: r,
|
|
1670
1944
|
onChange: s,
|
|
1671
1945
|
disabled: i
|
|
1672
1946
|
});
|
|
1673
1947
|
case "radio": {
|
|
1674
|
-
let n = /* @__PURE__ */ f(
|
|
1948
|
+
let n = /* @__PURE__ */ f(k, {
|
|
1675
1949
|
id: `${e}-${t}`,
|
|
1676
1950
|
name: e,
|
|
1677
1951
|
value: t,
|
|
@@ -1681,15 +1955,15 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1681
1955
|
disabled: i
|
|
1682
1956
|
});
|
|
1683
1957
|
return h === "list" ? /* @__PURE__ */ p("div", {
|
|
1684
|
-
className:
|
|
1958
|
+
className: Z.count,
|
|
1685
1959
|
children: [n, /* @__PURE__ */ f("span", {
|
|
1686
|
-
className:
|
|
1960
|
+
className: Z.countValue,
|
|
1687
1961
|
children: o
|
|
1688
1962
|
})]
|
|
1689
1963
|
}) : n;
|
|
1690
1964
|
}
|
|
1691
1965
|
default: return h === "list" ? /* @__PURE__ */ p("div", {
|
|
1692
|
-
className:
|
|
1966
|
+
className: Z.count,
|
|
1693
1967
|
children: [/* @__PURE__ */ f(b, {
|
|
1694
1968
|
label: t,
|
|
1695
1969
|
score: "",
|
|
@@ -1697,7 +1971,7 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1697
1971
|
onChange: s,
|
|
1698
1972
|
disabled: i
|
|
1699
1973
|
}), /* @__PURE__ */ f("span", {
|
|
1700
|
-
className:
|
|
1974
|
+
className: Z.countValue,
|
|
1701
1975
|
children: o
|
|
1702
1976
|
})]
|
|
1703
1977
|
}) : /* @__PURE__ */ f(b, {
|
|
@@ -1713,9 +1987,9 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1713
1987
|
title: t,
|
|
1714
1988
|
collapsible: s,
|
|
1715
1989
|
collapsed: s ? u : !1,
|
|
1716
|
-
className: g && U.length > 0 ?
|
|
1990
|
+
className: g && U.length > 0 ? Z.active : void 0,
|
|
1717
1991
|
children: /* @__PURE__ */ p("ul", {
|
|
1718
|
-
className: h === "grid" ?
|
|
1992
|
+
className: h === "grid" ? Z.grid : Z.list,
|
|
1719
1993
|
style: {
|
|
1720
1994
|
listStyle: "none",
|
|
1721
1995
|
padding: 0,
|
|
@@ -1724,7 +1998,7 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1724
1998
|
children: [re.map(([e, t]) => /* @__PURE__ */ f("li", { children: ie(e, t) }, e)), ne && B < K.length && (() => {
|
|
1725
1999
|
let e = K.length - B, t = Math.min(50, e);
|
|
1726
2000
|
return /* @__PURE__ */ f("li", {
|
|
1727
|
-
className:
|
|
2001
|
+
className: Z.toggleItem,
|
|
1728
2002
|
children: /* @__PURE__ */ f(y, {
|
|
1729
2003
|
variant: "ghost",
|
|
1730
2004
|
size: "micro",
|
|
@@ -1735,7 +2009,7 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1735
2009
|
})()]
|
|
1736
2010
|
})
|
|
1737
2011
|
});
|
|
1738
|
-
},
|
|
2012
|
+
}, Q = {
|
|
1739
2013
|
disabledMessage: "_disabledMessage_adany_1",
|
|
1740
2014
|
histogram: "_histogram_adany_6",
|
|
1741
2015
|
histogramLayer: "_histogramLayer_adany_14",
|
|
@@ -1748,36 +2022,36 @@ var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1748
2022
|
active: "_active_adany_76"
|
|
1749
2023
|
};
|
|
1750
2024
|
// src/utils/numeric.ts
|
|
1751
|
-
function
|
|
2025
|
+
function _t(e) {
|
|
1752
2026
|
if (!Number.isFinite(e)) return 0;
|
|
1753
2027
|
let t = String(e), n = t.indexOf(".");
|
|
1754
2028
|
return n === -1 ? 0 : Math.min(6, t.length - n - 1);
|
|
1755
2029
|
}
|
|
1756
|
-
function
|
|
2030
|
+
function vt(e) {
|
|
1757
2031
|
let t = 0;
|
|
1758
|
-
for (let n of e) t = Math.max(t,
|
|
2032
|
+
for (let n of e) t = Math.max(t, _t(n));
|
|
1759
2033
|
return t === 0 ? 1 : Number((10 ** -t).toFixed(t));
|
|
1760
2034
|
}
|
|
1761
|
-
function
|
|
1762
|
-
return Number(e.toFixed(
|
|
2035
|
+
function yt(e, t) {
|
|
2036
|
+
return Number(e.toFixed(_t(t)));
|
|
1763
2037
|
}
|
|
1764
2038
|
// src/components/RangeFilterPanel.tsx
|
|
1765
|
-
function
|
|
2039
|
+
function bt(e, t, n) {
|
|
1766
2040
|
let r = t + Math.round((e - t) / n) * n;
|
|
1767
|
-
return Number(r.toFixed(
|
|
2041
|
+
return Number(r.toFixed(_t(n)));
|
|
1768
2042
|
}
|
|
1769
|
-
function
|
|
2043
|
+
function xt(e, t, n) {
|
|
1770
2044
|
let r = Math.ceil(Number(((e - t) / n).toFixed(6)));
|
|
1771
|
-
return Number((t + r * n).toFixed(
|
|
2045
|
+
return Number((t + r * n).toFixed(_t(n)));
|
|
1772
2046
|
}
|
|
1773
|
-
var
|
|
1774
|
-
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] ?? {
|
|
1775
2049
|
min: r,
|
|
1776
2050
|
max: i
|
|
1777
|
-
}, 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(() => {
|
|
1778
2052
|
if (m) return m;
|
|
1779
|
-
let e = Math.max(
|
|
1780
|
-
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)));
|
|
1781
2055
|
return e === 0 ? 1 : Number((10 ** -e).toFixed(e));
|
|
1782
2056
|
}, [
|
|
1783
2057
|
m,
|
|
@@ -1785,20 +2059,20 @@ var ut = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
1785
2059
|
I,
|
|
1786
2060
|
y,
|
|
1787
2061
|
t
|
|
1788
|
-
]), V =
|
|
1789
|
-
let e =
|
|
1790
|
-
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)` };
|
|
1791
2065
|
}, [
|
|
1792
2066
|
B,
|
|
1793
2067
|
F,
|
|
1794
2068
|
I,
|
|
1795
|
-
|
|
1796
|
-
|
|
2069
|
+
se,
|
|
2070
|
+
le
|
|
1797
2071
|
]);
|
|
1798
2072
|
e.useEffect(() => {
|
|
1799
|
-
|
|
2073
|
+
ce(String(q[0])), ue(String(q[1]));
|
|
1800
2074
|
}, [q]);
|
|
1801
|
-
let { finalMin:
|
|
2075
|
+
let { finalMin: fe, finalMax: pe, isValidMin: me, isValidMax: he } = e.useMemo(() => {
|
|
1802
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);
|
|
1803
2077
|
return {
|
|
1804
2078
|
finalMin: i,
|
|
@@ -1814,22 +2088,22 @@ var ut = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
1814
2088
|
e.useEffect(() => {
|
|
1815
2089
|
if (V) return;
|
|
1816
2090
|
if (q[0] === F && q[1] === I) {
|
|
1817
|
-
|
|
2091
|
+
X(!1), oe(!1);
|
|
1818
2092
|
return;
|
|
1819
2093
|
}
|
|
1820
2094
|
let e = C ?? 500, n = setTimeout(() => {
|
|
1821
|
-
|
|
2095
|
+
X(!me), oe(!he);
|
|
1822
2096
|
}, 300), r = setTimeout(() => {
|
|
1823
|
-
|
|
2097
|
+
me && he && (fe === F && pe === I ? D(t, !1) : w(t, fe, pe));
|
|
1824
2098
|
}, e);
|
|
1825
2099
|
return () => {
|
|
1826
2100
|
clearTimeout(n), clearTimeout(r);
|
|
1827
2101
|
};
|
|
1828
2102
|
}, [
|
|
2103
|
+
fe,
|
|
2104
|
+
pe,
|
|
1829
2105
|
me,
|
|
1830
2106
|
he,
|
|
1831
|
-
ge,
|
|
1832
|
-
_e,
|
|
1833
2107
|
F,
|
|
1834
2108
|
I,
|
|
1835
2109
|
t,
|
|
@@ -1838,48 +2112,48 @@ var ut = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
1838
2112
|
C,
|
|
1839
2113
|
V
|
|
1840
2114
|
]), e.useEffect(() => {
|
|
1841
|
-
J([K, ne]),
|
|
2115
|
+
J([K, ne]), X(!1), oe(!1);
|
|
1842
2116
|
}, [
|
|
1843
2117
|
K,
|
|
1844
2118
|
ne,
|
|
1845
2119
|
t
|
|
1846
2120
|
]);
|
|
1847
|
-
let
|
|
1848
|
-
let t =
|
|
1849
|
-
return [t,
|
|
1850
|
-
}, [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) => {
|
|
1851
2125
|
if (V) return;
|
|
1852
|
-
let [t, n] =
|
|
2126
|
+
let [t, n] = ge(e);
|
|
1853
2127
|
J([Math.max(F, Math.min(z, t)), Math.max(R, Math.min(I, n))]);
|
|
1854
2128
|
}, [
|
|
1855
2129
|
V,
|
|
1856
|
-
|
|
2130
|
+
ge,
|
|
1857
2131
|
F,
|
|
1858
2132
|
I,
|
|
1859
2133
|
R,
|
|
1860
2134
|
z
|
|
1861
|
-
]),
|
|
2135
|
+
]), ye = e.useCallback((e) => {
|
|
1862
2136
|
if (V) return;
|
|
1863
|
-
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));
|
|
1864
2138
|
i === F && a === I ? (J([F, I]), D(t, !0)) : J([i, a]);
|
|
1865
2139
|
}, [
|
|
1866
2140
|
V,
|
|
1867
|
-
|
|
2141
|
+
ge,
|
|
1868
2142
|
F,
|
|
1869
2143
|
I,
|
|
1870
2144
|
R,
|
|
1871
2145
|
z,
|
|
1872
2146
|
t,
|
|
1873
2147
|
D
|
|
1874
|
-
]),
|
|
2148
|
+
]), be = e.useRef(null), xe = e.useCallback((e, n) => {
|
|
1875
2149
|
if (V) return;
|
|
1876
|
-
let r =
|
|
2150
|
+
let r = be.current;
|
|
1877
2151
|
if (G && r && r.start === e && r.last === n) {
|
|
1878
|
-
|
|
2152
|
+
be.current = null, J([F, I]), D(t, !0);
|
|
1879
2153
|
return;
|
|
1880
2154
|
}
|
|
1881
|
-
let i =
|
|
1882
|
-
|
|
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 = {
|
|
1883
2157
|
start: e,
|
|
1884
2158
|
last: n
|
|
1885
2159
|
}, J([i, a]);
|
|
@@ -1893,50 +2167,50 @@ var ut = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
1893
2167
|
B,
|
|
1894
2168
|
t,
|
|
1895
2169
|
D
|
|
1896
|
-
]),
|
|
2170
|
+
]), Se = e.useCallback(() => {
|
|
1897
2171
|
if (V) return;
|
|
1898
|
-
let e =
|
|
2172
|
+
let e = se.trim(), t = e === "" ? NaN : Number(e);
|
|
1899
2173
|
if (isNaN(t)) {
|
|
1900
|
-
|
|
2174
|
+
ce(String(q[0]));
|
|
1901
2175
|
return;
|
|
1902
2176
|
}
|
|
1903
2177
|
let n = Math.max(F, Math.min(z, t));
|
|
1904
|
-
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));
|
|
1905
2179
|
}, [
|
|
1906
2180
|
V,
|
|
1907
|
-
|
|
2181
|
+
se,
|
|
1908
2182
|
q,
|
|
1909
2183
|
F,
|
|
1910
2184
|
z
|
|
1911
|
-
]),
|
|
2185
|
+
]), Ce = e.useCallback(() => {
|
|
1912
2186
|
if (V) return;
|
|
1913
|
-
let e =
|
|
2187
|
+
let e = le.trim(), t = e === "" ? NaN : Number(e);
|
|
1914
2188
|
if (isNaN(t)) {
|
|
1915
|
-
|
|
2189
|
+
ue(String(q[1]));
|
|
1916
2190
|
return;
|
|
1917
2191
|
}
|
|
1918
2192
|
let n = Math.max(R, Math.min(I, t));
|
|
1919
|
-
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));
|
|
1920
2194
|
}, [
|
|
1921
2195
|
V,
|
|
1922
|
-
|
|
2196
|
+
le,
|
|
1923
2197
|
q,
|
|
1924
2198
|
R,
|
|
1925
2199
|
I
|
|
1926
|
-
]),
|
|
2200
|
+
]), we = (e) => (t) => {
|
|
1927
2201
|
t.key === "Enter" && e();
|
|
1928
|
-
}, [
|
|
2202
|
+
}, [Te, Ee] = e.useState(null), De = e.useRef(null);
|
|
1929
2203
|
e.useEffect(() => {
|
|
1930
2204
|
if (!u) return;
|
|
1931
2205
|
let e = `${F}:${I}`;
|
|
1932
|
-
if (e ===
|
|
2206
|
+
if (e === De.current && De.current !== null) return;
|
|
1933
2207
|
let n = y?.[t];
|
|
1934
2208
|
if (!Array.isArray(n) || n.length === 0) return;
|
|
1935
2209
|
let r = n.filter((e) => e.value != null && !isNaN(Number(e.key))).map((e) => ({
|
|
1936
2210
|
key: e.key,
|
|
1937
2211
|
value: e.value
|
|
1938
2212
|
}));
|
|
1939
|
-
r.length > 0 && (
|
|
2213
|
+
r.length > 0 && (De.current = e, Ee(r));
|
|
1940
2214
|
}, [
|
|
1941
2215
|
F,
|
|
1942
2216
|
I,
|
|
@@ -1944,22 +2218,22 @@ var ut = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
1944
2218
|
t,
|
|
1945
2219
|
u
|
|
1946
2220
|
]);
|
|
1947
|
-
let
|
|
1948
|
-
if (!u || !
|
|
2221
|
+
let Oe = e.useMemo(() => {
|
|
2222
|
+
if (!u || !Te || Te.length === 0) return [];
|
|
1949
2223
|
let e = I - F;
|
|
1950
2224
|
if (e <= 0) return [];
|
|
1951
|
-
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);
|
|
1952
2226
|
return Array.from({ length: n }, (e, r) => {
|
|
1953
|
-
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) => {
|
|
1954
2228
|
let t = Number(e.key);
|
|
1955
2229
|
return t >= i && (t < a || o && t <= I);
|
|
1956
|
-
}).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);
|
|
1957
2231
|
return {
|
|
1958
2232
|
bucketStart: i,
|
|
1959
2233
|
bucketEnd: a,
|
|
1960
2234
|
count: s,
|
|
1961
2235
|
last: c,
|
|
1962
|
-
barEnd:
|
|
2236
|
+
barEnd: yt(c + B, B)
|
|
1963
2237
|
};
|
|
1964
2238
|
}).map((e, t, n) => ({
|
|
1965
2239
|
...e,
|
|
@@ -1967,14 +2241,14 @@ var ut = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
1967
2241
|
}));
|
|
1968
2242
|
}, [
|
|
1969
2243
|
u,
|
|
1970
|
-
|
|
2244
|
+
Te,
|
|
1971
2245
|
F,
|
|
1972
2246
|
I,
|
|
1973
2247
|
d,
|
|
1974
2248
|
B,
|
|
1975
2249
|
W
|
|
1976
|
-
]),
|
|
1977
|
-
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, {
|
|
1978
2252
|
title: n,
|
|
1979
2253
|
variant: "slider",
|
|
1980
2254
|
withHistogram: u,
|
|
@@ -1987,72 +2261,72 @@ var ut = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
1987
2261
|
className: te,
|
|
1988
2262
|
children: [
|
|
1989
2263
|
V && /* @__PURE__ */ p("div", {
|
|
1990
|
-
className:
|
|
2264
|
+
className: Q.disabledMessage,
|
|
1991
2265
|
children: [
|
|
1992
2266
|
"No adjustable range (all results have the same value: ",
|
|
1993
2267
|
F,
|
|
1994
2268
|
")."
|
|
1995
2269
|
]
|
|
1996
2270
|
}),
|
|
1997
|
-
u &&
|
|
1998
|
-
u &&
|
|
1999
|
-
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) => ({
|
|
2000
2274
|
...e,
|
|
2001
|
-
height: Math.max(1, Math.ceil(e.count /
|
|
2275
|
+
height: Math.max(1, Math.ceil(e.count / ke * 20))
|
|
2002
2276
|
}));
|
|
2003
2277
|
return /* @__PURE__ */ p("div", {
|
|
2004
|
-
className:
|
|
2278
|
+
className: Q.histogram,
|
|
2005
2279
|
children: [
|
|
2006
2280
|
/* @__PURE__ */ f("div", {
|
|
2007
|
-
className:
|
|
2281
|
+
className: Q.histogramLayer,
|
|
2008
2282
|
children: _.map((e, t) => /* @__PURE__ */ f("button", {
|
|
2009
2283
|
type: "button",
|
|
2010
|
-
className:
|
|
2284
|
+
className: Q.histogramBar,
|
|
2011
2285
|
style: { flexGrow: e.span },
|
|
2012
2286
|
"data-testid": "histogram-bar",
|
|
2013
2287
|
disabled: V || h(e),
|
|
2014
2288
|
"aria-label": `${e.bucketStart} to ${e.last}: ${e.count}`,
|
|
2015
2289
|
title: `${e.bucketStart} to ${e.last}: ${e.count}`,
|
|
2016
|
-
onClick: () =>
|
|
2290
|
+
onClick: () => xe(e.bucketStart, e.last),
|
|
2017
2291
|
children: /* @__PURE__ */ f("span", {
|
|
2018
|
-
className:
|
|
2292
|
+
className: Q.histogramFill,
|
|
2019
2293
|
style: { height: `${e.height}px` }
|
|
2020
2294
|
})
|
|
2021
2295
|
}, t))
|
|
2022
2296
|
}),
|
|
2023
2297
|
/* @__PURE__ */ f("div", {
|
|
2024
|
-
className: `${
|
|
2298
|
+
className: `${Q.histogramLayer} ${Q.histogramLive}`,
|
|
2025
2299
|
"aria-hidden": "true",
|
|
2026
2300
|
"data-testid": "histogram-live",
|
|
2027
2301
|
style: { clipPath: m },
|
|
2028
2302
|
children: _.map((e, t) => /* @__PURE__ */ f("span", {
|
|
2029
|
-
className:
|
|
2303
|
+
className: Q.histogramBar,
|
|
2030
2304
|
style: { flexGrow: e.span },
|
|
2031
2305
|
children: /* @__PURE__ */ f("span", {
|
|
2032
|
-
className:
|
|
2306
|
+
className: Q.histogramFill,
|
|
2033
2307
|
style: { height: `${e.height}px` }
|
|
2034
2308
|
})
|
|
2035
2309
|
}, t))
|
|
2036
2310
|
}),
|
|
2037
2311
|
/* @__PURE__ */ f("div", {
|
|
2038
|
-
className: `${
|
|
2312
|
+
className: `${Q.histogramLayer} ${Q.histogramLit}`,
|
|
2039
2313
|
"aria-hidden": "true",
|
|
2040
2314
|
"data-testid": "histogram-lit",
|
|
2041
2315
|
style: { clipPath: d },
|
|
2042
2316
|
children: _.map((e, t) => /* @__PURE__ */ f("span", {
|
|
2043
|
-
className:
|
|
2317
|
+
className: Q.histogramBar,
|
|
2044
2318
|
style: { flexGrow: e.span },
|
|
2045
2319
|
children: /* @__PURE__ */ f("span", {
|
|
2046
|
-
className:
|
|
2320
|
+
className: Q.histogramFill,
|
|
2047
2321
|
style: { height: `${e.height}px` }
|
|
2048
2322
|
})
|
|
2049
2323
|
}, t))
|
|
2050
2324
|
}),
|
|
2051
2325
|
/* @__PURE__ */ f("div", {
|
|
2052
|
-
className:
|
|
2326
|
+
className: Q.histogramSeparators,
|
|
2053
2327
|
"aria-hidden": "true",
|
|
2054
2328
|
children: g.map((e, t) => /* @__PURE__ */ f("span", {
|
|
2055
|
-
className:
|
|
2329
|
+
className: Q.histogramSeparator,
|
|
2056
2330
|
style: { left: e }
|
|
2057
2331
|
}, t))
|
|
2058
2332
|
})
|
|
@@ -2061,18 +2335,18 @@ var ut = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
2061
2335
|
})(),
|
|
2062
2336
|
/* @__PURE__ */ f("div", {
|
|
2063
2337
|
style: { padding: "10px 10px 20px 10px" },
|
|
2064
|
-
children: /* @__PURE__ */ f(
|
|
2338
|
+
children: /* @__PURE__ */ f(P, {
|
|
2065
2339
|
min: H,
|
|
2066
2340
|
max: W,
|
|
2067
2341
|
step: B,
|
|
2068
2342
|
stepMarks: h,
|
|
2069
|
-
value: V ? [H, W] : [ee(
|
|
2343
|
+
value: V ? [H, W] : [ee(bt(fe, H, B)), ee(bt(pe + B, H, B))],
|
|
2070
2344
|
isRange: !0,
|
|
2071
|
-
onChange: (e) =>
|
|
2072
|
-
onFinalChange: (e) =>
|
|
2345
|
+
onChange: (e) => ve(e),
|
|
2346
|
+
onFinalChange: (e) => ye(e),
|
|
2073
2347
|
disabled: V,
|
|
2074
2348
|
activeMin: R,
|
|
2075
|
-
activeMax: ee(
|
|
2349
|
+
activeMax: ee(yt(z + B, B)),
|
|
2076
2350
|
isFaceted: ie,
|
|
2077
2351
|
highlightFaceted: re,
|
|
2078
2352
|
"aria-label": n || `Filter by ${t}`
|
|
@@ -2088,27 +2362,27 @@ var ut = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
2088
2362
|
children: [/* @__PURE__ */ f(E, {
|
|
2089
2363
|
label: "Min:",
|
|
2090
2364
|
type: "number",
|
|
2091
|
-
style:
|
|
2092
|
-
value: V ? String(F) :
|
|
2365
|
+
style: de,
|
|
2366
|
+
value: V ? String(F) : se,
|
|
2093
2367
|
min: F,
|
|
2094
|
-
max:
|
|
2095
|
-
onChange: (e) =>
|
|
2096
|
-
onBlur:
|
|
2097
|
-
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),
|
|
2098
2372
|
disabled: V,
|
|
2099
|
-
isValid: V || !
|
|
2373
|
+
isValid: V || !Y
|
|
2100
2374
|
}), /* @__PURE__ */ f(E, {
|
|
2101
2375
|
label: "Max:",
|
|
2102
2376
|
type: "number",
|
|
2103
|
-
style:
|
|
2104
|
-
value: V ? String(I) :
|
|
2105
|
-
min:
|
|
2377
|
+
style: de,
|
|
2378
|
+
value: V ? String(I) : le,
|
|
2379
|
+
min: yt(Math.max(R, q[0] + B), B),
|
|
2106
2380
|
max: I,
|
|
2107
|
-
onChange: (e) =>
|
|
2108
|
-
onBlur:
|
|
2109
|
-
onKeyDown:
|
|
2381
|
+
onChange: (e) => ue(e.target.value),
|
|
2382
|
+
onBlur: Ce,
|
|
2383
|
+
onKeyDown: we(Ce),
|
|
2110
2384
|
disabled: V,
|
|
2111
|
-
isValid: V || !
|
|
2385
|
+
isValid: V || !ae
|
|
2112
2386
|
})]
|
|
2113
2387
|
})
|
|
2114
2388
|
]
|
|
@@ -2116,7 +2390,7 @@ var ut = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
2116
2390
|
title: n,
|
|
2117
2391
|
className: te,
|
|
2118
2392
|
children: [V && /* @__PURE__ */ p("div", {
|
|
2119
|
-
className:
|
|
2393
|
+
className: Q.disabledMessage,
|
|
2120
2394
|
children: [
|
|
2121
2395
|
"No adjustable range (all results have the same value: ",
|
|
2122
2396
|
F,
|
|
@@ -2131,35 +2405,35 @@ var ut = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
2131
2405
|
children: [/* @__PURE__ */ f(E, {
|
|
2132
2406
|
label: "Min:",
|
|
2133
2407
|
type: "number",
|
|
2134
|
-
style:
|
|
2135
|
-
value: V ? String(F) :
|
|
2408
|
+
style: de,
|
|
2409
|
+
value: V ? String(F) : se,
|
|
2136
2410
|
min: F,
|
|
2137
|
-
max:
|
|
2138
|
-
onChange: (e) =>
|
|
2139
|
-
onBlur:
|
|
2140
|
-
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),
|
|
2141
2415
|
disabled: V,
|
|
2142
|
-
isValid: V || !
|
|
2416
|
+
isValid: V || !Y
|
|
2143
2417
|
}), /* @__PURE__ */ f(E, {
|
|
2144
2418
|
label: "Max:",
|
|
2145
2419
|
type: "number",
|
|
2146
|
-
style:
|
|
2147
|
-
value: V ? String(I) :
|
|
2148
|
-
min:
|
|
2420
|
+
style: de,
|
|
2421
|
+
value: V ? String(I) : le,
|
|
2422
|
+
min: yt(Math.max(R, q[0] + B), B),
|
|
2149
2423
|
max: I,
|
|
2150
|
-
onChange: (e) =>
|
|
2151
|
-
onBlur:
|
|
2152
|
-
onKeyDown:
|
|
2424
|
+
onChange: (e) => ue(e.target.value),
|
|
2425
|
+
onBlur: Ce,
|
|
2426
|
+
onKeyDown: we(Ce),
|
|
2153
2427
|
disabled: V,
|
|
2154
|
-
isValid: V || !
|
|
2428
|
+
isValid: V || !ae
|
|
2155
2429
|
})]
|
|
2156
2430
|
})]
|
|
2157
|
-
}) : /* @__PURE__ */ f(
|
|
2431
|
+
}) : /* @__PURE__ */ f(ht, {
|
|
2158
2432
|
label: n,
|
|
2159
2433
|
field: t,
|
|
2160
2434
|
missing: ["filterable"]
|
|
2161
2435
|
});
|
|
2162
|
-
},
|
|
2436
|
+
}, Ct = {
|
|
2163
2437
|
list: "_list_9je85_2",
|
|
2164
2438
|
grid: "_grid_9je85_9",
|
|
2165
2439
|
count: "_count_9je85_22",
|
|
@@ -2168,7 +2442,7 @@ var ut = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
2168
2442
|
active: "_active_9je85_41"
|
|
2169
2443
|
};
|
|
2170
2444
|
// src/components/BucketFilterPanel.tsx
|
|
2171
|
-
function
|
|
2445
|
+
function wt(e, t) {
|
|
2172
2446
|
if (!t) return null;
|
|
2173
2447
|
let n = 0, r = !1;
|
|
2174
2448
|
for (let i of t) {
|
|
@@ -2180,15 +2454,15 @@ function ft(e, t) {
|
|
|
2180
2454
|
}
|
|
2181
2455
|
return r ? n : 0;
|
|
2182
2456
|
}
|
|
2183
|
-
var
|
|
2184
|
-
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);
|
|
2185
2459
|
o(() => {
|
|
2186
2460
|
L(m ?? Infinity);
|
|
2187
2461
|
}, [m, P]);
|
|
2188
2462
|
let R = w?.[e] ?? E?.[e], z = s(() => {
|
|
2189
2463
|
let e = [];
|
|
2190
2464
|
if (R && e.push(R.min, R.max), Array.isArray(P)) for (let t of P) e.push(Number(t.key));
|
|
2191
|
-
return
|
|
2465
|
+
return vt(e.filter(Number.isFinite));
|
|
2192
2466
|
}, [R, P]), B = s(() => {
|
|
2193
2467
|
let e = R?.min ?? -Number.MAX_VALUE, t = R?.max ?? Number.MAX_VALUE, i = (n, r, i) => ({
|
|
2194
2468
|
label: i ?? (n === void 0 ? `up to ${r}` : r === void 0 ? `${n} and up` : `${n}-${r}`),
|
|
@@ -2201,12 +2475,12 @@ var pt = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2201
2475
|
if (r && r.length > 0) return r.map((e) => i(e.min, e.max, e.label));
|
|
2202
2476
|
if (Array.isArray(n)) {
|
|
2203
2477
|
let e = [...n].sort((e, t) => e - t), t = [];
|
|
2204
|
-
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)));
|
|
2205
2479
|
return t;
|
|
2206
2480
|
}
|
|
2207
2481
|
if (typeof n == "number" && n > 0 && R) {
|
|
2208
2482
|
let e = [], t = Math.floor(R.min / n) * n;
|
|
2209
|
-
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)));
|
|
2210
2484
|
return e;
|
|
2211
2485
|
}
|
|
2212
2486
|
return [];
|
|
@@ -2217,27 +2491,27 @@ var pt = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2217
2491
|
z
|
|
2218
2492
|
]);
|
|
2219
2493
|
if (A) return null;
|
|
2220
|
-
if (j || !v) return /* @__PURE__ */ f(
|
|
2494
|
+
if (j || !v) return /* @__PURE__ */ f(pt, {
|
|
2221
2495
|
title: t,
|
|
2222
2496
|
rows: Math.max(1, Math.min(B.length || 5, 8)),
|
|
2223
2497
|
collapsible: g,
|
|
2224
2498
|
startCollapsed: _
|
|
2225
2499
|
});
|
|
2226
2500
|
if (!M && !D) return null;
|
|
2227
|
-
if (!x?.includes(e)) return /* @__PURE__ */ f(
|
|
2501
|
+
if (!x?.includes(e)) return /* @__PURE__ */ f(ht, {
|
|
2228
2502
|
label: t,
|
|
2229
2503
|
field: e,
|
|
2230
2504
|
missing: ["filterable"]
|
|
2231
2505
|
});
|
|
2232
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) => ({
|
|
2233
2507
|
bucket: e,
|
|
2234
|
-
count: V ?
|
|
2508
|
+
count: V ? wt(e, P) : null
|
|
2235
2509
|
}));
|
|
2236
2510
|
if (d || (U = U.filter((e) => e.count !== 0 || H(e.bucket))), U.length === 0) return null;
|
|
2237
2511
|
let W = U.slice(0, I), ee = (t, n) => {
|
|
2238
|
-
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");
|
|
2239
2513
|
if (N === "radio") {
|
|
2240
|
-
let n = /* @__PURE__ */ f(
|
|
2514
|
+
let n = /* @__PURE__ */ f(k, {
|
|
2241
2515
|
id: `${e}-${t.range.min}-${t.range.max}`,
|
|
2242
2516
|
name: e,
|
|
2243
2517
|
value: t.label,
|
|
@@ -2247,9 +2521,9 @@ var pt = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2247
2521
|
disabled: i
|
|
2248
2522
|
});
|
|
2249
2523
|
return c === "list" ? /* @__PURE__ */ p("div", {
|
|
2250
|
-
className:
|
|
2524
|
+
className: Ct.count,
|
|
2251
2525
|
children: [n, /* @__PURE__ */ f("span", {
|
|
2252
|
-
className:
|
|
2526
|
+
className: Ct.countValue,
|
|
2253
2527
|
children: a
|
|
2254
2528
|
})]
|
|
2255
2529
|
}) : n;
|
|
@@ -2260,19 +2534,19 @@ var pt = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2260
2534
|
onClick: o,
|
|
2261
2535
|
disabled: i,
|
|
2262
2536
|
size: "micro",
|
|
2263
|
-
className:
|
|
2537
|
+
className: Ct.chip,
|
|
2264
2538
|
children: c === "grid" && a ? `${t.label} (${a})` : t.label
|
|
2265
2539
|
});
|
|
2266
2540
|
return c === "list" ? /* @__PURE__ */ p("div", {
|
|
2267
|
-
className:
|
|
2541
|
+
className: Ct.count,
|
|
2268
2542
|
children: [e, /* @__PURE__ */ f("span", {
|
|
2269
|
-
className:
|
|
2543
|
+
className: Ct.countValue,
|
|
2270
2544
|
children: a
|
|
2271
2545
|
})]
|
|
2272
2546
|
}) : e;
|
|
2273
2547
|
}
|
|
2274
2548
|
return c === "list" ? /* @__PURE__ */ p("div", {
|
|
2275
|
-
className:
|
|
2549
|
+
className: Ct.count,
|
|
2276
2550
|
children: [/* @__PURE__ */ f(b, {
|
|
2277
2551
|
label: t.label,
|
|
2278
2552
|
score: "",
|
|
@@ -2280,7 +2554,7 @@ var pt = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2280
2554
|
onChange: o,
|
|
2281
2555
|
disabled: i
|
|
2282
2556
|
}), /* @__PURE__ */ f("span", {
|
|
2283
|
-
className:
|
|
2557
|
+
className: Ct.countValue,
|
|
2284
2558
|
children: a
|
|
2285
2559
|
})]
|
|
2286
2560
|
}) : /* @__PURE__ */ f(b, {
|
|
@@ -2295,9 +2569,9 @@ var pt = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2295
2569
|
title: t,
|
|
2296
2570
|
collapsible: g,
|
|
2297
2571
|
collapsed: g ? _ : !1,
|
|
2298
|
-
className: h && F.length > 0 ?
|
|
2572
|
+
className: h && F.length > 0 ? Ct.active : void 0,
|
|
2299
2573
|
children: /* @__PURE__ */ p("ul", {
|
|
2300
|
-
className: c === "grid" ?
|
|
2574
|
+
className: c === "grid" ? Ct.grid : Ct.list,
|
|
2301
2575
|
style: {
|
|
2302
2576
|
listStyle: "none",
|
|
2303
2577
|
padding: 0,
|
|
@@ -2311,113 +2585,12 @@ var pt = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2311
2585
|
}) })]
|
|
2312
2586
|
})
|
|
2313
2587
|
});
|
|
2314
|
-
},
|
|
2315
|
-
grid: "_grid_1xjna_2",
|
|
2316
|
-
chip: "_chip_1xjna_21",
|
|
2317
|
-
chipLabel: "_chipLabel_1xjna_32"
|
|
2318
|
-
}, ht = r(({ field: e, value: t, onReset: n }) => /* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(y, {
|
|
2319
|
-
onClick: n,
|
|
2320
|
-
iconRight: /* @__PURE__ */ f(ie, {}),
|
|
2321
|
-
variant: "primary",
|
|
2322
|
-
size: "micro",
|
|
2323
|
-
className: mt.chip,
|
|
2324
|
-
title: `${e}: ${t}`,
|
|
2325
|
-
children: /* @__PURE__ */ p("span", {
|
|
2326
|
-
className: mt.chipLabel,
|
|
2327
|
-
children: [
|
|
2328
|
-
e,
|
|
2329
|
-
": ",
|
|
2330
|
-
t
|
|
2331
|
-
]
|
|
2332
|
-
})
|
|
2333
|
-
}) })), gt = r(({ field: e, min: t, max: n, onReset: r }) => /* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(y, {
|
|
2334
|
-
onClick: r,
|
|
2335
|
-
iconRight: /* @__PURE__ */ f(ie, {}),
|
|
2336
|
-
variant: "primary",
|
|
2337
|
-
size: "micro",
|
|
2338
|
-
className: mt.chip,
|
|
2339
|
-
title: `${e}: ${t} β ${n}`,
|
|
2340
|
-
children: /* @__PURE__ */ p("span", {
|
|
2341
|
-
className: mt.chipLabel,
|
|
2342
|
-
children: [
|
|
2343
|
-
e,
|
|
2344
|
-
": ",
|
|
2345
|
-
t,
|
|
2346
|
-
" β ",
|
|
2347
|
-
n
|
|
2348
|
-
]
|
|
2349
|
-
})
|
|
2350
|
-
}) })), _t = r(({ field: e, label: t, onReset: n }) => /* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(y, {
|
|
2351
|
-
onClick: n,
|
|
2352
|
-
iconRight: /* @__PURE__ */ f(ie, {}),
|
|
2353
|
-
variant: "primary",
|
|
2354
|
-
size: "micro",
|
|
2355
|
-
className: mt.chip,
|
|
2356
|
-
title: `${e}: ${t}`,
|
|
2357
|
-
children: /* @__PURE__ */ p("span", {
|
|
2358
|
-
className: mt.chipLabel,
|
|
2359
|
-
children: [
|
|
2360
|
-
e,
|
|
2361
|
-
": ",
|
|
2362
|
-
t
|
|
2363
|
-
]
|
|
2364
|
-
})
|
|
2365
|
-
}) }));
|
|
2366
|
-
function vt() {
|
|
2367
|
-
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) => ({
|
|
2368
|
-
field: e,
|
|
2369
|
-
value: t
|
|
2370
|
-
}))).flat(), [e]), l = s(() => Object.entries(t).map(([e, { min: t, max: n }]) => ({
|
|
2371
|
-
field: e,
|
|
2372
|
-
min: t,
|
|
2373
|
-
max: n
|
|
2374
|
-
})), [t]), u = s(() => Object.entries(n).flatMap(([e, t]) => t.map((t) => ({
|
|
2375
|
-
field: e,
|
|
2376
|
-
range: t,
|
|
2377
|
-
label: `${t.min}-${t.max}`
|
|
2378
|
-
}))), [n]);
|
|
2379
|
-
return s(() => Object.keys(e).length > 0 || Object.keys(t).length > 0 || u.length > 0, [
|
|
2380
|
-
e,
|
|
2381
|
-
t,
|
|
2382
|
-
u
|
|
2383
|
-
]) ? /* @__PURE__ */ f(T, {
|
|
2384
|
-
collapsible: !1,
|
|
2385
|
-
title: "Active filters",
|
|
2386
|
-
children: /* @__PURE__ */ p("ul", {
|
|
2387
|
-
className: mt.grid,
|
|
2388
|
-
children: [
|
|
2389
|
-
c.map(({ field: e, value: t }) => /* @__PURE__ */ f(ht, {
|
|
2390
|
-
field: e,
|
|
2391
|
-
value: t,
|
|
2392
|
-
onReset: () => i(e, t)
|
|
2393
|
-
}, `${e}-${t}`)),
|
|
2394
|
-
l.map(({ field: e, min: t, max: n }) => /* @__PURE__ */ f(gt, {
|
|
2395
|
-
field: e,
|
|
2396
|
-
min: t,
|
|
2397
|
-
max: n,
|
|
2398
|
-
onReset: () => a(e)
|
|
2399
|
-
}, e)),
|
|
2400
|
-
u.map(({ field: e, range: t, label: n }) => /* @__PURE__ */ f(_t, {
|
|
2401
|
-
field: e,
|
|
2402
|
-
label: n,
|
|
2403
|
-
onReset: () => o(e, t)
|
|
2404
|
-
}, `${e}-${t.min}-${t.max}`)),
|
|
2405
|
-
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(y, {
|
|
2406
|
-
onClick: r,
|
|
2407
|
-
size: "micro",
|
|
2408
|
-
variant: "ghost",
|
|
2409
|
-
children: "Reset"
|
|
2410
|
-
}) })
|
|
2411
|
-
]
|
|
2412
|
-
})
|
|
2413
|
-
}) : null;
|
|
2414
|
-
}
|
|
2415
|
-
var yt = {
|
|
2588
|
+
}, Et = {
|
|
2416
2589
|
select: "_select_nwf7i_1",
|
|
2417
2590
|
radioGroup: "_radioGroup_nwf7i_6"
|
|
2418
|
-
},
|
|
2419
|
-
let o = n ?? (r === "radio" ? "radio" : "select"), { state: { sortableFields: s, sortBy: c, sortAscending: l }, setSort: u, isFetchingInitial: d } =
|
|
2420
|
-
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, {
|
|
2421
2594
|
title: "Sort by",
|
|
2422
2595
|
rows: o === "radio" ? 3 : 1,
|
|
2423
2596
|
collapsible: i,
|
|
@@ -2447,15 +2620,15 @@ var yt = {
|
|
|
2447
2620
|
title: "Sort by",
|
|
2448
2621
|
collapsible: i,
|
|
2449
2622
|
collapsed: i ? a : !1,
|
|
2450
|
-
children: o === "select" ? /* @__PURE__ */ f(
|
|
2623
|
+
children: o === "select" ? /* @__PURE__ */ f(j, {
|
|
2451
2624
|
value: p,
|
|
2452
2625
|
onValueChange: g,
|
|
2453
2626
|
options: h,
|
|
2454
2627
|
placeholder: "Select sort...",
|
|
2455
2628
|
"aria-label": "Sort by"
|
|
2456
2629
|
}) : /* @__PURE__ */ f("div", {
|
|
2457
|
-
className:
|
|
2458
|
-
children: h.map((e) => /* @__PURE__ */ f(
|
|
2630
|
+
className: Et.radioGroup,
|
|
2631
|
+
children: h.map((e) => /* @__PURE__ */ f(k, {
|
|
2459
2632
|
id: `sort-${e.value}`,
|
|
2460
2633
|
name: "sort-by",
|
|
2461
2634
|
value: e.value,
|
|
@@ -2465,7 +2638,7 @@ var yt = {
|
|
|
2465
2638
|
}, e.value))
|
|
2466
2639
|
})
|
|
2467
2640
|
});
|
|
2468
|
-
},
|
|
2641
|
+
}, Ot = { list: "_list_1y4fk_1" }, kt = {
|
|
2469
2642
|
coverageDepth: 500,
|
|
2470
2643
|
coverWholeQuery: !0,
|
|
2471
2644
|
coverWholeWords: !0,
|
|
@@ -2480,8 +2653,8 @@ var yt = {
|
|
|
2480
2653
|
truncateWordHitTolerance: 0,
|
|
2481
2654
|
truncationScore: 65024
|
|
2482
2655
|
};
|
|
2483
|
-
function
|
|
2484
|
-
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);
|
|
2485
2658
|
o(() => {
|
|
2486
2659
|
let e = !0;
|
|
2487
2660
|
try {
|
|
@@ -2498,7 +2671,7 @@ function Ct() {
|
|
|
2498
2671
|
i,
|
|
2499
2672
|
a
|
|
2500
2673
|
]);
|
|
2501
|
-
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) => {
|
|
2502
2675
|
let r = parseInt(n, 10);
|
|
2503
2676
|
isNaN(r) || t({ [e]: r });
|
|
2504
2677
|
}, w = (e, n) => {
|
|
@@ -2519,7 +2692,7 @@ function Ct() {
|
|
|
2519
2692
|
collapsed: !0,
|
|
2520
2693
|
title: "Settings",
|
|
2521
2694
|
children: /* @__PURE__ */ p("ul", {
|
|
2522
|
-
className:
|
|
2695
|
+
className: Ot.list,
|
|
2523
2696
|
children: [
|
|
2524
2697
|
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(E, {
|
|
2525
2698
|
label: "Max Results",
|
|
@@ -2545,7 +2718,7 @@ function Ct() {
|
|
|
2545
2718
|
}
|
|
2546
2719
|
}), /* @__PURE__ */ f("div", {
|
|
2547
2720
|
style: { padding: "10px 10px 20px 10px" },
|
|
2548
|
-
children: /* @__PURE__ */ f(
|
|
2721
|
+
children: /* @__PURE__ */ f(P, {
|
|
2549
2722
|
min: 0,
|
|
2550
2723
|
max: 65535,
|
|
2551
2724
|
step: 1,
|
|
@@ -2564,17 +2737,17 @@ function Ct() {
|
|
|
2564
2737
|
t({ placeholderText: e.target.value });
|
|
2565
2738
|
}
|
|
2566
2739
|
}) }),
|
|
2567
|
-
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(
|
|
2740
|
+
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(I, {
|
|
2568
2741
|
label: "Show score",
|
|
2569
2742
|
checked: e.showScore,
|
|
2570
2743
|
onChange: (e) => w("showScore", e)
|
|
2571
2744
|
}) }),
|
|
2572
|
-
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(
|
|
2745
|
+
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(I, {
|
|
2573
2746
|
label: "Enable Coverage",
|
|
2574
2747
|
checked: e.enableCoverage,
|
|
2575
2748
|
onChange: (e) => w("enableCoverage", e)
|
|
2576
2749
|
}) }),
|
|
2577
|
-
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(
|
|
2750
|
+
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(I, {
|
|
2578
2751
|
label: "Remove Duplicates",
|
|
2579
2752
|
checked: e.removeDuplicates,
|
|
2580
2753
|
onChange: (e) => w("removeDuplicates", e)
|
|
@@ -2582,42 +2755,42 @@ function Ct() {
|
|
|
2582
2755
|
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(y, {
|
|
2583
2756
|
variant: "ghost",
|
|
2584
2757
|
size: "micro",
|
|
2585
|
-
iconRight: f(s ?
|
|
2758
|
+
iconRight: f(s ? B : V, {}),
|
|
2586
2759
|
onClick: () => c((e) => !e),
|
|
2587
2760
|
children: s ? "Hide Coverage Setup" : "Show Coverage Setup"
|
|
2588
2761
|
}) }),
|
|
2589
2762
|
s && /* @__PURE__ */ p(d, { children: [
|
|
2590
|
-
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(
|
|
2763
|
+
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(I, {
|
|
2591
2764
|
label: x("Cover Whole Query", g("coverWholeQuery")),
|
|
2592
2765
|
checked: _("coverWholeQuery"),
|
|
2593
2766
|
onChange: (e) => O("coverWholeQuery", e)
|
|
2594
2767
|
}) }),
|
|
2595
|
-
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(
|
|
2768
|
+
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(I, {
|
|
2596
2769
|
label: x("Cover Whole Words", g("coverWholeWords")),
|
|
2597
2770
|
checked: _("coverWholeWords"),
|
|
2598
2771
|
onChange: (e) => O("coverWholeWords", e)
|
|
2599
2772
|
}) }),
|
|
2600
|
-
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(
|
|
2773
|
+
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(I, {
|
|
2601
2774
|
label: x("Cover Fuzzy Words", g("coverFuzzyWords")),
|
|
2602
2775
|
checked: _("coverFuzzyWords"),
|
|
2603
2776
|
onChange: (e) => O("coverFuzzyWords", e)
|
|
2604
2777
|
}) }),
|
|
2605
|
-
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(
|
|
2778
|
+
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(I, {
|
|
2606
2779
|
label: x("Cover Joined Words", g("coverJoinedWords")),
|
|
2607
2780
|
checked: _("coverJoinedWords"),
|
|
2608
2781
|
onChange: (e) => O("coverJoinedWords", e)
|
|
2609
2782
|
}) }),
|
|
2610
|
-
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(
|
|
2783
|
+
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(I, {
|
|
2611
2784
|
label: x("Cover Prefix Suffix", g("coverPrefixSuffix")),
|
|
2612
2785
|
checked: _("coverPrefixSuffix"),
|
|
2613
2786
|
onChange: (e) => O("coverPrefixSuffix", e)
|
|
2614
2787
|
}) }),
|
|
2615
|
-
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(
|
|
2788
|
+
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(I, {
|
|
2616
2789
|
label: x("Truncate", g("truncate")),
|
|
2617
2790
|
checked: _("truncate"),
|
|
2618
2791
|
onChange: (e) => O("truncate", e)
|
|
2619
2792
|
}) }),
|
|
2620
|
-
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(
|
|
2793
|
+
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(I, {
|
|
2621
2794
|
label: x("Include Pattern Matches", g("includePatternMatches")),
|
|
2622
2795
|
checked: _("includePatternMatches"),
|
|
2623
2796
|
onChange: (e) => O("includePatternMatches", e)
|
|
@@ -2661,7 +2834,7 @@ function Ct() {
|
|
|
2661
2834
|
});
|
|
2662
2835
|
}
|
|
2663
2836
|
// src/components/SearchErrorBoundary.tsx
|
|
2664
|
-
var
|
|
2837
|
+
var jt = class extends t {
|
|
2665
2838
|
constructor(e) {
|
|
2666
2839
|
super(e), this.state = {
|
|
2667
2840
|
hasError: !1,
|
|
@@ -2742,48 +2915,58 @@ var wt = class extends t {
|
|
|
2742
2915
|
}
|
|
2743
2916
|
};
|
|
2744
2917
|
// src/hooks/useVectorSearch.ts
|
|
2745
|
-
function
|
|
2746
|
-
let { url: n, team: r, dataset: a, authenticatedFetch:
|
|
2747
|
-
return {
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2918
|
+
function Mt(e, t) {
|
|
2919
|
+
let { url: n, team: r, dataset: a, authenticatedFetch: s } = _e(), [u, d] = l(null), [f, p] = l(!1), [m, h] = l(void 0), g = c(0);
|
|
2920
|
+
return o(() => () => {
|
|
2921
|
+
g.current++;
|
|
2922
|
+
}, [
|
|
2923
|
+
n,
|
|
2924
|
+
r,
|
|
2925
|
+
a
|
|
2926
|
+
]), {
|
|
2927
|
+
results: u,
|
|
2928
|
+
isLoading: f,
|
|
2929
|
+
error: m,
|
|
2751
2930
|
search: i(async (i) => {
|
|
2752
|
-
|
|
2931
|
+
let o = ++g.current, c = () => o === g.current;
|
|
2932
|
+
p(!0), h(void 0);
|
|
2753
2933
|
try {
|
|
2754
|
-
let
|
|
2934
|
+
let o = await e(i), l = {
|
|
2755
2935
|
fieldName: t.fieldName,
|
|
2756
|
-
vector:
|
|
2936
|
+
vector: o,
|
|
2757
2937
|
maxResults: t.maxResults ?? 10
|
|
2758
2938
|
};
|
|
2759
2939
|
t.filter && (l.filter = t.filter);
|
|
2760
|
-
let u = await
|
|
2940
|
+
let u = await s(`${n}/api/teams/${r}/datasets/${a}/search/vector`, {
|
|
2761
2941
|
method: "POST",
|
|
2762
2942
|
headers: { "Content-Type": "application/json" },
|
|
2763
2943
|
body: JSON.stringify(l)
|
|
2764
2944
|
});
|
|
2765
|
-
if (!u.ok) throw await
|
|
2766
|
-
let
|
|
2767
|
-
if (
|
|
2768
|
-
|
|
2945
|
+
if (!u.ok) throw await Y.fromResponse("VectorSearch", u);
|
|
2946
|
+
let f = await u.json();
|
|
2947
|
+
if (!c()) return;
|
|
2948
|
+
if (f.length === 0) {
|
|
2949
|
+
d([]);
|
|
2769
2950
|
return;
|
|
2770
2951
|
}
|
|
2771
|
-
let
|
|
2952
|
+
let p = f.map((e) => e.documentKey), m = await s(`${n}/api/teams/${r}/datasets/${a}/documents/lookup`, {
|
|
2772
2953
|
method: "POST",
|
|
2773
2954
|
headers: { "Content-Type": "application/json" },
|
|
2774
|
-
body: JSON.stringify(
|
|
2955
|
+
body: JSON.stringify(p)
|
|
2775
2956
|
});
|
|
2776
|
-
if (!
|
|
2777
|
-
let
|
|
2778
|
-
c(
|
|
2957
|
+
if (!m.ok) throw await Y.fromResponse("GetJson", m);
|
|
2958
|
+
let h = await m.json();
|
|
2959
|
+
if (!c()) return;
|
|
2960
|
+
d(h.map((e, t) => ({
|
|
2779
2961
|
document: e,
|
|
2780
|
-
documentKey:
|
|
2781
|
-
score:
|
|
2962
|
+
documentKey: p[t],
|
|
2963
|
+
score: f[t].score
|
|
2782
2964
|
})));
|
|
2783
2965
|
} catch (e) {
|
|
2784
|
-
|
|
2966
|
+
if (!c()) return;
|
|
2967
|
+
h(e instanceof Error ? e.message : "Vector search failed"), d(null);
|
|
2785
2968
|
} finally {
|
|
2786
|
-
|
|
2969
|
+
c() && p(!1);
|
|
2787
2970
|
}
|
|
2788
2971
|
}, [
|
|
2789
2972
|
e,
|
|
@@ -2793,55 +2976,65 @@ function Tt(e, t) {
|
|
|
2793
2976
|
n,
|
|
2794
2977
|
r,
|
|
2795
2978
|
a,
|
|
2796
|
-
|
|
2979
|
+
s
|
|
2797
2980
|
])
|
|
2798
2981
|
};
|
|
2799
2982
|
}
|
|
2800
2983
|
// src/hooks/useHybridSearch.ts
|
|
2801
|
-
function
|
|
2802
|
-
let { url: n, team: r, dataset: a, authenticatedFetch:
|
|
2803
|
-
return {
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2984
|
+
function Nt(e, t) {
|
|
2985
|
+
let { url: n, team: r, dataset: a, authenticatedFetch: s } = _e(), [u, d] = l(null), [f, p] = l(!1), [m, h] = l(void 0), g = c(0);
|
|
2986
|
+
return o(() => () => {
|
|
2987
|
+
g.current++;
|
|
2988
|
+
}, [
|
|
2989
|
+
n,
|
|
2990
|
+
r,
|
|
2991
|
+
a
|
|
2992
|
+
]), {
|
|
2993
|
+
results: u,
|
|
2994
|
+
isLoading: f,
|
|
2995
|
+
error: m,
|
|
2807
2996
|
search: i(async (i) => {
|
|
2808
|
-
|
|
2997
|
+
let o = ++g.current, c = () => o === g.current;
|
|
2998
|
+
p(!0), h(void 0);
|
|
2809
2999
|
try {
|
|
2810
|
-
let
|
|
3000
|
+
let o = await e(i), l = {
|
|
2811
3001
|
text: i,
|
|
2812
3002
|
embeddingField: t.fieldName,
|
|
2813
|
-
vector:
|
|
3003
|
+
vector: o,
|
|
2814
3004
|
maxNumberOfRecordsToReturn: t.maxResults ?? 10,
|
|
2815
3005
|
alpha: t.alpha ?? .5
|
|
2816
3006
|
};
|
|
2817
3007
|
t.filter && (l.filter = t.filter), t.timeoutMs && (l.timeOutLimitMilliseconds = t.timeoutMs);
|
|
2818
|
-
let u = await
|
|
3008
|
+
let u = await s(`${n}/api/teams/${r}/datasets/${a}/search/hybrid`, {
|
|
2819
3009
|
method: "POST",
|
|
2820
3010
|
headers: { "Content-Type": "application/json" },
|
|
2821
3011
|
body: JSON.stringify(l)
|
|
2822
3012
|
});
|
|
2823
|
-
if (!u.ok) throw await
|
|
2824
|
-
let
|
|
2825
|
-
if (
|
|
2826
|
-
|
|
3013
|
+
if (!u.ok) throw await Y.fromResponse("HybridSearch", u);
|
|
3014
|
+
let f = await u.json();
|
|
3015
|
+
if (!c()) return;
|
|
3016
|
+
if (f.length === 0) {
|
|
3017
|
+
d([]);
|
|
2827
3018
|
return;
|
|
2828
3019
|
}
|
|
2829
|
-
let
|
|
3020
|
+
let p = f.map((e) => e.documentKey), m = await s(`${n}/api/teams/${r}/datasets/${a}/documents/lookup`, {
|
|
2830
3021
|
method: "POST",
|
|
2831
3022
|
headers: { "Content-Type": "application/json" },
|
|
2832
|
-
body: JSON.stringify(
|
|
3023
|
+
body: JSON.stringify(p)
|
|
2833
3024
|
});
|
|
2834
|
-
if (!
|
|
2835
|
-
let
|
|
2836
|
-
c(
|
|
3025
|
+
if (!m.ok) throw await Y.fromResponse("GetJson", m);
|
|
3026
|
+
let h = await m.json();
|
|
3027
|
+
if (!c()) return;
|
|
3028
|
+
d(h.map((e, t) => ({
|
|
2837
3029
|
document: e,
|
|
2838
|
-
documentKey:
|
|
2839
|
-
score:
|
|
3030
|
+
documentKey: p[t],
|
|
3031
|
+
score: f[t].score
|
|
2840
3032
|
})));
|
|
2841
3033
|
} catch (e) {
|
|
2842
|
-
|
|
3034
|
+
if (!c()) return;
|
|
3035
|
+
h(e instanceof Error ? e.message : "Hybrid search failed"), d(null);
|
|
2843
3036
|
} finally {
|
|
2844
|
-
|
|
3037
|
+
c() && p(!1);
|
|
2845
3038
|
}
|
|
2846
3039
|
}, [
|
|
2847
3040
|
e,
|
|
@@ -2853,19 +3046,19 @@ function Et(e, t) {
|
|
|
2853
3046
|
n,
|
|
2854
3047
|
r,
|
|
2855
3048
|
a,
|
|
2856
|
-
|
|
3049
|
+
s
|
|
2857
3050
|
])
|
|
2858
3051
|
};
|
|
2859
3052
|
}
|
|
2860
3053
|
// src/hooks/useFilterSuggestion.ts
|
|
2861
|
-
function
|
|
3054
|
+
function Pt(e) {
|
|
2862
3055
|
let t = e.trim().toLowerCase();
|
|
2863
3056
|
return t === "true" || t === "false" || t !== "" && !Number.isNaN(Number(t));
|
|
2864
3057
|
}
|
|
2865
|
-
function
|
|
3058
|
+
function Ft(e, t) {
|
|
2866
3059
|
if (!t) return null;
|
|
2867
3060
|
let n = [];
|
|
2868
|
-
for (let [e, r] of Object.entries(t)) for (let t of r ?? []) t?.key && t.key.trim().length >= 2 && !
|
|
3061
|
+
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({
|
|
2869
3062
|
field: e,
|
|
2870
3063
|
value: t.key
|
|
2871
3064
|
});
|
|
@@ -2884,14 +3077,14 @@ function Ot(e, t) {
|
|
|
2884
3077
|
sort: null
|
|
2885
3078
|
};
|
|
2886
3079
|
}
|
|
2887
|
-
function
|
|
2888
|
-
let t =
|
|
3080
|
+
function It(e = {}) {
|
|
3081
|
+
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);
|
|
2889
3082
|
h.current = t;
|
|
2890
3083
|
let [g, _] = l(null), [v, y] = l(""), [b, x] = l(!1), S = c(0), C = i(async (e) => {
|
|
2891
3084
|
let t = ++S.current;
|
|
2892
3085
|
x(!0);
|
|
2893
3086
|
try {
|
|
2894
|
-
let i = await s(`${n}/api/teams/${r}/datasets/${a}/search-or-ask/filters${
|
|
3087
|
+
let i = await s(`${n}/api/teams/${r}/datasets/${a}/search-or-ask/filters${je(h.current)}`, {
|
|
2895
3088
|
method: "POST",
|
|
2896
3089
|
headers: { "Content-Type": "application/json" },
|
|
2897
3090
|
body: JSON.stringify({ text: e })
|
|
@@ -2930,7 +3123,7 @@ function kt(e = {}) {
|
|
|
2930
3123
|
return o(() => {
|
|
2931
3124
|
if (!A || !j || P || E.current.has(j)) return;
|
|
2932
3125
|
E.current.add(j);
|
|
2933
|
-
let e =
|
|
3126
|
+
let e = Ft(j, N);
|
|
2934
3127
|
if (e && (E.current.add(e.text), w(e), O(j)), k !== "model") return;
|
|
2935
3128
|
let t = e ? e.text : j;
|
|
2936
3129
|
if (!t) return;
|
|
@@ -2939,7 +3132,7 @@ function kt(e = {}) {
|
|
|
2939
3132
|
let o = ++S.current;
|
|
2940
3133
|
x(!0);
|
|
2941
3134
|
try {
|
|
2942
|
-
let c = await s(`${n}/api/teams/${r}/datasets/${a}/search-or-ask/filters${
|
|
3135
|
+
let c = await s(`${n}/api/teams/${r}/datasets/${a}/search-or-ask/filters${je(h.current)}`, {
|
|
2943
3136
|
method: "POST",
|
|
2944
3137
|
headers: { "Content-Type": "application/json" },
|
|
2945
3138
|
body: JSON.stringify({ text: t })
|
|
@@ -2977,40 +3170,40 @@ function kt(e = {}) {
|
|
|
2977
3170
|
};
|
|
2978
3171
|
}
|
|
2979
3172
|
// src/hooks/useAsk.ts
|
|
2980
|
-
var
|
|
3173
|
+
var Lt = {
|
|
2981
3174
|
question: "",
|
|
2982
3175
|
status: "idle",
|
|
2983
3176
|
answer: "",
|
|
2984
3177
|
sources: [],
|
|
2985
3178
|
steps: []
|
|
2986
3179
|
};
|
|
2987
|
-
function
|
|
2988
|
-
let e =
|
|
3180
|
+
function Rt() {
|
|
3181
|
+
let e = _e(), { url: t, team: n, dataset: r, authenticatedFetch: a } = e, s = c(e);
|
|
2989
3182
|
s.current = e;
|
|
2990
|
-
let [u, d] = l(
|
|
3183
|
+
let [u, d] = l(Lt), f = c(u);
|
|
2991
3184
|
f.current = u;
|
|
2992
|
-
let p = c(null), m = i(async (e, i = []) => {
|
|
2993
|
-
let
|
|
2994
|
-
if (!
|
|
3185
|
+
let p = c(null), m = i(async (e, i = [], o = {}) => {
|
|
3186
|
+
let c = e.trim();
|
|
3187
|
+
if (!c) return;
|
|
2995
3188
|
p.current?.abort();
|
|
2996
|
-
let
|
|
2997
|
-
p.current =
|
|
2998
|
-
question:
|
|
3189
|
+
let l = new AbortController();
|
|
3190
|
+
p.current = l, d({
|
|
3191
|
+
question: c,
|
|
2999
3192
|
status: "searching",
|
|
3000
3193
|
answer: "",
|
|
3001
3194
|
sources: [],
|
|
3002
3195
|
steps: []
|
|
3003
3196
|
});
|
|
3004
|
-
let
|
|
3005
|
-
|
|
3006
|
-
let e =
|
|
3197
|
+
let u = "", f = null, m = () => {
|
|
3198
|
+
f = null;
|
|
3199
|
+
let e = u;
|
|
3007
3200
|
d((t) => t.answer === e ? t : {
|
|
3008
3201
|
...t,
|
|
3009
3202
|
answer: e
|
|
3010
3203
|
});
|
|
3011
|
-
},
|
|
3012
|
-
|
|
3013
|
-
},
|
|
3204
|
+
}, h = () => {
|
|
3205
|
+
f !== null && (cancelAnimationFrame(f), f = null), m();
|
|
3206
|
+
}, g = (e, t) => d((n) => ({
|
|
3014
3207
|
...n,
|
|
3015
3208
|
status: "error",
|
|
3016
3209
|
error: {
|
|
@@ -3019,17 +3212,18 @@ function jt() {
|
|
|
3019
3212
|
}
|
|
3020
3213
|
}));
|
|
3021
3214
|
try {
|
|
3022
|
-
let e = await a(`${t}/api/teams/${n}/datasets/${r}/search-or-ask/ask${
|
|
3215
|
+
let e = await a(`${t}/api/teams/${n}/datasets/${r}/search-or-ask/ask${je(s.current)}`, {
|
|
3023
3216
|
method: "POST",
|
|
3024
3217
|
headers: {
|
|
3025
3218
|
"Content-Type": "application/json",
|
|
3026
3219
|
Accept: "text/event-stream"
|
|
3027
3220
|
},
|
|
3028
|
-
body: JSON.stringify(
|
|
3029
|
-
question:
|
|
3030
|
-
history: i
|
|
3031
|
-
|
|
3032
|
-
|
|
3221
|
+
body: JSON.stringify({
|
|
3222
|
+
question: c,
|
|
3223
|
+
...i.length ? { history: i } : {},
|
|
3224
|
+
...o.proactive ? { proactive: !0 } : {}
|
|
3225
|
+
}),
|
|
3226
|
+
signal: l.signal
|
|
3033
3227
|
});
|
|
3034
3228
|
if (e.status === 429) {
|
|
3035
3229
|
let t = await e.json().catch(() => ({})), n = Number(e.headers.get("Retry-After"));
|
|
@@ -3046,10 +3240,10 @@ function jt() {
|
|
|
3046
3240
|
askId: p
|
|
3047
3241
|
})), !e.ok || !e.body) {
|
|
3048
3242
|
let t = await e.json().catch(() => ({}));
|
|
3049
|
-
|
|
3243
|
+
g(t.code ?? `http${e.status}`, t.detail ?? "The question could not be asked.");
|
|
3050
3244
|
return;
|
|
3051
3245
|
}
|
|
3052
|
-
for await (let { event: t, data: n } of
|
|
3246
|
+
for await (let { event: t, data: n } of Ae(e.body)) switch (t) {
|
|
3053
3247
|
case "status": {
|
|
3054
3248
|
let e = n.step;
|
|
3055
3249
|
e && d((t) => ({
|
|
@@ -3072,33 +3266,36 @@ function jt() {
|
|
|
3072
3266
|
}));
|
|
3073
3267
|
break;
|
|
3074
3268
|
case "text":
|
|
3075
|
-
|
|
3269
|
+
u || d((e) => e.status === "searching" ? {
|
|
3270
|
+
...e,
|
|
3271
|
+
status: "writing"
|
|
3272
|
+
} : e), u += n.delta, f ??= requestAnimationFrame(m);
|
|
3076
3273
|
break;
|
|
3077
3274
|
case "done":
|
|
3078
|
-
|
|
3275
|
+
h(), d((e) => ({
|
|
3079
3276
|
...e,
|
|
3080
3277
|
status: "answered"
|
|
3081
3278
|
}));
|
|
3082
3279
|
return;
|
|
3083
3280
|
case "error": {
|
|
3084
|
-
|
|
3281
|
+
h();
|
|
3085
3282
|
let e = n;
|
|
3086
|
-
|
|
3283
|
+
g(e.code, e.message);
|
|
3087
3284
|
return;
|
|
3088
3285
|
}
|
|
3089
3286
|
}
|
|
3090
|
-
|
|
3287
|
+
h(), l.signal.aborted || g("dropped", "The connection dropped while the answer was being written.");
|
|
3091
3288
|
} catch (e) {
|
|
3092
|
-
if (p.current !==
|
|
3093
|
-
|
|
3289
|
+
if (p.current !== l) return;
|
|
3290
|
+
h(), e.name === "AbortError" ? d((e) => e.answer ? {
|
|
3094
3291
|
...e,
|
|
3095
3292
|
status: "answered"
|
|
3096
3293
|
} : {
|
|
3097
3294
|
...e,
|
|
3098
3295
|
status: "idle"
|
|
3099
|
-
}) :
|
|
3296
|
+
}) : g("dropped", "The connection dropped while the answer was being written.");
|
|
3100
3297
|
} finally {
|
|
3101
|
-
p.current ===
|
|
3298
|
+
p.current === l && (p.current = null);
|
|
3102
3299
|
}
|
|
3103
3300
|
}, [
|
|
3104
3301
|
t,
|
|
@@ -3125,7 +3322,7 @@ function jt() {
|
|
|
3125
3322
|
r,
|
|
3126
3323
|
a
|
|
3127
3324
|
]), g = i(() => p.current?.abort(), []), _ = i(() => {
|
|
3128
|
-
p.current?.abort(), d(
|
|
3325
|
+
p.current?.abort(), d(Lt);
|
|
3129
3326
|
}, []);
|
|
3130
3327
|
return o(() => () => p.current?.abort(), []), {
|
|
3131
3328
|
...u,
|
|
@@ -3152,18 +3349,18 @@ var $ = {
|
|
|
3152
3349
|
searchedLabel: "_searchedLabel_gjc13_23",
|
|
3153
3350
|
steps: "_steps_gjc13_26",
|
|
3154
3351
|
stepDone: "_stepDone_gjc13_27"
|
|
3155
|
-
},
|
|
3156
|
-
function
|
|
3352
|
+
}, zt = /(`[^`\n]+`)|(\*\*[^*\n]+\*\*)|(\*[^*\n]+\*|_[^_\n]+_)|(\[[^\]\n]+\]\(https?:\/\/[^)\s]+\))|(\[\d+\])/g;
|
|
3353
|
+
function Bt(t, n, r) {
|
|
3157
3354
|
let i = [], a = 0, o = 0;
|
|
3158
|
-
for (let s of t.matchAll(
|
|
3355
|
+
for (let s of t.matchAll(zt)) {
|
|
3159
3356
|
s.index > a && i.push(t.slice(a, s.index));
|
|
3160
3357
|
let c = `${r}-${o++}`, [l, u, d, p, m, h] = s;
|
|
3161
3358
|
if (u) i.push(/* @__PURE__ */ f("code", {
|
|
3162
3359
|
className: $.inlineCode,
|
|
3163
3360
|
children: u.slice(1, -1)
|
|
3164
3361
|
}, c));
|
|
3165
|
-
else if (d) i.push(/* @__PURE__ */ f("strong", { children:
|
|
3166
|
-
else if (p) i.push(/* @__PURE__ */ f("em", { children:
|
|
3362
|
+
else if (d) i.push(/* @__PURE__ */ f("strong", { children: Bt(d.slice(2, -2), n, c) }, c));
|
|
3363
|
+
else if (p) i.push(/* @__PURE__ */ f("em", { children: Bt(p.slice(1, -1), n, c) }, c));
|
|
3167
3364
|
else if (m) {
|
|
3168
3365
|
let [, e, t] = /^\[([^\]]+)\]\(([^)]+)\)$/.exec(m);
|
|
3169
3366
|
i.push(/* @__PURE__ */ f("a", {
|
|
@@ -3177,7 +3374,7 @@ function Nt(t, n, r) {
|
|
|
3177
3374
|
}
|
|
3178
3375
|
return a < t.length && i.push(t.slice(a)), i;
|
|
3179
3376
|
}
|
|
3180
|
-
function
|
|
3377
|
+
function Vt(e) {
|
|
3181
3378
|
let t = e.replace(/\r\n/g, "\n").split("\n"), n = [], r = [], i = () => {
|
|
3182
3379
|
r.length && (n.push({
|
|
3183
3380
|
kind: "paragraph",
|
|
@@ -3226,8 +3423,8 @@ function Pt(e) {
|
|
|
3226
3423
|
}
|
|
3227
3424
|
return i(), n;
|
|
3228
3425
|
}
|
|
3229
|
-
function
|
|
3230
|
-
return
|
|
3426
|
+
function Ht(e, t) {
|
|
3427
|
+
return Vt(e).map((e, n) => {
|
|
3231
3428
|
let r = `b${n}`;
|
|
3232
3429
|
switch (e.kind) {
|
|
3233
3430
|
case "code": return /* @__PURE__ */ f("pre", {
|
|
@@ -3237,63 +3434,63 @@ function Ft(e, t) {
|
|
|
3237
3434
|
}, r);
|
|
3238
3435
|
case "heading": return /* @__PURE__ */ f("p", {
|
|
3239
3436
|
className: $.heading,
|
|
3240
|
-
children:
|
|
3437
|
+
children: Bt(e.text, t, r)
|
|
3241
3438
|
}, r);
|
|
3242
3439
|
case "list": {
|
|
3243
3440
|
let n = e.ordered ? "ol" : "ul";
|
|
3244
3441
|
return /* @__PURE__ */ f(n, {
|
|
3245
3442
|
className: $.list,
|
|
3246
|
-
children: e.items.map((e, n) => /* @__PURE__ */ f("li", { children:
|
|
3443
|
+
children: e.items.map((e, n) => /* @__PURE__ */ f("li", { children: Bt(e, t, `${r}-${n}`) }, n))
|
|
3247
3444
|
}, r);
|
|
3248
3445
|
}
|
|
3249
3446
|
default: return /* @__PURE__ */ f("p", {
|
|
3250
3447
|
className: $.paragraph,
|
|
3251
|
-
children:
|
|
3448
|
+
children: Bt(e.text, t, r)
|
|
3252
3449
|
}, r);
|
|
3253
3450
|
}
|
|
3254
3451
|
});
|
|
3255
3452
|
}
|
|
3256
3453
|
// src/components/AskPanel.tsx
|
|
3257
|
-
var
|
|
3258
|
-
function
|
|
3454
|
+
var Ut = /\[(\d+)\]/g;
|
|
3455
|
+
function Wt(e) {
|
|
3259
3456
|
let t = e.field.split(".")[0];
|
|
3260
3457
|
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;
|
|
3261
3458
|
}
|
|
3262
|
-
var
|
|
3263
|
-
let
|
|
3459
|
+
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 = "" }) => {
|
|
3460
|
+
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);
|
|
3264
3461
|
o(() => {
|
|
3265
|
-
L([]),
|
|
3462
|
+
L([]), V.current = [], e?.trim() ? O(e, [], { proactive: t }) : k();
|
|
3266
3463
|
}, [
|
|
3267
3464
|
e,
|
|
3268
|
-
|
|
3269
|
-
|
|
3465
|
+
O,
|
|
3466
|
+
k
|
|
3270
3467
|
]), o(() => {
|
|
3271
|
-
|
|
3272
|
-
}, [
|
|
3273
|
-
let
|
|
3468
|
+
u?.(j);
|
|
3469
|
+
}, [j, u]);
|
|
3470
|
+
let ee = c(void 0);
|
|
3274
3471
|
o(() => {
|
|
3275
|
-
|
|
3276
|
-
}, [
|
|
3277
|
-
let e =
|
|
3278
|
-
|
|
3472
|
+
D.filters && D.filters !== ee.current && (ee.current = D.filters, d?.(D.filters));
|
|
3473
|
+
}, [D.filters, d]), o(() => {
|
|
3474
|
+
let e = U.current;
|
|
3475
|
+
T && e && W.current && (e.scrollTop = e.scrollHeight);
|
|
3279
3476
|
}, [
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3477
|
+
T,
|
|
3478
|
+
D.answer,
|
|
3479
|
+
D.steps.length,
|
|
3480
|
+
j,
|
|
3481
|
+
I.length
|
|
3285
3482
|
]);
|
|
3286
|
-
let
|
|
3287
|
-
let e =
|
|
3288
|
-
e && (
|
|
3289
|
-
},
|
|
3483
|
+
let G = () => {
|
|
3484
|
+
let e = U.current;
|
|
3485
|
+
e && (W.current = e.scrollHeight - e.scrollTop - e.clientHeight < 40);
|
|
3486
|
+
}, te = (e) => e && /* @__PURE__ */ p("div", {
|
|
3290
3487
|
className: $.searched,
|
|
3291
3488
|
children: [
|
|
3292
3489
|
/* @__PURE__ */ p("span", {
|
|
3293
3490
|
className: $.searchedLabel,
|
|
3294
3491
|
children: [e.more ? `${e.found}+` : e.found, " found"]
|
|
3295
3492
|
}),
|
|
3296
|
-
e.filters.map((e, t) => /* @__PURE__ */ f(x, { children:
|
|
3493
|
+
e.filters.map((e, t) => /* @__PURE__ */ f(x, { children: b(e) }, t)),
|
|
3297
3494
|
e.text && /* @__PURE__ */ p("span", {
|
|
3298
3495
|
className: $.searchedLabel,
|
|
3299
3496
|
children: [
|
|
@@ -3314,39 +3511,39 @@ var Rt = ({ question: e, followUps: t = !1, onSourceClick: n, label: r = "Answer
|
|
|
3314
3511
|
})
|
|
3315
3512
|
]
|
|
3316
3513
|
});
|
|
3317
|
-
if (
|
|
3318
|
-
let K = (e, t) => (
|
|
3319
|
-
|
|
3320
|
-
},
|
|
3321
|
-
let i = e.find((e) => e.n ===
|
|
3514
|
+
if (j === "idle" && I.length === 0) return null;
|
|
3515
|
+
let K = (e, t) => (n) => {
|
|
3516
|
+
n.preventDefault(), M(e, t), r?.(e);
|
|
3517
|
+
}, re = (e, t) => (n) => {
|
|
3518
|
+
let i = e.find((e) => e.n === n);
|
|
3322
3519
|
return /* @__PURE__ */ f(C, {
|
|
3323
|
-
n
|
|
3520
|
+
n,
|
|
3324
3521
|
title: i?.title,
|
|
3325
|
-
onClick: i &&
|
|
3522
|
+
onClick: i && r ? K(i, t) : void 0
|
|
3326
3523
|
});
|
|
3327
|
-
},
|
|
3328
|
-
let r = new Set([...e.matchAll(
|
|
3524
|
+
}, ie = (e, t, n) => {
|
|
3525
|
+
let r = new Set([...e.matchAll(Ut)].map((e) => Number(e[1])));
|
|
3329
3526
|
return n && r.size > 0 ? t.filter((e) => r.has(e.n)) : t.slice(0, 3);
|
|
3330
|
-
},
|
|
3331
|
-
let a =
|
|
3527
|
+
}, q = (e, t, n, i) => {
|
|
3528
|
+
let a = ie(e, t, n);
|
|
3332
3529
|
return a.length > 0 && /* @__PURE__ */ f(S, { items: a.map((e) => ({
|
|
3333
3530
|
n: e.n,
|
|
3334
3531
|
title: e.title,
|
|
3335
|
-
onClick:
|
|
3532
|
+
onClick: r ? K(e, i) : void 0
|
|
3336
3533
|
})) });
|
|
3337
|
-
},
|
|
3338
|
-
navigator.clipboard?.writeText(
|
|
3339
|
-
},
|
|
3340
|
-
if (!
|
|
3341
|
-
if (
|
|
3534
|
+
}, J = () => {
|
|
3535
|
+
navigator.clipboard?.writeText(D.answer.replace(Ut, "")).catch(() => {}), P(!0), setTimeout(() => P(!1), 2e3);
|
|
3536
|
+
}, Y = (e) => {
|
|
3537
|
+
if (!D.busy && e.trim()) {
|
|
3538
|
+
if (j === "answered" && D.answer) {
|
|
3342
3539
|
let e = {
|
|
3343
|
-
question:
|
|
3344
|
-
answer:
|
|
3345
|
-
sources:
|
|
3346
|
-
askId:
|
|
3347
|
-
filters:
|
|
3540
|
+
question: D.question,
|
|
3541
|
+
answer: D.answer,
|
|
3542
|
+
sources: D.sources,
|
|
3543
|
+
askId: D.askId,
|
|
3544
|
+
filters: D.filters
|
|
3348
3545
|
};
|
|
3349
|
-
L((t) => [...t, e]),
|
|
3546
|
+
L((t) => [...t, e]), V.current = [...V.current, {
|
|
3350
3547
|
question: e.question,
|
|
3351
3548
|
answer: e.answer,
|
|
3352
3549
|
...e.filters ? { shown: {
|
|
@@ -3356,98 +3553,98 @@ var Rt = ({ question: e, followUps: t = !1, onSourceClick: n, label: r = "Answer
|
|
|
3356
3553
|
} } : {}
|
|
3357
3554
|
}];
|
|
3358
3555
|
}
|
|
3359
|
-
|
|
3556
|
+
B(""), O(e, V.current);
|
|
3360
3557
|
}
|
|
3361
|
-
},
|
|
3558
|
+
}, X = n ? () => H.current?.focus() : s;
|
|
3362
3559
|
return /* @__PURE__ */ p("div", {
|
|
3363
|
-
className: `${$.panel} ${
|
|
3560
|
+
className: `${$.panel} ${T ? $.fill : ""} ${E}`,
|
|
3364
3561
|
"aria-live": "polite",
|
|
3365
|
-
"aria-busy":
|
|
3562
|
+
"aria-busy": D.busy,
|
|
3366
3563
|
children: [/* @__PURE__ */ p("div", {
|
|
3367
|
-
ref:
|
|
3564
|
+
ref: U,
|
|
3368
3565
|
className: $.thread,
|
|
3369
|
-
onScroll:
|
|
3370
|
-
children: [
|
|
3566
|
+
onScroll: T ? G : void 0,
|
|
3567
|
+
children: [I.map((e, t) => /* @__PURE__ */ p("div", {
|
|
3371
3568
|
className: $.turn,
|
|
3372
|
-
children: [/* @__PURE__ */ f(
|
|
3373
|
-
label:
|
|
3569
|
+
children: [/* @__PURE__ */ f(R, { children: e.question }), /* @__PURE__ */ p(v, {
|
|
3570
|
+
label: i,
|
|
3374
3571
|
children: [
|
|
3375
|
-
|
|
3572
|
+
te(e.filters),
|
|
3376
3573
|
/* @__PURE__ */ f("div", {
|
|
3377
3574
|
className: $.answer,
|
|
3378
|
-
children:
|
|
3575
|
+
children: a(e.answer, re(e.sources, e.askId))
|
|
3379
3576
|
}),
|
|
3380
|
-
|
|
3577
|
+
q(e.answer, e.sources, !0, e.askId)
|
|
3381
3578
|
]
|
|
3382
3579
|
})]
|
|
3383
|
-
}, t)),
|
|
3580
|
+
}, t)), j !== "idle" && /* @__PURE__ */ p("div", {
|
|
3384
3581
|
className: $.turn,
|
|
3385
|
-
children: [/* @__PURE__ */ f(
|
|
3386
|
-
label:
|
|
3582
|
+
children: [/* @__PURE__ */ f(R, { children: D.question }), /* @__PURE__ */ p(v, {
|
|
3583
|
+
label: i,
|
|
3387
3584
|
children: [
|
|
3388
|
-
|
|
3389
|
-
|
|
3585
|
+
te(D.filters),
|
|
3586
|
+
D.answer && /* @__PURE__ */ f("div", {
|
|
3390
3587
|
className: $.answer,
|
|
3391
|
-
children:
|
|
3588
|
+
children: a(D.answer, re(D.sources))
|
|
3392
3589
|
}),
|
|
3393
|
-
|
|
3590
|
+
j === "searching" && D.steps.length > 0 && /* @__PURE__ */ p("div", {
|
|
3394
3591
|
className: $.steps,
|
|
3395
|
-
children: [
|
|
3592
|
+
children: [D.steps.slice(0, -1).map((e, t) => /* @__PURE__ */ f("span", {
|
|
3396
3593
|
className: $.stepDone,
|
|
3397
3594
|
children: e
|
|
3398
|
-
}, t)), /* @__PURE__ */ p(
|
|
3595
|
+
}, t)), /* @__PURE__ */ p(F, { children: [D.steps[D.steps.length - 1], "β¦"] })]
|
|
3399
3596
|
}),
|
|
3400
|
-
|
|
3401
|
-
|
|
3597
|
+
j === "searching" && D.steps.length === 0 && /* @__PURE__ */ f(F, { children: "Searchingβ¦" }),
|
|
3598
|
+
j === "writing" && /* @__PURE__ */ f(F, {
|
|
3402
3599
|
spinner: "grow",
|
|
3403
3600
|
children: "Writingβ¦"
|
|
3404
3601
|
}),
|
|
3405
|
-
|
|
3602
|
+
j === "error" && /* @__PURE__ */ p(m, {
|
|
3406
3603
|
variant: "default",
|
|
3407
3604
|
icon: null,
|
|
3408
3605
|
children: [
|
|
3409
|
-
/* @__PURE__ */ f(g, { children:
|
|
3410
|
-
/* @__PURE__ */ f(h, { children:
|
|
3411
|
-
|
|
3606
|
+
/* @__PURE__ */ f(g, { children: D.error?.code === "nothingFound" ? "Nothing to answer from" : "The answer did not come through" }),
|
|
3607
|
+
/* @__PURE__ */ f(h, { children: D.error?.code === "nothingFound" ? "The search found no records about this. Try other words, or search instead." : D.error?.message }),
|
|
3608
|
+
D.error?.code !== "nothingFound" && /* @__PURE__ */ f("div", {
|
|
3412
3609
|
className: $.action,
|
|
3413
3610
|
children: /* @__PURE__ */ f(y, {
|
|
3414
3611
|
variant: "secondary",
|
|
3415
3612
|
size: "micro",
|
|
3416
|
-
iconLeft: /* @__PURE__ */ f(
|
|
3417
|
-
onClick: () => D
|
|
3613
|
+
iconLeft: /* @__PURE__ */ f(ne, {}),
|
|
3614
|
+
onClick: () => O(D.question, V.current),
|
|
3418
3615
|
children: "Try again"
|
|
3419
3616
|
})
|
|
3420
3617
|
})
|
|
3421
3618
|
]
|
|
3422
3619
|
}),
|
|
3423
|
-
|
|
3620
|
+
j === "limited" && /* @__PURE__ */ p(m, {
|
|
3424
3621
|
variant: "default",
|
|
3425
3622
|
icon: null,
|
|
3426
3623
|
children: [/* @__PURE__ */ f(g, { children: "Too many questions for now" }), /* @__PURE__ */ p(h, { children: [
|
|
3427
3624
|
"You can ask again in about ",
|
|
3428
|
-
|
|
3625
|
+
D.retryAfterSeconds && D.retryAfterSeconds > 90 ? `${Math.ceil(D.retryAfterSeconds / 60)} minutes` : "a minute",
|
|
3429
3626
|
". Search still works in the meantime."
|
|
3430
3627
|
] })]
|
|
3431
3628
|
}),
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
onCopy:
|
|
3435
|
-
copied:
|
|
3436
|
-
onFollowUp:
|
|
3629
|
+
j !== "error" && j !== "limited" && q(D.answer, D.sources, j === "answered"),
|
|
3630
|
+
j === "answered" && /* @__PURE__ */ f(_, {
|
|
3631
|
+
onCopy: J,
|
|
3632
|
+
copied: N,
|
|
3633
|
+
onFollowUp: X
|
|
3437
3634
|
})
|
|
3438
3635
|
]
|
|
3439
3636
|
})]
|
|
3440
3637
|
})]
|
|
3441
|
-
}),
|
|
3442
|
-
ref:
|
|
3443
|
-
value:
|
|
3444
|
-
onChange:
|
|
3445
|
-
onSend:
|
|
3446
|
-
onStop:
|
|
3447
|
-
streaming:
|
|
3638
|
+
}), n && /* @__PURE__ */ f(w, {
|
|
3639
|
+
ref: H,
|
|
3640
|
+
value: z,
|
|
3641
|
+
onChange: B,
|
|
3642
|
+
onSend: Y,
|
|
3643
|
+
onStop: A,
|
|
3644
|
+
streaming: D.busy,
|
|
3448
3645
|
placeholder: "Ask a follow-upβ¦",
|
|
3449
3646
|
"aria-label": "Ask a follow-up"
|
|
3450
3647
|
})]
|
|
3451
3648
|
});
|
|
3452
3649
|
};
|
|
3453
|
-
export {
|
|
3650
|
+
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 };
|