@ekanos/ui 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2411 @@
1
+ 'use client';
2
+
3
+ // ../ui/src/ai-elements/prompt-input.tsx
4
+ import {
5
+ Children as Children2,
6
+ createContext as createContext3,
7
+ useCallback,
8
+ useContext as useContext3,
9
+ useEffect,
10
+ useMemo as useMemo2,
11
+ useRef,
12
+ useState
13
+ } from "react";
14
+
15
+ // ../ui/src/lib/utils/cn.ts
16
+ import { clsx } from "clsx";
17
+ import { twMerge } from "tailwind-merge";
18
+ function cn(...inputs) {
19
+ return twMerge(clsx(inputs));
20
+ }
21
+
22
+ // ../ui/src/ai-elements/prompt-input.tsx
23
+ import { nanoid } from "nanoid";
24
+
25
+ // ../ui/src/custom/icon.tsx
26
+ import {
27
+ createContext,
28
+ useContext
29
+ } from "react";
30
+
31
+ // ../ui/src/custom/lucide-fa-map.json
32
+ var lucide_fa_map_default = {
33
+ Activity: "fa-light fa-wave-pulse",
34
+ Airplay: "fa-light fa-airplay",
35
+ AlarmClock: "fa-light fa-alarm-clock",
36
+ Album: "fa-light fa-album",
37
+ Ampersand: "fa-light fa-ampersand",
38
+ Anchor: "fa-light fa-anchor",
39
+ Aperture: "fa-light fa-aperture",
40
+ Apple: "fa-brands fa-apple",
41
+ Archive: "fa-light fa-box-archive",
42
+ ArrowDown: "fa-light fa-arrow-down",
43
+ ArrowDownFromLine: "fa-light fa-arrow-down-from-line",
44
+ ArrowDownLeft: "fa-light fa-arrow-down-left",
45
+ ArrowDownRight: "fa-light fa-arrow-down-right",
46
+ ArrowDownToLine: "fa-light fa-arrow-down-to-line",
47
+ ArrowLeft: "fa-light fa-arrow-left",
48
+ ArrowLeftFromLine: "fa-light fa-arrow-left-from-line",
49
+ ArrowLeftRight: "fa-light fa-arrow-right-arrow-left",
50
+ ArrowLeftToLine: "fa-light fa-arrow-left-to-line",
51
+ ArrowRight: "fa-light fa-arrow-right",
52
+ ArrowRightFromLine: "fa-light fa-arrow-right-from-line",
53
+ ArrowRightToLine: "fa-light fa-arrow-right-to-line",
54
+ ArrowUp: "fa-light fa-arrow-up",
55
+ ArrowUpDown: "fa-light fa-arrow-up-arrow-down",
56
+ ArrowUpFromLine: "fa-light fa-arrow-up-from-line",
57
+ ArrowUpLeft: "fa-light fa-arrow-up-left",
58
+ ArrowUpRight: "fa-light fa-arrow-up-right",
59
+ ArrowUpToLine: "fa-light fa-arrow-up-to-line",
60
+ Asterisk: "fa-light fa-asterisk",
61
+ Atom: "fa-light fa-atom",
62
+ AtSign: "fa-light fa-at",
63
+ Award: "fa-light fa-award",
64
+ Axe: "fa-light fa-axe",
65
+ Baby: "fa-light fa-baby",
66
+ Backpack: "fa-light fa-backpack",
67
+ Badge: "fa-light fa-badge",
68
+ BadgeCheck: "fa-light fa-badge-check",
69
+ BadgeDollarSign: "fa-light fa-badge-dollar",
70
+ BadgePercent: "fa-light fa-badge-percent",
71
+ Balloon: "fa-light fa-balloon",
72
+ Ban: "fa-light fa-ban",
73
+ Banana: "fa-light fa-banana",
74
+ Bandage: "fa-light fa-bandage",
75
+ Banknote: "fa-light fa-money-bill",
76
+ Barcode: "fa-light fa-barcode",
77
+ Bath: "fa-light fa-bath",
78
+ Battery: "fa-light fa-battery-full",
79
+ BatteryFull: "fa-light fa-battery-full",
80
+ BatteryLow: "fa-light fa-battery-low",
81
+ Bed: "fa-light fa-bed",
82
+ Bell: "fa-light fa-bell",
83
+ BellPlus: "fa-light fa-bell-plus",
84
+ BellRing: "fa-light fa-bell-ring",
85
+ Binary: "fa-light fa-binary",
86
+ Binoculars: "fa-light fa-binoculars",
87
+ Biohazard: "fa-light fa-biohazard",
88
+ Bird: "fa-light fa-bird",
89
+ Bitcoin: "fa-brands fa-bitcoin",
90
+ Blinds: "fa-light fa-blinds",
91
+ Blocks: "fa-light fa-cubes",
92
+ Bluetooth: "fa-light fa-bluetooth",
93
+ Bold: "fa-light fa-bold",
94
+ Bolt: "fa-light fa-bolt",
95
+ Bomb: "fa-light fa-bomb",
96
+ Bone: "fa-light fa-bone",
97
+ Book: "fa-light fa-book",
98
+ BookCopy: "fa-light fa-book-copy",
99
+ BookHeart: "fa-light fa-book-heart",
100
+ Bookmark: "fa-light fa-bookmark",
101
+ BookmarkPlus: "fa-light fa-bookmark-plus",
102
+ BookOpen: "fa-light fa-book-open",
103
+ BookUser: "fa-light fa-book-user",
104
+ Bot: "fa-light fa-robot",
105
+ BowArrow: "fa-light fa-bow-arrow",
106
+ Box: "fa-light fa-box",
107
+ Boxes: "fa-light fa-boxes-stacked",
108
+ Brain: "fa-light fa-brain",
109
+ BrainCircuit: "fa-light fa-brain-circuit",
110
+ Briefcase: "fa-light fa-briefcase",
111
+ BriefcaseMedical: "fa-light fa-briefcase-medical",
112
+ Brush: "fa-light fa-brush",
113
+ Bug: "fa-light fa-bug",
114
+ Building: "fa-light fa-building",
115
+ Building2: "fa-light fa-building",
116
+ Bus: "fa-light fa-bus",
117
+ CableCar: "fa-light fa-cable-car",
118
+ CakeSlice: "fa-light fa-cake-slice",
119
+ Calculator: "fa-light fa-calculator",
120
+ Calendar: "fa-light fa-calendar",
121
+ CalendarArrowDown: "fa-light fa-calendar-arrow-down",
122
+ CalendarArrowUp: "fa-light fa-calendar-arrow-up",
123
+ CalendarCheck: "fa-light fa-calendar-check",
124
+ CalendarClock: "fa-light fa-calendar-clock",
125
+ CalendarDays: "fa-light fa-calendar-days",
126
+ CalendarHeart: "fa-light fa-calendar-heart",
127
+ CalendarMinus: "fa-light fa-calendar-minus",
128
+ CalendarPlus: "fa-light fa-calendar-plus",
129
+ CalendarRange: "fa-light fa-calendar-range",
130
+ Calendars: "fa-light fa-calendars",
131
+ Camera: "fa-light fa-camera",
132
+ Candy: "fa-light fa-candy",
133
+ CandyCane: "fa-light fa-candy-cane",
134
+ Cannabis: "fa-light fa-cannabis",
135
+ Car: "fa-light fa-car",
136
+ Caravan: "fa-light fa-caravan",
137
+ Carrot: "fa-light fa-carrot",
138
+ CassetteTape: "fa-light fa-cassette-tape",
139
+ Castle: "fa-light fa-castle",
140
+ Cat: "fa-light fa-cat",
141
+ ChartArea: "fa-light fa-chart-area",
142
+ ChartBar: "fa-light fa-chart-bar",
143
+ ChartCandlestick: "fa-light fa-chart-candlestick",
144
+ ChartColumn: "fa-light fa-chart-column",
145
+ ChartGantt: "fa-light fa-chart-gantt",
146
+ ChartLine: "fa-light fa-chart-line",
147
+ ChartNetwork: "fa-light fa-chart-network",
148
+ ChartPie: "fa-light fa-chart-pie",
149
+ ChartScatter: "fa-light fa-chart-scatter",
150
+ Check: "fa-light fa-check",
151
+ ChessBishop: "fa-light fa-chess-bishop",
152
+ ChessKing: "fa-light fa-chess-king",
153
+ ChessKnight: "fa-light fa-chess-knight",
154
+ ChessPawn: "fa-light fa-chess-pawn",
155
+ ChessQueen: "fa-light fa-chess-queen",
156
+ ChessRook: "fa-light fa-chess-rook",
157
+ ChevronDown: "fa-light fa-chevron-down",
158
+ ChevronLeft: "fa-light fa-chevron-left",
159
+ ChevronRight: "fa-light fa-chevron-right",
160
+ ChevronsDown: "fa-light fa-chevrons-down",
161
+ ChevronsLeft: "fa-light fa-angles-left",
162
+ ChevronsRight: "fa-light fa-angles-right",
163
+ ChevronsUp: "fa-light fa-chevrons-up",
164
+ ChevronsUpDown: "fa-light fa-up-down",
165
+ ChevronUp: "fa-light fa-chevron-up",
166
+ Church: "fa-light fa-church",
167
+ Circle: "fa-light fa-circle",
168
+ CircleArrowDown: "fa-light fa-circle-arrow-down",
169
+ CircleArrowLeft: "fa-light fa-circle-arrow-left",
170
+ CircleArrowRight: "fa-light fa-circle-arrow-right",
171
+ CircleArrowUp: "fa-light fa-circle-arrow-up",
172
+ CircleCheck: "fa-light fa-circle-check",
173
+ CircleChevronDown: "fa-light fa-circle-chevron-down",
174
+ CircleChevronLeft: "fa-light fa-circle-chevron-left",
175
+ CircleChevronRight: "fa-light fa-circle-chevron-right",
176
+ CircleChevronUp: "fa-light fa-circle-chevron-up",
177
+ CircleDashed: "fa-light fa-circle-dashed",
178
+ CircleDivide: "fa-light fa-circle-divide",
179
+ CircleDot: "fa-light fa-circle-dot",
180
+ CircleEllipsis: "fa-light fa-circle-ellipsis",
181
+ CircleMinus: "fa-light fa-circle-minus",
182
+ CircleParking: "fa-light fa-circle-parking",
183
+ CirclePause: "fa-light fa-circle-pause",
184
+ CirclePlay: "fa-light fa-circle-play",
185
+ CirclePlus: "fa-light fa-circle-plus",
186
+ CircleSmall: "fa-light fa-circle-small",
187
+ CircleStar: "fa-light fa-circle-star",
188
+ CircleStop: "fa-light fa-circle-stop",
189
+ CircleUser: "fa-light fa-circle-user",
190
+ CircleX: "fa-light fa-circle-x",
191
+ Citrus: "fa-light fa-citrus",
192
+ Clapperboard: "fa-light fa-clapperboard",
193
+ Clipboard: "fa-light fa-clipboard",
194
+ ClipboardCheck: "fa-light fa-clipboard-check",
195
+ ClipboardClock: "fa-light fa-clipboard-clock",
196
+ ClipboardList: "fa-light fa-clipboard-list",
197
+ Clock: "fa-light fa-clock",
198
+ Clock3: "fa-light fa-clock",
199
+ Cloud: "fa-light fa-cloud",
200
+ CloudCheck: "fa-light fa-cloud-check",
201
+ CloudDrizzle: "fa-light fa-cloud-drizzle",
202
+ CloudFog: "fa-light fa-cloud-fog",
203
+ CloudHail: "fa-light fa-cloud-hail",
204
+ CloudMoon: "fa-light fa-cloud-moon",
205
+ CloudMoonRain: "fa-light fa-cloud-moon-rain",
206
+ CloudRain: "fa-light fa-cloud-rain",
207
+ CloudSnow: "fa-light fa-cloud-snow",
208
+ CloudSun: "fa-light fa-cloud-sun",
209
+ CloudSunRain: "fa-light fa-cloud-sun-rain",
210
+ Clover: "fa-light fa-clover",
211
+ Club: "fa-light fa-club",
212
+ Code: "fa-light fa-code",
213
+ Codepen: "fa-brands fa-codepen",
214
+ Coffee: "fa-light fa-mug-saucer",
215
+ Cog: "fa-light fa-gear",
216
+ Coins: "fa-light fa-coins",
217
+ Command: "fa-light fa-command",
218
+ Compass: "fa-light fa-compass",
219
+ Computer: "fa-light fa-display",
220
+ Construction: "fa-light fa-person-digging",
221
+ Contact: "fa-light fa-address-book",
222
+ Cookie: "fa-light fa-cookie",
223
+ Copy: "fa-light fa-copy",
224
+ Copyright: "fa-light fa-copyright",
225
+ CornerDownLeft: "fa-light fa-arrow-turn-down-left",
226
+ CreativeCommons: "fa-brands fa-creative-commons",
227
+ CreditCard: "fa-light fa-credit-card",
228
+ Croissant: "fa-light fa-croissant",
229
+ Crop: "fa-light fa-crop",
230
+ Cross: "fa-light fa-cross",
231
+ Crown: "fa-light fa-crown",
232
+ Database: "fa-light fa-database",
233
+ Diamond: "fa-light fa-diamond",
234
+ Divide: "fa-light fa-divide",
235
+ Dna: "fa-light fa-dna",
236
+ Dog: "fa-light fa-dog",
237
+ DollarSign: "fa-light fa-dollar-sign",
238
+ Donut: "fa-light fa-donut",
239
+ DoorClosed: "fa-light fa-door-closed",
240
+ DoorOpen: "fa-light fa-door-open",
241
+ Dot: "fa-light fa-dot",
242
+ Download: "fa-light fa-download",
243
+ Dribbble: "fa-brands fa-dribbble",
244
+ Drone: "fa-light fa-drone",
245
+ Droplet: "fa-light fa-droplet",
246
+ Drum: "fa-light fa-drum",
247
+ Drumstick: "fa-light fa-drumstick",
248
+ Dumbbell: "fa-light fa-dumbbell",
249
+ Ear: "fa-light fa-ear",
250
+ Eclipse: "fa-light fa-eclipse",
251
+ Edit: "fa-light fa-pen-to-square",
252
+ Edit3: "fa-light fa-pencil",
253
+ Egg: "fa-light fa-egg",
254
+ EggFried: "fa-light fa-egg-fried",
255
+ Ellipsis: "fa-light fa-ellipsis",
256
+ EllipsisVertical: "fa-light fa-ellipsis-vertical",
257
+ Eraser: "fa-light fa-eraser",
258
+ Expand: "fa-light fa-expand",
259
+ ExternalLink: "fa-light fa-arrow-up-right-from-square",
260
+ Eye: "fa-light fa-eye",
261
+ EyeClosed: "fa-light fa-eye-closed",
262
+ EyeOff: "fa-light fa-eye-slash",
263
+ Facebook: "fa-brands fa-facebook",
264
+ Fan: "fa-light fa-fan",
265
+ Feather: "fa-light fa-feather",
266
+ Fence: "fa-light fa-fence",
267
+ FerrisWheel: "fa-light fa-ferris-wheel",
268
+ Figma: "fa-brands fa-figma",
269
+ File: "fa-light fa-file",
270
+ FileChartColumn: "fa-light fa-file-chart-column",
271
+ FileChartPie: "fa-light fa-file-chart-pie",
272
+ FileCheck: "fa-light fa-file-check",
273
+ FileCode: "fa-light fa-file-code",
274
+ FileHeart: "fa-light fa-file-heart",
275
+ FileImage: "fa-light fa-file-image",
276
+ FileLock: "fa-light fa-file-lock",
277
+ FileMinus: "fa-light fa-file-minus",
278
+ FileMusic: "fa-light fa-file-music",
279
+ FilePen: "fa-light fa-file-pen",
280
+ FilePlus: "fa-light fa-file-plus",
281
+ Files: "fa-light fa-files",
282
+ FileSpreadsheet: "fa-light fa-file-spreadsheet",
283
+ FileText: "fa-light fa-file-lines",
284
+ FileUser: "fa-light fa-file-user",
285
+ Film: "fa-light fa-film",
286
+ FireExtinguisher: "fa-light fa-fire-extinguisher",
287
+ Fish: "fa-light fa-fish",
288
+ Flag: "fa-light fa-flag",
289
+ Flashlight: "fa-light fa-flashlight",
290
+ Flower: "fa-light fa-flower",
291
+ Folder: "fa-light fa-folder",
292
+ FolderArchive: "fa-light fa-box-archive",
293
+ FolderCheck: "fa-light fa-folder-check",
294
+ FolderClosed: "fa-light fa-folder-closed",
295
+ FolderHeart: "fa-light fa-folder-heart",
296
+ FolderKanban: "fa-light fa-square-kanban",
297
+ FolderMinus: "fa-light fa-folder-minus",
298
+ FolderOpen: "fa-light fa-folder-open",
299
+ FolderPlus: "fa-light fa-folder-plus",
300
+ Folders: "fa-light fa-folders",
301
+ FolderTree: "fa-light fa-folder-tree",
302
+ Forklift: "fa-light fa-forklift",
303
+ Forward: "fa-light fa-forward",
304
+ Frame: "fa-light fa-frame",
305
+ GalleryThumbnails: "fa-light fa-gallery-thumbnails",
306
+ Gamepad: "fa-light fa-gamepad",
307
+ Gauge: "fa-light fa-gauge",
308
+ Gavel: "fa-light fa-gavel",
309
+ Gem: "fa-light fa-gem",
310
+ Ghost: "fa-light fa-ghost",
311
+ Gift: "fa-light fa-gift",
312
+ Github: "fa-brands fa-github",
313
+ Gitlab: "fa-brands fa-gitlab",
314
+ Glasses: "fa-light fa-glasses",
315
+ GlassWater: "fa-light fa-glass-water",
316
+ Globe: "fa-light fa-globe",
317
+ Gpu: "fa-light fa-gpu",
318
+ GraduationCap: "fa-light fa-graduation-cap",
319
+ Grid3X3: "fa-light fa-grid",
320
+ Grip: "fa-light fa-grip",
321
+ GripVertical: "fa-light fa-grip-vertical",
322
+ Guitar: "fa-light fa-guitar",
323
+ Hammer: "fa-light fa-hammer",
324
+ Hand: "fa-light fa-hand",
325
+ HandFist: "fa-light fa-hand-fist",
326
+ HandHeart: "fa-light fa-hand-heart",
327
+ Handshake: "fa-light fa-handshake",
328
+ HardDrive: "fa-light fa-hard-drive",
329
+ Hash: "fa-light fa-hashtag",
330
+ Heading: "fa-light fa-heading",
331
+ Headphones: "fa-light fa-headphones",
332
+ Headset: "fa-light fa-headset",
333
+ Heart: "fa-light fa-heart",
334
+ HeartCrack: "fa-light fa-heart-crack",
335
+ HeartPulse: "fa-light fa-heart-pulse",
336
+ Helicopter: "fa-light fa-helicopter",
337
+ Hexagon: "fa-light fa-hexagon",
338
+ Highlighter: "fa-light fa-highlighter",
339
+ History: "fa-light fa-clock-rotate-left",
340
+ Hospital: "fa-light fa-hospital",
341
+ Hotel: "fa-light fa-hotel",
342
+ Hourglass: "fa-light fa-hourglass",
343
+ House: "fa-light fa-house",
344
+ HouseHeart: "fa-light fa-house-heart",
345
+ IdCard: "fa-light fa-id-card",
346
+ Image: "fa-light fa-image",
347
+ Images: "fa-light fa-images",
348
+ Inbox: "fa-light fa-inbox",
349
+ Infinity: "fa-light fa-infinity",
350
+ Info: "fa-light fa-info",
351
+ Instagram: "fa-brands fa-instagram",
352
+ Italic: "fa-light fa-italic",
353
+ Joystick: "fa-light fa-joystick",
354
+ Kayak: "fa-light fa-kayak",
355
+ Key: "fa-light fa-key",
356
+ Keyboard: "fa-light fa-keyboard",
357
+ KeyRound: "fa-light fa-key",
358
+ Lamp: "fa-light fa-lamp",
359
+ LampDesk: "fa-light fa-lamp-desk",
360
+ LampFloor: "fa-light fa-lamp-floor",
361
+ Landmark: "fa-light fa-landmark",
362
+ Laptop: "fa-light fa-laptop",
363
+ Lasso: "fa-light fa-lasso",
364
+ Layers: "fa-light fa-layer-group",
365
+ Layout: "fa-light fa-table-layout",
366
+ LayoutDashboard: "fa-light fa-table-columns",
367
+ LayoutGrid: "fa-light fa-grid-2",
368
+ Leaf: "fa-light fa-leaf",
369
+ LeafyGreen: "fa-light fa-leafy-green",
370
+ Lightbulb: "fa-light fa-lightbulb",
371
+ Link: "fa-light fa-link",
372
+ Link2: "fa-light fa-link",
373
+ Linkedin: "fa-brands fa-linkedin",
374
+ List: "fa-light fa-list",
375
+ ListCheck: "fa-light fa-list-check",
376
+ ListMusic: "fa-light fa-list-music",
377
+ ListTree: "fa-light fa-list-tree",
378
+ Loader: "fa-light fa-loader",
379
+ Lock: "fa-light fa-lock",
380
+ LockKeyhole: "fa-light fa-lock-keyhole",
381
+ LockKeyholeOpen: "fa-light fa-lock-keyhole-open",
382
+ LockOpen: "fa-light fa-lock-open",
383
+ LogOut: "fa-light fa-right-from-bracket",
384
+ Lollipop: "fa-light fa-lollipop",
385
+ Magnet: "fa-light fa-magnet",
386
+ Mail: "fa-light fa-envelope",
387
+ Mailbox: "fa-light fa-mailbox",
388
+ Map: "fa-light fa-map",
389
+ MapPin: "fa-light fa-location-dot",
390
+ Mars: "fa-light fa-mars",
391
+ MarsStroke: "fa-light fa-mars-stroke",
392
+ Maximize: "fa-light fa-maximize",
393
+ Maximize2: "fa-light fa-expand",
394
+ Medal: "fa-light fa-medal",
395
+ Megaphone: "fa-light fa-bullhorn",
396
+ Menu: "fa-light fa-bars",
397
+ Merge: "fa-light fa-merge",
398
+ MessageCircle: "fa-light fa-comment",
399
+ MessageSquare: "fa-light fa-message",
400
+ Mic: "fa-light fa-microphone",
401
+ Microchip: "fa-light fa-microchip",
402
+ Microscope: "fa-light fa-microscope",
403
+ Microwave: "fa-light fa-microwave",
404
+ Minimize: "fa-light fa-minimize",
405
+ Minimize2: "fa-light fa-compress",
406
+ Minus: "fa-light fa-minus",
407
+ MinusCircle: "fa-light fa-circle-minus",
408
+ Monitor: "fa-light fa-display",
409
+ MonitorPlay: "fa-light fa-display",
410
+ Moon: "fa-light fa-moon",
411
+ MoonStar: "fa-light fa-moon-star",
412
+ Mountain: "fa-light fa-mountain",
413
+ Music: "fa-light fa-music",
414
+ Music2: "fa-light fa-music",
415
+ Newspaper: "fa-light fa-newspaper",
416
+ Nfc: "fa-light fa-nfc",
417
+ NonBinary: "fa-light fa-non-binary",
418
+ Notebook: "fa-light fa-notebook",
419
+ NotebookPen: "fa-light fa-notebook",
420
+ Octagon: "fa-light fa-octagon",
421
+ OctagonMinus: "fa-light fa-octagon-minus",
422
+ Omega: "fa-light fa-omega",
423
+ Option: "fa-light fa-option",
424
+ Package: "fa-light fa-box",
425
+ PackageOpen: "fa-light fa-box-open",
426
+ Paintbrush: "fa-light fa-paintbrush",
427
+ PaintRoller: "fa-light fa-paint-roller",
428
+ Palette: "fa-light fa-palette",
429
+ PanelLeft: "fa-light fa-table-columns",
430
+ PanelRightClose: "fa-light fa-sidebar-flip",
431
+ PanelRightOpen: "fa-light fa-sidebar",
432
+ Paperclip: "fa-light fa-paperclip",
433
+ Pause: "fa-light fa-pause",
434
+ Pen: "fa-light fa-pen",
435
+ Pencil: "fa-light fa-pencil",
436
+ PencilLine: "fa-light fa-pencil-line",
437
+ PenLine: "fa-light fa-pen-line",
438
+ Pentagon: "fa-light fa-pentagon",
439
+ Percent: "fa-light fa-percent",
440
+ Phone: "fa-light fa-phone",
441
+ PhoneMissed: "fa-light fa-phone-missed",
442
+ Pi: "fa-light fa-pi",
443
+ Piano: "fa-light fa-piano",
444
+ Pickaxe: "fa-light fa-pickaxe",
445
+ PictureInPicture: "fa-light fa-picture-in-picture",
446
+ PiggyBank: "fa-light fa-piggy-bank",
447
+ Pill: "fa-light fa-pills",
448
+ Pipette: "fa-light fa-eye-dropper",
449
+ Pizza: "fa-light fa-pizza",
450
+ Plane: "fa-light fa-plane",
451
+ Play: "fa-light fa-play",
452
+ Plug: "fa-light fa-plug",
453
+ PlugZap: "fa-light fa-plug-circle-bolt",
454
+ Plus: "fa-light fa-plus",
455
+ PlusCircle: "fa-light fa-circle-plus",
456
+ Podcast: "fa-light fa-podcast",
457
+ Popcorn: "fa-light fa-popcorn",
458
+ Popsicle: "fa-light fa-popsicle",
459
+ Power: "fa-light fa-power-off",
460
+ PowerOff: "fa-light fa-power-off",
461
+ Projector: "fa-light fa-projector",
462
+ Puzzle: "fa-light fa-puzzle",
463
+ Rabbit: "fa-light fa-rabbit",
464
+ Radar: "fa-light fa-radar",
465
+ Radiation: "fa-light fa-radiation",
466
+ Radio: "fa-light fa-radio",
467
+ Rainbow: "fa-light fa-rainbow",
468
+ Receipt: "fa-light fa-receipt",
469
+ RectangleVertical: "fa-light fa-rectangle-vertical",
470
+ Recycle: "fa-light fa-recycle",
471
+ RefreshCw: "fa-light fa-arrows-rotate",
472
+ Refrigerator: "fa-light fa-refrigerator",
473
+ Repeat: "fa-light fa-repeat",
474
+ Reply: "fa-light fa-reply",
475
+ ReplyAll: "fa-light fa-reply-all",
476
+ Ribbon: "fa-light fa-ribbon",
477
+ Rocket: "fa-light fa-rocket",
478
+ RollerCoaster: "fa-light fa-roller-coaster",
479
+ RotateCcw: "fa-light fa-rotate-left",
480
+ Route: "fa-light fa-route",
481
+ Router: "fa-light fa-router",
482
+ Rss: "fa-light fa-rss",
483
+ Ruler: "fa-light fa-ruler",
484
+ Sailboat: "fa-light fa-sailboat",
485
+ Salad: "fa-light fa-salad",
486
+ Sandwich: "fa-light fa-sandwich",
487
+ Satellite: "fa-light fa-satellite",
488
+ SatelliteDish: "fa-light fa-satellite-dish",
489
+ Save: "fa-light fa-floppy-disk",
490
+ School: "fa-light fa-school",
491
+ Scissors: "fa-light fa-scissors",
492
+ Scooter: "fa-light fa-scooter",
493
+ Scroll: "fa-light fa-scroll",
494
+ Search: "fa-light fa-magnifying-glass",
495
+ Section: "fa-light fa-section",
496
+ Send: "fa-light fa-paper-plane",
497
+ Server: "fa-light fa-server",
498
+ Settings: "fa-light fa-gear",
499
+ Shapes: "fa-light fa-shapes",
500
+ Share: "fa-light fa-share",
501
+ Shield: "fa-light fa-shield",
502
+ ShieldAlert: "fa-light fa-shield-exclamation",
503
+ ShieldCheck: "fa-light fa-shield-check",
504
+ ShieldMinus: "fa-light fa-shield-minus",
505
+ ShieldOff: "fa-light fa-shield-slash",
506
+ ShieldPlus: "fa-light fa-shield-plus",
507
+ ShieldUser: "fa-light fa-shield-user",
508
+ Ship: "fa-light fa-ship",
509
+ Shirt: "fa-light fa-shirt",
510
+ ShoppingBag: "fa-light fa-bag-shopping",
511
+ Shovel: "fa-light fa-shovel",
512
+ Shredder: "fa-light fa-shredder",
513
+ Shrimp: "fa-light fa-shrimp",
514
+ Shuffle: "fa-light fa-shuffle",
515
+ Sigma: "fa-light fa-sigma",
516
+ Signal: "fa-light fa-signal",
517
+ Signature: "fa-light fa-signature",
518
+ Siren: "fa-light fa-siren",
519
+ Skull: "fa-light fa-skull",
520
+ Slack: "fa-brands fa-slack",
521
+ Slash: "fa-light fa-slash",
522
+ SlidersHorizontal: "fa-light fa-sliders",
523
+ Snowflake: "fa-light fa-snowflake",
524
+ SolarPanel: "fa-light fa-solar-panel",
525
+ Spade: "fa-light fa-spade",
526
+ Sparkle: "fa-light fa-sparkle",
527
+ Sparkles: "fa-light fa-sparkles",
528
+ Speaker: "fa-light fa-speaker",
529
+ SpellCheck: "fa-light fa-spell-check",
530
+ Split: "fa-light fa-split",
531
+ SprayCan: "fa-light fa-spray-can",
532
+ Square: "fa-light fa-square",
533
+ SquareArrowDown: "fa-light fa-square-arrow-down",
534
+ SquareArrowDownLeft: "fa-light fa-square-arrow-down-left",
535
+ SquareArrowDownRight: "fa-light fa-square-arrow-down-right",
536
+ SquareArrowLeft: "fa-light fa-square-arrow-left",
537
+ SquareArrowRight: "fa-light fa-square-arrow-right",
538
+ SquareArrowUp: "fa-light fa-square-arrow-up",
539
+ SquareArrowUpLeft: "fa-light fa-square-arrow-up-left",
540
+ SquareArrowUpRight: "fa-light fa-square-arrow-up-right",
541
+ SquareCheck: "fa-light fa-square-check",
542
+ SquareChevronDown: "fa-light fa-square-chevron-down",
543
+ SquareChevronLeft: "fa-light fa-square-chevron-left",
544
+ SquareChevronRight: "fa-light fa-square-chevron-right",
545
+ SquareChevronUp: "fa-light fa-square-chevron-up",
546
+ SquareCode: "fa-light fa-square-code",
547
+ SquareDashed: "fa-light fa-square-dashed",
548
+ SquareDivide: "fa-light fa-square-divide",
549
+ SquareKanban: "fa-light fa-square-kanban",
550
+ SquareM: "fa-light fa-square-m",
551
+ SquareMinus: "fa-light fa-square-minus",
552
+ SquareParking: "fa-light fa-square-parking",
553
+ SquarePen: "fa-light fa-square-pen",
554
+ SquarePlus: "fa-light fa-square-plus",
555
+ SquareStar: "fa-light fa-square-star",
556
+ SquareTerminal: "fa-light fa-square-terminal",
557
+ SquareUser: "fa-light fa-square-user",
558
+ SquareX: "fa-light fa-square-x",
559
+ Squirrel: "fa-light fa-squirrel",
560
+ Stamp: "fa-light fa-stamp",
561
+ Star: "fa-light fa-star",
562
+ StarHalf: "fa-light fa-star-half",
563
+ Stethoscope: "fa-light fa-stethoscope",
564
+ Store: "fa-light fa-store",
565
+ Strikethrough: "fa-light fa-strikethrough",
566
+ Subscript: "fa-light fa-subscript",
567
+ Sun: "fa-light fa-sun",
568
+ Sunrise: "fa-light fa-sunrise",
569
+ Sunset: "fa-light fa-sunset",
570
+ Superscript: "fa-light fa-superscript",
571
+ Sword: "fa-light fa-sword",
572
+ Swords: "fa-light fa-swords",
573
+ Syringe: "fa-light fa-syringe",
574
+ Table: "fa-light fa-table",
575
+ TableCellsMerge: "fa-light fa-table-cells-merge",
576
+ TableCellsSplit: "fa-light fa-table-cells-split",
577
+ Tablet: "fa-light fa-tablet",
578
+ Tablets: "fa-light fa-tablets",
579
+ Tag: "fa-light fa-tag",
580
+ Tags: "fa-light fa-tags",
581
+ Telescope: "fa-light fa-telescope",
582
+ Tent: "fa-light fa-tent",
583
+ Terminal: "fa-light fa-terminal",
584
+ Thermometer: "fa-light fa-thermometer",
585
+ ThumbsDown: "fa-light fa-thumbs-down",
586
+ ThumbsUp: "fa-light fa-thumbs-up",
587
+ Ticket: "fa-light fa-ticket",
588
+ Tickets: "fa-light fa-tickets",
589
+ Timer: "fa-light fa-timer",
590
+ Toilet: "fa-light fa-toilet",
591
+ Tornado: "fa-light fa-tornado",
592
+ TowerControl: "fa-light fa-tower-control",
593
+ Tractor: "fa-light fa-tractor",
594
+ TrafficCone: "fa-light fa-traffic-cone",
595
+ TrainTrack: "fa-light fa-train-track",
596
+ Transgender: "fa-light fa-transgender",
597
+ Trash: "fa-light fa-trash",
598
+ Trash2: "fa-light fa-trash-can",
599
+ TreeDeciduous: "fa-light fa-tree-deciduous",
600
+ TreePalm: "fa-light fa-tree-palm",
601
+ Trees: "fa-light fa-trees",
602
+ Trello: "fa-brands fa-trello",
603
+ TrendingDown: "fa-light fa-arrow-trend-down",
604
+ TrendingUp: "fa-light fa-arrow-trend-up",
605
+ Triangle: "fa-light fa-triangle",
606
+ TriangleAlert: "fa-light fa-triangle-exclamation",
607
+ Trophy: "fa-light fa-trophy",
608
+ Truck: "fa-light fa-truck",
609
+ Turntable: "fa-light fa-turntable",
610
+ Turtle: "fa-light fa-turtle",
611
+ Tv: "fa-light fa-tv",
612
+ Twitch: "fa-brands fa-twitch",
613
+ Twitter: "fa-brands fa-twitter",
614
+ Umbrella: "fa-light fa-umbrella",
615
+ Underline: "fa-light fa-underline",
616
+ UnlockKeyhole: "fa-light fa-unlock-keyhole",
617
+ Upload: "fa-light fa-upload",
618
+ Usb: "fa-brands fa-usb",
619
+ User: "fa-light fa-user",
620
+ UserCheck: "fa-light fa-user-check",
621
+ UserCircle: "fa-light fa-circle-user",
622
+ UserCog: "fa-light fa-user-gear",
623
+ UserLock: "fa-light fa-user-lock",
624
+ UserMinus: "fa-light fa-user-minus",
625
+ UserPen: "fa-light fa-user-pen",
626
+ UserPlus: "fa-light fa-user-plus",
627
+ UserRound: "fa-light fa-user",
628
+ Users: "fa-light fa-users",
629
+ UsersRound: "fa-light fa-user-group",
630
+ Utensils: "fa-light fa-utensils",
631
+ UtilityPole: "fa-light fa-utility-pole",
632
+ Van: "fa-light fa-van",
633
+ Vault: "fa-light fa-vault",
634
+ Venus: "fa-light fa-venus",
635
+ Video: "fa-light fa-video",
636
+ Voicemail: "fa-light fa-voicemail",
637
+ Volleyball: "fa-light fa-volleyball",
638
+ Volume: "fa-light fa-volume",
639
+ VolumeOff: "fa-light fa-volume-off",
640
+ Wallet: "fa-light fa-wallet",
641
+ Wand: "fa-light fa-wand",
642
+ WandSparkles: "fa-light fa-wand-sparkles",
643
+ Warehouse: "fa-light fa-warehouse",
644
+ WashingMachine: "fa-light fa-washing-machine",
645
+ Watch: "fa-light fa-watch",
646
+ Webhook: "fa-light fa-webhook",
647
+ Wheat: "fa-light fa-wheat",
648
+ Wifi: "fa-light fa-wifi",
649
+ WifiOff: "fa-light fa-wifi-slash",
650
+ Wind: "fa-light fa-wind",
651
+ Worm: "fa-light fa-worm",
652
+ Wrench: "fa-light fa-wrench",
653
+ X: "fa-light fa-xmark",
654
+ Youtube: "fa-brands fa-youtube",
655
+ Zap: "fa-light fa-bolt"
656
+ };
657
+
658
+ // ../ui/src/custom/icon-shared.ts
659
+ var LUCIDE_FA_MAP = lucide_fa_map_default;
660
+ var FALLBACK_FA = "fa-light fa-shapes";
661
+ var FA_STYLE_CLASS = {
662
+ solid: "fa-solid",
663
+ regular: "fa-regular",
664
+ light: "fa-light",
665
+ duotone: "fa-duotone",
666
+ brands: "fa-brands"
667
+ };
668
+ var STYLE_CLASS_SET = new Set(Object.values(FA_STYLE_CLASS));
669
+ function isFaIcon(name) {
670
+ return typeof name === "string" && name.startsWith("fa-");
671
+ }
672
+ function toFaValue(name) {
673
+ if (!name) return FALLBACK_FA;
674
+ if (isFaIcon(name)) return name;
675
+ return LUCIDE_FA_MAP[name] ?? FALLBACK_FA;
676
+ }
677
+ function applyIconStyleOverride(value, override) {
678
+ if (!override) return value;
679
+ const tokens = value.split(/\s+/).filter(Boolean);
680
+ if (tokens.includes("fa-brands")) return value;
681
+ const overrideClass = FA_STYLE_CLASS[override];
682
+ let replaced = false;
683
+ const next = tokens.map((token) => {
684
+ if (STYLE_CLASS_SET.has(token)) {
685
+ replaced = true;
686
+ return overrideClass;
687
+ }
688
+ return token;
689
+ });
690
+ if (!replaced) next.unshift(overrideClass);
691
+ return next.join(" ");
692
+ }
693
+ var SIZE_TOKEN = /(?:^|\s)(?:size|h|w)-(\d+(?:\.\d+)?)\b/;
694
+ function faFontSize(className) {
695
+ const match = className?.match(SIZE_TOKEN);
696
+ if (!match) return 16;
697
+ const units = Number(match[1]);
698
+ return Number.isFinite(units) ? units * 4 : 16;
699
+ }
700
+
701
+ // ../ui/src/custom/icon.tsx
702
+ import { jsx } from "react/jsx-runtime";
703
+ var IconStyleOverrideContext = createContext(
704
+ null
705
+ );
706
+ function FaIcon({
707
+ value,
708
+ className,
709
+ style
710
+ }) {
711
+ const override = useContext(IconStyleOverrideContext);
712
+ const resolved = applyIconStyleOverride(value, override);
713
+ return /* @__PURE__ */ jsx(
714
+ "i",
715
+ {
716
+ className: cn(resolved, "inline-block leading-none", className),
717
+ style: { fontSize: faFontSize(className), ...style },
718
+ "aria-hidden": "true"
719
+ }
720
+ );
721
+ }
722
+ function Icon({ name, className, style }) {
723
+ return /* @__PURE__ */ jsx(FaIcon, { value: toFaValue(name), className, style });
724
+ }
725
+
726
+ // src/_impl/spinner.tsx
727
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
728
+ function Spinner({ className, ...props }) {
729
+ return /* @__PURE__ */ jsx2("span", { role: "status", "aria-label": "Loading", ...props, children: /* @__PURE__ */ jsxs(
730
+ "svg",
731
+ {
732
+ viewBox: "0 0 24 24",
733
+ fill: "none",
734
+ "aria-hidden": "true",
735
+ focusable: "false",
736
+ className: cn(
737
+ "text-muted-foreground size-6 animate-spin motion-reduce:animate-none",
738
+ className
739
+ ),
740
+ children: [
741
+ /* @__PURE__ */ jsx2(
742
+ "circle",
743
+ {
744
+ cx: "12",
745
+ cy: "12",
746
+ r: "9",
747
+ stroke: "currentColor",
748
+ strokeWidth: "2.5",
749
+ className: "opacity-20"
750
+ }
751
+ ),
752
+ /* @__PURE__ */ jsx2(
753
+ "path",
754
+ {
755
+ d: "M21 12a9 9 0 0 0-9-9",
756
+ stroke: "currentColor",
757
+ strokeWidth: "2.5",
758
+ strokeLinecap: "round"
759
+ }
760
+ )
761
+ ]
762
+ }
763
+ ) });
764
+ }
765
+
766
+ // ../ui/src/shadcn/command.tsx
767
+ import { Command as CommandPrimitive } from "cmdk";
768
+
769
+ // ../ui/src/shadcn/dialog.tsx
770
+ import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
771
+
772
+ // ../ui/src/shadcn/button.tsx
773
+ import { Button as ButtonPrimitive } from "@base-ui/react/button";
774
+ import { cva } from "class-variance-authority";
775
+ import { jsx as jsx3 } from "react/jsx-runtime";
776
+ var buttonVariants = cva(
777
+ "focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
778
+ {
779
+ variants: {
780
+ variant: {
781
+ default: "bg-primary-strong text-primary-foreground hover:bg-primary-strong/90",
782
+ destructive: "bg-destructive hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 text-destructive-foreground",
783
+ outline: "bg-background hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50 border shadow-xs",
784
+ success: "bg-success-strong text-success-foreground hover:bg-success-strong/90 focus-visible:ring-success-strong/30",
785
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
786
+ ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
787
+ link: "text-primary underline-offset-4 hover:underline"
788
+ },
789
+ size: {
790
+ default: "h-9 px-4 py-2 has-[>svg]:px-3",
791
+ xs: "h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",
792
+ sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",
793
+ lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
794
+ icon: "size-9",
795
+ "icon-xs": "size-6 rounded-md [&_svg:not([class*='size-'])]:size-3",
796
+ "icon-sm": "size-8",
797
+ "icon-lg": "size-10"
798
+ }
799
+ },
800
+ defaultVariants: {
801
+ variant: "default",
802
+ size: "default"
803
+ }
804
+ }
805
+ );
806
+ function Button({
807
+ className,
808
+ variant = "default",
809
+ size = "default",
810
+ ...props
811
+ }) {
812
+ return /* @__PURE__ */ jsx3(
813
+ ButtonPrimitive,
814
+ {
815
+ "data-slot": "button",
816
+ "data-variant": variant,
817
+ "data-size": size,
818
+ className: cn(buttonVariants({ variant, size, className })),
819
+ ...props
820
+ }
821
+ );
822
+ }
823
+
824
+ // ../ui/src/shadcn/dialog.tsx
825
+ import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
826
+
827
+ // ../ui/src/shadcn/command.tsx
828
+ import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
829
+ function Command({
830
+ className,
831
+ ...props
832
+ }) {
833
+ return /* @__PURE__ */ jsx5(
834
+ CommandPrimitive,
835
+ {
836
+ "data-slot": "command",
837
+ className: cn(
838
+ "bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",
839
+ className
840
+ ),
841
+ ...props
842
+ }
843
+ );
844
+ }
845
+ function CommandInput({
846
+ className,
847
+ ...props
848
+ }) {
849
+ return /* @__PURE__ */ jsxs3(
850
+ "div",
851
+ {
852
+ "data-slot": "command-input-wrapper",
853
+ className: "flex h-9 items-center gap-2 border-b px-3",
854
+ children: [
855
+ /* @__PURE__ */ jsx5(
856
+ Icon,
857
+ {
858
+ name: "fa-light fa-magnifying-glass",
859
+ className: "size-4 shrink-0 opacity-50"
860
+ }
861
+ ),
862
+ /* @__PURE__ */ jsx5(
863
+ CommandPrimitive.Input,
864
+ {
865
+ "data-slot": "command-input",
866
+ className: cn(
867
+ "placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",
868
+ className
869
+ ),
870
+ ...props
871
+ }
872
+ )
873
+ ]
874
+ }
875
+ );
876
+ }
877
+ function CommandList({
878
+ className,
879
+ ...props
880
+ }) {
881
+ return /* @__PURE__ */ jsx5(
882
+ CommandPrimitive.List,
883
+ {
884
+ "data-slot": "command-list",
885
+ className: cn(
886
+ "max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",
887
+ className
888
+ ),
889
+ ...props
890
+ }
891
+ );
892
+ }
893
+ function CommandEmpty({
894
+ ...props
895
+ }) {
896
+ return /* @__PURE__ */ jsx5(
897
+ CommandPrimitive.Empty,
898
+ {
899
+ "data-slot": "command-empty",
900
+ className: "py-6 text-center text-sm",
901
+ ...props
902
+ }
903
+ );
904
+ }
905
+ function CommandGroup({
906
+ className,
907
+ ...props
908
+ }) {
909
+ return /* @__PURE__ */ jsx5(
910
+ CommandPrimitive.Group,
911
+ {
912
+ "data-slot": "command-group",
913
+ className: cn(
914
+ "text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",
915
+ className
916
+ ),
917
+ ...props
918
+ }
919
+ );
920
+ }
921
+ function CommandSeparator({
922
+ className,
923
+ ...props
924
+ }) {
925
+ return /* @__PURE__ */ jsx5(
926
+ CommandPrimitive.Separator,
927
+ {
928
+ "data-slot": "command-separator",
929
+ className: cn("bg-border -mx-1 h-px", className),
930
+ ...props
931
+ }
932
+ );
933
+ }
934
+ function CommandItem({
935
+ className,
936
+ ...props
937
+ }) {
938
+ return /* @__PURE__ */ jsx5(
939
+ CommandPrimitive.Item,
940
+ {
941
+ "data-slot": "command-item",
942
+ className: cn(
943
+ "data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
944
+ className
945
+ ),
946
+ ...props
947
+ }
948
+ );
949
+ }
950
+
951
+ // ../ui/src/shadcn/dropdown-menu.tsx
952
+ import { Menu as MenuPrimitive } from "@base-ui/react/menu";
953
+ import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
954
+ function DropdownMenu({ ...props }) {
955
+ return /* @__PURE__ */ jsx6(MenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
956
+ }
957
+ function DropdownMenuTrigger({ ...props }) {
958
+ return /* @__PURE__ */ jsx6(MenuPrimitive.Trigger, { "data-slot": "dropdown-menu-trigger", ...props });
959
+ }
960
+ function DropdownMenuContent({
961
+ className,
962
+ align = "start",
963
+ alignOffset = 0,
964
+ side = "bottom",
965
+ sideOffset = 4,
966
+ ...props
967
+ }) {
968
+ return /* @__PURE__ */ jsx6(MenuPrimitive.Portal, { children: /* @__PURE__ */ jsx6(
969
+ MenuPrimitive.Positioner,
970
+ {
971
+ align,
972
+ alignOffset,
973
+ side,
974
+ sideOffset,
975
+ className: "isolate z-50 outline-none",
976
+ children: /* @__PURE__ */ jsx6(
977
+ MenuPrimitive.Popup,
978
+ {
979
+ "data-slot": "dropdown-menu-content",
980
+ className: cn(
981
+ "bg-popover text-popover-foreground z-50 max-h-(--available-height) min-w-[8rem] origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md transition-[translate,scale,opacity] outline-none data-closed:overflow-hidden data-ending-style:scale-95 data-ending-style:opacity-0 data-starting-style:scale-95 data-starting-style:opacity-0 data-[side=bottom]:data-starting-style:-translate-y-2 data-[side=left]:data-starting-style:translate-x-2 data-[side=right]:data-starting-style:-translate-x-2 data-[side=top]:data-starting-style:translate-y-2",
982
+ className
983
+ ),
984
+ ...props
985
+ }
986
+ )
987
+ }
988
+ ) });
989
+ }
990
+ function DropdownMenuItem({
991
+ className,
992
+ inset,
993
+ variant = "default",
994
+ ...props
995
+ }) {
996
+ return /* @__PURE__ */ jsx6(
997
+ MenuPrimitive.Item,
998
+ {
999
+ "data-slot": "dropdown-menu-item",
1000
+ "data-inset": inset,
1001
+ "data-variant": variant,
1002
+ className: cn(
1003
+ "data-highlighted:bg-accent data-highlighted:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:data-highlighted:bg-destructive/10 data-[variant=destructive]:data-highlighted:text-destructive dark:data-[variant=destructive]:data-highlighted:bg-destructive/20 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive! relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
1004
+ className
1005
+ ),
1006
+ ...props
1007
+ }
1008
+ );
1009
+ }
1010
+
1011
+ // ../ui/src/shadcn/hover-card.tsx
1012
+ import * as React from "react";
1013
+ import { PreviewCard as PreviewCardPrimitive } from "@base-ui/react/preview-card";
1014
+ import { jsx as jsx7 } from "react/jsx-runtime";
1015
+ var HoverCardDelayContext = React.createContext({});
1016
+ function HoverCard({
1017
+ openDelay,
1018
+ closeDelay,
1019
+ ...props
1020
+ }) {
1021
+ const delays = React.useMemo(
1022
+ () => ({ openDelay, closeDelay }),
1023
+ [openDelay, closeDelay]
1024
+ );
1025
+ return /* @__PURE__ */ jsx7(HoverCardDelayContext.Provider, { value: delays, children: /* @__PURE__ */ jsx7(PreviewCardPrimitive.Root, { "data-slot": "hover-card", ...props }) });
1026
+ }
1027
+ function HoverCardTrigger({
1028
+ delay,
1029
+ closeDelay,
1030
+ ...props
1031
+ }) {
1032
+ const delays = React.useContext(HoverCardDelayContext);
1033
+ return /* @__PURE__ */ jsx7(
1034
+ PreviewCardPrimitive.Trigger,
1035
+ {
1036
+ "data-slot": "hover-card-trigger",
1037
+ delay: delay ?? delays.openDelay,
1038
+ closeDelay: closeDelay ?? delays.closeDelay,
1039
+ ...props
1040
+ }
1041
+ );
1042
+ }
1043
+ function HoverCardContent({
1044
+ className,
1045
+ align = "center",
1046
+ alignOffset = 0,
1047
+ side = "bottom",
1048
+ sideOffset = 4,
1049
+ ...props
1050
+ }) {
1051
+ return /* @__PURE__ */ jsx7(PreviewCardPrimitive.Portal, { "data-slot": "hover-card-portal", children: /* @__PURE__ */ jsx7(
1052
+ PreviewCardPrimitive.Positioner,
1053
+ {
1054
+ align,
1055
+ alignOffset,
1056
+ side,
1057
+ sideOffset,
1058
+ className: "isolate z-50",
1059
+ children: /* @__PURE__ */ jsx7(
1060
+ PreviewCardPrimitive.Popup,
1061
+ {
1062
+ "data-slot": "hover-card-content",
1063
+ className: cn(
1064
+ "bg-popover text-popover-foreground z-50 w-64 origin-(--transform-origin) rounded-md border p-4 shadow-md outline-hidden transition-[translate,scale,opacity] data-ending-style:scale-95 data-ending-style:opacity-0 data-starting-style:scale-95 data-starting-style:opacity-0 data-[side=bottom]:data-starting-style:-translate-y-2 data-[side=left]:data-starting-style:translate-x-2 data-[side=right]:data-starting-style:-translate-x-2 data-[side=top]:data-starting-style:translate-y-2",
1065
+ className
1066
+ ),
1067
+ ...props
1068
+ }
1069
+ )
1070
+ }
1071
+ ) });
1072
+ }
1073
+
1074
+ // ../ui/src/shadcn/input-group.tsx
1075
+ import { cva as cva2 } from "class-variance-authority";
1076
+
1077
+ // ../ui/src/shadcn/input.tsx
1078
+ import { jsx as jsx8 } from "react/jsx-runtime";
1079
+
1080
+ // ../ui/src/shadcn/textarea.tsx
1081
+ import { jsx as jsx9 } from "react/jsx-runtime";
1082
+ function Textarea({ className, ...props }) {
1083
+ return /* @__PURE__ */ jsx9(
1084
+ "textarea",
1085
+ {
1086
+ "data-slot": "textarea",
1087
+ className: cn(
1088
+ "border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:aria-invalid:ring-destructive/40 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
1089
+ className
1090
+ ),
1091
+ ...props
1092
+ }
1093
+ );
1094
+ }
1095
+
1096
+ // ../ui/src/shadcn/input-group.tsx
1097
+ import { jsx as jsx10 } from "react/jsx-runtime";
1098
+ function InputGroup({ className, ...props }) {
1099
+ return /* @__PURE__ */ jsx10(
1100
+ "div",
1101
+ {
1102
+ "data-slot": "input-group",
1103
+ role: "group",
1104
+ className: cn(
1105
+ "group/input-group border-input dark:bg-input/30 relative flex w-full items-center rounded-md border shadow-xs transition-[color,box-shadow] outline-none",
1106
+ "h-9 min-w-0 has-[>textarea]:h-auto",
1107
+ // Variants based on alignment.
1108
+ "has-[>[data-align=inline-start]]:[&>input]:pl-2",
1109
+ "has-[>[data-align=inline-end]]:[&>input]:pr-2",
1110
+ "has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3",
1111
+ "has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3",
1112
+ // Focus state.
1113
+ "has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot=input-group-control]:focus-visible]:ring-[3px]",
1114
+ // Error state.
1115
+ "has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-destructive/20 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",
1116
+ className
1117
+ ),
1118
+ ...props
1119
+ }
1120
+ );
1121
+ }
1122
+ var inputGroupAddonVariants = cva2(
1123
+ "text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",
1124
+ {
1125
+ variants: {
1126
+ align: {
1127
+ "inline-start": "order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]",
1128
+ "inline-end": "order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]",
1129
+ "block-start": "order-first w-full justify-start px-3 pt-3 group-has-[>input]/input-group:pt-2.5 [.border-b]:pb-3",
1130
+ "block-end": "order-last w-full justify-start px-3 pb-3 group-has-[>input]/input-group:pb-2.5 [.border-t]:pt-3"
1131
+ }
1132
+ },
1133
+ defaultVariants: {
1134
+ align: "inline-start"
1135
+ }
1136
+ }
1137
+ );
1138
+ function InputGroupAddon({
1139
+ className,
1140
+ align = "inline-start",
1141
+ ...props
1142
+ }) {
1143
+ return /* @__PURE__ */ jsx10(
1144
+ "div",
1145
+ {
1146
+ role: "group",
1147
+ "data-slot": "input-group-addon",
1148
+ "data-align": align,
1149
+ className: cn(inputGroupAddonVariants({ align }), className),
1150
+ onClick: (e) => {
1151
+ if (e.target.closest("button")) {
1152
+ return;
1153
+ }
1154
+ e.currentTarget.parentElement?.querySelector("input")?.focus();
1155
+ },
1156
+ ...props
1157
+ }
1158
+ );
1159
+ }
1160
+ var inputGroupButtonVariants = cva2(
1161
+ "flex items-center gap-2 text-sm shadow-none",
1162
+ {
1163
+ variants: {
1164
+ size: {
1165
+ xs: "h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-2 has-[>svg]:px-2 [&>svg:not([class*='size-'])]:size-3.5",
1166
+ sm: "h-8 gap-1.5 rounded-md px-2.5 has-[>svg]:px-2.5",
1167
+ "icon-xs": "size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0",
1168
+ "icon-sm": "size-8 p-0 has-[>svg]:p-0"
1169
+ }
1170
+ },
1171
+ defaultVariants: {
1172
+ size: "xs"
1173
+ }
1174
+ }
1175
+ );
1176
+ function InputGroupButton({
1177
+ className,
1178
+ type = "button",
1179
+ variant = "ghost",
1180
+ size = "xs",
1181
+ ...props
1182
+ }) {
1183
+ return /* @__PURE__ */ jsx10(
1184
+ Button,
1185
+ {
1186
+ type,
1187
+ "data-size": size,
1188
+ variant,
1189
+ className: cn(inputGroupButtonVariants({ size }), className),
1190
+ ...props
1191
+ }
1192
+ );
1193
+ }
1194
+ function InputGroupTextarea({
1195
+ className,
1196
+ ...props
1197
+ }) {
1198
+ return /* @__PURE__ */ jsx10(
1199
+ Textarea,
1200
+ {
1201
+ "data-slot": "input-group-control",
1202
+ className: cn(
1203
+ "flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent",
1204
+ className
1205
+ ),
1206
+ ...props
1207
+ }
1208
+ );
1209
+ }
1210
+
1211
+ // ../ui/src/shadcn/select.tsx
1212
+ import * as React2 from "react";
1213
+ import { Select as SelectPrimitive } from "@base-ui/react/select";
1214
+ import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
1215
+ function collectOptions(node, options) {
1216
+ React2.Children.forEach(node, (child) => {
1217
+ if (!React2.isValidElement(
1218
+ child
1219
+ )) {
1220
+ return;
1221
+ }
1222
+ if (child.type === SelectItem || child.type === SelectPrimitive.Item) {
1223
+ if (child.props.value !== void 0) {
1224
+ options.push({ value: child.props.value, label: child.props.children });
1225
+ }
1226
+ return;
1227
+ }
1228
+ collectOptions(child.props.children, options);
1229
+ });
1230
+ }
1231
+ function deriveItems(children) {
1232
+ const options = [];
1233
+ collectOptions(children, options);
1234
+ return options.length > 0 ? options : void 0;
1235
+ }
1236
+ function Select({
1237
+ children,
1238
+ items,
1239
+ ...props
1240
+ }) {
1241
+ return /* @__PURE__ */ jsx11(SelectPrimitive.Root, { items: items ?? deriveItems(children), ...props, children });
1242
+ }
1243
+ function SelectValue({ className, ...props }) {
1244
+ return /* @__PURE__ */ jsx11(
1245
+ SelectPrimitive.Value,
1246
+ {
1247
+ "data-slot": "select-value",
1248
+ className: cn("flex flex-1 text-left", className),
1249
+ ...props
1250
+ }
1251
+ );
1252
+ }
1253
+ function SelectTrigger({
1254
+ className,
1255
+ size = "default",
1256
+ children,
1257
+ ...props
1258
+ }) {
1259
+ return /* @__PURE__ */ jsxs5(
1260
+ SelectPrimitive.Trigger,
1261
+ {
1262
+ "data-slot": "select-trigger",
1263
+ "data-size": size,
1264
+ className: cn(
1265
+ "border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:ring-destructive/40 [&_svg:not([class*='text-'])]:text-muted-foreground flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
1266
+ className
1267
+ ),
1268
+ ...props,
1269
+ children: [
1270
+ children,
1271
+ /* @__PURE__ */ jsx11(
1272
+ SelectPrimitive.Icon,
1273
+ {
1274
+ render: /* @__PURE__ */ jsx11(
1275
+ Icon,
1276
+ {
1277
+ name: "fa-light fa-chevron-down",
1278
+ className: "size-4 opacity-50"
1279
+ }
1280
+ )
1281
+ }
1282
+ )
1283
+ ]
1284
+ }
1285
+ );
1286
+ }
1287
+ function SelectContent({
1288
+ className,
1289
+ children,
1290
+ side = "bottom",
1291
+ sideOffset = 4,
1292
+ align = "start",
1293
+ alignOffset = 0,
1294
+ // Base UI defaults this to true, which overlaps the popup on top of the
1295
+ // trigger (native macOS select behaviour) for mouse input. That hides the
1296
+ // control being edited, so the dropdown drops below the trigger instead.
1297
+ alignItemWithTrigger = false,
1298
+ ...props
1299
+ }) {
1300
+ return /* @__PURE__ */ jsx11(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsx11(
1301
+ SelectPrimitive.Positioner,
1302
+ {
1303
+ side,
1304
+ sideOffset,
1305
+ align,
1306
+ alignOffset,
1307
+ alignItemWithTrigger,
1308
+ className: "isolate z-50",
1309
+ children: /* @__PURE__ */ jsxs5(
1310
+ SelectPrimitive.Popup,
1311
+ {
1312
+ "data-slot": "select-content",
1313
+ className: cn(
1314
+ "bg-popover text-popover-foreground relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md transition-[translate,scale,opacity] data-ending-style:scale-95 data-ending-style:opacity-0 data-starting-style:scale-95 data-starting-style:opacity-0",
1315
+ className
1316
+ ),
1317
+ ...props,
1318
+ children: [
1319
+ /* @__PURE__ */ jsx11(SelectScrollUpButton, {}),
1320
+ /* @__PURE__ */ jsx11(SelectPrimitive.List, { children }),
1321
+ /* @__PURE__ */ jsx11(SelectScrollDownButton, {})
1322
+ ]
1323
+ }
1324
+ )
1325
+ }
1326
+ ) });
1327
+ }
1328
+ function SelectItem({
1329
+ className,
1330
+ children,
1331
+ ...props
1332
+ }) {
1333
+ return /* @__PURE__ */ jsxs5(
1334
+ SelectPrimitive.Item,
1335
+ {
1336
+ "data-slot": "select-item",
1337
+ className: cn(
1338
+ "data-highlighted:bg-accent data-highlighted:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
1339
+ className
1340
+ ),
1341
+ ...props,
1342
+ children: [
1343
+ /* @__PURE__ */ jsx11(SelectPrimitive.ItemText, { className: "flex flex-1 shrink-0 gap-2 whitespace-nowrap", children }),
1344
+ /* @__PURE__ */ jsx11(
1345
+ SelectPrimitive.ItemIndicator,
1346
+ {
1347
+ render: /* @__PURE__ */ jsx11(
1348
+ "span",
1349
+ {
1350
+ "data-slot": "select-item-indicator",
1351
+ className: "absolute right-2 flex size-3.5 items-center justify-center"
1352
+ }
1353
+ ),
1354
+ children: /* @__PURE__ */ jsx11(Icon, { name: "fa-light fa-check", className: "size-4" })
1355
+ }
1356
+ )
1357
+ ]
1358
+ }
1359
+ );
1360
+ }
1361
+ function SelectScrollUpButton({
1362
+ className,
1363
+ ...props
1364
+ }) {
1365
+ return /* @__PURE__ */ jsx11(
1366
+ SelectPrimitive.ScrollUpArrow,
1367
+ {
1368
+ "data-slot": "select-scroll-up-button",
1369
+ className: cn(
1370
+ "bg-popover top-0 flex w-full cursor-default items-center justify-center py-1",
1371
+ className
1372
+ ),
1373
+ ...props,
1374
+ children: /* @__PURE__ */ jsx11(Icon, { name: "fa-light fa-chevron-up", className: "size-4" })
1375
+ }
1376
+ );
1377
+ }
1378
+ function SelectScrollDownButton({
1379
+ className,
1380
+ ...props
1381
+ }) {
1382
+ return /* @__PURE__ */ jsx11(
1383
+ SelectPrimitive.ScrollDownArrow,
1384
+ {
1385
+ "data-slot": "select-scroll-down-button",
1386
+ className: cn(
1387
+ "bg-popover bottom-0 flex w-full cursor-default items-center justify-center py-1",
1388
+ className
1389
+ ),
1390
+ ...props,
1391
+ children: /* @__PURE__ */ jsx11(Icon, { name: "fa-light fa-chevron-down", className: "size-4" })
1392
+ }
1393
+ );
1394
+ }
1395
+
1396
+ // ../ui/src/shadcn/tooltip.tsx
1397
+ import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip";
1398
+ import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
1399
+ function Tooltip({ ...props }) {
1400
+ return /* @__PURE__ */ jsx12(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props });
1401
+ }
1402
+ function TooltipTrigger({ ...props }) {
1403
+ return /* @__PURE__ */ jsx12(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", ...props });
1404
+ }
1405
+ function TooltipContent({
1406
+ className,
1407
+ side = "top",
1408
+ sideOffset = 4,
1409
+ align = "center",
1410
+ alignOffset = 0,
1411
+ children,
1412
+ ...props
1413
+ }) {
1414
+ return /* @__PURE__ */ jsx12(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsx12(
1415
+ TooltipPrimitive.Positioner,
1416
+ {
1417
+ side,
1418
+ sideOffset,
1419
+ align,
1420
+ alignOffset,
1421
+ className: "isolate z-50",
1422
+ children: /* @__PURE__ */ jsxs6(
1423
+ TooltipPrimitive.Popup,
1424
+ {
1425
+ "data-slot": "tooltip-content",
1426
+ className: cn(
1427
+ "bg-foreground text-background z-50 w-fit origin-(--transform-origin) rounded-md px-3 py-1.5 text-xs text-balance transition-[translate,scale,opacity] data-ending-style:scale-95 data-ending-style:opacity-0 data-starting-style:scale-95 data-starting-style:opacity-0 data-[side=bottom]:data-starting-style:-translate-y-2 data-[side=left]:data-starting-style:translate-x-2 data-[side=right]:data-starting-style:-translate-x-2 data-[side=top]:data-starting-style:translate-y-2",
1428
+ className
1429
+ ),
1430
+ ...props,
1431
+ children: [
1432
+ children,
1433
+ /* @__PURE__ */ jsx12(TooltipPrimitive.Arrow, { className: "bg-foreground fill-foreground z-50 size-2.5 rotate-45 rounded-[2px] data-[side=bottom]:-top-1 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-1" })
1434
+ ]
1435
+ }
1436
+ )
1437
+ }
1438
+ ) });
1439
+ }
1440
+
1441
+ // ../ui/src/ai-elements/prompt-input.tsx
1442
+ import { Fragment, jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
1443
+ var convertBlobUrlToDataUrl = async (url) => {
1444
+ try {
1445
+ const response = await fetch(url);
1446
+ const blob = await response.blob();
1447
+ return new Promise((resolve) => {
1448
+ const reader = new FileReader();
1449
+ reader.onloadend = () => resolve(reader.result);
1450
+ reader.onerror = () => resolve(null);
1451
+ reader.readAsDataURL(blob);
1452
+ });
1453
+ } catch {
1454
+ return null;
1455
+ }
1456
+ };
1457
+ var captureScreenshot = async () => {
1458
+ if (typeof navigator === "undefined" || !navigator.mediaDevices?.getDisplayMedia) {
1459
+ return null;
1460
+ }
1461
+ let stream = null;
1462
+ const video = document.createElement("video");
1463
+ video.muted = true;
1464
+ video.playsInline = true;
1465
+ try {
1466
+ stream = await navigator.mediaDevices.getDisplayMedia({
1467
+ audio: false,
1468
+ video: true
1469
+ });
1470
+ video.srcObject = stream;
1471
+ await new Promise((resolve, reject) => {
1472
+ video.onloadedmetadata = () => resolve();
1473
+ video.onerror = () => reject(new Error("Failed to load screen stream"));
1474
+ });
1475
+ await video.play();
1476
+ const width = video.videoWidth;
1477
+ const height = video.videoHeight;
1478
+ if (!width || !height) {
1479
+ return null;
1480
+ }
1481
+ const canvas = document.createElement("canvas");
1482
+ canvas.width = width;
1483
+ canvas.height = height;
1484
+ const context = canvas.getContext("2d");
1485
+ if (!context) {
1486
+ return null;
1487
+ }
1488
+ context.drawImage(video, 0, 0, width, height);
1489
+ const blob = await new Promise((resolve) => {
1490
+ canvas.toBlob(resolve, "image/png");
1491
+ });
1492
+ if (!blob) {
1493
+ return null;
1494
+ }
1495
+ const timestamp = (/* @__PURE__ */ new Date()).toISOString().replaceAll(/[:.]/g, "-").replace("T", "_").replace("Z", "");
1496
+ return new File([blob], `screenshot-${timestamp}.png`, {
1497
+ lastModified: Date.now(),
1498
+ type: "image/png"
1499
+ });
1500
+ } finally {
1501
+ if (stream) {
1502
+ for (const track of stream.getTracks()) {
1503
+ track.stop();
1504
+ }
1505
+ }
1506
+ video.pause();
1507
+ video.srcObject = null;
1508
+ }
1509
+ };
1510
+ var PromptInputController = createContext3(
1511
+ null
1512
+ );
1513
+ var ProviderAttachmentsContext = createContext3(
1514
+ null
1515
+ );
1516
+ var usePromptInputController = () => {
1517
+ const ctx = useContext3(PromptInputController);
1518
+ if (!ctx) {
1519
+ throw new Error(
1520
+ "Wrap your component inside <PromptInputProvider> to use usePromptInputController()."
1521
+ );
1522
+ }
1523
+ return ctx;
1524
+ };
1525
+ var useOptionalPromptInputController = () => useContext3(PromptInputController);
1526
+ var useProviderAttachments = () => {
1527
+ const ctx = useContext3(ProviderAttachmentsContext);
1528
+ if (!ctx) {
1529
+ throw new Error(
1530
+ "Wrap your component inside <PromptInputProvider> to use useProviderAttachments()."
1531
+ );
1532
+ }
1533
+ return ctx;
1534
+ };
1535
+ var useOptionalProviderAttachments = () => useContext3(ProviderAttachmentsContext);
1536
+ var PromptInputProvider = ({
1537
+ initialInput: initialTextInput = "",
1538
+ children
1539
+ }) => {
1540
+ const [textInput, setTextInput] = useState(initialTextInput);
1541
+ const clearInput = useCallback(() => setTextInput(""), []);
1542
+ const [attachmentFiles, setAttachmentFiles] = useState([]);
1543
+ const fileInputRef = useRef(null);
1544
+ const openRef = useRef(() => {
1545
+ });
1546
+ const add = useCallback((files) => {
1547
+ const incoming = [...files];
1548
+ if (incoming.length === 0) {
1549
+ return;
1550
+ }
1551
+ setAttachmentFiles((prev) => [
1552
+ ...prev,
1553
+ ...incoming.map((file) => ({
1554
+ filename: file.name,
1555
+ id: nanoid(),
1556
+ mediaType: file.type,
1557
+ type: "file",
1558
+ url: URL.createObjectURL(file)
1559
+ }))
1560
+ ]);
1561
+ }, []);
1562
+ const remove = useCallback((id) => {
1563
+ setAttachmentFiles((prev) => {
1564
+ const found = prev.find((f) => f.id === id);
1565
+ if (found?.url) {
1566
+ URL.revokeObjectURL(found.url);
1567
+ }
1568
+ return prev.filter((f) => f.id !== id);
1569
+ });
1570
+ }, []);
1571
+ const clear = useCallback(() => {
1572
+ setAttachmentFiles((prev) => {
1573
+ for (const f of prev) {
1574
+ if (f.url) {
1575
+ URL.revokeObjectURL(f.url);
1576
+ }
1577
+ }
1578
+ return [];
1579
+ });
1580
+ }, []);
1581
+ const attachmentsRef = useRef(attachmentFiles);
1582
+ useEffect(() => {
1583
+ attachmentsRef.current = attachmentFiles;
1584
+ }, [attachmentFiles]);
1585
+ useEffect(
1586
+ () => () => {
1587
+ for (const f of attachmentsRef.current) {
1588
+ if (f.url) {
1589
+ URL.revokeObjectURL(f.url);
1590
+ }
1591
+ }
1592
+ },
1593
+ []
1594
+ );
1595
+ const openFileDialog = useCallback(() => {
1596
+ openRef.current?.();
1597
+ }, []);
1598
+ const attachments = useMemo2(
1599
+ () => ({
1600
+ add,
1601
+ clear,
1602
+ fileInputRef,
1603
+ files: attachmentFiles,
1604
+ openFileDialog,
1605
+ remove
1606
+ }),
1607
+ [attachmentFiles, add, remove, clear, openFileDialog]
1608
+ );
1609
+ const __registerFileInput = useCallback(
1610
+ (ref, open) => {
1611
+ fileInputRef.current = ref.current;
1612
+ openRef.current = open;
1613
+ },
1614
+ []
1615
+ );
1616
+ const controller = useMemo2(
1617
+ () => ({
1618
+ __registerFileInput,
1619
+ attachments,
1620
+ textInput: {
1621
+ clear: clearInput,
1622
+ setInput: setTextInput,
1623
+ value: textInput
1624
+ }
1625
+ }),
1626
+ [textInput, clearInput, attachments, __registerFileInput]
1627
+ );
1628
+ return /* @__PURE__ */ jsx13(PromptInputController.Provider, { value: controller, children: /* @__PURE__ */ jsx13(ProviderAttachmentsContext.Provider, { value: attachments, children }) });
1629
+ };
1630
+ var LocalAttachmentsContext = createContext3(null);
1631
+ var usePromptInputAttachments = () => {
1632
+ const provider = useOptionalProviderAttachments();
1633
+ const local = useContext3(LocalAttachmentsContext);
1634
+ const context = local ?? provider;
1635
+ if (!context) {
1636
+ throw new Error(
1637
+ "usePromptInputAttachments must be used within a PromptInput or PromptInputProvider"
1638
+ );
1639
+ }
1640
+ return context;
1641
+ };
1642
+ var LocalReferencedSourcesContext = createContext3(null);
1643
+ var usePromptInputReferencedSources = () => {
1644
+ const ctx = useContext3(LocalReferencedSourcesContext);
1645
+ if (!ctx) {
1646
+ throw new Error(
1647
+ "usePromptInputReferencedSources must be used within a LocalReferencedSourcesContext.Provider"
1648
+ );
1649
+ }
1650
+ return ctx;
1651
+ };
1652
+ var PromptInputActionAddAttachments = ({
1653
+ label = "Add photos or files",
1654
+ ...props
1655
+ }) => {
1656
+ const attachments = usePromptInputAttachments();
1657
+ const handleClick = useCallback(() => {
1658
+ attachments.openFileDialog();
1659
+ }, [attachments]);
1660
+ return (
1661
+ // closeOnClick={false} preserves the radix-era preventDefault behavior:
1662
+ // the menu stays open while the file dialog comes up.
1663
+ /* @__PURE__ */ jsxs7(DropdownMenuItem, { ...props, closeOnClick: false, onClick: handleClick, children: [
1664
+ /* @__PURE__ */ jsx13(Icon, { name: "fa-light fa-image", className: "mr-2 size-4" }),
1665
+ " ",
1666
+ label
1667
+ ] })
1668
+ );
1669
+ };
1670
+ var PromptInputActionAddScreenshot = ({
1671
+ label = "Take screenshot",
1672
+ onClick,
1673
+ ...props
1674
+ }) => {
1675
+ const attachments = usePromptInputAttachments();
1676
+ const handleClick = useCallback(
1677
+ async (event) => {
1678
+ onClick?.(event);
1679
+ if (event.defaultPrevented) {
1680
+ return;
1681
+ }
1682
+ try {
1683
+ const screenshot = await captureScreenshot();
1684
+ if (screenshot) {
1685
+ attachments.add([screenshot]);
1686
+ }
1687
+ } catch (error) {
1688
+ if (error instanceof DOMException && (error.name === "NotAllowedError" || error.name === "AbortError")) {
1689
+ return;
1690
+ }
1691
+ throw error;
1692
+ }
1693
+ },
1694
+ [onClick, attachments]
1695
+ );
1696
+ return /* @__PURE__ */ jsxs7(DropdownMenuItem, { ...props, onClick: handleClick, children: [
1697
+ /* @__PURE__ */ jsx13(Icon, { name: "fa-light fa-display", className: "mr-2 size-4" }),
1698
+ label
1699
+ ] });
1700
+ };
1701
+ var PromptInput = ({
1702
+ className,
1703
+ accept,
1704
+ multiple,
1705
+ globalDrop,
1706
+ syncHiddenInput,
1707
+ maxFiles,
1708
+ maxFileSize,
1709
+ inputGroupClassName,
1710
+ onError,
1711
+ onSubmit,
1712
+ children,
1713
+ ...props
1714
+ }) => {
1715
+ const controller = useOptionalPromptInputController();
1716
+ const usingProvider = !!controller;
1717
+ const inputRef = useRef(null);
1718
+ const formRef = useRef(null);
1719
+ const [items, setItems] = useState([]);
1720
+ const files = usingProvider ? controller.attachments.files : items;
1721
+ const [referencedSources, setReferencedSources] = useState([]);
1722
+ const filesRef = useRef(files);
1723
+ useEffect(() => {
1724
+ filesRef.current = files;
1725
+ }, [files]);
1726
+ const openFileDialogLocal = useCallback(() => {
1727
+ inputRef.current?.click();
1728
+ }, []);
1729
+ const matchesAccept = useCallback(
1730
+ (f) => {
1731
+ if (!accept || accept.trim() === "") {
1732
+ return true;
1733
+ }
1734
+ const patterns = accept.split(",").map((s) => s.trim()).filter(Boolean);
1735
+ return patterns.some((pattern) => {
1736
+ if (pattern.startsWith(".")) {
1737
+ return f.name.toLowerCase().endsWith(pattern.toLowerCase());
1738
+ }
1739
+ if (pattern.endsWith("/*")) {
1740
+ const prefix = pattern.slice(0, -1);
1741
+ return f.type.startsWith(prefix);
1742
+ }
1743
+ return f.type === pattern;
1744
+ });
1745
+ },
1746
+ [accept]
1747
+ );
1748
+ const addLocal = useCallback(
1749
+ (fileList) => {
1750
+ const incoming = [...fileList];
1751
+ const accepted = incoming.filter((f) => matchesAccept(f));
1752
+ if (incoming.length && accepted.length === 0) {
1753
+ onError?.({
1754
+ code: "accept",
1755
+ message: "No files match the accepted types."
1756
+ });
1757
+ return;
1758
+ }
1759
+ const withinSize = (f) => maxFileSize ? f.size <= maxFileSize : true;
1760
+ const sized = accepted.filter(withinSize);
1761
+ if (accepted.length > 0 && sized.length === 0) {
1762
+ onError?.({
1763
+ code: "max_file_size",
1764
+ message: "All files exceed the maximum size."
1765
+ });
1766
+ return;
1767
+ }
1768
+ setItems((prev) => {
1769
+ const capacity = typeof maxFiles === "number" ? Math.max(0, maxFiles - prev.length) : void 0;
1770
+ const capped = typeof capacity === "number" ? sized.slice(0, capacity) : sized;
1771
+ if (typeof capacity === "number" && sized.length > capacity) {
1772
+ onError?.({
1773
+ code: "max_files",
1774
+ message: "Too many files. Some were not added."
1775
+ });
1776
+ }
1777
+ const next = [];
1778
+ for (const file of capped) {
1779
+ next.push({
1780
+ filename: file.name,
1781
+ id: nanoid(),
1782
+ mediaType: file.type,
1783
+ type: "file",
1784
+ url: URL.createObjectURL(file)
1785
+ });
1786
+ }
1787
+ return [...prev, ...next];
1788
+ });
1789
+ },
1790
+ [matchesAccept, maxFiles, maxFileSize, onError]
1791
+ );
1792
+ const removeLocal = useCallback(
1793
+ (id) => setItems((prev) => {
1794
+ const found = prev.find((file) => file.id === id);
1795
+ if (found?.url) {
1796
+ URL.revokeObjectURL(found.url);
1797
+ }
1798
+ return prev.filter((file) => file.id !== id);
1799
+ }),
1800
+ []
1801
+ );
1802
+ const addWithProviderValidation = useCallback(
1803
+ (fileList) => {
1804
+ const incoming = [...fileList];
1805
+ const accepted = incoming.filter((f) => matchesAccept(f));
1806
+ if (incoming.length && accepted.length === 0) {
1807
+ onError?.({
1808
+ code: "accept",
1809
+ message: "No files match the accepted types."
1810
+ });
1811
+ return;
1812
+ }
1813
+ const withinSize = (f) => maxFileSize ? f.size <= maxFileSize : true;
1814
+ const sized = accepted.filter(withinSize);
1815
+ if (accepted.length > 0 && sized.length === 0) {
1816
+ onError?.({
1817
+ code: "max_file_size",
1818
+ message: "All files exceed the maximum size."
1819
+ });
1820
+ return;
1821
+ }
1822
+ const currentCount = files.length;
1823
+ const capacity = typeof maxFiles === "number" ? Math.max(0, maxFiles - currentCount) : void 0;
1824
+ const capped = typeof capacity === "number" ? sized.slice(0, capacity) : sized;
1825
+ if (typeof capacity === "number" && sized.length > capacity) {
1826
+ onError?.({
1827
+ code: "max_files",
1828
+ message: "Too many files. Some were not added."
1829
+ });
1830
+ }
1831
+ if (capped.length > 0) {
1832
+ controller?.attachments.add(capped);
1833
+ }
1834
+ },
1835
+ [matchesAccept, maxFileSize, maxFiles, onError, files.length, controller]
1836
+ );
1837
+ const clearAttachments = useCallback(
1838
+ () => usingProvider ? controller?.attachments.clear() : setItems((prev) => {
1839
+ for (const file of prev) {
1840
+ if (file.url) {
1841
+ URL.revokeObjectURL(file.url);
1842
+ }
1843
+ }
1844
+ return [];
1845
+ }),
1846
+ [usingProvider, controller]
1847
+ );
1848
+ const clearReferencedSources = useCallback(
1849
+ () => setReferencedSources([]),
1850
+ []
1851
+ );
1852
+ const add = usingProvider ? addWithProviderValidation : addLocal;
1853
+ const remove = usingProvider ? controller.attachments.remove : removeLocal;
1854
+ const openFileDialog = usingProvider ? controller.attachments.openFileDialog : openFileDialogLocal;
1855
+ const clear = useCallback(() => {
1856
+ clearAttachments();
1857
+ clearReferencedSources();
1858
+ }, [clearAttachments, clearReferencedSources]);
1859
+ useEffect(() => {
1860
+ if (!usingProvider) {
1861
+ return;
1862
+ }
1863
+ controller.__registerFileInput(inputRef, () => inputRef.current?.click());
1864
+ }, [usingProvider, controller]);
1865
+ useEffect(() => {
1866
+ if (syncHiddenInput && inputRef.current && files.length === 0) {
1867
+ inputRef.current.value = "";
1868
+ }
1869
+ }, [files, syncHiddenInput]);
1870
+ useEffect(() => {
1871
+ const form = formRef.current;
1872
+ if (!form) {
1873
+ return;
1874
+ }
1875
+ if (globalDrop) {
1876
+ return;
1877
+ }
1878
+ const onDragOver = (e) => {
1879
+ if (e.dataTransfer?.types?.includes("Files")) {
1880
+ e.preventDefault();
1881
+ }
1882
+ };
1883
+ const onDrop = (e) => {
1884
+ if (e.dataTransfer?.types?.includes("Files")) {
1885
+ e.preventDefault();
1886
+ }
1887
+ if (e.dataTransfer?.files && e.dataTransfer.files.length > 0) {
1888
+ add(e.dataTransfer.files);
1889
+ }
1890
+ };
1891
+ form.addEventListener("dragover", onDragOver);
1892
+ form.addEventListener("drop", onDrop);
1893
+ return () => {
1894
+ form.removeEventListener("dragover", onDragOver);
1895
+ form.removeEventListener("drop", onDrop);
1896
+ };
1897
+ }, [add, globalDrop]);
1898
+ useEffect(() => {
1899
+ if (!globalDrop) {
1900
+ return;
1901
+ }
1902
+ const onDragOver = (e) => {
1903
+ if (e.dataTransfer?.types?.includes("Files")) {
1904
+ e.preventDefault();
1905
+ }
1906
+ };
1907
+ const onDrop = (e) => {
1908
+ if (e.dataTransfer?.types?.includes("Files")) {
1909
+ e.preventDefault();
1910
+ }
1911
+ if (e.dataTransfer?.files && e.dataTransfer.files.length > 0) {
1912
+ add(e.dataTransfer.files);
1913
+ }
1914
+ };
1915
+ document.addEventListener("dragover", onDragOver);
1916
+ document.addEventListener("drop", onDrop);
1917
+ return () => {
1918
+ document.removeEventListener("dragover", onDragOver);
1919
+ document.removeEventListener("drop", onDrop);
1920
+ };
1921
+ }, [add, globalDrop]);
1922
+ useEffect(
1923
+ () => () => {
1924
+ if (!usingProvider) {
1925
+ for (const f of filesRef.current) {
1926
+ if (f.url) {
1927
+ URL.revokeObjectURL(f.url);
1928
+ }
1929
+ }
1930
+ }
1931
+ },
1932
+ [usingProvider]
1933
+ );
1934
+ const handleChange = useCallback(
1935
+ (event) => {
1936
+ if (event.currentTarget.files) {
1937
+ add(event.currentTarget.files);
1938
+ }
1939
+ event.currentTarget.value = "";
1940
+ },
1941
+ [add]
1942
+ );
1943
+ const attachmentsCtx = useMemo2(
1944
+ () => ({
1945
+ add,
1946
+ clear: clearAttachments,
1947
+ fileInputRef: inputRef,
1948
+ files: files.map((item) => ({ ...item, id: item.id })),
1949
+ openFileDialog,
1950
+ remove
1951
+ }),
1952
+ [files, add, remove, clearAttachments, openFileDialog]
1953
+ );
1954
+ const refsCtx = useMemo2(
1955
+ () => ({
1956
+ add: (incoming) => {
1957
+ const array = Array.isArray(incoming) ? incoming : [incoming];
1958
+ setReferencedSources((prev) => [
1959
+ ...prev,
1960
+ ...array.map((s) => ({ ...s, id: nanoid() }))
1961
+ ]);
1962
+ },
1963
+ clear: clearReferencedSources,
1964
+ remove: (id) => {
1965
+ setReferencedSources((prev) => prev.filter((s) => s.id !== id));
1966
+ },
1967
+ sources: referencedSources
1968
+ }),
1969
+ [referencedSources, clearReferencedSources]
1970
+ );
1971
+ const handleSubmit = useCallback(
1972
+ async (event) => {
1973
+ event.preventDefault();
1974
+ const form = event.currentTarget;
1975
+ const text = usingProvider ? controller.textInput.value : (() => {
1976
+ const formData = new FormData(form);
1977
+ return formData.get("message") || "";
1978
+ })();
1979
+ if (!usingProvider) {
1980
+ form.reset();
1981
+ }
1982
+ try {
1983
+ const convertedFiles = await Promise.all(
1984
+ files.map(async ({ id: _id, ...item }) => {
1985
+ if (item.url?.startsWith("blob:")) {
1986
+ const dataUrl = await convertBlobUrlToDataUrl(item.url);
1987
+ return {
1988
+ ...item,
1989
+ url: dataUrl ?? item.url
1990
+ };
1991
+ }
1992
+ return item;
1993
+ })
1994
+ );
1995
+ const result = onSubmit({ files: convertedFiles, text }, event);
1996
+ if (result instanceof Promise) {
1997
+ try {
1998
+ await result;
1999
+ clear();
2000
+ if (usingProvider) {
2001
+ controller.textInput.clear();
2002
+ }
2003
+ } catch {
2004
+ }
2005
+ } else {
2006
+ clear();
2007
+ if (usingProvider) {
2008
+ controller.textInput.clear();
2009
+ }
2010
+ }
2011
+ } catch {
2012
+ }
2013
+ },
2014
+ [usingProvider, controller, files, onSubmit, clear]
2015
+ );
2016
+ const inner = /* @__PURE__ */ jsxs7(Fragment, { children: [
2017
+ /* @__PURE__ */ jsx13(
2018
+ "input",
2019
+ {
2020
+ accept,
2021
+ "aria-label": "Upload files",
2022
+ className: "hidden",
2023
+ multiple,
2024
+ onChange: handleChange,
2025
+ ref: inputRef,
2026
+ title: "Upload files",
2027
+ type: "file"
2028
+ }
2029
+ ),
2030
+ /* @__PURE__ */ jsx13(
2031
+ "form",
2032
+ {
2033
+ className: cn("w-full", className),
2034
+ onSubmit: handleSubmit,
2035
+ ref: formRef,
2036
+ ...props,
2037
+ children: /* @__PURE__ */ jsx13(InputGroup, { className: cn("overflow-hidden", inputGroupClassName), children })
2038
+ }
2039
+ )
2040
+ ] });
2041
+ const withReferencedSources = /* @__PURE__ */ jsx13(LocalReferencedSourcesContext.Provider, { value: refsCtx, children: inner });
2042
+ return /* @__PURE__ */ jsx13(LocalAttachmentsContext.Provider, { value: attachmentsCtx, children: withReferencedSources });
2043
+ };
2044
+ var PromptInputBody = ({
2045
+ className,
2046
+ ...props
2047
+ }) => /* @__PURE__ */ jsx13("div", { className: cn("contents", className), ...props });
2048
+ var PromptInputTextarea = ({
2049
+ onChange,
2050
+ onKeyDown,
2051
+ className,
2052
+ placeholder = "What would you like to know?",
2053
+ ...props
2054
+ }) => {
2055
+ const controller = useOptionalPromptInputController();
2056
+ const attachments = usePromptInputAttachments();
2057
+ const [isComposing, setIsComposing] = useState(false);
2058
+ const handleKeyDown = useCallback(
2059
+ (e) => {
2060
+ onKeyDown?.(e);
2061
+ if (e.defaultPrevented) {
2062
+ return;
2063
+ }
2064
+ if (e.key === "Enter") {
2065
+ if (isComposing || e.nativeEvent.isComposing) {
2066
+ return;
2067
+ }
2068
+ if (e.shiftKey) {
2069
+ return;
2070
+ }
2071
+ e.preventDefault();
2072
+ const { form } = e.currentTarget;
2073
+ const submitButton = form?.querySelector(
2074
+ 'button[type="submit"]'
2075
+ );
2076
+ if (submitButton?.disabled) {
2077
+ return;
2078
+ }
2079
+ form?.requestSubmit();
2080
+ }
2081
+ if (e.key === "Backspace" && e.currentTarget.value === "" && attachments.files.length > 0) {
2082
+ e.preventDefault();
2083
+ const lastAttachment = attachments.files.at(-1);
2084
+ if (lastAttachment) {
2085
+ attachments.remove(lastAttachment.id);
2086
+ }
2087
+ }
2088
+ },
2089
+ [onKeyDown, isComposing, attachments]
2090
+ );
2091
+ const handlePaste = useCallback(
2092
+ (event) => {
2093
+ const items = event.clipboardData?.items;
2094
+ if (!items) {
2095
+ return;
2096
+ }
2097
+ const pastedFiles = [];
2098
+ for (const item of items) {
2099
+ if (item.kind === "file") {
2100
+ const file = item.getAsFile();
2101
+ if (file) {
2102
+ pastedFiles.push(file);
2103
+ }
2104
+ }
2105
+ }
2106
+ if (pastedFiles.length > 0) {
2107
+ event.preventDefault();
2108
+ attachments.add(pastedFiles);
2109
+ }
2110
+ },
2111
+ [attachments]
2112
+ );
2113
+ const handleCompositionEnd = useCallback(() => setIsComposing(false), []);
2114
+ const handleCompositionStart = useCallback(() => setIsComposing(true), []);
2115
+ const controlledProps = controller ? {
2116
+ onChange: (e) => {
2117
+ controller.textInput.setInput(e.currentTarget.value);
2118
+ onChange?.(e);
2119
+ },
2120
+ value: controller.textInput.value
2121
+ } : {
2122
+ onChange
2123
+ };
2124
+ return /* @__PURE__ */ jsx13(
2125
+ InputGroupTextarea,
2126
+ {
2127
+ className: cn("field-sizing-content max-h-48 min-h-16", className),
2128
+ name: "message",
2129
+ onCompositionEnd: handleCompositionEnd,
2130
+ onCompositionStart: handleCompositionStart,
2131
+ onKeyDown: handleKeyDown,
2132
+ onPaste: handlePaste,
2133
+ placeholder,
2134
+ ...props,
2135
+ ...controlledProps
2136
+ }
2137
+ );
2138
+ };
2139
+ var PromptInputHeader = ({
2140
+ className,
2141
+ ...props
2142
+ }) => /* @__PURE__ */ jsx13(
2143
+ InputGroupAddon,
2144
+ {
2145
+ align: "block-end",
2146
+ className: cn("order-first flex-wrap gap-1", className),
2147
+ ...props
2148
+ }
2149
+ );
2150
+ var PromptInputFooter = ({
2151
+ className,
2152
+ ...props
2153
+ }) => /* @__PURE__ */ jsx13(
2154
+ InputGroupAddon,
2155
+ {
2156
+ align: "block-end",
2157
+ className: cn("justify-between gap-1", className),
2158
+ ...props
2159
+ }
2160
+ );
2161
+ var PromptInputTools = ({
2162
+ className,
2163
+ ...props
2164
+ }) => /* @__PURE__ */ jsx13(
2165
+ "div",
2166
+ {
2167
+ className: cn("flex min-w-0 items-center gap-1", className),
2168
+ ...props
2169
+ }
2170
+ );
2171
+ var PromptInputButton = ({
2172
+ variant = "ghost",
2173
+ className,
2174
+ size,
2175
+ tooltip,
2176
+ ...props
2177
+ }) => {
2178
+ const newSize = size ?? (Children2.count(props.children) > 1 ? "sm" : "icon-sm");
2179
+ const button = /* @__PURE__ */ jsx13(
2180
+ InputGroupButton,
2181
+ {
2182
+ className: cn(className),
2183
+ size: newSize,
2184
+ type: "button",
2185
+ variant,
2186
+ ...props
2187
+ }
2188
+ );
2189
+ if (!tooltip) {
2190
+ return button;
2191
+ }
2192
+ const tooltipContent = typeof tooltip === "string" ? tooltip : tooltip.content;
2193
+ const shortcut = typeof tooltip === "string" ? void 0 : tooltip.shortcut;
2194
+ const side = typeof tooltip === "string" ? "top" : tooltip.side ?? "top";
2195
+ return /* @__PURE__ */ jsxs7(Tooltip, { children: [
2196
+ /* @__PURE__ */ jsx13(TooltipTrigger, { render: button }),
2197
+ /* @__PURE__ */ jsxs7(TooltipContent, { side, children: [
2198
+ tooltipContent,
2199
+ shortcut && /* @__PURE__ */ jsx13("span", { className: "text-muted-foreground ml-2", children: shortcut })
2200
+ ] })
2201
+ ] });
2202
+ };
2203
+ var PromptInputActionMenu = (props) => /* @__PURE__ */ jsx13(DropdownMenu, { ...props });
2204
+ var PromptInputActionMenuTrigger = ({
2205
+ className,
2206
+ children,
2207
+ ...props
2208
+ }) => /* @__PURE__ */ jsx13(
2209
+ DropdownMenuTrigger,
2210
+ {
2211
+ render: /* @__PURE__ */ jsx13(PromptInputButton, { className, ...props }),
2212
+ children: children ?? /* @__PURE__ */ jsx13(Icon, { name: "fa-light fa-plus", className: "size-4" })
2213
+ }
2214
+ );
2215
+ var PromptInputActionMenuContent = ({
2216
+ className,
2217
+ ...props
2218
+ }) => /* @__PURE__ */ jsx13(DropdownMenuContent, { align: "start", className: cn(className), ...props });
2219
+ var PromptInputActionMenuItem = ({
2220
+ className,
2221
+ ...props
2222
+ }) => /* @__PURE__ */ jsx13(DropdownMenuItem, { className: cn(className), ...props });
2223
+ var PromptInputSubmit = ({
2224
+ className,
2225
+ variant = "default",
2226
+ size = "icon-sm",
2227
+ status,
2228
+ onStop,
2229
+ onClick,
2230
+ children,
2231
+ ...props
2232
+ }) => {
2233
+ const isGenerating = status === "submitted" || status === "streaming";
2234
+ let Icon2 = /* @__PURE__ */ jsx13(Icon, { name: "fa-light fa-arrow-turn-down-left", className: "size-4" });
2235
+ if (status === "submitted") {
2236
+ Icon2 = /* @__PURE__ */ jsx13(Spinner, {});
2237
+ } else if (status === "streaming") {
2238
+ Icon2 = /* @__PURE__ */ jsx13(Icon, { name: "fa-light fa-square", className: "size-4" });
2239
+ } else if (status === "error") {
2240
+ Icon2 = /* @__PURE__ */ jsx13(Icon, { name: "fa-light fa-xmark", className: "size-4" });
2241
+ }
2242
+ const handleClick = useCallback(
2243
+ (e) => {
2244
+ if (isGenerating && onStop) {
2245
+ e.preventDefault();
2246
+ onStop();
2247
+ return;
2248
+ }
2249
+ onClick?.(e);
2250
+ },
2251
+ [isGenerating, onStop, onClick]
2252
+ );
2253
+ return /* @__PURE__ */ jsx13(
2254
+ InputGroupButton,
2255
+ {
2256
+ "aria-label": isGenerating ? "Stop" : "Submit",
2257
+ className: cn(className),
2258
+ onClick: handleClick,
2259
+ size,
2260
+ type: isGenerating && onStop ? "button" : "submit",
2261
+ variant,
2262
+ ...props,
2263
+ children: children ?? Icon2
2264
+ }
2265
+ );
2266
+ };
2267
+ var PromptInputSelect = (props) => /* @__PURE__ */ jsx13(Select, { ...props });
2268
+ var PromptInputSelectTrigger = ({
2269
+ className,
2270
+ ...props
2271
+ }) => /* @__PURE__ */ jsx13(
2272
+ SelectTrigger,
2273
+ {
2274
+ className: cn(
2275
+ "text-muted-foreground border-none bg-transparent font-medium shadow-none transition-colors",
2276
+ "hover:bg-accent hover:text-foreground aria-expanded:bg-accent aria-expanded:text-foreground",
2277
+ className
2278
+ ),
2279
+ ...props
2280
+ }
2281
+ );
2282
+ var PromptInputSelectContent = ({
2283
+ className,
2284
+ ...props
2285
+ }) => /* @__PURE__ */ jsx13(SelectContent, { className: cn(className), ...props });
2286
+ var PromptInputSelectItem = ({
2287
+ className,
2288
+ ...props
2289
+ }) => /* @__PURE__ */ jsx13(SelectItem, { className: cn(className), ...props });
2290
+ var PromptInputSelectValue = ({
2291
+ className,
2292
+ ...props
2293
+ }) => /* @__PURE__ */ jsx13(SelectValue, { className: cn(className), ...props });
2294
+ var PromptInputHoverCard = ({
2295
+ openDelay = 0,
2296
+ closeDelay = 0,
2297
+ ...props
2298
+ }) => /* @__PURE__ */ jsx13(HoverCard, { closeDelay, openDelay, ...props });
2299
+ var PromptInputHoverCardTrigger = (props) => /* @__PURE__ */ jsx13(HoverCardTrigger, { ...props });
2300
+ var PromptInputHoverCardContent = ({
2301
+ align = "start",
2302
+ ...props
2303
+ }) => /* @__PURE__ */ jsx13(HoverCardContent, { align, ...props });
2304
+ var PromptInputTabsList = ({
2305
+ className,
2306
+ ...props
2307
+ }) => /* @__PURE__ */ jsx13("div", { className: cn(className), ...props });
2308
+ var PromptInputTab = ({
2309
+ className,
2310
+ ...props
2311
+ }) => /* @__PURE__ */ jsx13("div", { className: cn(className), ...props });
2312
+ var PromptInputTabLabel = ({
2313
+ className,
2314
+ ...props
2315
+ }) => /* @__PURE__ */ jsx13(
2316
+ "h3",
2317
+ {
2318
+ className: cn(
2319
+ "text-muted-foreground mb-2 px-3 text-xs font-medium",
2320
+ className
2321
+ ),
2322
+ ...props
2323
+ }
2324
+ );
2325
+ var PromptInputTabBody = ({
2326
+ className,
2327
+ ...props
2328
+ }) => /* @__PURE__ */ jsx13("div", { className: cn("space-y-1", className), ...props });
2329
+ var PromptInputTabItem = ({
2330
+ className,
2331
+ ...props
2332
+ }) => /* @__PURE__ */ jsx13(
2333
+ "div",
2334
+ {
2335
+ className: cn(
2336
+ "hover:bg-accent flex items-center gap-2 px-3 py-2 text-xs",
2337
+ className
2338
+ ),
2339
+ ...props
2340
+ }
2341
+ );
2342
+ var PromptInputCommand = ({
2343
+ className,
2344
+ ...props
2345
+ }) => /* @__PURE__ */ jsx13(Command, { className: cn(className), ...props });
2346
+ var PromptInputCommandInput = ({
2347
+ className,
2348
+ ...props
2349
+ }) => /* @__PURE__ */ jsx13(CommandInput, { className: cn(className), ...props });
2350
+ var PromptInputCommandList = ({
2351
+ className,
2352
+ ...props
2353
+ }) => /* @__PURE__ */ jsx13(CommandList, { className: cn(className), ...props });
2354
+ var PromptInputCommandEmpty = ({
2355
+ className,
2356
+ ...props
2357
+ }) => /* @__PURE__ */ jsx13(CommandEmpty, { className: cn(className), ...props });
2358
+ var PromptInputCommandGroup = ({
2359
+ className,
2360
+ ...props
2361
+ }) => /* @__PURE__ */ jsx13(CommandGroup, { className: cn(className), ...props });
2362
+ var PromptInputCommandItem = ({
2363
+ className,
2364
+ ...props
2365
+ }) => /* @__PURE__ */ jsx13(CommandItem, { className: cn(className), ...props });
2366
+ var PromptInputCommandSeparator = ({
2367
+ className,
2368
+ ...props
2369
+ }) => /* @__PURE__ */ jsx13(CommandSeparator, { className: cn(className), ...props });
2370
+ export {
2371
+ LocalReferencedSourcesContext,
2372
+ PromptInput,
2373
+ PromptInputActionAddAttachments,
2374
+ PromptInputActionAddScreenshot,
2375
+ PromptInputActionMenu,
2376
+ PromptInputActionMenuContent,
2377
+ PromptInputActionMenuItem,
2378
+ PromptInputActionMenuTrigger,
2379
+ PromptInputBody,
2380
+ PromptInputButton,
2381
+ PromptInputCommand,
2382
+ PromptInputCommandEmpty,
2383
+ PromptInputCommandGroup,
2384
+ PromptInputCommandInput,
2385
+ PromptInputCommandItem,
2386
+ PromptInputCommandList,
2387
+ PromptInputCommandSeparator,
2388
+ PromptInputFooter,
2389
+ PromptInputHeader,
2390
+ PromptInputHoverCard,
2391
+ PromptInputHoverCardContent,
2392
+ PromptInputHoverCardTrigger,
2393
+ PromptInputProvider,
2394
+ PromptInputSelect,
2395
+ PromptInputSelectContent,
2396
+ PromptInputSelectItem,
2397
+ PromptInputSelectTrigger,
2398
+ PromptInputSelectValue,
2399
+ PromptInputSubmit,
2400
+ PromptInputTab,
2401
+ PromptInputTabBody,
2402
+ PromptInputTabItem,
2403
+ PromptInputTabLabel,
2404
+ PromptInputTabsList,
2405
+ PromptInputTextarea,
2406
+ PromptInputTools,
2407
+ usePromptInputAttachments,
2408
+ usePromptInputController,
2409
+ usePromptInputReferencedSources,
2410
+ useProviderAttachments
2411
+ };