PageSourceSearch

https://klinic.com/_next/static/chunks/564.84ba4e53b5e8e4c3.js

js klinic.com collected 2026-09-29 13:18:38 UTC 7,299 bytes, 4 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[564],{40564:function(e,t,r){r.r(t);var n=r(20218),o=r(52983),i=r(14434),a=r(95908),l=r(23892),s=r(64180),c=r(51990),d=r(40346),u=r(98732),f=r(66139),p=r(35904),h=r(94744),g=r(86730),m=r(59339),x=r.n(m),b=r(82523),k=r(49297),Z=r(21572),y=r(72679);let C="#153B50",S="#D7F4E3",B="#7A8B86",F=(0,u.F4)`
2  0%, 80%, 100% { transform: scale(0); }
3  40% { transform: scale(1); }
4`,R=()=>(0,n.tZ)(f.Z,{sx:{display:"flex",alignItems:"center",gap:.5,px:.5,py:1.5},children:[0,1,2].map(e=>(0,n.tZ)(f.Z,{sx:{width:7,height:7,borderRadius:"50%",backgroundColor:"text.disabled",animation:`${F} 1.4s ease-in-out ${.16*e}s infinite both`}},e))}),v=[{key:"insurance",label:"Do you accept my insurance?",icon:(0,n.tZ)(d.Z,{sx:{fontSize:14}}),message:"Do you accept my insurance?"},{key:"provider",label:"Find a provider",icon:(0,n.tZ)(c.Z,{sx:{fontSize:14}}),message:"I need to find a provider at Klinic"}],z=e=>{let{onClick:t}=e;return(0,n.tZ)(x(),{href:"/membership",passHref:!0,legacyBehavior:!0,children:(0,n.BX)(f.Z,{component:"a",onClick:t,sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mx:2,my:1.5,px:2,py:1.5,background:"#35ABAB",color:"#fff",borderRadius:1.5,textDecoration:"none",cursor:"pointer",fontFamily:'"Figtree", sans-serif',"&:hover":{background:"#2C8C8C"}},children:[(0,n.tZ)(p.Z,{sx:{fontWeight:600,fontSize:"0.9rem"},children:"Ready to get started? Book your consultation"}),(0,n.tZ)(i.Z,{sx:{fontSize:18}})]})})};t.default=()=>{let{messages:e,isLoading:t,isCreatingSession:r,error:c,sendMessage:d,retryLastMessage:u,pendingBookingCTA:m}=(0,k.H)({feature:"home-chat",homeMode:!0}),x=(0,b.A4)(),F=(0,Z.k)(),[H,_]=(0,o.useState)(""),[E,w]=(0,o.useState)(null),[D,I]=(0,o.useState)(!1),[A,X]=(0,o.useState)(!1),W=(0,o.useRef)(null),T=(0,o.useRef)(null),M=(0,o.useRef)(null),$=(0,o.useRef)(!1),K=(0,o.useRef)(0),q=(0,o.useRef)(!1);(0,o.useEffect)(()=>{D&&!$.current&&($.current=!0,x.track("Home Chat Initiated",{}))},[D,x]),(0,o.useEffect)(()=>{let t=e.filter(e=>"assistant"===e.role).length;if(t>K.current){let r=e.filter(e=>"assistant"===e.role).slice(-1)[0];x.track("Home Chat Response Received",{response_index:String(t),has_cta:String(!!r?.cta)}),K.current=t}},[e,x]),(0,o.useEffect)(()=>{c&&x.track("Home Chat Error",{error_type:c.type,can_retry:String(c.canRetry)})},[c]),(0,o.useEffect)(()=>{m&&!q.current&&(q.current=!0,x.track("Home Chat Booking CTA Shown",{}))},[m,x]),(0,o.useEffect)(()=>{let e=T.current;e&&(e.scrollTop=e.scrollHeight)},[e,t,r,c,m,A]),(0,o.useEffect)(()=>{t||M.current?.focus()},[t,e.length]),(0,o.useEffect)(()=>{if(!E||W.current===E||t||r)return;let e=v.find(e=>e.key===E);e&&(W.current=E,x.track("Home Chat Message Sent",{source:"quick_prompt",quick_prompt_key:E,message_length:String(e.message.length)}),d(e.message),w(null),I(!0),X(!1))},[E,t,r,d,x]),(0,o.useEffect)(()=>{e.some(e=>"user"===e.role)&&I(!0)},[e]);let N=(0,o.useCallback)(e=>{let n=(e??H).trim();!n||t||r||(x.track("Home Chat Message Sent",{source:"input",message_length:String(n.length)}),d(n),I(!0),X(!1),e||_(""))},[H,t,r,d,x]),P=(0,o.useCallback)(e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),N())},[N]),Y=(0,o.useCallback)(e=>{x.track("Home Chat Quick Prompt Clicked",{prompt_key:e.key,prompt_label:e.label}),w(e.key)},[x]),j=(0,o.useCallback)(()=>{X(t=>{let r=!t;return x.track(r?"Home Chat Minimized":"Home Chat Reopened",{message_count:String(e.length)}),r})},[x,e.length]),O=(0,o.useCallback)(()=>{x.track("Home Chat Booking CTA Clicked",{})},[x]),Q=(0,o.useCallback)(e=>{x.track("Home Chat CTA Clicked",{cta_url:e.url,cta_label:e.label})},[x]);return(0,n.tZ)(f.Z,{sx:{position:"fixed",bottom:0,left:0,right:0,zIndex:"appBar",display:F?{xs:"none",md:"block"}:void 0,px:{xs:2,md:3},pb:2,pointerEvents:"none"},children:(0,n.BX)(f.Z,{sx:{maxWidth:768,mx:"auto",borderRadius:2,boxShadow:"0 8px 32px rgba(0,0,0,0.18)",border:`1px solid ${S}`,background:"rgba(255,255,255,0.7)",backdropFilter:"blur(12px)",overflow:"hidden",pointerEvents:"all",transition:"all 0.2s"},children:[(0,n.tZ)(f.Z,{sx:{display:{xs:"none",md:"flex"},alignItems:"center",gap:1,flexWrap:"wrap",px:2,pt:1.5,pb:1},children:D?(0,n.tZ)(f.Z,{sx:{ml:"auto"},children:(0,n.BX)(f.Z,{component:"button",type:"button",onClick:j,sx:{display:"inline-flex",alignItems:"center",gap:.5,height:28,px:1.5,borderRadius:"14px",border:`1px solid ${S}`,background:"rgba(255,255,255,0.5)",color:C,fontSize:"0.75rem",fontWeight:500,fontFamily:'"Figtree", sans-serif',cursor:"pointer","&:hover":{background:"#f5fdf5"}},children:[(0,n.tZ)("span",{children:A?"Open Chat":"Close Chat"}),A?(0,n.tZ)(l.Z,{sx:{fontSize:14}}):(0,n.tZ)(s.Z,{sx:{fontSize:14}})]})}):(0,n.BX)(n.HY,{children:[(0,n.BX)(f.Z,{sx:{display:"flex",alignItems:"center",gap:.5,mr:.5},children:[(0,n.tZ)(a.Z,{sx:{fontSize:12,color:B}}),(0,n.tZ)(p.Z,{sx:{fontSize:"0.75rem",color:B,fontFamily:'"Figtree", sans-serif'},children:"Ask about:"})]}),v.map(e=>(0,n.BX)(f.Z,{component:"button",type:"button",onClick:()=>
4Y(e),disabled:t||r,sx:{display:"inline-flex",alignItems:"center",gap:.5,height:28,px:1.5,borderRadius:"14px",border:`1px solid ${S}`,background:"rgba(255,255,255,0.5)",color:C,fontSize:"0.75rem",fontWeight:500,fontFamily:'"Figtree", sans-serif',cursor:"pointer",transition:"all 0.15s","&:hover":{background:"#f5fdf5"},"&:disabled":{opacity:.5,cursor:"not-allowed"}},children:[e.icon,(0,n.tZ)("span",{children:e.label})]},e.key))]})}),!A&&(0,n.BX)(f.Z,{children:[r&&0===e.length&&(0,n.tZ)(f.Z,{sx:{px:2,py:1.5},children:(0,n.tZ)(p.Z,{sx:{fontSize:"0.85rem",color:B,fontFamily:'"Figtree", sans-serif'},children:"Connecting…"})}),e.length>0&&(0,n.BX)(f.Z,{ref:T,"data-testid":"home-chat-log",sx:{maxHeight:240,overflowY:"auto",px:2,pt:1.5},children:[e.map(e=>(0,n.tZ)(y.Z,{message:e,onCtaClick:Q},e.id)),t&&(0,n.tZ)(R,{})]}),c&&(0,n.BX)(f.Z,{sx:{display:"flex",alignItems:"center",gap:1,mx:2,my:1,px:1.5,py:1,borderRadius:1,background:"#FEF2F2",border:"1px solid #FECACA"},children:[(0,n.tZ)(p.Z,{sx:{flex:1,fontSize:"0.82rem",color:"#B91C1C",fontFamily:'"Figtree", sans-serif'},children:c.message}),c.canRetry&&(0,n.tZ)(f.Z,{component:"button",type:"button",onClick:u,sx:{fontSize:"0.8rem",color:"#B91C1C",fontWeight:600,background:"none",border:"none",cursor:"pointer",textDecoration:"underline",fontFamily:'"Figtree", sans-serif',p:0,flexShrink:0},children:"Try again"})]}),m&&(0,n.tZ)(z,{onClick:O})]}),(0,n.BX)(f.Z,{sx:{display:"flex",alignItems:"center",gap:1.5,px:2,minHeight:52,background:"#fff",borderRadius:!A&&(e.length>0||m)?"0 0 16px 16px":"16px"},children:[(0,n.tZ)(h.Z,{fullWidth:!0,variant:"standard",placeholder:"Ask about weight loss, insurance, or any Klinic treatment…",value:H,onChange:e=>_(e.target.value),onKeyDown:P,onFocus:()=>{let e=T.current;e&&(e.scrollTop=e.scrollHeight)},disabled:t||r,inputRef:M,InputProps:{disableUnderline:!0,sx:{fontSize:"0.9rem",color:C,fontFamily:'"Figtree", sans-serif',pl:.5}}}),(0,n.tZ)(g.Z,{size:"small",onClick:()=>N(),disabled:!H.trim()||t||r,sx:{backgroundColor:!H.trim()||t||r?"#D1D5DB":"#5B6770",color:"#fff",width:36,height:36,flexShrink:0,"&:hover":{backgroundColor:"#43525B"},"&.Mui-disabled":{backgroundColor:"#D1D5DB",color:"rgba(255,255,255,0.6)"}},children:(0,n.tZ)(i.Z,{sx:{fontSize:18}})})]})]})})}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.