import g from"./CE6lP_wf.js";import{_ as h}from"./CglRsQQc.js";import{d as w,H as v,r,f as a,h as k,m as q,j as x,k as L,l as c,t as B,w as b,p as l}from"./BCLrUOBx.js";const C={class:"flex gap-10"},H={class:"hide-sm"},O={__name:"SortBy",emits:["fetching-data"],setup(S,{emit:u}){const _=u,{t:s}=w(),t=v(),p=r(!0),d=r({featured:{title:s("featured.featured")},price_low_to_high:{title:s("listingLayout.priceLowToHigh")},price_high_to_low:{title:s("listingLayout.priceHighToLow")},avg_customer_review:{title:s("listingLayout.avgCustomerReview")}}),n=r(t.query.sortby||"");a(()=>{var o,i;let e=0;return t.query.shipping&&e++,t.query.rating&&e++,(o=t==null?void 0:t.query)!=null&&o.min&&e++,(i=t==null?void 0:t.query)!=null&&i.max&&e++,e});const f=a(()=>window&&window.innerWidth<=576),m=e=>{if(n.value){let o=Object.assign({},t.query);o={...o,sortby:e.key},_("fetching-data",o)}n.value=e.key};return k(()=>{f.value&&(p.value=!1)}),(e,o)=>{const i=g,y=h;return x(),q("div",C,[L("span",H,B(e.$t("listingLayout.sortBy")),1),c(y,null,{default:b(()=>[c(i,{class:"sort-dropdown",options:l(d),"selected-key":l(n),onClicked:m},null,8,["options","selected-key"])]),_:1})])}}};export{O as default};
