@indxsearch/intrface 4.0.0-beta.3 → 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 +6 -0
- package/README.md +2 -1
- package/dist/context/SearchContext.d.ts +5 -0
- package/dist/context/useSearchExecution.d.ts +3 -1
- package/dist/index.cjs.js +3 -3
- package/dist/index.es.js +892 -854
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -3,9 +3,9 @@ import e, { Component as t, createContext as n, memo as r, useCallback as i, use
|
|
|
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
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
|
|
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 pe(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 pe(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 me({ 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 me({ 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 me({ 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 me({ 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 _e(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 ye({ 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
|
|
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 (
|
|
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:
|
|
447
|
+
countedTotal: X,
|
|
448
|
+
isFallback: Z,
|
|
427
449
|
toleranceCounts: ne,
|
|
428
450
|
countedTolerance: re,
|
|
429
|
-
ranked:
|
|
430
|
-
reranked:
|
|
431
|
-
fill:
|
|
432
|
-
queryId:
|
|
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)),
|
|
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,88 +503,103 @@ function ye({ 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 =
|
|
551
|
+
if (!O.current || !r.token || e.filterRevision === 0) return;
|
|
552
|
+
let t = x.trim();
|
|
516
553
|
if (d || t !== "") {
|
|
517
554
|
let t = e.pick?.revision === e.filterRevision ? e.pick : void 0;
|
|
518
|
-
|
|
555
|
+
w.current?.({
|
|
519
556
|
enableFacets: f,
|
|
520
557
|
pick: t
|
|
521
558
|
});
|
|
522
559
|
}
|
|
523
560
|
}, [e.filterRevision]), o(() => {
|
|
524
|
-
if (!
|
|
525
|
-
let e =
|
|
526
|
-
(d || e !== "") &&
|
|
527
|
-
}, [
|
|
528
|
-
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);
|
|
529
566
|
return o(() => {
|
|
530
|
-
if (
|
|
531
|
-
|
|
567
|
+
if (Y.current) {
|
|
568
|
+
Y.current = !1;
|
|
532
569
|
return;
|
|
533
570
|
}
|
|
534
|
-
if (
|
|
571
|
+
if (X.current !== x || !O.current || !r.token) return;
|
|
535
572
|
if (m.current) {
|
|
536
|
-
m.current = !1,
|
|
573
|
+
m.current = !1, w.current?.({ enableFacets: !1 });
|
|
537
574
|
return;
|
|
538
575
|
}
|
|
539
|
-
let e =
|
|
540
|
-
(d || e !== "") &&
|
|
576
|
+
let e = x.trim();
|
|
577
|
+
(d || e !== "") && w.current?.({ enableFacets: f });
|
|
541
578
|
}, [
|
|
542
|
-
j,
|
|
543
|
-
M,
|
|
544
|
-
N,
|
|
545
|
-
P,
|
|
546
579
|
F,
|
|
547
580
|
I,
|
|
548
|
-
L
|
|
581
|
+
L,
|
|
582
|
+
R,
|
|
583
|
+
z,
|
|
584
|
+
B,
|
|
585
|
+
V
|
|
549
586
|
]), o(() => {
|
|
550
|
-
|
|
551
|
-
}, [
|
|
552
|
-
|
|
587
|
+
X.current = x;
|
|
588
|
+
}, [x]), { retrySearch: i(() => {
|
|
589
|
+
w.current?.({ enableFacets: f });
|
|
553
590
|
}, [f]) };
|
|
554
591
|
}
|
|
555
|
-
function
|
|
592
|
+
function ve() {
|
|
556
593
|
if (typeof document < "u" && document.documentElement.lang) return document.documentElement.lang;
|
|
557
594
|
if (typeof navigator < "u" && navigator.language) return navigator.language;
|
|
558
595
|
}
|
|
559
596
|
// src/context/SearchContext.tsx
|
|
560
|
-
function
|
|
597
|
+
function ye() {
|
|
561
598
|
let e = globalThis.crypto;
|
|
562
599
|
return e?.randomUUID ? e.randomUUID() : Math.random().toString(36).slice(2) + Date.now().toString(36);
|
|
563
600
|
}
|
|
564
|
-
var
|
|
565
|
-
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({
|
|
566
603
|
query: "",
|
|
567
604
|
results: null,
|
|
568
605
|
isLoading: !1,
|
|
@@ -582,89 +619,90 @@ var Se = "Type to search", Ce = n(void 0), we = ({ children: e, url: t, team: n,
|
|
|
582
619
|
rangeBounds: {},
|
|
583
620
|
searchSettings: {
|
|
584
621
|
maxNumberOfRecordsToReturn: s,
|
|
585
|
-
mode:
|
|
586
|
-
match:
|
|
587
|
-
candidates:
|
|
588
|
-
ranking:
|
|
622
|
+
mode: p,
|
|
623
|
+
match: m,
|
|
624
|
+
candidates: g,
|
|
625
|
+
ranking: _,
|
|
589
626
|
minimumScore: 0,
|
|
590
627
|
showScore: !0,
|
|
591
|
-
placeholderText:
|
|
628
|
+
placeholderText: be
|
|
592
629
|
}
|
|
593
630
|
});
|
|
594
631
|
o(() => {
|
|
595
|
-
|
|
596
|
-
}, [
|
|
597
|
-
|
|
632
|
+
v && console.log("SearchContext mounted on client");
|
|
633
|
+
}, [v]), o(() => {
|
|
634
|
+
N((e) => ({
|
|
598
635
|
...e,
|
|
599
636
|
facetDebounceDelayMillis: u
|
|
600
637
|
}));
|
|
601
638
|
}, [u]);
|
|
602
|
-
let [
|
|
639
|
+
let [P] = l(f), F = fe({
|
|
603
640
|
url: t,
|
|
604
641
|
team: n,
|
|
605
642
|
dataset: r,
|
|
606
|
-
preAuthenticatedToken:
|
|
607
|
-
enableDebugLogs:
|
|
608
|
-
}),
|
|
609
|
-
if (!
|
|
643
|
+
preAuthenticatedToken: y,
|
|
644
|
+
enableDebugLogs: v
|
|
645
|
+
}), I = i((e, t = {}) => {
|
|
646
|
+
if (!F.token) throw Error("No authentication token available");
|
|
610
647
|
return fetch(e, {
|
|
611
648
|
...t,
|
|
612
649
|
headers: {
|
|
613
650
|
...t.headers,
|
|
614
|
-
Authorization: `Bearer ${
|
|
651
|
+
Authorization: `Bearer ${F.token}`
|
|
615
652
|
}
|
|
616
653
|
});
|
|
617
|
-
}, [
|
|
618
|
-
state:
|
|
619
|
-
setState:
|
|
620
|
-
authenticatedFetch:
|
|
621
|
-
auth:
|
|
654
|
+
}, [F.token]), { retrySearch: L } = _e({
|
|
655
|
+
state: M,
|
|
656
|
+
setState: N,
|
|
657
|
+
authenticatedFetch: I,
|
|
658
|
+
auth: F,
|
|
622
659
|
url: t,
|
|
623
660
|
team: n,
|
|
624
661
|
dataset: r,
|
|
625
662
|
allowEmptySearch: a,
|
|
626
|
-
facetsEnabled:
|
|
627
|
-
enableDebugLogs:
|
|
628
|
-
shouldFetchMore:
|
|
629
|
-
sessionId:
|
|
630
|
-
source:
|
|
631
|
-
locale:
|
|
632
|
-
count:
|
|
633
|
-
searchTextOf:
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
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);
|
|
639
677
|
try {
|
|
640
|
-
let i = await
|
|
678
|
+
let i = await I(`${t}/api/teams/${n}/datasets/${r}/events/select`, {
|
|
641
679
|
method: "POST",
|
|
642
680
|
headers: { "Content-Type": "application/json" },
|
|
643
681
|
body: JSON.stringify({
|
|
644
|
-
queryId:
|
|
682
|
+
queryId: R.current,
|
|
645
683
|
documentKey: e.documentKey,
|
|
646
684
|
position: e.position,
|
|
647
|
-
...
|
|
685
|
+
...S ? {} : { count: !1 }
|
|
648
686
|
})
|
|
649
687
|
});
|
|
650
|
-
|
|
688
|
+
v && (i.ok ? console.log(`[select] document ${e.documentKey} at position ${e.position}`) : console.warn(`[select] not recorded: ${i.status}`));
|
|
651
689
|
} catch (e) {
|
|
652
|
-
|
|
690
|
+
v && console.warn("[select] failed:", e);
|
|
653
691
|
}
|
|
654
692
|
}
|
|
655
693
|
}, [
|
|
656
|
-
|
|
657
|
-
|
|
694
|
+
F.token,
|
|
695
|
+
I,
|
|
658
696
|
t,
|
|
659
697
|
n,
|
|
660
698
|
r,
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
]),
|
|
664
|
-
if (!
|
|
665
|
-
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;
|
|
666
704
|
try {
|
|
667
|
-
let s = await
|
|
705
|
+
let s = await I(`${t}/api/teams/${n}/datasets/${r}/events/convert`, {
|
|
668
706
|
method: "POST",
|
|
669
707
|
headers: { "Content-Type": "application/json" },
|
|
670
708
|
body: JSON.stringify({
|
|
@@ -672,23 +710,23 @@ var Se = "Type to search", Ce = n(void 0), we = ({ children: e, url: t, team: n,
|
|
|
672
710
|
documentKey: e,
|
|
673
711
|
type: i.trim(),
|
|
674
712
|
...a?.quantity == null ? {} : { quantity: a.quantity },
|
|
675
|
-
...
|
|
713
|
+
...S ? {} : { count: !1 }
|
|
676
714
|
})
|
|
677
715
|
});
|
|
678
|
-
|
|
716
|
+
v && (s.ok ? console.log(`[convert] ${i} on document ${e}`) : console.warn(`[convert] not recorded: ${s.status}`));
|
|
679
717
|
} catch (e) {
|
|
680
|
-
|
|
718
|
+
v && console.warn("[convert] failed:", e);
|
|
681
719
|
}
|
|
682
720
|
}, [
|
|
683
|
-
|
|
684
|
-
|
|
721
|
+
F.token,
|
|
722
|
+
I,
|
|
685
723
|
t,
|
|
686
724
|
n,
|
|
687
725
|
r,
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
]),
|
|
691
|
-
|
|
726
|
+
v,
|
|
727
|
+
S
|
|
728
|
+
]), H = i((e) => {
|
|
729
|
+
N((t) => {
|
|
692
730
|
let n = Object.keys(t.filters).length > 0, r = Object.keys(t.rangeFilters).length > 0, i = Object.keys(t.bucketFilters).length > 0;
|
|
693
731
|
return {
|
|
694
732
|
...t,
|
|
@@ -698,17 +736,17 @@ var Se = "Type to search", Ce = n(void 0), we = ({ children: e, url: t, team: n,
|
|
|
698
736
|
bucketFilters: i ? {} : t.bucketFilters,
|
|
699
737
|
searchSettings: {
|
|
700
738
|
...t.searchSettings,
|
|
701
|
-
maxNumberOfRecordsToReturn:
|
|
739
|
+
maxNumberOfRecordsToReturn: j.current
|
|
702
740
|
}
|
|
703
741
|
};
|
|
704
742
|
});
|
|
705
|
-
}, []),
|
|
706
|
-
|
|
743
|
+
}, []), U = i((e) => {
|
|
744
|
+
N((t) => ({
|
|
707
745
|
...t,
|
|
708
746
|
facetDebounceDelayMillis: e
|
|
709
747
|
}));
|
|
710
|
-
}, []),
|
|
711
|
-
typeof e.maxNumberOfRecordsToReturn == "number" && (
|
|
748
|
+
}, []), W = i((e) => {
|
|
749
|
+
typeof e.maxNumberOfRecordsToReturn == "number" && (j.current = e.maxNumberOfRecordsToReturn), N((t) => {
|
|
712
750
|
let n = {
|
|
713
751
|
...t.searchSettings,
|
|
714
752
|
...e
|
|
@@ -721,16 +759,16 @@ var Se = "Type to search", Ce = n(void 0), we = ({ children: e, url: t, team: n,
|
|
|
721
759
|
searchSettings: n
|
|
722
760
|
};
|
|
723
761
|
});
|
|
724
|
-
}, []),
|
|
725
|
-
|
|
762
|
+
}, []), G = i((e) => {
|
|
763
|
+
w.current = !0, N((t) => ({
|
|
726
764
|
...t,
|
|
727
765
|
searchSettings: {
|
|
728
766
|
...t.searchSettings,
|
|
729
767
|
maxNumberOfRecordsToReturn: e
|
|
730
768
|
}
|
|
731
769
|
}));
|
|
732
|
-
}, []),
|
|
733
|
-
|
|
770
|
+
}, []), K = i((e, t, n = !1, r) => {
|
|
771
|
+
N((i) => {
|
|
734
772
|
let a = { ...i.filters }, o = a[e] || [], s = !o.includes(t), c = s ? n ? [t] : [...o, t] : o.filter((e) => e !== t);
|
|
735
773
|
return c.length ? a[e] = c : delete a[e], {
|
|
736
774
|
...i,
|
|
@@ -744,16 +782,16 @@ var Se = "Type to search", Ce = n(void 0), we = ({ children: e, url: t, team: n,
|
|
|
744
782
|
} : void 0
|
|
745
783
|
};
|
|
746
784
|
});
|
|
747
|
-
}, []),
|
|
748
|
-
|
|
785
|
+
}, []), ee = i((e, t) => {
|
|
786
|
+
N((n) => n.valueMatch[e] === t ? n : {
|
|
749
787
|
...n,
|
|
750
788
|
valueMatch: {
|
|
751
789
|
...n.valueMatch,
|
|
752
790
|
[e]: t
|
|
753
791
|
}
|
|
754
792
|
});
|
|
755
|
-
}, []),
|
|
756
|
-
|
|
793
|
+
}, []), q = i((e, t, n) => {
|
|
794
|
+
N((r) => ({
|
|
757
795
|
...r,
|
|
758
796
|
rangeFilters: {
|
|
759
797
|
...r.rangeFilters,
|
|
@@ -765,15 +803,15 @@ var Se = "Type to search", Ce = n(void 0), we = ({ children: e, url: t, team: n,
|
|
|
765
803
|
filterRevision: r.filterRevision + 1
|
|
766
804
|
}));
|
|
767
805
|
}, []), te = i(() => {
|
|
768
|
-
|
|
806
|
+
N((e) => ({
|
|
769
807
|
...e,
|
|
770
808
|
filters: {},
|
|
771
809
|
rangeFilters: {},
|
|
772
810
|
bucketFilters: {},
|
|
773
811
|
filterRevision: e.filterRevision + 1
|
|
774
812
|
}));
|
|
775
|
-
}, []),
|
|
776
|
-
|
|
813
|
+
}, []), J = i((e, t, n = !0) => {
|
|
814
|
+
N((r) => {
|
|
777
815
|
let i = { ...r.filters }, a = (i[e] || []).filter((e) => e !== t);
|
|
778
816
|
return a.length > 0 ? i[e] = a : delete i[e], {
|
|
779
817
|
...r,
|
|
@@ -781,8 +819,8 @@ var Se = "Type to search", Ce = n(void 0), we = ({ children: e, url: t, team: n,
|
|
|
781
819
|
filterRevision: r.filterRevision + +!!n
|
|
782
820
|
};
|
|
783
821
|
});
|
|
784
|
-
}, []),
|
|
785
|
-
|
|
822
|
+
}, []), Y = i((e, t = !0) => {
|
|
823
|
+
N((n) => {
|
|
786
824
|
if (!(e in n.rangeFilters)) return n;
|
|
787
825
|
let r = { ...n.rangeFilters };
|
|
788
826
|
return delete r[e], {
|
|
@@ -791,26 +829,26 @@ var Se = "Type to search", Ce = n(void 0), we = ({ children: e, url: t, team: n,
|
|
|
791
829
|
filterRevision: n.filterRevision + +!!t
|
|
792
830
|
};
|
|
793
831
|
});
|
|
794
|
-
}, []),
|
|
795
|
-
|
|
796
|
-
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 };
|
|
797
835
|
return a.length > 0 ? o[e] = a : delete o[e], {
|
|
798
836
|
...r,
|
|
799
837
|
bucketFilters: o,
|
|
800
838
|
filterRevision: r.filterRevision + 1
|
|
801
839
|
};
|
|
802
840
|
});
|
|
803
|
-
}, []),
|
|
804
|
-
|
|
805
|
-
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)) : [];
|
|
806
844
|
return a.length > 0 ? i[e] = a : delete i[e], {
|
|
807
845
|
...r,
|
|
808
846
|
bucketFilters: i,
|
|
809
847
|
filterRevision: r.filterRevision + +!!n
|
|
810
848
|
};
|
|
811
849
|
});
|
|
812
|
-
}, []),
|
|
813
|
-
let s = await
|
|
850
|
+
}, []), re = i(async (e, i, a, o) => {
|
|
851
|
+
let s = await I(`${t}/api/teams/${n}/datasets/${r}/facets/${encodeURIComponent(e)}/search`, {
|
|
814
852
|
method: "POST",
|
|
815
853
|
headers: { "Content-Type": "application/json" },
|
|
816
854
|
body: JSON.stringify({
|
|
@@ -829,67 +867,67 @@ var Se = "Type to search", Ce = n(void 0), we = ({ children: e, url: t, team: n,
|
|
|
829
867
|
t,
|
|
830
868
|
n,
|
|
831
869
|
r,
|
|
832
|
-
|
|
833
|
-
]),
|
|
834
|
-
|
|
870
|
+
I
|
|
871
|
+
]), ie = i((e, t) => {
|
|
872
|
+
N((n) => ({
|
|
835
873
|
...n,
|
|
836
874
|
sortBy: e || void 0,
|
|
837
875
|
sortAscending: e ? t : void 0
|
|
838
876
|
}));
|
|
839
877
|
}, []);
|
|
840
|
-
return /* @__PURE__ */ h(
|
|
878
|
+
return /* @__PURE__ */ h(xe.Provider, {
|
|
841
879
|
value: {
|
|
842
|
-
state:
|
|
843
|
-
isFetchingInitial:
|
|
844
|
-
authError:
|
|
845
|
-
authErrorInfo:
|
|
846
|
-
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,
|
|
847
885
|
allowEmptySearch: a,
|
|
848
|
-
facetsEnabled:
|
|
849
|
-
datasetBounds:
|
|
886
|
+
facetsEnabled: P,
|
|
887
|
+
datasetBounds: F.initialFacetStats,
|
|
850
888
|
url: t,
|
|
851
889
|
team: n,
|
|
852
890
|
dataset: r,
|
|
853
|
-
authenticatedFetch:
|
|
854
|
-
setQuery:
|
|
855
|
-
toggleFilter:
|
|
856
|
-
setValueMatch:
|
|
857
|
-
setRangeFilter:
|
|
891
|
+
authenticatedFetch: I,
|
|
892
|
+
setQuery: H,
|
|
893
|
+
toggleFilter: K,
|
|
894
|
+
setValueMatch: ee,
|
|
895
|
+
setRangeFilter: q,
|
|
858
896
|
resetFilters: te,
|
|
859
|
-
resetSingleFilter:
|
|
860
|
-
resetRangeFilter:
|
|
861
|
-
toggleBucketFilter:
|
|
862
|
-
resetBucketFilter:
|
|
863
|
-
setSort:
|
|
864
|
-
setDebounceDelay:
|
|
865
|
-
setSearchSettings:
|
|
866
|
-
fetchMoreResults:
|
|
867
|
-
selectResult:
|
|
868
|
-
convertResult:
|
|
869
|
-
sessionId:
|
|
870
|
-
source:
|
|
871
|
-
count:
|
|
872
|
-
searchText:
|
|
873
|
-
picks:
|
|
874
|
-
showPicks: (e) =>
|
|
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 ? {
|
|
875
913
|
picks: e,
|
|
876
|
-
query:
|
|
914
|
+
query: M.query
|
|
877
915
|
} : null),
|
|
878
|
-
searchAsTyped: () =>
|
|
879
|
-
searchFacetValues:
|
|
916
|
+
searchAsTyped: () => D(M.query),
|
|
917
|
+
searchFacetValues: re
|
|
880
918
|
},
|
|
881
919
|
children: e
|
|
882
920
|
});
|
|
883
|
-
},
|
|
884
|
-
let e = a(
|
|
921
|
+
}, Ce = () => {
|
|
922
|
+
let e = a(xe);
|
|
885
923
|
if (!e) throw Error("useSearchContext must be used within a SearchProvider");
|
|
886
924
|
return e;
|
|
887
925
|
};
|
|
888
926
|
// src/utils/searchOrAsk.ts
|
|
889
|
-
function
|
|
927
|
+
function we(e, t) {
|
|
890
928
|
return t ? t === "proactive" && e !== "proactive" ? "inviting" : t : e;
|
|
891
929
|
}
|
|
892
|
-
var
|
|
930
|
+
var Te = {
|
|
893
931
|
strong: .65,
|
|
894
932
|
strongHide: .45,
|
|
895
933
|
invite: .4,
|
|
@@ -898,32 +936,32 @@ var De = {
|
|
|
898
936
|
finished: .5,
|
|
899
937
|
found: .3,
|
|
900
938
|
refocus: 0
|
|
901
|
-
},
|
|
902
|
-
function
|
|
939
|
+
}, Ee = /^[\d\s\-_.:/]+$|^\w+\.\w+|^[A-Za-z]*[a-z][A-Z]\w*$|^[A-Za-z]+[-_]?\d[\w-]*$/;
|
|
940
|
+
function De(e) {
|
|
903
941
|
let t = e.trim();
|
|
904
|
-
return t.length > 0 && !t.includes(" ") &&
|
|
942
|
+
return t.length > 0 && !t.includes(" ") && Ee.test(t);
|
|
905
943
|
}
|
|
906
|
-
function
|
|
944
|
+
function Oe(e) {
|
|
907
945
|
let t = e.trim();
|
|
908
|
-
return !!t && !
|
|
946
|
+
return !!t && !De(t) && (t.endsWith("?") || t.split(/\s+/).length >= 3);
|
|
909
947
|
}
|
|
910
|
-
function
|
|
948
|
+
function ke(e, t = 4) {
|
|
911
949
|
let n = e.trim();
|
|
912
|
-
return !n ||
|
|
950
|
+
return !n || De(n) ? !1 : Oe(n) || n.length >= t;
|
|
913
951
|
}
|
|
914
|
-
function
|
|
952
|
+
function Ae(e, t, n = Te) {
|
|
915
953
|
return t >= n.strong || e === "strong" && t >= n.strongHide ? "strong" : t >= n.invite || e !== "none" && t >= n.inviteHide ? "invite" : "none";
|
|
916
954
|
}
|
|
917
|
-
var
|
|
955
|
+
var je = {
|
|
918
956
|
tolerance: p.Exact,
|
|
919
957
|
typingPrefixFrom: 0,
|
|
920
958
|
joinedWords: !1
|
|
921
959
|
};
|
|
922
|
-
function
|
|
960
|
+
function Me(e) {
|
|
923
961
|
let t = e.trim();
|
|
924
962
|
return t.includes(" ") || t.endsWith("?");
|
|
925
963
|
}
|
|
926
|
-
async function*
|
|
964
|
+
async function* Ne(e) {
|
|
927
965
|
let t = e.getReader(), n = new TextDecoder(), r = "";
|
|
928
966
|
try {
|
|
929
967
|
for (;;) {
|
|
@@ -946,24 +984,24 @@ async function* Fe(e) {
|
|
|
946
984
|
t.releaseLock();
|
|
947
985
|
}
|
|
948
986
|
}
|
|
949
|
-
function
|
|
987
|
+
function Pe(e) {
|
|
950
988
|
let t = new URLSearchParams();
|
|
951
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");
|
|
952
990
|
let n = t.toString();
|
|
953
991
|
return n ? `?${n}` : "";
|
|
954
992
|
}
|
|
955
993
|
// src/hooks/useSearchOrAsk.ts
|
|
956
|
-
function
|
|
994
|
+
function Fe(e) {
|
|
957
995
|
return {
|
|
958
|
-
...
|
|
996
|
+
...Te,
|
|
959
997
|
...e,
|
|
960
|
-
hint: e?.hint ??
|
|
961
|
-
finished: e?.finished ??
|
|
962
|
-
found: e?.found ??
|
|
963
|
-
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
|
|
964
1002
|
};
|
|
965
1003
|
}
|
|
966
|
-
var
|
|
1004
|
+
var Ie = .1, Le = {
|
|
967
1005
|
available: !1,
|
|
968
1006
|
offer: "none",
|
|
969
1007
|
p: null,
|
|
@@ -988,13 +1026,13 @@ var Re = .1, ze = {
|
|
|
988
1026
|
offerKind: null,
|
|
989
1027
|
enterAsks: !1
|
|
990
1028
|
};
|
|
991
|
-
function
|
|
992
|
-
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);
|
|
993
1031
|
_.current = s;
|
|
994
|
-
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);
|
|
995
1033
|
D.current = i;
|
|
996
1034
|
let O = { get current() {
|
|
997
|
-
return
|
|
1035
|
+
return we(E.current, D.current);
|
|
998
1036
|
} }, k = c(null), A = c("none"), j = c(""), M = c(0), N = c(0);
|
|
999
1037
|
A.current = x.offer;
|
|
1000
1038
|
let P = c(null), F = c(/* @__PURE__ */ new Set()), I = c(0), L = c(v);
|
|
@@ -1017,7 +1055,7 @@ function Be(e = {}) {
|
|
|
1017
1055
|
if (!t.ok) return;
|
|
1018
1056
|
let n = await t.json();
|
|
1019
1057
|
if (e || !n.available || !n.settings?.enabled) return;
|
|
1020
|
-
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);
|
|
1021
1059
|
} catch {}
|
|
1022
1060
|
})(), () => {
|
|
1023
1061
|
e = !0;
|
|
@@ -1029,7 +1067,7 @@ function Be(e = {}) {
|
|
|
1029
1067
|
]);
|
|
1030
1068
|
let K = c(() => {});
|
|
1031
1069
|
K.current = (e) => {
|
|
1032
|
-
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;
|
|
1033
1071
|
let t = (async () => {
|
|
1034
1072
|
try {
|
|
1035
1073
|
let t = await p(`${V}/intent`, {
|
|
@@ -1056,18 +1094,18 @@ function Be(e = {}) {
|
|
|
1056
1094
|
});
|
|
1057
1095
|
}, o(() => {
|
|
1058
1096
|
if (!y) {
|
|
1059
|
-
S(
|
|
1097
|
+
S(Le);
|
|
1060
1098
|
return;
|
|
1061
1099
|
}
|
|
1062
1100
|
if (!v) {
|
|
1063
1101
|
j.current = "", S({
|
|
1064
|
-
...
|
|
1102
|
+
...Le,
|
|
1065
1103
|
available: y
|
|
1066
1104
|
});
|
|
1067
1105
|
return;
|
|
1068
1106
|
}
|
|
1069
|
-
if (!
|
|
1070
|
-
|
|
1107
|
+
if (!ke(v, H())) {
|
|
1108
|
+
De(v) && S((e) => ({
|
|
1071
1109
|
...e,
|
|
1072
1110
|
available: y,
|
|
1073
1111
|
offer: "none",
|
|
@@ -1088,7 +1126,7 @@ function Be(e = {}) {
|
|
|
1088
1126
|
let t = ++M.current;
|
|
1089
1127
|
j.current = v;
|
|
1090
1128
|
try {
|
|
1091
|
-
let e = await p(`${V}/intent${
|
|
1129
|
+
let e = await p(`${V}/intent${Pe(_.current)}`, {
|
|
1092
1130
|
method: "POST",
|
|
1093
1131
|
headers: { "Content-Type": "application/json" },
|
|
1094
1132
|
body: JSON.stringify({ text: v })
|
|
@@ -1114,8 +1152,8 @@ function Be(e = {}) {
|
|
|
1114
1152
|
if (!e.ok) return;
|
|
1115
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();
|
|
1116
1154
|
if (u != null && (T.current = u), t !== M.current) return;
|
|
1117
|
-
l != null && (w.current = l), d != null && (E.current = d), c && (C.current =
|
|
1118
|
-
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;
|
|
1119
1157
|
return {
|
|
1120
1158
|
available: !0,
|
|
1121
1159
|
offer: p,
|
|
@@ -1154,12 +1192,12 @@ function Be(e = {}) {
|
|
|
1154
1192
|
p,
|
|
1155
1193
|
n
|
|
1156
1194
|
]);
|
|
1157
|
-
let [ee,
|
|
1195
|
+
let [ee, q] = l(null);
|
|
1158
1196
|
o(() => {
|
|
1159
|
-
|
|
1197
|
+
q(null);
|
|
1160
1198
|
let e = x.answerNow;
|
|
1161
1199
|
if (!e || e !== v) return;
|
|
1162
|
-
let t = setTimeout(() =>
|
|
1200
|
+
let t = setTimeout(() => q(e), Math.max(0, a - n));
|
|
1163
1201
|
return () => clearTimeout(t);
|
|
1164
1202
|
}, [
|
|
1165
1203
|
x.answerNow,
|
|
@@ -1167,24 +1205,24 @@ function Be(e = {}) {
|
|
|
1167
1205
|
a,
|
|
1168
1206
|
n
|
|
1169
1207
|
]);
|
|
1170
|
-
let
|
|
1208
|
+
let te = y && x.strictCoverage;
|
|
1171
1209
|
o(() => {
|
|
1172
1210
|
let { setSearchSettings: e, state: t } = _.current;
|
|
1173
|
-
if (
|
|
1211
|
+
if (te) {
|
|
1174
1212
|
if (k.current) return;
|
|
1175
1213
|
let n = t.searchSettings.match ?? {};
|
|
1176
|
-
k.current = Object.fromEntries(Object.keys(
|
|
1214
|
+
k.current = Object.fromEntries(Object.keys(je).map((e) => [e, n[e]])), e({ match: { ...je } });
|
|
1177
1215
|
} else k.current &&= (e({ match: { ...k.current } }), null);
|
|
1178
|
-
}, [
|
|
1179
|
-
let
|
|
1216
|
+
}, [te]);
|
|
1217
|
+
let J = y && x.refocus && !x.held && z === 0 && !!x.text && v.startsWith(x.text);
|
|
1180
1218
|
if (o(() => {
|
|
1181
|
-
_.current.setSearchSettings({ refocus:
|
|
1182
|
-
}, [
|
|
1183
|
-
let
|
|
1184
|
-
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 {
|
|
1185
1223
|
...x,
|
|
1186
|
-
mode:
|
|
1187
|
-
held:
|
|
1224
|
+
mode: Y,
|
|
1225
|
+
held: Z,
|
|
1188
1226
|
offer: "none",
|
|
1189
1227
|
askAnytime: !1,
|
|
1190
1228
|
answerNow: null,
|
|
@@ -1192,30 +1230,30 @@ function Be(e = {}) {
|
|
|
1192
1230
|
notFound: !1,
|
|
1193
1231
|
strictCoverage: !1,
|
|
1194
1232
|
refocus: !1,
|
|
1195
|
-
stands:
|
|
1233
|
+
stands: X,
|
|
1196
1234
|
door: !1,
|
|
1197
1235
|
offerRow: "none",
|
|
1198
1236
|
offerKind: null,
|
|
1199
1237
|
enterAsks: !1
|
|
1200
1238
|
};
|
|
1201
|
-
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");
|
|
1202
1240
|
return {
|
|
1203
1241
|
...x,
|
|
1204
|
-
refocus:
|
|
1205
|
-
mode:
|
|
1206
|
-
askAnytime:
|
|
1207
|
-
door:
|
|
1208
|
-
offerRow:
|
|
1209
|
-
offerKind:
|
|
1210
|
-
enterAsks:
|
|
1242
|
+
refocus: J,
|
|
1243
|
+
mode: Y,
|
|
1244
|
+
askAnytime: Y === "open" || ne,
|
|
1245
|
+
door: se,
|
|
1246
|
+
offerRow: ae,
|
|
1247
|
+
offerKind: oe,
|
|
1248
|
+
enterAsks: ae === "ready",
|
|
1211
1249
|
answerNow: ee !== null && ee === v && x.answerNow === v ? ee : null,
|
|
1212
|
-
text: (
|
|
1213
|
-
notFound:
|
|
1214
|
-
quick:
|
|
1215
|
-
stands:
|
|
1250
|
+
text: (ie === "hint" || ie === "ask") && !X ? v : x.text,
|
|
1251
|
+
notFound: X && x.notFound,
|
|
1252
|
+
quick: ie,
|
|
1253
|
+
stands: X
|
|
1216
1254
|
};
|
|
1217
1255
|
}
|
|
1218
|
-
var
|
|
1256
|
+
var ze = {
|
|
1219
1257
|
row: "_row_epo6h_3",
|
|
1220
1258
|
icon: "_icon_epo6h_17",
|
|
1221
1259
|
line: "_line_epo6h_24",
|
|
@@ -1225,7 +1263,7 @@ var Ve = {
|
|
|
1225
1263
|
enter: "_enter_epo6h_59"
|
|
1226
1264
|
};
|
|
1227
1265
|
// src/components/AskOffer.tsx
|
|
1228
|
-
function
|
|
1266
|
+
function Be(e) {
|
|
1229
1267
|
return e.row === "hint" ? {
|
|
1230
1268
|
text: "Type a bit more to ask the assistant",
|
|
1231
1269
|
action: ""
|
|
@@ -1243,7 +1281,7 @@ function He(e) {
|
|
|
1243
1281
|
action: "Ask the assistant"
|
|
1244
1282
|
};
|
|
1245
1283
|
}
|
|
1246
|
-
var
|
|
1284
|
+
var Ve = ({ searchOrAsk: e, onAsk: t, words: n, className: r = "" }) => {
|
|
1247
1285
|
let i = e.text.trim();
|
|
1248
1286
|
if (!e.available || e.offerRow === "none" || !i) return null;
|
|
1249
1287
|
let a = {
|
|
@@ -1254,16 +1292,16 @@ var Ue = ({ searchOrAsk: e, onAsk: t, words: n, className: r = "" }) => {
|
|
|
1254
1292
|
found: e.found,
|
|
1255
1293
|
text: i
|
|
1256
1294
|
}, o = {
|
|
1257
|
-
...
|
|
1258
|
-
...
|
|
1295
|
+
...Be(a),
|
|
1296
|
+
...He(n?.(a))
|
|
1259
1297
|
}, s = () => t(i);
|
|
1260
1298
|
return /* @__PURE__ */ g("div", {
|
|
1261
|
-
className: `${
|
|
1299
|
+
className: `${ze.row} ${ze[e.offerRow]} ${r}`,
|
|
1262
1300
|
"data-kind": e.offerKind ?? void 0,
|
|
1263
1301
|
"aria-live": "polite",
|
|
1264
1302
|
children: [
|
|
1265
1303
|
/* @__PURE__ */ h("span", {
|
|
1266
|
-
className:
|
|
1304
|
+
className: ze.icon,
|
|
1267
1305
|
"aria-hidden": "true",
|
|
1268
1306
|
children: /* @__PURE__ */ h(G, {
|
|
1269
1307
|
size: 14,
|
|
@@ -1271,22 +1309,22 @@ var Ue = ({ searchOrAsk: e, onAsk: t, words: n, className: r = "" }) => {
|
|
|
1271
1309
|
})
|
|
1272
1310
|
}),
|
|
1273
1311
|
e.offerRow === "thinking" && /* @__PURE__ */ h(L, {
|
|
1274
|
-
className:
|
|
1312
|
+
className: ze.text,
|
|
1275
1313
|
children: o.text
|
|
1276
1314
|
}),
|
|
1277
1315
|
e.offerRow === "hint" && /* @__PURE__ */ h("button", {
|
|
1278
1316
|
type: "button",
|
|
1279
|
-
className:
|
|
1317
|
+
className: ze.line,
|
|
1280
1318
|
onClick: s,
|
|
1281
1319
|
children: /* @__PURE__ */ h(L, { children: o.text })
|
|
1282
1320
|
}),
|
|
1283
1321
|
e.offerRow === "ready" && /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("span", {
|
|
1284
|
-
className:
|
|
1322
|
+
className: ze.question,
|
|
1285
1323
|
children: o.text
|
|
1286
1324
|
}), /* @__PURE__ */ g("span", {
|
|
1287
|
-
className:
|
|
1325
|
+
className: ze.actions,
|
|
1288
1326
|
children: [/* @__PURE__ */ h("span", {
|
|
1289
|
-
className:
|
|
1327
|
+
className: ze.enter,
|
|
1290
1328
|
children: /* @__PURE__ */ h(M, { children: "↵" })
|
|
1291
1329
|
}), /* @__PURE__ */ h(C, {
|
|
1292
1330
|
variant: "primary",
|
|
@@ -1298,37 +1336,37 @@ var Ue = ({ searchOrAsk: e, onAsk: t, words: n, className: r = "" }) => {
|
|
|
1298
1336
|
]
|
|
1299
1337
|
});
|
|
1300
1338
|
};
|
|
1301
|
-
function
|
|
1339
|
+
function He(e) {
|
|
1302
1340
|
return e ? Object.fromEntries(Object.entries(e).filter(([, e]) => typeof e == "string" && e.length > 0)) : {};
|
|
1303
1341
|
}
|
|
1304
|
-
var
|
|
1342
|
+
var Ue = {
|
|
1305
1343
|
grid: "_grid_1xjna_2",
|
|
1306
1344
|
chip: "_chip_1xjna_21",
|
|
1307
1345
|
chipLabel: "_chipLabel_1xjna_32"
|
|
1308
|
-
},
|
|
1346
|
+
}, We = r(({ field: e, value: t, onReset: n }) => /* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(C, {
|
|
1309
1347
|
onClick: n,
|
|
1310
|
-
iconRight: /* @__PURE__ */ h(
|
|
1348
|
+
iconRight: /* @__PURE__ */ h(le, {}),
|
|
1311
1349
|
variant: "primary",
|
|
1312
1350
|
size: "micro",
|
|
1313
|
-
className:
|
|
1351
|
+
className: Ue.chip,
|
|
1314
1352
|
title: `${e}: ${t}`,
|
|
1315
1353
|
children: /* @__PURE__ */ g("span", {
|
|
1316
|
-
className:
|
|
1354
|
+
className: Ue.chipLabel,
|
|
1317
1355
|
children: [
|
|
1318
1356
|
e,
|
|
1319
1357
|
": ",
|
|
1320
1358
|
t
|
|
1321
1359
|
]
|
|
1322
1360
|
})
|
|
1323
|
-
}) })),
|
|
1361
|
+
}) })), Ge = r(({ field: e, min: t, max: n, onReset: r }) => /* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(C, {
|
|
1324
1362
|
onClick: r,
|
|
1325
|
-
iconRight: /* @__PURE__ */ h(
|
|
1363
|
+
iconRight: /* @__PURE__ */ h(le, {}),
|
|
1326
1364
|
variant: "primary",
|
|
1327
1365
|
size: "micro",
|
|
1328
|
-
className:
|
|
1366
|
+
className: Ue.chip,
|
|
1329
1367
|
title: `${e}: ${t} – ${n}`,
|
|
1330
1368
|
children: /* @__PURE__ */ g("span", {
|
|
1331
|
-
className:
|
|
1369
|
+
className: Ue.chipLabel,
|
|
1332
1370
|
children: [
|
|
1333
1371
|
e,
|
|
1334
1372
|
": ",
|
|
@@ -1337,15 +1375,15 @@ var Ge = {
|
|
|
1337
1375
|
n
|
|
1338
1376
|
]
|
|
1339
1377
|
})
|
|
1340
|
-
}) })),
|
|
1378
|
+
}) })), Ke = r(({ field: e, label: t, onReset: n }) => /* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(C, {
|
|
1341
1379
|
onClick: n,
|
|
1342
|
-
iconRight: /* @__PURE__ */ h(
|
|
1380
|
+
iconRight: /* @__PURE__ */ h(le, {}),
|
|
1343
1381
|
variant: "primary",
|
|
1344
1382
|
size: "micro",
|
|
1345
|
-
className:
|
|
1383
|
+
className: Ue.chip,
|
|
1346
1384
|
title: `${e}: ${t}`,
|
|
1347
1385
|
children: /* @__PURE__ */ g("span", {
|
|
1348
|
-
className:
|
|
1386
|
+
className: Ue.chipLabel,
|
|
1349
1387
|
children: [
|
|
1350
1388
|
e,
|
|
1351
1389
|
": ",
|
|
@@ -1353,8 +1391,8 @@ var Ge = {
|
|
|
1353
1391
|
]
|
|
1354
1392
|
})
|
|
1355
1393
|
}) }));
|
|
1356
|
-
function
|
|
1357
|
-
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) => ({
|
|
1358
1396
|
field: e,
|
|
1359
1397
|
value: t
|
|
1360
1398
|
}))).flat(), [e]), l = s(() => Object.entries(t).map(([e, { min: t, max: n }]) => ({
|
|
@@ -1374,20 +1412,20 @@ function Ye() {
|
|
|
1374
1412
|
collapsible: !1,
|
|
1375
1413
|
title: "Active filters",
|
|
1376
1414
|
children: /* @__PURE__ */ g("ul", {
|
|
1377
|
-
className:
|
|
1415
|
+
className: Ue.grid,
|
|
1378
1416
|
children: [
|
|
1379
|
-
c.map(({ field: e, value: t }) => /* @__PURE__ */ h(
|
|
1417
|
+
c.map(({ field: e, value: t }) => /* @__PURE__ */ h(We, {
|
|
1380
1418
|
field: e,
|
|
1381
1419
|
value: t,
|
|
1382
1420
|
onReset: () => i(e, t)
|
|
1383
1421
|
}, `${e}-${t}`)),
|
|
1384
|
-
l.map(({ field: e, min: t, max: n }) => /* @__PURE__ */ h(
|
|
1422
|
+
l.map(({ field: e, min: t, max: n }) => /* @__PURE__ */ h(Ge, {
|
|
1385
1423
|
field: e,
|
|
1386
1424
|
min: t,
|
|
1387
1425
|
max: n,
|
|
1388
1426
|
onReset: () => a(e)
|
|
1389
1427
|
}, e)),
|
|
1390
|
-
u.map(({ field: e, range: t, label: n }) => /* @__PURE__ */ h(
|
|
1428
|
+
u.map(({ field: e, range: t, label: n }) => /* @__PURE__ */ h(Ke, {
|
|
1391
1429
|
field: e,
|
|
1392
1430
|
label: n,
|
|
1393
1431
|
onReset: () => o(e, t)
|
|
@@ -1402,7 +1440,7 @@ function Ye() {
|
|
|
1402
1440
|
})
|
|
1403
1441
|
}) : null;
|
|
1404
1442
|
}
|
|
1405
|
-
var
|
|
1443
|
+
var Je = {
|
|
1406
1444
|
withOffer: "_withOffer_1zrln_2",
|
|
1407
1445
|
offerRow: "_offerRow_1zrln_10",
|
|
1408
1446
|
offerHint: "_offerHint_1zrln_18",
|
|
@@ -1412,8 +1450,8 @@ var Xe = {
|
|
|
1412
1450
|
offerQuick: "_offerQuick_1zrln_56",
|
|
1413
1451
|
filterChip: "_filterChip_1zrln_59",
|
|
1414
1452
|
filtersPopover: "_filtersPopover_1zrln_63"
|
|
1415
|
-
},
|
|
1416
|
-
let { state: { query: p, filters: m, rangeFilters: _, bucketFilters: v, results: y, isFallback: b, searchSettings: x }, setQuery: S, resetFilters: w, picks: T, showPicks: D } =
|
|
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);
|
|
1417
1455
|
e.useEffect(() => {
|
|
1418
1456
|
let e = R.answerNow;
|
|
1419
1457
|
s && e && e === p.trim() && B.current !== e && (B.current = e, s(e, { proactive: !0 }));
|
|
@@ -1423,16 +1461,16 @@ var Xe = {
|
|
|
1423
1461
|
s
|
|
1424
1462
|
]);
|
|
1425
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) => {
|
|
1426
|
-
d?.(e), !e.defaultPrevented && e.key === "Enter" && s && z && p.trim() && (e.preventDefault(),
|
|
1427
|
-
}, [
|
|
1464
|
+
d?.(e), !e.defaultPrevented && e.key === "Enter" && s && z && p.trim() && (e.preventDefault(), Z());
|
|
1465
|
+
}, [q, te] = e.useState(!1);
|
|
1428
1466
|
e.useEffect(() => {
|
|
1429
|
-
k === 0 &&
|
|
1467
|
+
k === 0 && te(!1);
|
|
1430
1468
|
}, [k]);
|
|
1431
|
-
let
|
|
1469
|
+
let J = () => {
|
|
1432
1470
|
D?.(null), S(""), k > 0 && w(), u?.();
|
|
1433
|
-
},
|
|
1471
|
+
}, Z = () => {
|
|
1434
1472
|
B.current = p.trim(), s(p.trim());
|
|
1435
|
-
},
|
|
1473
|
+
}, ne = /* @__PURE__ */ g(F, {
|
|
1436
1474
|
type: "text",
|
|
1437
1475
|
value: p,
|
|
1438
1476
|
onChange: (e) => S(e.target.value),
|
|
@@ -1447,17 +1485,17 @@ var Xe = {
|
|
|
1447
1485
|
...f,
|
|
1448
1486
|
children: [
|
|
1449
1487
|
W === "thinking" && /* @__PURE__ */ g("span", {
|
|
1450
|
-
className:
|
|
1488
|
+
className: Je.thinking,
|
|
1451
1489
|
"aria-live": "polite",
|
|
1452
1490
|
children: [/* @__PURE__ */ h(G, {}), /* @__PURE__ */ h(L, { children: "Thinking" })]
|
|
1453
1491
|
}),
|
|
1454
1492
|
(W === "door" || W === "hint" || W === "ready") && /* @__PURE__ */ h(C, {
|
|
1455
1493
|
variant: W === "ready" ? "primary" : "ghost",
|
|
1456
|
-
className: W === "ready" ?
|
|
1494
|
+
className: W === "ready" ? Je.askStrong : void 0,
|
|
1457
1495
|
size: "micro",
|
|
1458
1496
|
iconLeft: /* @__PURE__ */ h(G, {}),
|
|
1459
1497
|
iconRight: W === "ready" ? /* @__PURE__ */ h(M, { children: "Enter ↵" }) : void 0,
|
|
1460
|
-
onClick:
|
|
1498
|
+
onClick: Z,
|
|
1461
1499
|
title: z ? "Enter asks" : "Ask the assistant",
|
|
1462
1500
|
children: W === "hint" ? /* @__PURE__ */ h(L, { children: "Type a bit more to ask" }) : W === "ready" && R.offerKind === "describe" ? "Explore" : "Ask"
|
|
1463
1501
|
}),
|
|
@@ -1465,112 +1503,112 @@ var Xe = {
|
|
|
1465
1503
|
o && P && /* @__PURE__ */ h(U, {
|
|
1466
1504
|
content: "No direct match. Showing the nearest results.",
|
|
1467
1505
|
children: /* @__PURE__ */ h("span", { children: /* @__PURE__ */ h(E, {
|
|
1468
|
-
icon: /* @__PURE__ */ h(
|
|
1506
|
+
icon: /* @__PURE__ */ h(X, {}),
|
|
1469
1507
|
children: "Nearest"
|
|
1470
1508
|
}) })
|
|
1471
1509
|
}),
|
|
1472
1510
|
o && k > 0 && /* @__PURE__ */ h(N, {
|
|
1473
|
-
open:
|
|
1474
|
-
onOpenChange:
|
|
1511
|
+
open: q,
|
|
1512
|
+
onOpenChange: te,
|
|
1475
1513
|
align: "end",
|
|
1476
1514
|
sideOffset: 6,
|
|
1477
|
-
className:
|
|
1515
|
+
className: Je.filtersPopover,
|
|
1478
1516
|
"aria-label": "Active filters",
|
|
1479
1517
|
trigger: /* @__PURE__ */ h(C, {
|
|
1480
1518
|
variant: "ghost",
|
|
1481
1519
|
size: "micro",
|
|
1482
|
-
className:
|
|
1520
|
+
className: Je.filterChip,
|
|
1483
1521
|
"aria-label": `${k} filter${k === 1 ? "" : "s"} active: show them`,
|
|
1484
1522
|
title: `${k} filter${k === 1 ? "" : "s"} active`,
|
|
1485
1523
|
children: /* @__PURE__ */ h(E, {
|
|
1486
|
-
icon: /* @__PURE__ */ h(
|
|
1524
|
+
icon: /* @__PURE__ */ h(Y, {}),
|
|
1487
1525
|
color: "var(--CLightBlue)",
|
|
1488
1526
|
textColor: "#080809",
|
|
1489
1527
|
children: k
|
|
1490
1528
|
})
|
|
1491
1529
|
}),
|
|
1492
|
-
children: /* @__PURE__ */ h(
|
|
1530
|
+
children: /* @__PURE__ */ h(qe, {})
|
|
1493
1531
|
}),
|
|
1494
1532
|
i && (A || k > 0) && /* @__PURE__ */ h(C, {
|
|
1495
1533
|
variant: "ghost",
|
|
1496
1534
|
size: "micro",
|
|
1497
|
-
onClick:
|
|
1535
|
+
onClick: J,
|
|
1498
1536
|
"aria-label": k > 0 ? "Clear search and filters" : "Clear search",
|
|
1499
1537
|
children: "Clear"
|
|
1500
1538
|
})
|
|
1501
1539
|
]
|
|
1502
1540
|
});
|
|
1503
|
-
return l !== "below" || !s || !R.available ?
|
|
1504
|
-
className:
|
|
1505
|
-
children: [
|
|
1506
|
-
className:
|
|
1507
|
-
children: !V && /* @__PURE__ */ h(
|
|
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, {
|
|
1508
1546
|
searchOrAsk: R,
|
|
1509
|
-
onAsk:
|
|
1510
|
-
className:
|
|
1547
|
+
onAsk: Z,
|
|
1548
|
+
className: Je.offerQuick
|
|
1511
1549
|
})
|
|
1512
1550
|
})]
|
|
1513
1551
|
});
|
|
1514
|
-
},
|
|
1552
|
+
}, Xe = {
|
|
1515
1553
|
message: "_message_1mgfk_1",
|
|
1516
1554
|
icon: "_icon_1mgfk_10",
|
|
1517
1555
|
title: "_title_1mgfk_15",
|
|
1518
1556
|
detail: "_detail_1mgfk_20",
|
|
1519
1557
|
technical: "_technical_1mgfk_25",
|
|
1520
1558
|
button: "_button_1mgfk_33"
|
|
1521
|
-
},
|
|
1559
|
+
}, Ze = {
|
|
1522
1560
|
unreachable: {
|
|
1523
|
-
icon:
|
|
1561
|
+
icon: te,
|
|
1524
1562
|
title: "Search is unavailable",
|
|
1525
1563
|
detail: "The search server can’t be reached right now."
|
|
1526
1564
|
},
|
|
1527
1565
|
unauthorized: {
|
|
1528
|
-
icon:
|
|
1566
|
+
icon: re,
|
|
1529
1567
|
title: "Search is unavailable",
|
|
1530
1568
|
detail: "The search key was not accepted."
|
|
1531
1569
|
},
|
|
1532
1570
|
forbidden: {
|
|
1533
|
-
icon:
|
|
1571
|
+
icon: ie,
|
|
1534
1572
|
title: "Search is unavailable",
|
|
1535
1573
|
detail: "This search key doesn’t have access to these results."
|
|
1536
1574
|
},
|
|
1537
1575
|
notFound: {
|
|
1538
|
-
icon:
|
|
1576
|
+
icon: ae,
|
|
1539
1577
|
title: "Nothing to search here",
|
|
1540
1578
|
detail: "The collection this page searches doesn’t exist."
|
|
1541
1579
|
},
|
|
1542
1580
|
notReady: {
|
|
1543
|
-
icon:
|
|
1581
|
+
icon: Z,
|
|
1544
1582
|
title: "Search is getting ready",
|
|
1545
1583
|
detail: "Results will appear in a moment."
|
|
1546
1584
|
},
|
|
1547
1585
|
unavailable: {
|
|
1548
|
-
icon:
|
|
1586
|
+
icon: ce,
|
|
1549
1587
|
title: "Search is unavailable",
|
|
1550
1588
|
detail: "The collection can’t be searched right now."
|
|
1551
1589
|
},
|
|
1552
1590
|
rateLimited: {
|
|
1553
|
-
icon:
|
|
1591
|
+
icon: se,
|
|
1554
1592
|
title: "Too many searches",
|
|
1555
1593
|
detail: "Wait a moment, then try again."
|
|
1556
1594
|
},
|
|
1557
1595
|
server: {
|
|
1558
|
-
icon:
|
|
1596
|
+
icon: ce,
|
|
1559
1597
|
title: "Something went wrong",
|
|
1560
1598
|
detail: "The search server ran into a problem."
|
|
1561
1599
|
},
|
|
1562
1600
|
setup: {
|
|
1563
|
-
icon:
|
|
1601
|
+
icon: ce,
|
|
1564
1602
|
title: "Search isn’t set up",
|
|
1565
1603
|
detail: "This page is missing part of its search setup."
|
|
1566
1604
|
},
|
|
1567
1605
|
unknown: {
|
|
1568
|
-
icon:
|
|
1606
|
+
icon: ce,
|
|
1569
1607
|
title: "Something went wrong",
|
|
1570
1608
|
detail: "The search couldn’t be completed."
|
|
1571
1609
|
}
|
|
1572
|
-
},
|
|
1573
|
-
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];
|
|
1574
1612
|
o(() => {
|
|
1575
1613
|
if (e.kind !== "notReady" || !t) return;
|
|
1576
1614
|
let n = setTimeout(t, (e.retryAfterSeconds ?? 2) * 1e3);
|
|
@@ -1578,38 +1616,38 @@ var Xe = {
|
|
|
1578
1616
|
}, [e, t]);
|
|
1579
1617
|
let s = e.retryable && e.kind !== "notReady" && t;
|
|
1580
1618
|
return /* @__PURE__ */ g("div", {
|
|
1581
|
-
className:
|
|
1619
|
+
className: Xe.message,
|
|
1582
1620
|
role: "alert",
|
|
1583
1621
|
children: [
|
|
1584
1622
|
/* @__PURE__ */ h("span", {
|
|
1585
|
-
className:
|
|
1623
|
+
className: Xe.icon,
|
|
1586
1624
|
children: /* @__PURE__ */ h(r, {
|
|
1587
1625
|
size: 70,
|
|
1588
1626
|
color: "var(--lv4)"
|
|
1589
1627
|
})
|
|
1590
1628
|
}),
|
|
1591
1629
|
/* @__PURE__ */ h("div", {
|
|
1592
|
-
className:
|
|
1630
|
+
className: Xe.title,
|
|
1593
1631
|
children: i
|
|
1594
1632
|
}),
|
|
1595
1633
|
/* @__PURE__ */ h("div", {
|
|
1596
|
-
className:
|
|
1634
|
+
className: Xe.detail,
|
|
1597
1635
|
children: a
|
|
1598
1636
|
}),
|
|
1599
1637
|
!n && /* @__PURE__ */ h("code", {
|
|
1600
|
-
className:
|
|
1638
|
+
className: Xe.technical,
|
|
1601
1639
|
children: e.technical
|
|
1602
1640
|
}),
|
|
1603
1641
|
s && /* @__PURE__ */ h(C, {
|
|
1604
1642
|
variant: "secondary",
|
|
1605
1643
|
size: "micro",
|
|
1606
|
-
className:
|
|
1644
|
+
className: Xe.button,
|
|
1607
1645
|
onClick: t,
|
|
1608
1646
|
children: "Try again"
|
|
1609
1647
|
})
|
|
1610
1648
|
]
|
|
1611
1649
|
});
|
|
1612
|
-
},
|
|
1650
|
+
}, $e = {
|
|
1613
1651
|
placeholder: "_placeholder_1m5kj_1",
|
|
1614
1652
|
invalid: "_invalid_1m5kj_11",
|
|
1615
1653
|
searchedFor: "_searchedFor_1m5kj_17",
|
|
@@ -1620,23 +1658,23 @@ var Xe = {
|
|
|
1620
1658
|
picksCount: "_picksCount_1m5kj_27",
|
|
1621
1659
|
picksSpacer: "_picksSpacer_1m5kj_28",
|
|
1622
1660
|
why: "_why_1m5kj_29"
|
|
1623
|
-
},
|
|
1661
|
+
}, et = {
|
|
1624
1662
|
row: "_row_11svi_1",
|
|
1625
1663
|
content: "_content_11svi_22",
|
|
1626
1664
|
indexNumber: "_indexNumber_11svi_36",
|
|
1627
1665
|
scoreNumber: "_scoreNumber_11svi_44",
|
|
1628
1666
|
skeletonBars: "_skeletonBars_11svi_53"
|
|
1629
|
-
},
|
|
1630
|
-
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,
|
|
1631
1669
|
children: [
|
|
1632
1670
|
t !== void 0 && /* @__PURE__ */ h("div", {
|
|
1633
|
-
className:
|
|
1671
|
+
className: et.indexNumber,
|
|
1634
1672
|
children: t
|
|
1635
1673
|
}),
|
|
1636
1674
|
/* @__PURE__ */ h("div", {
|
|
1637
|
-
className:
|
|
1675
|
+
className: et.content,
|
|
1638
1676
|
children: e ? /* @__PURE__ */ g("div", {
|
|
1639
|
-
className:
|
|
1677
|
+
className: et.skeletonBars,
|
|
1640
1678
|
children: [/* @__PURE__ */ h(R, {
|
|
1641
1679
|
level: 3,
|
|
1642
1680
|
height: 12,
|
|
@@ -1653,14 +1691,14 @@ var Xe = {
|
|
|
1653
1691
|
}) : i
|
|
1654
1692
|
}),
|
|
1655
1693
|
r && n !== void 0 && /* @__PURE__ */ h("div", {
|
|
1656
|
-
className:
|
|
1694
|
+
className: et.scoreNumber,
|
|
1657
1695
|
children: n
|
|
1658
1696
|
})
|
|
1659
1697
|
]
|
|
1660
|
-
}),
|
|
1698
|
+
}), nt = {
|
|
1661
1699
|
wrapper: "_wrapper_f970z_6",
|
|
1662
1700
|
skeletonAppear: "_skeletonAppear_f970z_1"
|
|
1663
|
-
},
|
|
1701
|
+
}, rt = [
|
|
1664
1702
|
[62, 38],
|
|
1665
1703
|
[75, 45],
|
|
1666
1704
|
[58, 33],
|
|
@@ -1669,23 +1707,23 @@ var Xe = {
|
|
|
1669
1707
|
[55, 35],
|
|
1670
1708
|
[72, 40],
|
|
1671
1709
|
[60, 30]
|
|
1672
|
-
],
|
|
1673
|
-
className:
|
|
1674
|
-
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, {
|
|
1675
1713
|
skeleton: !0,
|
|
1676
1714
|
skeletonDelay: t * .1,
|
|
1677
|
-
skeletonWidths:
|
|
1715
|
+
skeletonWidths: rt[t % rt.length]
|
|
1678
1716
|
}, t))
|
|
1679
1717
|
});
|
|
1680
1718
|
// src/hooks/useFilterSuggestion.ts
|
|
1681
|
-
function
|
|
1719
|
+
function at(e) {
|
|
1682
1720
|
let t = e.trim().toLowerCase();
|
|
1683
1721
|
return t === "true" || t === "false" || t !== "" && !Number.isNaN(Number(t));
|
|
1684
1722
|
}
|
|
1685
|
-
function
|
|
1723
|
+
function ot(e, t) {
|
|
1686
1724
|
if (!t) return null;
|
|
1687
1725
|
let n = [];
|
|
1688
|
-
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({
|
|
1689
1727
|
field: e,
|
|
1690
1728
|
value: t.key
|
|
1691
1729
|
});
|
|
@@ -1704,14 +1742,14 @@ function ct(e, t) {
|
|
|
1704
1742
|
sort: null
|
|
1705
1743
|
};
|
|
1706
1744
|
}
|
|
1707
|
-
function
|
|
1708
|
-
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);
|
|
1709
1747
|
h.current = t;
|
|
1710
1748
|
let [g, _] = l(null), [v, y] = l(""), [b, x] = l(!1), S = c(0), C = i(async (e) => {
|
|
1711
1749
|
let t = ++S.current;
|
|
1712
1750
|
x(!0);
|
|
1713
1751
|
try {
|
|
1714
|
-
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)}`, {
|
|
1715
1753
|
method: "POST",
|
|
1716
1754
|
headers: { "Content-Type": "application/json" },
|
|
1717
1755
|
body: JSON.stringify({ text: e })
|
|
@@ -1750,7 +1788,7 @@ function lt(e = {}) {
|
|
|
1750
1788
|
return o(() => {
|
|
1751
1789
|
if (!A || !j || P || E.current.has(j)) return;
|
|
1752
1790
|
E.current.add(j);
|
|
1753
|
-
let e =
|
|
1791
|
+
let e = ot(j, N);
|
|
1754
1792
|
if (e && (E.current.add(e.text), w(e), O(j)), k !== "model") return;
|
|
1755
1793
|
let t = e ? e.text : j;
|
|
1756
1794
|
if (!t) return;
|
|
@@ -1759,7 +1797,7 @@ function lt(e = {}) {
|
|
|
1759
1797
|
let o = ++S.current;
|
|
1760
1798
|
x(!0);
|
|
1761
1799
|
try {
|
|
1762
|
-
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)}`, {
|
|
1763
1801
|
method: "POST",
|
|
1764
1802
|
headers: { "Content-Type": "application/json" },
|
|
1765
1803
|
body: JSON.stringify({ text: t })
|
|
@@ -1797,20 +1835,20 @@ function lt(e = {}) {
|
|
|
1797
1835
|
};
|
|
1798
1836
|
}
|
|
1799
1837
|
// src/components/SearchResults.tsx
|
|
1800
|
-
var
|
|
1801
|
-
function
|
|
1838
|
+
var ct = /^\[\s*(?:'[^']*'(?:\s*,\s*'[^']*')*)?\s*\]$/;
|
|
1839
|
+
function lt(e) {
|
|
1802
1840
|
let t = e.trim();
|
|
1803
1841
|
if (!t.startsWith("[") || !t.endsWith("]")) return;
|
|
1804
1842
|
try {
|
|
1805
1843
|
let e = JSON.parse(t);
|
|
1806
1844
|
if (Array.isArray(e)) return e.map((e) => String(e));
|
|
1807
1845
|
} catch {}
|
|
1808
|
-
if (!
|
|
1846
|
+
if (!ct.test(t)) return;
|
|
1809
1847
|
let n = [], r = /'([^']*)'/g, i;
|
|
1810
1848
|
for (; (i = r.exec(t)) !== null;) n.push(i[1]);
|
|
1811
1849
|
return n;
|
|
1812
1850
|
}
|
|
1813
|
-
function
|
|
1851
|
+
function ut(e, t, n) {
|
|
1814
1852
|
let r;
|
|
1815
1853
|
try {
|
|
1816
1854
|
r = typeof e == "string" ? JSON.parse(e) : e;
|
|
@@ -1825,14 +1863,14 @@ function ft(e, t, n) {
|
|
|
1825
1863
|
if (n) for (let e in i) {
|
|
1826
1864
|
let t = i[e];
|
|
1827
1865
|
if (typeof t == "string") {
|
|
1828
|
-
let n =
|
|
1866
|
+
let n = lt(t);
|
|
1829
1867
|
n && (i[e] = n);
|
|
1830
1868
|
}
|
|
1831
1869
|
}
|
|
1832
1870
|
return i;
|
|
1833
1871
|
}
|
|
1834
|
-
var
|
|
1835
|
-
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);
|
|
1836
1874
|
o(() => {
|
|
1837
1875
|
let t = !1;
|
|
1838
1876
|
_(null);
|
|
@@ -1873,20 +1911,20 @@ var pt = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
1873
1911
|
} catch {}
|
|
1874
1912
|
}, y = e.search;
|
|
1875
1913
|
return /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ g("div", {
|
|
1876
|
-
className:
|
|
1914
|
+
className: $e.picksHead,
|
|
1877
1915
|
children: [
|
|
1878
1916
|
/* @__PURE__ */ g("span", {
|
|
1879
|
-
className:
|
|
1917
|
+
className: $e.picksTitle,
|
|
1880
1918
|
children: [/* @__PURE__ */ h(G, {
|
|
1881
1919
|
size: 14,
|
|
1882
1920
|
color: "currentColor"
|
|
1883
1921
|
}), r]
|
|
1884
1922
|
}),
|
|
1885
1923
|
/* @__PURE__ */ h("span", {
|
|
1886
|
-
className:
|
|
1924
|
+
className: $e.picksCount,
|
|
1887
1925
|
children: e.picks.length
|
|
1888
1926
|
}),
|
|
1889
|
-
/* @__PURE__ */ h("span", { className:
|
|
1927
|
+
/* @__PURE__ */ h("span", { className: $e.picksSpacer }),
|
|
1890
1928
|
i && /* @__PURE__ */ h(C, {
|
|
1891
1929
|
variant: "ghost",
|
|
1892
1930
|
size: "micro",
|
|
@@ -1894,9 +1932,9 @@ var pt = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
1894
1932
|
children: y ? `Show all ${y.found}${y.more ? "+" : ""} found` : "Show the search instead"
|
|
1895
1933
|
})
|
|
1896
1934
|
]
|
|
1897
|
-
}), p === null ? /* @__PURE__ */ h(
|
|
1898
|
-
let r = p.get(e.documentKey), i = r == null ? null :
|
|
1899
|
-
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, {
|
|
1900
1938
|
index: e.n,
|
|
1901
1939
|
showScore: !1,
|
|
1902
1940
|
children: [a(i, {
|
|
@@ -1908,7 +1946,7 @@ var pt = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
1908
1946
|
},
|
|
1909
1947
|
select: v(e.documentKey, e.n)
|
|
1910
1948
|
}), e.why && /* @__PURE__ */ g("div", {
|
|
1911
|
-
className:
|
|
1949
|
+
className: $e.why,
|
|
1912
1950
|
children: [/* @__PURE__ */ h(G, {
|
|
1913
1951
|
size: 12,
|
|
1914
1952
|
color: "currentColor"
|
|
@@ -1916,8 +1954,8 @@ var pt = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
1916
1954
|
})]
|
|
1917
1955
|
}, e.documentKey) : null;
|
|
1918
1956
|
}) })] });
|
|
1919
|
-
},
|
|
1920
|
-
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 } =
|
|
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 ?? (() => {
|
|
1921
1959
|
I?.search && F(I.search), P?.(null);
|
|
1922
1960
|
}), R = c(null);
|
|
1923
1961
|
I && R.current?.picks !== I && (R.current = {
|
|
@@ -1933,11 +1971,11 @@ var pt = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
1933
1971
|
B,
|
|
1934
1972
|
b
|
|
1935
1973
|
]);
|
|
1936
|
-
let G = p ?? [], K = !!r?.notFound, ee = j != null && j.trim() !== b.trim() ? j : null,
|
|
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 = () => {
|
|
1937
1975
|
let e = V + B;
|
|
1938
|
-
H(e), p && e >= p.length &&
|
|
1976
|
+
H(e), p && e >= p.length && q && k(p.length + B);
|
|
1939
1977
|
};
|
|
1940
|
-
if (I && z && !w && !T) return /* @__PURE__ */ h(
|
|
1978
|
+
if (I && z && !w && !T) return /* @__PURE__ */ h(dt, {
|
|
1941
1979
|
picks: I,
|
|
1942
1980
|
fields: e,
|
|
1943
1981
|
parseArrayStrings: n,
|
|
@@ -1945,31 +1983,31 @@ var pt = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
1945
1983
|
onShowSearch: L,
|
|
1946
1984
|
children: f
|
|
1947
1985
|
});
|
|
1948
|
-
if (w) return O ? /* @__PURE__ */ h(
|
|
1949
|
-
className:
|
|
1950
|
-
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, {
|
|
1951
1989
|
size: 200,
|
|
1952
1990
|
color: "var(--lv5)"
|
|
1953
1991
|
})
|
|
1954
1992
|
});
|
|
1955
|
-
let
|
|
1956
|
-
return
|
|
1993
|
+
let Y = T ?? x;
|
|
1994
|
+
return Y ? /* @__PURE__ */ h(Qe, {
|
|
1957
1995
|
error: (T ? E : S) ?? {
|
|
1958
1996
|
kind: "unknown",
|
|
1959
|
-
message:
|
|
1960
|
-
technical:
|
|
1997
|
+
message: Y,
|
|
1998
|
+
technical: Y,
|
|
1961
1999
|
retryable: !1
|
|
1962
2000
|
},
|
|
1963
2001
|
onRetry: D
|
|
1964
2002
|
}) : _ || p === null ? /* @__PURE__ */ h("div", {
|
|
1965
|
-
className:
|
|
1966
|
-
children: /* @__PURE__ */ h(
|
|
2003
|
+
className: $e.placeholder,
|
|
2004
|
+
children: /* @__PURE__ */ h(ne, {
|
|
1967
2005
|
size: 200,
|
|
1968
2006
|
color: "var(--lv5)"
|
|
1969
2007
|
})
|
|
1970
2008
|
}) : G.length === 0 ? null : /* @__PURE__ */ g(m, { children: [
|
|
1971
2009
|
ee && /* @__PURE__ */ g("div", {
|
|
1972
|
-
className:
|
|
2010
|
+
className: $e.searchedFor,
|
|
1973
2011
|
"aria-live": "polite",
|
|
1974
2012
|
children: [/* @__PURE__ */ g("span", { children: ["Searching for ", /* @__PURE__ */ h("strong", { children: ee })] }), M && /* @__PURE__ */ h(C, {
|
|
1975
2013
|
variant: "ghost",
|
|
@@ -1979,15 +2017,15 @@ var pt = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
1979
2017
|
})]
|
|
1980
2018
|
}),
|
|
1981
2019
|
K && /* @__PURE__ */ h("p", {
|
|
1982
|
-
className:
|
|
2020
|
+
className: $e.notFound,
|
|
1983
2021
|
"aria-live": "polite",
|
|
1984
2022
|
children: i
|
|
1985
2023
|
}),
|
|
1986
2024
|
/* @__PURE__ */ h("div", {
|
|
1987
|
-
className: K ?
|
|
2025
|
+
className: K ? $e.dimmed : void 0,
|
|
1988
2026
|
children: G.slice(0, V).map((t, r) => {
|
|
1989
|
-
let i = t.score, a =
|
|
1990
|
-
return a ? /* @__PURE__ */ h(
|
|
2027
|
+
let i = t.score, a = ut(t.document, e, n);
|
|
2028
|
+
return a ? /* @__PURE__ */ h(tt, {
|
|
1991
2029
|
index: r,
|
|
1992
2030
|
score: i,
|
|
1993
2031
|
showScore: d ?? v.showScore,
|
|
@@ -1996,12 +2034,12 @@ var pt = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
1996
2034
|
select: () => A?.(t) ?? Promise.resolve()
|
|
1997
2035
|
})
|
|
1998
2036
|
}, r) : /* @__PURE__ */ h("div", {
|
|
1999
|
-
className:
|
|
2037
|
+
className: $e.invalid,
|
|
2000
2038
|
children: /* @__PURE__ */ h("p", { children: "Invalid JSON" })
|
|
2001
2039
|
}, r);
|
|
2002
2040
|
})
|
|
2003
2041
|
}),
|
|
2004
|
-
|
|
2042
|
+
te && /* @__PURE__ */ h("div", {
|
|
2005
2043
|
style: {
|
|
2006
2044
|
textAlign: "center",
|
|
2007
2045
|
marginTop: "20px"
|
|
@@ -2009,23 +2047,23 @@ var pt = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
2009
2047
|
children: /* @__PURE__ */ h(C, {
|
|
2010
2048
|
variant: "secondary",
|
|
2011
2049
|
size: "micro",
|
|
2012
|
-
onClick:
|
|
2050
|
+
onClick: J,
|
|
2013
2051
|
children: b.trim() === "" ? "Load more" : y !== void 0 && y > 0 ? `Load results ${V + 1}-${Math.min(V + B, p.length, y)} of ${y}` : "Load more"
|
|
2014
2052
|
})
|
|
2015
2053
|
})
|
|
2016
2054
|
] });
|
|
2017
|
-
},
|
|
2055
|
+
}, pt = {
|
|
2018
2056
|
row: "_row_ujwhc_1",
|
|
2019
2057
|
title: "_title_ujwhc_8"
|
|
2020
|
-
},
|
|
2021
|
-
className: [
|
|
2058
|
+
}, mt = ({ variant: e = "default", children: t }) => /* @__PURE__ */ h("div", {
|
|
2059
|
+
className: [pt.row, e === "title" ? pt.title : ""].filter(Boolean).join(" "),
|
|
2022
2060
|
children: t
|
|
2023
|
-
}),
|
|
2061
|
+
}), ht = {
|
|
2024
2062
|
listRows: "_listRows_13obt_2",
|
|
2025
2063
|
sliderArea: "_sliderArea_13obt_8",
|
|
2026
2064
|
inputRow: "_inputRow_13obt_15",
|
|
2027
2065
|
histogramRow: "_histogramRow_13obt_22"
|
|
2028
|
-
},
|
|
2066
|
+
}, gt = [
|
|
2029
2067
|
65,
|
|
2030
2068
|
80,
|
|
2031
2069
|
55,
|
|
@@ -2034,17 +2072,17 @@ var pt = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
2034
2072
|
75,
|
|
2035
2073
|
50,
|
|
2036
2074
|
68
|
|
2037
|
-
],
|
|
2075
|
+
], _t = ({ title: e, rows: t = 5, variant: n = "list", withHistogram: r = !1, collapsible: i = !0, startCollapsed: a = !1 }) => /* @__PURE__ */ h(A, {
|
|
2038
2076
|
title: e,
|
|
2039
2077
|
collapsible: i,
|
|
2040
2078
|
collapsed: a,
|
|
2041
2079
|
children: n === "slider" ? /* @__PURE__ */ g("div", {
|
|
2042
|
-
className:
|
|
2080
|
+
className: ht.sliderArea,
|
|
2043
2081
|
children: [
|
|
2044
|
-
r && /* @__PURE__ */ h("div", { className:
|
|
2082
|
+
r && /* @__PURE__ */ h("div", { className: ht.histogramRow }),
|
|
2045
2083
|
/* @__PURE__ */ h(R, { height: 6 }),
|
|
2046
2084
|
/* @__PURE__ */ g("div", {
|
|
2047
|
-
className:
|
|
2085
|
+
className: ht.inputRow,
|
|
2048
2086
|
children: [/* @__PURE__ */ h(R, {
|
|
2049
2087
|
width: 40,
|
|
2050
2088
|
height: 20,
|
|
@@ -2057,13 +2095,13 @@ var pt = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
2057
2095
|
})
|
|
2058
2096
|
]
|
|
2059
2097
|
}) : /* @__PURE__ */ h("div", {
|
|
2060
|
-
className:
|
|
2098
|
+
className: ht.listRows,
|
|
2061
2099
|
children: Array.from({ length: t }).map((e, t) => /* @__PURE__ */ h(R, {
|
|
2062
|
-
width: `${
|
|
2100
|
+
width: `${gt[t % gt.length]}%`,
|
|
2063
2101
|
delay: t * .05
|
|
2064
2102
|
}, t))
|
|
2065
2103
|
})
|
|
2066
|
-
}),
|
|
2104
|
+
}), vt = {
|
|
2067
2105
|
list: "_list_1352r_2",
|
|
2068
2106
|
count: "_count_1352r_7",
|
|
2069
2107
|
countValue: "_countValue_1352r_17",
|
|
@@ -2073,10 +2111,10 @@ var pt = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
2073
2111
|
active: "_active_1352r_54",
|
|
2074
2112
|
search: "_search_1352r_59",
|
|
2075
2113
|
searchNote: "_searchNote_1352r_62"
|
|
2076
|
-
},
|
|
2114
|
+
}, yt = {
|
|
2077
2115
|
notice: "_notice_4sel0_1",
|
|
2078
2116
|
technical: "_technical_4sel0_9"
|
|
2079
|
-
},
|
|
2117
|
+
}, bt = ({ label: e, field: t, missing: n }) => {
|
|
2080
2118
|
let r = n.map((e) => e[0].toUpperCase() + e.slice(1)).join(" and ");
|
|
2081
2119
|
return o(() => {
|
|
2082
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).`);
|
|
@@ -2084,9 +2122,9 @@ var pt = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
2084
2122
|
title: e ?? t,
|
|
2085
2123
|
collapsible: !1,
|
|
2086
2124
|
children: /* @__PURE__ */ g("div", {
|
|
2087
|
-
className:
|
|
2125
|
+
className: yt.notice,
|
|
2088
2126
|
children: [/* @__PURE__ */ h("span", { children: "Not available" }), /* @__PURE__ */ g("code", {
|
|
2089
|
-
className:
|
|
2127
|
+
className: yt.technical,
|
|
2090
2128
|
children: [
|
|
2091
2129
|
t,
|
|
2092
2130
|
": not ",
|
|
@@ -2095,8 +2133,8 @@ var pt = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
2095
2133
|
})]
|
|
2096
2134
|
})
|
|
2097
2135
|
});
|
|
2098
|
-
},
|
|
2099
|
-
let { state: { facets: E, filterableFields: D, facetableFields: O, filters: k, query: j }, toggleFilter: M, setValueMatch: N, authError: I, isFetchingInitial: L, allowEmptySearch: R, searchFacetValues: z } =
|
|
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;
|
|
2100
2138
|
o(() => {
|
|
2101
2139
|
N(e, V);
|
|
2102
2140
|
}, [
|
|
@@ -2108,33 +2146,33 @@ var pt = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
2108
2146
|
o(() => {
|
|
2109
2147
|
G(a);
|
|
2110
2148
|
}, [E?.[e], a]);
|
|
2111
|
-
let [K, ee] = l(""), [
|
|
2149
|
+
let [K, ee] = l(""), [q, te] = l(null), J = c(0);
|
|
2112
2150
|
if (o(() => {
|
|
2113
2151
|
let t = K.trim();
|
|
2114
2152
|
if (!t) {
|
|
2115
|
-
|
|
2153
|
+
te(null);
|
|
2116
2154
|
return;
|
|
2117
2155
|
}
|
|
2118
|
-
let n = ++
|
|
2156
|
+
let n = ++J.current, r = /* @__PURE__ */ new Map();
|
|
2119
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);
|
|
2120
2158
|
let i = r.size > 0 && r.size <= 3e3 ? Array.from(r.keys()) : void 0;
|
|
2121
2159
|
(async () => {
|
|
2122
2160
|
let o = z ? await z(e, t, i ? Math.max(a, 10) : 100, i) : null;
|
|
2123
|
-
if (n !==
|
|
2161
|
+
if (n !== J.current) return;
|
|
2124
2162
|
let s, c = 0;
|
|
2125
2163
|
if (o) {
|
|
2126
2164
|
let a = o.values.filter((e) => r.has(e.value));
|
|
2127
|
-
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 && (
|
|
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({
|
|
2128
2166
|
text: t,
|
|
2129
2167
|
values: s,
|
|
2130
2168
|
outside: 0,
|
|
2131
2169
|
fallback: !1
|
|
2132
|
-
}), c = (await z(e, t, 10))?.values.length ?? 0, n !==
|
|
2170
|
+
}), c = (await z(e, t, 10))?.values.length ?? 0, n !== J.current)) return;
|
|
2133
2171
|
} else {
|
|
2134
2172
|
let e = t.toLowerCase();
|
|
2135
2173
|
s = Array.from(r.entries()).filter(([t]) => t.toLowerCase().includes(e));
|
|
2136
2174
|
}
|
|
2137
|
-
|
|
2175
|
+
te({
|
|
2138
2176
|
text: t,
|
|
2139
2177
|
values: s.slice(0, Math.max(a, 10)),
|
|
2140
2178
|
outside: c,
|
|
@@ -2148,10 +2186,10 @@ var pt = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
2148
2186
|
z,
|
|
2149
2187
|
E?.[e]
|
|
2150
2188
|
]), !R && !j || I) return null;
|
|
2151
|
-
if (L || !E) return B === "toggle" ? /* @__PURE__ */ h(
|
|
2189
|
+
if (L || !E) return B === "toggle" ? /* @__PURE__ */ h(_t, {
|
|
2152
2190
|
rows: 1,
|
|
2153
2191
|
collapsible: !1
|
|
2154
|
-
}) : /* @__PURE__ */ h(
|
|
2192
|
+
}) : /* @__PURE__ */ h(_t, {
|
|
2155
2193
|
title: t,
|
|
2156
2194
|
rows: Math.min(a, 6),
|
|
2157
2195
|
collapsible: s,
|
|
@@ -2164,35 +2202,35 @@ var pt = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
2164
2202
|
}) || !b && !j && Object.keys(k).length < 1) return null;
|
|
2165
2203
|
if (!D?.includes(e) || !O?.includes(e)) {
|
|
2166
2204
|
let n = [];
|
|
2167
|
-
return D?.includes(e) || n.push("filterable"), O?.includes(e) || n.push("facetable"), /* @__PURE__ */ h(
|
|
2205
|
+
return D?.includes(e) || n.push("filterable"), O?.includes(e) || n.push("facetable"), /* @__PURE__ */ h(bt, {
|
|
2168
2206
|
label: t,
|
|
2169
2207
|
field: e,
|
|
2170
2208
|
missing: n
|
|
2171
2209
|
});
|
|
2172
2210
|
}
|
|
2173
|
-
let
|
|
2174
|
-
if (!
|
|
2175
|
-
let
|
|
2176
|
-
n && !U.current &&
|
|
2177
|
-
let
|
|
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();
|
|
2178
2216
|
n && U.current && Object.keys(U.current).forEach((e) => {
|
|
2179
|
-
|
|
2180
|
-
}),
|
|
2181
|
-
|
|
2217
|
+
Z.set(e, 0);
|
|
2218
|
+
}), Y.forEach((e) => {
|
|
2219
|
+
Z.set(e.key, e.value);
|
|
2182
2220
|
});
|
|
2183
|
-
let
|
|
2221
|
+
let ne = /* @__PURE__ */ new Set([
|
|
2184
2222
|
"true",
|
|
2185
2223
|
"false",
|
|
2186
2224
|
"null"
|
|
2187
|
-
]),
|
|
2188
|
-
if (
|
|
2189
|
-
let e =
|
|
2190
|
-
|
|
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");
|
|
2191
2229
|
}
|
|
2192
|
-
if (B === "toggle" && !
|
|
2230
|
+
if (B === "toggle" && !ie) return /* @__PURE__ */ h(A, {
|
|
2193
2231
|
collapsible: !1,
|
|
2194
2232
|
children: /* @__PURE__ */ h("div", {
|
|
2195
|
-
className:
|
|
2233
|
+
className: vt.count,
|
|
2196
2234
|
children: /* @__PURE__ */ h(H, {
|
|
2197
2235
|
label: t,
|
|
2198
2236
|
checked: !1,
|
|
@@ -2201,12 +2239,12 @@ var pt = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
2201
2239
|
})
|
|
2202
2240
|
})
|
|
2203
2241
|
});
|
|
2204
|
-
if (
|
|
2205
|
-
let n =
|
|
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}` : "";
|
|
2206
2244
|
return /* @__PURE__ */ h(A, {
|
|
2207
2245
|
collapsible: !1,
|
|
2208
2246
|
children: /* @__PURE__ */ g("div", {
|
|
2209
|
-
className:
|
|
2247
|
+
className: vt.count,
|
|
2210
2248
|
children: [
|
|
2211
2249
|
/* @__PURE__ */ h(H, {
|
|
2212
2250
|
label: t,
|
|
@@ -2220,41 +2258,41 @@ var pt = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
2220
2258
|
})
|
|
2221
2259
|
});
|
|
2222
2260
|
}
|
|
2223
|
-
let
|
|
2224
|
-
if (v || (
|
|
2261
|
+
let Q = Array.from(Z.entries());
|
|
2262
|
+
if (v || (Q = Q.filter(([e]) => e !== "null")), Q.length === 0 && !n) return null;
|
|
2225
2263
|
if (!r) {
|
|
2226
2264
|
if (i === "alphabetical") {
|
|
2227
|
-
let e =
|
|
2228
|
-
|
|
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];
|
|
2229
2267
|
} else if (i === "numeric") {
|
|
2230
2268
|
let e = (e, t) => {
|
|
2231
2269
|
let n = Number(e), r = Number(t);
|
|
2232
2270
|
return !isNaN(n) && !isNaN(r) ? n - r : e.localeCompare(t);
|
|
2233
|
-
}, t =
|
|
2234
|
-
|
|
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];
|
|
2235
2273
|
} else {
|
|
2236
|
-
let e =
|
|
2237
|
-
|
|
2274
|
+
let e = Q.filter(([, e]) => typeof e == "number" && e > 0), t = Q.filter(([, e]) => e === 0 || e === null);
|
|
2275
|
+
Q = [...e, ...t];
|
|
2238
2276
|
}
|
|
2239
2277
|
}
|
|
2240
|
-
let
|
|
2241
|
-
let i =
|
|
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);
|
|
2242
2280
|
switch (B) {
|
|
2243
2281
|
case "button": return p === "list" ? /* @__PURE__ */ g("div", {
|
|
2244
|
-
className:
|
|
2282
|
+
className: vt.count,
|
|
2245
2283
|
children: [/* @__PURE__ */ h(C, {
|
|
2246
2284
|
variant: i ? "primary" : "secondary",
|
|
2247
2285
|
onClick: c,
|
|
2248
2286
|
disabled: a,
|
|
2249
2287
|
size: "micro",
|
|
2250
|
-
className:
|
|
2288
|
+
className: vt.chip,
|
|
2251
2289
|
title: t,
|
|
2252
2290
|
children: /* @__PURE__ */ h("span", {
|
|
2253
|
-
className:
|
|
2291
|
+
className: vt.chipLabel,
|
|
2254
2292
|
children: t
|
|
2255
2293
|
})
|
|
2256
2294
|
}), /* @__PURE__ */ h("span", {
|
|
2257
|
-
className:
|
|
2295
|
+
className: vt.countValue,
|
|
2258
2296
|
children: s
|
|
2259
2297
|
})]
|
|
2260
2298
|
}) : /* @__PURE__ */ h(C, {
|
|
@@ -2262,10 +2300,10 @@ var pt = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
2262
2300
|
onClick: c,
|
|
2263
2301
|
disabled: a,
|
|
2264
2302
|
size: "micro",
|
|
2265
|
-
className:
|
|
2303
|
+
className: vt.chip,
|
|
2266
2304
|
title: `${t}${o}`,
|
|
2267
2305
|
children: /* @__PURE__ */ h("span", {
|
|
2268
|
-
className:
|
|
2306
|
+
className: vt.chipLabel,
|
|
2269
2307
|
children: `${t}${o}`
|
|
2270
2308
|
})
|
|
2271
2309
|
});
|
|
@@ -2286,15 +2324,15 @@ var pt = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
2286
2324
|
disabled: a
|
|
2287
2325
|
});
|
|
2288
2326
|
return p === "list" ? /* @__PURE__ */ g("div", {
|
|
2289
|
-
className:
|
|
2327
|
+
className: vt.count,
|
|
2290
2328
|
children: [n, /* @__PURE__ */ h("span", {
|
|
2291
|
-
className:
|
|
2329
|
+
className: vt.countValue,
|
|
2292
2330
|
children: s
|
|
2293
2331
|
})]
|
|
2294
2332
|
}) : n;
|
|
2295
2333
|
}
|
|
2296
2334
|
default: return p === "list" ? /* @__PURE__ */ g("div", {
|
|
2297
|
-
className:
|
|
2335
|
+
className: vt.count,
|
|
2298
2336
|
children: [/* @__PURE__ */ h(T, {
|
|
2299
2337
|
label: t,
|
|
2300
2338
|
score: "",
|
|
@@ -2302,7 +2340,7 @@ var pt = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
2302
2340
|
onChange: c,
|
|
2303
2341
|
disabled: a
|
|
2304
2342
|
}), /* @__PURE__ */ h("span", {
|
|
2305
|
-
className:
|
|
2343
|
+
className: vt.countValue,
|
|
2306
2344
|
children: s
|
|
2307
2345
|
})]
|
|
2308
2346
|
}) : /* @__PURE__ */ h(T, {
|
|
@@ -2313,8 +2351,8 @@ var pt = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
2313
2351
|
disabled: a
|
|
2314
2352
|
});
|
|
2315
2353
|
}
|
|
2316
|
-
},
|
|
2317
|
-
className:
|
|
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,
|
|
2318
2356
|
children: /* @__PURE__ */ h(F, {
|
|
2319
2357
|
inputSize: "micro",
|
|
2320
2358
|
value: K,
|
|
@@ -2326,53 +2364,53 @@ var pt = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
2326
2364
|
"aria-label": `Search ${t ?? e}`
|
|
2327
2365
|
})
|
|
2328
2366
|
});
|
|
2329
|
-
return
|
|
2367
|
+
return ue ? /* @__PURE__ */ g(A, {
|
|
2330
2368
|
title: t,
|
|
2331
2369
|
collapsible: s,
|
|
2332
|
-
collapsed:
|
|
2333
|
-
className: m &&
|
|
2334
|
-
children: [
|
|
2335
|
-
className:
|
|
2336
|
-
children: [`Nothing in these results matches "${
|
|
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.`]
|
|
2337
2375
|
}) : /* @__PURE__ */ h("ul", {
|
|
2338
|
-
className: p === "grid" ?
|
|
2376
|
+
className: p === "grid" ? vt.grid : vt.list,
|
|
2339
2377
|
style: {
|
|
2340
2378
|
listStyle: "none",
|
|
2341
2379
|
padding: 0,
|
|
2342
2380
|
margin: 0
|
|
2343
2381
|
},
|
|
2344
|
-
children:
|
|
2345
|
-
text:
|
|
2346
|
-
fallback:
|
|
2382
|
+
children: ue.map(([e, t]) => /* @__PURE__ */ h("li", { children: se(e, t, {
|
|
2383
|
+
text: $.text,
|
|
2384
|
+
fallback: $.fallback
|
|
2347
2385
|
}) }, e))
|
|
2348
2386
|
})]
|
|
2349
2387
|
}) : /* @__PURE__ */ g(A, {
|
|
2350
2388
|
title: t,
|
|
2351
2389
|
collapsible: s,
|
|
2352
|
-
collapsed:
|
|
2353
|
-
className: m &&
|
|
2354
|
-
children: [
|
|
2355
|
-
className: p === "grid" ?
|
|
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,
|
|
2356
2394
|
style: {
|
|
2357
2395
|
listStyle: "none",
|
|
2358
2396
|
padding: 0,
|
|
2359
2397
|
margin: 0
|
|
2360
2398
|
},
|
|
2361
|
-
children: [
|
|
2362
|
-
let e =
|
|
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);
|
|
2363
2401
|
return /* @__PURE__ */ h("li", {
|
|
2364
|
-
className:
|
|
2402
|
+
className: vt.toggleItem,
|
|
2365
2403
|
children: /* @__PURE__ */ h(C, {
|
|
2366
2404
|
variant: "ghost",
|
|
2367
2405
|
size: "micro",
|
|
2368
2406
|
onClick: () => G((e) => e + 50),
|
|
2369
|
-
children: `Show ${t} more of ${
|
|
2407
|
+
children: `Show ${t} more of ${Q.length} total`
|
|
2370
2408
|
})
|
|
2371
2409
|
});
|
|
2372
2410
|
})()]
|
|
2373
2411
|
})]
|
|
2374
2412
|
});
|
|
2375
|
-
},
|
|
2413
|
+
}, Ct = {
|
|
2376
2414
|
disabledMessage: "_disabledMessage_adany_1",
|
|
2377
2415
|
histogram: "_histogram_adany_6",
|
|
2378
2416
|
histogramLayer: "_histogramLayer_adany_14",
|
|
@@ -2385,36 +2423,36 @@ var pt = ({ picks: e, fields: t, parseArrayStrings: n, label: r, onShowSearch: i
|
|
|
2385
2423
|
active: "_active_adany_76"
|
|
2386
2424
|
};
|
|
2387
2425
|
// src/utils/numeric.ts
|
|
2388
|
-
function
|
|
2426
|
+
function wt(e) {
|
|
2389
2427
|
if (!Number.isFinite(e)) return 0;
|
|
2390
2428
|
let t = String(e), n = t.indexOf(".");
|
|
2391
2429
|
return n === -1 ? 0 : Math.min(6, t.length - n - 1);
|
|
2392
2430
|
}
|
|
2393
|
-
function
|
|
2431
|
+
function Tt(e) {
|
|
2394
2432
|
let t = 0;
|
|
2395
|
-
for (let n of e) t = Math.max(t,
|
|
2433
|
+
for (let n of e) t = Math.max(t, wt(n));
|
|
2396
2434
|
return t === 0 ? 1 : Number((10 ** -t).toFixed(t));
|
|
2397
2435
|
}
|
|
2398
|
-
function
|
|
2399
|
-
return Number(e.toFixed(
|
|
2436
|
+
function Et(e, t) {
|
|
2437
|
+
return Number(e.toFixed(wt(t)));
|
|
2400
2438
|
}
|
|
2401
2439
|
// src/components/RangeFilterPanel.tsx
|
|
2402
|
-
function
|
|
2440
|
+
function Dt(e, t, n) {
|
|
2403
2441
|
let r = t + Math.round((e - t) / n) * n;
|
|
2404
|
-
return Number(r.toFixed(
|
|
2442
|
+
return Number(r.toFixed(wt(n)));
|
|
2405
2443
|
}
|
|
2406
|
-
function
|
|
2444
|
+
function Ot(e, t, n) {
|
|
2407
2445
|
let r = Math.ceil(Number(((e - t) / n).toFixed(6)));
|
|
2408
|
-
return Number((t + r * n).toFixed(
|
|
2446
|
+
return Number((t + r * n).toFixed(wt(n)));
|
|
2409
2447
|
}
|
|
2410
|
-
var
|
|
2411
|
-
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 } =
|
|
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] ?? {
|
|
2412
2450
|
min: r,
|
|
2413
2451
|
max: i
|
|
2414
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(() => {
|
|
2415
2453
|
if (f) return f;
|
|
2416
|
-
let e = Math.max(
|
|
2417
|
-
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)));
|
|
2418
2456
|
return e === 0 ? 1 : Number((10 ** -e).toFixed(e));
|
|
2419
2457
|
}, [
|
|
2420
2458
|
f,
|
|
@@ -2422,21 +2460,21 @@ var At = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
2422
2460
|
F,
|
|
2423
2461
|
y,
|
|
2424
2462
|
t
|
|
2425
|
-
]), V = M && P === F, H = V ? r : P, U = V ? i : F, W =
|
|
2426
|
-
let e =
|
|
2427
|
-
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)` };
|
|
2428
2466
|
}, [
|
|
2429
2467
|
B,
|
|
2430
2468
|
P,
|
|
2431
2469
|
F,
|
|
2432
|
-
|
|
2433
|
-
|
|
2470
|
+
ae,
|
|
2471
|
+
se
|
|
2434
2472
|
]);
|
|
2435
2473
|
e.useEffect(() => {
|
|
2436
|
-
|
|
2437
|
-
}, [
|
|
2438
|
-
let { finalMin:
|
|
2439
|
-
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);
|
|
2440
2478
|
return {
|
|
2441
2479
|
finalMin: i,
|
|
2442
2480
|
finalMax: a,
|
|
@@ -2444,29 +2482,29 @@ var At = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
2444
2482
|
isValidMax: a <= F && a >= i
|
|
2445
2483
|
};
|
|
2446
2484
|
}, [
|
|
2447
|
-
|
|
2485
|
+
X,
|
|
2448
2486
|
P,
|
|
2449
2487
|
F
|
|
2450
2488
|
]);
|
|
2451
2489
|
e.useEffect(() => {
|
|
2452
2490
|
if (V) return;
|
|
2453
|
-
if (
|
|
2454
|
-
|
|
2491
|
+
if (X[0] === P && X[1] === F) {
|
|
2492
|
+
re(!1), Q(!1);
|
|
2455
2493
|
return;
|
|
2456
2494
|
}
|
|
2457
2495
|
let e = C ?? 500, n = setTimeout(() => {
|
|
2458
|
-
|
|
2496
|
+
re(!de), Q(!fe);
|
|
2459
2497
|
}, 300), r = setTimeout(() => {
|
|
2460
|
-
|
|
2498
|
+
de && fe && ($ === P && ue === F ? T(t, !1) : w(t, $, ue));
|
|
2461
2499
|
}, e);
|
|
2462
2500
|
return () => {
|
|
2463
2501
|
clearTimeout(n), clearTimeout(r);
|
|
2464
2502
|
};
|
|
2465
2503
|
}, [
|
|
2466
|
-
|
|
2504
|
+
$,
|
|
2505
|
+
ue,
|
|
2506
|
+
de,
|
|
2467
2507
|
fe,
|
|
2468
|
-
pe,
|
|
2469
|
-
me,
|
|
2470
2508
|
P,
|
|
2471
2509
|
F,
|
|
2472
2510
|
t,
|
|
@@ -2475,51 +2513,51 @@ var At = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
2475
2513
|
C,
|
|
2476
2514
|
V
|
|
2477
2515
|
]), e.useEffect(() => {
|
|
2478
|
-
|
|
2516
|
+
Z([q, te]), re(!1), Q(!1);
|
|
2479
2517
|
}, [
|
|
2518
|
+
q,
|
|
2480
2519
|
te,
|
|
2481
|
-
ne,
|
|
2482
2520
|
t
|
|
2483
2521
|
]);
|
|
2484
|
-
let
|
|
2485
|
-
let t =
|
|
2486
|
-
return [t,
|
|
2487
|
-
}, [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) => {
|
|
2488
2526
|
if (V) return;
|
|
2489
|
-
let [t, n] =
|
|
2490
|
-
|
|
2527
|
+
let [t, n] = pe(e);
|
|
2528
|
+
Z([Math.max(P, Math.min(R, t)), Math.max(L, Math.min(F, n))]);
|
|
2491
2529
|
}, [
|
|
2492
2530
|
V,
|
|
2493
|
-
|
|
2531
|
+
pe,
|
|
2494
2532
|
P,
|
|
2495
2533
|
F,
|
|
2496
2534
|
L,
|
|
2497
2535
|
R
|
|
2498
|
-
]),
|
|
2536
|
+
]), he = e.useCallback((e) => {
|
|
2499
2537
|
if (V) return;
|
|
2500
|
-
let [n, r] =
|
|
2501
|
-
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]);
|
|
2502
2540
|
}, [
|
|
2503
2541
|
V,
|
|
2504
|
-
|
|
2542
|
+
pe,
|
|
2505
2543
|
P,
|
|
2506
2544
|
F,
|
|
2507
2545
|
L,
|
|
2508
2546
|
R,
|
|
2509
2547
|
t,
|
|
2510
2548
|
T
|
|
2511
|
-
]),
|
|
2549
|
+
]), ge = e.useRef(null), _e = e.useCallback((e, n) => {
|
|
2512
2550
|
if (V) return;
|
|
2513
|
-
let r =
|
|
2551
|
+
let r = ge.current;
|
|
2514
2552
|
if (K && r && r.start === e && r.last === n) {
|
|
2515
|
-
|
|
2553
|
+
ge.current = null, Z([P, F]), T(t, !0);
|
|
2516
2554
|
return;
|
|
2517
2555
|
}
|
|
2518
|
-
let i =
|
|
2519
|
-
|
|
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 = {
|
|
2520
2558
|
start: e,
|
|
2521
2559
|
last: n
|
|
2522
|
-
},
|
|
2560
|
+
}, Z([i, a]);
|
|
2523
2561
|
}, [
|
|
2524
2562
|
V,
|
|
2525
2563
|
K,
|
|
@@ -2530,50 +2568,50 @@ var At = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
2530
2568
|
B,
|
|
2531
2569
|
t,
|
|
2532
2570
|
T
|
|
2533
|
-
]),
|
|
2571
|
+
]), ve = e.useCallback(() => {
|
|
2534
2572
|
if (V) return;
|
|
2535
|
-
let e =
|
|
2573
|
+
let e = ae.trim(), t = e === "" ? NaN : Number(e);
|
|
2536
2574
|
if (isNaN(t)) {
|
|
2537
|
-
|
|
2575
|
+
oe(String(X[0]));
|
|
2538
2576
|
return;
|
|
2539
2577
|
}
|
|
2540
2578
|
let n = Math.max(P, Math.min(R, t));
|
|
2541
|
-
n <
|
|
2579
|
+
n < X[1] ? Z([n, X[1]]) : Z([P, X[1]]), oe(String(n < X[1] ? n : P));
|
|
2542
2580
|
}, [
|
|
2543
2581
|
V,
|
|
2544
|
-
|
|
2545
|
-
|
|
2582
|
+
ae,
|
|
2583
|
+
X,
|
|
2546
2584
|
P,
|
|
2547
2585
|
R
|
|
2548
|
-
]),
|
|
2586
|
+
]), ye = e.useCallback(() => {
|
|
2549
2587
|
if (V) return;
|
|
2550
|
-
let e =
|
|
2588
|
+
let e = se.trim(), t = e === "" ? NaN : Number(e);
|
|
2551
2589
|
if (isNaN(t)) {
|
|
2552
|
-
|
|
2590
|
+
ce(String(X[1]));
|
|
2553
2591
|
return;
|
|
2554
2592
|
}
|
|
2555
2593
|
let n = Math.max(L, Math.min(F, t));
|
|
2556
|
-
n >
|
|
2594
|
+
n > X[0] ? Z([X[0], n]) : Z([X[0], F]), ce(String(n > X[0] ? n : F));
|
|
2557
2595
|
}, [
|
|
2558
2596
|
V,
|
|
2559
|
-
|
|
2560
|
-
|
|
2597
|
+
se,
|
|
2598
|
+
X,
|
|
2561
2599
|
L,
|
|
2562
2600
|
F
|
|
2563
|
-
]),
|
|
2601
|
+
]), be = (e) => (t) => {
|
|
2564
2602
|
t.key === "Enter" && e();
|
|
2565
|
-
}, [
|
|
2603
|
+
}, [xe, Se] = e.useState(null), we = e.useRef(null);
|
|
2566
2604
|
e.useEffect(() => {
|
|
2567
2605
|
if (!u) return;
|
|
2568
2606
|
let e = `${P}:${F}`;
|
|
2569
|
-
if (e ===
|
|
2607
|
+
if (e === we.current && we.current !== null) return;
|
|
2570
2608
|
let n = y?.[t];
|
|
2571
2609
|
if (!Array.isArray(n) || n.length === 0) return;
|
|
2572
2610
|
let r = n.filter((e) => e.value != null && !isNaN(Number(e.key))).map((e) => ({
|
|
2573
2611
|
key: e.key,
|
|
2574
2612
|
value: e.value
|
|
2575
2613
|
}));
|
|
2576
|
-
r.length > 0 && (
|
|
2614
|
+
r.length > 0 && (we.current = e, Se(r));
|
|
2577
2615
|
}, [
|
|
2578
2616
|
P,
|
|
2579
2617
|
F,
|
|
@@ -2581,22 +2619,22 @@ var At = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
2581
2619
|
t,
|
|
2582
2620
|
u
|
|
2583
2621
|
]);
|
|
2584
|
-
let
|
|
2585
|
-
if (!u || !
|
|
2622
|
+
let Te = e.useMemo(() => {
|
|
2623
|
+
if (!u || !xe || xe.length === 0) return [];
|
|
2586
2624
|
let e = F - P;
|
|
2587
2625
|
if (e <= 0) return [];
|
|
2588
|
-
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);
|
|
2589
2627
|
return Array.from({ length: n }, (e, r) => {
|
|
2590
|
-
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) => {
|
|
2591
2629
|
let t = Number(e.key);
|
|
2592
2630
|
return t >= i && (t < a || o && t <= F);
|
|
2593
|
-
}).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);
|
|
2594
2632
|
return {
|
|
2595
2633
|
bucketStart: i,
|
|
2596
2634
|
bucketEnd: a,
|
|
2597
2635
|
count: s,
|
|
2598
2636
|
last: c,
|
|
2599
|
-
barEnd:
|
|
2637
|
+
barEnd: Et(c + B, B)
|
|
2600
2638
|
};
|
|
2601
2639
|
}).map((e, t, n) => ({
|
|
2602
2640
|
...e,
|
|
@@ -2604,14 +2642,14 @@ var At = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
2604
2642
|
}));
|
|
2605
2643
|
}, [
|
|
2606
2644
|
u,
|
|
2607
|
-
|
|
2645
|
+
xe,
|
|
2608
2646
|
P,
|
|
2609
2647
|
F,
|
|
2610
2648
|
d,
|
|
2611
2649
|
B,
|
|
2612
2650
|
W
|
|
2613
|
-
]),
|
|
2614
|
-
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(
|
|
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, {
|
|
2615
2653
|
title: n,
|
|
2616
2654
|
variant: "slider",
|
|
2617
2655
|
withHistogram: u,
|
|
@@ -2624,72 +2662,72 @@ var At = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
2624
2662
|
className: ee,
|
|
2625
2663
|
children: [
|
|
2626
2664
|
V && /* @__PURE__ */ g("div", {
|
|
2627
|
-
className:
|
|
2665
|
+
className: Ct.disabledMessage,
|
|
2628
2666
|
children: [
|
|
2629
2667
|
"No adjustable range (all results have the same value: ",
|
|
2630
2668
|
P,
|
|
2631
2669
|
")."
|
|
2632
2670
|
]
|
|
2633
2671
|
}),
|
|
2634
|
-
u &&
|
|
2635
|
-
u &&
|
|
2636
|
-
let [e, t] = R > L && (L > P || R < F) ? [L, R] : [H, U], n = Math.max(
|
|
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) => ({
|
|
2637
2675
|
...e,
|
|
2638
|
-
height: Math.max(1, Math.ceil(e.count /
|
|
2676
|
+
height: Math.max(1, Math.ceil(e.count / Ee * 20))
|
|
2639
2677
|
}));
|
|
2640
2678
|
return /* @__PURE__ */ g("div", {
|
|
2641
|
-
className:
|
|
2679
|
+
className: Ct.histogram,
|
|
2642
2680
|
children: [
|
|
2643
2681
|
/* @__PURE__ */ h("div", {
|
|
2644
|
-
className:
|
|
2682
|
+
className: Ct.histogramLayer,
|
|
2645
2683
|
children: _.map((e, t) => /* @__PURE__ */ h("button", {
|
|
2646
2684
|
type: "button",
|
|
2647
|
-
className:
|
|
2685
|
+
className: Ct.histogramBar,
|
|
2648
2686
|
style: { flexGrow: e.span },
|
|
2649
2687
|
"data-testid": "histogram-bar",
|
|
2650
2688
|
disabled: V || p(e),
|
|
2651
2689
|
"aria-label": `${e.bucketStart} to ${e.last}: ${e.count}`,
|
|
2652
2690
|
title: `${e.bucketStart} to ${e.last}: ${e.count}`,
|
|
2653
|
-
onClick: () =>
|
|
2691
|
+
onClick: () => _e(e.bucketStart, e.last),
|
|
2654
2692
|
children: /* @__PURE__ */ h("span", {
|
|
2655
|
-
className:
|
|
2693
|
+
className: Ct.histogramFill,
|
|
2656
2694
|
style: { height: `${e.height}px` }
|
|
2657
2695
|
})
|
|
2658
2696
|
}, t))
|
|
2659
2697
|
}),
|
|
2660
2698
|
/* @__PURE__ */ h("div", {
|
|
2661
|
-
className: `${
|
|
2699
|
+
className: `${Ct.histogramLayer} ${Ct.histogramLive}`,
|
|
2662
2700
|
"aria-hidden": "true",
|
|
2663
2701
|
"data-testid": "histogram-live",
|
|
2664
2702
|
style: { clipPath: f },
|
|
2665
2703
|
children: _.map((e, t) => /* @__PURE__ */ h("span", {
|
|
2666
|
-
className:
|
|
2704
|
+
className: Ct.histogramBar,
|
|
2667
2705
|
style: { flexGrow: e.span },
|
|
2668
2706
|
children: /* @__PURE__ */ h("span", {
|
|
2669
|
-
className:
|
|
2707
|
+
className: Ct.histogramFill,
|
|
2670
2708
|
style: { height: `${e.height}px` }
|
|
2671
2709
|
})
|
|
2672
2710
|
}, t))
|
|
2673
2711
|
}),
|
|
2674
2712
|
/* @__PURE__ */ h("div", {
|
|
2675
|
-
className: `${
|
|
2713
|
+
className: `${Ct.histogramLayer} ${Ct.histogramLit}`,
|
|
2676
2714
|
"aria-hidden": "true",
|
|
2677
2715
|
"data-testid": "histogram-lit",
|
|
2678
2716
|
style: { clipPath: d },
|
|
2679
2717
|
children: _.map((e, t) => /* @__PURE__ */ h("span", {
|
|
2680
|
-
className:
|
|
2718
|
+
className: Ct.histogramBar,
|
|
2681
2719
|
style: { flexGrow: e.span },
|
|
2682
2720
|
children: /* @__PURE__ */ h("span", {
|
|
2683
|
-
className:
|
|
2721
|
+
className: Ct.histogramFill,
|
|
2684
2722
|
style: { height: `${e.height}px` }
|
|
2685
2723
|
})
|
|
2686
2724
|
}, t))
|
|
2687
2725
|
}),
|
|
2688
2726
|
/* @__PURE__ */ h("div", {
|
|
2689
|
-
className:
|
|
2727
|
+
className: Ct.histogramSeparators,
|
|
2690
2728
|
"aria-hidden": "true",
|
|
2691
2729
|
children: m.map((e, t) => /* @__PURE__ */ h("span", {
|
|
2692
|
-
className:
|
|
2730
|
+
className: Ct.histogramSeparator,
|
|
2693
2731
|
style: { left: e }
|
|
2694
2732
|
}, t))
|
|
2695
2733
|
})
|
|
@@ -2703,15 +2741,15 @@ var At = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
2703
2741
|
max: W,
|
|
2704
2742
|
step: B,
|
|
2705
2743
|
stepMarks: p,
|
|
2706
|
-
value: V ? [H, W] : [G(
|
|
2744
|
+
value: V ? [H, W] : [G(Dt($, H, B)), G(Dt(ue + B, H, B))],
|
|
2707
2745
|
isRange: !0,
|
|
2708
|
-
onChange: (e) =>
|
|
2709
|
-
onFinalChange: (e) =>
|
|
2746
|
+
onChange: (e) => me(e),
|
|
2747
|
+
onFinalChange: (e) => he(e),
|
|
2710
2748
|
disabled: V,
|
|
2711
2749
|
activeMin: L,
|
|
2712
|
-
activeMax: G(
|
|
2713
|
-
isFaceted:
|
|
2714
|
-
highlightFaceted:
|
|
2750
|
+
activeMax: G(Et(R + B, B)),
|
|
2751
|
+
isFaceted: Y,
|
|
2752
|
+
highlightFaceted: J,
|
|
2715
2753
|
"aria-label": n || `Filter by ${t}`
|
|
2716
2754
|
})
|
|
2717
2755
|
}),
|
|
@@ -2725,27 +2763,27 @@ var At = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
2725
2763
|
children: [/* @__PURE__ */ h(j, {
|
|
2726
2764
|
label: "Min:",
|
|
2727
2765
|
type: "number",
|
|
2728
|
-
style:
|
|
2729
|
-
value: V ? String(P) :
|
|
2766
|
+
style: le,
|
|
2767
|
+
value: V ? String(P) : ae,
|
|
2730
2768
|
min: P,
|
|
2731
|
-
max:
|
|
2732
|
-
onChange: (e) =>
|
|
2733
|
-
onBlur:
|
|
2734
|
-
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),
|
|
2735
2773
|
disabled: V,
|
|
2736
|
-
isValid: V || !
|
|
2774
|
+
isValid: V || !ne
|
|
2737
2775
|
}), /* @__PURE__ */ h(j, {
|
|
2738
2776
|
label: "Max:",
|
|
2739
2777
|
type: "number",
|
|
2740
|
-
style:
|
|
2741
|
-
value: V ? String(F) :
|
|
2742
|
-
min:
|
|
2778
|
+
style: le,
|
|
2779
|
+
value: V ? String(F) : se,
|
|
2780
|
+
min: Et(Math.max(L, X[0] + B), B),
|
|
2743
2781
|
max: F,
|
|
2744
|
-
onChange: (e) =>
|
|
2745
|
-
onBlur:
|
|
2746
|
-
onKeyDown:
|
|
2782
|
+
onChange: (e) => ce(e.target.value),
|
|
2783
|
+
onBlur: ye,
|
|
2784
|
+
onKeyDown: be(ye),
|
|
2747
2785
|
disabled: V,
|
|
2748
|
-
isValid: V || !
|
|
2786
|
+
isValid: V || !ie
|
|
2749
2787
|
})]
|
|
2750
2788
|
})
|
|
2751
2789
|
]
|
|
@@ -2753,7 +2791,7 @@ var At = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
2753
2791
|
title: n,
|
|
2754
2792
|
className: ee,
|
|
2755
2793
|
children: [V && /* @__PURE__ */ g("div", {
|
|
2756
|
-
className:
|
|
2794
|
+
className: Ct.disabledMessage,
|
|
2757
2795
|
children: [
|
|
2758
2796
|
"No adjustable range (all results have the same value: ",
|
|
2759
2797
|
P,
|
|
@@ -2768,35 +2806,35 @@ var At = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
2768
2806
|
children: [/* @__PURE__ */ h(j, {
|
|
2769
2807
|
label: "Min:",
|
|
2770
2808
|
type: "number",
|
|
2771
|
-
style:
|
|
2772
|
-
value: V ? String(P) :
|
|
2809
|
+
style: le,
|
|
2810
|
+
value: V ? String(P) : ae,
|
|
2773
2811
|
min: P,
|
|
2774
|
-
max:
|
|
2775
|
-
onChange: (e) =>
|
|
2776
|
-
onBlur:
|
|
2777
|
-
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),
|
|
2778
2816
|
disabled: V,
|
|
2779
|
-
isValid: V || !
|
|
2817
|
+
isValid: V || !ne
|
|
2780
2818
|
}), /* @__PURE__ */ h(j, {
|
|
2781
2819
|
label: "Max:",
|
|
2782
2820
|
type: "number",
|
|
2783
|
-
style:
|
|
2784
|
-
value: V ? String(F) :
|
|
2785
|
-
min:
|
|
2821
|
+
style: le,
|
|
2822
|
+
value: V ? String(F) : se,
|
|
2823
|
+
min: Et(Math.max(L, X[0] + B), B),
|
|
2786
2824
|
max: F,
|
|
2787
|
-
onChange: (e) =>
|
|
2788
|
-
onBlur:
|
|
2789
|
-
onKeyDown:
|
|
2825
|
+
onChange: (e) => ce(e.target.value),
|
|
2826
|
+
onBlur: ye,
|
|
2827
|
+
onKeyDown: be(ye),
|
|
2790
2828
|
disabled: V,
|
|
2791
|
-
isValid: V || !
|
|
2829
|
+
isValid: V || !ie
|
|
2792
2830
|
})]
|
|
2793
2831
|
})]
|
|
2794
|
-
}) : /* @__PURE__ */ h(
|
|
2832
|
+
}) : /* @__PURE__ */ h(bt, {
|
|
2795
2833
|
label: n,
|
|
2796
2834
|
field: t,
|
|
2797
2835
|
missing: ["filterable"]
|
|
2798
2836
|
});
|
|
2799
|
-
},
|
|
2837
|
+
}, At = {
|
|
2800
2838
|
list: "_list_9je85_2",
|
|
2801
2839
|
grid: "_grid_9je85_9",
|
|
2802
2840
|
count: "_count_9je85_22",
|
|
@@ -2805,7 +2843,7 @@ var At = ({ field: t, label: n, expectedMin: r = 0, expectedMax: i = 1e3, contro
|
|
|
2805
2843
|
active: "_active_9je85_41"
|
|
2806
2844
|
};
|
|
2807
2845
|
// src/components/BucketFilterPanel.tsx
|
|
2808
|
-
function
|
|
2846
|
+
function jt(e, t) {
|
|
2809
2847
|
if (!t) return null;
|
|
2810
2848
|
let n = 0, r = !1;
|
|
2811
2849
|
for (let i of t) {
|
|
@@ -2817,15 +2855,15 @@ function Mt(e, t) {
|
|
|
2817
2855
|
}
|
|
2818
2856
|
return r ? n : 0;
|
|
2819
2857
|
}
|
|
2820
|
-
var
|
|
2821
|
-
let { state: { facets: v, filterableFields: y, facetableFields: b, bucketFilters: x, rangeBounds: S, facetStats: w, query: E }, toggleBucketFilter: D, authError: O, isFetchingInitial: k, allowEmptySearch: j } =
|
|
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);
|
|
2822
2860
|
o(() => {
|
|
2823
2861
|
L(f ?? Infinity);
|
|
2824
2862
|
}, [f, N]);
|
|
2825
2863
|
let R = S?.[e] ?? w?.[e], z = s(() => {
|
|
2826
2864
|
let e = [];
|
|
2827
2865
|
if (R && e.push(R.min, R.max), Array.isArray(N)) for (let t of N) e.push(Number(t.key));
|
|
2828
|
-
return
|
|
2866
|
+
return Tt(e.filter(Number.isFinite));
|
|
2829
2867
|
}, [R, N]), B = s(() => {
|
|
2830
2868
|
let e = R?.min ?? -Number.MAX_VALUE, t = R?.max ?? Number.MAX_VALUE, i = (n, r, i) => ({
|
|
2831
2869
|
label: i ?? (n === void 0 ? `up to ${r}` : r === void 0 ? `${n} and up` : `${n}-${r}`),
|
|
@@ -2838,12 +2876,12 @@ var Nt = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2838
2876
|
if (r && r.length > 0) return r.map((e) => i(e.min, e.max, e.label));
|
|
2839
2877
|
if (Array.isArray(n)) {
|
|
2840
2878
|
let e = [...n].sort((e, t) => e - t), t = [];
|
|
2841
|
-
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)));
|
|
2842
2880
|
return t;
|
|
2843
2881
|
}
|
|
2844
2882
|
if (typeof n == "number" && n > 0 && R) {
|
|
2845
2883
|
let e = [], t = Math.floor(R.min / n) * n;
|
|
2846
|
-
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)));
|
|
2847
2885
|
return e;
|
|
2848
2886
|
}
|
|
2849
2887
|
return [];
|
|
@@ -2854,21 +2892,21 @@ var Nt = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2854
2892
|
z
|
|
2855
2893
|
]);
|
|
2856
2894
|
if (O) return null;
|
|
2857
|
-
if (k || !v) return /* @__PURE__ */ h(
|
|
2895
|
+
if (k || !v) return /* @__PURE__ */ h(_t, {
|
|
2858
2896
|
title: t,
|
|
2859
2897
|
rows: Math.max(1, Math.min(B.length || 5, 8)),
|
|
2860
2898
|
collapsible: m,
|
|
2861
2899
|
startCollapsed: _
|
|
2862
2900
|
});
|
|
2863
2901
|
if (!j && !E) return null;
|
|
2864
|
-
if (!y?.includes(e)) return /* @__PURE__ */ h(
|
|
2902
|
+
if (!y?.includes(e)) return /* @__PURE__ */ h(bt, {
|
|
2865
2903
|
label: t,
|
|
2866
2904
|
field: e,
|
|
2867
2905
|
missing: ["filterable"]
|
|
2868
2906
|
});
|
|
2869
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) => ({
|
|
2870
2908
|
bucket: e,
|
|
2871
|
-
count: V ?
|
|
2909
|
+
count: V ? jt(e, N) : null
|
|
2872
2910
|
}));
|
|
2873
2911
|
if (d || (U = U.filter((e) => e.count !== 0 || H(e.bucket))), U.length === 0) return null;
|
|
2874
2912
|
let W = U.slice(0, I), G = (t, n) => {
|
|
@@ -2884,9 +2922,9 @@ var Nt = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2884
2922
|
disabled: i
|
|
2885
2923
|
});
|
|
2886
2924
|
return c === "list" ? /* @__PURE__ */ g("div", {
|
|
2887
|
-
className:
|
|
2925
|
+
className: At.count,
|
|
2888
2926
|
children: [n, /* @__PURE__ */ h("span", {
|
|
2889
|
-
className:
|
|
2927
|
+
className: At.countValue,
|
|
2890
2928
|
children: a
|
|
2891
2929
|
})]
|
|
2892
2930
|
}) : n;
|
|
@@ -2897,19 +2935,19 @@ var Nt = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2897
2935
|
onClick: o,
|
|
2898
2936
|
disabled: i,
|
|
2899
2937
|
size: "micro",
|
|
2900
|
-
className:
|
|
2938
|
+
className: At.chip,
|
|
2901
2939
|
children: c === "grid" && a ? `${t.label} (${a})` : t.label
|
|
2902
2940
|
});
|
|
2903
2941
|
return c === "list" ? /* @__PURE__ */ g("div", {
|
|
2904
|
-
className:
|
|
2942
|
+
className: At.count,
|
|
2905
2943
|
children: [e, /* @__PURE__ */ h("span", {
|
|
2906
|
-
className:
|
|
2944
|
+
className: At.countValue,
|
|
2907
2945
|
children: a
|
|
2908
2946
|
})]
|
|
2909
2947
|
}) : e;
|
|
2910
2948
|
}
|
|
2911
2949
|
return c === "list" ? /* @__PURE__ */ g("div", {
|
|
2912
|
-
className:
|
|
2950
|
+
className: At.count,
|
|
2913
2951
|
children: [/* @__PURE__ */ h(T, {
|
|
2914
2952
|
label: t.label,
|
|
2915
2953
|
score: "",
|
|
@@ -2917,7 +2955,7 @@ var Nt = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2917
2955
|
onChange: o,
|
|
2918
2956
|
disabled: i
|
|
2919
2957
|
}), /* @__PURE__ */ h("span", {
|
|
2920
|
-
className:
|
|
2958
|
+
className: At.countValue,
|
|
2921
2959
|
children: a
|
|
2922
2960
|
})]
|
|
2923
2961
|
}) : /* @__PURE__ */ h(T, {
|
|
@@ -2932,9 +2970,9 @@ var Nt = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2932
2970
|
title: t,
|
|
2933
2971
|
collapsible: m,
|
|
2934
2972
|
collapsed: m ? _ : !1,
|
|
2935
|
-
className: p && F.length > 0 ?
|
|
2973
|
+
className: p && F.length > 0 ? At.active : void 0,
|
|
2936
2974
|
children: /* @__PURE__ */ g("ul", {
|
|
2937
|
-
className: c === "grid" ?
|
|
2975
|
+
className: c === "grid" ? At.grid : At.list,
|
|
2938
2976
|
style: {
|
|
2939
2977
|
listStyle: "none",
|
|
2940
2978
|
padding: 0,
|
|
@@ -2948,12 +2986,12 @@ var Nt = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2948
2986
|
}) })]
|
|
2949
2987
|
})
|
|
2950
2988
|
});
|
|
2951
|
-
},
|
|
2989
|
+
}, Nt = {
|
|
2952
2990
|
select: "_select_nwf7i_1",
|
|
2953
2991
|
radioGroup: "_radioGroup_nwf7i_6"
|
|
2954
|
-
},
|
|
2955
|
-
let o = n ?? (r === "radio" ? "radio" : "select"), { state: { sortableFields: s, sortBy: c, sortAscending: l }, setSort: u, isFetchingInitial: d } =
|
|
2956
|
-
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, {
|
|
2957
2995
|
title: "Sort by",
|
|
2958
2996
|
rows: o === "radio" ? 3 : 1,
|
|
2959
2997
|
collapsible: i,
|
|
@@ -2990,7 +3028,7 @@ var Nt = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
2990
3028
|
placeholder: "Select sort...",
|
|
2991
3029
|
"aria-label": "Sort by"
|
|
2992
3030
|
}) : /* @__PURE__ */ h("div", {
|
|
2993
|
-
className:
|
|
3031
|
+
className: Nt.radioGroup,
|
|
2994
3032
|
children: m.map((e) => /* @__PURE__ */ h(P, {
|
|
2995
3033
|
id: `sort-${e.value}`,
|
|
2996
3034
|
name: "sort-by",
|
|
@@ -3001,7 +3039,7 @@ var Nt = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
3001
3039
|
}, e.value))
|
|
3002
3040
|
})
|
|
3003
3041
|
});
|
|
3004
|
-
},
|
|
3042
|
+
}, Ft = { list: "_list_1y4fk_1" }, It = {
|
|
3005
3043
|
tolerance: p.TwoEdits,
|
|
3006
3044
|
rungs: u.Fewest,
|
|
3007
3045
|
oneEditFrom: 3,
|
|
@@ -3010,18 +3048,18 @@ var Nt = ({ field: e, label: t, width: n, buckets: r, control: i, displayType: a
|
|
|
3010
3048
|
typingPrefixFrom: 2,
|
|
3011
3049
|
typingPrefixOneEditFrom: 6,
|
|
3012
3050
|
joinedWords: !0
|
|
3013
|
-
},
|
|
3051
|
+
}, Lt = {
|
|
3014
3052
|
candidatesPerRow: 4,
|
|
3015
3053
|
fallback: !0,
|
|
3016
3054
|
rest: !1
|
|
3017
|
-
},
|
|
3055
|
+
}, Rt = {
|
|
3018
3056
|
rerank: !0,
|
|
3019
3057
|
share: .2,
|
|
3020
3058
|
typingShift: .5,
|
|
3021
3059
|
wholeQueryFloor: !0
|
|
3022
3060
|
};
|
|
3023
|
-
function
|
|
3024
|
-
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);
|
|
3025
3063
|
o(() => {
|
|
3026
3064
|
let e = !0;
|
|
3027
3065
|
try {
|
|
@@ -3039,13 +3077,13 @@ function Bt() {
|
|
|
3039
3077
|
a
|
|
3040
3078
|
]);
|
|
3041
3079
|
let x = (e) => Object.fromEntries(Object.entries(e ?? {}).filter(([, e]) => e != null)), S = {
|
|
3042
|
-
...
|
|
3080
|
+
...It,
|
|
3043
3081
|
...x(y?.match)
|
|
3044
3082
|
}, w = {
|
|
3045
|
-
...
|
|
3083
|
+
...Lt,
|
|
3046
3084
|
...x(y?.candidates)
|
|
3047
3085
|
}, T = {
|
|
3048
|
-
...
|
|
3086
|
+
...Rt,
|
|
3049
3087
|
...x(y?.ranking)
|
|
3050
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 || [
|
|
3051
3089
|
f,
|
|
@@ -3067,7 +3105,7 @@ function Bt() {
|
|
|
3067
3105
|
collapsed: !0,
|
|
3068
3106
|
title: "Settings",
|
|
3069
3107
|
children: /* @__PURE__ */ g("ul", {
|
|
3070
|
-
className:
|
|
3108
|
+
className: Ft.list,
|
|
3071
3109
|
children: [
|
|
3072
3110
|
/* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(I, {
|
|
3073
3111
|
label: "Mode",
|
|
@@ -3265,7 +3303,7 @@ function Bt() {
|
|
|
3265
3303
|
});
|
|
3266
3304
|
}
|
|
3267
3305
|
// src/components/SearchErrorBoundary.tsx
|
|
3268
|
-
var
|
|
3306
|
+
var Bt = class extends t {
|
|
3269
3307
|
constructor(e) {
|
|
3270
3308
|
super(e), this.state = {
|
|
3271
3309
|
hasError: !1,
|
|
@@ -3346,8 +3384,8 @@ var Vt = class extends t {
|
|
|
3346
3384
|
}
|
|
3347
3385
|
};
|
|
3348
3386
|
// src/hooks/useVectorSearch.ts
|
|
3349
|
-
function
|
|
3350
|
-
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);
|
|
3351
3389
|
return o(() => () => {
|
|
3352
3390
|
g.current++;
|
|
3353
3391
|
}, [
|
|
@@ -3373,7 +3411,7 @@ function Ht(e, t) {
|
|
|
3373
3411
|
headers: { "Content-Type": "application/json" },
|
|
3374
3412
|
body: JSON.stringify(l)
|
|
3375
3413
|
});
|
|
3376
|
-
if (!u.ok) throw await
|
|
3414
|
+
if (!u.ok) throw await $.fromResponse("VectorSearch", u);
|
|
3377
3415
|
let f = await u.json();
|
|
3378
3416
|
if (!c()) return;
|
|
3379
3417
|
if (f.length === 0) {
|
|
@@ -3385,7 +3423,7 @@ function Ht(e, t) {
|
|
|
3385
3423
|
headers: { "Content-Type": "application/json" },
|
|
3386
3424
|
body: JSON.stringify(p)
|
|
3387
3425
|
});
|
|
3388
|
-
if (!m.ok) throw await
|
|
3426
|
+
if (!m.ok) throw await $.fromResponse("GetJson", m);
|
|
3389
3427
|
let h = await m.json();
|
|
3390
3428
|
if (!c()) return;
|
|
3391
3429
|
d(h.map((e, t) => ({
|
|
@@ -3412,8 +3450,8 @@ function Ht(e, t) {
|
|
|
3412
3450
|
};
|
|
3413
3451
|
}
|
|
3414
3452
|
// src/hooks/useHybridSearch.ts
|
|
3415
|
-
function
|
|
3416
|
-
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);
|
|
3417
3455
|
return o(() => () => {
|
|
3418
3456
|
g.current++;
|
|
3419
3457
|
}, [
|
|
@@ -3441,7 +3479,7 @@ function Ut(e, t) {
|
|
|
3441
3479
|
headers: { "Content-Type": "application/json" },
|
|
3442
3480
|
body: JSON.stringify(l)
|
|
3443
3481
|
});
|
|
3444
|
-
if (!u.ok) throw await
|
|
3482
|
+
if (!u.ok) throw await $.fromResponse("HybridSearch", u);
|
|
3445
3483
|
let f = await u.json();
|
|
3446
3484
|
if (!c()) return;
|
|
3447
3485
|
if (f.length === 0) {
|
|
@@ -3453,7 +3491,7 @@ function Ut(e, t) {
|
|
|
3453
3491
|
headers: { "Content-Type": "application/json" },
|
|
3454
3492
|
body: JSON.stringify(p)
|
|
3455
3493
|
});
|
|
3456
|
-
if (!m.ok) throw await
|
|
3494
|
+
if (!m.ok) throw await $.fromResponse("GetJson", m);
|
|
3457
3495
|
let h = await m.json();
|
|
3458
3496
|
if (!c()) return;
|
|
3459
3497
|
d(h.map((e, t) => ({
|
|
@@ -3482,7 +3520,7 @@ function Ut(e, t) {
|
|
|
3482
3520
|
};
|
|
3483
3521
|
}
|
|
3484
3522
|
// src/hooks/useAsk.ts
|
|
3485
|
-
var
|
|
3523
|
+
var Ut = {
|
|
3486
3524
|
question: "",
|
|
3487
3525
|
status: "idle",
|
|
3488
3526
|
answer: "",
|
|
@@ -3490,10 +3528,10 @@ var Wt = {
|
|
|
3490
3528
|
steps: [],
|
|
3491
3529
|
stepDetails: []
|
|
3492
3530
|
};
|
|
3493
|
-
function
|
|
3494
|
-
let e =
|
|
3531
|
+
function Wt() {
|
|
3532
|
+
let e = Ce(), { url: t, team: n, dataset: r, authenticatedFetch: a } = e, s = c(e);
|
|
3495
3533
|
s.current = e;
|
|
3496
|
-
let [u, d] = l(
|
|
3534
|
+
let [u, d] = l(Ut), f = c(u);
|
|
3497
3535
|
f.current = u;
|
|
3498
3536
|
let p = c(null), m = i(async (e, i = [], o = {}) => {
|
|
3499
3537
|
let c = e.trim();
|
|
@@ -3526,7 +3564,7 @@ function Gt() {
|
|
|
3526
3564
|
}
|
|
3527
3565
|
}));
|
|
3528
3566
|
try {
|
|
3529
|
-
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)}`, {
|
|
3530
3568
|
method: "POST",
|
|
3531
3569
|
headers: {
|
|
3532
3570
|
"Content-Type": "application/json",
|
|
@@ -3542,7 +3580,7 @@ function Gt() {
|
|
|
3542
3580
|
if (e.status === 429) {
|
|
3543
3581
|
let t = await e.json().catch(() => ({}));
|
|
3544
3582
|
if (o.proactive) {
|
|
3545
|
-
d(
|
|
3583
|
+
d(Ut);
|
|
3546
3584
|
return;
|
|
3547
3585
|
}
|
|
3548
3586
|
let n = Number(e.headers.get("Retry-After"));
|
|
@@ -3561,14 +3599,14 @@ function Gt() {
|
|
|
3561
3599
|
})), !e.ok || !e.body) {
|
|
3562
3600
|
let t = await e.json().catch(() => ({}));
|
|
3563
3601
|
if (o.proactive) {
|
|
3564
|
-
d(
|
|
3602
|
+
d(Ut);
|
|
3565
3603
|
return;
|
|
3566
3604
|
}
|
|
3567
3605
|
let n = e.status === 409 || e.status === 404;
|
|
3568
3606
|
g(t.code ?? `http${e.status}`, n ? "Answers are not available here right now. Search still works." : "The question could not be asked.");
|
|
3569
3607
|
return;
|
|
3570
3608
|
}
|
|
3571
|
-
for await (let { event: t, data: n } of
|
|
3609
|
+
for await (let { event: t, data: n } of Ne(e.body)) switch (t) {
|
|
3572
3610
|
case "status": {
|
|
3573
3611
|
let e = n;
|
|
3574
3612
|
e.step && d((t) => ({
|
|
@@ -3657,7 +3695,7 @@ function Gt() {
|
|
|
3657
3695
|
r,
|
|
3658
3696
|
a
|
|
3659
3697
|
]), g = i(() => p.current?.abort(), []), _ = i(() => {
|
|
3660
|
-
p.current?.abort(), d(
|
|
3698
|
+
p.current?.abort(), d(Ut);
|
|
3661
3699
|
}, []);
|
|
3662
3700
|
return o(() => () => p.current?.abort(), []), {
|
|
3663
3701
|
...u,
|
|
@@ -3669,8 +3707,8 @@ function Gt() {
|
|
|
3669
3707
|
};
|
|
3670
3708
|
}
|
|
3671
3709
|
// src/hooks/useAskFlow.ts
|
|
3672
|
-
function
|
|
3673
|
-
let a =
|
|
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) => {
|
|
3674
3712
|
let n = e?.trim();
|
|
3675
3713
|
n && (f(n), g(!!t?.proactive), m((e) => e + 1), v("idle"), S(!!t?.proactive), b(t?.proactive ? null : { phase: "asking" }));
|
|
3676
3714
|
}, []), E = i((e) => {
|
|
@@ -3750,7 +3788,7 @@ function Kt({ searchOrAsk: e, restore: t, settleMs: n = 350, maxWaitMs: r }) {
|
|
|
3750
3788
|
}
|
|
3751
3789
|
};
|
|
3752
3790
|
}
|
|
3753
|
-
var
|
|
3791
|
+
var Kt = {
|
|
3754
3792
|
panel: "_panel_gjc13_1",
|
|
3755
3793
|
thread: "_thread_gjc13_4",
|
|
3756
3794
|
fill: "_fill_gjc13_5",
|
|
@@ -3766,18 +3804,18 @@ var qt = {
|
|
|
3766
3804
|
searchedLabel: "_searchedLabel_gjc13_23",
|
|
3767
3805
|
steps: "_steps_gjc13_26",
|
|
3768
3806
|
stepDone: "_stepDone_gjc13_27"
|
|
3769
|
-
},
|
|
3770
|
-
function
|
|
3807
|
+
}, qt = /(`[^`\n]+`)|(\*\*[^*\n]+\*\*)|(\*[^*\n]+\*|_[^_\n]+_)|(\[[^\]\n]+\]\(https?:\/\/[^)\s]+\))|(\[\d+\])/g;
|
|
3808
|
+
function Jt(t, n, r) {
|
|
3771
3809
|
let i = [], a = 0, o = 0;
|
|
3772
|
-
for (let s of t.matchAll(
|
|
3810
|
+
for (let s of t.matchAll(qt)) {
|
|
3773
3811
|
s.index > a && i.push(t.slice(a, s.index));
|
|
3774
3812
|
let c = `${r}-${o++}`, [l, u, d, f, p, m] = s;
|
|
3775
3813
|
if (u) i.push(/* @__PURE__ */ h("code", {
|
|
3776
|
-
className:
|
|
3814
|
+
className: Kt.inlineCode,
|
|
3777
3815
|
children: u.slice(1, -1)
|
|
3778
3816
|
}, c));
|
|
3779
|
-
else if (d) i.push(/* @__PURE__ */ h("strong", { children:
|
|
3780
|
-
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));
|
|
3781
3819
|
else if (p) {
|
|
3782
3820
|
let [, e, t] = /^\[([^\]]+)\]\(([^)]+)\)$/.exec(p);
|
|
3783
3821
|
i.push(/* @__PURE__ */ h("a", {
|
|
@@ -3791,7 +3829,7 @@ function Yt(t, n, r) {
|
|
|
3791
3829
|
}
|
|
3792
3830
|
return a < t.length && i.push(t.slice(a)), i;
|
|
3793
3831
|
}
|
|
3794
|
-
function
|
|
3832
|
+
function Yt(e) {
|
|
3795
3833
|
let t = e.replace(/\r\n/g, "\n").split("\n"), n = [], r = [], i = () => {
|
|
3796
3834
|
r.length && (n.push({
|
|
3797
3835
|
kind: "paragraph",
|
|
@@ -3840,48 +3878,48 @@ function Xt(e) {
|
|
|
3840
3878
|
}
|
|
3841
3879
|
return i(), n;
|
|
3842
3880
|
}
|
|
3843
|
-
function
|
|
3844
|
-
return
|
|
3881
|
+
function Xt(e, t) {
|
|
3882
|
+
return Yt(e).map((e, n) => {
|
|
3845
3883
|
let r = `b${n}`;
|
|
3846
3884
|
switch (e.kind) {
|
|
3847
3885
|
case "code": return /* @__PURE__ */ h("pre", {
|
|
3848
|
-
className:
|
|
3886
|
+
className: Kt.codeBlock,
|
|
3849
3887
|
"data-lang": e.lang || void 0,
|
|
3850
3888
|
children: /* @__PURE__ */ h("code", { children: e.text })
|
|
3851
3889
|
}, r);
|
|
3852
3890
|
case "heading": return /* @__PURE__ */ h("p", {
|
|
3853
|
-
className:
|
|
3854
|
-
children:
|
|
3891
|
+
className: Kt.heading,
|
|
3892
|
+
children: Jt(e.text, t, r)
|
|
3855
3893
|
}, r);
|
|
3856
3894
|
case "list": {
|
|
3857
3895
|
let n = e.ordered ? "ol" : "ul";
|
|
3858
3896
|
return /* @__PURE__ */ h(n, {
|
|
3859
|
-
className:
|
|
3860
|
-
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))
|
|
3861
3899
|
}, r);
|
|
3862
3900
|
}
|
|
3863
3901
|
default: return /* @__PURE__ */ h("p", {
|
|
3864
|
-
className:
|
|
3865
|
-
children:
|
|
3902
|
+
className: Kt.paragraph,
|
|
3903
|
+
children: Jt(e.text, t, r)
|
|
3866
3904
|
}, r);
|
|
3867
3905
|
}
|
|
3868
3906
|
});
|
|
3869
3907
|
}
|
|
3870
3908
|
// src/components/AskPanel.tsx
|
|
3871
|
-
var
|
|
3909
|
+
var Zt = /\[(\d+)\]/g, Qt = /* @__PURE__ */ new Set([
|
|
3872
3910
|
"nothingFound",
|
|
3873
3911
|
"searchOrAskDisabled",
|
|
3874
3912
|
"searchOrAskUnavailable",
|
|
3875
3913
|
"http404"
|
|
3876
3914
|
]);
|
|
3877
|
-
function
|
|
3915
|
+
function $t(e) {
|
|
3878
3916
|
let t = e.field.split(".")[0];
|
|
3879
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;
|
|
3880
3918
|
}
|
|
3881
|
-
var
|
|
3882
|
-
let A =
|
|
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);
|
|
3883
3921
|
M.current = j, o(() => () => M.current?.(null), []);
|
|
3884
|
-
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),
|
|
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);
|
|
3885
3923
|
o(() => {
|
|
3886
3924
|
H([]), K.current = [], M.current?.(null), e?.trim() ? N(e, [], { proactive: t }) : P();
|
|
3887
3925
|
}, [
|
|
@@ -3891,14 +3929,14 @@ var tn = ({ question: e, proactive: t = !1, followUps: n = !1, onSourceClick: r,
|
|
|
3891
3929
|
]), o(() => {
|
|
3892
3930
|
u?.(I);
|
|
3893
3931
|
}, [I, u]);
|
|
3894
|
-
let
|
|
3932
|
+
let J = c(void 0);
|
|
3895
3933
|
o(() => {
|
|
3896
|
-
A.filters && A.filters !==
|
|
3934
|
+
A.filters && A.filters !== J.current && (J.current = A.filters, d?.(A.filters));
|
|
3897
3935
|
}, [A.filters, d]);
|
|
3898
|
-
let
|
|
3936
|
+
let Y = c(void 0);
|
|
3899
3937
|
o(() => {
|
|
3900
|
-
if (A.picks && A.picks !==
|
|
3901
|
-
|
|
3938
|
+
if (A.picks && A.picks !== Y.current) {
|
|
3939
|
+
Y.current = A.picks;
|
|
3902
3940
|
let e = {
|
|
3903
3941
|
...A.picks,
|
|
3904
3942
|
askId: A.picks.askId ?? A.askId
|
|
@@ -3913,8 +3951,8 @@ var tn = ({ question: e, proactive: t = !1, followUps: n = !1, onSourceClick: r,
|
|
|
3913
3951
|
t,
|
|
3914
3952
|
j
|
|
3915
3953
|
]), o(() => {
|
|
3916
|
-
let e =
|
|
3917
|
-
w && e &&
|
|
3954
|
+
let e = q.current;
|
|
3955
|
+
w && e && te.current && (e.scrollTop = e.scrollHeight);
|
|
3918
3956
|
}, [
|
|
3919
3957
|
w,
|
|
3920
3958
|
A.answer,
|
|
@@ -3922,19 +3960,19 @@ var tn = ({ question: e, proactive: t = !1, followUps: n = !1, onSourceClick: r,
|
|
|
3922
3960
|
I,
|
|
3923
3961
|
V.length
|
|
3924
3962
|
]);
|
|
3925
|
-
let
|
|
3926
|
-
let e =
|
|
3927
|
-
e && (
|
|
3928
|
-
},
|
|
3929
|
-
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,
|
|
3930
3968
|
children: [
|
|
3931
3969
|
/* @__PURE__ */ g("span", {
|
|
3932
|
-
className:
|
|
3970
|
+
className: Kt.searchedLabel,
|
|
3933
3971
|
children: [e.more ? `${e.found}+` : e.found, " found"]
|
|
3934
3972
|
}),
|
|
3935
3973
|
e.filters.map((e, t) => /* @__PURE__ */ h(E, { children: m(e) }, t)),
|
|
3936
3974
|
e.text && /* @__PURE__ */ g("span", {
|
|
3937
|
-
className:
|
|
3975
|
+
className: Kt.searchedLabel,
|
|
3938
3976
|
children: [
|
|
3939
3977
|
"“",
|
|
3940
3978
|
e.text,
|
|
@@ -3942,7 +3980,7 @@ var tn = ({ question: e, proactive: t = !1, followUps: n = !1, onSourceClick: r,
|
|
|
3942
3980
|
]
|
|
3943
3981
|
}),
|
|
3944
3982
|
e.sort && /* @__PURE__ */ g("span", {
|
|
3945
|
-
className:
|
|
3983
|
+
className: Kt.searchedLabel,
|
|
3946
3984
|
children: [
|
|
3947
3985
|
"sorted by ",
|
|
3948
3986
|
e.sort.field.split(".")[0],
|
|
@@ -3954,31 +3992,31 @@ var tn = ({ question: e, proactive: t = !1, followUps: n = !1, onSourceClick: r,
|
|
|
3954
3992
|
]
|
|
3955
3993
|
});
|
|
3956
3994
|
if (I === "idle" && V.length === 0) return null;
|
|
3957
|
-
let
|
|
3995
|
+
let ne = (e, t) => (n) => {
|
|
3958
3996
|
n.preventDefault(), L(e, t), r?.(e);
|
|
3959
|
-
},
|
|
3997
|
+
}, re = (e, t) => (n) => {
|
|
3960
3998
|
let i = e.find((e) => e.n === n);
|
|
3961
3999
|
return /* @__PURE__ */ h(O, {
|
|
3962
4000
|
n,
|
|
3963
4001
|
title: i?.title,
|
|
3964
|
-
onClick: i && r ?
|
|
4002
|
+
onClick: i && r ? ne(i, t) : void 0
|
|
3965
4003
|
});
|
|
3966
|
-
},
|
|
3967
|
-
let r = new Set([...e.matchAll(
|
|
4004
|
+
}, ie = (e, t, n) => {
|
|
4005
|
+
let r = new Set([...e.matchAll(Zt)].map((e) => Number(e[1])));
|
|
3968
4006
|
return n && r.size > 0 ? t.filter((e) => r.has(e.n)) : t.slice(0, 3);
|
|
3969
|
-
},
|
|
3970
|
-
let o = a ? t :
|
|
4007
|
+
}, ae = (e, t, n, i, a = !1) => {
|
|
4008
|
+
let o = a ? t : ie(e, t, n);
|
|
3971
4009
|
return o.length > 0 && /* @__PURE__ */ h(D, {
|
|
3972
4010
|
label: a ? "Picked" : void 0,
|
|
3973
4011
|
items: o.map((e) => ({
|
|
3974
4012
|
n: e.n,
|
|
3975
4013
|
title: e.title,
|
|
3976
|
-
onClick: r ?
|
|
4014
|
+
onClick: r ? ne(e, i) : void 0
|
|
3977
4015
|
}))
|
|
3978
4016
|
});
|
|
3979
|
-
},
|
|
3980
|
-
navigator.clipboard?.writeText(A.answer.replace(
|
|
3981
|
-
},
|
|
4017
|
+
}, oe = () => {
|
|
4018
|
+
navigator.clipboard?.writeText(A.answer.replace(Zt, "")).catch(() => {}), z(!0), setTimeout(() => z(!1), 2e3);
|
|
4019
|
+
}, se = (e) => {
|
|
3982
4020
|
if (!A.busy && e.trim()) {
|
|
3983
4021
|
if (I === "answered" && A.answer) {
|
|
3984
4022
|
let e = {
|
|
@@ -4004,42 +4042,42 @@ var tn = ({ question: e, proactive: t = !1, followUps: n = !1, onSourceClick: r,
|
|
|
4004
4042
|
}
|
|
4005
4043
|
G(""), N(e, K.current);
|
|
4006
4044
|
}
|
|
4007
|
-
},
|
|
4045
|
+
}, ce = n ? () => ee.current?.focus() : s;
|
|
4008
4046
|
return /* @__PURE__ */ g("div", {
|
|
4009
|
-
className: `${
|
|
4047
|
+
className: `${Kt.panel} ${w ? Kt.fill : ""} ${T}`,
|
|
4010
4048
|
"aria-live": "polite",
|
|
4011
4049
|
"aria-busy": A.busy,
|
|
4012
4050
|
children: [/* @__PURE__ */ g("div", {
|
|
4013
|
-
ref:
|
|
4014
|
-
className:
|
|
4015
|
-
onScroll: w ?
|
|
4051
|
+
ref: q,
|
|
4052
|
+
className: Kt.thread,
|
|
4053
|
+
onScroll: w ? X : void 0,
|
|
4016
4054
|
children: [V.map((e, t) => /* @__PURE__ */ g("div", {
|
|
4017
|
-
className:
|
|
4055
|
+
className: Kt.turn,
|
|
4018
4056
|
children: [/* @__PURE__ */ h(W, { children: e.question }), /* @__PURE__ */ g(x, {
|
|
4019
4057
|
label: i,
|
|
4020
4058
|
children: [
|
|
4021
|
-
|
|
4059
|
+
Z(e.filters),
|
|
4022
4060
|
/* @__PURE__ */ h("div", {
|
|
4023
|
-
className:
|
|
4024
|
-
children: a(e.answer,
|
|
4061
|
+
className: Kt.answer,
|
|
4062
|
+
children: a(e.answer, re(e.sources, e.askId))
|
|
4025
4063
|
}),
|
|
4026
|
-
|
|
4064
|
+
ae(e.answer, e.sources, !0, e.askId, !!e.picks)
|
|
4027
4065
|
]
|
|
4028
4066
|
})]
|
|
4029
4067
|
}, t)), I !== "idle" && /* @__PURE__ */ g("div", {
|
|
4030
|
-
className:
|
|
4068
|
+
className: Kt.turn,
|
|
4031
4069
|
children: [/* @__PURE__ */ h(W, { children: A.question }), /* @__PURE__ */ g(x, {
|
|
4032
4070
|
label: i,
|
|
4033
4071
|
children: [
|
|
4034
|
-
|
|
4072
|
+
Z(A.filters),
|
|
4035
4073
|
A.answer && /* @__PURE__ */ h("div", {
|
|
4036
|
-
className:
|
|
4037
|
-
children: a(A.answer,
|
|
4074
|
+
className: Kt.answer,
|
|
4075
|
+
children: a(A.answer, re(A.sources))
|
|
4038
4076
|
}),
|
|
4039
4077
|
I === "searching" && A.steps.length > 0 && /* @__PURE__ */ g("div", {
|
|
4040
|
-
className:
|
|
4078
|
+
className: Kt.steps,
|
|
4041
4079
|
children: [A.steps.slice(0, -1).map((e, t) => /* @__PURE__ */ h("span", {
|
|
4042
|
-
className:
|
|
4080
|
+
className: Kt.stepDone,
|
|
4043
4081
|
children: e
|
|
4044
4082
|
}, t)), /* @__PURE__ */ g(B, { children: [A.steps[A.steps.length - 1], "…"] })]
|
|
4045
4083
|
}),
|
|
@@ -4054,12 +4092,12 @@ var tn = ({ question: e, proactive: t = !1, followUps: n = !1, onSourceClick: r,
|
|
|
4054
4092
|
children: [
|
|
4055
4093
|
/* @__PURE__ */ h(y, { children: A.error?.code === "nothingFound" ? "Nothing to answer from" : "The answer did not come through" }),
|
|
4056
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 }),
|
|
4057
|
-
|
|
4058
|
-
className:
|
|
4095
|
+
!Qt.has(A.error?.code ?? "") && /* @__PURE__ */ h("div", {
|
|
4096
|
+
className: Kt.action,
|
|
4059
4097
|
children: /* @__PURE__ */ h(C, {
|
|
4060
4098
|
variant: "secondary",
|
|
4061
4099
|
size: "micro",
|
|
4062
|
-
iconLeft: /* @__PURE__ */ h(
|
|
4100
|
+
iconLeft: /* @__PURE__ */ h(Q, {}),
|
|
4063
4101
|
onClick: () => N(A.question, K.current),
|
|
4064
4102
|
children: "Try again"
|
|
4065
4103
|
})
|
|
@@ -4080,11 +4118,11 @@ var tn = ({ question: e, proactive: t = !1, followUps: n = !1, onSourceClick: r,
|
|
|
4080
4118
|
". Search still works in the meantime."
|
|
4081
4119
|
] })]
|
|
4082
4120
|
}),
|
|
4083
|
-
I !== "error" && I !== "limited" &&
|
|
4121
|
+
I !== "error" && I !== "limited" && ae(A.answer, A.sources, I === "answered", void 0, !!A.picks),
|
|
4084
4122
|
I === "answered" && /* @__PURE__ */ h(b, {
|
|
4085
|
-
onCopy:
|
|
4123
|
+
onCopy: oe,
|
|
4086
4124
|
copied: R,
|
|
4087
|
-
onFollowUp:
|
|
4125
|
+
onFollowUp: ce
|
|
4088
4126
|
})
|
|
4089
4127
|
]
|
|
4090
4128
|
})]
|
|
@@ -4093,14 +4131,14 @@ var tn = ({ question: e, proactive: t = !1, followUps: n = !1, onSourceClick: r,
|
|
|
4093
4131
|
ref: ee,
|
|
4094
4132
|
value: U,
|
|
4095
4133
|
onChange: G,
|
|
4096
|
-
onSend:
|
|
4134
|
+
onSend: se,
|
|
4097
4135
|
onStop: F,
|
|
4098
4136
|
streaming: A.busy,
|
|
4099
4137
|
placeholder: "Ask a follow-up…",
|
|
4100
4138
|
"aria-label": "Ask a follow-up"
|
|
4101
4139
|
})]
|
|
4102
4140
|
});
|
|
4103
|
-
},
|
|
4141
|
+
}, tn = {
|
|
4104
4142
|
wrapper: "_wrapper_ssdz8_3",
|
|
4105
4143
|
component: "_component_ssdz8_4",
|
|
4106
4144
|
main: "_main_ssdz8_5",
|
|
@@ -4165,7 +4203,7 @@ function an(e, t) {
|
|
|
4165
4203
|
function on({ intro: e, examples: t, onAsk: n, onExample: r, placeholder: i }) {
|
|
4166
4204
|
let [a, o] = l("");
|
|
4167
4205
|
return /* @__PURE__ */ g("div", {
|
|
4168
|
-
className:
|
|
4206
|
+
className: tn.assistantEmpty,
|
|
4169
4207
|
children: [
|
|
4170
4208
|
e && /* @__PURE__ */ h("p", { children: e }),
|
|
4171
4209
|
t && t.length > 0 && /* @__PURE__ */ h(V, {
|
|
@@ -4186,7 +4224,7 @@ function on({ intro: e, examples: t, onAsk: n, onExample: r, placeholder: i }) {
|
|
|
4186
4224
|
}
|
|
4187
4225
|
function sn({ text: e }) {
|
|
4188
4226
|
return /* @__PURE__ */ h("div", {
|
|
4189
|
-
className:
|
|
4227
|
+
className: tn.working,
|
|
4190
4228
|
children: /* @__PURE__ */ h(B, {
|
|
4191
4229
|
spinner: "searching",
|
|
4192
4230
|
children: e
|
|
@@ -4197,7 +4235,7 @@ function cn({ filters: e, renderResult: t, results: n, mode: r, intro: i, exampl
|
|
|
4197
4235
|
let x = {
|
|
4198
4236
|
...nn,
|
|
4199
4237
|
...f
|
|
4200
|
-
}, w = c(null), T = an(w, v), E =
|
|
4238
|
+
}, w = c(null), T = an(w, v), E = Re({ mode: r }), D = Gt({
|
|
4201
4239
|
searchOrAsk: E,
|
|
4202
4240
|
restore: s
|
|
4203
4241
|
}), [O, k] = l("filters"), [A, j] = l(!1), [M, N] = l("");
|
|
@@ -4213,13 +4251,13 @@ function cn({ filters: e, renderResult: t, results: n, mode: r, intro: i, exampl
|
|
|
4213
4251
|
}, L = [{
|
|
4214
4252
|
value: "filters",
|
|
4215
4253
|
label: x.filters,
|
|
4216
|
-
icon:
|
|
4254
|
+
icon: oe
|
|
4217
4255
|
}, {
|
|
4218
4256
|
value: "assistant",
|
|
4219
4257
|
label: x.assistant,
|
|
4220
4258
|
icon: G
|
|
4221
4259
|
}], R = /* @__PURE__ */ h("div", {
|
|
4222
|
-
className:
|
|
4260
|
+
className: tn.buttons,
|
|
4223
4261
|
role: "group",
|
|
4224
4262
|
"aria-label": "Side panel",
|
|
4225
4263
|
children: L.map((e) => /* @__PURE__ */ h(C, {
|
|
@@ -4233,33 +4271,33 @@ function cn({ filters: e, renderResult: t, results: n, mode: r, intro: i, exampl
|
|
|
4233
4271
|
}), z = (e) => {
|
|
4234
4272
|
A && O === e ? j(!1) : (k(e), j(!0));
|
|
4235
4273
|
}, B = /* @__PURE__ */ g("div", {
|
|
4236
|
-
className:
|
|
4274
|
+
className: tn.side,
|
|
4237
4275
|
children: [!T && /* @__PURE__ */ h("div", {
|
|
4238
|
-
className:
|
|
4276
|
+
className: tn.sideHead,
|
|
4239
4277
|
children: R
|
|
4240
4278
|
}), /* @__PURE__ */ g("div", {
|
|
4241
|
-
className:
|
|
4279
|
+
className: tn.sidePanels,
|
|
4242
4280
|
children: [/* @__PURE__ */ h("div", {
|
|
4243
|
-
className:
|
|
4281
|
+
className: tn.sideBody,
|
|
4244
4282
|
hidden: O !== "filters",
|
|
4245
4283
|
children: e
|
|
4246
4284
|
}), /* @__PURE__ */ h("div", {
|
|
4247
|
-
className: `${
|
|
4285
|
+
className: `${tn.sideBody} ${tn.assistant}`,
|
|
4248
4286
|
hidden: O !== "assistant",
|
|
4249
4287
|
children: D.question ? /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("div", {
|
|
4250
|
-
className:
|
|
4288
|
+
className: tn.assistantHead,
|
|
4251
4289
|
children: /* @__PURE__ */ h(C, {
|
|
4252
4290
|
variant: "ghost",
|
|
4253
4291
|
size: "micro",
|
|
4254
|
-
iconLeft: /* @__PURE__ */ h(
|
|
4292
|
+
iconLeft: /* @__PURE__ */ h(J, {}),
|
|
4255
4293
|
onClick: D.newConversation,
|
|
4256
4294
|
children: x.newConversation
|
|
4257
4295
|
})
|
|
4258
|
-
}), /* @__PURE__ */ h(
|
|
4296
|
+
}), /* @__PURE__ */ h(en, {
|
|
4259
4297
|
...D.panelProps,
|
|
4260
4298
|
followUps: !0,
|
|
4261
4299
|
fill: !0,
|
|
4262
|
-
className:
|
|
4300
|
+
className: tn.askFill
|
|
4263
4301
|
}, D.run)] }) : /* @__PURE__ */ h(on, {
|
|
4264
4302
|
intro: i,
|
|
4265
4303
|
examples: a,
|
|
@@ -4271,18 +4309,18 @@ function cn({ filters: e, renderResult: t, results: n, mode: r, intro: i, exampl
|
|
|
4271
4309
|
})]
|
|
4272
4310
|
});
|
|
4273
4311
|
return /* @__PURE__ */ h("div", {
|
|
4274
|
-
className: `${
|
|
4312
|
+
className: `${tn.wrapper} ${b}`,
|
|
4275
4313
|
ref: w,
|
|
4276
4314
|
children: /* @__PURE__ */ g(S, {
|
|
4277
|
-
className:
|
|
4315
|
+
className: tn.component,
|
|
4278
4316
|
children: [/* @__PURE__ */ g("div", {
|
|
4279
|
-
className:
|
|
4317
|
+
className: tn.main,
|
|
4280
4318
|
children: [
|
|
4281
4319
|
/* @__PURE__ */ h("div", {
|
|
4282
|
-
className:
|
|
4283
|
-
children: /* @__PURE__ */ h(
|
|
4320
|
+
className: tn.header,
|
|
4321
|
+
children: /* @__PURE__ */ h(Ye, {
|
|
4284
4322
|
showFocus: !1,
|
|
4285
|
-
className:
|
|
4323
|
+
className: tn.searchInput,
|
|
4286
4324
|
autoFocus: _,
|
|
4287
4325
|
askOffer: u === "row" ? "door" : "chip",
|
|
4288
4326
|
...D.inputProps,
|
|
@@ -4291,11 +4329,11 @@ function cn({ filters: e, renderResult: t, results: n, mode: r, intro: i, exampl
|
|
|
4291
4329
|
})
|
|
4292
4330
|
}),
|
|
4293
4331
|
T && /* @__PURE__ */ g("div", {
|
|
4294
|
-
className:
|
|
4332
|
+
className: tn.mobileBar,
|
|
4295
4333
|
children: [A && /* @__PURE__ */ h(C, {
|
|
4296
4334
|
variant: "secondary",
|
|
4297
4335
|
size: "micro",
|
|
4298
|
-
className:
|
|
4336
|
+
className: tn.mobileBack,
|
|
4299
4337
|
onClick: () => j(!1),
|
|
4300
4338
|
children: x.showResults
|
|
4301
4339
|
}), L.map((e) => /* @__PURE__ */ h(C, {
|
|
@@ -4308,23 +4346,23 @@ function cn({ filters: e, renderResult: t, results: n, mode: r, intro: i, exampl
|
|
|
4308
4346
|
}, e.value))]
|
|
4309
4347
|
}),
|
|
4310
4348
|
T && A && /* @__PURE__ */ h("div", {
|
|
4311
|
-
className:
|
|
4349
|
+
className: tn.mobilePanel,
|
|
4312
4350
|
children: B
|
|
4313
4351
|
}),
|
|
4314
4352
|
/* @__PURE__ */ g("div", {
|
|
4315
|
-
className:
|
|
4353
|
+
className: tn.body,
|
|
4316
4354
|
hidden: T && A,
|
|
4317
4355
|
children: [
|
|
4318
|
-
u === "row" && D.offerShown && /* @__PURE__ */ h(
|
|
4356
|
+
u === "row" && D.offerShown && /* @__PURE__ */ h(Ve, {
|
|
4319
4357
|
searchOrAsk: E,
|
|
4320
4358
|
onAsk: P,
|
|
4321
4359
|
words: d,
|
|
4322
|
-
className:
|
|
4360
|
+
className: tn.offer
|
|
4323
4361
|
}),
|
|
4324
4362
|
D.waiting && /* @__PURE__ */ h(sn, { text: x.searching }),
|
|
4325
4363
|
/* @__PURE__ */ h("div", {
|
|
4326
4364
|
hidden: D.waiting,
|
|
4327
|
-
children: /* @__PURE__ */ h(
|
|
4365
|
+
children: /* @__PURE__ */ h(ft, {
|
|
4328
4366
|
...n,
|
|
4329
4367
|
searchOrAsk: E,
|
|
4330
4368
|
children: t
|
|
@@ -4334,9 +4372,9 @@ function cn({ filters: e, renderResult: t, results: n, mode: r, intro: i, exampl
|
|
|
4334
4372
|
})
|
|
4335
4373
|
]
|
|
4336
4374
|
}), !T && /* @__PURE__ */ h("div", {
|
|
4337
|
-
className:
|
|
4375
|
+
className: tn.column,
|
|
4338
4376
|
children: /* @__PURE__ */ h("div", {
|
|
4339
|
-
className:
|
|
4377
|
+
className: tn.frame,
|
|
4340
4378
|
children: B
|
|
4341
4379
|
})
|
|
4342
4380
|
})]
|
|
@@ -4367,7 +4405,7 @@ function dn({ title: e, filters: t, renderResult: n, results: r, mode: i, exampl
|
|
|
4367
4405
|
let y = {
|
|
4368
4406
|
...un,
|
|
4369
4407
|
...u
|
|
4370
|
-
}, b = c(null), x = an(b, p), { state: S, setQuery: w } =
|
|
4408
|
+
}, b = c(null), x = an(b, p), { state: S, setQuery: w } = Ce(), T = Re({ mode: i }), E = Gt({
|
|
4371
4409
|
searchOrAsk: T,
|
|
4372
4410
|
restore: o
|
|
4373
4411
|
}), [D, O] = l(!1);
|
|
@@ -4382,7 +4420,7 @@ function dn({ title: e, filters: t, renderResult: n, results: r, mode: i, exampl
|
|
|
4382
4420
|
/* @__PURE__ */ h(C, {
|
|
4383
4421
|
variant: "ghost",
|
|
4384
4422
|
size: "micro",
|
|
4385
|
-
iconLeft: /* @__PURE__ */ h(
|
|
4423
|
+
iconLeft: /* @__PURE__ */ h(q, {}),
|
|
4386
4424
|
onClick: () => {
|
|
4387
4425
|
let e = E.question;
|
|
4388
4426
|
E.newConversation(), e && w(e);
|
|
@@ -4420,7 +4458,7 @@ function dn({ title: e, filters: t, renderResult: n, results: r, mode: i, exampl
|
|
|
4420
4458
|
className: ln.right,
|
|
4421
4459
|
children: [
|
|
4422
4460
|
!k && /* @__PURE__ */ g(m, { children: [
|
|
4423
|
-
/* @__PURE__ */ h(
|
|
4461
|
+
/* @__PURE__ */ h(Ye, {
|
|
4424
4462
|
showFocus: !1,
|
|
4425
4463
|
autoFocus: f,
|
|
4426
4464
|
askOffer: "door",
|
|
@@ -4433,7 +4471,7 @@ function dn({ title: e, filters: t, renderResult: n, results: r, mode: i, exampl
|
|
|
4433
4471
|
variant: D ? "secondary" : "ghost",
|
|
4434
4472
|
size: "micro",
|
|
4435
4473
|
"aria-expanded": D,
|
|
4436
|
-
iconLeft: /* @__PURE__ */ h(
|
|
4474
|
+
iconLeft: /* @__PURE__ */ h(oe, {}),
|
|
4437
4475
|
onClick: () => O((e) => !e),
|
|
4438
4476
|
children: y.filters
|
|
4439
4477
|
})
|
|
@@ -4442,7 +4480,7 @@ function dn({ title: e, filters: t, renderResult: n, results: r, mode: i, exampl
|
|
|
4442
4480
|
className: ln.narrowLeft,
|
|
4443
4481
|
children: t
|
|
4444
4482
|
}),
|
|
4445
|
-
E.offerShown && /* @__PURE__ */ h(
|
|
4483
|
+
E.offerShown && /* @__PURE__ */ h(Ve, {
|
|
4446
4484
|
searchOrAsk: T,
|
|
4447
4485
|
onAsk: E.ask,
|
|
4448
4486
|
words: s
|
|
@@ -4455,7 +4493,7 @@ function dn({ title: e, filters: t, renderResult: n, results: r, mode: i, exampl
|
|
|
4455
4493
|
E.question && /* @__PURE__ */ h("div", {
|
|
4456
4494
|
className: ln.answer,
|
|
4457
4495
|
hidden: !k,
|
|
4458
|
-
children: /* @__PURE__ */ h(
|
|
4496
|
+
children: /* @__PURE__ */ h(en, {
|
|
4459
4497
|
...E.panelProps,
|
|
4460
4498
|
followUps: !0
|
|
4461
4499
|
}, E.run)
|
|
@@ -4466,7 +4504,7 @@ function dn({ title: e, filters: t, renderResult: n, results: r, mode: i, exampl
|
|
|
4466
4504
|
}),
|
|
4467
4505
|
/* @__PURE__ */ h("div", {
|
|
4468
4506
|
hidden: k && E.waiting,
|
|
4469
|
-
children: /* @__PURE__ */ h(
|
|
4507
|
+
children: /* @__PURE__ */ h(ft, {
|
|
4470
4508
|
...r,
|
|
4471
4509
|
searchOrAsk: T,
|
|
4472
4510
|
children: n
|
|
@@ -4478,7 +4516,7 @@ function dn({ title: e, filters: t, renderResult: n, results: r, mode: i, exampl
|
|
|
4478
4516
|
});
|
|
4479
4517
|
}
|
|
4480
4518
|
// src/components/QuickAnswer.tsx
|
|
4481
|
-
var fn = ({ labels: e, ...t }) => /* @__PURE__ */ h(
|
|
4519
|
+
var fn = ({ labels: e, ...t }) => /* @__PURE__ */ h(Ve, {
|
|
4482
4520
|
...t,
|
|
4483
4521
|
words: e && ((t) => ({
|
|
4484
4522
|
text: t.row === "hint" ? e.hint : t.row === "thinking" ? e.thinking : void 0,
|
|
@@ -4513,7 +4551,7 @@ var fn = ({ labels: e, ...t }) => /* @__PURE__ */ h(Ue, {
|
|
|
4513
4551
|
headerActions: _ && /* @__PURE__ */ h(C, {
|
|
4514
4552
|
variant: "ghost",
|
|
4515
4553
|
size: "micro",
|
|
4516
|
-
iconLeft: /* @__PURE__ */ h(
|
|
4554
|
+
iconLeft: /* @__PURE__ */ h(J, {}),
|
|
4517
4555
|
onClick: () => {
|
|
4518
4556
|
v(null), b((e) => e + 1);
|
|
4519
4557
|
},
|
|
@@ -4525,7 +4563,7 @@ var fn = ({ labels: e, ...t }) => /* @__PURE__ */ h(Ue, {
|
|
|
4525
4563
|
onClick: e.onClick,
|
|
4526
4564
|
children: e.label
|
|
4527
4565
|
}, e.label)),
|
|
4528
|
-
children: _ ? /* @__PURE__ */ h(
|
|
4566
|
+
children: _ ? /* @__PURE__ */ h(en, {
|
|
4529
4567
|
question: _,
|
|
4530
4568
|
followUps: !0,
|
|
4531
4569
|
fill: !0,
|
|
@@ -4554,4 +4592,4 @@ var fn = ({ labels: e, ...t }) => /* @__PURE__ */ h(Ue, {
|
|
|
4554
4592
|
})
|
|
4555
4593
|
});
|
|
4556
4594
|
};
|
|
4557
|
-
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 };
|