andy-widget-vanilla 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +89 -0
  2. package/dist/bundle.js +2140 -0
  3. package/package.json +43 -0
package/dist/bundle.js ADDED
@@ -0,0 +1,2140 @@
1
+ (()=>{var j={0:"0",1:"0.25rem",2:"0.5rem",3:"0.75rem",4:"1rem",5:"1.25rem",6:"1.5rem",8:"2rem",10:"2.5rem",12:"3rem",16:"4rem",20:"5rem",24:"6rem",32:"8rem"};var Ue={bubbleSize:"60px",windowWidth:"480px",windowHeight:"680px",windowMinWidth:"320px",windowMinHeight:"400px",messageMaxWidth:"80%",messagePadding:j[3],messageGap:j[2],avatarSize:"32px",avatarSizeSmall:"24px"};var u={FORM_DISPLAY_DELAY_MS:1e3,PERSIST_SESSION:!1,SESSION_STORAGE_KEY:"andy-chat-session-id",DEFAULT_API_BASE_URL:"http://localhost:3000/api",PRODUCTION_API_BASE_URL:"https://app.andypartner.com/api",EMBED_ID_SOURCES:["ANDY_CHATBOT_ID","data-andy-embed-id","data-embed-id","andy-embed-id"],API_TIMEOUT_MS:1e4,MAX_MESSAGE_LENGTH:2e3,MAX_RETRIES:3,RETRY_DELAY_MS:1e3,WELCOME_POPUP_DEFAULT_DELAY:3e3,TYPING_INDICATOR_DELAY:500,MESSAGE_ANIMATION_DURATION:300,ENVIRONMENTS:{DEVELOPMENT:"development",PRODUCTION:"production"}},Y=null,V=!1,Q=t=>t?t==="localhost"||t==="127.0.0.1"||t==="::1"||t==="0.0.0.0"||t.startsWith("192.168."):!1,fe=t=>t?/:\/\/(localhost|127\.0\.0\.1|\[::1\]|0\.0\.0\.0|192\.168\.)/i.test(t):!1,K=t=>{if(t==null||typeof t!="string")return null;let e=t.trim();if(!e)return null;if(e.startsWith("/"))return e.replace(/\/+$/,"");let a;try{a=new URL(e)}catch{return null}return a.protocol!=="http:"&&a.protocol!=="https:"?null:e.replace(/\/+$/,"")},ve=()=>{if(typeof document>"u")return null;let t=document.querySelectorAll("script");for(let e of t){let a=e.src||"";if(!a.includes("andychat")&&!a.includes("andy-chat")&&!a.includes("bundle"))continue;let n=e.getAttribute("data-andy-api-url")||e.getAttribute("data-api-url");if(n&&n.trim())return n.trim()}for(let e of t){let a=e.getAttribute("data-andy-api-url")||e.getAttribute("data-api-url");if(a&&a.trim())return a.trim()}return null};var M=()=>{if(typeof window<"u"&&window.ANDY_CHAT_ENV){let t=String(window.ANDY_CHAT_ENV).trim().toLowerCase();if(t===u.ENVIRONMENTS.DEVELOPMENT)return u.ENVIRONMENTS.DEVELOPMENT;if(t===u.ENVIRONMENTS.PRODUCTION)return u.ENVIRONMENTS.PRODUCTION}if(typeof window<"u"&&window.location){let t=window.location.hostname||"";if(Q(t))return u.ENVIRONMENTS.DEVELOPMENT}return u.ENVIRONMENTS.PRODUCTION},_=()=>{if(Y)return Y;if(typeof window<"u"&&window.ANDY_CHAT_API_URL){let n=K(window.ANDY_CHAT_API_URL);if(n)return n}let t=ve();if(t){let n=K(t);if(n)return n}let a=M()===u.ENVIRONMENTS.DEVELOPMENT?u.DEFAULT_API_BASE_URL:u.PRODUCTION_API_BASE_URL;return!V&&typeof window<"u"&&window.location&&!Q(window.location.hostname||"")&&fe(a)&&(V=!0,console.warn("AndyChat: resolved a localhost API URL on a non-local hostname. Set window.ANDY_CHAT_API_URL or data-andy-api-url to fix.")),a},N=t=>{if(!t)return null;let e=["data-andy-embed-id","data-embed-id","data-chatbot-id","andy-embed-id","embed-id"];for(let a of e){let n=t.getAttribute(a);if(n&&n.trim())return n.trim()}return null},xe=()=>{if(typeof window>"u"||!window.location)return null;let t=new URLSearchParams(window.location.search),e=["andy-embed-id","embed-id","chatbot-id","andy_embed_id"];for(let a of e){let n=t.get(a);if(n&&n.trim())return n.trim()}return null},we=()=>{if(typeof document>"u")return null;let t=["andy:embed-id","andy-embed-id","chatbot-embed-id","andy:chatbot-id"];for(let e of t){let a=document.querySelector(`meta[name="${e}"], meta[property="${e}"]`);if(a){let n=a.getAttribute("content");if(n&&n.trim())return n.trim()}}return null},_e=()=>{if(typeof window<"u"&&window.ANDY_CHATBOT_ID){let a=window.ANDY_CHATBOT_ID;if(typeof a=="string"&&a.trim())return a.trim()}if(typeof document<"u"){let a=document.querySelectorAll("script");for(let n of a){let o=n.src||"";if(o.includes("andychat")||o.includes("andy-chat")){let i=N(n);if(i)return i}}for(let n of a){let o=N(n);if(o)return o}}let t=xe();if(t)return t;let e=we();if(e)return e;if(typeof document<"u"){let a=document.body,n=document.documentElement;for(let o of[a,n])if(o){let i=N(o);if(i)return i}}return console.warn("AndyChat: No embed ID found. Please ensure ANDY_CHATBOT_ID is set or use data-andy-embed-id attribute."),null},A=t=>{if(!t||typeof t!="string")return!1;let e=t.trim();return!(e.length<3||e.length>100||!/^[a-zA-Z0-9\-_]+$/.test(e))},G=t=>{let e=[];if(!t||typeof t!="object")return{isValid:!1,errors:["Configuration must be an object"]};if((!t.name||typeof t.name!="string"||t.name.trim().length===0)&&e.push("Configuration must have a valid name"),t.brandColor&&typeof t.brandColor=="string"&&(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(t.brandColor)||e.push("Brand color must be a valid hex color (e.g., #3B82F6)")),t.logoUrl&&typeof t.logoUrl=="string")try{new URL(t.logoUrl)}catch{e.push("Logo URL must be a valid URL")}return t.orientation&&!["left","right"].includes(t.orientation)&&e.push('Orientation must be either "left" or "right"'),t.faqs&&!Array.isArray(t.faqs)?e.push("FAQs must be an array"):t.faqs&&t.faqs.forEach((a,n)=>{(!a.question||!a.answer)&&e.push(`FAQ item ${n+1} must have both question and answer`)}),t.showWelcomePopup&&typeof t.showWelcomePopup=="object"&&(typeof t.showWelcomePopup.enabled!="boolean"&&e.push('Welcome popup "enabled" must be a boolean'),t.showWelcomePopup.seconds&&typeof t.showWelcomePopup.seconds!="number"&&e.push('Welcome popup "seconds" must be a number')),t.collectUserInfo&&typeof t.collectUserInfo=="object"&&typeof t.collectUserInfo.enabled!="boolean"&&e.push('User info collection "enabled" must be a boolean'),{isValid:e.length===0,errors:e}},Z=t=>{if(!t||typeof t!="object")return{};let e={...t};return e.name&&typeof e.name=="string"&&(e.name=e.name.trim()),e.headline&&typeof e.headline=="string"&&(e.headline=e.headline.trim()),e.description&&typeof e.description=="string"&&(e.description=e.description.trim()),e.welcomeMessage&&typeof e.welcomeMessage=="string"&&(e.welcomeMessage=e.welcomeMessage.trim()),e.brandColor&&typeof e.brandColor=="string"&&(e.brandColor=e.brandColor.trim().toUpperCase(),e.brandColor&&!e.brandColor.startsWith("#")&&(e.brandColor="#"+e.brandColor)),e.orientation&&typeof e.orientation=="string"&&(e.orientation=e.orientation.toLowerCase(),["left","right"].includes(e.orientation)||(e.orientation="right")),e.logoUrl&&typeof e.logoUrl=="string"&&(e.logoUrl=e.logoUrl.trim()),e},X=(t="unknown")=>{let e=_e();return e?A(e)?{success:!0,embedId:e,environment:M(),apiBaseUrl:_(),config:u}:(console.error(`AndyChat ${t}: Invalid embed ID format: ${e}`),{success:!1,error:"Invalid embed ID format",embedId:e,environment:M(),apiBaseUrl:_()}):(console.error(`AndyChat ${t}: No embed ID found`),{success:!1,error:"No embed ID found",embedId:null,environment:M(),apiBaseUrl:_()})};var ke={id:null,name:"AndyChat",theme:"light",logoUrl:"",headline:"Chat with our AI",brandColor:"#3B82F6",description:"Ask any question and our AI will answer!",orientation:"right",bubbleStyle:"icon",bubbleLabel:null,useBrandColor:!0,defaultLang:"en",showBranding:!0,showWelcomePopup:{enabled:!1,seconds:3,message:"Welcome! How can I help you today?"},collectUserInfo:{enabled:!1,message:"Let's get your name and email so we can follow up with you later."},welcomeMessage:"Hi there! I am the AI Assistant. How can I help you today?",predefinedQuestions:[],faqs:[]},q=t=>t==="es"?"Pregunta IA":"Ask AI",Ce=(t,e)=>{if(!t||typeof t!="object"||Array.isArray(t)||!t.chatbot||typeof t.chatbot!="object"||Array.isArray(t.chatbot)||!A(t.chatbot.id))throw new Error("Invalid chatbot configuration response.");let{chatbot:a,faqs:n}=t,o=a.appearance||{},i=a.behavior||{},r={...e};return r.id=a.id??e.id,r.name=a.name??e.name,r.defaultLang=a.defaultLang??e.defaultLang,r.theme=o.theme??e.theme,r.logoUrl=o.logoUrl??e.logoUrl,r.headline=o.headline??e.headline,r.brandColor=o.brandColor??e.brandColor,r.description=o.description??e.description,r.orientation=o.orientation??e.orientation,r.welcomeMessage=o.welcomeMessage??e.welcomeMessage,r.bubbleStyle=o.bubbleStyle??e.bubbleStyle,r.bubbleLabel=o.bubbleLabel??e.bubbleLabel,r.useBrandColor=o.useBrandColor??e.useBrandColor,r.showBranding=a.showBranding??e.showBranding,typeof i.showWelcomePopup=="object"&&i.showWelcomePopup!==null?r.showWelcomePopup={...e.showWelcomePopup,...i.showWelcomePopup}:r.showWelcomePopup={...e.showWelcomePopup},r.showWelcomePopup.enabled&&typeof r.showWelcomePopup.message>"u"&&(r.showWelcomePopup.message=e.showWelcomePopup.message),r.collectUserInfo={enabled:!1,message:i.collectUserInfo?.message??e.collectUserInfo.message},r.predefinedQuestions=[],i.predefinedQuestions&&Array.isArray(i.predefinedQuestions)&&(r.predefinedQuestions=i.predefinedQuestions.filter(s=>s&&typeof s.question=="string").sort((s,d)=>(s.order||0)-(d.order||0))),r.faqs=[],n&&Array.isArray(n)&&(r.faqs=n.map(s=>({question:s.question??s.title,answer:s.answer??s.content})).filter(s=>typeof s.question=="string"&&s.question.trim().length>0&&typeof s.answer=="string"&&s.answer.trim().length>0).map(s=>({question:s.question.trim(),answer:s.answer.trim()}))),r},J=async t=>{try{let e=_(),a=await fetch(`${e}/chatbot/${t}`);if(!a.ok){let i=`Failed to load chatbot config: ${a.status}`;try{let r=await a.json();r&&r.error?i=r.error:r&&r.message&&(i=r.message)}catch{}throw new Error(i)}let n=await a.json();return Ce(n,ke)}catch(e){throw console.error("AndyChat: Failed to load configuration."),e}},H=async(t,e,a)=>{try{let n=_(),o=await fetch(`${n}/messages`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({chatbotId:t,sessionId:e,currentUserMessage:{role:"user",content:a}})});if(o.ok){let i=await o.json();if(i.error||i.limitStatus)throw new Error(i.error||"Chat is temporarily unavailable.");if(typeof i.botResponse!="string"||!i.botResponse.trim())throw new Error("Unexpected response format from server.");return i.botResponse}else{let i;try{i=await o.json()}catch{let s=o.text?await o.text():"";throw new Error(o.statusText||`Server returned an error. ${s}`.trim())}throw new Error(i.error||i.message||o.statusText||"Server returned an error.")}}catch(n){throw console.error("AndyChat: Message request failed."),n}},ee=async(t,e,a)=>{throw new Error("Visitor information collection is not supported by this Widget release.")};var I=()=>crypto&&crypto.randomUUID?crypto.randomUUID():`andy-${Date.now()}-${Math.random().toString(36).substring(2,15)}`,Ae=t=>{if(!t)return"#";let e=t.trim(),a=e.toLowerCase();return a.startsWith("http://")||a.startsWith("https://")||a.startsWith("mailto:")||a.startsWith("tel:")?e:!a.includes(":")&&!a.startsWith("//")?"https://"+e:"#"},te=t=>{if(!t)return"";let e=t;e=e.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(o,i,r)=>{let s=Ae(r),l=s.startsWith("http://")||s.startsWith("https://")?' target="_blank" rel="noopener noreferrer"':"";return`<a href="${s}" class="andy-message-link"${l}>${i}</a>`}),e=e.replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>"),e=e.replace(/__(.*?)__/g,"<strong>$1</strong>"),e=e.replace(/\*([^*\n]+)\*/g,"<em>$1</em>"),e=e.replace(/_([^_\n]+)_/g,"<em>$1</em>");let a=e.split(`
2
+
3
+ `),n=[];for(let o of a){if(o=o.trim(),!o)continue;let i=o.split(`
4
+ `),r=!1,s=null,d=[],l=[];for(let c of i)if(c=c.trim(),/^#{1,6}\s+/.test(c)){l.length>0&&(n.push("<p>"+l.join("<br>")+"</p>"),l=[]),r&&(s==="ol"?n.push(`<ol>${d.join("")}</ol>`):n.push(`<ul>${d.join("")}</ul>`),r=!1,s=null,d=[]);let y=c.match(/^(#{1,6})\s+(.+)$/);if(y){let b=y[1].length,p=y[2].trim();n.push(`<h${b}>${p}</h${b}>`)}}else if(/^\d+\.\s+/.test(c)){l.length>0&&(n.push("<p>"+l.join("<br>")+"</p>"),l=[]),r&&s!=="ol"&&(n.push(`<ul>${d.join("")}</ul>`),d=[]),r=!0,s="ol";let y=c.replace(/^\d+\.\s+/,"");d.push(`<li>${y}</li>`)}else if(/^\*\s+/.test(c)){l.length>0&&(n.push("<p>"+l.join("<br>")+"</p>"),l=[]),r&&s!=="ul"&&(n.push(`<ol>${d.join("")}</ol>`),d=[]),r=!0,s="ul";let y=c.replace(/^\*\s+/,"");d.push(`<li>${y}</li>`)}else r&&(s==="ol"?n.push(`<ol>${d.join("")}</ol>`):n.push(`<ul>${d.join("")}</ul>`),r=!1,s=null,d=[]),c&&l.push(c);r?s==="ol"?n.push(`<ol>${d.join("")}</ol>`):n.push(`<ul>${d.join("")}</ul>`):l.length>0&&n.push("<p>"+l.join("<br>")+"</p>")}return n.join("")},E=t=>t?typeof t.welcomeMessage=="string"&&t.welcomeMessage.trim()!==""?t.welcomeMessage:t.name?`Hi there \u{1F44B}
5
+ I'm the AI Assistant created by ${t.name}!
6
+
7
+ Is there anything I can help you with?`:null:null;var Ie=t=>{let e=t.replace("#",""),a=e.length===3?e.split("").map(l=>l+l).join(""):e,n=parseInt(a.slice(0,2),16)/255,o=parseInt(a.slice(2,4),16)/255,i=parseInt(a.slice(4,6),16)/255,[r,s,d]=[n,o,i].map(l=>l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4));return .2126*r+.7152*s+.0722*d},Ee=t=>Ie(t)>.5,Le=t=>Ee(t)?"#000000":"#FFFFFF",Se=()=>`
8
+ /* AndyChat Design Tokens as CSS Custom Properties */
9
+ :host {
10
+ /* === COLOR TOKENS === */
11
+
12
+ /* Primary brand colors */
13
+ --andy-color-primary: #3b82f6;
14
+ --andy-color-primary-hover: #2563eb;
15
+ --andy-color-primary-light: #ebf4ff;
16
+
17
+ /* Basic colors */
18
+ --andy-color-white: #ffffff;
19
+ --andy-color-black: #000000;
20
+
21
+ /* Neutral grays */
22
+ --andy-color-gray-100: #f7fafc;
23
+ --andy-color-gray-200: #edf2f7;
24
+ --andy-color-gray-300: #e2e8f0;
25
+ --andy-color-gray-400: #cbd5e0;
26
+ --andy-color-gray-500: #a0adb8;
27
+ --andy-color-gray-600: #718096;
28
+ --andy-color-gray-700: #4a5568;
29
+ --andy-color-gray-800: #2d3748;
30
+ --andy-color-gray-900: #1a202c;
31
+
32
+ /* Semantic colors */
33
+ --andy-color-success: #48bb78;
34
+ --andy-color-warning: #ed8936;
35
+ --andy-color-error: #f56565;
36
+ --andy-color-error-light: #fed7d7;
37
+ --andy-color-info: #4299e1;
38
+
39
+ /* UI semantic colors */
40
+ --andy-color-background: #f9fafc;
41
+ --andy-color-text: #2d3748;
42
+ --andy-color-text-secondary: #4a5568;
43
+ --andy-color-text-muted: #718096;
44
+ --andy-color-border: #e2e8f0;
45
+ --andy-color-hover: #f7fafc;
46
+
47
+ /* Input specific colors */
48
+ --andy-color-input-background: #f5f5f5;
49
+ --andy-color-input-button: #f0f0f0;
50
+ --andy-color-input-button-hover: #e0e0e0;
51
+
52
+ /* Chat specific colors */
53
+ --andy-color-user-message: #3b82f6;
54
+ --andy-color-bot-message: #f5f5f5;
55
+ --andy-color-user-message-text: #ffffff;
56
+ --andy-color-bot-message-text: #2d3748;
57
+
58
+ /* Dark theme colors */
59
+ --andy-color-background-dark: #1a1a1a;
60
+ --andy-color-background-secondary-dark: #2c2c2c;
61
+ --andy-color-background-tertiary-dark: #383838;
62
+ --andy-color-text-dark: #e0e0e0;
63
+ --andy-color-text-muted-dark: #a0a0a0;
64
+ --andy-color-border-dark: #444444;
65
+ --andy-color-hover-dark: #4a4a4a;
66
+
67
+ /* === TYPOGRAPHY TOKENS === */
68
+ --andy-font-family-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
69
+ --andy-font-family-mono: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
70
+ --andy-font-size-xs: 0.75rem;
71
+ --andy-font-size-sm: 0.875rem;
72
+ --andy-font-size-base: 1rem;
73
+ --andy-font-size-lg: 1.125rem;
74
+ --andy-font-size-xl: 1.25rem;
75
+ --andy-font-size-2xl: 1.5rem;
76
+ --andy-font-size-3xl: 1.875rem;
77
+ --andy-font-weight-normal: 400;
78
+ --andy-font-weight-medium: 500;
79
+ --andy-font-weight-semibold: 600;
80
+ --andy-font-weight-bold: 700;
81
+ --andy-line-height-tight: 1.25;
82
+ --andy-line-height-normal: 1.4;
83
+ --andy-line-height-relaxed: 1.625;
84
+
85
+ /* === SPACING TOKENS === */
86
+ --andy-spacing-0: 0;
87
+ --andy-spacing-1: 0.25rem;
88
+ --andy-spacing-2: 0.5rem;
89
+ --andy-spacing-3: 0.75rem;
90
+ --andy-spacing-4: 1rem;
91
+ --andy-spacing-5: 1.25rem;
92
+ --andy-spacing-6: 1.5rem;
93
+ --andy-spacing-8: 2rem;
94
+ --andy-spacing-10: 2.5rem;
95
+ --andy-spacing-12: 3rem;
96
+ --andy-spacing-16: 4rem;
97
+ --andy-spacing-20: 5rem;
98
+ --andy-spacing-24: 6rem;
99
+ --andy-spacing-32: 8rem;
100
+
101
+ /* === BORDER RADIUS TOKENS === */
102
+ --andy-radius-none: 0;
103
+ --andy-radius-sm: 0.125rem;
104
+ --andy-radius-base: 0.25rem;
105
+ --andy-radius-md: 0.375rem;
106
+ --andy-radius-lg: 0.5rem;
107
+ --andy-radius-xl: 1rem;
108
+ --andy-radius-2xl: 1rem;
109
+ --andy-radius-full: 9999px;
110
+
111
+ /* === SHADOW TOKENS === */
112
+ --andy-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
113
+ --andy-shadow-base: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
114
+ --andy-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
115
+ --andy-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
116
+ --andy-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
117
+ --andy-shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
118
+
119
+ /* === Z-INDEX TOKENS === */
120
+ --andy-z-dropdown: 1000;
121
+ --andy-z-sticky: 1020;
122
+ --andy-z-fixed: 1030;
123
+ --andy-z-modal-backdrop: 1040;
124
+ --andy-z-modal: 1050;
125
+ --andy-z-popover: 1060;
126
+ --andy-z-tooltip: 1070;
127
+ --andy-z-toast: 1080;
128
+
129
+ /* === BREAKPOINT TOKENS === */
130
+ --andy-breakpoint-sm: 640px;
131
+ --andy-breakpoint-md: 768px;
132
+ --andy-breakpoint-lg: 1024px;
133
+ --andy-breakpoint-xl: 1280px;
134
+ --andy-breakpoint-2xl: 1536px;
135
+
136
+ /* === ANIMATION TOKENS === */
137
+ --andy-duration-fast: 150ms;
138
+ --andy-duration-normal: 300ms;
139
+ --andy-duration-slow: 500ms;
140
+ --andy-easing-linear: linear;
141
+ --andy-easing-ease-in: cubic-bezier(0.4, 0, 1, 1);
142
+ --andy-easing-ease-out: cubic-bezier(0, 0, 0.2, 1);
143
+ --andy-easing-ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
144
+
145
+ /* === CHAT SPECIFIC TOKENS === */
146
+ --andy-chat-bubble-size: 50px;
147
+ --andy-chat-window-width: 400px;
148
+ --andy-chat-window-height: min(664px, 100% - 104px);
149
+ --andy-chat-window-min-width: 320px;
150
+ --andy-chat-window-min-height: 400px;
151
+ --andy-chat-message-max-width: 80%;
152
+ --andy-chat-message-padding: var(--andy-spacing-2);
153
+ --andy-chat-message-gap: var(--andy-spacing-3);
154
+ --andy-chat-avatar-size: 32px;
155
+ --andy-chat-avatar-size-small: 24px;
156
+
157
+ /* Keyboard handling */
158
+ --andy-keyboard-height: 0px;
159
+
160
+ /* === THEMABLE VARIABLES (Default Light Theme) === */
161
+ --andy-themable-background: var(--andy-color-background);
162
+ --andy-themable-background-secondary: var(--andy-color-white);
163
+ --andy-themable-background-tertiary: var(--andy-color-gray-100);
164
+ --andy-themable-text: var(--andy-color-text);
165
+ --andy-themable-text-secondary: var(--andy-color-text-secondary);
166
+ --andy-themable-text-muted: var(--andy-color-text-muted);
167
+ --andy-themable-border: var(--andy-color-border);
168
+ --andy-themable-hover: var(--andy-color-hover);
169
+ --andy-themable-shadow: rgba(0, 0, 0, 0.1);
170
+ --andy-themable-shadow-light: rgba(0, 0, 0, 0.08);
171
+ --andy-themable-button-primary-bg: var(--andy-color-primary);
172
+ --andy-themable-button-primary-text: var(--andy-color-white);
173
+ --andy-themable-button-primary-hover: var(--andy-color-primary-hover);
174
+ --andy-themable-button-secondary-bg: var(--andy-color-gray-200);
175
+ --andy-themable-button-secondary-text: var(--andy-color-text);
176
+ --andy-themable-button-secondary-hover: var(--andy-color-gray-300);
177
+ --andy-themable-input-bg: var(--andy-color-input-background);
178
+ --andy-themable-input-border: var(--andy-color-border);
179
+ --andy-themable-input-text: var(--andy-color-text);
180
+ --andy-themable-input-placeholder: var(--andy-color-text-muted);
181
+ --andy-themable-message-user-bg: var(--andy-color-user-message);
182
+ --andy-themable-message-user-text: var(--andy-color-user-message-text);
183
+ --andy-themable-message-bot-bg: var(--andy-color-bot-message);
184
+ --andy-themable-message-bot-text: var(--andy-color-bot-message-text);
185
+ --andy-themable-message-bot-border: transparent;
186
+ --andy-themable-avatar-bg: var(--andy-color-primary);
187
+ --andy-themable-avatar-text: var(--andy-color-white);
188
+ --andy-themable-tooltip-bg: var(--andy-color-gray-800);
189
+ --andy-themable-tooltip-text: var(--andy-color-white);
190
+ }
191
+ `,Te=()=>`
192
+ /* Base Styles */
193
+ *,
194
+ *::before,
195
+ *::after {
196
+ box-sizing: border-box;
197
+ }
198
+
199
+ :host {
200
+ font-family: var(--andy-font-family-primary);
201
+ font-size: var(--andy-font-size-base);
202
+ line-height: var(--andy-line-height-normal);
203
+ color: var(--andy-themable-text);
204
+ -webkit-font-smoothing: antialiased;
205
+ -moz-osx-font-smoothing: grayscale;
206
+ }
207
+
208
+ /* Keyframes */
209
+ @keyframes andy-loader {
210
+ 0% { transform: rotate(0deg); }
211
+ 100% { transform: rotate(360deg); }
212
+ }
213
+
214
+ @keyframes andy-dot-pulse {
215
+ 0%, 100% { transform: scale(1); opacity: 0.7; }
216
+ 50% { transform: scale(1.1); opacity: 1; }
217
+ }
218
+
219
+ @keyframes andy-fade-in-slide-up {
220
+ from { opacity: 0; transform: translateY(20px); }
221
+ to { opacity: 1; transform: translateY(0); }
222
+ }
223
+
224
+ @keyframes andy-message-slide-in {
225
+ from { opacity: 0; transform: translateY(10px); }
226
+ to { opacity: 1; transform: translateY(0); }
227
+ }
228
+
229
+ /* Chat Bubble */
230
+ .andy-chat-bubble {
231
+ position: fixed;
232
+ bottom: 30px;
233
+ right: 30px;
234
+ width: var(--andy-chat-bubble-size);
235
+ height: var(--andy-chat-bubble-size);
236
+ z-index: var(--andy-z-fixed);
237
+ background: var(--andy-themable-button-primary-bg);
238
+ border: none;
239
+ border-radius: var(--andy-radius-full);
240
+ box-shadow: var(--andy-shadow-lg);
241
+ display: flex;
242
+ align-items: center;
243
+ justify-content: center;
244
+ cursor: pointer;
245
+ color: var(--andy-themable-button-primary-text);
246
+ outline: none;
247
+ transition: all var(--andy-duration-normal) var(--andy-easing-ease-out);
248
+ /* Hidden until config loads */
249
+ opacity: 0;
250
+ pointer-events: none;
251
+ }
252
+
253
+ /* Show bubble once config is loaded */
254
+ .andy-chat-bubble--loaded {
255
+ opacity: 1;
256
+ pointer-events: auto;
257
+ }
258
+
259
+ .andy-chat-bubble:hover {
260
+ background: var(--andy-themable-button-primary-hover);
261
+ transform: scale(1.05);
262
+ }
263
+
264
+ .andy-chat-bubble__icon {
265
+ width: 28px;
266
+ height: 28px;
267
+ flex-shrink: 0;
268
+ color: currentColor;
269
+ fill: currentColor;
270
+ /* Filter to convert black image to white */
271
+ filter: brightness(0) invert(1);
272
+ }
273
+
274
+ .andy-chat-bubble__logo {
275
+ width: 50px;
276
+ height: 50px;
277
+ border-radius: var(--andy-radius-full);
278
+ object-fit: cover;
279
+ flex-shrink: 0;
280
+ }
281
+
282
+ /* === PILL STYLE VARIANT === */
283
+
284
+ /* Pill-shaped bubble with label */
285
+ .andy-chat-bubble--pill {
286
+ width: auto;
287
+ height: auto;
288
+ padding: 12px 16px 12px 20px;
289
+ border-radius: 9999px;
290
+ gap: 8px;
291
+ background: var(--andy-themable-button-primary-bg);
292
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
293
+ transition: all 0.2s ease;
294
+ }
295
+
296
+ .andy-chat-bubble--pill:hover {
297
+ background: var(--andy-themable-button-primary-hover);
298
+ transform: scale(1.05);
299
+ }
300
+
301
+ .andy-chat-bubble--pill:active {
302
+ transform: translateY(0) scale(0.98);
303
+ }
304
+
305
+ /* Label text styling */
306
+ .andy-chat-bubble__label {
307
+ color: var(--andy-themable-button-primary-text);
308
+ font-size: 14px;
309
+ font-weight: 500;
310
+ white-space: nowrap;
311
+ line-height: 1;
312
+ }
313
+
314
+ /* Icon styling for pill variant */
315
+ .andy-chat-bubble__icon--pill {
316
+ width: 26px !important;
317
+ height: 26px !important;
318
+ flex-shrink: 0;
319
+ border-radius: 50%;
320
+ object-fit: cover;
321
+ }
322
+
323
+ /* Ensure pill icon sizing is enforced */
324
+ .andy-chat-bubble--pill .andy-chat-bubble__icon--pill {
325
+ width: 26px !important;
326
+ height: 26px !important;
327
+ max-width: 26px;
328
+ max-height: 26px;
329
+ filter: none;
330
+ }
331
+
332
+ /* When open, pill collapses to icon only */
333
+ .andy-chat-bubble--pill.andy-chat-bubble--open {
334
+ width: var(--andy-chat-bubble-size);
335
+ height: var(--andy-chat-bubble-size);
336
+ padding: 0;
337
+ justify-content: center;
338
+ }
339
+
340
+ .andy-chat-bubble--pill.andy-chat-bubble--open .andy-chat-bubble__label {
341
+ display: none;
342
+ }
343
+
344
+ /* Chat Bubble Tooltip */
345
+ .andy-chat-bubble__tooltip {
346
+ position: absolute;
347
+ bottom: calc(100% + 10px);
348
+ right: 50%;
349
+ transform: translateX(50%);
350
+ background: var(--andy-themable-tooltip-bg);
351
+ color: var(--andy-themable-tooltip-text);
352
+ padding: var(--andy-spacing-2) var(--andy-spacing-3);
353
+ border-radius: var(--andy-radius-md);
354
+ font-size: var(--andy-font-size-sm);
355
+ white-space: nowrap;
356
+ pointer-events: none;
357
+ opacity: 0;
358
+ visibility: hidden;
359
+ transition: opacity var(--andy-duration-fast) var(--andy-easing-ease-out),
360
+ visibility var(--andy-duration-fast) var(--andy-easing-ease-out);
361
+ box-shadow: var(--andy-shadow-md);
362
+ z-index: calc(var(--andy-z-fixed) + 10);
363
+ }
364
+
365
+ /* Tooltip arrow */
366
+ .andy-chat-bubble__tooltip::after {
367
+ content: '';
368
+ position: absolute;
369
+ top: 100%;
370
+ right: 50%;
371
+ transform: translateX(50%);
372
+ border: 6px solid transparent;
373
+ border-top-color: var(--andy-themable-tooltip-bg);
374
+ }
375
+
376
+ /* Show tooltip on hover */
377
+ .andy-chat-bubble:hover .andy-chat-bubble__tooltip {
378
+ opacity: 1;
379
+ visibility: visible;
380
+ }
381
+
382
+ /* Adjust tooltip position for left orientation */
383
+ :host(.andy-orientation-left) .andy-chat-bubble__tooltip {
384
+ right: auto;
385
+ left: 50%;
386
+ transform: translateX(-50%);
387
+ }
388
+
389
+ :host(.andy-orientation-left) .andy-chat-bubble__tooltip::after {
390
+ right: auto;
391
+ left: 50%;
392
+ transform: translateX(-50%);
393
+ }
394
+
395
+ /* Chat Window */
396
+ .andy-chat-window {
397
+ position: fixed;
398
+ bottom: calc(var(--andy-chat-bubble-size) + 40px + var(--andy-spacing-2));
399
+ right: 25px;
400
+ width: var(--andy-chat-window-width);
401
+ min-width: var(--andy-chat-window-min-width);
402
+ height: var(--andy-chat-window-height);
403
+ min-height: var(--andy-chat-window-min-height);
404
+ background: var(--andy-themable-background-secondary);
405
+ border-radius: var(--andy-radius-xl);
406
+ box-shadow: var(--andy-shadow-xl);
407
+ z-index: 9999;
408
+ display: flex;
409
+ flex-direction: column;
410
+ overflow: hidden;
411
+ opacity: 0;
412
+ transform: translateY(20px);
413
+ pointer-events: none;
414
+ transition: all var(--andy-duration-normal) var(--andy-easing-ease-out);
415
+ }
416
+
417
+ .andy-chat-window--open {
418
+ opacity: 1;
419
+ transform: translateY(0);
420
+ pointer-events: all;
421
+ }
422
+
423
+ /* Header */
424
+ .andy-header {
425
+ display: flex;
426
+ align-items: center;
427
+ justify-content: space-between;
428
+ padding: 16px 20px;
429
+ background: var(--andy-themable-background-secondary);
430
+ color: var(--andy-themable-text);
431
+ border-bottom: 1px solid var(--andy-themable-border);
432
+ height: 60px;
433
+ position: relative;
434
+ box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.04);
435
+ }
436
+
437
+ .andy-header__back {
438
+ display: none; /* Hide back arrow as requested */
439
+ }
440
+
441
+ .andy-header__back:hover {
442
+ background: var(--andy-themable-hover);
443
+ }
444
+
445
+ .andy-header__bot-info {
446
+ display: flex;
447
+ align-items: center;
448
+ gap: var(--andy-spacing-3);
449
+ flex: 1;
450
+ min-width: 0; /* Allow it to shrink */
451
+ margin-right: var(--andy-spacing-2); /* Add some space before close button */
452
+ }
453
+
454
+ .andy-header__avatar {
455
+ width: 36px;
456
+ height: 36px;
457
+ border-radius: 10px;
458
+ background: var(--andy-themable-button-primary-bg);
459
+ color: var(--andy-themable-button-primary-text);
460
+ display: flex;
461
+ align-items: center;
462
+ justify-content: center;
463
+ flex-shrink: 0;
464
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
465
+ }
466
+
467
+ .andy-header__avatar-icon {
468
+ width: 20px;
469
+ height: 20px;
470
+ display: block;
471
+ object-fit: contain;
472
+ }
473
+
474
+ .andy-header__avatar-icon--default {
475
+ filter: brightness(0) invert(1);
476
+ }
477
+
478
+ .andy-header__avatar-image {
479
+ width: 36px;
480
+ height: 36px;
481
+ object-fit: cover;
482
+ border-radius: 10px;
483
+ }
484
+
485
+ /* Remove background when custom logo is used in header */
486
+ .andy-header__avatar:has(.andy-header__avatar-image) {
487
+ background: transparent;
488
+ box-shadow: none;
489
+ }
490
+
491
+ .andy-header__text {
492
+ display: flex;
493
+ flex-direction: column;
494
+ gap: 2px;
495
+ flex: 1;
496
+ min-width: 0;
497
+ overflow: hidden;
498
+ text-align: left;
499
+ align-items: flex-start;
500
+ }
501
+
502
+ .andy-header__name {
503
+ font-size: 16px;
504
+ font-weight: 600;
505
+ color: var(--andy-themable-text);
506
+ margin: 0;
507
+ line-height: 1.2;
508
+ letter-spacing: -0.01em;
509
+ text-align: left;
510
+ }
511
+
512
+ .andy-header__subtitle {
513
+ display: block;
514
+ font-size: 13px;
515
+ color: var(--andy-themable-text-muted);
516
+ font-weight: 400;
517
+ margin: 0;
518
+ margin-top: 2px;
519
+ line-height: 1.2;
520
+ white-space: nowrap;
521
+ overflow: hidden;
522
+ text-overflow: ellipsis;
523
+ max-width: 280px; /* Increased from 200px to allow more text */
524
+ text-align: left;
525
+ }
526
+
527
+ .andy-header__faq {
528
+ display: flex;
529
+ align-items: center;
530
+ justify-content: center;
531
+ width: 32px;
532
+ height: 32px;
533
+ background: transparent;
534
+ border: none;
535
+ border-radius: var(--andy-radius-full);
536
+ color: var(--andy-themable-text-muted);
537
+ cursor: pointer;
538
+ transition: all var(--andy-duration-fast) var(--andy-easing-ease-out);
539
+ position: relative;
540
+ }
541
+
542
+ .andy-header__faq:hover {
543
+ background: rgba(0, 0, 0, 0.04);
544
+ color: var(--andy-themable-button-primary-bg);
545
+ }
546
+
547
+ .andy-header__faq-icon {
548
+ width: 20px;
549
+ height: 20px;
550
+ color: currentColor;
551
+ }
552
+
553
+ .andy-header__close {
554
+ display: flex; /* Always visible now that FAQ is disabled */
555
+ align-items: center;
556
+ justify-content: center;
557
+ width: 32px;
558
+ height: 32px;
559
+ background: transparent;
560
+ border: none;
561
+ border-radius: var(--andy-radius-full);
562
+ color: var(--andy-themable-text-muted);
563
+ cursor: pointer;
564
+ transition: all var(--andy-duration-fast) var(--andy-easing-ease-out);
565
+ position: relative;
566
+ z-index: 1000; /* Ensure it's on top */
567
+ flex-shrink: 0; /* Prevent it from shrinking */
568
+ }
569
+
570
+ .andy-header__close:hover {
571
+ background: rgba(0, 0, 0, 0.04);
572
+ color: var(--andy-themable-text);
573
+ }
574
+
575
+ .andy-header__close-icon {
576
+ width: 20px;
577
+ height: 20px;
578
+ color: currentColor;
579
+ }
580
+
581
+ .andy-header__dropdown {
582
+ position: absolute;
583
+ top: 100%;
584
+ right: 0;
585
+ margin-top: var(--andy-spacing-2);
586
+ background: var(--andy-themable-background-secondary);
587
+ border: 1px solid var(--andy-themable-border);
588
+ border-radius: var(--andy-radius-base);
589
+ box-shadow: var(--andy-shadow-lg);
590
+ min-width: 160px;
591
+ padding: var(--andy-spacing-2);
592
+ z-index: 10;
593
+ display: none;
594
+ }
595
+
596
+ .andy-header__dropdown--open {
597
+ display: block;
598
+ }
599
+
600
+ .andy-dropdown__item {
601
+ display: flex;
602
+ align-items: center;
603
+ gap: var(--andy-spacing-2);
604
+ width: 100%;
605
+ padding: var(--andy-spacing-2) var(--andy-spacing-3);
606
+ background: transparent;
607
+ border: none;
608
+ border-radius: var(--andy-radius-sm);
609
+ color: var(--andy-themable-text);
610
+ font-size: var(--andy-font-size-sm);
611
+ cursor: pointer;
612
+ transition: all var(--andy-duration-fast) var(--andy-easing-ease-out);
613
+ text-align: left;
614
+ }
615
+
616
+ .andy-dropdown__item:hover {
617
+ background: var(--andy-themable-hover);
618
+ }
619
+
620
+ /* Base Button Styles */
621
+ .andy-button {
622
+ display: inline-flex;
623
+ align-items: center;
624
+ justify-content: center;
625
+ gap: var(--andy-spacing-2);
626
+ padding: var(--andy-spacing-2) var(--andy-spacing-4);
627
+ border: none;
628
+ border-radius: var(--andy-radius-base);
629
+ font-family: var(--andy-font-family-primary);
630
+ font-size: var(--andy-font-size-sm);
631
+ font-weight: var(--andy-font-weight-medium);
632
+ cursor: pointer;
633
+ transition: all var(--andy-duration-fast) var(--andy-easing-ease-out);
634
+ text-decoration: none;
635
+ outline: none;
636
+ }
637
+
638
+ .andy-button:focus-visible {
639
+ outline: 2px solid var(--andy-themable-button-primary-bg);
640
+ outline-offset: 2px;
641
+ }
642
+
643
+ .andy-button--primary {
644
+ background: var(--andy-themable-button-primary-bg);
645
+ color: var(--andy-themable-button-primary-text);
646
+ }
647
+
648
+ .andy-button--primary:hover {
649
+ background: var(--andy-themable-button-primary-hover);
650
+ }
651
+
652
+ .andy-button--secondary {
653
+ background: var(--andy-themable-button-secondary-bg);
654
+ color: var(--andy-themable-button-secondary-text);
655
+ }
656
+
657
+ .andy-button--secondary:hover {
658
+ background: var(--andy-themable-button-secondary-hover);
659
+ }
660
+
661
+ /* Messages */
662
+ .andy-chat-window__messages {
663
+ flex: 1;
664
+ display: flex;
665
+ flex-direction: column;
666
+ gap: 0;
667
+ padding: var(--andy-spacing-5) var(--andy-spacing-6);
668
+ overflow-y: auto;
669
+ background: var(--andy-themable-background-secondary);
670
+ min-height: 0;
671
+ padding: 24px 20px 0px;
672
+ }
673
+
674
+ /* Subtitle section at top of messages */
675
+ .andy-chat-subtitle {
676
+ font-size: 14px;
677
+ color: var(--andy-themable-text-secondary);
678
+ text-align: center;
679
+ line-height: 21px;
680
+ margin-bottom: var(--andy-spacing-5);
681
+ }
682
+
683
+ .andy-chat-subtitle__text {
684
+ padding: 0;
685
+ margin: 0;
686
+ text-wrap: balance;
687
+ }
688
+
689
+
690
+
691
+ .andy-message-container {
692
+ display: flex;
693
+ margin-bottom: 8px;
694
+ max-width: 75%;
695
+ align-items: flex-start;
696
+ gap: var(--andy-spacing-3);
697
+ animation: andy-message-slide-in var(--andy-duration-normal) var(--andy-easing-ease-out);
698
+ }
699
+
700
+ .andy-message-container--user {
701
+ margin-left: auto;
702
+ flex-direction: row-reverse;
703
+ }
704
+
705
+ .andy-message-container--bot {
706
+ margin-right: auto;
707
+ flex-direction: row;
708
+ align-items: flex-start;
709
+ }
710
+
711
+ /* Bot message header with icon + name */
712
+ .andy-bot-header {
713
+ display: flex;
714
+ align-items: center;
715
+ gap: 8px;
716
+ margin-bottom: 8px;
717
+ }
718
+
719
+ .andy-bot-header__icon {
720
+ width: 24px;
721
+ height: 24px;
722
+ background: var(--andy-themable-button-primary-bg);
723
+ color: var(--andy-themable-button-primary-text);
724
+ border-radius: 6px;
725
+ display: flex;
726
+ align-items: center;
727
+ justify-content: center;
728
+ flex-shrink: 0;
729
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
730
+ }
731
+
732
+ .andy-bot-header__icon svg {
733
+ width: 14px;
734
+ height: 14px;
735
+ display: block;
736
+ }
737
+
738
+ .andy-bot-header__icon-image {
739
+ width: 24px;
740
+ height: 24px;
741
+ object-fit: cover;
742
+ border-radius: 6px;
743
+ display: block;
744
+ }
745
+
746
+ .andy-bot-header__icon-image--default {
747
+ width: 14px;
748
+ height: 14px;
749
+ object-fit: contain;
750
+ filter: brightness(0) invert(1);
751
+ }
752
+
753
+ /* Remove background when custom logo is used (not default icon) */
754
+ .andy-bot-header__icon:has(.andy-bot-header__icon-image:not(.andy-bot-header__icon-image--default)) {
755
+ background: transparent;
756
+ box-shadow: none;
757
+ }
758
+
759
+ .andy-bot-header__name {
760
+ font-size: 14px;
761
+ font-weight: 600;
762
+ color: var(--andy-themable-text);
763
+ line-height: 1.2;
764
+ letter-spacing: -0.01em;
765
+ }
766
+
767
+ .andy-avatar {
768
+ display: none; /* Hide regular avatar, using new bot header */
769
+ }
770
+
771
+ .andy-message {
772
+ border-radius: var(--andy-radius-lg);
773
+ font-size: var(--andy-font-size-sm);
774
+ line-height: var(--andy-line-height-normal);
775
+ word-wrap: break-word;
776
+ position: relative;
777
+ }
778
+
779
+ .andy-message--user {
780
+ background: var(--andy-themable-button-primary-bg);
781
+ color: var(--andy-themable-message-user-text);
782
+ border-radius: 20px;
783
+ padding: 8px 12px;
784
+ display: flex;
785
+ align-items: center;
786
+ justify-content: center;
787
+ text-align: center;
788
+ min-height: 36px;
789
+ font-weight: 500;
790
+ box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.1);
791
+ line-height: 1.4;
792
+ }
793
+
794
+ .andy-message--bot {
795
+ background: var(--andy-themable-message-bot-bg);
796
+ color: var(--andy-themable-message-bot-text);
797
+ border-radius: 20px;
798
+ border: 1px solid var(--andy-themable-message-bot-border);
799
+ padding: 12px 16px;
800
+ box-shadow: none;
801
+ line-height: 1.5;
802
+ text-align: left;
803
+ }
804
+
805
+ /* Message Sub-Components */
806
+ .andy-message__content {
807
+ line-height: 1.4;
808
+ margin: 0;
809
+ overflow-wrap: break-word;
810
+ word-break: break-word;
811
+ text-align: left;
812
+ }
813
+
814
+ /* User message content centering */
815
+ .andy-message--user .andy-message__content {
816
+ width: 100%;
817
+ display: flex;
818
+ align-items: center;
819
+ justify-content: center;
820
+ }
821
+
822
+ .andy-message--user .andy-message__content p {
823
+ margin: 0;
824
+ }
825
+
826
+ /* Bot message content left alignment */
827
+ .andy-message--bot .andy-message__content {
828
+ text-align: left;
829
+ }
830
+
831
+ .andy-message__content p {
832
+ margin: 0;
833
+ margin-bottom: var(--andy-spacing-1);
834
+ }
835
+
836
+ .andy-message__content p:last-child {
837
+ margin-bottom: 0;
838
+ }
839
+
840
+ .andy-message__content h1,
841
+ .andy-message__content h2,
842
+ .andy-message__content h3,
843
+ .andy-message__content h4,
844
+ .andy-message__content h5,
845
+ .andy-message__content h6 {
846
+ margin: 0 0 var(--andy-spacing-1) 0;
847
+ font-weight: var(--andy-font-weight-bold);
848
+ }
849
+
850
+ .andy-message__content ul,
851
+ .andy-message__content ol {
852
+ margin: var(--andy-spacing-2) 0;
853
+ padding-left: var(--andy-spacing-4);
854
+ }
855
+
856
+ .andy-message__content li {
857
+ margin-bottom: var(--andy-spacing-1);
858
+ }
859
+
860
+ .andy-message__content code {
861
+ background: rgba(0, 0, 0, 0.1);
862
+ padding: var(--andy-spacing-1) var(--andy-spacing-2);
863
+ border-radius: var(--andy-radius-sm);
864
+ font-family: monospace;
865
+ font-size: 0.875em;
866
+ }
867
+
868
+ .andy-message__content strong {
869
+ font-weight: var(--andy-font-weight-bold);
870
+ }
871
+
872
+ .andy-message__content em {
873
+ font-style: italic;
874
+ }
875
+
876
+ .andy-message__link {
877
+ color: var(--andy-themable-button-primary-bg);
878
+ text-decoration: none;
879
+ }
880
+
881
+ .andy-message__link:hover {
882
+ text-decoration: underline;
883
+ }
884
+
885
+ /* Avatar Sub-Components */
886
+ .andy-avatar__icon {
887
+ width: 18px;
888
+ height: 18px;
889
+ flex-shrink: 0;
890
+ display: block;
891
+ object-fit: contain;
892
+ }
893
+
894
+ .andy-avatar__icon--default {
895
+ filter: brightness(0) invert(1);
896
+ }
897
+
898
+ .andy-avatar__image {
899
+ width: 100%;
900
+ height: 100%;
901
+ border-radius: var(--andy-radius-full);
902
+ object-fit: cover;
903
+ }
904
+
905
+ /* Typing Indicator Component */
906
+ .andy-typing-indicator {
907
+ display: flex;
908
+ align-items: center;
909
+ justify-content: center;
910
+ padding: var(--andy-spacing-2) var(--andy-spacing-3);
911
+ min-height: 32px;
912
+ }
913
+
914
+ .andy-typing-indicator__dot {
915
+ width: 6px;
916
+ height: 6px;
917
+ border-radius: var(--andy-radius-full);
918
+ background-color: var(--andy-themable-text-secondary);
919
+ margin: 0 2px;
920
+ opacity: 0.7;
921
+ animation: andy-dot-pulse var(--andy-duration-slow) infinite var(--andy-easing-ease-in-out);
922
+ }
923
+
924
+ .andy-typing-indicator__dot:nth-child(1) {
925
+ animation-delay: 0s;
926
+ }
927
+
928
+ .andy-typing-indicator__dot:nth-child(2) {
929
+ animation-delay: 0.2s;
930
+ }
931
+
932
+ .andy-typing-indicator__dot:nth-child(3) {
933
+ animation-delay: 0.4s;
934
+ }
935
+
936
+
937
+ .andy-message__greeting-title {
938
+ font-size: var(--andy-font-size-lg);
939
+ font-weight: var(--andy-font-weight-bold);
940
+ margin-bottom: var(--andy-spacing-1);
941
+ }
942
+
943
+ .andy-message__greeting-content {
944
+ font-size: var(--andy-font-size-sm);
945
+ opacity: 0.9;
946
+ }
947
+
948
+ .andy-message--loading .andy-message__content {
949
+ padding: var(--andy-spacing-2) 0;
950
+ display: flex;
951
+ align-items: center;
952
+ justify-content: center;
953
+ }
954
+
955
+ .andy-message--error {
956
+ border-color: var(--andy-color-error);
957
+ background: var(--andy-color-error-light);
958
+ }
959
+
960
+ /* Input */
961
+ .andy-input-container {
962
+ display: flex;
963
+ flex-direction: column;
964
+ padding: var(--andy-spacing-5) var(--andy-spacing-6);
965
+ border-top: 1px solid var(--andy-themable-border);
966
+ background: var(--andy-themable-background-secondary);
967
+ border-radius: 0 0 var(--andy-radius-xl) var(--andy-radius-xl);
968
+ }
969
+
970
+ .andy-input {
971
+ display: flex;
972
+ position: relative;
973
+ width: 100%;
974
+ align-items: center;
975
+ gap: var(--andy-spacing-2);
976
+ }
977
+
978
+ .andy-input__field {
979
+ flex: 1;
980
+ padding: 12px var(--andy-spacing-4);
981
+ padding-left: var(--andy-spacing-4);
982
+ padding-right: 50px;
983
+ border: 1px solid var(--andy-themable-border);
984
+ border-radius: 24px;
985
+ font-family: var(--andy-font-family-primary);
986
+ font-size: var(--andy-font-size-sm);
987
+ line-height: var(--andy-line-height-normal);
988
+ background: var(--andy-themable-input-bg);
989
+ color: var(--andy-themable-input-text);
990
+ min-height: 48px;
991
+ outline: none;
992
+ resize: none;
993
+ transition: all var(--andy-duration-normal) var(--andy-easing-ease-out);
994
+ box-shadow: none;
995
+ }
996
+
997
+ .andy-input__field:focus {
998
+ border-color: var(--andy-themable-text-muted);
999
+ background: var(--andy-themable-background-secondary);
1000
+ box-shadow: none;
1001
+ }
1002
+
1003
+ .andy-input__button {
1004
+ position: absolute;
1005
+ right: 5px;
1006
+ top: 50%;
1007
+ transform: translateY(-50%);
1008
+ width: 30px;
1009
+ height: 30px;
1010
+ border: none;
1011
+ border-radius: var(--andy-radius-full);
1012
+ background: var(--andy-themable-button-primary-bg);
1013
+ color: var(--andy-themable-button-primary-text);
1014
+ cursor: pointer;
1015
+ display: flex;
1016
+ align-items: center;
1017
+ justify-content: center;
1018
+ transition: all var(--andy-duration-normal) var(--andy-easing-ease-out);
1019
+ outline: none;
1020
+ z-index: 1;
1021
+ box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.1);
1022
+ }
1023
+
1024
+ .andy-input__button:hover {
1025
+ background: var(--andy-themable-button-primary-hover);
1026
+ transform: translateY(-50%) scale(1.05);
1027
+ box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.15);
1028
+ }
1029
+
1030
+ .andy-input__button:disabled {
1031
+ background: #cccccc;
1032
+ cursor: not-allowed;
1033
+ opacity: 0.6;
1034
+ }
1035
+
1036
+ .andy-input__button svg,
1037
+ .andy-input__button-icon {
1038
+ pointer-events: none;
1039
+ }
1040
+
1041
+ .andy-input__button:disabled:hover {
1042
+ background: #cccccc;
1043
+ transform: translateY(-50%);
1044
+ }
1045
+
1046
+ /* Bottom Section */
1047
+ .andy-chat-window__bottom {
1048
+ display: flex;
1049
+ flex-direction: column;
1050
+ background: var(--andy-themable-background-secondary);
1051
+ border-top: none;
1052
+ border-radius: 0 0 var(--andy-radius-xl) var(--andy-radius-xl);
1053
+ overflow: visible;
1054
+ }
1055
+
1056
+ /* Predefined Questions */
1057
+ .andy-predefined-questions {
1058
+ padding: 20px 24px 16px;
1059
+ display: flex;
1060
+ flex-direction: column;
1061
+ gap: 16px;
1062
+ overflow: visible;
1063
+ }
1064
+
1065
+ .andy-predefined-questions__header {
1066
+ display: none; /* Hide header as requested */
1067
+ }
1068
+
1069
+ .andy-predefined-questions__title {
1070
+ display: none; /* Hide title as requested */
1071
+ }
1072
+
1073
+ .andy-predefined-questions__list {
1074
+ display: flex;
1075
+ flex-direction: column;
1076
+ gap: 12px;
1077
+ overflow: visible;
1078
+ scrollbar-width: none;
1079
+ -ms-overflow-style: none;
1080
+ padding: 0;
1081
+ margin: 0;
1082
+ }
1083
+
1084
+ .andy-predefined-questions__list::-webkit-scrollbar {
1085
+ display: none;
1086
+ }
1087
+
1088
+ .andy-predefined-question {
1089
+ display: flex;
1090
+ align-items: flex-start;
1091
+ gap: var(--andy-spacing-1);
1092
+ padding: 8px 16px;
1093
+ background: var(--andy-themable-background-secondary);
1094
+ border: 1px solid var(--andy-themable-border);
1095
+ border-radius: var(--andy-radius-full);
1096
+ color: var(--andy-themable-text);
1097
+ font-size: 13px;
1098
+ font-weight: 500;
1099
+ cursor: pointer;
1100
+ transition: all var(--andy-duration-normal) var(--andy-easing-ease-out);
1101
+ white-space: normal;
1102
+ text-align: left;
1103
+ flex-shrink: 1;
1104
+ width: 100%;
1105
+ max-width: 100%;
1106
+ box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
1107
+ min-height: 36px;
1108
+ position: relative;
1109
+ overflow: visible;
1110
+ }
1111
+
1112
+ .andy-predefined-question:hover {
1113
+ background: var(--andy-themable-hover);
1114
+ border-color: var(--andy-themable-text-muted);
1115
+ box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
1116
+ transform: translateY(-1px);
1117
+ z-index: 10;
1118
+ }
1119
+
1120
+ .andy-predefined-question:active {
1121
+ transform: translateY(0);
1122
+ box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
1123
+ }
1124
+
1125
+ .andy-predefined-question:disabled {
1126
+ opacity: 0.6;
1127
+ cursor: not-allowed;
1128
+ transform: none;
1129
+ box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
1130
+ }
1131
+
1132
+ .andy-predefined-question__icon {
1133
+ font-size: 12px;
1134
+ }
1135
+
1136
+ .andy-predefined-question__text {
1137
+ flex: 1 1 auto;
1138
+ line-height: 1.4;
1139
+ overflow-wrap: anywhere;
1140
+ }
1141
+
1142
+ /* Updated Input Container */
1143
+ .andy-chat-window__input {
1144
+ padding: var(--andy-spacing-3) var(--andy-spacing-5);
1145
+ }
1146
+
1147
+ .andy-input-container {
1148
+ display: flex;
1149
+ flex-direction: column;
1150
+ padding: 0;
1151
+ border-top: none;
1152
+ background: transparent;
1153
+ border-radius: 0;
1154
+ }
1155
+
1156
+ /* Footer */
1157
+ .andy-chat-window__footer {
1158
+ display: flex;
1159
+ align-items: center;
1160
+ justify-content: center;
1161
+ padding: var(--andy-spacing-1) var(--andy-spacing-3);
1162
+ background: transparent;
1163
+ border-radius: 0 0 var(--andy-radius-xl) var(--andy-radius-xl);
1164
+ }
1165
+
1166
+ .andy-chat-window__footer-link {
1167
+ text-decoration: none;
1168
+ display: inline-flex;
1169
+ align-items: center;
1170
+ gap: 3px;
1171
+ padding: 4px 10px;
1172
+ background: var(--andy-themable-hover);
1173
+ border-radius: 10px;
1174
+ transition: all 0.2s ease;
1175
+ font-size: 10px;
1176
+ opacity: 0.8;
1177
+ position: relative;
1178
+ /* Ensure reasonable touch target size for mobile */
1179
+ min-height: 28px;
1180
+ }
1181
+
1182
+ .andy-chat-window__footer-link:hover {
1183
+ opacity: 1;
1184
+ transform: translateY(-1px) scale(1.02);
1185
+ box-shadow: 0 2px 8px var(--andy-themable-shadow);
1186
+ background: var(--andy-themable-hover);
1187
+ }
1188
+
1189
+ .andy-chat-window__footer-link:active {
1190
+ transform: translateY(0) scale(1);
1191
+ box-shadow: 0 1px 4px var(--andy-themable-shadow-light);
1192
+ }
1193
+
1194
+ .andy-chat-window__footer-link:focus-visible {
1195
+ outline: 2px solid var(--andy-themable-button-primary-bg);
1196
+ outline-offset: 2px;
1197
+ opacity: 1;
1198
+ }
1199
+
1200
+ /* External link icon - using ::after instead of ::before */
1201
+ .andy-chat-window__footer-link::after {
1202
+ content: '\u2197';
1203
+ font-size: 9px;
1204
+ margin-left: 1px;
1205
+ transition: transform 0.2s ease;
1206
+ display: inline-block;
1207
+ color: var(--andy-themable-text-secondary);
1208
+ opacity: 0.8;
1209
+ }
1210
+
1211
+ .andy-chat-window__footer-link:hover::after {
1212
+ transform: translate(1px, -1px);
1213
+ opacity: 1;
1214
+ }
1215
+
1216
+ .andy-chat-window__footer-text {
1217
+ color: var(--andy-themable-text-secondary);
1218
+ font-size: 10px;
1219
+ font-weight: var(--andy-font-weight-medium);
1220
+ letter-spacing: 0.01em;
1221
+ line-height: 1.4;
1222
+ }
1223
+
1224
+ /* FAQ */
1225
+ .andy-chat-window__faq {
1226
+ display: none;
1227
+ flex: 1;
1228
+ flex-direction: column;
1229
+ background: var(--andy-themable-background);
1230
+ overflow-y: auto;
1231
+ }
1232
+
1233
+ .andy-faq {
1234
+ display: flex;
1235
+ flex-direction: column;
1236
+ height: 100%;
1237
+ }
1238
+
1239
+ .andy-faq__header {
1240
+ display: flex;
1241
+ flex-direction: column;
1242
+ padding: var(--andy-spacing-5) var(--andy-spacing-6) var(--andy-spacing-4);
1243
+ border-bottom: 1px solid var(--andy-themable-border);
1244
+ background: var(--andy-themable-background-secondary);
1245
+ }
1246
+
1247
+ .andy-faq__back-button {
1248
+ display: flex;
1249
+ align-items: center;
1250
+ gap: var(--andy-spacing-2);
1251
+ margin-bottom: var(--andy-spacing-4);
1252
+ padding: var(--andy-spacing-2) 0;
1253
+ background: none;
1254
+ border: none;
1255
+ color: var(--andy-themable-button-primary-bg);
1256
+ font-size: var(--andy-font-size-sm);
1257
+ cursor: pointer;
1258
+ transition: color var(--andy-duration-fast) var(--andy-easing-ease-out);
1259
+ outline: none;
1260
+ }
1261
+
1262
+ .andy-faq__back-button:hover {
1263
+ color: var(--andy-themable-button-primary-hover);
1264
+ }
1265
+
1266
+ .andy-faq__back-icon {
1267
+ width: 20px;
1268
+ height: 20px;
1269
+ flex-shrink: 0;
1270
+ }
1271
+
1272
+ .andy-faq__title {
1273
+ font-size: var(--andy-font-size-xl);
1274
+ font-weight: var(--andy-font-weight-bold);
1275
+ color: var(--andy-themable-text);
1276
+ margin: 0;
1277
+ text-align: center;
1278
+ }
1279
+
1280
+ .andy-faq__list {
1281
+ flex: 1;
1282
+ padding: var(--andy-spacing-4) var(--andy-spacing-6);
1283
+ overflow-y: auto;
1284
+ }
1285
+
1286
+ .andy-faq-item {
1287
+ margin-bottom: var(--andy-spacing-4);
1288
+ border: 1px solid var(--andy-themable-border);
1289
+ border-radius: var(--andy-radius-lg);
1290
+ background: var(--andy-themable-background-secondary);
1291
+ overflow: hidden;
1292
+ transition: all var(--andy-duration-fast) var(--andy-easing-ease-out);
1293
+ }
1294
+
1295
+ .andy-faq-item:hover {
1296
+ border-color: var(--andy-themable-button-primary-bg);
1297
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
1298
+ }
1299
+
1300
+ .andy-faq-item__question {
1301
+ display: flex;
1302
+ align-items: center;
1303
+ justify-content: space-between;
1304
+ width: 100%;
1305
+ padding: var(--andy-spacing-4) var(--andy-spacing-5);
1306
+ background: none;
1307
+ border: none;
1308
+ text-align: left;
1309
+ font-size: var(--andy-font-size-base);
1310
+ font-weight: var(--andy-font-weight-medium);
1311
+ color: var(--andy-themable-text);
1312
+ cursor: pointer;
1313
+ transition: all var(--andy-duration-fast) var(--andy-easing-ease-out);
1314
+ outline: none;
1315
+ }
1316
+
1317
+ .andy-faq-item__question:hover {
1318
+ background: var(--andy-themable-hover);
1319
+ }
1320
+
1321
+ .andy-faq-item__chevron {
1322
+ width: 16px;
1323
+ height: 16px;
1324
+ flex-shrink: 0;
1325
+ transition: transform var(--andy-duration-fast) var(--andy-easing-ease-out);
1326
+ color: var(--andy-themable-text-secondary);
1327
+ }
1328
+
1329
+ .andy-faq-item--open .andy-faq-item__chevron {
1330
+ transform: rotate(180deg);
1331
+ }
1332
+
1333
+ .andy-faq-item__answer {
1334
+ display: grid;
1335
+ grid-template-rows: 0fr;
1336
+ overflow: hidden;
1337
+ transition: grid-template-rows var(--andy-duration-normal) var(--andy-easing-ease-out);
1338
+ background: var(--andy-themable-background);
1339
+ }
1340
+
1341
+ .andy-faq-item--open .andy-faq-item__answer {
1342
+ grid-template-rows: 1fr;
1343
+ }
1344
+
1345
+ .andy-faq-item__answer-content {
1346
+ min-height: 0;
1347
+ padding: 0 var(--andy-spacing-5);
1348
+ }
1349
+
1350
+ .andy-faq-item--open .andy-faq-item__answer-content {
1351
+ padding: 0 var(--andy-spacing-5) var(--andy-spacing-4);
1352
+ }
1353
+
1354
+ .andy-faq-item__answer p {
1355
+ margin: 0 0 var(--andy-spacing-2) 0;
1356
+ color: var(--andy-themable-text-secondary);
1357
+ line-height: var(--andy-line-height-normal);
1358
+ }
1359
+
1360
+ .andy-faq-item__answer p:last-child {
1361
+ margin-bottom: 0;
1362
+ }
1363
+
1364
+ .andy-faq-item__answer ul,
1365
+ .andy-faq-item__answer ol {
1366
+ margin: var(--andy-spacing-2) 0;
1367
+ padding-left: var(--andy-spacing-4);
1368
+ color: var(--andy-themable-text-secondary);
1369
+ }
1370
+
1371
+ .andy-faq-item__answer li {
1372
+ margin-bottom: var(--andy-spacing-1);
1373
+ }
1374
+
1375
+ /* Welcome Popup */
1376
+ .andy-welcome-popup {
1377
+ position: fixed;
1378
+ bottom: 100px;
1379
+ right: 20px;
1380
+ z-index: 9998;
1381
+ display: none;
1382
+ max-width: 280px;
1383
+ animation: andy-fade-in-slide-up 0.3s ease-out;
1384
+ }
1385
+
1386
+ /* Left orientation */
1387
+ .andy-welcome-popup.andychat-popup-left,
1388
+ :host(.andy-orientation-left) .andy-welcome-popup {
1389
+ right: auto;
1390
+ left: 20px;
1391
+ }
1392
+
1393
+ .andy-welcome-popup__content {
1394
+ background: var(--andy-themable-background-secondary);
1395
+ border-radius: var(--andy-radius-lg);
1396
+ padding: 16px;
1397
+ box-shadow: var(--andy-shadow-lg);
1398
+ position: relative;
1399
+ border: 1px solid var(--andy-themable-border);
1400
+ }
1401
+
1402
+ .andy-welcome-popup__message {
1403
+ font-size: 14px;
1404
+ line-height: 1.5;
1405
+ color: var(--andy-themable-text);
1406
+ padding-right: 24px;
1407
+ }
1408
+
1409
+ .andy-welcome-popup__close {
1410
+ position: absolute;
1411
+ top: 8px;
1412
+ right: 8px;
1413
+ width: 24px;
1414
+ height: 24px;
1415
+ border: none;
1416
+ background: transparent;
1417
+ cursor: pointer;
1418
+ display: flex;
1419
+ align-items: center;
1420
+ justify-content: center;
1421
+ border-radius: 4px;
1422
+ color: var(--andy-themable-text-muted);
1423
+ transition: all 0.15s ease;
1424
+ }
1425
+
1426
+ .andy-welcome-popup__close:hover {
1427
+ background: var(--andy-themable-hover);
1428
+ color: var(--andy-themable-text);
1429
+ }
1430
+
1431
+ .andy-welcome-popup__close-icon {
1432
+ width: 16px;
1433
+ height: 16px;
1434
+ }
1435
+
1436
+ .andy-welcome-popup__arrow {
1437
+ position: absolute;
1438
+ bottom: -8px;
1439
+ right: 30px;
1440
+ width: 16px;
1441
+ height: 16px;
1442
+ background: var(--andy-themable-background-secondary);
1443
+ border-right: 1px solid var(--andy-themable-border);
1444
+ border-bottom: 1px solid var(--andy-themable-border);
1445
+ transform: rotate(45deg);
1446
+ }
1447
+
1448
+ /* Left orientation arrow */
1449
+ .andy-welcome-popup.andychat-popup-left .andy-welcome-popup__arrow,
1450
+ :host(.andy-orientation-left) .andy-welcome-popup .andy-welcome-popup__arrow {
1451
+ right: auto;
1452
+ left: 30px;
1453
+ }
1454
+
1455
+ /* Loading States */
1456
+ .andy-loading__dots {
1457
+ display: flex;
1458
+ align-items: center;
1459
+ justify-content: center;
1460
+ gap: var(--andy-spacing-2);
1461
+ padding: var(--andy-spacing-4);
1462
+ min-height: 60px;
1463
+ }
1464
+
1465
+ .andy-loading__dot {
1466
+ width: 12px;
1467
+ height: 12px;
1468
+ border-radius: var(--andy-radius-full);
1469
+ background-color: var(--andy-themable-text-muted);
1470
+ opacity: 0.6;
1471
+ }
1472
+
1473
+ .andy-loading__dot:nth-child(1) {
1474
+ animation: andy-dot-pulse var(--andy-duration-slow) infinite var(--andy-easing-ease-in-out) 0s;
1475
+ }
1476
+
1477
+ .andy-loading__dot:nth-child(2) {
1478
+ animation: andy-dot-pulse var(--andy-duration-slow) infinite var(--andy-easing-ease-in-out) 0.2s;
1479
+ }
1480
+
1481
+ .andy-loading__dot:nth-child(3) {
1482
+ animation: andy-dot-pulse var(--andy-duration-slow) infinite var(--andy-easing-ease-in-out) 0.4s;
1483
+ }
1484
+
1485
+ /* Responsive */
1486
+ @media (max-width: 520px) {
1487
+ .andy-chat-window {
1488
+ position: fixed !important;
1489
+ bottom: 1rem !important;
1490
+ left: 1rem !important;
1491
+ right: 1rem !important;
1492
+ top: 1rem !important;
1493
+ width: calc(100% - 2rem) !important;
1494
+ height: calc(100% - 2rem) !important;
1495
+ max-width: 500px !important;
1496
+ max-height: calc(100vh - 2rem) !important;
1497
+ max-height: calc(100dvh - 2rem) !important;
1498
+ margin: 0 auto !important;
1499
+ border-radius: var(--andy-radius-xl) !important;
1500
+ box-shadow: 0 0 40px rgba(0, 0, 0, 0.2) !important;
1501
+ overflow: hidden;
1502
+ display: flex;
1503
+ flex-direction: column;
1504
+ background: var(--andy-themable-background-secondary) !important;
1505
+ /* Card-like floating design */
1506
+ /* Add smooth scale animation on mobile */
1507
+ transform: scale(0.95);
1508
+ opacity: 0;
1509
+ }
1510
+
1511
+ .andy-chat-window--open {
1512
+ transform: scale(1);
1513
+ opacity: 1;
1514
+ }
1515
+
1516
+ /* Adjust for very small screens */
1517
+ @media (max-height: 600px) {
1518
+ .andy-chat-window {
1519
+ bottom: 0.5rem !important;
1520
+ top: 0.5rem !important;
1521
+ left: 0.5rem !important;
1522
+ right: 0.5rem !important;
1523
+ width: calc(100% - 1rem) !important;
1524
+ height: calc(100% - 1rem) !important;
1525
+ }
1526
+ }
1527
+
1528
+ /* No special handling for keyboard - let browser handle it naturally */
1529
+ .andy-chat-window--keyboard-open {
1530
+ /* Browser handles positioning automatically with our margin-based approach */
1531
+ }
1532
+
1533
+ /* Ensure the window content is properly laid out */
1534
+ .andy-chat-window__messages {
1535
+ flex: 1 1 auto;
1536
+ min-height: 0;
1537
+ overflow-y: auto;
1538
+ -webkit-overflow-scrolling: touch;
1539
+ }
1540
+
1541
+ .andy-chat-window__bottom {
1542
+ flex: 0 0 auto;
1543
+ position: relative;
1544
+ z-index: 10;
1545
+ }
1546
+
1547
+ /* Fix input font size to prevent iOS zoom */
1548
+ .andy-input__field {
1549
+ font-size: 16px !important; /* Prevents iOS zoom on focus */
1550
+ line-height: 1.5 !important;
1551
+ padding-right: 60px !important; /* More space for larger button */
1552
+ }
1553
+
1554
+ /* Larger send button on mobile for better touch targets */
1555
+ .andy-input__button {
1556
+ width: 40px !important;
1557
+ height: 40px !important;
1558
+ right: 8px !important;
1559
+ }
1560
+
1561
+ /* Add expanded touch target for submit button on mobile only */
1562
+ .andy-input__button::before {
1563
+ content: '';
1564
+ position: absolute;
1565
+ top: -15px;
1566
+ right: -15px;
1567
+ bottom: -15px;
1568
+ left: -15px;
1569
+ border-radius: var(--andy-radius-full);
1570
+ /* Invisible expanded touch target */
1571
+ }
1572
+
1573
+ /* Ensure proper header spacing on mobile */
1574
+ .andy-header {
1575
+ min-height: 60px;
1576
+ flex-shrink: 0;
1577
+ position: sticky;
1578
+ top: 0;
1579
+ z-index: 100;
1580
+ background: var(--andy-themable-background-secondary);
1581
+ }
1582
+
1583
+ /* Ensure messages don't go under header */
1584
+ .andy-chat-window__messages {
1585
+ padding-top: var(--andy-spacing-3);
1586
+ }
1587
+
1588
+ .andy-chat-bubble {
1589
+ width: 56px;
1590
+ height: 56px;
1591
+ bottom: 30px;
1592
+ /* Ensure bubble is tappable on mobile */
1593
+ cursor: pointer;
1594
+ -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
1595
+ touch-action: manipulation;
1596
+ }
1597
+
1598
+ .andy-chat-bubble__icon {
1599
+ width: 20px;
1600
+ height: 20px;
1601
+ }
1602
+
1603
+ /* Pill style on mobile - override fixed dimensions */
1604
+ .andy-chat-bubble--pill {
1605
+ width: auto !important;
1606
+ height: auto !important;
1607
+ padding: 10px 16px 10px 12px;
1608
+ gap: 6px;
1609
+ }
1610
+
1611
+ .andy-chat-bubble--pill .andy-chat-bubble__label {
1612
+ font-size: 13px;
1613
+ }
1614
+
1615
+ .andy-chat-bubble--pill .andy-chat-bubble__icon--pill {
1616
+ width: 22px !important;
1617
+ height: 22px !important;
1618
+ }
1619
+
1620
+ /* When open on mobile, pill collapses to icon only */
1621
+ .andy-chat-bubble--pill.andy-chat-bubble--open {
1622
+ width: 56px !important;
1623
+ height: 56px !important;
1624
+ padding: 0;
1625
+ }
1626
+
1627
+ /* Show close button on mobile */
1628
+ .andy-header__close {
1629
+ display: flex;
1630
+ }
1631
+
1632
+ /* Add expanded touch target for close button on mobile only */
1633
+ .andy-header__close::before {
1634
+ content: '';
1635
+ position: absolute;
1636
+ top: -12px;
1637
+ right: -12px;
1638
+ bottom: -12px;
1639
+ left: -12px;
1640
+ border-radius: var(--andy-radius-full);
1641
+ /* Invisible expanded touch target */
1642
+ }
1643
+
1644
+ /* Hide FAQ button on mobile to make room for close button */
1645
+ .andy-header__faq {
1646
+ display: none;
1647
+ }
1648
+ }
1649
+
1650
+ /* Desktop keyboard handling (for testing) */
1651
+ @media (min-width: 521px) {
1652
+ /* Desktop retains original positioning behavior */
1653
+ .andy-chat-window {
1654
+ transition: transform 0.3s ease-out;
1655
+ }
1656
+
1657
+ /* Optional: Add keyboard handling for desktop if needed */
1658
+ .andy-chat-window--keyboard-open {
1659
+ /* No transform on desktop - keyboard doesn't affect viewport */
1660
+ }
1661
+ }
1662
+
1663
+ /* Orientation */
1664
+ :host(.andy-orientation-right) .andy-chat-bubble {
1665
+ right: 30px;
1666
+ left: auto;
1667
+ }
1668
+
1669
+ :host(.andy-orientation-left) .andy-chat-bubble {
1670
+ left: 30px;
1671
+ right: auto;
1672
+ }
1673
+
1674
+ :host(.andy-orientation-right) .andy-chat-window {
1675
+ right: 30px;
1676
+ left: auto;
1677
+ }
1678
+
1679
+ :host(.andy-orientation-left) .andy-chat-window {
1680
+ left: 30px;
1681
+ right: auto;
1682
+ }
1683
+ `,Be=()=>`
1684
+ /* Light Theme (Default) */
1685
+ :host(.andy-theme-light) {
1686
+ --andy-themable-background: var(--andy-color-background);
1687
+ --andy-themable-background-secondary: var(--andy-color-white);
1688
+ --andy-themable-background-tertiary: var(--andy-color-gray-100);
1689
+ --andy-themable-text: var(--andy-color-text);
1690
+ --andy-themable-text-secondary: var(--andy-color-text-secondary);
1691
+ --andy-themable-text-muted: var(--andy-color-text-muted);
1692
+ --andy-themable-border: var(--andy-color-border);
1693
+ --andy-themable-hover: var(--andy-color-hover);
1694
+ --andy-themable-button-primary-bg: var(--andy-color-primary);
1695
+ --andy-themable-button-primary-text: var(--andy-color-white);
1696
+ --andy-themable-button-primary-hover: var(--andy-color-primary-hover);
1697
+ --andy-themable-button-secondary-bg: var(--andy-color-gray-200);
1698
+ --andy-themable-button-secondary-text: var(--andy-color-text);
1699
+ --andy-themable-button-secondary-hover: var(--andy-color-gray-300);
1700
+ --andy-themable-input-bg: var(--andy-color-input-background);
1701
+ --andy-themable-input-border: var(--andy-color-border);
1702
+ --andy-themable-input-text: var(--andy-color-text);
1703
+ --andy-themable-input-placeholder: var(--andy-color-text-muted);
1704
+ --andy-themable-message-user-bg: var(--andy-color-user-message);
1705
+ --andy-themable-message-user-text: var(--andy-color-user-message-text);
1706
+ --andy-themable-message-bot-bg: var(--andy-color-bot-message);
1707
+ --andy-themable-message-bot-text: var(--andy-color-bot-message-text);
1708
+ --andy-themable-avatar-bg: var(--andy-color-primary);
1709
+ --andy-themable-avatar-text: var(--andy-color-white);
1710
+ --andy-themable-tooltip-bg: var(--andy-color-gray-800);
1711
+ --andy-themable-tooltip-text: var(--andy-color-white);
1712
+ }
1713
+
1714
+ /* Dark Theme */
1715
+ :host(.andy-theme-dark) {
1716
+ --andy-themable-background: var(--andy-color-background-dark);
1717
+ --andy-themable-background-secondary: var(--andy-color-background-secondary-dark);
1718
+ --andy-themable-background-tertiary: var(--andy-color-background-tertiary-dark);
1719
+ --andy-themable-text: var(--andy-color-text-dark);
1720
+ --andy-themable-text-secondary: var(--andy-color-text-dark);
1721
+ --andy-themable-text-muted: var(--andy-color-text-muted-dark);
1722
+ --andy-themable-border: var(--andy-color-border-dark);
1723
+ --andy-themable-hover: var(--andy-color-hover-dark);
1724
+ --andy-themable-shadow: rgba(0, 0, 0, 0.3);
1725
+ --andy-themable-shadow-light: rgba(0, 0, 0, 0.2);
1726
+ --andy-themable-button-primary-bg: var(--andy-color-primary);
1727
+ --andy-themable-button-primary-text: var(--andy-color-white);
1728
+ --andy-themable-button-primary-hover: var(--andy-color-primary-hover);
1729
+ --andy-themable-button-secondary-bg: var(--andy-color-background-tertiary-dark);
1730
+ --andy-themable-button-secondary-text: var(--andy-color-text-dark);
1731
+ --andy-themable-button-secondary-hover: var(--andy-color-hover-dark);
1732
+ --andy-themable-input-bg: var(--andy-color-background-tertiary-dark);
1733
+ --andy-themable-input-border: var(--andy-color-border-dark);
1734
+ --andy-themable-input-text: var(--andy-color-text-dark);
1735
+ --andy-themable-input-placeholder: var(--andy-color-text-muted-dark);
1736
+ --andy-themable-message-user-bg: var(--andy-color-user-message);
1737
+ --andy-themable-message-user-text: var(--andy-color-user-message-text);
1738
+ --andy-themable-message-bot-bg: #353535;
1739
+ --andy-themable-message-bot-text: var(--andy-color-text-dark);
1740
+ --andy-themable-message-bot-border: rgba(255, 255, 255, 0.08);
1741
+ --andy-themable-avatar-bg: var(--andy-color-primary);
1742
+ --andy-themable-avatar-text: var(--andy-color-white);
1743
+ --andy-themable-tooltip-bg: var(--andy-color-background-secondary-dark);
1744
+ --andy-themable-tooltip-text: var(--andy-color-text-dark);
1745
+ }
1746
+
1747
+ /* Auto Theme */
1748
+ :host(.andy-theme-auto) {
1749
+ --andy-themable-background: var(--andy-color-background);
1750
+ --andy-themable-background-secondary: var(--andy-color-white);
1751
+ --andy-themable-background-tertiary: var(--andy-color-gray-100);
1752
+ --andy-themable-text: var(--andy-color-text);
1753
+ --andy-themable-text-secondary: var(--andy-color-text-secondary);
1754
+ --andy-themable-text-muted: var(--andy-color-text-muted);
1755
+ --andy-themable-border: var(--andy-color-border);
1756
+ --andy-themable-hover: var(--andy-color-hover);
1757
+ --andy-themable-button-primary-bg: var(--andy-color-primary);
1758
+ --andy-themable-button-primary-text: var(--andy-color-white);
1759
+ --andy-themable-button-primary-hover: var(--andy-color-primary-hover);
1760
+ --andy-themable-button-secondary-bg: var(--andy-color-gray-200);
1761
+ --andy-themable-button-secondary-text: var(--andy-color-text);
1762
+ --andy-themable-button-secondary-hover: var(--andy-color-gray-300);
1763
+ --andy-themable-input-bg: var(--andy-color-input-background);
1764
+ --andy-themable-input-border: var(--andy-color-border);
1765
+ --andy-themable-input-text: var(--andy-color-text);
1766
+ --andy-themable-input-placeholder: var(--andy-color-text-muted);
1767
+ --andy-themable-message-user-bg: var(--andy-color-user-message);
1768
+ --andy-themable-message-user-text: var(--andy-color-user-message-text);
1769
+ --andy-themable-message-bot-bg: var(--andy-color-bot-message);
1770
+ --andy-themable-message-bot-text: var(--andy-color-bot-message-text);
1771
+ --andy-themable-avatar-bg: var(--andy-color-primary);
1772
+ --andy-themable-avatar-text: var(--andy-color-white);
1773
+ --andy-themable-tooltip-bg: var(--andy-color-gray-800);
1774
+ --andy-themable-tooltip-text: var(--andy-color-white);
1775
+ }
1776
+
1777
+ @media (prefers-color-scheme: dark) {
1778
+ :host(.andy-theme-auto) {
1779
+ --andy-themable-background: var(--andy-color-background-dark);
1780
+ --andy-themable-background-secondary: var(--andy-color-background-secondary-dark);
1781
+ --andy-themable-background-tertiary: var(--andy-color-background-tertiary-dark);
1782
+ --andy-themable-text: var(--andy-color-text-dark);
1783
+ --andy-themable-text-secondary: var(--andy-color-text-dark);
1784
+ --andy-themable-text-muted: var(--andy-color-text-muted-dark);
1785
+ --andy-themable-border: var(--andy-color-border-dark);
1786
+ --andy-themable-hover: var(--andy-color-hover-dark);
1787
+ --andy-themable-shadow: rgba(0, 0, 0, 0.3);
1788
+ --andy-themable-shadow-light: rgba(0, 0, 0, 0.2);
1789
+ --andy-themable-button-secondary-bg: var(--andy-color-background-tertiary-dark);
1790
+ --andy-themable-button-secondary-text: var(--andy-color-text-dark);
1791
+ --andy-themable-button-secondary-hover: var(--andy-color-hover-dark);
1792
+ --andy-themable-input-bg: var(--andy-color-background-tertiary-dark);
1793
+ --andy-themable-input-border: var(--andy-color-border-dark);
1794
+ --andy-themable-input-text: var(--andy-color-text-dark);
1795
+ --andy-themable-input-placeholder: var(--andy-color-text-muted-dark);
1796
+ --andy-themable-message-bot-bg: #353535;
1797
+ --andy-themable-message-bot-text: var(--andy-color-text-dark);
1798
+ --andy-themable-message-bot-border: rgba(255, 255, 255, 0.08);
1799
+ --andy-themable-tooltip-bg: var(--andy-color-background-secondary-dark);
1800
+ --andy-themable-tooltip-text: var(--andy-color-text-dark);
1801
+ }
1802
+ }
1803
+ `,Me=(t,e=!0)=>{if(!e)return`
1804
+ /* Bubble: neutral background based on theme */
1805
+ .andy-chat-bubble,
1806
+ .andy-chat-bubble--pill {
1807
+ background: var(--andy-themable-background-tertiary) !important;
1808
+ color: var(--andy-themable-text) !important;
1809
+ }
1810
+ .andy-chat-bubble:hover,
1811
+ .andy-chat-bubble--pill:hover {
1812
+ background: var(--andy-themable-hover) !important;
1813
+ }
1814
+
1815
+ /* Bubble icon: use theme text color for contrast */
1816
+ .andy-chat-bubble__icon {
1817
+ color: var(--andy-themable-text) !important;
1818
+ stroke: var(--andy-themable-text) !important;
1819
+ fill: var(--andy-themable-text) !important;
1820
+ filter: none !important; /* Reset the brightness filter */
1821
+ }
1822
+ .andy-chat-bubble__icon path {
1823
+ stroke: inherit !important;
1824
+ fill: inherit !important;
1825
+ }
1826
+
1827
+ /* Dark mode: use filter to make icon white */
1828
+ .andy-chat-bubble--theme-dark .andy-chat-bubble__icon {
1829
+ filter: brightness(0) invert(1) !important;
1830
+ }
1831
+ .andy-chat-bubble--theme-dark .andy-chat-bubble__icon path {
1832
+ fill: currentColor !important;
1833
+ }
1834
+ .andy-chat-bubble__label {
1835
+ color: var(--andy-themable-text) !important;
1836
+ }
1837
+
1838
+ /* User messages: subtle neutral background */
1839
+ .andy-message--user {
1840
+ background: var(--andy-themable-background-tertiary) !important;
1841
+ color: var(--andy-themable-text) !important;
1842
+ }
1843
+
1844
+ /* Send button: neutral with proper icon contrast */
1845
+ .andy-input__button {
1846
+ background: var(--andy-themable-background-tertiary) !important;
1847
+ color: var(--andy-themable-text) !important;
1848
+ }
1849
+ .andy-input__button:hover {
1850
+ background: var(--andy-themable-hover) !important;
1851
+ }
1852
+ .andy-input__button-icon {
1853
+ color: var(--andy-themable-text) !important;
1854
+ fill: var(--andy-themable-text) !important;
1855
+ }
1856
+
1857
+ /* Avatar: neutral */
1858
+ .andy-bot-header__icon {
1859
+ background: var(--andy-themable-background-tertiary) !important;
1860
+ color: var(--andy-themable-text) !important;
1861
+ }
1862
+
1863
+ /* Header avatar: neutral */
1864
+ .andy-header__avatar {
1865
+ background: var(--andy-themable-background-tertiary) !important;
1866
+ color: var(--andy-themable-text) !important;
1867
+ }
1868
+ .andy-header__avatar-icon--default {
1869
+ filter: none !important;
1870
+ }
1871
+ /* Dark mode: make header avatar icon white */
1872
+ :host(.andy-theme-dark) .andy-header__avatar-icon--default {
1873
+ filter: brightness(0) invert(1) !important;
1874
+ }
1875
+
1876
+ /* Remove welcome popup accent border */
1877
+ .andy-welcome-popup__content {
1878
+ border-left: none !important;
1879
+ }
1880
+
1881
+ /* Predefined questions and links: neutral text color */
1882
+ .andy-predefined-question,
1883
+ .andy-message__link,
1884
+ .andy-chat-faq__back {
1885
+ color: var(--andy-themable-text-secondary) !important;
1886
+ }
1887
+ .andy-predefined-question:hover,
1888
+ .andy-message__link:hover,
1889
+ .andy-chat-faq__back:hover {
1890
+ color: var(--andy-themable-text) !important;
1891
+ }
1892
+ `;let a=t||"#3B82F6",n=a,o=Le(a);return`
1893
+ :host {
1894
+ --andy-color-primary: ${a};
1895
+ --andy-color-primary-hover: ${n};
1896
+ --andy-themable-button-primary-bg: ${a};
1897
+ --andy-themable-button-primary-hover: ${n};
1898
+ --andy-themable-button-primary-text: ${o};
1899
+ --andy-themable-message-user-bg: ${a};
1900
+ --andy-themable-message-user-text: ${o};
1901
+ --andy-themable-avatar-bg: ${a};
1902
+ }
1903
+
1904
+ /* Override theme-specific button text with contrast color */
1905
+ :host(.andy-theme-light),
1906
+ :host(.andy-theme-dark),
1907
+ :host(.andy-theme-auto) {
1908
+ --andy-themable-button-primary-text: ${o};
1909
+ --andy-themable-message-user-text: ${o};
1910
+ }
1911
+
1912
+ /* Chat bubble icon contrast color - use !important to override theme defaults */
1913
+ .andy-chat-bubble {
1914
+ color: ${o} !important;
1915
+ }
1916
+ .andy-chat-bubble__icon {
1917
+ color: ${o} !important;
1918
+ stroke: ${o} !important;
1919
+ fill: ${o} !important;
1920
+ }
1921
+ .andy-chat-bubble__icon path {
1922
+ stroke: inherit !important;
1923
+ fill: inherit !important;
1924
+ }
1925
+ .andy-chat-bubble__label {
1926
+ color: ${o} !important;
1927
+ }
1928
+
1929
+ /* Send button contrast color */
1930
+ .andy-input__button {
1931
+ color: ${o} !important;
1932
+ }
1933
+ .andy-input__button-icon {
1934
+ color: ${o} !important;
1935
+ fill: ${o} !important;
1936
+ }
1937
+
1938
+ /* User message text contrast */
1939
+ .andy-message--user {
1940
+ color: ${o} !important;
1941
+ }
1942
+
1943
+ /* Welcome popup accent border when brand color is enabled */
1944
+ .andy-welcome-popup__content {
1945
+ border-left: 3px solid ${a};
1946
+ }
1947
+ `},O=(t={})=>{let e="";return e+=Se(),e+=Te(),e+=Be(),e+=Me(t.color,t.useBrandColor??!0),t.fontFamily&&(e+=`
1948
+ :host {
1949
+ --andy-font-family-primary: "${t.fontFamily.replace(/"/g,'\\"')}";
1950
+ }
1951
+ `),t.borderRadius&&(e+=`
1952
+ :host {
1953
+ --andy-radius-base: ${t.borderRadius};
1954
+ --andy-radius-lg: ${t.borderRadius};
1955
+ }
1956
+ `),e};var qe="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJsdWNpZGUgbHVjaWRlLWJvdC1pY29uIGx1Y2lkZS1ib3QiPjxwYXRoIGQ9Ik0xMiA4VjRIOCIvPjxyZWN0IHdpZHRoPSIxNiIgaGVpZ2h0PSIxMiIgeD0iNCIgeT0iOCIgcng9IjIiLz48cGF0aCBkPSJNMiAxNGgyIi8+PHBhdGggZD0iTTIwIDE0aDIiLz48cGF0aCBkPSJNMTUgMTN2MiIvPjxwYXRoIGQ9Ik05IDEzdjIiLz48L3N2Zz4K",m=qe,ae=`<img src="${m}" alt="Chat" class="andy-chat-bubble__icon" />`,We=`<img src="${m}" alt="Bot Avatar" class="andy-header__avatar-icon andy-header__avatar-icon--default" />`,je=`<img src="${m}" alt="Bot Avatar" class="andy-bot-header__icon-image andy-bot-header__icon-image--default" />`,Ye=`<img src="${m}" alt="Bot Avatar" class="andy-avatar__icon andy-avatar__icon--default" />`,ne="Powered by Andy",U="https://andypartner.com/",oe=()=>{try{if(typeof window>"u"||!window.location)return U;let t=window.location.hostname||"direct";t==="localhost"||t==="127.0.0.1"||t.match(/^\d+\.\d+\.\d+\.\d+$/)?t="localhost":t=t.replace(/^www\./,"").toLowerCase();let e=encodeURIComponent(t);return`${U}?ref=${e}`}catch{return U}};var F=class{constructor(){this.isKeyboardOpen=!1,this.keyboardHeight=0,this.listeners=new Set,this.inputElement=null,this.viewportHeight=window.innerHeight,this.visualViewport=window.visualViewport,this.initializeDetection()}initializeDetection(){this.visualViewport?(this.visualViewport.addEventListener("resize",this.handleViewportResize.bind(this)),this.visualViewport.addEventListener("scroll",this.handleViewportScroll.bind(this))):window.addEventListener("resize",this.handleWindowResize.bind(this)),document.addEventListener("focusin",this.handleFocusIn.bind(this),!0),document.addEventListener("focusout",this.handleFocusOut.bind(this),!0),window.addEventListener("orientationchange",this.handleOrientationChange.bind(this))}handleViewportResize(){let e=this.visualViewport.height,a=window.innerHeight-e;a>100?this.setKeyboardOpen(!0,a):a<50&&this.setKeyboardOpen(!1,0)}handleViewportScroll(){this.visualViewport.offsetTop>0&&this.setKeyboardOpen(!0,this.visualViewport.offsetTop)}handleWindowResize(){let e=window.innerHeight,a=this.viewportHeight-e;a>100?this.setKeyboardOpen(!0,a):Math.abs(a)<50&&(this.setKeyboardOpen(!1,0),this.viewportHeight=e)}handleFocusIn(e){["input","textarea"].includes(e.target.tagName.toLowerCase())&&(this.inputElement=e.target,setTimeout(()=>{this.inputElement===e.target&&this.checkKeyboardStatus()},300))}handleFocusOut(e){["input","textarea"].includes(e.target.tagName.toLowerCase())&&this.inputElement===e.target&&(this.inputElement=null,setTimeout(()=>{this.inputElement||this.setKeyboardOpen(!1,0)},300))}handleOrientationChange(){setTimeout(()=>{this.viewportHeight=window.innerHeight,this.checkKeyboardStatus()},500)}checkKeyboardStatus(){if(!this.visualViewport){let e=window.innerHeight,a=this.viewportHeight-e;this.inputElement&&a>100&&this.setKeyboardOpen(!0,a)}}setKeyboardOpen(e,a){let n=this.isKeyboardOpen!==e||this.keyboardHeight!==a;this.isKeyboardOpen=e,this.keyboardHeight=a,n&&this.notifyListeners()}addListener(e){this.listeners.add(e),e({isOpen:this.isKeyboardOpen,height:this.keyboardHeight})}removeListener(e){this.listeners.delete(e)}notifyListeners(){let e={isOpen:this.isKeyboardOpen,height:this.keyboardHeight};this.listeners.forEach(a=>{try{a(e)}catch(n){console.error("Error in keyboard detector listener:",n)}})}getState(){return{isOpen:this.isKeyboardOpen,height:this.keyboardHeight}}destroy(){this.visualViewport?(this.visualViewport.removeEventListener("resize",this.handleViewportResize.bind(this)),this.visualViewport.removeEventListener("scroll",this.handleViewportScroll.bind(this))):window.removeEventListener("resize",this.handleWindowResize.bind(this)),document.removeEventListener("focusin",this.handleFocusIn.bind(this),!0),document.removeEventListener("focusout",this.handleFocusOut.bind(this),!0),window.removeEventListener("orientationchange",this.handleOrientationChange.bind(this)),this.listeners.clear()}},D=null;function re(){return D||(D=new F),D}function ie(t,e){t&&t.style.setProperty("--andy-keyboard-height",`${e}px`)}var se=()=>{let t="ontouchstart"in window||navigator.maxTouchPoints>0,e=window.innerWidth<=768,n=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),o="orientation"in window&&"ondeviceorientation"in window,i=window.matchMedia("(max-width: 768px) and (hover: none)").matches;return t&&e||n||i};var de=()=>{let t=document.createElement("div");t.id="andy-chatbot-container",document.body.appendChild(t);let e=t.attachShadow({mode:"open"}),a=document.createElement("style");return a.textContent=O(),e.appendChild(a),{container:t,shadow:e}},le=(t,e={})=>{let a=document.createElement("button");a.type="button",a.className="andy-chat-bubble",a.setAttribute("aria-label","Open chat");let n=e.tooltip?`<span class="andy-chat-bubble__tooltip" role="tooltip">${e.tooltip}</span>`:"";a.innerHTML=`
1957
+ <img src="${m}" alt="Chat" class="andy-chat-bubble__icon" />
1958
+ ${n}
1959
+ `,t.appendChild(a);let o=document.createElement("div");return o.className="andy-chat-window",o.innerHTML=`
1960
+ <header class="andy-header">
1961
+ <button type="button" class="andy-header__back" id="andy-back-button" aria-label="Go back">
1962
+ <svg class="andy-header__back-icon" width="20" height="20" viewBox="0 0 24 24" fill="none">
1963
+ <path d="M15 18l-6-6 6-6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
1964
+ </svg>
1965
+ </button>
1966
+
1967
+ <div class="andy-header__bot-info">
1968
+ <div class="andy-header__avatar">
1969
+ <img src="${m}" alt="Bot Avatar" class="andy-header__avatar-icon andy-header__avatar-icon--default" />
1970
+ </div>
1971
+ <div class="andy-header__text">
1972
+ <h1 class="andy-header__name">Andy bot</h1>
1973
+ <p class="andy-header__subtitle"></p>
1974
+ </div>
1975
+ </div>
1976
+
1977
+ <!-- FAQ button disabled for now
1978
+ <button type="button" class="andy-header__faq" id="andy-faq-button" aria-label="Help">
1979
+ <svg class="andy-header__faq-icon" width="20" height="20" viewBox="0 0 24 24" fill="none">
1980
+ <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75l-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z" fill="currentColor"/>
1981
+ </svg>
1982
+ </button>
1983
+ -->
1984
+
1985
+ <button type="button" class="andy-header__close" id="andy-close-button" aria-label="Close chat">
1986
+ <svg class="andy-header__close-icon" width="20" height="20" viewBox="0 0 24 24" fill="none">
1987
+ <path d="M18 6L6 18M6 6l12 12" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
1988
+ </svg>
1989
+ </button>
1990
+ </header>
1991
+
1992
+ <div class="andy-chat-window__messages" id="andy-messages">
1993
+ <div class="andy-chat-subtitle">
1994
+ <p class="andy-chat-subtitle__text"></p>
1995
+ </div>
1996
+ <!-- Messages will be populated dynamically -->
1997
+ </div>
1998
+
1999
+ <div class="andy-chat-window__faq" id="andy-faq-container">
2000
+ <div class="andy-faq">
2001
+ <div class="andy-faq__header">
2002
+ <button type="button" class="andy-faq__back-button" id="andy-back-to-chat">
2003
+ <svg class="andy-faq__back-icon" width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2004
+ <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" fill="currentColor"/>
2005
+ </svg>
2006
+ Back to chat
2007
+ </button>
2008
+ <h2 class="andy-faq__title">Frequently Asked Questions</h2>
2009
+ </div>
2010
+ <div class="andy-faq__list" id="andy-faq-list">
2011
+ <!-- FAQ items will be populated dynamically -->
2012
+ </div>
2013
+ </div>
2014
+ </div>
2015
+
2016
+ <!-- Bottom section with predefined questions and input -->
2017
+ <div class="andy-chat-window__bottom">
2018
+ <!-- Predefined questions (if any) -->
2019
+ <div class="andy-predefined-questions" id="andy-predefined-questions">
2020
+ <div class="andy-predefined-questions__header">
2021
+ <p class="andy-predefined-questions__title">What would you like to know?</p>
2022
+ </div>
2023
+ <div class="andy-predefined-questions__list">
2024
+ <!-- Will be populated dynamically -->
2025
+ </div>
2026
+ </div>
2027
+
2028
+ <!-- Input area -->
2029
+ <div class="andy-chat-window__input">
2030
+ <div class="andy-input-container">
2031
+ <div class="andy-input">
2032
+ <input type="text" class="andy-input__field" id="andy-message-input" placeholder="..." aria-label="Message input" disabled />
2033
+ <button type="button" class="andy-input__button" id="andy-send-button" aria-label="Send message" disabled>
2034
+ <svg class="andy-input__button-icon" width="18" height="18" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
2035
+ <path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z" />
2036
+ </svg>
2037
+ </button>
2038
+ </div>
2039
+ </div>
2040
+ </div>
2041
+
2042
+ <!-- Footer -->
2043
+ <footer class="andy-chat-window__footer">
2044
+ <a href="${oe()}" target="_blank" rel="noopener noreferrer" class="andy-chat-window__footer-link">
2045
+ <span class="andy-chat-window__footer-text">${ne}</span>
2046
+ </a>
2047
+ </footer>
2048
+ </div>
2049
+ `,t.appendChild(o),{bubble:a,chatbot:o}},ce=(t,e)=>{if(!e)return;let a=t.querySelector(".andy-header__name"),n=t.querySelector(".andy-header__subtitle"),o=t.querySelector(".andy-chat-window"),i=t.querySelector(".andy-chat-bubble"),r=t.querySelector(".andy-header__avatar"),s=t.querySelector(".andy-chat-window__footer");s&&(s.style.display=e.showBranding===!1?"none":""),t.host.classList.remove("andy-theme-dark","andy-theme-light"),e.theme==="dark"?t.host.classList.add("andy-theme-dark"):t.host.classList.add("andy-theme-light"),t.host.classList.remove("andy-orientation-left","andy-orientation-right"),e.orientation==="left"?t.host.classList.add("andy-orientation-left"):t.host.classList.add("andy-orientation-right");let d=t.querySelector("style");if(d){let y={color:e.brandColor,useBrandColor:e.useBrandColor??!0,theme:e.theme||"light",orientation:e.orientation||"right"};d.textContent=O(y)}if(i){let y=i.parentNode.querySelector(".andy-chat-window"),b=y&&y.classList.contains("andy-chat-window--open"),p=e.bubbleStyle==="pill",w=e.bubbleLabel||(p?q(e.defaultLang||"en"):null),v=e.logoUrl||m;i.classList.remove("andy-chat-bubble--pill","andy-chat-bubble--open"),p&&i.classList.add("andy-chat-bubble--pill"),b&&i.classList.add("andy-chat-bubble--open"),i.classList.add("andy-chat-bubble--loaded");let f=i.querySelector(".andy-chat-bubble__tooltip"),k=!b&&f&&!p?f.outerHTML:"",h=e.useBrandColor??!0,x=e.theme==="dark",B=!h&&x?"filter: brightness(0) invert(1);":h||x?"":"filter: none;";b||(p&&w?i.innerHTML=`
2050
+ <span class="andy-chat-bubble__label">${w}</span>
2051
+ <img src="${v}" alt="Chat" class="andy-chat-bubble__icon--pill" style="${B}" />
2052
+ `:e.logoUrl?i.innerHTML=`<img src="${e.logoUrl}" alt="Chatbot Logo" class="andy-chat-bubble__logo" style="${B}" />${k}`:!i.querySelector(".andy-chat-bubble__icon")&&!i.querySelector(".andy-chat-bubble__logo")&&(i.innerHTML=`
2053
+ <img src="${m}" alt="Chat" class="andy-chat-bubble__icon" style="${B}" />
2054
+ ${k}
2055
+ `))}r&&e.logoUrl?r.innerHTML=`<img src="${e.logoUrl}" alt="Bot Avatar" class="andy-header__avatar-image" />`:r&&(r.querySelector(".andy-header__avatar-icon")||(r.innerHTML=`<img src="${m}" alt="Bot Avatar" class="andy-header__avatar-icon andy-header__avatar-icon--default" />`)),a&&(a.textContent=e.name||"Andy bot"),n&&e.headline&&(n.textContent=e.headline,n.title=e.headline);let l=t.querySelector(".andy-chat-subtitle__text");l&&e.description&&(l.textContent=e.description);let c=t.getElementById("andy-predefined-questions");if(c&&e.predefinedQuestions&&e.predefinedQuestions.length>0){let y=c.querySelector(".andy-predefined-questions__list");y&&(y.innerHTML=e.predefinedQuestions.map(b=>`
2056
+ <button type="button" class="andy-predefined-question" data-question="${b.question}">
2057
+ <span class="andy-predefined-question__icon">\u{1F4AC}</span>
2058
+ <span class="andy-predefined-question__text">${b.question}</span>
2059
+ </button>
2060
+ `).join("")),c.style.display="flex"}else c&&(c.style.display="none")},ye=t=>({messagesContainer:t.getElementById("andy-messages"),faqContainer:t.getElementById("andy-faq-container"),faqList:t.getElementById("andy-faq-list"),titleElement:t.querySelector(".andy-header__title"),subtitleElement:t.querySelector(".andy-header__subtitle"),inputElement:t.getElementById("andy-message-input"),sendButton:t.getElementById("andy-send-button"),closeButton:t.getElementById("andy-close-button"),newChatButton:t.getElementById("andy-new-chat"),faqButton:t.getElementById("andy-faq-button"),backToChatButton:t.getElementById("andy-back-to-chat"),footer:t.querySelector(".andy-chat-window__footer-link"),inputAreaContainer:t.querySelector(".andy-input-container"),bottomSection:t.querySelector(".andy-chat-window__bottom"),predefinedQuestionsContainer:t.getElementById("andy-predefined-questions"),backButton:t.getElementById("andy-back-button")}),he=(t,e)=>{let a=document.createElement("div");return a.className="andy-welcome-popup",a.setAttribute("role","dialog"),a.setAttribute("aria-label","Welcome message"),a.innerHTML=`
2061
+ <div class="andy-welcome-popup__content">
2062
+ <div class="andy-welcome-popup__message">${t}</div>
2063
+ <button type="button" class="andy-welcome-popup__close" aria-label="Close welcome message">
2064
+ <svg class="andy-welcome-popup__close-icon" width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2065
+ <path d="M18 6L6 18M6 6l12 12" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
2066
+ </svg>
2067
+ </button>
2068
+ </div>
2069
+ <div class="andy-welcome-popup__arrow"></div>
2070
+ `,a},be=(t,e)=>{let a=document.createElement("div");return a.className="andy-user-info-form",a.innerHTML=`
2071
+ <div class="andy-user-info-form__content">
2072
+ <h3 class="andy-user-info-form__title">${t||"Please provide your information"}</h3>
2073
+ <form class="andy-user-info-form__form" id="andy-user-info-form">
2074
+ <div class="andy-form-group">
2075
+ <label for="andy-user-name" class="andy-form-group__label">Name</label>
2076
+ <input type="text" id="andy-user-name" class="andy-form-group__input" placeholder="Your Name" required />
2077
+ </div>
2078
+ <div class="andy-form-group">
2079
+ <label for="andy-user-email" class="andy-form-group__label">Email</label>
2080
+ <input type="email" id="andy-user-email" class="andy-form-group__input" placeholder="Your Email" required />
2081
+ </div>
2082
+ <button type="submit" class="andy-button andy-button--primary andy-user-info-form__submit">
2083
+ Submit
2084
+ </button>
2085
+ </form>
2086
+ </div>
2087
+ `,a};var g=(t,e,a,n=!1,o=null,i=null)=>{let r=document.createElement("div"),s;if(a==="bot"){r.className="andy-message-container andy-message-container--bot";let d=e;if(n){let y=e.split(`
2088
+ `);y.length>1&&(d=`<div class="andy-message__greeting-title">${y[0]}</div><div class="andy-message__greeting-content">${y.slice(1).join("<br>")}</div>`)}else/<\/?[a-z][\s\S]*>/i.test(e)?d=e:d=te(e);let l;o?l=`<img src="${o}" alt="Bot Avatar" class="andy-avatar__image" />`:l=`<img src="${m}" alt="Bot Avatar" class="andy-avatar__icon andy-avatar__icon--default" />`;let c;o?c=`<img src="${o}" alt="Bot Avatar" class="andy-bot-header__icon-image" />`:c=`<img src="${m}" alt="Bot Avatar" class="andy-bot-header__icon-image andy-bot-header__icon-image--default" />`,r.innerHTML=`
2089
+ <div class="andy-message andy-message--bot ${n?"andy-message--greeting":""}">
2090
+ <div class="andy-bot-header">
2091
+ <div class="andy-bot-header__icon">
2092
+ ${c}
2093
+ </div>
2094
+ <span class="andy-bot-header__name">${i||"Andy bot"}</span>
2095
+ </div>
2096
+ <div class="andy-message__content">
2097
+ ${d}
2098
+ </div>
2099
+ </div>
2100
+ `,s=r.querySelector(".andy-message__content")}else r.className="andy-message-container andy-message-container--user",r.innerHTML=`
2101
+ <div class="andy-message andy-message--user">
2102
+ <div class="andy-message__content">
2103
+ <p>${e}</p>
2104
+ </div>
2105
+ </div>
2106
+ `,s=r.querySelector(".andy-message__content");return t.appendChild(r),t.scrollTop=t.scrollHeight,s};var pe=t=>{let e=document.createElement("div");return e.className="andy-message-container andy-message-container--bot andy-message-container--typing",e.innerHTML=`
2107
+ <div class="andy-message andy-message--bot andy-message--typing">
2108
+ <div class="andy-typing-indicator">
2109
+ <div class="andy-typing-indicator__dot"></div>
2110
+ <div class="andy-typing-indicator__dot"></div>
2111
+ <div class="andy-typing-indicator__dot"></div>
2112
+ </div>
2113
+ </div>
2114
+ `,t.appendChild(e),t.scrollTop=t.scrollHeight,e},z=t=>{t&&t.parentNode&&t.parentNode.removeChild(t)};var P=(t,e,a)=>(e.style.display="none",t.style.display="flex",a&&(a.style.display="flex"),!1);var L=(t,e,a)=>{if(!t)return;let n=e?.bubbleStyle==="pill",o=e?.bubbleLabel||(n?q(e?.defaultLang||"en"):null),i=e?.logoUrl||m;t.classList.remove("andy-chat-bubble--pill","andy-chat-bubble--open","andy-chat-bubble--theme-dark"),n&&t.classList.add("andy-chat-bubble--pill"),a&&t.classList.add("andy-chat-bubble--open"),e?.theme==="dark"&&t.classList.add("andy-chat-bubble--theme-dark");let r=t.querySelector(".andy-chat-bubble__tooltip"),s=!a&&r&&!n?r.outerHTML:"",d=e?.useBrandColor??!0,l=e?.theme==="dark",b=!d&&l?"filter: brightness(0) invert(1);":d||l?"":"filter: none;";if(a)t.innerHTML=`
2115
+ <svg class="andy-chat-bubble__icon" style="${b}" width="28" height="28" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
2116
+ <path d="M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z" />
2117
+ </svg>
2118
+ `;else if(n&&o)t.innerHTML=`
2119
+ <span class="andy-chat-bubble__label">${o}</span>
2120
+ <img src="${i}" alt="Chat" class="andy-chat-bubble__icon--pill" style="${b}" />
2121
+ `;else if(e&&e.logoUrl)t.innerHTML=`<img src="${e.logoUrl}" alt="Chatbot Logo" class="andy-chat-bubble__logo" style="${b}" />${s}`;else{let p=ae.replace('class="andy-chat-bubble__icon"',`class="andy-chat-bubble__icon" style="${b}"`);t.innerHTML=`
2122
+ ${p}
2123
+ ${s}
2124
+ `}},me=(t,e)=>t.classList.contains("andy-chat-window--open")?(t.classList.remove("andy-chat-window--open"),!1):(t.classList.add("andy-chat-window--open"),setTimeout(()=>{e.focus()},100),!0),Ne=(t,e)=>{let a=t.elements.messagesContainer;a.innerHTML="",t.sessionId=I(),t.userInfoCollected=!1,t.isCollectingUserInfo=!1,e.disabled=!1,t.elements.sendButton.disabled=!1;let n=t.elements.predefinedQuestionsContainer;if(n&&t.config&&t.config.predefinedQuestions&&t.config.predefinedQuestions.length>0&&(n.style.display="flex"),e.focus(),t.config&&t.config.welcomeMessage){let o=E(t.config);o&&g(a,o.content||o,"bot",!0,t.config.logoUrl)}};function $(t,e,a,n,o){let i=t.value.trim();if(!i)return!1;g(e,i,"user"),e.scrollTop=e.scrollHeight;let r=n.elements.predefinedQuestionsContainer;return r&&(r.style.display="none"),t.value="",n._sendApiRequest(i),!0}var He=(t,e)=>{if(!e||t.isCollectingUserInfo)return;let a=e.trim();if(!a)return;let{inputElement:n,messagesContainer:o,sendButton:i,predefinedQuestionsContainer:r}=t.elements;n&&o&&(n.value=a,$(n,o,t.embedId,t,i))||o&&(g(o,a,"user"),o.scrollTop=o.scrollHeight,r&&(r.style.display="none"),t._sendApiRequest(a))},ue=(t,e,a,n,o)=>{let{bubble:i,chatbot:r,messagesContainer:s,faqContainer:d,faqList:l,inputElement:c,sendButton:y,closeButton:b,newChatButton:p,faqButton:w,backToChatButton:v}=t,f=!1;i.addEventListener("click",()=>{if(o.isLoading){r.classList.add("andy-chat-window--open"),f=!0,s.innerHTML=`
2125
+ <div class="andy-message-container andy-message-container--bot andy-message-container--loading">
2126
+ <div class="andy-avatar andy-avatar--bot">
2127
+ <svg class="andy-avatar__icon" width="18" height="18" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2128
+ <path d="M20 2H4C2.9 2 2 2.9 2 4V22L6 18H20C21.1 18 22 17.1 22 16V4C22 2.9 21.1 2 20 2Z" fill="currentColor"/>
2129
+ </svg>
2130
+ </div>
2131
+ <div class="andy-message andy-message--bot andy-message--loading">
2132
+ <div class="andy-typing-indicator">
2133
+ <div class="andy-typing-indicator__dot"></div>
2134
+ <div class="andy-typing-indicator__dot"></div>
2135
+ <div class="andy-typing-indicator__dot"></div>
2136
+ </div>
2137
+ <div class="andy-loading-text">Loading chatbot...</div>
2138
+ </div>
2139
+ </div>
2140
+ `;return}if(f=me(r,c),f){L(i,o.config,!0),s.scrollTop=s.scrollHeight,o.showingFaq=!1;let h=e.querySelector(".andy-chat-window__bottom");P(s,d,h),o.elements.welcomePopup&&o.elements.welcomePopup.style.display!=="none"&&(o.elements.welcomePopup.style.display="none")}else L(i,o.config,!1)}),b&&b.addEventListener("click",h=>{r.classList.remove("andy-chat-window--open"),f=!1,L(i,o.config,!1)}),document.addEventListener("click",h=>{if(se()||!f)return;let x=window.getSelection();if(x&&x.toString().length>0)return;let T=e.host,C=!1;T.contains(h.target)&&(C=!0),h.composedPath&&h.composedPath().includes(T)&&(C=!0),h.target===T&&(C=!0),C||(f=me(r,c),L(i,o.config,!1))}),e.addEventListener("click",h=>{h.target.closest("#andy-close-button")||h.target.closest("#andy-send-button")||h.target.closest(".andy-predefined-question")||h.target.closest(".andy-chat-window")&&h.stopPropagation()},!0);let k=e.getElementById("andy-back-button");k&&k.addEventListener("click",()=>{r.classList.remove("andy-chat-window--open"),f=!1,L(i,o.config,!1)}),v&&v.addEventListener("click",()=>{let h=e.querySelector(".andy-chat-window__bottom");o.showingFaq=P(s,d,h)}),p&&p.addEventListener("click",()=>{Ne(o,c)}),e.addEventListener("click",h=>{if(h.target.closest(".andy-predefined-question")){let x=h.target.closest(".andy-predefined-question").dataset.question;x&&He(o,x)}}),e.addEventListener("click",h=>{h.target.closest("#andy-send-button")&&(h.preventDefault(),h.stopPropagation(),$(c,s,n,o,y))}),c&&c.addEventListener("keydown",h=>{h.key==="Enter"&&!h.shiftKey&&(h.preventDefault(),$(c,s,n,o,y))})};var{SESSION_STORAGE_KEY:S,FORM_DISPLAY_DELAY_MS:Oe,PERSIST_SESSION:ge}=u,R=class{constructor(){if(window.AndyChatbotLoaded)return;window.AndyChatbotLoaded=!0;let e=X("andy-widget-vanilla");if(!e.success){console.error("AndyChat Configuration Error:",e.error);return}if(this.config=null,this.isLoading=!0,this.showingFaq=!1,this.embedId=e.embedId,this.userInfoCollected=!1,this.isCollectingUserInfo=!1,this.sessionId=I(),this.welcomePopupShown=!1,this.tooltip=this.getTooltipFromScriptTag(),this.propOverrides=this.getPropOverrides(),!this.embedId||!A(this.embedId)){console.error("AndyChat Error: Invalid embed ID provided"),this.handleInvalidEmbedId();return}this.initializeUI()}getTooltipFromScriptTag(){let e=document.getElementsByTagName("script");for(let a of e){let n=a.src||"";if(n.includes("andychat")||n.includes("andy-chat")||n.includes("bundle")){let o=a.getAttribute("data-andy-tooltip")||a.getAttribute("data-tooltip")||a.getAttribute("andy-tooltip");if(o&&o.trim())return o.trim()}}return window.ANDY_CHAT_TOOLTIP?window.ANDY_CHAT_TOOLTIP:null}getPropOverrides(){let e={},a=document.getElementsByTagName("script");for(let n of a){let o=n.src||"";if(o.includes("andychat")||o.includes("andy-chat")||o.includes("bundle")){let i=n.getAttribute("data-andy-name")||n.getAttribute("data-name")||n.getAttribute("andy-name");i&&i.trim()&&(e.name=i.trim());let r=n.getAttribute("data-andy-headline")||n.getAttribute("data-headline")||n.getAttribute("andy-headline");r&&r.trim()&&(e.headline=r.trim());let s=n.getAttribute("data-andy-description")||n.getAttribute("data-description")||n.getAttribute("andy-description");s&&s.trim()&&(e.description=s.trim());let d=n.getAttribute("data-andy-welcome-message")||n.getAttribute("data-welcome-message")||n.getAttribute("andy-welcome-message");d&&d.trim()&&(e.welcomeMessage=d.trim());let l=n.getAttribute("data-andy-theme")||n.getAttribute("data-theme")||n.getAttribute("andy-theme");l&&l.trim()&&(e.theme=l.trim());let c=n.getAttribute("data-andy-orientation")||n.getAttribute("data-orientation")||n.getAttribute("andy-orientation");c&&c.trim()&&(e.orientation=c.trim());let y=n.getAttribute("data-andy-brand-color")||n.getAttribute("data-brand-color")||n.getAttribute("andy-brand-color");y&&y.trim()&&(e.brandColor=y.trim());let b=n.getAttribute("data-andy-bubble-style")||n.getAttribute("data-bubble-style")||n.getAttribute("andy-bubble-style");b&&b.trim()&&(e.bubbleStyle=b.trim());let p=n.getAttribute("data-andy-bubble-label")||n.getAttribute("data-bubble-label")||n.getAttribute("andy-bubble-label");p&&p.trim()&&(e.bubbleLabel=p.trim());let w=n.getAttribute("data-andy-use-brand-color")||n.getAttribute("data-use-brand-color")||n.getAttribute("andy-use-brand-color");w!==null&&(e.useBrandColor=w==="true");let v=n.getAttribute("data-andy-logo-url")||n.getAttribute("data-logo-url")||n.getAttribute("andy-logo-url");v&&v.trim()&&(e.logoUrl=v.trim());break}}return window.ANDY_CHAT_NAME&&!e.name&&(e.name=window.ANDY_CHAT_NAME),window.ANDY_CHAT_HEADLINE&&!e.headline&&(e.headline=window.ANDY_CHAT_HEADLINE),window.ANDY_CHAT_DESCRIPTION&&!e.description&&(e.description=window.ANDY_CHAT_DESCRIPTION),window.ANDY_CHAT_WELCOME_MESSAGE&&!e.welcomeMessage&&(e.welcomeMessage=window.ANDY_CHAT_WELCOME_MESSAGE),window.ANDY_CHAT_THEME&&!e.theme&&(e.theme=window.ANDY_CHAT_THEME),window.ANDY_CHAT_ORIENTATION&&!e.orientation&&(e.orientation=window.ANDY_CHAT_ORIENTATION),window.ANDY_CHAT_BRAND_COLOR&&!e.brandColor&&(e.brandColor=window.ANDY_CHAT_BRAND_COLOR),window.ANDY_CHAT_BUBBLE_STYLE&&!e.bubbleStyle&&(e.bubbleStyle=window.ANDY_CHAT_BUBBLE_STYLE),window.ANDY_CHAT_BUBBLE_LABEL&&!e.bubbleLabel&&(e.bubbleLabel=window.ANDY_CHAT_BUBBLE_LABEL),window.ANDY_CHAT_USE_BRAND_COLOR!==void 0&&e.useBrandColor===void 0&&(e.useBrandColor=window.ANDY_CHAT_USE_BRAND_COLOR),window.ANDY_CHAT_LOGO_URL&&!e.logoUrl&&(e.logoUrl=window.ANDY_CHAT_LOGO_URL),e}handleInvalidEmbedId(){this.isLoading=!1,console.error("AndyChat Error: Missing or invalid chatbot ID. Please set ANDY_CHATBOT_ID or use data-andy-embed-id attribute.")}startNewChatSession(){if(this.sessionId=I(),ge?localStorage.setItem(S,this.sessionId):localStorage.removeItem(S),this.elements&&this.elements.messagesContainer&&(this.elements.messagesContainer.innerHTML="",this.config&&this.config.welcomeMessage)){let e=E(this.config);e&&g(this.elements.messagesContainer,e,"bot",!0,this.config.logoUrl,this.config.name)}}initializeUI(){let{container:e,shadow:a}=de(),{bubble:n,chatbot:o}=le(a,{tooltip:this.tooltip});this.shadow=a,this.chatbot=o,this.container=e,this.elements={...ye(a),bubble:n,chatbot:o},this.setupKeyboardDetection(),this.makeInteractive(),this.init()}makeInteractive(){let{bubble:e}=this.elements;e.classList.remove("andy-bubble-loading"),this.applyDefaultStyling()}setupKeyboardDetection(){let e=re();e.addListener(({isOpen:a,height:n})=>{ie(this.container,n);let o=this.shadow.querySelector(".andy-chat-window");o&&(a&&n>0?o.classList.add("andy-chat-window--keyboard-open"):o.classList.remove("andy-chat-window--keyboard-open"))}),this.keyboardDetector=e}applyDefaultStyling(){let e={brandColor:"#4086F4",orientation:"right",theme:"light"};this.shadow.host.classList.add("andy-light-theme");let{bubble:a,chatbot:n}=this.elements;a.style.right="30px",a.style.left="auto",n.style.right="30px",n.style.left="auto"}async init(){let{chatbot:e}=this.elements;try{let a=await J(this.embedId),n=G(a);if(!n.isValid)throw new Error(`Invalid configuration: ${n.errors.join(", ")}`);let o=Z(a);this.config={...o,...this.propOverrides},this.isLoading=!1;let{inputElement:i,sendButton:r}=this.elements;if(i&&(i.disabled=!1,i.placeholder="Type your message..."),r&&(r.disabled=!1),ge){let s=localStorage.getItem(S);s?this.sessionId=s:localStorage.setItem(S,this.sessionId)}else localStorage.removeItem(S);if(ce(this.shadow,this.config),e.classList.contains("open")&&this.updateOpenChatWithConfig(),this.prepareWelcomeMessage(),this.config.showWelcomePopup&&this.config.showWelcomePopup.enabled&&!this.welcomePopupShown){let s=this.config.showWelcomePopup.message||this.config.welcomeMessage||"Welcome! How can I help you today?",d=he(s,this.config.brandColor);this.shadow.appendChild(d),this.elements.welcomePopup=d,this.config.orientation==="left"&&d.classList.add("andychat-popup-left"),setTimeout(()=>{this.chatbot&&!this.chatbot.classList.contains("open")&&(d.style.display="block"),this.welcomePopupShown=!0},this.config.showWelcomePopup.seconds*1e3);let l=d.querySelector(".andy-welcome-popup__close");l&&l.addEventListener("click",()=>{d.style.display="none"})}this.elements.inputAreaContainer&&(this.elements.inputAreaContainer.style.display="flex"),ue(this.elements,this.shadow,this.config,this.embedId,this)}catch{this.isLoading=!1,this.config=null,this.container.remove(),console.error("AndyChat: Failed to load configuration.")}}updateOpenChatWithConfig(){let{messagesContainer:e}=this.elements;e.innerHTML="",this.prepareWelcomeMessage(),e.scrollTop=e.scrollHeight}prepareWelcomeMessage(){let{messagesContainer:e}=this.elements;if(!Array.from(e.children).some(n=>!n.classList.contains("andy-chat-subtitle"))||e.querySelector(".andy-loading-dots")){let n=e.querySelector(".andy-loading-dots");if(n&&n.remove(),this.config.welcomeMessage){let o=E(this.config);o&&g(e,o,"bot",!0,this.config.logoUrl,this.config.name)}}}showUserInfoForm(){this.isCollectingUserInfo=!0,setTimeout(()=>{let e=be(this.config.collectUserInfo.message,this.config.brandColor),a=g(this.elements.messagesContainer,e,"bot",!1,this.config.logoUrl,this.config.name);this.elements.userInfoFormMessageContent=a;let n=a.parentElement;n&&(n.classList.add("andychat-form-message-entering"),requestAnimationFrame(()=>{n.classList.add("andychat-form-message-active"),n.classList.remove("andychat-form-message-entering")}));let o=a.querySelector("#andychat-user-info-form"),i=a.querySelector("#andychat-submit-user-info"),r=a.querySelector("#andychat-user-name"),s=a.querySelector("#andychat-user-email"),d=a.querySelector("#andychat-user-info-error");o&&i&&r&&s&&d&&o.addEventListener("submit",async l=>{l.preventDefault(),d.style.display="none",d.textContent="";let c=r.value.trim(),y=s.value.trim();if(!y){d.textContent="Email is required.",d.style.display="block";return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(y)){d.textContent="Please enter a valid email address.",d.style.display="block";return}try{i.disabled=!0,i.textContent="Submitting...",await ee(this.embedId,this.sessionId,{name:c,email:y}),this.userInfoCollected=!0,this.isCollectingUserInfo=!1,a&&a.parentElement&&(a.parentElement.style.display="none"),g(this.elements.messagesContainer,"Thank you! Your information has been submitted.","system")}catch(b){console.error("Failed to submit user info:",b),d.textContent=b.message||"Failed to submit. Please try again.",d.style.display="block"}finally{i.disabled=!1,i.textContent="Submit"}})},Oe)}async _sendApiRequest(e){let{messagesContainer:a,inputElement:n,sendButton:o}=this.elements,i=pe(a);n&&(n.disabled=!0),o&&(o.disabled=!0);try{let r=await H(this.embedId,this.sessionId,e);z(i),g(a,r,"bot",!1,this.config&&this.config.logoUrl,this.config&&this.config.name),this.config.collectUserInfo&&this.config.collectUserInfo.enabled&&!this.userInfoCollected&&!this.isCollectingUserInfo&&this.showUserInfoForm()}catch{console.error("AndyChat: Message request failed."),z(i),g(a,this.config?.defaultLang==="es"?"Lo siento, no pude responder. Int\xE9ntalo de nuevo.":"Sorry, I could not answer. Please try again.","bot",!1,this.config&&this.config.logoUrl,this.config&&this.config.name).parentElement.querySelector(".andy-message").classList.add("andy-message--error")}finally{n&&(n.disabled=!1),o&&(o.disabled=!1),n&&n.focus(),a.scrollTop=a.scrollHeight}}},W=R;document.addEventListener("DOMContentLoaded",()=>{new W});(document.readyState==="complete"||document.readyState==="interactive")&&new W;})();