import{aa as h}from"./chunk-N445P7BV.js";import{Fa as l,Fb as o,Ka as r,sb as a,tb as s}from"./chunk-DZ62WUBN.js";var d=(()=>{class n{constructor(e,t,i){this.el=e,this.renderer=t,this.translate=i,this.buttonLabelKey="Choose File",this.noFileLabelKey="No file chosen",this.fileChange=new l,this.fileNameSpan=this.renderer.createElement("span"),this.customButton=this.renderer.createElement("button")}ngOnInit(){let e=this.el.nativeElement;e.tagName==="INPUT"&&e.type==="file"&&(this.renderer.setStyle(e,"display","none"),this.renderer.setAttribute(this.customButton,"type","button"),this.customButton.className="btn btn-primary",this.setButtonLabel(),this.renderer.setStyle(this.fileNameSpan,"marginLeft","10px"),this.setNoFileLabel(),this.renderer.insertBefore(e.parentNode,this.customButton,e.nextSibling),this.renderer.insertBefore(e.parentNode,this.fileNameSpan,this.customButton.nextSibling),this.customButton.onclick=()=>e.click(),e.addEventListener("change",t=>{let i=t.target;i.files&&i.files.length>0?this.fileNameSpan.textContent=i.files[0].name:this.setNoFileLabel(),this.fileChange.emit(t)}),this.translate.onLangChange.subscribe(()=>{this.setButtonLabel(),(!e.files||e.files?.length===0)&&this.setNoFileLabel()}))}setButtonLabel(){this.customButton.textContent=this.translate.instant(this.buttonLabelKey)}setNoFileLabel(){this.fileNameSpan.textContent=this.translate.instant(this.noFileLabelKey)}static{this.\u0275fac=function(t){return new(t||n)(s(r),s(a),s(h))}}static{this.\u0275dir=o({type:n,selectors:[["","localizedFileInput",""]],inputs:{buttonLabelKey:"buttonLabelKey",noFileLabelKey:"noFileLabelKey"},outputs:{fileChange:"fileChange"}})}}return n})();export{d as a};
