emanate-ai-chat-lib 0.1.1

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,985 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, Component, EventEmitter, Input, Output, NgModule } from '@angular/core';
3
+ import * as i3 from '@angular/common';
4
+ import { CommonModule } from '@angular/common';
5
+ import * as i4 from '@angular/forms';
6
+ import { FormsModule } from '@angular/forms';
7
+ import * as i1 from '@angular/common/http';
8
+ import { HttpHeaders, HttpClientModule } from '@angular/common/http';
9
+ import { throwError, Observable, Subject } from 'rxjs';
10
+ import { timeout, catchError, takeUntil } from 'rxjs/operators';
11
+ import * as i2 from '@angular/platform-browser';
12
+
13
+ class EmanateAiChatLibService {
14
+ constructor() { }
15
+ }
16
+ EmanateAiChatLibService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: EmanateAiChatLibService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
17
+ EmanateAiChatLibService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: EmanateAiChatLibService, providedIn: 'root' });
18
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: EmanateAiChatLibService, decorators: [{
19
+ type: Injectable,
20
+ args: [{
21
+ providedIn: 'root'
22
+ }]
23
+ }], ctorParameters: function () { return []; } });
24
+
25
+ class EmanateAiChatLibComponent {
26
+ constructor() { }
27
+ ngOnInit() {
28
+ }
29
+ }
30
+ EmanateAiChatLibComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: EmanateAiChatLibComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
31
+ EmanateAiChatLibComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: EmanateAiChatLibComponent, selector: "lib-emanate-ai-chat-lib", ngImport: i0, template: `
32
+ <p>
33
+ Emanate AI Chat Library v1.0.0 - Use lib-ai-chat component directly
34
+ </p>
35
+ `, isInline: true });
36
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: EmanateAiChatLibComponent, decorators: [{
37
+ type: Component,
38
+ args: [{
39
+ selector: 'lib-emanate-ai-chat-lib',
40
+ template: `
41
+ <p>
42
+ Emanate AI Chat Library v1.0.0 - Use lib-ai-chat component directly
43
+ </p>
44
+ `,
45
+ styles: []
46
+ }]
47
+ }], ctorParameters: function () { return []; } });
48
+
49
+ /**
50
+ * Icon configuration interfaces for the chat component
51
+ */
52
+ /**
53
+ * Feather Icons - Default icon set
54
+ * Clean, minimal, professional
55
+ */
56
+ const FEATHER_ICONS = {
57
+ compactView: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="5" y="2" width="14" height="20" rx="2" ry="2"></rect></svg>',
58
+ defaultView: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="3" width="20" height="14" rx="2" ry="2"></rect><line x1="8" y1="21" x2="16" y2="21"></line><line x1="12" y1="17" x2="12" y2="21"></line></svg>',
59
+ expandedView: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="2" width="20" height="20" rx="2.18" ry="2.18"></rect><line x1="7" y1="2" x2="7" y2="22"></line><line x1="17" y1="2" x2="17" y2="22"></line><line x1="2" y1="12" x2="22" y2="12"></line><line x1="2" y1="7" x2="7" y2="7"></line><line x1="2" y1="17" x2="7" y2="17"></line><line x1="17" y1="17" x2="22" y2="17"></line><line x1="17" y1="7" x2="22" y2="7"></line></svg>',
60
+ send: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="22" y1="2" x2="11" y2="13"></line><polygon points="22 2 15 22 11 13 2 9 22 2"></polygon></svg>',
61
+ sendLoading: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="2" x2="12" y2="6"></line><line x1="12" y1="18" x2="12" y2="22"></line><line x1="4.93" y1="4.93" x2="7.76" y2="7.76"></line><line x1="16.24" y1="16.24" x2="19.07" y2="19.07"></line><line x1="2" y1="12" x2="6" y2="12"></line><line x1="18" y1="12" x2="22" y2="12"></line><line x1="4.93" y1="19.07" x2="7.76" y2="16.24"></line><line x1="16.24" y1="7.76" x2="19.07" y2="4.93"></line></svg>',
62
+ userAvatar: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path><circle cx="12" cy="7" r="4"></circle></svg>',
63
+ aiAvatar: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="7" width="20" height="14" rx="2" ry="2"></rect><path d="M16 21V5a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16"></path></svg>',
64
+ loadingAvatar: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="2" x2="12" y2="6"></line><line x1="12" y1="18" x2="12" y2="22"></line><line x1="4.93" y1="4.93" x2="7.76" y2="7.76"></line><line x1="16.24" y1="16.24" x2="19.07" y2="19.07"></line><line x1="2" y1="12" x2="6" y2="12"></line><line x1="18" y1="12" x2="22" y2="12"></line><line x1="4.93" y1="19.07" x2="7.76" y2="16.24"></line><line x1="16.24" y1="7.76" x2="19.07" y2="4.93"></line></svg>',
65
+ imageUpload: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg>',
66
+ fileUpload: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"></path></svg>'
67
+ };
68
+ /**
69
+ * Material Icons - Google's Material Design
70
+ * Rounded, friendly, modern
71
+ */
72
+ const MATERIAL_ICONS = {
73
+ compactView: '<svg viewBox="0 0 24 24" fill="currentColor"><path d="M17 19H7V5h10m0-2H7c-1.11 0-2 .89-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2z"/></svg>',
74
+ defaultView: '<svg viewBox="0 0 24 24" fill="currentColor"><path d="M21 2H3c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h7v2H8v2h8v-2h-2v-2h7c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H3V4h18v12z"/></svg>',
75
+ expandedView: '<svg viewBox="0 0 24 24" fill="currentColor"><path d="M3 5v4h2V5h4V3H5c-1.1 0-2 .9-2 2zm2 10H3v4c0 1.1.9 2 2 2h4v-2H5v-4zm14 4h-4v2h4c1.1 0 2-.9 2-2v-4h-2v4zm0-16h-4v2h4v4h2V5c0-1.1-.9-2-2-2z"/></svg>',
76
+ send: '<svg viewBox="0 0 24 24" fill="currentColor"><path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"/></svg>',
77
+ sendLoading: '<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z"/></svg>',
78
+ userAvatar: '<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/></svg>',
79
+ aiAvatar: '<svg viewBox="0 0 24 24" fill="currentColor"><path d="M20 9V7c0-1.1-.9-2-2-2h-3c0-1.66-1.34-3-3-3S9 3.34 9 5H6c-1.1 0-2 .9-2 2v2c-1.66 0-3 1.34-3 3s1.34 3 3 3v4c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-4c1.66 0 3-1.34 3-3s-1.34-3-3-3zM6 19V7h12v12H6zm3-6c-.83 0-1.5-.67-1.5-1.5S8.17 10 9 10s1.5.67 1.5 1.5S9.83 13 9 13zm7.5-1.5c0 .83-.67 1.5-1.5 1.5s-1.5-.67-1.5-1.5.67-1.5 1.5-1.5 1.5.67 1.5 1.5zM8 15h8v2H8v-2z"/></svg>',
80
+ loadingAvatar: '<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z"/></svg>',
81
+ imageUpload: '<svg viewBox="0 0 24 24" fill="currentColor"><path d="M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"/></svg>',
82
+ fileUpload: '<svg viewBox="0 0 24 24" fill="currentColor"><path d="M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5a2.5 2.5 0 0 1 5 0v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5a2.5 2.5 0 0 0 5 0V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z"/></svg>'
83
+ };
84
+ /**
85
+ * Heroicons - By Tailwind CSS team
86
+ * Bold, clear, professional
87
+ */
88
+ const HEROICONS = {
89
+ compactView: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="5" y="2" width="14" height="20" rx="2" ry="2"></rect><path d="M9 22V12h6v10"></path></svg>',
90
+ defaultView: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="3" width="20" height="14" rx="2" ry="2"></rect><line x1="8" y1="21" x2="16" y2="21"></line><line x1="12" y1="17" x2="12" y2="21"></line></svg>',
91
+ expandedView: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><line x1="3" y1="9" x2="21" y2="9"></line><line x1="9" y1="21" x2="9" y2="9"></line></svg>',
92
+ send: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="22" y1="2" x2="11" y2="13"></line><polygon points="22 2 15 22 11 13 2 9 22 2"></polygon></svg>',
93
+ sendLoading: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a9 9 0 1 1-6.219-8.56"></path></svg>',
94
+ userAvatar: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path><circle cx="12" cy="7" r="4"></circle></svg>',
95
+ aiAvatar: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 8V4H8"></path><rect x="2" y="8" width="20" height="12" rx="2" ry="2"></rect><circle cx="8" cy="14" r="2"></circle><circle cx="16" cy="14" r="2"></circle></svg>',
96
+ loadingAvatar: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a9 9 0 1 1-6.219-8.56"></path></svg>',
97
+ imageUpload: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg>',
98
+ fileUpload: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"></path><polyline points="13 2 13 9 20 9"></polyline></svg>'
99
+ };
100
+ /**
101
+ * Lucide Icons - Community-driven Feather fork
102
+ * Similar to Feather but more extensive
103
+ */
104
+ const LUCIDE_ICONS = {
105
+ compactView: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="20" x="5" y="2" rx="2" ry="2"></rect><path d="M12.667 8 10 12h4l-2.667 4"></path></svg>',
106
+ defaultView: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="20" height="14" x="2" y="3" rx="2"></rect><line x1="8" x2="16" y1="21" y2="21"></line><line x1="12" x2="12" y1="17" y2="21"></line></svg>',
107
+ expandedView: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="18" height="18" x="3" y="3" rx="2"></rect><path d="M9 3v18"></path><path d="M15 3v18"></path><path d="M3 9h18"></path><path d="M3 15h18"></path></svg>',
108
+ send: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m22 2-7 20-4-9-9-4Z"></path><path d="M22 2 11 13"></path></svg>',
109
+ sendLoading: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a9 9 0 1 1-6.219-8.56"></path></svg>',
110
+ userAvatar: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="8" r="5"></circle><path d="M20 21a8 8 0 1 0-16 0"></path></svg>',
111
+ aiAvatar: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 8V4H8"></path><rect width="16" height="12" x="4" y="8" rx="2"></rect><path d="M2 14h2"></path><path d="M20 14h2"></path><path d="M15 13v2"></path><path d="M9 13v2"></path></svg>',
112
+ loadingAvatar: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a9 9 0 1 1-6.219-8.56"></path></svg>',
113
+ imageUpload: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"></rect><circle cx="9" cy="9" r="2"></circle><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"></path></svg>',
114
+ fileUpload: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"></path><polyline points="14 2 14 8 20 8"></polyline></svg>'
115
+ };
116
+ /**
117
+ * Bootstrap Icons - Clean and versatile
118
+ * Familiar, simple, widely used
119
+ */
120
+ const BOOTSTRAP_ICONS = {
121
+ compactView: '<svg viewBox="0 0 16 16" fill="currentColor"><path d="M11 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h6zM5 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H5z"/><path d="M8 14a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"/></svg>',
122
+ defaultView: '<svg viewBox="0 0 16 16" fill="currentColor"><path d="M0 1.5A.5.5 0 0 1 .5 1H2a.5.5 0 0 1 .485.379L2.89 3H14.5a.5.5 0 0 1 .49.598l-1 5a.5.5 0 0 1-.465.401l-9.397.472L4.415 11H13a.5.5 0 0 1 0 1H4a.5.5 0 0 1-.491-.408L2.01 3.607 1.61 2H.5a.5.5 0 0 1-.5-.5zM3.102 4l.84 4.479 9.144-.459L13.89 4H3.102zM5 12a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm7 0a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm-7 1a1 1 0 1 1 0 2 1 1 0 0 1 0-2zm7 0a1 1 0 1 1 0 2 1 1 0 0 1 0-2z"/></svg>',
123
+ expandedView: '<svg viewBox="0 0 16 16" fill="currentColor"><path d="M0 2.5A.5.5 0 0 1 .5 2H2a.5.5 0 0 1 .485.379L2.89 4H14.5a.5.5 0 0 1 .485.621l-1.5 6A.5.5 0 0 1 13 11H4a.5.5 0 0 1-.485-.379L1.61 3H.5a.5.5 0 0 1-.5-.5zM3.14 5l1.25 5h8.22l1.25-5H3.14zM5 13a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm-2 1a2 2 0 1 1 4 0 2 2 0 0 1-4 0zm9-1a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm-2 1a2 2 0 1 1 4 0 2 2 0 0 1-4 0z"/></svg>',
124
+ send: '<svg viewBox="0 0 16 16" fill="currentColor"><path d="M15.854.146a.5.5 0 0 1 .11.54l-5.819 14.547a.75.75 0 0 1-1.329.124l-3.178-4.995L.643 7.184a.75.75 0 0 1 .124-1.33L15.314.037a.5.5 0 0 1 .54.11ZM6.636 10.07l2.761 4.338L14.13 2.576 6.636 10.07Zm6.787-8.201L1.591 6.602l4.339 2.76 7.494-7.493Z"/></svg>',
125
+ sendLoading: '<svg viewBox="0 0 16 16" fill="currentColor"><path d="M11.534 7h3.932a.25.25 0 0 1 .192.41l-1.966 2.36a.25.25 0 0 1-.384 0l-1.966-2.36a.25.25 0 0 1 .192-.41zm-11 2h3.932a.25.25 0 0 0 .192-.41L2.692 6.23a.25.25 0 0 0-.384 0L.342 8.59A.25.25 0 0 0 .534 9z"/><path fill-rule="evenodd" d="M8 3c-1.552 0-2.94.707-3.857 1.818a.5.5 0 1 1-.771-.636A6.002 6.002 0 0 1 13.917 7H12.9A5.002 5.002 0 0 0 8 3zM3.1 9a5.002 5.002 0 0 0 8.757 2.182.5.5 0 1 1 .771.636A6.002 6.002 0 0 1 2.083 9H3.1z"/></svg>',
126
+ userAvatar: '<svg viewBox="0 0 16 16" fill="currentColor"><path d="M11 6a3 3 0 1 1-6 0 3 3 0 0 1 6 0z"/><path fill-rule="evenodd" d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8zm8-7a7 7 0 0 0-5.468 11.37C3.242 11.226 4.805 10 8 10s4.757 1.225 5.468 2.37A7 7 0 0 0 8 1z"/></svg>',
127
+ aiAvatar: '<svg viewBox="0 0 16 16" fill="currentColor"><path d="M6 10.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"/></svg>',
128
+ loadingAvatar: '<svg viewBox="0 0 16 16" fill="currentColor"><path d="M11.534 7h3.932a.25.25 0 0 1 .192.41l-1.966 2.36a.25.25 0 0 1-.384 0l-1.966-2.36a.25.25 0 0 1 .192-.41zm-11 2h3.932a.25.25 0 0 0 .192-.41L2.692 6.23a.25.25 0 0 0-.384 0L.342 8.59A.25.25 0 0 0 .534 9z"/></svg>',
129
+ imageUpload: '<svg viewBox="0 0 16 16" fill="currentColor"><path d="M6.002 5.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z"/><path d="M2.002 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V3a2 2 0 0 0-2-2h-12zm12 1a1 1 0 0 1 1 1v6.5l-3.777-1.947a.5.5 0 0 0-.577.093l-3.71 3.71-2.66-1.772a.5.5 0 0 0-.63.062L1.002 12V3a1 1 0 0 1 1-1h12z"/></svg>',
130
+ fileUpload: '<svg viewBox="0 0 16 16" fill="currentColor"><path d="M14 4.5V14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h5.5L14 4.5zm-3 0A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V4.5h-2z"/></svg>'
131
+ };
132
+ /**
133
+ * Get icon configuration by type
134
+ */
135
+ function getIconSet(iconSetType, customIcons) {
136
+ let baseIcons;
137
+ switch (iconSetType) {
138
+ case 'material':
139
+ baseIcons = MATERIAL_ICONS;
140
+ break;
141
+ case 'heroicons':
142
+ baseIcons = HEROICONS;
143
+ break;
144
+ case 'lucide':
145
+ baseIcons = LUCIDE_ICONS;
146
+ break;
147
+ case 'bootstrap':
148
+ baseIcons = BOOTSTRAP_ICONS;
149
+ break;
150
+ case 'custom':
151
+ baseIcons = FEATHER_ICONS; // Fallback to Feather for missing custom icons
152
+ break;
153
+ case 'feather':
154
+ default:
155
+ baseIcons = FEATHER_ICONS;
156
+ break;
157
+ }
158
+ // Merge custom icons if provided
159
+ return customIcons ? Object.assign(Object.assign({}, baseIcons), customIcons) : baseIcons;
160
+ }
161
+
162
+ class AiAgentService {
163
+ constructor(http) {
164
+ this.http = http;
165
+ this.defaultConfig = {
166
+ apiUrl: 'https://localhost:7237/api/AIAgent',
167
+ timeout: 30000,
168
+ retries: 3
169
+ };
170
+ this.config = Object.assign({}, this.defaultConfig);
171
+ }
172
+ configure(config) {
173
+ this.config = Object.assign(Object.assign({}, this.defaultConfig), config);
174
+ }
175
+ testConfiguration() {
176
+ // For development purposes, simulate a successful connection
177
+ // when the backend is not available
178
+ console.log('Testing configuration at:', `${this.config.apiUrl}/TestConfiguration`);
179
+ const headers = new HttpHeaders(Object.assign({ 'Content-Type': 'application/json' }, (this.config.appKey && { 'x-api-key': this.config.appKey })));
180
+ return this.http.get(`${this.config.apiUrl}/TestConfiguration`, { headers })
181
+ .pipe(timeout(this.config.timeout || 30000), catchError((error) => {
182
+ console.log('Backend API not available, running in demo mode:', error);
183
+ // Return a mock successful response for demo purposes
184
+ return throwError({
185
+ success: false,
186
+ error: 'Backend API not available (Demo Mode)'
187
+ });
188
+ }));
189
+ }
190
+ processInquiry(request) {
191
+ const headers = new HttpHeaders(Object.assign({ 'Content-Type': 'application/json' }, (this.config.appKey && { 'x-api-key': this.config.appKey })));
192
+ return this.http.post(`${this.config.apiUrl}/ProcessInquiry`, request, { headers })
193
+ .pipe(timeout(this.config.timeout || 30000), catchError((error) => {
194
+ console.log('ProcessInquiry API not available, returning demo response:', error);
195
+ // Return a mock response for demo purposes
196
+ const mockResponse = {
197
+ answer: `Demo Mode: I received your query "${request.query}". The backend API is currently not available, but the UI is working correctly!`,
198
+ contents: [{
199
+ content: `Demo Mode: I received your query "${request.query}". The backend API is currently not available, but the UI is working correctly!`,
200
+ role: 'assistant',
201
+ authorName: 'Maestro (Demo)'
202
+ }]
203
+ };
204
+ // Return the mock response as an Observable
205
+ return new Observable(observer => {
206
+ setTimeout(() => {
207
+ observer.next(mockResponse);
208
+ observer.complete();
209
+ }, 1000); // Simulate network delay
210
+ });
211
+ }));
212
+ }
213
+ handleError(error) {
214
+ let errorMessage = 'An error occurred while processing your request.';
215
+ if (error.error instanceof ErrorEvent) {
216
+ // Client-side error
217
+ errorMessage = `Client Error: ${error.error.message}`;
218
+ }
219
+ else {
220
+ // Server-side error
221
+ errorMessage = `Server Error: ${error.status} - ${error.message}`;
222
+ if (error.error && error.error.message) {
223
+ errorMessage += ` - ${error.error.message}`;
224
+ }
225
+ }
226
+ console.error('AiAgentService Error:', error);
227
+ return throwError({
228
+ success: false,
229
+ error: errorMessage
230
+ });
231
+ }
232
+ }
233
+ AiAgentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: AiAgentService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
234
+ AiAgentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: AiAgentService, providedIn: 'root' });
235
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: AiAgentService, decorators: [{
236
+ type: Injectable,
237
+ args: [{
238
+ providedIn: 'root'
239
+ }]
240
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }]; } });
241
+
242
+ class AiChatComponent {
243
+ constructor(aiAgentService, sanitizer) {
244
+ this.aiAgentService = aiAgentService;
245
+ this.sanitizer = sanitizer;
246
+ this.title = 'Chat with Maestro';
247
+ this.placeholder = 'Type your inquiry here... (Press Enter to send, Shift+Enter for new line)';
248
+ this.showDebugInfo = false;
249
+ this.enableImageUpload = false; // Enable/disable image upload button
250
+ this.enableFileUpload = false; // Enable/disable file upload button
251
+ this.iconSet = 'feather'; // Icon set selection
252
+ this.messageReceived = new EventEmitter();
253
+ this.messageSent = new EventEmitter();
254
+ this.fileUploaded = new EventEmitter();
255
+ this.sizeChanged = new EventEmitter();
256
+ this.messages = [];
257
+ this.currentInquiry = '';
258
+ this.authorName = '';
259
+ this.intent = '';
260
+ this.isLoading = false;
261
+ this.configurationStatus = '';
262
+ // Resizing properties
263
+ this.currentSize = 'default';
264
+ this.isFullscreen = false;
265
+ this.isResizing = false;
266
+ this.containerWidth = 800;
267
+ this.containerHeight = 600;
268
+ this.minWidth = 400;
269
+ this.maxWidth = 1400;
270
+ this.minHeight = 400;
271
+ this.maxHeight = window.innerHeight - 100;
272
+ this.startX = 0;
273
+ this.startY = 0;
274
+ this.startWidth = 0;
275
+ this.startHeight = 0;
276
+ // File upload properties
277
+ this.maxFileSize = 10 * 1024 * 1024; // 10MB
278
+ this.allowedImageTypes = ['image/png', 'image/jpeg', 'image/jpg', 'image/gif', 'image/webp'];
279
+ this.allowedFileTypes = ['application/pdf', 'application/msword',
280
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
281
+ 'text/plain', 'text/csv'];
282
+ this.selectedFiles = [];
283
+ // Icon configuration
284
+ this.icons = getIconSet('feather');
285
+ this.sanitizedIcons = {};
286
+ this.destroy$ = new Subject();
287
+ }
288
+ ngOnInit() {
289
+ this.configurationStatus = 'Initializing...';
290
+ console.log('AI Chat Component initialized');
291
+ // Load icon set
292
+ this.icons = getIconSet(this.iconSet, this.customIcons);
293
+ this.sanitizeIcons();
294
+ // Configure API URL and App Key if provided
295
+ if (this.apiUrl || this.appKey) {
296
+ this.aiAgentService.configure({
297
+ apiUrl: this.apiUrl,
298
+ appKey: this.appKey
299
+ });
300
+ }
301
+ try {
302
+ // Load historical messages if provided
303
+ if (this.historicalMessages && this.historicalMessages.length > 0) {
304
+ this.loadHistoricalMessages(this.historicalMessages);
305
+ }
306
+ else {
307
+ this.addWelcomeMessage();
308
+ }
309
+ this.testConfiguration();
310
+ this.loadSavedSize();
311
+ this.applySizePreset(this.currentSize);
312
+ }
313
+ catch (error) {
314
+ console.error('Error during component initialization:', error);
315
+ this.configurationStatus = 'Initialization error';
316
+ }
317
+ }
318
+ ngOnChanges(changes) {
319
+ // Detect when historicalMessages input changes
320
+ if (changes['historicalMessages'] && !changes['historicalMessages'].firstChange) {
321
+ const newMessages = changes['historicalMessages'].currentValue;
322
+ // console.log('Historical messages changed:', newMessages);
323
+ // Clear existing messages and reload
324
+ this.messages = [];
325
+ if (newMessages && newMessages.length > 0) {
326
+ this.loadHistoricalMessages(newMessages);
327
+ }
328
+ else {
329
+ this.addWelcomeMessage();
330
+ }
331
+ }
332
+ // Detect when conversationId changes
333
+ if (changes['conversationId'] && !changes['conversationId'].firstChange) {
334
+ // console.log('Conversation ID changed:', changes['conversationId'].currentValue);
335
+ // Update all existing messages with new conversationId if needed
336
+ this.messages.forEach(msg => {
337
+ if (msg.conversationId !== this.conversationId) {
338
+ msg.conversationId = this.conversationId;
339
+ }
340
+ });
341
+ }
342
+ // Detect when icon set changes
343
+ if (changes['iconSet'] || changes['customIcons']) {
344
+ this.icons = getIconSet(this.iconSet, this.customIcons);
345
+ this.sanitizeIcons();
346
+ }
347
+ }
348
+ ngOnDestroy() {
349
+ this.destroy$.next();
350
+ this.destroy$.complete();
351
+ }
352
+ /**
353
+ * Sanitize icon SVG strings for safe rendering in innerHTML bindings
354
+ */
355
+ sanitizeIcons() {
356
+ this.sanitizedIcons = {};
357
+ Object.keys(this.icons).forEach(key => {
358
+ const svgString = this.icons[key];
359
+ if (svgString) {
360
+ this.sanitizedIcons[key] = this.sanitizer.bypassSecurityTrustHtml(svgString);
361
+ }
362
+ });
363
+ }
364
+ testConfiguration() {
365
+ this.configurationStatus = 'Testing connection...';
366
+ this.aiAgentService.testConfiguration()
367
+ .pipe(takeUntil(this.destroy$))
368
+ .subscribe({
369
+ next: (response) => {
370
+ if (response.success) {
371
+ this.configurationStatus = 'AI Agent is ready';
372
+ }
373
+ else {
374
+ this.configurationStatus = `Configuration error: ${response.error}`;
375
+ }
376
+ },
377
+ error: (errorResponse) => {
378
+ this.configurationStatus = `Connection error: Cannot connect to backend service`;
379
+ console.error('API connection test failed:', errorResponse);
380
+ }
381
+ });
382
+ }
383
+ addWelcomeMessage() {
384
+ const welcomeText = this.welcomeMessage ||
385
+ `<h3>Hello ${this.firstName}!</h3>Hi, I'm Maestro—your AI assistant. I'm here to help with your policy-related inquiries.<br><br>How can I assist you today?`;
386
+ this.messages.push({
387
+ isUser: false,
388
+ content: welcomeText,
389
+ intent: 'welcome',
390
+ timestamp: new Date()
391
+ });
392
+ }
393
+ /**
394
+ * Load and transform historical messages from parent component
395
+ * Accepts messages in the format from your backend/state management
396
+ */
397
+ loadHistoricalMessages(historicalMessages) {
398
+ // console.log('Loading historical messages:', historicalMessages);
399
+ // console.log('Number of messages to load:', historicalMessages.length);
400
+ // Transform your backend format to ChatMessage format
401
+ const transformedMessages = historicalMessages.map((msg) => {
402
+ // Determine if message is from user based on sender or role
403
+ const isUserMessage = this.isUserMessage(msg);
404
+ const transformed = {
405
+ messageId: msg.messageId || msg.id,
406
+ conversationId: msg.conversationId || this.conversationId,
407
+ isUser: isUserMessage,
408
+ content: msg.messageText || msg.message || msg.text || msg.content || '',
409
+ sender: msg.sender || (isUserMessage ? this.userName || 'User' : 'Maestro'),
410
+ intent: msg.intent || '',
411
+ authorName: msg.authorName || msg.sender,
412
+ confidenceScore: msg.confidenceScore || msg.confidence || 0,
413
+ timestamp: msg.timestamp || msg.createdAt
414
+ ? new Date(msg.timestamp || msg.createdAt)
415
+ : new Date(),
416
+ isLoading: false
417
+ };
418
+ // console.log('Transformed message:', transformed);
419
+ return transformed;
420
+ });
421
+ // Sort messages by timestamp to maintain chronological order
422
+ transformedMessages.sort((a, b) => a.timestamp.getTime() - b.timestamp.getTime());
423
+ // console.log('Sorted messages count:', transformedMessages.length);
424
+ // Add welcome message first if no messages or load historical messages
425
+ if (transformedMessages.length === 0) {
426
+ // console.log('No messages to load, adding welcome message');
427
+ this.addWelcomeMessage();
428
+ }
429
+ else {
430
+ // Check if first message is a welcome message, if not add one
431
+ const hasWelcome = transformedMessages.some(msg => msg.intent === 'welcome' || msg.content.includes('Hello'));
432
+ if (!hasWelcome) {
433
+ // console.log('No welcome message found, adding one');
434
+ this.addWelcomeMessage();
435
+ }
436
+ // console.log('Pushing transformed messages to messages array');
437
+ this.messages.push(...transformedMessages);
438
+ }
439
+ // console.log('Total loaded messages in component:', this.messages.length);
440
+ // console.log('Messages array:', this.messages);
441
+ }
442
+ /**
443
+ * Helper method to determine if a message is from the user
444
+ */
445
+ isUserMessage(msg) {
446
+ var _a, _b;
447
+ // Check various properties that might indicate user message
448
+ if (msg.isUser !== undefined)
449
+ return msg.isUser;
450
+ if (msg.role)
451
+ return msg.role.toLowerCase() === 'user';
452
+ if (msg.sender) {
453
+ const sender = msg.sender.toLowerCase();
454
+ return sender === 'user' ||
455
+ sender === ((_a = this.userName) === null || _a === void 0 ? void 0 : _a.toLowerCase()) ||
456
+ sender === ((_b = this.userId) === null || _b === void 0 ? void 0 : _b.toLowerCase()) ||
457
+ sender.includes('user');
458
+ }
459
+ // Default to false (bot message) if can't determine
460
+ return false;
461
+ }
462
+ sendInquiry() {
463
+ if (!this.currentInquiry.trim() || this.isLoading) {
464
+ return;
465
+ }
466
+ const userMessage = {
467
+ messageId: this.generateMessageId(),
468
+ conversationId: this.conversationId,
469
+ isUser: true,
470
+ sender: this.userName || 'User',
471
+ intent: this.intent,
472
+ content: this.currentInquiry,
473
+ timestamp: new Date()
474
+ };
475
+ this.messages.push(userMessage);
476
+ this.messageSent.emit(userMessage);
477
+ // Add loading message
478
+ const loadingMessage = {
479
+ isUser: false,
480
+ intent: '',
481
+ content: 'Processing your inquiry...',
482
+ timestamp: new Date(),
483
+ isLoading: true
484
+ };
485
+ this.messages.push(loadingMessage);
486
+ const inquiry = this.currentInquiry.trim();
487
+ this.currentInquiry = '';
488
+ this.authorName = '';
489
+ this.intent = '';
490
+ this.isLoading = true;
491
+ const request = {
492
+ query: inquiry,
493
+ chatHistory: [],
494
+ userId: this.userId,
495
+ userName: this.userName,
496
+ appSource: this.appSource
497
+ };
498
+ this.aiAgentService.processInquiry(request)
499
+ .pipe(takeUntil(this.destroy$))
500
+ .subscribe({
501
+ next: (response) => {
502
+ this.isLoading = false;
503
+ // Remove loading message
504
+ this.messages = this.messages.filter(msg => !msg.isLoading);
505
+ if (response.answer || (response.contents && response.contents.length > 0)) {
506
+ if (response.answer) {
507
+ const botMessage = {
508
+ messageId: this.generateMessageId(),
509
+ conversationId: this.conversationId,
510
+ isUser: false,
511
+ sender: 'Maestro',
512
+ intent: response.searchIntent || inquiry,
513
+ content: this.formatMessageContent(response.answer),
514
+ authorName: response.contents && response.contents.length > 0 ? response.contents[0].authorName : undefined,
515
+ timestamp: new Date()
516
+ };
517
+ this.messages.push(botMessage);
518
+ this.messageReceived.emit(botMessage);
519
+ }
520
+ else if (response.contents && response.contents.length > 0) {
521
+ // Push each content as a separate message
522
+ response.contents.forEach(contentItem => {
523
+ if (contentItem.content) {
524
+ const botMessage = {
525
+ messageId: this.generateMessageId(),
526
+ conversationId: this.conversationId,
527
+ isUser: false,
528
+ sender: contentItem.authorName || 'Maestro',
529
+ intent: response.searchIntent || inquiry,
530
+ content: this.formatMessageContent(contentItem.content || 'No content available'),
531
+ authorName: contentItem.authorName,
532
+ timestamp: new Date()
533
+ };
534
+ this.messages.push(botMessage);
535
+ this.messageReceived.emit(botMessage);
536
+ }
537
+ });
538
+ }
539
+ }
540
+ else {
541
+ const errorMessage = {
542
+ messageId: this.generateMessageId(),
543
+ conversationId: this.conversationId,
544
+ isUser: false,
545
+ sender: 'Maestro',
546
+ intent: inquiry,
547
+ content: `Sorry, I didn't receive a valid response.`,
548
+ authorName: this.authorName,
549
+ timestamp: new Date()
550
+ };
551
+ this.messages.push(errorMessage);
552
+ this.messageReceived.emit(errorMessage);
553
+ }
554
+ },
555
+ error: (error) => {
556
+ this.isLoading = false;
557
+ // Remove loading message
558
+ this.messages = this.messages.filter(msg => !msg.isLoading);
559
+ const errorMessage = {
560
+ messageId: this.generateMessageId(),
561
+ conversationId: this.conversationId,
562
+ isUser: false,
563
+ sender: 'Maestro',
564
+ intent: inquiry,
565
+ content: 'Sorry, I encountered an error processing your request. Please try again.',
566
+ authorName: this.authorName,
567
+ timestamp: new Date()
568
+ };
569
+ this.messages.push(errorMessage);
570
+ this.messageReceived.emit(errorMessage);
571
+ console.error('Error processing inquiry:', error);
572
+ }
573
+ });
574
+ }
575
+ clearChat() {
576
+ this.messages = [];
577
+ this.addWelcomeMessage();
578
+ }
579
+ onKeyPress(event) {
580
+ if (event.key === 'Enter' && !event.shiftKey) {
581
+ event.preventDefault();
582
+ this.sendInquiry();
583
+ }
584
+ }
585
+ trackByIndex(index) {
586
+ return index;
587
+ }
588
+ getThemeClass() {
589
+ // Default theme if no template design is specified
590
+ if (!this.templateDesign) {
591
+ return 'theme-default';
592
+ }
593
+ // Validate and return theme class
594
+ const validThemes = ['default', 'dark', 'blue', 'green', 'purple', 'minimal', 'corporate', 'red', 'yellow', 'orange'];
595
+ const theme = this.templateDesign.toLowerCase();
596
+ if (validThemes.includes(theme)) {
597
+ return `theme-${theme}`;
598
+ }
599
+ // Fallback to default if invalid theme
600
+ console.warn(`Invalid theme '${this.templateDesign}' provided. Using default theme.`);
601
+ return 'theme-default';
602
+ }
603
+ formatMessageContent(content) {
604
+ if (!content)
605
+ return '';
606
+ // If content already contains HTML tags, return as-is
607
+ if (content.includes('<') && content.includes('>')) {
608
+ return content;
609
+ }
610
+ // Convert newlines to HTML breaks
611
+ let formatted = content.replace(/\n/g, '<br>');
612
+ // Convert escaped newlines to HTML breaks
613
+ formatted = formatted.replace(/\\n/g, '<br>');
614
+ // Convert markdown-style bold to HTML
615
+ formatted = formatted.replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>');
616
+ // Convert bullet points to HTML lists
617
+ const lines = formatted.split('<br>');
618
+ let inList = false;
619
+ const processedLines = [];
620
+ for (let line of lines) {
621
+ if (line.trim().startsWith('• ')) {
622
+ if (!inList) {
623
+ processedLines.push('<ul>');
624
+ inList = true;
625
+ }
626
+ processedLines.push('<li>' + line.replace(/^• /, '') + '</li>');
627
+ }
628
+ else {
629
+ if (inList) {
630
+ processedLines.push('</ul>');
631
+ inList = false;
632
+ }
633
+ processedLines.push(line);
634
+ }
635
+ }
636
+ if (inList) {
637
+ processedLines.push('</ul>');
638
+ }
639
+ return processedLines.join('<br>').replace(/<br><ul>/g, '<ul>').replace(/<\/ul><br>/g, '</ul>');
640
+ }
641
+ generateSessionId() {
642
+ return 'session_' + Math.random().toString(36).substr(2, 9) + '_' + Date.now();
643
+ }
644
+ generateMessageId() {
645
+ return 'msg_' + Math.random().toString(36).substr(2, 9) + '_' + Date.now();
646
+ }
647
+ getFormattedTime(timestamp) {
648
+ return timestamp.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
649
+ }
650
+ // ============= Resize Methods =============
651
+ startResize(event, direction) {
652
+ event.preventDefault();
653
+ this.isResizing = true;
654
+ this.startX = event.clientX;
655
+ this.startY = event.clientY;
656
+ this.startWidth = this.containerWidth;
657
+ this.startHeight = this.containerHeight;
658
+ const mouseMoveHandler = (e) => this.onResize(e, direction);
659
+ const mouseUpHandler = () => this.stopResize(mouseMoveHandler, mouseUpHandler);
660
+ document.addEventListener('mousemove', mouseMoveHandler);
661
+ document.addEventListener('mouseup', mouseUpHandler);
662
+ }
663
+ onResize(event, direction) {
664
+ if (!this.isResizing)
665
+ return;
666
+ const deltaX = event.clientX - this.startX;
667
+ const deltaY = event.clientY - this.startY;
668
+ if (direction === 'width' || direction === 'both') {
669
+ const newWidth = Math.min(Math.max(this.startWidth + deltaX, this.minWidth), this.maxWidth);
670
+ this.containerWidth = newWidth;
671
+ }
672
+ if (direction === 'both') {
673
+ const newHeight = Math.min(Math.max(this.startHeight + deltaY, this.minHeight), this.maxHeight);
674
+ this.containerHeight = newHeight;
675
+ }
676
+ }
677
+ stopResize(mouseMoveHandler, mouseUpHandler) {
678
+ this.isResizing = false;
679
+ document.removeEventListener('mousemove', mouseMoveHandler);
680
+ document.removeEventListener('mouseup', mouseUpHandler);
681
+ this.saveSizePreference();
682
+ this.emitSizeChange();
683
+ }
684
+ applySizePreset(size) {
685
+ this.currentSize = size;
686
+ switch (size) {
687
+ case 'compact':
688
+ this.containerWidth = 400;
689
+ this.containerHeight = 500;
690
+ this.isFullscreen = false;
691
+ break;
692
+ case 'default':
693
+ this.containerWidth = 800;
694
+ this.containerHeight = 600;
695
+ this.isFullscreen = false;
696
+ break;
697
+ case 'expanded':
698
+ this.containerWidth = 1200;
699
+ this.containerHeight = 800;
700
+ this.isFullscreen = false;
701
+ break;
702
+ case 'fullscreen':
703
+ this.toggleFullscreen();
704
+ return;
705
+ }
706
+ this.saveSizePreference();
707
+ this.emitSizeChange();
708
+ }
709
+ toggleFullscreen() {
710
+ if (!this.isFullscreen) {
711
+ // Entering fullscreen - save current state first
712
+ sessionStorage.setItem('chatbox-previous-size', JSON.stringify({
713
+ width: this.containerWidth,
714
+ height: this.containerHeight,
715
+ size: this.currentSize,
716
+ wasFullscreen: this.isFullscreen
717
+ }));
718
+ this.isFullscreen = true;
719
+ this.currentSize = 'fullscreen';
720
+ }
721
+ else {
722
+ // Exiting fullscreen - restore previous state
723
+ try {
724
+ const previous = sessionStorage.getItem('chatbox-previous-size');
725
+ if (previous) {
726
+ const prevData = JSON.parse(previous);
727
+ this.containerWidth = prevData.width || 800;
728
+ this.containerHeight = prevData.height || 600;
729
+ this.currentSize = prevData.size === 'fullscreen' ? 'default' : prevData.size;
730
+ }
731
+ else {
732
+ this.currentSize = 'default';
733
+ this.containerWidth = 800;
734
+ this.containerHeight = 600;
735
+ }
736
+ }
737
+ catch (error) {
738
+ this.currentSize = 'default';
739
+ this.containerWidth = 800;
740
+ this.containerHeight = 600;
741
+ }
742
+ this.isFullscreen = false;
743
+ }
744
+ this.saveSizePreference();
745
+ this.emitSizeChange();
746
+ }
747
+ saveSizePreference() {
748
+ const sizeData = {
749
+ size: this.currentSize,
750
+ width: this.containerWidth,
751
+ height: this.containerHeight,
752
+ isFullscreen: this.isFullscreen
753
+ };
754
+ try {
755
+ sessionStorage.setItem('chatbox-size-preference', JSON.stringify(sizeData));
756
+ }
757
+ catch (error) {
758
+ console.warn('Failed to save size preference:', error);
759
+ }
760
+ }
761
+ loadSavedSize() {
762
+ try {
763
+ const saved = sessionStorage.getItem('chatbox-size-preference');
764
+ if (saved) {
765
+ const sizeData = JSON.parse(saved);
766
+ this.currentSize = sizeData.size || 'default';
767
+ this.containerWidth = sizeData.width || 800;
768
+ this.containerHeight = sizeData.height || 600;
769
+ this.isFullscreen = sizeData.isFullscreen || false;
770
+ }
771
+ }
772
+ catch (error) {
773
+ console.warn('Failed to load size preference:', error);
774
+ }
775
+ }
776
+ emitSizeChange() {
777
+ this.sizeChanged.emit({
778
+ size: this.currentSize,
779
+ width: this.containerWidth,
780
+ height: this.containerHeight
781
+ });
782
+ }
783
+ getContainerStyle() {
784
+ if (this.isFullscreen) {
785
+ return {
786
+ width: '100vw !important',
787
+ height: '100vh !important',
788
+ maxWidth: '100vw !important',
789
+ maxHeight: '100vh !important',
790
+ position: 'fixed',
791
+ top: '0',
792
+ left: '0',
793
+ right: '0',
794
+ bottom: '0',
795
+ margin: '0',
796
+ zIndex: 99999
797
+ };
798
+ }
799
+ return {
800
+ width: `${this.containerWidth}px`,
801
+ height: `${this.containerHeight}px`,
802
+ maxWidth: `${this.maxWidth}px`
803
+ };
804
+ }
805
+ // ============= File Upload Methods =============
806
+ onImageUpload(event) {
807
+ const input = event.target;
808
+ if (input.files && input.files.length > 0) {
809
+ this.handleFileSelection(Array.from(input.files), 'image');
810
+ }
811
+ }
812
+ onFileUpload(event) {
813
+ const input = event.target;
814
+ if (input.files && input.files.length > 0) {
815
+ this.handleFileSelection(Array.from(input.files), 'file');
816
+ }
817
+ }
818
+ handleFileSelection(files, type) {
819
+ files.forEach(file => {
820
+ // Validate file type
821
+ const allowedTypes = type === 'image' ? this.allowedImageTypes : this.allowedFileTypes;
822
+ if (!allowedTypes.includes(file.type)) {
823
+ console.warn(`File type ${file.type} not allowed`);
824
+ return;
825
+ }
826
+ // Validate file size
827
+ if (file.size > this.maxFileSize) {
828
+ console.warn(`File ${file.name} exceeds maximum size of ${this.maxFileSize / 1024 / 1024}MB`);
829
+ return;
830
+ }
831
+ const reader = new FileReader();
832
+ reader.onload = (e) => {
833
+ var _a;
834
+ const attachment = {
835
+ id: this.generateMessageId(),
836
+ name: file.name,
837
+ type: file.type,
838
+ size: file.size,
839
+ data: ((_a = e.target) === null || _a === void 0 ? void 0 : _a.result) || undefined
840
+ };
841
+ this.selectedFiles.push(attachment);
842
+ this.fileUploaded.emit(attachment);
843
+ };
844
+ if (type === 'image') {
845
+ reader.readAsDataURL(file);
846
+ }
847
+ else {
848
+ reader.readAsArrayBuffer(file);
849
+ }
850
+ });
851
+ }
852
+ removeAttachment(attachmentId) {
853
+ this.selectedFiles = this.selectedFiles.filter(f => f.id !== attachmentId);
854
+ }
855
+ triggerImageUpload() {
856
+ const input = document.getElementById('image-upload-input');
857
+ if (input) {
858
+ input.click();
859
+ }
860
+ }
861
+ triggerFileUpload() {
862
+ const input = document.getElementById('file-upload-input');
863
+ if (input) {
864
+ input.click();
865
+ }
866
+ }
867
+ getFileIcon(fileType) {
868
+ if (fileType.startsWith('image/'))
869
+ return '🖼️';
870
+ if (fileType.includes('pdf'))
871
+ return '📄';
872
+ if (fileType.includes('word') || fileType.includes('document'))
873
+ return '📝';
874
+ if (fileType.includes('text'))
875
+ return '📃';
876
+ return '📎';
877
+ }
878
+ getFileSizeFormatted(bytes) {
879
+ if (bytes < 1024)
880
+ return bytes + ' B';
881
+ if (bytes < 1024 * 1024)
882
+ return (bytes / 1024).toFixed(1) + ' KB';
883
+ return (bytes / (1024 * 1024)).toFixed(1) + ' MB';
884
+ }
885
+ }
886
+ AiChatComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: AiChatComponent, deps: [{ token: AiAgentService }, { token: i2.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component });
887
+ AiChatComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: AiChatComponent, selector: "emanate-ai-chat", inputs: { title: "title", placeholder: "placeholder", showDebugInfo: "showDebugInfo", apiUrl: "apiUrl", appKey: "appKey", appSource: "appSource", userId: "userId", firstName: "firstName", userName: "userName", templateDesign: "templateDesign", welcomeMessage: "welcomeMessage", historicalMessages: "historicalMessages", conversationId: "conversationId", enableImageUpload: "enableImageUpload", enableFileUpload: "enableFileUpload", iconSet: "iconSet", customIcons: "customIcons" }, outputs: { messageReceived: "messageReceived", messageSent: "messageSent", fileUploaded: "fileUploaded", sizeChanged: "sizeChanged" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"ai-chat-container\" \r\n [ngClass]=\"getThemeClass()\" \r\n [ngStyle]=\"getContainerStyle()\"\r\n [class.fullscreen]=\"isFullscreen\"\r\n [class.resizing]=\"isResizing\">\r\n \r\n <!-- Resize Handles -->\r\n <div class=\"resize-handle resize-handle-right\" \r\n (mousedown)=\"startResize($event, 'width')\"\r\n *ngIf=\"!isFullscreen\"\r\n title=\"Drag to resize width\">\r\n </div>\r\n \r\n <div class=\"resize-handle resize-handle-corner\" \r\n (mousedown)=\"startResize($event, 'both')\"\r\n *ngIf=\"!isFullscreen\"\r\n title=\"Drag to resize\">\r\n </div>\r\n \r\n <!-- Debug Information (only shown when showDebugInfo is true) -->\r\n <div *ngIf=\"showDebugInfo\" class=\"debug-info\">\r\n <h3>DEBUG: AI Chat Component Loaded</h3>\r\n <p>Status: {{ configurationStatus || 'Loading...' }}</p>\r\n <p>Messages count: {{ messages.length || 0 }}</p>\r\n <p>Theme: {{ templateDesign || 'default' }}</p>\r\n <p>Size: {{ currentSize }} ({{ containerWidth }}x{{ containerHeight }})</p>\r\n </div>\r\n\r\n <div class=\"chat-header\">\r\n <div class=\"header-left\">\r\n <h2>{{ title }}</h2>\r\n <!-- Icon-only status indicator -->\r\n <div class=\"status-indicator-icon\" \r\n [ngClass]=\"{'status-ready': configurationStatus === 'AI Agent is ready', \r\n 'status-error': configurationStatus !== 'AI Agent is ready',\r\n 'status-loading': configurationStatus === 'Initializing...' || configurationStatus === 'Testing connection...'}\"\r\n [title]=\"configurationStatus\">\r\n </div>\r\n </div>\r\n \r\n <div class=\"header-controls\">\r\n <!-- Size Preset Buttons -->\r\n <div class=\"size-controls\" *ngIf=\"!isFullscreen\">\r\n <button class=\"control-button size-button\" \r\n (click)=\"applySizePreset('compact')\"\r\n [class.active]=\"currentSize === 'compact'\"\r\n title=\"Compact View\"\r\n attr.aria-label=\"Compact View\">\r\n <span class=\"icon-svg\" [innerHTML]=\"sanitizedIcons.compactView\"></span>\r\n </button>\r\n <button class=\"control-button size-button\" \r\n (click)=\"applySizePreset('default')\"\r\n [class.active]=\"currentSize === 'default'\"\r\n title=\"Default View\"\r\n attr.aria-label=\"Default View\">\r\n <span class=\"icon-svg\" [innerHTML]=\"sanitizedIcons.defaultView\"></span>\r\n </button>\r\n <button class=\"control-button size-button\" \r\n (click)=\"applySizePreset('expanded')\"\r\n [class.active]=\"currentSize === 'expanded'\"\r\n title=\"Expanded View\"\r\n attr.aria-label=\"Expanded View\">\r\n <span class=\"icon-svg\" [innerHTML]=\"sanitizedIcons.expandedView\"></span>\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div class=\"chat-messages\" #messagesContainer>\r\n <div *ngFor=\"let message of messages; let i = index; trackBy: trackByIndex\" class=\"message-wrapper\">\r\n <!-- Message -->\r\n <div class=\"message\" \r\n [ngClass]=\"{'user-message': message.isUser, 'ai-message': !message.isUser, 'loading-message': message.isLoading}\">\r\n \r\n <div class=\"message-content\">\r\n <div [innerHTML]=\"message.content\"></div>\r\n <div class=\"message-timestamp\">{{ getFormattedTime(message.timestamp) }}</div>\r\n </div>\r\n \r\n <div class=\"message-avatar\">\r\n <span *ngIf=\"message.isUser\" class=\"avatar-icon\" [innerHTML]=\"sanitizedIcons.userAvatar\"></span>\r\n <span *ngIf=\"!message.isUser && !message.isLoading\" class=\"avatar-icon\" [innerHTML]=\"sanitizedIcons.aiAvatar\"></span>\r\n <span *ngIf=\"message.isLoading\" class=\"avatar-icon loading-spinner\" [innerHTML]=\"sanitizedIcons.loadingAvatar\"></span>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div class=\"chat-input\">\r\n <!-- Attachments Preview -->\r\n <div class=\"attachments-preview\" *ngIf=\"selectedFiles.length > 0\">\r\n <div class=\"attachment-item\" *ngFor=\"let file of selectedFiles\">\r\n <svg class=\"attachment-icon\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\">\r\n <path d=\"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48\"></path>\r\n </svg>\r\n <span class=\"attachment-name\">{{ file.name }}</span>\r\n <span class=\"attachment-size\">{{ getFileSizeFormatted(file.size) }}</span>\r\n <button class=\"remove-attachment\" (click)=\"removeAttachment(file.id)\" title=\"Remove\" attr.aria-label=\"Remove attachment\">\r\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\">\r\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\"></line>\r\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\"></line>\r\n </svg>\r\n </button>\r\n </div>\r\n </div>\r\n \r\n <div class=\"input-container\">\r\n <!-- File Upload Inputs (Hidden) -->\r\n <input type=\"file\" \r\n id=\"image-upload-input\" \r\n accept=\"image/*\" \r\n multiple \r\n (change)=\"onImageUpload($event)\"\r\n style=\"display: none;\"\r\n [disabled]=\"!enableImageUpload\">\r\n \r\n <input type=\"file\" \r\n id=\"file-upload-input\" \r\n accept=\".pdf,.doc,.docx,.txt,.csv\" \r\n multiple \r\n (change)=\"onFileUpload($event)\"\r\n style=\"display: none;\"\r\n [disabled]=\"!enableFileUpload\">\r\n \r\n <!-- Upload Buttons (Conditionally rendered) -->\r\n <div class=\"upload-buttons\" *ngIf=\"enableImageUpload || enableFileUpload\">\r\n <button *ngIf=\"enableImageUpload\" \r\n class=\"upload-button image-upload\" \r\n (click)=\"triggerImageUpload()\"\r\n [disabled]=\"isLoading\"\r\n title=\"Upload Image\"\r\n attr.aria-label=\"Upload Image\">\r\n <span class=\"icon-svg\" [innerHTML]=\"sanitizedIcons.imageUpload\"></span>\r\n </button>\r\n \r\n <button *ngIf=\"enableFileUpload\" \r\n class=\"upload-button file-upload\" \r\n (click)=\"triggerFileUpload()\"\r\n [disabled]=\"isLoading\"\r\n title=\"Attach File\"\r\n attr.aria-label=\"Attach File\">\r\n <span class=\"icon-svg\" [innerHTML]=\"sanitizedIcons.fileUpload\"></span>\r\n </button>\r\n </div>\r\n \r\n <textarea \r\n [(ngModel)]=\"currentInquiry\" \r\n (keypress)=\"onKeyPress($event)\"\r\n [placeholder]=\"placeholder\"\r\n rows=\"2\"\r\n [disabled]=\"isLoading\"\r\n class=\"inquiry-textarea\"\r\n attr.aria-label=\"Type your message\"></textarea>\r\n \r\n <button \r\n (click)=\"sendInquiry()\" \r\n [disabled]=\"!currentInquiry.trim() || isLoading\"\r\n class=\"send-button\"\r\n title=\"Send Message\"\r\n attr.aria-label=\"Send Message\">\r\n <span *ngIf=\"!isLoading\" class=\"icon-svg\" [innerHTML]=\"sanitizedIcons.send\"></span>\r\n <span *ngIf=\"isLoading\" class=\"icon-svg loading-icon\" [innerHTML]=\"sanitizedIcons.sendLoading\"></span>\r\n <span class=\"text\">{{ isLoading ? 'Sending...' : 'Send' }}</span>\r\n </button>\r\n </div>\r\n </div>\r\n</div>", styles: ["@charset \"UTF-8\";.ai-chat-container{display:flex;flex-direction:column;height:100vh;max-width:800px;margin:0 auto;background:#ffffff;border-radius:12px;overflow:hidden;position:relative;transition:all .25s cubic-bezier(.4,0,.2,1);box-shadow:0 2px 8px #00000014,0 4px 16px #0000000a;--icon-primary: #667eea;--icon-secondary: #6b7280;--icon-avatar-user: #667eea;--icon-avatar-ai: #764ba2;--icon-header: #ffffff;--icon-upload: #667eea;--icon-send: #ffffff;--icon-active: #667eea;--icon-disabled: #d1d5db;--icon-hover: #5568d3}.ai-chat-container.fullscreen{position:fixed!important;top:0!important;left:0!important;right:0!important;bottom:0!important;width:100vw!important;height:100vh!important;max-width:100vw!important;max-height:100vh!important;border-radius:0;z-index:99999;margin:0}.ai-chat-container.resizing{-webkit-user-select:none;user-select:none;cursor:nwse-resize;transition:none}.resize-handle{position:absolute;background:rgba(102,126,234,.3);transition:background .2s ease;z-index:10}.resize-handle:hover{background:rgba(102,126,234,.6)}.resize-handle.resize-handle-right{top:0;right:-4px;width:8px;height:100%;cursor:ew-resize}.resize-handle.resize-handle-corner{bottom:-4px;right:-4px;width:20px;height:20px;cursor:nwse-resize;border-radius:0 0 8px}.resize-handle.resize-handle-corner:after{content:\"\\22f0\";position:absolute;bottom:2px;right:2px;font-size:12px;color:#fffc}.debug-info{background:yellow;padding:10px;border:1px solid orange}.debug-info h3{margin:0;font-size:1.2rem}.debug-info p{margin:5px 0}.icon-svg{display:inline-block;width:20px;height:20px;color:var(--icon-secondary)}.icon-svg svg{width:100%;height:100%;stroke-width:2;transition:all .2s ease}.avatar-icon{display:inline-block;width:28px;height:28px}.avatar-icon svg{width:100%;height:100%}.chat-header{background:linear-gradient(135deg,#667eea 0%,#764ba2 100%);color:#fff;padding:1rem 1.25rem;display:flex;justify-content:space-between;align-items:center;grid-gap:1rem;gap:1rem;flex-wrap:wrap;box-shadow:0 2px 4px #0000001a}.chat-header .header-left{display:flex;align-items:center;grid-gap:.75rem;gap:.75rem;flex:1;min-width:200px}.chat-header .header-left h2{margin:0;font-size:1.25rem;font-weight:600;letter-spacing:-.01em}.chat-header .header-controls{display:flex;align-items:center;grid-gap:.5rem;gap:.5rem}.chat-header .header-controls .icon-svg{color:var(--icon-header)}.chat-header .status-indicator-icon{width:10px;height:10px;border-radius:50%;background:rgba(255,255,255,.4);transition:all .3s ease;box-shadow:0 0 0 2px #fff3;cursor:help}.chat-header .status-indicator-icon.status-ready{background:#2ecc71;box-shadow:0 0 0 2px #2ecc714d,0 0 8px #2ecc7166}.chat-header .status-indicator-icon.status-error{background:#e74c3c;box-shadow:0 0 0 2px #e74c3c4d,0 0 8px #e74c3c66}.chat-header .status-indicator-icon.status-loading{background:#f39c12;box-shadow:0 0 0 2px #f39c124d;animation:pulse 1.5s ease-in-out infinite}@keyframes pulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.6;transform:scale(1.1)}}.size-controls{display:flex;grid-gap:.5rem;gap:.5rem;background:transparent;padding:0;border-radius:0;backdrop-filter:none}.control-button{background:transparent;border:none;border-radius:0;width:28px;height:28px;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s cubic-bezier(.4,0,.2,1);color:#fff;padding:0}.control-button .icon-svg{width:18px;height:18px;color:var(--icon-header)}.control-button:hover:not(:disabled){opacity:.8;transform:scale(1.1)}.control-button:active:not(:disabled){transform:scale(.95)}.control-button.active{opacity:1;transform:scale(1.15)}.control-button:disabled{opacity:.4;cursor:not-allowed}.fullscreen-button{background:transparent}.fullscreen-button:hover:not(:disabled){opacity:.8;transform:scale(1.1)}.clear-button{background:transparent}.clear-button:hover:not(:disabled){opacity:.8;transform:scale(1.1);color:#fcc}.chat-messages{flex:1;overflow-y:auto;overflow-x:hidden;padding:1.25rem;display:flex;flex-direction:column;grid-gap:.875rem;gap:.875rem;scroll-behavior:smooth;background:#f8f9fa}.chat-messages::-webkit-scrollbar{width:6px}.chat-messages::-webkit-scrollbar-track{background:transparent}.chat-messages::-webkit-scrollbar-thumb{background:rgba(0,0,0,.15);border-radius:3px}.chat-messages::-webkit-scrollbar-thumb:hover{background:rgba(0,0,0,.25)}.message-wrapper{display:flex;flex-direction:column}.message{display:flex;max-width:75%;animation:fadeInSlide .25s cubic-bezier(.4,0,.2,1)}.message.user-message{align-self:flex-end;flex-direction:row-reverse}.message.user-message .message-content{background:linear-gradient(135deg,#667eea,#764ba2);color:#fff;border-radius:18px 18px 4px;box-shadow:0 1px 2px #0000001a}.message.user-message .avatar-icon{color:var(--icon-avatar-user)}.message.ai-message{align-self:flex-start}.message.ai-message .message-content{background:white;color:#1a1a1a;border-radius:18px 18px 18px 4px;border:1px solid #e8e8e8;box-shadow:0 1px 2px #0000000d}.message.ai-message .avatar-icon{color:var(--icon-avatar-ai)}.message.loading-message{opacity:.7}.message.loading-message .message-content{font-style:italic}@keyframes fadeInSlide{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}.message-content{padding:.75rem 1rem;margin:0 .5rem;word-wrap:break-word;max-width:100%;line-height:1.5;font-size:.9375rem}.message-timestamp{font-size:.6875rem;opacity:.65;margin-top:.375rem;text-align:right;font-weight:500}.message-avatar{width:36px;height:36px;display:flex;align-items:center;justify-content:center;flex-shrink:0}.message-avatar .avatar-icon{opacity:.9}.loading-spinner{animation:spin 1.2s linear infinite;opacity:.7}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.chat-input{background:white;padding:1rem 1.25rem;border-top:1px solid #e8e8e8;display:flex;flex-direction:column;grid-gap:.75rem;gap:.75rem;box-shadow:0 -2px 8px #0000000a}.input-container{display:flex;grid-gap:.5rem;gap:.5rem;align-items:flex-end}.upload-buttons{display:flex;grid-gap:.5rem;gap:.5rem;flex-direction:column}.upload-button{background:#f5f5f5;border:1px solid #e0e0e0;border-radius:10px;width:42px;height:42px;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s cubic-bezier(.4,0,.2,1)}.upload-button .icon-svg{width:20px;height:20px;color:var(--icon-upload)}.upload-button:hover:not(:disabled){background:var(--icon-upload);border-color:var(--icon-upload);transform:translateY(-1px);box-shadow:0 2px 8px #667eea40}.upload-button:hover:not(:disabled) .icon-svg{color:#fff}.upload-button:active:not(:disabled){transform:translateY(0)}.upload-button:disabled{opacity:.4;cursor:not-allowed;background:#fafafa}.attachments-preview{display:flex;flex-wrap:wrap;grid-gap:.5rem;gap:.5rem;padding:.75rem;background:#f8f9fa;border-radius:10px;border:1px solid #e8e8e8}.attachment-item{display:flex;align-items:center;grid-gap:.625rem;gap:.625rem;background:white;border:1px solid #e0e0e0;border-radius:8px;padding:.625rem .875rem;font-size:.875rem;transition:all .2s ease}.attachment-item:hover{border-color:#667eea;box-shadow:0 2px 4px #667eea1a}.attachment-item .attachment-icon{width:20px;height:20px;color:#667eea;flex-shrink:0}.attachment-item .attachment-name{font-weight:500;max-width:150px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#1a1a1a}.attachment-item .attachment-size{color:#666;font-size:.75rem;font-weight:500}.attachment-item .remove-attachment{background:transparent;border:none;color:#999;cursor:pointer;padding:.25rem;margin-left:.25rem;transition:all .2s ease;display:flex;align-items:center;justify-content:center;border-radius:4px}.attachment-item .remove-attachment svg{width:16px;height:16px}.attachment-item .remove-attachment:hover{color:#e74c3c;background:rgba(231,76,60,.1)}.inquiry-textarea{flex:1;border:1.5px solid #e0e0e0;border-radius:22px;padding:.875rem 1.125rem;font-family:inherit;font-size:.9375rem;line-height:1.5;resize:none;outline:none;transition:all .2s cubic-bezier(.4,0,.2,1);background:#fafafa}.inquiry-textarea:focus{border-color:#667eea;background:white;box-shadow:0 0 0 3px #667eea14}.inquiry-textarea:disabled{background:#f5f5f5;cursor:not-allowed;opacity:.6}.inquiry-textarea::placeholder{color:#999}.send-button{background:linear-gradient(135deg,#667eea,#764ba2);color:#fff;border:none;border-radius:50px;padding:.875rem 1.75rem;font-size:.9375rem;font-weight:600;cursor:pointer;display:flex;align-items:center;grid-gap:.5rem;gap:.5rem;transition:all .2s cubic-bezier(.4,0,.2,1);min-width:110px;justify-content:center;box-shadow:0 2px 8px #667eea40}.send-button .icon-svg{width:18px;height:18px;color:var(--icon-send)}.send-button .loading-icon{animation:spin 1.2s linear infinite}.send-button:hover:not(:disabled){transform:translateY(-1px);box-shadow:0 4px 16px #667eea66}.send-button:active:not(:disabled){transform:translateY(0)}.send-button:disabled{background:#d0d0d0;cursor:not-allowed;box-shadow:none;opacity:.6}@media (max-width: 768px){.ai-chat-container{max-width:100%;border-radius:0;height:100vh}.ai-chat-container:not(.fullscreen){width:100%!important}.resize-handle{display:none}.size-controls{display:none}.chat-header{padding:.875rem 1rem}.chat-header .header-left h2{font-size:1.125rem}.chat-header .status-indicator-icon{width:8px;height:8px}.control-button{width:36px;height:36px}.control-button .icon-svg{width:18px;height:18px}.message{max-width:85%}.message-content{font-size:.875rem}.upload-buttons{flex-direction:row}.input-container{flex-wrap:wrap}.send-button{min-width:90px;padding:.75rem 1.25rem}.send-button .text{display:none}.chat-input{padding:.875rem 1rem}}@media (max-width: 480px){.chat-header{flex-direction:column;align-items:flex-start;grid-gap:.625rem;gap:.625rem}.chat-header .header-controls{width:100%;justify-content:space-between}.control-button{width:34px;height:34px}.control-button .icon-svg{width:16px;height:16px}.message-content{padding:.625rem .875rem;font-size:.875rem}.attachments-preview{flex-direction:column}.attachment-item{width:100%}.attachment-item .attachment-name{max-width:120px}.send-button{padding:.75rem 1rem;min-width:80px}}.control-button:focus,.upload-button:focus,.send-button:focus,.clear-button:focus{outline:3px solid #667eea;outline-offset:2px}@media (prefers-contrast: high){.control-button,.upload-button,.send-button{border:2px solid currentColor}.message-content{border:2px solid currentColor}}@media (prefers-reduced-motion: reduce){*{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}.theme-dark{background:#2c2c2c;--icon-primary: #818cf8;--icon-secondary: #9ca3af;--icon-avatar-user: #818cf8;--icon-avatar-ai: #a78bfa;--icon-header: #e5e7eb;--icon-upload: #818cf8;--icon-send: #ffffff;--icon-active: #818cf8;--icon-disabled: #4b5563;--icon-hover: #6366f1}.theme-dark .chat-header{background:linear-gradient(135deg,#1a1a1a,#333)}.theme-dark .chat-messages{background:#2c2c2c}.theme-dark .ai-message .message-content{background:#3a3a3a;color:#fff;border-color:#555}.theme-dark .chat-input{background:#3a3a3a;border-color:#555}.theme-dark .inquiry-textarea{background:#2c2c2c;color:#fff;border-color:#555}.theme-dark .inquiry-textarea:focus{border-color:#667eea}.theme-dark .attachments-preview{background:#3a3a3a;border-color:#555}.theme-dark .attachment-item{background:#2c2c2c;border-color:#555;color:#fff}.theme-dark .upload-button{background:rgba(255,255,255,.1);border-color:#fff3}.theme-dark .upload-button:hover:not(:disabled){background:rgba(255,255,255,.2)}.theme-blue{background:#e3f2fd;--icon-primary: #1976d2;--icon-secondary: #546e7a;--icon-avatar-user: #1976d2;--icon-avatar-ai: #0288d1;--icon-header: #ffffff;--icon-upload: #1976d2;--icon-send: #ffffff;--icon-active: #1976d2;--icon-disabled: #b0bec5;--icon-hover: #1565c0}.theme-blue .chat-header{background:linear-gradient(135deg,#1976d2,#42a5f5)}.theme-blue .user-message .message-content{background:linear-gradient(135deg,#1976d2,#42a5f5)}.theme-blue .ai-message .message-content{border-color:#bbdefb}.theme-blue .inquiry-textarea:focus{border-color:#1976d2}.theme-blue .send-button{background:linear-gradient(135deg,#1976d2,#42a5f5)}.theme-blue .upload-button{background:rgba(25,118,210,.1);border-color:#1976d24d}.theme-blue .upload-button:hover:not(:disabled){background:rgba(25,118,210,.2)}.theme-green{background:#e8f5e8;--icon-primary: #388e3c;--icon-secondary: #546e7a;--icon-avatar-user: #388e3c;--icon-avatar-ai: #2e7d32;--icon-header: #ffffff;--icon-upload: #388e3c;--icon-send: #ffffff;--icon-active: #388e3c;--icon-disabled: #b0bec5;--icon-hover: #2e7d32}.theme-green .chat-header{background:linear-gradient(135deg,#388e3c,#66bb6a)}.theme-green .user-message .message-content{background:linear-gradient(135deg,#388e3c,#66bb6a)}.theme-green .ai-message .message-content{border-color:#c8e6c9}.theme-green .inquiry-textarea:focus{border-color:#388e3c}.theme-green .send-button{background:linear-gradient(135deg,#388e3c,#66bb6a)}.theme-green .upload-button{background:rgba(56,142,60,.1);border-color:#388e3c4d}.theme-green .upload-button:hover:not(:disabled){background:rgba(56,142,60,.2)}.theme-purple{background:#f3e5f5;--icon-primary: #7b1fa2;--icon-secondary: #6a1b9a;--icon-avatar-user: #7b1fa2;--icon-avatar-ai: #8e24aa;--icon-header: #ffffff;--icon-upload: #7b1fa2;--icon-send: #ffffff;--icon-active: #7b1fa2;--icon-disabled: #ce93d8;--icon-hover: #6a1b9a}.theme-purple .chat-header{background:linear-gradient(135deg,#7b1fa2,#ab47bc)}.theme-purple .user-message .message-content{background:linear-gradient(135deg,#7b1fa2,#ab47bc)}.theme-purple .ai-message .message-content{border-color:#e1bee7}.theme-purple .inquiry-textarea:focus{border-color:#7b1fa2}.theme-purple .send-button{background:linear-gradient(135deg,#7b1fa2,#ab47bc)}.theme-purple .upload-button{background:rgba(123,31,162,.1);border-color:#7b1fa24d}.theme-purple .upload-button:hover:not(:disabled){background:rgba(123,31,162,.2)}.theme-minimal{background:#fafafa;--icon-primary: #333333;--icon-secondary: #757575;--icon-avatar-user: #424242;--icon-avatar-ai: #616161;--icon-header: #333333;--icon-upload: #424242;--icon-send: #ffffff;--icon-active: #333333;--icon-disabled: #bdbdbd;--icon-hover: #212121}.theme-minimal .chat-header{background:#fff;color:#333;border-bottom:1px solid #e0e0e0}.theme-minimal .user-message .message-content{background:#007bff;color:#fff;border-radius:18px}.theme-minimal .ai-message .message-content{background:#f8f9fa;color:#333;border:1px solid #dee2e6}.theme-minimal .send-button{background:#007bff;border-radius:4px}.theme-minimal .upload-button{background:rgba(0,123,255,.1);border-color:#007bff4d}.theme-minimal .upload-button:hover:not(:disabled){background:rgba(0,123,255,.2)}.theme-corporate{background:#f8f9fa}.theme-corporate .chat-header{background:linear-gradient(135deg,#495057,#6c757d)}.theme-corporate .user-message .message-content{background:#495057}.theme-corporate .ai-message .message-content{background:#fff;border-color:#dee2e6}.theme-corporate .inquiry-textarea:focus{border-color:#495057}.theme-corporate .send-button{background:#495057}.theme-corporate .upload-button{background:rgba(73,80,87,.1);border-color:#4950574d}.theme-corporate .upload-button:hover:not(:disabled){background:rgba(73,80,87,.2)}.theme-red{background:#ffebee}.theme-red .chat-header{background:linear-gradient(135deg,#d32f2f,#f44336)}.theme-red .user-message .message-content{background:linear-gradient(135deg,#d32f2f,#f44336)}.theme-red .ai-message .message-content{border-color:#ffcdd2}.theme-red .inquiry-textarea:focus{border-color:#d32f2f}.theme-red .send-button{background:linear-gradient(135deg,#d32f2f,#f44336)}.theme-red .upload-button{background:rgba(211,47,47,.1);border-color:#d32f2f4d}.theme-red .upload-button:hover:not(:disabled){background:rgba(211,47,47,.2)}.theme-yellow{background:#fffde7}.theme-yellow .chat-header{background:linear-gradient(135deg,#f57f17,#ffb300)}.theme-yellow .user-message .message-content{background:linear-gradient(135deg,#f57f17,#ffb300)}.theme-yellow .ai-message .message-content{border-color:#fff9c4}.theme-yellow .inquiry-textarea:focus{border-color:#f57f17}.theme-yellow .send-button{background:linear-gradient(135deg,#f57f17,#ffb300)}.theme-yellow .upload-button{background:rgba(245,127,23,.1);border-color:#f57f174d}.theme-yellow .upload-button:hover:not(:disabled){background:rgba(245,127,23,.2)}.theme-orange{background:#fff3e0}.theme-orange .chat-header{background:linear-gradient(135deg,#e65100,#ff9800)}.theme-orange .user-message .message-content{background:linear-gradient(135deg,#e65100,#ff9800)}.theme-orange .ai-message .message-content{border-color:#ffe0b2}.theme-orange .inquiry-textarea:focus{border-color:#e65100}.theme-orange .send-button{background:linear-gradient(135deg,#e65100,#ff9800)}.theme-orange .upload-button{background:rgba(230,81,0,.1);border-color:#e651004d}.theme-orange .upload-button:hover:not(:disabled){background:rgba(230,81,0,.2)}\n"], directives: [{ type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i3.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
888
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: AiChatComponent, decorators: [{
889
+ type: Component,
890
+ args: [{
891
+ selector: 'emanate-ai-chat',
892
+ templateUrl: './ai-chat.component.html',
893
+ styleUrls: ['./ai-chat.component.scss']
894
+ }]
895
+ }], ctorParameters: function () { return [{ type: AiAgentService }, { type: i2.DomSanitizer }]; }, propDecorators: { title: [{
896
+ type: Input
897
+ }], placeholder: [{
898
+ type: Input
899
+ }], showDebugInfo: [{
900
+ type: Input
901
+ }], apiUrl: [{
902
+ type: Input
903
+ }], appKey: [{
904
+ type: Input
905
+ }], appSource: [{
906
+ type: Input
907
+ }], userId: [{
908
+ type: Input
909
+ }], firstName: [{
910
+ type: Input
911
+ }], userName: [{
912
+ type: Input
913
+ }], templateDesign: [{
914
+ type: Input
915
+ }], welcomeMessage: [{
916
+ type: Input
917
+ }], historicalMessages: [{
918
+ type: Input
919
+ }], conversationId: [{
920
+ type: Input
921
+ }], enableImageUpload: [{
922
+ type: Input
923
+ }], enableFileUpload: [{
924
+ type: Input
925
+ }], iconSet: [{
926
+ type: Input
927
+ }], customIcons: [{
928
+ type: Input
929
+ }], messageReceived: [{
930
+ type: Output
931
+ }], messageSent: [{
932
+ type: Output
933
+ }], fileUploaded: [{
934
+ type: Output
935
+ }], sizeChanged: [{
936
+ type: Output
937
+ }] } });
938
+
939
+ class EmanateAiChatLibModule {
940
+ }
941
+ EmanateAiChatLibModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: EmanateAiChatLibModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
942
+ EmanateAiChatLibModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: EmanateAiChatLibModule, declarations: [EmanateAiChatLibComponent,
943
+ AiChatComponent], imports: [CommonModule,
944
+ FormsModule,
945
+ HttpClientModule], exports: [EmanateAiChatLibComponent,
946
+ AiChatComponent] });
947
+ EmanateAiChatLibModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: EmanateAiChatLibModule, providers: [
948
+ AiAgentService
949
+ ], imports: [[
950
+ CommonModule,
951
+ FormsModule,
952
+ HttpClientModule
953
+ ]] });
954
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: EmanateAiChatLibModule, decorators: [{
955
+ type: NgModule,
956
+ args: [{
957
+ declarations: [
958
+ EmanateAiChatLibComponent,
959
+ AiChatComponent
960
+ ],
961
+ imports: [
962
+ CommonModule,
963
+ FormsModule,
964
+ HttpClientModule
965
+ ],
966
+ providers: [
967
+ AiAgentService
968
+ ],
969
+ exports: [
970
+ EmanateAiChatLibComponent,
971
+ AiChatComponent
972
+ ]
973
+ }]
974
+ }] });
975
+
976
+ /*
977
+ * Public API Surface of emanate-ai-chat-lib
978
+ */
979
+
980
+ /**
981
+ * Generated bundle index. Do not edit.
982
+ */
983
+
984
+ export { AiAgentService, AiChatComponent, BOOTSTRAP_ICONS, EmanateAiChatLibComponent, EmanateAiChatLibModule, EmanateAiChatLibService, FEATHER_ICONS, HEROICONS, LUCIDE_ICONS, MATERIAL_ICONS, getIconSet };
985
+ //# sourceMappingURL=emanate-ai-chat-lib.js.map