@indxsearch/intrface 3.13.1 β 3.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -0
- package/dist/components/SearchInput.d.ts +4 -2
- package/dist/context/SearchContext.d.ts +6 -0
- package/dist/context/useSearchExecution.d.ts +3 -1
- package/dist/index.cjs.js +3 -3
- package/dist/index.es.js +754 -728
- package/dist/intrface.css +1 -1
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -2,10 +2,10 @@ import "@indxsearch/systm/styles.css";
|
|
|
2
2
|
import e, { Component as t, createContext as n, memo as r, useCallback as i, useContext as a, useEffect as o, useMemo as s, useRef as c, useState as l } from "react";
|
|
3
3
|
import { SystemState as u } from "@indxsearch/indx-types";
|
|
4
4
|
import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
5
|
-
import { Alert as m, AlertDescription as h, AlertTitle as g, AnswerActions as _, AssistantMessage as v, Button as y, Checkbox as b, Chip as x, CitationList as S, CitationRef as C, Composer as w, FilterPanelBase as T, InputField as E,
|
|
6
|
-
import { Ai_agent as
|
|
7
|
-
|
|
8
|
-
var
|
|
5
|
+
import { Alert as m, AlertDescription as h, AlertTitle as g, AnswerActions as _, AssistantMessage as v, Button as y, Checkbox as b, Chip as x, CitationList as S, CitationRef as C, Composer as w, FilterPanelBase as T, InputField as E, Kbd as D, RadioButton as O, SearchField as k, Select as A, Skeleton as j, Slider as M, StreamStatus as N, ToggleSwitch as P, Tooltip as F, UserMessage as I } from "@indxsearch/systm";
|
|
6
|
+
import { Ai_agent as L, ArrowDown as R, ArrowRight as z, Cloud as B, Filter as V, Fuzzy_search as H, Hour_glass as U, Indx as W, Key as ee, Lock as G, Refresh as te, Search as K, Speedometer as ne, Warning as re, X_or_error as ie } from "@indxsearch/pixl";
|
|
7
|
+
// src/context/IndxApiError.ts
|
|
8
|
+
var q = class e extends Error {
|
|
9
9
|
status;
|
|
10
10
|
code;
|
|
11
11
|
problem;
|
|
@@ -29,14 +29,14 @@ var J = 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
|
+
}, J = class extends Error {
|
|
33
33
|
constructor(e) {
|
|
34
34
|
super(e), this.name = "SearchSetupError";
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
function
|
|
37
|
+
function ae(e, t) {
|
|
38
38
|
let n = e instanceof Error ? e.message : String(e);
|
|
39
|
-
if (e instanceof
|
|
39
|
+
if (e instanceof J) return {
|
|
40
40
|
kind: "setup",
|
|
41
41
|
message: n,
|
|
42
42
|
technical: n,
|
|
@@ -48,7 +48,7 @@ function ie(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 q) {
|
|
52
52
|
let r = {
|
|
53
53
|
message: n,
|
|
54
54
|
status: e.status,
|
|
@@ -113,17 +113,16 @@ function ie(e, t) {
|
|
|
113
113
|
retryable: !0
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
function ae({ url: e, team: t, dataset: n, preAuthenticatedToken: r, enableDebugLogs: i = !1 }) {
|
|
116
|
+
// src/context/useIndxAuth.ts
|
|
117
|
+
function oe({ url: e, team: t, dataset: n, preAuthenticatedToken: r, enableDebugLogs: i = !1 }) {
|
|
119
118
|
let [a, s] = l(null), [c, d] = l(!0), [f, p] = l([]), [m, h] = l([]), [g, _] = l([]), [v, y] = l({}), [b, x] = l({}), [S, C] = l({}), [w, T] = l(0), [E, D] = l(null), [O, k] = l(null), [A, j] = l(0);
|
|
120
119
|
return o(() => {
|
|
121
120
|
(async () => {
|
|
122
121
|
D(null), k(null), d(!0);
|
|
123
122
|
try {
|
|
124
|
-
if (!r) throw console.error("[Auth] β Missing bearer token"), console.error("[Auth] π‘ Pass preAuthenticatedToken to SearchProvider (create a token on the Indx Dashboard)"), new
|
|
125
|
-
if (!e) throw console.error("[Auth] β Missing INDX server URL"), console.error("[Auth] π‘ Pass a url to SearchProvider"), new
|
|
126
|
-
if (!n) throw console.error("[Auth] β Missing dataset name"), console.error("[Auth] π‘ Pass dataset=\"your-dataset-name\" to SearchProvider"), new
|
|
123
|
+
if (!r) throw console.error("[Auth] β Missing bearer token"), console.error("[Auth] π‘ Pass preAuthenticatedToken to SearchProvider (create a token on the Indx Dashboard)"), new J("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 J("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 J("Dataset name is required. Check console for instructions.");
|
|
127
126
|
i && console.log("[Auth] β
Using bearer token");
|
|
128
127
|
let a = r, o = (e) => fetch(e, {
|
|
129
128
|
method: "GET",
|
|
@@ -134,7 +133,7 @@ function ae({ url: e, team: t, dataset: n, preAuthenticatedToken: r, enableDebug
|
|
|
134
133
|
});
|
|
135
134
|
i && console.log("[Auth] π Checking dataset status...");
|
|
136
135
|
let c = await o(`${e}/api/teams/${t}/datasets/${n}/status`);
|
|
137
|
-
if (!c.ok) throw c.status === 401 ? (console.error("[Auth] β Authentication failed (401 Unauthorized)"), console.error("[Auth] π‘ Your token may be expired or invalid"), console.error("[Auth] π‘ Create or refresh your token on the Indx Dashboard"), await
|
|
136
|
+
if (!c.ok) throw c.status === 401 ? (console.error("[Auth] β Authentication failed (401 Unauthorized)"), console.error("[Auth] π‘ Your token may be expired or invalid"), console.error("[Auth] π‘ Create or refresh your token on the Indx Dashboard"), await q.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 q.fromResponse("Dataset status", c)) : (console.error("[Auth] β Failed to get dataset status:", c.status), await q.fromResponse("Dataset status", c));
|
|
138
137
|
let l = await c.json();
|
|
139
138
|
i && console.log("[Auth] π Dataset status:", l), s(a), i && console.log("[Auth] β
Dataset session established"), l.systemState !== void 0 && l.systemState !== u.Ready && (console.warn("[Auth] β οΈ Dataset is not ready yet. Current state:", u[l.systemState]), console.warn("[Auth] π‘ Wait for indexing to complete before searching"));
|
|
140
139
|
let d = l.documentCount ?? l.numberOfRecords ?? 0;
|
|
@@ -145,9 +144,9 @@ function ae({ url: e, team: t, dataset: n, preAuthenticatedToken: r, enableDebug
|
|
|
145
144
|
o(`${e}/api/teams/${t}/datasets/${n}/fields/sortable`),
|
|
146
145
|
o(`${e}/api/teams/${t}/datasets/${n}/fields/configuration`).catch(() => null)
|
|
147
146
|
]);
|
|
148
|
-
if (!f.ok) throw console.error("[Auth] β GetFilterableFields failed:", f.status), await
|
|
149
|
-
if (!m.ok) throw console.error("[Auth] β GetFacetableFields failed:", m.status), await
|
|
150
|
-
if (!g.ok) throw console.error("[Auth] β GetSortableFields failed:", g.status), await
|
|
147
|
+
if (!f.ok) throw console.error("[Auth] β GetFilterableFields failed:", f.status), await q.fromResponse("Filterable fields", f);
|
|
148
|
+
if (!m.ok) throw console.error("[Auth] β GetFacetableFields failed:", m.status), await q.fromResponse("Facetable fields", m);
|
|
149
|
+
if (!g.ok) throw console.error("[Auth] β GetSortableFields failed:", g.status), await q.fromResponse("Sortable fields", g);
|
|
151
150
|
let [b, S, w] = await Promise.all([
|
|
152
151
|
f.json().catch((e) => (console.error("Failed to parse GetFilterableFields response:", e), [])),
|
|
153
152
|
m.json().catch((e) => (console.error("Failed to parse GetFacetableFields response:", e), [])),
|
|
@@ -192,7 +191,7 @@ function ae({ url: e, team: t, dataset: n, preAuthenticatedToken: r, enableDebug
|
|
|
192
191
|
if (D.facets) for (let [e, t] of Object.entries(D.facets)) Array.isArray(t) && (k[e] = t.map((e) => e.key));
|
|
193
192
|
x(O), C(k), i && console.log("[Auth] β
Initialization complete");
|
|
194
193
|
} catch (r) {
|
|
195
|
-
console.error("[Auth] β Initialization failed:", r), (r instanceof Error || typeof r == "object" && r && "message" in r) && console.error("[Auth] π‘ Error:", r.message), r instanceof TypeError && r.message.includes("fetch") && (console.error("[Auth] β Network error - cannot connect to INDX server"), console.error("[Auth] π‘ Check if the server is running at:", e), console.error("[Auth] π‘ Check the url you passed to SearchProvider"), console.error("[Auth] π‘ For local development, it should be: http://localhost:5001")), D(r instanceof Error ? r.message : String(r)), k(
|
|
194
|
+
console.error("[Auth] β Initialization failed:", r), (r instanceof Error || typeof r == "object" && r && "message" in r) && console.error("[Auth] π‘ Error:", r.message), r instanceof TypeError && r.message.includes("fetch") && (console.error("[Auth] β Network error - cannot connect to INDX server"), console.error("[Auth] π‘ Check if the server is running at:", e), console.error("[Auth] π‘ Check the url you passed to SearchProvider"), console.error("[Auth] π‘ For local development, it should be: http://localhost:5001")), D(r instanceof Error ? r.message : String(r)), k(ae(r, {
|
|
196
195
|
team: t,
|
|
197
196
|
dataset: n
|
|
198
197
|
}));
|
|
@@ -220,32 +219,31 @@ function ae({ url: e, team: t, dataset: n, preAuthenticatedToken: r, enableDebug
|
|
|
220
219
|
totalDocumentCount: w
|
|
221
220
|
};
|
|
222
221
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
async function oe(e, t, n, r, i, a, o) {
|
|
222
|
+
// src/context/buildFilterProxy.ts
|
|
223
|
+
async function se(e, t, n, r, i, a, o) {
|
|
226
224
|
let s = await o(`${r}/api/teams/${i}/datasets/${a}/filters/${e}`, {
|
|
227
225
|
method: "POST",
|
|
228
226
|
headers: { "Content-Type": "application/json" },
|
|
229
227
|
body: JSON.stringify(t)
|
|
230
228
|
});
|
|
231
|
-
if (!s.ok) throw await
|
|
229
|
+
if (!s.ok) throw await q.fromResponse(n, s);
|
|
232
230
|
let c = await s.json();
|
|
233
231
|
if (!c || typeof c.hashString != "string") throw Error(`${n} failed: server returned no filter token`);
|
|
234
232
|
return c;
|
|
235
233
|
}
|
|
236
|
-
async function
|
|
234
|
+
async function ce(e, t, n, r, i, a) {
|
|
237
235
|
if (e.length === 0) return null;
|
|
238
236
|
if (e.length === 1) return e[0];
|
|
239
237
|
let o = e[0];
|
|
240
|
-
for (let s = 1; s < e.length; s++) o = await
|
|
238
|
+
for (let s = 1; s < e.length; s++) o = await se("combine", {
|
|
241
239
|
a: o,
|
|
242
240
|
b: e[s],
|
|
243
241
|
useAndOperation: t === "and"
|
|
244
242
|
}, "CombineFilters", n, r, i, a);
|
|
245
243
|
return o;
|
|
246
244
|
}
|
|
247
|
-
async function
|
|
248
|
-
let l = Object.entries(e ?? {}).filter(([, e]) => e.length > 0), u = Object.entries(t ?? {}), d = Object.entries(s ?? {}).filter(([, e]) => e.length > 0), f = (e, { min: t, max: o }) =>
|
|
245
|
+
async function le(e, t, n, r, i, a, o = {}, s = {}, c = {}) {
|
|
246
|
+
let l = Object.entries(e ?? {}).filter(([, e]) => e.length > 0), u = Object.entries(t ?? {}), d = Object.entries(s ?? {}).filter(([, e]) => e.length > 0), f = (e, { min: t, max: o }) => se("range", {
|
|
249
247
|
fieldName: e,
|
|
250
248
|
lowerLimit: t,
|
|
251
249
|
upperLimit: o
|
|
@@ -254,33 +252,32 @@ async function ce(e, t, n, r, i, a, o = {}, s = {}, c = {}) {
|
|
|
254
252
|
return Number.isFinite(o) ? f(e, {
|
|
255
253
|
min: o,
|
|
256
254
|
max: o
|
|
257
|
-
}) :
|
|
255
|
+
}) : se("value", {
|
|
258
256
|
fieldName: e,
|
|
259
257
|
value: t
|
|
260
258
|
}, `Value filter '${e}'`, n, r, i, a);
|
|
261
259
|
}, [m, h, g] = await Promise.all([
|
|
262
|
-
Promise.all(l.map(async ([e, t]) =>
|
|
260
|
+
Promise.all(l.map(async ([e, t]) => ce(await Promise.all(t.map((t) => p(e, t))), o[e] === "any" ? "or" : "and", n, r, i, a))),
|
|
263
261
|
Promise.all(u.map(([e, t]) => f(e, t))),
|
|
264
|
-
Promise.all(d.map(async ([e, t]) =>
|
|
262
|
+
Promise.all(d.map(async ([e, t]) => ce(await Promise.all(t.map((t) => f(e, t))), "or", n, r, i, a)))
|
|
265
263
|
]);
|
|
266
|
-
return
|
|
264
|
+
return ce([
|
|
267
265
|
...m,
|
|
268
266
|
...h,
|
|
269
267
|
...g
|
|
270
268
|
], "and", n, r, i, a);
|
|
271
269
|
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
function le(e, t) {
|
|
270
|
+
// src/context/useSearchExecution.ts
|
|
271
|
+
function ue(e, t) {
|
|
275
272
|
let n, r = (...r) => {
|
|
276
273
|
clearTimeout(n), n = setTimeout(() => e(...r), t);
|
|
277
274
|
};
|
|
278
275
|
return r.cancel = () => clearTimeout(n), r;
|
|
279
276
|
}
|
|
280
|
-
function
|
|
281
|
-
let
|
|
282
|
-
|
|
283
|
-
let
|
|
277
|
+
function de({ state: e, setState: t, authenticatedFetch: n, auth: r, url: a, team: s, dataset: u, allowEmptySearch: d, facetsEnabled: f, enableDebugLogs: p, shouldFetchMore: m, sessionId: h, source: g, locale: _, count: v, searchTextOf: y }) {
|
|
278
|
+
let b = y ? y(e.query) : e.query, x = c(e.query);
|
|
279
|
+
x.current = e.query;
|
|
280
|
+
let S = c(0), C = c(void 0), w = c(!1), [T, E] = l({}), [D, O] = l(""), [k, A] = l("");
|
|
284
281
|
o(() => {
|
|
285
282
|
r.isFetchingInitial || t((e) => ({
|
|
286
283
|
...e,
|
|
@@ -302,166 +299,168 @@ function ue({ state: e, setState: t, authenticatedFetch: n, auth: r, url: a, tea
|
|
|
302
299
|
r.sortableFields,
|
|
303
300
|
t
|
|
304
301
|
]);
|
|
305
|
-
let
|
|
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 }) => {
|
|
306
303
|
if (!r.token) return;
|
|
307
|
-
let o = ++
|
|
304
|
+
let o = ++S.current;
|
|
308
305
|
if (t((e) => ({
|
|
309
306
|
...e,
|
|
310
307
|
isLoading: !0
|
|
311
|
-
})),
|
|
308
|
+
})), b.trim() === "") {
|
|
312
309
|
if (!d) return;
|
|
313
310
|
i = !0;
|
|
314
311
|
}
|
|
315
312
|
try {
|
|
316
|
-
let c = i ? Array.from(new Set([...Object.keys(e.filters).filter((t) => e.valueMatch[t] === "any" && (e.filters[t]?.length ?? 0) > 0), ...Object.keys(e.bucketFilters).filter((t) => (e.bucketFilters[t]?.length ?? 0) > 0)])) : [], [l, ...f] = await Promise.all([
|
|
313
|
+
let c = i ? Array.from(/* @__PURE__ */ new Set([...Object.keys(e.filters).filter((t) => e.valueMatch[t] === "any" && (e.filters[t]?.length ?? 0) > 0), ...Object.keys(e.bucketFilters).filter((t) => (e.bucketFilters[t]?.length ?? 0) > 0)])) : [], [l, ...f] = await Promise.all([le(e.filters, e.rangeFilters, a, s, u, n, e.valueMatch, e.bucketFilters, e.fieldTypes), ...c.map((t) => le({
|
|
317
314
|
...e.filters,
|
|
318
315
|
[t]: []
|
|
319
316
|
}, e.rangeFilters, a, s, u, n, e.valueMatch, {
|
|
320
317
|
...e.bucketFilters,
|
|
321
318
|
[t]: []
|
|
322
|
-
}, e.fieldTypes))]), m = d ||
|
|
323
|
-
text:
|
|
324
|
-
enableCoverage:
|
|
325
|
-
removeDuplicates:
|
|
326
|
-
coverageDepth:
|
|
327
|
-
coverageSetup:
|
|
328
|
-
},
|
|
329
|
-
...
|
|
330
|
-
maxNumberOfRecordsToReturn: m ?
|
|
319
|
+
}, e.fieldTypes))]), m = d || b.trim() !== "", y = {
|
|
320
|
+
text: b,
|
|
321
|
+
enableCoverage: M,
|
|
322
|
+
removeDuplicates: N,
|
|
323
|
+
coverageDepth: P,
|
|
324
|
+
coverageSetup: I
|
|
325
|
+
}, C = {
|
|
326
|
+
...y,
|
|
327
|
+
maxNumberOfRecordsToReturn: m ? j : 0,
|
|
331
328
|
enableFacets: i,
|
|
332
329
|
...l ? { filter: l } : {},
|
|
333
|
-
...
|
|
334
|
-
...
|
|
330
|
+
...L ? { sortBy: L } : {},
|
|
331
|
+
...R === void 0 ? {} : { sortAscending: R }
|
|
335
332
|
};
|
|
336
|
-
p && console.log("[performSearch] request body:", JSON.stringify(
|
|
337
|
-
let
|
|
338
|
-
g &&
|
|
339
|
-
let
|
|
333
|
+
p && console.log("[performSearch] request body:", JSON.stringify(C, null, 2));
|
|
334
|
+
let w = new URLSearchParams({ session: h });
|
|
335
|
+
g && w.set("source", g);
|
|
336
|
+
let z = _ ?? fe();
|
|
337
|
+
z && w.set("locale", z), v || w.set("count", "false"), x.current.trim() !== b.trim() && w.set("typed", x.current);
|
|
338
|
+
let B = (e) => n(`${a}/api/teams/${s}/datasets/${u}/search?${w}`, {
|
|
340
339
|
method: "POST",
|
|
341
340
|
headers: { "Content-Type": "application/json" },
|
|
342
341
|
body: JSON.stringify(e)
|
|
343
|
-
}), [
|
|
344
|
-
...
|
|
342
|
+
}), [V, ...H] = await Promise.all([B(C), ...f.map((e) => B({
|
|
343
|
+
...y,
|
|
345
344
|
maxNumberOfRecordsToReturn: 0,
|
|
346
345
|
enableFacets: !0,
|
|
347
346
|
...e ? { filter: e } : {}
|
|
348
347
|
}))]);
|
|
349
|
-
if (!
|
|
350
|
-
let
|
|
348
|
+
if (!V.ok) throw await q.fromResponse("Search", V);
|
|
349
|
+
let U = await V.json(), W = V.headers.get("Indx-Query-Id") ?? void 0, ee = U.truncationIndex ?? -1, G = {};
|
|
351
350
|
for (let e = 0; e < c.length; e++) {
|
|
352
351
|
let t = c[e];
|
|
353
|
-
if (!
|
|
354
|
-
let n = await
|
|
355
|
-
n.facets?.[t] !== void 0 && (
|
|
352
|
+
if (!H[e].ok) throw await q.fromResponse(`Facets for '${t}'`, H[e]);
|
|
353
|
+
let n = await H[e].json();
|
|
354
|
+
n.facets?.[t] !== void 0 && (G[t] = n.facets[t]);
|
|
356
355
|
}
|
|
357
|
-
let
|
|
358
|
-
if (m &&
|
|
356
|
+
let te = U.records || [], K = te.map((e) => e.documentKey), ne = te.map((e) => e.score), re = [];
|
|
357
|
+
if (m && K.length > 0) {
|
|
359
358
|
let e = await n(`${a}/api/teams/${s}/datasets/${u}/documents/lookup`, {
|
|
360
359
|
method: "POST",
|
|
361
360
|
headers: { "Content-Type": "application/json" },
|
|
362
|
-
body: JSON.stringify(
|
|
361
|
+
body: JSON.stringify(K)
|
|
363
362
|
});
|
|
364
|
-
if (!e.ok) throw await
|
|
365
|
-
|
|
363
|
+
if (!e.ok) throw await q.fromResponse("Document lookup", e);
|
|
364
|
+
re = (await e.json()).map((e, t) => ({
|
|
366
365
|
document: e,
|
|
367
|
-
documentKey:
|
|
368
|
-
score:
|
|
366
|
+
documentKey: K[t],
|
|
367
|
+
score: ne[t]
|
|
369
368
|
}));
|
|
370
369
|
}
|
|
371
|
-
let
|
|
372
|
-
if (i &&
|
|
373
|
-
for (let [e, t] of Object.entries(
|
|
370
|
+
let ie = {};
|
|
371
|
+
if (i && U.facets) {
|
|
372
|
+
for (let [e, t] of Object.entries(U.facets)) if (Array.isArray(t) && t.length > 0) {
|
|
374
373
|
let n = t.map((e) => Number(e.key)).filter((e) => !isNaN(e));
|
|
375
|
-
n.length > 0 && (
|
|
374
|
+
n.length > 0 && (ie[e] = {
|
|
376
375
|
min: Math.min(...n),
|
|
377
376
|
max: Math.max(...n)
|
|
378
377
|
});
|
|
379
378
|
}
|
|
380
379
|
}
|
|
381
|
-
if (o !==
|
|
382
|
-
let
|
|
383
|
-
if (
|
|
380
|
+
if (o !== S.current) return;
|
|
381
|
+
let J = b !== D, ae = b !== k, oe = e.facetStats ?? {};
|
|
382
|
+
if (J ? (oe = {
|
|
384
383
|
...r.initialFacetStats,
|
|
385
|
-
...
|
|
386
|
-
},
|
|
387
|
-
...
|
|
388
|
-
...
|
|
389
|
-
},
|
|
384
|
+
...ie
|
|
385
|
+
}, E(oe), O(b)) : oe = {
|
|
386
|
+
...T,
|
|
387
|
+
...ie
|
|
388
|
+
}, ae && i) {
|
|
390
389
|
let n = { ...e.rangeBounds };
|
|
391
|
-
for (let [e, t] of Object.entries(
|
|
390
|
+
for (let [e, t] of Object.entries(ie)) n[e] = t;
|
|
392
391
|
t((e) => ({
|
|
393
392
|
...e,
|
|
394
393
|
rangeBounds: n
|
|
395
|
-
})),
|
|
394
|
+
})), A(b);
|
|
396
395
|
}
|
|
397
|
-
let
|
|
398
|
-
...
|
|
399
|
-
...
|
|
400
|
-
} :
|
|
401
|
-
if (i && (!
|
|
402
|
-
|
|
403
|
-
for (let [e, t] of Object.entries(r.initialFacetKeys))
|
|
396
|
+
let se = Object.keys(G).length > 0 ? {
|
|
397
|
+
...U.facets ?? {},
|
|
398
|
+
...G
|
|
399
|
+
} : U.facets;
|
|
400
|
+
if (i && (!se || Object.keys(se).length === 0)) {
|
|
401
|
+
se = {};
|
|
402
|
+
for (let [e, t] of Object.entries(r.initialFacetKeys)) se[e] = t.map((e) => ({
|
|
404
403
|
key: e,
|
|
405
404
|
value: null
|
|
406
405
|
}));
|
|
407
406
|
}
|
|
408
|
-
let
|
|
409
|
-
let t =
|
|
410
|
-
return t === "" || t.length === 1
|
|
407
|
+
let ce = re.filter((e) => {
|
|
408
|
+
let t = b.trim();
|
|
409
|
+
return t === "" || t.length === 1 || e.score >= F;
|
|
411
410
|
}).map((e, t) => ({
|
|
412
411
|
...e,
|
|
413
412
|
position: t + 1
|
|
414
413
|
}));
|
|
415
414
|
t((e) => ({
|
|
416
415
|
...e,
|
|
417
|
-
results:
|
|
416
|
+
results: ce,
|
|
418
417
|
error: void 0,
|
|
419
418
|
errorInfo: void 0,
|
|
420
419
|
resultsSuppressed: !m,
|
|
421
420
|
...i ? {
|
|
422
|
-
facets:
|
|
423
|
-
facetStats:
|
|
421
|
+
facets: se,
|
|
422
|
+
facetStats: oe
|
|
424
423
|
} : {},
|
|
425
424
|
isLoading: !1,
|
|
426
|
-
truncationIndex:
|
|
427
|
-
queryId:
|
|
425
|
+
truncationIndex: ee,
|
|
426
|
+
queryId: W
|
|
428
427
|
}));
|
|
429
428
|
} catch (e) {
|
|
430
|
-
if (console.error("[Search] β Search failed:", e), e instanceof TypeError && e.message.includes("fetch") ? (console.error("[Search] β Network error - cannot reach INDX server"), console.error("[Search] π‘ Check if server is running at:", a)) : e instanceof Error && (e.message.includes("401") ? (console.error("[Search] β Authentication failed"), console.error("[Search] π‘ Your token may have expired. Create or refresh it on the Indx Dashboard.")) : e.message.includes("404") ? (console.error("[Search] β Dataset not found"), console.error("[Search] π‘ Check that dataset \"" + u + "\" exists")) : console.error("[Search] π‘ Error:", e.message)), o !==
|
|
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)), o !== S.current) return;
|
|
431
430
|
t((t) => ({
|
|
432
431
|
...t,
|
|
433
432
|
results: null,
|
|
434
433
|
isLoading: !1,
|
|
435
434
|
resultsSuppressed: !1,
|
|
436
435
|
error: e instanceof Error ? e.message : "Search failed",
|
|
437
|
-
errorInfo:
|
|
436
|
+
errorInfo: ae(e, {
|
|
438
437
|
team: s,
|
|
439
438
|
dataset: u
|
|
440
439
|
})
|
|
441
440
|
}));
|
|
442
441
|
}
|
|
443
442
|
}, [
|
|
444
|
-
|
|
443
|
+
b,
|
|
445
444
|
e.filters,
|
|
446
445
|
e.valueMatch,
|
|
447
446
|
e.rangeFilters,
|
|
448
447
|
e.bucketFilters,
|
|
449
448
|
e.facetStats,
|
|
450
|
-
I,
|
|
451
449
|
L,
|
|
452
|
-
|
|
450
|
+
R,
|
|
453
451
|
j,
|
|
454
452
|
M,
|
|
455
453
|
N,
|
|
456
|
-
F,
|
|
457
454
|
P,
|
|
455
|
+
I,
|
|
456
|
+
F,
|
|
458
457
|
n,
|
|
459
458
|
r.initialFacetStats,
|
|
460
459
|
r.initialFacetKeys,
|
|
461
460
|
r.token,
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
461
|
+
T,
|
|
462
|
+
D,
|
|
463
|
+
k,
|
|
465
464
|
e.rangeBounds,
|
|
466
465
|
a,
|
|
467
466
|
s,
|
|
@@ -471,90 +470,91 @@ function ue({ state: e, setState: t, authenticatedFetch: n, auth: r, url: a, tea
|
|
|
471
470
|
t,
|
|
472
471
|
h,
|
|
473
472
|
g,
|
|
474
|
-
_
|
|
473
|
+
_,
|
|
474
|
+
v
|
|
475
475
|
]);
|
|
476
476
|
o(() => {
|
|
477
|
-
|
|
478
|
-
}, [
|
|
479
|
-
let
|
|
480
|
-
o(() => (
|
|
481
|
-
p && console.log("Debounced searchWithFacets fired"),
|
|
477
|
+
C.current = z;
|
|
478
|
+
}, [z]);
|
|
479
|
+
let B = c(null);
|
|
480
|
+
o(() => (B.current?.cancel(), B.current = ue(() => {
|
|
481
|
+
p && console.log("Debounced searchWithFacets fired"), C.current?.({ enableFacets: !0 });
|
|
482
482
|
}, e.facetDebounceDelayMillis ?? 500), () => {
|
|
483
|
-
|
|
483
|
+
B.current?.cancel();
|
|
484
484
|
}), [e.facetDebounceDelayMillis]), o(() => {
|
|
485
|
-
!r.isFetchingInitial && r.token && !
|
|
485
|
+
!r.isFetchingInitial && r.token && !w.current && (d && C.current?.({ enableFacets: f }), w.current = !0);
|
|
486
486
|
}, [
|
|
487
487
|
r.isFetchingInitial,
|
|
488
488
|
r.token,
|
|
489
489
|
d,
|
|
490
490
|
f
|
|
491
491
|
]), o(() => {
|
|
492
|
-
if (!r.token || !
|
|
493
|
-
let n =
|
|
494
|
-
if (n === "" && !d) {
|
|
495
|
-
e
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
}
|
|
501
|
-
return i ? (z.current?.cancel(), S.current?.({ enableFacets: f })) : f ? (p && console.log("Search fired"), S.current?.({ enableFacets: !1 }), z.current?.()) : S.current?.({ enableFacets: !1 }), () => {
|
|
502
|
-
z.current?.cancel();
|
|
492
|
+
if (!r.token || !w.current) return;
|
|
493
|
+
let n = b.trim(), i = n === "" && d;
|
|
494
|
+
if (n === "" && !d) e.resultsSuppressed || t((e) => ({
|
|
495
|
+
...e,
|
|
496
|
+
resultsSuppressed: !0
|
|
497
|
+
}));
|
|
498
|
+
else return i ? (B.current?.cancel(), C.current?.({ enableFacets: f })) : f ? (p && console.log("Search fired"), C.current?.({ enableFacets: !1 }), B.current?.()) : C.current?.({ enableFacets: !1 }), () => {
|
|
499
|
+
B.current?.cancel();
|
|
503
500
|
};
|
|
504
501
|
}, [
|
|
505
|
-
|
|
502
|
+
b,
|
|
506
503
|
d,
|
|
507
504
|
f
|
|
508
505
|
]), o(() => {
|
|
509
|
-
if (!
|
|
510
|
-
let t =
|
|
511
|
-
|
|
506
|
+
if (!w.current || !r.token || e.filterRevision === 0) return;
|
|
507
|
+
let t = b.trim();
|
|
508
|
+
(d || t !== "") && C.current?.({ enableFacets: f });
|
|
512
509
|
}, [e.filterRevision]), o(() => {
|
|
513
|
-
if (!
|
|
514
|
-
let e =
|
|
515
|
-
|
|
516
|
-
}, [
|
|
517
|
-
let
|
|
510
|
+
if (!w.current || !r.token) return;
|
|
511
|
+
let e = b.trim();
|
|
512
|
+
(d || e !== "") && C.current?.({ enableFacets: f });
|
|
513
|
+
}, [L, R]);
|
|
514
|
+
let V = c(!0), H = c(b);
|
|
518
515
|
return o(() => {
|
|
519
|
-
if (
|
|
520
|
-
|
|
516
|
+
if (V.current) {
|
|
517
|
+
V.current = !1;
|
|
521
518
|
return;
|
|
522
519
|
}
|
|
523
|
-
if (
|
|
520
|
+
if (H.current !== b || !w.current || !r.token) return;
|
|
524
521
|
if (m.current) {
|
|
525
|
-
m.current = !1,
|
|
522
|
+
m.current = !1, C.current?.({ enableFacets: !1 });
|
|
526
523
|
return;
|
|
527
524
|
}
|
|
528
|
-
let e =
|
|
529
|
-
|
|
525
|
+
let e = b.trim();
|
|
526
|
+
(d || e !== "") && C.current?.({ enableFacets: f });
|
|
530
527
|
}, [
|
|
531
|
-
A,
|
|
532
528
|
j,
|
|
533
529
|
M,
|
|
534
530
|
N,
|
|
535
|
-
|
|
536
|
-
|
|
531
|
+
P,
|
|
532
|
+
I,
|
|
533
|
+
F
|
|
537
534
|
]), o(() => {
|
|
538
|
-
|
|
539
|
-
}, [
|
|
540
|
-
|
|
535
|
+
H.current = b;
|
|
536
|
+
}, [b]), { retrySearch: i(() => {
|
|
537
|
+
C.current?.({ enableFacets: f });
|
|
541
538
|
}, [f]) };
|
|
542
539
|
}
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
540
|
+
function fe() {
|
|
541
|
+
if (typeof document < "u" && document.documentElement.lang) return document.documentElement.lang;
|
|
542
|
+
if (typeof navigator < "u" && navigator.language) return navigator.language;
|
|
543
|
+
}
|
|
544
|
+
// src/context/SearchContext.tsx
|
|
545
|
+
function pe() {
|
|
546
546
|
let e = globalThis.crypto;
|
|
547
547
|
return e?.randomUUID ? e.randomUUID() : Math.random().toString(36).slice(2) + Date.now().toString(36);
|
|
548
548
|
}
|
|
549
|
-
var
|
|
550
|
-
let
|
|
551
|
-
let t =
|
|
552
|
-
return !t || e ===
|
|
549
|
+
var me = "Type to search", he = n(void 0), ge = ({ children: e, url: t, team: n, dataset: r, allowEmptySearch: a = !1, maxResults: s = 10, facetDebounceDelayMillis: u = 500, enableFacets: d = !0, coverageDepth: p, removeDuplicates: m = !0, enableCoverage: h = !0, initialCoverageSetup: g = {}, enableDebugLogs: _ = !1, preAuthenticatedToken: v, source: y, locale: b, count: x = !0, searchTextOf: S }) => {
|
|
550
|
+
let C = c(!1), w = c(pe()).current, [T, E] = l({ fn: null }), [D, O] = l(null), k = i((e) => {
|
|
551
|
+
let t = S ?? T.fn;
|
|
552
|
+
return !t || e === D ? e : t(e);
|
|
553
553
|
}, [
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
]),
|
|
554
|
+
S,
|
|
555
|
+
T,
|
|
556
|
+
D
|
|
557
|
+
]), A = i((e) => E({ fn: e }), []), j = c(s), [M, N] = l({
|
|
558
558
|
query: "",
|
|
559
559
|
results: null,
|
|
560
560
|
isLoading: !1,
|
|
@@ -579,77 +579,108 @@ var fe = "Type to search", pe = n(void 0), me = ({ children: e, url: t, team: n,
|
|
|
579
579
|
removeDuplicates: m,
|
|
580
580
|
minimumScore: 0,
|
|
581
581
|
showScore: !0,
|
|
582
|
-
placeholderText:
|
|
582
|
+
placeholderText: me,
|
|
583
583
|
coverageSetup: { ...g }
|
|
584
584
|
}
|
|
585
585
|
});
|
|
586
586
|
o(() => {
|
|
587
587
|
_ && console.log("SearchContext mounted on client");
|
|
588
588
|
}, [_]), o(() => {
|
|
589
|
-
|
|
589
|
+
N((e) => ({
|
|
590
590
|
...e,
|
|
591
591
|
facetDebounceDelayMillis: u
|
|
592
592
|
}));
|
|
593
593
|
}, [u]);
|
|
594
|
-
let [
|
|
594
|
+
let [P] = l(d), F = oe({
|
|
595
595
|
url: t,
|
|
596
596
|
team: n,
|
|
597
597
|
dataset: r,
|
|
598
598
|
preAuthenticatedToken: v,
|
|
599
599
|
enableDebugLogs: _
|
|
600
|
-
}),
|
|
601
|
-
if (!
|
|
600
|
+
}), I = i((e, t = {}) => {
|
|
601
|
+
if (!F.token) throw Error("No authentication token available");
|
|
602
602
|
return fetch(e, {
|
|
603
603
|
...t,
|
|
604
604
|
headers: {
|
|
605
605
|
...t.headers,
|
|
606
|
-
Authorization: `Bearer ${
|
|
606
|
+
Authorization: `Bearer ${F.token}`
|
|
607
607
|
}
|
|
608
608
|
});
|
|
609
|
-
}, [
|
|
610
|
-
state:
|
|
611
|
-
setState:
|
|
612
|
-
authenticatedFetch:
|
|
613
|
-
auth:
|
|
609
|
+
}, [F.token]), { retrySearch: L } = de({
|
|
610
|
+
state: M,
|
|
611
|
+
setState: N,
|
|
612
|
+
authenticatedFetch: I,
|
|
613
|
+
auth: F,
|
|
614
614
|
url: t,
|
|
615
615
|
team: n,
|
|
616
616
|
dataset: r,
|
|
617
617
|
allowEmptySearch: a,
|
|
618
|
-
facetsEnabled:
|
|
618
|
+
facetsEnabled: P,
|
|
619
619
|
enableDebugLogs: _,
|
|
620
|
-
shouldFetchMore:
|
|
621
|
-
sessionId:
|
|
620
|
+
shouldFetchMore: C,
|
|
621
|
+
sessionId: w,
|
|
622
622
|
source: y,
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
623
|
+
locale: b,
|
|
624
|
+
count: x,
|
|
625
|
+
searchTextOf: k
|
|
626
|
+
}), R = c(void 0);
|
|
627
|
+
R.current = M.queryId;
|
|
628
|
+
let z = c(/* @__PURE__ */ new Map()), B = i(async (e) => {
|
|
629
|
+
if (F.token) {
|
|
630
|
+
z.current.set(e.documentKey, R.current);
|
|
631
|
+
try {
|
|
632
|
+
let i = await I(`${t}/api/teams/${n}/datasets/${r}/events/select`, {
|
|
633
|
+
method: "POST",
|
|
634
|
+
headers: { "Content-Type": "application/json" },
|
|
635
|
+
body: JSON.stringify({
|
|
636
|
+
queryId: R.current,
|
|
637
|
+
documentKey: e.documentKey,
|
|
638
|
+
position: e.position,
|
|
639
|
+
...x ? {} : { count: !1 }
|
|
640
|
+
})
|
|
641
|
+
});
|
|
642
|
+
_ && (i.ok ? console.log(`[select] document ${e.documentKey} at position ${e.position}`) : console.warn(`[select] not recorded: ${i.status}`));
|
|
643
|
+
} catch (e) {
|
|
644
|
+
_ && console.warn("[select] failed:", e);
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
}, [
|
|
648
|
+
F.token,
|
|
649
|
+
I,
|
|
650
|
+
t,
|
|
651
|
+
n,
|
|
652
|
+
r,
|
|
653
|
+
_,
|
|
654
|
+
x
|
|
655
|
+
]), V = i(async (e, i, a) => {
|
|
656
|
+
if (!F.token || !i.trim()) return;
|
|
657
|
+
let o = a?.queryId ?? z.current.get(e) ?? R.current;
|
|
658
|
+
try {
|
|
659
|
+
let s = await I(`${t}/api/teams/${n}/datasets/${r}/events/convert`, {
|
|
630
660
|
method: "POST",
|
|
631
661
|
headers: { "Content-Type": "application/json" },
|
|
632
662
|
body: JSON.stringify({
|
|
633
|
-
queryId:
|
|
634
|
-
documentKey: e
|
|
635
|
-
|
|
636
|
-
...
|
|
663
|
+
queryId: o,
|
|
664
|
+
documentKey: e,
|
|
665
|
+
type: i.trim(),
|
|
666
|
+
...a?.quantity == null ? {} : { quantity: a.quantity },
|
|
667
|
+
...x ? {} : { count: !1 }
|
|
637
668
|
})
|
|
638
669
|
});
|
|
639
|
-
_ && (
|
|
670
|
+
_ && (s.ok ? console.log(`[convert] ${i} on document ${e}`) : console.warn(`[convert] not recorded: ${s.status}`));
|
|
640
671
|
} catch (e) {
|
|
641
|
-
_ && console.warn("[
|
|
672
|
+
_ && console.warn("[convert] failed:", e);
|
|
642
673
|
}
|
|
643
674
|
}, [
|
|
644
|
-
|
|
645
|
-
|
|
675
|
+
F.token,
|
|
676
|
+
I,
|
|
646
677
|
t,
|
|
647
678
|
n,
|
|
648
679
|
r,
|
|
649
680
|
_,
|
|
650
|
-
|
|
651
|
-
]),
|
|
652
|
-
|
|
681
|
+
x
|
|
682
|
+
]), H = i((e) => {
|
|
683
|
+
N((t) => {
|
|
653
684
|
let n = Object.keys(t.filters).length > 0, r = Object.keys(t.rangeFilters).length > 0, i = Object.keys(t.bucketFilters).length > 0;
|
|
654
685
|
return {
|
|
655
686
|
...t,
|
|
@@ -659,39 +690,39 @@ var fe = "Type to search", pe = n(void 0), me = ({ children: e, url: t, team: n,
|
|
|
659
690
|
bucketFilters: i ? {} : t.bucketFilters,
|
|
660
691
|
searchSettings: {
|
|
661
692
|
...t.searchSettings,
|
|
662
|
-
maxNumberOfRecordsToReturn:
|
|
693
|
+
maxNumberOfRecordsToReturn: j.current
|
|
663
694
|
}
|
|
664
695
|
};
|
|
665
696
|
});
|
|
666
|
-
}, []),
|
|
667
|
-
|
|
697
|
+
}, []), U = i((e) => {
|
|
698
|
+
N((t) => ({
|
|
668
699
|
...t,
|
|
669
700
|
facetDebounceDelayMillis: e
|
|
670
701
|
}));
|
|
671
|
-
}, []),
|
|
672
|
-
typeof e.maxNumberOfRecordsToReturn == "number" && (
|
|
702
|
+
}, []), W = i((e) => {
|
|
703
|
+
typeof e.maxNumberOfRecordsToReturn == "number" && (j.current = e.maxNumberOfRecordsToReturn), N((t) => {
|
|
673
704
|
let n = {
|
|
674
705
|
...t.searchSettings,
|
|
675
706
|
...e
|
|
676
707
|
};
|
|
677
|
-
return "coverageSetup" in e ? e.coverageSetup ?
|
|
708
|
+
return n.coverageSetup = "coverageSetup" in e ? e.coverageSetup ? {
|
|
678
709
|
...t.searchSettings.coverageSetup,
|
|
679
710
|
...e.coverageSetup
|
|
680
|
-
} :
|
|
711
|
+
} : {} : t.searchSettings.coverageSetup, {
|
|
681
712
|
...t,
|
|
682
713
|
searchSettings: n
|
|
683
714
|
};
|
|
684
715
|
});
|
|
685
|
-
}, []),
|
|
686
|
-
|
|
716
|
+
}, []), ee = i((e) => {
|
|
717
|
+
C.current = !0, N((t) => ({
|
|
687
718
|
...t,
|
|
688
719
|
searchSettings: {
|
|
689
720
|
...t.searchSettings,
|
|
690
721
|
maxNumberOfRecordsToReturn: e
|
|
691
722
|
}
|
|
692
723
|
}));
|
|
693
|
-
}, []),
|
|
694
|
-
|
|
724
|
+
}, []), G = i((e, t, n = !1) => {
|
|
725
|
+
N((r) => {
|
|
695
726
|
let i = { ...r.filters }, a = i[e] || [], o = a.includes(t) ? a.filter((e) => e !== t) : n ? [t] : [...a, t];
|
|
696
727
|
return o.length ? i[e] = o : delete i[e], {
|
|
697
728
|
...r,
|
|
@@ -699,16 +730,16 @@ var fe = "Type to search", pe = n(void 0), me = ({ children: e, url: t, team: n,
|
|
|
699
730
|
filterRevision: r.filterRevision + 1
|
|
700
731
|
};
|
|
701
732
|
});
|
|
702
|
-
}, []),
|
|
703
|
-
|
|
733
|
+
}, []), te = i((e, t) => {
|
|
734
|
+
N((n) => n.valueMatch[e] === t ? n : {
|
|
704
735
|
...n,
|
|
705
736
|
valueMatch: {
|
|
706
737
|
...n.valueMatch,
|
|
707
738
|
[e]: t
|
|
708
739
|
}
|
|
709
740
|
});
|
|
710
|
-
}, []),
|
|
711
|
-
|
|
741
|
+
}, []), K = i((e, t, n) => {
|
|
742
|
+
N((r) => ({
|
|
712
743
|
...r,
|
|
713
744
|
rangeFilters: {
|
|
714
745
|
...r.rangeFilters,
|
|
@@ -719,16 +750,16 @@ var fe = "Type to search", pe = n(void 0), me = ({ children: e, url: t, team: n,
|
|
|
719
750
|
},
|
|
720
751
|
filterRevision: r.filterRevision + 1
|
|
721
752
|
}));
|
|
722
|
-
}, []),
|
|
723
|
-
|
|
753
|
+
}, []), ne = i(() => {
|
|
754
|
+
N((e) => ({
|
|
724
755
|
...e,
|
|
725
756
|
filters: {},
|
|
726
757
|
rangeFilters: {},
|
|
727
758
|
bucketFilters: {},
|
|
728
759
|
filterRevision: e.filterRevision + 1
|
|
729
760
|
}));
|
|
730
|
-
}, []),
|
|
731
|
-
|
|
761
|
+
}, []), re = i((e, t, n = !0) => {
|
|
762
|
+
N((r) => {
|
|
732
763
|
let i = { ...r.filters }, a = (i[e] || []).filter((e) => e !== t);
|
|
733
764
|
return a.length > 0 ? i[e] = a : delete i[e], {
|
|
734
765
|
...r,
|
|
@@ -736,8 +767,8 @@ var fe = "Type to search", pe = n(void 0), me = ({ children: e, url: t, team: n,
|
|
|
736
767
|
filterRevision: r.filterRevision + +!!n
|
|
737
768
|
};
|
|
738
769
|
});
|
|
739
|
-
}, []),
|
|
740
|
-
|
|
770
|
+
}, []), ie = i((e, t = !0) => {
|
|
771
|
+
N((n) => {
|
|
741
772
|
if (!(e in n.rangeFilters)) return n;
|
|
742
773
|
let r = { ...n.rangeFilters };
|
|
743
774
|
return delete r[e], {
|
|
@@ -746,8 +777,8 @@ var fe = "Type to search", pe = n(void 0), me = ({ children: e, url: t, team: n,
|
|
|
746
777
|
filterRevision: n.filterRevision + +!!t
|
|
747
778
|
};
|
|
748
779
|
});
|
|
749
|
-
}, []), q = (e, t) => e.min === t.min && e.max === t.max,
|
|
750
|
-
|
|
780
|
+
}, []), q = (e, t) => e.min === t.min && e.max === t.max, J = i((e, t, n = !1) => {
|
|
781
|
+
N((r) => {
|
|
751
782
|
let i = r.bucketFilters[e] ?? [], a = i.some((e) => q(e, t)) ? i.filter((e) => !q(e, t)) : n ? [t] : [...i, t], o = { ...r.bucketFilters };
|
|
752
783
|
return a.length > 0 ? o[e] = a : delete o[e], {
|
|
753
784
|
...r,
|
|
@@ -755,8 +786,8 @@ var fe = "Type to search", pe = n(void 0), me = ({ children: e, url: t, team: n,
|
|
|
755
786
|
filterRevision: r.filterRevision + 1
|
|
756
787
|
};
|
|
757
788
|
});
|
|
758
|
-
}, []),
|
|
759
|
-
|
|
789
|
+
}, []), ae = i((e, t, n = !0) => {
|
|
790
|
+
N((r) => {
|
|
760
791
|
let i = { ...r.bucketFilters }, a = t ? (i[e] ?? []).filter((e) => !q(e, t)) : [];
|
|
761
792
|
return a.length > 0 ? i[e] = a : delete i[e], {
|
|
762
793
|
...r,
|
|
@@ -764,94 +795,95 @@ var fe = "Type to search", pe = n(void 0), me = ({ children: e, url: t, team: n,
|
|
|
764
795
|
filterRevision: r.filterRevision + +!!n
|
|
765
796
|
};
|
|
766
797
|
});
|
|
767
|
-
}, []),
|
|
768
|
-
|
|
798
|
+
}, []), se = i((e, t) => {
|
|
799
|
+
N((n) => ({
|
|
769
800
|
...n,
|
|
770
801
|
sortBy: e || void 0,
|
|
771
802
|
sortAscending: e ? t : void 0
|
|
772
803
|
}));
|
|
773
804
|
}, []);
|
|
774
|
-
return /* @__PURE__ */ f(
|
|
805
|
+
return /* @__PURE__ */ f(he.Provider, {
|
|
775
806
|
value: {
|
|
776
|
-
state:
|
|
777
|
-
isFetchingInitial:
|
|
778
|
-
authError:
|
|
779
|
-
authErrorInfo:
|
|
780
|
-
retry:
|
|
807
|
+
state: M,
|
|
808
|
+
isFetchingInitial: F.isFetchingInitial || !M.fieldsSeeded,
|
|
809
|
+
authError: F.authError ?? void 0,
|
|
810
|
+
authErrorInfo: F.authErrorInfo ?? void 0,
|
|
811
|
+
retry: F.authError ? F.retry : L,
|
|
781
812
|
allowEmptySearch: a,
|
|
782
|
-
facetsEnabled:
|
|
783
|
-
datasetBounds:
|
|
813
|
+
facetsEnabled: P,
|
|
814
|
+
datasetBounds: F.initialFacetStats,
|
|
784
815
|
url: t,
|
|
785
816
|
team: n,
|
|
786
817
|
dataset: r,
|
|
787
|
-
authenticatedFetch:
|
|
788
|
-
setQuery:
|
|
789
|
-
toggleFilter:
|
|
790
|
-
setValueMatch:
|
|
791
|
-
setRangeFilter:
|
|
792
|
-
resetFilters:
|
|
793
|
-
resetSingleFilter:
|
|
794
|
-
resetRangeFilter:
|
|
795
|
-
toggleBucketFilter:
|
|
796
|
-
resetBucketFilter:
|
|
797
|
-
setSort:
|
|
798
|
-
setDebounceDelay:
|
|
799
|
-
setSearchSettings:
|
|
800
|
-
fetchMoreResults:
|
|
801
|
-
selectResult:
|
|
802
|
-
|
|
818
|
+
authenticatedFetch: I,
|
|
819
|
+
setQuery: H,
|
|
820
|
+
toggleFilter: G,
|
|
821
|
+
setValueMatch: te,
|
|
822
|
+
setRangeFilter: K,
|
|
823
|
+
resetFilters: ne,
|
|
824
|
+
resetSingleFilter: re,
|
|
825
|
+
resetRangeFilter: ie,
|
|
826
|
+
toggleBucketFilter: J,
|
|
827
|
+
resetBucketFilter: ae,
|
|
828
|
+
setSort: se,
|
|
829
|
+
setDebounceDelay: U,
|
|
830
|
+
setSearchSettings: W,
|
|
831
|
+
fetchMoreResults: ee,
|
|
832
|
+
selectResult: B,
|
|
833
|
+
convertResult: V,
|
|
834
|
+
sessionId: w,
|
|
803
835
|
source: y,
|
|
804
|
-
count:
|
|
805
|
-
searchText:
|
|
806
|
-
searchAsTyped: () =>
|
|
807
|
-
setSearchRewrite:
|
|
836
|
+
count: x,
|
|
837
|
+
searchText: k(M.query),
|
|
838
|
+
searchAsTyped: () => O(M.query),
|
|
839
|
+
setSearchRewrite: A
|
|
808
840
|
},
|
|
809
841
|
children: e
|
|
810
842
|
});
|
|
811
|
-
},
|
|
812
|
-
let e = a(
|
|
843
|
+
}, Y = () => {
|
|
844
|
+
let e = a(he);
|
|
813
845
|
if (!e) throw Error("useSearchContext must be used within a SearchProvider");
|
|
814
846
|
return e;
|
|
815
|
-
},
|
|
847
|
+
}, _e = {
|
|
816
848
|
strong: .65,
|
|
817
849
|
strongHide: .45,
|
|
818
850
|
invite: .4,
|
|
819
851
|
inviteHide: .3
|
|
820
|
-
},
|
|
821
|
-
function
|
|
852
|
+
}, ve = /* @__PURE__ */ new Set(/* @__PURE__ */ "hvordan.hva.hvorfor.hvor.hvilken.hvilke.hvilket.hvem.nΓ₯r.kan.skal.mΓ₯.bΓΈr.er.gΓ₯r.finnes.trenger.how.what.why.where.which.who.when.can.should.does.do.is.are.will.could.would".split(".")), ye = /^[\d\s\-_.:/]+$|^\w+\.\w+|^[A-Za-z]*[a-z][A-Z]\w*$|^[A-Za-z]+[-_]?\d[\w-]*$/;
|
|
853
|
+
function be(e) {
|
|
822
854
|
let t = e.trim();
|
|
823
|
-
return t.length > 0 && !t.includes(" ") &&
|
|
855
|
+
return t.length > 0 && !t.includes(" ") && ye.test(t);
|
|
824
856
|
}
|
|
825
|
-
function
|
|
857
|
+
function xe(e) {
|
|
826
858
|
let t = e.trim();
|
|
827
|
-
if (!t ||
|
|
859
|
+
if (!t || be(t)) return !1;
|
|
828
860
|
let n = t.split(/\s+/);
|
|
829
|
-
return t.endsWith("?") || n.length > 1 &&
|
|
861
|
+
return t.endsWith("?") || n.length > 1 && ve.has(n[0].toLowerCase()) || n.length >= 3 ? !0 : t.length >= 4;
|
|
830
862
|
}
|
|
831
|
-
function
|
|
863
|
+
function Se(e, t, n = _e) {
|
|
832
864
|
return t >= n.strong || e === "strong" && t >= n.strongHide ? "strong" : t >= n.invite || e !== "none" && t >= n.inviteHide ? "invite" : "none";
|
|
833
865
|
}
|
|
834
|
-
var
|
|
866
|
+
var Ce = {
|
|
835
867
|
shareOfTop: .5,
|
|
836
868
|
topFloor: .2
|
|
837
|
-
},
|
|
869
|
+
}, we = {
|
|
838
870
|
coverFuzzyWords: !1,
|
|
839
871
|
coverPrefixSuffix: !1,
|
|
840
872
|
coverJoinedWords: !1,
|
|
841
873
|
minWordSize: 3
|
|
842
|
-
},
|
|
843
|
-
function
|
|
874
|
+
}, Te = 65535;
|
|
875
|
+
function Ee(e, t, n, r = Ce) {
|
|
844
876
|
if (!n || e.length === 0) return e;
|
|
845
877
|
let i = e[0].score;
|
|
846
878
|
if (i < r.topFloor * 65535) return [];
|
|
847
879
|
let a = t == null ? e : t < 0 ? [] : e.slice(0, t + 1), o = r.shareOfTop * i, s = a.findIndex((e) => e.score < o);
|
|
848
880
|
return s < 0 ? a : a.slice(0, s);
|
|
849
881
|
}
|
|
850
|
-
function
|
|
882
|
+
function De(e) {
|
|
851
883
|
let t = e.trim();
|
|
852
884
|
return t.includes(" ") || t.endsWith("?");
|
|
853
885
|
}
|
|
854
|
-
async function*
|
|
886
|
+
async function* Oe(e) {
|
|
855
887
|
let t = e.getReader(), n = new TextDecoder(), r = "";
|
|
856
888
|
try {
|
|
857
889
|
for (;;) {
|
|
@@ -874,36 +906,35 @@ async function* Ee(e) {
|
|
|
874
906
|
t.releaseLock();
|
|
875
907
|
}
|
|
876
908
|
}
|
|
877
|
-
function
|
|
909
|
+
function ke(e) {
|
|
878
910
|
let t = new URLSearchParams();
|
|
879
911
|
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");
|
|
880
912
|
let n = t.toString();
|
|
881
913
|
return n ? `?${n}` : "";
|
|
882
914
|
}
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
function je(e, t) {
|
|
915
|
+
// src/utils/askPhrases.ts
|
|
916
|
+
var Ae = (e) => e.toLowerCase().replace(/β/g, "'").split(/\s+/).filter(Boolean), je = /[?!.,]+$/, Me = 2;
|
|
917
|
+
function Ne(e, t) {
|
|
887
918
|
let n = 0;
|
|
888
919
|
for (let r of t) {
|
|
889
|
-
let t =
|
|
890
|
-
t.length > n && t.length <= e.length && t.every((n, r) => e[e.length - t.length + r].replace(
|
|
920
|
+
let t = Ae(r);
|
|
921
|
+
t.length > n && t.length <= e.length && t.every((n, r) => e[e.length - t.length + r].replace(je, "") === n) && (n = t.length);
|
|
891
922
|
}
|
|
892
923
|
return n;
|
|
893
924
|
}
|
|
894
|
-
function
|
|
925
|
+
function Pe(e, t, n) {
|
|
895
926
|
let r = 0;
|
|
896
927
|
for (let i of n) {
|
|
897
|
-
let n =
|
|
898
|
-
n.length > r && t + n.length <= e.length && n.every((n, r) => e[t + r].replace(
|
|
928
|
+
let n = Ae(i);
|
|
929
|
+
n.length > r && t + n.length <= e.length && n.every((n, r) => e[t + r].replace(je, "") === n) && (r = n.length);
|
|
899
930
|
}
|
|
900
931
|
return r;
|
|
901
932
|
}
|
|
902
|
-
function
|
|
903
|
-
let n = e.trim().split(/\s+/).filter(Boolean), r =
|
|
904
|
-
let t =
|
|
933
|
+
function Fe(e, t) {
|
|
934
|
+
let n = e.trim().split(/\s+/).filter(Boolean), r = Ae(e), i = 0, a = [], o = (e) => {
|
|
935
|
+
let t = Pe(r, i, e);
|
|
905
936
|
return t && (a.push(n.slice(i, i + t).join(" ")), i += t), t > 0;
|
|
906
|
-
}, s =
|
|
937
|
+
}, s = Pe(r, 0, t.leadIns), c = o(t.leadIns), l = o(t.frames), u = o(t.links);
|
|
907
938
|
if (!(c && (s > 1 || l) || l && u)) return {
|
|
908
939
|
text: e,
|
|
909
940
|
taken: []
|
|
@@ -914,8 +945,8 @@ function Ne(e, t) {
|
|
|
914
945
|
text: e,
|
|
915
946
|
taken: []
|
|
916
947
|
};
|
|
917
|
-
let f = d.split(/\s+/).filter(Boolean), p =
|
|
918
|
-
if (p > 0 && f.length - p >=
|
|
948
|
+
let f = d.split(/\s+/).filter(Boolean), p = Ne(Ae(d), t.frames);
|
|
949
|
+
if (p > 0 && f.length - p >= Me) {
|
|
919
950
|
let e = f.slice(0, f.length - p).join(" ");
|
|
920
951
|
if (/\p{L}{3,}/u.test(e)) return {
|
|
921
952
|
text: e,
|
|
@@ -927,9 +958,8 @@ function Ne(e, t) {
|
|
|
927
958
|
taken: a
|
|
928
959
|
};
|
|
929
960
|
}
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
var Pe = {
|
|
961
|
+
// src/hooks/useSearchOrAsk.ts
|
|
962
|
+
var Ie = {
|
|
933
963
|
available: !1,
|
|
934
964
|
offer: "none",
|
|
935
965
|
p: null,
|
|
@@ -938,15 +968,15 @@ var Pe = {
|
|
|
938
968
|
criteria: null,
|
|
939
969
|
describes: !1,
|
|
940
970
|
cutResults: !1,
|
|
941
|
-
cutRule:
|
|
971
|
+
cutRule: Ce,
|
|
942
972
|
strictCoverage: !1,
|
|
943
973
|
filtersWhileTyping: "off",
|
|
944
974
|
stands: !1
|
|
945
975
|
};
|
|
946
|
-
function
|
|
947
|
-
let { enabled: t = !0, pauseMs: n = 300 } = e, r =
|
|
976
|
+
function Le(e = {}) {
|
|
977
|
+
let { enabled: t = !0, pauseMs: n = 300 } = e, r = Y(), { url: i, team: a, dataset: s, authenticatedFetch: u, isFetchingInitial: d, authError: f, state: p } = r, m = c(r);
|
|
948
978
|
m.current = r;
|
|
949
|
-
let h = (e.text ?? p.query).trim(), [g, _] = l(!1), [v, y] = l(
|
|
979
|
+
let h = (e.text ?? p.query).trim(), [g, _] = l(!1), [v, y] = l(Ie), b = c(_e), x = c(!0), S = c(Ce), C = c(!0), w = c("off"), T = c(null), E = c(!0), D = c(!0), O = c(null), k = c("none"), A = c(""), j = c(0), M = c(0);
|
|
950
980
|
k.current = v.offer;
|
|
951
981
|
let N = `${i}/api/teams/${a}/datasets/${s}/search-or-ask`, P = t && !d && !f;
|
|
952
982
|
o(() => {
|
|
@@ -959,11 +989,11 @@ function Fe(e = {}) {
|
|
|
959
989
|
let n = await t.json();
|
|
960
990
|
if (e || !n.available || !n.settings?.enabled) return;
|
|
961
991
|
T.current = n.effective?.askPhrases ?? null, E.current = n.settings.refocusWhileTyping ?? !0, D.current = n.settings.inviteOnAskPhrase ?? !0, w.current = n.settings.filtersWhileTyping ?? "off", b.current = {
|
|
962
|
-
...
|
|
992
|
+
..._e,
|
|
963
993
|
...n.settings.thresholds
|
|
964
994
|
}, x.current = n.settings.cutWhileAsking ?? !0, C.current = n.settings.strictCoverageWhileAsking ?? !0, S.current = {
|
|
965
|
-
shareOfTop: n.settings.cutShareOfTop ??
|
|
966
|
-
topFloor: n.settings.cutTopFloor ??
|
|
995
|
+
shareOfTop: n.settings.cutShareOfTop ?? Ce.shareOfTop,
|
|
996
|
+
topFloor: n.settings.cutTopFloor ?? Ce.topFloor
|
|
967
997
|
}, _(!0);
|
|
968
998
|
} catch {}
|
|
969
999
|
})(), () => {
|
|
@@ -975,21 +1005,21 @@ function Fe(e = {}) {
|
|
|
975
1005
|
u
|
|
976
1006
|
]), o(() => {
|
|
977
1007
|
let { setSearchRewrite: e } = m.current, t = T.current;
|
|
978
|
-
if (
|
|
1008
|
+
if (g && t && E.current && e) return e((e) => Fe(e, t).text), () => e(null);
|
|
979
1009
|
}, [g]), o(() => {
|
|
980
1010
|
if (!g) {
|
|
981
|
-
y(
|
|
1011
|
+
y(Ie);
|
|
982
1012
|
return;
|
|
983
1013
|
}
|
|
984
1014
|
if (!h) {
|
|
985
1015
|
A.current = "", y({
|
|
986
|
-
...
|
|
1016
|
+
...Ie,
|
|
987
1017
|
available: g
|
|
988
1018
|
});
|
|
989
1019
|
return;
|
|
990
1020
|
}
|
|
991
|
-
if (!
|
|
992
|
-
|
|
1021
|
+
if (!xe(h)) {
|
|
1022
|
+
be(h) && y((e) => ({
|
|
993
1023
|
...e,
|
|
994
1024
|
available: g,
|
|
995
1025
|
offer: "none",
|
|
@@ -997,7 +1027,7 @@ function Fe(e = {}) {
|
|
|
997
1027
|
}));
|
|
998
1028
|
return;
|
|
999
1029
|
}
|
|
1000
|
-
D.current && T.current &&
|
|
1030
|
+
D.current && T.current && Fe(h, T.current).taken.length > 0 && y((e) => e.offer === "none" ? {
|
|
1001
1031
|
...e,
|
|
1002
1032
|
available: g,
|
|
1003
1033
|
offer: "invite",
|
|
@@ -1015,7 +1045,7 @@ function Fe(e = {}) {
|
|
|
1015
1045
|
let e = ++j.current;
|
|
1016
1046
|
A.current = h;
|
|
1017
1047
|
try {
|
|
1018
|
-
let t = await u(`${N}/intent${
|
|
1048
|
+
let t = await u(`${N}/intent${ke(m.current)}`, {
|
|
1019
1049
|
method: "POST",
|
|
1020
1050
|
headers: { "Content-Type": "application/json" },
|
|
1021
1051
|
body: JSON.stringify({ text: h })
|
|
@@ -1036,7 +1066,7 @@ function Fe(e = {}) {
|
|
|
1036
1066
|
shareOfTop: o,
|
|
1037
1067
|
topFloor: s
|
|
1038
1068
|
}), y((e) => {
|
|
1039
|
-
let t =
|
|
1069
|
+
let t = Se(e.offer, n, b.current), a = i ?? null, o = a != null && a >= b.current.strong, s = t === "strong" && !De(h) ? "invite" : t, c = o ? "strong" : s, l = c === "strong" && !(o && a > n);
|
|
1040
1070
|
return {
|
|
1041
1071
|
available: !0,
|
|
1042
1072
|
offer: c,
|
|
@@ -1068,55 +1098,57 @@ function Fe(e = {}) {
|
|
|
1068
1098
|
if (F) {
|
|
1069
1099
|
if (O.current) return;
|
|
1070
1100
|
let n = t.searchSettings.coverageSetup ?? {};
|
|
1071
|
-
O.current = Object.fromEntries(Object.keys(
|
|
1101
|
+
O.current = Object.fromEntries(Object.keys(we).map((e) => [e, n[e]])), e({ coverageSetup: { ...we } });
|
|
1072
1102
|
} else O.current &&= (e({ coverageSetup: { ...O.current } }), null);
|
|
1073
1103
|
}, [F]), g ? {
|
|
1074
1104
|
...v,
|
|
1075
1105
|
stands: !!v.text && h.startsWith(v.text)
|
|
1076
|
-
} :
|
|
1106
|
+
} : Ie;
|
|
1077
1107
|
}
|
|
1078
|
-
var
|
|
1079
|
-
withOffer: "
|
|
1080
|
-
offerRow: "
|
|
1081
|
-
offerHint: "
|
|
1082
|
-
kbd: "
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1108
|
+
var Re = {
|
|
1109
|
+
withOffer: "_withOffer_1074j_2",
|
|
1110
|
+
offerRow: "_offerRow_1074j_10",
|
|
1111
|
+
offerHint: "_offerHint_1074j_18",
|
|
1112
|
+
kbd: "_kbd_1074j_27",
|
|
1113
|
+
askStrong: "_askStrong_1074j_42"
|
|
1114
|
+
}, ze = ({ className: e = "", autoFocus: t = !1, inputSize: n = "default", showClear: r = !0, showFocus: i = !1, showStatus: a = !0, onAsk: o, searchOrAsk: s, askOffer: c = "chip", onKeyDown: l, ...u }) => {
|
|
1115
|
+
let { state: { query: m, filters: h, rangeFilters: g, bucketFilters: _, results: v, truncationIndex: b, searchSettings: S }, setQuery: C, resetFilters: w } = Y(), 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, O = E && v !== null && v.length === 0, A = E && S.enableCoverage && v !== null && v.length > 0 && b === -1, j = Le({ enabled: !!o && !s }), M = s ?? j, N = !!o && E && M.offer !== "none" && M.stands, P = M.available && S.placeholderText === "Type to search" ? "Search or ask" : S.placeholderText, I = (e) => {
|
|
1116
|
+
l?.(e), !e.defaultPrevented && e.key === "Enter" && o && M.offer === "strong" && M.stands && m.trim() && (e.preventDefault(), o(m.trim()));
|
|
1117
|
+
}, R = () => {
|
|
1087
1118
|
C(""), T > 0 && w();
|
|
1088
|
-
},
|
|
1119
|
+
}, z = () => o(m.trim()), B = /* @__PURE__ */ p(k, {
|
|
1089
1120
|
type: "text",
|
|
1090
1121
|
value: m,
|
|
1091
1122
|
onChange: (e) => C(e.target.value),
|
|
1092
|
-
placeholder:
|
|
1123
|
+
placeholder: P,
|
|
1093
1124
|
autoFocus: t,
|
|
1094
1125
|
className: e,
|
|
1095
1126
|
showSearchIcon: !0,
|
|
1096
1127
|
inputSize: n,
|
|
1097
1128
|
showFocusBorder: i,
|
|
1098
1129
|
clearable: !1,
|
|
1099
|
-
onKeyDown:
|
|
1130
|
+
onKeyDown: I,
|
|
1100
1131
|
...u,
|
|
1101
1132
|
children: [
|
|
1102
|
-
|
|
1103
|
-
variant:
|
|
1133
|
+
N && c === "chip" && /* @__PURE__ */ f(y, {
|
|
1134
|
+
variant: M.offer === "strong" ? "primary" : "ghost",
|
|
1135
|
+
className: M.offer === "strong" ? Re.askStrong : void 0,
|
|
1104
1136
|
size: "micro",
|
|
1105
|
-
iconLeft: /* @__PURE__ */ f(
|
|
1106
|
-
iconRight:
|
|
1107
|
-
onClick:
|
|
1108
|
-
title:
|
|
1109
|
-
children:
|
|
1137
|
+
iconLeft: /* @__PURE__ */ f(L, {}),
|
|
1138
|
+
iconRight: M.offer === "strong" ? /* @__PURE__ */ f(D, { children: "Enter β΅" }) : void 0,
|
|
1139
|
+
onClick: z,
|
|
1140
|
+
title: M.offer === "strong" ? "Enter asks" : void 0,
|
|
1141
|
+
children: M.offer === "strong" ? "Ask" : "Ask about this"
|
|
1110
1142
|
}),
|
|
1111
|
-
a &&
|
|
1112
|
-
a &&
|
|
1143
|
+
a && O && /* @__PURE__ */ f(x, { children: "No results" }),
|
|
1144
|
+
a && A && /* @__PURE__ */ f(F, {
|
|
1113
1145
|
content: "No direct match. Showing the nearest results.",
|
|
1114
1146
|
children: /* @__PURE__ */ f("span", { children: /* @__PURE__ */ f(x, {
|
|
1115
1147
|
icon: /* @__PURE__ */ f(H, {}),
|
|
1116
1148
|
children: "Nearest"
|
|
1117
1149
|
}) })
|
|
1118
1150
|
}),
|
|
1119
|
-
a && T > 0 && /* @__PURE__ */ f(
|
|
1151
|
+
a && T > 0 && /* @__PURE__ */ f(F, {
|
|
1120
1152
|
content: `${T} filter${T === 1 ? "" : "s"} active`,
|
|
1121
1153
|
children: /* @__PURE__ */ f("span", { children: /* @__PURE__ */ f(x, {
|
|
1122
1154
|
icon: /* @__PURE__ */ f(V, {}),
|
|
@@ -1128,43 +1160,44 @@ var Ie = {
|
|
|
1128
1160
|
r && (E || T > 0) && /* @__PURE__ */ f(y, {
|
|
1129
1161
|
variant: "ghost",
|
|
1130
1162
|
size: "micro",
|
|
1131
|
-
onClick:
|
|
1163
|
+
onClick: R,
|
|
1132
1164
|
"aria-label": T > 0 ? "Clear search and filters" : "Clear search",
|
|
1133
1165
|
children: "Clear"
|
|
1134
1166
|
})
|
|
1135
1167
|
]
|
|
1136
1168
|
});
|
|
1137
|
-
if (c !== "below" || !o || !
|
|
1138
|
-
let U =
|
|
1169
|
+
if (c !== "below" || !o || !M.available) return B;
|
|
1170
|
+
let U = M.offer === "strong";
|
|
1139
1171
|
return /* @__PURE__ */ p("div", {
|
|
1140
|
-
className:
|
|
1141
|
-
children: [
|
|
1142
|
-
className:
|
|
1172
|
+
className: Re.withOffer,
|
|
1173
|
+
children: [B, /* @__PURE__ */ f("div", {
|
|
1174
|
+
className: Re.offerRow,
|
|
1143
1175
|
"aria-live": "polite",
|
|
1144
|
-
children:
|
|
1176
|
+
children: N && /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f(y, {
|
|
1145
1177
|
variant: U ? "primary" : "ghost",
|
|
1146
|
-
|
|
1147
|
-
|
|
1178
|
+
className: U ? Re.askStrong : void 0,
|
|
1179
|
+
iconLeft: /* @__PURE__ */ f(L, {}),
|
|
1180
|
+
onClick: z,
|
|
1148
1181
|
children: U ? "Ask the assistant" : "Ask about this"
|
|
1149
1182
|
}), U && /* @__PURE__ */ p("span", {
|
|
1150
|
-
className:
|
|
1183
|
+
className: Re.offerHint,
|
|
1151
1184
|
children: [/* @__PURE__ */ f("kbd", {
|
|
1152
|
-
className:
|
|
1185
|
+
className: Re.kbd,
|
|
1153
1186
|
children: "β΅"
|
|
1154
1187
|
}), " to ask"]
|
|
1155
1188
|
})] })
|
|
1156
1189
|
})]
|
|
1157
1190
|
});
|
|
1158
|
-
},
|
|
1191
|
+
}, Be = {
|
|
1159
1192
|
message: "_message_1mgfk_1",
|
|
1160
1193
|
icon: "_icon_1mgfk_10",
|
|
1161
1194
|
title: "_title_1mgfk_15",
|
|
1162
1195
|
detail: "_detail_1mgfk_20",
|
|
1163
1196
|
technical: "_technical_1mgfk_25",
|
|
1164
1197
|
button: "_button_1mgfk_33"
|
|
1165
|
-
},
|
|
1198
|
+
}, Ve = {
|
|
1166
1199
|
unreachable: {
|
|
1167
|
-
icon:
|
|
1200
|
+
icon: B,
|
|
1168
1201
|
title: "Search is unavailable",
|
|
1169
1202
|
detail: "The search server canβt be reached right now."
|
|
1170
1203
|
},
|
|
@@ -1189,32 +1222,32 @@ var Ie = {
|
|
|
1189
1222
|
detail: "Results will appear in a moment."
|
|
1190
1223
|
},
|
|
1191
1224
|
unavailable: {
|
|
1192
|
-
icon:
|
|
1225
|
+
icon: re,
|
|
1193
1226
|
title: "Search is unavailable",
|
|
1194
1227
|
detail: "The collection canβt be searched right now."
|
|
1195
1228
|
},
|
|
1196
1229
|
rateLimited: {
|
|
1197
|
-
icon:
|
|
1230
|
+
icon: ne,
|
|
1198
1231
|
title: "Too many searches",
|
|
1199
1232
|
detail: "Wait a moment, then try again."
|
|
1200
1233
|
},
|
|
1201
1234
|
server: {
|
|
1202
|
-
icon:
|
|
1235
|
+
icon: re,
|
|
1203
1236
|
title: "Something went wrong",
|
|
1204
1237
|
detail: "The search server ran into a problem."
|
|
1205
1238
|
},
|
|
1206
1239
|
setup: {
|
|
1207
|
-
icon:
|
|
1240
|
+
icon: re,
|
|
1208
1241
|
title: "Search isnβt set up",
|
|
1209
1242
|
detail: "This page is missing part of its search setup."
|
|
1210
1243
|
},
|
|
1211
1244
|
unknown: {
|
|
1212
|
-
icon:
|
|
1245
|
+
icon: re,
|
|
1213
1246
|
title: "Something went wrong",
|
|
1214
1247
|
detail: "The search couldnβt be completed."
|
|
1215
1248
|
}
|
|
1216
|
-
},
|
|
1217
|
-
let { icon: r, title: i, detail: a } =
|
|
1249
|
+
}, He = ({ error: e, onRetry: t, hideTechnical: n = !1 }) => {
|
|
1250
|
+
let { icon: r, title: i, detail: a } = Ve[e.kind];
|
|
1218
1251
|
o(() => {
|
|
1219
1252
|
if (e.kind !== "notReady" || !t) return;
|
|
1220
1253
|
let n = setTimeout(t, (e.retryAfterSeconds ?? 2) * 1e3);
|
|
@@ -1222,65 +1255,65 @@ var Ie = {
|
|
|
1222
1255
|
}, [e, t]);
|
|
1223
1256
|
let s = e.retryable && e.kind !== "notReady" && t;
|
|
1224
1257
|
return /* @__PURE__ */ p("div", {
|
|
1225
|
-
className:
|
|
1258
|
+
className: Be.message,
|
|
1226
1259
|
role: "alert",
|
|
1227
1260
|
children: [
|
|
1228
1261
|
/* @__PURE__ */ f("span", {
|
|
1229
|
-
className:
|
|
1262
|
+
className: Be.icon,
|
|
1230
1263
|
children: /* @__PURE__ */ f(r, {
|
|
1231
1264
|
size: 70,
|
|
1232
1265
|
color: "var(--lv4)"
|
|
1233
1266
|
})
|
|
1234
1267
|
}),
|
|
1235
1268
|
/* @__PURE__ */ f("div", {
|
|
1236
|
-
className:
|
|
1269
|
+
className: Be.title,
|
|
1237
1270
|
children: i
|
|
1238
1271
|
}),
|
|
1239
1272
|
/* @__PURE__ */ f("div", {
|
|
1240
|
-
className:
|
|
1273
|
+
className: Be.detail,
|
|
1241
1274
|
children: a
|
|
1242
1275
|
}),
|
|
1243
1276
|
!n && /* @__PURE__ */ f("code", {
|
|
1244
|
-
className:
|
|
1277
|
+
className: Be.technical,
|
|
1245
1278
|
children: e.technical
|
|
1246
1279
|
}),
|
|
1247
1280
|
s && /* @__PURE__ */ f(y, {
|
|
1248
1281
|
variant: "secondary",
|
|
1249
1282
|
size: "micro",
|
|
1250
|
-
className:
|
|
1283
|
+
className: Be.button,
|
|
1251
1284
|
onClick: t,
|
|
1252
1285
|
children: "Try again"
|
|
1253
1286
|
})
|
|
1254
1287
|
]
|
|
1255
1288
|
});
|
|
1256
|
-
},
|
|
1289
|
+
}, Ue = {
|
|
1257
1290
|
placeholder: "_placeholder_1qr5o_1",
|
|
1258
1291
|
invalid: "_invalid_1qr5o_11",
|
|
1259
1292
|
searchedFor: "_searchedFor_1qr5o_17"
|
|
1260
|
-
},
|
|
1293
|
+
}, We = {
|
|
1261
1294
|
row: "_row_11svi_1",
|
|
1262
1295
|
content: "_content_11svi_22",
|
|
1263
1296
|
indexNumber: "_indexNumber_11svi_36",
|
|
1264
1297
|
scoreNumber: "_scoreNumber_11svi_44",
|
|
1265
1298
|
skeletonBars: "_skeletonBars_11svi_53"
|
|
1266
|
-
},
|
|
1267
|
-
className:
|
|
1299
|
+
}, Ge = ({ skeleton: e = !1, index: t, score: n, showScore: r = !1, children: i, skeletonDelay: a = 0, skeletonWidths: o = [62, 38] }) => /* @__PURE__ */ p("div", {
|
|
1300
|
+
className: We.row,
|
|
1268
1301
|
children: [
|
|
1269
1302
|
t !== void 0 && /* @__PURE__ */ f("div", {
|
|
1270
|
-
className:
|
|
1303
|
+
className: We.indexNumber,
|
|
1271
1304
|
children: t
|
|
1272
1305
|
}),
|
|
1273
1306
|
/* @__PURE__ */ f("div", {
|
|
1274
|
-
className:
|
|
1307
|
+
className: We.content,
|
|
1275
1308
|
children: e ? /* @__PURE__ */ p("div", {
|
|
1276
|
-
className:
|
|
1277
|
-
children: [/* @__PURE__ */ f(
|
|
1309
|
+
className: We.skeletonBars,
|
|
1310
|
+
children: [/* @__PURE__ */ f(j, {
|
|
1278
1311
|
level: 3,
|
|
1279
1312
|
height: 12,
|
|
1280
1313
|
width: `${o[0]}%`,
|
|
1281
1314
|
delay: a,
|
|
1282
1315
|
appear: !1
|
|
1283
|
-
}), /* @__PURE__ */ f(
|
|
1316
|
+
}), /* @__PURE__ */ f(j, {
|
|
1284
1317
|
level: 3,
|
|
1285
1318
|
height: 8,
|
|
1286
1319
|
width: `${o[1]}%`,
|
|
@@ -1290,14 +1323,14 @@ var Ie = {
|
|
|
1290
1323
|
}) : i
|
|
1291
1324
|
}),
|
|
1292
1325
|
r && n !== void 0 && /* @__PURE__ */ f("div", {
|
|
1293
|
-
className:
|
|
1326
|
+
className: We.scoreNumber,
|
|
1294
1327
|
children: n
|
|
1295
1328
|
})
|
|
1296
1329
|
]
|
|
1297
|
-
}),
|
|
1330
|
+
}), Ke = {
|
|
1298
1331
|
wrapper: "_wrapper_f970z_6",
|
|
1299
1332
|
skeletonAppear: "_skeletonAppear_f970z_1"
|
|
1300
|
-
},
|
|
1333
|
+
}, qe = [
|
|
1301
1334
|
[62, 38],
|
|
1302
1335
|
[75, 45],
|
|
1303
1336
|
[58, 33],
|
|
@@ -1306,28 +1339,28 @@ var Ie = {
|
|
|
1306
1339
|
[55, 35],
|
|
1307
1340
|
[72, 40],
|
|
1308
1341
|
[60, 30]
|
|
1309
|
-
],
|
|
1310
|
-
className:
|
|
1311
|
-
children: Array.from({ length: e }).map((e, t) => /* @__PURE__ */ f(
|
|
1342
|
+
], Je = ({ rows: e = 6 }) => /* @__PURE__ */ f("div", {
|
|
1343
|
+
className: Ke.wrapper,
|
|
1344
|
+
children: Array.from({ length: e }).map((e, t) => /* @__PURE__ */ f(Ge, {
|
|
1312
1345
|
skeleton: !0,
|
|
1313
1346
|
skeletonDelay: t * .1,
|
|
1314
|
-
skeletonWidths:
|
|
1347
|
+
skeletonWidths: qe[t % qe.length]
|
|
1315
1348
|
}, t))
|
|
1316
|
-
}),
|
|
1317
|
-
function
|
|
1349
|
+
}), Ye = /^\[\s*(?:'[^']*'(?:\s*,\s*'[^']*')*)?\s*\]$/;
|
|
1350
|
+
function Xe(e) {
|
|
1318
1351
|
let t = e.trim();
|
|
1319
1352
|
if (!t.startsWith("[") || !t.endsWith("]")) return;
|
|
1320
1353
|
try {
|
|
1321
1354
|
let e = JSON.parse(t);
|
|
1322
1355
|
if (Array.isArray(e)) return e.map((e) => String(e));
|
|
1323
1356
|
} catch {}
|
|
1324
|
-
if (!
|
|
1357
|
+
if (!Ye.test(t)) return;
|
|
1325
1358
|
let n = [], r = /'([^']*)'/g, i;
|
|
1326
1359
|
for (; (i = r.exec(t)) !== null;) n.push(i[1]);
|
|
1327
1360
|
return n;
|
|
1328
1361
|
}
|
|
1329
|
-
var
|
|
1330
|
-
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 } =
|
|
1362
|
+
var Ze = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk: r, showScore: i, children: a }) => {
|
|
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 } = Y(), k = t ?? 30, [A, j] = l(k), M = c(0), N = c("");
|
|
1331
1364
|
o(() => {
|
|
1332
1365
|
let e = g !== N.current;
|
|
1333
1366
|
(!s || s.length < M.current || e) && j(k), M.current = s?.length ?? 0, N.current = g;
|
|
@@ -1336,19 +1369,19 @@ var Ye = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1336
1369
|
k,
|
|
1337
1370
|
g
|
|
1338
1371
|
]);
|
|
1339
|
-
let P = s ?
|
|
1372
|
+
let P = s ? Ee(s, h, !!r?.cutResults, r?.cutRule) : [], F = D != null && D.trim() !== g.trim() ? D : null, I = s && P.length > A, L = () => {
|
|
1340
1373
|
let e = A + k;
|
|
1341
1374
|
j(e), s && e >= s.length && (!h || h === -1 || h > s.length) && T(s.length + k);
|
|
1342
1375
|
};
|
|
1343
|
-
if (b) return w ? /* @__PURE__ */ f(
|
|
1344
|
-
className:
|
|
1376
|
+
if (b) return w ? /* @__PURE__ */ f(Je, { rows: k }) : /* @__PURE__ */ f("div", {
|
|
1377
|
+
className: Ue.placeholder,
|
|
1345
1378
|
children: /* @__PURE__ */ f(W, {
|
|
1346
1379
|
size: 200,
|
|
1347
1380
|
color: "var(--lv5)"
|
|
1348
1381
|
})
|
|
1349
1382
|
});
|
|
1350
1383
|
let R = x ?? _;
|
|
1351
|
-
return R ? /* @__PURE__ */ f(
|
|
1384
|
+
return R ? /* @__PURE__ */ f(He, {
|
|
1352
1385
|
error: (x ? S : v) ?? {
|
|
1353
1386
|
kind: "unknown",
|
|
1354
1387
|
message: R,
|
|
@@ -1357,14 +1390,14 @@ var Ye = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1357
1390
|
},
|
|
1358
1391
|
onRetry: C
|
|
1359
1392
|
}) : u || s === null ? /* @__PURE__ */ f("div", {
|
|
1360
|
-
className:
|
|
1393
|
+
className: Ue.placeholder,
|
|
1361
1394
|
children: /* @__PURE__ */ f(W, {
|
|
1362
1395
|
size: 200,
|
|
1363
1396
|
color: "var(--lv5)"
|
|
1364
1397
|
})
|
|
1365
1398
|
}) : P.length === 0 ? null : /* @__PURE__ */ p(d, { children: [
|
|
1366
1399
|
F && /* @__PURE__ */ p("div", {
|
|
1367
|
-
className:
|
|
1400
|
+
className: Ue.searchedFor,
|
|
1368
1401
|
"aria-live": "polite",
|
|
1369
1402
|
children: [/* @__PURE__ */ p("span", { children: ["Searching for ", /* @__PURE__ */ f("strong", { children: F })] }), O && /* @__PURE__ */ f(y, {
|
|
1370
1403
|
variant: "ghost",
|
|
@@ -1379,7 +1412,7 @@ var Ye = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1379
1412
|
c = typeof o == "string" ? JSON.parse(o) : o;
|
|
1380
1413
|
} catch {
|
|
1381
1414
|
return /* @__PURE__ */ f("div", {
|
|
1382
|
-
className:
|
|
1415
|
+
className: Ue.invalid,
|
|
1383
1416
|
children: /* @__PURE__ */ f("p", { children: "Invalid JSON" })
|
|
1384
1417
|
}, r);
|
|
1385
1418
|
}
|
|
@@ -1391,11 +1424,11 @@ var Ye = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1391
1424
|
if (n) for (let e in l) {
|
|
1392
1425
|
let t = l[e];
|
|
1393
1426
|
if (typeof t == "string") {
|
|
1394
|
-
let n =
|
|
1427
|
+
let n = Xe(t);
|
|
1395
1428
|
n && (l[e] = n);
|
|
1396
1429
|
}
|
|
1397
1430
|
}
|
|
1398
|
-
return /* @__PURE__ */ f(
|
|
1431
|
+
return /* @__PURE__ */ f(Ge, {
|
|
1399
1432
|
index: r,
|
|
1400
1433
|
score: s,
|
|
1401
1434
|
showScore: i ?? m.showScore,
|
|
@@ -1418,18 +1451,18 @@ var Ye = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1418
1451
|
})
|
|
1419
1452
|
})
|
|
1420
1453
|
] });
|
|
1421
|
-
},
|
|
1454
|
+
}, Qe = {
|
|
1422
1455
|
row: "_row_ujwhc_1",
|
|
1423
1456
|
title: "_title_ujwhc_8"
|
|
1424
|
-
},
|
|
1425
|
-
className: [
|
|
1457
|
+
}, $e = ({ variant: e = "default", children: t }) => /* @__PURE__ */ f("div", {
|
|
1458
|
+
className: [Qe.row, e === "title" ? Qe.title : ""].filter(Boolean).join(" "),
|
|
1426
1459
|
children: t
|
|
1427
|
-
}),
|
|
1460
|
+
}), et = {
|
|
1428
1461
|
listRows: "_listRows_13obt_2",
|
|
1429
1462
|
sliderArea: "_sliderArea_13obt_8",
|
|
1430
1463
|
inputRow: "_inputRow_13obt_15",
|
|
1431
1464
|
histogramRow: "_histogramRow_13obt_22"
|
|
1432
|
-
},
|
|
1465
|
+
}, tt = [
|
|
1433
1466
|
65,
|
|
1434
1467
|
80,
|
|
1435
1468
|
55,
|
|
@@ -1438,22 +1471,22 @@ var Ye = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1438
1471
|
75,
|
|
1439
1472
|
50,
|
|
1440
1473
|
68
|
|
1441
|
-
],
|
|
1474
|
+
], nt = ({ title: e, rows: t = 5, variant: n = "list", withHistogram: r = !1, collapsible: i = !0, startCollapsed: a = !1 }) => /* @__PURE__ */ f(T, {
|
|
1442
1475
|
title: e,
|
|
1443
1476
|
collapsible: i,
|
|
1444
1477
|
collapsed: a,
|
|
1445
1478
|
children: n === "slider" ? /* @__PURE__ */ p("div", {
|
|
1446
|
-
className:
|
|
1479
|
+
className: et.sliderArea,
|
|
1447
1480
|
children: [
|
|
1448
|
-
r && /* @__PURE__ */ f("div", { className:
|
|
1449
|
-
/* @__PURE__ */ f(
|
|
1481
|
+
r && /* @__PURE__ */ f("div", { className: et.histogramRow }),
|
|
1482
|
+
/* @__PURE__ */ f(j, { height: 6 }),
|
|
1450
1483
|
/* @__PURE__ */ p("div", {
|
|
1451
|
-
className:
|
|
1452
|
-
children: [/* @__PURE__ */ f(
|
|
1484
|
+
className: et.inputRow,
|
|
1485
|
+
children: [/* @__PURE__ */ f(j, {
|
|
1453
1486
|
width: 40,
|
|
1454
1487
|
height: 20,
|
|
1455
1488
|
delay: .1
|
|
1456
|
-
}), /* @__PURE__ */ f(
|
|
1489
|
+
}), /* @__PURE__ */ f(j, {
|
|
1457
1490
|
width: 40,
|
|
1458
1491
|
height: 20,
|
|
1459
1492
|
delay: .15
|
|
@@ -1461,13 +1494,13 @@ var Ye = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1461
1494
|
})
|
|
1462
1495
|
]
|
|
1463
1496
|
}) : /* @__PURE__ */ f("div", {
|
|
1464
|
-
className:
|
|
1465
|
-
children: Array.from({ length: t }).map((e, t) => /* @__PURE__ */ f(
|
|
1466
|
-
width: `${
|
|
1497
|
+
className: et.listRows,
|
|
1498
|
+
children: Array.from({ length: t }).map((e, t) => /* @__PURE__ */ f(j, {
|
|
1499
|
+
width: `${tt[t % tt.length]}%`,
|
|
1467
1500
|
delay: t * .05
|
|
1468
1501
|
}, t))
|
|
1469
1502
|
})
|
|
1470
|
-
}),
|
|
1503
|
+
}), X = {
|
|
1471
1504
|
list: "_list_18vbb_2",
|
|
1472
1505
|
count: "_count_18vbb_7",
|
|
1473
1506
|
countValue: "_countValue_18vbb_17",
|
|
@@ -1475,10 +1508,10 @@ var Ye = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1475
1508
|
chipLabel: "_chipLabel_18vbb_32",
|
|
1476
1509
|
grid: "_grid_18vbb_40",
|
|
1477
1510
|
active: "_active_18vbb_54"
|
|
1478
|
-
},
|
|
1511
|
+
}, rt = {
|
|
1479
1512
|
notice: "_notice_4sel0_1",
|
|
1480
1513
|
technical: "_technical_4sel0_9"
|
|
1481
|
-
},
|
|
1514
|
+
}, it = ({ label: e, field: t, missing: n }) => {
|
|
1482
1515
|
let r = n.map((e) => e[0].toUpperCase() + e.slice(1)).join(" and ");
|
|
1483
1516
|
return o(() => {
|
|
1484
1517
|
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).`);
|
|
@@ -1486,9 +1519,9 @@ var Ye = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1486
1519
|
title: e ?? t,
|
|
1487
1520
|
collapsible: !1,
|
|
1488
1521
|
children: /* @__PURE__ */ p("div", {
|
|
1489
|
-
className:
|
|
1522
|
+
className: rt.notice,
|
|
1490
1523
|
children: [/* @__PURE__ */ f("span", { children: "Not available" }), /* @__PURE__ */ p("code", {
|
|
1491
|
-
className:
|
|
1524
|
+
className: rt.technical,
|
|
1492
1525
|
children: [
|
|
1493
1526
|
t,
|
|
1494
1527
|
": not ",
|
|
@@ -1497,8 +1530,8 @@ var Ye = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1497
1530
|
})]
|
|
1498
1531
|
})
|
|
1499
1532
|
});
|
|
1500
|
-
},
|
|
1501
|
-
let { state: { facets: w, filterableFields: E, facetableFields:
|
|
1533
|
+
}, at = ({ 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 }) => {
|
|
1534
|
+
let { state: { facets: w, filterableFields: E, facetableFields: D, filters: k, query: A }, toggleFilter: j, setValueMatch: M, authError: N, isFetchingInitial: F, allowEmptySearch: I } = Y(), L = d ?? m ?? "checkbox", R = L === "radio" ? "any" : x;
|
|
1502
1535
|
o(() => {
|
|
1503
1536
|
M(e, R);
|
|
1504
1537
|
}, [
|
|
@@ -1509,11 +1542,11 @@ var Ye = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1509
1542
|
let z = c(null), [B, V] = l(a);
|
|
1510
1543
|
if (o(() => {
|
|
1511
1544
|
V(a);
|
|
1512
|
-
}, [w?.[e], a]), !I && !A ||
|
|
1513
|
-
if (F || !w) return L === "toggle" ? /* @__PURE__ */ f(
|
|
1545
|
+
}, [w?.[e], a]), !I && !A || N) return null;
|
|
1546
|
+
if (F || !w) return L === "toggle" ? /* @__PURE__ */ f(nt, {
|
|
1514
1547
|
rows: 1,
|
|
1515
1548
|
collapsible: !1
|
|
1516
|
-
}) : /* @__PURE__ */ f(
|
|
1549
|
+
}) : /* @__PURE__ */ f(nt, {
|
|
1517
1550
|
title: t,
|
|
1518
1551
|
rows: Math.min(a, 6),
|
|
1519
1552
|
collapsible: s,
|
|
@@ -1524,9 +1557,9 @@ var Ye = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1524
1557
|
filters: k,
|
|
1525
1558
|
facets: w
|
|
1526
1559
|
}) || !S && !A && Object.keys(k).length < 1) return null;
|
|
1527
|
-
if (!E?.includes(e) || !
|
|
1560
|
+
if (!E?.includes(e) || !D?.includes(e)) {
|
|
1528
1561
|
let n = [];
|
|
1529
|
-
return E?.includes(e) || n.push("filterable"),
|
|
1562
|
+
return E?.includes(e) || n.push("filterable"), D?.includes(e) || n.push("facetable"), /* @__PURE__ */ f(it, {
|
|
1530
1563
|
label: t,
|
|
1531
1564
|
field: e,
|
|
1532
1565
|
missing: n
|
|
@@ -1542,7 +1575,7 @@ var Ye = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1542
1575
|
}), H.forEach((e) => {
|
|
1543
1576
|
W.set(e.key, e.value);
|
|
1544
1577
|
});
|
|
1545
|
-
let ee = new Set([
|
|
1578
|
+
let ee = /* @__PURE__ */ new Set([
|
|
1546
1579
|
"true",
|
|
1547
1580
|
"false",
|
|
1548
1581
|
"null"
|
|
@@ -1554,8 +1587,8 @@ var Ye = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1554
1587
|
if (L === "toggle" && !te) return /* @__PURE__ */ f(T, {
|
|
1555
1588
|
collapsible: !1,
|
|
1556
1589
|
children: /* @__PURE__ */ f("div", {
|
|
1557
|
-
className:
|
|
1558
|
-
children: /* @__PURE__ */ f(
|
|
1590
|
+
className: X.count,
|
|
1591
|
+
children: /* @__PURE__ */ f(P, {
|
|
1559
1592
|
label: t,
|
|
1560
1593
|
checked: !1,
|
|
1561
1594
|
onChange: () => {},
|
|
@@ -1568,9 +1601,9 @@ var Ye = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1568
1601
|
return /* @__PURE__ */ f(T, {
|
|
1569
1602
|
collapsible: !1,
|
|
1570
1603
|
children: /* @__PURE__ */ p("div", {
|
|
1571
|
-
className:
|
|
1604
|
+
className: X.count,
|
|
1572
1605
|
children: [
|
|
1573
|
-
/* @__PURE__ */ f(
|
|
1606
|
+
/* @__PURE__ */ f(P, {
|
|
1574
1607
|
label: t,
|
|
1575
1608
|
checked: i,
|
|
1576
1609
|
onChange: () => j(e, "true"),
|
|
@@ -1584,37 +1617,39 @@ var Ye = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1584
1617
|
}
|
|
1585
1618
|
let K = Array.from(W.entries());
|
|
1586
1619
|
if (v || (K = K.filter(([e]) => e !== "null")), K.length === 0 && !n) return null;
|
|
1587
|
-
if (!r)
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
let
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1620
|
+
if (!r) {
|
|
1621
|
+
if (i === "alphabetical") {
|
|
1622
|
+
let e = K.filter(([, e]) => typeof e == "number" && e > 0).sort(([e], [t]) => e.localeCompare(t)), t = K.filter(([, e]) => e === 0 || e === null).sort(([e], [t]) => e.localeCompare(t));
|
|
1623
|
+
K = [...e, ...t];
|
|
1624
|
+
} else if (i === "numeric") {
|
|
1625
|
+
let e = (e, t) => {
|
|
1626
|
+
let n = Number(e), r = Number(t);
|
|
1627
|
+
return !isNaN(n) && !isNaN(r) ? n - r : e.localeCompare(t);
|
|
1628
|
+
}, t = K.filter(([, e]) => typeof e == "number" && e > 0).sort(([t], [n]) => e(t, n)), n = K.filter(([, e]) => e === 0 || e === null).sort(([t], [n]) => e(t, n));
|
|
1629
|
+
K = [...t, ...n];
|
|
1630
|
+
} else {
|
|
1631
|
+
let e = K.filter(([, e]) => typeof e == "number" && e > 0), t = K.filter(([, e]) => e === 0 || e === null);
|
|
1632
|
+
K = [...e, ...t];
|
|
1633
|
+
}
|
|
1599
1634
|
}
|
|
1600
|
-
let
|
|
1635
|
+
let ne = typeof a == "number" && K.length > a, re = ne ? K.slice(0, B) : K, ie = (t, n) => {
|
|
1601
1636
|
let r = U.includes(t), i = n === 0, a = _ && (n ?? 0) > 0 ? ` (${n})` : "", o = _ && (n ?? 0) > 0 ? n : "", s = () => j(e, t, L === "radio");
|
|
1602
1637
|
switch (L) {
|
|
1603
1638
|
case "button": return h === "list" ? /* @__PURE__ */ p("div", {
|
|
1604
|
-
className:
|
|
1639
|
+
className: X.count,
|
|
1605
1640
|
children: [/* @__PURE__ */ f(y, {
|
|
1606
1641
|
variant: r ? "primary" : "secondary",
|
|
1607
1642
|
onClick: s,
|
|
1608
1643
|
disabled: i,
|
|
1609
1644
|
size: "micro",
|
|
1610
|
-
className:
|
|
1645
|
+
className: X.chip,
|
|
1611
1646
|
title: t,
|
|
1612
1647
|
children: /* @__PURE__ */ f("span", {
|
|
1613
|
-
className:
|
|
1648
|
+
className: X.chipLabel,
|
|
1614
1649
|
children: t
|
|
1615
1650
|
})
|
|
1616
1651
|
}), /* @__PURE__ */ f("span", {
|
|
1617
|
-
className:
|
|
1652
|
+
className: X.countValue,
|
|
1618
1653
|
children: o
|
|
1619
1654
|
})]
|
|
1620
1655
|
}) : /* @__PURE__ */ f(y, {
|
|
@@ -1622,21 +1657,21 @@ var Ye = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1622
1657
|
onClick: s,
|
|
1623
1658
|
disabled: i,
|
|
1624
1659
|
size: "micro",
|
|
1625
|
-
className:
|
|
1660
|
+
className: X.chip,
|
|
1626
1661
|
title: `${t}${a}`,
|
|
1627
1662
|
children: /* @__PURE__ */ f("span", {
|
|
1628
|
-
className:
|
|
1663
|
+
className: X.chipLabel,
|
|
1629
1664
|
children: `${t}${a}`
|
|
1630
1665
|
})
|
|
1631
1666
|
});
|
|
1632
|
-
case "toggle": return /* @__PURE__ */ f(
|
|
1667
|
+
case "toggle": return /* @__PURE__ */ f(P, {
|
|
1633
1668
|
label: t,
|
|
1634
1669
|
checked: r,
|
|
1635
1670
|
onChange: s,
|
|
1636
1671
|
disabled: i
|
|
1637
1672
|
});
|
|
1638
1673
|
case "radio": {
|
|
1639
|
-
let n = /* @__PURE__ */ f(
|
|
1674
|
+
let n = /* @__PURE__ */ f(O, {
|
|
1640
1675
|
id: `${e}-${t}`,
|
|
1641
1676
|
name: e,
|
|
1642
1677
|
value: t,
|
|
@@ -1646,15 +1681,15 @@ var Ye = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1646
1681
|
disabled: i
|
|
1647
1682
|
});
|
|
1648
1683
|
return h === "list" ? /* @__PURE__ */ p("div", {
|
|
1649
|
-
className:
|
|
1684
|
+
className: X.count,
|
|
1650
1685
|
children: [n, /* @__PURE__ */ f("span", {
|
|
1651
|
-
className:
|
|
1686
|
+
className: X.countValue,
|
|
1652
1687
|
children: o
|
|
1653
1688
|
})]
|
|
1654
1689
|
}) : n;
|
|
1655
1690
|
}
|
|
1656
1691
|
default: return h === "list" ? /* @__PURE__ */ p("div", {
|
|
1657
|
-
className:
|
|
1692
|
+
className: X.count,
|
|
1658
1693
|
children: [/* @__PURE__ */ f(b, {
|
|
1659
1694
|
label: t,
|
|
1660
1695
|
score: "",
|
|
@@ -1662,7 +1697,7 @@ var Ye = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1662
1697
|
onChange: s,
|
|
1663
1698
|
disabled: i
|
|
1664
1699
|
}), /* @__PURE__ */ f("span", {
|
|
1665
|
-
className:
|
|
1700
|
+
className: X.countValue,
|
|
1666
1701
|
children: o
|
|
1667
1702
|
})]
|
|
1668
1703
|
}) : /* @__PURE__ */ f(b, {
|
|
@@ -1678,18 +1713,18 @@ var Ye = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1678
1713
|
title: t,
|
|
1679
1714
|
collapsible: s,
|
|
1680
1715
|
collapsed: s ? u : !1,
|
|
1681
|
-
className: g && U.length > 0 ?
|
|
1716
|
+
className: g && U.length > 0 ? X.active : void 0,
|
|
1682
1717
|
children: /* @__PURE__ */ p("ul", {
|
|
1683
|
-
className: h === "grid" ?
|
|
1718
|
+
className: h === "grid" ? X.grid : X.list,
|
|
1684
1719
|
style: {
|
|
1685
1720
|
listStyle: "none",
|
|
1686
1721
|
padding: 0,
|
|
1687
1722
|
margin: 0
|
|
1688
1723
|
},
|
|
1689
|
-
children: [
|
|
1724
|
+
children: [re.map(([e, t]) => /* @__PURE__ */ f("li", { children: ie(e, t) }, e)), ne && B < K.length && (() => {
|
|
1690
1725
|
let e = K.length - B, t = Math.min(50, e);
|
|
1691
1726
|
return /* @__PURE__ */ f("li", {
|
|
1692
|
-
className:
|
|
1727
|
+
className: X.toggleItem,
|
|
1693
1728
|
children: /* @__PURE__ */ f(y, {
|
|
1694
1729
|
variant: "ghost",
|
|
1695
1730
|
size: "micro",
|
|
@@ -1700,7 +1735,7 @@ var Ye = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1700
1735
|
})()]
|
|
1701
1736
|
})
|
|
1702
1737
|
});
|
|
1703
|
-
},
|
|
1738
|
+
}, Z = {
|
|
1704
1739
|
disabledMessage: "_disabledMessage_adany_1",
|
|
1705
1740
|
histogram: "_histogram_adany_6",
|
|
1706
1741
|
histogramLayer: "_histogramLayer_adany_14",
|
|
@@ -1712,39 +1747,37 @@ var Ye = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk
|
|
|
1712
1747
|
histogramSeparator: "_histogramSeparator_adany_48",
|
|
1713
1748
|
active: "_active_adany_76"
|
|
1714
1749
|
};
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
function it(e) {
|
|
1750
|
+
// src/utils/numeric.ts
|
|
1751
|
+
function ot(e) {
|
|
1718
1752
|
if (!Number.isFinite(e)) return 0;
|
|
1719
1753
|
let t = String(e), n = t.indexOf(".");
|
|
1720
1754
|
return n === -1 ? 0 : Math.min(6, t.length - n - 1);
|
|
1721
1755
|
}
|
|
1722
|
-
function
|
|
1756
|
+
function st(e) {
|
|
1723
1757
|
let t = 0;
|
|
1724
|
-
for (let n of e) t = Math.max(t,
|
|
1758
|
+
for (let n of e) t = Math.max(t, ot(n));
|
|
1725
1759
|
return t === 0 ? 1 : Number((10 ** -t).toFixed(t));
|
|
1726
1760
|
}
|
|
1727
|
-
function
|
|
1728
|
-
return Number(e.toFixed(
|
|
1761
|
+
function Q(e, t) {
|
|
1762
|
+
return Number(e.toFixed(ot(t)));
|
|
1729
1763
|
}
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
function st(e, t, n) {
|
|
1764
|
+
// src/components/RangeFilterPanel.tsx
|
|
1765
|
+
function ct(e, t, n) {
|
|
1733
1766
|
let r = t + Math.round((e - t) / n) * n;
|
|
1734
|
-
return Number(r.toFixed(
|
|
1767
|
+
return Number(r.toFixed(ot(n)));
|
|
1735
1768
|
}
|
|
1736
|
-
function
|
|
1769
|
+
function lt(e, t, n) {
|
|
1737
1770
|
let r = Math.ceil(Number(((e - t) / n).toFixed(6)));
|
|
1738
|
-
return Number((t + r * n).toFixed(
|
|
1771
|
+
return Number((t + r * n).toFixed(ot(n)));
|
|
1739
1772
|
}
|
|
1740
|
-
var
|
|
1741
|
-
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 } =
|
|
1773
|
+
var ut = ({ 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 }) => {
|
|
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 } = Y(), j = a ?? o ?? "input", N = _?.[t] !== void 0, P = _?.[t] ?? {
|
|
1742
1775
|
min: r,
|
|
1743
1776
|
max: i
|
|
1744
1777
|
}, F = P.min, I = P.max, L = v?.[t] ?? P, R = Math.max(F, Math.min(I, L.min)), z = Math.max(F, Math.min(I, L.max)), B = e.useMemo(() => {
|
|
1745
1778
|
if (m) return m;
|
|
1746
|
-
let e = Math.max(
|
|
1747
|
-
if (Array.isArray(n)) for (let t of n) e = Math.max(e,
|
|
1779
|
+
let e = Math.max(ot(F), ot(I)), n = y?.[t];
|
|
1780
|
+
if (Array.isArray(n)) for (let t of n) e = Math.max(e, ot(Number(t.key)));
|
|
1748
1781
|
return e === 0 ? 1 : Number((10 ** -e).toFixed(e));
|
|
1749
1782
|
}, [
|
|
1750
1783
|
m,
|
|
@@ -1752,21 +1785,21 @@ var lt = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
1752
1785
|
I,
|
|
1753
1786
|
y,
|
|
1754
1787
|
t
|
|
1755
|
-
]), V = N && F === I, H = V ? r : F, U = V ? i : I, W =
|
|
1756
|
-
let e =
|
|
1757
|
-
return { width: `calc(${Math.max(3, F.toFixed(e).length, I.toFixed(e).length,
|
|
1788
|
+
]), V = N && F === I, H = V ? r : F, U = V ? i : I, W = lt(U + B, H, B), ee = (e) => Math.min(W, Math.max(H, e)), G = g?.[t], te = s && G !== void 0 ? Z.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]), [ae, oe] = e.useState(!1), [se, ce] = e.useState(!1), [le, ue] = e.useState(String(K)), [de, fe] = e.useState(String(ne)), pe = e.useMemo(() => {
|
|
1789
|
+
let e = ot(B);
|
|
1790
|
+
return { width: `calc(${Math.max(3, F.toFixed(e).length, I.toFixed(e).length, le.length, de.length) + 1}ch + 20px)` };
|
|
1758
1791
|
}, [
|
|
1759
1792
|
B,
|
|
1760
1793
|
F,
|
|
1761
1794
|
I,
|
|
1762
|
-
|
|
1763
|
-
|
|
1795
|
+
le,
|
|
1796
|
+
de
|
|
1764
1797
|
]);
|
|
1765
1798
|
e.useEffect(() => {
|
|
1766
|
-
|
|
1767
|
-
}, [
|
|
1768
|
-
let { finalMin:
|
|
1769
|
-
let [e, t] =
|
|
1799
|
+
ue(String(q[0])), fe(String(q[1]));
|
|
1800
|
+
}, [q]);
|
|
1801
|
+
let { finalMin: me, finalMax: he, isValidMin: ge, isValidMax: _e } = e.useMemo(() => {
|
|
1802
|
+
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);
|
|
1770
1803
|
return {
|
|
1771
1804
|
finalMin: i,
|
|
1772
1805
|
finalMax: a,
|
|
@@ -1774,29 +1807,29 @@ var lt = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
1774
1807
|
isValidMax: a <= I && a >= i
|
|
1775
1808
|
};
|
|
1776
1809
|
}, [
|
|
1777
|
-
|
|
1810
|
+
q,
|
|
1778
1811
|
F,
|
|
1779
1812
|
I
|
|
1780
1813
|
]);
|
|
1781
1814
|
e.useEffect(() => {
|
|
1782
1815
|
if (V) return;
|
|
1783
|
-
if (
|
|
1784
|
-
|
|
1816
|
+
if (q[0] === F && q[1] === I) {
|
|
1817
|
+
oe(!1), ce(!1);
|
|
1785
1818
|
return;
|
|
1786
1819
|
}
|
|
1787
1820
|
let e = C ?? 500, n = setTimeout(() => {
|
|
1788
|
-
|
|
1821
|
+
oe(!ge), ce(!_e);
|
|
1789
1822
|
}, 300), r = setTimeout(() => {
|
|
1790
|
-
|
|
1823
|
+
ge && _e && (me === F && he === I ? D(t, !1) : w(t, me, he));
|
|
1791
1824
|
}, e);
|
|
1792
1825
|
return () => {
|
|
1793
1826
|
clearTimeout(n), clearTimeout(r);
|
|
1794
1827
|
};
|
|
1795
1828
|
}, [
|
|
1796
|
-
pe,
|
|
1797
1829
|
me,
|
|
1798
1830
|
he,
|
|
1799
1831
|
ge,
|
|
1832
|
+
_e,
|
|
1800
1833
|
F,
|
|
1801
1834
|
I,
|
|
1802
1835
|
t,
|
|
@@ -1805,51 +1838,51 @@ var lt = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
1805
1838
|
C,
|
|
1806
1839
|
V
|
|
1807
1840
|
]), e.useEffect(() => {
|
|
1808
|
-
|
|
1841
|
+
J([K, ne]), oe(!1), ce(!1);
|
|
1809
1842
|
}, [
|
|
1810
1843
|
K,
|
|
1811
|
-
|
|
1844
|
+
ne,
|
|
1812
1845
|
t
|
|
1813
1846
|
]);
|
|
1814
|
-
let
|
|
1815
|
-
let t =
|
|
1816
|
-
return [t,
|
|
1817
|
-
}, [B]),
|
|
1847
|
+
let ve = e.useCallback((e) => {
|
|
1848
|
+
let t = Q(Math.min(e[0], e[1] - B), B);
|
|
1849
|
+
return [t, Q(Math.max(e[1] - B, t), B)];
|
|
1850
|
+
}, [B]), ye = e.useCallback((e) => {
|
|
1818
1851
|
if (V) return;
|
|
1819
|
-
let [t, n] =
|
|
1820
|
-
|
|
1852
|
+
let [t, n] = ve(e);
|
|
1853
|
+
J([Math.max(F, Math.min(z, t)), Math.max(R, Math.min(I, n))]);
|
|
1821
1854
|
}, [
|
|
1822
1855
|
V,
|
|
1823
|
-
|
|
1856
|
+
ve,
|
|
1824
1857
|
F,
|
|
1825
1858
|
I,
|
|
1826
1859
|
R,
|
|
1827
1860
|
z
|
|
1828
|
-
]),
|
|
1861
|
+
]), be = e.useCallback((e) => {
|
|
1829
1862
|
if (V) return;
|
|
1830
|
-
let [n, r] =
|
|
1831
|
-
i === F && a === I ? (
|
|
1863
|
+
let [n, r] = ve(e), i = Math.max(F, Math.min(z, n)), a = Math.max(R, Math.min(I, r));
|
|
1864
|
+
i === F && a === I ? (J([F, I]), D(t, !0)) : J([i, a]);
|
|
1832
1865
|
}, [
|
|
1833
1866
|
V,
|
|
1834
|
-
|
|
1867
|
+
ve,
|
|
1835
1868
|
F,
|
|
1836
1869
|
I,
|
|
1837
1870
|
R,
|
|
1838
1871
|
z,
|
|
1839
1872
|
t,
|
|
1840
1873
|
D
|
|
1841
|
-
]),
|
|
1874
|
+
]), xe = e.useRef(null), Se = e.useCallback((e, n) => {
|
|
1842
1875
|
if (V) return;
|
|
1843
|
-
let r =
|
|
1876
|
+
let r = xe.current;
|
|
1844
1877
|
if (G && r && r.start === e && r.last === n) {
|
|
1845
|
-
|
|
1878
|
+
xe.current = null, J([F, I]), D(t, !0);
|
|
1846
1879
|
return;
|
|
1847
1880
|
}
|
|
1848
|
-
let i =
|
|
1849
|
-
|
|
1881
|
+
let i = ct(Math.max(F, R, e), F, B), a = Math.max(i, ct(Math.min(I, z, n), F, B));
|
|
1882
|
+
xe.current = {
|
|
1850
1883
|
start: e,
|
|
1851
1884
|
last: n
|
|
1852
|
-
},
|
|
1885
|
+
}, J([i, a]);
|
|
1853
1886
|
}, [
|
|
1854
1887
|
V,
|
|
1855
1888
|
G,
|
|
@@ -1860,50 +1893,50 @@ var lt = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
1860
1893
|
B,
|
|
1861
1894
|
t,
|
|
1862
1895
|
D
|
|
1863
|
-
]),
|
|
1896
|
+
]), Ce = e.useCallback(() => {
|
|
1864
1897
|
if (V) return;
|
|
1865
|
-
let e =
|
|
1898
|
+
let e = le.trim(), t = e === "" ? NaN : Number(e);
|
|
1866
1899
|
if (isNaN(t)) {
|
|
1867
|
-
|
|
1900
|
+
ue(String(q[0]));
|
|
1868
1901
|
return;
|
|
1869
1902
|
}
|
|
1870
1903
|
let n = Math.max(F, Math.min(z, t));
|
|
1871
|
-
n <
|
|
1904
|
+
n < q[1] ? J([n, q[1]]) : J([F, q[1]]), ue(String(n < q[1] ? n : F));
|
|
1872
1905
|
}, [
|
|
1873
1906
|
V,
|
|
1874
|
-
|
|
1875
|
-
|
|
1907
|
+
le,
|
|
1908
|
+
q,
|
|
1876
1909
|
F,
|
|
1877
1910
|
z
|
|
1878
|
-
]),
|
|
1911
|
+
]), we = e.useCallback(() => {
|
|
1879
1912
|
if (V) return;
|
|
1880
|
-
let e =
|
|
1913
|
+
let e = de.trim(), t = e === "" ? NaN : Number(e);
|
|
1881
1914
|
if (isNaN(t)) {
|
|
1882
|
-
|
|
1915
|
+
fe(String(q[1]));
|
|
1883
1916
|
return;
|
|
1884
1917
|
}
|
|
1885
1918
|
let n = Math.max(R, Math.min(I, t));
|
|
1886
|
-
n >
|
|
1919
|
+
n > q[0] ? J([q[0], n]) : J([q[0], I]), fe(String(n > q[0] ? n : I));
|
|
1887
1920
|
}, [
|
|
1888
1921
|
V,
|
|
1889
|
-
|
|
1890
|
-
|
|
1922
|
+
de,
|
|
1923
|
+
q,
|
|
1891
1924
|
R,
|
|
1892
1925
|
I
|
|
1893
|
-
]),
|
|
1926
|
+
]), Te = (e) => (t) => {
|
|
1894
1927
|
t.key === "Enter" && e();
|
|
1895
|
-
}, [
|
|
1928
|
+
}, [Ee, De] = e.useState(null), Oe = e.useRef(null);
|
|
1896
1929
|
e.useEffect(() => {
|
|
1897
1930
|
if (!u) return;
|
|
1898
1931
|
let e = `${F}:${I}`;
|
|
1899
|
-
if (e ===
|
|
1932
|
+
if (e === Oe.current && Oe.current !== null) return;
|
|
1900
1933
|
let n = y?.[t];
|
|
1901
1934
|
if (!Array.isArray(n) || n.length === 0) return;
|
|
1902
1935
|
let r = n.filter((e) => e.value != null && !isNaN(Number(e.key))).map((e) => ({
|
|
1903
1936
|
key: e.key,
|
|
1904
1937
|
value: e.value
|
|
1905
1938
|
}));
|
|
1906
|
-
r.length > 0 && (
|
|
1939
|
+
r.length > 0 && (Oe.current = e, De(r));
|
|
1907
1940
|
}, [
|
|
1908
1941
|
F,
|
|
1909
1942
|
I,
|
|
@@ -1911,22 +1944,22 @@ var lt = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
1911
1944
|
t,
|
|
1912
1945
|
u
|
|
1913
1946
|
]);
|
|
1914
|
-
let
|
|
1915
|
-
if (!u || !
|
|
1947
|
+
let ke = e.useMemo(() => {
|
|
1948
|
+
if (!u || !Ee || Ee.length === 0) return [];
|
|
1916
1949
|
let e = I - F;
|
|
1917
1950
|
if (e <= 0) return [];
|
|
1918
|
-
let t = d ?? Math.max(B,
|
|
1951
|
+
let t = d ?? Math.max(B, Q(Math.ceil(e / 20 / B) * B, B)), n = Math.ceil(e / t);
|
|
1919
1952
|
return Array.from({ length: n }, (e, r) => {
|
|
1920
|
-
let i = F + r * t, a = F + (r + 1) * t, o = r === n - 1, s =
|
|
1953
|
+
let i = F + r * t, a = F + (r + 1) * t, o = r === n - 1, s = Ee.filter((e) => {
|
|
1921
1954
|
let t = Number(e.key);
|
|
1922
1955
|
return t >= i && (t < a || o && t <= I);
|
|
1923
|
-
}).reduce((e, t) => e + t.value, 0), c = o ? I :
|
|
1956
|
+
}).reduce((e, t) => e + t.value, 0), c = o ? I : Q(a - B, B);
|
|
1924
1957
|
return {
|
|
1925
1958
|
bucketStart: i,
|
|
1926
1959
|
bucketEnd: a,
|
|
1927
1960
|
count: s,
|
|
1928
1961
|
last: c,
|
|
1929
|
-
barEnd:
|
|
1962
|
+
barEnd: Q(c + B, B)
|
|
1930
1963
|
};
|
|
1931
1964
|
}).map((e, t, n) => ({
|
|
1932
1965
|
...e,
|
|
@@ -1934,92 +1967,92 @@ var lt = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
1934
1967
|
}));
|
|
1935
1968
|
}, [
|
|
1936
1969
|
u,
|
|
1937
|
-
|
|
1970
|
+
Ee,
|
|
1938
1971
|
F,
|
|
1939
1972
|
I,
|
|
1940
1973
|
d,
|
|
1941
1974
|
B,
|
|
1942
1975
|
W
|
|
1943
|
-
]),
|
|
1944
|
-
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(
|
|
1976
|
+
]), Ae = e.useMemo(() => Math.max(...ke.map((e) => e.count), 1), [ke]);
|
|
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(nt, {
|
|
1945
1978
|
title: n,
|
|
1946
1979
|
variant: "slider",
|
|
1947
1980
|
withHistogram: u,
|
|
1948
1981
|
collapsible: c,
|
|
1949
1982
|
startCollapsed: l
|
|
1950
|
-
}) : !O && !S ? null : b?.includes(t) ?
|
|
1983
|
+
}) : !O && !S ? null : b?.includes(t) ? j === "slider" ? /* @__PURE__ */ p(T, {
|
|
1951
1984
|
title: n,
|
|
1952
1985
|
collapsed: l,
|
|
1953
1986
|
collapsible: c,
|
|
1954
1987
|
className: te,
|
|
1955
1988
|
children: [
|
|
1956
1989
|
V && /* @__PURE__ */ p("div", {
|
|
1957
|
-
className:
|
|
1990
|
+
className: Z.disabledMessage,
|
|
1958
1991
|
children: [
|
|
1959
1992
|
"No adjustable range (all results have the same value: ",
|
|
1960
1993
|
F,
|
|
1961
1994
|
")."
|
|
1962
1995
|
]
|
|
1963
1996
|
}),
|
|
1964
|
-
u &&
|
|
1965
|
-
u &&
|
|
1966
|
-
let [e, t] = z > R && (R > F || z < I) ? [R, z] : [H, U], n = Math.max(
|
|
1997
|
+
u && ke.length === 0 && /* @__PURE__ */ f("div", { className: Z.histogram }),
|
|
1998
|
+
u && ke.length > 0 && (() => {
|
|
1999
|
+
let [e, t] = z > R && (R > F || z < I) ? [R, z] : [H, U], n = Math.max(me, e), r = Math.min(he, 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 = ke.slice(1).map((e) => u((e.bucketStart - H) / a)), _ = ke.map((e) => ({
|
|
1967
2000
|
...e,
|
|
1968
|
-
height: Math.max(1, Math.ceil(e.count /
|
|
2001
|
+
height: Math.max(1, Math.ceil(e.count / Ae * 20))
|
|
1969
2002
|
}));
|
|
1970
2003
|
return /* @__PURE__ */ p("div", {
|
|
1971
|
-
className:
|
|
2004
|
+
className: Z.histogram,
|
|
1972
2005
|
children: [
|
|
1973
2006
|
/* @__PURE__ */ f("div", {
|
|
1974
|
-
className:
|
|
2007
|
+
className: Z.histogramLayer,
|
|
1975
2008
|
children: _.map((e, t) => /* @__PURE__ */ f("button", {
|
|
1976
2009
|
type: "button",
|
|
1977
|
-
className:
|
|
2010
|
+
className: Z.histogramBar,
|
|
1978
2011
|
style: { flexGrow: e.span },
|
|
1979
2012
|
"data-testid": "histogram-bar",
|
|
1980
2013
|
disabled: V || h(e),
|
|
1981
2014
|
"aria-label": `${e.bucketStart} to ${e.last}: ${e.count}`,
|
|
1982
2015
|
title: `${e.bucketStart} to ${e.last}: ${e.count}`,
|
|
1983
|
-
onClick: () =>
|
|
2016
|
+
onClick: () => Se(e.bucketStart, e.last),
|
|
1984
2017
|
children: /* @__PURE__ */ f("span", {
|
|
1985
|
-
className:
|
|
2018
|
+
className: Z.histogramFill,
|
|
1986
2019
|
style: { height: `${e.height}px` }
|
|
1987
2020
|
})
|
|
1988
2021
|
}, t))
|
|
1989
2022
|
}),
|
|
1990
2023
|
/* @__PURE__ */ f("div", {
|
|
1991
|
-
className: `${
|
|
2024
|
+
className: `${Z.histogramLayer} ${Z.histogramLive}`,
|
|
1992
2025
|
"aria-hidden": "true",
|
|
1993
2026
|
"data-testid": "histogram-live",
|
|
1994
2027
|
style: { clipPath: m },
|
|
1995
2028
|
children: _.map((e, t) => /* @__PURE__ */ f("span", {
|
|
1996
|
-
className:
|
|
2029
|
+
className: Z.histogramBar,
|
|
1997
2030
|
style: { flexGrow: e.span },
|
|
1998
2031
|
children: /* @__PURE__ */ f("span", {
|
|
1999
|
-
className:
|
|
2032
|
+
className: Z.histogramFill,
|
|
2000
2033
|
style: { height: `${e.height}px` }
|
|
2001
2034
|
})
|
|
2002
2035
|
}, t))
|
|
2003
2036
|
}),
|
|
2004
2037
|
/* @__PURE__ */ f("div", {
|
|
2005
|
-
className: `${
|
|
2038
|
+
className: `${Z.histogramLayer} ${Z.histogramLit}`,
|
|
2006
2039
|
"aria-hidden": "true",
|
|
2007
2040
|
"data-testid": "histogram-lit",
|
|
2008
2041
|
style: { clipPath: d },
|
|
2009
2042
|
children: _.map((e, t) => /* @__PURE__ */ f("span", {
|
|
2010
|
-
className:
|
|
2043
|
+
className: Z.histogramBar,
|
|
2011
2044
|
style: { flexGrow: e.span },
|
|
2012
2045
|
children: /* @__PURE__ */ f("span", {
|
|
2013
|
-
className:
|
|
2046
|
+
className: Z.histogramFill,
|
|
2014
2047
|
style: { height: `${e.height}px` }
|
|
2015
2048
|
})
|
|
2016
2049
|
}, t))
|
|
2017
2050
|
}),
|
|
2018
2051
|
/* @__PURE__ */ f("div", {
|
|
2019
|
-
className:
|
|
2052
|
+
className: Z.histogramSeparators,
|
|
2020
2053
|
"aria-hidden": "true",
|
|
2021
2054
|
children: g.map((e, t) => /* @__PURE__ */ f("span", {
|
|
2022
|
-
className:
|
|
2055
|
+
className: Z.histogramSeparator,
|
|
2023
2056
|
style: { left: e }
|
|
2024
2057
|
}, t))
|
|
2025
2058
|
})
|
|
@@ -2028,20 +2061,20 @@ var lt = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
2028
2061
|
})(),
|
|
2029
2062
|
/* @__PURE__ */ f("div", {
|
|
2030
2063
|
style: { padding: "10px 10px 20px 10px" },
|
|
2031
|
-
children: /* @__PURE__ */ f(
|
|
2064
|
+
children: /* @__PURE__ */ f(M, {
|
|
2032
2065
|
min: H,
|
|
2033
2066
|
max: W,
|
|
2034
2067
|
step: B,
|
|
2035
2068
|
stepMarks: h,
|
|
2036
|
-
value: V ? [H, W] : [ee(
|
|
2069
|
+
value: V ? [H, W] : [ee(ct(me, H, B)), ee(ct(he + B, H, B))],
|
|
2037
2070
|
isRange: !0,
|
|
2038
|
-
onChange: (e) =>
|
|
2039
|
-
onFinalChange: (e) =>
|
|
2071
|
+
onChange: (e) => ye(e),
|
|
2072
|
+
onFinalChange: (e) => be(e),
|
|
2040
2073
|
disabled: V,
|
|
2041
2074
|
activeMin: R,
|
|
2042
|
-
activeMax: ee(
|
|
2043
|
-
isFaceted:
|
|
2044
|
-
highlightFaceted:
|
|
2075
|
+
activeMax: ee(Q(z + B, B)),
|
|
2076
|
+
isFaceted: ie,
|
|
2077
|
+
highlightFaceted: re,
|
|
2045
2078
|
"aria-label": n || `Filter by ${t}`
|
|
2046
2079
|
})
|
|
2047
2080
|
}),
|
|
@@ -2055,27 +2088,27 @@ var lt = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
2055
2088
|
children: [/* @__PURE__ */ f(E, {
|
|
2056
2089
|
label: "Min:",
|
|
2057
2090
|
type: "number",
|
|
2058
|
-
style:
|
|
2059
|
-
value: V ? String(F) :
|
|
2091
|
+
style: pe,
|
|
2092
|
+
value: V ? String(F) : le,
|
|
2060
2093
|
min: F,
|
|
2061
|
-
max:
|
|
2062
|
-
onChange: (e) =>
|
|
2063
|
-
onBlur:
|
|
2064
|
-
onKeyDown:
|
|
2094
|
+
max: Q(Math.min(z, q[1] - B), B),
|
|
2095
|
+
onChange: (e) => ue(e.target.value),
|
|
2096
|
+
onBlur: Ce,
|
|
2097
|
+
onKeyDown: Te(Ce),
|
|
2065
2098
|
disabled: V,
|
|
2066
|
-
isValid: V || !
|
|
2099
|
+
isValid: V || !ae
|
|
2067
2100
|
}), /* @__PURE__ */ f(E, {
|
|
2068
2101
|
label: "Max:",
|
|
2069
2102
|
type: "number",
|
|
2070
|
-
style:
|
|
2071
|
-
value: V ? String(I) :
|
|
2072
|
-
min:
|
|
2103
|
+
style: pe,
|
|
2104
|
+
value: V ? String(I) : de,
|
|
2105
|
+
min: Q(Math.max(R, q[0] + B), B),
|
|
2073
2106
|
max: I,
|
|
2074
|
-
onChange: (e) =>
|
|
2075
|
-
onBlur:
|
|
2076
|
-
onKeyDown: we
|
|
2107
|
+
onChange: (e) => fe(e.target.value),
|
|
2108
|
+
onBlur: we,
|
|
2109
|
+
onKeyDown: Te(we),
|
|
2077
2110
|
disabled: V,
|
|
2078
|
-
isValid: V || !
|
|
2111
|
+
isValid: V || !se
|
|
2079
2112
|
})]
|
|
2080
2113
|
})
|
|
2081
2114
|
]
|
|
@@ -2083,7 +2116,7 @@ var lt = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
2083
2116
|
title: n,
|
|
2084
2117
|
className: te,
|
|
2085
2118
|
children: [V && /* @__PURE__ */ p("div", {
|
|
2086
|
-
className:
|
|
2119
|
+
className: Z.disabledMessage,
|
|
2087
2120
|
children: [
|
|
2088
2121
|
"No adjustable range (all results have the same value: ",
|
|
2089
2122
|
F,
|
|
@@ -2098,35 +2131,35 @@ var lt = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
2098
2131
|
children: [/* @__PURE__ */ f(E, {
|
|
2099
2132
|
label: "Min:",
|
|
2100
2133
|
type: "number",
|
|
2101
|
-
style:
|
|
2102
|
-
value: V ? String(F) :
|
|
2134
|
+
style: pe,
|
|
2135
|
+
value: V ? String(F) : le,
|
|
2103
2136
|
min: F,
|
|
2104
|
-
max:
|
|
2105
|
-
onChange: (e) =>
|
|
2106
|
-
onBlur:
|
|
2107
|
-
onKeyDown:
|
|
2137
|
+
max: Q(Math.min(z, q[1] - B), B),
|
|
2138
|
+
onChange: (e) => ue(e.target.value),
|
|
2139
|
+
onBlur: Ce,
|
|
2140
|
+
onKeyDown: Te(Ce),
|
|
2108
2141
|
disabled: V,
|
|
2109
|
-
isValid: V || !
|
|
2142
|
+
isValid: V || !ae
|
|
2110
2143
|
}), /* @__PURE__ */ f(E, {
|
|
2111
2144
|
label: "Max:",
|
|
2112
2145
|
type: "number",
|
|
2113
|
-
style:
|
|
2114
|
-
value: V ? String(I) :
|
|
2115
|
-
min:
|
|
2146
|
+
style: pe,
|
|
2147
|
+
value: V ? String(I) : de,
|
|
2148
|
+
min: Q(Math.max(R, q[0] + B), B),
|
|
2116
2149
|
max: I,
|
|
2117
|
-
onChange: (e) =>
|
|
2118
|
-
onBlur:
|
|
2119
|
-
onKeyDown: we
|
|
2150
|
+
onChange: (e) => fe(e.target.value),
|
|
2151
|
+
onBlur: we,
|
|
2152
|
+
onKeyDown: Te(we),
|
|
2120
2153
|
disabled: V,
|
|
2121
|
-
isValid: V || !
|
|
2154
|
+
isValid: V || !se
|
|
2122
2155
|
})]
|
|
2123
2156
|
})]
|
|
2124
|
-
}) : /* @__PURE__ */ f(
|
|
2157
|
+
}) : /* @__PURE__ */ f(it, {
|
|
2125
2158
|
label: n,
|
|
2126
2159
|
field: t,
|
|
2127
2160
|
missing: ["filterable"]
|
|
2128
2161
|
});
|
|
2129
|
-
},
|
|
2162
|
+
}, dt = {
|
|
2130
2163
|
list: "_list_9je85_2",
|
|
2131
2164
|
grid: "_grid_9je85_9",
|
|
2132
2165
|
count: "_count_9je85_22",
|
|
@@ -2134,29 +2167,28 @@ var lt = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
2134
2167
|
chip: "_chip_9je85_35",
|
|
2135
2168
|
active: "_active_9je85_41"
|
|
2136
2169
|
};
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
function dt(e, t) {
|
|
2170
|
+
// src/components/BucketFilterPanel.tsx
|
|
2171
|
+
function ft(e, t) {
|
|
2140
2172
|
if (!t) return null;
|
|
2141
2173
|
let n = 0, r = !1;
|
|
2142
2174
|
for (let i of t) {
|
|
2143
2175
|
let t = Number(i.key);
|
|
2144
|
-
if (!
|
|
2176
|
+
if (!Number.isNaN(t) && e.contains(t)) {
|
|
2145
2177
|
if (typeof i.value != "number") return null;
|
|
2146
2178
|
n += i.value, r = !0;
|
|
2147
2179
|
}
|
|
2148
2180
|
}
|
|
2149
2181
|
return r ? n : 0;
|
|
2150
2182
|
}
|
|
2151
|
-
var
|
|
2152
|
-
let { state: { facets: v, filterableFields: x, facetableFields: S, bucketFilters: C, rangeBounds: w, facetStats: E, query:
|
|
2183
|
+
var pt = ({ 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 }) => {
|
|
2184
|
+
let { state: { facets: v, filterableFields: x, facetableFields: S, bucketFilters: C, rangeBounds: w, facetStats: E, query: D }, toggleBucketFilter: k, authError: A, isFetchingInitial: j, allowEmptySearch: M } = Y(), N = i ?? a ?? "checkbox", P = v?.[e], F = C[e] ?? [], [I, L] = l(m ?? Infinity);
|
|
2153
2185
|
o(() => {
|
|
2154
2186
|
L(m ?? Infinity);
|
|
2155
2187
|
}, [m, P]);
|
|
2156
2188
|
let R = w?.[e] ?? E?.[e], z = s(() => {
|
|
2157
2189
|
let e = [];
|
|
2158
2190
|
if (R && e.push(R.min, R.max), Array.isArray(P)) for (let t of P) e.push(Number(t.key));
|
|
2159
|
-
return
|
|
2191
|
+
return st(e.filter(Number.isFinite));
|
|
2160
2192
|
}, [R, P]), B = s(() => {
|
|
2161
2193
|
let e = R?.min ?? -Number.MAX_VALUE, t = R?.max ?? Number.MAX_VALUE, i = (n, r, i) => ({
|
|
2162
2194
|
label: i ?? (n === void 0 ? `up to ${r}` : r === void 0 ? `${n} and up` : `${n}-${r}`),
|
|
@@ -2169,12 +2201,12 @@ var ft = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2169
2201
|
if (r && r.length > 0) return r.map((e) => i(e.min, e.max, e.label));
|
|
2170
2202
|
if (Array.isArray(n)) {
|
|
2171
2203
|
let e = [...n].sort((e, t) => e - t), t = [];
|
|
2172
|
-
for (let n = 0; n < e.length - 1; n++) t.push(i(e[n],
|
|
2204
|
+
for (let n = 0; n < e.length - 1; n++) t.push(i(e[n], Q(e[n + 1] - z, z)));
|
|
2173
2205
|
return t;
|
|
2174
2206
|
}
|
|
2175
2207
|
if (typeof n == "number" && n > 0 && R) {
|
|
2176
2208
|
let e = [], t = Math.floor(R.min / n) * n;
|
|
2177
|
-
for (let r = t; r <= R.max; r =
|
|
2209
|
+
for (let r = t; r <= R.max; r = Q(r + n, z)) e.push(i(Q(r, z), Q(r + n - z, z)));
|
|
2178
2210
|
return e;
|
|
2179
2211
|
}
|
|
2180
2212
|
return [];
|
|
@@ -2185,27 +2217,27 @@ var ft = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2185
2217
|
z
|
|
2186
2218
|
]);
|
|
2187
2219
|
if (A) return null;
|
|
2188
|
-
if (j || !v) return /* @__PURE__ */ f(
|
|
2220
|
+
if (j || !v) return /* @__PURE__ */ f(nt, {
|
|
2189
2221
|
title: t,
|
|
2190
2222
|
rows: Math.max(1, Math.min(B.length || 5, 8)),
|
|
2191
2223
|
collapsible: g,
|
|
2192
2224
|
startCollapsed: _
|
|
2193
2225
|
});
|
|
2194
|
-
if (!M && !
|
|
2195
|
-
if (!x?.includes(e)) return /* @__PURE__ */ f(
|
|
2226
|
+
if (!M && !D) return null;
|
|
2227
|
+
if (!x?.includes(e)) return /* @__PURE__ */ f(it, {
|
|
2196
2228
|
label: t,
|
|
2197
2229
|
field: e,
|
|
2198
2230
|
missing: ["filterable"]
|
|
2199
2231
|
});
|
|
2200
2232
|
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) => ({
|
|
2201
2233
|
bucket: e,
|
|
2202
|
-
count: V ?
|
|
2234
|
+
count: V ? ft(e, P) : null
|
|
2203
2235
|
}));
|
|
2204
2236
|
if (d || (U = U.filter((e) => e.count !== 0 || H(e.bucket))), U.length === 0) return null;
|
|
2205
2237
|
let W = U.slice(0, I), ee = (t, n) => {
|
|
2206
2238
|
let r = H(t), i = n === 0 && !r, a = u && (n ?? 0) > 0 ? `${n}` : "", o = () => k(e, t.range, N === "radio");
|
|
2207
2239
|
if (N === "radio") {
|
|
2208
|
-
let n = /* @__PURE__ */ f(
|
|
2240
|
+
let n = /* @__PURE__ */ f(O, {
|
|
2209
2241
|
id: `${e}-${t.range.min}-${t.range.max}`,
|
|
2210
2242
|
name: e,
|
|
2211
2243
|
value: t.label,
|
|
@@ -2215,9 +2247,9 @@ var ft = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2215
2247
|
disabled: i
|
|
2216
2248
|
});
|
|
2217
2249
|
return c === "list" ? /* @__PURE__ */ p("div", {
|
|
2218
|
-
className:
|
|
2250
|
+
className: dt.count,
|
|
2219
2251
|
children: [n, /* @__PURE__ */ f("span", {
|
|
2220
|
-
className:
|
|
2252
|
+
className: dt.countValue,
|
|
2221
2253
|
children: a
|
|
2222
2254
|
})]
|
|
2223
2255
|
}) : n;
|
|
@@ -2228,19 +2260,19 @@ var ft = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2228
2260
|
onClick: o,
|
|
2229
2261
|
disabled: i,
|
|
2230
2262
|
size: "micro",
|
|
2231
|
-
className:
|
|
2263
|
+
className: dt.chip,
|
|
2232
2264
|
children: c === "grid" && a ? `${t.label} (${a})` : t.label
|
|
2233
2265
|
});
|
|
2234
2266
|
return c === "list" ? /* @__PURE__ */ p("div", {
|
|
2235
|
-
className:
|
|
2267
|
+
className: dt.count,
|
|
2236
2268
|
children: [e, /* @__PURE__ */ f("span", {
|
|
2237
|
-
className:
|
|
2269
|
+
className: dt.countValue,
|
|
2238
2270
|
children: a
|
|
2239
2271
|
})]
|
|
2240
2272
|
}) : e;
|
|
2241
2273
|
}
|
|
2242
2274
|
return c === "list" ? /* @__PURE__ */ p("div", {
|
|
2243
|
-
className:
|
|
2275
|
+
className: dt.count,
|
|
2244
2276
|
children: [/* @__PURE__ */ f(b, {
|
|
2245
2277
|
label: t.label,
|
|
2246
2278
|
score: "",
|
|
@@ -2248,7 +2280,7 @@ var ft = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2248
2280
|
onChange: o,
|
|
2249
2281
|
disabled: i
|
|
2250
2282
|
}), /* @__PURE__ */ f("span", {
|
|
2251
|
-
className:
|
|
2283
|
+
className: dt.countValue,
|
|
2252
2284
|
children: a
|
|
2253
2285
|
})]
|
|
2254
2286
|
}) : /* @__PURE__ */ f(b, {
|
|
@@ -2263,9 +2295,9 @@ var ft = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2263
2295
|
title: t,
|
|
2264
2296
|
collapsible: g,
|
|
2265
2297
|
collapsed: g ? _ : !1,
|
|
2266
|
-
className: h && F.length > 0 ?
|
|
2298
|
+
className: h && F.length > 0 ? dt.active : void 0,
|
|
2267
2299
|
children: /* @__PURE__ */ p("ul", {
|
|
2268
|
-
className: c === "grid" ?
|
|
2300
|
+
className: c === "grid" ? dt.grid : dt.list,
|
|
2269
2301
|
style: {
|
|
2270
2302
|
listStyle: "none",
|
|
2271
2303
|
padding: 0,
|
|
@@ -2279,34 +2311,34 @@ var ft = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2279
2311
|
}) })]
|
|
2280
2312
|
})
|
|
2281
2313
|
});
|
|
2282
|
-
},
|
|
2314
|
+
}, mt = {
|
|
2283
2315
|
grid: "_grid_1xjna_2",
|
|
2284
2316
|
chip: "_chip_1xjna_21",
|
|
2285
2317
|
chipLabel: "_chipLabel_1xjna_32"
|
|
2286
|
-
},
|
|
2318
|
+
}, ht = r(({ field: e, value: t, onReset: n }) => /* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(y, {
|
|
2287
2319
|
onClick: n,
|
|
2288
|
-
iconRight: /* @__PURE__ */ f(
|
|
2320
|
+
iconRight: /* @__PURE__ */ f(ie, {}),
|
|
2289
2321
|
variant: "primary",
|
|
2290
2322
|
size: "micro",
|
|
2291
|
-
className:
|
|
2323
|
+
className: mt.chip,
|
|
2292
2324
|
title: `${e}: ${t}`,
|
|
2293
2325
|
children: /* @__PURE__ */ p("span", {
|
|
2294
|
-
className:
|
|
2326
|
+
className: mt.chipLabel,
|
|
2295
2327
|
children: [
|
|
2296
2328
|
e,
|
|
2297
2329
|
": ",
|
|
2298
2330
|
t
|
|
2299
2331
|
]
|
|
2300
2332
|
})
|
|
2301
|
-
}) })),
|
|
2333
|
+
}) })), gt = r(({ field: e, min: t, max: n, onReset: r }) => /* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(y, {
|
|
2302
2334
|
onClick: r,
|
|
2303
|
-
iconRight: /* @__PURE__ */ f(
|
|
2335
|
+
iconRight: /* @__PURE__ */ f(ie, {}),
|
|
2304
2336
|
variant: "primary",
|
|
2305
2337
|
size: "micro",
|
|
2306
|
-
className:
|
|
2338
|
+
className: mt.chip,
|
|
2307
2339
|
title: `${e}: ${t} β ${n}`,
|
|
2308
2340
|
children: /* @__PURE__ */ p("span", {
|
|
2309
|
-
className:
|
|
2341
|
+
className: mt.chipLabel,
|
|
2310
2342
|
children: [
|
|
2311
2343
|
e,
|
|
2312
2344
|
": ",
|
|
@@ -2315,15 +2347,15 @@ var ft = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2315
2347
|
n
|
|
2316
2348
|
]
|
|
2317
2349
|
})
|
|
2318
|
-
}) })),
|
|
2350
|
+
}) })), _t = r(({ field: e, label: t, onReset: n }) => /* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(y, {
|
|
2319
2351
|
onClick: n,
|
|
2320
|
-
iconRight: /* @__PURE__ */ f(
|
|
2352
|
+
iconRight: /* @__PURE__ */ f(ie, {}),
|
|
2321
2353
|
variant: "primary",
|
|
2322
2354
|
size: "micro",
|
|
2323
|
-
className:
|
|
2355
|
+
className: mt.chip,
|
|
2324
2356
|
title: `${e}: ${t}`,
|
|
2325
2357
|
children: /* @__PURE__ */ p("span", {
|
|
2326
|
-
className:
|
|
2358
|
+
className: mt.chipLabel,
|
|
2327
2359
|
children: [
|
|
2328
2360
|
e,
|
|
2329
2361
|
": ",
|
|
@@ -2331,8 +2363,8 @@ var ft = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2331
2363
|
]
|
|
2332
2364
|
})
|
|
2333
2365
|
}) }));
|
|
2334
|
-
function
|
|
2335
|
-
let { state: { filters: e, rangeFilters: t, bucketFilters: n }, resetFilters: r, resetSingleFilter: i, resetRangeFilter: a, resetBucketFilter: o } =
|
|
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) => ({
|
|
2336
2368
|
field: e,
|
|
2337
2369
|
value: t
|
|
2338
2370
|
}))).flat(), [e]), l = s(() => Object.entries(t).map(([e, { min: t, max: n }]) => ({
|
|
@@ -2352,20 +2384,20 @@ function _t() {
|
|
|
2352
2384
|
collapsible: !1,
|
|
2353
2385
|
title: "Active filters",
|
|
2354
2386
|
children: /* @__PURE__ */ p("ul", {
|
|
2355
|
-
className:
|
|
2387
|
+
className: mt.grid,
|
|
2356
2388
|
children: [
|
|
2357
|
-
c.map(({ field: e, value: t }) => /* @__PURE__ */ f(
|
|
2389
|
+
c.map(({ field: e, value: t }) => /* @__PURE__ */ f(ht, {
|
|
2358
2390
|
field: e,
|
|
2359
2391
|
value: t,
|
|
2360
2392
|
onReset: () => i(e, t)
|
|
2361
2393
|
}, `${e}-${t}`)),
|
|
2362
|
-
l.map(({ field: e, min: t, max: n }) => /* @__PURE__ */ f(
|
|
2394
|
+
l.map(({ field: e, min: t, max: n }) => /* @__PURE__ */ f(gt, {
|
|
2363
2395
|
field: e,
|
|
2364
2396
|
min: t,
|
|
2365
2397
|
max: n,
|
|
2366
2398
|
onReset: () => a(e)
|
|
2367
2399
|
}, e)),
|
|
2368
|
-
u.map(({ field: e, range: t, label: n }) => /* @__PURE__ */ f(
|
|
2400
|
+
u.map(({ field: e, range: t, label: n }) => /* @__PURE__ */ f(_t, {
|
|
2369
2401
|
field: e,
|
|
2370
2402
|
label: n,
|
|
2371
2403
|
onReset: () => o(e, t)
|
|
@@ -2380,12 +2412,12 @@ function _t() {
|
|
|
2380
2412
|
})
|
|
2381
2413
|
}) : null;
|
|
2382
2414
|
}
|
|
2383
|
-
var
|
|
2415
|
+
var yt = {
|
|
2384
2416
|
select: "_select_nwf7i_1",
|
|
2385
2417
|
radioGroup: "_radioGroup_nwf7i_6"
|
|
2386
|
-
},
|
|
2387
|
-
let o = n ?? (r === "radio" ? "radio" : "select"), { state: { sortableFields: s, sortBy: c, sortAscending: l }, setSort: u, isFetchingInitial: d } =
|
|
2388
|
-
if (d) return /* @__PURE__ */ f(
|
|
2418
|
+
}, bt = ({ options: e, noneLabel: t = "None", control: n, displayType: r, collapsible: i = !0, startCollapsed: a = !1 }) => {
|
|
2419
|
+
let o = n ?? (r === "radio" ? "radio" : "select"), { state: { sortableFields: s, sortBy: c, sortAscending: l }, setSort: u, isFetchingInitial: d } = Y();
|
|
2420
|
+
if (d) return /* @__PURE__ */ f(nt, {
|
|
2389
2421
|
title: "Sort by",
|
|
2390
2422
|
rows: o === "radio" ? 3 : 1,
|
|
2391
2423
|
collapsible: i,
|
|
@@ -2415,15 +2447,15 @@ var vt = {
|
|
|
2415
2447
|
title: "Sort by",
|
|
2416
2448
|
collapsible: i,
|
|
2417
2449
|
collapsed: i ? a : !1,
|
|
2418
|
-
children: o === "select" ? /* @__PURE__ */ f(
|
|
2450
|
+
children: o === "select" ? /* @__PURE__ */ f(A, {
|
|
2419
2451
|
value: p,
|
|
2420
2452
|
onValueChange: g,
|
|
2421
2453
|
options: h,
|
|
2422
2454
|
placeholder: "Select sort...",
|
|
2423
2455
|
"aria-label": "Sort by"
|
|
2424
2456
|
}) : /* @__PURE__ */ f("div", {
|
|
2425
|
-
className:
|
|
2426
|
-
children: h.map((e) => /* @__PURE__ */ f(
|
|
2457
|
+
className: yt.radioGroup,
|
|
2458
|
+
children: h.map((e) => /* @__PURE__ */ f(O, {
|
|
2427
2459
|
id: `sort-${e.value}`,
|
|
2428
2460
|
name: "sort-by",
|
|
2429
2461
|
value: e.value,
|
|
@@ -2433,7 +2465,7 @@ var vt = {
|
|
|
2433
2465
|
}, e.value))
|
|
2434
2466
|
})
|
|
2435
2467
|
});
|
|
2436
|
-
},
|
|
2468
|
+
}, xt = { list: "_list_1y4fk_1" }, St = {
|
|
2437
2469
|
coverageDepth: 500,
|
|
2438
2470
|
coverWholeQuery: !0,
|
|
2439
2471
|
coverWholeWords: !0,
|
|
@@ -2448,8 +2480,8 @@ var vt = {
|
|
|
2448
2480
|
truncateWordHitTolerance: 0,
|
|
2449
2481
|
truncationScore: 65024
|
|
2450
2482
|
};
|
|
2451
|
-
function
|
|
2452
|
-
let { state: { searchSettings: e }, setSearchSettings: t, url: n, team: r, dataset: i, authenticatedFetch: a } =
|
|
2483
|
+
function Ct() {
|
|
2484
|
+
let { state: { searchSettings: e }, setSearchSettings: t, url: n, team: r, dataset: i, authenticatedFetch: a } = Y(), [s, c] = l(!1), [u, m] = l(null);
|
|
2453
2485
|
o(() => {
|
|
2454
2486
|
let e = !0;
|
|
2455
2487
|
try {
|
|
@@ -2466,7 +2498,7 @@ function St() {
|
|
|
2466
2498
|
i,
|
|
2467
2499
|
a
|
|
2468
2500
|
]);
|
|
2469
|
-
let h = e.coverageSetup, g = (e) => h[e] !== void 0 && h[e] !== null, _ = (e) => h[e] ?? u?.coverageSetup?.[e] ??
|
|
2501
|
+
let h = e.coverageSetup, g = (e) => h[e] !== void 0 && h[e] !== null, _ = (e) => h[e] ?? u?.coverageSetup?.[e] ?? St[e], v = e.coverageDepth ?? u?.coverageDepth ?? St.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) => {
|
|
2470
2502
|
let r = parseInt(n, 10);
|
|
2471
2503
|
isNaN(r) || t({ [e]: r });
|
|
2472
2504
|
}, w = (e, n) => {
|
|
@@ -2487,7 +2519,7 @@ function St() {
|
|
|
2487
2519
|
collapsed: !0,
|
|
2488
2520
|
title: "Settings",
|
|
2489
2521
|
children: /* @__PURE__ */ p("ul", {
|
|
2490
|
-
className:
|
|
2522
|
+
className: xt.list,
|
|
2491
2523
|
children: [
|
|
2492
2524
|
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(E, {
|
|
2493
2525
|
label: "Max Results",
|
|
@@ -2513,7 +2545,7 @@ function St() {
|
|
|
2513
2545
|
}
|
|
2514
2546
|
}), /* @__PURE__ */ f("div", {
|
|
2515
2547
|
style: { padding: "10px 10px 20px 10px" },
|
|
2516
|
-
children: /* @__PURE__ */ f(
|
|
2548
|
+
children: /* @__PURE__ */ f(M, {
|
|
2517
2549
|
min: 0,
|
|
2518
2550
|
max: 65535,
|
|
2519
2551
|
step: 1,
|
|
@@ -2532,17 +2564,17 @@ function St() {
|
|
|
2532
2564
|
t({ placeholderText: e.target.value });
|
|
2533
2565
|
}
|
|
2534
2566
|
}) }),
|
|
2535
|
-
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(
|
|
2567
|
+
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(P, {
|
|
2536
2568
|
label: "Show score",
|
|
2537
2569
|
checked: e.showScore,
|
|
2538
2570
|
onChange: (e) => w("showScore", e)
|
|
2539
2571
|
}) }),
|
|
2540
|
-
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(
|
|
2572
|
+
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(P, {
|
|
2541
2573
|
label: "Enable Coverage",
|
|
2542
2574
|
checked: e.enableCoverage,
|
|
2543
2575
|
onChange: (e) => w("enableCoverage", e)
|
|
2544
2576
|
}) }),
|
|
2545
|
-
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(
|
|
2577
|
+
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(P, {
|
|
2546
2578
|
label: "Remove Duplicates",
|
|
2547
2579
|
checked: e.removeDuplicates,
|
|
2548
2580
|
onChange: (e) => w("removeDuplicates", e)
|
|
@@ -2550,42 +2582,42 @@ function St() {
|
|
|
2550
2582
|
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(y, {
|
|
2551
2583
|
variant: "ghost",
|
|
2552
2584
|
size: "micro",
|
|
2553
|
-
iconRight: f(s ?
|
|
2585
|
+
iconRight: f(s ? R : z, {}),
|
|
2554
2586
|
onClick: () => c((e) => !e),
|
|
2555
2587
|
children: s ? "Hide Coverage Setup" : "Show Coverage Setup"
|
|
2556
2588
|
}) }),
|
|
2557
2589
|
s && /* @__PURE__ */ p(d, { children: [
|
|
2558
|
-
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(
|
|
2590
|
+
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(P, {
|
|
2559
2591
|
label: x("Cover Whole Query", g("coverWholeQuery")),
|
|
2560
2592
|
checked: _("coverWholeQuery"),
|
|
2561
2593
|
onChange: (e) => O("coverWholeQuery", e)
|
|
2562
2594
|
}) }),
|
|
2563
|
-
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(
|
|
2595
|
+
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(P, {
|
|
2564
2596
|
label: x("Cover Whole Words", g("coverWholeWords")),
|
|
2565
2597
|
checked: _("coverWholeWords"),
|
|
2566
2598
|
onChange: (e) => O("coverWholeWords", e)
|
|
2567
2599
|
}) }),
|
|
2568
|
-
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(
|
|
2600
|
+
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(P, {
|
|
2569
2601
|
label: x("Cover Fuzzy Words", g("coverFuzzyWords")),
|
|
2570
2602
|
checked: _("coverFuzzyWords"),
|
|
2571
2603
|
onChange: (e) => O("coverFuzzyWords", e)
|
|
2572
2604
|
}) }),
|
|
2573
|
-
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(
|
|
2605
|
+
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(P, {
|
|
2574
2606
|
label: x("Cover Joined Words", g("coverJoinedWords")),
|
|
2575
2607
|
checked: _("coverJoinedWords"),
|
|
2576
2608
|
onChange: (e) => O("coverJoinedWords", e)
|
|
2577
2609
|
}) }),
|
|
2578
|
-
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(
|
|
2610
|
+
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(P, {
|
|
2579
2611
|
label: x("Cover Prefix Suffix", g("coverPrefixSuffix")),
|
|
2580
2612
|
checked: _("coverPrefixSuffix"),
|
|
2581
2613
|
onChange: (e) => O("coverPrefixSuffix", e)
|
|
2582
2614
|
}) }),
|
|
2583
|
-
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(
|
|
2615
|
+
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(P, {
|
|
2584
2616
|
label: x("Truncate", g("truncate")),
|
|
2585
2617
|
checked: _("truncate"),
|
|
2586
2618
|
onChange: (e) => O("truncate", e)
|
|
2587
2619
|
}) }),
|
|
2588
|
-
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(
|
|
2620
|
+
/* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(P, {
|
|
2589
2621
|
label: x("Include Pattern Matches", g("includePatternMatches")),
|
|
2590
2622
|
checked: _("includePatternMatches"),
|
|
2591
2623
|
onChange: (e) => O("includePatternMatches", e)
|
|
@@ -2628,9 +2660,8 @@ function St() {
|
|
|
2628
2660
|
})
|
|
2629
2661
|
});
|
|
2630
2662
|
}
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
var Ct = class extends t {
|
|
2663
|
+
// src/components/SearchErrorBoundary.tsx
|
|
2664
|
+
var wt = class extends t {
|
|
2634
2665
|
constructor(e) {
|
|
2635
2666
|
super(e), this.state = {
|
|
2636
2667
|
hasError: !1,
|
|
@@ -2710,10 +2741,9 @@ var Ct = class extends t {
|
|
|
2710
2741
|
}) : this.props.children;
|
|
2711
2742
|
}
|
|
2712
2743
|
};
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
let { url: n, team: r, dataset: a, authenticatedFetch: o } = X(), [s, c] = l(null), [u, d] = l(!1), [f, p] = l(void 0);
|
|
2744
|
+
// src/hooks/useVectorSearch.ts
|
|
2745
|
+
function Tt(e, t) {
|
|
2746
|
+
let { url: n, team: r, dataset: a, authenticatedFetch: o } = Y(), [s, c] = l(null), [u, d] = l(!1), [f, p] = l(void 0);
|
|
2717
2747
|
return {
|
|
2718
2748
|
results: s,
|
|
2719
2749
|
isLoading: u,
|
|
@@ -2732,7 +2762,7 @@ function wt(e, t) {
|
|
|
2732
2762
|
headers: { "Content-Type": "application/json" },
|
|
2733
2763
|
body: JSON.stringify(l)
|
|
2734
2764
|
});
|
|
2735
|
-
if (!u.ok) throw await
|
|
2765
|
+
if (!u.ok) throw await q.fromResponse("VectorSearch", u);
|
|
2736
2766
|
let d = await u.json();
|
|
2737
2767
|
if (d.length === 0) {
|
|
2738
2768
|
c([]);
|
|
@@ -2743,8 +2773,9 @@ function wt(e, t) {
|
|
|
2743
2773
|
headers: { "Content-Type": "application/json" },
|
|
2744
2774
|
body: JSON.stringify(f)
|
|
2745
2775
|
});
|
|
2746
|
-
if (!p.ok) throw await
|
|
2747
|
-
|
|
2776
|
+
if (!p.ok) throw await q.fromResponse("GetJson", p);
|
|
2777
|
+
let m = await p.json();
|
|
2778
|
+
c(m.map((e, t) => ({
|
|
2748
2779
|
document: e,
|
|
2749
2780
|
documentKey: f[t],
|
|
2750
2781
|
score: d[t].score
|
|
@@ -2766,10 +2797,9 @@ function wt(e, t) {
|
|
|
2766
2797
|
])
|
|
2767
2798
|
};
|
|
2768
2799
|
}
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
let { url: n, team: r, dataset: a, authenticatedFetch: o } = X(), [s, c] = l(null), [u, d] = l(!1), [f, p] = l(void 0);
|
|
2800
|
+
// src/hooks/useHybridSearch.ts
|
|
2801
|
+
function Et(e, t) {
|
|
2802
|
+
let { url: n, team: r, dataset: a, authenticatedFetch: o } = Y(), [s, c] = l(null), [u, d] = l(!1), [f, p] = l(void 0);
|
|
2773
2803
|
return {
|
|
2774
2804
|
results: s,
|
|
2775
2805
|
isLoading: u,
|
|
@@ -2790,7 +2820,7 @@ function Tt(e, t) {
|
|
|
2790
2820
|
headers: { "Content-Type": "application/json" },
|
|
2791
2821
|
body: JSON.stringify(l)
|
|
2792
2822
|
});
|
|
2793
|
-
if (!u.ok) throw await
|
|
2823
|
+
if (!u.ok) throw await q.fromResponse("HybridSearch", u);
|
|
2794
2824
|
let d = await u.json();
|
|
2795
2825
|
if (d.length === 0) {
|
|
2796
2826
|
c([]);
|
|
@@ -2801,8 +2831,9 @@ function Tt(e, t) {
|
|
|
2801
2831
|
headers: { "Content-Type": "application/json" },
|
|
2802
2832
|
body: JSON.stringify(f)
|
|
2803
2833
|
});
|
|
2804
|
-
if (!p.ok) throw await
|
|
2805
|
-
|
|
2834
|
+
if (!p.ok) throw await q.fromResponse("GetJson", p);
|
|
2835
|
+
let m = await p.json();
|
|
2836
|
+
c(m.map((e, t) => ({
|
|
2806
2837
|
document: e,
|
|
2807
2838
|
documentKey: f[t],
|
|
2808
2839
|
score: d[t].score
|
|
@@ -2826,16 +2857,15 @@ function Tt(e, t) {
|
|
|
2826
2857
|
])
|
|
2827
2858
|
};
|
|
2828
2859
|
}
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
function Et(e) {
|
|
2860
|
+
// src/hooks/useFilterSuggestion.ts
|
|
2861
|
+
function Dt(e) {
|
|
2832
2862
|
let t = e.trim().toLowerCase();
|
|
2833
2863
|
return t === "true" || t === "false" || t !== "" && !Number.isNaN(Number(t));
|
|
2834
2864
|
}
|
|
2835
|
-
function
|
|
2865
|
+
function Ot(e, t) {
|
|
2836
2866
|
if (!t) return null;
|
|
2837
2867
|
let n = [];
|
|
2838
|
-
for (let [e, r] of Object.entries(t)) for (let t of r ?? []) t?.key && t.key.trim().length >= 2 && !
|
|
2868
|
+
for (let [e, r] of Object.entries(t)) for (let t of r ?? []) t?.key && t.key.trim().length >= 2 && !Dt(t.key) && n.push({
|
|
2839
2869
|
field: e,
|
|
2840
2870
|
value: t.key
|
|
2841
2871
|
});
|
|
@@ -2854,14 +2884,14 @@ function Dt(e, t) {
|
|
|
2854
2884
|
sort: null
|
|
2855
2885
|
};
|
|
2856
2886
|
}
|
|
2857
|
-
function
|
|
2858
|
-
let t =
|
|
2887
|
+
function kt(e = {}) {
|
|
2888
|
+
let t = Y(), { url: n, team: r, dataset: a, authenticatedFetch: s, setQuery: u, toggleFilter: d, setRangeFilter: f, setSort: p } = t, { auto: m } = e, h = c(t);
|
|
2859
2889
|
h.current = t;
|
|
2860
2890
|
let [g, _] = l(null), [v, y] = l(""), [b, x] = l(!1), S = c(0), C = i(async (e) => {
|
|
2861
2891
|
let t = ++S.current;
|
|
2862
2892
|
x(!0);
|
|
2863
2893
|
try {
|
|
2864
|
-
let i = await s(`${n}/api/teams/${r}/datasets/${a}/search-or-ask/filters${
|
|
2894
|
+
let i = await s(`${n}/api/teams/${r}/datasets/${a}/search-or-ask/filters${ke(h.current)}`, {
|
|
2865
2895
|
method: "POST",
|
|
2866
2896
|
headers: { "Content-Type": "application/json" },
|
|
2867
2897
|
body: JSON.stringify({ text: e })
|
|
@@ -2900,7 +2930,7 @@ function Ot(e = {}) {
|
|
|
2900
2930
|
return o(() => {
|
|
2901
2931
|
if (!A || !j || P || E.current.has(j)) return;
|
|
2902
2932
|
E.current.add(j);
|
|
2903
|
-
let e =
|
|
2933
|
+
let e = Ot(j, N);
|
|
2904
2934
|
if (e && (E.current.add(e.text), w(e), O(j)), k !== "model") return;
|
|
2905
2935
|
let t = e ? e.text : j;
|
|
2906
2936
|
if (!t) return;
|
|
@@ -2909,7 +2939,7 @@ function Ot(e = {}) {
|
|
|
2909
2939
|
let o = ++S.current;
|
|
2910
2940
|
x(!0);
|
|
2911
2941
|
try {
|
|
2912
|
-
let c = await s(`${n}/api/teams/${r}/datasets/${a}/search-or-ask/filters${
|
|
2942
|
+
let c = await s(`${n}/api/teams/${r}/datasets/${a}/search-or-ask/filters${ke(h.current)}`, {
|
|
2913
2943
|
method: "POST",
|
|
2914
2944
|
headers: { "Content-Type": "application/json" },
|
|
2915
2945
|
body: JSON.stringify({ text: t })
|
|
@@ -2946,19 +2976,18 @@ function Ot(e = {}) {
|
|
|
2946
2976
|
appliedText: D
|
|
2947
2977
|
};
|
|
2948
2978
|
}
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
var kt = {
|
|
2979
|
+
// src/hooks/useAsk.ts
|
|
2980
|
+
var At = {
|
|
2952
2981
|
question: "",
|
|
2953
2982
|
status: "idle",
|
|
2954
2983
|
answer: "",
|
|
2955
2984
|
sources: [],
|
|
2956
2985
|
steps: []
|
|
2957
2986
|
};
|
|
2958
|
-
function
|
|
2959
|
-
let e =
|
|
2987
|
+
function jt() {
|
|
2988
|
+
let e = Y(), { url: t, team: n, dataset: r, authenticatedFetch: a } = e, s = c(e);
|
|
2960
2989
|
s.current = e;
|
|
2961
|
-
let [u, d] = l(
|
|
2990
|
+
let [u, d] = l(At), f = c(u);
|
|
2962
2991
|
f.current = u;
|
|
2963
2992
|
let p = c(null), m = i(async (e, i = []) => {
|
|
2964
2993
|
let o = e.trim();
|
|
@@ -2990,7 +3019,7 @@ function At() {
|
|
|
2990
3019
|
}
|
|
2991
3020
|
}));
|
|
2992
3021
|
try {
|
|
2993
|
-
let e = await a(`${t}/api/teams/${n}/datasets/${r}/search-or-ask/ask${
|
|
3022
|
+
let e = await a(`${t}/api/teams/${n}/datasets/${r}/search-or-ask/ask${ke(s.current)}`, {
|
|
2994
3023
|
method: "POST",
|
|
2995
3024
|
headers: {
|
|
2996
3025
|
"Content-Type": "application/json",
|
|
@@ -3020,7 +3049,7 @@ function At() {
|
|
|
3020
3049
|
h(t.code ?? `http${e.status}`, t.detail ?? "The question could not be asked.");
|
|
3021
3050
|
return;
|
|
3022
3051
|
}
|
|
3023
|
-
for await (let { event: t, data: n } of
|
|
3052
|
+
for await (let { event: t, data: n } of Oe(e.body)) switch (t) {
|
|
3024
3053
|
case "status": {
|
|
3025
3054
|
let e = n.step;
|
|
3026
3055
|
e && d((t) => ({
|
|
@@ -3096,7 +3125,7 @@ function At() {
|
|
|
3096
3125
|
r,
|
|
3097
3126
|
a
|
|
3098
3127
|
]), g = i(() => p.current?.abort(), []), _ = i(() => {
|
|
3099
|
-
p.current?.abort(), d(
|
|
3128
|
+
p.current?.abort(), d(At);
|
|
3100
3129
|
}, []);
|
|
3101
3130
|
return o(() => () => p.current?.abort(), []), {
|
|
3102
3131
|
...u,
|
|
@@ -3123,18 +3152,18 @@ var $ = {
|
|
|
3123
3152
|
searchedLabel: "_searchedLabel_gjc13_23",
|
|
3124
3153
|
steps: "_steps_gjc13_26",
|
|
3125
3154
|
stepDone: "_stepDone_gjc13_27"
|
|
3126
|
-
},
|
|
3127
|
-
function
|
|
3155
|
+
}, Mt = /(`[^`\n]+`)|(\*\*[^*\n]+\*\*)|(\*[^*\n]+\*|_[^_\n]+_)|(\[[^\]\n]+\]\(https?:\/\/[^)\s]+\))|(\[\d+\])/g;
|
|
3156
|
+
function Nt(t, n, r) {
|
|
3128
3157
|
let i = [], a = 0, o = 0;
|
|
3129
|
-
for (let s of t.matchAll(
|
|
3158
|
+
for (let s of t.matchAll(Mt)) {
|
|
3130
3159
|
s.index > a && i.push(t.slice(a, s.index));
|
|
3131
3160
|
let c = `${r}-${o++}`, [l, u, d, p, m, h] = s;
|
|
3132
3161
|
if (u) i.push(/* @__PURE__ */ f("code", {
|
|
3133
3162
|
className: $.inlineCode,
|
|
3134
3163
|
children: u.slice(1, -1)
|
|
3135
3164
|
}, c));
|
|
3136
|
-
else if (d) i.push(/* @__PURE__ */ f("strong", { children:
|
|
3137
|
-
else if (p) i.push(/* @__PURE__ */ f("em", { children:
|
|
3165
|
+
else if (d) i.push(/* @__PURE__ */ f("strong", { children: Nt(d.slice(2, -2), n, c) }, c));
|
|
3166
|
+
else if (p) i.push(/* @__PURE__ */ f("em", { children: Nt(p.slice(1, -1), n, c) }, c));
|
|
3138
3167
|
else if (m) {
|
|
3139
3168
|
let [, e, t] = /^\[([^\]]+)\]\(([^)]+)\)$/.exec(m);
|
|
3140
3169
|
i.push(/* @__PURE__ */ f("a", {
|
|
@@ -3148,7 +3177,7 @@ function Mt(t, n, r) {
|
|
|
3148
3177
|
}
|
|
3149
3178
|
return a < t.length && i.push(t.slice(a)), i;
|
|
3150
3179
|
}
|
|
3151
|
-
function
|
|
3180
|
+
function Pt(e) {
|
|
3152
3181
|
let t = e.replace(/\r\n/g, "\n").split("\n"), n = [], r = [], i = () => {
|
|
3153
3182
|
r.length && (n.push({
|
|
3154
3183
|
kind: "paragraph",
|
|
@@ -3193,16 +3222,12 @@ function Nt(e) {
|
|
|
3193
3222
|
continue;
|
|
3194
3223
|
}
|
|
3195
3224
|
let l = n[n.length - 1];
|
|
3196
|
-
|
|
3197
|
-
l.items[l.items.length - 1] += " " + a.trim();
|
|
3198
|
-
continue;
|
|
3199
|
-
}
|
|
3200
|
-
r.push(a.trim());
|
|
3225
|
+
r.length === 0 && l?.kind === "list" && /^\s{2,}\S/.test(a) ? l.items[l.items.length - 1] += " " + a.trim() : r.push(a.trim());
|
|
3201
3226
|
}
|
|
3202
3227
|
return i(), n;
|
|
3203
3228
|
}
|
|
3204
|
-
function
|
|
3205
|
-
return
|
|
3229
|
+
function Ft(e, t) {
|
|
3230
|
+
return Pt(e).map((e, n) => {
|
|
3206
3231
|
let r = `b${n}`;
|
|
3207
3232
|
switch (e.kind) {
|
|
3208
3233
|
case "code": return /* @__PURE__ */ f("pre", {
|
|
@@ -3212,28 +3237,30 @@ function Pt(e, t) {
|
|
|
3212
3237
|
}, r);
|
|
3213
3238
|
case "heading": return /* @__PURE__ */ f("p", {
|
|
3214
3239
|
className: $.heading,
|
|
3215
|
-
children:
|
|
3216
|
-
}, r);
|
|
3217
|
-
case "list": return /* @__PURE__ */ f(e.ordered ? "ol" : "ul", {
|
|
3218
|
-
className: $.list,
|
|
3219
|
-
children: e.items.map((e, n) => /* @__PURE__ */ f("li", { children: Mt(e, t, `${r}-${n}`) }, n))
|
|
3240
|
+
children: Nt(e.text, t, r)
|
|
3220
3241
|
}, r);
|
|
3242
|
+
case "list": {
|
|
3243
|
+
let n = e.ordered ? "ol" : "ul";
|
|
3244
|
+
return /* @__PURE__ */ f(n, {
|
|
3245
|
+
className: $.list,
|
|
3246
|
+
children: e.items.map((e, n) => /* @__PURE__ */ f("li", { children: Nt(e, t, `${r}-${n}`) }, n))
|
|
3247
|
+
}, r);
|
|
3248
|
+
}
|
|
3221
3249
|
default: return /* @__PURE__ */ f("p", {
|
|
3222
3250
|
className: $.paragraph,
|
|
3223
|
-
children:
|
|
3251
|
+
children: Nt(e.text, t, r)
|
|
3224
3252
|
}, r);
|
|
3225
3253
|
}
|
|
3226
3254
|
});
|
|
3227
3255
|
}
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
function It(e) {
|
|
3256
|
+
// src/components/AskPanel.tsx
|
|
3257
|
+
var It = /\[(\d+)\]/g;
|
|
3258
|
+
function Lt(e) {
|
|
3232
3259
|
let t = e.field.split(".")[0];
|
|
3233
3260
|
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;
|
|
3234
3261
|
}
|
|
3235
|
-
var
|
|
3236
|
-
let E =
|
|
3262
|
+
var Rt = ({ question: e, followUps: t = !1, onSourceClick: n, label: r = "Answer", renderAnswer: i = Ft, onFollowUp: a, onStatusChange: s, onFilters: u, filterLabel: d = Lt, fill: b = !1, className: T = "" }) => {
|
|
3263
|
+
let E = jt(), { ask: D, reset: O, stop: k, status: A, openSource: j } = E, [M, P] = l(!1), [F, L] = l([]), [R, z] = l(""), B = c([]), V = c(null), H = c(null), U = c(!0);
|
|
3237
3264
|
o(() => {
|
|
3238
3265
|
L([]), B.current = [], e?.trim() ? D(e) : O();
|
|
3239
3266
|
}, [
|
|
@@ -3254,7 +3281,7 @@ var Lt = ({ question: e, followUps: t = !1, onSourceClick: n, label: r = "Answer
|
|
|
3254
3281
|
E.answer,
|
|
3255
3282
|
E.steps.length,
|
|
3256
3283
|
A,
|
|
3257
|
-
|
|
3284
|
+
F.length
|
|
3258
3285
|
]);
|
|
3259
3286
|
let ee = () => {
|
|
3260
3287
|
let e = H.current;
|
|
@@ -3287,30 +3314,30 @@ var Lt = ({ question: e, followUps: t = !1, onSourceClick: n, label: r = "Answer
|
|
|
3287
3314
|
})
|
|
3288
3315
|
]
|
|
3289
3316
|
});
|
|
3290
|
-
if (A === "idle" &&
|
|
3317
|
+
if (A === "idle" && F.length === 0) return null;
|
|
3291
3318
|
let K = (e, t) => (r) => {
|
|
3292
3319
|
r.preventDefault(), j(e, t), n?.(e);
|
|
3293
|
-
},
|
|
3320
|
+
}, ne = (e, t) => (r) => {
|
|
3294
3321
|
let i = e.find((e) => e.n === r);
|
|
3295
3322
|
return /* @__PURE__ */ f(C, {
|
|
3296
3323
|
n: r,
|
|
3297
3324
|
title: i?.title,
|
|
3298
3325
|
onClick: i && n ? K(i, t) : void 0
|
|
3299
3326
|
});
|
|
3300
|
-
},
|
|
3301
|
-
let r = new Set([...e.matchAll(
|
|
3327
|
+
}, re = (e, t, n) => {
|
|
3328
|
+
let r = new Set([...e.matchAll(It)].map((e) => Number(e[1])));
|
|
3302
3329
|
return n && r.size > 0 ? t.filter((e) => r.has(e.n)) : t.slice(0, 3);
|
|
3303
|
-
},
|
|
3304
|
-
let a =
|
|
3330
|
+
}, ie = (e, t, r, i) => {
|
|
3331
|
+
let a = re(e, t, r);
|
|
3305
3332
|
return a.length > 0 && /* @__PURE__ */ f(S, { items: a.map((e) => ({
|
|
3306
3333
|
n: e.n,
|
|
3307
3334
|
title: e.title,
|
|
3308
3335
|
onClick: n ? K(e, i) : void 0
|
|
3309
3336
|
})) });
|
|
3310
|
-
},
|
|
3311
|
-
navigator.clipboard?.writeText(E.answer.replace(
|
|
3312
|
-
},
|
|
3313
|
-
if (!
|
|
3337
|
+
}, q = () => {
|
|
3338
|
+
navigator.clipboard?.writeText(E.answer.replace(It, "")).catch(() => {}), P(!0), setTimeout(() => P(!1), 2e3);
|
|
3339
|
+
}, J = (e) => {
|
|
3340
|
+
if (!E.busy && e.trim()) {
|
|
3314
3341
|
if (A === "answered" && E.answer) {
|
|
3315
3342
|
let e = {
|
|
3316
3343
|
question: E.question,
|
|
@@ -3331,7 +3358,7 @@ var Lt = ({ question: e, followUps: t = !1, onSourceClick: n, label: r = "Answer
|
|
|
3331
3358
|
}
|
|
3332
3359
|
z(""), D(e, B.current);
|
|
3333
3360
|
}
|
|
3334
|
-
},
|
|
3361
|
+
}, ae = t ? () => V.current?.focus() : a;
|
|
3335
3362
|
return /* @__PURE__ */ p("div", {
|
|
3336
3363
|
className: `${$.panel} ${b ? $.fill : ""} ${T}`,
|
|
3337
3364
|
"aria-live": "polite",
|
|
@@ -3340,38 +3367,38 @@ var Lt = ({ question: e, followUps: t = !1, onSourceClick: n, label: r = "Answer
|
|
|
3340
3367
|
ref: H,
|
|
3341
3368
|
className: $.thread,
|
|
3342
3369
|
onScroll: b ? ee : void 0,
|
|
3343
|
-
children: [
|
|
3370
|
+
children: [F.map((e, t) => /* @__PURE__ */ p("div", {
|
|
3344
3371
|
className: $.turn,
|
|
3345
|
-
children: [/* @__PURE__ */ f(
|
|
3372
|
+
children: [/* @__PURE__ */ f(I, { children: e.question }), /* @__PURE__ */ p(v, {
|
|
3346
3373
|
label: r,
|
|
3347
3374
|
children: [
|
|
3348
3375
|
G(e.filters),
|
|
3349
3376
|
/* @__PURE__ */ f("div", {
|
|
3350
3377
|
className: $.answer,
|
|
3351
|
-
children: i(e.answer,
|
|
3378
|
+
children: i(e.answer, ne(e.sources, e.askId))
|
|
3352
3379
|
}),
|
|
3353
|
-
|
|
3380
|
+
ie(e.answer, e.sources, !0, e.askId)
|
|
3354
3381
|
]
|
|
3355
3382
|
})]
|
|
3356
3383
|
}, t)), A !== "idle" && /* @__PURE__ */ p("div", {
|
|
3357
3384
|
className: $.turn,
|
|
3358
|
-
children: [/* @__PURE__ */ f(
|
|
3385
|
+
children: [/* @__PURE__ */ f(I, { children: E.question }), /* @__PURE__ */ p(v, {
|
|
3359
3386
|
label: r,
|
|
3360
3387
|
children: [
|
|
3361
3388
|
G(E.filters),
|
|
3362
3389
|
E.answer && /* @__PURE__ */ f("div", {
|
|
3363
3390
|
className: $.answer,
|
|
3364
|
-
children: i(E.answer,
|
|
3391
|
+
children: i(E.answer, ne(E.sources))
|
|
3365
3392
|
}),
|
|
3366
3393
|
A === "searching" && E.steps.length > 0 && /* @__PURE__ */ p("div", {
|
|
3367
3394
|
className: $.steps,
|
|
3368
3395
|
children: [E.steps.slice(0, -1).map((e, t) => /* @__PURE__ */ f("span", {
|
|
3369
3396
|
className: $.stepDone,
|
|
3370
3397
|
children: e
|
|
3371
|
-
}, t)), /* @__PURE__ */ p(
|
|
3398
|
+
}, t)), /* @__PURE__ */ p(N, { children: [E.steps[E.steps.length - 1], "β¦"] })]
|
|
3372
3399
|
}),
|
|
3373
|
-
A === "searching" && E.steps.length === 0 && /* @__PURE__ */ f(
|
|
3374
|
-
A === "writing" && /* @__PURE__ */ f(
|
|
3400
|
+
A === "searching" && E.steps.length === 0 && /* @__PURE__ */ f(N, { children: "Searchingβ¦" }),
|
|
3401
|
+
A === "writing" && /* @__PURE__ */ f(N, {
|
|
3375
3402
|
spinner: "grow",
|
|
3376
3403
|
children: "Writingβ¦"
|
|
3377
3404
|
}),
|
|
@@ -3402,11 +3429,11 @@ var Lt = ({ question: e, followUps: t = !1, onSourceClick: n, label: r = "Answer
|
|
|
3402
3429
|
". Search still works in the meantime."
|
|
3403
3430
|
] })]
|
|
3404
3431
|
}),
|
|
3405
|
-
A !== "error" && A !== "limited" &&
|
|
3432
|
+
A !== "error" && A !== "limited" && ie(E.answer, E.sources, A === "answered"),
|
|
3406
3433
|
A === "answered" && /* @__PURE__ */ f(_, {
|
|
3407
|
-
onCopy:
|
|
3408
|
-
copied:
|
|
3409
|
-
onFollowUp:
|
|
3434
|
+
onCopy: q,
|
|
3435
|
+
copied: M,
|
|
3436
|
+
onFollowUp: ae
|
|
3410
3437
|
})
|
|
3411
3438
|
]
|
|
3412
3439
|
})]
|
|
@@ -3415,7 +3442,7 @@ var Lt = ({ question: e, followUps: t = !1, onSourceClick: n, label: r = "Answer
|
|
|
3415
3442
|
ref: V,
|
|
3416
3443
|
value: R,
|
|
3417
3444
|
onChange: z,
|
|
3418
|
-
onSend:
|
|
3445
|
+
onSend: J,
|
|
3419
3446
|
onStop: k,
|
|
3420
3447
|
streaming: E.busy,
|
|
3421
3448
|
placeholder: "Ask a follow-upβ¦",
|
|
@@ -3423,5 +3450,4 @@ var Lt = ({ question: e, followUps: t = !1, onSourceClick: n, label: r = "Answer
|
|
|
3423
3450
|
})]
|
|
3424
3451
|
});
|
|
3425
3452
|
};
|
|
3426
|
-
|
|
3427
|
-
export { _t as ActiveFiltersPanel, Lt as AskPanel, ft as BucketFilterPanel, xe as DEFAULT_CUT, he as DEFAULT_THRESHOLDS, et as FilterPanelSkeleton, J as IndxApiError, lt as RangeFilterPanel, Ce as SCORE_SCALE, Se as STRICT_COVERAGE, pe as SearchContext, Ct as SearchErrorBoundary, Le as SearchInput, me as SearchProvider, Ue as SearchResult, Ze as SearchResultRow, Ye as SearchResults, Be as SearchResultsMessage, Ke as SearchResultsSkeleton, St as SearchSettingsPanel, Y as SearchSetupError, yt as SortByPanel, rt as ValueFilterPanel, ie as describeSearchError, ve as isIdentifier, Dt as localFilters, be as nextOffer, Ne as stripAskPhrases, ye as triggers, At as useAsk, Ot as useFilterSuggestion, Tt as useHybridSearch, X as useSearch, X as useSearchContext, Fe as useSearchOrAsk, wt as useVectorSearch, we as visibleResults };
|
|
3453
|
+
export { vt as ActiveFiltersPanel, Rt as AskPanel, pt as BucketFilterPanel, Ce as DEFAULT_CUT, _e as DEFAULT_THRESHOLDS, nt as FilterPanelSkeleton, q as IndxApiError, ut as RangeFilterPanel, Te as SCORE_SCALE, we as STRICT_COVERAGE, he as SearchContext, wt as SearchErrorBoundary, ze as SearchInput, ge as SearchProvider, Ge as SearchResult, $e as SearchResultRow, Ze as SearchResults, He as SearchResultsMessage, Je as SearchResultsSkeleton, Ct as SearchSettingsPanel, J as SearchSetupError, bt as SortByPanel, at as ValueFilterPanel, ae as describeSearchError, be as isIdentifier, Ot as localFilters, Se as nextOffer, Fe as stripAskPhrases, xe as triggers, jt as useAsk, kt as useFilterSuggestion, Et as useHybridSearch, Y as useSearch, Y as useSearchContext, Le as useSearchOrAsk, Tt as useVectorSearch, Ee as visibleResults };
|