import{bI as B,a7 as J,f as w,bc as K,a$ as W,a_ as _,au as O,cv as U,cn as N,bJ as Y,bK as Z,c3 as a,cw as $,W as m,bo as j,bm as h,by as Q,i as T,al as X,bi as G,cT as p,F as ee,a3 as D,r as le,aO as ae,cd as te,cI as oe,c9 as ne,bO as ue,bk as ie,bg as re,bZ as R,O as y,cY as I}from"#entry";import{c as ce}from"./DmHQoNBb.js";const z=Symbol.for("vuetify:selection-control-group"),E=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:J},..._(),...W(),...K()},"SelectionControlGroup"),se=B({...E({defaultsTarget:"VSelectionControl"})},"VSelectionControlGroup");O()({name:"VSelectionControlGroup",props:se(),emits:{"update:modelValue":e=>!0},setup(e,n){let{slots:b}=n;const t=U(e,"modelValue"),o=N(),f=a(()=>e.id||`v-selection-control-group-${o}`),r=a(()=>e.name||f.value),l=new Set;return Y(z,{modelValue:t,forceUpdate:()=>{l.forEach(u=>u())},onForceUpdate:u=>{l.add(u),Q(()=>{l.delete(u)})}}),Z({[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)}}),$(()=>m("div",{class:h(["v-selection-control-group",{"v-selection-control-group--inline":e.inline},e.class]),style:j(e.style),role:e.type==="radio"?"radiogroup":void 0},[b.default?.()])),{}}});const de=B({label:String,baseColor:String,trueValue:null,falseValue:null,value:null,..._(),...E()},"VSelectionControl");function ve(e){const n=ae(z,void 0),{densityClasses:b}=te(e),t=U(e,"modelValue"),o=y(()=>e.trueValue!==void 0?e.trueValue:e.value!==void 0?e.value:!0),f=y(()=>e.falseValue!==void 0?e.falseValue:!1),r=y(()=>!!e.multiple||e.multiple==null&&Array.isArray(t.value)),l=y({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(c=>!e.valueComparator(c,o.value))),n?n.modelValue.value=v:t.value=v}}),{textColorClasses:u,textColorStyles:C}=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=y(()=>l.value?e.trueIcon:e.falseIcon);return{group:n,densityClasses:b,trueValue:o,falseValue:f,model:l,textColorClasses:u,textColorStyles:C,backgroundColorClasses:V,backgroundColorStyles:g,icon:k}}const be=O()({name:"VSelectionControl",directives:{vRipple:T},inheritAttrs:!1,props:de(),emits:{"update:modelValue":e=>!0},setup(e,n){let{attrs:b,slots:t}=n;const{group:o,densityClasses:f,icon:r,model:l,textColorClasses:u,textColorStyles:C,backgroundColorClasses:V,backgroundColorStyles:g,trueValue:k}=ve(e),d=N(),i=R(!1),v=R(!1),c=ue(),S=a(()=>e.id||`input-${d}`),F=a(()=>!e.disabled&&!e.readonly);o?.onForceUpdate(()=>{c.value&&(c.value.checked=l.value)});function x(s){F.value&&(i.value=!0,re(s.target,":focus-visible")!==!1&&(v.value=!0))}function A(){i.value=!1,v.value=!1}function L(s){s.stopPropagation()}function M(s){if(!F.value){c.value&&(c.value.checked=l.value);return}e.readonly&&o&&ie(()=>o.forceUpdate()),l.value=s.target.checked}return $(()=>{const s=t.label?t.label({label:e.label,props:{for:S.value}}):e.label,[q,H]=X(b),P=m("input",G({ref:c,checked:l.value,disabled:!!e.disabled,id:S.value,onBlur:A,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},H),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]},q,{style:e.style}),[m("div",{class:h(["v-selection-control__wrapper",u.value]),style:j(C.value)},[t.default?.({backgroundColorClasses:V,backgroundColorStyles:g}),p(m("div",{class:h(["v-selection-control__input"])},[t.input?.({model:l,textColorClasses:u,textColorStyles:C,backgroundColorClasses:V,backgroundColorStyles:g,inputNode:P,icon:r.value,props:{onFocus:x,onBlur:A,id:S.value}})??m(ee,null,[r.value&&D(le,{key:"icon",icon:r.value},null),P])]),[[T,!e.disabled&&!e.readonly&&e.ripple,null,{center:!0,circle:!0}]])]),s&&D(ce,{for:S.value,onClick:L},{default:()=>[s]})])}),{isFocused:i,input:c}}});export{be as V,de as m};
