import{_ as te}from"./ImageRatio.vue.0a3ccbc6.js";import{_ as oe}from"./nuxt-link.84259624.js";import{g as ie}from"./index.b668f905.js";import{f as le,g as ne,i as de,j as ae}from"./entry.213e9989.js";import{C as re,N as ue,S as ce}from"./carousel.es.49116b79.js";import{z as Z,C as B,ao as pe,G as W,S as ge,P as _e,Q as me,an as S,ae as p,af as f,k as n,ag as a,R as i,F as ee,ar as se,aj as F,ah as o,ap as D,a8 as T,au as he,H as fe,aq as we}from"./runtime-core.esm-bundler.030a571f.js";const xe={class:"attraction-list-page"},ve={key:0,class:"wrapper-carousel"},ye={class:"attraction-list"},ze={class:"item"},Pe={class:"img"},Le={class:"tour-content"},$e={class:"tour-meta"},Ae={class:"tour-offer"},Be={class:"tour-duration-price"},Se=["title"],Re={class:"tour-description2"},Ce={class:"tour-footer"},He={key:1,class:"wrapper-list pt-5"},Ie={class:"attraction-list"},ke={class:"item"},be={class:"img"},Te={class:"tour-content"},Oe={class:"tour-meta"},Ee={class:"tour-offer"},De={class:"tour-duration-price"},Ne=["title"],Ge={class:"tour-description2"},Ve={class:"tour-footer"},We={key:0,class:"pagination",style:{"text-align":"center"}},Fe={key:0},je={key:1},qe={__name:"AttractionList",props:{first:{type:Number,default:12},where:{type:Object,default:null},whereHasLocations:{type:Object,default:null},orderBy:{type:Array,default:[]},showPagination:{type:Boolean,default:!1},connectData:{type:Object},dataCustom:{type:Array,default:[]},modeList:{type:String,default:"LIST",validator(R){return["LIST","CAROUSEL"].includes(R)}}},emits:["onTotal"],async setup(R,{emit:N}){var U,Q,M,J;let C,G;const s=R,w=(d,u)=>{let r=d,c=B("");return c.value=r.substring(r.lastIndexOf("/")+1),`${r.substring(0,r.lastIndexOf("/")+1)}${u}${c.value}`},O=Z({ssr:!0,firstFetch:!0}),g=B(1),l=Z({data:[],pageSize:0,total:0,lastPage:0,loading:!1});if(((U=s.connectData)==null?void 0:U.sourceType)=="graphql"){const d=ie`
    query InitAttractionListComponent(
      $first: Int
      $page: Int
      $wherePosts: PostGroupPostsWhereWhereConditions
      $wherePostsHasLocations: PostGroupPostsHasLocationsWhereHasConditions
      $orderByPosts: [PostGroupPostsOrderByOrderByClause!]
    ) {
      postGroup(slug: "attractions") {
        id
        images
        titleEn
        titleVi
        slug
        status
        posts(
          first: $first
          page: $page
          where: $wherePosts
          hasLocations: $wherePostsHasLocations
          orderBy: $orderByPosts
        ) {
          paginatorInfo {
            count
            currentPage
            firstItem
            hasMorePages
            lastItem
            lastPage
            perPage
            total
          }
          data {
            id
            slug
            titleEn
            titleVi
            descriptionEn
            descriptionVi
            createdAt
            images
          }
        }
        createdAt
        updatedAt
      }
    }
  `,{data:u}=([C,G]=pe(()=>le(d,{first:s.first,page:g.value,wherePosts:s.where,wherePostsHasLocations:s.whereHasLocations,orderByPosts:s.orderBy})),C=await C,G(),C),{loading:r,load:c,refetch:x,onResult:L}=ne(d,{first:s.first,page:g.value,wherePosts:s.where,wherePostsHasLocations:s.whereHasLocations,orderByPosts:s.orderBy},{fetchPolicy:"no-cache"}),$=t=>{var h,A,v,e,I,y,z,P;const m=(A=(h=t==null?void 0:t.posts)==null?void 0:h.data)==null?void 0:A.map(_=>{const K=[],X=[],Y=[];return _.images.map(V=>{let b=w(V,"images-resized/400x267-");K.push(b),b=w(V,"images-resized/500x334-"),X.push(b),b=w(V,"images-resized/700x467-"),Y.push(b)}),_.imagesResized400x267=K,_.imagesResized500x334=X,_.imagesResized700x467=Y,_});l.data=m,l.pageSize=(e=(v=t==null?void 0:t.posts)==null?void 0:v.paginatorInfo)==null?void 0:e.perPage,l.total=(y=(I=t==null?void 0:t.posts)==null?void 0:I.paginatorInfo)==null?void 0:y.total,l.lastPage=(P=(z=t==null?void 0:t.posts)==null?void 0:z.paginatorInfo)==null?void 0:P.lastPage,N("onTotal",l.total)};(Q=u.value)!=null&&Q.postGroup&&$((M=u.value)==null?void 0:M.postGroup),L(({data:t})=>{$(t==null?void 0:t.postGroup)}),W([()=>s.where,()=>s.whereHasLocations],(t,m)=>{g.value=1}),W(r,()=>{l.loading=r.value}),W([g,()=>s.where,()=>s.whereHasLocations,()=>s.orderBy],()=>{if(O.firstFetch){c(void 0,{first:s.first,page:g.value,wherePosts:s.where,wherePostsHasLocations:s.whereHasLocations,orderByPosts:s.orderBy}),O.firstFetch=!1;return}x({first:s.first,page:g.value,wherePosts:s.where,wherePostsHasLocations:s.whereHasLocations,orderByPosts:s.orderBy})})}else((J=s.connectData)==null?void 0:J.sourceType)=="custom"&&ge(()=>{l.loading=!1;let d=s.dataCustom;d=d.map(u=>{var $;let r={...u},c=[],x=[],L=[];return($=u==null?void 0:u.images)==null||$.map(t=>{let m=w(t,"images-resized/400x267-");c.push(m),m=w(t,"images-resized/500x334-"),x.push(m),m=w(t,"images-resized/700x467-"),L.push(m)}),r.imagesResized400x267=c,r.imagesResized500x334=x,r.imagesResized700x467=L,r}),l.data=d});const H=B(1601),k=B(3),E=B(3),j=()=>{H.value=window.innerWidth,q()},q=()=>{H.value<768&&(k.value=1,E.value=1),H.value>=768&&H.value<992&&(k.value=2,E.value=1),H.value>=992&&(k.value=3,E.value=3)};return _e(()=>{H.value=window.innerWidth,q(),window.addEventListener("resize",j)}),me(()=>{window.removeEventListener("resize",j)}),(d,u)=>{const r=te,c=oe,x=S("a-card"),L=S("a-col"),$=S("a-row"),t=S("a-spin"),m=S("a-pagination");return p(),f("div",xe,[n(t,{spinning:i(l).loading,tip:"Loading..."},{default:a(()=>{var h,A;return[R.modeList==="CAROUSEL"?(p(),f("div",ve,[n(i(re),{"items-to-show":i(k),"items-to-scroll":i(E),"wrap-around":((A=(h=i(l))==null?void 0:h.data)==null?void 0:A.length)<i(k),transition:500},{addons:a(()=>[n(i(ue))]),default:a(()=>{var v;return[(p(!0),f(ee,null,se((v=i(l))==null?void 0:v.data,(e,I)=>(p(),F(i(ce),{key:I},{default:a(()=>[o("div",ye,[n(x,{class:"attraction-item",loading:i(l).loading,bordered:!1},{default:a(()=>[o("div",ze,[o("div",Pe,[n(c,{to:`/attractions/${e.slug}`},{default:a(()=>{var y,z,P,_;return[n(r,{ratio:"3:2",effectHover:!0,srcset:`${(y=e==null?void 0:e.imagesResized700x467)!=null&&y.length?(e==null?void 0:e.imagesResized700x467[0])+" 700w,":""} ${(z=e==null?void 0:e.imagesResized500x334)!=null&&z.length?(e==null?void 0:e.imagesResized500x334[0])+" 500w,":""} ${(P=e==null?void 0:e.imagesResized400x267)!=null&&P.length?(e==null?void 0:e.imagesResized400x267[0])+" 400w,":""}`,src:(_=e==null?void 0:e.images)!=null&&_.length?e==null?void 0:e.images[0]:"",sizes:"(min-width: 992px) 400px, (min-width: 768px) 500px, (max-width: 767px) and (min-width: 481px) 700px, (max-width: 480px) 400px, 700px",alt:e["title"+d.$t("lang-code")]},null,8,["srcset","src","alt"])]}),_:2},1032,["to"])]),o("div",Le,[o("div",$e,[o("div",Ae,[o("div",Be,[o("span",{class:"tour-duration",title:e["title"+d.$t("lang-code")]},D(e["title"+d.$t("lang-code")]),9,Se)]),o("p",Re,D(e["description"+d.$t("lang-code")]),1)])]),o("div",Ce,[n(c,{to:`/attractions/${e.slug}`,class:"ant-btn btn-click btn-view-details"},{default:a(()=>[T(" View Details")]),_:2},1032,["to"])])])])]),_:2},1032,["loading"])])]),_:2},1024))),128))]}),_:1},8,["items-to-show","items-to-scroll","wrap-around"])])):(p(),f("div",He,[n($,{gutter:24},{default:a(()=>{var v;return[(p(!0),f(ee,null,se((v=i(l))==null?void 0:v.data,(e,I)=>(p(),F(L,{xs:24,sm:24,md:12,lg:12,xl:8,key:I},{default:a(()=>[o("div",Ie,[n(x,{class:"attraction-item",loading:i(l).loading,bordered:!1},{default:a(()=>[o("div",ke,[o("div",be,[n(c,{to:`/attractions/${e.slug}`},{default:a(()=>{var y,z,P,_;return[n(r,{ratio:"3:2",effectHover:!0,srcset:`${(y=e==null?void 0:e.imagesResized700x467)!=null&&y.length?(e==null?void 0:e.imagesResized700x467[0])+" 700w,":""} ${(z=e==null?void 0:e.imagesResized500x334)!=null&&z.length?(e==null?void 0:e.imagesResized500x334[0])+" 500w,":""} ${(P=e==null?void 0:e.imagesResized400x267)!=null&&P.length?(e==null?void 0:e.imagesResized400x267[0])+" 400w,":""}`,src:(_=e==null?void 0:e.images)!=null&&_.length?e==null?void 0:e.images[0]:"",sizes:"(min-width: 992px) 400px, (min-width: 768px) 500px, (max-width: 767px) and (min-width: 481px) 700px, (max-width: 480px) 400px, 700px",alt:e["title"+d.$t("lang-code")]},null,8,["srcset","src","alt"])]}),_:2},1032,["to"])]),o("div",Te,[o("div",Oe,[o("div",Ee,[o("div",De,[o("span",{class:"tour-duration",title:e["title"+d.$t("lang-code")]},D(e["title"+d.$t("lang-code")]),9,Ne)]),o("p",Ge,D(e["description"+d.$t("lang-code")]),1)])]),o("div",Ve,[n(c,{to:`/attractions/${e.slug}`,class:"ant-btn btn-click btn-view-details"},{default:a(()=>[T(" View Details")]),_:2},1032,["to"])])])])]),_:2},1032,["loading"])])]),_:2},1024))),128))]}),_:1})]))]}),_:1},8,["spinning"]),R.showPagination&&i(l).lastPage>1?(p(),f("div",We,[n(m,{current:i(g),"onUpdate:current":u[0]||(u[0]=h=>fe(g)?g.value=h:null),pageSize:i(l).pageSize,total:i(l).total},{itemRender:a(({type:h,originalElement:A})=>[h==="prev"?(p(),f("a",Fe,[n(i(de)),T(" Previous")])):h==="next"?(p(),f("a",je,[T("Next "),n(i(ae))])):(p(),F(he(A),{key:2}))]),_:1},8,["current","pageSize","total"])])):we("",!0)])}}},Ue={class:"section-tour"},Qe={class:"container"},Me=o("h2",{class:"title-web text-center"},"Attractions",-1),Je={class:"content"},Ke={class:"button-view-all"},ts={__name:"Attractions",setup(R){const N=B({HAS:{relation:"ADDONS"}}),C=B([{column:"CREATED_AT",order:"ASC"}]);return(G,s)=>{const w=qe,O=oe,g=S("a-col"),l=S("a-row");return p(),f("section",Ue,[o("div",Qe,[n(l,{type:"flex",justify:"space-around",align:"middle"},{default:a(()=>[n(g,{span:24},{default:a(()=>[Me,o("div",Je,[n(w,{connectData:{sourceType:"graphql"},where:i(N),orderBy:i(C),first:6,modeList:"CAROUSEL"},null,8,["where","orderBy"])]),o("div",Ke,[n(O,{to:"/attractions"},{default:a(()=>[T("See All")]),_:1})])]),_:1})]),_:1})])])}}};export{ts as default};
