import{d as w,D as h,u as e,A as O,e as o,E as c,H as s,h as E,aO as I,J as j,K as D,$ as b,b as v,I as z,bf as M,a1 as _,c as k,F as g,f,O as x,ak as F,M as P,r as R}from"./lucide-BsOfcLnq.js";import{_ as C}from"./index-ITQq-KvP.js";import{_ as q}from"./index-BFBnvrkq.js";import{c as L,_ as H}from"./index-CyXUjyDM.js";import{r as J,u as K,C as T,s as U}from"./reka-ui-Ve6GQT9e.js";import{m as N}from"./vueuse-CmMrRm2c.js";import{_ as X}from"./Input.vue_vue_type_script_setup_true_lang-C8A8mwt1.js";import{a as G,b as Q,_ as W}from"./PopoverTrigger.vue_vue_type_script_setup_true_lang-CSFijvry.js";const Y=w({__name:"Separator",props:{orientation:{default:"horizontal"},decorative:{type:Boolean,default:!0},asChild:{type:Boolean},as:{},class:{default:void 0}},setup(i){const u=i,r=N(u,"class");return(p,m)=>(o(),h(e(J),O({"data-slot":"separator"},e(r),{class:e(L)("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",u.class)}),null,16,["class"]))}}),Z=w({__name:"Checkbox",props:{defaultValue:{type:[Boolean,String]},modelValue:{type:[Boolean,String,null]},disabled:{type:Boolean},value:{},id:{},asChild:{type:Boolean},as:{},name:{},required:{type:Boolean},class:{}},emits:["update:modelValue"],setup(i,{emit:u}){const r=i,p=u,m=N(r,"class"),n=K(m,p);return(d,V)=>(o(),h(e(T),O({"data-slot":"checkbox"},e(n),{class:e(L)("peer border-input data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",r.class)}),{default:c(y=>[s(e(U),{"data-slot":"checkbox-indicator",class:"grid place-content-center text-current transition-none"},{default:c(()=>[E(d.$slots,"default",j(D(y)),()=>[s(e(I),{class:"size-3.5"})])]),_:2},1024)]),_:3},16,["class"]))}}),ee={class:"hidden space-x-1 lg:flex"},ae=["onClick"],te={class:"faceted-filter-content"},se={class:"faceted-filter-list"},le=["onClick"],oe=w({__name:"FacetedFilter",props:{title:{},options:{},modelValue:{},class:{}},emits:["update:modelValue"],setup(i,{emit:u}){const r=i,p=u,m=R(""),n=k(()=>new Set(r.modelValue||[])),d=k(()=>n.value.size),V=k(()=>r.options.filter(l=>n.value.has(l.value))),y=k(()=>{const l=m.value.toLowerCase().trim();return l?r.options.filter(t=>t.label.toLowerCase().includes(l)):r.options}),$=l=>{const t=new Set(n.value);t.has(l)?t.delete(l):t.add(l),p("update:modelValue",Array.from(t))},A=l=>{const t=new Set(n.value);t.delete(l),p("update:modelValue",Array.from(t))},B=()=>{p("update:modelValue",[])};return(l,t)=>(o(),h(e(W),null,{default:c(()=>[s(e(G),{"as-child":""},{default:c(()=>[s(e(q),{variant:"outline",class:"border-dashed"},{default:c(()=>[s(e(M),{class:"h-4 w-4"}),b(" "+_(i.title)+" ",1),d.value>0?(o(),v(g,{key:0},[s(e(Y),{orientation:"vertical",class:"mx-2 h-4"}),s(e(C),{class:"lg:hidden font-medium rounded-[6px]"},{default:c(()=>[b(_(d.value),1)]),_:1}),f("div",ee,[d.value>2?(o(),h(e(C),{key:0,class:"rounded-[6px] gap-2"},{default:c(()=>[b(_(d.value)+" selected ",1),f("button",{type:"button",class:"flex items-center justify-center cursor-pointer hover:opacity-70",onClick:x(B,["stop"])},[s(e(F),{class:"size-2.5"})])]),_:1})):(o(!0),v(g,{key:1},P(V.value,a=>(o(),h(e(C),{key:a.value,class:"font-medium rounded-[6px] gap-2"},{default:c(()=>[b(_(a.label)+" ",1),f("button",{type:"button",class:"flex items-center justify-center cursor-pointer hover:opacity-70",onClick:x(S=>A(a.value),["stop"])},[s(e(F),{class:"size-2.5"})],8,ae)]),_:2},1024))),128))])],64)):z("",!0)]),_:1})]),_:1}),s(e(Q),{class:"w-[220px] p-0",align:"start"},{default:c(()=>[f("div",te,[s(e(X),{modelValue:m.value,"onUpdate:modelValue":t[0]||(t[0]=a=>m.value=a),placeholder:i.title,class:"mb-2 h-8"},null,8,["modelValue","placeholder"]),f("div",se,[(o(!0),v(g,null,P(y.value,a=>(o(),v("label",{key:`${a.value}-${n.value.has(a.value)}`,class:"faceted-filter-item"},[s(e(Z),{checked:n.value.has(a.value),"default-value":n.value.has(a.value),class:"mr-2",onClick:x(S=>$(a.value),["stop"])},null,8,["checked","default-value","onClick"]),f("span",{class:"truncate cursor-pointer",onClick:x(S=>$(a.value),["stop"])},_(a.label),9,le)]))),128))]),d.value>0?(o(),v("button",{key:0,type:"button",class:"faceted-filter-clear",onClick:B}," Clear filters ")):z("",!0)])]),_:1})]),_:1}))}}),fe=H(oe,[["__scopeId","data-v-4ebcab1d"]]);export{fe as F};
