import{aJ as a,ao as t,bU as f,L as j,t as w,hL as b,c4 as E,f3 as P,aF as D,f4 as x,m as I}from"./app-k0jcl5PQ.js";import{u as U}from"./Bg9cG42T.chunk.js";const v="shared.imageCropper";S.defaultProps={submitVariant:"dark"};function S(e){const{dataUrl:n,minHeight:p,minWidth:m,submitVariant:o,onCrop:u,onCancel:d,onCropStart:r,onCropEnd:g}=e,s=a.useRef(null),l={viewMode:1,autoCropArea:1,cropstart:r,cropend:g},h=()=>w.throw(new b),{crop:i,showSpinner:c,imageLoaded:C}=U(s,n,u,m,p,l,h);return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"pb-3 cropper-img-padding",children:t.jsx("img",{ref:s,src:n,className:"img img-fluid"})}),t.jsxs(f,{children:[t.jsx(f.Cancel,{onClick:d}),t.jsx(f.Submit,{onClick:i,disabled:!C,showSpinner:c,text:j.getPhrase(v,"crop"),variant:o})]})]})}function H(e){var i,c;const n=E(),{getDataUrlAndResetContext:p,setImage:m}=a.useContext(P),[o,u]=a.useState(),[d,r]=a.useState(!1),[g,s]=a.useState(!1);function l(C){I(n,e.getRequest(e.imageType,C,m,e.closePopup))}function h(){d||e.closePopup()}return a.useEffect(()=>u(p()),[]),t.jsx(D,{title:"Crop Image",size:e.popupSize,closePopup:h,onEntered:()=>s(!0),children:g&&o&&t.jsx(S,{dataUrl:o,minWidth:((i=e.overrideDimensions)==null?void 0:i.width)??x[e.imageType].width,minHeight:((c=e.overrideDimensions)==null?void 0:c.height)??x[e.imageType].height,onCrop:l,onCancel:e.closePopup,submitVariant:e.submitVariant,onCropStart:()=>r(!0),onCropEnd:()=>r(!1)})})}export{H as ImageUploadView};
//# sourceMappingURL=C4HcAt58.chunk.js.map
