import{b as I}from"./chunk-OLEUXR5V.js";import{a as O}from"./chunk-BFY7NOOI.js";import{a as y}from"./chunk-HYHNBP3O.js";import{Db as C,Ea as f,Eb as c,Fc as x,Ha as s,Jc as P,Sa as h,Y as v,Za as _,Zb as w,Zf as E,ac as d,ba as u,gb as r,pb as S,qb as l,rb as m,ta as p,ug as M}from"./chunk-7W5IJG57.js";import{i as g}from"./chunk-RB5FWREQ.js";var T=(i,t)=>({width:i,height:t});function b(i,t){if(i&1&&m(0,"img",5),i&2){let o=c();r("ngStyle",d(2,T,o.previewWidth(),o.previewHeight()))("src",o.imageSrc,f);}}function z(i,t){if(i&1&&m(0,"div",6),i&2){let o=c();r("ngStyle",d(1,T,o.previewWidth(),o.previewHeight()));}}var B=(()=>{let t=class t{serverService=u(M);inputLabel=p(void 0);inputName=p(void 0);previewWidth=p(void 0);previewHeight=p(void 0);imageSrc;allowedExtensionsMessage="";maxSizeText;serverConfig;bytesPipe;file;constructor(){this.bytesPipe=new O(),this.maxSizeText="max size";}get videoImageExtensions(){return this.serverConfig.video.image.extensions;}get maxVideoImageSize(){return this.serverConfig.video.image.size.max;}get maxVideoImageSizeInBytes(){return this.bytesPipe.transform(this.maxVideoImageSize);}getReactiveFileButtonTooltip(){return"(extensions: "+this.videoImageExtensions+", "+this.maxSizeText+": "+this.maxVideoImageSizeInBytes+")";}ngOnInit(){this.serverConfig=this.serverService.getHTMLConfig(),this.allowedExtensionsMessage=this.videoImageExtensions.join(", ");}onFileChanged(e){this.file=e,this.propagateChange(this.file),this.updatePreview();}propagateChange=e=>{};writeValue(e){this.file=e,this.updatePreview();}registerOnChange(e){this.propagateChange=e;}registerOnTouched(){}updatePreview(){this.file&&E(this.file).then(e=>this.imageSrc=e);}};g(t,"\u0275fac",function(a){return new(a||t)();}),g(t,"\u0275cmp",h({type:t,selectors:[["my-preview-upload"]],inputs:{inputLabel:[1,"inputLabel"],inputName:[1,"inputName"],previewWidth:[1,"previewWidth"],previewHeight:[1,"previewHeight"]},features:[w([{provide:y,useExisting:v(()=>t),multi:!0}])],decls:5,vars:7,consts:()=>{let e;return e="\u03A0\u03C1\u03BF\u03B5\u03C0\u03B9\u03C3\u03BA\u03CC\u03C0\u03B7\u03C3\u03B7",[[1,"root"],[1,"preview-container"],["placement","right","icon","upload","theme","primary",3,"fileChanged","inputName","inputLabel","extensions","maxFileSize","buttonTooltip"],["class","preview","alt",e,3,"ngStyle","src",4,"ngIf"],["class","preview no-image",3,"ngStyle",4,"ngIf"],["alt",e,1,"preview",3,"ngStyle","src"],[1,"preview","no-image",3,"ngStyle"]];},template:function(a,n){a&1&&(S(0,"div",0)(1,"div",1)(2,"my-reactive-file",2),C("fileChanged",function(R){return n.onFileChanged(R);}),l(),_(3,b,1,5,"img",3)(4,z,1,4,"div",4),l()()),a&2&&(s(2),r("inputName",n.inputName())("inputLabel",n.inputLabel())("extensions",n.videoImageExtensions)("maxFileSize",n.maxVideoImageSize)("buttonTooltip",n.getReactiveFileButtonTooltip()),s(),r("ngIf",n.imageSrc),s(),r("ngIf",!n.imageSrc));},dependencies:[I,x,P],styles:[`.root[_ngcontent-%COMP%]{height:auto;display:flex;flex-direction:column}.root[_ngcontent-%COMP%]   .preview-container[_ngcontent-%COMP%]{position:relative}.root[_ngcontent-%COMP%]   .preview-container[_ngcontent-%COMP%]   my-reactive-file[_ngcontent-%COMP%]{position:absolute;bottom:10px;left:10px}.root[_ngcontent-%COMP%]   .preview-container[_ngcontent-%COMP%]   .preview[_ngcontent-%COMP%]{object-fit:cover;border-radius:4px;max-width:100%}.root[_ngcontent-%COMP%]   .preview-container[_ngcontent-%COMP%]   .preview.no-image[_ngcontent-%COMP%]{border:2px solid #808080;background-color:var(--bg)}
/*# sourceMappingURL=preview-upload.component-SESSEDVO.css.map */`]}));let i=t;return i;})();export{B as a};/**i18n:3558f4fa3a6acf6a8a484a0589828971efacd00f9f89386e64ec00a5fc269cc5*///# sourceMappingURL=chunk-CWLDP4JH.js.map