1import{d6 as x,u as w,bE as I,K as i,bF as M,b2 as G,s as K,m as n}from"./DOUwDtZz.js";const Q=x("category",()=>{const{$api:t,$i18n:u}=w(),p=I(u.locale),c=i([]);async function d(o){return{data:await t(`/api/v1/categories/${o}`)}}function m(o){const l=M(p,"name",o);l&&(c.value=l)}return{useGetCategory:d,setPageCategories:m,pageCategories:c}}),U=x("listing",()=>{const{t}=w().$i18n,u=G(),{useSearchProducts:p}=u,c=Q(),{pageCategories:d}=K(c),{localeProperties:m}=w().$i18n,o=n(()=>m.value.defaultCurrency),l=i([{value:"price-desc",label:t("Prix (décroissants)")},{value:"price-asc",label:t("Prix (croissants)")}]),P=n(()=>d.value.map(r=>({id:r.id,label:r.name}))),B={id:"in-stock",label:t("En stock")},O={id:"new-product",label:t("Nouveau produit")},$={id:"is-bundle",label:t("Pack")},L={id:"on-promo",label:t("En promotion")},N={id:"best-seller",label:t("Meilleure vente")},R={id:"refurbish",label:t("Reconditionné")},S=n(()=>[{id:"categories",label:t("Catégories"),options:P.value,type:"checkbox"},{id:"price",label:t("Prix"),minPrice:0,maxPrice:1e3,type:"slider"},{id:"availability",item:B,type:"switch"},{id:"new-product",item:O,type:"switch"},{id:"is-bundle",item:$,type:"switch"},{id:"on-promo",item:L,type:"switch"},{id:"best-seller",item:N,type:"switch"},{id:"refurbish",item:R,type:"switch"}]),F=n(()=>{const r={};return S.value.map(s=>{switch(s.type){case"checkbox":r[s.id]=[];break;case"switch":r[s.id]=!1;break;case"slider":r[s.id]=[s.minPrice,s.maxPrice];break}}),r}),a=i(F.value),C=i(l.value[0]?.value),b=i(0),k=i(12),v=i(!1);async function A(r=!1){if(!a.value)return[];const s=[];if(r){const e={name:"label",params:{value:"accessory"}};s.push(e)}const E=P.value.map(e=>e.id),f=a.value.categories,h=f&&f.length>0?f:E;if(h&&h.length>0){const e={name:"categories",params:{ids:h,operator:"or"}};s.push(e)}if(a.value.availability){const e={name:"availability"};s.push(e)}if(a.value["new-product"]){const e={name:"label",params:{value:"new"}};s.push(e)}if(a.value["is-bundle"]){const e={name:"is-bundle"};s.push(e)}if(a.value["on-promo"]){const e={name:"label",params:{value:"promo"}};s.push(e)}if(a.value["best-seller"]){const e={name:"label",params:{value:"best-seller"}};s.push(e)}if(a.value.refurbish){const e={name:"label",params:{value:"refurbish"}};s.push(e)}const g=a.value.price;if(g){const e={name:"price",params:{min:g[0]*100,max:g[1]*100}};s.push(e)}let y=[];switch(C.value){case"price-asc":y=[{name:"price",params:{order:"asc",currency:o.value}}];break;case"price-desc":y=[{name:"price",params:{order:"desc",currency:o.value}}];break}const V={offset:b.value,limit:k.value,filters:s,sort:y};try{const{data:e}=await p(V);return!e||e.length===0?(v.value=!0,[]):(v.value=!1,b.value+=e.length,e)}catch{return[]}}return{filters:S,formValues:a,defaultFormValues:F,selectedSortOption:C,sortOptions:l,productCount:b,displayCount:k,disableSeeMore:v,fetchProducts:A}});export{Q as a,U as u};
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.