@indxsearch/intrface 4.0.0-beta.2 β†’ 4.0.0-beta.3

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