import{r as t,c as s,h as i,H as h,g as e}from"./p-ClISz4NF.js";import{c as a}from"./p-vN03FcXN.js";import{v as r}from"./p-NOJjz9dT.js";import{g as o,e as n,f as l}from"./p-B6CqPcY_.js";import{g as c,a as d,t as p}from"./p-CoD1xawt.js";import{F as m}from"./p-5itQzbON.js";import{A as u,a as v}from"./p-Bz_RzYFb.js";import{i as f}from"./p-CzXeijOj.js";import"./p-CgDnDrq5.js";import"./p-CQvUntGY.js";import"./p-BcQO4NH2.js";import"./p-EeKNA85D.js";import"./p-U40vKHrs.js";import"./p-DYcNEwSZ.js";import"./p-DBXGhafv.js";const j=class{constructor(i){t(this,i);this.govFocus=s(this,"gov-focus");this.govBlur=s(this,"gov-blur");this.govChange=s(this,"gov-change");this.hydrated=false;this.noLabel=false;this.checked=false;this.required=false;this.disabled=false;this.size="m";this.inheritedAttributes={};this.radioId=a("GovRadio");this.h=c(this.host);this.f=o(this.h)}validateSize(t){r(l,t,n.root)}watchControlAttrs(){this.passControlAttrs()}passControlAttrs(){this.f.passAttrToControl("size",this.size);this.f.passAttrToControl("invalid",d(this.invalid));this.f.passAttrToControl("disabled",d(this.disabled));this.f.passAttrToControl("type","radio")}componentWillLoad(){this.inheritedAttributes=f(this.host)}componentDidLoad(){this.attributeObserver=new u(this.host,((t,s)=>{this.onAriaAttributeChange(t,s)}));this.attributeObserver.startObserving(v)}async componentDidRender(){this.f.passAttrToLabel("identifier",this.identifier||this.radioId);this.f.passAttrToLabel("required",String(this.required));this.passControlAttrs()}connectedCallback(){this.hydrated=true}disconnectedCallback(){var t;(t=this.attributeObserver)===null||t===void 0?void 0:t.stopObserving()}onAriaAttributeChange(t,s){this.host.removeAttribute(t);this.inheritedAttributes=Object.assign(Object.assign({},this.inheritedAttributes),{[t]:s})}render(){const t=t=>{if(this.noLabel){return i("label",{class:n.label},t)}return t};return i(h,{class:n.root,hydrated:this.hydrated,checked:this.checked,size:this.size,invalid:p(this.invalid)},t(i(m,null,i("input",Object.assign({class:n.input,id:this.identifier||this.radioId,type:"radio",value:this.value,name:this.name,checked:this.checked,disabled:this.disabled,onClick:this.onClickHandler.bind(this),onChange:this.onChangeHandler.bind(this),onFocus:this.onFocusHandler.bind(this),onBlur:this.onBlurHandler.bind(this),ref:t=>this.inputRef=t,required:this.required},this.inheritedAttributes,{"aria-checked":this.checked,"aria-required":p(this.required),"aria-invalid":p(this.invalid),"aria-disabled":p(this.disabled)})),i("span",null,i("slot",{name:"label"})))))}onClickHandler(t){t.stopPropagation()}onFocusHandler(t){t.stopPropagation();this.govFocus.emit({component:n.root,value:this.value,checked:this.checked,originalEvent:t})}onBlurHandler(t){t.stopPropagation();this.govBlur.emit({component:n.root,value:this.value,checked:this.checked,originalEvent:t})}onChangeHandler(t){this.checked=t.target.checked;t.stopPropagation();this.govChange.emit({component:n.root,value:this.value,checked:this.checked,originalEvent:t})}async getRef(){return this.inputRef}get host(){return e(this)}static get watchers(){return{size:["validateSize","watchControlAttrs"],disabled:["watchControlAttrs"],invalid:["watchControlAttrs"]}}};export{j as gov_form_radio};
//# sourceMappingURL=p-46824842.entry.js.map