@brainfish-ai/components 0.22.10 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/avatar.d.ts +18 -0
  2. package/dist/chat-search.d.ts +14 -1
  3. package/dist/components/ui/avatar.d.ts +2 -0
  4. package/dist/dropdown-menu.d.ts +4 -0
  5. package/dist/esm/chunks/{ChatSearch.CgxpBVrd.js → ChatSearch.C6RERao6.js} +546 -188
  6. package/dist/esm/chunks/ChatSearch.C6RERao6.js.map +1 -0
  7. package/dist/esm/chunks/{FormattedMessage.ieoe4jPf.js → FormattedMessage.DFWDPJoI.js} +224 -224
  8. package/dist/esm/chunks/{FormattedMessage.ieoe4jPf.js.map → FormattedMessage.DFWDPJoI.js.map} +1 -1
  9. package/dist/esm/chunks/header-nav.gQJ2Hh5z.js +173 -0
  10. package/dist/esm/chunks/header-nav.gQJ2Hh5z.js.map +1 -0
  11. package/dist/esm/chunks/{hooks.CKojclfe.js → hooks.DI5ftshU.js} +29 -2
  12. package/dist/esm/chunks/hooks.DI5ftshU.js.map +1 -0
  13. package/dist/esm/chunks/{layout.Cxgg3kfZ.js → layout.Cw9KlzMD.js} +4 -4
  14. package/dist/esm/chunks/{layout.Cxgg3kfZ.js.map → layout.Cw9KlzMD.js.map} +1 -1
  15. package/dist/esm/chunks/{review-list.B1IHUfFS.js → review-list.CVJB3TFg.js} +3 -3
  16. package/dist/esm/chunks/{review-list.B1IHUfFS.js.map → review-list.CVJB3TFg.js.map} +1 -1
  17. package/dist/esm/chunks/{sidebar.Cfrsif7V.js → sidebar.BejmvpB3.js} +14 -13
  18. package/dist/esm/chunks/sidebar.BejmvpB3.js.map +1 -0
  19. package/dist/esm/components/chat-search.js +1 -1
  20. package/dist/esm/components/convos.js +4 -3
  21. package/dist/esm/components/convos.js.map +1 -1
  22. package/dist/esm/components/markdown.js +1 -1
  23. package/dist/esm/components/ui/avatar.js +90 -0
  24. package/dist/esm/components/ui/avatar.js.map +1 -0
  25. package/dist/esm/components/ui/dropdown-menu.js +8 -6
  26. package/dist/esm/components/ui/dropdown-menu.js.map +1 -1
  27. package/dist/esm/global.css +1 -1
  28. package/dist/esm/index.js +8 -7
  29. package/dist/esm/index.js.map +1 -1
  30. package/dist/esm/layouts/full-layout.js +2 -2
  31. package/dist/esm/layouts/header-nav.js +1 -1
  32. package/dist/esm/layouts/sidebar.js +1 -1
  33. package/dist/esm/scenes/knowledge-review.js +31 -10
  34. package/dist/esm/scenes/knowledge-review.js.map +1 -1
  35. package/dist/esm/tailwind.preset.js +12 -12
  36. package/dist/esm/tailwind.preset.js.map +1 -1
  37. package/dist/full-layout.d.ts +26 -1
  38. package/dist/header-nav.d.ts +26 -1
  39. package/dist/index.d.ts +59 -2
  40. package/dist/knowledge-review.d.ts +9 -1
  41. package/dist/stats.html +1 -1
  42. package/package.json +10 -9
  43. package/dist/esm/chunks/ChatSearch.CgxpBVrd.js.map +0 -1
  44. package/dist/esm/chunks/header-nav.DSUAniYA.js +0 -73
  45. package/dist/esm/chunks/header-nav.DSUAniYA.js.map +0 -1
  46. package/dist/esm/chunks/hooks.CKojclfe.js.map +0 -1
  47. package/dist/esm/chunks/sidebar.Cfrsif7V.js.map +0 -1
@@ -1,11 +1,11 @@
1
- import React__default, { useState, useCallback, useMemo, createContext, useContext, useRef, useEffect, forwardRef, useImperativeHandle } from 'react';
1
+ import React__default, { useState, useCallback, useMemo, useContext, createContext, useRef, useEffect, forwardRef, useImperativeHandle } from 'react';
2
2
  import { motion, AnimatePresence } from 'framer-motion';
3
3
  import rehypeRaw from 'rehype-raw';
4
4
  import remarkGfm from 'remark-gfm';
5
5
  import { TooltipProvider, Tooltip, TooltipTrigger, TooltipContent } from '../components/ui/tooltip.js';
6
6
  import { Button } from '../components/ui/button.js';
7
- import { XCircle, Check, Copy, CaretDown, ArrowSquareOut, CaretRight, ArrowsVertical, Globe, LockSimple, MagnifyingGlass, X, Image, ArrowRight, ArrowLeft, ArrowsInSimple, ArrowsOutSimple } from '@phosphor-icons/react';
8
- import { F as FormattedMessage, c as addPopupWidgetUtm, M as MemoizedReactMarkdown } from './FormattedMessage.ieoe4jPf.js';
7
+ import { XCircle, X, Check, Copy, CaretDown, ArrowSquareOut, CaretRight, ArrowsVertical, Globe, LockSimple, MagnifyingGlass, Plus, ArrowRight, ArrowLeft, ArrowsInSimple, ArrowsOutSimple } from '@phosphor-icons/react';
8
+ import { F as FormattedMessage, b as addPopupWidgetUtm, M as MemoizedReactMarkdown } from './FormattedMessage.DFWDPJoI.js';
9
9
  import { appendErrors, useForm, Controller } from 'react-hook-form';
10
10
  import { validateFieldsNatively, toNestErrors } from '@hookform/resolvers';
11
11
  import require$$0 from 'ajv';
@@ -27,7 +27,8 @@ import { getCountry } from 'countries-and-timezones';
27
27
  import { Switch } from '../components/ui/switch.js';
28
28
  import { C as Combobox } from './combobox.DNYCWyub.js';
29
29
  import { T as TwoLevelCombobox } from './two-level-combobox.DsWPDcI6.js';
30
- import { l as loadConversation, c as createConversationId, a as useAutocomplete, s as sendFeedbackReason, b as sendFeedback, d as searchApi, f as fetchAnswerStream, e as fetchFollowUpQuestions } from './hooks.CKojclfe.js';
30
+ import { X as X$1 } from 'lucide-react';
31
+ import { l as loadConversation, c as createConversationId, r as requestPresignedUrl, a as uploadFileToS3, b as useAutocomplete, s as sendFeedbackReason, d as sendFeedback, e as searchApi, f as fetchAnswerStream, g as fetchFollowUpQuestions } from './hooks.DI5ftshU.js';
31
32
  import { ScrollArea } from '../components/ui/scroll-area.js';
32
33
 
