1import{u as z,d as Be,e as Ne,c as De,r as i,g as Fe,a as l,bG as Ee,a3 as Ie,y as We,av as He,f as F,j as T,F as Oe,b as o,M as G,A as Ye,H as je,K as Ue,I as $e,bk as ze,a4 as Ge,a5 as Ke,o as Ve}from"./index-DHGK1Dec.js";import{c as _e,s as A}from"./Places.module-Bpp1xTY8.js";import{S as qe}from"./SubNavMenu-OCcFeuK6.js";import{P as Je}from"./PlaceCard-B_W5CruB.js";import{u as Qe}from"./useSeeMore-xbIFUTIy.js";import{S as Xe}from"./SeeMoreButton-DY2kScdp.js";import{C as Ze}from"./CardSkeleton-CMi3f_yS.js";import{M as et}from"./MapPopup-p-ircolu.js";import{u as tt,A as st,a as ot}from"./AddTripPopup-Da6_M46B.js";import{S as at}from"./SuccessMessagePopup-DPN_RBqm.js";import{W as it}from"./Widget-CBVA6OPv.js";import{W as nt}from"./WidgetSkeleton-DDSc7ebp.js";import"./PlaceCard.module-DDJ6OUVF.js";import"./countryTranslationHelper-BjQP78Z-.js";import"./index-BturGVvf.js";import"./SearchInput-B0S7K9GD.js";import"./SuggestionItem-x1fNSHBo.js";import"./CustomInput-BaSa39Xg.js";import"./index.es-CM3wzE6l.js";import"./TripTypeList-DzaGYBFh.js";import"./PlacesSection.module-Ba-wFYoY.js";import"./Widget.module-bO1jjeKz.js";const Ft=()=>{const{t:C}=z("Places"),{t:n}=z("Common"),g=Be(),r=Ne(),d=De(),{language:K}=i.useContext(Fe),{loading:V,tags:_,next:P,count:rt}=l(e=>e.tags),{isAuthenticated:c}=l(e=>e.auth),{loading:lt,destination:ct}=l(e=>e.destination),{loading:pt,categories:dt}=l(e=>e.places),{data:E,loading:I,next:q,loadMore:J}=Qe(_,P,ze),{isOpen:f}=l(e=>e.popup),{cities:Q}=l(e=>e.cities),{suggestedPlaces:X,loading:Z}=l(e=>e.suggestions),{isFavoriteToggling:ee,favTogglingId:te}=l(e=>e.favorites),[se,oe]=i.useState(!1),{tripState:ae,formState:ie,formErrors:ne,citiesSearchResults:re,isSearchingCities:le,activeDestinationIndex:ce,successData:L,isAddToPopupOpen:b,travelLiteList:pe,tripPopupState:y,setFormState:M,setTripState:de,setFormErrors:ue,handleTripClick:fe,handleSubmitTrip:ge,handleSubmit:me,updateDestination:he,setActiveDestinationIndex:ve,closeAddTripPopup:we,closeSuccessMessage:W,closeAddToTrip:H}=tt(),[O,m]=i.useState({selectedLevel:null,selectedCategory:null,selectedSubcategory:null,showArrow:!0,page:1,latAndLng:"",points:"",type:"place",preview:!0}),[Se,Te]=i.useState({map:!1,gallery:!1,reviewDrawer:!1,alert:!1,comment:!1,deleteConfirm:!1,success:!1}),[Ae,h]=i.useState(""),[Ce,v]=i.useState(""),u=(e,t)=>{Te(s=>({...s,[e]:t})),r(t?Ve():F())},w=i.useRef(null),R=i.useRef(null),k=i.useRef(null),Y=i.useRef(null),{cityId:S,title:Pe,tagId:x,cityName:Le}=(g==null?void 0:g.state)??{};i.useEffect(()=>{if(x&&S)return r(Ee({tagId:x,cityId:S,page:1})),c&&r(Ie()),r(We({})),r(He({page:1,type:O.type,cityId:S})),()=>{r(F()),H()}},[r,x,S,K]);const j=(e,t)=>{if(u("map",!1),c){const s=String(t);s.includes("/")?d(`/places/details/${encodeURIComponent(s)}`):d("/places/details",{state:{id:t}})}else u("alert",!0),v(n("authAlert.viewDetails.title")),h(n("authAlert.viewDetails.description"))},be=()=>{const e=window.innerWidth;return e<=480?-20:e<=1160?-5:e<=1280?0:e<=1350?10:30},B=()=>{if(w.current&&R.current&&k.current){R.current.getBoundingClientRect().left;const e=w.current.getBoundingClientRect().left,t=w.current.offsetWidth,s=e+t,a=be();s&&(k.current.style.left=`${s+a}px`)}};i.useEffect(()=>(B(),window.addEventListener("resize",B),()=>{window.removeEventListener("resize",B)}),[]),i.useEffect(()=>{let e=window.scrollY;const t=()=>{var p,$;const s=(p=k.current)==null?void 0:p.getBoundingClientRect(),a=($=Y.current)==null?void 0:$.getBoundingClientRect();s&&a&&(s.bottom>=a.top&&window.scrollY>e?m(D=>({...D,showArrow:!1})):a.top>window.innerHeight&&window.scrollY<e&&m(D=>({...D,showArrow:!0}))),e=window.scrollY};return window.addEventListener("scroll",t),()=>{window.removeEventListener("scroll",t)}},[]);const ye=()=>{oe(!1),r(F()),m(e=>({...e,points:""}))},N=(e,t,s,a)=>{switch(e.stopPropagation(),t){case"addToFavorites":Re(e,s);break;case"addToTrip":Me(e,s,a),M(p=>({...p,type:"event"}));break;case"viewMore":j(e,s);break;case"addToStop":M(p=>({...p,stops:[...p.stops,s]}));break}},Me=(e,t,s)=>{const a=fe(e,t,s);a!=null&&a.needsAuth&&(u("alert",!0),v(n("authAlert.favorites.title")),h(n("authAlert.favorites.description")))},Re=(e,t)=>{e.stopPropagation(),c?(r(Ge(t)),r(Ke(t))):(v(n("authAlert.favorites.title")),h(n("authAlert.favorites.description")),u("alert",!0))},U=()=>{d("/login",{state:{from:g}})},ke={activeDestinationIndex:ce,setActiveDestinationIndex:ve,citiesSearchResults:re,isSearchingCities:le,updateDestination:he};i.useEffect(()=>(y.addTripPopup||b?document.body.classList.add("overflowHide"):document.body.classList.remove("overflowHide"),()=>{document.body.classList.remove("overflowHide")}),[y.addTripPopup,b]);const xe=(e,t,s)=>{if(c&&s==="viewDetail"){const a=String(t);a.includes("/")?d(`/places/details/${encodeURIComponent(a)}`):d("/places/details",{state:{id:t}})}else s==="viewList"?d("/places"):(u("alert",!0),v(n("authAlert.viewDetails.title")),h(n("authAlert.viewDetails.description")))};return T(Oe,{children:[f&&se&&o(et,{onClose:ye,state:O,setState:m,handleActions:N}),f&&Se.alert&&o(G,{onClose:()=>u("alert",!1),customClass:"modalSmTypeOne",children:o(Ye,{handleNavigateToLogin:U,title:Ce,description:Ae,buttonText:n("authAlert.favorites.button")})}),f&&y.addTripPopup&&o(st,{onClose:we,travelLiteList:pe,state:ae,setState:de,handleSubmitTrip:ge}),f&&b&&o(ot,{closeModal:()=>{H()},state:ie,setState:M,cities:Q,onSubmit:me,formErrors:ne,setFormErrors:ue,...ke,handleActions:N}),f&&L.show&&o(G,{title:"",onClose:W,customClass:"modalSmTypeOne",hideCloseButton:!0,children:o(at,{title:L.title,message:L.message,onClose:W})}),o(je,{}),T("main",{className:"page-center",ref:R,children:[T("h1",{className:_e.pageTitle,children:[Le,", #",Pe]}
1),o(qe,{activeLink:"tags"}),T("div",{className:A.placesList,ref:w,children:[V?Array.from({length:5}).map((e,t)=>o(Ze,{},t)):E.length>0?E.map((e,t)=>o(Je,{place:e,translate:C,isAuthenticated:c,handleViewMoreDetails:j,handleActions:N,isFavoriteToggling:ee&&te===e.id},t)):o("div",{className:"no-results-wrapper",children:C("Places:noResults")}),I?o(Ue,{}):P&&c&&o(Xe,{onClick:J,loading:I,next:q,translate:C}),!c&&P&&o("div",{className:A.loginButtonWrapper,children:o("button",{className:A.loginButton,onClick:U,children:n("logInButton")})})]}),o("div",{className:A.placesListbreaker,ref:Y}),Z?o(nt,{}):o(it,{data:X,title:n("peopleAlsoSeen"),count:4,handleNavActions:xe})]}),o($e,{})]})};export{Ft as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.