@sampleapp.ai/sdk 1.0.24 → 1.0.26

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 m from "react";
2
- import { useState as u, useEffect as y } from "react";
3
- import * as g from "react-dom/client";
4
- import { jsxs as d, jsx as s, Fragment as h } from "react/jsx-runtime";
5
- const x = ({ settings: t, onClick: a }) => {
6
- const [r, i] = u(!1), o = () => {
7
- const n = new CustomEvent("chatButtonClick", {
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, d] = f(!1), s = () => {
7
+ const l = new CustomEvent("chatButtonClick", {
8
8
  detail: { settings: t }
9
9
  });
10
- document.dispatchEvent(n), a?.();
10
+ document.dispatchEvent(l), i?.();
11
11
  };
12
- return /* @__PURE__ */ d(
12
+ return /* @__PURE__ */ c(
13
13
  "button",
14
14
  {
15
15
  style: {
@@ -44,13 +44,13 @@ const x = ({ settings: t, onClick: a }) => {
44
44
  outline: "none",
45
45
  userSelect: "none"
46
46
  },
47
- onMouseEnter: () => i(!0),
48
- onMouseLeave: () => i(!1),
49
- onClick: o,
50
- onFocus: () => i(!0),
51
- onBlur: () => i(!1),
47
+ onMouseEnter: () => d(!0),
48
+ onMouseLeave: () => d(!1),
49
+ onClick: s,
50
+ onFocus: () => d(!0),
51
+ onBlur: () => d(!1),
52
52
  children: [
53
- t.aiChatSettings?.aiAssistantAvatar && /* @__PURE__ */ s(
53
+ t.aiChatSettings?.aiAssistantAvatar && /* @__PURE__ */ e(
54
54
  "img",
55
55
  {
56
56
  src: t.aiChatSettings.aiAssistantAvatar,
@@ -62,8 +62,8 @@ const x = ({ settings: t, onClick: a }) => {
62
62
  objectFit: "cover",
63
63
  flexShrink: 0
64
64
  },
65
- onError: (n) => {
66
- n.currentTarget.style.display = "none";
65
+ onError: (l) => {
66
+ l.currentTarget.style.display = "none";
67
67
  }
68
68
  }
69
69
  ),
@@ -71,28 +71,28 @@ const x = ({ settings: t, onClick: a }) => {
71
71
  ]
72
72
  }
73
73
  );
74
- }, b = ({
74
+ }, se = ({
75
75
  settings: t,
76
- onClose: a
76
+ onClose: i
77
77
  }) => {
78
- const [r, i] = u(!0), [o, n] = u(""), c = () => {
79
- i(!1), a?.();
80
- }, f = (e) => {
81
- n(e);
78
+ const [r, d] = f(!0), [s, l] = f(""), h = () => {
79
+ d(!1), i?.();
80
+ }, C = (n) => {
81
+ l(n);
82
82
  };
83
- return y(() => {
84
- const e = (p) => {
85
- p.key === "Escape" && c();
83
+ return M(() => {
84
+ const n = (b) => {
85
+ b.key === "Escape" && h();
86
86
  };
87
87
  if (r)
88
- return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
89
- }, [r]), y(() => {
88
+ return document.addEventListener("keydown", n), () => document.removeEventListener("keydown", n);
89
+ }, [r]), M(() => {
90
90
  if (r)
91
91
  return document.body.style.overflow = "hidden", () => {
92
92
  document.body.style.overflow = "";
93
93
  };
94
- }, [r]), r ? /* @__PURE__ */ d(h, { children: [
95
- /* @__PURE__ */ s(
94
+ }, [r]), r ? /* @__PURE__ */ c(z, { children: [
95
+ /* @__PURE__ */ e(
96
96
  "div",
97
97
  {
98
98
  style: {
@@ -106,10 +106,10 @@ const x = ({ settings: t, onClick: a }) => {
106
106
  zIndex: 999,
107
107
  animation: "fadeIn 0.2s ease-out"
108
108
  },
109
- onClick: c
109
+ onClick: h
110
110
  }
111
111
  ),
112
- /* @__PURE__ */ d(
112
+ /* @__PURE__ */ c(
113
113
  "div",
114
114
  {
115
115
  style: {
@@ -128,9 +128,9 @@ const x = ({ settings: t, onClick: a }) => {
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: (e) => e.stopPropagation(),
131
+ onClick: (n) => n.stopPropagation(),
132
132
  children: [
133
- /* @__PURE__ */ d(
133
+ /* @__PURE__ */ c(
134
134
  "div",
135
135
  {
136
136
  style: {
@@ -142,8 +142,8 @@ const x = ({ settings: t, onClick: a }) => {
142
142
  background: `linear-gradient(135deg, ${t.baseSettings.primaryBrandColor}10, ${t.baseSettings.primaryBrandColor}05)`
143
143
  },
144
144
  children: [
145
- /* @__PURE__ */ d("div", { style: { display: "flex", alignItems: "center", gap: "12px" }, children: [
146
- t.aiChatSettings?.aiAssistantAvatar && /* @__PURE__ */ s(
145
+ /* @__PURE__ */ c("div", { style: { display: "flex", alignItems: "center", gap: "12px" }, children: [
146
+ t.aiChatSettings?.aiAssistantAvatar && /* @__PURE__ */ e(
147
147
  "img",
148
148
  {
149
149
  src: t.aiChatSettings.aiAssistantAvatar,
@@ -154,12 +154,12 @@ const x = ({ settings: t, onClick: a }) => {
154
154
  borderRadius: "50%",
155
155
  objectFit: "cover"
156
156
  },
157
- onError: (e) => {
158
- e.currentTarget.style.display = "none";
157
+ onError: (n) => {
158
+ n.currentTarget.style.display = "none";
159
159
  }
160
160
  }
161
161
  ),
162
- /* @__PURE__ */ s(
162
+ /* @__PURE__ */ e(
163
163
  "h3",
164
164
  {
165
165
  style: {
@@ -173,10 +173,10 @@ const x = ({ settings: t, onClick: a }) => {
173
173
  }
174
174
  )
175
175
  ] }),
176
- /* @__PURE__ */ s(
176
+ /* @__PURE__ */ e(
177
177
  "button",
178
178
  {
179
- onClick: c,
179
+ onClick: h,
180
180
  style: {
181
181
  background: "none",
182
182
  border: "none",
@@ -190,11 +190,11 @@ const x = ({ settings: t, onClick: a }) => {
190
190
  justifyContent: "center",
191
191
  transition: "all 0.15s ease"
192
192
  },
193
- onMouseEnter: (e) => {
194
- e.currentTarget.style.backgroundColor = "#f1f5f9", e.currentTarget.style.color = "#334155";
193
+ onMouseEnter: (n) => {
194
+ n.currentTarget.style.backgroundColor = "#f1f5f9", n.currentTarget.style.color = "#334155";
195
195
  },
196
- onMouseLeave: (e) => {
197
- e.currentTarget.style.backgroundColor = "transparent", e.currentTarget.style.color = "#64748b";
196
+ onMouseLeave: (n) => {
197
+ n.currentTarget.style.backgroundColor = "transparent", n.currentTarget.style.color = "#64748b";
198
198
  },
199
199
  children: "×"
200
200
  }
@@ -202,7 +202,7 @@ const x = ({ settings: t, onClick: a }) => {
202
202
  ]
203
203
  }
204
204
  ),
205
- /* @__PURE__ */ d(
205
+ /* @__PURE__ */ c(
206
206
  "div",
207
207
  {
208
208
  style: {
@@ -211,14 +211,14 @@ const x = ({ settings: t, onClick: a }) => {
211
211
  overflowY: "auto"
212
212
  },
213
213
  children: [
214
- /* @__PURE__ */ d("div", { style: { position: "relative", marginBottom: "24px" }, children: [
215
- /* @__PURE__ */ s(
214
+ /* @__PURE__ */ c("div", { style: { position: "relative", marginBottom: "24px" }, children: [
215
+ /* @__PURE__ */ e(
216
216
  "input",
217
217
  {
218
218
  type: "text",
219
219
  placeholder: "Ask a question...",
220
- value: o,
221
- onChange: (e) => n(e.target.value),
220
+ value: s,
221
+ onChange: (n) => l(n.target.value),
222
222
  style: {
223
223
  width: "100%",
224
224
  padding: "14px 16px",
@@ -231,16 +231,16 @@ const x = ({ settings: t, onClick: a }) => {
231
231
  transition: "border-color 0.15s ease",
232
232
  backgroundColor: "#fafafa"
233
233
  },
234
- onFocus: (e) => {
235
- e.currentTarget.style.borderColor = t.baseSettings.primaryBrandColor, e.currentTarget.style.backgroundColor = "white";
234
+ onFocus: (n) => {
235
+ n.currentTarget.style.borderColor = t.baseSettings.primaryBrandColor, n.currentTarget.style.backgroundColor = "white";
236
236
  },
237
- onBlur: (e) => {
238
- e.currentTarget.style.borderColor = "#e2e8f0", e.currentTarget.style.backgroundColor = "#fafafa";
237
+ onBlur: (n) => {
238
+ n.currentTarget.style.borderColor = "#e2e8f0", n.currentTarget.style.backgroundColor = "#fafafa";
239
239
  },
240
240
  autoFocus: !0
241
241
  }
242
242
  ),
243
- /* @__PURE__ */ s(
243
+ /* @__PURE__ */ e(
244
244
  "button",
245
245
  {
246
246
  style: {
@@ -258,21 +258,21 @@ const x = ({ settings: t, onClick: a }) => {
258
258
  fontWeight: "500",
259
259
  transition: "opacity 0.15s ease"
260
260
  },
261
- onMouseEnter: (e) => {
262
- e.currentTarget.style.opacity = "0.9";
261
+ onMouseEnter: (n) => {
262
+ n.currentTarget.style.opacity = "0.9";
263
263
  },
264
- onMouseLeave: (e) => {
265
- e.currentTarget.style.opacity = "1";
264
+ onMouseLeave: (n) => {
265
+ n.currentTarget.style.opacity = "1";
266
266
  },
267
267
  onClick: () => {
268
- console.log("Search for:", o);
268
+ console.log("Search for:", s);
269
269
  },
270
270
  children: "Search"
271
271
  }
272
272
  )
273
273
  ] }),
274
- t.aiChatSettings?.exampleQuestions && t.aiChatSettings.exampleQuestions.length > 0 && /* @__PURE__ */ d("div", { children: [
275
- /* @__PURE__ */ s(
274
+ t.aiChatSettings?.exampleQuestions && t.aiChatSettings.exampleQuestions.length > 0 && /* @__PURE__ */ c("div", { children: [
275
+ /* @__PURE__ */ e(
276
276
  "p",
277
277
  {
278
278
  style: {
@@ -285,15 +285,15 @@ const x = ({ settings: t, onClick: a }) => {
285
285
  children: "Popular questions:"
286
286
  }
287
287
  ),
288
- /* @__PURE__ */ s(
288
+ /* @__PURE__ */ e(
289
289
  "div",
290
290
  {
291
291
  style: { display: "flex", flexDirection: "column", gap: "8px" },
292
292
  children: t.aiChatSettings.exampleQuestions.map(
293
- (e, p) => /* @__PURE__ */ s(
293
+ (n, b) => /* @__PURE__ */ e(
294
294
  "button",
295
295
  {
296
- onClick: () => f(e),
296
+ onClick: () => C(n),
297
297
  style: {
298
298
  display: "block",
299
299
  width: "100%",
@@ -309,15 +309,15 @@ const x = ({ settings: t, onClick: a }) => {
309
309
  transition: "all 0.15s ease",
310
310
  lineHeight: "1.4"
311
311
  },
312
- onMouseEnter: (l) => {
313
- l.currentTarget.style.backgroundColor = "#f8fafc", l.currentTarget.style.borderColor = t.baseSettings.primaryBrandColor, l.currentTarget.style.transform = "translateY(-1px)", l.currentTarget.style.boxShadow = "0 4px 12px rgba(0,0,0,0.1)";
312
+ onMouseEnter: (u) => {
313
+ u.currentTarget.style.backgroundColor = "#f8fafc", u.currentTarget.style.borderColor = t.baseSettings.primaryBrandColor, u.currentTarget.style.transform = "translateY(-1px)", u.currentTarget.style.boxShadow = "0 4px 12px rgba(0,0,0,0.1)";
314
314
  },
315
- onMouseLeave: (l) => {
316
- l.currentTarget.style.backgroundColor = "white", l.currentTarget.style.borderColor = "#e2e8f0", l.currentTarget.style.transform = "translateY(0)", l.currentTarget.style.boxShadow = "none";
315
+ onMouseLeave: (u) => {
316
+ u.currentTarget.style.backgroundColor = "white", u.currentTarget.style.borderColor = "#e2e8f0", u.currentTarget.style.transform = "translateY(0)", u.currentTarget.style.boxShadow = "none";
317
317
  },
318
- children: e
318
+ children: n
319
319
  },
320
- p
320
+ b
321
321
  )
322
322
  )
323
323
  }
@@ -329,7 +329,7 @@ const x = ({ settings: t, onClick: a }) => {
329
329
  ]
330
330
  }
331
331
  ),
332
- /* @__PURE__ */ s("style", { children: `
332
+ /* @__PURE__ */ e("style", { children: `
333
333
  @keyframes fadeIn {
334
334
  from { opacity: 0; }
335
335
  to { opacity: 1; }
@@ -347,47 +347,1383 @@ const x = ({ settings: t, onClick: a }) => {
347
347
  }
348
348
  ` })
349
349
  ] }) : null;
350
+ }, de = {
351
+ display: "flex",
352
+ minHeight: "60px",
353
+ width: "100%",
354
+ borderRadius: "6px",
355
+ border: "1px solid #e2e8f0",
356
+ backgroundColor: "transparent",
357
+ paddingLeft: "12px",
358
+ paddingRight: "12px",
359
+ paddingTop: "8px",
360
+ paddingBottom: "8px",
361
+ fontSize: "14px",
362
+ boxShadow: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
363
+ outline: "none",
364
+ fontFamily: "inherit",
365
+ resize: "vertical",
366
+ transition: "border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out"
367
+ }, le = {
368
+ borderColor: "#0f172a",
369
+ boxShadow: "0 0 0 1px #0f172a"
370
+ }, ce = "#64748b", q = L.forwardRef(
371
+ ({ style: t, onFocus: i, onBlur: r, ...d }, s) => {
372
+ const [l, h] = L.useState(!1), C = {
373
+ ...de,
374
+ ...l ? le : {},
375
+ ...t,
376
+ // Handle placeholder color via CSS custom property
377
+ // @ts-ignore - CSS custom properties are valid
378
+ "--placeholder-color": ce
379
+ };
380
+ return d.disabled && (C.cursor = "not-allowed", C.opacity = 0.5), /* @__PURE__ */ c(z, { children: [
381
+ /* @__PURE__ */ e("style", { children: `
382
+ .textarea-with-placeholder::placeholder {
383
+ color: var(--placeholder-color);
384
+ }
385
+ ` }),
386
+ /* @__PURE__ */ e(
387
+ "textarea",
388
+ {
389
+ className: "textarea-with-placeholder",
390
+ style: C,
391
+ ref: s,
392
+ onFocus: (u) => {
393
+ h(!0), i?.(u);
394
+ },
395
+ onBlur: (u) => {
396
+ h(!1), r?.(u);
397
+ },
398
+ ...d
399
+ }
400
+ )
401
+ ] });
402
+ }
403
+ );
404
+ q.displayName = "Textarea";
405
+ const pe = {
406
+ display: "inline-flex",
407
+ alignItems: "center",
408
+ justifyContent: "center",
409
+ gap: "0.5rem",
410
+ whiteSpace: "nowrap",
411
+ borderRadius: "15px",
412
+ fontSize: "14px",
413
+ fontWeight: "500",
414
+ transition: "all 0.15s ease-in-out",
415
+ outline: "none",
416
+ border: "none",
417
+ cursor: "pointer",
418
+ fontFamily: "inherit",
419
+ flexShrink: 0
420
+ }, ue = {
421
+ default: {
422
+ backgroundColor: "hsl(var(--sdk-primary, 240 5.9% 10%))",
423
+ color: "hsl(var(--sdk-primary-foreground, 0 0% 98%))",
424
+ boxShadow: "0 1px 2px 0 rgb(0 0 0 / 0.05)"
425
+ },
426
+ destructive: {
427
+ backgroundColor: "hsl(var(--sdk-destructive, 0 84.2% 60.2%))",
428
+ color: "hsl(var(--sdk-destructive-foreground, 0 0% 98%))",
429
+ boxShadow: "0 1px 2px 0 rgb(0 0 0 / 0.05)"
430
+ },
431
+ outline: {
432
+ border: "1px solid hsl(var(--sdk-border, 240 3.7% 25%))",
433
+ backgroundColor: "hsl(var(--sdk-secondary, 240 3.7% 15.9%))",
434
+ color: "hsl(var(--sdk-secondary-foreground, 0 0% 98%))",
435
+ boxShadow: "0 1px 2px 0 rgb(0 0 0 / 0.05)"
436
+ },
437
+ secondary: {
438
+ backgroundColor: "hsl(var(--sdk-secondary, 240 4.8% 95.9%))",
439
+ color: "hsl(var(--sdk-secondary-foreground, 240 5.9% 10%))",
440
+ boxShadow: "0 1px 2px 0 rgb(0 0 0 / 0.05)"
441
+ },
442
+ ghost: {
443
+ backgroundColor: "transparent",
444
+ color: "hsl(var(--sdk-foreground, 240 10% 3.9%))"
445
+ },
446
+ link: {
447
+ backgroundColor: "transparent",
448
+ color: "hsl(var(--sdk-primary, 240 5.9% 10%))",
449
+ textDecoration: "underline",
450
+ textUnderlineOffset: "4px"
451
+ },
452
+ ghostOutline: {
453
+ border: "1px solid hsl(var(--sdk-secondary, 240 4.8% 95.9%))",
454
+ backgroundColor: "transparent",
455
+ color: "hsl(var(--sdk-muted-foreground, 240 3.8% 46.1%))",
456
+ boxShadow: "0 1px 2px 0 rgb(0 0 0 / 0.05)"
457
+ }
458
+ }, fe = {
459
+ default: {
460
+ height: "36px",
461
+ paddingLeft: "16px",
462
+ paddingRight: "16px",
463
+ paddingTop: "8px",
464
+ paddingBottom: "8px"
465
+ },
466
+ sm: {
467
+ height: "32px",
468
+ paddingLeft: "12px",
469
+ paddingRight: "12px",
470
+ fontSize: "12px",
471
+ borderRadius: "6px"
472
+ },
473
+ lg: {
474
+ height: "40px",
475
+ paddingLeft: "32px",
476
+ paddingRight: "32px",
477
+ borderRadius: "6px"
478
+ },
479
+ icon: {
480
+ height: "32px",
481
+ width: "32px",
482
+ padding: "0"
483
+ }
484
+ }, he = (t) => {
485
+ switch (t) {
486
+ case "default":
487
+ return { backgroundColor: "hsl(var(--sdk-primary, 240 5.9% 10%) / 0.9)" };
488
+ case "destructive":
489
+ return {
490
+ backgroundColor: "hsl(var(--sdk-destructive, 0 84.2% 60.2%) / 0.9)"
491
+ };
492
+ case "outline":
493
+ return {
494
+ backgroundColor: "hsl(var(--sdk-secondary, 240 3.7% 15.9%) / 0.8)",
495
+ color: "hsl(var(--sdk-secondary-foreground, 0 0% 98%))"
496
+ };
497
+ case "secondary":
498
+ return {
499
+ backgroundColor: "hsl(var(--sdk-secondary, 240 4.8% 95.9%) / 0.7)"
500
+ };
501
+ case "ghost":
502
+ return {
503
+ backgroundColor: "hsl(var(--sdk-accent, 240 4.8% 95.9%))",
504
+ color: "hsl(var(--sdk-accent-foreground, 240 5.9% 10%))"
505
+ };
506
+ case "link":
507
+ return { textDecoration: "underline" };
508
+ case "ghostOutline":
509
+ return {
510
+ backgroundColor: "hsl(var(--sdk-accent, 240 4.8% 95.9%))",
511
+ color: "hsl(var(--sdk-foreground, 240 10% 3.9%))"
512
+ };
513
+ default:
514
+ return {};
515
+ }
516
+ }, ge = (t) => {
517
+ const i = {
518
+ outline: "1px solid hsl(var(--sdk-ring, 240 10% 3.9%))",
519
+ outlineOffset: "1px"
520
+ };
521
+ switch (t) {
522
+ case "outline":
523
+ return {
524
+ ...i,
525
+ backgroundColor: "hsl(var(--sdk-secondary, 240 3.7% 15.9%))",
526
+ color: "hsl(var(--sdk-secondary-foreground, 0 0% 98%))"
527
+ };
528
+ default:
529
+ return i;
530
+ }
531
+ }, G = L.forwardRef(
532
+ ({
533
+ variant: t = "default",
534
+ size: i = "default",
535
+ asChild: r = !1,
536
+ style: d,
537
+ onMouseEnter: s,
538
+ onMouseLeave: l,
539
+ onFocus: h,
540
+ onBlur: C,
541
+ onClick: n,
542
+ ...b
543
+ }, u) => {
544
+ const [H, A] = L.useState(!1), [y, F] = L.useState(!1), k = {
545
+ ...pe,
546
+ ...ue[t],
547
+ ...fe[i],
548
+ ...H ? he(t) : {},
549
+ ...y ? ge(t) : {},
550
+ ...d
551
+ // Allow style override
552
+ };
553
+ b.disabled && (k.pointerEvents = "none", k.opacity = 0.5, k.cursor = "not-allowed");
554
+ const I = (p) => {
555
+ A(!0), s?.(p);
556
+ }, R = (p) => {
557
+ A(!1), l?.(p);
558
+ }, w = (p) => {
559
+ F(!0), h?.(p);
560
+ }, D = (p) => {
561
+ F(!1), C?.(p);
562
+ }, j = (p) => {
563
+ setTimeout(() => {
564
+ p.currentTarget && p.currentTarget.blur();
565
+ }, 150), n?.(p);
566
+ };
567
+ return r && console.warn(
568
+ "asChild prop is not supported in the inline CSS version of Button."
569
+ ), /* @__PURE__ */ e(
570
+ "button",
571
+ {
572
+ style: k,
573
+ ref: u,
574
+ onMouseEnter: I,
575
+ onMouseLeave: R,
576
+ onFocus: w,
577
+ onBlur: D,
578
+ onClick: j,
579
+ ...b
580
+ }
581
+ );
582
+ }
583
+ );
584
+ G.displayName = "Button";
585
+ const me = {
586
+ ocean: {
587
+ primary: "#1ca0fb",
588
+ shadow: {
589
+ light: "#dbeafe",
590
+ // blue-100
591
+ dark: "#1e40af"
592
+ // blue-800
593
+ },
594
+ gradient: "radial-gradient(circle farthest-side at 0 100%, #00ccb1, transparent), radial-gradient(circle farthest-side at 100% 0, #7b61ff, transparent), radial-gradient(circle farthest-side at 100% 100%, #ffc414, transparent), radial-gradient(circle farthest-side at 0 0, #1ca0fb, #141316)",
595
+ placeholderText: {
596
+ light: "#60a5fa",
597
+ // blue-400
598
+ dark: "#93c5fd"
599
+ // blue-300
600
+ },
601
+ tabHint: {
602
+ text: {
603
+ light: "#1e40af",
604
+ // blue-800
605
+ dark: "#dbeafe"
606
+ // blue-100
607
+ },
608
+ bg: {
609
+ light: "#eff6ff",
610
+ // blue-50
611
+ dark: "#1e3a8a"
612
+ // blue-900
613
+ },
614
+ border: {
615
+ light: "#bfdbfe",
616
+ // blue-200
617
+ dark: "#1e40af"
618
+ // blue-800
619
+ }
620
+ }
621
+ },
622
+ autumn: {
623
+ primary: "#f97316",
624
+ shadow: {
625
+ light: "#fed7aa",
626
+ // orange-200
627
+ dark: "#c2410c"
628
+ // orange-700
629
+ },
630
+ gradient: "radial-gradient(circle farthest-side at 0 100%, #dc2626, transparent), radial-gradient(circle farthest-side at 100% 0, #f59e0b, transparent), radial-gradient(circle farthest-side at 100% 100%, #eab308, transparent), radial-gradient(circle farthest-side at 0 0, #f97316, #141316)",
631
+ placeholderText: {
632
+ light: "#fb923c",
633
+ // orange-400
634
+ dark: "#fdba74"
635
+ // orange-300
636
+ },
637
+ tabHint: {
638
+ text: {
639
+ light: "#c2410c",
640
+ // orange-700
641
+ dark: "#fed7aa"
642
+ // orange-200
643
+ },
644
+ bg: {
645
+ light: "#fff7ed",
646
+ // orange-50
647
+ dark: "#9a3412"
648
+ // orange-800
649
+ },
650
+ border: {
651
+ light: "#fde68a",
652
+ // yellow-200
653
+ dark: "#c2410c"
654
+ // orange-700
655
+ }
656
+ }
657
+ },
658
+ mint: {
659
+ primary: "#10b981",
660
+ shadow: {
661
+ light: "#a7f3d0",
662
+ // emerald-200
663
+ dark: "#047857"
664
+ // emerald-700
665
+ },
666
+ gradient: "radial-gradient(circle farthest-side at 0 100%, #059669, transparent), radial-gradient(circle farthest-side at 100% 0, #06b6d4, transparent), radial-gradient(circle farthest-side at 100% 100%, #10b981, transparent), radial-gradient(circle farthest-side at 0 0, #14b8a6, #141316)",
667
+ placeholderText: {
668
+ light: "#34d399",
669
+ // emerald-400
670
+ dark: "#6ee7b7"
671
+ // emerald-300
672
+ },
673
+ tabHint: {
674
+ text: {
675
+ light: "#047857",
676
+ // emerald-700
677
+ dark: "#a7f3d0"
678
+ // emerald-200
679
+ },
680
+ bg: {
681
+ light: "#ecfdf5",
682
+ // emerald-50
683
+ dark: "#064e3b"
684
+ // emerald-900
685
+ },
686
+ border: {
687
+ light: "#a7f3d0",
688
+ // emerald-200
689
+ dark: "#047857"
690
+ // emerald-700
691
+ }
692
+ }
693
+ },
694
+ sunset: {
695
+ primary: "#ec4899",
696
+ shadow: {
697
+ light: "#fce7f3",
698
+ // pink-100
699
+ dark: "#be185d"
700
+ // pink-700
701
+ },
702
+ gradient: "radial-gradient(circle farthest-side at 0 100%, #f59e0b, transparent), radial-gradient(circle farthest-side at 100% 0, #ec4899, transparent), radial-gradient(circle farthest-side at 100% 100%, #f97316, transparent), radial-gradient(circle farthest-side at 0 0, #ef4444, #141316)",
703
+ placeholderText: {
704
+ light: "#f472b6",
705
+ // pink-400
706
+ dark: "#f9a8d4"
707
+ // pink-300
708
+ },
709
+ tabHint: {
710
+ text: {
711
+ light: "#be185d",
712
+ // pink-700
713
+ dark: "#fce7f3"
714
+ // pink-100
715
+ },
716
+ bg: {
717
+ light: "#fdf2f8",
718
+ // pink-50
719
+ dark: "#831843"
720
+ // pink-900
721
+ },
722
+ border: {
723
+ light: "#fbcfe8",
724
+ // pink-200
725
+ dark: "#be185d"
726
+ // pink-700
727
+ }
728
+ }
729
+ },
730
+ lavender: {
731
+ primary: "#8b5cf6",
732
+ shadow: {
733
+ light: "#ddd6fe",
734
+ // violet-200
735
+ dark: "#5b21b6"
736
+ // violet-800
737
+ },
738
+ gradient: "radial-gradient(circle farthest-side at 0 100%, #6366f1, transparent), radial-gradient(circle farthest-side at 100% 0, #a855f7, transparent), radial-gradient(circle farthest-side at 100% 100%, #ec4899, transparent), radial-gradient(circle farthest-side at 0 0, #8b5cf6, #141316)",
739
+ placeholderText: {
740
+ light: "#a78bfa",
741
+ // violet-400
742
+ dark: "#c4b5fd"
743
+ // violet-300
744
+ },
745
+ tabHint: {
746
+ text: {
747
+ light: "#5b21b6",
748
+ // violet-800
749
+ dark: "#ddd6fe"
750
+ // violet-200
751
+ },
752
+ bg: {
753
+ light: "#f5f3ff",
754
+ // violet-50
755
+ dark: "#4c1d95"
756
+ // violet-900
757
+ },
758
+ border: {
759
+ light: "#ddd6fe",
760
+ // violet-200
761
+ dark: "#5b21b6"
762
+ // violet-800
763
+ }
764
+ }
765
+ },
766
+ forest: {
767
+ primary: "#16a34a",
768
+ shadow: {
769
+ light: "#bbf7d0",
770
+ // green-200
771
+ dark: "#15803d"
772
+ // green-700
773
+ },
774
+ gradient: "radial-gradient(circle farthest-side at 0 100%, #059669, transparent), radial-gradient(circle farthest-side at 100% 0, #16a34a, transparent), radial-gradient(circle farthest-side at 100% 100%, #65a30d, transparent), radial-gradient(circle farthest-side at 0 0, #166534, #141316)",
775
+ placeholderText: {
776
+ light: "#4ade80",
777
+ // green-400
778
+ dark: "#86efac"
779
+ // green-300
780
+ },
781
+ tabHint: {
782
+ text: {
783
+ light: "#15803d",
784
+ // green-700
785
+ dark: "#bbf7d0"
786
+ // green-200
787
+ },
788
+ bg: {
789
+ light: "#f0fdf4",
790
+ // green-50
791
+ dark: "#14532d"
792
+ // green-900
793
+ },
794
+ border: {
795
+ light: "#bbf7d0",
796
+ // green-200
797
+ dark: "#15803d"
798
+ // green-700
799
+ }
800
+ }
801
+ },
802
+ coral: {
803
+ primary: "#06b6d4",
804
+ shadow: {
805
+ light: "#a5f3fc",
806
+ // cyan-200
807
+ dark: "#0e7490"
808
+ // cyan-700
809
+ },
810
+ gradient: "radial-gradient(circle farthest-side at 0 100%, #0891b2, transparent), radial-gradient(circle farthest-side at 100% 0, #06b6d4, transparent), radial-gradient(circle farthest-side at 100% 100%, #0d9488, transparent), radial-gradient(circle farthest-side at 0 0, #0284c7, #141316)",
811
+ placeholderText: {
812
+ light: "#22d3ee",
813
+ // cyan-400
814
+ dark: "#67e8f9"
815
+ // cyan-300
816
+ },
817
+ tabHint: {
818
+ text: {
819
+ light: "#0e7490",
820
+ // cyan-700
821
+ dark: "#a5f3fc"
822
+ // cyan-200
823
+ },
824
+ bg: {
825
+ light: "#ecfeff",
826
+ // cyan-50
827
+ dark: "#164e63"
828
+ // cyan-900
829
+ },
830
+ border: {
831
+ light: "#a5f3fc",
832
+ // cyan-200
833
+ dark: "#0e7490"
834
+ // cyan-700
835
+ }
836
+ }
837
+ }
838
+ }, te = (t) => me[t || "ocean"], Re = "ocean", xe = ({
839
+ size: t = 20,
840
+ className: i = "",
841
+ style: r = {}
842
+ }) => /* @__PURE__ */ c(z, { children: [
843
+ /* @__PURE__ */ e("style", { children: `
844
+ @keyframes icon-spin {
845
+ from { transform: rotate(0deg); }
846
+ to { transform: rotate(360deg); }
847
+ }
848
+ ` }),
849
+ /* @__PURE__ */ e(
850
+ "svg",
851
+ {
852
+ xmlns: "http://www.w3.org/2000/svg",
853
+ width: t,
854
+ height: t,
855
+ viewBox: "0 0 24 24",
856
+ fill: "none",
857
+ stroke: "currentColor",
858
+ strokeWidth: "2",
859
+ strokeLinecap: "round",
860
+ strokeLinejoin: "round",
861
+ className: `lucide lucide-loader-circle ${i}`,
862
+ style: {
863
+ animation: "icon-spin 1s linear infinite",
864
+ ...r
865
+ },
866
+ children: /* @__PURE__ */ e("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
867
+ }
868
+ )
869
+ ] }), be = ({
870
+ size: t = 20,
871
+ className: i = "",
872
+ style: r = {}
873
+ }) => /* @__PURE__ */ c(
874
+ "svg",
875
+ {
876
+ xmlns: "http://www.w3.org/2000/svg",
877
+ width: t,
878
+ height: t,
879
+ viewBox: "0 0 24 24",
880
+ fill: "none",
881
+ stroke: "currentColor",
882
+ strokeWidth: "2",
883
+ strokeLinecap: "round",
884
+ strokeLinejoin: "round",
885
+ className: `lucide lucide-arrow-up ${i}`,
886
+ style: {
887
+ ...r
888
+ },
889
+ children: [
890
+ /* @__PURE__ */ e("path", { d: "m5 12 7-7 7 7" }),
891
+ /* @__PURE__ */ e("path", { d: "M12 19V5" })
892
+ ]
893
+ }
894
+ ), ye = ({
895
+ isRecording: t = !1,
896
+ isTranscribing: i = !1,
897
+ size: r = 20,
898
+ style: d = {}
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
+ ...d
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 l = Math.max(1, Math.floor(r * 0.075)), h = 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: `${h}px` }, children: [
1011
+ /* @__PURE__ */ e(
1012
+ "div",
1013
+ {
1014
+ style: {
1015
+ width: `${l}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: `${l}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: `${l}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: `${l}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: `${l}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(
1074
+ ({
1075
+ texts: t,
1076
+ typingSpeed: i = 30,
1077
+ deletingSpeed: r = 15,
1078
+ delayAfterText: d = 800,
1079
+ onSubmit: s,
1080
+ isStreaming: l = !1,
1081
+ className: h = "",
1082
+ placeholderClassName: C = "",
1083
+ value: n,
1084
+ onChange: b,
1085
+ onFocus: u,
1086
+ onBlur: H,
1087
+ onKeyDown: A,
1088
+ onPaste: y,
1089
+ placeholder: F,
1090
+ rows: k = 1,
1091
+ ...I
1092
+ }, R) => {
1093
+ const [w, D] = f(""), [j, p] = f(!1), [S, W] = f(0), [x, T] = f(!1), [v, N] = f(!1), [K, $] = f(!1), [P, Q] = f(!1), _ = U(null), O = R || _, B = t[S], E = n === "" || n === void 0;
1094
+ M(() => {
1095
+ if (!E) return;
1096
+ let o;
1097
+ return x ? (o = setTimeout(() => {
1098
+ T(!1), $(!0), N(!0), Q(!0);
1099
+ }, d), () => clearTimeout(o)) : K ? (o = setTimeout(() => {
1100
+ Q(!1), setTimeout(() => {
1101
+ N(!1), $(!1), p(!0);
1102
+ }, 300);
1103
+ }, 3e3), () => clearTimeout(o)) : (j ? w === "" ? (p(!1), W((m) => (m + 1) % t.length)) : o = setTimeout(() => {
1104
+ D((m) => m.slice(0, -1));
1105
+ }, r) : w === B ? T(!0) : o = setTimeout(() => {
1106
+ D(B.slice(0, w.length + 1));
1107
+ }, i), () => clearTimeout(o));
1108
+ }, [
1109
+ w,
1110
+ j,
1111
+ S,
1112
+ x,
1113
+ K,
1114
+ B,
1115
+ t,
1116
+ i,
1117
+ r,
1118
+ d,
1119
+ E
1120
+ ]);
1121
+ const a = (o) => {
1122
+ if (o.key === "Tab" && E) {
1123
+ o.preventDefault(), b?.({
1124
+ target: { value: B }
1125
+ });
1126
+ return;
1127
+ }
1128
+ if (o.key === "Enter") {
1129
+ if (o.shiftKey || (o.preventDefault(), l))
1130
+ return;
1131
+ s?.(o);
1132
+ }
1133
+ A?.(o);
1134
+ };
1135
+ return /* @__PURE__ */ c("div", { style: { position: "relative", width: "100%" }, children: [
1136
+ E && /* @__PURE__ */ e(
1137
+ "div",
1138
+ {
1139
+ style: {
1140
+ position: "absolute",
1141
+ top: 0,
1142
+ right: 0,
1143
+ bottom: 0,
1144
+ left: 0,
1145
+ pointerEvents: "none",
1146
+ display: "flex",
1147
+ alignItems: "flex-start",
1148
+ paddingLeft: "4px",
1149
+ paddingRight: "4px",
1150
+ paddingTop: "0",
1151
+ paddingBottom: "0",
1152
+ marginTop: "5px"
1153
+ },
1154
+ children: /* @__PURE__ */ c(
1155
+ "p",
1156
+ {
1157
+ style: {
1158
+ color: "#a1a1aa",
1159
+ fontWeight: "500",
1160
+ lineHeight: "1.25",
1161
+ ...C ? {} : {}
1162
+ },
1163
+ children: [
1164
+ w,
1165
+ /* @__PURE__ */ e(
1166
+ "span",
1167
+ {
1168
+ style: {
1169
+ fontSize: "12px",
1170
+ color: "#d1d5db",
1171
+ backgroundColor: "#27272a",
1172
+ paddingLeft: "6px",
1173
+ paddingRight: "6px",
1174
+ paddingTop: "2px",
1175
+ paddingBottom: "2px",
1176
+ borderRadius: "8px",
1177
+ border: "1px solid #3f3f46",
1178
+ alignItems: "center",
1179
+ marginLeft: "8px",
1180
+ display: "inline-flex",
1181
+ whiteSpace: "nowrap",
1182
+ opacity: P ? 1 : 0,
1183
+ transform: P ? "scale(1)" : "scale(0.8)",
1184
+ transition: "opacity 0.3s ease, transform 0.3s ease",
1185
+ visibility: v ? "visible" : "hidden",
1186
+ verticalAlign: "middle"
1187
+ },
1188
+ children: "Tab to select"
1189
+ }
1190
+ )
1191
+ ]
1192
+ }
1193
+ )
1194
+ }
1195
+ ),
1196
+ /* @__PURE__ */ e(
1197
+ q,
1198
+ {
1199
+ ref: O,
1200
+ placeholder: F,
1201
+ style: h ? {} : {},
1202
+ value: n,
1203
+ onFocus: u,
1204
+ onBlur: H,
1205
+ onChange: b,
1206
+ onKeyDown: a,
1207
+ onPaste: y,
1208
+ rows: k,
1209
+ ...I
1210
+ }
1211
+ )
1212
+ ] });
1213
+ }
1214
+ );
1215
+ re.displayName = "TypingTextarea";
1216
+ const ke = ({
1217
+ isRecording: t,
1218
+ isTranscribing: i,
1219
+ onVoiceRecording: r
1220
+ }) => /* @__PURE__ */ e(
1221
+ G,
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 = {
1254
+ gradient: "linear-gradient(45deg, #3b82f6, #8b5cf6, #ec4899)",
1255
+ shadow: {
1256
+ dark: "rgba(0, 0, 0, 0.2)"
1257
+ }
1258
+ }, we = (t, i) => {
1259
+ try {
1260
+ return t ? te(t) || Y : te() || Y;
1261
+ } catch (r) {
1262
+ return console.warn("Theme system error, using fallback:", r), Y;
1263
+ }
1264
+ }, Ie = ({
1265
+ placeholder: t = "Ask anything...",
1266
+ onSubmit: i,
1267
+ hasPendingEnv: r,
1268
+ playgroundUid: d,
1269
+ isSubmitting: s,
1270
+ typingTexts: l = [
1271
+ "Build me an AI chatbot application using OpenAI API",
1272
+ "Build me an ecommerce website using Stripe API",
1273
+ "Build me a price tracking tool using AgentQL API",
1274
+ "Build me a movie recommendation system using Qdrant API",
1275
+ "Build me a weather forecasting app using OpenWeather API",
1276
+ "Build me a SMS notification system using Twilio API",
1277
+ "Build me a travel booking platform using Skyscanner API"
1278
+ ],
1279
+ shouldFocusOnMount: h = !0,
1280
+ showModelSelector: C = !0,
1281
+ projectUid: n,
1282
+ theme: b,
1283
+ height: u = "auto"
1284
+ // Add default for required height prop
1285
+ }) => {
1286
+ const [H, A] = f(!0), [y, F] = f(!1), [k, I] = f(!1), [, R] = f(!1), [w, D] = f(null), [j, p] = f(
1287
+ null
1288
+ ), [S, W] = f(""), x = U(null), T = U([]), v = U(null), [N, K] = f(!1), $ = ne(() => {
1289
+ try {
1290
+ return we(b, d);
1291
+ } catch (a) {
1292
+ return console.warn("Error getting color scheme:", a), Y;
1293
+ }
1294
+ }, [b, d]);
1295
+ M(() => {
1296
+ K(!0);
1297
+ }, []), M(() => {
1298
+ if (h && v.current && N)
1299
+ try {
1300
+ v.current.focus(), v.current.select();
1301
+ } catch (a) {
1302
+ console.warn("Focus error:", a);
1303
+ }
1304
+ }, [N, h]);
1305
+ const P = () => {
1306
+ A(!0);
1307
+ }, Q = () => {
1308
+ A(!0);
1309
+ }, _ = () => {
1310
+ const a = v.current;
1311
+ if (a)
1312
+ try {
1313
+ a.style.height = "auto";
1314
+ const o = Math.min(a.scrollHeight, 200);
1315
+ a.style.height = `${o}px`;
1316
+ } catch (o) {
1317
+ console.warn("Textarea height adjustment error:", o);
1318
+ }
1319
+ };
1320
+ M(() => {
1321
+ _();
1322
+ }, [S]), M(() => {
1323
+ const a = (o) => {
1324
+ const m = (o.metaKey || o.ctrlKey) && o.key === "/", g = (o.key === "Enter" || o.key === "Escape") && (y || k);
1325
+ m ? (o.preventDefault(), B()) : g && (o.preventDefault(), y && !k && B());
1326
+ };
1327
+ return document.addEventListener("keydown", a), () => {
1328
+ document.removeEventListener("keydown", a);
1329
+ };
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 o = !1, m;
1338
+ x.current.ondataavailable = (g) => {
1339
+ g.data.size > 0 && (o = !0, T.current.push(g.data));
1340
+ }, x.current.onstop = async () => {
1341
+ m && clearTimeout(m);
1342
+ try {
1343
+ if (!o || T.current.length === 0)
1344
+ throw new Error("No audio data recorded");
1345
+ const g = new Blob(T.current, {
1346
+ type: "audio/wav"
1347
+ });
1348
+ if (g.size < 1024)
1349
+ throw new Error("Audio recording too short");
1350
+ const J = new FormData();
1351
+ J.append("audio", g, "recording.wav");
1352
+ const X = await fetch("/api/voice/transcribe", {
1353
+ method: "POST",
1354
+ body: J
1355
+ });
1356
+ if (X.ok) {
1357
+ const { transcription: V } = await X.json();
1358
+ if (V && V.trim()) {
1359
+ const ae = S ? `${S} ${V}` : V;
1360
+ W(ae.trim()), setTimeout(() => {
1361
+ if (v.current) {
1362
+ v.current.focus();
1363
+ const Z = v.current.value.length;
1364
+ v.current.setSelectionRange(Z, Z);
1365
+ }
1366
+ }, 100);
1367
+ }
1368
+ } else
1369
+ throw new Error("Transcription failed");
1370
+ } catch (g) {
1371
+ console.error("Transcription error:", g), g instanceof Error && (g.message.includes("No audio data") || g.message.includes("too short"));
1372
+ } finally {
1373
+ T.current = [], x.current = null, p(null), I(!1), R(!1), a();
1374
+ }
1375
+ }, m = setTimeout(() => {
1376
+ console.warn("MediaRecorder stop timeout, forcing cleanup"), T.current = [], x.current = null, p(null), I(!1), R(!1), a();
1377
+ }, 5e3);
1378
+ try {
1379
+ x.current.stop();
1380
+ } catch (g) {
1381
+ console.error("Error stopping MediaRecorder:", g), m && clearTimeout(m), T.current = [], x.current = null, p(null), I(!1), R(!1), a();
1382
+ }
1383
+ } else
1384
+ p(null), I(!1), R(!1), a();
1385
+ });
1386
+ }, B = async () => {
1387
+ if (!k)
1388
+ if (y)
1389
+ await O();
1390
+ else
1391
+ try {
1392
+ if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia)
1393
+ throw new Error("Browser doesn't support microphone access");
1394
+ const a = await navigator.mediaDevices.getUserMedia({
1395
+ audio: {
1396
+ echoCancellation: !0,
1397
+ noiseSuppression: !0,
1398
+ sampleRate: 44100
1399
+ }
1400
+ }), o = new MediaRecorder(a, {
1401
+ mimeType: MediaRecorder.isTypeSupported("audio/webm") ? "audio/webm" : "audio/mp4"
1402
+ });
1403
+ x.current = o, T.current = [], o.ondataavailable = (g) => {
1404
+ g.data.size > 0 && T.current.push(g.data);
1405
+ }, o.start(200), F(!0), p(Date.now()), R(!0);
1406
+ const m = setTimeout(async () => {
1407
+ await O();
1408
+ }, 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);
1412
+ }
1413
+ }, E = (a) => {
1414
+ if (a.preventDefault(), !!S.trim())
1415
+ try {
1416
+ if (d) {
1417
+ const o = encodeURIComponent(S.trim()), m = `https://${d}.sampleapp.ai?q=${o}`;
1418
+ window.open(m, "_blank");
1419
+ }
1420
+ i && i(a);
1421
+ } catch (o) {
1422
+ console.error("Submit error:", o);
1423
+ }
1424
+ };
1425
+ return /* @__PURE__ */ e("div", { children: /* @__PURE__ */ c(
1426
+ "div",
1427
+ {
1428
+ style: {
1429
+ position: "relative",
1430
+ padding: "2px",
1431
+ width: "100%",
1432
+ maxWidth: "100%",
1433
+ marginLeft: "auto",
1434
+ marginRight: "auto"
1435
+ },
1436
+ children: [
1437
+ /* @__PURE__ */ e(
1438
+ "div",
1439
+ {
1440
+ style: {
1441
+ backgroundColor: $.shadow?.dark || "rgba(0, 0, 0, 0.2)",
1442
+ position: "absolute",
1443
+ top: "0",
1444
+ right: "0",
1445
+ bottom: "0",
1446
+ left: "0",
1447
+ borderRadius: "0.85rem",
1448
+ transition: "opacity 0.3s ease-in-out",
1449
+ boxShadow: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",
1450
+ opacity: "1",
1451
+ pointerEvents: "none"
1452
+ }
1453
+ }
1454
+ ),
1455
+ /* @__PURE__ */ e(
1456
+ "div",
1457
+ {
1458
+ style: {
1459
+ background: $.gradient || Y.gradient,
1460
+ backgroundSize: "400% 400%",
1461
+ position: "absolute",
1462
+ top: "0",
1463
+ right: "0",
1464
+ bottom: "0",
1465
+ left: "0",
1466
+ borderRadius: "0.85rem",
1467
+ zIndex: 1,
1468
+ filter: "blur(12px)",
1469
+ transition: "opacity 0.3s ease-in-out",
1470
+ pointerEvents: "none",
1471
+ opacity: H ? "0.8" : "0.4",
1472
+ animation: "gradient-bg 5s ease infinite"
1473
+ }
1474
+ }
1475
+ ),
1476
+ /* @__PURE__ */ e(
1477
+ "div",
1478
+ {
1479
+ style: {
1480
+ background: $.gradient || Y.gradient,
1481
+ backgroundSize: "400% 400%",
1482
+ position: "absolute",
1483
+ top: "0",
1484
+ right: "0",
1485
+ bottom: "0",
1486
+ left: "0",
1487
+ borderRadius: "0.85rem",
1488
+ zIndex: 1,
1489
+ transition: "opacity 0.3s ease-in-out",
1490
+ pointerEvents: "none",
1491
+ opacity: H ? "1" : "0.7",
1492
+ animation: "gradient-bg 5s ease infinite"
1493
+ }
1494
+ }
1495
+ ),
1496
+ /* @__PURE__ */ e(
1497
+ "div",
1498
+ {
1499
+ style: {
1500
+ position: "relative",
1501
+ zIndex: 10,
1502
+ borderRadius: "0.75rem",
1503
+ backgroundColor: "rgb(24, 24, 27)",
1504
+ // zinc-900 equivalent
1505
+ width: "100%",
1506
+ paddingLeft: "0.25rem",
1507
+ paddingRight: "0.25rem",
1508
+ paddingTop: "0.5rem",
1509
+ paddingBottom: "0.5rem"
1510
+ },
1511
+ children: /* @__PURE__ */ c("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
1512
+ /* @__PURE__ */ c(
1513
+ "div",
1514
+ {
1515
+ style: {
1516
+ position: "relative",
1517
+ display: "flex",
1518
+ paddingLeft: "8px",
1519
+ paddingRight: "8px",
1520
+ gap: "8px",
1521
+ paddingTop: "4px",
1522
+ paddingBottom: "4px"
1523
+ },
1524
+ children: [
1525
+ l.length > 0 ? /* @__PURE__ */ e(
1526
+ re,
1527
+ {
1528
+ texts: l,
1529
+ ref: v,
1530
+ style: {
1531
+ flex: 1,
1532
+ width: "100%",
1533
+ border: "none",
1534
+ boxShadow: "none",
1535
+ outline: "none",
1536
+ paddingLeft: "4px",
1537
+ paddingRight: "4px",
1538
+ resize: "none",
1539
+ fontSize: "16px",
1540
+ overflow: "hidden",
1541
+ backgroundColor: "transparent",
1542
+ display: "block",
1543
+ paddingTop: "0",
1544
+ paddingBottom: "0",
1545
+ lineHeight: "1.5",
1546
+ overflowY: "auto",
1547
+ maxHeight: "192px",
1548
+ marginTop: "4px",
1549
+ color: "#f4f4f5",
1550
+ fontFamily: "inherit"
1551
+ },
1552
+ value: S,
1553
+ onFocus: P,
1554
+ onBlur: Q,
1555
+ onChange: (a) => W(a.target.value),
1556
+ onSubmit: (a) => {
1557
+ if (y || k) {
1558
+ a.preventDefault();
1559
+ return;
1560
+ }
1561
+ E(a);
1562
+ },
1563
+ rows: 1
1564
+ }
1565
+ ) : /* @__PURE__ */ e(
1566
+ q,
1567
+ {
1568
+ ref: v,
1569
+ placeholder: t,
1570
+ style: {
1571
+ flex: 1,
1572
+ width: "100%",
1573
+ border: "none",
1574
+ boxShadow: "none",
1575
+ outline: "none",
1576
+ paddingLeft: "4px",
1577
+ paddingRight: "4px",
1578
+ resize: "none",
1579
+ fontSize: "16px",
1580
+ overflow: "hidden",
1581
+ backgroundColor: "transparent",
1582
+ display: "block",
1583
+ paddingTop: "0",
1584
+ paddingBottom: "0",
1585
+ lineHeight: "1.5",
1586
+ overflowY: "auto",
1587
+ maxHeight: "192px",
1588
+ marginTop: "4px",
1589
+ color: "#f4f4f5",
1590
+ fontFamily: "inherit"
1591
+ },
1592
+ value: S,
1593
+ onFocus: P,
1594
+ onBlur: Q,
1595
+ onChange: (a) => W(a.target.value),
1596
+ onKeyDown: (a) => {
1597
+ if (a.key === "Enter") {
1598
+ if (a.shiftKey)
1599
+ return;
1600
+ a.preventDefault(), E(a);
1601
+ }
1602
+ },
1603
+ rows: 1
1604
+ }
1605
+ ),
1606
+ /* @__PURE__ */ c("div", { style: { display: "flex", flexDirection: "row", gap: "4px" }, children: [
1607
+ /* @__PURE__ */ e(
1608
+ ke,
1609
+ {
1610
+ isRecording: y,
1611
+ isTranscribing: k,
1612
+ onVoiceRecording: B
1613
+ }
1614
+ ),
1615
+ /* @__PURE__ */ e(
1616
+ G,
1617
+ {
1618
+ style: {
1619
+ height: "32px",
1620
+ width: "32px"
1621
+ },
1622
+ disabled: S.length === 0 || s || r,
1623
+ variant: "secondary",
1624
+ onClick: E,
1625
+ size: "icon",
1626
+ children: s ? /* @__PURE__ */ e(
1627
+ xe,
1628
+ {
1629
+ size: 20,
1630
+ style: { animation: "spin 1s linear infinite" }
1631
+ }
1632
+ ) : /* @__PURE__ */ e(be, { style: { width: "20px", height: "20px" } })
1633
+ }
1634
+ )
1635
+ ] })
1636
+ ]
1637
+ }
1638
+ ),
1639
+ /* @__PURE__ */ e(
1640
+ "div",
1641
+ {
1642
+ style: {
1643
+ display: "flex",
1644
+ alignItems: "center",
1645
+ justifyContent: "space-between",
1646
+ paddingLeft: "8px",
1647
+ paddingRight: "8px"
1648
+ },
1649
+ children: /* @__PURE__ */ e("div", { style: { display: "flex", alignItems: "center", gap: "4px" }, children: C && /* @__PURE__ */ e(
1650
+ "div",
1651
+ {
1652
+ style: { display: "flex", alignItems: "center", gap: "8px" }
1653
+ }
1654
+ ) })
1655
+ }
1656
+ )
1657
+ ] })
1658
+ }
1659
+ ),
1660
+ /* @__PURE__ */ e("style", { children: `
1661
+ @keyframes gradient-bg {
1662
+ 0%,
1663
+ 100% {
1664
+ background-position: 0% 50%;
1665
+ }
1666
+ 50% {
1667
+ background-position: 100% 50%;
1668
+ }
1669
+ }
1670
+ @keyframes spin {
1671
+ from {
1672
+ transform: rotate(0deg);
1673
+ }
1674
+ to {
1675
+ transform: rotate(360deg);
1676
+ }
1677
+ }
1678
+ ` })
1679
+ ]
1680
+ }
1681
+ ) });
350
1682
  };
351
- class C {
1683
+ class ve {
352
1684
  constructor() {
353
- this.ModalSearchAndChat = (a, r) => {
354
- const i = r || document.body, o = document.createElement("div");
355
- o.id = "sampleapp-modal-" + Date.now(), i.appendChild(o);
356
- const n = g.createRoot(o), c = m.createElement(b, {
357
- settings: a,
1685
+ this.ModalSearchAndChat = (i, r) => {
1686
+ const d = r || document.body, s = document.createElement("div");
1687
+ s.id = "sampleapp-modal-" + Date.now(), d.appendChild(s);
1688
+ const l = ee.createRoot(s), h = L.createElement(se, {
1689
+ settings: i,
358
1690
  onClose: () => {
359
- n.unmount(), o.remove();
1691
+ l.unmount(), s.remove();
360
1692
  }
361
1693
  });
362
- return n.render(c), {
1694
+ return l.render(h), {
363
1695
  unmount: () => {
364
- n.unmount(), o.remove();
1696
+ l.unmount(), s.remove();
365
1697
  },
366
1698
  show: () => {
367
- o.style.display = "block";
1699
+ s.style.display = "block";
368
1700
  },
369
1701
  hide: () => {
370
- o.style.display = "none";
1702
+ s.style.display = "none";
371
1703
  }
372
1704
  };
373
- }, this.ChatButton = (a, r) => {
374
- const i = r || this.createButtonContainer(), o = g.createRoot(i), n = m.createElement(x, { settings: a });
375
- return o.render(n), {
1705
+ }, this.ChatButton = (i, r) => {
1706
+ const d = r || this.createButtonContainer(), s = ee.createRoot(d), l = L.createElement(ie, { settings: i });
1707
+ return s.render(l), {
376
1708
  unmount: () => {
377
- o.unmount(), i.remove();
1709
+ s.unmount(), d.remove();
378
1710
  }
379
1711
  };
380
1712
  };
381
1713
  }
382
1714
  createButtonContainer() {
383
- const a = document.createElement("div");
384
- return a.id = "sampleapp-button-" + Date.now(), document.body.appendChild(a), a;
1715
+ const i = document.createElement("div");
1716
+ return i.id = "sampleapp-button-" + Date.now(), document.body.appendChild(i), i;
385
1717
  }
386
1718
  }
387
- const S = new C();
388
- typeof window < "u" && (window.SampleApp = S);
1719
+ const Ce = new ve();
1720
+ typeof window < "u" && (window.SampleApp = Ce);
389
1721
  export {
390
- x as ChatButton,
391
- b as ModalSearchAndChat,
392
- S as default
1722
+ Ie as ChatBar,
1723
+ ie as ChatButton,
1724
+ Re as DEFAULT_THEME,
1725
+ se as ModalSearchAndChat,
1726
+ Ce as default,
1727
+ te as getTheme,
1728
+ me as themes
393
1729
  };