import{D as $}from"./chunk-CKNOD7HV.js";import{A as k,a as V,c as L,g as z,l as D}from"./chunk-7VHQBARM.js";import{a as G}from"./chunk-ZJ7WKAH3.js";import{Cb as h,Da as a,Db as _,Ea as S,Hb as I,Ib as F,Jb as N,Kb as O,Lb as w,Oa as g,Wa as r,Wf as H,X as C,ba as y,db as p,eb as m,fb as v,jb as T,ka as b,la as M,ma as E,nb as x,rb as d,sb as u,sc as P,ta as R,uc as A}from"./chunk-QXV2GR6R.js";import{i as t}from"./chunk-JJ4RDTEF.js";function U(n,o){if(n&1&&v(0,"my-global-icon",7),n&2){let c=u();r("iconName",c.icon);}}function W(n,o){if(n&1&&(p(0,"div",8),h(1),m()),n&2){let c=u();a(),_(c.filename);}}function j(n,o){if(n&1){let c=T();p(0,"button",9),d("click",function(){M(c);let l=u();return E(l.reset());}),x(1,0),m();}}var ne=(()=>{let o=class o{constructor(i){t(this,"notifier");t(this,"theme","secondary");t(this,"inputLabel");t(this,"inputName");t(this,"extensions",[]);t(this,"maxFileSize");t(this,"displayFilename",!1);t(this,"displayReset",!1);t(this,"icon");t(this,"buttonTooltip");t(this,"fileChanged",new R());t(this,"classes",{});t(this,"allowedExtensionsMessage","");t(this,"fileInputValue");t(this,"file");t(this,"propagateChange",i=>{});this.notifier=i;}get filename(){return this.file?this.file.name:"";}ngOnInit(){this.allowedExtensionsMessage=this.extensions.join(", "),this.buildClasses();}ngOnChanges(){this.buildClasses();}buildClasses(){this.classes={"with-icon":!!this.icon,"primary-button":this.theme==="primary","secondary-button":this.theme==="secondary"};}fileChange(i){var l;if((l=i.target.files)!=null&&l.length){let[e]=i.target.files;if(e.size>this.maxFileSize){this.notifier.error("Diese Datei ist zu gro\xDF.");return;}let f="."+e.name.split(".").pop();if(this.extensions.includes(f.toLowerCase())===!1){let s="PeerTube kann mit diesem Dateityp nicht umgehen. Unterst\xFCtzte Dateierweiterungen sind "+this.allowedExtensionsMessage+".";this.notifier.error(s);return;}this.file=e,this.propagateChange(this.file);}this.fileChanged.emit(this.file);}reset(){this.writeValue(void 0),this.propagateChange(void 0),this.fileChanged.emit(void 0);}writeValue(i){this.file=i,this.file||(this.fileInputValue=null);}registerOnChange(i){this.propagateChange=i;}registerOnTouched(){}};t(o,"\u0275fac",function(l){return new(l||o)(S(H));}),t(o,"\u0275cmp",y({type:o,selectors:[["my-reactive-file"]],inputs:{theme:"theme",inputLabel:"inputLabel",inputName:"inputName",extensions:"extensions",maxFileSize:"maxFileSize",displayFilename:"displayFilename",displayReset:"displayReset",icon:"icon",buttonTooltip:"buttonTooltip"},outputs:{fileChanged:"fileChanged"},standalone:!0,features:[O([{provide:V,useExisting:C(()=>o),multi:!0}]),b,w],decls:8,vars:10,consts:()=>{let i;return i="Zur\xFCcksetzen",[i,[1,"root"],[1,"button-file",3,"ngClass","ngbTooltip"],[3,"iconName",4,"ngIf"],["type","file",3,"change","ngModelChange","name","id","accept","ngModel"],["class","filename",4,"ngIf"],["class","reset-button reset-button-small ms-2",3,"click",4,"ngIf"],[3,"iconName"],[1,"filename"],[1,"reset-button","reset-button-small","ms-2",3,"click"]];},template:function(l,e){l&1&&(p(0,"div",1)(1,"div",2),g(2,U,1,1,"my-global-icon",3),p(3,"span"),h(4),m(),p(5,"input",4),d("change",function(s){return e.fileChange(s);}),N("ngModelChange",function(s){return F(e.fileInputValue,s)||(e.fileInputValue=s),s;}),m()(),g(6,W,2,1,"div",5)(7,j,2,0,"button",6),m()),l&2&&(a(),r("ngClass",e.classes)("ngbTooltip",e.buttonTooltip),a(),r("ngIf",e.icon),a(2),_(e.inputLabel),a(),r("name",e.inputName)("id",e.inputName)("accept",e.extensions),I("ngModel",e.fileInputValue),a(),r("ngIf",e.displayFilename===!0&&e.filename),a(),r("ngIf",e.displayReset&&e.filename));},dependencies:[P,$,A,G,k,L,z,D],styles:[`.root[_ngcontent-%COMP%]{height:auto;display:flex;align-items:center}.root[_ngcontent-%COMP%]   .button-file.with-icon[_ngcontent-%COMP%]   my-global-icon[_ngcontent-%COMP%]{position:relative;top:-1px;right:0;display:inline-block;width:20px;height:20px;line-height:20px}.root[_ngcontent-%COMP%]   .button-file.with-icon[_ngcontent-%COMP%]:not(.icon-only)   my-global-icon[_ngcontent-%COMP%]{margin-inline-end:.1875rem}.root[_ngcontent-%COMP%]   .filename[_ngcontent-%COMP%]{font-weight:600;margin-inline-start:.3125rem}
/*# sourceMappingURL=reactive-file.component-HSPJ45MU.css.map */`]}));let n=o;return n;})();export{ne as a};/**i18n:224bcada6943fe8b17ea60808c2d370cec9507c3bd670ebe71692d099a3befa1*///# sourceMappingURL=chunk-C6CC5JGF.js.map