import{d as O,D as k,e as r,u as e,A,E as n,H as s,h as j,aU as L,J as N,K as E,$ as _,b as f,I as S,bn as I,a1 as v,c as h,F as g,f as d,O as b,ak as F,M as z,r as D}from"./lucide-F1B1VpI-.js";import{_ as C}from"./index-B6OmXTp4.js";import{_ as M}from"./index-BhOpLHn1.js";import{c as R,_ as U}from"./index-ByIRZxAe.js";import{u as q,C as H,z as J}from"./reka-ui-BNEScVJO.js";import{l as K}from"./vueuse-D-YfxAQp.js";import{_ as T}from"./Input.vue_vue_type_script_setup_true_lang-CWNOJvY-.js";import{a as X,b as G,_ as Q}from"./PopoverTrigger.vue_vue_type_script_setup_true_lang-CA2FEKyy.js";import{_ as W}from"./Separator.vue_vue_type_script_setup_true_lang-CXIbtG8p.js";const Y=O({__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:{type:[Boolean,null,String,Object,Array]}},emits:["update:modelValue"],setup(u,{emit:y}){const c=u,m=y,p=K(c,"class"),o=q(p,m);return(i,V)=>(r(),k(e(H),A({"data-slot":"checkbox"},e(o),{class:e(R)("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",c.class)}),{default:n(x=>[s(e(J),{"data-slot":"checkbox-indicator",class:"grid place-content-center text-current transition-none"},{default:n(()=>[j(i.$slots,"default",N(E(x)),()=>[s(e(L),{class:"size-3.5"})])]),_:2},1024)]),_:3},16,["class"]))}}),Z={class:"hidden space-x-1 lg:flex"},ee=["onClick"],ae={class:"faceted-filter-content"},te={class:"faceted-filter-list"},se=["onClick"],le=O({__name:"FacetedFilter",props:{title:{},options:{},modelValue:{},class:{type:[Boolean,null,String,Object,Array]}},emits:["update:modelValue"],setup(u,{emit:y}){const c=u,m=y,p=D(""),o=h(()=>new Set(c.modelValue||[])),i=h(()=>o.value.size),V=h(()=>c.options.filter(l=>o.value.has(l.value))),x=h(()=>{const l=p.value.toLowerCase().trim();return l?c.options.filter(t=>t.label.toLowerCase().includes(l)):c.options}),$=l=>{const t=new Set(o.value);t.has(l)?t.delete(l):t.add(l),m("update:modelValue",Array.from(t))},P=l=>{const t=new Set(o.value);t.delete(l),m("update:modelValue",Array.from(t))},w=()=>{m("update:modelValue",[])};return(l,t)=>(r(),k(e(Q),null,{default:n(()=>[s(e(X),{"as-child":""},{default:n(()=>[s(e(M),{variant:"outline",class:"border-dashed"},{default:n(()=>[s(e(I),{class:"h-4 w-4"}),_(" "+v(u.title)+" ",1),i.value>0?(r(),f(g,{key:0},[s(e(W),{orientation:"vertical",class:"mx-2 h-4"}),s(e(C),{class:"lg:hidden font-medium rounded-[6px]"},{default:n(()=>[_(v(i.value),1)]),_:1}),d("div",Z,[i.value>2?(r(),k(e(C),{key:0,class:"rounded-[6px] gap-2"},{default:n(()=>[_(v(i.value)+" selected ",1),d("button",{type:"button",class:"flex items-center justify-center cursor-pointer hover:opacity-70",onClick:b(w,["stop"])},[s(e(F),{class:"size-2.5"})])]),_:1})):(r(!0),f(g,{key:1},z(V.value,a=>(r(),k(e(C),{key:a.value,class:"font-medium rounded-[6px] gap-2"},{default:n(()=>[_(v(a.label)+" ",1),d("button",{type:"button",class:"flex items-center justify-center cursor-pointer hover:opacity-70",onClick:b(B=>P(a.value),["stop"])},[s(e(F),{class:"size-2.5"})],8,ee)]),_:2},1024))),128))])],64)):S("",!0)]),_:1})]),_:1}),s(e(G),{class:"w-[220px] p-0",align:"start"},{default:n(()=>[d("div",ae,[s(e(T),{modelValue:p.value,"onUpdate:modelValue":t[0]||(t[0]=a=>p.value=a),placeholder:u.title,class:"mb-2 h-8"},null,8,["modelValue","placeholder"]),d("div",te,[(r(!0),f(g,null,z(x.value,a=>(r(),f("label",{key:`${a.value}-${o.value.has(a.value)}`,class:"faceted-filter-item"},[s(e(Y),{checked:o.value.has(a.value),"default-value":o.value.has(a.value),class:"mr-2",onClick:b(B=>$(a.value),["stop"])},null,8,["checked","default-value","onClick"]),d("span",{class:"truncate cursor-pointer",onClick:b(B=>$(a.value),["stop"])},v(a.label),9,se)]))),128))]),i.value>0?(r(),f("button",{key:0,type:"button",class:"faceted-filter-clear",onClick:w}," Clear filters ")):S("",!0)])]),_:1})]),_:1}))}}),fe=U(le,[["__scopeId","data-v-4ebcab1d"]]);export{fe as F};
