import{r as e,j as t,z as i,V as s}from"./react-B_SyE9nW.js";import{o,j as n,B as r,G as a,w as l,S as x,N as d,n as c,b2 as p,aq as h,ao as m,y as u,ap as g}from"./index-Flm6m8Wj.js";import{U as j,I as f}from"./ItemLoading-wir9MCjq.js";import{A as b}from"./Address-CoPTZTJZ.js";import{S as w,a as y,B as v}from"./BtnSReply-ZToqTKfd.js";import{G as S}from"./GenericAvatarHeader-AzYkSuuO.js";import{N as k}from"./NoFound-BgX2Vk3k.js";import{P as M}from"./RatingReview-B-1D8CT5.js";import{L as I,R as C,S as L}from"./RatingReviewTitle-Bqj_kx7V.js";import{T as B,B as _,y as D,f as F,I as E}from"./index-C6Ujt1Uk.js";import{U as R}from"./Url-C83vkALQ.js";import{I as T}from"./ImageIco-Y8PzbnMz.js";import{L as z}from"./ListIco-CH0SGarb.js";import{a as N}from"./FldRadio-CJdXMDqh.js";import{E as W}from"./EnjBackdrop-C8mPud4I.js";import{S as P,B as $}from"./Stack-CZ7Wid7r.js";import{C as U}from"./ClockIco-CmNtRk_s.js";import{S as A,M as G,b as H,i as O}from"./SearchMap-Bu5_iDO0.js";import{B as q}from"./BtnShadow-BEdKMB6u.js";import{a as V}from"./embla-carousel-react.esm-NewS-kch.js";import{B as Y,F as K}from"./BackIco-CDsoigLi.js";import{S as Q}from"./ServicesModal-D27zwhtF.js";import{D as Z}from"./Divider-CSB2hYD2.js";const J=e.createContext({hasBackdrop:!0});const X=o((function({open:i,title:s,titleColor:o,headerBody:x=t.jsx(t.Fragment,{}),body:d=t.jsx(t.Fragment,{}),showIframe:c=!1,onClose:p,closeSelf:h=!0,headerSx:m,keepMounted:u=!1,headerHeight:g=.2*a.height+"px",bodySx:j,rightAction:f}){const{hasBackdrop:b}=e.useContext(J),w=e.useRef(!1);e.useEffect((()=>{i||(w.current=!1)}),[c,i]);const y=e.useMemo((()=>b?W:P),[b]);return t.jsxs(y,{...b?{open:i,keepMounted:u}:{},sx:{bgcolor:n.white,display:"flex",alignItems:"flex-start","& .enj-backdrop-close-btn":{background:n.black50},"& > .MuiGrid-root":{height:"100%"},"@media(min-width:1366px)":b?{height:"calc(100vh - 82px)",mt:"82px"}:void 0},children:[t.jsxs(r,{sx:{width:"100%",height:g,borderBottom:`1px solid ${n.whiteBorder}`,borderRadius:"0 0 16px 16px",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"column",position:"relative",overflow:"hidden",...m,"@media(min-width:1366px)":{borderRadius:0,height:"78px"}},children:[t.jsxs(r,{sx:{width:"100%",display:"flex",flexDirection:"row",position:"relative",zIndex:2,alignItems:"center",px:"15px","@media(min-width:1366px)":{maxWidth:"900px","& > .MuiButtonBase-root":{position:"relative"}}},children:[p?t.jsx(N,{onClick:()=>{h&&l(),null==p||p()}}):t.jsx(t.Fragment,{}),t.jsx(B,{sx:{cursor:"text",userSelect:"text"},dataTest:"enj-list-name",text:s,color:o,maxWidth:"80%",variant:"h1",align:"center"}),f]}),x]}),t.jsx(r,{sx:{position:"relative",height:`calc(${a.height}px - ${g})`,...j},children:d})]})}));function ee({...e}){return t.jsx(x,{...e,children:t.jsx("path",{d:"M19 3H5v18l7-3 7 3V3z"})})}const te={display:"flex",alignItems:"center",mt:"5px",justifyContent:"flex-start"},ie={width:"14px",height:"14px",color:n.grayLighter,position:"relative",top:"-1px"};const se=o((function({updated_at:e,num_elements:i,visibility:s,isList:o,showClock:a=!0}){return t.jsx(r,{sx:te,className:"enj-updated-at",children:o?t.jsx(d,{size:"minim",align:"start",margin:"0 -20px 0 0",fontStyle:"italic",children:c("listInfo",{num_elements:t.jsxs(r,{component:"span",sx:{fontStyle:"normal"},children:[t.jsx(ee,{sx:{"&.MuiSvgIcon-root":{width:"auto",height:"14px",color:n.grayLighter,position:"relative",top:"3px"}}}),i]}),updatedAt:p(e),visibility:s?c(s):""})}):t.jsxs(t.Fragment,{children:[a?t.jsx(U,{sx:ie}):t.jsx(t.Fragment,{}),t.jsxs(d,{size:"minim",fontStyle:"italic",align:"start",margin:a?"0 0 0 3px":"0",children:[c("updated")," ",p(e)]})]})})})),oe={DESKTOP:144,TABLET:115,MOBILE:117},ne={display:"flex",justifyContent:"center",alignItems:"center",margin:"15px 15px 5px 15px"},re={background:n.red,width:"fit-content",mx:"auto",my:"15px",borderRadius:"30px",p:"2px",height:"36px",display:"flex",justifyContent:"space-between",alignItems:"center","& .MuiButtonBase-root":{width:"32px",height:"31px",borderRadius:"30px",color:n.white,"&:not(.enj-active) .MuiSvgIcon-root":{color:n.white,opacity:.8},"&.enj-active":{opacity:1,background:n.white,color:n.red},"&.Mui-disabled":{color:n.white,fontWeight:"normal",opacity:.4,background:"transparent"}}},ae={"&":{"& > .MuiDialog-container > .MuiDialog-paper":{display:"flex",flexDirection:"row",maxWidth:"100%",width:"100%"}},"& *":{scrollbarWidth:"none","-ms-overflow-style":"none","&::-webkit-scrollbar":{display:"none"}}},le={display:"flex",flexWrap:"nowrap",width:"max-content"},xe=o((()=>e.useContext(j).getDetailStr.isLoading?null:t.jsxs(P,{children:[t.jsx(d,{size:"mini",margin:"15px auto",children:c("noListData")}),t.jsx(k,{height:"180px"})]}))),de=o((()=>{const i=e.useContext(j),s=e.useMemo((()=>i.getDetailStr),[i.getDetailStr]);return s.hasMore&&s.isLoading?t.jsx(f,{}):t.jsx(t.Fragment,{})})),ce=new Map,pe={align:"start",skipSnaps:!0};const he=o((function(){const{hasBackdrop:o}=e.useContext(J),[l,x]=e.useState(!0),[p,f]=e.useState(!1),[k,N]=e.useState([]),[W,U]=V(a.isDesktop?{skipSnaps:!1}:pe),[{prev:ee,next:te},ie]=e.useState({prev:!0,next:!0}),{width:he}=((t,i=a.width,s=40)=>e.useMemo((()=>{const e=(i-(s+5*(t-1)))/t;return{width:e,height:e/(4/3)}}),[t,a.width]))(1,a.isMobile?void 0:a.isTablet?655:734,30),me=e.useContext(j),ue=e.useMemo((()=>me.getDetailStr),[me.getDetailStr]),ge=e.useCallback((()=>ue.loadData()),[]),je=e.useContext(A),{map:fe}=i(),{front_picture:be,description:we,is_default_front_picture:ye,main_picture:ve,name:Se="",liIsList:ke,show_rank:Me=!1,url:Ie}=e.useMemo((()=>{const e=me.getList||{};return e.liIsList=(null==e?void 0:e.type)===I.TYPE_LIST,e.url=`${window.location.origin}${h("route.list.build",{slug:e.slug})}`,e}),[me.getList]),Ce=e.useMemo((()=>he-138),[he]);e.useEffect((()=>{const e=setTimeout((()=>!me.getShowListDetail&&x(!0)),300);return()=>clearTimeout(e)}),[me.getShowListDetail]),e.useEffect((()=>{ke&&x(!0)}),[ke]);const Le=e.useCallback((()=>{U&&ie({prev:!U.canScrollPrev(),next:!U.canScrollNext()})}),[U]),Be=e.useCallback((()=>{null==U||U.scrollPrev(),Le()}),[U]),_e=e.useCallback((()=>{null==U||U.scrollNext(),Le()}),[U]),De=()=>{f(!0)};e.useLayoutEffect((()=>(m.setGetLocation(!1),m.onMapLoaded((()=>{let e=1;ce.clear(),ue.getElements.forEach((({location:t,businessName:i,businessSlug:s})=>{if(t){const o=ce.get(s);if(o){const e=(o.count??0)+1;ce.set(s,{...o,count:e})}else ce.set(s,{name:i,slug:s,location:t,count:1,startIndex:e++})}})),ce.forEach((e=>{var t;m.addMarker({id:e.slug??"",position:{lat:e.location.coordinates[1]??0,lng:e.location.coordinates[0]},label:(null==(t=e.startIndex)?void 0:t.toString())??" ",multi:(e.count??0)>1,onClick:(e,t)=>{N(t?ue.getElements.filter((({businessSlug:t})=>t===e)):[])}})})),m.fitBoundsForMarkers()})),()=>{N([]),m.clear(),m.setGetLocation(!0)})),[p]),e.useEffect((()=>{k.length&&(null==U||U.reInit(pe));const e=setTimeout((()=>{Le()}),400);return()=>{clearTimeout(e)}}),[k,U]),e.useLayoutEffect((()=>{fe&&fe===c("map")&&De()}),[]);const Fe={zIndex:2,width:a.isDesktop?"516px":a.isTablet?"428px":"325px",py:"5px",position:"absolute",bottom:a.isMobile?"10px":"4px",height:"fit-content",marginLeft:"auto",marginRight:"auto",display:k.length?"flex":"none",alignItems:"center",left:0,right:0},Ee={"& .MuiIconButton-root.MuiButtonBase-root,&.MuiIconButton-root.MuiButtonBase-root":{backgroundColor:"white",width:"28px",height:"28px"},"& > .MuiSvgIcon-root":{height:"18px",width:"auto",color:n.gray},border:"1px solid gray",zIndex:4};return t.jsxs(t.Fragment,{children:[t.jsx(X,{closeSelf:!1,onClose:!o&&me.isFirst?()=>u.goBack():me.onCloseListDetails,open:me.getShowListDetail,title:Se,titleColor:"white",rightAction:t.jsx(w.Provider,{value:{url:Ie,title:"shareList",text:c("shareListText",{name:Se})},children:t.jsx(y,{})}),bodySx:{width:"100vw","@media(min-width:768px)":{maxWidth:"652px",mx:"auto",width:"100%"},"@media(min-width:1366px)":{width:"750px",maxWidth:"750px",height:`calc(${a.height}px - 160px)`}},body:t.jsxs(t.Fragment,{children:[we?t.jsxs(r,{sx:{width:"100%",px:"20px",py:"15px",textAlign:"center"},children:[we,t.jsx(Z,{sx:{width:"100%",mt:"15px"}})]}):t.jsx(t.Fragment,{}),t.jsxs(r,{sx:ne,children:[!ke&&a.isMobile&&ue.getElements.length?t.jsxs(r,{sx:re,children:[t.jsx(_,{className:l?"enj-active":"",onClick:()=>x(!0),children:t.jsx(z,{})}),t.jsx(_,{className:l?"":"enj-active",onClick:()=>x(!1),children:t.jsx(T,{})})]}):t.jsx(t.Fragment,{}),Boolean(ue.getElements.length)&&"TYPE_LIST"!==ue.getInfo.type&&t.jsx($,{variant:"outlined",startIcon:t.jsx(G,{}),onClick:De,sx:{fontSize:"12px",...a.isMobile?{position:"absolute",right:"15px"}:{}},children:c("viewMap")})]}),t.jsx(r,{sx:{width:"100%",height:`calc(100% - ${o?66:120}px)`},children:t.jsx(s,{style:{height:"100%",width:"100%"},data:ue.getElements,endReached:ge,overscan:1.25*a.height,rangeChanged:ue.hasMore?({endIndex:e})=>{e>=ue.offset&&!ue.isLoading&&ue.loadData()}:void 0,components:{Footer:de,EmptyPlaceholder:xe},itemContent:(e,{parentUuid:i,refUuid:s,item_identifier:o,order:x,main_picture:p,route:m,rating:j,num_reviews:f,name:w,address:y,full_address:k,businessName:M,city:_,isBusiness:D,isList:F,profile_name:E,updated_at:T,note:z,username:N,type:W,is_bookmarked:$,count:U,is_editable:A,businessRoute:G,slug:H})=>t.jsxs(r,{sx:{width:"calc(100% - 30px)",mx:"auto",position:"relative",display:"flex",flexDirection:l?"row":"column",alignItems:l?"center":"flex-start",p:"20px 0 15px","&& .enj-av-img-box":{minWidth:l?a.isMobile?"64px":"225px":`${he}px`,width:l?a.isMobile?"64px":"225x":`${he}px`,height:l?a.isMobile?"64px":"154px":he*(3/4)+"px",borderRadius:a.isMobile?void 0:"20px","& picture, & img":{width:"100%",height:"100%"}},"&:not(:last-of-type)":{borderBottom:`1px solid ${n.grayLighter}80`},"&& .enj-btn-base-address":{mt:"5px",alignItems:"center","& .MuiSvgIcon-root":{width:"26px",height:"26px",position:"unset"}}},children:[F?t.jsx(R,{route:h("route.list.build",{slug:H})}):t.jsx(t.Fragment,{}),A&&me.isMyList||!me.isMyList?t.jsx(v,{is_bookmarked:$,listType:F?I.TYPE_LIST:W,name:w,src:p,num_reviews:f,rating:j,note:z,order:x,count:U,fromMyProfile:me.isMyList,item_identifier:o,refUuid:s,parentUuid:i,isDetails:!0,cb:me.onBookmarkCbDetails}):t.jsx(t.Fragment,{}),Me?t.jsx(P,{sx:{m:l?"0":"0 0 6px",height:a.isMobile?l?"64px":void 0:"154px",alignSelf:"flex-start",width:"36px",minWidth:"36px"},children:t.jsx(B,{text:`N°${String(x)}`,align:"start",size:"mini",weight:500})}):t.jsx(r,{sx:{height:"20px"}}),t.jsxs(S,{mid:!!a.isMobile&&l,square:!0,src:p,alt:c("alt.top.list"+(_?".city":""),{name:w,city:_}),margin:"0",imgWidth:a.isMobile?void 0:168,imgHeight:a.isMobile?void 0:114,onClickAvatar:()=>{F?me.onClickShowSubItemDetail(o):m&&u.push(m)},sx:{alignItems:"flex-start",flexDirection:l?"row":"column",width:he-(l?60:0)+"px","& p":{...l?{maxWidth:`${Ce}px`,display:"-webkit-box","-webkit-box-orient":"vertical","-webkit-line-clamp":"2",overflow:"hidden"}:{}}},bodyContainerMargin:l?a.isMobile?"0 0 0 8px":"0 0 0 20px":"0",onClick:()=>m&&u.push(m),children:[t.jsx(R,{route:m}),t.jsx(C,{onClick:()=>F&&((e,t)=>{me.onClickShowSubItemDetail(e),u.push(h("route.list.build",{slug:t}))})(o,H),titleMargin:l?"0":"12px 0 2px",titleVariant:"h2",rating:j,reviews:f,title:w,titleSize:l?a.isMobile?void 0:a.isTablet?"micro":"small":"micro",ratingCmp:F?T?t.jsx(se,{updated_at:T,showClock:!0}):t.jsx(t.Fragment,{}):void 0}),!a.isMobile&&G?t.jsx(b,{address:D?G:[M,_],onClick:D?void 0:()=>u.push(G),viewInMapOnClick:D,full_address:D?k:"",route:D?void 0:G,city:_}):t.jsx(t.Fragment,{}),!a.isMobile&&z?t.jsx(L,{margin:"12px 0 0",align:"start",size:"micro",baseReadMore:oe,children:z||""}):t.jsx(t.Fragment,{}),F?t.jsxs(t.Fragment,{children:[t.jsx(R,{route:g(N)}),t.jsx(d,{size:"mini",margin:"10px 0 0",align:"start",children:c("createdBy",{user:t.jsx(d,{size:"mini",color:"red",onClick:e=>{e.stopPropagation(),me.onClickRouteProfile(g(N),N)},children:E})})})]}):t.jsx(t.Fragment,{})]}),l?t.jsx(t.Fragment,{}):t.jsxs(t.Fragment,{children:[y||M?t.jsx(b,{address:y??[M||"-",_||"-",m],viewInMapOnClick:D,full_address:k,alignItems:"flex-start",iconMargin:"0",route:m,city:_}):t.jsx(t.Fragment,{}),z?t.jsx(L,{margin:"12px 0 0",align:"start",size:"micro",baseReadMore:oe,children:z||""}):t.jsx(t.Fragment,{})]})]})})})]}),headerSx:{position:"sticky",top:0,zIndex:1,mt:"-1px",bgcolor:n.red},headerHeight:a.isMobile?void 0:"122px",headerBody:a.isMobile?t.jsx(r,{sx:{position:"absolute",width:"100%",height:"100%",bgcolor:n.red,zIndex:0,filter:!be&&!ve||ye?"unset":"brightness(0.5)","& img":{objectFit:"cover",width:"100%",height:"100%"}},children:!be&&!ve||ye?t.jsx(t.Fragment,{}):t.jsx(M,{src:be||ve})}):void 0}),t.jsxs(D,{fullScreen:!0,fullWidth:!0,open:p,sx:ae,children:[t.jsx(r,{sx:{"&":{position:"absolute",m:"20px",right:0,zIndex:2}},children:t.jsx(q,{onClick:()=>f(!1),children:t.jsx(F,{})})}),t.jsx(H,{}),t.jsxs(r,{sx:Fe,children:[a.isDesktop&&k.length>1&&t.jsx(r,{sx:{width:"28px",height:"28px",marginRight:"-15px"},children:t.jsx(E,{sx:{...Ee,display:ee?"none":"blok"},onClick:Be,disabled:ee,children:t.jsx(Y,{sx:{color:"gray"}})})}),t.jsx(r,{component:"div",ref:W,sx:{width:"100%",overflow:"hidden"},children:t.jsx(r,{sx:le,children:k.map((({businessName:e,businessSlug:i,city:s,full_address:o,main_picture:n,name:r,num_reviews:a,phone_number:l,secondary_phone_number:x,has_delivery:d,rating:c,slug:p,price:h,businessRoute:m,type:u,address:g})=>t.jsx(O,{type:String(u),name:String(r),address:[u.includes("BUSINESS")?g:e,o,m],rating:Number(c),reviews:Number(a),src:String(n),price:Number(h),currency:String("EUR"),has_delivery:d,businessSlug:String(i),slug:String(p),city:String(s),phone_number:l,secondary_phone_number:x,business:e,forList:!0},p)))})}),a.isDesktop&&k.length>1&&t.jsx(r,{sx:{width:"28px",height:"28px",marginLeft:"-15px"},children:t.jsx(E,{size:"small",sx:{...Ee,display:te?"none":"blok"},onClick:_e,disabled:te,children:t.jsx(K,{sx:{color:"gray"}})})})]})]}),t.jsx(Q,{services:je.getServices})]})}));const me=o((function(){return e.useContext(j).haveDetails?t.jsx(he,{}):t.jsx(t.Fragment,{})}));export{ee as B,me as U,se as a,oe as b,J as c};