import{a as De}from"./chunk-FH4KR5HL.js";import{a as He}from"./chunk-F6KLNSUK.js";import{Db as Fe,nb as Z}from"./chunk-YSQLW2JA.js";import{Ja as ke,Ka as Be}from"./chunk-NVJ2ZZFT.js";import{Aa as c,Ab as re,B as ie,Ba as M,Ca as $,Cb as ne,Da as we,Ea as Ae,Ja as Ie,K as ue,Ka as oe,Na as H,Nc as se,Oa as Me,Pa as D,Q as ye,Qa as N,Qf as G,Ra as ze,Sa as Re,Sd as Ee,V as be,Va as d,W as ve,_ as Q,a as y,ab as Se,b as fe,bb as Y,ca as F,dd as X,ea as V,h as b,ha as I,ic as Ce,mb as q,mg as K,pc as Te,qa as ae,wa as L,y as W,ya as T}from"./chunk-SKPDQO4E.js";var Ue=`<div class="modal-header">
  <span class="text-lg">{{title|translate}}</span>
</div>

<div class="modal-body" *ngIf="visibleComponent">
  <nz-tabset *ngIf="!isBaseProfile" [nzAnimated]="false">
    <nz-tab nzTitle="{{'IDENTITY.THUMBNAIL' | translate}}">
      <div class="pt-3">
        <armon-identity-photo-editor [identityId]="identityId"></armon-identity-photo-editor>
      </div>
    </nz-tab>
    <nz-tab nzTitle="{{'IDENTITY.PHOTO_LIST' | translate}}">
      <div class="pt-3">
        <armon-identity-photo-gallery [identityId]="identityId"></armon-identity-photo-gallery>
      </div>
    </nz-tab>
  </nz-tabset>
  <div class="pt-3" *ngIf="isBaseProfile">
    <armon-identity-photo-editor [isBaseProfile]="true"></armon-identity-photo-editor>
  </div>
</div>

<div class="modal-footer">
  <button type="button" class="btn btn-outline-primary"
    (click)="onCancelClicked($event)">{{'BUTTON.CLOSE' | translate}}</button>
</div>`;var We=`.modal-title>h3{margin-top:0;margin-bottom:.5rem}.thumbnailEmpty{width:64px;height:64px;background:#ebebeb;color:#fff}.thumbnailButtons{margin-left:12px}.thumbnailButtons>div{margin:3px}.thumbnailButtons>div>button{margin:0;width:100%}.thumbnailButtons>div>label{margin:0;width:100%}.thumbnailButtons>div>label>input{display:none}.photoItem{height:200px;padding:4px;position:relative}.photoItemImage{background:#ebebeb;height:100%}.photoItemImage>img{width:100%;height:100%;object-fit:cover}.photoItemNew{height:200px;padding:4px}.photoItemNew>div{background:#ebebeb;height:100%;color:#fff}.photoItemNew:hover>div{opacity:.4;color:#0a2a5a}.photoItemNew>div>label{height:100%;width:100%;cursor:pointer}.photoItemNew>div>label>input{display:none}.photoItem:hover .photoItemButtons{display:flex}.photoItemButtons{position:absolute;top:0;height:100%;width:100%;background:#fff;opacity:.7;display:none;align-items:center;justify-content:center}.photoItemButtons cds-icon{margin:4px;cursor:pointer;color:#0a2a5a}.photoItemRemoveButton{color:#c82602!important}
`;var Le=`<div>
  <div class="row">
    <div class="col-md-4 photoItem" *ngFor="let photo of identityPhotos">
      <div class="centered photoItemImage">
        <img [src]="photo.data">
      </div>
      <div class="photoItemButtons">
        <cds-icon shape="trash" solid class="photoItemRemoveButton" size="md" (click)="onRemovePhotoClicked($event, photo.photoId)"></cds-icon>
      </div>
    </div>
    <div class="col-md-4 photoItemNew">
      <div class="centered">
        <label class="centered">
          <input type="file" (change)="onNewPhotoSelected($event)" placeholder="Upload file" accept="image/*">
          <cds-icon shape="plus" size="xxl"></cds-icon>
        </label>
      </div>
    </div>
  </div>
</div>`;var _e=`:host{min-height:40vh;max-height:60vh}:host .modal-title>h3{margin-top:0;margin-bottom:.5rem}:host .thumbnailEmpty{width:64px;height:64px;background:#ebebeb;color:#fff}:host .thumbnailButtons{margin-left:12px}:host .thumbnailButtons>div{margin:3px}:host .thumbnailButtons>div>button{margin:0;width:100%}:host .thumbnailButtons>div>label{margin:0;width:100%}:host .thumbnailButtons>div>label>input{display:none}:host .photoItem{height:200px;padding:4px;position:relative}:host .photoItemImage{background:#ebebeb;height:100%}:host .photoItemImage>img{width:100%;height:100%;object-fit:cover}:host .photoItemNew{height:200px;padding:4px}:host .photoItemNew>div{background:#ebebeb;height:100%;color:#fff}:host .photoItemNew:hover>div{opacity:.4;color:#0a2a5a}:host .photoItemNew>div>label{height:100%;width:100%;cursor:pointer}:host .photoItemNew>div>label>input{display:none}:host .photoItem:hover .photoItemButtons{display:flex}:host .photoItemButtons{position:absolute;top:0;height:100%;width:100%;background:#fff;opacity:.7;display:none;align-items:center;justify-content:center}:host .photoItemButtons cds-icon{margin:4px;cursor:pointer;color:#0a2a5a}:host .photoItemRemoveButton{color:#c82602!important}
`;var Je=function(s,e,t,i){var o=arguments.length,a=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,e,t,i);else for(var n=s.length-1;n>=0;n--)(r=s[n])&&(a=(o<3?r(a):o>3?r(e,t,a):r(e,t))||a);return o>3&&a&&Object.defineProperty(e,t,a),a},J=class{interactionService;identityService;identityId;identityPhotos=[];currentFile;constructor(e,t){this.interactionService=e,this.identityService=t}ngOnInit(){this.initializeData()}readImage(e,t){let i=e.target.files;if(i.length>0){var o=new FileReader;o!=null&&(this.currentFile=i[0],o.onload=t.bind(this),o.readAsDataURL(i[0]))}}loadImage(e,t){this.loadImageFromBase64(e.target.result,t)}loadImageFromBase64(e,t){var i=new Image;i.src=e,i.onload=t.bind(this,i)}onNewPhotoSelected(e){this.readImage(e,this.loadProfileImage)}onRemovePhotoClicked(e,t){this.interactionService.showDialog("","IDENTITY.CONFIRM_REMOVE_PROFILE_PHOTO",null,null,!0,"BUTTON.YES","BUTTON.NO",!1,()=>{this.identityService.deleteIdentityProfilePhoto(this.identityId,t).subscribe(()=>{Ce(this.identityPhotos,"photoId",t)})})}initializeData(){this.listProfilePhotos()}loadProfileImage(e){this.loadImage(e,this.createIdentityProfilePhoto)}createIdentityProfilePhoto(e){var t=document.createElement("canvas");if(t.id="tempCanvas",t.width=Number(e.width),t.height=Number(e.height),t.getContext){var i=t.getContext("2d");i.drawImage(e,0,0,t.width,t.height);let o=e.src.substring(5,e.src.indexOf(";base64")),a=t.toDataURL();a&&(t.toBlob?t.toBlob(r=>{this.saveIdentityProfilePhoto(r,a)},o):this.currentFile&&this.saveIdentityProfilePhoto(this.currentFile,a))}}saveIdentityProfilePhoto(e,t){this.identityService.addIdentityProfilePhoto(this.identityId,e).subscribe(i=>{let o=new ke;o.photoId=i.PhotoId,o.data=t,this.identityPhotos.push(o)})}listProfilePhotos(){this.identityService.listIdentityProfilePhotos(this.identityId).subscribe(e=>{e.items.forEach(t=>{this.identityService.getIdentityProfilePhoto(this.identityId,t.id).subscribe(i=>{i.data="data:image/"+t.imageType+";base64,"+i.data,this.identityPhotos.push(i)})})})}static ctorParameters=()=>[{type:G},{type:Z}];static propDecorators={identityId:[{type:c}]}};J=Je([T({selector:"armon-identity-photo-gallery",template:Le,standalone:!0,imports:[Se,K],styles:[_e]})],J);var Oe=`<div class="editor-container">
  <input #photoEditorFileInput type="file" style="display:none" (change)="fileChangeEvent($event)" accept="image/*" />
  <div class="actions-container">
    <span class="mb-3">{{'BUTTON.PREVIEW'|translate}}</span>
    <armon-identity-photo [showData]="edited || (croppedImage && croppedImage!=''?true:false)"
      [identityData]="croppedImage" [identityId]="identityId" [size]="'xxl'"
      [isBaseProfile]="isBaseProfile"></armon-identity-photo>
    <button class="btn btn-danger btn-sm"
      (click)="onRemoveThumbnailClicked($event)">{{'BUTTON.REMOVE'|translate}}</button>
    <button class="btn btn-primary btn-sm" (click)="onSaveThumbnailClicked($event)"
      [disabled]="!edited">{{'BUTTON.SAVE'|translate}}</button>
  </div>
  <div class="preview-container">
    <button class="btn btn-primary btn-sm" (click)="uploadFileClicked($event)">
      <cds-icon shape="image" class="me-2"></cds-icon>{{'BUTTON.UPLOAD_IMAGE'|translate}}</button>
    <image-cropper [imageChangedEvent]="imageChangedEvent" [maintainAspectRatio]="true" [aspectRatio]="1/1"
      [resizeToWidth]="128" roundCropper="true" (imageCropped)="imageCropped($event)" (imageLoaded)="imageLoaded()"
      (loadImageFailed)="imageLoadFailed()" [style.display]="cropperReady ? null : 'none'"></image-cropper>
  </div>
</div>`;var je=`.justify-content-center{-webkit-box-pack:center;-moz-box-pack:center;-webkit-flex-pack:center;-ms-flex-pack:center;-moz-justify-content:center;-webkit-justify-content:center;justify-content:center}.justify-content-flex-end{-webkit-box-pack:end;-moz-box-pack:end;-webkit-flex-pack:end;-ms-flex-pack:end;-moz-justify-content:flex-end;-webkit-justify-content:flex-end;justify-content:flex-end}.card-footer{padding:.28rem .7rem}.alert{font-size:.756rem}@media screen and (min-width: 992px){.modal-xxl{max-width:1640px}}@media screen and (min-width: 1200px){.modal-xxxl{max-width:1860px}}.modal-fs{max-width:none;position:absolute;margin:auto;inset:16px;height:100vh;display:flex}.btn-link{text-decoration:none}.btn-link:hover{text-decoration:underline}.invalid-feedback{margin-top:0!important;font-size:.672rem!important}:host .editor-container{display:-webkit-box;display:-moz-box;display:-webkit-flexbox;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-orient:horizontal;-moz-box-orient:horizontal;-webkit-flex-direction:row;-moz-flex-direction:row;-ms-flex-direction:row;flex-direction:row;padding:3px}@media screen and (max-width: 768px){:host .editor-container{-webkit-box-orient:vertical;-moz-box-orient:vertical;-webkit-flex-direction:column;-moz-flex-direction:column;-ms-flex-direction:column;flex-direction:column}}:host .editor-container .actions-container{margin-right:6px;margin-bottom:0;padding:12px;box-shadow:0 0 4px #ccc;display:-webkit-box;display:-moz-box;display:-webkit-flexbox;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-moz-box-orient:vertical;-webkit-flex-direction:column;-moz-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:start;-moz-box-pack:start;-webkit-flex-pack:start;-ms-flex-pack:start;-moz-justify-content:flex-start;-webkit-justify-content:flex-start;justify-content:flex-start;-webkit-border-radius:.375rem;-moz-border-radius:.375rem;border-radius:.375rem}@media screen and (max-width: 768px){:host .editor-container .actions-container{-webkit-box-orient:horizontal;-moz-box-orient:horizontal;-webkit-flex-direction:row;-moz-flex-direction:row;-ms-flex-direction:row;flex-direction:row;margin-right:0;margin-bottom:6px;-webkit-box-align:center;-ms-flex-align:center;-webkit-align-items:center;-moz-align-items:center;align-items:center}}:host .editor-container .actions-container button{margin:6px!important}:host .editor-container .actions-container button:last-child{margin-top:auto}:host .editor-container .actions-container span{text-align:center}@media screen and (max-width: 768px){:host .editor-container .actions-container span{display:none}}:host .editor-container .preview-container{padding:6px;box-shadow:0 0 4px #ccc;min-height:40vh;max-height:60vh;-webkit-flex-grow:1;-webkit-box-flex:1;-moz-flex-grow:1;-ms-flex-positive:1;flex-grow:1;display:-webkit-box;display:-moz-box;display:-webkit-flexbox;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-moz-box-orient:vertical;-webkit-flex-direction:column;-moz-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:center;-moz-box-pack:center;-webkit-flex-pack:center;-ms-flex-pack:center;-moz-justify-content:center;-webkit-justify-content:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;-webkit-align-items:center;-moz-align-items:center;align-items:center;-webkit-border-radius:.375rem;-moz-border-radius:.375rem;border-radius:.375rem}:host .editor-container .preview-container button{margin:0!important}
`;var ce=class{constructor(){this.format="png",this.output="blob",this.maintainAspectRatio=!0,this.transform={},this.aspectRatio=1,this.resetCropOnAspectRatioChange=!0,this.resizeToWidth=0,this.resizeToHeight=0,this.cropperMinWidth=0,this.cropperMinHeight=0,this.cropperMaxHeight=0,this.cropperMaxWidth=0,this.cropperStaticWidth=0,this.cropperStaticHeight=0,this.canvasRotation=0,this.initialStepSize=3,this.roundCropper=!1,this.onlyScaleDown=!1,this.imageQuality=92,this.autoCrop=!0,this.backgroundColor=null,this.containWithinAspectRatio=!1,this.hideResizeSquares=!1,this.alignImage="center",this.cropperFrameAriaLabel="Crop photo",this.cropperScaledMinWidth=20,this.cropperScaledMinHeight=20,this.cropperScaledMaxWidth=20,this.cropperScaledMaxHeight=20,this.stepSize=this.initialStepSize}setOptions(e){Object.keys(e).filter(t=>t in this).forEach(t=>this[t]=e[t]),this.validateOptions()}setOptionsFromChanges(e){Object.keys(e).filter(t=>t in this).forEach(t=>this[t]=e[t].currentValue),this.validateOptions()}validateOptions(){if(this.maintainAspectRatio&&!this.aspectRatio)throw new Error("`aspectRatio` should > 0 when `maintainAspectRatio` is enabled")}},g;(function(s){s.Drag="drag",s.Move="move",s.Resize="resize",s.Pinch="pinch"})(g||(g={}));function tt(s){switch(s){case"ArrowUp":return"top";case"ArrowRight":return"right";case"ArrowDown":return"bottom";case"ArrowLeft":default:return"left"}}function it(s){switch(s){case"ArrowUp":return"bottom";case"ArrowRight":return"left";case"ArrowDown":return"top";case"ArrowLeft":default:return"right"}}function at(s,e){switch(s){case"ArrowUp":return{clientX:0,clientY:e*-1};case"ArrowRight":return{clientX:e,clientY:0};case"ArrowDown":return{clientX:0,clientY:e};case"ArrowLeft":default:return{clientX:e*-1,clientY:0}}}function ot(s,e,t){let i=s.width,o=s.height;e=Math.round(e),t=Math.round(t);let a=i/e,r=o/t,n=Math.ceil(a/2),p=Math.ceil(r/2),h=s.getContext("2d");if(h){let l=h.getImageData(0,0,i,o),f=h.createImageData(e,t),u=l.data,E=f.data;for(let C=0;C<t;C++)for(let x=0;x<e;x++){let m=(x+C*e)*4,U=C*r,A=0,_=0,he=0,pe=0,le=0,de=0,me=0,$e=Math.floor(x*a),Ne=Math.floor(C*r),ee=Math.ceil((x+1)*a),te=Math.ceil((C+1)*r);ee=Math.min(ee,i),te=Math.min(te,o);for(let O=Ne;O<te;O++){let ge=Math.abs(U-O)/p,Ye=x*a,qe=ge*ge;for(let j=$e;j<ee;j++){let xe=Math.abs(Ye-j)/n,k=Math.sqrt(qe+xe*xe);if(k>=1)continue;A=2*k*k*k-3*k*k+1;let B=4*(j+O*i);me+=A*u[B+3],he+=A,u[B+3]<255&&(A=A*u[B+3]/250),pe+=A*u[B],le+=A*u[B+1],de+=A*u[B+2],_+=A}}E[m]=pe/_,E[m+1]=le/_,E[m+2]=de/_,E[m+3]=me/he}s.width=e,s.height=t,h.putImageData(f,0,0)}}function Qe(s,e){return s/100*e}var z=class{crop(e,t,i,o,a){let r=this.getImagePosition(e,t,i,a),n=r.x2-r.x1,p=r.y2-r.y1,h=document.createElement("canvas");h.width=n,h.height=p;let l=h.getContext("2d");if(!l)return null;i.backgroundColor!=null&&(l.fillStyle=i.backgroundColor,l.fillRect(0,0,n,p));let f=(i.transform.scale||1)*(i.transform.flipH?-1:1),u=(i.transform.scale||1)*(i.transform.flipV?-1:1),{translateH:E,translateV:C}=this.getCanvasTranslate(e,i,a),x=e.transformed;l.setTransform(f,0,0,u,x.size.width/2+E,x.size.height/2+C),l.translate(-r.x1/f,-r.y1/u),l.rotate((i.transform.rotate||0)*Math.PI/180),l.drawImage(x.image,-x.size.width/2,-x.size.height/2);let m={width:n,height:p,imagePosition:r,cropperPosition:y({},t)};i.containWithinAspectRatio&&(m.offsetImagePosition=this.getOffsetImagePosition(e,t,i,a));let U=this.getResizeRatio(n,p,i);return U!==1&&(m.width=Math.round(n*U),m.height=i.maintainAspectRatio?Math.round(m.width/i.aspectRatio):Math.round(p*U),ot(h,m.width,m.height)),o==="blob"?this.cropToBlob(m,h,i):(m.base64=h.toDataURL("image/"+i.format,this.getQuality(i)),m)}cropToBlob(e,t,i){return b(this,null,function*(){return e.blob=yield new Promise(o=>t.toBlob(o,"image/"+i.format,this.getQuality(i))),e.blob&&(e.objectUrl=URL.createObjectURL(e.blob)),e})}getCanvasTranslate(e,t,i){if(t.transform.translateUnit==="px"){let o=this.getRatio(e,i);return{translateH:(t.transform.translateH||0)*o,translateV:(t.transform.translateV||0)*o}}else return{translateH:t.transform.translateH?Qe(t.transform.translateH,e.transformed.size.width):0,translateV:t.transform.translateV?Qe(t.transform.translateV,e.transformed.size.height):0}}getRatio(e,t){return e.transformed.size.width/t.width}getImagePosition(e,t,i,o){let a=this.getRatio(e,o),r={x1:Math.round(t.x1*a),y1:Math.round(t.y1*a),x2:Math.round(t.x2*a),y2:Math.round(t.y2*a)};return i.containWithinAspectRatio||(r.x1=Math.max(r.x1,0),r.y1=Math.max(r.y1,0),r.x2=Math.min(r.x2,e.transformed.size.width),r.y2=Math.min(r.y2,e.transformed.size.height)),r}getOffsetImagePosition(e,t,i,o){let a=i.canvasRotation+e.exifTransform.rotate,r=this.getRatio(e,o),n,p;a%2?(n=(e.transformed.size.width-e.original.size.height)/2,p=(e.transformed.size.height-e.original.size.width)/2):(n=(e.transformed.size.width-e.original.size.width)/2,p=(e.transformed.size.height-e.original.size.height)/2);let h={x1:Math.round(t.x1*r)-n,y1:Math.round(t.y1*r)-p,x2:Math.round(t.x2*r)-n,y2:Math.round(t.y2*r)-p};return i.containWithinAspectRatio||(h.x1=Math.max(h.x1,0),h.y1=Math.max(h.y1,0),h.x2=Math.min(h.x2,e.transformed.size.width),h.y2=Math.min(h.y2,e.transformed.size.height)),h}getResizeRatio(e,t,i){let o=i.resizeToWidth/e,a=i.resizeToHeight/t,r=new Array;i.resizeToWidth>0&&r.push(o),i.resizeToHeight>0&&r.push(a);let n=r.length===0?1:Math.min(...r);return n>1&&!i.onlyScaleDown?n:Math.min(n,1)}getQuality(e){return Math.min(1,Math.max(0,e.imageQuality/100))}};z.\u0275fac=D({minVersion:"12.0.0",version:"13.3.11",ngImport:d,type:z,deps:[],target:F.Injectable});z.\u0275prov=N({minVersion:"12.0.0",version:"13.3.11",ngImport:d,type:z,providedIn:"root"});H({minVersion:"12.0.0",version:"13.3.11",ngImport:d,type:z,decorators:[{type:V,args:[{providedIn:"root"}]}]});var R=class{resetCropperPosition(e,t,i,o){if(e?.nativeElement)if(i.cropperStaticHeight&&i.cropperStaticWidth)t.x1=0,t.x2=o.width>i.cropperStaticWidth?i.cropperStaticWidth:o.width,t.y1=0,t.y2=o.height>i.cropperStaticHeight?i.cropperStaticHeight:o.height;else{let a=Math.min(i.cropperScaledMaxWidth,o.width),r=Math.min(i.cropperScaledMaxHeight,o.height);if(!i.maintainAspectRatio)t.x1=0,t.x2=a,t.y1=0,t.y2=r;else if(o.width/i.aspectRatio<o.height){t.x1=0,t.x2=a;let n=a/i.aspectRatio;t.y1=(o.height-n)/2,t.y2=t.y1+n}else{t.y1=0,t.y2=r;let n=r*i.aspectRatio;t.x1=(o.width-n)/2,t.x2=t.x1+n}}}move(e,t,i){let o=this.getClientX(e)-t.clientX,a=this.getClientY(e)-t.clientY;i.x1=t.x1+o,i.y1=t.y1+a,i.x2=t.x2+o,i.y2=t.y2+a}resize(e,t,i,o,a){let r=this.getClientX(e)-t.clientX,n=this.getClientY(e)-t.clientY;switch(t.position){case"left":i.x1=Math.min(Math.max(t.x1+r,i.x2-a.cropperScaledMaxWidth),i.x2-a.cropperScaledMinWidth);break;case"topleft":i.x1=Math.min(Math.max(t.x1+r,i.x2-a.cropperScaledMaxWidth),i.x2-a.cropperScaledMinWidth),i.y1=Math.min(Math.max(t.y1+n,i.y2-a.cropperScaledMaxHeight),i.y2-a.cropperScaledMinHeight);break;case"top":i.y1=Math.min(Math.max(t.y1+n,i.y2-a.cropperScaledMaxHeight),i.y2-a.cropperScaledMinHeight);break;case"topright":i.x2=Math.max(Math.min(t.x2+r,i.x1+a.cropperScaledMaxWidth),i.x1+a.cropperScaledMinWidth),i.y1=Math.min(Math.max(t.y1+n,i.y2-a.cropperScaledMaxHeight),i.y2-a.cropperScaledMinHeight);break;case"right":i.x2=Math.max(Math.min(t.x2+r,i.x1+a.cropperScaledMaxWidth),i.x1+a.cropperScaledMinWidth);break;case"bottomright":i.x2=Math.max(Math.min(t.x2+r,i.x1+a.cropperScaledMaxWidth),i.x1+a.cropperScaledMinWidth),i.y2=Math.max(Math.min(t.y2+n,i.y1+a.cropperScaledMaxHeight),i.y1+a.cropperScaledMinHeight);break;case"bottom":i.y2=Math.max(Math.min(t.y2+n,i.y1+a.cropperScaledMaxHeight),i.y1+a.cropperScaledMinHeight);break;case"bottomleft":i.x1=Math.min(Math.max(t.x1+r,i.x2-a.cropperScaledMaxWidth),i.x2-a.cropperScaledMinWidth),i.y2=Math.max(Math.min(t.y2+n,i.y1+a.cropperScaledMaxHeight),i.y1+a.cropperScaledMinHeight);break;case"center":let p=e.scale,h=Math.min(Math.max(a.cropperScaledMinWidth,Math.abs(t.x2-t.x1)*p),a.cropperScaledMaxWidth),l=Math.min(Math.max(a.cropperScaledMinHeight,Math.abs(t.y2-t.y1)*p),a.cropperScaledMaxHeight);i.x1=t.clientX-h/2,i.x2=t.clientX+h/2,i.y1=t.clientY-l/2,i.y2=t.clientY+l/2,i.x1<0?(i.x2-=i.x1,i.x1=0):i.x2>o.width&&(i.x1-=i.x2-o.width,i.x2=o.width),i.y1<0?(i.y2-=i.y1,i.y1=0):i.y2>o.height&&(i.y1-=i.y2-o.height,i.y2=o.height);break}a.maintainAspectRatio&&this.checkAspectRatio(t.position,i,o,a)}checkAspectRatio(e,t,i,o){let a=0,r=0;switch(e){case"top":t.x2=t.x1+(t.y2-t.y1)*o.aspectRatio,a=Math.max(t.x2-i.width,0),r=Math.max(0-t.y1,0),(a>0||r>0)&&(t.x2-=r*o.aspectRatio>a?r*o.aspectRatio:a,t.y1+=r*o.aspectRatio>a?r:a/o.aspectRatio);break;case"bottom":t.x2=t.x1+(t.y2-t.y1)*o.aspectRatio,a=Math.max(t.x2-i.width,0),r=Math.max(t.y2-i.height,0),(a>0||r>0)&&(t.x2-=r*o.aspectRatio>a?r*o.aspectRatio:a,t.y2-=r*o.aspectRatio>a?r:a/o.aspectRatio);break;case"topleft":t.y1=t.y2-(t.x2-t.x1)/o.aspectRatio,a=Math.max(0-t.x1,0),r=Math.max(0-t.y1,0),(a>0||r>0)&&(t.x1+=r*o.aspectRatio>a?r*o.aspectRatio:a,t.y1+=r*o.aspectRatio>a?r:a/o.aspectRatio);break;case"topright":t.y1=t.y2-(t.x2-t.x1)/o.aspectRatio,a=Math.max(t.x2-i.width,0),r=Math.max(0-t.y1,0),(a>0||r>0)&&(t.x2-=r*o.aspectRatio>a?r*o.aspectRatio:a,t.y1+=r*o.aspectRatio>a?r:a/o.aspectRatio);break;case"right":case"bottomright":t.y2=t.y1+(t.x2-t.x1)/o.aspectRatio,a=Math.max(t.x2-i.width,0),r=Math.max(t.y2-i.height,0),(a>0||r>0)&&(t.x2-=r*o.aspectRatio>a?r*o.aspectRatio:a,t.y2-=r*o.aspectRatio>a?r:a/o.aspectRatio);break;case"left":case"bottomleft":t.y2=t.y1+(t.x2-t.x1)/o.aspectRatio,a=Math.max(0-t.x1,0),r=Math.max(t.y2-i.height,0),(a>0||r>0)&&(t.x1+=r*o.aspectRatio>a?r*o.aspectRatio:a,t.y2-=r*o.aspectRatio>a?r:a/o.aspectRatio);break;case"center":t.x2=t.x1+(t.y2-t.y1)*o.aspectRatio,t.y2=t.y1+(t.x2-t.x1)/o.aspectRatio;let n=Math.max(0-t.x1,0),p=Math.max(t.x2-i.width,0),h=Math.max(t.y2-i.height,0),l=Math.max(0-t.y1,0);(n>0||p>0||h>0||l>0)&&(t.x1+=h*o.aspectRatio>n?h*o.aspectRatio:n,t.x2-=l*o.aspectRatio>p?l*o.aspectRatio:p,t.y1+=l*o.aspectRatio>p?l:p/o.aspectRatio,t.y2-=h*o.aspectRatio>n?h:n/o.aspectRatio);break}}getClientX(e){return e.touches?.[0].clientX||e.clientX||0}getClientY(e){return e.touches?.[0].clientY||e.clientY||0}};R.\u0275fac=D({minVersion:"12.0.0",version:"13.3.11",ngImport:d,type:R,deps:[],target:F.Injectable});R.\u0275prov=N({minVersion:"12.0.0",version:"13.3.11",ngImport:d,type:R,providedIn:"root"});H({minVersion:"12.0.0",version:"13.3.11",ngImport:d,type:R,decorators:[{type:V,args:[{providedIn:"root"}]}]});var rt="data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==";function nt(){return new Promise(s=>{let e=new Image;e.onload=()=>{let t=e.width===1&&e.height===2;s(t)},e.src=rt})}function st(s){switch(typeof s=="object"&&(s=ct(s)),s){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 ct(s){let e=new DataView(s);if(e.getUint16(0,!1)!==65496)return-2;let t=e.byteLength,i=2;for(;i<t;){if(e.getUint16(i+2,!1)<=8)return-1;let o=e.getUint16(i,!1);if(i+=2,o==65505){if(e.getUint32(i+=2,!1)!==1165519206)return-1;let a=e.getUint16(i+=6,!1)==18761;i+=e.getUint32(i+4,a);let r=e.getUint16(i,a);i+=2;for(let n=0;n<r;n++)if(e.getUint16(i+n*12,a)==274)return e.getUint16(i+n*12+8,a)}else{if((o&65280)!==65280)break;i+=e.getUint16(i,!1)}}return-1}var S=class{constructor(){this.autoRotateSupported=nt()}loadImageFile(e,t){return b(this,null,function*(){let i=yield e.arrayBuffer();return yield this.checkImageTypeAndLoadImageFromArrayBuffer(i,e.type,t)})}checkImageTypeAndLoadImageFromArrayBuffer(e,t,i){return this.isValidImageType(t)?this.loadImageFromArrayBuffer(e,i,t):Promise.reject(new Error("Invalid image type"))}isValidImageType(e){return/image\/(png|jpg|jpeg|bmp|gif|tiff|svg|webp|x-icon|vnd.microsoft.icon)/.test(e)}loadImageFromURL(e,t){return b(this,null,function*(){let o=yield(yield fetch(e)).blob(),a=yield o.arrayBuffer();return yield this.loadImageFromArrayBuffer(a,t,o.type)})}loadBase64Image(e,t){let i=this.base64ToArrayBuffer(e);return this.loadImageFromArrayBuffer(i,t)}base64ToArrayBuffer(e){e=e.replace(/^data:([^;]+);base64,/gmi,"");let t=atob(e),i=t.length,o=new Uint8Array(i);for(let a=0;a<i;a++)o[a]=t.charCodeAt(a);return o.buffer}loadImageFromArrayBuffer(e,t,i){return b(this,null,function*(){let o=yield new Promise((a,r)=>b(this,null,function*(){try{let n=new Blob([e],i?{type:i}:void 0),p=URL.createObjectURL(n),h=new Image,f=i==="image/svg+xml"?yield this.getSvgImageSize(n):void 0;h.onload=()=>a({originalImage:h,originalImageSize:f,originalObjectUrl:p,originalArrayBuffer:e}),h.onerror=r,h.src=p}catch(n){r(n)}}));return yield this.transformImageFromArrayBuffer(o,t,o.originalImageSize!=null)})}getSvgImageSize(e){return b(this,null,function*(){let o=new DOMParser().parseFromString(yield e.text(),"image/svg+xml").querySelector("svg");if(!o)throw Error("Failed to parse SVG image");let a=o.getAttribute("width"),r=o.getAttribute("height");if(a&&r)return null;let n=o.getAttribute("viewBox")||o.getAttribute("viewbox");if(n){let p=n.split(" ");return{width:+p[2],height:+p[3]}}throw Error("Failed to load SVG image. SVG must have width + height or viewBox definition.")})}transformImageFromArrayBuffer(e,t,i=!1){return b(this,null,function*(){let o=yield this.autoRotateSupported,a=st(o?-1:e.originalArrayBuffer);if(!e.originalImage||!e.originalImage.complete)return Promise.reject(new Error("No image loaded"));let r={original:{objectUrl:e.originalObjectUrl,image:e.originalImage,size:e.originalImageSize??{width:e.originalImage.naturalWidth,height:e.originalImage.naturalHeight}},exifTransform:a};return this.transformLoadedImage(r,t,i)})}transformLoadedImage(e,t,i=!1){return b(this,null,function*(){let o=t.canvasRotation+e.exifTransform.rotate,a=e.original.size;if(!i&&o===0&&!e.exifTransform.flip&&!t.containWithinAspectRatio)return{original:{objectUrl:e.original.objectUrl,image:e.original.image,size:y({},a)},transformed:{objectUrl:e.original.objectUrl,image:e.original.image,size:y({},a)},exifTransform:e.exifTransform};let r=this.getTransformedSize(a,e.exifTransform,t),n=document.createElement("canvas");n.width=r.width,n.height=r.height;let p=n.getContext("2d");p?.setTransform(e.exifTransform.flip?-1:1,0,0,1,n.width/2,n.height/2),p?.rotate(Math.PI*(o/2)),p?.drawImage(e.original.image,-a.width/2,-a.height/2);let h=yield new Promise(u=>n.toBlob(u,t.format));if(!h)throw new Error("Failed to get Blob for transformed image.");let l=URL.createObjectURL(h),f=yield this.loadImageFromObjectUrl(l);return{original:{objectUrl:e.original.objectUrl,image:e.original.image,size:y({},a)},transformed:{objectUrl:l,image:f,size:{width:f.width,height:f.height}},exifTransform:e.exifTransform}})}loadImageFromObjectUrl(e){return new Promise((t,i)=>{let o=new Image;o.onload=()=>t(o),o.onerror=i,o.src=e})}getTransformedSize(e,t,i){let o=i.canvasRotation+t.rotate;if(i.containWithinAspectRatio)if(o%2){let a=e.width*i.aspectRatio,r=e.height/i.aspectRatio;return{width:Math.max(e.height,a),height:Math.max(e.width,r)}}else{let a=e.height*i.aspectRatio,r=e.width/i.aspectRatio;return{width:Math.max(e.width,a),height:Math.max(e.height,r)}}return o%2?{height:e.width,width:e.height}:{width:e.width,height:e.height}}};S.\u0275fac=D({minVersion:"12.0.0",version:"13.3.11",ngImport:d,type:S,deps:[],target:F.Injectable});S.\u0275prov=N({minVersion:"12.0.0",version:"13.3.11",ngImport:d,type:S,providedIn:"root"});H({minVersion:"12.0.0",version:"13.3.11",ngImport:d,type:S,decorators:[{type:V,args:[{providedIn:"root"}]}]});var v=class{constructor(e,t,i,o,a,r,n){this.cropService=e,this.cropperPositionService=t,this.loadImageService=i,this.sanitizer=o,this.cd=a,this.zone=r,this.hammerLoader=n,this.settings=new ce,this.setImageMaxSizeRetries=0,this.resizedWhileHidden=!1,this.marginLeft="0px",this.maxSize={width:0,height:0},this.moveTypes=g,this.imageVisible=!1,this.cropperFrameAriaLabel=this.settings.cropperFrameAriaLabel,this.output=this.settings.output,this.format=this.settings.format,this.transform={},this.maintainAspectRatio=this.settings.maintainAspectRatio,this.aspectRatio=this.settings.aspectRatio,this.resetCropOnAspectRatioChange=this.settings.resetCropOnAspectRatioChange,this.resizeToWidth=this.settings.resizeToWidth,this.resizeToHeight=this.settings.resizeToHeight,this.cropperMinWidth=this.settings.cropperMinWidth,this.cropperMinHeight=this.settings.cropperMinHeight,this.cropperMaxHeight=this.settings.cropperMaxHeight,this.cropperMaxWidth=this.settings.cropperMaxWidth,this.cropperStaticWidth=this.settings.cropperStaticWidth,this.cropperStaticHeight=this.settings.cropperStaticHeight,this.canvasRotation=this.settings.canvasRotation,this.initialStepSize=this.settings.initialStepSize,this.roundCropper=this.settings.roundCropper,this.onlyScaleDown=this.settings.onlyScaleDown,this.imageQuality=this.settings.imageQuality,this.autoCrop=this.settings.autoCrop,this.backgroundColor=this.settings.backgroundColor,this.containWithinAspectRatio=this.settings.containWithinAspectRatio,this.hideResizeSquares=this.settings.hideResizeSquares,this.allowMoveImage=!1,this.cropper={x1:-100,y1:-100,x2:1e4,y2:1e4},this.alignImage=this.settings.alignImage,this.disabled=!1,this.hidden=!1,this.imageCropped=new I,this.startCropImage=new I,this.imageLoaded=new I,this.cropperReady=new I,this.loadImageFailed=new I,this.transformChange=new I,this.reset()}ngOnChanges(e){this.onChangesUpdateSettings(e),this.onChangesInputImage(e),this.loadedImage?.original.image.complete&&(e.containWithinAspectRatio||e.canvasRotation)&&this.loadImageService.transformLoadedImage(this.loadedImage,this.settings).then(t=>this.setLoadedImage(t)).catch(t=>this.loadImageError(t)),(e.cropper||e.maintainAspectRatio||e.aspectRatio)&&(this.setMaxSize(),this.setCropperScaledMinSize(),this.setCropperScaledMaxSize(),this.maintainAspectRatio&&(this.resetCropOnAspectRatioChange||!this.aspectRatioIsCorrect())&&(e.maintainAspectRatio||e.aspectRatio)?this.resetCropperPosition():e.cropper&&(this.checkCropperPosition(!1),this.doAutoCrop())),e.transform&&(this.transform=this.transform||{},this.setCssTransform(),this.doAutoCrop()),e.hidden&&this.resizedWhileHidden&&!this.hidden&&setTimeout(()=>{this.onResize(),this.resizedWhileHidden=!1})}onChangesUpdateSettings(e){this.settings.setOptionsFromChanges(e),this.settings.cropperStaticHeight&&this.settings.cropperStaticWidth&&(this.hideResizeSquares=!0,this.settings.setOptions({hideResizeSquares:!0,cropperMinWidth:this.settings.cropperStaticWidth,cropperMinHeight:this.settings.cropperStaticHeight,cropperMaxHeight:this.settings.cropperStaticHeight,cropperMaxWidth:this.settings.cropperStaticWidth,maintainAspectRatio:!1}))}onChangesInputImage(e){(e.imageChangedEvent||e.imageURL||e.imageBase64||e.imageFile)&&this.reset(),e.imageChangedEvent&&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(){return this.imageChangedEvent?.target?.files?.length>0}setCssTransform(){let e=this.transform?.translateUnit||"%";this.safeTransformStyle=this.sanitizer.bypassSecurityTrustStyle(`translate(${this.transform.translateH||0}${e}, ${this.transform.translateV||0}${e}) scaleX(`+(this.transform.scale||1)*(this.transform.flipH?-1:1)+") scaleY("+(this.transform.scale||1)*(this.transform.flipV?-1:1)+") rotate("+(this.transform.rotate||0)+"deg)")}ngOnInit(){this.settings.stepSize=this.initialStepSize,this.activatePinchGesture()}reset(){this.imageVisible=!1,this.loadedImage=void 0,this.safeImgDataUrl="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=",this.moveStart={active:!1,type:null,position:null,x1:0,y1:0,x2:0,y2:0,clientX:0,clientY:0},this.maxSize={width:0,height:0},this.cropper.x1=-100,this.cropper.y1=-100,this.cropper.x2=1e4,this.cropper.y2=1e4}loadImageFile(e){this.loadImageService.loadImageFile(e,this.settings).then(t=>this.setLoadedImage(t)).catch(t=>this.loadImageError(t))}loadBase64Image(e){this.loadImageService.loadBase64Image(e,this.settings).then(t=>this.setLoadedImage(t)).catch(t=>this.loadImageError(t))}loadImageFromURL(e){this.loadImageService.loadImageFromURL(e,this.settings).then(t=>this.setLoadedImage(t)).catch(t=>this.loadImageError(t))}setLoadedImage(e){this.loadedImage=e,this.safeImgDataUrl=this.sanitizer.bypassSecurityTrustResourceUrl(e.transformed.objectUrl),this.cd.markForCheck()}loadImageError(e){console.error(e),this.loadImageFailed.emit()}imageLoadedInView(){this.loadedImage!=null&&(this.imageLoaded.emit(this.loadedImage),this.setImageMaxSizeRetries=0,setTimeout(()=>this.checkImageMaxSizeRecursively()))}checkImageMaxSizeRecursively(){this.setImageMaxSizeRetries>40?this.loadImageFailed.emit():this.sourceImageLoaded()?(this.setMaxSize(),this.setCropperScaledMinSize(),this.setCropperScaledMaxSize(),this.resetCropperPosition(),this.cropperReady.emit(y({},this.maxSize)),this.cd.markForCheck()):(this.setImageMaxSizeRetries++,setTimeout(()=>this.checkImageMaxSizeRecursively(),50))}sourceImageLoaded(){return this.sourceImage?.nativeElement?.offsetWidth>0}onResize(){if(this.loadedImage)if(this.hidden)this.resizedWhileHidden=!0;else{let e=y({},this.maxSize);this.setMaxSize(),this.resizeCropperPosition(e),this.setCropperScaledMinSize(),this.setCropperScaledMaxSize()}}activatePinchGesture(){return b(this,null,function*(){yield this.hammerLoader?.();let e=window?.Hammer||null;if(e){let t=new e(this.wrapper.nativeElement);t.get("pinch").set({enable:!0}),t.on("pinchmove",this.onPinch.bind(this)),t.on("pinchend",this.pinchStop.bind(this)),t.on("pinchstart",this.startPinch.bind(this))}else Ie()&&console.warn("[NgxImageCropper] Could not find HammerJS - Pinch Gesture won't work")})}resizeCropperPosition(e){(e.width!==this.maxSize.width||e.height!==this.maxSize.height)&&(this.cropper.x1=this.cropper.x1*this.maxSize.width/e.width,this.cropper.x2=this.cropper.x2*this.maxSize.width/e.width,this.cropper.y1=this.cropper.y1*this.maxSize.height/e.height,this.cropper.y2=this.cropper.y2*this.maxSize.height/e.height)}resetCropperPosition(){this.cropperPositionService.resetCropperPosition(this.sourceImage,this.cropper,this.settings,this.maxSize),this.doAutoCrop(),this.imageVisible=!0}keyboardAccess(e){this.changeKeyboardStepSize(e),this.keyboardMoveCropper(e)}changeKeyboardStepSize(e){let t=+e.key;t>=1&&t<=9&&(this.settings.stepSize=t)}keyboardMoveCropper(e){if(!["ArrowUp","ArrowDown","ArrowRight","ArrowLeft"].includes(e.key))return;let i=e.shiftKey?g.Resize:g.Move,o=e.altKey?it(e.key):tt(e.key),a=at(e.key,this.settings.stepSize);e.preventDefault(),e.stopPropagation(),this.startMove({clientX:0,clientY:0},i,o),this.handleMouseMove(a),this.handleMouseUp()}startMove(e,t,i=null){this.disabled||this.moveStart?.active&&this.moveStart?.type===g.Pinch||t===g.Drag&&!this.allowMoveImage||(e.preventDefault&&e.preventDefault(),this.moveStart=y({active:!0,type:t,position:i,transform:y({},this.transform),clientX:this.cropperPositionService.getClientX(e),clientY:this.cropperPositionService.getClientY(e)},this.cropper),this.initMouseMove())}initMouseMove(){ie(W(document,"mousemove"),W(document,"touchmove")).pipe(ye(ie(W(document,"mouseup"),W(document,"touchend")).pipe(ue()))).subscribe({next:e=>this.zone.run(()=>{this.handleMouseMove(e),this.cd.markForCheck()}),complete:()=>this.zone.run(()=>{this.handleMouseUp(),this.cd.markForCheck()})})}startPinch(e){this.safeImgDataUrl&&(e.preventDefault&&e.preventDefault(),this.moveStart=y({active:!0,type:g.Pinch,position:"center",clientX:this.cropper.x1+(this.cropper.x2-this.cropper.x1)/2,clientY:this.cropper.y1+(this.cropper.y2-this.cropper.y1)/2},this.cropper))}handleMouseMove(e){if(this.moveStart.active){if(e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault(),this.moveStart.type===g.Move)this.cropperPositionService.move(e,this.moveStart,this.cropper),this.checkCropperPosition(!0);else if(this.moveStart.type===g.Resize)!this.cropperStaticWidth&&!this.cropperStaticHeight&&this.cropperPositionService.resize(e,this.moveStart,this.cropper,this.maxSize,this.settings),this.checkCropperPosition(!1);else if(this.moveStart.type===g.Drag){let t=this.cropperPositionService.getClientX(e)-this.moveStart.clientX,i=this.cropperPositionService.getClientY(e)-this.moveStart.clientY;this.transform=fe(y({},this.transform),{translateH:(this.moveStart.transform?.translateH||0)+t,translateV:(this.moveStart.transform?.translateV||0)+i}),this.setCssTransform()}}}onPinch(e){this.moveStart.active&&(e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault(),this.moveStart.type===g.Pinch&&(this.cropperPositionService.resize(e,this.moveStart,this.cropper,this.maxSize,this.settings),this.checkCropperPosition(!1)),this.cd.markForCheck())}setMaxSize(){if(this.sourceImage){let e=getComputedStyle(this.sourceImage.nativeElement);this.maxSize.width=parseFloat(e.width),this.maxSize.height=parseFloat(e.height),this.marginLeft=this.sanitizer.bypassSecurityTrustStyle("calc(50% - "+this.maxSize.width/2+"px)")}}setCropperScaledMinSize(){this.loadedImage?.transformed?.image?(this.setCropperScaledMinWidth(),this.setCropperScaledMinHeight()):(this.settings.cropperScaledMinWidth=20,this.settings.cropperScaledMinHeight=20)}setCropperScaledMinWidth(){this.settings.cropperScaledMinWidth=this.cropperMinWidth>0?Math.max(20,this.cropperMinWidth/this.loadedImage.transformed.image.width*this.maxSize.width):20}setCropperScaledMinHeight(){this.maintainAspectRatio?this.settings.cropperScaledMinHeight=Math.max(20,this.settings.cropperScaledMinWidth/this.aspectRatio):this.cropperMinHeight>0?this.settings.cropperScaledMinHeight=Math.max(20,this.cropperMinHeight/this.loadedImage.transformed.image.height*this.maxSize.height):this.settings.cropperScaledMinHeight=20}setCropperScaledMaxSize(){if(this.loadedImage?.transformed?.image){let e=this.loadedImage.transformed.size.width/this.maxSize.width;this.settings.cropperScaledMaxWidth=this.cropperMaxWidth>20?this.cropperMaxWidth/e:this.maxSize.width,this.settings.cropperScaledMaxHeight=this.cropperMaxHeight>20?this.cropperMaxHeight/e:this.maxSize.height,this.maintainAspectRatio&&(this.settings.cropperScaledMaxWidth>this.settings.cropperScaledMaxHeight*this.aspectRatio?this.settings.cropperScaledMaxWidth=this.settings.cropperScaledMaxHeight*this.aspectRatio:this.settings.cropperScaledMaxWidth<this.settings.cropperScaledMaxHeight*this.aspectRatio&&(this.settings.cropperScaledMaxHeight=this.settings.cropperScaledMaxWidth/this.aspectRatio))}else this.settings.cropperScaledMaxWidth=this.maxSize.width,this.settings.cropperScaledMaxHeight=this.maxSize.height}checkCropperPosition(e=!1){this.cropper.x1<0&&(this.cropper.x2-=e?this.cropper.x1:0,this.cropper.x1=0),this.cropper.y1<0&&(this.cropper.y2-=e?this.cropper.y1:0,this.cropper.y1=0),this.cropper.x2>this.maxSize.width&&(this.cropper.x1-=e?this.cropper.x2-this.maxSize.width:0,this.cropper.x2=this.maxSize.width),this.cropper.y2>this.maxSize.height&&(this.cropper.y1-=e?this.cropper.y2-this.maxSize.height:0,this.cropper.y2=this.maxSize.height)}handleMouseUp(){this.moveStart.active&&(this.moveStart.active=!1,this.moveStart?.type===g.Drag?this.transformChange.emit(this.transform):this.doAutoCrop())}pinchStop(){this.moveStart.active&&(this.moveStart.active=!1,this.doAutoCrop())}doAutoCrop(){this.autoCrop&&this.crop()}crop(e=this.settings.output){if(this.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,t)=>this.zone.run(()=>b(this,null,function*(){let i=yield this.cropService.crop(this.loadedImage,this.cropper,this.settings,"blob",this.maxSize);i?(this.imageCropped.emit(i),e(i)):t("Crop image failed")})))}cropToBase64(){let e=this.cropService.crop(this.loadedImage,this.cropper,this.settings,"base64",this.maxSize);return e?(this.imageCropped.emit(e),e):null}aspectRatioIsCorrect(){return(this.cropper.x2-this.cropper.x1)/(this.cropper.y2-this.cropper.y1)===this.aspectRatio}};v.\u0275fac=D({minVersion:"12.0.0",version:"13.3.11",ngImport:d,type:v,deps:[{token:z},{token:R},{token:S},{token:ne},{token:oe},{token:ae},{token:re,optional:!0}],target:F.Component});v.\u0275cmp=Me({minVersion:"12.0.0",version:"13.3.11",type:v,selector:"image-cropper",inputs:{imageChangedEvent:"imageChangedEvent",imageURL:"imageURL",imageBase64:"imageBase64",imageFile:"imageFile",imageAltText:"imageAltText",cropperFrameAriaLabel:"cropperFrameAriaLabel",output:"output",format:"format",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",autoCrop:"autoCrop",backgroundColor:"backgroundColor",containWithinAspectRatio:"containWithinAspectRatio",hideResizeSquares:"hideResizeSquares",allowMoveImage:"allowMoveImage",cropper:"cropper",alignImage:"alignImage",disabled:"disabled",hidden:"hidden"},outputs:{imageCropped:"imageCropped",startCropImage:"startCropImage",imageLoaded:"imageLoaded",cropperReady:"cropperReady",loadImageFailed:"loadImageFailed",transformChange:"transformChange"},host:{listeners:{"window:resize":"onResize()"},properties:{"style.text-align":"this.alignImage","class.disabled":"this.disabled","class.ngx-ix-hidden":"this.hidden"}},viewQueries:[{propertyName:"wrapper",first:!0,predicate:["wrapper"],descendants:!0,static:!0},{propertyName:"sourceImage",first:!0,predicate:["sourceImage"],descendants:!0}],usesOnChanges:!0,ngImport:d,template:`<div
  [style.background]="imageVisible && backgroundColor"
  #wrapper
>
  <img
    #sourceImage
    class="ngx-ic-source-image"
    role="presentation"
    *ngIf="safeImgDataUrl"
    [src]="safeImgDataUrl"
    [style.visibility]="imageVisible ? 'visible' : 'hidden'"
    [style.transform]="safeTransformStyle"
    [class.ngx-ic-draggable]="!disabled && allowMoveImage"
    [attr.alt]="imageAltText"
    (load)="imageLoadedInView()"
    (mousedown)="startMove($event, moveTypes.Drag)"
    (touchstart)="startMove($event, moveTypes.Drag)"
    (error)="loadImageError($event)"
  >
  <div
    class="ngx-ic-overlay"
    [style.width.px]="maxSize.width"
    [style.height.px]="maxSize.height"
    [style.margin-left]="alignImage === 'center' ? marginLeft : null"
  ></div>
  <div class="ngx-ic-cropper"
       *ngIf="imageVisible"
       [class.ngx-ic-round]="roundCropper"
       [attr.aria-label]="cropperFrameAriaLabel"
       [style.top.px]="cropper.y1"
       [style.left.px]="cropper.x1"
       [style.width.px]="cropper.x2 - cropper.x1"
       [style.height.px]="cropper.y2 - cropper.y1"
       [style.margin-left]="alignImage === 'center' ? marginLeft : null"
       [style.visibility]="imageVisible ? 'visible' : 'hidden'"
       (keydown)="keyboardAccess($event)"
       tabindex="0"
  >
    <div
      (mousedown)="startMove($event, moveTypes.Move)"
      (touchstart)="startMove($event, moveTypes.Move)"
      class="ngx-ic-move"
      role="presentation">
    </div>
    <ng-container *ngIf="!hideResizeSquares">
            <span class="ngx-ic-resize ngx-ic-topleft"
                  role="presentation"
                  (mousedown)="startMove($event, moveTypes.Resize, 'topleft')"
                  (touchstart)="startMove($event, moveTypes.Resize, 'topleft')">
                <span class="ngx-ic-square"></span>
            </span>
      <span class="ngx-ic-resize ngx-ic-top">
                <span class="ngx-ic-square"></span>
            </span>
      <span class="ngx-ic-resize ngx-ic-topright"
            role="presentation"
            (mousedown)="startMove($event, moveTypes.Resize, 'topright')"
            (touchstart)="startMove($event, moveTypes.Resize, 'topright')">
                <span class="ngx-ic-square"></span>
            </span>
      <span class="ngx-ic-resize ngx-ic-right">
                <span class="ngx-ic-square"></span>
            </span>
      <span class="ngx-ic-resize ngx-ic-bottomright"
            role="presentation"
            (mousedown)="startMove($event, moveTypes.Resize, 'bottomright')"
            (touchstart)="startMove($event, moveTypes.Resize, 'bottomright')">
                <span class="ngx-ic-square"></span>
            </span>
      <span class="ngx-ic-resize ngx-ic-bottom">
                <span class="ngx-ic-square"></span>
            </span>
      <span class="ngx-ic-resize ngx-ic-bottomleft"
            role="presentation"
            (mousedown)="startMove($event, moveTypes.Resize, 'bottomleft')"
            (touchstart)="startMove($event, moveTypes.Resize, 'bottomleft')">
                <span class="ngx-ic-square"></span>
            </span>
      <span class="ngx-ic-resize ngx-ic-left">
                <span class="ngx-ic-square"></span>
            </span>
      <span class="ngx-ic-resize-bar ngx-ic-top"
            role="presentation"
            (mousedown)="startMove($event, moveTypes.Resize, 'top')"
            (touchstart)="startMove($event, moveTypes.Resize, 'top')">
            </span>
      <span class="ngx-ic-resize-bar ngx-ic-right"
            role="presentation"
            (mousedown)="startMove($event, moveTypes.Resize, 'right')"
            (touchstart)="startMove($event, moveTypes.Resize, 'right')">
            </span>
      <span class="ngx-ic-resize-bar ngx-ic-bottom"
            role="presentation"
            (mousedown)="startMove($event, moveTypes.Resize, 'bottom')"
            (touchstart)="startMove($event, moveTypes.Resize, 'bottom')">
            </span>
      <span class="ngx-ic-resize-bar ngx-ic-left"
            role="presentation"
            (mousedown)="startMove($event, moveTypes.Resize, 'left')"
            (touchstart)="startMove($event, moveTypes.Resize, 'left')">
            </span>
    </ng-container>
  </div>
</div>
`,styles:[`:host{display:flex;position:relative;width:100%;max-width:100%;max-height:100%;overflow:hidden;padding:5px;text-align:center}:host>div{width:100%;position:relative}:host>div img.ngx-ic-source-image{max-width:100%;max-height:100%;transform-origin:center}:host>div img.ngx-ic-source-image.ngx-ic-draggable{user-drag:none;-webkit-user-drag:none;user-select:none;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;cursor:grab}:host .ngx-ic-overlay{position:absolute;pointer-events:none;touch-action:none;outline:var(--cropper-overlay-color, white) solid 100vw;top:0;left:0}:host .ngx-ic-cropper{position:absolute;display:flex;color:#53535c;background:transparent;outline:rgba(255,255,255,.3) solid 100vw;outline:var(--cropper-outline-color, rgba(255, 255, 255, .3)) solid 100vw;touch-action:none}@media (orientation: portrait){:host .ngx-ic-cropper{outline-width:100vh}}:host .ngx-ic-cropper:after{position:absolute;content:"";inset:0;pointer-events:none;border:dashed 1px;opacity:.75;color:inherit;z-index:1}:host .ngx-ic-cropper .ngx-ic-move{width:100%;cursor:move;border:1px solid rgba(255,255,255,.5)}:host .ngx-ic-cropper:focus .ngx-ic-move{border-color:#1e90ff;border-width:2px}:host .ngx-ic-cropper .ngx-ic-resize{position:absolute;display:inline-block;line-height:6px;padding:8px;opacity:.85;z-index:1}:host .ngx-ic-cropper .ngx-ic-resize .ngx-ic-square{display:inline-block;background:#53535C;width:6px;height:6px;border:1px solid rgba(255,255,255,.5);box-sizing:content-box}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-topleft{top:-12px;left:-12px;cursor:nwse-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-top{top:-12px;left:calc(50% - 12px);cursor:ns-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-topright{top:-12px;right:-12px;cursor:nesw-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-right{top:calc(50% - 12px);right:-12px;cursor:ew-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-bottomright{bottom:-12px;right:-12px;cursor:nwse-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-bottom{bottom:-12px;left:calc(50% - 12px);cursor:ns-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-bottomleft{bottom:-12px;left:-12px;cursor:nesw-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-left{top:calc(50% - 12px);left:-12px;cursor:ew-resize}:host .ngx-ic-cropper .ngx-ic-resize-bar{position:absolute;z-index:1}:host .ngx-ic-cropper .ngx-ic-resize-bar.ngx-ic-top{top:-11px;left:11px;width:calc(100% - 22px);height:22px;cursor:ns-resize}:host .ngx-ic-cropper .ngx-ic-resize-bar.ngx-ic-right{top:11px;right:-11px;height:calc(100% - 22px);width:22px;cursor:ew-resize}:host .ngx-ic-cropper .ngx-ic-resize-bar.ngx-ic-bottom{bottom:-11px;left:11px;width:calc(100% - 22px);height:22px;cursor:ns-resize}:host .ngx-ic-cropper .ngx-ic-resize-bar.ngx-ic-left{top:11px;left:-11px;height:calc(100% - 22px);width:22px;cursor:ew-resize}:host .ngx-ic-cropper.ngx-ic-round{outline-color:transparent}:host .ngx-ic-cropper.ngx-ic-round:after{border-radius:100%;box-shadow:0 0 0 100vw #ffffff4d;box-shadow:0 0 0 100vw var(--cropper-outline-color, rgba(255, 255, 255, .3))}@media (orientation: portrait){:host .ngx-ic-cropper.ngx-ic-round:after{box-shadow:0 0 0 100vh #ffffff4d;box-shadow:0 0 0 100vh var(--cropper-outline-color, rgba(255, 255, 255, .3))}}:host .ngx-ic-cropper.ngx-ic-round .ngx-ic-move{border-radius:100%}:host.disabled .ngx-ic-cropper .ngx-ic-resize,:host.disabled .ngx-ic-cropper .ngx-ic-resize-bar,:host.disabled .ngx-ic-cropper .ngx-ic-move{display:none}:host.ngx-ix-hidden{display:none}
`],directives:[{type:Y,selector:"[ngIf]",inputs:["ngIf","ngIfThen","ngIfElse"]}],changeDetection:Q.OnPush});H({minVersion:"12.0.0",version:"13.3.11",ngImport:d,type:v,decorators:[{type:T,args:[{selector:"image-cropper",changeDetection:Q.OnPush,template:`<div
  [style.background]="imageVisible && backgroundColor"
  #wrapper
>
  <img
    #sourceImage
    class="ngx-ic-source-image"
    role="presentation"
    *ngIf="safeImgDataUrl"
    [src]="safeImgDataUrl"
    [style.visibility]="imageVisible ? 'visible' : 'hidden'"
    [style.transform]="safeTransformStyle"
    [class.ngx-ic-draggable]="!disabled && allowMoveImage"
    [attr.alt]="imageAltText"
    (load)="imageLoadedInView()"
    (mousedown)="startMove($event, moveTypes.Drag)"
    (touchstart)="startMove($event, moveTypes.Drag)"
    (error)="loadImageError($event)"
  >
  <div
    class="ngx-ic-overlay"
    [style.width.px]="maxSize.width"
    [style.height.px]="maxSize.height"
    [style.margin-left]="alignImage === 'center' ? marginLeft : null"
  ></div>
  <div class="ngx-ic-cropper"
       *ngIf="imageVisible"
       [class.ngx-ic-round]="roundCropper"
       [attr.aria-label]="cropperFrameAriaLabel"
       [style.top.px]="cropper.y1"
       [style.left.px]="cropper.x1"
       [style.width.px]="cropper.x2 - cropper.x1"
       [style.height.px]="cropper.y2 - cropper.y1"
       [style.margin-left]="alignImage === 'center' ? marginLeft : null"
       [style.visibility]="imageVisible ? 'visible' : 'hidden'"
       (keydown)="keyboardAccess($event)"
       tabindex="0"
  >
    <div
      (mousedown)="startMove($event, moveTypes.Move)"
      (touchstart)="startMove($event, moveTypes.Move)"
      class="ngx-ic-move"
      role="presentation">
    </div>
    <ng-container *ngIf="!hideResizeSquares">
            <span class="ngx-ic-resize ngx-ic-topleft"
                  role="presentation"
                  (mousedown)="startMove($event, moveTypes.Resize, 'topleft')"
                  (touchstart)="startMove($event, moveTypes.Resize, 'topleft')">
                <span class="ngx-ic-square"></span>
            </span>
      <span class="ngx-ic-resize ngx-ic-top">
                <span class="ngx-ic-square"></span>
            </span>
      <span class="ngx-ic-resize ngx-ic-topright"
            role="presentation"
            (mousedown)="startMove($event, moveTypes.Resize, 'topright')"
            (touchstart)="startMove($event, moveTypes.Resize, 'topright')">
                <span class="ngx-ic-square"></span>
            </span>
      <span class="ngx-ic-resize ngx-ic-right">
                <span class="ngx-ic-square"></span>
            </span>
      <span class="ngx-ic-resize ngx-ic-bottomright"
            role="presentation"
            (mousedown)="startMove($event, moveTypes.Resize, 'bottomright')"
            (touchstart)="startMove($event, moveTypes.Resize, 'bottomright')">
                <span class="ngx-ic-square"></span>
            </span>
      <span class="ngx-ic-resize ngx-ic-bottom">
                <span class="ngx-ic-square"></span>
            </span>
      <span class="ngx-ic-resize ngx-ic-bottomleft"
            role="presentation"
            (mousedown)="startMove($event, moveTypes.Resize, 'bottomleft')"
            (touchstart)="startMove($event, moveTypes.Resize, 'bottomleft')">
                <span class="ngx-ic-square"></span>
            </span>
      <span class="ngx-ic-resize ngx-ic-left">
                <span class="ngx-ic-square"></span>
            </span>
      <span class="ngx-ic-resize-bar ngx-ic-top"
            role="presentation"
            (mousedown)="startMove($event, moveTypes.Resize, 'top')"
            (touchstart)="startMove($event, moveTypes.Resize, 'top')">
            </span>
      <span class="ngx-ic-resize-bar ngx-ic-right"
            role="presentation"
            (mousedown)="startMove($event, moveTypes.Resize, 'right')"
            (touchstart)="startMove($event, moveTypes.Resize, 'right')">
            </span>
      <span class="ngx-ic-resize-bar ngx-ic-bottom"
            role="presentation"
            (mousedown)="startMove($event, moveTypes.Resize, 'bottom')"
            (touchstart)="startMove($event, moveTypes.Resize, 'bottom')">
            </span>
      <span class="ngx-ic-resize-bar ngx-ic-left"
            role="presentation"
            (mousedown)="startMove($event, moveTypes.Resize, 'left')"
            (touchstart)="startMove($event, moveTypes.Resize, 'left')">
            </span>
    </ng-container>
  </div>
</div>
`,styles:[`:host{display:flex;position:relative;width:100%;max-width:100%;max-height:100%;overflow:hidden;padding:5px;text-align:center}:host>div{width:100%;position:relative}:host>div img.ngx-ic-source-image{max-width:100%;max-height:100%;transform-origin:center}:host>div img.ngx-ic-source-image.ngx-ic-draggable{user-drag:none;-webkit-user-drag:none;user-select:none;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;cursor:grab}:host .ngx-ic-overlay{position:absolute;pointer-events:none;touch-action:none;outline:var(--cropper-overlay-color, white) solid 100vw;top:0;left:0}:host .ngx-ic-cropper{position:absolute;display:flex;color:#53535c;background:transparent;outline:rgba(255,255,255,.3) solid 100vw;outline:var(--cropper-outline-color, rgba(255, 255, 255, .3)) solid 100vw;touch-action:none}@media (orientation: portrait){:host .ngx-ic-cropper{outline-width:100vh}}:host .ngx-ic-cropper:after{position:absolute;content:"";inset:0;pointer-events:none;border:dashed 1px;opacity:.75;color:inherit;z-index:1}:host .ngx-ic-cropper .ngx-ic-move{width:100%;cursor:move;border:1px solid rgba(255,255,255,.5)}:host .ngx-ic-cropper:focus .ngx-ic-move{border-color:#1e90ff;border-width:2px}:host .ngx-ic-cropper .ngx-ic-resize{position:absolute;display:inline-block;line-height:6px;padding:8px;opacity:.85;z-index:1}:host .ngx-ic-cropper .ngx-ic-resize .ngx-ic-square{display:inline-block;background:#53535C;width:6px;height:6px;border:1px solid rgba(255,255,255,.5);box-sizing:content-box}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-topleft{top:-12px;left:-12px;cursor:nwse-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-top{top:-12px;left:calc(50% - 12px);cursor:ns-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-topright{top:-12px;right:-12px;cursor:nesw-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-right{top:calc(50% - 12px);right:-12px;cursor:ew-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-bottomright{bottom:-12px;right:-12px;cursor:nwse-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-bottom{bottom:-12px;left:calc(50% - 12px);cursor:ns-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-bottomleft{bottom:-12px;left:-12px;cursor:nesw-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-left{top:calc(50% - 12px);left:-12px;cursor:ew-resize}:host .ngx-ic-cropper .ngx-ic-resize-bar{position:absolute;z-index:1}:host .ngx-ic-cropper .ngx-ic-resize-bar.ngx-ic-top{top:-11px;left:11px;width:calc(100% - 22px);height:22px;cursor:ns-resize}:host .ngx-ic-cropper .ngx-ic-resize-bar.ngx-ic-right{top:11px;right:-11px;height:calc(100% - 22px);width:22px;cursor:ew-resize}:host .ngx-ic-cropper .ngx-ic-resize-bar.ngx-ic-bottom{bottom:-11px;left:11px;width:calc(100% - 22px);height:22px;cursor:ns-resize}:host .ngx-ic-cropper .ngx-ic-resize-bar.ngx-ic-left{top:11px;left:-11px;height:calc(100% - 22px);width:22px;cursor:ew-resize}:host .ngx-ic-cropper.ngx-ic-round{outline-color:transparent}:host .ngx-ic-cropper.ngx-ic-round:after{border-radius:100%;box-shadow:0 0 0 100vw #ffffff4d;box-shadow:0 0 0 100vw var(--cropper-outline-color, rgba(255, 255, 255, .3))}@media (orientation: portrait){:host .ngx-ic-cropper.ngx-ic-round:after{box-shadow:0 0 0 100vh #ffffff4d;box-shadow:0 0 0 100vh var(--cropper-outline-color, rgba(255, 255, 255, .3))}}:host .ngx-ic-cropper.ngx-ic-round .ngx-ic-move{border-radius:100%}:host.disabled .ngx-ic-cropper .ngx-ic-resize,:host.disabled .ngx-ic-cropper .ngx-ic-resize-bar,:host.disabled .ngx-ic-cropper .ngx-ic-move{display:none}:host.ngx-ix-hidden{display:none}
`]}]}],ctorParameters:function(){return[{type:z},{type:R},{type:S},{type:ne},{type:oe},{type:ae},{type:void 0,decorators:[{type:ve},{type:be,args:[re]}]}]},propDecorators:{wrapper:[{type:L,args:["wrapper",{static:!0}]}],sourceImage:[{type:L,args:["sourceImage",{static:!1}]}],imageChangedEvent:[{type:c}],imageURL:[{type:c}],imageBase64:[{type:c}],imageFile:[{type:c}],imageAltText:[{type:c}],cropperFrameAriaLabel:[{type:c}],output:[{type:c}],format:[{type:c}],transform:[{type:c}],maintainAspectRatio:[{type:c}],aspectRatio:[{type:c}],resetCropOnAspectRatioChange:[{type:c}],resizeToWidth:[{type:c}],resizeToHeight:[{type:c}],cropperMinWidth:[{type:c}],cropperMinHeight:[{type:c}],cropperMaxHeight:[{type:c}],cropperMaxWidth:[{type:c}],cropperStaticWidth:[{type:c}],cropperStaticHeight:[{type:c}],canvasRotation:[{type:c}],initialStepSize:[{type:c}],roundCropper:[{type:c}],onlyScaleDown:[{type:c}],imageQuality:[{type:c}],autoCrop:[{type:c}],backgroundColor:[{type:c}],containWithinAspectRatio:[{type:c}],hideResizeSquares:[{type:c}],allowMoveImage:[{type:c}],cropper:[{type:c}],alignImage:[{type:$,args:["style.text-align"]},{type:c}],disabled:[{type:$,args:["class.disabled"]},{type:c}],hidden:[{type:$,args:["class.ngx-ix-hidden"]},{type:c}],imageCropped:[{type:M}],startCropImage:[{type:M}],imageLoaded:[{type:M}],cropperReady:[{type:M}],loadImageFailed:[{type:M}],transformChange:[{type:M}],onResize:[{type:we,args:["window:resize"]}]}});var w=class{};w.\u0275fac=D({minVersion:"12.0.0",version:"13.3.11",ngImport:d,type:w,deps:[],target:F.NgModule});w.\u0275mod=Re({minVersion:"12.0.0",version:"13.3.11",ngImport:d,type:w,declarations:[v],imports:[q],exports:[v]});w.\u0275inj=ze({minVersion:"12.0.0",version:"13.3.11",ngImport:d,type:w,imports:[[q]]});H({minVersion:"12.0.0",version:"13.3.11",ngImport:d,type:w,decorators:[{type:Ae,args:[{imports:[q],declarations:[v],exports:[v]}]}]});var ht=function(s,e,t,i){var o=arguments.length,a=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,e,t,i);else for(var n=s.length-1;n>=0;n--)(r=s[n])&&(a=(o<3?r(a):o>3?r(e,t,a):r(e,t))||a);return o>3&&a&&Object.defineProperty(e,t,a),a},pt=128,P=class{interactionService;identityService;identityId;isBaseProfile=!1;thumbnailSaved=new I;photoEditorFileInput;imageChangedEvent="";croppedImage="";cropperReady=!1;edited=!1;fileLoaded=!1;constructor(e,t){this.interactionService=e,this.identityService=t}ngOnInit(){}fileChangeEvent(e){this.edited=!0,this.imageChangedEvent=e}imageCropped(e){var t=new FileReader;t.readAsDataURL(e.blob),t.onload=i=>{this.croppedImage=t.result},this.edited=!0}imageLoaded(){this.cropperReady=!0}imageLoadFailed(){this.interactionService.showMessage("FILE.ERROR_LOAD",null,se.Error)}uploadFileClicked(e){this.photoEditorFileInput.nativeElement.click()}onSaveThumbnailClicked(e){this.edited&&this.saveIdentityThumbnail(this.croppedImage)}onRemoveThumbnailClicked(e){this.croppedImage=He.DATA,this.edited=!0}saveIdentityThumbnail(e){let t=new Be;if(e&&e!=""){let i=new Image;i.src=e,t.data=Te(i,pt/i.width).toDataURL()}else t.data="";this.isBaseProfile?this.identityService.upsertProfileSelfProfileThumbnail(t).subscribe(()=>{this.afterSave(e),this.interactionService.informProfilePhotoUpdated()}):this.identityService.upsertIdentityProfileThumbnail(this.identityId,t).subscribe(()=>{this.afterSave(e)})}afterSave(e){this.croppedImage=e,this.edited=!1,this.thumbnailSaved.emit(),this.interactionService.showMessage("IDENTITY.THUMBNAIL_UPDATED",null,se.Success)}static ctorParameters=()=>[{type:G},{type:Z}];static propDecorators={identityId:[{type:c}],isBaseProfile:[{type:c}],thumbnailSaved:[{type:M}],photoEditorFileInput:[{type:L,args:["photoEditorFileInput",{static:!0}]}]}};P=ht([T({selector:"armon-identity-photo-editor",template:Oe,standalone:!0,imports:[K,De,w,X],styles:[je]})],P);var lt=function(s,e,t,i){var o=arguments.length,a=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,e,t,i);else for(var n=s.length-1;n>=0;n--)(r=s[n])&&(a=(o<3?r(a):o>3?r(e,t,a):r(e,t))||a);return o>3&&a&&Object.defineProperty(e,t,a),a},Ve=class extends Ee{identityId=null;title;isBaseProfile=!1;visibleComponent=!1;constructor(){super()}onModalInitialized(){super.onModalInitialized(),this.visibleComponent=!0}onCancelClicked(e){this.cancelModal()}static ctorParameters=()=>[];static propDecorators={identityId:[{type:c}],title:[{type:c}],isBaseProfile:[{type:c}]}};Ve=lt([T({selector:"armon-identity-photo-modal",template:Ue,standalone:!0,imports:[Y,Fe,P,J,X],styles:[We]})],Ve);export{Ve as a};
