1try{let e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="9b0ea5c5-34cc-4b2d-a2f2-b8613da2302c",e._sentryDebugIdIdentifier="sentry-dbid-9b0ea5c5-34cc-4b2d-a2f2-b8613da2302c")}catch(e){}"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8093],{60644:(e,t,s)=>{function r(e,t,r,a){if("error"===e||"warn"===e){let s=function(e,t,s){let r=`[${e.toUpperCase()}]`;return s&&Object.keys(s).length>0?`${r} ${t} ${JSON.stringify(s,null,0)}`:`${r} ${t}`}(e,t,r);switch(e){case"debug":console.debug(s);break;case"info":console.info(s);break;case"warn":console.warn(s);break;case"error":a?console.error(s,a):console.error(s)}}"error"===e&&a&&function(e,t){try{Promise.all([s.e(4850),s.e(5392)]).then(s.bind(s,55392)).then(s=>{s.captureException(e,{extra:t})}).catch(()=>{})}catch{}}(a,r)}s.d(t,{v:()=>a});let a={debug:(e,t)=>{r("debug",e,t)},info:(e,t)=>{r("info",e,t)},warn:(e,t)=>{r("warn",e,t)},error:(e,t,s)=>{r("error",e,s,t)}}},68823:(e,t,s)=>{s.r(t),s.d(t,{HotelChatWidgetWithProvider:()=>S,default:()=>C});var r=s(95155),a=s(12115),n=s(47650),o=s(35695),i=s(17652),l=s(18827),c=s(23736),d=s(60644);function u(e){return e instanceof Error?e:"string"==typeof e?Error(e):Error("An unknown error occurred")}function m(e){return{chatType:e.chatType,domain:e.pageContext?.params?.domain,locale:e.pageContext?.params?.locale,pathname:e.pageContext?.pathname,hotelCode:e.hotelContext?.hotelCode,hotelName:e.hotelContext?.hotelName}}function h(e){return"text"===e.type&&"text"in e&&"string"==typeof e.text}function p({hotel:e,onQuestionClick:t,className:s="",aiSuggestions:n,isLoading:o=!1}){let l=(0,i.c3)("Chat.SuggestedQuestions"),c=(0,a.useMemo)(()=>n&&n.length>0?n:(function(e){let t=[];return t.push("facilities"),t.push("rooms"),t.push("directions"),e.features&&e.features.length>0&&e.features.some(e=>e.features?.some(e=>{let t=e.text;if("string"!=typeof t)return!1;let s=t.toLowerCase();return s.includes("spa")||s.includes("wellness")}))&&t.push("spaServices"),e.programs&&e.programs.length>0&&t.push("programs"),e.ratingValue>0&&t.push("guestReviews"),t.slice(0,5)})(e).map(e=>l(e)),[n,e,l]);return 0!==c.length||o?(0,r.jsx)("div",{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap ${s}`,children:o&&0===c.length?Array.from({length:3}).map((e,t)=>(0,r.jsx)("div",{className:"h-11 w-full animate-pulse rounded-lg bg-stone-200 sm:h-9 sm:w-32 sm:rounded-full","aria-label":"Loading suggestions"},t)):c.map((e,s)=>(0,r.jsx)("button",{type:"button",onClick:()=>t(e),className:"group w-full rounded-lg border border-stone-300 bg-white px-4 py-3 text-left text-sm leading-snug text-stone-700 transition-all whitespace-normal break-words [hyphens:auto] hover:border-primary hover:bg-primary/5 hover:text-primary focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 sm:w-auto sm:rounded-full sm:py-2 sm:text-center","aria-label":e,children:e},s))}):null}var f=s(32599),g=s(98014),x=s(85573),b=s(67345),y=s(88277),w=s(25057),v=s(61797),j=s(50085),N=s(62374);function C({hotelCode:e,hotelName:t,hotel:s,domain:j,currency:N,locale:C,abTestVariant:S}){let[k,E]=(0,a.useState)(!1),[T,D]=(0,a.useState)(!1),[L,$]=(0,a.useState)(""),[R,I]=(0,a.useState)(!1),A=(0,o.usePathname)(),M=(0,i.c3)("Chat.Widget");(0,a.useEffect)(()=>{function e(){D((0,v.pj)())}return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);let _=(0,a.useMemo)(()=>({pageContext:{type:"hotel",params:{locale:C,domain:j,currency:N,hotelName:t},pathname:A,searchParams:{}},searchContext:{destinations:[],themes:[],dates:{},filters:{guests:0,locationFilters:[]}},hotelContext:{hotelCode:e,hotelName:t},chatType:"hotel-page",abTestVariant:S}),[e,t,j,N,C,A,S]),{messages:z,handleSubmit:F,status:H,error:P,clearConversation:U,clearLocalError:O}=function(e){let t=(0,a.useRef)(e.context),[s,r]=a.useState(null),n=(0,a.useMemo)(()=>(function(){let e=globalThis.crypto?.randomUUID?.();return e||`${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`})(),[]);t.current=e.context;let{messages:o,setMessages:i,sendMessage:h,status:p,stop:f,error:g,clearError:x}=(0,l.Y_)({transport:new c.rL({api:e.api,headers:{"Content-Type":"application/json"}}),onError(e){d.v.error("Hotel chat stream error",e,m(t.current)),r(u(e))}}),b=(0,a.useCallback)(async e=>{if(e.trim())try{r(null),await h({role:"user",parts:[{type:"text",text:e.trim()}]},{body:{context:t.current,conversationId:n}})}catch(e){d.v.error("Failed to send hotel chat message",e,m(t.current)),r(u(e))}},[h,n]),y=(0,a.useCallback)(()=>{i([]),r(null),x?.()},[i,x]),w=(0,a.useCallback)(()=>{r(null)},[]);return{messages:o,handleSubmit:b,status:p,setMessages:i,stop:f,isLoading:"submitted"===p||"streaming"===p,error:s??(g?u(g):null),clearConversation:y,clearError:x,clearLocalError:w}}({context:_,api:"/api/chat"}),W=z.length>0,{suggestions:Q,isLoading:J}=function({context:e,messages:t,hotelName:s,enabled:r=!0}
1){let[n,o]=(0,a.useState)([]),[i,l]=(0,a.useState)(!1),[c,u]=(0,a.useState)(null),m=(0,a.useCallback)(async()=>{if(!r)return void o([]);l(!0),u(null);try{let r=t.map(e=>({role:e.role,content:e.parts.filter(h).map(e=>e.text).join(" ")})),a=await fetch("/api/chat/suggestions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:r,context:e,hotelName:s})});if(!a.ok)throw Error(`Failed to fetch suggestions: ${a.statusText}`);let n=await a.json();o(n.suggestions||[])}catch(t){d.v.error("Error fetching hotel chat suggestions",t,{chatType:e.chatType,domain:e.pageContext?.params?.domain,locale:e.pageContext?.params?.locale,pathname:e.pageContext?.pathname,hotelName:s}),u(t instanceof Error?t:"string"==typeof t?Error(t):Error("An unknown error occurred")),o([])}finally{l(!1)}},[e,t,s,r]);return(0,a.useEffect)(()=>{if(!r)return;let e=setTimeout(()=>{m()},500);return()=>clearTimeout(e)},[r,m]),{suggestions:n,isLoading:i,error:c,refetch:m}}({context:_,messages:z,hotelName:t,enabled:W}),K=(0,a.useRef)(e);(0,a.useEffect)(()=>{K.current!==e&&K.current&&U(),K.current=e},[e,U]);let{messagesEndRef:V,messagesContainerRef:Y,bottomSpacing:q,lastUserMessageLabelRef:B,typingIndicatorRef:G,lastAssistantMessageRef:X}=(0,x.T)({messages:z,status:H,isOpen:k});(0,a.useEffect)(()=>(T&&k?(0,v.bA)():(0,v.ec)(),()=>(0,v.ec)()),[T,k]);let Z=(0,a.useCallback)(()=>{E(!0)},[]),ee=(0,a.useCallback)(()=>{E(!1)},[]),et=(0,a.useCallback)(()=>{k||Z()},[k,Z]),es=(0,a.useCallback)(e=>{let t=e.target.value;$(t);let s=e.target;s.style.height="auto",s.style.height=`${Math.min(s.scrollHeight,120)}px`,t.length>0&&!k&&Z()},[k,Z]),er=(0,a.useCallback)(e=>{$(""),Z(),setTimeout(()=>{F(e)},100)},[Z,F]),ea=(0,a.useCallback)(async e=>{$(""),await F(e)},[F]),en="submitted"===H||"streaming"===H,eo=z.length>0,ei=(0,a.useCallback)(e=>{e.preventDefault();let t=L.trim();t&&($(""),Z(),setTimeout(()=>{F(t)},100))},[L,Z,F]);if(T&&k){let e=(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col bg-white animate-[hotelChatFadeUp_300ms_cubic-bezier(0.4,0,0.2,1)]",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between border-b border-stone-200 px-4 py-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-gradient-to-r from-primary to-primary",children:(0,r.jsx)(b.W,{className:"h-4 w-4 text-primary-complement"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold text-stone-900",children:M("chattingAbout",{hotelName:t})})]}),(0,r.jsx)("button",{type:"button",onClick:ee,className:"rounded-lg p-2 text-stone-500 hover:bg-stone-100 hover:text-stone-700 focus:outline-none focus:ring-2 focus:ring-primary","aria-label":M("minimize"),children:(0,r.jsx)(w.default,{className:"h-5 w-5"})})]}),(0,r.jsxs)("div",{ref:Y,className:"min-h-0 flex-1 overflow-y-auto px-4 py-4",children:[(0,r.jsx)(g.A,{messages:z,messagesContainerRef:Y,messagesEndRef:V,bottomSpacing:q,lastUserMessageLabelRef:B,typingIndicatorRef:G,lastAssistantMessageRef:X,isLoading:en,status:H,showEmptyState:!0,emptyStateTitle:M("emptyStateTitle"),emptyStateDescription:M("emptyStateDescription")}),!eo&&(0,r.jsx)("div",{className:"mt-4",children:(0,r.jsx)(p,{hotel:s,onQuestionClick:er,aiSuggestions:Q,isLoading:J})})]}),P&&(0,r.jsx)("div",{className:"border-t border-red-200 bg-red-50 px-4 py-2",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("p",{className:"text-sm text-red-800",children:P.message}),(0,r.jsx)("button",{onClick:O,className:"text-sm text-red-600 hover:text-red-800",children:M("dismiss")})]})}),(0,r.jsx)("div",{className:"border-t border-stone-200",children:(0,r.jsx)(f.A,{handleSubmit:ea,isLoading:en,isInputDisabled:!1,onFocusChange:I})})]});return(0,n.createPortal)(e,document.body)}return(0,r.jsxs)("div",{className:"relative overflow-hidden rounded-lg border border-stone-200 bg-white shadow-sm",children:[(0,r.jsxs)("div",{className:`flex items-center justify-between px-4 py-3 ${k?"border-b border-stone-200":""}`,children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-gradient-to-r from-primary to-primary",children:(0,r.jsx)(b.W,{className:"h-5 w-5 text-primary-complement"})}),(0,r.jsx)("h3",{className:"text-base font-semibold leading-snug text-stone-900",children:M("title")})]}),(0,r.jsx)("button",{type:"button",onClick:ee,className:`rounded-lg p-2 text-stone-500 transition-[opacity,transform] duration-150 ease-out hover:bg-stone-100 hover:text-stone-700 focus:outline-none focus:ring-2 focus:ring-primary ${k?"scale-100 opacity-100":"pointer-events-none scale-75 opacity-0"}`,"aria-label":M("minimize"),"aria-hidden":!k,tabIndex:k?0:-1,children:(0,r.jsx)(y.default,{className:"h-5 w-5"})})]}),(0,r.jsx)("div",{className:`grid transition-[grid-template-rows,opacity] duration-300 ease-[
1cubic-bezier(0.4,0,0.2,1)] ${k?"grid-rows-[0fr] opacity-0":"grid-rows-[1fr] opacity-100"}`,inert:k,"aria-hidden":k,children:(0,r.jsx)("div",{className:"overflow-hidden",children:(0,r.jsxs)("form",{onSubmit:ei,className:"space-y-3 px-4 pb-4",children:[(0,r.jsx)("div",{className:"relative",children:(0,r.jsx)("textarea",{value:L,onChange:es,onFocus:et,placeholder:M("placeholder"),className:"w-full resize-none rounded-lg border border-stone-300 px-4 py-3 text-sm text-stone-700 placeholder-stone-400 focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1",rows:1,style:{minHeight:"44px",maxHeight:"120px",height:"auto"}})}),(0,r.jsx)(p,{hotel:s,onQuestionClick:er,className:"mt-2",aiSuggestions:Q,isLoading:J})]})})}),(0,r.jsx)("div",{className:`grid transition-[grid-template-rows,opacity] duration-300 ease-[cubic-bezier(0.4,0,0.2,1)] ${k?"grid-rows-[1fr] opacity-100":"grid-rows-[0fr] opacity-0"}`,inert:!k,"aria-hidden":!k,children:(0,r.jsxs)("div",{className:"flex min-h-0 flex-col overflow-hidden",children:[(0,r.jsxs)("div",{ref:Y,className:"min-h-0 flex-1 overflow-y-auto px-4 py-4",style:{maxHeight:"500px"},children:[(0,r.jsx)(g.A,{messages:z,messagesContainerRef:Y,messagesEndRef:V,bottomSpacing:q,lastUserMessageLabelRef:B,typingIndicatorRef:G,lastAssistantMessageRef:X,isLoading:en,status:H,showEmptyState:!0,emptyStateTitle:M("emptyStateTitle"),emptyStateDescription:M("emptyStateDescription")}),!eo&&(0,r.jsx)("div",{className:"mt-4",children:(0,r.jsx)(p,{hotel:s,onQuestionClick:er,aiSuggestions:Q,isLoading:J})})]}),P&&(0,r.jsx)("div",{className:"border-t border-red-200 bg-red-50 px-4 py-2",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("p",{className:"text-sm text-red-800",children:P.message}),(0,r.jsx)("button",{onClick:O,className:"text-sm text-red-600 hover:text-red-800",children:M("dismiss")})]})}),eo&&!en&&Q.length>0&&R&&(0,r.jsx)("div",{className:"border-t border-stone-100 bg-stone-50 px-3 py-2",children:(0,r.jsx)("div",{className:"flex flex-wrap gap-1.5",children:Q.slice(0,2).map((e,t)=>(0,r.jsx)("button",{type:"button",onMouseDown:t=>{t.preventDefault(),er(e)},className:"rounded-full border border-stone-200 bg-white px-3 py-1.5 text-xs text-stone-600 transition-all hover:border-primary hover:bg-primary/5 hover:text-primary focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1",children:e},t))})}),(0,r.jsx)("div",{className:"border-t border-stone-200",children:(0,r.jsx)(f.A,{handleSubmit:ea,isLoading:en,isInputDisabled:!1,onFocusChange:I})})]})})]})}function S(e){return(0,r.jsx)(j.e,{children:(0,r.jsx)(N.l,{fallback:(0,r.jsx)(r.Fragment,{}),children:(0,r.jsx)(C,{...e})})})}},70247:(e,t,s)=>{s.d(t,{T:()=>o,default:()=>i});var r=s(95155),a=s(12115),n=s(61432);let o=(0,a.createContext)({});function i({children:e}){let[t,s]=(0,a.useState)(!1),[i,l]=(0,a.useState)(),[c,d]=(0,a.useState)(!1);return(0,a.useEffect)(function e(){window.store?d(!0):setTimeout(e,100)},[]),(0,r.jsx)(o,{value:{setDisplayMap:function(e){s(e),window.dispatchEvent(new CustomEvent(n.Ki,{}))},displayMap:t,searchOptionsType:i,setSearchOptionsType:l,storeInitialized:c},children:e})}}}]); 2//# sourceMappingURL=8093.d7471cbeeb4e9d6b.js.map
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.