index-legacy-e523abce-1694078809672.js 47 KB

12345678910
  1. System.register(["./index-legacy-da1c415f-1694078809672.js"],(function(t,e){"use strict";var i,a,o,n,r,s,h,c,l,p,d,u,m,g,f,v,w=document.createElement("style");return w.textContent='/*!\n * Cropper.js v1.5.13\n * https://fengyuanchen.github.io/cropperjs\n *\n * Copyright 2015-present Chen Fengyuan\n * Released under the MIT license\n *\n * Date: 2022-11-20T05:30:43.444Z\n */.cropper-container{direction:ltr;font-size:0;line-height:0;position:relative;-ms-touch-action:none;touch-action:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.cropper-container img{-webkit-backface-visibility:hidden;backface-visibility:hidden;display:block;height:100%;image-orientation:0deg;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;width:100%}.cropper-wrap-box,.cropper-canvas,.cropper-drag-box,.cropper-crop-box,.cropper-modal{bottom:0;left:0;position:absolute;right:0;top:0}.cropper-wrap-box,.cropper-canvas{overflow:hidden}.cropper-drag-box{background-color:#fff;opacity:0}.cropper-modal{background-color:#000;opacity:.5}.cropper-view-box{display:block;height:100%;outline:1px solid #39f;outline-color:rgba(51,153,255,.75);overflow:hidden;width:100%}.cropper-dashed{border:0 dashed #eee;display:block;opacity:.5;position:absolute}.cropper-dashed.dashed-h{border-bottom-width:1px;border-top-width:1px;height:calc(100% / 3);left:0;top:calc(100% / 3);width:100%}.cropper-dashed.dashed-v{border-left-width:1px;border-right-width:1px;height:100%;left:calc(100% / 3);top:0;width:calc(100% / 3)}.cropper-center{display:block;height:0;left:50%;opacity:.75;position:absolute;top:50%;width:0}.cropper-center:before,.cropper-center:after{background-color:#eee;content:" ";display:block;position:absolute}.cropper-center:before{height:1px;left:-.15625vw;top:0;width:.36458333vw}.cropper-center:after{height:.36458333vw;left:0;top:-.15625vw;width:1px}.cropper-face,.cropper-line,.cropper-point{display:block;height:100%;opacity:.1;position:absolute;width:100%}.cropper-face{background-color:#fff;left:0;top:0}.cropper-line{background-color:#39f}.cropper-line.line-e{cursor:ew-resize;right:-.15625vw;top:0;width:.26041667vw}.cropper-line.line-n{cursor:ns-resize;height:.26041667vw;left:0;top:-.15625vw}.cropper-line.line-w{cursor:ew-resize;left:-.15625vw;top:0;width:.26041667vw}.cropper-line.line-s{bottom:-.15625vw;cursor:ns-resize;height:.26041667vw;left:0}.cropper-point{background-color:#39f;height:.26041667vw;opacity:.75;width:.26041667vw}.cropper-point.point-e{cursor:ew-resize;margin-top:-.15625vw;right:-.15625vw;top:50%}.cropper-point.point-n{cursor:ns-resize;left:50%;margin-left:-.15625vw;top:-.15625vw}.cropper-point.point-w{cursor:ew-resize;left:-.15625vw;margin-top:-.15625vw;top:50%}.cropper-point.point-s{bottom:-.15625vw;cursor:s-resize;left:50%;margin-left:-.15625vw}.cropper-point.point-ne{cursor:nesw-resize;right:-.15625vw;top:-.15625vw}.cropper-point.point-nw{cursor:nwse-resize;left:-.15625vw;top:-.15625vw}.cropper-point.point-sw{bottom:-.15625vw;cursor:nesw-resize;left:-.15625vw}.cropper-point.point-se{bottom:-.15625vw;cursor:nwse-resize;height:1.04166667vw;opacity:1;right:-.15625vw;width:1.04166667vw}@media (min-width: 768px){.cropper-point.point-se{height:.78125vw;width:.78125vw}}@media (min-width: 992px){.cropper-point.point-se{height:.52083333vw;width:.52083333vw}}@media (min-width: 1200px){.cropper-point.point-se{height:.26041667vw;opacity:.75;width:.26041667vw}}.cropper-point.point-se:before{background-color:#39f;bottom:-50%;content:" ";display:block;height:200%;opacity:0;position:absolute;right:-50%;width:200%}.cropper-invisible{opacity:0}.cropper-bg{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC)}.cropper-hide{display:block;height:0;position:absolute;width:0}.cropper-hidden{display:none!important}.cropper-move{cursor:move}.cropper-crop{cursor:crosshair}.cropper-disabled .cropper-drag-box,.cropper-disabled .cropper-face,.cropper-disabled .cropper-line,.cropper-disabled .cropper-point{cursor:not-allowed}\n',document.head.appendChild(w),{setters:[t=>{i=t.B,a=t.d,o=t.e,n=t.r,r=t.f,s=t.cg,h=t.ch,c=t.w,l=t.j,p=t.k,d=t.E,u=t.b,m=t.y,g=t.C,f=t.v,v=t.dj}],execute:function(){const e=t("p",(t=>i.post("/edu-app/open/getUploadSign",{data:t})));
  2. /*!
  3. * Cropper.js v1.5.13
  4. * https://fengyuanchen.github.io/cropperjs
  5. *
  6. * Copyright 2015-present Chen Fengyuan
  7. * Released under the MIT license
  8. *
  9. * Date: 2022-11-20T05:30:46.114Z
  10. */function w(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,a)}return i}function b(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?w(Object(i),!0).forEach((function(e){C(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):w(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function y(t){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},y(t)}function x(t,e){for(var i=0;i<e.length;i++){var a=e[i];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}function C(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function M(t){return function(t){if(Array.isArray(t))return k(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return k(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?k(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function k(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,a=new Array(e);i<e;i++)a[i]=t[i];return a}var D="undefined"!=typeof window&&void 0!==window.document,A=D?window:{},B=!(!D||!A.document.documentElement)&&"ontouchstart"in A.document.documentElement,T=!!D&&"PointerEvent"in A,z="cropper",O="all",L="crop",E="move",N="zoom",W="e",S="w",H="s",R="n",j="ne",X="nw",Y="se",I="sw",U="".concat(z,"-crop"),P="".concat(z,"-disabled"),F="".concat(z,"-hidden"),K="".concat(z,"-hide"),$="".concat(z,"-invisible"),q="".concat(z,"-modal"),Q="".concat(z,"-move"),V="".concat(z,"Action"),Z="".concat(z,"Preview"),G="crop",J="move",_="none",tt="crop",et="cropend",it="cropmove",at="cropstart",ot="dblclick",nt=T?"pointerdown":B?"touchstart":"mousedown",rt=T?"pointermove":B?"touchmove":"mousemove",st=T?"pointerup pointercancel":B?"touchend touchcancel":"mouseup",ht="ready",ct="resize",lt="wheel",pt="zoom",dt="image/jpeg",ut=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,mt=/^data:/,gt=/^data:image\/jpeg;base64,/,ft=/^img|canvas$/i,vt={viewMode:0,dragMode:G,initialAspectRatio:NaN,aspectRatio:NaN,data:null,preview:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,autoCropArea:.8,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,wheelZoomRatio:.1,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0,minCanvasWidth:0,minCanvasHeight:0,minCropBoxWidth:0,minCropBoxHeight:0,minContainerWidth:200,minContainerHeight:100,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},wt=Number.isNaN||A.isNaN;function bt(t){return"number"==typeof t&&!wt(t)}var yt=function(t){return t>0&&t<1/0};function xt(t){return void 0===t}function Ct(t){return"object"===y(t)&&null!==t}var Mt=Object.prototype.hasOwnProperty;function kt(t){if(!Ct(t))return!1;try{var e=t.constructor,i=e.prototype;return e&&i&&Mt.call(i,"isPrototypeOf")}catch(a){return!1}}function Dt(t){return"function"==typeof t}var At=Array.prototype.slice;function Bt(t){return Array.from?Array.from(t):At.call(t)}function Tt(t,e){return t&&Dt(e)&&(Array.isArray(t)||bt(t.length)?Bt(t).forEach((function(i,a){e.call(t,i,a,t)})):Ct(t)&&Object.keys(t).forEach((function(i){e.call(t,t[i],i,t)}))),t}var zt=Object.assign||function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),a=1;a<e;a++)i[a-1]=arguments[a];return Ct(t)&&i.length>0&&i.forEach((function(e){Ct(e)&&Object.keys(e).forEach((function(i){t[i]=e[i]}))})),t},Ot=/\.\d*(?:0|9){12}\d*$/;function Lt(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e11;return Ot.test(t)?Math.round(t*e)/e:t}var Et=/^width|height|left|top|marginLeft|marginTop$/;function Nt(t,e){var i=t.style;Tt(e,(function(t,e){Et.test(e)&&bt(t)&&(t="".concat(t,"px")),i[e]=t}))}function Wt(t,e){if(e)if(bt(t.length))Tt(t,(function(t){Wt(t,e)}));else if(t.classList)t.classList.add(e);else{var i=t.className.trim();i?i.indexOf(e)<0&&(t.className="".concat(i," ").concat(e)):t.className=e}}function St(t,e){e&&(bt(t.length)?Tt(t,(function(t){St(t,e)})):t.classList?t.classList.remove(e):t.className.indexOf(e)>=0&&(t.className=t.className.replace(e,"")))}function Ht(t,e,i){e&&(bt(t.length)?Tt(t,(function(t){Ht(t,e,i)})):i?Wt(t,e):St(t,e))}var Rt=/([a-z\d])([A-Z])/g;function jt(t){return t.replace(Rt,"$1-$2").toLowerCase()}function Xt(t,e){return Ct(t[e])?t[e]:t.dataset?t.dataset[e]:t.getAttribute("data-".concat(jt(e)))}function Yt(t,e,i){Ct(i)?t[e]=i:t.dataset?t.dataset[e]=i:t.setAttribute("data-".concat(jt(e)),i)}var It=/\s\s*/,Ut=function(){var t=!1;if(D){var e=!1,i=function(){},a=Object.defineProperty({},"once",{get:function(){return t=!0,e},set:function(t){e=t}});A.addEventListener("test",i,a),A.removeEventListener("test",i,a)}return t}();function Pt(t,e,i){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i;e.trim().split(It).forEach((function(e){if(!Ut){var n=t.listeners;n&&n[e]&&n[e][i]&&(o=n[e][i],delete n[e][i],0===Object.keys(n[e]).length&&delete n[e],0===Object.keys(n).length&&delete t.listeners)}t.removeEventListener(e,o,a)}))}function Ft(t,e,i){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i;e.trim().split(It).forEach((function(e){if(a.once&&!Ut){var n=t.listeners,r=void 0===n?{}:n;o=function(){delete r[e][i],t.removeEventListener(e,o,a);for(var n=arguments.length,s=new Array(n),h=0;h<n;h++)s[h]=arguments[h];i.apply(t,s)},r[e]||(r[e]={}),r[e][i]&&t.removeEventListener(e,r[e][i],a),r[e][i]=o,t.listeners=r}t.addEventListener(e,o,a)}))}function Kt(t,e,i){var a;return Dt(Event)&&Dt(CustomEvent)?a=new CustomEvent(e,{detail:i,bubbles:!0,cancelable:!0}):(a=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,i),t.dispatchEvent(a)}function $t(t){var e=t.getBoundingClientRect();return{left:e.left+(window.pageXOffset-document.documentElement.clientLeft),top:e.top+(window.pageYOffset-document.documentElement.clientTop)}}var qt=A.location,Qt=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function Vt(t){var e=t.match(Qt);return null!==e&&(e[1]!==qt.protocol||e[2]!==qt.hostname||e[3]!==qt.port)}function Zt(t){var e="timestamp=".concat((new Date).getTime());return t+(-1===t.indexOf("?")?"?":"&")+e}function Gt(t){var e=t.rotate,i=t.scaleX,a=t.scaleY,o=t.translateX,n=t.translateY,r=[];bt(o)&&0!==o&&r.push("translateX(".concat(o,"px)")),bt(n)&&0!==n&&r.push("translateY(".concat(n,"px)")),bt(e)&&0!==e&&r.push("rotate(".concat(e,"deg)")),bt(i)&&1!==i&&r.push("scaleX(".concat(i,")")),bt(a)&&1!==a&&r.push("scaleY(".concat(a,")"));var s=r.length?r.join(" "):"none";return{WebkitTransform:s,msTransform:s,transform:s}}function Jt(t,e){var i=t.pageX,a=t.pageY,o={endX:i,endY:a};return e?o:b({startX:i,startY:a},o)}function _t(t){var e=t.aspectRatio,i=t.height,a=t.width,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"contain",n=yt(a),r=yt(i);if(n&&r){var s=i*e;"contain"===o&&s>a||"cover"===o&&s<a?i=a/e:a=i*e}else n?i=a/e:r&&(a=i*e);return{width:a,height:i}}var te=String.fromCharCode,ee=/^data:.*,/;function ie(t){var e,i=new DataView(t);try{var a,o,n;if(255===i.getUint8(0)&&216===i.getUint8(1))for(var r=i.byteLength,s=2;s+1<r;){if(255===i.getUint8(s)&&225===i.getUint8(s+1)){o=s;break}s+=1}if(o){var h=o+10;if("Exif"===function(t,e,i){var a="";i+=e;for(var o=e;o<i;o+=1)a+=te(t.getUint8(o));return a}(i,o+4,4)){var c=i.getUint16(h);if(((a=18761===c)||19789===c)&&42===i.getUint16(h+2,a)){var l=i.getUint32(h+4,a);l>=8&&(n=h+l)}}}if(n){var p,d,u=i.getUint16(n,a);for(d=0;d<u;d+=1)if(p=n+12*d+2,274===i.getUint16(p,a)){p+=8,e=i.getUint16(p,a),i.setUint16(p,1,a);break}}}catch(m){e=1}return e}var ae={render:function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},initContainer:function(){var t=this.element,e=this.options,i=this.container,a=this.cropper,o=Number(e.minContainerWidth),n=Number(e.minContainerHeight);Wt(a,F),St(t,F);var r={width:Math.max(i.offsetWidth,o>=0?o:200),height:Math.max(i.offsetHeight,n>=0?n:100)};this.containerData=r,Nt(a,{width:r.width,height:r.height}),Wt(t,F),St(a,F)},initCanvas:function(){var t=this.containerData,e=this.imageData,i=this.options.viewMode,a=Math.abs(e.rotate)%180==90,o=a?e.naturalHeight:e.naturalWidth,n=a?e.naturalWidth:e.naturalHeight,r=o/n,s=t.width,h=t.height;t.height*r>t.width?3===i?s=t.height*r:h=t.width/r:3===i?h=t.width/r:s=t.height*r;var c={aspectRatio:r,naturalWidth:o,naturalHeight:n,width:s,height:h};this.canvasData=c,this.limited=1===i||2===i,this.limitCanvas(!0,!0),c.width=Math.min(Math.max(c.width,c.minWidth),c.maxWidth),c.height=Math.min(Math.max(c.height,c.minHeight),c.maxHeight),c.left=(t.width-c.width)/2,c.top=(t.height-c.height)/2,c.oldLeft=c.left,c.oldTop=c.top,this.initialCanvasData=zt({},c)},limitCanvas:function(t,e){var i=this.options,a=this.containerData,o=this.canvasData,n=this.cropBoxData,r=i.viewMode,s=o.aspectRatio,h=this.cropped&&n;if(t){var c=Number(i.minCanvasWidth)||0,l=Number(i.minCanvasHeight)||0;r>1?(c=Math.max(c,a.width),l=Math.max(l,a.height),3===r&&(l*s>c?c=l*s:l=c/s)):r>0&&(c?c=Math.max(c,h?n.width:0):l?l=Math.max(l,h?n.height:0):h&&(c=n.width,(l=n.height)*s>c?c=l*s:l=c/s));var p=_t({aspectRatio:s,width:c,height:l});c=p.width,l=p.height,o.minWidth=c,o.minHeight=l,o.maxWidth=1/0,o.maxHeight=1/0}if(e)if(r>(h?0:1)){var d=a.width-o.width,u=a.height-o.height;o.minLeft=Math.min(0,d),o.minTop=Math.min(0,u),o.maxLeft=Math.max(0,d),o.maxTop=Math.max(0,u),h&&this.limited&&(o.minLeft=Math.min(n.left,n.left+(n.width-o.width)),o.minTop=Math.min(n.top,n.top+(n.height-o.height)),o.maxLeft=n.left,o.maxTop=n.top,2===r&&(o.width>=a.width&&(o.minLeft=Math.min(0,d),o.maxLeft=Math.max(0,d)),o.height>=a.height&&(o.minTop=Math.min(0,u),o.maxTop=Math.max(0,u))))}else o.minLeft=-o.width,o.minTop=-o.height,o.maxLeft=a.width,o.maxTop=a.height},renderCanvas:function(t,e){var i=this.canvasData,a=this.imageData;if(e){var o=function(t){var e=t.width,i=t.height,a=t.degree;if(90==(a=Math.abs(a)%180))return{width:i,height:e};var o=a%90*Math.PI/180,n=Math.sin(o),r=Math.cos(o),s=e*r+i*n,h=e*n+i*r;return a>90?{width:h,height:s}:{width:s,height:h}}({width:a.naturalWidth*Math.abs(a.scaleX||1),height:a.naturalHeight*Math.abs(a.scaleY||1),degree:a.rotate||0}),n=o.width,r=o.height,s=i.width*(n/i.naturalWidth),h=i.height*(r/i.naturalHeight);i.left-=(s-i.width)/2,i.top-=(h-i.height)/2,i.width=s,i.height=h,i.aspectRatio=n/r,i.naturalWidth=n,i.naturalHeight=r,this.limitCanvas(!0,!1)}(i.width>i.maxWidth||i.width<i.minWidth)&&(i.left=i.oldLeft),(i.height>i.maxHeight||i.height<i.minHeight)&&(i.top=i.oldTop),i.width=Math.min(Math.max(i.width,i.minWidth),i.maxWidth),i.height=Math.min(Math.max(i.height,i.minHeight),i.maxHeight),this.limitCanvas(!1,!0),i.left=Math.min(Math.max(i.left,i.minLeft),i.maxLeft),i.top=Math.min(Math.max(i.top,i.minTop),i.maxTop),i.oldLeft=i.left,i.oldTop=i.top,Nt(this.canvas,zt({width:i.width,height:i.height},Gt({translateX:i.left,translateY:i.top}))),this.renderImage(t),this.cropped&&this.limited&&this.limitCropBox(!0,!0)},renderImage:function(t){var e=this.canvasData,i=this.imageData,a=i.naturalWidth*(e.width/e.naturalWidth),o=i.naturalHeight*(e.height/e.naturalHeight);zt(i,{width:a,height:o,left:(e.width-a)/2,top:(e.height-o)/2}),Nt(this.image,zt({width:i.width,height:i.height},Gt(zt({translateX:i.left,translateY:i.top},i)))),t&&this.output()},initCropBox:function(){var t=this.options,e=this.canvasData,i=t.aspectRatio||t.initialAspectRatio,a=Number(t.autoCropArea)||.8,o={width:e.width,height:e.height};i&&(e.height*i>e.width?o.height=o.width/i:o.width=o.height*i),this.cropBoxData=o,this.limitCropBox(!0,!0),o.width=Math.min(Math.max(o.width,o.minWidth),o.maxWidth),o.height=Math.min(Math.max(o.height,o.minHeight),o.maxHeight),o.width=Math.max(o.minWidth,o.width*a),o.height=Math.max(o.minHeight,o.height*a),o.left=e.left+(e.width-o.width)/2,o.top=e.top+(e.height-o.height)/2,o.oldLeft=o.left,o.oldTop=o.top,this.initialCropBoxData=zt({},o)},limitCropBox:function(t,e){var i=this.options,a=this.containerData,o=this.canvasData,n=this.cropBoxData,r=this.limited,s=i.aspectRatio;if(t){var h=Number(i.minCropBoxWidth)||0,c=Number(i.minCropBoxHeight)||0,l=r?Math.min(a.width,o.width,o.width+o.left,a.width-o.left):a.width,p=r?Math.min(a.height,o.height,o.height+o.top,a.height-o.top):a.height;h=Math.min(h,a.width),c=Math.min(c,a.height),s&&(h&&c?c*s>h?c=h/s:h=c*s:h?c=h/s:c&&(h=c*s),p*s>l?p=l/s:l=p*s),n.minWidth=Math.min(h,l),n.minHeight=Math.min(c,p),n.maxWidth=l,n.maxHeight=p}e&&(r?(n.minLeft=Math.max(0,o.left),n.minTop=Math.max(0,o.top),n.maxLeft=Math.min(a.width,o.left+o.width)-n.width,n.maxTop=Math.min(a.height,o.top+o.height)-n.height):(n.minLeft=0,n.minTop=0,n.maxLeft=a.width-n.width,n.maxTop=a.height-n.height))},renderCropBox:function(){var t=this.options,e=this.containerData,i=this.cropBoxData;(i.width>i.maxWidth||i.width<i.minWidth)&&(i.left=i.oldLeft),(i.height>i.maxHeight||i.height<i.minHeight)&&(i.top=i.oldTop),i.width=Math.min(Math.max(i.width,i.minWidth),i.maxWidth),i.height=Math.min(Math.max(i.height,i.minHeight),i.maxHeight),this.limitCropBox(!1,!0),i.left=Math.min(Math.max(i.left,i.minLeft),i.maxLeft),i.top=Math.min(Math.max(i.top,i.minTop),i.maxTop),i.oldLeft=i.left,i.oldTop=i.top,t.movable&&t.cropBoxMovable&&Yt(this.face,V,i.width>=e.width&&i.height>=e.height?E:O),Nt(this.cropBox,zt({width:i.width,height:i.height},Gt({translateX:i.left,translateY:i.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),Kt(this.element,tt,this.getData())}},oe={initPreview:function(){var t=this.element,e=this.crossOrigin,i=this.options.preview,a=e?this.crossOriginUrl:this.url,o=t.alt||"The image to preview",n=document.createElement("img");if(e&&(n.crossOrigin=e),n.src=a,n.alt=o,this.viewBox.appendChild(n),this.viewBoxImage=n,i){var r=i;"string"==typeof i?r=t.ownerDocument.querySelectorAll(i):i.querySelector&&(r=[i]),this.previews=r,Tt(r,(function(t){var i=document.createElement("img");Yt(t,Z,{width:t.offsetWidth,height:t.offsetHeight,html:t.innerHTML}),e&&(i.crossOrigin=e),i.src=a,i.alt=o,i.style.cssText='display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"',t.innerHTML="",t.appendChild(i)}))}},resetPreview:function(){Tt(this.previews,(function(t){var e=Xt(t,Z);Nt(t,{width:e.width,height:e.height}),t.innerHTML=e.html,function(t,e){if(Ct(t[e]))try{delete t[e]}catch(i){t[e]=void 0}else if(t.dataset)try{delete t.dataset[e]}catch(i){t.dataset[e]=void 0}else t.removeAttribute("data-".concat(jt(e)))}(t,Z)}))},preview:function(){var t=this.imageData,e=this.canvasData,i=this.cropBoxData,a=i.width,o=i.height,n=t.width,r=t.height,s=i.left-e.left-t.left,h=i.top-e.top-t.top;this.cropped&&!this.disabled&&(Nt(this.viewBoxImage,zt({width:n,height:r},Gt(zt({translateX:-s,translateY:-h},t)))),Tt(this.previews,(function(e){var i=Xt(e,Z),c=i.width,l=i.height,p=c,d=l,u=1;a&&(d=o*(u=c/a)),o&&d>l&&(p=a*(u=l/o),d=l),Nt(e,{width:p,height:d}),Nt(e.getElementsByTagName("img")[0],zt({width:n*u,height:r*u},Gt(zt({translateX:-s*u,translateY:-h*u},t))))})))}},ne={bind:function(){var t=this.element,e=this.options,i=this.cropper;Dt(e.cropstart)&&Ft(t,at,e.cropstart),Dt(e.cropmove)&&Ft(t,it,e.cropmove),Dt(e.cropend)&&Ft(t,et,e.cropend),Dt(e.crop)&&Ft(t,tt,e.crop),Dt(e.zoom)&&Ft(t,pt,e.zoom),Ft(i,nt,this.onCropStart=this.cropStart.bind(this)),e.zoomable&&e.zoomOnWheel&&Ft(i,lt,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),e.toggleDragModeOnDblclick&&Ft(i,ot,this.onDblclick=this.dblclick.bind(this)),Ft(t.ownerDocument,rt,this.onCropMove=this.cropMove.bind(this)),Ft(t.ownerDocument,st,this.onCropEnd=this.cropEnd.bind(this)),e.responsive&&Ft(window,ct,this.onResize=this.resize.bind(this))},unbind:function(){var t=this.element,e=this.options,i=this.cropper;Dt(e.cropstart)&&Pt(t,at,e.cropstart),Dt(e.cropmove)&&Pt(t,it,e.cropmove),Dt(e.cropend)&&Pt(t,et,e.cropend),Dt(e.crop)&&Pt(t,tt,e.crop),Dt(e.zoom)&&Pt(t,pt,e.zoom),Pt(i,nt,this.onCropStart),e.zoomable&&e.zoomOnWheel&&Pt(i,lt,this.onWheel,{passive:!1,capture:!0}),e.toggleDragModeOnDblclick&&Pt(i,ot,this.onDblclick),Pt(t.ownerDocument,rt,this.onCropMove),Pt(t.ownerDocument,st,this.onCropEnd),e.responsive&&Pt(window,ct,this.onResize)}},re={resize:function(){if(!this.disabled){var t,e,i=this.options,a=this.container,o=this.containerData,n=a.offsetWidth/o.width,r=a.offsetHeight/o.height,s=Math.abs(n-1)>Math.abs(r-1)?n:r;1!==s&&(i.restore&&(t=this.getCanvasData(),e=this.getCropBoxData()),this.render(),i.restore&&(this.setCanvasData(Tt(t,(function(e,i){t[i]=e*s}))),this.setCropBoxData(Tt(e,(function(t,i){e[i]=t*s})))))}},dblclick:function(){var t,e;this.disabled||this.options.dragMode===_||this.setDragMode((t=this.dragBox,e=U,(t.classList?t.classList.contains(e):t.className.indexOf(e)>-1)?J:G))},wheel:function(t){var e=this,i=Number(this.options.wheelZoomRatio)||.1,a=1;this.disabled||(t.preventDefault(),this.wheeling||(this.wheeling=!0,setTimeout((function(){e.wheeling=!1}),50),t.deltaY?a=t.deltaY>0?1:-1:t.wheelDelta?a=-t.wheelDelta/120:t.detail&&(a=t.detail>0?1:-1),this.zoom(-a*i,t)))},cropStart:function(t){var e=t.buttons,i=t.button;if(!(this.disabled||("mousedown"===t.type||"pointerdown"===t.type&&"mouse"===t.pointerType)&&(bt(e)&&1!==e||bt(i)&&0!==i||t.ctrlKey))){var a,o=this.options,n=this.pointers;t.changedTouches?Tt(t.changedTouches,(function(t){n[t.identifier]=Jt(t)})):n[t.pointerId||0]=Jt(t),a=Object.keys(n).length>1&&o.zoomable&&o.zoomOnTouch?N:Xt(t.target,V),ut.test(a)&&!1!==Kt(this.element,at,{originalEvent:t,action:a})&&(t.preventDefault(),this.action=a,this.cropping=!1,a===L&&(this.cropping=!0,Wt(this.dragBox,q)))}},cropMove:function(t){var e=this.action;if(!this.disabled&&e){var i=this.pointers;t.preventDefault(),!1!==Kt(this.element,it,{originalEvent:t,action:e})&&(t.changedTouches?Tt(t.changedTouches,(function(t){zt(i[t.identifier]||{},Jt(t,!0))})):zt(i[t.pointerId||0]||{},Jt(t,!0)),this.change(t))}},cropEnd:function(t){if(!this.disabled){var e=this.action,i=this.pointers;t.changedTouches?Tt(t.changedTouches,(function(t){delete i[t.identifier]})):delete i[t.pointerId||0],e&&(t.preventDefault(),Object.keys(i).length||(this.action=""),this.cropping&&(this.cropping=!1,Ht(this.dragBox,q,this.cropped&&this.options.modal)),Kt(this.element,et,{originalEvent:t,action:e}))}}},se={change:function(t){var e,i=this.options,a=this.canvasData,o=this.containerData,n=this.cropBoxData,r=this.pointers,s=this.action,h=i.aspectRatio,c=n.left,l=n.top,p=n.width,d=n.height,u=c+p,m=l+d,g=0,f=0,v=o.width,w=o.height,y=!0;!h&&t.shiftKey&&(h=p&&d?p/d:1),this.limited&&(g=n.minLeft,f=n.minTop,v=g+Math.min(o.width,a.width,a.left+a.width),w=f+Math.min(o.height,a.height,a.top+a.height));var x=r[Object.keys(r)[0]],C={x:x.endX-x.startX,y:x.endY-x.startY},M=function(t){switch(t){case W:u+C.x>v&&(C.x=v-u);break;case S:c+C.x<g&&(C.x=g-c);break;case R:l+C.y<f&&(C.y=f-l);break;case H:m+C.y>w&&(C.y=w-m)}};switch(s){case O:c+=C.x,l+=C.y;break;case W:if(C.x>=0&&(u>=v||h&&(l<=f||m>=w))){y=!1;break}M(W),(p+=C.x)<0&&(s=S,c-=p=-p),h&&(d=p/h,l+=(n.height-d)/2);break;case R:if(C.y<=0&&(l<=f||h&&(c<=g||u>=v))){y=!1;break}M(R),d-=C.y,l+=C.y,d<0&&(s=H,l-=d=-d),h&&(p=d*h,c+=(n.width-p)/2);break;case S:if(C.x<=0&&(c<=g||h&&(l<=f||m>=w))){y=!1;break}M(S),p-=C.x,c+=C.x,p<0&&(s=W,c-=p=-p),h&&(d=p/h,l+=(n.height-d)/2);break;case H:if(C.y>=0&&(m>=w||h&&(c<=g||u>=v))){y=!1;break}M(H),(d+=C.y)<0&&(s=R,l-=d=-d),h&&(p=d*h,c+=(n.width-p)/2);break;case j:if(h){if(C.y<=0&&(l<=f||u>=v)){y=!1;break}M(R),d-=C.y,l+=C.y,p=d*h}else M(R),M(W),C.x>=0?u<v?p+=C.x:C.y<=0&&l<=f&&(y=!1):p+=C.x,C.y<=0?l>f&&(d-=C.y,l+=C.y):(d-=C.y,l+=C.y);p<0&&d<0?(s=I,l-=d=-d,c-=p=-p):p<0?(s=X,c-=p=-p):d<0&&(s=Y,l-=d=-d);break;case X:if(h){if(C.y<=0&&(l<=f||c<=g)){y=!1;break}M(R),d-=C.y,l+=C.y,p=d*h,c+=n.width-p}else M(R),M(S),C.x<=0?c>g?(p-=C.x,c+=C.x):C.y<=0&&l<=f&&(y=!1):(p-=C.x,c+=C.x),C.y<=0?l>f&&(d-=C.y,l+=C.y):(d-=C.y,l+=C.y);p<0&&d<0?(s=Y,l-=d=-d,c-=p=-p):p<0?(s=j,c-=p=-p):d<0&&(s=I,l-=d=-d);break;case I:if(h){if(C.x<=0&&(c<=g||m>=w)){y=!1;break}M(S),p-=C.x,c+=C.x,d=p/h}else M(H),M(S),C.x<=0?c>g?(p-=C.x,c+=C.x):C.y>=0&&m>=w&&(y=!1):(p-=C.x,c+=C.x),C.y>=0?m<w&&(d+=C.y):d+=C.y;p<0&&d<0?(s=j,l-=d=-d,c-=p=-p):p<0?(s=Y,c-=p=-p):d<0&&(s=X,l-=d=-d);break;case Y:if(h){if(C.x>=0&&(u>=v||m>=w)){y=!1;break}M(W),d=(p+=C.x)/h}else M(H),M(W),C.x>=0?u<v?p+=C.x:C.y>=0&&m>=w&&(y=!1):p+=C.x,C.y>=0?m<w&&(d+=C.y):d+=C.y;p<0&&d<0?(s=X,l-=d=-d,c-=p=-p):p<0?(s=I,c-=p=-p):d<0&&(s=j,l-=d=-d);break;case E:this.move(C.x,C.y),y=!1;break;case N:this.zoom(function(t){var e=b({},t),i=0;return Tt(t,(function(t,a){delete e[a],Tt(e,(function(e){var a=Math.abs(t.startX-e.startX),o=Math.abs(t.startY-e.startY),n=Math.abs(t.endX-e.endX),r=Math.abs(t.endY-e.endY),s=Math.sqrt(a*a+o*o),h=(Math.sqrt(n*n+r*r)-s)/s;Math.abs(h)>Math.abs(i)&&(i=h)}))})),i}(r),t),y=!1;break;case L:if(!C.x||!C.y){y=!1;break}e=$t(this.cropper),c=x.startX-e.left,l=x.startY-e.top,p=n.minWidth,d=n.minHeight,C.x>0?s=C.y>0?Y:j:C.x<0&&(c-=p,s=C.y>0?I:X),C.y<0&&(l-=d),this.cropped||(St(this.cropBox,F),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0))}y&&(n.width=p,n.height=d,n.left=c,n.top=l,this.action=s,this.renderCropBox()),Tt(r,(function(t){t.startX=t.endX,t.startY=t.endY}))}},he={crop:function(){return!this.ready||this.cropped||this.disabled||(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&Wt(this.dragBox,q),St(this.cropBox,F),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=zt({},this.initialImageData),this.canvasData=zt({},this.initialCanvasData),this.cropBoxData=zt({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(zt(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),St(this.dragBox,q),Wt(this.cropBox,F)),this},replace:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return!this.disabled&&t&&(this.isImg&&(this.element.src=t),e?(this.url=t,this.image.src=t,this.ready&&(this.viewBoxImage.src=t,Tt(this.previews,(function(e){e.getElementsByTagName("img")[0].src=t})))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(t))),this},enable:function(){return this.ready&&this.disabled&&(this.disabled=!1,St(this.cropper,P)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,Wt(this.cropper,P)),this},destroy:function(){var t=this.element;return t[z]?(t[z]=void 0,this.isImg&&this.replaced&&(t.src=this.originalUrl),this.uncreate(),this):this},move:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=this.canvasData,a=i.left,o=i.top;return this.moveTo(xt(t)?t:a+Number(t),xt(e)?e:o+Number(e))},moveTo:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=this.canvasData,a=!1;return t=Number(t),e=Number(e),this.ready&&!this.disabled&&this.options.movable&&(bt(t)&&(i.left=t,a=!0),bt(e)&&(i.top=e,a=!0),a&&this.renderCanvas(!0)),this},zoom:function(t,e){var i=this.canvasData;return t=(t=Number(t))<0?1/(1-t):1+t,this.zoomTo(i.width*t/i.naturalWidth,null,e)},zoomTo:function(t,e,i){var a=this.options,o=this.canvasData,n=o.width,r=o.height,s=o.naturalWidth,h=o.naturalHeight;if((t=Number(t))>=0&&this.ready&&!this.disabled&&a.zoomable){var c=s*t,l=h*t;if(!1===Kt(this.element,pt,{ratio:t,oldRatio:n/s,originalEvent:i}))return this;if(i){var p=this.pointers,d=$t(this.cropper),u=p&&Object.keys(p).length?function(t){var e=0,i=0,a=0;return Tt(t,(function(t){var o=t.startX,n=t.startY;e+=o,i+=n,a+=1})),{pageX:e/=a,pageY:i/=a}}(p):{pageX:i.pageX,pageY:i.pageY};o.left-=(c-n)*((u.pageX-d.left-o.left)/n),o.top-=(l-r)*((u.pageY-d.top-o.top)/r)}else kt(e)&&bt(e.x)&&bt(e.y)?(o.left-=(c-n)*((e.x-o.left)/n),o.top-=(l-r)*((e.y-o.top)/r)):(o.left-=(c-n)/2,o.top-=(l-r)/2);o.width=c,o.height=l,this.renderCanvas(!0)}return this},rotate:function(t){return this.rotateTo((this.imageData.rotate||0)+Number(t))},rotateTo:function(t){return bt(t=Number(t))&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=t%360,this.renderCanvas(!0,!0)),this},scaleX:function(t){var e=this.imageData.scaleY;return this.scale(t,bt(e)?e:1)},scaleY:function(t){var e=this.imageData.scaleX;return this.scale(bt(e)?e:1,t)},scale:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=this.imageData,a=!1;return t=Number(t),e=Number(e),this.ready&&!this.disabled&&this.options.scalable&&(bt(t)&&(i.scaleX=t,a=!0),bt(e)&&(i.scaleY=e,a=!0),a&&this.renderCanvas(!0,!0)),this},getData:function(){var t,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=this.options,a=this.imageData,o=this.canvasData,n=this.cropBoxData;if(this.ready&&this.cropped){t={x:n.left-o.left,y:n.top-o.top,width:n.width,height:n.height};var r=a.width/a.naturalWidth;if(Tt(t,(function(e,i){t[i]=e/r})),e){var s=Math.round(t.y+t.height),h=Math.round(t.x+t.width);t.x=Math.round(t.x),t.y=Math.round(t.y),t.width=h-t.x,t.height=s-t.y}}else t={x:0,y:0,width:0,height:0};return i.rotatable&&(t.rotate=a.rotate||0),i.scalable&&(t.scaleX=a.scaleX||1,t.scaleY=a.scaleY||1),t},setData:function(t){var e=this.options,i=this.imageData,a=this.canvasData,o={};if(this.ready&&!this.disabled&&kt(t)){var n=!1;e.rotatable&&bt(t.rotate)&&t.rotate!==i.rotate&&(i.rotate=t.rotate,n=!0),e.scalable&&(bt(t.scaleX)&&t.scaleX!==i.scaleX&&(i.scaleX=t.scaleX,n=!0),bt(t.scaleY)&&t.scaleY!==i.scaleY&&(i.scaleY=t.scaleY,n=!0)),n&&this.renderCanvas(!0,!0);var r=i.width/i.naturalWidth;bt(t.x)&&(o.left=t.x*r+a.left),bt(t.y)&&(o.top=t.y*r+a.top),bt(t.width)&&(o.width=t.width*r),bt(t.height)&&(o.height=t.height*r),this.setCropBoxData(o)}return this},getContainerData:function(){return this.ready?zt({},this.containerData):{}},getImageData:function(){return this.sized?zt({},this.imageData):{}},getCanvasData:function(){var t=this.canvasData,e={};return this.ready&&Tt(["left","top","width","height","naturalWidth","naturalHeight"],(function(i){e[i]=t[i]})),e},setCanvasData:function(t){var e=this.canvasData,i=e.aspectRatio;return this.ready&&!this.disabled&&kt(t)&&(bt(t.left)&&(e.left=t.left),bt(t.top)&&(e.top=t.top),bt(t.width)?(e.width=t.width,e.height=t.width/i):bt(t.height)&&(e.height=t.height,e.width=t.height*i),this.renderCanvas(!0)),this},getCropBoxData:function(){var t,e=this.cropBoxData;return this.ready&&this.cropped&&(t={left:e.left,top:e.top,width:e.width,height:e.height}),t||{}},setCropBoxData:function(t){var e,i,a=this.cropBoxData,o=this.options.aspectRatio;return this.ready&&this.cropped&&!this.disabled&&kt(t)&&(bt(t.left)&&(a.left=t.left),bt(t.top)&&(a.top=t.top),bt(t.width)&&t.width!==a.width&&(e=!0,a.width=t.width),bt(t.height)&&t.height!==a.height&&(i=!0,a.height=t.height),o&&(e?a.height=a.width/o:i&&(a.width=a.height*o)),this.renderCropBox()),this},getCroppedCanvas:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var e=this.canvasData,i=function(t,e,i,a){var o=e.aspectRatio,n=e.naturalWidth,r=e.naturalHeight,s=e.rotate,h=void 0===s?0:s,c=e.scaleX,l=void 0===c?1:c,p=e.scaleY,d=void 0===p?1:p,u=i.aspectRatio,m=i.naturalWidth,g=i.naturalHeight,f=a.fillColor,v=void 0===f?"transparent":f,w=a.imageSmoothingEnabled,b=void 0===w||w,y=a.imageSmoothingQuality,x=void 0===y?"low":y,C=a.maxWidth,k=void 0===C?1/0:C,D=a.maxHeight,A=void 0===D?1/0:D,B=a.minWidth,T=void 0===B?0:B,z=a.minHeight,O=void 0===z?0:z,L=document.createElement("canvas"),E=L.getContext("2d"),N=_t({aspectRatio:u,width:k,height:A}),W=_t({aspectRatio:u,width:T,height:O},"cover"),S=Math.min(N.width,Math.max(W.width,m)),H=Math.min(N.height,Math.max(W.height,g)),R=_t({aspectRatio:o,width:k,height:A}),j=_t({aspectRatio:o,width:T,height:O},"cover"),X=Math.min(R.width,Math.max(j.width,n)),Y=Math.min(R.height,Math.max(j.height,r)),I=[-X/2,-Y/2,X,Y];return L.width=Lt(S),L.height=Lt(H),E.fillStyle=v,E.fillRect(0,0,S,H),E.save(),E.translate(S/2,H/2),E.rotate(h*Math.PI/180),E.scale(l,d),E.imageSmoothingEnabled=b,E.imageSmoothingQuality=x,E.drawImage.apply(E,[t].concat(M(I.map((function(t){return Math.floor(Lt(t))}))))),E.restore(),L}(this.image,this.imageData,e,t);if(!this.cropped)return i;var a=this.getData(),o=a.x,n=a.y,r=a.width,s=a.height,h=i.width/Math.floor(e.naturalWidth);1!==h&&(o*=h,n*=h,r*=h,s*=h);var c=r/s,l=_t({aspectRatio:c,width:t.maxWidth||1/0,height:t.maxHeight||1/0}),p=_t({aspectRatio:c,width:t.minWidth||0,height:t.minHeight||0},"cover"),d=_t({aspectRatio:c,width:t.width||(1!==h?i.width:r),height:t.height||(1!==h?i.height:s)}),u=d.width,m=d.height;u=Math.min(l.width,Math.max(p.width,u)),m=Math.min(l.height,Math.max(p.height,m));var g=document.createElement("canvas"),f=g.getContext("2d");g.width=Lt(u),g.height=Lt(m),f.fillStyle=t.fillColor||"transparent",f.fillRect(0,0,u,m);var v=t.imageSmoothingEnabled,w=void 0===v||v,b=t.imageSmoothingQuality;f.imageSmoothingEnabled=w,b&&(f.imageSmoothingQuality=b);var y,x,C,k,D,A,B=i.width,T=i.height,z=o,O=n;z<=-r||z>B?(z=0,y=0,C=0,D=0):z<=0?(C=-z,z=0,D=y=Math.min(B,r+z)):z<=B&&(C=0,D=y=Math.min(r,B-z)),y<=0||O<=-s||O>T?(O=0,x=0,k=0,A=0):O<=0?(k=-O,O=0,A=x=Math.min(T,s+O)):O<=T&&(k=0,A=x=Math.min(s,T-O));var L=[z,O,y,x];if(D>0&&A>0){var E=u/r;L.push(C*E,k*E,D*E,A*E)}return f.drawImage.apply(f,[i].concat(M(L.map((function(t){return Math.floor(Lt(t))}))))),g},setAspectRatio:function(t){var e=this.options;return this.disabled||xt(t)||(e.aspectRatio=Math.max(0,t)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function(t){var e=this.options,i=this.dragBox,a=this.face;if(this.ready&&!this.disabled){var o=t===G,n=e.movable&&t===J;t=o||n?t:_,e.dragMode=t,Yt(i,V,t),Ht(i,U,o),Ht(i,Q,n),e.cropBoxMovable||(Yt(a,V,t),Ht(a,U,o),Ht(a,Q,n))}return this}},ce=A.Cropper,le=function(){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e||!ft.test(e.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=e,this.options=zt({},vt,kt(i)&&i),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,this.sized=!1,this.sizing=!1,this.init()}var e,i,a;return e=t,i=[{key:"init",value:function(){var t,e=this.element,i=e.tagName.toLowerCase();if(!e[z]){if(e[z]=this,"img"===i){if(this.isImg=!0,t=e.getAttribute("src")||"",this.originalUrl=t,!t)return;t=e.src}else"canvas"===i&&window.HTMLCanvasElement&&(t=e.toDataURL());this.load(t)}}},{key:"load",value:function(t){var e=this;if(t){this.url=t,this.imageData={};var i=this.element,a=this.options;if(a.rotatable||a.scalable||(a.checkOrientation=!1),a.checkOrientation&&window.ArrayBuffer)if(mt.test(t))gt.test(t)?this.read((o=t.replace(ee,""),n=atob(o),r=new ArrayBuffer(n.length),Tt(s=new Uint8Array(r),(function(t,e){s[e]=n.charCodeAt(e)})),r)):this.clone();else{var o,n,r,s,h=new XMLHttpRequest,c=this.clone.bind(this);this.reloading=!0,this.xhr=h,h.onabort=c,h.onerror=c,h.ontimeout=c,h.onprogress=function(){h.getResponseHeader("content-type")!==dt&&h.abort()},h.onload=function(){e.read(h.response)},h.onloadend=function(){e.reloading=!1,e.xhr=null},a.checkCrossOrigin&&Vt(t)&&i.crossOrigin&&(t=Zt(t)),h.open("GET",t,!0),h.responseType="arraybuffer",h.withCredentials="use-credentials"===i.crossOrigin,h.send()}else this.clone()}}},{key:"read",value:function(t){var e=this.options,i=this.imageData,a=ie(t),o=0,n=1,r=1;if(a>1){this.url=function(t,e){for(var i=[],a=new Uint8Array(t);a.length>0;)i.push(te.apply(null,Bt(a.subarray(0,8192)))),a=a.subarray(8192);return"data:".concat(e,";base64,").concat(btoa(i.join("")))}(t,dt);var s=function(t){var e=0,i=1,a=1;switch(t){case 2:i=-1;break;case 3:e=-180;break;case 4:a=-1;break;case 5:e=90,a=-1;break;case 6:e=90;break;case 7:e=90,i=-1;break;case 8:e=-90}return{rotate:e,scaleX:i,scaleY:a}}(a);o=s.rotate,n=s.scaleX,r=s.scaleY}e.rotatable&&(i.rotate=o),e.scalable&&(i.scaleX=n,i.scaleY=r),this.clone()}},{key:"clone",value:function(){var t=this.element,e=this.url,i=t.crossOrigin,a=e;this.options.checkCrossOrigin&&Vt(e)&&(i||(i="anonymous"),a=Zt(e)),this.crossOrigin=i,this.crossOriginUrl=a;var o=document.createElement("img");i&&(o.crossOrigin=i),o.src=a||e,o.alt=t.alt||"The image to crop",this.image=o,o.onload=this.start.bind(this),o.onerror=this.stop.bind(this),Wt(o,K),t.parentNode.insertBefore(o,t.nextSibling)}},{key:"start",value:function(){var t=this,e=this.image;e.onload=null,e.onerror=null,this.sizing=!0;var i=A.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(A.navigator.userAgent),a=function(e,i){zt(t.imageData,{naturalWidth:e,naturalHeight:i,aspectRatio:e/i}),t.initialImageData=zt({},t.imageData),t.sizing=!1,t.sized=!0,t.build()};if(!e.naturalWidth||i){var o=document.createElement("img"),n=document.body||document.documentElement;this.sizingImage=o,o.onload=function(){a(o.width,o.height),i||n.removeChild(o)},o.src=e.src,i||(o.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",n.appendChild(o))}else a(e.naturalWidth,e.naturalHeight)}},{key:"stop",value:function(){var t=this.image;t.onload=null,t.onerror=null,t.parentNode.removeChild(t),this.image=null}},{key:"build",value:function(){if(this.sized&&!this.ready){var t=this.element,e=this.options,i=this.image,a=t.parentNode,o=document.createElement("div");o.innerHTML='<div class="cropper-container" touch-action="none"><div class="cropper-wrap-box"><div class="cropper-canvas"></div></div><div class="cropper-drag-box"></div><div class="cropper-crop-box"><span class="cropper-view-box"></span><span class="cropper-dashed dashed-h"></span><span class="cropper-dashed dashed-v"></span><span class="cropper-center"></span><span class="cropper-face"></span><span class="cropper-line line-e" data-cropper-action="e"></span><span class="cropper-line line-n" data-cropper-action="n"></span><span class="cropper-line line-w" data-cropper-action="w"></span><span class="cropper-line line-s" data-cropper-action="s"></span><span class="cropper-point point-e" data-cropper-action="e"></span><span class="cropper-point point-n" data-cropper-action="n"></span><span class="cropper-point point-w" data-cropper-action="w"></span><span class="cropper-point point-s" data-cropper-action="s"></span><span class="cropper-point point-ne" data-cropper-action="ne"></span><span class="cropper-point point-nw" data-cropper-action="nw"></span><span class="cropper-point point-sw" data-cropper-action="sw"></span><span class="cropper-point point-se" data-cropper-action="se"></span></div></div>';var n=o.querySelector(".".concat(z,"-container")),r=n.querySelector(".".concat(z,"-canvas")),s=n.querySelector(".".concat(z,"-drag-box")),h=n.querySelector(".".concat(z,"-crop-box")),c=h.querySelector(".".concat(z,"-face"));this.container=a,this.cropper=n,this.canvas=r,this.dragBox=s,this.cropBox=h,this.viewBox=n.querySelector(".".concat(z,"-view-box")),this.face=c,r.appendChild(i),Wt(t,F),a.insertBefore(n,t.nextSibling),St(i,K),this.initPreview(),this.bind(),e.initialAspectRatio=Math.max(0,e.initialAspectRatio)||NaN,e.aspectRatio=Math.max(0,e.aspectRatio)||NaN,e.viewMode=Math.max(0,Math.min(3,Math.round(e.viewMode)))||0,Wt(h,F),e.guides||Wt(h.getElementsByClassName("".concat(z,"-dashed")),F),e.center||Wt(h.getElementsByClassName("".concat(z,"-center")),F),e.background&&Wt(n,"".concat(z,"-bg")),e.highlight||Wt(c,$),e.cropBoxMovable&&(Wt(c,Q),Yt(c,V,O)),e.cropBoxResizable||(Wt(h.getElementsByClassName("".concat(z,"-line")),F),Wt(h.getElementsByClassName("".concat(z,"-point")),F)),this.render(),this.ready=!0,this.setDragMode(e.dragMode),e.autoCrop&&this.crop(),this.setData(e.data),Dt(e.ready)&&Ft(t,ht,e.ready,{once:!0}),Kt(t,ht)}}},{key:"unbuild",value:function(){if(this.ready){this.ready=!1,this.unbind(),this.resetPreview();var t=this.cropper.parentNode;t&&t.removeChild(this.cropper),St(this.element,F)}}},{key:"uncreate",value:function(){this.ready?(this.unbuild(),this.ready=!1,this.cropped=!1):this.sizing?(this.sizingImage.onload=null,this.sizing=!1,this.sized=!1):this.reloading?(this.xhr.onabort=null,this.xhr.abort()):this.image&&this.stop()}}],a=[{key:"noConflict",value:function(){return window.Cropper=ce,t}},{key:"setDefaults",value:function(t){zt(vt,kt(t)&&t)}}],i&&x(e.prototype,i),a&&x(e,a),Object.defineProperty(e,"prototype",{writable:!1}),t}();zt(le.prototype,ae,oe,ne,re,se,he);const pe=a({name:"copper-image",emits:["close","cropperNo","cropperOk"],setup(t,{emit:e,expose:i}){const a=o({visible:!1,img:null,confirmLoading:!1,options:{img:"",autoCrop:!0,autoCropWidth:180,autoCropHeight:180,fixedBox:!0,full:!1,enlarge:1,previewsCircle:!0,centerBox:!0,outputType:"png",title:"修改头像",name:null},previews:{},url:{upload:"/sys/common/saveToImgByStr"},myCropper:null}),u=n(),m=()=>{a.myCropper=new le(u.value,{viewMode:1,dragMode:"move",aspectRatio:a.options.autoCropWidth/a.options.autoCropHeight,initialAspectRatio:1,autoCropArea:1,cropBoxMovable:!0,cropBoxResizable:!1,background:!0,movable:!0,modal:!0,preview:".before"})},g=t=>{switch(t){case"left":a.myCropper.rotate(90);break;case"right":a.myCropper.rotate(-90);break;case"zoomIn":a.myCropper.zoom(.1);break;case"zoomOut":a.myCropper.zoom(-.1)}},f=()=>{a.confirmLoading=!0,a.myCropper.getCroppedCanvas({imageSmoothingQuality:"high"}).toBlob((t=>{console.log(t,"1212"),e("cropperOk",t),a.confirmLoading=!1}))};return i({edit:t=>{const{options:e}=a;a.visible=!0,a.options=Object.assign({},e,t),d((()=>{m()}))}}),()=>r("div",null,[r(s,{cols:2,xGap:24,style:{paddingTop:"12px"}},{default:()=>[r(h,null,{default:()=>[r("div",{style:"width: 100%; height: 300px"},[r("img",{ref:u,id:"myImages",src:a.options.img,alt:""},null)]),r(c,{justify:"center",style:{paddingTop:"12px"}},{default:()=>[r(l,{type:"primary",size:"small",onClick:()=>g("left")},{default:()=>[p("逆时针旋转")]}),r(l,{type:"primary",size:"small",onClick:()=>g("right")},{default:()=>[p("顺时针旋转")]}),r(l,{type:"primary",size:"small",onClick:()=>g("zoomIn")},{default:()=>[p("放大")]}),r(l,{type:"primary",size:"small",onClick:()=>g("zoomOut")},{default:()=>[p("缩小")]})]})]}),r(h,null,{default:()=>[r("span",{style:{fontSize:"15px",fontWeight:600,paddingBottom:"8px",display:"inline-block"}},[p("预览图片")]),r("div",{class:"before",style:{width:a.options.autoCropWidth+"px",height:a.options.autoCropHeight+"px",overflow:"hidden"}},null)]})]}),r(c,{justify:"end"},{default:()=>[r(l,{type:"default",onClick:()=>{a.confirmLoading=!1,e("close"),e("cropperNo")}},{default:()=>[p("取消")]}),r(l,{type:"primary",loading:a.confirmLoading,onClick:f},{default:()=>[p("确认")]})]})])}});t("U",a({name:"upload-file",props:{fileList:{type:String,default:""},imageList:{type:Array,default:()=>[]},accept:{type:String,default:".jpg,.png,.jpeg,.gif"},listType:{type:String,default:"image-card"},showType:{type:String,default:"default"},showFileList:{type:Boolean,default:!0},text:{type:String,default:"上传文件"},size:{type:Number,default:5},max:{type:Number,default:1},multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},tips:{type:String,default:""},bucketName:{type:String,default:"gyt"},path:{type:String,default:""},fileName:{type:String,default:""},cropper:{type:Boolean,default:!1},options:{type:Object,default:()=>({viewMode:0,autoCrop:!0,enlarge:1,autoCropWidth:200,autoCropHeight:200,fixedBox:!1,previewsCircle:!0,title:"上传图片"})}},emits:["update:fileList","close","readFileInputEventAsArrayBuffer","remove"],setup(t,{emit:i,expose:a,slots:s}){const h=`https://${t.bucketName}.ks3-cn-beijing.ksyuncs.com/`,c=u(),p=n(!1),d=n(!1),w=n(),b=n(),y=o({policy:"",signature:"",key:"",KSSAccessKeyId:"",acl:"public-read",name:""}),x=n([]),C=()=>{if(t.fileList){const e=t.fileList.split("/");x.value=[{id:(new Date).getTime().toString(),name:e[e.length-1],status:"finished",url:t.fileList}]}else if(Array.isArray(t.imageList)){const e=[];t.imageList.forEach((t=>{const i=t.split("/");e.push({id:Date.now().toString(),name:i[i.length-1],status:"finished",url:t})})),x.value=e}else x.value=[]};C(),m((()=>t.imageList),(()=>{C()})),m((()=>t.fileList),(()=>{console.log("list"),C()})),a({handleClearFile:()=>{b.value?.clear(),console.log("清空",b.value)}});const M=n(),k=async(t,e)=>{const i=new FileReader;i.addEventListener("load",(()=>e(i.result))),i.readAsDataURL(t)},D=async a=>{try{const o=`${t.path}${t.fileName||(new Date).getTime()+".png"}`,n={filename:o,bucketName:t.bucketName,postData:{filename:o,acl:"public-read",key:o,unknowValueField:[]}},{data:r}=await e(n);y.policy=r.policy,y.signature=r.signature,y.key=o,y.KSSAccessKeyId=r.kssAccessKeyId,y.name=o;const s=new FormData;for(const t in y)s.append(t,y[t]);s.append("file",a),await v.post(h,s).then((()=>{const t=h+y.key;console.log(t,"url");const e=t.split("/");x.value=[{id:(new Date).getTime().toString(),name:e[e.length-1],status:"finished",url:t}],i("update:fileList",t),p.value=!1}))}catch{return!1}};return()=>r("div",null,[r(g,{ref:b,action:h,data:y,fileList:x.value,"onUpdate:fileList":t=>x.value=t,listType:t.listType,accept:t.accept,multiple:t.multiple,max:t.max,disabled:t.disabled,showFileList:t.showFileList,showPreviewButton:!0,onBeforeUpload:i=>(async i=>{const a=i.file;let o=!0;if(t.size&&(o=a.file.size/1024/1024<t.size,!o))return c.error(`文件大小不能超过${t.size}M`),!1;if(!o)return o;if(t.cropper)return k(a.file,(e=>{const i=Object.assign({},t.options,{img:e,name:a.file.name});p.value=!0,setTimeout((()=>{M.value?.edit(i),console.log(M.value,"cropper")}),100)})),!1;try{d.value=!0,console.log(t.path,a.file);const i=a.file.name,o=i.slice(i.lastIndexOf(".")),n=`${t.path}${t.fileName||Date.now()+o}`,r={filename:n,bucketName:t.bucketName,postData:{filename:n,acl:"public-read",key:n,unknowValueField:[]}},{data:s}=await e(r);y.policy=s.policy,y.signature=s.signature,y.key=n,y.KSSAccessKeyId=s.kssAccessKeyId,y.name=n,w.value=a.file}catch{return d.value=!1,!1}return!0})(i),onFinish:t=>(t=>{const e=h+y.key;console.log(e,"url"),i("update:fileList",e),i("readFileInputEventAsArrayBuffer",w.value),t.file.url=e,p.value=!1,d.value=!1})(t),onRemove:t=>(async t=>{console.log("🚀 ~ options",t),i("update:fileList",""),i("remove"),d.value=!1})(t)},{default:()=>["default"===t.showType&&"image"===t.listType&&r(l,{loading:d.value,type:"primary"},{default:()=>[t.text]}),"custom"===t.showType&&s.custom&&s.custom()]}),t.tips&&r("p",{style:"font-size: 13px; color: #666; padding-top: 4px;"},[t.tips]),r(f,{show:p.value,"onUpdate:show":t=>p.value=t,preset:"dialog",showIcon:!1,class:["modalTitle background"],title:"上传图片",style:{width:"800px"}},{default:()=>[r(pe,{ref:M,onClose:()=>p.value=!1,onCropperOk:D},null)]})])}}))}}}));