t&&(t=e[r]);return t},A=function(e,t,r){var n=t/8|0;return(e[n]|e[n+1]<<8)>>(7&t)&r},I=function(e,t){var r=t/8|0;return(e[r]|e[r+1]<<8|e[r+2]<<16)>>(7&t)},R=function(e,t,r){(null==t||t<0)&&(t=0),(null==r||r>e.length)&&(r=e.length);var n=new(e instanceof d?d:e instanceof p?p:f)(r-t);return n.set(e.subarray(t,r)),n},O=function(e,t,r){var n=e.length;if(!n||r&&!r.l&&n<5)return t||new f(0);var a=!t||r,i=!r||r.i;r||(r={}),t||(t=new f(3*n));var o=function(e){var r=t.length;if(e>r){var n=new f(Math.max(2*r,e));n.set(t),t=n}},l=r.f||0,s=r.p||0,u=r.b||0,c=r.l,d=r.d,p=r.m,g=r.n,y=8*n;do{if(!c){r.f=l=A(e,s,1);var b=A(e,s+1,3);if(s+=3,b)if(1==b)c=k,d=U,p=9,g=5;else if(2==b){var x=A(e,s,31)+257,_=A(e,s+10,15)+4,E=x+A(e,s+5,31)+1;s+=14;for(var C=new f(E),P=new f(19),j=0;j<_;++j)P[m[j]]=A(e,s+3*j,7);s+=3*_;for(var O=T(P),D=(1<>>4;if(L<16)C[j++]=L;else{var B=0,H=0;for(16==L?(H=3+A(e,s,3),s+=2,B=C[j-1]):17==L?(H=3+A(e,s,7),s+=3):18==L&&(H=11+A(e,s,127),s+=7);H--;)C[j++]=B}}var N=C.subarray(0,x),q=C.subarray(x);p=T(N),g=T(q),c=S(N,p,1),d=S(q,g,1)}else throw"invalid block type";else{var W,L=((W=s)/8|0)+(7&W&&1)+4,G=e[L-4]|e[L-3]<<8,V=L+G;if(V>n){if(i)throw"unexpected EOF";break}a&&o(u+G),t.set(e.subarray(L,V),u),r.b=u+=G,r.p=s=8*V;continue}if(s>y){if(i)throw"unexpected EOF";break}}a&&o(u+131072);for(var $=(1<>>4;if((s+=15&B)>y){if(i)throw"unexpected EOF";break}if(!B)throw"invalid length/literal";if(Z<256)t[u++]=Z;else if(256==Z){X=s,c=null;break}else{var Q=Z-254;if(Z>264){var j=Z-257,K=v[j];Q=A(e,s,(1<>>4;if(!J)throw"invalid distance";s+=15&J;var q=M[ee];if(ee>3){var K=h[ee];q+=I(e,s)&(1<y){if(i)throw"unexpected EOF";break}a&&o(u+131072);for(var et=u+Q;u>>4>7||(e[0]<<8|e[1])%31)throw"invalid zlib data";if(32&e[1])throw"invalid zlib data: preset dictionaries not supported"};function z(e,t){return O((F(e),e.subarray(2,-4)),t)}var L="undefined"!=typeof TextDecoder&&new TextDecoder;try{L.decode(D,{stream:!0})}catch(e){}let B=s>=152;class H extends l.BRH{constructor(e){super(e),this.type=l.ix0}parse(e){let t={l:0,c:0,lc:0};function r(e,r,n,a,i){for(;n>(n-=e)&(1<>(n-=8),p=new Uint8Array([p])[0];if(f.value+p>d)return!1;for(var v=c[f.value-1];p-- >0;)c[f.value++]=v}else{if(!(f.value32767?t-65536:t}let c={a:0,b:0};function f(e,t){var r=u(e),n=u(t),a=r+(1&n)+(n>>1),i=a-n;c.a=a,c.b=i}function d(e,t){var r=65535&t,n=(65535&e)-(r>>1)&65535;c.a=r+n-32768&65535,c.b=n}function p(e,l,u,c,f,d){var p=u.value,v=C(l,u),h=C(l,u);u.value+=4;var m=C(l,u);if(u.value+=4,v<0||v>=65537||h<0||h>=65537)throw"Something wrong with HUF_ENCSIZE";for(var g=Array(65537),y=Array(16384),w=0;w<16384;w++)y[w]={},y[w].len=0,y[w].lit=0,y[w].p=null;var b=c-(u.value-p);if(!function(e,a,i,o,l,s,u){for(var c=0,f=0;l<=s;l++){if(i.value-i.value>o)return!1;r(6,c,f,e,i);var d=t.l;if(c=t.c,f=t.lc,u[l]=d,63==d){if(i.value-i.value>o)throw"Something wrong with hufUnpackEncTable";r(8,c,f,e,i);var p=t.l+6;if(c=t.c,f=t.lc,l+p>s+1)throw"Something wrong with hufUnpackEncTable";for(;p--;)u[l++]=0;l--}else if(d>=59){var p=d-59+2;if(l+p>s+1)throw"Something wrong with hufUnpackEncTable";for(;p--;)u[l++]=0;l--}}!function(e){for(var t=0;t<=58;++t)n[t]=0;for(var t=0;t<65537;++t)n[e[t]]+=1;for(var r=0,t=58;t>0;--t){var a=r+n[t]>>1;n[t]=r,r=a}for(var t=0;t<65537;++t){var i=e[t];i>0&&(e[t]=i|n[i]++<<6)}}(u)}(e,0,u,b,v,h,g),m>8*(c-(u.value-p)))throw"Something wrong with hufUncompress";!function(e,t,r,n){for(;t<=r;t++){var a=e[t]>>6,i=63&e[t];if(a>>i)throw"Invalid table entry";if(i>14){var o=n[a>>i-14];if(o.len)throw"Invalid table entry";if(o.lit++,o.p){var l=o.p;o.p=Array(o.lit);for(var s=0;s0;s--){var o=n[(a<<14-i)+u];if(o.len||o.p)throw"Invalid table entry";o.len=i,o.lit=t,u++}}}(g,v,h,y),function(e,t,r,n,l,u,c,f,d,p){for(var v=0,h=0,m=Math.trunc(l.value+(u+7)/8);l.value=14;){var g=t[v>>h-14&16383];if(g.len)h-=g.len,s(g.lit,c,v,h,r,n,l,d,p,f),v=o.c,h=o.lc;else{if(!g.p)throw"hufDecode issues";for(y=0;y=w&&e[g.p[y]]>>6==(v>>h-w&(1<>=b,h-=b;h>0;){var g=t[v<<14-h&16383];if(g.len)h-=g.len,s(g.lit,c,v,h,r,n,l,d,p,f),v=o.c,h=o.lc;else throw"hufDecode issues"}}(g,y,e,l,u,m,h,d,f,{value:0})}function v(e){for(var t=1;ti)&&(t[a++]=e[r++],!(a>i));){;t[a++]=e[n++]}}function m(e){for(var t=e.byteLength,r=[],n=0,a=new DataView(e);t>0;){var i=a.getInt8(n++);if(i<0){var o=-i;t-=o+1;for(var l=0;l=8192)throw"Something is wrong with PIZ_COMPRESSION BITMAP_SIZE";if(s<=u)for(var l=0;l>3]&1<<(7&n))&&(t[r++]=n);for(var a=r-1;r<65536;)t[r++]=0;return a}(a,v),m=C(t,r);p(e.array,t,r,m,n,i);for(var l=0;la?a:r,u=1;u<=s;)u<<=1;for(u>>=1,p=u,u>>=1;u>=1;){for(var p,v,h,m,g,y=0,w=0+i*(a-p),b=i*u,x=i*p,M=n*u,_=n*p;y<=w;y+=x){for(var E=y,C=y+n*(r-p);E<=C;E+=_){var S=E+M,P=E+b,j=P+M;l?(f(e[E+t],e[P+t]),v=c.a,m=c.b,f(e[S+t],e[j+t]),h=c.a,g=c.b,f(v,h),e[E+t]=c.a,e[S+t]=c.b,f(m,g)):(d(e[E+t],e[P+t]),v=c.a,m=c.b,d(e[S+t],e[j+t]),h=c.a,g=c.b,d(v,h),e[E+t]=c.a,e[S+t]=c.b,d(m,g)),e[P+t]=c.a,e[j+t]=c.b}if(r&u){var P=E+b;l?f(e[E+t],e[P+t]):d(e[E+t],e[P+t]),v=c.a,e[P+t]=c.b,e[E+t]=v}}if(a&u)for(var E=y,C=y+n*(r-p);E<=C;E+=_){var S=E+M;l?f(e[E+t],e[S+t]):d(e[E+t],e[S+t]),v=c.a,e[S+t]=c.b,e[E+t]=v}p=u,u>>=1}}(n,g.start+y,g.nx,g.size,g.ny,g.nx*g.size,h);for(var w=i,b=0;b0;){var s=_(t.buffer,r),u=P(t,r),c=u>>2&3,f=new Int8Array([(u>>4)-1])[0],d=P(t,r);i.push({name:s,index:f,type:d,compression:c}),o-=s.length+3}for(var v=F.channels,h=Array(e.channels),g=0;g=0&&(x.idx[E.index]=M),y.offset=M)}if(a.acCompressedSize>0)switch(a.acCompression){case 0:var C=new Uint16Array(a.totalAcUncompressedCount);p(e.array,t,r,a.acCompressedSize,C,a.totalAcUncompressedCount);break;case 1:var S=e.array.slice(r.value,r.value+a.totalAcUncompressedCount),k=z(S),C=new Uint16Array(k.buffer);r.value+=a.totalAcUncompressedCount}if(a.dcCompressedSize>0){var U=new Uint16Array(w({array:e.array,offset:r,size:a.dcCompressedSize}).buffer);r.value+=a.dcCompressedSize}if(a.rleRawSize>0){var S=e.array.slice(r.value,r.value+a.rleCompressedSize),k=z(S),I=m(k.buffer);r.value+=a.rleCompressedSize}for(var R=0,O=Array(h.length),g=0;g>8==255?a+=255&n:(r[a]=n,a++),e.value++}(h,n,y[e]),x=y[e],(M=g[e])[0]=T(x[0]),M[1]=T(x[1]),M[2]=T(x[5]),M[3]=T(x[6]),M[4]=T(x[14]),M[5]=T(x[15]),M[6]=T(x[27]),M[7]=T(x[28]),M[8]=T(x[2]),M[9]=T(x[4]),M[10]=T(x[7]),M[11]=T(x[13]),M[12]=T(x[16]),M[13]=T(x[26]),M[14]=T(x[29]),M[15]=T(x[42]),M[16]=T(x[3]),M[17]=T(x[8]),M[18]=T(x[12]),M[19]=T(x[17]),M[20]=T(x[25]),M[21]=T(x[30]),M[22]=T(x[41]),M[23]=T(x[43]),M[24]=T(x[9]),M[25]=T(x[11]),M[26]=T(x[18]),M[27]=T(x[24]),M[28]=T(x[31]),M[29]=T(x[40]),M[30]=T(x[44]),M[31]=T(x[53]),M[32]=T(x[10]),M[33]=T(x[19]),M[34]=T(x[23]),M[35]=T(x[32]),M[36]=T(x[39]),M[37]=T(x[45]),M[38]=T(x[52]),M[39]=T(x[54]),M[40]=T(x[20]),M[41]=T(x[22]),M[42]=T(x[33]),M[43]=T(x[38]),M[44]=T(x[46]),M[45]=T(x[51]),M[46]=T(x[55]),M[47]=T(x[60]),M[48]=T(x[21]),M[49]=T(x[34]),M[50]=T(x[37]),M[51]=T(x[47]),M[52]=T(x[50]),M[53]=T(x[56]),M[54]=T(x[59]),M[55]=T(x[61]),M[56]=T(x[35]),M[57]=T(x[36]),M[58]=T(x[48]),M[59]=T(x[49]),M[60]=T(x[57]),M[61]=T(x[58]),M[62]=T(x[62]),M[63]=T(x[63]),function(e){let t=.5*Math.cos(3.14159/16),r=.5*Math.cos(3.14159/8),n=.5*Math.cos(3*3.14159/16),a=.5*Math.cos(3*3.14159/8);for(var i=[,,,,],o=[,,,,],l=[,,,,],s=[,,,,],u=0;u<8;++u){var c=8*u;i[0]=r*e[c+2],i[1]=a*e[c+2],i[2]=r*e[c+6],i[3]=a*e[c+6],o[0]=t*e[c+1]+n*e[c+3]+.2777854612564676*e[c+5]+.09754573032714427*e[c+7],o[1]=n*e[c+1]-.09754573032714427*e[c+3]-t*e[c+5]-.2777854612564676*e[c+7],o[2]=.2777854612564676*e[c+1]-t*e[c+3]+.09754573032714427*e[c+5]+n*e[c+7],o[3]=.09754573032714427*e[c+1]-.2777854612564676*e[c+3]+n*e[c+5]-t*e[c+7],l[0]=.35355362513961314*(e[c+0]+e[c+4]),l[3]=.35355362513961314*(e[c+0]-e[c+4]),l[1]=i[0]+i[3],l[2]=i[1]-i[2],s[0]=l[0]+l[1],s[1]=l[3]+l[2],s[2]=l[3]-l[2],s[3]=l[0]-l[1],e[c+0]=s[0]+o[0],e[c+1]=s[1]+o[1],e[c+2]=s[2]+o[2],e[c+3]=s[3]+o[3],e[c+4]=s[3]-o[3],e[c+5]=s[2]-o[2],e[c+6]=s[1]-o[1],e[c+7]=s[0]-o[0]}for(var f=0;f<8;++f)i[0]=r*e[16+f],i[1]=a*e[16+f],i[2]=r*e[48+f],i[3]=a*e[48+f],o[0]=t*e[8+f]+n*e[24+f]+.2777854612564676*e[40+f]+.09754573032714427*e[56+f],o[1]=n*e[8+f]-.09754573032714427*e[24+f]-t*e[40+f]-.2777854612564676*e[56+f],o[2]=.2777854612564676*e[8+f]-t*e[24+f]+.09754573032714427*e[40+f]+n*e[56+f],o[3]=.09754573032714427*e[8+f]-.2777854612564676*e[24+f]+n*e[40+f]-t*e[56+f],l[0]=.35355362513961314*(e[f]+e[32+f]),l[3]=.35355362513961314*(e[f]-e[32+f]),l[1]=i[0]+i[3],l[2]=i[1]-i[2],s[0]=l[0]+l[1],s[1]=l[3]+l[2],s[2]=l[3]-l[2],s[3]=l[0]-l[1],e[0+f]=s[0]+o[0],e[8+f]=s[1]+o[1],e[16+f]=s[2]+o[2],e[24+f]=s[3]+o[3],e[32+f]=s[3]-o[3],e[40+f]=s[2]-o[2],e[48+f]=s[1]-o[1],e[56+f]=s[0]-o[0]}(g[e])}for(var C=g,S=0;S<64;++S){var P=C[0][S],j=C[1][S],k=C[2][S];C[0][S]=P+1.5747*k,C[1][S]=P-.1873*j-.4682*k,C[2][S]=P+1.8556*j}for(let t=0;t<3;++t)!function(e,t,r){for(var n,a=0;a<64;++a){t[r+a]=l.GxU.toHalfFloat((n=e[a])<=1?Math.sign(n)*Math.pow(Math.abs(n),2.2):Math.sign(n)*Math.pow(9.025013291561939,Math.abs(n)-1))}}(g[t],w[t],64*e)}let i=0;for(let n=0;n<3;++n){let a=r[e.idx[n]].type;for(let e=8*t;e<8*t+_;++e){i=b[n][e];for(let t=0;t>10,r=1023&e;return(e>>15?-1:1)*(t?31===t?r?NaN:1/0:Math.pow(2,t-15)*(1+r/1024):r/1024*6103515625e-14)}function A(e,t){var r=e.getUint16(t.value,!0);return t.value+=2,r}function I(e,t){return T(A(e,t))}let R=new DataView(e),O=new Uint8Array(e),D={value:0},F=function(e,t,r){let n={};if(0x1312f76!=e.getUint32(0,!0))throw"THREE.EXRLoader: provided file doesn't appear to be in OpenEXR format.";n.version=e.getUint8(4);let a=e.getUint8(5);n.spec={singleTile:!!(2&a),longName:!!(4&a),deepFormat:!!(8&a),multiPart:!!(16&a)},r.value=8;for(var i=!0;i;){var o=_(t,r);if(0==o)i=!1;else{var l=_(t,r),s=C(e,r),u=function(e,t,r,n,a){var i,o,l,s,u,c,f;if("string"===n||"stringvector"===n||"iccProfile"===n)return i=new TextDecoder().decode(new Uint8Array(t).slice(r.value,r.value+a)),r.value=r.value+a,i;if("chlist"===n)return function(e,t,r,n){for(var a=r.value,i=[];r.valueL.height?L.height-t:L.scanlineBlockSize;let r=L.size=L.height)break;for(let e=0;e{let n;switch(e){case l.OUM:n=new Uint8ClampedArray(t*r*4);break;case l.ix0:n=new Uint16Array(t*r*4);break;case l.bkx:n=new Uint32Array(t*r*4);break;case l.tJf:n=new Int8Array(t*r*4);break;case l.fBL:n=new Int16Array(t*r*4);break;case l.Yuy:n=new Int32Array(t*r*4);break;case l.RQf:n=new Float32Array(t*r*4);break;default:throw Error("Unsupported data type")}return n};class W{constructor(e){var t,r,a,i,o,s,u,c,f,d,p,v,h,m,g,y;this._rendererIsDisposable=!1,this._supportsReadPixels=!0,this.render=()=>{this._renderer.setRenderTarget(this._renderTarget);try{this._renderer.render(this._scene,this._camera)}catch(e){throw this._renderer.setRenderTarget(null),e}this._renderer.setRenderTarget(null)},this._width=e.width,this._height=e.height,this._type=e.type,this._colorSpace=e.colorSpace;let w={format:l.GWd,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:(null==(t=e.renderTargetOptions)?void 0:t.anisotropy)!==void 0?null==(r=e.renderTargetOptions)?void 0:r.anisotropy:1,generateMipmaps:(null==(a=e.renderTargetOptions)?void 0:a.generateMipmaps)!==void 0&&(null==(i=e.renderTargetOptions)?void 0:i.generateMipmaps),magFilter:(null==(o=e.renderTargetOptions)?void 0:o.magFilter)!==void 0?null==(s=e.renderTargetOptions)?void 0:s.magFilter:l.k6q,minFilter:(null==(u=e.renderTargetOptions)?void 0:u.minFilter)!==void 0?null==(c=e.renderTargetOptions)?void 0:c.minFilter:l.k6q,samples:(null==(f=e.renderTargetOptions)?void 0:f.samples)!==void 0?null==(d=e.renderTargetOptions)?void 0:d.samples:void 0,wrapS:(null==(p=e.renderTargetOptions)?void 0:p.wrapS)!==void 0?null==(v=e.renderTargetOptions)?void 0:v.wrapS:l.ghU,wrapT:(null==(h=e.renderTargetOptions)?void 0:h.wrapT)!==void 0?null==(m=e.renderTargetOptions)?void 0:m.wrapT:l.ghU};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=W.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new l.Z58,this._camera=new l.qUd,this._camera.position.set(0,0,10),this._camera.left=-.5,this._camera.right=.5,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),!((e,t,r,a)=>{if(void 0!==n)return n;let i=new l.nWS(1,1,a);t.setRenderTarget(i);let o=new l.eaF(new l.bdM,new l.V9B({color:0xffffff}));t.render(o,r),t.setRenderTarget(null);let s=q(e,i.width,i.height);return t.readRenderTargetPixels(i,0,0,i.width,i.height,s),i.dispose(),o.geometry.dispose(),o.material.dispose(),n=0!==s[0]})(this._type,this._renderer,this._camera,w)){let e;this._type===l.ix0&&(e=this._renderer.extensions.has("EXT_color_buffer_float")?l.RQf:void 0),void 0!==e?(console.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to ${l.RQf}`),this._type=e):(this._supportsReadPixels=!1,console.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new l.eaF(new l.bdM,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new l.nWS(this.width,this.height,w),this._renderTarget.texture.mapping=(null==(g=e.renderTargetOptions)?void 0:g.mapping)!==void 0?null==(y=e.renderTargetOptions)?void 0:y.mapping:l.UTZ}static instantiateRenderer(){let e=new N.WebGLRenderer;return e.setSize(128,128),e}toArray(){if(!this._supportsReadPixels)throw Error("Can't read pixels in this browser");let e=q(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,e),e}toDataTexture(e){let t=new l.GYF(this.toArray(),this.width,this.height,l.GWd,this._type,(null==e?void 0:e.mapping)||l.UTZ,(null==e?void 0:e.wrapS)||l.ghU,(null==e?void 0:e.wrapT)||l.ghU,(null==e?void 0:e.magFilter)||l.k6q,(null==e?void 0:e.minFilter)||l.k6q,(null==e?void 0:e.anisotropy)||1,l.Zr2);return t.generateMipmaps=(null==e?void 0:e.generateMipmaps)!==void 0&&(null==e?void 0:e.generateMipmaps),t}disposeOnDemandRenderer(){this._renderer.setRenderTarget(null),this._rendererIsDisposable&&(this._renderer.dispose(),this._renderer.forceContextLoss())}dispose(e){this.disposeOnDemandRenderer(),e&&this.renderTarget.dispose(),this.material instanceof l.BKk&&Object.values(this.material.uniforms).forEach(e=>{e.value instanceof l.gPd&&e.value.dispose()}),Object.values(this.material).forEach(e=>{e instanceof l.gPd&&e.dispose()}),this.material.dispose(),this._quad.geometry.dispose()}get width(){return this._width}set width(e){this._width=e,this._renderTarget.setSize(this._width,this._height)}get height(){return this._height}set height(e){this._height=e,this._renderTarget.setSize(this._width,this._height)}get renderer(){return this._renderer}get renderTarget(){return this._renderTarget}set renderTarget(e){this._renderTarget=e,this._width=e.width,this._height=e.height}get material(){return this._material}get type(){return this._type}get colorSpace(){return this._colorSpace}}let G=`
varying vec2 vUv;
void main() {
vUv = uv;
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
}
`,V=`
// min half float value
#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 )
// max half float value
#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 )
uniform sampler2D sdr;
uniform sampler2D gainMap;
uniform vec3 gamma;
uniform vec3 offsetHdr;
uniform vec3 offsetSdr;
uniform vec3 gainMapMin;
uniform vec3 gainMapMax;
uniform float weightFactor;
varying vec2 vUv;
void main() {
vec3 rgb = texture2D( sdr, vUv ).rgb;
vec3 recovery = texture2D( gainMap, vUv ).rgb;
vec3 logRecovery = pow( recovery, gamma );
vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery;
vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr;
vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor ));
gl_FragColor = vec4( clampedHdrColor , 1.0 );
}
`;class $ extends l.BKk{constructor({gamma:e,offsetHdr:t,offsetSdr:r,gainMapMin:n,gainMapMax:a,maxDisplayBoost:i,hdrCapacityMin:o,hdrCapacityMax:s,sdr:u,gainMap:c}){super({name:"GainMapDecoderMaterial",vertexShader:G,fragmentShader:V,uniforms:{sdr:{value:u},gainMap:{value:c},gamma:{value:new l.Pq0(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:new l.Pq0().fromArray(t)},offsetSdr:{value:new l.Pq0().fromArray(r)},gainMapMin:{value:new l.Pq0().fromArray(n)},gainMapMax:{value:new l.Pq0().fromArray(a)},weightFactor:{value:(Math.log2(i)-o)/(s-o)}},blending:l.XIg,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=i,this._hdrCapacityMin=o,this._hdrCapacityMax=s,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(e){this.uniforms.sdr.value=e}get gainMap(){return this.uniforms.gainMap.value}set gainMap(e){this.uniforms.gainMap.value=e}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(e){this.uniforms.offsetHdr.value.fromArray(e)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(e){this.uniforms.offsetSdr.value.fromArray(e)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(e){this.uniforms.gainMapMin.value.fromArray(e)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(e){this.uniforms.gainMapMax.value.fromArray(e)}get gamma(){let e=this.uniforms.gamma.value;return[1/e.x,1/e.y,1/e.z]}set gamma(e){let t=this.uniforms.gamma.value;t.x=1/e[0],t.y=1/e[1],t.z=1/e[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(e){this._hdrCapacityMin=e,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(e){this._hdrCapacityMax=e,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(e){this._maxDisplayBoost=Math.max(1,Math.min(65504,e)),this.calculateWeight()}calculateWeight(){let e=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,e))}}class Y extends Error{}class X extends Error{}let Z=(e,t,r)=>{let n=RegExp(`${t}="([^"]*)"`,"i").exec(e);if(n)return n[1];let a=RegExp(`<${t}[^>]*>([\\s\\S]*?)${t}>`,"i").exec(e);if(a){let e=a[1].match(/([^<]*)<\/rdf:li>/g);return e&&3===e.length?e.map(e=>e.replace(/<\/?rdf:li>/g,"")):a[1].trim()}if(void 0!==r)return r;throw Error(`Can't find ${t} in gainmap metadata`)};class Q{constructor(e){this.options={debug:!!e&&void 0!==e.debug&&e.debug,extractFII:!e||void 0===e.extractFII||e.extractFII,extractNonFII:!e||void 0===e.extractNonFII||e.extractNonFII}}extract(e){return new Promise((t,r)=>{let n,a=this.options.debug,i=new DataView(e.buffer);if(65496!==i.getUint16(0))return void r(Error("Not a valid jpeg"));let o=i.byteLength,l=2,s=0;for(;l250)return void r(Error(`Found no marker after ${s} loops 😵`));if(255!==i.getUint8(l))return void r(Error(`Not a valid marker at offset 0x${l.toString(16)}, found: 0x${i.getUint8(l).toString(16)}`));if(n=i.getUint8(l+1),a&&console.log(`Marker: ${n.toString(16)}`),226===n){a&&console.log("Found APP2 marker (0xffe2)");let e=l+4;if(0x4d504600===i.getUint32(e)){let n,a=e+4;if(18761===i.getUint16(a))n=!1;else{if(19789!==i.getUint16(a))return void r(Error("No valid endianness marker found in TIFF header"));n=!0}if(42!==i.getUint16(a+2,!n))return void r(Error("Not valid TIFF data! (no 0x002A marker)"));let o=i.getUint32(a+4,!n);if(o<8)return void r(Error("Not valid TIFF data! (First offset less than 8)"));let l=a+o,s=i.getUint16(l,!n),u=l+2,c=0;for(let e=u;e{let t=(e=>{let t,r=(t="undefined"!=typeof TextDecoder?new TextDecoder().decode(e):e.toString()).indexOf("",r),n=t.slice(r,e+10);try{let e=Z(n,"hdrgm:GainMapMin","0"),t=Z(n,"hdrgm:GainMapMax"),r=Z(n,"hdrgm:Gamma","1"),a=Z(n,"hdrgm:OffsetSDR","0.015625"),i=Z(n,"hdrgm:OffsetHDR","0.015625"),o=/hdrgm:HDRCapacityMin="([^"]*)"/.exec(n),l=o?o[1]:"0",s=/hdrgm:HDRCapacityMax="([^"]*)"/.exec(n);if(!s)throw Error("Incomplete gainmap metadata");let u=s[1];return{gainMapMin:Array.isArray(e)?e.map(e=>parseFloat(e)):[parseFloat(e),parseFloat(e),parseFloat(e)],gainMapMax:Array.isArray(t)?t.map(e=>parseFloat(e)):[parseFloat(t),parseFloat(t),parseFloat(t)],gamma:Array.isArray(r)?r.map(e=>parseFloat(e)):[parseFloat(r),parseFloat(r),parseFloat(r)],offsetSdr:Array.isArray(a)?a.map(e=>parseFloat(e)):[parseFloat(a),parseFloat(a),parseFloat(a)],offsetHdr:Array.isArray(i)?i.map(e=>parseFloat(e)):[parseFloat(i),parseFloat(i),parseFloat(i)],hdrCapacityMin:parseFloat(l),hdrCapacityMax:parseFloat(u)}}catch(e){}r=t.indexOf("new Promise((t,r)=>{let n=document.createElement("img");n.onload=()=>{t(n)},n.onerror=e=>{r(e)},n.src=URL.createObjectURL(e)});class ee extends l.aHM{constructor(e,t){super(t),e&&(this._renderer=e),this._internalLoadingManager=new l.KPJ}setRenderer(e){return this._renderer=e,this}setRenderTargetOptions(e){return this._renderTargetOptions=e,this}prepareQuadRenderer(){this._renderer||console.warn("WARNING: An existing WebGL Renderer was not passed to this Loader constructor or in setRenderer, the result of this Loader will need to be converted to a Data Texture with toDataTexture() before you can use it in your renderer.");let e=new $({gainMapMax:[1,1,1],gainMapMin:[0,0,0],gamma:[1,1,1],offsetHdr:[1,1,1],offsetSdr:[1,1,1],hdrCapacityMax:1,hdrCapacityMin:0,maxDisplayBoost:1,gainMap:new l.gPd,sdr:new l.gPd});return new W({width:16,height:16,type:l.ix0,colorSpace:l.Zr2,material:e,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async render(e,t,r,n){let a,i,o=n?new Blob([n],{type:"image/jpeg"}):void 0,s=new Blob([r],{type:"image/jpeg"}),u=!1;if("undefined"==typeof createImageBitmap){let e=await Promise.all([o?J(o):Promise.resolve(void 0),J(s)]);i=e[0],a=e[1],u=!0}else{let e=await Promise.all([o?createImageBitmap(o,{imageOrientation:"flipY"}):Promise.resolve(void 0),createImageBitmap(s,{imageOrientation:"flipY"})]);i=e[0],a=e[1]}let c=new l.gPd(i||new ImageData(2,2),l.UTZ,l.ghU,l.ghU,l.k6q,l.NZq,l.GWd,l.OUM,1,l.Zr2);c.flipY=u,c.needsUpdate=!0;let f=new l.gPd(a,l.UTZ,l.ghU,l.ghU,l.k6q,l.NZq,l.GWd,l.OUM,1,l.er$);f.flipY=u,f.needsUpdate=!0,e.width=a.width,e.height=a.height,e.material.gainMap=c,e.material.sdr=f,e.material.gainMapMin=t.gainMapMin,e.material.gainMapMax=t.gainMapMax,e.material.offsetHdr=t.offsetHdr,e.material.offsetSdr=t.offsetSdr,e.material.gamma=t.gamma,e.material.hdrCapacityMin=t.hdrCapacityMin,e.material.hdrCapacityMax=t.hdrCapacityMax,e.material.maxDisplayBoost=Math.pow(2,t.hdrCapacityMax),e.material.needsUpdate=!0,e.render()}}class et extends ee{load([e,t,r],n,a,i){let o,s,u,c=this.prepareQuadRenderer(),f=async()=>{if(o&&s&&u){try{await this.render(c,u,o,s)}catch(n){this.manager.itemError(e),this.manager.itemError(t),this.manager.itemError(r),"function"==typeof i&&i(n),c.disposeOnDemandRenderer();return}"function"==typeof n&&n(c),this.manager.itemEnd(e),this.manager.itemEnd(t),this.manager.itemEnd(r),c.disposeOnDemandRenderer()}},d=!0,p=0,v=0,h=!0,m=0,g=0,y=!0,w=0,b=0,x=()=>{"function"==typeof a&&a(new ProgressEvent("progress",{lengthComputable:d&&h&&y,loaded:v+g+b,total:p+m+w}))};this.manager.itemStart(e),this.manager.itemStart(t),this.manager.itemStart(r);let M=new l.Y9S(this._internalLoadingManager);M.setResponseType("arraybuffer"),M.setRequestHeader(this.requestHeader),M.setPath(this.path),M.setWithCredentials(this.withCredentials),M.load(e,async e=>{if("string"==typeof e)throw Error("Invalid sdr buffer");o=e,await f()},e=>{d=e.lengthComputable,v=e.loaded,p=e.total,x()},t=>{this.manager.itemError(e),"function"==typeof i&&i(t)});let _=new l.Y9S(this._internalLoadingManager);_.setResponseType("arraybuffer"),_.setRequestHeader(this.requestHeader),_.setPath(this.path),_.setWithCredentials(this.withCredentials),_.load(t,async e=>{if("string"==typeof e)throw Error("Invalid gainmap buffer");s=e,await f()},e=>{h=e.lengthComputable,g=e.loaded,m=e.total,x()},e=>{this.manager.itemError(t),"function"==typeof i&&i(e)});let E=new l.Y9S(this._internalLoadingManager);return E.setRequestHeader(this.requestHeader),E.setPath(this.path),E.setWithCredentials(this.withCredentials),E.load(r,async e=>{if("string"!=typeof e)throw Error("Invalid metadata string");u=JSON.parse(e),await f()},e=>{y=e.lengthComputable,b=e.loaded,w=e.total,x()},e=>{this.manager.itemError(r),"function"==typeof i&&i(e)}),c}}class er extends ee{load(e,t,r,n){let a=this.prepareQuadRenderer(),i=new l.Y9S(this._internalLoadingManager);return i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setPath(this.path),i.setWithCredentials(this.withCredentials),this.manager.itemStart(e),i.load(e,async r=>{let i,o,l;if("string"==typeof r)throw Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");let s=new Uint8Array(r);try{let e=await K(s);i=e.sdr,o=e.gainMap,l=e.metadata}catch(t){if(t instanceof X||t instanceof Y)console.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),l={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},i=s;else throw t}try{await this.render(a,l,i,o)}catch(t){this.manager.itemError(e),"function"==typeof n&&n(t),a.disposeOnDemandRenderer();return}"function"==typeof t&&t(a),this.manager.itemEnd(e),a.disposeOnDemandRenderer()},r,t=>{this.manager.itemError(e),"function"==typeof n&&n(t)}),a}}let en={apartment:"lebombo_1k.hdr",city:"potsdamer_platz_1k.hdr",dawn:"kiara_1_dawn_1k.hdr",forest:"forest_slope_1k.hdr",lobby:"st_fagans_interior_1k.hdr",night:"dikhololo_night_1k.hdr",park:"rooitou_park_1k.hdr",studio:"studio_small_03_1k.hdr",sunset:"venice_sunset_1k.hdr",warehouse:"empty_warehouse_01_1k.hdr"},ea="https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/",ei=e=>Array.isArray(e),eo=["/px.png","/nx.png","/py.png","/ny.png","/pz.png","/nz.png"];function el({files:e=eo,path:t="",preset:r,colorSpace:n,extensions:a}={}){r&&(ec(r),e=en[r],t=ea);let s=ei(e),{extension:u,isCubemap:c}=ef(e),f=ed(u);if(!f)throw Error("useEnvironment: Unrecognized file extension: "+e);let d=(0,o.C)(e=>e.gl);(0,i.useLayoutEffect)(()=>{("webp"===u||"jpg"===u||"jpeg"===u)&&d.domElement.addEventListener("webglcontextlost",function(){o.G.clear(f,s?[e]:e)},{once:!0})},[e,d.domElement]);let p=(0,o.G)(f,s?[e]:e,e=>{("webp"===u||"jpg"===u||"jpeg"===u)&&e.setRenderer(d),null==e.setPath||e.setPath(t),a&&a(e)}),v=s?p[0]:p;if("jpg"===u||"jpeg"===u||"webp"===u){var h;v=null==(h=v.renderTarget)?void 0:h.texture}return v.mapping=c?l.hy7:l.wfO,v.colorSpace=null!=n?n:c?"srgb":"srgb-linear",v}let es={files:eo,path:"",preset:void 0,extensions:void 0};el.preload=e=>{let t={...es,...e},{files:r,path:n=""}=t,{preset:a,extensions:i}=t;a&&(ec(a),r=en[a],n=ea);let{extension:l}=ef(r);if("webp"===l||"jpg"===l||"jpeg"===l)throw Error("useEnvironment: Preloading gainmaps is not supported");let s=ed(l);if(!s)throw Error("useEnvironment: Unrecognized file extension: "+r);o.G.preload(s,ei(r)?[r]:r,e=>{null==e.setPath||e.setPath(n),i&&i(e)})};let eu={files:eo,preset:void 0};function ec(e){if(!(e in en))throw Error("Preset must be one of: "+Object.keys(en).join(", "))}function ef(e){var t;let r=ei(e)&&6===e.length,n=ei(e)&&3===e.length&&e.some(e=>e.endsWith("json")),a=ei(e)?e[0]:e;return{extension:r?"cube":n?"webp":a.startsWith("data:application/exr")?"exr":a.startsWith("data:application/hdr")?"hdr":a.startsWith("data:image/jpeg")?"jpg":null==(t=a.split(".").pop())||null==(t=t.split("?"))||null==(t=t.shift())?void 0:t.toLowerCase(),isCubemap:r,isGainmap:n}}function ed(e){return"cube"===e?l.ScU:"hdr"===e?c:"exr"===e?H:"jpg"===e||"jpeg"===e?er:"webp"===e?et:null}function ep(e,t,r,n,a={}){var i,l,s,u;let c,f;a={backgroundBlurriness:0,backgroundIntensity:1,backgroundRotation:[0,0,0],environmentIntensity:1,environmentRotation:[0,0,0],...a};let d=(f=c=t||r).current&&f.current.isScene?c.current:c,p=d.background,v=d.environment,h={backgroundBlurriness:d.backgroundBlurriness,backgroundIntensity:d.backgroundIntensity,backgroundRotation:null!=(i=null==(l=d.backgroundRotation)||null==l.clone?void 0:l.clone())?i:[0,0,0],environmentIntensity:d.environmentIntensity,environmentRotation:null!=(s=null==(u=d.environmentRotation)||null==u.clone?void 0:u.clone())?s:[0,0,0]};return"only"!==e&&(d.environment=n),e&&(d.background=n),(0,o.s)(d,a),()=>{"only"!==e&&(d.environment=v),e&&(d.background=p),(0,o.s)(d,h)}}function ev({scene:e,background:t=!1,map:r,...n}){let a=(0,o.C)(e=>e.scene);return i.useLayoutEffect(()=>{if(r)return ep(t,e,a,r,n)}),null}function eh({background:e=!1,scene:t,blur:r,backgroundBlurriness:n,backgroundIntensity:a,backgroundRotation:l,environmentIntensity:s,environmentRotation:u,...c}){let f=el(c),d=(0,o.C)(e=>e.scene);return i.useLayoutEffect(()=>ep(e,t,d,f,{backgroundBlurriness:null!=r?r:n,backgroundIntensity:a,backgroundRotation:l,environmentIntensity:s,environmentRotation:u})),i.useEffect(()=>()=>{f.dispose()},[f]),null}function em({children:e,near:t=.1,far:r=1e3,resolution:n=256,frames:a=1,map:s,background:u=!1,blur:c,backgroundBlurriness:f,backgroundIntensity:d,backgroundRotation:p,environmentIntensity:v,environmentRotation:h,scene:m,files:g,path:y,preset:w,extensions:b}){let x=(0,o.C)(e=>e.gl),M=(0,o.C)(e=>e.scene),_=i.useRef(null),[E]=i.useState(()=>new l.Z58),C=i.useMemo(()=>{let e=new l.o6l(n);return e.texture.type=l.ix0,e},[n]);i.useEffect(()=>()=>{C.dispose()},[C]),i.useLayoutEffect(()=>{if(1===a){let e=x.autoClear;x.autoClear=!0,_.current.update(x,E),x.autoClear=e}return ep(u,m,M,C.texture,{backgroundBlurriness:null!=c?c:f,backgroundIntensity:d,backgroundRotation:p,environmentIntensity:v,environmentRotation:h})},[e,E,C.texture,m,M,u,a,x]);let S=1;return(0,o.D)(()=>{if(a===1/0||S(0,o.e)({GroundProjectedEnvImpl:u}),[]),i.useEffect(()=>()=>{s.dispose()},[s]);let f=i.useMemo(()=>[c],[c]),d=null==(t=e.ground)?void 0:t.height,p=null==(r=e.ground)?void 0:r.radius,v=null!=(n=null==(l=e.ground)?void 0:l.scale)?n:1e3;return i.createElement(i.Fragment,null,i.createElement(ev,(0,a.A)({},e,{map:c})),i.createElement("groundProjectedEnvImpl",{args:f,scale:v,height:d,radius:p}))}function ey(e){return e.ground?i.createElement(eg,e):e.map?i.createElement(ev,e):e.children?i.createElement(em,e):i.createElement(eh,e)}el.clear=e=>{let t={...eu,...e},{files:r}=t,{preset:n}=t;n&&(ec(n),r=en[n]);let{extension:a}=ef(r),i=ed(a);if(!i)throw Error("useEnvironment: Unrecognized file extension: "+r);o.G.clear(i,ei(r)?[r]:r)}},5302:(e,t,r)=>{r.d(t,{Hl:()=>f});var n=r(2648),a=r(4232),i=r(4796);function o(e,t){let r;return(...n)=>{window.clearTimeout(r),r=window.setTimeout(()=>e(...n),t)}}let l=["x","y","top","bottom","left","right","width","height"];var s=r(1831),u=r(7876);function c({ref:e,children:t,fallback:r,resize:s,style:c,gl:f,events:d=n.f,eventSource:p,eventPrefix:v,shadows:h,linear:m,flat:g,legacy:y,orthographic:w,frameloop:b,dpr:x,performance:M,raycaster:_,camera:E,scene:C,onPointerMissed:S,onCreated:P,...j}){a.useMemo(()=>(0,n.e)(i),[]);let k=(0,n.u)(),[U,T]=function({debounce:e,scroll:t,polyfill:r,offsetSize:n}={debounce:0,scroll:!1,offsetSize:!1}){var i,s,u;let c=r||("undefined"==typeof window?class{}:window.ResizeObserver);if(!c)throw Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");let[f,d]=(0,a.useState)({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),p=(0,a.useRef)({element:null,scrollContainers:null,resizeObserver:null,lastBounds:f,orientationHandler:null}),v=e?"number"==typeof e?e:e.scroll:null,h=e?"number"==typeof e?e:e.resize:null,m=(0,a.useRef)(!1);(0,a.useEffect)(()=>(m.current=!0,()=>void(m.current=!1)));let[g,y,w]=(0,a.useMemo)(()=>{let e=()=>{let e,t;if(!p.current.element)return;let{left:r,top:a,width:i,height:o,bottom:s,right:u,x:c,y:f}=p.current.element.getBoundingClientRect(),v={left:r,top:a,width:i,height:o,bottom:s,right:u,x:c,y:f};p.current.element instanceof HTMLElement&&n&&(v.height=p.current.element.offsetHeight,v.width=p.current.element.offsetWidth),Object.freeze(v),m.current&&(e=p.current.lastBounds,t=v,!l.every(r=>e[r]===t[r]))&&d(p.current.lastBounds=v)};return[e,h?o(e,h):e,v?o(e,v):e]},[d,n,v,h]);function b(){p.current.scrollContainers&&(p.current.scrollContainers.forEach(e=>e.removeEventListener("scroll",w,!0)),p.current.scrollContainers=null),p.current.resizeObserver&&(p.current.resizeObserver.disconnect(),p.current.resizeObserver=null),p.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",p.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",p.current.orientationHandler))}function x(){p.current.element&&(p.current.resizeObserver=new c(w),p.current.resizeObserver.observe(p.current.element),t&&p.current.scrollContainers&&p.current.scrollContainers.forEach(e=>e.addEventListener("scroll",w,{capture:!0,passive:!0})),p.current.orientationHandler=()=>{w()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",p.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",p.current.orientationHandler))}return i=w,s=!!t,(0,a.useEffect)(()=>{if(s)return window.addEventListener("scroll",i,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",i,!0)},[i,s]),u=y,(0,a.useEffect)(()=>(window.addEventListener("resize",u),()=>void window.removeEventListener("resize",u)),[u]),(0,a.useEffect)(()=>{b(),x()},[t,w,y]),(0,a.useEffect)(()=>b,[]),[e=>{e&&e!==p.current.element&&(b(),p.current.element=e,p.current.scrollContainers=function e(t){let r=[];if(!t||t===document.body)return r;let{overflow:n,overflowX:a,overflowY:i}=window.getComputedStyle(t);return[n,a,i].some(e=>"auto"===e||"scroll"===e)&&r.push(t),[...r,...e(t.parentElement)]}(e),x())},f,g]}({scroll:!0,debounce:{scroll:50,resize:0},...s}),A=a.useRef(null),I=a.useRef(null);a.useImperativeHandle(e,()=>A.current);let R=(0,n.a)(S),[O,D]=a.useState(!1),[F,z]=a.useState(!1);if(O)throw O;if(F)throw F;let L=a.useRef(null);(0,n.b)(()=>{let e=A.current;T.width>0&&T.height>0&&e&&(L.current||(L.current=(0,n.c)(e)),async function(){await L.current.configure({gl:f,scene:C,events:d,shadows:h,linear:m,flat:g,legacy:y,orthographic:w,frameloop:b,dpr:x,performance:M,raycaster:_,camera:E,size:T,onPointerMissed:(...e)=>null==R.current?void 0:R.current(...e),onCreated:e=>{null==e.events.connect||e.events.connect(p?(0,n.i)(p)?p.current:p:I.current),v&&e.setEvents({compute:(e,t)=>{let r=e[v+"X"],n=e[v+"Y"];t.pointer.set(r/t.size.width*2-1,-(2*(n/t.size.height))+1),t.raycaster.setFromCamera(t.pointer,t.camera)}}),null==P||P(e)}}),L.current.render((0,u.jsx)(k,{children:(0,u.jsx)(n.E,{set:z,children:(0,u.jsx)(a.Suspense,{fallback:(0,u.jsx)(n.B,{set:D}),children:null!=t?t:null})})}))}())}),a.useEffect(()=>{let e=A.current;if(e)return()=>(0,n.d)(e)},[]);let B=p?"none":"auto";return(0,u.jsx)("div",{ref:I,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:B,...c},...j,children:(0,u.jsx)("div",{ref:U,style:{width:"100%",height:"100%"},children:(0,u.jsx)("canvas",{ref:A,style:{display:"block"},children:r})})})}function f(e){return(0,u.jsx)(s.Af,{children:(0,u.jsx)(c,{...e})})}r(7302),r(667),r(1923)},5712:(e,t,r)=>{e.exports=r(8214)},6100:(e,t,r)=>{r.d(t,{C:()=>a});var n=r(1898);function a(e,t){return(0,n.a)(e,null==t?void 0:t.in).getFullYear()}},7302:(e,t,r)=>{e.exports=r(3307)},7816:(e,t)=>{function r(e,t){var r=e.length;for(e.push(t);0>>1,a=e[n];if(0>>1;ni(s,r))ui(c,s)?(e[n]=c,e[u]=r,n=u):(e[n]=s,e[l]=r,n=l);else if(ui(c,r))e[n]=c,e[u]=r,n=u;else break}}return t}function i(e,t){var r=e.sortIndex-t.sortIndex;return 0!==r?r:e.id-t.id}if(t.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var o,l=performance;t.unstable_now=function(){return l.now()}}else{var s=Date,u=s.now();t.unstable_now=function(){return s.now()-u}}var c=[],f=[],d=1,p=null,v=3,h=!1,m=!1,g=!1,y="function"==typeof setTimeout?setTimeout:null,w="function"==typeof clearTimeout?clearTimeout:null,b="undefined"!=typeof setImmediate?setImmediate:null;function x(e){for(var t=n(f);null!==t;){if(null===t.callback)a(f);else if(t.startTime<=e)a(f),t.sortIndex=t.expirationTime,r(c,t);else break;t=n(f)}}function M(e){if(g=!1,x(e),!m)if(null!==n(c))m=!0,T();else{var t=n(f);null!==t&&A(M,t.startTime-e)}}var _=!1,E=-1,C=5,S=-1;function P(){return!(t.unstable_now()-Se&&P());){var l=p.callback;if("function"==typeof l){p.callback=null,v=p.priorityLevel;var s=l(p.expirationTime<=e);if(e=t.unstable_now(),"function"==typeof s){p.callback=s,x(e),r=!0;break t}p===n(c)&&a(c),x(e)}else a(c);p=n(c)}if(null!==p)r=!0;else{var u=n(f);null!==u&&A(M,u.startTime-e),r=!1}}break e}finally{p=null,v=i,h=!1}}}finally{r?o():_=!1}}}if("function"==typeof b)o=function(){b(j)};else if("undefined"!=typeof MessageChannel){var k=new MessageChannel,U=k.port2;k.port1.onmessage=j,o=function(){U.postMessage(null)}}else o=function(){y(j,0)};function T(){_||(_=!0,o())}function A(e,r){E=y(function(){e(t.unstable_now())},r)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){m||h||(m=!0,T())},t.unstable_forceFrameRate=function(e){0>e||125o?(e.sortIndex=i,r(f,e),null===n(c)&&e===n(f)&&(g?(w(E),E=-1):g=!0,A(M,i-o))):(e.sortIndex=l,r(c,e),m||h||(m=!0,T())),e},t.unstable_shouldYield=P,t.unstable_wrapCallback=function(e){var t=v;return function(){var r=v;v=t;try{return e.apply(this,arguments)}finally{v=r}}}},8214:(e,t,r)=>{var n=r(4232),a=r(8806),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=a.useSyncExternalStore,l=n.useRef,s=n.useEffect,u=n.useMemo,c=n.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,r,n,a){var f=l(null);if(null===f.current){var d={hasValue:!1,value:null};f.current=d}else d=f.current;var p=o(e,(f=u(function(){function e(e){if(!s){if(s=!0,o=e,e=n(e),void 0!==a&&d.hasValue){var t=d.value;if(a(t,e))return l=t}return l=e}if(t=l,i(o,e))return t;var r=n(e);return void 0!==a&&a(t,r)?(o=e,t):(o=e,l=r)}var o,l,s=!1,u=void 0===r?null:r;return[function(){return e(t())},null===u?void 0:function(){return e(u())}]},[t,r,n,a]))[0],f[1]);return s(function(){d.hasValue=!0,d.value=p},[p]),c(p),p}},8519:(e,t,r)=>{r.d(t,{I:()=>s});var n=r(4501),a=r(4232),i=r(6691),o=r(2648);class l extends i.uSd{constructor(e={}){super(e),this.setValues(e),this._time={value:0},this._distort={value:.4},this._radius={value:1}}onBeforeCompile(e){e.uniforms.time=this._time,e.uniforms.radius=this._radius,e.uniforms.distort=this._distort,e.vertexShader=`
uniform float time;
uniform float radius;
uniform float distort;
#define GLSLIFY 1
vec3 mod289(vec3 x){return x-floor(x*(1.0/289.0))*289.0;}vec4 mod289(vec4 x){return x-floor(x*(1.0/289.0))*289.0;}vec4 permute(vec4 x){return mod289(((x*34.0)+1.0)*x);}vec4 taylorInvSqrt(vec4 r){return 1.79284291400159-0.85373472095314*r;}float snoise(vec3 v){const vec2 C=vec2(1.0/6.0,1.0/3.0);const vec4 D=vec4(0.0,0.5,1.0,2.0);vec3 i=floor(v+dot(v,C.yyy));vec3 x0=v-i+dot(i,C.xxx);vec3 g=step(x0.yzx,x0.xyz);vec3 l=1.0-g;vec3 i1=min(g.xyz,l.zxy);vec3 i2=max(g.xyz,l.zxy);vec3 x1=x0-i1+C.xxx;vec3 x2=x0-i2+C.yyy;vec3 x3=x0-D.yyy;i=mod289(i);vec4 p=permute(permute(permute(i.z+vec4(0.0,i1.z,i2.z,1.0))+i.y+vec4(0.0,i1.y,i2.y,1.0))+i.x+vec4(0.0,i1.x,i2.x,1.0));float n_=0.142857142857;vec3 ns=n_*D.wyz-D.xzx;vec4 j=p-49.0*floor(p*ns.z*ns.z);vec4 x_=floor(j*ns.z);vec4 y_=floor(j-7.0*x_);vec4 x=x_*ns.x+ns.yyyy;vec4 y=y_*ns.x+ns.yyyy;vec4 h=1.0-abs(x)-abs(y);vec4 b0=vec4(x.xy,y.xy);vec4 b1=vec4(x.zw,y.zw);vec4 s0=floor(b0)*2.0+1.0;vec4 s1=floor(b1)*2.0+1.0;vec4 sh=-step(h,vec4(0.0));vec4 a0=b0.xzyw+s0.xzyw*sh.xxyy;vec4 a1=b1.xzyw+s1.xzyw*sh.zzww;vec3 p0=vec3(a0.xy,h.x);vec3 p1=vec3(a0.zw,h.y);vec3 p2=vec3(a1.xy,h.z);vec3 p3=vec3(a1.zw,h.w);vec4 norm=taylorInvSqrt(vec4(dot(p0,p0),dot(p1,p1),dot(p2,p2),dot(p3,p3)));p0*=norm.x;p1*=norm.y;p2*=norm.z;p3*=norm.w;vec4 m=max(0.6-vec4(dot(x0,x0),dot(x1,x1),dot(x2,x2),dot(x3,x3)),0.0);m=m*m;return 42.0*dot(m*m,vec4(dot(p0,x0),dot(p1,x1),dot(p2,x2),dot(p3,x3)));}
${e.vertexShader}
`,e.vertexShader=e.vertexShader.replace("#include ",`
float updateTime = time / 50.0;
float noise = snoise(vec3(position / 2.0 + updateTime * 5.0));
vec3 transformed = vec3(position * (noise * pow(distort, 2.0) + radius));
`)}get time(){return this._time.value}set time(e){this._time.value=e}get distort(){return this._distort.value}set distort(e){this._distort.value=e}get radius(){return this._radius.value}set radius(e){this._radius.value=e}}let s=a.forwardRef(({speed:e=1,...t},r)=>{let[i]=a.useState(()=>new l);return(0,o.D)(t=>i&&(i.time=t.clock.elapsedTime*e)),a.createElement("primitive",(0,n.A)({object:i,ref:r,attach:"material"},t))})},8575:(e,t)=>{function r(e,t){var r=e.length;for(e.push(t);0>>1,a=e[n];if(0>>1;ni(s,r))ui(c,s)?(e[n]=c,e[u]=r,n=u):(e[n]=s,e[l]=r,n=l);else if(ui(c,r))e[n]=c,e[u]=r,n=u;else break}}return t}function i(e,t){var r=e.sortIndex-t.sortIndex;return 0!==r?r:e.id-t.id}if(t.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var o,l=performance;t.unstable_now=function(){return l.now()}}else{var s=Date,u=s.now();t.unstable_now=function(){return s.now()-u}}var c=[],f=[],d=1,p=null,v=3,h=!1,m=!1,g=!1,y="function"==typeof setTimeout?setTimeout:null,w="function"==typeof clearTimeout?clearTimeout:null,b="undefined"!=typeof setImmediate?setImmediate:null;function x(e){for(var t=n(f);null!==t;){if(null===t.callback)a(f);else if(t.startTime<=e)a(f),t.sortIndex=t.expirationTime,r(c,t);else break;t=n(f)}}function M(e){if(g=!1,x(e),!m)if(null!==n(c))m=!0,T();else{var t=n(f);null!==t&&A(M,t.startTime-e)}}var _=!1,E=-1,C=5,S=-1;function P(){return!(t.unstable_now()-Se&&P());){var l=p.callback;if("function"==typeof l){p.callback=null,v=p.priorityLevel;var s=l(p.expirationTime<=e);if(e=t.unstable_now(),"function"==typeof s){p.callback=s,x(e),r=!0;break t}p===n(c)&&a(c),x(e)}else a(c);p=n(c)}if(null!==p)r=!0;else{var u=n(f);null!==u&&A(M,u.startTime-e),r=!1}}break e}finally{p=null,v=i,h=!1}}}finally{r?o():_=!1}}}if("function"==typeof b)o=function(){b(j)};else if("undefined"!=typeof MessageChannel){var k=new MessageChannel,U=k.port2;k.port1.onmessage=j,o=function(){U.postMessage(null)}}else o=function(){y(j,0)};function T(){_||(_=!0,o())}function A(e,r){E=y(function(){e(t.unstable_now())},r)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){m||h||(m=!0,T())},t.unstable_forceFrameRate=function(e){0>e||125o?(e.sortIndex=i,r(f,e),null===n(c)&&e===n(f)&&(g?(w(E),E=-1):g=!0,A(M,i-o))):(e.sortIndex=l,r(c,e),m||h||(m=!0,T())),e},t.unstable_shouldYield=P,t.unstable_wrapCallback=function(e){var t=v;return function(){var r=v;v=t;try{return e.apply(this,arguments)}finally{v=r}}}}}]);