{"version":3,"sources":["../../src/app/components/radiobutton/radiobutton.ts"],"names":["RADIO_VALUE_ACCESSOR","provide","NG_VALUE_ACCESSOR","useExisting","forwardRef","RadioButton","multi","RadioControlRegistry","this","accessors","prototype","add","control","accessor","push","remove","filter","c","select","_this","forEach","isSameGroup","writeValue","value","controlPair","root","name","Injectable","args","providedIn","cd","injector","registry","onClick","EventEmitter","onFocus","onBlur","onModelChange","onModelTouched","ngOnInit","formControlName","get","NgControl","checkName","handleClick","event","radioButton","focus","preventDefault","disabled","inputViewChild","nativeElement","checked","emit","markForCheck","registerOnChange","fn","registerOnTouched","setDisabledState","val","onInputFocus","focused","onInputBlur","onChange","ngOnDestroy","throwNameError","Error","Component","selector","template","providers","changeDetection","ChangeDetectionStrategy","OnPush","ChangeDetectorRef","Injector","Input","Output","ViewChild","NgModule","imports","CommonModule","exports","declarations"],"mappings":"udAIaA,EAA4B,CACrCC,QAASC,EAAAA,kBACTC,YAAaC,EAAAA,YAAW,WAAM,OAAAC,KAC9BC,OAAO,gBAGX,SAAAC,IAIYC,KAAAC,UAAmB,UAE3BF,EAAAG,UAAAC,IAAA,SAAIC,EAAoBC,GACpBL,KAAKC,UAAUK,KAAK,CAACF,EAASC,KAGlCN,EAAAG,UAAAK,OAAA,SAAOF,GACHL,KAAKC,UAAYD,KAAKC,UAAUO,QAAO,SAACC,GACpC,OAAOA,EAAE,KAAOJ,MAIxBN,EAAAG,UAAAQ,OAAA,SAAOL,GAAP,IAAAM,EAAAX,KACIA,KAAKC,UAAUW,SAAQ,SAACH,GAChBE,EAAKE,YAAYJ,EAAGJ,IAAaI,EAAE,KAAOJ,GAC1CI,EAAE,GAAGK,WAAWT,EAASU,WAK7BhB,EAAAG,UAAAW,YAAA,SAAYG,EAAuCX,GACvD,QAAKW,EAAY,GAAGZ,UAIbY,EAAY,GAAGZ,QAAQa,OAASZ,EAASD,QAAQA,QAAQa,MAAQD,EAAY,GAAGE,OAASb,EAASa,2HA7BhHC,EAAAA,WAAUC,KA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itter,forwardRef,ViewChild,ChangeDetectorRef,ChangeDetectionStrategy, Injectable, Injector, OnInit, OnDestroy} from '@angular/core';\nimport {CommonModule} from '@angular/common';\nimport {NG_VALUE_ACCESSOR, ControlValueAccessor, NgControl} from '@angular/forms';\n\nexport const RADIO_VALUE_ACCESSOR: any = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => RadioButton),\n multi: true\n};\n\n@Injectable({\n providedIn: 'root',\n})\nexport class RadioControlRegistry {\n private accessors: any[] = [];\n\n add(control: NgControl, accessor: RadioButton) {\n this.accessors.push([control, accessor]);\n }\n\n remove(accessor: RadioButton) {\n this.accessors = this.accessors.filter((c) => {\n return c[1] !== accessor;\n })\n }\n\n select(accessor: RadioButton) {\n this.accessors.forEach((c) => {\n if (this.isSameGroup(c, accessor) && c[1] !== accessor) {\n c[1].writeValue(accessor.value);\n }\n });\n }\n\n private isSameGroup(controlPair: [NgControl, RadioButton], accessor: RadioButton): boolean {\n if (!controlPair[0].control) {\n return false;\n }\n\n return controlPair[0].control.root === accessor.control.control.root && controlPair[1].name === accessor.name;\n }\n}\n\n@Component({\n selector: 'p-radioButton',\n template: `\n