/*!
 * KoliBri - The accessible HTML-Standard
 */
import{V as t,w as s,W as i,X as a,Y as e,k as o}from"./index-0489af72.js";import{I as r}from"./controller-19ccfc94.js";const h=(t,e,o="")=>{e.forEach(((e,a)=>{const i=`${o}-${a}`;"object"==typeof e&&null!==e&&"string"==typeof e.label&&e.label.length>0&&(Array.isArray(e.options)?h(t,e.options,i):t.set(i,e))}))};class n extends r{constructor(t,e,o){super(t,e,o),this.component=t}validateRequired(e){t(this.component,e)}componentWillLoad(){super.componentWillLoad(),this.validateRequired(this.component._required)}}class l extends n{constructor(t,e,o){super(t,e,o),this.keyOptionMap=new Map,this.getOptionByKey=t=>this.keyOptionMap.get(t),this.afterPatchOptions=(t,e,o,a)=>{"_value"===a&&this.setFormAssociatedValue(t)},this.component=t}validateOrientation(t){s(this.component,"_orientation",(t=>"string"==typeof t&&i.includes(t)),new Set([`Orientation {${i.join(", ")}`]),t,{defaultValue:"vertical"})}validateOptions(t){a(this.component,t,{hooks:{afterPatch:this.afterPatchOptions}})}validateValue(t){t=e(t),t=Array.isArray(t)?t[0]:t,o(this.component,"_value",t,{afterPatch:this.afterPatchOptions})}componentWillLoad(){super.componentWillLoad(),this.validateOrientation(this.component._orientation),this.validateOptions(this.component._options),this.validateValue(this.component._value)}}export{n as I,l as a,h as f};