PageSourceSearch

https://avtrs.ai/_next/static/chunks/23811a87-58261fa1f61e0e70.js

js avtrs.ai collected 2026-09-25 02:56:32 UTC 84,588 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[580],{5558:function(t,e,i){i.d(e,{U8w:function(){return eE},iyG:function(){return a}});var n,o,r,a,s,c,h=i(655),l=i(7294),d=i(4184),u=i.n(d);function m(t,e){var i,n;return t&&e?(i=""+t+e[0].toUpperCase()+e.slice(1),n=t+"-"+e):(i=t||e,n=t||e),{camelCase:i,snakeCase:n}}function p(t){return/^blob:/.test(t)}function v(t){return p(t)||/^data:/.test(t)}function f(t){return"function"==typeof t}function g(t){return void 0===t}var w=function(t){return null!==t&&"object"==typeof t};function b(t,e,i){void 0===i&&(i={});var n={};return w(t)?(Object.keys(e).forEach(function(o){g(t[o])?n[o]=e[o]:w(e[o])?w(t[o])?n[o]=b(t[o],e[o],i[o]):n[o]=t[o]?e[o]:i[o]:!0===e[o]||!1===e[o]?n[o]=Boolean(t[o]):n[o]=t[o]}),n):t?e:i}function y(t){var e=Number(t);return Number.isNaN(e)?t:e}function A(t){return!0===t||!1===t}function x(t){return"number"==typeof t}function C(t){return x(t)&&!(t!=t)||"string"==typeof t&&!Number.isNaN(parseFloat(t))&&isFinite(parseFloat(t))}function E(t,e){return Math.sqrt(Math.pow(t.left-e.left,2)+Math.pow(t.top-e.top,2))}function M(t,e,i){return void 0===i&&(i=.001),Math.abs(e-t)<i}function R(t,e,i){return!M(t,e,i)&&t>e}function S(t,e,i){return!M(t,e,i)&&t<e}function z(t){return new Promise(function(e){setTimeout(function(){e()},t)})}function N(t){if(!w(t))return t;var e={};return Array.isArray(t)?e=t.map(function(t){return N(t)}):Object.keys(t).forEach(function(i){return e[i]=N(t[i])}),e}function W(t,e,i){if(void 0===i&&(i=.001),x(t)&&x(e)&&M(t,e,i)||t===e)return!0;if(t&&e&&"object"==typeof t&&"object"==typeof e){if(t.constructor!==e.constructor)return!1;var n,o=void 0;if(Array.isArray(t)){if((n=t.length)!=e.length)return!1;for(o=n;0!=o--;)if(!W(t[o],e[o],i))return!1;return!0}if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();var r=Object.keys(t);if((n=r.length)!==Object.keys(e).length)return!1;for(o=n;0!=o--;)if(!Object.prototype.hasOwnProperty.call(e,r[o]))return!1;for(o=n;0!=o--;){var a=r[o];if(!W(t[a],e[a],i))return!1}return!0}return t!=t&&e!=e}function P(){return{left:0,top:0,width:0,height:0}}function H(t,e){var i,n;function o(){for(var r=[],a=0;a<arguments.length;a++)r[a]=arguments[a];var s=Date.now()-i,c=f(e)?e():e||0;s<c&&s>=0?n=setTimeout(function(){return o.apply(void 0,r)},c-s):t.apply(void 0,r)}function r(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];i=Date.now(),n=setTimeout(function(){return o.apply(void 0,t)},f(e)?e():e||0)}return r.clear=function(){clearTimeout(n)},r}var I=["left","right","top","bottom"],T=["left","right"],_=["top","bottom"];function D(t,e){return{left:t.left-e.left,top:t.top-e.top}}function L(t){return{left:t.left+t.width/2,top:t.top+t.height/2}}function O(t,e){return Math.pow(t.width-e.width,2)+Math.pow(t.height-e.height,2)}function k(t,e){return{left:t.left-e.left,top:t.top-e.top,width:t.width+e.left+e.right,height:t.height+e.top+e.bottom}}function X(t){return{left:-t.left,top:-t.top}}function U(t,e){return(0,h.pi)((0,h.pi)({},t),{left:t.left+e.left,top:t.top+e.top})}function Y(t){return{left:t.left,top:t.top,right:t.left+t.width,bottom:t.top+t.height}}function B(t,e,i,n){if(1===e)return t;if(!("left"in t)&&!("top"in t))return{width:t.width*e,height:t.height*e};if(!i)return{width:t.width*e,height:t.height*e,left:t.left+t.width*(1-e)/2,top:t.top+t.height*(1-e)/2};var o=L(t);return{width:t.width*e,height:t.height*e,left:t.left+t.width*(1-e)/2+(i.left-o.left)*(n||1-e),top:t.top+t.height*(1-e)/2+(i.top-o.top)*(n||1-e)}}function j(t){return t.width/t.height}function V(t,e){return Math.min(e.maxWidth?e.maxWidth/t.width:1/0,e.maxHeight?e.maxHeight/t.height:1/0)}function F(t,e){var i;return e.minimum&&S(t,e.minimum)?i=e.minimum:e.maximum&&R(t,e.maximum)&&(i=e.maximum),i}function Z(t,e){var i=j(t),n=1;return e.minWidth>0&&e.minHeight>0?i>e.minWidth/e.minHeight?t.height<e.minHeight&&(n=e.minHeight/t.height):t.width<e.minWidth&&(n=e.minWidth/t.width):e.minWidth>0?t.width<e.minWidth&&(n=e.minWidth/t.width):e.minHeight>0&&t.height<e.minHeight&&(n=e.minHeight/t.height),e.maxWidth<1/0&&e.maxHeight<1/0?i>e.maxWidth/e.maxHeight?t.width>e.maxWidth&&(n=e.maxWidth/t.width):t.height>e.maxHeight&&(n=e.maxHeight/t.height):e.maxWidth<1/0?t.width>e.maxWidth&&(n=e.maxWidth/t.width):e.maxHeight<1/0&&t.height>e.maxHeight&&(n=e.maxHeight/t.height),n}function q(t,e){var i={left:0,top:0,right:0,bottom:0};return I.forEach(function(n){var o=e[n],r=Y(t)[n];void 0!==o&&void 0!==r?"left"===n||"top"===n?i[n]=Math.max(0,o-r):i[n]=Math.max(0,r-o):i[n]=0}),i}function G(t,e){return B(t,Z(t,e))}function Q(t,e){var i=e*Math.PI/180;return{width:Math.abs(t.width*Math.cos(i))+Math.abs(t.height*Math.sin(i)),height:Math.abs(t.width*Math.sin(i))+Math.abs(t.height*Math.cos(i))}}function J(t,e,i){var n=e*Math.PI/180;return i?{left:(t.left-i.left)*Math.cos(n)-(t.top-i.top)*Math.sin(n)+i.left,top:(t.left-i.left)*Math.sin(n)+(t.top-i.top)*Math.cos(n)+i.top}:{left:t.left*Math.cos(n)-t.top*Math.sin(n),top:t.left*Math.sin(n)+t.top*Math.cos(n)}}function K(t){return{minWidth:0,minHeight:0,maxWidth:void 0!==t.right&&void 0!==t.left?t.right-t.left:1/0,maxHeight:void 0!==t.bottom&&void 0!==t.top?t.bottom-t.top:1/0}}function $(t,e){var i={};return I.forEach(function(n){var o=t[n],r=e[n];void 0!==o&&void 0!==r?"left"===n||"top"===n?i[n]=Math.max(o,r):i[n]=Math.min(o,r):void 0!==r?i[n]=r:void 0!==o&&(i[n]=o)}),i}function tt(t,e){var i={left:0,top:0},n=q(t,e);return n.left&&n.left>0?i.left=n.left:n.right&&n.right>
10&&(i.left=-n.right),n.top&&n.top>0?i.top=n.top:n.bottom&&n.bottom>0&&(i.top=-n.bottom),i}function te(t,e){return U(t,tt(t,e))}function ti(t){return(void 0===t&&(t={}),x(t))?{minimum:t,maximum:t}:{minimum:C(t.minimum)?t.minimum:0,maximum:C(t.maximum)?t.maximum:1/0}}function tn(t,e){return(g(e.maxWidth)||!R(t.width,e.maxWidth))&&(g(e.maxHeight)||!R(t.height,e.maxHeight))&&(g(e.minHeight)||!S(t.height,e.minHeight))&&(g(e.minWidth)||!S(t.width,e.minWidth))}function to(t,e){return(g(e.left)||!S(t.left,e.left))&&(g(e.top)||!S(t.top,e.top))&&(g(e.right)||!R(t.left+t.width,e.right))&&(g(e.bottom)||!R(t.top+t.height,e.bottom))}function tr(t){return Boolean(t&&t.visibleArea&&t.coordinates)}function ta(t,e){return f(e.areaPositionRestrictions)?e.areaPositionRestrictions(t,e):e.areaPositionRestrictions}function ts(t,e){return f(e.positionRestrictions)?e.positionRestrictions(t,e):e.positionRestrictions}function tc(t){return t.visibleArea?t.visibleArea.width/t.boundary.width:0}function th(t){if(!tr(t))return P();var e=t.coordinates,i=e.width,n=e.height,o=e.left,r=e.top,a=tc(t);return{width:i/a,height:n/a,left:(o-t.visibleArea.left)/a,top:(r-t.visibleArea.top)/a}}function tl(t,e){return ti(f(e.aspectRatio)?e.aspectRatio(t,e):e.aspectRatio)}function td(t,e){return f(e.defaultCoordinates)?e.defaultCoordinates(t,e):e.defaultCoordinates}function tu(t,e){return f(e.defaultVisibleArea)?e.defaultVisibleArea(t,e):e.defaultVisibleArea}function tm(t){return t.imageSize&&t.imageSize.width&&t.imageSize.height?Q(t.imageSize,t.transforms.rotate):{width:0,height:0}}function tp(t,e){return!tr(t)||!F(j(t.coordinates),tl(t,e))&&tn(t.visibleArea,tw(t,e))&&tn(t.coordinates,tg(t,e))&&to(t.visibleArea,ta(t,e))&&to(t.coordinates,ts(t,e))}function tv(t){var e=(0,h.pi)({},t);return e.minWidth>e.maxWidth&&(e.minWidth=e.maxWidth),e.minHeight>e.maxHeight&&(e.minHeight=e.maxHeight),e}function tf(t,e){var i=(0,h.pi)({minWidth:0,minHeight:0,maxWidth:1/0,maxHeight:1/0},e);return tv({maxHeight:Math.min(t.maxHeight,i.maxHeight),minHeight:Math.max(t.minHeight,i.minHeight),maxWidth:Math.min(t.maxWidth,i.maxWidth),minWidth:Math.max(t.minWidth,i.minWidth)})}function tg(t,e){var i=f(e.sizeRestrictions)?e.sizeRestrictions(t,e):e.sizeRestrictions,n=ts(t,e),o={minWidth:C(i.minWidth)?y(i.minWidth):0,minHeight:C(i.minHeight)?y(i.minHeight):0,maxWidth:C(i.maxWidth)?y(i.maxWidth):1/0,maxHeight:C(i.maxHeight)?y(i.maxHeight):1/0};return void 0!==n.left&&void 0!==n.right&&(o.maxWidth=Math.min(o.maxWidth,n.right-n.left)),void 0!==n.bottom&&void 0!==n.top&&(o.maxHeight=Math.min(o.maxHeight,n.bottom-n.top)),tv(o)}function tw(t,e){var i=f(e.areaSizeRestrictions)?e.areaSizeRestrictions(t,e):e.areaSizeRestrictions;return i.maxWidth<1/0&&i.maxHeight<1/0&&(j(t.boundary)>i.maxWidth/i.maxHeight?i.maxHeight=i.maxWidth/j(t.boundary):i.maxWidth=i.maxHeight*j(t.boundary)),tv(i)}function tb(t){var e,i,n,o=t.width,r=t.height,a=t.sizeRestrictions||{minWidth:0,minHeight:0,maxWidth:1/0,maxHeight:1/0},s=ti(t.aspectRatio),c={width:Math.max(a.minWidth,Math.min(a.maxWidth,o)),height:Math.max(a.minHeight,Math.min(a.maxHeight,r))},h=[c];return s&&[s.minimum,s.maximum].forEach(function(t){t&&h.push({width:c.width,height:c.width/t},{width:c.height*t,height:c.height})}),e=h=h.map(function(t){return G(t,a)}),i={width:o,height:r},(n=function(t){return e.reduce(function(e,n){var o=f(a)?a(n):a,r=o.maxHeight,c=o.maxWidth,h=o.minWidth,l=o.minHeight,d=ti(f(s)?s(n):s);return tn(n,t?{maxWidth:c,maxHeight:r}:{maxWidth:c,maxHeight:r,minWidth:h,minHeight:l})&&!F(j(n),d)&&n.width&&n.height&&(!e||S(O(n,i),O(e,i)))?n:e},null)})()||n(!0)}function ty(t,e){var i=N(t);if(t.visibleArea){var n=tw(t,e);i.visibleArea=(0,h.pi)((0,h.pi)({},t.visibleArea),tb({width:t.visibleArea.width,height:t.visibleArea.height,aspectRatio:{minimum:j(i.boundary),maximum:j(i.boundary)},sizeRestrictions:n})),i.visibleArea=U(i.visibleArea,D(L(t.visibleArea),L(i.visibleArea))),i.visibleArea=te(i.visibleArea,ta(i,e))}return i}function tA(t,e,i){var n=U(t,e);return i?te(n,i):n}function tx(t,e,i,n){void 0===n&&(n=!0);var o=!1===n?c.unsafe:!0===n?c.zoom:n,r=tl(t,e),a=tg(t,e);t.visibleArea&&o===c.limit&&(a=(0,h.pi)((0,h.pi)({},a),{minWidth:Math.min(t.visibleArea.width,a.minWidth),minHeight:Math.min(t.visibleArea.height,a.minHeight),maxWidth:Math.min(t.visibleArea.width,a.maxWidth),maxHeight:Math.min(t.visibleArea.height,a.maxHeight)}));var s=ts(t,e);t.visibleArea&&o===c.limit&&(s=$(s,Y(t.visibleArea)));var l=function(t,e){return tA(t,{left:e.left-(t.left||0),top:e.top-(t.top||0)},s)},d=t.coordinates?(0,h.pi)({}
1,t.coordinates):P();(Array.isArray(i)?i:[i]).forEach(function(i){var n,o,s;(n="function"==typeof i?i((0,h.pi)((0,h.pi)({},t),{coordinates:d}),e):i)&&(g(n.width)&&g(n.height)||(o=d,s=(0,h.pi)((0,h.pi)({},d),n),d=l((0,h.pi)((0,h.pi)((0,h.pi)({},o),tb({width:s.width,height:s.height,sizeRestrictions:a,aspectRatio:r})),{left:0,top:0}),{left:o.left||0,top:o.top||0})),g(n.left)&&g(n.top)||(d=l(d,(0,h.pi)((0,h.pi)({},d),n))))});var u=(0,h.pi)((0,h.pi)({},N(t)),{coordinates:d});if(!u.visibleArea||o!==c.zoom)return u;var m=Math.max(0,u.coordinates.width-u.visibleArea.width),p=Math.max(0,u.coordinates.height-u.visibleArea.height),v=tw(t,e),f=m>p?u.coordinates.width/u.visibleArea.width:u.coordinates.height/u.visibleArea.height;return f>1&&(u.visibleArea=B(u.visibleArea,Math.min(f,V(u.visibleArea,v)))),u.visibleArea=U(u.visibleArea,X(tt(u.coordinates,Y(u.visibleArea)))),ty(u,e)}function tC(t,e){if(t.coordinates){var i=N(t),n=tl(t,e),o=tg(t,e);return i.coordinates=(0,h.pi)((0,h.pi)({},t.coordinates),tb({width:t.coordinates.width,height:t.coordinates.height,aspectRatio:n,sizeRestrictions:t.visibleArea?{maxWidth:Math.min(t.visibleArea.width,o.maxWidth),maxHeight:Math.min(t.visibleArea.height,o.maxHeight),minHeight:Math.min(t.visibleArea.height,o.minHeight),minWidth:Math.min(t.visibleArea.width,o.minWidth)}:o})),i.coordinates=U(i.coordinates,D(L(t.coordinates),L(i.coordinates))),i.coordinates=te(i.coordinates,t.visibleArea?$(Y(t.visibleArea),ts(i,e)):ts(i,e)),i}return t}function tE(t,e,i,n){void 0===n&&(n=!0);var o=(0,h.pi)((0,h.pi)({},N(t)),{visibleArea:i});return o=ty(o,e),n&&(o=tC(o,e)),o}function tM(t,e){var i,n,o,r,a,l=t.boundary,d=t.image,u={boundary:{width:l.width,height:l.height},imageSize:{width:d.width,height:d.height},transforms:{rotate:(null===(i=d.transforms)||void 0===i?void 0:i.rotate)||0,flip:{horizontal:(null===(o=null===(n=d.transforms)||void 0===n?void 0:n.flip)||void 0===o?void 0:o.horizontal)||!1,vertical:(null===(a=null===(r=d.transforms)||void 0===r?void 0:r.flip)||void 0===a?void 0:a.vertical)||!1}},visibleArea:null,coordinates:null};return e.defaultTransforms&&(u.transforms=function(t,e){var i=(0,h.pi)((0,h.pi)({},t.transforms),{flip:(0,h.pi)({},t.transforms.flip)});if(e.defaultTransforms){var n=f(e.defaultTransforms)?e.defaultTransforms(t,e):e.defaultTransforms;x(n.rotate)&&(i.rotate=n.rotate),n.flip&&(A(n.flip.horizontal)&&(i.flip.horizontal=n.flip.horizontal),A(n.flip.vertical)&&(i.flip.vertical=n.flip.vertical))}return i}(u,e)),u=e.priority===s.visibleArea?tx(u=tE(u,e,tu(u,e),!1),e,td(u,e),c.limit):tE(u=tx(u,e,td(u,e),c.unsafe),e,tu(u,e),!0)}function tR(t,e,i){if(tr(t)){var n=N(t);return n.coordinates=U(n.coordinates,i),n.coordinates=te(n.coordinates,$(Y(n.visibleArea),ts(n,e))),n}return t}function tS(t){var e=t.coordinates,i=t.directions,n=t.positionRestrictions,o=t.sizeRestrictions,r=t.preserveRatio,a=t.allowedDirections,s=t.compensate,c=(0,h.pi)({},i),l=k(e,c).width,d=k(e,c).height;l<0&&(c.left<0&&c.right<0?(c.left=-(e.width-o.minWidth)/(c.left/c.right),c.right=-(e.width-o.minWidth)/(c.right/c.left)):c.left<0?c.left=-(e.width-o.minWidth):c.right<0&&(c.right=-(e.width-o.minWidth))),d<0&&(c.top<0&&c.bottom<0?(c.top=-(e.height-o.minHeight)/(c.top/c.bottom),c.bottom=-(e.height-o.minHeight)/(c.bottom/c.top)):c.top<0?c.top=-(e.height-o.minHeight):c.bottom<0&&(c.bottom=-(e.height-o.minHeight)));var u=q(k(e,c),n),m=I.every(function(t){return!R(u[({left:"right",top:"bottom",right:"left",bottom:"top"})[t]],0)||a[t]});(void 0===s||s)&&m&&(u.left&&u.left>0&&0===u.right?(c.right+=u.left,c.left-=u.left):u.right&&u.right>0&&0===u.left&&(c.left+=u.right,c.right-=u.right),u.top&&u.top>0&&0===u.bottom?(c.bottom+=u.top,c.top-=u.top):u.bottom&&u.bottom>0&&0===u.top&&(c.top+=u.bottom,c.bottom-=u.bottom),u=q(k(e,c),n));var p={width:1/0,height:1/0,left:1/0,right:1/0,top:1/0,bottom:1/0};if(I.forEach(function(t){var e=u[t];e&&c[t]&&(p[t]=Math.max(0,1-e/c[t]))}),r){var v=Math.min.apply(Math,I.map(function(t){return p[t]}));v!==1/0&&I.forEach(function(t){c[t]*=v})}else I.forEach(function(t){p[t]!==1/0&&(c[t]*=p[t])});if(l=k(e,c).width,d=k(e,c).height,c.right+c.left&&(l>o.maxWidth?p.width=(o.maxWidth-e.width)/(c.right+c.left):l<o.minWidth&&(p.width=(o.minWidth-e.width)/(c.right+c.left))),c.bottom+c.top&&(d>o.maxHeight?p.height=(o.maxHeight-e.height)/(c.bottom+c.top):d<o.minHeight&&(p.height=(o.minHeight-e.height)/(c.bottom+c.top))),r){var f=Math.min(p.width,p.height);f!==1/0&&I.forEach(function(t){c[t]*=f})}else p.width!==1/0&&T.forEach(function(t){c[t]*=p.width}),p.height!==1/0&&_.forEach(function(t){c[t]*=p.height});return c}function tz(t,e,i){return M(e+i,0)?t/2:M(e,0)?0:M(i,0)?t:t*Math.abs(e/(e+i))}function tN(t,e){var i=e.toLowerCase();return{left:t.left+t.width*(-1!==i.indexOf("west")?1:-1!==i.indexOf("east")?0:.5),top:t.top+t.height*(-1!==i.indexOf("north")?1:-1!==i.indexOf("south")?0:.5)}}function tW(t){var e=t.toLowerCase();return{left:-1===e.indexOf("east"),top:-1===e.indexOf("south"),right:-1===e.indexOf("west"),bottom:-1===e.indexOf("north")}}function tP(t,e,i,n,o){var r,a,s,c,l,d,u,m,p=t.coordinates?Math.min(t.coordinates.width,t.coordinates.height,20*tc(t)):1,v=tg(t,e);return tr(t)?(0,h.pi)((0,h.pi)({},N(t)),{coordinates:(r=t.coordinates,a={positionRestrictions:$(ts(t,e),Y(t.visibleArea)),sizeRestrictions:{maxWidth:Math.min(v.maxWidth,t.visibleArea.width),maxHeight:Math.min(v.maxHeight,t.visibleArea.height),minWidth:Math.max(Math.min(v.minWidth,t.visibleArea.width),p),minHeight:Math.max(Math.min(v.minHeight,t.visibleArea.height),p)},aspectRatio:tl(t,e)},s=o.reference,l={left:-1===(c=i.toLowerCase()).indexOf("west")?n.left:-n.left,top:-n.top,right:n.left,bottom:n.top},["north","south","center"].every(function(t){return -1===c.indexOf(t)})&&(l.top=0,l.bottom=0),["west","east","center"].every(function(t){return -1===c.indexOf(t)})&&(l.left=0,l.right=0),d=tW(i),I.forEach(function(t){d[t]||(l[t]=0)}
1),u=tW(i),m=function(t,e,i,n){var o=n.aspectRatio,r=n.positionRestrictions,a=n.sizeRestrictions,s=(0,h.pi)({},t);e=(0,h.pi)({},e);var c=i.allowedDirections||{left:!0,right:!0,bottom:!0,top:!0};t.width<a.minWidth&&(e.left=0,e.right=0),t.height<a.minHeight&&(e.top=0,e.bottom=0),I.forEach(function(t){c[t]||(e[t]=0)}),e=tS({coordinates:s,directions:e,sizeRestrictions:a,positionRestrictions:r,allowedDirections:c});var l=k(s,e).width,d=k(s,e).height,u=i.preserveAspectRatio?j(s):F(l/d,o);if(u){var m=i.respectDirection;if("width"!==m&&"height"!==m&&(m=s.width>=s.height||1===u?"width":"height"),"width"===m){var p=l/u-s.height;if(c.top&&c.bottom){var v=e.top,f=e.bottom;e.bottom=tz(p,f,v),e.top=tz(p,v,f)}else c.bottom?e.bottom=p:c.top?e.top=p:c.right?e.right=0:c.left&&(e.left=0)}else if("height"===m){var g=s.width-d*u;if(c.left&&c.right){var w=e.left,b=e.right;e.left=-tz(g,w,b),e.right=-tz(g,b,w)}else c.left?e.left=-g:c.right?e.right=-g:c.top?e.top=0:c.bottom&&(e.bottom=0)}e=tS({directions:e,coordinates:s,sizeRestrictions:a,positionRestrictions:r,preserveRatio:!0,compensate:i.compensate,allowedDirections:c})}return l=k(s,e).width,d=k(s,e).height,(u=i.preserveAspectRatio?j(s):F(l/d,o))&&R(Math.abs(u-l/d),0)&&I.forEach(function(t){e[t]=0}),tA({width:t.width+e.right+e.left,height:t.height+e.top+e.bottom,left:t.left,top:t.top},{left:-e.left,top:-e.top},r)}(r,l,(0,h.pi)((0,h.pi)({},o),{allowedDirections:u}),a),s&&(m=U(m,D(tN(s,i),tN(m,i)))),te(m,a.positionRestrictions))}):t}function tH(t,e,i){var n=(0,h.pi)((0,h.pi)({},N(t)),{boundary:i});if(n.visibleArea&&n.coordinates&&t.visibleArea){n.visibleArea.height=n.visibleArea.width/j(i),n.visibleArea.top+=(t.visibleArea.height-n.visibleArea.height)/2;var o=tg(n,e);(Math.max(o.minHeight,n.coordinates.height)-n.visibleArea.height>0||Math.max(o.minWidth,n.coordinates.width)-n.visibleArea.width>0)&&(n.visibleArea=B(n.visibleArea,Math.max(Math.max(o.minHeight,n.coordinates.height)/n.visibleArea.height,Math.max(o.minWidth,n.coordinates.width)/n.visibleArea.width))),n.visibleArea=G(n.visibleArea,tw(n,e));var r=X(tt(n.coordinates,Y(n.visibleArea)));n.visibleArea.width<n.coordinates.width&&(r.left=0),n.visibleArea.height<n.coordinates.height&&(r.top=0),n.visibleArea=U(n.visibleArea,r),n.visibleArea=te(n.visibleArea,ta(n,e)),n=tC(n,e)}return n}function tI(t,e,i){return i.rotate&&(t=function(t,e,i){if(tr(t)){var n=N(t),o=x(i)?i:i.angle,r=J(L((0,h.pi)({left:0,top:0},tm(t))),o);n.transforms.rotate+=o,n.coordinates=(0,h.pi)((0,h.pi)({},tb({sizeRestrictions:tg(n,e),aspectRatio:tl(n,e),width:n.coordinates.width,height:n.coordinates.height})),J(L(n.coordinates),o));var a=!x(i)&&i.center?i.center:L(t.coordinates),s=D(L(t.coordinates),J(L(t.coordinates),o,a)),c=tm(n);return n.coordinates.left-=r.left-c.width/2+n.coordinates.width/2-s.left,n.coordinates.top-=r.top-c.height/2+n.coordinates.height/2-s.top,n.visibleArea=G(n.visibleArea,tf(tw(n,e),{minWidth:n.coordinates.width,minHeight:n.coordinates.height})),n.coordinates=te(n.coordinates,ts(n,e)),n.visibleArea=U(n.visibleArea,D(L(n.coordinates),L(t.coordinates))),n.visibleArea=te(n.visibleArea,ta(n,e)),n}return t}(t,e,i.rotate)),i.flip&&(t=function(t,e,i,n){if(tr(t)){var o=N(t),r=t.transforms.rotate,a=tm(t),s={horizontal:i,vertical:n};if(s.horizontal||s.vertical){var c=J({left:a.width/2,top:a.height/2},-r),h=J(L(o.coordinates),-r),l=J({left:s.horizontal?c.left-(h.left-c.left):h.left,top:s.vertical?c.top-(h.top-c.top):h.top},r);o.coordinates=U(o.coordinates,D(l,L(o.coordinates))),h=J(L(o.visibleArea),-r),l=J({left:s.horizontal?c.left-(h.left-c.left):h.left,top:s.vertical?c.top-(h.top-c.top):h.top},r),o.visibleArea=U(o.visibleArea,D(l,L(o.visibleArea))),o.visibleArea=te(o.visibleArea,ta(o,e))}
1return s.horizontal&&(o.transforms.flip.horizontal=!t.transforms.flip.horizontal),s.vertical&&(o.transforms.flip.vertical=!t.transforms.flip.vertical),o}return t}(t,e,i.flip.horizontal,i.flip.vertical)),(i.move||i.scale)&&(t=function(t,e,i){var n,o=i.scale,r=void 0===o?1:o,a=i.move,s=void 0===a?{}:a;if(tr(t)){var c,h=N(t),l=1/(x(r)?r:r.factor),d=x(r)?void 0:r.center,u=!M(l,1),m=1,p=1;h.visibleArea=U(h.visibleArea,{left:s.left||0,top:s.top||0});var v=tg(h,e),f=ts(h,e),g=tw(h,e),w={stencil:{minimum:Math.max(v.minWidth?v.minWidth/h.coordinates.width:0,v.minHeight?v.minHeight/h.coordinates.height:0),maximum:Math.min(v.maxWidth?v.maxWidth/h.coordinates.width:1/0,v.maxHeight?v.maxHeight/h.coordinates.height:1/0,V(h.coordinates,K(f)))},area:{maximum:V(h.visibleArea,g),minimum:(c=h.visibleArea,Math.max(g.minWidth?g.minWidth/c.width:0,g.minHeight?g.minHeight/c.height:0))}};l&&u&&(l<1?(p=Math.max(l,Math.max(w.area.minimum,w.stencil.minimum)))>1&&(p=1):l>1&&(p=Math.min(l,Math.min(w.area.maximum,w.stencil.maximum)))<1&&(p=1)),p&&(h.visibleArea=B(h.visibleArea,p,d));var b={left:t.coordinates.left-t.visibleArea.left,right:t.visibleArea.width+t.visibleArea.left-(t.coordinates.width+t.coordinates.left),top:t.coordinates.top-t.visibleArea.top,bottom:t.visibleArea.height+t.visibleArea.top-(t.coordinates.height+t.coordinates.top)};return h.visibleArea=te(h.visibleArea,{left:void 0!==f.left?f.left-b.left*p:void 0,top:void 0!==f.top?f.top-b.top*p:void 0,bottom:void 0!==f.bottom?f.bottom+b.bottom*p:void 0,right:void 0!==f.right?f.right+b.right*p:void 0}),h.visibleArea=te(h.visibleArea,ta(h,e)),h.coordinates.width=h.coordinates.width*p,h.coordinates.height=h.coordinates.height*p,h.coordinates.left=h.visibleArea.left+b.left*p,h.coordinates.top=h.visibleArea.top+b.top*p,h.coordinates=te(h.coordinates,$(Y(h.visibleArea),f)),u&&l&&(null===(n=e.transformImage)||void 0===n?void 0:n.adjustStencil)&&(l>1?m=Math.min(w.area.maximum,l)/p:l<1&&(m=Math.max(h.coordinates.height/h.visibleArea.height,h.coordinates.width/h.visibleArea.width,l/p)),1!==m&&(h.visibleArea=B(h.visibleArea,m,l>1?d:L(h.coordinates)),h.visibleArea=te(h.visibleArea,ta(h,e)),h.visibleArea=U(h.visibleArea,X(tt(h.coordinates,Y(h.visibleArea)))))),h}return t}(t,e,i)),t}function tT(t,e){if(tr(t)){var i=N(t),n=tl(t,e),o=tg(t,e),r=tw(t,e),a=F(j(t.coordinates),n),s=a?{height:t.coordinates.height,width:t.coordinates.height*a}:t.coordinates;i.coordinates=(0,h.pi)((0,h.pi)({},i.coordinates),tb({width:s.width,height:s.height,aspectRatio:n,sizeRestrictions:tf(r,o)})),i.coordinates=U(i.coordinates,D(L(t.coordinates),L(i.coordinates)));var c=Math.max(i.coordinates.width/i.visibleArea.width,i.coordinates.height/i.visibleArea.height,1);return i.visibleArea=(0,h.pi)((0,h.pi)({},t.visibleArea),tb({width:t.visibleArea.width*c,height:t.visibleArea.height*c,aspectRatio:{minimum:j(i.boundary),maximum:j(i.boundary)},sizeRestrictions:r})),i.visibleArea=U(i.visibleArea,D(L(t.visibleArea),L(i.visibleArea))),i.visibleArea=te(i.visibleArea,ta(i,e)),i.coordinates=te(i.coordinates,$(Y(i.visibleArea),ts(i,e))),i}return t}function t_(t,e){var i=tc(t);return t.visibleArea?{left:e.left*i+t.visibleArea.left,top:e.top*i+t.visibleArea.top}:e}function tD(t,e){var i=tc(t);return{left:x(e.left)?e.left*i:0,top:x(e.top)?e.top*i:0}}function tL(t,e){var i=e.getBoundingClientRect(),n=i.left,o=i.top,r={left:0,top:0},a=0;return t.forEach(function(e){r.left+=(e.clientX-n)/t.length,r.top+=(e.clientY-o)/t.length}),t.forEach(function(t){a+=E({left:r.left,top:r.top},{left:t.clientX-n,top:t.clientY-o})}),{centerMass:r,spread:a,count:t.length}}function tO(t){return t.moveCoordinates||t.resizeCoordinates||t.transformImage.move||t.transformImage.rotate||t.transformImage.flip||t.transformImage.scale}function tk(t,e){var i,n=t.imageSize,o=t.visibleArea,r=tg(t,e),a=tl(t,e);if(o)i=o;else{var s=K(ts(t,e));i={width:Math.max(s.minWidth,Math.min(s.maxWidth,n.width)),height:Math.max(s.minHeight,Math.min(s.maxHeight,n.height))}}var c=Math.min(a.maximum||1/0,Math.max(a.minimum||0,j(i))),l=i.width<i.height?{width:.8*i.width,height:.8*i.width/c}:{height:.8*i.height,width:.8*i.height*c};return tb((0,h.pi)((0,h.pi)({},l),{aspectRatio:a,sizeRestrictions:r}))}function tX(t,e){return{minWidth:C(e.minWidth)?y(e.minWidth):0,minHeight:C(e.minHeight)?y(e.minHeight):0,maxWidth:C(e.maxWidth)?y(e.maxWidth):1/0,maxHeight:C(e.maxHeight)?y(e.maxHeight):1/0}}function tU(t){var e=t.visibleArea,i=t.coordinates,n=e||tm(t);return{left:(e?e.left:0)+n.width/2-(i?i.width/2:0),top:(e?e.top:0)+n.height/2-(i?i.height/2:0)}}function tY(t){var e=t.getBoundingClientRect();return{width:e.width,height:e.height}}function tB(t,e){return t.aspectRatio?{}:{aspectRatio:ti(f(e.aspectRatio)?e.aspectRatio():e.aspectRatio)}}function tj(t,e){if(t&&e){var i=e();i&&t(i)}}function tV(t,e){t.forEach(function(t){tj(t,e)})}(n=a||(a={})).fillArea="fillArea",n.fitArea="fitArea",n.stencil="stencil",n.none="none",(o=s||(s={})).coordinates="coordinates",o.visibleArea="visibleArea",(r=c||(c={})).limit="limit",r.zoom="zoom",r.unsafe="unsafe";var tF={linear:function(t){return t},"ease-in":function(t){return Math.pow(t,1.675)},"ease-out":function(t){return 1-Math.pow(1-t,1.675)},"ease-in-out":function(t){return .5*(Math.sin((t-.5)*Math.PI)+1)}},tZ=function(){function t(){this.active=!1}return t.prototype.start=function(t){var e;this.onStart=t.onStart,this.onProgress=t.onProgress,this.onStop=t.onStop,this.active||null===(e=this.onStart)||void 0===e||e.call(this),this.id&&window.cancelAnimationFrame(this.id
1),this.startTime=performance.now(),this.timingFunction=t.timingFunction,this.endTime=this.startTime+t.duration,this.active=!0,this.animate()},t.prototype.animate=function(){var t=this;if(this.startTime&&this.endTime){var e=tF[this.timingFunction];e||(e=tF["ease-out"]);var i=1-(this.endTime-performance.now())/(this.endTime-this.startTime),n=Math.min(1,e(i));this.onProgress&&this.onProgress(n),i<1?this.id=window.requestAnimationFrame(function(){return t.animate()}):this.stop()}else this.stop()},t.prototype.stop=function(){this.active=!1,this.id&&window.cancelAnimationFrame(this.id),this.onStop&&this.onStop()},t}();function tq(t,e,i){e.style.width="0px",e.style.height="0px",e.style.width=Math.max(t.clientWidth,i.width)+"px";var n=i.width/i.height;e.style.height=Math.max(t.clientHeight,e.clientWidth/n)+"px",e.style.width=e.clientHeight*n+"px"}function tG(t,e,i){e.style.width="0px",e.style.height="0px",e.style.width=Math.max(t.getBoundingClientRect().width,i.width)+"px";var n=i.width/i.height;e.style.height=Math.max(t.getBoundingClientRect().height,e.getBoundingClientRect().width/n)+"px",e.style.width=e.getBoundingClientRect().height*n+"px",e.clientWidth/e.clientHeight>t.clientWidth/t.clientHeight?e.clientWidth>t.clientWidth&&(e.style.width=t.clientWidth+"px",e.style.height=t.clientWidth/n+"px"):e.clientHeight>t.clientHeight&&(e.style.height=t.clientHeight+"px",e.style.width=t.clientHeight*n+"px")}function tQ(t){var e=t.src,i=t.arrayBuffer,n=void 0===i?null:i,o=t.orientation,r=void 0===o?null:o,a={src:e,arrayBuffer:n,revoke:!1,transforms:{flip:{horizontal:!1,vertical:!1},rotate:0}};return n&&r&&r>1?p(e)||!v(e)?(a.src=URL.createObjectURL(new Blob([n])),a.revoke=!0):a.src=function(t){for(var e=[],i=new Uint8Array(t);i.length>0;){var n=i.subarray(0,8192);e.push(String.fromCharCode.apply(null,Array.from?Array.from(n):n.slice())),i=i.subarray(8192)}return"data:image/jpeg;base64,"+btoa(e.join(""))}(n):a.src=e,r&&(a.transforms=function(t){var e={flip:{horizontal:!1,vertical:!1},rotate:0};if(t)switch(t){case 2:e.flip.horizontal=!0;break;case 3:e.rotate=-180;break;case 4:e.flip.vertical=!0;break;case 5:e.rotate=90,e.flip.vertical=!0;break;case 6:e.rotate=90;break;case 7:e.rotate=90,e.flip.horizontal=!0;break;case 8:e.rotate=-90}return e}(r)),a}function tJ(t,e,i,n,o){void 0===o&&(o=null);var r,a,s,c,l,d=t.width>t.height?{width:Math.min(512,t.width),height:Math.min(512,t.width)/(t.width/t.height)}:{height:Math.min(512,t.height),width:Math.min(512,t.height)*(t.width/t.height)},u=tm(e),m={rotate:e.transforms.rotate,flip:{horizontal:e.transforms.flip.horizontal,vertical:e.transforms.flip.vertical},translateX:i.left/n,translateY:i.top/n,scale:1/n},p={rotate:{left:(d.width-u.width)/(2*n),top:(d.height-u.height)/(2*n)},scale:{left:(1-1/n)*d.width/2,top:(1-1/n)*d.height/2}},v=(0,h.pi)((0,h.pi)({},m),{scale:m.scale*(t.width/d.width)}),f={width:d.width+"px",height:d.height+"px",left:"0px",top:"0px",transition:"none",transform:"translate3d("+(-p.rotate.left-p.scale.left-m.translateX)+"px, "+(-p.rotate.top-p.scale.top-m.translateY)+"px, 0px)"+(r=v.rotate,s=void 0===(a=v.flip)?{horizontal:!1,vertical:!1}:a," rotate("+(void 0===r?0:r)+"deg) scaleX("+(l=void 0===(c=v.scale)?1:c)*(s.horizontal?-1:1)+") scaleY("+l*(s.vertical?-1:1)+")"),willChange:"none"};return o&&o.active&&(f.willChange="transform",f.transition=o.duration+"ms "+o.timingFunction),f}function tK(t,e,i){return i.immediately?function(t,e){if(tr(t)){var i=N(t),n={width:0,height:0};j(i.boundary)>j(i.coordinates)?(n.height=.8*i.boundary.height,n.width=n.height*j(i.coordinates)):(n.width=.8*i.boundary.width,n.height=n.width*j(i.coordinates)),i.visibleArea=B(i.visibleArea,i.coordinates.width*i.boundary.width/(i.visibleArea.width*n.width));var o=Z(i.visibleArea,tw(i,e));return i.visibleArea=B(i.visibleArea,o),1!==o&&(n.height/=o,n.width/=o),i.visibleArea=U(i.visibleArea,D(L(i.coordinates),L(i.visibleArea))),i.visibleArea=te(i.visibleArea,ta(i,e)),i.coordinates=te(i.coordinates,$(Y(i.visibleArea),ts(i,e))),i}return t}(t,e):t}var t$=function(t,e){var i,n=(i=(0,l.useRef)(!0)).current?(i.current=!1,!0):i.current;(0,l.useEffect)(function(){if(!n)return t()},e)},t0=function(t){function e(e,i){var n=t.call(this)||this;return n.props=e,n.notify=i,n.data={state:null,transitions:!1,interactions:{moveCoordinates:!1,resizeCoordinates:!1,transformImage:{rotate:!1,move:!1,scale:!1,flip:!1}}},n}return(0,h.ZT)(e,t),e.prototype.getProps=function(){return this.props()},e.prototype.setData=function(t){this.data=t,this.notify()},e.prototype.getData=function(){return this.data},e}(function(){var t=this;this.getTransitions=function(){var e=t.getData(),i=t.getProps().transitions;return(0,h.pi)((0,h.pi)({},b(i,{timingFunction:"ease-in-out",duration:350})),{active:e.transitions})},this.getInteractions=function(){return N(t.getData().interactions)},this.hasInteractions=function(){return tO(t.getData().interactions)},this.startTransitions=function(){var e=t.getProps(),i=e.onTransitionsStart,n=e.onUpdate,o=e.getInstance,r=t.getData(),a=r.transitions,s=(0,h._T)(r,["transitions"]);t.setData((0,h.pi)((0,h.pi)({},s),{transitions:!0})),a||tV([i,n],o),t.endTransitions()},this.endTransitions=H(function(){var e=t.getProps(),i=e.onTransitionsEnd,n=e.onUpdate,o=e.getInstance;t.setData((0,h.pi)((0,h.pi)({},t.getData()),{transitions:!1})),tV([i,n],o)},function(){return t.getTransitions().duration}),this.applyPostProcess=function(e,i){var n=t.getProps(),o=n.settings,r=n.postProcess,a=e.name,s=e.interaction,c=e.transitions,h=e.immediately,l={name:a,interaction:void 0!==s&&s,transitions:void 0!==c&&c,immediately:void 0!==h&&h};return Array.isArray(r)?r.reduce(function(t,e){return e(t,o,l)},i):f(r)?r(i,o,l):i},this.updateState=function(e,i,n){void 0===i&&(i={}),void 0===n&&(n=[]);var o=i.transitions,r=void 0!==o&&o,a=t.getProps(),s=a.onTransitionsStart,c=a.getInstance,l=a.onChange,d=a.onUpdate,u=a.settings,m=t.getData(),p=f(e)?e(m.state,u):e,v=p?.001*tc(p):.001,g=!W(m.state,p,v),w=["coordinates","boun
1dary","visibleArea","imageSize","transforms"].some(function(t){var e;return!W(null===(e=m.state)||void 0===e?void 0:e[t],null==p?void 0:p[t],v)}),b=m;g&&(r&&w&&t.endTransitions(),b=(0,h.pi)((0,h.pi)({},b),{state:N(p),transitions:r&&w}),t.setData(b),tj(l,c)),b.transitions&&!m.transitions&&tj(s,c),tV((0,h.pr)(n,[d]),c)},this.setInteractions=function(e){var i=t.getProps(),n=i.onInteractionStart,o=i.onInteractionEnd,r=i.getInstance,a=t.getInteractions(),s=(0,h.pi)((0,h.pi)({},a),e);if(W(a,s)||t.setData((0,h.pi)((0,h.pi)({},t.getData()),{interactions:s})),tO(a)!==tO(s)){if(tO(a)){var c=t.getData().state;t.updateState(function(){return c&&t.applyPostProcess({name:"interactionEnd",immediately:!0,transitions:!0},c)},{transitions:!0},[o])}else tj(n,r)}},this.resetState=function(e,i){t.updateState(t.createDefaultState(e,i))},this.clear=function(){t.updateState(null)},this.reconcileState=function(e){void 0===e&&(e={});var i=t.getProps(),n=i.reconcileStateAlgorithm,o=i.settings,r=t.getData().state,a=e.transitions,s=void 0!==a&&a;if(r&&!tp(r,o)){var c=(n||tT)(r,o);c=t.applyPostProcess({name:"reconcileState",immediately:!0,transitions:s},c),t.updateState(c,{transitions:s})}},this.transformImage=function(e,i){void 0===i&&(i={});var n,o=i.transitions,r=void 0===o||o,a=i.interaction,s=i.immediately,c=void 0!==s&&s,h=i.normalize,l=t.getProps(),d=l.transformImageAlgorithm,u=l.onTransformImage,m=l.onTransformImageEnd,p=l.settings,v=t.getData().state,f=[];if(v){(void 0===h||h)&&((n=e).scale&&(n.scale={factor:x(n.scale)?n.scale:n.scale.factor,center:!x(n.scale)&&n.scale.center?t_(v,n.scale.center):void 0}),n.rotate&&(n.rotate={angle:x(n.rotate)?n.rotate:n.rotate.angle,center:!x(n.rotate)&&n.rotate.center?t_(v,n.rotate.center):void 0}),n.move&&(n.move=tD(v,n.move)),e=n);var w=t.applyPostProcess({name:"transformImage",transitions:r,immediately:c},(d||tI)(v,p,e));f.push(u),void 0===a||a?t.setInteractions({transformImage:{rotate:!g(e.rotate),flip:!g(e.flip),scale:!g(e.scale),move:!g(e.move)}}):(w=t.applyPostProcess({name:"transformImageEnd",transitions:r,immediately:!0},w),f.push(m)),t.updateState(w,{transitions:c&&r},f)}},this.transformImageEnd=function(e){void 0===e&&(e={});var i=e.immediately,n=void 0===i||i,o=e.transitions,r=void 0===o||o,a=t.getData().state,s=t.getProps().onTransformImageEnd;t.updateState(function(){return a&&t.applyPostProcess({name:"transformImageEnd",immediately:n,transitions:r},a)},{transitions:r},[s]),t.setInteractions({transformImage:{rotate:!1,flip:!1,scale:!1,move:!1}})},this.zoomImage=function(e,i){void 0===i&&(i={});var n=i.interaction,o=i.immediately,r=i.transitions,a=i.normalize;t.transformImage({scale:e},{interaction:void 0!==n&&n,immediately:void 0===o||o,transitions:void 0===r||r,normalize:void 0!==a&&a})},this.moveImage=function(e,i,n){void 0===n&&(n={});var o=n.interaction,r=n.immediately,a=n.transitions,s=n.normalize;t.transformImage({move:{left:e,top:i}},{interaction:void 0!==o&&o,immediately:void 0===r||r,transitions:void 0===a||a,normalize:void 0!==s&&s})},this.flipImage=function(e,i,n){void 0===n&&(n={});var o=n.interaction,r=n.immediately,a=n.transitions,s=n.normalize,c=t.getState(),h={horizontal:e,vertical:i};t.transformImage({flip:c&&(void 0===s||s)?function(t,e){if(t){var i=Math.abs(t.transforms.rotate%180);if(!(i<=45)&&!(i>=135))return{horizontal:e.vertical,vertical:e.horizontal}}return e}(c,h):h},{interaction:void 0!==o&&o,immediately:void 0===r||r,transitions:void 0===a||a})},this.rotateImage=function(e,i){void 0===i&&(i={});var n=i.interaction,o=i.immediately,r=i.transitions,a=i.normalize;t.transformImage({rotate:e},{interaction:void 0!==n&&n,immediately:void 0===o||o,transitions:void 0===r||r,normalize:void 0!==a&&a})},this.reset=function(e,i){t.resetState(e,i)},this.setState=function(e,i){void 0===i&&(i={});var n=t.getSettings(),o=t.getData().state,r=i.transitions,a=void 0===r||r,s=i.immediately,c=void 0!==s&&s,l=i.interaction,d=void 0!==l&&l,u=i.postprocess,m=void 0!==u&&u,p=e&&(f(e)?e(o,n):(0,h.pi)((0,h.pi)({},o),e));t.updateState(function(){return m?p&&t.applyPostProcess({name:"setState",immediately:c,transitions:a,interaction:d},p):p},{transitions:a})},this.setCoordinates=function(e,i){void 0===i&&(i={});
1var n=t.getData().state,o=t.getProps(),r=o.setCoordinatesAlgorithm,a=o.settings,s=i.transitions,h=void 0===s||s,l=i.immediately,d=void 0===l||l;t.updateState(function(){return n&&t.applyPostProcess({name:"setCoordinates",immediately:d,transitions:h},(r||tx)(n,a,e,c.zoom))},{transitions:h})},this.setVisibleArea=function(e,i){void 0===i&&(i={});var n=i.transitions,o=void 0===n||n,r=i.immediately,a=void 0===r||r,s=t.getData().state,c=t.getProps(),h=c.setVisibleAreaAlgorithm,l=c.settings;t.updateState(function(){return s&&t.applyPostProcess({name:"setVisibleArea",immediately:a,transitions:o},(h||tE)(s,l,e))},{transitions:o})},this.setBoundary=function(e,i){void 0===i&&(i={});var n=t.getData().state,o=t.getProps(),r=o.setBoundaryAlgorithm,a=o.settings,s=i.transitions,c=void 0!==s&&s,h=i.immediately,l=void 0===h||h;e?t.updateState(function(){return n&&t.applyPostProcess({name:"setBoundary",immediately:l,transitions:c},(r||tH)(n,a,e))}):t.updateState(null)},this.moveCoordinates=function(e,i){void 0===i&&(i={});var n=t.getData(),o=t.getProps(),r=o.moveC
1oordinatesAlgorithm,a=o.onMove,s=o.onMoveEnd,c=o.settings,h=i.interaction,l=void 0===h||h,d=i.transitions,u=void 0!==d&&d,m=i.immediately,p=void 0!==m&&m,v=i.normalize,f=[];if(!n.transitions&&n.state){var g=void 0===v||v?tD(n.state,e):{left:x(e.left)?e.left:0,top:x(e.top)?e.top:0},w=t.applyPostProcess({name:"moveCoordinates",interaction:l,immediately:p,transitions:u},(r||tR)(n.state,c,g));f.push(a),l?t.setInteractions({moveCoordinates:!0}):(w=t.applyPostProcess({name:"moveCoordinatesEnd",interaction:l,immediately:p,transitions:u},w),f.push(s)),t.updateState(w,{transitions:p&&u},f)}},this.moveCoordinatesEnd=function(e){void 0===e&&(e={});var i=t.getData().state,n=t.getProps().onMoveEnd,o=e.transitions,r=void 0===o||o,a=e.immediately,s=void 0!==a&&a;t.updateState(function(){return i&&t.applyPostProcess({name:"moveCoordinatesEnd",transitions:r,immediately:s},i)},{transitions:r},[n]),t.setInteractions({moveCoordinates:!1})},this.resizeCoordinates=function(e,i,n,o){void 0===o&&(o={});var r=t.getData().state,a=t.getProps(),s=a.resizeCoordinatesAlgorithm,c=a.onResize,h=a.onResizeEnd,l=a.settings,d=o.interaction,u=void 0===d||d,m=o.transitions,p=void 0!==m&&m,v=o.immediately,f=void 0!==v&&v,g=o.normalize;if(!t.getTransitions().active&&r){var b,y=[],A=void 0===g||g?(b=tc(r),{left:x(i.left)?i.left*b:0,top:x(i.top)?i.top*b:0,right:x(i.right)?i.right*b:0,bottom:x(i.bottom)?i.bottom*b:0}):{left:x(i.left)?i.left:0,top:x(i.top)?i.top:0,right:x(i.right)?i.right:0,bottom:x(i.bottom)?i.bottom:0},C=t.applyPostProcess({name:"resizeCoordinates",interaction:u,immediately:f,transitions:p},(s||tP)(r,l,e,A,w(n)?n:{}));y.push(c),u?t.setInteractions({resizeCoordinates:!0}):(C=t.applyPostProcess({name:"resizeCoordinatesEnd",interaction:u,immediately:f,transitions:p},C),y.push(h)),t.updateState(C,{transitions:f&&p},y)}},this.resizeCoordinatesEnd=function(e){void 0===e&&(e={});var i=t.getProps().onResizeEnd,n=t.getData().state,o=e.transitions,r=void 0===o||o,a=e.immediately,s=void 0!==a&&a;t.updateState(function(){return n&&t.applyPostProcess({name:"resizeCoordinatesEnd",transitions:r,immediately:s},n)},{transitions:r},[i]),t.setInteractions({resizeCoordinates:!1})},this.getStencilCoordinates=function(){return th(t.getData().state)},this.getCoordinates=function(e){void 0===e&&(e={});var i=t.getData().state,n=t.getProps().settings;if(!i||!i.coordinates)return null;var o=e.round;return void 0===o||o?function(t,e){if(!tr(t))return null;var i=tg(t,e),n=ts(t,e),o={width:Math.round(t.coordinates.width),height:Math.round(t.coordinates.height),left:Math.round(t.coordinates.left),top:Math.round(t.coordinates.top)};return o.width>i.maxWidth?o.width=Math.floor(t.coordinates.width):o.width<i.minWidth&&(o.width=Math.ceil(t.coordinates.width)),o.height>i.maxHeight?o.height=Math.floor(t.coordinates.height):o.height<i.minHeight&&(o.height=Math.ceil(t.coordinates.height)),te(o,n)}(i,n):(0,h.pi)({},i.coordinates)},this.getVisibleArea=function(){var e=t.getData().state;return(null==e?void 0:e.visibleArea)?(0,h.pi)({},e.visibleArea):null},this.getSettings=function(){var e=t.getProps().settings;return(0,h.pi)({},e)},this.getState=function(){return N(t.getData().state)},this.getTransforms=function(){var e=t.getData().state;return e?N(e.transforms):{rotate:0,flip:{horizontal:!1,vertical:!1}}},this.createDefaultState=function(e,i){var n=t.getProps(),o=n.createStateAlgorithm,r=n.settings;return t.applyPostProcess({name:"createState",immediately:!0,transitions:!1},(o||tM)({image:i,boundary:e},r))},this.isConsistent=function(){var e=t.getData().state,i=t.getProps().settings;return!e||tp(e,i)}});function t1(){var t=(0,h.CR)((0,l.useState)({}),2);t[0];var e=t[1];return function(){e({})}}var t2=function(t){var e=(0,l.useRef)(t),i=function(){e.current&&e.current()};(0,l.useEffect)(function(){e.current=t},[t]),(0,l.useEffect)(function(){return window.addEventListener("resize",i),window.addEventListener("orientationchange",i),function(){window.removeEventListener("resize",i),window.removeEventListener("orientationchange",i)}},[])},t8=(0,l.forwardRef)(function(t,e){var i=t.className,n=t.style,o=t.stretcherClassName,r=t.contentClassName,a=t.stretchAlgorithm,s=void 0===a?tq:a,c=t.sizeAlgorithm,h=void 0===c?tY:c,d=t.children,m=(0,l.useRef)(null),p=(0,l.useRef)(null);return(0,l.useImperativeHandle)(e,function(){return{reset:function(){var t=m.current;t&&(t.style.height="",t.style.width="")},stretchTo:function(t){var e=m.current,i=p.current;if(null==t||!t.width||null==t||!t.height||!e||!i)return e&&(e.style.height="",e.style.width=""),Promise.resolve(null);s(i,e,t);var n=h(i,t);return Promise.resolve(n.width&&n.height?n:null)}}}),l.createElement("div",{ref:p,style:n,className:u()("advanced-cropper-boundary",i)},l.createElement("div",{ref:m,className:u()(["advanced-cropper-boundary__stretcher",o])}),l.createElement("div",{className:u()(["advanced-cropper-boundary__content",r])},d))});t8.displayName="StretchableBoundary";var t5=function(t){var e=t.visible,i=t.className,n=t.style,o=t.children;return l.createElement("div",{style:n,className:u()(i,"advanced-cropper-fade",Boolean(e)&&"advanced-cropper-fade--visible")},o)},t3=function(t){var e=t.cropper,i=t.children,n=t.className,o=t.style,r=e?e.getState():null,a=!!e&&e.isLoaded();return l.createElement("div",{className:u()(n,"advanced-cropper-wrapper"),style:o},l.createElement(t5,{visible:r&&a,className:"advanced-cropper-wrapper__fade"},i))};function t4(t){t.preventDefault()}var t6=(0,l.forwardRef)(function(t,e){var i,n=t.className,o=t.cropper,r=t.crossOrigin,a=void 0===r||r,s=o.getState(),c=o.getTransitions(),h=o.getImage(),d=h&&s&&(void 0===(i=c)&&(i=null),h&&s&&s.visibleArea)?tJ(h,s,s.visibleArea,tc(s),i):{},m=h?h.src:void 0;return m?l.createElement("img",{key:m,ref:e,className:u()("advanced-cropper-background-image",n),src:m,crossOrigin:!0===a?"anonymous":a||void 0,style:d,onMouseDown:t4}):null});
1t6.displayName="CropperBackgroundImage";var t9=(0,l.forwardRef)(function(t,e){var i=(0,l.useRef)(null),n=(0,l.useRef)(null);return(0,l.useImperativeHandle)(e,function(){return{draw:function(t,e,o){return(void 0===o&&(o={}),e&&i.current&&n.current)?function(t,e,i,n,o){if(!tr(t))return null;var r=t.transforms,a=t.coordinates,s=0!==r.rotate||r.flip.horizontal||r.flip.vertical?function(t,e,i){var n=i.rotate,o=i.flip,r={width:"naturalWidth"in e?e.naturalWidth:e.width,height:"naturalHeight"in e?e.naturalHeight:e.height},a=Q(r,n),s=t.getContext("2d");if(t.height=a.height,t.width=a.width,s){s.save();var c=J(L((0,h.pi)({left:0,top:0},r)),n);s.translate(-(c.left-a.width/2),-(c.top-a.height/2)),s.rotate(n*Math.PI/180),s.translate(o.horizontal?r.width:0,o.vertical?r.height:0),s.scale(o.horizontal?-1:1,o.vertical?-1:1),s.drawImage(e,0,0,r.width,r.height),s.restore()}return t}(n,e,r):e,c=(0,h.pi)({minWidth:0,minHeight:0,maxWidth:1/0,maxHeight:1/0,maxArea:1/0,imageSmoothingEnabled:!0,imageSmoothingQuality:"high",fillColor:"transparent"},o),l=function(t){return t.find(function(t){return C(t)})},d=tb({sizeRestrictions:{minWidth:l([c.width,c.minWidth])||0,minHeight:l([c.height,c.minHeight])||0,maxWidth:l([c.width,c.maxWidth])||1/0,maxHeight:l([c.height,c.maxHeight])||1/0},width:a.width,height:a.height,aspectRatio:{minimum:a.width/a.height,maximum:a.width/a.height}});if(c.maxArea&&d.width*d.height>c.maxArea){var u=Math.sqrt(c.maxArea/(d.width*d.height));d={width:Math.round(u*d.width),height:Math.round(u*d.height)}}return function(t,e,i,n,o){t.width=n?n.width:i.width,t.height=n?n.height:i.height;var r=t.getContext("2d");if(r){r.clearRect(0,0,t.width,t.height),o&&(o.imageSmoothingEnabled&&(r.imageSmoothingEnabled=o.imageSmoothingEnabled),o.imageSmoothingQuality&&(r.imageSmoothingQuality=o.imageSmoothingQuality),o.fillColor&&(r.fillStyle=o.fillColor,r.fillRect(0,0,t.width,t.height),r.save()));var a=i.left<0?-i.left:0,s=i.top<0?-i.top:0;r.drawImage(e,i.left+a,i.top+s,i.width,i.height,a,s,t.width,t.height)}return t}(i,s,a,d,c)}(t,e,i.current,n.current,o):null}}}),l.createElement(l.Fragment,null,l.createElement("canvas",{className:"advanced-cropper-canvas",ref:i}),l.createElement("canvas",{className:"advanced-cropper-canvas",ref:n}))});t9.displayName="CropperCanvas";var t7=function(t){function e(e){var i=t.call(this,e)||this;return i.processMove=function(t,e){var n,o=i.container.current;if(o&&i.touches.length){var r=o.getBoundingClientRect(),a=r.left,s=r.top;if(1===i.touches.length&&1===e.length&&i.props.onMove){var c={left:Math.abs(e[0].clientX-i.anchor.left-a)<Math.abs(i.touches[0].clientX-i.anchor.left-a),top:Math.abs(e[0].clientY-i.anchor.top-s)<Math.abs(i.touches[0].clientY-i.anchor.top-s)},l={left:0,top:0};i.props.useAnchor&&c.left||(l.left=e[0].clientX-i.touches[0].clientX),i.props.useAnchor&&c.top||(l.top=e[0].clientY-i.touches[0].clientY),null===(n=i.props)||void 0===n||n.onMove(l,t),i.touches=(0,h.ev)([],(0,h.CR)(e),!1)}}},i.processEnd=function(){var t=i.props,e=t.onMoveEnd,n=t.onLeave;!i.props.disabled&&i.touches.length&&(null==e||e()),i.hovered&&(null==n||n(),i.hovered=!1),i.touches=[]},i.initAnchor=function(t){var e=i.container.current;if(e){var n=e.getBoundingClientRect(),o=n.left,r=n.top;i.anchor={left:t.clientX-o,top:t.clientY-r}}},i.onMouseOver=function(){var t=i.props,e=t.onEnter,n=t.disabled;i.hovered||n||(i.hovered=!0,null==e||e())},i.onMouseLeave=function(){var t=i.props.onLeave;i.hovered&&!i.touches.length&&(i.hovered=!1,null==t||t())},i.onTouchStart=function(t){var e=i.props,n=e.onEnter,o=e.onMoveStart,r=e.disabled;if(t.cancelable){i.touches=Array.from(t.touches);var a=!r&&1===t.touches.length;a&&(i.touches=Array.from(t.touches),null==o||o()),i.hovered||r||(i.hovered=!0,null==n||n()),(i.started||a)&&(t.preventDefault(),t.stopPropagation())}},i.onTouchEnd=function(){i.started=!1,i.processEnd()},i.onTouchMove=function(t){i.touches.length>=1&&(i.started?(i.processMove(t,Array.from(t.touches)),t.preventDefault(),t.stopPropagation()):E({left:i.touches[0].clientX,top:i.touches[0].clientY},{left:t.touches[0].clientX,top:t.touches[0].clientY})>(i.props.activationDistance||0)&&(i.initAnchor({clientX:t.touches[0].clientX,clientY:t.touches[0].clientY}),i.started=!0))},i.onMouseDown=function(t){var e=i.props,n=e.onMoveStart;if(!e.disabled&&0===t.button){var o={clientX:t.clientX,clientY:t.clientY};i.touches=[o],i.initAnchor(o),t.stopPropagation(),null==n||n()}},i.onMouseMove=function(t){!i.props.disabled&&i.touches.length&&(i.processMove(t,[{clientX:t.clientX,clientY:t.clientY}]),t.preventDefault&&t.cancelable&&t.preventDefault(),t.stopPropagation())},i.onMouseUp=function(){i.processEnd()},i.touches=[],i.hovered=!1,i.started=!1,i.anchor={left:0,top:0},i.container=(0,l.createRef)(),i}return(0,h.ZT)(e,t),e.prototype.componentWillUnmount=function(){window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd);var t=this.container.current;t&&(t.removeEventListener("touchstart",this.onTouchStart),t.removeEventListener("mousedown",this.onMouseDown))},e.prototype.componentDidMount=function(){window.addEventListener("mouseup",this.onMouseUp,{passive:!1}),window.addEventListener("mousemove",this.onMouseMove,{passive:!1}),window.addEventListener("touchmove",this.onTouchMove,{passive:!1}),window.addEventListener("touchend",this.onTouchEnd,{passive:!1});var t=this.container.current;t&&(t.addEventListener("touchstart",this.onTouchStart,{passive:!1}),t.addEventListener("mousedown",this.onMouseDown,{passive:!1}))},e.prototype.componentDidUpdate=function(t){this.props.disabled&&!t.disabled&&(this.touches=[])},e.prototype.render=function(){var t=this.props,e=t.children,i=t.className;return l.createElement("div",{className:u()("advanced-cropper-draggable-element",i),ref:this.container,onMouseOver:this.onMouseOver,onMouseLeave:this.onMouseLeave},e)},e.defaultProps={disabled:!1,activationDistance:30,useAnchor:!0,rerender:!0},e}(l.Component),et=function(t){var e=t.position,i=t.className,n=t.disabled,o=t.onDrag,r=t.onDragEnd,a=t.onLeave,s=t.onEnter,c=t.children;return l.createElement(t7,{className:u()(["advanced-cropper-line-wrapper",e&&"advanced-cropper-line-wrapper--".concat(e),i]),disabled:n,onMove:o,onMoveEnd:r,onLeave:a,onEnter:s,activationDistance:0},l.createElement("div",{className:u()(["advanced-cropper-line-wrapper__content",e&&"advanced-cropper-line-wrapper__content--".concat(e)
1])},c))},ee=function(t){var e,i,n=t.position,o=t.hoverClassName,r=t.wrapperClassName,a=t.defaultClassName,s=t.disabled,c=t.onMove,d=t.onMoveEnd,m=(0,h.CR)((0,l.useState)(!1),2),p=m[0],v=m[1];return l.createElement(et,{className:u()("advanced-cropper-simple-line-wrapper",r,((e={})["advanced-cropper-simple-line-wrapper--".concat(n)]=!!n,e)),position:n,disabled:s,onDrag:c,onDragEnd:d,onLeave:function(){v(!1)},onEnter:function(){v(!0)}},l.createElement("div",{className:u()("advanced-cropper-simple-line",p&&"advanced-cropper-simple-line--hover",a,p&&o,((i={})["advanced-cropper-simple-line--".concat(n)]=!!n,i))}))},ei=function(t){var e=t.horizontalPosition,i=t.verticalPosition,n=t.className,o=t.disabled,r=t.onDrag,a=t.onDragEnd,s=t.onLeave,c=t.onEnter,h=t.children,d=t.style,p=e||i?m(e,i).snakeCase:null;return l.createElement("div",{style:d,className:u()(n,"advanced-cropper-handler-wrapper",p&&"advanced-cropper-handler-wrapper--".concat(p),o&&"advanced-cropper-handler-wrapper--disabled")},l.createElement(t7,{className:"advanced-cropper-handler-wrapper__draggable",disabled:o,onMove:r,onMoveEnd:a,onLeave:s,onEnter:c,activationDistance:0},h))},en=function(t){var e,i=t.verticalPosition,n=t.horizontalPosition,o=t.hoverClassName,r=t.wrapperClassName,a=t.defaultClassName,s=t.wrapperStyle,c=t.disabled,d=t.onMove,m=t.onMoveEnd,p=(0,h.CR)((0,l.useState)(!1),2),v=p[0],f=p[1];return l.createElement(ei,{style:s,className:u()("advanced-cropper-simple-handler-wrapper",r,i&&"advanced-cropper-simple-handler-wrapper--".concat(i),n&&"advanced-cropper-simple-handler-wrapper--".concat(n),n&&i&&"advanced-cropper-simple-handler-wrapper--".concat(n,"-").concat(i),v&&"advanced-cropper-simple-handler-wrapper--hover"),verticalPosition:i,horizontalPosition:n,disabled:c,onDrag:d,onDragEnd:m,onLeave:function(){f(!1)},onEnter:function(){f(!0)}},l.createElement("div",{className:u()("advanced-cropper-simple-handler",v&&"advanced-cropper-simple-handler--hover",a,v&&o,((e={})["advanced-cropper-simple-handler--".concat(i)]=!!i,e["advanced-cropper-simple-handler--".concat(n)]=!!n,e["advanced-cropper-simple-handler--".concat(n,"-").concat(i)]=n&&i,e))}))},eo=["east","west",null],er=["south","north",null],ea=function(t){var e=t.style,i=t.className,n=t.children,o=t.onResize,r=t.onResizeEnd,a=t.handlerComponent,s=void 0===a?en:a,c=t.handlers,d=void 0===c?{eastNorth:!0,north:!0,westNorth:!0,west:!0,westSouth:!0,south:!0,eastSouth:!0,east:!0}:c,p=t.handlerClassNames,v=void 0===p?{}:p,f=t.handlerWrapperClassNames,g=void 0===f?{}:f,b=t.lines,y=void 0===b?{west:!0,north:!0,east:!0,south:!0}:b,A=t.lineComponent,x=void 0===A?ee:A,C=t.lineClassNames,E=void 0===C?{}:C,M=t.lineWrapperClassNames,R=void 0===M?{}:M,S=t.disabled,z=void 0!==S&&S,N=t.reference,W=void 0===N?null:N,P=(0,h.CR)((0,l.useState)(null),2),H=P[0],I=P[1],T=(0,l.useMemo)(function(){var t=[];return eo.forEach(function(e){er.forEach(function(i){if(e!==i){var n=m(e,i),o=n.snakeCase,r=n.camelCase;o&&r&&t.push({name:r,className:o,verticalPosition:i,horizontalPosition:e})}})}),t},[]),_=(0,l.useMemo)(function(){var t=[];return T.forEach(function(e){var i;("west"===(i=e.name)||"south"===i||"north"===i||"east"===i)&&(w(y)?y[e.name]:y)&&t.push({name:e.name,component:x,className:u()(E.default,E[e.name],z&&E.disabled),wrapperClassName:u()("advanced-cropper-bounding-box__line","advanced-cropper-bounding-box__line--".concat(e.name),R.default,R[e.name],z&&R.disabled),hoverClassName:E.hover,verticalPosition:e.verticalPosition,horizontalPosition:e.horizontalPosition,disabled:z})}),t},[T,y,x,E,R,z]),D=(0,l.useMemo)(function(){var t=[];return T.forEach(function(e){(w(d)?d[e.name]:d)&&t.push({name:e.name,component:s,className:u()(v.default,v[e.name]),containerClassName:u()("advanced-cropper-bounding-box__handler-wrapper","advanced-cropper-bounding-box__handler-wrapper--".concat(e.className)),wrapperClassName:u()("advanced-cropper-bounding-box__handler","advanced-cropper-bounding-box__handler--".concat(e.className),g.default,g[e.name]),hoverClassName:v.hover,verticalPosition:e.verticalPosition,horizontalPosition:e.horizontalPosition,disabled:z})}),t},[T,d,s,v,g,z]),L=function(t,e){return function(i,n){var r,a=i.left,s=i.top;if(!e&&t?r="width":e&&!t&&(r="height"),!z){if(o){var c=m(t,e).camelCase;c&&o(c,{left:a,top:s},{reference:H||W,preserveAspectRatio:n&&n.shiftKey,respectDirection:r,compensate:!0})}H||I(W)}}},O=function(){null==r||r(),I(null)};return l.createElement("div",{className:u()("advanced-cropper-bounding-box",i),style:e},n,l.createElement("div",null,_.map(function(t){return l.createElement(t.component,{key:t.name,defaultClassName:t.className,hoverClassName:t.hoverClassName,wrapperClassName:t.wrapperClassName,position:t.name,disabled:t.disabled,onMove:L(t.horizontalPosition,t.verticalPosition),onMoveEnd:O})})),l.createElement("div",null,D.map(function(t){var e=l.createElement(t.component,{defaultClassName:t.className,hoverClassName:t.hoverClassName,wrapperClassName:t.wrapperClassName,horizontalPosition:t.horizontalPosition,verticalPosition:t.verticalPosition,disabled:t.disabled,onMove:L(t.horizontalPosition,t.verticalPosition),onMoveEnd:O});return l.createElement("div",{key:t.name,className:t.containerClassName},e)})))},es=function(t){var e=t.className,i=t.children;return l.createElement("div",{className:u()("advanced-cropper-stencil-overlay",e)},i)},ec=function(t){var e,i,n,o,r,a=t.className,s=t.transitions,c=t.children,d=(0,h._T)(t,["className","transitions","children"]),m=(0,l.useRef)(null),p=(0,l.useRef)(d),v=(0,h.CR)((0,l.useState)(d),2),f=v[0],g=v[1],w=(0,h.CR)((void 0===(e=s)&&(e=null),i=(0,l.useRef)(new tZ),o=(n=(0,h.CR)((0,l.useState)(!1),2))[0],r=n[1],[function(t){e&&e.active?i.current.start((0,h.pi)((0,h.pi)({},e),{onStart:function(){r(!0)},onProgress:function(e){t(e)},onStop:function(){r(!1)}})):i.current.active||t(1)},o]),2),b=w[0],y=w[1];(0,l.useLayoutEffect)(function(){if(!W(f,d)){g(d);var t=y?(0,h.pi)({},p.current):f;b(function(e){["left","top","height","width"].forEach(function(i){var n=d[i],o=t[i];p.current[i]=x(o)&&x(n)?o+(n-o)*e:n}),m.current&&(m.current.style.width="".concat(p.current.width,"px"),m.current.style.height="".concat(p.current.height,"px"),m.current.style.transform="translate3d(".concat(p.current.left,"px, ").concat(p.current.top,"px, 0px)"))})}},[f,y,d.width,d.height,d.top,d.left]);var A=y?p.current:d,C={left:0,top:0,width:"".concat(A.width,"px"),height:"".concat(A.height,"px"),transform:"translate3d(".concat(A.left,"px, ").concat(A.top,"px, 0px)")};return l.createElement("div",{ref:m,className:u()("advanced-cropper-artificial-transition",a),style:C},c)},eh=function(t){var e=t.className,i=t.transitions,n=t.width,o=t.height,r=t.left,a=t.top,s=t.children;return l.createElement(ec,{className:u()("advanced-cropper-stencil-wrapper",e),transitions:i,width:n,height:o,top:a,left:r},s)},el=function(t){var e=t.columns,i=void 0===e?3:e,n=t.rows,o=void 0===n?3:n,r=t.visible,a=void 0!==r&&r,s=t.className,c=[],d=(0,h.CR)((0,l.useState)(i),2),m=d[0],p=d[1],v=(0,h.CR)((0,l.useState)(o),2),f=v[0],g=v[1];t$(function(){a&&(g(o),p(i))},[a,i,o]);for(var w=0;w<f;w++){for(var b=[],y=0;y<m;y++)b.push(l.createElement("div",{key:y,className:u()("advanced-cropper-stencil-grid__cell",0===w&&"advanced-cropper-stencil-grid__cell--top",w===f-1&&"advanced-cropper-stencil-grid__cell--bottom",0===y&&"advanced-cropper-stencil-grid__cell--left",y===m-1&&"advanced-cropper-stencil-grid__cell--right")}));c.push(l.createElement("div",{key:w,className:"advanced-cropper-stencil-grid__row"},b))}return l.createElement("div",{className:u()("advanced-cropper-stencil-grid",a&&"advanced-cropper-stencil-grid--visible",s)},c)},ed=(0,l.forwardRef)(function(t,e){var i=t.cropper,n=t.coordinates,o=t.aspectRatio,r=t.minAspectRatio,a=t.maxAspectRatio,s=t.handlerComponent,c=t.handlers,h=t.handlerClassNames,d=t.handlerWrapperClassNames,m=t.lines,p=t.lineComponent,v=t.lineClassNames,g=t.lineWrapperClassNames,w=t.resizable,b=void 0===w||w,y=t.movable,A=void 0===y||y,x=t.grid,C=t.gridClassName,E=t.className,M=t.movingClassName,R=t.resizingClassName,S=t.previewClassName,z=t.boun
1dingBoxClassName,N=t.overlayClassName,W=t.draggableAreaClassName,P=i.getState(),H=i.getTransitions(),I=i.getInteractions();(0,l.useImperativeHandle)(e,function(){return{aspectRatio:ti(o||{minimum:r,maximum:a})}});var T=n?f(n)?n(P):n:th(P),_=T.width,D=T.height,L=T.left,O=T.top;return P&&l.createElement(eh,{className:u()("advanced-cropper-rectangle-stencil",E,I.moveCoordinates&&M,I.resizeCoordinates&&R,{"advanced-cropper-rectangle-stencil--movable":A,"advanced-cropper-rectangle-stencil--moving":I.moveCoordinates,"advanced-cropper-rectangle-stencil--resizable":b,"advanced-cropper-rectangle-stencil--resizing":I.resizeCoordinates}),width:_,height:D,left:L,top:O,transitions:H},l.createElement(ea,{reference:P.coordinates,className:u()(z,"advanced-cropper-rectangle-stencil__bounding-box"),handlers:void 0===c?{eastNorth:!0,north:!0,westNorth:!0,west:!0,westSouth:!0,south:!0,eastSouth:!0,east:!0}:c,handlerComponent:void 0===s?en:s,handlerClassNames:void 0===h?{}:h,handlerWrapperClassNames:void 0===d?{}:d,lines:void 0===m?{west:!0,north:!0,east:!0,south:!0}:m,lineComponent:void 0===p?ee:p,lineClassNames:void 0===v?{}:v,lineWrapperClassNames:void 0===g?{}:g,onResize:function(t,e,n){i&&b&&i.resizeCoordinates(t,e,n)},onResizeEnd:function(){i&&i.resizeCoordinatesEnd()},disabled:!b},l.createElement(t7,{disabled:!A,onMove:function(t){i&&A&&i.moveCoordinates(t)},onMoveEnd:function(){i&&i.moveCoordinatesEnd()},className:u()("advanced-cropper-rectangle-stencil__draggable-area",W)},l.createElement(es,{className:u()("advanced-cropper-rectangle-stencil__overlay",N)},x&&l.createElement(el,{visible:i.hasInteractions(),columns:I.transformImage.rotate?9:3,rows:I.transformImage.rotate?9:3,className:u()("advanced-cropper-rectangle-stencil__grid",C)}),l.createElement("div",{className:u()("advanced-cropper-rectangle-stencil__preview",S)})))))});ed.displayName="RectangleStencil";var eu=function(){function t(t){var e=t.active;this.active=e,this.defaultPrevented=!1}return t.prototype.preventDefault=function(){this.defaultPrevented=!0},t}(),em=function(t){function e(e){var i=t.call(this,e)||this;return i.processMove=function(t){var e=i.props,n=e.onTransform,o=e.touchScale,r=e.touchMove,a=e.touchRotate,s=i.container.current;s&&n&&(n(function(t,e,i,n){if(void 0===n&&(n={}),1===e.length&&1===t.length)n.move&&(o={left:e[0].clientX-t[0].clientX,top:e[0].clientY-t[0].clientY});else if(t.length>1){var o,r,a,s=tL(e,i),c=tL(t,i);if(n.rotate&&2===e.length&&2===t.length){var h={left:[t[0].clientX-t[1].clientX,e[0].clientX-e[1].clientX],top:[t[0].clientY-t[1].clientY,e[0].clientY-e[1].clientY]},l=h.left[0]*h.top[1]-h.left[1]*h.top[0],d=h.left[0]*h.left[1]+h.top[0]*h.top[1];M(d,0)||M(l,0)||(a={center:c.centerMass,angle:-(180*Math.atan2(l,d))/Math.PI})}n.move&&(o={left:s.centerMass.left-c.centerMass.left,top:s.centerMass.top-c.centerMass.top}),n.scale&&(r={factor:c.spread/s.spread,center:c.centerMass})}return{move:o,scale:r,rotate:a}}(t,i.touches,s,{scale:o,rotate:a,move:r})),i.touches=t)},i.processEnd=function(){var t=i.props.onTransformEnd;i.transforming&&(i.transforming=!1,t&&t())},i.processStart=function(){i.transforming=!0,i.debouncedProcessEnd.clear()},i.processEvent=function(t){var e=i.props,n=e.onEvent,o=e.disabled,r=new eu({active:i.transforming});return n?n(r,t):(t.preventDefault(),t.stopPropagation()),!o&&!r.defaultPrevented},i.onWheel=function(t){var e,n,o,r,a,s,c,h=i.props,l=h.onTransform,d=h.wheelScale,u=i.container.current;d&&i.processEvent(t)&&(i.processStart(),l&&u&&l((e=t,n=u,void 0===(o=!0===d?.1:d.ratio)&&(o=.1),s=(a=n.getBoundingClientRect()).left,c=a.top,{scale:{factor:1-o*(0==(r=+(e.deltaY||e.detail||e.wheelDelta))||r!=r?r:r>0?1:-1),center:{left:e.clientX-s,top:e.clientY-c}}})),i.touches.length||i.debouncedProcessEnd())},i.onTouchStart=function(t){var e=i.props,n=e.touchMove,o=e.touchScale,r=e.touchRotate;if(t.cancelable&&(n||(o||r)&&t.touches.length>1)&&i.processEvent(t)){var a=i.container.current;if(a){var s=a.getBoundingClientRect(),c=s.left,h=s.top,l=s.bottom,d=s.right;i.touches=Array.from(t.touches).filter(function(t){return t.clientX>c&&t.clientX<d&&t.clientY>
1h&&t.clientY<l})}}},i.onTouchEnd=function(t){0===t.touches.length&&(i.touches=[],i.processEnd())},i.onTouchMove=function(t){if(i.touches.length){var e=(0,h.ev)([],(0,h.CR)(t.touches),!1).filter(function(t){return!t.identifier||i.touches.find(function(e){return e.identifier===t.identifier})});i.processEvent(t)&&(i.processMove(e),i.processStart())}},i.onMouseDown=function(t){if(i.props.mouseMove&&"buttons"in t&&1===t.buttons&&i.processEvent(t)){var e={clientX:t.clientX,clientY:t.clientY};i.touches=[e],i.processStart()}},i.onMouseMove=function(t){i.touches.length&&i.processEvent(t)&&i.processMove([{clientX:t.clientX,clientY:t.clientY}])},i.onMouseUp=function(){i.touches=[],i.processEnd()},i.transforming=!1,i.touches=[],i.anchor={left:0,top:0},i.container=(0,l.createRef)(),i.debouncedProcessEnd=H(i.processEnd,e.timeout),i}return(0,h.ZT)(e,t),e.prototype.shouldComponentUpdate=function(){return!0},e.prototype.componentWillUnmount=function(){window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd);var t=this.container.current;t&&(t.removeEventListener("touchstart",this.onTouchStart),t.removeEventListener("mousedown",this.onMouseDown),t.removeEventListener("wheel",this.onWheel))},e.prototype.componentDidMount=function(){window.addEventListener("mouseup",this.onMouseUp,{passive:!1}),window.addEventListener("mousemove",this.onMouseMove,{passive:!1}),window.addEventListener("touchmove",this.onTouchMove,{passive:!1}),window.addEventListener("touchend",this.onTouchEnd,{passive:!1});var t=this.container.current;t&&(t.addEventListener("touchstart",this.onTouchStart,{passive:!1}),t.addEventListener("mousedown",this.onMouseDown,{passive:!1}),t.addEventListener("wheel",this.onWheel,{passive:!1}))},e.prototype.render=function(){var t=this.props,e=t.className,i=t.children,n=t.style;return l.createElement("div",{className:e,style:n,ref:this.container},i)},e.defaultProps={touchMove:!0,mouseMove:!0,touchScale:!0,touchRotate:!1,wheelScale:!0,timeout:500},e}(l.Component),ep=function(t){var e,i,n,o=t.scaleImage,r=t.moveImage,a=t.rotateImage,s=t.children,c=t.className,h=t.style,d=t.cropper,u=t.timeout,m=d.getTransitions(),p=(e=void 0!==a&&a,(0,l.useMemo)(function(){return b(e,{touch:!0},{touch:!1})},[e])),v=(i=void 0===o||o,(0,l.useMemo)(function(){return b(i,{touch:!0,wheel:{ratio:.1}},{touch:!1,wheel:!1})},[i])),f=(n=void 0===r||r,(0,l.useMemo)(function(){return b(n,{touch:!0,mouse:!0},{touch:!1,mouse:!1})},[n]));return l.createElement(em,{className:c,style:h,onTransform:d.transformImage,onTransformEnd:d.transformImageEnd,touchMove:f.touch,mouseMove:f.mouse,touchScale:v.touch,wheelScale:v.wheel,touchRotate:p.touch,disabled:m.active,timeout:u},s)},ev=(0,l.forwardRef)(function(t,e){var i=t.style,n=t.className,o=t.stencilComponent,r=void 0===o?ed:o,s=t.stencilConstraints,c=void 0===s?tB:s,d=t.stencilProps,m=void 0===d?{}:d,p=t.wrapperComponent,w=t.wrapperProps,b=t.backgroundComponent,y=void 0===b?t6:b,A=t.backgroundProps,x=t.backgroundClassName,C=t.backgroundWrapperComponent,E=t.backgroundWrapperProps,M=t.boundaryClassName,R=t.boundarySizeAlgorithm,S=t.boundaryStretchAlgorithm,N=t.canvas,W=void 0===N||N,P=t.crossOrigin,H=void 0===P||P,I=t.settings,T=(0,h._T)(t,["style","className","stencilComponent","stencilConstraints","stencilProps","wrapperComponent","wrapperProps","backgroundComponent","backgroundProps","backgroundClassName","backgroundWrapperComponent","backgroundWrapperProps","boundaryClassName","boundarySizeAlgorithm","boundaryStretchAlgorithm","canvas","crossOrigin","settings"]),_=(0,l.useRef)(null),D=function(t){var e,i,n,o,r,s,c,d,u,m,p,w,b,y,A,x,C,E,M,R,S,N,W,P,H,I,T,_,D,L,O,k,X,U,B=this,V=t(),F=V.src,Z=V.onReady,Q=V.onError,J=V.onUpdate,K=V.canvas,$=V.unloadTime,tt=V.crossOrigin,tn=V.checkOrientation,to=V.autoReconcileState,tr=(0,l.useRef)(null),ta=(0,l.useRef)(null),ts=(0,l.useRef)(null),tc=(0,l.useRef)(null),th=(0,h.CR)((i=(e=(0,h.CR)((0,l.useState)(null),2))[0],n=e[1],r=(o=(0,h.CR)((0,l.useState)(null),2))[0],s=o[1],c=(0,l.useRef)(null),t$(function(){r&&r(i,c.current)},[r]),[i,function(t,e){c.current=i,n(t),s(function(){return e})}]),2),tl=th[0],td=th[1],tu=(d=t1(),u=function(){var e=(0,h.pi)((0,h.pi)({},t()),{getInstance:function(){return tc.current}}),i=e.settings,n=(0,h._T)(e,["settings"]),o=(0,h.pi)({imageRestriction:a.fitArea,transformImage:{adjustStencil:!0}},i),r=(0,h.pi)({transitions:!0},n);return(0,h.pi)({settings:(0,h.pi)((0,h.pi)({},o),(0,h.pi)((0,h.pi)({},o),{sizeRestrictions:function(t,e){return o.sizeRestrictions?f(o.sizeRestrictions)?o.sizeRestrictions(t,e):o.sizeRestrictions:tX(t,e)},areaPositionRestrictions:function(t,e){var i,n,r,s,c;return o.areaPositionRestrictions?f(o.areaPositionRestrictions)?o.areaPositionRestrictions(t,e):o.areaPositionRestrictions:(i=t.visibleArea,n=t.boundary,r=e.imageRestriction,s=tm(t),c={},r===a.fillArea?c={left:0,top:0,right:s.width,bottom:s.height}:r===a.fitArea&&(j(n)>j(s)?(c={top:0,bottom:s.height},i&&(i.width>s.width?(c.left=-(i.width-s.width)/2,c.right=s.width-c.left):(c.left
1=0,c.right=s.width))):(c={left:0,right:s.width},i&&(i.height>s.height?(c.top=-(i.height-s.height)/2,c.bottom=s.height-c.top):(c.top=0,c.bottom=s.height)))),c)},areaSizeRestrictions:function(t,e){var i,n,r,s;return o.areaSizeRestrictions?f(o.areaSizeRestrictions)?o.areaSizeRestrictions(t,e):o.areaSizeRestrictions:(i=t.boundary,n=e.imageRestriction,r=tm(t),s={minWidth:0,minHeight:0,maxWidth:1/0,maxHeight:1/0},n===a.fillArea?(s.maxWidth=r.width,s.maxHeight=r.height):n===a.fitArea&&(j(i)>j(r)?(s.maxHeight=r.height,s.maxWidth=r.height*j(i)):(s.maxWidth=r.width,s.maxHeight=r.width/j(i))),s)},positionRestrictions:function(t,e){var i,n;return o.positionRestrictions?f(o.positionRestrictions)?o.positionRestrictions(t,e):o.positionRestrictions:(i=tm(t),n={},e.imageRestriction&&"none"!==e.imageRestriction&&(n={left:0,top:0,right:i.width,bottom:i.height}),n)},defaultCoordinates:function(t,e){if(o.defaultCoordinates)return f(o.defaultCoordinates)?o.defaultCoordinates(t,e):o.defaultCoordinates;var i=o.defaultSize;i||(i=tk);var n=f(i)?i(t,e):i,r=o.defaultPosition||tU;return[n,function(t){return(0,h.pi)({},f(r)?r(t,e):r)}]},defaultVisibleArea:function(t,e){return o.defaultVisibleArea?f(o.defaultVisibleArea)?o.defaultVisibleArea(t,e):o.defaultVisibleArea:function(t,e){var i=t.coordinates,n=t.boundary,o=tm(t),r=j(n);if(i){var a={height:Math.max(i.height,o.height),width:Math.max(i.width,o.width)},s={left:0,top:0,width:j(a)>r?a.width:a.height*r,height:j(a)>r?a.width/r:a.height};(s=G(s,tw(t,e))).left=i.left+i.width/2-s.width/2,s.top=i.top+i.height/2-s.height/2;var c=q(i,Y((0,h.pi)({left:0,top:0},o))),l={};return c.left||c.right||!(s.width<=o.width)||(l.left=0,l.right=o.width),c.top||c.bottom||!(s.height<=o.height)||(l.top=0,l.bottom=o.height),te(s,l)}var d=j(o),u={height:d<r?o.height:o.width/r,width:d<r?o.height*r:o.width};return{left:o.width/2-u.width/2,top:o.height/2-u.height/2,width:u.width,height:u.height}}(t,e)},aspectRatio:function(t,e){return ti(f(o.aspectRatio)?o.aspectRatio(t,e):o.aspectRatio)}}))},r)},(m=(0,l.useRef)(u)).current=u,(0,l.useRef)(new t0(function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return m.current.apply(m,(0,h.ev)([],(0,h.CR)(t),!1))},d)).current),tp=(w=(p={src:F,crossOrigin:void 0===tt||tt,checkOrientation:void 0===tn||tn,unloadTime:void 0===$?500:$,canvas:void 0===K||K,onLoad:function(){tc.current&&(null==Z||Z(tc.current))},onError:function(){tc.current&&(null==Q||Q(tc.current))}}).src,b=p.onLoadingStart,y=p.onLoadingEnd,A=p.onError,x=p.onLoad,C=p.crossOrigin,E=p.checkOrientation,M=p.canvas,R=p.unloadTime,N=(S=(0,h.CR)((0,l.useState)(!1),2))[0],W=S[1],H=(P=(0,h.CR)((0,l.useState)(!1),2))[0],I=P[1],_=(T=(0,h.CR)((0,l.useState)(null),2))[0],D=T[1],L=(0,l.useRef)(null),(0,l.useEffect)(function(){if(L.current!==w){if(L.current=w||null,I(!1),w){W(!0),null==b||b();var t,e,i,n,o=[(t={crossOrigin:g(C)?M:C,checkOrientation:E},(void 0===(e=(0,h.pi)((0,h.pi)({},t),{crossOrigin:function(t){if(v(t))return!1;var e=window.location,i=/(\w+:)?(?:\/\/)([\w.-]+)?(?::(\d+))?\/?/.exec(t)||[],n={protocol:i[1]||"",host:i[2]||"",port:i[3]||""},o=function(t){return t.port||("http"===(t.protocol||e.protocol)?80:433)};return!(!n.protocol&&!n.host&&!n.port||Boolean(n.protocol&&n.protocol==e.protocol&&n.host&&n.host==e.host&&n.host&&o(n)==o(e)))}(w)&&t.crossOrigin}))&&(e={}),i=e.checkOrientation,n=e.parse,new Promise(function(t){i||n?new Promise(function(t,e){try{if(w){if(/^data:/i.test(w))t(function(t){for(var e=atob(t=t.replace(/^data:([^;]+);base64,/gim,"")),i=e.length,n=new ArrayBuffer(i),o=new Uint8Array(n),r=0;r<i;r++)o[r]=e.charCodeAt(r);return n}(w));else if(/^blob:/i.test(w)){var i,n,o=new FileReader;o.onload=function(e){var i;t(null===(i=e.target)||void 0===i?void 0:i.result)},i=function(t){o.readAsArrayBuffer(t)},(n=new XMLHttpRequest).open("GET",w,!0),n.responseType="blob",n.onload=function(){(200==this.status||0===this.status)&&i(this.response)},n.send()}else{var r=new XMLHttpRequest;r.onreadystatechange=function(){4===r.readyState&&(200===r.status||0===r.status?t(r.response):e("Warning: could not load an image to parse its orientation"))},r.onprogress=function(){"image/jpeg"!==r.getResponseHeader("content-type")&&r.abort()},r.withCredentials=!1,r.open("GET",w,!0),r.responseType="arraybuffer",r.send(null)}}else e("Error: the image is empty")}catch(a){e(a)}}).then(function(e){var i=function(t){try{var e,i=new DataView(t),n=void 0,o=void 0,r=void 0,a=void 0,s=void 0;if(255===i.getUint8(0)&&216===i.getUint8(1))for(var c=i.byteLength,h=2;h+1<c;){if(255===i.getUint8(h)&&225===i.getUint8(h+1)){a=h;break}h++}
1if(a&&(n=a+4,o=a+10,"Exif"===function(t,e,i){var n,o="";for(n=e,i+=e;n<i;n++)o+=String.fromCharCode(t.getUint8(n));return o}(i,n,4))){var l=i.getUint16(o);if(((r=18761===l)||19789===l)&&42===i.getUint16(o+2,r)){var d=i.getUint32(o+4,r);d>=8&&(s=o+d)}}if(s)for(var u=i.getUint16(s,r),m=0;m<u;m++){var h=s+12*m+2;if(274===i.getUint16(h,r)){h+=8,e=i.getUint16(h,r),i.setUint16(h,1,r);break}}return e}catch(p){return null}}(e);t(tQ(e?{src:w,arrayBuffer:e,orientation:i}:{src:w,arrayBuffer:null,orientation:null}))}).catch(function(e){console.warn(e),t(tQ({src:w}))}):t(tQ({src:w}))})).then(function(e){return new Promise(function(i,n){var o,r;(o=e.src,void 0===(r=t)&&(r={}),new Promise(function(t,e){var i=document.createElement("img");r.crossOrigin&&(i.crossOrigin=!0!==r.crossOrigin?r.crossOrigin:"anonymous"),i.src=o,i.style.visibility="hidden",i.style.position="fixed",document.body.appendChild(i),i.complete?(t(i),document.body.removeChild(i)):(i.addEventListener("load",function(){t(i),document.body.removeChild(i)}),i.addEventListener("error",function(){e(null),document.body.removeChild(i)}))})).then(function(t){i((0,h.pi)((0,h.pi)({},e),{width:t.naturalWidth,height:t.naturalHeight}))}).catch(function(){n(null)})})}))];H&&R&&o.push(z(R)),Promise.all(o).then(function(t){var e=(0,h.CR)(t,1)[0];L.current===w&&(D(e),null==x||x(e))}).catch(function(){L.current===w&&(null==A||A())}).finally(function(){L.current===w&&(null==y||y(),W(!1))})}else R?z(R).then(function(){D(null)}):D(null)}},[w]),(0,l.useEffect)(function(){_&&I(!0)},[_]),{isLoading:function(){return N},isLoaded:function(){return H},getImage:function(){return _},setImage:D}),tv=(void 0===(O=void 0===to||to)&&(O=!0),X=(k=(0,h.CR)((0,l.useState)(O),2))[0],U=k[1],(0,l.useLayoutEffect)(function(){X&&!tu.hasInteractions()&&tu.reconcileState()}),{pause:function(){U(!1)},resume:function(){U(!0)}}),tf=function(){return(0,h.mG)(B,void 0,void 0,function(){var t,e,i;return(0,h.Jh)(this,function(n){switch(n.label){case 0:if(!ta.current)return[3,2];return tv.pause(),t=tp.getImage(),[4,null===(i=ta.current)||void 0===i?void 0:i.stretchTo(t)];case 1:e=n.sent(),td(t,function(){e&&t?tu.reset(e,t):tu.clear()}),tv.resume(),n.label=2;case 2:return[2]}})})},tg=function(){return(0,h.mG)(B,void 0,void 0,function(){var t,e,i,n;return(0,h.Jh)(this,function(o){switch(o.label){case 0:if(!ta.current)return[3,2];return tv.pause(),t=tp.getImage(),[4,null===(n=ta.current)||void 0===n?void 0:n.stretchTo(t)];case 1:(e=o.sent())&&t?(i=tu.getState())?(e.width!==i.boundary.width||e.height!==i.boundary.height)&&(tu.setBoundary(e),tu.reconcileState()):tu.reset(e,t):tu.clear(),tv.resume(),o.label=2;case 2:return[2]}})})},tb={reset:function(){return tf()},refresh:function(){return tg()},setImage:function(t){return td(t)},reconcileState:tu.reconcileState,moveCoordinates:tu.moveCoordinates,moveCoordinatesEnd:tu.moveCoordinatesEnd,resizeCoordinates:tu.resizeCoordinates,clear:tu.clear,resizeCoordinatesEnd:tu.resizeCoordinatesEnd,moveImage:tu.moveImage,flipImage:tu.flipImage,zoomImage:tu.zoomImage,rotateImage:tu.rotateImage,transformImage:tu.transformImage,transformImageEnd:tu.transformImageEnd,setCoordinates:tu.setCoordinates,setVisibleArea:tu.setVisibleArea,startTransitions:tu.startTransitions,setState:tu.setState,hasInteractions:tu.hasInteractions,getStencilCoordinates:tu.getStencilCoordinates,getCoordinates:tu.getCoordinates,getVisibleArea:tu.getVisibleArea,getTransforms:tu.getTransforms,getTransitions:tu.getTransitions,getInteractions:tu.getInteractions,getSettings:tu.getSettings,getState:tu.getState,getDefaultState:function(){var t=tu.getState(),e=tp.getImage();return t&&e?tu.createDefaultState(t.boundary,e):null},getCanvas:function(t){var e=tu.getState();return tr.current&&ts.current&&e?ts.current.draw(e,tr.current,t):null},getImage:function(){return tl?(0,h.pi)({},tl):null},isLoading:tp.isLoading,isLoaded:tp.isLoaded};return t2(function(){tg()}),t$(function(){tf()},[tp.getImage()]),t$(function(){tc.current&&(null==J||J(tc.current))},[tp.isLoaded(),tp.isLoading()]),(0,l.useImperativeHandle)(tc,function(){return tb}),{cropper:tb,refs:{image:tr,boundary:ta,canvas:ts},image:tl}}(function(){return(0,h.pi)((0,h.pi)({},T),{crossOrigin:H,stencilProps:m,canvas:W,settings:(0,h.pi)((0,h.pi)({},I),c(I,(0,h.pi)((0,h.pi)({},m),_.current)))})}),L=D.cropper,O=D.image,k=D.refs;(0,l.useImperativeHandle)(e,function(){return L});var X={loading:L.isLoading(),loaded:L.isLoaded()};return l.createElement(void 0===p?t3:p,(0,h.pi)({},void 0===w?{}:w,{className:u()("advanced-cropper",n),cropper:L,style:i},X),l.createElement(t8,{ref:k.boundary,stretchAlgorithm:S,sizeAlgorithm:R,className:u()("advanced-cropper__boundary",M),stretcherClassName:u()("advanced-cropper__stretcher")},l.createElement(void 0===C?ep:C,(0,h.pi)({},void 0===E?{}:E,{cropper:L,className:"advanced-cropper__background-wrapper"}),L.getState()&&l.createElement(y,(0,h.pi)({},void 0===A?{}:A,{ref:k.image,crossOrigin:H,cropper:L,className:u()("advanced-cropper__background",x)})),l.createElement(r,(0,h.pi)({},m,{ref:_,cropper:L,image:O}))),W&&l.createElement(t9,{ref:k.canvas})))}),ef=["transformImage","moveCoordinates","resizeCoordinates","defaultCoordinates","defaultVisibleArea","areaPositionRestrictions","areaSizeRestrictions","sizeRestrictions","positionRestrictions","aspectRatio","minWidth","minHeight","maxWidth","maxHeight","defaultSize","defaultPosition","defaultTransforms","imageRestriction","priority"];function eg(t,e){void 0===e&&(e=ef);var i={settings:{},props:{}};
1return Object.keys(t).forEach(function(n){e.some(function(t){return t===n})?i.settings[n]=t[n]:i.props[n]=t[n]}),i}function ew(t,e){var i=tB({},e);return{stencilSize:function(e,n){var o,r,a=f(t.stencilSize)?t.stencilSize(e,n):t.stencilSize;return tb((0,h.pi)((0,h.pi)({},a),{aspectRatio:(o=i.aspectRatio,(r=ti(j(a)))?o?{minimum:Math.min(o.maximum,Math.max(o.minimum,r.minimum)),maximum:Math.max(o.minimum,Math.min(o.maximum,r.maximum))}:r:o)}))}}}function eb(t,e){var i=t.boundary,n=f(e.stencilSize)?e.stencilSize(t,e):e.stencilSize;return(n.width>i.width||n.height>i.height)&&(n=tb({sizeRestrictions:{maxWidth:i.width,maxHeight:i.height,minWidth:0,minHeight:0},width:n.width,height:n.height,aspectRatio:{minimum:j(n),maximum:j(n)}})),n}function ey(t,e){var i=eb(t,(0,h.pi)((0,h.pi)({},e),{stencilSize:e.stencilSize})),n=tw(t,e);return{maxWidth:n.maxWidth*i.width/t.boundary.width,maxHeight:n.maxHeight*i.height/t.boundary.height,minWidth:0,minHeight:0}}function eA(t,e){var i,n,o=t.imageSize,r=t.visibleArea,a=t.boundary,s=tg(t,e),c=tl(t,e),h=f(e.stencilSize)?e.stencilSize(t,e):e.stencilSize,l=r||o;return j(l)>j(a)?n=(i=h.height*l.height/a.height)*j(h):i=(n=h.width*l.width/a.width)/j(h),tb({width:n,height:i,aspectRatio:c,sizeRestrictions:s})}function ex(t,e){var i=j(eb(t,e));return{minimum:i,maximum:i}}function eC(t,e,i){return i&&i.immediately?function(t,e){if(tr(t)){var i=N(t),n=eb(t,e);i.visibleArea=B(i.visibleArea,i.coordinates.width*i.boundary.width/(i.visibleArea.width*n.width));var o=Z(i.visibleArea,tw(i,e));return 1!==o&&(i.visibleArea=B(i.visibleArea,o),i.coordinates=B(i.coordinates,o)),i.visibleArea=U(i.visibleArea,D(L(i.coordinates),L(i.visibleArea))),i.visibleArea=te(i.visibleArea,ta(i,e)),i.coordinates=te(i.coordinates,$(Y(i.visibleArea),ta(i,e))),i}return t}(t,e):t}var eE=(0,l.forwardRef)(function(t,e){var i=eg(t,(0,h.ev)((0,h.ev)([],(0,h.CR)(ef),!1),["stencilSize"],!1));return l.createElement(ev,(0,h.pi)({postProcess:eC,stencilConstraints:ew},i.props,{settings:(0,h.pi)((0,h.pi)({defaultSize:eA,aspectRatio:ex,sizeRestrictions:function(t,e){var i=f(ey)?ey(t,e):ey;return tf(tX(t,e),i)}},i.settings),{transformImage:(0,h.pi)((0,h.pi)({},i.settings.transformImage),{adjustStencil:!1})}),ref:e}))});eE.displayName="FixedCropper",(0,l.forwardRef)(function(t,e){var i,n=eg(t),o=n.props,r=n.settings,a=r.stencilSize,s=r.autoZoom,c=(0,h._T)(r,["stencilSize","autoZoom"]),d=(i=(0,l.useRef)([]),function(t){-1===i.current.indexOf(t)&&i.current.push(t)});return(g(s)||(o.postProcess||a?d("prop 'autoZoom' is deprecated now and will be removed, use 'postProcess' prop to pass your auto zoom function."):(d("prop 'autoZoom' is deprecated now and will be removed, use 'postProcess' prop to pass your auto zoom function. The 'postProcess' automatically set to 'hybridAutoZoom'"),o.postProcess=tK)),g(a))?l.createElement(ev,(0,h.pi)({},o,{ref:e,settings:c})):(d("prop 'stencilSize' is deprecated for <Cropper/> component now and will be removed, use <FixedCropper/> component instead."),l.createElement(eE,(0,h.pi)({ref:e,stencilSize:a},c,o)))}).displayName="CropperComponent",(0,l.forwardRef)(function(t,e){var i=t.cropper,n=t.coordinates,o=t.handlerComponent,r=t.handlers,a=t.handlerClassNames,s=t.handlerWrapperClassNames,c=t.lines,h=t.lineComponent,d=t.lineClassNames,m=t.lineWrapperClassNames,p=t.resizable,v=void 0===p||p,g=t.movable,w=void 0===g||g,b=t.grid,y=t.gridClassName,A=t.className,x=t.movingClassName,C=t.resizingClassName,E=t.previewClassName,M=t.boundingBoxClassName,R=t.overlayClassName,S=t.draggableAreaClassName,z=i.getState(),N=i.getTransitions(),W=i.getInteractions();(0,l.useImperativeHandle)(e,function(){return{aspectRatio:1,boundingBox:"circle"}});var P=n?f(n)?n(z):n:th(z),H=P.width,I=P.height,T=P.left,_=P.top;return z&&l.createElement(eh,{className:u()("advanced-cropper-circle-stencil",A,W.moveCoordinates&&x,W.resizeCoordinates&&C,{"advanced-cropper-circle-stencil--movable":w,"advanced-cropper-circle-stencil--moving":W.moveCoordinates,"advanced-cropper-circle-stencil--resizable":v,"advanced-cropper-circle-stencil--resizing":W.resizeCoordinates}
1),width:H,height:I,left:T,top:_,transitions:N},l.createElement(ea,{reference:z.coordinates,className:u()(M,"advanced-cropper-circle-stencil__bounding-box"),handlers:void 0===r?{eastNorth:!0,westNorth:!0,westSouth:!0,eastSouth:!0}:r,handlerComponent:void 0===o?en:o,handlerClassNames:void 0===a?{}:a,handlerWrapperClassNames:void 0===s?{}:s,lines:void 0===c?{west:!0,north:!0,east:!0,south:!0}:c,lineComponent:void 0===h?ee:h,lineClassNames:void 0===d?{}:d,lineWrapperClassNames:void 0===m?{}:m,onResize:function(t,e,n){i&&v&&i.resizeCoordinates(t,e,n)},onResizeEnd:function(){i&&i.resizeCoordinatesEnd()},disabled:!v},l.createElement(t7,{disabled:!w,onMove:function(t){i&&w&&i.moveCoordinates(t)},onMoveEnd:function(){i&&i.moveCoordinatesEnd()},className:u()("advanced-cropper-circle-stencil__draggable-area",S)},l.createElement(es,{className:u()("advanced-cropper-circle-stencil__overlay",R)},b&&l.createElement(el,{visible:i.hasInteractions(),columns:W.transformImage.rotate?9:3,rows:W.transformImage.rotate?9:3,className:u()("advanced-cropper-circle-stencil__grid",y)}),l.createElement("div",{className:u()("advanced-cropper-circle-stencil__preview",E)})))))}).displayName="CircleStencil",(0,l.forwardRef)(function(t,e){var i=t.src,n=t.crossOrigin,o=void 0===n||n,r=(0,h._T)(t,["src","crossOrigin"]);return i?l.createElement("img",(0,h.pi)({key:i,ref:e,src:i,className:u()("advanced-cropper-source"),crossOrigin:!0===o?"anonymous":o||void 0},r)):null}).displayName="CropperSource";var eM=function(t){var e=t.children,i=t.cropper,n=t.className,o=t.style;return l.createElement("div",{className:u()(n,"cropper-preview-wrapper"),style:o},l.createElement(t5,{visible:null==i?void 0:i.isLoaded(),className:"cropper-preview-wrapper__fade"},e))},eR=function(t){var e,i=t.className,n=t.cropper,o=t.crossOrigin,r=void 0===o||o,a=t.size,s=n.getState(),c=n.getTransitions(),h=n.getImage(),d=a&&h&&(null==s?void 0:s.coordinates)&&(void 0===(e=c)&&(e=null),h&&s&&s.visibleArea&&s.coordinates)?tJ(h,s,s.coordinates,j(s.coordinates)>j(a)?s.coordinates.width/a.width:s.coordinates.height/a.height,e):{},m=h?h.src:void 0;return m?l.createElement("img",{key:m,className:u()("advanced-cropper-background-image",i),src:m,crossOrigin:!0===r?"anonymous":r||void 0,style:d,onMouseDown:t4}):null};(0,l.forwardRef)(function(t,e){var i,n,o,r,a=t.className,s=t.contentClassName,c=t.state,d=void 0===c?null:c,m=t.image,p=void 0===m?null:m,v=t.transitions,f=void 0===v?null:v,g=t.backgroundComponent,w=t.backgroundProps,b=t.backgroundClassName,y=t.wrapperComponent,A=t.wrapperProps,x=t.loaded,C=void 0===x||x,E=t.loading,M=void 0!==E&&E,S=t.style,z=t.cropper,N=t1(),W=(0,l.useRef)(null),P=z||{current:{getState:function(){return d},getTransitions:function(){return f},getImage:function(){return p},isLoaded:function(){return C},isLoading:function(){return M}}},H=(0,h.CR)((0,l.useState)(null),2),I=H[0],T=H[1],_=null===(n=null===(i=P.current)||void 0===i?void 0:i.getState())||void 0===n?void 0:n.coordinates,D=null===(r=null===(o=P.current)||void 0===o?void 0:o.getImage())||void 0===r?void 0:r.src,L=I?{width:"".concat(I.width,"px"),height:"".concat(I.height,"px")}:{},O=function(){W.current&&_&&W.current.stretchTo(_).then(function(t){t&&_?R(j(_),j(t))?T({width:t.width,height:t.width/j(_)}):T({width:t.height*j(_),height:t.height}):T(null)}),N()};return t2(O),(0,l.useLayoutEffect)(O,[null==_?void 0:_.height,null==_?void 0:_.width]),(0,l.useImperativeHandle)(e,function(){return{refresh:N}}),l.createElement(void 0===y?eM:y,(0,h.pi)({},A,{className:u()(a,"advanced-cropper-preview"),cropper:P.current,style:S}),l.createElement(t8,{ref:W,className:"advanced-cropper-preview__boundary",contentClassName:"advanced-cropper-preview__boundary-content",stretchAlgorithm:tG},l.createElement("div",{className:u()(s,"advanced-cropper-preview__content"),style:L},P.current&&l.createElement(void 0===g?eR:g,(0,h.pi)({},w,{cropper:P.current,size:I,className:u()(b,"advanced-cropper-preview__image",D&&"advanced-cropper-preview__image--visible")})))))})}}]);

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.