import{E as $,m as N,o as D,p as B}from"./chunk-744YDU4V.js";import{a as L}from"./chunk-NZVZXGIX.js";import{Db as M,Ea as y,Eb as _,Fc as R,Ha as p,Kc as I,Na as h,Ob as w,Pb as x,Qb as A,Sa as P,Wf as z,Xf as G,Yf as H,Za as g,ba as b,gb as a,ha as u,ia as f,lc as S,pb as l,qb as c,rb as d,rg as U,sa as C,ta as E,ub as T,vb as v,zb as m}from"./chunk-3MFSOWAK.js";import{i as s}from"./chunk-ASXIZBWV.js";var k=["bannerfileInput"],F=["bannerPopover"];function V(e,i){if(e&1&&d(0,"img",11),e&2){let o=_();a("src",o.preview||o.bannerUrl(),y);}}function X(e,i){e&1&&T(0);}function Q(e,i){if(e&1&&(l(0,"div",12),g(1,X,1,0,"ng-container",13),c()),e&2){let o=_(),n=A(7);a("ngbTooltip",o.bannerFormat),p(),a("ngTemplateOutlet",n);}}function j(e,i){e&1&&T(0);}function q(e,i){if(e&1){let o=v();l(0,"div",14)(1,"button",15),d(2,"my-global-icon",16),l(3,"span"),m(4,2),c()(),l(5,"div",17)(6,"div",18),g(7,j,1,0,"ng-container",13),c(),l(8,"button",19),M("click",function(){u(o);let t=_();return f(t.deleteBanner());}),d(9,"my-global-icon",20),l(10,"span"),m(11,3),c()()()();}if(e&2){let o=_(),n=A(7);p(6),a("ngbTooltip",o.bannerFormat),p(),a("ngTemplateOutlet",n);}}function Y(e,i){if(e&1){let o=v();d(0,"my-global-icon",21),l(1,"label",22),m(2,4),c(),l(3,"input",23,1),M("change",function(){u(o);let t=_();return f(t.onBannerChange());}),c();}if(e&2){let o=_();p(3),a("accept",o.bannerExtensions);}}var re=(()=>{let i=class i{serverService=b(U);notifier=b(z);bannerfileInput=h("bannerfileInput");bannerPopover=h("bannerPopover");bannerUrl=E(void 0);previewImage=E(!1);bannerChange=C();bannerDelete=C();bannerFormat="";maxBannerSize=0;bannerExtensions="";preview;ngOnInit(){let n=this.serverService.getHTMLConfig();this.maxBannerSize=n.banner.file.size.max,this.bannerExtensions=n.banner.file.extensions.join(", "),this.bannerFormat="kuvasuhde 6/1, suositeltu koko: 1920x317, max koko: "+G(this.maxBannerSize)+", p\xE4\xE4tteet: "+this.bannerExtensions+"";}onBannerChange(){let n=this.bannerfileInput().nativeElement.files[0];if(n.size>this.maxBannerSize){this.notifier.error("Error","T\xE4m\xE4 kuva on liian suuri.");return;}let t=new FormData();t.append("bannerfile",n),this.bannerPopover()?.close(),this.bannerChange.emit(t),this.previewImage()&&H(n).then(r=>this.preview=r);}deleteBanner(){this.preview=void 0,this.bannerDelete.emit();}hasBanner(){return!!this.preview||!!this.bannerUrl();}};s(i,"\u0275fac",function(t){return new(t||i)();}),s(i,"\u0275cmp",P({type:i,selectors:[["my-actor-banner-edit"]],viewQuery:function(t,r){t&1&&(w(r.bannerfileInput,k,5),w(r.bannerPopover,F,5)),t&2&&x(2);},inputs:{bannerUrl:[1,"bannerUrl"],previewImage:[1,"previewImage"]},outputs:{bannerChange:"bannerChange",bannerDelete:"bannerDelete"},decls:8,vars:3,consts:()=>{let n;n="Muuta bannerisi";let t;t="Poista banneri";let r;return r="Lataa uusi banneri",[["uploadNewBanner",""],["bannerfileInput",""],n,t,r,[1,"actor"],[1,"actor-img-edit-container"],[1,"banner-placeholder"],["alt","Banner",3,"src",4,"ngIf"],["class","actor-img-edit-button button-file primary-button button-focus-within","placement","right","container","body",3,"ngbTooltip",4,"ngIf"],["ngbDropdown","","placement","right",4,"ngIf"],["alt","Banner",3,"src"],["placement","right","container","body",1,"actor-img-edit-button","button-file","primary-button","button-focus-within",3,"ngbTooltip"],[4,"ngTemplateOutlet"],["ngbDropdown","","placement","right"],["type","button","ngbDropdownToggle","",1,"actor-img-edit-button","button-file","primary-button"],["iconName","edit"],["ngbDropdownMenu",""],[1,"dropdown-item","dropdown-file","button-focus-within",3,"ngbTooltip"],["type","button",1,"dropdown-item",3,"click"],["iconName","delete"],["iconName","upload"],["for","bannerfile"],["type","file","name","bannerfile","id","bannerfile",3,"change","accept"]];},template:function(t,r){t&1&&(l(0,"div",5)(1,"div",6)(2,"div",7),g(3,V,1,1,"img",8),c(),g(4,Q,2,2,"div",9)(5,q,12,2,"div",10),c()(),g(6,Y,5,1,"ng-template",null,0,S)),t&2&&(p(3),a("ngIf",r.hasBanner()),p(),a("ngIf",!r.hasBanner()),p(),a("ngIf",r.hasBanner()));},dependencies:[R,$,I,B,D,L,N],styles:[`.dropdown-file[_ngcontent-%COMP%]{position:relative;overflow:hidden;display:inline-block}.dropdown-file[_ngcontent-%COMP%]   input[type=file][_ngcontent-%COMP%]{position:absolute;top:0;right:0;width:100%;height:100%;font-size:100px;text-align:end;filter:alpha(opacity=0);opacity:0;outline:none;background:var(--bg);cursor:inherit;display:block}.actor-img-edit-button[_ngcontent-%COMP%]{width:31px;cursor:pointer;display:flex;justify-content:center;align-items:center}.actor-img-edit-button[_ngcontent-%COMP%]   my-global-icon[_ngcontent-%COMP%]{position:relative;top:-1px;right:0;display:inline-block;width:19px;height:19px;line-height:19px}.actor-img-edit-button[_ngcontent-%COMP%]:not(.icon-only)   my-global-icon[_ngcontent-%COMP%]{margin-inline-end:0}label[_ngcontent-%COMP%]{font-weight:400;font-size:inherit;color:inherit;margin:0}
/*# sourceMappingURL=actor-image-edit-ID47BVXQ.css.map */`,`.banner-placeholder[_ngcontent-%COMP%]{position:relative;height:0;width:100%;padding-top:16.6666666667%}.banner-placeholder[_ngcontent-%COMP%] > div[_ngcontent-%COMP%], .banner-placeholder[_ngcontent-%COMP%] > img[_ngcontent-%COMP%]{position:absolute;width:100%;height:100%;top:0}.banner-placeholder[_ngcontent-%COMP%]{background-color:var(--bg-secondary-500)}.actor-img-edit-container[_ngcontent-%COMP%]{position:relative;display:flex;justify-content:center;align-items:center}.dropdown[_ngcontent-%COMP%]{position:absolute}.dropdown[_ngcontent-%COMP%] > .actor-img-edit-button[_ngcontent-%COMP%]{position:relative}.actor-img-edit-button[_ngcontent-%COMP%]{width:auto;position:absolute}.actor-img-edit-button[_ngcontent-%COMP%]   label[_ngcontent-%COMP%]{font-weight:600;margin-bottom:0}.button-focus-within[_ngcontent-%COMP%]:focus-within{box-shadow:0 0 0 .2rem var(--fg-100)}.dropdown-item[_ngcontent-%COMP%]{padding:var(--input-y-padding) 15px}.dropdown-item[_ngcontent-%COMP%]   my-global-icon[_ngcontent-%COMP%]{width:22px;opacity:.7;position:relative;top:-2px;margin-inline-end:.625rem}.dropdown-toggle[_ngcontent-%COMP%]:after{display:none}
/*# sourceMappingURL=actor-banner-edit.component-N4Y65F3I.css.map */`]}));let e=i;return e;})();export{re as a};/**i18n:a80de7963c3a1ee38e5afb7317b8dafa5dd6a0c8b3d465be96b90b317d6167e1*///# sourceMappingURL=chunk-2F62NLSX.js.map