@inkeep/agents-ui 0.16.0 → 0.16.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/color-mode/index.js +4 -4
- package/dist/index.cjs +1 -1
- package/dist/index.js +167 -161
- package/dist/node_modules/.pnpm/use-sync-external-store@1.6.0_react@19.3.0-canary-87ae75b3-20260128/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.cjs +9 -0
- package/dist/node_modules/.pnpm/{use-sync-external-store@1.5.0_react@19.0.0 → use-sync-external-store@1.6.0_react@19.3.0-canary-87ae75b3-20260128}/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +2 -2
- package/dist/primitives/atoms/cmdk/index.cjs +1 -1
- package/dist/primitives/atoms/cmdk/index.js +14 -2
- package/dist/primitives/atoms/combobox.d.ts +104 -0
- package/dist/primitives/atoms/icons/built-in-icons.cjs +1 -1
- package/dist/primitives/atoms/icons/built-in-icons.d.ts +4 -1
- package/dist/primitives/atoms/icons/built-in-icons.js +94 -91
- package/dist/primitives/atoms/icons/collections/pi.cjs +1 -1
- package/dist/primitives/atoms/icons/collections/pi.d.ts +3 -0
- package/dist/primitives/atoms/icons/collections/pi.js +82 -37
- package/dist/primitives/atoms/icons/inkeep-default-icons.cjs +1 -1
- package/dist/primitives/atoms/icons/inkeep-default-icons.js +4 -1
- package/dist/primitives/atoms/portal.js +3 -3
- package/dist/primitives/atoms/select.cjs +1 -1
- package/dist/primitives/atoms/select.js +2 -2
- package/dist/primitives/atoms/shadow/context.js +4 -4
- package/dist/primitives/components/embedded-chat/chat-error-helpers.cjs +3 -0
- package/dist/primitives/components/embedded-chat/chat-error-helpers.d.ts +26 -0
- package/dist/primitives/components/embedded-chat/chat-error-helpers.js +32 -0
- package/dist/primitives/components/embedded-chat/file-upload-input.cjs +1 -1
- package/dist/primitives/components/embedded-chat/file-upload-input.d.ts +1 -2
- package/dist/primitives/components/embedded-chat/file-upload-input.js +359 -217
- package/dist/primitives/components/embedded-chat/image-preview-modal.js +3 -3
- package/dist/primitives/components/embedded-chat/use-chat-action.cjs +1 -1
- package/dist/primitives/components/embedded-chat/use-chat-action.js +16 -14
- package/dist/primitives/components/embedded-chat/use-inkeep-chat.cjs +2 -4
- package/dist/primitives/components/embedded-chat/use-inkeep-chat.d.ts +1 -2
- package/dist/primitives/components/embedded-chat/use-inkeep-chat.js +312 -284
- package/dist/primitives/components/embedded-chat/use-stream-processor.cjs +1 -1
- package/dist/primitives/components/embedded-chat/use-stream-processor.js +1 -1
- package/dist/primitives/components/embedded-chat.cjs +3 -3
- package/dist/primitives/components/embedded-chat.d.ts +2 -3
- package/dist/primitives/components/embedded-chat.js +122 -114
- package/dist/primitives/components/embedded-search/search-provider.js +3 -3
- package/dist/primitives/components/embedded-search.cjs +1 -1
- package/dist/primitives/components/embedded-search.d.ts +1 -1
- package/dist/primitives/components/embedded-search.js +3 -3
- package/dist/primitives/components/modal/modal-provider.js +2 -2
- package/dist/primitives/components/modal.js +3 -3
- package/dist/primitives/components/sidebar-chat/index.js +1 -1
- package/dist/primitives/components/tagline-logo-icon.js +50 -9
- package/dist/primitives/hooks/use-events-api.cjs +1 -0
- package/dist/primitives/hooks/use-events-api.d.ts +29 -0
- package/dist/primitives/hooks/use-events-api.js +43 -0
- package/dist/primitives/hooks/use-initial-conversation.js +4 -1
- package/dist/primitives/hooks/use-input-notification.js +9 -9
- package/dist/primitives/index.cjs +1 -1
- package/dist/primitives/index.js +150 -144
- package/dist/primitives/providers/base-events-provider.cjs +1 -1
- package/dist/primitives/providers/base-events-provider.d.ts +2 -0
- package/dist/primitives/providers/base-events-provider.js +23 -22
- package/dist/primitives/providers/chat-auth-provider.cjs +1 -0
- package/dist/primitives/providers/chat-auth-provider.d.ts +27 -0
- package/dist/primitives/providers/chat-auth-provider.js +46 -0
- package/dist/primitives/providers/chat-base-events-provider.cjs +1 -0
- package/dist/primitives/providers/chat-base-events-provider.d.ts +12 -0
- package/dist/primitives/providers/chat-base-events-provider.js +73 -0
- package/dist/primitives/providers/chat-bubble-provider.js +1 -1
- package/dist/primitives/providers/chat-form-provider.d.ts +1 -1
- package/dist/primitives/providers/chat-form-provider.js +4 -4
- package/dist/primitives/providers/chat-history-provider.js +3 -3
- package/dist/primitives/providers/config-provider.js +3 -3
- package/dist/primitives/providers/feedback-provider.cjs +1 -1
- package/dist/primitives/providers/feedback-provider.js +37 -31
- package/dist/primitives/providers/form-field-provider.js +3 -3
- package/dist/primitives/providers/help-menu-provider.js +4 -4
- package/dist/primitives/providers/hover-popover-provider.js +3 -3
- package/dist/primitives/providers/image-preview-provider.js +5 -5
- package/dist/primitives/providers/index.cjs +1 -1
- package/dist/primitives/providers/index.d.ts +2 -0
- package/dist/primitives/providers/index.js +57 -51
- package/dist/primitives/providers/markdown-provider.js +2 -2
- package/dist/primitives/providers/message-provider.js +1 -1
- package/dist/primitives/providers/sidebar-chat-provider.js +3 -3
- package/dist/primitives/providers/source-item-provider.js +3 -3
- package/dist/primitives/providers/widget-provider.js +2 -2
- package/dist/primitives/utils/misc.cjs +1 -1
- package/dist/primitives/utils/misc.js +2 -2
- package/dist/react/chat-button.js +1 -1
- package/dist/react/embedded-chat.cjs +1 -1
- package/dist/react/embedded-chat.js +104 -102
- package/dist/react/embedded-search.cjs +1 -1
- package/dist/react/embedded-search.js +18 -18
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.js +167 -161
- package/dist/styled/components/chat-bubble.js +4 -4
- package/dist/styled/components/chat-button.cjs +1 -1
- package/dist/styled/components/chat-button.js +9 -9
- package/dist/styled/components/chat-history.cjs +1 -1
- package/dist/styled/components/chat-history.js +22 -22
- package/dist/styled/components/embedded-chat/file-upload-input.cjs +1 -1
- package/dist/styled/components/embedded-chat/file-upload-input.js +71 -72
- package/dist/styled/components/embedded-chat/image-preview-modal.js +14 -7
- package/dist/styled/components/embedded-chat.cjs +1 -1
- package/dist/styled/components/embedded-chat.js +211 -199
- package/dist/styled/components/embedded-search.cjs +1 -1
- package/dist/styled/components/embedded-search.js +72 -66
- package/dist/styled/components/loading-indicator.cjs +1 -1
- package/dist/styled/components/loading-indicator.js +1 -1
- package/dist/styled/components/message.cjs +1 -1
- package/dist/styled/components/message.js +142 -139
- package/dist/styled/components/modal.js +3 -3
- package/dist/styled/components/searchbar.js +8 -8
- package/dist/styled/components/sidebar-chat.cjs +1 -1
- package/dist/styled/components/sidebar-chat.js +5 -5
- package/dist/styled/index.cjs +1 -1
- package/dist/styled/index.js +155 -149
- package/dist/styled/inkeep.css.cjs +13 -3
- package/dist/styled/inkeep.css.js +13 -3
- package/dist/theme/utils/generate-theme-variables.js +6 -6
- package/dist/types/config/ai.d.ts +5 -0
- package/dist/types/events.d.ts +11 -0
- package/dist/types/icons/built-in.d.ts +1 -1
- package/dist/types/icons/custom.d.ts +3 -0
- package/package.json +2 -2
- package/dist/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.0.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.cjs +0 -9
- /package/dist/node_modules/.pnpm/{use-sync-external-store@1.5.0_react@19.0.0 → use-sync-external-store@1.6.0_react@19.3.0-canary-87ae75b3-20260128}/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.cjs +0 -0
- /package/dist/node_modules/.pnpm/{use-sync-external-store@1.5.0_react@19.0.0 → use-sync-external-store@1.6.0_react@19.3.0-canary-87ae75b3-20260128}/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +0 -0
- /package/dist/node_modules/.pnpm/{use-sync-external-store@1.5.0_react@19.0.0 → use-sync-external-store@1.6.0_react@19.3.0-canary-87ae75b3-20260128}/node_modules/use-sync-external-store/shim/index.cjs +0 -0
- /package/dist/node_modules/.pnpm/{use-sync-external-store@1.5.0_react@19.0.0 → use-sync-external-store@1.6.0_react@19.3.0-canary-87ae75b3-20260128}/node_modules/use-sync-external-store/shim/index.js +0 -0
|
@@ -1,328 +1,470 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import
|
|
4
|
-
import { CustomIcon as
|
|
5
|
-
import { useImagePreview as
|
|
6
|
-
import { useMessage as
|
|
7
|
-
import { useChat as
|
|
8
|
-
import {
|
|
9
|
-
import { dataAttr as
|
|
10
|
-
import { composeEventHandlers as
|
|
11
|
-
import { ikp as
|
|
12
|
-
import { useInkeepConfig as
|
|
13
|
-
const
|
|
2
|
+
import { jsx as a, jsxs as j } from "react/jsx-runtime";
|
|
3
|
+
import C, { useState as h, useEffect as E, useMemo as w } from "react";
|
|
4
|
+
import { CustomIcon as v } from "../../atoms/icons/custom-icon.js";
|
|
5
|
+
import { useImagePreview as I } from "../../providers/image-preview-provider.js";
|
|
6
|
+
import { useMessage as k } from "../../providers/message-provider.js";
|
|
7
|
+
import { useChat as c } from "./chat-provider.js";
|
|
8
|
+
import { useFileUploadApi as d, FileUploadRoot as N } from "../../atoms/file-upload.js";
|
|
9
|
+
import { dataAttr as g } from "../../utils/misc.js";
|
|
10
|
+
import { composeEventHandlers as r } from "../../utils/compose-event-handlers.js";
|
|
11
|
+
import { ikp as o } from "../factory.js";
|
|
12
|
+
import { useInkeepConfig as T } from "../../providers/config-provider.js";
|
|
13
|
+
const L = {
|
|
14
14
|
"application/pdf": "filePdf",
|
|
15
15
|
"text/plain": "fileText",
|
|
16
16
|
"text/markdown": "fileMarkdown",
|
|
17
17
|
"text/html": "fileHtml",
|
|
18
18
|
"text/csv": "fileCsv",
|
|
19
19
|
"text/x-log": "fileLog",
|
|
20
|
-
"application/json": "fileJson"
|
|
20
|
+
"application/json": "fileJson",
|
|
21
|
+
"text/x-sql": "fileSql",
|
|
22
|
+
"application/x-sql": "fileSql",
|
|
23
|
+
"text/x-script.python": "filePy",
|
|
24
|
+
"text/x-python": "filePy",
|
|
25
|
+
"text/x-python-script": "filePy"
|
|
21
26
|
};
|
|
22
|
-
function
|
|
23
|
-
return
|
|
27
|
+
function F(t) {
|
|
28
|
+
return t.startsWith("image/");
|
|
24
29
|
}
|
|
25
|
-
const
|
|
30
|
+
const _ = {
|
|
31
|
+
// Images
|
|
26
32
|
"image/png": [".png"],
|
|
27
33
|
"image/jpeg": [".jpg", ".jpeg"],
|
|
28
34
|
"image/webp": [".webp"],
|
|
35
|
+
// PDF
|
|
29
36
|
"application/pdf": [".pdf"],
|
|
30
|
-
|
|
31
|
-
"text/
|
|
32
|
-
"text/html": [".html"],
|
|
33
|
-
"text/csv": [".csv"],
|
|
37
|
+
// Plain text & logs
|
|
38
|
+
"text/plain": [".txt", ".text", ".bat", ".cfg", ".conf", ".def", ".dic", ".in", ".list"],
|
|
34
39
|
"text/x-log": [".log"],
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
// Markup & web
|
|
41
|
+
"text/markdown": [".md", ".markdown"],
|
|
42
|
+
"text/html": [".html", ".htm"],
|
|
43
|
+
"text/csv": [".csv"],
|
|
44
|
+
"text/xml": [".xml"],
|
|
45
|
+
"text/css": [".css"],
|
|
46
|
+
// Data formats
|
|
47
|
+
"application/json": [".json"],
|
|
48
|
+
"application/yaml": [".yaml", ".yml"],
|
|
49
|
+
"application/x-yaml": [".yaml", ".yml"],
|
|
50
|
+
"text/x-yaml": [".yaml", ".yml"],
|
|
51
|
+
"application/toml": [".toml"],
|
|
52
|
+
"application/x-toml": [".toml"],
|
|
53
|
+
"application/graphql": [".graphql", ".gql"],
|
|
54
|
+
"application/x-graphql": [".graphql", ".gql"],
|
|
55
|
+
"text/x-graphql": [".graphql", ".gql"],
|
|
56
|
+
"application/x-ndjson": [".ndjson"],
|
|
57
|
+
"application/json5": [".json5"],
|
|
58
|
+
"application/x-json5": [".json5"],
|
|
59
|
+
// JavaScript & TypeScript
|
|
60
|
+
"application/javascript": [".js", ".mjs"],
|
|
61
|
+
"text/javascript": [".js", ".mjs"],
|
|
62
|
+
"application/typescript": [".ts"],
|
|
63
|
+
"text/x-typescript": [".ts"],
|
|
64
|
+
"text/jsx": [".jsx"],
|
|
65
|
+
"text/tsx": [".tsx"],
|
|
66
|
+
// Shell & scripting
|
|
67
|
+
"text/x-sh": [".sh"],
|
|
68
|
+
"text/x-bash": [".bash"],
|
|
69
|
+
"application/x-bash": [".bash"],
|
|
70
|
+
"text/x-zsh": [".zsh"],
|
|
71
|
+
"text/x-shellscript": [".sh", ".ksh"],
|
|
72
|
+
"application/x-powershell": [".ps1"],
|
|
73
|
+
"text/vbscript": [".vbs"],
|
|
74
|
+
"text/x-awk": [".awk"],
|
|
75
|
+
"application/x-awk": [".awk"],
|
|
76
|
+
// C-family
|
|
77
|
+
"text/x-c": [".c", ".h"],
|
|
78
|
+
"text/x-c++": [".cpp", ".cc", ".cxx", ".hh"],
|
|
79
|
+
"text/x-csharp": [".cs"],
|
|
80
|
+
"text/x-objectivec": [".m"],
|
|
81
|
+
"text/x-objectivec++": [".mm"],
|
|
82
|
+
// JVM
|
|
83
|
+
"text/x-java": [".java"],
|
|
84
|
+
"text/x-scala": [".scala"],
|
|
85
|
+
"application/x-scala": [".scala"],
|
|
86
|
+
"text/x-kotlin": [".kt"],
|
|
87
|
+
"text/x-groovy": [".groovy"],
|
|
88
|
+
"text/x-clojure": [".clj"],
|
|
89
|
+
// Systems & compiled
|
|
90
|
+
"text/x-go": [".go"],
|
|
91
|
+
"text/x-golang": [".go"],
|
|
92
|
+
"text/x-rust": [".rs"],
|
|
93
|
+
"application/x-rust": [".rs"],
|
|
94
|
+
"text/x-swift": [".swift"],
|
|
95
|
+
"text/x-dart": [".dart"],
|
|
96
|
+
// Scripting languages
|
|
97
|
+
"text/x-python": [".py"],
|
|
98
|
+
"text/x-script.python": [".py"],
|
|
99
|
+
"text/x-python-script": [".py"],
|
|
100
|
+
"text/x-ruby": [".rb"],
|
|
101
|
+
"text/x-perl": [".pl"],
|
|
102
|
+
"text/x-lua": [".lua"],
|
|
103
|
+
"text/x-r": [".r"],
|
|
104
|
+
"text/x-R": [".r"],
|
|
105
|
+
"text/x-julia": [".jl"],
|
|
106
|
+
"text/x-elixir": [".ex"],
|
|
107
|
+
"text/x-erlang": [".erl"],
|
|
108
|
+
"text/x-haskell": [".hs"],
|
|
109
|
+
"text/x-lisp": [".lisp"],
|
|
110
|
+
// PHP
|
|
111
|
+
"text/x-php": [".php"],
|
|
112
|
+
"application/x-php": [".php"],
|
|
113
|
+
"application/x-httpd-php": [".php"],
|
|
114
|
+
"application/x-httpd-php-source": [".php"],
|
|
115
|
+
// Markup & templating
|
|
116
|
+
"text/x-tex": [".tex"],
|
|
117
|
+
"text/x-rst": [".rst"],
|
|
118
|
+
"text/x-handlebars": [".hbs"],
|
|
119
|
+
"text/x-mustache": [".mustache"],
|
|
120
|
+
"text/x-ejs": [".ejs"],
|
|
121
|
+
"text/x-jinja2": [".jinja", ".jinja2"],
|
|
122
|
+
"text/x-liquid": [".liquid"],
|
|
123
|
+
"text/x-erb": [".erb"],
|
|
124
|
+
"text/x-twig": [".twig"],
|
|
125
|
+
"text/x-pug": [".pug"],
|
|
126
|
+
"text/x-jade": [".jade"],
|
|
127
|
+
"text/x-tmpl": [".tmpl"],
|
|
128
|
+
"text/x-astro": [".astro"],
|
|
129
|
+
// Style
|
|
130
|
+
"text/x-sass": [".sass"],
|
|
131
|
+
"text/x-scss": [".scss"],
|
|
132
|
+
"text/x-less": [".less"],
|
|
133
|
+
// SQL
|
|
134
|
+
"text/x-sql": [".sql"],
|
|
135
|
+
"application/x-sql": [".sql"],
|
|
136
|
+
// Config & build
|
|
137
|
+
"text/x-makefile": [".makefile", ".mk"],
|
|
138
|
+
"text/x-cmake": [".cmake"],
|
|
139
|
+
"text/x-dockerfile": [".dockerfile"],
|
|
140
|
+
"text/x-gradle": [".gradle"],
|
|
141
|
+
"text/x-ini": [".ini"],
|
|
142
|
+
"text/x-properties": [".properties"],
|
|
143
|
+
"text/x-protobuf": [".proto"],
|
|
144
|
+
"application/x-protobuf": [".proto"],
|
|
145
|
+
"text/x-hcl": [".hcl"],
|
|
146
|
+
"text/x-terraform": [".tf"],
|
|
147
|
+
"application/x-terraform": [".tf"],
|
|
148
|
+
// Diff & patch
|
|
149
|
+
"text/x-diff": [".diff"],
|
|
150
|
+
"text/x-patch": [".patch"],
|
|
151
|
+
"application/x-patch": [".patch"],
|
|
152
|
+
// Assembly
|
|
153
|
+
"text/x-asm": [".asm", ".s"],
|
|
154
|
+
// Email
|
|
155
|
+
"message/rfc822": [".eml", ".mht", ".mhtml", ".mime", ".nws"],
|
|
156
|
+
// Subtitles & calendar
|
|
157
|
+
"text/srt": [".srt"],
|
|
158
|
+
"application/x-subrip": [".srt"],
|
|
159
|
+
"text/x-subrip": [".srt"],
|
|
160
|
+
"text/vtt": [".vtt"],
|
|
161
|
+
"text/x-vcard": [".vcf"],
|
|
162
|
+
"text/calendar": [".ics", ".ifb"],
|
|
163
|
+
// Office documents
|
|
164
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": [".docx"],
|
|
165
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [".xlsx"],
|
|
166
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation": [".pptx"],
|
|
167
|
+
"application/vnd.oasis.opendocument.text": [".odt"],
|
|
168
|
+
"application/vnd.oasis.opendocument.spreadsheet": [".ods"],
|
|
169
|
+
"application/vnd.oasis.opendocument.presentation": [".odp"],
|
|
170
|
+
"application/vnd.apple.pages": [".pages"],
|
|
171
|
+
"application/vnd.apple.numbers": [".numbers"],
|
|
172
|
+
"application/vnd.apple.keynote": [".key"],
|
|
173
|
+
"application/x-iwork-pages-sffpages": [".pages"],
|
|
174
|
+
"application/x-iwork-numbers-sffnumbers": [".numbers"],
|
|
175
|
+
"application/x-iwork-keynote-sffkey": [".key"]
|
|
176
|
+
}, M = new Set(Object.keys(_)), P = 10, y = 1024 * 1024 * 10, q = Object.entries(_).reduce(
|
|
177
|
+
(t, [e, i]) => {
|
|
178
|
+
for (const n of i) t[n] = e;
|
|
179
|
+
return t;
|
|
40
180
|
},
|
|
41
181
|
{}
|
|
42
182
|
);
|
|
43
|
-
function R(
|
|
44
|
-
if (
|
|
45
|
-
const
|
|
46
|
-
return i ? new File([
|
|
183
|
+
function R(t) {
|
|
184
|
+
if (t.type) return t;
|
|
185
|
+
const e = `.${t.name.split(".").pop()?.toLowerCase()}`, i = q[e];
|
|
186
|
+
return i ? new File([t], t.name, { type: i }) : t;
|
|
47
187
|
}
|
|
48
|
-
function
|
|
49
|
-
if (!
|
|
50
|
-
const
|
|
51
|
-
return
|
|
188
|
+
function U(t) {
|
|
189
|
+
if (!t.length) return null;
|
|
190
|
+
const e = (i) => t.some((n) => n.errors.includes(i));
|
|
191
|
+
return e("TOO_MANY_FILES") ? {
|
|
52
192
|
title: "Attachment limit reached",
|
|
53
|
-
message: `You can only attach up to ${
|
|
54
|
-
} :
|
|
193
|
+
message: `You can only attach up to ${P} files per message.`
|
|
194
|
+
} : e("FILE_INVALID_TYPE") ? {
|
|
55
195
|
title: "Unsupported file type",
|
|
56
|
-
message:
|
|
57
|
-
} :
|
|
196
|
+
message: "Supported formats include images, PDFs, text, code, and document files."
|
|
197
|
+
} : e("FILE_TOO_LARGE") ? {
|
|
58
198
|
title: "File too large",
|
|
59
|
-
message: `Files must be smaller than ${
|
|
60
|
-
} :
|
|
199
|
+
message: `Files must be smaller than ${y / 1024 / 1024}MB.`
|
|
200
|
+
} : e("FILE_EXISTS") ? {
|
|
61
201
|
title: "File already exists",
|
|
62
|
-
message: `The file "${
|
|
202
|
+
message: `The file "${t.find((n) => n.errors.includes("FILE_EXISTS"))?.file.name ?? "file"}" is already attached to this message.`
|
|
63
203
|
} : {
|
|
64
204
|
title: "File rejected",
|
|
65
205
|
message: "This file could not be added."
|
|
66
206
|
};
|
|
67
207
|
}
|
|
68
|
-
const
|
|
208
|
+
const S = o("div", {
|
|
69
209
|
_id: "aiChatMessage__Files"
|
|
70
|
-
}),
|
|
71
|
-
|
|
72
|
-
...t
|
|
73
|
-
}) => {
|
|
74
|
-
const { message: i } = w();
|
|
210
|
+
}), dt = ({ children: t, ...e }) => {
|
|
211
|
+
const { message: i } = k();
|
|
75
212
|
if (i.role !== "user") return null;
|
|
76
|
-
const n = (i.parts ?? []).filter((
|
|
77
|
-
if (
|
|
78
|
-
const
|
|
79
|
-
return
|
|
213
|
+
const n = (i.parts ?? []).filter((s) => {
|
|
214
|
+
if (s.type !== "file") return !1;
|
|
215
|
+
const l = s.mediaType;
|
|
216
|
+
return M.has(l ?? "");
|
|
80
217
|
});
|
|
81
|
-
return n.length ? /* @__PURE__ */
|
|
82
|
-
},
|
|
218
|
+
return n.length ? /* @__PURE__ */ a(S, { ...e, children: t(n) }) : null;
|
|
219
|
+
}, A = o("button", {
|
|
83
220
|
_id: "aiChatMessage__File"
|
|
84
|
-
}),
|
|
85
|
-
url:
|
|
86
|
-
name:
|
|
221
|
+
}), xt = ({
|
|
222
|
+
url: t,
|
|
223
|
+
name: e,
|
|
87
224
|
mediaType: i,
|
|
88
225
|
onClick: n,
|
|
89
|
-
...
|
|
226
|
+
...s
|
|
90
227
|
}) => {
|
|
91
|
-
const { openImagePreview:
|
|
92
|
-
|
|
93
|
-
|
|
228
|
+
const { openImagePreview: l } = I(), [p, m] = h(!0), u = w(
|
|
229
|
+
() => new File([], e ?? "file", { type: i }),
|
|
230
|
+
[e, i]
|
|
231
|
+
);
|
|
232
|
+
return /* @__PURE__ */ a(
|
|
233
|
+
b.Provider,
|
|
94
234
|
{
|
|
95
|
-
value: { file:
|
|
235
|
+
value: { file: u, objectUrl: t, isLoading: p, setIsLoading: m, onRemove: () => {
|
|
96
236
|
} },
|
|
97
|
-
children: /* @__PURE__ */
|
|
98
|
-
|
|
237
|
+
children: /* @__PURE__ */ a(
|
|
238
|
+
A,
|
|
99
239
|
{
|
|
100
240
|
type: "button",
|
|
101
|
-
"aria-label":
|
|
102
|
-
"data-loading":
|
|
103
|
-
onClick:
|
|
104
|
-
if (
|
|
105
|
-
|
|
106
|
-
else if (
|
|
107
|
-
if (
|
|
108
|
-
const
|
|
109
|
-
|
|
241
|
+
"aria-label": F(i ?? "") ? `Preview ${e ?? "file"}` : `Open ${e ?? "file"} in new tab`,
|
|
242
|
+
"data-loading": g(p),
|
|
243
|
+
onClick: r(n, () => {
|
|
244
|
+
if (F(i ?? ""))
|
|
245
|
+
l({ url: t, name: e ?? "file" });
|
|
246
|
+
else if (t)
|
|
247
|
+
if (t.startsWith("data:")) {
|
|
248
|
+
const f = document.createElement("a");
|
|
249
|
+
f.href = t, f.download = e ?? "file", f.click();
|
|
110
250
|
} else
|
|
111
|
-
window.open(
|
|
251
|
+
window.open(t, "_blank", "noopener,noreferrer");
|
|
112
252
|
}),
|
|
113
|
-
...
|
|
253
|
+
...s
|
|
114
254
|
}
|
|
115
255
|
)
|
|
116
256
|
}
|
|
117
257
|
);
|
|
118
|
-
},
|
|
258
|
+
}, O = o("div", {
|
|
119
259
|
_id: "aiChatInput__Fieldset"
|
|
120
|
-
}),
|
|
121
|
-
const
|
|
122
|
-
return /* @__PURE__ */
|
|
123
|
-
|
|
260
|
+
}), D = (t) => {
|
|
261
|
+
const e = d();
|
|
262
|
+
return /* @__PURE__ */ a(
|
|
263
|
+
O,
|
|
124
264
|
{
|
|
125
|
-
...
|
|
126
|
-
"data-drag-over":
|
|
127
|
-
...
|
|
265
|
+
...e.getDropzoneProps({ disableClick: !0 }),
|
|
266
|
+
"data-drag-over": g(e.dragging),
|
|
267
|
+
...t
|
|
128
268
|
}
|
|
129
269
|
);
|
|
130
|
-
},
|
|
131
|
-
...
|
|
270
|
+
}, mt = ({
|
|
271
|
+
...t
|
|
132
272
|
}) => {
|
|
133
|
-
const { files:
|
|
134
|
-
return /* @__PURE__ */
|
|
135
|
-
|
|
273
|
+
const { files: e, setFiles: i, showInputNotification: n } = c();
|
|
274
|
+
return /* @__PURE__ */ a(
|
|
275
|
+
N,
|
|
136
276
|
{
|
|
137
|
-
accept:
|
|
138
|
-
maxFiles:
|
|
139
|
-
maxFileSize:
|
|
277
|
+
accept: _,
|
|
278
|
+
maxFiles: P,
|
|
279
|
+
maxFileSize: y,
|
|
140
280
|
preventDocumentDrop: !0,
|
|
141
|
-
acceptedFiles:
|
|
142
|
-
onFileAccept: (
|
|
143
|
-
onFileReject: (
|
|
144
|
-
const
|
|
145
|
-
|
|
281
|
+
acceptedFiles: e,
|
|
282
|
+
onFileAccept: (s) => i(s.files),
|
|
283
|
+
onFileReject: (s) => {
|
|
284
|
+
const l = U(s.files);
|
|
285
|
+
l && n(l);
|
|
146
286
|
},
|
|
147
|
-
children: /* @__PURE__ */
|
|
287
|
+
children: /* @__PURE__ */ a(D, { ...t })
|
|
148
288
|
}
|
|
149
289
|
);
|
|
150
|
-
},
|
|
290
|
+
}, ut = o("div", {
|
|
151
291
|
_id: "aiChatInput__DropZone"
|
|
152
|
-
}),
|
|
292
|
+
}), $ = o("div", {
|
|
153
293
|
_id: "aiChatInput__Notification"
|
|
154
|
-
}),
|
|
155
|
-
const { inputNotification:
|
|
156
|
-
return
|
|
157
|
-
},
|
|
294
|
+
}), ft = (t) => {
|
|
295
|
+
const { inputNotification: e } = c();
|
|
296
|
+
return e ? /* @__PURE__ */ a($, { role: "alert", ...t }) : null;
|
|
297
|
+
}, B = o("p", {
|
|
158
298
|
_id: "aiChatInput__NotificationTitle"
|
|
159
|
-
}),
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
299
|
+
}), ht = ({
|
|
300
|
+
children: t,
|
|
301
|
+
...e
|
|
302
|
+
}) => {
|
|
303
|
+
const { inputNotification: i } = c();
|
|
304
|
+
return i?.title ? /* @__PURE__ */ j(B, { ...e, children: [
|
|
305
|
+
t,
|
|
306
|
+
i.title
|
|
307
|
+
] }) : null;
|
|
308
|
+
}, z = o("p", {
|
|
163
309
|
_id: "aiChatInput__NotificationMessage"
|
|
164
|
-
}),
|
|
165
|
-
const { inputNotification:
|
|
166
|
-
return /* @__PURE__ */
|
|
167
|
-
},
|
|
310
|
+
}), vt = (t) => {
|
|
311
|
+
const { inputNotification: e } = c();
|
|
312
|
+
return /* @__PURE__ */ a(z, { ...t, children: e?.message });
|
|
313
|
+
}, H = o("button", {
|
|
168
314
|
_id: "aiChatInput__NotificationClose"
|
|
169
|
-
}),
|
|
170
|
-
onClick:
|
|
171
|
-
...
|
|
315
|
+
}), gt = ({
|
|
316
|
+
onClick: t,
|
|
317
|
+
...e
|
|
172
318
|
}) => {
|
|
173
|
-
const { clearInputNotification: i } =
|
|
174
|
-
return /* @__PURE__ */
|
|
175
|
-
|
|
319
|
+
const { clearInputNotification: i } = c();
|
|
320
|
+
return /* @__PURE__ */ a(
|
|
321
|
+
H,
|
|
176
322
|
{
|
|
177
323
|
type: "button",
|
|
178
324
|
"aria-label": "Dismiss",
|
|
179
|
-
onClick:
|
|
180
|
-
...
|
|
325
|
+
onClick: r(t, i),
|
|
326
|
+
...e
|
|
181
327
|
}
|
|
182
328
|
);
|
|
183
|
-
},
|
|
329
|
+
}, _t = o("div", {
|
|
184
330
|
_id: "aiChatInput__NotificationContent"
|
|
185
|
-
}),
|
|
331
|
+
}), bt = o("div", {
|
|
186
332
|
_id: "aiChatInput__NotificationHeader"
|
|
187
|
-
}),
|
|
333
|
+
}), Ft = o(v, {
|
|
188
334
|
_id: "aiChatInput__FileUploadButtonIcon",
|
|
189
335
|
iconKey: "fileUpload"
|
|
190
|
-
}),
|
|
336
|
+
}), X = o("button", {
|
|
191
337
|
_id: "aiChatInput__FileUploadButton"
|
|
192
|
-
}),
|
|
193
|
-
const { aiChatSettings:
|
|
194
|
-
return /* @__PURE__ */
|
|
195
|
-
|
|
338
|
+
}), Ct = (t) => {
|
|
339
|
+
const { aiChatSettings: e } = T(), i = d(), { onClick: n, ...s } = t;
|
|
340
|
+
return /* @__PURE__ */ a(
|
|
341
|
+
X,
|
|
196
342
|
{
|
|
197
343
|
type: "button",
|
|
198
344
|
"aria-label": "Upload file",
|
|
199
|
-
disabled:
|
|
200
|
-
onClick:
|
|
201
|
-
...
|
|
345
|
+
disabled: e.isViewOnly,
|
|
346
|
+
onClick: r(n, () => i.openFilePicker()),
|
|
347
|
+
...s
|
|
202
348
|
}
|
|
203
349
|
);
|
|
204
|
-
},
|
|
350
|
+
}, Y = o("input", {
|
|
205
351
|
_id: "aiChatInput__FileInput"
|
|
206
|
-
}),
|
|
207
|
-
const
|
|
208
|
-
return /* @__PURE__ */
|
|
209
|
-
},
|
|
352
|
+
}), It = (t) => {
|
|
353
|
+
const e = d();
|
|
354
|
+
return /* @__PURE__ */ a(Y, { ...t, ...e.getHiddenInputProps() });
|
|
355
|
+
}, K = o("div", {
|
|
210
356
|
_id: "aiChatInput__FileList"
|
|
211
|
-
}),
|
|
212
|
-
|
|
213
|
-
...t
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
const e = P.useContext(v);
|
|
220
|
-
if (!e) throw new Error("useFileContext must be used within EmbeddedChatPrimitiveFileItem");
|
|
221
|
-
return e;
|
|
357
|
+
}), Pt = ({ children: t, ...e }) => {
|
|
358
|
+
const n = d().acceptedFiles;
|
|
359
|
+
return n.length ? /* @__PURE__ */ a(K, { ...e, children: t(n) }) : null;
|
|
360
|
+
}, b = C.createContext(null);
|
|
361
|
+
function x() {
|
|
362
|
+
const t = C.useContext(b);
|
|
363
|
+
if (!t) throw new Error("useFileContext must be used within EmbeddedChatPrimitiveFileItem");
|
|
364
|
+
return t;
|
|
222
365
|
}
|
|
223
|
-
const
|
|
366
|
+
const Z = o("div", {
|
|
224
367
|
_id: "aiChatInput__FileItem"
|
|
225
|
-
}),
|
|
226
|
-
const i =
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
}), [
|
|
230
|
-
const
|
|
231
|
-
return /* @__PURE__ */
|
|
232
|
-
},
|
|
368
|
+
}), yt = ({ file: t, ...e }) => {
|
|
369
|
+
const i = d(), [n, s] = h(void 0), [l, p] = h(!0);
|
|
370
|
+
E(() => i.createFileUrl(t, (u) => {
|
|
371
|
+
s(u), p(!0);
|
|
372
|
+
}), [t]);
|
|
373
|
+
const m = () => i.deleteFile(t);
|
|
374
|
+
return /* @__PURE__ */ a(b.Provider, { value: { file: t, objectUrl: n, isLoading: l, setIsLoading: p, onRemove: m }, children: /* @__PURE__ */ a(Z, { "data-loading": g(l), ...e }) });
|
|
375
|
+
}, V = o("button", {
|
|
233
376
|
_id: "aiChatInput__FilePreviewTrigger"
|
|
234
|
-
}),
|
|
235
|
-
onClick:
|
|
236
|
-
...
|
|
377
|
+
}), jt = ({
|
|
378
|
+
onClick: t,
|
|
379
|
+
...e
|
|
237
380
|
}) => {
|
|
238
|
-
const { objectUrl: i, file: n } =
|
|
239
|
-
return /* @__PURE__ */
|
|
240
|
-
|
|
381
|
+
const { objectUrl: i, file: n } = x(), { openImagePreview: s } = I();
|
|
382
|
+
return /* @__PURE__ */ a(
|
|
383
|
+
V,
|
|
241
384
|
{
|
|
242
385
|
type: "button",
|
|
243
386
|
"aria-label": `Preview ${n.name}`,
|
|
244
387
|
disabled: !i,
|
|
245
|
-
onClick:
|
|
246
|
-
i &&
|
|
388
|
+
onClick: r(t, () => {
|
|
389
|
+
i && s({ url: i, name: n.name });
|
|
247
390
|
}),
|
|
248
|
-
...
|
|
391
|
+
...e
|
|
249
392
|
}
|
|
250
393
|
);
|
|
251
|
-
},
|
|
394
|
+
}, W = o("span", {
|
|
252
395
|
_id: "aiChatInput__FileContent"
|
|
253
|
-
}),
|
|
396
|
+
}), Et = (t) => /* @__PURE__ */ a(W, { ...t }), G = o("img", {
|
|
254
397
|
_id: "aiChatInput__FileThumbnail"
|
|
255
|
-
}),
|
|
256
|
-
onLoad:
|
|
257
|
-
...
|
|
398
|
+
}), wt = ({
|
|
399
|
+
onLoad: t,
|
|
400
|
+
...e
|
|
258
401
|
}) => {
|
|
259
|
-
const { objectUrl: i, file: n, setIsLoading:
|
|
260
|
-
return /* @__PURE__ */
|
|
261
|
-
|
|
402
|
+
const { objectUrl: i, file: n, setIsLoading: s } = x();
|
|
403
|
+
return /* @__PURE__ */ a(
|
|
404
|
+
G,
|
|
262
405
|
{
|
|
263
406
|
src: i,
|
|
264
407
|
alt: n.name,
|
|
265
|
-
onLoad:
|
|
266
|
-
...
|
|
408
|
+
onLoad: r(t, () => s(!1)),
|
|
409
|
+
...e
|
|
267
410
|
}
|
|
268
411
|
);
|
|
269
|
-
},
|
|
270
|
-
const { file:
|
|
271
|
-
return /* @__PURE__ */
|
|
272
|
-
},
|
|
412
|
+
}, kt = ({ className: t }) => {
|
|
413
|
+
const { file: e } = x(), i = L[R(e).type] ?? "file";
|
|
414
|
+
return /* @__PURE__ */ a(v, { iconKey: i, className: t });
|
|
415
|
+
}, J = o("span", {
|
|
273
416
|
_id: "aiChatInput__FileName"
|
|
274
|
-
}),
|
|
275
|
-
const { file:
|
|
276
|
-
return /* @__PURE__ */
|
|
277
|
-
}, Q =
|
|
417
|
+
}), Nt = (t) => {
|
|
418
|
+
const { file: e } = x();
|
|
419
|
+
return /* @__PURE__ */ a(J, { ...t, children: e.name });
|
|
420
|
+
}, Q = o("button", {
|
|
278
421
|
_id: "aiChatInput__FileRemove"
|
|
279
|
-
}),
|
|
422
|
+
}), Tt = o(v, {
|
|
280
423
|
_id: "aiChatInput__FileRemoveIcon",
|
|
281
424
|
iconKey: "close"
|
|
282
|
-
}),
|
|
283
|
-
onClick:
|
|
284
|
-
...
|
|
425
|
+
}), Lt = ({
|
|
426
|
+
onClick: t,
|
|
427
|
+
...e
|
|
285
428
|
}) => {
|
|
286
|
-
const { onRemove: i } =
|
|
287
|
-
return /* @__PURE__ */
|
|
429
|
+
const { onRemove: i } = x();
|
|
430
|
+
return /* @__PURE__ */ a(
|
|
288
431
|
Q,
|
|
289
432
|
{
|
|
290
433
|
type: "button",
|
|
291
434
|
"aria-label": "Remove file",
|
|
292
|
-
onClick:
|
|
293
|
-
...
|
|
435
|
+
onClick: r(t, i),
|
|
436
|
+
...e
|
|
294
437
|
}
|
|
295
438
|
);
|
|
296
439
|
};
|
|
297
440
|
export {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
g as isImageMimeType,
|
|
441
|
+
M as ACCEPTED_FILE_MIME_TYPES,
|
|
442
|
+
ut as EmbeddedChatPrimitiveDropZone,
|
|
443
|
+
Et as EmbeddedChatPrimitiveFileContent,
|
|
444
|
+
It as EmbeddedChatPrimitiveFileInput,
|
|
445
|
+
yt as EmbeddedChatPrimitiveFileItem,
|
|
446
|
+
Pt as EmbeddedChatPrimitiveFileList,
|
|
447
|
+
Nt as EmbeddedChatPrimitiveFileName,
|
|
448
|
+
jt as EmbeddedChatPrimitiveFilePreviewTrigger,
|
|
449
|
+
Lt as EmbeddedChatPrimitiveFileRemove,
|
|
450
|
+
Tt as EmbeddedChatPrimitiveFileRemoveIcon,
|
|
451
|
+
wt as EmbeddedChatPrimitiveFileThumbnail,
|
|
452
|
+
kt as EmbeddedChatPrimitiveFileTypeIcon,
|
|
453
|
+
Ct as EmbeddedChatPrimitiveFileUploadButton,
|
|
454
|
+
Ft as EmbeddedChatPrimitiveFileUploadButtonIcon,
|
|
455
|
+
mt as EmbeddedChatPrimitiveInputFieldset,
|
|
456
|
+
ft as EmbeddedChatPrimitiveInputNotification,
|
|
457
|
+
gt as EmbeddedChatPrimitiveInputNotificationClose,
|
|
458
|
+
_t as EmbeddedChatPrimitiveInputNotificationContent,
|
|
459
|
+
bt as EmbeddedChatPrimitiveInputNotificationHeader,
|
|
460
|
+
vt as EmbeddedChatPrimitiveInputNotificationMessage,
|
|
461
|
+
ht as EmbeddedChatPrimitiveInputNotificationTitle,
|
|
462
|
+
xt as EmbeddedChatPrimitiveMessageFile,
|
|
463
|
+
dt as EmbeddedChatPrimitiveMessageFiles,
|
|
464
|
+
_ as FILE_ACCEPT_MAP,
|
|
465
|
+
L as FILE_TYPE_ICON_MAP,
|
|
466
|
+
P as MAX_FILES,
|
|
467
|
+
y as MAX_FILE_SIZE,
|
|
468
|
+
F as isImageMimeType,
|
|
327
469
|
R as normalizeFileType
|
|
328
470
|
};
|