"function"!=typeof Promise&&function(n){function o(){}function t(n){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof n)throw new TypeError("not a function");this._state=0;this._handled=!1;this._value=void 0;this._deferreds=[];e(n,this)}function f(n,u){for(;3===n._state;)n=n._value;return 0===n._state?void n._deferreds.push(u):(n._handled=!0,void t._immediateFn(function(){var t=1===n._state?u.onFulfilled:u.onRejected,f;if(null!==t){try{f=t(n._value)}catch(n){return void i(u.promise,n)}r(u.promise,f)}else(1===n._state?r:i)(u.promise,n._value)}))}function r(n,r){try{if(r===n)throw new TypeError("A promise cannot be resolved with itself.");if(r&&("object"==typeof r||"function"==typeof r)){var f=r.then;if(r instanceof t)return n._state=3,n._value=r,void u(n);if("function"==typeof f)return void e(function(n,t){return function(){n.apply(t,arguments)}}(f,r),n)}n._state=1;n._value=r;u(n)}catch(r){i(n,r)}}function i(n,t){n._state=2;n._value=t;u(n)}function u(n){2===n._state&&0===n._deferreds.length&&t._immediateFn(function(){n._handled||t._unhandledRejectionFn(n._value)});for(var i=0,r=n._deferreds.length;i<r;i++)f(n,n._deferreds[i]);n._deferreds=null}function s(n,t,i){this.onFulfilled="function"==typeof n?n:null;this.onRejected="function"==typeof t?t:null;this.promise=i}function e(n,t){var u=!1;try{n(function(n){u||(u=!0,r(t,n))},function(n){u||(u=!0,i(t,n))})}catch(n){if(u)return;u=!0;i(t,n)}}var h=setTimeout;t.prototype.catch=function(n){return this.then(null,n)};t.prototype.then=function(n,t){var i=new this.constructor(o);return f(this,new s(n,t,i)),i};t.all=function(n){var i=Array.prototype.slice.call(n);return new t(function(n,t){function u(r,e){try{if(e&&("object"==typeof e||"function"==typeof e)){var o=e.then;if("function"==typeof o)return void o.call(e,function(n){u(r,n)},t)}i[r]=e;0==--f&&n(i)}catch(n){t(n)}}if(0===i.length)return n([]);for(var f=i.length,r=0;r<i.length;r++)u(r,i[r])})};t.resolve=function(n){return n&&"object"==typeof n&&n.constructor===t?n:new t(function(t){t(n)})};t.reject=function(n){return new t(function(t,i){i(n)})};t.race=function(n){return new t(function(t,i){for(var r=0,u=n.length;r<u;r++)n[r].then(t,i)})};t._immediateFn="function"==typeof setImmediate&&function(n){setImmediate(n)}||function(n){h(n,0)};t._unhandledRejectionFn=function(n){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",n)};t._setImmediateFn=function(n){t._immediateFn=n};t._setUnhandledRejectionFn=function(n){t._unhandledRejectionFn=n};"undefined"!=typeof module&&module.exports?module.exports=t:n.Promise||(n.Promise=t)}(this),function(n,t){"function"==typeof define&&define.amd?define(["exports"],t):"object"==typeof exports&&"string"!=typeof exports.nodeName?t(exports):t(n.commonJsStrict={})}(this,function(n){function g(n){if(n in d)return n;for(var i=n[0].toUpperCase()+n.slice(1),t=k.length;t--;)if((n=k[t]+i)in d)return n}function l(n,t){for(var i in n=n||{},t)t[i]&&t[i].constructor&&t[i].constructor===Object?(n[i]=n[i]||{},l(n[i],t[i])):n[i]=t[i];return n}function nt(n){if("createEvent"in document){var t=document.createEvent("HTMLEvents");t.initEvent("change",!1,!0);n.dispatchEvent(t)}else n.fireEvent("onchange")}function t(n,t,i){var u,r;"string"==typeof t&&(u=t,(t={})[u]=i);for(r in t)n.style[r]=t[r]}function r(n,t){n.classList?n.classList.add(t):n.className+=" "+t}function h(n){return parseInt(n,10)}function tt(n,t,i){var u=t.width,f=t.height,r=n.getContext("2d");switch(n.width=t.width,n.height=t.height,r.save(),i){case 2:r.translate(u,0);r.scale(-1,1);break;case 3:r.translate(u,f);r.rotate(Math.PI/1);break;case 4:r.translate(0,f);r.scale(1,-1);break;case 5:n.width=f;n.height=u;r.rotate(Math.PI/2);r.scale(1,-1);break;case 6:n.width=f;n.height=u;r.rotate(Math.PI/2);r.translate(0,-f);break;case 7:n.width=f;n.height=u;r.rotate(Math.PI/-2);r.translate(-u,f);r.scale(1,-1);break;case 8:n.width=f;n.height=u;r.translate(0,u);r.rotate(Math.PI/-2)}r.drawImage(t,0,0,u,f);r.restore()}function bt(){var n,f,e,o,h,c=this.options.viewport.type?"cr-vp-"+this.options.viewport.type:null;this.options.useCanvas=this.options.enableOrientation||it.call(this);this.data={};this.elements={};n=this.elements.boundary=document.createElement("div");f=this.elements.viewport=document.createElement("div");this.elements.img=document.createElement("img");e=this.elements.overlay=document.createElement("div");this.options.useCanvas?(this.elements.canvas=document.createElement("canvas"),this.elements.preview=this.elements.canvas):this.elements.preview=this.elements.img;r(n,"cr-boundary");o=this.options.boundary.width;h=this.options.boundary.height;t(n,{width:o+(isNaN(o)?"":"px"),height:h+(isNaN(h)?"":"px")});r(f,"cr-viewport");c&&r(f,c);t(f,{width:this.options.viewport.width+"px",height:this.options.viewport.height+"px"});f.setAttribute("tabindex",0);r(this.elements.preview,"cr-image");r(e,"cr-overlay");this.element.appendChild(n);n.appendChild(this.elements.preview);n.appendChild(f);n.appendChild(e);r(this.element,"croppie-container");this.options.customClass&&r(this.element,this.options.customClass),function(){function b(t,i){var u=n.elements.preview.getBoundingClientRect(),e=r.y+i,o=r.x+t;n.options.enforceBoundary?(f.top>u.top+i&&f.bottom<u.bottom+i&&(r.y=e),f.left>u.left+t&&f.right<u.right+t&&(r.x=o)):(r.y=e,r.x=o)}function k(t){if((void 0===t.button||0===t.button)&&(t.preventDefault(),!a)){if(a=!0,o=t.pageX,h=t.pageY,t.touches){var u=t.touches[0];o=u.pageX;h=u.pageY}r=i.parse(n.elements.preview);window.addEventListener("mousemove",c);window.addEventListener("touchmove",c);window.addEventListener("mouseup",l);window.addEventListener("touchend",l);document.body.style[s]="none";f=n.elements.viewport.getBoundingClientRect()}}function c(i){var f,s,a,k;i.preventDefault();f=i.pageX;s=i.pageY;i.touches&&(a=i.touches[0],f=a.pageX,s=a.pageY);var d=f-o,g=s-h,v={};if("touchmove"==i.type&&i.touches.length>1){var c=i.touches[0],l=i.touches[1],w=Math.sqrt((c.pageX-l.pageX)*(c.pageX-l.pageX)+(c.pageY-l.pageY)*(c.pageY-l.pageY));return e||(e=w/n._currentZoom),k=w/e,y.call(n,k),void nt(n.elements.zoomer)}b(d,g);v[u]=r.toString();t(n.elements.preview,v);p.call(n);h=s;o=f}function l(){a=!1;window.removeEventListener("mousemove",c);window.removeEventListener("touchmove",c);window.removeEventListener("mouseup",l);window.removeEventListener("touchend",l);document.body.style[s]="";w.call(n);v.call(n);e=0}var o,h,e,f,r,n=this,a=!1;n.elements.overlay.addEventListener("mousedown",k);n.elements.viewport.addEventListener("keydown",function(o){var y=37,h=38,k=39,l=40,a,c;o.shiftKey&&(o.keyCode==h||o.keyCode==l)?(c=0,c=o.keyCode==h?parseFloat(n.elements.zoomer.value,10)+parseFloat(n.elements.zoomer.step,10):parseFloat(n.elements.zoomer.value,10)-parseFloat(n.elements.zoomer.step,10),n.setZoom(c)):n.options.enableKeyMovement&&o.keyCode>=37&&o.keyCode<=40&&(o.preventDefault(),a=function(n){switch(n){case y:return[1,0];case h:return[0,1];case k:return[-1,0];case l:return[0,-1]}}(o.keyCode),r=i.parse(n.elements.preview),document.body.style[s]="none",f=n.elements.viewport.getBoundingClientRect(),function(i){var o=i[0],h=i[1],f={};b(o,h);f[u]=r.toString();t(n.elements.preview,f);p.call(n);document.body.style[s]="";w.call(n);v.call(n);e=0}(a))});n.elements.overlay.addEventListener("touchstart",k)}.call(this);this.options.enableZoom&&function(){function f(){ot.call(n,{value:parseFloat(t.value),origin:new a(n.elements.preview),viewportRect:n.elements.viewport.getBoundingClientRect(),transform:i.parse(n.elements.preview)})}function e(t){var i,r;i=t.wheelDelta?t.wheelDelta/1200:t.deltaY?t.deltaY/1060:t.detail?t.detail/-60:0;r=n._currentZoom+i*n._currentZoom;t.preventDefault();y.call(n,r);f.call(n)}var n=this,u=n.elements.zoomerWrap=document.createElement("div"),t=n.elements.zoomer=document.createElement("input");r(u,"cr-slider-wrap");r(t,"cr-slider");t.type="range";t.step="0.0001";t.value=1;t.style.display=n.options.showZoomer?"":"none";n.element.appendChild(u);u.appendChild(t);n._currentZoom=1;n.elements.zoomer.addEventListener("input",f);n.elements.zoomer.addEventListener("change",f);n.options.mouseWheelZoom&&(n.elements.boundary.addEventListener("mousewheel",e),n.elements.boundary.addEventListener("DOMMouseScroll",e))}.call(this);this.options.enableResize&&function(){function d(t){var i,r;void 0!==t.button&&0!==t.button||(t.preventDefault(),a)||(i=n.elements.overlay.getBoundingClientRect(),(a=!0,u=t.pageX,f=t.pageY,l=-1!==t.currentTarget.className.indexOf("vertical")?"v":"h",y=i.width,b=i.height,t.touches)&&(r=t.touches[0],u=r.pageX,f=r.pageY),window.addEventListener("mousemove",h),window.addEventListener("touchmove",h),window.addEventListener("mouseup",c),window.addEventListener("touchend",c),document.body.style[s]="none")}function h(r){var e=r.pageX,o=r.pageY,s;(r.preventDefault(),r.touches)&&(s=r.touches[0],e=s.pageX,o=s.pageY);var h=e-u,c=o-f,a=n.options.viewport.height+c,d=n.options.viewport.width+h;"v"===l&&a>=k&&a<=b?(t(i,{height:a+"px"}),n.options.boundary.height+=c,t(n.elements.boundary,{height:n.options.boundary.height+"px"}),n.options.viewport.height+=c,t(n.elements.viewport,{height:n.options.viewport.height+"px"})):"h"===l&&d>=k&&d<=y&&(t(i,{width:d+"px"}),n.options.boundary.width+=h,t(n.elements.boundary,{width:n.options.boundary.width+"px"}),n.options.viewport.width+=h,t(n.elements.viewport,{width:n.options.viewport.width+"px"}));p.call(n);at.call(n);w.call(n);v.call(n);f=o;u=e}function c(){a=!1;window.removeEventListener("mousemove",h);window.removeEventListener("touchmove",h);window.removeEventListener("mouseup",c);window.removeEventListener("touchend",c);document.body.style[s]=""}var l,u,f,y,b,e,o,n=this,i=document.createElement("div"),a=!1,k=50;r(i,"cr-resizer");t(i,{width:this.options.viewport.width+"px",height:this.options.viewport.height+"px"});this.options.resizeControls.height&&(r(e=document.createElement("div"),"cr-resizer-vertical"),i.appendChild(e));this.options.resizeControls.width&&(r(o=document.createElement("div"),"cr-resizer-horisontal"),i.appendChild(o));e&&e.addEventListener("mousedown",d);o&&o.addEventListener("mousedown",d);this.elements.boundary.appendChild(i)}.call(this)}function it(){return this.options.enableExif&&window.EXIF}function y(n){if(this.options.enableZoom){var t=this.elements.zoomer,i=c(n,4);t.value=Math.max(t.min,Math.min(t.max,i))}}function ot(n){function c(){var n={};n[u]=f.toString();n[o]=s.toString();t(r.elements.preview,n)}var r=this,f=n?n.transform:i.parse(r.elements.preview),y=n?n.viewportRect:r.elements.viewport.getBoundingClientRect(),s=n?n.origin:new a(r.elements.preview);if(r._currentZoom=n?n.value:r._currentZoom,f.scale=r._currentZoom,c(),r.options.enforceBoundary){var l=function(n){var t=this._currentZoom,i=n.width,r=n.height,v=this.elements.boundary.clientWidth/2,y=this.elements.boundary.clientHeight/2,u=this.elements.preview.getBoundingClientRect(),f=u.width,e=u.height,o=i/2,s=r/2,h=-1*(o/t-v),c=-1*(s/t-y),l=1/t*o,a=1/t*s;return{translate:{maxX:h,minX:h-(f*(1/t)-i*(1/t)),maxY:c,minY:c-(e*(1/t)-r*(1/t))},origin:{maxX:f*(1/t)-l,minX:l,maxY:e*(1/t)-a,minY:a}}}.call(r,y),e=l.translate,h=l.origin;f.x>=e.maxX&&(s.x=h.minX,f.x=e.maxX);f.x<=e.minX&&(s.x=h.maxX,f.x=e.minX);f.y>=e.maxY&&(s.y=h.minY,f.y=e.maxY);f.y<=e.minY&&(s.y=h.maxY,f.y=e.minY)}c();ct.call(r);v.call(r)}function w(){var r=this._currentZoom,c=this.elements.preview.getBoundingClientRect(),f=this.elements.viewport.getBoundingClientRect(),h=i.parse(this.elements.preview.style[u]),l=new a(this.elements.preview),v=f.top-c.top+f.height/2,y=f.left-c.left+f.width/2,n={},e={},s;n.y=v/r;n.x=y/r;e.y=(n.y-l.y)*(1-r);e.x=(n.x-l.x)*(1-r);h.x-=e.x;h.y-=e.y;s={};s[o]=n.x+"px "+n.y+"px";s[u]=h.toString();t(this.elements.preview,s)}function p(){var i=this.elements.boundary.getBoundingClientRect(),n=this.elements.preview.getBoundingClientRect();t(this.elements.overlay,{width:n.width+"px",height:n.height+"px",top:n.top-i.top+"px",left:n.left-i.left+"px"})}function v(){var t,n=this.get();lt.call(this)&&(this.options.update.call(this,n),this.$&&"undefined"==typeof Prototype?this.$(this.element).trigger("update",n):(window.CustomEvent?t=new CustomEvent("update",{detail:n}):(t=document.createEvent("CustomEvent")).initCustomEvent("update",!0,!0,n),this.element.dispatchEvent(t)))}function lt(){return this.elements.preview.offsetHeight>0&&this.elements.preview.offsetWidth>0}function ut(){var n={},f=this.elements.preview,e=this.elements.preview.getBoundingClientRect(),r=new i(0,0,1),s=new a;lt.call(this)&&!this.data.bound&&(this.data.bound=!0,n[u]=r.toString(),n[o]=s.toString(),n.opacity=1,t(f,n),this._originalImageWidth=e.width,this._originalImageHeight=e.height,this.options.enableZoom?at.call(this,!0):this._currentZoom=1,r.scale=this._currentZoom,n[u]=r.toString(),t(f,n),this.data.points.length?function(n){if(4!=n.length)throw"Croppie - Invalid number of points supplied: "+n;var c=n[2]-n[0],r=this.elements.viewport.getBoundingClientRect(),s=this.elements.boundary.getBoundingClientRect(),h={left:r.left-s.left,top:r.top-s.top},f=r.width/c,l=n[1],a=n[0],v=-1*n[1]+h.top,p=-1*n[0]+h.left,e={};e[o]=a+"px "+l+"px";e[u]=new i(p,v,f).toString();t(this.elements.preview,e);y.call(this,f);this._currentZoom=f}.call(this,this.data.points):function(){var r=this.elements.preview.getBoundingClientRect(),n=this.elements.viewport.getBoundingClientRect(),f=this.elements.boundary.getBoundingClientRect(),e=n.left-f.left,o=n.top-f.top,s=e-(r.width-n.width)/2,h=o-(r.height-n.height)/2,c=new i(s,h,this._currentZoom);t(this.elements.preview,u,c.toString())}.call(this),w.call(this),p.call(this))}function at(n){var f,e,o,s,i=0,u=1.5,r=this.elements.zoomer,h=parseFloat(r.value),l=this.elements.boundary.getBoundingClientRect(),t=this.elements.preview.getBoundingClientRect(),a=this.elements.viewport.getBoundingClientRect();this.options.enforceBoundary&&(o=a.width/(n?t.width:t.width/h),s=a.height/(n?t.height:t.height/h),i=Math.max(o,s));i>=u&&(u=i+1);r.min=c(i,4);r.max=c(u,4);n&&(e=Math.max(l.width/t.width,l.height/t.height),f=null!==this.data.boundZoom?this.data.boundZoom:e,y.call(this,f));nt(r)}function ft(n){var o=n.points,r=h(o[0]),u=h(o[1]),p=h(o[2]),w=h(o[3]),c=p-r,l=w-u,k=n.circle,s=document.createElement("canvas"),t=s.getContext("2d"),i=c,f=l,a=0,v=0,y=i,b=f,e=1;return n.outputWidth&&n.outputHeight&&(y=n.outputWidth,b=n.outputHeight,e=y/i),s.width=y,s.height=b,n.backgroundColor&&(t.fillStyle=n.backgroundColor,t.fillRect(0,0,i,f)),this.options.enforceBoundary||(r<0&&(a=Math.abs(r),r=0),u<0&&(v=Math.abs(u),u=0),p>this._originalImageWidth&&(i=c=this._originalImageWidth-r),w>this._originalImageHeight&&(f=l=this._originalImageHeight-u)),1!==e&&(a*=e,v*=e,i*=e,f*=e),t.drawImage(this.elements.preview,r,u,Math.min(c,this._originalImageWidth),Math.min(l,this._originalImageHeight),a,v,i,f),k&&(t.fillStyle="#fff",t.globalCompositeOperation="destination-in",t.beginPath(),t.arc(i/2,f/2,i/2,0,2*Math.PI,!0),t.closePath(),t.fill()),s}function vt(n,t){var f,e,o,s,r,i=this,u=[],c=null,l=it.call(i);if("string"==typeof n)f=n,n={};else if(Array.isArray(n))u=n.slice();else{if(void 0===n&&i.data.url)return ut.call(i),v.call(i),null;f=n.url;u=n.points||[];c=void 0===n.zoom?null:n.zoom}return i.data.bound=!1,i.data.url=f||i.data.url,i.data.boundZoom=c,(e=f,o=i.elements.img,s=l,r=o||new Image,r.style.opacity=0,new Promise(function(n){function t(){setTimeout(function(){n(r)},1)}r.src!==e?(r.exifdata=null,r.removeAttribute("crossOrigin"),e.match(/^https?:\/\/|^\/\//)&&r.setAttribute("crossOrigin","anonymous"),r.onload=function(){s?EXIF.getData(r,function(){t()}):t()},r.src=e):t()})).then(function(r){if(u.length)i.options.relative&&(u=[u[0]*r.naturalWidth/100,u[1]*r.naturalHeight/100,u[2]*r.naturalWidth/100,u[3]*r.naturalHeight/100]);else{var e,o,f=function(n){var t=n.naturalWidth,i=n.naturalHeight,r;return n.exifdata&&n.exifdata.Orientation>=5&&(r=t,t=i,i=r),{width:t,height:i}}(r),c=i.elements.viewport.getBoundingClientRect(),s=c.width/c.height;f.width/f.height>s?e=(o=f.height)*s:o=(e=f.width)/s;var l=(f.width-e)/2,a=(f.height-o)/2,y=l+e,p=a+o;i.data.points=[l,a,y,p]}i.data.points=u.map(function(n){return parseFloat(n)});i.options.useCanvas&&function(n){var t=this.elements.canvas,i=this.elements.img,r=t.getContext("2d"),u=it.call(this);n=this.options.enableOrientation&&n;r.clearRect(0,0,t.width,t.height);t.width=i.width;t.height=i.height;u&&!n?tt(t,i,h(function(n){return n.exifdata.Orientation}(i)||0)):n&&tt(t,i,n)}.call(i,n.orientation||1);ut.call(i);v.call(i);t&&t()})}function c(n,t){return parseFloat(n).toFixed(t||0)}function yt(){var o=this.elements.preview.getBoundingClientRect(),i=this.elements.viewport.getBoundingClientRect(),r=i.left-o.left,u=i.top-o.top,s=(i.width-this.elements.viewport.offsetWidth)/2,h=(i.height-this.elements.viewport.offsetHeight)/2,f=r+this.elements.viewport.offsetWidth+s,e=u+this.elements.viewport.offsetHeight+h,n=this._currentZoom,t;return(n===1/0||isNaN(n))&&(n=1),t=this.options.enforceBoundary?0:Number.NEGATIVE_INFINITY,r=Math.max(t,r/n),u=Math.max(t,u/n),f=Math.max(t,f/n),e=Math.max(t,e/n),{points:[c(r),c(u),c(f),c(e)],zoom:n}}function kt(n){var f=this,i=yt.call(f),e=l(pt,l({},n)),c="string"==typeof n?n:e.type||"base64",u=e.size||"viewport",s=e.format,a=e.quality,v=e.backgroundColor,y="boolean"==typeof e.circle?e.circle:"circle"===f.options.viewport.type,o=f.elements.viewport.getBoundingClientRect(),h=o.width/o.height;return"viewport"===u?(i.outputWidth=o.width,i.outputHeight=o.height):"object"==typeof u&&(u.width&&u.height?(i.outputWidth=u.width,i.outputHeight=u.height):u.width?(i.outputWidth=u.width,i.outputHeight=u.width/h):u.height&&(i.outputWidth=u.height*h,i.outputHeight=u.height)),wt.indexOf(s)>-1&&(i.format="image/"+s,i.quality=a),i.circle=y,i.url=f.data.url,i.backgroundColor=v,new Promise(function(n){switch(c.toLowerCase()){case"rawcanvas":n(ft.call(f,i));break;case"canvas":case"base64":n(function(n){return ft.call(this,n).toDataURL(n.format,n.quality)}.call(f,i));break;case"blob":(function(n){var t=this;return new Promise(function(i){ft.call(t,n).toBlob(function(n){i(n)},n.format,n.quality)})}).call(f,i).then(n);break;default:n(function(n){var i=n.points,u=document.createElement("div"),f=document.createElement("img"),e=i[2]-i[0],o=i[3]-i[1];return r(u,"croppie-result"),u.appendChild(f),t(f,{left:-1*i[0]+"px",top:-1*i[1]+"px"}),f.src=n.url,t(u,{width:e+"px",height:o+"px"}),u}.call(f,i))}})}function f(n,t){var i,u,e;(this.element=n,this.options=l(l({},f.defaults),t),"img"===this.element.tagName.toLowerCase())&&(i=this.element,r(i,"cr-original-image"),u=document.createElement("div"),this.element.parentNode.appendChild(u),u.appendChild(i),this.element=u,this.options.url=this.options.url||i.src);(bt.call(this),this.options.url)&&(e={url:this.options.url,points:this.options.points},delete this.options.url,delete this.options.points,vt.call(this,e))}var o,u,s,k,d,et,i,a,rt,st,ht,b,ct,pt,wt,e;"function"!=typeof CustomEvent&&function(){function n(n,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var i=document.createEvent("CustomEvent");return i.initCustomEvent(n,t.bubbles,t.cancelable,t.detail),i}n.prototype=window.Event.prototype;window.CustomEvent=n}();HTMLCanvasElement.prototype.toBlob||Object.defineProperty(HTMLCanvasElement.prototype,"toBlob",{value:function(n,t,i){for(var u=atob(this.toDataURL(t,i).split(",")[1]),f=u.length,e=new Uint8Array(f),r=0;r<f;r++)e[r]=u.charCodeAt(r);n(new Blob([e],{type:t||"image/png"}))}});k=["Webkit","Moz","ms"];d=document.createElement("div").style;u=g("transform");o=g("transformOrigin");s=g("userSelect");et={translate3d:{suffix:", 0px"},translate:{suffix:""}};i=function(n,t,i){this.x=parseFloat(n);this.y=parseFloat(t);this.scale=parseFloat(i)};i.parse=function(n){return n.style?i.parse(n.style[u]):n.indexOf("matrix")>-1||n.indexOf("none")>-1?i.fromMatrix(n):i.fromString(n)};i.fromMatrix=function(n){var t=n.substring(7).split(",");return t.length&&"none"!==n||(t=[1,0,0,1,0,0]),new i(h(t[4]),h(t[5]),parseFloat(t[0]))};i.fromString=function(n){var r=n.split(") "),t=r[0].substring(f.globals.translate.length+1).split(","),u=r.length>1?r[1].substring(6):1,e=t.length>1?t[0]:0,o=t.length>1?t[1]:0;return new i(e,o,u)};i.prototype.toString=function(){var n=et[f.globals.translate].suffix||"";return f.globals.translate+"("+this.x+"px, "+this.y+"px"+n+") scale("+this.scale+")"};a=function(n){if(!n||!n.style[o])return this.x=0,void(this.y=0);var t=n.style[o].split(" ");this.x=parseFloat(t[0]);this.y=parseFloat(t[1])};a.prototype.toString=function(){return this.x+"px "+this.y+"px"};ct=(rt=p,st=500,function(){var n=this,t=arguments,i=ht&&!b;clearTimeout(b);b=setTimeout(function(){b=null;ht||rt.apply(n,t)},st);i&&rt.apply(n,t)});pt={type:"canvas",format:"png",quality:1};wt=["jpeg","webp","png"];window.jQuery&&(e=window.jQuery,e.fn.croppie=function(n){if("string"==typeof n){var i=Array.prototype.slice.call(arguments,1),t=e(this).data("croppie");return"get"===n?t.get():"result"===n?t.result.apply(t,i):"bind"===n?t.bind.apply(t,i):this.each(function(){var t=e(this).data("croppie"),r;if(t){if(r=t[n],!e.isFunction(r))throw"Croppie "+n+" method not found";r.apply(t,i);"destroy"===n&&e(this).removeData("croppie")}})}return this.each(function(){var t=new f(this,n);t.$=e;e(this).data("croppie",t)})});f.defaults={viewport:{width:100,height:100,type:"square"},boundary:{},orientationControls:{enabled:!0,leftClass:"",rightClass:""},resizeControls:{width:!0,height:!0},customClass:"",showZoomer:!0,enableZoom:!0,enableResize:!1,mouseWheelZoom:!0,enableExif:!1,enforceBoundary:!0,enableOrientation:!1,enableKeyMovement:!0,update:function(){}};f.globals={translate:"translate3d"};l(f.prototype,{bind:function(n,t){return vt.call(this,n,t)},get:function(){var t=yt.call(this),n=t.points;return this.options.relative&&(n[0]/=this.elements.img.naturalWidth/100,n[1]/=this.elements.img.naturalHeight/100,n[2]/=this.elements.img.naturalWidth/100,n[3]/=this.elements.img.naturalHeight/100),t},result:function(n){return kt.call(this,n)},refresh:function(){return function(){ut.call(this)}.call(this)},setZoom:function(n){y.call(this,n);nt(this.elements.zoomer)},rotate:function(n){(function(n){if(!this.options.useCanvas)throw"Croppie: Cannot rotate without enableOrientation";var i=this.elements.canvas,t=document.createElement("canvas"),r=1;t.width=i.width;t.height=i.height;t.getContext("2d").drawImage(i,0,0);90!==n&&-270!==n||(r=6);-90!==n&&270!==n||(r=8);180!==n&&-180!==n||(r=3);tt(i,t,r);ot.call(this);t=null}).call(this,n)},destroy:function(){return function(){var n,t;this.element.removeChild(this.elements.boundary);n=this.element;t="croppie-container";n.classList?n.classList.remove(t):n.className=n.className.replace(t,"");this.options.enableZoom&&this.element.removeChild(this.elements.zoomerWrap);delete this.elements}.call(this)}});n.Croppie=window.Croppie=f;"object"==typeof module&&module.exports&&(module.exports=f)}),function(){function r(n){return!!n.exifdata}function y(n,r){function e(f){var s=h(f),e,o;n.exifdata=s||{};e=function(n){var u=new DataView(n),t,f,e;if(i&&console.log("Got file of length "+n.byteLength),255!=u.getUint8(0)||216!=u.getUint8(1))return i&&console.log("Not a valid JPEG"),!1;for(var r=2,o=n.byteLength,s=function(n,t){return 56===n.getUint8(t)&&66===n.getUint8(t+1)&&73===n.getUint8(t+2)&&77===n.getUint8(t+3)&&4===n.getUint8(t+4)&&4===n.getUint8(t+5)};r<o;){if(s(u,r))return t=u.getUint8(r+7),t%2!=0&&(t+=1),0===t&&(t=4),f=r+8+t,e=u.getUint16(r+6+t),p(n,f,e);r++}}(f);(n.iptcdata=e||{},t.isXmpEnabled)&&(o=function(n){var r,o;if("DOMParser"in self){if(r=new DataView(n),i&&console.log("Got file of length "+n.byteLength),255!=r.getUint8(0)||216!=r.getUint8(1))return i&&console.log("Not a valid JPEG"),!1;for(var f=2,s=n.byteLength,h=new DOMParser;f<s-4;){if("http"==u(r,f,4)){var c=f-1,l=r.getUint16(f-2)-1,t=u(r,c,l),a=t.indexOf("xmpmeta>")+8,e=(t=t.substring(t.indexOf("<x:xmpmeta"),a)).indexOf("x:xmpmeta")+10;return t=t.slice(0,e)+'xmlns:Iptc4xmpCore="http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tiff="http://ns.adobe.com/tiff/1.0/" xmlns:plus="http://schemas.android.com/apk/lib/com.google.android.gms.plus" xmlns:ext="http://www.gettyimages.com/xsltExtension/1.0" xmlns:exif="http://ns.adobe.com/exif/1.0/" xmlns:stEvt="http://ns.adobe.com/xap/1.0/sType/ResourceEvent#" xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#" xmlns:crs="http://ns.adobe.com/camera-raw-settings/1.0/" xmlns:xapGImg="http://ns.adobe.com/xap/1.0/g/img/" xmlns:Iptc4xmpExt="http://iptc.org/std/Iptc4xmpExt/2008-02-29/" '+t.slice(e),o=h.parseFromString(t,"text/xml"),k(o)}f++}}}(f),n.xmpdata=o||{});r&&r.call(n)}var f,o;n.src?/^data\:/i.test(n.src)?e(function(n,t){t=t||n.match(/^data\:([^\;]+)\;base64,/im)[1]||"";n=n.replace(/^data\:([^\;]+)\;base64,/gim,"");for(var r=atob(n),u=r.length,f=new ArrayBuffer(u),e=new Uint8Array(f),i=0;i<u;i++)e[i]=r.charCodeAt(i);return f}(n.src)):/^blob\:/i.test(n.src)?((o=new FileReader).onload=function(n){e(n.target.result)},function(n,t){var i=new XMLHttpRequest;i.open("GET",n,!0);i.responseType="blob";i.onload=function(){200!=this.status&&0!==this.status||t(this.response)};i.send()}(n.src,function(n){o.readAsArrayBuffer(n)})):(f=new XMLHttpRequest,f.onload=function(){if(200!=this.status&&0!==this.status)throw"Could not load image";e(f.response);f=null},f.open("GET",n.src,!0),f.responseType="arraybuffer",f.send(null)):self.FileReader&&(n instanceof self.Blob||n instanceof self.File)&&((o=new FileReader).onload=function(n){i&&console.log("Got file of length "+n.target.result.byteLength);e(n.target.result)},o.readAsArrayBuffer(n))}function h(n){var r=new DataView(n),u,t,f;if(i&&console.log("Got file of length "+n.byteLength),255!=r.getUint8(0)||216!=r.getUint8(1))return i&&console.log("Not a valid JPEG"),!1;for(t=2,f=n.byteLength;t<f;){if(255!=r.getUint8(t))return i&&console.log("Not a valid marker at offset "+t+", found: "+r.getUint8(t)),!1;if(u=r.getUint8(t+1),i&&console.log(u),225==u)return i&&console.log("Found 0xFFE1 marker"),b(r,t+4,r.getUint16(t+2));t+=2+r.getUint16(t+2)}}function p(n,t,i){for(var h,r,c,l,o=new DataView(n),f={},e=t;e<t+i;)28===o.getUint8(e)&&2===o.getUint8(e+1)&&(l=o.getUint8(e+2))in s&&((c=o.getInt16(e+3))+5,r=s[l],h=u(o,e+5,c),f.hasOwnProperty(r)?f[r]instanceof Array?f[r].push(h):f[r]=[f[r],h]:f[r]=h),e++;return f}function e(n,t,r,u,f){for(var e,s,c=n.getUint16(r,!f),h={},o=0;o<c;o++)e=r+12*o+2,!(s=u[n.getUint16(e,!f)])&&i&&console.log("Unknown tag: "+n.getUint16(e,!f)),h[s]=w(n,e,t,r,f);return h}function w(n,t,i,r,f){var a,o,v,e,c,l,y=n.getUint16(t+2,!f),s=n.getUint32(t+4,!f),h=n.getUint32(t+8,!f)+i;switch(y){case 1:case 7:if(1==s)return n.getUint8(t+8,!f);for(a=s>4?h:t+8,o=[],e=0;e<s;e++)o[e]=n.getUint8(a+e);return o;case 2:return u(n,a=s>4?h:t+8,s-1);case 3:if(1==s)return n.getUint16(t+8,!f);for(a=s>2?h:t+8,o=[],e=0;e<s;e++)o[e]=n.getUint16(a+2*e,!f);return o;case 4:if(1==s)return n.getUint32(t+8,!f);for(o=[],e=0;e<s;e++)o[e]=n.getUint32(h+4*e,!f);return o;case 5:if(1==s)return c=n.getUint32(h,!f),l=n.getUint32(h+4,!f),(v=new Number(c/l)).numerator=c,v.denominator=l,v;for(o=[],e=0;e<s;e++)c=n.getUint32(h+8*e,!f),l=n.getUint32(h+4+8*e,!f),o[e]=new Number(c/l),o[e].numerator=c,o[e].denominator=l;return o;case 9:if(1==s)return n.getInt32(t+8,!f);for(o=[],e=0;e<s;e++)o[e]=n.getInt32(h+4*e,!f);return o;case 10:if(1==s)return n.getInt32(h,!f)/n.getInt32(h+4,!f);for(o=[],e=0;e<s;e++)o[e]=n.getInt32(h+8*e,!f)/n.getInt32(h+4+8*e,!f);return o}}function u(t,i,r){var u="";for(n=i;n<i+r;n++)u+=String.fromCharCode(t.getUint8(n));return u}function b(n,t){var h,y,r,o,p,s,w;if("Exif"!=u(n,t,4))return i&&console.log("Not valid EXIF data! "+u(n,t,4)),!1;if(s=t+6,18761==n.getUint16(s))h=!1;else{if(19789!=n.getUint16(s))return i&&console.log("Not valid TIFF data! (no 0x4949 or 0x4D4D)"),!1;h=!0}if(42!=n.getUint16(s+2,!h))return i&&console.log("Not valid TIFF data! (no 0x002A)"),!1;if(w=n.getUint32(s+4,!h),w<8)return i&&console.log("Not valid TIFF data! (First offset less than 8)",n.getUint32(s+4,!h)),!1;if((y=e(n,s,s+w,l,h)).ExifIFDPointer)for(r in o=e(n,s,s+y.ExifIFDPointer,c,h)){switch(r){case"LightSource":case"Flash":case"MeteringMode":case"ExposureProgram":case"SensingMethod":case"SceneCaptureType":case"SceneType":case"CustomRendered":case"WhiteBalance":case"GainControl":case"Contrast":case"Saturation":case"Sharpness":case"SubjectDistanceRange":case"FileSource":o[r]=f[r][o[r]];break;case"ExifVersion":case"FlashpixVersion":o[r]=String.fromCharCode(o[r][0],o[r][1],o[r][2],o[r][3]);break;case"ComponentsConfiguration":o[r]=f.Components[o[r][0]]+f.Components[o[r][1]]+f.Components[o[r][2]]+f.Components[o[r][3]]}y[r]=o[r]}if(y.GPSInfoIFDPointer)for(r in p=e(n,s,s+y.GPSInfoIFDPointer,a,h)){switch(r){case"GPSVersionID":p[r]=p[r][0]+"."+p[r][1]+"."+p[r][2]+"."+p[r][3]}y[r]=p[r]}return y.thumbnail=function(n,t,i,r){var f=function(n,t,i){var r=n.getUint16(t,!i);return n.getUint32(t+2+12*r,!i)}(n,t+i,r),u,o,s;if(!f)return{};if(f>n.byteLength)return{};if(u=e(n,t,t+f,v,r),u.Compression)switch(u.Compression){case 6:u.JpegIFOffset&&u.JpegIFByteCount&&(o=t+u.JpegIFOffset,s=u.JpegIFByteCount,u.blob=new Blob([new Uint8Array(n.buffer,o,s)],{type:"image/jpeg"}));break;case 1:console.log("Thumbnail image format is TIFF, which is not implemented.");break;default:console.log("Unknown thumbnail image format '%s'",u.Compression)}else 2==u.PhotometricInterpretation&&console.log("Thumbnail image format is RGB, which is not implemented.");return u}(n,s,w,h),y}function o(n){var t={},r,e,u,f,i,s;if(1==n.nodeType){if(n.attributes.length>0)for(t["@attributes"]={},r=0;r<n.attributes.length;r++)e=n.attributes.item(r),t["@attributes"][e.nodeName]=e.nodeValue}else if(3==n.nodeType)return n.nodeValue;if(n.hasChildNodes())for(u=0;u<n.childNodes.length;u++)f=n.childNodes.item(u),i=f.nodeName,null==t[i]?t[i]=o(f):(null==t[i].push&&(s=t[i],t[i]=[],t[i].push(s)),t[i].push(o(f)));return t}function k(n){var t,u,r,f,e,i,c;try{if(t={},n.children.length>0)for(u=0;u<n.children.length;u++){r=n.children.item(u);f=r.attributes;for(e in f){var s=f[e],h=s.nodeName,l=s.nodeValue;void 0!==h&&(t[h]=l)}i=r.nodeName;void 0===t[i]?t[i]=o(r):(void 0===t[i].push&&(c=t[i],t[i]=[],t[i].push(c)),t[i].push(o(r)))}else t=n.textContent;return t}catch(n){console.log(n.message)}}var i=!1,t=function(n){return n instanceof t?n:this instanceof t?void(this.EXIFwrapped=n):new t(n)},s;"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=t),exports.EXIF=t):this.EXIF=t;var c=t.Tags={36864:"ExifVersion",40960:"FlashpixVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",37121:"ComponentsConfiguration",37122:"CompressedBitsPerPixel",37500:"MakerNote",37510:"UserComment",40964:"RelatedSoundFile",36867:"DateTimeOriginal",36868:"DateTimeDigitized",37520:"SubsecTime",37521:"SubsecTimeOriginal",37522:"SubsecTimeDigitized",33434:"ExposureTime",33437:"FNumber",34850:"ExposureProgram",34852:"SpectralSensitivity",34855:"ISOSpeedRatings",34856:"OECF",37377:"ShutterSpeedValue",37378:"ApertureValue",37379:"BrightnessValue",37380:"ExposureBias",37381:"MaxApertureValue",37382:"SubjectDistance",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37396:"SubjectArea",37386:"FocalLength",41483:"FlashEnergy",41484:"SpatialFrequencyResponse",41486:"FocalPlaneXResolution",41487:"FocalPlaneYResolution",41488:"FocalPlaneResolutionUnit",41492:"SubjectLocation",41493:"ExposureIndex",41495:"SensingMethod",41728:"FileSource",41729:"SceneType",41730:"CFAPattern",41985:"CustomRendered",41986:"ExposureMode",41987:"WhiteBalance",41988:"DigitalZoomRation",41989:"FocalLengthIn35mmFilm",41990:"SceneCaptureType",41991:"GainControl",41992:"Contrast",41993:"Saturation",41994:"Sharpness",41995:"DeviceSettingDescription",41996:"SubjectDistanceRange",40965:"InteroperabilityIFDPointer",42016:"ImageUniqueID"},l=t.TiffTags={256:"ImageWidth",257:"ImageHeight",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer",40965:"InteroperabilityIFDPointer",258:"BitsPerSample",259:"Compression",262:"PhotometricInterpretation",274:"Orientation",277:"SamplesPerPixel",284:"PlanarConfiguration",530:"YCbCrSubSampling",531:"YCbCrPositioning",282:"XResolution",283:"YResolution",296:"ResolutionUnit",273:"StripOffsets",278:"RowsPerStrip",279:"StripByteCounts",513:"JPEGInterchangeFormat",514:"JPEGInterchangeFormatLength",301:"TransferFunction",318:"WhitePoint",319:"PrimaryChromaticities",529:"YCbCrCoefficients",532:"ReferenceBlackWhite",306:"DateTime",270:"ImageDescription",271:"Make",272:"Model",305:"Software",315:"Artist",33432:"Copyright"},a=t.GPSTags={0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude",5:"GPSAltitudeRef",6:"GPSAltitude",7:"GPSTimeStamp",8:"GPSSatellites",9:"GPSStatus",10:"GPSMeasureMode",11:"GPSDOP",12:"GPSSpeedRef",13:"GPSSpeed",14:"GPSTrackRef",15:"GPSTrack",16:"GPSImgDirectionRef",17:"GPSImgDirection",18:"GPSMapDatum",19:"GPSDestLatitudeRef",20:"GPSDestLatitude",21:"GPSDestLongitudeRef",22:"GPSDestLongitude",23:"GPSDestBearingRef",24:"GPSDestBearing",25:"GPSDestDistanceRef",26:"GPSDestDistance",27:"GPSProcessingMethod",28:"GPSAreaInformation",29:"GPSDateStamp",30:"GPSDifferential"},v=t.IFD1Tags={256:"ImageWidth",257:"ImageHeight",258:"BitsPerSample",259:"Compression",262:"PhotometricInterpretation",273:"StripOffsets",274:"Orientation",277:"SamplesPerPixel",278:"RowsPerStrip",279:"StripByteCounts",282:"XResolution",283:"YResolution",284:"PlanarConfiguration",296:"ResolutionUnit",513:"JpegIFOffset",514:"JpegIFByteCount",529:"YCbCrCoefficients",530:"YCbCrSubSampling",531:"YCbCrPositioning",532:"ReferenceBlackWhite"},f=t.StringValues={ExposureProgram:{0:"Not defined",1:"Manual",2:"Normal program",3:"Aperture priority",4:"Shutter priority",5:"Creative program",6:"Action program",7:"Portrait mode",8:"Landscape mode"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{0:"Unknown",1:"Daylight",2:"Fluorescent",3:"Tungsten (incandescent light)",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 - 5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},SensingMethod:{1:"Not defined",2:"One-chip color area sensor",3:"Two-chip color area sensor",4:"Three-chip color area sensor",5:"Color sequential area sensor",7:"Trilinear sensor",8:"Color sequential linear sensor"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},SceneType:{1:"Directly photographed"},CustomRendered:{0:"Normal process",1:"Custom process"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},GainControl:{0:"None",1:"Low gain up",2:"High gain up",3:"Low gain down",4:"High gain down"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},SubjectDistanceRange:{0:"Unknown",1:"Macro",2:"Close view",3:"Distant view"},FileSource:{3:"DSC"},Components:{0:"",1:"Y",2:"Cb",3:"Cr",4:"R",5:"G",6:"B"}};s={120:"caption",110:"credit",25:"keywords",55:"dateCreated",80:"byline",85:"bylineTitle",122:"captionWriter",105:"headline",116:"copyright",15:"category"};t.enableXmp=function(){t.isXmpEnabled=!0};t.disableXmp=function(){t.isXmpEnabled=!1};t.getData=function(n,t){return!(!self.Image&&!self.HTMLImageElement||!(n instanceof self.Image||n instanceof self.HTMLImageElement))&&(r(n)?t&&t.call(n):y(n,t),!0)};t.getTag=function(n,t){if(r(n))return n.exifdata[t]};t.getIptcTag=function(n,t){if(r(n))return n.iptcdata[t]};t.getAllTags=function(n){if(!r(n))return{};var t,i=n.exifdata,u={};for(t in i)i.hasOwnProperty(t)&&(u[t]=i[t]);return u};t.getAllIptcTags=function(n){if(!r(n))return{};var t,i=n.iptcdata,u={};for(t in i)i.hasOwnProperty(t)&&(u[t]=i[t]);return u};t.pretty=function(n){if(!r(n))return"";var t,i=n.exifdata,u="";for(t in i)i.hasOwnProperty(t)&&(u+="object"==typeof i[t]?i[t]instanceof Number?t+" : "+i[t]+" ["+i[t].numerator+"/"+i[t].denominator+"]\r\n":t+" : ["+i[t].length+" values]\r\n":t+" : "+i[t]+"\r\n");return u};t.readFromBinaryFile=function(n){return h(n)};"function"==typeof define&&define.amd&&define("exif-js",[],function(){return t})}.call(this)