three-stdlib 2.8.8 → 2.8.9
Sign up to get free protection for your applications and to get access to all the features.
- package/index.cjs.js +1 -1
- package/loaders/RGBELoader.cjs.js +1 -1
- package/loaders/RGBELoader.js +3 -3
- package/loaders/RGBMLoader.cjs.js +1 -1
- package/loaders/RGBMLoader.js +190 -268
- package/package.json +1 -1
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three");class t extends e.DataTextureLoader{constructor(t){super(t),this.type=e.HalfFloatType}parse(t){const r=function(e,t){switch(e){case 1:console.error("THREE.RGBELoader Read Error: "+(t||""));break;case 2:console.error("THREE.RGBELoader Write Error: "+(t||""));break;case 3:console.error("THREE.RGBELoader Bad File Format: "+(t||""));break;default:case 4:console.error("THREE.RGBELoader: Error: "+(t||""))}return-1},a=function(e,t,r){t=t||1024;let a=e.pos,n=-1,o=0,s="",i=String.fromCharCode.apply(null,new Uint16Array(e.subarray(a,a+128)));for(;0>(n=i.indexOf("\n"))&&o<t&&a<e.byteLength;)s+=i,o+=i.length,a+=128,i+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(a,a+128)));return-1<n&&(!1!==r&&(e.pos+=o+n+1),s+i.slice(0,n))},n=function(e,t,r,a){const n=e[t+3],o=Math.pow(2,n-128)/255;r[a+0]=e[t+0]*o,r[a+1]=e[t+1]*o,r[a+2]=e[t+2]*o,r[a+3]=1},o=function(t,r,a,n){const o=t[r+3],s=Math.pow(2,o-128)/255;a[n+0]=e.DataUtils.toHalfFloat(Math.min(t[r+0]*s,65504)),a[n+1]=e.DataUtils.toHalfFloat(Math.min(t[r+1]*s,65504)),a[n+2]=e.DataUtils.toHalfFloat(Math.min(t[r+2]*s,65504)),a[n+3]=e.DataUtils.toHalfFloat(1)},s=new Uint8Array(t);s.pos=0;const i=function(e){const t=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,n=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,o=/^\s*FORMAT=(\S+)\s*$/,s=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,i={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let l,c;if(e.pos>=e.byteLength||!(l=a(e)))return r(1,"no header found");if(!(c=l.match(/^#\?(\S+)/)))return r(3,"bad initial token");for(i.valid|=1,i.programtype=c[1],i.string+=l+"\n";l=a(e),!1!==l;)if(i.string+=l+"\n","#"!==l.charAt(0)){if((c=l.match(t))&&(i.gamma=parseFloat(c[1]
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three");class t extends e.DataTextureLoader{constructor(t){super(t),this.type=e.HalfFloatType}parse(t){const r=function(e,t){switch(e){case 1:console.error("THREE.RGBELoader Read Error: "+(t||""));break;case 2:console.error("THREE.RGBELoader Write Error: "+(t||""));break;case 3:console.error("THREE.RGBELoader Bad File Format: "+(t||""));break;default:case 4:console.error("THREE.RGBELoader: Error: "+(t||""))}return-1},a=function(e,t,r){t=t||1024;let a=e.pos,n=-1,o=0,s="",i=String.fromCharCode.apply(null,new Uint16Array(e.subarray(a,a+128)));for(;0>(n=i.indexOf("\n"))&&o<t&&a<e.byteLength;)s+=i,o+=i.length,a+=128,i+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(a,a+128)));return-1<n&&(!1!==r&&(e.pos+=o+n+1),s+i.slice(0,n))},n=function(e,t,r,a){const n=e[t+3],o=Math.pow(2,n-128)/255;r[a+0]=e[t+0]*o,r[a+1]=e[t+1]*o,r[a+2]=e[t+2]*o,r[a+3]=1},o=function(t,r,a,n){const o=t[r+3],s=Math.pow(2,o-128)/255;a[n+0]=e.DataUtils.toHalfFloat(Math.min(t[r+0]*s,65504)),a[n+1]=e.DataUtils.toHalfFloat(Math.min(t[r+1]*s,65504)),a[n+2]=e.DataUtils.toHalfFloat(Math.min(t[r+2]*s,65504)),a[n+3]=e.DataUtils.toHalfFloat(1)},s=new Uint8Array(t);s.pos=0;const i=function(e){const t=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,n=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,o=/^\s*FORMAT=(\S+)\s*$/,s=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,i={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let l,c;if(e.pos>=e.byteLength||!(l=a(e)))return r(1,"no header found");if(!(c=l.match(/^#\?(\S+)/)))return r(3,"bad initial token");for(i.valid|=1,i.programtype=c[1],i.string+=l+"\n";l=a(e),!1!==l;)if(i.string+=l+"\n","#"!==l.charAt(0)){if((c=l.match(t))&&(i.gamma=parseFloat(c[1])),(c=l.match(n))&&(i.exposure=parseFloat(c[1])),(c=l.match(o))&&(i.valid|=2,i.format=c[1]),(c=l.match(s))&&(i.valid|=4,i.height=parseInt(c[1],10),i.width=parseInt(c[2],10)),2&i.valid&&4&i.valid)break}else i.comments+=l+"\n";return 2&i.valid?4&i.valid?i:r(3,"missing image size specifier"):r(3,"missing format specifier")}(s);if(-1!==i){const t=i.width,a=i.height,l=function(e,t,a){const n=t;if(n<8||n>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);if(n!==(e[2]<<8|e[3]))return r(3,"wrong scanline width");const o=new Uint8Array(4*t*a);if(!o.length)return r(4,"unable to allocate buffer space");let s=0,i=0;const l=4*n,c=new Uint8Array(4),f=new Uint8Array(l);let p=a;for(;p>0&&i<e.byteLength;){if(i+4>e.byteLength)return r(1);if(c[0]=e[i++],c[1]=e[i++],c[2]=e[i++],c[3]=e[i++],2!=c[0]||2!=c[1]||(c[2]<<8|c[3])!=n)return r(3,"bad rgbe scanline format");let t,a=0;for(;a<l&&i<e.byteLength;){t=e[i++];const n=t>128;if(n&&(t-=128),0===t||a+t>l)return r(3,"bad scanline data");if(n){const r=e[i++];for(let e=0;e<t;e++)f[a++]=r}else f.set(e.subarray(i,i+t),a),a+=t,i+=t}const d=n;for(let e=0;e<d;e++){let t=0;o[s]=f[e+t],t+=n,o[s+1]=f[e+t],t+=n,o[s+2]=f[e+t],t+=n,o[s+3]=f[e+t],s+=4}p--}return o}(s.subarray(s.pos),t,a);if(-1!==l){let r,s,c,f;switch(this.type){case e.FloatType:f=l.length/4;const t=new Float32Array(4*f);for(let e=0;e<f;e++)n(l,4*e,t,4*e);r=t,c=e.FloatType;break;case e.HalfFloatType:f=l.length/4;const a=new Uint16Array(4*f);for(let e=0;e<f;e++)o(l,4*e,a,4*e);r=a,c=e.HalfFloatType;break;default:console.error("THREE.RGBELoader: unsupported type: ",this.type)}return{width:t,height:a,data:r,header:i.string,gamma:i.gamma,exposure:i.exposure,format:s,type:c}}}return null}setDataType(e){return this.type=e,this}load(t,r,a,n){return super.load(t,(function(t,a){switch(t.type){case e.FloatType:case e.HalfFloatType:t.encoding=e.LinearEncoding,t.minFilter=e.LinearFilter,t.magFilter=e.LinearFilter,t.generateMipmaps=!1,t.flipY=!0}r&&r(t,a)}),a,n)}}exports.RGBELoader=t;
|
package/loaders/RGBELoader.js
CHANGED
@@ -148,11 +148,11 @@ class RGBELoader extends DataTextureLoader {
|
|
148
148
|
}
|
149
149
|
|
150
150
|
if (match = line.match(gamma_re)) {
|
151
|
-
header.gamma = parseFloat(match[1]
|
151
|
+
header.gamma = parseFloat(match[1]);
|
152
152
|
}
|
153
153
|
|
154
154
|
if (match = line.match(exposure_re)) {
|
155
|
-
header.exposure = parseFloat(match[1]
|
155
|
+
header.exposure = parseFloat(match[1]);
|
156
156
|
}
|
157
157
|
|
158
158
|
if (match = line.match(format_re)) {
|
@@ -325,7 +325,7 @@ class RGBELoader extends DataTextureLoader {
|
|
325
325
|
const halfArray = new Uint16Array(numElements * 4);
|
326
326
|
|
327
327
|
for (let j = 0; j < numElements; j++) {
|
328
|
-
RGBEByteToRGBHalf(image_rgba_data, j * 4, halfArray, j *
|
328
|
+
RGBEByteToRGBHalf(image_rgba_data, j * 4, halfArray, j * 4);
|
329
329
|
}
|
330
330
|
|
331
331
|
data = halfArray;
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three");class r extends e.DataTextureLoader{constructor(r){super(r),this.type=e.HalfFloatType,this.maxRange=7}setDataType(e){return this.type=e,this}setMaxRange(e){return this.maxRange=e,this}loadCubemap(r,t,a,n){const i=new e.CubeTexture;let f=0;const o=this;function s(e){o.load(r[e],(function(r){i.images[e]=r,f++,6===f&&(i.needsUpdate=!0,t&&t(i))}),void 0,n)}for(let e=0;e<r.length;++e)s(e);return i.type=this.type,i.format=e.RGBAFormat,i.minFilter=e.LinearFilter,i.generateMipmaps=!1,i}parse(r){const t=i.decode(r),a=i.toRGBA8(t)[0],n=new Uint8Array(a),f=t.width*t.height*4,o=this.type===e.HalfFloatType?new Uint16Array(f):new Float32Array(f);for(let r=0;r<n.length;r+=4){const t=n[r+0]/255,a=n[r+1]/255,i=n[r+2]/255,f=n[r+3]/255;this.type===e.HalfFloatType?(o[r+0]=e.DataUtils.toHalfFloat(Math.min(t*f*this.maxRange,65504)),o[r+1]=e.DataUtils.toHalfFloat(Math.min(a*f*this.maxRange,65504)),o[r+2]=e.DataUtils.toHalfFloat(Math.min(i*f*this.maxRange,65504)),o[r+3]=e.DataUtils.toHalfFloat(1)):(o[r+0]=t*f*this.maxRange,o[r+1]=a*f*this.maxRange,o[r+2]=i*f*this.maxRange,o[r+3]=1)}return{width:t.width,height:t.height,data:o,format:e.RGBAFormat,type:this.type,flipY:!0}}}var t,a,n,i={};i.toRGBA8=function(e){var r=e.width,t=e.height;if(null==e.tabs.acTL)return[i.toRGBA8.decodeImage(e.data,r,t,e).buffer];var a=[];null==e.frames[0].data&&(e.frames[0].data=e.data);for(var n=r*t*4,f=new Uint8Array(n),o=new Uint8Array(n),s=new Uint8Array(n),l=0;l<e.frames.length;l++){var d=e.frames[l],c=d.rect.x,h=d.rect.y,u=d.rect.width,v=d.rect.height,p=i.toRGBA8.decodeImage(d.data,u,v,e);if(0!=l)for(var g=0;g<n;g++)s[g]=f[g];if(0==d.blend?i._copyTile(p,u,v,f,r,t,c,h,0):1==d.blend&&i._copyTile(p,u,v,f,r,t,c,h,1),a.push(f.buffer.slice(0)),0==d.dispose);else if(1==d.dispose)i._copyTile(o,u,v,f,r,t,c,h,0);else if(2==d.dispose)for(g=0;g<n;g++)f[g]=s[g]}return a},i.toRGBA8.decodeImage=function(e,r,t,a){var n=r*t,f=i.decode._getBPP(a),o=Math.ceil(r*f/8),s=new Uint8Array(4*n),l=new Uint32Array(s.buffer),d=a.ctype,c=a.depth,h=i._bin.readUshort;if(6==d){var u=n<<2;if(8==c)for(var v=0;v<u;v+=4)s[v]=e[v],s[v+1]=e[v+1],s[v+2]=e[v+2],s[v+3]=e[v+3];if(16==c)for(v=0;v<u;v++)s[v]=e[v<<1]}else if(2==d){var p=a.tabs.tRNS;if(null==p){if(8==c)for(v=0;v<n;v++){var g=3*v;l[v]=255<<24|e[g+2]<<16|e[g+1]<<8|e[g]}if(16==c)for(v=0;v<n;v++){g=6*v;l[v]=255<<24|e[g+4]<<16|e[g+2]<<8|e[g]}}else{var w=p[0],y=p[1],b=p[2];if(8==c)for(v=0;v<n;v++){var m=v<<2;g=3*v;l[v]=255<<24|e[g+2]<<16|e[g+1]<<8|e[g],e[g]==w&&e[g+1]==y&&e[g+2]==b&&(s[m+3]=0)}if(16==c)for(v=0;v<n;v++){m=v<<2,g=6*v;l[v]=255<<24|e[g+4]<<16|e[g+2]<<8|e[g],h(e,g)==w&&h(e,g+2)==y&&h(e,g+4)==b&&(s[m+3]=0)}}}else if(3==d){var _=a.tabs.PLTE,H=a.tabs.tRNS,U=H?H.length:0;if(1==c)for(var A=0;A<t;A++){var R=A*o,I=A*r;for(v=0;v<r;v++){m=I+v<<2;var T=3*(x=e[R+(v>>3)]>>7-((7&v)<<0)&1);s[m]=_[T],s[m+1]=_[T+1],s[m+2]=_[T+2],s[m+3]=x<U?H[x]:255}}if(2==c)for(A=0;A<t;A++)for(R=A*o,I=A*r,v=0;v<r;v++){m=I+v<<2,T=3*(x=e[R+(v>>2)]>>6-((3&v)<<1)&3);s[m]=_[T],s[m+1]=_[T+1],s[m+2]=_[T+2],s[m+3]=x<U?H[x]:255}if(4==c)for(A=0;A<t;A++)for(R=A*o,I=A*r,v=0;v<r;v++){m=I+v<<2,T=3*(x=e[R+(v>>1)]>>4-((1&v)<<2)&15);s[m]=_[T],s[m+1]=_[T+1],s[m+2]=_[T+2],s[m+3]=x<U?H[x]:255}if(8==c)for(v=0;v<n;v++){var x;m=v<<2,T=3*(x=e[v]);s[m]=_[T],s[m+1]=_[T+1],s[m+2]=_[T+2],s[m+3]=x<U?H[x]:255}}else if(4==d){if(8==c)for(v=0;v<n;v++){m=v<<2;var C=e[B=v<<1];s[m]=C,s[m+1]=C,s[m+2]=C,s[m+3]=e[B+1]}if(16==c)for(v=0;v<n;v++){var B;m=v<<2,C=e[B=v<<2];s[m]=C,s[m+1]=C,s[m+2]=C,s[m+3]=e[B+2]}}else if(0==d)for(w=a.tabs.tRNS?a.tabs.tRNS:-1,A=0;A<t;A++){var M=A*o,S=A*r;if(1==c)for(var D=0;D<r;D++){var F=(C=255*(e[M+(D>>>3)]>>>7-(7&D)&1))==255*w?0:255;l[S+D]=F<<24|C<<16|C<<8|C}else if(2==c)for(D=0;D<r;D++){F=(C=85*(e[M+(D>>>2)]>>>6-((3&D)<<1)&3))==85*w?0:255;l[S+D]=F<<24|C<<16|C<<8|C}else if(4==c)for(D=0;D<r;D++){F=(C=17*(e[M+(D>>>1)]>>>4-((1&D)<<2)&15))==17*w?0:255;l[S+D]=F<<24|C<<16|C<<8|C}else if(8==c)for(D=0;D<r;D++){F=(C=e[M+D])==w?0:255;l[S+D]=F<<24|C<<16|C<<8|C}else if(16==c)for(D=0;D<r;D++){C=e[M+(D<<1)],F=h(e,M+(D<<1))==w?0:255;l[S+D]=F<<24|C<<16|C<<8|C}}return s},i.decode=function(e){for(var r,t=new Uint8Array(e),a=8,n=i._bin,f=n.readUshort,o=n.readUint,s={tabs:{},frames:[]},l=new Uint8Array(t.length),d=0,c=0,h=[137,80,78,71,13,10,26,10],u=0;u<8;u++)if(t[u]!=h[u])throw"The input is not a PNG file!";for(;a<t.length;){var v=n.readUint(t,a);a+=4;var p=n.readASCII(t,a,4);if(a+=4,"IHDR"==p)i.decode._IHDR(t,a,s);else if("CgBI"==p)s.tabs[p]=t.slice(a,a+4);else if("IDAT"==p){for(u=0;u<v;u++)l[d+u]=t[a+u];d+=v}else if("acTL"==p)s.tabs[p]={num_frames:o(t,a),num_plays:o(t,a+4)},r=new Uint8Array(t.length);else if("fcTL"==p){var g;if(0!=c)(g=s.frames[s.frames.length-1]).data=i.decode._decompress(s,r.slice(0,c),g.rect.width,g.rect.height),c=0;var w={x:o(t,a+12),y:o(t,a+16),width:o(t,a+4),height:o(t,a+8)},y=f(t,a+22);y=f(t,a+20)/(0==y?100:y);var b={rect:w,delay:Math.round(1e3*y),dispose:t[a+24],blend:t[a+25]};s.frames.push(b)}else if("fdAT"==p){for(u=0;u<v-4;u++)r[c+u]=t[a+u+4];c+=v-4}else if("pHYs"==p)s.tabs[p]=[n.readUint(t,a),n.readUint(t,a+4),t[a+8]];else if("cHRM"==p){s.tabs[p]=[];for(u=0;u<8;u++)s.tabs[p].push(n.readUint(t,a+4*u))}else if("tEXt"==p||"zTXt"==p){null==s.tabs[p]&&(s.tabs[p]={});var m=n.nextZero(t,a),_=n.readASCII(t,a,m-a),H=a+v-m-1;if("tEXt"==p)I=n.readASCII(t,m+1,H);else{var U=i.decode._inflate(t.slice(m+2,m+2+H));I=n.readUTF8(U,0,U.length)}s.tabs[p][_]=I}else if("iTXt"==p){null==s.tabs[p]&&(s.tabs[p]={});m=0;var A=a;m=n.nextZero(t,A);_=n.readASCII(t,A,m-A);var R=t[A=m+1];A+=2,m=n.nextZero(t,A),n.readASCII(t,A,m-A),A=m+1,m=n.nextZero(t,A),n.readUTF8(t,A,m-A);var I;H=v-((A=m+1)-a);if(0==R)I=n.readUTF8(t,A,H);else{U=i.decode._inflate(t.slice(A,A+H));I=n.readUTF8(U,0,U.length)}s.tabs[p][_]=I}else if("PLTE"==p)s.tabs[p]=n.readBytes(t,a,v);else if("hIST"==p){var T=s.tabs.PLTE.length/3;s.tabs[p]=[];for(u=0;u<T;u++)s.tabs[p].push(f(t,a+2*u))}else if("tRNS"==p)3==s.ctype?s.tabs[p]=n.readBytes(t,a,v):0==s.ctype?s.tabs[p]=f(t,a):2==s.ctype&&(s.tabs[p]=[f(t,a),f(t,a+2),f(t,a+4)]);else if("gAMA"==p)s.tabs[p]=n.readUint(t,a)/1e5;else if("sRGB"==p)s.tabs[p]=t[a];else if("bKGD"==p)0==s.ctype||4==s.ctype?s.tabs[p]=[f(t,a)]:2==s.ctype||6==s.ctype?s.tabs[p]=[f(t,a),f(t,a+2),f(t,a+4)]:3==s.ctype&&(s.tabs[p]=t[a]);else if("IEND"==p)break;a+=v,n.readUint(t,a),a+=4}0!=c&&((g=s.frames[s.frames.length-1]).data=i.decode._decompress(s,r.slice(0,c),g.rect.width,g.rect.height));return s.data=i.decode._decompress(s,l,s.width,s.height),delete s.compress,delete s.interlace,delete s.filter,s},i.decode._decompress=function(e,r,t,a){var n=i.decode._getBPP(e),f=Math.ceil(t*n/8),o=new Uint8Array((f+1+e.interlace)*a);return r=e.tabs.CgBI?i.inflateRaw(r,o):i.decode._inflate(r,o),0==e.interlace?r=i.decode._filterZero(r,e,0,t,a):1==e.interlace&&(r=i.decode._readInterlace(r,e)),r},i.decode._inflate=function(e,r){return i.inflateRaw(new Uint8Array(e.buffer,2,e.length-6),r)},i.inflateRaw=((n={}).H={},n.H.N=function(e,r){var t,a,i=Uint8Array,f=0,o=0,s=0,l=0,d=0,c=0,h=0,u=0,v=0;if(3==e[0]&&0==e[1])return r||new i(0);var p=n.H,g=p.b,w=p.e,y=p.R,b=p.n,m=p.A,_=p.Z,H=p.m,U=null==r;for(U&&(r=new i(e.length>>>2<<5));0==f;)if(f=g(e,v,1),o=g(e,v+1,2),v+=3,0!=o){if(U&&(r=n.H.W(r,u+(1<<17))),1==o&&(t=H.J,a=H.h,c=511,h=31),2==o){s=w(e,v,5)+257,l=w(e,v+5,5)+1,d=w(e,v+10,4)+4,v+=14;for(var A=1,R=0;R<38;R+=2)H.Q[R]=0,H.Q[R+1]=0;for(R=0;R<d;R++){var I=w(e,v+3*R,3);H.Q[1+(H.X[R]<<1)]=I,I>A&&(A=I)}v+=3*d,b(H.Q,A),m(H.Q,A,H.u),t=H.w,a=H.d,v=y(H.u,(1<<A)-1,s+l,e,v,H.v);var T=p.V(H.v,0,s,H.C);c=(1<<T)-1;var x=p.V(H.v,s,l,H.D);h=(1<<x)-1,b(H.C,T),m(H.C,T,t),b(H.D,x),m(H.D,x,a)}for(;;){var C=t[_(e,v)&c];v+=15&C;var B=C>>>4;if(B>>>8==0)r[u++]=B;else{if(256==B)break;var M=u+B-254;if(B>264){var S=H.q[B-257];M=u+(S>>>3)+w(e,v,7&S),v+=7&S}var D=a[_(e,v)&h];v+=15&D;var F=D>>>4,P=H.c[F],G=(P>>>4)+g(e,v,15&P);for(v+=15&P;u<M;)r[u]=r[u++-G],r[u]=r[u++-G],r[u]=r[u++-G],r[u]=r[u++-G];u=M}}}else{0!=(7&v)&&(v+=8-(7&v));var Z=4+(v>>>3),L=e[Z-4]|e[Z-3]<<8;U&&(r=n.H.W(r,u+L)),r.set(new i(e.buffer,e.byteOffset+Z,L),u),v=Z+L<<3,u+=L}return r.length==u?r:r.slice(0,u)},n.H.W=function(e,r){var t=e.length;if(r<=t)return e;var a=new Uint8Array(t<<1);return a.set(e,0),a},n.H.R=function(e,r,t,a,i,f){for(var o=n.H.e,s=n.H.Z,l=0;l<t;){var d=e[s(a,i)&r];i+=15&d;var c=d>>>4;if(c<=15)f[l]=c,l++;else{var h=0,u=0;16==c?(u=3+o(a,i,2),i+=2,h=f[l-1]):17==c?(u=3+o(a,i,3),i+=3):18==c&&(u=11+o(a,i,7),i+=7);for(var v=l+u;l<v;)f[l]=h,l++}}return i},n.H.V=function(e,r,t,a){for(var n=0,i=0,f=a.length>>>1;i<t;){var o=e[i+r];a[i<<1]=0,a[1+(i<<1)]=o,o>n&&(n=o),i++}for(;i<f;)a[i<<1]=0,a[1+(i<<1)]=0,i++;return n},n.H.n=function(e,r){for(var t,a,i,f,o=n.H.m,s=e.length,l=o.j,d=0;d<=r;d++)l[d]=0;for(d=1;d<s;d+=2)l[e[d]]++;var c=o.K;for(t=0,l[0]=0,a=1;a<=r;a++)t=t+l[a-1]<<1,c[a]=t;for(i=0;i<s;i+=2)0!=(f=e[i+1])&&(e[i]=c[f],c[f]++)},n.H.A=function(e,r,t){for(var a=e.length,i=n.H.m.r,f=0;f<a;f+=2)if(0!=e[f+1])for(var o=f>>1,s=e[f+1],l=o<<4|s,d=r-s,c=e[f]<<d,h=c+(1<<d);c!=h;)t[i[c]>>>15-r]=l,c++},n.H.l=function(e,r){for(var t=n.H.m.r,a=15-r,i=0;i<e.length;i+=2){var f=e[i]<<r-e[i+1];e[i]=t[f]>>>a}},n.H.M=function(e,r,t){t<<=7&r;var a=r>>>3;e[a]|=t,e[a+1]|=t>>>8},n.H.I=function(e,r,t){t<<=7&r;var a=r>>>3;e[a]|=t,e[a+1]|=t>>>8,e[a+2]|=t>>>16},n.H.e=function(e,r,t){return(e[r>>>3]|e[1+(r>>>3)]<<8)>>>(7&r)&(1<<t)-1},n.H.b=function(e,r,t){return(e[r>>>3]|e[1+(r>>>3)]<<8|e[2+(r>>>3)]<<16)>>>(7&r)&(1<<t)-1},n.H.Z=function(e,r){return(e[r>>>3]|e[1+(r>>>3)]<<8|e[2+(r>>>3)]<<16)>>>(7&r)},n.H.i=function(e,r){return(e[r>>>3]|e[1+(r>>>3)]<<8|e[2+(r>>>3)]<<16|e[3+(r>>>3)]<<24)>>>(7&r)},n.H.m=(t=Uint16Array,a=Uint32Array,{K:new t(16),j:new t(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new t(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new a(32),J:new t(512),_:[],h:new t(32),$:[],w:new t(32768),C:[],v:[],d:new t(32768),D:[],u:new t(512),Q:[],r:new t(32768),s:new a(286),Y:new a(30),a:new a(19),t:new a(15e3),k:new t(65536),g:new t(32768)}),function(){for(var e=n.H.m,r=0;r<32768;r++){var t=r;t=(4278255360&(t=(4042322160&(t=(3435973836&(t=(2863311530&t)>>>1|(1431655765&t)<<1))>>>2|(858993459&t)<<2))>>>4|(252645135&t)<<4))>>>8|(16711935&t)<<8,e.r[r]=(t>>>16|t<<16)>>>17}function a(e,r,t){for(;0!=r--;)e.push(0,t)}for(r=0;r<32;r++)e.q[r]=e.S[r]<<3|e.T[r],e.c[r]=e.p[r]<<4|e.z[r];a(e._,144,8),a(e._,112,9),a(e._,24,7),a(e._,8,8),n.H.n(e._,9),n.H.A(e._,9,e.J),n.H.l(e._,9),a(e.$,32,5),n.H.n(e.$,5),n.H.A(e.$,5,e.h),n.H.l(e.$,5),a(e.Q,19,0),a(e.C,286,0),a(e.D,30,0),a(e.v,320,0)}(),n.H.N),i.decode._readInterlace=function(e,r){for(var t=r.width,a=r.height,n=i.decode._getBPP(r),f=n>>3,o=Math.ceil(t*n/8),s=new Uint8Array(a*o),l=0,d=[0,0,4,0,2,0,1],c=[0,4,0,2,0,1,0],h=[8,8,8,4,4,2,2],u=[8,8,4,4,2,2,1],v=0;v<7;){for(var p=h[v],g=u[v],w=0,y=0,b=d[v];b<a;)b+=p,y++;for(var m=c[v];m<t;)m+=g,w++;var _=Math.ceil(w*n/8);i.decode._filterZero(e,r,l,w,y);for(var H=0,U=d[v];U<a;){for(var A=c[v],R=l+H*_<<3;A<t;){var I;if(1==n)I=(I=e[R>>3])>>7-(7&R)&1,s[U*o+(A>>3)]|=I<<7-((7&A)<<0);if(2==n)I=(I=e[R>>3])>>6-(7&R)&3,s[U*o+(A>>2)]|=I<<6-((3&A)<<1);if(4==n)I=(I=e[R>>3])>>4-(7&R)&15,s[U*o+(A>>1)]|=I<<4-((1&A)<<2);if(n>=8)for(var T=U*o+A*f,x=0;x<f;x++)s[T+x]=e[(R>>3)+x];R+=n,A+=g}H++,U+=p}w*y!=0&&(l+=y*(1+_)),v+=1}return s},i.decode._getBPP=function(e){return[1,null,3,1,2,null,4][e.ctype]*e.depth},i.decode._filterZero=function(e,r,t,a,n){var f=i.decode._getBPP(r),o=Math.ceil(a*f/8),s=i.decode._paeth;f=Math.ceil(f/8);var l,d,c=e[t],h=0;if(c>1&&(e[t]=[0,0,1][c-2]),3==c)for(h=f;h<o;h++)e[h+1]=e[h+1]+(e[h+1-f]>>>1)&255;for(var u=0;u<n;u++)if(h=0,0==(c=e[(d=(l=t+u*o)+u+1)-1]))for(;h<o;h++)e[l+h]=e[d+h];else if(1==c){for(;h<f;h++)e[l+h]=e[d+h];for(;h<o;h++)e[l+h]=e[d+h]+e[l+h-f]}else if(2==c)for(;h<o;h++)e[l+h]=e[d+h]+e[l+h-o];else if(3==c){for(;h<f;h++)e[l+h]=e[d+h]+(e[l+h-o]>>>1);for(;h<o;h++)e[l+h]=e[d+h]+(e[l+h-o]+e[l+h-f]>>>1)}else{for(;h<f;h++)e[l+h]=e[d+h]+s(0,e[l+h-o],0);for(;h<o;h++)e[l+h]=e[d+h]+s(e[l+h-f],e[l+h-o],e[l+h-f-o])}return e},i.decode._paeth=function(e,r,t){var a=e+r-t,n=a-e,i=a-r,f=a-t;return n*n<=i*i&&n*n<=f*f?e:i*i<=f*f?r:t},i.decode._IHDR=function(e,r,t){var a=i._bin;t.width=a.readUint(e,r),r+=4,t.height=a.readUint(e,r),r+=4,t.depth=e[r],r++,t.ctype=e[r],r++,t.compress=e[r],r++,t.filter=e[r],r++,t.interlace=e[r],r++},i._bin={nextZero:function(e,r){for(;0!=e[r];)r++;return r},readUshort:function(e,r){return e[r]<<8|e[r+1]},writeUshort:function(e,r,t){e[r]=t>>8&255,e[r+1]=255&t},readUint:function(e,r){return 16777216*e[r]+(e[r+1]<<16|e[r+2]<<8|e[r+3])},writeUint:function(e,r,t){e[r]=t>>24&255,e[r+1]=t>>16&255,e[r+2]=t>>8&255,e[r+3]=255&t},readASCII:function(e,r,t){for(var a="",n=0;n<t;n++)a+=String.fromCharCode(e[r+n]);return a},writeASCII:function(e,r,t){for(var a=0;a<t.length;a++)e[r+a]=t.charCodeAt(a)},readBytes:function(e,r,t){for(var a=[],n=0;n<t;n++)a.push(e[r+n]);return a},pad:function(e){return e.length<2?"0"+e:e},readUTF8:function(e,r,t){for(var a,n="",f=0;f<t;f++)n+="%"+i._bin.pad(e[r+f].toString(16));try{a=decodeURIComponent(n)}catch(a){return i._bin.readASCII(e,r,t)}return a}},i._copyTile=function(e,r,t,a,n,i,f,o,s){for(var l=Math.min(r,n),d=Math.min(t,i),c=0,h=0,u=0;u<d;u++)for(var v=0;v<l;v++)if(f>=0&&o>=0?(c=u*r+v<<2,h=(o+u)*n+f+v<<2):(c=(-o+u)*r-f+v<<2,h=u*n+v<<2),0==s)a[h]=e[c],a[h+1]=e[c+1],a[h+2]=e[c+2],a[h+3]=e[c+3];else if(1==s){var p=e[c+3]*(1/255),g=e[c]*p,w=e[c+1]*p,y=e[c+2]*p,b=a[h+3]*(1/255),m=a[h]*b,_=a[h+1]*b,H=a[h+2]*b,U=1-p,A=p+b*U,R=0==A?0:1/A;a[h+3]=255*A,a[h+0]=(g+m*U)*R,a[h+1]=(w+_*U)*R,a[h+2]=(y+H*U)*R}else if(2==s){p=e[c+3],g=e[c],w=e[c+1],y=e[c+2],b=a[h+3],m=a[h],_=a[h+1],H=a[h+2];p==b&&g==m&&w==_&&y==H?(a[h]=0,a[h+1]=0,a[h+2]=0,a[h+3]=0):(a[h]=g,a[h+1]=w,a[h+2]=y,a[h+3]=p)}else if(3==s){p=e[c+3],g=e[c],w=e[c+1],y=e[c+2],b=a[h+3],m=a[h],_=a[h+1],H=a[h+2];if(p==b&&g==m&&w==_&&y==H)continue;if(p<220&&b>20)return!1}return!0},exports.RGBMLoader=r;
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three");class r extends e.DataTextureLoader{constructor(r){super(r),this.type=e.HalfFloatType,this.maxRange=7}setDataType(e){return this.type=e,this}setMaxRange(e){return this.maxRange=e,this}loadCubemap(r,t,a,n){const i=new e.CubeTexture;let f=0;const o=this;function s(e){o.load(r[e],(function(r){i.images[e]=r,f++,6===f&&(i.needsUpdate=!0,t&&t(i))}),void 0,n)}for(let e=0;e<r.length;++e)s(e);return i.type=this.type,i.format=e.RGBAFormat,i.minFilter=e.LinearFilter,i.generateMipmaps=!1,i}parse(r){const t=i.decode(r),a=i.toRGBA8(t)[0],n=new Uint8Array(a),f=t.width*t.height*4,o=this.type===e.HalfFloatType?new Uint16Array(f):new Float32Array(f);for(let r=0;r<n.length;r+=4){const t=n[r+0]/255,a=n[r+1]/255,i=n[r+2]/255,f=n[r+3]/255;this.type===e.HalfFloatType?(o[r+0]=e.DataUtils.toHalfFloat(Math.min(t*f*this.maxRange,65504)),o[r+1]=e.DataUtils.toHalfFloat(Math.min(a*f*this.maxRange,65504)),o[r+2]=e.DataUtils.toHalfFloat(Math.min(i*f*this.maxRange,65504)),o[r+3]=e.DataUtils.toHalfFloat(1)):(o[r+0]=t*f*this.maxRange,o[r+1]=a*f*this.maxRange,o[r+2]=i*f*this.maxRange,o[r+3]=1)}return{width:t.width,height:t.height,data:o,format:e.RGBAFormat,type:this.type,flipY:!0}}}var t,a,n,i={};i.toRGBA8=function(e){var r=e.width,t=e.height;if(null==e.tabs.acTL)return[i.toRGBA8.decodeImage(e.data,r,t,e).buffer];var a=[];null==e.frames[0].data&&(e.frames[0].data=e.data);for(var n=r*t*4,f=new Uint8Array(n),o=new Uint8Array(n),s=new Uint8Array(n),l=0;l<e.frames.length;l++){var d=e.frames[l],c=d.rect.x,h=d.rect.y,u=d.rect.width,v=d.rect.height,p=i.toRGBA8.decodeImage(d.data,u,v,e);if(0!=l)for(var g=0;g<n;g++)s[g]=f[g];if(0==d.blend?i._copyTile(p,u,v,f,r,t,c,h,0):1==d.blend&&i._copyTile(p,u,v,f,r,t,c,h,1),a.push(f.buffer.slice(0)),1==d.dispose)i._copyTile(o,u,v,f,r,t,c,h,0);else if(2==d.dispose)for(g=0;g<n;g++)f[g]=s[g]}return a},i.toRGBA8.decodeImage=function(e,r,t,a){var n=r*t,f=i.decode._getBPP(a),o=Math.ceil(r*f/8),s=new Uint8Array(4*n),l=new Uint32Array(s.buffer),d=a.ctype,c=a.depth,h=i._bin.readUshort;if(6==d){var u=n<<2;if(8==c)for(var v=0;v<u;v+=4)s[v]=e[v],s[v+1]=e[v+1],s[v+2]=e[v+2],s[v+3]=e[v+3];if(16==c)for(v=0;v<u;v++)s[v]=e[v<<1]}else if(2==d){var p=a.tabs.tRNS;if(null==p){if(8==c)for(v=0;v<n;v++){var g=3*v;l[v]=255<<24|e[g+2]<<16|e[g+1]<<8|e[g]}if(16==c)for(v=0;v<n;v++){g=6*v;l[v]=255<<24|e[g+4]<<16|e[g+2]<<8|e[g]}}else{var w=p[0],y=p[1],b=p[2];if(8==c)for(v=0;v<n;v++){var m=v<<2;g=3*v;l[v]=255<<24|e[g+2]<<16|e[g+1]<<8|e[g],e[g]==w&&e[g+1]==y&&e[g+2]==b&&(s[m+3]=0)}if(16==c)for(v=0;v<n;v++){m=v<<2,g=6*v;l[v]=255<<24|e[g+4]<<16|e[g+2]<<8|e[g],h(e,g)==w&&h(e,g+2)==y&&h(e,g+4)==b&&(s[m+3]=0)}}}else if(3==d){var _=a.tabs.PLTE,H=a.tabs.tRNS,U=H?H.length:0;if(1==c)for(var A=0;A<t;A++){var R=A*o,I=A*r;for(v=0;v<r;v++){m=I+v<<2;var T=3*(x=e[R+(v>>3)]>>7-((7&v)<<0)&1);s[m]=_[T],s[m+1]=_[T+1],s[m+2]=_[T+2],s[m+3]=x<U?H[x]:255}}if(2==c)for(A=0;A<t;A++)for(R=A*o,I=A*r,v=0;v<r;v++){m=I+v<<2,T=3*(x=e[R+(v>>2)]>>6-((3&v)<<1)&3);s[m]=_[T],s[m+1]=_[T+1],s[m+2]=_[T+2],s[m+3]=x<U?H[x]:255}if(4==c)for(A=0;A<t;A++)for(R=A*o,I=A*r,v=0;v<r;v++){m=I+v<<2,T=3*(x=e[R+(v>>1)]>>4-((1&v)<<2)&15);s[m]=_[T],s[m+1]=_[T+1],s[m+2]=_[T+2],s[m+3]=x<U?H[x]:255}if(8==c)for(v=0;v<n;v++){var x;m=v<<2,T=3*(x=e[v]);s[m]=_[T],s[m+1]=_[T+1],s[m+2]=_[T+2],s[m+3]=x<U?H[x]:255}}else if(4==d){if(8==c)for(v=0;v<n;v++){m=v<<2;var C=e[B=v<<1];s[m]=C,s[m+1]=C,s[m+2]=C,s[m+3]=e[B+1]}if(16==c)for(v=0;v<n;v++){var B;m=v<<2,C=e[B=v<<2];s[m]=C,s[m+1]=C,s[m+2]=C,s[m+3]=e[B+2]}}else if(0==d)for(w=a.tabs.tRNS?a.tabs.tRNS:-1,A=0;A<t;A++){var M=A*o,S=A*r;if(1==c)for(var D=0;D<r;D++){var F=(C=255*(e[M+(D>>>3)]>>>7-(7&D)&1))==255*w?0:255;l[S+D]=F<<24|C<<16|C<<8|C}else if(2==c)for(D=0;D<r;D++){F=(C=85*(e[M+(D>>>2)]>>>6-((3&D)<<1)&3))==85*w?0:255;l[S+D]=F<<24|C<<16|C<<8|C}else if(4==c)for(D=0;D<r;D++){F=(C=17*(e[M+(D>>>1)]>>>4-((1&D)<<2)&15))==17*w?0:255;l[S+D]=F<<24|C<<16|C<<8|C}else if(8==c)for(D=0;D<r;D++){F=(C=e[M+D])==w?0:255;l[S+D]=F<<24|C<<16|C<<8|C}else if(16==c)for(D=0;D<r;D++){C=e[M+(D<<1)],F=h(e,M+(D<<1))==w?0:255;l[S+D]=F<<24|C<<16|C<<8|C}}return s},i.decode=function(e){for(var r,t,a,n,f=new Uint8Array(e),o=8,s=i._bin,l=s.readUshort,d=s.readUint,c={tabs:{},frames:[]},h=new Uint8Array(f.length),u=0,v=0,p=[137,80,78,71,13,10,26,10],g=0;g<8;g++)if(f[g]!=p[g])throw new Error("The input is not a PNG file!");for(;o<f.length;){var w=s.readUint(f,o);o+=4;var y=s.readASCII(f,o,4);if(o+=4,"IHDR"==y)i.decode._IHDR(f,o,c);else if("CgBI"==y)c.tabs[y]=f.slice(o,o+4);else if("IDAT"==y){for(g=0;g<w;g++)h[u+g]=f[o+g];u+=w}else if("acTL"==y)c.tabs[y]={num_frames:d(f,o),num_plays:d(f,o+4)},r=new Uint8Array(f.length);else if("fcTL"==y){var b;if(0!=v)(b=c.frames[c.frames.length-1]).data=i.decode._decompress(c,r.slice(0,v),b.rect.width,b.rect.height),v=0;var m={x:d(f,o+12),y:d(f,o+16),width:d(f,o+4),height:d(f,o+8)},_=l(f,o+22);_=l(f,o+20)/(0==_?100:_);var H={rect:m,delay:Math.round(1e3*_),dispose:f[o+24],blend:f[o+25]};c.frames.push(H)}else if("fdAT"==y){for(g=0;g<w-4;g++)r[v+g]=f[o+g+4];v+=w-4}else if("pHYs"==y)c.tabs[y]=[s.readUint(f,o),s.readUint(f,o+4),f[o+8]];else if("cHRM"==y){c.tabs[y]=[];for(g=0;g<8;g++)c.tabs[y].push(s.readUint(f,o+4*g))}else if("tEXt"==y||"zTXt"==y){null==c.tabs[y]&&(c.tabs[y]={});var U=s.nextZero(f,o);a=s.readASCII(f,o,U-o);var A=o+w-U-1;"tEXt"==y?t=s.readASCII(f,U+1,A):(n=i.decode._inflate(f.slice(U+2,U+2+A)),t=s.readUTF8(n,0,n.length)),c.tabs[y][a]=t}else if("iTXt"==y){null==c.tabs[y]&&(c.tabs[y]={});U=0;var R=o;U=s.nextZero(f,R),a=s.readASCII(f,R,U-R);var I=f[R=U+1];R+=2,U=s.nextZero(f,R),s.readASCII(f,R,U-R),R=U+1,U=s.nextZero(f,R),s.readUTF8(f,R,U-R);A=w-((R=U+1)-o);0==I?t=s.readUTF8(f,R,A):(n=i.decode._inflate(f.slice(R,R+A)),t=s.readUTF8(n,0,n.length)),c.tabs[y][a]=t}else if("PLTE"==y)c.tabs[y]=s.readBytes(f,o,w);else if("hIST"==y){var T=c.tabs.PLTE.length/3;c.tabs[y]=[];for(g=0;g<T;g++)c.tabs[y].push(l(f,o+2*g))}else if("tRNS"==y)3==c.ctype?c.tabs[y]=s.readBytes(f,o,w):0==c.ctype?c.tabs[y]=l(f,o):2==c.ctype&&(c.tabs[y]=[l(f,o),l(f,o+2),l(f,o+4)]);else if("gAMA"==y)c.tabs[y]=s.readUint(f,o)/1e5;else if("sRGB"==y)c.tabs[y]=f[o];else if("bKGD"==y)0==c.ctype||4==c.ctype?c.tabs[y]=[l(f,o)]:2==c.ctype||6==c.ctype?c.tabs[y]=[l(f,o),l(f,o+2),l(f,o+4)]:3==c.ctype&&(c.tabs[y]=f[o]);else if("IEND"==y)break;o+=w,s.readUint(f,o),o+=4}0!=v&&((b=c.frames[c.frames.length-1]).data=i.decode._decompress(c,r.slice(0,v),b.rect.width,b.rect.height));return c.data=i.decode._decompress(c,h,c.width,c.height),delete c.compress,delete c.interlace,delete c.filter,c},i.decode._decompress=function(e,r,t,a){var n=i.decode._getBPP(e),f=Math.ceil(t*n/8),o=new Uint8Array((f+1+e.interlace)*a);return r=e.tabs.CgBI?i.inflateRaw(r,o):i.decode._inflate(r,o),0==e.interlace?r=i.decode._filterZero(r,e,0,t,a):1==e.interlace&&(r=i.decode._readInterlace(r,e)),r},i.decode._inflate=function(e,r){return i.inflateRaw(new Uint8Array(e.buffer,2,e.length-6),r)},i.inflateRaw=((n={}).H={},n.H.N=function(e,r){var t,a,i=Uint8Array,f=0,o=0,s=0,l=0,d=0,c=0,h=0,u=0,v=0;if(3==e[0]&&0==e[1])return r||new i(0);var p=n.H,g=p.b,w=p.e,y=p.R,b=p.n,m=p.A,_=p.Z,H=p.m,U=null==r;for(U&&(r=new i(e.length>>>2<<5));0==f;)if(f=g(e,v,1),o=g(e,v+1,2),v+=3,0!=o){if(U&&(r=n.H.W(r,u+(1<<17))),1==o&&(t=H.J,a=H.h,c=511,h=31),2==o){s=w(e,v,5)+257,l=w(e,v+5,5)+1,d=w(e,v+10,4)+4,v+=14;for(var A=1,R=0;R<38;R+=2)H.Q[R]=0,H.Q[R+1]=0;for(R=0;R<d;R++){var I=w(e,v+3*R,3);H.Q[1+(H.X[R]<<1)]=I,I>A&&(A=I)}v+=3*d,b(H.Q,A),m(H.Q,A,H.u),t=H.w,a=H.d,v=y(H.u,(1<<A)-1,s+l,e,v,H.v);var T=p.V(H.v,0,s,H.C);c=(1<<T)-1;var x=p.V(H.v,s,l,H.D);h=(1<<x)-1,b(H.C,T),m(H.C,T,t),b(H.D,x),m(H.D,x,a)}for(;;){var C=t[_(e,v)&c];v+=15&C;var B=C>>>4;if(B>>>8==0)r[u++]=B;else{if(256==B)break;var M=u+B-254;if(B>264){var S=H.q[B-257];M=u+(S>>>3)+w(e,v,7&S),v+=7&S}var D=a[_(e,v)&h];v+=15&D;var F=D>>>4,P=H.c[F],G=(P>>>4)+g(e,v,15&P);for(v+=15&P;u<M;)r[u]=r[u++-G],r[u]=r[u++-G],r[u]=r[u++-G],r[u]=r[u++-G];u=M}}}else{0!=(7&v)&&(v+=8-(7&v));var Z=4+(v>>>3),L=e[Z-4]|e[Z-3]<<8;U&&(r=n.H.W(r,u+L)),r.set(new i(e.buffer,e.byteOffset+Z,L),u),v=Z+L<<3,u+=L}return r.length==u?r:r.slice(0,u)},n.H.W=function(e,r){var t=e.length;if(r<=t)return e;var a=new Uint8Array(t<<1);return a.set(e,0),a},n.H.R=function(e,r,t,a,i,f){for(var o=n.H.e,s=n.H.Z,l=0;l<t;){var d=e[s(a,i)&r];i+=15&d;var c=d>>>4;if(c<=15)f[l]=c,l++;else{var h=0,u=0;16==c?(u=3+o(a,i,2),i+=2,h=f[l-1]):17==c?(u=3+o(a,i,3),i+=3):18==c&&(u=11+o(a,i,7),i+=7);for(var v=l+u;l<v;)f[l]=h,l++}}return i},n.H.V=function(e,r,t,a){for(var n=0,i=0,f=a.length>>>1;i<t;){var o=e[i+r];a[i<<1]=0,a[1+(i<<1)]=o,o>n&&(n=o),i++}for(;i<f;)a[i<<1]=0,a[1+(i<<1)]=0,i++;return n},n.H.n=function(e,r){for(var t,a,i,f,o=n.H.m,s=e.length,l=o.j,d=0;d<=r;d++)l[d]=0;for(d=1;d<s;d+=2)l[e[d]]++;var c=o.K;for(t=0,l[0]=0,a=1;a<=r;a++)t=t+l[a-1]<<1,c[a]=t;for(i=0;i<s;i+=2)0!=(f=e[i+1])&&(e[i]=c[f],c[f]++)},n.H.A=function(e,r,t){for(var a=e.length,i=n.H.m.r,f=0;f<a;f+=2)if(0!=e[f+1])for(var o=f>>1,s=e[f+1],l=o<<4|s,d=r-s,c=e[f]<<d,h=c+(1<<d);c!=h;)t[i[c]>>>15-r]=l,c++},n.H.l=function(e,r){for(var t=n.H.m.r,a=15-r,i=0;i<e.length;i+=2){var f=e[i]<<r-e[i+1];e[i]=t[f]>>>a}},n.H.M=function(e,r,t){t<<=7&r;var a=r>>>3;e[a]|=t,e[a+1]|=t>>>8},n.H.I=function(e,r,t){t<<=7&r;var a=r>>>3;e[a]|=t,e[a+1]|=t>>>8,e[a+2]|=t>>>16},n.H.e=function(e,r,t){return(e[r>>>3]|e[1+(r>>>3)]<<8)>>>(7&r)&(1<<t)-1},n.H.b=function(e,r,t){return(e[r>>>3]|e[1+(r>>>3)]<<8|e[2+(r>>>3)]<<16)>>>(7&r)&(1<<t)-1},n.H.Z=function(e,r){return(e[r>>>3]|e[1+(r>>>3)]<<8|e[2+(r>>>3)]<<16)>>>(7&r)},n.H.i=function(e,r){return(e[r>>>3]|e[1+(r>>>3)]<<8|e[2+(r>>>3)]<<16|e[3+(r>>>3)]<<24)>>>(7&r)},n.H.m=(t=Uint16Array,a=Uint32Array,{K:new t(16),j:new t(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new t(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new a(32),J:new t(512),_:[],h:new t(32),$:[],w:new t(32768),C:[],v:[],d:new t(32768),D:[],u:new t(512),Q:[],r:new t(32768),s:new a(286),Y:new a(30),a:new a(19),t:new a(15e3),k:new t(65536),g:new t(32768)}),function(){for(var e=n.H.m,r=0;r<32768;r++){var t=r;t=(4278255360&(t=(4042322160&(t=(3435973836&(t=(2863311530&t)>>>1|(1431655765&t)<<1))>>>2|(858993459&t)<<2))>>>4|(252645135&t)<<4))>>>8|(16711935&t)<<8,e.r[r]=(t>>>16|t<<16)>>>17}function a(e,r,t){for(;0!=r--;)e.push(0,t)}for(r=0;r<32;r++)e.q[r]=e.S[r]<<3|e.T[r],e.c[r]=e.p[r]<<4|e.z[r];a(e._,144,8),a(e._,112,9),a(e._,24,7),a(e._,8,8),n.H.n(e._,9),n.H.A(e._,9,e.J),n.H.l(e._,9),a(e.$,32,5),n.H.n(e.$,5),n.H.A(e.$,5,e.h),n.H.l(e.$,5),a(e.Q,19,0),a(e.C,286,0),a(e.D,30,0),a(e.v,320,0)}(),n.H.N),i.decode._readInterlace=function(e,r){for(var t=r.width,a=r.height,n=i.decode._getBPP(r),f=n>>3,o=Math.ceil(t*n/8),s=new Uint8Array(a*o),l=0,d=[0,0,4,0,2,0,1],c=[0,4,0,2,0,1,0],h=[8,8,8,4,4,2,2],u=[8,8,4,4,2,2,1],v=0;v<7;){for(var p=h[v],g=u[v],w=0,y=0,b=d[v];b<a;)b+=p,y++;for(var m=c[v];m<t;)m+=g,w++;var _=Math.ceil(w*n/8);i.decode._filterZero(e,r,l,w,y);for(var H,U=0,A=d[v];A<a;){for(var R=c[v],I=l+U*_<<3;R<t;){if(1==n&&(H=(H=e[I>>3])>>7-(7&I)&1,s[A*o+(R>>3)]|=H<<7-((7&R)<<0)),2==n&&(H=(H=e[I>>3])>>6-(7&I)&3,s[A*o+(R>>2)]|=H<<6-((3&R)<<1)),4==n&&(H=(H=e[I>>3])>>4-(7&I)&15,s[A*o+(R>>1)]|=H<<4-((1&R)<<2)),n>=8)for(var T=A*o+R*f,x=0;x<f;x++)s[T+x]=e[(I>>3)+x];I+=n,R+=g}U++,A+=p}w*y!=0&&(l+=y*(1+_)),v+=1}return s},i.decode._getBPP=function(e){return[1,null,3,1,2,null,4][e.ctype]*e.depth},i.decode._filterZero=function(e,r,t,a,n){var f=i.decode._getBPP(r),o=Math.ceil(a*f/8),s=i.decode._paeth;f=Math.ceil(f/8);var l,d,c=e[t],h=0;if(c>1&&(e[t]=[0,0,1][c-2]),3==c)for(h=f;h<o;h++)e[h+1]=e[h+1]+(e[h+1-f]>>>1)&255;for(var u=0;u<n;u++)if(h=0,0==(c=e[(d=(l=t+u*o)+u+1)-1]))for(;h<o;h++)e[l+h]=e[d+h];else if(1==c){for(;h<f;h++)e[l+h]=e[d+h];for(;h<o;h++)e[l+h]=e[d+h]+e[l+h-f]}else if(2==c)for(;h<o;h++)e[l+h]=e[d+h]+e[l+h-o];else if(3==c){for(;h<f;h++)e[l+h]=e[d+h]+(e[l+h-o]>>>1);for(;h<o;h++)e[l+h]=e[d+h]+(e[l+h-o]+e[l+h-f]>>>1)}else{for(;h<f;h++)e[l+h]=e[d+h]+s(0,e[l+h-o],0);for(;h<o;h++)e[l+h]=e[d+h]+s(e[l+h-f],e[l+h-o],e[l+h-f-o])}return e},i.decode._paeth=function(e,r,t){var a=e+r-t,n=a-e,i=a-r,f=a-t;return n*n<=i*i&&n*n<=f*f?e:i*i<=f*f?r:t},i.decode._IHDR=function(e,r,t){var a=i._bin;t.width=a.readUint(e,r),r+=4,t.height=a.readUint(e,r),r+=4,t.depth=e[r],r++,t.ctype=e[r],r++,t.compress=e[r],r++,t.filter=e[r],r++,t.interlace=e[r],r++},i._bin={nextZero:function(e,r){for(;0!=e[r];)r++;return r},readUshort:function(e,r){return e[r]<<8|e[r+1]},writeUshort:function(e,r,t){e[r]=t>>8&255,e[r+1]=255&t},readUint:function(e,r){return 16777216*e[r]+(e[r+1]<<16|e[r+2]<<8|e[r+3])},writeUint:function(e,r,t){e[r]=t>>24&255,e[r+1]=t>>16&255,e[r+2]=t>>8&255,e[r+3]=255&t},readASCII:function(e,r,t){for(var a="",n=0;n<t;n++)a+=String.fromCharCode(e[r+n]);return a},writeASCII:function(e,r,t){for(var a=0;a<t.length;a++)e[r+a]=t.charCodeAt(a)},readBytes:function(e,r,t){for(var a=[],n=0;n<t;n++)a.push(e[r+n]);return a},pad:function(e){return e.length<2?"0"+e:e},readUTF8:function(e,r,t){for(var a,n="",f=0;f<t;f++)n+="%"+i._bin.pad(e[r+f].toString(16));try{a=decodeURIComponent(n)}catch(a){return i._bin.readASCII(e,r,t)}return a}},i._copyTile=function(e,r,t,a,n,i,f,o,s){for(var l=Math.min(r,n),d=Math.min(t,i),c=0,h=0,u=0;u<d;u++)for(var v=0;v<l;v++)if(f>=0&&o>=0?(c=u*r+v<<2,h=(o+u)*n+f+v<<2):(c=(-o+u)*r-f+v<<2,h=u*n+v<<2),0==s)a[h]=e[c],a[h+1]=e[c+1],a[h+2]=e[c+2],a[h+3]=e[c+3];else if(1==s){var p=e[c+3]*(1/255),g=e[c]*p,w=e[c+1]*p,y=e[c+2]*p,b=a[h+3]*(1/255),m=a[h]*b,_=a[h+1]*b,H=a[h+2]*b,U=1-p,A=p+b*U,R=0==A?0:1/A;a[h+3]=255*A,a[h+0]=(g+m*U)*R,a[h+1]=(w+_*U)*R,a[h+2]=(y+H*U)*R}else if(2==s){p=e[c+3],g=e[c],w=e[c+1],y=e[c+2],b=a[h+3],m=a[h],_=a[h+1],H=a[h+2];p==b&&g==m&&w==_&&y==H?(a[h]=0,a[h+1]=0,a[h+2]=0,a[h+3]=0):(a[h]=g,a[h+1]=w,a[h+2]=y,a[h+3]=p)}else if(3==s){p=e[c+3],g=e[c],w=e[c+1],y=e[c+2],b=a[h+3],m=a[h],_=a[h+1],H=a[h+2];if(p==b&&g==m&&w==_&&y==H)continue;if(p<220&&b>20)return!1}return!0},exports.RGBMLoader=r;
|