ordify-chat-widget 1.0.45 → 1.0.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/components/AttachmentChips.d.ts +10 -0
  2. package/dist/components/AttachmentChips.d.ts.map +1 -0
  3. package/dist/components/AttachmentPicker.d.ts +16 -0
  4. package/dist/components/AttachmentPicker.d.ts.map +1 -0
  5. package/dist/components/ChatHeader.d.ts +13 -0
  6. package/dist/components/ChatHeader.d.ts.map +1 -0
  7. package/dist/components/Conversation.d.ts +22 -0
  8. package/dist/components/Conversation.d.ts.map +1 -0
  9. package/dist/components/EmbeddedChat.d.ts +9 -0
  10. package/dist/components/EmbeddedChat.d.ts.map +1 -0
  11. package/dist/components/FloatingChat.d.ts +9 -0
  12. package/dist/components/FloatingChat.d.ts.map +1 -0
  13. package/dist/components/Icons.d.ts +10 -0
  14. package/dist/components/Icons.d.ts.map +1 -0
  15. package/dist/components/InlineChat.d.ts +9 -0
  16. package/dist/components/InlineChat.d.ts.map +1 -0
  17. package/dist/components/MarkdownRenderer.d.ts +7 -0
  18. package/dist/components/MarkdownRenderer.d.ts.map +1 -0
  19. package/dist/components/OrdifyChat.d.ts +4 -0
  20. package/dist/components/OrdifyChat.d.ts.map +1 -0
  21. package/dist/components/ProfessionalInput.d.ts +15 -0
  22. package/dist/components/ProfessionalInput.d.ts.map +1 -0
  23. package/dist/components/ResizeHandle.d.ts +8 -0
  24. package/dist/components/ResizeHandle.d.ts.map +1 -0
  25. package/dist/components/SendIcon.d.ts +4 -0
  26. package/dist/components/SendIcon.d.ts.map +1 -0
  27. package/dist/components/WelcomeScreen.d.ts +11 -0
  28. package/dist/components/WelcomeScreen.d.ts.map +1 -0
  29. package/dist/components/styled/ChatComponents.d.ts +45 -0
  30. package/dist/components/styled/ChatComponents.d.ts.map +1 -0
  31. package/dist/hooks/useOrdifyChat.d.ts +4 -0
  32. package/dist/hooks/useOrdifyChat.d.ts.map +1 -0
  33. package/dist/hooks/useOrdifyConfig.d.ts +36 -0
  34. package/dist/hooks/useOrdifyConfig.d.ts.map +1 -0
  35. package/dist/hooks/useWidgetAttachmentStaging.d.ts +16 -0
  36. package/dist/hooks/useWidgetAttachmentStaging.d.ts.map +1 -0
  37. package/dist/index.cjs.js +1182 -0
  38. package/dist/index.d.ts +12 -0
  39. package/dist/index.d.ts.map +1 -0
  40. package/dist/index.esm.js +4488 -0
  41. package/dist/ordify-chat-widget.standalone.js +345 -66
  42. package/dist/ordify-chat-widget.standalone.js.map +1 -1
  43. package/dist/standalone.d.ts +12 -0
  44. package/dist/standalone.d.ts.map +1 -0
  45. package/dist/types/index.d.ts +150 -0
  46. package/dist/types/index.d.ts.map +1 -0
  47. package/dist/utils/api.d.ts +26 -0
  48. package/dist/utils/api.d.ts.map +1 -0
  49. package/dist/utils/attachments.d.ts +6 -0
  50. package/dist/utils/attachments.d.ts.map +1 -0
  51. package/dist/utils/index.d.ts +5 -0
  52. package/dist/utils/index.d.ts.map +1 -0
  53. package/package.json +2 -1
