"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9526],{39526:function(e,t,a){a.d(t,{u:function(){return Ve}});var i=a(67294),o=a(3241),n=a(70917),l=a(56817),r=a(96768),s=Object.defineProperty,c=Object.defineProperties,d=Object.getOwnPropertyDescriptors,p=Object.getOwnPropertySymbols,u=Object.prototype.hasOwnProperty,h=Object.prototype.propertyIsEnumerable,g=(e,t,a)=>t in e?s(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,m=(e,t)=>{for(var a in t||(t={}))u.call(t,a)&&g(e,a,t[a]);if(p)for(var a of p(t))h.call(t,a)&&g(e,a,t[a]);return e},b=(e,t)=>c(e,d(t));const y=(0,n.F4)({"from, to":{opacity:.4},"50%":{opacity:1}});var f=(0,l.k)(((e,{height:t,width:a,radius:i,circle:o,animate:n})=>({root:{height:(0,r.h)(t),width:o?(0,r.h)(t):(0,r.h)(a),borderRadius:o?(0,r.h)(t):e.fn.radius(i),position:"relative",WebkitTransform:"translateZ(0)"},visible:{overflow:"hidden","&::before":b(m({},e.fn.cover(0)),{content:'""',background:"dark"===e.colorScheme?e.colors.dark[7]:e.white,zIndex:10}),"&::after":b(m({},e.fn.cover(0)),{content:'""',background:"dark"===e.colorScheme?e.colors.dark[4]:e.colors.gray[3],animation:n?`${y} 1500ms linear infinite`:"none",zIndex:11})}}))),x=a(64523),v=Object.defineProperty,S=Object.getOwnPropertySymbols,E=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable,w=(e,t,a)=>t in e?v(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;const k={height:"auto",width:"100%",visible:!0,animate:!0},O=(0,i.forwardRef)(((e,t)=>{const a=(0,o.N4)("Skeleton",k,e),{height:n,width:l,visible:r,animate:s,className:c,circle:d,radius:p,unstyled:u,variant:h}=a,g=((e,t)=>{var a={};for(var i in e)E.call(e,i)&&t.indexOf(i)<0&&(a[i]=e[i]);if(null!=e&&S)for(var i of S(e))t.indexOf(i)<0&&C.call(e,i)&&(a[i]=e[i]);return a})(a,["height","width","visible","animate","className","circle","radius","unstyled","variant"]),{classes:m,cx:b}=f({height:n,width:l,circle:d,radius:p,animate:s},{name:"Skeleton",unstyled:u,variant:h});return i.createElement(x.x,((e,t)=>{for(var a in t||(t={}))E.call(t,a)&&w(e,a,t[a]);if(S)for(var a of S(t))C.call(t,a)&&w(e,a,t[a]);return e})({className:b(m.root,{[m.visible]:r},c),ref:t},g))}));O.displayName="@mantine/core/Skeleton";var L=a(94151),I=a(54777),j=a(80579),$=a(69876),M=a(67841),T=a(30908),P=a(9465),_=a(26601),F=a(10917),R=a(70454),D=a(84849),K=a(47856),N=a.n(K),A=a(78577);const B=({className:e,color:t})=>i.createElement("svg",{width:"14",height:"20",viewBox:"0 0 14 20",className:e},i.createElement("path",{d:"M7 0C3.134 0 0 3.134 0 7C0 10.966 4.404 16.82 6.226 19.071C6.626 19.565 7.374 19.565 7.774 19.071C9.596 16.82 14 10.966 14 7C14 3.134 10.866 0 7 0ZM7 9.5C5.619 9.5 4.5 8.381 4.5 7C4.5 5.619 5.619 4.5 7 4.5C8.381 4.5 9.5 5.619 9.5 7C9.5 8.381 8.381 9.5 7 9.5Z",fill:t||"currentColor"})),z=_.Z.li`
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;

  > :first-child {
    flex: 1;
  }

  > :nth-child(2) {
    flex: 6;
  }

  & + li::before {
    content: '';
    position: absolute;
    left: 18px;
    right: 18px;
    top: 0;
    height: 1px;
    background-color: ${F.r.colors.neutral100};
  }
`,Z="url(\"data:image/svg+xml,%3Csvg width='19' height='14' viewBox='0 0 19 14' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M16.9803 0.990669C16.7205 0.99841 16.4739 1.10699 16.2928 1.2934L5.99984 11.5864L2.70687 8.2934C2.61473 8.19743 2.50436 8.12081 2.38223 8.06802C2.2601 8.01524 2.12867 7.98735 1.99563 7.986C1.86259 7.98464 1.73061 8.00985 1.60743 8.06014C1.48426 8.11043 1.37235 8.18479 1.27827 8.27887C1.1842 8.37295 1.10983 8.48485 1.05954 8.60803C1.00926 8.73121 0.98405 8.86318 0.985403 8.99622C0.986757 9.12926 1.01464 9.26069 1.06743 9.38282C1.12021 9.50495 1.19684 9.61532 1.29281 9.70747L5.29281 13.7075C5.48035 13.8949 5.73467 14.0002 5.99984 14.0002C6.26501 14.0002 6.51933 13.8949 6.70687 13.7075L17.7069 2.70747C17.8514 2.567 17.9501 2.38616 17.99 2.18864C18.03 1.99112 18.0093 1.78614 17.9308 1.60055C17.8523 1.41497 17.7195 1.25744 17.5499 1.14861C17.3803 1.03978 17.1817 0.984729 16.9803 0.990669Z' fill='%232685F1'/%3E%3C/svg%3E%0A\")",q=(_.Z.div`
  display: flex;
  position: absolute;
  top: 48px;
  min-width: 100%;
  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);
  border-radius: ${F.r.borderRadius};
  background-color: white;
  z-index: 30;

  ${R.M.tdDown} {
    position: relative;
    top: 0;
    box-shadow: initial;
  }
`,_.Z.ul`
  width: 100%;
  max-height: 600px;
  overflow-y: auto;
`,(0,_.Z)(B)`
  width: 12px;
  height: 18px;
