import{w as f,s as d,X as l,i as u,D as b,q as y}from"./index-BeCeuELg.js";import{I as O}from"./controller-fe4af011-DCaVWhXc.js";import{b as m,c as g}from"./label-3757689e-D7ErDa5R.js";const c=e=>{if(typeof e=="object"&&e!==null){if(typeof e.label=="string"&&e.label.length>0)return e.disabled=e.disabled===!0,e.label=`${e.label}`.trim(),m(e.label,3)===!1&&g(e.label)===!1&&b(`A differing Aria-Label (${e.label}) is not accessible. A differing Aria-Label should consist of at least three readable characters.`),Array.isArray(e.options)?e.options.find(t=>c(t)===!1)===void 0:!0;if(typeof e.label=="number")return!0}return!1},_=(e,t,s={})=>{l(e,"_options",a=>u(a)&&typeof a.label=="string"&&a.label.length>0,t,void 0,s)},w=(e,t,s={})=>{l(e,"_options",c,t,void 0,s)},v=(e,t)=>{y(e,"_required",t)},r=["horizontal","vertical"],h=(e,t,s="")=>{t.forEach((a,i)=>{const n=`${s}-${i}`;typeof a=="object"&&a!==null&&typeof a.label=="string"&&a.label.length>0&&(Array.isArray(a.options)?h(e,a.options,n):e.set(n,a))})};class A extends O{constructor(t,s,a){super(t,s,a),this.component=t}validateRequired(t){v(this.component,t)}componentWillLoad(){super.componentWillLoad(),this.validateRequired(this.component._required)}}class I extends A{constructor(t,s,a){super(t,s,a),this.keyOptionMap=new Map,this.getOptionByKey=i=>this.keyOptionMap.get(i),this.afterPatchOptions=(i,n,o,p)=>{p==="_value"&&this.setFormAssociatedValue(i)},this.beforePatchOptions=(i,n)=>{const o=n.has("_options")?n.get("_options"):this.component.state._options;Array.isArray(o)&&o.length>0&&(this.keyOptionMap.clear(),h(this.keyOptionMap,o))},this.component=t}validateOrientation(t){f(this.component,"_orientation",s=>typeof s=="string"&&r.includes(s),new Set([`Orientation {${r.join(", ")}`]),t,{defaultValue:"vertical"})}validateOptions(t){_(this.component,t,{hooks:{afterPatch:this.afterPatchOptions,beforePatch:this.beforePatchOptions}})}validateValue(t){t=Array.isArray(t)?t[0]:t,d(this.component,"_value",t,{afterPatch:this.afterPatchOptions,beforePatch:this.beforePatchOptions})}componentWillLoad(){super.componentWillLoad(),this.validateOrientation(this.component._orientation),this.validateOptions(this.component._options),this.validateValue(this.component._value)}}export{A as I,I as a,_ as b,h as f,w as v};
//# sourceMappingURL=controller-06f2bcc0-CrEafCKk.js.map
