1import{j as t,cn as k,a as x,b as p,r as i,er as S,c as R,f as y,A as C}from"./index-QW0Z3Qxf.js";import{I as j}from"./index.es-Ce9x5BLn.js";import{S as v}from"./SkyliftCardContainer-tu1O-1lA.js";import{N as E}from"./NoResultsFoundFallback-BTsPTxRw.js";import{A as g}from"./actions-COS1B2Rj.js";import{u as I}from"./useSearchResultsShown-BYwIv1Hf.js";import{u as N}from"./useSearchResultClick-BMv83rRp.js";import"./functions-DdJvkE4g.js";import"./utils-CXQ0-jqC.js";import"./ListingCardComponentV2-CR1Rbvo4.js";import"./StarIcon-BB8HTKix.js";import"./SuccessAnimation-DUbOsSdG.js";import"./CheckIcon-DAs5eYNW.js";import"./useOutsideClickHandler-Dx04ccO2.js";import"./RenderPrice-B25KcB4k.js";function w(){return t.jsx("div",{className:"flex flex-row justify-between space-x-6",children:t.jsx("div",{className:"flex-shrink-0 w-full h-14 md:w-full md:h-24 shimmer"})})}const d=()=>t.jsx(w,{});function b({fetchSearchResults:o,skylifts:s,hasMore:c,hasNoResults:n,onResultClick:l=()=>{}}){return n?t.jsx(E,{}):s?t.jsx(j,{dataLength:s.length,hasMore:c,next:o,className:"pt-2 md:pt-4",loader:t.jsx(d,{}),endMessage:t.jsx(t.Fragment,{}),children:s.map((e,r)=>{const u=!!(e!=null&&e.isTemplate);return t.jsx(k,{elementType:"search-results-skylift-card",logImpression:!0,actionProps:{onClick:{action:"click"}},logEventProps:{eventName:"search-results-skylift-card-click",isTemplate:u,description:e==null?void 0:e.description,...u?{templateId:e==null?void 0:e._id}:{skyliftId:e==null?void 0:e._id}},children:t.jsx("div",{className:"border-b md:text-base text-md",onClick:()=>l(e,r),children:t.jsx(v,{skylift:e,openInNewTab:!0,showRedirectButton:!0},r)})})})}):t.jsx(d,{})}const h=5,A=C+"/v1/search/skylifts";function T(){const o=x(),s=p(f=>f.search.query),[c,n]=i.useState(!1),[l,e]=i.useState(!0),r=i.useRef(0),u=I(S.SERVICES),m=i.useCallback(()=>{R.get(A,{params:{limit:h,skip:r.current,q:s}}).then(f=>{const{data:a=null}=f;if(!a)throw new Error("Could not fetch Skylift search results");r.current===0&&u(a.length),r.current===0&&a.length===0&&n(!0),e(a.length>0&&a.length===h),o(g.setSkylifts(a)),r.current+=1}).catch(f=>{console.error(f),y.error("Could not fetch Skylift search results")})},[s,o,u]);return i.useEffect(()=>{r.current=0,e(!0),n(!1)},[s]),i.useEffect(()=>{m()},[m]),[l,c,m]}function K(){const[o,s,c]=T(),n=p(e=>e.search.skylifts),l=N(S.SERVICES);return t.jsx(b,{skylifts:n,hasMore:o,hasNoResults:s,fetchSearchResults:c,onResultClick:l})}export{K as default}; 2//# sourceMappingURL=index-DvEk_hXN.js.map
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.