(a=>{let b=document.body.style.overflow,c=a.vercelDomainForImageProxy,d=a,e=d.profileImageUrl,f=d.replicaUuid,g=d.replicaSlug,h=`${d.iframeBaseUrl}/${d.replicaUuid}${d.isPreview?"?isPreview=true":""}`,i="var(--sensay-widget-primary-color)",j="var(--sensay-widget-foreground-color)",k="var(--sensay-widget-background-color)";function l(){var a;let c=d.widgetPosition,g=d.suggestedQuestions;if(!f)return null;let l=document.getElementById("sensay-widget-container");l||((l=document.createElement("div")).id="sensay-widget-container",l.style.display="block");let m=l.attachShadow({mode:"open"}),p=function(a){let b=document.createElement("div");return b.id="sensay-widget",b.dataset.position=a,b}(c);m.appendChild(p),function(a,b={primaryColor:"#000000",foregroundColor:"#000000",backgroundColor:"#FFFFFF"}){let c=82,e=82,f=document.createElement("style");f.textContent=` :host { --sensay-widget-primary-color: ${b.primaryColor}; --sensay-widget-foreground-color: ${b.foregroundColor}; --sensay-widget-background-color: ${b.backgroundColor}; } :host #sensay-widget { ${d.isPreview?"position: absolute;":"position: fixed;"} display: flex; flex-direction: column; gap: 0px; max-width: 100%; max-height: 100vh; z-index: 9999; pointer-events: none; padding: 8px; } :host #sensay-widget[data-position='BOTTOM_LEFT'], :host #sensay-widget[data-position='CENTER_LEFT'], :host #sensay-widget[data-position='TOP_LEFT'] { align-items: flex-start; } :host #sensay-widget[data-position='BOTTOM_RIGHT'], :host #sensay-widget[data-position='CENTER_RIGHT'], :host #sensay-widget[data-position='TOP_RIGHT'] { align-items: flex-end; } :host #sensay-widget[data-position='BOTTOM_RIGHT'] { bottom: 0; right: 0; } :host #sensay-widget[data-position='BOTTOM_LEFT'] { bottom: 0; left: 0; } :host #sensay-widget[data-position='TOP_RIGHT'] { top: 0; right: 0; } :host #sensay-widget[data-position='TOP_LEFT'] { top: 0; left: 0; } :host #sensay-widget[data-position='CENTER_RIGHT'] { right: 0; top: 50%; transform: translateY(-50%); } :host #sensay-widget[data-position='CENTER_LEFT'] { left: 0; top: 50%; transform: translateY(-50%); } @media (min-width: 640px) { :host #sensay-widget { padding: 32px; } :host #sensay-iframe-container.visible { z-index: 1000; } } :host #sensay-chat-button { padding: 0; background-color: ${i}; color: ${k}; border: 2px solid color-mix(in srgb, ${k} 10%, ${i}); border-radius: 50%; width: ${c}px; height: ${e}px; display: flex; align-items: center; justify-content: center; transition: all 0.15s ease-out; cursor: pointer; -webkit-tap-highlight-color: transparent; backface-visibility: hidden; will-change: transform; overflow: hidden; flex-shrink: 0; animation: sensay-widget_buttonFadeIn 0.15s ease-out forwards; box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.20); pointer-events: auto; order: 3; } @keyframes sensay-widget_buttonFadeIn { from { opacity: 0; } to { opacity: 1; } } :host #sensay-chat-button svg { transition: all 0.15s ease-out; } :host #sensay-chat-button:hover { background-color: color-mix(in srgb, ${i} 85%, white); border: 2px solid color-mix(in srgb, ${k} 15%, ${i}); transform: scale(1.05); transition: all 0.15s ease-in-out; } :host #sensay-chat-button:active { border: 2px solid color-mix(in srgb, ${k} 50%, ${i}); } :host #sensay-chat-button.open { transform: scale(${52/c}); background-color: ${k}; color: ${j}; border: 2px solid color-mix(in srgb, ${j} 10%, transparent); } @media (max-width: 640px) { :host #sensay-chat-button.open { display: none; } } :host #sensay-chat-button.open:hover { background-color: color-mix(in srgb, ${k} 80%, white); } :host #sensay-chat-button .chat-icon { display: block; } :host #sensay-chat-button .close-icon { display: none; } :host #sensay-chat-button.open .chat-icon { display: none; } :host #sensay-chat-button.open .close-icon { display: block; } :host #sensay-iframe-container { max-width: 100%; width: 372px; height: 500px; border-radius: 10px; display: flex; flex-direction: column; transition: opacity 0.15s ease-out; opacity: 0; box-shadow: 0px 2px 22px 0px rgba(0, 0, 0, 0.15); border: 1px solid color-mix(in srgb, ${j} 10%, transparent); order: 1; } :host #sensay-iframe-container.hidden { visibility: hidden; pointer-events: none; } :host #sensay-iframe-container.visible { opacity: 1; visibility: visible; pointer-events: auto; transform: scale(1); } @media (max-width: 640px) { :host #sensay-iframe-container { position: fixed; top: 0; bottom: 0; right: 0; left: 0; width: 100%; height: 100dvh; border-radius: 0; border: none; z-index: 10000; } :host #sensay-iframe-container .sensay-iframe-container-inner { border-radius: 0; } } @media (min-width: 640px) { :host #sensay-iframe-container { height: 550px; width: 372px; } } :host .sensay-iframe-container-inner { border-radius: 10px; overflow: hidden; height: 100%; } :host #sensay-iframe { width: 100%; height: 100%; border: none; pointer-events: auto; } :host #sensay-chat-button .avatar-container { width: 100%; height: 100%; background-size: cover; background-position: center; background-repeat: no-repeat; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; -webkit-user-drag: none; pointer-events: none; } :host #sensay-chat-button:has(.avatar-container) { background-color: ${k}; border: 2px solid ${k}; } :host #sensay-suggested-questions-layout { display: flex; flex-direction: column; gap: 10px; order: 2; padding-bottom: 10px; position: relative; overflow: visible; pointer-events: auto; } :host #sensay-suggested-questions-layout[data-show="false"] { display: none; } :host #sensay-suggested-questions-layout > button:not(.suggested-questions-close-button) { pointer-events: auto; border-radius: 8px; box-shadow: 0 1px 5px 0 rgba(0, 0, 0, 0.1); padding: 8px; cursor: pointer; width: fit-content; border: 1px solid color-mix(in srgb, ${i} 5%, transparent); background-color: color-mix(in srgb, ${k} 100%, transparent); color: color-mix(in srgb, ${j} 70%, transparent); font-size: 14px; gap: 8px; opacity: 0; display: flex; align-items: start; transform: translateY(20px); animation: sensay-widget_fadeInUp 0.15s ease-out forwards; max-width: 300px; min-width: 100px; backdrop-filter: blur(8px); transition: all 0.15s ease-in-out; user-select: none; text-align: left; } :host #sensay-suggested-questions-layout > button:not(.suggested-questions-close-button) > span { text-align: left; overflow-wrap: break-word; word-break: normal; -webkit-hyphens: auto; -moz-hyphens: auto; hyphens: auto; display: block; } :host #sensay-suggested-questions-layout > button:not(.suggested-questions-close-button):hover { border: 1px solid color-mix(in srgb, ${i} 10%, transparent); color: ${j}; } :host #sensay-suggested-questions-layout > button:not(.suggested-questions-close-button) svg { flex-shrink: 0; color: color-mix(in srgb, ${j} 40%, transparent); transition: all 0.15s ease-in-out; margin-top: 5px; } :host #sensay-suggested-questions-layout > button:not(.suggested-questions-close-button):hover svg { color: color-mix(in srgb, ${j} 70%, transparent); } @keyframes sensay-widget_fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } } :host #sensay-widget[data-position='BOTTOM_RIGHT'] #sensay-suggested-questions-layout { align-items: flex-end; } :host .suggested-questions-close-button { width: 26px; height: 26px; border-radius: 100%; box-shadow: 0 1px 5px 0 rgba(0, 0, 0, 0.1); display: flex; align-items: center; justify-content: center; cursor: pointer; pointer-events: auto; opacity: 0; transition: opacity 0.3s ease, background-color 0.3s ease; background-color: ${k}; color: ${j}; border: 1px solid color-mix(in srgb, ${j} 5%, transparent); align-self: flex-end; } :host #sensay-widget[data-position='BOTTOM_LEFT'] .suggested-questions-close-button, :host #sensay-widget[data-position='CENTER_LEFT'] .suggested-questions-close-button, :host #sensay-widget[data-position='TOP_LEFT'] .suggested-questions-close-button { align-self: flex-start; } :host .suggested-questions-close-button svg { margin-top: 0; } :host #sensay-suggested-questions-layout:hover .suggested-questions-close-button { opacity: 1; } :host .suggested-questions-close-button:hover { border: 1px solid color-mix(in srgb, ${i} 10%, transparent); } @media (max-width: 640px) { :host #sensay-suggested-questions-layout { padding: 10px 10px; } :host .suggested-questions-close-button { opacity: 1 !important; } } `,a.appendChild(f)}(m,d);let{iframeContainer:s,iframe:t}=function(){let a=document.createElement("div");a.id="sensay-iframe-container";let b=document.createElement("div");b.className="sensay-iframe-container-inner";let c=document.createElement("iframe");return c.src=h,c.id="sensay-iframe",c.allow="clipboard-read; clipboard-write",b.appendChild(c),a.appendChild(b),{iframeContainer:a,iframe:c}}();s.classList.add("hidden"),this.messageManager=new r(t),this.messageManager.setShadowRoot(m);let{chatButton:u}=function(a){let b=document.createElement("button");return b.id="sensay-chat-button",b.type="button",b.setAttribute("aria-label","Open chat"),q(b,d.showAvatarInLauncher,a),{chatButton:b}}(d.showAvatarInLauncher?d.profileImageUrl:void 0),v=function({chatButton:a,iframeContainer:c,shadow:f,messageManager:g}){let h=!1,i=!1;function j(){return window.innerWidth<640}return function(){if(h=!h,a.classList.toggle("open"),o(a,f,h,d.showAvatarInLauncher&&e),h&&!i&&(i=!0),h){j()&&(b=document.body.style.overflow,document.body.style.overflow="hidden"),c.classList.remove("hidden"),c.offsetHeight,c.classList.add("visible");let a=f.getElementById("sensay-suggested-questions-layout");a&&(a.dataset.show="false"),setTimeout(()=>{d.isPreview||g.sendMessageToIframe({messageType:"focus_input"})},150)}else{c.classList.remove("visible"),c.classList.add("hidden"),j()&&(document.body.style.overflow=b);let a=f.getElementById("sensay-suggested-questions-layout");a&&(!i||d.isPreview)&&!1!==d.showFloatingQuestions&&setTimeout(()=>{h||(a.dataset.show="true",a.style.pointerEvents="auto")},150)}}}({chatButton:u,iframeContainer:s,shadow:m,messageManager:this.messageManager});this.messageManager.setToggleChat(v);let w=function({suggestedQuestions:a,toggleChat:b}){let c=document.createElement("div");c.id="sensay-suggested-questions-layout",c.dataset.show="true",c.ariaLabel="Suggested Questions";let d=document.createElement("button");d.classList.add("suggested-questions-close-button"),d.ariaLabel="Close suggested questions";let e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("width","12"),e.setAttribute("height","12"),e.setAttribute("viewBox","0 0 12 12"),e.style.fill="currentColor";let f=document.createElementNS("http://www.w3.org/2000/svg","path");f.setAttribute("d","M2.5 2.5L9.5 9.5"),f.setAttribute("stroke","currentColor"),f.setAttribute("stroke-width","1.7"),f.setAttribute("stroke-linecap","round");let g=document.createElementNS("http://www.w3.org/2000/svg","path");if(g.setAttribute("d","M2.5 9.5L9.5 2.5"),g.setAttribute("stroke","currentColor"),g.setAttribute("stroke-width","1.7"),g.setAttribute("stroke-linecap","round"),e.appendChild(f),e.appendChild(g),d.appendChild(e),d.addEventListener("click",()=>{n(!1,c.parentNode,c)}),c.appendChild(d),!a||0===a.length)return c;for(let d=0;d{c.style.pointerEvents="none",b(),this.messageManager.sendMessageToIframe({messageType:"suggestedQuestion",data:e})}),c.appendChild(f)}return c}({suggestedQuestions:g,toggleChat:v});u.addEventListener("click",v),a=v,window.addEventListener("message",b=>{b.data&&"close_widget"===b.data.messageType&&a()},!1),p.appendChild(s),p.appendChild(u),d.showFloatingQuestions&&n(!0,p,w);let x=document.getElementById("sensay-widget-target");x?x.appendChild(l):document.body.appendChild(l),window.configSensayWidget=a=>{let b={...d};if((d={...d,...a}).primaryColor&&m.host.style.setProperty("--sensay-widget-primary-color",d.primaryColor),d.backgroundColor&&m.host.style.setProperty("--sensay-widget-background-color",d.backgroundColor),d.textColor&&m.host.style.setProperty("--sensay-widget-foreground-color",d.textColor),d.position&&(p.dataset.position=d.position),void 0!==d.showAvatarInLauncher||e){let a=m.getElementById("sensay-chat-button");if(a){q(a,d.showAvatarInLauncher,e);let b=a.classList.contains("open");o(a,m,b,d.showAvatarInLauncher&&e)}let c=void 0!==d.showAvatarInLauncher&&b.showAvatarInLauncher!==d.showAvatarInLauncher,f=d.isPreview&&s.classList.contains("visible");c&&f&&v()}void 0!==d.showFloatingQuestions&&b.showFloatingQuestions!==d.showFloatingQuestions&&(n(d.showFloatingQuestions,p,w),d.isPreview&&s.classList.contains("visible")&&v()),this.messageManager.sendMessageToIframe({messageType:"config",data:{...d,name:d.name,description:d.description,greeting:d.greeting,suggestedQuestions:d.suggestedQuestions,isAvailable:d.isAvailable}})};let y=window.innerWidth;!d.isPreview||y<640||s.classList.contains("visible")||v()}function m(){let a=document.getElementById("sensay-widget-container");return a?.parentNode&&a.parentNode.removeChild(a),document.body.style.overflow=b,function(){let a=`/${g}/embed-script.js`;for(let b of[`link[rel="preload"][href*="${a}"]`,`link[rel="preload"][href*="${f}"]`])for(let a of document.querySelectorAll(b))a.parentNode&&a.parentNode.removeChild(a);for(let b of[`script[src*="${a}"]`,`script[src*="${f}"]`])for(let a of document.querySelectorAll(b))a.parentNode&&a.parentNode.removeChild(a);window.initSensayWidget&&(window.initSensayWidget=void 0),window.unmountSensayWidget&&(window.unmountSensayWidget=void 0),window.initSensayWidgetPreview&&(window.initSensayWidgetPreview=void 0),window.unmountSensayWidgetPreview&&(window.unmountSensayWidgetPreview=void 0)}(),!0}function n(a,b,c){a?c.parentNode||b.appendChild(c):c.parentNode&&c.parentNode.removeChild(c)}function o(a,b,c,d){navigator.userAgent.toLowerCase().indexOf("firefox")>-1&&(c?(a.style.backgroundColor=getComputedStyle(b.host).getPropertyValue("--sensay-widget-background-color"),a.style.color=getComputedStyle(b.host).getPropertyValue("--sensay-widget-foreground-color"),a.style.border=`2px solid color-mix(in srgb, ${getComputedStyle(b.host).getPropertyValue("--sensay-widget-foreground-color")} 10%, transparent)`):d?(a.style.backgroundColor=getComputedStyle(b.host).getPropertyValue("--sensay-widget-background-color"),a.style.border=`1px solid ${getComputedStyle(b.host).getPropertyValue("--sensay-widget-background-color")} 10%`):(a.style.backgroundColor=getComputedStyle(b.host).getPropertyValue("--sensay-widget-primary-color"),a.style.color=getComputedStyle(b.host).getPropertyValue("--sensay-widget-background-color"),a.style.border=`1px solid color-mix(in srgb, ${getComputedStyle(b.host).getPropertyValue("--sensay-widget-background-color")} 10%, ${getComputedStyle(b.host).getPropertyValue("--sensay-widget-primary-color")})`))}function p(a,{viewBox:b,width:c,height:d}){let e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("width",c),e.setAttribute("height",d),e.setAttribute("viewBox",b),e.style.fill="currentColor";let f=document.createElementNS("http://www.w3.org/2000/svg","path");return f.setAttribute("d",a),e.appendChild(f),e}function q(a,b,d){for(;a.firstChild;)a.removeChild(a.firstChild);let e=p("M25 0.5H3.00002C2.33698 0.5 1.7011 0.763392 1.23225 1.23223C0.763414 1.70107 0.500022 2.33696 0.500022 3V23C0.498025 23.4761 0.63325 23.9427 0.889516 24.3439C1.14578 24.7452 1.51223 25.0641 1.94502 25.2625C2.27724 25.418 2.63944 25.4991 3.00627 25.5C3.5933 25.4985 4.16091 25.2895 4.60877 24.91L4.62377 24.8962L8.55877 21.5H25C25.6631 21.5 26.2989 21.2366 26.7678 20.7678C27.2366 20.2989 27.5 19.663 27.5 19V3C27.5 2.33696 27.2366 1.70107 26.7678 1.23223C26.2989 0.763392 25.6631 0.5 25 0.5ZM24.5 18.5H8.00002C7.64001 18.4994 7.29192 18.629 7.02002 18.865L3.50002 21.9037V3.5H24.5V18.5Z",{viewBox:"0 0 28 26",width:"28",height:"26"});e.classList.add("chat-icon"),e.style.fill="currentColor";let f=p("M27.0612 13.0612L17.0612 23.0612C16.9218 23.2011 16.7563 23.312 16.5739 23.3877C16.3916 23.4634 16.1961 23.5024 15.9987 23.5024C15.8013 23.5024 15.6058 23.4634 15.4235 23.3877C15.2411 23.312 15.0756 23.2011 14.9362 23.0612L4.9362 13.0612C4.6544 12.7794 4.49609 12.3972 4.49609 11.9987C4.49609 11.6002 4.6544 11.218 4.9362 10.9362C5.21799 10.6544 5.60018 10.4961 5.9987 10.4961C6.39721 10.4961 6.7794 10.6544 7.0612 10.9362L15.9999 19.875L24.9387 10.935C25.2205 10.6532 25.6027 10.4949 26.0012 10.4949C26.3997 10.4949 26.7819 10.6532 27.0637 10.935C27.3455 11.2168 27.5038 11.599 27.5038 11.9975C27.5038 12.396 27.3455 12.7782 27.0637 13.06L27.0612 13.0612Z",{viewBox:"0 0 32 32",width:"32",height:"32"});if(f.classList.add("close-icon"),f.style.fill="currentColor",b&&d){let b=document.createElement("div");if(b.classList.add("chat-icon","avatar-container"),d.startsWith("data:"))b.style.backgroundImage=`url(${d})`;else{let a=`&cb=${Date.now()}`;b.style.backgroundImage=`url(${c}/_next/image?url=${d}&w=256&q=75${a})`}a.appendChild(b),a.appendChild(f)}else a.appendChild(e),a.appendChild(f)}class r{constructor(a,b="*"){this.iframe=a,this.isReady=!1,this.messageQueue=[],this.targetOrigin=b,this.shadow=null,this.setupMessageListener()}setShadowRoot(a){this.shadow=a}setToggleChat(a){this.toggleChat=a}setupMessageListener(){window.addEventListener("message",a=>{a.data?.messageType==="iframe_ready"&&this.handleIframeReady()})}handleIframeReady(){this.isReady=!0,this.processQueue()}processQueue(){for(;this.messageQueue.length>0;){let a=this.messageQueue.shift();a&&this.sendMessageToIframe(a)}}sendMessageToIframe(a){if(!this.isReady)return void this.messageQueue.push(a);this.iframe.contentWindow?.postMessage(a,this.targetOrigin),"config"===a.messageType&&this.shadow&&this.updateShadowDOMElements(a.data)}updateShadowDOMElements(a){if(!this.shadow)return;let b=this.shadow.getElementById("sensay-chat-button");if(b){let c=void 0!==a.showAvatarInLauncher?a.showAvatarInLauncher:d.showAvatarInLauncher,e=a.profileImage||a.profileImageUrl;(e||void 0!==c)&&q(b,c,e)}let c=this.shadow.getElementById("sensay-suggested-questions-layout");if(c&&a.suggestedQuestions){for(let a of c.querySelectorAll("button:not(.suggested-questions-close-button)"))a.remove();for(let b=0;b{c.style.pointerEvents="none",this.toggleChat&&this.toggleChat(),this.sendMessageToIframe({messageType:"suggestedQuestion",data:d})}),c.appendChild(e)}}}}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",l):l(),window.configSensayWidget=configSensayWidget.bind(window),window.initSensayWidget=l.bind(window),window.unmountSensayWidget=m.bind(window),window.SensayChatbot={config:configSensayWidget.bind(window),init:l.bind(window),destroy:m.bind(window)};let s=document.createElement("link");s.rel="preload",s.href=h,s.as="document",s.crossOrigin="anonymous",document.head.appendChild(s)})({ replicaUuid: 'aadd498f-a153-4840-b8b2-e09da0c16386', replicaSlug: 'ask-sensay', widgetPosition: 'BOTTOM_RIGHT', iframeBaseUrl: 'https://chat-widget.sensay.io', primaryColor: '#000000', foregroundColor: '#000000', backgroundColor: '#FFFFFF', profileImageUrl: 'https://xotqxvmmnunwfsaemqfy.supabase.co/storage/v1/object/public/persona_images/aadd498f-a153-4840-b8b2-e09da0c16386/profile-2025-09-20T20:03:30.907Z.jpg', name: "Ask Sensay", description: "Your 24/7 AI Chatbot for fast, clear FAQ support", greeting: "You’ve got questions.\nAsk Sensay has answers-fast.", hideBranding: false, showAvatarInLauncher: true, suggestedQuestions: ["How does Sensay train the replica with the client's knowledge and expertise?","What are the technical limitations with uploading and using audio files with the Sensay product?","Can Sensay's replicas access patient medical records and history to provide more personalized advice?"], showFloatingQuestions: true, isAvailable: true, isPreview: false, vercelDomainForImageProxy: 'https://chat-widget.sensay.io' })