!function(i){function o(e,t){var i,n,r;if("string"==typeof e)return s(e);for(i=[],n=e.length,r=0;r>0,r=!0;n&&(e.on("beforeFileQueued",function(e){return n<=i&&r&&(r=!1,this.trigger("error","Q_EXCEED_NUM_LIMIT",n,e),setTimeout(function(){r=!0},1)),!(n<=i)}),e.on("fileQueued",function(){i++}),e.on("fileDequeued",function(){i--}),e.on("uploadFinished",function(){i=0}))}),n.addValidator("fileSizeLimit",function(){var e=this,t=e.options,i=0,n=t.fileSizeLimit>>0,r=!0;n&&(e.on("beforeFileQueued",function(e){var t=i+e.size>n;return t&&r&&(r=!1,this.trigger("error","Q_EXCEED_SIZE_LIMIT",n,e),setTimeout(function(){r=!0},1)),!t}),e.on("fileQueued",function(e){i+=e.size}),e.on("fileDequeued",function(e){i-=e.size}),e.on("uploadFinished",function(){i=0}))}),n.addValidator("fileSingleSizeLimit",function(){var t=this.options.fileSingleSizeLimit;t&&this.on("beforeFileQueued",function(e){if(e.size>t)return e.setStatus(i.Status.INVALID,"exceed_size"),this.trigger("error","F_EXCEED_SIZE",e),!1})}),n.addValidator("duplicate",function(){var e=this.options,i={};e.duplicate||(this.on("beforeFileQueued",function(e){var t=e.__hash||(e.__hash=function(e){for(var t=0,i=0,n=e.length;is.byteLength);){if(r=d.parsers[i],!t&&r)for(o=0;oe.byteLength)){if(1===r)return f.getValue(e,a,o);for(u=[],c=0;ce.byteLength)h.log("Invalid Exif data: Invalid directory offset.");else{if(!((s=i+2+12*(o=e.getUint16(i,n)))+4>e.byteLength)){for(a=0;ae.byteLength)h.log("Invalid Exif data: Invalid segment size.");else if(0===e.getUint16(t+8)){switch(e.getUint16(s)){case 18761:r=!0;break;case 19789:r=!1;break;default:return void h.log("Invalid Exif data: Invalid byte alignment marker.")}42===e.getUint16(s+2,r)?(o=e.getUint32(s+4,r),n.exif=new p.ExifMap,o=p.parseExifTags(e,s,s+o,r,n)):h.log("Invalid Exif data: Missing TIFF marker.")}else h.log("Invalid Exif data: Missing byte alignment offset.")},e.parsers[65505].push(p.parseExifData),p}),t("runtime/html5/image",["base","runtime/html5/runtime","runtime/html5/util"],function(e,t,r){return t.register("Image",{modified:!1,init:function(){var i=this,e=new Image;e.onload=function(){i._info={type:i.type,width:this.width,height:this.height},i._metas||"image/jpeg"!==i.type?i.owner.trigger("load"):r.parseMeta(i._blob,function(e,t){i._metas=t,i.owner.trigger("load")})},e.onerror=function(){i.owner.trigger("error")},i._img=e},loadFromBlob:function(e){var t=this._img;this._blob=e,this.type=e.type,t.src=r.createObjectURL(e.getSource()),this.owner.once("load",function(){r.revokeObjectURL(t.src)})},resize:function(e,t){var i=this._canvas||(this._canvas=document.createElement("canvas"));this._resize(this._img,i,e,t),this._blob=null,this.modified=!0,this.owner.trigger("complete")},getAsBlob:function(e){var t,i=this._blob,n=this.options;if(e=e||this.type,this.modified||this.type!==e){if(t=this._canvas,"image/jpeg"===e){if(i=r.canvasToDataUrl(t,"image/jpeg",n.quality),n.preserveHeaders&&this._metas&&this._metas.imageHead)return i=r.dataURL2ArrayBuffer(i),i=r.updateImageHead(i,this._metas.imageHead),i=r.arrayBufferToBlob(i,e)}else i=r.canvasToDataUrl(t,e);i=r.dataURL2Blob(i)}return i},getAsDataUrl:function(e){var t=this.options;return"image/jpeg"===(e=e||this.type)?r.canvasToDataUrl(this._canvas,e,t.quality):this._canvas.toDataURL(e)},getOrientation:function(){return this._metas&&this._metas.exif&&this._metas.exif.get("Orientation")||1},info:function(e){return e?(this._info=e,this):this._info},meta:function(e){return e?(this._meta=e,this):this._meta},destroy:function(){var e=this._canvas;this._img.onload=null,e&&(e.getContext("2d").clearRect(0,0,e.width,e.height),e.width=e.height=0,this._canvas=null),this._img.src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs%3D",this._img=this._blob=null},_resize:function(e,t,i,n){var r,o,s,a,u,c=this.options,l=e.width,d=e.height,f=this.getOrientation();~[5,6,7,8].indexOf(f)&&(i^=n,i^=n^=i),r=Math[c.crop?"max":"min"](i/l,n/d),c.allowMagnify||(r=Math.min(1,r)),o=l*r,s=d*r,c.crop?(t.width=i,t.height=n):(t.width=o,t.height=s),a=(t.width-o)/2,u=(t.height-s)/2,c.preserveHeaders||this._rotate2Orientaion(t,f),this._renderImageToCanvas(t,e,a,u,o,s)},_rotate2Orientaion:function(e,t){var i=e.width,n=e.height,r=e.getContext("2d");switch(t){case 5:case 6:case 7:case 8:e.width=n,e.height=i}switch(t){case 2:r.translate(i,0),r.scale(-1,1);break;case 3:r.translate(i,n),r.rotate(Math.PI);break;case 4:r.translate(0,n),r.scale(1,-1);break;case 5:r.rotate(.5*Math.PI),r.scale(1,-1);break;case 6:r.rotate(.5*Math.PI),r.translate(0,-n);break;case 7:r.rotate(.5*Math.PI),r.translate(i,-n),r.scale(-1,1);break;case 8:r.rotate(-.5*Math.PI),r.translate(-i,0)}},_renderImageToCanvas:function(){if(!e.os.ios)return function(e,t,i,n,r,o){e.getContext("2d").drawImage(t,i,n,r,o)};function k(e,t,i){var n,r,o=document.createElement("canvas"),s=o.getContext("2d"),a=0,u=i,c=i;for(o.width=1,o.height=i,s.drawImage(e,0,0),n=s.getImageData(0,0,1,i).data;a>1;return 0==(r=c/i)?1:r}return 7<=e.os.ios?function(e,t,i,n,r,o){var s=t.naturalWidth,a=t.naturalHeight,u=k(t,0,a);return e.getContext("2d").drawImage(t,0,0,s*u,a*u,i,n,r,o)}:function(e,t,i,n,r,o){var s,a,u,c,l,d,f,h,p,g,m,v=t.naturalWidth,b=t.naturalHeight,_=e.getContext("2d"),y=1048576<(m=(h=t).naturalWidth)*h.naturalHeight&&((p=document.createElement("canvas")).width=p.height=1,(g=p.getContext("2d")).drawImage(h,1-m,0),0===g.getImageData(0,0,1,1).data[3]),w="image/jpeg"===this.type,x=1024,R=0,E=0;for(y&&(v/=2,b/=2),_.save(),(s=document.createElement("canvas")).width=s.height=x,a=s.getContext("2d"),u=w?k(t,0,b):1,c=Math.ceil(x*r/v),l=Math.ceil(x*o/b/u);R