@@ -0,0 +1,4488 @@
1
+ var Tn = Object.defineProperty;
2
+ var En = (e, t, r) => t in e ? Tn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var bt = (e, t, r) => En(e, typeof t != "symbol" ? t + "" : t, r);
4
+ import * as Bt from "react";
5
+ import F, { useState as J, useRef as ae, useEffect as De, useCallback as Z, useMemo as Pt, forwardRef as Fr, createElement as Je, useContext as Kr, useImperativeHandle as Mn, useLayoutEffect as _n, createContext as Rn } from "react";
6
+ var Wr = { exports: {} }, ot = {};
7
+ /**
8
+ * @license React
9
+ * react-jsx-runtime.production.min.js
10
+ *
11
+ * Copyright (c) Facebook, Inc. and its affiliates.
12
+ *
13
+ * This source code is licensed under the MIT license found in the
14
+ * LICENSE file in the root directory of this source tree.
15
+ */
16
+ var zn = F, Dn = Symbol.for("react.element"), On = Symbol.for("react.fragment"), Nn = Object.prototype.hasOwnProperty, Bn = zn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, Pn = { key: !0, ref: !0, __self: !0, __source: !0 };
17
+ function Ur(e, t, r) {
18
+ var n, a = {}, c = null, u = null;
19
+ r !== void 0 && (c = "" + r), t.key !== void 0 && (c = "" + t.key), t.ref !== void 0 && (u = t.ref);
20
+ for (n in t) Nn.call(t, n) && !Pn.hasOwnProperty(n) && (a[n] = t[n]);
21
+ if (e && e.defaultProps) for (n in t = e.defaultProps, t) a[n] === void 0 && (a[n] = t[n]);
22
+ return { $$typeof: Dn, type: e, key: c, ref: u, props: a, _owner: Bn.current };
23
+ }
24
+ ot.Fragment = On;
25
+ ot.jsx = Ur;
26
+ ot.jsxs = Ur;
27
+ Wr.exports = ot;
28
+ var l = Wr.exports;
29
+ function Ue() {
30
+ return Math.random().toString(36).substr(2, 9);
31
+ }
32
+ function ii(e) {
33
+ return new Intl.DateTimeFormat("en-US", {
34
+ hour: "2-digit",
35
+ minute: "2-digit",
36
+ hour12: !0
37
+ }).format(e);
38
+ }
39
+ function ci(e, t) {
40
+ let r;
41
+ return (...n) => {
42
+ clearTimeout(r), r = setTimeout(() => e(...n), t);
43
+ };
44
+ }
45
+ function li(e, t) {
46
+ let r;
47
+ return (...n) => {
48
+ r || (e(...n), r = !0, setTimeout(() => r = !1, t));
49
+ };
50
+ }
51
+ function Ln(e) {
52
+ return {
53
+ id: e.id,
54
+ name: e.name,
55
+ url: e.url,
56
+ content_type: e.content_type,
57
+ type: e.type,
58
+ size: e.size ?? null,
59
+ preview: null,
60
+ oauth_token: null
61
+ };
62
+ }
63
+ class Fn {
64
+ constructor(t) {
65
+ bt(this, "config");
66
+ bt(this, "warnedLegacyApiKey", !1);
67
+ if (this.config = t, !this.config.publishableKey && !this.config.apiKey)
68
+ throw new Error("Either publishableKey or apiKey is required.");
69
+ this.config.publishableKey && this.config.apiKey && console.warn("[Ordify] Both publishableKey and apiKey provided. publishableKey will be used.");
70
+ }
71
+ usePublishableKey() {
72
+ return !!this.config.publishableKey;
73
+ }
74
+ maybeWarnLegacyApiKey() {
75
+ this.usePublishableKey() || this.warnedLegacyApiKey || (this.warnedLegacyApiKey = !0, console.warn(
76
+ "[Ordify] Using legacy apiKey in browser. For production embeds, use publishableKey from user settings."
77
+ ));
78
+ }
79
+ getAuthHeaders(t = !1) {
80
+ return this.usePublishableKey() ? {
81
+ ...t ? { "Content-Type": "application/json" } : {},
82
+ "x-ordify-publishable-key": this.config.publishableKey,
83
+ accept: "application/json"
84
+ } : (this.maybeWarnLegacyApiKey(), {
85
+ ...t ? { "Content-Type": "application/json" } : {},
86
+ "api-key": this.config.apiKey,
87
+ accept: "application/json"
88
+ });
89
+ }
90
+ async sendMessage(t, r, n, a) {
91
+ const c = this.usePublishableKey() ? `/widget/chat/${this.config.agentId}` : `/chat/agents/${this.config.agentId}`, u = `${this.config.apiBaseUrl}${c}`, d = a != null && a.length ? a.map(Ln) : void 0, h = {
92
+ message: t,
93
+ sessionId: r,
94
+ context: n
95
+ };
96
+ d != null && d.length && (h.attachments = d, h.use_document_understanding = d.some(
97
+ (b) => b.type === "document" || !b.type && !String(b.content_type || "").startsWith("image/")
98
+ ));
99
+ const g = await fetch(u, {
100
+ method: "POST",
101
+ headers: this.getAuthHeaders(!0),
102
+ body: JSON.stringify(h)
103
+ });
104
+ if (!g.ok) {
105
+ const b = await g.json();
106
+ throw new Error(`API Error: ${b.detail}`);
107
+ }
108
+ if (!g.body)
109
+ throw new Error("No response body");
110
+ return g.body;
111
+ }
112
+ /**
113
+ * Upload a file for widget chat. Requires publishableKey (browser-safe auth).
114
+ */
115
+ async uploadAttachment(t) {
116
+ if (!this.usePublishableKey())
117
+ throw new Error("[Ordify] uploadAttachment requires publishableKey.");
118
+ const r = `${this.config.apiBaseUrl}/widget/attachments`, n = new FormData();
119
+ n.append("file", t);
120
+ const a = await fetch(r, {
121
+ method: "POST",
122
+ headers: this.getAuthHeaders(!1),
123
+ body: n
124
+ });
125
+ if (!a.ok) {
126
+ let u = `HTTP ${a.status}`;
127
+ try {
128
+ u = (await a.json()).detail || u;
129
+ } catch {
130
+ }
131
+ throw new Error(`API Error: ${u}`);
132
+ }
133
+ const c = await a.json();
134
+ if (!(c != null && c.url) || !(c != null && c.content_type) || !(c != null && c.name))
135
+ throw new Error("Invalid attachment response from server");
136
+ return {
137
+ id: c.id,
138
+ name: c.name,
139
+ type: c.type === "image" ? "image" : "document",
140
+ url: c.url,
141
+ content_type: c.content_type,
142
+ size: c.size,
143
+ preview: c.preview
144
+ };
145
+ }
146
+ async createSession() {
147
+ const t = this.usePublishableKey() ? "/widget/sessions" : "/sessions", r = `${this.config.apiBaseUrl}${t}`, n = await fetch(r, {
148
+ method: "POST",
149
+ headers: this.getAuthHeaders(!0),
150
+ body: JSON.stringify({
151
+ name: "Chat Session",
152
+ agentConfig: {
153
+ type: "chat",
154
+ settings: null
155
+ }
156
+ })
157
+ });
158
+ if (!n.ok) {
159
+ const a = await n.json();
160
+ throw new Error(`API Error: ${a.detail}`);
161
+ }
162
+ return n.json();
163
+ }
164
+ async getSessionWithMessages(t) {
165
+ const r = this.usePublishableKey() ? `/widget/sessions/${t}/with-messages` : `/sessions/${t}/with-messages`, n = `${this.config.apiBaseUrl}${r}`, a = await fetch(n, {
166
+ method: "GET",
167
+ headers: this.getAuthHeaders()
168
+ });
169
+ if (!a.ok) {
170
+ const c = await a.json();
171
+ throw new Error(`API Error: ${c.detail}`);
172
+ }
173
+ return a.json();
174
+ }
175
+ /** @deprecated Use the Ordify dashboard to list agents. Will be removed in a future major version. */
176
+ async getAgents() {
177
+ if (!this.config.apiKey)
178
+ throw new Error("[Ordify] getAgents() requires apiKey and is not supported with publishableKey.");
179
+ const t = `${this.config.apiBaseUrl}/chat/agents`, r = await fetch(t, {
180
+ method: "GET",
181
+ headers: { "api-key": this.config.apiKey, accept: "application/json" }
182
+ });
183
+ if (!r.ok) {
184
+ const a = await r.json();
185
+ throw new Error(`API Error: ${a.detail}`);
186
+ }
187
+ return (await r.json()).agents || [];
188
+ }
189
+ /** @deprecated Use sessionId prop to load sessions. Will be removed in a future major version. */
190
+ async getSessions() {
191
+ if (!this.config.apiKey)
192
+ throw new Error("[Ordify] getSessions() requires apiKey and is not supported with publishableKey.");
193
+ const t = `${this.config.apiBaseUrl}/sessions`, r = await fetch(t, {
194
+ method: "GET",
195
+ headers: { "api-key": this.config.apiKey, accept: "application/json" }
196
+ });
197
+ if (!r.ok) {
198
+ const n = await r.json();
199
+ throw new Error(`API Error: ${n.detail}`);
200
+ }
201
+ return r.json();
202
+ }
203
+ }
204
+ function Kn(e) {
205
+ try {
206
+ if (e.startsWith("data: ")) {
207
+ const t = e.slice(6).trim();
208
+ if (t === "[DONE]" || t === "")
209
+ return { text: "", sessionId: "", type: "done" };
210
+ const r = JSON.parse(t);
211
+ return r.done ? { text: "", sessionId: r.sessionId || "", type: "done" } : r;
212
+ }
213
+ } catch (t) {
214
+ console.warn("Failed to parse streaming response:", t);
215
+ }
216
+ return null;
217
+ }
218
+ function sr(e) {
219
+ const t = (e.attachments || []).map((r) => r.id).join("|");
220
+ return `${e.role}:${e.content.trim()}:${t}`;
221
+ }
222
+ function Wn(e) {
223
+ const t = e.attachments;
224
+ if (!t || !Array.isArray(t) || t.length === 0) return;
225
+ const r = [];
226
+ for (const n of t) {
227
+ const a = n.url || "";
228
+ a && r.push({
229
+ id: n.id || Ue(),
230
+ name: String(n.name || "attachment"),
231
+ type: n.type === "image" ? "image" : "document",
232
+ url: a,
233
+ content_type: String(n.content_type || n.contentType || "application/octet-stream"),
234
+ size: n.size,
235
+ preview: n.preview
236
+ });
237
+ }
238
+ return r.length ? r : void 0;
239
+ }
240
+ function Un(e) {
241
+ const [t, r] = J([]), [n, a] = J(!1), [c, u] = J(null), [d, h] = J(e.sessionId || null), [g, b] = J(!1), [p, w] = J(!1), [k, $] = J(!1), [j, S] = J(!1), [o, i] = J(!1), s = ae(null), f = ae(""), m = ae(!1), y = ae(!1), x = ae(!1), A = `${e.publishableKey ?? ""}|${e.apiKey ?? ""}|${e.apiBaseUrl ?? ""}|${e.agentId}`;
242
+ f.current !== A && (s.current = null, f.current = A), s.current || (s.current = new Fn({
243
+ publishableKey: e.publishableKey,
244
+ apiKey: e.apiKey,
245
+ apiBaseUrl: e.apiBaseUrl || "https://api.ordify.ai",
246
+ agentId: e.agentId
247
+ }));
248
+ const M = ae(null), C = ae(/* @__PURE__ */ new Set());
249
+ De(() => {
250
+ if (e.sessionId && e.sessionId !== d) {
251
+ const I = C.current.has(e.sessionId);
252
+ h(e.sessionId), y.current = !1, M.current = null, $(!1), I || r([]);
253
+ }
254
+ }, [e.sessionId]), De(() => {
255
+ (async () => {
256
+ const D = d || e.sessionId;
257
+ if (x.current || n)
258
+ return;
259
+ if (!D) {
260
+ y.current = !0, M.current = null, $(!1);
261
+ return;
262
+ }
263
+ if (M.current === D)
264
+ return;
265
+ if (C.current.has(D) && t.length > 0 && !y.current) {
266
+ y.current = !0, M.current = D, S(!1);
267
+ return;
268
+ }
269
+ M.current = D, S(!0);
270
+ try {
271
+ const v = await s.current.getSessionWithMessages(D);
272
+ if (v.messages && v.messages.length > 0) {
273
+ const O = v.messages.map((R) => ({
274
+ id: R.id || Ue(),
275
+ content: R.content || "",
276
+ role: R.role === "assistant" ? "assistant" : "user",
277
+ timestamp: R.timestamp ? new Date(R.timestamp) : /* @__PURE__ */ new Date(),
278
+ sessionId: D,
279
+ attachments: Wn(R)
280
+ }));
281
+ r((R) => {
282
+ if (R.length > 0) {
283
+ const W = /* @__PURE__ */ new Map(), N = /* @__PURE__ */ new Map();
284
+ return R.forEach((z) => {
285
+ W.set(z.id, z);
286
+ const U = sr(z);
287
+ N.has(U) || N.set(U, z);
288
+ }), O.forEach((z) => {
289
+ const U = sr(z);
290
+ !W.has(z.id) && !N.has(U) ? (W.set(z.id, z), N.set(U, z)) : W.has(z.id) && W.set(z.id, z);
291
+ }), Array.from(W.values()).sort(
292
+ (z, U) => z.timestamp.getTime() - U.timestamp.getTime()
293
+ );
294
+ }
295
+ return O;
296
+ }), $(!0), i(!0);
297
+ } else
298
+ $(!1);
299
+ } catch (v) {
300
+ console.warn("Failed to load session history:", v), $(!1), v instanceof Error && v.message.includes("404") && (h(null), M.current = null);
301
+ } finally {
302
+ S(!1), y.current = !0;
303
+ }
304
+ })();
305
+ }, [d, e.sessionId]);
306
+ const E = Z(() => {
307
+ u(null);
308
+ }, []), K = Z(async (I) => {
309
+ if (!s.current)
310
+ throw new Error("API client not initialized");
311
+ return s.current.uploadAttachment(I);
312
+ }, []), P = Z(
313
+ async (I, D, H) => {
314
+ const v = I.trim(), O = !!(H && H.length > 0);
315
+ if (!(!v && !O || n)) {
316
+ a(!0), u(null);
317
+ try {
318
+ const R = H != null && H.length ? H.map((V) => ({ ...V })) : void 0, W = {
319
+ id: Ue(),
320
+ content: v,
321
+ role: "user",
322
+ timestamp: /* @__PURE__ */ new Date(),
323
+ sessionId: d || void 0,
324
+ attachments: R
325
+ };
326
+ r((V) => [...V, W]), i(!0);
327
+ let N = d || e.sessionId || null;
328
+ N ? N !== d && h(N) : (N = (await s.current.createSession()).id, C.current.add(N), e.onSessionCreated && e.onSessionCreated(N)), x.current = !0;
329
+ const z = (await s.current.sendMessage(
330
+ v || "(see attachments)",
331
+ N,
332
+ D,
333
+ R
334
+ )).getReader(), U = new TextDecoder();
335
+ let Q = {
336
+ id: Ue(),
337
+ content: "",
338
+ role: "assistant",
339
+ timestamp: /* @__PURE__ */ new Date(),
340
+ sessionId: N
341
+ };
342
+ for (r((V) => [...V, Q]); ; ) {
343
+ const { done: V, value: ie } = await z.read();
344
+ if (V) break;
345
+ const ce = U.decode(ie, { stream: !0 }).split(`
346
+ `);
347
+ for (const ke of ce) {
348
+ if (!ke.trim()) continue;
349
+ const ne = Kn(ke);
350
+ if (ne) {
351
+ if (ne.type === "stream" && ne.text)
352
+ Q.content += ne.text, r((ee) => ee.find((_e) => _e.id === Q.id) ? ee.map(
353
+ (_e) => _e.id === Q.id ? { ..._e, content: Q.content } : _e
354
+ ) : [...ee, { ...Q, content: Q.content }]);
355
+ else if (ne.type === "done")
356
+ break;
357
+ }
358
+ }
359
+ }
360
+ N && N !== d && h(N), e.onMessage && e.onMessage(Q);
361
+ } catch (R) {
362
+ const W = R instanceof Error ? R.message : "Failed to send message";
363
+ u(W), e.onError && e.onError(R instanceof Error ? R : new Error(W));
364
+ } finally {
365
+ x.current = !1, a(!1);
366
+ }
367
+ }
368
+ },
369
+ [e.onSessionCreated, e.onMessage, e.onError, e.sessionId, n, d]
370
+ );
371
+ return De(() => {
372
+ const D = !(d || e.sessionId) || !k, H = e.quickQuestions && e.quickQuestions.length > 0;
373
+ if ((e.initialMessage || e.initialContext) && D && !p && !n && !j && !m.current && y.current && !H) {
374
+ w(!0), m.current = !0;
375
+ let v, O;
376
+ if (e.initialMessage && e.initialContext)
377
+ v = e.initialMessage, O = e.initialContext;
378
+ else if (e.initialMessage)
379
+ v = e.initialMessage, O = void 0;
380
+ else if (e.initialContext)
381
+ v = "Hi", O = e.initialContext;
382
+ else
383
+ return;
384
+ setTimeout(() => {
385
+ P(v, O);
386
+ }, 0);
387
+ }
388
+ }, [e.initialMessage, e.initialContext, p, n, j, k, d, e.sessionId, P]), {
389
+ messages: t,
390
+ sendMessage: P,
391
+ uploadAttachment: K,
392
+ isLoading: n,
393
+ error: c,
394
+ clearError: E,
395
+ sessionId: d,
396
+ isOpen: g,
397
+ setIsOpen: b,
398
+ hasSessionStarted: o
399
+ };
400
+ }
401
+ function Le(e) {
402
+ if (typeof process > "u" || !process.env)
403
+ return;
404
+ const t = process.env[e];
405
+ return typeof t == "string" && t.length > 0 ? t : void 0;
406
+ }
407
+ function Hn(e) {
408
+ return Pt(() => {
409
+ const t = e.agentId || Le("ORDIFY_AGENT_ID"), r = e.publishableKey || Le("ORDIFY_PUBLISHABLE_KEY"), n = e.apiKey || Le("ORDIFY_API_KEY"), a = e.apiBaseUrl || Le("ORDIFY_API_BASE_URL") || "https://r.ordify.ai";
410
+ if (!t)
411
+ throw new Error("Ordify agent ID is required. Provide agentId prop or set ORDIFY_AGENT_ID environment variable.");
412
+ if (!r && !n)
413
+ throw new Error(
414
+ "Ordify credentials are required. Provide publishableKey (recommended) or apiKey."
415
+ );
416
+ return {
417
+ agentId: t,
418
+ publishableKey: r,
419
+ apiKey: n,
420
+ apiBaseUrl: a,
421
+ mode: e.mode || "floating",
422
+ position: e.position || "bottom-right",
423
+ theme: e.theme || "auto",
424
+ placeholder: e.placeholder || "Type a message...",
425
+ height: e.height || "500px",
426
+ className: e.className || "",
427
+ buttonStyle: e.buttonStyle || {},
428
+ chatWindowStyle: e.chatWindowStyle || {},
429
+ showHeader: e.showHeader !== !1,
430
+ buttonText: e.buttonText,
431
+ chatName: e.chatName,
432
+ primaryColor: e.primaryColor,
433
+ agentImage: e.agentImage,
434
+ onMessage: e.onMessage,
435
+ onError: e.onError,
436
+ onClose: e.onClose,
437
+ onSessionCreated: e.onSessionCreated,
438
+ initialMessage: e.initialMessage,
439
+ initialContext: e.initialContext,
440
+ sessionId: e.sessionId,
441
+ quickQuestions: e.quickQuestions,
442
+ welcomeMessage: e.welcomeMessage,
443
+ welcomeImage: e.welcomeImage,
444
+ enableAttachments: e.enableAttachments,
445
+ maxAttachmentSizeMB: e.maxAttachmentSizeMB,
446
+ maxAttachments: e.maxAttachments,
447
+ allowedAttachmentTypes: e.allowedAttachmentTypes
448
+ };
449
+ }, [e]);
450
+ }
451
+ /**
452
+ * @license lucide-react v0.544.0 - ISC
453
+ *
454
+ * This source code is licensed under the ISC license.
455
+ * See the LICENSE file in the root directory of this source tree.
456
+ */
457
+ const qn = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Gn = (e) => e.replace(
458
+ /^([A-Z])|[\s-_]+(\w)/g,
459
+ (t, r, n) => n ? n.toUpperCase() : r.toLowerCase()
460
+ ), ir = (e) => {
461
+ const t = Gn(e);
462
+ return t.charAt(0).toUpperCase() + t.slice(1);
463
+ }, Hr = (...e) => e.filter((t, r, n) => !!t && t.trim() !== "" && n.indexOf(t) === r).join(" ").trim(), Yn = (e) => {
464
+ for (const t in e)
465
+ if (t.startsWith("aria-") || t === "role" || t === "title")
466
+ return !0;
467
+ };
468
+ /**
469
+ * @license lucide-react v0.544.0 - ISC
470
+ *
471
+ * This source code is licensed under the ISC license.
472
+ * See the LICENSE file in the root directory of this source tree.
473
+ */
474
+ var Qn = {
475
+ xmlns: "http://www.w3.org/2000/svg",
476
+ width: 24,
477
+ height: 24,
478
+ viewBox: "0 0 24 24",
479
+ fill: "none",
480
+ stroke: "currentColor",
481
+ strokeWidth: 2,
482
+ strokeLinecap: "round",
483
+ strokeLinejoin: "round"
484
+ };
485
+ /**
486
+ * @license lucide-react v0.544.0 - ISC
487
+ *
488
+ * This source code is licensed under the ISC license.
489
+ * See the LICENSE file in the root directory of this source tree.
490
+ */
491
+ const Vn = Fr(
492
+ ({
493
+ color: e = "currentColor",
494
+ size: t = 24,
495
+ strokeWidth: r = 2,
496
+ absoluteStrokeWidth: n,
497
+ className: a = "",
498
+ children: c,
499
+ iconNode: u,
500
+ ...d
501
+ }, h) => Je(
502
+ "svg",
503
+ {
504
+ ref: h,
505
+ ...Qn,
506
+ width: t,
507
+ height: t,
508
+ stroke: e,
509
+ strokeWidth: n ? Number(r) * 24 / Number(t) : r,
510
+ className: Hr("lucide", a),
511
+ ...!c && !Yn(d) && { "aria-hidden": "true" },
512
+ ...d
513
+ },
514
+ [
515
+ ...u.map(([g, b]) => Je(g, b)),
516
+ ...Array.isArray(c) ? c : [c]
517
+ ]
518
+ )
519
+ );
520
+ /**
521
+ * @license lucide-react v0.544.0 - ISC
522
+ *
523
+ * This source code is licensed under the ISC license.
524
+ * See the LICENSE file in the root directory of this source tree.
525
+ */
526
+ const at = (e, t) => {
527
+ const r = Fr(
528
+ ({ className: n, ...a }, c) => Je(Vn, {
529
+ ref: c,
530
+ iconNode: t,
531
+ className: Hr(
532
+ `lucide-${qn(ir(e))}`,
533
+ `lucide-${e}`,
534
+ n
535
+ ),
536
+ ...a
537
+ })
538
+ );
539
+ return r.displayName = ir(e), r;
540
+ };
541
+ /**
542
+ * @license lucide-react v0.544.0 - ISC
543
+ *
544
+ * This source code is licensed under the ISC license.
545
+ * See the LICENSE file in the root directory of this source tree.
546
+ */
547
+ const Zn = [
548
+ ["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z", key: "1rqfz7" }],
549
+ ["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
550
+ ["path", { d: "M10 9H8", key: "b1mrlr" }],
551
+ ["path", { d: "M16 13H8", key: "t4e002" }],
552
+ ["path", { d: "M16 17H8", key: "z1uh3a" }]
553
+ ], Jn = at("file-text", Zn);
554
+ /**
555
+ * @license lucide-react v0.544.0 - ISC
556
+ *
557
+ * This source code is licensed under the ISC license.
558
+ * See the LICENSE file in the root directory of this source tree.
559
+ */
560
+ const Xn = [
561
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2", key: "1m3agn" }],
562
+ ["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }],
563
+ ["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }]
564
+ ], eo = at("image", Xn);
565
+ /**
566
+ * @license lucide-react v0.544.0 - ISC
567
+ *
568
+ * This source code is licensed under the ISC license.
569
+ * See the LICENSE file in the root directory of this source tree.
570
+ */
571
+ const to = [
572
+ [
573
+ "path",
574
+ {
575
+ d: "m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",
576
+ key: "1miecu"
577
+ }
578
+ ]
579
+ ], ro = at("paperclip", to);
580
+ /**
581
+ * @license lucide-react v0.544.0 - ISC
582
+ *
583
+ * This source code is licensed under the ISC license.
584
+ * See the LICENSE file in the root directory of this source tree.
585
+ */
586
+ const no = [
587
+ ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
588
+ ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
589
+ ], oo = at("x", no);
590
+ var X = function() {
591
+ return X = Object.assign || function(t) {
592
+ for (var r, n = 1, a = arguments.length; n < a; n++) {
593
+ r = arguments[n];
594
+ for (var c in r) Object.prototype.hasOwnProperty.call(r, c) && (t[c] = r[c]);
595
+ }
596
+ return t;
597
+ }, X.apply(this, arguments);
598
+ };
599
+ function Xe(e, t, r) {
600
+ if (r || arguments.length === 2) for (var n = 0, a = t.length, c; n < a; n++)
601
+ (c || !(n in t)) && (c || (c = Array.prototype.slice.call(t, 0, n)), c[n] = t[n]);
602
+ return e.concat(c || Array.prototype.slice.call(t));
603
+ }
604
+ var L = "-ms-", Oe = "-moz-", B = "-webkit-", qr = "comm", st = "rule", Lt = "decl", ao = "@import", Gr = "@keyframes", so = "@layer", Yr = Math.abs, Ft = String.fromCharCode, Mt = Object.assign;
605
+ function io(e, t) {
606
+ return Y(e, 0) ^ 45 ? (((t << 2 ^ Y(e, 0)) << 2 ^ Y(e, 1)) << 2 ^ Y(e, 2)) << 2 ^ Y(e, 3) : 0;
607
+ }
608
+ function Qr(e) {
609
+ return e.trim();
610
+ }
611
+ function de(e, t) {
612
+ return (e = t.exec(e)) ? e[0] : e;
613
+ }
614
+ function _(e, t, r) {
615
+ return e.replace(t, r);
616
+ }
617
+ function He(e, t, r) {
618
+ return e.indexOf(t, r);
619
+ }
620
+ function Y(e, t) {
621
+ return e.charCodeAt(t) | 0;
622
+ }
623
+ function $e(e, t, r) {
624
+ return e.slice(t, r);
625
+ }
626
+ function se(e) {
627
+ return e.length;
628
+ }
629
+ function Vr(e) {
630
+ return e.length;
631
+ }
632
+ function ze(e, t) {
633
+ return t.push(e), e;
634
+ }
635
+ function co(e, t) {
636
+ return e.map(t).join("");
637
+ }
638
+ function cr(e, t) {
639
+ return e.filter(function(r) {
640
+ return !de(r, t);
641
+ });
642
+ }
643
+ var it = 1, Se = 1, Zr = 0, te = 0, G = 0, Me = "";
644
+ function ct(e, t, r, n, a, c, u, d) {
645
+ return { value: e, root: t, parent: r, type: n, props: a, children: c, line: it, column: Se, length: u, return: "", siblings: d };
646
+ }
647
+ function fe(e, t) {
648
+ return Mt(ct("", null, null, "", null, null, 0, e.siblings), e, { length: -e.length }, t);
649
+ }
650
+ function we(e) {
651
+ for (; e.root; )
652
+ e = fe(e.root, { children: [e] });
653
+ ze(e, e.siblings);
654
+ }
655
+ function lo() {
656
+ return G;
657
+ }
658
+ function uo() {
659
+ return G = te > 0 ? Y(Me, --te) : 0, Se--, G === 10 && (Se = 1, it--), G;
660
+ }
661
+ function re() {
662
+ return G = te < Zr ? Y(Me, te++) : 0, Se++, G === 10 && (Se = 1, it++), G;
663
+ }
664
+ function ge() {
665
+ return Y(Me, te);
666
+ }
667
+ function qe() {
668
+ return te;
669
+ }
670
+ function lt(e, t) {
671
+ return $e(Me, e, t);
672
+ }
673
+ function _t(e) {
674
+ switch (e) {
675
+ case 0:
676
+ case 9:
677
+ case 10:
678
+ case 13:
679
+ case 32:
680
+ return 5;
681
+ case 33:
682
+ case 43:
683
+ case 44:
684
+ case 47:
685
+ case 62:
686
+ case 64:
687
+ case 126:
688
+ case 59:
689
+ case 123:
690
+ case 125:
691
+ return 4;
692
+ case 58:
693
+ return 3;
694
+ case 34:
695
+ case 39:
696
+ case 40:
697
+ case 91:
698
+ return 2;
699
+ case 41:
700
+ case 93:
701
+ return 1;
702
+ }
703
+ return 0;
704
+ }
705
+ function po(e) {
706
+ return it = Se = 1, Zr = se(Me = e), te = 0, [];
707
+ }
708
+ function fo(e) {
709
+ return Me = "", e;
710
+ }
711
+ function xt(e) {
712
+ return Qr(lt(te - 1, Rt(e === 91 ? e + 2 : e === 40 ? e + 1 : e)));
713
+ }
714
+ function ho(e) {
715
+ for (; (G = ge()) && G < 33; )
716
+ re();
717
+ return _t(e) > 2 || _t(G) > 3 ? "" : " ";
718
+ }
719
+ function mo(e, t) {
720
+ for (; --t && re() && !(G < 48 || G > 102 || G > 57 && G < 65 || G > 70 && G < 97); )
721
+ ;
722
+ return lt(e, qe() + (t < 6 && ge() == 32 && re() == 32));
723
+ }
724
+ function Rt(e) {
725
+ for (; re(); )
726
+ switch (G) {
727
+ case e:
728
+ return te;
729
+ case 34:
730
+ case 39:
731
+ e !== 34 && e !== 39 && Rt(G);
732
+ break;
733
+ case 40:
734
+ e === 41 && Rt(e);
735
+ break;
736
+ case 92:
737
+ re();
738
+ break;
739
+ }
740
+ return te;
741
+ }
742
+ function go(e, t) {
743
+ for (; re() && e + G !== 57; )
744
+ if (e + G === 84 && ge() === 47)
745
+ break;
746
+ return "/*" + lt(t, te - 1) + "*" + Ft(e === 47 ? e : re());
747
+ }
748
+ function bo(e) {
749
+ for (; !_t(ge()); )
750
+ re();
751
+ return lt(e, te);
752
+ }
753
+ function xo(e) {
754
+ return fo(Ge("", null, null, null, [""], e = po(e), 0, [0], e));
755
+ }
756
+ function Ge(e, t, r, n, a, c, u, d, h) {
757
+ for (var g = 0, b = 0, p = u, w = 0, k = 0, $ = 0, j = 1, S = 1, o = 1, i = 0, s = "", f = a, m = c, y = n, x = s; S; )
758
+ switch ($ = i, i = re()) {
759
+ case 40:
760
+ if ($ != 108 && Y(x, p - 1) == 58) {
761
+ He(x += _(xt(i), "&", "&\f"), "&\f", Yr(g ? d[g - 1] : 0)) != -1 && (o = -1);
762
+ break;
763
+ }
764
+ case 34:
765
+ case 39:
766
+ case 91:
767
+ x += xt(i);
768
+ break;
769
+ case 9:
770
+ case 10:
771
+ case 13:
772
+ case 32:
773
+ x += ho($);
774
+ break;
775
+ case 92:
776
+ x += mo(qe() - 1, 7);
777
+ continue;
778
+ case 47:
779
+ switch (ge()) {
780
+ case 42:
781
+ case 47:
782
+ ze(yo(go(re(), qe()), t, r, h), h);
783
+ break;
784
+ default:
785
+ x += "/";
786
+ }
787
+ break;
788
+ case 123 * j:
789
+ d[g++] = se(x) * o;
790
+ case 125 * j:
791
+ case 59:
792
+ case 0:
793
+ switch (i) {
794
+ case 0:
795
+ case 125:
796
+ S = 0;
797
+ case 59 + b:
798
+ o == -1 && (x = _(x, /\f/g, "")), k > 0 && se(x) - p && ze(k > 32 ? dr(x + ";", n, r, p - 1, h) : dr(_(x, " ", "") + ";", n, r, p - 2, h), h);
799
+ break;
800
+ case 59:
801
+ x += ";";
802
+ default:
803
+ if (ze(y = lr(x, t, r, g, b, a, d, s, f = [], m = [], p, c), c), i === 123)
804
+ if (b === 0)
805
+ Ge(x, t, y, y, f, c, p, d, m);
806
+ else
807
+ switch (w === 99 && Y(x, 3) === 110 ? 100 : w) {
808
+ case 100:
809
+ case 108:
810
+ case 109:
811
+ case 115:
812
+ Ge(e, y, y, n && ze(lr(e, y, y, 0, 0, a, d, s, a, f = [], p, m), m), a, m, p, d, n ? f : m);
813
+ break;
814
+ default:
815
+ Ge(x, y, y, y, [""], m, 0, d, m);
816
+ }
817
+ }
818
+ g = b = k = 0, j = o = 1, s = x = "", p = u;
819
+ break;
820
+ case 58:
821
+ p = 1 + se(x), k = $;
822
+ default:
823
+ if (j < 1) {
824
+ if (i == 123)
825
+ --j;
826
+ else if (i == 125 && j++ == 0 && uo() == 125)
827
+ continue;
828
+ }
829
+ switch (x += Ft(i), i * j) {
830
+ case 38:
831
+ o = b > 0 ? 1 : (x += "\f", -1);
832
+ break;
833
+ case 44:
834
+ d[g++] = (se(x) - 1) * o, o = 1;
835
+ break;
836
+ case 64:
837
+ ge() === 45 && (x += xt(re())), w = ge(), b = p = se(s = x += bo(qe())), i++;
838
+ break;
839
+ case 45:
840
+ $ === 45 && se(x) == 2 && (j = 0);
841
+ }
842
+ }
843
+ return c;
844
+ }
845
+ function lr(e, t, r, n, a, c, u, d, h, g, b, p) {
846
+ for (var w = a - 1, k = a === 0 ? c : [""], $ = Vr(k), j = 0, S = 0, o = 0; j < n; ++j)
847
+ for (var i = 0, s = $e(e, w + 1, w = Yr(S = u[j])), f = e; i < $; ++i)
848
+ (f = Qr(S > 0 ? k[i] + " " + s : _(s, /&\f/g, k[i]))) && (h[o++] = f);
849
+ return ct(e, t, r, a === 0 ? st : d, h, g, b, p);
850
+ }
851
+ function yo(e, t, r, n) {
852
+ return ct(e, t, r, qr, Ft(lo()), $e(e, 2, -2), 0, n);
853
+ }
854
+ function dr(e, t, r, n, a) {
855
+ return ct(e, t, r, Lt, $e(e, 0, n), $e(e, n + 1, -1), n, a);
856
+ }
857
+ function Jr(e, t, r) {
858
+ switch (io(e, t)) {
859
+ case 5103:
860
+ return B + "print-" + e + e;
861
+ case 5737:
862
+ case 4201:
863
+ case 3177:
864
+ case 3433:
865
+ case 1641:
866
+ case 4457:
867
+ case 2921:
868
+ case 5572:
869
+ case 6356:
870
+ case 5844:
871
+ case 3191:
872
+ case 6645:
873
+ case 3005:
874
+ case 6391:
875
+ case 5879:
876
+ case 5623:
877
+ case 6135:
878
+ case 4599:
879
+ case 4855:
880
+ case 4215:
881
+ case 6389:
882
+ case 5109:
883
+ case 5365:
884
+ case 5621:
885
+ case 3829:
886
+ return B + e + e;
887
+ case 4789:
888
+ return Oe + e + e;
889
+ case 5349:
890
+ case 4246:
891
+ case 4810:
892
+ case 6968:
893
+ case 2756:
894
+ return B + e + Oe + e + L + e + e;
895
+ case 5936:
896
+ switch (Y(e, t + 11)) {
897
+ case 114:
898
+ return B + e + L + _(e, /[svh]\w+-[tblr]{2}/, "tb") + e;
899
+ case 108:
900
+ return B + e + L + _(e, /[svh]\w+-[tblr]{2}/, "tb-rl") + e;
901
+ case 45:
902
+ return B + e + L + _(e, /[svh]\w+-[tblr]{2}/, "lr") + e;
903
+ }
904
+ case 6828:
905
+ case 4268:
906
+ case 2903:
907
+ return B + e + L + e + e;
908
+ case 6165:
909
+ return B + e + L + "flex-" + e + e;
910
+ case 5187:
911
+ return B + e + _(e, /(\w+).+(:[^]+)/, B + "box-$1$2" + L + "flex-$1$2") + e;
912
+ case 5443:
913
+ return B + e + L + "flex-item-" + _(e, /flex-|-self/g, "") + (de(e, /flex-|baseline/) ? "" : L + "grid-row-" + _(e, /flex-|-self/g, "")) + e;
914
+ case 4675:
915
+ return B + e + L + "flex-line-pack" + _(e, /align-content|flex-|-self/g, "") + e;
916
+ case 5548:
917
+ return B + e + L + _(e, "shrink", "negative") + e;
918
+ case 5292:
919
+ return B + e + L + _(e, "basis", "preferred-size") + e;
920
+ case 6060:
921
+ return B + "box-" + _(e, "-grow", "") + B + e + L + _(e, "grow", "positive") + e;
922
+ case 4554:
923
+ return B + _(e, /([^-])(transform)/g, "$1" + B + "$2") + e;
924
+ case 6187:
925
+ return _(_(_(e, /(zoom-|grab)/, B + "$1"), /(image-set)/, B + "$1"), e, "") + e;
926
+ case 5495:
927
+ case 3959:
928
+ return _(e, /(image-set\([^]*)/, B + "$1$`$1");
929
+ case 4968:
930
+ return _(_(e, /(.+:)(flex-)?(.*)/, B + "box-pack:$3" + L + "flex-pack:$3"), /s.+-b[^;]+/, "justify") + B + e + e;
931
+ case 4200:
932
+ if (!de(e, /flex-|baseline/)) return L + "grid-column-align" + $e(e, t) + e;
933
+ break;
934
+ case 2592:
935
+ case 3360:
936
+ return L + _(e, "template-", "") + e;
937
+ case 4384:
938
+ case 3616:
939
+ return r && r.some(function(n, a) {
940
+ return t = a, de(n.props, /grid-\w+-end/);
941
+ }) ? ~He(e + (r = r[t].value), "span", 0) ? e : L + _(e, "-start", "") + e + L + "grid-row-span:" + (~He(r, "span", 0) ? de(r, /\d+/) : +de(r, /\d+/) - +de(e, /\d+/)) + ";" : L + _(e, "-start", "") + e;
942
+ case 4896:
943
+ case 4128:
944
+ return r && r.some(function(n) {
945
+ return de(n.props, /grid-\w+-start/);
946
+ }) ? e : L + _(_(e, "-end", "-span"), "span ", "") + e;
947
+ case 4095:
948
+ case 3583:
949
+ case 4068:
950
+ case 2532:
951
+ return _(e, /(.+)-inline(.+)/, B + "$1$2") + e;
952
+ case 8116:
953
+ case 7059:
954
+ case 5753:
955
+ case 5535:
956
+ case 5445:
957
+ case 5701:
958
+ case 4933:
959
+ case 4677:
960
+ case 5533:
961
+ case 5789:
962
+ case 5021:
963
+ case 4765:
964
+ if (se(e) - 1 - t > 6)
965
+ switch (Y(e, t + 1)) {
966
+ case 109:
967
+ if (Y(e, t + 4) !== 45)
968
+ break;
969
+ case 102:
970
+ return _(e, /(.+:)(.+)-([^]+)/, "$1" + B + "$2-$3$1" + Oe + (Y(e, t + 3) == 108 ? "$3" : "$2-$3")) + e;
971
+ case 115:
972
+ return ~He(e, "stretch", 0) ? Jr(_(e, "stretch", "fill-available"), t, r) + e : e;
973
+ }
974
+ break;
975
+ case 5152:
976
+ case 5920:
977
+ return _(e, /(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/, function(n, a, c, u, d, h, g) {
978
+ return L + a + ":" + c + g + (u ? L + a + "-span:" + (d ? h : +h - +c) + g : "") + e;
979
+ });
980
+ case 4949:
981
+ if (Y(e, t + 6) === 121)
982
+ return _(e, ":", ":" + B) + e;
983
+ break;
984
+ case 6444:
985
+ switch (Y(e, Y(e, 14) === 45 ? 18 : 11)) {
986
+ case 120:
987
+ return _(e, /(.+:)([^;\s!]+)(;|(\s+)?!.+)?/, "$1" + B + (Y(e, 14) === 45 ? "inline-" : "") + "box$3$1" + B + "$2$3$1" + L + "$2box$3") + e;
988
+ case 100:
989
+ return _(e, ":", ":" + L) + e;
990
+ }
991
+ break;
992
+ case 5719:
993
+ case 2647:
994
+ case 2135:
995
+ case 3927:
996
+ case 2391:
997
+ return _(e, "scroll-", "scroll-snap-") + e;
998
+ }
999
+ return e;
1000
+ }
1001
+ function et(e, t) {
1002
+ for (var r = "", n = 0; n < e.length; n++)
1003
+ r += t(e[n], n, e, t) || "";
1004
+ return r;
1005
+ }
1006
+ function ko(e, t, r, n) {
1007
+ switch (e.type) {
1008
+ case so:
1009
+ if (e.children.length) break;
1010
+ case ao:
1011
+ case Lt:
1012
+ return e.return = e.return || e.value;
1013
+ case qr:
1014
+ return "";
1015
+ case Gr:
1016
+ return e.return = e.value + "{" + et(e.children, n) + "}";
1017
+ case st:
1018
+ if (!se(e.value = e.props.join(","))) return "";
1019
+ }
1020
+ return se(r = et(e.children, n)) ? e.return = e.value + "{" + r + "}" : "";
1021
+ }
1022
+ function wo(e) {
1023
+ var t = Vr(e);
1024
+ return function(r, n, a, c) {
1025
+ for (var u = "", d = 0; d < t; d++)
1026
+ u += e[d](r, n, a, c) || "";
1027
+ return u;
1028
+ };
1029
+ }
1030
+ function vo(e) {
1031
+ return function(t) {
1032
+ t.root || (t = t.return) && e(t);
1033
+ };
1034
+ }
1035
+ function $o(e, t, r, n) {
1036
+ if (e.length > -1 && !e.return)
1037
+ switch (e.type) {
1038
+ case Lt:
1039
+ e.return = Jr(e.value, e.length, r);
1040
+ return;
1041
+ case Gr:
1042
+ return et([fe(e, { value: _(e.value, "@", "@" + B) })], n);
1043
+ case st:
1044
+ if (e.length)
1045
+ return co(r = e.props, function(a) {
1046
+ switch (de(a, n = /(::plac\w+|:read-\w+)/)) {
1047
+ case ":read-only":
1048
+ case ":read-write":
1049
+ we(fe(e, { props: [_(a, /:(read-\w+)/, ":" + Oe + "$1")] })), we(fe(e, { props: [a] })), Mt(e, { props: cr(r, n) });
1050
+ break;
1051
+ case "::placeholder":
1052
+ we(fe(e, { props: [_(a, /:(plac\w+)/, ":" + B + "input-$1")] })), we(fe(e, { props: [_(a, /:(plac\w+)/, ":" + Oe + "$1")] })), we(fe(e, { props: [_(a, /:(plac\w+)/, L + "input-$1")] })), we(fe(e, { props: [a] })), Mt(e, { props: cr(r, n) });
1053
+ break;
1054
+ }
1055
+ return "";
1056
+ });
1057
+ }
1058
+ }
1059
+ var So = {
1060
+ animationIterationCount: 1,
1061
+ aspectRatio: 1,
1062
+ borderImageOutset: 1,
1063
+ borderImageSlice: 1,
1064
+ borderImageWidth: 1,
1065
+ boxFlex: 1,
1066
+ boxFlexGroup: 1,
1067
+ boxOrdinalGroup: 1,
1068
+ columnCount: 1,
1069
+ columns: 1,
1070
+ flex: 1,
1071
+ flexGrow: 1,
1072
+ flexPositive: 1,
1073
+ flexShrink: 1,
1074
+ flexNegative: 1,
1075
+ flexOrder: 1,
1076
+ gridRow: 1,
1077
+ gridRowEnd: 1,
1078
+ gridRowSpan: 1,
1079
+ gridRowStart: 1,
1080
+ gridColumn: 1,
1081
+ gridColumnEnd: 1,
1082
+ gridColumnSpan: 1,
1083
+ gridColumnStart: 1,
1084
+ msGridRow: 1,
1085
+ msGridRowSpan: 1,
1086
+ msGridColumn: 1,
1087
+ msGridColumnSpan: 1,
1088
+ fontWeight: 1,
1089
+ lineHeight: 1,
1090
+ opacity: 1,
1091
+ order: 1,
1092
+ orphans: 1,
1093
+ tabSize: 1,
1094
+ widows: 1,
1095
+ zIndex: 1,
1096
+ zoom: 1,
1097
+ WebkitLineClamp: 1,
1098
+ // SVG-related properties
1099
+ fillOpacity: 1,
1100
+ floodOpacity: 1,
1101
+ stopOpacity: 1,
1102
+ strokeDasharray: 1,
1103
+ strokeDashoffset: 1,
1104
+ strokeMiterlimit: 1,
1105
+ strokeOpacity: 1,
1106
+ strokeWidth: 1
1107
+ }, Ce = typeof process < "u" && process.env !== void 0 && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR) || "data-styled", Xr = "active", en = "data-styled-version", dt = "6.1.19", Kt = `/*!sc*/
1108
+ `, tt = typeof window < "u" && typeof document < "u", Co = !!(typeof SC_DISABLE_SPEEDY == "boolean" ? SC_DISABLE_SPEEDY : typeof process < "u" && process.env !== void 0 && process.env.REACT_APP_SC_DISABLE_SPEEDY !== void 0 && process.env.REACT_APP_SC_DISABLE_SPEEDY !== "" ? process.env.REACT_APP_SC_DISABLE_SPEEDY !== "false" && process.env.REACT_APP_SC_DISABLE_SPEEDY : typeof process < "u" && process.env !== void 0 && process.env.SC_DISABLE_SPEEDY !== void 0 && process.env.SC_DISABLE_SPEEDY !== "" && process.env.SC_DISABLE_SPEEDY !== "false" && process.env.SC_DISABLE_SPEEDY), ut = Object.freeze([]), je = Object.freeze({});
1109
+ function jo(e, t, r) {
1110
+ return r === void 0 && (r = je), e.theme !== r.theme && e.theme || t || r.theme;
1111
+ }
1112
+ var tn = /* @__PURE__ */ new Set(["a", "abbr", "address", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "header", "hgroup", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "menu", "menuitem", "meta", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "small", "source", "span", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "u", "ul", "use", "var", "video", "wbr", "circle", "clipPath", "defs", "ellipse", "foreignObject", "g", "image", "line", "linearGradient", "marker", "mask", "path", "pattern", "polygon", "polyline", "radialGradient", "rect", "stop", "svg", "text", "tspan"]), Io = /[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g, Ao = /(^-|-$)/g;
1113
+ function ur(e) {
1114
+ return e.replace(Io, "-").replace(Ao, "");
1115
+ }
1116
+ var To = /(a)(d)/gi, Fe = 52, pr = function(e) {
1117
+ return String.fromCharCode(e + (e > 25 ? 39 : 97));
1118
+ };
1119
+ function zt(e) {
1120
+ var t, r = "";
1121
+ for (t = Math.abs(e); t > Fe; t = t / Fe | 0) r = pr(t % Fe) + r;
1122
+ return (pr(t % Fe) + r).replace(To, "$1-$2");
1123
+ }
1124
+ var yt, rn = 5381, ve = function(e, t) {
1125
+ for (var r = t.length; r; ) e = 33 * e ^ t.charCodeAt(--r);
1126
+ return e;
1127
+ }, nn = function(e) {
1128
+ return ve(rn, e);
1129
+ };
1130
+ function Eo(e) {
1131
+ return zt(nn(e) >>> 0);
1132
+ }
1133
+ function Mo(e) {
1134
+ return e.displayName || e.name || "Component";
1135
+ }
1136
+ function kt(e) {
1137
+ return typeof e == "string" && !0;
1138
+ }
1139
+ var on = typeof Symbol == "function" && Symbol.for, an = on ? Symbol.for("react.memo") : 60115, _o = on ? Symbol.for("react.forward_ref") : 60112, Ro = { childContextTypes: !0, contextType: !0, contextTypes: !0, defaultProps: !0, displayName: !0, getDefaultProps: !0, getDerivedStateFromError: !0, getDerivedStateFromProps: !0, mixins: !0, propTypes: !0, type: !0 }, zo = { name: !0, length: !0, prototype: !0, caller: !0, callee: !0, arguments: !0, arity: !0 }, sn = { $$typeof: !0, compare: !0, defaultProps: !0, displayName: !0, propTypes: !0, type: !0 }, Do = ((yt = {})[_o] = { $$typeof: !0, render: !0, defaultProps: !0, displayName: !0, propTypes: !0 }, yt[an] = sn, yt);
1140
+ function fr(e) {
1141
+ return ("type" in (t = e) && t.type.$$typeof) === an ? sn : "$$typeof" in e ? Do[e.$$typeof] : Ro;
1142
+ var t;
1143
+ }
1144
+ var Oo = Object.defineProperty, No = Object.getOwnPropertyNames, hr = Object.getOwnPropertySymbols, Bo = Object.getOwnPropertyDescriptor, Po = Object.getPrototypeOf, mr = Object.prototype;
1145
+ function cn(e, t, r) {
1146
+ if (typeof t != "string") {
1147
+ if (mr) {
1148
+ var n = Po(t);
1149
+ n && n !== mr && cn(e, n, r);
1150
+ }
1151
+ var a = No(t);
1152
+ hr && (a = a.concat(hr(t)));
1153
+ for (var c = fr(e), u = fr(t), d = 0; d < a.length; ++d) {
1154
+ var h = a[d];
1155
+ if (!(h in zo || r && r[h] || u && h in u || c && h in c)) {
1156
+ var g = Bo(t, h);
1157
+ try {
1158
+ Oo(e, h, g);
1159
+ } catch {
1160
+ }
1161
+ }
1162
+ }
1163
+ }
1164
+ return e;
1165
+ }
1166
+ function Ie(e) {
1167
+ return typeof e == "function";
1168
+ }
1169
+ function Wt(e) {
1170
+ return typeof e == "object" && "styledComponentId" in e;
1171
+ }
1172
+ function me(e, t) {
1173
+ return e && t ? "".concat(e, " ").concat(t) : e || t || "";
1174
+ }
1175
+ function gr(e, t) {
1176
+ if (e.length === 0) return "";
1177
+ for (var r = e[0], n = 1; n < e.length; n++) r += e[n];
1178
+ return r;
1179
+ }
1180
+ function Be(e) {
1181
+ return e !== null && typeof e == "object" && e.constructor.name === Object.name && !("props" in e && e.$$typeof);
1182
+ }
1183
+ function Dt(e, t, r) {
1184
+ if (r === void 0 && (r = !1), !r && !Be(e) && !Array.isArray(e)) return t;
1185
+ if (Array.isArray(t)) for (var n = 0; n < t.length; n++) e[n] = Dt(e[n], t[n]);
1186
+ else if (Be(t)) for (var n in t) e[n] = Dt(e[n], t[n]);
1187
+ return e;
1188
+ }
1189
+ function Ut(e, t) {
1190
+ Object.defineProperty(e, "toString", { value: t });
1191
+ }
1192
+ function Pe(e) {
1193
+ for (var t = [], r = 1; r < arguments.length; r++) t[r - 1] = arguments[r];
1194
+ return new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(e, " for more information.").concat(t.length > 0 ? " Args: ".concat(t.join(", ")) : ""));
1195
+ }
1196
+ var Lo = function() {
1197
+ function e(t) {
1198
+ this.groupSizes = new Uint32Array(512), this.length = 512, this.tag = t;
1199
+ }
1200
+ return e.prototype.indexOfGroup = function(t) {
1201
+ for (var r = 0, n = 0; n < t; n++) r += this.groupSizes[n];
1202
+ return r;
1203
+ }, e.prototype.insertRules = function(t, r) {
1204
+ if (t >= this.groupSizes.length) {
1205
+ for (var n = this.groupSizes, a = n.length, c = a; t >= c; ) if ((c <<= 1) < 0) throw Pe(16, "".concat(t));
1206
+ this.groupSizes = new Uint32Array(c), this.groupSizes.set(n), this.length = c;
1207
+ for (var u = a; u < c; u++) this.groupSizes[u] = 0;
1208
+ }
1209
+ for (var d = this.indexOfGroup(t + 1), h = (u = 0, r.length); u < h; u++) this.tag.insertRule(d, r[u]) && (this.groupSizes[t]++, d++);
1210
+ }, e.prototype.clearGroup = function(t) {
1211
+ if (t < this.length) {
1212
+ var r = this.groupSizes[t], n = this.indexOfGroup(t), a = n + r;
1213
+ this.groupSizes[t] = 0;
1214
+ for (var c = n; c < a; c++) this.tag.deleteRule(n);
1215
+ }
1216
+ }, e.prototype.getGroup = function(t) {
1217
+ var r = "";
1218
+ if (t >= this.length || this.groupSizes[t] === 0) return r;
1219
+ for (var n = this.groupSizes[t], a = this.indexOfGroup(t), c = a + n, u = a; u < c; u++) r += "".concat(this.tag.getRule(u)).concat(Kt);
1220
+ return r;
1221
+ }, e;
1222
+ }(), Ye = /* @__PURE__ */ new Map(), rt = /* @__PURE__ */ new Map(), Qe = 1, Ke = function(e) {
1223
+ if (Ye.has(e)) return Ye.get(e);
1224
+ for (; rt.has(Qe); ) Qe++;
1225
+ var t = Qe++;
1226
+ return Ye.set(e, t), rt.set(t, e), t;
1227
+ }, Fo = function(e, t) {
1228
+ Qe = t + 1, Ye.set(e, t), rt.set(t, e);
1229
+ }, Ko = "style[".concat(Ce, "][").concat(en, '="').concat(dt, '"]'), Wo = new RegExp("^".concat(Ce, '\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')), Uo = function(e, t, r) {
1230
+ for (var n, a = r.split(","), c = 0, u = a.length; c < u; c++) (n = a[c]) && e.registerName(t, n);
1231
+ }, Ho = function(e, t) {
1232
+ for (var r, n = ((r = t.textContent) !== null && r !== void 0 ? r : "").split(Kt), a = [], c = 0, u = n.length; c < u; c++) {
1233
+ var d = n[c].trim();
1234
+ if (d) {
1235
+ var h = d.match(Wo);
1236
+ if (h) {
1237
+ var g = 0 | parseInt(h[1], 10), b = h[2];
1238
+ g !== 0 && (Fo(b, g), Uo(e, b, h[3]), e.getTag().insertRules(g, a)), a.length = 0;
1239
+ } else a.push(d);
1240
+ }
1241
+ }
1242
+ }, br = function(e) {
1243
+ for (var t = document.querySelectorAll(Ko), r = 0, n = t.length; r < n; r++) {
1244
+ var a = t[r];
1245
+ a && a.getAttribute(Ce) !== Xr && (Ho(e, a), a.parentNode && a.parentNode.removeChild(a));
1246
+ }
1247
+ };
1248
+ function qo() {
1249
+ return typeof __webpack_nonce__ < "u" ? __webpack_nonce__ : null;
1250
+ }
1251
+ var ln = function(e) {
1252
+ var t = document.head, r = e || t, n = document.createElement("style"), a = function(d) {
1253
+ var h = Array.from(d.querySelectorAll("style[".concat(Ce, "]")));
1254
+ return h[h.length - 1];
1255
+ }(r), c = a !== void 0 ? a.nextSibling : null;
1256
+ n.setAttribute(Ce, Xr), n.setAttribute(en, dt);
1257
+ var u = qo();
1258
+ return u && n.setAttribute("nonce", u), r.insertBefore(n, c), n;
1259
+ }, Go = function() {
1260
+ function e(t) {
1261
+ this.element = ln(t), this.element.appendChild(document.createTextNode("")), this.sheet = function(r) {
1262
+ if (r.sheet) return r.sheet;
1263
+ for (var n = document.styleSheets, a = 0, c = n.length; a < c; a++) {
1264
+ var u = n[a];
1265
+ if (u.ownerNode === r) return u;
1266
+ }
1267
+ throw Pe(17);
1268
+ }(this.element), this.length = 0;
1269
+ }
1270
+ return e.prototype.insertRule = function(t, r) {
1271
+ try {
1272
+ return this.sheet.insertRule(r, t), this.length++, !0;
1273
+ } catch {
1274
+ return !1;
1275
+ }
1276
+ }, e.prototype.deleteRule = function(t) {
1277
+ this.sheet.deleteRule(t), this.length--;
1278
+ }, e.prototype.getRule = function(t) {
1279
+ var r = this.sheet.cssRules[t];
1280
+ return r && r.cssText ? r.cssText : "";
1281
+ }, e;
1282
+ }(), Yo = function() {
1283
+ function e(t) {
1284
+ this.element = ln(t), this.nodes = this.element.childNodes, this.length = 0;
1285
+ }
1286
+ return e.prototype.insertRule = function(t, r) {
1287
+ if (t <= this.length && t >= 0) {
1288
+ var n = document.createTextNode(r);
1289
+ return this.element.insertBefore(n, this.nodes[t] || null), this.length++, !0;
1290
+ }
1291
+ return !1;
1292
+ }, e.prototype.deleteRule = function(t) {
1293
+ this.element.removeChild(this.nodes[t]), this.length--;
1294
+ }, e.prototype.getRule = function(t) {
1295
+ return t < this.length ? this.nodes[t].textContent : "";
1296
+ }, e;
1297
+ }(), Qo = function() {
1298
+ function e(t) {
1299
+ this.rules = [], this.length = 0;
1300
+ }
1301
+ return e.prototype.insertRule = function(t, r) {
1302
+ return t <= this.length && (this.rules.splice(t, 0, r), this.length++, !0);
1303
+ }, e.prototype.deleteRule = function(t) {
1304
+ this.rules.splice(t, 1), this.length--;
1305
+ }, e.prototype.getRule = function(t) {
1306
+ return t < this.length ? this.rules[t] : "";
1307
+ }, e;
1308
+ }(), xr = tt, Vo = { isServer: !tt, useCSSOMInjection: !Co }, dn = function() {
1309
+ function e(t, r, n) {
1310
+ t === void 0 && (t = je), r === void 0 && (r = {});
1311
+ var a = this;
1312
+ this.options = X(X({}, Vo), t), this.gs = r, this.names = new Map(n), this.server = !!t.isServer, !this.server && tt && xr && (xr = !1, br(this)), Ut(this, function() {
1313
+ return function(c) {
1314
+ for (var u = c.getTag(), d = u.length, h = "", g = function(p) {
1315
+ var w = function(o) {
1316
+ return rt.get(o);
1317
+ }(p);
1318
+ if (w === void 0) return "continue";
1319
+ var k = c.names.get(w), $ = u.getGroup(p);
1320
+ if (k === void 0 || !k.size || $.length === 0) return "continue";
1321
+ var j = "".concat(Ce, ".g").concat(p, '[id="').concat(w, '"]'), S = "";
1322
+ k !== void 0 && k.forEach(function(o) {
1323
+ o.length > 0 && (S += "".concat(o, ","));
1324
+ }), h += "".concat($).concat(j, '{content:"').concat(S, '"}').concat(Kt);
1325
+ }, b = 0; b < d; b++) g(b);
1326
+ return h;
1327
+ }(a);
1328
+ });
1329
+ }
1330
+ return e.registerId = function(t) {
1331
+ return Ke(t);
1332
+ }, e.prototype.rehydrate = function() {
1333
+ !this.server && tt && br(this);
1334
+ }, e.prototype.reconstructWithOptions = function(t, r) {
1335
+ return r === void 0 && (r = !0), new e(X(X({}, this.options), t), this.gs, r && this.names || void 0);
1336
+ }, e.prototype.allocateGSInstance = function(t) {
1337
+ return this.gs[t] = (this.gs[t] || 0) + 1;
1338
+ }, e.prototype.getTag = function() {
1339
+ return this.tag || (this.tag = (t = function(r) {
1340
+ var n = r.useCSSOMInjection, a = r.target;
1341
+ return r.isServer ? new Qo(a) : n ? new Go(a) : new Yo(a);
1342
+ }(this.options), new Lo(t)));
1343
+ var t;
1344
+ }, e.prototype.hasNameForId = function(t, r) {
1345
+ return this.names.has(t) && this.names.get(t).has(r);
1346
+ }, e.prototype.registerName = function(t, r) {
1347
+ if (Ke(t), this.names.has(t)) this.names.get(t).add(r);
1348
+ else {
1349
+ var n = /* @__PURE__ */ new Set();
1350
+ n.add(r), this.names.set(t, n);
1351
+ }
1352
+ }, e.prototype.insertRules = function(t, r, n) {
1353
+ this.registerName(t, r), this.getTag().insertRules(Ke(t), n);
1354
+ }, e.prototype.clearNames = function(t) {
1355
+ this.names.has(t) && this.names.get(t).clear();
1356
+ }, e.prototype.clearRules = function(t) {
1357
+ this.getTag().clearGroup(Ke(t)), this.clearNames(t);
1358
+ }, e.prototype.clearTag = function() {
1359
+ this.tag = void 0;
1360
+ }, e;
1361
+ }(), Zo = /&/g, Jo = /^\s*\/\/.*$/gm;
1362
+ function un(e, t) {
1363
+ return e.map(function(r) {
1364
+ return r.type === "rule" && (r.value = "".concat(t, " ").concat(r.value), r.value = r.value.replaceAll(",", ",".concat(t, " ")), r.props = r.props.map(function(n) {
1365
+ return "".concat(t, " ").concat(n);
1366
+ })), Array.isArray(r.children) && r.type !== "@keyframes" && (r.children = un(r.children, t)), r;
1367
+ });
1368
+ }
1369
+ function Xo(e) {
1370
+ var t, r, n, a = je, c = a.options, u = c === void 0 ? je : c, d = a.plugins, h = d === void 0 ? ut : d, g = function(w, k, $) {
1371
+ return $.startsWith(r) && $.endsWith(r) && $.replaceAll(r, "").length > 0 ? ".".concat(t) : w;
1372
+ }, b = h.slice();
1373
+ b.push(function(w) {
1374
+ w.type === st && w.value.includes("&") && (w.props[0] = w.props[0].replace(Zo, r).replace(n, g));
1375
+ }), u.prefix && b.push($o), b.push(ko);
1376
+ var p = function(w, k, $, j) {
1377
+ k === void 0 && (k = ""), $ === void 0 && ($ = ""), j === void 0 && (j = "&"), t = j, r = k, n = new RegExp("\\".concat(r, "\\b"), "g");
1378
+ var S = w.replace(Jo, ""), o = xo($ || k ? "".concat($, " ").concat(k, " { ").concat(S, " }") : S);
1379
+ u.namespace && (o = un(o, u.namespace));
1380
+ var i = [];
1381
+ return et(o, wo(b.concat(vo(function(s) {
1382
+ return i.push(s);
1383
+ })))), i;
1384
+ };
1385
+ return p.hash = h.length ? h.reduce(function(w, k) {
1386
+ return k.name || Pe(15), ve(w, k.name);
1387
+ }, rn).toString() : "", p;
1388
+ }
1389
+ var ea = new dn(), Ot = Xo(), pn = F.createContext({ shouldForwardProp: void 0, styleSheet: ea, stylis: Ot });
1390
+ pn.Consumer;
1391
+ F.createContext(void 0);
1392
+ function yr() {
1393
+ return Kr(pn);
1394
+ }
1395
+ var ta = function() {
1396
+ function e(t, r) {
1397
+ var n = this;
1398
+ this.inject = function(a, c) {
1399
+ c === void 0 && (c = Ot);
1400
+ var u = n.name + c.hash;
1401
+ a.hasNameForId(n.id, u) || a.insertRules(n.id, u, c(n.rules, u, "@keyframes"));
1402
+ }, this.name = t, this.id = "sc-keyframes-".concat(t), this.rules = r, Ut(this, function() {
1403
+ throw Pe(12, String(n.name));
1404
+ });
1405
+ }
1406
+ return e.prototype.getName = function(t) {
1407
+ return t === void 0 && (t = Ot), this.name + t.hash;
1408
+ }, e;
1409
+ }(), ra = function(e) {
1410
+ return e >= "A" && e <= "Z";
1411
+ };
1412
+ function kr(e) {
1413
+ for (var t = "", r = 0; r < e.length; r++) {
1414
+ var n = e[r];
1415
+ if (r === 1 && n === "-" && e[0] === "-") return e;
1416
+ ra(n) ? t += "-" + n.toLowerCase() : t += n;
1417
+ }
1418
+ return t.startsWith("ms-") ? "-" + t : t;
1419
+ }
1420
+ var fn = function(e) {
1421
+ return e == null || e === !1 || e === "";
1422
+ }, hn = function(e) {
1423
+ var t, r, n = [];
1424
+ for (var a in e) {
1425
+ var c = e[a];
1426
+ e.hasOwnProperty(a) && !fn(c) && (Array.isArray(c) && c.isCss || Ie(c) ? n.push("".concat(kr(a), ":"), c, ";") : Be(c) ? n.push.apply(n, Xe(Xe(["".concat(a, " {")], hn(c), !1), ["}"], !1)) : n.push("".concat(kr(a), ": ").concat((t = a, (r = c) == null || typeof r == "boolean" || r === "" ? "" : typeof r != "number" || r === 0 || t in So || t.startsWith("--") ? String(r).trim() : "".concat(r, "px")), ";")));
1427
+ }
1428
+ return n;
1429
+ };
1430
+ function be(e, t, r, n) {
1431
+ if (fn(e)) return [];
1432
+ if (Wt(e)) return [".".concat(e.styledComponentId)];
1433
+ if (Ie(e)) {
1434
+ if (!Ie(c = e) || c.prototype && c.prototype.isReactComponent || !t) return [e];
1435
+ var a = e(t);
1436
+ return be(a, t, r, n);
1437
+ }
1438
+ var c;
1439
+ return e instanceof ta ? r ? (e.inject(r, n), [e.getName(n)]) : [e] : Be(e) ? hn(e) : Array.isArray(e) ? Array.prototype.concat.apply(ut, e.map(function(u) {
1440
+ return be(u, t, r, n);
1441
+ })) : [e.toString()];
1442
+ }
1443
+ function na(e) {
1444
+ for (var t = 0; t < e.length; t += 1) {
1445
+ var r = e[t];
1446
+ if (Ie(r) && !Wt(r)) return !1;
1447
+ }
1448
+ return !0;
1449
+ }
1450
+ var oa = nn(dt), aa = function() {
1451
+ function e(t, r, n) {
1452
+ this.rules = t, this.staticRulesId = "", this.isStatic = (n === void 0 || n.isStatic) && na(t), this.componentId = r, this.baseHash = ve(oa, r), this.baseStyle = n, dn.registerId(r);
1453
+ }
1454
+ return e.prototype.generateAndInjectStyles = function(t, r, n) {
1455
+ var a = this.baseStyle ? this.baseStyle.generateAndInjectStyles(t, r, n) : "";
1456
+ if (this.isStatic && !n.hash) if (this.staticRulesId && r.hasNameForId(this.componentId, this.staticRulesId)) a = me(a, this.staticRulesId);
1457
+ else {
1458
+ var c = gr(be(this.rules, t, r, n)), u = zt(ve(this.baseHash, c) >>> 0);
1459
+ if (!r.hasNameForId(this.componentId, u)) {
1460
+ var d = n(c, ".".concat(u), void 0, this.componentId);
1461
+ r.insertRules(this.componentId, u, d);
1462
+ }
1463
+ a = me(a, u), this.staticRulesId = u;
1464
+ }
1465
+ else {
1466
+ for (var h = ve(this.baseHash, n.hash), g = "", b = 0; b < this.rules.length; b++) {
1467
+ var p = this.rules[b];
1468
+ if (typeof p == "string") g += p;
1469
+ else if (p) {
1470
+ var w = gr(be(p, t, r, n));
1471
+ h = ve(h, w + b), g += w;
1472
+ }
1473
+ }
1474
+ if (g) {
1475
+ var k = zt(h >>> 0);
1476
+ r.hasNameForId(this.componentId, k) || r.insertRules(this.componentId, k, n(g, ".".concat(k), void 0, this.componentId)), a = me(a, k);
1477
+ }
1478
+ }
1479
+ return a;
1480
+ }, e;
1481
+ }(), mn = F.createContext(void 0);
1482
+ mn.Consumer;
1483
+ var wt = {};
1484
+ function sa(e, t, r) {
1485
+ var n = Wt(e), a = e, c = !kt(e), u = t.attrs, d = u === void 0 ? ut : u, h = t.componentId, g = h === void 0 ? function(f, m) {
1486
+ var y = typeof f != "string" ? "sc" : ur(f);
1487
+ wt[y] = (wt[y] || 0) + 1;
1488
+ var x = "".concat(y, "-").concat(Eo(dt + y + wt[y]));
1489
+ return m ? "".concat(m, "-").concat(x) : x;
1490
+ }(t.displayName, t.parentComponentId) : h, b = t.displayName, p = b === void 0 ? function(f) {
1491
+ return kt(f) ? "styled.".concat(f) : "Styled(".concat(Mo(f), ")");
1492
+ }(e) : b, w = t.displayName && t.componentId ? "".concat(ur(t.displayName), "-").concat(t.componentId) : t.componentId || g, k = n && a.attrs ? a.attrs.concat(d).filter(Boolean) : d, $ = t.shouldForwardProp;
1493
+ if (n && a.shouldForwardProp) {
1494
+ var j = a.shouldForwardProp;
1495
+ if (t.shouldForwardProp) {
1496
+ var S = t.shouldForwardProp;
1497
+ $ = function(f, m) {
1498
+ return j(f, m) && S(f, m);
1499
+ };
1500
+ } else $ = j;
1501
+ }
1502
+ var o = new aa(r, w, n ? a.componentStyle : void 0);
1503
+ function i(f, m) {
1504
+ return function(y, x, A) {
1505
+ var M = y.attrs, C = y.componentStyle, E = y.defaultProps, K = y.foldedComponentIds, P = y.styledComponentId, I = y.target, D = F.useContext(mn), H = yr(), v = y.shouldForwardProp || H.shouldForwardProp, O = jo(x, D, E) || je, R = function(Q, V, ie) {
1506
+ for (var ye, ce = X(X({}, V), { className: void 0, theme: ie }), ke = 0; ke < Q.length; ke += 1) {
1507
+ var ne = Ie(ye = Q[ke]) ? ye(ce) : ye;
1508
+ for (var ee in ne) ce[ee] = ee === "className" ? me(ce[ee], ne[ee]) : ee === "style" ? X(X({}, ce[ee]), ne[ee]) : ne[ee];
1509
+ }
1510
+ return V.className && (ce.className = me(ce.className, V.className)), ce;
1511
+ }(M, x, O), W = R.as || I, N = {};
1512
+ for (var q in R) R[q] === void 0 || q[0] === "$" || q === "as" || q === "theme" && R.theme === O || (q === "forwardedAs" ? N.as = R.forwardedAs : v && !v(q, W) || (N[q] = R[q]));
1513
+ var z = function(Q, V) {
1514
+ var ie = yr(), ye = Q.generateAndInjectStyles(V, ie.styleSheet, ie.stylis);
1515
+ return ye;
1516
+ }(C, R), U = me(K, P);
1517
+ return z && (U += " " + z), R.className && (U += " " + R.className), N[kt(W) && !tn.has(W) ? "class" : "className"] = U, A && (N.ref = A), Je(W, N);
1518
+ }(s, f, m);
1519
+ }
1520
+ i.displayName = p;
1521
+ var s = F.forwardRef(i);
1522
+ return s.attrs = k, s.componentStyle = o, s.displayName = p, s.shouldForwardProp = $, s.foldedComponentIds = n ? me(a.foldedComponentIds, a.styledComponentId) : "", s.styledComponentId = w, s.target = n ? a.target : e, Object.defineProperty(s, "defaultProps", { get: function() {
1523
+ return this._foldedDefaultProps;
1524
+ }, set: function(f) {
1525
+ this._foldedDefaultProps = n ? function(m) {
1526
+ for (var y = [], x = 1; x < arguments.length; x++) y[x - 1] = arguments[x];
1527
+ for (var A = 0, M = y; A < M.length; A++) Dt(m, M[A], !0);
1528
+ return m;
1529
+ }({}, a.defaultProps, f) : f;
1530
+ } }), Ut(s, function() {
1531
+ return ".".concat(s.styledComponentId);
1532
+ }), c && cn(s, e, { attrs: !0, componentStyle: !0, displayName: !0, foldedComponentIds: !0, shouldForwardProp: !0, styledComponentId: !0, target: !0 }), s;
1533
+ }
1534
+ function wr(e, t) {
1535
+ for (var r = [e[0]], n = 0, a = t.length; n < a; n += 1) r.push(t[n], e[n + 1]);
1536
+ return r;
1537
+ }
1538
+ var vr = function(e) {
1539
+ return Object.assign(e, { isCss: !0 });
1540
+ };
1541
+ function ia(e) {
1542
+ for (var t = [], r = 1; r < arguments.length; r++) t[r - 1] = arguments[r];
1543
+ if (Ie(e) || Be(e)) return vr(be(wr(ut, Xe([e], t, !0))));
1544
+ var n = e;
1545
+ return t.length === 0 && n.length === 1 && typeof n[0] == "string" ? be(n) : vr(be(wr(n, t)));
1546
+ }
1547
+ function Nt(e, t, r) {
1548
+ if (r === void 0 && (r = je), !t) throw Pe(1, t);
1549
+ var n = function(a) {
1550
+ for (var c = [], u = 1; u < arguments.length; u++) c[u - 1] = arguments[u];
1551
+ return e(t, r, ia.apply(void 0, Xe([a], c, !1)));
1552
+ };
1553
+ return n.attrs = function(a) {
1554
+ return Nt(e, t, X(X({}, r), { attrs: Array.prototype.concat(r.attrs, a).filter(Boolean) }));
1555
+ }, n.withConfig = function(a) {
1556
+ return Nt(e, t, X(X({}, r), a));
1557
+ }, n;
1558
+ }
1559
+ var gn = function(e) {
1560
+ return Nt(sa, e);
1561
+ }, T = gn;
1562
+ tn.forEach(function(e) {
1563
+ T[e] = gn(e);
1564
+ });
1565
+ const ca = T.div`
1566
+ display: flex;
1567
+ flex-wrap: wrap;
1568
+ gap: 6px;
1569
+ margin-bottom: 6px;
1570
+ `, la = T.div`
1571
+ display: inline-flex;
1572
+ align-items: center;
1573
+ gap: 6px;
1574
+ max-width: 220px;
1575
+ padding: 4px 8px;
1576
+ border-radius: 8px;
1577
+ font-size: 12px;
1578
+ background: ${(e) => e.$isImage ? "rgba(59, 130, 246, 0.12)" : "rgba(107, 114, 128, 0.12)"};
1579
+ color: #374151;
1580
+ border: 1px solid #e5e7eb;
1581
+
1582
+ [data-theme='dark'] & {
1583
+ color: #e5e7eb;
1584
+ border-color: #4b5563;
1585
+ background: ${(e) => e.$isImage ? "rgba(59, 130, 246, 0.2)" : "rgba(107, 114, 128, 0.25)"};
1586
+ }
1587
+ `, da = T.img`
1588
+ width: 28px;
1589
+ height: 28px;
1590
+ object-fit: cover;
1591
+ border-radius: 4px;
1592
+ `, ua = T.span`
1593
+ overflow: hidden;
1594
+ text-overflow: ellipsis;
1595
+ white-space: nowrap;
1596
+ flex: 1;
1597
+ min-width: 0;
1598
+ `, pa = T.button`
1599
+ display: flex;
1600
+ align-items: center;
1601
+ justify-content: center;
1602
+ padding: 2px;
1603
+ border: none;
1604
+ background: transparent;
1605
+ cursor: pointer;
1606
+ color: #6b7280;
1607
+ border-radius: 4px;
1608
+
1609
+ &:hover {
1610
+ color: #ef4444;
1611
+ background: rgba(239, 68, 68, 0.1);
1612
+ }
1613
+ `;
1614
+ function Ae({ attachments: e, onRemove: t, readOnly: r }) {
1615
+ return e.length ? /* @__PURE__ */ l.jsx(ca, { children: e.map((n) => {
1616
+ const a = n.type === "image", c = a && (n.preview || n.url);
1617
+ return /* @__PURE__ */ l.jsxs(la, { $isImage: a, title: n.name, children: [
1618
+ c ? /* @__PURE__ */ l.jsx(da, { src: n.preview || n.url, alt: "", loading: "lazy", decoding: "async" }) : a ? /* @__PURE__ */ l.jsx(eo, { size: 16, "aria-hidden": !0 }) : /* @__PURE__ */ l.jsx(Jn, { size: 16, "aria-hidden": !0 }),
1619
+ /* @__PURE__ */ l.jsx(ua, { children: n.name }),
1620
+ !r && t && /* @__PURE__ */ l.jsx(pa, { type: "button", onClick: () => t(n.id), "aria-label": `Remove ${n.name}`, children: /* @__PURE__ */ l.jsx(oo, { size: 14 }) })
1621
+ ] }, n.id);
1622
+ }) }) : null;
1623
+ }
1624
+ const bn = [
1625
+ "application/pdf",
1626
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
1627
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
1628
+ "application/vnd.ms-excel",
1629
+ "text/csv",
1630
+ "text/plain",
1631
+ "text/markdown",
1632
+ "application/json",
1633
+ "image/png",
1634
+ "image/jpeg",
1635
+ "image/webp",
1636
+ "image/gif"
1637
+ ], fa = {
1638
+ ".pdf": "application/pdf",
1639
+ ".docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
1640
+ ".xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
1641
+ ".xls": "application/vnd.ms-excel",
1642
+ ".csv": "text/csv",
1643
+ ".txt": "text/plain",
1644
+ ".md": "text/markdown",
1645
+ ".json": "application/json",
1646
+ ".png": "image/png",
1647
+ ".jpg": "image/jpeg",
1648
+ ".jpeg": "image/jpeg",
1649
+ ".webp": "image/webp",
1650
+ ".gif": "image/gif"
1651
+ };
1652
+ function ha(e) {
1653
+ const t = e.lastIndexOf(".");
1654
+ if (!(t < 0))
1655
+ return fa[e.slice(t).toLowerCase()];
1656
+ }
1657
+ async function Ht(e) {
1658
+ var r;
1659
+ if (!e) return [];
1660
+ const t = [];
1661
+ if ((r = e.files) != null && r.length)
1662
+ for (let n = 0; n < e.files.length; n++)
1663
+ t.push(e.files[n]);
1664
+ return t;
1665
+ }
1666
+ function xn(e, t, r) {
1667
+ if (e.size > t)
1668
+ return `File too large (max ${Math.floor(t / (1024 * 1024))}MB)`;
1669
+ if (r.includes(e.type)) return null;
1670
+ const n = ha(e.name);
1671
+ return n && r.includes(n) ? null : "File type not allowed for attachments";
1672
+ }
1673
+ const ma = T.button`
1674
+ display: flex;
1675
+ align-items: center;
1676
+ justify-content: center;
1677
+ width: 36px;
1678
+ height: 36px;
1679
+ min-width: 36px;
1680
+ min-height: 36px;
1681
+ border-radius: 8px;
1682
+ border: 1px solid #d1d5db;
1683
+ background: #f9fafb;
1684
+ color: #374151;
1685
+ cursor: pointer;
1686
+ flex-shrink: 0;
1687
+ transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
1688
+
1689
+ &:hover:not(:disabled) {
1690
+ background: #f3f4f6;
1691
+ border-color: #9ca3af;
1692
+ }
1693
+
1694
+ &:disabled {
1695
+ opacity: 0.45;
1696
+ cursor: not-allowed;
1697
+ }
1698
+
1699
+ [data-theme='dark'] & {
1700
+ background: #374151;
1701
+ border-color: #4b5563;
1702
+ color: #e5e7eb;
1703
+ }
1704
+ `, ga = T.button`
1705
+ display: flex;
1706
+ align-items: center;
1707
+ justify-content: center;
1708
+ width: 28px;
1709
+ height: 28px;
1710
+ min-width: 28px;
1711
+ min-height: 28px;
1712
+ border: none;
1713
+ border-radius: 8px;
1714
+ background: transparent;
1715
+ color: #64748b;
1716
+ cursor: pointer;
1717
+ flex-shrink: 0;
1718
+ transition: background 0.2s ease, color 0.2s ease;
1719
+
1720
+ &:hover:not(:disabled) {
1721
+ background: rgba(15, 23, 42, 0.06);
1722
+ color: #334155;
1723
+ }
1724
+
1725
+ &:disabled {
1726
+ opacity: 0.45;
1727
+ cursor: not-allowed;
1728
+ }
1729
+
1730
+ @media (prefers-color-scheme: dark) {
1731
+ color: #94a3b8;
1732
+
1733
+ &:hover:not(:disabled) {
1734
+ background: rgba(255, 255, 255, 0.08);
1735
+ color: #e2e8f0;
1736
+ }
1737
+ }
1738
+
1739
+ [data-theme='dark'] & {
1740
+ color: #94a3b8;
1741
+
1742
+ &:hover:not(:disabled) {
1743
+ background: rgba(255, 255, 255, 0.08);
1744
+ color: #e2e8f0;
1745
+ }
1746
+ }
1747
+ `;
1748
+ function qt({
1749
+ disabled: e,
1750
+ integrated: t = !1,
1751
+ maxFileBytes: r,
1752
+ maxFiles: n,
1753
+ allowedMime: a = bn,
1754
+ currentCount: c,
1755
+ uploadAttachment: u,
1756
+ onUploaded: d,
1757
+ onError: h
1758
+ }) {
1759
+ const g = F.useRef(null), [b, p] = F.useState(!1), w = F.useMemo(
1760
+ () => [
1761
+ ".pdf,.docx,.xlsx,.xls,.csv,.txt,.md,.json",
1762
+ "image/png,image/jpeg,image/webp,image/gif"
1763
+ ].join(","),
1764
+ []
1765
+ ), k = F.useCallback(
1766
+ async (i) => {
1767
+ const s = Array.from(i);
1768
+ if (!s.length) return;
1769
+ let f = 0;
1770
+ for (const m of s) {
1771
+ if (c + f >= n) {
1772
+ h == null || h(`You can attach at most ${n} files per message.`);
1773
+ break;
1774
+ }
1775
+ const y = xn(m, r, a);
1776
+ if (y) {
1777
+ h == null || h(`${m.name}: ${y}`);
1778
+ continue;
1779
+ }
1780
+ try {
1781
+ p(!0);
1782
+ const x = await u(m);
1783
+ d(x), f += 1;
1784
+ } catch (x) {
1785
+ const A = x instanceof Error ? x.message : "Upload failed";
1786
+ h == null || h(A);
1787
+ } finally {
1788
+ p(!1);
1789
+ }
1790
+ }
1791
+ },
1792
+ [a, c, r, n, h, d, u]
1793
+ ), $ = (i) => {
1794
+ const s = i.target.files;
1795
+ s != null && s.length && k(s), i.target.value = "";
1796
+ }, j = c >= n, S = !!(e || b || j), o = t ? ga : ma;
1797
+ return /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
1798
+ /* @__PURE__ */ l.jsx(
1799
+ "input",
1800
+ {
1801
+ ref: g,
1802
+ type: "file",
1803
+ multiple: !0,
1804
+ accept: w,
1805
+ style: { display: "none" },
1806
+ onChange: $
1807
+ }
1808
+ ),
1809
+ /* @__PURE__ */ l.jsx(
1810
+ o,
1811
+ {
1812
+ type: "button",
1813
+ disabled: S,
1814
+ "aria-label": "Attach file",
1815
+ title: "Attach file",
1816
+ onClick: () => {
1817
+ var i;
1818
+ return (i = g.current) == null ? void 0 : i.click();
1819
+ },
1820
+ children: /* @__PURE__ */ l.jsx(ro, { size: 16, strokeWidth: 2 })
1821
+ }
1822
+ )
1823
+ ] });
1824
+ }
1825
+ function he() {
1826
+ return he = Object.assign ? Object.assign.bind() : function(e) {
1827
+ for (var t = 1; t < arguments.length; t++) {
1828
+ var r = arguments[t];
1829
+ for (var n in r) Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n]);
1830
+ }
1831
+ return e;
1832
+ }, he.apply(this, arguments);
1833
+ }
1834
+ const ba = ["children", "options"], $r = ["allowFullScreen", "allowTransparency", "autoComplete", "autoFocus", "autoPlay", "cellPadding", "cellSpacing", "charSet", "classId", "colSpan", "contentEditable", "contextMenu", "crossOrigin", "encType", "formAction", "formEncType", "formMethod", "formNoValidate", "formTarget", "frameBorder", "hrefLang", "inputMode", "keyParams", "keyType", "marginHeight", "marginWidth", "maxLength", "mediaGroup", "minLength", "noValidate", "radioGroup", "readOnly", "rowSpan", "spellCheck", "srcDoc", "srcLang", "srcSet", "tabIndex", "useMap"].reduce((e, t) => (e[t.toLowerCase()] = t, e), { class: "className", for: "htmlFor" }), Sr = { amp: "&", apos: "'", gt: ">", lt: "<", nbsp: " ", quot: "“" }, xa = ["style", "script", "pre"], ya = ["src", "href", "data", "formAction", "srcDoc", "action"], ka = /([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi, wa = /mailto:/i, va = /\n{2,}$/, Cr = /^(\s*>[\s\S]*?)(?=\n\n|$)/, $a = /^ *> ?/gm, Sa = /^(?:\[!([^\]]*)\]\n)?([\s\S]*)/, Ca = /^ {2,}\n/, ja = /^(?:( *[-*_])){3,} *(?:\n *)+\n/, jr = /^(?: {1,3})?(`{3,}|~{3,}) *(\S+)? *([^\n]*?)?\n([\s\S]*?)(?:\1\n?|$)/, Ir = /^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/, Ia = /^(`+)((?:\\`|(?!\1)`|[^`])+)\1/, Aa = /^(?:\n *)*\n/, Ta = /\r\n?/g, Ea = /^\[\^([^\]]+)](:(.*)((\n+ {4,}.*)|(\n(?!\[\^).+))*)/, Ma = /^\[\^([^\]]+)]/, _a = /\f/g, Ra = /^---[ \t]*\n(.|\n)*\n---[ \t]*\n/, za = /^\s*?\[(x|\s)\]/, Ar = /^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/, Tr = /^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/, Er = /^([^\n]+)\n *(=|-){3,} *\n/, vt = /^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?((?:[^>]*[^/])?)>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1\b)[\s\S])*?)<\/\1>(?!<\/\1>)\n*/i, Da = /&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi, Mr = /^<!--[\s\S]*?(?:-->)/, Oa = /^(data|aria|x)-[a-z_][a-z\d_.-]*$/, $t = /^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i, Na = /^\{.*\}$/, Ba = /^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/, Pa = /^<([^ >]+@[^ >]+)>/, La = /^<([^ >]+:\/[^ >]+)>/, Fa = /-([a-z])?/gi, _r = /^(\|.*)\n(?: *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*))?\n?/, Ka = /^[^\n]+(?: \n|\n{2,})/, Wa = /^\[([^\]]*)\]:\s+<?([^\s>]+)>?\s*("([^"]*)")?/, Ua = /^!\[([^\]]*)\] ?\[([^\]]*)\]/, Ha = /^\[([^\]]*)\] ?\[([^\]]*)\]/, qa = /(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/, Ga = /\t/g, Ya = /(^ *\||\| *$)/g, Qa = /^ *:-+: *$/, Va = /^ *:-+ *$/, Za = /^ *-+: *$/, pt = (e) => `(?=[\\s\\S]+?\\1${e ? "\\1" : ""})`, ft = "((?:\\[.*?\\][([].*?[)\\]]|<.*?>(?:.*?<.*?>)?|`.*?`|\\\\\\1|[\\s\\S])+?)", Ja = RegExp(`^([*_])\\1${pt(1)}${ft}\\1\\1(?!\\1)`), Xa = RegExp(`^([*_])${pt(0)}${ft}\\1(?!\\1)`), es = RegExp(`^(==)${pt(0)}${ft}\\1`), ts = RegExp(`^(~~)${pt(0)}${ft}\\1`), rs = /^(:[a-zA-Z0-9-_]+:)/, ns = /^\\([^0-9A-Za-z\s])/, os = /\\([^0-9A-Za-z\s])/g, as = /^[\s\S](?:(?! \n|[0-9]\.|http)[^=*_~\-\n:<`\\\[!])*/, ss = /^\n+/, is = /^([ \t]*)/, cs = /(?:^|\n)( *)$/, Gt = "(?:\\d+\\.)", Yt = "(?:[*+-])";
1835
+ function yn(e) {
1836
+ return "( *)(" + (e === 1 ? Gt : Yt) + ") +";
1837
+ }
1838
+ const kn = yn(1), wn = yn(2);
1839
+ function vn(e) {
1840
+ return RegExp("^" + (e === 1 ? kn : wn));
1841
+ }
1842
+ const ls = vn(1), ds = vn(2);
1843
+ function $n(e) {
1844
+ return RegExp("^" + (e === 1 ? kn : wn) + "[^\\n]*(?:\\n(?!\\1" + (e === 1 ? Gt : Yt) + " )[^\\n]*)*(\\n|$)", "gm");
1845
+ }
1846
+ const us = $n(1), ps = $n(2);
1847
+ function Sn(e) {
1848
+ const t = e === 1 ? Gt : Yt;
1849
+ return RegExp("^( *)(" + t + ") [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1" + t + " (?!" + t + " ))\\n*|\\s*\\n*$)");
1850
+ }
1851
+ const Cn = Sn(1), jn = Sn(2);
1852
+ function Rr(e, t) {
1853
+ const r = t === 1, n = r ? Cn : jn, a = r ? us : ps, c = r ? ls : ds;
1854
+ return { t: (u) => c.test(u), o: Te(function(u, d) {
1855
+ const h = cs.exec(d.prevCapture);
1856
+ return h && (d.list || !d.inline && !d.simple) ? n.exec(u = h[1] + u) : null;
1857
+ }), i: 1, u(u, d, h) {
1858
+ const g = r ? +u[2] : void 0, b = u[0].replace(va, `
1859
+ `).match(a);
1860
+ let p = !1;
1861
+ return { items: b.map(function(w, k) {
1862
+ const $ = c.exec(w)[0].length, j = RegExp("^ {1," + $ + "}", "gm"), S = w.replace(j, "").replace(c, ""), o = k === b.length - 1, i = S.indexOf(`
1863
+
1864
+ `) !== -1 || o && p;
1865
+ p = i;
1866
+ const s = h.inline, f = h.list;
1867
+ let m;
1868
+ h.list = !0, i ? (h.inline = !1, m = Ne(S) + `
1869
+
1870
+ `) : (h.inline = !0, m = Ne(S));
1871
+ const y = d(m, h);
1872
+ return h.inline = s, h.list = f, y;
1873
+ }), ordered: r, start: g };
1874
+ }, l: (u, d, h) => e(u.ordered ? "ol" : "ul", { key: h.key, start: u.type === "20" ? u.start : void 0 }, u.items.map(function(g, b) {
1875
+ return e("li", { key: b }, d(g, h));
1876
+ })) };
1877
+ }
1878
+ const fs = RegExp(`^\\[((?:\\[[^\\[\\]]*(?:\\[[^\\[\\]]*\\][^\\[\\]]*)*\\]|[^\\[\\]])*)\\]\\(\\s*<?((?:\\([^)]*\\)|[^\\s\\\\]|\\\\.)*?)>?(?:\\s+['"]([\\s\\S]*?)['"])?\\s*\\)`), hs = /^!\[(.*?)\]\( *((?:\([^)]*\)|[^() ])*) *"?([^)"]*)?"?\)/;
1879
+ function Ne(e) {
1880
+ let t = e.length;
1881
+ for (; t > 0 && e[t - 1] <= " "; ) t--;
1882
+ return e.slice(0, t);
1883
+ }
1884
+ function Ve(e, t) {
1885
+ return e.startsWith(t);
1886
+ }
1887
+ function ms(e, t, r) {
1888
+ if (Array.isArray(r)) {
1889
+ for (let n = 0; n < r.length; n++) if (Ve(e, r[n])) return !0;
1890
+ return !1;
1891
+ }
1892
+ return r(e, t);
1893
+ }
1894
+ function Re(e) {
1895
+ return e.replace(/[ÀÁÂÃÄÅàáâãä忯]/g, "a").replace(/[çÇ]/g, "c").replace(/[ðÐ]/g, "d").replace(/[ÈÉÊËéèêë]/g, "e").replace(/[ÏïÎîÍíÌì]/g, "i").replace(/[Ññ]/g, "n").replace(/[øØœŒÕõÔôÓóÒò]/g, "o").replace(/[ÜüÛûÚúÙù]/g, "u").replace(/[ŸÿÝý]/g, "y").replace(/[^a-z0-9- ]/gi, "").replace(/ /gi, "-").toLowerCase();
1896
+ }
1897
+ function gs(e) {
1898
+ return Za.test(e) ? "right" : Qa.test(e) ? "center" : Va.test(e) ? "left" : null;
1899
+ }
1900
+ function zr(e, t, r, n) {
1901
+ const a = r.inTable;
1902
+ r.inTable = !0;
1903
+ let c = [[]], u = "";
1904
+ function d() {
1905
+ if (!u) return;
1906
+ const h = c[c.length - 1];
1907
+ h.push.apply(h, t(u, r)), u = "";
1908
+ }
1909
+ return e.trim().split(/(`[^`]*`|\\\||\|)/).filter(Boolean).forEach((h, g, b) => {
1910
+ h.trim() === "|" && (d(), n) ? g !== 0 && g !== b.length - 1 && c.push([]) : u += h;
1911
+ }), d(), r.inTable = a, c;
1912
+ }
1913
+ function bs(e, t, r) {
1914
+ r.inline = !0;
1915
+ const n = e[2] ? e[2].replace(Ya, "").split("|").map(gs) : [], a = e[3] ? function(u, d, h) {
1916
+ return u.trim().split(`
1917
+ `).map(function(g) {
1918
+ return zr(g, d, h, !0);
1919
+ });
1920
+ }(e[3], t, r) : [], c = zr(e[1], t, r, !!a.length);
1921
+ return r.inline = !1, a.length ? { align: n, cells: a, header: c, type: "25" } : { children: c, type: "21" };
1922
+ }
1923
+ function Dr(e, t) {
1924
+ return e.align[t] == null ? {} : { textAlign: e.align[t] };
1925
+ }
1926
+ function Te(e) {
1927
+ return e.inline = 1, e;
1928
+ }
1929
+ function ue(e) {
1930
+ return Te(function(t, r) {
1931
+ return r.inline ? e.exec(t) : null;
1932
+ });
1933
+ }
1934
+ function pe(e) {
1935
+ return Te(function(t, r) {
1936
+ return r.inline || r.simple ? e.exec(t) : null;
1937
+ });
1938
+ }
1939
+ function le(e) {
1940
+ return function(t, r) {
1941
+ return r.inline || r.simple ? null : e.exec(t);
1942
+ };
1943
+ }
1944
+ function We(e) {
1945
+ return Te(function(t) {
1946
+ return e.exec(t);
1947
+ });
1948
+ }
1949
+ const xs = /(javascript|vbscript|data(?!:image)):/i;
1950
+ function ys(e) {
1951
+ try {
1952
+ const t = decodeURIComponent(e).replace(/[^A-Za-z0-9/:]/g, "");
1953
+ if (xs.test(t)) return null;
1954
+ } catch {
1955
+ return null;
1956
+ }
1957
+ return e;
1958
+ }
1959
+ function oe(e) {
1960
+ return e && e.replace(os, "$1");
1961
+ }
1962
+ function Ze(e, t, r) {
1963
+ const n = r.inline || !1, a = r.simple || !1;
1964
+ r.inline = !0, r.simple = !0;
1965
+ const c = e(t, r);
1966
+ return r.inline = n, r.simple = a, c;
1967
+ }
1968
+ function ks(e, t, r) {
1969
+ const n = r.inline || !1, a = r.simple || !1;
1970
+ r.inline = !1, r.simple = !0;
1971
+ const c = e(t, r);
1972
+ return r.inline = n, r.simple = a, c;
1973
+ }
1974
+ function ws(e, t, r) {
1975
+ const n = r.inline || !1;
1976
+ r.inline = !1;
1977
+ const a = e(t, r);
1978
+ return r.inline = n, a;
1979
+ }
1980
+ const St = (e, t, r) => ({ children: Ze(t, e[2], r) });
1981
+ function Ct() {
1982
+ return {};
1983
+ }
1984
+ function jt() {
1985
+ return null;
1986
+ }
1987
+ function vs(...e) {
1988
+ return e.filter(Boolean).join(" ");
1989
+ }
1990
+ function It(e, t, r) {
1991
+ let n = e;
1992
+ const a = t.split(".");
1993
+ for (; a.length && (n = n[a[0]], n !== void 0); ) a.shift();
1994
+ return n || r;
1995
+ }
1996
+ function $s(e = "", t = {}) {
1997
+ t.overrides = t.overrides || {}, t.namedCodesToUnicode = t.namedCodesToUnicode ? he({}, Sr, t.namedCodesToUnicode) : Sr;
1998
+ const r = t.slugify || Re, n = t.sanitizer || ys, a = t.createElement || Bt.createElement, c = [Cr, jr, Ir, t.enforceAtxHeadings ? Tr : Ar, Er, _r, Cn, jn], u = [...c, Ka, vt, Mr, $t];
1999
+ function d(o, i, ...s) {
2000
+ const f = It(t.overrides, o + ".props", {});
2001
+ return a(function(m, y) {
2002
+ const x = It(y, m);
2003
+ return x ? typeof x == "function" || typeof x == "object" && "render" in x ? x : It(y, m + ".component", m) : m;
2004
+ }(o, t.overrides), he({}, i, f, { className: vs(i == null ? void 0 : i.className, f.className) || void 0 }), ...s);
2005
+ }
2006
+ function h(o) {
2007
+ o = o.replace(Ra, "");
2008
+ let i = !1;
2009
+ t.forceInline ? i = !0 : t.forceBlock || (i = qa.test(o) === !1);
2010
+ const s = $(k(i ? o : Ne(o).replace(ss, "") + `
2011
+
2012
+ `, { inline: i }));
2013
+ for (; typeof s[s.length - 1] == "string" && !s[s.length - 1].trim(); ) s.pop();
2014
+ if (t.wrapper === null) return s;
2015
+ const f = t.wrapper || (i ? "span" : "div");
2016
+ let m;
2017
+ if (s.length > 1 || t.forceWrapper) m = s;
2018
+ else {
2019
+ if (s.length === 1) return m = s[0], typeof m == "string" ? d("span", { key: "outer" }, m) : m;
2020
+ m = null;
2021
+ }
2022
+ return a(f, { key: "outer" }, m);
2023
+ }
2024
+ function g(o, i) {
2025
+ if (!i || !i.trim()) return null;
2026
+ const s = i.match(ka);
2027
+ return s ? s.reduce(function(f, m) {
2028
+ const y = m.indexOf("=");
2029
+ if (y !== -1) {
2030
+ const x = function(E) {
2031
+ return E.indexOf("-") !== -1 && E.match(Oa) === null && (E = E.replace(Fa, function(K, P) {
2032
+ return P.toUpperCase();
2033
+ })), E;
2034
+ }(m.slice(0, y)).trim(), A = function(E) {
2035
+ const K = E[0];
2036
+ return (K === '"' || K === "'") && E.length >= 2 && E[E.length - 1] === K ? E.slice(1, -1) : E;
2037
+ }(m.slice(y + 1).trim()), M = $r[x] || x;
2038
+ if (M === "ref") return f;
2039
+ const C = f[M] = function(E, K, P, I) {
2040
+ return K === "style" ? function(D) {
2041
+ const H = [];
2042
+ let v = "", O = !1, R = !1, W = "";
2043
+ if (!D) return H;
2044
+ for (let q = 0; q < D.length; q++) {
2045
+ const z = D[q];
2046
+ if (z !== '"' && z !== "'" || O || (R ? z === W && (R = !1, W = "") : (R = !0, W = z)), z === "(" && v.endsWith("url") ? O = !0 : z === ")" && O && (O = !1), z !== ";" || R || O) v += z;
2047
+ else {
2048
+ const U = v.trim();
2049
+ if (U) {
2050
+ const Q = U.indexOf(":");
2051
+ if (Q > 0) {
2052
+ const V = U.slice(0, Q).trim(), ie = U.slice(Q + 1).trim();
2053
+ H.push([V, ie]);
2054
+ }
2055
+ }
2056
+ v = "";
2057
+ }
2058
+ }
2059
+ const N = v.trim();
2060
+ if (N) {
2061
+ const q = N.indexOf(":");
2062
+ if (q > 0) {
2063
+ const z = N.slice(0, q).trim(), U = N.slice(q + 1).trim();
2064
+ H.push([z, U]);
2065
+ }
2066
+ }
2067
+ return H;
2068
+ }(P).reduce(function(D, [H, v]) {
2069
+ return D[H.replace(/(-[a-z])/g, (O) => O[1].toUpperCase())] = I(v, E, H), D;
2070
+ }, {}) : ya.indexOf(K) !== -1 ? I(oe(P), E, K) : (P.match(Na) && (P = oe(P.slice(1, P.length - 1))), P === "true" || P !== "false" && P);
2071
+ }(o, x, A, n);
2072
+ typeof C == "string" && (vt.test(C) || $t.test(C)) && (f[M] = h(C.trim()));
2073
+ } else m !== "style" && (f[$r[m] || m] = !0);
2074
+ return f;
2075
+ }, {}) : null;
2076
+ }
2077
+ const b = [], p = {}, w = { 0: { t: [">"], o: le(Cr), i: 1, u(o, i, s) {
2078
+ const [, f, m] = o[0].replace($a, "").match(Sa);
2079
+ return { alert: f, children: i(m, s) };
2080
+ }, l(o, i, s) {
2081
+ const f = { key: s.key };
2082
+ return o.alert && (f.className = "markdown-alert-" + r(o.alert.toLowerCase(), Re), o.children.unshift({ attrs: {}, children: [{ type: "27", text: o.alert }], noInnerParse: !0, type: "11", tag: "header" })), d("blockquote", f, i(o.children, s));
2083
+ } }, 1: { o: We(Ca), i: 1, u: Ct, l: (o, i, s) => d("br", { key: s.key }) }, 2: { t: (o) => {
2084
+ const i = o[0];
2085
+ return i === "-" || i === "*" || i === "_";
2086
+ }, o: le(ja), i: 1, u: Ct, l: (o, i, s) => d("hr", { key: s.key }) }, 3: { t: [" "], o: le(Ir), i: 0, u: (o) => ({ lang: void 0, text: oe(Ne(o[0].replace(/^ {4}/gm, ""))) }), l: (o, i, s) => d("pre", { key: s.key }, d("code", he({}, o.attrs, { className: o.lang ? "lang-" + o.lang : "" }), o.text)) }, 4: { t: ["```", "~~~"], o: le(jr), i: 0, u: (o) => ({ attrs: g("code", o[3] || ""), lang: o[2] || void 0, text: o[4], type: "3" }) }, 5: { t: ["`"], o: pe(Ia), i: 3, u: (o) => ({ text: oe(o[2]) }), l: (o, i, s) => d("code", { key: s.key }, o.text) }, 6: { t: ["[^"], o: le(Ea), i: 0, u: (o) => (b.push({ footnote: o[2], identifier: o[1] }), {}), l: jt }, 7: { t: ["[^"], o: ue(Ma), i: 1, u: (o) => ({ target: "#" + r(o[1], Re), text: o[1] }), l: (o, i, s) => d("a", { key: s.key, href: n(o.target, "a", "href") }, d("sup", { key: s.key }, o.text)) }, 8: { t: ["[ ]", "[x]"], o: ue(za), i: 1, u: (o) => ({ completed: o[1].toLowerCase() === "x" }), l: (o, i, s) => d("input", { checked: o.completed, key: s.key, readOnly: !0, type: "checkbox" }) }, 9: { t: ["#"], o: le(t.enforceAtxHeadings ? Tr : Ar), i: 1, u: (o, i, s) => ({ children: Ze(i, o[2], s), id: r(o[2], Re), level: o[1].length }), l: (o, i, s) => d("h" + o.level, { id: o.id, key: s.key }, i(o.children, s)) }, 10: { o: le(Er), i: 0, u: (o, i, s) => ({ children: Ze(i, o[1], s), level: o[2] === "=" ? 1 : 2, type: "9" }) }, 11: { t: ["<"], o: We(vt), i: 1, u(o, i, s) {
2087
+ const [, f] = o[3].match(is), m = RegExp("^" + f, "gm"), y = o[3].replace(m, ""), x = (A = y, u.some((P) => P.test(A)) ? ws : Ze);
2088
+ var A;
2089
+ const M = o[1].toLowerCase(), C = xa.indexOf(M) !== -1, E = (C ? M : o[1]).trim(), K = { attrs: g(E, o[2]), noInnerParse: C, tag: E };
2090
+ if (s.inAnchor = s.inAnchor || M === "a", C) K.text = o[3];
2091
+ else {
2092
+ const P = s.inHTML;
2093
+ s.inHTML = !0, K.children = x(i, y, s), s.inHTML = P;
2094
+ }
2095
+ return s.inAnchor = !1, K;
2096
+ }, l: (o, i, s) => d(o.tag, he({ key: s.key }, o.attrs), o.text || (o.children ? i(o.children, s) : "")) }, 13: { t: ["<"], o: We($t), i: 1, u(o) {
2097
+ const i = o[1].trim();
2098
+ return { attrs: g(i, o[2] || ""), tag: i };
2099
+ }, l: (o, i, s) => d(o.tag, he({}, o.attrs, { key: s.key })) }, 12: { t: ["<!--"], o: We(Mr), i: 1, u: () => ({}), l: jt }, 14: { t: ["!["], o: pe(hs), i: 1, u: (o) => ({ alt: oe(o[1]), target: oe(o[2]), title: oe(o[3]) }), l: (o, i, s) => d("img", { key: s.key, alt: o.alt || void 0, title: o.title || void 0, src: n(o.target, "img", "src") }) }, 15: { t: ["["], o: ue(fs), i: 3, u: (o, i, s) => ({ children: ks(i, o[1], s), target: oe(o[2]), title: oe(o[3]) }), l: (o, i, s) => d("a", { key: s.key, href: n(o.target, "a", "href"), title: o.title }, i(o.children, s)) }, 16: { t: ["<"], o: ue(La), i: 0, u: (o) => ({ children: [{ text: o[1], type: "27" }], target: o[1], type: "15" }) }, 17: { t: (o, i) => !i.inAnchor && !t.disableAutoLink && (Ve(o, "http://") || Ve(o, "https://")), o: ue(Ba), i: 0, u: (o) => ({ children: [{ text: o[1], type: "27" }], target: o[1], title: void 0, type: "15" }) }, 18: { t: ["<"], o: ue(Pa), i: 0, u(o) {
2100
+ let i = o[1], s = o[1];
2101
+ return wa.test(s) || (s = "mailto:" + s), { children: [{ text: i.replace("mailto:", ""), type: "27" }], target: s, type: "15" };
2102
+ } }, 20: Rr(d, 1), 33: Rr(d, 2), 19: { o: le(Aa), i: 3, u: Ct, l: () => `
2103
+ ` }, 21: { o: Te(function(o, i) {
2104
+ if (i.inline || i.simple || i.inHTML && o.indexOf(`
2105
+
2106
+ `) === -1 && i.prevCapture.indexOf(`
2107
+
2108
+ `) === -1) return null;
2109
+ let s = "";
2110
+ o.split(`
2111
+ `).every((m) => (m += `
2112
+ `, !c.some((y) => y.test(m)) && (s += m, !!m.trim())));
2113
+ const f = Ne(s);
2114
+ return f === "" ? null : [s, , f];
2115
+ }), i: 3, u: St, l: (o, i, s) => d("p", { key: s.key }, i(o.children, s)) }, 22: { t: ["["], o: ue(Wa), i: 0, u: (o) => (p[o[1]] = { target: o[2], title: o[4] }, {}), l: jt }, 23: { t: ["!["], o: pe(Ua), i: 0, u: (o) => ({ alt: o[1] ? oe(o[1]) : void 0, ref: o[2] }), l: (o, i, s) => p[o.ref] ? d("img", { key: s.key, alt: o.alt, src: n(p[o.ref].target, "img", "src"), title: p[o.ref].title }) : null }, 24: { t: (o) => o[0] === "[" && o.indexOf("](") === -1, o: ue(Ha), i: 0, u: (o, i, s) => ({ children: i(o[1], s), fallbackChildren: o[0], ref: o[2] }), l: (o, i, s) => p[o.ref] ? d("a", { key: s.key, href: n(p[o.ref].target, "a", "href"), title: p[o.ref].title }, i(o.children, s)) : d("span", { key: s.key }, o.fallbackChildren) }, 25: { t: ["|"], o: le(_r), i: 1, u: bs, l(o, i, s) {
2116
+ const f = o;
2117
+ return d("table", { key: s.key }, d("thead", null, d("tr", null, f.header.map(function(m, y) {
2118
+ return d("th", { key: y, style: Dr(f, y) }, i(m, s));
2119
+ }))), d("tbody", null, f.cells.map(function(m, y) {
2120
+ return d("tr", { key: y }, m.map(function(x, A) {
2121
+ return d("td", { key: A, style: Dr(f, A) }, i(x, s));
2122
+ }));
2123
+ })));
2124
+ } }, 27: { o: Te(function(o, i) {
2125
+ let s;
2126
+ return Ve(o, ":") && (s = rs.exec(o)), s || as.exec(o);
2127
+ }), i: 4, u(o) {
2128
+ const i = o[0];
2129
+ return { text: i.indexOf("&") === -1 ? i : i.replace(Da, (s, f) => t.namedCodesToUnicode[f] || s) };
2130
+ }, l: (o) => o.text }, 28: { t: ["**", "__"], o: pe(Ja), i: 2, u: (o, i, s) => ({ children: i(o[2], s) }), l: (o, i, s) => d("strong", { key: s.key }, i(o.children, s)) }, 29: { t: (o) => {
2131
+ const i = o[0];
2132
+ return (i === "*" || i === "_") && o[1] !== i;
2133
+ }, o: pe(Xa), i: 3, u: (o, i, s) => ({ children: i(o[2], s) }), l: (o, i, s) => d("em", { key: s.key }, i(o.children, s)) }, 30: { t: ["\\"], o: pe(ns), i: 1, u: (o) => ({ text: o[1], type: "27" }) }, 31: { t: ["=="], o: pe(es), i: 3, u: St, l: (o, i, s) => d("mark", { key: s.key }, i(o.children, s)) }, 32: { t: ["~~"], o: pe(ts), i: 3, u: St, l: (o, i, s) => d("del", { key: s.key }, i(o.children, s)) } };
2134
+ t.disableParsingRawHTML === !0 && (delete w[11], delete w[13]);
2135
+ const k = function(o) {
2136
+ var i = Object.keys(o);
2137
+ function s(f, m) {
2138
+ var y = [];
2139
+ if (m.prevCapture = m.prevCapture || "", f.trim()) for (; f; ) for (var x = 0; x < i.length; ) {
2140
+ var A = i[x], M = o[A];
2141
+ if (!M.t || ms(f, m, M.t)) {
2142
+ var C = M.o(f, m);
2143
+ if (C && C[0]) {
2144
+ f = f.substring(C[0].length);
2145
+ var E = M.u(C, s, m);
2146
+ m.prevCapture += C[0], E.type || (E.type = A), y.push(E);
2147
+ break;
2148
+ }
2149
+ x++;
2150
+ } else x++;
2151
+ }
2152
+ return m.prevCapture = "", y;
2153
+ }
2154
+ return i.sort(function(f, m) {
2155
+ return o[f].i - o[m].i || (f < m ? -1 : 1);
2156
+ }), function(f, m) {
2157
+ return s(function(y) {
2158
+ return y.replace(Ta, `
2159
+ `).replace(_a, "").replace(Ga, " ");
2160
+ }(f), m);
2161
+ };
2162
+ }(w), $ = (j = /* @__PURE__ */ function(o, i) {
2163
+ return function(s, f, m) {
2164
+ const y = o[s.type].l;
2165
+ return i ? i(() => y(s, f, m), s, f, m) : y(s, f, m);
2166
+ };
2167
+ }(w, t.renderRule), function o(i, s = {}) {
2168
+ if (Array.isArray(i)) {
2169
+ const f = s.key, m = [];
2170
+ let y = !1;
2171
+ for (let x = 0; x < i.length; x++) {
2172
+ s.key = x;
2173
+ const A = o(i[x], s), M = typeof A == "string";
2174
+ M && y ? m[m.length - 1] += A : A !== null && m.push(A), y = M;
2175
+ }
2176
+ return s.key = f, m;
2177
+ }
2178
+ return j(i, o, s);
2179
+ });
2180
+ var j;
2181
+ const S = h(e);
2182
+ return b.length ? d("div", null, S, d("footer", { key: "footer" }, b.map(function(o) {
2183
+ return d("div", { id: r(o.identifier, Re), key: o.identifier }, o.identifier, $(k(o.footnote, { inline: !0 })));
2184
+ }))) : S;
2185
+ }
2186
+ const Ss = (e) => {
2187
+ let { children: t = "", options: r } = e, n = function(a, c) {
2188
+ if (a == null) return {};
2189
+ var u, d, h = {}, g = Object.keys(a);
2190
+ for (d = 0; d < g.length; d++) c.indexOf(u = g[d]) >= 0 || (h[u] = a[u]);
2191
+ return h;
2192
+ }(e, ba);
2193
+ return Bt.cloneElement($s(t, r), n);
2194
+ }, Cs = T.div`
2195
+ code {
2196
+ @media (prefers-color-scheme: dark) {
2197
+ background-color: #374151 !important;
2198
+ color: #e5e7eb !important;
2199
+ }
2200
+
2201
+ [data-theme="dark"] & {
2202
+ background-color: #374151 !important;
2203
+ color: #e5e7eb !important;
2204
+ }
2205
+ }
2206
+
2207
+ pre {
2208
+ @media (prefers-color-scheme: dark) {
2209
+ background-color: #374151 !important;
2210
+ color: #e5e7eb !important;
2211
+ }
2212
+
2213
+ [data-theme="dark"] & {
2214
+ background-color: #374151 !important;
2215
+ color: #e5e7eb !important;
2216
+ }
2217
+ }
2218
+
2219
+ blockquote {
2220
+ @media (prefers-color-scheme: dark) {
2221
+ background-color: #1e3a8a !important;
2222
+ border-left-color: #3b82f6 !important;
2223
+ color: #e5e7eb !important;
2224
+ }
2225
+
2226
+ [data-theme="dark"] & {
2227
+ background-color: #1e3a8a !important;
2228
+ border-left-color: #3b82f6 !important;
2229
+ color: #e5e7eb !important;
2230
+ }
2231
+ }
2232
+ `;
2233
+ function Qt({ content: e, className: t }) {
2234
+ return /* @__PURE__ */ l.jsx(Cs, { className: t, children: /* @__PURE__ */ l.jsx(
2235
+ Ss,
2236
+ {
2237
+ options: {
2238
+ overrides: {
2239
+ // Custom styling for markdown elements with better spacing
2240
+ p: {
2241
+ props: {
2242
+ style: {
2243
+ marginBottom: "12px",
2244
+ lineHeight: "1.5",
2245
+ color: "inherit"
2246
+ }
2247
+ }
2248
+ },
2249
+ strong: {
2250
+ props: {
2251
+ style: {
2252
+ fontWeight: 700,
2253
+ color: "inherit"
2254
+ }
2255
+ }
2256
+ },
2257
+ em: {
2258
+ props: {
2259
+ style: {
2260
+ fontStyle: "italic",
2261
+ color: "inherit"
2262
+ }
2263
+ }
2264
+ },
2265
+ code: {
2266
+ props: {
2267
+ style: {
2268
+ backgroundColor: "#f3f4f6",
2269
+ padding: "2px 6px",
2270
+ borderRadius: "4px",
2271
+ fontSize: "14px",
2272
+ fontFamily: "monospace",
2273
+ color: "#111827"
2274
+ }
2275
+ }
2276
+ },
2277
+ pre: {
2278
+ props: {
2279
+ style: {
2280
+ backgroundColor: "#f3f4f6",
2281
+ padding: "12px",
2282
+ borderRadius: "6px",
2283
+ fontSize: "14px",
2284
+ fontFamily: "monospace",
2285
+ color: "#111827",
2286
+ overflowX: "auto",
2287
+ marginBottom: "12px"
2288
+ }
2289
+ }
2290
+ },
2291
+ ul: {
2292
+ props: {
2293
+ className: "list-disc list-inside mb-3 space-y-1 ml-2"
2294
+ }
2295
+ },
2296
+ ol: {
2297
+ props: {
2298
+ className: "list-decimal list-inside mb-3 space-y-1 ml-2"
2299
+ }
2300
+ },
2301
+ li: {
2302
+ props: {
2303
+ className: "leading-relaxed"
2304
+ }
2305
+ },
2306
+ blockquote: {
2307
+ props: {
2308
+ style: {
2309
+ borderLeft: "4px solid #93c5fd",
2310
+ paddingLeft: "16px",
2311
+ padding: "8px",
2312
+ fontStyle: "italic",
2313
+ marginBottom: "12px",
2314
+ backgroundColor: "#eff6ff",
2315
+ borderRadius: "4px",
2316
+ color: "inherit"
2317
+ }
2318
+ }
2319
+ },
2320
+ h1: {
2321
+ props: {
2322
+ style: {
2323
+ fontSize: "20px",
2324
+ fontWeight: 700,
2325
+ marginBottom: "12px",
2326
+ color: "inherit"
2327
+ }
2328
+ }
2329
+ },
2330
+ h2: {
2331
+ props: {
2332
+ style: {
2333
+ fontSize: "18px",
2334
+ fontWeight: 700,
2335
+ marginBottom: "8px",
2336
+ color: "inherit"
2337
+ }
2338
+ }
2339
+ },
2340
+ h3: {
2341
+ props: {
2342
+ style: {
2343
+ fontSize: "16px",
2344
+ fontWeight: 700,
2345
+ marginBottom: "8px",
2346
+ color: "inherit"
2347
+ }
2348
+ }
2349
+ },
2350
+ h4: {
2351
+ props: {
2352
+ style: {
2353
+ fontSize: "14px",
2354
+ fontWeight: 700,
2355
+ marginBottom: "8px",
2356
+ color: "inherit"
2357
+ }
2358
+ }
2359
+ },
2360
+ h5: {
2361
+ props: {
2362
+ style: {
2363
+ fontSize: "14px",
2364
+ fontWeight: 700,
2365
+ marginBottom: "8px",
2366
+ color: "inherit"
2367
+ }
2368
+ }
2369
+ },
2370
+ h6: {
2371
+ props: {
2372
+ style: {
2373
+ fontSize: "14px",
2374
+ fontWeight: 700,
2375
+ marginBottom: "8px",
2376
+ color: "inherit"
2377
+ }
2378
+ }
2379
+ },
2380
+ hr: {
2381
+ props: {
2382
+ style: {
2383
+ margin: "16px 0",
2384
+ borderColor: "#e5e7eb",
2385
+ borderWidth: "1px",
2386
+ borderStyle: "solid"
2387
+ }
2388
+ }
2389
+ },
2390
+ a: {
2391
+ props: {
2392
+ style: {
2393
+ color: "#2563eb",
2394
+ textDecoration: "underline"
2395
+ },
2396
+ target: "_blank",
2397
+ rel: "noopener noreferrer"
2398
+ }
2399
+ }
2400
+ }
2401
+ },
2402
+ children: e
2403
+ }
2404
+ ) });
2405
+ }
2406
+ const In = T.div`
2407
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
2408
+ background-color: white;
2409
+ border: 1px solid #e5e7eb;
2410
+ min-height: 0;
2411
+
2412
+ /* Scoped CSS reset to prevent host page style leakage */
2413
+ & button,
2414
+ & input,
2415
+ & textarea,
2416
+ & select {
2417
+ margin: 0;
2418
+ padding: 0;
2419
+ border: none;
2420
+ background: none;
2421
+ box-sizing: border-box;
2422
+ font-family: inherit;
2423
+ font-size: inherit;
2424
+ font-weight: normal;
2425
+ line-height: normal;
2426
+ color: inherit;
2427
+ text-shadow: none;
2428
+ -webkit-appearance: none;
2429
+ appearance: none;
2430
+ }
2431
+
2432
+ /* Try both media query approaches */
2433
+ @media (prefers-color-scheme: dark) {
2434
+ background-color: #1f2937;
2435
+ border-color: #374151;
2436
+ }
2437
+
2438
+ /* Alternative approach using data attribute */
2439
+ &[data-theme="dark"] {
2440
+ background-color: #1f2937;
2441
+ border-color: #374151;
2442
+ }
2443
+ `, Ee = T.div`
2444
+ max-width: 80%;
2445
+ padding: 12px;
2446
+ border-radius: 8px;
2447
+ font-size: 14px;
2448
+ word-break: break-word;
2449
+ margin-left: ${(e) => e.$isUser ? "auto" : "0"};
2450
+ margin-right: ${(e) => e.$isUser ? "0" : "auto"};
2451
+ line-height: 1.5;
2452
+
2453
+ /* User message styles - Light mode */
2454
+ background-color: ${(e) => e.$isUser ? "#3b82f6" : "#f3f4f6"};
2455
+ color: ${(e) => e.$isUser ? "#ffffff" : "#111827"};
2456
+
2457
+ /* Ensure bold text has proper contrast */
2458
+ strong, b {
2459
+ font-weight: 600;
2460
+ color: inherit;
2461
+ }
2462
+
2463
+ /* Dark mode support - Media query */
2464
+ @media (prefers-color-scheme: dark) {
2465
+ background-color: ${(e) => e.$isUser ? "#3b82f6" : "transparent"};
2466
+ color: ${(e) => e.$isUser ? "#ffffff" : "#e5e7eb"};
2467
+
2468
+ strong, b {
2469
+ color: ${(e) => (e.$isUser, "#ffffff")};
2470
+ font-weight: 700;
2471
+ }
2472
+ }
2473
+
2474
+ /* Dark mode support - Data attribute (for ChatWindow/ChatWidget parents) */
2475
+ [data-theme="dark"] & {
2476
+ background-color: ${(e) => e.$isUser ? "#3b82f6" : "transparent"};
2477
+ color: ${(e) => e.$isUser ? "#ffffff" : "#e5e7eb"};
2478
+
2479
+ strong, b {
2480
+ color: ${(e) => (e.$isUser, "#ffffff")};
2481
+ font-weight: 700;
2482
+ }
2483
+ }
2484
+ `, Vt = T.div`
2485
+ display: flex;
2486
+ flex-direction: column;
2487
+ flex: 1;
2488
+ min-width: 0;
2489
+ border: 1px solid #e5e7eb;
2490
+ border-radius: 14px;
2491
+ background-color: #ffffff;
2492
+ overflow: hidden;
2493
+ transition: border-color 0.2s ease, box-shadow 0.2s ease;
2494
+
2495
+ &:focus-within {
2496
+ border-color: #9ca3af;
2497
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
2498
+ }
2499
+
2500
+ @media (prefers-color-scheme: dark) {
2501
+ background-color: #18181b;
2502
+ border-color: rgba(255, 255, 255, 0.1);
2503
+
2504
+ &:focus-within {
2505
+ border-color: rgba(255, 255, 255, 0.3);
2506
+ }
2507
+ }
2508
+
2509
+ [data-theme='dark'] & {
2510
+ background-color: #18181b;
2511
+ border-color: rgba(255, 255, 255, 0.1);
2512
+
2513
+ &:focus-within {
2514
+ border-color: rgba(255, 255, 255, 0.3);
2515
+ }
2516
+ }
2517
+ `, Zt = T.div`
2518
+ display: flex;
2519
+ align-items: center;
2520
+ justify-content: space-between;
2521
+ gap: 6px;
2522
+ flex-shrink: 0;
2523
+ padding: 6px 10px;
2524
+ border-top: 1px solid #e5e7eb;
2525
+ background-color: #f9fafb;
2526
+
2527
+ @media (prefers-color-scheme: dark) {
2528
+ border-top-color: #52525b;
2529
+ background-color: #3f3f46;
2530
+ }
2531
+
2532
+ [data-theme='dark'] & {
2533
+ border-top-color: #52525b;
2534
+ background-color: #3f3f46;
2535
+ }
2536
+ `, js = T.textarea`
2537
+ display: block;
2538
+ width: 100%;
2539
+ min-width: 0;
2540
+ min-height: 42px;
2541
+ max-height: 96px;
2542
+ padding: 8px 12px;
2543
+ border: none;
2544
+ border-radius: 0;
2545
+ background-color: transparent;
2546
+ color: #1f2937;
2547
+ font-size: 14px;
2548
+ line-height: 1.5;
2549
+ font-family: inherit;
2550
+ resize: none;
2551
+ outline: none;
2552
+ transition: color 0.2s ease;
2553
+ box-sizing: border-box;
2554
+ overflow-y: auto;
2555
+
2556
+ &::placeholder {
2557
+ color: #6b7280;
2558
+ }
2559
+
2560
+ &:disabled {
2561
+ opacity: 0.5;
2562
+ cursor: not-allowed;
2563
+ }
2564
+
2565
+ @media (prefers-color-scheme: dark) {
2566
+ color: #f9fafb;
2567
+
2568
+ &::placeholder {
2569
+ color: #9ca3af;
2570
+ }
2571
+ }
2572
+
2573
+ [data-theme='dark'] & {
2574
+ color: #f9fafb;
2575
+
2576
+ &::placeholder {
2577
+ color: #9ca3af;
2578
+ }
2579
+ }
2580
+ `, Jt = T.div`
2581
+ display: flex;
2582
+ align-items: center;
2583
+ gap: 8px;
2584
+ padding: 8px 12px 10px;
2585
+ border-top: 1px solid #e5e7eb;
2586
+ background-color: #ffffff;
2587
+
2588
+ @media (prefers-color-scheme: dark) {
2589
+ background-color: #1f2937;
2590
+ border-top-color: #374151;
2591
+ }
2592
+
2593
+ [data-theme="dark"] & {
2594
+ background-color: #1f2937;
2595
+ border-top-color: #374151;
2596
+ }
2597
+ `, Is = T.textarea`
2598
+ flex: 1;
2599
+ width: 100%;
2600
+ min-height: 40px;
2601
+ max-height: 120px;
2602
+ padding: 8px 12px;
2603
+ border: 1px solid #d1d5db;
2604
+ border-radius: 6px;
2605
+ background-color: #ffffff;
2606
+ color: #1f2937;
2607
+ font-size: 14px;
2608
+ font-family: inherit;
2609
+ resize: none;
2610
+ outline: none;
2611
+ transition: all 0.2s ease;
2612
+
2613
+ &::placeholder {
2614
+ color: #6b7280;
2615
+ }
2616
+
2617
+ &:focus {
2618
+ border-color: #3b82f6;
2619
+ box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
2620
+ }
2621
+
2622
+ &:disabled {
2623
+ opacity: 0.5;
2624
+ cursor: not-allowed;
2625
+ }
2626
+
2627
+ @media (prefers-color-scheme: dark) {
2628
+ background-color: #374151;
2629
+ color: #f9fafb;
2630
+ border-color: #4b5563;
2631
+
2632
+ &::placeholder {
2633
+ color: #9ca3af;
2634
+ }
2635
+
2636
+ &:focus {
2637
+ border-color: #3b82f6;
2638
+ box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
2639
+ }
2640
+ }
2641
+
2642
+ [data-theme="dark"] & {
2643
+ background-color: #374151;
2644
+ color: #f9fafb;
2645
+ border-color: #4b5563;
2646
+
2647
+ &::placeholder {
2648
+ color: #9ca3af;
2649
+ }
2650
+
2651
+ &:focus {
2652
+ border-color: #3b82f6;
2653
+ box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
2654
+ }
2655
+ }
2656
+ `, As = T.button`
2657
+ width: 32px;
2658
+ height: 32px;
2659
+ min-width: 32px;
2660
+ min-height: 32px;
2661
+ padding: 0;
2662
+ box-sizing: border-box;
2663
+ line-height: normal;
2664
+ background: transparent;
2665
+ border: 2px solid #3b82f6;
2666
+ border-radius: 50%;
2667
+ color: #3b82f6;
2668
+ cursor: pointer;
2669
+ display: flex;
2670
+ align-items: center;
2671
+ justify-content: center;
2672
+ transition: all 0.2s ease;
2673
+ flex-shrink: 0;
2674
+
2675
+ &:hover:not(:disabled) {
2676
+ background: #3b82f6;
2677
+ color: white;
2678
+ }
2679
+
2680
+ &:disabled {
2681
+ opacity: 0.5;
2682
+ cursor: not-allowed;
2683
+ border-color: #9ca3af;
2684
+ color: #9ca3af;
2685
+ }
2686
+
2687
+ svg {
2688
+ width: 16px !important;
2689
+ height: 16px !important;
2690
+ min-width: 16px !important;
2691
+ min-height: 16px !important;
2692
+ color: inherit;
2693
+ display: block !important;
2694
+ visibility: visible !important;
2695
+ opacity: 1 !important;
2696
+ flex-shrink: 0;
2697
+ }
2698
+ svg path {
2699
+ stroke: currentColor !important;
2700
+ fill: none !important;
2701
+ visibility: visible !important;
2702
+ }
2703
+
2704
+ @media (prefers-color-scheme: dark) {
2705
+ border-color: #60a5fa;
2706
+ color: #60a5fa;
2707
+ &:hover:not(:disabled) {
2708
+ background: #2563eb;
2709
+ color: white;
2710
+ }
2711
+ &:disabled {
2712
+ border-color: #6b7280;
2713
+ color: #6b7280;
2714
+ }
2715
+ }
2716
+
2717
+ [data-theme="dark"] & {
2718
+ border-color: #60a5fa;
2719
+ color: #60a5fa;
2720
+ &:hover:not(:disabled) {
2721
+ background: #2563eb;
2722
+ color: white;
2723
+ }
2724
+ &:disabled {
2725
+ border-color: #6b7280;
2726
+ color: #6b7280;
2727
+ }
2728
+ }
2729
+ `, Xt = T.button`
2730
+ width: 26px;
2731
+ height: 26px;
2732
+ min-width: 26px;
2733
+ min-height: 26px;
2734
+ padding: 0;
2735
+ box-sizing: border-box;
2736
+ line-height: normal;
2737
+ background: transparent;
2738
+ border: 1px solid #3b82f6;
2739
+ border-radius: 8px;
2740
+ color: #3b82f6;
2741
+ cursor: pointer;
2742
+ display: flex;
2743
+ align-items: center;
2744
+ justify-content: center;
2745
+ transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease,
2746
+ box-shadow 0.2s ease;
2747
+ flex-shrink: 0;
2748
+
2749
+ &:hover:not(:disabled) {
2750
+ background: rgba(59, 130, 246, 0.12);
2751
+ color: #2563eb;
2752
+ border-color: #2563eb;
2753
+ }
2754
+
2755
+ &:focus-visible {
2756
+ outline: none;
2757
+ box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px rgba(59, 130, 246, 0.45);
2758
+ }
2759
+
2760
+ &:disabled {
2761
+ opacity: 0.45;
2762
+ cursor: not-allowed;
2763
+ border-color: #9ca3af;
2764
+ color: #9ca3af;
2765
+ }
2766
+
2767
+ svg {
2768
+ width: 13px !important;
2769
+ height: 13px !important;
2770
+ min-width: 13px !important;
2771
+ min-height: 13px !important;
2772
+ color: inherit;
2773
+ display: block !important;
2774
+ visibility: visible !important;
2775
+ opacity: 1 !important;
2776
+ flex-shrink: 0;
2777
+ }
2778
+
2779
+ svg path {
2780
+ stroke: currentColor !important;
2781
+ fill: none !important;
2782
+ visibility: visible !important;
2783
+ }
2784
+
2785
+ @media (prefers-color-scheme: dark) {
2786
+ border-color: #60a5fa;
2787
+ color: #60a5fa;
2788
+
2789
+ &:hover:not(:disabled) {
2790
+ background: rgba(96, 165, 250, 0.14);
2791
+ color: #93c5fd;
2792
+ border-color: #93c5fd;
2793
+ }
2794
+
2795
+ &:focus-visible {
2796
+ box-shadow: 0 0 0 2px #18181b, 0 0 0 4px rgba(96, 165, 250, 0.45);
2797
+ }
2798
+
2799
+ &:disabled {
2800
+ border-color: #6b7280;
2801
+ color: #6b7280;
2802
+ }
2803
+ }
2804
+
2805
+ [data-theme='dark'] & {
2806
+ border-color: #60a5fa;
2807
+ color: #60a5fa;
2808
+
2809
+ &:hover:not(:disabled) {
2810
+ background: rgba(96, 165, 250, 0.14);
2811
+ color: #93c5fd;
2812
+ border-color: #93c5fd;
2813
+ }
2814
+
2815
+ &:focus-visible {
2816
+ box-shadow: 0 0 0 2px #18181b, 0 0 0 4px rgba(96, 165, 250, 0.45);
2817
+ }
2818
+
2819
+ &:disabled {
2820
+ border-color: #6b7280;
2821
+ color: #6b7280;
2822
+ }
2823
+ }
2824
+ `, At = (e, t = 0.15) => {
2825
+ if (e && e.startsWith("#")) {
2826
+ const r = e.replace("#", ""), n = parseInt(r, 16);
2827
+ if (isNaN(n)) return e;
2828
+ const a = Math.max(0, Math.min(255, n >> 16 & 255) * (1 - t)), c = Math.max(0, Math.min(255, n >> 8 & 255) * (1 - t)), u = Math.max(0, Math.min(255, n & 255) * (1 - t));
2829
+ return `#${Math.floor(a).toString(16).padStart(2, "0")}${Math.floor(c).toString(16).padStart(2, "0")}${Math.floor(u).toString(16).padStart(2, "0")}`;
2830
+ }
2831
+ return e || "#2563eb";
2832
+ }, Ts = T.button`
2833
+ position: fixed;
2834
+ z-index: 50;
2835
+ height: 48px;
2836
+ padding: 0 16px;
2837
+ box-sizing: border-box;
2838
+ line-height: normal;
2839
+ background: ${(e) => {
2840
+ if (e.$primaryColor) {
2841
+ const t = At(e.$primaryColor, 0.1);
2842
+ return `linear-gradient(135deg, ${e.$primaryColor} 0%, ${t} 100%)`;
2843
+ }
2844
+ return "linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%)";
2845
+ }};
2846
+ color: white;
2847
+ border: none;
2848
+ border-radius: 24px;
2849
+ box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
2850
+ cursor: pointer;
2851
+ display: flex;
2852
+ align-items: center;
2853
+ gap: 8px;
2854
+ font-weight: 500;
2855
+ font-size: 14px;
2856
+ transition: all 0.2s ease;
2857
+
2858
+ /* Position based on prop */
2859
+ ${(e) => {
2860
+ switch (e.$position) {
2861
+ case "bottom-left":
2862
+ return "bottom: 24px; left: 24px;";
2863
+ case "top-right":
2864
+ return "top: 24px; right: 24px;";
2865
+ case "top-left":
2866
+ return "top: 24px; left: 24px;";
2867
+ default:
2868
+ return "bottom: 24px; right: 24px;";
2869
+ }
2870
+ }}
2871
+
2872
+ &:hover {
2873
+ background: ${(e) => {
2874
+ if (e.$primaryColor) {
2875
+ const t = At(e.$primaryColor, 0.2), r = At(e.$primaryColor, 0.3);
2876
+ return `linear-gradient(135deg, ${t} 0%, ${r} 100%)`;
2877
+ }
2878
+ return "linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%)";
2879
+ }};
2880
+ box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
2881
+ }
2882
+
2883
+ .icon-container {
2884
+ width: 24px;
2885
+ height: 24px;
2886
+ background: rgba(255, 255, 255, 0.2);
2887
+ border-radius: 50%;
2888
+ display: flex;
2889
+ align-items: center;
2890
+ justify-content: center;
2891
+ }
2892
+ `, Es = T.div`
2893
+ position: fixed;
2894
+ z-index: 50;
2895
+ width: 320px;
2896
+ background: white;
2897
+ border: 1px solid #e5e7eb;
2898
+ border-radius: 8px;
2899
+ box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
2900
+ display: flex;
2901
+ flex-direction: column;
2902
+
2903
+ /* Position based on prop */
2904
+ ${(e) => {
2905
+ switch (e.$position) {
2906
+ case "bottom-left":
2907
+ return "bottom: 24px; left: 24px;";
2908
+ case "top-right":
2909
+ return "top: 24px; right: 24px;";
2910
+ case "top-left":
2911
+ return "top: 24px; left: 24px;";
2912
+ default:
2913
+ return "bottom: 24px; right: 24px;";
2914
+ }
2915
+ }}
2916
+
2917
+ @media (prefers-color-scheme: dark) {
2918
+ background: #1f2937;
2919
+ border-color: #374151;
2920
+ }
2921
+
2922
+ &[data-theme="dark"] {
2923
+ background: #1f2937;
2924
+ border-color: #374151;
2925
+ }
2926
+
2927
+ @media (min-width: 640px) {
2928
+ width: 384px;
2929
+ }
2930
+ `;
2931
+ T.div`
2932
+ padding: 12px 16px;
2933
+ background: ${(e) => e.primaryColor || "#3b82f6"};
2934
+ color: white;
2935
+ border-radius: 8px 8px 0 0;
2936
+ display: flex;
2937
+ align-items: center;
2938
+ justify-content: space-between;
2939
+ font-weight: 500;
2940
+
2941
+ .header-content {
2942
+ display: flex;
2943
+ align-items: center;
2944
+ gap: 8px;
2945
+ }
2946
+
2947
+ .header-actions {
2948
+ display: flex;
2949
+ align-items: center;
2950
+ gap: 4px;
2951
+ }
2952
+ `;
2953
+ T.button`
2954
+ width: 24px;
2955
+ height: 24px;
2956
+ padding: 0;
2957
+ box-sizing: border-box;
2958
+ line-height: normal;
2959
+ background: transparent;
2960
+ border: none;
2961
+ color: white;
2962
+ cursor: pointer;
2963
+ display: flex;
2964
+ align-items: center;
2965
+ justify-content: center;
2966
+ border-radius: 4px;
2967
+ transition: background-color 0.2s ease;
2968
+
2969
+ &:hover {
2970
+ background: rgba(255, 255, 255, 0.1);
2971
+ }
2972
+
2973
+ svg {
2974
+ width: 16px;
2975
+ height: 16px;
2976
+ }
2977
+ `;
2978
+ T.div`
2979
+ flex: 1;
2980
+ overflow-y: auto;
2981
+ padding: 16px;
2982
+ display: flex;
2983
+ flex-direction: column;
2984
+ gap: 16px;
2985
+
2986
+ /* Custom scrollbar */
2987
+ &::-webkit-scrollbar {
2988
+ width: 6px;
2989
+ }
2990
+
2991
+ &::-webkit-scrollbar-track {
2992
+ background: #f1f5f9;
2993
+ }
2994
+
2995
+ &::-webkit-scrollbar-thumb {
2996
+ background: #cbd5e1;
2997
+ border-radius: 3px;
2998
+ }
2999
+
3000
+ &::-webkit-scrollbar-thumb:hover {
3001
+ background: #94a3b8;
3002
+ }
3003
+
3004
+ @media (prefers-color-scheme: dark) {
3005
+ &::-webkit-scrollbar-track {
3006
+ background: #374151;
3007
+ }
3008
+
3009
+ &::-webkit-scrollbar-thumb {
3010
+ background: #6b7280;
3011
+ }
3012
+
3013
+ &::-webkit-scrollbar-thumb:hover {
3014
+ background: #9ca3af;
3015
+ }
3016
+ }
3017
+
3018
+ [data-theme="dark"] & {
3019
+ &::-webkit-scrollbar-track {
3020
+ background: #374151;
3021
+ }
3022
+
3023
+ &::-webkit-scrollbar-thumb {
3024
+ background: #6b7280;
3025
+ }
3026
+
3027
+ &::-webkit-scrollbar-thumb:hover {
3028
+ background: #9ca3af;
3029
+ }
3030
+ }
3031
+ `;
3032
+ const er = T.div`
3033
+ display: flex;
3034
+ gap: 4px;
3035
+ align-items: center;
3036
+
3037
+ .dot {
3038
+ width: 8px;
3039
+ height: 8px;
3040
+ background: #6b7280;
3041
+ border-radius: 50%;
3042
+ animation: bounce 1.4s ease-in-out infinite both;
3043
+
3044
+ &:nth-child(1) { animation-delay: -0.32s; }
3045
+ &:nth-child(2) { animation-delay: -0.16s; }
3046
+ &:nth-child(3) { animation-delay: 0s; }
3047
+ }
3048
+
3049
+ @keyframes bounce {
3050
+ 0%, 80%, 100% {
3051
+ transform: scale(0);
3052
+ }
3053
+ 40% {
3054
+ transform: scale(1);
3055
+ }
3056
+ }
3057
+
3058
+ @media (prefers-color-scheme: dark) {
3059
+ .dot {
3060
+ background: #9ca3af;
3061
+ }
3062
+ }
3063
+ `;
3064
+ T.div`
3065
+ font-size: 12px;
3066
+ margin-top: 4px;
3067
+ color: ${(e) => e.$isUser ? "rgba(255, 255, 255, 0.8)" : "#6b7280"};
3068
+
3069
+ @media (prefers-color-scheme: dark) {
3070
+ color: ${(e) => e.$isUser ? "rgba(255, 255, 255, 0.8)" : "#d1d5db"};
3071
+ }
3072
+
3073
+ [data-theme="dark"] & {
3074
+ color: ${(e) => e.$isUser ? "rgba(255, 255, 255, 0.8)" : "#d1d5db"};
3075
+ }
3076
+ `;
3077
+ const tr = T.div`
3078
+ font-size: 14px;
3079
+ color: #dc2626;
3080
+ text-align: center;
3081
+ padding: 8px;
3082
+ margin: 16px 0;
3083
+
3084
+ @media (prefers-color-scheme: dark) {
3085
+ color: #f87171;
3086
+ }
3087
+ `, Ms = T.div`
3088
+ position: absolute;
3089
+ ${(e) => e.$position === "top" ? "top: 0;" : "bottom: 0;"}
3090
+ left: 0;
3091
+ right: 0;
3092
+ height: 6px;
3093
+ background: linear-gradient(90deg, #e5e7eb 0%, #3b82f6 50%, #e5e7eb 100%);
3094
+ cursor: ${(e) => (e.$position === "top", "ns-resize")};
3095
+ border-radius: ${(e) => e.$position === "top" ? "8px 8px 0 0" : "0 0 8px 8px"};
3096
+ opacity: 0.7;
3097
+ transition: opacity 0.2s ease;
3098
+
3099
+ &:hover {
3100
+ opacity: 1;
3101
+ background: linear-gradient(90deg, #3b82f6 0%, #1d4ed8 50%, #3b82f6 100%);
3102
+ }
3103
+
3104
+ @media (prefers-color-scheme: dark) {
3105
+ background: linear-gradient(90deg, #374151 0%, #3b82f6 50%, #374151 100%);
3106
+
3107
+ &:hover {
3108
+ background: linear-gradient(90deg, #3b82f6 0%, #1d4ed8 50%, #3b82f6 100%);
3109
+ }
3110
+ }
3111
+ `, xe = T.img`
3112
+ width: ${(e) => e.$size || "32px"};
3113
+ height: ${(e) => e.$size || "32px"};
3114
+ border-radius: 50%;
3115
+ object-fit: cover;
3116
+ flex-shrink: 0;
3117
+ border: 2px solid rgba(255, 255, 255, 0.2);
3118
+ background-color: rgba(255, 255, 255, 0.1);
3119
+ `, _s = T.div`
3120
+ display: flex;
3121
+ flex-direction: column;
3122
+ align-items: center;
3123
+ justify-content: flex-start;
3124
+ padding: 24px 16px;
3125
+ flex: 1;
3126
+ min-height: 0;
3127
+ overflow-y: auto;
3128
+ gap: 20px;
3129
+ position: relative;
3130
+
3131
+ /* Gradient background - starts with full primary color at top, fades to background color */
3132
+ background: ${(e) => e.$primaryColor ? `linear-gradient(to bottom, ${e.$primaryColor} 0%, ${e.$primaryColor} 20%, rgba(255, 255, 255, 0.3) 45%, rgba(255, 255, 255, 0.7) 65%, rgba(255, 255, 255, 1) 100%)` : "transparent"};
3133
+
3134
+ @media (prefers-color-scheme: dark) {
3135
+ background: ${(e) => e.$primaryColor ? `linear-gradient(to bottom, ${e.$primaryColor} 0%, ${e.$primaryColor} 20%, rgba(31, 41, 55, 0.3) 45%, rgba(31, 41, 55, 0.7) 65%, rgba(31, 41, 55, 1) 100%)` : "transparent"};
3136
+ }
3137
+
3138
+ [data-theme="dark"] & {
3139
+ background: ${(e) => e.$primaryColor ? `linear-gradient(to bottom, ${e.$primaryColor} 0%, ${e.$primaryColor} 20%, rgba(31, 41, 55, 0.3) 45%, rgba(31, 41, 55, 0.7) 65%, rgba(31, 41, 55, 1) 100%)` : "transparent"};
3140
+ }
3141
+ `, Rs = T.div`
3142
+ font-size: 18px;
3143
+ font-weight: 600;
3144
+ text-align: center;
3145
+ color: #111827;
3146
+ margin-bottom: 8px;
3147
+
3148
+ @media (prefers-color-scheme: dark) {
3149
+ color: #f9fafb;
3150
+ }
3151
+
3152
+ [data-theme="dark"] & {
3153
+ color: #f9fafb;
3154
+ }
3155
+ `, zs = T.img`
3156
+ max-width: 120px;
3157
+ max-height: 120px;
3158
+ width: auto;
3159
+ height: auto;
3160
+ object-fit: contain;
3161
+ margin-bottom: 8px;
3162
+ border-radius: 8px;
3163
+ `, Ds = T.div`
3164
+ display: flex;
3165
+ flex-direction: column;
3166
+ gap: 12px;
3167
+ width: 100%;
3168
+ max-width: 100%;
3169
+ margin-bottom: 16px;
3170
+ `, Os = T.button`
3171
+ width: 100%;
3172
+ padding: 12px 16px;
3173
+ box-sizing: border-box;
3174
+ line-height: normal;
3175
+ text-align: left;
3176
+ border: 1px solid #e5e7eb;
3177
+ border-radius: 8px;
3178
+ background-color: #ffffff;
3179
+ color: #111827;
3180
+ font-size: 14px;
3181
+ font-weight: 500;
3182
+ cursor: pointer;
3183
+ transition: all 0.2s ease;
3184
+
3185
+ &:hover:not(:disabled) {
3186
+ background-color: ${(e) => e.$primaryColor ? `${e.$primaryColor}15` : "#f3f4f6"};
3187
+ border-color: ${(e) => e.$primaryColor || "#d1d5db"};
3188
+ transform: translateY(-1px);
3189
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
3190
+ }
3191
+
3192
+ &:active:not(:disabled) {
3193
+ transform: translateY(0);
3194
+ }
3195
+
3196
+ &:disabled {
3197
+ opacity: 0.5;
3198
+ cursor: not-allowed;
3199
+ }
3200
+
3201
+ @media (prefers-color-scheme: dark) {
3202
+ background-color: #374151;
3203
+ color: #f9fafb;
3204
+ border-color: #4b5563;
3205
+
3206
+ &:hover:not(:disabled) {
3207
+ background-color: ${(e) => e.$primaryColor ? `${e.$primaryColor}25` : "#4b5563"};
3208
+ border-color: ${(e) => e.$primaryColor || "#6b7280"};
3209
+ }
3210
+ }
3211
+
3212
+ [data-theme="dark"] & {
3213
+ background-color: #374151;
3214
+ color: #f9fafb;
3215
+ border-color: #4b5563;
3216
+
3217
+ &:hover:not(:disabled) {
3218
+ background-color: ${(e) => e.$primaryColor ? `${e.$primaryColor}25` : "#4b5563"};
3219
+ border-color: ${(e) => e.$primaryColor || "#6b7280"};
3220
+ }
3221
+ }
3222
+ `, Ns = T.div`
3223
+ display: flex;
3224
+ align-items: center;
3225
+ gap: 8px;
3226
+ width: 100%;
3227
+ margin-top: auto;
3228
+ padding-top: 16px;
3229
+ border-top: 1px solid #e5e7eb;
3230
+
3231
+ @media (prefers-color-scheme: dark) {
3232
+ border-top-color: #374151;
3233
+ }
3234
+
3235
+ [data-theme="dark"] & {
3236
+ border-top-color: #374151;
3237
+ }
3238
+ `, ht = F.forwardRef(function({
3239
+ value: t,
3240
+ onChange: r,
3241
+ onKeyDown: n,
3242
+ placeholder: a = "Type a message...",
3243
+ disabled: c = !1,
3244
+ className: u,
3245
+ maxLength: d = 2e3,
3246
+ variant: h = "default"
3247
+ }, g) {
3248
+ const b = (k) => {
3249
+ r(k.target.value);
3250
+ }, p = (k) => {
3251
+ k.key === "Enter" && !k.shiftKey && k.preventDefault(), n(k);
3252
+ }, w = h === "composer" ? js : Is;
3253
+ return /* @__PURE__ */ l.jsx(
3254
+ w,
3255
+ {
3256
+ ref: g,
3257
+ value: t,
3258
+ onChange: b,
3259
+ onKeyDown: p,
3260
+ placeholder: a,
3261
+ disabled: c,
3262
+ maxLength: d,
3263
+ className: u,
3264
+ onInput: (k) => {
3265
+ const $ = k.target;
3266
+ $.style.height = "auto";
3267
+ const j = h === "composer" ? 96 : 120;
3268
+ $.style.height = `${Math.min($.scrollHeight, j)}px`;
3269
+ }
3270
+ }
3271
+ );
3272
+ });
3273
+ function mt({ size: e = 16 }) {
3274
+ return /* @__PURE__ */ l.jsxs(
3275
+ "svg",
3276
+ {
3277
+ width: e,
3278
+ height: e,
3279
+ viewBox: "0 0 24 24",
3280
+ fill: "none",
3281
+ stroke: "currentColor",
3282
+ strokeWidth: "2",
3283
+ strokeLinecap: "round",
3284
+ strokeLinejoin: "round",
3285
+ "aria-hidden": !0,
3286
+ children: [
3287
+ /* @__PURE__ */ l.jsx("path", { d: "M22 2L11 13" }),
3288
+ /* @__PURE__ */ l.jsx("path", { d: "M22 2L15 22L11 13L2 9L22 2Z" })
3289
+ ]
3290
+ }
3291
+ );
3292
+ }
3293
+ function rr({ config: e, onQuestionClick: t, onSendMessage: r, isLoading: n }) {
3294
+ const [a, c] = F.useState(""), u = F.useRef(null), d = async () => {
3295
+ !a.trim() || n || (await r(a.trim()), c(""));
3296
+ }, h = (b) => {
3297
+ b.key === "Enter" && !b.shiftKey && (b.preventDefault(), d());
3298
+ }, g = e.welcomeMessage || "Hi there 👋 How can we help?";
3299
+ return /* @__PURE__ */ l.jsxs(_s, { $primaryColor: e.primaryColor, children: [
3300
+ e.welcomeImage && /* @__PURE__ */ l.jsx(
3301
+ zs,
3302
+ {
3303
+ src: e.welcomeImage,
3304
+ alt: "Welcome"
3305
+ }
3306
+ ),
3307
+ /* @__PURE__ */ l.jsx(Rs, { children: g }),
3308
+ e.quickQuestions && e.quickQuestions.length > 0 && /* @__PURE__ */ l.jsx(Ds, { children: e.quickQuestions.map((b, p) => /* @__PURE__ */ l.jsx(
3309
+ Os,
3310
+ {
3311
+ onClick: () => t(b),
3312
+ disabled: n,
3313
+ $primaryColor: e.primaryColor,
3314
+ children: b
3315
+ },
3316
+ p
3317
+ )) }),
3318
+ /* @__PURE__ */ l.jsxs(Ns, { children: [
3319
+ /* @__PURE__ */ l.jsx(
3320
+ ht,
3321
+ {
3322
+ ref: u,
3323
+ value: a,
3324
+ onChange: c,
3325
+ onKeyDown: h,
3326
+ placeholder: e.placeholder || "Type a message...",
3327
+ disabled: n
3328
+ }
3329
+ ),
3330
+ /* @__PURE__ */ l.jsx(
3331
+ As,
3332
+ {
3333
+ onClick: d,
3334
+ disabled: n || !a.trim(),
3335
+ children: /* @__PURE__ */ l.jsx(mt, { size: 16 })
3336
+ }
3337
+ )
3338
+ ] })
3339
+ ] });
3340
+ }
3341
+ function nr(e, t) {
3342
+ var j;
3343
+ const r = (e.maxAttachmentSizeMB ?? 10) * 1024 * 1024, n = e.maxAttachments ?? 3, a = (j = e.allowedAttachmentTypes) != null && j.length ? e.allowedAttachmentTypes : bn, c = !!(e.enableAttachments && e.publishableKey), [u, d] = J([]), [h, g] = J(null), b = ae([]);
3344
+ De(() => {
3345
+ b.current = u;
3346
+ }, [u]);
3347
+ const p = Z(
3348
+ async (S) => {
3349
+ if (c) {
3350
+ g(null);
3351
+ for (const o of S) {
3352
+ if (b.current.length >= n) {
3353
+ g(`At most ${n} attachments per message.`);
3354
+ break;
3355
+ }
3356
+ const i = xn(o, r, a);
3357
+ if (i) {
3358
+ g(`${o.name}: ${i}`);
3359
+ continue;
3360
+ }
3361
+ try {
3362
+ const s = await t(o);
3363
+ d((f) => {
3364
+ if (f.length >= n) return f;
3365
+ const m = [...f, s];
3366
+ return b.current = m, m;
3367
+ });
3368
+ } catch (s) {
3369
+ g(s instanceof Error ? s.message : "Upload failed");
3370
+ }
3371
+ }
3372
+ }
3373
+ },
3374
+ [a, c, r, n, t]
3375
+ ), w = Z((S) => {
3376
+ d((o) => {
3377
+ const i = o.filter((s) => s.id !== S);
3378
+ return b.current = i, i;
3379
+ });
3380
+ }, []), k = Z(() => {
3381
+ d([]), b.current = [], g(null);
3382
+ }, []), $ = Z(
3383
+ (S) => {
3384
+ g(null), d((o) => {
3385
+ if (o.length >= n) return o;
3386
+ const i = [...o, S];
3387
+ return b.current = i, i;
3388
+ });
3389
+ },
3390
+ [n]
3391
+ );
3392
+ return {
3393
+ enabled: c,
3394
+ staged: u,
3395
+ attachmentError: h,
3396
+ setAttachmentError: g,
3397
+ addFiles: p,
3398
+ appendStaged: $,
3399
+ removeStaged: w,
3400
+ clearStaged: k,
3401
+ maxFiles: n,
3402
+ maxBytes: r,
3403
+ allowed: a
3404
+ };
3405
+ }
3406
+ function Bs({ size: e = 16 }) {
3407
+ return /* @__PURE__ */ l.jsx(
3408
+ "svg",
3409
+ {
3410
+ width: e,
3411
+ height: e,
3412
+ viewBox: "0 0 24 24",
3413
+ fill: "none",
3414
+ stroke: "currentColor",
3415
+ strokeWidth: "2",
3416
+ strokeLinecap: "round",
3417
+ strokeLinejoin: "round",
3418
+ "aria-hidden": !0,
3419
+ children: /* @__PURE__ */ l.jsx("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" })
3420
+ }
3421
+ );
3422
+ }
3423
+ function Ps({ size: e = 16 }) {
3424
+ return /* @__PURE__ */ l.jsxs(
3425
+ "svg",
3426
+ {
3427
+ width: e,
3428
+ height: e,
3429
+ viewBox: "0 0 24 24",
3430
+ fill: "none",
3431
+ stroke: "currentColor",
3432
+ strokeWidth: "2",
3433
+ strokeLinecap: "round",
3434
+ strokeLinejoin: "round",
3435
+ "aria-hidden": !0,
3436
+ children: [
3437
+ /* @__PURE__ */ l.jsx("path", { d: "M18 6 6 18" }),
3438
+ /* @__PURE__ */ l.jsx("path", { d: "m6 6 12 12" })
3439
+ ]
3440
+ }
3441
+ );
3442
+ }
3443
+ /*!---------------------------------------------------------------------------------------------
3444
+ * Copyright (c) StackBlitz. All rights reserved.
3445
+ * Licensed under the MIT License. See License.txt in the project root for license information.
3446
+ *--------------------------------------------------------------------------------------------*/
3447
+ const Ls = {
3448
+ /**
3449
+ * A value from 0 to 1, on how much to damp the animation.
3450
+ * 0 means no damping, 1 means full damping.
3451
+ *
3452
+ * @default 0.7
3453
+ */
3454
+ damping: 0.7,
3455
+ /**
3456
+ * The stiffness of how fast/slow the animation gets up to speed.
3457
+ *
3458
+ * @default 0.05
3459
+ */
3460
+ stiffness: 0.05,
3461
+ /**
3462
+ * The inertial mass associated with the animation.
3463
+ * Higher numbers make the animation slower.
3464
+ *
3465
+ * @default 1.25
3466
+ */
3467
+ mass: 1.25
3468
+ }, Fs = 70, Ks = 1e3 / 60, Ws = 350;
3469
+ let gt = !1;
3470
+ var Br;
3471
+ (Br = globalThis.document) == null || Br.addEventListener("mousedown", () => {
3472
+ gt = !0;
3473
+ });
3474
+ var Pr;
3475
+ (Pr = globalThis.document) == null || Pr.addEventListener("mouseup", () => {
3476
+ gt = !1;
3477
+ });
3478
+ var Lr;
3479
+ (Lr = globalThis.document) == null || Lr.addEventListener("click", () => {
3480
+ gt = !1;
3481
+ });
3482
+ const Us = (e = {}) => {
3483
+ const [t, r] = J(!1), [n, a] = J(e.initial !== !1), [c, u] = J(!1), d = ae(null);
3484
+ d.current = e;
3485
+ const h = Z(() => {
3486
+ var f;
3487
+ if (!gt)
3488
+ return !1;
3489
+ const i = window.getSelection();
3490
+ if (!i || !i.rangeCount)
3491
+ return !1;
3492
+ const s = i.getRangeAt(0);
3493
+ return s.commonAncestorContainer.contains(S.current) || ((f = S.current) == null ? void 0 : f.contains(s.commonAncestorContainer));
3494
+ }, []), g = Z((i) => {
3495
+ p.isAtBottom = i, a(i);
3496
+ }, []), b = Z((i) => {
3497
+ p.escapedFromLock = i, r(i);
3498
+ }, []), p = Pt(() => {
3499
+ let i;
3500
+ return {
3501
+ escapedFromLock: t,
3502
+ isAtBottom: n,
3503
+ resizeDifference: 0,
3504
+ accumulated: 0,
3505
+ velocity: 0,
3506
+ listeners: /* @__PURE__ */ new Set(),
3507
+ get scrollTop() {
3508
+ var s;
3509
+ return ((s = S.current) == null ? void 0 : s.scrollTop) ?? 0;
3510
+ },
3511
+ set scrollTop(s) {
3512
+ S.current && (S.current.scrollTop = s, p.ignoreScrollToTop = S.current.scrollTop);
3513
+ },
3514
+ get targetScrollTop() {
3515
+ return !S.current || !o.current ? 0 : S.current.scrollHeight - 1 - S.current.clientHeight;
3516
+ },
3517
+ get calculatedTargetScrollTop() {
3518
+ if (!S.current || !o.current)
3519
+ return 0;
3520
+ const { targetScrollTop: s } = this;
3521
+ if (!e.targetScrollTop)
3522
+ return s;
3523
+ if ((i == null ? void 0 : i.targetScrollTop) === s)
3524
+ return i.calculatedScrollTop;
3525
+ const f = Math.max(Math.min(e.targetScrollTop(s, {
3526
+ scrollElement: S.current,
3527
+ contentElement: o.current
3528
+ }), s), 0);
3529
+ return i = { targetScrollTop: s, calculatedScrollTop: f }, requestAnimationFrame(() => {
3530
+ i = void 0;
3531
+ }), f;
3532
+ },
3533
+ get scrollDifference() {
3534
+ return this.calculatedTargetScrollTop - this.scrollTop;
3535
+ },
3536
+ get isNearBottom() {
3537
+ return this.scrollDifference <= Fs;
3538
+ }
3539
+ };
3540
+ }, []), w = Z((i = {}) => {
3541
+ var M;
3542
+ typeof i == "string" && (i = { animation: i }), i.preserveScrollPosition || g(!0);
3543
+ const s = Date.now() + (Number(i.wait) || 0), f = Et(d.current, i.animation), { ignoreEscapes: m = !1 } = i;
3544
+ let y, x = p.calculatedTargetScrollTop;
3545
+ i.duration instanceof Promise ? i.duration.finally(() => {
3546
+ y = Date.now();
3547
+ }) : y = s + (i.duration ?? 0);
3548
+ const A = async () => {
3549
+ const C = new Promise(requestAnimationFrame).then(() => {
3550
+ var I;
3551
+ if (!p.isAtBottom)
3552
+ return p.animation = void 0, !1;
3553
+ const { scrollTop: E } = p, K = performance.now(), P = (K - (p.lastTick ?? K)) / Ks;
3554
+ if (p.animation || (p.animation = { behavior: f, promise: C, ignoreEscapes: m }), p.animation.behavior === f && (p.lastTick = K), h() || s > Date.now())
3555
+ return A();
3556
+ if (E < Math.min(x, p.calculatedTargetScrollTop)) {
3557
+ if (((I = p.animation) == null ? void 0 : I.behavior) === f) {
3558
+ if (f === "instant")
3559
+ return p.scrollTop = p.calculatedTargetScrollTop, A();
3560
+ p.velocity = (f.damping * p.velocity + f.stiffness * p.scrollDifference) / f.mass, p.accumulated += p.velocity * P, p.scrollTop += p.accumulated, p.scrollTop !== E && (p.accumulated = 0);
3561
+ }
3562
+ return A();
3563
+ }
3564
+ return y > Date.now() ? (x = p.calculatedTargetScrollTop, A()) : (p.animation = void 0, p.scrollTop < p.calculatedTargetScrollTop ? w({
3565
+ animation: Et(d.current, d.current.resize),
3566
+ ignoreEscapes: m,
3567
+ duration: Math.max(0, y - Date.now()) || void 0
3568
+ }) : p.isAtBottom);
3569
+ });
3570
+ return C.then((E) => (requestAnimationFrame(() => {
3571
+ p.animation || (p.lastTick = void 0, p.velocity = 0);
3572
+ }), E));
3573
+ };
3574
+ return i.wait !== !0 && (p.animation = void 0), ((M = p.animation) == null ? void 0 : M.behavior) === f ? p.animation.promise : A();
3575
+ }, [g, h, p]), k = Z(() => {
3576
+ b(!0), g(!1);
3577
+ }, [b, g]), $ = Z(({ target: i }) => {
3578
+ if (i !== S.current)
3579
+ return;
3580
+ const { scrollTop: s, ignoreScrollToTop: f } = p;
3581
+ let { lastScrollTop: m = s } = p;
3582
+ p.lastScrollTop = s, p.ignoreScrollToTop = void 0, f && f > s && (m = f), u(p.isNearBottom), setTimeout(() => {
3583
+ var A;
3584
+ if (p.resizeDifference || s === f)
3585
+ return;
3586
+ if (h()) {
3587
+ b(!0), g(!1);
3588
+ return;
3589
+ }
3590
+ const y = s > m, x = s < m;
3591
+ if ((A = p.animation) != null && A.ignoreEscapes) {
3592
+ p.scrollTop = m;
3593
+ return;
3594
+ }
3595
+ x && (b(!0), g(!1)), y && b(!1), !p.escapedFromLock && p.isNearBottom && g(!0);
3596
+ }, 1);
3597
+ }, [b, g, h, p]), j = Z(({ target: i, deltaY: s }) => {
3598
+ var m;
3599
+ let f = i;
3600
+ for (; !["scroll", "auto"].includes(getComputedStyle(f).overflow); ) {
3601
+ if (!f.parentElement)
3602
+ return;
3603
+ f = f.parentElement;
3604
+ }
3605
+ f === S.current && s < 0 && S.current.scrollHeight > S.current.clientHeight && !((m = p.animation) != null && m.ignoreEscapes) && (b(!0), g(!1));
3606
+ }, [b, g, p]), S = Or((i) => {
3607
+ var s, f;
3608
+ (s = S.current) == null || s.removeEventListener("scroll", $), (f = S.current) == null || f.removeEventListener("wheel", j), i == null || i.addEventListener("scroll", $, { passive: !0 }), i == null || i.addEventListener("wheel", j, { passive: !0 });
3609
+ }, []), o = Or((i) => {
3610
+ var f, m;
3611
+ if ((f = p.resizeObserver) == null || f.disconnect(), !i)
3612
+ return;
3613
+ let s;
3614
+ p.resizeObserver = new ResizeObserver(([y]) => {
3615
+ const { height: x } = y.contentRect, A = x - (s ?? x);
3616
+ if (p.resizeDifference = A, p.scrollTop > p.targetScrollTop && (p.scrollTop = p.targetScrollTop), u(p.isNearBottom), A >= 0) {
3617
+ const M = Et(d.current, s ? d.current.resize : d.current.initial);
3618
+ w({
3619
+ animation: M,
3620
+ wait: !0,
3621
+ preserveScrollPosition: !0,
3622
+ duration: M === "instant" ? void 0 : Ws
3623
+ });
3624
+ } else
3625
+ p.isNearBottom && (b(!1), g(!0));
3626
+ s = x, requestAnimationFrame(() => {
3627
+ setTimeout(() => {
3628
+ p.resizeDifference === A && (p.resizeDifference = 0);
3629
+ }, 1);
3630
+ });
3631
+ }), (m = p.resizeObserver) == null || m.observe(i);
3632
+ }, []);
3633
+ return {
3634
+ contentRef: o,
3635
+ scrollRef: S,
3636
+ scrollToBottom: w,
3637
+ stopScroll: k,
3638
+ isAtBottom: n || c,
3639
+ isNearBottom: c,
3640
+ escapedFromLock: t,
3641
+ state: p
3642
+ };
3643
+ };
3644
+ function Or(e, t) {
3645
+ const r = Z((n) => (r.current = n, e(n)), t);
3646
+ return r;
3647
+ }
3648
+ const Tt = /* @__PURE__ */ new Map();
3649
+ function Et(...e) {
3650
+ const t = { ...Ls };
3651
+ let r = !1;
3652
+ for (const a of e) {
3653
+ if (a === "instant") {
3654
+ r = !0;
3655
+ continue;
3656
+ }
3657
+ typeof a == "object" && (r = !1, t.damping = a.damping ?? t.damping, t.stiffness = a.stiffness ?? t.stiffness, t.mass = a.mass ?? t.mass);
3658
+ }
3659
+ const n = JSON.stringify(t);
3660
+ return Tt.has(n) || Tt.set(n, Object.freeze(t)), r ? "instant" : Tt.get(n);
3661
+ }
3662
+ const An = Rn(null), Hs = typeof window < "u" ? _n : De;
3663
+ function nt({ instance: e, children: t, resize: r, initial: n, mass: a, damping: c, stiffness: u, targetScrollTop: d, contextRef: h, ...g }) {
3664
+ const b = ae(null), p = Bt.useCallback((m, y) => {
3665
+ const x = (f == null ? void 0 : f.targetScrollTop) ?? d;
3666
+ return (x == null ? void 0 : x(m, y)) ?? m;
3667
+ }, [d]), w = Us({
3668
+ mass: a,
3669
+ damping: c,
3670
+ stiffness: u,
3671
+ resize: r,
3672
+ initial: n,
3673
+ targetScrollTop: p
3674
+ }), { scrollRef: k, contentRef: $, scrollToBottom: j, stopScroll: S, isAtBottom: o, escapedFromLock: i, state: s } = e ?? w, f = Pt(() => ({
3675
+ scrollToBottom: j,
3676
+ stopScroll: S,
3677
+ scrollRef: k,
3678
+ isAtBottom: o,
3679
+ escapedFromLock: i,
3680
+ contentRef: $,
3681
+ state: s,
3682
+ get targetScrollTop() {
3683
+ return b.current;
3684
+ },
3685
+ set targetScrollTop(m) {
3686
+ b.current = m;
3687
+ }
3688
+ }), [
3689
+ j,
3690
+ o,
3691
+ $,
3692
+ k,
3693
+ S,
3694
+ i,
3695
+ s
3696
+ ]);
3697
+ return Mn(h, () => f, [f]), Hs(() => {
3698
+ k.current && getComputedStyle(k.current).overflow === "visible" && (k.current.style.overflow = "auto");
3699
+ }, []), l.jsx(An.Provider, { value: f, children: l.jsx("div", { ...g, children: typeof t == "function" ? t(f) : t }) });
3700
+ }
3701
+ (function(e) {
3702
+ function t({ children: r, ...n }) {
3703
+ const a = qs();
3704
+ return l.jsx("div", { ref: a.scrollRef, style: {
3705
+ height: "100%",
3706
+ width: "100%"
3707
+ }, children: l.jsx("div", { ...n, ref: a.contentRef, children: typeof r == "function" ? r(a) : r }) });
3708
+ }
3709
+ e.Content = t;
3710
+ })(nt || (nt = {}));
3711
+ function qs() {
3712
+ const e = Kr(An);
3713
+ if (!e)
3714
+ throw new Error("use-stick-to-bottom component context must be used within a StickToBottom component");
3715
+ return e;
3716
+ }
3717
+ const Gs = T(nt)`
3718
+ position: relative;
3719
+ flex: 1;
3720
+ overflow-y: auto;
3721
+ scroll-behavior: smooth;
3722
+ scrollbar-width: thin;
3723
+ scrollbar-color: rgba(148, 163, 184, 0.55) transparent;
3724
+
3725
+ &::-webkit-scrollbar {
3726
+ width: 8px;
3727
+ }
3728
+
3729
+ &::-webkit-scrollbar-track {
3730
+ background: transparent;
3731
+ }
3732
+
3733
+ &::-webkit-scrollbar-thumb {
3734
+ background-color: rgba(148, 163, 184, 0.45);
3735
+ border-radius: 999px;
3736
+ border: 2px solid transparent;
3737
+ background-clip: padding-box;
3738
+ }
3739
+
3740
+ &::-webkit-scrollbar-thumb:hover {
3741
+ background-color: rgba(100, 116, 139, 0.55);
3742
+ }
3743
+
3744
+ @media (prefers-color-scheme: dark) {
3745
+ scrollbar-color: rgba(71, 85, 105, 0.75) transparent;
3746
+
3747
+ &::-webkit-scrollbar-thumb {
3748
+ background-color: rgba(71, 85, 105, 0.65);
3749
+ }
3750
+
3751
+ &::-webkit-scrollbar-thumb:hover {
3752
+ background-color: rgba(100, 116, 139, 0.75);
3753
+ }
3754
+ }
3755
+
3756
+ [data-theme='dark'] & {
3757
+ scrollbar-color: rgba(71, 85, 105, 0.75) transparent;
3758
+
3759
+ &::-webkit-scrollbar-thumb {
3760
+ background-color: rgba(71, 85, 105, 0.65);
3761
+ }
3762
+
3763
+ &::-webkit-scrollbar-thumb:hover {
3764
+ background-color: rgba(100, 116, 139, 0.75);
3765
+ }
3766
+ }
3767
+ `, Ys = T(nt.Content)`
3768
+ padding: 16px;
3769
+ `;
3770
+ T.button`
3771
+ position: absolute;
3772
+ bottom: 16px;
3773
+ left: 50%;
3774
+ transform: translateX(-50%);
3775
+ width: 40px;
3776
+ height: 40px;
3777
+ border-radius: 50%;
3778
+ border: 1px solid #d1d5db;
3779
+ background: white;
3780
+ color: #6b7280;
3781
+ cursor: pointer;
3782
+ display: flex;
3783
+ align-items: center;
3784
+ justify-content: center;
3785
+ transition: all 0.2s ease;
3786
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
3787
+
3788
+ &:hover {
3789
+ background: #f9fafb;
3790
+ border-color: #9ca3af;
3791
+ color: #374151;
3792
+ }
3793
+
3794
+ svg {
3795
+ width: 16px;
3796
+ height: 16px;
3797
+ }
3798
+
3799
+ @media (prefers-color-scheme: dark) {
3800
+ background: #1f2937;
3801
+ border-color: #374151;
3802
+ color: #9ca3af;
3803
+
3804
+ &:hover {
3805
+ background: #374151;
3806
+ border-color: #4b5563;
3807
+ color: #d1d5db;
3808
+ }
3809
+ }
3810
+ `;
3811
+ function or({
3812
+ className: e,
3813
+ children: t,
3814
+ style: r,
3815
+ onDragOver: n,
3816
+ onDragLeave: a,
3817
+ onDrop: c
3818
+ }) {
3819
+ return /* @__PURE__ */ l.jsx(
3820
+ Gs,
3821
+ {
3822
+ className: e,
3823
+ style: r,
3824
+ initial: "smooth",
3825
+ resize: "smooth",
3826
+ role: "log",
3827
+ onDragOver: n,
3828
+ onDragLeave: a,
3829
+ onDrop: c,
3830
+ children: t
3831
+ }
3832
+ );
3833
+ }
3834
+ function ar({ className: e, children: t }) {
3835
+ return /* @__PURE__ */ l.jsx(Ys, { className: e, children: t });
3836
+ }
3837
+ function Qs({ config: e, chat: t }) {
3838
+ const { messages: r, sendMessage: n, uploadAttachment: a, isLoading: c, error: u, hasSessionStarted: d } = t, [h, g] = F.useState(""), [b, p] = F.useState(!1), w = F.useRef(null), {
3839
+ enabled: k,
3840
+ staged: $,
3841
+ attachmentError: j,
3842
+ setAttachmentError: S,
3843
+ addFiles: o,
3844
+ appendStaged: i,
3845
+ removeStaged: s,
3846
+ clearStaged: f,
3847
+ maxFiles: m,
3848
+ maxBytes: y,
3849
+ allowed: x
3850
+ } = nr(e, a), A = () => e.theme === "dark" ? "dark" : e.theme === "light" ? "light" : b ? "dark" : "light";
3851
+ F.useEffect(() => {
3852
+ if (e.theme === "auto" || !e.theme) {
3853
+ const I = () => {
3854
+ p(window.matchMedia("(prefers-color-scheme: dark)").matches);
3855
+ };
3856
+ I();
3857
+ const D = window.matchMedia("(prefers-color-scheme: dark)");
3858
+ return D.addEventListener("change", I), () => D.removeEventListener("change", I);
3859
+ } else
3860
+ p(e.theme === "dark");
3861
+ }, [e.theme]);
3862
+ const M = async () => {
3863
+ const I = h.trim();
3864
+ !I && $.length === 0 || c || (await n(I, void 0, $.length ? $ : void 0), g(""), f(), setTimeout(() => {
3865
+ var D;
3866
+ (D = w.current) == null || D.focus();
3867
+ }, 100));
3868
+ }, C = (I) => {
3869
+ I.key === "Enter" && !I.shiftKey && (I.preventDefault(), M());
3870
+ }, E = F.useMemo(() => e.height === "100%" || e.height === "100vh" ? {
3871
+ height: "100%",
3872
+ minHeight: 0,
3873
+ display: "flex",
3874
+ flexDirection: "column",
3875
+ borderRadius: "8px"
3876
+ } : {
3877
+ height: e.height,
3878
+ display: "flex",
3879
+ flexDirection: "column",
3880
+ borderRadius: "8px"
3881
+ }, [e.height]), K = (I) => {
3882
+ k && (I.preventDefault(), I.dataTransfer.dropEffect = "copy");
3883
+ }, P = async (I) => {
3884
+ if (!k) return;
3885
+ I.preventDefault();
3886
+ const D = await Ht(I.dataTransfer);
3887
+ D.length && await o(D);
3888
+ };
3889
+ return /* @__PURE__ */ l.jsx(
3890
+ In,
3891
+ {
3892
+ "data-theme": A(),
3893
+ style: E,
3894
+ children: e.quickQuestions && e.quickQuestions.length > 0 && !d ? /* @__PURE__ */ l.jsx(
3895
+ rr,
3896
+ {
3897
+ config: e,
3898
+ onQuestionClick: async (I) => {
3899
+ await n(I);
3900
+ },
3901
+ onSendMessage: n,
3902
+ isLoading: c
3903
+ }
3904
+ ) : /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
3905
+ /* @__PURE__ */ l.jsx(or, { style: { flex: 1 }, onDragOver: K, onDrop: P, children: /* @__PURE__ */ l.jsxs(ar, { children: [
3906
+ r.map((I) => /* @__PURE__ */ l.jsxs(
3907
+ "div",
3908
+ {
3909
+ style: {
3910
+ display: "flex",
3911
+ marginBottom: "16px",
3912
+ justifyContent: I.role === "user" ? "flex-end" : "flex-start",
3913
+ alignItems: "flex-start",
3914
+ gap: "8px"
3915
+ },
3916
+ children: [
3917
+ I.role === "assistant" && e.agentImage && /* @__PURE__ */ l.jsx(
3918
+ xe,
3919
+ {
3920
+ src: e.agentImage,
3921
+ alt: e.chatName || "Agent",
3922
+ $size: "28px"
3923
+ }
3924
+ ),
3925
+ /* @__PURE__ */ l.jsx(Ee, { $isUser: I.role === "user", children: I.role === "assistant" ? /* @__PURE__ */ l.jsx(Qt, { content: I.content }) : /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
3926
+ I.attachments && I.attachments.length > 0 && /* @__PURE__ */ l.jsx(Ae, { attachments: I.attachments, readOnly: !0 }),
3927
+ I.content ? I.content : null
3928
+ ] }) })
3929
+ ]
3930
+ },
3931
+ I.id
3932
+ )),
3933
+ c && /* @__PURE__ */ l.jsxs("div", { style: { display: "flex", justifyContent: "flex-start", alignItems: "flex-start", gap: "8px", marginBottom: "16px" }, children: [
3934
+ e.agentImage && /* @__PURE__ */ l.jsx(
3935
+ xe,
3936
+ {
3937
+ src: e.agentImage,
3938
+ alt: e.chatName || "Agent",
3939
+ $size: "28px"
3940
+ }
3941
+ ),
3942
+ /* @__PURE__ */ l.jsx(Ee, { $isUser: !1, children: /* @__PURE__ */ l.jsxs(er, { children: [
3943
+ /* @__PURE__ */ l.jsx("div", { className: "dot" }),
3944
+ /* @__PURE__ */ l.jsx("div", { className: "dot" }),
3945
+ /* @__PURE__ */ l.jsx("div", { className: "dot" })
3946
+ ] }) })
3947
+ ] }),
3948
+ u && /* @__PURE__ */ l.jsx(tr, { children: u })
3949
+ ] }) }),
3950
+ /* @__PURE__ */ l.jsxs(Jt, { style: { flexDirection: "column", alignItems: "stretch", gap: 0 }, children: [
3951
+ (j || k && $.length > 0) && /* @__PURE__ */ l.jsxs("div", { style: { paddingBottom: 8 }, children: [
3952
+ j && /* @__PURE__ */ l.jsx("div", { style: { fontSize: 12, color: "#dc2626", marginBottom: 4 }, children: j }),
3953
+ k && $.length > 0 && /* @__PURE__ */ l.jsx(Ae, { attachments: $, onRemove: s })
3954
+ ] }),
3955
+ /* @__PURE__ */ l.jsx("div", { style: { width: "100%" }, children: /* @__PURE__ */ l.jsxs(Vt, { children: [
3956
+ /* @__PURE__ */ l.jsx(
3957
+ ht,
3958
+ {
3959
+ ref: w,
3960
+ variant: "composer",
3961
+ value: h,
3962
+ onChange: g,
3963
+ onKeyDown: C,
3964
+ placeholder: e.placeholder,
3965
+ disabled: c
3966
+ }
3967
+ ),
3968
+ /* @__PURE__ */ l.jsxs(Zt, { children: [
3969
+ /* @__PURE__ */ l.jsx("div", { style: { display: "flex", alignItems: "center", gap: 8, flex: 1, minWidth: 0 }, children: k && /* @__PURE__ */ l.jsx(
3970
+ qt,
3971
+ {
3972
+ integrated: !0,
3973
+ disabled: c,
3974
+ maxFileBytes: y,
3975
+ maxFiles: m,
3976
+ allowedMime: x,
3977
+ currentCount: $.length,
3978
+ uploadAttachment: a,
3979
+ onUploaded: i,
3980
+ onError: S
3981
+ }
3982
+ ) }),
3983
+ /* @__PURE__ */ l.jsx(
3984
+ Xt,
3985
+ {
3986
+ type: "button",
3987
+ onClick: M,
3988
+ disabled: c || !h.trim() && $.length === 0,
3989
+ "aria-label": "Send message",
3990
+ children: /* @__PURE__ */ l.jsx(mt, { size: 13 })
3991
+ }
3992
+ )
3993
+ ] })
3994
+ ] }) })
3995
+ ] })
3996
+ ] })
3997
+ }
3998
+ );
3999
+ }
4000
+ const Vs = T.div`
4001
+ display: flex;
4002
+ align-items: center;
4003
+ justify-content: space-between;
4004
+ padding: 12px 16px;
4005
+ border-radius: 8px 8px 0 0;
4006
+ background: ${(e) => e.$showWelcomeScreen && e.$primaryColor ? e.$primaryColor : "#ffffff"};
4007
+ color: ${(e) => e.$showWelcomeScreen && e.$primaryColor ? "white" : "#111827"};
4008
+ border-bottom: none;
4009
+ transition: background-color 0.3s ease, color 0.3s ease;
4010
+
4011
+ @media (prefers-color-scheme: dark) {
4012
+ background: ${(e) => e.$showWelcomeScreen && e.$primaryColor ? e.$primaryColor : "#1f2937"};
4013
+ color: ${(e) => e.$showWelcomeScreen && e.$primaryColor ? "white" : "#f9fafb"};
4014
+ border-bottom: none;
4015
+ }
4016
+
4017
+ [data-theme="dark"] & {
4018
+ background: ${(e) => e.$showWelcomeScreen && e.$primaryColor ? e.$primaryColor : "#1f2937"};
4019
+ color: ${(e) => e.$showWelcomeScreen && e.$primaryColor ? "white" : "#f9fafb"};
4020
+ }
4021
+
4022
+ [data-theme="light"] & {
4023
+ background: ${(e) => e.$showWelcomeScreen && e.$primaryColor ? e.$primaryColor : "#ffffff"};
4024
+ color: ${(e) => e.$showWelcomeScreen && e.$primaryColor ? "white" : "#111827"};
4025
+ }
4026
+ `, Zs = T.div`
4027
+ display: flex;
4028
+ align-items: center;
4029
+ gap: 12px;
4030
+ `, Js = T.div`
4031
+ display: flex;
4032
+ align-items: center;
4033
+ gap: 8px;
4034
+ `, Xs = T.div`
4035
+ width: 8px;
4036
+ height: 8px;
4037
+ background: #10b981;
4038
+ border-radius: 50%;
4039
+ animation: pulse 2s infinite;
4040
+
4041
+ @keyframes pulse {
4042
+ 0%, 100% {
4043
+ opacity: 1;
4044
+ }
4045
+ 50% {
4046
+ opacity: 0.5;
4047
+ }
4048
+ }
4049
+ `, ei = T.span`
4050
+ font-weight: 500;
4051
+ font-size: 14px;
4052
+ `, ti = T.div`
4053
+ display: flex;
4054
+ align-items: center;
4055
+ gap: 4px;
4056
+ `, ri = T.button`
4057
+ padding: 4px;
4058
+ background: transparent;
4059
+ border: none;
4060
+ color: inherit;
4061
+ cursor: pointer;
4062
+ border-radius: 4px;
4063
+ transition: background-color 0.2s ease;
4064
+ display: flex;
4065
+ align-items: center;
4066
+ justify-content: center;
4067
+
4068
+ &:hover {
4069
+ background: rgba(255, 255, 255, 0.1);
4070
+ }
4071
+
4072
+ svg {
4073
+ width: 16px;
4074
+ height: 16px;
4075
+ }
4076
+ `;
4077
+ function ni({
4078
+ chatName: e = "Chat Assistant",
4079
+ showCloseButton: t = !0,
4080
+ onClose: r,
4081
+ agentImage: n,
4082
+ className: a,
4083
+ primaryColor: c,
4084
+ showWelcomeScreen: u = !1
4085
+ }) {
4086
+ return /* @__PURE__ */ l.jsxs(
4087
+ Vs,
4088
+ {
4089
+ className: a,
4090
+ $primaryColor: c,
4091
+ $showWelcomeScreen: u,
4092
+ children: [
4093
+ /* @__PURE__ */ l.jsxs(Zs, { children: [
4094
+ n && /* @__PURE__ */ l.jsx(
4095
+ xe,
4096
+ {
4097
+ src: n,
4098
+ alt: e || "Agent",
4099
+ $size: "32px"
4100
+ }
4101
+ ),
4102
+ /* @__PURE__ */ l.jsxs(Js, { children: [
4103
+ /* @__PURE__ */ l.jsx(Xs, {}),
4104
+ /* @__PURE__ */ l.jsx(ei, { children: e })
4105
+ ] })
4106
+ ] }),
4107
+ /* @__PURE__ */ l.jsx(ti, { children: t && /* @__PURE__ */ l.jsx(
4108
+ ri,
4109
+ {
4110
+ onClick: r,
4111
+ "aria-label": "Close",
4112
+ children: /* @__PURE__ */ l.jsx(Ps, { size: 16 })
4113
+ }
4114
+ ) })
4115
+ ]
4116
+ }
4117
+ );
4118
+ }
4119
+ function Nr({ config: e, chat: t }) {
4120
+ const { messages: r, sendMessage: n, uploadAttachment: a, isLoading: c, error: u, isOpen: d, setIsOpen: h, hasSessionStarted: g } = t, [b, p] = F.useState(""), [w, k] = F.useState(e.height || 600), [$, j] = F.useState(!1), S = F.useRef(null), {
4121
+ enabled: o,
4122
+ staged: i,
4123
+ attachmentError: s,
4124
+ setAttachmentError: f,
4125
+ addFiles: m,
4126
+ appendStaged: y,
4127
+ removeStaged: x,
4128
+ clearStaged: A,
4129
+ maxFiles: M,
4130
+ maxBytes: C,
4131
+ allowed: E
4132
+ } = nr(e, a), K = () => e.theme === "dark" ? "dark" : e.theme === "light" ? "light" : $ ? "dark" : "light";
4133
+ F.useEffect(() => {
4134
+ if (e.theme === "auto" || !e.theme) {
4135
+ const v = () => {
4136
+ j(window.matchMedia("(prefers-color-scheme: dark)").matches);
4137
+ };
4138
+ v();
4139
+ const O = window.matchMedia("(prefers-color-scheme: dark)");
4140
+ return O.addEventListener("change", v), () => O.removeEventListener("change", v);
4141
+ } else
4142
+ j(e.theme === "dark");
4143
+ }, [e.theme]);
4144
+ const P = async () => {
4145
+ const v = b.trim();
4146
+ !v && i.length === 0 || c || (await n(v, void 0, i.length ? i : void 0), p(""), A(), setTimeout(() => {
4147
+ var O;
4148
+ (O = S.current) == null || O.focus();
4149
+ }, 100));
4150
+ }, I = (v) => {
4151
+ v.key === "Enter" && !v.shiftKey && (v.preventDefault(), P());
4152
+ }, D = (v) => {
4153
+ o && (v.preventDefault(), v.dataTransfer.dropEffect = "copy");
4154
+ }, H = async (v) => {
4155
+ if (!o) return;
4156
+ v.preventDefault();
4157
+ const O = await Ht(v.dataTransfer);
4158
+ O.length && await m(O);
4159
+ };
4160
+ return d ? /* @__PURE__ */ l.jsxs(
4161
+ Es,
4162
+ {
4163
+ $position: e.position || "bottom-right",
4164
+ "data-theme": K(),
4165
+ style: {
4166
+ height: w,
4167
+ ...e.chatWindowStyle
4168
+ },
4169
+ children: [
4170
+ e.resizable !== !1 && /* @__PURE__ */ l.jsx(
4171
+ Ms,
4172
+ {
4173
+ $position: "top",
4174
+ onMouseDown: (v) => {
4175
+ v.preventDefault();
4176
+ const O = v.clientY, R = typeof w == "number" ? w : 600, W = (q) => {
4177
+ const z = q.clientY - O, U = R - z;
4178
+ k(Math.max(200, Math.min(600, U)));
4179
+ }, N = () => {
4180
+ document.removeEventListener("mousemove", W), document.removeEventListener("mouseup", N);
4181
+ };
4182
+ document.addEventListener("mousemove", W), document.addEventListener("mouseup", N);
4183
+ }
4184
+ }
4185
+ ),
4186
+ e.showHeader !== !1 && /* @__PURE__ */ l.jsx(
4187
+ ni,
4188
+ {
4189
+ agentImage: e.agentImage,
4190
+ chatName: e.chatName,
4191
+ onClose: () => h(!1),
4192
+ primaryColor: e.primaryColor,
4193
+ showWelcomeScreen: e.quickQuestions && e.quickQuestions.length > 0 && !g
4194
+ }
4195
+ ),
4196
+ e.quickQuestions && e.quickQuestions.length > 0 && !g ? /* @__PURE__ */ l.jsx(
4197
+ rr,
4198
+ {
4199
+ config: e,
4200
+ onQuestionClick: async (v) => {
4201
+ await n(v);
4202
+ },
4203
+ onSendMessage: n,
4204
+ isLoading: c
4205
+ }
4206
+ ) : /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
4207
+ /* @__PURE__ */ l.jsx(or, { onDragOver: D, onDrop: H, children: /* @__PURE__ */ l.jsxs(ar, { children: [
4208
+ r.map((v) => /* @__PURE__ */ l.jsxs(
4209
+ "div",
4210
+ {
4211
+ style: {
4212
+ display: "flex",
4213
+ marginBottom: "16px",
4214
+ justifyContent: v.role === "user" ? "flex-end" : "flex-start",
4215
+ alignItems: "flex-start",
4216
+ gap: "8px"
4217
+ },
4218
+ children: [
4219
+ v.role === "assistant" && e.agentImage && /* @__PURE__ */ l.jsx(
4220
+ xe,
4221
+ {
4222
+ src: e.agentImage,
4223
+ alt: e.chatName || "Agent",
4224
+ $size: "28px"
4225
+ }
4226
+ ),
4227
+ /* @__PURE__ */ l.jsx(Ee, { $isUser: v.role === "user", children: v.role === "assistant" ? /* @__PURE__ */ l.jsx(Qt, { content: v.content }) : /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
4228
+ v.attachments && v.attachments.length > 0 && /* @__PURE__ */ l.jsx(Ae, { attachments: v.attachments, readOnly: !0 }),
4229
+ v.content ? v.content : null
4230
+ ] }) })
4231
+ ]
4232
+ },
4233
+ v.id
4234
+ )),
4235
+ c && /* @__PURE__ */ l.jsxs("div", { style: { display: "flex", justifyContent: "flex-start", alignItems: "flex-start", gap: "8px", marginBottom: "16px" }, children: [
4236
+ e.agentImage && /* @__PURE__ */ l.jsx(
4237
+ xe,
4238
+ {
4239
+ src: e.agentImage,
4240
+ alt: e.chatName || "Agent",
4241
+ $size: "28px"
4242
+ }
4243
+ ),
4244
+ /* @__PURE__ */ l.jsx(Ee, { $isUser: !1, children: /* @__PURE__ */ l.jsxs(er, { children: [
4245
+ /* @__PURE__ */ l.jsx("div", { className: "dot" }),
4246
+ /* @__PURE__ */ l.jsx("div", { className: "dot" }),
4247
+ /* @__PURE__ */ l.jsx("div", { className: "dot" })
4248
+ ] }) })
4249
+ ] }),
4250
+ u && /* @__PURE__ */ l.jsx(tr, { children: u })
4251
+ ] }) }),
4252
+ /* @__PURE__ */ l.jsxs(Jt, { style: { flexDirection: "column", alignItems: "stretch", gap: 0 }, children: [
4253
+ (s || o && i.length > 0) && /* @__PURE__ */ l.jsxs("div", { style: { paddingBottom: 8 }, children: [
4254
+ s && /* @__PURE__ */ l.jsx("div", { style: { fontSize: 12, color: "#dc2626", marginBottom: 4 }, children: s }),
4255
+ o && i.length > 0 && /* @__PURE__ */ l.jsx(Ae, { attachments: i, onRemove: x })
4256
+ ] }),
4257
+ /* @__PURE__ */ l.jsx("div", { style: { width: "100%" }, children: /* @__PURE__ */ l.jsxs(Vt, { children: [
4258
+ /* @__PURE__ */ l.jsx(
4259
+ ht,
4260
+ {
4261
+ ref: S,
4262
+ variant: "composer",
4263
+ value: b,
4264
+ onChange: p,
4265
+ onKeyDown: I,
4266
+ placeholder: e.placeholder,
4267
+ disabled: c
4268
+ }
4269
+ ),
4270
+ /* @__PURE__ */ l.jsxs(Zt, { children: [
4271
+ /* @__PURE__ */ l.jsx("div", { style: { display: "flex", alignItems: "center", gap: 8, flex: 1, minWidth: 0 }, children: o && /* @__PURE__ */ l.jsx(
4272
+ qt,
4273
+ {
4274
+ integrated: !0,
4275
+ disabled: c,
4276
+ maxFileBytes: C,
4277
+ maxFiles: M,
4278
+ allowedMime: E,
4279
+ currentCount: i.length,
4280
+ uploadAttachment: a,
4281
+ onUploaded: y,
4282
+ onError: f
4283
+ }
4284
+ ) }),
4285
+ /* @__PURE__ */ l.jsx(
4286
+ Xt,
4287
+ {
4288
+ type: "button",
4289
+ onClick: P,
4290
+ disabled: c || !b.trim() && i.length === 0,
4291
+ "aria-label": "Send message",
4292
+ children: /* @__PURE__ */ l.jsx(mt, { size: 13 })
4293
+ }
4294
+ )
4295
+ ] })
4296
+ ] }) })
4297
+ ] })
4298
+ ] })
4299
+ ]
4300
+ }
4301
+ ) : /* @__PURE__ */ l.jsxs(
4302
+ Ts,
4303
+ {
4304
+ onClick: () => h(!0),
4305
+ style: e.buttonStyle,
4306
+ $position: e.position || "bottom-right",
4307
+ $primaryColor: e.primaryColor,
4308
+ "aria-label": "Open chat",
4309
+ children: [
4310
+ /* @__PURE__ */ l.jsx("div", { className: "icon-container", children: /* @__PURE__ */ l.jsx(Bs, { size: 16 }) }),
4311
+ /* @__PURE__ */ l.jsx("span", { children: e.buttonText || e.chatName || "AI Chat" })
4312
+ ]
4313
+ }
4314
+ );
4315
+ }
4316
+ function di(e) {
4317
+ const t = Hn(e), r = Un(t);
4318
+ switch (t.mode) {
4319
+ case "floating":
4320
+ return /* @__PURE__ */ l.jsx(Nr, { config: t, chat: r });
4321
+ case "embedded":
4322
+ return /* @__PURE__ */ l.jsx(Qs, { config: t, chat: r });
4323
+ default:
4324
+ return /* @__PURE__ */ l.jsx(Nr, { config: t, chat: r });
4325
+ }
4326
+ }
4327
+ function ui({ config: e, chat: t }) {
4328
+ const { messages: r, sendMessage: n, uploadAttachment: a, isLoading: c, error: u, hasSessionStarted: d } = t, [h, g] = F.useState(""), b = F.useRef(null), {
4329
+ enabled: p,
4330
+ staged: w,
4331
+ attachmentError: k,
4332
+ setAttachmentError: $,
4333
+ addFiles: j,
4334
+ appendStaged: S,
4335
+ removeStaged: o,
4336
+ clearStaged: i,
4337
+ maxFiles: s,
4338
+ maxBytes: f,
4339
+ allowed: m
4340
+ } = nr(e, a), y = async () => {
4341
+ const C = h.trim();
4342
+ !C && w.length === 0 || c || (await n(C, void 0, w.length ? w : void 0), g(""), i(), setTimeout(() => {
4343
+ var E;
4344
+ (E = b.current) == null || E.focus();
4345
+ }, 100));
4346
+ }, x = (C) => {
4347
+ C.key === "Enter" && !C.shiftKey && (C.preventDefault(), y());
4348
+ }, A = (C) => {
4349
+ p && (C.preventDefault(), C.dataTransfer.dropEffect = "copy");
4350
+ }, M = async (C) => {
4351
+ if (!p) return;
4352
+ C.preventDefault();
4353
+ const E = await Ht(C.dataTransfer);
4354
+ E.length && await j(E);
4355
+ };
4356
+ return /* @__PURE__ */ l.jsx(
4357
+ In,
4358
+ {
4359
+ style: {
4360
+ height: e.height,
4361
+ display: "flex",
4362
+ flexDirection: "column",
4363
+ backgroundColor: "white",
4364
+ border: "1px solid #e5e7eb",
4365
+ borderRadius: "8px"
4366
+ },
4367
+ children: e.quickQuestions && e.quickQuestions.length > 0 && !d ? /* @__PURE__ */ l.jsx(
4368
+ rr,
4369
+ {
4370
+ config: e,
4371
+ onQuestionClick: async (C) => {
4372
+ await n(C);
4373
+ },
4374
+ onSendMessage: n,
4375
+ isLoading: c
4376
+ }
4377
+ ) : /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
4378
+ /* @__PURE__ */ l.jsx(or, { style: { flex: 1 }, onDragOver: A, onDrop: M, children: /* @__PURE__ */ l.jsxs(ar, { children: [
4379
+ r.map((C) => /* @__PURE__ */ l.jsxs(
4380
+ "div",
4381
+ {
4382
+ style: {
4383
+ display: "flex",
4384
+ marginBottom: "12px",
4385
+ justifyContent: C.role === "user" ? "flex-end" : "flex-start",
4386
+ alignItems: "flex-start",
4387
+ gap: "8px"
4388
+ },
4389
+ children: [
4390
+ C.role === "assistant" && e.agentImage && /* @__PURE__ */ l.jsx(
4391
+ xe,
4392
+ {
4393
+ src: e.agentImage,
4394
+ alt: e.chatName || "Agent",
4395
+ $size: "28px"
4396
+ }
4397
+ ),
4398
+ /* @__PURE__ */ l.jsx(Ee, { $isUser: C.role === "user", children: C.role === "assistant" ? /* @__PURE__ */ l.jsx(Qt, { content: C.content }) : /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
4399
+ C.attachments && C.attachments.length > 0 && /* @__PURE__ */ l.jsx(Ae, { attachments: C.attachments, readOnly: !0 }),
4400
+ C.content ? C.content : null
4401
+ ] }) })
4402
+ ]
4403
+ },
4404
+ C.id
4405
+ )),
4406
+ c && /* @__PURE__ */ l.jsxs("div", { style: { display: "flex", justifyContent: "flex-start", alignItems: "flex-start", gap: "8px", marginBottom: "12px" }, children: [
4407
+ e.agentImage && /* @__PURE__ */ l.jsx(
4408
+ xe,
4409
+ {
4410
+ src: e.agentImage,
4411
+ alt: e.chatName || "Agent",
4412
+ $size: "28px"
4413
+ }
4414
+ ),
4415
+ /* @__PURE__ */ l.jsx(Ee, { $isUser: !1, children: /* @__PURE__ */ l.jsxs(er, { children: [
4416
+ /* @__PURE__ */ l.jsx("div", { className: "dot" }),
4417
+ /* @__PURE__ */ l.jsx("div", { className: "dot" }),
4418
+ /* @__PURE__ */ l.jsx("div", { className: "dot" })
4419
+ ] }) })
4420
+ ] }),
4421
+ u && /* @__PURE__ */ l.jsx(tr, { children: u })
4422
+ ] }) }),
4423
+ /* @__PURE__ */ l.jsxs(Jt, { style: { flexDirection: "column", alignItems: "stretch", gap: 0 }, children: [
4424
+ (k || p && w.length > 0) && /* @__PURE__ */ l.jsxs("div", { style: { paddingBottom: 8 }, children: [
4425
+ k && /* @__PURE__ */ l.jsx("div", { style: { fontSize: 12, color: "#dc2626", marginBottom: 4 }, children: k }),
4426
+ p && w.length > 0 && /* @__PURE__ */ l.jsx(Ae, { attachments: w, onRemove: o })
4427
+ ] }),
4428
+ /* @__PURE__ */ l.jsx("div", { style: { width: "100%" }, children: /* @__PURE__ */ l.jsxs(Vt, { children: [
4429
+ /* @__PURE__ */ l.jsx(
4430
+ ht,
4431
+ {
4432
+ ref: b,
4433
+ variant: "composer",
4434
+ value: h,
4435
+ onChange: g,
4436
+ onKeyDown: x,
4437
+ placeholder: e.placeholder,
4438
+ disabled: c
4439
+ }
4440
+ ),
4441
+ /* @__PURE__ */ l.jsxs(Zt, { children: [
4442
+ /* @__PURE__ */ l.jsx("div", { style: { display: "flex", alignItems: "center", gap: 8, flex: 1, minWidth: 0 }, children: p && /* @__PURE__ */ l.jsx(
4443
+ qt,
4444
+ {
4445
+ integrated: !0,
4446
+ disabled: c,
4447
+ maxFileBytes: f,
4448
+ maxFiles: s,
4449
+ allowedMime: m,
4450
+ currentCount: w.length,
4451
+ uploadAttachment: a,
4452
+ onUploaded: S,
4453
+ onError: $
4454
+ }
4455
+ ) }),
4456
+ /* @__PURE__ */ l.jsx(
4457
+ Xt,
4458
+ {
4459
+ type: "button",
4460
+ onClick: y,
4461
+ disabled: c || !h.trim() && w.length === 0,
4462
+ "aria-label": "Send message",
4463
+ children: /* @__PURE__ */ l.jsx(mt, { size: 13 })
4464
+ }
4465
+ )
4466
+ ] })
4467
+ ] }) })
4468
+ ] })
4469
+ ] })
4470
+ }
4471
+ );
4472
+ }
4473
+ export {
4474
+ Qs as EmbeddedChat,
4475
+ Nr as FloatingChat,
4476
+ ui as InlineChat,
4477
+ Qt as MarkdownRenderer,
4478
+ Fn as OrdifyApiClient,
4479
+ di as OrdifyChat,
4480
+ ci as debounce,
4481
+ ii as formatTime,
4482
+ Ue as generateId,
4483
+ Kn as parseStreamingResponse,
4484
+ li as throttle,
4485
+ Un as useOrdifyChat,
4486
+ Hn as useOrdifyConfig,
4487
+ nr as useWidgetAttachmentStaging
4488
+ };