`,_.Z.li`
  position: relative;
  cursor: pointer;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  overflow: hidden;

  ${({isSelected:e})=>e&&`\n        &::after {\n            content: ${Z};\n            top: 50%;\n            right: 18px;\n            position: absolute;\n            transform: translateY(-50%);\n        }\n    `}

  & + li::before {
    content: '';
    position: absolute;
    left: 18px;
    right: 18px;
    top: 0;
    height: 1px;
    background-color: ${F.r.colors.neutral100};
  }

  &:not([data-is-denied='true']):hover {
    background-color: ${F.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;
  }
`,(0,_.Z)((({count:e,className:t})=>i.createElement(i.Fragment,null,[...Array(e)].map(((e,a)=>i.createElement(z,{className:t,key:a},i.createElement(D.Z,{count:1,height:32}),i.createElement(D.Z,{count:1,height:24})))))))`
  &:first-child {
    padding-top: 18px;
  }
`,(e,t,a)=>N()(e,Object.assign(Object.assign({},t),{domain:A.v[a||"en-PH"]})));var G=a(18403),V=a(81793),H=a(23279),Y=a.n(H),W=a(16006),U=a(38860),Q=a(36834),J=function(e,t){var a={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(a[i]=e[i]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(e);o<i.length;o++)t.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(a[i[o]]=e[i[o]])}return a};var X=e=>{var{size:t,color:a=Q.SQ}=e,o=J(e,["size","color"]);const n=(0,Q.jd)(t);return i.createElement("svg",Object.assign({width:n,height:n,viewBox:"0 0 24 24",fill:"none"},o),i.createElement("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.972 10.873a6.901 6.901 0 1 1 13.803 0 6.901 6.901 0 0 1-13.803 0M10.873 2a8.873 8.873 0 1 0 5.539 15.806l3.905 3.906a.986.986 0 0 0 1.394-1.395l-3.905-3.905A8.873 8.873 0 0 0 10.873 2",fill:a}))},ee=a(49053),te=a(90177),ae=a(54770);const ie=_.Z.div``,oe=_.Z.div`
  background-color: ${F.r.colors.neutral50};
  padding-bottom: 1px;
  ${R.M.mbDown} {
    padding: 0 16px 10px;
  }
`,ne=(0,_.Z)(U.C)`
  padding: 0 16px;

  ${R.M.mbDown} {
    padding: 0;
  }
`,le=_.Z.div`
  padding: 24px 56px;
  border-radius: 16px;
  background-color: ${F.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);

  ${R.M.mbDown} {
    padding: 16px 16px;
    border-radius: 0px 0px 12px 12px;
  }

  .flex-search-input {
    flex-direction: row;
    ${R.M.mbDown} {
      flex-direction: column;
    }
  }
`,re={"en-PH":3,"tl-PH":2,"id-ID":3,"vi-VN":2,"zh-TW":0,"ms-MY":2},se={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:[]};var ce;function de(e){const{selectedLocation:t,searchLocationKeywords:a}=e;return t&&a!==t.name?Object.assign(Object.assign({},e),{searchLocationKeywords:t.name}):e}function pe(e,t){var a,i;switch(e.isDebug&&console.log("bookingSearchBar",{action:t,state:e}),t.type){case ce.NavigateTo:return Object.assign(Object.assign({},e),{navigateTo:t.payload,focused:"none",isMobileModalOpened:!1});case ce.ClickOutsideInputLocation:return"location"!==e.focused?e:de(Object.assign(Object.assign({},e),{focused:"none"}));case ce.ClickOutsideInputSpecialty:return"specialty"!==e.focused?e:de(Object.assign(Object.assign({},e),{focused:"none"}));case ce.ClickOutsideInputSearch:return"search"!==e.focused?e:Object.assign(Object.assign({},e),{focused:"none"});case ce.ClickOutsideInputSearchSpecialty:return"search"!==e.focusedSpecialty?e:Object.assign(Object.assign({},e),{focusedSpecialty:"none"});case ce.FocusInputLocation:{const t=Object.assign(Object.assign({},e),{focused:"location"});return(null===(a=e.selectedLocation)||void 0===a?void 0:a.id)===W.a&&(t.searchLocationKeywords=""),t}case ce.FocusInputSpecialty:{const t=Object.assign(Object.assign({},e),{focused:"specialty"});return(null===(i=e.selectedLocation)||void 0===i?void 0:i.id)===W.a&&(t.searchLocationKeywords=""),t}case ce.FocusInputSearch:const o=Object.assign(Object.assign({},e),{focused:"search"});return e.isMobile?de(o):o;case ce.FocusInputSearchSpecialty:return Object.assign(Object.assign({},e),{focusedSpecialty:"search"});case ce.ChangeInputLocation:return Object.assign(Object.assign({},e),{searchLocationKeywords:t.payload});case ce.ChangeInputSearch:{const a=t.payload;return Object.assign(Object.assign({},e),{searchKeywords:a,isLoadingSearchResults:a.trim().length>re[e.locale]})}case ce.SelectCurrentLocation:return Object.assign(Object.assign({},e),{focused:"none",selectedLocation:t.payload,searchLocationKeywords:t.payload.name});case ce.ClearInputLocation:return Object.assign(Object.assign({},e),{focused:"location",cities:e.initialCities,searchLocationKeywords:""});case ce.ClearInputSearch:return Object.assign(Object.assign({},e),{focused:"search",searchKeywords:""});case ce.SelectLocation:return Object.assign(Object.assign({},e),{focused:"none",selectedLocation:t.payload,searchLocationKeywords:t.payload.name});case ce.SelectSpecialty:return Object.assign(Object.assign({},e),{focused:"none",selectedSpecialty:t.payload});case ce.SelectSearchResult:return Object.assign(Object.assign({},e),{searchKeywords:t.payload.name,isMobileModalOpened:!1,focused:"none",navigateTo:t.payload.url});case ce.FetchCitiesStart:return Object.assign(Object.assign({},e),{isLoadingCities:!0});case ce.FetchCitiesFinish:return Object.assign(Object.assign({},e),{isLoadingCities:!1});case ce.FetchSearchResultsStart:return Object.assign(Object.assign({},e),{isLoadingSearchResults:!0});case ce.FetchSearchResultsFinish:return Object.assign(Object.assign({},e),{isLoadingSearchResults:!1});case ce.FetchSearchResultsComplete:return Object.assign(Object.assign({},e),{searchResults:Object.assign(Object.assign({},e.searchResults),{[t.payload.key]:t.payload.searches})});case ce.FetchCitiesByGeoIpComplete:{let{cities:a}=t.payload;const{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);const 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 ce.FetchCitiesByKeywordComplete:return Object.assign(Object.assign({},e),{cities:t.payload});case ce.DisplayInitialCities:return Object.assign(Object.assign({},e),{cities:e.initialCities});case ce.DisplayInitialSearchResults:return Object.assign(Object.assign({},e),{searchResults:e.initialSearchResults,isLoadingSearchResults:!1});case ce.UpdateInitialSearchResults:return Object.assign(Object.assign({},e),{initialSearchResults:Object.assign(Object.assign({},e.initialSearchResults),{[t.payload.key]:t.payload.searches})});case ce.GrantGeoLocationPermission:return Object.assign(Object.assign({},e),{geoLocationPermission:"granted",geoLocationCoordinates:t.payload});case ce.DenyGeoLocationPermission:return Object.assign(Object.assign({},e),{geoLocationPermission:"denied",geoLocationCoordinates:null});case ce.OpenMobileModal:return Object.assign(Object.assign({},e),{isMobileModalOpened:!0});case ce.CloseMobileModal:return Object.assign(Object.assign({},e),{isMobileModalOpened:!1});case ce.UpdateInitialSearchValue:return Object.assign(Object.assign({},e),{searchKeywords:t.payload});case ce.SetInputSearchPlaceholder:return Object.assign(Object.assign({},e),{inputSearchPlaceholder:t.payload});case ce.FetchAllSpecialties:return Object.assign(Object.assign({},e),{allSpecialties:t.payload});case ce.FetchPopularKeys:return Object.assign(Object.assign({},e),{popularKeys:t.payload});default:return e}}!function(e){e.NavigateTo="navigate to url",e.ClickOutsideInputLocation="click outside input location",e.ClickOutsideInputSearch="click outside input search",e.ClickOutsideInputSearchSpecialty="click outside input search specialty",e.ClickOutsideInputSpecialty="click outside input specialty",e.SelectCurrentLocation="select current location",e.FocusInputLocation="focus input location",e.FocusInputSearch="focus input search",e.FocusInputSearchSpecialty="focus input search specialty",e.ChangeInputLocation="change input location",e.ChangeInputSearch="change input search",e.ClearInputLocation="clear input location",e.ClearInputSearch="clear input search",e.SelectLocation="select location",e.SelectSpecialty="select specialty",e.FetchCitiesStart="fetch cities start",e.FetchCitiesFinish="fetch cities finish",e.FetchSearchResultsStart="fetch search results start",e.FetchSearchResultsComplete="fetch search results complete",e.FetchSearchResultsFinish="fetch search results finish",e.FetchCitiesByGeoIpComplete="fetch cities by geo IP finish",e.FetchCitiesByKeywordComplete="fetch cities by keyword finish",e.DisplayInitialCities="display initial cities",e.DisplayInitialSearchResults="display initial search results",e.UpdateInitialSearchResults="update initial search results",e.GrantGeoLocationPermission="grant geolocation permission",e.DenyGeoLocationPermission="deny geolocation permission",e.OpenMobileModal="open mobile modal",e.CloseMobileModal="close mobile modal",e.UpdateInitialSearchValue="update initial search value",e.SelectSearchResult="select search result",e.SetInputSearchPlaceholder="set input search placeholder",e.FocusInputSpecialty="focus input specialty",e.FetchAllSpecialties="fetch all specialty",e.FetchPopularKeys="fetch popular key by type"}(ce||(ce={}));const ue=_.Z.div`
  flex: 1;
  position: relative;

  ${R.M.mbDown} {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
`,he=_.Z.div`
  position: absolute;
  top: calc(100% + 2px);
  width: 100%;
  border-radius: 4px;
  background: ${F.r.colors.white};
  box-shadow: 0px 8px 40px 0px rgba(0, 0, 0, 0.1);
  z-index: 10;

  ${R.M.mbDown} {
    width: calc(100% + 64px);
    left: -32px;
  }
`,ge=_.Z.div``,me=_.Z.div`
  display: flex;
  justify-content: space-between;
  align-item: center;
  padding: 9px 14px 9px 22px;
  background: #f7f9fc;

  .title {
    color: ${F.r.colors.gray800};
    font-size: 14px;
    font-weight: 600;
    line-height: 22px;
  }

  .btn-see-all {
    color: ${F.r.colors.blue600};
    font-size: 14px;
    line-height: 22px;
    cursor: pointer;
  }
`,be=_.Z.div`
  padding: 10px 16px;
  max-height: 400px;
  overflow: auto;
`,ye=_.Z.div`
  display: flex;
  gap: 12px;
  align-items: center;
  cursor: pointer;

  &:hover {
    background-color: ${F.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 ${F.r.colors.neutral100};
    .title {
      color: ${F.r.colors.gray800};
      font-size: 16px;
      font-weight: 600;
      line-height: 24px;
    }
    .description {
      overflow: hidden;
      color: ${F.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;
    }
  }
`;_.Z.div`
  padding: 0 16px 16px;

  .search-detail-btn {
    color: ${F.r.colors.blue600};
    font-size: 14px;
    line-height: 22px;
    cursor: pointer;
  }
`;const fe=({state:e,type:t,results:a,location:o,isLoading:n,typeInformation:l,clientSlug:r="",dispatch:s})=>{const{locale:c,t:d}=(0,V.u)(),{selectedLocation:p}=e,u=(0,i.useMemo)((()=>l[t].slug),[l,t]);return i.createElement(ge,null,i.createElement(me,null,i.createElement("div",{className:"title"},d("booking.searchResult.description",{search_type:l[t].name,search_location:o})),a.length>0&&i.createElement("div",{className:"btn-see-all",onClick:()=>{let a=`/${p.slug}/${u}`;const i=W.M[c][r];i&&(a+=`/${i}`),("doctor"===t||"hospital"===t)&&e.selectedSpecialty.id>0&&(a+=`?specialtyId=${e.selectedSpecialty.id}`),a&&s({type:ce.NavigateTo,payload:a})}},d("home.seeAll"))),i.createElement(be,null,n&&Array(3).fill(void 0).map(((e,a)=>i.createElement(ye,{key:t+"loading"+a,className:2===a?"last-item":""},i.createElement("div",{className:"image-item"},i.createElement(O,{height:48,circle:!0,mb:"xl",animate:!0})),i.createElement("div",{className:"infor"},i.createElement("div",{className:"title"},i.createElement(O,{height:8,mt:10,radius:"xl",animate:!0})),i.createElement("div",{className:"description"},i.createElement("div",{className:"sub-description"},i.createElement(O,{height:8,mt:10,radius:"xl",width:"80%",animate:!0}))))))),!n&&a&&a.length>0&&i.createElement(i.Fragment,null,a.map(((e,o)=>{var n,r;const c=a.length>4&&3===o||a.length<=4&&o===a.length-1;let d="";return"hospital"===t&&(d=(null===e||void 0===e?void 0:e.address)||""),"doctor"===t&&(d=(null===(n=null===e||void 0===e?void 0:e.specialties)||void 0===n?void 0:n.join(", "))||""),"service"===t&&(d=(null===(r=null===e||void 0===e?void 0:e.hospital_branch)||void 0===r?void 0:r.name)||""),o>=4?i.createElement(i.Fragment,null):i.createElement(ye,{key:e.id,className:c?"last-item":"",onClick:()=>(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&&s({type:ce.NavigateTo,payload:a})})(e)},i.createElement("div",{className:"image-item"},i.createElement("img",{src:e.logo||e.avatar,alt:e.name})),i.createElement("div",{className:"infor"},i.createElement("div",{className:"title"},e.name),i.createElement("div",{className:"description"},l[t].icon,i.createElement("div",{className:"sub-description"},d))))}))),!n&&0===(null===a||void 0===a?void 0:a.length)&&i.createElement(ee.T,{size:"sm",color:F.r.colors.gray400},d("booking.searchBar.noResults"))))},xe=_.Z.div`
  position: relative;

  ${R.M.mbDown} {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
`,ve=_.Z.div`
  position: absolute;
  top: calc(100% + 2px);
  width: calc(100% + 100px);
  border-radius: 4px;
  background: ${F.r.colors.white};
  box-shadow: 0px 8px 40px 0px rgba(0, 0, 0, 0.1);
  z-index: 10;
  max-height: 300px;
  overflow: auto;

  ${R.M.mbDown} {
    width: calc(100% + 64px);
    left: -32px;
  }
`,Se=_.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;

    img {
      width: 100%;
      object-fit: cover;
    }

    svg {
      width: 40px;
    }
  }

  ${({isSelected:e})=>e&&`\n        &::after {\n            content: ${Z};\n            top: 50%;\n            right: 18px;\n            position: absolute;\n            transform: translateY(-50%);\n        }\n    `}

  & + li::before {
    content: '';
    position: absolute;
    left: 18px;
    right: 18px;
    top: 0;
    height: 1px;
    background-color: ${F.r.colors.neutral100};
  }

  &:not([data-is-denied='true']):hover {
    background-color: ${F.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;
  }
`,Ee=()=>i.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},i.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"})),Ce=()=>i.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},i.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"})),we=()=>i.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},i.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"})),ke=()=>i.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16"},i.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"})),Oe=({state:e,isMobile:t,debouncedFetchSearchResults:a,selectedLocation:o,onSpecialtyClick:n,dispatch:l})=>{var r;const{t:s,locale:c}=(0,V.u)(),d=(0,i.useRef)(null),p=(0,i.useMemo)((()=>W.L[c]),[c]),u=(0,i.useMemo)((()=>({wrapper:{"&:after":{content:'""',width:"1px",height:"20px",backgroundColor:"#E4E8EC",position:"absolute",right:0,top:"13px"}},input:{border:t?"border: 1px solid #d9d9d9":"none",height:t?"40px":"46px !important",paddingRight:"30px","&:focus":{boxShadow:t?"box-shadow: 0px 0px 0px 2px #91caff":"none"}},rightSection:{width:"30px",svg:{fontSize:"20px"}}})),[t]),h=(0,i.useCallback)((function(e){console.log(e)}),[a,l]);return(0,G.a)(d,(()=>{l({type:ce.ClickOutsideInputSpecialty})})),i.createElement(xe,{ref:d},i.createElement(L.I.Wrapper,null,i.createElement(L.I,{size:t?"md":"lg",placeholder:s("booking.searchPopup.specialties"),value:(null===(r=null===e||void 0===e?void 0:e.selectedSpecialty)||void 0===r?void 0:r.name)||"",rightSection:i.createElement(te.C,null),styles:u,onFocus:()=>l({type:ce.FocusInputSpecialty}),onChange:e=>{h(e.target.value)}})),"specialty"===e.focused&&i.createElement(ve,null,i.createElement(Se,{key:"all-location",role:"button",tabIndex:0,onClick:()=>{n&&n({name:s("booking.searchBar.allSpecialties"),id:-1,thumbnail:"",total_doctor:0,slug:p.SPECIALTIES})}},i.createElement("div",{className:"image-item"},i.createElement(ke,null)),i.createElement(ee.T,{size:"md"},s("booking.searchBar.allSpecialties"))),e.allSpecialties.map((e=>i.createElement(Se,{key:e.id,onClick:t=>{t.nativeEvent.stopImmediatePropagation(),n&&n(Object.assign(Object.assign({},e),{total_doctor:0}))},role:"button",tabIndex:0,"aria-label":`Select ${e.name} as location`,isSelected:(null===o||void 0===o?void 0:o.id)===e.id},i.createElement("div",{className:"image-item"},i.createElement("img",{src:e.thumbnail,alt:e.name})),i.createElement(ee.T,{size:"md"},e.name))))))},Le=({state:e,type:t,isMobile:a,isLoading:o,initalSearchValue:n,typeInformation:l,debouncedFetchSearchResults:r,trackingAttributes:s,hideSpecialtySelection:c=!1,clientSlug:d="",focusSearchInput:p,onSearch:u,onEnterSearch:h,dispatch:g})=>{var m;const{t:b}=(0,V.u)(),y=(0,i.useRef)(null),f=(0,i.useMemo)((()=>s?{"data-event-category":s.dataEventCategory,"data-event-action":s.dataEventAction,"data-event-label":s.dataEventLabel}:{}),[s]),x=(0,i.useMemo)((()=>"doctor"===t?b("booking.searchBar.placeholder.doctor"):"service"===t?b("booking.searchBar.placeholder.service"):"hospital"===t?b("booking.searchBar.placeholder.hospital"):"specialty"===t?b("booking.searchBar.placeholder.specialty"):""),[t]),v=(0,i.useMemo)((()=>({root:{flex:1,"&.hide-specialty-selection":{".mantine-Input-rightSection":{display:"none"},input:{paddingLeft:"48px"},".mantine-Input-icon":{left:"0"}}}})),[]),S=(0,i.useMemo)((()=>({icon:{left:"165px"},input:{color:"#262626",'&[data-with-icon="true"]':{paddingLeft:"205px",paddingRight:"16px"}},rightSection:{left:0,width:"165px",padding:"1px"}})),[]),E=(0,i.useMemo)((()=>({input:{color:"#262626"}})),[]);(0,G.a)(y,(()=>{g({type:ce.ClickOutsideInputSearch})}));const C=(0,i.useCallback)((function(a){g({type:ce.ChangeInputSearch,payload:a}),"function"!==typeof u&&(a.trim().length>re[e.locale]||n||0===a.trim().length?r(a.trim(),e,t,d):(r.cancel(),g({type:ce.DisplayInitialSearchResults})))}),[g,e,t]),w=(0,i.useCallback)((function(e){g({type:ce.SelectSpecialty,payload:e}),p()}),[g]),k=(0,i.useCallback)((e=>{13===e.keyCode&&(e.stopPropagation(),e.preventDefault(),h&&h())}),[h]);return i.createElement(ue,{ref:y},"specialty"===t?i.createElement(L.I.Wrapper,{styles:v},i.createElement(L.I,{icon:i.createElement(X,null),size:a?"md":"lg",placeholder:x,styles:E,value:e.searchKeywords,onFocus:()=>g({type:ce.FocusInputSearchSpecialty}),onChange:e=>{C(e.target.value)},onKeyDown:k})):i.createElement(i.Fragment,null,"service"===t?i.createElement(L.I.Wrapper,{styles:v},i.createElement(L.I,{icon:i.createElement(X,null),size:a?"md":"lg",name:"search-results",placeholder:x,onFocus:()=>g({type:ce.FocusInputSearch}),value:e.searchKeywords,onChange:e=>{C(e.target.value)},onKeyDown:k})):i.createElement(i.Fragment,null,a&&!c?i.createElement(i.Fragment,null,i.createElement(Oe,{state:e,isMobile:a,dispatch:g,debouncedFetchSearchResults:r,onSpecialtyClick:w}),i.createElement(L.I.Wrapper,{styles:v},i.createElement(L.I,{icon:i.createElement(X,null),size:"md",placeholder:x,value:e.searchKeywords,name:"search-results",onFocus:()=>g({type:ce.FocusInputSearch}),onChange:e=>{C(e.target.value)},onKeyDown:k}))):i.createElement(L.I.Wrapper,{styles:v,className:c?"hide-specialty-selection":""},i.createElement(L.I,Object.assign({icon:i.createElement(X,null),size:"lg",placeholder:x,styles:S,name:"search-results",autoComplete:"off",value:e.searchKeywords,onChange:e=>{C(e.target.value)},onFocus:()=>g({type:ce.FocusInputSearch}),onKeyDown:k},f,{rightSection:c?i.createElement(i.Fragment,null):i.createElement(Oe,{state:e,isMobile:a,dispatch:g,debouncedFetchSearchResults:r,onSpecialtyClick:w})})))),"search"===e.focused&&i.createElement(he,null,i.createElement(fe,{type:t,state:e,results:(null===(m=e.searchResults)||void 0===m?void 0:m[t])||[],location:e.selectedLocation.name,dispatch:g,isLoading:o,typeInformation:l,clientSlug:d}))))},Ie=_.Z.div`
  position: relative;

  ${R.M.mbDown} {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
`,je=_.Z.div`
  position: absolute;
  top: calc(100% + 2px);
  width: 100%;
  border-radius: 4px;
  background: ${F.r.colors.white};
  box-shadow: 0px 8px 40px 0px rgba(0, 0, 0, 0.1);
  z-index: 10;

  ${R.M.mbDown} {
    width: calc(100% + 64px);
    left: -32px;
  }
`,$e=_.Z.li`
  position: relative;
  cursor: pointer;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  overflow: hidden;

  ${({isSelected:e})=>e&&`\n        &::after {\n            content: ${Z};\n            top: 50%;\n            right: 18px;\n            position: absolute;\n            transform: translateY(-50%);\n        }\n    `}

  & + li::before {
    content: '';
    position: absolute;
    left: 18px;
    right: 18px;
    top: 0;
    height: 1px;
    background-color: ${F.r.colors.neutral100};
  }

  &:not([data-is-denied='true']):hover {
    background-color: ${F.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;
  }
`,Me=(0,_.Z)(B)`
  width: 12px;
  height: 18px;
  flex: 0 0 12px;
`,Te=({state:e,isMobile:t,debouncedFetchCitiesByKeyword:a,selectedLocation:o,trackingAttributes:n,onLocationClick:l,dispatch:r})=>{const{t:s,locale:c}=(0,V.u)(),d=(0,i.useRef)(null),p=(0,i.useMemo)((()=>n?{"data-event-category":n.dataEventCategory,"data-event-action":n.dataEventAction,"data-event-label":n.dataEventLabel}:{}),[n]),u=(0,i.useCallback)((function(t){r({type:ce.ChangeInputLocation,payload:t}),t.trim().length>re[e.locale]?a(t.trim()):(a.cancel(),r({type:ce.DisplayInitialCities}))}),[a,r]);return(0,G.a)(d,(()=>{r({type:ce.ClickOutsideInputLocation})})),i.createElement(Ie,{ref:d},i.createElement(L.I.Wrapper,null,i.createElement(L.I,Object.assign({size:t?"md":"lg",placeholder:"Search location",value:e.searchLocationKeywords,onFocus:()=>r({type:ce.FocusInputLocation}),onChange:e=>{u(e.target.value)}},p))),"location"===e.focused&&i.createElement(je,null,i.createElement($e,{key:"all-location",role:"button",tabIndex:0,onClick:()=>{var e;l&&l({name:s("booking.searchBar.allLocations"),id:W.I,slug:null===(e=W.L[c])||void 0===e?void 0:e.ALL})}},i.createElement(Me,{color:F.r.colors.neutral400}),i.createElement(ee.T,{size:"md"},s("booking.searchBar.allLocations"))),e.cities.map((e=>i.createElement($e,{key:e.id,onClick:t=>{t.nativeEvent.stopImmediatePropagation(),l&&l(e)},role:"button",tabIndex:0,"aria-label":`Select ${e.name} as location`,isSelected:(null===o||void 0===o?void 0:o.id)===e.id},i.createElement(Me,{color:F.r.colors.neutral400}),i.createElement(ee.T,{size:"md"},e.name))))))},Pe=_.Z.div`
  display: flex;
  flex-wrap: wrap;
  row-gap: 8px;
  column-gap: 20px;
  ${R.M.mbDown} {
    margin-top: 12px;
  }
`,_e=_.Z.div`
  display: flex;
  align-items: center;
  border-radius: 8px;
  border: 1px solid ${F.r.colors.neutral100};
  background: ${F.r.colors.white};
  padding: 8px 12px 8px 8px;
  flex: 0 0 calc(33.3% - 13px);
  gap: 12px;
  cursor: pointer;

  &:hover {
    background: ${F.r.colors.blue50};
  }

  ${R.M.tdDown} {
    flex: 0 0 calc(50% - 10px);
  }

  ${R.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: ${F.r.colors.gray800};
      font-size: 14px;
      font-style: normal;
      font-weight: 400;
      line-height: 22px;
    }

    .description {
      color: ${F.r.colors.gray600};
      font-size: 12px;
      font-weight: 400;
      line-height: 18px;
    }
  }
`,Fe=(0,_.Z)(I.i)`
  margin: 24px 0 !important;
`,Re=_.Z.div`
  display: flex;
  justify-content: center;
  margin-top: 24px;
  .show-more {
    border-radius: 4px;
    border: 1px solid ${F.r.colors.neutral200};
    padding: 12px 16px;
    cursor: pointer;
    display: inline-block;
    color: ${F.r.colors.gray800};
    font-size: 16px;
    font-weight: 600;
    line-height: 24px;

    ${R.M.mbDown} {
      width: 100%;
      text-align: center;
    }
  }
`,De=({state:e,isMobile:t,specialties:a,isLoading:o,dispatch:n})=>{const{t:l,locale:r}=(0,V.u)(),{selectedLocation:s}=e,c=(0,i.useMemo)((()=>W.L[r]),[r]),d=(0,i.useMemo)((()=>a.length>=9||e.searchKeywords.trim().length<=re[e.locale]),[e.searchKeywords,a]);return i.createElement(i.Fragment,null,!t&&i.createElement(Fe,{color:"#E4E8EC"}),i.createElement(Pe,null,a.length>0&&!o&&i.createElement(i.Fragment,null,a.map(((e,t)=>t>=9?i.createElement(i.Fragment,null):i.createElement(_e,{key:e.id,onClick:()=>(e=>{let t="";e===W.S?(t=`/${s.slug}/${c.HOSPITAL}/${W.C.GSK}/`,n({type:ce.ClickOutsideInputSearchSpecialty})):t=`/${s.slug}/${c.DOCTOR}/${e}`,n({type:ce.NavigateTo,payload:t})})(e.slug)},i.createElement("div",{className:"image-item"},i.createElement("img",{src:e.thumbnail,alt:e.name})),i.createElement("div",{className:"infor"},i.createElement("div",{className:"title"},e.name)))))),0===a.length&&!o&&i.createElement(ee.T,{size:"sm",color:F.r.colors.gray400},l("booking.searchBar.noResults")),o&&Array(6).fill(void 0).map(((e,t)=>i.createElement(_e,{key:"loading"+t},i.createElement("div",{className:"image-item"},i.createElement(O,{height:40,animate:!0})),i.createElement("div",{className:"infor"},i.createElement("div",{className:"title"},i.createElement(O,{height:20,radius:"sm",animate:!0}))))))),d&&i.createElement(Re,null,i.createElement("div",{className:"show-more",onClick:()=>{const e=`/${c.SPECIALTIES}`;n({type:ce.NavigateTo,payload:e})}},l("home.seeAll"))))},Ke=_.Z.div`
  display: flex;
  gap: 5px;
  margin-top: 16px;
  flex-wrap: wrap;
`,Ne=_.Z.div`
  color: ${F.r.colors.gray600};
  font-size: 14px;
  font-weight: 600;
  line-height: 22px;
  padding: 4px 12px;
  background: ${F.r.colors.white};
  border-radius: 32px;
  cursor: pointer;
  border: 1px solid ${F.r.colors.white};
  margin-bottom: 5px;
  border-color: ${F.r.colors.neutral100};
  background: #f7f9fc;

  &.view-all {
    border-radius: 32px;
    border-color: ${F.r.colors.blue50};
    background: ${F.r.colors.blue50};
    color: ${F.r.colors.blue600};

    &:hover {
      border-color: ${F.r.colors.blue50};
      background: ${F.r.colors.blue50};
      color: ${F.r.colors.blue600};
    }
  }

  &:hover {
    border-color: ${F.r.colors.neutral100};
    background: #f7f9fc;
  }
`,Ae=_.Z.div`
  color: ${F.r.colors.gray600};
  font-size: 14px;
  font-weight: 600;
  line-height: 22px;
  padding: 4px 0;
  background: ${F.r.colors.white};
  border-radius: 32px;
  border: 1px solid ${F.r.colors.white};
  margin-bottom: 5px;
  margin-right: 7px;
`,Be=({state:e,type:t,typeInformation:a,dispatch:o})=>{const{t:n}=(0,V.u)(),{selectedLocation:l}=e,r=(0,i.useMemo)((()=>a[t].slug),[a,t]);return i.createElement(Ke,null,i.createElement(Ae,null,n("booking.searchBar.popularKey")),e.popularKeys.map((e=>i.createElement(Ne,{key:e.id,onClick:()=>{var t;(t=e).url&&(window.location.href=t.url)}},e.keyword))),i.createElement(Ne,{className:"view-all",onClick:()=>{const e=`/${l.slug}/${r}`;e&&o({type:ce.NavigateTo,payload:e})}},n("booking.searchBar.viewAll")))},ze=_.Z.div`
  background: rgba(255, 255, 255, 0.64);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid ${F.r.colors.neutral100};
`,Ze=(0,_.Z)(U.C)`
  padding: 0 16px;
`,qe=({currentTab:e,hideTabBookingSearch:t=[],isMobile:a,setCurrentTab:o})=>{const n=(0,i.useMemo)((()=>({root:{overflowY:a?"hidden":"initial",overflowX:a?"auto":"initial"},tabsList:{background:"rgba(255, 255, 255, 0)",borderBottom:"none",flexWrap:"nowrap",".mantine-Tabs-tab":{"&:last-child":{"&:after":{display:"none"}}}},tab:{padding:a?"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:a?"14px":"16px",fontWeight:600,lineHeight:a?"22px":"24px"}})),[a]),l=(()=>{const{t:e}=(0,V.u)();return[{value:"hospital",label:e("booking.searchPopup.hospitals")},{value:"doctor",label:e("booking.searchPopup.doctors")},{value:"service",label:e("booking.searchPopup.services")},{value:"specialty",label:e("booking.searchPopup.specialties")}]})(),r=(0,i.useMemo)((()=>l.filter((e=>!t.includes(e.value)))||[]),[t,l]);return i.createElement(ze,{className:"booking-search-tab"},i.createElement(Ze,null,i.createElement(j.m,{value:e,onTabChange:e=>{o(e)},styles:n},i.createElement(j.m.List,null,r.map((e=>i.createElement(j.m.Tab,{value:e.value,key:e.value},e.label)))))))};var Ge;!function(e){e.doctor="doctor",e.service="hospital_service",e.hospital="hospital_branch"}(Ge||(Ge={}));const Ve=({isMobile:e,careApiDomain:t,geoLocationPermission:a,geoLocationCoordinates:o,initialSelectedCity:n,initialSearchValue:l="",initTypeSearch:r="hospital",initSpecialty:s,careFrontDomain:c="/care",isDebug:d=!1,gaTrackingSearchBar:p,gaTrackingLocationSearch:u,autoCompleteDisabled:h=!1,inputSearchPlaceholder:g="",hideTabBookingSearch:m=[],hideSpecialtySelection:b=!1,hidePopularSearchKeys:y=!1,clientSlug:f="",routerPush:x,onGeoLocationPermissionChange:v,onChangeLocation:S})=>{const{locale:E,t:C}=(0,V.u)(),w=(0,i.useRef)(null),k=(0,i.useRef)(null),[O,L]=(0,i.useState)(r),{geoLocationPermission:I,geoLocationCoordinates:j}=function(){const[e,t]=(0,i.useState)((()=>{if("undefined"===typeof window)return"unset";if((0,P.ej)(T.U))return"granted";const e=!location.protocol.includes("https")&&"localhost"!==location.hostname;return!navigator.geolocation||e?"denied":"unset"})),[a,o]=(0,i.useState)((()=>{if("undefined"===typeof window)return null;const e=(0,P.ej)(T.U);if(e)try{return JSON.parse(e)}catch(t){console.log(t)}return null})),n=(0,i.useCallback)((function(){navigator.geolocation&&navigator.geolocation.getCurrentPosition((e=>{const a={lat:""+Math.round(1e7*e.coords.latitude)/1e7,lng:""+Math.round(1e7*e.coords.longitude)/1e7};(0,P.d8)(T.U,JSON.stringify(a),{minutes:15}),o(a),t("granted")}),(()=>{(0,P.kT)(T.U),t("denied")}))}),[]);return(0,i.useMemo)((()=>({geoLocationPermission:e,geoLocationCoordinates:a,requestGeoLocation:n})),[e,a])}(),[_,F]=(0,i.useReducer)(pe,se,(t=>Object.assign(Object.assign({},t),{isDebug:d,isMobile:e,geoLocationPermission:a||I||"unset",geoLocationCoordinates:o||j||null,searchKeywords:l,initialSelectedCity:n||null,selectedLocation:n||t.selectedLocation||null,searchLocationKeywords:(null===n||void 0===n?void 0:n.name)||t.searchLocationKeywords,autoCompleteDisabled:h,inputSearchPlaceholder:g,locale:E}))),{navigateTo:R,focusedSpecialty:D,searchKeywords:K,geoLocationPermission:N,selectedLocation:A,selectedSpecialty:B,initialSelectedCity:z,searchResults:Z,isLoadingSearchResults:H}=_,{fetchCitiesByLocation:U,fetchCitiesByKeyword:Q,fetchSearchResults:J,fetchAllSpecialties:X,fetchPopularKeys:ee}=function({dispatch:e,careApiDomain:t,locale:a="vi-VN",client:o=""}){const n=(0,i.useCallback)((function(i,o={}){const n=`${t}${i}`;return e({type:ce.FetchCitiesStart}),fetch(q(n,o,a),{method:"GET"}).then((e=>e.json())).then((e=>1===e._status&&e._data?null===e||void 0===e?void 0:e._data:(console.log("error loading cities",e),Promise.reject(e)))).finally((()=>e({type:ce.FetchCitiesFinish})))}),[a]);return{fetchCitiesByLocation:(0,i.useCallback)((function({coordinates:t}){let i={};const l={};t&&(i={lat:t.lat,lng:t.lng}),"ms-MY"===a&&(l.noPaging=1);const r=[n(ae.P.GET_CITY_BY_IP,Object.assign(Object.assign(Object.assign({},i),l),{client:W.C.MSD===o?"":o}))];return"zh-TW"===a&&r.push(n(ae.P.GET_CITIES_LIST,{noPaging:1,client:W.C.MSD===o?"":o})),Promise.all(r).then((([t,a])=>{const i=Object.assign({},t);if(a){const e=i.cities.map((e=>e.id));i.cities=i.cities.concat(a.cities.filter((t=>!e.includes(t.id))))}e({type:ce.FetchCitiesByGeoIpComplete,payload:i})})).catch((e=>console.error("error loading cities by location",e)))}),[a,t,e]),fetchCitiesByKeyword:(0,i.useCallback)((function(t){return n(ae.P.GET_CITIES_LIST,{keyword:t,client:o}).then((t=>{e({type:ce.FetchCitiesByKeywordComplete,payload:t.cities})})).catch((e=>console.error("error loading cities by keyword",e)))}),[a,t,e]),fetchSearchResults:(0,i.useCallback)((function(i,n,l,r,s){const c="specialty"===l?`${t}${ae.P.GET_SEARCH_SPECIALTY}`:`${t}${ae.P.GET_SEARCH_V2}`;e({type:ce.FetchSearchResultsStart});const{selectedLocation:d,geoLocationCoordinates:p,selectedSpecialty:u}=n;let h="";if(!d)return void e({type:ce.FetchSearchResultsFinish});h=d.id===W.I?"":d.id;const g=(null===p||void 0===p?void 0:p.lat)||"",m=(null===p||void 0===p?void 0:p.lng)||"",b=(null===u||void 0===u?void 0:u.id)>0?null===u||void 0===u?void 0:u.id:"",y=i.trim().length>re[a]?i.trim():"";return fetch(q(c,{domain:t,searchType:l||"global",keyword:y,city:h===W.a?"":h,lat:g,lng:m,specialty_id:b,client_slug:W.C.MSD===r?"":r,msd:W.C.MSD===o?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?void 0:e._data:Promise.reject(e))).then((t=>{let a=[];"specialty"!==l&&(a=t.searches),"specialty"===l&&(a=y?t.specialties:t.default),e({type:ce.FetchSearchResultsComplete,payload:{key:l,searches:a||[]}}),s&&e({type:ce.UpdateInitialSearchResults,payload:{key:l,searches:a||[]}})})).catch((e=>{console.log("error loading search results",{url:c,error:e})})).finally((()=>e({type:ce.FetchSearchResultsFinish})))}),[a,t,e]),fetchAllSpecialties:(0,i.useCallback)((function(){const i=`${t}${ae.P.GET_SEARCH_SPECIALTY}`;return fetch(q(i,{domain:t,searchType:"",msd:W.C.MSD===o?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?void 0:e._data:Promise.reject(e))).then((t=>{e({type:ce.FetchAllSpecialties,payload:t.specialties||[]})})).catch((e=>{console.log("error loading search results",{url:i,error:e})}))}),[a,t,e]),fetchPopularKeys:(0,i.useCallback)((function(i){const o=`${t}${ae.P.GET_SEARCH_POPULAR_KEY}`;return fetch(q(o,{domain:t,searchType:Ge[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?void 0:e._data:Promise.reject(e))).then((t=>{e({type:ce.FetchPopularKeys,payload:t.popular_searches||[]})})).catch((e=>{console.log("error loading search results",{url:o,error:e})}))}),[a,t,e])}}({dispatch:F,locale:E,careApiDomain:t,client:f}),te=(0,i.useMemo)((()=>W.L[E]),[E]),de=(0,i.useMemo)((()=>({doctor:{name:C("booking.searchPopup.doctors"),icon:i.createElement(Ee,null),slug:te.DOCTOR},service:{name:C("booking.searchPopup.services"),icon:i.createElement(Ce,null),slug:te.SERVICE},hospital:{name:C("booking.searchPopup.hospitals"),icon:i.createElement(we,null),slug:te.HOSPITAL},specialty:{name:C("booking.searchPopup.specialties"),icon:i.createElement(ke,null),slug:te.SPECIALTIES}})),[O]),ue=(0,i.useMemo)((()=>Y()(Q,400)),[Q]),he=(0,i.useMemo)((()=>Y()(J,400)),[J]),ge=(0,i.useCallback)((function(e){F({type:ce.SelectLocation,payload:e}),me(),S&&S(e)}),[C,F]);function me(){var e;w.current&&(null===(e=w.current.querySelector('input[name="search-results"]'))||void 0===e||e.focus())}function be(){let e="";const{slug:t}=de[O];let a="";const i=W.M[E][f];("doctor"===O||"hospital"===O)&&_.selectedSpecialty.id>0&&(a=`&specialtyId=${_.selectedSpecialty.id}`),e="specialty"===O?`/${t}`:`/${A.slug}/${t}`,i&&(e+=`/${i}`),e+=`?q=${K}${a}`,e&&F({type:ce.NavigateTo,payload:e})}return(0,G.a)(k,(()=>{F({type:ce.ClickOutsideInputSearchSpecialty})})),(0,i.useEffect)((()=>{var t;"denied"===N||z||F({type:ce.SelectLocation,payload:{name:C("booking.searchBar.allLocations"),id:W.I,slug:null===(t=W.L[E])||void 0===t?void 0:t.ALL}}),v&&v(N,_.geoLocationCoordinates),e&&"granted"===N&&A&&F({type:ce.FocusInputSearch}),U({coordinates:_.geoLocationCoordinates})}),[N]),(0,i.useEffect)((()=>{const e=s||{name:C("booking.searchBar.allSpecialties"),id:-1,thumbnail:"",total_doctor:0,slug:te.SPECIALTIES};_.selectedSpecialty||F({type:ce.SelectSpecialty,payload:e})}),[s,_.selectedSpecialty]),(0,i.useEffect)((()=>{X()}),[]),(0,i.useEffect)((()=>{ee(O)}),[O]),(0,i.useEffect)((()=>{R&&(x?x(R):window.location.href=`${c}${R}`)}),[R]),(0,i.useEffect)((()=>{J(_.searchKeywords,_,O,f,!0)}),[A,B,O]),i.createElement(ie,{ref:w},i.createElement(qe,{currentTab:O,setCurrentTab:L,isMobile:e,hideTabBookingSearch:m}),i.createElement(oe,{className:"booking-search-container"},i.createElement(ne,null,i.createElement(le,{className:"booking-search-content"},i.createElement("div",{ref:k},i.createElement($.k,{gap:"12px",justify:"space-between",align:"center",direction:e?"column":"row",className:"flex-search-input"},"specialty"!==O&&i.createElement(Te,{state:_,isMobile:e,dispatch:F,debouncedFetchCitiesByKeyword:ue,selectedLocation:A,onLocationClick:ge,trackingAttributes:u}),i.createElement(Le,{type:O,isMobile:e,state:_,dispatch:F,debouncedFetchSearchResults:he,initalSearchValue:l,focusSearchInput:me,onEnterSearch:be,typeInformation:de,trackingAttributes:p,isLoading:H,hideSpecialtySelection:b,clientSlug:f}),i.createElement(M.z,{size:e?"md":"lg",color:"#2D87F3",fullWidth:e,variant:"filled",onClick:be,styles:{root:{height:e?"40px":"48px"}}},C("booking.searchBar.searchButton"))),!y&&"specialty"!==O&&_.popularKeys.length>0&&i.createElement(Be,{type:O,state:_,typeInformation:de,dispatch:F}),"specialty"===O&&"search"===D&&i.createElement(De,{state:_,isMobile:e,dispatch:F,specialties:(null===Z||void 0===Z?void 0:Z.specialty)||[],isLoading:H}))))))}},54770:function(e,t,a){a.d(t,{P:function(){return i}});const i={GET_CITIES_LIST:"api/lists/cities?keyword={keyword}&country_id={countryId}&site={domain}&_nopaging={noPaging}&client={client}",GET_CITY:"api/lists/cities?ids={ids}&site={domain}&longitude={longitude}&latitude={latitude}",GET_HOME_SEARCH:"api/search/?_home=1&city_id={city}&keyword={keyword}&site={domain}&latitude={lat}&longitude={lng}",GET_SEARCH_V2:"api/v2/search/?site={domain}&type={searchType}&keyword={keyword}&city_id={city}&latitude={lat}&longitude={lng}&specialty_id={specialty_id}&client_slug={client_slug}&msd={msd}",GET_CITY_BY_IP:"api/geobyip?site={domain}&latitude={lat}&longitude={lng}&_nopaging={noPaging}&client={client}",GET_DOCTOR_DETAIL:"api/doctors/{id}?site={site}",GET_HOSPITAL_DETAIL:"api/hospital/branch/{id}?site={site}",GET_SERVICE_DETAIL:"api/hospital/service/{id}?site={site}",GET_SEARCH_SPECIALTY:"api/v2/specialties/?site={domain}&type={searchType}&keyword={keyword}&city_id={city}&latitude={lat}&longitude={lng}&msd={msd}",GET_SEARCH_POPULAR_KEY:"api/search/keywords?site={domain}&sort_by={sort_by}&sort_order={sort_order}&type={searchType}"}}}]);