import{t as S}from"./chunk-6GMBHO4S.js";import{b as R,c as O,e as m,f as a,h as k,l as q,r as N,z as G}from"./chunk-AUG6ZMIQ.js";import{Aa as c,Ac as g,Cb as s,Fd as T,Hb as r,Jc as I,Kc as y,Tb as d,Ub as p,Vb as f,cc as h,kb as n,ma as l,qa as u,qc as C,rc as F,vd as x,xd as _,zc as v}from"./chunk-NW2U37DI.js";function b(i,V){i&1&&(d(0,"span",4),C(1),I(2,"translate"),p()),i&2&&(n(),F(y(2,1,"This field is required")))}function w(i,V){if(i&1&&(d(0,"div",2),s(1,b,3,3,"span",3),p()),i&2){let e=h();n(),r("ngIf",e.formControl.hasError("required"))}}var Q=(()=>{class i{constructor(){this.parentContainer=l(a)}get parentFormGroup(){return this.parentContainer.control}get formControl(){return this.parentFormGroup.get(this.nameField)}ngOnInit(){let e=[];this.validationRules?.includes("required")&&e.push(m.required),this.parentFormGroup.addControl(this.nameField,new q(this.value??"",e))}ngOnChanges(e){e.value&&this.updateFormControl()}updateFormControl(){if(this.parentFormGroup){let e=this.parentFormGroup.get(this.nameField);if(e){e.setValue(this.value??"");let o=[];this.validationRules.includes("required")&&o.push(m.required),e.setValidators(o),e.updateValueAndValidity()}}}ngOnDestroy(){this.parentFormGroup.removeControl(this.nameField)}static{this.\u0275fac=function(o){return new(o||i)}}static{this.\u0275cmp=u({type:i,selectors:[["app-text-input"]],inputs:{nameField:"nameField",value:"value",idField:"idField",classText:"classText",placeholder:"placeholder",validationRules:"validationRules"},standalone:!0,features:[v([],[{provide:a,useFactory:()=>l(a,{skipSelf:!0})}]),c,g],decls:2,vars:6,consts:[["type","text",3,"ngClass","id","formControlName","value","placeholder"],["class","error-invalid",4,"ngIf"],[1,"error-invalid"],["class","text-danger",4,"ngIf"],[1,"text-danger"]],template:function(o,t){if(o&1&&(f(0,"input",0),s(1,w,2,1,"div",1)),o&2){let M;r("ngClass",t.classText)("id",t.idField?t.idField:t.nameField)("formControlName",t.nameField)("value",(M=t.value)!==null&&M!==void 0?M:"")("placeholder",t.placeholder),n(),r("ngIf",t.formControl.invalid&&t.formControl.touched)}},dependencies:[G,O,k,N,T,x,_,S],encapsulation:2})}}return i})();function A(i,V){i&1&&(d(0,"span",5),C(1),I(2,"translate"),p()),i&2&&(n(),F(y(2,1,"This field is required")))}function j(i,V){if(i&1&&(d(0,"div",3),s(1,A,3,3,"span",4),p()),i&2){let e=h();n(),r("ngIf",e.formControl.hasError("required"))}}var te=(()=>{class i{constructor(){this.parentContainer=l(a)}get parentFormGroup(){return this.parentContainer.control}get formControl(){return this.parentFormGroup.get(this.nameField)}ngOnInit(){this.parentFormGroup.addControl(this.nameField,new q(this.isChecked??"",this.isRequired?m.required:null))}ngOnChanges(e){e.isChecked&&this.updateFormControl()}updateFormControl(){if(this.parentFormGroup){let e=this.parentFormGroup.get(this.nameField);e&&(e.setValue(this.isChecked??""),e.setValidators(this.isRequired?m.required:null),e.updateValueAndValidity())}}ngOnDestroy(){this.parentFormGroup.removeControl(this.nameField)}static{this.\u0275fac=function(o){return new(o||i)}}static{this.\u0275cmp=u({type:i,selectors:[["app-check-box-input"]],inputs:{nameField:"nameField",idField:"idField",classText:"classText",placeholder:"placeholder",isRequired:"isRequired",isChecked:"isChecked"},standalone:!0,features:[v([],[{provide:a,useFactory:()=>l(a,{skipSelf:!0})}]),c,g],decls:3,vars:7,consts:[["type","checkbox",3,"ngClass","id","formControlName","placeholder","checked"],[1,"toggle-class","onoffswitch2-label",3,"for"],["class","error-invalid",4,"ngIf"],[1,"error-invalid"],["class","text-danger",4,"ngIf"],[1,"text-danger"]],template:function(o,t){o&1&&(f(0,"input",0)(1,"label",1),s(2,j,2,1,"div",2)),o&2&&(r("ngClass",t.classText)("id",t.idField?t.idField:t.nameField)("formControlName",t.nameField)("placeholder",t.placeholder)("checked",t.isChecked),n(),r("for",t.idField?t.idField:t.nameField),n(),r("ngIf",t.formControl.invalid&&t.formControl.touched))},dependencies:[G,R,k,N,T,x,_,S],encapsulation:2})}}return i})();export{Q as a,te as b};