33
34
  import '../ChatSearch.css';function Suggestions({ suggestions, onQuestionClick, title = "Suggested questions" }) {
@@ -56,18 +57,18 @@ var hasRequiredCode$1;
56
57
  function requireCode$1 () {
57
58
  if (hasRequiredCode$1) return code$1;
58
59
  hasRequiredCode$1 = 1;
59
- (function (exports) {
60
- Object.defineProperty(exports, "__esModule", { value: true });
61
- exports.regexpCode = exports.getEsmExportName = exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = void 0;
60
+ (function (exports$1) {
61
+ Object.defineProperty(exports$1, "__esModule", { value: true });
62
+ exports$1.regexpCode = exports$1.getEsmExportName = exports$1.getProperty = exports$1.safeStringify = exports$1.stringify = exports$1.strConcat = exports$1.addCodeArg = exports$1.str = exports$1._ = exports$1.nil = exports$1._Code = exports$1.Name = exports$1.IDENTIFIER = exports$1._CodeOrName = void 0;
62
63
  // eslint-disable-next-line @typescript-eslint/no-extraneous-class
63
64
  class _CodeOrName {
64
65
  }
65
- exports._CodeOrName = _CodeOrName;
66
- exports.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
66
+ exports$1._CodeOrName = _CodeOrName;
67
+ exports$1.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
67
68
  class Name extends _CodeOrName {
68
69
  constructor(s) {
69
70
  super();
70
- if (!exports.IDENTIFIER.test(s))
71
+ if (!exports$1.IDENTIFIER.test(s))
71
72
  throw new Error("CodeGen: name must be a valid identifier");
72
73
  this.str = s;
73
74
  }
@@ -81,7 +82,7 @@ function requireCode$1 () {
81
82
  return { [this.str]: 1 };
82
83
  }
83
84
  }
84
- exports.Name = Name;
85
+ exports$1.Name = Name;
85
86
  class _Code extends _CodeOrName {
86
87
  constructor(code) {
87
88
  super();
@@ -109,8 +110,8 @@ function requireCode$1 () {
109
110
  }, {})));
110
111
  }
111
112
  }
112
- exports._Code = _Code;
113
- exports.nil = new _Code("");
113
+ exports$1._Code = _Code;
114
+ exports$1.nil = new _Code("");
114
115
  function _(strs, ...args) {
115
116
  const code = [strs[0]];
116
117
  let i = 0;
@@ -120,7 +121,7 @@ function requireCode$1 () {
120
121
  }
121
122
  return new _Code(code);
122
123
  }
123
- exports._ = _;
124
+ exports$1._ = _;
124
125
  const plus = new _Code("+");
125
126
  function str(strs, ...args) {
126
127
  const expr = [safeStringify(strs[0])];
@@ -133,7 +134,7 @@ function requireCode$1 () {
133
134
  optimize(expr);
134
135
  return new _Code(expr);
135
136
  }
136
- exports.str = str;
137
+ exports$1.str = str;
137
138
  function addCodeArg(code, arg) {
138
139
  if (arg instanceof _Code)
139
140
  code.push(...arg._items);
@@ -142,7 +143,7 @@ function requireCode$1 () {
142
143
  else
143
144
  code.push(interpolate(arg));
144
145
  }
145
- exports.addCodeArg = addCodeArg;
146
+ exports$1.addCodeArg = addCodeArg;
146
147
  function optimize(expr) {
147
148
  let i = 1;
148
149
  while (i < expr.length - 1) {
@@ -178,7 +179,7 @@ function requireCode$1 () {
178
179
  function strConcat(c1, c2) {
179
180
  return c2.emptyStr() ? c1 : c1.emptyStr() ? c2 : str `${c1}${c2}`;
180
181
  }
181
- exports.strConcat = strConcat;
182
+ exports$1.strConcat = strConcat;
182
183
  // TODO do not allow arrays here
183
184
  function interpolate(x) {
184
185
  return typeof x == "number" || typeof x == "boolean" || x === null
@@ -188,29 +189,29 @@ function requireCode$1 () {
188
189
  function stringify(x) {
189
190
  return new _Code(safeStringify(x));
190
191
  }
191
- exports.stringify = stringify;
192
+ exports$1.stringify = stringify;
192
193
  function safeStringify(x) {
193
194
  return JSON.stringify(x)
194
195
  .replace(/\u2028/g, "\\u2028")
195
196
  .replace(/\u2029/g, "\\u2029");
196
197
  }
197
- exports.safeStringify = safeStringify;
198
+ exports$1.safeStringify = safeStringify;
198
199
  function getProperty(key) {
199
- return typeof key == "string" && exports.IDENTIFIER.test(key) ? new _Code(`.${key}`) : _ `[${key}]`;
200
+ return typeof key == "string" && exports$1.IDENTIFIER.test(key) ? new _Code(`.${key}`) : _ `[${key}]`;
200
201
  }
201
- exports.getProperty = getProperty;
202
+ exports$1.getProperty = getProperty;
202
203
  //Does best effort to format the name properly
203
204
  function getEsmExportName(key) {
204
- if (typeof key == "string" && exports.IDENTIFIER.test(key)) {
205
+ if (typeof key == "string" && exports$1.IDENTIFIER.test(key)) {
205
206
  return new _Code(`${key}`);
206
207
  }
207
208
  throw new Error(`CodeGen: invalid export name: ${key}, use explicit $id name mapping`);
208
209
  }
209
- exports.getEsmExportName = getEsmExportName;
210
+ exports$1.getEsmExportName = getEsmExportName;
210
211
  function regexpCode(rx) {
211
212
  return new _Code(rx.toString());
212
213
  }
213
- exports.regexpCode = regexpCode;
214
+ exports$1.regexpCode = regexpCode;
214
215
 
215
216
  } (code$1));
216
217
  return code$1;
@@ -223,9 +224,9 @@ var hasRequiredScope;
223
224
  function requireScope () {
224
225
  if (hasRequiredScope) return scope;
225
226
  hasRequiredScope = 1;
226
- (function (exports) {
227
- Object.defineProperty(exports, "__esModule", { value: true });
228
- exports.ValueScope = exports.ValueScopeName = exports.Scope = exports.varKinds = exports.UsedValueState = void 0;
227
+ (function (exports$1) {
228
+ Object.defineProperty(exports$1, "__esModule", { value: true });
229
+ exports$1.ValueScope = exports$1.ValueScopeName = exports$1.Scope = exports$1.varKinds = exports$1.UsedValueState = void 0;
229
230
  const code_1 = requireCode$1();
230
231
  class ValueError extends Error {
231
232
  constructor(name) {
@@ -237,8 +238,8 @@ function requireScope () {
237
238
  (function (UsedValueState) {
238
239
  UsedValueState[UsedValueState["Started"] = 0] = "Started";
239
240
  UsedValueState[UsedValueState["Completed"] = 1] = "Completed";
240
- })(UsedValueState || (exports.UsedValueState = UsedValueState = {}));
241
- exports.varKinds = {
241
+ })(UsedValueState || (exports$1.UsedValueState = UsedValueState = {}));
242
+ exports$1.varKinds = {
242
243
  const: new code_1.Name("const"),
243
244
  let: new code_1.Name("let"),
244
245
  var: new code_1.Name("var"),
@@ -267,7 +268,7 @@ function requireScope () {
267
268
  return (this._names[prefix] = { prefix, index: 0 });
268
269
  }
269
270
  }
270
- exports.Scope = Scope;
271
+ exports$1.Scope = Scope;
271
272
  class ValueScopeName extends code_1.Name {
272
273
  constructor(prefix, nameStr) {
273
274
  super(nameStr);
@@ -278,7 +279,7 @@ function requireScope () {
278
279
  this.scopePath = (0, code_1._) `.${new code_1.Name(property)}[${itemIndex}]`;
279
280
  }
280
281
  }
281
- exports.ValueScopeName = ValueScopeName;
282
+ exports$1.ValueScopeName = ValueScopeName;
282
283
  const line = (0, code_1._) `\n`;
283
284
  class ValueScope extends Scope {
284
285
  constructor(opts) {
@@ -349,7 +350,7 @@ function requireScope () {
349
350
  nameSet.set(name, UsedValueState.Started);
350
351
  let c = valueCode(name);
351
352
  if (c) {
352
- const def = this.opts.es5 ? exports.varKinds.var : exports.varKinds.const;
353
+ const def = this.opts.es5 ? exports$1.varKinds.var : exports$1.varKinds.const;
353
354
  code = (0, code_1._) `${code}${def} ${name} = ${c};${this.opts._n}`;
354
355
  }
355
356
  else if ((c = getCode === null || getCode === void 0 ? void 0 : getCode(name))) {
@@ -364,7 +365,7 @@ function requireScope () {
364
365
  return code;
365
366
  }
366
367
  }
367
- exports.ValueScope = ValueScope;
368
+ exports$1.ValueScope = ValueScope;
368
369
 
369
370
  } (scope));
370
371
  return scope;
@@ -375,26 +376,26 @@ var hasRequiredCodegen;
375
376
  function requireCodegen () {
376
377
  if (hasRequiredCodegen) return codegen;
377
378
  hasRequiredCodegen = 1;
378
- (function (exports) {
379
- Object.defineProperty(exports, "__esModule", { value: true });
380
- exports.or = exports.and = exports.not = exports.CodeGen = exports.operators = exports.varKinds = exports.ValueScopeName = exports.ValueScope = exports.Scope = exports.Name = exports.regexpCode = exports.stringify = exports.getProperty = exports.nil = exports.strConcat = exports.str = exports._ = void 0;
379
+ (function (exports$1) {
380
+ Object.defineProperty(exports$1, "__esModule", { value: true });
381
+ exports$1.or = exports$1.and = exports$1.not = exports$1.CodeGen = exports$1.operators = exports$1.varKinds = exports$1.ValueScopeName = exports$1.ValueScope = exports$1.Scope = exports$1.Name = exports$1.regexpCode = exports$1.stringify = exports$1.getProperty = exports$1.nil = exports$1.strConcat = exports$1.str = exports$1._ = void 0;
381
382
  const code_1 = requireCode$1();
382
383
  const scope_1 = requireScope();
383
384
  var code_2 = requireCode$1();
384
- Object.defineProperty(exports, "_", { enumerable: true, get: function () { return code_2._; } });
385
- Object.defineProperty(exports, "str", { enumerable: true, get: function () { return code_2.str; } });
386
- Object.defineProperty(exports, "strConcat", { enumerable: true, get: function () { return code_2.strConcat; } });
387
- Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return code_2.nil; } });
388
- Object.defineProperty(exports, "getProperty", { enumerable: true, get: function () { return code_2.getProperty; } });
389
- Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return code_2.stringify; } });
390
- Object.defineProperty(exports, "regexpCode", { enumerable: true, get: function () { return code_2.regexpCode; } });
391
- Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return code_2.Name; } });
385
+ Object.defineProperty(exports$1, "_", { enumerable: true, get: function () { return code_2._; } });
386
+ Object.defineProperty(exports$1, "str", { enumerable: true, get: function () { return code_2.str; } });
387
+ Object.defineProperty(exports$1, "strConcat", { enumerable: true, get: function () { return code_2.strConcat; } });
388
+ Object.defineProperty(exports$1, "nil", { enumerable: true, get: function () { return code_2.nil; } });
389
+ Object.defineProperty(exports$1, "getProperty", { enumerable: true, get: function () { return code_2.getProperty; } });
390
+ Object.defineProperty(exports$1, "stringify", { enumerable: true, get: function () { return code_2.stringify; } });
391
+ Object.defineProperty(exports$1, "regexpCode", { enumerable: true, get: function () { return code_2.regexpCode; } });
392
+ Object.defineProperty(exports$1, "Name", { enumerable: true, get: function () { return code_2.Name; } });
392
393
  var scope_2 = requireScope();
393
- Object.defineProperty(exports, "Scope", { enumerable: true, get: function () { return scope_2.Scope; } });
394
- Object.defineProperty(exports, "ValueScope", { enumerable: true, get: function () { return scope_2.ValueScope; } });
395
- Object.defineProperty(exports, "ValueScopeName", { enumerable: true, get: function () { return scope_2.ValueScopeName; } });
396
- Object.defineProperty(exports, "varKinds", { enumerable: true, get: function () { return scope_2.varKinds; } });
397
- exports.operators = {
394
+ Object.defineProperty(exports$1, "Scope", { enumerable: true, get: function () { return scope_2.Scope; } });
395
+ Object.defineProperty(exports$1, "ValueScope", { enumerable: true, get: function () { return scope_2.ValueScope; } });
396
+ Object.defineProperty(exports$1, "ValueScopeName", { enumerable: true, get: function () { return scope_2.ValueScopeName; } });
397
+ Object.defineProperty(exports$1, "varKinds", { enumerable: true, get: function () { return scope_2.varKinds; } });
398
+ exports$1.operators = {
398
399
  GT: new code_1._Code(">"),
399
400
  GTE: new code_1._Code(">="),
400
401
  LT: new code_1._Code("<"),
@@ -808,7 +809,7 @@ function requireCodegen () {
808
809
  }
809
810
  // `+=` code
810
811
  add(lhs, rhs) {
811
- return this._leafNode(new AssignOp(lhs, exports.operators.ADD, rhs));
812
+ return this._leafNode(new AssignOp(lhs, exports$1.operators.ADD, rhs));
812
813
  }
813
814
  // appends passed SafeExpr to code or executes Block
814
815
  code(c) {
@@ -1010,7 +1011,7 @@ function requireCodegen () {
1010
1011
  ns[ns.length - 1] = node;
1011
1012
  }
1012
1013
  }
1013
- exports.CodeGen = CodeGen;
1014
+ exports$1.CodeGen = CodeGen;
1014
1015
  function addNames(names, from) {
1015
1016
  for (const n in from)
1016
1017
  names[n] = (names[n] || 0) + (from[n] || 0);
@@ -1052,19 +1053,19 @@ function requireCodegen () {
1052
1053
  function not(x) {
1053
1054
  return typeof x == "boolean" || typeof x == "number" || x === null ? !x : (0, code_1._) `!${par(x)}`;
1054
1055
  }
1055
- exports.not = not;
1056
- const andCode = mappend(exports.operators.AND);
1056
+ exports$1.not = not;
1057
+ const andCode = mappend(exports$1.operators.AND);
1057
1058
  // boolean AND (&&) expression with the passed arguments
1058
1059
  function and(...args) {
1059
1060
  return args.reduce(andCode);
1060
1061
  }
1061
- exports.and = and;
1062
- const orCode = mappend(exports.operators.OR);
1062
+ exports$1.and = and;
1063
+ const orCode = mappend(exports$1.operators.OR);
1063
1064
  // boolean OR (||) expression with the passed arguments
1064
1065
  function or(...args) {
1065
1066
  return args.reduce(orCode);
1066
1067
  }
1067
- exports.or = or;
1068
+ exports$1.or = or;
1068
1069
  function mappend(op) {
1069
1070
  return (x, y) => (x === code_1.nil ? y : y === code_1.nil ? x : (0, code_1._) `${par(x)} ${op} ${par(y)}`);
1070
1071
  }
@@ -1311,21 +1312,21 @@ var hasRequiredErrors;
1311
1312
  function requireErrors () {
1312
1313
  if (hasRequiredErrors) return errors;
1313
1314
  hasRequiredErrors = 1;
1314
- (function (exports) {
1315
- Object.defineProperty(exports, "__esModule", { value: true });
1316
- exports.extendErrors = exports.resetErrorsCount = exports.reportExtraError = exports.reportError = exports.keyword$DataError = exports.keywordError = void 0;
1315
+ (function (exports$1) {
1316
+ Object.defineProperty(exports$1, "__esModule", { value: true });
1317
+ exports$1.extendErrors = exports$1.resetErrorsCount = exports$1.reportExtraError = exports$1.reportError = exports$1.keyword$DataError = exports$1.keywordError = void 0;
1317
1318
  const codegen_1 = requireCodegen();
1318
1319
  const util_1 = requireUtil();
1319
1320
  const names_1 = requireNames();
1320
- exports.keywordError = {
1321
+ exports$1.keywordError = {
1321
1322
  message: ({ keyword }) => (0, codegen_1.str) `must pass "${keyword}" keyword validation`,
1322
1323
  };
1323
- exports.keyword$DataError = {
1324
+ exports$1.keyword$DataError = {
1324
1325
  message: ({ keyword, schemaType }) => schemaType
1325
1326
  ? (0, codegen_1.str) `"${keyword}" keyword must be ${schemaType} ($data)`
1326
1327
  : (0, codegen_1.str) `"${keyword}" keyword is invalid ($data)`,
1327
1328
  };
1328
- function reportError(cxt, error = exports.keywordError, errorPaths, overrideAllErrors) {
1329
+ function reportError(cxt, error = exports$1.keywordError, errorPaths, overrideAllErrors) {
1329
1330
  const { it } = cxt;
1330
1331
  const { gen, compositeRule, allErrors } = it;
1331
1332
  const errObj = errorObjectCode(cxt, error, errorPaths);
@@ -1336,8 +1337,8 @@ function requireErrors () {
1336
1337
  returnErrors(it, (0, codegen_1._) `[${errObj}]`);
1337
1338
  }
1338
1339
  }
1339
- exports.reportError = reportError;
1340
- function reportExtraError(cxt, error = exports.keywordError, errorPaths) {
1340
+ exports$1.reportError = reportError;
1341
+ function reportExtraError(cxt, error = exports$1.keywordError, errorPaths) {
1341
1342
  const { it } = cxt;
1342
1343
  const { gen, compositeRule, allErrors } = it;
1343
1344
  const errObj = errorObjectCode(cxt, error, errorPaths);
@@ -1346,12 +1347,12 @@ function requireErrors () {
1346
1347
  returnErrors(it, names_1.default.vErrors);
1347
1348
  }
1348
1349
  }
1349
- exports.reportExtraError = reportExtraError;
1350
+ exports$1.reportExtraError = reportExtraError;
1350
1351
  function resetErrorsCount(gen, errsCount) {
1351
1352
  gen.assign(names_1.default.errors, errsCount);
1352
1353
  gen.if((0, codegen_1._) `${names_1.default.vErrors} !== null`, () => gen.if(errsCount, () => gen.assign((0, codegen_1._) `${names_1.default.vErrors}.length`, errsCount), () => gen.assign(names_1.default.vErrors, null)));
1353
1354
  }
1354
- exports.resetErrorsCount = resetErrorsCount;
1355
+ exports$1.resetErrorsCount = resetErrorsCount;
1355
1356
  function extendErrors({ gen, keyword, schemaValue, data, errsCount, it, }) {
1356
1357
  /* istanbul ignore if */
1357
1358
  if (errsCount === undefined)
@@ -1367,7 +1368,7 @@ function requireErrors () {
1367
1368
  }
1368
1369
  });
1369
1370
  }
1370
- exports.extendErrors = extendErrors;
1371
+ exports$1.extendErrors = extendErrors;
1371
1372
  function addError(gen, errObj) {
1372
1373
  const err = gen.const("err", errObj);
1373
1374
  gen.if((0, codegen_1._) `${names_1.default.vErrors} === null`, () => gen.assign(names_1.default.vErrors, (0, codegen_1._) `[${err}]`), (0, codegen_1._) `${names_1.default.vErrors}.push(${err})`);
@@ -3028,8 +3029,8 @@ var hasRequiredDist;
3028
3029
  function requireDist () {
3029
3030
  if (hasRequiredDist) return dist.exports;
3030
3031
  hasRequiredDist = 1;
3031
- (function (module, exports) {
3032
- Object.defineProperty(exports, "__esModule", { value: true });
3032
+ (function (module, exports$1) {
3033
+ Object.defineProperty(exports$1, "__esModule", { value: true });
3033
3034
  const ajv_1 = require$$0;
3034
3035
  const codegen_1 = requireCodegen();
3035
3036
  const code_1 = requireCode$1();
@@ -3299,7 +3300,7 @@ function requireDist () {
3299
3300
  }
3300
3301
  return ajv.addKeyword(errorMessage(options));
3301
3302
  };
3302
- exports.default = ajvErrors;
3303
+ exports$1.default = ajvErrors;
3303
3304
  module.exports = ajvErrors;
3304
3305
  module.exports.default = ajvErrors;
3305
3306
 
@@ -3516,9 +3517,13 @@ const setAnswers = ({ answers }) => ({
3516
3517
  const clearAll = () => ({
3517
3518
  type: AnswersActions.CLEAR_ALL
3518
3519
  });
3519
- const appendNewAnswer = ({ id, query }) => ({
3520
+ const appendNewAnswer = ({
3521
+ id,
3522
+ query,
3523
+ attachments
3524
+ }) => ({
3520
3525
  type: AnswersActions.APPEND_NEW_ANSWER,
3521
- payload: { id, query }
3526
+ payload: { id, query, attachments }
3522
3527
  });
3523
3528
  const setSearchResults = ({
3524
3529
  searchQueryId,
@@ -3653,7 +3658,8 @@ const reducer = (draft, action) => {
3653
3658
  state: "fetching-search-results",
3654
3659
  question: action.payload.query,
3655
3660
  blocks: [markdownTextBlock()],
3656
- isUncertain: false
3661
+ isUncertain: false,
3662
+ attachments: action.payload.attachments
3657
3663
  });
3658
3664
  return;
3659
3665
  }
@@ -3792,7 +3798,7 @@ const useAnswerList = () => {
3792
3798
  };
3793
3799
 
3794
3800
  const CONVERSATION_PARAM = "conversation";
3795
- const useConversationId = (searchPath) => {
3801
+ const useConversationId = (searchPath, widgetKey) => {
3796
3802
  const conversationId = useSearchParam(CONVERSATION_PARAM);
3797
3803
  const [_conversationId, _setConversationId] = useState(conversationId ?? void 0);
3798
3804
  const setConversationId = useCallback(
@@ -3809,8 +3815,11 @@ const useConversationId = (searchPath) => {
3809
3815
  const newUrl = url.toString();
3810
3816
  window.history.replaceState({ ...window.history.state, newUrl, url: newUrl }, "", newUrl);
3811
3817
  _setConversationId(id);
3818
+ if (typeof window !== "undefined" && window.parent !== window) {
3819
+ window.parent.postMessage({ type: "CONVERSATION_CHANGED", conversationId: id, widgetKey }, "*");
3820
+ }
3812
3821
  },
3813
- [searchPath]
3822
+ [searchPath, widgetKey]
3814
3823
  );
3815
3824
  const clearConversationId = useCallback(() => {
3816
3825
  const url = new URL(window.location.href);
@@ -3818,12 +3827,15 @@ const useConversationId = (searchPath) => {
3818
3827
  const newUrl = url.toString();
3819
3828
  window.history.replaceState({ ...window.history.state, newUrl, url: newUrl }, "", newUrl);
3820
3829
  _setConversationId(void 0);
3821
- }, []);
3830
+ if (typeof window !== "undefined" && window.parent !== window) {
3831
+ window.parent.postMessage({ type: "CONVERSATION_CHANGED", conversationId: "", widgetKey }, "*");
3832
+ }
3833
+ }, [widgetKey]);
3822
3834
  return { conversationId: _conversationId, setConversationId, clearConversationId };
3823
3835
  };
3824
3836
 
3825
3837
  const ChatSearchContext = createContext(void 0);
3826
- const ChatSearchProvider = ({ children, searchPath, contentTypeEndpoint }) => {
3838
+ const ChatSearchProvider = ({ children, searchPath, contentTypeEndpoint, widgetKey }) => {
3827
3839
  const [query, setQuery] = useState("");
3828
3840
  const [queryId, setQueryId] = useState("");
3829
3841
  const [followUpQuery, setFollowUpQuery] = useState("");
@@ -3834,7 +3846,7 @@ const ChatSearchProvider = ({ children, searchPath, contentTypeEndpoint }) => {
3834
3846
  const [isLoadingConversation, setIsLoadingConversation] = useState(false);
3835
3847
  const [loadError, setLoadError] = useState("");
3836
3848
  const [showMobileCloseWidgetButton, setShowMobileCloseWidgetButton] = useState(false);
3837
- const { conversationId, setConversationId, clearConversationId } = useConversationId(searchPath);
3849
+ const { conversationId, setConversationId, clearConversationId } = useConversationId(searchPath, widgetKey);
3838
3850
  const contextValue = useMemo(
3839
3851
  () => ({
3840
3852
  query,
@@ -3922,6 +3934,46 @@ function AnswerBlock({ block, redirectRules, state }) {
3922
3934
  }
3923
3935
  }
3924
3936
 
3937
+ const sizeConfig = {
3938
+ xs: { container: "size-12", spinner: "size-3", close: "top-0.5 right-0.5 p-0.5", closeIcon: "size-2" },
3939
+ sm: { container: "size-16", spinner: "size-4", close: "top-0.5 right-0.5 p-0.5", closeIcon: "size-2.5" },
3940
+ md: { container: "size-20", spinner: "size-5", close: "top-1 right-1 p-1", closeIcon: "size-3" }
3941
+ };
3942
+ function AttachmentThumbnails({ items, size = "sm", onRemove, className }) {
3943
+ if (items.length === 0) return null;
3944
+ const config = sizeConfig[size];
3945
+ return /* @__PURE__ */ React__default.createElement("div", { className: cn("flex gap-2 overflow-x-auto", className) }, items.map((item) => /* @__PURE__ */ React__default.createElement("div", { key: item.id, className: cn("relative group rounded-lg overflow-hidden flex-shrink-0", config.container) }, /* @__PURE__ */ React__default.createElement(
3946
+ "a",
3947
+ {
3948
+ href: item.url,
3949
+ target: "_blank",
3950
+ rel: "noopener noreferrer",
3951
+ className: cn(!item.url && "pointer-events-none")
3952
+ },
3953
+ /* @__PURE__ */ React__default.createElement("img", { src: item.src, alt: item.alt || "Attachment", className: "w-full h-full object-cover" })
3954
+ ), item.status === "uploading" && /* @__PURE__ */ React__default.createElement("div", { className: "absolute inset-0 flex items-center justify-center bg-black/40" }, /* @__PURE__ */ React__default.createElement(
3955
+ "div",
3956
+ {
3957
+ className: cn(
3958
+ "animate-spin rounded-full border-[2.5px] border-black/30 border-t-white",
3959
+ config.spinner
3960
+ )
3961
+ }
3962
+ )), onRemove && /* @__PURE__ */ React__default.createElement(
3963
+ "button",
3964
+ {
3965
+ onClick: () => onRemove(item.id),
3966
+ className: cn(
3967
+ "absolute rounded-full opacity-0",
3968
+ "group-hover:opacity-100 transition-opacity duration-200",
3969
+ "hover:bg-black/70 bg-black/50",
3970
+ config.close
3971
+ )
3972
+ },
3973
+ /* @__PURE__ */ React__default.createElement(X, { className: cn("text-white", config.closeIcon), "aria-label": "Remove attachment" })
3974
+ ))));
3975
+ }
3976
+
3925
3977
  var ActionType = /* @__PURE__ */ ((ActionType2) => {
3926
3978
  ActionType2["CallPhone"] = "call_phone";
3927
3979
  ActionType2["OpenUrl"] = "open_url";
@@ -4338,6 +4390,7 @@ const useConversationLoader = ({ loadConversationEndpoint, headers, mergedTextCo
4338
4390
  };
4339
4391
  });
4340
4392
  answerListDispatch(setAnswers({ answers }));
4393
+ setConversationId(conversationId2);
4341
4394
  setShowResults(true);
4342
4395
  }).catch((error) => {
4343
4396
  console.error("Error loading conversation:", error);
@@ -4530,6 +4583,129 @@ ${response.content}`
4530
4583
  };
4531
4584
  };
4532
4585
 
4586
+ const ALLOWED_CONTENT_TYPES = {
4587
+ "image/jpeg": "image",
4588
+ "image/png": "image",
4589
+ "image/gif": "image",
4590
+ "image/webp": "image"
4591
+ };
4592
+ const MAX_FILE_SIZE = 10 * 1024 * 1024;
4593
+ const MAX_FILE_COUNT = 5;
4594
+ let nextFileId = 0;
4595
+ const generateFileId = () => `file-${++nextFileId}`;
4596
+ function useFileAttachment({ presignedUrlEndpoint, headers, getConversationId, onError }) {
4597
+ const [attachedFiles, setAttachedFiles] = useState([]);
4598
+ const removeFile = useCallback((id) => {
4599
+ setAttachedFiles((prev) => {
4600
+ const file = prev.find((f) => f.id === id);
4601
+ if (file) URL.revokeObjectURL(file.preview);
4602
+ return prev.filter((f) => f.id !== id);
4603
+ });
4604
+ }, []);
4605
+ const addFiles = useCallback(
4606
+ (files) => {
4607
+ if (files.length === 0) return;
4608
+ const validFiles = files.filter((file) => {
4609
+ if (!ALLOWED_CONTENT_TYPES[file.type]) {
4610
+ onError?.("Image type is not supported. Please use JPEG, PNG, GIF, or WebP.");
4611
+ return false;
4612
+ }
4613
+ if (file.size > MAX_FILE_SIZE) {
4614
+ onError?.(`Image "${file.name}" exceeds the 10MB size limit.`);
4615
+ return false;
4616
+ }
4617
+ return true;
4618
+ });
4619
+ const remaining = MAX_FILE_COUNT - attachedFiles.length;
4620
+ if (remaining === 0) {
4621
+ onError?.("Maximum 5 images reached.");
4622
+ return;
4623
+ }
4624
+ const filesToAdd = validFiles.slice(0, remaining);
4625
+ if (filesToAdd.length === 0) {
4626
+ return;
4627
+ }
4628
+ if (filesToAdd.length < validFiles.length) {
4629
+ onError?.("Maximum 5 images. Some images were not attached.");
4630
+ }
4631
+ if (!presignedUrlEndpoint) {
4632
+ console.error("[useFileAttachment] presignedUrlEndpoint is not configured — file attachment is unavailable.");
4633
+ onError?.("Something went wrong. Please try again later.");
4634
+ return;
4635
+ }
4636
+ const newFiles = filesToAdd.map((file) => ({
4637
+ id: generateFileId(),
4638
+ file,
4639
+ preview: URL.createObjectURL(file),
4640
+ status: "uploading",
4641
+ attachmentType: ALLOWED_CONTENT_TYPES[file.type]
4642
+ }));
4643
+ setAttachedFiles((prev) => [...prev, ...newFiles]);
4644
+ const conversationId = getConversationId();
4645
+ newFiles.forEach((newFile) => {
4646
+ void (async () => {
4647
+ try {
4648
+ const { uploadUrl, publicUrl } = await requestPresignedUrl({
4649
+ endpoint: presignedUrlEndpoint,
4650
+ conversationId,
4651
+ filename: newFile.file.name,
4652
+ contentType: newFile.file.type,
4653
+ size: newFile.file.size,
4654
+ headers
4655
+ });
4656
+ await uploadFileToS3(uploadUrl, newFile.file);
4657
+ setAttachedFiles((prev) => prev.map((f) => f.id === newFile.id ? { ...f, status: "uploaded", publicUrl } : f));
4658
+ } catch (error) {
4659
+ console.error("Upload failed:", error);
4660
+ onError?.(`Failed to upload "${newFile.file.name}". Please try again.`);
4661
+ setAttachedFiles((prev) => {
4662
+ const file = prev.find((f) => f.id === newFile.id);
4663
+ if (file) URL.revokeObjectURL(file.preview);
4664
+ return prev.filter((f) => f.id !== newFile.id);
4665
+ });
4666
+ }
4667
+ })();
4668
+ });
4669
+ },
4670
+ [attachedFiles, presignedUrlEndpoint, headers, getConversationId, onError]
4671
+ );
4672
+ const clearAttachedFiles = useCallback(() => {
4673
+ attachedFiles.forEach((f) => URL.revokeObjectURL(f.preview));
4674
+ setAttachedFiles([]);
4675
+ }, [attachedFiles]);
4676
+ const getUploadedAttachments = useCallback(() => {
4677
+ return attachedFiles.filter((f) => f.status === "uploaded" && f.publicUrl).map((f) => ({ type: f.attachmentType, url: f.publicUrl, filename: f.file.name }));
4678
+ }, [attachedFiles]);
4679
+ const isUploading = attachedFiles.some((f) => f.status === "uploading");
4680
+ return {
4681
+ attachedFiles,
4682
+ isUploading,
4683
+ addFiles,
4684
+ removeFile,
4685
+ clearAttachedFiles,
4686
+ getUploadedAttachments
4687
+ };
4688
+ }
4689
+
4690
+ function useToast(duration = 3e3) {
4691
+ const [toasts, setToasts] = useState([]);
4692
+ const idRef = useRef(0);
4693
+ const showToast = useCallback(
4694
+ (message) => {
4695
+ const id = ++idRef.current;
4696
+ setToasts((prev) => [...prev, { id, message }]);
4697
+ setTimeout(() => {
4698
+ setToasts((prev) => prev.filter((t) => t.id !== id));
4699
+ }, duration);
4700
+ },
4701
+ [duration]
4702
+ );
4703
+ const dismissToast = useCallback((id) => {
4704
+ setToasts((prev) => prev.filter((t) => t.id !== id));
4705
+ }, []);
4706
+ return { toasts, showToast, dismissToast };
4707
+ }
4708
+
4533
4709
  function Answer({
4534
4710
  index,
4535
4711
  blocks = [],
@@ -4544,6 +4720,7 @@ function Answer({
4544
4720
  disableFeedback = false,
4545
4721
  textConfig = {},
4546
4722
  redirectRules,
4723
+ attachments = [],
4547
4724
  actions,
4548
4725
  handleActionClick,
4549
4726
  nextBestActions,
@@ -4594,7 +4771,14 @@ function Answer({
4594
4771
  "data-name": "SearchResults",
4595
4772
  "data-index": index
4596
4773
  },
4597
- /* @__PURE__ */ React__default.createElement("div", { className: "px-4 pt-4 pb-2" }, /* @__PURE__ */ React__default.createElement("div", { className: "flex items-start justify-between gap-2 min-h-9" }, /* @__PURE__ */ React__default.createElement("div", { className: "flex gap-1" }, /* @__PURE__ */ React__default.createElement(GeneratingStar, { loading: !isIdle }), /* @__PURE__ */ React__default.createElement("h2", { className: "leading-normal font-semibold m-0 text-foreground self-center text-lg" }, question)), isCompleted && !showError && /* @__PURE__ */ React__default.createElement(TooltipProvider, null, /* @__PURE__ */ React__default.createElement(Tooltip, null, /* @__PURE__ */ React__default.createElement(TooltipTrigger, { asChild: true }, /* @__PURE__ */ React__default.createElement(Button, { variant: "ghost", size: "icon", onClick: () => void handleCopy(), className: "-mt-1 flex-shrink-0" }, isCopied ? /* @__PURE__ */ React__default.createElement(Check, { className: "text-feedback-positive", weight: "bold" }) : /* @__PURE__ */ React__default.createElement(Copy, { className: "text-secondary-foreground", weight: "bold" }))), /* @__PURE__ */ React__default.createElement(TooltipContent, null, /* @__PURE__ */ React__default.createElement("p", null, isCopied ? "Copied!" : "Copy")))))),
4774
+ /* @__PURE__ */ React__default.createElement("div", { className: "px-4 pt-4 pb-2" }, /* @__PURE__ */ React__default.createElement("div", { className: "flex items-start justify-between gap-2 min-h-9" }, /* @__PURE__ */ React__default.createElement("div", { className: "flex gap-1" }, /* @__PURE__ */ React__default.createElement(GeneratingStar, { loading: !isIdle }), /* @__PURE__ */ React__default.createElement("h2", { className: "leading-normal font-semibold m-0 text-foreground self-center text-lg" }, question)), isCompleted && !showError && /* @__PURE__ */ React__default.createElement(TooltipProvider, null, /* @__PURE__ */ React__default.createElement(Tooltip, null, /* @__PURE__ */ React__default.createElement(TooltipTrigger, { asChild: true }, /* @__PURE__ */ React__default.createElement(Button, { variant: "ghost", size: "icon", onClick: () => void handleCopy(), className: "-mt-1 flex-shrink-0" }, isCopied ? /* @__PURE__ */ React__default.createElement(Check, { className: "text-feedback-positive", weight: "bold" }) : /* @__PURE__ */ React__default.createElement(Copy, { className: "text-secondary-foreground", weight: "bold" }))), /* @__PURE__ */ React__default.createElement(TooltipContent, null, /* @__PURE__ */ React__default.createElement("p", null, isCopied ? "Copied!" : "Copy"))))), /* @__PURE__ */ React__default.createElement(
4775
+ AttachmentThumbnails,
4776
+ {
4777
+ items: attachments.map((a, i) => ({ id: `${i}`, src: a.url, url: a.url, alt: a.filename })),
4778
+ size: "xs",
4779
+ className: "mt-2"
4780
+ }
4781
+ )),
4598
4782
  isFetchingInitialAnswer && /* @__PURE__ */ React__default.createElement("div", { className: "px-4 pt-0 pb-2" }, /* @__PURE__ */ React__default.createElement("p", { className: "text-sm text-muted-foreground" }, isFetchingSearchResults ? textConfig.loadingSearchText : textConfig.loadingAnswerText)),
4599
4783
  /* @__PURE__ */ React__default.createElement("div", { className: "flex flex-col" }, blocks?.map((block, i) => /* @__PURE__ */ React__default.createElement(
4600
4784
  "div",
@@ -4826,10 +5010,11 @@ const PrimarySearch = React__default.forwardRef(
4826
5010
  onRegionChange,
4827
5011
  apiKey,
4828
5012
  fetchRegionConfig,
4829
- disableImageAttachment = false,
4830
- attachedImages = [],
4831
- onImageUpload,
4832
- onRemoveImage,
5013
+ enableFileAttachment = false,
5014
+ attachedFiles = [],
5015
+ isUploading = false,
5016
+ onAddFiles,
5017
+ onRemoveFile,
4833
5018
  isSearching = false,
4834
5019
  autocompleteSuggestions = [],
4835
5020
  onAutocompleteSuggestionSelect,
@@ -4841,6 +5026,31 @@ const PrimarySearch = React__default.forwardRef(
4841
5026
  }, ref) => {
4842
5027
  const fileInputRef = useRef(null);
4843
5028
  const [showSuggestions, setShowSuggestions] = useState(false);
5029
+ const [isDragOver, setIsDragOver] = useState(false);
5030
+ const handlePaste = (e) => {
5031
+ if (!enableFileAttachment || !onAddFiles) return;
5032
+ const files = Array.from(e.clipboardData.files);
5033
+ if (files.length > 0) {
5034
+ e.preventDefault();
5035
+ onAddFiles(files);
5036
+ }
5037
+ };
5038
+ const handleDrop = (e) => {
5039
+ e.preventDefault();
5040
+ setIsDragOver(false);
5041
+ if (!enableFileAttachment || !onAddFiles) return;
5042
+ const files = Array.from(e.dataTransfer.files);
5043
+ if (files.length > 0) {
5044
+ onAddFiles(files);
5045
+ }
5046
+ };
5047
+ const handleDragOver = (e) => {
5048
+ e.preventDefault();
5049
+ if (enableFileAttachment) setIsDragOver(true);
5050
+ };
5051
+ const handleDragLeave = () => {
5052
+ setIsDragOver(false);
5053
+ };
4844
5054
  const showIncludePageToggle = useBooleanFlagValue("showIncludePageToggle", false);
4845
5055
  const regionItems = [
4846
5056
  {
@@ -4906,7 +5116,7 @@ const PrimarySearch = React__default.forwardRef(
4906
5116
  textarea.style.height = `${textarea.scrollHeight}px`;
4907
5117
  };
4908
5118
  const handleKeyPress = (e) => {
4909
- if (e.key === "Enter" && !e.shiftKey) {
5119
+ if (e.key === "Enter" && !e.shiftKey && !isUploading) {
4910
5120
  e.preventDefault();
4911
5121
  onSearch();
4912
5122
  }
@@ -4976,10 +5186,32 @@ const PrimarySearch = React__default.forwardRef(
4976
5186
  "div",
4977
5187
  {
4978
5188
  className: cn(
4979
- "w-full overflow-hidden bg-background border border-border transition-all",
4980
- shouldShowSuggestions ? "rounded-t-md" : "rounded-md"
4981
- )
5189
+ "relative w-full overflow-hidden bg-background border border-border transition-all",
5190
+ shouldShowSuggestions ? "rounded-t-md" : "rounded-md",
5191
+ isDragOver && enableFileAttachment && "ring-2 ring-primary"
5192
+ ),
5193
+ onDrop: handleDrop,
5194
+ onDragOver: handleDragOver,
5195
+ onDragLeave: handleDragLeave,
5196
+ onPaste: handlePaste
4982
5197
  },
5198
+ isDragOver && enableFileAttachment && /* @__PURE__ */ React__default.createElement(
5199
+ "div",
5200
+ {
5201
+ className: "absolute inset-0 z-10 flex items-center justify-center rounded-md",
5202
+ style: { backgroundColor: "color-mix(in srgb, var(--bfc-card) 90%, transparent)" }
5203
+ },
5204
+ /* @__PURE__ */ React__default.createElement("p", { className: "text-sm font-medium text-muted-foreground" }, "Drop images here to attach")
5205
+ ),
5206
+ enableFileAttachment && /* @__PURE__ */ React__default.createElement(
5207
+ AttachmentThumbnails,
5208
+ {
5209
+ items: attachedFiles.map((f) => ({ id: f.id, src: f.preview, url: f.publicUrl, status: f.status })),
5210
+ size: "md",
5211
+ onRemove: onRemoveFile,
5212
+ className: "pt-3 px-3 bg-card"
5213
+ }
5214
+ ),
4983
5215
  /* @__PURE__ */ React__default.createElement("div", { className: "p-3 flex items-center bg-card", "data-name": "search-input" }, /* @__PURE__ */ React__default.createElement(MagnifyingGlass, { className: "h-5 w-5 mr-2 text-muted-foreground", "aria-hidden": true, role: "presentation" }), /* @__PURE__ */ React__default.createElement(
4984
5216
  "textarea",
4985
5217
  {
@@ -5000,19 +5232,33 @@ const PrimarySearch = React__default.forwardRef(
5000
5232
  rows: 1
5001
5233
  }
5002
5234
  ), isSearching && /* @__PURE__ */ React__default.createElement("div", { className: "flex items-center justify-center ml-2" }, /* @__PURE__ */ React__default.createElement("div", { className: "animate-spin rounded-full size-4 border-2 border-t-transparent border-primary" }))),
5003
- !disableImageAttachment && attachedImages.length > 0 && /* @__PURE__ */ React__default.createElement("div", { className: "flex gap-2 mt-3 overflow-x-auto pb-1 px-3" }, attachedImages.map((image, index) => /* @__PURE__ */ React__default.createElement("div", { key: index, className: "relative group rounded-lg overflow-hidden flex-shrink-0 size-20" }, /* @__PURE__ */ React__default.createElement("img", { src: image.preview, alt: `Attached ${index + 1}`, className: "w-full h-full object-cover" }), /* @__PURE__ */ React__default.createElement(
5004
- "button",
5235
+ !shouldShowSuggestions && /* @__PURE__ */ React__default.createElement("div", { className: "flex items-center justify-between px-3 py-2 border-t border-border" }, /* @__PURE__ */ React__default.createElement("div", { className: "flex items-center gap-2" }, enableFileAttachment && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
5236
+ "input",
5005
5237
  {
5006
- onClick: () => onRemoveImage?.(index),
5007
- className: cn(
5008
- "absolute top-1 right-1 rounded-full p-1 opacity-0",
5009
- "group-hover:opacity-100 transition-opacity duration-200",
5010
- "hover:bg-black/70 bg-black/50"
5011
- )
5238
+ type: "file",
5239
+ ref: fileInputRef,
5240
+ accept: "image/jpeg,image/png,image/gif,image/webp",
5241
+ multiple: true,
5242
+ className: "hidden",
5243
+ onChange: (e) => {
5244
+ if (e.target.files) {
5245
+ onAddFiles?.(Array.from(e.target.files));
5246
+ }
5247
+ e.target.value = "";
5248
+ }
5249
+ }
5250
+ ), /* @__PURE__ */ React__default.createElement(
5251
+ Button,
5252
+ {
5253
+ variant: "ghost",
5254
+ size: "icon",
5255
+ className: "rounded-md size-8 hover:bg-opacity-80 disabled:opacity-50",
5256
+ onClick: () => fileInputRef.current?.click(),
5257
+ disabled: attachedFiles.length >= 5,
5258
+ "aria-label": textConfig.attachImageText
5012
5259
  },
5013
- /* @__PURE__ */ React__default.createElement(X, { className: "size-3 text-white", "aria-label": "Remove image" })
5014
- )))),
5015
- !shouldShowSuggestions && /* @__PURE__ */ React__default.createElement("div", { className: "flex items-center justify-between px-3 py-2 border-t border-border" }, /* @__PURE__ */ React__default.createElement("div", { className: "flex gap-2" }, /* @__PURE__ */ React__default.createElement("div", { className: "flex gap-1", "data-name": "collections-dropdown" }, allowedRegions.length > 0 && collections.length > 0 ? (
5260
+ /* @__PURE__ */ React__default.createElement(Plus, { className: "size-4 text-secondary-foreground" })
5261
+ )), /* @__PURE__ */ React__default.createElement("div", { className: "flex gap-1", "data-name": "collections-dropdown" }, allowedRegions.length > 0 && collections.length > 0 ? (
5016
5262
  // Two-level selection: Region -> Collection
5017
5263
  /* @__PURE__ */ React__default.createElement(
5018
5264
  TwoLevelCombobox,
@@ -5053,33 +5299,12 @@ const PrimarySearch = React__default.forwardRef(
5053
5299
  disabled: includePageDisabled,
5054
5300
  onToggle: onIncludePageToggle
5055
5301
  }
5056
- ), !disableImageAttachment && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
5057
- "input",
5058
- {
5059
- type: "file",
5060
- ref: fileInputRef,
5061
- accept: "image/*",
5062
- multiple: true,
5063
- className: "hidden",
5064
- onChange: onImageUpload
5065
- }
5066
- ), /* @__PURE__ */ React__default.createElement(
5302
+ )), /* @__PURE__ */ React__default.createElement("div", { className: "flex items-center", "data-name": "search-button" }, /* @__PURE__ */ React__default.createElement(
5067
5303
  Button,
5068
5304
  {
5069
- variant: "ghost",
5070
5305
  size: "sm",
5071
- className: "rounded-md h-8 hover:bg-opacity-80",
5072
- onClick: () => fileInputRef.current?.click(),
5073
- "aria-label": textConfig.attachImageText
5074
- },
5075
- /* @__PURE__ */ React__default.createElement(Image, { className: "size-4 text-secondary-foreground" }),
5076
- /* @__PURE__ */ React__default.createElement("span", { className: "hidden @sm:block" }, textConfig.attachImageText)
5077
- ))), /* @__PURE__ */ React__default.createElement("div", { className: "flex items-center", "data-name": "search-button" }, /* @__PURE__ */ React__default.createElement(
5078
- Button,
5079
- {
5080
- size: "sm",
5081
- disabled: !query || isSearching,
5082
- "aria-disabled": !query || isSearching,
5306
+ disabled: !query || isSearching || isUploading,
5307
+ "aria-disabled": !query || isSearching || isUploading,
5083
5308
  className: "rounded-md size-8 disabled:opacity-50 bg-primary",
5084
5309
  onClick: onSearch
5085
5310
  },
@@ -5180,9 +5405,22 @@ const styles = {
5180
5405
  };
5181
5406
 
5182
5407
  const FollowUpSearchBar = React__default.forwardRef(
5183
- ({ initialQuery = "", onQueryChange, isSearching, handleFollowUpSearch, textConfig }, ref) => {
5408
+ ({
5409
+ initialQuery = "",
5410
+ onQueryChange,
5411
+ isSearching,
5412
+ handleFollowUpSearch,
5413
+ textConfig,
5414
+ enableFileAttachment = false,
5415
+ attachedFiles = [],
5416
+ isUploading = false,
5417
+ onAddFiles,
5418
+ onRemoveFile
5419
+ }, ref) => {
5184
5420
  const [localQuery, setLocalQuery] = useState(initialQuery);
5421
+ const [isDragOver, setIsDragOver] = useState(false);
5185
5422
  const followUpInputRef = useRef(null);
5423
+ const fileInputRef = useRef(null);
5186
5424
  const setCombinedRef = (instance) => {
5187
5425
  followUpInputRef.current = instance;
5188
5426
  if (typeof ref === "function") {
@@ -5200,8 +5438,9 @@ const FollowUpSearchBar = React__default.forwardRef(
5200
5438
  useEffect(() => {
5201
5439
  setLocalQuery(initialQuery);
5202
5440
  }, [initialQuery]);
5441
+ const isSendDisabled = isSearching || !localQuery.trim() || isUploading;
5203
5442
  const handleKeyPress = (e) => {
5204
- if (e.key === "Enter" && !e.shiftKey && !isSearching) {
5443
+ if (e.key === "Enter" && !e.shiftKey && !isSendDisabled) {
5205
5444
  e.preventDefault();
5206
5445
  const currentQuery = localQuery;
5207
5446
  onQueryChange(currentQuery);
@@ -5223,6 +5462,30 @@ const FollowUpSearchBar = React__default.forwardRef(
5223
5462
  handleFollowUpSearch(currentQuery);
5224
5463
  setLocalQuery("");
5225
5464
  };
5465
+ const handlePaste = (e) => {
5466
+ if (!enableFileAttachment || !onAddFiles) return;
5467
+ const files = Array.from(e.clipboardData.files);
5468
+ if (files.length > 0) {
5469
+ e.preventDefault();
5470
+ onAddFiles(files);
5471
+ }
5472
+ };
5473
+ const handleDrop = (e) => {
5474
+ e.preventDefault();
5475
+ setIsDragOver(false);
5476
+ if (!enableFileAttachment || !onAddFiles) return;
5477
+ const files = Array.from(e.dataTransfer.files);
5478
+ if (files.length > 0) {
5479
+ onAddFiles(files);
5480
+ }
5481
+ };
5482
+ const handleDragOver = (e) => {
5483
+ e.preventDefault();
5484
+ if (enableFileAttachment) setIsDragOver(true);
5485
+ };
5486
+ const handleDragLeave = () => {
5487
+ setIsDragOver(false);
5488
+ };
5226
5489
  return /* @__PURE__ */ React__default.createElement(
5227
5490
  motion.footer,
5228
5491
  {
@@ -5231,32 +5494,88 @@ const FollowUpSearchBar = React__default.forwardRef(
5231
5494
  transition: { duration: 0.5 },
5232
5495
  className: styles.followUpSearchBar
5233
5496
  },
5234
- /* @__PURE__ */ React__default.createElement("div", { className: "container flex items-center justify-center p-3" }, /* @__PURE__ */ React__default.createElement("div", { className: "relative flex w-full items-center gap-2 rounded bg-card px-2 border border-dark-400" }, /* @__PURE__ */ React__default.createElement("div", { className: "size-6 flex flex-shrink-0 justify-center items-center" }, /* @__PURE__ */ React__default.createElement(MagnifyingGlass, { className: "size-5 text-secondary-foreground" })), /* @__PURE__ */ React__default.createElement(
5235
- Textarea,
5236
- {
5237
- ref: setCombinedRef,
5238
- value: localQuery,
5239
- onChange: handleChange,
5240
- onBlur: handleBlur,
5241
- onKeyDown: handleKeyPress,
5242
- placeholder: textConfig.followUpPlaceholder,
5243
- className: "min-h-[44px] w-full resize-none border-0 shadow-none bg-transparent px-0 py-2.5 focus:outline-none focus:ring-0 focus-visible:ring-0",
5244
- rows: 1
5245
- }
5246
- ), /* @__PURE__ */ React__default.createElement(
5247
- Button,
5497
+ /* @__PURE__ */ React__default.createElement("div", { className: "container flex items-center justify-center p-3" }, /* @__PURE__ */ React__default.createElement(
5498
+ "div",
5248
5499
  {
5249
- type: "button",
5250
- size: "icon",
5251
- disabled: isSearching || !localQuery.trim(),
5252
- onClick: handleSearchClick,
5253
5500
  className: cn(
5254
- "size-8 shrink-0 rounded",
5255
- localQuery ? "bg-primary text-primary-foreground" : "bg-dark-400 text-white"
5256
- )
5501
+ "relative flex w-full flex-col rounded bg-card border border-dark-400",
5502
+ isDragOver && enableFileAttachment && "ring-2 ring-primary"
5503
+ ),
5504
+ onDrop: handleDrop,
5505
+ onDragOver: handleDragOver,
5506
+ onDragLeave: handleDragLeave,
5507
+ onPaste: handlePaste
5257
5508
  },
5258
- isSearching ? /* @__PURE__ */ React__default.createElement("div", { className: "animate-spin rounded-full size-4 sm:size-5 border-2 border-dark/40 !border-t-foreground" }) : /* @__PURE__ */ React__default.createElement(ArrowRight, { className: "size-6" })
5259
- )))
5509
+ isDragOver && enableFileAttachment && /* @__PURE__ */ React__default.createElement(
5510
+ "div",
5511
+ {
5512
+ className: "absolute inset-0 z-10 flex items-center justify-center rounded",
5513
+ style: { backgroundColor: "color-mix(in srgb, var(--bfc-card) 90%, transparent)" }
5514
+ },
5515
+ /* @__PURE__ */ React__default.createElement("p", { className: "text-sm font-medium text-muted-foreground" }, "Drop images here to attach")
5516
+ ),
5517
+ enableFileAttachment && /* @__PURE__ */ React__default.createElement(
5518
+ AttachmentThumbnails,
5519
+ {
5520
+ items: attachedFiles.map((f) => ({ id: f.id, src: f.preview, url: f.publicUrl, status: f.status })),
5521
+ size: "sm",
5522
+ onRemove: onRemoveFile,
5523
+ className: "pt-2 px-2"
5524
+ }
5525
+ ),
5526
+ /* @__PURE__ */ React__default.createElement("div", { className: "flex items-center gap-2 px-2" }, enableFileAttachment && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
5527
+ "input",
5528
+ {
5529
+ type: "file",
5530
+ ref: fileInputRef,
5531
+ accept: "image/jpeg,image/png,image/gif,image/webp",
5532
+ multiple: true,
5533
+ className: "hidden",
5534
+ onChange: (e) => {
5535
+ if (e.target.files) {
5536
+ onAddFiles?.(Array.from(e.target.files));
5537
+ }
5538
+ e.target.value = "";
5539
+ }
5540
+ }
5541
+ ), /* @__PURE__ */ React__default.createElement(
5542
+ Button,
5543
+ {
5544
+ variant: "ghost",
5545
+ size: "icon",
5546
+ className: "rounded-md size-7 hover:bg-opacity-80 disabled:opacity-50 shrink-0",
5547
+ onClick: () => fileInputRef.current?.click(),
5548
+ disabled: attachedFiles.length >= 5,
5549
+ "aria-label": textConfig.attachImageText
5550
+ },
5551
+ /* @__PURE__ */ React__default.createElement(Plus, { className: "size-4 text-secondary-foreground" })
5552
+ )), !enableFileAttachment && /* @__PURE__ */ React__default.createElement("div", { className: "size-6 flex flex-shrink-0 justify-center items-center" }, /* @__PURE__ */ React__default.createElement(MagnifyingGlass, { className: "size-5 text-secondary-foreground" })), /* @__PURE__ */ React__default.createElement(
5553
+ Textarea,
5554
+ {
5555
+ ref: setCombinedRef,
5556
+ value: localQuery,
5557
+ onChange: handleChange,
5558
+ onBlur: handleBlur,
5559
+ onKeyDown: handleKeyPress,
5560
+ placeholder: textConfig.followUpPlaceholder,
5561
+ className: "min-h-[44px] w-full resize-none border-0 shadow-none bg-transparent px-0 py-2.5 focus:outline-none focus:ring-0 focus-visible:ring-0",
5562
+ rows: 1
5563
+ }
5564
+ ), /* @__PURE__ */ React__default.createElement(
5565
+ Button,
5566
+ {
5567
+ type: "button",
5568
+ size: "icon",
5569
+ disabled: isSendDisabled,
5570
+ onClick: handleSearchClick,
5571
+ className: cn(
5572
+ "size-8 shrink-0 rounded",
5573
+ localQuery ? "bg-primary text-primary-foreground" : "bg-dark-400 text-white"
5574
+ )
5575
+ },
5576
+ isSearching ? /* @__PURE__ */ React__default.createElement("div", { className: "animate-spin rounded-full size-4 sm:size-5 border-2 border-dark/40 !border-t-foreground" }) : /* @__PURE__ */ React__default.createElement(ArrowRight, { className: "size-6" })
5577
+ ))
5578
+ ))
5260
5579
  );
5261
5580
  }
5262
5581
  );
@@ -5377,6 +5696,30 @@ const buildConversationContext = (answers, conversationId) => ({
5377
5696
  }))
5378
5697
  });
5379
5698
 
5699
+ function ToastContainer({ toasts, onDismiss }) {
5700
+ return /* @__PURE__ */ React__default.createElement("div", { className: "fixed top-4 left-4 right-4 z-50 flex flex-col gap-2 pointer-events-none" }, /* @__PURE__ */ React__default.createElement(AnimatePresence, null, toasts.map((toast) => /* @__PURE__ */ React__default.createElement(
5701
+ motion.div,
5702
+ {
5703
+ key: toast.id,
5704
+ initial: { opacity: 0, y: -8 },
5705
+ animate: { opacity: 1, y: 0 },
5706
+ exit: { opacity: 0, y: -8 },
5707
+ transition: { duration: 0.2 },
5708
+ className: "pointer-events-auto flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-3 text-sm text-foreground shadow-lg"
5709
+ },
5710
+ /* @__PURE__ */ React__default.createElement("span", { className: "flex-1" }, toast.message),
5711
+ /* @__PURE__ */ React__default.createElement(
5712
+ "button",
5713
+ {
5714
+ onClick: () => onDismiss(toast.id),
5715
+ className: "shrink-0 rounded-full p-0.5 hover:bg-muted transition-colors",
5716
+ "aria-label": "Dismiss"
5717
+ },
5718
+ /* @__PURE__ */ React__default.createElement(X$1, { className: "size-3.5" })
5719
+ )
5720
+ ))));
5721
+ }
5722
+
5380
5723
  const clientExecutionEventType = "CLIENT_EXECUTION";
5381
5724
  const clientExecutionResultEventType = "CLIENT_EXECUTION_RESULT";
5382
5725
  const executeClientAction = (key, inputs) => {
@@ -5460,12 +5803,13 @@ const ChatSearchComponent = forwardRef(
5460
5803
  fetchRegionConfig,
5461
5804
  searchEndpoint,
5462
5805
  answerStreamEndpoint,
5806
+ presignedUrlEndpoint,
5463
5807
  feedbackEndpoint,
5464
5808
  feedbackReasonEndpoint,
5465
5809
  loadConversationEndpoint,
5466
5810
  autocompleteEndpoint,
5467
5811
  disableFollowUpQuestions = false,
5468
- disableImageAttachment = false,
5812
+ enableFileAttachment: enableFileAttachmentProp = false,
5469
5813
  disableFeedback = false,
5470
5814
  disclaimer,
5471
5815
  offset = 0,
@@ -5509,14 +5853,29 @@ const ChatSearchComponent = forwardRef(
5509
5853
  setShowMobileCloseWidgetButton
5510
5854
  } = useChatSearch();
5511
5855
  const mergedTextConfig = { ...defaultTextConfig, ...textConfig };
5512
- const [attachedImages, setAttachedImages] = useState([]);
5856
+ const enableFileAttachmentFlag = useBooleanFlagValue("enableFileAttachment", false);
5857
+ const enableFileAttachment = enableFileAttachmentProp || enableFileAttachmentFlag;
5858
+ const { toasts, showToast, dismissToast } = useToast();
5859
+ const getOrCreateConversationId = useCallback(() => {
5860
+ let conversationId = currentConversationId;
5861
+ if (!conversationId) {
5862
+ conversationId = createConversationId();
5863
+ setCurrentConversationId(conversationId);
5864
+ }
5865
+ return conversationId;
5866
+ }, [currentConversationId, setCurrentConversationId]);
5867
+ const { attachedFiles, isUploading, addFiles, removeFile, clearAttachedFiles, getUploadedAttachments } = useFileAttachment({
5868
+ presignedUrlEndpoint,
5869
+ headers,
5870
+ getConversationId: getOrCreateConversationId,
5871
+ onError: showToast
5872
+ });
5513
5873
  const [currentCollectionId, setCurrentCollectionId] = useState(selectedCollectionId);
5514
5874
  const [currentRegion, setCurrentRegion] = useState(selectedRegion);
5515
5875
  const [showFollowUp, setShowFollowUp] = useState(true);
5516
5876
  const primaryTextareaRef = useRef(null);
5517
5877
  const answerRefs = useRef([]);
5518
5878
  const containerRef = useRef(null);
5519
- const fileInputRef = useRef(null);
5520
5879
  const primarySearchRef = useRef(null);
5521
5880
  const followUpSearchRef = useRef(null);
5522
5881
  const bottomRef = useRef(null);
@@ -5664,7 +6023,8 @@ const ChatSearchComponent = forwardRef(
5664
6023
  const generateAnswerForQuery = async ({
5665
6024
  searchQueryId,
5666
6025
  conversationId,
5667
- context
6026
+ context,
6027
+ attachments
5668
6028
  }) => {
5669
6029
  try {
5670
6030
  const followUpQuestions = loadFollowUpQuestions(searchQueryId);
@@ -5676,7 +6036,8 @@ const ChatSearchComponent = forwardRef(
5676
6036
  conversationId,
5677
6037
  searchQueryId,
5678
6038
  profileId: userData?.userId,
5679
- ...context && { context }
6039
+ ...context && { context },
6040
+ ...attachments?.length && { attachments }
5680
6041
  }
5681
6042
  });
5682
6043
  const reader = response.body?.getReader();
@@ -5825,13 +6186,16 @@ const ChatSearchComponent = forwardRef(
5825
6186
  if (!searchQuery) return;
5826
6187
  const conversationId = currentConversationId || createConversationId();
5827
6188
  setCurrentConversationId(conversationId);
6189
+ const fileAttachments = getUploadedAttachments();
6190
+ clearAttachedFiles();
5828
6191
  setIsSearching(true);
5829
6192
  setShowResults(true);
5830
6193
  setActiveAnswerIndex(answers.length);
5831
6194
  scrollToLastAnswer();
5832
6195
  answerListDispatch(
5833
6196
  appendNewAnswer({
5834
- query: searchQuery
6197
+ query: searchQuery,
6198
+ attachments: fileAttachments
5835
6199
  })
5836
6200
  );
5837
6201
  await Promise.resolve();
@@ -5856,7 +6220,8 @@ const ChatSearchComponent = forwardRef(
5856
6220
  await generateAnswerForQuery({
5857
6221
  searchQueryId,
5858
6222
  conversationId,
5859
- context: pageContext
6223
+ context: pageContext,
6224
+ attachments: fileAttachments.length > 0 ? fileAttachments : void 0
5860
6225
  });
5861
6226
  } else {
5862
6227
  answerListDispatch(noArticlesFound());
@@ -5889,7 +6254,7 @@ const ChatSearchComponent = forwardRef(
5889
6254
  setShowResults(false);
5890
6255
  answerListDispatch(clearAll());
5891
6256
  setActiveAnswerIndex(0);
5892
- setAttachedImages([]);
6257
+ clearAttachedFiles();
5893
6258
  clearCurrentConversationId();
5894
6259
  trackEvent?.("New Thread Created", { oldConversationId: currentConversationId });
5895
6260
  if (primaryTextareaRef.current) {
@@ -5909,7 +6274,8 @@ const ChatSearchComponent = forwardRef(
5909
6274
  focusSearchField: () => primarySearchRef.current?.focus() || followUpSearchRef.current?.focus(),
5910
6275
  showCloseButton: (showButton = true) => {
5911
6276
  setShowMobileCloseWidgetButton(showButton);
5912
- }
6277
+ },
6278
+ loadConversation: loadConversationById
5913
6279
  }));
5914
6280
  useEffect(() => {
5915
6281
  setCurrentCollectionId(selectedCollectionId);
@@ -5988,30 +6354,6 @@ const ChatSearchComponent = forwardRef(
5988
6354
  const handleAutocompleteSuggestionClick = (suggestion) => {
5989
6355
  void performSearch({ searchQuery: suggestion.question, event: { name: "Autocomplete Suggestion Clicked" } });
5990
6356
  };
5991
- useEffect(() => {
5992
- return () => {
5993
- attachedImages.forEach((image) => URL.revokeObjectURL(image.preview));
5994
- };
5995
- }, [attachedImages]);
5996
- const handleImageUpload = (event) => {
5997
- const files = event.target.files;
5998
- if (files) {
5999
- const newImages = Array.from(files).map((file) => ({
6000
- file,
6001
- preview: URL.createObjectURL(file)
6002
- }));
6003
- setAttachedImages((prev) => [...prev, ...newImages]);
6004
- }
6005
- if (fileInputRef.current) {
6006
- fileInputRef.current.value = "";
6007
- }
6008
- };
6009
- const removeImage = (index) => {
6010
- setAttachedImages((prev) => {
6011
- URL.revokeObjectURL(prev[index].preview);
6012
- return prev.filter((_, i) => i !== index);
6013
- });
6014
- };
6015
6357
  const handleCollectionChange = (collectionId) => {
6016
6358
  setCurrentCollectionId(collectionId);
6017
6359
  onCollectionChange?.(collectionId);
@@ -6031,7 +6373,7 @@ const ChatSearchComponent = forwardRef(
6031
6373
  setShowResults(false);
6032
6374
  answerListDispatch(clearAll());
6033
6375
  setActiveAnswerIndex(0);
6034
- setAttachedImages([]);
6376
+ clearAttachedFiles();
6035
6377
  if (primaryTextareaRef.current) {
6036
6378
  primaryTextareaRef.current.style.height = "auto";
6037
6379
  }
@@ -6118,6 +6460,7 @@ const ChatSearchComponent = forwardRef(
6118
6460
  "data-name": "ChatSearch",
6119
6461
  style
6120
6462
  },
6463
+ /* @__PURE__ */ React__default.createElement(ToastContainer, { toasts, onDismiss: dismissToast }),
6121
6464
  (isWidgetMode || !showResults) && /* @__PURE__ */ React__default.createElement(
6122
6465
  Header,
6123
6466
  {
@@ -6185,10 +6528,11 @@ const ChatSearchComponent = forwardRef(
6185
6528
  onRegionChange: handleRegionChange,
6186
6529
  apiKey,
6187
6530
  fetchRegionConfig,
6188
- disableImageAttachment,
6189
- attachedImages,
6190
- onImageUpload: handleImageUpload,
6191
- onRemoveImage: removeImage,
6531
+ enableFileAttachment,
6532
+ attachedFiles,
6533
+ isUploading,
6534
+ onAddFiles: addFiles,
6535
+ onRemoveFile: removeFile,
6192
6536
  isSearching,
6193
6537
  autocompleteSuggestions,
6194
6538
  onAutocompleteSuggestionSelect: handleAutocompleteSuggestionClick,
@@ -6247,6 +6591,7 @@ const ChatSearchComponent = forwardRef(
6247
6591
  index: i,
6248
6592
  blocks: answer.blocks,
6249
6593
  question: answer.question,
6594
+ attachments: answer.attachments,
6250
6595
  state: answer.state,
6251
6596
  searchResults: answer.searchResults,
6252
6597
  searchQueryId: answer.searchQueryId,
@@ -6317,15 +6662,28 @@ const ChatSearchComponent = forwardRef(
6317
6662
  onQueryChange: setFollowUpQuery,
6318
6663
  isSearching,
6319
6664
  handleFollowUpSearch,
6320
- textConfig: mergedTextConfig
6665
+ textConfig: mergedTextConfig,
6666
+ enableFileAttachment,
6667
+ attachedFiles,
6668
+ isUploading,
6669
+ onAddFiles: addFiles,
6670
+ onRemoveFile: removeFile
6321
6671
  }
6322
6672
  )
6323
6673
  );
6324
6674
  }
6325
6675
  );
6326
6676
  ChatSearchComponent.displayName = "ChatSearch";
6327
- const ChatSearch = forwardRef(({ featureFlags, ...props }, ref) => /* @__PURE__ */ React__default.createElement(FeatureFlagProvider, { flags: featureFlags }, /* @__PURE__ */ React__default.createElement(ChatSearchProvider, { searchPath: props.searchPath, contentTypeEndpoint: props.contentTypeEndpoint }, /* @__PURE__ */ React__default.createElement(ChatSearchComponent, { ...props, ref }))));
6677
+ const ChatSearch = forwardRef(({ featureFlags, ...props }, ref) => /* @__PURE__ */ React__default.createElement(FeatureFlagProvider, { flags: featureFlags }, /* @__PURE__ */ React__default.createElement(
6678
+ ChatSearchProvider,
6679
+ {
6680
+ searchPath: props.searchPath,
6681
+ contentTypeEndpoint: props.contentTypeEndpoint,
6682
+ widgetKey: props.apiKey
6683
+ },
6684
+ /* @__PURE__ */ React__default.createElement(ChatSearchComponent, { ...props, ref })
6685
+ )));
6328
6686
  ChatSearch.displayName = "ChatSearch";
6329
6687
 
6330
6688
  export { ChatSearch as C, ChatSearchProvider as a, useIsChatSearchDirty as b, useChatSearch as u };
6331
- //# sourceMappingURL=ChatSearch.CgxpBVrd.js.map
6689
+ //# sourceMappingURL=ChatSearch.C6RERao6.js.map