@indxsearch/intrface 4.0.0-beta.2 β 4.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/README.md +118 -1
- package/dist/components/AskChat.d.ts +39 -0
- package/dist/components/AskOffer.d.ts +43 -0
- package/dist/components/AskPanel.d.ts +4 -0
- package/dist/components/QuickAnswer.d.ts +5 -9
- package/dist/components/SearchInput.d.ts +19 -14
- package/dist/components/SearchOrAsk.d.ts +73 -0
- package/dist/components/SearchPage.d.ts +53 -0
- package/dist/components/ValueFilterPanel.d.ts +11 -0
- package/dist/context/SearchContext.d.ts +39 -1
- package/dist/context/useSearchExecution.d.ts +3 -1
- package/dist/hooks/useAskFlow.d.ts +89 -0
- package/dist/hooks/useSearchOrAsk.d.ts +25 -3
- package/dist/index.cjs.js +3 -3
- package/dist/index.d.ts +13 -3
- package/dist/index.es.js +1784 -1082
- 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 { Rungs as u, SearchMode as d, SystemState as f, Tolerance as p } from "@indxsearch/indx-types";
|
|
4
4
|
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
5
|
-
import { Alert as _, AlertDescription as v, AlertTitle as y, AnswerActions as b, AssistantMessage as x,
|
|
6
|
-
import { Ai_agent as
|
|
5
|
+
import { Alert as _, AlertDescription as v, AlertTitle as y, AnswerActions as b, AssistantMessage as x, Base as S, Button as C, ChatLauncher as w, Checkbox as T, Chip as E, CitationList as D, CitationRef as O, Composer as k, FilterPanelBase as A, InputField as j, Kbd as M, Popover as N, RadioButton as P, SearchField as F, Select as I, ShimmerText as L, Skeleton as R, Slider as z, StreamStatus as B, Suggestions as V, ToggleSwitch as H, Tooltip as U, UserMessage as W } from "@indxsearch/systm";
|
|
6
|
+
import { Ai_agent as G, ArrowDown as K, ArrowRight as ee, Chevron_left as q, Cloud as te, Compose as J, Filter as Y, Fuzzy_search as X, Hour_glass as Z, Indx as ne, Key as re, Lock as ie, Refresh as Q, Search as ae, Sliders_horizontal as oe, Speedometer as se, Warning as ce, X_or_error as le } from "@indxsearch/pixl";
|
|
7
7
|
// src/context/IndxApiError.ts
|
|
8
|
-
var
|
|
8
|
+
var $ = class e extends Error {
|
|
9
9
|
status;
|
|
10
10
|
code;
|
|
11
11
|
problem;
|
|
@@ -29,14 +29,14 @@ var Z = 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
|
+
}, ue = class extends Error {
|
|
33
33
|
constructor(e) {
|
|
34
34
|
super(e), this.name = "SearchSetupError";
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
function
|
|
37
|
+
function de(e, t) {
|
|
38
38
|
let n = e instanceof Error ? e.message : String(e);
|
|
39
|
-
if (e instanceof
|
|
39
|
+
if (e instanceof ue) return {
|
|
40
40
|
kind: "setup",
|
|
41
41
|
message: n,
|
|
42
42
|
technical: n,
|
|
@@ -48,7 +48,7 @@ function se(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 $) {
|
|
52
52
|
let r = {
|
|
53
53
|
message: n,
|
|
54
54
|
status: e.status,
|
|
@@ -114,15 +114,15 @@ function se(e, t) {
|
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
116
|
// src/context/useIndxAuth.ts
|
|
117
|
-
function
|
|
117
|
+
function fe({ url: e, team: t, dataset: n, preAuthenticatedToken: r, enableDebugLogs: i = !1 }) {
|
|
118
118
|
let [a, s] = l(null), [c, u] = l(!0), [d, 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);
|
|
119
119
|
return o(() => {
|
|
120
120
|
(async () => {
|
|
121
121
|
D(null), k(null), u(!0);
|
|
122
122
|
try {
|
|
123
|
-
if (!r) throw console.error("[Auth] β Missing bearer token"), console.error("[Auth] π‘ Pass preAuthenticatedToken to SearchProvider (create a token on the Indx Dashboard)"), new
|
|
124
|
-
if (!e) throw console.error("[Auth] β Missing INDX server URL"), console.error("[Auth] π‘ Pass a url to SearchProvider"), new
|
|
125
|
-
if (!n) throw console.error("[Auth] β Missing dataset name"), console.error("[Auth] π‘ Pass dataset=\"your-dataset-name\" to SearchProvider"), new
|
|
123
|
+
if (!r) throw console.error("[Auth] β Missing bearer token"), console.error("[Auth] π‘ Pass preAuthenticatedToken to SearchProvider (create a token on the Indx Dashboard)"), new ue("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 ue("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 ue("Dataset name is required. Check console for instructions.");
|
|
126
126
|
i && console.log("[Auth] β
Using bearer token");
|
|
127
127
|
let a = r, o = (e) => fetch(e, {
|
|
128
128
|
method: "GET",
|
|
@@ -133,7 +133,7 @@ function ce({ url: e, team: t, dataset: n, preAuthenticatedToken: r, enableDebug
|
|
|
133
133
|
});
|
|
134
134
|
i && console.log("[Auth] π Checking dataset status...");
|
|
135
135
|
let c = await o(`${e}/api/teams/${t}/datasets/${n}/status`);
|
|
136
|
-
if (!c.ok) throw c.status === 401 ? (console.error("[Auth] β Authentication failed (401 Unauthorized)"), console.error("[Auth] π‘ Your token may be expired or invalid"), console.error("[Auth] π‘ Create or refresh your token on the Indx Dashboard"), await
|
|
136
|
+
if (!c.ok) throw c.status === 401 ? (console.error("[Auth] β Authentication failed (401 Unauthorized)"), console.error("[Auth] π‘ Your token may be expired or invalid"), console.error("[Auth] π‘ Create or refresh your token on the Indx Dashboard"), await $.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 $.fromResponse("Dataset status", c)) : (console.error("[Auth] β Failed to get dataset status:", c.status), await $.fromResponse("Dataset status", c));
|
|
137
137
|
let l = await c.json();
|
|
138
138
|
i && console.log("[Auth] π Dataset status:", l), s(a), i && console.log("[Auth] β
Dataset session established"), l.systemState !== void 0 && l.systemState !== f.Ready && (console.warn("[Auth] β οΈ Dataset is not ready yet. Current state:", l.systemState), console.warn("[Auth] π‘ Wait for indexing to complete before searching"));
|
|
139
139
|
let u = l.documentCount ?? l.numberOfRecords ?? 0;
|
|
@@ -144,9 +144,9 @@ function ce({ url: e, team: t, dataset: n, preAuthenticatedToken: r, enableDebug
|
|
|
144
144
|
o(`${e}/api/teams/${t}/datasets/${n}/fields/sortable`),
|
|
145
145
|
o(`${e}/api/teams/${t}/datasets/${n}/fields/configuration`).catch(() => null)
|
|
146
146
|
]);
|
|
147
|
-
if (!d.ok) throw console.error("[Auth] β GetFilterableFields failed:", d.status), await
|
|
148
|
-
if (!m.ok) throw console.error("[Auth] β GetFacetableFields failed:", m.status), await
|
|
149
|
-
if (!g.ok) throw console.error("[Auth] β GetSortableFields failed:", g.status), await
|
|
147
|
+
if (!d.ok) throw console.error("[Auth] β GetFilterableFields failed:", d.status), await $.fromResponse("Filterable fields", d);
|
|
148
|
+
if (!m.ok) throw console.error("[Auth] β GetFacetableFields failed:", m.status), await $.fromResponse("Facetable fields", m);
|
|
149
|
+
if (!g.ok) throw console.error("[Auth] β GetSortableFields failed:", g.status), await $.fromResponse("Sortable fields", g);
|
|
150
150
|
let [b, S, w] = await Promise.all([
|
|
151
151
|
d.json().catch((e) => (console.error("Failed to parse GetFilterableFields response:", e), [])),
|
|
152
152
|
m.json().catch((e) => (console.error("Failed to parse GetFacetableFields response:", e), [])),
|
|
@@ -191,7 +191,7 @@ function ce({ url: e, team: t, dataset: n, preAuthenticatedToken: r, enableDebug
|
|
|
191
191
|
if (D.facets) for (let [e, t] of Object.entries(D.facets)) Array.isArray(t) && (k[e] = t.map((e) => e.key));
|
|
192
192
|
x(O), C(k), i && console.log("[Auth] β
Initialization complete");
|
|
193
193
|
} catch (r) {
|
|
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(
|
|
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(de(r, {
|
|
195
195
|
team: t,
|
|
196
196
|
dataset: n
|
|
197
197
|
}));
|
|
@@ -220,25 +220,25 @@ function ce({ url: e, team: t, dataset: n, preAuthenticatedToken: r, enableDebug
|
|
|
220
220
|
};
|
|
221
221
|
}
|
|
222
222
|
// src/context/buildFilterProxy.ts
|
|
223
|
-
async function
|
|
223
|
+
async function pe(e, t, n, r, i, a, o) {
|
|
224
224
|
let s = await o(`${r}/api/teams/${i}/datasets/${a}/filters/${e}`, {
|
|
225
225
|
method: "POST",
|
|
226
226
|
headers: { "Content-Type": "application/json" },
|
|
227
227
|
body: JSON.stringify(t)
|
|
228
228
|
});
|
|
229
|
-
if (!s.ok) throw await
|
|
229
|
+
if (!s.ok) throw await $.fromResponse(n, s);
|
|
230
230
|
let c = await s.json();
|
|
231
231
|
if (!c || typeof c.hashString != "string") throw Error(`${n} failed: server returned no filter token`);
|
|
232
232
|
return c;
|
|
233
233
|
}
|
|
234
|
-
async function
|
|
235
|
-
return e.length === 0 ? null : e.length === 1 ? e[0] :
|
|
234
|
+
async function me(e, t, n, r, i, a) {
|
|
235
|
+
return e.length === 0 ? null : e.length === 1 ? e[0] : pe("combine", {
|
|
236
236
|
filters: e,
|
|
237
237
|
useAndOperation: t === "and"
|
|
238
238
|
}, "CombineFilters", n, r, i, a);
|
|
239
239
|
}
|
|
240
|
-
async function
|
|
241
|
-
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 }) =>
|
|
240
|
+
async function he(e, t, n, r, i, a, o = {}, s = {}, c = {}) {
|
|
241
|
+
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 }) => pe("range", {
|
|
242
242
|
fieldName: e,
|
|
243
243
|
lowerLimit: t,
|
|
244
244
|
upperLimit: o
|
|
@@ -247,32 +247,32 @@ async function de(e, t, n, r, i, a, o = {}, s = {}, c = {}) {
|
|
|
247
247
|
return Number.isFinite(o) ? f(e, {
|
|
248
248
|
min: o,
|
|
249
249
|
max: o
|
|
250
|
-
}) :
|
|
250
|
+
}) : pe("value", {
|
|
251
251
|
fieldName: e,
|
|
252
252
|
value: t
|
|
253
253
|
}, `Value filter '${e}'`, n, r, i, a);
|
|
254
254
|
}, [m, h, g] = await Promise.all([
|
|
255
|
-
Promise.all(l.map(async ([e, t]) =>
|
|
255
|
+
Promise.all(l.map(async ([e, t]) => me(await Promise.all(t.map((t) => p(e, t))), o[e] === "any" ? "or" : "and", n, r, i, a))),
|
|
256
256
|
Promise.all(u.map(([e, t]) => f(e, t))),
|
|
257
|
-
Promise.all(d.map(async ([e, t]) =>
|
|
257
|
+
Promise.all(d.map(async ([e, t]) => me(await Promise.all(t.map((t) => f(e, t))), "or", n, r, i, a)))
|
|
258
258
|
]);
|
|
259
|
-
return
|
|
259
|
+
return me([
|
|
260
260
|
...m,
|
|
261
261
|
...h,
|
|
262
262
|
...g
|
|
263
263
|
], "and", n, r, i, a);
|
|
264
264
|
}
|
|
265
265
|
// src/context/useSearchExecution.ts
|
|
266
|
-
function
|
|
266
|
+
function ge(e, t) {
|
|
267
267
|
let n, r = (...r) => {
|
|
268
268
|
clearTimeout(n), n = setTimeout(() => e(...r), t);
|
|
269
269
|
};
|
|
270
270
|
return r.cancel = () => clearTimeout(n), r;
|
|
271
271
|
}
|
|
272
|
-
function
|
|
273
|
-
let
|
|
274
|
-
|
|
275
|
-
let
|
|
272
|
+
function _e({ 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, facetTiming: b = "inFlight" }) {
|
|
273
|
+
let x = y ? y(e.query) : e.query, S = c(e.query);
|
|
274
|
+
S.current = e.query;
|
|
275
|
+
let C = c(0), w = c(void 0), T = c(0), E = c(0), D = c(0), O = c(!1), [k, A] = l({}), [j, M] = l(""), [N, P] = l("");
|
|
276
276
|
o(() => {
|
|
277
277
|
r.isFetchingInitial || t((e) => ({
|
|
278
278
|
...e,
|
|
@@ -294,180 +294,202 @@ function pe({ state: e, setState: t, authenticatedFetch: n, auth: r, url: a, tea
|
|
|
294
294
|
r.sortableFields,
|
|
295
295
|
t
|
|
296
296
|
]);
|
|
297
|
-
let
|
|
297
|
+
let F = e.searchSettings.maxNumberOfRecordsToReturn, I = e.searchSettings.mode, L = e.searchSettings.refocus, R = e.searchSettings.match, z = e.searchSettings.candidates, B = e.searchSettings.ranking, V = e.searchSettings.minimumScore, H = e.sortBy, U = e.sortAscending, W = i(async ({ enableFacets: i, pick: o, facetsOnly: c = !1 }) => {
|
|
298
298
|
if (!r.token) return;
|
|
299
|
-
let
|
|
300
|
-
if (
|
|
301
|
-
let c = ++
|
|
302
|
-
t((e) => ({
|
|
299
|
+
let l = x.trim() === "";
|
|
300
|
+
if (l && !d) return;
|
|
301
|
+
let f = c ? C.current : ++C.current, m = c ? ++E.current : 0;
|
|
302
|
+
c ? i = !0 : t((e) => ({
|
|
303
303
|
...e,
|
|
304
304
|
isLoading: !0
|
|
305
|
-
})),
|
|
305
|
+
})), l && (i = !0);
|
|
306
|
+
let y = c || !i ? T.current : ++T.current;
|
|
306
307
|
try {
|
|
307
|
-
let
|
|
308
|
+
let l = 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)])) : [], [b, ...w] = await Promise.all([he(e.filters, e.rangeFilters, a, s, u, n, e.valueMatch, e.bucketFilters, e.fieldTypes), ...l.map((t) => he({
|
|
308
309
|
...e.filters,
|
|
309
310
|
[t]: []
|
|
310
311
|
}, e.rangeFilters, a, s, u, n, e.valueMatch, {
|
|
311
312
|
...e.bucketFilters,
|
|
312
313
|
[t]: []
|
|
313
|
-
}, e.fieldTypes))]),
|
|
314
|
-
text:
|
|
315
|
-
mode:
|
|
316
|
-
match:
|
|
317
|
-
candidates:
|
|
318
|
-
ranking:
|
|
319
|
-
},
|
|
320
|
-
...
|
|
321
|
-
maxNumberOfRecordsToReturn:
|
|
314
|
+
}, e.fieldTypes))]), E = !c && (d || x.trim() !== ""), O = {
|
|
315
|
+
text: x,
|
|
316
|
+
mode: I,
|
|
317
|
+
match: R,
|
|
318
|
+
candidates: z,
|
|
319
|
+
ranking: B
|
|
320
|
+
}, W = {
|
|
321
|
+
...O,
|
|
322
|
+
maxNumberOfRecordsToReturn: E ? F : 0,
|
|
322
323
|
enableFacets: i,
|
|
323
|
-
...
|
|
324
|
-
...
|
|
325
|
-
...
|
|
326
|
-
...
|
|
324
|
+
...E ? { includeDocuments: !0 } : {},
|
|
325
|
+
...b ? { filter: b } : {},
|
|
326
|
+
...H ? { sortBy: H } : {},
|
|
327
|
+
...U === void 0 ? {} : { sortAscending: U }
|
|
327
328
|
};
|
|
328
|
-
p && console.log("[performSearch] request body:", JSON.stringify(
|
|
329
|
-
let
|
|
330
|
-
g &&
|
|
331
|
-
let
|
|
332
|
-
|
|
333
|
-
let
|
|
329
|
+
p && console.log("[performSearch] request body:", JSON.stringify(W, null, 2));
|
|
330
|
+
let G = new URLSearchParams({ session: h });
|
|
331
|
+
g && G.set("source", g);
|
|
332
|
+
let K = _ ?? ve();
|
|
333
|
+
K && G.set("locale", K), v || G.set("count", "false"), L && G.set("refocus", "true"), S.current.trim() !== x.trim() && G.set("typed", S.current), o && (G.set("pickField", o.field), G.set("pickValue", o.value), G.set("pickText", o.text), o.fallback && G.set("pickFallback", "true"));
|
|
334
|
+
let ee = (e) => n(`${a}/api/teams/${s}/datasets/${u}/search?${G}`, {
|
|
334
335
|
method: "POST",
|
|
335
336
|
headers: { "Content-Type": "application/json" },
|
|
336
337
|
body: JSON.stringify(e)
|
|
337
|
-
}), [
|
|
338
|
-
...
|
|
338
|
+
}), [q, ...te] = await Promise.all([ee(W), ...w.map((e) => ee({
|
|
339
|
+
...O,
|
|
339
340
|
maxNumberOfRecordsToReturn: 0,
|
|
340
341
|
enableFacets: !0,
|
|
341
342
|
...e ? { filter: e } : {}
|
|
342
343
|
}))]);
|
|
343
|
-
if (!
|
|
344
|
-
let
|
|
345
|
-
for (let e = 0; e <
|
|
346
|
-
let t =
|
|
347
|
-
if (!
|
|
348
|
-
let n = await
|
|
349
|
-
n.facets?.[t] !== void 0 && (
|
|
344
|
+
if (!q.ok) throw await $.fromResponse("Search", q);
|
|
345
|
+
let J = await q.json(), Y = q.headers.get("Indx-Query-Id") ?? void 0, X = J.isFallback ? void 0 : J.count, Z = J.isFallback === !0, ne = J.toleranceCounts ?? null, re = J.countedTolerance ?? null, ie = J.ranked, Q = J.reranked, ae = J.fill ?? null, oe = {};
|
|
346
|
+
for (let e = 0; e < l.length; e++) {
|
|
347
|
+
let t = l[e];
|
|
348
|
+
if (!te[e].ok) throw await $.fromResponse(`Facets for '${t}'`, te[e]);
|
|
349
|
+
let n = await te[e].json();
|
|
350
|
+
n.facets?.[t] !== void 0 && (oe[t] = n.facets[t]);
|
|
350
351
|
}
|
|
351
|
-
let
|
|
352
|
-
if (
|
|
352
|
+
let se = J.records || [], ce = se.map((e) => e.documentKey), le = se.map((e) => e.score), ue = [];
|
|
353
|
+
if (E && ce.length > 0) {
|
|
353
354
|
let e;
|
|
354
|
-
if (Array.isArray(
|
|
355
|
+
if (Array.isArray(J.documents) && J.documents.length === ce.length) e = J.documents;
|
|
355
356
|
else {
|
|
356
357
|
let t = await n(`${a}/api/teams/${s}/datasets/${u}/documents/lookup`, {
|
|
357
358
|
method: "POST",
|
|
358
359
|
headers: { "Content-Type": "application/json" },
|
|
359
|
-
body: JSON.stringify(
|
|
360
|
+
body: JSON.stringify(ce)
|
|
360
361
|
});
|
|
361
|
-
if (!t.ok) throw await
|
|
362
|
+
if (!t.ok) throw await $.fromResponse("Document lookup", t);
|
|
362
363
|
e = await t.json();
|
|
363
364
|
}
|
|
364
|
-
|
|
365
|
+
ue = e.map((e, t) => ({
|
|
365
366
|
document: e,
|
|
366
|
-
documentKey:
|
|
367
|
-
score:
|
|
367
|
+
documentKey: ce[t],
|
|
368
|
+
score: le[t]
|
|
368
369
|
}));
|
|
369
370
|
}
|
|
370
|
-
let
|
|
371
|
-
if (i &&
|
|
372
|
-
for (let [e, t] of Object.entries(
|
|
371
|
+
let de = {};
|
|
372
|
+
if (i && J.facets) {
|
|
373
|
+
for (let [e, t] of Object.entries(J.facets)) if (Array.isArray(t) && t.length > 0) {
|
|
373
374
|
let n = t.map((e) => Number(e.key)).filter((e) => !isNaN(e));
|
|
374
|
-
n.length > 0 && (
|
|
375
|
+
n.length > 0 && (de[e] = {
|
|
375
376
|
min: Math.min(...n),
|
|
376
377
|
max: Math.max(...n)
|
|
377
378
|
});
|
|
378
379
|
}
|
|
379
380
|
}
|
|
380
|
-
if (c
|
|
381
|
-
|
|
382
|
-
|
|
381
|
+
if (c) {
|
|
382
|
+
if (y !== T.current || m < D.current) return;
|
|
383
|
+
if (D.current = m, f !== C.current) {
|
|
384
|
+
let e = Object.keys(oe).length > 0 ? {
|
|
385
|
+
...J.facets ?? {},
|
|
386
|
+
...oe
|
|
387
|
+
} : J.facets;
|
|
388
|
+
e && Object.keys(e).length > 0 && t((t) => ({
|
|
389
|
+
...t,
|
|
390
|
+
facets: e
|
|
391
|
+
}));
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
} else if (f !== C.current) return;
|
|
395
|
+
let fe = x !== j, pe = x !== N, me = e.facetStats ?? {};
|
|
396
|
+
if (fe ? (me = {
|
|
383
397
|
...r.initialFacetStats,
|
|
384
|
-
...
|
|
385
|
-
},
|
|
386
|
-
...
|
|
387
|
-
...
|
|
388
|
-
},
|
|
398
|
+
...de
|
|
399
|
+
}, A(me), M(x)) : me = {
|
|
400
|
+
...k,
|
|
401
|
+
...de
|
|
402
|
+
}, pe && i) {
|
|
389
403
|
let n = { ...e.rangeBounds };
|
|
390
|
-
for (let [e, t] of Object.entries(
|
|
404
|
+
for (let [e, t] of Object.entries(de)) n[e] = t;
|
|
391
405
|
t((e) => ({
|
|
392
406
|
...e,
|
|
393
407
|
rangeBounds: n
|
|
394
|
-
})),
|
|
408
|
+
})), P(x);
|
|
395
409
|
}
|
|
396
|
-
let
|
|
397
|
-
...
|
|
398
|
-
...
|
|
399
|
-
} :
|
|
400
|
-
if (i && (!
|
|
401
|
-
|
|
402
|
-
for (let [e, t] of Object.entries(r.initialFacetKeys))
|
|
410
|
+
let ge = Object.keys(oe).length > 0 ? {
|
|
411
|
+
...J.facets ?? {},
|
|
412
|
+
...oe
|
|
413
|
+
} : J.facets;
|
|
414
|
+
if (i && (!ge || Object.keys(ge).length === 0)) {
|
|
415
|
+
ge = {};
|
|
416
|
+
for (let [e, t] of Object.entries(r.initialFacetKeys)) ge[e] = t.map((e) => ({
|
|
403
417
|
key: e,
|
|
404
418
|
value: null
|
|
405
419
|
}));
|
|
406
420
|
}
|
|
407
|
-
let
|
|
408
|
-
let t =
|
|
409
|
-
return t === "" || t.length === 1 || e.score >=
|
|
421
|
+
let _e = ue.filter((e) => {
|
|
422
|
+
let t = x.trim();
|
|
423
|
+
return t === "" || t.length === 1 || e.score >= V;
|
|
410
424
|
}).map((e, t) => ({
|
|
411
425
|
...e,
|
|
412
426
|
position: t + 1
|
|
413
427
|
}));
|
|
428
|
+
if (c) {
|
|
429
|
+
t((e) => ({
|
|
430
|
+
...e,
|
|
431
|
+
facets: ge,
|
|
432
|
+
facetStats: me
|
|
433
|
+
}));
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
414
436
|
t((e) => ({
|
|
415
437
|
...e,
|
|
416
|
-
results:
|
|
438
|
+
results: _e,
|
|
417
439
|
error: void 0,
|
|
418
440
|
errorInfo: void 0,
|
|
419
|
-
resultsSuppressed: !
|
|
441
|
+
resultsSuppressed: !E,
|
|
420
442
|
...i ? {
|
|
421
|
-
facets:
|
|
422
|
-
facetStats:
|
|
443
|
+
facets: ge,
|
|
444
|
+
facetStats: me
|
|
423
445
|
} : {},
|
|
424
446
|
isLoading: !1,
|
|
425
|
-
countedTotal:
|
|
426
|
-
isFallback:
|
|
427
|
-
toleranceCounts:
|
|
428
|
-
countedTolerance:
|
|
429
|
-
ranked:
|
|
430
|
-
reranked:
|
|
431
|
-
fill:
|
|
432
|
-
queryId:
|
|
447
|
+
countedTotal: X,
|
|
448
|
+
isFallback: Z,
|
|
449
|
+
toleranceCounts: ne,
|
|
450
|
+
countedTolerance: re,
|
|
451
|
+
ranked: ie,
|
|
452
|
+
reranked: Q,
|
|
453
|
+
fill: ae,
|
|
454
|
+
queryId: Y
|
|
433
455
|
}));
|
|
434
456
|
} catch (e) {
|
|
435
|
-
if (console.error("[Search] β Search failed:", e), e instanceof TypeError && e.message.includes("fetch") ? (console.error("[Search] β Network error - cannot reach INDX server"), console.error("[Search] π‘ Check if server is running at:", a)) : e instanceof Error && (e.message.includes("401") ? (console.error("[Search] β Authentication failed"), console.error("[Search] π‘ Your token may have expired. Create or refresh it on the Indx Dashboard.")) : e.message.includes("404") ? (console.error("[Search] β Dataset not found"), console.error("[Search] π‘ Check that dataset \"" + u + "\" exists")) : console.error("[Search] π‘ Error:", e.message)), c !==
|
|
457
|
+
if (console.error("[Search] β Search failed:", e), e instanceof TypeError && e.message.includes("fetch") ? (console.error("[Search] β Network error - cannot reach INDX server"), console.error("[Search] π‘ Check if server is running at:", a)) : e instanceof Error && (e.message.includes("401") ? (console.error("[Search] β Authentication failed"), console.error("[Search] π‘ Your token may have expired. Create or refresh it on the Indx Dashboard.")) : e.message.includes("404") ? (console.error("[Search] β Dataset not found"), console.error("[Search] π‘ Check that dataset \"" + u + "\" exists")) : console.error("[Search] π‘ Error:", e.message)), c || f !== C.current) return;
|
|
436
458
|
t((t) => ({
|
|
437
459
|
...t,
|
|
438
460
|
results: null,
|
|
439
461
|
isLoading: !1,
|
|
440
462
|
resultsSuppressed: !1,
|
|
441
463
|
error: e instanceof Error ? e.message : "Search failed",
|
|
442
|
-
errorInfo:
|
|
464
|
+
errorInfo: de(e, {
|
|
443
465
|
team: s,
|
|
444
466
|
dataset: u
|
|
445
467
|
})
|
|
446
468
|
}));
|
|
447
469
|
}
|
|
448
470
|
}, [
|
|
449
|
-
|
|
471
|
+
x,
|
|
450
472
|
e.filters,
|
|
451
473
|
e.valueMatch,
|
|
452
474
|
e.rangeFilters,
|
|
453
475
|
e.bucketFilters,
|
|
454
476
|
e.facetStats,
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
j,
|
|
458
|
-
M,
|
|
459
|
-
N,
|
|
460
|
-
P,
|
|
477
|
+
H,
|
|
478
|
+
U,
|
|
461
479
|
F,
|
|
462
480
|
I,
|
|
463
481
|
L,
|
|
482
|
+
R,
|
|
483
|
+
z,
|
|
484
|
+
B,
|
|
485
|
+
V,
|
|
464
486
|
n,
|
|
465
487
|
r.initialFacetStats,
|
|
466
488
|
r.initialFacetKeys,
|
|
467
489
|
r.token,
|
|
468
|
-
T,
|
|
469
|
-
D,
|
|
470
490
|
k,
|
|
491
|
+
j,
|
|
492
|
+
N,
|
|
471
493
|
e.rangeBounds,
|
|
472
494
|
a,
|
|
473
495
|
s,
|
|
@@ -481,82 +503,103 @@ function pe({ state: e, setState: t, authenticatedFetch: n, auth: r, url: a, tea
|
|
|
481
503
|
v
|
|
482
504
|
]);
|
|
483
505
|
o(() => {
|
|
484
|
-
|
|
485
|
-
}, [
|
|
486
|
-
let
|
|
487
|
-
o(() => (
|
|
488
|
-
p && console.log("Debounced searchWithFacets fired"),
|
|
506
|
+
w.current = W;
|
|
507
|
+
}, [W]);
|
|
508
|
+
let G = c(null);
|
|
509
|
+
o(() => (G.current?.cancel(), G.current = ge(() => {
|
|
510
|
+
p && console.log("Debounced searchWithFacets fired"), w.current?.({ enableFacets: !0 });
|
|
489
511
|
}, e.facetDebounceDelayMillis ?? 500), () => {
|
|
490
|
-
|
|
491
|
-
}), [e.facetDebounceDelayMillis])
|
|
492
|
-
|
|
512
|
+
G.current?.cancel();
|
|
513
|
+
}), [e.facetDebounceDelayMillis]);
|
|
514
|
+
let K = c(!1), ee = c(!1), q = c(() => {});
|
|
515
|
+
q.current = () => {
|
|
516
|
+
K.current ? ee.current = !0 : (K.current = !0, ee.current = !1, (w.current?.({
|
|
517
|
+
enableFacets: !0,
|
|
518
|
+
facetsOnly: !0
|
|
519
|
+
}) ?? Promise.resolve()).finally(() => {
|
|
520
|
+
K.current = !1, ee.current && q.current();
|
|
521
|
+
}));
|
|
522
|
+
};
|
|
523
|
+
let te = () => {
|
|
524
|
+
b === "debounce" ? G.current?.() : q.current();
|
|
525
|
+
}, J = () => {
|
|
526
|
+
G.current?.cancel(), ee.current = !1, T.current++;
|
|
527
|
+
};
|
|
528
|
+
o(() => {
|
|
529
|
+
!r.isFetchingInitial && r.token && !O.current && ((d || x.trim() !== "") && w.current?.({ enableFacets: f }), O.current = !0);
|
|
493
530
|
}, [
|
|
494
531
|
r.isFetchingInitial,
|
|
495
532
|
r.token,
|
|
496
533
|
d,
|
|
497
534
|
f
|
|
498
535
|
]), o(() => {
|
|
499
|
-
if (!r.token || !
|
|
500
|
-
let e =
|
|
501
|
-
if (e === "" && !d)
|
|
536
|
+
if (!r.token || !O.current) return;
|
|
537
|
+
let e = x.trim(), n = e === "" && d;
|
|
538
|
+
if (e === "" && !d) C.current++, J(), t((e) => e.resultsSuppressed && !e.isLoading ? e : {
|
|
502
539
|
...e,
|
|
503
540
|
resultsSuppressed: !0,
|
|
504
541
|
isLoading: !1
|
|
505
542
|
});
|
|
506
|
-
else return n ? (
|
|
507
|
-
|
|
543
|
+
else return n ? (J(), w.current?.({ enableFacets: f })) : f ? (p && console.log("Search fired"), w.current?.({ enableFacets: !1 }), te()) : w.current?.({ enableFacets: !1 }), () => {
|
|
544
|
+
G.current?.cancel();
|
|
508
545
|
};
|
|
509
546
|
}, [
|
|
510
|
-
|
|
547
|
+
x,
|
|
511
548
|
d,
|
|
512
549
|
f
|
|
513
550
|
]), o(() => {
|
|
514
|
-
if (!
|
|
515
|
-
let t =
|
|
516
|
-
(d || t !== "")
|
|
551
|
+
if (!O.current || !r.token || e.filterRevision === 0) return;
|
|
552
|
+
let t = x.trim();
|
|
553
|
+
if (d || t !== "") {
|
|
554
|
+
let t = e.pick?.revision === e.filterRevision ? e.pick : void 0;
|
|
555
|
+
w.current?.({
|
|
556
|
+
enableFacets: f,
|
|
557
|
+
pick: t
|
|
558
|
+
});
|
|
559
|
+
}
|
|
517
560
|
}, [e.filterRevision]), o(() => {
|
|
518
|
-
if (!
|
|
519
|
-
let e =
|
|
520
|
-
(d || e !== "") &&
|
|
521
|
-
}, [
|
|
522
|
-
let
|
|
561
|
+
if (!O.current || !r.token) return;
|
|
562
|
+
let e = x.trim();
|
|
563
|
+
(d || e !== "") && w.current?.({ enableFacets: f });
|
|
564
|
+
}, [H, U]);
|
|
565
|
+
let Y = c(!0), X = c(x);
|
|
523
566
|
return o(() => {
|
|
524
|
-
if (
|
|
525
|
-
|
|
567
|
+
if (Y.current) {
|
|
568
|
+
Y.current = !1;
|
|
526
569
|
return;
|
|
527
570
|
}
|
|
528
|
-
if (
|
|
571
|
+
if (X.current !== x || !O.current || !r.token) return;
|
|
529
572
|
if (m.current) {
|
|
530
|
-
m.current = !1,
|
|
573
|
+
m.current = !1, w.current?.({ enableFacets: !1 });
|
|
531
574
|
return;
|
|
532
575
|
}
|
|
533
|
-
let e =
|
|
534
|
-
(d || e !== "") &&
|
|
576
|
+
let e = x.trim();
|
|
577
|
+
(d || e !== "") && w.current?.({ enableFacets: f });
|
|
535
578
|
}, [
|
|
536
|
-
j,
|
|
537
|
-
M,
|
|
538
|
-
N,
|
|
539
|
-
P,
|
|
540
579
|
F,
|
|
541
580
|
I,
|
|
542
|
-
L
|
|
581
|
+
L,
|
|
582
|
+
R,
|
|
583
|
+
z,
|
|
584
|
+
B,
|
|
585
|
+
V
|
|
543
586
|
]), o(() => {
|
|
544
|
-
|
|
545
|
-
}, [
|
|
546
|
-
|
|
587
|
+
X.current = x;
|
|
588
|
+
}, [x]), { retrySearch: i(() => {
|
|
589
|
+
w.current?.({ enableFacets: f });
|
|
547
590
|
}, [f]) };
|
|
548
591
|
}
|
|
549
|
-
function
|
|
592
|
+
function ve() {
|
|
550
593
|
if (typeof document < "u" && document.documentElement.lang) return document.documentElement.lang;
|
|
551
594
|
if (typeof navigator < "u" && navigator.language) return navigator.language;
|
|
552
595
|
}
|
|
553
596
|
// src/context/SearchContext.tsx
|
|
554
|
-
function
|
|
597
|
+
function ye() {
|
|
555
598
|
let e = globalThis.crypto;
|
|
556
599
|
return e?.randomUUID ? e.randomUUID() : Math.random().toString(36).slice(2) + Date.now().toString(36);
|
|
557
600
|
}
|
|
558
|
-
var
|
|
559
|
-
let
|
|
601
|
+
var be = "Type to search", xe = n(void 0), Se = ({ children: e, url: t, team: n, dataset: r, allowEmptySearch: a = !1, maxResults: s = 10, facetDebounceDelayMillis: u = 500, facetTiming: d = "inFlight", enableFacets: f = !0, mode: p, match: m = {}, candidates: g = {}, ranking: _ = {}, enableDebugLogs: v = !1, preAuthenticatedToken: y, source: b, locale: x, count: S = !0, searchTextOf: C }) => {
|
|
602
|
+
let w = c(!1), T = c(ye()).current, [E, D] = l(null), [O, k] = l(null), A = i((e) => !C || e === E ? e : C(e), [C, E]), j = c(s), [M, N] = l({
|
|
560
603
|
query: "",
|
|
561
604
|
results: null,
|
|
562
605
|
isLoading: !1,
|
|
@@ -576,89 +619,90 @@ var ge = "Type to search", _e = n(void 0), ve = ({ children: e, url: t, team: n,
|
|
|
576
619
|
rangeBounds: {},
|
|
577
620
|
searchSettings: {
|
|
578
621
|
maxNumberOfRecordsToReturn: s,
|
|
579
|
-
mode:
|
|
580
|
-
match:
|
|
581
|
-
candidates:
|
|
582
|
-
ranking:
|
|
622
|
+
mode: p,
|
|
623
|
+
match: m,
|
|
624
|
+
candidates: g,
|
|
625
|
+
ranking: _,
|
|
583
626
|
minimumScore: 0,
|
|
584
627
|
showScore: !0,
|
|
585
|
-
placeholderText:
|
|
628
|
+
placeholderText: be
|
|
586
629
|
}
|
|
587
630
|
});
|
|
588
631
|
o(() => {
|
|
589
|
-
|
|
590
|
-
}, [
|
|
591
|
-
|
|
632
|
+
v && console.log("SearchContext mounted on client");
|
|
633
|
+
}, [v]), o(() => {
|
|
634
|
+
N((e) => ({
|
|
592
635
|
...e,
|
|
593
636
|
facetDebounceDelayMillis: u
|
|
594
637
|
}));
|
|
595
638
|
}, [u]);
|
|
596
|
-
let [
|
|
639
|
+
let [P] = l(f), F = fe({
|
|
597
640
|
url: t,
|
|
598
641
|
team: n,
|
|
599
642
|
dataset: r,
|
|
600
|
-
preAuthenticatedToken:
|
|
601
|
-
enableDebugLogs:
|
|
602
|
-
}),
|
|
603
|
-
if (!
|
|
643
|
+
preAuthenticatedToken: y,
|
|
644
|
+
enableDebugLogs: v
|
|
645
|
+
}), I = i((e, t = {}) => {
|
|
646
|
+
if (!F.token) throw Error("No authentication token available");
|
|
604
647
|
return fetch(e, {
|
|
605
648
|
...t,
|
|
606
649
|
headers: {
|
|
607
650
|
...t.headers,
|
|
608
|
-
Authorization: `Bearer ${
|
|
651
|
+
Authorization: `Bearer ${F.token}`
|
|
609
652
|
}
|
|
610
653
|
});
|
|
611
|
-
}, [
|
|
612
|
-
state:
|
|
613
|
-
setState:
|
|
614
|
-
authenticatedFetch:
|
|
615
|
-
auth:
|
|
654
|
+
}, [F.token]), { retrySearch: L } = _e({
|
|
655
|
+
state: M,
|
|
656
|
+
setState: N,
|
|
657
|
+
authenticatedFetch: I,
|
|
658
|
+
auth: F,
|
|
616
659
|
url: t,
|
|
617
660
|
team: n,
|
|
618
661
|
dataset: r,
|
|
619
662
|
allowEmptySearch: a,
|
|
620
|
-
facetsEnabled:
|
|
621
|
-
enableDebugLogs:
|
|
622
|
-
shouldFetchMore:
|
|
623
|
-
sessionId:
|
|
624
|
-
source:
|
|
625
|
-
locale:
|
|
626
|
-
count:
|
|
627
|
-
searchTextOf:
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
663
|
+
facetsEnabled: P,
|
|
664
|
+
enableDebugLogs: v,
|
|
665
|
+
shouldFetchMore: w,
|
|
666
|
+
sessionId: T,
|
|
667
|
+
source: b,
|
|
668
|
+
locale: x,
|
|
669
|
+
count: S,
|
|
670
|
+
searchTextOf: A,
|
|
671
|
+
facetTiming: d
|
|
672
|
+
}), R = c(void 0);
|
|
673
|
+
R.current = M.queryId;
|
|
674
|
+
let z = c(/* @__PURE__ */ new Map()), B = i(async (e) => {
|
|
675
|
+
if (F.token) {
|
|
676
|
+
z.current.set(e.documentKey, R.current);
|
|
633
677
|
try {
|
|
634
|
-
let i = await
|
|
678
|
+
let i = await I(`${t}/api/teams/${n}/datasets/${r}/events/select`, {
|
|
635
679
|
method: "POST",
|
|
636
680
|
headers: { "Content-Type": "application/json" },
|
|
637
681
|
body: JSON.stringify({
|
|
638
|
-
queryId:
|
|
682
|
+
queryId: R.current,
|
|
639
683
|
documentKey: e.documentKey,
|
|
640
684
|
position: e.position,
|
|
641
|
-
...
|
|
685
|
+
...S ? {} : { count: !1 }
|
|
642
686
|
})
|
|
643
687
|
});
|
|
644
|
-
|
|
688
|
+
v && (i.ok ? console.log(`[select] document ${e.documentKey} at position ${e.position}`) : console.warn(`[select] not recorded: ${i.status}`));
|
|
645
689
|
} catch (e) {
|
|
646
|
-
|
|
690
|
+
v && console.warn("[select] failed:", e);
|
|
647
691
|
}
|
|
648
692
|
}
|
|
649
693
|
}, [
|
|
650
|
-
|
|
651
|
-
|
|
694
|
+
F.token,
|
|
695
|
+
I,
|
|
652
696
|
t,
|
|
653
697
|
n,
|
|
654
698
|
r,
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
]),
|
|
658
|
-
if (!
|
|
659
|
-
let o = a?.queryId ??
|
|
699
|
+
v,
|
|
700
|
+
S
|
|
701
|
+
]), V = i(async (e, i, a) => {
|
|
702
|
+
if (!F.token || !i.trim()) return;
|
|
703
|
+
let o = a?.queryId ?? z.current.get(e) ?? R.current;
|
|
660
704
|
try {
|
|
661
|
-
let s = await
|
|
705
|
+
let s = await I(`${t}/api/teams/${n}/datasets/${r}/events/convert`, {
|
|
662
706
|
method: "POST",
|
|
663
707
|
headers: { "Content-Type": "application/json" },
|
|
664
708
|
body: JSON.stringify({
|
|
@@ -666,23 +710,23 @@ var ge = "Type to search", _e = n(void 0), ve = ({ children: e, url: t, team: n,
|
|
|
666
710
|
documentKey: e,
|
|
667
711
|
type: i.trim(),
|
|
668
712
|
...a?.quantity == null ? {} : { quantity: a.quantity },
|
|
669
|
-
...
|
|
713
|
+
...S ? {} : { count: !1 }
|
|
670
714
|
})
|
|
671
715
|
});
|
|
672
|
-
|
|
716
|
+
v && (s.ok ? console.log(`[convert] ${i} on document ${e}`) : console.warn(`[convert] not recorded: ${s.status}`));
|
|
673
717
|
} catch (e) {
|
|
674
|
-
|
|
718
|
+
v && console.warn("[convert] failed:", e);
|
|
675
719
|
}
|
|
676
720
|
}, [
|
|
677
|
-
|
|
678
|
-
|
|
721
|
+
F.token,
|
|
722
|
+
I,
|
|
679
723
|
t,
|
|
680
724
|
n,
|
|
681
725
|
r,
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
]),
|
|
685
|
-
|
|
726
|
+
v,
|
|
727
|
+
S
|
|
728
|
+
]), H = i((e) => {
|
|
729
|
+
N((t) => {
|
|
686
730
|
let n = Object.keys(t.filters).length > 0, r = Object.keys(t.rangeFilters).length > 0, i = Object.keys(t.bucketFilters).length > 0;
|
|
687
731
|
return {
|
|
688
732
|
...t,
|
|
@@ -692,17 +736,17 @@ var ge = "Type to search", _e = n(void 0), ve = ({ children: e, url: t, team: n,
|
|
|
692
736
|
bucketFilters: i ? {} : t.bucketFilters,
|
|
693
737
|
searchSettings: {
|
|
694
738
|
...t.searchSettings,
|
|
695
|
-
maxNumberOfRecordsToReturn:
|
|
739
|
+
maxNumberOfRecordsToReturn: j.current
|
|
696
740
|
}
|
|
697
741
|
};
|
|
698
742
|
});
|
|
699
|
-
}, []),
|
|
700
|
-
|
|
743
|
+
}, []), U = i((e) => {
|
|
744
|
+
N((t) => ({
|
|
701
745
|
...t,
|
|
702
746
|
facetDebounceDelayMillis: e
|
|
703
747
|
}));
|
|
704
|
-
}, []),
|
|
705
|
-
typeof e.maxNumberOfRecordsToReturn == "number" && (
|
|
748
|
+
}, []), W = i((e) => {
|
|
749
|
+
typeof e.maxNumberOfRecordsToReturn == "number" && (j.current = e.maxNumberOfRecordsToReturn), N((t) => {
|
|
706
750
|
let n = {
|
|
707
751
|
...t.searchSettings,
|
|
708
752
|
...e
|
|
@@ -715,33 +759,39 @@ var ge = "Type to search", _e = n(void 0), ve = ({ children: e, url: t, team: n,
|
|
|
715
759
|
searchSettings: n
|
|
716
760
|
};
|
|
717
761
|
});
|
|
718
|
-
}, []),
|
|
719
|
-
|
|
762
|
+
}, []), G = i((e) => {
|
|
763
|
+
w.current = !0, N((t) => ({
|
|
720
764
|
...t,
|
|
721
765
|
searchSettings: {
|
|
722
766
|
...t.searchSettings,
|
|
723
767
|
maxNumberOfRecordsToReturn: e
|
|
724
768
|
}
|
|
725
769
|
}));
|
|
726
|
-
}, []),
|
|
727
|
-
|
|
728
|
-
let
|
|
729
|
-
return
|
|
730
|
-
...
|
|
731
|
-
filters:
|
|
732
|
-
filterRevision:
|
|
770
|
+
}, []), K = i((e, t, n = !1, r) => {
|
|
771
|
+
N((i) => {
|
|
772
|
+
let a = { ...i.filters }, o = a[e] || [], s = !o.includes(t), c = s ? n ? [t] : [...o, t] : o.filter((e) => e !== t);
|
|
773
|
+
return c.length ? a[e] = c : delete a[e], {
|
|
774
|
+
...i,
|
|
775
|
+
filters: a,
|
|
776
|
+
filterRevision: i.filterRevision + 1,
|
|
777
|
+
pick: s && r ? {
|
|
778
|
+
field: e,
|
|
779
|
+
value: t,
|
|
780
|
+
...r,
|
|
781
|
+
revision: i.filterRevision + 1
|
|
782
|
+
} : void 0
|
|
733
783
|
};
|
|
734
784
|
});
|
|
735
|
-
}, []),
|
|
736
|
-
|
|
785
|
+
}, []), ee = i((e, t) => {
|
|
786
|
+
N((n) => n.valueMatch[e] === t ? n : {
|
|
737
787
|
...n,
|
|
738
788
|
valueMatch: {
|
|
739
789
|
...n.valueMatch,
|
|
740
790
|
[e]: t
|
|
741
791
|
}
|
|
742
792
|
});
|
|
743
|
-
}, []),
|
|
744
|
-
|
|
793
|
+
}, []), q = i((e, t, n) => {
|
|
794
|
+
N((r) => ({
|
|
745
795
|
...r,
|
|
746
796
|
rangeFilters: {
|
|
747
797
|
...r.rangeFilters,
|
|
@@ -752,16 +802,16 @@ var ge = "Type to search", _e = n(void 0), ve = ({ children: e, url: t, team: n,
|
|
|
752
802
|
},
|
|
753
803
|
filterRevision: r.filterRevision + 1
|
|
754
804
|
}));
|
|
755
|
-
}, []),
|
|
756
|
-
|
|
805
|
+
}, []), te = i(() => {
|
|
806
|
+
N((e) => ({
|
|
757
807
|
...e,
|
|
758
808
|
filters: {},
|
|
759
809
|
rangeFilters: {},
|
|
760
810
|
bucketFilters: {},
|
|
761
811
|
filterRevision: e.filterRevision + 1
|
|
762
812
|
}));
|
|
763
|
-
}, []),
|
|
764
|
-
|
|
813
|
+
}, []), J = i((e, t, n = !0) => {
|
|
814
|
+
N((r) => {
|
|
765
815
|
let i = { ...r.filters }, a = (i[e] || []).filter((e) => e !== t);
|
|
766
816
|
return a.length > 0 ? i[e] = a : delete i[e], {
|
|
767
817
|
...r,
|
|
@@ -769,8 +819,8 @@ var ge = "Type to search", _e = n(void 0), ve = ({ children: e, url: t, team: n,
|
|
|
769
819
|
filterRevision: r.filterRevision + +!!n
|
|
770
820
|
};
|
|
771
821
|
});
|
|
772
|
-
}, []),
|
|
773
|
-
|
|
822
|
+
}, []), Y = i((e, t = !0) => {
|
|
823
|
+
N((n) => {
|
|
774
824
|
if (!(e in n.rangeFilters)) return n;
|
|
775
825
|
let r = { ...n.rangeFilters };
|
|
776
826
|
return delete r[e], {
|
|
@@ -779,83 +829,105 @@ var ge = "Type to search", _e = n(void 0), ve = ({ children: e, url: t, team: n,
|
|
|
779
829
|
filterRevision: n.filterRevision + +!!t
|
|
780
830
|
};
|
|
781
831
|
});
|
|
782
|
-
}, []),
|
|
783
|
-
|
|
784
|
-
let i = r.bucketFilters[e] ?? [], a = i.some((e) =>
|
|
832
|
+
}, []), X = (e, t) => e.min === t.min && e.max === t.max, Z = i((e, t, n = !1) => {
|
|
833
|
+
N((r) => {
|
|
834
|
+
let i = r.bucketFilters[e] ?? [], a = i.some((e) => X(e, t)) ? i.filter((e) => !X(e, t)) : n ? [t] : [...i, t], o = { ...r.bucketFilters };
|
|
785
835
|
return a.length > 0 ? o[e] = a : delete o[e], {
|
|
786
836
|
...r,
|
|
787
837
|
bucketFilters: o,
|
|
788
838
|
filterRevision: r.filterRevision + 1
|
|
789
839
|
};
|
|
790
840
|
});
|
|
791
|
-
}, []),
|
|
792
|
-
|
|
793
|
-
let i = { ...r.bucketFilters }, a = t ? (i[e] ?? []).filter((e) => !
|
|
841
|
+
}, []), ne = i((e, t, n = !0) => {
|
|
842
|
+
N((r) => {
|
|
843
|
+
let i = { ...r.bucketFilters }, a = t ? (i[e] ?? []).filter((e) => !X(e, t)) : [];
|
|
794
844
|
return a.length > 0 ? i[e] = a : delete i[e], {
|
|
795
845
|
...r,
|
|
796
846
|
bucketFilters: i,
|
|
797
847
|
filterRevision: r.filterRevision + +!!n
|
|
798
848
|
};
|
|
799
849
|
});
|
|
800
|
-
}, []), re = i((e,
|
|
801
|
-
|
|
850
|
+
}, []), re = i(async (e, i, a, o) => {
|
|
851
|
+
let s = await I(`${t}/api/teams/${n}/datasets/${r}/facets/${encodeURIComponent(e)}/search`, {
|
|
852
|
+
method: "POST",
|
|
853
|
+
headers: { "Content-Type": "application/json" },
|
|
854
|
+
body: JSON.stringify({
|
|
855
|
+
text: i,
|
|
856
|
+
rows: a,
|
|
857
|
+
...o ? { values: o } : {}
|
|
858
|
+
})
|
|
859
|
+
});
|
|
860
|
+
if (!s.ok) return null;
|
|
861
|
+
let c = await s.json();
|
|
862
|
+
return {
|
|
863
|
+
values: c.values ?? [],
|
|
864
|
+
fallback: c.fallback === !0
|
|
865
|
+
};
|
|
866
|
+
}, [
|
|
867
|
+
t,
|
|
868
|
+
n,
|
|
869
|
+
r,
|
|
870
|
+
I
|
|
871
|
+
]), ie = i((e, t) => {
|
|
872
|
+
N((n) => ({
|
|
802
873
|
...n,
|
|
803
874
|
sortBy: e || void 0,
|
|
804
875
|
sortAscending: e ? t : void 0
|
|
805
876
|
}));
|
|
806
877
|
}, []);
|
|
807
|
-
return /* @__PURE__ */ h(
|
|
878
|
+
return /* @__PURE__ */ h(xe.Provider, {
|
|
808
879
|
value: {
|
|
809
|
-
state:
|
|
810
|
-
isFetchingInitial:
|
|
811
|
-
authError:
|
|
812
|
-
authErrorInfo:
|
|
813
|
-
retry:
|
|
880
|
+
state: M,
|
|
881
|
+
isFetchingInitial: F.isFetchingInitial || !M.fieldsSeeded,
|
|
882
|
+
authError: F.authError ?? void 0,
|
|
883
|
+
authErrorInfo: F.authErrorInfo ?? void 0,
|
|
884
|
+
retry: F.authError ? F.retry : L,
|
|
814
885
|
allowEmptySearch: a,
|
|
815
|
-
facetsEnabled:
|
|
816
|
-
datasetBounds:
|
|
886
|
+
facetsEnabled: P,
|
|
887
|
+
datasetBounds: F.initialFacetStats,
|
|
817
888
|
url: t,
|
|
818
889
|
team: n,
|
|
819
890
|
dataset: r,
|
|
820
|
-
authenticatedFetch:
|
|
821
|
-
setQuery:
|
|
822
|
-
toggleFilter:
|
|
823
|
-
setValueMatch:
|
|
824
|
-
setRangeFilter:
|
|
825
|
-
resetFilters:
|
|
826
|
-
resetSingleFilter:
|
|
827
|
-
resetRangeFilter:
|
|
828
|
-
toggleBucketFilter:
|
|
829
|
-
resetBucketFilter:
|
|
830
|
-
setSort:
|
|
831
|
-
setDebounceDelay:
|
|
832
|
-
setSearchSettings:
|
|
833
|
-
fetchMoreResults:
|
|
834
|
-
selectResult:
|
|
835
|
-
convertResult:
|
|
836
|
-
sessionId:
|
|
837
|
-
source:
|
|
838
|
-
count:
|
|
839
|
-
searchText:
|
|
840
|
-
picks:
|
|
841
|
-
showPicks: (e) =>
|
|
891
|
+
authenticatedFetch: I,
|
|
892
|
+
setQuery: H,
|
|
893
|
+
toggleFilter: K,
|
|
894
|
+
setValueMatch: ee,
|
|
895
|
+
setRangeFilter: q,
|
|
896
|
+
resetFilters: te,
|
|
897
|
+
resetSingleFilter: J,
|
|
898
|
+
resetRangeFilter: Y,
|
|
899
|
+
toggleBucketFilter: Z,
|
|
900
|
+
resetBucketFilter: ne,
|
|
901
|
+
setSort: ie,
|
|
902
|
+
setDebounceDelay: U,
|
|
903
|
+
setSearchSettings: W,
|
|
904
|
+
fetchMoreResults: G,
|
|
905
|
+
selectResult: B,
|
|
906
|
+
convertResult: V,
|
|
907
|
+
sessionId: T,
|
|
908
|
+
source: b,
|
|
909
|
+
count: S,
|
|
910
|
+
searchText: A(M.query),
|
|
911
|
+
picks: O && O.query === M.query ? O.picks : null,
|
|
912
|
+
showPicks: (e) => k(e ? {
|
|
842
913
|
picks: e,
|
|
843
|
-
query:
|
|
914
|
+
query: M.query
|
|
844
915
|
} : null),
|
|
845
|
-
searchAsTyped: () =>
|
|
916
|
+
searchAsTyped: () => D(M.query),
|
|
917
|
+
searchFacetValues: re
|
|
846
918
|
},
|
|
847
919
|
children: e
|
|
848
920
|
});
|
|
849
|
-
},
|
|
850
|
-
let e = a(
|
|
921
|
+
}, Ce = () => {
|
|
922
|
+
let e = a(xe);
|
|
851
923
|
if (!e) throw Error("useSearchContext must be used within a SearchProvider");
|
|
852
924
|
return e;
|
|
853
925
|
};
|
|
854
926
|
// src/utils/searchOrAsk.ts
|
|
855
|
-
function
|
|
927
|
+
function we(e, t) {
|
|
856
928
|
return t ? t === "proactive" && e !== "proactive" ? "inviting" : t : e;
|
|
857
929
|
}
|
|
858
|
-
var
|
|
930
|
+
var Te = {
|
|
859
931
|
strong: .65,
|
|
860
932
|
strongHide: .45,
|
|
861
933
|
invite: .4,
|
|
@@ -864,32 +936,32 @@ var xe = {
|
|
|
864
936
|
finished: .5,
|
|
865
937
|
found: .3,
|
|
866
938
|
refocus: 0
|
|
867
|
-
},
|
|
868
|
-
function
|
|
939
|
+
}, Ee = /^[\d\s\-_.:/]+$|^\w+\.\w+|^[A-Za-z]*[a-z][A-Z]\w*$|^[A-Za-z]+[-_]?\d[\w-]*$/;
|
|
940
|
+
function De(e) {
|
|
869
941
|
let t = e.trim();
|
|
870
|
-
return t.length > 0 && !t.includes(" ") &&
|
|
942
|
+
return t.length > 0 && !t.includes(" ") && Ee.test(t);
|
|
871
943
|
}
|
|
872
|
-
function
|
|
944
|
+
function Oe(e) {
|
|
873
945
|
let t = e.trim();
|
|
874
|
-
return !!t && !
|
|
946
|
+
return !!t && !De(t) && (t.endsWith("?") || t.split(/\s+/).length >= 3);
|
|
875
947
|
}
|
|
876
|
-
function
|
|
948
|
+
function ke(e, t = 4) {
|
|
877
949
|
let n = e.trim();
|
|
878
|
-
return !n ||
|
|
950
|
+
return !n || De(n) ? !1 : Oe(n) || n.length >= t;
|
|
879
951
|
}
|
|
880
|
-
function
|
|
952
|
+
function Ae(e, t, n = Te) {
|
|
881
953
|
return t >= n.strong || e === "strong" && t >= n.strongHide ? "strong" : t >= n.invite || e !== "none" && t >= n.inviteHide ? "invite" : "none";
|
|
882
954
|
}
|
|
883
|
-
var
|
|
955
|
+
var je = {
|
|
884
956
|
tolerance: p.Exact,
|
|
885
957
|
typingPrefixFrom: 0,
|
|
886
958
|
joinedWords: !1
|
|
887
959
|
};
|
|
888
|
-
function
|
|
960
|
+
function Me(e) {
|
|
889
961
|
let t = e.trim();
|
|
890
962
|
return t.includes(" ") || t.endsWith("?");
|
|
891
963
|
}
|
|
892
|
-
async function*
|
|
964
|
+
async function* Ne(e) {
|
|
893
965
|
let t = e.getReader(), n = new TextDecoder(), r = "";
|
|
894
966
|
try {
|
|
895
967
|
for (;;) {
|
|
@@ -912,24 +984,24 @@ async function* ke(e) {
|
|
|
912
984
|
t.releaseLock();
|
|
913
985
|
}
|
|
914
986
|
}
|
|
915
|
-
function
|
|
987
|
+
function Pe(e) {
|
|
916
988
|
let t = new URLSearchParams();
|
|
917
989
|
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");
|
|
918
990
|
let n = t.toString();
|
|
919
991
|
return n ? `?${n}` : "";
|
|
920
992
|
}
|
|
921
993
|
// src/hooks/useSearchOrAsk.ts
|
|
922
|
-
function
|
|
994
|
+
function Fe(e) {
|
|
923
995
|
return {
|
|
924
|
-
...
|
|
996
|
+
...Te,
|
|
925
997
|
...e,
|
|
926
|
-
hint: e?.hint ??
|
|
927
|
-
finished: e?.finished ??
|
|
928
|
-
found: e?.found ??
|
|
929
|
-
refocus: e?.refocus ??
|
|
998
|
+
hint: e?.hint ?? Te.hint,
|
|
999
|
+
finished: e?.finished ?? Te.finished,
|
|
1000
|
+
found: e?.found ?? Te.found,
|
|
1001
|
+
refocus: e?.refocus ?? Te.refocus
|
|
930
1002
|
};
|
|
931
1003
|
}
|
|
932
|
-
var
|
|
1004
|
+
var Ie = .1, Le = {
|
|
933
1005
|
available: !1,
|
|
934
1006
|
offer: "none",
|
|
935
1007
|
p: null,
|
|
@@ -948,15 +1020,19 @@ var Me = .1, Ne = {
|
|
|
948
1020
|
finished: null,
|
|
949
1021
|
answerNow: null,
|
|
950
1022
|
quick: "none",
|
|
951
|
-
stands: !1
|
|
1023
|
+
stands: !1,
|
|
1024
|
+
door: !1,
|
|
1025
|
+
offerRow: "none",
|
|
1026
|
+
offerKind: null,
|
|
1027
|
+
enterAsks: !1
|
|
952
1028
|
};
|
|
953
|
-
function
|
|
954
|
-
let { enabled: t = !0, pauseMs: n = 300, prefetch: r = !0, mode: i, answerAfterMs: a = 1e3 } = e, s =
|
|
1029
|
+
function Re(e = {}) {
|
|
1030
|
+
let { enabled: t = !0, pauseMs: n = 300, prefetch: r = !0, mode: i, answerAfterMs: a = 1e3 } = e, s = Ce(), { url: u, team: d, dataset: f, authenticatedFetch: p, isFetchingInitial: m, authError: h, state: g } = s, _ = c(s);
|
|
955
1031
|
_.current = s;
|
|
956
|
-
let v = (e.text ?? g.query).trim(), [y, b] = l(!1), [x, S] = l(
|
|
1032
|
+
let v = (e.text ?? g.query).trim(), [y, b] = l(!1), [x, S] = l(Le), C = c(Te), w = c(!0), T = c("off"), E = c("soft"), D = c(i);
|
|
957
1033
|
D.current = i;
|
|
958
1034
|
let O = { get current() {
|
|
959
|
-
return
|
|
1035
|
+
return we(E.current, D.current);
|
|
960
1036
|
} }, k = c(null), A = c("none"), j = c(""), M = c(0), N = c(0);
|
|
961
1037
|
A.current = x.offer;
|
|
962
1038
|
let P = c(null), F = c(/* @__PURE__ */ new Set()), I = c(0), L = c(v);
|
|
@@ -979,7 +1055,7 @@ function Pe(e = {}) {
|
|
|
979
1055
|
if (!t.ok) return;
|
|
980
1056
|
let n = await t.json();
|
|
981
1057
|
if (e || !n.available || !n.settings?.enabled) return;
|
|
982
|
-
T.current = n.settings.filtersWhileTyping ?? "off", E.current = n.settings.mode ?? "soft", C.current =
|
|
1058
|
+
T.current = n.settings.filtersWhileTyping ?? "off", E.current = n.settings.mode ?? "soft", C.current = Fe(n.settings.thresholds), w.current = n.settings.strictCoverageWhileAsking ?? !0, b(!0);
|
|
983
1059
|
} catch {}
|
|
984
1060
|
})(), () => {
|
|
985
1061
|
e = !0;
|
|
@@ -991,7 +1067,7 @@ function Pe(e = {}) {
|
|
|
991
1067
|
]);
|
|
992
1068
|
let K = c(() => {});
|
|
993
1069
|
K.current = (e) => {
|
|
994
|
-
if (!r || !R.current || P.current || !e || !
|
|
1070
|
+
if (!r || !R.current || P.current || !e || !ke(e, H()) || F.current.has(e) || W(e) || Date.now() < N.current || Date.now() < I.current) return;
|
|
995
1071
|
let t = (async () => {
|
|
996
1072
|
try {
|
|
997
1073
|
let t = await p(`${V}/intent`, {
|
|
@@ -1018,18 +1094,18 @@ function Pe(e = {}) {
|
|
|
1018
1094
|
});
|
|
1019
1095
|
}, o(() => {
|
|
1020
1096
|
if (!y) {
|
|
1021
|
-
S(
|
|
1097
|
+
S(Le);
|
|
1022
1098
|
return;
|
|
1023
1099
|
}
|
|
1024
1100
|
if (!v) {
|
|
1025
1101
|
j.current = "", S({
|
|
1026
|
-
...
|
|
1102
|
+
...Le,
|
|
1027
1103
|
available: y
|
|
1028
1104
|
});
|
|
1029
1105
|
return;
|
|
1030
1106
|
}
|
|
1031
|
-
if (!
|
|
1032
|
-
|
|
1107
|
+
if (!ke(v, H())) {
|
|
1108
|
+
De(v) && S((e) => ({
|
|
1033
1109
|
...e,
|
|
1034
1110
|
available: y,
|
|
1035
1111
|
offer: "none",
|
|
@@ -1050,7 +1126,7 @@ function Pe(e = {}) {
|
|
|
1050
1126
|
let t = ++M.current;
|
|
1051
1127
|
j.current = v;
|
|
1052
1128
|
try {
|
|
1053
|
-
let e = await p(`${V}/intent${
|
|
1129
|
+
let e = await p(`${V}/intent${Pe(_.current)}`, {
|
|
1054
1130
|
method: "POST",
|
|
1055
1131
|
headers: { "Content-Type": "application/json" },
|
|
1056
1132
|
body: JSON.stringify({ text: v })
|
|
@@ -1076,8 +1152,8 @@ function Pe(e = {}) {
|
|
|
1076
1152
|
if (!e.ok) return;
|
|
1077
1153
|
let { p: n, answerable: r, criteria: i, finished: a, found: o, reason: s, thresholds: c, strictCoverageWhileAsking: l, filtersWhileTyping: u, mode: d, refocus: f } = await e.json();
|
|
1078
1154
|
if (u != null && (T.current = u), t !== M.current) return;
|
|
1079
|
-
l != null && (w.current = l), d != null && (E.current = d), c && (C.current =
|
|
1080
|
-
let t =
|
|
1155
|
+
l != null && (w.current = l), d != null && (E.current = d), c && (C.current = Fe(c)), S((e) => {
|
|
1156
|
+
let t = Ae(e.offer, n, C.current), c = i ?? null, l = c != null && c >= C.current.strong, u = e.offer === "strong" && !!e.text && v.startsWith(e.text) || Me(v) && (a == null || U(a)), d = l && u ? "strong" : l || t === "strong" && !u ? "invite" : t, p = O.current === "strict" && d === "invite" ? "none" : d, m = p === "strong" && !(l && c > n), h = o ?? null, g = C.current.found ?? 0, _ = C.current.refocus ?? 0, y = e.refocus && _ > 0 && !!e.text && v.startsWith(e.text) && Math.max(n, c ?? 0) >= _ - Ie;
|
|
1081
1157
|
return {
|
|
1082
1158
|
available: !0,
|
|
1083
1159
|
offer: p,
|
|
@@ -1095,6 +1171,10 @@ function Pe(e = {}) {
|
|
|
1095
1171
|
mode: O.current,
|
|
1096
1172
|
askAnytime: !1,
|
|
1097
1173
|
quick: "none",
|
|
1174
|
+
door: !1,
|
|
1175
|
+
offerRow: "none",
|
|
1176
|
+
offerKind: null,
|
|
1177
|
+
enterAsks: !1,
|
|
1098
1178
|
finished: a ?? null,
|
|
1099
1179
|
answerNow: O.current === "proactive" && p === "strong" && U(a) ? v : null,
|
|
1100
1180
|
stands: !0
|
|
@@ -1131,18 +1211,18 @@ function Pe(e = {}) {
|
|
|
1131
1211
|
if (te) {
|
|
1132
1212
|
if (k.current) return;
|
|
1133
1213
|
let n = t.searchSettings.match ?? {};
|
|
1134
|
-
k.current = Object.fromEntries(Object.keys(
|
|
1214
|
+
k.current = Object.fromEntries(Object.keys(je).map((e) => [e, n[e]])), e({ match: { ...je } });
|
|
1135
1215
|
} else k.current &&= (e({ match: { ...k.current } }), null);
|
|
1136
1216
|
}, [te]);
|
|
1137
|
-
let
|
|
1217
|
+
let J = y && x.refocus && !x.held && z === 0 && !!x.text && v.startsWith(x.text);
|
|
1138
1218
|
if (o(() => {
|
|
1139
|
-
_.current.setSearchSettings({ refocus:
|
|
1140
|
-
}, [
|
|
1141
|
-
let
|
|
1142
|
-
if (
|
|
1219
|
+
_.current.setSearchSettings({ refocus: J });
|
|
1220
|
+
}, [J]), !y) return Le;
|
|
1221
|
+
let Y = O.current, X = !!x.text && v.startsWith(x.text), Z = x.held || z > 0;
|
|
1222
|
+
if (Z) return {
|
|
1143
1223
|
...x,
|
|
1144
|
-
mode:
|
|
1145
|
-
held:
|
|
1224
|
+
mode: Y,
|
|
1225
|
+
held: Z,
|
|
1146
1226
|
offer: "none",
|
|
1147
1227
|
askAnytime: !1,
|
|
1148
1228
|
answerNow: null,
|
|
@@ -1150,22 +1230,30 @@ function Pe(e = {}) {
|
|
|
1150
1230
|
notFound: !1,
|
|
1151
1231
|
strictCoverage: !1,
|
|
1152
1232
|
refocus: !1,
|
|
1153
|
-
stands:
|
|
1233
|
+
stands: X,
|
|
1234
|
+
door: !1,
|
|
1235
|
+
offerRow: "none",
|
|
1236
|
+
offerKind: null,
|
|
1237
|
+
enterAsks: !1
|
|
1154
1238
|
};
|
|
1155
|
-
let
|
|
1239
|
+
let ne = Y === "inviting" || Y === "proactive", re = ne && !!v && (X && x.p != null && x.p >= (C.current.hint ?? 1) || Oe(v)), ie = v ? X && x.offer === "strong" ? Y === "proactive" ? U(x.finished) ? "thinking" : "hint" : "ready" : X && x.offer === "invite" ? ne ? "hint" : "invite" : re ? "hint" : Y === "open" || ne ? "ask" : "none" : "none", Q = X && x.offer === "strong", ae = v ? Q ? Y === "proactive" ? U(x.finished) ? "thinking" : "hint" : "ready" : X && x.offer === "invite" && ne || re ? "hint" : "none" : "none", oe = ae === "ready" ? x.describes && (x.criteria ?? 0) > (x.p ?? 0) ? "describe" : x.notFound ? "notFound" : "ask" : null, se = !!v && ae !== "thinking" && (Y === "open" || ne || Y === "soft" && X && x.offer !== "none");
|
|
1156
1240
|
return {
|
|
1157
1241
|
...x,
|
|
1158
|
-
refocus:
|
|
1159
|
-
mode:
|
|
1160
|
-
askAnytime:
|
|
1242
|
+
refocus: J,
|
|
1243
|
+
mode: Y,
|
|
1244
|
+
askAnytime: Y === "open" || ne,
|
|
1245
|
+
door: se,
|
|
1246
|
+
offerRow: ae,
|
|
1247
|
+
offerKind: oe,
|
|
1248
|
+
enterAsks: ae === "ready",
|
|
1161
1249
|
answerNow: ee !== null && ee === v && x.answerNow === v ? ee : null,
|
|
1162
|
-
text: (
|
|
1163
|
-
notFound:
|
|
1164
|
-
quick:
|
|
1165
|
-
stands:
|
|
1250
|
+
text: (ie === "hint" || ie === "ask") && !X ? v : x.text,
|
|
1251
|
+
notFound: X && x.notFound,
|
|
1252
|
+
quick: ie,
|
|
1253
|
+
stands: X
|
|
1166
1254
|
};
|
|
1167
1255
|
}
|
|
1168
|
-
var
|
|
1256
|
+
var ze = {
|
|
1169
1257
|
row: "_row_epo6h_3",
|
|
1170
1258
|
icon: "_icon_epo6h_17",
|
|
1171
1259
|
line: "_line_epo6h_24",
|
|
@@ -1173,107 +1261,112 @@ var Fe = {
|
|
|
1173
1261
|
question: "_question_epo6h_43",
|
|
1174
1262
|
actions: "_actions_epo6h_52",
|
|
1175
1263
|
enter: "_enter_epo6h_59"
|
|
1176
|
-
}
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
}
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1264
|
+
};
|
|
1265
|
+
// src/components/AskOffer.tsx
|
|
1266
|
+
function Be(e) {
|
|
1267
|
+
return e.row === "hint" ? {
|
|
1268
|
+
text: "Type a bit more to ask the assistant",
|
|
1269
|
+
action: ""
|
|
1270
|
+
} : e.row === "thinking" ? {
|
|
1271
|
+
text: "Thinking",
|
|
1272
|
+
action: ""
|
|
1273
|
+
} : e.kind === "describe" ? {
|
|
1274
|
+
text: "Let the assistant pick the best matches",
|
|
1275
|
+
action: "Explore"
|
|
1276
|
+
} : e.kind === "notFound" ? {
|
|
1277
|
+
text: "Not among these results",
|
|
1278
|
+
action: "Ask the assistant"
|
|
1279
|
+
} : {
|
|
1280
|
+
text: "Ask the assistant about this",
|
|
1281
|
+
action: "Ask the assistant"
|
|
1282
|
+
};
|
|
1283
|
+
}
|
|
1284
|
+
var Ve = ({ searchOrAsk: e, onAsk: t, words: n, className: r = "" }) => {
|
|
1285
|
+
let i = e.text.trim();
|
|
1286
|
+
if (!e.available || e.offerRow === "none" || !i) return null;
|
|
1287
|
+
let a = {
|
|
1288
|
+
row: e.offerRow,
|
|
1289
|
+
kind: e.offerKind,
|
|
1290
|
+
p: e.p,
|
|
1291
|
+
criteria: e.criteria,
|
|
1292
|
+
found: e.found,
|
|
1293
|
+
text: i
|
|
1294
|
+
}, o = {
|
|
1295
|
+
...Be(a),
|
|
1296
|
+
...He(n?.(a))
|
|
1297
|
+
}, s = () => t(i);
|
|
1189
1298
|
return /* @__PURE__ */ g("div", {
|
|
1190
|
-
className: `${
|
|
1299
|
+
className: `${ze.row} ${ze[e.offerRow]} ${r}`,
|
|
1300
|
+
"data-kind": e.offerKind ?? void 0,
|
|
1191
1301
|
"aria-live": "polite",
|
|
1192
1302
|
children: [
|
|
1193
1303
|
/* @__PURE__ */ h("span", {
|
|
1194
|
-
className:
|
|
1304
|
+
className: ze.icon,
|
|
1195
1305
|
"aria-hidden": "true",
|
|
1196
|
-
children: /* @__PURE__ */ h(
|
|
1306
|
+
children: /* @__PURE__ */ h(G, {
|
|
1197
1307
|
size: 14,
|
|
1198
1308
|
color: "currentColor"
|
|
1199
1309
|
})
|
|
1200
1310
|
}),
|
|
1201
|
-
e.
|
|
1202
|
-
className:
|
|
1203
|
-
children:
|
|
1204
|
-
}),
|
|
1205
|
-
e.quick === "hint" && /* @__PURE__ */ h("button", {
|
|
1206
|
-
type: "button",
|
|
1207
|
-
className: Fe.line,
|
|
1208
|
-
onClick: o,
|
|
1209
|
-
children: /* @__PURE__ */ h(F, { children: i.hint })
|
|
1311
|
+
e.offerRow === "thinking" && /* @__PURE__ */ h(L, {
|
|
1312
|
+
className: ze.text,
|
|
1313
|
+
children: o.text
|
|
1210
1314
|
}),
|
|
1211
|
-
e.
|
|
1315
|
+
e.offerRow === "hint" && /* @__PURE__ */ h("button", {
|
|
1212
1316
|
type: "button",
|
|
1213
|
-
className:
|
|
1214
|
-
onClick:
|
|
1215
|
-
children:
|
|
1317
|
+
className: ze.line,
|
|
1318
|
+
onClick: s,
|
|
1319
|
+
children: /* @__PURE__ */ h(L, { children: o.text })
|
|
1216
1320
|
}),
|
|
1217
|
-
e.
|
|
1218
|
-
className:
|
|
1219
|
-
children:
|
|
1321
|
+
e.offerRow === "ready" && /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("span", {
|
|
1322
|
+
className: ze.question,
|
|
1323
|
+
children: o.text
|
|
1220
1324
|
}), /* @__PURE__ */ g("span", {
|
|
1221
|
-
className:
|
|
1222
|
-
children: [/* @__PURE__ */
|
|
1223
|
-
className:
|
|
1224
|
-
children:
|
|
1225
|
-
}), /* @__PURE__ */ h(
|
|
1226
|
-
variant: "ghost",
|
|
1227
|
-
size: "micro",
|
|
1228
|
-
onClick: o,
|
|
1229
|
-
children: i.ask
|
|
1230
|
-
})]
|
|
1231
|
-
})] }),
|
|
1232
|
-
e.quick === "ready" && /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("span", {
|
|
1233
|
-
className: Fe.question,
|
|
1234
|
-
children: a
|
|
1235
|
-
}), /* @__PURE__ */ g("span", {
|
|
1236
|
-
className: Fe.actions,
|
|
1237
|
-
children: [/* @__PURE__ */ g("span", {
|
|
1238
|
-
className: Fe.enter,
|
|
1239
|
-
children: [/* @__PURE__ */ h(A, { children: "β΅" }), " to ask"]
|
|
1240
|
-
}), /* @__PURE__ */ h(S, {
|
|
1325
|
+
className: ze.actions,
|
|
1326
|
+
children: [/* @__PURE__ */ h("span", {
|
|
1327
|
+
className: ze.enter,
|
|
1328
|
+
children: /* @__PURE__ */ h(M, { children: "β΅" })
|
|
1329
|
+
}), /* @__PURE__ */ h(C, {
|
|
1241
1330
|
variant: "primary",
|
|
1242
1331
|
size: "micro",
|
|
1243
|
-
onClick:
|
|
1244
|
-
children:
|
|
1332
|
+
onClick: s,
|
|
1333
|
+
children: o.action
|
|
1245
1334
|
})]
|
|
1246
1335
|
})] })
|
|
1247
1336
|
]
|
|
1248
1337
|
});
|
|
1249
|
-
}
|
|
1338
|
+
};
|
|
1339
|
+
function He(e) {
|
|
1340
|
+
return e ? Object.fromEntries(Object.entries(e).filter(([, e]) => typeof e == "string" && e.length > 0)) : {};
|
|
1341
|
+
}
|
|
1342
|
+
var Ue = {
|
|
1250
1343
|
grid: "_grid_1xjna_2",
|
|
1251
1344
|
chip: "_chip_1xjna_21",
|
|
1252
1345
|
chipLabel: "_chipLabel_1xjna_32"
|
|
1253
|
-
},
|
|
1346
|
+
}, We = r(({ field: e, value: t, onReset: n }) => /* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(C, {
|
|
1254
1347
|
onClick: n,
|
|
1255
|
-
iconRight: /* @__PURE__ */ h(
|
|
1348
|
+
iconRight: /* @__PURE__ */ h(le, {}),
|
|
1256
1349
|
variant: "primary",
|
|
1257
1350
|
size: "micro",
|
|
1258
|
-
className:
|
|
1351
|
+
className: Ue.chip,
|
|
1259
1352
|
title: `${e}: ${t}`,
|
|
1260
1353
|
children: /* @__PURE__ */ g("span", {
|
|
1261
|
-
className:
|
|
1354
|
+
className: Ue.chipLabel,
|
|
1262
1355
|
children: [
|
|
1263
1356
|
e,
|
|
1264
1357
|
": ",
|
|
1265
1358
|
t
|
|
1266
1359
|
]
|
|
1267
1360
|
})
|
|
1268
|
-
}) })),
|
|
1361
|
+
}) })), Ge = r(({ field: e, min: t, max: n, onReset: r }) => /* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(C, {
|
|
1269
1362
|
onClick: r,
|
|
1270
|
-
iconRight: /* @__PURE__ */ h(
|
|
1363
|
+
iconRight: /* @__PURE__ */ h(le, {}),
|
|
1271
1364
|
variant: "primary",
|
|
1272
1365
|
size: "micro",
|
|
1273
|
-
className:
|
|
1366
|
+
className: Ue.chip,
|
|
1274
1367
|
title: `${e}: ${t} β ${n}`,
|
|
1275
1368
|
children: /* @__PURE__ */ g("span", {
|
|
1276
|
-
className:
|
|
1369
|
+
className: Ue.chipLabel,
|
|
1277
1370
|
children: [
|
|
1278
1371
|
e,
|
|
1279
1372
|
": ",
|
|
@@ -1282,15 +1375,15 @@ var Fe = {
|
|
|
1282
1375
|
n
|
|
1283
1376
|
]
|
|
1284
1377
|
})
|
|
1285
|
-
}) })),
|
|
1378
|
+
}) })), Ke = r(({ field: e, label: t, onReset: n }) => /* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(C, {
|
|
1286
1379
|
onClick: n,
|
|
1287
|
-
iconRight: /* @__PURE__ */ h(
|
|
1380
|
+
iconRight: /* @__PURE__ */ h(le, {}),
|
|
1288
1381
|
variant: "primary",
|
|
1289
1382
|
size: "micro",
|
|
1290
|
-
className:
|
|
1383
|
+
className: Ue.chip,
|
|
1291
1384
|
title: `${e}: ${t}`,
|
|
1292
1385
|
children: /* @__PURE__ */ g("span", {
|
|
1293
|
-
className:
|
|
1386
|
+
className: Ue.chipLabel,
|
|
1294
1387
|
children: [
|
|
1295
1388
|
e,
|
|
1296
1389
|
": ",
|
|
@@ -1298,8 +1391,8 @@ var Fe = {
|
|
|
1298
1391
|
]
|
|
1299
1392
|
})
|
|
1300
1393
|
}) }));
|
|
1301
|
-
function
|
|
1302
|
-
let { state: { filters: e, rangeFilters: t, bucketFilters: n }, resetFilters: r, resetSingleFilter: i, resetRangeFilter: a, resetBucketFilter: o } =
|
|
1394
|
+
function qe() {
|
|
1395
|
+
let { state: { filters: e, rangeFilters: t, bucketFilters: n }, resetFilters: r, resetSingleFilter: i, resetRangeFilter: a, resetBucketFilter: o } = Ce(), c = s(() => Object.entries(e).map(([e, t]) => t.map((t) => ({
|
|
1303
1396
|
field: e,
|
|
1304
1397
|
value: t
|
|
1305
1398
|
}))).flat(), [e]), l = s(() => Object.entries(t).map(([e, { min: t, max: n }]) => ({
|
|
@@ -1315,29 +1408,29 @@ function He() {
|
|
|
1315
1408
|
e,
|
|
1316
1409
|
t,
|
|
1317
1410
|
u
|
|
1318
|
-
]) ? /* @__PURE__ */ h(
|
|
1411
|
+
]) ? /* @__PURE__ */ h(A, {
|
|
1319
1412
|
collapsible: !1,
|
|
1320
1413
|
title: "Active filters",
|
|
1321
1414
|
children: /* @__PURE__ */ g("ul", {
|
|
1322
|
-
className:
|
|
1415
|
+
className: Ue.grid,
|
|
1323
1416
|
children: [
|
|
1324
|
-
c.map(({ field: e, value: t }) => /* @__PURE__ */ h(
|
|
1417
|
+
c.map(({ field: e, value: t }) => /* @__PURE__ */ h(We, {
|
|
1325
1418
|
field: e,
|
|
1326
1419
|
value: t,
|
|
1327
1420
|
onReset: () => i(e, t)
|
|
1328
1421
|
}, `${e}-${t}`)),
|
|
1329
|
-
l.map(({ field: e, min: t, max: n }) => /* @__PURE__ */ h(
|
|
1422
|
+
l.map(({ field: e, min: t, max: n }) => /* @__PURE__ */ h(Ge, {
|
|
1330
1423
|
field: e,
|
|
1331
1424
|
min: t,
|
|
1332
1425
|
max: n,
|
|
1333
1426
|
onReset: () => a(e)
|
|
1334
1427
|
}, e)),
|
|
1335
|
-
u.map(({ field: e, range: t, label: n }) => /* @__PURE__ */ h(
|
|
1428
|
+
u.map(({ field: e, range: t, label: n }) => /* @__PURE__ */ h(Ke, {
|
|
1336
1429
|
field: e,
|
|
1337
1430
|
label: n,
|
|
1338
1431
|
onReset: () => o(e, t)
|
|
1339
1432
|
}, `${e}-${t.min}-${t.max}`)),
|
|
1340
|
-
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(
|
|
1433
|
+
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(C, {
|
|
1341
1434
|
onClick: r,
|
|
1342
1435
|
size: "micro",
|
|
1343
1436
|
variant: "ghost",
|
|
@@ -1347,7 +1440,7 @@ function He() {
|
|
|
1347
1440
|
})
|
|
1348
1441
|
}) : null;
|
|
1349
1442
|
}
|
|
1350
|
-
var
|
|
1443
|
+
var Je = {
|
|
1351
1444
|
withOffer: "_withOffer_1zrln_2",
|
|
1352
1445
|
offerRow: "_offerRow_1zrln_10",
|
|
1353
1446
|
offerHint: "_offerHint_1zrln_18",
|
|
@@ -1357,165 +1450,165 @@ var Ue = {
|
|
|
1357
1450
|
offerQuick: "_offerQuick_1zrln_56",
|
|
1358
1451
|
filterChip: "_filterChip_1zrln_59",
|
|
1359
1452
|
filtersPopover: "_filtersPopover_1zrln_63"
|
|
1360
|
-
},
|
|
1361
|
-
let { state: { query:
|
|
1453
|
+
}, Ye = ({ className: t = "", autoFocus: n = !1, inputSize: r = "default", showClear: i = !0, showFocus: a = !1, showStatus: o = !0, onAsk: s, searchOrAsk: c, askOffer: l = "chip", onClear: u, onKeyDown: d, ...f }) => {
|
|
1454
|
+
let { state: { query: p, filters: m, rangeFilters: _, bucketFilters: v, results: y, isFallback: b, searchSettings: x }, setQuery: S, resetFilters: w, picks: T, showPicks: D } = Ce(), O = !!T, k = Object.values(m).reduce((e, t) => e + t.length, 0) + Object.keys(_).length + Object.values(v ?? {}).reduce((e, t) => e + t.length, 0), A = p.length > 0, j = A && !O && y !== null && y.length === 0, P = A && !O && y !== null && y.length > 0 && b === !0, I = Re({ enabled: !!s && !c }), R = c ?? I, z = R.enterAsks, B = e.useRef(null);
|
|
1362
1455
|
e.useEffect(() => {
|
|
1363
|
-
let e =
|
|
1364
|
-
s && e && e ===
|
|
1456
|
+
let e = R.answerNow;
|
|
1457
|
+
s && e && e === p.trim() && B.current !== e && (B.current = e, s(e, { proactive: !0 }));
|
|
1365
1458
|
}, [
|
|
1366
|
-
|
|
1367
|
-
|
|
1459
|
+
R.answerNow,
|
|
1460
|
+
p,
|
|
1368
1461
|
s
|
|
1369
1462
|
]);
|
|
1370
|
-
let V =
|
|
1371
|
-
|
|
1463
|
+
let V = B.current !== null && B.current === p.trim(), H = l === "below" ? "door" : l, W = !s || !A || V || H === "none" ? "none" : H === "chip" && R.offerRow !== "none" ? R.offerRow : R.door ? "door" : "none", K = R.available && x.placeholderText === "Type to search" ? "Search or ask" : x.placeholderText, ee = (e) => {
|
|
1464
|
+
d?.(e), !e.defaultPrevented && e.key === "Enter" && s && z && p.trim() && (e.preventDefault(), Z());
|
|
1372
1465
|
}, [q, te] = e.useState(!1);
|
|
1373
1466
|
e.useEffect(() => {
|
|
1374
|
-
|
|
1375
|
-
}, [
|
|
1376
|
-
let
|
|
1377
|
-
|
|
1378
|
-
},
|
|
1379
|
-
|
|
1380
|
-
},
|
|
1467
|
+
k === 0 && te(!1);
|
|
1468
|
+
}, [k]);
|
|
1469
|
+
let J = () => {
|
|
1470
|
+
D?.(null), S(""), k > 0 && w(), u?.();
|
|
1471
|
+
}, Z = () => {
|
|
1472
|
+
B.current = p.trim(), s(p.trim());
|
|
1473
|
+
}, ne = /* @__PURE__ */ g(F, {
|
|
1381
1474
|
type: "text",
|
|
1382
|
-
value:
|
|
1383
|
-
onChange: (e) =>
|
|
1384
|
-
placeholder:
|
|
1475
|
+
value: p,
|
|
1476
|
+
onChange: (e) => S(e.target.value),
|
|
1477
|
+
placeholder: K,
|
|
1385
1478
|
autoFocus: n,
|
|
1386
1479
|
className: t,
|
|
1387
1480
|
showSearchIcon: !0,
|
|
1388
1481
|
inputSize: r,
|
|
1389
1482
|
showFocusBorder: a,
|
|
1390
1483
|
clearable: !1,
|
|
1391
|
-
onKeyDown:
|
|
1392
|
-
...
|
|
1484
|
+
onKeyDown: ee,
|
|
1485
|
+
...f,
|
|
1393
1486
|
children: [
|
|
1394
|
-
|
|
1395
|
-
className:
|
|
1487
|
+
W === "thinking" && /* @__PURE__ */ g("span", {
|
|
1488
|
+
className: Je.thinking,
|
|
1396
1489
|
"aria-live": "polite",
|
|
1397
|
-
children: [/* @__PURE__ */ h(
|
|
1490
|
+
children: [/* @__PURE__ */ h(G, {}), /* @__PURE__ */ h(L, { children: "Thinking" })]
|
|
1398
1491
|
}),
|
|
1399
|
-
|
|
1400
|
-
variant:
|
|
1401
|
-
className:
|
|
1492
|
+
(W === "door" || W === "hint" || W === "ready") && /* @__PURE__ */ h(C, {
|
|
1493
|
+
variant: W === "ready" ? "primary" : "ghost",
|
|
1494
|
+
className: W === "ready" ? Je.askStrong : void 0,
|
|
1402
1495
|
size: "micro",
|
|
1403
|
-
iconLeft: /* @__PURE__ */ h(
|
|
1404
|
-
iconRight:
|
|
1405
|
-
onClick:
|
|
1406
|
-
title:
|
|
1407
|
-
children:
|
|
1496
|
+
iconLeft: /* @__PURE__ */ h(G, {}),
|
|
1497
|
+
iconRight: W === "ready" ? /* @__PURE__ */ h(M, { children: "Enter β΅" }) : void 0,
|
|
1498
|
+
onClick: Z,
|
|
1499
|
+
title: z ? "Enter asks" : "Ask the assistant",
|
|
1500
|
+
children: W === "hint" ? /* @__PURE__ */ h(L, { children: "Type a bit more to ask" }) : W === "ready" && R.offerKind === "describe" ? "Explore" : "Ask"
|
|
1408
1501
|
}),
|
|
1409
|
-
o &&
|
|
1410
|
-
o && P && /* @__PURE__ */ h(
|
|
1502
|
+
o && j && /* @__PURE__ */ h(E, { children: "No results" }),
|
|
1503
|
+
o && P && /* @__PURE__ */ h(U, {
|
|
1411
1504
|
content: "No direct match. Showing the nearest results.",
|
|
1412
|
-
children: /* @__PURE__ */ h("span", { children: /* @__PURE__ */ h(
|
|
1413
|
-
icon: /* @__PURE__ */ h(
|
|
1505
|
+
children: /* @__PURE__ */ h("span", { children: /* @__PURE__ */ h(E, {
|
|
1506
|
+
icon: /* @__PURE__ */ h(X, {}),
|
|
1414
1507
|
children: "Nearest"
|
|
1415
1508
|
}) })
|
|
1416
1509
|
}),
|
|
1417
|
-
o &&
|
|
1510
|
+
o && k > 0 && /* @__PURE__ */ h(N, {
|
|
1418
1511
|
open: q,
|
|
1419
1512
|
onOpenChange: te,
|
|
1420
1513
|
align: "end",
|
|
1421
1514
|
sideOffset: 6,
|
|
1422
|
-
className:
|
|
1515
|
+
className: Je.filtersPopover,
|
|
1423
1516
|
"aria-label": "Active filters",
|
|
1424
|
-
trigger: /* @__PURE__ */ h(
|
|
1517
|
+
trigger: /* @__PURE__ */ h(C, {
|
|
1425
1518
|
variant: "ghost",
|
|
1426
1519
|
size: "micro",
|
|
1427
|
-
className:
|
|
1428
|
-
"aria-label": `${
|
|
1429
|
-
title: `${
|
|
1430
|
-
children: /* @__PURE__ */ h(
|
|
1431
|
-
icon: /* @__PURE__ */ h(
|
|
1520
|
+
className: Je.filterChip,
|
|
1521
|
+
"aria-label": `${k} filter${k === 1 ? "" : "s"} active: show them`,
|
|
1522
|
+
title: `${k} filter${k === 1 ? "" : "s"} active`,
|
|
1523
|
+
children: /* @__PURE__ */ h(E, {
|
|
1524
|
+
icon: /* @__PURE__ */ h(Y, {}),
|
|
1432
1525
|
color: "var(--CLightBlue)",
|
|
1433
1526
|
textColor: "#080809",
|
|
1434
|
-
children:
|
|
1527
|
+
children: k
|
|
1435
1528
|
})
|
|
1436
1529
|
}),
|
|
1437
|
-
children: /* @__PURE__ */ h(
|
|
1530
|
+
children: /* @__PURE__ */ h(qe, {})
|
|
1438
1531
|
}),
|
|
1439
|
-
i && (
|
|
1532
|
+
i && (A || k > 0) && /* @__PURE__ */ h(C, {
|
|
1440
1533
|
variant: "ghost",
|
|
1441
1534
|
size: "micro",
|
|
1442
|
-
onClick:
|
|
1443
|
-
"aria-label":
|
|
1535
|
+
onClick: J,
|
|
1536
|
+
"aria-label": k > 0 ? "Clear search and filters" : "Clear search",
|
|
1444
1537
|
children: "Clear"
|
|
1445
1538
|
})
|
|
1446
1539
|
]
|
|
1447
1540
|
});
|
|
1448
|
-
return l !== "below" || !s || !
|
|
1449
|
-
className:
|
|
1450
|
-
children: [
|
|
1451
|
-
className:
|
|
1452
|
-
children: !V && /* @__PURE__ */ h(
|
|
1453
|
-
searchOrAsk:
|
|
1454
|
-
onAsk:
|
|
1455
|
-
className:
|
|
1541
|
+
return l !== "below" || !s || !R.available ? ne : /* @__PURE__ */ g("div", {
|
|
1542
|
+
className: Je.withOffer,
|
|
1543
|
+
children: [ne, /* @__PURE__ */ h("div", {
|
|
1544
|
+
className: Je.offerRow,
|
|
1545
|
+
children: !V && /* @__PURE__ */ h(Ve, {
|
|
1546
|
+
searchOrAsk: R,
|
|
1547
|
+
onAsk: Z,
|
|
1548
|
+
className: Je.offerQuick
|
|
1456
1549
|
})
|
|
1457
1550
|
})]
|
|
1458
1551
|
});
|
|
1459
|
-
},
|
|
1552
|
+
}, Xe = {
|
|
1460
1553
|
message: "_message_1mgfk_1",
|
|
1461
1554
|
icon: "_icon_1mgfk_10",
|
|
1462
1555
|
title: "_title_1mgfk_15",
|
|
1463
1556
|
detail: "_detail_1mgfk_20",
|
|
1464
1557
|
technical: "_technical_1mgfk_25",
|
|
1465
1558
|
button: "_button_1mgfk_33"
|
|
1466
|
-
},
|
|
1559
|
+
}, Ze = {
|
|
1467
1560
|
unreachable: {
|
|
1468
|
-
icon:
|
|
1561
|
+
icon: te,
|
|
1469
1562
|
title: "Search is unavailable",
|
|
1470
1563
|
detail: "The search server canβt be reached right now."
|
|
1471
1564
|
},
|
|
1472
1565
|
unauthorized: {
|
|
1473
|
-
icon:
|
|
1566
|
+
icon: re,
|
|
1474
1567
|
title: "Search is unavailable",
|
|
1475
1568
|
detail: "The search key was not accepted."
|
|
1476
1569
|
},
|
|
1477
1570
|
forbidden: {
|
|
1478
|
-
icon:
|
|
1571
|
+
icon: ie,
|
|
1479
1572
|
title: "Search is unavailable",
|
|
1480
1573
|
detail: "This search key doesnβt have access to these results."
|
|
1481
1574
|
},
|
|
1482
1575
|
notFound: {
|
|
1483
|
-
icon:
|
|
1576
|
+
icon: ae,
|
|
1484
1577
|
title: "Nothing to search here",
|
|
1485
1578
|
detail: "The collection this page searches doesnβt exist."
|
|
1486
1579
|
},
|
|
1487
1580
|
notReady: {
|
|
1488
|
-
icon:
|
|
1581
|
+
icon: Z,
|
|
1489
1582
|
title: "Search is getting ready",
|
|
1490
1583
|
detail: "Results will appear in a moment."
|
|
1491
1584
|
},
|
|
1492
1585
|
unavailable: {
|
|
1493
|
-
icon:
|
|
1586
|
+
icon: ce,
|
|
1494
1587
|
title: "Search is unavailable",
|
|
1495
1588
|
detail: "The collection canβt be searched right now."
|
|
1496
1589
|
},
|
|
1497
1590
|
rateLimited: {
|
|
1498
|
-
icon:
|
|
1591
|
+
icon: se,
|
|
1499
1592
|
title: "Too many searches",
|
|
1500
1593
|
detail: "Wait a moment, then try again."
|
|
1501
1594
|
},
|
|
1502
1595
|
server: {
|
|
1503
|
-
icon:
|
|
1596
|
+
icon: ce,
|
|
1504
1597
|
title: "Something went wrong",
|
|
1505
1598
|
detail: "The search server ran into a problem."
|
|
1506
1599
|
},
|
|
1507
1600
|
setup: {
|
|
1508
|
-
icon:
|
|
1601
|
+
icon: ce,
|
|
1509
1602
|
title: "Search isnβt set up",
|
|
1510
1603
|
detail: "This page is missing part of its search setup."
|
|
1511
1604
|
},
|
|
1512
1605
|
unknown: {
|
|
1513
|
-
icon:
|
|
1606
|
+
icon: ce,
|
|
1514
1607
|
title: "Something went wrong",
|
|
1515
1608
|
detail: "The search couldnβt be completed."
|
|
1516
1609
|
}
|
|
1517
|
-
},
|
|
1518
|
-
let { icon: r, title: i, detail: a } =
|
|
1610
|
+
}, Qe = ({ error: e, onRetry: t, hideTechnical: n = !1 }) => {
|
|
1611
|
+
let { icon: r, title: i, detail: a } = Ze[e.kind];
|
|
1519
1612
|
o(() => {
|
|
1520
1613
|
if (e.kind !== "notReady" || !t) return;
|
|
1521
1614
|
let n = setTimeout(t, (e.retryAfterSeconds ?? 2) * 1e3);
|
|
@@ -1523,38 +1616,38 @@ var Ue = {
|
|
|
1523
1616
|
}, [e, t]);
|
|
1524
1617
|
let s = e.retryable && e.kind !== "notReady" && t;
|
|
1525
1618
|
return /* @__PURE__ */ g("div", {
|
|
1526
|
-
className:
|
|
1619
|
+
className: Xe.message,
|
|
1527
1620
|
role: "alert",
|
|
1528
1621
|
children: [
|
|
1529
1622
|
/* @__PURE__ */ h("span", {
|
|
1530
|
-
className:
|
|
1623
|
+
className: Xe.icon,
|
|
1531
1624
|
children: /* @__PURE__ */ h(r, {
|
|
1532
1625
|
size: 70,
|
|
1533
1626
|
color: "var(--lv4)"
|
|
1534
1627
|
})
|
|
1535
1628
|
}),
|
|
1536
1629
|
/* @__PURE__ */ h("div", {
|
|
1537
|
-
className:
|
|
1630
|
+
className: Xe.title,
|
|
1538
1631
|
children: i
|
|
1539
1632
|
}),
|
|
1540
1633
|
/* @__PURE__ */ h("div", {
|
|
1541
|
-
className:
|
|
1634
|
+
className: Xe.detail,
|
|
1542
1635
|
children: a
|
|
1543
1636
|
}),
|
|
1544
1637
|
!n && /* @__PURE__ */ h("code", {
|
|
1545
|
-
className:
|
|
1638
|
+
className: Xe.technical,
|
|
1546
1639
|
children: e.technical
|
|
1547
1640
|
}),
|
|
1548
|
-
s && /* @__PURE__ */ h(
|
|
1641
|
+
s && /* @__PURE__ */ h(C, {
|
|
1549
1642
|
variant: "secondary",
|
|
1550
1643
|
size: "micro",
|
|
1551
|
-
className:
|
|
1644
|
+
className: Xe.button,
|
|
1552
1645
|
onClick: t,
|
|
1553
1646
|
children: "Try again"
|
|
1554
1647
|
})
|
|
1555
1648
|
]
|
|
1556
1649
|
});
|
|
1557
|
-
},
|
|
1650
|
+
}, $e = {
|
|
1558
1651
|
placeholder: "_placeholder_1m5kj_1",
|
|
1559
1652
|
invalid: "_invalid_1m5kj_11",
|
|
1560
1653
|
searchedFor: "_searchedFor_1m5kj_17",
|
|
@@ -1565,30 +1658,30 @@ var Ue = {
|
|
|
1565
1658
|
picksCount: "_picksCount_1m5kj_27",
|
|
1566
1659
|
picksSpacer: "_picksSpacer_1m5kj_28",
|
|
1567
1660
|
why: "_why_1m5kj_29"
|
|
1568
|
-
},
|
|
1661
|
+
}, et = {
|
|
1569
1662
|
row: "_row_11svi_1",
|
|
1570
1663
|
content: "_content_11svi_22",
|
|
1571
1664
|
indexNumber: "_indexNumber_11svi_36",
|
|
1572
1665
|
scoreNumber: "_scoreNumber_11svi_44",
|
|
1573
1666
|
skeletonBars: "_skeletonBars_11svi_53"
|
|
1574
|
-
},
|
|
1575
|
-
className:
|
|
1667
|
+
}, tt = ({ skeleton: e = !1, index: t, score: n, showScore: r = !1, children: i, skeletonDelay: a = 0, skeletonWidths: o = [62, 38] }) => /* @__PURE__ */ g("div", {
|
|
1668
|
+
className: et.row,
|
|
1576
1669
|
children: [
|
|
1577
1670
|
t !== void 0 && /* @__PURE__ */ h("div", {
|
|
1578
|
-
className:
|
|
1671
|
+
className: et.indexNumber,
|
|
1579
1672
|
children: t
|
|
1580
1673
|
}),
|
|
1581
1674
|
/* @__PURE__ */ h("div", {
|
|
1582
|
-
className:
|
|
1675
|
+
className: et.content,
|
|
1583
1676
|
children: e ? /* @__PURE__ */ g("div", {
|
|
1584
|
-
className:
|
|
1585
|
-
children: [/* @__PURE__ */ h(
|
|
1677
|
+
className: et.skeletonBars,
|
|
1678
|
+
children: [/* @__PURE__ */ h(R, {
|
|
1586
1679
|
level: 3,
|
|
1587
1680
|
height: 12,
|
|
1588
1681
|
width: `${o[0]}%`,
|
|
1589
1682
|
delay: a,
|
|
1590
1683
|
appear: !1
|
|
1591
|
-
}), /* @__PURE__ */ h(
|
|
1684
|
+
}), /* @__PURE__ */ h(R, {
|
|
1592
1685
|
level: 3,
|
|
1593
1686
|
height: 8,
|
|
1594
1687
|
width: `${o[1]}%`,
|
|
@@ -1598,14 +1691,14 @@ var Ue = {
|
|
|
1598
1691
|
}) : i
|
|
1599
1692
|
}),
|
|
1600
1693
|
r && n !== void 0 && /* @__PURE__ */ h("div", {
|
|
1601
|
-
className:
|
|
1694
|
+
className: et.scoreNumber,
|
|
1602
1695
|
children: n
|
|
1603
1696
|
})
|
|
1604
1697
|
]
|
|
1605
|
-
}),
|
|
1698
|
+
}), nt = {
|
|
1606
1699
|
wrapper: "_wrapper_f970z_6",
|
|
1607
1700
|
skeletonAppear: "_skeletonAppear_f970z_1"
|
|
1608
|
-
},
|
|
1701
|
+
}, rt = [
|
|
1609
1702
|
[62, 38],
|
|
1610
1703
|
[75, 45],
|
|
1611
1704
|
[58, 33],
|
|
@@ -1614,23 +1707,23 @@ var Ue = {
|
|
|
1614
1707
|
[55, 35],
|
|
1615
1708
|
[72, 40],
|
|
1616
1709
|
[60, 30]
|
|
1617
|
-
],
|
|
1618
|
-
className:
|
|
1619
|
-
children: Array.from({ length: e }).map((e, t) => /* @__PURE__ */ h(
|
|
1710
|
+
], it = ({ rows: e = 6 }) => /* @__PURE__ */ h("div", {
|
|
1711
|
+
className: nt.wrapper,
|
|
1712
|
+
children: Array.from({ length: e }).map((e, t) => /* @__PURE__ */ h(tt, {
|
|
1620
1713
|
skeleton: !0,
|
|
1621
1714
|
skeletonDelay: t * .1,
|
|
1622
|
-
skeletonWidths:
|
|
1715
|
+
skeletonWidths: rt[t % rt.length]
|
|
1623
1716
|
}, t))
|
|
1624
1717
|
});
|
|
1625
1718
|
// src/hooks/useFilterSuggestion.ts
|
|
1626
|
-
function
|
|
1719
|
+
function at(e) {
|
|
1627
1720
|
let t = e.trim().toLowerCase();
|
|
1628
1721
|
return t === "true" || t === "false" || t !== "" && !Number.isNaN(Number(t));
|
|
1629
1722
|
}
|
|
1630
|
-
function
|
|
1723
|
+
function ot(e, t) {
|
|
1631
1724
|
if (!t) return null;
|
|
1632
1725
|
let n = [];
|
|
1633
|
-
for (let [e, r] of Object.entries(t)) for (let t of r ?? []) t?.key && t.key.trim().length >= 2 && !
|
|
1726
|
+
for (let [e, r] of Object.entries(t)) for (let t of r ?? []) t?.key && t.key.trim().length >= 2 && !at(t.key) && n.push({
|
|
1634
1727
|
field: e,
|
|
1635
1728
|
value: t.key
|
|
1636
1729
|
});
|
|
@@ -1649,14 +1742,14 @@ function tt(e, t) {
|
|
|
1649
1742
|
sort: null
|
|
1650
1743
|
};
|
|
1651
1744
|
}
|
|
1652
|
-
function
|
|
1653
|
-
let t =
|
|
1745
|
+
function st(e = {}) {
|
|
1746
|
+
let t = Ce(), { url: n, team: r, dataset: a, authenticatedFetch: s, setQuery: u, toggleFilter: d, setRangeFilter: f, setSort: p } = t, { auto: m } = e, h = c(t);
|
|
1654
1747
|
h.current = t;
|
|
1655
1748
|
let [g, _] = l(null), [v, y] = l(""), [b, x] = l(!1), S = c(0), C = i(async (e) => {
|
|
1656
1749
|
let t = ++S.current;
|
|
1657
1750
|
x(!0);
|
|
1658
1751
|
try {
|
|
1659
|
-
let i = await s(`${n}/api/teams/${r}/datasets/${a}/search-or-ask/filters${
|
|
1752
|
+
let i = await s(`${n}/api/teams/${r}/datasets/${a}/search-or-ask/filters${Pe(h.current)}`, {
|
|
1660
1753
|
method: "POST",
|
|
1661
1754
|
headers: { "Content-Type": "application/json" },
|
|
1662
1755
|
body: JSON.stringify({ text: e })
|
|
@@ -1695,7 +1788,7 @@ function nt(e = {}) {
|
|
|
1695
1788
|
return o(() => {
|
|
1696
1789
|
if (!A || !j || P || E.current.has(j)) return;
|
|
1697
1790
|
E.current.add(j);
|
|
1698
|
-
let e =
|
|
1791
|
+
let e = ot(j, N);
|
|
1699
1792
|
if (e && (E.current.add(e.text), w(e), O(j)), k !== "model") return;
|
|
1700
1793
|
let t = e ? e.text : j;
|
|
1701
1794
|
if (!t) return;
|
|
@@ -1704,7 +1797,7 @@ function nt(e = {}) {
|
|
|
1704
1797
|
let o = ++S.current;
|
|
1705
1798
|
x(!0);
|
|
1706
1799
|
try {
|
|
1707
|
-
let c = await s(`${n}/api/teams/${r}/datasets/${a}/search-or-ask/filters${
|
|
1800
|
+
let c = await s(`${n}/api/teams/${r}/datasets/${a}/search-or-ask/filters${Pe(h.current)}`, {
|
|
1708
1801
|
method: "POST",
|
|
1709
1802
|
headers: { "Content-Type": "application/json" },
|
|
1710
1803
|
body: JSON.stringify({ text: t })
|
|
@@ -1742,20 +1835,20 @@ function nt(e = {}) {
|
|
|
1742
1835
|
};
|
|
1743
1836
|
}
|
|
1744
1837
|
// src/components/SearchResults.tsx
|
|
1745
|
-
var
|
|
1746
|
-
function
|
|
1838
|
+
var ct = /^\[\s*(?:'[^']*'(?:\s*,\s*'[^']*')*)?\s*\]$/;
|
|
1839
|
+
function lt(e) {
|
|
1747
1840
|
let t = e.trim();
|
|
1748
1841
|
if (!t.startsWith("[") || !t.endsWith("]")) return;
|
|
1749
1842
|
try {
|
|
1750
1843
|
let e = JSON.parse(t);
|
|
1751
1844
|
if (Array.isArray(e)) return e.map((e) => String(e));
|
|
1752
1845
|
} catch {}
|
|
1753
|
-
if (!
|
|
1846
|
+
if (!ct.test(t)) return;
|
|
1754
1847
|
let n = [], r = /'([^']*)'/g, i;
|
|
1755
1848
|
for (; (i = r.exec(t)) !== null;) n.push(i[1]);
|
|
1756
1849
|
return n;
|
|
1757
1850
|
}
|
|
1758
|
-
function
|
|
1851
|
+
function ut(e, t, n) {
|
|
1759
1852
|
let r;
|
|
1760
1853
|
try {
|
|
1761
1854
|
r = typeof e == "string" ? JSON.parse(e) : e;
|
|
@@ -1770,14 +1863,14 @@ function at(e, t, n) {
|
|
|
1770
1863
|
if (n) for (let e in i) {
|
|
1771
1864
|
let t = i[e];
|
|
1772
1865
|
if (typeof t == "string") {
|
|
1773
|
-
let n =
|
|
1866
|
+
let n = lt(t);
|
|
1774
1867
|
n && (i[e] = n);
|
|
1775
1868
|
}
|
|
1776
1869
|
}
|
|
1777
1870
|
return i;
|
|
1778
1871
|
}
|
|
1779
|
-
var
|
|
1780
|
-
let { url: s, team: c, dataset: u, authenticatedFetch: d, count: f } =
|
|
1872
|
+
var dt = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i, children: a }) => {
|
|
1873
|
+
let { url: s, team: c, dataset: u, authenticatedFetch: d, count: f } = Ce(), [p, _] = l(null);
|
|
1781
1874
|
o(() => {
|
|
1782
1875
|
let t = !1;
|
|
1783
1876
|
_(null);
|
|
@@ -1818,30 +1911,30 @@ var ot = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
1818
1911
|
} catch {}
|
|
1819
1912
|
}, y = e.search;
|
|
1820
1913
|
return /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ g("div", {
|
|
1821
|
-
className:
|
|
1914
|
+
className: $e.picksHead,
|
|
1822
1915
|
children: [
|
|
1823
1916
|
/* @__PURE__ */ g("span", {
|
|
1824
|
-
className:
|
|
1825
|
-
children: [/* @__PURE__ */ h(
|
|
1917
|
+
className: $e.picksTitle,
|
|
1918
|
+
children: [/* @__PURE__ */ h(G, {
|
|
1826
1919
|
size: 14,
|
|
1827
1920
|
color: "currentColor"
|
|
1828
1921
|
}), r]
|
|
1829
1922
|
}),
|
|
1830
1923
|
/* @__PURE__ */ h("span", {
|
|
1831
|
-
className:
|
|
1924
|
+
className: $e.picksCount,
|
|
1832
1925
|
children: e.picks.length
|
|
1833
1926
|
}),
|
|
1834
|
-
/* @__PURE__ */ h("span", { className:
|
|
1835
|
-
i && /* @__PURE__ */ h(
|
|
1927
|
+
/* @__PURE__ */ h("span", { className: $e.picksSpacer }),
|
|
1928
|
+
i && /* @__PURE__ */ h(C, {
|
|
1836
1929
|
variant: "ghost",
|
|
1837
1930
|
size: "micro",
|
|
1838
1931
|
onClick: i,
|
|
1839
1932
|
children: y ? `Show all ${y.found}${y.more ? "+" : ""} found` : "Show the search instead"
|
|
1840
1933
|
})
|
|
1841
1934
|
]
|
|
1842
|
-
}), p === null ? /* @__PURE__ */ h(
|
|
1843
|
-
let r = p.get(e.documentKey), i = r == null ? null :
|
|
1844
|
-
return i ? /* @__PURE__ */ g(
|
|
1935
|
+
}), p === null ? /* @__PURE__ */ h(it, { rows: Math.max(1, e.picks.length) }) : /* @__PURE__ */ h("div", { children: e.picks.map((e) => {
|
|
1936
|
+
let r = p.get(e.documentKey), i = r == null ? null : ut(r, t, n);
|
|
1937
|
+
return i ? /* @__PURE__ */ g(tt, {
|
|
1845
1938
|
index: e.n,
|
|
1846
1939
|
showScore: !1,
|
|
1847
1940
|
children: [a(i, {
|
|
@@ -1853,16 +1946,16 @@ var ot = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
1853
1946
|
},
|
|
1854
1947
|
select: v(e.documentKey, e.n)
|
|
1855
1948
|
}), e.why && /* @__PURE__ */ g("div", {
|
|
1856
|
-
className:
|
|
1857
|
-
children: [/* @__PURE__ */ h(
|
|
1949
|
+
className: $e.why,
|
|
1950
|
+
children: [/* @__PURE__ */ h(G, {
|
|
1858
1951
|
size: 12,
|
|
1859
1952
|
color: "currentColor"
|
|
1860
1953
|
}), /* @__PURE__ */ h("span", { children: e.why })]
|
|
1861
1954
|
})]
|
|
1862
1955
|
}, e.documentKey) : null;
|
|
1863
1956
|
}) })] });
|
|
1864
|
-
},
|
|
1865
|
-
let { state: { results: p, resultsSuppressed: _, searchSettings: v, countedTotal: y, query: b, error: x, errorInfo:
|
|
1957
|
+
}, ft = ({ fields: e, resultsPerPage: t, parseArrayStrings: n = !1, searchOrAsk: r, notFoundLabel: i = "These results may not hold what you are asking about", picks: a, onShowSearch: s, picksLabel: u = "Picked by the assistant", showScore: d, children: f }) => {
|
|
1958
|
+
let { state: { results: p, resultsSuppressed: _, searchSettings: v, countedTotal: y, query: b, error: x, errorInfo: S }, isFetchingInitial: w, authError: T, authErrorInfo: E, retry: D, allowEmptySearch: O, fetchMoreResults: k, selectResult: A, searchText: j, searchAsTyped: M, picks: N, showPicks: P } = Ce(), { apply: F } = st(), I = a === void 0 ? N : a, L = s ?? (() => {
|
|
1866
1959
|
I?.search && F(I.search), P?.(null);
|
|
1867
1960
|
}), R = c(null);
|
|
1868
1961
|
I && R.current?.picks !== I && (R.current = {
|
|
@@ -1878,11 +1971,11 @@ var ot = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
1878
1971
|
B,
|
|
1879
1972
|
b
|
|
1880
1973
|
]);
|
|
1881
|
-
let G = p ?? [], K = !!r?.notFound, ee = j != null && j.trim() !== b.trim() ? j : null, q = !!p && p.length >= v.maxNumberOfRecordsToReturn && (y === void 0 || y > p.length),
|
|
1974
|
+
let G = p ?? [], K = !!r?.notFound, ee = j != null && j.trim() !== b.trim() ? j : null, q = !!p && p.length >= v.maxNumberOfRecordsToReturn && (y === void 0 || y > p.length), te = !!p && (G.length > V || q), J = () => {
|
|
1882
1975
|
let e = V + B;
|
|
1883
1976
|
H(e), p && e >= p.length && q && k(p.length + B);
|
|
1884
1977
|
};
|
|
1885
|
-
if (I && z && !w && !T) return /* @__PURE__ */ h(
|
|
1978
|
+
if (I && z && !w && !T) return /* @__PURE__ */ h(dt, {
|
|
1886
1979
|
picks: I,
|
|
1887
1980
|
fields: e,
|
|
1888
1981
|
parseArrayStrings: n,
|
|
@@ -1890,16 +1983,16 @@ var ot = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
1890
1983
|
onShowSearch: L,
|
|
1891
1984
|
children: f
|
|
1892
1985
|
});
|
|
1893
|
-
if (w) return O ? /* @__PURE__ */ h(
|
|
1894
|
-
className:
|
|
1895
|
-
children: /* @__PURE__ */ h(
|
|
1986
|
+
if (w) return O ? /* @__PURE__ */ h(it, { rows: B }) : /* @__PURE__ */ h("div", {
|
|
1987
|
+
className: $e.placeholder,
|
|
1988
|
+
children: /* @__PURE__ */ h(ne, {
|
|
1896
1989
|
size: 200,
|
|
1897
1990
|
color: "var(--lv5)"
|
|
1898
1991
|
})
|
|
1899
1992
|
});
|
|
1900
1993
|
let Y = T ?? x;
|
|
1901
|
-
return Y ? /* @__PURE__ */ h(
|
|
1902
|
-
error: (T ? E :
|
|
1994
|
+
return Y ? /* @__PURE__ */ h(Qe, {
|
|
1995
|
+
error: (T ? E : S) ?? {
|
|
1903
1996
|
kind: "unknown",
|
|
1904
1997
|
message: Y,
|
|
1905
1998
|
technical: Y,
|
|
@@ -1907,16 +2000,16 @@ var ot = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
1907
2000
|
},
|
|
1908
2001
|
onRetry: D
|
|
1909
2002
|
}) : _ || p === null ? /* @__PURE__ */ h("div", {
|
|
1910
|
-
className:
|
|
1911
|
-
children: /* @__PURE__ */ h(
|
|
2003
|
+
className: $e.placeholder,
|
|
2004
|
+
children: /* @__PURE__ */ h(ne, {
|
|
1912
2005
|
size: 200,
|
|
1913
2006
|
color: "var(--lv5)"
|
|
1914
2007
|
})
|
|
1915
2008
|
}) : G.length === 0 ? null : /* @__PURE__ */ g(m, { children: [
|
|
1916
2009
|
ee && /* @__PURE__ */ g("div", {
|
|
1917
|
-
className:
|
|
2010
|
+
className: $e.searchedFor,
|
|
1918
2011
|
"aria-live": "polite",
|
|
1919
|
-
children: [/* @__PURE__ */ g("span", { children: ["Searching for ", /* @__PURE__ */ h("strong", { children: ee })] }), M && /* @__PURE__ */ h(
|
|
2012
|
+
children: [/* @__PURE__ */ g("span", { children: ["Searching for ", /* @__PURE__ */ h("strong", { children: ee })] }), M && /* @__PURE__ */ h(C, {
|
|
1920
2013
|
variant: "ghost",
|
|
1921
2014
|
size: "micro",
|
|
1922
2015
|
onClick: M,
|
|
@@ -1924,15 +2017,15 @@ var ot = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
1924
2017
|
})]
|
|
1925
2018
|
}),
|
|
1926
2019
|
K && /* @__PURE__ */ h("p", {
|
|
1927
|
-
className:
|
|
2020
|
+
className: $e.notFound,
|
|
1928
2021
|
"aria-live": "polite",
|
|
1929
2022
|
children: i
|
|
1930
2023
|
}),
|
|
1931
2024
|
/* @__PURE__ */ h("div", {
|
|
1932
|
-
className: K ?
|
|
2025
|
+
className: K ? $e.dimmed : void 0,
|
|
1933
2026
|
children: G.slice(0, V).map((t, r) => {
|
|
1934
|
-
let i = t.score, a =
|
|
1935
|
-
return a ? /* @__PURE__ */ h(
|
|
2027
|
+
let i = t.score, a = ut(t.document, e, n);
|
|
2028
|
+
return a ? /* @__PURE__ */ h(tt, {
|
|
1936
2029
|
index: r,
|
|
1937
2030
|
score: i,
|
|
1938
2031
|
showScore: d ?? v.showScore,
|
|
@@ -1941,17 +2034,17 @@ var ot = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
1941
2034
|
select: () => A?.(t) ?? Promise.resolve()
|
|
1942
2035
|
})
|
|
1943
2036
|
}, r) : /* @__PURE__ */ h("div", {
|
|
1944
|
-
className:
|
|
2037
|
+
className: $e.invalid,
|
|
1945
2038
|
children: /* @__PURE__ */ h("p", { children: "Invalid JSON" })
|
|
1946
2039
|
}, r);
|
|
1947
2040
|
})
|
|
1948
2041
|
}),
|
|
1949
|
-
|
|
2042
|
+
te && /* @__PURE__ */ h("div", {
|
|
1950
2043
|
style: {
|
|
1951
2044
|
textAlign: "center",
|
|
1952
2045
|
marginTop: "20px"
|
|
1953
2046
|
},
|
|
1954
|
-
children: /* @__PURE__ */ h(
|
|
2047
|
+
children: /* @__PURE__ */ h(C, {
|
|
1955
2048
|
variant: "secondary",
|
|
1956
2049
|
size: "micro",
|
|
1957
2050
|
onClick: J,
|
|
@@ -1959,18 +2052,18 @@ var ot = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
1959
2052
|
})
|
|
1960
2053
|
})
|
|
1961
2054
|
] });
|
|
1962
|
-
},
|
|
2055
|
+
}, pt = {
|
|
1963
2056
|
row: "_row_ujwhc_1",
|
|
1964
2057
|
title: "_title_ujwhc_8"
|
|
1965
|
-
},
|
|
1966
|
-
className: [
|
|
2058
|
+
}, mt = ({ variant: e = "default", children: t }) => /* @__PURE__ */ h("div", {
|
|
2059
|
+
className: [pt.row, e === "title" ? pt.title : ""].filter(Boolean).join(" "),
|
|
1967
2060
|
children: t
|
|
1968
|
-
}),
|
|
2061
|
+
}), ht = {
|
|
1969
2062
|
listRows: "_listRows_13obt_2",
|
|
1970
2063
|
sliderArea: "_sliderArea_13obt_8",
|
|
1971
2064
|
inputRow: "_inputRow_13obt_15",
|
|
1972
2065
|
histogramRow: "_histogramRow_13obt_22"
|
|
1973
|
-
},
|
|
2066
|
+
}, gt = [
|
|
1974
2067
|
65,
|
|
1975
2068
|
80,
|
|
1976
2069
|
55,
|
|
@@ -1979,22 +2072,22 @@ var ot = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
1979
2072
|
75,
|
|
1980
2073
|
50,
|
|
1981
2074
|
68
|
|
1982
|
-
],
|
|
2075
|
+
], _t = ({ title: e, rows: t = 5, variant: n = "list", withHistogram: r = !1, collapsible: i = !0, startCollapsed: a = !1 }) => /* @__PURE__ */ h(A, {
|
|
1983
2076
|
title: e,
|
|
1984
2077
|
collapsible: i,
|
|
1985
2078
|
collapsed: a,
|
|
1986
2079
|
children: n === "slider" ? /* @__PURE__ */ g("div", {
|
|
1987
|
-
className:
|
|
2080
|
+
className: ht.sliderArea,
|
|
1988
2081
|
children: [
|
|
1989
|
-
r && /* @__PURE__ */ h("div", { className:
|
|
1990
|
-
/* @__PURE__ */ h(
|
|
2082
|
+
r && /* @__PURE__ */ h("div", { className: ht.histogramRow }),
|
|
2083
|
+
/* @__PURE__ */ h(R, { height: 6 }),
|
|
1991
2084
|
/* @__PURE__ */ g("div", {
|
|
1992
|
-
className:
|
|
1993
|
-
children: [/* @__PURE__ */ h(
|
|
2085
|
+
className: ht.inputRow,
|
|
2086
|
+
children: [/* @__PURE__ */ h(R, {
|
|
1994
2087
|
width: 40,
|
|
1995
2088
|
height: 20,
|
|
1996
2089
|
delay: .1
|
|
1997
|
-
}), /* @__PURE__ */ h(
|
|
2090
|
+
}), /* @__PURE__ */ h(R, {
|
|
1998
2091
|
width: 40,
|
|
1999
2092
|
height: 20,
|
|
2000
2093
|
delay: .15
|
|
@@ -2002,34 +2095,36 @@ var ot = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
2002
2095
|
})
|
|
2003
2096
|
]
|
|
2004
2097
|
}) : /* @__PURE__ */ h("div", {
|
|
2005
|
-
className:
|
|
2006
|
-
children: Array.from({ length: t }).map((e, t) => /* @__PURE__ */ h(
|
|
2007
|
-
width: `${
|
|
2098
|
+
className: ht.listRows,
|
|
2099
|
+
children: Array.from({ length: t }).map((e, t) => /* @__PURE__ */ h(R, {
|
|
2100
|
+
width: `${gt[t % gt.length]}%`,
|
|
2008
2101
|
delay: t * .05
|
|
2009
2102
|
}, t))
|
|
2010
2103
|
})
|
|
2011
|
-
}),
|
|
2012
|
-
list: "
|
|
2013
|
-
count: "
|
|
2014
|
-
countValue: "
|
|
2015
|
-
chip: "
|
|
2016
|
-
chipLabel: "
|
|
2017
|
-
grid: "
|
|
2018
|
-
active: "
|
|
2019
|
-
|
|
2104
|
+
}), vt = {
|
|
2105
|
+
list: "_list_1352r_2",
|
|
2106
|
+
count: "_count_1352r_7",
|
|
2107
|
+
countValue: "_countValue_1352r_17",
|
|
2108
|
+
chip: "_chip_1352r_22",
|
|
2109
|
+
chipLabel: "_chipLabel_1352r_32",
|
|
2110
|
+
grid: "_grid_1352r_40",
|
|
2111
|
+
active: "_active_1352r_54",
|
|
2112
|
+
search: "_search_1352r_59",
|
|
2113
|
+
searchNote: "_searchNote_1352r_62"
|
|
2114
|
+
}, yt = {
|
|
2020
2115
|
notice: "_notice_4sel0_1",
|
|
2021
2116
|
technical: "_technical_4sel0_9"
|
|
2022
|
-
},
|
|
2117
|
+
}, bt = ({ label: e, field: t, missing: n }) => {
|
|
2023
2118
|
let r = n.map((e) => e[0].toUpperCase() + e.slice(1)).join(" and ");
|
|
2024
2119
|
return o(() => {
|
|
2025
2120
|
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).`);
|
|
2026
|
-
}, [t, r]), /* @__PURE__ */ h(
|
|
2121
|
+
}, [t, r]), /* @__PURE__ */ h(A, {
|
|
2027
2122
|
title: e ?? t,
|
|
2028
2123
|
collapsible: !1,
|
|
2029
2124
|
children: /* @__PURE__ */ g("div", {
|
|
2030
|
-
className:
|
|
2125
|
+
className: yt.notice,
|
|
2031
2126
|
children: [/* @__PURE__ */ h("span", { children: "Not available" }), /* @__PURE__ */ g("code", {
|
|
2032
|
-
className:
|
|
2127
|
+
className: yt.technical,
|
|
2033
2128
|
children: [
|
|
2034
2129
|
t,
|
|
2035
2130
|
": not ",
|
|
@@ -2038,65 +2133,105 @@ var ot = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
2038
2133
|
})]
|
|
2039
2134
|
})
|
|
2040
2135
|
});
|
|
2041
|
-
},
|
|
2042
|
-
let { state: { facets:
|
|
2136
|
+
}, xt = 50, St = ({ 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: f, layout: p = "list", showActivePanel: m = !1, showCount: _ = !0, showNull: v = !1, match: y = "all", displayIfEmptyQuery: b = !0, searchable: x = "auto", searchPlaceholder: S, displayCondition: w = (e) => !0 }) => {
|
|
2137
|
+
let { state: { facets: E, filterableFields: D, facetableFields: O, filters: k, query: j }, toggleFilter: M, setValueMatch: N, authError: I, isFetchingInitial: L, allowEmptySearch: R, searchFacetValues: z } = Ce(), B = d ?? f ?? "checkbox", V = B === "radio" ? "any" : y;
|
|
2043
2138
|
o(() => {
|
|
2044
|
-
|
|
2139
|
+
N(e, V);
|
|
2045
2140
|
}, [
|
|
2046
2141
|
e,
|
|
2047
|
-
|
|
2048
|
-
|
|
2142
|
+
V,
|
|
2143
|
+
N
|
|
2049
2144
|
]);
|
|
2050
|
-
let
|
|
2145
|
+
let U = c(null), [W, G] = l(a);
|
|
2146
|
+
o(() => {
|
|
2147
|
+
G(a);
|
|
2148
|
+
}, [E?.[e], a]);
|
|
2149
|
+
let [K, ee] = l(""), [q, te] = l(null), J = c(0);
|
|
2051
2150
|
if (o(() => {
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2151
|
+
let t = K.trim();
|
|
2152
|
+
if (!t) {
|
|
2153
|
+
te(null);
|
|
2154
|
+
return;
|
|
2155
|
+
}
|
|
2156
|
+
let n = ++J.current, r = /* @__PURE__ */ new Map();
|
|
2157
|
+
for (let t of Array.isArray(E?.[e]) ? E[e] : []) typeof t.key == "string" && (t.value ?? 0) > 0 && r.set(t.key, t.value);
|
|
2158
|
+
let i = r.size > 0 && r.size <= 3e3 ? Array.from(r.keys()) : void 0;
|
|
2159
|
+
(async () => {
|
|
2160
|
+
let o = z ? await z(e, t, i ? Math.max(a, 10) : 100, i) : null;
|
|
2161
|
+
if (n !== J.current) return;
|
|
2162
|
+
let s, c = 0;
|
|
2163
|
+
if (o) {
|
|
2164
|
+
let a = o.values.filter((e) => r.has(e.value));
|
|
2165
|
+
if (s = a.map((e) => [e.value, r.get(e.value)]), o.fallback || s.sort((e, t) => t[1] - e[1]), c = o.values.length - a.length, s.length === 0 && i && (te({
|
|
2166
|
+
text: t,
|
|
2167
|
+
values: s,
|
|
2168
|
+
outside: 0,
|
|
2169
|
+
fallback: !1
|
|
2170
|
+
}), c = (await z(e, t, 10))?.values.length ?? 0, n !== J.current)) return;
|
|
2171
|
+
} else {
|
|
2172
|
+
let e = t.toLowerCase();
|
|
2173
|
+
s = Array.from(r.entries()).filter(([t]) => t.toLowerCase().includes(e));
|
|
2174
|
+
}
|
|
2175
|
+
te({
|
|
2176
|
+
text: t,
|
|
2177
|
+
values: s.slice(0, Math.max(a, 10)),
|
|
2178
|
+
outside: c,
|
|
2179
|
+
fallback: o?.fallback ?? !1
|
|
2180
|
+
});
|
|
2181
|
+
})();
|
|
2182
|
+
}, [
|
|
2183
|
+
K,
|
|
2184
|
+
e,
|
|
2185
|
+
a,
|
|
2186
|
+
z,
|
|
2187
|
+
E?.[e]
|
|
2188
|
+
]), !R && !j || I) return null;
|
|
2189
|
+
if (L || !E) return B === "toggle" ? /* @__PURE__ */ h(_t, {
|
|
2055
2190
|
rows: 1,
|
|
2056
2191
|
collapsible: !1
|
|
2057
|
-
}) : /* @__PURE__ */ h(
|
|
2192
|
+
}) : /* @__PURE__ */ h(_t, {
|
|
2058
2193
|
title: t,
|
|
2059
2194
|
rows: Math.min(a, 6),
|
|
2060
2195
|
collapsible: s,
|
|
2061
2196
|
startCollapsed: u
|
|
2062
2197
|
});
|
|
2063
|
-
if (!
|
|
2064
|
-
query:
|
|
2065
|
-
filters:
|
|
2066
|
-
facets:
|
|
2067
|
-
}) || !b && !
|
|
2068
|
-
if (!
|
|
2198
|
+
if (!w({
|
|
2199
|
+
query: j ?? "",
|
|
2200
|
+
filters: k,
|
|
2201
|
+
facets: E
|
|
2202
|
+
}) || !b && !j && Object.keys(k).length < 1) return null;
|
|
2203
|
+
if (!D?.includes(e) || !O?.includes(e)) {
|
|
2069
2204
|
let n = [];
|
|
2070
|
-
return
|
|
2205
|
+
return D?.includes(e) || n.push("filterable"), O?.includes(e) || n.push("facetable"), /* @__PURE__ */ h(bt, {
|
|
2071
2206
|
label: t,
|
|
2072
2207
|
field: e,
|
|
2073
2208
|
missing: n
|
|
2074
2209
|
});
|
|
2075
2210
|
}
|
|
2076
|
-
let
|
|
2077
|
-
if (!
|
|
2078
|
-
let
|
|
2079
|
-
n && !
|
|
2080
|
-
let
|
|
2081
|
-
n &&
|
|
2082
|
-
|
|
2083
|
-
}),
|
|
2084
|
-
|
|
2211
|
+
let Y = E?.[e] ?? (B === "toggle" ? [] : void 0);
|
|
2212
|
+
if (!Y || !Array.isArray(Y)) return null;
|
|
2213
|
+
let X = k?.[e] ?? [];
|
|
2214
|
+
n && !U.current && Y.length > 0 && (U.current = Y.reduce((e, t) => (e[t.key] = t.value, e), {}));
|
|
2215
|
+
let Z = /* @__PURE__ */ new Map();
|
|
2216
|
+
n && U.current && Object.keys(U.current).forEach((e) => {
|
|
2217
|
+
Z.set(e, 0);
|
|
2218
|
+
}), Y.forEach((e) => {
|
|
2219
|
+
Z.set(e.key, e.value);
|
|
2085
2220
|
});
|
|
2086
|
-
let
|
|
2221
|
+
let ne = /* @__PURE__ */ new Set([
|
|
2087
2222
|
"true",
|
|
2088
2223
|
"false",
|
|
2089
2224
|
"null"
|
|
2090
|
-
]),
|
|
2091
|
-
if (
|
|
2092
|
-
let e =
|
|
2093
|
-
|
|
2225
|
+
]), re = Array.from(Z.keys()), ie = B === "toggle" && (re.length > 0 && re.every((e) => ne.has(e)) || re.length === 0 && X.length > 0);
|
|
2226
|
+
if (ie && Z.has("null")) {
|
|
2227
|
+
let e = Z.get("null") ?? 0, t = Z.get("false") ?? 0;
|
|
2228
|
+
Z.set("false", t + e), Z.delete("null");
|
|
2094
2229
|
}
|
|
2095
|
-
if (
|
|
2230
|
+
if (B === "toggle" && !ie) return /* @__PURE__ */ h(A, {
|
|
2096
2231
|
collapsible: !1,
|
|
2097
2232
|
children: /* @__PURE__ */ h("div", {
|
|
2098
|
-
className:
|
|
2099
|
-
children: /* @__PURE__ */ h(
|
|
2233
|
+
className: vt.count,
|
|
2234
|
+
children: /* @__PURE__ */ h(H, {
|
|
2100
2235
|
label: t,
|
|
2101
2236
|
checked: !1,
|
|
2102
2237
|
onChange: () => {},
|
|
@@ -2104,17 +2239,17 @@ var ot = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
2104
2239
|
})
|
|
2105
2240
|
})
|
|
2106
2241
|
});
|
|
2107
|
-
if (
|
|
2108
|
-
let n =
|
|
2109
|
-
return /* @__PURE__ */ h(
|
|
2242
|
+
if (ie) {
|
|
2243
|
+
let n = Z.get("true"), r = typeof n == "number" ? n : null, i = X.includes("true"), a = r === 0 && !i, o = _ && (r ?? 0) > 0 ? `${r}` : "";
|
|
2244
|
+
return /* @__PURE__ */ h(A, {
|
|
2110
2245
|
collapsible: !1,
|
|
2111
2246
|
children: /* @__PURE__ */ g("div", {
|
|
2112
|
-
className:
|
|
2247
|
+
className: vt.count,
|
|
2113
2248
|
children: [
|
|
2114
|
-
/* @__PURE__ */ h(
|
|
2249
|
+
/* @__PURE__ */ h(H, {
|
|
2115
2250
|
label: t,
|
|
2116
2251
|
checked: i,
|
|
2117
|
-
onChange: () =>
|
|
2252
|
+
onChange: () => M(e, "true"),
|
|
2118
2253
|
disabled: a
|
|
2119
2254
|
}),
|
|
2120
2255
|
" ",
|
|
@@ -2123,127 +2258,159 @@ var ot = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
2123
2258
|
})
|
|
2124
2259
|
});
|
|
2125
2260
|
}
|
|
2126
|
-
let
|
|
2127
|
-
if (v || (
|
|
2261
|
+
let Q = Array.from(Z.entries());
|
|
2262
|
+
if (v || (Q = Q.filter(([e]) => e !== "null")), Q.length === 0 && !n) return null;
|
|
2128
2263
|
if (!r) {
|
|
2129
2264
|
if (i === "alphabetical") {
|
|
2130
|
-
let e =
|
|
2131
|
-
|
|
2265
|
+
let e = Q.filter(([, e]) => typeof e == "number" && e > 0).sort(([e], [t]) => e.localeCompare(t)), t = Q.filter(([, e]) => e === 0 || e === null).sort(([e], [t]) => e.localeCompare(t));
|
|
2266
|
+
Q = [...e, ...t];
|
|
2132
2267
|
} else if (i === "numeric") {
|
|
2133
2268
|
let e = (e, t) => {
|
|
2134
2269
|
let n = Number(e), r = Number(t);
|
|
2135
2270
|
return !isNaN(n) && !isNaN(r) ? n - r : e.localeCompare(t);
|
|
2136
|
-
}, t =
|
|
2137
|
-
|
|
2271
|
+
}, t = Q.filter(([, e]) => typeof e == "number" && e > 0).sort(([t], [n]) => e(t, n)), n = Q.filter(([, e]) => e === 0 || e === null).sort(([t], [n]) => e(t, n));
|
|
2272
|
+
Q = [...t, ...n];
|
|
2138
2273
|
} else {
|
|
2139
|
-
let e =
|
|
2140
|
-
|
|
2274
|
+
let e = Q.filter(([, e]) => typeof e == "number" && e > 0), t = Q.filter(([, e]) => e === 0 || e === null);
|
|
2275
|
+
Q = [...e, ...t];
|
|
2141
2276
|
}
|
|
2142
2277
|
}
|
|
2143
|
-
let
|
|
2144
|
-
let
|
|
2145
|
-
switch (
|
|
2278
|
+
let ae = typeof a == "number" && Q.length > a, oe = ae ? Q.slice(0, W) : Q, se = (t, n, r) => {
|
|
2279
|
+
let i = X.includes(t), a = n === 0, o = _ && (n ?? 0) > 0 ? ` (${n})` : "", s = _ && (n ?? 0) > 0 ? n : "", c = () => M(e, t, B === "radio", r);
|
|
2280
|
+
switch (B) {
|
|
2146
2281
|
case "button": return p === "list" ? /* @__PURE__ */ g("div", {
|
|
2147
|
-
className:
|
|
2148
|
-
children: [/* @__PURE__ */ h(
|
|
2149
|
-
variant:
|
|
2150
|
-
onClick:
|
|
2151
|
-
disabled:
|
|
2282
|
+
className: vt.count,
|
|
2283
|
+
children: [/* @__PURE__ */ h(C, {
|
|
2284
|
+
variant: i ? "primary" : "secondary",
|
|
2285
|
+
onClick: c,
|
|
2286
|
+
disabled: a,
|
|
2152
2287
|
size: "micro",
|
|
2153
|
-
className:
|
|
2288
|
+
className: vt.chip,
|
|
2154
2289
|
title: t,
|
|
2155
2290
|
children: /* @__PURE__ */ h("span", {
|
|
2156
|
-
className:
|
|
2291
|
+
className: vt.chipLabel,
|
|
2157
2292
|
children: t
|
|
2158
2293
|
})
|
|
2159
2294
|
}), /* @__PURE__ */ h("span", {
|
|
2160
|
-
className:
|
|
2161
|
-
children:
|
|
2295
|
+
className: vt.countValue,
|
|
2296
|
+
children: s
|
|
2162
2297
|
})]
|
|
2163
|
-
}) : /* @__PURE__ */ h(
|
|
2164
|
-
variant:
|
|
2165
|
-
onClick:
|
|
2166
|
-
disabled:
|
|
2298
|
+
}) : /* @__PURE__ */ h(C, {
|
|
2299
|
+
variant: i ? "primary" : "secondary",
|
|
2300
|
+
onClick: c,
|
|
2301
|
+
disabled: a,
|
|
2167
2302
|
size: "micro",
|
|
2168
|
-
className:
|
|
2169
|
-
title: `${t}${
|
|
2303
|
+
className: vt.chip,
|
|
2304
|
+
title: `${t}${o}`,
|
|
2170
2305
|
children: /* @__PURE__ */ h("span", {
|
|
2171
|
-
className:
|
|
2172
|
-
children: `${t}${
|
|
2306
|
+
className: vt.chipLabel,
|
|
2307
|
+
children: `${t}${o}`
|
|
2173
2308
|
})
|
|
2174
2309
|
});
|
|
2175
|
-
case "toggle": return /* @__PURE__ */ h(
|
|
2310
|
+
case "toggle": return /* @__PURE__ */ h(H, {
|
|
2176
2311
|
label: t,
|
|
2177
|
-
checked:
|
|
2178
|
-
onChange:
|
|
2179
|
-
disabled:
|
|
2312
|
+
checked: i,
|
|
2313
|
+
onChange: c,
|
|
2314
|
+
disabled: a
|
|
2180
2315
|
});
|
|
2181
2316
|
case "radio": {
|
|
2182
|
-
let n = /* @__PURE__ */ h(
|
|
2317
|
+
let n = /* @__PURE__ */ h(P, {
|
|
2183
2318
|
id: `${e}-${t}`,
|
|
2184
2319
|
name: e,
|
|
2185
2320
|
value: t,
|
|
2186
|
-
label: p === "grid" ? `${t}${
|
|
2187
|
-
checked:
|
|
2188
|
-
onChange:
|
|
2189
|
-
disabled:
|
|
2321
|
+
label: p === "grid" ? `${t}${o}` : t,
|
|
2322
|
+
checked: i,
|
|
2323
|
+
onChange: c,
|
|
2324
|
+
disabled: a
|
|
2190
2325
|
});
|
|
2191
2326
|
return p === "list" ? /* @__PURE__ */ g("div", {
|
|
2192
|
-
className:
|
|
2327
|
+
className: vt.count,
|
|
2193
2328
|
children: [n, /* @__PURE__ */ h("span", {
|
|
2194
|
-
className:
|
|
2195
|
-
children:
|
|
2329
|
+
className: vt.countValue,
|
|
2330
|
+
children: s
|
|
2196
2331
|
})]
|
|
2197
2332
|
}) : n;
|
|
2198
2333
|
}
|
|
2199
2334
|
default: return p === "list" ? /* @__PURE__ */ g("div", {
|
|
2200
|
-
className:
|
|
2201
|
-
children: [/* @__PURE__ */ h(
|
|
2335
|
+
className: vt.count,
|
|
2336
|
+
children: [/* @__PURE__ */ h(T, {
|
|
2202
2337
|
label: t,
|
|
2203
2338
|
score: "",
|
|
2204
|
-
checked:
|
|
2205
|
-
onChange:
|
|
2206
|
-
disabled:
|
|
2339
|
+
checked: i,
|
|
2340
|
+
onChange: c,
|
|
2341
|
+
disabled: a
|
|
2207
2342
|
}), /* @__PURE__ */ h("span", {
|
|
2208
|
-
className:
|
|
2209
|
-
children:
|
|
2343
|
+
className: vt.countValue,
|
|
2344
|
+
children: s
|
|
2210
2345
|
})]
|
|
2211
|
-
}) : /* @__PURE__ */ h(
|
|
2346
|
+
}) : /* @__PURE__ */ h(T, {
|
|
2212
2347
|
label: t,
|
|
2213
|
-
score:
|
|
2214
|
-
checked:
|
|
2215
|
-
onChange:
|
|
2216
|
-
disabled:
|
|
2348
|
+
score: o,
|
|
2349
|
+
checked: i,
|
|
2350
|
+
onChange: c,
|
|
2351
|
+
disabled: a
|
|
2217
2352
|
});
|
|
2218
2353
|
}
|
|
2219
|
-
}
|
|
2220
|
-
|
|
2354
|
+
}, ce = s ? u : !1, le = B !== "toggle" && (x === !0 || x === "auto" && Q.length > a && Q.length >= xt), $ = le && K.trim() && q ? q : null, ue = $ ? [...X.map((e) => [e, Z.get(e) ?? null]), ...$.values.filter(([e]) => !X.includes(e))] : null, de = new Intl.NumberFormat("en"), fe = le && /* @__PURE__ */ h("div", {
|
|
2355
|
+
className: vt.search,
|
|
2356
|
+
children: /* @__PURE__ */ h(F, {
|
|
2357
|
+
inputSize: "micro",
|
|
2358
|
+
value: K,
|
|
2359
|
+
onChange: (e) => ee(e.target.value),
|
|
2360
|
+
onFocus: () => {
|
|
2361
|
+
z?.(e, "", 1);
|
|
2362
|
+
},
|
|
2363
|
+
placeholder: S ?? "Type to search",
|
|
2364
|
+
"aria-label": `Search ${t ?? e}`
|
|
2365
|
+
})
|
|
2366
|
+
});
|
|
2367
|
+
return ue ? /* @__PURE__ */ g(A, {
|
|
2221
2368
|
title: t,
|
|
2222
2369
|
collapsible: s,
|
|
2223
|
-
collapsed:
|
|
2224
|
-
className: m &&
|
|
2225
|
-
children: /* @__PURE__ */ g("
|
|
2226
|
-
className:
|
|
2370
|
+
collapsed: ce,
|
|
2371
|
+
className: m && X.length > 0 ? vt.active : void 0,
|
|
2372
|
+
children: [fe, ue.length === 0 ? /* @__PURE__ */ g("p", {
|
|
2373
|
+
className: vt.searchNote,
|
|
2374
|
+
children: [`Nothing in these results matches "${$.text}".`, $.outside > 0 && ` ${$.outside >= 10 ? "More" : de.format($.outside)} ${$.outside === 1 ? "matches" : "match"} outside them.`]
|
|
2375
|
+
}) : /* @__PURE__ */ h("ul", {
|
|
2376
|
+
className: p === "grid" ? vt.grid : vt.list,
|
|
2227
2377
|
style: {
|
|
2228
2378
|
listStyle: "none",
|
|
2229
2379
|
padding: 0,
|
|
2230
2380
|
margin: 0
|
|
2231
2381
|
},
|
|
2232
|
-
children:
|
|
2233
|
-
|
|
2382
|
+
children: ue.map(([e, t]) => /* @__PURE__ */ h("li", { children: se(e, t, {
|
|
2383
|
+
text: $.text,
|
|
2384
|
+
fallback: $.fallback
|
|
2385
|
+
}) }, e))
|
|
2386
|
+
})]
|
|
2387
|
+
}) : /* @__PURE__ */ g(A, {
|
|
2388
|
+
title: t,
|
|
2389
|
+
collapsible: s,
|
|
2390
|
+
collapsed: ce,
|
|
2391
|
+
className: m && X.length > 0 ? vt.active : void 0,
|
|
2392
|
+
children: [fe, /* @__PURE__ */ g("ul", {
|
|
2393
|
+
className: p === "grid" ? vt.grid : vt.list,
|
|
2394
|
+
style: {
|
|
2395
|
+
listStyle: "none",
|
|
2396
|
+
padding: 0,
|
|
2397
|
+
margin: 0
|
|
2398
|
+
},
|
|
2399
|
+
children: [oe.map(([e, t]) => /* @__PURE__ */ h("li", { children: se(e, t) }, e)), ae && W < Q.length && (() => {
|
|
2400
|
+
let e = Q.length - W, t = Math.min(50, e);
|
|
2234
2401
|
return /* @__PURE__ */ h("li", {
|
|
2235
|
-
className:
|
|
2236
|
-
children: /* @__PURE__ */ h(
|
|
2402
|
+
className: vt.toggleItem,
|
|
2403
|
+
children: /* @__PURE__ */ h(C, {
|
|
2237
2404
|
variant: "ghost",
|
|
2238
2405
|
size: "micro",
|
|
2239
|
-
onClick: () =>
|
|
2240
|
-
children: `Show ${t} more of ${
|
|
2406
|
+
onClick: () => G((e) => e + 50),
|
|
2407
|
+
children: `Show ${t} more of ${Q.length} total`
|
|
2241
2408
|
})
|
|
2242
2409
|
});
|
|
2243
2410
|
})()]
|
|
2244
|
-
})
|
|
2411
|
+
})]
|
|
2245
2412
|
});
|
|
2246
|
-
},
|
|
2413
|
+
}, Ct = {
|
|
2247
2414
|
disabledMessage: "_disabledMessage_adany_1",
|
|
2248
2415
|
histogram: "_histogram_adany_6",
|
|
2249
2416
|
histogramLayer: "_histogramLayer_adany_14",
|
|
@@ -2256,36 +2423,36 @@ var ot = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
2256
2423
|
active: "_active_adany_76"
|
|
2257
2424
|
};
|
|
2258
2425
|
// src/utils/numeric.ts
|
|
2259
|
-
function
|
|
2426
|
+
function wt(e) {
|
|
2260
2427
|
if (!Number.isFinite(e)) return 0;
|
|
2261
2428
|
let t = String(e), n = t.indexOf(".");
|
|
2262
2429
|
return n === -1 ? 0 : Math.min(6, t.length - n - 1);
|
|
2263
2430
|
}
|
|
2264
|
-
function
|
|
2431
|
+
function Tt(e) {
|
|
2265
2432
|
let t = 0;
|
|
2266
|
-
for (let n of e) t = Math.max(t,
|
|
2433
|
+
for (let n of e) t = Math.max(t, wt(n));
|
|
2267
2434
|
return t === 0 ? 1 : Number((10 ** -t).toFixed(t));
|
|
2268
2435
|
}
|
|
2269
|
-
function
|
|
2270
|
-
return Number(e.toFixed(
|
|
2436
|
+
function Et(e, t) {
|
|
2437
|
+
return Number(e.toFixed(wt(t)));
|
|
2271
2438
|
}
|
|
2272
2439
|
// src/components/RangeFilterPanel.tsx
|
|
2273
|
-
function
|
|
2440
|
+
function Dt(e, t, n) {
|
|
2274
2441
|
let r = t + Math.round((e - t) / n) * n;
|
|
2275
|
-
return Number(r.toFixed(
|
|
2442
|
+
return Number(r.toFixed(wt(n)));
|
|
2276
2443
|
}
|
|
2277
|
-
function
|
|
2444
|
+
function Ot(e, t, n) {
|
|
2278
2445
|
let r = Math.ceil(Number(((e - t) / n).toFixed(6)));
|
|
2279
|
-
return Number((t + r * n).toFixed(
|
|
2446
|
+
return Number((t + r * n).toFixed(wt(n)));
|
|
2280
2447
|
}
|
|
2281
|
-
var
|
|
2282
|
-
let { state: { rangeFilters: m, rangeBounds: _, facetStats: v, facets: y, filterableFields: b, facetableFields: x, query: S, facetDebounceDelayMillis: C }, setRangeFilter: w, resetRangeFilter: T, allowEmptySearch: E, authError: D, isFetchingInitial:
|
|
2448
|
+
var kt = ({ 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: f, stepMarks: p }) => {
|
|
2449
|
+
let { state: { rangeFilters: m, rangeBounds: _, facetStats: v, facets: y, filterableFields: b, facetableFields: x, query: S, facetDebounceDelayMillis: C }, setRangeFilter: w, resetRangeFilter: T, allowEmptySearch: E, authError: D, isFetchingInitial: O } = Ce(), k = a ?? o ?? "input", M = _?.[t] !== void 0, N = _?.[t] ?? {
|
|
2283
2450
|
min: r,
|
|
2284
2451
|
max: i
|
|
2285
|
-
}, P = N.min, F = N.max, I = v?.[t] ?? N,
|
|
2452
|
+
}, P = N.min, F = N.max, I = v?.[t] ?? N, L = Math.max(P, Math.min(F, I.min)), R = Math.max(P, Math.min(F, I.max)), B = e.useMemo(() => {
|
|
2286
2453
|
if (f) return f;
|
|
2287
|
-
let e = Math.max(
|
|
2288
|
-
if (Array.isArray(n)) for (let t of n) e = Math.max(e,
|
|
2454
|
+
let e = Math.max(wt(P), wt(F)), n = y?.[t];
|
|
2455
|
+
if (Array.isArray(n)) for (let t of n) e = Math.max(e, wt(Number(t.key)));
|
|
2289
2456
|
return e === 0 ? 1 : Number((10 ** -e).toFixed(e));
|
|
2290
2457
|
}, [
|
|
2291
2458
|
f,
|
|
@@ -2293,21 +2460,21 @@ var St = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
2293
2460
|
F,
|
|
2294
2461
|
y,
|
|
2295
2462
|
t
|
|
2296
|
-
]), V = M && P === F, H = V ? r : P, U = V ? i : F, W =
|
|
2297
|
-
let e =
|
|
2298
|
-
return { width: `calc(${Math.max(3, P.toFixed(e).length, F.toFixed(e).length,
|
|
2463
|
+
]), V = M && P === F, H = V ? r : P, U = V ? i : F, W = Ot(U + B, H, B), G = (e) => Math.min(W, Math.max(H, e)), K = m?.[t], ee = s && K !== void 0 ? Ct.active : void 0, q = K ? K.min : P, te = K ? K.max : F, J = K !== void 0, Y = L !== P || R !== F, [X, Z] = e.useState([q, te]), [ne, re] = e.useState(!1), [ie, Q] = e.useState(!1), [ae, oe] = e.useState(String(q)), [se, ce] = e.useState(String(te)), le = e.useMemo(() => {
|
|
2464
|
+
let e = wt(B);
|
|
2465
|
+
return { width: `calc(${Math.max(3, P.toFixed(e).length, F.toFixed(e).length, ae.length, se.length) + 1}ch + 20px)` };
|
|
2299
2466
|
}, [
|
|
2300
2467
|
B,
|
|
2301
2468
|
P,
|
|
2302
2469
|
F,
|
|
2303
|
-
|
|
2304
|
-
|
|
2470
|
+
ae,
|
|
2471
|
+
se
|
|
2305
2472
|
]);
|
|
2306
2473
|
e.useEffect(() => {
|
|
2307
|
-
|
|
2308
|
-
}, [
|
|
2309
|
-
let { finalMin:
|
|
2310
|
-
let [e, t] =
|
|
2474
|
+
oe(String(X[0])), ce(String(X[1]));
|
|
2475
|
+
}, [X]);
|
|
2476
|
+
let { finalMin: $, finalMax: ue, isValidMin: de, isValidMax: fe } = e.useMemo(() => {
|
|
2477
|
+
let [e, t] = X, n = Math.max(P, Math.min(F, e)), r = Math.max(P, Math.min(F, t)), i = Math.min(n, r), a = Math.max(n, r);
|
|
2311
2478
|
return {
|
|
2312
2479
|
finalMin: i,
|
|
2313
2480
|
finalMax: a,
|
|
@@ -2315,29 +2482,29 @@ var St = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
2315
2482
|
isValidMax: a <= F && a >= i
|
|
2316
2483
|
};
|
|
2317
2484
|
}, [
|
|
2318
|
-
|
|
2485
|
+
X,
|
|
2319
2486
|
P,
|
|
2320
2487
|
F
|
|
2321
2488
|
]);
|
|
2322
2489
|
e.useEffect(() => {
|
|
2323
2490
|
if (V) return;
|
|
2324
|
-
if (
|
|
2325
|
-
|
|
2491
|
+
if (X[0] === P && X[1] === F) {
|
|
2492
|
+
re(!1), Q(!1);
|
|
2326
2493
|
return;
|
|
2327
2494
|
}
|
|
2328
2495
|
let e = C ?? 500, n = setTimeout(() => {
|
|
2329
|
-
|
|
2496
|
+
re(!de), Q(!fe);
|
|
2330
2497
|
}, 300), r = setTimeout(() => {
|
|
2331
|
-
|
|
2498
|
+
de && fe && ($ === P && ue === F ? T(t, !1) : w(t, $, ue));
|
|
2332
2499
|
}, e);
|
|
2333
2500
|
return () => {
|
|
2334
2501
|
clearTimeout(n), clearTimeout(r);
|
|
2335
2502
|
};
|
|
2336
2503
|
}, [
|
|
2504
|
+
$,
|
|
2505
|
+
ue,
|
|
2337
2506
|
de,
|
|
2338
2507
|
fe,
|
|
2339
|
-
pe,
|
|
2340
|
-
me,
|
|
2341
2508
|
P,
|
|
2342
2509
|
F,
|
|
2343
2510
|
t,
|
|
@@ -2346,105 +2513,105 @@ var St = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
2346
2513
|
C,
|
|
2347
2514
|
V
|
|
2348
2515
|
]), e.useEffect(() => {
|
|
2349
|
-
|
|
2516
|
+
Z([q, te]), re(!1), Q(!1);
|
|
2350
2517
|
}, [
|
|
2351
2518
|
q,
|
|
2352
2519
|
te,
|
|
2353
2520
|
t
|
|
2354
2521
|
]);
|
|
2355
|
-
let
|
|
2356
|
-
let t =
|
|
2357
|
-
return [t,
|
|
2358
|
-
}, [B]),
|
|
2522
|
+
let pe = e.useCallback((e) => {
|
|
2523
|
+
let t = Et(Math.min(e[0], e[1] - B), B);
|
|
2524
|
+
return [t, Et(Math.max(e[1] - B, t), B)];
|
|
2525
|
+
}, [B]), me = e.useCallback((e) => {
|
|
2359
2526
|
if (V) return;
|
|
2360
|
-
let [t, n] =
|
|
2361
|
-
|
|
2527
|
+
let [t, n] = pe(e);
|
|
2528
|
+
Z([Math.max(P, Math.min(R, t)), Math.max(L, Math.min(F, n))]);
|
|
2362
2529
|
}, [
|
|
2363
2530
|
V,
|
|
2364
|
-
|
|
2531
|
+
pe,
|
|
2365
2532
|
P,
|
|
2366
2533
|
F,
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
]),
|
|
2534
|
+
L,
|
|
2535
|
+
R
|
|
2536
|
+
]), he = e.useCallback((e) => {
|
|
2370
2537
|
if (V) return;
|
|
2371
|
-
let [n, r] =
|
|
2372
|
-
i === P && a === F ? (
|
|
2538
|
+
let [n, r] = pe(e), i = Math.max(P, Math.min(R, n)), a = Math.max(L, Math.min(F, r));
|
|
2539
|
+
i === P && a === F ? (Z([P, F]), T(t, !0)) : Z([i, a]);
|
|
2373
2540
|
}, [
|
|
2374
2541
|
V,
|
|
2375
|
-
|
|
2542
|
+
pe,
|
|
2376
2543
|
P,
|
|
2377
2544
|
F,
|
|
2545
|
+
L,
|
|
2378
2546
|
R,
|
|
2379
|
-
z,
|
|
2380
2547
|
t,
|
|
2381
2548
|
T
|
|
2382
|
-
]),
|
|
2549
|
+
]), ge = e.useRef(null), _e = e.useCallback((e, n) => {
|
|
2383
2550
|
if (V) return;
|
|
2384
|
-
let r =
|
|
2551
|
+
let r = ge.current;
|
|
2385
2552
|
if (K && r && r.start === e && r.last === n) {
|
|
2386
|
-
|
|
2553
|
+
ge.current = null, Z([P, F]), T(t, !0);
|
|
2387
2554
|
return;
|
|
2388
2555
|
}
|
|
2389
|
-
let i =
|
|
2390
|
-
|
|
2556
|
+
let i = Dt(Math.max(P, L, e), P, B), a = Math.max(i, Dt(Math.min(F, R, n), P, B));
|
|
2557
|
+
ge.current = {
|
|
2391
2558
|
start: e,
|
|
2392
2559
|
last: n
|
|
2393
|
-
},
|
|
2560
|
+
}, Z([i, a]);
|
|
2394
2561
|
}, [
|
|
2395
2562
|
V,
|
|
2396
2563
|
K,
|
|
2397
2564
|
P,
|
|
2398
2565
|
F,
|
|
2566
|
+
L,
|
|
2399
2567
|
R,
|
|
2400
|
-
z,
|
|
2401
2568
|
B,
|
|
2402
2569
|
t,
|
|
2403
2570
|
T
|
|
2404
|
-
]),
|
|
2571
|
+
]), ve = e.useCallback(() => {
|
|
2405
2572
|
if (V) return;
|
|
2406
|
-
let e =
|
|
2573
|
+
let e = ae.trim(), t = e === "" ? NaN : Number(e);
|
|
2407
2574
|
if (isNaN(t)) {
|
|
2408
|
-
|
|
2575
|
+
oe(String(X[0]));
|
|
2409
2576
|
return;
|
|
2410
2577
|
}
|
|
2411
|
-
let n = Math.max(P, Math.min(
|
|
2412
|
-
n <
|
|
2578
|
+
let n = Math.max(P, Math.min(R, t));
|
|
2579
|
+
n < X[1] ? Z([n, X[1]]) : Z([P, X[1]]), oe(String(n < X[1] ? n : P));
|
|
2413
2580
|
}, [
|
|
2414
2581
|
V,
|
|
2415
|
-
|
|
2416
|
-
|
|
2582
|
+
ae,
|
|
2583
|
+
X,
|
|
2417
2584
|
P,
|
|
2418
|
-
|
|
2419
|
-
]),
|
|
2585
|
+
R
|
|
2586
|
+
]), ye = e.useCallback(() => {
|
|
2420
2587
|
if (V) return;
|
|
2421
|
-
let e =
|
|
2588
|
+
let e = se.trim(), t = e === "" ? NaN : Number(e);
|
|
2422
2589
|
if (isNaN(t)) {
|
|
2423
|
-
|
|
2590
|
+
ce(String(X[1]));
|
|
2424
2591
|
return;
|
|
2425
2592
|
}
|
|
2426
|
-
let n = Math.max(
|
|
2427
|
-
n >
|
|
2593
|
+
let n = Math.max(L, Math.min(F, t));
|
|
2594
|
+
n > X[0] ? Z([X[0], n]) : Z([X[0], F]), ce(String(n > X[0] ? n : F));
|
|
2428
2595
|
}, [
|
|
2429
2596
|
V,
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2597
|
+
se,
|
|
2598
|
+
X,
|
|
2599
|
+
L,
|
|
2433
2600
|
F
|
|
2434
|
-
]),
|
|
2601
|
+
]), be = (e) => (t) => {
|
|
2435
2602
|
t.key === "Enter" && e();
|
|
2436
|
-
}, [
|
|
2603
|
+
}, [xe, Se] = e.useState(null), we = e.useRef(null);
|
|
2437
2604
|
e.useEffect(() => {
|
|
2438
2605
|
if (!u) return;
|
|
2439
2606
|
let e = `${P}:${F}`;
|
|
2440
|
-
if (e ===
|
|
2607
|
+
if (e === we.current && we.current !== null) return;
|
|
2441
2608
|
let n = y?.[t];
|
|
2442
2609
|
if (!Array.isArray(n) || n.length === 0) return;
|
|
2443
2610
|
let r = n.filter((e) => e.value != null && !isNaN(Number(e.key))).map((e) => ({
|
|
2444
2611
|
key: e.key,
|
|
2445
2612
|
value: e.value
|
|
2446
2613
|
}));
|
|
2447
|
-
r.length > 0 && (
|
|
2614
|
+
r.length > 0 && (we.current = e, Se(r));
|
|
2448
2615
|
}, [
|
|
2449
2616
|
P,
|
|
2450
2617
|
F,
|
|
@@ -2452,22 +2619,22 @@ var St = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
2452
2619
|
t,
|
|
2453
2620
|
u
|
|
2454
2621
|
]);
|
|
2455
|
-
let
|
|
2456
|
-
if (!u || !
|
|
2622
|
+
let Te = e.useMemo(() => {
|
|
2623
|
+
if (!u || !xe || xe.length === 0) return [];
|
|
2457
2624
|
let e = F - P;
|
|
2458
2625
|
if (e <= 0) return [];
|
|
2459
|
-
let t = d ?? Math.max(B,
|
|
2626
|
+
let t = d ?? Math.max(B, Et(Math.ceil(e / 20 / B) * B, B)), n = Math.ceil(e / t);
|
|
2460
2627
|
return Array.from({ length: n }, (e, r) => {
|
|
2461
|
-
let i = P + r * t, a = P + (r + 1) * t, o = r === n - 1, s =
|
|
2628
|
+
let i = P + r * t, a = P + (r + 1) * t, o = r === n - 1, s = xe.filter((e) => {
|
|
2462
2629
|
let t = Number(e.key);
|
|
2463
2630
|
return t >= i && (t < a || o && t <= F);
|
|
2464
|
-
}).reduce((e, t) => e + t.value, 0), c = o ? F :
|
|
2631
|
+
}).reduce((e, t) => e + t.value, 0), c = o ? F : Et(a - B, B);
|
|
2465
2632
|
return {
|
|
2466
2633
|
bucketStart: i,
|
|
2467
2634
|
bucketEnd: a,
|
|
2468
2635
|
count: s,
|
|
2469
2636
|
last: c,
|
|
2470
|
-
barEnd:
|
|
2637
|
+
barEnd: Et(c + B, B)
|
|
2471
2638
|
};
|
|
2472
2639
|
}).map((e, t, n) => ({
|
|
2473
2640
|
...e,
|
|
@@ -2475,92 +2642,92 @@ var St = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
2475
2642
|
}));
|
|
2476
2643
|
}, [
|
|
2477
2644
|
u,
|
|
2478
|
-
|
|
2645
|
+
xe,
|
|
2479
2646
|
P,
|
|
2480
2647
|
F,
|
|
2481
2648
|
d,
|
|
2482
2649
|
B,
|
|
2483
2650
|
W
|
|
2484
|
-
]),
|
|
2485
|
-
return u && !
|
|
2651
|
+
]), Ee = e.useMemo(() => Math.max(...Te.map((e) => e.count), 1), [Te]);
|
|
2652
|
+
return u && !O && !x?.includes(t) && console.warn(`RangeFilterPanel: showHistogram=true but field "${t}" is not facetable. Add .Facetable = true to this field.`), D ? null : O ? /* @__PURE__ */ h(_t, {
|
|
2486
2653
|
title: n,
|
|
2487
2654
|
variant: "slider",
|
|
2488
2655
|
withHistogram: u,
|
|
2489
2656
|
collapsible: c,
|
|
2490
2657
|
startCollapsed: l
|
|
2491
|
-
}) : !E && !S ? null : b?.includes(t) ?
|
|
2658
|
+
}) : !E && !S ? null : b?.includes(t) ? k === "slider" ? /* @__PURE__ */ g(A, {
|
|
2492
2659
|
title: n,
|
|
2493
2660
|
collapsed: l,
|
|
2494
2661
|
collapsible: c,
|
|
2495
2662
|
className: ee,
|
|
2496
2663
|
children: [
|
|
2497
2664
|
V && /* @__PURE__ */ g("div", {
|
|
2498
|
-
className:
|
|
2665
|
+
className: Ct.disabledMessage,
|
|
2499
2666
|
children: [
|
|
2500
2667
|
"No adjustable range (all results have the same value: ",
|
|
2501
2668
|
P,
|
|
2502
2669
|
")."
|
|
2503
2670
|
]
|
|
2504
2671
|
}),
|
|
2505
|
-
u &&
|
|
2506
|
-
u &&
|
|
2507
|
-
let [e, t] =
|
|
2672
|
+
u && Te.length === 0 && /* @__PURE__ */ h("div", { className: Ct.histogram }),
|
|
2673
|
+
u && Te.length > 0 && (() => {
|
|
2674
|
+
let [e, t] = R > L && (L > P || R < F) ? [L, R] : [H, U], n = Math.max($, e), r = Math.min(ue, 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)})`, f = `inset(0 ${u(s(t))} 0 ${u(o(e))})`, p = (n) => n.last < e || n.bucketStart > t, m = Te.slice(1).map((e) => u((e.bucketStart - H) / a)), _ = Te.map((e) => ({
|
|
2508
2675
|
...e,
|
|
2509
|
-
height: Math.max(1, Math.ceil(e.count /
|
|
2676
|
+
height: Math.max(1, Math.ceil(e.count / Ee * 20))
|
|
2510
2677
|
}));
|
|
2511
2678
|
return /* @__PURE__ */ g("div", {
|
|
2512
|
-
className:
|
|
2679
|
+
className: Ct.histogram,
|
|
2513
2680
|
children: [
|
|
2514
2681
|
/* @__PURE__ */ h("div", {
|
|
2515
|
-
className:
|
|
2682
|
+
className: Ct.histogramLayer,
|
|
2516
2683
|
children: _.map((e, t) => /* @__PURE__ */ h("button", {
|
|
2517
2684
|
type: "button",
|
|
2518
|
-
className:
|
|
2685
|
+
className: Ct.histogramBar,
|
|
2519
2686
|
style: { flexGrow: e.span },
|
|
2520
2687
|
"data-testid": "histogram-bar",
|
|
2521
2688
|
disabled: V || p(e),
|
|
2522
2689
|
"aria-label": `${e.bucketStart} to ${e.last}: ${e.count}`,
|
|
2523
2690
|
title: `${e.bucketStart} to ${e.last}: ${e.count}`,
|
|
2524
|
-
onClick: () =>
|
|
2691
|
+
onClick: () => _e(e.bucketStart, e.last),
|
|
2525
2692
|
children: /* @__PURE__ */ h("span", {
|
|
2526
|
-
className:
|
|
2693
|
+
className: Ct.histogramFill,
|
|
2527
2694
|
style: { height: `${e.height}px` }
|
|
2528
2695
|
})
|
|
2529
2696
|
}, t))
|
|
2530
2697
|
}),
|
|
2531
2698
|
/* @__PURE__ */ h("div", {
|
|
2532
|
-
className: `${
|
|
2699
|
+
className: `${Ct.histogramLayer} ${Ct.histogramLive}`,
|
|
2533
2700
|
"aria-hidden": "true",
|
|
2534
2701
|
"data-testid": "histogram-live",
|
|
2535
2702
|
style: { clipPath: f },
|
|
2536
2703
|
children: _.map((e, t) => /* @__PURE__ */ h("span", {
|
|
2537
|
-
className:
|
|
2704
|
+
className: Ct.histogramBar,
|
|
2538
2705
|
style: { flexGrow: e.span },
|
|
2539
2706
|
children: /* @__PURE__ */ h("span", {
|
|
2540
|
-
className:
|
|
2707
|
+
className: Ct.histogramFill,
|
|
2541
2708
|
style: { height: `${e.height}px` }
|
|
2542
2709
|
})
|
|
2543
2710
|
}, t))
|
|
2544
2711
|
}),
|
|
2545
2712
|
/* @__PURE__ */ h("div", {
|
|
2546
|
-
className: `${
|
|
2713
|
+
className: `${Ct.histogramLayer} ${Ct.histogramLit}`,
|
|
2547
2714
|
"aria-hidden": "true",
|
|
2548
2715
|
"data-testid": "histogram-lit",
|
|
2549
2716
|
style: { clipPath: d },
|
|
2550
2717
|
children: _.map((e, t) => /* @__PURE__ */ h("span", {
|
|
2551
|
-
className:
|
|
2718
|
+
className: Ct.histogramBar,
|
|
2552
2719
|
style: { flexGrow: e.span },
|
|
2553
2720
|
children: /* @__PURE__ */ h("span", {
|
|
2554
|
-
className:
|
|
2721
|
+
className: Ct.histogramFill,
|
|
2555
2722
|
style: { height: `${e.height}px` }
|
|
2556
2723
|
})
|
|
2557
2724
|
}, t))
|
|
2558
2725
|
}),
|
|
2559
2726
|
/* @__PURE__ */ h("div", {
|
|
2560
|
-
className:
|
|
2727
|
+
className: Ct.histogramSeparators,
|
|
2561
2728
|
"aria-hidden": "true",
|
|
2562
2729
|
children: m.map((e, t) => /* @__PURE__ */ h("span", {
|
|
2563
|
-
className:
|
|
2730
|
+
className: Ct.histogramSeparator,
|
|
2564
2731
|
style: { left: e }
|
|
2565
2732
|
}, t))
|
|
2566
2733
|
})
|
|
@@ -2569,20 +2736,20 @@ var St = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
2569
2736
|
})(),
|
|
2570
2737
|
/* @__PURE__ */ h("div", {
|
|
2571
2738
|
style: { padding: "10px 10px 20px 10px" },
|
|
2572
|
-
children: /* @__PURE__ */ h(
|
|
2739
|
+
children: /* @__PURE__ */ h(z, {
|
|
2573
2740
|
min: H,
|
|
2574
2741
|
max: W,
|
|
2575
2742
|
step: B,
|
|
2576
2743
|
stepMarks: p,
|
|
2577
|
-
value: V ? [H, W] : [G(
|
|
2744
|
+
value: V ? [H, W] : [G(Dt($, H, B)), G(Dt(ue + B, H, B))],
|
|
2578
2745
|
isRange: !0,
|
|
2579
|
-
onChange: (e) =>
|
|
2580
|
-
onFinalChange: (e) =>
|
|
2746
|
+
onChange: (e) => me(e),
|
|
2747
|
+
onFinalChange: (e) => he(e),
|
|
2581
2748
|
disabled: V,
|
|
2582
|
-
activeMin:
|
|
2583
|
-
activeMax: G(
|
|
2584
|
-
isFaceted:
|
|
2585
|
-
highlightFaceted:
|
|
2749
|
+
activeMin: L,
|
|
2750
|
+
activeMax: G(Et(R + B, B)),
|
|
2751
|
+
isFaceted: Y,
|
|
2752
|
+
highlightFaceted: J,
|
|
2586
2753
|
"aria-label": n || `Filter by ${t}`
|
|
2587
2754
|
})
|
|
2588
2755
|
}),
|
|
@@ -2593,38 +2760,38 @@ var St = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
2593
2760
|
alignItems: "flex-start",
|
|
2594
2761
|
justifyContent: "space-between"
|
|
2595
2762
|
},
|
|
2596
|
-
children: [/* @__PURE__ */ h(
|
|
2763
|
+
children: [/* @__PURE__ */ h(j, {
|
|
2597
2764
|
label: "Min:",
|
|
2598
2765
|
type: "number",
|
|
2599
|
-
style:
|
|
2600
|
-
value: V ? String(P) :
|
|
2766
|
+
style: le,
|
|
2767
|
+
value: V ? String(P) : ae,
|
|
2601
2768
|
min: P,
|
|
2602
|
-
max:
|
|
2603
|
-
onChange: (e) =>
|
|
2604
|
-
onBlur:
|
|
2605
|
-
onKeyDown:
|
|
2769
|
+
max: Et(Math.min(R, X[1] - B), B),
|
|
2770
|
+
onChange: (e) => oe(e.target.value),
|
|
2771
|
+
onBlur: ve,
|
|
2772
|
+
onKeyDown: be(ve),
|
|
2606
2773
|
disabled: V,
|
|
2607
|
-
isValid: V || !
|
|
2608
|
-
}), /* @__PURE__ */ h(
|
|
2774
|
+
isValid: V || !ne
|
|
2775
|
+
}), /* @__PURE__ */ h(j, {
|
|
2609
2776
|
label: "Max:",
|
|
2610
2777
|
type: "number",
|
|
2611
|
-
style:
|
|
2612
|
-
value: V ? String(F) :
|
|
2613
|
-
min:
|
|
2778
|
+
style: le,
|
|
2779
|
+
value: V ? String(F) : se,
|
|
2780
|
+
min: Et(Math.max(L, X[0] + B), B),
|
|
2614
2781
|
max: F,
|
|
2615
|
-
onChange: (e) =>
|
|
2616
|
-
onBlur:
|
|
2617
|
-
onKeyDown:
|
|
2782
|
+
onChange: (e) => ce(e.target.value),
|
|
2783
|
+
onBlur: ye,
|
|
2784
|
+
onKeyDown: be(ye),
|
|
2618
2785
|
disabled: V,
|
|
2619
|
-
isValid: V || !
|
|
2786
|
+
isValid: V || !ie
|
|
2620
2787
|
})]
|
|
2621
2788
|
})
|
|
2622
2789
|
]
|
|
2623
|
-
}) : /* @__PURE__ */ g(
|
|
2790
|
+
}) : /* @__PURE__ */ g(A, {
|
|
2624
2791
|
title: n,
|
|
2625
2792
|
className: ee,
|
|
2626
2793
|
children: [V && /* @__PURE__ */ g("div", {
|
|
2627
|
-
className:
|
|
2794
|
+
className: Ct.disabledMessage,
|
|
2628
2795
|
children: [
|
|
2629
2796
|
"No adjustable range (all results have the same value: ",
|
|
2630
2797
|
P,
|
|
@@ -2636,38 +2803,38 @@ var St = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
2636
2803
|
gap: "10px",
|
|
2637
2804
|
alignItems: "flex-start"
|
|
2638
2805
|
},
|
|
2639
|
-
children: [/* @__PURE__ */ h(
|
|
2806
|
+
children: [/* @__PURE__ */ h(j, {
|
|
2640
2807
|
label: "Min:",
|
|
2641
2808
|
type: "number",
|
|
2642
|
-
style:
|
|
2643
|
-
value: V ? String(P) :
|
|
2809
|
+
style: le,
|
|
2810
|
+
value: V ? String(P) : ae,
|
|
2644
2811
|
min: P,
|
|
2645
|
-
max:
|
|
2646
|
-
onChange: (e) =>
|
|
2647
|
-
onBlur:
|
|
2648
|
-
onKeyDown:
|
|
2812
|
+
max: Et(Math.min(R, X[1] - B), B),
|
|
2813
|
+
onChange: (e) => oe(e.target.value),
|
|
2814
|
+
onBlur: ve,
|
|
2815
|
+
onKeyDown: be(ve),
|
|
2649
2816
|
disabled: V,
|
|
2650
|
-
isValid: V || !
|
|
2651
|
-
}), /* @__PURE__ */ h(
|
|
2817
|
+
isValid: V || !ne
|
|
2818
|
+
}), /* @__PURE__ */ h(j, {
|
|
2652
2819
|
label: "Max:",
|
|
2653
2820
|
type: "number",
|
|
2654
|
-
style:
|
|
2655
|
-
value: V ? String(F) :
|
|
2656
|
-
min:
|
|
2821
|
+
style: le,
|
|
2822
|
+
value: V ? String(F) : se,
|
|
2823
|
+
min: Et(Math.max(L, X[0] + B), B),
|
|
2657
2824
|
max: F,
|
|
2658
|
-
onChange: (e) =>
|
|
2659
|
-
onBlur:
|
|
2660
|
-
onKeyDown:
|
|
2825
|
+
onChange: (e) => ce(e.target.value),
|
|
2826
|
+
onBlur: ye,
|
|
2827
|
+
onKeyDown: be(ye),
|
|
2661
2828
|
disabled: V,
|
|
2662
|
-
isValid: V || !
|
|
2829
|
+
isValid: V || !ie
|
|
2663
2830
|
})]
|
|
2664
2831
|
})]
|
|
2665
|
-
}) : /* @__PURE__ */ h(
|
|
2832
|
+
}) : /* @__PURE__ */ h(bt, {
|
|
2666
2833
|
label: n,
|
|
2667
2834
|
field: t,
|
|
2668
2835
|
missing: ["filterable"]
|
|
2669
2836
|
});
|
|
2670
|
-
},
|
|
2837
|
+
}, At = {
|
|
2671
2838
|
list: "_list_9je85_2",
|
|
2672
2839
|
grid: "_grid_9je85_9",
|
|
2673
2840
|
count: "_count_9je85_22",
|
|
@@ -2676,7 +2843,7 @@ var St = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
2676
2843
|
active: "_active_9je85_41"
|
|
2677
2844
|
};
|
|
2678
2845
|
// src/components/BucketFilterPanel.tsx
|
|
2679
|
-
function
|
|
2846
|
+
function jt(e, t) {
|
|
2680
2847
|
if (!t) return null;
|
|
2681
2848
|
let n = 0, r = !1;
|
|
2682
2849
|
for (let i of t) {
|
|
@@ -2688,16 +2855,16 @@ function wt(e, t) {
|
|
|
2688
2855
|
}
|
|
2689
2856
|
return r ? n : 0;
|
|
2690
2857
|
}
|
|
2691
|
-
var
|
|
2692
|
-
let { state: { facets: v, filterableFields: y, facetableFields: b, bucketFilters: x, rangeBounds:
|
|
2858
|
+
var Mt = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a, layout: c = "list", showCount: u = !0, showEmpty: d = !1, limit: f, showActivePanel: p = !1, collapsible: m = !0, startCollapsed: _ = !1 }) => {
|
|
2859
|
+
let { state: { facets: v, filterableFields: y, facetableFields: b, bucketFilters: x, rangeBounds: S, facetStats: w, query: E }, toggleBucketFilter: D, authError: O, isFetchingInitial: k, allowEmptySearch: j } = Ce(), M = i ?? a ?? "checkbox", N = v?.[e], F = x[e] ?? [], [I, L] = l(f ?? Infinity);
|
|
2693
2860
|
o(() => {
|
|
2694
2861
|
L(f ?? Infinity);
|
|
2695
|
-
}, [f,
|
|
2696
|
-
let R =
|
|
2862
|
+
}, [f, N]);
|
|
2863
|
+
let R = S?.[e] ?? w?.[e], z = s(() => {
|
|
2697
2864
|
let e = [];
|
|
2698
|
-
if (R && e.push(R.min, R.max), Array.isArray(
|
|
2699
|
-
return
|
|
2700
|
-
}, [R,
|
|
2865
|
+
if (R && e.push(R.min, R.max), Array.isArray(N)) for (let t of N) e.push(Number(t.key));
|
|
2866
|
+
return Tt(e.filter(Number.isFinite));
|
|
2867
|
+
}, [R, N]), B = s(() => {
|
|
2701
2868
|
let e = R?.min ?? -Number.MAX_VALUE, t = R?.max ?? Number.MAX_VALUE, i = (n, r, i) => ({
|
|
2702
2869
|
label: i ?? (n === void 0 ? `up to ${r}` : r === void 0 ? `${n} and up` : `${n}-${r}`),
|
|
2703
2870
|
range: {
|
|
@@ -2709,12 +2876,12 @@ var Tt = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2709
2876
|
if (r && r.length > 0) return r.map((e) => i(e.min, e.max, e.label));
|
|
2710
2877
|
if (Array.isArray(n)) {
|
|
2711
2878
|
let e = [...n].sort((e, t) => e - t), t = [];
|
|
2712
|
-
for (let n = 0; n < e.length - 1; n++) t.push(i(e[n],
|
|
2879
|
+
for (let n = 0; n < e.length - 1; n++) t.push(i(e[n], Et(e[n + 1] - z, z)));
|
|
2713
2880
|
return t;
|
|
2714
2881
|
}
|
|
2715
2882
|
if (typeof n == "number" && n > 0 && R) {
|
|
2716
2883
|
let e = [], t = Math.floor(R.min / n) * n;
|
|
2717
|
-
for (let r = t; r <= R.max; r =
|
|
2884
|
+
for (let r = t; r <= R.max; r = Et(r + n, z)) e.push(i(Et(r, z), Et(r + n - z, z)));
|
|
2718
2885
|
return e;
|
|
2719
2886
|
}
|
|
2720
2887
|
return [];
|
|
@@ -2724,28 +2891,28 @@ var Tt = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2724
2891
|
R,
|
|
2725
2892
|
z
|
|
2726
2893
|
]);
|
|
2727
|
-
if (
|
|
2728
|
-
if (
|
|
2894
|
+
if (O) return null;
|
|
2895
|
+
if (k || !v) return /* @__PURE__ */ h(_t, {
|
|
2729
2896
|
title: t,
|
|
2730
2897
|
rows: Math.max(1, Math.min(B.length || 5, 8)),
|
|
2731
2898
|
collapsible: m,
|
|
2732
2899
|
startCollapsed: _
|
|
2733
2900
|
});
|
|
2734
2901
|
if (!j && !E) return null;
|
|
2735
|
-
if (!y?.includes(e)) return /* @__PURE__ */ h(
|
|
2902
|
+
if (!y?.includes(e)) return /* @__PURE__ */ h(bt, {
|
|
2736
2903
|
label: t,
|
|
2737
2904
|
field: e,
|
|
2738
2905
|
missing: ["filterable"]
|
|
2739
2906
|
});
|
|
2740
|
-
let V = b?.includes(e) && Array.isArray(
|
|
2907
|
+
let V = b?.includes(e) && Array.isArray(N), H = (e) => F.some((t) => t.min === e.range.min && t.max === e.range.max), U = B.map((e) => ({
|
|
2741
2908
|
bucket: e,
|
|
2742
|
-
count: V ?
|
|
2909
|
+
count: V ? jt(e, N) : null
|
|
2743
2910
|
}));
|
|
2744
2911
|
if (d || (U = U.filter((e) => e.count !== 0 || H(e.bucket))), U.length === 0) return null;
|
|
2745
2912
|
let W = U.slice(0, I), G = (t, n) => {
|
|
2746
|
-
let r = H(t), i = n === 0 && !r, a = u && (n ?? 0) > 0 ? `${n}` : "", o = () => D(e, t.range,
|
|
2747
|
-
if (
|
|
2748
|
-
let n = /* @__PURE__ */ h(
|
|
2913
|
+
let r = H(t), i = n === 0 && !r, a = u && (n ?? 0) > 0 ? `${n}` : "", o = () => D(e, t.range, M === "radio");
|
|
2914
|
+
if (M === "radio") {
|
|
2915
|
+
let n = /* @__PURE__ */ h(P, {
|
|
2749
2916
|
id: `${e}-${t.range.min}-${t.range.max}`,
|
|
2750
2917
|
name: e,
|
|
2751
2918
|
value: t.label,
|
|
@@ -2755,43 +2922,43 @@ var Tt = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2755
2922
|
disabled: i
|
|
2756
2923
|
});
|
|
2757
2924
|
return c === "list" ? /* @__PURE__ */ g("div", {
|
|
2758
|
-
className:
|
|
2925
|
+
className: At.count,
|
|
2759
2926
|
children: [n, /* @__PURE__ */ h("span", {
|
|
2760
|
-
className:
|
|
2927
|
+
className: At.countValue,
|
|
2761
2928
|
children: a
|
|
2762
2929
|
})]
|
|
2763
2930
|
}) : n;
|
|
2764
2931
|
}
|
|
2765
|
-
if (
|
|
2766
|
-
let e = /* @__PURE__ */ h(
|
|
2932
|
+
if (M === "button") {
|
|
2933
|
+
let e = /* @__PURE__ */ h(C, {
|
|
2767
2934
|
variant: r ? "primary" : "secondary",
|
|
2768
2935
|
onClick: o,
|
|
2769
2936
|
disabled: i,
|
|
2770
2937
|
size: "micro",
|
|
2771
|
-
className:
|
|
2938
|
+
className: At.chip,
|
|
2772
2939
|
children: c === "grid" && a ? `${t.label} (${a})` : t.label
|
|
2773
2940
|
});
|
|
2774
2941
|
return c === "list" ? /* @__PURE__ */ g("div", {
|
|
2775
|
-
className:
|
|
2942
|
+
className: At.count,
|
|
2776
2943
|
children: [e, /* @__PURE__ */ h("span", {
|
|
2777
|
-
className:
|
|
2944
|
+
className: At.countValue,
|
|
2778
2945
|
children: a
|
|
2779
2946
|
})]
|
|
2780
2947
|
}) : e;
|
|
2781
2948
|
}
|
|
2782
2949
|
return c === "list" ? /* @__PURE__ */ g("div", {
|
|
2783
|
-
className:
|
|
2784
|
-
children: [/* @__PURE__ */ h(
|
|
2950
|
+
className: At.count,
|
|
2951
|
+
children: [/* @__PURE__ */ h(T, {
|
|
2785
2952
|
label: t.label,
|
|
2786
2953
|
score: "",
|
|
2787
2954
|
checked: r,
|
|
2788
2955
|
onChange: o,
|
|
2789
2956
|
disabled: i
|
|
2790
2957
|
}), /* @__PURE__ */ h("span", {
|
|
2791
|
-
className:
|
|
2958
|
+
className: At.countValue,
|
|
2792
2959
|
children: a
|
|
2793
2960
|
})]
|
|
2794
|
-
}) : /* @__PURE__ */ h(
|
|
2961
|
+
}) : /* @__PURE__ */ h(T, {
|
|
2795
2962
|
label: t.label,
|
|
2796
2963
|
score: a ? ` (${a})` : "",
|
|
2797
2964
|
checked: r,
|
|
@@ -2799,19 +2966,19 @@ var Tt = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2799
2966
|
disabled: i
|
|
2800
2967
|
});
|
|
2801
2968
|
};
|
|
2802
|
-
return /* @__PURE__ */ h(
|
|
2969
|
+
return /* @__PURE__ */ h(A, {
|
|
2803
2970
|
title: t,
|
|
2804
2971
|
collapsible: m,
|
|
2805
2972
|
collapsed: m ? _ : !1,
|
|
2806
|
-
className: p && F.length > 0 ?
|
|
2973
|
+
className: p && F.length > 0 ? At.active : void 0,
|
|
2807
2974
|
children: /* @__PURE__ */ g("ul", {
|
|
2808
|
-
className: c === "grid" ?
|
|
2975
|
+
className: c === "grid" ? At.grid : At.list,
|
|
2809
2976
|
style: {
|
|
2810
2977
|
listStyle: "none",
|
|
2811
2978
|
padding: 0,
|
|
2812
2979
|
margin: 0
|
|
2813
2980
|
},
|
|
2814
|
-
children: [W.map(({ bucket: e, count: t }) => /* @__PURE__ */ h("li", { children: G(e, t) }, `${e.range.min}-${e.range.max}`)), W.length < U.length && /* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(
|
|
2981
|
+
children: [W.map(({ bucket: e, count: t }) => /* @__PURE__ */ h("li", { children: G(e, t) }, `${e.range.min}-${e.range.max}`)), W.length < U.length && /* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(C, {
|
|
2815
2982
|
variant: "ghost",
|
|
2816
2983
|
size: "micro",
|
|
2817
2984
|
onClick: () => L(U.length),
|
|
@@ -2819,12 +2986,12 @@ var Tt = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2819
2986
|
}) })]
|
|
2820
2987
|
})
|
|
2821
2988
|
});
|
|
2822
|
-
},
|
|
2989
|
+
}, Nt = {
|
|
2823
2990
|
select: "_select_nwf7i_1",
|
|
2824
2991
|
radioGroup: "_radioGroup_nwf7i_6"
|
|
2825
|
-
},
|
|
2826
|
-
let o = n ?? (r === "radio" ? "radio" : "select"), { state: { sortableFields: s, sortBy: c, sortAscending: l }, setSort: u, isFetchingInitial: d } =
|
|
2827
|
-
if (d) return /* @__PURE__ */ h(
|
|
2992
|
+
}, Pt = ({ options: e, noneLabel: t = "None", control: n, displayType: r, collapsible: i = !0, startCollapsed: a = !1 }) => {
|
|
2993
|
+
let o = n ?? (r === "radio" ? "radio" : "select"), { state: { sortableFields: s, sortBy: c, sortAscending: l }, setSort: u, isFetchingInitial: d } = Ce();
|
|
2994
|
+
if (d) return /* @__PURE__ */ h(_t, {
|
|
2828
2995
|
title: "Sort by",
|
|
2829
2996
|
rows: o === "radio" ? 3 : 1,
|
|
2830
2997
|
collapsible: i,
|
|
@@ -2850,19 +3017,19 @@ var Tt = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2850
3017
|
u(t, n === "asc");
|
|
2851
3018
|
}
|
|
2852
3019
|
};
|
|
2853
|
-
return /* @__PURE__ */ h(
|
|
3020
|
+
return /* @__PURE__ */ h(A, {
|
|
2854
3021
|
title: "Sort by",
|
|
2855
3022
|
collapsible: i,
|
|
2856
3023
|
collapsed: i ? a : !1,
|
|
2857
|
-
children: o === "select" ? /* @__PURE__ */ h(
|
|
3024
|
+
children: o === "select" ? /* @__PURE__ */ h(I, {
|
|
2858
3025
|
value: f,
|
|
2859
3026
|
onValueChange: g,
|
|
2860
3027
|
options: m,
|
|
2861
3028
|
placeholder: "Select sort...",
|
|
2862
3029
|
"aria-label": "Sort by"
|
|
2863
3030
|
}) : /* @__PURE__ */ h("div", {
|
|
2864
|
-
className:
|
|
2865
|
-
children: m.map((e) => /* @__PURE__ */ h(
|
|
3031
|
+
className: Nt.radioGroup,
|
|
3032
|
+
children: m.map((e) => /* @__PURE__ */ h(P, {
|
|
2866
3033
|
id: `sort-${e.value}`,
|
|
2867
3034
|
name: "sort-by",
|
|
2868
3035
|
value: e.value,
|
|
@@ -2872,27 +3039,27 @@ var Tt = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2872
3039
|
}, e.value))
|
|
2873
3040
|
})
|
|
2874
3041
|
});
|
|
2875
|
-
},
|
|
3042
|
+
}, Ft = { list: "_list_1y4fk_1" }, It = {
|
|
2876
3043
|
tolerance: p.TwoEdits,
|
|
2877
3044
|
rungs: u.Fewest,
|
|
2878
3045
|
oneEditFrom: 3,
|
|
2879
3046
|
twoEditsFrom: 6,
|
|
2880
3047
|
threeEditsFrom: 9,
|
|
2881
|
-
typingPrefixFrom:
|
|
3048
|
+
typingPrefixFrom: 2,
|
|
2882
3049
|
typingPrefixOneEditFrom: 6,
|
|
2883
3050
|
joinedWords: !0
|
|
2884
|
-
},
|
|
3051
|
+
}, Lt = {
|
|
2885
3052
|
candidatesPerRow: 4,
|
|
2886
3053
|
fallback: !0,
|
|
2887
3054
|
rest: !1
|
|
2888
|
-
},
|
|
3055
|
+
}, Rt = {
|
|
2889
3056
|
rerank: !0,
|
|
2890
3057
|
share: .2,
|
|
2891
3058
|
typingShift: .5,
|
|
2892
3059
|
wholeQueryFloor: !0
|
|
2893
3060
|
};
|
|
2894
|
-
function
|
|
2895
|
-
let { state: { searchSettings: e }, setSearchSettings: t, url: n, team: r, dataset: i, authenticatedFetch: a } =
|
|
3061
|
+
function zt() {
|
|
3062
|
+
let { state: { searchSettings: e }, setSearchSettings: t, url: n, team: r, dataset: i, authenticatedFetch: a } = Ce(), [s, c] = l(!1), { match: f, candidates: _, ranking: v } = e, [y, b] = l(null);
|
|
2896
3063
|
o(() => {
|
|
2897
3064
|
let e = !0;
|
|
2898
3065
|
try {
|
|
@@ -2909,38 +3076,38 @@ function Mt() {
|
|
|
2909
3076
|
i,
|
|
2910
3077
|
a
|
|
2911
3078
|
]);
|
|
2912
|
-
let x = (e) => Object.fromEntries(Object.entries(e ?? {}).filter(([, e]) => e != null)),
|
|
2913
|
-
...
|
|
3079
|
+
let x = (e) => Object.fromEntries(Object.entries(e ?? {}).filter(([, e]) => e != null)), S = {
|
|
3080
|
+
...It,
|
|
2914
3081
|
...x(y?.match)
|
|
2915
3082
|
}, w = {
|
|
2916
|
-
...
|
|
3083
|
+
...Lt,
|
|
2917
3084
|
...x(y?.candidates)
|
|
2918
3085
|
}, T = {
|
|
2919
|
-
...
|
|
3086
|
+
...Rt,
|
|
2920
3087
|
...x(y?.ranking)
|
|
2921
|
-
}, E = e.mode ?? y?.mode ?? d.EditDistance, D = E === d.Bm25f,
|
|
3088
|
+
}, E = e.mode ?? y?.mode ?? d.EditDistance, D = E === d.Bm25f, O = v.rerank ?? T.rerank, k = D && !O, M = e.mode !== void 0 || [
|
|
2922
3089
|
f,
|
|
2923
3090
|
_,
|
|
2924
3091
|
v
|
|
2925
3092
|
].some((e) => Object.values(e ?? {}).some((e) => e != null)), N = (e, n) => {
|
|
2926
3093
|
let r = parseInt(n, 10);
|
|
2927
3094
|
isNaN(r) || t({ [e]: r });
|
|
2928
|
-
},
|
|
3095
|
+
}, P = (e, n) => {
|
|
2929
3096
|
t({ [e]: n });
|
|
2930
|
-
},
|
|
3097
|
+
}, F = (e) => t({ match: e }), L = (e) => t({ candidates: e }), R = (e) => t({ ranking: e }), B = (e, t) => {
|
|
2931
3098
|
let n = parseInt(e, 10);
|
|
2932
3099
|
isNaN(n) || t(n);
|
|
2933
|
-
},
|
|
3100
|
+
}, V = (e, t) => {
|
|
2934
3101
|
let n = parseFloat(e);
|
|
2935
3102
|
isNaN(n) || t(Math.max(0, Math.min(100, n)) / 100);
|
|
2936
3103
|
};
|
|
2937
|
-
return /* @__PURE__ */ h(
|
|
3104
|
+
return /* @__PURE__ */ h(A, {
|
|
2938
3105
|
collapsed: !0,
|
|
2939
3106
|
title: "Settings",
|
|
2940
3107
|
children: /* @__PURE__ */ g("ul", {
|
|
2941
|
-
className:
|
|
3108
|
+
className: Ft.list,
|
|
2942
3109
|
children: [
|
|
2943
|
-
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(
|
|
3110
|
+
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(I, {
|
|
2944
3111
|
label: "Mode",
|
|
2945
3112
|
size: "micro",
|
|
2946
3113
|
value: E,
|
|
@@ -2953,18 +3120,18 @@ function Mt() {
|
|
|
2953
3120
|
value: d.Bm25f
|
|
2954
3121
|
}]
|
|
2955
3122
|
}) }),
|
|
2956
|
-
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(
|
|
3123
|
+
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(H, {
|
|
2957
3124
|
label: "Rerank (Coverage)",
|
|
2958
|
-
checked:
|
|
2959
|
-
onChange: (e) =>
|
|
3125
|
+
checked: O,
|
|
3126
|
+
onChange: (e) => R({ rerank: e })
|
|
2960
3127
|
}) }),
|
|
2961
|
-
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(
|
|
3128
|
+
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(j, {
|
|
2962
3129
|
label: "Max Results",
|
|
2963
3130
|
type: "number",
|
|
2964
3131
|
value: e.maxNumberOfRecordsToReturn.toString(),
|
|
2965
3132
|
onChange: (e) => N("maxNumberOfRecordsToReturn", e.target.value)
|
|
2966
3133
|
}) }),
|
|
2967
|
-
/* @__PURE__ */ g("li", { children: [/* @__PURE__ */ h(
|
|
3134
|
+
/* @__PURE__ */ g("li", { children: [/* @__PURE__ */ h(j, {
|
|
2968
3135
|
label: "Minimum Score (16 bit)",
|
|
2969
3136
|
type: "number",
|
|
2970
3137
|
value: e.minimumScore.toString(),
|
|
@@ -2976,7 +3143,7 @@ function Mt() {
|
|
|
2976
3143
|
}
|
|
2977
3144
|
}), /* @__PURE__ */ h("div", {
|
|
2978
3145
|
style: { padding: "10px 10px 20px 10px" },
|
|
2979
|
-
children: /* @__PURE__ */ h(
|
|
3146
|
+
children: /* @__PURE__ */ h(z, {
|
|
2980
3147
|
min: 0,
|
|
2981
3148
|
max: 65535,
|
|
2982
3149
|
step: 1,
|
|
@@ -2987,7 +3154,7 @@ function Mt() {
|
|
|
2987
3154
|
"aria-label": "Minimum score"
|
|
2988
3155
|
})
|
|
2989
3156
|
})] }),
|
|
2990
|
-
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(
|
|
3157
|
+
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(j, {
|
|
2991
3158
|
label: "Placeholder text",
|
|
2992
3159
|
type: "text",
|
|
2993
3160
|
value: e.placeholderText,
|
|
@@ -2995,25 +3162,25 @@ function Mt() {
|
|
|
2995
3162
|
t({ placeholderText: e.target.value });
|
|
2996
3163
|
}
|
|
2997
3164
|
}) }),
|
|
2998
|
-
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(
|
|
3165
|
+
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(H, {
|
|
2999
3166
|
label: "Show score",
|
|
3000
3167
|
checked: e.showScore,
|
|
3001
|
-
onChange: (e) =>
|
|
3168
|
+
onChange: (e) => P("showScore", e)
|
|
3002
3169
|
}) }),
|
|
3003
|
-
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(
|
|
3170
|
+
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(C, {
|
|
3004
3171
|
variant: "ghost",
|
|
3005
3172
|
size: "micro",
|
|
3006
|
-
iconRight: h(s ?
|
|
3173
|
+
iconRight: h(s ? K : ee, {}),
|
|
3007
3174
|
onClick: () => c((e) => !e),
|
|
3008
3175
|
children: s ? "Hide Match, Candidates and Ranking" : "Show Match, Candidates and Ranking"
|
|
3009
3176
|
}) }),
|
|
3010
3177
|
s && /* @__PURE__ */ g(m, { children: [
|
|
3011
|
-
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(
|
|
3178
|
+
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(I, {
|
|
3012
3179
|
label: "Tolerance",
|
|
3013
3180
|
size: "micro",
|
|
3014
3181
|
disabled: D,
|
|
3015
|
-
value: f.tolerance ??
|
|
3016
|
-
onValueChange: (e) =>
|
|
3182
|
+
value: f.tolerance ?? S.tolerance,
|
|
3183
|
+
onValueChange: (e) => F({ tolerance: e }),
|
|
3017
3184
|
options: [
|
|
3018
3185
|
{
|
|
3019
3186
|
label: "Exact",
|
|
@@ -3033,93 +3200,93 @@ function Mt() {
|
|
|
3033
3200
|
}
|
|
3034
3201
|
]
|
|
3035
3202
|
}) }),
|
|
3036
|
-
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(
|
|
3203
|
+
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(H, {
|
|
3037
3204
|
label: "Every rung",
|
|
3038
3205
|
disabled: D,
|
|
3039
|
-
checked: (f.rungs ??
|
|
3040
|
-
onChange: (e) =>
|
|
3206
|
+
checked: (f.rungs ?? S.rungs) === u.All,
|
|
3207
|
+
onChange: (e) => F({ rungs: e ? u.All : u.Fewest })
|
|
3041
3208
|
}) }),
|
|
3042
|
-
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(
|
|
3209
|
+
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(j, {
|
|
3043
3210
|
label: "One edit from",
|
|
3044
3211
|
type: "number",
|
|
3045
3212
|
disabled: D,
|
|
3046
|
-
value: (f.oneEditFrom ??
|
|
3047
|
-
onChange: (e) =>
|
|
3213
|
+
value: (f.oneEditFrom ?? S.oneEditFrom).toString(),
|
|
3214
|
+
onChange: (e) => B(e.target.value, (e) => F({ oneEditFrom: e }))
|
|
3048
3215
|
}) }),
|
|
3049
|
-
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(
|
|
3216
|
+
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(j, {
|
|
3050
3217
|
label: "Two edits from",
|
|
3051
3218
|
type: "number",
|
|
3052
3219
|
disabled: D,
|
|
3053
|
-
value: (f.twoEditsFrom ??
|
|
3054
|
-
onChange: (e) =>
|
|
3220
|
+
value: (f.twoEditsFrom ?? S.twoEditsFrom).toString(),
|
|
3221
|
+
onChange: (e) => B(e.target.value, (e) => F({ twoEditsFrom: e }))
|
|
3055
3222
|
}) }),
|
|
3056
|
-
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(
|
|
3223
|
+
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(j, {
|
|
3057
3224
|
label: "Three edits from",
|
|
3058
3225
|
type: "number",
|
|
3059
3226
|
disabled: D,
|
|
3060
|
-
value: (f.threeEditsFrom ??
|
|
3061
|
-
onChange: (e) =>
|
|
3227
|
+
value: (f.threeEditsFrom ?? S.threeEditsFrom).toString(),
|
|
3228
|
+
onChange: (e) => B(e.target.value, (e) => F({ threeEditsFrom: e }))
|
|
3062
3229
|
}) }),
|
|
3063
|
-
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(
|
|
3230
|
+
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(j, {
|
|
3064
3231
|
label: "Typing prefix from",
|
|
3065
3232
|
type: "number",
|
|
3066
3233
|
disabled: D,
|
|
3067
|
-
value: (f.typingPrefixFrom ??
|
|
3068
|
-
onChange: (e) =>
|
|
3234
|
+
value: (f.typingPrefixFrom ?? S.typingPrefixFrom).toString(),
|
|
3235
|
+
onChange: (e) => B(e.target.value, (e) => F({ typingPrefixFrom: e }))
|
|
3069
3236
|
}) }),
|
|
3070
|
-
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(
|
|
3237
|
+
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(H, {
|
|
3071
3238
|
label: "Joined words",
|
|
3072
3239
|
disabled: D,
|
|
3073
|
-
checked: f.joinedWords ??
|
|
3074
|
-
onChange: (e) =>
|
|
3240
|
+
checked: f.joinedWords ?? S.joinedWords,
|
|
3241
|
+
onChange: (e) => F({ joinedWords: e })
|
|
3075
3242
|
}) }),
|
|
3076
|
-
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(
|
|
3243
|
+
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(j, {
|
|
3077
3244
|
label: "Candidates per row",
|
|
3078
3245
|
type: "number",
|
|
3079
|
-
disabled:
|
|
3246
|
+
disabled: k,
|
|
3080
3247
|
value: (_.candidatesPerRow ?? w.candidatesPerRow).toString(),
|
|
3081
|
-
onChange: (e) =>
|
|
3248
|
+
onChange: (e) => B(e.target.value, (e) => L({ candidatesPerRow: e }))
|
|
3082
3249
|
}) }),
|
|
3083
|
-
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(
|
|
3250
|
+
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(j, {
|
|
3084
3251
|
label: "Max candidates (0: per row)",
|
|
3085
3252
|
type: "number",
|
|
3086
|
-
disabled:
|
|
3253
|
+
disabled: k,
|
|
3087
3254
|
value: (_.maxCandidates ?? 0).toString(),
|
|
3088
|
-
onChange: (e) =>
|
|
3255
|
+
onChange: (e) => B(e.target.value, (e) => L({ maxCandidates: e > 0 ? e : null }))
|
|
3089
3256
|
}) }),
|
|
3090
|
-
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(
|
|
3257
|
+
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(H, {
|
|
3091
3258
|
label: "Fallback (most words when none holds every word)",
|
|
3092
3259
|
disabled: D,
|
|
3093
3260
|
checked: _.fallback ?? w.fallback,
|
|
3094
|
-
onChange: (e) =>
|
|
3261
|
+
onChange: (e) => L({ fallback: e })
|
|
3095
3262
|
}) }),
|
|
3096
|
-
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(
|
|
3263
|
+
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(H, {
|
|
3097
3264
|
label: "Rest (BM25F below the counted set)",
|
|
3098
3265
|
disabled: D,
|
|
3099
3266
|
checked: _.rest ?? w.rest,
|
|
3100
|
-
onChange: (e) =>
|
|
3267
|
+
onChange: (e) => L({ rest: e })
|
|
3101
3268
|
}) }),
|
|
3102
|
-
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(
|
|
3269
|
+
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(j, {
|
|
3103
3270
|
label: "Coverage share %",
|
|
3104
3271
|
type: "number",
|
|
3105
|
-
disabled: !
|
|
3272
|
+
disabled: !O,
|
|
3106
3273
|
value: Math.round((v.share ?? T.share) * 100).toString(),
|
|
3107
|
-
onChange: (e) =>
|
|
3274
|
+
onChange: (e) => V(e.target.value, (e) => R({ share: e }))
|
|
3108
3275
|
}) }),
|
|
3109
|
-
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(
|
|
3276
|
+
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(j, {
|
|
3110
3277
|
label: "Typing shift %",
|
|
3111
3278
|
type: "number",
|
|
3112
|
-
disabled: !
|
|
3279
|
+
disabled: !O,
|
|
3113
3280
|
value: Math.round((v.typingShift ?? T.typingShift) * 100).toString(),
|
|
3114
|
-
onChange: (e) =>
|
|
3281
|
+
onChange: (e) => V(e.target.value, (e) => R({ typingShift: e }))
|
|
3115
3282
|
}) }),
|
|
3116
|
-
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(
|
|
3283
|
+
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(H, {
|
|
3117
3284
|
label: "Whole query floor",
|
|
3118
|
-
disabled: !
|
|
3285
|
+
disabled: !O,
|
|
3119
3286
|
checked: v.wholeQueryFloor ?? T.wholeQueryFloor,
|
|
3120
|
-
onChange: (e) =>
|
|
3287
|
+
onChange: (e) => R({ wholeQueryFloor: e })
|
|
3121
3288
|
}) }),
|
|
3122
|
-
M && /* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(
|
|
3289
|
+
M && /* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(C, {
|
|
3123
3290
|
variant: "ghost",
|
|
3124
3291
|
size: "micro",
|
|
3125
3292
|
onClick: () => t({
|
|
@@ -3136,7 +3303,7 @@ function Mt() {
|
|
|
3136
3303
|
});
|
|
3137
3304
|
}
|
|
3138
3305
|
// src/components/SearchErrorBoundary.tsx
|
|
3139
|
-
var
|
|
3306
|
+
var Bt = class extends t {
|
|
3140
3307
|
constructor(e) {
|
|
3141
3308
|
super(e), this.state = {
|
|
3142
3309
|
hasError: !1,
|
|
@@ -3206,7 +3373,7 @@ var Nt = class extends t {
|
|
|
3206
3373
|
]
|
|
3207
3374
|
})]
|
|
3208
3375
|
}),
|
|
3209
|
-
/* @__PURE__ */ h(
|
|
3376
|
+
/* @__PURE__ */ h(C, {
|
|
3210
3377
|
variant: "primary",
|
|
3211
3378
|
size: "micro",
|
|
3212
3379
|
onClick: this.reset,
|
|
@@ -3217,8 +3384,8 @@ var Nt = class extends t {
|
|
|
3217
3384
|
}
|
|
3218
3385
|
};
|
|
3219
3386
|
// src/hooks/useVectorSearch.ts
|
|
3220
|
-
function
|
|
3221
|
-
let { url: n, team: r, dataset: a, authenticatedFetch: s } =
|
|
3387
|
+
function Vt(e, t) {
|
|
3388
|
+
let { url: n, team: r, dataset: a, authenticatedFetch: s } = Ce(), [u, d] = l(null), [f, p] = l(!1), [m, h] = l(void 0), g = c(0);
|
|
3222
3389
|
return o(() => () => {
|
|
3223
3390
|
g.current++;
|
|
3224
3391
|
}, [
|
|
@@ -3244,7 +3411,7 @@ function Pt(e, t) {
|
|
|
3244
3411
|
headers: { "Content-Type": "application/json" },
|
|
3245
3412
|
body: JSON.stringify(l)
|
|
3246
3413
|
});
|
|
3247
|
-
if (!u.ok) throw await
|
|
3414
|
+
if (!u.ok) throw await $.fromResponse("VectorSearch", u);
|
|
3248
3415
|
let f = await u.json();
|
|
3249
3416
|
if (!c()) return;
|
|
3250
3417
|
if (f.length === 0) {
|
|
@@ -3256,7 +3423,7 @@ function Pt(e, t) {
|
|
|
3256
3423
|
headers: { "Content-Type": "application/json" },
|
|
3257
3424
|
body: JSON.stringify(p)
|
|
3258
3425
|
});
|
|
3259
|
-
if (!m.ok) throw await
|
|
3426
|
+
if (!m.ok) throw await $.fromResponse("GetJson", m);
|
|
3260
3427
|
let h = await m.json();
|
|
3261
3428
|
if (!c()) return;
|
|
3262
3429
|
d(h.map((e, t) => ({
|
|
@@ -3283,8 +3450,8 @@ function Pt(e, t) {
|
|
|
3283
3450
|
};
|
|
3284
3451
|
}
|
|
3285
3452
|
// src/hooks/useHybridSearch.ts
|
|
3286
|
-
function
|
|
3287
|
-
let { url: n, team: r, dataset: a, authenticatedFetch: s } =
|
|
3453
|
+
function Ht(e, t) {
|
|
3454
|
+
let { url: n, team: r, dataset: a, authenticatedFetch: s } = Ce(), [u, d] = l(null), [f, p] = l(!1), [m, h] = l(void 0), g = c(0);
|
|
3288
3455
|
return o(() => () => {
|
|
3289
3456
|
g.current++;
|
|
3290
3457
|
}, [
|
|
@@ -3312,7 +3479,7 @@ function Ft(e, t) {
|
|
|
3312
3479
|
headers: { "Content-Type": "application/json" },
|
|
3313
3480
|
body: JSON.stringify(l)
|
|
3314
3481
|
});
|
|
3315
|
-
if (!u.ok) throw await
|
|
3482
|
+
if (!u.ok) throw await $.fromResponse("HybridSearch", u);
|
|
3316
3483
|
let f = await u.json();
|
|
3317
3484
|
if (!c()) return;
|
|
3318
3485
|
if (f.length === 0) {
|
|
@@ -3324,7 +3491,7 @@ function Ft(e, t) {
|
|
|
3324
3491
|
headers: { "Content-Type": "application/json" },
|
|
3325
3492
|
body: JSON.stringify(p)
|
|
3326
3493
|
});
|
|
3327
|
-
if (!m.ok) throw await
|
|
3494
|
+
if (!m.ok) throw await $.fromResponse("GetJson", m);
|
|
3328
3495
|
let h = await m.json();
|
|
3329
3496
|
if (!c()) return;
|
|
3330
3497
|
d(h.map((e, t) => ({
|
|
@@ -3353,7 +3520,7 @@ function Ft(e, t) {
|
|
|
3353
3520
|
};
|
|
3354
3521
|
}
|
|
3355
3522
|
// src/hooks/useAsk.ts
|
|
3356
|
-
var
|
|
3523
|
+
var Ut = {
|
|
3357
3524
|
question: "",
|
|
3358
3525
|
status: "idle",
|
|
3359
3526
|
answer: "",
|
|
@@ -3361,10 +3528,10 @@ var It = {
|
|
|
3361
3528
|
steps: [],
|
|
3362
3529
|
stepDetails: []
|
|
3363
3530
|
};
|
|
3364
|
-
function
|
|
3365
|
-
let e =
|
|
3531
|
+
function Wt() {
|
|
3532
|
+
let e = Ce(), { url: t, team: n, dataset: r, authenticatedFetch: a } = e, s = c(e);
|
|
3366
3533
|
s.current = e;
|
|
3367
|
-
let [u, d] = l(
|
|
3534
|
+
let [u, d] = l(Ut), f = c(u);
|
|
3368
3535
|
f.current = u;
|
|
3369
3536
|
let p = c(null), m = i(async (e, i = [], o = {}) => {
|
|
3370
3537
|
let c = e.trim();
|
|
@@ -3397,7 +3564,7 @@ function Lt() {
|
|
|
3397
3564
|
}
|
|
3398
3565
|
}));
|
|
3399
3566
|
try {
|
|
3400
|
-
let e = await a(`${t}/api/teams/${n}/datasets/${r}/search-or-ask/ask${
|
|
3567
|
+
let e = await a(`${t}/api/teams/${n}/datasets/${r}/search-or-ask/ask${Pe(s.current)}`, {
|
|
3401
3568
|
method: "POST",
|
|
3402
3569
|
headers: {
|
|
3403
3570
|
"Content-Type": "application/json",
|
|
@@ -3413,7 +3580,7 @@ function Lt() {
|
|
|
3413
3580
|
if (e.status === 429) {
|
|
3414
3581
|
let t = await e.json().catch(() => ({}));
|
|
3415
3582
|
if (o.proactive) {
|
|
3416
|
-
d(
|
|
3583
|
+
d(Ut);
|
|
3417
3584
|
return;
|
|
3418
3585
|
}
|
|
3419
3586
|
let n = Number(e.headers.get("Retry-After"));
|
|
@@ -3432,14 +3599,14 @@ function Lt() {
|
|
|
3432
3599
|
})), !e.ok || !e.body) {
|
|
3433
3600
|
let t = await e.json().catch(() => ({}));
|
|
3434
3601
|
if (o.proactive) {
|
|
3435
|
-
d(
|
|
3602
|
+
d(Ut);
|
|
3436
3603
|
return;
|
|
3437
3604
|
}
|
|
3438
3605
|
let n = e.status === 409 || e.status === 404;
|
|
3439
3606
|
g(t.code ?? `http${e.status}`, n ? "Answers are not available here right now. Search still works." : "The question could not be asked.");
|
|
3440
3607
|
return;
|
|
3441
3608
|
}
|
|
3442
|
-
for await (let { event: t, data: n } of
|
|
3609
|
+
for await (let { event: t, data: n } of Ne(e.body)) switch (t) {
|
|
3443
3610
|
case "status": {
|
|
3444
3611
|
let e = n;
|
|
3445
3612
|
e.step && d((t) => ({
|
|
@@ -3528,7 +3695,7 @@ function Lt() {
|
|
|
3528
3695
|
r,
|
|
3529
3696
|
a
|
|
3530
3697
|
]), g = i(() => p.current?.abort(), []), _ = i(() => {
|
|
3531
|
-
p.current?.abort(), d(
|
|
3698
|
+
p.current?.abort(), d(Ut);
|
|
3532
3699
|
}, []);
|
|
3533
3700
|
return o(() => () => p.current?.abort(), []), {
|
|
3534
3701
|
...u,
|
|
@@ -3539,7 +3706,89 @@ function Lt() {
|
|
|
3539
3706
|
busy: u.status === "searching" || u.status === "writing"
|
|
3540
3707
|
};
|
|
3541
3708
|
}
|
|
3542
|
-
|
|
3709
|
+
// src/hooks/useAskFlow.ts
|
|
3710
|
+
function Gt({ searchOrAsk: e, restore: t, settleMs: n = 350, maxWaitMs: r }) {
|
|
3711
|
+
let a = Ce(), { state: s, setQuery: c } = a, u = st({ auto: e }), [d, f] = l(null), [p, m] = l(0), [h, g] = l(!1), [_, v] = l("idle"), [y, b] = l(null), [x, S] = l(!0), [C, w] = l(!1), T = i((e, t) => {
|
|
3712
|
+
let n = e?.trim();
|
|
3713
|
+
n && (f(n), g(!!t?.proactive), m((e) => e + 1), v("idle"), S(!!t?.proactive), b(t?.proactive ? null : { phase: "asking" }));
|
|
3714
|
+
}, []), E = i((e) => {
|
|
3715
|
+
c(e), T(e);
|
|
3716
|
+
}, [c, T]), D = T, O = i(() => {
|
|
3717
|
+
f(null), m((e) => e + 1), b(null);
|
|
3718
|
+
}, []), k = i((e) => {
|
|
3719
|
+
h || (u.apply(e), e.sort && w(!0), b({
|
|
3720
|
+
phase: "applied",
|
|
3721
|
+
before: s.queryId
|
|
3722
|
+
}));
|
|
3723
|
+
}, [
|
|
3724
|
+
h,
|
|
3725
|
+
u,
|
|
3726
|
+
s.queryId
|
|
3727
|
+
]), A = i((e) => b(null), []);
|
|
3728
|
+
o(() => {
|
|
3729
|
+
if (y) {
|
|
3730
|
+
if (y.phase === "applied" && !s.isLoading && s.queryId !== y.before) {
|
|
3731
|
+
let e = setTimeout(() => b(null), n);
|
|
3732
|
+
return () => clearTimeout(e);
|
|
3733
|
+
}
|
|
3734
|
+
y.phase === "asking" && [
|
|
3735
|
+
"answered",
|
|
3736
|
+
"error",
|
|
3737
|
+
"limited"
|
|
3738
|
+
].includes(_) && b(null);
|
|
3739
|
+
}
|
|
3740
|
+
}, [
|
|
3741
|
+
y,
|
|
3742
|
+
s.isLoading,
|
|
3743
|
+
s.queryId,
|
|
3744
|
+
_,
|
|
3745
|
+
n
|
|
3746
|
+
]), o(() => {
|
|
3747
|
+
if (!y) return;
|
|
3748
|
+
let e = setTimeout(() => b(null), y.phase === "applied" ? r?.applied ?? 4e3 : r?.asking ?? 3e4);
|
|
3749
|
+
return () => clearTimeout(e);
|
|
3750
|
+
}, [
|
|
3751
|
+
y,
|
|
3752
|
+
r?.applied,
|
|
3753
|
+
r?.asking
|
|
3754
|
+
]);
|
|
3755
|
+
let j = i((e) => {
|
|
3756
|
+
e.key !== "Enter" && S(!0);
|
|
3757
|
+
}, []), M = i(() => {
|
|
3758
|
+
S(!0), C && (t?.(a), w(!1));
|
|
3759
|
+
}, [
|
|
3760
|
+
C,
|
|
3761
|
+
t,
|
|
3762
|
+
a
|
|
3763
|
+
]), N = s.query.trim(), P = d != null && !x;
|
|
3764
|
+
return {
|
|
3765
|
+
question: d,
|
|
3766
|
+
run: p,
|
|
3767
|
+
proactive: h,
|
|
3768
|
+
status: _,
|
|
3769
|
+
asked: P,
|
|
3770
|
+
waiting: P && y != null,
|
|
3771
|
+
offerShown: !P && (d == null || d !== N),
|
|
3772
|
+
ask: T,
|
|
3773
|
+
askExample: E,
|
|
3774
|
+
askHere: D,
|
|
3775
|
+
newConversation: O,
|
|
3776
|
+
inputProps: {
|
|
3777
|
+
searchOrAsk: e,
|
|
3778
|
+
onAsk: T,
|
|
3779
|
+
onKeyDown: j,
|
|
3780
|
+
onClear: M
|
|
3781
|
+
},
|
|
3782
|
+
panelProps: {
|
|
3783
|
+
question: d ?? "",
|
|
3784
|
+
proactive: h,
|
|
3785
|
+
onFilters: k,
|
|
3786
|
+
onPicks: A,
|
|
3787
|
+
onStatusChange: v
|
|
3788
|
+
}
|
|
3789
|
+
};
|
|
3790
|
+
}
|
|
3791
|
+
var Kt = {
|
|
3543
3792
|
panel: "_panel_gjc13_1",
|
|
3544
3793
|
thread: "_thread_gjc13_4",
|
|
3545
3794
|
fill: "_fill_gjc13_5",
|
|
@@ -3555,18 +3804,18 @@ var $ = {
|
|
|
3555
3804
|
searchedLabel: "_searchedLabel_gjc13_23",
|
|
3556
3805
|
steps: "_steps_gjc13_26",
|
|
3557
3806
|
stepDone: "_stepDone_gjc13_27"
|
|
3558
|
-
},
|
|
3559
|
-
function
|
|
3807
|
+
}, qt = /(`[^`\n]+`)|(\*\*[^*\n]+\*\*)|(\*[^*\n]+\*|_[^_\n]+_)|(\[[^\]\n]+\]\(https?:\/\/[^)\s]+\))|(\[\d+\])/g;
|
|
3808
|
+
function Jt(t, n, r) {
|
|
3560
3809
|
let i = [], a = 0, o = 0;
|
|
3561
|
-
for (let s of t.matchAll(
|
|
3810
|
+
for (let s of t.matchAll(qt)) {
|
|
3562
3811
|
s.index > a && i.push(t.slice(a, s.index));
|
|
3563
3812
|
let c = `${r}-${o++}`, [l, u, d, f, p, m] = s;
|
|
3564
3813
|
if (u) i.push(/* @__PURE__ */ h("code", {
|
|
3565
|
-
className:
|
|
3814
|
+
className: Kt.inlineCode,
|
|
3566
3815
|
children: u.slice(1, -1)
|
|
3567
3816
|
}, c));
|
|
3568
|
-
else if (d) i.push(/* @__PURE__ */ h("strong", { children:
|
|
3569
|
-
else if (f) i.push(/* @__PURE__ */ h("em", { children:
|
|
3817
|
+
else if (d) i.push(/* @__PURE__ */ h("strong", { children: Jt(d.slice(2, -2), n, c) }, c));
|
|
3818
|
+
else if (f) i.push(/* @__PURE__ */ h("em", { children: Jt(f.slice(1, -1), n, c) }, c));
|
|
3570
3819
|
else if (p) {
|
|
3571
3820
|
let [, e, t] = /^\[([^\]]+)\]\(([^)]+)\)$/.exec(p);
|
|
3572
3821
|
i.push(/* @__PURE__ */ h("a", {
|
|
@@ -3580,7 +3829,7 @@ function zt(t, n, r) {
|
|
|
3580
3829
|
}
|
|
3581
3830
|
return a < t.length && i.push(t.slice(a)), i;
|
|
3582
3831
|
}
|
|
3583
|
-
function
|
|
3832
|
+
function Yt(e) {
|
|
3584
3833
|
let t = e.replace(/\r\n/g, "\n").split("\n"), n = [], r = [], i = () => {
|
|
3585
3834
|
r.length && (n.push({
|
|
3586
3835
|
kind: "paragraph",
|
|
@@ -3629,101 +3878,101 @@ function Bt(e) {
|
|
|
3629
3878
|
}
|
|
3630
3879
|
return i(), n;
|
|
3631
3880
|
}
|
|
3632
|
-
function
|
|
3633
|
-
return
|
|
3881
|
+
function Xt(e, t) {
|
|
3882
|
+
return Yt(e).map((e, n) => {
|
|
3634
3883
|
let r = `b${n}`;
|
|
3635
3884
|
switch (e.kind) {
|
|
3636
3885
|
case "code": return /* @__PURE__ */ h("pre", {
|
|
3637
|
-
className:
|
|
3886
|
+
className: Kt.codeBlock,
|
|
3638
3887
|
"data-lang": e.lang || void 0,
|
|
3639
3888
|
children: /* @__PURE__ */ h("code", { children: e.text })
|
|
3640
3889
|
}, r);
|
|
3641
3890
|
case "heading": return /* @__PURE__ */ h("p", {
|
|
3642
|
-
className:
|
|
3643
|
-
children:
|
|
3891
|
+
className: Kt.heading,
|
|
3892
|
+
children: Jt(e.text, t, r)
|
|
3644
3893
|
}, r);
|
|
3645
3894
|
case "list": {
|
|
3646
3895
|
let n = e.ordered ? "ol" : "ul";
|
|
3647
3896
|
return /* @__PURE__ */ h(n, {
|
|
3648
|
-
className:
|
|
3649
|
-
children: e.items.map((e, n) => /* @__PURE__ */ h("li", { children:
|
|
3897
|
+
className: Kt.list,
|
|
3898
|
+
children: e.items.map((e, n) => /* @__PURE__ */ h("li", { children: Jt(e, t, `${r}-${n}`) }, n))
|
|
3650
3899
|
}, r);
|
|
3651
3900
|
}
|
|
3652
3901
|
default: return /* @__PURE__ */ h("p", {
|
|
3653
|
-
className:
|
|
3654
|
-
children:
|
|
3902
|
+
className: Kt.paragraph,
|
|
3903
|
+
children: Jt(e.text, t, r)
|
|
3655
3904
|
}, r);
|
|
3656
3905
|
}
|
|
3657
3906
|
});
|
|
3658
3907
|
}
|
|
3659
3908
|
// src/components/AskPanel.tsx
|
|
3660
|
-
var
|
|
3909
|
+
var Zt = /\[(\d+)\]/g, Qt = /* @__PURE__ */ new Set([
|
|
3661
3910
|
"nothingFound",
|
|
3662
3911
|
"searchOrAskDisabled",
|
|
3663
3912
|
"searchOrAskUnavailable",
|
|
3664
3913
|
"http404"
|
|
3665
3914
|
]);
|
|
3666
|
-
function
|
|
3915
|
+
function $t(e) {
|
|
3667
3916
|
let t = e.field.split(".")[0];
|
|
3668
3917
|
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;
|
|
3669
3918
|
}
|
|
3670
|
-
var
|
|
3671
|
-
let
|
|
3672
|
-
|
|
3673
|
-
let { ask:
|
|
3919
|
+
var en = ({ question: e, proactive: t = !1, followUps: n = !1, onSourceClick: r, label: i = "Answer", renderAnswer: a = Xt, onFollowUp: s, onStatusChange: u, onFilters: d, onPicks: f, listPicks: p = !0, filterLabel: m = $t, showSearched: S = !0, fill: w = !1, className: T = "" }) => {
|
|
3920
|
+
let A = Wt(), { showPicks: j } = Ce(), M = c(j);
|
|
3921
|
+
M.current = j, o(() => () => M.current?.(null), []);
|
|
3922
|
+
let { ask: N, reset: P, stop: F, status: I, openSource: L } = A, [R, z] = l(!1), [V, H] = l([]), [U, G] = l(""), K = c([]), ee = c(null), q = c(null), te = c(!0);
|
|
3674
3923
|
o(() => {
|
|
3675
|
-
H([]),
|
|
3924
|
+
H([]), K.current = [], M.current?.(null), e?.trim() ? N(e, [], { proactive: t }) : P();
|
|
3676
3925
|
}, [
|
|
3677
3926
|
e,
|
|
3678
|
-
|
|
3679
|
-
|
|
3927
|
+
N,
|
|
3928
|
+
P
|
|
3680
3929
|
]), o(() => {
|
|
3681
|
-
u?.(
|
|
3682
|
-
}, [
|
|
3683
|
-
let
|
|
3930
|
+
u?.(I);
|
|
3931
|
+
}, [I, u]);
|
|
3932
|
+
let J = c(void 0);
|
|
3684
3933
|
o(() => {
|
|
3685
|
-
|
|
3686
|
-
}, [
|
|
3687
|
-
let
|
|
3934
|
+
A.filters && A.filters !== J.current && (J.current = A.filters, d?.(A.filters));
|
|
3935
|
+
}, [A.filters, d]);
|
|
3936
|
+
let Y = c(void 0);
|
|
3688
3937
|
o(() => {
|
|
3689
|
-
if (
|
|
3690
|
-
|
|
3938
|
+
if (A.picks && A.picks !== Y.current) {
|
|
3939
|
+
Y.current = A.picks;
|
|
3691
3940
|
let e = {
|
|
3692
|
-
...
|
|
3693
|
-
askId:
|
|
3941
|
+
...A.picks,
|
|
3942
|
+
askId: A.picks.askId ?? A.askId
|
|
3694
3943
|
};
|
|
3695
|
-
f?.(e), p && !t &&
|
|
3944
|
+
f?.(e), p && !t && j?.(e);
|
|
3696
3945
|
}
|
|
3697
3946
|
}, [
|
|
3698
|
-
|
|
3699
|
-
|
|
3947
|
+
A.picks,
|
|
3948
|
+
A.askId,
|
|
3700
3949
|
f,
|
|
3701
3950
|
p,
|
|
3702
3951
|
t,
|
|
3703
|
-
|
|
3952
|
+
j
|
|
3704
3953
|
]), o(() => {
|
|
3705
|
-
let e =
|
|
3706
|
-
|
|
3954
|
+
let e = q.current;
|
|
3955
|
+
w && e && te.current && (e.scrollTop = e.scrollHeight);
|
|
3707
3956
|
}, [
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3957
|
+
w,
|
|
3958
|
+
A.answer,
|
|
3959
|
+
A.steps.length,
|
|
3960
|
+
I,
|
|
3961
|
+
V.length
|
|
3713
3962
|
]);
|
|
3714
|
-
let
|
|
3715
|
-
let e =
|
|
3716
|
-
e && (
|
|
3717
|
-
},
|
|
3718
|
-
className:
|
|
3963
|
+
let X = () => {
|
|
3964
|
+
let e = q.current;
|
|
3965
|
+
e && (te.current = e.scrollHeight - e.scrollTop - e.clientHeight < 40);
|
|
3966
|
+
}, Z = (e) => S && e && /* @__PURE__ */ g("div", {
|
|
3967
|
+
className: Kt.searched,
|
|
3719
3968
|
children: [
|
|
3720
3969
|
/* @__PURE__ */ g("span", {
|
|
3721
|
-
className:
|
|
3970
|
+
className: Kt.searchedLabel,
|
|
3722
3971
|
children: [e.more ? `${e.found}+` : e.found, " found"]
|
|
3723
3972
|
}),
|
|
3724
|
-
e.filters.map((e, t) => /* @__PURE__ */ h(
|
|
3973
|
+
e.filters.map((e, t) => /* @__PURE__ */ h(E, { children: m(e) }, t)),
|
|
3725
3974
|
e.text && /* @__PURE__ */ g("span", {
|
|
3726
|
-
className:
|
|
3975
|
+
className: Kt.searchedLabel,
|
|
3727
3976
|
children: [
|
|
3728
3977
|
"β",
|
|
3729
3978
|
e.text,
|
|
@@ -3731,7 +3980,7 @@ var Gt = ({ question: e, proactive: t = !1, followUps: n = !1, onSourceClick: r,
|
|
|
3731
3980
|
]
|
|
3732
3981
|
}),
|
|
3733
3982
|
e.sort && /* @__PURE__ */ g("span", {
|
|
3734
|
-
className:
|
|
3983
|
+
className: Kt.searchedLabel,
|
|
3735
3984
|
children: [
|
|
3736
3985
|
"sorted by ",
|
|
3737
3986
|
e.sort.field.split(".")[0],
|
|
@@ -3742,43 +3991,43 @@ var Gt = ({ question: e, proactive: t = !1, followUps: n = !1, onSourceClick: r,
|
|
|
3742
3991
|
})
|
|
3743
3992
|
]
|
|
3744
3993
|
});
|
|
3745
|
-
if (
|
|
3746
|
-
let
|
|
3747
|
-
n.preventDefault(),
|
|
3748
|
-
},
|
|
3994
|
+
if (I === "idle" && V.length === 0) return null;
|
|
3995
|
+
let ne = (e, t) => (n) => {
|
|
3996
|
+
n.preventDefault(), L(e, t), r?.(e);
|
|
3997
|
+
}, re = (e, t) => (n) => {
|
|
3749
3998
|
let i = e.find((e) => e.n === n);
|
|
3750
|
-
return /* @__PURE__ */ h(
|
|
3999
|
+
return /* @__PURE__ */ h(O, {
|
|
3751
4000
|
n,
|
|
3752
4001
|
title: i?.title,
|
|
3753
|
-
onClick: i && r ?
|
|
4002
|
+
onClick: i && r ? ne(i, t) : void 0
|
|
3754
4003
|
});
|
|
3755
|
-
},
|
|
3756
|
-
let r = new Set([...e.matchAll(
|
|
4004
|
+
}, ie = (e, t, n) => {
|
|
4005
|
+
let r = new Set([...e.matchAll(Zt)].map((e) => Number(e[1])));
|
|
3757
4006
|
return n && r.size > 0 ? t.filter((e) => r.has(e.n)) : t.slice(0, 3);
|
|
3758
|
-
},
|
|
3759
|
-
let o = a ? t :
|
|
3760
|
-
return o.length > 0 && /* @__PURE__ */ h(
|
|
4007
|
+
}, ae = (e, t, n, i, a = !1) => {
|
|
4008
|
+
let o = a ? t : ie(e, t, n);
|
|
4009
|
+
return o.length > 0 && /* @__PURE__ */ h(D, {
|
|
3761
4010
|
label: a ? "Picked" : void 0,
|
|
3762
4011
|
items: o.map((e) => ({
|
|
3763
4012
|
n: e.n,
|
|
3764
4013
|
title: e.title,
|
|
3765
|
-
onClick: r ?
|
|
4014
|
+
onClick: r ? ne(e, i) : void 0
|
|
3766
4015
|
}))
|
|
3767
4016
|
});
|
|
3768
4017
|
}, oe = () => {
|
|
3769
|
-
navigator.clipboard?.writeText(
|
|
4018
|
+
navigator.clipboard?.writeText(A.answer.replace(Zt, "")).catch(() => {}), z(!0), setTimeout(() => z(!1), 2e3);
|
|
3770
4019
|
}, se = (e) => {
|
|
3771
|
-
if (!
|
|
3772
|
-
if (
|
|
4020
|
+
if (!A.busy && e.trim()) {
|
|
4021
|
+
if (I === "answered" && A.answer) {
|
|
3773
4022
|
let e = {
|
|
3774
|
-
question:
|
|
3775
|
-
answer:
|
|
3776
|
-
sources:
|
|
3777
|
-
askId:
|
|
3778
|
-
filters:
|
|
3779
|
-
picks:
|
|
4023
|
+
question: A.question,
|
|
4024
|
+
answer: A.answer,
|
|
4025
|
+
sources: A.sources,
|
|
4026
|
+
askId: A.askId,
|
|
4027
|
+
filters: A.filters,
|
|
4028
|
+
picks: A.picks
|
|
3780
4029
|
};
|
|
3781
|
-
H((t) => [...t, e]),
|
|
4030
|
+
H((t) => [...t, e]), K.current = [...K.current, {
|
|
3782
4031
|
question: e.question,
|
|
3783
4032
|
answer: e.answer,
|
|
3784
4033
|
...e.picks ? { shown: { picks: e.picks.picks.map((e) => ({
|
|
@@ -3791,103 +4040,556 @@ var Gt = ({ question: e, proactive: t = !1, followUps: n = !1, onSourceClick: r,
|
|
|
3791
4040
|
} } : {}
|
|
3792
4041
|
}];
|
|
3793
4042
|
}
|
|
3794
|
-
|
|
4043
|
+
G(""), N(e, K.current);
|
|
3795
4044
|
}
|
|
3796
|
-
}, ce = n ? () =>
|
|
4045
|
+
}, ce = n ? () => ee.current?.focus() : s;
|
|
3797
4046
|
return /* @__PURE__ */ g("div", {
|
|
3798
|
-
className: `${
|
|
4047
|
+
className: `${Kt.panel} ${w ? Kt.fill : ""} ${T}`,
|
|
3799
4048
|
"aria-live": "polite",
|
|
3800
|
-
"aria-busy":
|
|
4049
|
+
"aria-busy": A.busy,
|
|
3801
4050
|
children: [/* @__PURE__ */ g("div", {
|
|
3802
|
-
ref:
|
|
3803
|
-
className:
|
|
3804
|
-
onScroll:
|
|
3805
|
-
children: [
|
|
3806
|
-
className:
|
|
3807
|
-
children: [/* @__PURE__ */ h(
|
|
4051
|
+
ref: q,
|
|
4052
|
+
className: Kt.thread,
|
|
4053
|
+
onScroll: w ? X : void 0,
|
|
4054
|
+
children: [V.map((e, t) => /* @__PURE__ */ g("div", {
|
|
4055
|
+
className: Kt.turn,
|
|
4056
|
+
children: [/* @__PURE__ */ h(W, { children: e.question }), /* @__PURE__ */ g(x, {
|
|
3808
4057
|
label: i,
|
|
3809
4058
|
children: [
|
|
3810
|
-
|
|
4059
|
+
Z(e.filters),
|
|
3811
4060
|
/* @__PURE__ */ h("div", {
|
|
3812
|
-
className:
|
|
3813
|
-
children: a(e.answer,
|
|
4061
|
+
className: Kt.answer,
|
|
4062
|
+
children: a(e.answer, re(e.sources, e.askId))
|
|
3814
4063
|
}),
|
|
3815
|
-
|
|
4064
|
+
ae(e.answer, e.sources, !0, e.askId, !!e.picks)
|
|
3816
4065
|
]
|
|
3817
4066
|
})]
|
|
3818
|
-
}, t)),
|
|
3819
|
-
className:
|
|
3820
|
-
children: [/* @__PURE__ */ h(
|
|
4067
|
+
}, t)), I !== "idle" && /* @__PURE__ */ g("div", {
|
|
4068
|
+
className: Kt.turn,
|
|
4069
|
+
children: [/* @__PURE__ */ h(W, { children: A.question }), /* @__PURE__ */ g(x, {
|
|
3821
4070
|
label: i,
|
|
3822
4071
|
children: [
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
className:
|
|
3826
|
-
children: a(
|
|
4072
|
+
Z(A.filters),
|
|
4073
|
+
A.answer && /* @__PURE__ */ h("div", {
|
|
4074
|
+
className: Kt.answer,
|
|
4075
|
+
children: a(A.answer, re(A.sources))
|
|
3827
4076
|
}),
|
|
3828
|
-
|
|
3829
|
-
className:
|
|
3830
|
-
children: [
|
|
3831
|
-
className:
|
|
4077
|
+
I === "searching" && A.steps.length > 0 && /* @__PURE__ */ g("div", {
|
|
4078
|
+
className: Kt.steps,
|
|
4079
|
+
children: [A.steps.slice(0, -1).map((e, t) => /* @__PURE__ */ h("span", {
|
|
4080
|
+
className: Kt.stepDone,
|
|
3832
4081
|
children: e
|
|
3833
|
-
}, t)), /* @__PURE__ */ g(
|
|
4082
|
+
}, t)), /* @__PURE__ */ g(B, { children: [A.steps[A.steps.length - 1], "β¦"] })]
|
|
3834
4083
|
}),
|
|
3835
|
-
|
|
3836
|
-
|
|
4084
|
+
I === "searching" && A.steps.length === 0 && /* @__PURE__ */ h(B, { children: "Searchingβ¦" }),
|
|
4085
|
+
I === "writing" && /* @__PURE__ */ h(B, {
|
|
3837
4086
|
spinner: "grow",
|
|
3838
4087
|
children: "Writingβ¦"
|
|
3839
4088
|
}),
|
|
3840
|
-
|
|
4089
|
+
I === "error" && /* @__PURE__ */ g(_, {
|
|
3841
4090
|
variant: "default",
|
|
3842
4091
|
icon: null,
|
|
3843
4092
|
children: [
|
|
3844
|
-
/* @__PURE__ */ h(y, { children:
|
|
3845
|
-
/* @__PURE__ */ h(v, { children:
|
|
3846
|
-
!
|
|
3847
|
-
className:
|
|
3848
|
-
children: /* @__PURE__ */ h(
|
|
4093
|
+
/* @__PURE__ */ h(y, { children: A.error?.code === "nothingFound" ? "Nothing to answer from" : "The answer did not come through" }),
|
|
4094
|
+
/* @__PURE__ */ h(v, { children: A.error?.code === "nothingFound" ? "The search found no records about this. Try other words, or search instead." : A.error?.message }),
|
|
4095
|
+
!Qt.has(A.error?.code ?? "") && /* @__PURE__ */ h("div", {
|
|
4096
|
+
className: Kt.action,
|
|
4097
|
+
children: /* @__PURE__ */ h(C, {
|
|
3849
4098
|
variant: "secondary",
|
|
3850
4099
|
size: "micro",
|
|
3851
|
-
iconLeft: /* @__PURE__ */ h(
|
|
3852
|
-
onClick: () =>
|
|
4100
|
+
iconLeft: /* @__PURE__ */ h(Q, {}),
|
|
4101
|
+
onClick: () => N(A.question, K.current),
|
|
3853
4102
|
children: "Try again"
|
|
3854
4103
|
})
|
|
3855
4104
|
})
|
|
3856
4105
|
]
|
|
3857
4106
|
}),
|
|
3858
|
-
|
|
4107
|
+
I === "limited" && A.limit === "budget" && /* @__PURE__ */ g(_, {
|
|
3859
4108
|
variant: "default",
|
|
3860
4109
|
icon: null,
|
|
3861
4110
|
children: [/* @__PURE__ */ h(y, { children: "No more answers today" }), /* @__PURE__ */ h(v, { children: "This site has answered all the questions it can for today. Search still works, and asking is back tomorrow." })]
|
|
3862
4111
|
}),
|
|
3863
|
-
|
|
4112
|
+
I === "limited" && A.limit !== "budget" && /* @__PURE__ */ g(_, {
|
|
3864
4113
|
variant: "default",
|
|
3865
4114
|
icon: null,
|
|
3866
4115
|
children: [/* @__PURE__ */ h(y, { children: "Too many questions for now" }), /* @__PURE__ */ g(v, { children: [
|
|
3867
4116
|
"You can ask again in about ",
|
|
3868
|
-
|
|
4117
|
+
A.retryAfterSeconds && A.retryAfterSeconds > 90 ? `${Math.ceil(A.retryAfterSeconds / 60)} minutes` : "a minute",
|
|
3869
4118
|
". Search still works in the meantime."
|
|
3870
4119
|
] })]
|
|
3871
4120
|
}),
|
|
3872
|
-
|
|
3873
|
-
|
|
4121
|
+
I !== "error" && I !== "limited" && ae(A.answer, A.sources, I === "answered", void 0, !!A.picks),
|
|
4122
|
+
I === "answered" && /* @__PURE__ */ h(b, {
|
|
3874
4123
|
onCopy: oe,
|
|
3875
|
-
copied:
|
|
4124
|
+
copied: R,
|
|
3876
4125
|
onFollowUp: ce
|
|
3877
4126
|
})
|
|
3878
4127
|
]
|
|
3879
4128
|
})]
|
|
3880
4129
|
})]
|
|
3881
|
-
}), n && /* @__PURE__ */ h(
|
|
3882
|
-
ref:
|
|
4130
|
+
}), n && /* @__PURE__ */ h(k, {
|
|
4131
|
+
ref: ee,
|
|
3883
4132
|
value: U,
|
|
3884
|
-
onChange:
|
|
4133
|
+
onChange: G,
|
|
3885
4134
|
onSend: se,
|
|
3886
|
-
onStop:
|
|
3887
|
-
streaming:
|
|
4135
|
+
onStop: F,
|
|
4136
|
+
streaming: A.busy,
|
|
3888
4137
|
placeholder: "Ask a follow-upβ¦",
|
|
3889
4138
|
"aria-label": "Ask a follow-up"
|
|
3890
4139
|
})]
|
|
3891
4140
|
});
|
|
4141
|
+
}, tn = {
|
|
4142
|
+
wrapper: "_wrapper_ssdz8_3",
|
|
4143
|
+
component: "_component_ssdz8_4",
|
|
4144
|
+
main: "_main_ssdz8_5",
|
|
4145
|
+
header: "_header_ssdz8_6",
|
|
4146
|
+
searchInput: "_searchInput_ssdz8_7",
|
|
4147
|
+
body: "_body_ssdz8_8",
|
|
4148
|
+
offer: "_offer_ssdz8_12",
|
|
4149
|
+
working: "_working_ssdz8_14",
|
|
4150
|
+
column: "_column_ssdz8_17",
|
|
4151
|
+
frame: "_frame_ssdz8_21",
|
|
4152
|
+
side: "_side_ssdz8_22",
|
|
4153
|
+
sidePanels: "_sidePanels_ssdz8_23",
|
|
4154
|
+
sideBody: "_sideBody_ssdz8_24",
|
|
4155
|
+
assistant: "_assistant_ssdz8_24",
|
|
4156
|
+
sideHead: "_sideHead_ssdz8_28",
|
|
4157
|
+
buttons: "_buttons_ssdz8_29",
|
|
4158
|
+
assistantHead: "_assistantHead_ssdz8_34",
|
|
4159
|
+
askFill: "_askFill_ssdz8_35",
|
|
4160
|
+
assistantEmpty: "_assistantEmpty_ssdz8_37",
|
|
4161
|
+
mobileBar: "_mobileBar_ssdz8_42",
|
|
4162
|
+
mobilePanel: "_mobilePanel_ssdz8_43",
|
|
4163
|
+
mobileBack: "_mobileBack_ssdz8_44"
|
|
4164
|
+
}, nn = {
|
|
4165
|
+
filters: "Filters",
|
|
4166
|
+
assistant: "Assistant",
|
|
4167
|
+
newConversation: "New conversation",
|
|
4168
|
+
searching: "The assistant is searchingβ¦",
|
|
4169
|
+
composer: "Ask the assistantβ¦",
|
|
4170
|
+
showResults: "Show results"
|
|
4171
|
+
};
|
|
4172
|
+
function rn(e, t) {
|
|
4173
|
+
let n = c(t);
|
|
4174
|
+
n.current = t, o(() => {
|
|
4175
|
+
e?.(n.current);
|
|
4176
|
+
}, [
|
|
4177
|
+
e,
|
|
4178
|
+
t.available,
|
|
4179
|
+
t.p,
|
|
4180
|
+
t.answerable,
|
|
4181
|
+
t.finished,
|
|
4182
|
+
t.found,
|
|
4183
|
+
t.criteria,
|
|
4184
|
+
t.offer,
|
|
4185
|
+
t.offerRow,
|
|
4186
|
+
t.offerKind,
|
|
4187
|
+
t.door,
|
|
4188
|
+
t.mode,
|
|
4189
|
+
t.held,
|
|
4190
|
+
t.notFound,
|
|
4191
|
+
t.text,
|
|
4192
|
+
t.refocus
|
|
4193
|
+
]);
|
|
4194
|
+
}
|
|
4195
|
+
function an(e, t) {
|
|
4196
|
+
let [n, r] = l(!1);
|
|
4197
|
+
return o(() => {
|
|
4198
|
+
if (!e.current || typeof ResizeObserver > "u") return;
|
|
4199
|
+
let n = new ResizeObserver(([e]) => r(e.contentRect.width <= t));
|
|
4200
|
+
return n.observe(e.current), () => n.disconnect();
|
|
4201
|
+
}, [e, t]), n;
|
|
4202
|
+
}
|
|
4203
|
+
function on({ intro: e, examples: t, onAsk: n, onExample: r, placeholder: i }) {
|
|
4204
|
+
let [a, o] = l("");
|
|
4205
|
+
return /* @__PURE__ */ g("div", {
|
|
4206
|
+
className: tn.assistantEmpty,
|
|
4207
|
+
children: [
|
|
4208
|
+
e && /* @__PURE__ */ h("p", { children: e }),
|
|
4209
|
+
t && t.length > 0 && /* @__PURE__ */ h(V, {
|
|
4210
|
+
items: t,
|
|
4211
|
+
onPick: r
|
|
4212
|
+
}),
|
|
4213
|
+
/* @__PURE__ */ h(k, {
|
|
4214
|
+
value: a,
|
|
4215
|
+
onChange: o,
|
|
4216
|
+
onSend: (e) => {
|
|
4217
|
+
o(""), n(e);
|
|
4218
|
+
},
|
|
4219
|
+
placeholder: i,
|
|
4220
|
+
"aria-label": i
|
|
4221
|
+
})
|
|
4222
|
+
]
|
|
4223
|
+
});
|
|
4224
|
+
}
|
|
4225
|
+
function sn({ text: e }) {
|
|
4226
|
+
return /* @__PURE__ */ h("div", {
|
|
4227
|
+
className: tn.working,
|
|
4228
|
+
children: /* @__PURE__ */ h(B, {
|
|
4229
|
+
spinner: "searching",
|
|
4230
|
+
children: e
|
|
4231
|
+
})
|
|
4232
|
+
});
|
|
4233
|
+
}
|
|
4234
|
+
function cn({ filters: e, renderResult: t, results: n, mode: r, intro: i, examples: a, restore: s, offer: u = "row", words: d, labels: f, placeholder: p, autoFocus: _ = !0, narrowBelow: v = 800, onJudged: y, className: b = "" }) {
|
|
4235
|
+
let x = {
|
|
4236
|
+
...nn,
|
|
4237
|
+
...f
|
|
4238
|
+
}, w = c(null), T = an(w, v), E = Re({ mode: r }), D = Gt({
|
|
4239
|
+
searchOrAsk: E,
|
|
4240
|
+
restore: s
|
|
4241
|
+
}), [O, k] = l("filters"), [A, j] = l(!1), [M, N] = l("");
|
|
4242
|
+
rn(y, E), o(() => {
|
|
4243
|
+
T || j(!1);
|
|
4244
|
+
}, [T]);
|
|
4245
|
+
let P = (e, t) => {
|
|
4246
|
+
D.ask(e, t), k("assistant"), T && j(!0);
|
|
4247
|
+
}, F = (e) => {
|
|
4248
|
+
N(""), P(e);
|
|
4249
|
+
}, I = (e) => {
|
|
4250
|
+
D.askExample(e), k("assistant"), T && j(!0);
|
|
4251
|
+
}, L = [{
|
|
4252
|
+
value: "filters",
|
|
4253
|
+
label: x.filters,
|
|
4254
|
+
icon: oe
|
|
4255
|
+
}, {
|
|
4256
|
+
value: "assistant",
|
|
4257
|
+
label: x.assistant,
|
|
4258
|
+
icon: G
|
|
4259
|
+
}], R = /* @__PURE__ */ h("div", {
|
|
4260
|
+
className: tn.buttons,
|
|
4261
|
+
role: "group",
|
|
4262
|
+
"aria-label": "Side panel",
|
|
4263
|
+
children: L.map((e) => /* @__PURE__ */ h(C, {
|
|
4264
|
+
size: "micro",
|
|
4265
|
+
variant: O === e.value ? "secondary" : "ghost",
|
|
4266
|
+
"aria-pressed": O === e.value,
|
|
4267
|
+
iconLeft: /* @__PURE__ */ h(e.icon, {}),
|
|
4268
|
+
onClick: () => k(e.value),
|
|
4269
|
+
children: e.label
|
|
4270
|
+
}, e.value))
|
|
4271
|
+
}), z = (e) => {
|
|
4272
|
+
A && O === e ? j(!1) : (k(e), j(!0));
|
|
4273
|
+
}, B = /* @__PURE__ */ g("div", {
|
|
4274
|
+
className: tn.side,
|
|
4275
|
+
children: [!T && /* @__PURE__ */ h("div", {
|
|
4276
|
+
className: tn.sideHead,
|
|
4277
|
+
children: R
|
|
4278
|
+
}), /* @__PURE__ */ g("div", {
|
|
4279
|
+
className: tn.sidePanels,
|
|
4280
|
+
children: [/* @__PURE__ */ h("div", {
|
|
4281
|
+
className: tn.sideBody,
|
|
4282
|
+
hidden: O !== "filters",
|
|
4283
|
+
children: e
|
|
4284
|
+
}), /* @__PURE__ */ h("div", {
|
|
4285
|
+
className: `${tn.sideBody} ${tn.assistant}`,
|
|
4286
|
+
hidden: O !== "assistant",
|
|
4287
|
+
children: D.question ? /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("div", {
|
|
4288
|
+
className: tn.assistantHead,
|
|
4289
|
+
children: /* @__PURE__ */ h(C, {
|
|
4290
|
+
variant: "ghost",
|
|
4291
|
+
size: "micro",
|
|
4292
|
+
iconLeft: /* @__PURE__ */ h(J, {}),
|
|
4293
|
+
onClick: D.newConversation,
|
|
4294
|
+
children: x.newConversation
|
|
4295
|
+
})
|
|
4296
|
+
}), /* @__PURE__ */ h(en, {
|
|
4297
|
+
...D.panelProps,
|
|
4298
|
+
followUps: !0,
|
|
4299
|
+
fill: !0,
|
|
4300
|
+
className: tn.askFill
|
|
4301
|
+
}, D.run)] }) : /* @__PURE__ */ h(on, {
|
|
4302
|
+
intro: i,
|
|
4303
|
+
examples: a,
|
|
4304
|
+
onAsk: F,
|
|
4305
|
+
onExample: I,
|
|
4306
|
+
placeholder: x.composer
|
|
4307
|
+
})
|
|
4308
|
+
})]
|
|
4309
|
+
})]
|
|
4310
|
+
});
|
|
4311
|
+
return /* @__PURE__ */ h("div", {
|
|
4312
|
+
className: `${tn.wrapper} ${b}`,
|
|
4313
|
+
ref: w,
|
|
4314
|
+
children: /* @__PURE__ */ g(S, {
|
|
4315
|
+
className: tn.component,
|
|
4316
|
+
children: [/* @__PURE__ */ g("div", {
|
|
4317
|
+
className: tn.main,
|
|
4318
|
+
children: [
|
|
4319
|
+
/* @__PURE__ */ h("div", {
|
|
4320
|
+
className: tn.header,
|
|
4321
|
+
children: /* @__PURE__ */ h(Ye, {
|
|
4322
|
+
showFocus: !1,
|
|
4323
|
+
className: tn.searchInput,
|
|
4324
|
+
autoFocus: _,
|
|
4325
|
+
askOffer: u === "row" ? "door" : "chip",
|
|
4326
|
+
...D.inputProps,
|
|
4327
|
+
onAsk: P,
|
|
4328
|
+
...p ? { placeholder: p } : {}
|
|
4329
|
+
})
|
|
4330
|
+
}),
|
|
4331
|
+
T && /* @__PURE__ */ g("div", {
|
|
4332
|
+
className: tn.mobileBar,
|
|
4333
|
+
children: [A && /* @__PURE__ */ h(C, {
|
|
4334
|
+
variant: "secondary",
|
|
4335
|
+
size: "micro",
|
|
4336
|
+
className: tn.mobileBack,
|
|
4337
|
+
onClick: () => j(!1),
|
|
4338
|
+
children: x.showResults
|
|
4339
|
+
}), L.map((e) => /* @__PURE__ */ h(C, {
|
|
4340
|
+
size: "micro",
|
|
4341
|
+
variant: A && O === e.value ? "primary" : "ghost",
|
|
4342
|
+
"aria-pressed": A && O === e.value,
|
|
4343
|
+
iconLeft: /* @__PURE__ */ h(e.icon, {}),
|
|
4344
|
+
onClick: () => z(e.value),
|
|
4345
|
+
children: e.label
|
|
4346
|
+
}, e.value))]
|
|
4347
|
+
}),
|
|
4348
|
+
T && A && /* @__PURE__ */ h("div", {
|
|
4349
|
+
className: tn.mobilePanel,
|
|
4350
|
+
children: B
|
|
4351
|
+
}),
|
|
4352
|
+
/* @__PURE__ */ g("div", {
|
|
4353
|
+
className: tn.body,
|
|
4354
|
+
hidden: T && A,
|
|
4355
|
+
children: [
|
|
4356
|
+
u === "row" && D.offerShown && /* @__PURE__ */ h(Ve, {
|
|
4357
|
+
searchOrAsk: E,
|
|
4358
|
+
onAsk: P,
|
|
4359
|
+
words: d,
|
|
4360
|
+
className: tn.offer
|
|
4361
|
+
}),
|
|
4362
|
+
D.waiting && /* @__PURE__ */ h(sn, { text: x.searching }),
|
|
4363
|
+
/* @__PURE__ */ h("div", {
|
|
4364
|
+
hidden: D.waiting,
|
|
4365
|
+
children: /* @__PURE__ */ h(ft, {
|
|
4366
|
+
...n,
|
|
4367
|
+
searchOrAsk: E,
|
|
4368
|
+
children: t
|
|
4369
|
+
})
|
|
4370
|
+
})
|
|
4371
|
+
]
|
|
4372
|
+
})
|
|
4373
|
+
]
|
|
4374
|
+
}), !T && /* @__PURE__ */ h("div", {
|
|
4375
|
+
className: tn.column,
|
|
4376
|
+
children: /* @__PURE__ */ h("div", {
|
|
4377
|
+
className: tn.frame,
|
|
4378
|
+
children: B
|
|
4379
|
+
})
|
|
4380
|
+
})]
|
|
4381
|
+
})
|
|
4382
|
+
});
|
|
4383
|
+
}
|
|
4384
|
+
var ln = {
|
|
4385
|
+
page: "_page_1kcpg_5",
|
|
4386
|
+
head: "_head_1kcpg_6",
|
|
4387
|
+
title: "_title_1kcpg_7",
|
|
4388
|
+
muted: "_muted_1kcpg_8",
|
|
4389
|
+
spacer: "_spacer_1kcpg_9",
|
|
4390
|
+
mode: "_mode_1kcpg_10",
|
|
4391
|
+
grid: "_grid_1kcpg_11",
|
|
4392
|
+
single: "_single_1kcpg_12",
|
|
4393
|
+
left: "_left_1kcpg_13",
|
|
4394
|
+
right: "_right_1kcpg_14",
|
|
4395
|
+
answer: "_answer_1kcpg_17",
|
|
4396
|
+
narrowBar: "_narrowBar_1kcpg_20",
|
|
4397
|
+
narrowLeft: "_narrowLeft_1kcpg_21"
|
|
4398
|
+
}, un = {
|
|
4399
|
+
filters: "Filters",
|
|
4400
|
+
backToSearch: "Back to search",
|
|
4401
|
+
assistant: "Assistant",
|
|
4402
|
+
searching: "The assistant is searchingβ¦"
|
|
4403
|
+
};
|
|
4404
|
+
function dn({ title: e, filters: t, renderResult: n, results: r, mode: i, examples: a, restore: o, words: s, labels: u, placeholder: d, autoFocus: f = !0, narrowBelow: p = 860, onJudged: _, className: v = "" }) {
|
|
4405
|
+
let y = {
|
|
4406
|
+
...un,
|
|
4407
|
+
...u
|
|
4408
|
+
}, b = c(null), x = an(b, p), { state: S, setQuery: w } = Ce(), T = Re({ mode: i }), E = Gt({
|
|
4409
|
+
searchOrAsk: T,
|
|
4410
|
+
restore: o
|
|
4411
|
+
}), [D, O] = l(!1);
|
|
4412
|
+
rn(_, T);
|
|
4413
|
+
let k = !!E.question && (!E.proactive || S.query.trim() === E.question);
|
|
4414
|
+
return /* @__PURE__ */ g("div", {
|
|
4415
|
+
className: `${ln.page} ${k ? ln.asking : ""} ${v}`,
|
|
4416
|
+
ref: b,
|
|
4417
|
+
children: [k ? /* @__PURE__ */ g("div", {
|
|
4418
|
+
className: ln.head,
|
|
4419
|
+
children: [
|
|
4420
|
+
/* @__PURE__ */ h(C, {
|
|
4421
|
+
variant: "ghost",
|
|
4422
|
+
size: "micro",
|
|
4423
|
+
iconLeft: /* @__PURE__ */ h(q, {}),
|
|
4424
|
+
onClick: () => {
|
|
4425
|
+
let e = E.question;
|
|
4426
|
+
E.newConversation(), e && w(e);
|
|
4427
|
+
},
|
|
4428
|
+
children: y.backToSearch
|
|
4429
|
+
}),
|
|
4430
|
+
/* @__PURE__ */ h("span", { className: ln.spacer }),
|
|
4431
|
+
/* @__PURE__ */ g("span", {
|
|
4432
|
+
className: ln.mode,
|
|
4433
|
+
children: [
|
|
4434
|
+
/* @__PURE__ */ h(G, {
|
|
4435
|
+
size: 14,
|
|
4436
|
+
color: "currentColor"
|
|
4437
|
+
}),
|
|
4438
|
+
" ",
|
|
4439
|
+
y.assistant
|
|
4440
|
+
]
|
|
4441
|
+
})
|
|
4442
|
+
]
|
|
4443
|
+
}) : e && /* @__PURE__ */ g("div", {
|
|
4444
|
+
className: ln.head,
|
|
4445
|
+
children: [/* @__PURE__ */ h("span", {
|
|
4446
|
+
className: ln.title,
|
|
4447
|
+
children: e
|
|
4448
|
+
}), S.totalDocumentCount != null && /* @__PURE__ */ h("span", {
|
|
4449
|
+
className: ln.muted,
|
|
4450
|
+
children: S.totalDocumentCount.toLocaleString("en")
|
|
4451
|
+
})]
|
|
4452
|
+
}), /* @__PURE__ */ g("div", {
|
|
4453
|
+
className: `${ln.grid} ${x || k ? ln.single : ""}`,
|
|
4454
|
+
children: [!k && !x && t && /* @__PURE__ */ h("aside", {
|
|
4455
|
+
className: ln.left,
|
|
4456
|
+
children: t
|
|
4457
|
+
}), /* @__PURE__ */ g("section", {
|
|
4458
|
+
className: ln.right,
|
|
4459
|
+
children: [
|
|
4460
|
+
!k && /* @__PURE__ */ g(m, { children: [
|
|
4461
|
+
/* @__PURE__ */ h(Ye, {
|
|
4462
|
+
showFocus: !1,
|
|
4463
|
+
autoFocus: f,
|
|
4464
|
+
askOffer: "door",
|
|
4465
|
+
...E.inputProps,
|
|
4466
|
+
...d ? { placeholder: d } : {}
|
|
4467
|
+
}),
|
|
4468
|
+
x && t && /* @__PURE__ */ h("div", {
|
|
4469
|
+
className: ln.narrowBar,
|
|
4470
|
+
children: /* @__PURE__ */ h(C, {
|
|
4471
|
+
variant: D ? "secondary" : "ghost",
|
|
4472
|
+
size: "micro",
|
|
4473
|
+
"aria-expanded": D,
|
|
4474
|
+
iconLeft: /* @__PURE__ */ h(oe, {}),
|
|
4475
|
+
onClick: () => O((e) => !e),
|
|
4476
|
+
children: y.filters
|
|
4477
|
+
})
|
|
4478
|
+
}),
|
|
4479
|
+
x && D && t && /* @__PURE__ */ h("div", {
|
|
4480
|
+
className: ln.narrowLeft,
|
|
4481
|
+
children: t
|
|
4482
|
+
}),
|
|
4483
|
+
E.offerShown && /* @__PURE__ */ h(Ve, {
|
|
4484
|
+
searchOrAsk: T,
|
|
4485
|
+
onAsk: E.ask,
|
|
4486
|
+
words: s
|
|
4487
|
+
}),
|
|
4488
|
+
!E.question && !S.query.trim() && a && a.length > 0 && /* @__PURE__ */ h(V, {
|
|
4489
|
+
items: a,
|
|
4490
|
+
onPick: E.askExample
|
|
4491
|
+
})
|
|
4492
|
+
] }),
|
|
4493
|
+
E.question && /* @__PURE__ */ h("div", {
|
|
4494
|
+
className: ln.answer,
|
|
4495
|
+
hidden: !k,
|
|
4496
|
+
children: /* @__PURE__ */ h(en, {
|
|
4497
|
+
...E.panelProps,
|
|
4498
|
+
followUps: !0
|
|
4499
|
+
}, E.run)
|
|
4500
|
+
}),
|
|
4501
|
+
k && E.waiting && /* @__PURE__ */ h(B, {
|
|
4502
|
+
spinner: "searching",
|
|
4503
|
+
children: y.searching
|
|
4504
|
+
}),
|
|
4505
|
+
/* @__PURE__ */ h("div", {
|
|
4506
|
+
hidden: k && E.waiting,
|
|
4507
|
+
children: /* @__PURE__ */ h(ft, {
|
|
4508
|
+
...r,
|
|
4509
|
+
searchOrAsk: T,
|
|
4510
|
+
children: n
|
|
4511
|
+
})
|
|
4512
|
+
})
|
|
4513
|
+
]
|
|
4514
|
+
})]
|
|
4515
|
+
})]
|
|
4516
|
+
});
|
|
4517
|
+
}
|
|
4518
|
+
// src/components/QuickAnswer.tsx
|
|
4519
|
+
var fn = ({ labels: e, ...t }) => /* @__PURE__ */ h(Ve, {
|
|
4520
|
+
...t,
|
|
4521
|
+
words: e && ((t) => ({
|
|
4522
|
+
text: t.row === "hint" ? e.hint : t.row === "thinking" ? e.thinking : void 0,
|
|
4523
|
+
action: t.row === "ready" ? e.ready : void 0
|
|
4524
|
+
}))
|
|
4525
|
+
}), pn = {
|
|
4526
|
+
panel: "_panel_mv793_2",
|
|
4527
|
+
empty: "_empty_mv793_3",
|
|
4528
|
+
intro: "_intro_mv793_5"
|
|
4529
|
+
}, mn = ({ title: e = "Help", launcherLabel: t = "Ask", intro: n, examples: r, actions: i, onSourceClick: a, open: o, onOpenChange: s, defaultOpen: c = !1, corner: u = "bottom-right", contained: d = !1, placeholder: f = "Ask a questionβ¦", className: p = "" }) => {
|
|
4530
|
+
let [_, v] = l(null), [y, b] = l(0), [x, S] = l(""), T = (e) => {
|
|
4531
|
+
let t = e.trim();
|
|
4532
|
+
t && (S(""), v(t), b((e) => e + 1));
|
|
4533
|
+
};
|
|
4534
|
+
return /* @__PURE__ */ h(w, {
|
|
4535
|
+
className: p,
|
|
4536
|
+
title: /* @__PURE__ */ g(m, { children: [
|
|
4537
|
+
/* @__PURE__ */ h(G, {
|
|
4538
|
+
size: 14,
|
|
4539
|
+
color: "currentColor"
|
|
4540
|
+
}),
|
|
4541
|
+
" ",
|
|
4542
|
+
e
|
|
4543
|
+
] }),
|
|
4544
|
+
"aria-label": e,
|
|
4545
|
+
label: t,
|
|
4546
|
+
open: o,
|
|
4547
|
+
onOpenChange: s,
|
|
4548
|
+
defaultOpen: c,
|
|
4549
|
+
corner: u,
|
|
4550
|
+
contained: d,
|
|
4551
|
+
headerActions: _ && /* @__PURE__ */ h(C, {
|
|
4552
|
+
variant: "ghost",
|
|
4553
|
+
size: "micro",
|
|
4554
|
+
iconLeft: /* @__PURE__ */ h(J, {}),
|
|
4555
|
+
onClick: () => {
|
|
4556
|
+
v(null), b((e) => e + 1);
|
|
4557
|
+
},
|
|
4558
|
+
"aria-label": "New conversation"
|
|
4559
|
+
}),
|
|
4560
|
+
footer: i && i.length > 0 && i.map((e) => /* @__PURE__ */ h(C, {
|
|
4561
|
+
variant: "secondary",
|
|
4562
|
+
size: "micro",
|
|
4563
|
+
onClick: e.onClick,
|
|
4564
|
+
children: e.label
|
|
4565
|
+
}, e.label)),
|
|
4566
|
+
children: _ ? /* @__PURE__ */ h(en, {
|
|
4567
|
+
question: _,
|
|
4568
|
+
followUps: !0,
|
|
4569
|
+
fill: !0,
|
|
4570
|
+
listPicks: !1,
|
|
4571
|
+
onSourceClick: a,
|
|
4572
|
+
className: pn.panel
|
|
4573
|
+
}, y) : /* @__PURE__ */ g("div", {
|
|
4574
|
+
className: pn.empty,
|
|
4575
|
+
children: [
|
|
4576
|
+
n && /* @__PURE__ */ h("p", {
|
|
4577
|
+
className: pn.intro,
|
|
4578
|
+
children: n
|
|
4579
|
+
}),
|
|
4580
|
+
r && r.length > 0 && /* @__PURE__ */ h(V, {
|
|
4581
|
+
items: r,
|
|
4582
|
+
onPick: T
|
|
4583
|
+
}),
|
|
4584
|
+
/* @__PURE__ */ h(k, {
|
|
4585
|
+
value: x,
|
|
4586
|
+
onChange: S,
|
|
4587
|
+
onSend: T,
|
|
4588
|
+
placeholder: f,
|
|
4589
|
+
"aria-label": f
|
|
4590
|
+
})
|
|
4591
|
+
]
|
|
4592
|
+
})
|
|
4593
|
+
});
|
|
3892
4594
|
};
|
|
3893
|
-
export {
|
|
4595
|
+
export { qe as ActiveFiltersPanel, mn as AskChat, Ve as AskOffer, en as AskPanel, Mt as BucketFilterPanel, Te as DEFAULT_THRESHOLDS, _t as FilterPanelSkeleton, $ as IndxApiError, fn as QuickAnswer, kt as RangeFilterPanel, je as STRICT_MATCH, xe as SearchContext, Bt as SearchErrorBoundary, Ye as SearchInput, cn as SearchOrAsk, dn as SearchPage, Se as SearchProvider, tt as SearchResult, mt as SearchResultRow, ft as SearchResults, Qe as SearchResultsMessage, it as SearchResultsSkeleton, zt as SearchSettingsPanel, ue as SearchSetupError, Pt as SortByPanel, St as ValueFilterPanel, Be as defaultOfferWords, de as describeSearchError, De as isIdentifier, ot as localFilters, Ae as nextOffer, we as pageMode, ke as triggers, Wt as useAsk, Gt as useAskFlow, st as useFilterSuggestion, Ht as useHybridSearch, Ce as useSearch, Ce as useSearchContext, Re as useSearchOrAsk, Vt as useVectorSearch };
|