import{g as he,a as C}from"./BulkImageUpload-DGPbX05r.js";var W=function(n,r){return W=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])},W(n,r)};function ue(n,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");W(n,r);function e(){this.constructor=n}n.prototype=r===null?Object.create(r):(e.prototype=r.prototype,new e)}var d=function(){return d=Object.assign||function(r){for(var e,t=1,o=arguments.length;t<o;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},d.apply(this,arguments)};var U=!1,y,T,O,D,b,J,P,N,F,L,K,Z,I,Q,ee;function f(){if(!U){U=!0;var n=navigator.userAgent,r=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(n),e=/(Mac OS X)|(Windows)|(Linux)/.exec(n);if(Z=/\b(iPhone|iP[ao]d)/.exec(n),I=/\b(iP[ao]d)/.exec(n),L=/Android/i.exec(n),Q=/FBAN\/\w+;/i.exec(n),ee=/Mobile/i.exec(n),K=!!/Win64/.exec(n),r){y=r[1]?parseFloat(r[1]):r[5]?parseFloat(r[5]):NaN,y&&document&&document.documentMode&&(y=document.documentMode);var t=/(?:Trident\/(\d+.\d+))/.exec(n);J=t?parseFloat(t[1])+4:y,T=r[2]?parseFloat(r[2]):NaN,O=r[3]?parseFloat(r[3]):NaN,D=r[4]?parseFloat(r[4]):NaN,D?(r=/(?:Chrome\/(\d+\.\d+))/.exec(n),b=r&&r[1]?parseFloat(r[1]):NaN):b=NaN}else y=T=O=b=D=NaN;if(e){if(e[1]){var o=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(n);P=o?parseFloat(o[1].replace("_",".")):!0}else P=!1;N=!!e[2],F=!!e[3]}else P=N=F=!1}}var j={ie:function(){return f()||y},ieCompatibilityMode:function(){return f()||J>y},ie64:function(){return j.ie()&&K},firefox:function(){return f()||T},opera:function(){return f()||O},webkit:function(){return f()||D},safari:function(){return j.webkit()},chrome:function(){return f()||b},windows:function(){return f()||N},osx:function(){return f()||P},linux:function(){return f()||F},iphone:function(){return f()||Z},mobile:function(){return f()||Z||I||L||ee},nativeApp:function(){return f()||Q},android:function(){return f()||L},ipad:function(){return f()||I}},pe=j,_=!!(typeof window<"u"&&window.document&&window.document.createElement),de={canUseDOM:_,canUseWorkers:typeof Worker<"u",canUseEventListeners:_&&!!(window.addEventListener||window.attachEvent),canUseViewport:_&&!!window.screen,isInWorker:!_},le=de,te=le,oe;te.canUseDOM&&(oe=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0);/**
 * Checks if an event is supported in the current execution environment.
 *
 * NOTE: This will not work correctly for non-generic events such as `change`,
 * `reset`, `load`, `error`, and `select`.
 *
 * Borrows from Modernizr.
 *
 * @param {string} eventNameSuffix Event name, e.g. "click".
 * @param {?boolean} capture Check if the capture phase is supported.
 * @return {boolean} True if the event is supported.
 * @internal
 * @license Modernizr 3.0.0pre (Custom Build) | MIT
 */function fe(n,r){if(!te.canUseDOM||r&&!("addEventListener"in document))return!1;var e="on"+n,t=e in document;if(!t){var o=document.createElement("div");o.setAttribute(e,"return;"),t=typeof o[e]=="function"}return!t&&oe&&n==="wheel"&&(t=document.implementation.hasFeature("Events.wheel","3.0")),t}var ve=fe,me=pe,ge=ve,X=10,B=40,Y=800;function re(n){var r=0,e=0,t=0,o=0;return"detail"in n&&(e=n.detail),"wheelDelta"in n&&(e=-n.wheelDelta/120),"wheelDeltaY"in n&&(e=-n.wheelDeltaY/120),"wheelDeltaX"in n&&(r=-n.wheelDeltaX/120),"axis"in n&&n.axis===n.HORIZONTAL_AXIS&&(r=e,e=0),t=r*X,o=e*X,"deltaY"in n&&(o=n.deltaY),"deltaX"in n&&(t=n.deltaX),(t||o)&&n.deltaMode&&(n.deltaMode==1?(t*=B,o*=B):(t*=Y,o*=Y)),t&&!r&&(r=t<1?-1:1),o&&!e&&(e=o<1?-1:1),{spinX:r,spinY:e,pixelX:t,pixelY:o}}re.getEventType=function(){return me.firefox()?"DOMMouseScroll":ge("wheel")?"wheel":"mousewheel"};var we=re,Ce=we;const ye=he(Ce);function xe(n,r,e,t,o,i){i===void 0&&(i=0);var s=R(n,r,i),a=s.width,c=s.height,h=Math.min(a,e),u=Math.min(c,t);return h>u*o?{width:u*o,height:u}:{width:h,height:h/o}}function Re(n){return n.width>n.height?n.width/n.naturalWidth:n.height/n.naturalHeight}function S(n,r,e,t,o){o===void 0&&(o=0);var i=R(r.width,r.height,o),s=i.width,a=i.height;return{x:V(n.x,s,e.width,t),y:V(n.y,a,e.height,t)}}function V(n,r,e,t){var o=r*t/2-e/2;return M(n,-o,o)}function k(n,r){return Math.sqrt(Math.pow(n.y-r.y,2)+Math.pow(n.x-r.x,2))}function q(n,r){return Math.atan2(r.y-n.y,r.x-n.x)*180/Math.PI}function _e(n,r,e,t,o,i,s){i===void 0&&(i=0),s===void 0&&(s=!0);var a=s?Se:Ee,c=R(r.width,r.height,i),h=R(r.naturalWidth,r.naturalHeight,i),u={x:a(100,((c.width-e.width/o)/2-n.x/o)/c.width*100),y:a(100,((c.height-e.height/o)/2-n.y/o)/c.height*100),width:a(100,e.width/c.width*100/o),height:a(100,e.height/c.height*100/o)},p=Math.round(a(h.width,u.width*h.width/100)),l=Math.round(a(h.height,u.height*h.height/100)),w=h.width>=h.height*t,v=w?{width:Math.round(l*t),height:l}:{width:p,height:Math.round(p/t)},g=d(d({},v),{x:Math.round(a(h.width-v.width,u.x*h.width/100)),y:Math.round(a(h.height-v.height,u.y*h.height/100))});return{croppedAreaPercentages:u,croppedAreaPixels:g}}function Se(n,r){return Math.min(n,Math.max(0,r))}function Ee(n,r){return r}function De(n,r,e,t,o,i){var s=R(r.width,r.height,e),a=M(t.width/s.width*(100/n.width),o,i),c={x:a*s.width/2-t.width/2-s.width*a*(n.x/100),y:a*s.height/2-t.height/2-s.height*a*(n.y/100)};return{crop:c,zoom:a}}function be(n,r,e){var t=Re(r);return e.height>e.width?e.height/(n.height*t):e.width/(n.width*t)}function Pe(n,r,e,t,o,i){e===void 0&&(e=0);var s=R(r.naturalWidth,r.naturalHeight,e),a=M(be(n,r,t),o,i),c=t.height>t.width?t.height/n.height:t.width/n.width,h={x:((s.width-n.width)/2-n.x)*c,y:((s.height-n.height)/2-n.y)*c};return{crop:h,zoom:a}}function $(n,r){return{x:(r.x+n.x)/2,y:(r.y+n.y)/2}}function Me(n){return n*Math.PI/180}function R(n,r,e){var t=Me(e);return{width:Math.abs(Math.cos(t)*n)+Math.abs(Math.sin(t)*r),height:Math.abs(Math.sin(t)*n)+Math.abs(Math.cos(t)*r)}}function M(n,r,e){return Math.min(Math.max(n,r),e)}function E(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return n.filter(function(e){return typeof e=="string"&&e.length>0}).join(" ").trim()}var ze=`.reactEasyCrop_Container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  user-select: none;
  touch-action: none;
  cursor: move;
  display: flex;
  justify-content: center;
  align-items: center;
}

.reactEasyCrop_Image,
.reactEasyCrop_Video {
  will-change: transform; /* this improves performances and prevent painting issues on iOS Chrome */
}

.reactEasyCrop_Contain {
  max-width: 100%;
  max-height: 100%;
  margin: auto;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
}
.reactEasyCrop_Cover_Horizontal {
  width: 100%;
  height: auto;
}
.reactEasyCrop_Cover_Vertical {
  width: auto;
  height: 100%;
}

.reactEasyCrop_CropArea {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-sizing: border-box;
  box-shadow: 0 0 0 9999em;
  color: rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.reactEasyCrop_CropAreaRound {
  border-radius: 50%;
}

.reactEasyCrop_CropAreaGrid::before {
  content: ' ';
  box-sizing: border-box;
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.5);
  top: 0;
  bottom: 0;
  left: 33.33%;
  right: 33.33%;
  border-top: 0;
  border-bottom: 0;
}

.reactEasyCrop_CropAreaGrid::after {
  content: ' ';
  box-sizing: border-box;
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.5);
  top: 33.33%;
  bottom: 33.33%;
  left: 0;
  right: 0;
  border-left: 0;
  border-right: 0;
}
`,Ae=1,We=3,Oe=function(n){ue(r,n);function r(){var e=n!==null&&n.apply(this,arguments)||this;return e.imageRef=C.createRef(),e.videoRef=C.createRef(),e.containerPosition={x:0,y:0},e.containerRef=null,e.styleRef=null,e.containerRect=null,e.mediaSize={width:0,height:0,naturalWidth:0,naturalHeight:0},e.dragStartPosition={x:0,y:0},e.dragStartCrop={x:0,y:0},e.gestureZoomStart=0,e.gestureRotationStart=0,e.isTouching=!1,e.lastPinchDistance=0,e.lastPinchRotation=0,e.rafDragTimeout=null,e.rafPinchTimeout=null,e.wheelTimer=null,e.currentDoc=typeof document<"u"?document:null,e.currentWindow=typeof window<"u"?window:null,e.resizeObserver=null,e.state={cropSize:null,hasWheelJustStarted:!1,mediaObjectFit:void 0},e.initResizeObserver=function(){if(!(typeof window.ResizeObserver>"u"||!e.containerRef)){var t=!0;e.resizeObserver=new window.ResizeObserver(function(o){if(t){t=!1;return}e.computeSizes()}),e.resizeObserver.observe(e.containerRef)}},e.preventZoomSafari=function(t){return t.preventDefault()},e.cleanEvents=function(){e.currentDoc&&(e.currentDoc.removeEventListener("mousemove",e.onMouseMove),e.currentDoc.removeEventListener("mouseup",e.onDragStopped),e.currentDoc.removeEventListener("touchmove",e.onTouchMove),e.currentDoc.removeEventListener("touchend",e.onDragStopped),e.currentDoc.removeEventListener("gesturemove",e.onGestureMove),e.currentDoc.removeEventListener("gestureend",e.onGestureEnd),e.currentDoc.removeEventListener("scroll",e.onScroll))},e.clearScrollEvent=function(){e.containerRef&&e.containerRef.removeEventListener("wheel",e.onWheel),e.wheelTimer&&clearTimeout(e.wheelTimer)},e.onMediaLoad=function(){var t=e.computeSizes();t&&(e.emitCropData(),e.setInitialCrop(t)),e.props.onMediaLoaded&&e.props.onMediaLoaded(e.mediaSize)},e.setInitialCrop=function(t){if(e.props.initialCroppedAreaPercentages){var o=De(e.props.initialCroppedAreaPercentages,e.mediaSize,e.props.rotation,t,e.props.minZoom,e.props.maxZoom),i=o.crop,s=o.zoom;e.props.onCropChange(i),e.props.onZoomChange&&e.props.onZoomChange(s)}else if(e.props.initialCroppedAreaPixels){var a=Pe(e.props.initialCroppedAreaPixels,e.mediaSize,e.props.rotation,t,e.props.minZoom,e.props.maxZoom),i=a.crop,s=a.zoom;e.props.onCropChange(i),e.props.onZoomChange&&e.props.onZoomChange(s)}},e.computeSizes=function(){var t,o,i,s,a,c,h=e.imageRef.current||e.videoRef.current;if(h&&e.containerRef){e.containerRect=e.containerRef.getBoundingClientRect(),e.saveContainerPosition();var u=e.containerRect.width/e.containerRect.height,p=((t=e.imageRef.current)===null||t===void 0?void 0:t.naturalWidth)||((o=e.videoRef.current)===null||o===void 0?void 0:o.videoWidth)||0,l=((i=e.imageRef.current)===null||i===void 0?void 0:i.naturalHeight)||((s=e.videoRef.current)===null||s===void 0?void 0:s.videoHeight)||0,w=h.offsetWidth<p||h.offsetHeight<l,v=p/l,g=void 0;if(w)switch(e.state.mediaObjectFit){default:case"contain":g=u>v?{width:e.containerRect.height*v,height:e.containerRect.height}:{width:e.containerRect.width,height:e.containerRect.width/v};break;case"horizontal-cover":g={width:e.containerRect.width,height:e.containerRect.width/v};break;case"vertical-cover":g={width:e.containerRect.height*v,height:e.containerRect.height};break}else g={width:h.offsetWidth,height:h.offsetHeight};e.mediaSize=d(d({},g),{naturalWidth:p,naturalHeight:l}),e.props.setMediaSize&&e.props.setMediaSize(e.mediaSize);var m=e.props.cropSize?e.props.cropSize:xe(e.mediaSize.width,e.mediaSize.height,e.containerRect.width,e.containerRect.height,e.props.aspect,e.props.rotation);return(((a=e.state.cropSize)===null||a===void 0?void 0:a.height)!==m.height||((c=e.state.cropSize)===null||c===void 0?void 0:c.width)!==m.width)&&e.props.onCropSizeChange&&e.props.onCropSizeChange(m),e.setState({cropSize:m},e.recomputeCropPosition),e.props.setCropSize&&e.props.setCropSize(m),m}},e.saveContainerPosition=function(){if(e.containerRef){var t=e.containerRef.getBoundingClientRect();e.containerPosition={x:t.left,y:t.top}}},e.onMouseDown=function(t){e.currentDoc&&(t.preventDefault(),e.currentDoc.addEventListener("mousemove",e.onMouseMove),e.currentDoc.addEventListener("mouseup",e.onDragStopped),e.saveContainerPosition(),e.onDragStart(r.getMousePoint(t)))},e.onMouseMove=function(t){return e.onDrag(r.getMousePoint(t))},e.onScroll=function(t){e.currentDoc&&(t.preventDefault(),e.saveContainerPosition())},e.onTouchStart=function(t){e.currentDoc&&(e.isTouching=!0,!(e.props.onTouchRequest&&!e.props.onTouchRequest(t))&&(e.currentDoc.addEventListener("touchmove",e.onTouchMove,{passive:!1}),e.currentDoc.addEventListener("touchend",e.onDragStopped),e.saveContainerPosition(),t.touches.length===2?e.onPinchStart(t):t.touches.length===1&&e.onDragStart(r.getTouchPoint(t.touches[0]))))},e.onTouchMove=function(t){t.preventDefault(),t.touches.length===2?e.onPinchMove(t):t.touches.length===1&&e.onDrag(r.getTouchPoint(t.touches[0]))},e.onGestureStart=function(t){e.currentDoc&&(t.preventDefault(),e.currentDoc.addEventListener("gesturechange",e.onGestureMove),e.currentDoc.addEventListener("gestureend",e.onGestureEnd),e.gestureZoomStart=e.props.zoom,e.gestureRotationStart=e.props.rotation)},e.onGestureMove=function(t){if(t.preventDefault(),!e.isTouching){var o=r.getMousePoint(t),i=e.gestureZoomStart-1+t.scale;if(e.setNewZoom(i,o,{shouldUpdatePosition:!0}),e.props.onRotationChange){var s=e.gestureRotationStart+t.rotation;e.props.onRotationChange(s)}}},e.onGestureEnd=function(t){e.cleanEvents()},e.onDragStart=function(t){var o,i,s=t.x,a=t.y;e.dragStartPosition={x:s,y:a},e.dragStartCrop=d({},e.props.crop),(i=(o=e.props).onInteractionStart)===null||i===void 0||i.call(o)},e.onDrag=function(t){var o=t.x,i=t.y;e.currentWindow&&(e.rafDragTimeout&&e.currentWindow.cancelAnimationFrame(e.rafDragTimeout),e.rafDragTimeout=e.currentWindow.requestAnimationFrame(function(){if(e.state.cropSize&&!(o===void 0||i===void 0)){var s=o-e.dragStartPosition.x,a=i-e.dragStartPosition.y,c={x:e.dragStartCrop.x+s,y:e.dragStartCrop.y+a},h=e.props.restrictPosition?S(c,e.mediaSize,e.state.cropSize,e.props.zoom,e.props.rotation):c;e.props.onCropChange(h)}}))},e.onDragStopped=function(){var t,o;e.isTouching=!1,e.cleanEvents(),e.emitCropData(),(o=(t=e.props).onInteractionEnd)===null||o===void 0||o.call(t)},e.onWheel=function(t){if(e.currentWindow&&!(e.props.onWheelRequest&&!e.props.onWheelRequest(t))){t.preventDefault();var o=r.getMousePoint(t),i=ye(t).pixelY,s=e.props.zoom-i*e.props.zoomSpeed/200;e.setNewZoom(s,o,{shouldUpdatePosition:!0}),e.state.hasWheelJustStarted||e.setState({hasWheelJustStarted:!0},function(){var a,c;return(c=(a=e.props).onInteractionStart)===null||c===void 0?void 0:c.call(a)}),e.wheelTimer&&clearTimeout(e.wheelTimer),e.wheelTimer=e.currentWindow.setTimeout(function(){return e.setState({hasWheelJustStarted:!1},function(){var a,c;return(c=(a=e.props).onInteractionEnd)===null||c===void 0?void 0:c.call(a)})},250)}},e.getPointOnContainer=function(t,o){var i=t.x,s=t.y;if(!e.containerRect)throw new Error("The Cropper is not mounted");return{x:e.containerRect.width/2-(i-o.x),y:e.containerRect.height/2-(s-o.y)}},e.getPointOnMedia=function(t){var o=t.x,i=t.y,s=e.props,a=s.crop,c=s.zoom;return{x:(o+a.x)/c,y:(i+a.y)/c}},e.setNewZoom=function(t,o,i){var s=i===void 0?{}:i,a=s.shouldUpdatePosition,c=a===void 0?!0:a;if(!(!e.state.cropSize||!e.props.onZoomChange)){var h=M(t,e.props.minZoom,e.props.maxZoom);if(c){var u=e.getPointOnContainer(o,e.containerPosition),p=e.getPointOnMedia(u),l={x:p.x*h-u.x,y:p.y*h-u.y},w=e.props.restrictPosition?S(l,e.mediaSize,e.state.cropSize,h,e.props.rotation):l;e.props.onCropChange(w)}e.props.onZoomChange(h)}},e.getCropData=function(){if(!e.state.cropSize)return null;var t=e.props.restrictPosition?S(e.props.crop,e.mediaSize,e.state.cropSize,e.props.zoom,e.props.rotation):e.props.crop;return _e(t,e.mediaSize,e.state.cropSize,e.getAspect(),e.props.zoom,e.props.rotation,e.props.restrictPosition)},e.emitCropData=function(){var t=e.getCropData();if(t){var o=t.croppedAreaPercentages,i=t.croppedAreaPixels;e.props.onCropComplete&&e.props.onCropComplete(o,i),e.props.onCropAreaChange&&e.props.onCropAreaChange(o,i)}},e.emitCropAreaChange=function(){var t=e.getCropData();if(t){var o=t.croppedAreaPercentages,i=t.croppedAreaPixels;e.props.onCropAreaChange&&e.props.onCropAreaChange(o,i)}},e.recomputeCropPosition=function(){if(e.state.cropSize){var t=e.props.restrictPosition?S(e.props.crop,e.mediaSize,e.state.cropSize,e.props.zoom,e.props.rotation):e.props.crop;e.props.onCropChange(t),e.emitCropData()}},e}return r.prototype.componentDidMount=function(){!this.currentDoc||!this.currentWindow||(this.containerRef&&(this.containerRef.ownerDocument&&(this.currentDoc=this.containerRef.ownerDocument),this.currentDoc.defaultView&&(this.currentWindow=this.currentDoc.defaultView),this.initResizeObserver(),typeof window.ResizeObserver>"u"&&this.currentWindow.addEventListener("resize",this.computeSizes),this.props.zoomWithScroll&&this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}),this.containerRef.addEventListener("gesturestart",this.onGestureStart)),this.currentDoc.addEventListener("scroll",this.onScroll),this.props.disableAutomaticStylesInjection||(this.styleRef=this.currentDoc.createElement("style"),this.styleRef.setAttribute("type","text/css"),this.props.nonce&&this.styleRef.setAttribute("nonce",this.props.nonce),this.styleRef.innerHTML=ze,this.currentDoc.head.appendChild(this.styleRef)),this.imageRef.current&&this.imageRef.current.complete&&this.onMediaLoad(),this.props.setImageRef&&this.props.setImageRef(this.imageRef),this.props.setVideoRef&&this.props.setVideoRef(this.videoRef))},r.prototype.componentWillUnmount=function(){var e,t;!this.currentDoc||!this.currentWindow||(typeof window.ResizeObserver>"u"&&this.currentWindow.removeEventListener("resize",this.computeSizes),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),this.containerRef&&this.containerRef.removeEventListener("gesturestart",this.preventZoomSafari),this.styleRef&&((t=this.styleRef.parentNode)===null||t===void 0||t.removeChild(this.styleRef)),this.cleanEvents(),this.props.zoomWithScroll&&this.clearScrollEvent())},r.prototype.componentDidUpdate=function(e){var t,o,i,s,a,c,h,u,p;e.rotation!==this.props.rotation?(this.computeSizes(),this.recomputeCropPosition()):e.aspect!==this.props.aspect?this.computeSizes():e.objectFit!==this.props.objectFit?this.computeSizes():e.zoom!==this.props.zoom?this.recomputeCropPosition():((t=e.cropSize)===null||t===void 0?void 0:t.height)!==((o=this.props.cropSize)===null||o===void 0?void 0:o.height)||((i=e.cropSize)===null||i===void 0?void 0:i.width)!==((s=this.props.cropSize)===null||s===void 0?void 0:s.width)?this.computeSizes():(((a=e.crop)===null||a===void 0?void 0:a.x)!==((c=this.props.crop)===null||c===void 0?void 0:c.x)||((h=e.crop)===null||h===void 0?void 0:h.y)!==((u=this.props.crop)===null||u===void 0?void 0:u.y))&&this.emitCropAreaChange(),e.zoomWithScroll!==this.props.zoomWithScroll&&this.containerRef&&(this.props.zoomWithScroll?this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}):this.clearScrollEvent()),e.video!==this.props.video&&((p=this.videoRef.current)===null||p===void 0||p.load());var l=this.getObjectFit();l!==this.state.mediaObjectFit&&this.setState({mediaObjectFit:l},this.computeSizes)},r.prototype.getAspect=function(){var e=this.props,t=e.cropSize,o=e.aspect;return t?t.width/t.height:o},r.prototype.getObjectFit=function(){var e,t,o,i;if(this.props.objectFit==="cover"){var s=this.imageRef.current||this.videoRef.current;if(s&&this.containerRef){this.containerRect=this.containerRef.getBoundingClientRect();var a=this.containerRect.width/this.containerRect.height,c=((e=this.imageRef.current)===null||e===void 0?void 0:e.naturalWidth)||((t=this.videoRef.current)===null||t===void 0?void 0:t.videoWidth)||0,h=((o=this.imageRef.current)===null||o===void 0?void 0:o.naturalHeight)||((i=this.videoRef.current)===null||i===void 0?void 0:i.videoHeight)||0,u=c/h;return u<a?"horizontal-cover":"vertical-cover"}return"horizontal-cover"}return this.props.objectFit},r.prototype.onPinchStart=function(e){var t=r.getTouchPoint(e.touches[0]),o=r.getTouchPoint(e.touches[1]);this.lastPinchDistance=k(t,o),this.lastPinchRotation=q(t,o),this.onDragStart($(t,o))},r.prototype.onPinchMove=function(e){var t=this;if(!(!this.currentDoc||!this.currentWindow)){var o=r.getTouchPoint(e.touches[0]),i=r.getTouchPoint(e.touches[1]),s=$(o,i);this.onDrag(s),this.rafPinchTimeout&&this.currentWindow.cancelAnimationFrame(this.rafPinchTimeout),this.rafPinchTimeout=this.currentWindow.requestAnimationFrame(function(){var a=k(o,i),c=t.props.zoom*(a/t.lastPinchDistance);t.setNewZoom(c,s,{shouldUpdatePosition:!1}),t.lastPinchDistance=a;var h=q(o,i),u=t.props.rotation+(h-t.lastPinchRotation);t.props.onRotationChange&&t.props.onRotationChange(u),t.lastPinchRotation=h})}},r.prototype.render=function(){var e=this,t,o=this.props,i=o.image,s=o.video,a=o.mediaProps,c=o.transform,h=o.crop,u=h.x,p=h.y,l=o.rotation,w=o.zoom,v=o.cropShape,g=o.showGrid,m=o.style,ne=m.containerStyle,ie=m.cropAreaStyle,H=m.mediaStyle,z=o.classes,ae=z.containerClassName,se=z.cropAreaClassName,G=z.mediaClassName,x=(t=this.state.mediaObjectFit)!==null&&t!==void 0?t:this.getObjectFit();return C.createElement("div",{onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart,ref:function(ce){return e.containerRef=ce},"data-testid":"container",style:ne,className:E("reactEasyCrop_Container",ae)},i?C.createElement("img",d({alt:"",className:E("reactEasyCrop_Image",x==="contain"&&"reactEasyCrop_Contain",x==="horizontal-cover"&&"reactEasyCrop_Cover_Horizontal",x==="vertical-cover"&&"reactEasyCrop_Cover_Vertical",G)},a,{src:i,ref:this.imageRef,style:d(d({},H),{transform:c||"translate(".concat(u,"px, ").concat(p,"px) rotate(").concat(l,"deg) scale(").concat(w,")")}),onLoad:this.onMediaLoad})):s&&C.createElement("video",d({autoPlay:!0,playsInline:!0,loop:!0,muted:!0,className:E("reactEasyCrop_Video",x==="contain"&&"reactEasyCrop_Contain",x==="horizontal-cover"&&"reactEasyCrop_Cover_Horizontal",x==="vertical-cover"&&"reactEasyCrop_Cover_Vertical",G)},a,{ref:this.videoRef,onLoadedMetadata:this.onMediaLoad,style:d(d({},H),{transform:c||"translate(".concat(u,"px, ").concat(p,"px) rotate(").concat(l,"deg) scale(").concat(w,")")}),controls:!1}),(Array.isArray(s)?s:[{src:s}]).map(function(A){return C.createElement("source",d({key:A.src},A))})),this.state.cropSize&&C.createElement("div",{style:d(d({},ie),{width:this.state.cropSize.width,height:this.state.cropSize.height}),"data-testid":"cropper",className:E("reactEasyCrop_CropArea",v==="round"&&"reactEasyCrop_CropAreaRound",g&&"reactEasyCrop_CropAreaGrid",se)}))},r.defaultProps={zoom:1,rotation:0,aspect:4/3,maxZoom:We,minZoom:Ae,cropShape:"rect",objectFit:"contain",showGrid:!0,style:{},classes:{},mediaProps:{},zoomSpeed:1,restrictPosition:!0,zoomWithScroll:!0},r.getMousePoint=function(e){return{x:Number(e.clientX),y:Number(e.clientY)}},r.getTouchPoint=function(e){return{x:Number(e.clientX),y:Number(e.clientY)}},r}(C.Component);export{Oe as C};
