11 lines
8.5 KiB
JavaScript
11 lines
8.5 KiB
JavaScript
|
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d2106a6"],{b893:function(e,t,r){"use strict";
|
||
|
/*!
|
||
|
* Image Compressor v1.1.4
|
||
|
* https://xkeshi.github.io/image-compressor
|
||
|
*
|
||
|
* Copyright 2017-present Chen Fengyuan
|
||
|
* Released under the MIT license
|
||
|
*
|
||
|
* Date: 2018-06-20T07:28:41.051Z
|
||
|
*/
|
||
|
function n(e,t){return t={exports:{}},e(t,t.exports),t.exports}r.d(t,"a",(function(){return A})),r.d(t,"c",(function(){return R})),r.d(t,"b",(function(){return E})),r.d(t,"f",(function(){return L})),r.d(t,"e",(function(){return H})),r.d(t,"d",(function(){return j}));var a=n((function(e){(function(t){var r=t.HTMLCanvasElement&&t.HTMLCanvasElement.prototype,n=t.Blob&&function(){try{return Boolean(new Blob)}catch(e){return!1}}(),a=n&&t.Uint8Array&&function(){try{return 100===new Blob([new Uint8Array(100)]).size}catch(e){return!1}}(),i=t.BlobBuilder||t.WebKitBlobBuilder||t.MozBlobBuilder||t.MSBlobBuilder,o=/^data:((.*?)(;charset=.*?)?)(;base64)?,/,c=(n||i)&&t.atob&&t.ArrayBuffer&&t.Uint8Array&&function(e){var t,r,c,u,l,s,f,h,d;if(t=e.match(o),!t)throw new Error("invalid data URI");for(r=t[2]?t[1]:"text/plain"+(t[3]||";charset=US-ASCII"),c=!!t[4],u=e.slice(t[0].length),l=c?atob(u):decodeURIComponent(u),s=new ArrayBuffer(l.length),f=new Uint8Array(s),h=0;h<l.length;h+=1)f[h]=l.charCodeAt(h);return n?new Blob([a?f:s],{type:r}):(d=new i,d.append(s),d.getBlob(r))};t.HTMLCanvasElement&&!r.toBlob&&(r.mozGetAsFile?r.toBlob=function(e,t,n){var a=this;setTimeout((function(){n&&r.toDataURL&&c?e(c(a.toDataURL(t,n))):e(a.mozGetAsFile("blob",t))}))}:r.toDataURL&&c&&(r.toBlob=function(e,t,r){var n=this;setTimeout((function(){e(c(n.toDataURL(t,r)))}))})),e.exports?e.exports=c:t.dataURLtoBlob=c})(window)})),i=Object.prototype.toString,o=function(e){return e instanceof Blob||"[object Blob]"===i.call(e)},c={checkOrientation:!0,maxWidth:1/0,maxHeight:1/0,minWidth:0,minHeight:0,width:void 0,height:void 0,quality:.8,mimeType:"auto",convertSize:5e6,beforeDraw:null,drew:null,success:null,error:null},u=/^image\/.+$/;function l(e){return u.test(e)}function s(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=l(e)?e.substr(6):"";return"jpeg"===r&&(r="jpg"),r&&t&&(r="."+r),r}var f=String.fromCharCode;function h(e,t,r){var n="",a=void 0;for(r+=t,a=t;a<r;a+=1)n+=f(e.getUint8(a));return n}var d=window,m=d.btoa;function w(e,t){var r=new Uint8Array(e),n="";if("function"===typeof r.forEach)r.forEach((function(e){n+=f(e)}));else for(var a=r.length,i=0;i<a;i+=1)n+=f(r[i]);return"data:"+t+";base64,"+m(n)}function g(e){var t=new DataView(e),r=void 0,n=void 0,a=void 0,i=void 0;if(255===t.getUint8(0)&&216===t.getUint8(1)){var o=t.byteLength,c=2;while(c<o){if(255===t.getUint8(c)&&225===t.getUint8(c+1)){a=c;break}c+=1}}if(a){var u=a+4,l=a+10;if("Exif"===h(t,u,4)){var s=t.getUint16(l);if(n=18761===s,(n||19789===s)&&42===t.getUint16(l+2,n)){var f=t.getUint32(l+4,n);f>=8&&(i=l+f)}}}if(i){var d=t.getUint16(i,n),m=void 0,w=void 0;for(w=0;w<d;w+=1)if(m=i+12*w+2,274===t.getUint16(m,n)){m+=8,r=t.getUint16(m,n),t.setUint16(m,1,n);break}}return r}function b(e){var t=0,r=1,n=1;switch(e){case 2:r=-1;break;case 3:t=-180;break;case 4:n=-1;break;case 5:t=90,n=-1;break;case 6:t=90;break;case 7:t=90,r=-1;break;case 8:t=-90;break;default:}return{rotate:t,scaleX:r,scaleY:n}}var v=/\.\d*(?:0|9){12}\d*$/i;function p(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e11;return v.test(e)?Math.round(e*t)/t:e}var y=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},M=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),U=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},D=window,B=D.ArrayBuffer,k=D.FileReader,x=window.URL||window.webkitURL,S=/\.\w+$/,T=function(){function e(t,r){y(this,e),this.result=null,t&&this.compress(t,r)}return M(e,[{key:"compress",value:function(e,t){var r=this,n=new Image;return t=U({},c,t),B||(t.checkOrientation=!1),new Promise((function(r,n){if(o(e)){var a=e.type;if(l(a))if(x||k){if(x&&!t.checkOrientation)r({url:x.createObjectURL(e)});else if(k){var i=new k,c=t.checkOrientation&&"image/jpeg"=
|