@zantopia/zephyr-ui 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,926 @@
1
+ import { resolveConfig as w } from "./core/config.js";
2
+ import { resolveTheme as b, themeToCSSVars as B } from "./core/themes.js";
3
+ const l = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAAsTAAALEwEAmpwYAAAdn0lEQVR4nO2dB3hUVdrHA6ggUtKTCSD2BuuqqOuyCtjX1VUUEAQLiKJSBETpOHQQFEIRCb1EwIQOUkKJ9AghQHpIZiZTMjWZ3u+95/8959yZEPzYb2E/XV33/J7nMJOBuXPvvP/zf9/3nJkQE8PhcDgcDofD4XA4HA6Hw+FwOBwOh8PhcDgcDofD4XA4HA6Hw+FwOBwOh8PhcDgczi8DlF2vQ0an65EV0yTmNwrQqwnyO12P3K7XATGNfu3z+d2AmMvfTEDZmI6Y3wjI6tXkp+fDBfAzUqy87wZx20P9pUN/muLf/2CXy2bcr/hGAzGN6Dmw+zExjYUT3Z7GmWeniMe6DUTWYzf+Wuf1uwHKGDarhJX3pePQw0DpUyLOP0ek/Of2eHK7dvw1RQAldSE5+OG85zqhsPthVL4OoushouolhA8/vlw+P+4E/6/gB1fed5+0rmMAmR2AvQ+FUP6SBG1PSBWvesX8vw3+NVICmOWjET1HseDFcZKmbwjmAYD2TQkXXw1J+X8l5GQXMbzvsUej5/fvOrffVdFHb8WMe0dj+wOQ0u8ShP4pwPY/E8nQT4SmrwTrO5CKXsusXf9oK/acyIz8Rc8L8mt4dz+SKhW+she2d0H074ukdqhI8ruDzLgD0uZOAoqfhnTokSnsObnytXCugah1SsvuycLuBxAe0V4MvJBEQj2TCDn4PFA7SIJ2gADnIEjlPc/i0JO3/9JvNiLBD+V2fUAq61mFug8B/WABrrESit4CGdEG6J8Iae6dIoqegpTz8N5f6lz+K6p+DOp0vbTqnhLsfAChj9pJ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yGSd+QsE8BROqgj5JxiKaLg1AXoqvTwOKjlg1SrDVixZCMWz1tLli/ZIK5dsVnauGY7li9cvS99avqd9DX4ws5vk0YRN2BMGDXznWmfLzDNmLIUkyfMF79dtUU8mctcgPyQc5IGn/yQcwqH957AoT3HcfpoAY4f/hHpc1eT9LmrxCUL1otrMrKxbOFa2/zZiz9oOOsRwwu9/wg3GD9iukI5ds6KKRPSJeX4dCyYu0I8sDtXPH74R3J43wkc2nucHNxznBw9mIed2fvxxbSl0txZy4TF6evJN+nrMH/WkuxpE+a2rw+8kn+W7z+FRnRTKdqSKcdMe/zzMXOPTxo3H9M+X0QyV26Wjuw/Kfyw/yShY9fmHHH29G+E2TMypEVfrcPcGV+Xz5ky7xX5UPKiDp/1/+FuQAUxcfTsPmNHzTw/dtQXmP/FSrJ+xWas+HoDpim/JrOmL8OMKYsdk8fPmaQcLG/dNmw3Of/B0OBHA6lUKm8YM3J6jxFDJm8ZMXSKafQns/wTRs+t/Hz83C/GDFdG/oMnZePotjTnd5oWKIuVi1vMmJGeolQqm0Uf4xX+fwF0AemnQe7F7f6/jka0wIs4Ai/wOBwOh8PhcDgcDofD4XA4HA6Hw+FwOBwOh8PhcDgcDofD4XA4HA6Hw+FwOBwOh8PhcDgcDofD4XA4HA6Hw+H8pvgfTgf5MG8aXiYAAAAASUVORK5CYII=";
4
+ function g(o, e) {
5
+ return !o || o === "zephyr-default" ? {
6
+ trigger: l,
7
+ header: l,
8
+ isImage: !0,
9
+ alt: "Zephyr"
10
+ } : typeof o == "string" ? {
11
+ trigger: o,
12
+ header: o,
13
+ isImage: !0,
14
+ alt: "Zephyr"
15
+ } : {
16
+ trigger: o.trigger || l,
17
+ header: o.header || l,
18
+ isImage: !0,
19
+ alt: "Zephyr"
20
+ };
21
+ }
22
+ const u = {
23
+ friendly: {
24
+ name: "Zephyr Friendly",
25
+ avatar: "",
26
+ // Will be resolved to SVG at runtime
27
+ avatarType: "svg"
28
+ },
29
+ professional: {
30
+ name: "Zephyr Pro",
31
+ avatar: "",
32
+ avatarType: "svg"
33
+ },
34
+ playful: {
35
+ name: "Zephyr Playful",
36
+ avatar: "",
37
+ avatarType: "svg"
38
+ },
39
+ futuristic: {
40
+ name: "Zephyr Futuristic",
41
+ avatar: "",
42
+ avatarType: "svg"
43
+ }
44
+ }, q = {
45
+ neutral: { eyeRx: 3, eyeRy: 3.5, mouth: "M28,42 Q32,44 36,42" },
46
+ happy: { eyeRx: 0, eyeRy: 0, mouth: "M26,42 Q32,48 38,42", eyeArc: !0 },
47
+ surprised: { eyeRx: 4, eyeRy: 5, mouth: "M28,43 Q32,47 36,43" },
48
+ thinking: { eyeRx: 3, eyeRy: 2.5, mouth: "M28,42 L36,42", dots: !0 },
49
+ helping: { eyeRx: 3, eyeRy: 3.5, mouth: "M26,42 Q32,46 38,42" },
50
+ speaking: { eyeRx: 3, eyeRy: 3.5, mouth: "M28,41 Q32,46 36,41" },
51
+ wink: { eyeRx: 3, eyeRy: 3.5, mouth: "M26,42 Q32,47 38,42", winkLeft: !0 }
52
+ };
53
+ function m(o, e, t = "neutral") {
54
+ const r = l, s = {
55
+ friendly: (i) => `
56
+ <svg viewBox="0 0 80 80" xmlns="http://www.w3.org/2000/svg">
57
+ <circle cx="40" cy="40" r="38" fill="${i}" opacity="0.12"/>
58
+ <circle cx="40" cy="40" r="35" fill="none" stroke="${i}" stroke-width="2" opacity="0.5"/>
59
+ <image href="${r}" x="8" y="8" width="64" height="64"/>
60
+ </svg>`,
61
+ professional: (i) => `
62
+ <svg viewBox="0 0 80 80" xmlns="http://www.w3.org/2000/svg">
63
+ <rect x="8" y="8" width="64" height="64" rx="18" fill="${i}" opacity="0.08"/>
64
+ <rect x="8" y="8" width="64" height="64" rx="18" fill="none" stroke="${i}" stroke-width="1.5" opacity="0.3"/>
65
+ <image href="${r}" x="10" y="10" width="60" height="60"/>
66
+ </svg>`,
67
+ playful: (i) => `
68
+ <svg viewBox="0 0 80 80" xmlns="http://www.w3.org/2000/svg">
69
+ <circle cx="40" cy="40" r="38" fill="${i}" opacity="0.1"/>
70
+ <circle cx="40" cy="40" r="34" fill="${i}" opacity="0.06"/>
71
+ <circle cx="40" cy="40" r="30" fill="${i}" opacity="0.03"/>
72
+ <circle cx="40" cy="40" r="33" fill="none" stroke="${i}" stroke-width="1" opacity="0.3"/>
73
+ <image href="${r}" x="10" y="10" width="60" height="60" opacity="0.92"/>
74
+ </svg>`,
75
+ futuristic: (i) => `
76
+ <svg viewBox="0 0 80 80" xmlns="http://www.w3.org/2000/svg">
77
+ <rect x="5" y="5" width="70" height="70" rx="16" fill="none" stroke="${i}" stroke-width="1.5" opacity="0.6"/>
78
+ <rect x="10" y="10" width="60" height="60" rx="12" fill="${i}" opacity="0.06"/>
79
+ <circle cx="40" cy="7" r="3" fill="${i}" opacity="0.8"/>
80
+ <circle cx="40" cy="73" r="2.5" fill="${i}" opacity="0.4"/>
81
+ <circle cx="7" cy="40" r="2.5" fill="${i}" opacity="0.4"/>
82
+ <circle cx="73" cy="40" r="2.5" fill="${i}" opacity="0.4"/>
83
+ <image href="${r}" x="14" y="14" width="52" height="52"/>
84
+ </svg>`
85
+ };
86
+ return (s[o] || s.friendly)(e);
87
+ }
88
+ function y(o, e) {
89
+ if (typeof o == "string") {
90
+ const t = o;
91
+ return t in u ? {
92
+ name: u[t].name,
93
+ avatar: m(t, e),
94
+ renderType: "svg-inline"
95
+ } : { name: "Custom", avatar: o, renderType: "image" };
96
+ }
97
+ if (o && typeof o == "object") {
98
+ const t = o, r = t.avatarType === "lottie" ? "lottie" : t.avatarType === "svg" ? "svg-inline" : "image";
99
+ return {
100
+ name: t.name,
101
+ avatar: t.avatar,
102
+ renderType: r
103
+ };
104
+ }
105
+ return {
106
+ name: "Zephyr Friendly",
107
+ avatar: m("friendly", e),
108
+ renderType: "svg-inline"
109
+ };
110
+ }
111
+ const k = {
112
+ open: `
113
+ @keyframes zephyr-slide-up-in {
114
+ from { opacity: 0; transform: translateY(20px) scale(0.95); }
115
+ to { opacity: 1; transform: translateY(0) scale(1); }
116
+ }`,
117
+ close: `
118
+ @keyframes zephyr-slide-up-out {
119
+ from { opacity: 1; transform: translateY(0) scale(1); }
120
+ to { opacity: 0; transform: translateY(20px) scale(0.95); }
121
+ }`
122
+ }, C = {
123
+ open: `
124
+ @keyframes zephyr-slide-down-in {
125
+ from { opacity: 0; transform: translateY(-20px) scale(0.95); }
126
+ to { opacity: 1; transform: translateY(0) scale(1); }
127
+ }`,
128
+ close: `
129
+ @keyframes zephyr-slide-down-out {
130
+ from { opacity: 1; transform: translateY(0) scale(1); }
131
+ to { opacity: 0; transform: translateY(-20px) scale(0.95); }
132
+ }`
133
+ }, D = {
134
+ open: `
135
+ @keyframes zephyr-slide-left-in {
136
+ from { opacity: 0; transform: translateX(20px) scale(0.95); }
137
+ to { opacity: 1; transform: translateX(0) scale(1); }
138
+ }`,
139
+ close: `
140
+ @keyframes zephyr-slide-left-out {
141
+ from { opacity: 1; transform: translateX(0) scale(1); }
142
+ to { opacity: 0; transform: translateX(20px) scale(0.95); }
143
+ }`
144
+ }, E = {
145
+ open: `
146
+ @keyframes zephyr-slide-right-in {
147
+ from { opacity: 0; transform: translateX(-20px) scale(0.95); }
148
+ to { opacity: 1; transform: translateX(0) scale(1); }
149
+ }`,
150
+ close: `
151
+ @keyframes zephyr-slide-right-out {
152
+ from { opacity: 1; transform: translateX(0) scale(1); }
153
+ to { opacity: 0; transform: translateX(-20px) scale(0.95); }
154
+ }`
155
+ }, I = {
156
+ open: `
157
+ @keyframes zephyr-fade-in {
158
+ from { opacity: 0; }
159
+ to { opacity: 1; }
160
+ }`,
161
+ close: `
162
+ @keyframes zephyr-fade-out {
163
+ from { opacity: 1; }
164
+ to { opacity: 0; }
165
+ }`
166
+ }, S = {
167
+ open: `
168
+ @keyframes zephyr-scale-in {
169
+ from { opacity: 0; transform: scale(0.6); }
170
+ to { opacity: 1; transform: scale(1); }
171
+ }`,
172
+ close: `
173
+ @keyframes zephyr-scale-out {
174
+ from { opacity: 1; transform: scale(1); }
175
+ to { opacity: 0; transform: scale(0.6); }
176
+ }`
177
+ }, Q = {
178
+ open: `
179
+ @keyframes zephyr-bounce-in {
180
+ 0% { opacity: 0; transform: scale(0.3); }
181
+ 50% { opacity: 1; transform: scale(1.08); }
182
+ 70% { transform: scale(0.95); }
183
+ 100% { transform: scale(1); }
184
+ }`,
185
+ close: `
186
+ @keyframes zephyr-bounce-out {
187
+ 0% { opacity: 1; transform: scale(1); }
188
+ 30% { transform: scale(1.05); }
189
+ 100% { opacity: 0; transform: scale(0.3); }
190
+ }`
191
+ }, T = { open: "", close: "" }, A = {
192
+ "slide-up": k,
193
+ "slide-down": C,
194
+ "slide-left": D,
195
+ "slide-right": E,
196
+ fade: I,
197
+ scale: S,
198
+ bounce: Q,
199
+ none: T
200
+ }, L = {
201
+ float: `
202
+ @keyframes zephyr-float {
203
+ 0%, 100% { transform: translateY(0); }
204
+ 50% { transform: translateY(-6px); }
205
+ }`,
206
+ pulse: `
207
+ @keyframes zephyr-pulse {
208
+ 0%, 100% { box-shadow: 0 0 0 0 var(--zephyr-accent); }
209
+ 50% { box-shadow: 0 0 0 10px transparent; }
210
+ }`,
211
+ bounce: `
212
+ @keyframes zephyr-trigger-bounce {
213
+ 0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
214
+ 40% { transform: translateY(-8px); }
215
+ 60% { transform: translateY(-4px); }
216
+ }`,
217
+ glow: `
218
+ @keyframes zephyr-glow {
219
+ 0%, 100% { box-shadow: 0 0 8px 0 var(--zephyr-accent); }
220
+ 50% { box-shadow: 0 0 20px 4px var(--zephyr-accent); }
221
+ }`,
222
+ none: ""
223
+ };
224
+ function x(o) {
225
+ const e = A[o] || A["slide-up"];
226
+ return `${e.open}
227
+ ${e.close}`;
228
+ }
229
+ function R(o) {
230
+ return o === "none" ? "none" : `zephyr-${o}-in`;
231
+ }
232
+ function Y(o) {
233
+ return o === "none" ? "none" : `zephyr-${o}-out`;
234
+ }
235
+ function O(o) {
236
+ return L[o] || "";
237
+ }
238
+ function z(o) {
239
+ return o === "none" ? "none" : {
240
+ float: "zephyr-float",
241
+ pulse: "zephyr-pulse",
242
+ bounce: "zephyr-trigger-bounce",
243
+ glow: "zephyr-glow"
244
+ }[o] || "none";
245
+ }
246
+ const M = `
247
+ /* ─── Root ──────────────────────────────────────────────────── */
248
+ .zephyr-root {
249
+ --zephyr-accent: #ff6b35;
250
+ --zephyr-bg: #0f0f1a;
251
+ --zephyr-surface: #1a1a2e;
252
+ --zephyr-text: #e8e8f0;
253
+ --zephyr-muted: #6b6b80;
254
+ --zephyr-border: #2a2a40;
255
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, system-ui, sans-serif;
256
+ font-size: 14px;
257
+ line-height: 1.5;
258
+ box-sizing: border-box;
259
+ color: var(--zephyr-text);
260
+ }
261
+ .zephyr-root *, .zephyr-root *::before, .zephyr-root *::after {
262
+ box-sizing: inherit;
263
+ }
264
+
265
+ /* ─── Trigger button ────────────────────────────────────────── */
266
+ .zephyr-trigger {
267
+ position: fixed;
268
+ width: 56px;
269
+ height: 56px;
270
+ border-radius: 50%;
271
+ border: 2px solid var(--zephyr-accent);
272
+ background: var(--zephyr-surface);
273
+ cursor: pointer;
274
+ display: flex;
275
+ align-items: center;
276
+ justify-content: center;
277
+ padding: 8px;
278
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
279
+ transition: transform 0.25s ease, box-shadow 0.25s ease;
280
+ outline: none;
281
+ }
282
+ .zephyr-trigger:hover {
283
+ transform: scale(1.08);
284
+ box-shadow: 0 6px 28px rgba(0, 0, 0, 0.35);
285
+ }
286
+ .zephyr-trigger:focus-visible {
287
+ outline: 2px solid var(--zephyr-accent);
288
+ outline-offset: 3px;
289
+ }
290
+ .zephyr-trigger.zephyr-sm { width: 44px; height: 44px; }
291
+ .zephyr-trigger.zephyr-lg { width: 68px; height: 68px; }
292
+ .zephyr-trigger.zephyr-open { animation: none !important; }
293
+
294
+ .zephyr-trigger-avatar {
295
+ width: 100%;
296
+ height: 100%;
297
+ display: flex;
298
+ align-items: center;
299
+ justify-content: center;
300
+ }
301
+ .zephyr-trigger-avatar svg { width: 100%; height: 100%; }
302
+ .zephyr-trigger-avatar img { width: 100%; height: 100%; object-fit: contain; border-radius: 50%; }
303
+
304
+ /* ─── Positions ─────────────────────────────────────────────── */
305
+ .zephyr-pos-br .zephyr-trigger { bottom: 24px; right: 24px; }
306
+ .zephyr-pos-bl .zephyr-trigger { bottom: 24px; left: 24px; }
307
+ .zephyr-pos-tr .zephyr-trigger { top: 24px; right: 24px; }
308
+ .zephyr-pos-tl .zephyr-trigger { top: 24px; left: 24px; }
309
+
310
+ .zephyr-pos-br .zephyr-panel { bottom: 92px; right: 24px; }
311
+ .zephyr-pos-bl .zephyr-panel { bottom: 92px; left: 24px; }
312
+ .zephyr-pos-tr .zephyr-panel { top: 92px; right: 24px; }
313
+ .zephyr-pos-tl .zephyr-panel { top: 92px; left: 24px; }
314
+
315
+ /* ─── Badge ─────────────────────────────────────────────────── */
316
+ .zephyr-badge {
317
+ position: absolute;
318
+ top: -4px;
319
+ right: -4px;
320
+ background: #ff4757;
321
+ color: #fff;
322
+ font-size: 10px;
323
+ font-weight: 700;
324
+ min-width: 18px;
325
+ height: 18px;
326
+ border-radius: 9px;
327
+ display: none;
328
+ align-items: center;
329
+ justify-content: center;
330
+ padding: 0 4px;
331
+ }
332
+ .zephyr-badge.zephyr-has-count { display: flex; }
333
+
334
+ /* ─── Backdrop ──────────────────────────────────────────────── */
335
+ .zephyr-backdrop {
336
+ position: fixed;
337
+ inset: 0;
338
+ background: rgba(0, 0, 0, 0.4);
339
+ opacity: 0;
340
+ pointer-events: none;
341
+ transition: opacity 0.3s ease;
342
+ }
343
+ .zephyr-backdrop.zephyr-visible {
344
+ opacity: 1;
345
+ pointer-events: auto;
346
+ }
347
+
348
+ /* ─── Panel ─────────────────────────────────────────────────── */
349
+ .zephyr-panel {
350
+ position: fixed;
351
+ width: var(--zephyr-panel-width, 380px);
352
+ height: var(--zephyr-panel-height, 520px);
353
+ max-height: calc(100vh - 140px);
354
+ max-width: calc(100vw - 48px);
355
+ background: var(--zephyr-bg);
356
+ border: 1px solid var(--zephyr-border);
357
+ border-radius: var(--zephyr-panel-radius, 16px);
358
+ display: flex;
359
+ flex-direction: column;
360
+ overflow: hidden;
361
+ box-shadow: 0 8px 40px rgba(0, 0, 0, 0.35);
362
+ opacity: 0;
363
+ pointer-events: none;
364
+ transform-origin: bottom right;
365
+ }
366
+ .zephyr-panel.zephyr-visible {
367
+ opacity: 1;
368
+ pointer-events: auto;
369
+ }
370
+
371
+ /* ─── Header ────────────────────────────────────────────────── */
372
+ .zephyr-header {
373
+ display: flex;
374
+ align-items: center;
375
+ gap: 12px;
376
+ padding: 14px 16px;
377
+ background: var(--zephyr-surface);
378
+ border-bottom: 1px solid var(--zephyr-border);
379
+ min-height: 56px;
380
+ }
381
+ .zephyr-header-avatar {
382
+ width: 36px;
383
+ height: 36px;
384
+ border-radius: 50%;
385
+ overflow: hidden;
386
+ flex-shrink: 0;
387
+ }
388
+ .zephyr-header-avatar svg { width: 100%; height: 100%; }
389
+ .zephyr-header-avatar img { width: 100%; height: 100%; object-fit: contain; }
390
+ .zephyr-header-info { flex: 1; min-width: 0; }
391
+ .zephyr-header-title {
392
+ font-size: 0.95rem;
393
+ font-weight: 700;
394
+ color: var(--zephyr-text);
395
+ }
396
+ .zephyr-header-sub {
397
+ font-size: 0.75rem;
398
+ color: var(--zephyr-muted);
399
+ }
400
+ .zephyr-close {
401
+ width: 32px;
402
+ height: 32px;
403
+ border: none;
404
+ background: transparent;
405
+ color: var(--zephyr-muted);
406
+ cursor: pointer;
407
+ border-radius: 8px;
408
+ font-size: 1.2rem;
409
+ display: flex;
410
+ align-items: center;
411
+ justify-content: center;
412
+ transition: background 0.2s, color 0.2s;
413
+ }
414
+ .zephyr-close:hover {
415
+ background: var(--zephyr-border);
416
+ color: var(--zephyr-text);
417
+ }
418
+
419
+ /* ─── Messages ──────────────────────────────────────────────── */
420
+ .zephyr-messages {
421
+ flex: 1;
422
+ overflow-y: auto;
423
+ padding: 16px;
424
+ display: flex;
425
+ flex-direction: column;
426
+ gap: 10px;
427
+ scroll-behavior: smooth;
428
+ }
429
+ .zephyr-messages::-webkit-scrollbar { width: 4px; }
430
+ .zephyr-messages::-webkit-scrollbar-track { background: transparent; }
431
+ .zephyr-messages::-webkit-scrollbar-thumb { background: var(--zephyr-border); border-radius: 2px; }
432
+
433
+ .zephyr-msg {
434
+ max-width: 85%;
435
+ padding: 10px 14px;
436
+ border-radius: 12px;
437
+ font-size: 0.88rem;
438
+ line-height: 1.55;
439
+ word-break: break-word;
440
+ }
441
+ .zephyr-msg a { color: var(--zephyr-accent); text-decoration: underline; }
442
+ .zephyr-msg code {
443
+ background: rgba(255, 255, 255, 0.08);
444
+ padding: 1px 5px;
445
+ border-radius: 4px;
446
+ font-size: 0.82rem;
447
+ font-family: 'Fira Code', 'Cascadia Code', monospace;
448
+ }
449
+ .zephyr-msg pre {
450
+ background: rgba(0, 0, 0, 0.3);
451
+ padding: 10px;
452
+ border-radius: 8px;
453
+ overflow-x: auto;
454
+ margin: 6px 0;
455
+ }
456
+ .zephyr-msg pre code { background: none; padding: 0; }
457
+
458
+ .zephyr-msg.zephyr-user {
459
+ align-self: flex-end;
460
+ background: var(--zephyr-user-bubble);
461
+ color: var(--zephyr-user-text);
462
+ border-bottom-right-radius: 4px;
463
+ }
464
+ .zephyr-msg.zephyr-bot {
465
+ align-self: flex-start;
466
+ background: var(--zephyr-bot-bubble, var(--zephyr-surface));
467
+ color: var(--zephyr-bot-text, var(--zephyr-text));
468
+ border-bottom-left-radius: 4px;
469
+ }
470
+ .zephyr-msg.zephyr-system {
471
+ align-self: center;
472
+ background: transparent;
473
+ color: var(--zephyr-muted);
474
+ font-size: 0.8rem;
475
+ font-style: italic;
476
+ }
477
+
478
+ /* ─── Typing indicator ──────────────────────────────────────── */
479
+ .zephyr-typing {
480
+ display: flex;
481
+ gap: 4px;
482
+ padding: 10px 14px;
483
+ align-self: flex-start;
484
+ }
485
+ .zephyr-typing span {
486
+ width: 7px;
487
+ height: 7px;
488
+ border-radius: 50%;
489
+ background: var(--zephyr-muted);
490
+ animation: zephyr-typing-dot 1.4s infinite ease-in-out;
491
+ }
492
+ .zephyr-typing span:nth-child(2) { animation-delay: 0.2s; }
493
+ .zephyr-typing span:nth-child(3) { animation-delay: 0.4s; }
494
+ @keyframes zephyr-typing-dot {
495
+ 0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
496
+ 40% { transform: scale(1); opacity: 1; }
497
+ }
498
+
499
+ /* ─── Suggestions ───────────────────────────────────────────── */
500
+ .zephyr-suggestions {
501
+ display: flex;
502
+ flex-wrap: wrap;
503
+ gap: 6px;
504
+ padding: 0 16px 8px;
505
+ }
506
+ .zephyr-suggestion {
507
+ background: var(--zephyr-surface);
508
+ border: 1px solid var(--zephyr-border);
509
+ color: var(--zephyr-accent);
510
+ padding: 5px 12px;
511
+ border-radius: 16px;
512
+ font-size: 0.78rem;
513
+ font-weight: 500;
514
+ cursor: pointer;
515
+ transition: all 0.2s;
516
+ line-height: 1.3;
517
+ }
518
+ .zephyr-suggestion:hover {
519
+ background: var(--zephyr-accent);
520
+ color: #fff;
521
+ border-color: var(--zephyr-accent);
522
+ }
523
+
524
+ /* ─── Input ─────────────────────────────────────────────────── */
525
+ .zephyr-input-wrap {
526
+ display: flex;
527
+ align-items: flex-end;
528
+ gap: 8px;
529
+ padding: 12px 16px;
530
+ border-top: 1px solid var(--zephyr-border);
531
+ background: var(--zephyr-surface);
532
+ }
533
+ .zephyr-input {
534
+ flex: 1;
535
+ background: var(--zephyr-bg);
536
+ border: 1px solid var(--zephyr-border);
537
+ color: var(--zephyr-text);
538
+ padding: 8px 12px;
539
+ border-radius: 10px;
540
+ font-size: 0.88rem;
541
+ font-family: inherit;
542
+ resize: none;
543
+ max-height: 80px;
544
+ outline: none;
545
+ transition: border-color 0.2s;
546
+ }
547
+ .zephyr-input::placeholder { color: var(--zephyr-muted); }
548
+ .zephyr-input:focus { border-color: var(--zephyr-accent); }
549
+
550
+ .zephyr-send {
551
+ width: 36px;
552
+ height: 36px;
553
+ border: none;
554
+ border-radius: 10px;
555
+ background: var(--zephyr-accent);
556
+ color: #fff;
557
+ cursor: pointer;
558
+ display: flex;
559
+ align-items: center;
560
+ justify-content: center;
561
+ font-size: 1rem;
562
+ flex-shrink: 0;
563
+ transition: background 0.2s, transform 0.15s;
564
+ }
565
+ .zephyr-send:hover { filter: brightness(1.1); transform: scale(1.05); }
566
+ .zephyr-send:active { transform: scale(0.95); }
567
+
568
+ /* ─── Responsive ────────────────────────────────────────────── */
569
+ @media (max-width: 480px) {
570
+ .zephyr-panel {
571
+ width: calc(100vw - 16px) !important;
572
+ height: calc(100vh - 80px) !important;
573
+ max-height: none;
574
+ bottom: 8px !important;
575
+ right: 8px !important;
576
+ left: 8px !important;
577
+ border-radius: 12px !important;
578
+ }
579
+ }
580
+ `;
581
+ let v = !1;
582
+ function N(o, e) {
583
+ if (typeof document > "u" || v) return;
584
+ const t = document.createElement("style");
585
+ t.id = "zephyr-styles", t.textContent = M + (e || "") + (o || ""), document.head.appendChild(t), v = !0;
586
+ }
587
+ function P(o) {
588
+ if (typeof document > "u") return;
589
+ let e = document.getElementById("zephyr-extra-styles");
590
+ e || (e = document.createElement("style"), e.id = "zephyr-extra-styles", document.head.appendChild(e)), e.textContent = o;
591
+ }
592
+ class F {
593
+ constructor(e) {
594
+ this.ws = null, this.sessionId = "", this.reconnectAttempts = 0, this.reconnectTimer = null, this.destroyed = !1, this.options = {
595
+ reconnectDelay: 3e3,
596
+ maxReconnectAttempts: 10,
597
+ onError: () => {
598
+ },
599
+ onConnect: () => {
600
+ },
601
+ onDisconnect: () => {
602
+ },
603
+ apiKey: "",
604
+ sessionId: "",
605
+ ...e
606
+ }, e.sessionId && (this.sessionId = e.sessionId);
607
+ }
608
+ /** Connect to the WebSocket server */
609
+ connect() {
610
+ if (this.destroyed) return;
611
+ if (!this.options.server) {
612
+ console.warn("[Zephyr] No server URL configured.");
613
+ return;
614
+ }
615
+ const e = this.options.server.replace(/\/$/, ""), t = e.startsWith("https") ? "wss:" : "ws:", r = e.replace(/^https?:\/\//, ""), s = new URLSearchParams();
616
+ this.sessionId && s.set("session_id", this.sessionId), this.options.apiKey && s.set("api_key", this.options.apiKey);
617
+ const i = `${t}//${r}/ws/chat?${s.toString()}`;
618
+ try {
619
+ this.ws = new WebSocket(i);
620
+ } catch (n) {
621
+ this.options.onError(n), this.scheduleReconnect();
622
+ return;
623
+ }
624
+ this.ws.onopen = () => {
625
+ this.reconnectAttempts = 0, this.options.onConnect();
626
+ }, this.ws.onmessage = (n) => {
627
+ try {
628
+ const a = JSON.parse(n.data);
629
+ a.session_id && (this.sessionId = a.session_id), this.options.onMessage(a);
630
+ } catch {
631
+ }
632
+ }, this.ws.onclose = () => {
633
+ this.options.onDisconnect(), this.scheduleReconnect();
634
+ }, this.ws.onerror = (n) => {
635
+ this.options.onError(n);
636
+ };
637
+ }
638
+ /** Send a chat message */
639
+ send(e, t) {
640
+ !this.ws || this.ws.readyState !== WebSocket.OPEN || this.ws.send(
641
+ JSON.stringify({
642
+ message: e,
643
+ session_id: this.sessionId,
644
+ ...t
645
+ })
646
+ );
647
+ }
648
+ /** Get current session ID */
649
+ getSessionId() {
650
+ return this.sessionId;
651
+ }
652
+ /** Check if connected */
653
+ isConnected() {
654
+ var e;
655
+ return ((e = this.ws) == null ? void 0 : e.readyState) === WebSocket.OPEN;
656
+ }
657
+ /** Disconnect and cleanup */
658
+ destroy() {
659
+ this.destroyed = !0, this.reconnectTimer && (clearTimeout(this.reconnectTimer), this.reconnectTimer = null), this.ws && (this.ws.onclose = null, this.ws.onerror = null, this.ws.close(), this.ws = null);
660
+ }
661
+ scheduleReconnect() {
662
+ this.destroyed || this.reconnectAttempts >= this.options.maxReconnectAttempts || (this.reconnectAttempts++, this.reconnectTimer = setTimeout(
663
+ () => this.connect(),
664
+ this.options.reconnectDelay
665
+ ));
666
+ }
667
+ }
668
+ class j {
669
+ constructor(e, t = {}) {
670
+ this.el = null, this.wsClient = null, this.isOpen = !1, this.messages = [], this.mounted = !1, this.config = w(e), this.events = t, this.logo = g(this.config.logo, this.config.accentColor), this.persona = y(this.config.persona, this.config.accentColor);
671
+ }
672
+ // ─── Lifecycle ────────────────────────────────────────────
673
+ /** Mount the widget to the DOM */
674
+ mount(e) {
675
+ var s, i;
676
+ if (this.mounted) return;
677
+ const t = [
678
+ x(this.config.openAnimation),
679
+ O(this.config.triggerAnimation)
680
+ ].join(`
681
+ `);
682
+ N(this.config.customCSS, t), this.el = document.createElement("div"), this.el.className = `zephyr-root ${this.positionClass()}`, this.el.setAttribute("data-zephyr", ""), this.applyThemeVars(), this.applyPanelVars(), this.el.innerHTML = this.renderHTML();
683
+ const r = typeof e == "string" ? document.querySelector(e) : e || document.body;
684
+ r == null || r.appendChild(this.el), this.bindEvents(), this.connectWS(), this.config.startOpen && requestAnimationFrame(() => this.open()), this.mounted = !0, (i = (s = this.events).onReady) == null || i.call(s);
685
+ }
686
+ /** Destroy the widget and clean up */
687
+ destroy() {
688
+ var e, t;
689
+ (e = this.wsClient) == null || e.destroy(), (t = this.el) == null || t.remove(), this.el = null, this.mounted = !1;
690
+ }
691
+ // ─── Public API ───────────────────────────────────────────
692
+ open() {
693
+ this.setOpenState(!0);
694
+ }
695
+ close() {
696
+ this.setOpenState(!1);
697
+ }
698
+ toggle() {
699
+ this.setOpenState(!this.isOpen);
700
+ }
701
+ /** Send a message programmatically */
702
+ send(e) {
703
+ var t;
704
+ e.trim() && (this.addMessage("user", e), (t = this.wsClient) == null || t.send(e));
705
+ }
706
+ /** Change theme at runtime */
707
+ setTheme(e) {
708
+ this.config = { ...this.config, theme: e || "dark" }, this.applyThemeVars();
709
+ }
710
+ /** Change logo at runtime */
711
+ setLogo(e) {
712
+ this.config = { ...this.config, logo: e }, this.logo = g(e, this.config.accentColor), this.updateAvatars();
713
+ }
714
+ /** Change persona at runtime */
715
+ setPersona(e) {
716
+ this.config = { ...this.config, persona: e }, this.persona = y(e, this.config.accentColor), this.updateChatAvatar();
717
+ }
718
+ /** Change accent color at runtime */
719
+ setAccentColor(e) {
720
+ var t;
721
+ this.config = { ...this.config, accentColor: e }, this.logo = g(this.config.logo), this.persona = y(this.config.persona, e), (t = this.el) == null || t.style.setProperty("--zephyr-accent", e), this.updateAvatars(), this.updateChatAvatar();
722
+ }
723
+ /** Change open animation */
724
+ setOpenAnimation(e) {
725
+ this.config = { ...this.config, openAnimation: e };
726
+ const t = x(e);
727
+ P(t);
728
+ }
729
+ /** Change trigger animation */
730
+ setTriggerAnimation(e) {
731
+ var r;
732
+ this.config = { ...this.config, triggerAnimation: e };
733
+ const t = (r = this.el) == null ? void 0 : r.querySelector(".zephyr-trigger");
734
+ if (t) {
735
+ const s = z(e);
736
+ t.style.animation = s === "none" ? "none" : `${s} 3s ease-in-out infinite`;
737
+ }
738
+ }
739
+ /** Get message history */
740
+ getMessages() {
741
+ return [...this.messages];
742
+ }
743
+ /** Check if panel is open */
744
+ getIsOpen() {
745
+ return this.isOpen;
746
+ }
747
+ // ─── Private: Rendering ───────────────────────────────────
748
+ renderHTML() {
749
+ const e = `zephyr-${this.config.panel.size || "md"}`, t = z(this.config.triggerAnimation), r = t === "none" ? "" : `animation: ${t} 3s ease-in-out infinite;`, s = this.config.placeholder || (this.config.language === "fr" ? "Posez une question..." : "Ask a question..."), i = `<img src="${this.escapeAttr(this.logo.trigger)}" alt="${this.escapeAttr(this.logo.alt)}" />`, n = `<img src="${this.escapeAttr(this.logo.header)}" alt="${this.escapeAttr(this.logo.alt)}" />`;
750
+ return `
751
+ ${this.config.panel.backdrop ? '<div class="zephyr-backdrop"></div>' : ""}
752
+ <button class="zephyr-trigger ${e}" style="${r}" aria-label="Zephyr Assistant">
753
+ <div class="zephyr-trigger-avatar">${i}</div>
754
+ ${this.config.showBadge ? '<div class="zephyr-badge"></div>' : ""}
755
+ </button>
756
+ <div class="zephyr-panel">
757
+ <div class="zephyr-header">
758
+ <div class="zephyr-header-avatar">${n}</div>
759
+ <div class="zephyr-header-info">
760
+ <div class="zephyr-header-title">Zephyr</div>
761
+ <div class="zephyr-header-sub">${this.config.language === "fr" ? "Assistant Navigation" : "Navigation Assistant"}</div>
762
+ </div>
763
+ <button class="zephyr-close" aria-label="${this.config.language === "fr" ? "Fermer" : "Close"}">✕</button>
764
+ </div>
765
+ <div class="zephyr-messages"></div>
766
+ <div class="zephyr-suggestions"></div>
767
+ <div class="zephyr-input-wrap">
768
+ <textarea class="zephyr-input" rows="1" placeholder="${this.escapeAttr(s)}"></textarea>
769
+ <button class="zephyr-send" aria-label="${this.config.language === "fr" ? "Envoyer" : "Send"}">
770
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
771
+ <path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"/>
772
+ </svg>
773
+ </button>
774
+ </div>
775
+ </div>
776
+ `;
777
+ }
778
+ bindEvents() {
779
+ if (!this.el) return;
780
+ const e = this.el.querySelector(".zephyr-trigger"), t = this.el.querySelector(".zephyr-close"), r = this.el.querySelector(".zephyr-input"), s = this.el.querySelector(".zephyr-send"), i = this.el.querySelector(".zephyr-backdrop");
781
+ e.addEventListener("click", () => this.toggle()), t.addEventListener("click", () => this.close()), i == null || i.addEventListener("click", () => this.close()), s.addEventListener("click", () => {
782
+ this.send(r.value), r.value = "", r.style.height = "auto";
783
+ }), r.addEventListener("keydown", (n) => {
784
+ n.key === "Enter" && !n.shiftKey && (n.preventDefault(), this.send(r.value), r.value = "", r.style.height = "auto");
785
+ }), r.addEventListener("input", () => {
786
+ r.style.height = "auto", r.style.height = Math.min(r.scrollHeight, 80) + "px";
787
+ });
788
+ }
789
+ // ─── Private: State ───────────────────────────────────────
790
+ setOpenState(e) {
791
+ var i, n, a, p, h;
792
+ if (this.isOpen === e) return;
793
+ this.isOpen = e;
794
+ const t = (i = this.el) == null ? void 0 : i.querySelector(".zephyr-panel"), r = (n = this.el) == null ? void 0 : n.querySelector(".zephyr-trigger"), s = (a = this.el) == null ? void 0 : a.querySelector(".zephyr-backdrop");
795
+ if (t) {
796
+ if (e) {
797
+ t.classList.add("zephyr-visible");
798
+ const c = R(this.config.openAnimation);
799
+ c !== "none" && (t.style.animation = `${c} 0.3s ease-out forwards`), r == null || r.classList.add("zephyr-open"), s == null || s.classList.add("zephyr-visible"), setTimeout(() => {
800
+ var d, f;
801
+ (f = (d = this.el) == null ? void 0 : d.querySelector(".zephyr-input")) == null || f.focus();
802
+ }, 200);
803
+ } else {
804
+ const c = Y(this.config.openAnimation);
805
+ c !== "none" ? (t.style.animation = `${c} 0.2s ease-in forwards`, t.addEventListener("animationend", () => {
806
+ t.classList.remove("zephyr-visible"), t.style.animation = "";
807
+ }, { once: !0 })) : t.classList.remove("zephyr-visible"), r == null || r.classList.remove("zephyr-open"), s == null || s.classList.remove("zephyr-visible");
808
+ }
809
+ (h = (p = this.events).onToggle) == null || h.call(p, e);
810
+ }
811
+ }
812
+ // ─── Private: Messages ────────────────────────────────────
813
+ addMessage(e, t, r) {
814
+ var a, p, h;
815
+ const s = { role: e, text: t, expression: r, timestamp: Date.now() };
816
+ this.messages.push(s);
817
+ const i = (a = this.el) == null ? void 0 : a.querySelector(".zephyr-messages");
818
+ if (!i) return;
819
+ const n = document.createElement("div");
820
+ n.className = `zephyr-msg zephyr-${e}`, n.innerHTML = this.renderMarkdown(t), i.appendChild(n), i.scrollTop = i.scrollHeight, (h = (p = this.events).onMessage) == null || h.call(p, s);
821
+ }
822
+ showTyping() {
823
+ var r;
824
+ const e = (r = this.el) == null ? void 0 : r.querySelector(".zephyr-messages");
825
+ if (!e || e.querySelector(".zephyr-typing")) return;
826
+ const t = document.createElement("div");
827
+ t.className = "zephyr-typing", t.innerHTML = "<span></span><span></span><span></span>", e.appendChild(t), e.scrollTop = e.scrollHeight;
828
+ }
829
+ hideTyping() {
830
+ var e, t;
831
+ (t = (e = this.el) == null ? void 0 : e.querySelector(".zephyr-typing")) == null || t.remove();
832
+ }
833
+ showSuggestions(e) {
834
+ var r;
835
+ const t = (r = this.el) == null ? void 0 : r.querySelector(".zephyr-suggestions");
836
+ t && (t.innerHTML = e.map((s) => `<button class="zephyr-suggestion">${this.escapeHTML(s)}</button>`).join(""), t.querySelectorAll(".zephyr-suggestion").forEach((s) => {
837
+ s.addEventListener("click", () => {
838
+ this.send(s.textContent || ""), t.innerHTML = "";
839
+ });
840
+ }));
841
+ }
842
+ // ─── Private: Theme & Avatars ─────────────────────────────
843
+ applyThemeVars() {
844
+ if (!this.el) return;
845
+ const e = b(this.config.theme), t = B(e, this.config.accentColor);
846
+ for (const [r, s] of Object.entries(t))
847
+ this.el.style.setProperty(r, s);
848
+ }
849
+ applyPanelVars() {
850
+ if (!this.el) return;
851
+ const e = this.config.panel;
852
+ this.el.style.setProperty("--zephyr-panel-width", `${e.width}px`), this.el.style.setProperty("--zephyr-panel-height", `${e.height}px`), this.el.style.setProperty("--zephyr-panel-radius", `${e.borderRadius}px`), this.el.style.setProperty("z-index", String(e.zIndex));
853
+ }
854
+ positionClass() {
855
+ return {
856
+ "bottom-right": "zephyr-pos-br",
857
+ "bottom-left": "zephyr-pos-bl",
858
+ "top-right": "zephyr-pos-tr",
859
+ "top-left": "zephyr-pos-tl"
860
+ }[this.config.panel.position] || "zephyr-pos-br";
861
+ }
862
+ updateAvatars() {
863
+ if (!this.el) return;
864
+ const e = `<img src="${this.escapeAttr(this.logo.trigger)}" alt="${this.escapeAttr(this.logo.alt)}" />`, t = `<img src="${this.escapeAttr(this.logo.header)}" alt="${this.escapeAttr(this.logo.alt)}" />`, r = this.el.querySelector(".zephyr-trigger-avatar"), s = this.el.querySelector(".zephyr-header-avatar");
865
+ r && (r.innerHTML = e), s && (s.innerHTML = t);
866
+ }
867
+ updateChatAvatar() {
868
+ var t;
869
+ const e = (t = this.el) == null ? void 0 : t.querySelector(".zephyr-header-avatar");
870
+ e && (this.persona.renderType === "svg-inline" ? e.innerHTML = this.persona.avatar : e.innerHTML = `<img src="${this.escapeAttr(this.persona.avatar)}" alt="${this.escapeAttr(this.persona.name)}" />`);
871
+ }
872
+ // ─── Private: WebSocket ───────────────────────────────────
873
+ connectWS() {
874
+ this.wsClient = new F({
875
+ server: this.config.server,
876
+ apiKey: this.config.apiKey,
877
+ onMessage: (e) => this.handleWSMessage(e),
878
+ onError: (e) => {
879
+ var t, r;
880
+ (r = (t = this.events).onError) == null || r.call(t, { message: e instanceof Error ? e.message : "WebSocket error" });
881
+ }
882
+ }), this.wsClient.connect();
883
+ }
884
+ handleWSMessage(e) {
885
+ var t, r, s;
886
+ switch (e.type) {
887
+ case "welcome":
888
+ this.addMessage("bot", this.config.greeting || e.message || "Bonjour !", e.expression);
889
+ break;
890
+ case "status":
891
+ this.showTyping();
892
+ break;
893
+ case "response":
894
+ this.hideTyping(), this.addMessage("bot", e.message || "", e.expression), (t = e.suggestions) != null && t.length && this.showSuggestions(e.suggestions);
895
+ break;
896
+ case "error":
897
+ this.hideTyping(), this.addMessage("system", e.message || "Erreur", "surprised"), (s = (r = this.events).onError) == null || s.call(r, { message: e.message || "Error" });
898
+ break;
899
+ }
900
+ }
901
+ // ─── Private: Utilities ───────────────────────────────────
902
+ renderMarkdown(e) {
903
+ if (!e) return "";
904
+ let t = this.escapeHTML(e);
905
+ return t = t.replace(/```(\w*)\n([\s\S]*?)```/g, "<pre><code>$2</code></pre>"), t = t.replace(/`([^`]+)`/g, "<code>$1</code>"), t = t.replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>"), t = t.replace(/\*(.+?)\*/g, "<em>$1</em>"), t = t.replace(/^[-•] (.+)$/gm, "<li>$1</li>"), t = t.replace(/(<li>.*<\/li>\n?)+/g, "<ul>$&</ul>"), t = t.replace(/\n/g, "<br>"), t;
906
+ }
907
+ escapeHTML(e) {
908
+ const t = document.createElement("div");
909
+ return t.textContent = e, t.innerHTML;
910
+ }
911
+ escapeAttr(e) {
912
+ return e.replace(/"/g, "&quot;").replace(/'/g, "&#39;");
913
+ }
914
+ }
915
+ export {
916
+ q as E,
917
+ j as Z,
918
+ x as a,
919
+ R as b,
920
+ O as c,
921
+ z as d,
922
+ y as e,
923
+ m as g,
924
+ g as r
925
+ };
926
+ //# sourceMappingURL=widget-BjgCJR9K.js.map