"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8299],{h8Xt:function(e,t,a){a.d(t,{B:function(){return BookingSearchBarV3},T:function(){return TextDivider}});var i,o,l,r,n=a("q1tI"),s=a("6mQP"),c=a("0D4Z"),d=a("iuhU"),p=a("Eso5"),u=a("aDCK"),h=a("mYVa"),g=a("vaps"),m=a("8vDj"),b=a("OAL+"),y=a("SPK5"),f=a("TIp3"),x=a("CmzK"),v=a("NEaA"),S=a("rlLN"),C=a("Iblh"),w=a("5oaG"),E=a("0++/"),k=a("RVQf"),O=a("sEfC"),j=a.n(O),I=a("qWy5"),L=a("rBCA"),T=a("iBNF"),$=a("+J3I"),R=a("jONk"),M=a("HalR"),N=a("/6O3"),P=a("XBaX"),_=a("A24R"),F=a("if/6"),B=a("aqw/"),D=a("k1Nl");let z=L.Z.div``,K=L.Z.div` background-color: ${T.r.colors.neutral50}; padding-bottom: 1px; ${$.M.mbDown} { padding: 0; } `,A=(0,L.Z)(R.C)` padding: 0 16px; ${$.M.mbDown} { padding: 0; } `,q=L.Z.div` padding: 24px 56px; border-radius: 16px; background-color: ${T.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); ${$.M.mbDown} { padding: 16px; border-radius: 0; } .flex-search-input { flex-direction: row; ${$.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},W={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("bookingSearchBarV3",{action:t,state:e}),t.type){case l.NavigateTo:return Object.assign(Object.assign({},e),{navigateTo:t.payload,focused:"none",isMobileModalOpened:!1});case l.ClickOutsideInputLocation:if("location"!==e.focused)return e;return resetSearchLocationKeywords(Object.assign(Object.assign({},e),{focused:"none"}));case l.ClickOutsideInputSpecialty:if("specialty"!==e.focused)return e;return resetSearchLocationKeywords(Object.assign(Object.assign({},e),{focused:"none"}));case l.ClickOutsideInputSearch:if("search"!==e.focused)return e;return Object.assign(Object.assign({},e),{focused:"none"});case l.ClickOutsideInputSearchSpecialty:if("search"!==e.focusedSpecialty)return e;return Object.assign(Object.assign({},e),{focusedSpecialty:"none"});case l.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 l.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 l.FocusInputSearch:let o=Object.assign(Object.assign({},e),{focused:"search"});if(e.isMobile)return resetSearchLocationKeywords(o);return o;case l.FocusInputSearchSpecialty:{let t=Object.assign(Object.assign({},e),{focusedSpecialty:"search"});return t}case l.ChangeInputLocation:return Object.assign(Object.assign({},e),{searchLocationKeywords:t.payload});case l.ChangeInputSearch:{let a=t.payload;return Object.assign(Object.assign({},e),{searchKeywords:a,isLoadingSearchResults:a.trim().length>Z[e.locale]})}case l.SelectCurrentLocation:return Object.assign(Object.assign({},e),{focused:"none",selectedLocation:t.payload,searchLocationKeywords:t.payload.name});case l.ClearInputLocation:return Object.assign(Object.assign({},e),{focused:"location",cities:e.initialCities,searchLocationKeywords:""});case l.ClearInputSearch:return Object.assign(Object.assign({},e),{focused:"search",searchKeywords:""});case l.SelectLocation:return Object.assign(Object.assign({},e),{focused:"none",selectedLocation:t.payload,searchLocationKeywords:t.payload.name,searchResults:{}});case l.SelectSpecialty:return Object.assign(Object.assign({},e),{focused:"none",selectedSpecialty:t.payload,searchResults:{}});case l.SelectSearchResult:return Object.assign(Object.assign({},e),{searchKeywords:t.payload.name,isMobileModalOpened:!1,focused:"none",navigateTo:t.payload.url});case l.FetchCitiesStart:return Object.assign(Object.assign({},e),{isLoadingCities:!0});case l.FetchCitiesFinish:return Object.assign(Object.assign({},e),{isLoadingCities:!1});case l.FetchSearchResultsStart:return Object.assign(Object.assign({},e),{isLoadingSearchResults:!0});case l.FetchSearchResultsFinish:return Object.assign(Object.assign({},e),{isLoadingSearchResults:!1});case l.FetchSearchResultsComplete:{let a=Object.assign(Object.assign({},e),{searchResults:Object.assign(Object.assign({},e.searchResults),{[t.payload.key]:t.payload.searches})});return a}case l.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 l.FetchCitiesByKeywordComplete:return Object.assign(Object.assign({},e),{cities:t.payload});case l.DisplayInitialCities:return Object.assign(Object.assign({},e),{cities:e.initialCities});case l.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 l.UpdateInitialSearchResults:return Object.assign(Object.assign({},e),{initialSearchResults:Object.assign(Object.assign({},e.initialSearchResults),{[t.payload.key]:t.payload.searches})});case l.GrantGeoLocationPermission:return Object.assign(Object.assign({},e),{geoLocationPermission:"granted",geoLocationCoordinates:t.payload});case l.DenyGeoLocationPermission:return Object.assign(Object.assign({},e),{geoLocationPermission:"denied",geoLocationCoordinates:null});case l.OpenMobileModal:return Object.assign(Object.assign({},e),{isMobileModalOpened:!0});case l.CloseMobileModal:return Object.assign(Object.assign({},e),{isMobileModalOpened:!1});case l.UpdateInitialSearchValue:return Object.assign(Object.assign({},e),{searchKeywords:t.payload});case l.SetInputSearchPlaceholder:return Object.assign(Object.assign({},e),{inputSearchPlaceholder:t.payload});case l.FetchAllSpecialties:return Object.assign(Object.assign({},e),{allSpecialties:t.payload});case l.FetchPopularKeys:return Object.assign(Object.assign({},e),{popularKeys:t.payload});default:return e}}(i=l||(l={})).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.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=L.Z.div` flex: 1; position: relative; ${$.M.mbDown} { width: 100%; } `,G=L.Z.div` background: #f7f9fc; border-radius: 12px; height: 48px; display: flex; align-items: center; padding: 4px 12px 4px 4px; gap: 16px; ${$.M.mbDown} { height: 48px; width: 100%; } `,V=L.Z.div` display: flex; align-items: center; flex-shrink: 0; color: #8c8c8c; svg { width: 18px; height: 18px; } `,Q=L.Z.div` position: absolute; top: calc(100% + 2px); width: 100%; border-radius: 4px; background: ${T.r.colors.white}; box-shadow: 0px 8px 40px 0px rgba(0, 0, 0, 0.1); z-index: 10; ${$.M.mbDown} { width: calc(100% + 64px); left: -32px; } `,Y=L.Z.div``;L.Z.div` display: flex; justify-content: space-between; align-item: center; padding: 9px 14px 9px 22px; background: #f7f9fc; .title { color: ${T.r.colors.gray800}; font-size: 14px; font-weight: 600; line-height: 22px; } .btn-see-all { color: ${T.r.colors.blue600}; font-size: 14px; line-height: 22px; cursor: pointer; } `;let U=L.Z.div` padding: 10px 16px; max-height: 400px; overflow: auto; `,X=L.Z.div` display: flex; gap: 12px; align-items: center; cursor: pointer; ${$.M.mbUp} { &:hover { background-color: ${T.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 ${T.r.colors.neutral100}; .title { color: ${T.r.colors.gray800}; font-size: 16px; font-weight: 600; line-height: 24px; } .description { overflow: hidden; color: ${T.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; } } `;L.Z.div` padding: 0 16px 16px; .search-detail-btn { color: ${T.r.colors.blue600}; font-size: 14px; line-height: 22px; cursor: pointer; } `;let SearchResult=({state:e,type:t,results:a,isLoading:i,typeInformation:o,dispatch:r})=>{let{t:s}=(0,k.u)(),{selectedLocation:p}=e,u=(0,n.useMemo)(()=>o[t].slug,[o,t]),handleOnClick=e=>{let a="";switch(t){case"service":a=`/${p.slug}/${u}/${e.slug}`;break;case"doctor":case"hospital":a=`/${u}/${e.slug}-${e.id}`}a&&r({type:l.NavigateTo,payload:a})};return null===a?null:n.createElement(Y,null,n.createElement(U,{className:"search-results__body"},i&&n.createElement("div",{className:"skeleton-result"},[,,,].fill(void 0).map((e,a)=>n.createElement(X,{key:t+"loading"+a,className:2===a?"last-item":""},n.createElement("div",{className:"image-item"},n.createElement(c.O,{height:48,circle:!0,mb:"xl",animate:!0})),n.createElement("div",{className:"infor"},n.createElement("div",{className:"title"},n.createElement(c.O,{height:8,mt:10,radius:"xl",animate:!0})),n.createElement("div",{className:"description"},n.createElement("div",{className:"sub-description"},n.createElement(c.O,{height:8,mt:10,radius:"xl",width:"80%",animate:!0}))))))),!i&&a&&a.length>0&&n.createElement(n.Fragment,null,a.map((e,i)=>{var l,r;let s=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===(l=null==e?void 0:e.specialties)||void 0===l?void 0:l.join(", "))||""),"service"===t&&(c=(null===(r=null==e?void 0:e.hospital_branch)||void 0===r?void 0:r.name)||""),i>=4)?n.createElement(n.Fragment,null):n.createElement(X,{key:e.id,className:(0,d.default)(s?"last-item":"","result-item"),onClick:()=>handleOnClick(e)},n.createElement("div",{className:"image-item"},n.createElement("img",{src:e.logo||e.avatar,alt:e.name})),n.createElement("div",{className:"infor"},n.createElement("div",{className:"title"},e.name),n.createElement("div",{className:"description"},o[t].icon,n.createElement("div",{className:"sub-description"},c))))})),!i&&(null==a?void 0:a.length)===0&&n.createElement(M.T,{size:"sm",color:T.r.colors.gray400,className:"noresult-block"},s("booking.searchBar.noResults"))))},SearchResultContent=({state:e,type:t,isLoading:a,clientSlug:i,typeInformation:o,dispatch:l})=>{var r;return"search"!==e.focused?null:n.createElement(SearchResult,{type:t,state:e,results:(null===(r=e.searchResults)||void 0===r?void 0:r[t])||null,location:e.selectedLocation.name,dispatch:l,isLoading:a,typeInformation:o,clientSlug:i})},J=L.Z.div` position: relative; flex-shrink: 0; ${$.M.mbDown} { width: 100%; display: flex; flex-direction: column; gap: 12px; } &.compact { ${$.M.mbDown} { width: auto; display: block; } } `,ee=L.Z.div` position: absolute; top: calc(100% + 4px); left: 0; min-width: 264px; background: white; border-radius: 12px; box-shadow: 0px 0px 1px 0px rgba(0, 0, 0, 0.04), 0px 2px 8px 0px rgba(0, 0, 0, 0.04), 0px 10px 16px 0px rgba(0, 0, 0, 0.04); z-index: 10; overflow: hidden; &.mobile { min-width: 280px; } `,et=L.Z.div` cursor: pointer; padding: 12px 16px; display: flex; align-items: center; gap: 12px; outline: none; .image-item { display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; flex-shrink: 0; img { width: 100%; height: 100%; object-fit: contain; } svg { width: 24px; height: 24px; } } .item-label { font-size: 15px; font-weight: 400; line-height: 24px; letter-spacing: -0.3px; color: ${T.r.colors.gray800}; } &:hover { background-color: ${T.r.colors.neutral50}; } &.selected { background-color: ${T.r.colors.neutral50}; } &:last-child { border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; } `,DoctorIcon=()=>n.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},n.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=()=>n.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},n.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=()=>n.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},n.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=()=>n.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16"},n.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"})),SearchSpecialty=({state:e,isMobile:t,onSpecialtyClick:a,dispatch:i,isCompact:o=!1})=>{let{t:r,locale:c}=(0,k.u)(),d=(0,n.useRef)(null),m=(0,n.useRef)(null),b=(0,n.useMemo)(()=>I.L[c],[c]),[y,f]=(0,n.useState)(""),[x,{close:v,toggle:S}]=(0,C.q)(!1);(0,E.a)(d,()=>{v(),f(""),i({type:l.ClickOutsideInputSpecialty})});let w=(0,n.useMemo)(()=>[{name:r("booking.searchBar.allSpecialties"),id:-1,thumbnail:"",total_doctor:0,slug:b.SPECIALTIES},...e.allSpecialties],[e.allSpecialties,r,b.SPECIALTIES]),O=(0,n.useMemo)(()=>y.trim()?w.filter(e=>e.name.toLowerCase().includes(y.toLowerCase().trim())):w,[w,y]),j=(0,n.useMemo)(()=>e.selectedSpecialty?e.selectedSpecialty.name:"",[e.selectedSpecialty]),L=(0,n.useCallback)(e=>{a({id:e.id,name:e.name,slug:e.slug,thumbnail:e.thumbnail||"",total_doctor:0}),v(),f("")},[a,v]),$=(0,n.useCallback)(()=>{S(),x&&f("")},[S,x]);return n.createElement(J,{ref:d,className:o?"compact":""},n.createElement(p.x,{onClick:$,className:x?"dropdown-trigger-open":"",sx:{cursor:"pointer",position:"relative",width:o?t?96:160:"100%",flexShrink:0}},n.createElement(u.I,{readOnly:!0,value:j,placeholder:r("booking.searchPopup.specialties"),rightSection:n.createElement(N.C,{style:{width:20,height:20}}),styles:Object.assign({input:{cursor:"pointer",outline:"none","&:focus":{outline:"none"},"&:not(.mantine-Textarea-input)":{height:o?40:t?40:46,fontSize:o?(0,h.h)(14):t?(0,h.h)(14):(0,h.h)(16),paddingLeft:o?12:16,paddingRight:30,background:o?"white":"transparent",border:o?`1px solid ${T.r.colors.gray200}`:"none",borderRadius:8,letterSpacing:"-0.2px",color:T.r.colors.gray800,textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap"}},rightSection:{width:30,pointerEvents:"none"}},!o&&{wrapper:{position:"relative","&:after":{content:'""',width:"1px",height:"20px",backgroundColor:T.r.colors.neutral100,position:"absolute",right:0,top:"50%",transform:"translateY(-50%)"}}})})),x&&n.createElement(ee,{className:t?"mobile":""},n.createElement(p.x,{sx:{padding:"12px 12px 8px"}},n.createElement(u.I,{ref:m,icon:n.createElement(s.Z,{size:18,color:T.r.colors.gray300}),placeholder:r("booking.searchBar.placeholder.specialty"),value:y,onChange:e=>f(e.target.value),size:"md",styles:{input:{height:40,fontSize:(0,h.h)(15),paddingLeft:36,"&::placeholder":{color:T.r.colors.gray400}},icon:{width:36}}})),n.createElement(g.x.Autosize,{mah:300},0===O.length?n.createElement(p.x,{sx:{padding:"12px 16px",color:T.r.colors.gray400,fontSize:14}},r("common.noResult")):O.map(t=>{var a,i;return n.createElement(et,{key:t.id,tabIndex:0,role:"option","aria-selected":(null===(a=e.selectedSpecialty)||void 0===a?void 0:a.id)===t.id,className:(null===(i=e.selectedSpecialty)||void 0===i?void 0:i.id)===t.id?"selected":"",onClick:()=>L(t),onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),L(t))}},n.createElement("div",{className:"image-item"},t.thumbnail?n.createElement("img",{src:t.thumbnail,alt:t.name}):n.createElement(SpecialtyIcon,null)),n.createElement("span",{className:"item-label"},t.name))}))))},ea=(0,n.forwardRef)(({state:e,type:t,isMobile:a,isLoading:i,initalSearchValue:o,typeInformation:r,debouncedFetchSearchResults:c,trackingAttributes:d,hideSpecialtySelection:p=!1,clientSlug:g="",onSearch:m,onFocusInput:b,onEnterSearch:y,dispatch:f,onlyShowSearchBox:x,onChangeSpecialty:v},S)=>{let{t:C}=(0,k.u)(),w=(0,n.useRef)(null),O=(0,n.useRef)(null);(0,n.useImperativeHandle)(S,()=>({focus:()=>{var e;null===(e=O.current)||void 0===e||e.focus()}}));let j=(0,n.useMemo)(()=>d?{"data-event-category":d.dataEventCategory,"data-event-action":d.dataEventAction,"data-event-label":d.dataEventLabel}:{},[d]),I=(0,n.useMemo)(()=>"doctor"===t?C("booking.searchBar.placeholder.doctor"):"service"===t?C("booking.searchBar.placeholder.service"):"hospital"===t?C("booking.searchBar.placeholder.hospital"):"specialty"===t?C("booking.searchBar.placeholder.specialty"):"",[t,C]),L="specialty"!==t&&"service"!==t&&!p&&!x,$=(0,n.useMemo)(()=>({input:{border:"none",background:"transparent",height:"100%",fontSize:(0,h.h)(16),color:T.r.colors.gray800,padding:"0","&::placeholder":{color:T.r.colors.gray400},"&:focus":{outline:"none",boxShadow:"none"},[a?"@media (max-width: 767px)":""]:a?{fontSize:(0,h.h)(16)}:{}},wrapper:{flex:1}}),[a]);(0,E.a)(w,()=>{a||f({type:l.ClickOutsideInputSearch})});let R=(0,n.useCallback)(function(a){f({type:l.ChangeInputSearch,payload:a}),"function"!=typeof m&&(a.trim().length>Z[e.locale]||o||0===a.trim().length)&&c(a.trim(),e,t,g)},[f,e,t,o,c,g,m]),M=(0,n.useCallback)(function(e){var t;f({type:l.SelectSpecialty,payload:e}),null==v||v(e),a||null===(t=O.current)||void 0===t||t.focus()},[f,v]),N=(0,n.useCallback)(e=>{"Enter"===e.key&&(e.stopPropagation(),e.preventDefault(),y&&y())},[y]);return n.createElement(H,{ref:w},n.createElement(G,null,L&&n.createElement(SearchSpecialty,{state:e,isMobile:a,dispatch:f,debouncedFetchSearchResults:c,onSpecialtyClick:M,isCompact:!0}),n.createElement(V,null,n.createElement(s.Z,null)),n.createElement(u.I,Object.assign({ref:O,variant:"unstyled",size:a?"md":"lg",placeholder:I,styles:$,value:e.searchKeywords,name:"search-results",autoComplete:"off",onFocus:()=>{f({type:l.FocusInputSearch}),null==b||b()},onChange:e=>{R(e.target.value)},onKeyDown:N},j))),!a&&"specialty"!==t&&n.createElement(Q,null,n.createElement(SearchResultContent,{type:t,state:e,dispatch:f,isLoading:i,typeInformation:r,clientSlug:g})))});ea.displayName="SearchInputs";let ModalSearchResult=e=>{var{searchInputEle:t,closeModal:a,children:i}=e,o=(0,P._)(e,["searchInputEle","closeModal","children"]);let l=(0,m.rZ)();return n.createElement(F.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"}}}),n.createElement(b.K,{spacing:16,sx:{paddingTop:16}},n.createElement(y.k,{align:"center",gap:12},n.createElement(_.Z,{size:28,onClick:a,color:l.fn.primaryColor()}),n.createElement(p.x,{sx:{width:"100%"}},t)),i))},ei=L.Z.div` position: relative; width: 240px; flex-shrink: 0; ${$.M.mbDown} { width: 100%; } `;L.Z.div` position: absolute; top: calc(100% + 2px); width: 100%; border-radius: 4px; background: ${T.r.colors.white}; box-shadow: 0px 8px 40px 0px rgba(0, 0, 0, 0.1); z-index: 10; ${$.M.mbDown} { width: calc(100% + 64px); left: -32px; } `;let eo=L.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: ${T.r.colors.neutral100}; } &:not([data-is-denied='true']):hover { background-color: ${T.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; } `,el=(0,L.Z)(w.P)` width: 12px; height: 18px; flex: 0 0 12px; `,er=(0,n.forwardRef)((e,t)=>{var{label:a,value:i}=e,o=(0,P._)(e,["label","value"]);return n.createElement("div",Object.assign({ref:t},o),n.createElement(eo,{key:i,role:"button",tabIndex:0,"aria-label":`Select ${a} as location`,className:"location-item"},n.createElement(el,{color:T.r.colors.neutral400}),n.createElement(f.x,{size:"md"},a)))}),SearchLocation=({state:e,debouncedFetchCitiesByKeyword:t,selectedLocation:a,trackingAttributes:i,onLocationClick:o,dispatch:r})=>{var s;let{t:c,locale:d}=(0,k.u)(),p=(0,n.useRef)(null),u=(0,n.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]),g=(0,n.useMemo)(()=>i?{"data-event-category":i.dataEventCategory,"data-event-action":i.dataEventAction,"data-event-label":i.dataEventLabel}:{},[i]),m=(0,n.useCallback)(function(a){r({type:l.ChangeInputLocation,payload:a}),a.trim().length>Z[e.locale]?t(a.trim()):(t.cancel(),r({type:l.DisplayInitialCities}))},[t,r,e.locale]);(0,E.a)(p,()=>{r({type:l.ClickOutsideInputLocation})});let b=null!==(s=null==a?void 0:a.id)&&void 0!==s?s:null,y=null===b?void 0:String(b);return n.createElement(ei,{ref:p},n.createElement(x.Ph,Object.assign({key:null!=y?y:"no-selected-location",defaultValue:y,placeholder:c("booking.searchBar.allLocations"),searchable:!0,onSearchChange:e=>{m(e)},onFocus:()=>{r({type:l.DisplayInitialCities})},onDropdownClose:()=>{t.cancel(),r({type:l.DisplayInitialCities})},nothingFound:c("common.noResult"),maxDropdownHeight:340,dropdownPosition:"bottom",icon:n.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n.createElement("path",{d:"M9.99908 10.8332C11.2264 10.8332 12.2213 9.83764 12.2213 8.61097C12.2213 7.3843 11.2264 6.38875 9.99908 6.38875C8.77174 6.38875 7.77686 7.3843 7.77686 8.61097C7.77686 9.83764 8.77174 10.8332 9.99908 10.8332Z",stroke:"#111111",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),n.createElement("path",{d:"M9.99919 18.0554C11.7584 17.4999 16.6659 13.611 16.6659 8.61097C16.6659 4.93097 13.6811 1.94431 9.99919 1.94431C6.3173 1.94431 3.33252 4.93097 3.33252 8.61097C3.33252 13.611 8.23996 17.4999 9.99919 18.0554Z",stroke:"#111111",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})),rightSection:n.createElement(N.C,{style:{width:20,height:20}})},g,{styles:()=>({item:{padding:0,"&[data-selected]":{"&, &:hover":{backgroundColor:"#F7F9FC",color:"inherit"},".location-item":{"&::after":{content:w.i,top:"50%",right:19,position:"absolute",transform:"translateY(-50%)"}}},"&[data-hovered]":{backgroundColor:"transparent"}},root:{width:"100%"},wrapper:{width:"100%"},input:{"&:not(.mantine-Textarea-input)":{height:48,fontSize:(0,h.h)(15),fontWeight:400,letterSpacing:"-0.3px",color:T.r.colors.gray1000,paddingLeft:44,paddingRight:40,background:"white",border:`1px solid ${T.r.colors.gray200}`,borderRadius:12}},icon:{width:44,paddingLeft:12},rightSection:{width:40,paddingRight:12},itemsWrapper:{padding:0},dropdown:{left:"0 !important",border:0,marginTop:4,borderRadius:12,overflow:"hidden",boxShadow:"0px 0px 1px 0px rgba(0, 0, 0, 0.04), 0px 2px 8px 0px rgba(0, 0, 0, 0.04), 0px 10px 16px 0px rgba(0, 0, 0, 0.04)","& ::-webkit-scrollbar":{width:"6px",height:"6px"}}}),itemComponent:er,filter:()=>!0,onChange:e=>{if(null==e)return;let a=u.find(t=>String(t.id)===e);a&&(o(a),t.cancel(),r({type:l.DisplayInitialCities}),setTimeout(()=>{var e,t;null===(t=null===(e=p.current)||void 0===e?void 0:e.querySelector("input"))||void 0===t||t.blur()},0))},data:u.map(e=>({value:String(e.id),label:e.name,city:e}))})))},en=L.Z.div` display: flex; flex-wrap: wrap; row-gap: 8px; column-gap: 20px; ${$.M.mbDown} { margin-top: 12px; } `,es=L.Z.div` display: flex; align-items: center; border-radius: 8px; border: 1px solid ${T.r.colors.neutral100}; background: ${T.r.colors.white}; padding: 8px 12px 8px 8px; flex: 0 0 calc(33.3% - 13px); gap: 12px; cursor: pointer; &:hover { background: ${T.r.colors.blue50}; } ${$.M.tdDown} { flex: 0 0 calc(50% - 10px); } ${$.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: ${T.r.colors.gray800}; font-size: 14px; font-style: normal; font-weight: 400; line-height: 22px; } .description { color: ${T.r.colors.gray600}; font-size: 12px; font-weight: 400; line-height: 18px; } } `,ec=(0,L.Z)(v.i)` margin: 24px 0 !important; `,ed=L.Z.div` display: flex; justify-content: center; margin-top: 24px; .show-more { border-radius: 4px; border: 1px solid ${T.r.colors.neutral200}; padding: 12px 16px; cursor: pointer; display: inline-block; color: ${T.r.colors.gray800}; font-size: 16px; font-weight: 600; line-height: 24px; ${$.M.mbDown} { width: 100%; text-align: center; } } `,SearchResultSpecialties=({state:e,isMobile:t,specialties:a,isLoading:i,dispatch:o})=>{let{t:r,locale:s}=(0,k.u)(),{selectedLocation:d}=e,p=(0,n.useMemo)(()=>I.L[s],[s]),handleOnClick=e=>{let t="";e===I.S?(t=`/${d.slug}/${p.HOSPITAL}/${I.C.GSK}/`,o({type:l.ClickOutsideInputSearchSpecialty})):t=`/${d.slug}/${p.DOCTOR}/${e}`,o({type:l.NavigateTo,payload:t})},u=(0,n.useMemo)(()=>a.length>=9||e.searchKeywords.trim().length<=Z[e.locale],[e.searchKeywords,a]);return n.createElement(n.Fragment,null,!t&&n.createElement(ec,{color:"#E4E8EC"}),n.createElement(en,null,a.length>0&&!i&&n.createElement(n.Fragment,null,a.map((e,t)=>t>=9?n.createElement(n.Fragment,null):n.createElement(es,{key:e.id,onClick:()=>handleOnClick(e.slug)},n.createElement("div",{className:"image-item"},n.createElement("img",{src:e.thumbnail,alt:e.name})),n.createElement("div",{className:"infor"},n.createElement("div",{className:"title"},e.name))))),0===a.length&&!i&&n.createElement(M.T,{size:"sm",color:T.r.colors.gray400},r("booking.searchBar.noResults")),i&&Array(6).fill(void 0).map((e,t)=>n.createElement(es,{key:"loading"+t},n.createElement("div",{className:"image-item"},n.createElement(c.O,{height:40,animate:!0})),n.createElement("div",{className:"infor"},n.createElement("div",{className:"title"},n.createElement(c.O,{height:20,radius:"sm",animate:!0})))))),u&&n.createElement(ed,null,n.createElement("div",{className:"show-more",onClick:()=>{let e=`/${p.SPECIALTIES}`;o({type:l.NavigateTo,payload:e})}},r("home.seeAll"))))},ep=L.Z.div` display: flex; gap: 5px; margin-top: 16px; flex-wrap: wrap; `,eu=L.Z.div` color: ${T.r.colors.gray600}; font-size: 14px; font-weight: 600; line-height: 22px; padding: 4px 12px; background: ${T.r.colors.white}; border-radius: 32px; cursor: pointer; border: 1px solid ${T.r.colors.white}; margin-bottom: 5px; border-color: ${T.r.colors.neutral100}; background: #f7f9fc; &.view-all { border-radius: 32px; border-color: ${T.r.colors.blue50}; background: ${T.r.colors.blue50}; color: ${T.r.colors.blue600}; &:hover { border-color: ${T.r.colors.blue50}; background: ${T.r.colors.blue50}; color: ${T.r.colors.blue600}; } } &:hover { border-color: ${T.r.colors.neutral100}; background: #f7f9fc; } `,eh=L.Z.div` color: ${T.r.colors.gray600}; font-size: 14px; font-weight: 600; line-height: 22px; padding: 4px 0; background: ${T.r.colors.white}; border-radius: 32px; border: 1px solid ${T.r.colors.white}; margin-bottom: 5px; margin-right: 7px; `,SearchTag=({state:e,type:t,typeInformation:a,dispatch:i})=>{let{t:o}=(0,k.u)(),{selectedLocation:r}=e,s=(0,n.useMemo)(()=>a[t].slug,[a,t]),handleClickKeyword=e=>{e.url&&(window.location.href=e.url)};return n.createElement(ep,null,n.createElement(eh,null,o("booking.searchBar.popularKey")),e.popularKeys.map(e=>n.createElement(eu,{key:e.id,onClick:()=>handleClickKeyword(e)},e.keyword)),n.createElement(eu,{className:"view-all",onClick:()=>{let e=`/${r.slug}/${s}`;e&&i({type:l.NavigateTo,payload:e})}},o("booking.searchBar.viewAll")))},eg=L.Z.div` background: rgba(255, 255, 255, 0.64); backdrop-filter: blur(12px); border-bottom: 1px solid ${T.r.colors.neutral100}; `,em=(0,L.Z)(R.C)` padding: 0 16px; `,TabSearch=({currentTab:e,hideTabBookingSearch:t=[],hideSpecialtyTab:a,isMobile:i,setCurrentTab:o})=>{let{t:l}=(0,k.u)(),r=(0,n.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]),s=(0,n.useMemo)(()=>[{value:"hospital",label:l("booking.searchPopup.hospitals")},{value:"doctor",label:l("booking.searchPopup.doctors")},{value:"service",label:l("booking.searchPopup.services")},...a?[]:[{value:"specialty",label:l("booking.searchPopup.specialties")}]],[a]),c=(0,n.useMemo)(()=>s.filter(e=>!t.includes(e.value))||[],[t,s]);return n.createElement(eg,{className:"booking-search-tab"},n.createElement(em,null,n.createElement(S.m,{value:e,onTabChange:e=>{o(e)},styles:r},n.createElement(S.m.List,null,c.map(e=>n.createElement(S.m.Tab,{value:e.value,key:e.value},e.label))))))};(o=r||(r={})).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),BookingSearchBarV3=({isMobile:e,careApiDomain:t,geoLocationPermission:a,geoLocationCoordinates:i,initialSelectedCity:o,initialSearchValue:c="",initTypeSearch:d="hospital",initSpecialty:u,careFrontDomain:h="/care",isDebug:g=!1,gaTrackingSearchBar:m,gaTrackingLocationSearch:b,autoCompleteDisabled:f=!1,inputSearchPlaceholder:x="",hideTabBookingSearch:v=[],hideSpecialtySelection:S=!1,hideSpecialtyTab:O=!1,hidePopularSearchKeys:L=!1,clientSlug:T="",triggerSearchWhenChangeFilter:$,routerPush:R,onGeoLocationPermissionChange:M,onChangeLocation:N})=>{var P;let{locale:_,t:F}=(0,k.u)(),H=(0,n.useRef)(null),G=(0,n.useRef)(null),V=(0,n.useRef)(null),Q=(0,n.useRef)(null),[Y,U]=(0,n.useState)(d),{geoLocationPermission:X,geoLocationCoordinates:J}=(0,w.u)(),[ee,et]=(0,n.useReducer)(reducer,W,t=>Object.assign(Object.assign({},t),{isDebug:g,isMobile:e,geoLocationPermission:a||X||"unset",geoLocationCoordinates:i||J||null,searchKeywords:c,initialSelectedCity:o||null,selectedLocation:o||t.selectedLocation||null,searchLocationKeywords:(null==o?void 0:o.name)||t.searchLocationKeywords,autoCompleteDisabled:f,inputSearchPlaceholder:x,locale:_})),{navigateTo:ei,focusedSpecialty:eo,searchKeywords:el,geoLocationPermission:er,selectedLocation:en,initialSelectedCity:es,searchResults:ec,isLoadingSearchResults:ed}=ee,{fetchCitiesByLocation:ep,fetchCitiesByKeyword:eu,fetchSearchResults:eh,fetchAllSpecialties:eg,fetchPopularKeys:em}=function({dispatch:e,careApiDomain:t,locale:a="vi-VN",client:i=""}){let o=(0,n.useCallback)(function(i,o={}){let r=`${t}${i}`;return e({type:l.FetchCitiesStart}),fetch((0,w.h)(r,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:l.FetchCitiesFinish}))},[a]),s=(0,n.useCallback)(function({coordinates:t}){let r={},n={};t&&(r={lat:t.lat,lng:t.lng}),"ms-MY"===a&&(n.noPaging=1);let s=[o(B.P.GET_CITY_BY_IP,Object.assign(Object.assign(Object.assign({},r),n),{hospitalActive:1,client:I.C.MSD===i?"":i}))];return"zh-TW"===a?s.push(o(B.P.GET_CITIES_LIST,{noPaging:1,hospitalActive:1,client:I.C.MSD===i?"":i})):s.push(o(B.P.GET_CITIES_LIST,{noPaging:1,hospitalActive: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:l.FetchCitiesByGeoIpComplete,payload:i})}).catch(e=>console.error("error loading cities by location",e))},[a,t,e]),c=(0,n.useCallback)(function(t){return o(B.P.GET_CITIES_LIST,{keyword:t,client:i}).then(t=>{e({type:l.FetchCitiesByKeywordComplete,payload:t.cities})}).catch(e=>console.error("error loading cities by keyword",e))},[a,t,e]),d=(0,n.useCallback)(function(o,r,n,s,c){let d="specialty"===n?`${t}${B.P.GET_SEARCH_SPECIALTY}`:`${t}${B.P.GET_SEARCH_V2}`;e({type:l.FetchSearchResultsStart});let{selectedLocation:p,geoLocationCoordinates:u,selectedSpecialty:h}=r,g="";if(!p){e({type:l.FetchSearchResultsFinish});return}g=p.id===I.I?"":p.id;let m=(null==u?void 0:u.lat)||"",b=(null==u?void 0:u.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,w.h)(d,Object.assign({domain:t,searchType:n||"global",keyword:f,city:g===I.a?"":g,lat:m,lng:b,specialty_id:y,client_slug:I.C.MSD===s?"":s,msd:I.C.MSD===i?1:""},"doctor"===n&&{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"!==n&&(a="doctor"===n?t.searches.map(e=>Object.assign(Object.assign({},e),{specialties:ignoreCacarSpecialty((null==e?void 0:e.specialties)||[])})):t.searches),"specialty"===n&&(a=f?ignoreCacarSpecialty((null==t?void 0:t.specialties)||[]):ignoreCacarSpecialty((null==t?void 0:t.default)||[])),e({type:l.FetchSearchResultsComplete,payload:{key:n,searches:a||[]}}),c&&e({type:l.UpdateInitialSearchResults,payload:{key:n,searches:a||[]}})}).catch(e=>{console.log("error loading search results",{url:d,error:e})}).finally(()=>e({type:l.FetchSearchResultsFinish}))},[a,t,e]),p=(0,n.useCallback)(function(){let o=`${t}${B.P.GET_SEARCH_SPECIALTY}`;return fetch((0,w.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:l.FetchAllSpecialties,payload:ignoreCacarSpecialty(t.specialties||[])})}).catch(e=>{console.log("error loading search results",{url:o,error:e})})},[a,t,e]),u=(0,n.useCallback)(function(i){let o=`${t}${B.P.GET_SEARCH_POPULAR_KEY}`;return fetch((0,w.h)(o,{domain:t,searchType:r[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:l.FetchPopularKeys,payload:t.popular_searches||[]})}).catch(e=>{console.log("error loading search results",{url:o,error:e})})},[a,t,e]);return{fetchCitiesByLocation:s,fetchCitiesByKeyword:c,fetchSearchResults:d,fetchAllSpecialties:p,fetchPopularKeys:u}}({dispatch:et,locale:_,careApiDomain:t,client:T}),eb=(0,n.useMemo)(()=>I.L[_],[_]),[ey,{close:ef,open:ex}]=(0,C.q)(!1),ev=(0,n.useMemo)(()=>Object.assign({doctor:{name:F("booking.searchPopup.doctors"),icon:n.createElement(DoctorIcon,null),slug:eb.DOCTOR},service:{name:F("booking.searchPopup.services"),icon:n.createElement(ServiceIcon,null),slug:eb.SERVICE},hospital:{name:F("booking.searchPopup.hospitals"),icon:n.createElement(HospitalIcon,null),slug:eb.HOSPITAL}},!O&&{specialty:{name:F("booking.searchPopup.specialties"),icon:n.createElement(SpecialtyIcon,null),slug:eb.SPECIALTIES}}),[Y]),eS=(0,n.useMemo)(()=>j()(eu,400),[eu]),eC=(0,n.useMemo)(()=>j()(eh,400),[eh]),ew=(0,n.useCallback)(function({locationSlug:e,specialtyId:t}={}){var a;ef();let i="",{slug:o}=ev[Y],r="",n=I.M[_][T],s=t||(null===(a=ee.selectedSpecialty)||void 0===a?void 0:a.id)||-1,c=e||(null==en?void 0:en.slug)||"";("doctor"===Y||"hospital"===Y)&&s>0&&(r=`&specialtyId=${s}`),i="specialty"===Y?`/${o}`:`/${c}/${o}`,n&&(i+=`/${n}`),(i+=`?q=${el}${r}`)&&et({type:l.NavigateTo,payload:i})},[T,ef,Y,et,_,el,null==en?void 0:en.slug,null===(P=ee.selectedSpecialty)||void 0===P?void 0:P.id,ev]),eE=(0,n.useCallback)(function(e){$&&ew({locationSlug:e.slug}),et({type:l.SelectLocation,payload:e}),N&&N(e)},[et,e,N,ew,$]);(0,E.a)(Q,()=>{e||et({type:l.ClickOutsideInputSearchSpecialty})}),(0,n.useEffect)(()=>{var t;"denied"===er||es||et({type:l.SelectLocation,payload:{name:F("booking.searchBar.allLocations"),id:I.I,slug:null===(t=I.L[_])||void 0===t?void 0:t.ALL}}),M&&M(er,ee.geoLocationCoordinates),e&&"granted"===er&&en&&et({type:l.FocusInputSearch}),ep({coordinates:ee.geoLocationCoordinates})},[er]),(0,n.useEffect)(()=>{var e;let t=u||{name:F("booking.searchBar.allSpecialties"),id:-1,thumbnail:"",total_doctor:0,slug:eb.SPECIALTIES};if(u){(null===(e=ee.selectedSpecialty)||void 0===e?void 0:e.id)!==u.id&&et({type:l.SelectSpecialty,payload:u});return}ee.selectedSpecialty&&ee.selectedSpecialty.id===t.id||et({type:l.SelectSpecialty,payload:t})},[u,eb.SPECIALTIES,F]),(0,n.useEffect)(()=>{eg()},[]),(0,n.useEffect)(()=>{em(Y)},[Y]),(0,n.useEffect)(()=>{ei&&(R?R(ei):window.location.href=`${h}${ei}`)},[ei]),(0,n.useEffect)(()=>{eh(ee.searchKeywords,ee,Y,T,!0)},[Y]),(0,n.useEffect)(()=>{if(ey&&e){let e=setTimeout(()=>{var e;null===(e=V.current)||void 0===e||e.focus()},150);return()=>clearTimeout(e)}},[ey,e]);let ek={type:Y,isMobile:e,state:ee,dispatch:et,debouncedFetchSearchResults:eC,initalSearchValue:c,onEnterSearch:ew,typeInformation:ev,trackingAttributes:m,isLoading:ed,hideSpecialtySelection:S||O,clientSlug:T,triggerSearchWhenChangeFilter:$,onChangeSpecialty:e=>$&&ew({specialtyId:e.id})};return n.createElement(n.Fragment,null,n.createElement(z,{ref:H},n.createElement(TabSearch,{currentTab:Y,setCurrentTab:U,isMobile:e,hideTabBookingSearch:v,hideSpecialtyTab:O}),n.createElement(K,{className:"booking-search-container"},n.createElement(A,null,n.createElement(q,{className:"booking-search-content"},n.createElement("div",{ref:Q},n.createElement(y.k,{gap:"12px",align:"center",className:"flex-search-input"},n.createElement(ea,Object.assign({},ek,{ref:G,onFocusInput:()=>e&&ex()})),"specialty"!==Y&&n.createElement(SearchLocation,{state:ee,isMobile:e,dispatch:et,debouncedFetchCitiesByKeyword:eS,selectedLocation:en,onLocationClick:eE,trackingAttributes:b}),!e&&n.createElement(D.B,{size:"lg",variant:"primary",onClick:()=>ew(),styles:{root:{height:"48px",minWidth:"120px",borderRadius:"12px"}}},F("booking.searchBar.searchButton"))),!L&&"specialty"!==Y&&ee.popularKeys.length>0&&n.createElement(SearchTag,{type:Y,state:ee,typeInformation:ev,dispatch:et}),"specialty"===Y&&"search"===eo&&n.createElement(SearchResultSpecialties,{state:ee,isMobile:e,dispatch:et,specialties:(null==ec?void 0:ec.specialty)||[],isLoading:ed})))))),e&&n.createElement(ModalSearchResult,{keepMounted:!0,opened:ey,onClose:ef,closeModal:ef,searchInputEle:n.createElement(y.k,{align:"center",gap:8},n.createElement(ea,Object.assign({},ek,{onlyShowSearchBox:!0,ref:V})),n.createElement(D.B,{variant:"primary",leftIcon:n.createElement(s.Z,{size:20,color:"#fff"}),onClick:()=>ew(),styles:{root:{borderRadius:"12px"}}}))},n.createElement(p.x,{sx:{marginLeft:-16,marginRight:-16}},n.createElement(SearchResultContent,{type:Y,state:ee,dispatch:et,isLoading:ed,typeInformation:ev,clientSlug:T}))))},eb=L.Z.div` background-color: var(--neutral50); padding: 12px 0; box-shadow: inset 0px 1px 0px #e4e8ec; > * { display: grid; grid-template-columns: 32px 1fr; align-content: center; p { font-weight: 600; } } .icon-wrapper { display: flex; align-items: center; } `,TextDivider=({children:e,icon:t,className:a,style:i})=>n.createElement(eb,{style:i,className:a},n.createElement(R.C,null,n.createElement("div",{className:"icon-wrapper"},t),n.createElement(M.T,{size:"c1",color:"var(--neutral800)"},e)))},"+JSE":function(e,t,a){a.d(t,{H:function(){return HealthToolCardWrapper},T:function(){return ToolsBannerCard}});var i=a("XBaX"),o=a("q1tI"),l=a("/npG"),r=a("mYVa"),n=a("8vDj"),s=a("Eso5"),c=a("SPK5"),d=a("vaps"),p=a("CmQM"),u=a("UlxI"),h=a("HalR"),g=a("O8A1"),m=a("RVQf"),b=a("+J3I"),y=a("g+a8");let f=(0,l.k)((e,{isRevamp:t,isPregTool:a,bannerColor:i,isMarryBaby:o})=>({wrapper:{position:"relative",width:"100%",height:"100%",display:"flex",gap:(0,r.h)(24),alignItems:"center",justifyContent:"space-between",padding:(0,r.h)(16),[e.fn.smallerThan("sm")]:{gap:(0,r.h)(12)}},container:{width:"100%",backgroundColor:i||(o?e.colors.mb[1]:a?e.colors.pink[1]:e.colors.blue[1]),position:"relative",display:"flex",gap:24,alignItems:"center",justifyContent:"space-between",padding:(0,r.h)(16),[e.fn.smallerThan("sm")]:{padding:`${(0,r.h)(12)} ${(0,r.h)(16)}`},a:{textDecoration:"none",color:"inherit"},'&[data-site="marryBaby"]':{a:{textDecoration:"underline"},[b.M.mbDown]:{paddingBottom:0}},[b.M.tdDown]:{height:"auto",".hhgcomp-toolbanner-wrapper":{".hhgcomp-toolbanner-inner":{display:"flex",alignItems:"center",[b.M.mbDown]:{justifyContent:"space-between"},".hhgcomp-toolbanner-iconcontainer":{position:"relative",right:(0,r.h)(-50),bottom:(0,r.h)(-20),width:(0,r.h)(110),minWidth:0,height:"auto",minHeight:0,alignSelf:"flex-end",marginBottom:(0,r.h)(-20),[b.M.mbDown]:{right:"unset"}}}}},".embedded-review":{gap:(0,r.h)(12),display:"flex",alignItems:"center"},".embedded-review__avatar":{position:"relative",minWidth:(0,r.h)(32),img:{width:(0,r.h)(32),height:(0,r.h)(32),display:"block",borderRadius:"100%"},svg:{bottom:0,right:0,position:"absolute"}}},headingWrapper:{display:"flex",flexDirection:"column",gap:t?(0,r.h)(8):0,[e.fn.smallerThan("sm")]:{gap:4}},avatarWrapper:{position:"relative",img:{maxWidth:(0,r.h)(48),maxHeight:(0,r.h)(48)},".embedded-review__avatar":{position:"relative"}},reviewText:{a:{textDecoration:"underline",textUnderlineOffset:"2px"}},iconWrapper:{display:"flex",justifyContent:"center",alignItems:"center",width:(0,r.h)(80),height:(0,r.h)(80),borderRadius:"50%",backgroundColor:"#fff",flexShrink:0,img:{maxWidth:(0,r.h)(48),maxHeight:(0,r.h)(48)},[e.fn.smallerThan("sm")]:{width:(0,r.h)(64),height:(0,r.h)(64),img:{maxWidth:(0,r.h)(40),maxHeight:(0,r.h)(40)}}},heading:{},disclaimerIcon:{flexShrink:0}})),ToolsBannerCard=e=>{var{className:t,classNames:a,heading:l,bannerColor:r,medicalReview:d={link:"#",reviewer:"",date:""},icon:g,style:b,isPregTool:y,isRevamp:x,disclaimer:v,styles:S}=e,C=(0,i._)(e,["className","classNames","heading","bannerColor","medicalReview","icon","style","isPregTool","isRevamp","disclaimer","styles"]);let{t:w}=(0,m.u)(),E=(0,n.rZ)(),k="mb"===E.other.template,O=k?"marryBaby":"helloSites",{classes:j,cx:I}=f({isRevamp:x,isPregTool:y,bannerColor:r,isMarryBaby:k},{name:"ToolsBannerCard",styles:S,classNames:a}),L=(null==d?void 0:d.reviewer)?o.createElement(h.T,{size:"label2",as:"div",className:j.reviewText},d.avatar&&o.createElement("div",{className:"embedded-review__avatar"},o.createElement(s.x,{className:j.avatarWrapper},o.createElement("img",{src:d.avatar,alt:d.reviewer,loading:"lazy"}),o.createElement(u.Z,{size:14}))),o.createElement("div",{dangerouslySetInnerHTML:{__html:w("toolPage.toolReviewer",{expert_name:`${d.reviewer.trim()}`,date:d.date})}})):null;return o.createElement(s.x,Object.assign({className:I(t,j.container),style:b,"data-site":O},C),o.createElement(c.k,{className:j.headingWrapper},o.createElement(h.T,{className:I(j.heading,"heading"),size:"h4",as:"h2"},l),L&&o.createElement(h.T,{size:"n1"},L),v&&o.createElement(c.k,{gap:4},o.createElement(p.Z,{size:16,color:E.colors.yellow[8],className:j.disclaimerIcon}),o.createElement(h.T,{size:"c1",variant:"secondary"},v))),o.createElement(c.k,{className:j.iconWrapper},g))};var x=(0,l.k)(()=>({root:{borderTopLeftRadius:"inherit",borderTopRightRadius:"inherit"}})),v=(0,l.k)(e=>({root:{paddingTop:16,borderRadius:"inherit",[e.fn.smallerThan("sm")]:{paddingTop:8}}})),S=(0,l.k)((e,{isPregTool:t,variant:a})=>{let i="mb"===e.other.template;return{root:Object.assign(Object.assign(Object.assign({display:"flex",flexDirection:"column",borderRadius:(0,r.h)(i?16:8)},"default"===a&&{backgroundColor:"#fff",border:`1px solid ${i?e.colors.mb[2]:t?e.colors.pink[1]:e.colors.blue[2]}`}),"gray"===a&&{backgroundColor:e.colors.neutral[0]}),"violet"===a&&{backgroundColor:e.colors.violet[0]}),submitBtn:{},bodyWrapper:{},scrollAreaWrapper:{},bannerWrapper:Object.assign(Object.assign({},"gray"===a&&{backgroundColor:"transparent",padding:`${(0,r.h)(16)} ${(0,r.h)(16)} 0`}),"violet"===a&&{backgroundColor:"transparent",padding:`${(0,r.h)(16)} ${(0,r.h)(16)} 0`}),bannerHeading:Object.assign({},("gray"===a||"violet"===a)&&{fontSize:(0,r.h)(20),lineHeight:(0,r.h)(28),fontWeight:g.F.semiBold,[e.fn.smallerThan("sm")]:{fontSize:(0,r.h)(17),lineHeight:(0,r.h)(24)}}),bannerReviewText:Object.assign({},("gray"===a||"violet"===a)&&{fontSize:(0,r.h)(14),lineHeight:(0,r.h)(22),[e.fn.smallerThan("sm")]:{fontSize:(0,r.h)(12),lineHeight:(0,r.h)(18)}}),submitWrapper:Object.assign(Object.assign({[e.fn.smallerThan("sm")]:{button:{width:"100%"}},[e.fn.largerThan("sm")]:{textAlign:"right"}},"gray"===a&&{backgroundColor:e.colors.neutral[0],button:{marginTop:10}}),"violet"===a&&{backgroundColor:e.colors.violet[0],button:{marginTop:10}}),newsletterBlock:Object.assign(Object.assign({},"gray"===a&&{backgroundColor:e.colors.neutral[0]}),"violet"===a&&{backgroundColor:e.colors.violet[0]})}});let HealthToolCardWrapper=e=>{var{children:t,styles:a,classNames:l,className:r,isPregTool:n,variant:c="default",hasBodyScroll:d}=e,p=(0,i._)(e,["children","styles","classNames","className","isPregTool","variant","hasBodyScroll"]);let{classes:u,cx:h}=S({isPregTool:n,variant:c},{name:"HealthToolCardWrapper",styles:a,classNames:l});return o.createElement(g.T,{variant:g.C.LEADGEN},o.createElement(y.C.Provider,{value:{isPregTool:n,classes:u,variant:c,hasBodyScroll:d}},o.createElement(s.x,Object.assign({className:h(r,u.root)},p),t)))};HealthToolCardWrapper.Body=e=>{var{children:t,className:a,styles:l,classNames:r}=e,n=(0,i._)(e,["children","className","styles","classNames"]);let{classes:c,hasBodyScroll:p}=(0,o.useContext)(y.C),{classes:u,cx:h}=v(void 0,{name:"HealthToolCardWrapper__Body",styles:l,classNames:r});return o.createElement(s.x,Object.assign({className:h(a,u.root,c.bodyWrapper)},n),p?o.createElement(d.x,{h:"100%",type:"auto",scrollbarSize:8,className:c.scrollAreaWrapper},t):t)},HealthToolCardWrapper.Banner=e=>{var{className:t,classNames:a,styles:l}=e,r=(0,i._)(e,["className","classNames","styles"]);let{classes:n}=(0,o.useContext)(y.C),{isPregTool:s}=(0,o.useContext)(y.C),{classes:c,cx:d}=x(void 0,{name:"HealthToolCardWrapper__Banner",classNames:a,styles:l});return o.createElement(ToolsBannerCard,Object.assign({isPregTool:s,classNames:{container:n.bannerWrapper,heading:n.bannerHeading,reviewText:n.bannerReviewText},className:d(t,c.root)},r))}}}]);