12 |
- !function(t){function e(r){if(i[r])return i[r].exports;var s=i[r]={i:r,l:!1,exports:{}};return t[r].call(s.exports,s,s.exports,e),s.l=!0,s.exports}var i={};e.m=t,e.c=i,e.d=function(t,i,r){e.o(t,i)||Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/dist/",e(e.s=0)}([function(t,e){~function(){function t(t,e,i,r){function a(t,e){F[P++]=t,P>=254&&d(e)}function f(t){c(u),D=S+2,G=!0,b(S,t)}function c(t){for(var e=0;e<t;++e)A[e]=-1}function y(t,e){var i,r,s,o,a,p,y;for(m=t,G=!1,n=m,B=g(n),S=1<<t-1,T=S+1,D=S+2,P=0,o=x(),y=0,i=u;i<65536;i*=2)++y;y=8-y,p=u,c(p),b(S,e);t:for(;(r=x())!=h;)if(i=(r<<l)+o,s=r<<y^o,A[s]!==i){if(A[s]>=0){a=p-s,0===s&&(a=1);do{if((s-=a)<0&&(s+=p),A[s]===i){o=C[s];continue t}}while(A[s]>=0)}b(o,e),o=r,D<1<<l?(C[s]=D++,A[s]=i):f(e)}else o=C[s];b(o,e),b(T,e)}function w(i){i.writeByte(M),s=t*e,o=0,y(M+1,i),i.writeByte(0)}function d(t){P>0&&(t.writeByte(P),t.writeBytes(F,0,P),P=0)}function g(t){return(1<<t)-1}function x(){return 0===s?h:(--s,255&i[o++])}function b(t,e){for(v&=p[I],I>0?v|=t<<I:v=t,I+=n;I>=8;)a(255&v,e),v>>=8,I-=8;if((D>B||G)&&(G?(B=g(n=m),G=!1):(++n,B=n==l?1<<l:g(n))),t==T){for(;I>0;)a(255&v,e),v>>=8,I-=8;d(e)}}var v,P,B,m,S,T,M=Math.max(2,r),F=new Uint8Array(256),A=new Int32Array(u),C=new Int32Array(u),I=0,D=0,G=!1;this.encode=w}function e(t,e){function i(){B=[],S=new Int32Array(256),R=new Int32Array(c),U=new Int32Array(c),Q=new Int32Array(c>>3);var t,e;for(t=0;t<c;t++)e=(t<<w+8)/c,B[t]=new Float64Array([e,e,e,0]),U[t]=g/c,R[t]=0}function r(){for(var t=0;t<c;t++)B[t][0]>>=w,B[t][1]>>=w,B[t][2]>>=w,B[t][3]=t}function s(t,e,i,r,s){B[e][0]-=t*(B[e][0]-i)/F,B[e][1]-=t*(B[e][1]-r)/F,B[e][2]-=t*(B[e][2]-s)/F}function o(t,e,i,r,s){for(var o,n,a=Math.abs(e-t),h=Math.min(e+t,c),l=e+1,u=e-1,p=1;l<h||u>a;)n=Q[p++],l<h&&(o=B[l++],o[0]-=n*(o[0]-i)/C,o[1]-=n*(o[1]-r)/C,o[2]-=n*(o[2]-s)/C),u>a&&(o=B[u--],o[0]-=n*(o[0]-i)/C,o[1]-=n*(o[1]-r)/C,o[2]-=n*(o[2]-s)/C)}function n(t,e,i){var r,s,o,n,a,h=~(1<<31),l=h,u=-1,p=u;for(r=0;r<c;r++)s=B[r],o=Math.abs(s[0]-t)+Math.abs(s[1]-e)+Math.abs(s[2]-i),o<h&&(h=o,u=r),n=o-(R[r]>>d-w),n<l&&(l=n,p=r),a=U[r]>>b,U[r]-=a,R[r]+=a<<x;return U[u]+=v,R[u]-=P,p}function a(){var t,e,i,r,s,o,n=0,a=0;for(t=0;t<c;t++){for(i=B[t],s=t,o=i[1],e=t+1;e<c;e++)r=B[e],r[1]<o&&(s=e,o=r[1]);if(r=B[s],t!=s&&(e=r[0],r[0]=i[0],i[0]=e,e=r[1],r[1]=i[1],i[1]=e,e=r[2],r[2]=i[2],i[2]=e,e=r[3],r[3]=i[3],i[3]=e),o!=n){for(S[n]=a+t>>1,e=n+1;e<o;e++)S[e]=t;n=o,a=t}}for(S[n]=a+y>>1,e=n+1;e<256;e++)S[e]=y}function h(t,e,i){for(var r,s,o,n=1e3,a=-1,h=S[e],l=h-1;h<c||l>=0;)h<c&&(s=B[h],o=s[1]-e,o>=n?h=c:(h++,o<0&&(o=-o),r=s[0]-t,r<0&&(r=-r),(o+=r)<n&&(r=s[2]-i,r<0&&(r=-r),(o+=r)<n&&(n=o,a=s[3])))),l>=0&&(s=B[l],o=e-s[1],o>=n?l=-1:(l--,o<0&&(o=-o),r=s[0]-t,r<0&&(r=-r),(o+=r)<n&&(r=s[2]-i,r<0&&(r=-r),(o+=r)<n&&(n=o,a=s[3]))));return a}function l(){var i,r=t.length,a=30+(e-1)/3,h=r/(3*e),l=~~(h/f),u=F,p=T,c=p>>m;for(c<=1&&(c=0),i=0;i<c;i++)Q[i]=u*((c*c-i*i)*A/(c*c));var y;r<E?(e=1,y=3):y=r%I!=0?3*I:r%D!=0?3*D:r%G!=0?3*G:3*z;var d,g,x,b,v=0;for(i=0;i<h;)if(d=(255&t[v])<<w,g=(255&t[v+1])<<w,x=(255&t[v+2])<<w,b=n(d,g,x),s(u,b,d,g,x),0!==c&&o(c,b,d,g,x),v+=y,v>=r&&(v-=r),i++,0===l&&(l=1),i%l==0)for(u-=u/a,p-=p/M,c=p>>m,c<=1&&(c=0),b=0;b<c;b++)Q[b]=u*((c*c-b*b)*A/(c*c))}function u(){i(),l(),r(),a()}function p(){for(var t=[],e=[],i=0;i<c;i++)e[B[i][3]]=i;for(var r=0,s=0;s<c;s++){var o=e[s];t[r++]=B[o][0],t[r++]=B[o][1],t[r++]=B[o][2]}return t}var B,S,R,U,Q;this.buildColormap=u,this.getColormap=p,this.lookupRGB=h}function i(){this.page=-1,this.pages=[],this.newPage()}function r(t,e){this.width=~~t,this.height=~~e,this.transparent=null,this.transIndex=0,this.repeat=-1,this.delay=0,this.image=null,this.pixels=null,this.indexedPixels=null,this.colorDepth=null,this.colorTab=null,this.neuQuant=null,this.usedEntry=new Array,this.palSize=7,this.dispose=-1,this.firstFrame=!0,this.sample=10,this.dither=!1,this.globalPalette=!1,this.out=new i}var s,o,n,a,h=-1,l=12,u=5003,p=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],f=100,c=256,y=c-1,w=4,d=16,g=1<<d,x=10,b=10,v=g>>b,P=g<<x-b,B=c>>3,m=6,S=1<<m,T=B*S,M=30,F=1024,A=256,C=1<<18,I=499,D=491,G=487,z=503,E=3*z;a=function(t){var e,i,s,o;return e=new r(t.width,t.height),0===t.index?e.writeHeader():e.firstFrame=!1,e.setTransparent(t.transparent),e.setRepeat(t.repeat),e.setDelay(t.delay),e.setQuality(t.quality),e.setDither(t.dither),e.setGlobalPalette(t.globalPalette),e.addFrame(t.data),t.last&&e.finish(),!0===t.globalPalette&&(t.globalPalette=e.getGlobalPalette()),s=e.stream(),t.data=s.pages,t.cursor=s.cursor,t.pageSize=s.constructor.pageSize,t.canTransfer?(o=function(){var e,r,s,o;for(s=t.data,o=[],e=0,r=s.length;e<r;e++)i=s[e],o.push(i.buffer);return o}(),self.postMessage(t,o)):self.postMessage(t)},self.onmessage=function(t){return a(t.data)},i.pageSize=4096,i.charMap={};for(var R=0;R<256;R++)i.charMap[R]=String.fromCharCode(R);i.prototype.newPage=function(){this.pages[++this.page]=new Uint8Array(i.pageSize),this.cursor=0},i.prototype.getData=function(){for(var t="",e=0;e<this.pages.length;e++)for(var r=0;r<i.pageSize;r++)t+=i.charMap[this.pages[e][r]];return t},i.prototype.writeByte=function(t){this.cursor>=i.pageSize&&this.newPage(),this.pages[this.page][this.cursor++]=t},i.prototype.writeUTFBytes=function(t){for(var e=t.length,i=0;i<e;i++)this.writeByte(t.charCodeAt(i))},i.prototype.writeBytes=function(t,e,i){for(var r=i||t.length,s=e||0;s<r;s++)this.writeByte(t[s])},r.prototype.setDelay=function(t){this.delay=Math.round(t/10)},r.prototype.setFrameRate=function(t){this.delay=Math.round(100/t)},r.prototype.setDispose=function(t){t>=0&&(this.dispose=t)},r.prototype.setRepeat=function(t){this.repeat=t},r.prototype.setTransparent=function(t){this.transparent=t},r.prototype.addFrame=function(t){this.image=t,this.colorTab=this.globalPalette&&this.globalPalette.slice?this.globalPalette:null,this.getImagePixels(),this.analyzePixels(),!0===this.globalPalette&&(this.globalPalette=this.colorTab),this.firstFrame&&(this.writeLSD(),this.writePalette(),this.repeat>=0&&this.writeNetscapeExt()),this.writeGraphicCtrlExt(),this.writeImageDesc(),this.firstFrame||this.globalPalette||this.writePalette(),this.writePixels(),this.firstFrame=!1},r.prototype.finish=function(){this.out.writeByte(59)},r.prototype.setQuality=function(t){t<1&&(t=1),this.sample=t},r.prototype.setDither=function(t){!0===t&&(t="FloydSteinberg"),this.dither=t},r.prototype.setGlobalPalette=function(t){this.globalPalette=t},r.prototype.getGlobalPalette=function(){return this.globalPalette&&this.globalPalette.slice&&this.globalPalette.slice(0)||this.globalPalette},r.prototype.writeHeader=function(){this.out.writeUTFBytes("GIF89a")},r.prototype.analyzePixels=function(){this.colorTab||(this.neuQuant=new e(this.pixels,this.sample),this.neuQuant.buildColormap(),this.colorTab=this.neuQuant.getColormap()),this.dither?this.ditherPixels(this.dither.replace("-serpentine",""),null!==this.dither.match(/-serpentine/)):this.indexPixels(),this.pixels=null,this.colorDepth=8,this.palSize=7,null!==this.transparent&&(this.transIndex=this.findClosest(this.transparent,!0))},r.prototype.indexPixels=function(t){var e=this.pixels.length/3;this.indexedPixels=new Uint8Array(e);for(var i=0,r=0;r<e;r++){var s=this.findClosestRGB(255&this.pixels[i++],255&this.pixels[i++],255&this.pixels[i++]);this.usedEntry[s]=!0,this.indexedPixels[r]=s}},r.prototype.ditherPixels=function(t,e){var i={FalseFloydSteinberg:[[3/8,1,0],[3/8,0,1],[.25,1,1]],FloydSteinberg:[[7/16,1,0],[3/16,-1,1],[5/16,0,1],[1/16,1,1]],Stucki:[[8/42,1,0],[4/42,2,0],[2/42,-2,1],[4/42,-1,1],[8/42,0,1],[4/42,1,1],[2/42,2,1],[1/42,-2,2],[2/42,-1,2],[4/42,0,2],[2/42,1,2],[1/42,2,2]],Atkinson:[[1/8,1,0],[1/8,2,0],[1/8,-1,1],[1/8,0,1],[1/8,1,1],[1/8,0,2]]};if(!t||!i[t])throw"Unknown dithering kernel: "+t;var r=i[t],s=0,o=this.height,n=this.width,a=this.pixels,h=e?-1:1;this.indexedPixels=new Uint8Array(this.pixels.length/3);for(var l=0;l<o;l++){e&&(h*=-1);for(var u=1==h?0:n-1,p=1==h?n:0;u!==p;u+=h){s=l*n+u;var f=3*s,c=a[f],y=a[f+1],w=a[f+2];f=this.findClosestRGB(c,y,w),this.usedEntry[f]=!0,this.indexedPixels[s]=f,f*=3;for(var d=this.colorTab[f],g=this.colorTab[f+1],x=this.colorTab[f+2],b=c-d,v=y-g,P=w-x,B=1==h?0:r.length-1,m=1==h?r.length:0;B!==m;B+=h){var S=r[B][1],T=r[B][2];if(S+u>=0&&S+u<n&&T+l>=0&&T+l<o){var M=r[B][0];f=s+S+T*n,f*=3,a[f]=Math.max(0,Math.min(255,a[f]+b*M)),a[f+1]=Math.max(0,Math.min(255,a[f+1]+v*M)),a[f+2]=Math.max(0,Math.min(255,a[f+2]+P*M))}}}}},r.prototype.findClosest=function(t,e){return this.findClosestRGB((16711680&t)>>16,(65280&t)>>8,255&t,e)},r.prototype.findClosestRGB=function(t,e,i,r){if(null===this.colorTab)return-1;if(this.neuQuant&&!r)return this.neuQuant.lookupRGB(t,e,i);for(var s=0,o=16777216,n=this.colorTab.length,a=0,h=0;a<n;h++){var l=t-(255&this.colorTab[a++]),u=e-(255&this.colorTab[a++]),p=i-(255&this.colorTab[a++]),f=l*l+u*u+p*p;(!r||this.usedEntry[h])&&f<o&&(o=f,s=h)}return s},r.prototype.getImagePixels=function(){var t=this.width,e=this.height;this.pixels=new Uint8Array(t*e*3);for(var i=this.image,r=0,s=0,o=0;o<e;o++)for(var n=0;n<t;n++)this.pixels[s++]=i[r++],this.pixels[s++]=i[r++],this.pixels[s++]=i[r++],r++},r.prototype.writeGraphicCtrlExt=function(){this.out.writeByte(33),this.out.writeByte(249),this.out.writeByte(4);var t,e;null===this.transparent?(t=0,e=0):(t=1,e=2),this.dispose>=0&&(e=7&dispose),e<<=2,this.out.writeByte(0|e|t),this.writeShort(this.delay),this.out.writeByte(this.transIndex),this.out.writeByte(0)},r.prototype.writeImageDesc=function(){this.out.writeByte(44),this.writeShort(0),this.writeShort(0),this.writeShort(this.width),this.writeShort(this.height),this.firstFrame||this.globalPalette?this.out.writeByte(0):this.out.writeByte(128|this.palSize)},r.prototype.writeLSD=function(){this.writeShort(this.width),this.writeShort(this.height),this.out.writeByte(240|this.palSize),this.out.writeByte(0),this.out.writeByte(0)},r.prototype.writeNetscapeExt=function(){this.out.writeByte(33),this.out.writeByte(255),this.out.writeByte(11),this.out.writeUTFBytes("NETSCAPE2.0"),this.out.writeByte(3),this.out.writeByte(1),this.writeShort(this.repeat),this.out.writeByte(0)},r.prototype.writePalette=function(){this.out.writeBytes(this.colorTab);for(var t=768-this.colorTab.length,e=0;e<t;e++)this.out.writeByte(0)},r.prototype.writeShort=function(t){this.out.writeByte(255&t),this.out.writeByte(t>>8&255)},r.prototype.writePixels=function(){new t(this.width,this.height,this.indexedPixels,this.colorDepth).encode(this.out)},r.prototype.stream=function(){return this.out}}()}]);
- //# sourceMappingURL=2c74dc4a359491c13776.worker.js.map
|