1import{a as it,b as nt,c as we,d as ye}from"./chunk-AXWOWECU.js";import{a as Ce,b as Ze}from"./chunk-RC3V2VR2.js";import{c as et,d as tt}from"./chunk-ZRBPW2HV.js";import{d as ne}from"./chunk-NKY44VBP.js";import{Aa as De,Ab as qe,Ca as O,G as de,Gd as $e,Hb as ie,I as p,Ia as f,J as m,Ja as l,Md as Qe,Na as ee,Oa as j,Pa as q,Q as B,Ra as H,S as Le,Sa as te,Ta as W,X as K,Z as ke,_ as R,b as Ae,c as he,ca as He,cd as Xe,da as J,eb as xe,fb as _e,gd as Ye,ha as Z,j as V,ka as ge,kb as U,m as pe,ma as ue,na as We,o as Ve,oa as fe,rb as Be,sa as P,t as Fe,ta as g,ua as u,va as C,wc as Ge,xb as je,y as me,za as Ee}from"./chunk-HBSCIRJF.js";import{a as Ne}from"./chunk-EWCAJSRE.js";import{a as F,c as Ke,d as Je}from"./chunk-JPSAJPKY.js";import{a as w,b as A,l as h}from"./chunk-CU44V7JF.js";var dt=["wrapper"],gt=["sourceImage"];function ut(a,t){if(a&1){let e=O();g(0,"img",5,0),f("load",function(){p(e);let n=l();return m(n.imageLoadedInView())})("mousedown",function(n){p(e);let o=l();return m(o.startMove(n,o.moveTypes.Drag))})("touchstart",function(n){p(e);let o=l();return m(o.startMove(n,o.moveTypes.Drag))})("error",function(n){p(e);let o=l();return m(o.loadImageError(n))}),u()}if(a&2){let e=t.ngIf,i=l();H("visibility",i.imageVisible?"visible":"hidden")("transform",i.safeTransformStyle()),te("ngx-ic-draggable",!i.disabled&&i.allowMoveImage),P("src",e,K),ge("alt",i.imageAltText)}}function ft(a,t){if(a&1){let e=O();
1Ee(0),g(1,"span",9),f("mousedown",function(n){p(e);let o=l(2);return m(o.startMove(n,o.moveTypes.Resize,"topleft"))})("touchstart",function(n){p(e);let o=l(2);return m(o.startMove(n,o.moveTypes.Resize,"topleft"))}),C(2,"span",10),u(),g(3,"span",11),f("mousedown",function(n){p(e);let o=l(2);return m(o.startMove(n,o.moveTypes.Resize,"topright"))})("touchstart",function(n){p(e);let o=l(2);return m(o.startMove(n,o.moveTypes.Resize,"topright"))}),C(4,"span",10),u(),g(5,"span",12),f("mousedown",function(n){p(e);let o=l(2);return m(o.startMove(n,o.moveTypes.Resize,"bottomright"))})("touchstart",function(n){p(e);let o=l(2);return m(o.startMove(n,o.moveTypes.Resize,"bottomright"))}),C(6,"span",10),u(),g(7,"span",13),f("mousedown",function(n){p(e);let o=l(2);return m(o.startMove(n,o.moveTypes.Resize,"bottomleft"))})("touchstart",function(n){p(e);let o=l(2);return m(o.startMove(n,o.moveTypes.Resize,"bottomleft"))}),C(8,"span",10),u(),g(9,"span",14),f("mousedown",function(n){p(e);let o=l(2);return m(o.startMove(n,o.moveTypes.Resize,"top"))})("touchstart",function(n){p(e);let o=l(2);return m(o.startMove(n,o.moveTypes.Resize,"top"))}),u(),g(10,"span",15),f("mousedown",function(n){p(e);let o=l(2);return m(o.startMove(n,o.moveTypes.Resize,"top"))})("touchstart",function(n){p(e);let o=l(2);return m(o.startMove(n,o.moveTypes.Resize,"top"))}),C(11,"span",10),u(),g(12,"span",16),f("mousedown",function(n){p(e);let o=l(2);return m(o.startMove(n,o.moveTypes.Resize,"right"))})("touchstart",function(n){p(e);let o=l(2);return m(o.startMove(n,o.moveTypes.Resize,"right"))}),u(),g(13,"span",17),f("mousedown",function(n){p(e);let o=l(2);return m(o.startMove(n,o.moveTypes.Resize,"right"))})("touchstart",function(n){p(e);let o=l(2);return m(o.startMove(n,o.moveTypes.Resize,"right"))}),C(14,"span",10),u(),g(15,"span",18),f("mousedown",function(n){p(e);let o=l(2);return m(o.startMove(n,o.moveTypes.Resize,"bottom"))})("touchstart",function(n){p(e);let o=l(2);return m(o.startMove(n,o.moveTypes.Resize,"bottom"))}),u(),g(16,"span",19),f("mousedown",function(n){p(e);let o=l(2);return m(o.startMove(n,o.moveTypes.Resize,"bottom"))})("touchstart",function(n){p(e);let o=l(2);return m(o.startMove(n,o.moveTypes.Resize,"bottom"))}),C(17,"span",10),u(),g(18,"span",20),f("mousedown",function(n){p(e);let o=l(2);return m(o.startMove(n,o.moveTypes.Resize,"left"))})("touchstart",function(n){p(e);let o=l(2);return m(o.startMove(n,o.moveTypes.Resize,"left"))}),u(),g(19,"span",21),f("mousedown",function(n){p(e);let o=l(2);return m(o.startMove(n,o.moveTypes.Resize,"left"))})("touchstart",function(n){p(e);let o=l(2);return m(o.startMove(n,o.moveTypes.Resize,"left"))}),C(20,"span",10),u(),De()}}function xt(a,t){if(a&1){let e=O();g(0,"div",6),f("keydown",function(n){p(e);let o=l();return m(o.keyboardAccess(n))}),g(1,"div",7),f("mousedown",function(n){p(e);let o=l();return m(o.startMove(n,o.moveTypes.Move))})("touchstart",function(n){p(e);let o=l();return m(o.startMove(n,o.moveTypes.Move))}),u(),Z(2,ft,21,0,"ng-container",8),u()}if(a&2){let e=l();H("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"),te("ngx-ic-round",e.state.options.roundCropper),ge("aria-label",e.state.options.cropperFrameAriaLabel),R(2),P("ngIf",!e.state.options.hideResizeSquares&&!(e.state.options.cropperStaticWidth&&e.state.options.cropperStaticHeight))}}function G(a,t,e){return a=_t(a,t),oe(a,t,e)}function _t(a,t){let e=a.x2-a.x1,i=a.y2-a.y1,n=a.x1+e/2,o=a.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 r=n-e/2,s=r+e,c=o-i/2,d=c+i;return{x1:r,x2:s,y1:c,y2:d}}function oe(a,t,e=!1){return a.x1<0&&(a=A(w({},a),{x1:0,x2:a.x2-(e?a.x1:0)})),a.y1<0&&(a=A(w({},a),{y2:a.y2-(e?a.y1:0),y1:0})),a.x2>t.maxSize().width&&(a=A(w({},a),{x1:a.x1-(e?a.x2-t.maxSize().width:0),x2:t.maxSize().width})),a.y2>t.maxSize().height&&(a=A(w({},a),{y1:a.y1-(e?a.y2-t.maxSize().height:0),y2:t.maxSize().height})),a}
1function Ct(a,t){let e=ae(a)-t.clientX,i=re(a)-t.clientY;return{x1:t.cropper.x1+e,y1:t.cropper.y1+i,x2:t.cropper.x2+e,y2:t.cropper.y2+i}}function ot(a,t,e){let i=w({},e.cropper()),n=ae(a)-t.clientX,o=re(a)-t.clientY;switch(t.position){case"left":i.x1=Math.min(Math.max(t.cropper.x1+n,i.x2-e.cropperScaledMaxWidth),i.x2-e.cropperScaledMinWidth);break;case"topleft":i.x1=Math.min(Math.max(t.cropper.x1+n,i.x2-e.cropperScaledMaxWidth),i.x2-e.cropperScaledMinWidth),i.y1=Math.min(Math.max(t.cropper.y1+o,i.y2-e.cropperScaledMaxHeight),i.y2-e.cropperScaledMinHeight);break;case"top":i.y1=Math.min(Math.max(t.cropper.y1+o,i.y2-e.cropperScaledMaxHeight),i.y2-e.cropperScaledMinHeight);break;case"topright":i.x2=Math.max(Math.min(t.cropper.x2+n,i.x1+e.cropperScaledMaxWidth),i.x1+e.cropperScaledMinWidth),i.y1=Math.min(Math.max(t.cropper.y1+o,i.y2-e.cropperScaledMaxHeight),i.y2-e.cropperScaledMinHeight);break;case"right":i.x2=Math.max(Math.min(t.cropper.x2+n,i.x1+e.cropperScaledMaxWidth),i.x1+e.cropperScaledMinWidth);break;case"bottomright":i.x2=Math.max(Math.min(t.cropper.x2+n,i.x1+e.cropperScaledMaxWidth),i.x1+e.cropperScaledMinWidth),i.y2=Math.max(Math.min(t.cropper.y2+o,i.y1+e.cropperScaledMaxHeight),i.y1+e.cropperScaledMinHeight);break;case"bottom":i.y2=Math.max(Math.min(t.cropper.y2+o,i.y1+e.cropperScaledMaxHeight),i.y1+e.cropperScaledMinHeight);break;case"bottomleft":i.x1=Math.min(Math.max(t.cropper.x1+n,i.x2-e.cropperScaledMaxWidth),i.x2-e.cropperScaledMinWidth),i.y2=Math.max(Math.min(t.cropper.y2+o,i.y1+e.cropperScaledMaxHeight),i.y1+e.cropperScaledMinHeight);break;case"center":let r="scale"in a?a.scale:1,s=Math.min(Math.max(e.cropperScaledMinWidth,Math.abs(t.cropper.x2-t.cropper.x1)*r),e.cropperScaledMaxWidth),c=Math.min(Math.max(e.cropperScaledMinHeight,Math.abs(t.cropper.y2-t.cropper.y1)*r),e.cropperScaledMaxHeight);i.x1=t.clientX-s/2,i.x2=t.clientX+s/2,i.y1=t.clientY-c/2,i.y2=t.clientY+c/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(a,t,e){t=w({},t);let i=0,n=0;switch(a){case"top":t.x2=t.x1+(t.y2-t.y1)*e.options.aspectRatio,i=Math.max(t.x2-e.maxSize().width,0),n=Math.max(0-t.y1,0),(i>0||n>0)&&(t.x2-=n*e.options.aspectRatio>i?n*e.options.aspectRatio:i,t.y1+=n*e.options.aspectRatio>i?n: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),n=Math.max(t.y2-e.maxSize().height,0),(i>0||n>0)&&(t.x2-=n*e.options.aspectRatio>i?n*e.options.aspectRatio:i,t.y2-=n*e.options.aspectRatio>i?n: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),n=Math.max(0-t.y1,0),(i>0||n>0)&&(t.x1+=n*e.options.aspectRatio>i?n*e.options.aspectRatio:i,t.y1+=n*e.options.aspectRatio>i?n: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),n=Math.max(0-t.y1,0),(i>0||n>0)&&(t.x2-=n*e.options.aspectRatio>i?n*e.options.aspectRatio:i,t.y1+=n*e.options.aspectRatio>i?n: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),n=Math.max(t.y2-e.maxSize().height,0),(i>0||n>0)&&(t.x2-=n*e.options.aspectRatio>i?n*e.options.aspectRatio:i,t.y2-=n*e.options.aspectRatio>i?n: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),n=Math.max(t.y2-e.maxSize().height,0),(i>0||n>0)&&(t.x1+=n*e.options.aspectRatio>i?n*e.options.aspectRatio:i,t.y2-=n*e.options.aspectRatio>i?n: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 o=Math.max(0-t.x1,0),r=Math.max(t.x2-e.maxSize().width,0),s=Math.max(t.y2-e.maxSize().height,0),c=Math.max(0-t.y1,0);(o>0||r>0||s>0||c>0)&&(t.x1+=s*e.options.aspectRatio>o?s*e.options.aspectRatio:o,t.x2-=c*e.options.aspectRatio>r?c*e.options.aspectRatio:r,t.y1+=c*e.options.aspectRatio>r?c:r/e.options.aspectRatio,t.y2-=s*e.options.aspectRatio>o?s:o/e.options.aspectRatio);break}return t}function ae(a){return"touches"in a&&a.touches[0]?a.touches[0].clientX:"clientX"in a?a.clientX:0}function re(a){return"touches"in a&&a.touches[0]?a.touches[0].clientY:"
1clientX"in a?a.clientY:0}var Me=class{constructor(){this.cropper=B({x1:0,x2:0,y1:0,y2:0}),this.maxSize=B({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,[n,o])=>A(w({},i),{[n]:o.currentValue}),{});Object.keys(e).length>0&&this.setOptions(e)}setOptions(t){if(this.options=w(w({},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=>G(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:w({},this.options)}}},b=(function(a){return a.Drag="drag",a.Move="move",a.Resize="resize",a.Pinch="pinch",a})(b||{});function yt(a,t,e){let i=a.width,n=a.height;t=Math.round(t),e=Math.round(e);let o=i/t,r=n/e,s=Math.ceil(o/2),c=Math.ceil(r/2),d=a.getContext("2d");if(d){let M=d.getImageData(0,0,i,n),y=d.createImageData(t,e),_=M.data,x=y.data;for(let v=0;v<e;v++)for(let S=0;S<t;S++){let T=(S+v*t)*4,N=v*r,I=0,z=0,Re=0,ze=0,Pe=0,Se=0,Oe=0,ct=Math.floor(S*o),lt=Math.floor(v*r),ce=Math.ceil((S+1)*o),le=Math.ceil((v+1)*r);ce=Math.min(ce,i),le=Math.min(le,n);for(let $=lt;$<le;$++){let Ue=Math.abs(N-$)/c,ht=S*o,pt=Ue*Ue;for(let Q=ct;Q<ce;Q++){let Te=Math.abs(ht-Q)/s,L=Math.sqrt(pt+Te*Te);if(L>=1)continue;I=2*L*L*L-3*L*L+1;let k=4*(Q+$*i);Oe+=I*_[k+3],Re+=I,_[k+3]<255&&(I=I*_[k+3]/250),ze+=I*_[k],Pe+=I*_[k+1],Se+=I*_[k+2],z+=I}}x[T]=ze/z,x[T+1]=Pe/z,x[T+2]=Se/z,x[T+3]=Oe/Re}a.width=t,a.height=e,d.putImageData(y,0,0)}}function at(a,t){return a/100*t}var be=class{crop(t,e){let i=this.getImagePosition(t),n=i.x2-i.x1,o=i.y2-i.y1,r=document.createElement("canvas");
1r.width=n,r.height=o;let s=r.getContext("2d");if(!s)return null;t.options?.backgroundColor!=null&&(s.fillStyle=t.options.backgroundColor,s.fillRect(0,0,n,o));let c=(t.transform?.scale||1)*(t.transform?.flipH?-1:1),d=(t.transform?.scale||1)*(t.transform?.flipV?-1:1),{translateH:M,translateV:y}=this.getCanvasTranslate(t),_=t.loadedImage.transformed;s.setTransform(c,0,0,d,_.size.width/2+M,_.size.height/2+y),s.translate(-i.x1/c,-i.y1/d),s.rotate((t.transform?.rotate||0)*Math.PI/180),s.drawImage(_.image,-_.size.width/2,-_.size.height/2);let x={width:n,height:o,imagePosition:i,cropperPosition:w({},t.cropper)};t.options?.containWithinAspectRatio&&(x.offsetImagePosition=this.getOffsetImagePosition(t));let v=this.getResizeRatio(n,o,t.options);return v!==1&&(x.width=Math.round(n*v),x.height=t.options?.maintainAspectRatio?Math.round(x.width/(t.options?.aspectRatio??1)):Math.round(o*v),yt(r,x.width,x.height)),e==="blob"?this.cropToBlob(x,r,t):(x.base64=r.toDataURL("image/"+(t.options?.format??"png"),this.getQuality(t.options)),x)}cropToBlob(t,e,i){return h(this,null,function*(){return t.blob=yield new Promise(n=>e.toBlob(n,"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?at(t.transform.translateH,t.loadedImage.transformed.size.width):0,translateV:t.transform?.translateV?at(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),n,o;e%2?(n=(t.loadedImage.transformed.size.width-t.loadedImage.original.size.height)/2,o=(t.loadedImage.transformed.size.height-t.loadedImage.original.size.width)/2):(n=(t.loadedImage.transformed.size.width-t.loadedImage.original.size.width)/2,o=(t.loadedImage.transformed.size.height-t.loadedImage.original.size.height)/2);let r=t.cropper,s={x1:Math.round(r.x1*i)-n,y1:Math.round(r.y1*i)-o,x2:Math.round(r.x2*i)-n,y2:Math.round(r.y2*i)-o};return t.options?.containWithinAspectRatio||(s.x1=Math.max(s.x1,0),s.y1=Math.max(s.y1,0),s.x2=Math.min(s.x2,t.loadedImage.transformed.size.width),s.y2=Math.min(s.y2,t.loadedImage.transformed.size.height)),s}getResizeRatio(t,e,i){let n=new Array;i?.resizeToWidth&&i.resizeToWidth>0&&n.push(i.resizeToWidth/t),i?.resizeToHeight&&i.resizeToHeight>0&&n.push(i.resizeToHeight/e);let o=n.length===0?1:Math.min(...n);return o>1&&!i?.onlyScaleDown?o:Math.min(o,1)}getQuality(t){return Math.min(1,Math.max(0,(t?.imageQuality??92)/100))}},Mt=[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])],bt=URL.createObjectURL(new Blob(Mt,{type:"image/jpeg"}));function vt(){return new Promise(a=>{let t=new Image;t.onload=()=>{let e=t.width===1&&t.height===2;a(e)},t.src=bt})}function It(a){switch(typeof a=="object"&&(a=Rt(a)),a){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 Rt(a){let t=new DataView(a);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 n=t.getUint16(i,!1);if(i+=2,n==65505){if(t.getUint32(i+=2,!1)!==1165519206)return-1;let o=t.getUint16(i+=6,!1)==18761;i+=t.getUint32(i+4,o);let r=t.getUint16(i,o);i+=2;for(let s=0;s<r;s++)if(t.getUint16(i+s*12,o)==274)return t.getUint16(i+s*12+8,o)}else{if((n&65280)!==65280)break;i+=t.getUint16(i,!1)}}return-1}var ve=class{constructor(){this.autoRotateSupported=vt()}loadImageFile(t,e){return h(this,null,function*(){let i=yield t.arrayBuffer();return e.checkImageType?yield this.checkImageTypeAndLoadImageFromArrayBuffer(i,t.type,e):yield 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)}loadImageFromURL(t,e){return h(this,null,function*(){let n=yield(yield fetch(t)).blob(),o=yield n.arrayBuffer();return yield this.loadImageFromArrayBuffer(o,e,n.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,n=new Uint8Array(i);for(let o=0;o<i;o++)n[o]=e.charCodeAt(o);return n.buffer}loadImageFromArrayBuffer(t,e,i){return h(this,null,function*(){let n=yield new Promise((o,r)=>h(this,null,function*(){try{let s=new Blob([t],i?{type:i}:void 0),c=URL.createObjectURL(s),d=new Image,y=i==="image/svg+xml"?yield this.getSvgImageSize(s):void 0;d.onload=()=>o({originalImage:d,originalImageSize:y,originalObjectUrl:c,originalArrayBuffer:t}),d.onerror=r,d.src=c}catch(s){r(s)}}));return yield this.transformImageFromArrayBuffer(n,e,n.originalImageSize!=null)})}getSvgImageSize(t){return h(this,null,function*(){let n=new DOMParser().parseFromString(yield t.text(),"image/svg+xml").querySelector("svg");if(!n)throw Error("Failed to parse SVG image");let o=n.getAttribute("width"),r=n.getAttribute("height");if(o&&r)return null;let s=n.getAttribute("viewBox")||n.getAttribute("viewbox");if(s){let c=s.split(" ");return{width:+c[2],height:+c[3]}}throw Error("Failed to load SVG image. SVG must have width + height or viewBox definition.")})}transformImageFromArrayBuffer(t,e,i=!1){return h(this,null,function*(){let n=yield this.autoRotateSupported,o=It(n?-1:t.originalArrayBuffer);if(!t.originalImage||!t.originalImage.complete)return Promise.reject(new Error("No image loaded"));let r={original:{objectUrl:t.originalObjectUrl,image:t.originalImage,size:t.originalImageSize??{width:t.originalImage.naturalWidth,height:t.originalImage.naturalHeight}},exifTransform:o};return this.transformLoadedImage(r,e,i)})}transformLoadedImage(t,e,i=!1){return h(this,null,function*(){let n=(e.canvasRotation??0)+t.exifTransform.rotate,o=t.original.size;if(!i&&n===0&&!t.exifTransform.flip&&!e.containWithinAspectRatio)return{original:{objectUrl:t.original.objectUrl,image:t.original.image,size:w({},o)},transformed:{objectUrl:t.original.objectUrl,image:t.original.image,size:w({},o)},exifTransform:t.exifTransform};let r=this.getTransformedSize(o,t.exifTransform,e),s=document.createElement("canvas");s.width=r.width,s.height=r.height;let c=s.getContext("2d");c?.setTransform(t.exifTransform.flip?-1:1,0,0,1,s.width/2,s.height/2),c?.rotate(Math.PI*(n/2)),c?.drawImage(t.original.image,-o.width/2,-o.height/2);let d=yield new Promise(_=>s.toBlob(_,"image/"+(e.format??"png")));if(!d)throw new Error("Failed to get Blob for transformed image.");let M=URL.createObjectURL(d),y=yield this.loadImageFromObjectUrl(M);return{original:{objectUrl:t.original.objectUrl,image:t.original.image,size:w({},o)},transformed:{objectUrl:M,image:y,size:{width:y.width,height:y.height}},exifTransform:t.exifTransform}})}loadImageFromObjectUrl(t){return new Promise((e,i)=>{let n=new Image;n.onload=()=>e(n),n.onerror=i,n.src=t})}getTransformedSize(t,e,i){let n=(i.canvasRotation??0)+e.rotate;if(i.containWithinAspectRatio)if(n%2){let o=t.width*(i.aspectRatio??1),r=t.height/(i.aspectRatio??1);return{width:Math.max(t.height,o),height:Math.max(t.width,r)}}else{let o=t.height*(i.aspectRatio??1),r=t.width/(i.aspectRatio??1);return{width:Math.max(t.width,o),height:Math.max(t.height,r)}}return n%2?{height:t.width,width:t.height}:{width:t.width,height:t.height}}};function zt(a){switch(a){case"ArrowUp":return"top";case"ArrowRight":return"right";case"ArrowDown":return"bottom";default:return"left"}}function Pt(a){switch(a){case"ArrowUp":return"bottom";case"ArrowRight":return"left";case"ArrowDown":return"top";default:return"right"}}function St(a,t){switch(a){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 rt=(()=>{class a{get alignImageStyle(){return this.state.options.alignImage}constructor(e){this.sanitizer=e,this.pinchStart$=new Ae,this.cropService=new be,this.loadImageService=new ve,this.setImageMaxSizeRetries=0,this.resizedWhileHidden=!1,this.moveTypes=b,this.state=new Me,this.safeImgDataUrl=B(void 0),this.safeTransformStyle=B(void 0),this.marginLeft="0px",this.imageVisible=!1,this.allowMoveImage=!1,this.checkImageType=!0,this.disabled=!1,this.hidden=!1,this.imageCropped=U(),this.startCropImage=U(),this.imageLoaded=U(),this.cropperReady=U(),this.loadImageFailed=U(),this.transformChange=U(),this.cropperChange=U(),this.reset()}ngOnInit(){this.state.stepSize=this.initialStepSize||this.state.stepSize}ngOnChanges(e){let i=this.state.cropper(),n=this.state.transform,o=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(s=>this.setLoadedImage(s)).catch(s=>this.loadImageError(s));return}e.cropper&&this.cropper&&this.state.cropper.set(G(this.cropper,this.state,!0));let r=!this.state.equalsCropperPosition(i);r&&(!this.cropper||!this.state.equalsCropperPosition(this.cropper))&&this.cropperChange.emit(this.state.cropper()),(r||!this.state.equalsTransform(n)||this.state.options.backgroundColor!==o)&&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(G(this.cropper,this.state,!0)),this.emitCropperPositionChange(this.cropper)):(this.state.cropper.set(G(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 n=e.shiftKey?b.Resize:b.Move,o=e.altKey?Pt(e.key):zt(e.key),r=St(e.key,this.state.stepSize);e.preventDefault(),e.stopPropagation(),this.moveStart={type:n,position:o,clientX:0,clientY:0,transform:this.state.transform,cropper:this.state.cropper()},this.handleMouseMove(r),this.handleMouseUp()}startMove(e,i,n=null){this.disabled||this.moveStart&&this.moveStart.type===b.Pinch||i===b.Drag&&!this.allowMoveImage||("preventDefault"in e&&e.preventDefault(),this.moveStart={type:i,position:n,clientX:ae(e),clientY:re(e),transform:this.state.transform,cropper:this.state.cropper()},this.initMouseMove())}initMouseMove(){pe(V(document,"mousemove"),V(document,"touchmove")).pipe(me(pe(V(document,"mouseup"),V(document,"touchend"),this.pinchStart$).pipe(Fe()))).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===b.Move)this.state.cropper.set(oe(Ct(e,this.moveStart),this.state,!0));else if(this.moveStart.type===b.Resize)!this.cropperStaticWidth&&!this.cropperStaticHeight&&this.state.cropper.set(oe(ot(e,this.moveStart,this.state),this.state,!1));else if(this.moveStart.type===b.Drag){let i=ae(e)-this.moveStart.clientX,n=re(e)-this.moveStart.clientY;this.state.transform=A(w({},this.state.transform),{translateH:(this.moveStart.transform?.translateH||0)+i,translateV:(this.moveStart.transform?.translateV||0)+n}),this.setCssTransform()}}}handleMouseUp(){!this.moveStart||this.moveStart.type===b.Pinch||((!this.state.equalsCropperPosition(this.moveStart.cropper)||this.moveStart.transform&&!this.state.equalsTransform(this.moveStart.transform))&&(this.moveStart.type===b.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:b.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(),V(document,"touchmove").pipe(me(V(document,"touchend"))).subscribe({next:e=>
1this.handlePinchMove(e),complete:()=>this.handlePinchStop()})}handlePinchMove(e){this.moveStart&&(e.preventDefault&&e.preventDefault(),this.moveStart.type===b.Pinch&&!this.cropperStaticWidth&&!this.cropperStaticHeight&&this.state.cropper.set(oe(ot(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((e,i)=>h(this,null,function*(){let n=yield this.cropService.crop(this.state.toCropInput(),"blob");n?(this.imageCropped.emit(n),e(n)):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(G(this.state.maxSizeCropperPosition(),this.state,!0)),this.cropperChange.emit(this.state.cropper())}ngOnDestroy(){this.pinchStart$.complete()}static{this.\u0275fac=function(i){return new(i||a)(He(ie))}}static{this.\u0275cmp=J({type:a,selectors:[["image-cropper"]],viewQuery:function(i,n){if(i&1&&ee(dt,7)(gt,5),i&2){let o;j(o=q())&&(n.wrapper=o.first),j(o=q())&&(n.sourceImage=o.first)}},hostVars:6,hostBindings:function(i,n){i&1&&f("resize",function(){return n.onResize()},ke),i&2&&(H("text-align",n.alignImageStyle),te("disabled",n.disabled)("ngx-ic-hidden",n.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:[Le],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,n){i&1&&(g(0,"div",1),f("touchstart",function(r){return n.startPinch(r)}),Z(1,ut,2,8,"img",2),C(2,"div",3),Z(3,xt,3,16,"div",4),u()),i&2&&(H("background",n.imageVisible&&n.state.options.backgroundColor),R(),P("ngIf",n.safeImgDataUrl()),R(),H("width",n.state.maxSize().width||0,"px")("height",n.state.maxSize().height||0,"px")("margin-left",n.state.options.alignImage==="center"?n.marginLeft:null),R(),P("ngIf",n.imageVisible))},dependencies:[Be],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 a})();var E=(function(a){return a.Prompt="PROMPT",a.Camera="CAMERA",a.Photos="PHOTOS",a})(E||{}),D=(function(a){return a.Rear="REAR",a.Front="FRONT",a})(D||{}),Ie=(function(a){return a.Uri="uri",a.Base64="base64",a.DataUrl="dataUrl",a})(Ie||{}),se=(function(a){return a[a.Photo=0]="Photo",a[a.Video=1]="Video",a})(se||{}),X=(function(a){return a[a.Photo=0]="Photo",a[a.Video=1]="Video",a[a.All=2]="All",a})(X||{});var Y=class extends Je{takePhoto(t){return h(this,null,function*(){return new Promise((e,i)=>h(this,null,function*(){t.webUseInput?this.takePhotoCameraInputExperience(t,e,i):this.takePhotoCameraExperience(t,e,i)}))})}recordVideo(t){return h(this,null,function*(){throw this.unimplemented("recordVideo is not implemented on Web.")})}playVideo(t){return h(this,null,function*(){throw this.unimplemented("playVideo is not implemented on Web.")})}chooseFromGallery(t){return h(this,null,function*(){return new Promise((e,i)=>h(this,null,function*(){this.galleryInputExperience(t,e,i)}))})}editPhoto(t){return h(this,null,function*(){throw this.unimplemented("editPhoto is not implemented on Web.")})}editURIPhoto(t){return h(this,null,function*(){throw this.unimplemented("editURIPhoto is not implemented on Web.")})}getPhoto(t){return h(this,null,function*(){return new Promise((e,i)=>h(this,null,function*(){if(t.webUseInput||t.source===E.Photos)this.fileInputExperience(t,e,i);else if(t.source===E.Prompt){let n=document.querySelector("pwa-action-sheet");n||(n=document.createElement("pwa-action-sheet"),document.body.appendChild(n)),n.header=t.promptLabelHeader||"Photo",n.cancelable=!1,n.options=[{title:t.promptLabelPhoto||"From Photos"},{title:t.promptLabelPicture||"Take Picture"}],n.addEventListener("onSelection",o=>h(this,null,function*(){o.detail===0?this.fileInputExperience(t,e,i):this.cameraExperience(t,e,i)}))}else this.cameraExperience(t,e,i)}))})}pickImages(t){return h(this,null,function*(){return new Promise((e,i)=>h(this,null,function*(){this.multipleFileInputExperience(e,i)}))})}cameraExperience(t,e,i){return h(this,null,function*(){yield this._setupPWACameraModal(t.direction,n=>this._getCameraPhoto(n,t),()=>this.fileInputExperience(t,e,i),e,i)})}fileInputExperience(t,e,i){let n=document.querySelector("#_capacitor-camera-input"),o=()=>{var r;(r=n.parentNode)===null||r===void 0||r.removeChild(n)};n||(n=document.createElement("input"),n.id="_capacitor-camera-input",n.type="file",n.hidden=!0,document.body.appendChild(n),n.addEventListener("change",r=>{let s=n.files[0],c="jpeg";if(s.type==="image/png"?c="png":s.type==="image/gif"&&(c="gif"),t.resultType==="dataUrl"||t.resultType==="base64"){let d=new FileReader;d.addEventListener("load",()=>{if(t.resultType==="dataUrl")e({dataUrl:d.result,format:c});else if(t.resultType==="base64"){let M=d.result.split(",")[1];e({base64String:M,format:c})}o()}),d.readAsDataURL(s)}else e({webPath:URL.createObjectURL(s),format:c}),o()}),n.addEventListener("cancel",r=>{i(new F("User cancelled photos app")),o()}
1)),n.accept="image/*",n.capture=!0,t.source===E.Photos||t.source===E.Prompt?n.removeAttribute("capture"):t.direction===D.Front?n.capture="user":t.direction===D.Rear&&(n.capture="environment"),n.click()}multipleFileInputExperience(t,e){let i=document.querySelector("#_capacitor-camera-input-multiple"),n=()=>{var o;(o=i.parentNode)===null||o===void 0||o.removeChild(i)};i||(i=document.createElement("input"),i.id="_capacitor-camera-input-multiple",i.type="file",i.hidden=!0,i.multiple=!0,document.body.appendChild(i),i.addEventListener("change",o=>{let r=[];for(let s=0;s<i.files.length;s++){let c=i.files[s],d="jpeg";c.type==="image/png"?d="png":c.type==="image/gif"&&(d="gif"),r.push({webPath:URL.createObjectURL(c),format:d})}t({photos:r}),n()}),i.addEventListener("cancel",o=>{e(new F("User cancelled photos app")),n()})),i.accept="image/*",i.click()}_getCameraPhoto(t,e){return new Promise((i,n)=>{let o=new FileReader,r=this._getFileFormat(t);e.resultType==="uri"?i({webPath:URL.createObjectURL(t),format:r,saved:!1}):(o.readAsDataURL(t),o.onloadend=()=>{let s=o.result;e.resultType==="dataUrl"?i({dataUrl:s,format:r,saved:!1}):i({base64String:s.split(",")[1],format:r,saved:!1})},o.onerror=s=>{n(s)})})}takePhotoCameraExperience(t,e,i){return h(this,null,function*(){yield this._setupPWACameraModal(t.cameraDirection,n=>{var o;return this._buildPhotoMediaResult(n,(o=t.includeMetadata)!==null&&o!==void 0?o:!1)},()=>this.takePhotoCameraInputExperience(t,e,i),e,i)})}takePhotoCameraInputExperience(t,e,i){let n=this._createFileInput("_capacitor-camera-input-takephoto"),o=()=>{var r;(r=n.parentNode)===null||r===void 0||r.removeChild(n)};n.onchange=r=>h(this,null,function*(){var s;if(!this._validateFileInput(n,i,o))return;let c=n.files[0];e(yield this._buildPhotoMediaResult(c,(s=t.includeMetadata)!==null&&s!==void 0?s:!1)),o()}),n.oncancel=()=>{i(new F("User cancelled photos app")),o()},n.accept="image/*",t.cameraDirection===D.Front?n.capture="user":n.capture="environment",n.click()}galleryInputExperience(t,e,i){var n,o;let r=this._createFileInput("_capacitor-camera-input-gallery");r.multiple=(n=t.allowMultipleSelection)!==null&&n!==void 0?n:!1;let s=()=>{var d;(d=r.parentNode)===null||d===void 0||d.removeChild(r)};r.onchange=d=>h(this,null,function*(){var M;if(!this._validateFileInput(r,i,s))return;let y=[];for(let _=0;_<r.files.length;_++){let x=r.files[_];if(x.type.startsWith("image/"))y.push(yield this._buildPhotoMediaResult(x,(M=t.includeMetadata)!==null&&M!==void 0?M:!1));else if(x.type.startsWith("video/")){let v=this._getFileFormat(x),S,T,N;try{let z=yield this._getVideoMetadata(x);S=z.thumbnail,t.includeMetadata&&(T=z.resolution,N=z.duration)}catch(z){console.warn("Failed to get video metadata:",z)}let I={type:se.Video,thumbnail:S,webPath:URL.createObjectURL(x),saved:!1};t.includeMetadata&&(I.metadata={format:v,resolution:T,size:x.size,creationDate:new Date(x.lastModified).toISOString(),duration:N}),y.push(I)}}e({results:y}),s()}),r.oncancel=()=>{i(new F("User cancelled photos app")),s()};let c=(o=t.mediaType)!==null&&o!==void 0?o:X.Photo;c===X.Photo?r.accept="image/*":c===X.Video?r.accept="video/*":r.accept="image/*,video/*",r.click()}_getFileFormat(t){return t.type==="image/png"?"png":t.type==="image/gif"?"gif":t.type.startsWith("video/")?t.type.split("/")[1]:t.type.startsWith("image/")?"jpeg":t.type.split("/")[1]||"jpeg"}_buildPhotoMediaResult(t,e){return h(this,null,function*(){let i=this._getFileFormat(t),n=yield this._getBase64FromFile(t),o={type:se.Photo,thumbnail:n,webPath:URL.createObjectURL(t),saved:!1};if(e){let r=yield this._getImageResolution(t);o.metadata={format:i,resolution:r,size:t.size,creationDate:"lastModified"in t?new Date(t.lastModified).toISOString():new Date().toISOString()}}return o})}_validateFileInput(t,e,i){if(!t.files||t.files.length===0){let n=t.multiple?"No files selected":"No file selected";return e(new F(n)),i(),!1}return!0}_setupPWACameraModal(t,e,i,n,o){return h(this,null,function*(){if(customElements.get("pwa-camera-modal")){let r=document.createElement("pwa-camera-modal");r.facingMode=t===D.Front?"user":"environment",document.body.appendChild(r);try{yield r.componentOnReady(),r.addEventListener("onPhoto",s=>h(null,null,function*(){let c=s.detail;c===null?o(new F("User cancelled photos app")):c instanceof Error?o(c):n(yield e(c)),r.dismiss(),document.body.removeChild(r)})),r.present()}catch(s){i()}}else console.error("Unable to load PWA Element 'pwa-camera-modal'. See the docs: https://capacitorjs.com/docs/web/pwa-elements."),i()})}_createFileInput(t){let e=document.querySelector(`#${t}`);return e||(e=document.createElement("input"),e.id=t,e.type="file",e.hidden=!0,document.body.appendChild(e)),e}_getImageResolution(t){return h(this,null,function*(){try{let e=yield createImageBitmap(t),i=`${e.width}x${e.height}`;return e.close(),i}catch(e){console.warn("Failed to get image resolution:",e);return}})}_getBase64FromFile(t){return new Promise((e,i)=>{let n=new FileReader;n.onloadend=()=>{let r=n.result.split(",")[1];e(r)},n.onerror=o=>{i(o)},n.readAsDataURL(t)})}_getVideoMetadata(t){return new Promise(e=>{let i=document.createElement("video");i.preload="metadata",i.muted=!0,i.onloadedmetadata=()=>{let n=Math.min(1,i.duration*.1);i.currentTime=n},i.onseeked=()=>{let n={resolution:`${i.videoWidth}x${i.videoHeight}`,duration:i.duration};try{let o=document.createElement("canvas");o.width=i.videoWidth,o.height=i.videoHeight;let r=o.getContext("2d");r&&(r.drawImage(i,0,0,o.width,o.height),n.thumbnail=o.toDataURL("image/jpeg",.8).split(",")[1])}catch(o){console.warn("Failed to generate video thumbnail:",o)}URL.revokeObjectURL(i.src),e(n)},i.onerror=()=>{URL.revokeObjectURL(i.src),e({})},i.src=URL.createObjectURL(t)})}checkPermissions(){return h(this,null,function*(){if(typeof navigator>"u"||!navigator.permissions)throw this.unavailable("Permissions API not available in this browser");try{return{camera:(yield window.navigator.permissions.query({name:"camera"})).state,photos:"granted"}}catch(t){throw this.unavailable("Camera permissions are not available in this browser")}})}requestPermissions(){return h(this,null,function*(){throw this.unimplemented("Not implemented on web.")})}pickLimitedLibraryPhotos(){return h(this,null,function*(){throw this.unavailable("Not implemented on web.")})}getLimitedLibraryPhotos(){return h(this,null,function*(){throw this.unavailable("Not implemented on web.")})}},ti=new Y;var st=Ke("Camera",{web:()=>new Y});var Ot=["fileUploader"],Ut=["form","","storagePath",""];function Tt(a,t){if(a&1&&(g(0,"div")(1,"span",6),W(2,"Image used if not customized:"),u(),C(3,"img",7),u()),a&2){let e=l(2);R(3),P("asset",e.defaultImage)}}function At(a,t){if(a&1){let e=O();g(0,"article",2)(1,"p"),W(2,"Drag 'n drop an Image"),u(),g(3,"p"),W(4,"or "),g(5,"a",5),f("click",function(){p(e);let n=l();return m(n.selectImage())}),W(6,"choose a file"),u()(),ue(7,Tt,4,1,"div"),u()}if(a&2){let e=l();R(7),fe(e.defaultImage?7:-1)}}function Vt(a,t){a&1&&(g(0,"article",2),C(1,"img",8),g(2,"h3"),W(3,"Drop your file here"),u()())}function Ft(a,t){if(a&1){let e=O();g(0,"article",3)(1,"image-cropper",9),f("imageCropped",function(n){p(e);let o=l();return m(o.imageCropped(n))}
1),u(),g(2,"div")(3,"ion-fab-button",10),f("click",function(){p(e);let n=l();return m(n.cropIt())}),C(4,"ion-icon",11),u(),g(5,"ion-fab-button",10),f("click",function(){p(e);let n=l();return m(n.step.next("drop"))}),C(6,"ion-icon",12),u()()()}if(a&2){let e=l();R(),P("imageFile",e.file)("aspectRatio",1)("containWithinAspectRatio",!1)}}function Lt(a,t){if(a&1){let e=O();g(0,"article",4),C(1,"img",13),xe(2,"async"),g(3,"div")(4,"ion-fab-button",10),f("click",function(){p(e);let n=l();return m(n.remove())}),C(5,"ion-icon",12),u()()()}if(a&2){let e=l();R(),P("src",_e(2,1,e.previewUrl$),K)}}var Oi=(()=>{class a{sanitizer=de(ie);toast=de(Xe);step=new he("drop");sub;step$=this.step.asObservable();accept=[".jpg",".jpeg",".png",".webp"];file;croppedImage;previewUrl$=new he("");defaultImage;form;storagePath;fileUploader;constructor(){Ne({checkmarkOutline:$e,closeOutline:Qe})}ngOnInit(){this.resetState(),this.form&&(this.sub=this.form.valueChanges.pipe(Ve(e=>ne(e))).subscribe(()=>this.resetState()))}ngOnDestroy(){this.sub?.unsubscribe()}onDrop(e){e?.preventDefault(),e?.dataTransfer?.files.length?this.filesSelected(e.dataTransfer.files):this.resetState()}onDragOver(e){e.preventDefault(),this.step.next("hovering")}onDragLeave(e){e.preventDefault(),this.resetState()}resetState(){if(this.form)if(this.form.value)if(ne(this.form.value))this.previewUrl$.next(this.form.value),this.step.next("show");else{let e={w:1024},i=et(this.form.value,e);this.previewUrl$.next(i),this.step.next("show")}else this.step.next("drop")}imageCropped(e){!e.objectUrl||!e.blob||(this.croppedImage=e.blob,this.previewUrl$.next(this.sanitizer.bypassSecurityTrustUrl(e.objectUrl)))}selectImage(){return h(this,null,function*(){try{let e=yield st.getPhoto({quality:100,allowEditing:!1,resultType:Ie.DataUrl});if(e.dataUrl){let i=Ht(e.dataUrl,Date.now().toString());this.filesSelected(i)}else this.toast.create({message:"Unsupported file type",duration:3e3}).then(i=>i.present()),Ze("Unsupported file type chosen"),Ce(e)}catch(e){this.fileUploader?.nativeElement.click()}})}inputChange(e){let i=e.target.files;this.filesSelected(i)}filesSelected(e){if(this.file=kt(e)?e.item(0)??void 0:e,this.file?.type?.split("/")[0]!=="image"){this.toast.create({message:"Unsupported file type",duration:3e3}).then(i=>i.present());return}this.step.next("crop"),this.fileUploader&&(this.fileUploader.nativeElement.value="")}remove(){if(!this.form?.value)return;ne(this.form.value)||nt(we(ye(),this.form.value)).catch(i=>{i.code,Ce(i)}),this.form.setValue(""),this.form.markAsDirty(),this.step.next("drop")}cropIt(){if(this.form)try{if(!this.croppedImage)throw new Error("No image cropped yet");if(!this.storagePath)throw new Error("No path defined to upload to");let e=this.croppedImage,i=`${this.storagePath}/${this.file?.name}`;it(we(ye(),i),e),this.form.setValue(i),this.form.markAsDirty(),this.step.next("show")}catch(e){console.error(e)}}static \u0275fac=function(i){return new(i||a)};static \u0275cmp=J({type:a,selectors:[["strive-image-selector","form","","storagePath",""]],viewQuery:function(i,n){if(i&1&&ee(Ot,5),i&2){let o;j(o=q())&&(n.fileUploader=o.first)}},hostBindings:function(i,n){i&1&&f("drop",function(r){return n.onDrop(r)})("dragover",function(r){return n.onDragOver(r)})("dragleave",function(r){return n.onDragLeave(r)})},inputs:{defaultImage:"defaultImage",form:"form",storagePath:"storagePath"},attrs:Ut,decls:8,vars:4,consts:[["fileUploader",""],["multiple","","hidden","","type","file",3,"change","accept"],[1,"drop-zone"],[1,"crop"],[1,"show"],[3,"click"],[1,"caption"],[3,"asset"],["asset","goal.png","alt","upload image",1,"picture-hover"],["format","webp",3,"imageCropped","imageFile","aspectRatio","containWithinAspectRatio"],["color","primary",3,"click"],["name","checkmark-outline"],["name","close-outline"],[1,"croppedImage",3,"src"]],template:function(i,n){if(i&1&&(g(0,"input",1,0),f("change",function(r){return n.inputChange(r)}),u(),g(2,"section"),ue(3,At,8,1,"article",2),xe(4,"async"),We(5,Vt,4,0,"article",2)(6,Ft,7,3,"article",3)(7,Lt,6,3,"article",4),u()),i&2){let o;P("accept",n.accept),R(3),fe((o=_e(4,2,n.step$))==="drop"?3:o==="hovering"?5:o==="crop"?6:o==="show"?7:-1)}},dependencies:[qe,tt,rt,Ge,Ye,je],styles:["section[_ngcontent-%COMP%]{width:100%;padding:24px}section[_ngcontent-%COMP%] article[_ngcontent-%COMP%]{text-align:center;border-radius:12px}section[_ngcontent-%COMP%] article[_ngcontent-%COMP%] image-cropper[_ngcontent-%COMP%]{padding:0;margin:5px;--cropper-outline-color: rgba(18, 18, 18, .4);--cropper-overlay-color: var(--ion-background-color)}section[_ngcontent-%COMP%] article.drop-zone[_ngcontent-%COMP%]{border:2px dashed var(--ion-color-primary);padding:16px}section[_ngcontent-%COMP%] article.drop-zone[_ngcontent-%COMP%] div[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;margin-bottom:1em}section[_ngcontent-%COMP%] article.drop-zone[_ngcontent-%COMP%] div[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100px}section[_ngcontent-%COMP%] .crop[_ngcontent-%COMP%] div[_ngcontent-%COMP%], section[_ngcontent-%COMP%] .show[_ngcontent-%COMP%] div[_ngcontent-%COMP%]{display:flex;justify-content:space-evenly;align-items:center}image-cropper[_ngcontent-%COMP%]{height:200px}.croppedImage[_ngcontent-%COMP%]{margin:auto auto 16px;max-height:200px;
1max-width:200px;width:100%;aspect-ratio:1/1;object-fit:cover;border-radius:12px}.caption[_ngcontent-%COMP%]{font-size:small;opacity:50%}"],changeDetection:0})}return a})();function kt(a){return a.item!==void 0}function Ht(a,t){let e=a.split(","),i=e[0].match(/:(.*?);/)?.[1],n=atob(e[1]),o=n.length,r=new Uint8Array(o);for(;o--;)r[o]=n.charCodeAt(o);return new File([r],t,{type:i})}export{Oi as a};
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.