1import{a as Je,b as Ze}from"./chunk-64IEP75B.js";import{s as pe}from"./chunk-WDH3LG4L.js";import{a as it}from"./chunk-Q2EVE2WY.js";import{a as ce,b as me,c as tt}from"./chunk-N3TGFQAO.js";import{a as et}from"./chunk-RUDOQ4J6.js";import{b as de}from"./chunk-NZIBTTVY.js";import{d as le}from"./chunk-NXWNKTP5.js";import{a as F}from"./chunk-OATPHP6U.js";import{c as Ke,e as Ge}from"./chunk-AN3X2WPI.js";import{j as Ye,k as qe,n as Qe}from"./chunk-XYYBCPI6.js";import{$b as Y,Ab as X,Ac as q,Bb as b,Cb as o,Db as s,Dc as H,E as Oe,Eb as _,Ib as We,Jb as Be,K as we,L as K,Lb as M,Ma as U,P as Ae,Pa as Fe,Qb as u,Ra as d,Sb as m,U as I,Ub as oe,Vb as G,Wb as J,Z as h,_ as g,_a as He,_b as z,bc as ye,cc as l,d as Pe,dc as V,eb as N,ec as k,fc as Z,jb as ne,ka as f,na as Ue,oc as se,pc as je,qc as Ne,s as W,sc as $e,tb as ve,u as _e,ub as T,uc as Xe,wb as D,yb as Le,zb as $}from"./chunk-R7SP6EIA.js";import{a as v,b as L}from"./chunk-7CGTOI24.js";var Q=class n{http=I(Ge);ssrCache=I(et);apiUrl=F.API_URL+"media";listMedia(t,e=20,i="",a="all"){let r=new Ke().set("page",t).set("limit",e).set("search",i);return a!=="all"&&(r=r.set("fileType",a)),this.http.get(this.apiUrl,{params:r})}uploadFiles(t){let e=new FormData;return t.forEach(i=>e.append("files",i,i.name)),this.http.post(`${this.apiUrl}/upload`,e).pipe(K(()=>this.ssrCache.clear()))}importRemoteImages(t){return this.http.post(`${this.apiUrl}/import-remote`,{items:t}).pipe(K(()=>this.ssrCache.clear()))}updateMedia(t,e){return this.http.put(`${this.apiUrl}/${t}`,e).pipe(K(()=>this.ssrCache.clear()))}deleteFile(t){return this.http.delete(`${this.apiUrl}/${t}`).pipe(K(()=>this.ssrCache.clear()))}static \u0275fac=function(e){return new(e||n)};static \u0275prov=Ae({token:n,factory:n.\u0275fac,providedIn:"root"})};var ht=["wrapper"],gt=["sourceImage"];function ut(n,t){if(n&1){let e=M();o(0,"img",5,0),u("load",function(){h(e);let a=m();return g(a.imageLoadedInView())})("mousedown",function(a){h(e);let r=m();return g(r.startMove(a,r.moveTypes.Drag))})("touchstart",function(a){h(e);let r=m();return g(r.startMove(a,r.moveTypes.Drag))})("error",function(a){h(e);let r=m();return g(r.loadImageError(a))}),s()}if(n&2){let e=t.ngIf,i=m();z("visibility",i.imageVisible?"visible":"hidden")("transform",i.safeTransformStyle()),Y("ngx-ic-draggable",!i.disabled&&i.allowMoveImage),b("src",e,U),ve("alt",i.imageAltText)}}function xt(n,t){if(n&1){let e=M();We(0),o(1,"span",9),u("mousedown",function(a){h(e);let r=m(2);return g(r.startMove(a,r.moveTypes.Resize,"topleft"))})("touchstart",function(a){h(e);let r=m(2);return g(r.startMove(a,r.moveTypes.Resize,"topleft"))}),_(2,"span",10),s(),o(3,"span",11),u("mousedown",function(a){h(e);let r=m(2);return g(r.startMove(a,r.moveTypes.Resize,"topright"))})("touchstart",function(a){h(e);let r=m(2);return g(r.startMove(a,r.moveTypes.Resize,"topright"))}),_(4,"span",10),s(),o(5,"span",12),u("mousedown",function(a){h(e);let r=m(2);return g(r.startMove(a,r.moveTypes.Resize,"bottomright"))})("touchstart",function(a){h(e);let r=m(2);return g(r.startMove(a,r.moveTypes.Resize,"bottomright"))}),_(6,"span",10),s(),o(7,"span",13),u("mousedown",function(a){h(e);let r=m(2);return g(r.startMove(a,r.moveTypes.Resize,"bottomleft"))})("touchstart",function(a){h(e);let r=m(2);return g(r.startMove(a,r.moveTypes.Resize,"bottomleft"))}),_(8,"span",10),s(),o(9,"span",14),u("mousedown",function(a){h(e);let r=m(2);return g(r.startMove(a,r.moveTypes.Resize,"top"))})("touchstart",function(a){h(e);let r=m(2);return g(r.startMove(a,r.moveTypes.Resize,"top"))}),s(),o(10,"span",15),u("mousedown",function(a){h(e);let r=m(2);return g(r.startMove(a,r.moveTypes.Resize,"top"))})("touchstart",function(a){h(e);let r=m(2);return g(r.startMove(a,r.moveTypes.Resize,"top"))}),_(11,"span",10),s(),o(12,"span",16),u("mousedown",function(a){h(e);let r=m(2);return g(r.startMove(a,r.moveTypes.Resize,"right"))})("touchstart",function(a){h(e);let r=m(2);return g(r.startMove(a,r.moveTypes.Resize,"right"))}),s(),o(13,"span",17),u("mousedown",function(a){h(e);let r=m(2);return g(r.startMove(a,r.moveTypes.Resize,"right"))})("touchstart",function(a){h(e);let r=m(2);return g(r.startMove(a,r.moveTypes.Resize,"right"))}),_(14,"span",10),s(),o(15,"span",18),u("mousedown",function(a){h(e);let r=m(2);return g(r.startMove(a,r.moveTypes.Resize,"bottom"))})("touchstart",function(a){h(e);let r=m(2);return g(r.startMove(a,r.moveTypes.Resize,"bottom"))}),s(),o(16,"span",19),u("mousedown",function(a){h(e);let r=m(2);return g(r.startMove(a,r.moveTypes.Resize,"bottom"))})("touchstart",function(a){h(e);let r=m(2);return g(r.startMove(a,r.moveTypes.Resize,"bottom"))}),_(17,"span",10),s(),o(18,"span",20),u("mousedown",function(a){h(e);let r=m(2);return g(r.startMove(a,r.moveTypes.Resize,"left"))})("touchstart",function(a){h(e);let r=m(2);return g(r.startMove(a,r.moveTypes.Resize,"left"))}),s(),o(19,"span",21),u("mousedown",function(a){h(e);let r=m(2);return g(r.startMove(a,r.moveTypes.Resize,"left"))})("touchstart",function(a){h(e);let r=m(2);return g(r.startMove(a,r.moveTypes.Resize,"left"))}),_(20,"span",10),s(),Be()}}function ft(n,t){if(n&1){let e=M();o(0,"div",6),u("keydown",function(a){h(e);let r=m();return g(r.keyboardAccess(a))}),o(1,"div",7),u("mousedown",function(a){h(e);let r=m();return g(r.startMove(a,r.moveTypes.Move))})("touchstart",function(a){h(e);let r=m();return g(r.startMove(a,r.moveTypes.Move))}),s(),ne(2,xt,21,0,"ng-container",8),s()}if(n&2){let e=m();z("top",e.state.cropper().y1,"px")("left",e.state.cropper().x1,"px")("width",e.state.cropper().x2-e.state.cropper().x1,"px")("height",e.state.cropper().y2-e.state.cropper().y1,"px")("margin-left",e.state.options.alignImage==="center"?e.marginLeft:null)("visibility",e.imageVisible?"visible":"hidden"),Y("ngx-ic-round",e.state.options.roundCropper),ve("aria-label",e.state.options.cropperFrameAriaLabel),d(2),b("ngIf",!e.state.options.hideResizeSquares&&!(e.state.options.cropperStaticWidth&&e.state.options.cropperStaticHeight))}}function ee(n,t,e){return n=bt(n,t),he(n,t,e)}function bt(n,t){let e=n.x2-n.x1,i=n.y2-n.y1,a=n.x1+e/2,r=n.y1+i/2;t.options.cropperStaticHeight&&t.options.cropperStaticWidth?(e=t.maxSize().width>t.options.cropperStaticWidth?t.options.cropperStaticWidth:t.maxSize().width,i=t.maxSize().height>t.options.cropperStaticHeight?t.options.cropperStaticHeight:t.maxSize().height):(e=Math.max(t.cropperScaledMinWidth,Math.min(e,t.cropperScaledMaxWidth,t.maxSize().width)),i=Math.max(t.cropperScaledMinHeight,Math.min(i,t.cropperScaledMaxHeight,t.maxSize().height)),t.options.maintainAspectRatio&&(t.maxSize().width/t.options.aspectRatio<t.maxSize().height?i=e/t.options.aspectRatio:e=i*t.options.aspectRatio));let p=a-e/2,c=p+e,x=r-i/2,w=x+i;return{x1:p,x2:c,y1:x,y2:w}}function he(n,t,e=!1){return n.x1<0&&(n=L(v({},n),{x1:0,x2:n.x2-(e?n.x1:0)})),n.y1<0&&(n=L(v({},n),{y2:n.y2-(e?n.y1:0),y1:0})),n.x2>t.maxSize().width&&(n=L(v({},n),{x1:n.x1-(e?n.x2-t.maxSize().width:0),x2:t.maxSize().width})),n.y2>t.maxSize().height&&(n=L(v({},n),{y1:n.y1-(e?n.y2-t.maxSize().height:0),y2:t.maxSize().height})),n}function _t(n,t){let e=ge(n)-t.clientX,i=ue(n)-t.clientY;return{x1:t.cropper.x1+e,y1:t.cropper.y1+i,x2:t.cropper.x2+e,y2:t.cropper.y2+i}}function at(n,t,e){let i=v({},e.cropper()),a=ge(n)-t.clientX,r=ue(n)-t.clientY;switch(t.position){case"left":i.x1=Math.min(Math.max(t.cropper.x1+a,i.x2-e.cropperScaledMaxWidth),i.x2-e.cropperScaledMinWidth);break;case"topleft":i.x1=Math.min(Math.max(t.cropper.x1+a,i.x2-e.cropperScaledMaxWidth),i.x2-e.cropperScaledMinWidth),i.y1=Math.min(Math.max(t.cropper.y1+r,i.y2-e.cropperScaledMaxHeight),i.y2-e.cropperScaledMinHeight);break;case"top":i.y1=Math.min(Math.max(t.cropper.y1+r,i.y2-e.cropperScaledMaxHeight),i.y2-e.cropperScaledMinHeight);break;case"topright":i.x2=Math.max(Math.min(t.cropper.x2+a,i.x1+e.cropperScaledMaxWidth),i.x1+e.cropperScaledMinWidth),i.y1=Math.min(Math.max(t.cropper.y1+r,i.y2-e.cropperScaledMaxHeight),i.y2-e.cropperScaledMinHeight);break;case"right":i.x2=Math.max(Math.min(t.cropper.x2+a,i.x1+e.cropperScaledMaxWidth),i.x1+e.cropperScaledMinWidth);break;case"bottomright":i.x2=Math.max(Math.min(t.cropper.x2+a,i.x1+e.cropperScaledMaxWidth),i.x1+e.cropperScaledMinWidth),i.y2=Math.max(Math.min(t.cropper.y2+r,i.y1+e.cropperScaledMaxHeight),i.y1+e.cropperScaledMinHeight);break;case"bottom":i.y2=Math.max(Math.min(t.cropper.y2+r,i.y1+e.cropperScaledMaxHeight),i.y1+e.cropperScaledMinHeight);break;case"bottomleft":i.x1=Math.min(Math.max(t.cropper.x1+a,i.x2-e.cropperScaledMaxWidth),i.x2-e.cropperScaledMinWidth),i.y2=Math.max(Math.min(t.cropper.y2+r,i.y1+e.cropperScaledMaxHeight),i.y1+e.cropperScaledMinHeight);break;case"center":let p="scale"in n?n.scale:1,c=Math.min(Math.max(e.cropperScaledMinWidth,Math.abs(t.cropper.x2-t.cropper.x1)*p),e.cropperScaledMaxWidth),x=Math.min(Math.max(e.cropperScaledMinHeight,Math.abs(t.cropper.y2-t.cropper.y1)*p),e.cropperScaledMaxHeight);i.x1=t.clientX-c/2,i.x2=t.clientX+c/2,i.y1=t.clientY-x/2,i.y2=t.clientY+x/2,i.x1<0?(i.x2-=i.x1,i.x1=0):i.x2>e.maxSize().width&&(i.x1-=i.x2-e.maxSize().width,i.x2=e.maxSize().width),i.y1<0?(i.y2-=i.y1,i.y1=0):i.y2>e.maxSize().height&&(i.y1-=i.y2-e.maxSize().height,i.y2=e.maxSize().height);break}return e.options.maintainAspectRatio?wt(t.position,i,e):i}function wt(n,t,e){t=v({},t);let i=0,a=0;switch(n){case"top":t.x2=t.x1+(t.y2-t.y1)*e.options.aspectRatio,i=Math.max(t.x2-e.maxSize().width,0),a=Math.max(0-t.y1,0),(i>0||a>0)&&(t.x2-=a*e.options.aspectRatio>i?a*e.options.aspectRatio:i,t.y1+=a*e.options.aspectRatio>i?a:i/e.options.aspectRatio);break;case"bottom":t.x2=t.x1+(t.y2-t.y1)*e.options.aspectRatio,i=Math.max(t.x2-e.maxSize().width,0),a=Math.max(t.y2-e.maxSize().height,0),(i>0||a>0)&&(t.x2-=a*e.options.aspectRatio>i?a*e.options.aspectRatio:i,t.y2-=a*e.options.aspectRatio>i?a:i/e.options.aspectRatio);break;case"topleft":t.y1=t.y2-(t.x2-t.x1)/e.options.aspectRatio,i=Math.max(0-t.x1,0),a=Math.max(0-t.y1,0),(i>0||a>0)&&(t.x1+=a*e.options.aspectRatio>i?a*e.options.aspectRatio:i,t.y1+=a*e.options.aspectRatio>i?a:i/e.options.aspectRatio);break;case"topright":t.y1=t.y2-(t.x2-t.x1)/e.options.aspectRatio,i=Math.max(t.x2-e.maxSize().width,0),a=Math.max(0-t.y1,0),(i>0||a>0)&&(t.x2-=a*e.options.aspectRatio>i?a*e.options.aspectRatio:i,t.y1+=a*e.options.aspectRatio>i?a:i/e.options.aspectRatio);break;case"right":case"bottomright":t.y2=t.y1+(t.x2-t.x1)/e.options.aspectRatio,i=Math.max(t.x2-e.maxSize().width,0),a=Math.max(t.y2-e.maxSize().height,0),(i>0||a>0)&&(t.x2-=a*e.options.aspectRatio>i?a*e.options.aspectRatio:i,t.y2-=a*e.options.aspectRatio>i?a:i/e.options.aspectRatio);break;case"left":case"bottomleft":t.y2=t.y1+(t.x2-t.x1)/e.options.aspectRatio,i=Math.max(0-t.x1,0),a=Math.max(t.y2-e.maxSize().height,0),(i>0||a>0)&&(t.x1+=a*e.options.aspectRatio>i?a*e.options.aspectRatio:i,t.y2-=a*e.options.aspectRatio>i?a:i/e.options.aspectRatio);break;case"center":t.x2=t.x1+(t.y2-t.y1)*e.options.aspectRatio,t.y2=t.y1+(t.x2-t.x1)/e.options.aspectRatio;let r=Math.max(0-t.x1,0),p=Math.max(t.x2-e.maxSize().width,0),c=Math.max(t.y2-e.maxSize().height,0),x=Math.max(0-t.y1,0);(r>0||p>0||c>0||x>0)&&(t.x1+=c*e.options.aspectRatio>r?c*e.options.aspectRatio:r,t.x2-=x*e.options.aspectRatio>p?x*e.options.aspectRatio:p,t.y1+=x*e.options.aspectRatio>p?x:p/e.options.aspectRatio,t.y2-=c*e.options.aspectRatio>r?c:r/e.options.aspectRatio);break}return t}function ge(n){return"touches"in n&&n.touches[0]?n.touches[0].clientX:"clientX"in n?n.clientX:0}function ue(n){return"touches"in n&&n.touches[0]?n.touches[0].clientY:"
1clientX"in n?n.clientY:0}var Me=class{constructor(){this.cropper=f({x1:0,x2:0,y1:0,y2:0}),this.maxSize=f({width:0,height:0}),this.transform={},this.options={format:"png",output:"blob",autoCrop:!0,maintainAspectRatio:!0,aspectRatio:1,resetCropOnAspectRatioChange:!0,resizeToWidth:0,resizeToHeight:0,cropperMinWidth:0,cropperMinHeight:0,cropperMaxHeight:0,cropperMaxWidth:0,cropperStaticWidth:0,cropperStaticHeight:0,canvasRotation:0,roundCropper:!1,onlyScaleDown:!1,imageQuality:92,backgroundColor:void 0,containWithinAspectRatio:!1,hideResizeSquares:!1,alignImage:"center",cropperFrameAriaLabel:void 0,checkImageType:!0},this.cropperScaledMinWidth=20,this.cropperScaledMinHeight=20,this.cropperScaledMaxWidth=20,this.cropperScaledMaxHeight=20,this.stepSize=3}setOptionsFromChanges(t){t.options?.currentValue&&this.setOptions(t.options.currentValue);let e=Object.entries(t).filter(([i])=>i in this.options).reduce((i,[a,r])=>L(v({},i),{[a]:r.currentValue}),{});Object.keys(e).length>0&&this.setOptions(e)}setOptions(t){if(this.options=v(v({},this.options),t||{}),this.validateOptions(),!this.loadedImage?.transformed.image.complete||!this.maxSize)return;let e=!1;this.options.maintainAspectRatio&&t.aspectRatio||"maintainAspectRatio"in t?(this.setCropperScaledMinSize(),this.setCropperScaledMaxSize(),this.options.maintainAspectRatio&&(this.options.resetCropOnAspectRatioChange||!this.aspectRatioIsCorrect())&&(this.cropper.set(this.maxSizeCropperPosition()),e=!0)):((t.cropperMinWidth||t.cropperMinHeight)&&(this.setCropperScaledMinSize(),e=!0),(t.cropperMaxWidth||t.cropperMaxHeight)&&(this.setCropperScaledMaxSize(),e=!0),(t.cropperStaticWidth||t.cropperStaticHeight)&&(e=!0)),e&&this.cropper.update(i=>ee(i,this,!1))}validateOptions(){if(this.options.maintainAspectRatio&&!this.options.aspectRatio)throw new Error("`aspectRatio` should > 0 when `maintainAspectRatio` is enabled")}setMaxSize(t,e){this.maxSize.set({width:t,height:e}),this.setCropperScaledMinSize(),this.setCropperScaledMaxSize()}setCropperScaledMinSize(){this.loadedImage?.transformed.size?(this.setCropperScaledMinWidth(),this.setCropperScaledMinHeight()):(this.cropperScaledMinWidth=20,this.cropperScaledMinHeight=20)}setCropperScaledMinWidth(){this.cropperScaledMinWidth=this.options.cropperMinWidth>0?Math.max(20,this.options.cropperMinWidth/this.loadedImage.transformed.size.width*this.maxSize().width):20}setCropperScaledMinHeight(){this.options.maintainAspectRatio?this.cropperScaledMinHeight=Math.max(20,this.cropperScaledMinWidth/this.options.aspectRatio):this.options.cropperMinHeight>0?this.cropperScaledMinHeight=Math.max(20,this.options.cropperMinHeight/this.loadedImage.transformed.size.height*this.maxSize().height):this.cropperScaledMinHeight=20}setCropperScaledMaxSize(){if(this.loadedImage?.transformed.size){let t=this.loadedImage.transformed.size.width/this.maxSize().width;this.cropperScaledMaxWidth=this.options.cropperMaxWidth>20?this.options.cropperMaxWidth/t:this.maxSize().width,this.cropperScaledMaxHeight=this.options.cropperMaxHeight>20?this.options.cropperMaxHeight/t:this.maxSize().height,this.options.maintainAspectRatio&&(this.cropperScaledMaxWidth>this.cropperScaledMaxHeight*this.options.aspectRatio?this.cropperScaledMaxWidth=this.cropperScaledMaxHeight*this.options.aspectRatio:this.cropperScaledMaxWidth<this.cropperScaledMaxHeight*this.options.aspectRatio&&(this.cropperScaledMaxHeight=this.cropperScaledMaxWidth/this.options.aspectRatio))}else this.cropperScaledMaxWidth=this.maxSize().width,this.cropperScaledMaxHeight=this.maxSize().height}equalsCropperPosition(t){let e=this.cropper();return e==null&&t==null||e!=null&&t!=null&&e.x1.toFixed(3)===t.x1.toFixed(3)&&e.y1.toFixed(3)===t.y1.toFixed(3)&&e.x2.toFixed(3)===t.x2.toFixed(3)&&e.y2.toFixed(3)===t.y2.toFixed(3)}equalsTransformTranslate(t){return(this.transform.translateH??0)===(t.translateH??0)&&(this.transform.translateV??0)===(t.translateV??0)}equalsTransform(t){return this.equalsTransformTranslate(t)&&(this.transform.scale??1)===(t.scale??1)&&(this.transform.rotate??0)===(t.rotate??0)&&(this.transform.flipH??!1)===(t.flipH??!1)&&(this.transform.flipV??!1)===(t.flipV??!1)}aspectRatioIsCorrect(){let t=this.cropper();return(t.x2-t.x1)/(t.y2-t.y1)===this.options.aspectRatio}resizeCropperPosition(t){(t.width!==this.maxSize().width||t.height!==this.maxSize().height)&&this.cropper.update(e=>({x1:e.x1*this.maxSize().width/t.width,x2:e.x2*this.maxSize().width/t.width,y1:e.y1*this.maxSize().height/t.height,y2:e.y2*this.maxSize().height/t.height}))}maxSizeCropperPosition(){return{x1:0,y1:0,x2:this.maxSize().width,y2:this.maxSize().height}}toCropInput(){return{cropper:this.cropper(),maxSize:this.maxSize(),transform:this.transform,loadedImage:this.loadedImage,options:v({},this.options)}}},R=(function(n){return n.Drag="drag",n.Move="move",n.Resize="resize",n.Pinch="pinch",n})(R||{});function vt(n,t,e){let i=n.width,a=n.height;t=Math.round(t),e=Math.round(e);let r=i/t,p=a/e,c=Math.ceil(r/2),x=Math.ceil(p/2),w=n.getContext("2d");if(w){let P=w.getImageData(0,0,i,a),S=w.createImageData(t,e),y=P.data,C=S.data;for(let E=0;E<e;E++)for(let O=0;O<t;O++){let te=(O+E*t)*4,lt=E*p,A=0,ie=0,Se=0,ze=0,Re=0,Ee=0,Te=0,dt=Math.floor(O*r),ct=Math.floor(E*p),fe=Math.ceil((O+1)*r),be=Math.ceil((E+1)*p);fe=Math.min(fe,i),be=Math.min(be,a);for(let ae=ct;ae<be;ae++){let De=Math.abs(lt-ae)/x,mt=O*r,pt=De*De;for(let re=dt;re<fe;re++){let Ve=Math.abs(mt-re)/c,B=Math.sqrt(pt+Ve*Ve);if(B>=1)continue;A=2*B*B*B-3*B*B+1;let j=4*(re+ae*i);Te+=A*y[j+3],Se+=A,y[j+3]<255&&(A=A*y[j+3]/250),ze+=A*y[j],Re+=A*y[j+1],Ee+=A*y[j+2],ie+=A}}C[te]=ze/ie,C[te+1]=Re/ie,C[te+2]=Ee/ie,C[te+3]=Te/Se}n.width=t,n.height=e,w.putImageData(S,0,0)}}function rt(n,t){return n/100*t}var ke=class{crop(t,e){let i=this.getImagePosition(t),a=i.x2-i.x1,r=i.y2-i.y1,p=document.createElement("canvas");p.width=a,p.height=r;let c=p.getContext("2d");if(!c)return null;t.options?.backgroundColor!=null&&(c.fillStyle=t.options.backgroundColor,c.fillRect(0,0,a,r));let x=(t.transform?.scale||1)*(t.transform?.flipH?-1:1),w=(t.transform?.scale||1)*(t.transform?.flipV?-1:1),{translateH:P,translateV:S}=this.getCanvasTranslate(t),y=t.loadedImage.transformed;c.setTransform(x,0,0,w,y.size.width/2+P,y.size.height/2+S),c.translate(-i.x1/x,-i.y1/w),c.rotate((t.transform?.rotate||0)*Math.PI/180),c.drawImage(y.image,-y.size.width/2,-y.size.height/2);let C={width:a,height:r,imagePosition:i,cropperPosition:v({},t.cropper)};t.options?.containWithinAspectRatio&&(C.offsetImagePosition=this.getOffsetImagePosition(t));let E=this.getResizeRatio(a,r,t.options);return E!==1&&(C.width=Math.round(a*E),C.height=t.options?.maintainAspectRatio?Math.round(C.width/(t.options?.aspectRatio??1)):Math.round(r*E),vt(p,C.width,C.height)),e==="blob"?this.cropToBlob(C,p,t):(C.base64=p.toDataURL("image/"+(t.options?.format??"png"),this.getQuality(t.options)),C)}async cropToBlob(t,e,i){return t.blob=await new Promise(a=>e.toBlob(a,"image/"+(i.options?.format??"png"),this.getQuality(i.options))),t.blob&&(t.objectUrl=URL.createObjectURL(t.blob)),t}getCanvasTranslate(t){if(t.transform?.translateUnit==="px"){let e=this.getRatio(t);return{translateH:(t.transform?.translateH||0)*e,translateV:(t.transform?.translateV||0)*e}}else return{translateH:t.transform?.translateH?rt(t.transform.translateH,t.loadedImage.transformed.size.width):0,translateV:t.transform?.translateV?rt(t.transform.translateV,t.loadedImage.transformed.size.height):0}}getRatio(t){return t.loadedImage.transformed.size.width/t.maxSize.width}getImagePosition(t){let e=this.getRatio(t),i={x1:Math.round(t.cropper.x1*e),y1:Math.round(t.cropper.y1*e),x2:Math.round(t.cropper.x2*e),y2:Math.round(t.cropper.y2*e)};return t.options?.containWithinAspectRatio||(i.x1=Math.max(i.x1,0),i.y1=Math.max(i.y1,0),i.x2=Math.min(i.x2,t.loadedImage.transformed.size.width),i.y2=Math.min(i.y2,t.loadedImage.transformed.size.height)),i}getOffsetImagePosition(t){let e=(t.options?.canvasRotation??0)+t.loadedImage.exifTransform.rotate,i=this.getRatio(t),a,r;e%2?(a=(t.loadedImage.transformed.size.width-t.loadedImage.original.size.height)/2,r=(t.loadedImage.transformed.size.height-t.loadedImage.original.size.width)/2):(a=(t.loadedImage.transformed.size.width-t.loadedImage.original.size.width)/2,r=(t.loadedImage.transformed.size.height-t.loadedImage.original.size.height)/2);let p=t.cropper,c={x1:Math.round(p.x1*i)-a,y1:Math.round(p.y1*i)-r,x2:Math.round(p.x2*i)-a,y2:Math.round(p.y2*i)-r};return t.options?.containWithinAspectRatio||(c.x1=Math.max(c.x1,0),c.y1=Math.max(c.y1,0),c.x2=Math.min(c.x2,t.loadedImage.transformed.size.width),c.y2=Math.min(c.y2,t.loadedImage.transformed.size.height)),c}getResizeRatio(t,e,i){let a=new Array;i?.resizeToWidth&&i.resizeToWidth>0&&a.push(i.resizeToWidth/t),i?.resizeToHeight&&i.resizeToHeight>0&&a.push(i.resizeToHeight/e);let r=a.length===0?1:Math.min(...a);return r>1&&!i?.onlyScaleDown?r:Math.min(r,1)}getQuality(t){return Math.min(1,Math.max(0,(t?.imageQuality??92)/100))}},yt=[new Uint8Array([255,216,255,225,0,34,69,120,105,102,0,0,77,77,0,42,0,0,0,8,0,1,1,18,0,3,0,0,0,1,0,6,0,0,0,0,0,0,255,219,0,132,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,255,192,0,17,8,0,1,0,2,3,1,17,0,2,17,1,3,17,1,255,196,0,74,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,16,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,218,0,12,3,1,0,2,17,3,17,0,63,0,63,240,127,255,217])],Ct=URL.createObjectURL(new Blob(yt,{type:"image/jpeg"}));function Mt(){return new Promise(n=>{let t=new Image;t.onload=()=>{let e=t.width===1&&t.height===2;n(e)},t.src=Ct})}function kt(n){switch(typeof n=="object"&&(n=It(n)),n){case 2:return{rotate:0,flip:!0};case 3:return{rotate:2,flip:!1};case 4:return{rotate:2,flip:!0};case 5:return{rotate:1,flip:!0};case 6:return{rotate:1,flip:!1};case 7:return{rotate:3,flip:!0};case 8:return{rotate:3,flip:!1};default:return{rotate:0,flip:!1}}}function It(n){let t=new DataView(n);if(t.getUint16(0,!1)!==65496)return-2;let e=t.byteLength,i=2;
1for(;i<e;){if(t.getUint16(i+2,!1)<=8)return-1;let a=t.getUint16(i,!1);if(i+=2,a==65505){if(t.getUint32(i+=2,!1)!==1165519206)return-1;let r=t.getUint16(i+=6,!1)==18761;i+=t.getUint32(i+4,r);let p=t.getUint16(i,r);i+=2;for(let c=0;c<p;c++)if(t.getUint16(i+c*12,r)==274)return t.getUint16(i+c*12+8,r)}else{if((a&65280)!==65280)break;i+=t.getUint16(i,!1)}}return-1}var Ie=class{constructor(){this.autoRotateSupported=Mt()}async loadImageFile(t,e){let i=await t.arrayBuffer();return e.checkImageType?await this.checkImageTypeAndLoadImageFromArrayBuffer(i,t.type,e):await this.loadImageFromArrayBuffer(i,e)}checkImageTypeAndLoadImageFromArrayBuffer(t,e,i){return this.isValidImageType(e)?this.loadImageFromArrayBuffer(t,i,e):Promise.reject(new Error("Invalid image type"))}isValidImageType(t){return/image\/(png|jpg|jpeg|heic|bmp|gif|tiff|svg|webp|x-icon|vnd.microsoft.icon|avif)/.test(t)}async loadImageFromURL(t,e){let a=await(await fetch(t)).blob(),r=await a.arrayBuffer();return await this.loadImageFromArrayBuffer(r,e,a.type)}loadBase64Image(t,e){let i=this.base64ToArrayBuffer(t);return this.loadImageFromArrayBuffer(i,e)}base64ToArrayBuffer(t){t=t.replace(/^data:([^;]+);base64,/gmi,"");let e=atob(t),i=e.length,a=new Uint8Array(i);for(let r=0;r<i;r++)a[r]=e.charCodeAt(r);return a.buffer}async loadImageFromArrayBuffer(t,e,i){let a=await new Promise(async(r,p)=>{try{let c=new Blob([t],i?{type:i}:void 0),x=URL.createObjectURL(c),w=new Image,S=i==="image/svg+xml"?await this.get
1SvgImageSize(c):void 0;w.onload=()=>r({originalImage:w,originalImageSize:S,originalObjectUrl:x,originalArrayBuffer:t}),w.onerror=p,w.src=x}catch(c){p(c)}});return await this.transformImageFromArrayBuffer(a,e,a.originalImageSize!=null)}async getSvgImageSize(t){let a=new DOMParser().parseFromString(await t.text(),"image/svg+xml").querySelector("svg");if(!a)throw Error("Failed to parse SVG image");let r=a.getAttribute("width"),p=a.getAttribute("height");if(r&&p)return null;let c=a.getAttribute("viewBox")||a.getAttribute("viewbox");if(c){let x=c.split(" ");return{width:+x[2],height:+x[3]}}throw Error("Failed to load SVG image. SVG must have width + height or viewBox definition.")}async transformImageFromArrayBuffer(t,e,i=!1){let a=await this.autoRotateSupported,r=kt(a?-1:t.originalArrayBuffer);if(!t.originalImage||!t.originalImage.complete)return Promise.reject(new Error("No image loaded"));let p={original:{objectUrl:t.originalObjectUrl,image:t.originalImage,size:t.originalImageSize??{width:t.originalImage.naturalWidth,height:t.originalImage.naturalHeight}},exifTransform:r};return this.transformLoadedImage(p,e,i)}async transformLoadedImage(t,e,i=!1){let a=(e.canvasRotation??0)+t.exifTransform.rotate,r=t.original.size;if(!i&&a===0&&!t.exifTransform.flip&&!e.containWithinAspectRatio)return{original:{objectUrl:t.original.objectUrl,image:t.original.image,size:v({},r)},transformed:{objectUrl:t.original.objectUrl,image:t.original.image,size:v({},r)},exifTransform:t.exifTransform};let p=this.getTransformedSize(r,t.exifTransform,e),c=document.createElement("canvas");c.width=p.width,c.height=p.height;let x=c.getContext("2d");x?.setTransform(t.exifTransform.flip?-1:1,0,0,1,c.width/2,c.height/2),x?.rotate(Math.PI*(a/2)),x?.drawImage(t.original.image,-r.width/2,-r.height/2);let w=await new Promise(y=>c.toBlob(y,"image/"+(e.format??"png")));if(!w)throw new Error("Failed to get Blob for transformed image.");let P=URL.createObjectURL(w),S=await this.loadImageFromObjectUrl(P);return{original:{objectUrl:t.original.objectUrl,image:t.original.image,size:v({},r)},transformed:{objectUrl:P,image:S,size:{width:S.width,height:S.height}},exifTransform:t.exifTransform}}loadImageFromObjectUrl(t){return new Promise((e,i)=>{let a=new Image;a.onload=()=>e(a),a.onerror=i,a.src=t})}getTransformedSize(t,e,i){let a=(i.canvasRotation??0)+e.rotate;if(i.containWithinAspectRatio)if(a%2){let r=t.width*(i.aspectRatio??1),p=t.height/(i.aspectRatio??1);return{width:Math.max(t.height,r),height:Math.max(t.width,p)}}else{let r=t.height*(i.aspectRatio??1),p=t.width/(i.aspectRatio??1);return{width:Math.max(t.width,r),height:Math.max(t.height,p)}}return a%2?{height:t.width,width:t.height}:{width:t.width,height:t.height}}};function St(n){switch(n){case"ArrowUp":return"top";case"ArrowRight":return"right";case"ArrowDown":return"bottom";default:return"left"}}function zt(n){switch(n){case"ArrowUp":return"bottom";case"ArrowRight":return"left";case"ArrowDown":return"top";default:return"right"}}function Rt(n,t){switch(n){case"ArrowUp":return{clientX:0,clientY:t*-1};case"ArrowRight":return{clientX:t,clientY:0};case"ArrowDown":return{clientX:0,clientY:t};default:return{clientX:t*-1,clientY:0}}}var nt=(()=>{class n{get alignImageStyle(){return this.state.options.alignImage}constructor(e){this.sanitizer=e,this.pinchStart$=new Pe,this.cropService=new ke,this.loadImageService=new Ie,this.setImageMaxSizeRetries=0,this.resizedWhileHidden=!1,this.moveTypes=R,this.state=new Me,this.safeImgDataUrl=f(void 0),this.safeTransformStyle=f(void 0),this.marginLeft="0px",this.imageVisible=!1,this.allowMoveImage=!1,this.checkImageType=!0,this.disabled=!1,this.hidden=!1,this.imageCropped=H(),this.startCropImage=H(),this.imageLoaded=H(),this.cropperReady=H(),this.loadImageFailed=H(),this.transformChange=H(),this.cropperChange=H(),this.reset()}ngOnInit(){this.state.stepSize=this.initialStepSize||this.state.stepSize}ngOnChanges(e){let i=this.state.cropper(),a=this.state.transform,r=this.state.options.backgroundColor;if(this.state.setOptionsFromChanges(e),this.onChangesInputImage(e),e.transform&&this.transform&&(this.state.transform=this.transform,this.setCssTransform()),!this.state.loadedImage?.transformed.image.complete||!this.state.maxSize)return;if(this.containWithinAspectRatio&&e.aspectRatio||e.containWithinAspectRatio||e.canvasRotation){this.loadImageService.transformLoadedImage(this.state.loadedImage,this.state.options).then(c=>this.setLoadedImage(c)).catch(c=>this.loadImageError(c));return}e.cropper&&this.cropper&&this.state.cropper.set(ee(this.cropper,this.state,!0));let p=!this.state.equalsCropperPosition(i);p&&(!this.cropper||!this.state.equalsCropperPosition(this.cropper))&&this.cropperChange.emit(this.state.cropper()),(p||!this.state.equalsTransform(a)||this.state.options.backgroundColor!==r)&&this.doAutoCrop(),e.hidden&&this.resizedWhileHidden&&!this.hidden&&setTimeout(()=>{this.onResize(),this.resizedWhileHidden=!1})}onChangesInputImage(e){(e.imageChangedEvent||e.imageURL||e.imageBase64||e.imageFile)&&this.reset(),e.
1imageChangedEvent&&this.isValidImageChangedEvent()&&this.loadImageFile(this.imageChangedEvent.target.files[0]),e.imageURL&&this.imageURL&&this.loadImageFromURL(this.imageURL),e.imageBase64&&this.imageBase64&&this.loadBase64Image(this.imageBase64),e.imageFile&&this.imageFile&&this.loadImageFile(this.imageFile)}isValidImageChangedEvent(){let e=this.imageChangedEvent?.target?.files;return e instanceof FileList&&e.length>0}reset(){this.state.loadedImage=void 0,this.state.maxSize.set({width:0,height:0}),this.imageVisible=!1}loadImageFile(e){this.loadImageService.loadImageFile(e,this.state.options).then(i=>this.setLoadedImage(i)).catch(i=>this.loadImageError(i))}loadBase64Image(e){this.loadImageService.loadBase64Image(e,this.state.options).then(i=>this.setLoadedImage(i)).catch(i=>this.loadImageError(i))}loadImageFromURL(e){this.loadImageService.loadImageFromURL(e,this.state.options).then(i=>this.setLoadedImage(i)).catch(i=>this.loadImageError(i))}setLoadedImage(e){this.state.loadedImage=e,this.safeImgDataUrl.set(this.sanitizer.bypassSecurityTrustResourceUrl(e.transformed.objectUrl))}loadImageError(e){console.error(e),this.loadImageFailed.emit()}setCssTransform(){let e=this.state.transform?.translateUnit||"%";this.safeTransformStyle.set(this.sanitizer.bypassSecurityTrustStyle(`translate(${this.state.transform.translateH||0}${e}, ${this.state.transform.translateV||0}${e}) scaleX(`+(this.state.transform.scale||1)*(this.state.transform.flipH?-1:1)+") scaleY("+(this.state.transform.scale||1)*(this.state.transform.flipV?-1:1)+") rotate("+(this.state.transform.rotate||0)+"deg)"))}imageLoadedInView(){this.state.loadedImage!=null&&(this.imageLoaded.emit(this.state.loadedImage),this.setImageMaxSizeRetries=0,setTimeout(()=>this.checkImageMaxSizeRecursively()))}checkImageMaxSizeRecursively(){this.setImageMaxSizeRetries>40?this.loadImageFailed.emit():this.sourceImageLoaded()?(this.setMaxSize(),this.cropper&&(!this.maintainAspectRatio||this.state.aspectRatioIsCorrect())?(this.state.cropper.set(ee(this.cropper,this.state,!0)),this.emitCropperPositionChange(this.cropper)):(this.state.cropper.set(ee(this.state.maxSizeCropperPosition(),this.state,!0)),this.cropperChange.emit(this.state.cropper())),this.imageVisible=!0,this.cropperReady.emit(this.state.maxSize()),this.doAutoCrop()):(this.setImageMaxSizeRetries++,setTimeout(()=>this.checkImageMaxSizeRecursively(),50))}sourceImageLoaded(){return this.sourceImage?.nativeElement?.offsetWidth>1}onResize(){if(this.state.loadedImage)if(this.hidden)this.resizedWhileHidden=!0;else{let e=this.state.maxSize();this.setMaxSize(),this.state.resizeCropperPosition(e)}}keyboardAccess(e){this.changeKeyboardStepSize(e),this.keyboardMoveCropper(e)}changeKeyboardStepSize(e){let i=+e.key;i>=1&&i<=9&&(this.state.stepSize=i)}keyboardMoveCropper(e){if(!["ArrowUp","ArrowDown","ArrowRight","ArrowLeft"].includes(e.key))return;let a=e.shiftKey?R.Resize:R.Move,r=e.altKey?zt(e.key):St(e.key),p=Rt(e.key,this.state.stepSize);e.preventDefault(),e.stopPropagation(),this.moveStart={type:a,position:r,clientX:0,clientY:0,transform:this.state.transform,cropper:this.state.cropper()},this.handleMouseMove(p),this.handleMouseUp()}startMove(e,i,a=null){this.disabled||this.moveStart&&this.moveStart.type===R.Pinch||i===R.Drag&&!this.allowMoveImage||("preventDefault"in e&&e.preventDefault(),this.moveStart={type:i,position:a,clientX:ge(e),clientY:ue(e),transform:this.state.transform,cropper:this.state.cropper()},this.initMouseMove())}initMouseMove(){_e(W(document,"mousemove"),W(document,"touchmove")).pipe(we(_e(W(document,"mouseup"),W(document,"touchend"),this.pinchStart$).pipe(Oe()))).subscribe({next:e=>this.handleMouseMove(e),complete:()=>this.handleMouseUp()})}handleMouseMove(e){if(this.moveStart){if("stopPropagation"in e&&e.stopPropagation(),"preventDefault"in e&&e.preventDefault(),this.moveStart.type===R.Move)this.state.cropper.set(he(_t(e,this.moveStart),this.state,!0));else if(this.moveStart.type===R.Resize)!this.cropperStaticWidth&&!this.cropperStaticHeight&&this.state.cropper.set(he(at(e,this.moveStart,this.state),this.state,!1));else if(this.moveStart.type===R.Drag){let i=ge(e)-this.moveStart.clientX,a=ue(e)-this.moveStart.clientY;this.state.transform=L(v({},this.state.transform),{translateH:(this.moveStart.transform?.translateH||0)+i,translateV:(this.moveStart.transform?.translateV||0)+a}),this.setCssTransform()}}}handleMouseUp(){!this.moveStart||this.moveStart.type===R.Pinch||((!this.state.equalsCropperPosition(this.moveStart.cropper)||this.moveStart.transform&&!this.state.equalsTransform(this.moveStart.transform))&&(this.moveStart.type===R.Drag?this.transformChange.emit(this.state.transform):this.cropperChange.emit(this.state.cropper()),this.doAutoCrop()),this.moveStart=void 0)}startPinch(e){if(this.disabled||!this.sourceImageLoaded()||e.touches.length<2)return;"preventDefault"in e&&e.preventDefault();let i=this.state.cropper();this.moveStart={type:R.Pinch,position:"center",clientX:i.x1+(i.x2-i.x1)/2,clientY:i.y1+(i.y2-i.y1)/2,cropper:i},this.initPinch()}initPinch(){this.pinchStart$.next(),W(document,"touchmove").pipe(we(W(document,"touchend"))).subscribe({next:e=>
1this.handlePinchMove(e),complete:()=>this.handlePinchStop()})}handlePinchMove(e){this.moveStart&&(e.preventDefault&&e.preventDefault(),this.moveStart.type===R.Pinch&&!this.cropperStaticWidth&&!this.cropperStaticHeight&&this.state.cropper.set(he(at(e,this.moveStart,this.state),this.state,!1)))}handlePinchStop(){this.moveStart&&(this.state.equalsCropperPosition(this.moveStart.cropper)||(this.emitCropperPositionChange(this.moveStart.cropper),this.doAutoCrop()),this.moveStart=void 0)}setMaxSize(){if(this.sourceImage){let e=getComputedStyle(this.sourceImage.nativeElement);this.state.setMaxSize(parseFloat(e.width),parseFloat(e.height)),this.marginLeft=this.sanitizer.bypassSecurityTrustStyle("calc(50% - "+this.state.maxSize().width/2+"px)")}}emitCropperPositionChange(e){this.state.equalsCropperPosition(e)||this.cropperChange.emit(this.state.cropper())}doAutoCrop(){this.state.options.autoCrop&&this.crop()}crop(e=this.state.options.output){if(this.state.loadedImage?.transformed?.image!=null){if(this.startCropImage.emit(),e==="blob")return this.cropToBlob();if(e==="base64")return this.cropToBase64()}return null}cropToBlob(){return new Promise(async(e,i)=>{let a=await this.cropService.crop(this.state.toCropInput(),"blob");a?(this.imageCropped.emit(a),e(a)):i("Crop image failed")})}cropToBase64(){let e=this.cropService.crop(this.state.toCropInput(),"base64");return e?(this.imageCropped.emit(e),e):null}resetCropperPosition(){this.state.cropper.set(ee(this.state.maxSizeCropperPosition(),this.state,!0)),this.cropperChange.emit(this.state.cropper())}ngOnDestroy(){this.pinchStart$.complete()}static{this.\u0275fac=function(i){return new(i||n)(He(le))}}static{this.\u0275cmp=N({type:n,selectors:[["image-cropper"]],viewQuery:function(i,a){if(i&1&&oe(ht,7)(gt,5),i&2){let r;G(r=J())&&(a.wrapper=r.first),G(r=J())&&(a.sourceImage=r.first)}},hostVars:6,hostBindings:function(i,a){i&1&&u("resize",function(){return a.onResize()},Fe),i&2&&(z("text-align",a.alignImageStyle),Y("disabled",a.disabled)("ngx-ic-hidden",a.hidden))},inputs:{imageChangedEvent:"imageChangedEvent",imageURL:"imageURL",imageBase64:"imageBase64",imageFile:"imageFile",imageAltText:"imageAltText",options:"options",cropperFrameAriaLabel:"cropperFrameAriaLabel",output:"output",format:"format",autoCrop:"autoCrop",cropper:"cropper",transform:"transform",maintainAspectRatio:"maintainAspectRatio",aspectRatio:"aspectRatio",resetCropOnAspectRatioChange:"resetCropOnAspectRatioChange",resizeToWidth:"resizeToWidth",resizeToHeight:"resizeToHeight",cropperMinWidth:"cropperMinWidth",cropperMinHeight:"cropperMinHeight",cropperMaxHeight:"cropperMaxHeight",cropperMaxWidth:"cropperMaxWidth",cropperStaticWidth:"cropperStaticWidth",cropperStaticHeight:"cropperStaticHeight",canvasRotation:"canvasRotation",initialStepSize:"initialStepSize",roundCropper:"roundCropper",onlyScaleDown:"onlyScaleDown",imageQuality:"imageQuality",backgroundColor:"backgroundColor",containWithinAspectRatio:"containWithinAspectRatio",hideResizeSquares:"hideResizeSquares",allowMoveImage:"allowMoveImage",checkImageType:"checkImageType",alignImage:"alignImage",disabled:"disabled",hidden:"hidden"},outputs:{imageCropped:"imageCropped",startCropImage:"startCropImage",imageLoaded:"imageLoaded",cropperReady:"cropperReady",loadImageFailed:"loadImageFailed",transformChange:"transformChange",cropperChange:"cropperChange"},features:[Ue],decls:4,vars:10,consts:[["sourceImage",""],[3,"touchstart"],["class","ngx-ic-source-image","role","presentation",3,"src","visibility","transform","ngx-ic-draggable","load","mousedown","touchstart","error",4,"ngIf"],[1,"ngx-ic-overlay"],["class","ngx-ic-cropper","tabindex","0",3,"ngx-ic-round","top","left","width","height","margin-left","visibility","keydown",4,"ngIf"],["role","presentation",1,"ngx-ic-source-image",3,"load","mousedown","touchstart","error","src"],["tabindex","0",1,"ngx-ic-cropper",3,"keydown"],["role","presentation",1,"ngx-ic-move",3,"mousedown","touchstart"],[4,"ngIf"],["role","presentation",1,"ngx-ic-resize","ngx-ic-topleft",3,"mousedown","touchstart"],[1,"ngx-ic-square"],["role","presentation",1,"ngx-ic-resize","ngx-ic-topright",3,"mousedown","touchstart"],["role","presentation",1,"ngx-ic-resize","ngx-ic-bottomright",3,"mousedown","touchstart"],["role","presentation",1,"ngx-ic-resize","ngx-ic-bottomleft",3,"mousedown","touchstart"],["role","presentation",1,"ngx-ic-resize-bar","ngx-ic-top",3,"mousedown","touchstart"],[1,"ngx-ic-resize","ngx-ic-top",3,"mousedown","touchstart"],["role","presentation",1,"ngx-ic-resize-bar","ngx-ic-right",3,"mousedown","touchstart"],[1,"ngx-ic-resize","ngx-ic-right",3,"mousedown","touchstart"],["role","presentation",1,"ngx-ic-resize-bar","ngx-ic-bottom",3,"mousedown","touchstart"],[1,"ngx-ic-resize","ngx-ic-bottom",3,"mousedown","touchstart"],["role","presentation",1,"ngx-ic-resize-bar","ngx-ic-left",3,"mousedown","touchstart"],[1,"ngx-ic-resize","ngx-ic-left",3,"mousedown","touchstart"]],template:function(i,a){i&1&&(o(0,"div",1),u("touchstart",function(p){return a.startPinch(p)}),ne(1,ut,2,8,"img",2),_(2,"div",3),ne(3,ft,3,16,"div",4),s()),i&2&&(z("background",a.imageVisible&&a.state.options.backgroundColor),d(),b("ngIf",a.safeImgDataUrl()),d(),z("width",a.state.maxSize().width||0,"px")("height",a.state.maxSize().height||0,"px")("margin-left",a.state.options.alignImage==="center"?a.marginLeft:null),d(),b("ngIf",a.imageVisible))},dependencies:[qe],styles:['[_nghost-%COMP%]{display:flex;position:relative;width:100%;max-width:100%;max-height:100%;overflow:hidden;padding:5px;text-align:center}[_nghost-%COMP%] > div[_ngcontent-%COMP%]{width:100%;position:relative}[_nghost-%COMP%] > div[_ngcontent-%COMP%] img.ngx-ic-source-image[_ngcontent-%COMP%]{display:inline;max-width:100%;max-height:100%;transform-origin:center}[_nghost-%COMP%] > div[_ngcontent-%COMP%] img.ngx-ic-source-image.ngx-ic-draggable[_ngcontent-%COMP%]{user-drag:none;-webkit-user-drag:none;user-select:none;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;cursor:grab}[_nghost-%COMP%] .ngx-ic-overlay[_ngcontent-%COMP%]{position:absolute;pointer-events:none;touch-action:none;
1outline:var(--cropper-overlay-color, white) solid 100vw;top:0;left:0}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%]{position:absolute;display:flex;color:var(--cropper-color, #53535C);background:transparent;outline:var(--cropper-outline-color, rgba(255, 255, 255, .3)) solid 100vw;touch-action:none}@media (orientation: portrait){[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%]{outline-width:100vh}}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%]:after{position:absolute;content:"";inset:0;pointer-events:none;border:dashed 1px;opacity:.75;color:inherit;z-index:1}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-move[_ngcontent-%COMP%]{width:100%;cursor:move;border:var(--cropper-border, 1px solid rgba(255, 255, 255, .5))}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%]:hover .ngx-ic-move[_ngcontent-%COMP%]{border:var(--cropper-hover-border, var(--cropper-border, 1px solid rgba(255, 255, 255, .5)))}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%]:focus .ngx-ic-move[_ngcontent-%COMP%]{border:var(--cropper-focus-border, 2px solid dodgerblue)}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%]:focus .ngx-ic-resize[_ngcontent-%COMP%] .ngx-ic-square[_ngcontent-%COMP%]{background:var(--cropper-resize-square-focus-bg, var(--cropper-resize-square-bg, #53535C));border:var(--cropper-resize-square-focus-border, var(--cropper-resize-square-border, 1px solid rgba(255, 255, 255, .5)))}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-resize[_ngcontent-%COMP%]{position:absolute;display:inline-block;line-height:6px;padding:8px;opacity:.85;z-index:1}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-resize[_ngcontent-%COMP%] .ngx-ic-square[_ngcontent-%COMP%]{display:inline-block;width:6px;height:6px;box-sizing:content-box;background:var(--cropper-resize-square-bg, #53535C);border:var(--cropper-resize-square-border, 1px solid rgba(255, 255, 255, .5))}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-resize[_ngcontent-%COMP%]:hover .ngx-ic-square[_ngcontent-%COMP%]{background:var(--cropper-resize-square-hover-bg, var(--cropper-resize-square-bg, #53535C));border:var(--cropper-resize-square-hover-border, var(--cropper-resize-square-border, 1px solid rgba(255, 255, 255, .5)))}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-resize.ngx-ic-topleft[_ngcontent-%COMP%]{top:-12px;left:-12px;cursor:nwse-resize}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-resize.ngx-ic-top[_ngcontent-%COMP%]{top:-12px;left:calc(50% - 12px);cursor:ns-resize}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-resize.ngx-ic-topright[_ngcontent-%COMP%]{top:-12px;right:-12px;cursor:nesw-resize}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-resize.ngx-ic-right[_ngcontent-%COMP%]{top:calc(50% - 12px);right:-12px;cursor:ew-resize}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-resize.ngx-ic-bottomright[_ngcontent-%COMP%]{bottom:-12px;right:-12px;cursor:nwse-resize}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-resize.ngx-ic-bottom[_ngcontent-%COMP%]{bottom:-12px;left:calc(50% - 12px);cursor:ns-resize}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-resize.ngx-ic-bottomleft[_ngcontent-%COMP%]{bottom:-12px;left:-12px;cursor:nesw-resize}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-resize.ngx-ic-left[_ngcontent-%COMP%]{top:calc(50% - 12px);left:-12px;cursor:ew-resize}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-resize-bar[_ngcontent-%COMP%]{position:absolute;z-index:1}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-resize-bar.ngx-ic-top[_ngcontent-%COMP%]{top:-11px;left:11px;width:calc(100% - 22px);height:22px;cursor:ns-resize}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-resize-bar.ngx-ic-right[_ngcontent-%COMP%]{top:11px;right:-11px;height:calc(100% - 22px);width:22px;cursor:ew-resize}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-resize-bar.ngx-ic-bottom[_ngcontent-%COMP%]{bottom:-11px;left:11px;width:calc(100% - 22px);height:22px;
1cursor:ns-resize}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-resize-bar.ngx-ic-left[_ngcontent-%COMP%]{top:11px;left:-11px;height:calc(100% - 22px);width:22px;cursor:ew-resize}[_nghost-%COMP%] .ngx-ic-cropper.ngx-ic-round[_ngcontent-%COMP%]{outline-color:transparent}[_nghost-%COMP%] .ngx-ic-cropper.ngx-ic-round[_ngcontent-%COMP%]:after{border-radius:100%;box-shadow:0 0 0 100vw var(--cropper-outline-color, rgba(255, 255, 255, .3))}@media (orientation: portrait){[_nghost-%COMP%] .ngx-ic-cropper.ngx-ic-round[_ngcontent-%COMP%]:after{box-shadow:0 0 0 100vh var(--cropper-outline-color, rgba(255, 255, 255, .3))}}[_nghost-%COMP%] .ngx-ic-cropper.ngx-ic-round[_ngcontent-%COMP%] .ngx-ic-move[_ngcontent-%COMP%]{border-radius:100%}.disabled[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-resize[_ngcontent-%COMP%], .disabled[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-resize-bar[_ngcontent-%COMP%], .disabled[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-move[_ngcontent-%COMP%]{display:none}.ngx-ic-hidden[_nghost-%COMP%]{display:none}'],changeDetection:0})}}return n})();var Tt=(n,t)=>({flipH:n,flipV:t}),Dt=n=>({label:"Luminozitate",sig:n,icon:"light_mode"}),Vt=n=>({label:"Contrast",sig:n,icon:"contrast"}),Pt=n=>({label:"Satura\u021Bie",sig:n,icon:"palette"}),Ot=(n,t,e)=>[n,t,e],At=(n,t)=>t.key,ot=(n,t)=>t.label;function Ut(n,t){n&1&&(o(0,"div",11)(1,"span",30),l(2,"progress_activity"),s(),o(3,"p",31),l(4,"Se \xEEncarc\u0103..."),s()())}function Ft(n,t){if(n&1&&_(0,"img",32),n&2){let e=m();z("opacity",e.watermarkOpacity())("width",e.watermarkSizePx(),"px")("height","auto")("left",e.watermarkPosX(),"px")("top",e.watermarkPosY(),"px"),b("src",e.watermarkUrl,U)}}function Ht(n,t){if(n&1){let e=M();o(0,"button",33),u("click",function(){let a=h(e).$implicit,r=m();return g(r.setTool(a.key))}),o(1,"span",34)(2,"span",26),l(3),s(),l(4),s()()}if(n&2){let e=t.$implicit,i=m();b("ngClass",i.activeTool()===e.key?"border-slate-900 dark:border-white text-slate-900 dark:text-white":"border-transparent text-slate-400 hover:text-slate-600 dark:hover:text-slate-300"),d(3),V(e.icon),d(),k(" ",e.label," ")}}function Lt(n,t){if(n&1){let e=M();o(0,"button",42),u("click",function(){let a=h(e).$implicit,r=m(2);return g(r.setAspect(a.value))}),l(1),s()}if(n&2){let e=t.$implicit,i=m(2);b("ngClass",i.isAspectActive(e.value)?"border-slate-900 dark:border-white bg-slate-900 dark:bg-white text-white dark:text-slate-900":"border-slate-200 dark:border-slate-700 text-slate-600 dark:text-slate-400 hover:border-slate-400"),d(),k(" ",e.label," ")}}function Wt(n,t){if(n&1){let e=M();o(0,"div",22)(1,"div")(2,"p",35),l(3,"Propor\u021Bii"),s(),o(4,"div",36),$(5,Lt,2,2,"button",37,ot),s()(),o(7,"div")(8,"p",35),l(9,"Transformare"),s(),o(10,"div",38)(11,"button",39),u("click",function(){h(e);let a=m();return g(a.rotate(-90))}),o(12,"span",26),l(13,"rotate_left"),s(),l(14," -90\xB0 "),s(),o(15,"button",39),u("click",function(){h(e);let a=m();return g(a.rotate(90))}),o(16,"span",26),l(17,"rotate_right"),s(),l(18," +90\xB0 "),s(),o(19,"button",40),u("click",function(){h(e);let a=m();return g(a.flip("h"))}),o(20,"span",26),l(21,"flip"),s(),l(22," Flip H "),s(),o(23,"button",40),u("click",function(){h(e);let a=m();return g(a.flip("v"))}),o(24,"span",41),l(25,"flip"),s(),l(26," Flip V "),s()()()()}if(n&2){let e=m();d(5),X(e.aspectRatios),d(14),b("ngClass",e.flipH()?"border-blue-600 text-blue-600 bg-blue-50 dark:bg-blue-950/30":"border-slate-200 dark:border-slate-700 text-slate-600 dark:text-slate-400 hover:border-slate-400"),d(4),b("ngClass",e.flipV()?"border-blue-600 text-blue-600 bg-blue-50 dark:bg-blue-950/30":"border-slate-200 dark:border-slate-700 text-slate-600 dark:text-slate-400 hover:border-slate-400")}}function Bt(n,t){if(n&1){let e=M();o(0,"div")(1,"div",43)(2,"label",44)(3,"span",26),l(4),s(),l(5),s(),o(6,"span",45),l(7),s()(),o(8,"input",46),u("input",function(a){let r=h(e).$implicit;return g(r.sig.set(+a.target.value))}),s(),o(9,"div",47)(10,"span"),l(11,"-100"),s(),o(12,"span"),l(13,"0"),s(),o(14,"span"),l(15,"+100"),s()()()}if(n&2){let e=t.$implicit;d(4),V(e.icon),d(),k(" ",e.label," "),d(2),Z(" ",e.sig()>0?"+":"","",e.sig()," "),d(),b("value",e.sig())}}function jt(n,t){if(n&1&&(o(0,"div",23),$(1,Bt,16,5,"div",null,ot),s()),n&2){let e=m();d(),X(Ne(6,Ot,se(0,Dt,e.brightness),se(2,Vt,e.contrast),se(4,Pt,e.saturation)))}}function Nt(n,t){if(n&1){let e=M();o(0,"div",52)(1,"div",53)(2,"div",54)(3,"div",55)(4,"span",56),l(5,"image"),s()(),_(6,"div",57),s(),o(7,"p",58),l(8,"Preview pozi\u021Bie"),s()(),o(9,"div",59)(10,"div",60)(11,"div",61)(12,"label",62),l(13,"M\u0103rime"),s(),o(14,"span",63),l(15),s()(),o(16,"input",64),u("input",function(a){h(e);let r=m(2);return g(r.watermarkSizePx.set(+a.target.value))}),s()(),o(17,"div",60)(18,"div",61)(19,"label",65),l(20," Pozi\u021Bie X "),s(),o(21,"span",63),l(22),s()(),o(23,"input",66),u("input",function(a){h(e);let r=m(2);return g(r.watermarkPosX.set(+a.target.value))}),s()(),o(24,"div",60)(25,"div",61)(26,"label",65),l(27," Pozi\u021Bie Y "),s(),o(28,"span",63),l(29),s()(),o(30,"input",67),u("input",function(a){h(e);let r=m(2);return g(r.watermarkPosY.set(+a.target.value))}),s()(),o(31,"div")(32,"div",61)(33,"label",62),l(34,"Opacitate"),s(),o(35,"span",63),l(36),s()(),o(37,"input",68),u("input",function(a){h(e);let r=m(2);return g(r.watermarkOpacity.set(+a.target.value/100))}),s()()(),o(38,"button",69),u("click",function(){h(e);let a=m(2);return g(a.resetWatermarkPosition())}),l(39," Reseteaz\u0103 pozi\u021Bia (st\xE2nga sus) "),s()()}if(n&2){let e=m(2);d(6),z("left",e.watermarkPosX()/800*100,"%")("top",e.watermarkPosY()/600*100,"%"),d(9),k("",e.watermarkSizePx(),"px"),d(),b("value",e.watermarkSizePx()),d(6),k("",e.watermarkPosX(),"px"),d(),b("value",e.watermarkPosX()),d(6),k("",e.watermarkPosY(),"px"),d(),b("value",e.watermarkPosY()),d(6),k("",(e.watermarkOpacity()*100).toFixed(0),"%"),d(),b("value",e.watermarkOpacity()*100)}}function $t(n,t){if(n&1){let e=M();o(0,"div",22)(1,"div",48)(2,"span",49),l(3,"Activeaz\u0103 Logo"),s(),o(4,"button",50),u("click",function(){h(e);let a=m();return g(a.watermarkEnabled.set(!a.watermarkEnabled()))}),_(5,"span",51),s()(),T(6,Nt,40,12,"div",52),s()}if(n&2){let e=m();d(4),b("ngClass",e.watermarkEnabled()?"border-slate-900 dark:border-white bg-slate-900 dark:bg-white":"border-slate-300 dark:border-slate-600 bg-slate-100 dar
1k:bg-slate-800"),d(),b("ngClass",e.watermarkEnabled()?"translate-x-0.5 bg-white dark:bg-slate-900 border-slate-900 dark:border-white":"-translate-x-6 bg-white dark:bg-slate-600 border-slate-300 dark:border-slate-600"),d(),D(e.watermarkEnabled()?6:-1)}}var xe=class n{dialogRef=I(ce);data=I(me);mediaService=I(Q);notify=I(de);sanitizer=I(le);activeTool=f("crop");isSaving=f(!1);imageLoaded=f(!1);brightness=f(0);contrast=f(0);saturation=f(0);canvasRotation=f(0);flipH=f(!1);flipV=f(!1);aspectRatio=f(NaN);watermarkEnabled=f(!1);watermarkPosition=f("bottom-right");watermarkOpacity=f(.7);watermarkScale=f(.25);watermarkSizePx=f(120);watermarkPosX=f(20);watermarkPosY=f(20);watermarkUrl=F.WATERMARK_URL||"";resetWatermarkPosition(){this.watermarkPosX.set(20),this.watermarkPosY.set(20)}updateWatermarkSize(t){this.watermarkSizePx.set(t),this.watermarkScale.set((t-50)/150)}rawCroppedBlob=null;tabs=[{key:"crop",icon:"crop",label:"CROP"},{key:"adjust",icon:"tune",label:"AJUST\u0102RI"},{key:"watermark",icon:"branding_watermark",label:"LOGO"}];watermarkPositions=[{label:"ST\xC2NGA SUS",value:"top-left"},{label:"DREAPTA SUS",value:"top-right"},{label:"ST\xC2NGA JOS",value:"bottom-left"},{label:"DREAPTA JOS",value:"bottom-right"}];aspectRatios=[{label:"LIBER",value:NaN},{label:"1:1",value:1},{label:"4:3",value:4/3},{label:"16:9",value:16/9},{label:"3:2",value:3/2},{label:"9:16",value:9/16}];imageUrl=q(()=>{let t=F.API_URL.replace(/\/api\/$/,""),e=this.data.media.variants?.original||this.data.media.url;return`${t}${e.replace(/^\//,"")}`});cssFilter=q(()=>`brightness(${100+this.brightness()}%) contrast(${100+this.contrast()}%) saturate(${100+this.saturation()}%)`);onImageLoaded(t){this.imageLoaded.set(!0)}onCropped(t){this.rawCroppedBlob=t.blob??null}setTool(t){this.activeTool.set(t)}setAspect(t){this.aspectRatio.set(t)}setWatermarkPosition(t){this.watermarkPosition.set(t)}rotate(t){this.canvasRotation.update(e=>e+t/90)}flip(t){t==="h"?this.flipH.update(e=>!e):this.flipV.update(e=>!e)}isAspectActive(t){let e=this.aspectRatio();return isNaN(t)&&isNaN(e)?!0:e===t}reset(){this.brightness.set(0),this.contrast.set(0),this.saturation.set(0),this.canvasRotation.set(0),this.flipH.set(!1),this.flipV.set(!1),this.aspectRatio.set(NaN),this.watermarkEnabled.set(!1),this.watermarkOpacity.set(.7),this.watermarkSizePx.set(100),this.watermarkPosX.set(20),this.watermarkPosY.set(20),this.notify.success("Reset complet")}async applyFilters(t){return this.brightness()===0&&this.contrast()===0&&this.saturation()===0?t:new Promise((e,i)=>{let a=new Image;a.onload=()=>{let r=document.createElement("canvas");r.width=a.width,r.height=a.height;let p=r.getContext("2d");if(!p){i(new Error("Could not get canvas context"));return}let c=[];
1this.brightness()!==0&&c.push(`brightness(${100+this.brightness()}%)`),this.contrast()!==0&&c.push(`contrast(${100+this.contrast()}%)`),this.saturation()!==0&&c.push(`saturate(${100+this.saturation()}%)`),p.filter=c.join(" ")||"none",p.drawImage(a,0,0,r.width,r.height),r.toBlob(x=>{x?e(x):i(new Error("Canvas toBlob failed"))},"image/jpeg",.92)},a.onerror=()=>i(new Error("Failed to load image for filtering")),a.src=URL.createObjectURL(t)})}async save(){if(!this.rawCroppedBlob)return this.notify.error("Selecteaz\u0103 o zon\u0103 de crop mai \xEEnt\xE2i.");this.isSaving.set(!0);try{let t=this.rawCroppedBlob;if(t=await this.applyFilters(t),this.watermarkEnabled())try{t=await this.applyWatermark(t)}catch(r){console.error("Eroare watermark:",r),this.notify.error("Eroare la aplicarea watermark-ului. Se salveaz\u0103 f\u0103r\u0103 logo.")}let e=this.data.media.name.split("."),i=e.length>1?e.pop():"jpg",a=new File([t],`${e.join(".")}_edited.${i}`,{type:"image/jpeg"});this.mediaService.uploadFiles([a]).subscribe({next:r=>{this.isSaving.set(!1),this.notify.success("Imagine editat\u0103 cu succes!"),this.dialogRef.close(r[0])},error:()=>{this.isSaving.set(!1),this.notify.error("Eroare la upload.")}})}catch(t){this.isSaving.set(!1),this.notify.error("Eroare la procesare."),console.error(t)}}onLoadFailed(t){console.error("Eroare \xEEnc\u0103rcare imagine:",t),this.notify.error("Eroare la \xEEnc\u0103rcarea imaginii. \xCEncearc\u0103 din nou.")}async applyWatermark(t){if(!t||t.size===0)throw new Error("Invalid blob for watermark");return new Promise((e,i)=>{let a=new Image,r=URL.createObjectURL(t);a.onload=()=>{let p=document.createElement("canvas");p.width=a.width,p.height=a.height;let c=p.getContext("2d");if(!c){URL.revokeObjectURL(r),i(new Error("Could not get canvas context"));return}if(c.drawImage(a,0,0),URL.revokeObjectURL(r),!F.WATERMARK_URL){e(t);return}let x=new Image;x.crossOrigin="anonymous",x.onload=()=>{let w=a.width/800,P=a.height/600,S=this.watermarkSizePx()*w,y=x.height/x.width*S,C=this.watermarkPosX()*w,E=this.watermarkPosY()*P;c.save(),c.globalAlpha=this.watermarkOpacity(),c.drawImage(x,C,E,S,y),c.restore(),p.toBlob(O=>{O?e(O):i(new Error("Canvas toBlob failed"))},"image/jpeg",.92)},x.onerror=()=>e(t),x.src=F.WATERMARK_URL},a.onerror=()=>{URL.revokeObjectURL(r),i(new Error("Failed to load image"))},a.src=r})}isNaN=isNaN;cancel(){this.dialogRef.close()}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=N({type:n,selectors:[["app-image-editor-dialog"]],decls:42,vars:24,consts:[["cropper",""],[1,"bg-white","dark:bg-[#050505]","border-t-4","border-slate-900","dark:border-white","shadow-2xl","flex","flex-col","w-full","max-w-6xl","h-[90vh]","font-sans","relative","mx-auto","overflow-hidden"],[1,"flex","items-center","justify-between","px-6","py-4","border-b","border-slate-200","dark:border-slate-800","bg-white","dark:bg-[#0a0a0a]","shrink-0"],[1,"min-w-0","flex-1"],[1,"text-[10px]","font-bold","uppercase","tracking-[0.2em]","text-slate-900","dark:text-white","mb-1","flex","items-center","gap-2"],[1,"w-1.5","h-1.5","bg-blue-600","rounded-full"],[1,"font-serif","text-lg","font-bold","text-slate-900","dark:text-white","leading-tight","truncate"],[1,"w-8","h-8","flex","items-center","justify-center","border","border-slate-300","dark:border-slate-700","text-slate-500","hover:text-slate-900","dark:hover:text-white","hover:border-slate-900","dark:hover:border-white","transition-colors",3,"click"],[1,"material-symbols-outlined","text-[18px]"],[1,"flex","flex-1","overflow-hidden","min-h-0","bg-slate-50","dark:bg-[#050505]"],[1,"flex-1","relative","flex","items-start","justify-start","overflow-hidden","p-6","border-r","border-slate-200","dark:border-slate-800"],[1,"flex","flex-col","items-center","gap-3","text-slate-500","absolute","inset-0","justify-center"],[1,"relative","border","border-slate-300","dark:border-slate-700","bg-white","dark:bg-slate-900","overflow-hidden",2,"width","800px","height","600px","max-width","100%","max-height","100%"],[1,"absolute","inset-0","opacity-10","pointer-events-none",2,"background-image","linear-gradient(#000 1px, transparent 1px), linear-gradient(90deg, #000 1px, transparent 1px)","background-size","20px 20px"],[1,"relative","w-full","h-full"],["format","jpeg",1,"w-full","h-full","block","relative","z-10",3,"imageCropped","imageLoaded","loadImageFailed","imageURL","maintainAspectRatio","aspectRatio","canvasRotation","transform","alignImage"],["alt","watermark",1,"absolute","pointer-events-none","z-20","transition-all","duration-200",3,"src","opacity","width","height","left","top"],[1,"absolute","bottom-0","right-0","px-3","py-1.5","bg-slate-900","dark:bg-white","text-white","dark:text-slate-900","text-[10px]","font-mono","font-bold","uppercase","tracking-widest","pointer-events-none","z-30"],[1,"w-80","shrink-0","bg-white","dark:bg-[#050505]","flex","flex-col","overflow-hidden"],[1,"flex","border-b","border-slate-200","dark:border-slate-800"],[1,"flex-1","py-4","text-[10px]","font-bold","uppercase","tracking-widest","transition-colors","border-b-2","focus:outline-none",3,"ngClass"],[1,"flex-1","p-6","space-y-6","overflow-y-auto"],[1,"space-y-5"],[1,"space-y-6"],[1,"p-6","border-t","border-slate-200","dark:border-slate-800","bg-slate-50","dark:bg-slate-900/30"],[1,"w-full","flex","items-center","justify-center","gap-2","py-3","border","border-slate-300","dark:border-slate-600","text-[10px]","font-bold","uppercase","tracking-widest","text-slate-600","dark:text-slate-400","hover:border-slate-900","dark:hover:border-white","hover:text-slate-900","dark:hover:text-white","transition-colors",3,"click"],[1,"material-symbols-outlined","text-[16px]"],[1,"px-6","py-4","border-t","border-slate-200","dark:border-slate-800","bg-white","dark:bg-[#0a0a0a]","shrink-0","flex","items-center","justify-end","gap-3"],[1,"px-5","py-2.5","text-[10px]","font-bold","uppercase","tracking-widest","text-slate-500","hover:text-slate-900","dark:hover:text-white","transition-colors","border","border-transparent","hover:border-slate-200","dark:hover:border-slate-700",3,"click"],[1,"flex","items-center","gap-2","bg-slate-900","dark:bg-white","text-white","dark:text-slate-900","px-6","py-2.5","text-[10px]","font-bold","uppercase","tracking-widest","hover:bg-blue-600","dark:hover:bg-blue-600","dark:hover:text-white","transition-colors","disabled:opacity-50","disabled:cursor-not-allowed","border","border-slate-900","dark:border-white",3,"click","disabled"],[1,"material-symbols-outlined","animate-spin","text-3xl"],[1,"text-[10px]","font-bold","uppercase","tracking-widest"],["alt","watermark",1,"absolute","pointer-events-none","z-20","transition-all","duration-200",3,"src"],[1,"flex-1","py-4","text-[10px]","font-bold","uppercase","tracking-widest","transition-colors","border-b-2","focus:outline-none",3,"click","ngClass"],[1,"flex","items-center","justify-center","gap-1.5"],[1,"text-[9px]","font-bold","uppercase","tracking-[0.15em]","text-slate-400","mb-3","border-b","border-slate-100","dark:border-slate-800","pb-1"],[1,"grid","grid-cols-3","gap-2"],[1,"py-2.5","text-[9px]","font-bold","uppercase","tracking-wider","border","transition-colors","focus:outline-none",3,"ngClass"],[1,"grid","grid-cols-2","gap-3"],[1,"flex","items-center","justify-center","gap-2","py-3","border","border-slate-200","dark:border-slate-700","text-slate-600","dark:text-slate-400","hover:border-slate-900","dark:hover:border-white","hover:text-slate-900","dark:hover:text-white","transition-colors","text-[10px]","font-bold","uppercase","tracking-wider",3,"click"],[1,"flex","items-center","justify-center","gap-2","py-3","border","transition-colors","text-[10px]","font-bold","uppercase","tracking-wider",3,"click","ngClass"],[1,"material-symbols-outlined","text-[16px]",2,"transform","rotate(90deg)"],[1,"py-2.5","text-[9px]","font-bold","uppercase","tracking-wider","border","transition-colors","focus:outline-none",3,"click","ngClass"],[1,"flex","items-center","justify-between","mb-3","pb-1","border-b","border-slate-100","dark:border-slate-800"],[1,"flex","items-center","gap-2","text-[9px]","font-bold","uppercase","tracking-[0.15em]","text-slate-500"],[1,"text-[11px]","font-mono","font-bold","text-slate-900","dark:text-white","tabular-nums"],["type","range","min","-100","max","100","step","1",1,"w-full","h-1","bg-slate-200","dark:bg-slate-700","rounded-none","appearance-none","cursor-pointer","accent-slate-900","dark:accent-white",3,"input","value"],[1,"flex","justify-between","text-[9px]","font-mono","text-slate-400","mt-1.5","uppercase"],[1,"flex","items-center","justify-between","py-3","border-b","border-slate-200","dark:border-slate-800"],[1,"text-[10px]","font-bold","uppercase","tracking-widest","text-slate-900","dark:text-white"],[1,"relative","w-12","h-6.5","border","transition-colors","focus:outline-none","cursor-pointer",3,"click","ngClass"],[1,"absolute","top-0.5","w-5","h-5","transition-all","duration-200","border",3,"ngClass"],[1,"space-y-5","animate-fade-in"],[1,"border","border-slate-200","dark:border-slate-700","p-1"],[1,"relative","w-full","as
1pect-video","bg-slate-100","dark:bg-slate-800","border","border-slate-300","dark:border-slate-600","overflow-hidden"],[1,"absolute","inset-0","flex","items-center","justify-center"],[1,"material-symbols-outlined","text-slate-300","dark:text-slate-600","text-4xl"],[1,"absolute","w-6","h-4","bg-slate-900","dark:bg-white","border-2","border-white","dark:border-slate-900","transition-all","duration-200"],[1,"text-[9px]","font-mono","text-slate-500","uppercase","tracking-wider","text-center","mt-1.5"],[1,"space-y-4"],[1,"pb-3","border-b","border-slate-100","dark:border-slate-800"],[1,"flex","items-center","justify-between","mb-2"],[1,"text-[9px]","font-bold","uppercase","tracking-widest","text-slate-500"],[1,"text-[10px]","font-mono","font-bold","text-slate-900","dark:text-white"],["type","range","min","30","max","150","step","5",1,"w-full","h-1","bg-slate-200","dark:bg-slate-700","rounded-none","appearance-none","cursor-pointer","accent-slate-900","dark:accent-white",3,"input","value"],[1,"text-[9px]","font-bold","uppercase","tracking-widest","text-slate-500","flex","items-center","gap-1"],["type","range","min","0","max","700","step","5",1,"w-full","h-1","bg-slate-200","dark:bg-slate-700","rounded-none","appearance-none","cursor-pointer","accent-slate-900","dark:accent-white",3,"input","value"],["type","range","min","0","max","500","step","5",1,"w-full","h-1","bg-slate-200","dark:bg-slate-700","rounded-none","appearance-none","cursor-pointer","accent-slate-900","dark:accent-white",3,"input","value"],["type","range","min","10","max","100","step","5",1,"w-full","h-1","bg-slate-200","dark:bg-slate-700","rounded-none","appearance-none","cursor-pointer","accent-slate-900","dark:accent-white",3,"input","value"],[1,"w-full","py-3","border","border-dashed","border-slate-300","dark:border-slate-600","text-[9px]","font-bold","uppercase","tracking-widest","text-slate-500","hover:text-slate-900","dark:hover:text-white","hover:border-slate-900","dark:hover:border-white","transition-colors",3,"click"]],template:function(e,i){e&1&&(o(0,"div",1)(1,"header",2)(2,"div",3)(3,"p",4),_(4,"span",5),l(5," Editor Imagini "),s(),o(6,"h2",6),l(7),s()(),o(8,"button",7),u("click",function(){return i.cancel()}),o(9,"span",8),l(10,"close"),s()()(),o(11,"div",9)(12,"div",10),T(13,Ut,5,0,"div",11),o(14,"div",12),_(15,"div",13),o(16,"div",14)(17,"image-cropper",15,0),u("imageCropped",function(r){return i.onCropped(r)})("imageLoaded",function(r){return i.onImageLoaded(r)})("loadImageFailed",function(r){return i.onLoadFailed(r)}),s(),T(19,Ft,1,11,"img",16),s(),o(20,"div",17),l(21),s()()(),o(22,"div",18)(23,"div",19),$(24,Ht,5,3,"button",20,At),s(),o(26,"div",21),T(27,Wt,27,2,"div",22),T(28,jt,3,10,"div",23),T(29,$t,7,3,"div",22),s(),o(30,"div",24)(31,"button",25),u("click",function(){return i.reset()}),o(32,"span",26),l(33,"restart_alt"),s(),l(34," Reseteaz\u0103 tot "),s()()()(),o(35,"div",27)(36,"button",28),u("click",function(){return i.cancel()}),l(37," Anuleaz\u0103 "),s(),o(38,"button",29),u("click",function(){return i.save()}),o(39,"span",26),l(40),s(),l(41),s()()()),e&2&&(d(7),k(" ",i.data.media.name," "),d(6),D(i.imageLoaded()?-1:13),d(4),z("filter",i.cssFilter()),b("imageURL",i.imageUrl())("maintainAspectRatio",!i.isNaN(i.aspectRatio()))("aspectRatio",i.aspectRatio())("canvasRotation",i.canvasRotation())("transform",je(21,Tt,i.flipH(),i.flipV()))("alignImage","left"),d(2),D(i.watermarkEnabled()&&i.imageLoaded()?19:-1),d(2),Z(" ",i.data.media.width,"\xD7",i.data.media.height,"px "),d(3),X(i.tabs),d(3),D(i.activeTool()==="crop"?27:-1),d(),D(i.activeTool()==="adjust"?28:-1),d(),D(i.activeTool()==="watermark"?29:-1),d(9),b("disabled",i.isSaving()||!i.imageLoaded()),d(),Y("animate-spin",i.isSaving()),d(),k(" ",i.isSaving()?"progress_activity":"save"," "),d(),k(" ",i.isSaving()?"Se proceseaz\u0103...":"Salveaz\u0103 imaginea"," "))},dependencies:[Ye,pe,nt],encapsulation:2})};var Xt=["blurhashCanvas"];function Yt(n,t){if(n&1){let e=M();o(0,"div",35),_(1,"canvas",36,0)(3,"img",37),s(),o(4,"div",38)(5,"button",39),u("click",function(){h(e);let a=m();return g(a.activePreview.set("image"))}),l(6," Imagine "),s(),o(7,"button",40),u("click",function(){h(e);let a=m();return g(a.activePreview.set("blurhash"))}),o(8,"span",41),l(9,"blur_on"),s(),l(10," Blurhash "),s()()}if(n&2){let e,i=m();d(),z("opacity",i.activePreview()==="blurhash"?"1":"0"),d(2),z("opacity",i.activePreview()==="image"?"1":"0"),b("src",i.baseUrl+(((e=i.media().variants)==null?null:e.lg)||i.media().url),U)("alt",i.media().altText||i.media().name),d(2),ye(i.activePreview()==="image"?"bg-white dark:bg-[#151515] text-blue-600 shadow-sm":"text-slate-500 dark:text-slate-400 hover:text-slate-900 dark:hover:text-white"),d(2),ye(i.activePreview()==="blurhash"?"bg-white dark:bg-[#151515] text-indigo-600 shadow-sm":"text-slate-500 dark:text-slate-400 hover:text-slate-900 dark:hover:text-white")}}function qt(n,t){if(n&1&&(o(0,"div",10),_(1,"app-image",42),s()),n&2){let e=m();d(),b("media",e.media())("alt",e.media().altText||e.media().name)}}function Qt(n,t){if(n&1&&(o(0,"div",12)(1,"span",13),l(2,"Dimensiuni"),s(),o(3,"span",14),l(4),s()()),n&2){let e=m();d(4),Z("",e.media().width,"\xD7",e.media().height,"px")}}function Kt(n,t){if(n&1){let e=M();o(0,"div",20)(1,"h3",43),l(2,"Variante WebP"),s(),o(3,"div",44)(4,"div",45)(5,"div",46),_(6,"span",47),o(7,"span",48),l(8,"SM"),s(),o(9,"span",49),l(10),s()(),o(11,"div",50)(12,"button",51),u("click",function(){h(e);let a=m();return g(a.copyAnyUrl(a.media().variants.sm))}),o(13,"span",52),l(14,"content_copy"),s()(),o(15,"a",53)(16,"span",52),l(17,"open_in_new"),s()()()(),o(18,"div",45)(19,"div",46),_(20,"span",54),o(21,"span",48),l(22,"MD"),s(),o(23,"span",49),l(24),s()(),o(25,"div",50)(26,"button",51),u("click",function(){h(e);let a=m();return g(a.copyAnyUrl(a.media().variants.md))}),o(27,"span",52),l(28,"content_copy"),s()(),o(29,"a",53)(30,"span",52),l(31,"open_in_new"),s()()()(),o(32,"div",45)(33,"div",46),_(34,"span",55),o(35,"span",48),l(36,"LG"),s(),o(37,"span",49),l(38),s()(),o(39,"div",50)(40,"button",51),u("click",function(){h(e);let a=m();return g(a.copyAnyUrl(a.media().variants.lg))}),o(41,"span",52),l(42,"content_copy"),s()(),o(43,"a",53)(44,"span",52),l(45,"open_in_new"),s()()()()()()}if(n&2){let e=m();d(10),V(e.media().variants.sm),d(5),b("href",e.baseUrl+e.media().variants.sm,U),d(9),V(e.media().variants.md),d(5),b("href",e.baseUrl+e.media().variants.md,U),d(9),V(e.media().variants.lg),d(5),b("href",e.baseUrl+e.media().variants.lg,U)}}function Gt(n,t){if(n&1){let e=M();o(0,"span",29),l(1),o(2,"button",56),u("click",function(){let a=h(e).$implicit,r=m();
1return g(r.removeTag(a))}),o(3,"span",57),l(4,"close"),s()()()}if(n&2){let e=t.$implicit;d(),k(" #",e," ")}}function Jt(n,t){if(n&1){let e=M();o(0,"button",58),u("click",function(){h(e);let a=m();return g(a.openImageEditor())}),o(1,"span",19),l(2,"tune"),s(),l(3," Editor Imagini "),s()}}var st=class n{dialogRef=I(ce);data=I(me);mediaService=I(Q);notify=I(de);dialog=I(tt);media=f(v({},this.data.media));name=f(this.data.media.name);altText=f(this.data.media.altText??"");description=f(this.data.media.description??"");tags=f([...this.data.media.tags??[]]);tagInput=f("");isSaving=f(!1);isDeleting=f(!1);isImage=q(()=>this.media().variants!==null);baseUrl=F.API_URL.replace(/\/api\/$/,"");fileUrl=q(()=>{let t=this.media().url;return`${this.baseUrl}${t.replace(/^\//,"")}`});activePreview=f("image");canvasRef;formatSize(t){if(t===0)return"0 B";let e=1024,i=["B","KB","MB","GB"],a=Math.floor(Math.log(t)/Math.log(e));return parseFloat((t/Math.pow(e,a)).toFixed(1))+" "+i[a]}ngOnInit(){}ngAfterViewInit(){let t=this.media().variants?.blurhash;t&&this.canvasRef?.nativeElement&&this.renderBlurhash(t,this.canvasRef.nativeElement)}onTagInputKeydown(t){(t.key==="Enter"||t.key===",")&&(t.preventDefault(),this.addTag())}addTag(){let t=this.tagInput().trim().replace(/^,+|,+$/g,"");if(!t)return;let e=t.split(",").map(i=>i.trim()).filter(i=>i&&!this.tags().includes(i));this.tags.update(i=>[...i,...e]),this.tagInput.set("")}removeTag(t){this.tags.update(e=>e.filter(i=>i!==t))}copyUrl(){navigator.clipboard.writeText(this.fileUrl()).then(()=>{this.notify.info("URL copiat \xEEn clipboard.")})}copyAnyUrl(t){if(!t)return;let e=t.startsWith("/")?`${this.baseUrl}${t.replace(/^\//,"")}`:t;navigator.clipboard.writeText(e).then(()=>{this.notify.info("URL copiat \xEEn clipboard.")})}renderBlurhash(t,e){try{let r=Je(t,32,32),p=e.getContext("2d");if(!p)return;e.width=32,e.height=32;let c=p.createImageData(32,32);c.data.set(r),p.putImageData(c,0,0)}catch(i){console.error("Eroare decodare Blurhash",i)}}save(){this.isSaving.set(!0),this.mediaService.updateMedia(this.media().id,{name:this.name(),altText:this.altText(),description:this.description(),tags:this.tags()}).subscribe({next:t=>{this.isSaving.set(!1),this.notify.success("Fi\u0219ier actualizat."),this.dialogRef.close(t)},error:()=>{this.isSaving.set(!1),this.notify.error("Eroare la salvare.")}})}openImageEditor(){this.dialog.open(xe,{data:{media:this.media()},backdropClass:["bg-slate-900/80","backdrop-blur-sm"],panelClass:["custom-dialog-panel","!max-w-[1300px]","!w-[95vw]","!h-[92vh]"]}).closed.subscribe(e=>{e&&(this.media.set(e),this.notify.success("Imagine editat\u0103 \u0219i salvat\u0103 ca fi\u0219ier nou."))})}delete(){this.dialog.open(it,{data:{title:`\u0218terge\u021Bi "${this.media().name}"?`,message:"Fi\u0219ierul va fi eliminat definitiv. Dac\u0103 e folosit \xEEn articole, imaginile vor disp\u0103rea.",confirmText:"\u0218terge Definitiv",cancelText:"Anuleaz\u0103",intent:"danger"},backdropClass:["bg-slate-900/80","backdrop-blur-sm"],panelClass:"custom-dialog-panel"}).closed.subscribe(e=>{e?.confirm&&(this.isDeleting.set(!0),this.mediaService.deleteFile(this.media().id).subscribe({next:()=>{this.isDeleting.set(!1),this.notify.deleted(`"${this.media().name}" a fost \u0219ters.`),this.dialogRef.close({deleted:!0})},error:()=>{this.isDeleting.set(!1),this.notify.error("Eroare la \u0219tergere.")}}))})}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=N({type:n,selectors:[["app-media-edit-dialog"]],viewQuery:function(e,i){if(e&1&&oe(Xt,5),e&2){let a;G(a=J())&&(i.canvasRef=a.first)}},decls:76,vars:21,consts:[["blurhashCanvas",""],[1,"bg-white","dark:bg-[#050505]","border-t-4","border-slate-900","dark:border-white","shadow-2xl","flex","flex-col","w-full","max-w-3xl","font-sans","animate-fade-in","relative","mx-auto","rounded-sm","overflow-hidden","max-h-[90vh]"],[1,"flex","items-center","justify-between","px-8","pt-7","pb-5","border-b","border-slate-200","dark:border-slate-800","bg-slate-50","dark:bg-[#0a0a0a]","shrink-0"],[1,"text-[10px]","font-bold","uppercase","tracking-[0.2em]","text-blue-600","mb-1"],[1,"font-sans","text-2xl","font-black","text-slate-900","dark:text-white","leading-none","truncate","max-w-md"],[1,"p-2","text-slate-400","hover:text-red-600","transition-colors","focus:outline-none",3,"click"],[1,"material-symbols-outlined","text-[22px]"],[1,"flex","flex-col","md:flex-row","flex-1","overflow-hidden","min-h-0"],[1,"w-full","md:w-2/5","border-b","md:border-b-0","md:border-r","border-slate-200","dark:border-slate-800","flex","flex-col","bg-slate-50","dark:bg-[#0a0a0a]"],[1,"w-full","bg-slate-100","dark:bg-slate-900","p-6","flex","flex-col","items-center","justify-center","gap-6"],[1,"w-full","as
1pect-square","max-w-[280px]","bg-slate-200","dark:bg-slate-900","rounded-sm","overflow-hidden","flex","items-center","justify-center","border","border-slate-300","dark:border-slate-700"],[1,"p-5","space-y-3","flex-1","overflow-y-auto"],[1,"flex","justify-between","text-[11px]"],[1,"font-bold","uppercase","tracking-widest","text-slate-400"],[1,"font-mono","text-slate-900","dark:text-white"],[1,"pt-2","border-t","border-slate-200","dark:border-slate-800"],[1,"flex","items-center","gap-2","bg-white","dark:bg-[#111]","border","border-slate-200","dark:border-slate-700","px-3","py-2"],[1,"text-[10px]","font-mono","text-slate-500","truncate","flex-1"],[1,"text-slate-400","hover:text-blue-600","transition-colors","shrink-0","focus:outline-none",3,"click"],[1,"material-symbols-outlined","text-[16px]"],[1,"pt-5","border-t","border-slate-200","dark:border-slate-800"],[1,"w-full","md:w-3/5","p-6","md:p-8","overflow-y-auto","space-y-5"],[1,"block","text-[10px]","font-bold","uppercase","tracking-widest","text-slate-500","mb-2"],["type","text",1,"w-full","bg-transparent","border","border-slate-200","dark:border-slate-700","px-3","py-2.5","text-sm","text-slate-900","dark:text-white","placeholder-slate-400","focus:outline-none","focus:border-blue-500","transition-colors","font-sans",3,"input","value"],[1,"normal-case","tracking-normal","font-normal","text-slate-400"],["type","text","placeholder","Descrie imaginea pentru screen readers...",1,"w-full","bg-transparent","border","border-slate-200","dark:border-slate-700","px-3","py-2.5","text-sm","text-slate-900","dark:text-white","placeholder-slate-400","focus:outline-none","focus:border-blue-500","transition-colors","font-sans",3,"input","value"],["placeholder","Descriere op\u021Bional\u0103...","rows","3",1,"w-full","bg-transparent","border","border-slate-200","dark:border-slate-700","px-3","py-2.5","text-sm","text-slate-900","dark:text-white","placeholder-slate-400","focus:outline-none","focus:border-blue-500","transition-colors","font-sans","resize-none",3,"input","value"],["type","text","placeholder","Adaug\u0103 tag-uri...",1,"w-full","bg-transparent","border","border-slate-200","dark:border-slate-700","px-3","py-2.5","text-sm","text-slate-900","dark:text-white","placeholder-slate-400","focus:outline-none","focus:border-blue-500","transition-colors","font-mono",3,"input","keydown","blur","value"],[1,"flex","flex-wrap","gap-1.5","mt-2"],[1,"flex","items-center","gap-1","text-[10px]","font-mono","uppercase","tracking-wider","px-2","py-1","bg-slate-100","dark:bg-white","text-black","dark:text-slate-900"],[1,"px-8","py-5","border-t","border-slate-200","dark:border-slate-800","bg-slate-50","dark:bg-[#0a0a0a]","shrink-0","flex","flex-col","sm:flex-row","items-center","justify-between","gap-3"],[1,"flex","items-center","gap-2","px-4","py-2.5","text-[11px]","font-bold","uppercase","tracking-widest","text-red-600","hover:bg-red-50","dark:hover:bg-red-950","border","border-red-200","dark:border-red-900","transition-colors","focus:outline-none","disabled:opacity-50","w-full","sm:w-auto","justify-center",3,"click","disabled"],[1,"flex","items-center","gap-3","w-full","sm:w-auto"],[1,"flex","items-center","gap-2","px-4","py-2.5","text-[11px]","font-bold","uppercase","tracking-widest","border-2","border-slate-300","dark:border-slate-700","text-slate-700","dark:text-slate-300","hover:border-slate-900","dark:hover:border-white","hover:text-slate-900","dark:hover:text-white","transition-colors","focus:outline-none","w-full","sm:w-auto","justify-center"],[1,"flex","items-center","gap-2","bg-slate-900","dark:bg-white","text-white","dark:text-slate-900","px-6","py-2.5","text-[11px]","font-bold","uppercase","tracking-widest","hover:bg-blue-600","dark:hover:bg-blue-500","hover:text-white","dark:hover:text-white","transition-colors","focus:outline-none","disabled:opacity-50","w-full","sm:w-auto","justify-center",3,"click","disabled"],[1,"relative","w-full","aspect-square","max-w-[280px]","bg-slate-200","dark:bg-slate-900","rounded-sm","overflow-hidden","shadow-sm","border","border-slate-300","dark:border-slate-700"],[1,"absolute","
1inset-0","w-full","h-full","transition-opacity","duration-700","object-cover"],[1,"absolute","inset-0","w-full","h-full","transition-opacity","duration-700","object-contain","bg-slate-900/5","dark:bg-white/5",3,"src","alt"],[1,"flex","bg-slate-200/70","dark:bg-slate-800","p-1","rounded-sm","w-full","max-w-[280px]","shadow-inner"],[1,"flex-1","py-2","text-[10px]","font-bold","uppercase","tracking-widest","text-center","rounded-sm","transition-all",3,"click"],[1,"flex-1","py-2","text-[10px]","font-bold","uppercase","tracking-widest","text-center","rounded-sm","transition-all","flex","items-center","justify-center","gap-1.5",3,"click"],[1,"material-symbols-outlined","text-[14px]"],[1,"w-full","h-full","block",3,"media","alt"],[1,"text-[10px]","font-bold","uppercase","tracking-widest","text-slate-400","mb-3"],[1,"space-y-2"],[1,"flex","items-center","justify-between","px-3","py-2","text-xs","bg-slate-50","dark:bg-[#0a0a0a]","border","border-slate-200","dark:border-slate-800","rounded-sm"],[1,"flex","items-center","gap-2","flex-1","min-w-0"],[1,"w-2","h-2","rounded-full","bg-green-500","shrink-0"],[1,"font-bold","uppercase","tracking-widest","text-slate-900","dark:text-white"],[1,"font-mono","text-slate-500","truncate"],[1,"flex","gap-px","shrink-0"],[1,"p-1","text-slate-400","hover:text-blue-600",3,"click"],[1,"material-symbols-outlined","text-sm"],["target","_blank",1,"p-1","text-slate-400","hover:text-blue-600",3,"href"],[1,"w-2","h-2","rounded-full","bg-blue-500","shrink-0"],[1,"w-2","h-2","rounded-full","bg-purple-500","shrink-0"],[1,"hover:text-red-400","dark:hover:text-red-600","transition-colors","focus:outline-none","ml-0.5","cursor-pointer",3,"click"],[1,"material-symbols-outlined","text-[18px]!","mt-1"],[1,"flex","items-center","gap-2","px-4","py-2.5","text-[11px]","font-bold","uppercase","tracking-widest","border-2","border-slate-300","dark:border-slate-700","text-slate-700","dark:text-slate-300","hover:border-slate-900","dark:hover:border-white","hover:text-slate-900","dark:hover:text-white","transition-colors","focus:outline-none","w-full","sm:w-auto","justify-center",3,"click"]],template:function(e,i){e&1&&(o(0,"div",1)(1,"header",2)(2,"div")(3,"p",3),l(4,"Editare Fi\u0219ier"),s(),o(5,"h2",4),l(6),s()(),o(7,"button",5),u("click",function(){return i.dialogRef.close()}),o(8,"span",6),l(9,"close"),s()()(),o(10,"div",7)(11,"div",8)(12,"div",9),T(13,Yt,11,10)(14,qt,2,2,"div",10),s(),o(15,"div",11),T(16,Qt,5,2,"div",12),o(17,"div",12)(18,"span",13),l(19,"M\u0103rime"),s(),o(20,"span",14),l(21),s()(),o(22,"div",12)(23,"span",13),l(24,"Tip"),s(),o(25,"span",14),l(26),s()(),o(27,"div",12)(28,"span",13),l(29,"Ad\u0103ugat"),s(),o(30,"span",14),l(31),$e(32,"date"),s()(),o(33,"div",15)(34,"div",16)(35,"span",17),l(36),s(),o(37,"button",18),u("click",function(){return i.copyUrl()}),o(38,"span",19),l(39,"content_copy"),s()()()(),T(40,Kt,46,6,"div",20),s()(),o(41,"div",21)(42,"div")(43,"label",22),l(44,"Denumire"),s(),o(45,"input",23),u("input",function(r){return i.name.set(r.target.value)}),s()(),o(46,"div")(47,"label",22),l(48," Text Alternativ "),o(49,"span",24),l(50,"(pentru accesibilitate & SEO)"),s()(),o(51,"input",25),u("input",function(r){return i.altText.set(r.target.value)}),s()(),o(52,"div")(53,"label",22),l(54,"Descriere"),s(),o(55,"textarea",26),u("input",function(r){return i.description.set(r.target.value)}),s()(),o(56,"div")(57,"label",22),l(58," Tag-uri "),o(59,"span",24),l(60,"(Enter sau virgul\u0103)"),s()(),o(61,"input",27),u("input",function(r){return i.tagInput.set(r.target.value)})("keydown",function(r){return i.onTagInputKeydown(r)})("blur",function(){return i.addTag()}),s(),o(62,"div",28),$(63,Gt,5,1,"span",29,Le),s()()()(),o(65,"div",30)(66,"button",31),u("click",function(){return i.delete()}),o(67,"span",19),l(68,"delete"),s(),l(69),s(),o(70,"div",32),T(71,Jt,4,0,"button",33),o(72,"button",34),u("click",function(){return i.save()}),o(73,"span",19),l(74),s(),l(75),s()()()()),e&2&&(d(6),k(" ",i.media().name," "),d(7),D(i.isImage()?13:14),d(3),D(i.media().width&&i.media().height?16:-1),d(5),V(i.formatSize(i.media().mediaSize)),d(5),V(i.media().mimeType),d(5),V(Xe(32,18,i.media().createdAt,"dd MMM yyyy")),d(5),V(i.fileUrl()),d(4),D(i.media().variants?40:-1),d(5),b("value",i.name()),d(6),b("value",i.altText()),d(4),b("value",i.description()),d(6),b("value",i.tagInput()),d(2),X(i.tags()),d(3),b("disabled",i.isDeleting()),d(3),k(" ",i.isDeleting()?"Se \u0219terge...":"\u0218terge"," "),d(2),D(i.isImage()?71:-1),d(),b("disabled",i.isSaving()),d(2),V(i.isSaving()?"progress_activity":"save"),d(),k(" ",i.isSaving()?"Se salveaz\u0103...":"Salveaz\u0103"," "))},dependencies:[pe,Ze,Qe],encapsulation:2})};export{Q as a,xe as b,st as c};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.