import{a as k}from"./chunk-FZVS655W.js";import{a as B}from"./chunk-TL6U2ZZX.js";import{a as U}from"./chunk-4YSTL544.js";import{C as V,a as F,g as L,n as $}from"./chunk-3V3ZIFZ3.js";import{$a as C,Aa as g,Bb as u,Fc as b,Ka as x,Lb as E,Oc as R,Rc as z,Sh as H,Wb as I,X as w,Xb as N,Yb as O,Zc as D,_a as f,aa as P,cc as T,eb as l,ec as A,fa as m,fb as d,ga as p,gb as c,hb as v,rb as S,sh as G,xa as y,yc as r,zb as M}from"./chunk-AVPM423Z.js";import{i as _}from"./chunk-W5TMGCPH.js";var X=t=>({"buttons-aside":t});function W(t,n){if(t&1&&v(0,"img",2),t&2){let a=u();l("ngStyle",a.previewSize())("src",a.imageSrc,y);}}function q(t,n){if(t&1&&v(0,"div",3),t&2){let a=u();l("ngStyle",a.previewSize());}}function J(t,n){if(t&1){let a=S();d(0,"my-delete-button",7),M("click",function(){m(a),u();let o=E(5);return p(o.reset());}),c();}}var le=(()=>{let n=class n{serverService=P(H);inputName=r.required();inputLabel=r();displayDelete=r(!1,{transform:b});buttonsAside=r(!1,{transform:b});previewSize=r();fileConstraints=r();imageSrc;maxSizeText;file;imageExtensions=[];maxImageSize;maxImageSizeInBytes;allowedExtensionsMessage="";serverConfig;bytesPipe;constructor(){this.bytesPipe=new B(),this.maxSizeText="legnagyobb m\xE9ret";}getReactiveFileButtonTooltip(){return"(extensions: "+this.imageExtensions.join(", ")+", max size: "+this.maxImageSizeInBytes+")";}ngOnInit(){this.serverConfig=this.serverService.getHTMLConfig();let e=this.fileConstraints()??this.serverConfig.video.image;this.imageExtensions=e.extensions,this.maxImageSize=e.size.max,this.maxImageSizeInBytes=this.bytesPipe.transform(this.maxImageSize),this.allowedExtensionsMessage=this.imageExtensions.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?G(this.file).then(e=>this.imageSrc=e):this.imageSrc=void 0;}};_(n,"\u0275fac",function(o){return new(o||n)();}),_(n,"\u0275cmp",x({type:n,selectors:[["my-image-input"]],inputs:{inputName:[1,"inputName"],inputLabel:[1,"inputLabel"],displayDelete:[1,"displayDelete"],buttonsAside:[1,"buttonsAside"],previewSize:[1,"previewSize"],fileConstraints:[1,"fileConstraints"]},features:[T([{provide:F,useExisting:w(()=>n),multi:!0}])],decls:7,vars:11,consts:()=>{let e;e="El\u0151n\xE9zet";let o;return o="K\xE9p t\xF6rl\xE9se",[["reactiveFile",""],[1,"preview-container",3,"ngClass"],["alt",e,1,"preview",3,"ngStyle","src"],[1,"preview","no-image",3,"ngStyle"],[1,"buttons"],["placement","right","icon","upload","theme","primary",3,"ngModelChange","fileChanged","ngModel","inputName","inputLabel","extensions","maxFileSize","buttonTooltip"],["title",o,"theme","danger"],["title",o,"theme","danger",3,"click"]];},template:function(o,i){if(o&1){let h=S();d(0,"div",1),f(1,W,1,2,"img",2)(2,q,1,1,"div",3),d(3,"div",4)(4,"my-reactive-file",5,0),O("ngModelChange",function(s){return m(h),N(i.file,s)||(i.file=s),p(s);}),M("fileChanged",function(s){return m(h),p(i.onFileChanged(s));}),c(),f(6,J,1,0,"my-delete-button",6),c()();}o&2&&(l("ngClass",A(9,X,i.buttonsAside())),g(),C(i.imageSrc?1:2),g(3),I("ngModel",i.file),l("inputName",i.inputName())("inputLabel",i.inputLabel())("extensions",i.imageExtensions)("maxFileSize",i.maxImageSize)("buttonTooltip",i.getReactiveFileButtonTooltip()),g(2),C(i.displayDelete()&&i.file?6:-1));},dependencies:[D,R,z,V,L,$,k,U],styles:[`[_nghost-%COMP%]{display:block}.preview-container[_ngcontent-%COMP%], .preview[_ngcontent-%COMP%]{height:100%;width:100%}.preview-container[_ngcontent-%COMP%]{position:relative}.preview-container[_ngcontent-%COMP%]   .buttons[_ngcontent-%COMP%]{display:flex;gap:10px}.preview-container[_ngcontent-%COMP%]   .preview[_ngcontent-%COMP%]{object-fit:cover;border-radius:4px;max-width:100%}.preview-container[_ngcontent-%COMP%]:not(.buttons-aside)   .buttons[_ngcontent-%COMP%]{position:absolute;bottom:10px;left:10px;flex-wrap:wrap}.preview-container[_ngcontent-%COMP%]:not(.buttons-aside)   .preview.no-image[_ngcontent-%COMP%]{border:2px solid var(--secondary-icon-color);background-color:var(--bg)}.preview-container.buttons-aside[_ngcontent-%COMP%]{text-align:center;border:1px solid var(--secondary-icon-color);border-radius:4px;width:min-content;padding-inline-start:calc(1.275rem + .3vw);padding-inline-end:calc(1.275rem + .3vw);padding-top:1rem;padding-bottom:1rem}@media (min-width: 1200px){.preview-container.buttons-aside[_ngcontent-%COMP%]{padding-inline-start:1.5rem}}@media (min-width: 1200px){.preview-container.buttons-aside[_ngcontent-%COMP%]{padding-inline-end:1.5rem}}.preview-container.buttons-aside[_ngcontent-%COMP%]   .buttons[_ngcontent-%COMP%]{margin-top:1rem}
/*# sourceMappingURL=image-input.component-2JUT3Y5O.css.map */`]}));let t=n;return t;})();export{le as a};/**i18n:ceac57349051bcddcb40dd2878e0abcb86556d5ceb9d6109d22ac3f1ae3cc7b1*///# sourceMappingURL=chunk-QDU3F646.js.map