diff --git a/CHANGELOG.md b/CHANGELOG.md index e4d4e7d6b..0c8726d86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,12 @@ # Changelog -## 0.3.2 (Nov 20, 2015) +## 0.3.3 (Nov 30, 2015) + +- Floor the numerical parameters for `CanvasRenderingContext2D.drawImage` + + +## 0.3.2 (Nov 18, 2015) - Fixed #10: improve new crop box creating diff --git a/README.md b/README.md index 3f5d00055..7d0501dbc 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# [Cropper](https://github.com/fengyuanchen/cropperjs) +# [Cropper.js](https://github.com/fengyuanchen/cropperjs) > JavaScript image cropper. @@ -28,7 +28,7 @@ dist/ ├── cropper.css ( 5 KB) ├── cropper.min.css ( 4 KB) -├── cropper.js (78 KB) +├── cropper.js (80 KB) └── cropper.min.js (28 KB) ``` diff --git a/bower.json b/bower.json index bb5bfa96d..04bce7700 100644 --- a/bower.json +++ b/bower.json @@ -8,12 +8,14 @@ "keywords": [ "image", "crop", - "cropper", "cropping", "move", "zoom", "rotate", "scale", + "cropper", + "cropperjs", + "cropper.js", "html", "css", "javascript", diff --git a/dist/cropper.css b/dist/cropper.css index 1b9fc85f5..972c32828 100644 --- a/dist/cropper.css +++ b/dist/cropper.css @@ -1,11 +1,11 @@ /*! - * Cropper v0.3.2 + * Cropper v0.3.3 * https://github.com/fengyuanchen/cropperjs * * Copyright (c) 2015 Fengyuan Chen * Released under the MIT license * - * Date: 2015-11-18T02:52:53.353Z + * Date: 2015-11-30T02:54:22.268Z */ .cropper-container { position: relative; @@ -27,7 +27,7 @@ width: 100%; min-width: 0 !important; max-width: none !important; - height: 100%; + height: 100%; min-height: 0 !important; max-height: none !important; @@ -52,20 +52,20 @@ .cropper-drag-box { background-color: #fff; - filter: alpha(opacity=0); + filter: alpha(opacity=0); opacity: 0; } .cropper-modal { background-color: #000; - filter: alpha(opacity=50); + filter: alpha(opacity=50); opacity: .5; } .cropper-view-box { display: block; width: 100%; - height: 100%; + height: 100%; overflow: hidden; outline: 1px solid #39f; outline-color: rgba(51, 153, 255, .75); @@ -74,7 +74,7 @@ .cropper-dashed { position: absolute; display: block; - filter: alpha(opacity=50); + filter: alpha(opacity=50); border: 0 dashed #eee; opacity: .5; } @@ -82,7 +82,7 @@ top: 33.33333%; left: 0; width: 100%; - height: 33.33333%; + height: 33.33333%; border-top-width: 1px; border-bottom-width: 1px; } @@ -90,7 +90,7 @@ top: 0; left: 33.33333%; width: 33.33333%; - height: 100%; + height: 100%; border-right-width: 1px; border-left-width: 1px; } @@ -102,13 +102,13 @@ display: block; width: 0; height: 0; - filter: alpha(opacity=75); + filter: alpha(opacity=75); opacity: .75; } .cropper-center:before, .cropper-center:after { position: absolute; display: block; - content: " "; + content: " "; background-color: #eee; } .cropper-center:before { @@ -131,7 +131,7 @@ display: block; width: 100%; height: 100%; - filter: alpha(opacity=10); + filter: alpha(opacity=10); opacity: .1; } @@ -173,7 +173,7 @@ width: 5px; height: 5px; background-color: #39f; - filter: alpha(opacity=75); + filter: alpha(opacity=75); opacity: .75; } .cropper-point.point-e { @@ -221,7 +221,7 @@ width: 20px; height: 20px; cursor: se-resize; - filter: alpha(opacity=100); + filter: alpha(opacity=100); opacity: 1; } .cropper-point.point-se:before { @@ -233,7 +233,7 @@ height: 200%; content: " "; background-color: #39f; - filter: alpha(opacity=0); + filter: alpha(opacity=0); opacity: 0; } @media (min-width: 768px) { @@ -252,20 +252,20 @@ .cropper-point.point-se { width: 5px; height: 5px; - filter: alpha(opacity=75); + filter: alpha(opacity=75); opacity: .75; } } -.cropper-bg { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC"); -} - .cropper-invisible { - filter: alpha(opacity=0); + filter: alpha(opacity=0); opacity: 0; } +.cropper-bg { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC"); +} + .cropper-hide { position: absolute; display: block; diff --git a/dist/cropper.js b/dist/cropper.js index 5b98a36c4..389d7698a 100644 --- a/dist/cropper.js +++ b/dist/cropper.js @@ -1,11 +1,11 @@ /*! - * Cropper v0.3.2 + * Cropper v0.3.3 * https://github.com/fengyuanchen/cropperjs * * Copyright (c) 2015 Fengyuan Chen * Released under the MIT license * - * Date: 2015-11-18T02:52:57.879Z + * Date: 2015-11-30T02:54:53.110Z */ (function (global, factory) { @@ -87,10 +87,11 @@ var cos = Math.cos; var sqrt = Math.sqrt; var round = Math.round; + var floor = Math.floor; // Prototype var prototype = { - version: '0.3.2' + version: '0.3.3' }; // Utilities @@ -560,7 +561,7 @@ context.scale(scaleX, scaleY); } - context.drawImage(image, x, y, width, height); + context.drawImage(image, floor(x), floor(y), floor(width), floor(height)); if (advanced) { context.restore(); @@ -2784,7 +2785,7 @@ srcHeight = dstHeight = min(originalHeight, sourceHeight - srcY); } - args.push(srcX, srcY, srcWidth, srcHeight); + args.push(floor(srcX), floor(srcY), floor(srcWidth), floor(srcHeight)); // Scale destination sizes if (scaledRatio) { @@ -2796,7 +2797,7 @@ // Avoid "IndexSizeError" in IE and Firefox if (dstWidth > 0 && dstHeight > 0) { - args.push(dstX, dstY, dstWidth, dstHeight); + args.push(floor(dstX), floor(dstY), floor(dstWidth), floor(dstHeight)); } return args; diff --git a/dist/cropper.min.css b/dist/cropper.min.css index 1f6d6e030..e1bfe7184 100644 --- a/dist/cropper.min.css +++ b/dist/cropper.min.css @@ -1,9 +1,9 @@ /*! - * Cropper v0.3.2 + * Cropper v0.3.3 * https://github.com/fengyuanchen/cropperjs * * Copyright (c) 2015 Fengyuan Chen * Released under the MIT license * - * Date: 2015-11-18T02:52:53.353Z - */.cropper-container{position:relative;font-size:0;line-height:0;-ms-touch-action:none;touch-action:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;direction:ltr!important;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none}.cropper-container img{display:block;width:100%;min-width:0!important;max-width:none!important;height:100%;min-height:0!important;max-height:none!important;image-orientation:0deg!important}.cropper-canvas,.cropper-crop-box,.cropper-drag-box,.cropper-modal,.cropper-wrap-box{position:absolute;top:0;right:0;bottom:0;left:0}.cropper-wrap-box{overflow:hidden}.cropper-drag-box{background-color:#fff;filter:alpha(opacity=0);opacity:0}.cropper-dashed,.cropper-modal{filter:alpha(opacity=50);opacity:.5}.cropper-modal{background-color:#000}.cropper-view-box{display:block;width:100%;height:100%;overflow:hidden;outline:#39f solid 1px;outline-color:rgba(51,153,255,.75)}.cropper-dashed{position:absolute;display:block;border:0 dashed #eee}.cropper-dashed.dashed-h{top:33.33333%;left:0;width:100%;height:33.33333%;border-top-width:1px;border-bottom-width:1px}.cropper-dashed.dashed-v{top:0;left:33.33333%;width:33.33333%;height:100%;border-right-width:1px;border-left-width:1px}.cropper-center{position:absolute;top:50%;left:50%;display:block;width:0;height:0;filter:alpha(opacity=75);opacity:.75}.cropper-center:after,.cropper-center:before{position:absolute;display:block;content:" ";background-color:#eee}.cropper-center:before{top:0;left:-3px;width:7px;height:1px}.cropper-center:after{top:-3px;left:0;width:1px;height:7px}.cropper-face,.cropper-line,.cropper-point{position:absolute;display:block;width:100%;height:100%;filter:alpha(opacity=10);opacity:.1}.cropper-face{top:0;left:0;background-color:#fff}.cropper-line,.cropper-point{background-color:#39f}.cropper-line.line-e{top:0;right:-3px;width:5px;cursor:e-resize}.cropper-line.line-n{top:-3px;left:0;height:5px;cursor:n-resize}.cropper-line.line-w{top:0;left:-3px;width:5px;cursor:w-resize}.cropper-line.line-s{bottom:-3px;left:0;height:5px;cursor:s-resize}.cropper-point{width:5px;height:5px;filter:alpha(opacity=75);opacity:.75}.cropper-point.point-e{top:50%;right:-3px;margin-top:-3px;cursor:e-resize}.cropper-point.point-n{top:-3px;left:50%;margin-left:-3px;cursor:n-resize}.cropper-point.point-w{top:50%;left:-3px;margin-top:-3px;cursor:w-resize}.cropper-point.point-s{bottom:-3px;left:50%;margin-left:-3px;cursor:s-resize}.cropper-point.point-ne{top:-3px;right:-3px;cursor:ne-resize}.cropper-point.point-nw{top:-3px;left:-3px;cursor:nw-resize}.cropper-point.point-sw{bottom:-3px;left:-3px;cursor:sw-resize}.cropper-point.point-se{right:-3px;bottom:-3px;width:20px;height:20px;cursor:se-resize;filter:alpha(opacity=100);opacity:1}.cropper-point.point-se:before{position:absolute;right:-50%;bottom:-50%;display:block;width:200%;height:200%;content:" ";background-color:#39f;filter:alpha(opacity=0);opacity:0}@media (min-width:768px){.cropper-point.point-se{width:15px;height:15px}}@media (min-width:992px){.cropper-point.point-se{width:10px;height:10px}}@media (min-width:1200px){.cropper-point.point-se{width:5px;height:5px;filter:alpha(opacity=75);opacity:.75}}.cropper-bg{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC)}.cropper-invisible{filter:alpha(opacity=0);opacity:0}.cropper-hide{position:absolute;display:block;width:0;height: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} \ No newline at end of file + * Date: 2015-11-30T02:54:22.268Z + */.cropper-container{position:relative;font-size:0;line-height:0;-ms-touch-action:none;touch-action:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;direction:ltr!important;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none}.cropper-container img{display:block;width:100%;min-width:0!important;max-width:none!important;height:100%;min-height:0!important;max-height:none!important;image-orientation:0deg!important}.cropper-canvas,.cropper-crop-box,.cropper-drag-box,.cropper-modal,.cropper-wrap-box{position:absolute;top:0;right:0;bottom:0;left:0}.cropper-wrap-box{overflow:hidden}.cropper-drag-box{background-color:#fff;filter:alpha(opacity=0);opacity:0}.cropper-dashed,.cropper-modal{filter:alpha(opacity=50);opacity:.5}.cropper-modal{background-color:#000}.cropper-view-box{display:block;width:100%;height:100%;overflow:hidden;outline:#39f solid 1px;outline-color:rgba(51,153,255,.75)}.cropper-dashed{position:absolute;display:block;border:0 dashed #eee}.cropper-dashed.dashed-h{top:33.33333%;left:0;width:100%;height:33.33333%;border-top-width:1px;border-bottom-width:1px}.cropper-dashed.dashed-v{top:0;left:33.33333%;width:33.33333%;height:100%;border-right-width:1px;border-left-width:1px}.cropper-center{position:absolute;top:50%;left:50%;display:block;width:0;height:0;filter:alpha(opacity=75);opacity:.75}.cropper-center:after,.cropper-center:before{position:absolute;display:block;content:" ";background-color:#eee}.cropper-center:before{top:0;left:-3px;width:7px;height:1px}.cropper-center:after{top:-3px;left:0;width:1px;height:7px}.cropper-face,.cropper-line,.cropper-point{position:absolute;display:block;width:100%;height:100%;filter:alpha(opacity=10);opacity:.1}.cropper-face{top:0;left:0;background-color:#fff}.cropper-line,.cropper-point{background-color:#39f}.cropper-line.line-e{top:0;right:-3px;width:5px;cursor:e-resize}.cropper-line.line-n{top:-3px;left:0;height:5px;cursor:n-resize}.cropper-line.line-w{top:0;left:-3px;width:5px;cursor:w-resize}.cropper-line.line-s{bottom:-3px;left:0;height:5px;cursor:s-resize}.cropper-point{width:5px;height:5px;filter:alpha(opacity=75);opacity:.75}.cropper-point.point-e{top:50%;right:-3px;margin-top:-3px;cursor:e-resize}.cropper-point.point-n{top:-3px;left:50%;margin-left:-3px;cursor:n-resize}.cropper-point.point-w{top:50%;left:-3px;margin-top:-3px;cursor:w-resize}.cropper-point.point-s{bottom:-3px;left:50%;margin-left:-3px;cursor:s-resize}.cropper-point.point-ne{top:-3px;right:-3px;cursor:ne-resize}.cropper-point.point-nw{top:-3px;left:-3px;cursor:nw-resize}.cropper-point.point-sw{bottom:-3px;left:-3px;cursor:sw-resize}.cropper-point.point-se{right:-3px;bottom:-3px;width:20px;height:20px;cursor:se-resize;filter:alpha(opacity=100);opacity:1}.cropper-point.point-se:before{position:absolute;right:-50%;bottom:-50%;display:block;width:200%;height:200%;content:" ";background-color:#39f;filter:alpha(opacity=0);opacity:0}@media (min-width:768px){.cropper-point.point-se{width:15px;height:15px}}@media (min-width:992px){.cropper-point.point-se{width:10px;height:10px}}@media (min-width:1200px){.cropper-point.point-se{width:5px;height:5px;filter:alpha(opacity=75);opacity:.75}}.cropper-invisible{filter:alpha(opacity=0);opacity:0}.cropper-bg{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC)}.cropper-hide{position:absolute;display:block;width:0;height: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} \ No newline at end of file diff --git a/dist/cropper.min.js b/dist/cropper.min.js index f5a492d98..53e77c696 100644 --- a/dist/cropper.min.js +++ b/dist/cropper.min.js @@ -1,10 +1,10 @@ /*! - * Cropper v0.3.2 + * Cropper v0.3.3 * https://github.com/fengyuanchen/cropperjs * * Copyright (c) 2015 Fengyuan Chen * Released under the MIT license * - * Date: 2015-11-18T02:52:57.879Z + * Date: 2015-11-30T02:54:53.110Z */ -!function(t,i){"object"==typeof module&&"object"==typeof module.exports?module.exports=t.document?i(t,!0):function(t){if(!t.document)throw new Error("Cropper requires a window with a document");return i(t)}:i(t)}("undefined"!=typeof window?window:this,function(t,i){"use strict";function e(t){return It.call(t).slice(8,-1).toLowerCase()}function a(t){return"string"==typeof t}function s(t){return"number"==typeof t&&!isNaN(t)}function h(t){return"undefined"==typeof t}function n(t){return"object"==typeof t&&null!==t}function o(t){var i,e;if(!n(t))return!1;try{return i=t.constructor,e=i.prototype,i&&e&&Nt.call(e,"isPrototypeOf")}catch(a){return!1}}function r(t){return"function"===e(t)}function p(t){return Array.isArray?Array.isArray(t):"array"===e(t)}function l(t,i){var e=[];return s(i)&&e.push(i),e.slice.apply(t,e)}function c(t,i){var e=-1;return u(i,function(i,a){return i===t?(e=a,!1):void 0}),e}function d(t){return a(t)||(t=String(t)),t=t.trim?t.trim():t.replace(lt,"$1")}function u(t,i){var e,a;if(t&&r(i))if(p(t)||s(t.length))for(a=0,e=t.length;e>a&&i.call(t,t[a],a,t)!==!1;a++);else if(n(t))for(a in t)if(Nt.call(t,a)&&i.call(t,t[a],a,t)===!1)break;return t}function g(t){var i=l(arguments);return i.length>1&&i.shift(),u(i,function(i){u(i,function(i,e){t[e]=i})}),t}function f(t,i){var e=l(arguments,2);return function(){return t.apply(i,e.concat(l(arguments)))}}function m(t){return d(t).split(pt)}function v(t,i){return t.className.indexOf(i)>-1}function w(t,i){var e;return s(t.length)?u(t,function(t){w(t,i)}):(e=m(t.className),u(m(i),function(t){c(t,e)<0&&e.push(t)}),void(t.className=e.join(" ")))}function x(t,i){var e;return s(t.length)?u(t,function(t){x(t,i)}):(e=m(t.className),u(m(i),function(t,i){(i=c(t,e))>-1&&e.splice(i,1)}),void(t.className=e.join(" ")))}function D(t,i,e){return e?w(t,i):x(t,i)}function b(t,i){return n(t[i])?t[i]:t.dataset?t.dataset[i]:t.getAttribute("data-"+i)}function C(t,i,e){n(e)&&h(t[i])?t[i]=e:t.dataset?t.dataset[i]=e:t.setAttribute("data-"+i,e)}function B(t,i){n(t[i])?delete t[i]:t.dataset?delete t.dataset[i]:t.removeAttribute("data-"+i)}function y(t,i,e){var a;if(r(e))return a=d(i).split(pt),a.length>1?u(a,function(i){y(t,i,e)}):void(t.addEventListener?t.addEventListener(i,e,!1):t.attachEvent&&t.attachEvent("on"+i,e))}function L(t,i,e){var a;if(r(e))return a=d(i).split(pt),a.length>1?u(a,function(i){L(t,i,e)}):void(t.removeEventListener?t.removeEventListener(i,e,!1):t.detachEvent&&t.detachEvent("on"+i,e))}function T(t){t&&(t.preventDefault?t.preventDefault():t.returnValue=!1)}function M(i){var e,a=i||t.event;return a.target||(a.target=a.srcElement||U),s(a.pageX)||(e=U.documentElement,a.pageX=a.clientX+(t.scrollX||e&&e.scrollLeft||0)-(e&&e.clientLeft||0),a.pageY=a.clientY+(t.scrollY||e&&e.scrollTop||0)-(e&&e.clientTop||0)),a}function W(i){var e=U.documentElement,a=i.getBoundingClientRect();return{left:a.left+(t.scrollX||e&&e.scrollLeft||0)-(e&&e.clientLeft||0),top:a.top+(t.scrollY||e&&e.scrollTop||0)-(e&&e.clientTop||0)}}function X(t,i){return t.querySelector(i)}function Y(t,i){return t.querySelectorAll(i)}function H(t,i){t.parentNode.insertBefore(i,t)}function E(t,i){t.appendChild(i)}function R(t){t.parentNode.removeChild(t)}function k(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function z(t){var i=t.match(/^(https?:)\/\/([^\:\/\?#]+):?(\d*)/i);return i&&(i[1]!==j.protocol||i[2]!==j.hostname||i[3]!==j.port)}function O(t,i){i&&(t.crossOrigin=i)}function I(t){var i="timestamp="+(new Date).getTime();return t+(-1===t.indexOf("?")?"?":"&")+i}function N(t,i){var e;return t.naturalWidth?i(t.naturalWidth,t.naturalHeight):(e=U.createElement("img"),e.onload=function(){i(this.width,this.height)},void(e.src=t.src))}function A(t){var i=[],e=t.rotate,a=t.scaleX,h=t.scaleY;return s(e)&&i.push("rotate("+e+"deg)"),s(a)&&s(h)&&i.push("scale("+a+","+h+")"),i.length?i.join(" "):"none"}function S(t,i){var e,a,s=Yt(t.degree)%180,h=(s>90?180-s:s)*Math.PI/180,n=Ht(h),o=Et(h),r=t.width,p=t.height,l=t.aspectRatio;return i?(e=r/(o+n/l),a=e/l):(e=r*o+p*n,a=r*n+p*o),{width:e,height:a}}function P(t,i){var e,a,h,n=U.createElement("canvas"),o=n.getContext("2d"),r=0,p=0,l=i.naturalWidth,c=i.naturalHeight,d=i.rotate,u=i.scaleX,g=i.scaleY,f=s(u)&&s(g)&&(1!==u||1!==g),m=s(d)&&0!==d,v=m||f,w=l,x=c;return f&&(e=l/2,a=c/2),m&&(h=S({width:l,height:c,degree:d}),w=h.width,x=h.height,e=h.width/2,a=h.height/2),n.width=w,n.height=x,v&&(r=-l/2,p=-c/2,o.save(),o.translate(e,a)),m&&o.rotate(d*Math.PI/180),f&&o.scale(u,g),o.drawImage(t,r,p,l,c),v&&o.restore(),n}function _(t,i){this.element=t,this.options=g({},_.DEFAULTS,o(i)&&i),this.isLoaded=!1,this.isBuilt=!1,this.isCompleted=!1,this.isRotated=!1,this.isCropped=!1,this.isDisabled=!1,this.isReplaced=!1,this.isLimited=!1,this.isImg=!1,this.originalUrl="",this.crossOrigin="",this.canvasData=null,this.cropBoxData=null,this.previews=null,this.init()}var U=t.document,j=t.location,q="cropper",F="cropper-modal",Z="cropper-hide",$="cropper-hidden",K="cropper-invisible",V="cropper-move",G="cropper-crop",J="cropper-disabled",Q="cropper-bg",tt="mousedown touchstart pointerdown MSPointerDown",it="mousemove touchmove pointermove MSPointerMove",et="mouseup touchend touchcancel pointerup pointercancel MSPointerUp MSPointerCancel",at="wheel mousewheel DOMMouseScroll",st="dblclick",ht="resize",nt="error",ot="load",rt=/^(e|w|s|n|se|sw|ne|nw|all|crop|move|zoom)$/,pt=/\s+/,lt=/^\s+(.*)\s+^/,ct="preview",dt="action",ut="e",gt="w",ft="s",mt="n",vt="se",wt="sw",xt="ne",Dt="nw",bt="all",Ct="crop",Bt="move",yt="zoom",Lt="none",Tt=!!U.createElement("canvas").getContext,Mt=Number,Wt=Math.min,Xt=Math.max,Yt=Math.abs,Ht=Math.sin,Et=Math.cos,Rt=Math.sqrt,kt=Math.round,zt={version:"0.3.2"},Ot={},It=Ot.toString,Nt=Ot.hasOwnProperty;g(zt,{init:function(){var t,i=this.element,e=i.tagName.toLowerCase();if(!b(i,q)){if(C(i,q,this),"img"===e){if(this.isImg=!0,this.originalUrl=t=i.getAttribute("src"),!t)return;t=i.src}else"canvas"===e&&Tt&&(t=i.toDataURL());this.load(t)}},load:function(t){var i,e,a,s,h,n=this.options,o=this.element;t&&(this.url=t,r(n.build)&&n.build.call(o)===!1||(n.checkCrossOrigin&&z(t)&&(i=o.crossOrigin,i||(i="anonymous",e=I(t))),this.crossOrigin=i,a=U.createElement("img"),O(a,i),a.src=e||t,this.image=a,this._start=s=f(this.start,this),this._stop=h=f(this.stop,this),this.isImg?o.complete?this.start():y(o,ot,s):(y(a,ot,s),y(a,nt,h),w(a,Z),H(o,a))))},start:function(t){var i=this.isImg?this.element:this.image;t&&(L(i,ot,this._start),L(i,nt,this._stop)),N(i,f(function(t,i){this.imageData={naturalWidth:t,naturalHeight:i,aspectRatio:t/i},this.isLoaded=!0,this.build()},this))},stop:function(){var t=this.image;L(t,ot,this._start),L(t,nt,this._stop),R(t),this.image=null}}),g(zt,{build:function(){var t,i,e,a,s,h,n=this.options,o=this.element,p=this.image;this.isLoaded&&(this.isBuilt&&this.unbuild(),t=U.createElement("div"),t.innerHTML=_.TEMPLATE,this.container=o.parentNode,this.cropper=i=X(t,".cropper-container"),this.canvas=e=X(i,".cropper-canvas"),this.dragBox=a=X(i,".cropper-drag-box"),this.cropBox=s=X(i,".cropper-crop-box"),this.viewBox=X(i,".cropper-view-box"),this.face=h=X(s,".cropper-face"),E(e,p),w(o,$),H(o,i),this.isImg||x(p,Z),this.initPreview(),this.bind(),n.aspectRatio=Xt(0,n.aspectRatio)||NaN,n.viewMode=Xt(0,Wt(3,kt(n.viewMode)))||0,n.autoCrop?(this.isCropped=!0,n.modal&&w(a,F)):w(s,$),n.guides||w(Y(s,".cropper-dashed"),$),n.center||w(X(s,".cropper-center"),$),n.background&&w(i,Q),n.highlight||w(h,K),n.cropBoxMovable&&(w(h,V),C(h,dt,bt)),n.cropBoxResizable||(w(Y(s,".cropper-line"),$),w(Y(s,".cropper-point"),$)),this.setDragMode(n.dragMode),this.render(),this.isBuilt=!0,this.setData(n.data),setTimeout(f(function(){r(n.built)&&n.built.call(o),r(n.crop)&&n.crop.call(o,this.getData()),this.isCompleted=!0},this),0))},unbuild:function(){this.isBuilt&&(this.isBuilt=!1,this.initialImageData=null,this.initialCanvasData=null,this.initialCropBoxData=null,this.containerData=null,this.canvasData=null,this.cropBoxData=null,this.unbind(),this.resetPreview(),this.previews=null,this.viewBox=null,this.cropBox=null,this.dragBox=null,this.canvas=null,this.container=null,R(this.cropper),this.cropper=null)}}),g(zt,{render:function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.isCropped&&this.renderCropBox()},initContainer:function(){var t,i=this.options,e=this.element,a=this.container,s=this.cropper;w(s,$),x(e,$),this.containerData=t={width:Xt(a.offsetWidth,Mt(i.minContainerWidth)||200),height:Xt(a.offsetHeight,Mt(i.minContainerHeight)||100)},s.style.cssText="width:"+t.width+"px;height:"+t.height+"px;",w(e,$),x(s,$)},initCanvas:function(){var t=this.options.viewMode,i=this.containerData,e=i.width,a=i.height,s=this.imageData,h=s.aspectRatio,n={naturalWidth:s.naturalWidth,naturalHeight:s.naturalHeight,aspectRatio:h,width:e,height:a};a*h>e?3===t?n.width=a*h:n.height=e/h:3===t?n.height=e/h:n.width=a*h,n.oldLeft=n.left=(e-n.width)/2,n.oldTop=n.top=(a-n.height)/2,this.canvasData=n,this.isLimited=1===t||2===t,this.limitCanvas(!0,!0),this.initialImageData=g({},s),this.initialCanvasData=g({},n)},limitCanvas:function(t,i){var e,a,s,h,n=this.options,o=n.viewMode,r=this.containerData,p=r.width,l=r.height,c=this.canvasData,d=c.aspectRatio,u=this.cropBoxData,g=this.isCropped&&u;t&&(e=Mt(n.minCanvasWidth)||0,a=Mt(n.minCanvasHeight)||0,o&&(o>1?(e=Xt(e,p),a=Xt(a,l),3===o&&(a*d>e?e=a*d:a=e/d)):e?e=Xt(e,g?u.width:0):a?a=Xt(a,g?u.height:0):g&&(e=u.width,a=u.height,a*d>e?e=a*d:a=e/d)),e&&a?a*d>e?a=e/d:e=a*d:e?a=e/d:a&&(e=a*d),c.minWidth=e,c.minHeight=a,c.maxWidth=1/0,c.maxHeight=1/0),i&&(o?(s=p-c.width,h=l-c.height,c.minLeft=Wt(0,s),c.minTop=Wt(0,h),c.maxLeft=Xt(0,s),c.maxTop=Xt(0,h),g&&this.isLimited&&(c.minLeft=Wt(u.left,u.left+u.width-c.width),c.minTop=Wt(u.top,u.top+u.height-c.height),c.maxLeft=u.left,c.maxTop=u.top,2===o&&(c.width>=p&&(c.minLeft=Wt(0,s),c.maxLeft=Xt(0,s)),c.height>=l&&(c.minTop=Wt(0,h),c.maxTop=Xt(0,h))))):(c.minLeft=-c.width,c.minTop=-c.height,c.maxLeft=p,c.maxTop=l))},renderCanvas:function(t){var i,e,a=this.canvasData,s=this.imageData,h=s.rotate,n=s.naturalWidth,o=s.naturalHeight;this.isRotated&&(this.isRotated=!1,e=S({width:s.width,height:s.height,degree:h}),i=e.width/e.height,i!==a.aspectRatio&&(a.left-=(e.width-a.width)/2,a.top-=(e.height-a.height)/2,a.width=e.width,a.height=e.height,a.aspectRatio=i,a.naturalWidth=n,a.naturalHeight=o,h%180&&(e=S({width:n,height:o,degree:h}),a.naturalWidth=e.width,a.naturalHeight=e.height),this.limitCanvas(!0,!1))),(a.width>a.maxWidth||a.widtha.maxHeight||a.heighta.width?s.height=s.width/i:s.width=s.height*i),this.cropBoxData=s,this.limitCropBox(!0,!0),s.width=Wt(Xt(s.width,s.minWidth),s.maxWidth),s.height=Wt(Xt(s.height,s.minHeight),s.maxHeight),s.width=Xt(s.minWidth,s.width*e),s.height=Xt(s.minHeight,s.height*e),s.oldLeft=s.left=a.left+(a.width-s.width)/2,s.oldTop=s.top=a.top+(a.height-s.height)/2,this.initialCropBoxData=g({},s)},limitCropBox:function(t,i){var e,a,s,h,n=this.options,o=n.aspectRatio,r=this.containerData,p=r.width,l=r.height,c=this.canvasData,d=this.cropBoxData,u=this.isLimited;t&&(e=Mt(n.minCropBoxWidth)||0,a=Mt(n.minCropBoxHeight)||0,e=Wt(e,p),a=Wt(a,l),s=Wt(p,u?c.width:p),h=Wt(l,u?c.height:l),o&&(e&&a?a*o>e?a=e/o:e=a*o:e?a=e/o:a&&(e=a*o),h*o>s?h=s/o:s=h*o),d.minWidth=Wt(e,s),d.minHeight=Wt(a,h),d.maxWidth=s,d.maxHeight=h),i&&(u?(d.minLeft=Xt(0,c.left),d.minTop=Xt(0,c.top),d.maxLeft=Wt(p,c.left+c.width)-d.width,d.maxTop=Wt(l,c.top+c.height)-d.height):(d.minLeft=0,d.minTop=0,d.maxLeft=p-d.width,d.maxTop=l-d.height))},renderCropBox:function(){var t=this.options,i=this.containerData,e=i.width,a=i.height,s=this.cropBoxData;(s.width>s.maxWidth||s.widths.maxHeight||s.heightc&&(g=c/s,d=a*g,u=c),i.style.width=d+"px",i.style.height=u+"px",e.width=h*g+"px",e.height=n*g+"px",e.marginLeft=-o*g+"px",e.marginTop=-r*g+"px",e.transform=A(t)}))}}),g(zt,{bind:function(){var i=this.options,e=this.cropper;y(e,tt,f(this.cropStart,this)),i.zoomable&&i.zoomOnWheel&&y(e,at,f(this.wheel,this)),i.toggleDragModeOnDblclick&&y(e,st,f(this.dblclick,this)),y(U,it,this._cropMove=f(this.cropMove,this)),y(U,et,this._cropEnd=f(this.cropEnd,this)),i.responsive&&y(t,ht,this._resize=f(this.resize,this))},unbind:function(){var i=this.options,e=this.cropper;L(e,tt,this.cropStart),i.zoomable&&i.zoomOnWheel&&L(e,at,this.wheel),i.toggleDragModeOnDblclick&&L(e,st,this.dblclick),L(U,it,this._cropMove),L(U,et,this._cropEnd),i.responsive&&L(t,ht,this._resize)}}),g(zt,{resize:function(){var t,i,e,a=this.container,s=this.containerData;!this.isDisabled&&s&&(e=a.offsetWidth/s.width,(1!==e||a.offsetHeight!==s.height)&&(t=this.getCanvasData(),i=this.getCropBoxData(),this.render(),this.setCanvasData(u(t,function(i,a){t[a]=i*e})),this.setCropBoxData(u(i,function(t,a){i[a]=t*e}))))},dblclick:function(){this.isDisabled||this.setDragMode(v(this.dragBox,G)?Bt:Ct)},wheel:function(t){var i=M(t),e=Mt(this.options.wheelZoomRatio)||.1,a=1;this.isDisabled||(T(i),i.deltaY?a=i.deltaY>0?1:-1:i.wheelDelta?a=-i.wheelDelta/120:i.detail&&(a=i.detail>0?1:-1),this.zoom(-a*e,i))},cropStart:function(t){var i,e,a,s=this.options,h=M(t),n=h.touches;if(!this.isDisabled){if(n){if(i=n.length,i>1){if(!s.zoomable||!s.zoomOnTouch||2!==i)return;e=n[1],this.startX2=e.pageX,this.startY2=e.pageY,a=yt}e=n[0]}if(a=a||b(h.target,dt),rt.test(a)){if(r(s.cropstart)&&s.cropstart.call(this.element,{originalEvent:h,action:a})===!1)return;T(h),this.action=a,this.cropping=!1,this.startX=e?e.pageX:h.pageX,this.startY=e?e.pageY:h.pageY,a===Ct&&(this.cropping=!0,w(this.dragBox,F))}}},cropMove:function(t){var i,e,a=this.options,s=M(t),h=s.touches,n=this.action;if(!this.isDisabled){if(h){if(i=h.length,i>1){if(!a.zoomable||!a.zoomOnTouch||2!==i)return;e=h[1],this.endX2=e.pageX,this.endY2=e.pageY}e=h[0]}if(n){if(r(a.cropmove)&&a.cropmove.call(this.element,{originalEvent:s,action:n})===!1)return;T(s),this.endX=e?e.pageX:s.pageX,this.endY=e?e.pageY:s.pageY,this.change(s.shiftKey,n===yt?s:null)}}},cropEnd:function(t){var i=this.options,e=M(t),a=this.action;this.isDisabled||a&&(T(e),this.cropping&&(this.cropping=!1,D(this.dragBox,F,this.isCropped&&i.modal)),this.action="",r(i.cropend)&&i.cropend.call(this.element,{originalEvent:e,action:a}))}}),g(zt,{change:function(t,i){var e,a,s=this.options,h=s.aspectRatio,n=this.action,o=this.containerData,r=this.canvasData,p=this.cropBoxData,l=p.width,c=p.height,d=p.left,u=p.top,g=d+l,f=u+c,m=0,v=0,w=o.width,D=o.height,b=!0;switch(!h&&t&&(h=l&&c?l/c:1),this.isLimited&&(m=p.minLeft,v=p.minTop,w=m+Wt(o.width,r.width),D=v+Wt(o.height,r.height)),a={x:this.endX-this.startX,y:this.endY-this.startY},h&&(a.X=a.y*h,a.Y=a.x/h),n){case bt:d+=a.x,u+=a.y;break;case ut:if(a.x>=0&&(g>=w||h&&(v>=u||f>=D))){b=!1;break}l+=a.x,h&&(c=l/h,u-=a.Y/2),0>l&&(n=gt,l=0);break;case mt:if(a.y<=0&&(v>=u||h&&(m>=d||g>=w))){b=!1;break}c-=a.y,u+=a.y,h&&(l=c*h,d+=a.X/2),0>c&&(n=ft,c=0);break;case gt:if(a.x<=0&&(m>=d||h&&(v>=u||f>=D))){b=!1;break}l-=a.x,d+=a.x,h&&(c=l/h,u+=a.Y/2),0>l&&(n=ut,l=0);break;case ft:if(a.y>=0&&(f>=D||h&&(m>=d||g>=w))){b=!1;break}c+=a.y,h&&(l=c*h,d-=a.X/2),0>c&&(n=mt,c=0);break;case xt:if(h){if(a.y<=0&&(v>=u||g>=w)){b=!1;break}c-=a.y,u+=a.y,l=c*h}else a.x>=0?w>g?l+=a.x:a.y<=0&&v>=u&&(b=!1):l+=a.x,a.y<=0?u>v&&(c-=a.y,u+=a.y):(c-=a.y,u+=a.y);0>l&&0>c?(n=wt,c=0,l=0):0>l?(n=Dt,l=0):0>c&&(n=vt,c=0);break;case Dt:if(h){if(a.y<=0&&(v>=u||m>=d)){b=!1;break}c-=a.y,u+=a.y,l=c*h,d+=a.X}else a.x<=0?d>m?(l-=a.x,d+=a.x):a.y<=0&&v>=u&&(b=!1):(l-=a.x,d+=a.x),a.y<=0?u>v&&(c-=a.y,u+=a.y):(c-=a.y,u+=a.y);0>l&&0>c?(n=vt,c=0,l=0):0>l?(n=xt,l=0):0>c&&(n=wt,c=0);break;case wt:if(h){if(a.x<=0&&(m>=d||f>=D)){b=!1;break}l-=a.x,d+=a.x,c=l/h}else a.x<=0?d>m?(l-=a.x,d+=a.x):a.y>=0&&f>=D&&(b=!1):(l-=a.x,d+=a.x),a.y>=0?D>f&&(c+=a.y):c+=a.y;0>l&&0>c?(n=xt,c=0,l=0):0>l?(n=vt,l=0):0>c&&(n=Dt,c=0);break;case vt:if(h){if(a.x>=0&&(g>=w||f>=D)){b=!1;break}l+=a.x,c=l/h}else a.x>=0?w>g?l+=a.x:a.y>=0&&f>=D&&(b=!1):l+=a.x,a.y>=0?D>f&&(c+=a.y):c+=a.y;0>l&&0>c?(n=Dt,c=0,l=0):0>l?(n=wt,l=0):0>c&&(n=xt,c=0);break;case Bt:this.move(a.x,a.y),b=!1;break;case yt:this.zoom(function(t,i,e,a){var s=Rt(t*t+i*i),h=Rt(e*e+a*a);return(h-s)/s}(Yt(this.startX-this.startX2),Yt(this.startY-this.startY2),Yt(this.endX-this.endX2),Yt(this.endY-this.endY2)),i),this.startX2=this.endX2,this.startY2=this.endY2,b=!1;break;case Ct:if(!a.x||!a.y){b=!1;break}e=W(this.cropper),d=this.startX-e.left,u=this.startY-e.top,l=p.minWidth,c=p.minHeight,a.x>0?n=a.y>0?vt:xt:a.x<0&&(d-=l,n=a.y>0?wt:Dt),a.y<0&&(u-=c),this.isCropped||(x(this.cropBox,$),this.isCropped=!0,this.isLimited&&this.limitCropBox(!0,!0))}b&&(p.width=l,p.height=c,p.left=d,p.top=u,this.action=n,this.renderCropBox()),this.startX=this.endX,this.startY=this.endY}}),g(zt,{crop:function(){return this.isBuilt&&!this.isDisabled&&(this.isCropped||(this.isCropped=!0,this.limitCropBox(!0,!0),this.options.modal&&w(this.dragBox,F),x(this.cropBox,$)),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.isBuilt&&!this.isDisabled&&(this.imageData=g({},this.initialImageData),this.canvasData=g({},this.initialCanvasData),this.cropBoxData=g({},this.initialCropBoxData),this.renderCanvas(),this.isCropped&&this.renderCropBox()),this},clear:function(){return this.isCropped&&!this.isDisabled&&(g(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.isCropped=!1,this.renderCropBox(),this.limitCanvas(),this.renderCanvas(),x(this.dragBox,F),w(this.cropBox,$)),this},replace:function(t){return!this.isDisabled&&t&&(this.isImg&&(this.isReplaced=!0,this.element.src=t),this.options.data=null,this.load(t)),this},enable:function(){return this.isBuilt&&(this.isDisabled=!1,x(this.cropper,J)),this},disable:function(){return this.isBuilt&&(this.isDisabled=!0,w(this.cropper,J)),this},destroy:function(){var t=this.element,i=this.image;return this.isLoaded?(this.isImg&&this.isReplaced&&(t.src=this.originalUrl),this.unbuild(),x(t,$)):this.isImg?t.off(ot,this.start):i&&R(i),B(t,q),this},move:function(t,i){var e=this.canvasData;return this.moveTo(h(t)?t:e.left+Mt(t),h(i)?i:e.top+Mt(i))},moveTo:function(t,i){var e=this.canvasData,a=!1;return h(i)&&(i=t),t=Mt(t),i=Mt(i),this.isBuilt&&!this.isDisabled&&this.options.movable&&(s(t)&&(e.left=t,a=!0),s(i)&&(e.top=i,a=!0),a&&this.renderCanvas(!0)),this},zoom:function(t,i){var e=this.canvasData;return t=Mt(t),t=0>t?1/(1-t):1+t,this.zoomTo(e.width*t/e.naturalWidth,i)},zoomTo:function(t,i){var e,a,s=this.options,h=this.canvasData,n=h.width,o=h.height,p=h.naturalWidth,l=h.naturalHeight;if(t=Mt(t),t>=0&&this.isBuilt&&!this.isDisabled&&s.zoomable){if(e=p*t,a=l*t,r(s.zoom)&&s.zoom.call(this.element,{originalEvent:i,oldRatio:n/p,ratio:e/p})===!1)return this;h.left-=(e-n)/2,h.top-=(a-o)/2,h.width=e,h.height=a,this.renderCanvas(!0)}return this},rotate:function(t){return this.rotateTo((this.imageData.rotate||0)+Mt(t))},rotateTo:function(t){return t=Mt(t),s(t)&&this.isBuilt&&!this.isDisabled&&this.options.rotatable&&(this.imageData.rotate=t%360,this.isRotated=!0,this.renderCanvas(!0)),this},scale:function(t,i){var e=this.imageData,a=!1;return h(i)&&(i=t),t=Mt(t),i=Mt(i),this.isBuilt&&!this.isDisabled&&this.options.scalable&&(s(t)&&(e.scaleX=t,a=!0),s(i)&&(e.scaleY=i,a=!0),a&&this.renderImage(!0)),this},scaleX:function(t){var i=this.imageData.scaleY;return this.scale(t,s(i)?i:1)},scaleY:function(t){var i=this.imageData.scaleX;return this.scale(s(i)?i:1,t)},getData:function(t){var i,e,a=this.options,s=this.imageData,h=this.canvasData,n=this.cropBoxData;return this.isBuilt&&this.isCropped?(e={x:n.left-h.left,y:n.top-h.top,width:n.width,height:n.height},i=s.width/s.naturalWidth,u(e,function(a,s){a/=i,e[s]=t?kt(a):a})):e={x:0,y:0,width:0,height:0},a.rotatable&&(e.rotate=s.rotate||0),a.scalable&&(e.scaleX=s.scaleX||1,e.scaleY=s.scaleY||1),e},setData:function(t){var i,e,a,h=this.options,n=this.imageData,p=this.canvasData,l={};return r(t)&&(t=t.call(this.element)),this.isBuilt&&!this.isDisabled&&o(t)&&(h.rotatable&&s(t.rotate)&&t.rotate!==n.rotate&&(n.rotate=t.rotate,this.isRotated=i=!0),h.scalable&&(s(t.scaleX)&&t.scaleX!==n.scaleX&&(n.scaleX=t.scaleX,e=!0),s(t.scaleY)&&t.scaleY!==n.scaleY&&(n.scaleY=t.scaleY,e=!0)),i?this.renderCanvas():e&&this.renderImage(),a=n.width/n.naturalWidth,s(t.x)&&(l.left=t.x*a+p.left),s(t.y)&&(l.top=t.y*a+p.top),s(t.width)&&(l.width=t.width*a),s(t.height)&&(l.height=t.height*a),this.setCropBoxData(l)),this},getContainerData:function(){return this.isBuilt?this.containerData:{}},getImageData:function(){return this.isLoaded?this.imageData:{}},getCanvasData:function(){var t=this.canvasData,i={};return this.isBuilt&&u(["left","top","width","height","naturalWidth","naturalHeight"],function(e){i[e]=t[e]}),i},setCanvasData:function(t){var i=this.canvasData,e=i.aspectRatio;return r(t)&&(t=t.call(this.element)),this.isBuilt&&!this.isDisabled&&o(t)&&(s(t.left)&&(i.left=t.left),s(t.top)&&(i.top=t.top),s(t.width)?(i.width=t.width,i.height=t.width/e):s(t.height)&&(i.height=t.height,i.width=t.height*e),this.renderCanvas(!0)),this},getCropBoxData:function(){var t,i=this.cropBoxData;return this.isBuilt&&this.isCropped&&(t={left:i.left,top:i.top,width:i.width,height:i.height}),t||{}},setCropBoxData:function(t){var i,e,a=this.cropBoxData,h=this.options.aspectRatio;return r(t)&&(t=t.call(this.element)),this.isBuilt&&this.isCropped&&!this.isDisabled&&o(t)&&(s(t.left)&&(a.left=t.left),s(t.top)&&(a.top=t.top),s(t.width)&&t.width!==a.width&&(i=!0,a.width=t.width),s(t.height)&&t.height!==a.height&&(e=!0,a.height=t.height),h&&(i?a.height=a.width/h:e&&(a.width=a.height*h)),this.renderCropBox()),this},getCroppedCanvas:function(t){var i,e,a,s,h,n,r,p,l,c,d;return this.isBuilt&&this.isCropped&&Tt?(o(t)||(t={}),d=this.getData(),i=d.width,e=d.height,p=i/e,o(t)&&(h=t.width,n=t.height,h?(n=h/p,r=h/i):n&&(h=n*p,r=n/e)),a=kt(h||i),s=kt(n||e),l=U.createElement("canvas"),l.width=a,l.height=s,c=l.getContext("2d"),t.fillColor&&(c.fillStyle=t.fillColor,c.fillRect(0,0,a,s)),c.drawImage.apply(c,function(){var t,a,s,h,n,o,p=P(this.image,this.imageData),l=p.width,c=p.height,u=[p],g=d.x,f=d.y;return-i>=g||g>l?g=t=s=n=0:0>=g?(s=-g,g=0,t=n=Wt(l,i+g)):l>=g&&(s=0,t=n=Wt(i,l-g)),0>=t||-e>=f||f>c?f=a=h=o=0:0>=f?(h=-f,f=0,a=o=Wt(c,e+f)):c>=f&&(h=0,a=o=Wt(e,c-f)),u.push(g,f,t,a),r&&(s*=r,h*=r,n*=r,o*=r),n>0&&o>0&&u.push(s,h,n,o),u}.call(this)),l):void 0},setAspectRatio:function(t){var i=this.options;return this.isDisabled||h(t)||(i.aspectRatio=Xt(0,t)||NaN,this.isBuilt&&(this.initCropBox(),this.isCropped&&this.renderCropBox())),this},setDragMode:function(t){var i,e,a=this.options,s=this.dragBox,h=this.face;return this.isLoaded&&!this.isDisabled&&(i=t===Ct,e=a.movable&&t===Bt,t=i||e?t:Lt,C(s,dt,t),D(s,G,i),D(s,V,e),a.cropBoxMovable||(C(h,dt,t),D(h,G,i),D(h,V,e))),this}}),g(_.prototype,zt),_.DEFAULTS={viewMode:0,dragMode:"crop",aspectRatio:NaN,data:null,preview:"",responsive:!0,checkCrossOrigin:!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,build:null,built:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},_.TEMPLATE='
';var At=t.Cropper;return _.noConflict=function(){return t.Cropper=At,_},_.setDefaults=function(t){g(_.DEFAULTS,t)},"function"==typeof define&&define.amd&&define("cropper",[],function(){return _}),"undefined"==typeof i&&(t.Cropper=_),_}); \ No newline at end of file +!function(t,i){"object"==typeof module&&"object"==typeof module.exports?module.exports=t.document?i(t,!0):function(t){if(!t.document)throw new Error("Cropper requires a window with a document");return i(t)}:i(t)}("undefined"!=typeof window?window:this,function(t,i){"use strict";function e(t){return Nt.call(t).slice(8,-1).toLowerCase()}function a(t){return"string"==typeof t}function s(t){return"number"==typeof t&&!isNaN(t)}function h(t){return"undefined"==typeof t}function n(t){return"object"==typeof t&&null!==t}function o(t){var i,e;if(!n(t))return!1;try{return i=t.constructor,e=i.prototype,i&&e&&At.call(e,"isPrototypeOf")}catch(a){return!1}}function r(t){return"function"===e(t)}function p(t){return Array.isArray?Array.isArray(t):"array"===e(t)}function l(t,i){var e=[];return s(i)&&e.push(i),e.slice.apply(t,e)}function c(t,i){var e=-1;return u(i,function(i,a){return i===t?(e=a,!1):void 0}),e}function d(t){return a(t)||(t=String(t)),t=t.trim?t.trim():t.replace(lt,"$1")}function u(t,i){var e,a;if(t&&r(i))if(p(t)||s(t.length))for(a=0,e=t.length;e>a&&i.call(t,t[a],a,t)!==!1;a++);else if(n(t))for(a in t)if(At.call(t,a)&&i.call(t,t[a],a,t)===!1)break;return t}function g(t){var i=l(arguments);return i.length>1&&i.shift(),u(i,function(i){u(i,function(i,e){t[e]=i})}),t}function f(t,i){var e=l(arguments,2);return function(){return t.apply(i,e.concat(l(arguments)))}}function m(t){return d(t).split(pt)}function v(t,i){return t.className.indexOf(i)>-1}function w(t,i){var e;return s(t.length)?u(t,function(t){w(t,i)}):(e=m(t.className),u(m(i),function(t){c(t,e)<0&&e.push(t)}),void(t.className=e.join(" ")))}function x(t,i){var e;return s(t.length)?u(t,function(t){x(t,i)}):(e=m(t.className),u(m(i),function(t,i){(i=c(t,e))>-1&&e.splice(i,1)}),void(t.className=e.join(" ")))}function D(t,i,e){return e?w(t,i):x(t,i)}function b(t,i){return n(t[i])?t[i]:t.dataset?t.dataset[i]:t.getAttribute("data-"+i)}function C(t,i,e){n(e)&&h(t[i])?t[i]=e:t.dataset?t.dataset[i]=e:t.setAttribute("data-"+i,e)}function B(t,i){n(t[i])?delete t[i]:t.dataset?delete t.dataset[i]:t.removeAttribute("data-"+i)}function y(t,i,e){var a;if(r(e))return a=d(i).split(pt),a.length>1?u(a,function(i){y(t,i,e)}):void(t.addEventListener?t.addEventListener(i,e,!1):t.attachEvent&&t.attachEvent("on"+i,e))}function L(t,i,e){var a;if(r(e))return a=d(i).split(pt),a.length>1?u(a,function(i){L(t,i,e)}):void(t.removeEventListener?t.removeEventListener(i,e,!1):t.detachEvent&&t.detachEvent("on"+i,e))}function T(t){t&&(t.preventDefault?t.preventDefault():t.returnValue=!1)}function M(i){var e,a=i||t.event;return a.target||(a.target=a.srcElement||U),s(a.pageX)||(e=U.documentElement,a.pageX=a.clientX+(t.scrollX||e&&e.scrollLeft||0)-(e&&e.clientLeft||0),a.pageY=a.clientY+(t.scrollY||e&&e.scrollTop||0)-(e&&e.clientTop||0)),a}function W(i){var e=U.documentElement,a=i.getBoundingClientRect();return{left:a.left+(t.scrollX||e&&e.scrollLeft||0)-(e&&e.clientLeft||0),top:a.top+(t.scrollY||e&&e.scrollTop||0)-(e&&e.clientTop||0)}}function X(t,i){return t.querySelector(i)}function Y(t,i){return t.querySelectorAll(i)}function H(t,i){t.parentNode.insertBefore(i,t)}function E(t,i){t.appendChild(i)}function R(t){t.parentNode.removeChild(t)}function k(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function z(t){var i=t.match(/^(https?:)\/\/([^\:\/\?#]+):?(\d*)/i);return i&&(i[1]!==j.protocol||i[2]!==j.hostname||i[3]!==j.port)}function O(t,i){i&&(t.crossOrigin=i)}function I(t){var i="timestamp="+(new Date).getTime();return t+(-1===t.indexOf("?")?"?":"&")+i}function N(t,i){var e;return t.naturalWidth?i(t.naturalWidth,t.naturalHeight):(e=U.createElement("img"),e.onload=function(){i(this.width,this.height)},void(e.src=t.src))}function A(t){var i=[],e=t.rotate,a=t.scaleX,h=t.scaleY;return s(e)&&i.push("rotate("+e+"deg)"),s(a)&&s(h)&&i.push("scale("+a+","+h+")"),i.length?i.join(" "):"none"}function S(t,i){var e,a,s=Yt(t.degree)%180,h=(s>90?180-s:s)*Math.PI/180,n=Ht(h),o=Et(h),r=t.width,p=t.height,l=t.aspectRatio;return i?(e=r/(o+n/l),a=e/l):(e=r*o+p*n,a=r*n+p*o),{width:e,height:a}}function P(t,i){var e,a,h,n=U.createElement("canvas"),o=n.getContext("2d"),r=0,p=0,l=i.naturalWidth,c=i.naturalHeight,d=i.rotate,u=i.scaleX,g=i.scaleY,f=s(u)&&s(g)&&(1!==u||1!==g),m=s(d)&&0!==d,v=m||f,w=l,x=c;return f&&(e=l/2,a=c/2),m&&(h=S({width:l,height:c,degree:d}),w=h.width,x=h.height,e=h.width/2,a=h.height/2),n.width=w,n.height=x,v&&(r=-l/2,p=-c/2,o.save(),o.translate(e,a)),m&&o.rotate(d*Math.PI/180),f&&o.scale(u,g),o.drawImage(t,zt(r),zt(p),zt(l),zt(c)),v&&o.restore(),n}function _(t,i){this.element=t,this.options=g({},_.DEFAULTS,o(i)&&i),this.isLoaded=!1,this.isBuilt=!1,this.isCompleted=!1,this.isRotated=!1,this.isCropped=!1,this.isDisabled=!1,this.isReplaced=!1,this.isLimited=!1,this.isImg=!1,this.originalUrl="",this.crossOrigin="",this.canvasData=null,this.cropBoxData=null,this.previews=null,this.init()}var U=t.document,j=t.location,q="cropper",F="cropper-modal",Z="cropper-hide",$="cropper-hidden",K="cropper-invisible",V="cropper-move",G="cropper-crop",J="cropper-disabled",Q="cropper-bg",tt="mousedown touchstart pointerdown MSPointerDown",it="mousemove touchmove pointermove MSPointerMove",et="mouseup touchend touchcancel pointerup pointercancel MSPointerUp MSPointerCancel",at="wheel mousewheel DOMMouseScroll",st="dblclick",ht="resize",nt="error",ot="load",rt=/^(e|w|s|n|se|sw|ne|nw|all|crop|move|zoom)$/,pt=/\s+/,lt=/^\s+(.*)\s+^/,ct="preview",dt="action",ut="e",gt="w",ft="s",mt="n",vt="se",wt="sw",xt="ne",Dt="nw",bt="all",Ct="crop",Bt="move",yt="zoom",Lt="none",Tt=!!U.createElement("canvas").getContext,Mt=Number,Wt=Math.min,Xt=Math.max,Yt=Math.abs,Ht=Math.sin,Et=Math.cos,Rt=Math.sqrt,kt=Math.round,zt=Math.floor,Ot={version:"0.3.3"},It={},Nt=It.toString,At=It.hasOwnProperty;g(Ot,{init:function(){var t,i=this.element,e=i.tagName.toLowerCase();if(!b(i,q)){if(C(i,q,this),"img"===e){if(this.isImg=!0,this.originalUrl=t=i.getAttribute("src"),!t)return;t=i.src}else"canvas"===e&&Tt&&(t=i.toDataURL());this.load(t)}},load:function(t){var i,e,a,s,h,n=this.options,o=this.element;t&&(this.url=t,r(n.build)&&n.build.call(o)===!1||(n.checkCrossOrigin&&z(t)&&(i=o.crossOrigin,i||(i="anonymous",e=I(t))),this.crossOrigin=i,a=U.createElement("img"),O(a,i),a.src=e||t,this.image=a,this._start=s=f(this.start,this),this._stop=h=f(this.stop,this),this.isImg?o.complete?this.start():y(o,ot,s):(y(a,ot,s),y(a,nt,h),w(a,Z),H(o,a))))},start:function(t){var i=this.isImg?this.element:this.image;t&&(L(i,ot,this._start),L(i,nt,this._stop)),N(i,f(function(t,i){this.imageData={naturalWidth:t,naturalHeight:i,aspectRatio:t/i},this.isLoaded=!0,this.build()},this))},stop:function(){var t=this.image;L(t,ot,this._start),L(t,nt,this._stop),R(t),this.image=null}}),g(Ot,{build:function(){var t,i,e,a,s,h,n=this.options,o=this.element,p=this.image;this.isLoaded&&(this.isBuilt&&this.unbuild(),t=U.createElement("div"),t.innerHTML=_.TEMPLATE,this.container=o.parentNode,this.cropper=i=X(t,".cropper-container"),this.canvas=e=X(i,".cropper-canvas"),this.dragBox=a=X(i,".cropper-drag-box"),this.cropBox=s=X(i,".cropper-crop-box"),this.viewBox=X(i,".cropper-view-box"),this.face=h=X(s,".cropper-face"),E(e,p),w(o,$),H(o,i),this.isImg||x(p,Z),this.initPreview(),this.bind(),n.aspectRatio=Xt(0,n.aspectRatio)||NaN,n.viewMode=Xt(0,Wt(3,kt(n.viewMode)))||0,n.autoCrop?(this.isCropped=!0,n.modal&&w(a,F)):w(s,$),n.guides||w(Y(s,".cropper-dashed"),$),n.center||w(X(s,".cropper-center"),$),n.background&&w(i,Q),n.highlight||w(h,K),n.cropBoxMovable&&(w(h,V),C(h,dt,bt)),n.cropBoxResizable||(w(Y(s,".cropper-line"),$),w(Y(s,".cropper-point"),$)),this.setDragMode(n.dragMode),this.render(),this.isBuilt=!0,this.setData(n.data),setTimeout(f(function(){r(n.built)&&n.built.call(o),r(n.crop)&&n.crop.call(o,this.getData()),this.isCompleted=!0},this),0))},unbuild:function(){this.isBuilt&&(this.isBuilt=!1,this.initialImageData=null,this.initialCanvasData=null,this.initialCropBoxData=null,this.containerData=null,this.canvasData=null,this.cropBoxData=null,this.unbind(),this.resetPreview(),this.previews=null,this.viewBox=null,this.cropBox=null,this.dragBox=null,this.canvas=null,this.container=null,R(this.cropper),this.cropper=null)}}),g(Ot,{render:function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.isCropped&&this.renderCropBox()},initContainer:function(){var t,i=this.options,e=this.element,a=this.container,s=this.cropper;w(s,$),x(e,$),this.containerData=t={width:Xt(a.offsetWidth,Mt(i.minContainerWidth)||200),height:Xt(a.offsetHeight,Mt(i.minContainerHeight)||100)},s.style.cssText="width:"+t.width+"px;height:"+t.height+"px;",w(e,$),x(s,$)},initCanvas:function(){var t=this.options.viewMode,i=this.containerData,e=i.width,a=i.height,s=this.imageData,h=s.aspectRatio,n={naturalWidth:s.naturalWidth,naturalHeight:s.naturalHeight,aspectRatio:h,width:e,height:a};a*h>e?3===t?n.width=a*h:n.height=e/h:3===t?n.height=e/h:n.width=a*h,n.oldLeft=n.left=(e-n.width)/2,n.oldTop=n.top=(a-n.height)/2,this.canvasData=n,this.isLimited=1===t||2===t,this.limitCanvas(!0,!0),this.initialImageData=g({},s),this.initialCanvasData=g({},n)},limitCanvas:function(t,i){var e,a,s,h,n=this.options,o=n.viewMode,r=this.containerData,p=r.width,l=r.height,c=this.canvasData,d=c.aspectRatio,u=this.cropBoxData,g=this.isCropped&&u;t&&(e=Mt(n.minCanvasWidth)||0,a=Mt(n.minCanvasHeight)||0,o&&(o>1?(e=Xt(e,p),a=Xt(a,l),3===o&&(a*d>e?e=a*d:a=e/d)):e?e=Xt(e,g?u.width:0):a?a=Xt(a,g?u.height:0):g&&(e=u.width,a=u.height,a*d>e?e=a*d:a=e/d)),e&&a?a*d>e?a=e/d:e=a*d:e?a=e/d:a&&(e=a*d),c.minWidth=e,c.minHeight=a,c.maxWidth=1/0,c.maxHeight=1/0),i&&(o?(s=p-c.width,h=l-c.height,c.minLeft=Wt(0,s),c.minTop=Wt(0,h),c.maxLeft=Xt(0,s),c.maxTop=Xt(0,h),g&&this.isLimited&&(c.minLeft=Wt(u.left,u.left+u.width-c.width),c.minTop=Wt(u.top,u.top+u.height-c.height),c.maxLeft=u.left,c.maxTop=u.top,2===o&&(c.width>=p&&(c.minLeft=Wt(0,s),c.maxLeft=Xt(0,s)),c.height>=l&&(c.minTop=Wt(0,h),c.maxTop=Xt(0,h))))):(c.minLeft=-c.width,c.minTop=-c.height,c.maxLeft=p,c.maxTop=l))},renderCanvas:function(t){var i,e,a=this.canvasData,s=this.imageData,h=s.rotate,n=s.naturalWidth,o=s.naturalHeight;this.isRotated&&(this.isRotated=!1,e=S({width:s.width,height:s.height,degree:h}),i=e.width/e.height,i!==a.aspectRatio&&(a.left-=(e.width-a.width)/2,a.top-=(e.height-a.height)/2,a.width=e.width,a.height=e.height,a.aspectRatio=i,a.naturalWidth=n,a.naturalHeight=o,h%180&&(e=S({width:n,height:o,degree:h}),a.naturalWidth=e.width,a.naturalHeight=e.height),this.limitCanvas(!0,!1))),(a.width>a.maxWidth||a.widtha.maxHeight||a.heighta.width?s.height=s.width/i:s.width=s.height*i),this.cropBoxData=s,this.limitCropBox(!0,!0),s.width=Wt(Xt(s.width,s.minWidth),s.maxWidth),s.height=Wt(Xt(s.height,s.minHeight),s.maxHeight),s.width=Xt(s.minWidth,s.width*e),s.height=Xt(s.minHeight,s.height*e),s.oldLeft=s.left=a.left+(a.width-s.width)/2,s.oldTop=s.top=a.top+(a.height-s.height)/2,this.initialCropBoxData=g({},s)},limitCropBox:function(t,i){var e,a,s,h,n=this.options,o=n.aspectRatio,r=this.containerData,p=r.width,l=r.height,c=this.canvasData,d=this.cropBoxData,u=this.isLimited;t&&(e=Mt(n.minCropBoxWidth)||0,a=Mt(n.minCropBoxHeight)||0,e=Wt(e,p),a=Wt(a,l),s=Wt(p,u?c.width:p),h=Wt(l,u?c.height:l),o&&(e&&a?a*o>e?a=e/o:e=a*o:e?a=e/o:a&&(e=a*o),h*o>s?h=s/o:s=h*o),d.minWidth=Wt(e,s),d.minHeight=Wt(a,h),d.maxWidth=s,d.maxHeight=h),i&&(u?(d.minLeft=Xt(0,c.left),d.minTop=Xt(0,c.top),d.maxLeft=Wt(p,c.left+c.width)-d.width,d.maxTop=Wt(l,c.top+c.height)-d.height):(d.minLeft=0,d.minTop=0,d.maxLeft=p-d.width,d.maxTop=l-d.height))},renderCropBox:function(){var t=this.options,i=this.containerData,e=i.width,a=i.height,s=this.cropBoxData;(s.width>s.maxWidth||s.widths.maxHeight||s.heightc&&(g=c/s,d=a*g,u=c),i.style.width=d+"px",i.style.height=u+"px",e.width=h*g+"px",e.height=n*g+"px",e.marginLeft=-o*g+"px",e.marginTop=-r*g+"px",e.transform=A(t)}))}}),g(Ot,{bind:function(){var i=this.options,e=this.cropper;y(e,tt,f(this.cropStart,this)),i.zoomable&&i.zoomOnWheel&&y(e,at,f(this.wheel,this)),i.toggleDragModeOnDblclick&&y(e,st,f(this.dblclick,this)),y(U,it,this._cropMove=f(this.cropMove,this)),y(U,et,this._cropEnd=f(this.cropEnd,this)),i.responsive&&y(t,ht,this._resize=f(this.resize,this))},unbind:function(){var i=this.options,e=this.cropper;L(e,tt,this.cropStart),i.zoomable&&i.zoomOnWheel&&L(e,at,this.wheel),i.toggleDragModeOnDblclick&&L(e,st,this.dblclick),L(U,it,this._cropMove),L(U,et,this._cropEnd),i.responsive&&L(t,ht,this._resize)}}),g(Ot,{resize:function(){var t,i,e,a=this.container,s=this.containerData;!this.isDisabled&&s&&(e=a.offsetWidth/s.width,(1!==e||a.offsetHeight!==s.height)&&(t=this.getCanvasData(),i=this.getCropBoxData(),this.render(),this.setCanvasData(u(t,function(i,a){t[a]=i*e})),this.setCropBoxData(u(i,function(t,a){i[a]=t*e}))))},dblclick:function(){this.isDisabled||this.setDragMode(v(this.dragBox,G)?Bt:Ct)},wheel:function(t){var i=M(t),e=Mt(this.options.wheelZoomRatio)||.1,a=1;this.isDisabled||(T(i),i.deltaY?a=i.deltaY>0?1:-1:i.wheelDelta?a=-i.wheelDelta/120:i.detail&&(a=i.detail>0?1:-1),this.zoom(-a*e,i))},cropStart:function(t){var i,e,a,s=this.options,h=M(t),n=h.touches;if(!this.isDisabled){if(n){if(i=n.length,i>1){if(!s.zoomable||!s.zoomOnTouch||2!==i)return;e=n[1],this.startX2=e.pageX,this.startY2=e.pageY,a=yt}e=n[0]}if(a=a||b(h.target,dt),rt.test(a)){if(r(s.cropstart)&&s.cropstart.call(this.element,{originalEvent:h,action:a})===!1)return;T(h),this.action=a,this.cropping=!1,this.startX=e?e.pageX:h.pageX,this.startY=e?e.pageY:h.pageY,a===Ct&&(this.cropping=!0,w(this.dragBox,F))}}},cropMove:function(t){var i,e,a=this.options,s=M(t),h=s.touches,n=this.action;if(!this.isDisabled){if(h){if(i=h.length,i>1){if(!a.zoomable||!a.zoomOnTouch||2!==i)return;e=h[1],this.endX2=e.pageX,this.endY2=e.pageY}e=h[0]}if(n){if(r(a.cropmove)&&a.cropmove.call(this.element,{originalEvent:s,action:n})===!1)return;T(s),this.endX=e?e.pageX:s.pageX,this.endY=e?e.pageY:s.pageY,this.change(s.shiftKey,n===yt?s:null)}}},cropEnd:function(t){var i=this.options,e=M(t),a=this.action;this.isDisabled||a&&(T(e),this.cropping&&(this.cropping=!1,D(this.dragBox,F,this.isCropped&&i.modal)),this.action="",r(i.cropend)&&i.cropend.call(this.element,{originalEvent:e,action:a}))}}),g(Ot,{change:function(t,i){var e,a,s=this.options,h=s.aspectRatio,n=this.action,o=this.containerData,r=this.canvasData,p=this.cropBoxData,l=p.width,c=p.height,d=p.left,u=p.top,g=d+l,f=u+c,m=0,v=0,w=o.width,D=o.height,b=!0;switch(!h&&t&&(h=l&&c?l/c:1),this.isLimited&&(m=p.minLeft,v=p.minTop,w=m+Wt(o.width,r.width),D=v+Wt(o.height,r.height)),a={x:this.endX-this.startX,y:this.endY-this.startY},h&&(a.X=a.y*h,a.Y=a.x/h),n){case bt:d+=a.x,u+=a.y;break;case ut:if(a.x>=0&&(g>=w||h&&(v>=u||f>=D))){b=!1;break}l+=a.x,h&&(c=l/h,u-=a.Y/2),0>l&&(n=gt,l=0);break;case mt:if(a.y<=0&&(v>=u||h&&(m>=d||g>=w))){b=!1;break}c-=a.y,u+=a.y,h&&(l=c*h,d+=a.X/2),0>c&&(n=ft,c=0);break;case gt:if(a.x<=0&&(m>=d||h&&(v>=u||f>=D))){b=!1;break}l-=a.x,d+=a.x,h&&(c=l/h,u+=a.Y/2),0>l&&(n=ut,l=0);break;case ft:if(a.y>=0&&(f>=D||h&&(m>=d||g>=w))){b=!1;break}c+=a.y,h&&(l=c*h,d-=a.X/2),0>c&&(n=mt,c=0);break;case xt:if(h){if(a.y<=0&&(v>=u||g>=w)){b=!1;break}c-=a.y,u+=a.y,l=c*h}else a.x>=0?w>g?l+=a.x:a.y<=0&&v>=u&&(b=!1):l+=a.x,a.y<=0?u>v&&(c-=a.y,u+=a.y):(c-=a.y,u+=a.y);0>l&&0>c?(n=wt,c=0,l=0):0>l?(n=Dt,l=0):0>c&&(n=vt,c=0);break;case Dt:if(h){if(a.y<=0&&(v>=u||m>=d)){b=!1;break}c-=a.y,u+=a.y,l=c*h,d+=a.X}else a.x<=0?d>m?(l-=a.x,d+=a.x):a.y<=0&&v>=u&&(b=!1):(l-=a.x,d+=a.x),a.y<=0?u>v&&(c-=a.y,u+=a.y):(c-=a.y,u+=a.y);0>l&&0>c?(n=vt,c=0,l=0):0>l?(n=xt,l=0):0>c&&(n=wt,c=0);break;case wt:if(h){if(a.x<=0&&(m>=d||f>=D)){b=!1;break}l-=a.x,d+=a.x,c=l/h}else a.x<=0?d>m?(l-=a.x,d+=a.x):a.y>=0&&f>=D&&(b=!1):(l-=a.x,d+=a.x),a.y>=0?D>f&&(c+=a.y):c+=a.y;0>l&&0>c?(n=xt,c=0,l=0):0>l?(n=vt,l=0):0>c&&(n=Dt,c=0);break;case vt:if(h){if(a.x>=0&&(g>=w||f>=D)){b=!1;break}l+=a.x,c=l/h}else a.x>=0?w>g?l+=a.x:a.y>=0&&f>=D&&(b=!1):l+=a.x,a.y>=0?D>f&&(c+=a.y):c+=a.y;0>l&&0>c?(n=Dt,c=0,l=0):0>l?(n=wt,l=0):0>c&&(n=xt,c=0);break;case Bt:this.move(a.x,a.y),b=!1;break;case yt:this.zoom(function(t,i,e,a){var s=Rt(t*t+i*i),h=Rt(e*e+a*a);return(h-s)/s}(Yt(this.startX-this.startX2),Yt(this.startY-this.startY2),Yt(this.endX-this.endX2),Yt(this.endY-this.endY2)),i),this.startX2=this.endX2,this.startY2=this.endY2,b=!1;break;case Ct:if(!a.x||!a.y){b=!1;break}e=W(this.cropper),d=this.startX-e.left,u=this.startY-e.top,l=p.minWidth,c=p.minHeight,a.x>0?n=a.y>0?vt:xt:a.x<0&&(d-=l,n=a.y>0?wt:Dt),a.y<0&&(u-=c),this.isCropped||(x(this.cropBox,$),this.isCropped=!0,this.isLimited&&this.limitCropBox(!0,!0))}b&&(p.width=l,p.height=c,p.left=d,p.top=u,this.action=n,this.renderCropBox()),this.startX=this.endX,this.startY=this.endY}}),g(Ot,{crop:function(){return this.isBuilt&&!this.isDisabled&&(this.isCropped||(this.isCropped=!0,this.limitCropBox(!0,!0),this.options.modal&&w(this.dragBox,F),x(this.cropBox,$)),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.isBuilt&&!this.isDisabled&&(this.imageData=g({},this.initialImageData),this.canvasData=g({},this.initialCanvasData),this.cropBoxData=g({},this.initialCropBoxData),this.renderCanvas(),this.isCropped&&this.renderCropBox()),this},clear:function(){return this.isCropped&&!this.isDisabled&&(g(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.isCropped=!1,this.renderCropBox(),this.limitCanvas(),this.renderCanvas(),x(this.dragBox,F),w(this.cropBox,$)),this},replace:function(t){return!this.isDisabled&&t&&(this.isImg&&(this.isReplaced=!0,this.element.src=t),this.options.data=null,this.load(t)),this},enable:function(){return this.isBuilt&&(this.isDisabled=!1,x(this.cropper,J)),this},disable:function(){return this.isBuilt&&(this.isDisabled=!0,w(this.cropper,J)),this},destroy:function(){var t=this.element,i=this.image;return this.isLoaded?(this.isImg&&this.isReplaced&&(t.src=this.originalUrl),this.unbuild(),x(t,$)):this.isImg?t.off(ot,this.start):i&&R(i),B(t,q),this},move:function(t,i){var e=this.canvasData;return this.moveTo(h(t)?t:e.left+Mt(t),h(i)?i:e.top+Mt(i))},moveTo:function(t,i){var e=this.canvasData,a=!1;return h(i)&&(i=t),t=Mt(t),i=Mt(i),this.isBuilt&&!this.isDisabled&&this.options.movable&&(s(t)&&(e.left=t,a=!0),s(i)&&(e.top=i,a=!0),a&&this.renderCanvas(!0)),this},zoom:function(t,i){var e=this.canvasData;return t=Mt(t),t=0>t?1/(1-t):1+t,this.zoomTo(e.width*t/e.naturalWidth,i)},zoomTo:function(t,i){var e,a,s=this.options,h=this.canvasData,n=h.width,o=h.height,p=h.naturalWidth,l=h.naturalHeight;if(t=Mt(t),t>=0&&this.isBuilt&&!this.isDisabled&&s.zoomable){if(e=p*t,a=l*t,r(s.zoom)&&s.zoom.call(this.element,{originalEvent:i,oldRatio:n/p,ratio:e/p})===!1)return this;h.left-=(e-n)/2,h.top-=(a-o)/2,h.width=e,h.height=a,this.renderCanvas(!0)}return this},rotate:function(t){return this.rotateTo((this.imageData.rotate||0)+Mt(t))},rotateTo:function(t){return t=Mt(t),s(t)&&this.isBuilt&&!this.isDisabled&&this.options.rotatable&&(this.imageData.rotate=t%360,this.isRotated=!0,this.renderCanvas(!0)),this},scale:function(t,i){var e=this.imageData,a=!1;return h(i)&&(i=t),t=Mt(t),i=Mt(i),this.isBuilt&&!this.isDisabled&&this.options.scalable&&(s(t)&&(e.scaleX=t,a=!0),s(i)&&(e.scaleY=i,a=!0),a&&this.renderImage(!0)),this},scaleX:function(t){var i=this.imageData.scaleY;return this.scale(t,s(i)?i:1)},scaleY:function(t){var i=this.imageData.scaleX;return this.scale(s(i)?i:1,t)},getData:function(t){var i,e,a=this.options,s=this.imageData,h=this.canvasData,n=this.cropBoxData;return this.isBuilt&&this.isCropped?(e={x:n.left-h.left,y:n.top-h.top,width:n.width,height:n.height},i=s.width/s.naturalWidth,u(e,function(a,s){a/=i,e[s]=t?kt(a):a})):e={x:0,y:0,width:0,height:0},a.rotatable&&(e.rotate=s.rotate||0),a.scalable&&(e.scaleX=s.scaleX||1,e.scaleY=s.scaleY||1),e},setData:function(t){var i,e,a,h=this.options,n=this.imageData,p=this.canvasData,l={};return r(t)&&(t=t.call(this.element)),this.isBuilt&&!this.isDisabled&&o(t)&&(h.rotatable&&s(t.rotate)&&t.rotate!==n.rotate&&(n.rotate=t.rotate,this.isRotated=i=!0),h.scalable&&(s(t.scaleX)&&t.scaleX!==n.scaleX&&(n.scaleX=t.scaleX,e=!0),s(t.scaleY)&&t.scaleY!==n.scaleY&&(n.scaleY=t.scaleY,e=!0)),i?this.renderCanvas():e&&this.renderImage(),a=n.width/n.naturalWidth,s(t.x)&&(l.left=t.x*a+p.left),s(t.y)&&(l.top=t.y*a+p.top),s(t.width)&&(l.width=t.width*a),s(t.height)&&(l.height=t.height*a),this.setCropBoxData(l)),this},getContainerData:function(){return this.isBuilt?this.containerData:{}},getImageData:function(){return this.isLoaded?this.imageData:{}},getCanvasData:function(){var t=this.canvasData,i={};return this.isBuilt&&u(["left","top","width","height","naturalWidth","naturalHeight"],function(e){i[e]=t[e]}),i},setCanvasData:function(t){var i=this.canvasData,e=i.aspectRatio;return r(t)&&(t=t.call(this.element)),this.isBuilt&&!this.isDisabled&&o(t)&&(s(t.left)&&(i.left=t.left),s(t.top)&&(i.top=t.top),s(t.width)?(i.width=t.width,i.height=t.width/e):s(t.height)&&(i.height=t.height,i.width=t.height*e),this.renderCanvas(!0)),this},getCropBoxData:function(){var t,i=this.cropBoxData;return this.isBuilt&&this.isCropped&&(t={left:i.left,top:i.top,width:i.width,height:i.height}),t||{}},setCropBoxData:function(t){var i,e,a=this.cropBoxData,h=this.options.aspectRatio;return r(t)&&(t=t.call(this.element)),this.isBuilt&&this.isCropped&&!this.isDisabled&&o(t)&&(s(t.left)&&(a.left=t.left),s(t.top)&&(a.top=t.top),s(t.width)&&t.width!==a.width&&(i=!0,a.width=t.width),s(t.height)&&t.height!==a.height&&(e=!0,a.height=t.height),h&&(i?a.height=a.width/h:e&&(a.width=a.height*h)),this.renderCropBox()),this},getCroppedCanvas:function(t){var i,e,a,s,h,n,r,p,l,c,d;return this.isBuilt&&this.isCropped&&Tt?(o(t)||(t={}),d=this.getData(),i=d.width,e=d.height,p=i/e,o(t)&&(h=t.width,n=t.height,h?(n=h/p,r=h/i):n&&(h=n*p,r=n/e)),a=kt(h||i),s=kt(n||e),l=U.createElement("canvas"),l.width=a,l.height=s,c=l.getContext("2d"),t.fillColor&&(c.fillStyle=t.fillColor,c.fillRect(0,0,a,s)),c.drawImage.apply(c,function(){var t,a,s,h,n,o,p=P(this.image,this.imageData),l=p.width,c=p.height,u=[p],g=d.x,f=d.y;return-i>=g||g>l?g=t=s=n=0:0>=g?(s=-g,g=0,t=n=Wt(l,i+g)):l>=g&&(s=0,t=n=Wt(i,l-g)),0>=t||-e>=f||f>c?f=a=h=o=0:0>=f?(h=-f,f=0,a=o=Wt(c,e+f)):c>=f&&(h=0,a=o=Wt(e,c-f)),u.push(zt(g),zt(f),zt(t),zt(a)),r&&(s*=r,h*=r,n*=r,o*=r),n>0&&o>0&&u.push(zt(s),zt(h),zt(n),zt(o)),u}.call(this)),l):void 0},setAspectRatio:function(t){var i=this.options;return this.isDisabled||h(t)||(i.aspectRatio=Xt(0,t)||NaN,this.isBuilt&&(this.initCropBox(),this.isCropped&&this.renderCropBox())),this},setDragMode:function(t){var i,e,a=this.options,s=this.dragBox,h=this.face;return this.isLoaded&&!this.isDisabled&&(i=t===Ct,e=a.movable&&t===Bt,t=i||e?t:Lt,C(s,dt,t),D(s,G,i),D(s,V,e),a.cropBoxMovable||(C(h,dt,t),D(h,G,i),D(h,V,e))),this}}),g(_.prototype,Ot),_.DEFAULTS={viewMode:0,dragMode:"crop",aspectRatio:NaN,data:null,preview:"",responsive:!0,checkCrossOrigin:!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,build:null,built:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},_.TEMPLATE='
';var St=t.Cropper;return _.noConflict=function(){return t.Cropper=St,_},_.setDefaults=function(t){g(_.DEFAULTS,t)},"function"==typeof define&&define.amd&&define("cropper",[],function(){return _}),"undefined"==typeof i&&(t.Cropper=_),_}); \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 2a18ba26a..268b603f8 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,4 +1,4 @@ - + @@ -7,7 +7,7 @@ - Cropper + Cropper.js @@ -33,11 +33,11 @@ - Cropper + Cropper.js