1import{aZ as F,bj as W,bw as G,bb as a,cq as q,bk as n,bn as O,bo as j,bp as H,bq as K,bh as R,b0 as U,b5 as b,bi as V,a$ as Z}from"#entry";import{b as w}from"./CZ_ZJkug.js";import{m as S}from"./DX86mQpf.js";import{w as _,k as z,m as J,S as Q}from"./BM7SgFZz.js";import{A as X}from"./Dv5c45rY.js";import{_ as Y}from"./C1P6tDhY.js";import{P as ee}from"./HTlnSN7o.js";import"./BJpbbBCV.js";import"./wPRrSWjA.js";import"./BJ_vMnxU.js";import"./Bqp0qfwT.js";import"./DktwDxOf.js";import"./CkdhRD17.js";import"./6ShroVNk.js";import"./BUyFoN4y.js";try{(function(){var r=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new r.Error().stack;s&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[s]="ece53e76-67c5-4003-9b81-b657ec5a95b2",r._sentryDebugIdIdentifier="sentry-dbid-ece53e76-67c5-4003-9b81-b657ec5a95b2")})()}catch{}const fe=F({__name:"best-sellers",setup(r){const{t:s,locale:f}=W(),d=q(),{withGlobalLoading:k}=G(),o=a(()=>d.params.gender),I=a(()=>{switch(o.value){case"women":return _;case"men":return J;case"kids":return z;default:return _}}),g=a(()=>{switch(o.value){case"women":return"Women";case"men":return"Men";case"kids":return"Kids";default:return"Women"}}),B=a(()=>`${s(`nav.${o.value}`)} - ${s("nav.bestSellers")}`),L=a(()=>s("bestSellers.description")),M=a(()=>[{label:s("nav.home"),href:"/"},{label:s(`nav.${o.value}`),href:`/category/${o.value}`},{label:s("nav.bestSellers"),href:""}]),i=n([]),P=n(0),c=n(!1),m=n(!1),u=n(!1),p=n(null);n({sort_by:"popular",min_price:void 0,max_price:void 0,limit:20});const $=a(()=>i.value||[]),E=async(e=!1)=>{try{m.value=!0,p.value=null;const t=await w.getBestSellers(g.value);if(t){const v=S(t.result.data);e?i.value=v:i.value=[...i.value,...v],P.value=t.result?.total||0,c.value=t.result.data.length>0}else throw new Error("Failed to load best sellers")}catch(t){console.error(`â Error loading ${o.value} best sellers:`,t),p.value=t.message||"Failed to load best sellers"}finally{m.value=!1}},y=async(e=!1)=>{await k(()=>E(e),`Loading ${o.value} best sellers...`)},N=e=>{},T=a(()=>[{id:1,text:s("announcements.freeShipping"),type:"info"},{id:2,text:s("announcements.newCollection"),type:"success"}]),x=n([]);let l=null;const C=()=>{l&&l.disconnect(),l=new IntersectionObserver(t=>{t[0].isIntersecting&&c.value&&!u.value&&A()},{threshold:.1});const e=document.getElementById("load-more-trigger");e&&l.observe(e)},D=()=>{l&&(l.disconnect(),l=null)},A=async()=>{if(!(u.value||!c.value))try{u.value=!0;const e=await w.getBestSellers(g.value);if(e){const t=S(e.result.data);i.value=[...i.value,...t],c.value=e.result.data.length>0}}catch(e){console.error(`â Error loading more ${o.value} best sellers:`,e)}finally{u.value=!1}};O(async()=>{await y(),await j(),C()}),H(()=>{D()}),K(()=>d.fullPath,async()=>{await y()});const h={en:{men:{title:"Locally | Men's Best Sellers",description:"Shop Locallyâs best-selling menâs clothes, featuring top picks from Egyptian designers that combine style, comfort, and everyday wearability."},women:{title:"Locally | Women's Best Sellers",description:"Shop Locallyâs best-selling womenâs clothes, showcasing favorite pieces from Egyptian designers for effortless style and versatile outfits."}}};return R({title:a(()=>h[f.value][d.params.gender]?.title||"Locally - best sellers"),meta:[{name:"description",content:a(()=>h[f.value][d.params.gender]?.title||"Shop the best locally designed products for men, women, and kids")}]}),(e,t)=>(Z(),U("div",null,[b(Q,{links:I.value},null,8,["links"]),b(X,{announcements:T.value,"discount-banners":x.value},null,8,["announcements","discount-banners"]),b(Y,{"show-breadcrumb":!0,"breadcrumb-items":M.value,"show-page-header":!0,title:B.value,subtitle:L.value,error:p.value,"is-loading":m.value},{default:V(()=>[b(ee,{products:$.value,"is-loading":m.value,"is-loading-more":u.value,"has-more":c.value,error:p.value,onLoadMore:e.loadMoreProducts,onFavoriteToggle:N},null,8,["products","is-loading","is-loading-more","has-more","error","onLoadMore"])]),_:1},8,["breadcrumb-items","title","subtitle","error","is-loading"])]))}});
1export{fe 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.