import{p as B,v as K,B as O,C as N,cZ as Z,cA as T,g as _,j as U,ct as j,t as a,m as Q,n as E,E as m,q as L,r as h,S as W,a7 as X,cN as w,K as G,J as Y,cu as p,ae as R,o as D,N as ee,ah as le,aL as ae,cV as te,T as oe,d as ne,i as C,c_ as I,ao as ue,c as ie,R as re,c$ as se}from"./index-BRUnowC8.js";const $=Symbol.for("vuetify:selection-control-group"),q=B({color:String,disabled:{type:Boolean,default:null},defaultsTarget:String,error:Boolean,id:String,inline:Boolean,falseIcon:T,trueIcon:T,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:Z},...N(),...O(),...K()},"SelectionControlGroup"),ce=B({...q({defaultsTarget:"VSelectionControl"})},"VSelectionControlGroup");_()({name:"VSelectionControlGroup",props:ce(),emits:{"update:modelValue":e=>!0},setup(e,n){let{slots:y}=n;const t=U(e,"modelValue"),o=j(),f=a(()=>e.id||`v-selection-control-group-${o}`),r=a(()=>e.name||f.value),l=new Set;return W($,{modelValue:t,forceUpdate:()=>{l.forEach(u=>u())},onForceUpdate:u=>{l.add(u),X(()=>{l.delete(u)})}}),Q({[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)}}),E(()=>m("div",{class:h(["v-selection-control-group",{"v-selection-control-group--inline":e.inline},e.class]),style:L(e.style),role:e.type==="radio"?"radiogroup":void 0},[y.default?.()])),{}}});const de=B({label:String,baseColor:String,trueValue:null,falseValue:null,value:null,...N(),...q()},"VSelectionControl");function ve(e){const n=oe($,void 0),{densityClasses:y}=ne(e),t=U(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}=ue(()=>{if(!(e.error||e.disabled))return l.value?e.color:e.baseColor}),{backgroundColorClasses:V,backgroundColorStyles:g}=ie(()=>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 me=_()({name:"VSelectionControl",directives:{vRipple:w},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=j(),i=G(!1),v=G(!1),s=Y(),S=a(()=>e.id||`input-${d}`),A=a(()=>!e.disabled&&!e.readonly);o?.onForceUpdate(()=>{s.value&&(s.value.checked=l.value)});function x(c){A.value&&(i.value=!0,se(c.target,":focus-visible")!==!1&&(v.value=!0))}function F(){i.value=!1,v.value=!1}function z(c){c.stopPropagation()}function M(c){if(!A.value){s.value&&(s.value.checked=l.value);return}e.readonly&&o&&re(()=>o.forceUpdate()),l.value=c.target.checked}return E(()=>{const c=t.label?t.label({label:e.label,props:{for:S.value}}):e.label,[H,J]=p(y),P=m("input",R({ref:s,checked:l.value,disabled:!!e.disabled,id:S.value,onBlur:F,onFocus:x,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},J),null);return m("div",R({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]},H,{style:e.style}),[m("div",{class:h(["v-selection-control__wrapper",u.value]),style:L(b.value)},[t.default?.({backgroundColorClasses:V,backgroundColorStyles:g}),ee(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:x,onBlur:F,id:S.value}})??m(le,null,[r.value&&D(ae,{key:"icon",icon:r.value},null),P])]),[[w,!e.disabled&&!e.readonly&&e.ripple,null,{center:!0,circle:!0}]])]),c&&D(te,{for:S.value,onClick:z},{default:()=>[c]})])}),{isFocused:i,input:s}}});export{me as V,de as m};
