import{Ea as x,I}from"./chunk-KT4MWGDC.js";import{b as g,f as P}from"./chunk-IF6GMCTP.js";import{aa as y,ya as M}from"./chunk-ONNJVTQI.js";import{Ab as v,Ea as f,Fb as s,Sb as b,Tb as n,Vb as d,cc as p,dc as r,ec as h,gd as O,ic as k,mb as a,oc as _,pc as c,rb as l,wa as u,xa as C}from"./chunk-A4WWLITB.js";function w(t,m){if(t&1&&h(0,"tis-svg",6),t&2){let e=c();d("disabled",e.isDisabled),n("icon",e.filledRadioIcon)}}function D(t,m){if(t&1&&h(0,"tis-svg",7),t&2){let e=c();d("disabled",e.isDisabled),n("icon",e.emptyRadioIcon)}}function T(t,m){if(t&1){let e=k();p(0,"tis-label",8),_("click",function(){u(e);let i=c();return C(i.selectRadio())}),r()}if(t&2){let e=c();n("disabled",e.isDisabled)("label",e.label)}}var K=(()=>{class t{get isDisabled(){return this.disabled||this._isDisabled}get checked(){return this.value===this.selectedValue||this.control?.value!==null&&this.control?.value!==void 0&&this.value===this.control.value}get control(){return this._ngControl?.control}constructor(e,o){this._cdr=e,this._ngControl=o,this.label="",this.disabled=!1,this.tabIndex=0,this.changed=new f,this.filledRadioIcon=g.RadioChecked,this.emptyRadioIcon=g.RadioEmpty,this._isDisabled=!1,this._ngControl&&(this._ngControl.valueAccessor=this)}ngOnInit(){this.control&&this.control.valueChanges.subscribe(()=>{this._cdr.markForCheck()})}ngDoCheck(){this._cdr.markForCheck()}writeValue(e){this._onChange?.(e)}registerOnChange(e){this._onChange=e}registerOnTouched(e){this._onTouched=e}setDisabledState(e){this._isDisabled=e,this._cdr.detectChanges()}selectRadio(){this.isDisabled||(this._onTouched?.(),this._onChange?.(this.value),this.changed.emit(this.value))}static{this.\u0275fac=function(o){return new(o||t)(l(O),l(I,10))}}static{this.\u0275cmp=v({type:t,selectors:[["tis-radio"]],inputs:{value:"value",selectedValue:"selectedValue",label:"label",disabled:"disabled",token:"token",tabIndex:"tabIndex"},outputs:{changed:"changed"},decls:6,vars:6,consts:[[1,"radio-wrapper"],[1,"radio-container"],["role","radio",1,"radio",3,"click","keydown.enter","tabIndex"],["class","icon",3,"icon","disabled",4,"ngIf"],["class","icon-empty",3,"icon","disabled",4,"ngIf"],["class","label-wrapper",3,"disabled","label","click",4,"ngIf"],[1,"icon",3,"icon"],[1,"icon-empty",3,"icon"],[1,"label-wrapper",3,"click","disabled","label"]],template:function(o,i){o&1&&(p(0,"div",0)(1,"div",1)(2,"div",2),_("click",function(){return i.selectRadio()})("keydown.enter",function(){return i.selectRadio()}),s(3,w,1,3,"tis-svg",3)(4,D,1,3,"tis-svg",4),r()(),s(5,T,1,2,"tis-label",5),r()),o&2&&(a(2),n("tabIndex",i.tabIndex),b("data-token",i.token)("aria-checked",i.checked),a(),n("ngIf",i.checked),a(),n("ngIf",!i.checked),a(),n("ngIf",i.label))},dependencies:[M,y,x,P],styles:["[_nghost-%COMP%]{display:block;width:fit-content;padding-top:var(--space-vertical-s);padding-bottom:var(--space-vertical-s)}.radio-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center}.radio[_ngcontent-%COMP%]{outline:none;cursor:pointer}.radio[_ngcontent-%COMP%]   .icon[_ngcontent-%COMP%]{fill:var(--radio-checked-rest)}.radio[_ngcontent-%COMP%]   .icon-empty[_ngcontent-%COMP%]{fill:var(--radio-unchecked-rest)}.radio[_ngcontent-%COMP%]:hover   .icon[_ngcontent-%COMP%]{fill:var(--radio-checked-hover)}.radio[_ngcontent-%COMP%]:hover   .icon-empty[_ngcontent-%COMP%]{fill:var(--radio-unchecked-hover)}.radio[_ngcontent-%COMP%]:focus   .icon[_ngcontent-%COMP%], .radio[_ngcontent-%COMP%]:active   .icon[_ngcontent-%COMP%]{fill:var(--radio-checked-focus)}.radio[_ngcontent-%COMP%]:focus   .icon-empty[_ngcontent-%COMP%], .radio[_ngcontent-%COMP%]:active   .icon-empty[_ngcontent-%COMP%]{fill:var(--radio-unchecked-focus)}.radio[_ngcontent-%COMP%]   .disabled.icon[_ngcontent-%COMP%], .radio[_ngcontent-%COMP%]   .disabled.icon-empty[_ngcontent-%COMP%]{cursor:default;fill:var(--radio-disabled)}.radio-container[_ngcontent-%COMP%]{display:flex;justify-content:center;width:36px;flex-shrink:0}.label-wrapper[_ngcontent-%COMP%]{margin-right:var(--space-horizontal-m);margin-left:var(--space-horizontal-xs);margin-bottom:0}"],changeDetection:0})}}return t})();export{K as a};
