import{r as t,j as e,R as o}from"./react-B_SyE9nW.js";import{o as s,m as i,B as r,G as n,y as a,j as c,n as p,S as l,az as m,Z as j,W as d,P as x,a4 as u,au as h}from"./index-DVx3XUkT.js";import{S as f,N as g,b as C,c as I,d as S,e as v,P as b,f as w,F as y,a as k,g as E,h as B}from"./SearchMap-BBAveyfR.js";import{p as M,u as F,c as D}from"./Switch-a8Hc4XU-.js";import{S as T}from"./ServicesModal-CZP4rIgG.js";import{I as L,a as R,E as A,b as P}from"./EditSuccessModal-DknloC6l.js";import{u as W,a as H}from"./embla-carousel-react.esm-NewS-kch.js";import{B as N}from"./BtnSort-DkdbM27h.js";import{B as z,R as O}from"./ReviewsModal-CKQpmdmC.js";import{H as G,u as $}from"./useAutoUpdateServiceWorker-CvwvjXL3.js";import{H as U}from"./HelpMenu-Bvny7lm2.js";import{I as V}from"./index-HT-5AD7E.js";import{B as J}from"./BtnFilter-DYJK-nlF.js";import{B as Q}from"./BtnChip-FazAQ_kO.js";import{D as Z}from"./DeliveryIco-s-WO99Xm.js";import{C as _}from"./ClockIco-DD83_h6b.js";import{S as K}from"./Stack-DWxbwU3r.js";import{S as X,a as Y}from"./BtnSReply-6abPDBDT.js";import{D as q}from"./Divider-CvF4q94n.js";import{P as tt,a as et}from"./BagIco-NRTShpWn.js";import{P as ot,S as st}from"./SortProductReview-DKz-At0i.js";import{E as it}from"./EditBusinessReview-PKZQ-ev3.js";import"./history-CBi_mSPs.js";import"./styled-components-D7wwngcN.js";import"./sentry-Br0bWdGN.js";import"./BusinessReviewStore-B1li4-uN.js";import"./CoreServices-SqNJAolu.js";import"./BtnShadow-C8wlgmJV.js";import"./BackIco-8zMErfY7.js";import"./index-CWdensOV.js";import"./createSvgIcon-CRufxXOX.js";import"./BtnRestart-Y6iH4BTJ.js";import"./BtnGeneric-VNHvyqX_.js";import"./ItemLoading-B0qbhEL4.js";import"./SearchRating-B2uAkqf5.js";import"./FldText-CoGyGXSJ.js";import"./styles-Dr-0T67S.js";import"./GlobalStyles-DQe6i-JI.js";import"./RatingReview-1uOdijm5.js";import"./Grid-DRA5GTmM.js";import"./ActivityIco-DkU_vd49.js";import"./FldRadioSort-Bt-3y7YR.js";import"./BtnIconRounded-CfwY9W7B.js";import"./DownIco-B67nTPsD.js";import"./FldIngredients-BngvrW3W.js";import"./FldCuisineType-DJPkWJ2_.js";import"./BtnAccept-DuA7pTxU.js";import"./BtnCancel-B4o76N3R.js";import"./Autocomplete-B-M5Q-AZ.js";import"./index-dbPBR86R.js";import"./usePreviousProps-GIwTB3Ki.js";import"./Checkbox-Ctz9c9jx.js";import"./SwitchBase-BkR_KtPc.js";import"./listItemButtonClasses-0sZQWNAV.js";import"./AccordionSummary-BIfMWSAn.js";import"./useSlot-48k3ed2d.js";import"./FldRadio-B86iYBMu.js";import"./RatingReviewTitle-BHMCdk_D.js";import"./SubTitle-CIQFjien.js";import"./BusinessIco-DqvV2WuT.js";import"./Url-C6XTBQVE.js";import"./NoFound-CkLZ6FHd.js";import"./NoFoundIco-CCMbds0r.js";import"./PublishIco-CTt5pd1e.js";import"./PublishContext-BPIl0LWV.js";import"./PublishRedirect-Cs6SvL_-.js";import"./NoOptionsText-CNa8Bm1k.js";import"./Address-D7cjbXj0.js";import"./FldSwitch-BfSVJdBw.js";import"./PopperGoogle-CfjtFHGm.js";import"./NearIco-CYQYG08Z.js";import"./GoogleIdentityStoreContext-DPdR2OJT.js";import"./SearchIco-DTCP2lIv.js";import"./BaseList-BS6_vFm0.js";import"./BusinessContext-DGcTXG3r.js";import"./AddBusinessModal-DG9-oryx.js";import"./FldTextArea-C8EQrgi3.js";import"./FldTextSelect-CYrn0aFm.js";import"./FldAutocomplete-DdzXexOn.js";import"./FacebookIco-CJReqDRM.js";import"./Avatar-BsiN2ezt.js";import"./GenericAvatarHeader-DO7pCYOO.js";import"./Statistics-_kjfnrnV.js";import"./Tooltip-C3_xfLH8.js";import"./ImageIco-BTTHFJ5H.js";import"./MessageIco-zMTCxxwJ.js";import"./WarningIco-BqWiG8sL.js";import"./PhotoUpIco-CBJj1q9f.js";import"./ErrorIco-9lrqXIPt.js";import"./CelebrationIco-DzignSjF.js";import"./FAQIco-CLFzVWzH.js";import"./ContactContext-DBdgNkfH.js";import"./Link-BvG5xHxi.js";import"./EditIco-sjndGYzv.js";import"./TrashIco-CXUipucv.js";import"./CircleCheckIco-BY245pyQ.js";import"./TwitterIco-DhWIHfJt.js";import"./CalendarIco-1grwueIG.js";import"./index-eKDAOccZ.js";import"./InputAdornment-CMJm1Szv.js";import"./colorManipulator-DR3Qv2hV.js";import"./RatingPrice-p6_8TWOj.js";const rt=s((function(){const o=t.useContext(f);return e.jsx(T,{services:o.getServices})}));const nt=s((function(){const o=t.useContext(f),{onClickLikeImage:s,getImageProductStr:r}=o;return r.getSize?e.jsx(L.Provider,{value:{name:r.getInfo.product_name},children:e.jsx(R,{open:i.isImageDetailUser,images:r.getElements,onClickLikeImage:s,onCloseImageDetail:r.onCloseImageDetail,defaultImage:0,onCallNextItem:t=>{!r.isLoading&&r.hasMore&&t>=r.offset&&r.loadData()},totalElements:r.getCount})}):e.jsx(e.Fragment,{})})),at={position:"absolute !important",top:"0px",p:0,right:"0",mr:"2px",mt:"2px",backgroundColor:"white",height:"20px",width:"20px","&:hover":{backgroundColor:"white"},"&.Mui-focusVisible":{backgroundColor:"white"},"& .MuiSvgIcon-root":{height:"20px",width:"20px"}};const ct=s((function(){const s=t.useContext(f),i=W(),[c,p]=o.useState(!1);return e.jsxs(r,{sx:{display:"flex",alignItems:"center",width:"100%",justifyContent:"center",position:"relative",height:n.isMobile?"24px":"default"},children:[e.jsx(z,{onClick:()=>{s.onToggleExpand(),i.set("view",s.isExpanded?"list":"map"),a.replace({search:i.toString()})},expanded:s.isExpanded}),n.isMobile&&e.jsx(V,{onClick:()=>p(!0),sx:at,children:e.jsx(U,{})}),e.jsx(G,{title:"explore",open:c,setOpen:p})]})}));const pt=s((function(){const o=t.useContext(f);return e.jsx(J,{onClick:o.onClickSort,count:o.getFilterCount})}));const lt=s((function({fieldState:t,labelId:o,IcoComponent:s,onClick:i}){const r=!!t.value;return e.jsx(Q,{sx:{"&":{bgcolor:`${c[r?"yellowLight":"white"]}!important`,opacity:r?1:.8}},onClick:()=>{t.onChange(!r),null==i||i()},color:r?"primary":"secondary",icon:e.jsx(s,{color:r?"primary":"disabled"}),selected:r,label:o?p(o):void 0})}));const mt=s((function(t){return e.jsx(lt,{...t,IcoComponent:Z,labelId:"delivery"})}));const jt=s((function(){const o=t.useContext(f);return e.jsx(mt,{onClick:o.loadDataWithLoading,fieldState:o.getHasDelivery})}));function dt(t){return e.jsx(l,{...t,children:e.jsx("path",{d:"M8.5 9c1.2-3 3-5.4 4.8-6.4a9.6 9.6 0 00-8.6 4.1c-.2.2-.1.6.1.8L8.5 9zm1 .4l8.2 3.2c1.2-4.5.6-8.6-1.5-9.4-2.4-.9-5.2 2.4-6.7 6.2zm9.4-4.7c.9 2.3.5 6.1-.2 8.2l3.5 1.4c.3.1.6 0 .7-.3.3-1-.1-6.1-4-9.3zm1.3 14.4H12l2.2-6.6-2.1-.8-2.5 7.4H1.5c-.3 0-.5.3-.5.6v1.2c0 .3.2.6.5.6h18.7c.3 0 .5-.3.5-.6v-1.2c.1-.3-.2-.6-.5-.6z"})})}const xt=s((function(t){return e.jsx(lt,{...t,IcoComponent:dt,labelId:"terraces"})}));const ut=s((function(){const o=t.useContext(f);return e.jsx(xt,{onClick:o.onClickHasTerrace,fieldState:o.getHasTerrace})}));const ht=s((function(t){return e.jsx(lt,{...t,IcoComponent:_,labelId:"openNow"})}));const ft=s((function(){const o=t.useContext(f);return e.jsx(ht,{onClick:o.loadDataWithLoading,fieldState:o.getOpenNow})})),gt={width:"calc(100% - 15px)","&& .MuiChip-root":{m:"5px",minWidth:"fit-content"},"@media(min-width:768px)":{maxWidth:"608px"}},Ct={width:"100%",bgcolor:c.white,top:0,zIndex:2,pb:"5px",position:"sticky"},It={display:"flex",flexWrap:"nowrap","@media(min-width:768px)":{flexDirection:"row",alignItems:"center",justifyContent:"center"}};const St=s((function(){const{onClickFilter:o}=t.useContext(f),[s,i]=H(m);return t.useEffect((()=>{const t=setTimeout((()=>null==i?void 0:i.reInit(m)),400);return()=>clearTimeout(t)}),[i]),e.jsxs(K,{sx:Ct,alignItems:"center",children:[e.jsx(ct,{}),e.jsx(r,{sx:gt,ref:n.isMobile?s:void 0,children:e.jsxs(r,{sx:It,children:[e.jsx(pt,{}),e.jsx(N,{onClick:o}),e.jsx(jt,{}),e.jsx(ut,{}),e.jsx(ft,{})]})})]})}));const vt=s((function(){const o=t.useContext(f),s=t.useMemo((()=>o.isExpanded?n.height-(n.isMobile?132:164):66),[n.height,o.isExpanded,n.device]);return e.jsxs(K,{alignItems:"center",sx:{bgcolor:c.white,height:`${s}px`,position:"relative",transition:"height 250ms ease-out",overflow:"hidden",overflowY:o.isExpanded?"auto":void 0,maxWidth:"100vw"},children:[e.jsx(St,{}),e.jsx(g,{})]})})),bt={width:"100%",position:"sticky",top:0,display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"nowrap",px:"10px",pt:"5px",gap:.5,"@media(min-width:768px)":{maxWidth:"570px",mx:"auto",pt:"30px"}},wt={backgroundColor:"white",border:`1px solid ${c.grayLighter}`,"&:hover":{backgroundColor:"white",border:`1px solid ${c.black36}`},"&.Mui-focusVisible":{backgroundColor:"white"},"& .MuiSvgIcon-root":{height:"20px",width:"20px"}};const yt=s((function(){const s=t.useContext(f),[i,a]=o.useState(!1),{height:c,heightExp:l}=t.useMemo((()=>{let t=n.height-132,e=66;return n.isMobile||(t-=25,e=96),{height:t,heightExp:e}}),[n.height,n.device]);return e.jsxs(r,{"data-test":"enj-mobile-search-map",sx:{position:"relative",height:s.isExpanded?l:`${c}px`,transition:"height 250ms ease-out","& .gmnoprint":{display:"none!important"}},children:[e.jsx(C,{}),e.jsxs(r,{sx:bt,children:[e.jsx(I,{}),e.jsx(S,{}),n.isTablet&&e.jsx(V,{onClick:()=>a(!0),sx:wt,children:e.jsx(U,{})}),e.jsx(X.Provider,{value:{title:"shareSearch",text:p("shareSearchText")},children:e.jsx(Y,{hasShadow:!1,encodeUrl:!0})}),e.jsx(v,{})]}),e.jsx(G,{title:"explore",open:i,setOpen:a}),e.jsx(b,{})]})})),kt="--sl-h",Et={height:`var(${kt})`,display:"flow-root",maxWidth:"100vw"},Bt={"&.MuiDivider-root":{borderColor:"transparent",boxShadow:"0 10px 15px 1px #000"}};const Mt=s((function(){const o=n.height,s=t.useMemo((()=>({[kt]:o-66+"px"})),[o]);return e.jsxs(r,{sx:Et,style:s,children:[e.jsx(yt,{}),e.jsx(q,{sx:Bt}),e.jsx(vt,{}),e.jsx(w,{}),e.jsx(y,{})]})}));const Ft=s((function(){const o=W(),s=t.useContext(f),{getReviewStr:i}=t.useContext(tt);return t.useLayoutEffect((()=>(M("search",{}),j(d.SEARCH),!s.apiLoaded||"cuisineTags"===s.isFilterDifferentToDefault||o.has("reload")?s.init(Object.fromEntries(o.entries())):s.isApiLoaded&&o.has("lat")&&o.has("lng")&&x(!0),()=>{s.clear()})),[]),t.useLayoutEffect((()=>{if(s.isFilterDifferentToDefault||u.isDifferentPath||!a.location.search){const t=s.getFilters;k.forEach((e=>{o.delete(e);let i=t[e],r=!1;switch(typeof i){case"boolean":case"string":case"number":r=!!i;break;case"object":Array.isArray(i)&&(r=!!i.length,i=i.map((({value:t,label:e})=>`${t}.${e}`)).join(","))}"location"===e&&(i=s.getLocationLabel(),r&&i!==p("mapArea")&&(o.delete("lat"),o.delete("lng"),o.delete("zoom"))),"reload"===e&&(o.delete("reload"),r=!1),r&&o.append(e,i)})),a.replace({search:o.toString()})}return F("route.search"),()=>{D()}}),[JSON.stringify(s.getFilters),u.isDifferentPath]),t.useLayoutEffect((()=>{s.apiLoaded&&(s.refreshSearch(Object.fromEntries(o.entries())),s.startTrack())}),[s.apiLoaded]),t.useLayoutEffect((()=>{s.updateMapState(Object.fromEntries(o.entries()))}),[o]),t.useEffect((()=>{const t=o.get("name");return t&&h((()=>{E.value=t,E.open=!1})),()=>{h((()=>{E.value="",E.open=!1}))}}),[]),$(),e.jsxs(e.Fragment,{children:[n.isDesktop?e.jsx(B,{}):e.jsx(Mt,{}),e.jsx(rt,{}),e.jsx(nt,{}),e.jsxs(et.Provider,{value:i,children:[e.jsx(ot,{}),e.jsx(O,{}),e.jsx(st,{}),e.jsx(A,{}),e.jsx(it,{}),e.jsx(P,{})]})]})}));export{Ft as default};