import{a as nt,b as ot,c as st}from"./chunk-7YL35ZIO.js";import{e as tt,g as it}from"./chunk-MZH7I7UK.js";import{a as et}from"./chunk-JEBQFVFV.js";import{a as qe,b as rt}from"./chunk-UV4NIRDR.js";import{a as Je}from"./chunk-7CAH5JY2.js";import"./chunk-PVT2TCFK.js";import"./chunk-LMC2BXXM.js";import"./chunk-XT6MQKXX.js";import"./chunk-KW7LGSS5.js";import"./chunk-AAHKRPJ3.js";import"./chunk-S7TPI5WJ.js";import"./chunk-F6YS3FBI.js";import"./chunk-S7UDHO3E.js";import"./chunk-SZQILDRF.js";import"./chunk-QIJGSTAO.js";import"./chunk-5U7RRVH2.js";import"./chunk-O3MLOUKJ.js";import"./chunk-2C3QPSQO.js";import"./chunk-R6EOTM56.js";import"./chunk-OIAL2MBO.js";import"./chunk-PEEQSXXX.js";import"./chunk-CUOWKLRV.js";import"./chunk-M7NRMR5C.js";import"./chunk-2DOD3TZP.js";import"./chunk-6LCLSCUC.js";import"./chunk-3RTUOFQH.js";import"./chunk-NOQGKTKU.js";import"./chunk-WQRIIPLB.js";import{h as Ye,i as Ke,k as Qe}from"./chunk-7ZRO5KWR.js";import"./chunk-VJNS2G4F.js";import"./chunk-NK5MR2BM.js";import"./chunk-ZHB7Y3RV.js";import"./chunk-CV7XZEMK.js";import"./chunk-SXGSJAWW.js";import"./chunk-U24TZDHA.js";import"./chunk-4OC5AVTP.js";import"./chunk-5BQ7EGVC.js";import"./chunk-E5AMFSXI.js";import"./chunk-EGB5EUWP.js";import{a as x,c as K}from"./chunk-UACQJK7R.js";import{R as ze,T as Fe,W as Ue,da as Ge,ea as We,ja as Ze,z as Y}from"./chunk-Q232IBQN.js";import{j as je}from"./chunk-LGT7QKWT.js";import"./chunk-Z3H43YNT.js";import{A as ke,Ba as Xe,C as Le,c as Re,d as He}from"./chunk-E4UUPK46.js";import"./chunk-AK5L5EKD.js";import{j as Be,k as De,l as Ie,m as Ve,n as $e}from"./chunk-K3AFQ46O.js";import"./chunk-WWNBTMQ7.js";import{$ as _e,$c as we,Ac as M,Ad as S,Cb as fe,Da as d,Db as Ee,E as ce,Ea as _,Ec as A,Fb as W,Fd as D,G as $,Ha as pe,Ic as u,Ja as Ce,K as k,Kc as r,Ma as ge,Ob as Te,Pa as g,Qa as be,Sa as j,Sc as ye,Tc as xe,Uc as q,Vc as L,Wc as y,X as de,Xb as ve,Zc as B,_c as z,c as oe,cc as Me,e as X,f as se,fd as Ne,g as re,ga as H,gd as Pe,ha as he,hc as Z,hd as F,j as U,ja as me,jc as T,lc as v,nc as Se,o as ae,oc as Oe,p as le,pc as Ae,qc as E,rc as a,sc as l,tc as C,v as G,wb as c,xa as O,za as ue}from"./chunk-O7RN3KYY.js";import"./chunk-T6QEVPBZ.js";import"./chunk-MPPP2QUX.js";import{a as P}from"./chunk-ZE2KCNEA.js";import{a as w,b as N}from"./chunk-CEWFFWI2.js";P();P();var ct={schedule(n,o){let e=setTimeout(n,o);return()=>clearTimeout(e)}};function dt(n){return n.replace(/[A-Z]/g,o=>`-${o.toLowerCase()}`)}function _t(n){return!!n&&n.nodeType===Node.ELEMENT_NODE}var Q;function ht(n,o){if(!Q){let e=Element.prototype;Q=e.matches||e.matchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector||e.webkitMatchesSelector}return n.nodeType===Node.ELEMENT_NODE?Q.call(n,o):!1}function mt(n){let o={};return n.forEach(({propName:e,templateName:i,transform:t})=>{o[dt(i)]=[e,t]}),o}function ut(n,o){return o.get(W).resolveComponentFactory(n).inputs}function pt(n,o){let e=n.childNodes,i=o.map(()=>[]),t=-1;o.some((s,p)=>s==="*"?(t=p,!0):!1);for(let s=0,p=e.length;st!=="*"&&ht(n,t)?(i=s,!0):!1),i}var gt=10,J=class{componentFactory;inputMap=new Map;constructor(o,e){this.componentFactory=e.get(W).resolveComponentFactory(o);for(let i of this.componentFactory.inputs)this.inputMap.set(i.propName,i.templateName)}create(o){return new ee(this.componentFactory,o,this.inputMap)}},ee=class{componentFactory;injector;inputMap;eventEmitters=new re(1);events=this.eventEmitters.pipe(H(o=>$(...o)));componentRef=null;scheduledDestroyFn=null;initialInputValues=new Map;ngZone;elementZone;appRef;cdScheduler;constructor(o,e,i){this.componentFactory=o,this.injector=e,this.inputMap=i,this.ngZone=this.injector.get(ge),this.appRef=this.injector.get(Me),this.cdScheduler=e.get(be),this.elementZone=typeof Zone>"u"?null:this.ngZone.run(()=>Zone.current)}connect(o){this.runInZone(()=>{if(this.scheduledDestroyFn!==null){this.scheduledDestroyFn(),this.scheduledDestroyFn=null;return}this.componentRef===null&&this.initializeComponent(o)})}disconnect(){this.runInZone(()=>{this.componentRef===null||this.scheduledDestroyFn!==null||(this.scheduledDestroyFn=ct.schedule(()=>{this.componentRef!==null&&(this.componentRef.destroy(),this.componentRef=null)},gt))})}getInputValue(o){return this.runInZone(()=>this.componentRef===null?this.initialInputValues.get(o):this.componentRef.instance[o])}setInputValue(o,e){if(this.componentRef===null){this.initialInputValues.set(o,e);return}this.runInZone(()=>{this.componentRef.setInput(this.inputMap.get(o)??o,e),fe(this.componentRef.hostView)&&(Ee(this.componentRef.changeDetectorRef),this.cdScheduler.notify(6))})}initializeComponent(o){let e=pe.create({providers:[],parent:this.injector}),i=pt(o,this.componentFactory.ngContentSelectors);this.componentRef=this.componentFactory.create(e,i,o),this.initializeInputs(),this.initializeOutputs(this.componentRef),this.appRef.attachView(this.componentRef.hostView),this.componentRef.hostView.detectChanges()}initializeInputs(){for(let[o,e]of this.initialInputValues)this.setInputValue(o,e);this.initialInputValues.clear()}initializeOutputs(o){let e=this.componentFactory.outputs.map(({propName:i,templateName:t})=>{let s=o.instance[i];return new oe(p=>{let h=s.subscribe(m=>p.next({name:t,value:m}));return()=>h.unsubscribe()})});this.eventEmitters.next(e)}runInZone(o){return this.elementZone&&Zone.current!==this.elementZone?this.ngZone.run(o):o()}},te=class extends HTMLElement{ngElementEventsSubscription=null};function at(n,o){let e=ut(n,o.injector),i=o.strategyFactory||new J(n,o.injector),t=mt(e);class s extends te{injector;static observedAttributes=Object.keys(t);get ngElementStrategy(){if(!this._ngElementStrategy){let h=this._ngElementStrategy=i.create(this.injector||o.injector);e.forEach(({propName:m,transform:b})=>{if(!this.hasOwnProperty(m))return;let I=this[m];delete this[m],h.setInputValue(m,I,b)})}return this._ngElementStrategy}_ngElementStrategy;constructor(h){super(),this.injector=h}attributeChangedCallback(h,m,b,I){let[V,R]=t[h];this.ngElementStrategy.setInputValue(V,b,R)}connectedCallback(){let h=!1;this.ngElementStrategy.events&&(this.subscribeToEvents(),h=!0),this.ngElementStrategy.connect(this),h||this.subscribeToEvents()}disconnectedCallback(){this._ngElementStrategy&&this._ngElementStrategy.disconnect(),this.ngElementEventsSubscription&&(this.ngElementEventsSubscription.unsubscribe(),this.ngElementEventsSubscription=null)}subscribeToEvents(){this.ngElementEventsSubscription=this.ngElementStrategy.events.subscribe(h=>{let m=new CustomEvent(h.name,{detail:h.value});this.dispatchEvent(m)})}}return e.forEach(({propName:p,transform:h,isSignal:m})=>{Object.defineProperty(s.prototype,p,{get(){let b=this.ngElementStrategy.getInputValue(p);return m&&ve(b)?b():b},set(b){this.ngElementStrategy.setInputValue(p,b,h)},configurable:!0,enumerable:!0})}),s}P();var bt=["wrapperEl"],ft=["chatbotCore"],Et=["sidebarToggle"],Tt=["historySidebar"],vt=["chatbotSearch"];function Mt(n,o){if(n&1){let e=M();a(0,"button",37),u("click",function(){let t=d(e).$implicit;r(2);let s=q(14);return r().toggle(),s.onOpen(),_(s.askQuestion(t))}),a(1,"span",38),B(2),l()()}if(n&2){let e=o.$implicit;c(2),z(e)}}function St(n,o){if(n&1){let e=M();a(0,"div",16)(1,"div",30)(2,"div",31)(3,"div"),B(4),l(),a(5,"span",32),B(6,"\u0387"),l(),a(7,"div"),A(8,6),l()(),a(9,"div",33),A(10,7),l(),a(11,"button",34),u("click",function(){d(e);let t=r(2);return _(t.greetingDismissed.set(!0))}),C(12,"icon",35),l()(),Oe(13,Mt,3,1,"button",36,Se),l()}if(n&2){let e=r();c(4),z(e.branding.chatbot_name),c(7),L("top",-8,"px")("right",-8,"px"),c(2),Ae(e.sample_questions)}}function Ot(n,o){if(n&1){let e=M();a(0,"button",39,2),u("click",function(){d(e);let t=r(2);return _(t.toggleSidebar())}),a(2,"div",20),C(3,"profile-pic",29),l(),C(4,"icon",40),l()}if(n&2){let e=r(2);Z("aria-expanded",e.sidebarOpen()),c(3),E("manualOverrideSrc",e.chatbotAvatar())}}function At(n,o){if(n&1&&(a(0,"div",20),C(1,"profile-pic",29),l()),n&2){let e=r(2);c(),E("manualOverrideSrc",e.chatbotAvatar())}}function yt(n,o){n&1&&C(0,"loader",43),n&2&&E("size",20)}function xt(n,o){n&1&&C(0,"icon",44)}function wt(n,o){n&1&&(C(0,"icon",47),a(1,"span"),A(2,9),l())}function Nt(n,o){n&1&&(C(0,"icon",48),a(1,"span"),A(2,10),l())}function Pt(n,o){if(n&1){let e=M();a(0,"button",41)(1,"span",42),B(2),l(),T(3,yt,1,1,"loader",43)(4,xt,1,0,"icon",44),l(),a(5,"pfy-menu",null,3)(7,"button",45),u("click",function(){d(e),r();let t=F(6),s=r();return _(s.togglePin(t,"header"))}),T(8,wt,3,0)(9,Nt,3,0),l(),a(10,"button",45),u("click",function(){d(e),r();let t=F(6),s=r();return _(s.renameChat(t,"header"))}),C(11,"icon",46),a(12,"span"),A(13,8),l()()()}if(n&2){let e=q(6);r();let i=F(6),t=r();E("title",t.activeTitle())("disabled",t.isPinning(i.public_id))("pfyMenuTriggerFor",e),c(2),z(t.activeTitle()),c(),v(t.isPinning(i.public_id)?3:4),c(5),v(i.pinned_at?8:9)}}function Bt(n,o){if(n&1&&(a(0,"h2",21),B(1),l()),n&2){let e=r();E("title",e.branding.chatbot_name),c(),we(" ",e.branding.chatbot_name," ")}}function Dt(n,o){if(n&1){let e=M();a(0,"button",49),u("click",function(){d(e);let t=r(2);return _(t.toggle())}),C(1,"icon",35),l()}}function It(n,o){if(n&1){let e=M();a(0,"button",53),u("click",function(){d(e);let t=r(3);return _(t.toggleSidebar())}),l()}}function Rt(n,o){if(n&1){let e=M();a(0,"aside",50),u("keydown.escape",function(){d(e);let t=r(2);return _(t.sidebarOpen()&&t.toggleSidebar())}),a(1,"chatbot-history-sidebar",51,4),u("selected",function(t){d(e);let s=r(2);return _(s.onConversationSelected(t))})("conversationUpdated",function(t){d(e);let s=r(2);return _(s.onConversationUpdated(t))})("newChatRequested",function(){d(e);let t=r(2);return _(t.newChat())})("closeRequested",function(){d(e);let t=r(2);return _(t.toggleSidebar())})("searchToggled",function(){d(e);let t=r(2);return _(t.toggleSearch())}),l()(),T(3,It,1,0,"button",52)}if(n&2){let e,i=r(),t=r();y("sidebar-open",t.sidebarOpen()),E("cdkTrapFocus",t.sidebarOpen())("cdkTrapFocusAutoCapture",t.sidebarOpen()),Z("inert",t.sidebarOpen()?null:""),c(),E("currentPublicId",t.mode()==="chat"?((e=t.activeConversation())==null?null:e.public_id)??null:null)("chatbotAvatar",t.chatbotAvatar())("chatbotName",i.branding.chatbot_name)("isMobile",!1)("searchActive",t.mode()==="search"),c(2),v(t.sidebarOpen()?3:-1)}}function Ht(n,o){if(n&1){let e=M();a(0,"chatbot-search",54,5),u("conversationSelected",function(t){d(e);let s=r(2);return _(s.onSearchConversationSelected(t))}),l()}if(n&2){let e=r(2);y("hidden",e.mode()!=="search"),E("active",e.mode()==="search")}}function Vt(n,o){if(n&1){let e=M();a(0,"div",15),T(1,St,15,5,"div",16),a(2,"div",17)(3,"div",18),T(4,Ot,5,2,"button",19)(5,At,2,1,"div",20),Ne(6),T(7,Pt,14,6)(8,Bt,2,2,"h2",21),a(9,"button",22),u("click",function(){d(e);let t=r();return _(t.newChat())}),C(10,"icon",23),l(),T(11,Dt,2,0,"button",24),l(),T(12,Rt,4,11),a(13,"chatbot-core",25,1),u("firstTurnComplete",function(t){d(e);let s=r();return _(s.onFirstTurnComplete(t))})("loadOlderMessages",function(){d(e);let t=r();return _(t.onLoadOlderMessages())})("conversationUpdated",function(t){d(e);let s=r();return _(s.onConversationUpdated(t))})("refreshConfig",function(){d(e);let t=r();return _(t.refreshConfigOnly$.next())}),l(),T(15,Ht,2,3,"chatbot-search",26),l(),a(16,"button",27),u("click",function(){d(e);let t=r();return _(t.toggle())}),a(17,"div",28),C(18,"profile-pic",29),l()()()}if(n&2){let e=r();y("pa-24",!e.fullscreenMobile())("fullscreen-mobile",e.fullscreenMobile()),c(),v(e.greetingVisible()?1:-1),c(),L("height",e.fullscreenMobile()?null:e.responsiveHeight(),"px")("width",e.fullscreenMobile()?null:e.responsiveWidth(),"px"),y("hidden",!e.visible()),c(2),v(e.usersService.isAuthenticated()?4:5),c(2);let i=Pe(e.activeConversation());c(),v(i&&e.activeTitle()&&e.mode()==="chat"?7:8),c(4),v(e.isMobile()?11:-1),c(),v(e.usersService.isAuthenticated()?12:-1),c(),y("hidden",e.mode()==="search"),E("aiChatbotConfig",o)("displayLoginButtonWhenUnauth",!0)("hideHeader",!0)("fullScreen",!1)("hydrateFromConversation",e.hydratePayload())("olderMessages",e.olderMessages())("loadingOlder",e.loadingOlderMessages())("canLoadOlder",e.canLoadOlder()),c(2),v(e.usersService.isAuthenticated()?15:-1),c(),y("hidden",e.fullscreenMobile()),c(2),E("manualOverrideSrc",e.chatbotAvatar())}}function $t(n,o){if(n&1){let e=M();a(0,"div",14)(1,"div",55)(2,"div"),A(3,11),l(),a(4,"button",56),u("click",function(){d(e);let t=r();return _(t.noAccessMessageVisible.set(!1))}),C(5,"icon",35),l()()()}n&2&&(c(4),L("top",-8,"px")("right",-8,"px"))}var lt=(()=>{class n{constructor(){this.chatbotService=O(Je),this.usersService=O(We),this.destroyRef=O(Ce),this.conversationActions=O(st),this.analyticsService=O(Ze),this.storageAccessService=O(tt),this.storageRestoreAttempted=!1,this.newChatLabel=$localize`:Default placeholder for an untitled conversation:New Chat`,this.chatbotWidth=400,this.chatbotHeight=664,this.iframeXPadding=48,this.iframeYPadding=104,this.greetingDismissedSessionKey="chatbot_greeting_dismissed",this.viewportSize=g({width:window.innerWidth,height:window.innerHeight}),this.responsiveWidth=S(()=>Math.min(this.chatbotWidth,this.viewportSize().width-this.iframeXPadding)),this.responsiveHeight=S(()=>Math.min(this.chatbotHeight,this.viewportSize().height-this.iframeYPadding)),this.hostViewportWidth=g(null),this.isMobile=S(()=>this.hostViewportWidth()?this.hostViewportWidth()<$e.XS:this.viewportSize().widththis.visible()&&this.isMobile()),this.noAccessMessageVisible=g(!1),this.refreshConfig$=new se(!0),this.refreshConfigOnly$=new X,this.aiChatbotConfig=K($(this.refreshConfig$.pipe(H(e=>ae(this.usersService.fetchInfo()).pipe(k(()=>le(null)),G(()=>e)))),this.refreshConfigOnly$.pipe(G(()=>!1))).pipe(H(e=>this.chatbotService.getAiChatbotUserConfig().pipe(me(i=>{!e&&!i&&this.noAccessMessageVisible.set(!0)}))))),this.userColorMode=K(this.usersService.currentColorMode$),this.chatbotAvatar=S(()=>{let e=this.aiChatbotConfig().branding;switch(this.userColorMode()){case Y.DARK:return e.avatar_image_dark;case Y.LIGHT:return e.avatar_image_light}}),this.greetingDismissed=g(sessionStorage.getItem(this.greetingDismissedSessionKey)==="true"),this.greetingVisible=S(()=>!this.visible()&&!this.greetingDismissed()),this.sidebarOpen=g(!1),this.mode=g("chat"),this.activeConversation=g(null),this.hydratePayload=g(null),this.nextOlderUrl=g(null),this.loadingOlderMessages=g(!1),this.olderMessages=g(null),this.canLoadOlder=S(()=>this.nextOlderUrl()!==null&&!this.loadingOlderMessages()),this.cancelMessagesFetch=new X,this.activeTitle=S(()=>{let e=this.activeConversation();return e?e.title||this.newChatLabel:null}),this.wrapperEl=D("wrapperEl"),this.chatbotCore=D("chatbotCore"),this.sidebarToggle=D("sidebarToggle"),this.historySidebar=D("historySidebar"),this.chatbotSearch=D("chatbotSearch"),this.usersService.autoSetColorMode(),ze(),Fe(),document.documentElement.style.colorScheme="normal",window.addEventListener("resize",()=>{this.viewportSize.set({width:window.innerWidth,height:window.innerHeight})}),window.addEventListener("message",e=>{e.source===window.parent&&e.data?.type==="pathify-chatbot-viewport"&&typeof e.data.width=="number"&&this.hostViewportWidth.set(e.data.width)}),window.parent!==window&&window.parent.postMessage({type:"pathify-chatbot-ready"},"*"),document.addEventListener("touchmove",e=>{if(!this.fullscreenMobile())return;let i=e.target;for(;i&&i!==document.body;){let t=getComputedStyle(i);if((t.overflowY==="auto"||t.overflowY==="scroll")&&i.scrollHeight>i.clientHeight)return;i=i.parentElement}e.preventDefault()},{passive:!1}),j(()=>{sessionStorage.setItem(this.greetingDismissedSessionKey,this.greetingDismissed().toString())}),j(()=>{this.fullscreenMobile(),this.updateIframeStyle()})}ngOnInit(){this.chatbotService.newChatRequested$.pipe(x(this.destroyRef)).subscribe(()=>this.newChat())}toggle(){!this.visible()&&this.restoreSessionViaStorageAccess(),this.visible.update(i=>!i),this.updateIframeStyle(),this.visible()&&setTimeout(()=>this.chatbotCore()?.onOpen())}restoreSessionViaStorageAccess(){this.storageRestoreAttempted||!this.storageAccessService.isSupported||this.usersService.isAuthenticated()||(this.storageRestoreAttempted=!0,this.storageAccessService.requestAccess().then(e=>{e&&this.refreshConfig$.next(!1)}))}toggleSidebar(){let e=this.sidebarOpen();this.sidebarOpen.update(i=>!i),e&&setTimeout(()=>this.sidebarToggle()?.nativeElement.focus())}newChat(){this.resetMessagesPagination(),this.chatbotCore()?.newConversation(),this.activeConversation.set(null),this.hydratePayload.set(null),this.sidebarOpen.set(!1),this.mode.set("chat")}resetMessagesPagination(){this.cancelMessagesFetch.next(),this.olderMessages.set(null),this.nextOlderUrl.set(null),this.loadingOlderMessages.set(!1)}toggleSearch(){switch(this.mode()){case"search":this.mode.set("chat");break;case"chat":this.mode.set("search"),this.analyticsService.analyticsEvent({type:Ue.CHATBOT_SEARCH_VIEW_OPENED});break}this.sidebarOpen.set(!1)}onConversationSelected(e){this.resetMessagesPagination(),this.nextOlderUrl.set(e.nextOlderUrl),this.sidebarOpen.set(!1),this.mode.set("chat"),this.activeConversation.set(e.conversation),this.hydratePayload.set({publicId:e.conversation.public_id,messages:e.messages,rating:e.conversation.rating}),setTimeout(()=>this.chatbotCore()?.onOpen())}onSearchConversationSelected(e){this.chatbotService.getConversationMessages({conversation:e.id,pagination_method:"cursor"}).pipe(x(this.destroyRef)).subscribe(({results:i,next:t})=>{let s=[...i].reverse();this.onConversationSelected({conversation:e,messages:s,nextOlderUrl:t??null})})}onLoadOlderMessages(){let e=this.nextOlderUrl();e===null||this.loadingOlderMessages()||(this.loadingOlderMessages.set(!0),this.chatbotService.getMessagesByUrl(e).pipe(x(this.destroyRef),he(this.cancelMessagesFetch),k(()=>U),de(()=>this.loadingOlderMessages.set(!1))).subscribe(({results:i,next:t})=>{let s=[...i].reverse();this.olderMessages.set(s),this.nextOlderUrl.set(t??null)}))}onConversationUpdated(e){this.activeConversation.update(i=>i&&i.public_id===e.public_id?e:i),this.chatbotSearch()?.applyConversationUpdate(e),this.historySidebar()?.applyConversationUpdate(e)}isPinning(e){return this.conversationActions.isPinning(e)}togglePin(e,i){this.conversationActions.togglePin(e,i).pipe(x(this.destroyRef)).subscribe(t=>{this.onConversationUpdated(t),this.historySidebar()?.refresh()})}renameChat(e,i){this.conversationActions.renameChat(e,i).pipe(x(this.destroyRef)).subscribe(t=>{this.onConversationUpdated(t),this.historySidebar()?.refresh()})}onFirstTurnComplete(e){this.activeConversation.set({public_id:e,title:null}),this.usersService.isAuthenticated()&&this.chatbotService.generateConversationTitle(e).pipe(_e({count:2,delay:(i,t)=>ce(t*500)}),k(()=>U),x(this.destroyRef)).subscribe(i=>{i?.title&&this.activeConversation.update(t=>t&&t.public_id===e?N(w({},t),{title:i.title}):t),this.historySidebar()?.refresh()})}onWrapperResize(){this.updateIframeStyle()}updateIframeStyle(){window.parent.postMessage({type:"pathify-chatbot-style",style:this.iframeStyle},"*")}get iframeStyle(){let e={display:"block",zIndex:"9999999999",position:"fixed",border:"0",bottom:"0",right:"0",width:"0",height:"0",maxHeight:"100dvh",maxWidth:"100vw"};if(this.visible())return this.isMobile()?N(w({},e),{width:"100vw",height:"100dvh"}):N(w({},e),{width:`min(${this.chatbotWidth+this.iframeXPadding}px, 100vw)`,height:`min(${this.chatbotHeight+this.iframeYPadding}px, 100dvh)`});let i=this.wrapperEl();if(!i)return e;let{width:t,height:s}=i.nativeElement.getBoundingClientRect();return this.greetingVisible()?N(w({},e),{width:`min(${this.chatbotWidth+this.iframeXPadding}px, 100vw)`,height:`${s}px`}):N(w({},e),{width:`${t}px`,height:`${s}px`})}static{this.\u0275fac=function(i){return new(i||n)}}static{this.\u0275cmp=Te({type:n,selectors:[["ng-component"]],viewQuery:function(i,t){i&1&&ye(t.wrapperEl,bt,5)(t.chatbotCore,ft,5)(t.sidebarToggle,Et,5)(t.historySidebar,Tt,5)(t.chatbotSearch,vt,5),i&2&&xe(5)},decls:4,vars:2,consts:()=>{let e;e=$localize`Open chat history`;let i;i=$localize`New chat`;let t;t=$localize`Close AI Agent`;let s;s=$localize`dismiss AI Agent greeting`;let p;p=$localize`Just now`;let h;h=$localize`Hi 👋 How can I help you?`;let m;m=$localize`Rename`;let b;b=$localize`Unpin`;let I;I=$localize`:verb:Pin`;let V;V=$localize`AI Agent chat history`;let R;R=$localize`Close chat history`;let ie;ie=$localize`dismiss AI Agent unavailable message`;let ne;return ne=$localize` The AI Agent isn't available for your role. Please contact your institution for assistance. `,[["wrapperEl",""],["chatbotCore",""],["sidebarToggle",""],["headerChatMenu",""],["historySidebar",""],["chatbotSearch",""],p,h,m,b,I,ne,[1,"d-inline-block","pos-fix","bottom-0","right-0",3,"resized","resizedEmitOnInit"],[1,"d-flex","flex-column","justify-content-end","gap-8",3,"pa-24","fullscreen-mobile"],[1,"pa-24"],[1,"d-flex","flex-column","justify-content-end","gap-8"],[1,"d-flex","flex-column","gap-8","align-items-end","mb-8"],[1,"card","flex-grow","minh-0","pos-rel","d-flex","flex-column","overflow-hidden",2,"max-width","100%"],[1,"d-flex","align-items-center","gap-4","px-16","py-12","bb","mb-8"],["type","button","aria-label",e,"aria-controls","ai-agent-embed-sidebar",1,"btn","sm","borderless","gap-4"],[1,"avatar","size-32","circle","flex-no-shrink"],[1,"h3","text-truncate","mb-0","text-center","flex-grow","minw-0",3,"title"],["type","button","aria-label",i,1,"btn","md","borderless",3,"click"],["name","common-comment-plus"],["type","button","aria-label",t,1,"btn","md","borderless"],[1,"d-flex","flex-column","flex-grow","minh-0",3,"firstTurnComplete","loadOlderMessages","conversationUpdated","refreshConfig","aiChatbotConfig","displayLoginButtonWhenUnauth","hideHeader","fullScreen","hydrateFromConversation","olderMessages","loadingOlder","canLoadOlder"],[1,"d-flex","flex-column","flex-grow","minh-0",3,"hidden","active"],["type","button",1,"btn","md","floating","circle","align-self-end","pa-0","size-48","flex-no-shrink",3,"click"],[1,"avatar","circle","h-100","w-100"],["fallbackIcon","common-chatbot",3,"manualOverrideSrc"],[1,"message-bubble-right","bg-white","shadow-md","px-16","py-12","pos-rel"],[1,"text-muted","text-md","d-flex"],["aria-hidden","true",1,"text-lg","mx-8"],[1,"mt-4"],["type","button","aria-label",s,1,"btn","sm","bg-white","shadow-md","pos-abs",3,"click"],["name","internal-close"],["type","button",1,"rounded","bg-white","shadow-md","px-16","py-8","text-right"],["type","button",1,"rounded","bg-white","shadow-md","px-16","py-8","text-right",3,"click"],[1,"line-clamp-2"],["type","button","aria-label",e,"aria-controls","ai-agent-embed-sidebar",1,"btn","sm","borderless","gap-4",3,"click"],["name","internal-chevron-right"],["type","button",1,"btn","md","borderless","chat-header-trigger","d-flex","align-items-center","gap-4","flex-grow","justify-content-center","minw-0",3,"title","disabled","pfyMenuTriggerFor"],[1,"text-lg","text-base","mb-0","text-truncate"],["padding","none",3,"size"],["name","internal-chevron-down",1,"size-20","flex-no-shrink"],["pfy-menu-item","","type","button",3,"click"],["name","internal-edit"],["name","common-pin-off"],["name","common-pin-outline"],["type","button","aria-label",t,1,"btn","md","borderless",3,"click"],["id","ai-agent-embed-sidebar","aria-label",V,1,"sidebar","d-flex","flex-column","bg-white",3,"keydown.escape","cdkTrapFocus","cdkTrapFocusAutoCapture"],[3,"selected","conversationUpdated","newChatRequested","closeRequested","searchToggled","currentPublicId","chatbotAvatar","chatbotName","isMobile","searchActive"],["type","button","aria-label",R,1,"sidebar-backdrop"],["type","button","aria-label",R,1,"sidebar-backdrop",3,"click"],[1,"d-flex","flex-column","flex-grow","minh-0",3,"conversationSelected","active"],[1,"card","pa-16","pos-rel"],["type","button","aria-label",ie,1,"btn","sm","bg-white","shadow-md","pos-abs",3,"click"]]},template:function(i,t){if(i&1&&(a(0,"div",12,0),u("resized",function(){return t.onWrapperResize()}),T(2,Vt,19,30,"div",13)(3,$t,6,4,"div",14),l()),i&2){let s;E("resizedEmitOnInit",!0),c(2),v((s=t.aiChatbotConfig())?2:t.noAccessMessageVisible()?3:-1,s)}},dependencies:[Le,ke,it,nt,ot,Xe,je,Ke,Ye,Qe,Ge,et],styles:[".fullscreen-mobile[_ngcontent-%COMP%]{width:100vw;height:100dvh;gap:0;padding-top:env(safe-area-inset-top);padding-bottom:env(safe-area-inset-bottom)}.fullscreen-mobile[_ngcontent-%COMP%] .card[_ngcontent-%COMP%]{width:100%!important;height:100%!important;max-width:100%!important;border:0;border-radius:0;box-shadow:none} .scroll-y{overscroll-behavior:contain;scrollbar-width:none} .scroll-y::-webkit-scrollbar{width:0;height:0}.sidebar[_ngcontent-%COMP%]{position:absolute;top:0;left:0;bottom:0;width:100%;max-width:320px;z-index:20;transform:translate(-100%);transition:transform .2s ease;border-right:1px solid var(--n3)}.sidebar.sidebar-open[_ngcontent-%COMP%]{transform:translate(0)}.sidebar[_ngcontent-%COMP%] .btn.active[_ngcontent-%COMP%]{background:var(--n1)}.sidebar-backdrop[_ngcontent-%COMP%]{position:absolute;inset:0;background:#0006;z-index:19;border:0;padding:0;cursor:pointer}"],changeDetection:0})}}return n})();Re({providers:[ue(He),qe(),Be(De(),Ie({cookieName:Ve.CSRF_COOKIE_NAME})),rt()]}).then(n=>{let o=at(lt,{injector:n.injector});customElements.get("pathify-chatbot")||customElements.define("pathify-chatbot",o)}).catch(n=>console.error(n));