@chaibuilder/pages 0.16.13 → 0.16.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/dist/{2AITGKQY-D1mM4eEh.js → 2AITGKQY-2rt9M99C.js} +5 -5
  2. package/dist/{2AITGKQY-AK2WgbeT.cjs → 2AITGKQY-Cs6RBSPQ.cjs} +1 -1
  3. package/dist/{NCMVHL6D-DItDf9IY.cjs → NCMVHL6D-CsC6nsSQ.cjs} +1 -1
  4. package/dist/{NCMVHL6D-BeRsWdGV.js → NCMVHL6D-vUfYKc6i.js} +2 -2
  5. package/dist/{ZDWCUMSJ-COSBY-at.cjs → ZDWCUMSJ-B2OZjsr6.cjs} +1 -1
  6. package/dist/{ZDWCUMSJ-D6caRaY7.js → ZDWCUMSJ-CzEWKlEU.js} +1 -1
  7. package/dist/active-in-another-tab-B0N5S-Bh.js +34 -0
  8. package/dist/active-in-another-tab-BK3cZf-x.cjs +1 -0
  9. package/dist/{add-new-language-page-CQcFi0Tp.cjs → add-new-language-page-Dt1j-8Zg.cjs} +1 -1
  10. package/dist/{add-new-language-page-nnaUe-qk.js → add-new-language-page-YlqcCdlK.js} +20 -20
  11. package/dist/{add-new-page-DxObnvo_.cjs → add-new-page-DqhQUQBz.cjs} +1 -1
  12. package/dist/{add-new-page-Ba1fq6LH.js → add-new-page-aYomeid4.js} +1 -1
  13. package/dist/ai-panel-content-C6cH9rrC.js +123 -0
  14. package/dist/ai-panel-content-MOZmNIKP.cjs +1 -0
  15. package/dist/ai-panel-default-lang-BZHkFsox.js +317 -0
  16. package/dist/ai-panel-default-lang-DOk_Q0IO.cjs +3 -0
  17. package/dist/{ai-panel-other-lang-B4euTuod.js → ai-panel-other-lang-D2A46FTg.js} +10 -9
  18. package/dist/ai-panel-other-lang-qHrdvAMa.cjs +1 -0
  19. package/dist/ai-prompt-input-BZSjjNJd.cjs +1 -0
  20. package/dist/ai-prompt-input-C6gDvvLQ.js +1071 -0
  21. package/dist/{ai-translation-prompt-Ip7w2_Ey.cjs → ai-translation-prompt-BqXo2CLp.cjs} +1 -1
  22. package/dist/{ai-translation-prompt-CVuPbgXw.js → ai-translation-prompt-DTR0wbGt.js} +1 -1
  23. package/dist/continue-editing-in-this-client-C3T6Jzhi.cjs +1 -0
  24. package/dist/continue-editing-in-this-client-D2S1yCOM.js +24 -0
  25. package/dist/delete-page-BF1k60U2.js +70 -0
  26. package/dist/delete-page-x0DWKzsR.cjs +1 -0
  27. package/dist/{digital-asset-manager-CIMo79Di.cjs → digital-asset-manager-BmlFt2T_.cjs} +1 -1
  28. package/dist/{digital-asset-manager-SAFNO_mx.js → digital-asset-manager-C8udwDBW.js} +1 -1
  29. package/dist/{duplicate-page-CXK2HcxD.cjs → duplicate-page-Dt_QZkTk.cjs} +1 -1
  30. package/dist/{duplicate-page-5SwLvmkX.js → duplicate-page-u_6vUVo1.js} +7 -7
  31. package/dist/{dynamic-page-selector-Crd3y4Hk.cjs → dynamic-page-selector-Cgs_Y_Kl.cjs} +1 -1
  32. package/dist/{dynamic-page-selector-DfcuTqRN.js → dynamic-page-selector-DxBHmglP.js} +1 -1
  33. package/dist/index-BeWL6Sj6.cjs +5 -0
  34. package/dist/index-DI2Rwk5v.js +4820 -0
  35. package/dist/index.cjs +1 -1
  36. package/dist/index.d.ts +1 -34
  37. package/dist/index.js +21 -22
  38. package/dist/{json-diff-viewer-D34kDA_c.cjs → json-diff-viewer-D2g0Yab2.cjs} +1 -1
  39. package/dist/{json-diff-viewer-CDwpbuag.js → json-diff-viewer-QdUwk7yF.js} +6 -6
  40. package/dist/{lang-panel-CUIeO5bb.js → lang-panel-B8OD0GiA.js} +24 -24
  41. package/dist/{lang-panel-CaFrYllL.cjs → lang-panel-M2Zb01lF.cjs} +1 -1
  42. package/dist/{mark-as-template-D0dLQaIB.js → mark-as-template-CJ1mlxYT.js} +7 -7
  43. package/dist/{mark-as-template-v182tmN6.cjs → mark-as-template-DONU52b1.cjs} +1 -1
  44. package/dist/{no-language-page-content-Bk4fEx_p.cjs → no-language-page-content-DD9Ok2Ku.cjs} +1 -1
  45. package/dist/{no-language-page-content-ByRFD_qA.js → no-language-page-content-Dtm37LTJ.js} +1 -1
  46. package/dist/no-language-page-dialog-D3dvenZ7.cjs +1 -0
  47. package/dist/no-language-page-dialog-Dj_z2_hF.js +10 -0
  48. package/dist/{page-creator-Bh0IUGR3.js → page-creator-DIMFISo4.js} +52 -52
  49. package/dist/{page-creator-BnvaGZVI.cjs → page-creator-DTC66ujU.cjs} +1 -1
  50. package/dist/page-lock-CI6BYvF_.cjs +1 -0
  51. package/dist/page-lock-DUlNr3os.js +30 -0
  52. package/dist/page-locked-dialog-BKwULMV7.js +133 -0
  53. package/dist/page-locked-dialog-DorIbva0.cjs +1 -0
  54. package/dist/page-manager-new-lNVrLOJp.cjs +1 -0
  55. package/dist/page-manager-new-znvqI9_L.js +354 -0
  56. package/dist/{page-manager-search-and-filter-BETHSa3y.js → page-manager-search-and-filter-C-_w7N27.js} +1 -1
  57. package/dist/{page-manager-search-and-filter-hyUIHOD_.cjs → page-manager-search-and-filter-pe0q0qnZ.cjs} +1 -1
  58. package/dist/{page-revisions-content-BCMjvZRZ.cjs → page-revisions-content-Caaj5TEI.cjs} +1 -1
  59. package/dist/{page-revisions-content-VWthKL7O.js → page-revisions-content-CyLjyxNU.js} +16 -16
  60. package/dist/pages.css +1 -1
  61. package/dist/publish-pages-content-Bih1W9C4.js +178 -0
  62. package/dist/publish-pages-content-D5beVcQI.cjs +1 -0
  63. package/dist/{save-to-lib-YYBxY7MV.js → save-to-lib-BwpkJcT2.js} +1 -1
  64. package/dist/{save-to-lib-CtGpDkC6.cjs → save-to-lib-DPAERsi4.cjs} +1 -1
  65. package/dist/{selected-block-display-DdW-DWF1.js → selected-block-display-GXSf3y2s.js} +1 -1
  66. package/dist/{selected-block-display-BEbuJn0l.cjs → selected-block-display-s99Y91qI.cjs} +1 -1
  67. package/dist/{seo-panel-CqJDhbj-.js → seo-panel-BurZA566.js} +61 -61
  68. package/dist/{seo-panel-B9P7fXjo.cjs → seo-panel-BxUfalVy.cjs} +1 -1
  69. package/dist/server.cjs +1 -1
  70. package/dist/server.js +39 -39
  71. package/dist/{shared-json-ld-CyxmC9y5.cjs → shared-json-ld-BYAdrPeC.cjs} +1 -1
  72. package/dist/{shared-json-ld-DxEPILj_.js → shared-json-ld-DHWdJvQd.js} +39 -39
  73. package/dist/{slug-input-RNiSrU3p.cjs → slug-input-CR2B1kDJ.cjs} +1 -1
  74. package/dist/{slug-input-j5z5ZQn9.js → slug-input-Z_ny7bgX.js} +1 -1
  75. package/dist/take-over-request-CnEpToCM.cjs +1 -0
  76. package/dist/take-over-request-DF2JsIes.js +63 -0
  77. package/dist/{theme-panel-footer-DD2yalfG.js → theme-panel-footer-5mxFeEua.js} +4 -4
  78. package/dist/{theme-panel-footer-CCsiDIVl.cjs → theme-panel-footer-C2CjHoBu.cjs} +1 -1
  79. package/dist/{unmark-as-template-DXjLbqOM.cjs → unmark-as-template-Dn90g1eh.cjs} +1 -1
  80. package/dist/{unmark-as-template-B2hKhAHn.js → unmark-as-template-JRRUYTOY.js} +1 -1
  81. package/dist/{unpublish-page-BdJScWMX.cjs → unpublish-page-C3C_rTRd.cjs} +1 -1
  82. package/dist/{unpublish-page-BvB1PGSz.js → unpublish-page-FZ8rbi7u.js} +9 -9
  83. package/dist/{web-preview-CwVpkcwU.js → web-preview-CGBKG162.js} +1 -1
  84. package/dist/{web-preview-BI4jd0O7.cjs → web-preview-NdxC92Fk.cjs} +1 -1
  85. package/package.json +3 -3
  86. package/dist/ai-panel-content-B2AgBWqo.cjs +0 -1
  87. package/dist/ai-panel-content-M1UnzG_f.js +0 -54
  88. package/dist/ai-panel-default-lang-CHOFEwmV.js +0 -313
  89. package/dist/ai-panel-default-lang-sy6vkQJh.cjs +0 -3
  90. package/dist/ai-panel-other-lang-BwjSDD3L.cjs +0 -1
  91. package/dist/ai-prompt-input-B_NRADBT.js +0 -988
  92. package/dist/ai-prompt-input-DcyVXcLG.cjs +0 -1
  93. package/dist/delete-page-CbY8q5M3.cjs +0 -1
  94. package/dist/delete-page-SX9X35nA.js +0 -40
  95. package/dist/index-Bz7smSC0.cjs +0 -5
  96. package/dist/index-EnM7J19_.js +0 -4960
  97. package/dist/page-lock-request-C2b1kqyA.cjs +0 -1
  98. package/dist/page-lock-request-CaNqxfD6.js +0 -75
  99. package/dist/page-locked-by-dialog--WLDdkw9.js +0 -68
  100. package/dist/page-locked-by-dialog-90ElC8aG.cjs +0 -1
  101. package/dist/page-manager-new-Bo4-zwfW.js +0 -354
  102. package/dist/page-manager-new-SNRQn7Az.cjs +0 -1
  103. package/dist/publish-pages-content-6N7aEcM1.js +0 -178
  104. package/dist/publish-pages-content-CaBwfekc.cjs +0 -1
