"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5454],{"0Tio":function(e,t,a){a.d(t,{J:function(){return BookingSearchBar}});var i,o,n=a("fbRC"),l=a("q1tI"),s=a("AeFk"),r=a("Dh7N"),c=a("thIk"),d=a("sEfC"),u=a.n(d),p=a("DXMQ"),h=a("rBCA"),g=a("5JWB"),m=a("F/Hd"),b=a("iBNF"),y=a("9WAK"),f=a.n(y),v=a("+Q0Z"),E=a("oKqh"),S=a("ECoa"),C=a("Hcbr");a("gY0P");let x=h.Z.div``,w=h.Z.div` --searchbar-z-index: 305; &[data-is-modal='true'] { position: fixed; left: 0; right: 0; top: 0; height: var(--mobile-care-searchbar-height, 100%); overflow-y: auto; -webkit-overflow-scrolling: touch; background-color: white; z-index: var(--searchbar-z-index); } `,L=h.Z.section``,k=h.Z.input` position: fixed; left: -100%; top: -100%; `,I=(0,h.Z)(g.I)` #booking-search-bar & { input { font-size: 16px; } } `,LocationResults=({cities:e,isLoading:t,onLocationClick:a,selectedLocation:i})=>{let{t:o,locale:n}=(0,c.u)();return l.createElement(r.S,{"data-testid":"location-search-results"},l.createElement(r.a,null,t?l.createElement(r.b,{count:5}):!e||e.length<1?l.createElement(l.Fragment,null,l.createElement(r.c,{"data-is-denied":"true"},l.createElement(m.T,{size:"sm",color:"#ccc"},o("booking.searchBar.noResults")))):l.createElement(l.Fragment,null,l.createElement(r.c,{key:"all-location",role:"button",tabIndex:0,onClick:()=>{var e;a&&a({name:o("booking.searchBar.allLocations"),id:p.I,slug:null===(e=p.L[n])||void 0===e?void 0:e.ALL})}},l.createElement(r.d,{color:b.r.colors.neutral400}),l.createElement(m.T,{size:"md"},o("booking.searchBar.allLocations"))),e.map(e=>l.createElement(r.c,{key:e.id,onClick:t=>{t.nativeEvent.stopImmediatePropagation(),a&&a(e)},role:"button",tabIndex:0,"aria-label":`Select ${e.name} as location`,isSelected:(null==i?void 0:i.id)===e.id},l.createElement(r.d,{color:b.r.colors.neutral400}),l.createElement(m.T,{size:"md"},e.name))))))},O={TYPE_CHARACTER:"TYPE_CHARACTER",REMOVE_CHARACTER:"REMOVE_CHARACTER",REMOVE_ALL:"REMOVE_ALL",REMOVE_LAST_VISIBLE_NODE:"REMOVE_LAST_VISIBLE_NODE",PAUSE_FOR:"PAUSE_FOR",CHANGE_DELETE_SPEED:"CHANGE_DELETE_SPEED",CHANGE_DELAY:"CHANGE_DELAY",PASTE_STRING:"PASTE_STRING"},getRandomInteger=(e,t)=>Math.floor(Math.random()*(t-e+1))+e,R={TEXT_NODE:"TEXT_NODE"};let Typewriter=class Typewriter{constructor(e){this.state={lastFrameTime:null,pauseUntil:null,eventQueue:[],eventLoop:null,eventLoopPaused:!1,reverseCalledEvents:[],calledEvents:[],visibleNodes:[],initialOptions:null},this.options={strings:null,delay:"natural",pauseFor:1500,deleteSpeed:"natural",loop:!1,autoStart:!1,stringSplitter:null,onCreateTextNode:null,onRemoveNode:null},this.start=()=>(this.state.eventLoopPaused=!1,this.runEventLoop(),this),this.pause=()=>(this.state.eventLoopPaused=!0,this),this.stop=()=>(this.state.eventLoop&&(window.cancelAnimationFrame(this.state.eventLoop),this.state.eventLoop=null),this),this.pauseFor=e=>(this.addEventToQueue(O.PAUSE_FOR,{ms:e}),this),this.typeOutAllStrings=()=>("string"==typeof this.options.strings?this.typeString(this.options.strings).pauseFor(this.options.pauseFor):this.options.strings.forEach(e=>{this.typeString(e).pauseFor(this.options.pauseFor).deleteAll(this.options.deleteSpeed)}),this),this.typeString=(e,t=null)=>{if(e){let{stringSplitter:a}=this.options||{},i="function"==typeof a?a(e):e.split("");this.typeCharacters(i,t)}return this},this.pasteString=(e,t=null)=>(e&&this.addEventToQueue(O.PASTE_STRING,{character:e,node:t}),this),this.deleteAll=(e="natural")=>(this.addEventToQueue(O.REMOVE_ALL,{speed:e}),this),this.changeDeleteSpeed=e=>{if(!e)throw Error("Must provide new delete speed");return this.addEventToQueue(O.CHANGE_DELETE_SPEED,{speed:e}),this},this.changeDelay=e=>{if(!e)throw Error("Must provide new delay");return this.addEventToQueue(O.CHANGE_DELAY,{delay:e}),this},this.deleteChars=e=>{if(!e)throw Error("Must provide amount of characters to delete");for(let t=0;t{if(!e||!Array.isArray(e))throw Error("Characters must be an array");return e.forEach(e=>{this.addEventToQueue(O.TYPE_CHARACTER,{character:e,node:t})}),this},this.removeCharacters=e=>{if(!e||!Array.isArray(e))throw Error("Characters must be an array");return e.forEach(()=>{this.addEventToQueue(O.REMOVE_CHARACTER)}),this},this.addEventToQueue=(e,t,a=!1)=>this.addEventToStateProperty(e,t,a,"eventQueue"),this.addReverseCalledEvent=(e,t,a=!1)=>{let{loop:i}=this.options;return i?this.addEventToStateProperty(e,t,a,"reverseCalledEvents"):this},this.addEventToStateProperty=(e,t,a=!1,i)=>{let o={eventName:e,eventArgs:t||{}};return a?this.state[i]=[o,...this.state[i]]:this.state[i]=[...this.state[i],o],this},this.runEventLoop=()=>{this.state.lastFrameTime||(this.state.lastFrameTime=Date.now());let e=Date.now(),t=e-this.state.lastFrameTime;if(!this.state.eventQueue.length){if(!this.options.loop)return;this.state.eventQueue=[...this.state.calledEvents],this.state.calledEvents=[],this.options=Object.assign({},this.state.initialOptions)}if(this.state.eventLoop=window.requestAnimationFrame(this.runEventLoop),this.state.eventLoopPaused)return;if(this.state.pauseUntil){if(e{if(a)return[];let e=["booking.searchBar.placeholder.hospital","booking.searchBar.placeholder.doctor"];return"zh-TW"!==o&&e.push("booking.searchBar.placeholder.specialty","booking.searchBar.placeholder.service"),f()(e).map(e=>i(e))},[i,o]);function customNodeCreator(e){let t=getInput();return t&&(t.placeholder=t.placeholder+e),null}function onRemoveNode(){let e=getInput();e&&(e.placeholder=e.placeholder.slice(0,-1))}function getInput(){return e&&e.current?e.current:t&&t.current&&t.current.querySelector("input")||null}(0,l.useEffect)(()=>{if(a)return;let e=getInput();e&&(e.placeholder="",new Typewriter({strings:n,autoStart:!0,loop:!0,delay:32,deleteSpeed:32,pauseFor:1500,onCreateTextNode:customNodeCreator,onRemoveNode:onRemoveNode}))},[e,t])}let T=h.Z.div` user-select: none; input { pointer-events: none; background-color: white; } `;function MobileFakeInput({focused:e,value:t="",onClick:a,trackingAttributes:i,inputSearchPlaceholder:o}){let{t:n}=(0,c.u)(),s=(0,l.useRef)(null);useAnimatedPlaceholder({wrapperRef:s,disabled:!!o});let d=(0,l.useMemo)(()=>i?{"data-event-category":i.dataEventCategory,"data-event-action":i.dataEventAction,"data-event-label":i.dataEventLabel}:{},[i]);return l.createElement(T,Object.assign({onClick:()=>a&&a(),ref:s},d),l.createElement(I,{inputClassName:"location"===e?"focused":void 0,name:"booking-search-placeholder",displayIcon:l.createElement(r.M,{color:b.r.colors.gray400}),placeholder:n("booking.searchBar.searchInput.placeholder"),value:t,size:"md"}))}let j=h.Z.header` display: flex; height: 64px; align-items: center; justify-content: space-between; margin: 0 auto; position: sticky; z-index: 99; background-color: white; top: 0; left: 0; `,M=h.Z.div` display: inline-flex; flex: 1; justify-content: flex-end; cursor: pointer; text-decoration: underline; `,A=h.Z.div` display: flex; align-items: center; margin-left: 16px; cursor: pointer; `,P=h.Z.div` width: 100%; margin-left: 24px; `,F=(0,h.Z)(m.T)` color: ${b.r.colors.secondaryDark}; text-align: start; `,MobileTopBar=({className:e,onLeftClick:t,headingText:a,onRightClick:i,iconLeft:o,textRight:n})=>l.createElement(j,{className:e},l.createElement(A,{onClick:t},o||l.createElement(r.C,{color:b.r.colors.gray800})),l.createElement(P,null,l.createElement(F,{size:"md",weight:"bold"},a)),l.createElement(M,{onClick:i},n&&l.createElement("p",null,n))),$={"en-PH":3,"tl-PH":2,"id-ID":3,"vi-VN":2,"zh-TW":0,"ms-MY":2,"th-TH":2},_={isMobile:!1,isDebug:!1,navigateTo:null,geoLocationPermission:"unset",geoLocationCoordinates:null,focused:"none",searchLocationKeywords:"",searchKeywords:"",selectedLocation:null,defaultCity:null,initialCities:[],cities:[],searchResults:[],initialSearchResults:[],isLoadingCities:!1,isLoadingSearchResults:!1,isMobileModalOpened:!1,initialSelectedCity:null,autoCompleteDisabled:!1,inputSearchPlaceholder:"",locale:"vi-VN"};function resetSearchLocationKeywords(e){let{selectedLocation:t,searchLocationKeywords:a}=e;return t&&a!==t.name?Object.assign(Object.assign({},e),{searchLocationKeywords:t.name}):e}function reducer(e,t){var a;switch(e.isDebug&&console.log("bookingSearchBar",{action:t,state:e}),t.type){case o.NavigateTo:return Object.assign(Object.assign({},e),{navigateTo:t.payload,focused:"none",isMobileModalOpened:!1});case o.ClickOutsideInputLocation:if(e.isMobile||"location"!==e.focused)return e;return resetSearchLocationKeywords(Object.assign(Object.assign({},e),{focused:"none"}));case o.ClickOutsideInputSearch:if(e.isMobile||"search"!==e.focused)return e;return Object.assign(Object.assign({},e),{focused:"none"});case o.FocusInputLocation:{let t=Object.assign(Object.assign({},e),{focused:"location"});return(null===(a=e.selectedLocation)||void 0===a?void 0:a.id)===p.a&&(t.searchLocationKeywords=""),t}case o.FocusInputSearch:let i=Object.assign(Object.assign({},e),{focused:"search"});if(e.isMobile)return resetSearchLocationKeywords(i);return i;case o.ChangeInputLocation:return Object.assign(Object.assign({},e),{searchLocationKeywords:t.payload});case o.ChangeInputSearch:{let a=t.payload;return Object.assign(Object.assign({},e),{searchKeywords:a,isLoadingSearchResults:a.trim().length>$[e.locale]})}case o.SelectCurrentLocation:return Object.assign(Object.assign({},e),{focused:"none",selectedLocation:t.payload,searchLocationKeywords:t.payload.name});case o.ClearInputLocation:return Object.assign(Object.assign({},e),{focused:"location",cities:e.initialCities,searchLocationKeywords:""});case o.ClearInputSearch:return Object.assign(Object.assign({},e),{focused:"search",searchKeywords:""});case o.SelectLocation:return Object.assign(Object.assign({},e),{focused:"none",selectedLocation:t.payload,searchLocationKeywords:t.payload.name});case o.SelectSearchResult:return Object.assign(Object.assign({},e),{searchKeywords:t.payload.name,isMobileModalOpened:!1,focused:"none",navigateTo:t.payload.url});case o.FetchCitiesStart:return Object.assign(Object.assign({},e),{isLoadingCities:!0});case o.FetchCitiesFinish:return Object.assign(Object.assign({},e),{isLoadingCities:!1});case o.FetchSearchResultsStart:return Object.assign(Object.assign({},e),{isLoadingSearchResults:!0});case o.FetchSearchResultsFinish:return Object.assign(Object.assign({},e),{isLoadingSearchResults:!1});case o.FetchSearchResultsComplete:{let a=Object.assign(Object.assign({},e),{searchResults:t.payload});return 0===e.initialSearchResults.length&&(a.initialSearchResults=t.payload),a}case o.FetchCitiesByGeoIpComplete:{let{cities:a}=t.payload,{default:i}=t.payload;(a=a.filter(e=>e.id!==i.id)).unshift(i),e.initialSelectedCity&&!a.find(t=>t.id===e.initialSelectedCity.id)&&a.unshift(e.initialSelectedCity);let o=Object.assign(Object.assign({},e),{defaultCity:i,initialCities:a,cities:a});return"denied"!==e.geoLocationPermission||e.initialSelectedCity||(o.selectedLocation=i,o.searchLocationKeywords=i.name),o}case o.FetchCitiesByKeywordComplete:return Object.assign(Object.assign({},e),{cities:t.payload});case o.DisplayInitialCities:return Object.assign(Object.assign({},e),{cities:e.initialCities});case o.DisplayInitialSearchResults:return Object.assign(Object.assign({},e),{searchResults:e.initialSearchResults,isLoadingSearchResults:!1});case o.GrantGeoLocationPermission:return Object.assign(Object.assign({},e),{geoLocationPermission:"granted",geoLocationCoordinates:t.payload});case o.DenyGeoLocationPermission:return Object.assign(Object.assign({},e),{geoLocationPermission:"denied",geoLocationCoordinates:null});case o.OpenMobileModal:return Object.assign(Object.assign({},e),{isMobileModalOpened:!0});case o.CloseMobileModal:return Object.assign(Object.assign({},e),{isMobileModalOpened:!1});case o.UpdateInitialSearchValue:return Object.assign(Object.assign({},e),{searchKeywords:t.payload});case o.SetInputSearchPlaceholder:return Object.assign(Object.assign({},e),{inputSearchPlaceholder:t.payload});default:return e}}(i=o||(o={})).NavigateTo="navigate to url",i.ClickOutsideInputLocation="click outside input location",i.ClickOutsideInputSearch="click outside input search",i.SelectCurrentLocation="select current location",i.FocusInputLocation="focus input location",i.FocusInputSearch="focus input search",i.ChangeInputLocation="change input location",i.ChangeInputSearch="change input search",i.ClearInputLocation="clear input location",i.ClearInputSearch="clear input search",i.SelectLocation="select location",i.FetchCitiesStart="fetch cities start",i.FetchCitiesFinish="fetch cities finish",i.FetchSearchResultsStart="fetch search results start",i.FetchSearchResultsComplete="fetch search results complete",i.FetchSearchResultsFinish="fetch search results finish",i.FetchCitiesByGeoIpComplete="fetch cities by geo IP finish",i.FetchCitiesByKeywordComplete="fetch cities by keyword finish",i.DisplayInitialCities="display initial cities",i.DisplayInitialSearchResults="display initial search results",i.GrantGeoLocationPermission="grant geolocation permission",i.DenyGeoLocationPermission="deny geolocation permission",i.OpenMobileModal="open mobile modal",i.CloseMobileModal="close mobile modal",i.UpdateInitialSearchValue="update initial search value",i.SelectSearchResult="select search result",i.SetInputSearchPlaceholder="set input search placeholder";let N=h.Z.div` display: flex; gap: 16px; ${E.M.mbDown} { flex-direction: column; padding: 14px; background-color: ${b.r.colors.primary50}; input { filter: drop-shadow(0px 4px 8px rgba(0, 0, 0, 0.04)) drop-shadow(0px 0px 2px rgba(0, 0, 0, 0.06)) drop-shadow(0px 0px 1px rgba(0, 0, 0, 0.04)); } } input { background-color: white; } `,D=h.Z.div` position: relative; `,B=(0,h.Z)(D)` flex: 1; `,z=(0,h.Z)(D)` flex: 2; `,K=(0,h.Z)(r.e)` display: none; &.shown { display: block; } `,SearchIcon=()=>l.createElement("svg",{width:"18",height:"18",viewBox:"0 0 18 18"},l.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.97887 8.15493C2.97887 5.29627 5.29627 2.97887 8.15493 2.97887C11.0136 2.97887 13.331 5.29627 13.331 8.15493C13.331 11.0136 11.0136 13.331 8.15493 13.331C5.29627 13.331 2.97887 11.0136 2.97887 8.15493ZM8.15493 1.5C4.47951 1.5 1.5 4.47951 1.5 8.15493C1.5 11.8303 4.47951 14.8099 8.15493 14.8099C9.72624 14.8099 11.1704 14.2653 12.3089 13.3546L15.2377 16.2834C15.5265 16.5722 15.9947 16.5722 16.2834 16.2834C16.5722 15.9947 16.5722 15.5265 16.2834 15.2377L13.3546 12.3089C14.2653 11.1704 14.8099 9.72624 14.8099 8.15493C14.8099 4.47951 11.8303 1.5 8.15493 1.5Z",fill:"white"})),Z=h.Z.button` min-height: 100%; border-radius: 6px; background-color: ${b.r.colors.primaryBase}; display: flex; justify-content: center; align-items: center; gap: 11px; cursor: pointer; flex: 0.3; ${E.M.mbDown} { --margin: 16px; min-height: 44px; margin: var(--margin); width: calc(100% - var(--margin) * 2); position: absolute; bottom: 0; } &:hover { background-color: ${b.r.colors.primaryHover}; } &:active { background-color: ${b.r.colors.primaryActive}; } &:focus-visible { outline: 1px solid black; } `,V=(0,h.Z)(m.T)` font-weight: ${b.r.sizes.fwSemiBold}; `,SearchButton=({onClick:e})=>{let{t}=(0,c.u)(),a=t("booking.searchBar.searchButton");return l.createElement(Z,{onClick:e,title:a},l.createElement(SearchIcon,null),l.createElement(V,{size:"s3",color:"white"},a))};function SearchInputs({isMobile:e,state:t,dispatch:a,debouncedFetchCitiesByKeyword:i,debouncedFetchSearchResults:n,focusLocationInput:s,focusSearchInput:d,renderLocationResults:u,renderSearchResults:h,locationTrackingAttributes:g,trackingAttributes:m,onSearch:y,initalSearchValue:f}){let E=(0,l.useRef)(null),S=(0,l.useRef)(null),{focused:C,searchLocationKeywords:x,geoLocationPermission:w,selectedLocation:L,searchKeywords:k,inputSearchPlaceholder:O}=t,{t:R}=(0,c.u)();useAnimatedPlaceholder({wrapperRef:S,disabled:!!O}),(0,v.a)(E,()=>{e||a({type:o.ClickOutsideInputLocation})}),(0,v.a)(S,()=>{e||a({type:o.ClickOutsideInputSearch})});let T=(0,l.useMemo)(()=>"granted"===w&&(null==L?void 0:L.id)===p.a?b.r.colors.primaryBase:b.r.colors.gray400,[w,L]),j=(0,l.useCallback)(function(e){a({type:o.ChangeInputSearch,payload:e}),"function"!=typeof y&&(e.trim().length>$[t.locale]||f?n(e.trim(),t):(n.cancel(),a({type:o.DisplayInitialSearchResults})))},[a,t]),M=(0,l.useCallback)(function(e){a({type:o.ChangeInputLocation,payload:e}),e.trim().length>$[t.locale]?i(e.trim()):(i.cancel(),a({type:o.DisplayInitialCities}))},[i,a]);return l.createElement(N,null,l.createElement(B,{ref:E},l.createElement(I,{inputClassName:"location"===C?"focused":void 0,placeholder:R("booking.searchBar.locationPlaceholder"),autoComplete:"off",name:"search-location",displayIcon:l.createElement(r.P,{className:"location-pin-icon",color:T}),actionIcon:l.createElement(K,{color:b.r.colors.gray300,className:""!==x?"shown":""}),onActionClick:function(){a({type:o.ClearInputLocation}),i.cancel(),s()},value:x,onChange:M,onFocus:()=>a({type:o.FocusInputLocation}),size:"md",trackingAttributes:g}),!e&&u()),l.createElement(z,{ref:S},l.createElement(I,{placeholder:O||R("booking.searchBar.searchInput.placeholder"),autoComplete:"off",name:"search-results",actionIcon:l.createElement(K,{color:b.r.colors.gray300,className:""!==k?"shown":""}),onActionClick:function(){a({type:o.ClearInputSearch}),n.cancel(),n("",t),d()},value:k,onChange:j,onFocus:()=>a({type:o.FocusInputSearch}),inputClassName:"search"===C?"focused":void 0,size:"md",trackingAttributes:m,onKeyPress:e=>{t.autoCompleteDisabled&&"Enter"===e.key&&y&&y({cityId:t.selectedLocation.id,keyword:k})},enterKeyHint:t.autoCompleteDisabled?"search":void 0}),!e&&h()),t.autoCompleteDisabled&&!t.isMobile&&l.createElement(SearchButton,{onClick:()=>{y({cityId:t.selectedLocation.id,keyword:k})}}))}let DoctorIcon=()=>l.createElement("svg",{width:"14",height:"18",viewBox:"0 0 14 18"},l.createElement("path",{d:"M7 .667c-1.702 0-3.36.146-4.48.365a1.67 1.67 0 0 0-1.353 1.64v2.162c0 .459.374.833.833.833h10a.835.835 0 0 0 .833-.833V2.698c0-.804-.566-1.487-1.354-1.64C10.356.84 8.693.667 7 .667m-.833.833h1.666v.834h.834V4h-.834v.834H6.167V4h-.834V2.334h.834zm-4.74 5a8 8 0 0 0-.234 1.276c-.046.404-.137 1.478-.13 1.589a1.94 1.94 0 0 0-.73 1.536c0 .935.645 1.735 1.51 1.928.902 2.19 2.71 4.505 5.157 4.505s4.255-2.338 5.156-4.532a1.935 1.935 0 0 0 1.51-1.9 1.94 1.94 0 0 0-.729-1.537c.007-.11-.08-1.205-.13-1.615a8.4 8.4 0 0 0-.234-1.25H5.359c1.169 1.706 3.916.687 5.678 1.12.537 1.172.13 2.813.13 2.813l.65.208c.095.03.183.114.183.26 0 .157-.114.293-.312.287l-.678-.104-.234.65C9.966 14.05 8.413 15.668 7 15.668s-2.965-1.618-3.776-3.932l-.26-.651-.704.104c-.143 0-.26-.13-.26-.287a.26.26 0 0 1 .182-.26l.651-.208c-.1.12-.423-1.729 0-2.396.759-.524 1.394-.16 2.292-1.537zm3.75 2.552c-.605 0-1.094.502-1.094 1.12s.489 1.12 1.094 1.12 1.094-.501 1.094-1.12c0-.618-.488-1.12-1.094-1.12m3.646 0c-.606 0-1.094.502-1.094 1.12s.488 1.12 1.094 1.12c.605 0 1.094-.501 1.094-1.12 0-.618-.489-1.12-1.094-1.12",fill:"#9AA2AC"})),ServiceIcon=()=>l.createElement("svg",{width:"18",height:"18",viewBox:"0 0 18 18"},l.createElement("path",{d:"M9 .667A8.33 8.33 0 0 0 2.333 4H4.6A6.7 6.7 0 0 1 9 2.334c1.637 0 3.2.612 4.401 1.666h2.266A8.33 8.33 0 0 0 9 .667M1.786 4.834c-.71 2.207-1.12 4.765-1.12 7.5 0 1.751.16 3.434.47 5h15.729c.309-1.566.468-3.249.468-5 0-2.735-.41-5.293-1.12-7.5zM9 7.334a4.166 4.166 0 1 1 0 8.332 4.166 4.166 0 0 1 0-8.332M8.167 9v1.667H6.5v1.667h1.667V14h1.666v-1.666H11.5v-1.667H9.833V9z",fill:"#9AA2AC"})),HospitalIcon=()=>l.createElement("svg",{width:"16",height:"17",viewBox:"0 0 16 17"},l.createElement("path",{d:"M8 .667.5 5.635v9.199c0 .92.746 1.666 1.667 1.666h11.666c.921 0 1.667-.745 1.667-1.666V5.635zm3.333 10h-2.5v2.5H7.167v-2.5h-2.5V9h2.5V6.5h1.666V9h2.5z",fill:"#9AA2AC"})),SpecialtyIcon=()=>l.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16"},l.createElement("path",{d:"M3.833.5a3.333 3.333 0 1 0 0 6.667 3.333 3.333 0 0 0 0-6.667M10.5.5c-.92 0-1.667.746-1.667 1.667V5.5c0 .92.746 1.667 1.667 1.667h3.333c.921 0 1.667-.746 1.667-1.667V2.167C15.5 1.246 14.754.5 13.833.5zM3.833 8.833a3.333 3.333 0 1 0 0 6.667 3.333 3.333 0 0 0 0-6.667m8.334 0a3.333 3.333 0 1 0 0 6.667 3.333 3.333 0 0 0 0-6.667",fill:"#9AA2AC"})),H=h.Z.header` display: flex; justify-content: space-between; padding: 12px 24px; background-color: ${b.r.colors.neutral50}; box-shadow: inset 0px 1px 0px #e4e8ec; `,G=h.Z.div` display: grid; flex: 2; align-items: center; gap: 16px; grid-template-columns: 16px 1fr; `,q=h.Z.p` color: ${b.r.colors.neutral800}; font-size: 14px; font-weight: ${b.r.sizes.fwSemiBold}; letter-spacing: -0.2px; line-height: 22px; `,Y=h.Z.button` flex: 1; cursor: pointer; text-align: end; `,U=h.Z.section` padding: 12px 16px; --rowGap: 16px; --graphicSize: 32px; ${E.M.tdUp} { --rowGap: 8px; } `,Q=h.Z.ul` --gap: 16px; ${E.M.tdUp} { --gap: 8px; } display: grid; overflow: hidden; gap: var(--gap); transition: max-height 0.8s ease-out; ${({isMore:e})=>e&&` height: auto; max-height: 0; margin-top: var(--gap); `} ${({isShown:e})=>e&&` max-height: 600px; `} @media (prefers-reduced-motion) { transition: none; } ${E.M.tdUp} { grid-template-columns: 1fr 1fr; } `,W=(0,h.Z)(m.T)` margin-top: 12px; margin-bottom: 8px; cursor: pointer; text-align: start; text-transform: capitalize; `,X=h.Z.li` display: flex; align-items: center; gap: var(--rowGap); cursor: pointer; &.not-nav { cursor: default; } `,J=h.Z.div` --wrapper-size: var(--graphicSize); border-radius: calc(var(--wrapper-size) / 2); background-color: var(--neutral50); width: var(--wrapper-size); height: var(--wrapper-size); aspect-ratio: 1/1; overflow: hidden; ${({type:e})=>e&&"doctors"===e&&` border-radius: calc(var(--graphicSize) / 2); `} img { width: var(--graphicSize); height: var(--graphicSize); ${({type:e})=>e&&"doctors"===e?` object-fit: cover; `:` object-fit: contain; `} } &:focus-visible { outline: 1px solid ${b.r.colors.gray600}; } `,ee=(0,h.Z)(m.T)` line-height: 22px; letter-spacing: -0.2px; ${E.M.tdUp} { &[data-size='p3'] { font-size: 14px; } } `,et=h.Z.figure` max-width: var(--graphicSize); min-width: var(--graphicSize); `,ea=h.Z.svg` margin: 0 auto; display: block; `,ei=h.Z.div` display: grid; place-items: center; `,eo={doctors:r.f,services:r.g},ResultSectionItem=({type:e,item:t,imageUrl:a,className:i,onClickItem:o})=>{let n=(0,l.useMemo)(()=>{let t=eo[e]||r.D;return l.createElement(t,{width:32,height:"services"===e?32:24})},[e]);return l.createElement(X,{onClick:()=>o&&o(t),onKeyDown:e=>{("Enter"===e.key||"Space"===e.key)&&o&&o(t)},tabIndex:0,role:"button",className:i},l.createElement(et,null,"hospitals"===e?l.createElement(ea,{width:"12",height:"16",viewBox:"0 0 12 16"},l.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.75 5.94873C0.75 3.04623 3.0975 0.69873 6 0.69873C8.9025 0.69873 11.25 3.04623 11.25 5.94873C11.25 9.07623 7.935 13.3887 6.5775 15.0312C6.2775 15.3912 5.73 15.3912 5.43 15.0312C4.065 13.3887 0.75 9.07623 0.75 5.94873ZM4.125 5.94873C4.125 6.98373 4.965 7.82373 6 7.82373C7.035 7.82373 7.875 6.98373 7.875 5.94873C7.875 4.91373 7.035 4.07373 6 4.07373C4.965 4.07373 4.125 4.91373 4.125 5.94873Z",fill:"#9AA2AC"})):l.createElement(J,{type:e},a?l.createElement("img",{src:a,width:32,height:"services"===e?32:24,loading:"lazy"}):n)),l.createElement(ee,{color:b.r.colors.gray800,size:"p3"},t.name))},ResultSection=({type:e,data:t,state:a,dispatch:i,itemsToShow:n,itemsToShowDesktop:s,isMobile:r,isLoading:d,keyword:u,isNavResultItem:h})=>{let[g,y]=(0,l.useState)(!1),{t:f,locale:v}=(0,c.u)(),{selectedLocation:E,searchKeywords:C}=a,x=(0,l.useMemo)(()=>p.L[v],[v]),w="ms-MY"===v,L=(0,l.useMemo)(()=>({doctors:{name:f("booking.searchPopup.doctors"),icon:l.createElement(DoctorIcon,null),slug:x.DOCTOR},services:{name:f("booking.searchPopup.services"),icon:l.createElement(ServiceIcon,null),slug:x.SERVICE},hospitals:{name:f("booking.searchPopup.hospitals"),icon:l.createElement(HospitalIcon,null),slug:x.HOSPITAL},specialties:{name:f("booking.searchPopup.specialties"),icon:l.createElement(SpecialtyIcon,null),slug:x.SPECIALTIES}}),[e,x]),k=(0,l.useMemo)(()=>L[e].slug,[L]),I=r?n:s;function onClickItem(t){let a="";switch(e){case"specialties":a=`/${E.slug}/${L.doctors.slug}/${t.slug}`;break;case"services":a=`/${E.slug}/${k}/${t.slug}`;break;case"doctors":case"hospitals":a=`/${k}/${t.slug}-${t.id}`}a&&i({type:o.SelectSearchResult,payload:{name:t.name,url:a}})}function renderItem(t){return l.createElement(ResultSectionItem,{key:t.id,item:t,type:e,imageUrl:t.logo||t.avatar||t.thumbnail,className:h?"":"not-nav",onClickItem:h&&onClickItem})}return l.createElement("section",null,l.createElement(H,null,l.createElement(G,null,L[e].icon,l.createElement(q,null,L[e].name)),(u.trim().length<=$[v]||w)&&l.createElement(Y,{onClick:function(){let t="";switch(e){case"specialties":t=`/${k}`;break;case"services":case"doctors":case"hospitals":t=`/${E.slug}/${k}`}t&&i({type:o.NavigateTo,payload:t})}},l.createElement(m.T,{size:"p3",color:b.r.colors.primaryBase},f("booking.searchPopup.seeAll")))),(d||t&&t.length>0)&&l.createElement(U,null,l.createElement(Q,null,d&&[,,].fill(void 0).map((t,a)=>l.createElement(X,{key:e+"loading"+a},l.createElement(et,null,l.createElement(ei,null,l.createElement(S.Z,{height:14,width:"hospitals"===e?12:32,style:{maxWidth:"var(--graphicSize)",minHeight:"var(--graphicSize)"}}))),l.createElement(S.Z,{width:120,height:24}))),!d&&t&&t.length>0&&t.slice(0,I).map(renderItem)),l.createElement(Q,{isShown:g,isMore:!0},t.slice(I,-1).map(renderItem)),"specialties"===e&&Iy(!g)},l.createElement(W,{size:"p3",color:b.r.colors.primaryBase},g?f("booking.searchPopup.seeLessSpecialties"):f("booking.searchPopup.seeMoreSpecialties"))),"specialties"!==e&&(I$[v]&&l.createElement("button",{onClick:function(){let{slug:t}=L[e],a=`/${E.slug}/${t}?q=${C}`;i({type:o.NavigateTo,payload:a})}},l.createElement(W,{size:"p3",color:b.r.colors.primaryBase},f(`booking.searchPopup.searchIn.${e}`,{name:u})))),!d&&(null==t?void 0:t.length)===0&&l.createElement(U,null,l.createElement(m.T,{size:"sm",color:b.r.colors.gray400},f("booking.searchBar.noResults"))))},en=h.Z.section` background-color: white; border-radius: 4px; position: absolute; width: 100%; z-index: 30; ${E.M.tdUp} { box-shadow: 0px 24px 32px rgba(0, 0, 0, 0.04), 0px 16px 24px rgba(0, 0, 0, 0.04), 0px 4px 8px rgba(0, 0, 0, 0.04), 0px 0px 1px rgba(0, 0, 0, 0.04); } `,SearchResults=({data:e,state:t,dispatch:a,isMobile:i,isLoading:o,keyword:n,hideResults:s,isNavResultItem:r})=>l.createElement(en,null,e&&e.map(e=>s&&s.includes(e.type)?l.createElement(l.Fragment,null):l.createElement(ResultSection,{type:e.type,state:t,dispatch:a,itemsToShow:2,itemsToShowDesktop:4,key:e.type,data:e.results,isMobile:i,isLoading:o,keyword:n,isNavResultItem:r}))),BookingSearchBar=({isMobile:e,careApiDomain:t,geoLocationPermission:a,geoLocationCoordinates:i,initialSelectedCity:d,initialSearchValue:h="",careFrontDomain:g="/care",isDebug:m=!1,askForGeolocationPermission:b=!1,gaTrackingSearchBar:y,gaTrackingLocationSearch:f,autoCompleteDisabled:v=!1,inputSearchPlaceholder:E="",isOptionAllLocation:S=!1,hideResults:I=[],isNavResultItem:O=!0,routerPush:R,onGeoLocationPermissionChange:T,onSearch:j,onChangeLocation:M})=>{let{t:A,locale:P}=(0,c.u)(),F=(0,l.useRef)(null),N=(0,l.useRef)(null),[D,B]=(0,l.useState)(void 0),[z,K]=(0,l.useState)(!1),{geoLocationPermission:Z,geoLocationCoordinates:V,requestGeoLocation:H}=(0,r.u)(),[G,q]=(0,l.useReducer)(reducer,_,t=>Object.assign(Object.assign({},t),{isDebug:m,isMobile:e,geoLocationPermission:a||Z||"unset",geoLocationCoordinates:i||V||null,searchKeywords:h,initialSelectedCity:d||null,selectedLocation:d||t.selectedLocation||null,searchLocationKeywords:(null==d?void 0:d.name)||t.searchLocationKeywords,autoCompleteDisabled:v,inputSearchPlaceholder:E,locale:P})),{navigateTo:Y,focused:U,isLoadingCities:Q,cities:W,searchKeywords:X,geoLocationPermission:J,selectedLocation:ee,initialSelectedCity:et,defaultCity:ea,searchResults:ei,isLoadingSearchResults:eo,isMobileModalOpened:en,inputSearchPlaceholder:el}=G,{fetchCitiesByLocation:es,fetchCitiesByKeyword:er,fetchSearchResults:ec}=function({dispatch:e,careApiDomain:t,locale:a="vi-VN"}){let i=(0,l.useCallback)(function(i,n={}){let l=`${t}${i}`;return e({type:o.FetchCitiesStart}),fetch((0,r.h)(l,n,a),{method:"GET"}).then(e=>e.json()).then(e=>1===e._status&&e._data?null==e?void 0:e._data:(console.log("error loading cities",e),Promise.reject(e))).finally(()=>e({type:o.FetchCitiesFinish}))},[a]),n=(0,l.useCallback)(function({coordinates:t}){let n={},l={};t&&(n={lat:t.lat,lng:t.lng}),"ms-MY"===a&&(l.noPaging=1);let s=[i(C.P.GET_CITY_BY_IP,Object.assign(Object.assign({},n),l))];return"zh-TW"===a&&s.push(i(C.P.GET_CITIES_LIST,{noPaging:1})),Promise.all(s).then(([t,a])=>{let i=Object.assign({},t);if(a){let e=i.cities.map(e=>e.id);i.cities=i.cities.concat(a.cities.filter(t=>!e.includes(t.id)))}e({type:o.FetchCitiesByGeoIpComplete,payload:i})}).catch(e=>console.error("error loading cities by location",e))},[a,t,e]),s=(0,l.useCallback)(function(t){return i(C.P.GET_CITIES_LIST,{keyword:t}).then(t=>{e({type:o.FetchCitiesByKeywordComplete,payload:t.cities})}).catch(e=>console.error("error loading cities by keyword",e))},[a,t,e]),c=(0,l.useCallback)(function(i,n){let l=`${t}${C.P.GET_SEARCH_V2}`;e({type:o.FetchSearchResultsStart});let{defaultCity:s,selectedLocation:c,geoLocationCoordinates:d}=n,u="";if(!c||!s){e({type:o.FetchSearchResultsFinish});return}let h=c.id===p.a;h?d||(u=s.id):u=c.id===p.I?"":c.id;let g=(null==d?void 0:d.lat)||"",m=(null==d?void 0:d.lng)||"";return fetch((0,r.h)(l,{domain:t,searchType:"global",keyword:i.trim().length>$[a]?i.trim():"",city:u===p.a?"":u,lat:g,lng:m},a),{method:"GET",headers:{accept:"version=2.0.0.0"}}).then(e=>e.json()).then(e=>1===e._status&&e._data?null==e?void 0:e._data:Promise.reject(e)).then(t=>e({type:o.FetchSearchResultsComplete,payload:t})).catch(e=>{console.log("error loading search results",{url:l,error:e})}).finally(()=>e({type:o.FetchSearchResultsFinish}))},[a,t,e]);return{fetchCitiesByLocation:n,fetchCitiesByKeyword:s,fetchSearchResults:c}}({dispatch:q,locale:P,careApiDomain:t}),ed=(0,l.useMemo)(()=>{var e;return{id:p.a,name:A("booking.searchBar.currentLocation"),slug:null===(e=p.L[P])||void 0===e?void 0:e.CURRENT}},[A,P]),eu=(0,l.useMemo)(()=>u()(er,400),[er]),ep=(0,l.useMemo)(()=>u()(ec,400),[ec]);(0,l.useEffect)(()=>{""!==h&&h!==G.searchKeywords&&q({type:o.UpdateInitialSearchValue,payload:h})},[h]),(0,l.useEffect)(()=>{b&&(null==ee?void 0:ee.id)===p.a&&"unset"===J&&H()},[b,ee,J]),(0,l.useEffect)(()=>{a||J===Z||("granted"===Z&&V?q({type:o.GrantGeoLocationPermission,payload:V}):"denied"===Z&&q({type:o.DenyGeoLocationPermission}))},[J,Z,V,a]),(0,l.useEffect)(()=>{Y&&(R?R(Y):window.location.href=`${g}${Y}`)},[Y]);let eh=(0,l.useCallback)(function(){q({type:o.SelectCurrentLocation,payload:ed})},[A,q]);(0,l.useEffect)(()=>{var t;"denied"===J||et||q({type:o.SelectLocation,payload:{name:A("booking.searchBar.allLocations"),id:p.I,slug:null===(t=p.L[P])||void 0===t?void 0:t.ALL}}),T&&T(J,G.geoLocationCoordinates),e&&"granted"===J&&ee&&q({type:o.FocusInputSearch}),es({coordinates:G.geoLocationCoordinates})},[J]),(0,l.useEffect)(()=>{ee&&ea&&ec(G.searchKeywords,G)},[ee,ea]),(0,l.useEffect)(()=>{E!==el&&q({type:o.SetInputSearchPlaceholder,payload:E})},[E,el]),(0,l.useEffect)(()=>{en?document.body.classList.add("care-popup-open"):document.body.classList.remove("care-popup-open")},[en]);let eg=(0,l.useCallback)(function(e){"ms-MY"===P&&K(!0),q({type:o.SelectLocation,payload:e}),"ms-MY"!==P&&focusSearchInput(),M&&M(e)},[A,q]);function handleCurrentLocationClick(){"ms-MY"===P&&K(!0),e&&"granted"!==G.geoLocationPermission?H():(eh(),"ms-MY"!==P&&focusSearchInput())}function focusLocationInput(){var e;F.current&&(null===(e=F.current.querySelector('input[name="search-location"]'))||void 0===e||e.focus())}function focusSearchInput(){var e;F.current&&(null===(e=F.current.querySelector('input[name="search-results"]'))||void 0===e||e.focus())}function handleMobileTopBarClose(){q({type:o.CloseMobileModal})}function renderLocationResults(){return"location"!==U?null:l.createElement(LocationResults,{isLoading:Q,cities:W,onLocationClick:eg,onCurrentLocationClick:handleCurrentLocationClick,isLocationLoading:Q,geoLocationPermission:J,selectedLocation:ee,isOptionAllLocation:S})}function renderSearchResults(){return"search"!==U?null:G.autoCompleteDisabled?e?l.createElement(SearchButton,{onClick:()=>{j({cityId:G.selectedLocation.id,keyword:X}),handleMobileTopBarClose()}}):null:l.createElement(SearchResults,{data:ei,state:G,dispatch:q,isMobile:!1,keyword:X,isLoading:eo,hideResults:I,isNavResultItem:O})}function renderSearchInputs(){return l.createElement(SearchInputs,{isMobile:e,state:G,dispatch:q,debouncedFetchCitiesByKeyword:eu,debouncedFetchSearchResults:ep,focusLocationInput:focusLocationInput,focusSearchInput:focusSearchInput,renderLocationResults:renderLocationResults,renderSearchResults:renderSearchResults,trackingAttributes:y,locationTrackingAttributes:f,onSearch:j,initalSearchValue:h})}return((0,l.useEffect)(()=>{if(window.visualViewport){let resizeHandler=e=>{let t=e.target;B(null==t?void 0:t.height)};return window.visualViewport.addEventListener("resize",resizeHandler,{passive:!0}),()=>{window.visualViewport.removeEventListener("resize",resizeHandler)}}},[B]),(0,l.useEffect)(()=>{if(ee&&z&&"ms-MY"===P){let e=`/${ee.slug}/hospital`;q({type:o.NavigateTo,payload:e}),K(!1)}},[z,P,ee]),e)?l.createElement(l.Fragment,null,l.createElement(s.xB,{styles:s.iv` .care-popup-open { overflow: hidden; position: fixed; &::before { content: ''; inset: 0; position: absolute; background-color: white; min-height: 100vh; min-width: 100vw; z-index: 2; } } `}),l.createElement(k,{ref:N}),l.createElement(w,{id:"booking-search-bar",ref:F,"data-is-modal":e&&en,style:{"--mobile-care-searchbar-height":en&&D?`${D}px`:"100%"}},en?l.createElement(l.Fragment,null,l.createElement(L,null,l.createElement(MobileTopBar,{headingText:A("booking.searchBar.searchButton"),onLeftClick:handleMobileTopBarClose}),renderSearchInputs()),renderLocationResults(),renderSearchResults()):l.createElement(MobileFakeInput,{onClick:function(){var e;return(0,n.a)(this,void 0,void 0,function*(){N.current&&N.current.focus(),q({type:o.OpenMobileModal}),yield Promise.resolve(),F.current&&(null===(e=F.current.querySelector('input[name="search-location"]'))||void 0===e||e.focus())})},focused:U,value:X,trackingAttributes:y,inputSearchPlaceholder:E}))):l.createElement(x,{id:"booking-search-bar",ref:F},renderSearchInputs())}},UMsb:function(e,t,a){a.d(t,{u:function(){return BookingSearchBarV2}});var i,o,n,l,s=a("q1tI"),r=a("VZtU"),c=a("0D4Z"),d=a("iuhU"),u=a("TIp3"),p=a("CmzK"),h=a("mYVa"),g=a("8vDj"),m=a("aDCK"),b=a("OAL+"),y=a("SPK5"),f=a("Eso5"),v=a("NEaA"),E=a("rlLN"),S=a("Iblh"),C=a("Dh7N"),x=a("+Q0Z"),w=a("thIk"),L=a("sEfC"),k=a.n(L),I=a("DXMQ"),O=a("rBCA"),R=a("iBNF"),T=a("oKqh"),j=a("BdHP"),M=a("F/Hd"),A=a("5/p/"),P=a("fbRC"),F=a("D6YN"),$=a("h3Tz"),_=a("Hcbr"),N=a("G5av");a("gY0P");let D=O.Z.div``,B=O.Z.div` background-color: ${R.r.colors.neutral50}; padding-bottom: 1px; ${T.M.mbDown} { padding: 0 16px 10px; } `,z=(0,O.Z)(j.C)` padding: 0 16px; ${T.M.mbDown} { padding: 0; } `,K=O.Z.div` padding: 24px 56px; border-radius: 16px; background-color: ${R.r.colors.white}; box-shadow: 0px 0px 1px 0px rgba(0, 0, 0, 0.04), 0px 0px 2px 0px rgba(0, 0, 0, 0.06), 0px 4px 8px 0px rgba(0, 0, 0, 0.04); ${T.M.mbDown} { padding: 16px 16px; border-radius: 0px 0px 12px 12px; } .flex-search-input { flex-direction: row; ${T.M.mbDown} { flex-direction: column; } } `,Z={"en-PH":3,"tl-PH":2,"id-ID":3,"vi-VN":2,"zh-TW":0,"ms-MY":2,"th-TH":2},V={isMobile:!1,isDebug:!1,navigateTo:null,geoLocationPermission:"unset",geoLocationCoordinates:null,focused:"none",focusedSpecialty:"none",searchLocationKeywords:"",searchSpecialtyKeywords:"",searchKeywords:"",selectedLocation:null,selectedSpecialty:null,defaultCity:null,initialCities:[],cities:[],searchResults:{},initialSearchResults:{},isLoadingCities:!1,isLoadingSearchResults:!1,isMobileModalOpened:!1,initialSelectedCity:null,autoCompleteDisabled:!1,inputSearchPlaceholder:"",locale:"vi-VN",allSpecialties:[],popularKeys:[]};function resetSearchLocationKeywords(e){let{selectedLocation:t,searchLocationKeywords:a}=e;return t&&a!==t.name?Object.assign(Object.assign({},e),{searchLocationKeywords:t.name}):e}function reducer(e,t){var a,i;switch(e.isDebug&&console.log("bookingSearchBar",{action:t,state:e}),t.type){case n.NavigateTo:return Object.assign(Object.assign({},e),{navigateTo:t.payload,focused:"none",isMobileModalOpened:!1});case n.ClickOutsideInputLocation:if("location"!==e.focused)return e;return resetSearchLocationKeywords(Object.assign(Object.assign({},e),{focused:"none"}));case n.ClickOutsideInputSpecialty:if("specialty"!==e.focused)return e;return resetSearchLocationKeywords(Object.assign(Object.assign({},e),{focused:"none"}));case n.ClickOutsideInputSearch:if("search"!==e.focused)return e;return Object.assign(Object.assign({},e),{focused:"none"});case n.ClickOutsideInputSearchSpecialty:if("search"!==e.focusedSpecialty)return e;return Object.assign(Object.assign({},e),{focusedSpecialty:"none"});case n.FocusInputLocation:{let t=Object.assign(Object.assign({},e),{focused:"location"});return(null===(a=e.selectedLocation)||void 0===a?void 0:a.id)===I.a&&(t.searchLocationKeywords=""),t}case n.FocusInputSpecialty:{let t=Object.assign(Object.assign({},e),{focused:"specialty"});return(null===(i=e.selectedLocation)||void 0===i?void 0:i.id)===I.a&&(t.searchLocationKeywords=""),t}case n.FocusInputSearch:let o=Object.assign(Object.assign({},e),{focused:"search"});if(e.isMobile)return resetSearchLocationKeywords(o);return o;case n.FocusInputSearchSpecialty:{let t=Object.assign(Object.assign({},e),{focusedSpecialty:"search"});return t}case n.ChangeInputLocation:return Object.assign(Object.assign({},e),{searchLocationKeywords:t.payload});case n.ChangeInputSearch:{let a=t.payload;return Object.assign(Object.assign({},e),{searchKeywords:a,isLoadingSearchResults:a.trim().length>Z[e.locale]})}case n.SelectCurrentLocation:return Object.assign(Object.assign({},e),{focused:"none",selectedLocation:t.payload,searchLocationKeywords:t.payload.name});case n.ClearInputLocation:return Object.assign(Object.assign({},e),{focused:"location",cities:e.initialCities,searchLocationKeywords:""});case n.ClearInputSearch:return Object.assign(Object.assign({},e),{focused:"search",searchKeywords:""});case n.SelectLocation:return Object.assign(Object.assign({},e),{focused:"none",selectedLocation:t.payload,searchLocationKeywords:t.payload.name,searchResults:{}});case n.SelectSpecialty:return Object.assign(Object.assign({},e),{focused:"none",selectedSpecialty:t.payload,searchResults:{}});case n.SelectSearchResult:return Object.assign(Object.assign({},e),{searchKeywords:t.payload.name,isMobileModalOpened:!1,focused:"none",navigateTo:t.payload.url});case n.FetchCitiesStart:return Object.assign(Object.assign({},e),{isLoadingCities:!0});case n.FetchCitiesFinish:return Object.assign(Object.assign({},e),{isLoadingCities:!1});case n.FetchSearchResultsStart:return Object.assign(Object.assign({},e),{isLoadingSearchResults:!0});case n.FetchSearchResultsFinish:return Object.assign(Object.assign({},e),{isLoadingSearchResults:!1});case n.FetchSearchResultsComplete:{let a=Object.assign(Object.assign({},e),{searchResults:Object.assign(Object.assign({},e.searchResults),{[t.payload.key]:t.payload.searches})});return a}case n.FetchCitiesByGeoIpComplete:{let{cities:a}=t.payload,{default:i}=t.payload;a=a.filter(e=>e.id!==i.id),i&&a.unshift(i),e.initialSelectedCity&&!a.find(t=>t.id===e.initialSelectedCity.id)&&a.unshift(e.initialSelectedCity);let o=Object.assign(Object.assign({},e),{defaultCity:i,initialCities:a,cities:a});return"denied"!==e.geoLocationPermission||e.initialSelectedCity||(o.selectedLocation=i,o.searchLocationKeywords=i.name),o}case n.FetchCitiesByDefaultComplete:return Object.assign(Object.assign({},e),{defaultCity:null,initialCities:t.payload,cities:t.payload});case n.FetchCitiesByKeywordComplete:return Object.assign(Object.assign({},e),{cities:t.payload});case n.DisplayInitialCities:return Object.assign(Object.assign({},e),{cities:e.initialCities});case n.DisplayInitialSearchResults:{let t=e.searchKeywords.trim(),a=Z[e.locale],i=t.length>0&&t.length<=a;return Object.assign(Object.assign({},e),{searchResults:i?{}:e.initialSearchResults,isLoadingSearchResults:!1})}case n.UpdateInitialSearchResults:return Object.assign(Object.assign({},e),{initialSearchResults:Object.assign(Object.assign({},e.initialSearchResults),{[t.payload.key]:t.payload.searches})});case n.GrantGeoLocationPermission:return Object.assign(Object.assign({},e),{geoLocationPermission:"granted",geoLocationCoordinates:t.payload});case n.DenyGeoLocationPermission:return Object.assign(Object.assign({},e),{geoLocationPermission:"denied",geoLocationCoordinates:null});case n.OpenMobileModal:return Object.assign(Object.assign({},e),{isMobileModalOpened:!0});case n.CloseMobileModal:return Object.assign(Object.assign({},e),{isMobileModalOpened:!1});case n.UpdateInitialSearchValue:return Object.assign(Object.assign({},e),{searchKeywords:t.payload});case n.SetInputSearchPlaceholder:return Object.assign(Object.assign({},e),{inputSearchPlaceholder:t.payload});case n.FetchAllSpecialties:return Object.assign(Object.assign({},e),{allSpecialties:t.payload});case n.FetchPopularKeys:return Object.assign(Object.assign({},e),{popularKeys:t.payload});default:return e}}(i=n||(n={})).NavigateTo="navigate to url",i.ClickOutsideInputLocation="click outside input location",i.ClickOutsideInputSearch="click outside input search",i.ClickOutsideInputSearchSpecialty="click outside input search specialty",i.ClickOutsideInputSpecialty="click outside input specialty",i.SelectCurrentLocation="select current location",i.FocusInputLocation="focus input location",i.FocusInputSearch="focus input search",i.FocusInputSearchSpecialty="focus input search specialty",i.ChangeInputLocation="change input location",i.ChangeInputSearch="change input search",i.ClearInputLocation="clear input location",i.ClearInputSearch="clear input search",i.SelectLocation="select location",i.SelectSpecialty="select specialty",i.FetchCitiesStart="fetch cities start",i.FetchCitiesFinish="fetch cities finish",i.FetchSearchResultsStart="fetch search results start",i.FetchSearchResultsComplete="fetch search results complete",i.FetchSearchResultsFinish="fetch search results finish",i.FetchCitiesByGeoIpComplete="fetch cities by geo IP finish",i.FetchCitiesByDefaultComplete="fetch cities by default finish",i.FetchCitiesByKeywordComplete="fetch cities by keyword finish",i.DisplayInitialCities="display initial cities",i.DisplayInitialSearchResults="display initial search results",i.UpdateInitialSearchResults="update initial search results",i.GrantGeoLocationPermission="grant geolocation permission",i.DenyGeoLocationPermission="deny geolocation permission",i.OpenMobileModal="open mobile modal",i.CloseMobileModal="close mobile modal",i.UpdateInitialSearchValue="update initial search value",i.SelectSearchResult="select search result",i.SetInputSearchPlaceholder="set input search placeholder",i.FocusInputSpecialty="focus input specialty",i.FetchAllSpecialties="fetch all specialty",i.FetchPopularKeys="fetch popular key by type";let H=O.Z.div` flex: 1; position: relative; ${T.M.mbDown} { width: 100%; display: flex; flex-direction: column; gap: 12px; } `,G=O.Z.div` position: absolute; top: calc(100% + 2px); width: 100%; border-radius: 4px; background: ${R.r.colors.white}; box-shadow: 0px 8px 40px 0px rgba(0, 0, 0, 0.1); z-index: 10; ${T.M.mbDown} { width: calc(100% + 64px); left: -32px; } `,q=O.Z.div``;O.Z.div` display: flex; justify-content: space-between; align-item: center; padding: 9px 14px 9px 22px; background: #f7f9fc; .title { color: ${R.r.colors.gray800}; font-size: 14px; font-weight: 600; line-height: 22px; } .btn-see-all { color: ${R.r.colors.blue600}; font-size: 14px; line-height: 22px; cursor: pointer; } `;let Y=O.Z.div` padding: 10px 16px; max-height: 400px; overflow: auto; `,U=O.Z.div` display: flex; gap: 12px; align-items: center; cursor: pointer; ${T.M.mbUp} { &:hover { background-color: ${R.r.colors.blue50}; } } .image-item { flex: 0 0 48px; width: 48px; height: 48px; border-radius: 50%; img { object-fit: contain; width: 100%; height: 100%; border-radius: 50%; } } .infor { overflow: hidden; padding: 12px 0; flex: 1; border-bottom: 1px solid ${R.r.colors.neutral100}; .title { color: ${R.r.colors.gray800}; font-size: 16px; font-weight: 600; line-height: 24px; } .description { overflow: hidden; color: ${R.r.colors.gray600}; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; line-height: 18px; display: flex; gap: 8px; align-items: center; margin-top: 5px; svg { flex: 0 0 16px; } .sub-description { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; flex: 1; } } } &.last-item { .infor { border-bottom: none; } } `;O.Z.div` padding: 0 16px 16px; .search-detail-btn { color: ${R.r.colors.blue600}; font-size: 14px; line-height: 22px; cursor: pointer; } `;let SearchResult=({state:e,type:t,results:a,isLoading:i,typeInformation:o,dispatch:l})=>{let{t:r}=(0,w.u)(),{selectedLocation:u}=e,p=(0,s.useMemo)(()=>o[t].slug,[o,t]),handleOnClick=e=>{let a="";switch(t){case"service":a=`/${u.slug}/${p}/${e.slug}`;break;case"doctor":case"hospital":a=`/${p}/${e.slug}-${e.id}`}a&&l({type:n.NavigateTo,payload:a})};return null===a?null:s.createElement(q,null,s.createElement(Y,{className:"search-results__body"},i&&s.createElement("div",{className:"skeleton-result"},[,,,].fill(void 0).map((e,a)=>s.createElement(U,{key:t+"loading"+a,className:2===a?"last-item":""},s.createElement("div",{className:"image-item"},s.createElement(c.O,{height:48,circle:!0,mb:"xl",animate:!0})),s.createElement("div",{className:"infor"},s.createElement("div",{className:"title"},s.createElement(c.O,{height:8,mt:10,radius:"xl",animate:!0})),s.createElement("div",{className:"description"},s.createElement("div",{className:"sub-description"},s.createElement(c.O,{height:8,mt:10,radius:"xl",width:"80%",animate:!0}))))))),!i&&a&&a.length>0&&s.createElement(s.Fragment,null,a.map((e,i)=>{var n,l;let r=a.length>4&&3===i||a.length<=4&&i===a.length-1,c="";return("hospital"===t&&(c=(null==e?void 0:e.address)||""),"doctor"===t&&(c=(null===(n=null==e?void 0:e.specialties)||void 0===n?void 0:n.join(", "))||""),"service"===t&&(c=(null===(l=null==e?void 0:e.hospital_branch)||void 0===l?void 0:l.name)||""),i>=4)?s.createElement(s.Fragment,null):s.createElement(U,{key:e.id,className:(0,d.default)(r?"last-item":"","result-item"),onClick:()=>handleOnClick(e)},s.createElement("div",{className:"image-item"},s.createElement("img",{src:e.logo||e.avatar,alt:e.name})),s.createElement("div",{className:"infor"},s.createElement("div",{className:"title"},e.name),s.createElement("div",{className:"description"},o[t].icon,s.createElement("div",{className:"sub-description"},c))))})),!i&&(null==a?void 0:a.length)===0&&s.createElement(M.T,{size:"sm",color:R.r.colors.gray400,className:"noresult-block"},r("booking.searchBar.noResults"))))},SearchResultContent=({state:e,type:t,isLoading:a,clientSlug:i,typeInformation:o,dispatch:n})=>{var l;return"search"!==e.focused?null:s.createElement(SearchResult,{type:t,state:e,results:(null===(l=e.searchResults)||void 0===l?void 0:l[t])||null,location:e.selectedLocation.name,dispatch:n,isLoading:a,typeInformation:o,clientSlug:i})},Q=O.Z.div` position: relative; ${T.M.mbDown} { width: 100%; display: flex; flex-direction: column; gap: 12px; } `;O.Z.div` position: absolute; top: calc(100% + 2px); width: calc(100% + 100px); border-radius: 4px; background: ${R.r.colors.white}; box-shadow: 0px 8px 40px 0px rgba(0, 0, 0, 0.1); z-index: 10; max-height: 300px; overflow: auto; ${T.M.mbDown} { width: calc(100% + 64px); left: -32px; } `;let W=O.Z.li` position: relative; cursor: pointer; padding: 12px 18px; display: flex; align-items: center; gap: 14px; overflow: hidden; .image-item { display: flex; align-items: center; width: 40px; height: 40px; flex-shrink: 0; img { width: 100%; object-fit: cover; } svg { width: 40px; } } ${({isSelected:e})=>e&&` &::after { content: ${C.i}; top: 50%; right: 18px; position: absolute; transform: translateY(-50%); } `} & + li::before { content: ''; position: absolute; left: 18px; right: 18px; top: 0; height: 1px; background-color: ${R.r.colors.neutral100}; } &:not([data-is-denied='true']):hover { background-color: ${R.r.colors.neutral50}; } &:last-child:hover { border-bottom-right-radius: 6px; border-bottom-left-radius: 6px; } &:first-child:hover { border-top-right-radius: 6px; border-top-left-radius: 6px; } &[data-is-denied='true'] { cursor: not-allowed; } `,DoctorIcon=()=>s.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},s.createElement("path",{d:"M8.983 14.333q-1.666 0-2.833-1.166Q4.983 12 4.983 10.333v-.366a3.48 3.48 0 0 1-2.258-1.2 3.57 3.57 0 0 1-.909-2.434V3.1a.58.58 0 0 1 .175-.425.58.58 0 0 1 .425-.175h1.4v-.167a.486.486 0 0 1 .5-.5q.217 0 .36.142a.5.5 0 0 1 .14.358v1.334a.485.485 0 0 1-.5.5.484.484 0 0 1-.5-.5V3.5h-1v2.833q0 1.1.784 1.884Q4.383 9 5.483 9t1.883-.783.784-1.884V3.5h-1v.167a.485.485 0 0 1-.5.5.484.484 0 0 1-.5-.5V2.333a.486.486 0 0 1 .5-.5q.217 0 .358.142a.5.5 0 0 1 .142.358V2.5h1.4a.58.58 0 0 1 .425.175.58.58 0 0 1 .175.425v3.233q0 1.4-.908 2.434a3.5 3.5 0 0 1-2.259 1.2v.366q0 1.25.875 2.126a2.9 2.9 0 0 0 2.125.874q1.25 0 2.125-.874a2.9 2.9 0 0 0 .875-2.126V9.25a1.74 1.74 0 0 1-.858-.609 1.6 1.6 0 0 1-.342-1.008q0-.716.5-1.216t1.2-.5q.716 0 1.217.5.5.5.5 1.216 0 .567-.342 1.008t-.875.609v1.083q0 1.667-1.167 2.834-1.166 1.166-2.833 1.166m3.5-6q.3 0 .509-.208a.67.67 0 0 0 .208-.492q0-.3-.208-.508a.7.7 0 0 0-.509-.208q-.3 0-.5.208a.7.7 0 0 0-.2.508q0 .284.2.492t.5.208",fill:"#595959"})),ServiceIcon=()=>s.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},s.createElement("path",{d:"M6.868 9.265v.974q0 .405.284.69.284.283.69.283t.69-.284.284-.69v-.973h.973q.405 0 .69-.284a.94.94 0 0 0 .284-.689.94.94 0 0 0-.284-.69.94.94 0 0 0-.69-.284h-.973v-.974a.94.94 0 0 0-.284-.69.94.94 0 0 0-.69-.284.94.94 0 0 0-.689.284.94.94 0 0 0-.285.69v.974h-.973a.94.94 0 0 0-.69.283.94.94 0 0 0-.284.69q0 .405.284.69.285.284.69.284zm-3.46 4.868q-.581 0-.994-.413A1.36 1.36 0 0 1 2 12.725v-6.65a1.4 1.4 0 0 1 .563-1.127l4.434-3.333q.369-.282.844-.282.474 0 .846.282l4.434 3.333q.264.193.413.493.15.3.15.633v6.651q0 .58-.414.995a1.36 1.36 0 0 1-.994.413zm0-1.168h8.868q.105 0 .172-.068a.23.23 0 0 0 .068-.172v-6.65a.2.2 0 0 0-.027-.11.3.3 0 0 0-.07-.085L7.983 2.554a.2.2 0 0 0-.142-.052.2.2 0 0 0-.142.052L3.266 5.88a.3.3 0 0 0-.071.086.2.2 0 0 0-.027.108v6.651q0 .105.068.172a.23.23 0 0 0 .172.068",fill:"#595959"})),HospitalIcon=()=>s.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},s.createElement("path",{d:"M8 8q.55 0 .941-.392.393-.391.392-.941 0-.55-.392-.942A1.28 1.28 0 0 0 8 5.333q-.55 0-.942.392a1.28 1.28 0 0 0-.391.942q0 .55.391.941Q7.45 8 8 8m0 4.9q2.032-1.866 3.017-3.392Q12 7.983 12 6.8q0-1.817-1.158-2.975Q9.682 2.667 8 2.667T5.158 3.825Q4 4.983 4 6.8q0 1.184.983 2.708Q5.966 11.034 8 12.9m0 1.517a.8.8 0 0 1-.5-.183q-2.433-2.151-3.633-3.992T2.667 6.8q0-2.5 1.608-3.983Q5.883 1.332 8 1.333q2.116 0 3.725 1.484T13.333 6.8q0 1.6-1.2 3.442-1.2 1.841-3.633 3.991a.8.8 0 0 1-.5.184",fill:"#8C8C8C"})),SpecialtyIcon=()=>s.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16"},s.createElement("path",{d:"M3.833.5a3.333 3.333 0 1 0 0 6.667 3.333 3.333 0 0 0 0-6.667M10.5.5c-.92 0-1.667.746-1.667 1.667V5.5c0 .92.746 1.667 1.667 1.667h3.333c.921 0 1.667-.746 1.667-1.667V2.167C15.5 1.246 14.754.5 13.833.5zM3.833 8.833a3.333 3.333 0 1 0 0 6.667 3.333 3.333 0 0 0 0-6.667m8.334 0a3.333 3.333 0 1 0 0 6.667 3.333 3.333 0 0 0 0-6.667",fill:"#9AA2AC"})),X=(0,s.forwardRef)((e,t)=>{var{label:a,value:i,specialty:o}=e,n=(0,P._)(e,["label","value","specialty"]);return s.createElement("div",Object.assign({ref:t},n),s.createElement(W,{key:i,role:"button",tabIndex:0,"aria-label":`Select ${a} as location`},s.createElement("div",{className:"image-item"},o.thumbnail?s.createElement("img",{src:o.thumbnail,alt:a}):s.createElement(SpecialtyIcon,null)),s.createElement(u.x,{size:"md"},a)))}),SearchSpecialty=({state:e,onSpecialtyClick:t,dispatch:a})=>{let{t:i,locale:o}=(0,w.u)(),l=(0,s.useRef)(null),r=(0,s.useMemo)(()=>I.L[o],[o]);(0,x.a)(l,()=>{a({type:n.ClickOutsideInputSpecialty})});let c=[{name:i("booking.searchBar.allSpecialties"),id:-1,thumbnail:"",total_doctor:0,slug:r.SPECIALTIES},...e.allSpecialties],d=e.selectedSpecialty&&"number"==typeof e.selectedSpecialty.id?String(e.selectedSpecialty.id):null;return s.createElement(Q,{ref:l},s.createElement(p.Ph,{value:d,placeholder:i("booking.searchPopup.specialties"),searchable:!0,nothingFound:i("common.noResult"),maxDropdownHeight:340,dropdownPosition:"bottom",data:c.map(e=>({value:String(e.id),label:e.name,specialty:e})),rightSection:s.createElement(A.C,{style:{width:20,height:20}}),styles:e=>({dropdown:{left:"0 !important",border:0,marginTop:-7,borderRadius:0,"& [data-mantine-scrollbar]":{'&[data-orientation="vertical"]':{width:"6px"}},[e.fn.largerThan("sm")]:{minWidth:264,width:"264px !important"}},item:{padding:0,"&[data-selected]":{"&, &:hover":{backgroundColor:"transparent",color:"inherit"}},"&[data-hovered]":{backgroundColor:"transparent"}},input:{"&:not(.mantine-Textarea-input)":{height:40,fontSize:(0,h.h)(14),paddingLeft:14,paddingRight:14,[e.fn.largerThan("sm")]:{height:46,fontSize:(0,h.h)(16),paddingLeft:16,paddingRight:16,borderColor:"transparent"},"&:focus, &:focus-within":{outline:"none",boxShadow:"none"}}},itemsWrapper:{padding:0},wrapper:{[e.fn.largerThan("sm")]:{position:"relative","&:after":{content:'""',width:"1px",height:"20px",backgroundColor:"#E4E8EC",position:"absolute",right:0,top:"13px"}}}}),itemComponent:X,filter:(e,t)=>t.label.toLowerCase().includes(e.toLowerCase().trim()),onChange:e=>{if(null==e)return;let a=c.find(t=>String(t.id)===e);a&&t(Object.assign(Object.assign(Object.assign({},a),{thumbnail:a.thumbnail||""}),-1!==Number(e)&&{total_doctor:0}))}}))},J=(0,s.forwardRef)(({state:e,type:t,isMobile:a,isLoading:i,initalSearchValue:o,typeInformation:l,debouncedFetchSearchResults:c,trackingAttributes:d,hideSpecialtySelection:u=!1,clientSlug:p="",onSearch:b,onFocusInput:y,onEnterSearch:f,dispatch:v,onlyShowSearchBox:E,onChangeSpecialty:S},C)=>{let{t:L}=(0,w.u)(),k=(0,g.rZ)(),I=(0,s.useRef)(null),O=(0,s.useRef)(null);(0,s.useImperativeHandle)(C,()=>({focus:()=>{var e;null===(e=O.current)||void 0===e||e.focus()}}));let R=!E,T=(0,s.useMemo)(()=>d?{"data-event-category":d.dataEventCategory,"data-event-action":d.dataEventAction,"data-event-label":d.dataEventLabel}:{},[d]),j=(0,s.useMemo)(()=>"doctor"===t?L("booking.searchBar.placeholder.doctor"):"service"===t?L("booking.searchBar.placeholder.service"):"hospital"===t?L("booking.searchBar.placeholder.hospital"):"specialty"===t?L("booking.searchBar.placeholder.specialty"):"",[t,L]),M=(0,s.useMemo)(()=>({root:{flex:1,"&.hide-specialty-selection":{".mantine-Input-rightSection":{display:"none"},input:{paddingLeft:R?48:16,[k.fn.smallerThan("sm")]:{height:40,fontSize:(0,h.h)(14)}},".mantine-Input-icon":{left:"0"}}}}),[R,k]),A=(0,s.useMemo)(()=>({icon:{left:"205px"},input:{color:"#262626",'&[data-with-icon="true"]':{paddingLeft:"245px",paddingRight:"16px"}},rightSection:{left:0,width:"205px",padding:"1px"}}),[]),P=(0,s.useMemo)(()=>({input:{color:"#262626"}}),[]);(0,x.a)(I,()=>{a||v({type:n.ClickOutsideInputSearch})});let F=(0,s.useCallback)(function(a){v({type:n.ChangeInputSearch,payload:a}),"function"!=typeof b&&(a.trim().length>Z[e.locale]||o||0===a.trim().length)&&c(a.trim(),e,t,p)},[v,e,t,o,c,p,b]),$=(0,s.useCallback)(function(e){var t;v({type:n.SelectSpecialty,payload:e}),null==S||S(e),a||null===(t=O.current)||void 0===t||t.focus()},[v,S]),_=(0,s.useCallback)(e=>{"Enter"===e.key&&(e.stopPropagation(),e.preventDefault(),f&&f())},[f]);return s.createElement(H,{ref:I},"specialty"===t?s.createElement(m.I.Wrapper,{styles:M},s.createElement(m.I,{ref:O,icon:R&&s.createElement(r.Z,null),size:a?"md":"lg",placeholder:j,styles:P,value:e.searchKeywords,onFocus:()=>v({type:n.FocusInputSearchSpecialty}),onChange:e=>{F(e.target.value)},onKeyDown:_})):s.createElement(s.Fragment,null,"service"===t?s.createElement(m.I.Wrapper,{styles:M},s.createElement(m.I,{ref:O,icon:R&&s.createElement(r.Z,null),size:a?"md":"lg",name:"search-results",placeholder:j,onFocus:()=>{v({type:n.FocusInputSearch}),null==y||y()},value:e.searchKeywords,onChange:e=>{F(e.target.value)},onKeyDown:_})):s.createElement(s.Fragment,null,a&&!u?s.createElement(s.Fragment,null,!E&&s.createElement(SearchSpecialty,{state:e,isMobile:a,dispatch:v,debouncedFetchSearchResults:c,onSpecialtyClick:$}),s.createElement(m.I.Wrapper,{styles:M},s.createElement(m.I,{ref:O,icon:R&&s.createElement(r.Z,null),size:"md",placeholder:j,value:e.searchKeywords,name:"search-results",onFocus:()=>{v({type:n.FocusInputSearch}),null==y||y()},onChange:e=>{F(e.target.value)},onKeyDown:_}))):s.createElement(m.I.Wrapper,{styles:M,className:u?"hide-specialty-selection":""},s.createElement(m.I,Object.assign({ref:O,icon:R&&s.createElement(r.Z,null),size:"lg",placeholder:j,styles:A,name:"search-results",autoComplete:"off",value:e.searchKeywords,onChange:e=>{F(e.target.value)},onFocus:()=>{v({type:n.FocusInputSearch}),null==y||y()},onKeyDown:_},T,{rightSection:u?s.createElement(s.Fragment,null):!E&&s.createElement(SearchSpecialty,{state:e,isMobile:a,dispatch:v,debouncedFetchSearchResults:c,onSpecialtyClick:$})})))),!a&&s.createElement(G,null,s.createElement(SearchResultContent,{type:t,state:e,dispatch:v,isLoading:i,typeInformation:l,clientSlug:p}))))});J.displayName="SearchInputs";let ModalSearchResult=e=>{var{searchInputEle:t,closeModal:a,children:i}=e,o=(0,P._)(e,["searchInputEle","closeModal","children"]);let n=(0,g.rZ)();return s.createElement($.M,Object.assign({},o,{zIndex:310,fullScreen:!0,styles:{content:{borderRadius:0,height:"100%",".search-results__body":{padding:0},".result-item":{paddingLeft:16,paddingRight:16},".noresult-block":{padding:16},".skeleton-result":{padding:16}},header:{display:"none"}}}),s.createElement(b.K,{spacing:16,sx:{paddingTop:16}},s.createElement(y.k,{align:"center",gap:12},s.createElement(F.Z,{size:28,onClick:a,color:n.fn.primaryColor()}),s.createElement(f.x,{sx:{width:"100%"}},t)),i))},ee=O.Z.div` position: relative; ${T.M.mbDown} { width: 100%; display: flex; flex-direction: column; gap: 12px; } `;O.Z.div` position: absolute; top: calc(100% + 2px); width: 100%; border-radius: 4px; background: ${R.r.colors.white}; box-shadow: 0px 8px 40px 0px rgba(0, 0, 0, 0.1); z-index: 10; ${T.M.mbDown} { width: calc(100% + 64px); left: -32px; } `;let et=O.Z.div` position: relative; cursor: pointer; padding: 12px 18px; display: flex; align-items: center; gap: 14px; overflow: hidden; & + li::before { content: ''; position: absolute; left: 18px; right: 18px; top: 0; height: 1px; background-color: ${R.r.colors.neutral100}; } &:not([data-is-denied='true']):hover { background-color: ${R.r.colors.neutral50}; } &:last-child:hover { border-bottom-right-radius: 6px; border-bottom-left-radius: 6px; } &:first-child:hover { border-top-right-radius: 6px; border-top-left-radius: 6px; } &[data-is-denied='true'] { cursor: not-allowed; } `,ea=(0,O.Z)(C.P)` width: 12px; height: 18px; flex: 0 0 12px; `,ei=(0,s.forwardRef)((e,t)=>{var{label:a,value:i}=e,o=(0,P._)(e,["label","value"]);return s.createElement("div",Object.assign({ref:t},o),s.createElement(et,{key:i,role:"button",tabIndex:0,"aria-label":`Select ${a} as location`,className:"location-item"},s.createElement(ea,{color:R.r.colors.neutral400}),s.createElement(u.x,{size:"md"},a)))}),SearchLocation=({state:e,debouncedFetchCitiesByKeyword:t,selectedLocation:a,trackingAttributes:i,onLocationClick:o,dispatch:l})=>{var r;let{t:c,locale:d}=(0,w.u)(),u=(0,s.useRef)(null),g=(0,s.useMemo)(()=>{var t;return[{name:c("booking.searchBar.allLocations"),id:I.I,slug:null===(t=I.L[d])||void 0===t?void 0:t.ALL},...e.cities]},[e.cities,c,d]),m=(0,s.useMemo)(()=>i?{"data-event-category":i.dataEventCategory,"data-event-action":i.dataEventAction,"data-event-label":i.dataEventLabel}:{},[i]),b=(0,s.useCallback)(function(a){l({type:n.ChangeInputLocation,payload:a}),a.trim().length>Z[e.locale]?t(a.trim()):(t.cancel(),l({type:n.DisplayInitialCities}))},[t,l,e.locale]);(0,x.a)(u,()=>{l({type:n.ClickOutsideInputLocation})});let y=null!==(r=null==a?void 0:a.id)&&void 0!==r?r:null,f=null===y?void 0:String(y);return s.createElement(ee,{ref:u},s.createElement(p.Ph,Object.assign({key:null!=f?f:"no-selected-location",defaultValue:f,placeholder:c("booking.searchBar.allLocations"),searchable:!0,onSearchChange:e=>{b(e)},onFocus:()=>{l({type:n.DisplayInitialCities})},onDropdownClose:()=>{t.cancel(),l({type:n.DisplayInitialCities})},nothingFound:c("common.noResult"),maxDropdownHeight:340,dropdownPosition:"bottom",data:g.map(e=>({value:String(e.id),label:e.name,city:e})),rightSection:s.createElement(s.Fragment,null)},m,{styles:e=>({item:{padding:0,"&[data-selected]":{"&, &:hover":{backgroundColor:"transparent",color:"inherit"},".location-item":{"&::after":{content:C.i,top:"50%",right:19,position:"absolute",transform:"translateY(-50%)"}}},"&[data-hovered]":{backgroundColor:"transparent"}},input:{"&:not(.mantine-Textarea-input)":{height:48,fontSize:(0,h.h)(16),paddingLeft:16,paddingRight:16,[e.fn.smallerThan("sm")]:{height:40,fontSize:(0,h.h)(14),paddingLeft:14,paddingRight:14}}},itemsWrapper:{padding:0},dropdown:{left:"0 !important",border:0,marginTop:-7,borderRadius:0,"& ::-webkit-scrollbar":{width:"6px",height:"6px"}}}),itemComponent:ei,filter:()=>!0,onChange:e=>{if(null==e)return;let a=g.find(t=>String(t.id)===e);a&&(o(a),t.cancel(),l({type:n.DisplayInitialCities}),setTimeout(()=>{var e,t;null===(t=null===(e=u.current)||void 0===e?void 0:e.querySelector("input"))||void 0===t||t.blur()},0))}})))},eo=O.Z.div` display: flex; flex-wrap: wrap; row-gap: 8px; column-gap: 20px; ${T.M.mbDown} { margin-top: 12px; } `,en=O.Z.div` display: flex; align-items: center; border-radius: 8px; border: 1px solid ${R.r.colors.neutral100}; background: ${R.r.colors.white}; padding: 8px 12px 8px 8px; flex: 0 0 calc(33.3% - 13px); gap: 12px; cursor: pointer; &:hover { background: ${R.r.colors.blue50}; } ${T.M.tdDown} { flex: 0 0 calc(50% - 10px); } ${T.M.mbDown} { flex: 0 0 100%; border: none; } .image-item { display: flex; align-items: center; width: 40px; height: 40px; img { width: 100%; object-fit: cover; } } .infor { flex: 1; .title { color: ${R.r.colors.gray800}; font-size: 14px; font-style: normal; font-weight: 400; line-height: 22px; } .description { color: ${R.r.colors.gray600}; font-size: 12px; font-weight: 400; line-height: 18px; } } `,el=(0,O.Z)(v.i)` margin: 24px 0 !important; `,es=O.Z.div` display: flex; justify-content: center; margin-top: 24px; .show-more { border-radius: 4px; border: 1px solid ${R.r.colors.neutral200}; padding: 12px 16px; cursor: pointer; display: inline-block; color: ${R.r.colors.gray800}; font-size: 16px; font-weight: 600; line-height: 24px; ${T.M.mbDown} { width: 100%; text-align: center; } } `,SearchResultSpecialties=({state:e,isMobile:t,specialties:a,isLoading:i,dispatch:o})=>{let{t:l,locale:r}=(0,w.u)(),{selectedLocation:d}=e,u=(0,s.useMemo)(()=>I.L[r],[r]),handleOnClick=e=>{let t="";e===I.S?(t=`/${d.slug}/${u.HOSPITAL}/${I.C.GSK}/`,o({type:n.ClickOutsideInputSearchSpecialty})):t=`/${d.slug}/${u.DOCTOR}/${e}`,o({type:n.NavigateTo,payload:t})},p=(0,s.useMemo)(()=>a.length>=9||e.searchKeywords.trim().length<=Z[e.locale],[e.searchKeywords,a]);return s.createElement(s.Fragment,null,!t&&s.createElement(el,{color:"#E4E8EC"}),s.createElement(eo,null,a.length>0&&!i&&s.createElement(s.Fragment,null,a.map((e,t)=>t>=9?s.createElement(s.Fragment,null):s.createElement(en,{key:e.id,onClick:()=>handleOnClick(e.slug)},s.createElement("div",{className:"image-item"},s.createElement("img",{src:e.thumbnail,alt:e.name})),s.createElement("div",{className:"infor"},s.createElement("div",{className:"title"},e.name))))),0===a.length&&!i&&s.createElement(M.T,{size:"sm",color:R.r.colors.gray400},l("booking.searchBar.noResults")),i&&Array(6).fill(void 0).map((e,t)=>s.createElement(en,{key:"loading"+t},s.createElement("div",{className:"image-item"},s.createElement(c.O,{height:40,animate:!0})),s.createElement("div",{className:"infor"},s.createElement("div",{className:"title"},s.createElement(c.O,{height:20,radius:"sm",animate:!0})))))),p&&s.createElement(es,null,s.createElement("div",{className:"show-more",onClick:()=>{let e=`/${u.SPECIALTIES}`;o({type:n.NavigateTo,payload:e})}},l("home.seeAll"))))},er=O.Z.div` display: flex; gap: 5px; margin-top: 16px; flex-wrap: wrap; `,ec=O.Z.div` color: ${R.r.colors.gray600}; font-size: 14px; font-weight: 600; line-height: 22px; padding: 4px 12px; background: ${R.r.colors.white}; border-radius: 32px; cursor: pointer; border: 1px solid ${R.r.colors.white}; margin-bottom: 5px; border-color: ${R.r.colors.neutral100}; background: #f7f9fc; &.view-all { border-radius: 32px; border-color: ${R.r.colors.blue50}; background: ${R.r.colors.blue50}; color: ${R.r.colors.blue600}; &:hover { border-color: ${R.r.colors.blue50}; background: ${R.r.colors.blue50}; color: ${R.r.colors.blue600}; } } &:hover { border-color: ${R.r.colors.neutral100}; background: #f7f9fc; } `,ed=O.Z.div` color: ${R.r.colors.gray600}; font-size: 14px; font-weight: 600; line-height: 22px; padding: 4px 0; background: ${R.r.colors.white}; border-radius: 32px; border: 1px solid ${R.r.colors.white}; margin-bottom: 5px; margin-right: 7px; `,SearchTag=({state:e,type:t,typeInformation:a,dispatch:i})=>{let{t:o}=(0,w.u)(),{selectedLocation:l}=e,r=(0,s.useMemo)(()=>a[t].slug,[a,t]),handleClickKeyword=e=>{e.url&&(window.location.href=e.url)};return s.createElement(er,null,s.createElement(ed,null,o("booking.searchBar.popularKey")),e.popularKeys.map(e=>s.createElement(ec,{key:e.id,onClick:()=>handleClickKeyword(e)},e.keyword)),s.createElement(ec,{className:"view-all",onClick:()=>{let e=`/${l.slug}/${r}`;e&&i({type:n.NavigateTo,payload:e})}},o("booking.searchBar.viewAll")))},eu=O.Z.div` background: rgba(255, 255, 255, 0.64); backdrop-filter: blur(12px); border-bottom: 1px solid ${R.r.colors.neutral100}; `,ep=(0,O.Z)(j.C)` padding: 0 16px; `,TabSearch=({currentTab:e,hideTabBookingSearch:t=[],hideSpecialtyTab:a,isMobile:i,setCurrentTab:o})=>{let{t:n}=(0,w.u)(),l=(0,s.useMemo)(()=>({root:{overflowY:i?"hidden":"initial",overflowX:i?"auto":"initial"},tabsList:{background:"rgba(255, 255, 255, 0)",borderBottom:"none",flexWrap:"nowrap",".mantine-Tabs-tab":{"&:last-child":{"&:after":{display:"none"}}}},tab:{padding:i?"12px 16px 12px 16px":"15px 40px 15px 40px",borderTop:"2px solid transparent",borderBottom:"none",margin:0,borderRadius:0,position:"relative",width:"auto",'&[data-active="true"]':{borderColor:"#2d87f3",backgroundColor:"#ffffff","&:after":{display:"none"},"&:before":{content:'""',width:"100%",height:"1px",position:"absolute",backgroundColor:"#ffffff",bottom:"-1px"}},"&:hover":{borderColor:"#2d87f3",backgroundColor:"#ffffff","&:before":{content:'""',width:"100%",height:"1px",position:"absolute",backgroundColor:"#ffffff",bottom:"-1px"}},"&:after":{content:'""',width:"1px",height:"24px",backgroundColor:"#E4E8EC",position:"absolute",right:"-1px"}},tabLabel:{color:"#595959",fontSize:i?"14px":"16px",fontWeight:600,lineHeight:i?"22px":"24px"}}),[i]),r=(0,s.useMemo)(()=>[{value:"hospital",label:n("booking.searchPopup.hospitals")},{value:"doctor",label:n("booking.searchPopup.doctors")},{value:"service",label:n("booking.searchPopup.services")},...a?[]:[{value:"specialty",label:n("booking.searchPopup.specialties")}]],[a]),c=(0,s.useMemo)(()=>r.filter(e=>!t.includes(e.value))||[],[t,r]);return s.createElement(eu,{className:"booking-search-tab"},s.createElement(ep,null,s.createElement(E.m,{value:e,onTabChange:e=>{o(e)},styles:l},s.createElement(E.m.List,null,c.map(e=>s.createElement(E.m.Tab,{value:e.value,key:e.value},e.label))))))};(o=l||(l={})).doctor="doctor",o.service="hospital_service",o.hospital="hospital_branch";let ignoreCacarSpecialty=e=>e.filter(e=>"string"==typeof e?"cacar-api"!==e:(null==e?void 0:e.id)!==232),BookingSearchBarV2=({isMobile:e,careApiDomain:t,geoLocationPermission:a,geoLocationCoordinates:i,initialSelectedCity:o,initialSearchValue:c="",initTypeSearch:d="hospital",initSpecialty:u,careFrontDomain:p="/care",isDebug:h=!1,gaTrackingSearchBar:g,gaTrackingLocationSearch:m,autoCompleteDisabled:b=!1,inputSearchPlaceholder:v="",hideTabBookingSearch:E=[],hideSpecialtySelection:L=!1,hideSpecialtyTab:O=!1,hidePopularSearchKeys:R=!1,clientSlug:T="",triggerSearchWhenChangeFilter:j,routerPush:M,onChangeLocation:A})=>{var P;let{locale:F,t:$}=(0,w.u)(),H=(0,s.useRef)(null),G=(0,s.useRef)(null),q=(0,s.useRef)(null),Y=(0,s.useRef)(null),[U,Q]=(0,s.useState)(d),{geoLocationPermission:W,geoLocationCoordinates:X}=(0,C.u)(),[ee,et]=(0,s.useReducer)(reducer,V,t=>Object.assign(Object.assign({},t),{isDebug:h,isMobile:e,geoLocationPermission:a||W||"unset",geoLocationCoordinates:i||X||null,searchKeywords:c,initialSelectedCity:o||null,selectedLocation:o||t.selectedLocation||null,searchLocationKeywords:(null==o?void 0:o.name)||t.searchLocationKeywords,autoCompleteDisabled:b,inputSearchPlaceholder:v,locale:F})),{navigateTo:ea,focusedSpecialty:ei,searchKeywords:eo,selectedLocation:en,searchResults:el,isLoadingSearchResults:es}=ee,{fetchCitiesByDefault:er,fetchCitiesByKeyword:ec,fetchSearchResults:ed,fetchAllSpecialties:eu,fetchPopularKeys:ep}=function({dispatch:e,careApiDomain:t,locale:a="vi-VN",client:i=""}){let o=(0,s.useCallback)(function(i,o={}){let l=`${t}${i}`;return e({type:n.FetchCitiesStart}),fetch((0,C.h)(l,o,a),{method:"GET"}).then(e=>e.json()).then(e=>1===e._status&&e._data?null==e?void 0:e._data:(console.log("error loading cities",e),Promise.reject(e))).finally(()=>e({type:n.FetchCitiesFinish}))},[a]),r=(0,s.useCallback)(function({coordinates:t}){let l={},s={};t&&(l={lat:t.lat,lng:t.lng}),"ms-MY"===a&&(s.noPaging=1);let r=[o(_.P.GET_CITY_BY_IP,Object.assign(Object.assign(Object.assign({},l),s),{hospitalActive:1,client:I.C.MSD===i?"":i}))];return"zh-TW"===a?r.push(o(_.P.GET_CITIES_LIST,{noPaging:1,hospitalActive:1,client:I.C.MSD===i?"":i})):r.push(o(_.P.GET_CITIES_LIST,{noPaging:1,hospitalActive:1})),Promise.all(r).then(([t,a])=>{let i=Object.assign({},t);if(a){let e=i.cities.map(e=>e.id);i.cities=i.cities.concat(a.cities.filter(t=>!e.includes(t.id)))}e({type:n.FetchCitiesByGeoIpComplete,payload:i})}).catch(e=>console.error("error loading cities by location",e))},[a,t,e]),c=(0,s.useCallback)(function(){return o(_.P.GET_CITIES_LIST,{noPaging:1,hospitalActive:1}).then(t=>{e({type:n.FetchCitiesByDefaultComplete,payload:t.cities||[]})}).catch(e=>console.error("error loading cities by default",e))},[a,t,e]),d=(0,s.useCallback)(function(t){return o(_.P.GET_CITIES_LIST,{keyword:t,client:i}).then(t=>{e({type:n.FetchCitiesByKeywordComplete,payload:t.cities})}).catch(e=>console.error("error loading cities by keyword",e))},[a,t,e]),u=(0,s.useCallback)(function(o,l,s,r,c){let d="specialty"===s?`${t}${_.P.GET_SEARCH_SPECIALTY}`:`${t}${_.P.GET_SEARCH_V2}`;e({type:n.FetchSearchResultsStart});let{selectedLocation:u,geoLocationCoordinates:p,selectedSpecialty:h}=l,g="";if(!u){e({type:n.FetchSearchResultsFinish});return}g=u.id===I.I?"":u.id;let m=(null==p?void 0:p.lat)||"",b=(null==p?void 0:p.lng)||"",y=(null==h?void 0:h.id)>0?null==h?void 0:h.id:"",f=o.trim().length>Z[a]?o.trim():"";return fetch((0,C.h)(d,Object.assign({domain:t,searchType:s||"global",keyword:f,city:g===I.a?"":g,lat:m,lng:b,specialty_id:y,client_slug:I.C.MSD===r?"":r,msd:I.C.MSD===i?1:""},"doctor"===s&&{skipBooking:1}),a),{method:"GET",headers:{accept:"version=2.0.0.0"}}).then(e=>e.json()).then(e=>1===e._status&&e._data?null==e?void 0:e._data:Promise.reject(e)).then(t=>{let a=[];"specialty"!==s&&(a="doctor"===s?t.searches.map(e=>Object.assign(Object.assign({},e),{specialties:ignoreCacarSpecialty((null==e?void 0:e.specialties)||[])})):t.searches),"specialty"===s&&(a=f?ignoreCacarSpecialty((null==t?void 0:t.specialties)||[]):ignoreCacarSpecialty((null==t?void 0:t.default)||[])),e({type:n.FetchSearchResultsComplete,payload:{key:s,searches:a||[]}}),c&&e({type:n.UpdateInitialSearchResults,payload:{key:s,searches:a||[]}})}).catch(e=>{console.log("error loading search results",{url:d,error:e})}).finally(()=>e({type:n.FetchSearchResultsFinish}))},[a,t,e]),p=(0,s.useCallback)(function(){let o=`${t}${_.P.GET_SEARCH_SPECIALTY}`;return fetch((0,C.h)(o,{domain:t,searchType:"",msd:I.C.MSD===i?1:""},a),{method:"GET",headers:{accept:"version=2.0.0.0"}}).then(e=>e.json()).then(e=>1===e._status&&e._data?null==e?void 0:e._data:Promise.reject(e)).then(t=>{e({type:n.FetchAllSpecialties,payload:ignoreCacarSpecialty(t.specialties||[])})}).catch(e=>{console.log("error loading search results",{url:o,error:e})})},[a,t,e]),h=(0,s.useCallback)(function(i){let o=`${t}${_.P.GET_SEARCH_POPULAR_KEY}`;return fetch((0,C.h)(o,{domain:t,searchType:l[i],sort_by:"display_order",sort_order:"asc"},a)).then(e=>e.json()).then(e=>1===e._status&&e._data?null==e?void 0:e._data:Promise.reject(e)).then(t=>{e({type:n.FetchPopularKeys,payload:t.popular_searches||[]})}).catch(e=>{console.log("error loading search results",{url:o,error:e})})},[a,t,e]);return{fetchCitiesByLocation:r,fetchCitiesByDefault:c,fetchCitiesByKeyword:d,fetchSearchResults:u,fetchAllSpecialties:p,fetchPopularKeys:h}}({dispatch:et,locale:F,careApiDomain:t,client:T}),eh=(0,s.useMemo)(()=>I.L[F],[F]),[eg,{close:em,open:eb}]=(0,S.q)(!1),ey=(0,s.useMemo)(()=>Object.assign({doctor:{name:$("booking.searchPopup.doctors"),icon:s.createElement(DoctorIcon,null),slug:eh.DOCTOR},service:{name:$("booking.searchPopup.services"),icon:s.createElement(ServiceIcon,null),slug:eh.SERVICE},hospital:{name:$("booking.searchPopup.hospitals"),icon:s.createElement(HospitalIcon,null),slug:eh.HOSPITAL}},!O&&{specialty:{name:$("booking.searchPopup.specialties"),icon:s.createElement(SpecialtyIcon,null),slug:eh.SPECIALTIES}}),[U]),ef=(0,s.useMemo)(()=>k()(ec,400),[ec]),ev=(0,s.useMemo)(()=>k()(ed,400),[ed]),eE=(0,s.useCallback)(function({locationSlug:e,specialtyId:t}={}){var a;em();let i="",{slug:o}=ey[U],l="",s=I.M[F][T],r=t||(null===(a=ee.selectedSpecialty)||void 0===a?void 0:a.id)||-1,c=e||(null==en?void 0:en.slug)||"";("doctor"===U||"hospital"===U)&&r>0&&(l=`&specialtyId=${r}`),i="specialty"===U?`/${o}`:`/${c}/${o}`,s&&(i+=`/${s}`),(i+=`?q=${eo}${l}`)&&et({type:n.NavigateTo,payload:i})},[T,em,U,et,F,eo,null==en?void 0:en.slug,null===(P=ee.selectedSpecialty)||void 0===P?void 0:P.id,ey]),eS=(0,s.useCallback)(function(e){j&&eE({locationSlug:e.slug}),et({type:n.SelectLocation,payload:e}),A&&A(e)},[et,e,A,eE,j]);(0,x.a)(Y,()=>{e||et({type:n.ClickOutsideInputSearchSpecialty})}),(0,s.useEffect)(()=>{var e;let t=u||{name:$("booking.searchBar.allSpecialties"),id:-1,thumbnail:"",total_doctor:0,slug:eh.SPECIALTIES};if(u){(null===(e=ee.selectedSpecialty)||void 0===e?void 0:e.id)!==u.id&&et({type:n.SelectSpecialty,payload:u});return}ee.selectedSpecialty&&ee.selectedSpecialty.id===t.id||et({type:n.SelectSpecialty,payload:t})},[u,eh.SPECIALTIES,$]),(0,s.useEffect)(()=>{var e;o||en||et({type:n.SelectLocation,payload:{name:$("booking.searchBar.allLocations"),id:I.I,slug:null===(e=I.L[F])||void 0===e?void 0:e.ALL}})},[et,o,F,en,$]),(0,s.useEffect)(()=>{eu(),er()},[]),(0,s.useEffect)(()=>{ep(U)},[U]),(0,s.useEffect)(()=>{ea&&(M?M(ea):window.location.href=`${p}${ea}`)},[ea]),(0,s.useEffect)(()=>{ed(ee.searchKeywords,ee,U,T,!0)},[U]),(0,s.useEffect)(()=>{if(eg&&e){let e=setTimeout(()=>{var e;null===(e=q.current)||void 0===e||e.focus()},150);return()=>clearTimeout(e)}},[eg,e]);let eC={type:U,isMobile:e,state:ee,dispatch:et,debouncedFetchSearchResults:ev,initalSearchValue:c,onEnterSearch:eE,typeInformation:ey,trackingAttributes:g,isLoading:es,hideSpecialtySelection:L||O,clientSlug:T,triggerSearchWhenChangeFilter:j,onChangeSpecialty:e=>j&&eE({specialtyId:e.id})};return s.createElement(s.Fragment,null,s.createElement(D,{ref:H},s.createElement(TabSearch,{currentTab:U,setCurrentTab:Q,isMobile:e,hideTabBookingSearch:E,hideSpecialtyTab:O}),s.createElement(B,{className:"booking-search-container"},s.createElement(z,null,s.createElement(K,{className:"booking-search-content"},s.createElement("div",{ref:Y},s.createElement(y.k,{gap:"12px",justify:"space-between",align:"center",direction:e?"column":"row",className:"flex-search-input"},"specialty"!==U&&s.createElement(SearchLocation,{state:ee,isMobile:e,dispatch:et,debouncedFetchCitiesByKeyword:ef,selectedLocation:en,onLocationClick:eS,trackingAttributes:m}),s.createElement(J,Object.assign({},eC,{ref:G,onFocusInput:()=>e&&eb()})),s.createElement(N.B,{size:e?"md":"lg",fullWidth:e,variant:"primary",onClick:()=>eE(),styles:{root:{height:e?"40px":"48px"}}},$("booking.searchBar.searchButton"))),!R&&"specialty"!==U&&ee.popularKeys.length>0&&s.createElement(SearchTag,{type:U,state:ee,typeInformation:ey,dispatch:et}),"specialty"===U&&"search"===ei&&s.createElement(SearchResultSpecialties,{state:ee,isMobile:e,dispatch:et,specialties:(null==el?void 0:el.specialty)||[],isLoading:es})))))),e&&s.createElement(ModalSearchResult,{keepMounted:!0,opened:eg,onClose:em,closeModal:em,searchInputEle:s.createElement(y.k,{align:"center",gap:8},s.createElement(J,Object.assign({},eC,{onlyShowSearchBox:!0,ref:q})),s.createElement(N.B,{variant:"primary",leftIcon:s.createElement(r.Z,{size:20,color:"#fff"}),onClick:()=>eE()}))},s.createElement(f.x,{sx:{marginLeft:-16,marginRight:-16}},s.createElement(SearchResultContent,{type:U,state:ee,dispatch:et,isLoading:es,typeInformation:ey,clientSlug:T}))))}}}]);