@sampleapp.ai/sdk 1.0.27 → 1.0.29

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
@@ -1,15 +1,15 @@
1
- import * as L from "react";
2
- import { useState as f, useEffect as M, forwardRef as oe, useRef as U, useMemo as ne } from "react";
3
- import * as ee from "react-dom/client";
4
- import { jsxs as c, jsx as e, Fragment as z } from "react/jsx-runtime";
5
- const ie = ({ settings: t, onClick: i }) => {
6
- const [r, l] = f(!1), s = () => {
7
- const d = new CustomEvent("chatButtonClick", {
8
- detail: { settings: t }
1
+ import * as M from "react";
2
+ import { useState as u, useEffect as E, forwardRef as oe, useRef as V, useMemo as ne } from "react";
3
+ import * as Z from "react-dom/client";
4
+ import { jsxs as g, jsx as o, Fragment as q } from "react/jsx-runtime";
5
+ const ie = ({ settings: e, onClick: i }) => {
6
+ const [n, d] = u(!1), s = () => {
7
+ const l = new CustomEvent("chatButtonClick", {
8
+ detail: { settings: e }
9
9
  });
10
- document.dispatchEvent(d), i?.();
10
+ document.dispatchEvent(l), i?.();
11
11
  };
12
- return /* @__PURE__ */ c(
12
+ return /* @__PURE__ */ g(
13
13
  "button",
14
14
  {
15
15
  style: {
@@ -19,7 +19,7 @@ const ie = ({ settings: t, onClick: i }) => {
19
19
  right: "20px",
20
20
  zIndex: 1e3,
21
21
  // Colors
22
- backgroundColor: t.baseSettings.primaryBrandColor,
22
+ backgroundColor: e.baseSettings.primaryBrandColor,
23
23
  color: "white",
24
24
  // Typography
25
25
  fontSize: "14px",
@@ -31,11 +31,11 @@ const ie = ({ settings: t, onClick: i }) => {
31
31
  border: "none",
32
32
  borderRadius: "50px",
33
33
  // Visual Effects
34
- boxShadow: r ? "0 6px 20px rgba(0,0,0,0.2)" : "0 4px 12px rgba(0,0,0,0.15)",
34
+ boxShadow: n ? "0 6px 20px rgba(0,0,0,0.2)" : "0 4px 12px rgba(0,0,0,0.15)",
35
35
  cursor: "pointer",
36
36
  // Animations
37
37
  transition: "all 0.2s ease-in-out",
38
- transform: r ? "scale(1.05)" : "scale(1)",
38
+ transform: n ? "scale(1.05)" : "scale(1)",
39
39
  // Layout for icon + text
40
40
  display: "flex",
41
41
  alignItems: "center",
@@ -44,16 +44,16 @@ const ie = ({ settings: t, onClick: i }) => {
44
44
  outline: "none",
45
45
  userSelect: "none"
46
46
  },
47
- onMouseEnter: () => l(!0),
48
- onMouseLeave: () => l(!1),
47
+ onMouseEnter: () => d(!0),
48
+ onMouseLeave: () => d(!1),
49
49
  onClick: s,
50
- onFocus: () => l(!0),
51
- onBlur: () => l(!1),
50
+ onFocus: () => d(!0),
51
+ onBlur: () => d(!1),
52
52
  children: [
53
- t.aiChatSettings?.aiAssistantAvatar && /* @__PURE__ */ e(
53
+ e.aiChatSettings?.aiAssistantAvatar && /* @__PURE__ */ o(
54
54
  "img",
55
55
  {
56
- src: t.aiChatSettings.aiAssistantAvatar,
56
+ src: e.aiChatSettings.aiAssistantAvatar,
57
57
  alt: "AI Assistant",
58
58
  style: {
59
59
  width: "20px",
@@ -62,8 +62,8 @@ const ie = ({ settings: t, onClick: i }) => {
62
62
  objectFit: "cover",
63
63
  flexShrink: 0
64
64
  },
65
- onError: (d) => {
66
- d.currentTarget.style.display = "none";
65
+ onError: (l) => {
66
+ l.currentTarget.style.display = "none";
67
67
  }
68
68
  }
69
69
  ),
@@ -72,27 +72,27 @@ const ie = ({ settings: t, onClick: i }) => {
72
72
  }
73
73
  );
74
74
  }, se = ({
75
- settings: t,
75
+ settings: e,
76
76
  onClose: i
77
77
  }) => {
78
- const [r, l] = f(!0), [s, d] = f(""), g = () => {
79
- l(!1), i?.();
80
- }, T = (o) => {
81
- d(o);
78
+ const [n, d] = u(!0), [s, l] = u(""), m = () => {
79
+ d(!1), i?.();
80
+ }, T = (r) => {
81
+ l(r);
82
82
  };
83
- return M(() => {
84
- const o = (b) => {
85
- b.key === "Escape" && g();
83
+ return E(() => {
84
+ const r = (x) => {
85
+ x.key === "Escape" && m();
86
86
  };
87
- if (r)
88
- return document.addEventListener("keydown", o), () => document.removeEventListener("keydown", o);
89
- }, [r]), M(() => {
90
- if (r)
87
+ if (n)
88
+ return document.addEventListener("keydown", r), () => document.removeEventListener("keydown", r);
89
+ }, [n]), E(() => {
90
+ if (n)
91
91
  return document.body.style.overflow = "hidden", () => {
92
92
  document.body.style.overflow = "";
93
93
  };
94
- }, [r]), r ? /* @__PURE__ */ c(z, { children: [
95
- /* @__PURE__ */ e(
94
+ }, [n]), n ? /* @__PURE__ */ g(q, { children: [
95
+ /* @__PURE__ */ o(
96
96
  "div",
97
97
  {
98
98
  style: {
@@ -106,10 +106,10 @@ const ie = ({ settings: t, onClick: i }) => {
106
106
  zIndex: 999,
107
107
  animation: "fadeIn 0.2s ease-out"
108
108
  },
109
- onClick: g
109
+ onClick: m
110
110
  }
111
111
  ),
112
- /* @__PURE__ */ c(
112
+ /* @__PURE__ */ g(
113
113
  "div",
114
114
  {
115
115
  style: {
@@ -128,9 +128,9 @@ const ie = ({ settings: t, onClick: i }) => {
128
128
  fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
129
129
  animation: "slideIn 0.3s ease-out"
130
130
  },
131
- onClick: (o) => o.stopPropagation(),
131
+ onClick: (r) => r.stopPropagation(),
132
132
  children: [
133
- /* @__PURE__ */ c(
133
+ /* @__PURE__ */ g(
134
134
  "div",
135
135
  {
136
136
  style: {
@@ -139,14 +139,14 @@ const ie = ({ settings: t, onClick: i }) => {
139
139
  display: "flex",
140
140
  justifyContent: "space-between",
141
141
  alignItems: "center",
142
- background: `linear-gradient(135deg, ${t.baseSettings.primaryBrandColor}10, ${t.baseSettings.primaryBrandColor}05)`
142
+ background: `linear-gradient(135deg, ${e.baseSettings.primaryBrandColor}10, ${e.baseSettings.primaryBrandColor}05)`
143
143
  },
144
144
  children: [
145
- /* @__PURE__ */ c("div", { style: { display: "flex", alignItems: "center", gap: "12px" }, children: [
146
- t.aiChatSettings?.aiAssistantAvatar && /* @__PURE__ */ e(
145
+ /* @__PURE__ */ g("div", { style: { display: "flex", alignItems: "center", gap: "12px" }, children: [
146
+ e.aiChatSettings?.aiAssistantAvatar && /* @__PURE__ */ o(
147
147
  "img",
148
148
  {
149
- src: t.aiChatSettings.aiAssistantAvatar,
149
+ src: e.aiChatSettings.aiAssistantAvatar,
150
150
  alt: "AI Assistant",
151
151
  style: {
152
152
  width: "32px",
@@ -154,29 +154,29 @@ const ie = ({ settings: t, onClick: i }) => {
154
154
  borderRadius: "50%",
155
155
  objectFit: "cover"
156
156
  },
157
- onError: (o) => {
158
- o.currentTarget.style.display = "none";
157
+ onError: (r) => {
158
+ r.currentTarget.style.display = "none";
159
159
  }
160
160
  }
161
161
  ),
162
- /* @__PURE__ */ e(
162
+ /* @__PURE__ */ o(
163
163
  "h3",
164
164
  {
165
165
  style: {
166
166
  margin: 0,
167
- color: t.baseSettings.primaryBrandColor,
167
+ color: e.baseSettings.primaryBrandColor,
168
168
  fontSize: "18px",
169
169
  fontWeight: "600",
170
170
  letterSpacing: "-0.025em"
171
171
  },
172
- children: t.baseSettings.organizationDisplayName
172
+ children: e.baseSettings.organizationDisplayName
173
173
  }
174
174
  )
175
175
  ] }),
176
- /* @__PURE__ */ e(
176
+ /* @__PURE__ */ o(
177
177
  "button",
178
178
  {
179
- onClick: g,
179
+ onClick: m,
180
180
  style: {
181
181
  background: "none",
182
182
  border: "none",
@@ -190,11 +190,11 @@ const ie = ({ settings: t, onClick: i }) => {
190
190
  justifyContent: "center",
191
191
  transition: "all 0.15s ease"
192
192
  },
193
- onMouseEnter: (o) => {
194
- o.currentTarget.style.backgroundColor = "#f1f5f9", o.currentTarget.style.color = "#334155";
193
+ onMouseEnter: (r) => {
194
+ r.currentTarget.style.backgroundColor = "#f1f5f9", r.currentTarget.style.color = "#334155";
195
195
  },
196
- onMouseLeave: (o) => {
197
- o.currentTarget.style.backgroundColor = "transparent", o.currentTarget.style.color = "#64748b";
196
+ onMouseLeave: (r) => {
197
+ r.currentTarget.style.backgroundColor = "transparent", r.currentTarget.style.color = "#64748b";
198
198
  },
199
199
  children: "×"
200
200
  }
@@ -202,7 +202,7 @@ const ie = ({ settings: t, onClick: i }) => {
202
202
  ]
203
203
  }
204
204
  ),
205
- /* @__PURE__ */ c(
205
+ /* @__PURE__ */ g(
206
206
  "div",
207
207
  {
208
208
  style: {
@@ -211,14 +211,14 @@ const ie = ({ settings: t, onClick: i }) => {
211
211
  overflowY: "auto"
212
212
  },
213
213
  children: [
214
- /* @__PURE__ */ c("div", { style: { position: "relative", marginBottom: "24px" }, children: [
215
- /* @__PURE__ */ e(
214
+ /* @__PURE__ */ g("div", { style: { position: "relative", marginBottom: "24px" }, children: [
215
+ /* @__PURE__ */ o(
216
216
  "input",
217
217
  {
218
218
  type: "text",
219
219
  placeholder: "Ask a question...",
220
220
  value: s,
221
- onChange: (o) => d(o.target.value),
221
+ onChange: (r) => l(r.target.value),
222
222
  style: {
223
223
  width: "100%",
224
224
  padding: "14px 16px",
@@ -231,16 +231,16 @@ const ie = ({ settings: t, onClick: i }) => {
231
231
  transition: "border-color 0.15s ease",
232
232
  backgroundColor: "#fafafa"
233
233
  },
234
- onFocus: (o) => {
235
- o.currentTarget.style.borderColor = t.baseSettings.primaryBrandColor, o.currentTarget.style.backgroundColor = "white";
234
+ onFocus: (r) => {
235
+ r.currentTarget.style.borderColor = e.baseSettings.primaryBrandColor, r.currentTarget.style.backgroundColor = "white";
236
236
  },
237
- onBlur: (o) => {
238
- o.currentTarget.style.borderColor = "#e2e8f0", o.currentTarget.style.backgroundColor = "#fafafa";
237
+ onBlur: (r) => {
238
+ r.currentTarget.style.borderColor = "#e2e8f0", r.currentTarget.style.backgroundColor = "#fafafa";
239
239
  },
240
240
  autoFocus: !0
241
241
  }
242
242
  ),
243
- /* @__PURE__ */ e(
243
+ /* @__PURE__ */ o(
244
244
  "button",
245
245
  {
246
246
  style: {
@@ -248,7 +248,7 @@ const ie = ({ settings: t, onClick: i }) => {
248
248
  right: "8px",
249
249
  top: "50%",
250
250
  transform: "translateY(-50%)",
251
- backgroundColor: t.baseSettings.primaryBrandColor,
251
+ backgroundColor: e.baseSettings.primaryBrandColor,
252
252
  color: "white",
253
253
  border: "none",
254
254
  borderRadius: "8px",
@@ -258,11 +258,11 @@ const ie = ({ settings: t, onClick: i }) => {
258
258
  fontWeight: "500",
259
259
  transition: "opacity 0.15s ease"
260
260
  },
261
- onMouseEnter: (o) => {
262
- o.currentTarget.style.opacity = "0.9";
261
+ onMouseEnter: (r) => {
262
+ r.currentTarget.style.opacity = "0.9";
263
263
  },
264
- onMouseLeave: (o) => {
265
- o.currentTarget.style.opacity = "1";
264
+ onMouseLeave: (r) => {
265
+ r.currentTarget.style.opacity = "1";
266
266
  },
267
267
  onClick: () => {
268
268
  console.log("Search for:", s);
@@ -271,8 +271,8 @@ const ie = ({ settings: t, onClick: i }) => {
271
271
  }
272
272
  )
273
273
  ] }),
274
- t.aiChatSettings?.exampleQuestions && t.aiChatSettings.exampleQuestions.length > 0 && /* @__PURE__ */ c("div", { children: [
275
- /* @__PURE__ */ e(
274
+ e.aiChatSettings?.exampleQuestions && e.aiChatSettings.exampleQuestions.length > 0 && /* @__PURE__ */ g("div", { children: [
275
+ /* @__PURE__ */ o(
276
276
  "p",
277
277
  {
278
278
  style: {
@@ -285,15 +285,15 @@ const ie = ({ settings: t, onClick: i }) => {
285
285
  children: "Popular questions:"
286
286
  }
287
287
  ),
288
- /* @__PURE__ */ e(
288
+ /* @__PURE__ */ o(
289
289
  "div",
290
290
  {
291
291
  style: { display: "flex", flexDirection: "column", gap: "8px" },
292
- children: t.aiChatSettings.exampleQuestions.map(
293
- (o, b) => /* @__PURE__ */ e(
292
+ children: e.aiChatSettings.exampleQuestions.map(
293
+ (r, x) => /* @__PURE__ */ o(
294
294
  "button",
295
295
  {
296
- onClick: () => T(o),
296
+ onClick: () => T(r),
297
297
  style: {
298
298
  display: "block",
299
299
  width: "100%",
@@ -309,15 +309,15 @@ const ie = ({ settings: t, onClick: i }) => {
309
309
  transition: "all 0.15s ease",
310
310
  lineHeight: "1.4"
311
311
  },
312
- onMouseEnter: (p) => {
313
- p.currentTarget.style.backgroundColor = "#f8fafc", p.currentTarget.style.borderColor = t.baseSettings.primaryBrandColor, p.currentTarget.style.transform = "translateY(-1px)", p.currentTarget.style.boxShadow = "0 4px 12px rgba(0,0,0,0.1)";
312
+ onMouseEnter: (c) => {
313
+ c.currentTarget.style.backgroundColor = "#f8fafc", c.currentTarget.style.borderColor = e.baseSettings.primaryBrandColor, c.currentTarget.style.transform = "translateY(-1px)", c.currentTarget.style.boxShadow = "0 4px 12px rgba(0,0,0,0.1)";
314
314
  },
315
- onMouseLeave: (p) => {
316
- p.currentTarget.style.backgroundColor = "white", p.currentTarget.style.borderColor = "#e2e8f0", p.currentTarget.style.transform = "translateY(0)", p.currentTarget.style.boxShadow = "none";
315
+ onMouseLeave: (c) => {
316
+ c.currentTarget.style.backgroundColor = "white", c.currentTarget.style.borderColor = "#e2e8f0", c.currentTarget.style.transform = "translateY(0)", c.currentTarget.style.boxShadow = "none";
317
317
  },
318
- children: o
318
+ children: r
319
319
  },
320
- b
320
+ x
321
321
  )
322
322
  )
323
323
  }
@@ -329,7 +329,7 @@ const ie = ({ settings: t, onClick: i }) => {
329
329
  ]
330
330
  }
331
331
  ),
332
- /* @__PURE__ */ e("style", { children: `
332
+ /* @__PURE__ */ o("style", { children: `
333
333
  @keyframes fadeIn {
334
334
  from { opacity: 0; }
335
335
  to { opacity: 1; }
@@ -367,35 +367,35 @@ const ie = ({ settings: t, onClick: i }) => {
367
367
  }, le = {
368
368
  borderColor: "#0f172a",
369
369
  boxShadow: "0 0 0 1px #0f172a"
370
- }, ce = "#64748b", G = L.forwardRef(
371
- ({ style: t, onFocus: i, onBlur: r, ...l }, s) => {
372
- const [d, g] = L.useState(!1), T = {
370
+ }, ce = "#64748b", G = M.forwardRef(
371
+ ({ style: e, onFocus: i, onBlur: n, ...d }, s) => {
372
+ const [l, m] = M.useState(!1), T = {
373
373
  ...de,
374
- ...d ? le : {},
375
- ...t,
374
+ ...l ? le : {},
375
+ ...e,
376
376
  // Handle placeholder color via CSS custom property
377
377
  // @ts-ignore - CSS custom properties are valid
378
378
  "--placeholder-color": ce
379
379
  };
380
- return l.disabled && (T.cursor = "not-allowed", T.opacity = 0.5), /* @__PURE__ */ c(z, { children: [
381
- /* @__PURE__ */ e("style", { children: `
380
+ return d.disabled && (T.cursor = "not-allowed", T.opacity = 0.5), /* @__PURE__ */ g(q, { children: [
381
+ /* @__PURE__ */ o("style", { children: `
382
382
  .textarea-with-placeholder::placeholder {
383
383
  color: var(--placeholder-color);
384
384
  }
385
385
  ` }),
386
- /* @__PURE__ */ e(
386
+ /* @__PURE__ */ o(
387
387
  "textarea",
388
388
  {
389
389
  className: "textarea-with-placeholder",
390
390
  style: T,
391
391
  ref: s,
392
- onFocus: (p) => {
393
- g(!0), i?.(p);
392
+ onFocus: (c) => {
393
+ m(!0), i?.(c);
394
394
  },
395
- onBlur: (p) => {
396
- g(!1), r?.(p);
395
+ onBlur: (c) => {
396
+ m(!1), n?.(c);
397
397
  },
398
- ...l
398
+ ...d
399
399
  }
400
400
  )
401
401
  ] });
@@ -481,8 +481,8 @@ const pe = {
481
481
  width: "32px",
482
482
  padding: "0"
483
483
  }
484
- }, he = (t) => {
485
- switch (t) {
484
+ }, ge = (e) => {
485
+ switch (e) {
486
486
  case "default":
487
487
  return { backgroundColor: "hsl(var(--sdk-primary, 240 5.9% 10%) / 0.9)" };
488
488
  case "destructive":
@@ -513,12 +513,12 @@ const pe = {
513
513
  default:
514
514
  return {};
515
515
  }
516
- }, ge = (t) => {
516
+ }, he = (e) => {
517
517
  const i = {
518
518
  outline: "1px solid hsl(var(--sdk-ring, 240 10% 3.9%))",
519
519
  outlineOffset: "1px"
520
520
  };
521
- switch (t) {
521
+ switch (e) {
522
522
  case "outline":
523
523
  return {
524
524
  ...i,
@@ -528,60 +528,60 @@ const pe = {
528
528
  default:
529
529
  return i;
530
530
  }
531
- }, J = L.forwardRef(
531
+ }, te = M.forwardRef(
532
532
  ({
533
- variant: t = "default",
533
+ variant: e = "default",
534
534
  size: i = "default",
535
- asChild: r = !1,
536
- style: l,
535
+ asChild: n = !1,
536
+ style: d,
537
537
  onMouseEnter: s,
538
- onMouseLeave: d,
539
- onFocus: g,
538
+ onMouseLeave: l,
539
+ onFocus: m,
540
540
  onBlur: T,
541
- onClick: o,
542
- ...b
543
- }, p) => {
544
- const [H, A] = L.useState(!1), [y, F] = L.useState(!1), k = {
541
+ onClick: r,
542
+ ...x
543
+ }, c) => {
544
+ const [z, A] = M.useState(!1), [k, F] = M.useState(!1), w = {
545
545
  ...pe,
546
- ...ue[t],
546
+ ...ue[e],
547
547
  ...fe[i],
548
- ...H ? he(t) : {},
549
- ...y ? ge(t) : {},
550
- ...l
548
+ ...z ? ge(e) : {},
549
+ ...k ? he(e) : {},
550
+ ...d
551
551
  // Allow style override
552
552
  };
553
- b.disabled && (k.pointerEvents = "none", k.opacity = 0.5, k.cursor = "not-allowed");
554
- const I = (u) => {
555
- A(!0), s?.(u);
556
- }, R = (u) => {
557
- A(!1), d?.(u);
558
- }, w = (u) => {
559
- F(!0), g?.(u);
560
- }, D = (u) => {
561
- F(!1), T?.(u);
562
- }, j = (u) => {
553
+ x.disabled && (w.pointerEvents = "none", w.opacity = 0.5, w.cursor = "not-allowed");
554
+ const I = (p) => {
555
+ A(!0), s?.(p);
556
+ }, R = (p) => {
557
+ A(!1), l?.(p);
558
+ }, y = (p) => {
559
+ F(!0), m?.(p);
560
+ }, D = (p) => {
561
+ F(!1), T?.(p);
562
+ }, N = (p) => {
563
563
  setTimeout(() => {
564
- u.currentTarget && u.currentTarget.blur();
565
- }, 150), o?.(u);
564
+ p.currentTarget && p.currentTarget.blur();
565
+ }, 150), r?.(p);
566
566
  };
567
- return r && console.warn(
567
+ return n && console.warn(
568
568
  "asChild prop is not supported in the inline CSS version of Button."
569
- ), /* @__PURE__ */ e(
569
+ ), /* @__PURE__ */ o(
570
570
  "button",
571
571
  {
572
- style: k,
573
- ref: p,
572
+ style: w,
573
+ ref: c,
574
574
  onMouseEnter: I,
575
575
  onMouseLeave: R,
576
- onFocus: w,
576
+ onFocus: y,
577
577
  onBlur: D,
578
- onClick: j,
579
- ...b
578
+ onClick: N,
579
+ ...x
580
580
  }
581
581
  );
582
582
  }
583
583
  );
584
- J.displayName = "Button";
584
+ te.displayName = "Button";
585
585
  const me = {
586
586
  ocean: {
587
587
  primary: "#1ca0fb",
@@ -835,23 +835,23 @@ const me = {
835
835
  }
836
836
  }
837
837
  }
838
- }, te = (t) => me[t || "ocean"], Re = "ocean", xe = ({
839
- size: t = 20,
838
+ }, ee = (e) => me[e || "ocean"], Ce = "ocean", be = ({
839
+ size: e = 20,
840
840
  className: i = "",
841
- style: r = {}
842
- }) => /* @__PURE__ */ c(z, { children: [
843
- /* @__PURE__ */ e("style", { children: `
841
+ style: n = {}
842
+ }) => /* @__PURE__ */ g(q, { children: [
843
+ /* @__PURE__ */ o("style", { children: `
844
844
  @keyframes icon-spin {
845
845
  from { transform: rotate(0deg); }
846
846
  to { transform: rotate(360deg); }
847
847
  }
848
848
  ` }),
849
- /* @__PURE__ */ e(
849
+ /* @__PURE__ */ o(
850
850
  "svg",
851
851
  {
852
852
  xmlns: "http://www.w3.org/2000/svg",
853
- width: t,
854
- height: t,
853
+ width: e,
854
+ height: e,
855
855
  viewBox: "0 0 24 24",
856
856
  fill: "none",
857
857
  stroke: "currentColor",
@@ -861,21 +861,21 @@ const me = {
861
861
  className: `lucide lucide-loader-circle ${i}`,
862
862
  style: {
863
863
  animation: "icon-spin 1s linear infinite",
864
- ...r
864
+ ...n
865
865
  },
866
- children: /* @__PURE__ */ e("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
866
+ children: /* @__PURE__ */ o("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
867
867
  }
868
868
  )
869
- ] }), be = ({
870
- size: t = 20,
869
+ ] }), xe = ({
870
+ size: e = 20,
871
871
  className: i = "",
872
- style: r = {}
873
- }) => /* @__PURE__ */ c(
872
+ style: n = {}
873
+ }) => /* @__PURE__ */ g(
874
874
  "svg",
875
875
  {
876
876
  xmlns: "http://www.w3.org/2000/svg",
877
- width: t,
878
- height: t,
877
+ width: e,
878
+ height: e,
879
879
  viewBox: "0 0 24 24",
880
880
  fill: "none",
881
881
  stroke: "currentColor",
@@ -884,256 +884,77 @@ const me = {
884
884
  strokeLinejoin: "round",
885
885
  className: `lucide lucide-arrow-up ${i}`,
886
886
  style: {
887
- ...r
887
+ ...n
888
888
  },
889
889
  children: [
890
- /* @__PURE__ */ e("path", { d: "m5 12 7-7 7 7" }),
891
- /* @__PURE__ */ e("path", { d: "M12 19V5" })
890
+ /* @__PURE__ */ o("path", { d: "m5 12 7-7 7 7" }),
891
+ /* @__PURE__ */ o("path", { d: "M12 19V5" })
892
892
  ]
893
893
  }
894
- ), ye = ({
895
- isRecording: t = !1,
896
- isTranscribing: i = !1,
897
- size: r = 20,
898
- style: l = {}
899
- }) => {
900
- const s = {
901
- position: "relative",
902
- width: `${r}px`,
903
- height: `${Math.floor(r * 0.8)}px`,
904
- display: "flex",
905
- alignItems: "center",
906
- justifyContent: "center",
907
- ...l
908
- };
909
- if (i)
910
- return /* @__PURE__ */ c(z, { children: [
911
- /* @__PURE__ */ e("style", { children: `
912
- @keyframes icon-spin {
913
- from { transform: rotate(0deg); }
914
- to { transform: rotate(360deg); }
915
- }
916
- ` }),
917
- /* @__PURE__ */ e("div", { style: s, children: /* @__PURE__ */ e(
918
- "div",
919
- {
920
- style: {
921
- width: `${Math.floor(r * 0.6)}px`,
922
- height: `${Math.floor(r * 0.6)}px`,
923
- border: "2px solid currentColor",
924
- borderTop: "2px solid transparent",
925
- borderRadius: "50%",
926
- animation: "icon-spin 1s linear infinite"
927
- }
928
- }
929
- ) })
930
- ] });
931
- if (t)
932
- return /* @__PURE__ */ c(z, { children: [
933
- /* @__PURE__ */ e("style", { children: `
934
- @keyframes icon-pulse {
935
- 0%, 100% { transform: scale(1); }
936
- 50% { transform: scale(0.95); }
937
- }
938
- ` }),
939
- /* @__PURE__ */ e("div", { style: s, children: /* @__PURE__ */ e(
940
- "div",
941
- {
942
- style: {
943
- width: `${Math.floor(r * 0.6)}px`,
944
- height: `${Math.floor(r * 0.6)}px`,
945
- backgroundColor: "currentColor",
946
- borderRadius: "2px",
947
- animation: "icon-pulse 1s ease-in-out infinite"
948
- }
949
- }
950
- ) })
951
- ] });
952
- const d = Math.max(1, Math.floor(r * 0.075)), g = Math.max(1, Math.floor(r * 0.1));
953
- return /* @__PURE__ */ c(z, { children: [
954
- /* @__PURE__ */ e("style", { children: `
955
- @keyframes wave1 {
956
- 0%, 100% {
957
- transform: scaleY(0.4);
958
- opacity: 0.6;
959
- }
960
- 50% {
961
- transform: scaleY(0.8);
962
- opacity: 0.9;
963
- }
964
- }
965
-
966
- @keyframes wave2 {
967
- 0%, 100% {
968
- transform: scaleY(0.5);
969
- opacity: 0.7;
970
- }
971
- 50% {
972
- transform: scaleY(1);
973
- opacity: 1;
974
- }
975
- }
976
-
977
- @keyframes wave3 {
978
- 0%, 100% {
979
- transform: scaleY(0.6);
980
- opacity: 0.8;
981
- }
982
- 50% {
983
- transform: scaleY(1);
984
- opacity: 1;
985
- }
986
- }
987
-
988
- @keyframes wave4 {
989
- 0%, 100% {
990
- transform: scaleY(0.5);
991
- opacity: 0.7;
992
- }
993
- 50% {
994
- transform: scaleY(0.9);
995
- opacity: 1;
996
- }
997
- }
998
-
999
- @keyframes wave5 {
1000
- 0%, 100% {
1001
- transform: scaleY(0.4);
1002
- opacity: 0.6;
1003
- }
1004
- 50% {
1005
- transform: scaleY(0.7);
1006
- opacity: 0.9;
1007
- }
1008
- }
1009
- ` }),
1010
- /* @__PURE__ */ e("div", { style: s, children: /* @__PURE__ */ c("div", { style: { display: "flex", alignItems: "center", gap: `${g}px` }, children: [
1011
- /* @__PURE__ */ e(
1012
- "div",
1013
- {
1014
- style: {
1015
- width: `${d}px`,
1016
- height: `${Math.floor(r * 0.4)}px`,
1017
- backgroundColor: "currentColor",
1018
- borderRadius: "999px",
1019
- animation: "wave1 1.8s ease-in-out infinite"
1020
- }
1021
- }
1022
- ),
1023
- /* @__PURE__ */ e(
1024
- "div",
1025
- {
1026
- style: {
1027
- width: `${d}px`,
1028
- height: `${Math.floor(r * 0.6)}px`,
1029
- backgroundColor: "currentColor",
1030
- borderRadius: "999px",
1031
- animation: "wave2 2.1s ease-in-out infinite"
1032
- }
1033
- }
1034
- ),
1035
- /* @__PURE__ */ e(
1036
- "div",
1037
- {
1038
- style: {
1039
- width: `${d}px`,
1040
- height: `${Math.floor(r * 0.8)}px`,
1041
- backgroundColor: "currentColor",
1042
- borderRadius: "999px",
1043
- animation: "wave3 1.6s ease-in-out infinite"
1044
- }
1045
- }
1046
- ),
1047
- /* @__PURE__ */ e(
1048
- "div",
1049
- {
1050
- style: {
1051
- width: `${d}px`,
1052
- height: `${Math.floor(r * 0.6)}px`,
1053
- backgroundColor: "currentColor",
1054
- borderRadius: "999px",
1055
- animation: "wave4 1.9s ease-in-out infinite"
1056
- }
1057
- }
1058
- ),
1059
- /* @__PURE__ */ e(
1060
- "div",
1061
- {
1062
- style: {
1063
- width: `${d}px`,
1064
- height: `${Math.floor(r * 0.4)}px`,
1065
- backgroundColor: "currentColor",
1066
- borderRadius: "999px",
1067
- animation: "wave5 2.2s ease-in-out infinite"
1068
- }
1069
- }
1070
- )
1071
- ] }) })
1072
- ] });
1073
- }, re = oe(
894
+ ), re = oe(
1074
895
  ({
1075
- texts: t,
896
+ texts: e,
1076
897
  typingSpeed: i = 30,
1077
- deletingSpeed: r = 15,
1078
- delayAfterText: l = 800,
898
+ deletingSpeed: n = 15,
899
+ delayAfterText: d = 800,
1079
900
  onSubmit: s,
1080
- isStreaming: d = !1,
1081
- className: g = "",
901
+ isStreaming: l = !1,
902
+ className: m = "",
1082
903
  placeholderClassName: T = "",
1083
- value: o,
1084
- onChange: b,
1085
- onFocus: p,
1086
- onBlur: H,
904
+ value: r,
905
+ onChange: x,
906
+ onFocus: c,
907
+ onBlur: z,
1087
908
  onKeyDown: A,
1088
- onPaste: y,
909
+ onPaste: k,
1089
910
  placeholder: F,
1090
- rows: k = 1,
911
+ rows: w = 1,
1091
912
  ...I
1092
913
  }, R) => {
1093
- const [w, D] = f(""), [j, u] = f(!1), [C, W] = f(0), [x, S] = f(!1), [v, N] = f(!1), [K, $] = f(!1), [P, Q] = f(!1), _ = U(null), O = R || _, B = t[C], E = o === "" || o === void 0;
1094
- M(() => {
1095
- if (!E) return;
1096
- let n;
1097
- return x ? (n = setTimeout(() => {
1098
- S(!1), $(!0), N(!0), Q(!0);
1099
- }, l), () => clearTimeout(n)) : K ? (n = setTimeout(() => {
1100
- Q(!1), setTimeout(() => {
1101
- N(!1), $(!1), u(!0);
914
+ const [y, D] = u(""), [N, p] = u(!1), [S, P] = u(0), [b, C] = u(!1), [v, W] = u(!1), [O, H] = u(!1), [Q, K] = u(!1), Y = V(null), $ = R || Y, L = e[S], B = r === "" || r === void 0;
915
+ E(() => {
916
+ if (!B) return;
917
+ let a;
918
+ return b ? (a = setTimeout(() => {
919
+ C(!1), H(!0), W(!0), K(!0);
920
+ }, d), () => clearTimeout(a)) : O ? (a = setTimeout(() => {
921
+ K(!1), setTimeout(() => {
922
+ W(!1), H(!1), p(!0);
1102
923
  }, 300);
1103
- }, 3e3), () => clearTimeout(n)) : (j ? w === "" ? (u(!1), W((m) => (m + 1) % t.length)) : n = setTimeout(() => {
1104
- D((m) => m.slice(0, -1));
1105
- }, r) : w === B ? S(!0) : n = setTimeout(() => {
1106
- D(B.slice(0, w.length + 1));
1107
- }, i), () => clearTimeout(n));
924
+ }, 3e3), () => clearTimeout(a)) : (N ? y === "" ? (p(!1), P((h) => (h + 1) % e.length)) : a = setTimeout(() => {
925
+ D((h) => h.slice(0, -1));
926
+ }, n) : y === L ? C(!0) : a = setTimeout(() => {
927
+ D(L.slice(0, y.length + 1));
928
+ }, i), () => clearTimeout(a));
1108
929
  }, [
1109
- w,
1110
- j,
1111
- C,
1112
- x,
1113
- K,
1114
- B,
1115
- t,
930
+ y,
931
+ N,
932
+ S,
933
+ b,
934
+ O,
935
+ L,
936
+ e,
1116
937
  i,
1117
- r,
1118
- l,
1119
- E
938
+ n,
939
+ d,
940
+ B
1120
941
  ]);
1121
- const a = (n) => {
1122
- if (n.key === "Tab" && E) {
1123
- n.preventDefault(), b?.({
1124
- target: { value: B }
942
+ const t = (a) => {
943
+ if (a.key === "Tab" && B) {
944
+ a.preventDefault(), x?.({
945
+ target: { value: L }
1125
946
  });
1126
947
  return;
1127
948
  }
1128
- if (n.key === "Enter") {
1129
- if (n.shiftKey || (n.preventDefault(), d))
949
+ if (a.key === "Enter") {
950
+ if (a.shiftKey || (a.preventDefault(), l))
1130
951
  return;
1131
- s?.(n);
952
+ s?.(a);
1132
953
  }
1133
- A?.(n);
954
+ A?.(a);
1134
955
  };
1135
- return /* @__PURE__ */ c("div", { style: { position: "relative", width: "100%" }, children: [
1136
- E && /* @__PURE__ */ e(
956
+ return /* @__PURE__ */ g("div", { style: { position: "relative", width: "100%" }, children: [
957
+ B && /* @__PURE__ */ o(
1137
958
  "div",
1138
959
  {
1139
960
  style: {
@@ -1151,7 +972,7 @@ const me = {
1151
972
  paddingBottom: "0",
1152
973
  marginTop: "5px"
1153
974
  },
1154
- children: /* @__PURE__ */ c(
975
+ children: /* @__PURE__ */ g(
1155
976
  "p",
1156
977
  {
1157
978
  style: {
@@ -1161,8 +982,8 @@ const me = {
1161
982
  ...T ? {} : {}
1162
983
  },
1163
984
  children: [
1164
- w,
1165
- /* @__PURE__ */ e(
985
+ y,
986
+ /* @__PURE__ */ o(
1166
987
  "span",
1167
988
  {
1168
989
  style: {
@@ -1179,8 +1000,8 @@ const me = {
1179
1000
  marginLeft: "8px",
1180
1001
  display: "inline-flex",
1181
1002
  whiteSpace: "nowrap",
1182
- opacity: P ? 1 : 0,
1183
- transform: P ? "scale(1)" : "scale(0.8)",
1003
+ opacity: Q ? 1 : 0,
1004
+ transform: Q ? "scale(1)" : "scale(0.8)",
1184
1005
  transition: "opacity 0.3s ease, transform 0.3s ease",
1185
1006
  visibility: v ? "visible" : "hidden",
1186
1007
  verticalAlign: "middle"
@@ -1193,19 +1014,19 @@ const me = {
1193
1014
  )
1194
1015
  }
1195
1016
  ),
1196
- /* @__PURE__ */ e(
1017
+ /* @__PURE__ */ o(
1197
1018
  G,
1198
1019
  {
1199
- ref: O,
1020
+ ref: $,
1200
1021
  placeholder: F,
1201
- style: g ? {} : {},
1202
- value: o,
1203
- onFocus: p,
1204
- onBlur: H,
1205
- onChange: b,
1206
- onKeyDown: a,
1207
- onPaste: y,
1208
- rows: k,
1022
+ style: m ? {} : {},
1023
+ value: r,
1024
+ onFocus: c,
1025
+ onBlur: z,
1026
+ onChange: x,
1027
+ onKeyDown: t,
1028
+ onPaste: k,
1029
+ rows: w,
1209
1030
  ...I
1210
1031
  }
1211
1032
  )
@@ -1213,59 +1034,22 @@ const me = {
1213
1034
  }
1214
1035
  );
1215
1036
  re.displayName = "TypingTextarea";
1216
- const ke = ({
1217
- isRecording: t,
1218
- isTranscribing: i,
1219
- onVoiceRecording: r
1220
- }) => /* @__PURE__ */ e(
1221
- J,
1222
- {
1223
- size: "icon",
1224
- variant: "outline",
1225
- style: {
1226
- height: "32px",
1227
- paddingLeft: "8px",
1228
- paddingRight: "8px",
1229
- fontSize: "12px",
1230
- fontWeight: "500",
1231
- transition: "all 0.2s ease-in-out",
1232
- ...t && {
1233
- backgroundColor: "#ef4444",
1234
- // red-500
1235
- borderColor: "#ef4444",
1236
- boxShadow: "0 10px 15px -3px rgba(239, 68, 68, 0.25)",
1237
- color: "white"
1238
- },
1239
- ...i && {
1240
- backgroundColor: "#3b82f6",
1241
- // blue-500
1242
- borderColor: "#3b82f6",
1243
- boxShadow: "0 10px 15px -3px rgba(59, 130, 246, 0.25)",
1244
- color: "white"
1245
- }
1246
- },
1247
- onClick: () => {
1248
- r();
1249
- },
1250
- disabled: i,
1251
- children: /* @__PURE__ */ e(ye, { isRecording: t, isTranscribing: i })
1252
- }
1253
- ), Y = {
1037
+ const j = {
1254
1038
  gradient: "linear-gradient(45deg, #3b82f6, #8b5cf6, #ec4899)",
1255
1039
  shadow: {
1256
1040
  dark: "rgba(0, 0, 0, 0.2)"
1257
1041
  }
1258
- }, we = (t, i) => {
1042
+ }, ye = (e, i) => {
1259
1043
  try {
1260
- return t ? te(t) || Y : te() || Y;
1261
- } catch (r) {
1262
- return console.warn("Theme system error, using fallback:", r), Y;
1044
+ return e ? ee(e) || j : ee() || j;
1045
+ } catch (n) {
1046
+ return console.warn("Theme system error, using fallback:", n), j;
1263
1047
  }
1264
- }, Ie = ({
1265
- placeholder: t = "Ask anything...",
1048
+ }, Te = ({
1049
+ placeholder: e = "Ask anything...",
1266
1050
  onSubmit: i,
1267
- playgroundUid: r,
1268
- isSubmitting: l,
1051
+ playgroundUid: n,
1052
+ isSubmitting: d,
1269
1053
  typingTexts: s = [
1270
1054
  "Build me an AI chatbot application using OpenAI API",
1271
1055
  "Build me an ecommerce website using Stripe API",
@@ -1275,154 +1059,154 @@ const ke = ({
1275
1059
  "Build me a SMS notification system using Twilio API",
1276
1060
  "Build me a travel booking platform using Skyscanner API"
1277
1061
  ],
1278
- shouldFocusOnMount: d = !0,
1279
- showModelSelector: g = !0,
1062
+ shouldFocusOnMount: l = !0,
1063
+ showModelSelector: m = !0,
1280
1064
  projectUid: T,
1281
- theme: o,
1282
- height: b = "auto",
1065
+ theme: r,
1066
+ height: x = "auto",
1283
1067
  // Add default for required height prop
1284
- deepgramApiKey: p
1068
+ deepgramApiKey: c
1285
1069
  }) => {
1286
- const [H, A] = f(!0), [y, F] = f(!1), [k, I] = f(!1), [, R] = f(!1), [w, D] = f(null), [j, u] = f(
1070
+ const [z, A] = u(!0), [k, F] = u(!1), [w, I] = u(!1), [, R] = u(!1), [y, D] = u(null), [N, p] = u(
1287
1071
  null
1288
- ), [C, W] = f(""), x = U(null), S = U([]), v = U(null), [N, K] = f(!1), $ = ne(() => {
1072
+ ), [S, P] = u(""), b = V(null), C = V([]), v = V(null), [W, O] = u(!1), H = ne(() => {
1289
1073
  try {
1290
- return we(o, r);
1291
- } catch (a) {
1292
- return console.warn("Error getting color scheme:", a), Y;
1074
+ return ye(r, n);
1075
+ } catch (t) {
1076
+ return console.warn("Error getting color scheme:", t), j;
1293
1077
  }
1294
- }, [o, r]);
1295
- M(() => {
1296
- K(!0);
1297
- }, []), M(() => {
1298
- if (d && v.current && N)
1078
+ }, [r, n]);
1079
+ E(() => {
1080
+ O(!0);
1081
+ }, []), E(() => {
1082
+ if (l && v.current && W)
1299
1083
  try {
1300
1084
  v.current.focus(), v.current.select();
1301
- } catch (a) {
1302
- console.warn("Focus error:", a);
1085
+ } catch (t) {
1086
+ console.warn("Focus error:", t);
1303
1087
  }
1304
- }, [N, d]);
1305
- const P = () => {
1088
+ }, [W, l]);
1089
+ const Q = () => {
1306
1090
  A(!0);
1307
- }, Q = () => {
1091
+ }, K = () => {
1308
1092
  A(!0);
1309
- }, _ = () => {
1310
- const a = v.current;
1311
- if (a)
1093
+ }, Y = () => {
1094
+ const t = v.current;
1095
+ if (t)
1312
1096
  try {
1313
- a.style.height = "auto";
1314
- const n = Math.min(a.scrollHeight, 200);
1315
- a.style.height = `${n}px`;
1316
- } catch (n) {
1317
- console.warn("Textarea height adjustment error:", n);
1097
+ t.style.height = "auto";
1098
+ const a = Math.min(t.scrollHeight, 200);
1099
+ t.style.height = `${a}px`;
1100
+ } catch (a) {
1101
+ console.warn("Textarea height adjustment error:", a);
1318
1102
  }
1319
1103
  };
1320
- M(() => {
1321
- _();
1322
- }, [C]), M(() => {
1323
- const a = (n) => {
1324
- const m = (n.metaKey || n.ctrlKey) && n.key === "/", h = (n.key === "Enter" || n.key === "Escape") && (y || k);
1325
- m ? (n.preventDefault(), B()) : h && (n.preventDefault(), y && !k && B());
1104
+ E(() => {
1105
+ Y();
1106
+ }, [S]), E(() => {
1107
+ const t = (a) => {
1108
+ const h = (a.metaKey || a.ctrlKey) && a.key === "/", f = (a.key === "Enter" || a.key === "Escape") && (k || w);
1109
+ h ? (a.preventDefault(), L()) : f && (a.preventDefault(), k && !w && L());
1326
1110
  };
1327
- return document.addEventListener("keydown", a), () => {
1328
- document.removeEventListener("keydown", a);
1111
+ return document.addEventListener("keydown", t), () => {
1112
+ document.removeEventListener("keydown", t);
1329
1113
  };
1330
- }, [y, k]), M(() => () => {
1331
- w && clearTimeout(w), x.current && y && x.current.stop(), R(!1);
1332
- }, [w, y]);
1333
- const O = async () => {
1334
- if (x.current && y)
1335
- return F(!1), I(!0), w && (clearTimeout(w), D(null)), new Promise((a) => {
1336
- if (x.current) {
1337
- let n = !1, m;
1338
- x.current.ondataavailable = (h) => {
1339
- h.data.size > 0 && (n = !0, S.current.push(h.data));
1340
- }, x.current.onstop = async () => {
1341
- m && clearTimeout(m);
1114
+ }, [k, w]), E(() => () => {
1115
+ y && clearTimeout(y), b.current && k && b.current.stop(), R(!1);
1116
+ }, [y, k]);
1117
+ const $ = async () => {
1118
+ if (b.current && k)
1119
+ return F(!1), I(!0), y && (clearTimeout(y), D(null)), new Promise((t) => {
1120
+ if (b.current) {
1121
+ let a = !1, h;
1122
+ b.current.ondataavailable = (f) => {
1123
+ f.data.size > 0 && (a = !0, C.current.push(f.data));
1124
+ }, b.current.onstop = async () => {
1125
+ h && clearTimeout(h);
1342
1126
  try {
1343
- if (!n || S.current.length === 0)
1127
+ if (!a || C.current.length === 0)
1344
1128
  throw new Error("No audio data recorded");
1345
- const h = new Blob(S.current, {
1129
+ const f = new Blob(C.current, {
1346
1130
  type: "audio/wav"
1347
1131
  });
1348
- if (h.size < 1024)
1132
+ if (f.size < 1024)
1349
1133
  throw new Error("Audio recording too short");
1350
- const q = new FormData();
1351
- q.append("audio", h, "recording.wav"), p && q.append("deepgramApiKey", p);
1352
- const X = await fetch("/api/voice/transcribe", {
1134
+ const _ = new FormData();
1135
+ _.append("audio", f, "recording.wav"), c && _.append("deepgramApiKey", c);
1136
+ const J = await fetch("/api/voice/transcribe", {
1353
1137
  method: "POST",
1354
- body: q
1138
+ body: _
1355
1139
  });
1356
- if (X.ok) {
1357
- const { transcription: V } = await X.json();
1358
- if (V && V.trim()) {
1359
- const ae = C ? `${C} ${V}` : V;
1360
- W(ae.trim()), setTimeout(() => {
1140
+ if (J.ok) {
1141
+ const { transcription: U } = await J.json();
1142
+ if (U && U.trim()) {
1143
+ const ae = S ? `${S} ${U}` : U;
1144
+ P(ae.trim()), setTimeout(() => {
1361
1145
  if (v.current) {
1362
1146
  v.current.focus();
1363
- const Z = v.current.value.length;
1364
- v.current.setSelectionRange(Z, Z);
1147
+ const X = v.current.value.length;
1148
+ v.current.setSelectionRange(X, X);
1365
1149
  }
1366
1150
  }, 100);
1367
1151
  }
1368
1152
  } else
1369
1153
  throw new Error("Transcription failed");
1370
- } catch (h) {
1371
- console.error("Transcription error:", h), h instanceof Error && (h.message.includes("No audio data") || h.message.includes("too short"));
1154
+ } catch (f) {
1155
+ console.error("Transcription error:", f), f instanceof Error && (f.message.includes("No audio data") || f.message.includes("too short"));
1372
1156
  } finally {
1373
- S.current = [], x.current = null, u(null), I(!1), R(!1), a();
1157
+ C.current = [], b.current = null, p(null), I(!1), R(!1), t();
1374
1158
  }
1375
- }, m = setTimeout(() => {
1376
- console.warn("MediaRecorder stop timeout, forcing cleanup"), S.current = [], x.current = null, u(null), I(!1), R(!1), a();
1159
+ }, h = setTimeout(() => {
1160
+ console.warn("MediaRecorder stop timeout, forcing cleanup"), C.current = [], b.current = null, p(null), I(!1), R(!1), t();
1377
1161
  }, 5e3);
1378
1162
  try {
1379
- x.current.stop();
1380
- } catch (h) {
1381
- console.error("Error stopping MediaRecorder:", h), m && clearTimeout(m), S.current = [], x.current = null, u(null), I(!1), R(!1), a();
1163
+ b.current.stop();
1164
+ } catch (f) {
1165
+ console.error("Error stopping MediaRecorder:", f), h && clearTimeout(h), C.current = [], b.current = null, p(null), I(!1), R(!1), t();
1382
1166
  }
1383
1167
  } else
1384
- u(null), I(!1), R(!1), a();
1168
+ p(null), I(!1), R(!1), t();
1385
1169
  });
1386
- }, B = async () => {
1387
- if (!k)
1388
- if (y)
1389
- await O();
1170
+ }, L = async () => {
1171
+ if (!w)
1172
+ if (k)
1173
+ await $();
1390
1174
  else
1391
1175
  try {
1392
1176
  if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia)
1393
1177
  throw new Error("Browser doesn't support microphone access");
1394
- const a = await navigator.mediaDevices.getUserMedia({
1178
+ const t = await navigator.mediaDevices.getUserMedia({
1395
1179
  audio: {
1396
1180
  echoCancellation: !0,
1397
1181
  noiseSuppression: !0,
1398
1182
  sampleRate: 44100
1399
1183
  }
1400
- }), n = new MediaRecorder(a, {
1184
+ }), a = new MediaRecorder(t, {
1401
1185
  mimeType: MediaRecorder.isTypeSupported("audio/webm") ? "audio/webm" : "audio/mp4"
1402
1186
  });
1403
- x.current = n, S.current = [], n.ondataavailable = (h) => {
1404
- h.data.size > 0 && S.current.push(h.data);
1405
- }, n.start(200), F(!0), u(Date.now()), R(!0);
1406
- const m = setTimeout(async () => {
1407
- await O();
1187
+ b.current = a, C.current = [], a.ondataavailable = (f) => {
1188
+ f.data.size > 0 && C.current.push(f.data);
1189
+ }, a.start(200), F(!0), p(Date.now()), R(!0);
1190
+ const h = setTimeout(async () => {
1191
+ await $();
1408
1192
  }, 6e4);
1409
- D(m);
1410
- } catch (a) {
1411
- console.error("Microphone access error:", a), a instanceof Error && (a.name === "NotAllowedError" || a.name === "NotFoundError" || a.name === "NotReadableError" || a.name);
1193
+ D(h);
1194
+ } catch (t) {
1195
+ console.error("Microphone access error:", t), t instanceof Error && (t.name === "NotAllowedError" || t.name === "NotFoundError" || t.name === "NotReadableError" || t.name);
1412
1196
  }
1413
- }, E = (a) => {
1414
- if (a.preventDefault(), !!C.trim())
1197
+ }, B = (t) => {
1198
+ if (t.preventDefault(), !!S.trim())
1415
1199
  try {
1416
- if (r) {
1417
- const n = encodeURIComponent(C.trim()), m = `https://${r}.sampleapp.ai?q=${n}`;
1418
- window.open(m, "_blank");
1200
+ if (n) {
1201
+ const a = encodeURIComponent(S.trim()), h = `https://${n}.sampleapp.ai?q=${a}`;
1202
+ window.open(h, "_blank");
1419
1203
  }
1420
- i && i(a);
1421
- } catch (n) {
1422
- console.error("Submit error:", n);
1204
+ i && i(t);
1205
+ } catch (a) {
1206
+ console.error("Submit error:", a);
1423
1207
  }
1424
1208
  };
1425
- return /* @__PURE__ */ e("div", { children: /* @__PURE__ */ c(
1209
+ return /* @__PURE__ */ o("div", { children: /* @__PURE__ */ g(
1426
1210
  "div",
1427
1211
  {
1428
1212
  style: {
@@ -1434,11 +1218,11 @@ const ke = ({
1434
1218
  marginRight: "auto"
1435
1219
  },
1436
1220
  children: [
1437
- /* @__PURE__ */ e(
1221
+ /* @__PURE__ */ o(
1438
1222
  "div",
1439
1223
  {
1440
1224
  style: {
1441
- backgroundColor: $.shadow?.dark || "rgba(0, 0, 0, 0.2)",
1225
+ backgroundColor: H.shadow?.dark || "rgba(0, 0, 0, 0.2)",
1442
1226
  position: "absolute",
1443
1227
  top: "0",
1444
1228
  right: "0",
@@ -1452,11 +1236,11 @@ const ke = ({
1452
1236
  }
1453
1237
  }
1454
1238
  ),
1455
- /* @__PURE__ */ e(
1239
+ /* @__PURE__ */ o(
1456
1240
  "div",
1457
1241
  {
1458
1242
  style: {
1459
- background: $.gradient || Y.gradient,
1243
+ background: H.gradient || j.gradient,
1460
1244
  backgroundSize: "400% 400%",
1461
1245
  position: "absolute",
1462
1246
  top: "0",
@@ -1468,16 +1252,16 @@ const ke = ({
1468
1252
  filter: "blur(12px)",
1469
1253
  transition: "opacity 0.3s ease-in-out",
1470
1254
  pointerEvents: "none",
1471
- opacity: H ? "0.8" : "0.4",
1255
+ opacity: z ? "0.8" : "0.4",
1472
1256
  animation: "gradient-bg 5s ease infinite"
1473
1257
  }
1474
1258
  }
1475
1259
  ),
1476
- /* @__PURE__ */ e(
1260
+ /* @__PURE__ */ o(
1477
1261
  "div",
1478
1262
  {
1479
1263
  style: {
1480
- background: $.gradient || Y.gradient,
1264
+ background: H.gradient || j.gradient,
1481
1265
  backgroundSize: "400% 400%",
1482
1266
  position: "absolute",
1483
1267
  top: "0",
@@ -1488,12 +1272,12 @@ const ke = ({
1488
1272
  zIndex: 1,
1489
1273
  transition: "opacity 0.3s ease-in-out",
1490
1274
  pointerEvents: "none",
1491
- opacity: H ? "1" : "0.7",
1275
+ opacity: z ? "1" : "0.7",
1492
1276
  animation: "gradient-bg 5s ease infinite"
1493
1277
  }
1494
1278
  }
1495
1279
  ),
1496
- /* @__PURE__ */ e(
1280
+ /* @__PURE__ */ o(
1497
1281
  "div",
1498
1282
  {
1499
1283
  style: {
@@ -1508,8 +1292,8 @@ const ke = ({
1508
1292
  paddingTop: "0.5rem",
1509
1293
  paddingBottom: "0.5rem"
1510
1294
  },
1511
- children: /* @__PURE__ */ c("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
1512
- /* @__PURE__ */ c(
1295
+ children: /* @__PURE__ */ g("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
1296
+ /* @__PURE__ */ g(
1513
1297
  "div",
1514
1298
  {
1515
1299
  style: {
@@ -1522,7 +1306,7 @@ const ke = ({
1522
1306
  paddingBottom: "4px"
1523
1307
  },
1524
1308
  children: [
1525
- s.length > 0 ? /* @__PURE__ */ e(
1309
+ s.length > 0 ? /* @__PURE__ */ o(
1526
1310
  re,
1527
1311
  {
1528
1312
  texts: s,
@@ -1548,26 +1332,26 @@ const ke = ({
1548
1332
  marginTop: "4px",
1549
1333
  color: "#f4f4f5",
1550
1334
  fontFamily: "inherit",
1551
- height: b
1335
+ height: x
1552
1336
  },
1553
- value: C,
1554
- onFocus: P,
1555
- onBlur: Q,
1556
- onChange: (a) => W(a.target.value),
1557
- onSubmit: (a) => {
1558
- if (y || k) {
1559
- a.preventDefault();
1337
+ value: S,
1338
+ onFocus: Q,
1339
+ onBlur: K,
1340
+ onChange: (t) => P(t.target.value),
1341
+ onSubmit: (t) => {
1342
+ if (k || w) {
1343
+ t.preventDefault();
1560
1344
  return;
1561
1345
  }
1562
- E(a);
1346
+ B(t);
1563
1347
  },
1564
1348
  rows: 1
1565
1349
  }
1566
- ) : /* @__PURE__ */ e(
1350
+ ) : /* @__PURE__ */ o(
1567
1351
  G,
1568
1352
  {
1569
1353
  ref: v,
1570
- placeholder: t,
1354
+ placeholder: e,
1571
1355
  style: {
1572
1356
  flex: 1,
1573
1357
  width: "100%",
@@ -1589,56 +1373,46 @@ const ke = ({
1589
1373
  marginTop: "4px",
1590
1374
  color: "#f4f4f5",
1591
1375
  fontFamily: "inherit",
1592
- height: b
1376
+ height: x
1593
1377
  },
1594
- value: C,
1595
- onFocus: P,
1596
- onBlur: Q,
1597
- onChange: (a) => W(a.target.value),
1598
- onKeyDown: (a) => {
1599
- if (a.key === "Enter") {
1600
- if (a.shiftKey)
1378
+ value: S,
1379
+ onFocus: Q,
1380
+ onBlur: K,
1381
+ onChange: (t) => P(t.target.value),
1382
+ onKeyDown: (t) => {
1383
+ if (t.key === "Enter") {
1384
+ if (t.shiftKey)
1601
1385
  return;
1602
- a.preventDefault(), E(a);
1386
+ t.preventDefault(), B(t);
1603
1387
  }
1604
1388
  },
1605
1389
  rows: 1
1606
1390
  }
1607
1391
  ),
1608
- /* @__PURE__ */ c("div", { style: { display: "flex", flexDirection: "row", gap: "4px" }, children: [
1609
- /* @__PURE__ */ e(
1610
- ke,
1611
- {
1612
- isRecording: y,
1613
- isTranscribing: k,
1614
- onVoiceRecording: B
1615
- }
1616
- ),
1617
- /* @__PURE__ */ e(
1618
- J,
1619
- {
1620
- style: {
1621
- height: "32px",
1622
- width: "32px"
1623
- },
1624
- disabled: C.length === 0 || l,
1625
- variant: "secondary",
1626
- onClick: E,
1627
- size: "icon",
1628
- children: l ? /* @__PURE__ */ e(
1629
- xe,
1630
- {
1631
- size: 20,
1632
- style: { animation: "spin 1s linear infinite" }
1633
- }
1634
- ) : /* @__PURE__ */ e(be, { style: { width: "20px", height: "20px" } })
1635
- }
1636
- )
1637
- ] })
1392
+ /* @__PURE__ */ o("div", { style: { display: "flex", flexDirection: "row", gap: "4px" }, children: /* @__PURE__ */ o(
1393
+ te,
1394
+ {
1395
+ style: {
1396
+ height: "32px",
1397
+ width: "32px"
1398
+ },
1399
+ disabled: S.length === 0 || d,
1400
+ variant: "secondary",
1401
+ onClick: B,
1402
+ size: "icon",
1403
+ children: d ? /* @__PURE__ */ o(
1404
+ be,
1405
+ {
1406
+ size: 20,
1407
+ style: { animation: "spin 1s linear infinite" }
1408
+ }
1409
+ ) : /* @__PURE__ */ o(xe, { style: { width: "20px", height: "20px" } })
1410
+ }
1411
+ ) })
1638
1412
  ]
1639
1413
  }
1640
1414
  ),
1641
- /* @__PURE__ */ e(
1415
+ /* @__PURE__ */ o(
1642
1416
  "div",
1643
1417
  {
1644
1418
  style: {
@@ -1648,7 +1422,7 @@ const ke = ({
1648
1422
  paddingLeft: "8px",
1649
1423
  paddingRight: "8px"
1650
1424
  },
1651
- children: /* @__PURE__ */ e("div", { style: { display: "flex", alignItems: "center", gap: "4px" }, children: g && /* @__PURE__ */ e(
1425
+ children: /* @__PURE__ */ o("div", { style: { display: "flex", alignItems: "center", gap: "4px" }, children: m && /* @__PURE__ */ o(
1652
1426
  "div",
1653
1427
  {
1654
1428
  style: { display: "flex", alignItems: "center", gap: "8px" }
@@ -1659,7 +1433,7 @@ const ke = ({
1659
1433
  ] })
1660
1434
  }
1661
1435
  ),
1662
- /* @__PURE__ */ e("style", { children: `
1436
+ /* @__PURE__ */ o("style", { children: `
1663
1437
  @keyframes gradient-bg {
1664
1438
  0%,
1665
1439
  100% {
@@ -1682,20 +1456,20 @@ const ke = ({
1682
1456
  }
1683
1457
  ) });
1684
1458
  };
1685
- class ve {
1459
+ class ke {
1686
1460
  constructor() {
1687
- this.ModalSearchAndChat = (i, r) => {
1688
- const l = r || document.body, s = document.createElement("div");
1689
- s.id = "sampleapp-modal-" + Date.now(), l.appendChild(s);
1690
- const d = ee.createRoot(s), g = L.createElement(se, {
1461
+ this.ModalSearchAndChat = (i, n) => {
1462
+ const d = n || document.body, s = document.createElement("div");
1463
+ s.id = "sampleapp-modal-" + Date.now(), d.appendChild(s);
1464
+ const l = Z.createRoot(s), m = M.createElement(se, {
1691
1465
  settings: i,
1692
1466
  onClose: () => {
1693
- d.unmount(), s.remove();
1467
+ l.unmount(), s.remove();
1694
1468
  }
1695
1469
  });
1696
- return d.render(g), {
1470
+ return l.render(m), {
1697
1471
  unmount: () => {
1698
- d.unmount(), s.remove();
1472
+ l.unmount(), s.remove();
1699
1473
  },
1700
1474
  show: () => {
1701
1475
  s.style.display = "block";
@@ -1704,11 +1478,11 @@ class ve {
1704
1478
  s.style.display = "none";
1705
1479
  }
1706
1480
  };
1707
- }, this.ChatButton = (i, r) => {
1708
- const l = r || this.createButtonContainer(), s = ee.createRoot(l), d = L.createElement(ie, { settings: i });
1709
- return s.render(d), {
1481
+ }, this.ChatButton = (i, n) => {
1482
+ const d = n || this.createButtonContainer(), s = Z.createRoot(d), l = M.createElement(ie, { settings: i });
1483
+ return s.render(l), {
1710
1484
  unmount: () => {
1711
- s.unmount(), l.remove();
1485
+ s.unmount(), d.remove();
1712
1486
  }
1713
1487
  };
1714
1488
  };
@@ -1718,14 +1492,14 @@ class ve {
1718
1492
  return i.id = "sampleapp-button-" + Date.now(), document.body.appendChild(i), i;
1719
1493
  }
1720
1494
  }
1721
- const Ce = new ve();
1722
- typeof window < "u" && (window.SampleApp = Ce);
1495
+ const we = new ke();
1496
+ typeof window < "u" && (window.SampleApp = we);
1723
1497
  export {
1724
- Ie as ChatBar,
1498
+ Te as ChatBar,
1725
1499
  ie as ChatButton,
1726
- Re as DEFAULT_THEME,
1500
+ Ce as DEFAULT_THEME,
1727
1501
  se as ModalSearchAndChat,
1728
- Ce as default,
1729
- te as getTheme,
1502
+ we as default,
1503
+ ee as getTheme,
1730
1504
  me as themes
1731
1505
  };