@@ -1,988 +0,0 @@
1
- import { jsx as a, jsxs as g, Fragment as ye } from "react/jsx-runtime";
2
- import { j as s, B as Z } from "./selected-block-display-DdW-DWF1.js";
3
- import * as c from "react";
4
- import { createContext as K, Fragment as we, useRef as F, useEffect as L, useState as U, useCallback as V, useMemo as Ne, Children as Ie, useContext as X } from "react";
5
- import { Command as R } from "cmdk";
6
- import { X as ke, Search as Se, ChevronRight as Re, Check as ee, Circle as Ce, ChevronDown as te, ChevronUp as ze, PaperclipIcon as De, XIcon as ae, ImageIcon as Pe, PlusIcon as Te, MicIcon as Le, CornerDownLeftIcon as Ae, Loader2Icon as je, SquareIcon as _e, Paperclip as Ue, GlobeIcon as Me, Square as Be, Send as Fe } from "lucide-react";
7
- import * as P from "@radix-ui/react-dialog";
8
- import * as v from "@radix-ui/react-dropdown-menu";
9
- import * as H from "@radix-ui/react-hover-card";
10
- import { cva as ne } from "class-variance-authority";
11
- import * as N from "@radix-ui/react-select";
12
- import { useTranslation as Oe } from "@chaibuilder/sdk";
13
- const Ge = P.Portal, oe = c.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ a(
14
- P.Overlay,
15
- {
16
- ref: n,
17
- className: s(
18
- "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
19
- e
20
- ),
21
- ...t
22
- }
23
- ));
24
- oe.displayName = P.Overlay.displayName;
25
- const Ee = c.forwardRef(({ className: e, children: t, ...n }, o) => /* @__PURE__ */ g(Ge, { children: [
26
- /* @__PURE__ */ a(oe, {}),
27
- /* @__PURE__ */ g(
28
- P.Content,
29
- {
30
- ref: o,
31
- className: s(
32
- "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
33
- e
34
- ),
35
- ...n,
36
- children: [
37
- t,
38
- /* @__PURE__ */ g(P.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
39
- /* @__PURE__ */ a(ke, { className: "h-4 w-4" }),
40
- /* @__PURE__ */ a("span", { className: "sr-only", children: "Close" })
41
- ] })
42
- ]
43
- }
44
- )
45
- ] }));
46
- Ee.displayName = P.Content.displayName;
47
- const Ve = c.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ a(
48
- P.Title,
49
- {
50
- ref: n,
51
- className: s(
52
- "text-lg font-semibold leading-none tracking-tight",
53
- e
54
- ),
55
- ...t
56
- }
57
- ));
58
- Ve.displayName = P.Title.displayName;
59
- const He = c.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ a(
60
- P.Description,
61
- {
62
- ref: n,
63
- className: s("text-sm text-muted-foreground", e),
64
- ...t
65
- }
66
- ));
67
- He.displayName = P.Description.displayName;
68
- const We = c.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ a(
69
- R,
70
- {
71
- ref: n,
72
- className: s(
73
- "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
74
- e
75
- ),
76
- ...t
77
- }
78
- ));
79
- We.displayName = R.displayName;
80
- const qe = c.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ g("div", { className: "flex items-center border-b px-3", "cmdk-input-wrapper": "", children: [
81
- /* @__PURE__ */ a(Se, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
82
- /* @__PURE__ */ a(
83
- R.Input,
84
- {
85
- ref: n,
86
- className: s(
87
- "flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
88
- e
89
- ),
90
- ...t
91
- }
92
- )
93
- ] }));
94
- qe.displayName = R.Input.displayName;
95
- const Ke = c.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ a(
96
- R.List,
97
- {
98
- ref: n,
99
- className: s("max-h-[300px] overflow-y-auto overflow-x-hidden", e),
100
- ...t
101
- }
102
- ));
103
- Ke.displayName = R.List.displayName;
104
- const Xe = c.forwardRef((e, t) => /* @__PURE__ */ a(
105
- R.Empty,
106
- {
107
- ref: t,
108
- className: "py-6 text-center text-sm",
109
- ...e
110
- }
111
- ));
112
- Xe.displayName = R.Empty.displayName;
113
- const Ye = c.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ a(
114
- R.Group,
115
- {
116
- ref: n,
117
- className: s(
118
- "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
119
- e
120
- ),
121
- ...t
122
- }
123
- ));
124
- Ye.displayName = R.Group.displayName;
125
- const $e = c.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ a(
126
- R.Separator,
127
- {
128
- ref: n,
129
- className: s("-mx-1 h-px bg-border", e),
130
- ...t
131
- }
132
- ));
133
- $e.displayName = R.Separator.displayName;
134
- const Je = c.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ a(
135
- R.Item,
136
- {
137
- ref: n,
138
- className: s(
139
- "relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
140
- e
141
- ),
142
- ...t
143
- }
144
- ));
145
- Je.displayName = R.Item.displayName;
146
- const Qe = v.Root, Ze = v.Trigger, et = c.forwardRef(({ className: e, inset: t, children: n, ...o }, i) => /* @__PURE__ */ g(
147
- v.SubTrigger,
148
- {
149
- ref: i,
150
- className: s(
151
- "flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
152
- t && "pl-8",
153
- e
154
- ),
155
- ...o,
156
- children: [
157
- n,
158
- /* @__PURE__ */ a(Re, { className: "ml-auto" })
159
- ]
160
- }
161
- ));
162
- et.displayName = v.SubTrigger.displayName;
163
- const tt = c.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ a(
164
- v.SubContent,
165
- {
166
- ref: n,
167
- className: s(
168
- "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",
169
- e
170
- ),
171
- ...t
172
- }
173
- ));
174
- tt.displayName = v.SubContent.displayName;
175
- const re = c.forwardRef(({ className: e, sideOffset: t = 4, ...n }, o) => /* @__PURE__ */ a(v.Portal, { children: /* @__PURE__ */ a(
176
- v.Content,
177
- {
178
- ref: o,
179
- sideOffset: t,
180
- className: s(
181
- "z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",
182
- e
183
- ),
184
- ...n
185
- }
186
- ) }));
187
- re.displayName = v.Content.displayName;
188
- const se = c.forwardRef(({ className: e, inset: t, ...n }, o) => /* @__PURE__ */ a(
189
- v.Item,
190
- {
191
- ref: o,
192
- className: s(
193
- "relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
194
- t && "pl-8",
195
- e
196
- ),
197
- ...n
198
- }
199
- ));
200
- se.displayName = v.Item.displayName;
201
- const at = c.forwardRef(({ className: e, children: t, checked: n, ...o }, i) => /* @__PURE__ */ g(
202
- v.CheckboxItem,
203
- {
204
- ref: i,
205
- className: s(
206
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
207
- e
208
- ),
209
- checked: n,
210
- ...o,
211
- children: [
212
- /* @__PURE__ */ a("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ a(v.ItemIndicator, { children: /* @__PURE__ */ a(ee, { className: "h-4 w-4" }) }) }),
213
- t
214
- ]
215
- }
216
- ));
217
- at.displayName = v.CheckboxItem.displayName;
218
- const nt = c.forwardRef(({ className: e, children: t, ...n }, o) => /* @__PURE__ */ g(
219
- v.RadioItem,
220
- {
221
- ref: o,
222
- className: s(
223
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
224
- e
225
- ),
226
- ...n,
227
- children: [
228
- /* @__PURE__ */ a("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ a(v.ItemIndicator, { children: /* @__PURE__ */ a(Ce, { className: "h-2 w-2 fill-current" }) }) }),
229
- t
230
- ]
231
- }
232
- ));
233
- nt.displayName = v.RadioItem.displayName;
234
- const ot = c.forwardRef(({ className: e, inset: t, ...n }, o) => /* @__PURE__ */ a(
235
- v.Label,
236
- {
237
- ref: o,
238
- className: s(
239
- "px-2 py-1.5 text-sm font-semibold",
240
- t && "pl-8",
241
- e
242
- ),
243
- ...n
244
- }
245
- ));
246
- ot.displayName = v.Label.displayName;
247
- const rt = c.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ a(
248
- v.Separator,
249
- {
250
- ref: n,
251
- className: s("-mx-1 my-1 h-px bg-muted", e),
252
- ...t
253
- }
254
- ));
255
- rt.displayName = v.Separator.displayName;
256
- const st = H.Root, it = H.Trigger, ie = c.forwardRef(({ className: e, align: t = "center", sideOffset: n = 4, ...o }, i) => /* @__PURE__ */ a(
257
- H.Content,
258
- {
259
- ref: i,
260
- align: t,
261
- sideOffset: n,
262
- className: s(
263
- "z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-hover-card-content-transform-origin]",
264
- e
265
- ),
266
- ...o
267
- }
268
- ));
269
- ie.displayName = H.Content.displayName;
270
- const lt = c.forwardRef(
271
- ({ className: e, type: t, ...n }, o) => /* @__PURE__ */ a(
272
- "input",
273
- {
274
- type: t,
275
- className: s(
276
- "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
277
- e
278
- ),
279
- ref: o,
280
- ...n
281
- }
282
- )
283
- );
284
- lt.displayName = "Input";
285
- const le = c.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ a(
286
- "textarea",
287
- {
288
- className: s(
289
- "flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
290
- e
291
- ),
292
- ref: n,
293
- ...t
294
- }
295
- ));
296
- le.displayName = "Textarea";
297
- function dt({ className: e, ...t }) {
298
- return /* @__PURE__ */ a(
299
- "div",
300
- {
301
- "data-slot": "input-group",
302
- role: "group",
303
- className: s(
304
- "group/input-group border-input dark:bg-input/30 shadow-xs relative flex w-full items-center rounded-md border outline-none transition-[color,box-shadow]",
305
- "h-9 has-[>textarea]:h-auto",
306
- // Variants based on alignment.
307
- "has-[>[data-align=inline-start]]:[&>input]:pl-2",
308
- "has-[>[data-align=inline-end]]:[&>input]:pr-2",
309
- "has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3",
310
- "has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3",
311
- // Focus state.
312
- "has-[[data-slot=input-group-control]:focus-visible]:ring-ring has-[[data-slot=input-group-control]:focus-visible]:ring-1",
313
- // Error state.
314
- "has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",
315
- e
316
- ),
317
- ...t
318
- }
319
- );
320
- }
321
- const ct = ne(
322
- "text-muted-foreground flex h-auto cursor-text select-none items-center justify-center gap-2 py-1.5 text-sm font-medium group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",
323
- {
324
- variants: {
325
- align: {
326
- "inline-start": "order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]",
327
- "inline-end": "order-last pr-3 has-[>button]:mr-[-0.4rem] has-[>kbd]:mr-[-0.35rem]",
328
- "block-start": "[.border-b]:pb-3 order-first w-full justify-start px-3 pt-3 group-has-[>input]/input-group:pt-2.5",
329
- "block-end": "[.border-t]:pt-3 order-last w-full justify-start px-3 pb-3 group-has-[>input]/input-group:pb-2.5"
330
- }
331
- },
332
- defaultVariants: {
333
- align: "inline-start"
334
- }
335
- }
336
- );
337
- function de({
338
- className: e,
339
- align: t = "inline-start",
340
- ...n
341
- }) {
342
- return /* @__PURE__ */ a(
343
- "div",
344
- {
345
- role: "group",
346
- "data-slot": "input-group-addon",
347
- "data-align": t,
348
- className: s(ct({ align: t }), e),
349
- onClick: (o) => {
350
- var i, x;
351
- o.target.closest("button") || (x = (i = o.currentTarget.parentElement) == null ? void 0 : i.querySelector("input")) == null || x.focus();
352
- },
353
- ...n
354
- }
355
- );
356
- }
357
- const mt = ne(
358
- "flex items-center gap-2 text-sm shadow-none",
359
- {
360
- variants: {
361
- size: {
362
- xs: "h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-2 has-[>svg]:px-2 [&>svg:not([class*='size-'])]:size-3.5",
363
- sm: "h-8 gap-1.5 rounded-md px-2.5 has-[>svg]:px-2.5",
364
- "icon-xs": "size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0",
365
- "icon-sm": "size-8 p-0 has-[>svg]:p-0"
366
- }
367
- },
368
- defaultVariants: {
369
- size: "xs"
370
- }
371
- }
372
- );
373
- function ce({
374
- className: e,
375
- type: t = "button",
376
- variant: n = "ghost",
377
- size: o = "xs",
378
- ...i
379
- }) {
380
- return /* @__PURE__ */ a(
381
- Z,
382
- {
383
- type: t,
384
- "data-size": o,
385
- variant: n,
386
- className: s(mt({ size: o }), e),
387
- ...i
388
- }
389
- );
390
- }
391
- function ut({
392
- className: e,
393
- ...t
394
- }) {
395
- return /* @__PURE__ */ a(
396
- le,
397
- {
398
- "data-slot": "input-group-control",
399
- className: s(
400
- "flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent",
401
- e
402
- ),
403
- ...t
404
- }
405
- );
406
- }
407
- const pt = c.forwardRef(({ className: e, children: t, ...n }, o) => /* @__PURE__ */ g(
408
- N.Trigger,
409
- {
410
- ref: o,
411
- className: s(
412
- "flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
413
- e
414
- ),
415
- ...n,
416
- children: [
417
- t,
418
- /* @__PURE__ */ a(N.Icon, { asChild: !0, children: /* @__PURE__ */ a(te, { className: "h-4 w-4 opacity-50" }) })
419
- ]
420
- }
421
- ));
422
- pt.displayName = N.Trigger.displayName;
423
- const me = c.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ a(
424
- N.ScrollUpButton,
425
- {
426
- ref: n,
427
- className: s(
428
- "flex cursor-default items-center justify-center py-1",
429
- e
430
- ),
431
- ...t,
432
- children: /* @__PURE__ */ a(ze, { className: "h-4 w-4" })
433
- }
434
- ));
435
- me.displayName = N.ScrollUpButton.displayName;
436
- const ue = c.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ a(
437
- N.ScrollDownButton,
438
- {
439
- ref: n,
440
- className: s(
441
- "flex cursor-default items-center justify-center py-1",
442
- e
443
- ),
444
- ...t,
445
- children: /* @__PURE__ */ a(te, { className: "h-4 w-4" })
446
- }
447
- ));
448
- ue.displayName = N.ScrollDownButton.displayName;
449
- const ft = c.forwardRef(({ className: e, children: t, position: n = "popper", ...o }, i) => /* @__PURE__ */ a(N.Portal, { children: /* @__PURE__ */ g(
450
- N.Content,
451
- {
452
- ref: i,
453
- className: s(
454
- "relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",
455
- n === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
456
- e
457
- ),
458
- position: n,
459
- ...o,
460
- children: [
461
- /* @__PURE__ */ a(me, {}),
462
- /* @__PURE__ */ a(
463
- N.Viewport,
464
- {
465
- className: s(
466
- "p-1",
467
- n === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
468
- ),
469
- children: t
470
- }
471
- ),
472
- /* @__PURE__ */ a(ue, {})
473
- ]
474
- }
475
- ) }));
476
- ft.displayName = N.Content.displayName;
477
- const gt = c.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ a(
478
- N.Label,
479
- {
480
- ref: n,
481
- className: s("py-1.5 pl-8 pr-2 text-sm font-semibold", e),
482
- ...t
483
- }
484
- ));
485
- gt.displayName = N.Label.displayName;
486
- const ht = c.forwardRef(({ className: e, children: t, ...n }, o) => /* @__PURE__ */ g(
487
- N.Item,
488
- {
489
- ref: o,
490
- className: s(
491
- "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
492
- e
493
- ),
494
- ...n,
495
- children: [
496
- /* @__PURE__ */ a("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ a(N.ItemIndicator, { children: /* @__PURE__ */ a(ee, { className: "h-4 w-4" }) }) }),
497
- /* @__PURE__ */ a(N.ItemText, { children: t })
498
- ]
499
- }
500
- ));
501
- ht.displayName = N.Item.displayName;
502
- const bt = c.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ a(
503
- N.Separator,
504
- {
505
- ref: n,
506
- className: s("-mx-1 my-1 h-px bg-muted", e),
507
- ...t
508
- }
509
- ));
510
- bt.displayName = N.Separator.displayName;
511
- const vt = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
512
- let xt = (e = 21) => {
513
- let t = "", n = crypto.getRandomValues(new Uint8Array(e |= 0));
514
- for (; e--; )
515
- t += vt[n[e] & 63];
516
- return t;
517
- };
518
- const yt = K(null), wt = K(null), pe = () => X(yt), Nt = () => X(wt), fe = K(null), W = () => {
519
- const e = Nt(), t = X(fe), n = e ?? t;
520
- if (!n)
521
- throw new Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");
522
- return n;
523
- };
524
- function It({ data: e, className: t, ...n }) {
525
- var S;
526
- const o = W(), i = e.filename || "", u = ((S = e.mediaType) != null && S.startsWith("image/") && e.url ? "image" : "file") === "image", w = i || (u ? "Image" : "Attachment");
527
- return /* @__PURE__ */ g(Ut, { children: [
528
- /* @__PURE__ */ a(it, { asChild: !0, children: /* @__PURE__ */ g(
529
- "div",
530
- {
531
- className: s(
532
- "group relative flex h-8 cursor-default select-none items-center gap-1.5 rounded-md border border-border px-1.5 text-sm font-medium transition-all hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
533
- t
534
- ),
535
- ...n,
536
- children: [
537
- /* @__PURE__ */ g("div", { className: "relative size-5 shrink-0", children: [
538
- /* @__PURE__ */ a("div", { className: "absolute inset-0 flex size-5 items-center justify-center overflow-hidden rounded bg-background transition-opacity group-hover:opacity-0", children: u ? /* @__PURE__ */ a(
539
- "img",
540
- {
541
- alt: i || "attachment",
542
- className: "size-5 object-cover",
543
- height: 20,
544
- src: e.url,
545
- width: 20
546
- }
547
- ) : /* @__PURE__ */ a("div", { className: "flex size-5 items-center justify-center text-muted-foreground", children: /* @__PURE__ */ a(De, { className: "size-3" }) }) }),
548
- /* @__PURE__ */ g(
549
- Z,
550
- {
551
- "aria-label": "Remove attachment",
552
- className: "absolute inset-0 size-5 cursor-pointer rounded p-0 opacity-0 transition-opacity group-hover:pointer-events-auto group-hover:opacity-100 [&>svg]:size-2.5",
553
- onClick: (C) => {
554
- C.stopPropagation(), o.remove(e.id);
555
- },
556
- type: "button",
557
- variant: "ghost",
558
- children: [
559
- /* @__PURE__ */ a(ae, {}),
560
- /* @__PURE__ */ a("span", { className: "sr-only", children: "Remove" })
561
- ]
562
- }
563
- )
564
- ] }),
565
- /* @__PURE__ */ a("span", { className: "flex-1 truncate", children: w })
566
- ]
567
- },
568
- e.id
569
- ) }),
570
- /* @__PURE__ */ a(Mt, { className: "w-auto p-2", children: /* @__PURE__ */ g("div", { className: "w-auto space-y-3", children: [
571
- u && /* @__PURE__ */ a("div", { className: "flex max-h-96 w-96 items-center justify-center overflow-hidden rounded-md border", children: /* @__PURE__ */ a(
572
- "img",
573
- {
574
- alt: i || "attachment preview",
575
- className: "max-h-full max-w-full object-contain",
576
- height: 384,
577
- src: e.url,
578
- width: 448
579
- }
580
- ) }),
581
- /* @__PURE__ */ a("div", { className: "flex items-center gap-2.5", children: /* @__PURE__ */ g("div", { className: "min-w-0 flex-1 space-y-1 px-0.5", children: [
582
- /* @__PURE__ */ a("h4", { className: "truncate text-sm font-semibold leading-none", children: i || (u ? "Image" : "Attachment") }),
583
- e.mediaType && /* @__PURE__ */ a("p", { className: "truncate font-mono text-xs text-muted-foreground", children: e.mediaType })
584
- ] }) })
585
- ] }) })
586
- ] });
587
- }
588
- function kt({ children: e, className: t, ...n }) {
589
- const o = W();
590
- return o.files.length ? /* @__PURE__ */ a("div", { className: s("flex flex-wrap items-center gap-2 p-3", t), ...n, children: o.files.map((i) => /* @__PURE__ */ a(we, { children: e(i) }, i.id)) }) : null;
591
- }
592
- const St = ({
593
- label: e = "Add photos or files",
594
- ...t
595
- }) => {
596
- const n = W();
597
- return /* @__PURE__ */ g(
598
- se,
599
- {
600
- ...t,
601
- onSelect: (o) => {
602
- o.preventDefault(), n.openFileDialog();
603
- },
604
- children: [
605
- /* @__PURE__ */ a(Pe, { className: "mr-2 size-4" }),
606
- " ",
607
- e
608
- ]
609
- }
610
- );
611
- }, Rt = ({
612
- className: e,
613
- accept: t,
614
- multiple: n,
615
- globalDrop: o,
616
- syncHiddenInput: i,
617
- maxFiles: x,
618
- maxFileSize: u,
619
- onError: w,
620
- onSubmit: S,
621
- children: C,
622
- ...A
623
- }) => {
624
- const l = pe(), d = !!l, h = F(null), D = F(null), k = F(null);
625
- L(() => {
626
- var b;
627
- const r = (b = D.current) == null ? void 0 : b.closest("form");
628
- r instanceof HTMLFormElement && (k.current = r);
629
- }, []);
630
- const [z, j] = U([]), I = d ? l.attachments.files : z, M = V(() => {
631
- var r;
632
- (r = h.current) == null || r.click();
633
- }, []), O = V(
634
- (r) => !t || t.trim() === "" ? !0 : t.includes("image/*") ? r.type.startsWith("image/") : !0,
635
- [t]
636
- ), G = V(
637
- (r) => {
638
- const b = Array.from(r), f = b.filter((y) => O(y));
639
- if (b.length && f.length === 0) {
640
- w == null || w({
641
- code: "accept",
642
- message: "No files match the accepted types."
643
- });
644
- return;
645
- }
646
- const p = (y) => u ? y.size <= u : !0, m = f.filter(p);
647
- if (f.length > 0 && m.length === 0) {
648
- w == null || w({
649
- code: "max_file_size",
650
- message: "All files exceed the maximum size."
651
- });
652
- return;
653
- }
654
- j((y) => {
655
- const _ = typeof x == "number" ? Math.max(0, x - y.length) : void 0, xe = typeof _ == "number" ? m.slice(0, _) : m;
656
- typeof _ == "number" && m.length > _ && (w == null || w({
657
- code: "max_files",
658
- message: "Too many files. Some were not added."
659
- }));
660
- const Q = [];
661
- for (const q of xe)
662
- Q.push({
663
- id: xt(),
664
- type: "file",
665
- url: URL.createObjectURL(q),
666
- mediaType: q.type,
667
- filename: q.name
668
- });
669
- return y.concat(Q);
670
- });
671
- },
672
- [O, x, u, w]
673
- ), T = d ? (r) => l.attachments.add(r) : G, B = d ? (r) => l.attachments.remove(r) : (r) => j((b) => {
674
- const f = b.find((p) => p.id === r);
675
- return f != null && f.url && URL.revokeObjectURL(f.url), b.filter((p) => p.id !== r);
676
- }), E = d ? () => l.attachments.clear() : () => j((r) => {
677
- for (const b of r)
678
- b.url && URL.revokeObjectURL(b.url);
679
- return [];
680
- }), $ = d ? () => l.attachments.openFileDialog() : M;
681
- L(() => {
682
- d && l.__registerFileInput(h, () => {
683
- var r;
684
- return (r = h.current) == null ? void 0 : r.click();
685
- });
686
- }, [d, l]), L(() => {
687
- i && h.current && I.length === 0 && (h.current.value = "");
688
- }, [I, i]), L(() => {
689
- const r = k.current;
690
- if (!r) return;
691
- const b = (p) => {
692
- var m, y;
693
- (y = (m = p.dataTransfer) == null ? void 0 : m.types) != null && y.includes("Files") && p.preventDefault();
694
- }, f = (p) => {
695
- var m, y, _;
696
- (y = (m = p.dataTransfer) == null ? void 0 : m.types) != null && y.includes("Files") && p.preventDefault(), (_ = p.dataTransfer) != null && _.files && p.dataTransfer.files.length > 0 && T(p.dataTransfer.files);
697
- };
698
- return r.addEventListener("dragover", b), r.addEventListener("drop", f), () => {
699
- r.removeEventListener("dragover", b), r.removeEventListener("drop", f);
700
- };
701
- }, [T]), L(() => {
702
- if (!o) return;
703
- const r = (f) => {
704
- var p, m;
705
- (m = (p = f.dataTransfer) == null ? void 0 : p.types) != null && m.includes("Files") && f.preventDefault();
706
- }, b = (f) => {
707
- var p, m, y;
708
- (m = (p = f.dataTransfer) == null ? void 0 : p.types) != null && m.includes("Files") && f.preventDefault(), (y = f.dataTransfer) != null && y.files && f.dataTransfer.files.length > 0 && T(f.dataTransfer.files);
709
- };
710
- return document.addEventListener("dragover", r), document.addEventListener("drop", b), () => {
711
- document.removeEventListener("dragover", r), document.removeEventListener("drop", b);
712
- };
713
- }, [T, o]), L(
714
- () => () => {
715
- if (!d)
716
- for (const r of I)
717
- r.url && URL.revokeObjectURL(r.url);
718
- },
719
- [d, I]
720
- );
721
- const ge = (r) => {
722
- r.currentTarget.files && T(r.currentTarget.files);
723
- }, he = async (r) => {
724
- const f = await (await fetch(r)).blob();
725
- return new Promise((p, m) => {
726
- const y = new FileReader();
727
- y.onloadend = () => p(y.result), y.onerror = m, y.readAsDataURL(f);
728
- });
729
- }, be = Ne(
730
- () => ({
731
- files: I.map((r) => ({ ...r, id: r.id })),
732
- add: T,
733
- remove: B,
734
- clear: E,
735
- openFileDialog: $,
736
- fileInputRef: h
737
- }),
738
- [I, T, B, E, $]
739
- ), ve = (r) => {
740
- r.preventDefault();
741
- const b = r.currentTarget, f = d ? l.textInput.value : new FormData(b).get("message") || "";
742
- d || b.reset(), Promise.all(
743
- I.map(async ({ id: p, ...m }) => m.url && m.url.startsWith("blob:") ? {
744
- ...m,
745
- url: await he(m.url)
746
- } : m)
747
- ).then((p) => {
748
- try {
749
- const m = S({ text: f, files: p }, r);
750
- m instanceof Promise ? m.then(() => {
751
- E(), d && l.textInput.clear();
752
- }).catch(() => {
753
- }) : (E(), d && l.textInput.clear());
754
- } catch {
755
- }
756
- });
757
- }, J = /* @__PURE__ */ g(ye, { children: [
758
- /* @__PURE__ */ a("span", { "aria-hidden": "true", className: "hidden", ref: D }),
759
- /* @__PURE__ */ a(
760
- "input",
761
- {
762
- accept: t,
763
- "aria-label": "Upload files",
764
- className: "hidden",
765
- multiple: n,
766
- onChange: ge,
767
- ref: h,
768
- title: "Upload files",
769
- type: "file"
770
- }
771
- ),
772
- /* @__PURE__ */ a("form", { className: s("w-full", e), onSubmit: ve, ...A, children: /* @__PURE__ */ a(dt, { className: "overflow-hidden", children: C }) })
773
- ] });
774
- return d ? J : /* @__PURE__ */ a(fe.Provider, { value: be, children: J });
775
- }, Ct = ({
776
- onChange: e,
777
- className: t,
778
- placeholder: n = "What would you like to know?",
779
- ...o
780
- }) => {
781
- const i = pe(), x = W(), [u, w] = U(!1), S = (l) => {
782
- if (l.key === "Enter") {
783
- if (u || l.nativeEvent.isComposing || l.shiftKey)
784
- return;
785
- l.preventDefault();
786
- const d = l.currentTarget.form, h = d == null ? void 0 : d.querySelector('button[type="submit"]');
787
- if (h != null && h.disabled)
788
- return;
789
- d == null || d.requestSubmit();
790
- }
791
- if (l.key === "Backspace" && l.currentTarget.value === "" && x.files.length > 0) {
792
- l.preventDefault();
793
- const d = x.files.at(-1);
794
- d && x.remove(d.id);
795
- }
796
- }, C = (l) => {
797
- var D;
798
- const d = (D = l.clipboardData) == null ? void 0 : D.items;
799
- if (!d)
800
- return;
801
- const h = [];
802
- for (const k of d)
803
- if (k.kind === "file") {
804
- const z = k.getAsFile();
805
- z && h.push(z);
806
- }
807
- h.length > 0 && (l.preventDefault(), x.add(h));
808
- }, A = i ? {
809
- value: i.textInput.value,
810
- onChange: (l) => {
811
- i.textInput.setInput(l.currentTarget.value), e == null || e(l);
812
- }
813
- } : {
814
- onChange: e
815
- };
816
- return /* @__PURE__ */ a(
817
- ut,
818
- {
819
- className: s("field-sizing-content max-h-48 min-h-16", t),
820
- name: "message",
821
- onCompositionEnd: () => w(!1),
822
- onCompositionStart: () => w(!0),
823
- onKeyDown: S,
824
- onPaste: C,
825
- placeholder: n,
826
- ...o,
827
- ...A
828
- }
829
- );
830
- }, zt = ({ className: e, ...t }) => /* @__PURE__ */ a(de, { align: "block-end", className: s("order-first flex-wrap gap-1", e), ...t }), Dt = ({ className: e, ...t }) => /* @__PURE__ */ a(de, { align: "block-end", className: s("justify-between gap-1", e), ...t }), Pt = ({ className: e, ...t }) => /* @__PURE__ */ a("div", { className: s("flex items-center gap-1", e), ...t }), Y = ({ variant: e = "ghost", className: t, size: n, ...o }) => {
831
- const i = n ?? (Ie.count(o.children) > 1 ? "sm" : "icon-sm");
832
- return /* @__PURE__ */ a(ce, { className: s(t), size: i, type: "button", variant: e, ...o });
833
- }, Tt = (e) => /* @__PURE__ */ a(Qe, { ...e }), Lt = ({ className: e, children: t, ...n }) => /* @__PURE__ */ a(Ze, { asChild: !0, children: /* @__PURE__ */ a(Y, { className: e, ...n, children: t ?? /* @__PURE__ */ a(Te, { className: "size-4" }) }) }), At = ({ className: e, ...t }) => /* @__PURE__ */ a(re, { align: "start", className: s(e), ...t }), jt = ({
834
- className: e,
835
- variant: t = "default",
836
- size: n = "icon-sm",
837
- status: o,
838
- children: i,
839
- ...x
840
- }) => {
841
- let u = /* @__PURE__ */ a(Ae, { className: "size-4" });
842
- return o === "submitted" ? u = /* @__PURE__ */ a(je, { className: "size-4 animate-spin" }) : o === "streaming" ? u = /* @__PURE__ */ a(_e, { className: "size-4" }) : o === "error" && (u = /* @__PURE__ */ a(ae, { className: "size-4" })), /* @__PURE__ */ a(
843
- ce,
844
- {
845
- "aria-label": "Submit",
846
- className: s(e),
847
- size: n,
848
- type: "submit",
849
- variant: t,
850
- ...x,
851
- children: i ?? u
852
- }
853
- );
854
- }, _t = ({
855
- className: e,
856
- textareaRef: t,
857
- onTranscriptionChange: n,
858
- ...o
859
- }) => {
860
- const [i, x] = U(!1), [u, w] = U(null), S = F(null);
861
- L(() => {
862
- if (typeof window < "u" && ("SpeechRecognition" in window || "webkitSpeechRecognition" in window)) {
863
- const A = window.SpeechRecognition || window.webkitSpeechRecognition, l = new A();
864
- l.continuous = !0, l.interimResults = !0, l.lang = "en-US", l.onstart = () => {
865
- x(!0);
866
- }, l.onend = () => {
867
- x(!1);
868
- }, l.onresult = (d) => {
869
- var D;
870
- let h = "";
871
- for (let k = d.resultIndex; k < d.results.length; k++) {
872
- const z = d.results[k];
873
- z.isFinal && (h += ((D = z[0]) == null ? void 0 : D.transcript) ?? "");
874
- }
875
- if (h && (t != null && t.current)) {
876
- const k = t.current, z = k.value, j = z + (z ? " " : "") + h;
877
- k.value = j, k.dispatchEvent(new Event("input", { bubbles: !0 })), n == null || n(j);
878
- }
879
- }, l.onerror = (d) => {
880
- console.error("Speech recognition error:", d.error), x(!1);
881
- }, S.current = l, w(l);
882
- }
883
- return () => {
884
- S.current && S.current.stop();
885
- };
886
- }, [t, n]);
887
- const C = V(() => {
888
- u && (i ? u.stop() : u.start());
889
- }, [u, i]);
890
- return /* @__PURE__ */ a(
891
- Y,
892
- {
893
- className: s(
894
- "relative transition-all duration-200",
895
- i && "animate-pulse bg-accent text-accent-foreground",
896
- e
897
- ),
898
- disabled: !u,
899
- onClick: C,
900
- ...o,
901
- children: /* @__PURE__ */ a(Le, { className: "size-4" })
902
- }
903
- );
904
- }, Ut = ({ openDelay: e = 0, closeDelay: t = 0, ...n }) => /* @__PURE__ */ a(st, { closeDelay: t, openDelay: e, ...n }), Mt = ({ align: e = "start", ...t }) => /* @__PURE__ */ a(ie, { align: e, ...t }), Bt = "chai-ai-selected-model", qt = ({
905
- input: e,
906
- setInput: t,
907
- onSend: n,
908
- onStop: o,
909
- isLoading: i,
910
- disabled: x,
911
- selectedLang: u,
912
- selectedModel: w = "google/gemini-2.5-flash",
913
- onModelChange: S
914
- }) => {
915
- const { t: C } = Oe(), [A, l] = U(w), [d, h] = U(null), D = F(null), [k, z] = U(!1);
916
- return L(() => {
917
- if (!u) {
918
- const I = localStorage.getItem(Bt);
919
- I && (l(I), S == null || S(I));
920
- }
921
- }, [u, S]), /* @__PURE__ */ a("div", { className: "relative", children: /* @__PURE__ */ a("div", { className: "border-gray-20 rounded-lg border", children: /* @__PURE__ */ g(Rt, { onSubmit: (I) => {
922
- var G;
923
- const M = I.files.find((T) => {
924
- var B;
925
- return (B = T.mediaType) == null ? void 0 : B.startsWith("image/");
926
- }), O = (M == null ? void 0 : M.url) || d;
927
- n((G = I.text) == null ? void 0 : G.trim(), void 0, O, A), h(null);
928
- }, accept: "image/*", className: "flex h-auto w-full flex-col", children: [
929
- /* @__PURE__ */ a(zt, { className: "p-0", children: /* @__PURE__ */ a(kt, { className: "pb-0", children: (I) => /* @__PURE__ */ a(It, { className: "text-xs", data: I }) }) }),
930
- /* @__PURE__ */ a(
931
- Ct,
932
- {
933
- ref: D,
934
- value: e,
935
- onChange: (I) => t(I.target.value),
936
- placeholder: C(u ? "Ask to update content" : "Ask me anything..."),
937
- disabled: i,
938
- className: "max-h-[200px] min-h-[60px] w-full",
939
- rows: 3
940
- }
941
- ),
942
- /* @__PURE__ */ g(Dt, { children: [
943
- u ? /* @__PURE__ */ a("div", {}) : /* @__PURE__ */ g(Pt, { children: [
944
- /* @__PURE__ */ g(Tt, { children: [
945
- /* @__PURE__ */ a(Lt, { disabled: i, children: /* @__PURE__ */ a(Ue, { size: 16 }) }),
946
- /* @__PURE__ */ a(At, { children: /* @__PURE__ */ a(St, {}) })
947
- ] }),
948
- /* @__PURE__ */ a(
949
- _t,
950
- {
951
- textareaRef: D,
952
- onTranscriptionChange: t,
953
- disabled: i
954
- }
955
- ),
956
- /* @__PURE__ */ g(
957
- Y,
958
- {
959
- className: "hidden",
960
- size: "sm",
961
- onClick: () => z(!k),
962
- variant: k ? "default" : "ghost",
963
- children: [
964
- /* @__PURE__ */ a(Me, { size: 16 }),
965
- /* @__PURE__ */ a("span", { children: "Search" })
966
- ]
967
- }
968
- )
969
- ] }),
970
- i ? /* @__PURE__ */ g(
971
- "button",
972
- {
973
- onClick: o,
974
- className: "z-50 flex items-center gap-x-1 rounded-md bg-red-500 p-1.5 text-white transition-colors hover:bg-red-600",
975
- title: C("Stop generation"),
976
- children: [
977
- /* @__PURE__ */ a(Be, { size: 16 }),
978
- " ",
979
- /* @__PURE__ */ a("span", { className: "text-xs", children: C("Stop") })
980
- ]
981
- }
982
- ) : /* @__PURE__ */ a(jt, { disabled: !e.trim() || x, children: /* @__PURE__ */ a(Fe, { size: 16 }) })
983
- ] })
984
- ] }) }) });
985
- };
986
- export {
987
- qt as default
988
- };