import{p as B,b1 as Q,I as w,av as X,bB as J,az as U,g as _,k as j,c3 as z,aR as K,s as W,aH as a,a as N,c as m,ah as q,n as h,aQ as Y,R,aX as Z,l as G,w as p,F as ee,b as T,h as le,j as ae,bA as te,aq as oe,ao as ne,a4 as ue,ae as ie,cB as re,aC as D,i as C,bi as I}from"#entry";import{a as se}from"./C1aoz2cp.js";const E=Symbol.for("vuetify:selection-control-group"),H=B({color:String,disabled:{type:Boolean,default:null},defaultsTarget:String,error:Boolean,id:String,inline:Boolean,falseIcon:w,trueIcon:w,ripple:{type:[Boolean,Object],default:!0},multiple:{type:Boolean,default:null},name:String,readonly:{type:Boolean,default:null},modelValue:null,type:String,valueComparator:{type:Function,default:Q},...U(),...J(),...X()},"SelectionControlGroup"),ce=B({...H({defaultsTarget:"VSelectionControl"})},"VSelectionControlGroup");_()({name:"VSelectionControlGroup",props:ce(),emits:{"update:modelValue":e=>!0},setup(e,n){let{slots:y}=n;const t=j(e,"modelValue"),o=z(),f=a(()=>e.id||`v-selection-control-group-${o}`),r=a(()=>e.name||f.value),l=new Set;return K(E,{modelValue:t,forceUpdate:()=>{l.forEach(u=>u())},onForceUpdate:u=>{l.add(u),Y(()=>{l.delete(u)})}}),W({[e.defaultsTarget]:{color:a(()=>e.color),disabled:a(()=>e.disabled),density:a(()=>e.density),error:a(()=>e.error),inline:a(()=>e.inline),modelValue:t,multiple:a(()=>!!e.multiple||e.multiple==null&&Array.isArray(t.value)),name:r,falseIcon:a(()=>e.falseIcon),trueIcon:a(()=>e.trueIcon),readonly:a(()=>e.readonly),ripple:a(()=>e.ripple),type:a(()=>e.type),valueComparator:a(()=>e.valueComparator)}}),N(()=>m("div",{class:h(["v-selection-control-group",{"v-selection-control-group--inline":e.inline},e.class]),style:q(e.style),role:e.type==="radio"?"radiogroup":void 0},[y.default?.()])),{}}});const de=B({label:String,baseColor:String,trueValue:null,falseValue:null,value:null,...U(),...H()},"VSelectionControl");function ve(e){const n=ae(E,void 0),{densityClasses:y}=te(e),t=j(e,"modelValue"),o=C(()=>e.trueValue!==void 0?e.trueValue:e.value!==void 0?e.value:!0),f=C(()=>e.falseValue!==void 0?e.falseValue:!1),r=C(()=>!!e.multiple||e.multiple==null&&Array.isArray(t.value)),l=C({get(){const d=n?n.modelValue.value:t.value;return r.value?I(d).some(i=>e.valueComparator(i,o.value)):e.valueComparator(d,o.value)},set(d){if(e.readonly)return;const i=d?o.value:f.value;let v=i;r.value&&(v=d?[...I(t.value),i]:I(t.value).filter(s=>!e.valueComparator(s,o.value))),n?n.modelValue.value=v:t.value=v}}),{textColorClasses:u,textColorStyles:b}=oe(()=>{if(!(e.error||e.disabled))return l.value?e.color:e.baseColor}),{backgroundColorClasses:V,backgroundColorStyles:g}=ne(()=>l.value&&!e.error&&!e.disabled?e.color:e.baseColor),k=C(()=>l.value?e.trueIcon:e.falseIcon);return{group:n,densityClasses:y,trueValue:o,falseValue:f,model:l,textColorClasses:u,textColorStyles:b,backgroundColorClasses:V,backgroundColorStyles:g,icon:k}}const ye=_()({name:"VSelectionControl",directives:{vRipple:R},inheritAttrs:!1,props:de(),emits:{"update:modelValue":e=>!0},setup(e,n){let{attrs:y,slots:t}=n;const{group:o,densityClasses:f,icon:r,model:l,textColorClasses:u,textColorStyles:b,backgroundColorClasses:V,backgroundColorStyles:g,trueValue:k}=ve(e),d=z(),i=D(!1),v=D(!1),s=ue(),S=a(()=>e.id||`input-${d}`),A=a(()=>!e.disabled&&!e.readonly);o?.onForceUpdate(()=>{s.value&&(s.value.checked=l.value)});function F(c){A.value&&(i.value=!0,re(c.target,":focus-visible")!==!1&&(v.value=!0))}function x(){i.value=!1,v.value=!1}function L(c){c.stopPropagation()}function M(c){if(!A.value){s.value&&(s.value.checked=l.value);return}e.readonly&&o&&ie(()=>o.forceUpdate()),l.value=c.target.checked}return N(()=>{const c=t.label?t.label({label:e.label,props:{for:S.value}}):e.label,[$,O]=Z(y),P=m("input",G({ref:s,checked:l.value,disabled:!!e.disabled,id:S.value,onBlur:x,onFocus:F,onInput:M,"aria-disabled":!!e.disabled,"aria-label":e.label,type:e.type,value:k.value,name:e.name,"aria-checked":e.type==="checkbox"?l.value:void 0},O),null);return m("div",G({class:["v-selection-control",{"v-selection-control--dirty":l.value,"v-selection-control--disabled":e.disabled,"v-selection-control--error":e.error,"v-selection-control--focused":i.value,"v-selection-control--focus-visible":v.value,"v-selection-control--inline":e.inline},f.value,e.class]},$,{style:e.style}),[m("div",{class:h(["v-selection-control__wrapper",u.value]),style:q(b.value)},[t.default?.({backgroundColorClasses:V,backgroundColorStyles:g}),p(m("div",{class:h(["v-selection-control__input"])},[t.input?.({model:l,textColorClasses:u,textColorStyles:b,backgroundColorClasses:V,backgroundColorStyles:g,inputNode:P,icon:r.value,props:{onFocus:F,onBlur:x,id:S.value}})??m(ee,null,[r.value&&T(le,{key:"icon",icon:r.value},null),P])]),[[R,!e.disabled&&!e.readonly&&e.ripple,null,{center:!0,circle:!0}]])]),c&&T(se,{for:S.value,onClick:L},{default:()=>[c]})])}),{isFocused:i,input:s}}});export{ye as V,de as m};
