1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[96085],{504:(e,t,i)=>{"use strict";i.d(t,{L:()=>s});let r={};function s(e="id"){r[e]=r[e]||1;let t=r[e]++;return`${e}-${t}`}},2137:(e,t,i)=>{"use strict";i.d(t,{M:()=>s});let r="colormap",s={name:r,fs:`\ 2uniform ${r}Uniforms { 3 int colormapIndex; 4 float reversed; 5} ${r}; 6`,inject:{"fs:#decl":`\ 7precision highp sampler2DArray; 8uniform sampler2DArray colormapTexture; 9`,"fs:DECKGL_FILTER_COLOR":` 10 float idx = mix(color.r, 1.0 - color.r, ${r}.reversed); 11 color = texture( 12 colormapTexture, 13 vec3(idx, 0.5, float(${r}.colormapIndex)) 14 ); 15 `},uniformTypes:{colormapIndex:"i32",reversed:"f32"},getUniforms:e=>({colormapTexture:e.colormapTexture,colormapIndex:e.colormapIndex??0,reversed:e.reversed??!1})}},2186:(e,t,i)=>{"use strict";i.d(t,{_:()=>s});var r=i(38809);function s(e){let t=(0,r.A)(e);return"longlat"!==t.projName||t.units&&"unknown"!==t.units||(t.units="degree",t.to_meter=void 0),t}},3055:(e,t,i)=>{"use strict";i.d(t,{$:()=>s});let r="linearRescale",s={name:r,fs:`\ 16uniform ${r}Uniforms { 17 float rescaleMin; 18 float rescaleMax; 19} ${r}; 20`,inject:{"fs:DECKGL_FILTER_COLOR":` 21 color.rgb = clamp((color.rgb - ${r}.rescaleMin) / (${r}.rescaleMax - ${r}.rescaleMin), 0.0, 1.0); 22`},uniformTypes:{rescaleMin:"f32",rescaleMax:"f32"},getUniforms:e=>({rescaleMin:e.rescaleMin??0,rescaleMax:e.rescaleMax??1})}},3991:(e,t,i)=>{"use strict";i.d(t,{RZ:()=>l,D4:()=>h});var r=i(97681);async function s(e,t){let i=new Blob([e]),r=await createImageBitmap(i),s=new OffscreenCanvas(r.width,r.height),n=s.getContext("2d");n.drawImage(r,0,0),r.close();let{width:o,height:a}=s,l=n.getImageData(0,0,o,a).data,h=t.samplesPerPixel;if(4===h)return{layout:"pixel-interleaved",data:l};if(3===h){let e=new Uint8ClampedArray(o*a*3);for(let t=0,i=0;t<e.length;t+=3,i+=4)e[t]=l[i],e[t+1]=l[i+1],e[t+2]=l[i+2];return{layout:"pixel-interleaved",data:e}}if(1===h){let e=o*a,t=new Uint8ClampedArray(e);for(let i=0,r=0;i<e;i++,r+=4)t[i]=l[r];return{layout:"pixel-interleaved",data:t}}throw Error(`Unsupported SamplesPerPixel for JPEG: ${h}`)}async function n(e,{format:t,signal:i}){let r=e instanceof Response?e:new Response(e);!function(e,t=""){if(!e)throw Error(t)}(r.body,"Response does not contain body.");try{let e=new Response(r.body.pipeThrough(new DecompressionStream(t),{signal:i}));return await e.arrayBuffer()}catch{throw i?.throwIfAborted(),Error(`Failed to decode ${t}`)}}async function o(e){return n(e,{format:"deflate"})}async function a(e){return e}let l=new Map;async function h(e,t,i){let s=l.get(t);if(!s)throw Error(`Unsupported compression: ${t}`);let n=await s(),o=await n(e,i);if(o instanceof ArrayBuffer){let{predictor:e,width:t,height:s,bitsPerSample:n,samplesPerPixel:a,planarConfiguration:l}=i;return{layout:"pixel-interleaved",data:function(e,t){let{sampleFormat:i,bitsPerSample:s}=t;switch(i){case r.wF.Uint:switch(s){case 1:return function(e,t){let i=new Uint8Array(e),r=new Uint8Array(t);for(let e=0;e<t;e++)r[e]=i[e>>3]>>7-(7&e)&1?255:0;return r}(e,t.width*t.height*t.samplesPerPixel);case 8:return new Uint8Array(e);case 16:return new Uint16Array(e);case 32:return new Uint32Array(e)}break;case r.wF.Int:switch(s){case 8:return new Int8Array(e);case 16:return new Int16Array(e);case 32:return new Int32Array(e)}break;case r.wF.Float:switch(s){case 32:return new Float32Array(e);case 64:return new Float64Array(e)}}throw Error(`Unsupported sample format/depth: SampleFormat=${i}, BitsPerSample=${s}`)}(function(e,t,i,s,n,o,a){if(t===r.XE.None)return e;let l=n/8,h=a===r.lI.Separate?1:o;for(let o=0;o<s;o++){let s=o*h*i*l;if(s>=e.byteLength)break;if(t===r.XE.Horizontal){let t,r=h*i;switch(n){case 8:t=new Uint8Array(e,s,r);break;case 16:t=new Uint16Array(e,s,r);break;case 32:t=new Uint32Array(e,s,r);break;default:throw Error(`Predictor 2 not supported for ${n} bits per sample.`)}!function(e,t){let i=0,r=e.length-t;do{for(let r=t;r>0;r--)e[i+t]=(e[i+t]??0)+(e[i]??0),i++;r-=t}while(r>0)}(t,h)}else t===r.XE.FloatingPoint&&function(e,t,i){let r=0,s=e.length,n=s/i;for(;s>t;){for(let i=t;i>0;i--)e[r+t]+=e[r],r++;
22s-=t}let o=e.slice();for(let t=0;t<n;t++)for(let r=0;r<i;r++)e[i*t+r]=o[(i-r-1)*n+t]}(new Uint8Array(e,s,h*i*l),h,l)}return e}(o,e,t,s,n,a,l),i)}}return o}l.set(r.Pr.None,()=>Promise.resolve(a)),l.set(r.Pr.Deflate,()=>Promise.resolve(o)),l.set(r.Pr.DeflateOther,()=>Promise.resolve(o)),l.set(r.Pr.Lzw,()=>i.e(9606).then(i.bind(i,9606)).then(e=>e.decode)),l.set(r.Pr.Zstd,()=>i.e(90685).then(i.bind(i,90685)).then(e=>e.decode)),l.set(r.Pr.Jpeg,()=>Promise.resolve(s)),l.set(r.Pr.Jpeg6,()=>Promise.resolve(s)),l.set(r.Pr.Webp,()=>Promise.resolve(s)),l.set(r.Pr.Lerc,()=>i.e(60215).then(i.bind(i,60215)).then(e=>e.decode))},5725:(e,t,i)=>{"use strict";function r(e,t,i){return!(t<e.sourceOffset)&&!(e.sourceOffset+e.byteLength<t+i)}i.d(t,{g:()=>r})},7460:(e,t,i)=>{"use strict";function r(e,t=()=>!0){return Array.isArray(e)?function e(t,i,r){let s=-1;for(;++s<t.length;){let n=t[s];Array.isArray(n)?e(n,i,r):i(n)&&r.push(n)}return r}(e,t,[]):t(e)?[e]:[]}function s({target:e,source:t,start:i=0,count:r=1}){let s=t.length,n=r*s,o=0;for(let r=i;o<s;o++)e[r++]=t[o];for(;o<n;)o<n-o?(e.copyWithin(i+o,i,i+o),o*=2):(e.copyWithin(i+o,i,i+n-o),o=n);return e}i.d(t,{B:()=>r,R:()=>s})},8457:(e,t,i)=>{"use strict";Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});let r=i(27364);var s=Math.pow,n=(e,t,i)=>new Promise((r,s)=>{var n=e=>{try{a(i.next(e))}catch(e){s(e)}},o=e=>{try{a(i.throw(e))}catch(e){s(e)}},a=e=>e.done?r(e.value):Promise.resolve(e.value).then(n,o);a((i=i.apply(e,t)).next())}),o=Uint8Array,a=Uint16Array,l=Int32Array,h=new o([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]),u=new o([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 o([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),d=function(e,t){for(var i=new a(31),r=0;r<31;++r)i[r]=t+=1<<e[r-1];var s=new l(i[30]);for(r=1;r<30;++r)for(var n=i[r];n<i[r+1];++n)s[n]=n-i[r]<<5|r;return{b:i,r:s}},f=d(h,2),p=f.b,g=f.r;p[28]=258,g[258]=28;var m,_=d(u,0).b,y=new a(32768);for(E=0;E<32768;++E)m=(61680&(m=(52428&(m=(43690&E)>>1|(21845&E)<<1))>>2|(13107&m)<<2))>>4|(3855&m)<<4,y[E]=((65280&m)>>8|(255&m)<<8)>>1;var v=function(e,t,i){for(var r=e.length,s=0,n=new a(t);s<r;++s)e[s]&&++n[e[s]-1];var o,l=new a(t);for(s=1;s<t;++s)l[s]=l[s-1]+n[s-1]<<1;o=new a(1<<t);var h=15-t;for(s=0;s<r;++s)if(e[s])for(var u=s<<4|e[s],c=t-e[s],d=l[e[s]-1]++<<c,f=d|(1<<c)-1;d<=f;++d)o[y[d]>>h]=u;return o},b=new o(288);for(E=0;E<144;++E)b[E]=8;for(E=144;E<256;++E)b[E]=9;for(E=256;E<280;++E)b[E]=7;for(E=280;E<288;++E)b[E]=8;var E,x=new o(32);for(E=0;E<32;++E)x[E]=5;var w=v(b,9),S=v(x,5),P=function(e){for(var t=e[0],i=1;i<e.length;++i)e[i]>t&&(t=e[i]);return t},T=function(e,t,i){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&i},A=function(e,t){var i=t/8|0;return(e[i]|e[i+1]<<8|e[i+2]<<16)>>(7&t)}
22,M=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],C=function(e,t,i){var r=Error(t||M[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,C),!i)throw r;return r},R=function(e,t,i,r){var s,n,a,l=e.length;if(!l||t.f&&!t.l)return i||new o(0);var d=!i||2!=t.i,f=t.i;i||(i=new o(3*l));var g=function(e){var t=i.length;if(e>t){var r=new o(Math.max(2*t,e));r.set(i),i=r}},m=t.f||0,y=t.p||0,b=t.b||0,E=t.l,x=t.d,M=t.m,R=t.n,L=8*l;do{if(!E){m=T(e,y,1);var I=T(e,y+1,3);if(y+=3,!I){var O=e[(W=4+((y+7)/8|0))-4]|e[W-3]<<8,N=W+O;if(N>l){f&&C(0);break}d&&g(b+O),i.set(e.subarray(W,N),b),t.b=b+=O,t.p=y=8*N,t.f=m;continue}if(1==I)E=w,x=S,M=9,R=5;else if(2==I){var F=T(e,y,31)+257,D=T(e,y+10,15)+4,B=F+T(e,y+5,31)+1;y+=14;for(var G=new o(B),k=new o(19),U=0;U<D;++U)k[c[U]]=T(e,y+3*U,7);y+=3*D;var z=P(k),j=(1<<z)-1,V=v(k,z);for(U=0;U<B;){var W,$=V[T(e,y,j)];if(y+=15&$,(W=$>>4)<16)G[U++]=W;else{var H=0,q=0;for(16==W?(q=3+T(e,y,3),y+=2,H=G[U-1]):17==W?(q=3+T(e,y,7),y+=3):18==W&&(q=11+T(e,y,127),y+=7);q--;)G[U++]=H}}var K=G.subarray(0,F),X=G.subarray(F);M=P(K),R=P(X),E=v(K,M),x=v(X,R)}else C(1);if(y>L){f&&C(0);break}}d&&g(b+131072);for(var Y=(1<<M)-1,Z=(1<<R)-1,Q=y;;Q=y){var J=(H=E[A(e,y)&Y])>>4;if((y+=15&H)>L){f&&C(0);break}if(H||C(2),J<256)i[b++]=J;else{if(256==J){Q=y,E=null;break}var ee=J-254;if(J>264){var et=h[U=J-257];ee=T(e,y,(1<<et)-1)+p[U],y+=et}var ei=x[A(e,y)&Z],er=ei>>4;if(ei||C(3),y+=15&ei,X=_[er],er>3&&(et=u[er],X+=A(e,y)&(1<<et)-1,y+=et),y>L){f&&C(0);break}d&&g(b+131072);var es=b+ee;if(b<X){var en=0-X,eo=Math.min(X,es);for(en+b<0&&C(3);b<eo;++b)i[b]=r[en+b]}for(;b<es;b+=4)i[b]=i[b-X],i[b+1]=i[b+1-X],i[b+2]=i[b+2-X],i[b+3]=i[b+3-X];b=es}}t.l=E,t.p=Q,t.b=b,t.f=m,E&&(m=1,t.m=M,t.d=x,t.n=R)}while(!m);return b==i.length?i:(s=i,(null==(n=b)||n>s.length)&&(n=s.length),(a=new o(n-0)).set(s.subarray(0,n)),a)},L=new o(0),I=function(e){31==e[0]&&139==e[1]&&8==e[2]||C(6,"invalid gzip data");var t=e[3],i=10;4&t&&(i+=2+(e[10]|e[11]<<8));for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[i++]);return i+(2&t)},O=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0};function N(e,t){var i;return 31==e[0]&&139==e[1]&&8==e[2]?((i=I(e))+8>e.length&&C(6,"invalid gzip data"),R(e.subarray(i,-8),{i:2},new o(O(e)),t)):8!=(15&e[0])||e[0]>>4>7||(e[0]<<8|e[1])%31?R(e,{i:2},t,t):R(e.subarray(((8!=(15&e[0])||e[0]>>4>7||(e[0]<<8|e[1])%31)&&C(6,"invalid zlib data"),(e[1]>>5&1)==+!t&&C(6,"invalid zlib data: "+(32&e[1]?"need":"unexpected")+" dictionary"),2+(e[1]>>3&4)),-4),{i:2},t,t)}var F="undefined"!=typeof TextDecoder&&new TextDecoder;try{F.decode(L,{stream:!0})}catch(e){}var D=(e,t)=>e*s(2,t),B=(e,t)=>Math.floor(e/s(2,t)),G=(e,t)=>D(e.getUint16(t+1,!0),8)+e.getUint8(t),k=(e,t)=>D(e.getUint32(t+2,!0),16)+e.getUint16(t,!0),U=(e,t,i,r,s)=>{if(e!==r.getUint8(s))return e-r.getUint8(s);let n=G(r,s+1);if(t!==n)return t-n;let o=G(r,s+4);return i!==o?i-o:0},z=(e,t,i,r)=>{let s=j(e,t,i,r);return s?{z:t,x:i,y:r,offset:s[0],length:s[1],isDir:!1}:null},j=(e,t,i,r)=>{let s=0,n=e.byteLength/17-1;for(;s<=n;){let o=n+s>>1,a=U(t,i,r,e,17*o);if(a>0)s=o+1;else{if(!(a<0))return[k(e,17*o+7),e.getUint32(17*o+13,!0)];n=o-1}}return null},V=(e,t)=>e.isDir&&!t.isDir?1:!e.isDir&&t.isDir?-1:e.z!==t.z?e.z-t.z:e.x!==t.x?e.x-t.x:e.y-t.y,W=(e,t)=>{let i=e.getUint8(17*t);return{z:127&i,x:G(e,17*t+1),y:G(e,17*t+4),offset:k(e,17*t+7),length:e.getUint32(17*t+13,!0),isDir:i>>7==1}},$=e=>{let t=[],i=new DataView(e);for(let e=0;e<i.byteLength/17;e++)t.push(W(i,e));return H(t)},H=e=>{e.sort(V);let t=new ArrayBuffer(17*e.length),i=new Uint8Array(t);for(let t=0;t<e.length;t++){let r=e[t],s=r.z;r.isDir&&(s|=128),i[17*t]=s,i[17*t+1]=255&r.x,i[17*t+2]=r.x>>8&255,i[17*t+3]=r.x>>16&255,i[17*t+4]=255&r.y,i[17*t+5]=r.y>>8&255,i[17*t+6]=r.y>>16&255,i[17*t+7]=255&r.offset,i[17*t+8]=255&B(r.offset,8),i[17*t+9]=255&B(r.offset,16),i[17*t+10]=255&B(r.offset,24),i[17*t+11]=255&B(r.offset,32),i[17*t+12]=255&B(r.offset,48),i[17*t+13]=255&r.length,i[17*t+14]=r.length>>8&255,i[17*t+15]=r.length>>16&255,i[17*t+16]=r.length>>24&255}return t},q={getHeader:function(e){return n(this,null,function*(){let t=yield e.getBytes(0,512e3),i=new DataView(t.data),r=i.getUint32(4,!0),s=i.getUint16(8,!0),n=JSON.parse(new TextDecoder("utf-8").decode(new DataView(t.data,10,r))),o=0;"gzip"===n.compression&&(o=2);let a=0;"minzoom"in n&&(a=+n.minzoom);let l=0;"maxzoom"in n&&(l=+n.maxzoom);let h=0,u=0,c=0,d=-180,f=-85,p=180,g=85;if(n.bounds){let e=n.bounds.split(",");d=+e[0],f=+e[1],p=+e[2],g=+e[3]}if(n.center){let e=n.center.split(",");h=+e[0],u=+e[1],c=+e[2]}return{specVersion:i.getUint16(2,!0),rootDirectoryOffset:10+r,rootDirectoryLength:17*s,jsonMetadataOffset:10,jsonMetadataLength:r,leafDirectoryOffset:0,leafDirectoryLength:void 0,tileDataOffset:0,tileDataLength:void 0,numAddressedTiles:0,numTileEntries:0,numTileContents:0,clustered:!1,internalCompression:1,tileCompression:o,tileType:1,minZoom:a,maxZoom:l,minLon:d,minLat:f,maxLon:p,maxLat:g,centerZoom:c,centerLon:h,centerLat:u,etag:t.etag}})},getZxy:function(e,t,i,r,s,o,a){return n(this,null,function*(){let n=yield i.getArrayBuffer(t,e.rootDirectoryOffset,e.rootDirectoryLength,e);1===e.specVersion&&(n=$(n));let l=z(new DataView(n),r,s,o);if(l){let e=(yield t.getBytes(l.offset,l.length,a)).data,i=new DataView(e);
22return 31===i.getUint8(0)&&139===i.getUint8(1)&&(e=N(new Uint8Array(e))),{data:e}}let h=((e,t)=>{if(e.byteLength<17)return null;let i=e.byteLength/17,r=W(e,i-1);if(r.isDir){let e=r.z,i=t.z-e;return{z:e,x:Math.trunc(t.x/(1<<i)),y:Math.trunc(t.y/(1<<i))}}return null})(new DataView(n),{z:r,x:s,y:o});if(h){let l=((e,t,i,r)=>{let s=j(e,128|t,i,r);return s?{z:t,x:i,y:r,offset:s[0],length:s[1],isDir:!0}:null})(new DataView(n),h.z,h.x,h.y);if(l){let n=yield i.getArrayBuffer(t,l.offset,l.length,e);1===e.specVersion&&(n=$(n));let h=z(new DataView(n),r,s,o);if(h){let e=(yield t.getBytes(h.offset,h.length,a)).data,i=new DataView(e);return 31===i.getUint8(0)&&139===i.getUint8(1)&&(e=N(new Uint8Array(e))),{data:e}}}}})}},K=class{constructor(){var e;this.tilev4=(e,t)=>n(this,null,function*(){if("json"===e.type){let t=e.url.substr(10),i=this.tiles.get(t);i||(i=new es(t),this.tiles.set(t,i));let r=yield i.getHeader();return{data:{tiles:[`${e.url}/{z}/{x}/{y}`],minzoom:r.minZoom,maxzoom:r.maxZoom,bounds:[r.minLon,r.minLat,r.maxLon,r.maxLat]}}}let i=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),r=e.url.match(i);if(!r)throw Error("Invalid PMTiles protocol URL");let s=r[1],n=this.tiles.get(s);n||(n=new es(s),this.tiles.set(s,n));let o=r[2],a=r[3],l=r[4],h=yield n.getHeader(),u=yield null==n?void 0:n.getZxy(+o,+a,+l,t.signal);return u?{data:new Uint8Array(u.data),cacheControl:u.cacheControl,expires:u.expires}:1===h.tileType?{data:new Uint8Array}:{data:null}}),this.tile=(e=this.tilev4,(t,i)=>{if(i instanceof AbortController)return e(t,i);let r=new AbortController;return e(t,r).then(e=>i(void 0,e.data,e.cacheControl||"",e.expires||""),e=>i(e)).catch(e=>i(e)),{cancel:()=>r.abort()}}),this.tiles=new Map}add(e){this.tiles.set(e.source.getKey(),e)}get(e){return this.tiles.get(e)}};function X(e){let t=e.buf,i=t[e.pos++],r=127&i;return i<128?r:(r|=(127&(i=t[e.pos++]))<<7,i<128?r:(r|=(127&(i=t[e.pos++]))<<14,i<128?r:(r|=(127&(i=t[e.pos++]))<<21,i<128?r:function(e,t){let i=t.buf,r=i[t.pos++],s=(112&r)>>4;if(r<128||(s|=(127&(r=i[t.pos++]))<<3,r<128)||(s|=(127&(r=i[t.pos++]))<<10,r<128)||(s|=(127&(r=i[t.pos++]))<<17,r<128)||(s|=(127&(r=i[t.pos++]))<<24,r<128)||(s|=(1&(r=i[t.pos++]))<<31,r<128))return 0x100000000*(s>>>0)+(e>>>0);throw Error("Expected varint not more than 10 bytes")}(r|=(15&(i=t[e.pos]))<<28,e))))}var Y=[0,1,5,21,85,341,1365,5461,21845,87381,349525,1398101,5592405,0x1555555,0x5555555,0x15555555,0x55555555,0x155555555,0x555555555,0x1555555555,0x5555555555,0x15555555555,0x55555555555,0x155555555555,0x555555555555,0x1555555555555,0x5555555555555];function Z(e,t){return n(this,null,function*(){if(1===t||0===t)return e;if(2===t){if(void 0===globalThis.DecompressionStream)return N(new Uint8Array(e));let t=new Response(e).body;if(!t)throw Error("Failed to read response stream");return new Response(t.pipeThrough(new globalThis.DecompressionStream("gzip"))).arrayBuffer()}throw Error("Compression method not supported")})}var Q=(e=>(e[e.Unknown=0]="Unknown",e[e.Mvt=1]="Mvt",e[e.Png=2]="Png",e[e.Jpeg=3]="Jpeg",e[e.Webp=4]="Webp",e[e.Avif=5]="Avif",e))(Q||{}),J=class{constructor(e,t=new Headers){this.url=e,this.customHeaders=t,this.mustReload=!1}getKey(){return this.url}setHeaders(e){this.customHeaders=e}getBytes(e,t,i,r){return n(this,null,function*(){let s,n,o;n=i||(s=new AbortController).signal;let a=new Headers(this.customHeaders);a.set("range",`bytes=${e}-${e+t-1}`),this.mustReload&&(o="reload");let l=yield fetch(this.url,{signal:n,cache:o,headers:a});if(0===e&&416===l.status){let e=l.headers.get("Content-Range");if(!e||!e.startsWith("bytes */"))throw Error("Missing content-length on 416 response");let t=+e.substr(8);l=yield fetch(this.url,{signal:n,cache:"reload",headers:{range:"bytes=0-"+(t-1)}})}let h=l.headers.get("Etag");if((null==h?void 0:h.startsWith("W/"))&&(h=null),416===l.status||r&&h&&h!==r)throw this.mustReload=!0,new ei(r);if(l.status>=300)throw Error(`Bad response code: ${l.status}`);let u=l.headers.get("Content-Length");if(200===l.status&&(!u||+u>t))throw s&&s.abort(),Error("Server returned no content-length header or content-length exceeding request. Check that your storage backend supports HTTP Byte Serving.");return{data:yield l.arrayBuffer(),etag:h||void 0,cacheControl:l.headers.get("Cache-Control")||void 0,expires:l.headers.get("Expires")||void 0}})}};function ee(e,t){let i=e.getUint32(t+4,!0),r=e.getUint32(t+0,!0);return i*s(2,32)+r}function et(e){let t={buf:new Uint8Array(e),pos:0},i=X(t),r=[],s=0;for(let e=0;e<i;e++){let e=X(t);r.push({tileId:s+e,offset:0,length:0,runLength:1}),s+=e}for(let e=0;e<i;e++)r[e].runLength=X(t);for(let e=0;e<i;e++)r[e].length=X(t);for(let e=0;e<i;e++){let i=X(t);r[e].offset=0===i&&e>0?r[e-1].offset+r[e-1].length:i-1}return r}
22var ei=class extends Error{},er=class{constructor(e=100,t=!0,i=Z){this.cache=new Map,this.invalidations=new Map,this.maxCacheEntries=e,this.counter=1,this.decompress=i}getHeader(e){return n(this,null,function*(){let t=e.getKey(),i=this.cache.get(t);if(i)return i.lastUsed=this.counter++,yield i.data;let r=new Promise((t,i)=>{(function(e,t){return n(this,null,function*(){let i=yield e.getBytes(0,16384);if(19792!==new DataView(i.data).getUint16(0,!0))throw Error("Wrong magic number for PMTiles archive");if(3>function(e){let t=new DataView(e);return 2===t.getUint16(2,!0)?(console.warn("PMTiles spec version 2 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),2):1===t.getUint16(2,!0)?(console.warn("PMTiles spec version 1 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),1):3}(i.data))return[(yield q.getHeader(e))];let r=function(e,t){let i=new DataView(e),r=i.getUint8(7);if(r>3)throw Error(`Archive is spec version ${r} but this library supports up to spec version 3`);return{specVersion:r,rootDirectoryOffset:ee(i,8),rootDirectoryLength:ee(i,16),jsonMetadataOffset:ee(i,24),jsonMetadataLength:ee(i,32),leafDirectoryOffset:ee(i,40),leafDirectoryLength:ee(i,48),tileDataOffset:ee(i,56),tileDataLength:ee(i,64),numAddressedTiles:ee(i,72),numTileEntries:ee(i,80),numTileContents:ee(i,88),clustered:1===i.getUint8(96),internalCompression:i.getUint8(97),tileCompression:i.getUint8(98),tileType:i.getUint8(99),minZoom:i.getUint8(100),maxZoom:i.getUint8(101),minLon:i.getInt32(102,!0)/1e7,minLat:i.getInt32(106,!0)/1e7,maxLon:i.getInt32(110,!0)/1e7,maxLat:i.getInt32(114,!0)/1e7,centerZoom:i.getUint8(118),centerLon:i.getInt32(119,!0)/1e7,centerLat:i.getInt32(123,!0)/1e7,etag:t}}(i.data.slice(0,127),i.etag),s=i.data.slice(r.rootDirectoryOffset,r.rootDirectoryOffset+r.rootDirectoryLength),n=`${e.getKey()}|${r.etag||""}|${r.rootDirectoryOffset}|${r.rootDirectoryLength}`,o=et((yield t(s,r.internalCompression)));return[r,[n,o.length,o]]})})(e,this.decompress).then(e=>{e[1]&&this.cache.set(e[1][0],{lastUsed:this.counter++,data:Promise.resolve(e[1][2])}),t(e[0]),this.prune()}).catch(e=>{i(e)})});return this.cache.set(t,{lastUsed:this.counter++,data:r}),r})}getDirectory(e,t,i,r){return n(this,null,function*(){let s=`${e.getKey()}|${r.etag||""}|${t}|${i}`,o=this.cache.get(s);if(o)return o.lastUsed=this.counter++,yield o.data;let a=new Promise((s,o)=>{(function(e,t,i,r,s){return n(this,null,function*(){let n=yield e.getBytes(i,r,void 0,s.etag),o=et((yield t(n.data,s.internalCompression)));
22if(0===o.length)throw Error("Empty directory is invalid");return o})})(e,this.decompress,t,i,r).then(e=>{s(e),this.prune()}).catch(e=>{o(e)})});return this.cache.set(s,{lastUsed:this.counter++,data:a}),a})}getArrayBuffer(e,t,i,r){return n(this,null,function*(){let s=`${e.getKey()}|${r.etag||""}|${t}|${i}`,n=this.cache.get(s);if(n)return n.lastUsed=this.counter++,yield n.data;let o=new Promise((n,o)=>{e.getBytes(t,i,void 0,r.etag).then(e=>{n(e.data),this.cache.has(s),this.prune()}).catch(e=>{o(e)})});return this.cache.set(s,{lastUsed:this.counter++,data:o}),o})}prune(){if(this.cache.size>=this.maxCacheEntries){let e,t=1/0;this.cache.forEach((i,r)=>{i.lastUsed<t&&(t=i.lastUsed,e=r)}),e&&this.cache.delete(e)}}invalidate(e){return n(this,null,function*(){let t=e.getKey();if(this.invalidations.get(t))return yield this.invalidations.get(t);this.cache.delete(e.getKey());let i=new Promise((i,r)=>{this.getHeader(e).then(e=>{i(),this.invalidations.delete(t)}).catch(e=>{r(e)})});this.invalidations.set(t,i)})}},es=class{constructor(e,t,i){this.source="string"==typeof e?new J(e):e,this.decompress=i||Z,this.cache=t||new er}getHeader(){return n(this,null,function*(){return yield this.cache.getHeader(this.source)})}getZxyAttempt(e,t,i,r){return n(this,null,function*(){let n=function(e,t,i){if(e>26)throw Error("Tile zoom level exceeds max safe number limit (26)");if(t>s(2,e)-1||i>s(2,e)-1)throw Error("tile x/y outside zoom level bounds");let r=Y[e],n=0,o=0,a=0,l=[t,i],h=s(2,e)/2;for(;h>0;)n=+((l[0]&h)>0),o=+((l[1]&h)>0),a+=h*h*(3*n^o),function(e,t,i,r){if(0===r){1===i&&(t[0]=e-1-t[0],t[1]=e-1-t[1]);let r=t[0];t[0]=t[1],t[1]=r}}(h,l,n,o),h/=2;return r+a}(e,t,i),o=yield this.cache.getHeader(this.source);if(o.specVersion<3)return q.getZxy(o,this.source,this.cache,e,t,i,r);if(e<o.minZoom||e>o.maxZoom)return;let a=o.rootDirectoryOffset,l=o.rootDirectoryLength;for(let e=0;e<=3;e++){let e=function(e,t){let i=0,r=e.length-1;for(;i<=r;){let s=r+i>>1,n=t-e[s].tileId;if(n>0)i=s+1;else{if(!(n<0))return e[s];r=s-1}}return r>=0&&(0===e[r].runLength||t-e[r].tileId<e[r].runLength)?e[r]:null}((yield this.cache.getDirectory(this.source,a,l,o)),n);if(!e)return;if(e.runLength>0){let t=yield this.source.getBytes(o.tileDataOffset+e.offset,e.length,r,o.etag);return{data:yield this.decompress(t.data,o.tileCompression),cacheControl:t.cacheControl,expires:t.expires}}a=o.leafDirectoryOffset+e.offset,l=e.length}throw Error("Maximum directory depth exceeded")})}getZxy(e,t,i,r){return n(this,null,function*(){try{return yield this.getZxyAttempt(e,t,i,r)}catch(s){if(s instanceof ei)return this.cache.invalidate(this.source),yield this.getZxyAttempt(e,t,i,r);throw s}})}getMetadataAttempt(){return n(this,null,function*(){let e=yield this.cache.getHeader(this.source),t=yield this.source.getBytes(e.jsonMetadataOffset,e.jsonMetadataLength,void 0,e.etag),i=yield this.decompress(t.data,e.internalCompression);return JSON.parse(new TextDecoder("utf-8").decode(i))})}getMetadata(){return n(this,null,function*(){try{return yield this.getMetadataAttempt()}catch(e){if(e instanceof ei)return this.cache.invalidate(this.source),yield this.getMetadataAttempt();throw e}})}};let en=r.Style.getSourceType("vector"),eo="pmtile-source",ea=(e,...t)=>{for(let i of t)for(let t in i)e[t]=i[t];return e},el=e=>(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360;class eh{constructor(e,t,i){this.bounds=r.LngLatBounds.convert(this.validateBounds(e)),this.minzoom=t||0,this.maxzoom=i||24}validateBounds(e){return Array.isArray(e)&&4===e.length?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){let t=Math.pow(2,e.z),i=Math.floor((180+this.bounds.getWest())/360*t),r=Math.floor(el(this.bounds.getNorth())*t),s=Math.ceil((180+this.bounds.getEast())/360*t),n=Math.ceil(el(this.bounds.getSouth())*t);return e.x>=i&&e.x<s&&e.y>=r&&e.y<n}}class eu{constructor(e,t={}){ea(this,t),this.type=e}}class ec extends eu{constructor(e,t={}){super("error",ea({error:e},t))}}let ed=class extends en{constructor(e,t,i,r){super(e,t,i,r),this.scheme="xyz",this.roundZoom=!0,this.type="vector",this.reparseOverscaled=!0,this._loaded=!1,this._dataType="vector",this.id=e,this._dataType="vector",this.dispatcher=i,this._implementation=t,this._implementation||this.fire(new ec(Error(`Missing options for ${this.id} ${eo} source`)));let{url:s}=t;this.reparseOverscaled=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this.type="vector",this._protocol=new K,this.tiles=[`pmt
22iles://${s}/{z}/{x}/{y}`];let n=new es(s);this._protocol.add(n),this._instance=n}static async getMetadata(e){return new es(e).getMetadata()}static async getHeader(e){return new es(e).getHeader()}getExtent(){if(!this.header)return[[-180,-90],[180,90]];let{minLon:e,minLat:t,maxLon:i,maxLat:r}=this.header;return[e,t,i,r]}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}fixTile(e){e.destroy||(e.destroy=()=>{})}async load(e){return this._loaded=!1,this.fire(new eu("dataloading",{dataType:"source"})),Promise.all([this._instance.getHeader(),this._instance.getMetadata()]).then(([e,t])=>{ea(this,t),this.header=e;let{specVersion:i,clustered:r,tileType:s,minZoom:n,maxZoom:o,minLon:a,minLat:l,maxLon:h,maxLat:u,centerZoom:c,centerLon:d,centerLat:f}=e,p=[n,o,a,l,h,u];switch(p.includes(void 0)||p.includes(null)||(this.tileBounds=new eh([a,l,h,u],n,o),this.minzoom=n,this.maxzoom=o),null==this.maxzoom&&console.warn("The maxzoom parameter is not defined in the source json. This can cause memory leak. So make sure to define maxzoom in the layer"),this.minzoom=Number.parseInt(this.minzoom.toString())||0,this.maxzoom=Number.parseInt(this.maxzoom.toString())||0,this._loaded=!0,this.tileType=s,s){case Q.Png:this.contentType="image/png";break;case Q.Jpeg:this.contentType="image/jpeg";break;case Q.Webp:this.contentType="image/webp";break;case Q.Avif:this.contentType="image/avif";break;case Q.Mvt:this.contentType="application/vnd.mapbox-vector-tile"}[Q.Jpeg,Q.Png].includes(this.tileType)?(this.loadTile=this.loadRasterTile,this.type="raster"):this.tileType===Q.Mvt?(this.loadTile=this.loadVectorTile,this.type="vector"):this.fire(new ec(Error("Unsupported Tile Type"))),this.fire(new eu("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new eu("data",{dataType:"source",sourceDataType:"content"}))}).catch(t=>{this.fire(new ec(t)),e&&e(t)})}loaded(){return this._loaded}loadVectorTile(e,t){var i,r,s,n;let o=(i,r)=>{var s,n;return delete e.request,e.aborted?t(null):i&&404!==i.status?t(i):(r&&r.resourceTiming&&(e.resourceTiming=r.resourceTiming),(null==(s=this.map)?void 0:s._refreshExpiredTiles)&&r&&e.setExpiryData(r),e.loadVectorData(r,null==(n=this.map)?void 0:n.painter),t(null),void(e.reloadCallback&&(this.loadVectorTile(e,e.reloadCallback),e.reloadCallback=null)))},a=null==(i=this.map)?void 0:i._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme)),l=null==(r=this.map)?void 0:r._requestManager.transformRequest(a,"Tile"),h={request:l,data:{},uid:e.uid,tileID:e.tileID,tileZoom:e.tileZoom,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:"vector",source:this.id,scope:this.scope,showCollisionBoxes:null==(s=this.map)?void 0:s.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:e.isSymbolTile,extraShadowCaster:e.isExtraShadowCaster},u=(t,i,r,s)=>{!t&&i?(h.data={cacheControl:r,expires:s,rawData:i},this.map._refreshExpiredTiles&&e.setExpiryData({cacheControl:r,expires:s}),e.actor&&e.actor.send("loadTile",h,o.bind(this),void 0,!0)):o.call(this,t)};this.fixTile(e),e.actor&&"expired"!==e.state?"loading"===e.state?e.reloadCallback=t:e.request=this._protocol.tile({...e,url:a},u):(e.actor=this._tileWorkers[a]=this._tileWorkers[a]||(null==(n=this.dispatcher)?void 0:n.getActor()),e.request=this._protocol.tile({...l},u))}loadRasterTileData(e,t){e.setTexture(t,this.map.painter)}loadRasterTile(e,t){var i,r;let s=null==(i=this.map)?void 0:i._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme)),n=null==(r=this.map)?void 0:r._requestManager.transformRequest(s,"Tile");this.fixTile(e);let o=new AbortController;e.request={cancel:()=>o.abort()},this._protocol.tile(n,o).then((({data:i,cacheControl:r,expires:s})=>{if(delete e.request,e.aborted)return t(null);if(null==i){let i={width:this.tileSize,height:this.tileSize,data:null};return this.loadRasterTileData(e,i),e.state="loaded",t(null)}i&&i.resourceTiming&&(e.resourceTiming=i.resourceTiming),this.map._refreshExpiredTiles&&e.setExpiryData({cacheControl:r,expires:s});let n=new window.Blob([new Uint8Array(i)],{type:"image/png"});window.createImageBitmap(n).then(i=>{this.loadRasterTileData(e,i),e.state="loaded",t(null)}
22).catch(i=>(e.state="errored",t(Error(`Can't infer data type for ${this.id}, only raster data supported at the moment. ${i}`))))}).bind(this)).catch(i=>{20!==i.code&&(e.state="errored",t(i))})}};ed.SOURCE_TYPE=eo,t.PmTilesSource=ed,t.SOURCE_TYPE=eo,t.default=ed},10430:(e,t,i)=>{"use strict";i.d(t,{Ay:()=>f,bl:()=>p,rf:()=>c});var r=i(13541),s=i(27466),n=i(27645),o=i(45692),a=i(85476),l=i(74073);let h=Math.PI/180,u=180/Math.PI,c=256;class d extends s.A{constructor(e={}){let{longitude:t=0,zoom:i=0,nearZMultiplier:s=.5,farZMultiplier:n=1,resolution:a=10}=e,{latitude:l=0,height:u,altitude:d=1.5,fovy:f}=e;l=Math.max(Math.min(l,o.aH),-o.aH),u=u||1,f?d=(0,o.wZ)(f):f=(0,o.Os)(d);let g=Math.pow(2,i-p(l)),m=e.nearZ??s,_=e.farZ??(d+2*c*g/u)*n,y=new r.k().lookAt({eye:[0,-d,0],up:[0,0,1]});y.rotateX(l*h),y.rotateZ(-t*h),y.scale(g/u),super({...e,height:u,viewMatrix:y,longitude:t,latitude:l,zoom:i,distanceScales:function(){let e=c/6370972,t=Math.PI/180*c;return{unitsPerMeter:[e,e,e],unitsPerMeter2:[0,0,0],metersPerUnit:[1/e,1/e,1/e],unitsPerDegree:[t,t,e],unitsPerDegree2:[0,0,0],degreesPerUnit:[1/t,1/t,1/e]}}(),fovy:f,focalDistance:d,near:m,far:_}),this.scale=g,this.latitude=l,this.longitude=t,this.fovy=f,this.resolution=a}get projectionMode(){return n.Kx.GLOBE}getDistanceScales(){return this.distanceScales}getBounds(e={}){let t={targetZ:e.z||0},i=this.unproject([0,this.height/2],t),r=this.unproject([this.width/2,0],t),s=this.unproject([this.width,this.height/2],t),n=this.unproject([this.width/2,this.height],t);return s[0]<this.longitude&&(s[0]+=360),i[0]>this.longitude&&(i[0]-=360),[Math.min(i[0],s[0],r[0],n[0]),Math.min(i[1],s[1],r[1],n[1]),Math.max(i[0],s[0],r[0],n[0]),Math.max(i[1],s[1],r[1],n[1])]}unproject(e,{topLeft:t=!0,targetZ:i}={}){let r,[s,n,o]=e,l=t?n:this.height-n,{pixelUnprojectionMatrix:h}=this;if(Number.isFinite(o))r=g(h,[s,l,o,1]);else{let e=g(h,[s,l,-1,1]),t=g(h,[s,l,1,1]),n=((i||0)/6370972+1)*c,o=a.uE(a.jb([],e,t)),u=a.uE(e),d=a.uE(t),f=(4*u*d-(o-u-d)**2)/16*4/o,p=(Math.sqrt(u-f)-Math.sqrt(Math.max(0,n*n-f)))/Math.sqrt(o);r=a.Cc([],e,t,p)}let[u,d,f]=this.unprojectPosition(r);return Number.isFinite(o)?[u,d,f]:Number.isFinite(i)?[u,d,i]:[u,d]}projectPosition(e){let[t,i,r=0]=e,s=t*h,n=i*h,o=Math.cos(n),a=(r/6370972+1)*c;return[Math.sin(s)*o*a,-Math.cos(s)*o*a,Math.sin(n)*a]}unprojectPosition(e){let[t,i,r]=e,s=a.Il(e);return[Math.atan2(t,-i)*u,Math.asin(r/s)*u,(s/c-1)*6370972]}projectFlat(e){return e}unprojectFlat(e){return e}panByPosition([e,t,i],r,s){let n=.25/Math.pow(2,this.zoom-p(this.latitude)),a=e+n*(s[0]-r[0]),l=t-n*(s[1]-r[1]),h={longitude:a,latitude:l=Math.max(Math.min(l,o.aH),-o.aH),zoom:i-p(t)};return h.zoom+=p(h.latitude),h}}d.displayName="GlobeViewport";let f=d;function p(e){return Math.log2(Math.PI*Math.cos(e*Math.PI/180))}function g(e,t){let i=l.Z0([],t,e);return l.hs(i,i,1/i[3]),i}},10840:(e,t,i)=>{"use strict";i.d(t,{Ay:()=>b,Gw:()=>P,KI:()=>O,Q1:()=>s,Qh:()=>S,Uw:()=>o,b:()=>w,ef:()=>n});var r=i(25410);function s(){}var n=.7,o=1.4285714285714286,a="\\s*([+-]?\\d+)\\s*",l="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",h="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",u=/^#([0-9a-f]{3,8})$/,c=RegExp(`^rgb\\(${a},${a},${a}\\)$`),d=RegExp(`^rgb\\(${h},${h},${h}\\)$`),f=RegExp(`^rgba\\(${a},${a},${a},${l}\\)$`),p=RegExp(`^rgba\\(${h},${h},${h},${l}\\)$`),g=RegExp(`^hsl\\(${l},${h},${h}\\)$`),m=RegExp(`^hsla\\(${l},${h},${h},${l}\\)$`),_={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32};function y(){return this.rgb().formatHex()}function v(){return this.rgb().formatRgb()}function b(e){var t,i;return e=(e+"").trim().toLowerCase(),(t=u.exec(e))?(i=t[1].length,t=parseInt(t[1],16),6===i?E(t):3===i?new P(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===i?x(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===i?x(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=c.exec(e))?new P(t[1],t[2],t[3],1):(t=d.exec(e))?new P(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=f.exec(e))?x(t[1],t[2],t[3],t[4]):(t=p.exec(e))?x(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=g.exec(e))?L(t[1],t[2]/100,t[3]/100,1):(t=m.exec(e))?L(t[1],t[2]/100,t[3]/100,t[4]):_.hasOwnProperty(e)?E(_[e]):"transparent"===e?new P(NaN,NaN,NaN,0):null}function E(e){return new P(e>>16&255,e>>8&255,255&e,1)}function x(e,t,i,r){return r<=0&&(e=t=i=NaN),new P(e,t,i,r)}function w(e){return(e instanceof s||(e=b(e)),e)?new P((e=e.rgb()).r,e.g,e.b,e.opacity):new P}function S(e,t,i,r){return 1==arguments.length?w(e):new P(e,t,i,null==r?1:r)}function P(e,t,i,r){this.r=+e,this.g=+t,this.b=+i,this.opacity=+r}function T(){return`#${R(this.r)}${R(this.g)}${R(this.b)}`}function A(){let e=M(this.opacity);return`${1===e?"rgb(":"rgba("}${C(this.r)}, ${C(this.g)}, ${C(this.b)}${1===e?")":`, ${e})`}`}function M(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function C(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function R(e){return((e=C(e))<16?"0":"")+e.toString(16)}function L(e,t,i,r){return r<=0?e=t=i=NaN:i<=0||i>=1?e=t=NaN:t<=0&&(e=NaN),new N(e,t,i,r)}function I(e){if(e instanceof N)return new N(e.h,e.s,e.l,e.opacity);if(e instanceof s||(e=b(e)),!e)return new N;if(e instanceof N)return e;var t=(e=e.rgb()).r/255,i=e.g/255,r=e.b/255,n=Math.min(t,i,r),o=Math.max(t,i,r),a=NaN,l=o-n,h=(o+n)/2;return l?(a=t===o?(i-r)/l+(i<r)*6:i===o?(r-t)/l+2:(t-i)/l+4,l/=h<.5?o+n:2-o-n,a*=60):l=h>0&&h<1?0:a,new N(a,l,h,e.opacity)}function O(e,t,i,r){return 1==arguments.length?I(e):new N(e,t,i,null==r?1:r)}function N(e,t,i,r){this.h=+e,this.s=+t,this.l=+i,this.opacity=+r}function F(e){return(e=(e||0)%360)<0?e+360:e}function D(e){return Math.max(0,Math.min(1,e||0))}function B(e,t,i){return(e<60?t+(i-t)*e/60:e<180?i:e<240?t+(i-t)*(240-e)/60:t)*255}(0,r.A)(s,b,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:y,formatHex:y,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return I(this).formatHsl()},formatRgb:v,toString:v}),(0,r.A)(P,S,(0,r.X)(s,{brighter(e){return e=null==e?o:Math.pow(o,e),new P(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?n:Math.pow(n,e),new P(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new P(C(this.r),C(this.g),C(this.b),M(this.opacity))},displayable(){return -.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:T,formatHex:T,formatHex8:function(){return`#${R(this.r)}${R(this.g)}${R(this.b)}${R((isNaN(this.opacity)?1:this.opacity)*255)}`},formatRgb:A,toString:A})),(0,r.A)(N,O,(0,r.X)(s,{brighter(e){return e=null==e?o:Math.pow(o,e),new N(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?n:Math.pow(n,e),new N(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,i=this.l,r=i+(i<.5?i:1-i)*t,s=2*i-r;return new P(B(e>=240?e-240:e+120,s,r),B(e,s,r),B(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new N(F(this.h),D(this.s),D(this.l),M(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=M(this.opacity);return`${1===e?"hsl(":"hsla("}${F(this.h)}, ${100*D(this.s)}%, ${100*D(this.l)}%${1===e?")":`, ${e})`}`}}))},11151:(e,t,i)=>{"use strict";e.exports=s;var r=i(56783);function s(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}s.Varint=0,s.Fixed64=1,s.Bytes=2,s.Fixed32=5;var n="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");function o(e){return e.type===s.Bytes?e.readVarint()+e.pos:e.pos+1}function a(e,t,i){return i?0x100000000*t+(e>>>0):(t>>>0)*0x100000000+(e>>>0)}function l(e,t,i){var r=t<=16383?1:t<=2097151?2:t<=0xfffffff?3:Math.floor(Math.log(t)/(7*Math.LN2));i.realloc(r);for(var s=i.pos-1;s>=e;s--)i.buf[s+r]=i.buf[s]}function h(e,t){for(var i=0;i<e.length;i++)t.writeVarint(e[i])}function u(e,t){for(var i=0;i<e.length;i++)t.writeSVarint(e[i])}function c(e,t){for(var i=0;i<e.length;i++)t.writeFloat(e[i])}function d(e,t){for(var i=0;i<e.length;i++)t.writeDouble(e[i])}function f(e,t){for(var i=0;i<e.length;i++)t.writeBoolean(e[i])}function p(e,t){for(var i=0;i<e.length;i++)t.writeFixed32(e[i])}function g(e,t){for(var i=0;i<e.length;i++)t.writeSFixed32(e[i])}function m(e,t){for(var i=0;i<e.length;
22i++)t.writeFixed64(e[i])}function _(e,t){for(var i=0;i<e.length;i++)t.writeSFixed64(e[i])}function y(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+0x1000000*e[t+3]}function v(e,t,i){e[i]=t,e[i+1]=t>>>8,e[i+2]=t>>>16,e[i+3]=t>>>24}function b(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}s.prototype={destroy:function(){this.buf=null},readFields:function(e,t,i){for(i=i||this.length;this.pos<i;){var r=this.readVarint(),s=r>>3,n=this.pos;this.type=7&r,e(s,t,this),this.pos===n&&this.skip(r)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=y(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=b(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=y(this.buf,this.pos)+0x100000000*y(this.buf,this.pos+4);return this.pos+=8,e},readSFixed64:function(){var e=y(this.buf,this.pos)+0x100000000*b(this.buf,this.pos+4);return this.pos+=8,e},readFloat:function(){var e=r.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=r.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t,i,r=this.buf;return(t=127&(i=r[this.pos++]),i<128||(t|=(127&(i=r[this.pos++]))<<7,i<128||(t|=(127&(i=r[this.pos++]))<<14,i<128||(t|=(127&(i=r[this.pos++]))<<21,i<128))))?t:function(e,t,i){var r,s,n=i.buf;if(r=(112&(s=n[i.pos++]))>>4,s<128||(r|=(127&(s=n[i.pos++]))<<3,s<128)||(r|=(127&(s=n[i.pos++]))<<10,s<128)||(r|=(127&(s=n[i.pos++]))<<17,s<128)||(r|=(127&(s=n[i.pos++]))<<24,s<128)||(r|=(1&(s=n[i.pos++]))<<31,s<128))return a(e,r,t);throw Error("Expected varint not more than 10 bytes")}(t|=(15&(i=r[this.pos]))<<28,e,this)},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2==1?-((e+1)/2):e/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var e,t,i,r=this.readVarint()+this.pos,s=this.pos;return(this.pos=r,r-s>
22=12&&n)?(e=this.buf,t=s,i=r,n.decode(e.subarray(t,i))):function(e,t,i){for(var r="",s=t;s<i;){var n,o,a,l=e[s],h=null,u=l>239?4:l>223?3:l>191?2:1;if(s+u>i)break;1===u?l<128&&(h=l):2===u?(192&(n=e[s+1]))==128&&(h=(31&l)<<6|63&n)<=127&&(h=null):3===u?(n=e[s+1],o=e[s+2],(192&n)==128&&(192&o)==128&&((h=(15&l)<<12|(63&n)<<6|63&o)<=2047||h>=55296&&h<=57343)&&(h=null)):4===u&&(n=e[s+1],o=e[s+2],a=e[s+3],(192&n)==128&&(192&o)==128&&(192&a)==128&&((h=(15&l)<<18|(63&n)<<12|(63&o)<<6|63&a)<=65535||h>=1114112)&&(h=null)),null===h?(h=65533,u=1):h>65535&&(h-=65536,r+=String.fromCharCode(h>>>10&1023|55296),h=56320|1023&h),r+=String.fromCharCode(h),s+=u}return r}(this.buf,s,r)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==s.Bytes)return e.push(this.readVarint(t));var i=o(this);for(e=e||[];this.pos<i;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==s.Bytes)return e.push(this.readSVarint());var t=o(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==s.Bytes)return e.push(this.readBoolean());var t=o(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==s.Bytes)return e.push(this.readFloat());var t=o(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==s.Bytes)return e.push(this.readDouble());var t=o(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==s.Bytes)return e.push(this.readFixed32());var t=o(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==s.Bytes)return e.push(this.readSFixed32());var t=o(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==s.Bytes)return e.push(this.readFixed64());var t=o(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==s.Bytes)return e.push(this.readSFixed64());var t=o(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=7&e;if(t===s.Varint)for(;this.buf[this.pos++]>127;);else if(t===s.Bytes)this.pos=this.readVarint()+this.pos;else if(t===s.Fixed32)this.pos+=4;else if(t===s.Fixed64)this.pos+=8;else throw Error("Unimplemented type: "+t)},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var i=new Uint8Array(t);i.set(this.buf),this.buf=i,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),v(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),v(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),v(this.buf,-1&e,this.pos),v(this.buf,Math.floor(23283064365386963e-26*e),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),v(this.buf,-1&e,this.pos),v(this.buf,Math.floor(23283064365386963e-26*e),this.pos+4),this.pos+=8},writeVarint:function(e){if((e=+e||0)>0xfffffff||e<0)return void function(e,t){var i,r,s,n,o;if(e>=0?(i=e%0x100000000|0,r=e/0x100000000|0):(i=~(-e%0x100000000),r=~(-e/0x100000000),0xffffffff^i?i=i+1|0:(i=0,r=r+1|0)),e>=0xffffffffffffffff||e<-0xffffffffffffffff)throw Error("Given varint doesn't fit into 10 bytes");t.realloc(10),s=i,n=0,(o=t).buf[o.pos++]=127&s|128,s>>>=7,o.buf[o.pos++]=127&s|128,s>>>=7,o.buf[o.pos++]=127&s|128,s>>>=7,o.buf[o.pos++]=127&s|128,s>>>=7,o.buf[o.pos]=127&s,function(e,t){var i=(7&e)<<4;if(t.buf[t.pos++]|=i|128*!!(e>>>=3),e&&(t.buf[t.pos++]=127&e|128*!!(e>>>=7),e)&&(t.buf[t.pos++]=127&e|128*!!(e>>>=7),e))t.buf[t.pos++]=127&e|128*!!(e>>>=7),e&&(t.buf[t.pos++]=127&e|128*!!(e>>>=7),e&&(t.buf[t.pos++]=127&e))}(r,t)}(e,this);if(this.realloc(4),this.buf[this.pos++]=127&e|128*(e>127),!(e<=127))this.buf[this.pos++]=127&(e>>>=7)|128*(e>127),!(e<=127)&&(this.buf[this.pos++]=127&(e>>>=7)|128*(e>127),e<=127||(this.buf[this.pos++]=e>>>7&127))},writeSVarint:function(e){this.writeVarint(e<0?-(2*e)-1:2*e)},writeBoolean:function(e){this.writeVarint(!!e)},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=function(e,t,i){for(var r,s,n=0;n<t.length;n++){if((r=t.charCodeAt(n))>55295&&r<57344)if(s)if(r<56320){e[i++]=239,e[i++]=191,e[i++]=189,s=r;continue}else r=s-55296<<10|r-56320|65536,s=null;else{r>56319||n+1===t.length?(e[i++]=239,e[i++]=191,e[i++]=189):s=r;continue}else s&&(e[i++]=239,e[i++]=191,e[i++]=189,s=null);r<128?e[i++]=r:(r<2048?e[i++]=r>>6|192:(r<65536?e[i++]=r>>12|224:(e[i++]=r>>18|240,e[i++]=r>>12&63|128),e[i++]=r>>6&63|128),e[i++]=63&r|128)}return i}(this.buf,e,this.pos);var i=this.pos-t;i>=128&&l(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i},writeFloat:function(e){this.realloc(4),r.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),r.write(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var i=0;i<t;i++)this.buf[this.pos++]=e[i]},writeRawMessage:function(e,t){this.pos++;var i=this.pos;e(t,this);var r=this.pos-i;r>=128&&l(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,t,i){this.writeTag(e,s.Bytes),this.writeRawMessage(t,i)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,h,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,u,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,f,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,c,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,d,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,p,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,g,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,m,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,_,t)},writeBytesField:function(e,t){this.writeTag(e,s.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,s.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,s.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,s.Fixed64),this.writeFixed64
22(t)},writeSFixed64Field:function(e,t){this.writeTag(e,s.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,s.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,s.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,s.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,s.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,s.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,!!t)}}},12286:e=>{"use strict";function t(e,t,u){u=u||2;var c,p,m,_,y,v,b,E=t&&t.length,x=E?t[0]*u:e.length,w=i(e,0,x,u,!0),S=[];if(!w||w.next===w.prev)return S;if(E&&(w=function(e,t,n,l){var h,u,c,p,g,m=[];for(h=0,u=t.length;h<u;h++)c=t[h]*l,p=h<u-1?t[h+1]*l:e.length,(g=i(e,c,p,l,!1))===g.next&&(g.steiner=!0),m.push(function(e){var t=e,i=e;do(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next;while(t!==e);return i}(g));for(m.sort(s),h=0;h<m.length;h++)n=function(e,t){var i=function(e,t){var i,r,s,n=t,l=e.x,h=e.y,u=-1/0;do{if(h<=n.y&&h>=n.next.y&&n.next.y!==n.y){var c=n.x+(h-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(c<=l&&c>u&&(u=c,s=n.x<n.next.x?n:n.next,c===l))return s}n=n.next}while(n!==t);if(!s)return null;var f,p=s,g=s.x,m=s.y,_=1/0;n=s;do{l>=n.x&&n.x>=g&&l!==n.x&&o(h<m?l:u,h,g,m,h<m?u:l,h,n.x,n.y)&&(f=Math.abs(h-n.y)/(l-n.x),d(n,e)&&(f<_||f===_&&(n.x>s.x||n.x===s.x&&(i=s,r=n,0>a(i.prev,i,r.prev)&&0>a(r.next,i,i.next))))&&(s=n,_=f)),n=n.next}while(n!==p);return s}(e,t);if(!i)return t;var s=f(i,e);return r(s,s.next),r(i,i.next)}(m[h],n);return n}(e,t,w,u)),e.length>80*u){c=m=e[0],p=_=e[1];for(var P=u;P<x;P+=u)y=e[P],v=e[P+1],y<c&&(c=y),v<p&&(p=v),y>m&&(m=y),v>_&&(_=v);b=0!==(b=Math.max(m-c,_-p))?32767/b:0}return function e(t,i,s,u,c,p,m){if(t){!m&&p&&function(e,t,i,r){var s=e;do 0===s.z&&(s.z=n(s.x,s.y,t,i,r)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==e);s.prevZ.nextZ=null,s.prevZ=null,function(e){var t,i,r,s,n,o,a,l,h=1;do{for(i=e,e=null,n=null,o=0;i;){for(o++,r=i,a=0,t=0;t<h&&(a++,r=r.nextZ);t++);for(l=h;a>0||l>0&&r;)0!==a&&(0===l||!r||i.z<=r.z)?(s=i,i=i.nextZ,a--):(s=r,r=r.nextZ,l--),n?n.nextZ=s:e=s,s.prevZ=n,n=s;i=r}n.nextZ=null,h*=2}while(o>1)}(s)}(t,u,c,p);for(var _,y,v=t;t.prev!==t.next;){if(_=t.prev,y=t.next,p?function(e,t,i,r){var s=e.prev,l=e.next;if(a(s,e,l)>=0)return!1;for(var h=s.x,u=e.x,c=l.x,d=s.y,f=e.y,p=l.y,g=h<u?h<c?h:c:u<c?u:c,m=d<f?d<p?d:p:f<p?f:p,_=h>u?h>c?h:c:u>c?u:c,y=d>f?d>p?d:p:f>p?f:p,v=n(g,m,t,i,r),b=n(_,y,t,i,r),E=e.prevZ,x=e.nextZ;E&&E.z>=v&&x&&x.z<=b;){if(E.x>=g&&E.x<=_&&E.y>=m&&E.y<=y&&E!==s&&E!==l&&o(h,d,u,f,c,p,E.x,E.y)&&a(E.prev,E,E.next)>=0||(E=E.prevZ,x.x>=g&&x.x<=_&&x.y>=m&&x.y<=y&&x!==s&&x!==l&&o(h,d,u,f,c,p,x.x,x.y)&&a(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;E&&E.z>=v;){if(E.x>=g&&E.x<=_&&E.y>=m&&E.y<=y&&E!==s&&E!==l&&o(h,d,u,f,c,p,E.x,E.y)&&a(E.prev,E,E.next)>=0)return!1;E=E.prevZ}for(;x&&x.z<=b;){if(x.x>=g&&x.x<=_&&x.y>=m&&x.y<=y&&x!==s&&x!==l&&o(h,d,u,f,c,p,x.x,x.y)&&a(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}(t,u,c,p):function(e){var t=e.prev,i=e.next;if(a(t,e,i)>=0)return!1;for(var r=t.x,s=e.x,n=i.x,l=t.y,h=e.y,u=i.y,c=r<s?r<n?r:n:s<n?s:n,d=l<h?l<u?l:u:h<u?h:u,f=r>s?r>n?r:n:s>n?s:n,p=l>h?l>u?l:u:h>u?h:u,g=i.next;g!==t;){if(g.x>=c&&g.x<=f&&g.y>=d&&g.y<=p&&o(r,l,s,h,n,u,g.x,g.y)&&a(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}(t)){i.push(_.i/s|0),i.push(t.i/s|0),i.push(y.i/s|0),g(t),t=y.next,v=y.next;continue}if((t=y)===v){m?1===m?e(t=function(e,t,i){var s=e;do{var n=s.prev,o=s.next.next;!l(n,o)&&h(n,s,s.next,o)&&d(n,o)&&d(o,n)&&(t.push(n.i/i|0),t.push(s.i/i|0),t.push(o.i/i|0),g(s),g(s.next),s=e=o),s=s.next}while(s!==e);return r(s)}(r(t),i,s),i,s,u,c,p,2):2===m&&function(t,i,s,n,o,u){var c=t;do{for(var p,g,m=c.next.next;m!==c.prev;){if(c.i!==m.i&&(p=c,g=m,p.next.i!==g.i&&p.prev.i!==g.i&&!function(e,t){var i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&h(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(p,g)&&(d(p,g)&&d(g,p)&&function(e,t){var i=e,r=!1,s=(e.x+t.x)/2,n=(e.y+t.y)/2;do i.y>n!=i.next.y>n&&i.next.y!==i.y&&s<(i.next.x-i.x)*(n-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next;while(i!==e);return r}(p,g)&&(a(p.prev,p,g.prev)||a(p,g.prev,g))||l(p,g)&&a(p.prev,p,p.next)>0&&a(g.prev,g,g.next)>0))){var _=f(c,m);c=r(c,c.next),_=r(_,_.next),e(c,i,s,n,o,u,0),e(_,i,s,n,o,u,0);return}m=m.next}c=c.next}while(c!==t)}(t,i,s,u,c,p):e(r(t),i,s,u,c,p,1);break}}}}(w,S,u,c,p,b,0),S}function i(e,t,i,r,s){var n,o;if(s===_(e,t,i,r)>0)for(n=t;n<i;
22n+=r)o=p(n,e[n],e[n+1],o);else for(n=i-r;n>=t;n-=r)o=p(n,e[n],e[n+1],o);return o&&l(o,o.next)&&(g(o),o=o.next),o}function r(e,t){if(!e)return e;t||(t=e);var i,r=e;do if(i=!1,!r.steiner&&(l(r,r.next)||0===a(r.prev,r,r.next))){if(g(r),(r=t=r.prev)===r.next)break;i=!0}else r=r.next;while(i||r!==t);return t}function s(e,t){return e.x-t.x}function n(e,t,i,r,s){return(e=((e=((e=((e=((e=(e-i)*s|0)|e<<8)&0xff00ff)|e<<4)&0xf0f0f0f)|e<<2)&0x33333333)|e<<1)&0x55555555)|(t=((t=((t=((t=((t=(t-r)*s|0)|t<<8)&0xff00ff)|t<<4)&0xf0f0f0f)|t<<2)&0x33333333)|t<<1)&0x55555555)<<1}function o(e,t,i,r,s,n,o,a){return(s-o)*(t-a)>=(e-o)*(n-a)&&(e-o)*(r-a)>=(i-o)*(t-a)&&(i-o)*(n-a)>=(s-o)*(r-a)}function a(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function l(e,t){return e.x===t.x&&e.y===t.y}function h(e,t,i,r){var s=c(a(e,t,i)),n=c(a(e,t,r)),o=c(a(i,r,e)),l=c(a(i,r,t));return!!(s!==n&&o!==l||0===s&&u(e,i,t)||0===n&&u(e,r,t)||0===o&&u(i,e,r)||0===l&&u(i,t,r))}function u(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function c(e){return e>0?1:e<0?-1:0}function d(e,t){return 0>a(e.prev,e,e.next)?a(e,t,e.next)>=0&&a(e,e.prev,t)>=0:0>a(e,t,e.prev)||0>a(e,e.next,t)}function f(e,t){var i=new m(e.i,e.x,e.y),r=new m(t.i,t.x,t.y),s=e.next,n=t.prev;return e.next=t,t.prev=e,i.next=s,s.prev=i,r.next=i,i.prev=r,n.next=r,r.prev=n,r}function p(e,t,i,r){var s=new m(e,t,i);return r?(s.next=r.next,s.prev=r,r.next.prev=s,r.next=s):(s.prev=s,s.next=s),s}function g(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function m(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function _(e,t,i,r){for(var s=0,n=t,o=i-r;n<i;n+=r)s+=(e[o]-e[n])*(e[n+1]+e[o+1]),o=n;return s}e.exports=t,e.exports.default=t,t.deviation=function(e,t,i,r){var s=t&&t.length,n=s?t[0]*i:e.length,o=Math.abs(_(e,0,n,i));if(s)for(var a=0,l=t.length;a<l;a++){var h=t[a]*i,u=a<l-1?t[a+1]*i:e.length;o-=Math.abs(_(e,h,u,i))}var c=0;for(a=0;a<r.length;a+=3){var d=r[a]*i,f=r[a+1]*i,p=r[a+2]*i;c+=Math.abs((e[d]-e[p])*(e[f+1]-e[d+1])-(e[d]-e[f])*(e[p+1]-e[d+1]))}return 0===o&&0===c?0:Math.abs((c-o)/o)},t.flatten=function(e){for(var t=e[0][0].length,i={vertices:[],holes:[],dimensions:t},r=0,s=0;s<e.length;s++){for(var n=0;n<e[s].length;n++)for(var o=0;o<t;o++)i.vertices.push(e[s][n][o]);s>0&&(r+=e[s-1].length,i.holes.push(r))}return i}},12388:(e,t,i)=>{"use strict";i.d(t,{E1:()=>o,S3:()=>n,by:()=>s});let r=/\?.*/;function s(e){let t=e.match(r);return t&&t[0]}function n(e){return e.replace(r,"")}function o(e){if(e.length<50)return e;let t=e.slice(e.length-15),i=e.substr(0,32);return`${i}...${t}`}},13324:(e,t,i)=>{"use strict";i.d(t,{sf:()=>s,sv:()=>n});let r="compositeBands",s={name:r,inject:{"fs:#decl":` 23uniform sampler2D band0; 24uniform sampler2D band1; 25uniform sampler2D band2; 26uniform sampler2D band3; 27 28vec2 compositeBands_applyUv(vec2 uv, vec4 transform) { 29 return uv * transform.zw + transform.xy; 30} 31 32float compositeBands_sampleSlot(int slot, vec2 uv) { 33 if (slot == 0) return texture(band0, compositeBands_applyUv(uv, ${r}.uvTransform0)).r; 34 if (slot == 1) return texture(band1, compositeBands_applyUv(uv, ${r}.uvTransform1)).r; 35 if (slot == 2) return texture(band2, compositeBands_applyUv(uv, ${r}.uvTransform2)).r; 36 if (slot == 3) return texture(band3, compositeBands_applyUv(uv, ${r}.uvTransform3)).r; 37 return 0.0; 38} 39`,"fs:DECKGL_FILTER_COLOR":` 40 float r = ${r}.channelMap.r >= 0 ? compositeBands_sampleSlot(${r}.channelMap.r, geometry.uv) : 0.0; 41 float g = ${r}.channelMap.g >= 0 ? compositeBands_sampleSlot(${r}.channelMap.g, geometry.uv) : 0.0; 42 float b = ${r}.channelMap.b >= 0 ? compositeBands_sampleSlot(${r}.channelMap.b, geometry.uv) : 0.0; 43 float a = ${r}.channelMap.a >= 0 ? compositeBands_sampleSlot(${r}.channelMap.a, geometry.uv) : 1.0; 44 color = vec4(r, g, b, a); 45`},fs:`\ 46uniform ${r}Uniforms { 47 vec4 uvTransform0; 48 vec4 uvTransform1; 49 vec4 uvTransform2; 50 vec4 uvTransform3; 51 ivec4 channelMap; 52} ${r}; 53`,uniformTypes:{uvTransform0:"vec4<f32>",uvTransform1:"vec4<f32>",uvTransform2:"vec4<f32>",uvTransform3:"vec4<f32>",channelMap:"vec4<i32>"},getUniforms:e=>({band0:e.band0,band1:e.band1,band2:e.band2,band3:e.band3,uvTransform0:e.uvTransform0??[0,0,1,1],uvTransform1:e.uvTransform1??[0,0,1,1],uvTransform2:e.uvTransform2??[0,0,1,1],uvTransform3:e.uvTransform3??[0,0,1,1],channelMap:e.channelMap??[0,1,2,-1]})};function n(e,t){let i=[],r=new Map;for(let t of[e.r,e.g,e.b,e.a])if(t&&!r.has(t)){if(i.length>=4)throw Error("CompositeBands supports at most 4 band slots");r.set(t,i.length),i.push(t)}function s(e){return e?r.get(e)??-1:-1}let n={channelMap:[s(e.r),s(e.g),s(e.b),s(e.a)]},o=i[0];if(!o)throw Error("At least one band is required");let a=t.get(o).texture;for(let[e,i]of r){let r=t.get(e);if(!r)throw Error(`Band "${e}" not found in fetched bands`);n[`band${i}`]=r.texture,n[`uvTransform${i}`]=r.uvTransform}for(let e=i.length;e<4;e++)n[`band${e}`]=a;return n}},19277:(e,t,i)=>{"use strict";i.d(t,{b:()=>function e(t,i,r){if(t===i)return!0;
53if(!r||!t||!i)return!1;if(Array.isArray(t)){if(!Array.isArray(i)||t.length!==i.length)return!1;for(let s=0;s<t.length;s++)if(!e(t[s],i[s],r-1))return!1;return!0}if(Array.isArray(i))return!1;if("object"==typeof t&&"object"==typeof i){let s=Object.keys(t),n=Object.keys(i);if(s.length!==n.length)return!1;for(let n of s)if(!i.hasOwnProperty(n)||!e(t[n],i[n],r-1))return!1;return!0}return!1}})},20430:(e,t,i)=>{"use strict";i.d(t,{L:()=>s});var r=i(60154);class s extends r.F{static defaultProps={...r.F.defaultProps,type:"color-sampler",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"nearest",minFilter:"nearest",mipmapFilter:"none",lodMinClamp:0,lodMaxClamp:32,compare:"less-equal",maxAnisotropy:1};get[Symbol.toStringTag](){return"Sampler"}constructor(e,t){super(e,t=s.normalizeProps(e,t),s.defaultProps)}static normalizeProps(e,t){return t}}},24365:(e,t,i)=>{"use strict";function r(e,t,i,r,s){var n=e*e,o=n*e;return((1-3*e+3*n-o)*t+(4-6*n+3*o)*i+(1+3*e+3*n-3*o)*r+o*s)/6}function s(e){var t=e.length-1;return function(i){var s=i<=0?i=0:i>=1?(i=1,t-1):Math.floor(i*t),n=e[s],o=e[s+1],a=s>0?e[s-1]:2*n-o,l=s<t-1?e[s+2]:2*o-n;return r((i-s/t)*t,a,n,o,l)}}i.d(t,{A:()=>s,H:()=>r})},25410:(e,t,i)=>{"use strict";function r(e,t,i){e.prototype=t.prototype=i,i.constructor=e}function s(e,t){var i=Object.create(e.prototype);for(var r in t)i[r]=t[r];return i}i.d(t,{A:()=>r,X:()=>s})},26785:e=>{"use strict";e.exports=function e(t,i){if(t===i)return!0;if(t&&i&&"object"==typeof t&&"object"==typeof i){if(t.constructor!==i.constructor)return!1;if(Array.isArray(t)){if((r=t.length)!=i.length)return!1;for(s=r;0!=s--;)if(!e(t[s],i[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===i.source&&t.flags===i.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===i.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===i.toString();if((r=(n=Object.keys(t)).length)!==Object.keys(i).length)return!1;for(s=r;0!=s--;)if(!Object.prototype.hasOwnProperty.call(i,n[s]))return!1;for(s=r;0!=s--;){var r,s,n,o=n[s];if(!e(t[o],i[o]))return!1}return!0}return t!=t&&i!=i}},29288:(e,t,i)=>{"use strict";function r(e){let t=h[n(e)];if(!t)throw Error(`Unsupported variable shader type: ${e}`);return t}i.d(t,{Co:()=>o,k0:()=>r,si:()=>n});class s{getVariableShaderTypeInfo(e){return r(e)}getAttributeShaderTypeInfo(e){let t=l[function(e){return u[e]||e}(e)];if(!t)throw Error(`Unsupported attribute shader type: ${e}`);let[i,r]=t,s=a[i]*r;return{primitiveType:i,components:r,byteLength:s,integer:"i32"===i||"u32"===i,signed:"u32"!==i}}makeShaderAttributeType(e,t){var i,r;return i=e,1===(r=t)?i:`vec${r}<${i}>`}resolveAttributeShaderTypeAlias(e){var t;return u[t=e]||t}resolveVariableShaderTypeAlias(e){return n(e)}}function n(e){return c[e]||e}let o=new s,a={f32:4,f16:2,i32:4,u32:4},l={f32:["f32",1],"vec2<f32>":["f32",2],"vec3<f32>":["f32",3],"vec4<f32>":["f32",4],f16:["f16",1],"vec2<f16>":["f16",2],"vec3<f16>":["f16",3],"vec4<f16>":["f16",4],i32:["i32",1],"vec2<i32>":["i32",2],"vec3<i32>":["i32",3],"vec4<i32>":["i32",4],u32:["u32",1],"vec2<u32>":["u32",2],"vec3<u32>":["u32",3],"vec4<u32>":["u32",4]},h={f32:{type:"f32",components:1},f16:{type:"f16",components:1},i32:{type:"i32",components:1},u32:{type:"u32",components:1},"vec2<f32>":{type:"f32",components:2},"vec3<f32>":{type:"f32",components:3},"vec4<f32>":{type:"f32",components:4},"vec2<f16>":{type:"f16",components:2},"vec3<f16>":{type:"f16",components:3},"vec4<f16>":{type:"f16",components:4},"vec2<i32>":{type:"i32",components:2},"vec3<i32>":{type:"i32",components:3},"vec4<i32>":{type:"i32",components:4},"vec2<u32>":{type:"u32",components:2},"vec3<u32>":{type:"u32",components:3},"vec4<u32>":{type:"u32",components:4},"mat2x2<f32>":{type:"f32",components:4},"mat2x3<f32>":{type:"f32",components:6},"mat2x4<f32>":{type:"f32",components:8},"mat3x2<f32>":{type:"f32",components:6},"mat3x3<f32>":{type:"f32",components:9},"mat3x4<f32>":{type:"f32",components:12},"mat4x2<f32>":{type:"f32",components:8},"mat4x3<f32>":{type:"f32",components:12},"mat4x4<f32>":{type:"f32",components:16},"mat2x2<f16>":{type:"f16",components:4},"mat2x3<f16>
53":{type:"f16",components:6},"mat2x4<f16>":{type:"f16",components:8},"mat3x2<f16>":{type:"f16",components:6},"mat3x3<f16>":{type:"f16",components:9},"mat3x4<f16>":{type:"f16",components:12},"mat4x2<f16>":{type:"f16",components:8},"mat4x3<f16>":{type:"f16",components:12},"mat4x4<f16>":{type:"f16",components:16},"mat2x2<i32>":{type:"i32",components:4},"mat2x3<i32>":{type:"i32",components:6},"mat2x4<i32>":{type:"i32",components:8},"mat3x2<i32>":{type:"i32",components:6},"mat3x3<i32>":{type:"i32",components:9},"mat3x4<i32>":{type:"i32",components:12},"mat4x2<i32>":{type:"i32",components:8},"mat4x3<i32>":{type:"i32",components:12},"mat4x4<i32>":{type:"i32",components:16},"mat2x2<u32>":{type:"u32",components:4},"mat2x3<u32>":{type:"u32",components:6},"mat2x4<u32>":{type:"u32",components:8},"mat3x2<u32>":{type:"u32",components:6},"mat3x3<u32>":{type:"u32",components:9},"mat3x4<u32>":{type:"u32",components:12},"mat4x2<u32>":{type:"u32",components:8},"mat4x3<u32>":{type:"u32",components:12},"mat4x4<u32>":{type:"u32",components:16}},u={vec2i:"vec2<i32>",vec3i:"vec3<i32>",vec4i:"vec4<i32>",vec2u:"vec2<u32>",vec3u:"vec3<u32>",vec4u:"vec4<u32>",vec2f:"vec2<f32>",vec3f:"vec3<f32>",vec4f:"vec4<f32>",vec2h:"vec2<f16>",vec3h:"vec3<f16>",vec4h:"vec4<f16>"},c={vec2i:"vec2<i32>",vec3i:"vec3<i32>",vec4i:"vec4<i32>",vec2u:"vec2<u32>",vec3u:"vec3<u32>",vec4u:"vec4<u32>",vec2f:"vec2<f32>",vec3f:"vec3<f32>",vec4f:"vec4<f32>",vec2h:"vec2<f16>",vec3h:"vec3<f16>",vec4h:"vec4<f16>",mat2x2f:"mat2x2<f32>",mat2x3f:"mat2x3<f32>",mat2x4f:"mat2x4<f32>",mat3x2f:"mat3x2<f32>",mat3x3f:"mat3x3<f32>",mat3x4f:"mat3x4<f32>",mat4x2f:"mat4x2<f32>",mat4x3f:"mat4x3<f32>",mat4x4f:"mat4x4<f32>",mat2x2i:"mat2x2<i32>",mat2x3i:"mat2x3<i32>",mat2x4i:"mat2x4<i32>",mat3x2i:"mat3x2<i32>",mat3x3i:"mat3x3<i32>",mat3x4i:"mat3x4<i32>",mat4x2i:"mat4x2<i32>",mat4x3i:"mat4x3<i32>",mat4x4i:"mat4x4<i32>",mat2x2u:"mat2x2<u32>",mat2x3u:"mat2x3<u32>",mat2x4u:"mat2x4<u32>",mat3x2u:"mat3x2<u32>",mat3x3u:"mat3x3<u32>",mat3x4u:"mat3x4<u32>",mat4x2u:"mat4x2<u32>",mat4x3u:"mat4x3<u32>",mat4x4u:"mat4x4<u32>",mat2x2h:"mat2x2<f16>",mat2x3h:"mat2x3<f16>",mat2x4h:"mat2x4<f16>",mat3x2h:"mat3x2<f16>",mat3x3h:"mat3x3<f16>",mat3x4h:"mat3x4<f16>",mat4x2h:"mat4x2<f16>",mat4x3h:"mat4x3<f16>",mat4x4h:"mat4x4<f16>"}},29642:(e,t,i)=>{"use strict";i.d(t,{r:()=>s});class r{getDataTypeInfo(e){let[t,i,r]=n[e],s=e.includes("norm"),o=!s&&!e.startsWith("float");return{signedType:t,primitiveType:i,byteLength:r,normalized:s,integer:o,signed:e.startsWith("s")}}getNormalizedDataType(e){switch(e){case"uint8":return"unorm8";case"sint8":return"snorm8";case"uint16":return"unorm16";case"sint16":return"snorm16";default:return e}}alignTo(e,t){switch(t){case 1:return e;case 2:return e+e%2;default:return e+(4-e%4)%4}}getDataType(e){let t=ArrayBuffer.isView(e)?e.constructor:e;if(t===Uint8ClampedArray)return"uint8";let i=Object.values(n).find(e=>t===e[4]);if(!i)throw Error(t.name);return i[0]}getTypedArrayConstructor(e){let[,,,,t]=n[e];return t}}let s=new r,n={uint8:["uint8","u32",1,!1,Uint8Array],sint8:["sint8","i32",1,!1,Int8Array],unorm8:["uint8","f32",1,!0,Uint8Array],snorm8:["sint8","f32",1,!0,Int8Array],uint16:["uint16","u32",2,!1,Uint16Array],sint16:["sint16","i32",2,!1,Int16Array],unorm16:["uint16","u32",2,!0,Uint16Array],snorm16:["sint16","i32",2,!0,Int16Array],float16:["float16","f16",2,!1,Uint16Array],float32:["float32","f32",4,!1,Float32Array],uint32:["uint32","u32",4,!1,Uint32Array],sint32:["sint32","i32",4,!1,Int32Array]}},29884:(e,t,i)=>{"use strict";function r(e){let t=e.luma||{_polyfilled:!1,extensions:{},softwareRenderer:!1};return t._polyfilled??=!1,t.extensions||={},e.luma=t,t}i.d(t,{V:()=>r})},29929:(e,t,i)=>{"use strict";let r;function s(e){return(!r||r.byteLength<e)&&(r=new ArrayBuffer(e)),r}function n(e,t){let i=s(e.BYTES_PER_ELEMENT*t);return new e(i,0,t)}i.d(t,{X:()=>n,o:()=>s})},30971:(e,t,i)=>{"use strict";i.d(t,{vz:()=>u});var r=i(29642),s=i(61899);let n=/^(r|rg|rgb|rgba|bgra)([0-9]*)([a-z]*)(-srgb)?(-webgl)?$/,o=["rgb","rgba","bgra"],a=["depth","stencil"],l=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"];class h{isColor(e){return o.some(t=>e.startsWith(t))}isDepthStencil(e){return a.some(t=>e.startsWith(t))}isCompressed(e){return l.some(t=>e.startsWith(t))}getInfo(e){return c(e)}getCapabilities(e){return function(e){let t=(0,s.qG)(e),i={format:e,create:t.f??!0,render:t.render??!0,filter:t.filter??!0,blend:t.blend??!0,store:t.store??!0},r=c(e),n=e.startsWith("depth")||e.startsWith("stencil"),o=r?.signed,a=r?.integer,l=r?.webgl,h=!!r?.compressed;return i.render&&=!n&&!h,i.filter&&=!n&&!o&&!a&&!l,i}(e)}computeMemoryLayout(e){return function({format:e,width:t,height:i,depth:r,byteAlignment:s}){let{bytesPerPixel:n,bytesPerBlock:o=n,blockWidth:a=1,blockHeight:l=1,compressed:h=!1}=u.getInfo(e),c=h?Math.ceil(t/a):t,d=h?Math.ceil(i/l):i,f=Math.ceil(c*o/s)*s;return{bytesPerPixel:n,bytesPerRow:f,rowsPerImage:d,depthOrArrayLayers:r,bytesPerImage:f*d,byteLength:f*d*r}}(e)}}let u=new h;function c(e){let t=function(e){let t=(0,s.qG)(e),i=t.bytesPerPixel||1,r=t.bitsPerChannel||[8,8,8,8];return delete t.bitsPerChannel,delete t.bytesPerPixel,delete t.f,delete t.render,delete t.filter,delete t.blend,delete t.store,{...t,format:e,attachment:t.attachment||"color",channels:t.channels||"r",components:t.components||t.channels?.length||1,bytesPerPixel:i,bitsPerChannel:r,dataType:t.dataType||"uint8",srgb:t.srgb??!1,packed:t.packed??!1,webgl:t.webgl??!1,integer:t.integer??!1,signed:t.signed??!1,normalized:t.normalized??!1,compressed:t.compressed??!1}}(e);if(u.isCompressed(e)){var i;t.channels="rgb",t.components=3,t.bytesPerPixel=1,t.srgb=!1,t.compressed=!0,t.bytesPerBlock=(i=e).startsWith("bc1")||i.startsWith("bc4")||i.startsWith("etc1")||i.startsWith("etc2-rgb8")||i.startsWith("etc2-rgb8a1")||i.startsWith("eac-r11")||"atc-rgb-unorm-webgl"===i?8:i.startsWith("bc2")||i.startsWith("bc3")||i.startsWith("bc5")||i.startsWith("bc6h")||i.startsWith("bc7")||i.startsWith("etc2-rgba8")||i.startsWith("eac-rg11")||i.startsWith("astc")||"atc-rgba-unorm-webgl"===i||"atc-rgbai-unorm-webgl"===i?16:i.startsWith("pvrtc")?8:16;let r=function(e){let t=/.*-(\d+)x(\d+)-.*/.exec(e);if(t){let[,e,i]=t;return{blockWidth:Number(e),blockHeight:Number(i)}}return e.startsWith("bc")||e.startsWith("etc1")||e.startsWith("etc2")||e.startsWith("eac")||e.startsWith("atc")||e.startsWith("pvrtc-rgb4")||e.startsWith("pvrtc-rgba4")?{blockWidth:4,blockHeight:4}:e.startsWith("pvrtc-rgb2")||e.startsWith("pvrtc-rgba2")?{blockWidth:8,blockHeight:4}:null}(e);r&&(t.blockWidth=r.blockWidth,t.blockHeight=r.blockHeight)}let o=t.packed?null:n.exec(e);if(o){let[,i,s,n,a,l]=o,h=`${n}${s}`,u=r.r.getDataTypeInfo(h),c=8*u.byteLength,d=i?.length??1;t={format:e,attachment:t.attachment,dataType:u.signedType,components:d,channels:i,integer:u.integer,signed:u.signed,normalized:u.normalized,bitsPerChannel:[c,d>=2?c:0,d>=3?c:0,d>=4?c:0],bytesPerPixel:u.byteLength*d,packed:t.packed,srgb:t.srgb},"-webgl"===l&&(t.webgl=!0),"-srgb"===a&&(t.srgb=!0)}return e.endsWith("-webgl")&&(t.webgl=!0),e.endsWith("-srgb")&&(t.srgb=!0),t}},32845:(e,t,i)=>{e.exports.VectorTile=i(62760),i(75278),i(77513)},33086:(e,t,i)=>{"use strict";i.d(t,{A:()=>r});
53class r{constructor(e){this._inProgress=!1,this._handle=null,this.time=0,this.settings={duration:0},this._timeline=e}get inProgress(){return this._inProgress}start(e){this.cancel(),this.settings=e,this._inProgress=!0,this.settings.onStart?.(this)}end(){this._inProgress&&(this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1,this.settings.onEnd?.(this))}cancel(){this._inProgress&&(this.settings.onInterrupt?.(this),this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1)}update(){if(!this._inProgress)return!1;if(null===this._handle){let{_timeline:e,settings:t}=this;this._handle=e.addChannel({delay:e.getTime(),duration:t.duration})}return this.time=this._timeline.getTime(this._handle),this._onUpdate(),this.settings.onUpdate?.(this),this._timeline.isFinished(this._handle)&&this.end(),!0}_onUpdate(){}}},34315:(e,t,i)=>{"use strict";i.d(t,{r:()=>s});var r=i(60154);class s extends r.F{get[Symbol.toStringTag](){return"RenderPipeline"}shaderLayout;bufferLayout;linkStatus="pending";hash="";sharedRenderPipeline=null;get isPending(){return"pending"===this.linkStatus||"pending"===this.vs.compilationStatus||this.fs?.compilationStatus==="pending"}get isErrored(){return"error"===this.linkStatus||"error"===this.vs.compilationStatus||this.fs?.compilationStatus==="error"}constructor(e,t){super(e,t,s.defaultProps),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[],this.sharedRenderPipeline=this.props._sharedRenderPipeline||null}static defaultProps={...r.F.defaultProps,vs:null,vertexEntryPoint:"vertexMain",vsConstants:{},fs:null,fragmentEntryPoint:"fragmentMain",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",colorAttachmentFormats:void 0,depthStencilAttachmentFormat:void 0,parameters:{},varyings:void 0,bufferMode:void 0,disableWarnings:!1,_sharedRenderPipeline:void 0,bindings:void 0,bindGroups:void 0}}},36286:(e,t,i)=>{"use strict";async function r(e,t){let i=document.getElementsByTagName("head")[0];if(!i)throw Error("loadScript");let r=document.createElement("script");return r.setAttribute("type","text/javascript"),r.setAttribute("src",e),t&&(r.id=t),new Promise((t,s)=>{r.onload=t,r.onerror=t=>s(Error(`Unable to load script '${e}': ${t}`)),i.appendChild(r)})}i.d(t,{k:()=>r})},36426:(e,t,i)=>{"use strict";i.d(t,{A:()=>_});let r=`\ 54#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND 55 56// All these functions are for substituting tan() function from Intel GPU only 57const float TWO_PI = 6.2831854820251465; 58const float PI_2 = 1.5707963705062866; 59const float PI_16 = 0.1963495463132858; 60 61const float SIN_TABLE_0 = 0.19509032368659973; 62const float SIN_TABLE_1 = 0.3826834261417389; 63const float SIN_TABLE_2 = 0.5555702447891235; 64const float SIN_TABLE_3 = 0.7071067690849304; 65 66const float COS_TABLE_0 = 0.9807852506637573; 67const float COS_TABLE_1 = 0.9238795042037964; 68const float COS_TABLE_2 = 0.8314695954322815; 69const float COS_TABLE_3 = 0.7071067690849304; 70 71const float INVERSE_FACTORIAL_3 = 1.666666716337204e-01; // 1/3! 72const float INVERSE_FACTORIAL_5 = 8.333333767950535e-03; // 1/5! 73const float INVERSE_FACTORIAL_7 = 1.9841270113829523e-04; // 1/7! 74const float INVERSE_FACTORIAL_9 = 2.75573188446287533e-06; // 1/9! 75 76float sin_taylor_fp32(float a) { 77 float r, s, t, x; 78 79 if (a == 0.0) { 80 return 0.0; 81 } 82 83 x = -a * a; 84 s = a; 85 r = a; 86 87 r = r * x; 88 t = r * INVERSE_FACTORIAL_3; 89 s = s + t; 90 91 r = r * x; 92 t = r * INVERSE_FACTORIAL_5; 93 s = s + t; 94 95 r = r * x; 96 t = r * INVERSE_FACTORIAL_7; 97 s = s + t; 98 99 r = r * x; 100 t = r * INVERSE_FACTORIAL_9; 101 s = s + t; 102 103 return s; 104} 105 106void sincos_taylor_fp32(float a, out float sin_t, out float cos_t) { 107 if (a == 0.0) { 108 sin_t = 0.0; 109 cos_t = 1.0; 110 } 111 sin_t = sin_taylor_fp32(a); 112 cos_t = sqrt(1.0 - sin_t * sin_t); 113} 114 115float tan_taylor_fp32(float a) { 116 float sin_a; 117 float cos_a; 118 119 if (a == 0.0) { 120 return 0.0; 121 } 122 123 // 2pi range reduction 124 float z = floor(a / TWO_PI); 125 float r = a - TWO_PI * z; 126 127 float t; 128 float q = floor(r / PI_2 + 0.5); 129 int j = int(q); 130 131 if (j < -2 || j > 2) { 132 return 1.0 / 0.0; 133 } 134 135 t = r - PI_2 * q; 136 137 q = floor(t / PI_16 + 0.5); 138 int k = int(q); 139 int abs_k = int(abs(float(k))); 140 141 if (abs_k > 4) { 142 return 1.0 / 0.0; 143 } else { 144 t = t - PI_16 * q; 145 } 146 147 float u = 0.0; 148 float v = 0.0; 149 150 float sin_t, cos_t; 151 float s, c; 152 sincos_taylor_fp32(t, sin_t, cos_t); 153 154 if (k == 0) { 155 s = sin_t; 156 c = cos_t; 157 } else { 158 if (abs(float(abs_k) - 1.0) < 0.5) { 159 u = COS_TABLE_0; 160 v = SIN_TABLE_0; 161 } else if (abs(float(abs_k) - 2.0) < 0.5) { 162 u = COS_TABLE_1; 163 v = SIN_TABLE_1; 164 } else if (abs(float(abs_k) - 3.0) < 0.5) { 165 u = COS_TABLE_2; 166 v = SIN_TABLE_2; 167 } else if (abs(float(abs_k) - 4.0) < 0.5) { 168 u = COS_TABLE_3; 169 v = SIN_TABLE_3; 170 } 171 if (k > 0) { 172 s = u * sin_t + v * cos_t; 173 c = u * cos_t - v * sin_t; 174 } else { 175 s = u * sin_t - v * cos_t; 176 c = u * cos_t + v * sin_t; 177 } 178 } 179 180 if (j == 0) { 181 sin_a = s; 182 cos_a = c; 183 } else if (j == 1) { 184 sin_a = c; 185 cos_a = -s; 186 } else if (j == -1) { 187 sin_a = -c; 188 cos_a = s; 189 } else { 190 sin_a = -s; 191 cos_a = -c; 192 } 193 return sin_a / cos_a; 194} 195#endif 196 197float tan_fp32(float a) { 198#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND 199 return tan_taylor_fp32(a); 200#else 201 return tan(a); 202#endif 203} 204`;var s=i(43406),n=i(79549),o=i(27645);let a=["default","lnglat","meter-offsets","lnglat-offsets","cartesian"].map(e=>`const COORDINATE_SYSTEM_${e.toUpperCase().replaceAll("-","_")}: i32 = ${(0,n.LB)(e)};`).join(""),l=Object.keys(o.Kx).map(e=>`const PROJECTION_MODE_${e}
204: i32 = ${o.Kx[e]};`).join(""),h=Object.keys(o.p5).map(e=>`const UNIT_${e.toUpperCase()}: i32 = ${o.p5[e]};`).join(""),u=`\ 205${a} 206${l} 207${h} 208 209const TILE_SIZE: f32 = 512.0; 210const PI: f32 = 3.1415926536; 211const WORLD_SCALE: f32 = TILE_SIZE / (PI * 2.0); 212const ZERO_64_LOW: vec3<f32> = vec3<f32>(0.0, 0.0, 0.0); 213const EARTH_RADIUS: f32 = 6370972.0; // meters 214const GLOBE_RADIUS: f32 = 256.0; 215 216// ----------------------------------------------------------------------------- 217// Uniform block (converted from GLSL uniform block) 218// ----------------------------------------------------------------------------- 219struct ProjectUniforms { 220 wrapLongitude: i32, 221 coordinateSystem: i32, 222 commonUnitsPerMeter: vec3<f32>, 223 projectionMode: i32, 224 scale: f32, 225 commonUnitsPerWorldUnit: vec3<f32>, 226 commonUnitsPerWorldUnit2: vec3<f32>, 227 center: vec4<f32>, 228 modelMatrix: mat4x4<f32>, 229 viewProjectionMatrix: mat4x4<f32>, 230 viewportSize: vec2<f32>, 231 devicePixelRatio: f32, 232 focalDistance: f32, 233 cameraPosition: vec3<f32>, 234 coordinateOrigin: vec3<f32>, 235 commonOrigin: vec3<f32>, 236 pseudoMeters: i32, 237}; 238 239@group(0) @binding(auto) 240var<uniform> project: ProjectUniforms; 241 242// ----------------------------------------------------------------------------- 243// Geometry data shared across the project helpers. 244// The active layer shader is responsible for populating this private module 245// state before calling the project functions below. 246// ----------------------------------------------------------------------------- 247 248// Structure to carry additional geometry data used by deck.gl filters. 249struct Geometry { 250 worldPosition: vec3<f32>, 251 worldPositionAlt: vec3<f32>, 252 position: vec4<f32>, 253 normal: vec3<f32>, 254 uv: vec2<f32>, 255 pickingColor: vec3<f32>, 256}; 257 258var<private> geometry: Geometry; 259`,c=`\ 260${u} 261 262// ----------------------------------------------------------------------------- 263// Functions 264// ----------------------------------------------------------------------------- 265 266// Returns an adjustment factor for commonUnitsPerMeter 267fn _project_size_at_latitude(lat: f32) -> f32 { 268 let y = clamp(lat, -89.9, 89.9); 269 return 1.0 / cos(radians(y)); 270} 271 272// Overloaded version: scales a value in meters at a given latitude. 273fn _project_size_at_latitude_m(meters: f32, lat: f32) -> f32 { 274 return meters * project.commonUnitsPerMeter.z * _project_size_at_latitude(lat); 275} 276 277// Computes a non-linear scale factor based on geometry. 278// (Note: This function relies on "geometry" being provided.) 279fn project_size() -> f32 { 280 if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR && 281 project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT && 282 project.pseudoMeters == 0) { 283 if (geometry.position.w == 0.0) { 284 return _project_size_at_latitude(geometry.worldPosition.y); 285 } 286 let y: f32 = geometry.position.y / TILE_SIZE * 2.0 - 1.0; 287 let y2 = y * y; 288 let y4 = y2 * y2; 289 let y6 = y4 * y2; 290 return 1.0 + 4.9348 * y2 + 4.0587 * y4 + 1.5642 * y6; 291 } 292 return 1.0; 293} 294 295// Overloads to scale offsets (meters to world units) 296fn project_size_float(meters: f32) -> f32 { 297 return meters * project.commonUnitsPerMeter.z * project_size(); 298} 299 300fn project_size_vec2(meters: vec2<f32>) -> vec2<f32> { 301 return meters * project.commonUnitsPerMeter.xy * project_size(); 302} 303 304fn project_size_vec3(meters: vec3<f32>) -> vec3<f32> { 305 return meters * project.commonUnitsPerMeter * project_size(); 306} 307 308fn project_size_vec4(meters: vec4<f32>) -> vec4<f32> { 309 return vec4<f32>(meters.xyz * project.commonUnitsPerMeter, meters.w); 310} 311 312// Returns a rotation matrix aligning the z‑axis with the given up vector. 313fn project_get_orientation_matrix(up: vec3<f32>) -> mat3x3<f32> { 314 let uz = normalize(up); 315 let ux = select( 316 vec3<f32>(1.0, 0.0, 0.0), 317 normalize(vec3<f32>(uz.y, -uz.x, 0.0)), 318 abs(uz.z) == 1.0 319 ); 320 let uy = cross(uz, ux); 321 return mat3x3<f32>(ux, uy, uz); 322} 323 324// Since WGSL does not support "out" parameters, we return a struct. 325struct RotationResult { 326 needsRotation: bool, 327 transform: mat3x3<f32>, 328}; 329 330fn project_needs_rotation(commonPosition: vec3<f32>) -> RotationResult { 331 if (project.projectionMode == PROJECTION_MODE_GLOBE) { 332 return RotationResult(true, project_get_orientation_matrix(commonPosition)); 333 } else { 334 return RotationResult(false, mat3x3<f32>()); // identity alternative if needed 335 }; 336} 337 338// Projects a normal vector from the current coordinate system to world space. 339fn project_normal(vector: vec3<f32>) -> vec3<f32> { 340 let normal_modelspace = project.modelMatrix * vec4<f32>(vector, 0.0); 341 var n = normalize(normal_modelspace.xyz * project.commonUnitsPerMeter); 342 let rotResult = project_needs_rotation(geometry.position.xyz); 343 if (rotResult.needsRotation) { 344 n = rotResult.transform * n; 345 } 346 return n; 347} 348 349// Applies a scale offset based on y-offset (dy) 350fn project_offset_(offset: vec4<f32>) -> vec4<f32> { 351 let dy: f32 = offset.y; 352 let commonUnitsPerWorldUnit = project.commonUnitsPerWorldUnit + project.commonUnitsPerWorldUnit2 * dy; 353 return vec4<f32>(offset.xyz * commonUnitsPerWorldUnit, offset.w); 354} 355 356// Projects lng/lat coordinates to a unit tile [0,1] 357fn project_mercator_(lnglat: vec2<f32>) -> vec2<f32> { 358 var x = lnglat.x; 359 if (project.wrapLongitude != 0) { 360 x = ((x + 180.0) % 360.0) - 180.0; 361 } 362 let y = clamp(lnglat.y, -89.9, 89.9); 363 return vec2<f32>( 364 radians(x) + PI, 365 PI + log(tan(PI * 0.25 + radians(y) * 0.5)) 366 ) * WORLD_SCALE; 367} 368 369// Projects lng/lat/z coordinates for a globe projection. 370fn project_globe_(lnglatz: vec3<f32>) -> vec3<f32> { 371 let lambda = radians(lnglatz.x); 372 let phi = radians(lnglatz.y); 373 let cosPhi = cos(phi); 374 let D = (lnglatz.z / EARTH_RADIUS + 1.0) * GLOBE_RADIUS; 375 return vec3<f32>( 376 sin(lambda) * cosPhi, 377 -cos(lambda) * cosPhi, 378 sin(phi) 379 ) * D; 380} 381 382// Projects positions (with an optional 64-bit low part) from the input 383// coordinate system to the common space. 384fn project_position_vec4_f64(position: vec4<f32>, position64Low: vec3<f32>) -> vec4<f32> { 385 var position_world = project.modelMatrix * position; 386 387 // Work around for a Mac+NVIDIA bug: 388 if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR) { 389 if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) { 390 return vec4<f32>( 391 project_mercator_(position_world.xy), 392 _project_size_at_latitude_m(position_world.z, position_world.y), 393 position_world.w 394 ); 395 } 396 if (project.coordinateSystem == COORDINATE_SYSTEM_CARTESIAN) {
397 position_world = vec4f(position_world.xyz + project.coordinateOrigin, position_world.w); 398 } 399 } 400 if (project.projectionMode == PROJECTION_MODE_GLOBE) { 401 if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) { 402 return vec4<f32>( 403 project_globe_(position_world.xyz), 404 position_world.w 405 ); 406 } 407 } 408 if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) { 409 if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) { 410 if (abs(position_world.y - project.coordinateOrigin.y) > 0.25) { 411 return vec4<f32>( 412 project_mercator_(position_world.xy) - project.commonOrigin.xy, 413 project_size_float(position_world.z), 414 position_world.w 415 ); 416 } 417 } 418 } 419 if (project.projectionMode == PROJECTION_MODE_IDENTITY || 420 (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET && 421 (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT || 422 project.coordinateSystem == COORDINATE_SYSTEM_CARTESIAN))) { 423 position_world = vec4f(position_world.xyz - project.coordinateOrigin, position_world.w); 424 } 425 426 return project_offset_(position_world) + 427 project_offset_(project.modelMatrix * vec4<f32>(position64Low, 0.0)); 428} 429 430// Overloaded versions for different input types. 431fn project_position_vec4_f32(position: vec4<f32>) -> vec4<f32> { 432 return project_position_vec4_f64(position, ZERO_64_LOW); 433} 434 435fn project_position_vec3_f64(position: vec3<f32>, position64Low: vec3<f32>) -> vec3<f32> { 436 let projected_position = project_position_vec4_f64(vec4<f32>(position, 1.0), position64Low); 437 return projected_position.xyz; 438} 439 440fn project_position_vec3_f32(position: vec3<f32>) -> vec3<f32> { 441 let projected_position = project_position_vec4_f64(vec4<f32>(position, 1.0), ZERO_64_LOW); 442 return projected_position.xyz; 443} 444 445fn project_position_vec2_f32(position: vec2<f32>) -> vec2<f32> { 446 let projected_position = project_position_vec4_f64(vec4<f32>(position, 0.0, 1.0), ZERO_64_LOW); 447 return projected_position.xy; 448} 449 450// Transforms a common space position to clip space. 451fn project_common_position_to_clipspace_with_projection(position: vec4<f32>, viewProjectionMatrix: mat4x4<f32>, center: vec4<f32>) -> vec4<f32> { 452 return viewProjectionMatrix * position + center; 453} 454 455// Uses the project viewProjectionMatrix and center. 456fn project_common_position_to_clipspace(position: vec4<f32>) -> vec4<f32> { 457 return project_common_position_to_clipspace_with_projection(position, project.viewProjectionMatrix, project.center); 458} 459 460// Returns a clip space offset corresponding to a given number of screen pixels. 461fn project_pixel_size_to_clipspace(pixels: vec2<f32>) -> vec2<f32> { 462 let offset = pixels / project.viewportSize * project.devicePixelRatio * 2.0; 463 return offset * project.focalDistance; 464} 465 466fn project_meter_size_to_pixel(meters: f32) -> f32 { 467 return project_size_float(meters) * project.scale; 468} 469 470fn project_unit_size_to_pixel(size: f32, unit: i32) -> f32 { 471 if (unit == UNIT_METERS) { 472 return project_meter_size_to_pixel(size); 473 } else if (unit == UNIT_COMMON) { 474 return size * project.scale; 475 } 476 // UNIT_PIXELS: no scaling applied. 477 return size; 478} 479 480fn project_pixel_size_float(pixels: f32) -> f32 { 481 return pixels / project.scale; 482} 483 484fn project_pixel_size_vec2(pixels: vec2<f32>) -> vec2<f32> { 485 return pixels / project.scale; 486} 487`,d=["default","lnglat","meter-offsets","lnglat-offsets","cartesian"].map(e=>`const int COORDINATE_SYSTEM_${e.toUpperCase().replaceAll("-","_")} = ${(0,n.LB)(e)};`).join(""),f=Object.keys(o.Kx).map(e=>`const int PROJECTION_MODE_${e} = ${o.Kx[e]};`).join(""),p=Object.keys(o.p5).map(e=>`const int UNIT_${e.toUpperCase()} = ${o.p5[e]};`).join(""),g=`\ 488${d} 489${f} 490${p
vendor: 6,166 bytes, lines 490-682
490} 491layout(std140) uniform projectUniforms { 492bool wrapLongitude; 493int coordinateSystem; 494vec3 commonUnitsPerMeter; 495int projectionMode; 496float scale; 497vec3 commonUnitsPerWorldUnit; 498vec3 commonUnitsPerWorldUnit2; 499vec4 center; 500mat4 modelMatrix; 501mat4 viewProjectionMatrix; 502vec2 viewportSize; 503float devicePixelRatio; 504float focalDistance; 505vec3 cameraPosition; 506vec3 coordinateOrigin; 507vec3 commonOrigin; 508bool pseudoMeters; 509} project; 510const float TILE_SIZE = 512.0; 511const float PI = 3.1415926536; 512const float WORLD_SCALE = TILE_SIZE / (PI * 2.0); 513const vec3 ZERO_64_LOW = vec3(0.0); 514const float EARTH_RADIUS = 6370972.0; 515const float GLOBE_RADIUS = 256.0; 516float project_size_at_latitude(float lat) { 517float y = clamp(lat, -89.9, 89.9); 518return 1.0 / cos(radians(y)); 519} 520float project_size() { 521if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR && 522project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT && 523project.pseudoMeters == false) { 524if (geometry.position.w == 0.0) { 525return project_size_at_latitude(geometry.worldPosition.y); 526} 527float y = geometry.position.y / TILE_SIZE * 2.0 - 1.0; 528float y2 = y * y; 529float y4 = y2 * y2; 530float y6 = y4 * y2; 531return 1.0 + 4.9348 * y2 + 4.0587 * y4 + 1.5642 * y6; 532} 533return 1.0; 534} 535float project_size_at_latitude(float meters, float lat) { 536return meters * project.commonUnitsPerMeter.z * project_size_at_latitude(lat); 537} 538float project_size(float meters) { 539return meters * project.commonUnitsPerMeter.z * project_size(); 540} 541vec2 project_size(vec2 meters) { 542return meters * project.commonUnitsPerMeter.xy * project_size(); 543} 544vec3 project_size(vec3 meters) { 545return meters * project.commonUnitsPerMeter * project_size(); 546} 547vec4 project_size(vec4 meters) { 548return vec4(meters.xyz * project.commonUnitsPerMeter, meters.w); 549} 550mat3 project_get_orientation_matrix(vec3 up) { 551vec3 uz = normalize(up); 552vec3 ux = abs(uz.z) == 1.0 ? vec3(1.0, 0.0, 0.0) : normalize(vec3(uz.y, -uz.x, 0)); 553vec3 uy = cross(uz, ux); 554return mat3(ux, uy, uz); 555} 556bool project_needs_rotation(vec3 commonPosition, out mat3 transform) { 557if (project.projectionMode == PROJECTION_MODE_GLOBE) { 558transform = project_get_orientation_matrix(commonPosition); 559return true; 560} 561return false; 562} 563vec3 project_normal(vec3 vector) { 564vec4 normal_modelspace = project.modelMatrix * vec4(vector, 0.0); 565vec3 n = normalize(normal_modelspace.xyz * project.commonUnitsPerMeter); 566mat3 rotation; 567if (project_needs_rotation(geometry.position.xyz, rotation)) { 568n = rotation * n; 569} 570return n; 571} 572vec4 project_offset_(vec4 offset) { 573float dy = offset.y; 574vec3 commonUnitsPerWorldUnit = project.commonUnitsPerWorldUnit + project.commonUnitsPerWorldUnit2 * dy; 575return vec4(offset.xyz * commonUnitsPerWorldUnit, offset.w); 576} 577vec2 project_mercator_(vec2 lnglat) { 578float x = lnglat.x; 579if (project.wrapLongitude) { 580x = mod(x + 180., 360.0) - 180.; 581} 582float y = clamp(lnglat.y, -89.9, 89.9); 583return vec2( 584radians(x) + PI, 585PI + log(tan_fp32(PI * 0.25 + radians(y) * 0.5)) 586) * WORLD_SCALE; 587} 588vec3 project_globe_(vec3 lnglatz) { 589float lambda = radians(lnglatz.x); 590float phi = radians(lnglatz.y); 591float cosPhi = cos(phi); 592float D = (lnglatz.z / EARTH_RADIUS + 1.0) * GLOBE_RADIUS; 593return vec3( 594sin(lambda) * cosPhi, 595-cos(lambda) * cosPhi, 596sin(phi) 597) * D; 598} 599vec4 project_position(vec4 position, vec3 position64Low) { 600vec4 position_world = project.modelMatrix * position; 601if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR) { 602if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) { 603return vec4( 604project_mercator_(position_world.xy), 605project_size_at_latitude(position_world.z, position_world.y), 606position_world.w 607); 608} 609if (project.coordinateSystem == COORDINATE_SYSTEM_CARTESIAN) { 610position_world.xyz += project.coordinateOrigin; 611} 612} 613if (project.projectionMode == PROJECTION_MODE_GLOBE) { 614if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) { 615return vec4( 616project_globe_(position_world.xyz), 617position_world.w 618); 619} 620} 621if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) { 622if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) { 623if (abs(position_world.y - project.coordinateOrigin.y) > 0.25) { 624return vec4( 625project_mercator_(position_world.xy) - project.commonOrigin.xy, 626project_size(position_world.z), 627position_world.w 628); 629} 630} 631} 632if (project.projectionMode == PROJECTION_MODE_IDENTITY || 633(project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET && 634(project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT || 635project.coordinateSystem == COORDINATE_SYSTEM_CARTESIAN))) { 636position_world.xyz -= project.coordinateOrigin; 637} 638return project_offset_(position_world) + project_offset_(project.modelMatrix * vec4(position64Low, 0.0)); 639} 640vec4 project_position(vec4 position) { 641return project_position(position, ZERO_64_LOW); 642} 643vec3 project_position(vec3 position, vec3 position64Low) { 644vec4 projected_position = project_position(vec4(position, 1.0), position64Low); 645return projected_position.xyz; 646} 647vec3 project_position(vec3 position) { 648vec4 projected_position = project_position(vec4(position, 1.0), ZERO_64_LOW); 649return projected_position.xyz; 650} 651vec2 project_position(vec2 position) { 652vec4 projected_position = project_position(vec4(position, 0.0, 1.0), ZERO_64_LOW); 653return projected_position.xy; 654} 655vec4 project_common_position_to_clipspace(vec4 position, mat4 viewProjectionMatrix, vec4 center) { 656return viewProjectionMatrix * position + center; 657} 658vec4 project_common_position_to_clipspace(vec4 position) { 659return project_common_position_to_clipspace(position, project.viewProjectionMatrix, project.center); 660} 661vec2 project_pixel_size_to_clipspace(vec2 pixels) { 662vec2 offset = pixels / project.viewportSize * project.devicePixelRatio * 2.0; 663return offset * project.focalDistance; 664} 665float project_size_to_pixel(float meters) { 666return project_size(meters) * project.scale; 667} 668vec2 project_size_to_pixel(vec2 meters) { 669return project_size(meters) * project.scale; 670} 671float project_size_to_pixel(float size, int unit) { 672if (unit == UNIT_METERS) return project_size_to_pixel(size); 673if (unit == UNIT_COMMON) return size * project.scale; 674return size; 675} 676float project_pixel_size(float pixels) { 677return pixels / project.scale; 678} 679vec2 project_pixel_size(vec2 pixels) { 680return pixels / project.scale; 681} 682`,
682m={},_={name:"project",dependencies:[{name:"fp32",vs:r},s.A],source:c,vs:g,getUniforms:function(e=m){return"viewport"in e?(0,n.aY)(e):{}},uniformTypes:{wrapLongitude:"f32",coordinateSystem:"i32",commonUnitsPerMeter:"vec3<f32>",projectionMode:"i32",scale:"f32",commonUnitsPerWorldUnit:"vec3<f32>",commonUnitsPerWorldUnit2:"vec3<f32>",center:"vec4<f32>",modelMatrix:"mat4x4<f32>",viewProjectionMatrix:"mat4x4<f32>",viewportSize:"vec2<f32>",devicePixelRatio:"f32",focalDistance:"f32",cameraPosition:"vec3<f32>",coordinateOrigin:"vec3<f32>",commonOrigin:"vec3<f32>",pseudoMeters:"f32"}}},37114:(e,t,i)=>{"use strict";i.d(t,{$Q:()=>s});var r=i(46899);function s(e){(0,r.$g)(e);let t={},i={};!function e(t){let{modules:i,level:r,moduleMap:s,moduleDepth:n}=t;if(r>=5)throw Error("Possible loop in shader dependency graph");for(let e of i)s[e.name]=e,(void 0===n[e.name]||n[e.name]<r)&&(n[e.name]=r);for(let t of i)t.dependencies&&e({modules:t.dependencies,level:r+1,moduleMap:s,moduleDepth:n})}({modules:e,level:0,moduleMap:t,moduleDepth:i});let s=Object.keys(i).sort((e,t)=>
682i[t]-i[e]).map(e=>t[e]);return(0,r.$g)(s),s}},38809:(e,t,i)=>{"use strict";i.d(t,{A:()=>x});class r{static getId(e){let t=e.find(e=>Array.isArray(e)&&"ID"===e[0]);return t&&t.length>=3?{authority:t[1],code:parseInt(t[2],10)}:null}static convertUnit(e,t="unit"){if(!e||e.length<3)return{type:t,name:"unknown",conversion_factor:null};let i=e[1],r=parseFloat(e[2])||null,s=e.find(e=>Array.isArray(e)&&"ID"===e[0]);return{type:t,name:i,conversion_factor:r,id:s?{authority:s[1],code:parseInt(s[2],10)}:null}}static convertAxis(e){let t,i=e[1]||"Unknown",r=i.match(/^\((.)\)$/);if(r){let i=r[1].toUpperCase();if("E"===i)t="east";else if("N"===i)t="north";else if("U"===i)t="up";else if(e[2])t=e[2];else throw Error(`Unknown axis abbreviation: ${i}`)}else t=e[2]||"unknown";let s=e.find(e=>Array.isArray(e)&&"ORDER"===e[0]),n=s?parseInt(s[1],10):null,o=e.find(e=>Array.isArray(e)&&("LENGTHUNIT"===e[0]||"ANGLEUNIT"===e[0]||"SCALEUNIT"===e[0]));return{name:i,direction:t,unit:this.convertUnit(o),order:n}}static extractAxes(e){return e.filter(e=>Array.isArray(e)&&"AXIS"===e[0]).map(e=>this.convertAxis(e)).sort((e,t)=>(e.order||0)-(t.order||0))}static convert(e,t={}){switch(e[0]){case"PROJCRS":t.type="ProjectedCRS",t.name=e[1],t.base_crs=e.find(e=>Array.isArray(e)&&"BASEGEOGCRS"===e[0])?this.convert(e.find(e=>Array.isArray(e)&&"BASEGEOGCRS"===e[0])):null,t.conversion=e.find(e=>Array.isArray(e)&&"CONVERSION"===e[0])?this.convert(e.find(e=>Array.isArray(e)&&"CONVERSION"===e[0])):null;let i=e.find(e=>Array.isArray(e)&&"CS"===e[0]);i&&(t.coordinate_system={type:i[1],axis:this.extractAxes(e)});let r=e.find(e=>Array.isArray(e)&&"LENGTHUNIT"===e[0]);if(r){let e=this.convertUnit(r);t.coordinate_system.unit=e}t.id=this.getId(e);break;case"BASEGEOGCRS":case"GEOGCRS":case"GEODCRS":t.type="GEODCRS"===e[0]?"GeodeticCRS":"GeographicCRS",t.name=e[1];let s=e.find(e=>Array.isArray(e)&&("DATUM"===e[0]||"ENSEMBLE"===e[0]));if(s){let i=this.convert(s);"ENSEMBLE"===s[0]?t.datum_ensemble=i:t.datum=i;let r=e.find(e=>Array.isArray(e)&&"PRIMEM"===e[0]);r&&"Greenwich"!==r[1]&&(i.prime_meridian={name:r[1],longitude:parseFloat(r[2])})}t.coordinate_system={type:"ellipsoidal",axis:this.extractAxes(e)},t.id=this.getId(e);break;case"DATUM":t.type="GeodeticReferenceFrame",t.name=e[1],t.ellipsoid=e.find(e=>Array.isArray(e)&&"ELLIPSOID"===e[0])?this.convert(e.find(e=>Array.isArray(e)&&"ELLIPSOID"===e[0])):null;break;case"ENSEMBLE":t.type="DatumEnsemble",t.name=e[1],t.members=e.filter(e=>Array.isArray(e)&&"MEMBER"===e[0]).map(e=>({type:"DatumEnsembleMember",name:e[1],id:this.getId(e)}));let n=e.find(e=>Array.isArray(e)&&"ENSEMBLEACCURACY"===e[0]);n&&(t.accuracy=parseFloat(n[1]));let o=e.find(e=>Array.isArray(e)&&"ELLIPSOID"===e[0]);o&&(t.ellipsoid=this.convert(o)),t.id=this.getId(e);break;case"ELLIPSOID":t.type="Ellipsoid",t.name=e[1],t.semi_major_axis=parseFloat(e[2]),t.inverse_flattening=parseFloat(e[3]),e.find(e=>Array.isArray(e)&&"LENGTHUNIT"===e[0])&&this.convert(e.find(e=>Array.isArray(e)&&"LENGTHUNIT"===e[0]),t);break;case"CONVERSION":t.type="Conversion",t.name=e[1],t.method=e.find(e=>Array.isArray(e)&&"METHOD"===e[0])?this.convert(e.find(e=>Array.isArray(e)&&"METHOD"===e[0])):null,t.parameters=e.filter(e=>Array.isArray(e)&&"PARAMETER"===e[0]).map(e=>this.convert(e));break;case"METHOD":t.type="Method",t.name=e[1],t.id=this.getId(e);break;case"PARAMETER":t.type="Parameter",t.name=e[1],t.value=parseFloat(e[2]),t.unit=this.convertUnit(e.find(e=>Array.isArray(e)&&("LENGTHUNIT"===e[0]||"ANGLEUNIT"===e[0]||"SCALEUNIT"===e[0]))),t.id=this.getId(e);break;case"BOUNDCRS":t.type="BoundCRS";let a=e.find(e=>Array.isArray(e)&&"SOURCECRS"===e[0]);if(a){let e=a.find(e=>Array.isArray(e));t.source_crs=e?this.convert(e):null}let l=e.find(e=>Array.isArray(e)&&"TARGETCRS"===e[0]);if(l){let e=l.find(e=>Array.isArray(e));t.target_crs=e?this.convert(e):null}let h=e.find(e=>Array.isArray(e)&&"ABRIDGEDTRANSFORMATION"===e[0]);h?t.transformation=this.convert(h):t.transformation=null;break;case"ABRIDGEDTRANSFORMATION":if(t.type="Transformation",t.name=e[1],t.method=e.find(e=>Array.isArray(e)&&"METHOD"===e[0])?this.convert(e.find(e=>Array.isArray(e)&&"METHOD"===e[0])):null,t.parameters=e.filter(e=>Array.isArray(e)&&("PARAMETER"===e[0]||"PARAMETERFILE"===e[0])).map(e=>"PARAMETER"===e[0]?this.convert(e):"PARAMETERFILE"===e[0]?{name:e[1],value:e[2],id:{authority:"EPSG",code:8656}}:void 0),7===t.parameters.length){let e=t.parameters[6];"Scale difference"===e.name&&(e.value=Math.round((e.value-1)*1e12)/1e6)}t.id=this.getId(e);break;case"AXIS":t.coordinate_system||(t.coordinate_system={type:"unspecified",axis:[]}),t.coordinate_system.axis.push(this.convertAxis(e));break;case"LENGTHUNIT":let u=this.convertUnit(e,"LinearUnit");
682t.coordinate_system&&t.coordinate_system.axis&&t.coordinate_system.axis.forEach(e=>{e.unit||(e.unit=u)}),u.conversion_factor&&1!==u.conversion_factor&&t.semi_major_axis&&(t.semi_major_axis={value:t.semi_major_axis,unit:u});break;default:t.keyword=e[0]}return t}}let s=r;class n extends s{static convert(e,t={}){return super.convert(e,t),t.coordinate_system&&"Cartesian"===t.coordinate_system.subtype&&delete t.coordinate_system,t.usage&&delete t.usage,t}}class o extends s{static convert(e,t={}){super.convert(e,t);let i=e.find(e=>Array.isArray(e)&&"CS"===e[0]);i&&(t.coordinate_system={subtype:i[1],axis:this.extractAxes(e)});let r=e.find(e=>Array.isArray(e)&&"USAGE"===e[0]);if(r){let e=r.find(e=>Array.isArray(e)&&"SCOPE"===e[0]),i=r.find(e=>Array.isArray(e)&&"AREA"===e[0]),s=r.find(e=>Array.isArray(e)&&"BBOX"===e[0]);t.usage={},e&&(t.usage.scope=e[1]),i&&(t.usage.area=i[1]),s&&(t.usage.bbox=s.slice(1))}return t}}var a=/\s/,l=/[A-Za-z]/,h=/[A-Za-z84_]/,u=/[,\]]/,c=/[\d\.E\-\+]/;function d(e){if("string"!=typeof e)throw Error("not a string");this.text=e.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=1}function f(e,t,i){Array.isArray(t)&&(i.unshift(t),t=null);var r=t?{}:e,s=i.reduce(function(e,t){return p(t,e),e},r);t&&(e[t]=s)}function p(e,t){if(!Array.isArray(e)){t[e]=!0;return}var i,r=e.shift();if("PARAMETER"===r&&(r=e.shift()),1===e.length){if(Array.isArray(e[0])){t[r]={},p(e[0],t[r]);return}t[r]=e[0];return}if(!e.length){t[r]=!0;return}if("TOWGS84"===r){t[r]=e;return}if("AXIS"===r){r in t||(t[r]=[]),t[r].push(e);return}switch(!Array.isArray(r)&&(t[r]={}),r){case"UNIT":case"PRIMEM":case"VERT_DATUM":t[r]={name:e[0].toLowerCase(),convert:e[1]},3===e.length&&p(e[2],t[r]);return;case"SPHEROID":case"ELLIPSOID":t[r]={name:e[0],a:e[1],rf:e[2]},4===e.length&&p(e[3],t[r]);return;case"EDATUM":case"ENGINEERINGDATUM":case"LOCAL_DATUM":case"DATUM":case"VERT_CS":case"VERTCRS":case"VERTICALCRS":e[0]=["name",e[0]],f(t,r,e);return;case"COMPD_CS":case"COMPOUNDCRS":case"FITTED_CS":case"PROJECTEDCRS":case"PROJCRS":case"GEOGCS":case"GEOCCS":case"PROJCS":case"LOCAL_CS":case"GEODCRS":case"GEODETICCRS":case"GEODETICDATUM":case"ENGCRS":case"ENGINEERINGCRS":e[0]=["name",e[0]],f(t,r,e),t[r].type=r;return;default:for(i=-1;++i<e.length;)if(!Array.isArray(e[i]))return p(e,t[r]);return f(t,r,e)}}function g(e){return .017453292519943295*e}function m(e){let t=(e.projName||"").toLowerCase().replace(/_/g," ");void 0===e.long0&&void 0!==e.longc&&(e.long0=e.longc),!e.lat_ts&&e.lat1&&("stereographic south pole"===t||"polar stereographic (variant b)"===t)?(e.lat0=g(e.lat1>0?90:-90),e.lat_ts=e.lat1,delete e.lat1):!e.lat_ts&&e.lat0&&("polar stereographic"===t||"polar stereographic (variant a)"===t)&&(e.lat_ts=e.lat0,e.lat0=g(e.lat0>0?90:-90),delete e.lat1)}function _(e){let t={units:null,to_meter:void 0};return"string"==typeof e?(t.units=e.toLowerCase(),"metre"===t.units&&(t.units="meter"),"meter"===t.units&&(t.to_meter=1)):e&&e.name&&(t.units=e.name.toLowerCase(),"metre"===t.units&&(t.units="meter"),t.to_meter=e.conversion_factor),t}function y(e){return"object"==typeof e?e.value*e.unit.conversion_factor:e}function v(e,t){e.ellipsoid.radius?(t.a=e.ellipsoid.radius,t.rf=0):(t.a=y(e.ellipsoid.semi_major_axis),void 0!==e.ellipsoid.inverse_flattening?t.rf=e.ellipsoid.inverse_flattening:void 0!==e.ellipsoid.semi_major_axis&&void 0!==e.ellipsoid.semi_minor_axis&&(t.rf=t.a/(t.a-y(e.ellipsoid.semi_minor_axis))))}function b(e,t={}){return e&&"object"==typeof e?("BoundCRS"===e.type?(b(e.source_crs,t),e.transformation&&(e.transformation.method&&"NTv2"===e.transformation.method.name?t.nadgrids=e.transformation.parameters[0].value:t.datum_params=e.transformation.parameters.map(e=>e.value))):(Object.keys(e).forEach(i=>{let r=e[i];if(null!==r)switch(i){case"name":if(t.srsCode)break;t.name=r,t.srsCode=r;break;case"type":"GeographicCRS"===r?t.projName="longlat":"GeodeticCRS"===r?e.coordinate_system&&"Cartesian"===e.coordinate_system.subtype?t.projName="geocent":t.projName="longlat":"ProjectedCRS"===r&&e.conversion&&e.conversion.method&&(t.projName=e.conversion.method.name);break;case"datum":case"datum_ensemble":r.ellipsoid&&(t.ellps=r.ellipsoid.name,v(r,t)),r.prime_meridian&&(t.from_greenwich=r.prime_meridian.longitude*Math.PI/180);break;case"ellipsoid":t.ellps=r.name,v(r,t);break;case"prime_meridian":t.long0=(r.longitude||0)*Math.PI/180;break;case"coordinate_system":if(r.axis){let e={east:"e",north:"n",west:"w",south:"s",up:"u",down:"d",geocentricx:"e",geocentricy:"n",geocentricz:"u"},i=r.axis.map(t=>e[t.direction.toLowerCase()]);if(i.every(Boolean)&&(t.axis=i.join(""),2===t.axis.length&&(t.axis+="u")),r.unit){let{units:e,to_meter:i}=_(r.unit);t.units=e,t.to_meter=i}else if(r.axis[0]&&r.axis[0].unit){let{units:e,to_meter:i}=_(r.axis[0].unit);t.units=e,t.to_meter=i}}break;case"id":r.authority&&r.code&&(t.title=r.authority+":"+r.code);break;case"conversion":r.method&&r.method.name&&(t.projName=r.method.name),r.parameters&&r.parameters.forEac
682h(e=>{let i=e.name.toLowerCase().replace(/\s+/g,"_"),r=e.value;e.unit&&e.unit.conversion_factor?t[i]=r*e.unit.conversion_factor:"degree"===e.unit?t[i]=r*Math.PI/180:t[i]=r});break;case"unit":r.name&&(t.units=r.name.toLowerCase(),"metre"===t.units&&(t.units="meter")),r.conversion_factor&&(t.to_meter=r.conversion_factor);break;case"base_crs":b(r,t),t.datumCode=r.id?r.id.authority+"_"+r.id.code:r.name}}),void 0!==t.latitude_of_false_origin&&(t.lat0=t.latitude_of_false_origin),void 0!==t.longitude_of_false_origin&&(t.long0=t.longitude_of_false_origin),void 0!==t.latitude_of_standard_parallel&&(t.lat0=t.latitude_of_standard_parallel,t.lat1=t.latitude_of_standard_parallel),void 0!==t.latitude_of_1st_standard_parallel&&(t.lat1=t.latitude_of_1st_standard_parallel),void 0!==t.latitude_of_2nd_standard_parallel&&(t.lat2=t.latitude_of_2nd_standard_parallel),void 0!==t.latitude_of_projection_centre&&(t.lat0=t.latitude_of_projection_centre),void 0!==t.longitude_of_projection_centre&&(t.longc=t.longitude_of_projection_centre),void 0!==t.easting_at_false_origin&&(t.x0=t.easting_at_false_origin),void 0!==t.northing_at_false_origin&&(t.y0=t.northing_at_false_origin),void 0!==t.latitude_of_natural_origin&&(t.lat0=t.latitude_of_natural_origin),void 0!==t.longitude_of_natural_origin&&(t.long0=t.longitude_of_natural_origin),void 0!==t.longitude_of_origin&&(t.long0=t.longitude_of_origin),void 0!==t.false_easting&&(t.x0=t.false_easting),t.easting_at_projection_centre&&(t.x0=t.easting_at_projection_centre),void 0!==t.false_northing&&(t.y0=t.false_northing),t.northing_at_projection_centre&&(t.y0=t.northing_at_projection_centre),void 0!==t.standard_parallel_1&&(t.lat1=t.standard_parallel_1),void 0!==t.standard_parallel_2&&(t.lat2=t.standard_parallel_2),void 0!==t.scale_factor_at_natural_origin&&(t.k0=t.scale_factor_at_natural_origin),void 0!==t.scale_factor_at_projection_centre&&(t.k0=t.scale_factor_at_projection_centre),void 0!==t.scale_factor_on_pseudo_standard_parallel&&(t.k0=t.scale_factor_on_pseudo_standard_parallel),void 0!==t.azimuth&&(t.alpha=t.azimuth),void 0!==t.azimuth_at_projection_centre&&(t.alpha=t.azimuth_at_projection_centre),t.angle_from_rectified_to_skew_grid&&(t.rectified_grid_angle=t.angle_from_rectified_to_skew_grid),m(t)),t):e}d.prototype.readCharicter=function(){var e=this.text[this.place++];if(4!==this.state)for(;a.test(e);){if(this.place>=this.text.length)return;e=this.text[this.place++]}switch(this.state){case 1:return this.neutral(e);case 2:return this.keyword(e);case 4:return this.quoted(e);case 5:return this.afterquote(e);case 3:return this.number(e);case -1:return}},d.prototype.afterquote=function(e){if('"'===e){this.word+='"',this.state=4;return}if(u.test(e)){this.word=this.word.trim(),this.afterItem(e);return}throw Error("havn't handled \""+e+'" in afterquote yet, index '+this.place)},d.prototype.afterItem=function(e){if(","===e){null!==this.word&&this.currentObject.push(this.word),this.word=null,this.state=1;return}if("]"===e){this.level--,null!==this.word&&(this.currentObject.push(this.word),this.word=null),this.state=1,this.currentObject=this.stack.pop(),this.currentObject||(this.state=-1);return}},d.prototype.number=function(e){if(c.test(e)){this.word+=e;return}if(u.test(e)){this.word=parseFloat(this.word),this.afterItem(e);return}throw Error("havn't handled \""+e+'" in number yet, index '+this.place)},d.prototype.quoted=function(e){if('"'===e){this.state=5;return}this.word+=e},d.prototype.keyword=function(e){if(h.test(e)){this.word+=e;return}if("["===e){var t=[];t.push(this.word),this.level++,null===this.root?this.root=t:this.currentObject.push(t),this.stack.push(this.currentObject),this.currentObject=t,this.state=1;return}if(u.test(e))return void this.afterItem(e);throw Error("havn't handled \""+e+'" in keyword yet, index '+this.place)},d.prototype.neutral=function(e){if(l.test(e)){this.word=e,this.state=2;return}if('"'===e){this.word="",this.state=4;return}if(c.test(e)){this.word=e,this.state=3;return}if(u.test(e))return void this.afterItem(e);throw Error("havn't handled \""+e+'" in neutral yet, index '+this.place)},d.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(-1===this.state)return this.root;throw Error('unable to parse string "'+this.text+'". State is '+this.state)};
682var E=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function x(e){if("object"==typeof e)return b(e);let t=function(e){let t=e.toUpperCase();return t.includes("PROJCRS")||t.includes("GEOGCRS")||t.includes("BOUNDCRS")||t.includes("VERTCRS")||t.includes("LENGTHUNIT")||t.includes("ANGLEUNIT")||t.includes("SCALEUNIT")?"WKT2":(t.includes("PROJCS")||t.includes("GEOGCS")||t.includes("LOCAL_CS")||t.includes("VERT_CS")||t.includes("UNIT"),"WKT1")}(e);var i=new d(e).output();if("WKT2"===t)return b(function(e){return("2019"==(e.find(e=>Array.isArray(e)&&"USAGE"===e[0])?"2019":(e.find(e=>Array.isArray(e)&&"CS"===e[0])||"BOUNDCRS"===e[0]||"PROJCRS"===e[0]||e[0],"2015"))?o:n).convert(e)}(i));var r=i[0],s={};return p(i,s),!function e(t){for(var i=Object.keys(t),r=0,s=i.length;r<s;++r){var n=i[r];-1!==E.indexOf(n)&&function(e){if(e.AUTHORITY){var t=Object.keys(e.AUTHORITY)[0];t&&t in e.AUTHORITY&&(e.title=t+":"+e.AUTHORITY[t])}if("GEOGCS"===e.type?e.projName="longlat":"LOCAL_CS"===e.type?(e.projName="identity",e.local=!0):"object"==typeof e.PROJECTION?e.projName=Object.keys(e.PROJECTION)[0]:e.projName=e.PROJECTION,e.AXIS){for(var i="",r=0,s=e.AXIS.length;r<s;++r){var n=[e.AXIS[r][0].toLowerCase(),e.AXIS[r][1].toLowerCase()];-1!==n[0].indexOf("north")||("y"===n[0]||"lat"===n[0])&&"north"===n[1]?i+="n":-1!==n[0].indexOf("south")||("y"===n[0]||"lat"===n[0])&&"south"===n[1]?i+="s":-1!==n[0].indexOf("east")||("x"===n[0]||"lon"===n[0])&&"east"===n[1]?i+="e":(-1!==n[0].indexOf("west")||("x"===n[0]||"lon"===n[0])&&"west"===n[1])&&(i+="w")}2===i.length&&(i+="u"),3===i.length&&(e.axis=i)}e.UNIT&&(e.units=e.UNIT.name.toLowerCase(),"metre"===e.units&&(e.units="meter"),e.UNIT.convert&&("GEOGCS"===e.type?e.DATUM&&e.DATUM.SPHEROID&&(e.to_meter=e.UNIT.convert*e.DATUM.SPHEROID.a):e.to_meter=e.UNIT.convert));var o=e.GEOGCS;function a(t){return t*(e.to_meter||1)}"GEOGCS"===e.type&&(o=e),o&&(o.PRIMEM&&o.PRIMEM.convert&&(e.from_greenwich=g(o.PRIMEM.convert)),o.DATUM?e.datumCode=o.DATUM.name.toLowerCase():e.datumCode=o.name.toLowerCase(),"d_"===e.datumCode.slice(0,2)&&(e.datumCode=e.datumCode.slice(2)),"new_zealand_1949"===e.datumCode&&(e.datumCode="nzgd49"),("wgs_1984"===e.datumCode||"world_geodetic_system_1984"===e.datumCode)&&("Mercator_Auxiliary_Sphere"===e.PROJECTION&&(e.sphere=!0),e.datumCode="wgs84"),"belge_1972"===e.datumCode&&(e.datumCode="rnb72"),o.DATUM&&o.DATUM.SPHEROID&&(e.ellps=o.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),"international"===e.ellps.toLowerCase().slice(0,13)&&(e.ellps="intl"),e.a=o.DATUM.SPHEROID.a,e.rf=parseFloat(o.DATUM.SPHEROID.rf)),o.DATUM&&o.DATUM.TOWGS84&&(e.datum_params=o.DATUM.TOWGS84),~e.datumCode.indexOf("osgb_1936")&&(e.datumCode="osgb36"),~e.datumCode.indexOf("osni_1952")&&(e.datumCode="osni52"),(~e.datumCode.indexOf("tm65")||~e.datumCode.indexOf("geodetic_datum_of_1965"))&&(e.datumCode="ire65"),"ch1903+"===e.datumCode&&(e.datumCode="ch1903"),~e.datumCode.indexOf("israel")&&(e.datumCode="isr93")),e.b&&!isFinite(e.b)&&(e.b=e.a),e.rectified_grid_angle&&(e.rectified_grid_angle=g(e.rectified_grid_angle)),[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_1","Latitude of 1st standard parallel"],["standard_parallel_2","Standard_Parallel_2"],["standard_parallel_2","Latitude of 2nd standard parallel"],["false_easting","False_Easting"],["false_easting","False easting"],["false-easting","Easting at false origin"],["false_northing","False_Northing"],["false_northing","False northing"],["false_northing","Northing at false origin"],["central_meridian","Central_Meridian"],["central_meridian","Longitude of natural origin"],["central_meridian","Longitude of false origin"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["latitude_of_origin","Latitude of natural origin"],["latitude_of_origin","Latitude of false origin"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_Of_Center"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",g],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",g],["x0","false_easting",a],["y0","fal
682se_northing",a],["long0","central_meridian",g],["lat0","latitude_of_origin",g],["lat0","standard_parallel_1",g],["lat1","standard_parallel_1",g],["lat2","standard_parallel_2",g],["azimuth","Azimuth"],["alpha","azimuth",g],["srsCode","name"]].forEach(function(t){var i,r;return i=t[0],r=t[1],void(!(i in e)&&r in e&&(e[i]=e[r],3===t.length&&(e[i]=t[2](e[i]))))}),m(e)}(t[n]),"object"==typeof t[n]&&e(t[n])}}(s),s[r]}},40712:(e,t,i)=>{"use strict";i.d(t,{A:()=>o,k:()=>n});var r=i(43280);let s={};function n(e){s=e}function o(e,t,i,n){r.A.level>0&&s[e]&&s[e].call(null,t,i,n)}},41109:(e,t,i)=>{"use strict";i.d(t,{A:()=>s});let r=null;function s(e){return r||(r=n(e??new i.U(i(45408)))),r}async function n(e){let t=await fetch(e);if(!t.body)throw Error("Response has no body");return o("gzip"===t.headers.get("Content-Encoding")?t.body.pipeThrough(new TextDecoderStream):t.body.pipeThrough(new DecompressionStream("gzip")).pipeThrough(new TextDecoderStream))}async function o(e){let t=e.getReader(),i=new Map,r="";for(;;){let{value:e,done:s}=await t.read();if(s)break;let n=(r+=e).indexOf("\n");for(;-1!==n;){let e=r.slice(0,n);if(n=(r=r.slice(n+1)).indexOf("\n"),!e)continue;let t=e.indexOf("|");if(-1===t)throw Error(`Invalid line, missing separator: ${e}`);let s=Number.parseInt(e.slice(0,t),10),o=e.slice(t+1);i.set(s,o)}}return i}},41487:(e,t,i)=>{"use strict";i.d(t,{H:()=>e_});var r=i(51910),s=i(81866);let n={};class o extends Error{constructor(e,t){super(e),this.reason=t.reason,this.url=t.url,this.response=t.response}reason;url;response}let a=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,l=/^([-\w.]+\/[-\w.+]+)/;function h(e,t){return e.toLowerCase()===t.toLowerCase()}function u(e){let t=a.exec(e);return t?t[1]:""}var c=i(12388);function d(e){return(0,r.Sv)(e)?e.url:(0,r.qf)(e)?("name"in e?e.name:"")||"":"string"==typeof e?e:""}function f(e){if((0,r.Sv)(e)){let t=e.headers.get("content-type")||"",i=(0,c.S3)(e.url);return function(e){let t=l.exec(e);return t?t[1]:e}(t)||u(i)}return(0,r.qf)(e)?e.type||"":"string"==typeof e?u(e):""}async function p(e){var t;if((0,r.Sv)(e))return e;let i={},s=(t=e,(0,r.Sv)(t)?t.headers["content-length"]||-1:(0,r.qf)(t)?t.size:"string"==typeof t?t.length:t instanceof ArrayBuffer||ArrayBuffer.isView(t)?t.byteLength:-1);s>=0&&(i["content-length"]=String(s));let n=d(e),o=f(e);o&&(i["content-type"]=o);let a=await _(e);a&&(i["x-first-bytes"]=a),"string"==typeof e&&(e=new TextEncoder().encode(e));let l=new Response(e,{headers:i});return Object.defineProperty(l,"url",{value:n}),l}async function g(e){if(!e.ok)throw await m(e)}async function m(e){let t=(0,c.E1)(e.url),i=`Failed to fetch resource (${e.status}) ${e.statusText}: ${t}`;i=i.length>100?`${i.slice(0,100)}...`:i;let r={reason:e.statusText,url:e.url,response:e};try{let t=e.headers.get("Content-Type");r.reason=!e.bodyUsed&&t?.includes("application/json")?await e.json():await e.text()}catch(e){}return new o(i,r)}async function _(e){if("string"==typeof e)return`data:,${e.slice(0,5)}`;if(e instanceof Blob){let t=e.slice(0,5);return await new Promise(e=>{let i=new FileReader;i.onload=t=>e(t?.target?.result),i.readAsDataURL(t)})}if(e instanceof ArrayBuffer){let t=function(e){let t="",i=new Uint8Array(e);for(let e=0;e<i.byteLength;e++)t+=String.fromCharCode(i[e]);return btoa(t)}(e.slice(0,5));return`data:base64,${t}`}return null}async function y(e,t){if("string"==typeof e){var i;let r=function(e){for(let t in n)if(e.startsWith(t)){let i=n[t];e=e.replace(t,i)}return e.startsWith("http://")||e.startsWith("https://")||(e=`${e}`),e}(e);return!((i=r).startsWith("http:")||i.startsWith("https:"))&&!r.startsWith("data:")&&globalThis.loaders?.fetchNode?globalThis.loaders?.fetchNode(r,t):await fetch(r,t)}return await p(e)}var v=i(75261);function b(e,t){let i=(0,v.pp)(),s=e||i,n=s.fetch??s.core?.fetch;return"function"==typeof n?n:(0,r.Gv)(n)?e=>y(e,n):t?.fetch?t?.fetch:y}var E=i(40459);let x={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:"undefined"!=typeof global&&global,document:"undefined"!=typeof document&&document};x.self||x.window||x.global,x.window||x.self||x.global,x.global||x.self||x.window,x.document;let w="object"!=typeof E||"[object process]"!==String(E)||!0,S="undefined"!=typeof window&&void 0!==window.orientation,P=void 0!==E&&E.version&&/v([0-9]*)/.exec(E.version);P&&parseFloat(P[1]);class T{terminate(){}}function A(e,t){if(!e)throw Error(t||"loaders.gl assertion failed.")}let M=new Map;function C(e){let t=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(t)}function R(e){return!!e&&!!(e instanceof ArrayBuffer||"undefined"!=typeof MessagePort&&e instanceof MessagePort||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas)}let L=()=>{};class I{name;source;url;terminated=!1;worker;onMessage;onError;_loadableURL="";static isSupported(){return"undefined"!=typeof Worker&&w||!w}constructor(e){let{name:t,source:i,url:r}=e;A(i||r),this.name=t,this.source=i,this.url=r,this.onMessage=L,this.onError=e=>console.log(e),this.worker=w?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=L,this.onError=L,this.worker.terminate(),this.terminated=!0}get isRunning(){return!!this.onMessage}postMessage(e,t){t=t||function e(t,i=!0,r){let s=r||new Set;if(t){if(R(t))s.add(t);else if(R(t.buffer))s.add(t.buffer);else if(ArrayBuffer.isView(t));else if(i&&"object"==typeof t)for(let r in t)e(t[r],i,s)}return void 0===r?Array.from(s):[]}(e),this.worker.postMessage(e,t)}_getErrorFromErrorEvent(e){let t="Failed to load ";return t+=`worker ${this.name} from ${this.url}. `,e.message&&(t+=`${e.message} in `),e.lineno&&(t+=`:${e.lineno}:${e.colno}`),Error(t)}_createBrowserWorker(){var e,t,i;let r;this._loadableURL=(A((e={source:this.source,url:this.url}).source&&!e.url||!e.source&&e.url),(r=M.get(e.source||e.url))||(e.url&&(r=(t=e.url).startsWith("http")?C((i=t,`\ 683try { 684 importScripts('${i}'); 685} catch (error) { 686 console.error(error); 687 throw error; 688}`)):t,M.set(e.url,r)),e.source&&(r=C(e.source),M.set(e.source,r))),A(r),r);let s=new Worker(this._loadableURL,{name:this.name});return s.onmessage=e=>{e.data?this.onMessage(e.data):this.onError(Error("No data received"))},s.onerror=e=>{this.onError(this._getErrorFromErrorEvent(e)),this.terminated=!0},s.onmessageerror=e=>console.error(e),s}_createNodeWorker(){let e;if(this.url)e=new T(this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`,{eval:!1,type:this.url.endsWith(".ts")||this.url.endsWith(".mjs")?"module":"commonjs"});else if(this.source)e=new T(this.source,{eval:!0});else throw Error("no worker");return e.on("message",e=>{this.onMessage(e)}),e.on("error",e=>{this.onError(e)}),e.on("exit",e=>{}),e}}class O{name;workerThread;isRunning=!0;result;_resolve=()=>{};_reject=()=>{};constructor(e,t){this.name=e,this.workerThread=t,this.result=new Promise((e,t)=>
688{this._resolve=e,this._reject=t})}postMessage(e,t){this.workerThread.postMessage({source:"loaders.gl",type:e,payload:t})}done(e){A(this.isRunning),this.isRunning=!1,this._resolve(e)}error(e){A(this.isRunning),this.isRunning=!1,this._reject(e)}}class N{name="unnamed";source;url;maxConcurrency=1;maxMobileConcurrency=1;onDebug=()=>{};reuseWorkers=!0;props={};jobQueue=[];idleQueue=[];count=0;isDestroyed=!1;static isSupported(){return I.isSupported()}constructor(e){this.source=e.source,this.url=e.url,this.setProps(e)}destroy(){this.idleQueue.forEach(e=>e.destroy()),this.isDestroyed=!0}setProps(e){this.props={...this.props,...e},void 0!==e.name&&(this.name=e.name),void 0!==e.maxConcurrency&&(this.maxConcurrency=e.maxConcurrency),void 0!==e.maxMobileConcurrency&&(this.maxMobileConcurrency=e.maxMobileConcurrency),void 0!==e.reuseWorkers&&(this.reuseWorkers=e.reuseWorkers),void 0!==e.onDebug&&(this.onDebug=e.onDebug)}async startJob(e,t=(e,t,i)=>e.done(i),i=(e,t)=>e.error(t)){let r=new Promise(r=>(this.jobQueue.push({name:e,onMessage:t,onError:i,onStart:r}),this));return this._startQueuedJob(),await r}async _startQueuedJob(){if(!this.jobQueue.length)return;let e=this._getAvailableWorker();if(!e)return;let t=this.jobQueue.shift();if(t){this.onDebug({message:"Starting job",name:t.name,workerThread:e,backlog:this.jobQueue.length});let i=new O(t.name,e);e.onMessage=e=>t.onMessage(i,e.type,e.payload),e.onError=e=>t.onError(i,e),t.onStart(i);try{await i.result}catch(e){console.error(`Worker exception: ${e}`)}finally{this.returnWorkerToQueue(e)}}}returnWorkerToQueue(e){!w||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(e.destroy(),this.count--):this.idleQueue.push(e),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){return this.idleQueue.length>0?this.idleQueue.shift()||null:this.count<this._getMaxConcurrency()?(this.count++,new I({name:`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`,source:this.source,url:this.url})):null}_getMaxConcurrency(){return S?this.maxMobileConcurrency:this.maxConcurrency}}let F={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}};class D{props;workerPools=new Map;static _workerFarm;static isSupported(){return I.isSupported()}static getWorkerFarm(e={}){return D._workerFarm=D._workerFarm||new D({}),D._workerFarm.setProps(e),D._workerFarm}constructor(e){this.props={...F},this.setProps(e),this.workerPools=new Map}destroy(){for(let e of this.workerPools.values())e.destroy();this.workerPools=new Map}setProps(e){for(let t of(this.props={...this.props,...e},this.workerPools.values()))t.setProps(this._getWorkerPoolProps())}getWorkerPool(e){let{name:t,source:i,url:r}=e,s=this.workerPools.get(t);return s||((s=new N({name:t,source:i,url:r})).setProps(this._getWorkerPoolProps()),this.workerPools.set(t,s)),s}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}}async function B(e,t,i,r,s){let n=e.id,o=function(e,t={}){let i=t[e.id]||{},r=w?`${e.id}-worker.js`:`${e.id}-worker-node.js`,s=i.workerUrl;if(s||"compression"!==e.id||(s=t.workerUrl),"test"===(t._workerType||t?.core?._workerType)&&(s=w?`modules/${e.module}/dist/${r}`:`modules/${e.module}/src/workers/${e.id}-worker-node.ts`),!s){let t=e.version;"latest"===t&&(t="latest");let i=t?`@${t}`:"";s=`https://unpkg.com/@loaders.gl/${e.module}${i}/dist/${r}`}return A(s),s}(e,i),a=D.getWorkerFarm(i?.core).getWorkerPool({name:n,url:o});i=JSON.parse(JSON.stringify(i)),r=JSON.parse(JSON.stringify(r||{}));let l=await a.startJob("process-on-worker",G.bind(null,s));l.postMessage("process",{input:t,options:i,context:r});let h=await l.result;return await h.result}async function G(e,t,i,r){switch(i){case"done":t.done(r);break;case"error":t.error(Error(r.error));break;case"process":let{id:s,input:n,options:o}=r;try{let i=await e(n,o);t.postMessage("done",{id:s,result:i})}catch(i){let e=i instanceof Error?i.message:"unknown error";t.postMessage("error",{id:s,error:e})}break;
688default:console.warn(`parse-with-worker unknown message ${i}`)}}let k=(globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.4.3"),globalThis._loadersgl_.version);function U(e){return e&&"object"==typeof e&&e.isBuffer}function z(e){if(U(e)||e instanceof ArrayBuffer)return e;if((0,r.L8)(e))return V(e);if(ArrayBuffer.isView(e)){let t=e.buffer;return 0===e.byteOffset&&e.byteLength===e.buffer.byteLength?t:t.slice(e.byteOffset,e.byteOffset+e.byteLength)}if("string"==typeof e)return new TextEncoder().encode(e).buffer;if(e&&"object"==typeof e&&e._toArrayBuffer)return e._toArrayBuffer();throw Error("toArrayBuffer")}function j(e){if(e instanceof ArrayBuffer)return e;if((0,r.L8)(e))return V(e);let{buffer:t,byteOffset:i,byteLength:s}=e;return t instanceof ArrayBuffer&&0===i&&s===t.byteLength?t:V(t,i,s)}function V(e,t=0,i=e.byteLength-t){let r=new Uint8Array(e,t,i),s=new Uint8Array(r.length);return s.set(r),s.buffer}async function W(e){let t=[];for await(let i of e)t.push(function(e){if(e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e)){let{buffer:t,byteOffset:i,byteLength:r}=e;return $(t,i,r)}return $(e)}(i));return function(...e){var t=e;let i=t.map(e=>e instanceof ArrayBuffer?new Uint8Array(e):e),r=new Uint8Array(i.reduce((e,t)=>e+t.byteLength,0)),s=0;for(let e of i)r.set(e,s),s+=e.byteLength;return r.buffer}(...t)}function $(e,t=0,i=e.byteLength-t){let r=new Uint8Array(e,t,i),s=new Uint8Array(r.length);return s.set(r),s.buffer}async function*H(e,t){let i=t?.chunkSize||1048576,r=0;for(;r<e.size;){let t=r+i,s=await e.slice(r,t).arrayBuffer();r=t,yield s}}var q=i(96347);function K(e,t){return q.Bd?X(e,t):Y(e,t)}async function*X(e,t){let i,r=e.getReader();try{for(;;){let e=i||r.read();t?._streamReadAhead&&(i=r.read());let{done:s,value:n}=await e;if(s)return;yield z(n)}}catch(e){r.releaseLock()}}async function*Y(e,t){for await(let t of e)yield z(t)}let Z="Cannot convert supplied data type";async function Q(e,t,i){if("string"==typeof e||(0,r.B1)(e)){var s,n=e;if(t.text&&"string"==typeof n)return n;if(U(n)&&(n=n.buffer),(0,r.B1)(n)){let e=ArrayBuffer.isView(s=n)?s:new Uint8Array(s);return t.text&&!t.binary?new TextDecoder("utf8").decode(e):z(e)}throw Error(Z)}if((0,r.qf)(e)&&(e=await p(e)),(0,r.Sv)(e))return await g(e),t.binary?await e.arrayBuffer():await e.text();if((0,r.H1)(e)&&(e=function(e,t){if("string"==typeof e)return function*(e,t){let i=t?.chunkSize||262144,r=0,s=new TextEncoder;for(;r<e.length;){let t=Math.min(e.length-r,i),n=e.slice(r,r+t);r+=t,yield j(s.encode(n))}}(e,t);if(e instanceof ArrayBuffer)return function*(e,t={}){let{chunkSize:i=262144}=t,r=0;for(;r<e.byteLength;){let t=Math.min(e.byteLength-r,i),s=new ArrayBuffer(t),n=new Uint8Array(e,r,t);new Uint8Array(s).set(n),r+=t,yield s}}(e,t);if((0,r.qf)(e))return H(e,t);if((0,r.H1)(e))return K(e,t);if((0,r.Sv)(e)){let i=e.body;if(!i)throw Error("Readable stream not available on Response");return K(i,t)}throw Error("makeIterator")}(e,i)),(0,r.xZ)(e)||(0,r.Td)(e))return W(e);throw Error(Z)}var J=i(98328),ee=i(97517);let et="4.4.3",ei=et[0]>="0"&&et[0]<="9"?`v${et}`:"",er=function(){let e=new ee.hW({id:"loaders.gl"});return globalThis.loaders||={},globalThis.loaders.log=e,globalThis.loaders.version=ei,globalThis.probe||={},globalThis.probe.loaders=e,e}();var es=i(68456);let en=/\.([^.]+)$/;async function eo(e,t=[],i,s){if(!eh(e))return null;let n=(0,v.Rf)(i||{});if(n.core||={},e instanceof Response&&ea(e)){let i=el(await e.clone().text(),t,{...n,core:{...n.core,nothrow:!0}},s);if(i)return i}let o=el(e,t,{...n,core:{...n.core,nothrow:!0}},s);if(o)return o;if((0,r.qf)(e)&&(o=el(e=await e.slice(0,10).arrayBuffer(),t,n,s)),!o&&e instanceof Response&&ea(e)&&(o=el(await e.clone().text(),t,n,s)),!o&&!n.core.nothrow)throw Error(eu(e));return o}function ea(e){let t=f(e);return!!(t&&(t.startsWith("text/")||"application/json"===t||t.endsWith("+json")))}function el(e,t=[],i,r){if(!eh(e))return null;let n=(0,v.Rf)(i||{});if(n.core||={},t&&!Array.isArray(t))return(0,s.D)(t);let o=[];t&&(o=o.concat(t)),n.core.ignoreRegisteredLoaders||o.push(...(0,es.Ph)()),function(e){for(let t of e)(0,s.D)(t)}(o);let a=function(e,t,i,r){let s=d(e),n=f(e),o=(0,c.S3)(s)||r?.url,a=null,l="";return i?.core?.mimeType&&(a=ec(t,i?.core?.mimeType),l=`match forced by supplied MIME type ${i?.core?.mimeType}`),a=a||function(e,t){let i=t&&en.exec(t),r=i&&i[1];return r?function(e,t){for(let i of(t=t.toLowerCase(),e))for(let e of i.extensions)if(e.toLowerCase()===t)return i;return null}(e,r):null}(t,o),l=l||(a?`matched url ${o}`:""),a=a||ec(t,n),l=l||(a?`matched MIME type ${n}`:""),a=a||function(e,t){if(!t)return null;for(let i of e)if("string"==typeof t){if(function(e,t){return t.testText?t.testText(e):(Array.isArray(t.tests)?t.tests:[t.tests]).some(t=>e.startsWith(t))}(t,i))return i}else if(ArrayBuffer.isView(t)){if(ed(t.buffer,t.byteOffset,i))return i}else if(t instanceof ArrayBuffer&&ed(t,0,i))return i;return null}(t,e),l=l||(a?`matched initial data ${ef(e)}`:""),i?.core?.fallbackMimeType&&(a=a||ec(t,i?.core?.fallbackMimeType),l=l||(a?`matched fallback MIME type ${n}`:"")),l&&er.log(1,`selectLoader selected ${a?.name}: ${l}.`),a}(e,o,n,r);if(!a&&!n.core.nothrow)throw Error(eu(e));return a}function eh(e){return!(e instanceof Response)||204!==e.status}function eu(e){let t=d(e),i=f(e),r="No valid loader found (";r+=(t?`${J.iW(t)}, `:"no url provided, ")+`MIME type: ${i?`"${i}"`:"not provided"}, `;let s=e?ef(e):"";return r+((s?` first bytes: "${s}"`:"first bytes: not available")+")")}function ec(e,t){for(let i of e)if(i.mimeTypes?.some(e=>h(t,e))||h(t,`application/x.${i.id}`))return i;return null}function ed(e,t,i){return(Array.isArray(i.tests)?i.tests:[i.tests]).some(i=>(function(e,t,i,s){if((0,r.B1)(s))return function(e,t,i){if(i=i||e.byteLength,e.byteLength<i||t.byteLength<i)return!1;let r=new Uint8Array(e),s=new Uint8Array(t);for(let e=0;e<r.length;++e)if(r[e]!==s[e])return!1;return!0}(s,e,s.byteLength);switch(typeof s){case"function":return s(j(e));case"string":let n=ep(e,t,s.length);return s===n;default:return!1}})(e,t,0,i))}function ef(e,t=5){return"string"==typeof e?e.slice(0,t):ArrayBuffer.isView(e)?ep(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?ep(e,0,t):""}function ep(e,t,i){if(e.byteLength<t+i)return"";let r=new DataView(e),s="";for(let e=0;e<i;e++)s+=String.fromCharCode(r.getUint8(t+e));return s}async function eg(e,t,i,r){!t||Array.isArray(t)||(0,s.l)(t)||(r=void 0,i=t,t=void 0),e=await e,i=i||{};let n=d(e),o=function(e,t){let i;if(e&&!Array.isArray(e))return e;if(e&&(i=Array.isArray(e)?e:[e]),t&&t.loaders){let e=Array.isArray(t.loaders)?t.loaders:[t.loaders];i=i?[...i,...e]:e}return i&&i.length?i:void 0}(t,r),a=await eo(e,o,i);if(!a)return null;let l=(0,v.a5)(i,a,o,n);return r=function(e,t,i){if(i)return i;let r={fetch:b(t,e),...e};if(r.url){let e=(0,c.S3)(r.url);r.baseUrl=e,r.queryString=(0,c.by)(r.url),r.filename=J.iW(e),r.baseUrl=J.pD(e)}return Array.isArray(r.loaders)||(r.loaders=null),r}({url:n,_parse:eg,loaders:o},l,r||null),await em(a,e,l,r)}async function em(e,t,i,s){if(!function(e,t=k){A(e,"no worker provided");e.version}(e),i=function e(t,i,r=0){if(r>3)return i;let s={...t};for(let[t,n]of Object.entries(i))n&&"object"==typeof n&&!Array.isArray(n)?s[t]=e(s[t]||{},i[t],r+1):s[t]=i[t];return s}(e.options||{},i),(0,r.Sv)(t)){let{ok:e,redirected:i,status:r,statusText:n,type:o,url:a}=t;s.response={headers:Object.fromEntries(t.headers.entries()),ok:e,redirected:i,status:r,statusText:n,type:o,url:a}}if(t=await Q(t,e,i),e.parseTextSync&&"string"==typeof t)return e.parseTextSync(t,i,s);if(function(e,t){if(!D.isSupported())return!1;let i=t?._nodeWorkers??t?.core?._nodeWorkers;if(!w&&!i)return!1;let r=t?.worker??t?.core?.worker;return!!(e.worker&&r)}(e,i))return await B(e,t,i,s,eg);if(e.parseText&&"string"==typeof t)return await e.parseText(t,i,s);if(e.parse)return await e.parse(t,i,s);throw A(!e.parseSync),Error(`${e.id} loader - no parser found and worker is disabled`)}async function e_(e,t,i,n){let o,a;Array.isArray(t)||(0,s.l)(t)?(o=t,a=i):(o=[],a=t);let l=b(a),h=e;if("string"==typeof e&&(h=await l(e)),(0,r.qf)(e)&&(h=await l(e)),"string"==typeof e){let t=(0,v.Rf)(a||{});t.core?.baseUrl||(a={...a,core:{...a?.core,baseUrl:e}})}return Array.isArray(o),await eg(h,o,a)}},42678:()=>{},42846:(e,t,i)=>{"use strict";i.d(t,{_:()=>X});var r=i(46899),s=i(37114),n=i(90564);let o=[[/^(#version[ \t]+(100|300[ \t]+es))?[ \t]*\n/,"#version 300 es\n"],[/\btexture(2D|2DProj|Cube)Lod(EXT)?\(/g,"textureLod("],[/\btexture(2D|2DProj|Cube)(EXT)?\(/g,"texture("]],a=[...o,[u("attribute"),"in $1"],[u("varying"),"out $1"]],l=[...o,[u("varying"),"in $1"]];function h(e,t){for(let[i,r]of t)e=e.replace(i,r);return e}function u(e){return RegExp(`\\b${e}[ \\t]+(\\w+[ \\t]+\\w+(\\[\\w+\\])?;)`,"g")}function c(e,t){if(!e){let e=Error(t||"shadertools: assertion failed.");throw Error.captureStackTrace?.(e,c),e}}let d=/^(?:uniform\s+)?(?:(?:lowp|mediump|highp)\s+)?[A-Za-z0-9_]+(?:<[^>]+>)?\s+([A-Za-z0-9_]+)(?:\s*\[[^\]]+\])?\s*;/,f=/((?:layout\s*\([^)]*\)\s*)*)uniform\s+([A-Za-z_][A-Za-z0-9_]*)\s*\{([\s\S]*?)\}\s*([A-Za-z_][A-Za-z0-9_]*)?\s*;/g;function p(e){return`${e.name}Uniforms`}function g(e){let t=[];for(let i of e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/.*$/gm,"").matchAll(f)){let e=i[1]?.trim()||null;t.push({blockName:i[2],body:i[3],instanceName:i[4]||null,layoutQualifier:e,hasLayoutQualifier:!!e,isStd140:!!(e&&/\blayout\s*\([^)]*\bstd140\b[^)]*\)/.exec(e))})}return t}function m(e,t=8){if(e.length<=t)return e.join(", ");let i=e.length-t;return`${e.slice(0,t).join(", ")}, ... (${i} more)`}function _(e,t){let i="";for(let r in e){let s=e[r];if(i+=`void ${s.signature} { 689`,s.header&&(i+=` ${s.header}`),t[r]){let e=t[r];for(let t of(e.sort((e,t)=>
689e.order-t.order),e))i+=` ${t.injection} 690`}s.footer&&(i+=` ${s.footer}`),i+="}\n"}return i}function y(e){let t={vertex:{},fragment:{}};for(let i of e){let e,r;"string"!=typeof i?r=(e=i).hook:(e={},r=i);let[s,n]=(r=r.trim()).split(":"),o=r.replace(/\(.+/,""),a=Object.assign(e,{signature:n});switch(s){case"vs":t.vertex[o]=a;break;case"fs":t.fragment[o]=a;break;default:throw Error(s)}}return t}let v="(?:var<\\s*(uniform|storage(?:\\s*,\\s*[A-Za-z_][A-Za-z0-9_]*)?)\\s*>|var)\\s+([A-Za-z_][A-Za-z0-9_]*)",b=[RegExp(`@binding\\(\\s*(auto|\\d+)\\s*\\)\\s*@group\\(\\s*(\\d+)\\s*\\)\\s*${v}`,"g"),RegExp(`@group\\(\\s*(\\d+)\\s*\\)\\s*@binding\\(\\s*(auto|\\d+)\\s*\\)\\s*${v}`,"g")],E=[RegExp(`@binding\\(\\s*(auto|\\d+)\\s*\\)\\s*@group\\(\\s*(\\d+)\\s*\\)\\s*${v}`,"g"),RegExp(`@group\\(\\s*(\\d+)\\s*\\)\\s*@binding\\(\\s*(auto|\\d+)\\s*\\)\\s*${v}`,"g")],x=[RegExp(`@binding\\(\\s*(\\d+)\\s*\\)\\s*@group\\(\\s*(\\d+)\\s*\\)\\s*${v}`,"g"),RegExp(`@group\\(\\s*(\\d+)\\s*\\)\\s*@binding\\(\\s*(\\d+)\\s*\\)\\s*${v}`,"g")],w=[RegExp(`@binding\\(\\s*(auto)\\s*\\)\\s*@group\\(\\s*(\\d+)\\s*\\)\\s*${v}`,"g"),RegExp(`@group\\(\\s*(\\d+)\\s*\\)\\s*@binding\\(\\s*(auto)\\s*\\)\\s*${v}`,"g"),RegExp(`@binding\\(\\s*(auto)\\s*\\)\\s*@group\\(\\s*(\\d+)\\s*\\)(?:[\\s\\n\\r]*@[A-Za-z_][^\\n\\r]*)*[\\s\\n\\r]*${v}`,"g"),RegExp(`@group\\(\\s*(\\d+)\\s*\\)\\s*@binding\\(\\s*(auto)\\s*\\)(?:[\\s\\n\\r]*@[A-Za-z_][^\\n\\r]*)*[\\s\\n\\r]*${v}`,"g")];function S(e){let t=e.split(""),i=0,r=0,s=!1,n=!1,o=!1;for(;i<e.length;){let a=e[i],l=e[i+1];if(n){o?o=!1:"\\"===a?o=!0:'"'===a&&(n=!1),i++;continue}if(s){"\n"===a||"\r"===a?s=!1:t[i]=" ",i++;continue}if(r>0){if("/"===a&&"*"===l){t[i]=" ",t[i+1]=" ",r++,i+=2;continue}if("*"===a&&"/"===l){t[i]=" ",t[i+1]=" ",r--,i+=2;continue}"\n"!==a&&"\r"!==a&&(t[i]=" "),i++;continue}if('"'===a){n=!0,i++;continue}if("/"===a&&"/"===l){t[i]=" ",t[i+1]=" ",s=!0,i+=2;continue}if("/"===a&&"*"===l){t[i]=" ",t[i+1]=" ",r=1,i+=2;continue}i++}return t.join("")}function P(e,t){let i=S(e),r=[];for(let s of t){let n;for(s.lastIndex=0,n=s.exec(i);n;){let o=s===t[0],a=n.index,l=n[0].length;r.push({match:e.slice(a,a+l),index:a,length:l,bindingToken:n[o?1:2],groupToken:n[o?2:1],accessDeclaration:n[3]?.trim(),name:n[4]}),n=s.exec(i)}}return r.sort((e,t)=>e.index-t.index)}function T(e,t,i){let r=P(e,t);if(!r.length)return e;let s="",n=0;for(let t of r)s+=e.slice(n,t.index),s+=i(t),n=t.index+t.length;return s+e.slice(n)}function A(e){return/@binding\(\s*auto\s*\)/.test(S(e))}let M=[RegExp(`@binding\\(\\s*(\\d+)\\s*\\)\\s*@group\\(\\s*(\\d+)\\s*\\)\\s*${v}\\s*:\\s*([^;]+);`,"g"),RegExp(`@group\\(\\s*(\\d+)\\s*\\)\\s*@binding\\(\\s*(\\d+)\\s*\\)\\s*${v}\\s*:\\s*([^;]+);`,"g")];function C(e,t=[]){let i=S(e),r=new Map;for(let e of t)r.set(R(e.name,e.group,e.location),e.moduleName);let s=[];for(let e of M){let t;for(e.lastIndex=0,t=e.exec(i);t;){let n=e===M[0],o=Number(t[n?1:2]),a=Number(t[n?2:1]),l=t[3]?.trim(),h=t[4],u=t[5].trim(),c=r.get(R(h,a,o));s.push(function(e){var t;let i={name:e.name,group:e.group,binding:e.binding,owner:e.owner,kind:"unknown",moduleName:e.moduleName,resourceType:e.resourceType};if(e.accessDeclaration){let t=e.accessDeclaration.split(",").map(e=>e.trim());if("uniform"===t[0])return{...i,kind:"uniform",access:"uniform"};if("storage"===t[0]){let e=t[1]||"read_write";return{...i,kind:"read"===e?"read-only-storage":"storage",access:e}}}return"sampler"===e.resourceType||"sampler_comparison"===e.resourceType?{...i,kind:"sampler",samplerKind:"sampler_comparison"===e.resourceType?"comparison":"filtering"}:e.resourceType.startsWith("texture_storage_")?{...i,kind:"storage-texture",access:function(e){let t=/,\s*([A-Za-z_][A-Za-z0-9_]*)\s*>$/.exec(e);return t?.[1]}(e.resourceType),viewDimension:L(e.resourceType)}:e.resourceType.startsWith("texture_")?{...i,kind:"texture",viewDimension:L(e.resourceType),sampleType:(t=e.resourceType).startsWith("texture_depth_")?"depth":t.includes("<i32>")?"sint":t.includes("<u32>")?"uint":t.includes("<f32>")?"float":void 0,multisampled:e.resourceType.startsWith("texture_multisampled_")}:i}({name:h,group:a,binding:o,owner:c?"module":"application",moduleName:c,accessDeclaration:l,resourceType:u})),t=e.exec(i)}}return s.sort((e,t)=>
690e.group!==t.group?e.group-t.group:e.binding!==t.binding?e.binding-t.binding:e.name.localeCompare(t.name))}function R(e,t,i){return`${t}:${i}:${e}`}function L(e){return e.includes("cube_array")?"cube-array":e.includes("2d_array")?"2d-array":e.includes("cube")?"cube":e.includes("3d")?"3d":e.includes("2d")?"2d":e.includes("1d")?"1d":void 0}let I=` 691 692${n.O_} 693`,O=`\ 694precision highp float; 695`;function N(e,t){let{source:i,stage:s,language:o="glsl",modules:u,defines:d={},hookFunctions:f=[],inject:p={},prologue:m=!0,log:v}=t;c("string"==typeof i,"shader source must be a string");let b="glsl"===o?({name:function(e,t="unnamed"){let i=/#define[^\S\r\n]*SHADER_NAME[^\S\r\n]*([A-Za-z0-9_-]+)\s*/.exec(e);return i?i[1]:t}(i,void 0),language:"glsl",version:function(e){let t=100,i=e.match(/[^\s]+/g);if(i&&i.length>=2&&"#version"===i[0]){let e=parseInt(i[1],10);Number.isFinite(e)&&(t=e)}if(100!==t&&300!==t)throw Error(`Invalid GLSL version ${t}`);return t}(i)}).version:-1,E=e.shaderLanguageVersion,x=100===b?"#version 100":"#version 300 es",w=i.split("\n").slice(1).join("\n"),S={};u.forEach(e=>{Object.assign(S,e.defines)}),Object.assign(S,d);let P="";switch(o){case"wgsl":break;case"glsl":P=m?`\ 696${x} 697 698// ----- PROLOGUE ------------------------- 699#define SHADER_TYPE_${s.toUpperCase()} 700 701${function(e){switch(e?.gpu.toLowerCase()){case"apple":return`\ 702#define APPLE_GPU 703// Apple optimizes away the calculation necessary for emulated fp64 704#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1 705#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1 706// Intel GPU doesn't have full 32 bits precision in same cases, causes overflow 707#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1 708`;case"nvidia":return`\ 709#define NVIDIA_GPU 710// Nvidia optimizes away the calculation necessary for emulated fp64 711#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1 712`;case"intel":return`\ 713#define INTEL_GPU 714// Intel optimizes away the calculation necessary for emulated fp64 715#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1 716// Intel's built-in 'tan' function doesn't have acceptable precision 717#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1 718// Intel GPU doesn't have full 32 bits precision in same cases, causes overflow 719#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1 720`;case"amd":return`\ 721#define AMD_GPU 722`;default:return`\ 723#define DEFAULT_GPU 724// Prevent driver from optimizing away the calculation necessary for emulated fp64 725#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1 726// Headless Chrome's software shader 'tan' function doesn't have acceptable precision 727#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1 728// If the GPU doesn't have full 32 bits precision, will causes overflow 729#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1 730`}}(e)} 731${"fragment"===s?O:""} 732 733// ----- APPLICATION DEFINES ------------------------- 734 735${function(e={}){let t="";for(let i in e){let r=e[i];(r||Number.isFinite(r))&&(t+=`#define ${i.toUpperCase()} ${e[i]} 736`)}return t}(S)} 737 738`:`${x} 739`}let T=y(f),A={},M={},C={};for(let e in p){let t="string"==typeof p[e]?{injection:p[e],order:0}:p[e],i=/^(v|f)s:(#)?([\w-]+)$/.exec(e);if(i){let r=i[2],s=i[3];r?"decl"===s?M[e]=[t]:C[e]=[t]:A[e]=[t]}else C[e]=[t]}for(let e of u){v&&(0,r.ZG)(e,w,v),P+=D(e,s,v);let t=e.instance?.normalizedInjections[s]||{};for(let e in t){let i=/^(v|f)s:#([\w-]+)$/.exec(e);if(i){let r="decl"===i[2]?M:C;r[e]=r[e]||[],r[e].push(t[e])}else A[e]=A[e]||[],A[e].push(t[e])}}return P+="// ----- MAIN SHADER SOURCE -------------------------",P+=I,P=(0,n.bv)(P,s,M)+_(T[s],A)+w,P=(0,n.bv)(P,s,C),"glsl"===o&&b!==E&&(P=function(e,t){if(300!==Number(e.match(/^#version[ \t]+(\d+)/m)?.[1]||100))throw Error("luma.gl v9 only supports GLSL 3.00 shader sources");switch(t){case"vertex":return h(e,a);case"fragment":return h(e,l);default:throw Error(t)}}(P,s)),"glsl"===o&&function(e,t,i,r){let s=g(e).filter(e=>!e.isStd140),n=new Set;for(let e of s){if(n.has(e.blockName))continue;n.add(e.blockName);let r=e.hasLayoutQualifier?`declares ${e.layoutQualifier.replace(/\s+/g," ").trim()} instead of layout(std140)`:"does not declare layout(std140)",s=`${t} shader uniform block ${e.blockName} ${r}. luma.gl host-side shader block packing assumes explicit layout(std140) for GLSL uniform blocks. Add \`layout(std140)\` to the block declaration.`;i?.warn?.(s,e)()}}(P,s,v),P.trim()}function F(e){return function(t){let i={};for(let r of e){let e=r.getUniforms?.(t,i);Object.assign(i,e)}return i}}function D(e,t,i){let r;switch(t){case"vertex":r=e.vs||"";break;case"fragment":r=e.fs||"";break;case"wgsl":r=e.source||"";break;default:c(!1)}if(!e.name)throw Error("Shader module must have a name");!function(e,t,i={}){let r=function(e,t){let i=Object.keys(e.uniformTypes||{});if(!i.length)return null;let r=function(e,t){let i="wgsl"===t?e.source:"vertex"===t?e.vs:e.fs;return i?function(e,t,i){let r="wgsl"===t?function(e,t){let i=RegExp(`\\bstruct\\s+${t}\\b`,"m").exec(e);if(!i)return null;let r=e.indexOf("{",i.index);if(r<0)return null;let s=0;for(let t=r;t<e.length;t++){let i=e[t];if("{"===i){s++;continue}if("}"===i&&0==--s)return e.slice(r+1,t)}return null}(e,i):function(e,t){let i=g(e).find(e=>e.blockName===t);return i?.body||null}(e,i);if(!r)return null;let s=[];for(let e of r.split("\n")){let i=e.replace(/\/\/.*$/,"").trim();if(!i||i.startsWith("#"))continue;let r="wgsl"===t?i.match(/^([A-Za-z0-9_]+)\s*:/):i.match(d);r&&s.push(r[1])}return s}(i,"wgsl"===t?"wgsl":"glsl",p(e)):null}(e,t);return r?{moduleName:e.name,uniformBlockName:p(e),stage:t,expectedUniformNames:i,actualUniformNames:r,matches:function(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0}(i,r)}:null}(e,t);if(!r||r.matches)return;let s=function(e){let{expectedUniformNames:t,actualUniformNames:i}=e,r=t.filter(e=>!i.includes(e)),s=i.filter(e=>!t.includes(e)),n=[`Expected ${t.length} fields, found ${i.length}.`],o=function(e,t){let i=Math.min(e.length,t.length);for(let r=0;r<i;r++)if(e[r]!==t[r])return`First mismatch at field ${r+1}: expected ${e[r]}, found ${t[r]}.`;return e.length>t.length?`Shader block ends after field ${t.length}; expected next field ${e[t.length]}.`:t.length>e.length?`Shader block has extra field ${t.length}: ${t[e.length]}.`:null}(t,i);return o&&n.push(o),r.length&&n.push(`Missing from shader block (${r.length}): ${m(r)}.`),s.length&&n.push(`Unexpected in shader block (${s.length}): ${m(s)}.`),t.length<=12&&i.length<=12&&(r.length||s.length)&&(n.push(`Expected: ${t.join(", ")}.`),n.push(`Actual: ${i.join(", ")}.`)),`${e.moduleName}: ${e.stage} shader uniform block ${e.uniformBlockName} does not match module.uniformTypes. ${n.join(" ")}`}(r);i.log?.error?.(s,r)(),!1!==i.throwOnError&&c(!1,s)}(e,t,{log:i});let s=e.name.toUpperCase().replace(/[^0-9a-z]/gi,"_"),n=`\ 740// ----- MODULE ${e.name} --------------- 741 742`;return"wgsl"!==t&&(n+=`#define MODULE_${s} 743`),n+=`${r} 744`}function B(e,t,i){if(0===e&&t>=100)throw Error(`Application binding "${i}" in group 0 uses reserved binding ${t}. Application-owned explicit group-0 bindings must stay below 100.`)}function G(e,t,i,r){if(0===t&&i<100)throw Error(`Module "${e}" binding "${r}" in group 0 uses reserved application binding ${i}. Module-owned explicit group-0 bindings must be 100 or higher.`)}function k(e,t,i,r){let s=e.get(t)||new Set;if(s.has(i))throw Error(`Duplicate WGSL binding assignment for ${r}: group ${t}, binding ${i}.`);s.add(i),e.set(t,s)}function U(e,t,i){let r=t.get(e)||new Set,s=i??(0===e?100:r.size>0?Math.max(...r)+1:0);for(;r.has(s);)s++;return s}function z(e,t,i){return`${e}:${t}:${i}`}let j="([a-zA-Z_][a-zA-Z0-9_]*)",V=RegExp(`^\\s*\\#\\s*ifdef\\s*${j}\\s*$`),W=RegExp(`^\\s*\\#\\s*ifndef\\s*${j}\\s*(?:\\/\\/.*)?$`),$=/^\s*\#\s*else\s*(?:\/\/.*)?$/,H=/^\s*\#\s*endif\s*$/,q=RegExp(`^\\s*\\#\\s*ifdef\\s*${j}\\s*(?:\\/\\/.*)?$`),K=/^\s*\#\s*endif\s*(?:\/\/.*)?$/;class X{static defaultShaderAssembler;_hookFunctions=[];_defaultModules=[];_wgslBindingRegistry=new Map;static getDefaultShaderAssembler(){return X.defaultShaderAssembler=X.defaultShaderAssembler||new X,X.defaultShaderAssembler}addDefaultModule(e){this._defaultModules.find(t=>t.name===("string"==typeof e?e:e.name))||this._defaultModules.push(e)}removeDefaultModule(e){let t="string"==typeof e?e:e.name;this._defaultModules=this._defaultModules.filter(e=>e.name!==t)}addShaderHook(e,t){t&&(e=Object.assign(t,{hook:e})),this._hookFunctions.push(e)}assembleWGSLShader(e){let t=this._getModuleList(e.modules),i=this._hookFunctions,{source:o,getUniforms:a,bindingAssignments:l}=function(e){let t=(0,s.$Q)(e.modules||[]),{source:i,bindingAssignments:o}=function(e,t){let{source:i,stage:s,modules:o,hookFunctions:a=[],inject:l={},log:h}=t;
744c("string"==typeof i,"shader source must be a string");let u="",d=y(a),f={},p={},g={};for(let e in l){let t="string"==typeof l[e]?{injection:l[e],order:0}:l[e],i=/^(v|f)s:(#)?([\w-]+)$/.exec(e);if(i){let r=i[2],s=i[3];r?"decl"===s?p[e]=[t]:g[e]=[t]:f[e]=[t]}else g[e]=[t]}let m=function(e){let t=P(e,E),i=new Map;for(let e of t){if("auto"===e.bindingToken)continue;let t=Number(e.bindingToken),r=Number(e.groupToken);B(r,t,e.name),k(i,r,t,`application binding "${e.name}"`)}let r={sawSupportedBindingDeclaration:t.length>0},s=T(e,E,e=>(function(e,t,i){let{match:r,bindingToken:s,groupToken:n,name:o}=e,a=Number(n);if("auto"===s){let e=function(e,t){let i=t.get(e)||new Set,r=0;for(;i.has(r);)r++;return r}(a,t);return B(a,e,o),k(t,a,e,`application binding "${o}"`),r.replace(/@binding\(\s*auto\s*\)/,`@binding(${e})`)}return i.sawSupportedBindingDeclaration=!0,r})(e,i,r));if(A(e)&&!r.sawSupportedBindingDeclaration)throw Error('Unsupported @binding(auto) declaration form in application WGSL. Use adjacent "@group(N)" and "@binding(auto)" decorators followed by a bindable "var" declaration.');return{source:s}}(i),v=function(e){let t=new Map;for(let i of P(e,x)){let e=Number(i.bindingToken),r=Number(i.groupToken);B(r,e,i.name),k(t,r,e,`application binding "${i.name}"`)}return t}(m.source),S=function(e,t,i){let r=new Map;if(!t)return r;for(let s of e)for(let e of function(e){let t=[];for(let i of P(e.source||"",b))t.push({name:i.name,group:Number(i.groupToken)});return t}(s)){let n=z(e.group,s.name,e.name),o=t.get(n);if(void 0!==o){let t=r.get(e.group)||new Map,s=t.get(o);if(s&&s!==n)throw Error(`Duplicate WGSL binding reservation for modules "${s}" and "${n}": group ${e.group}, binding ${o}.`);k(i,e.group,o,`registered module binding "${n}"`),t.set(o,n),r.set(e.group,t)}}return r}(o,t._bindingRegistry,v),M=[];for(let e of o){h&&(0,r.ZG)(e,i,h);let n=function(e,t,i){let r=[],s={sawSupportedBindingDeclaration:P(e,b).length>0,nextHintedBindingLocation:"number"==typeof t.firstBindingSlot?t.firstBindingSlot:null},n=T(e,b,e=>(function(e,t){let{module:i,context:r,bindingAssignments:s,relocationState:n}=t,{match:o,bindingToken:a,groupToken:l,name:h}=e,u=Number(l);if("auto"===a){let e=z(u,i.name,h),t=r.bindingRegistry?.get(e),a=void 0!==t?t:null===n.nextHintedBindingLocation?U(u,r.usedBindingsByGroup):U(u,r.usedBindingsByGroup,n.nextHintedBindingLocation);return(G(i.name,u,a,h),void 0!==t&&function(e,t,i,r){let s=e.get(t);if(!s)return!1;let n=s.get(i);if(!n)return!1;if(n!==r)throw Error(`Registered module binding "${r}" collided with "${n}": group ${t}, binding ${i}.`);return!0}(r.reservedBindingKeysByGroup,u,a,e))?s.push({moduleName:i.name,name:h,group:u,location:a}):(k(r.usedBindingsByGroup,u,a,`module "${i.name}" binding "${h}"`),r.bindingRegistry?.set(e,a),s.push({moduleName:i.name,name:h,group:u,location:a}),null!==n.nextHintedBindingLocation&&void 0===t&&(n.nextHintedBindingLocation=a+1)),o.replace(/@binding\(\s*auto\s*\)/,`@binding(${a})`)}let c=Number(a);return G(i.name,u,c,h),k(r.usedBindingsByGroup,u,c,`module "${i.name}" binding "${h}"`),s.push({moduleName:i.name,name:h,group:u,location:c}),o})(e,{module:t,context:i,bindingAssignments:r,relocationState:s}));if(A(e)&&!s.sawSupportedBindingDeclaration)throw Error(`Unsupported @binding(auto) declaration form in module "${t.name}". Use adjacent "@group(N)" and "@binding(auto)" decorators followed by a bindable "var" declaration.`);return{source:n,bindingAssignments:r}}(D(e,"wgsl",h),e,{usedBindingsByGroup:v,bindingRegistry:t._bindingRegistry,reservedBindingKeysByGroup:S}
744);M.push(...n.bindingAssignments),u+=n.source;let o=e.injections?.[s]||{};for(let e in o){let t=/^(v|f)s:#([\w-]+)$/.exec(e);if(t){let i="decl"===t[2]?p:g;i[e]=i[e]||[],i[e].push(o[e])}else f[e]=f[e]||[],f[e].push(o[e])}}return u+=I,u=(0,n.bv)(u,s,p)+_(d[s],f)+function(e){if(0===e.length)return"";let t="// ----- MODULE WGSL BINDING ASSIGNMENTS ---------------\n";for(let i of e)t+=`// ${i.moduleName}.${i.name} -> @group(${i.group}) @binding(${i.location}) 745`;return t+"\n"}(M)+m.source,function(e){let t=P(e,b==b||b===E?w:b).find(e=>"auto"===e.bindingToken);if(!t)return;let i=function(e,t){let i,r,s=/^\/\/ ----- MODULE ([^\n]+) ---------------$/gm;for(r=s.exec(e);r&&r.index<=t;)i=r[1],r=s.exec(e);return i}(e,t.index);if(i)throw Error(`Unresolved @binding(auto) for module "${i}" binding "${t.name}" remained in assembled WGSL source.`);if(function(e,t){let i=e.indexOf(I);return!(i>=0)||t>i}(e,t.index))throw Error(`Unresolved @binding(auto) for application binding "${t.name}" remained in assembled WGSL source.`);throw Error(`Unresolved @binding(auto) remained in assembled WGSL source near "${t.match.replace(/\s+/g," ").trim()}".`)}(u=(0,n.bv)(u,s,g)),{source:u,bindingAssignments:M}}(e.platformInfo,{...e,source:e.source,stage:"vertex",modules:t});return{source:i,getUniforms:F(t),bindingAssignments:o,bindingTable:C(i,o)}}({...e,source:e.source,_bindingRegistry:this._wgslBindingRegistry,modules:t,hookFunctions:i}),h={...t.reduce((e,t)=>(Object.assign(e,t.defines),e),{}),...e.defines},u="wgsl"===e.platformInfo.shaderLanguage?function(e,t){let i=e.split("\n"),r=[],s=[],n=!0;for(let e of i){let i=e.match(q)||e.match(V),o=e.match(W),a=e.match($),l=e.match(K)||e.match(H);if(i||o){let e=(i||o)?.[1],r=!!t?.defines?.[e],a=i?r:!r,l=n&&a;s.push({parentActive:n,branchTaken:a,active:l}),n=l}else if(a){let e=s[s.length-1];if(!e)throw Error("Encountered #else without matching #ifdef or #ifndef");e.active=e.parentActive&&!e.branchTaken,e.branchTaken=!0,n=e.active}else l?(s.pop(),n=!s.length||s[s.length-1].active):n&&r.push(e)}if(s.length>0)throw Error("Unterminated conditional block in shader source");return r.join("\n")}(o,{defines:h}):o;return{source:u,getUniforms:a,modules:t,bindingAssignments:l,bindingTable:C(u,l)}}assembleGLSLShaderPair(e){let t=this._getModuleList(e.modules),i=this._hookFunctions;return{...function(e){let{vs:t,fs:i}=e,r=(0,s.$Q)(e.modules||[]);return{vs:N(e.platformInfo,{...e,source:t,stage:"vertex",modules:r}),fs:N(e.platformInfo,{...e,source:i,stage:"fragment",modules:r}),getUniforms:F(r)}}({...e,vs:e.vs,fs:e.fs,modules:t,hookFunctions:i}),modules:t}}_getModuleList(e=[]){let t=Array(this._defaultModules.length+e.length),i={},s=0;for(let e=0,r=this._defaultModules.length;e<r;++e){let r=this._defaultModules[e],n=r.name;t[s++]=r,i[n]=!0}for(let r=0,n=e.length;r<n;++r){let n=e[r],o=n.name;i[o]||(t[s++]=n,i[o]=!0)}return t.length=s,(0,r.$g)(t),t}}},42906:(e,t,i)=>{"use strict";function r(e){return"undefined"!=typeof ImageData&&e instanceof ImageData||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLVideoElement&&e instanceof HTMLVideoElement||"undefined"!=typeof VideoFrame&&e instanceof VideoFrame||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas}function s(e){if("undefined"!=typeof ImageData&&e instanceof ImageData||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas)return{width:e.width,height:e.height};if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement)return{width:e.naturalWidth,height:e.naturalHeight};if("undefined"!=typeof HTMLVideoElement&&e instanceof HTMLVideoElement)return{width:e.videoWidth,height:e.videoHeight};if("undefined"!=typeof VideoFrame&&e instanceof VideoFrame)return{width:e.displayWidth,height:e.displayHeight};throw Error("Unknown image type")}i.d(t,{c:()=>s,x:()=>r})},43406:(e,t,i)=>{"use strict";i.d(t,{A:()=>s});let r="#define SMOOTH_EDGE_RADIUS 0.5",s={name:"geometry",source:`\ 746const SMOOTH_EDGE_RADIUS: f32 = 0.5; 747 748struct VertexGeometry { 749 position: vec4<f32>, 750 worldPosition: vec3<f32>, 751 worldPositionAlt: vec3<f32>, 752 normal: vec3<f32>, 753 uv: vec2<f32>, 754 pickingColor: vec3<f32>, 755}; 756 757var<private> geometry_: VertexGeometry = VertexGeometry( 758 vec4<f32>(0.0, 0.0, 1.0, 0.0), 759 vec3<f32>(0.0, 0.0, 0.0), 760 vec3<f32>(0.0, 0.0, 0.0), 761 vec3<f32>(0.0, 0.0, 0.0), 762 vec2<f32>(0.0, 0.0), 763 vec3<f32>(0.0, 0.0, 0.0) 764); 765 766struct FragmentGeometry { 767 uv: vec2<f32>, 768}; 769 770var<private> fragmentGeometry: FragmentGeometry; 771 772fn smoothedge(edge: f32, x: f32) -> f32 { 773 return smoothstep(edge - SMOOTH_EDGE_RADIUS, edge + SMOOTH_EDGE_RADIUS, x); 774} 775`,vs:`\ 776${r} 777 778struct VertexGeometry { 779 vec4 position; 780 vec3 worldPosition; 781 vec3 worldPositionAlt; 782 vec3 normal; 783 vec2 uv; 784 vec3 pickingColor; 785} geometry = VertexGeometry( 786 vec4(0.0, 0.0, 1.0, 0.0), 787 vec3(0.0), 788 vec3(0.0), 789 vec3(0.0), 790 vec2(0.0), 791 vec3(0.0) 792); 793`,fs:`\ 794${r} 795 796struct FragmentGeometry { 797 vec2 uv; 798} geometry; 799 800float smoothedge(float edge, float x) { 801 return smoothstep(edge - SMOOTH_EDGE_RADIUS, edge + SMOOTH_EDGE_RADIUS, x); 802} 803`}},44168:(e,t,i)=>{"use strict";i.d(t,{_G:()=>h,ic:()=>l,k2:()=>u});var r=i(79904),s=i(36286),n=i(29884);let o=null,a=!1,l={debugSpectorJS:r.R.get("debug-spectorjs"),debugSpectorJSUrl:"https://cdn.jsdelivr.net/npm/[email protected]/dist/spector.bundle.js",gl:void 0};async function h(e){if(!globalThis.SPECTOR)try{await (0,s.k)(e.debugSpectorJSUrl||l.debugSpectorJSUrl)}catch(e){r.R.warn(String(e))}}function u(e){if(!(e={...l,...e}).debugSpectorJS)return null;if(!o&&globalThis.SPECTOR&&!globalThis.luma?.spector){r.R.probe(1,"SPECTOR foun
803d and initialized. Start with `luma.spector.displayUI()`")();let{Spector:e}=globalThis.SPECTOR;o=new e,globalThis.luma&&(globalThis.luma.spector=o)}if(!o)return null;if(a||(a=!0,o.spyCanvases(),o?.onCaptureStarted.add(e=>r.R.info("Spector capture started:",e)()),o?.onCapture.add(e=>{r.R.info("Spector capture complete:",e)(),o?.getResultUI(),o?.resultView.display(),o?.resultView.addCapture(e)})),e.gl){let t=e.gl,i=(0,n.V)(t),s=i.device;o?.startCapture(e.gl,500),i.device=s,new Promise(e=>setTimeout(e,2e3)).then(e=>{r.R.info("Spector capture stopped after 2 seconds")(),o?.stopCapture()})}return o}},45408:(e,t,i)=>{"use strict";e.exports=i.p+"static/media/all.csv.110c22a6.gz"},46899:(e,t,i)=>{"use strict";i.d(t,{ZG:()=>o,$g:()=>function e(t){t.map(t=>(function(t){var i;if(t.instance)return;e(t.dependencies||[]);let{propTypes:o={},deprecations:a=[],inject:l={}}=t,h={normalizedInjections:(0,n.Uu)(l),parsedDeprecations:((i=a).forEach(e=>{"function"===e.type?e.regex=RegExp(`\\b${e.old}\\(`):e.regex=RegExp(`${e.type} ${e.old};`)}),i)};o&&(h.propValidators=function(e){let t={};for(let[i,n]of Object.entries(e))t[i]=function(e){let t=s(e);if("object"!==t)return{value:e,...r[t],type:t};if("object"==typeof e)return e?void 0!==e.type?{...e,...r[e.type],type:e.type}:void 0===e.value?{type:"object",value:e}:(t=s(e.value),{...e,...r[t],type:t}):{type:"object",value:null};throw Error("props")}(n);return t}(o)),t.instance=h;let u={};o&&(u=Object.entries(o).reduce((e,[t,i])=>{let r=i?.value;return r&&(e[t]=r),e},{})),t.defaultUniforms={...t.defaultUniforms,...u}})(t))}});let r={number:{type:"number",validate:(e,t)=>Number.isFinite(e)&&"object"==typeof t&&(void 0===t.max||e<=t.max)&&(void 0===t.min||e>=t.min)},array:{type:"array",validate:(e,t)=>Array.isArray(e)||ArrayBuffer.isView(e)}};function s(e){return Array.isArray(e)||ArrayBuffer.isView(e)?"array":typeof e}var n=i(90564);function o(e,t,i){e.deprecations?.forEach(e=>{e.regex?.test(t)&&(e.deprecated?i.deprecated(e.old,e.new)():i.removed(e.old,e.new)())})}},47694:(e,t,i)=>{"use strict";i.d(t,{Uz:()=>o});var r=i(40459);function s(){let e;if("undefined"!=typeof window&&window.performance)e=window.performance.now();else if(void 0!==r&&r.hrtime){let t=r.hrtime();e=1e3*t[0]+t[1]/1e6}else e=Date.now();return e}class n{constructor(e,t){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=e,this.type=t,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(e){return this.sampleSize=e,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(e){return this._count+=e,this._samples++,this._checkSampling(),this}subtractCount(e){return this._count-=e,this._samples++,this._checkSampling(),this}addTime(e){return this._time+=e,this.lastTiming=e,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=s(),this._timerPending=!0,this}timeEnd(){return this._timerPending&&(this.addTime(s()-this._startTime),this._timerPending=!1,this._checkSampling()),this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}}class o{constructor(e){this.stats={},this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e,t="count"){return this._getOrCreate({name:e,type:t})}get size(){return Object.keys(this.stats).length}reset(){for(let e of Object.values(this.stats))e.reset();return this}forEach(e){for(let t of Object.values(this.stats))e(t)}getTable(){let e={};return this.forEach(t=>{e[t.name]={time:t.time||0,count:t.count||0,average:t.getAverageTime()||0,hz:t.getHz()||0}}),e}
803_initializeStats(e=[]){e.forEach(e=>this._getOrCreate(e))}_getOrCreate(e){let{name:t,type:i}=e,r=this.stats[t];return r||(r=e instanceof n?e:new n(t,i),this.stats[t]=r),r}}},47941:(e,t,i)=>{"use strict";function r(e,t){switch(t){case 1:return e;case 2:return e+e%2;default:return e+(4-e%4)%4}}function s(e){let[,,,,t]=n[e];return t}i.d(t,{Ak:()=>s,JP:()=>r});let n={uint8:["uint8","u32",1,!1,Uint8Array],sint8:["sint8","i32",1,!1,Int8Array],unorm8:["uint8","f32",1,!0,Uint8Array],snorm8:["sint8","f32",1,!0,Int8Array],uint16:["uint16","u32",2,!1,Uint16Array],sint16:["sint16","i32",2,!1,Int16Array],unorm16:["uint16","u32",2,!0,Uint16Array],snorm16:["sint16","i32",2,!0,Int16Array],float16:["float16","f16",2,!1,Uint16Array],float32:["float32","f32",4,!1,Float32Array],uint32:["uint32","u32",4,!1,Uint32Array],sint32:["sint32","i32",4,!1,Int32Array]}},48064:(e,t,i)=>{"use strict";i.d(t,{Ay:()=>a,lG:()=>n,uN:()=>o});var r=i(71513);function s(e,t){return function(i){return e+i*t}}function n(e,t){var i=t-e;return i?s(e,i>180||i<-180?i-360*Math.round(i/360):i):(0,r.A)(isNaN(e)?t:e)}function o(e){return 1==(e*=1)?a:function(t,i){var s,n,o;return i-t?(s=t,n=i,s=Math.pow(s,o=e),n=Math.pow(n,o)-s,o=1/o,function(e){return Math.pow(s+e*n,o)}):(0,r.A)(isNaN(t)?i:t)}}function a(e,t){var i=t-e;return i?s(e,i):(0,r.A)(isNaN(e)?t:e)}},50246:e=>{e.exports=function(e){if(!e||!e.type)return null;var i=t[e.type];return i?"geometry"===i?{type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:e}]}:"feature"===i?{type:"FeatureCollection",features:[e]}:"featurecollection"===i?e:void 0:null};var t={Point:"geometry",MultiPoint:"geometry",LineString:"geometry",MultiLineString:"geometry",Polygon:"geometry",MultiPolygon:"geometry",GeometryCollection:"geometry",Feature:"feature",FeatureCollection:"featurecollection"}},51910:(e,t,i)=>{"use strict";i.d(t,{B1:()=>o,Gv:()=>r,H1:()=>c,L8:()=>n,Sv:()=>h,Td:()=>l,aC:()=>s,qf:()=>u,xZ:()=>a});let r=e=>null!==e&&"object"==typeof e,s=e=>r(e)&&e.constructor===({}).constructor,n=e=>"undefined"!=typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer,o=e=>r(e)&&"number"==typeof e.byteLength&&"function"==typeof e.slice,a=e=>!!e&&"function"==typeof e[Symbol.iterator],l=e=>!!e&&"function"==typeof e[Symbol.asyncIterator],h=e=>"undefined"!=typeof Response&&e instanceof Response||r(e)&&"function"==typeof e.arrayBuffer&&"function"==typeof e.text&&"function"==typeof e.json,u=e=>"undefined"!=typeof Blob&&e instanceof Blob,c=e=>(e=>"undefined"!=typeof ReadableStream&&e instanceof ReadableStream||r(e)&&"function"==typeof e.tee&&"function"==typeof e.cancel&&"function"==typeof e.getReader)(e)||(e=>r(e)&&"function"==typeof e.read&&"function"==typeof e.pipe&&"boolean"==typeof e.readable)(e)},54059:(e,t,i)=>{"use strict";i.d(t,{P:()=>o,l:()=>n,xy:()=>a});var r=i(97681),s=i(57981);function n({modelTiepoint:e,modelPixelScale:t,modelTransformation:i,rasterType:n}){let o;if(e&&t)o=function(e,t){let i=e[3],r=e[4];return[t[0],0,i,0,-t[1],r]}(e,t);else if(i)o=function(e){let t=e[3],i=e[7],r=e[1],s=e[4];return[e[0],r,t,s,e[5],i]}(i);else throw Error("The image does not have an affine transformation.");return n===r.jE.PixelIsPoint&&(o=(0,s.Zz)(o,(0,s.wT)(-.5,-.5))),o}function o(e,t,i,r=Math.floor){let n=(0,s.B8)(e.transform),[a,l]=(0,s.Bb)(n,t,i);return[r(l),r(a)]}function a(e,t,i,r="center"){let n,o;switch(r){case"center":n=i+.5,o=t+.5;break;case"ul":n=i,o=t;break;case"ur":n=i+1,o=t;break;case"ll":n=i,o=t+1;break;case"lr":n=i+1,o=t+1}return(0,s.Bb)(e.transform,n,o)}},57981:(e,t,i)=>{"use strict";function r(e,t){return[1,0,e,0,1,t]}function s(e,t=e){return[e,0,0,0,t,0]}function n([e,t,i,r,s,n],o,a){return[e*o+t*a+i,r*o+s*a+n]}function o([e,t,i,r,s,n],[o,a,l,h,u,c]){return[e*o+t*h,e*a+t*u,e*l+t*c+i,r*o+s*h,r*a+s*u,r*l+s*c+n]}function a([e,t,i,r,s,n]){let o=e*s-t*r;if(0===o)throw Error("Cannot invert degenerate transform");let a=1/o,l=s*a,h=-t*a,u=-r*a,c=e*a;return[l,h,-i*l-n*h,u,c,-i*u-n*c]}function l(e){return e[0]}function h(e){return e[4]}i.d(t,{B8:()=>a,Bb:()=>n,Zz:()=>o,a:()=>l,e:()=>h,hs:()=>s,wT:()=>r})},58280:e=>{"use strict";function t(e,t){this.x=e,this.y=t}e.exports=t,t.prototype={clone:function(){return new t(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)}
803,rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,i=e.y-this.y;return t*t+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[0]*this.x+e[1]*this.y,i=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=i,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),i=Math.sin(e),r=t*this.x-i*this.y,s=i*this.x+t*this.y;return this.x=r,this.y=s,this},_rotateAround:function(e,t){var i=Math.cos(e),r=Math.sin(e),s=t.x+i*(this.x-t.x)-r*(this.y-t.y),n=t.y+r*(this.x-t.x)+i*(this.y-t.y);return this.x=s,this.y=n,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},t.convert=function(e){return e instanceof t?e:Array.isArray(e)?new t(e[0],e[1]):e}},60154:(e,t,i)=>{"use strict";i.d(t,{F:()=>c});var r=i(504);let s="GPU Resource Counts",n="Resource Counts",o="GPU Time and Memory",a=["Resources","Buffers","Textures","Samplers","TextureViews","Framebuffers","QuerySets","Shaders","RenderPipelines","ComputePipelines","PipelineLayouts","VertexArrays","RenderPasss","ComputePasss","CommandEncoders","CommandBuffers"].flatMap(e=>[`${e} Created`,`${e} Active`]),l=["Resources","Buffers","Textures","Samplers","TextureViews","Framebuffers","QuerySets","Shaders","RenderPipelines","SharedRenderPipelines","ComputePipelines","PipelineLayouts","VertexArrays","RenderPasss","ComputePasss","CommandEncoders","CommandBuffers"].flatMap(e=>[`${e} Created`,`${e} Active`]),h=new WeakMap,u=new WeakMap;class c{static defaultProps={id:"undefined",handle:void 0,userData:void 0};toString(){return`${this[Symbol.toStringTag]||this.constructor.name}:"${this.id}"`}id;props;userData={};_device;destroyed=!1;allocatedBytes=0;allocatedBytesName=null;_attachedResources=new Set;constructor(e,t,i){if(!e)throw Error("no device");this._device=e,this.props=function(e,t){let i={...t};for(let t in e)void 0!==e[t]&&(i[t]=e[t]);return i}(t,i);let s="undefined"!==this.props.id?this.props.id:(0,r.L)(this[Symbol.toStringTag]);this.props.id=s,this.id=s,this.userData=this.props.userData||{},this.addStats()}destroy(){this.destroyed||this.destroyResource()}delete(){return this.destroy(),this}getProps(){return this.props}attachResource(e){this._attachedResources.add(e)}detachResource(e){this._attachedResources.delete(e)}destroyAttachedResource(e){this._attachedResources.delete(e)&&e.destroy()}destroyAttachedResources(){for(let e of this._attachedResources)e.destroy();this._attachedResources=new Set}destroyResource(){this.destroyed||(this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0)}removeStats(){let e=p(this._device),t=e?g():0,i=[this._device.statsManager.getStats(s),this._device.statsManager.getStats(n)],r=f(this._device);for(let e of i)d(e,r);let o=this.getStatsName();for(let e of i)e.get("Resources Active").decrementCount(),e.get(`${o}s Active`).decrementCount();e&&(e.statsBookkeepingCalls=(e.statsBookkeepingCalls||0)+1,e.statsBookkeepingTimeMs=(e.statsBookkeepingTimeMs||0)+(g()-t))}trackAllocatedMemory(e,t=this.getStatsName()){let i=p(this._device),r=i?g():0,s=this._device.statsManager.getStats(o);this.allocatedBytes>0&&this.allocatedBytesName&&(s.get("GPU Memory").subtractCount(this.allocatedBytes),s.get(`${this.allocatedBytesName} Memory`).subtractCount(this.allocatedBytes)),s.get("GPU Memory").addCount(e),s.get(`${t} Memory`).addCount(e),i&&(i.statsBookkeepingCalls=(i.statsBookkeepingCalls||0)+1,i.statsBookkeepingTimeMs=(i.statsBookkeepingTimeMs||0)+(g()-r)),this.allocatedBytes=e,this.allocatedBytesName=t}trackReferencedMemory(e,t=this.getStatsName()){this.trackAllocatedMemory(e,`Referenced ${t}`)}trackDeallocatedMemory(e=this.getStatsName()){if(0===this.allocatedBytes){this.allocatedBytesName=null;return}let t=p(this._device),i=t?g():0,r=this._device.statsManager.getStats(o);r.get("GPU Memory").subtractCount(this.allocatedBytes),r.get(`${this.allocatedBytesName||e} Memory`).subtractCount(this.allocatedBytes),t&&(t.statsBookkeepingCalls=(t.statsBookkeepingCalls||0)+1,t.statsBookkeepingTimeMs=(t.statsBookkeepingTimeMs||0)+(g()-i)),this.allocatedBytes=0,this.allocatedBytesName=null}trackDeallocatedReferencedMemory(e=this.getStatsName()){this.trackDeallocatedMemory(`Referenced ${e}`)}addStats(){let e=this.getStatsName(),t=p(this._device),i=t?g():0,r=[this._device.statsManager.getStats(s),this._device.statsManager.getStats(n)],o=f(this._device);for(let e of r)d(e,o);for(let t of r)t.get("Resources Created").incrementCount(),t.get("Resources Active").incrementCount(),t.get(`${e}s Created`).incrementCount(),t.get(`${e}s Active`).incrementCount();t&&(t.statsBookkeepingCalls=(t.statsBookkeepingCalls||0)+1,t.statsBookkeepingTimeMs=(t.statsBookkeepingTimeMs||0)+(g()-i)),function(e,t){let i=p(e);if(i&&i.activeDefaultFramebufferAcquireDepth)switch(i.transientCanvasResourceCreates=(i.transientCanvasResourceCreates||0)+1,t){case"Texture":i.transientCanvasTextureCreates=(i.transientCanvasTextureCreates||0)+1;break;case"TextureView":i.transientCanvasTextureViewCreates=(i.transientCanvasTextureViewCreates||0)+1;break;case"Sampler":i.transientCanvasSamplerCreates=(i.transientCanvasSamplerCreates||0)+1;break;case"Framebuffer":i.transientCanvasFramebufferCreates=(i.transientCanvasFramebufferCreates||0)+1}}(this._device,e)}getStatsName(){var e=this;let t=Object.getPrototypeOf(e);for(;t;){let i=Object.getPrototypeOf(t);if(!i||i===c.prototype)return function(e){let t=Object.getOwnPropertyDescriptor(e,Symbol.toStringTag);
803return"function"==typeof t?.get?t.get.call(e):"string"==typeof t?.value?t.value:null}(t)||e[Symbol.toStringTag]||e.constructor.name;t=i}return e[Symbol.toStringTag]||e.constructor.name}}function d(e,t){let i=e.stats,r=!1;for(let s of t)i[s]||(e.get(s),r=!0);let s=Object.keys(i).length,n=h.get(e);if(!r&&n?.orderedStatNames===t&&n.statCount===s)return;let o={},a=u.get(t);for(let e of(a||(a=new Set(t),u.set(t,a)),t))i[e]&&(o[e]=i[e]);for(let[e,t]of Object.entries(i))a.has(e)||(o[e]=t);for(let e of Object.keys(i))delete i[e];Object.assign(i,o),h.set(e,{orderedStatNames:t,statCount:s})}function f(e){return"webgl"===e.type?l:a}function p(e){let t=e.userData["cpu-hotspot-profiler"];return t?.enabled?t:null}function g(){return globalThis.performance?.now?.()??Date.now()}},60875:(e,t,i)=>{"use strict";i.d(t,{K:()=>eh});var r=i(34315),s=i(60154);class n extends s.F{get[Symbol.toStringTag](){return"ComputePipeline"}hash="";shaderLayout;constructor(e,t){super(e,t,n.defaultProps),this.shaderLayout=t.shaderLayout}static defaultProps={...s.F.defaultProps,shader:void 0,entryPoint:void 0,constants:{},shaderLayout:void 0}}var o=i(79904),a=i(504);class l{static defaultProps={...r.r.defaultProps};static getDefaultPipelineFactory(e){let t=e.getModuleData("@luma.gl/core");return t.defaultPipelineFactory||=new l(e),t.defaultPipelineFactory}device;_hashCounter=0;_hashes={};_renderPipelineCache={};_computePipelineCache={};_sharedRenderPipelineCache={};get[Symbol.toStringTag](){return"PipelineFactory"}toString(){return`PipelineFactory(${this.device.id})`}constructor(e){this.device=e}createRenderPipeline(e){if(!this.device.props._cachePipelines)return this.device.createRenderPipeline(e);let t={...r.r.defaultProps,...e},i=this._renderPipelineCache,s=this._hashRenderPipeline(t),n=i[s]?.resource;if(n)i[s].useCount++,this.device.props.debugFactories&&o.R.log(3,`${this}: ${i[s].resource} reused, count=${i[s].useCount}, (id=${e.id})`)();else{let e="webgl"===this.device.type&&this.device.props._sharePipelines?this.createSharedRenderPipeline(t):void 0;(n=this.device.createRenderPipeline({...t,id:t.id?`${t.id}-cached`:(0,a.L)("unnamed-cached"),_sharedRenderPipeline:e})).hash=s,i[s]={resource:n,useCount:1},this.device.props.debugFactories&&o.R.log(3,`${this}: ${n} created, count=${i[s].useCount}`)()}return n}createComputePipeline(e){if(!this.device.props._cachePipelines)return this.device.createComputePipeline(e);let t={...n.defaultProps,...e},i=this._computePipelineCache,r=this._hashComputePipeline(t),s=i[r]?.resource;return s?(i[r].useCount++,this.device.props.debugFactories&&o.R.log(3,`${this}: ${i[r].resource} reused, count=${i[r].useCount}, (id=${e.id})`)()):((s=this.device.createComputePipeline({...t,id:t.id?`${t.id}-cached`:void 0})).hash=r,i[r]={resource:s,useCount:1},this.device.props.debugFactories&&o.R.log(3,`${this}: ${s} created, count=${i[r].useCount}`)()),s}release(e){if(!this.device.props._cachePipelines)return void e.destroy();let t=this._getCache(e),i=e.hash;t[i].useCount--,0===t[i].useCount?(this._destroyPipeline(e),this.device.props.debugFactories&&o.R.log(3,`${this}: ${e} released and destroyed`)()):t[i].useCount<0?(o.R.error(`${this}: ${e} released, useCount < 0, resetting`)(),t[i].useCount=0):this.device.props.debugFactories&&o.R.log(3,`${this}: ${e} released, count=${t[i].useCount}`)()}createSharedRenderPipeline(e){let t=this._hashSharedRenderPipeline(e),i=this._sharedRenderPipelineCache[t];return i||(i={resource:this.device._createSharedRenderPipelineWebGL(e),useCount:0},this._sharedRenderPipelineCache[t]=i),i.useCount++,i.resource}releaseSharedRenderPipeline(e){if(!e.sharedRenderPipeline)return;let t=this._hashSharedRenderPipeline(e.sharedRenderPipeline.props),i=this._sharedRenderPipelineCache[t];i&&(i.useCount--,0===i.useCount&&(i.resource.destroy(),delete this._sharedRenderPipelineCache[t]))}_destroyPipeline(e){let t=this._getCache(e);return!!this.device.props._destroyPipelines&&(delete t[e.hash],e.destroy(),e instanceof r.r&&this.releaseSharedRenderPipeline(e),!0)}_getCache(e){let t;if(e instanceof n&&(t=this._computePipelineCache),e instanceof r.r&&(t=this._renderPipelineCache),!t)throw Error(`${this}`);
803if(!t[e.hash])throw Error(`${this}: ${e} matched incorrect entry`);return t}_hashComputePipeline(e){let{type:t}=this.device,i=this._getHash(e.shader.source),r=this._getHash(JSON.stringify(e.shaderLayout));return`${t}/C/${i}SL${r}`}_hashRenderPipeline(e){let t=e.vs?this._getHash(e.vs.source):0,i=e.fs?this._getHash(e.fs.source):0,r=this._getWebGLVaryingHash(e),s=this._getHash(JSON.stringify(e.shaderLayout)),n=this._getHash(JSON.stringify(e.bufferLayout)),{type:o}=this.device;if("webgl"===o){let a=this._getHash(JSON.stringify(e.parameters));return`${o}/R/${t}/${i}V${r}T${e.topology}P${a}SL${s}BL${n}`}{let a=this._getHash(JSON.stringify({vertexEntryPoint:e.vertexEntryPoint,fragmentEntryPoint:e.fragmentEntryPoint})),l=this._getHash(JSON.stringify(e.parameters)),h=this._getWebGPUAttachmentHash(e);return`${o}/R/${t}/${i}V${r}T${e.topology}EP${a}P${l}SL${s}BL${n}A${h}`}}_hashSharedRenderPipeline(e){let t=e.vs?this._getHash(e.vs.source):0,i=e.fs?this._getHash(e.fs.source):0,r=this._getWebGLVaryingHash(e);return`webgl/S/${t}/${i}V${r}`}_getHash(e){return void 0===this._hashes[e]&&(this._hashes[e]=this._hashCounter++),this._hashes[e]}_getWebGLVaryingHash(e){let{varyings:t=[],bufferMode:i=null}=e;return this._getHash(JSON.stringify({varyings:t,bufferMode:i}))}_getWebGPUAttachmentHash(e){let t=e.colorAttachmentFormats??[this.device.preferredColorFormat],i=e.parameters?.depthWriteEnabled?e.depthStencilAttachmentFormat||this.device.preferredDepthF
803ormat:null;return this._getHash(JSON.stringify({colorAttachmentFormats:t,depthStencilAttachmentFormat:i}))}}var h=i(99416);class u{static defaultProps={...h.M.defaultProps};static getDefaultShaderFactory(e){let t=e.getModuleData("@luma.gl/core");return t.defaultShaderFactory||=new u(e),t.defaultShaderFactory}device;_cache={};get[Symbol.toStringTag](){return"ShaderFactory"}toString(){return`${this[Symbol.toStringTag]}(${this.device.id})`}constructor(e){this.device=e}createShader(e){if(!this.device.props._cacheShaders)return this.device.createShader(e);let t=this._hashShader(e),i=this._cache[t];if(i)i.useCount++,this.device.props.debugFactories&&o.R.log(3,`${this}: Reusing shader ${i.resource.id} count=${i.useCount}`)();else{let r=this.device.createShader({...e,id:e.id?`${e.id}-cached`:void 0});this._cache[t]=i={resource:r,useCount:1},this.device.props.debugFactories&&o.R.log(3,`${this}: Created new shader ${r.id}`)()}return i.resource}release(e){if(!this.device.props._cacheShaders)return void e.destroy();let t=this._hashShader(e),i=this._cache[t];if(i)if(i.useCount--,0===i.useCount)this.device.props._destroyShaders&&(delete this._cache[t],i.resource.destroy(),this.device.props.debugFactories&&o.R.log(3,`${this}: Releasing shader ${e.id}, destroyed`)());else if(i.useCount<0)throw Error(`ShaderFactory: Shader ${e.id} released too many times`);else this.device.props.debugFactories&&o.R.log(3,`${this}: Releasing shader ${e.id} count=${i.useCount}`)()}_hashShader(e){return`${e.stage}:${e.source}`}}var c=i(69804),d=i(47941),f=i(29288);function p(e,t){let i=(0,f.si)(e),r=(0,f.k0)(i),s=/^mat(\d)x(\d)<.+>$/.exec(i);if(s){var n,o;let e=Number(s[1]),a=Number(s[2]),l=_(a,i,r.type,t),h=(n=l.size,o=l.alignment,"std140"===t?4:(0,d.JP)(n,o));return{alignment:l.alignment,size:e*h,components:e*a,columns:e,rows:a,columnStride:h,shaderType:i,type:r.type}}let a=/^vec(\d)<.+>$/.exec(i);return a?_(Number(a[1]),i,r.type,t):{alignment:1,size:1,components:1,columns:1,rows:1,columnStride:1,shaderType:i,type:r.type}}function g(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function m(e,t){var i;if("string"==typeof e)return p(e,t).alignment;if(Array.isArray(e)){let i=m(e[0],t);return y(t)?Math.max(i,4):i}let r=1;for(let i of Object.values(e))r=Math.max(r,m(i,t));return"std140"===(i=t)||"wgsl-uniform"===i?Math.max(r,4):r}function _(e,t,i,r){return{alignment:2===e?2:4,size:3===e?3:e,components:e,columns:1,rows:e,columnStride:3===e?3:e,shaderType:t,type:i}}function y(e){return"std140"===e||"wgsl-uniform"===e}function v(e){return Array.isArray(e)?0===e.length||"number"==typeof e[0]:ArrayBuffer.isView(e)&&!(e instanceof DataView)}class b{name;uniforms={};modifiedUniforms={};modified=!0;bindingLayout={};needsRedraw="initialized";constructor(e){if(this.name=e?.name||"unnamed",e?.name&&e?.shaderLayout){let t=e?.shaderLayout.bindings?.find(t=>"uniform"===t.type&&t.name===e?.name);if(!t)throw Error(e?.name);for(let e of t.uniforms||[])this.bindingLayout[e.name]=e}}setUniforms(e){for(let[t,i]of Object.entries(e))this._setUniform(t,i),this.needsRedraw||this.setNeedsRedraw(`${this.name}.${t}=${i}`)}setNeedsRedraw(e){this.needsRedraw=this.needsRedraw||e}getAllUniforms(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}}_setUniform(e,t){!function(e,t,i=16){if(e===t)return!0;if(!v(e)||!v(t)||e.length!==t.length)return!1;let r=Math.min(i,128);if(e.length>r)return!1;for(let i=0;i<e.length;++i)if(t[i]!==e[i])return!1;return!0}(this.uniforms[e],t)&&(this.uniforms[e]=v(t)?t.slice():t,this.modifiedUniforms[e]=!0,this.modified=!0)}}var E=i(29929);class x{layout;constructor(e){this.layout=e}has(e){return!!this.layout.fields[e]}get(e){let t=this.layout.fields[e];return t?{offset:t.offset,size:t.size}:void 0}getFlatUniformValues(e){let t={};for(let[i,r]of Object.entries(e)){let e=this.layout.uniformTypes[i];e?this._flattenCompositeValue(t,i,e,r):this.layout.fields[i]&&(t[i]=r)}return t}getData(e){let t=(0,E.o)(this.layout.byteLength);new Uint8Array(t,0,this.layout.byteLength).fill(0);let i={i32:new Int32Array(t),u32:new Uint32Array(t),f32:new Float32Array(t),f16:new Uint16Array(t)};for(let[t,r]of Object.entries(this.getFlatUniformValues(e)))this._writeLeafValue(i,t,r);return new Uint8Array(t,0,this.layout.byteLength)}_flattenCompositeValue(e,t,i,r){if(void 0!==r){var s;if("string"==typeof i||this.layout.fields[t]){e[t]=r;return}if(Array.isArray(i)){let s=i[0],n=i[1];if(Array.isArray(s))throw Error(`Nested arrays are not supported for ${t}`);if("string"==typeof s&&v(r))return void this._flattenPackedArray(e,t,s,n,r);if(!Array.isArray(r))return void o.R.warn(`Unsupported uniform array value for ${t}:`,r)();for(let i=0;i<Math.min(r.length,n);i++){let n=r[i];void 0!==n&&this._flattenCompositeValue(e,`${t}[${i}]`,s,n)}return}if(g(i)&&(s=r)&&"object"==typeof s&&!Array.isArray(s)&&!ArrayBuffer.isView(s)){for(let[s,n]of Object.entries(r)){if(void 0===n)continue;let r=`${t}.${s}`;this._flattenCompositeValue(e,r,i[s],n)}return}o.R.warn(`Unsupported uniform value for ${t}:`,r)()}}_flattenPackedArray(e,t,i,r,s){let n=p(i,this.layout.layout).components;for(let i=0;i<r;i++){var o,a,l;let r=i*n;if(r>=s.length)break;1===n?e[`${t}[${i}]`]=Number(s[r]):e[`${t}[${i}]`]=(o=s,a=r,l=r+n,Array.prototype.slice.call(o,a,l))}}_writeLeafValue(e,t,i){let r=this.layout.fields[t];if(!r)return void o.R.warn(`Uniform ${t} not found in layout`)();let{type:s,components:n,columns:a,rows:l,offset:h,columnStride:u}=r,c=e[s];if(1===n){c[h]=Number(i);return}if(1===a){for(let e=0;e<n;e++)c[h+e]=Number(i[e]??0);return}let d=0;for(let e=0;e<a;e++){let t=h+e*u;for(let e=0;e<l;e++)c[t+e]=Number(i[d++]??0)}}}class w{device;uniformBlocks=new Map;shaderBlockLayouts=new Map;shaderBlockWriters=new Map;uniformBuffers=new Map;constructor(e,t){for(let[i,r]of(this.device=e,Object.entries(t))){let t=function(e,t={}){let i={...e},r=t.layout??"std140",s={},n=0;for(let[e,t]of Object.entries(i))n=function e(t,i,r,s,n){if("string"==typeof r){let e=p(r,n),o=(0,d.JP)(s,e.alignment);return t[i]={offset:o,...e},o+e.size}if(Array.isArray(r)){if(Array.isArray(r[0]))throw Error(`Nested arrays are not supported for ${i}`);let o=r[0],a=r[1],l=function e(t,i){var r,s,n;return r=function t(i,r){if("string"==typeof i)return p(i,r).size;if(Array.isArray(i)){let t=i[0],s=i[1];if(Array.isArray(t))throw Error("Nested arrays are not supported");return e(t,r)*s}let s=0;for(let e of Object.values(i))s=(0,d.JP)(s,m(e,r))+t(e,r);return(0,d.JP)(s,m(i,r))}(t,i),s=m(t,i),n=i,(0,d.JP)(r,y(n)?4:s)}(o,n),h=(0,d.JP)(s,m(r,n));for(let r=0;r<a;r++)e(t,`${i}[${r}]`,o,h+r*l,n);return h+l*a}if(g(r)){let o=m(r,n),a=(0,d.JP)(s,o);for(let[s,o]of Object.entries(r))a=e(t,`${i}.${s}`,o,a,n);return(0,d.JP)(a,o)}throw Error(`Unsupported CompositeShaderType for ${i}`)}(s,e,t,n,r);return n=(0,d.JP)(n,m(i,r)),{layout:r,byteLength:4*n,uniformTypes:i,fields:s}}(r.uniformTypes??{},{layout:r.layout??("webgpu"===e.type?"wgsl-uniform":"std140")}),s=new x(t);this.shaderBlockLayouts.set(i,t),this.shaderBlockWriters.set(i,s);let n=new b({name:i});n.setUniforms(s.getFlatUniformValues(r.defaultUniforms||{})),this.uniformBlocks.set(i,n)}}destroy(){for(let e of this.uniformBuffers.values())e.destroy()}setUniforms(e){for(let[t,i]of Object.entries(e)){let e=this.shaderBlockWriters.get(t),r=e?.getFlatUniformValues(i||{});this.uniformBlocks.get(t)?.setUniforms(r||{})}this.updateUniformBuffers()}getUniformBufferByteLength(e){return Math.max(this.shaderBlockLayouts.get(e)?.byteLength||0,1024)}getUniformBufferData(e){let t=this.uniformBlocks.get(e)?.getAllUniforms()||{},i=this.shaderBlockWriters.get(e);return i?.getData(t)||new Uint8Array(0)}createUniformBuffer(e,t){t&&this.setUniforms(t);let i=this.getUniformBufferByteLength(e),r=this.device.createBuffer({usage:c.h.UNIFORM|c.h.COPY_DST,byteLength:i}),s=this.getUniformBufferData(e);return r.write(s),r}getManagedUniformBuffer(e){if(!this.uniformBuffers.get(e)){let t=this.getUniformBufferByteLength(e),i=this.device.createBuffer({usage:c.h.UNIFORM|c.h.COPY_DST,byteLength:t});this.uniformBuffers.set(e,i)}return this.uniformBuffers.get(e)}updateUniformBuffers(){let e=!1;for(let t of this.uniformBlocks.keys()){let i=this.updateUniformBuffer(t);e||=i}return e&&o.R.log(3,`UniformStore.updateUniformBuffers(): ${e}`)(),e}updateUniformBuffer(e){let t=this.uniformBlocks.get(e),i=this.uniformBuffers.get(e),r=!1;if(i&&t?.needsRedraw){r||=t.needsRedraw;let s=this.getUniformBufferData(e);i=this.uniformBuffers.get(e),i?.write(s);let n=this.uniformBlocks.get(e)?.getAllUniforms();o.R.log(4,`Writing to uniform buffer ${String(e)}`,s,n)()}return r}}var S=i(84062),P=i(85745),T=i(75457),A=i(20430),M=i(92354),C=i(29642),R=i(42846),L=i(77797),I=i(81403);class O{id;userData={};
803topology;bufferLayout=[];vertexCount;indices;attributes;constructor(e){if(this.id=e.id||(0,I.L)("geometry"),this.topology=e.topology,this.indices=e.indices||null,this.attributes=e.attributes,this.vertexCount=e.vertexCount,this.bufferLayout=e.bufferLayout||[],this.indices&&!(this.indices.usage&c.h.INDEX))throw Error("Index buffer must have INDEX usage")}destroy(){for(let e of(this.indices?.destroy(),Object.values(this.attributes)))e.destroy()}getVertexCount(){return this.vertexCount}getAttributes(){return this.attributes}getIndexes(){return this.indices||null}_calculateVertexCount(e){return e.byteLength/12}}let N="__debugFramebufferState";function F(e,t){if(!e)return t;let i=Number.parseInt(e,10);return Number.isFinite(i)?i:t}class D{bufferLayouts;constructor(e){this.bufferLayouts=e}getBufferLayout(e){return this.bufferLayouts.find(t=>t.name===e)||null}getAttributeNamesForBuffer(e){return e.attributes?e.attributes?.map(e=>e.attribute):[e.name]}mergeBufferLayouts(e,t){let i=[...e];for(let e of t){let t=i.findIndex(t=>t.name===e.name);t<0?i.push(e):i[t]=e}return i}getBufferIndex(e){let t=this.bufferLayouts.findIndex(t=>t.name===e);return -1===t&&o.R.warn(`BufferLayout: Missing buffer for "${e}".`)(),t}}function B(e,t){let i=1/0;for(let r of e){let e=t[r];void 0!==e&&(i=Math.min(i,e))}return i}function G(e,t){if(!e||!t.some(e=>e.bindingLayout?.length))return e;let i={...e,bindings:e.bindings.map(e=>({...e}))};for(let r of("attributes"in(e||{})&&(i.attributes=e?.attributes||[]),t))for(let e of r.bindingLayout||[])for(let t of function(e){let t=new Set([e,`${e}Uniforms`]);return e.endsWith("Uniforms")||t.add(`${e}Sampler`),[...t]}(e.name)){let r=i.bindings.find(e=>e.name===t);r?.group===0&&(r.group=e.group)}return i}var k=i(37114);class U{options={disableWarnings:!1};modules;moduleUniforms;moduleBindings;constructor(e,t){for(let i of(Object.assign(this.options,t),(0,k.$Q)(Object.values(e).filter($))))e[i.name]=i;for(let[t,i]of(o.R.log(1,"Creating ShaderInputs with modules",Object.keys(e))(),this.modules=e,this.moduleUniforms={},this.moduleBindings={},Object.entries(e)))i&&(this._addModule(i),i.name&&t!==i.name&&!this.options.disableWarnings&&o.R.warn(`Module name: ${t} vs ${i.name}`)())}destroy(){}setProps(e){for(let t of Object.keys(e)){let i=e[t]||{},r=this.modules[t];if(r){let e=this.moduleUniforms[t],s=this.moduleBindings[t],{uniforms:n,bindings:o}=function(e,t={}){let i={bindings:{},uniforms:{}};return Object.keys(e).forEach(r=>{var s,n,o;let a=e[r];Object.prototype.hasOwnProperty.call(t,r)||ArrayBuffer.isView(o=n=s=a)&&!(o instanceof DataView)||Array.isArray(n)&&(0===n.length||"number"==typeof n[0])||"number"==typeof s||"boolean"==typeof s?i.uniforms[r]=a:i.bindings[r]=a}),i}(r.getUniforms?.(i,e)||i,r.uniformTypes);this.moduleUniforms[t]=z(e,n,r.uniformTypes),this.moduleBindings[t]={...s,...o}}else this.options.disableWarnings||o.R.warn(`Module ${t} not found`)()}}getModules(){return Object.values(this.modules)}getUniformValues(){return this.moduleUniforms}getBindingValues(){let e={};for(let t of Object.values(this.moduleBindings))Object.assign(e,t);return e}getDebugTable(){let e={};for(let[t,i]of Object.entries(this.moduleUniforms))for(let[r,s]of Object.entries(i))e[`${t}.${r}`]={type:this.modules[t].uniformTypes?.[r],value:String(s)};return e}_addModule(e){let t=e.name;this.moduleUniforms[t]=z({},e.defaultUniforms||{},e.uniformTypes),this.moduleBindings[t]={}}}function z(e={},t={},i={}){let r={...e};for(let[s,n]of Object.entries(t))void 0!==n&&(r[s]=function e(t,i,r){if(!r||"string"==typeof r)return j(i);if(Array.isArray(r)){if(V(i)||!Array.isArray(i))return j(i);let s=Array.isArray(t)&&!V(t)?[...t]:[],n=s.slice();for(let t=0;t<i.length;t++){let o=i[t];void 0!==o&&(n[t]=e(s[t],o,r[0]))}return n}if(!W(i))return j(i);let s=W(t)?t:{},n={...s};for(let[t,o]of Object.entries(i))void 0!==o&&(n[t]=e(s[t],o,r[t]));return n}(e[s],n,i[s]));return r}function j(e){return ArrayBuffer.isView(e)?Array.prototype.slice.call(e):Array.isArray(e)?V(e)?e.slice():e.map(e=>void 0===e?void 0:j(e)):W(e)?Object.fromEntries(Object.entries(e).map(([e,t])=>[e,void 0===t?void 0:j(t)])):e}function V(e){return ArrayBuffer.isView(e)||Array.isArray(e)&&(0===e.length||"number"==typeof e[0])}function W(e){return!!e&&"object"==typeof e&&!Array.isArray(e)&&!ArrayBuffer.isView(e)}function $(e){return!!e?.dependencies}var H=i(42906);let q={"+X":0,"-X":1,"+Y":2,"-Y":3,"+Z":4,"-Z":5};function K(e){return e?Array.isArray(e)?e[0]??null:e:null}function X(e){if((0,H.x)(e))return(0,H.c)(e);if("object"==typeof e&&"width"in e&&"height"in e)return{width:e.width,height:e.height};throw Error("Unsupported mip-level data")}function Y(e){let{textureFormat:t,format:i}=e;if(t&&i&&t!==i)throw Error(`Conflicting texture formats "${t}" and "${i}" provided for the same mip level`);return t??i}function Z(e){let t=q[e];
803if(void 0===t)throw Error(`Invalid cube face: ${e}`);return t}function Q(e){throw Error("setTexture1DData not supported in WebGL.")}function J(e,t,i,r){let s=Array.isArray(t)?t:[t],n=[];for(let t=0;t<s.length;t++){let o=s[t];if((0,H.x)(o))n.push({type:"external-image",image:o,z:e,mipLevel:t});else if("object"==typeof o&&null!==o&&"data"in o&&"width"in o&&"height"in o)n.push({type:"texture-data",data:o,textureFormat:Y(o),z:e,mipLevel:t});else if(ArrayBuffer.isView(o)&&i)n.push({type:"texture-data",data:{data:o,width:Math.max(1,i.width>>t),height:Math.max(1,i.height>>t),...r?{format:r}:{}},textureFormat:r,z:e,mipLevel:t});else throw Error("Unsupported 2D mip-level payload")}return n}function ee(e){let t=[];for(let i=0;i<e.length;i++)t.push(...J(i,e[i]));return t}function et(e){let t=[];for(let i=0;i<e.length;i++)t.push(...J(i,e[i]));return t}function ei(e){let t=[];for(let[i,r]of Object.entries(e)){let e=Z(i);t.push(...J(e,r))}return t}function er(e){let t=[];return e.forEach((e,i)=>{for(let[r,s]of Object.entries(e)){let e=6*i+Z(r);t.push(...J(e,s))}}),t}class es{device;id;props;_texture=null;_sampler=null;_view=null;ready;isReady=!1;destroyed=!1;resolveReady=()=>{};rejectReady=()=>{};get texture(){if(!this._texture)throw Error("Texture not initialized yet");return this._texture}get sampler(){if(!this._sampler)throw Error("Sampler not initialized yet");return this._sampler}get view(){if(!this._view)throw Error("View not initialized yet");return this._view}get[Symbol.toStringTag](){return"DynamicTexture"}toString(){let e=this._texture?.width??this.props.width??"?",t=this._texture?.height??this.props.height??"?";return`DynamicTexture:"${this.id}":${e}x${t}px:(${this.isReady?"ready":"loading..."})`}constructor(e,t){this.device=e;let i=(0,I.L)("dynamic-texture");this.props={...es.defaultProps,id:i,...t,data:null},this.id=this.props.id,this.ready=new Promise((e,t)=>{this.resolveReady=e,this.rejectReady=t}),this.initAsync(t)}async initAsync(e){try{let t=await this._loadAllData(e);this._checkNotDestroyed();let i=t.data?function(e){if(!e.data)return[];let t=e.width&&e.height?{width:e.width,height:e.height}:void 0,i="format"in e?e.format:void 0;switch(e.dimension){case"1d":return Q(e.data);case"2d":return J(0,e.data,t,i);case"3d":return ee(e.data);case"2d-array":return et(e.data);case"cube":return ei(e.data);case"cube-array":return er(e.data);default:throw Error(`Unhandled dimension ${e.dimension}`)}}({...t,width:e.width,height:e.height,format:e.format}):[],r="format"in e&&void 0!==e.format,s="usage"in e&&void 0!==e.usage,n=(()=>{if(this.props.width&&this.props.height)return{width:this.props.width,height:this.props.height};let e=function(e){let{dimension:t,data:i}=e;if(!i)return null;switch(t){case"1d":{let e=K(i);if(!e)return null;let{width:t}=X(e);return{width:t,height:1}}case"2d":{let e=K(i);return e?X(e):null}case"3d":case"2d-array":{if(!Array.isArray(i)||0===i.length)return null;let e=K(i[0]);return e?X(e):null}case"cube":{let e=Object.keys(i)[0]??null;if(!e)return null;let t=K(i[e]);return t?X(t):null}case"cube-array":{if(!Array.isArray(i)||0===i.length)return null;let e=i[0],t=Object.keys(e)[0]??null;if(!t)return null;let r=K(e[t]);return r?X(r):null}default:return null}}(t);return e||{width:this.props.width||1,height:this.props.height||1}})();if(!n||n.width<=0||n.height<=0)throw Error(`${this} size could not be determined or was zero`);let a=function(e,t,i,r){if(0===t.length)return{subresources:t,mipLevels:1,format:r.format,hasExplicitMipChain:!1};let s=new Map;for(let e of t){let t=s.get(e.z)??[];t.push(e),s.set(e.z,t)}let n=t.some(e=>e.mipLevel>0),o=r.format,a=1/0,l=[];for(let[t,r]of s){let s=[...r].sort((e,t)=>e.mipLevel-t.mipLevel),n=s[0];
803if(!n||0!==n.mipLevel)throw Error(`DynamicTexture: slice ${t} is missing mip level 0`);let h=eo(e,n);if(h.width!==i.width||h.height!==i.height)throw Error(`DynamicTexture: slice ${t} base level dimensions ${h.width}x${h.height} do not match expected ${i.width}x${i.height}`);let u=en(n);if(u){if(o&&o!==u)throw Error(`DynamicTexture: slice ${t} base level format "${u}" does not match texture format "${o}"`);o=u}let c=o&&e.isTextureFormatCompressed(o)?function(e,t,i,r){let{blockWidth:s=1,blockHeight:n=1}=e.getTextureFormatInfo(r),o=1;for(let e=1;;e++){let r=Math.max(1,t>>e),a=Math.max(1,i>>e);if(r<s||a<n)break;o++}return o}(e,h.width,h.height,o):e.getMipLevelCount(h.width,h.height),d=0;for(let t=0;t<s.length;t++){let i=s[t];if(!i||i.mipLevel!==t||t>=c)break;let r=eo(e,i),n=Math.max(1,h.width>>t),a=Math.max(1,h.height>>t);if(r.width!==n||r.height!==a)break;let u=en(i);if(u&&(o||(o=u),u!==o))break;d++,l.push(i)}a=Math.min(a,d)}let h=Number.isFinite(a)?Math.max(1,a):1;return{subresources:l.filter(e=>e.mipLevel<h),mipLevels:h,format:o,hasExplicitMipChain:n}}(this.device,i,n,{format:r?e.format:void 0}),l=a.format??this.props.format,h={...this.props,...n,format:l,mipLevels:1,data:void 0};this.device.isTextureFormatCompressed(l)&&!s&&(h.usage=T.g.SAMPLE|T.g.COPY_DST);let u=this.props.mipmaps&&!a.hasExplicitMipChain&&!this.device.isTextureFormatCompressed(l);if("webgpu"===this.device.type&&u){let e="3d"===this.props.dimension?T.g.SAMPLE|T.g.STORAGE|T.g.COPY_DST|T.g.COPY_SRC:T.g.SAMPLE|T.g.RENDER|T.g.COPY_DST|T.g.COPY_SRC;h.usage|=e}let c=this.device.getMipLevelCount(h.width,h.height),d=a.hasExplicitMipChain?a.mipLevels:"auto"===this.props.mipLevels?c:Math.max(1,Math.min(c,this.props.mipLevels??1)),f={...h,mipLevels:d};this._texture=this.device.createTexture(f),this._sampler=this.texture.sampler,this._view=this.texture.view,a.subresources.length&&this._setTextureSubresources(a.subresources),!this.props.mipmaps||a.hasExplicitMipChain||u||o.R.warn(`${this} skipping auto-generated mipmaps for compressed texture format`)(),u&&this.generateMipmaps(),this.isReady=!0,this.resolveReady(this.texture),o.R.info(0,`${this} created`)()}catch(t){let e=t instanceof Error?t:Error(String(t));this.rejectReady(e)}}destroy(){this._texture&&(this._texture.destroy(),this._texture=null,this._sampler=null,this._view=null),this.destroyed=!0}generateMipmaps(){"webgl"===this.device.type?this.texture.generateMipmapsWebGL():"webgpu"===this.device.type?this.device.generateMipmapsWebGPU(this.texture):o.R.warn(`${this} mipmaps not supported on ${this.device.type}`)}setSampler(e={}){this._checkReady();let t=e instanceof A.L?e:this.device.createSampler(e);this.texture.setSampler(t),this._sampler=t}async readBuffer(e={}){this.isReady||await this.ready;let t=e.width??this.texture.width,i=e.height??this.texture.height,r=e.depthOrArrayLayers??this.texture.depth,s=this.texture.computeMemoryLayout({width:t,height:i,depthOrArrayLayers:r}),n=this.device.createBuffer({byteLength:s.byteLength,usage:c.h.COPY_DST|c.h.MAP_READ});this.texture.readBuffer({...e,width:t,height:i,depthOrArrayLayers:r},n);let o=this.device.createFence();return await o.signaled,o.destroy(),n}async readAsync(e={}){this.isReady||await this.ready;let t=e.width??this.texture.width,i=e.height??this.texture.height,r=e.depthOrArrayLayers??this.texture.depth,s=this.texture.computeMemoryLayout({width:t,height:i,depthOrArrayLayers:r}),n=await this.readBuffer(e),o=await n.readAsync(0,s.byteLength);return n.destroy(),o.buffer}resize(e){if(this._checkReady(),e.width===this.texture.width&&e.height===this.texture.height)return!1;let t=this.texture;return this._texture=t.clone(e),this._sampler=this.texture.sampler,this._view=this.texture.view,t.destroy(),o.R.info(`${this} resized`),!0}getCubeFaceIndex(e){let t=q[e];if(void 0===t)throw Error(`Invalid cube face: ${e}`);return t}getCubeArrayFaceIndex(e,t){return 6*e+this.getCubeFaceIndex(t)}setTexture1DData(e){if(this._checkReady(),"1d"!==this.texture.props.dimension)throw Error(`${this} is not 1d`);let t=Q(e);this._setTextureSubresources(t)}setTexture2DData(e,t=0){if(this._checkReady(),"2d"!==this.texture.props.dimension)throw Error(`${this} is not 2d`);let i=J(t,e);this._setTextureSubresources(i)}setTexture3DData(e){if("3d"!==this.texture.props.dimension)throw Error(`${this} is not 3d`);let t=ee(e);this._setTextureSubresources(t)}setTextureArrayData(e){if("2d-array"!==this.texture.props.dimension)throw Error(`${this} is not 2d-array`);let t=et(e);this._setTextureSubresources(t)}setTextureCubeData(e){if("cube"!==this.texture.props.dimension)throw Error(`${this} is not cube`);let t=ei(e);this._setTextureSubresources(t)}setTextureCubeArrayData(e){if("cube-array"!==this.texture.props.dimension)throw Error(`${this} is not cube-array`);let t=er(e);this._setTextureSubresources(t)}_setTextureSubresources(e){for(let t of e){let{z:e,mipLevel:i}=t;switch(t.type){case"external-image":let{image:r,flipY:s}=t;this.texture.copyExternalImage({image:r,z:e,mipLevel:i,flipY:s});break;case"texture-data":let{data:n,textureFormat:o}=t;if(o&&o!==this.texture.format)throw Error(`${this} mip level ${i} uses format "${o}" but texture format is "${this.texture.format}"`);this.texture.writeData(n.data,{x:0,y:0,z:e,width:n.width,height:n.height,depthOrArrayLayers:1,mipLevel:i});break;default:throw Error("Unsupported 2D mip-level payload")}}}async _loadAllData(e){let t=await ea(e.data);return{dimension:e.dimension??"2d",data:t??null}}_checkNotDestroyed(){this.destroyed&&o.R.warn(`${this} already destroyed`)}_checkReady(){this.isReady||o.R.warn(`${this} Cannot perform this operation before ready`)}static defaultProps={...T.g.defaultProps,dimension:"2d",data:null,mipmaps:!1}}function en(e){if("texture-data"===e.type)return e.textureFormat??Y(e.data)}function eo(e,t){switch(t.type){case"external-image":return e.getExternalImageSize(t.image);case"texture-data":return{width:t.data.width,height:t.data.height};default:throw Error("Unsupported texture subresource")}}async function ea(e){if(Array.isArray(e=await e))return await Promise.all(e.map(ea));if(e&&"object"==typeof e&&e.constructor===Object){let t=e,i=await Promise.all(Object.values(t).map(ea)),r=Object.keys(t),s={};for(let e=0;e<r.length;e++)s[r[e]]=i[e];return s}return e}let el="render pipeline initialization failed";class eh{static defaultProps={...r.r.defaultProps,source:void 0,vs:null,fs:null,id:"unnamed",handle:void 0,userData:{},defines:{},modules:[],geometry:null,indexBuffer:null,attributes:{},constantAttributes:{},bindings:{},uniforms:{},varyings:[],isInstanced:void 0,instanceCount:0,vertexCount:0,shaderInputs:void 0,material:void 0,pipelineFactory:void 0,shaderFactory:void 0,transformFeedback:void 0,shaderAssembler:R._.getDefaultShaderAssembler(),debugShaders:void 0,disableWarnings:void 0};device;id;source;vs;fs;pipelineFactory;shaderFactory;userData={};parameters;topology;bufferLayout;isInstanced=void 0;instanceCount=0;vertexCount;indexBuffer=null;bufferAttributes={};constantAttributes={};bindings={};vertexArray;transformFeedback=null;pipeline;shaderInputs;material=null;_uniformStore;_attributeInfos={};_gpuGeometry=null;props;_pipelineNeedsUpdate="newly created";_needsRedraw="initializing";_destroyed=!1;_lastDrawTimestamp=-1;_bindingTable=[];get[Symbol.toStringTag](){return"Model"}toString(){return`Model(${this.id})`}constructor(e,t){this.props={...eh.defaultProps,...t},t=this.props,this.id=t.id||(0,I.L)("model"),this.device=e,Object.assign(this.userData,t.userData),this.material=t.material||null;let i=Object.fromEntries(this.props.modules?.map(e=>[e.name,e])||[]),r=t.shaderInputs||new U(i,{disableWarnings:this.props.disableWarnings});this.setShaderInputs(r);let s=function(e){return{type:e.type,shaderLanguage:e.info.shadingLanguage,shaderLanguageVersion:e.info.shadingLanguageVersion,gpu:e.info.gpu,features:e.features}}(e),n=(this.props.modules?.length>0?this.props.modules:this.shaderInputs?.getModules())||[];if(this.props.shaderLayout=G(this.props.shaderLayout,n)||null,"webgpu"===this.device.type&&this.props.source){let{source:t,getUniforms:i,bindingTable:r}=this.props.shaderAssembler.assembleWGSLShader({platformInfo:s,...this.props,modules:n});this.source=t,this._getModuleUniforms=i,this._bindingTable=r;let o=e.getShaderLayout?.(this.source);
803this.props.shaderLayout=G(this.props.shaderLayout||o||null,n)||null}else{let{vs:e,fs:t,getUniforms:i}=this.props.shaderAssembler.assembleGLSLShaderPair({platformInfo:s,...this.props,modules:n});this.vs=e,this.fs=t,this._getModuleUniforms=i,this._bindingTable=[]}this.vertexCount=this.props.vertexCount,this.instanceCount=this.props.instanceCount,this.topology=this.props.topology,this.bufferLayout=this.props.bufferLayout,this.parameters=this.props.parameters,t.geometry&&this.setGeometry(t.geometry),this.pipelineFactory=t.pipelineFactory||l.getDefaultPipelineFactory(this.device),this.shaderFactory=t.shaderFactory||u.getDefaultShaderFactory(this.device),this.pipeline=this._updatePipeline(),this.vertexArray=e.createVertexArray({shaderLayout:this.pipeline.shaderLayout,bufferLayout:this.pipeline.bufferLayout}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry),"isInstanced"in t&&(this.isInstanced=t.isInstanced),t.instanceCount&&this.setInstanceCount(t.instanceCount),t.vertexCount&&this.setVertexCount(t.vertexCount),t.indexBuffer&&this.setIndexBuffer(t.indexBuffer),t.attributes&&this.setAttributes(t.attributes),t.constantAttributes&&this.setConstantAttributes(t.constantAttributes),t.bindings&&this.setBindings(t.bindings),t.transformFeedback&&(this.transformFeedback=t.transformFeedback)}destroy(){this._destroyed||(this.pipelineFactory.release(this.pipeline),this.shaderFactory.release(this.pipeline.vs),this.pipeline.fs&&this.pipeline.fs!==this.pipeline.vs&&this.shaderFactory.release(this.pipeline.fs),this._uniformStore.destroy(),this._gpuGeometry?.destroy(),this._destroyed=!0)}needsRedraw(){this._getBindingsUpdateTimestamp()>this._lastDrawTimestamp&&this.setNeedsRedraw("contents of bound textures or buffers updated");let e=this._needsRedraw;return this._needsRedraw=!1,e}setNeedsRedraw(e){this._needsRedraw||=e}getBindingDebugTable(){return this._bindingTable}predraw(){this.updateShaderInputs(),this.pipeline=this._updatePipeline()}draw(e){let t,i=this._areBindingsLoading();if(i)return o.R.info(2,`>>> DRAWING ABORTED ${this.id}: ${i} not loaded`)(),!1;try{e.pushDebugGroup(`${this}.predraw(${e})`),this.predraw()}finally{e.popDebugGroup()}let r=this.pipeline.isErrored;try{if(e.pushDebugGroup(`${this}.draw(${e})`),this._logDrawCallStart(),this.pipeline=this._updatePipeline(),r=this.pipeline.isErrored)o.R.info(2,`>>> DRAWING ABORTED ${this.id}: ${el}`)(),t=!1;else{let i=this._getBindings(),r=this._getBindGroups(),{indexBuffer:s}=this.vertexArray,n=s?s.byteLength/("uint32"===s.indexType?4:2):void 0;t=this.pipeline.draw({renderPass:e,vertexArray:this.vertexArray,isInstanced:this.isInstanced,vertexCount:this.vertexCount,instanceCount:this.instanceCount,indexCount:n,transformFeedback:this.transformFeedback||void 0,bindings:i,bindGroups:r,_bindGroupCacheKeys:this._getBindGroupCacheKeys(),uniforms:this.props.uniforms,parameters:this.parameters,topology:this.topology})}}finally{e.popDebugGroup(),this._logDrawCallEnd()}return this._logFramebuffer(e),t?(this._lastDrawTimestamp=this.device.timestamp,this._needsRedraw=!1):r?this._needsRedraw=el:this._needsRedraw="waiting for resource initialization",t}setGeometry(e){this._gpuGeometry?.destroy();let t=e&&function(e,t){if(t instanceof O)return t;let i=function(e,t){if(!t.indices)return;let i=t.indices.value;return e.createBuffer({usage:c.h.INDEX,data:i})}(e,t),{attributes:r,bufferLayout:s}=function(e,t){let i=[],r={};for(let[s,n]of Object.entries(t.attributes)){let t=s;switch(s){case"POSITION":t="positions";break;case"NORMAL":t="normals";break;case"TEXCOORD_0":t="texCoords";break;case"TEXCOORD_1":t="texCoords1";break;case"COLOR_0":t="colors"}if(n){r[t]=e.createBuffer({data:n.value,id:`${s}-buffer`});let{value:o,size:a,normalized:l}=n;if(void 0===a)throw Error(`Attribute ${s} is missing a size`);i.push({name:t,format:L.E.getVertexFormatFromAttribute(o,a,l)})}}return{attributes:r,bufferLayout:i,vertexCount:t._calculateVertexCount(t.attributes,t.indices)}}(e,t);return new O({topology:t.topology||"triangle-list",bufferLayout:s,vertexCount:t.vertexCount,indices:i,attributes:r})}(this.device,e);
803if(t){this.setTopology(t.topology||"triangle-list");let e=new D(this.bufferLayout);this.bufferLayout=e.mergeBufferLayouts(t.bufferLayout,this.bufferLayout),this.vertexArray&&this._setGeometryAttributes(t)}this._gpuGeometry=t}setTopology(e){e!==this.topology&&(this.topology=e,this._setPipelineNeedsUpdate("topology"))}setBufferLayout(e){let t=new D(this.bufferLayout);this.bufferLayout=this._gpuGeometry?t.mergeBufferLayouts(e,this._gpuGeometry.bufferLayout):e,this._setPipelineNeedsUpdate("bufferLayout"),this.pipeline=this._updatePipeline(),this.vertexArray=this.device.createVertexArray({shaderLayout:this.pipeline.shaderLayout,bufferLayout:this.pipeline.bufferLayout}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry)}setParameters(e){!function e(t,i,r){if(t===i)return!0;if(!r||!t||!i)return!1;if(Array.isArray(t)){if(!Array.isArray(i)||t.length!==i.length)return!1;for(let s=0;s<t.length;s++)if(!e(t[s],i[s],r-1))return!1;return!0}if(Array.isArray(i))return!1;if("object"==typeof t&&"object"==typeof i){let s=Object.keys(t),n=Object.keys(i);if(s.length!==n.length)return!1;for(let n of s)if(!i.hasOwnProperty(n)||!e(t[n],i[n],r-1))return!1;return!0}return!1}(e,this.parameters,2)&&(this.parameters=e,this._setPipelineNeedsUpdate("parameters"))}setInstanceCount(e){this.instanceCount=e,void 0===this.isInstanced&&e>0&&(this.isInstanced=!0),this.setNeedsRedraw("instanceCount")}setVertexCount(e){this.vertexCount=e,this.setNeedsRedraw("vertexCount")}setShaderInputs(e){for(let[t,i]of(this.shaderInputs=e,this._uniformStore=new w(this.device,this.shaderInputs.modules),Object.entries(this.shaderInputs.modules)))if(i.uniformTypes&&!function(e){for(let t in e)return!1;return!0}(i.uniformTypes)&&!this.material?.ownsModule(t)){let e=this._uniformStore.getManagedUniformBuffer(t);this.bindings[`${t}Uniforms`]=e}this.setNeedsRedraw("shaderInputs")}setMaterial(e){this.material=e,this.setNeedsRedraw("material")}updateShaderInputs(){this._uniformStore.setUniforms(this.shaderInputs.getUniformValues()),this.setBindings(this._getNonMaterialBindings(this.shaderInputs.getBindingValues())),this.setNeedsRedraw("shaderInputs")}setBindings(e){Object.assign(this.bindings,e),this.setNeedsRedraw("bindings")}setTransformFeedback(e){this.transformFeedback=e,this.setNeedsRedraw("transformFeedback")}setIndexBuffer(e){this.vertexArray.setIndexBuffer(e),this.setNeedsRedraw("indexBuffer")}setAttributes(e,t){let i=t?.disableWarnings??this.props.disableWarnings;e.indices&&o.R.warn(`Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`)(),this.bufferLayout=function(e,t){let i=Object.fromEntries(e.attributes.map(e=>[e.name,e.location])),r=t.slice();return r.sort((e,t)=>{let r=e.attributes?e.attributes.map(e=>e.attribute):[e.name],s=t.attributes?t.attributes.map(e=>e.attribute):[t.name];return B(r,i)-B(s,i)}),r}(this.pipeline.shaderLayout,this.bufferLayout);let r=new D(this.bufferLayout);for(let[t,s]of Object.entries(e)){let e=r.getBufferLayout(t);if(!e){i||o.R.warn(`Model(${this.id}): Missing layout for buffer "${t}".`)();continue}let n=r.getAttributeNamesForBuffer(e),a=!1;for(let e of n){let t=this._attributeInfos[e];if(t){let e="webgpu"===this.device.type?r.getBufferIndex(t.bufferName):t.location;this.vertexArray.setBuffer(e,s),a=!0}}a||i||o.R.warn(`Model(${this.id}): Ignoring buffer "${s.id}" for unknown attribute "${t}"`)()}this.setNeedsRedraw("attributes")}setConstantAttributes(e,t){for(let[i,r]of Object.entries(e)){let e=this._attributeInfos[i];e?this.vertexArray.setConstantWebGL(e.location,r):(t?.disableWarnings??this.props.disableWarnings)||o.R.warn(`Model "${this.id}: Ignoring constant supplied for unknown attribute "${i}"`)()}this.setNeedsRedraw("constants")}_areBindingsLoading(){for(let e of Object.values(this.bindings))if(e instanceof es&&!e.isReady)return e.id;for(let e of Object.values(this.material?.bindings||{}))if(e instanceof es&&!e.isReady)return e.id;return!1}_getBindings(){let e={};for(let[t,i]of Object.entries(this.bindings))i instanceof es?i.isReady&&(e[t]=i.texture):e[t]=i;return e}_getBindGroups(){let e=this.pipeline?.shaderLayout||this.props.shaderLayout||{bindings:[]},t=e.bindings.length?(0,S.gO)(e,this._getBindings()):{0:this._getBindings()};if(!this.material)return t;for(let[e,i]of Object.entries(this.material.getBindingsByGroup())){let r=Number(e);t[r]={...t[r]||{},...i}}return t}_getBindGroupCacheKeys(){let e=this.material?.getBindGroupCacheKey(3);return e?{3:e}:{}}_getBindingsUpdateTimestamp(){let e=0;for(let t of Object.values(this.bindings))t instanceof P.X?e=Math.max(e,t.texture.updateTimestamp):t instanceof c.h||t instanceof T.g?e=Math.max(e,t.updateTimestamp):t instanceof es?e=t.texture?Math.max(e,t.texture.updateTimestamp):1/0:t instanceof A.L||(e=Math.max(e,t.buffer.updateTimestamp));return Math.max(e,this.material?.getBindingsUpdateTimestamp()||0)}_setGeometryAttributes(e){let t={...e.attributes};for(let[e]of Object.entries(t))this.pipeline.shaderLayout.attributes.find(t=>t.name===e)||"positions"===e||delete t[e];this.vertexCount=e.vertexCount,this.setIndexBuffer(e.indices||null),this.setAttributes(e.attributes,{disableWarnings:!0}),this.setAttributes(t,{disableWarnings:this.props.disableWarnings}),this.setNeedsRedraw("geometry attributes")}_setPipelineNeedsUpdate(e){this._pipelineNeedsUpdate||=e,this.setNeedsRedraw(e)}_updatePipeline(){if(this._pipelineNeedsUpdate){let e=null,t=null;
803this.pipeline&&(o.R.log(1,`Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)(),e=this.pipeline.vs,t=this.pipeline.fs),this._pipelineNeedsUpdate=!1;let i=this.shaderFactory.createShader({id:`${this.id}-vertex`,stage:"vertex",source:this.source||this.vs,debugShaders:this.props.debugShaders}),r=null;this.source?r=i:this.fs&&(r=this.shaderFactory.createShader({id:`${this.id}-fragment`,stage:"fragment",source:this.source||this.fs,debugShaders:this.props.debugShaders})),this.pipeline=this.pipelineFactory.createRenderPipeline({...this.props,bindings:void 0,bufferLayout:this.bufferLayout,topology:this.topology,parameters:this.parameters,bindGroups:this._getBindGroups(),vs:i,fs:r}),this._attributeInfos=(0,M.P)(this.pipeline.shaderLayout,this.bufferLayout),e&&this.shaderFactory.release(e),t&&t!==e&&this.shaderFactory.release(t)}return this.pipeline}_lastLogTime=0;_logOpen=!1;_logDrawCallStart(){let e=o.R.level>3?0:1e4;o.R.level<2||Date.now()-this._lastLogTime<e||(this._lastLogTime=Date.now(),this._logOpen=!0,o.R.group(2,`>>> DRAWING MODEL ${this.id}`,{collapsed:o.R.level<=2})())}_logDrawCallEnd(){if(this._logOpen){let e=function(e,t){let i={},r="Values";if(0===e.attributes.length&&!e.varyings?.length)return{"No attributes or varyings":{[r]:"N/A"}};for(let t of e.attributes)if(t){let e=`${t.location} ${t.name}: ${t.type}`;i[`in ${e}`]={[r]:t.stepMode||"vertex"}}for(let t of e.varyings||[]){let e=`${t.location} ${t.name}`;i[`out ${e}`]={[r]:JSON.stringify(t)}}return i}(this.pipeline.shaderLayout,this.id);o.R.table(2,e)();let t=this.shaderInputs.getDebugTable();o.R.table(2,t)();let i=this._getAttributeDebugTable();o.R.table(2,this._attributeInfos)(),o.R.table(2,i)(),o.R.groupEnd(2)(),this._logOpen=!1}}_drawCount=0;_logFramebuffer(e){let t=this.device.props.debugFramebuffers;if(this._drawCount++,!t)return;let i=e.props.framebuffer;!function(e,t,i){var r;if("webgl"!==e.device.type)return;let s=(r=e.device,r.userData[N]||={flushing:!1,queuedFramebuffers:[]},r.userData[N]);if(!s.flushing){if(function(e){let t=e.props.framebuffer;return!t||null===t.handle}(e))return function(e,t,i){if(0===i.queuedFramebuffers.length)return;let{gl:r}=e.device,s=r.getParameter(36010),n=r.getParameter(36006),[o,a]=e.device.getDefaultCanvasContext().getDrawingBufferSize(),l=F(t.top,8),h=F(t.left,8);i.flushing=!0;try{for(let e of i.queuedFramebuffers){let[i,s,n,u,c]=function(e){let{framebuffer:t,targetWidth:i,targetHeight:r,topPx:s,leftPx:n,minimap:o}=e,a=o?Math.max(Math.floor(i/4),1):i,l=o?Math.max(Math.floor(r/4),1):r,h=Math.min(a/t.width,l/t.height),u=Math.max(Math.floor(t.width*h),1),c=Math.max(Math.floor(t.height*h),1),d=Math.max(r-s-c,0);return[n,d,n+u,d+c,c]}({framebuffer:e,targetWidth:o,targetHeight:a,topPx:l,leftPx:h,minimap:t.minimap});r.bindFramebuffer(36008,e.handle),r.bindFramebuffer(36009,null),r.blitFramebuffer(0,0,e.width,e.height,i,s,n,u,16384,9728),l+=c+8}}finally{r.bindFramebuffer(36008,s),r.bindFramebuffer(36009,n),i.flushing=!1}}(e,i,s);t&&"colorAttachments"in t&&null!==t.handle&&!s.queuedFramebuffers.includes(t)&&s.queuedFramebuffers.push(t)}}(e,i,{id:i?.id||`${this.id}-framebuffer`,minimap:!0})}_getAttributeDebugTable(){let e={};for(let[t,i]of Object.entries(this._attributeInfos)){let r=this.vertexArray.attributes[i.location];e[i.location]={name:t,type:i.shaderType,values:r?this._getBufferOrConstantValues(r,i.bufferDataType):"null"}}if(this.vertexArray.indexBuffer){let{indexBuffer:t}=this.vertexArray,i="uint32"===t.indexType?new Uint32Array(t.debugData):new Uint16Array(t.debugData);e.indices={name:"indices",type:t.indexType,values:i.toString()}}return e}_getBufferOrConstantValues(e,t){let i=C.r.getTypedArrayConstructor(t);return(e instanceof c.h?new i(e.debugData):e).toString()}_getNonMaterialBindings(e){if(!this.material)return e;let t={};for(let[i,r]of Object.entries(e))this.material.ownsBinding(i)||(t[i]=r);return t}}},61899:(e,t,i)=>{"use strict";i.d(t,{PU:()=>_,qG:()=>m});let r="texture-compression-bc",s="texture-compression-astc",n="texture-compression-etc2",o="texture-compression-pvrtc-webgl",a="texture-compression-atc-webgl",l="float32-renderable-webgl",h="float16-renderable-webgl",u="snorm8-renderable-webgl",c="norm16-webgl",d="norm16-renderable-webgl",f="snorm16-renderable-webgl",p="float32-filterable",g="float16-filterable-webgl";function m(e){let t=y[e];if(!t)throw Error(`Unsupported texture format ${e}`);return t}function _(){return y}let y={r8unorm:{},rg8unorm:{},"rgb8unorm-webgl":{},rgba8unorm:{},"rgba8unorm-srgb":{},r8snorm:{render:u},rg8snorm:{render:u},"rgb8snorm-webgl":{},rgba8snorm:{render:u},r8uint:{},rg8uint:{},rgba8uint:{},r8sint:{},rg8sint:{},rgba8sint:{},bgra8unorm:{},"bgra8unorm-srgb":{},r16unorm:{f:c,render:d},rg16unorm:{f:c,render:d},"rgb16unorm-webgl":{f:c,render:!1},rgba16unorm:{f:c,render:d},r16snorm:{f:c,render:f},rg16snorm:{f:c,render:f},"rgb16snorm-webgl":{f:c,render:!1},rgba16snorm:{f:c,render:f},r16uint:{},rg16uint:{},rgba16uint:{},r16sint:{},rg16sint:{},rgba16sint:{},r16float:{render:h,filter:"float16-filterable-webgl"},rg16float:{render:h,filter:g},rgba16float:{render:h,filter:g},r32uint:{},rg32uint:{},rgba32uint:{},r32sint:{},rg32sint:{},rgba32sint:{},r32float:{render:l,filter:p},rg32float:{render:!1,filter:p},"rgb32float-webgl":{render:l,filter:p},rgba32float:{render:l,filter:p},"rgba4unorm-webgl":{channels:"rgba",bitsPerChannel:[4,4,4,4],packed:!0},"rgb565unorm-webgl":{channels:"rgb",bitsPerChannel:[5,6,5,0],packed:!0},"rgb5a1unorm-webgl":{channels:"rgba",bitsPerChannel:[5,5,5,1],packed:!0},rgb9e5ufloat:{channels:"rgb",packed:!0,render:"rgb9e5ufloat-renderable-webgl"},rg11b10ufloat:{channels:"rgb",bitsPerChannel:[11,11,10,0],packed:!0,p:1,render:l},rgb10a2unorm:{channels:"rgba",bitsPerChannel:[10,10,10,2],packed:!0,p:1},rgb10a2uint:{channels:"rgba",bitsPerChannel:[10,10,10,2],packed:!0,p:1},stencil8:{attachment:"stencil",bitsPerChannel:[8,0,0,0],dataType:"uint8"},depth16unorm:{attachment:"depth",bitsPerChannel:[16,0,0,0],dataType:"uint16"},depth24plus:{attachment:"depth",bitsPerChannel:[24,0,0,0],dataType:"uint32"},depth32float:{attachment:"depth",bitsPerChannel:[32,0,0,0],dataType:"float32"},"depth24plus-stencil8":{attachment:"depth-stencil",bitsPerChannel:[24,8,0,0],packed:!0},"depth32float-stencil8":{attachment:"depth-stencil",bitsPerChannel:[32,8,0,0],packed:!0}
803,"bc1-rgb-unorm-webgl":{f:r},"bc1-rgb-unorm-srgb-webgl":{f:r},"bc1-rgba-unorm":{f:r},"bc1-rgba-unorm-srgb":{f:r},"bc2-rgba-unorm":{f:r},"bc2-rgba-unorm-srgb":{f:r},"bc3-rgba-unorm":{f:r},"bc3-rgba-unorm-srgb":{f:r},"bc4-r-unorm":{f:r},"bc4-r-snorm":{f:r},"bc5-rg-unorm":{f:r},"bc5-rg-snorm":{f:r},"bc6h-rgb-ufloat":{f:r},"bc6h-rgb-float":{f:r},"bc7-rgba-unorm":{f:r},"bc7-rgba-unorm-srgb":{f:r},"etc2-rgb8unorm":{f:n},"etc2-rgb8unorm-srgb":{f:n},"etc2-rgb8a1unorm":{f:n},"etc2-rgb8a1unorm-srgb":{f:n},"etc2-rgba8unorm":{f:n},"etc2-rgba8unorm-srgb":{f:n},"eac-r11unorm":{f:n},"eac-r11snorm":{f:n},"eac-rg11unorm":{f:n},"eac-rg11snorm":{f:n},"astc-4x4-unorm":{f:s},"astc-4x4-unorm-srgb":{f:s},"astc-5x4-unorm":{f:s},"astc-5x4-unorm-srgb":{f:s},"astc-5x5-unorm":{f:s},"astc-5x5-unorm-srgb":{f:s},"astc-6x5-unorm":{f:s},"astc-6x5-unorm-srgb":{f:s},"astc-6x6-unorm":{f:s},"astc-6x6-unorm-srgb":{f:s},"astc-8x5-unorm":{f:s},"astc-8x5-unorm-srgb":{f:s},"astc-8x6-unorm":{f:s},"astc-8x6-unorm-srgb":{f:s},"astc-8x8-unorm":{f:s},"astc-8x8-unorm-srgb":{f:s},"astc-10x5-unorm":{f:s},"astc-10x5-unorm-srgb":{f:s},"astc-10x6-unorm":{f:s},"astc-10x6-unorm-srgb":{f:s},"astc-10x8-unorm":{f:s},"astc-10x8-unorm-srgb":{f:s},"astc-10x10-unorm":{f:s},"astc-10x10-unorm-srgb":{f:s},"astc-12x10-unorm":{f:s},"astc-12x10-unorm-srgb":{f:s},"astc-12x12-unorm":{f:s},"astc-12x12-unorm-srgb":{f:s},"pvrtc-rgb4unorm-webgl":{f:o},"pvrtc-rgba4unorm-webgl":{f:o},"pvrtc-rgb2unorm-webgl":{f:o},"pvrtc-rgba2unorm-webgl":{f:o},"etc1-rbg-unorm-webgl":{f:"texture-compression-etc1-webgl"},"atc-rgb-unorm-webgl":{f:a},"atc-rgba-unorm-webgl":{f:a},"atc-rgbai-unorm-webgl":{f:a}}},62376:()=>{},62760:(e,t,i)=>{"use strict";var r=i(77513);function s(e,t,i){if(3===e){var s=new r(i,i.readVarint()+i.pos);s.length&&(t[s.name]=s)}}e.exports=function(e,t){this.layers=e.readFields(s,{},t)}},62876:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});var r=i(68468),s=i(74503),n=function(e,t={}){return(0,s.OQ)(e,(e,i)=>{let s=i.geometry.coordinates;return e+(0,r.I)(s[0],s[1],t)},0)}},63344:(e,t,i)=>{"use strict";function r(e,t){if(!e)throw Error(t||"deck.gl: assertion failed.")}i.d(t,{A:()=>r})},63542:(e,t,i)=>{"use strict";i.d(t,{A:()=>o});var r=i(57981),s=i(83829),n=i(54059);class o{cachedTags;dataSource;geotiff;gkd;image;maskImage=null;constructor(e,t,i,r,s,n){this.geotiff=e,this.gkd=t,this.image=i,this.maskImage=r,this.cachedTags=s,this.dataSource=n}get crs(){return this.geotiff.crs}get height(){return this.image.size.height}get nodata(){return this.geotiff.nodata}get _debug(){return this.geotiff._debug}get tileCount(){return this.image.tileCount}get tileHeight(){return this.image.tileSize.height}get tileWidth(){return this.image.tileSize.width}get transform(){let e=this.geotiff.transform,t=this.geotiff.width/this.width,i=this.geotiff.height/this.height;return(0,r.Zz)(e,(0,r.hs)(t,i))}get width(){return this.image.size.width}async fetchTile(e,t,i={}){return await (0,s.v4)(this,e,t,i)}async fetchTiles(e,t={}){return await (0,s.UP)(this,e,t)}index(e,t,i=Math.floor){return(0,n.P)(this,e,t,i)}xy(e,t,i="center"){return(0,n.xy)(this,e,t,i)}}},64734:(e,t,i)=>{"use strict";i.d(t,{I7:()=>f,PI:()=>c,pF:()=>p});var r=i(88743),s=i(79904),n=i(504),o=i(69804),a=i(77797),l=i(30971),h=i(42906),u=i(61899);class c{}function d(e){if(void 0!==e){if(null===e||"string"==typeof e||"number"==typeof e||"boolean"==typeof e)return e;if(e instanceof Error)return e.message;if(Array.isArray(e))return e.map(d);if("object"==typeof e){var t,i;if("toString"in(t=e)&&"function"==typeof t.toString&&t.toString!==Object.prototype.toString){let t=String(e);if("[object Object]"!==t)return t}return"message"in(i=e)&&"type"in i?function(e){let t="string"==typeof e.type?e.type:"message",i="string"==typeof e.message?e.message:"",r="number"==typeof e.lineNum?e.lineNum:null,s="number"==typeof e.linePos?e.linePos:null,n=null!==r&&null!==s?` @ ${r}:${s}`:null!==r?` @ ${r}`:"";return`${t}${n}: ${i}`.trim()}(e):e.constructor?.name||"Object"}return String(e)}}class f{features;disabledFeatures;constructor(e=[],t){this.features=new Set(e),this.disabledFeatures=t||{}}*[Symbol.iterator](){yield*this.features}has(e){return!this.disabledFeatures?.[e]&&this.features.has(e)}}class p{static defaultProps={id:null,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,createCanvasContext:void 0,webgl:{},onError:(e,t)=>
803{},onResize:(e,t)=>{let[i,r]=e.getDevicePixelSize();s.R.log(1,`${e} resized => ${i}x${r}px`)()},onPositionChange:(e,t)=>{let[i,r]=e.getPosition();s.R.log(1,`${e} repositioned => ${i},${r}`)()},onVisibilityChange:e=>s.R.log(1,`${e} Visibility changed ${e.isVisible}`)(),onDevicePixelRatioChange:(e,t)=>s.R.log(1,`${e} DPR changed ${t.oldRatio} => ${e.devicePixelRatio}`)(),debug:function(){var e,t;return e=s.R.get("debug"),t=function(){let e=globalThis.process;if(e?.env)return e.env.NODE_ENV}(),null!=e?!!e:void 0!==t&&"production"!==t}(),debugGPUTime:!1,debugShaders:s.R.get("debug-shaders")||void 0,debugFramebuffers:!!s.R.get("debug-framebuffers"),debugFactories:!!s.R.get("debug-factories"),debugWebGL:!!s.R.get("debug-webgl"),debugSpectorJS:void 0,debugSpectorJSUrl:void 0,_reuseDevices:!1,_requestMaxLimits:!0,_cacheShaders:!0,_destroyShaders:!1,_cachePipelines:!0,_sharePipelines:!0,_destroyPipelines:!1,_initializeFeatures:!0,_disabledFeatures:{"compilation-status-async-webgl":!0},_handle:void 0};get[Symbol.toStringTag](){return"Device"}toString(){return`Device(${this.id})`}id;props;userData={};statsManager=r.d;_factories={};timestamp=0;_reused=!1;_moduleData={};_textureCaps={};_debugGPUTimeQuery=null;constructor(e){this.props={...p.defaultProps,...e},this.id=this.props.id||(0,n.L)(this[Symbol.toStringTag].toLowerCase())}getVertexFormatInfo(e){return a.E.getVertexFormatInfo(e)}isVertexFormatSupported(e){return!0}getTextureFormatInfo(e){return l.vz.getInfo(e)}getTextureFormatCapabilities(e){let t=this._textureCaps[e];if(!t){let i=this._getDeviceTextureFormatCapabilities(e);t=this._getDeviceSpecificTextureFormatCapabilities(i),this._textureCaps[e]=t}return t}getMipLevelCount(e,t,i=1){return 1+Math.floor(Math.log2(Math.max(e,t,i)))}isExternalImage(e){return(0,h.x)(e)}getExternalImageSize(e){return(0,h.c)(e)}isTextureFormatSupported(e){return this.getTextureFormatCapabilities(e).create}isTextureFormatFilterable(e){return this.getTextureFormatCapabilities(e).filter}isTextureFormatRenderable(e){return this.getTextureFormatCapabilities(e).render}isTextureFormatCompressed(e){return l.vz.isCompressed(e)}getSupportedCompressedTextureFormats(){let e=[];for(let t of Object.keys((0,u.PU)()))this.isTextureFormatCompressed(t)&&this.isTextureFormatSupported(t)&&e.push(t);return e}pushDebugGroup(e){this.commandEncoder.pushDebugGroup(e)}popDebugGroup(){this.commandEncoder?.popDebugGroup()}insertDebugMarker(e){this.commandEncoder?.insertDebugMarker(e)}loseDevice(){return!1}incrementTimestamp(){return this.timestamp++}reportError(e,t,...i){if(!this.props.onError(e,t)){var r,n;let o=(r=t,n=i,[d(r),...n.map(d).filter(e=>void 0!==e)].filter(e=>void 0!==e));return s.R.error("webgl"===this.type?"%cWebGL":"%cWebGPU","color: white; background: red; padding: 2px 6px; border-radius: 3px;",e.message,...o)}return()=>{}}debug(){if(this.props.debug);else{let e=`\ 804'Type luma.log.set({debug: true}) in console to enable debug breakpoints', 805or create a device with the 'debug: true' prop.`;s.R.once(0,e)()}}getDefaultCanvasContext(){if(!this.canvasContext)throw Error("Device has no default CanvasContext. See props.createCanvasContext");return this.canvasContext}createFence(){throw Error("createFence() not implemented")}beginRenderPass(e){return this.commandEncoder.beginRenderPass(e)}beginComputePass(e){return this.commandEncoder.beginComputePass(e)}generateMipmapsWebGPU(e){throw Error("not implemented")}_createSharedRenderPipelineWebGL(e){throw Error("_createSharedRenderPipelineWebGL() not implemented")}_createBindGroupLayoutWebGPU(e,t){throw Error("_createBindGroupLayoutWebGPU() not implemented")}_createBindGroupWebGPU(e,t,i,r,s){throw Error("_createBindGroupWebGPU() not implemented")}_supportsDebugGPUTime(){return this.features.has("timestamp-query")&&!!(this.props.debug||this.props.debugGPUTime)}_enableDebugGPUTime(e=256){if(!this._supportsDebugGPUTime())return null;if(this._debugGPUTimeQuery)return this._debugGPUTimeQuery;try{this._debugGPUTimeQuery=this.createQuerySet({type:"timestamp",count:e}),this.commandEncoder=this.createCommandEncoder({id:this.commandEncoder.props.id,timeProfilingQuerySet:this._debugGPUTimeQuery})}catch{this._debugGPUTimeQuery=null}return this._debugGPUTimeQuery}_disableDebugGPUTime(){this._debugGPUTimeQuery&&(this.commandEncoder.getTimeProfilingQuerySet()===this._debugGPUTimeQuery&&(this.commandEncoder=this.createCommandEncoder({id:this.commandEncoder.props.id})),this._debugGPUTimeQuery.destroy(),this._debugGPUTimeQuery=null)}_isDebugGPUTimeEnabled(){return null!==this._debugGPUTimeQuery}getCanvasContext(){return this.getDefaultCanvasContext()}readPixelsToArrayWebGL(e,t){throw Error("not implemented")}readPixelsToBufferWebGL(e,t){throw Error("not implemented")}setParametersWebGL(e){throw Error("not implemented")}getParametersWebGL(e){throw Error("not implemented")}withParametersWebGL(e,t){throw Error("not implemented")}clearWebGL(e){throw Error("not implemented")}resetWebGL(){throw Error("not implemented")}getModuleData(e){return this._moduleData[e]||={},this._moduleData[e]}static _getCanvasContextProps(e){return!0===e.createCanvasContext?{}:e.createCanvasContext}_getDeviceTextureFormatCapabilities(e){let t=l.vz.getCapabilities(e),i=e=>("string"==typeof e?this.features.has(e):e)??!0,r=i(t.create);return{format:e,create:r,render:r&&i(t.render),filter:r&&i(t.filter),blend:r&&i(t.blend),store:r&&i(t.store)}}_normalizeBufferProps(e){(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});let t={...e};if((e.usage||0)&o.h.INDEX&&(!e.indexType&&(e.data instanceof Uint32Array?t.indexType="uint32":e.data instanceof Uint16Array?t.indexType="uint16":e.data instanceof Uint8Array&&(t.data=new Uint16Array(e.data),t.indexType="uint16")),!t.indexType))throw Error("indices buffer content must be of type uint16 or uint32");return t}}},67238:(e,t,i)=>{"use strict";function r(e){let t,i={};return r=>{for(let s in r)if(!function(e,t){if(e===t)return!0;
805if(Array.isArray(e)){let i=e.length;if(!t||t.length!==i)return!1;for(let r=0;r<i;r++)if(e[r]!==t[r])return!1;return!0}return!1}(r[s],i[s])){t=e(r),i=r;break}return t}}i.d(t,{A:()=>r})},68456:(e,t,i)=>{"use strict";i.d(t,{Ph:()=>a,mk:()=>o});var r=i(81866),s=i(75261);let n=()=>{let e=(0,s.K2)();return e.loaderRegistry=e.loaderRegistry||[],e.loaderRegistry};function o(e){let t=n();for(let i of e=Array.isArray(e)?e:[e]){let e=(0,r.D)(i);t.find(t=>e===t)||t.unshift(e)}}function a(){return n()}},68468:(e,t,i)=>{"use strict";function r(e){if(!e)throw Error("coord is required");if(!Array.isArray(e)){if("Feature"===e.type&&null!==e.geometry&&"Point"===e.geometry.type)return[...e.geometry.coordinates];if("Point"===e.type)return[...e.coordinates]}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return[...e];throw Error("coord must be GeoJSON Point or an Array of numbers")}i.d(t,{A:()=>o,I:()=>n});var s=i(85347);function n(e,t,i={}){var o=r(e),a=r(t),l=Math.pow(Math.sin((0,s.tR)(a[1]-o[1])/2),2)+Math.pow(Math.sin((0,s.tR)(a[0]-o[0])/2),2)*Math.cos((0,s.tR)(o[1]))*Math.cos((0,s.tR)(a[1]));return(0,s.cJ)(2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)),i.units)}var o=n},69804:(e,t,i)=>{"use strict";i.d(t,{h:()=>s});var r=i(60154);class s extends r.F{static INDEX=16;static VERTEX=32;static UNIFORM=64;static STORAGE=128;static INDIRECT=256;static QUERY_RESOLVE=512;static MAP_READ=1;static MAP_WRITE=2;static COPY_SRC=4;static COPY_DST=8;get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(e,t){let i={...t};(t.usage||0)&s.INDEX&&!t.indexType&&(t.data instanceof Uint32Array?i.indexType="uint32":t.data instanceof Uint16Array?i.indexType="uint16":t.data instanceof Uint8Array&&(i.indexType="uint8")),delete i.data,super(e,i,s.defaultProps),this.usage=i.usage||0,this.indexType=i.indexType,this.updateTimestamp=e.incrementTimestamp()}clone(e){return this.device.createBuffer({...this.props,...e})}static DEBUG_DATA_MAX_LENGTH=32;debugData=new ArrayBuffer(0);_setDebugData(e,t,i){let r,n=null;ArrayBuffer.isView(e)?(n=e,r=e.buffer):r=e;let o=Math.min(e?e.byteLength:i,s.DEBUG_DATA_MAX_LENGTH);if(null===r)this.debugData=new ArrayBuffer(o);else{let e=Math.min(n?.byteOffset||0,r.byteLength),t=Math.min(o,Math.max(0,r.byteLength-e));this.debugData=new Uint8Array(r,e,t).slice().buffer}}static defaultProps={...r.F.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",onMapped:void 0}}},71312:(e,t,i)=>{var r=i(76680);function s(e){var t=0;if(e&&e.length>0){t+=Math.abs(n(e[0]));for(var i=1;i<e.length;i++)t-=Math.abs(n(e[i]))}return t}function n(e){var t,i,s,n,a,l,h=0,u=e.length;if(u>2){for(l=0;l<u;l++)l===u-2?(s=u-2,n=u-1,a=0):l===u-1?(s=u-1,n=0,a=1):(s=l,n=l+1,a=l+2),t=e[s],i=e[n],h+=(o(e[a][0])-o(t[0]))*Math.sin(o(i[1]));h=h*r.RADIUS*r.RADIUS/2}return h}function o(e){return e*Math.PI/180}e.exports.geometry=function e(t){var i,r=0;switch(t.type){case"Polygon":return s(t.coordinates);case"MultiPolygon":for(i=0;i<t.coordinates.length;i++)r+=s(t.coordinates[i]);return r;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0;case"GeometryCollection":for(i=0;i<t.geometries.length;i++)r+=e(t.geometries[i]);return r}},e.exports.ring=n},71513:(e,t,i)=>{"use strict";i.d(t,{A:()=>r});let r=e=>()=>e},73254:(e,t,i)=>{"use strict";i.d(t,{VD:()=>r,YN:()=>l,fW:()=>n,jA:()=>a,r3:()=>s,uH:()=>o,vf:()=>h});let r={NO_STATE:"Awaiting state",MATCHED:"Matched. State transferred from previous layer",INITIALIZED:"Initialized",AWAITING_GC:"Discarded. Awaiting garbage collection",AWAITING_FINALIZATION:"No longer matched. Awaiting garbage collection",FINALIZED:"Finalized! Awaiting garbage collection"},s=Symbol.for("component"),n=Symbol.for("propTypes"),o=Symbol.for("deprecatedProps"),a=Symbol.for("asyncPropDefaults"),l=Symbol.for("asyncPropOriginal"),h=Symbol.for("asyncPropResolved")},73452:(e,t,i)=>{"use strict";i.d(t,{I:()=>a,Td:()=>o,X:()=>n});let r=[],s=[];function n(e,t=0,i=1/0){let o=r,a={index:-1,data:e,target:[]};return e?"function"==typeof e[Symbol.iterator]?o=e:e.length>0&&(s.length=e.length,o=s):o=r,(t>0||Number.isFinite(i))&&(o=(Array.isArray(o)?o:Array.from(o)).slice(t,i),a.index=t-1),{iterable:o,objectInfo:a}}function o(e){return e&&e[Symbol.asyncIterator]}function a(e,t){let{size:i,stride:r,offset:s,startIndices:n,nested:o}=t,a=e.BYTES_PER_ELEMENT,l=r?r/a:i,h=s?s/a:0,u=Math.floor((e.length-h)/l);return(t,{index:r,target:s})=>{let a;if(!n){let t=r*l+h;for(let r=0;r<i;r++)s[r]=e[t+r];return s}let c=n[r],d=n[r+1]||u;if(o){a=Array(d-c);for(let t=c;t<d;t++){let r=t*l+h;s=Array(i);for(let t=0;t<i;t++)s[t]=e[r+t];a[t-c]=s}}else if(l===i)a=e.subarray(c*i+h,d*i+h);else{a=new e.constructor((d-c)*i);let t=0;for(let r=c;r<d;r++){let s=r*l+h;for(let r=0;r<i;r++)a[t++]=e[s+r]}}return a}}},75261:(e,t,i)=>{"use strict";i.d(t,{pp:()=>p,K2:()=>f,Rf:()=>m,a5:()=>g});var r=i(51910),s=i(98328);let n=new(i(97517)).hW({id:"loaders.gl"});class o{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}}class a{console;constructor(){this.console=console}log(...e){return this.console.log.bind(this.console,...e)}info(...e){return this.console.info.bind(this.console,...e)}warn(...e){return this.console.warn.bind(this.console,...e)}error(...e){return this.console.error.bind(this.console,...e)}}var l=i(96347);let h={core:{baseUrl:void 0,fetch:null,mimeType:void 0,fallbackMimeType:void 0,ignoreRegisteredLoaders:void 0,nothrow:!1,log:new a,useLocalLibraries:!1,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:l.Bd,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]}},u={baseUri:"core.baseUrl",fetch:"core.fetch",mimeType:"core.mimeType",fallbackMimeType:"core.fallbackMimeType",ignoreRegisteredLoaders:"core.ignoreRegisteredLoaders",nothrow:"core.nothrow",log:"core.log",useLocalLibraries:"core.useLocalLibraries",CDN:"core.CDN",worker:"core.worker",maxConcurrency:"core.maxConcurrency",max
805MobileConcurrency:"core.maxMobileConcurrency",reuseWorkers:"core.reuseWorkers",_nodeWorkers:"core.nodeWorkers",_workerType:"core._workerType",_worker:"core._workerType",limit:"core.limit",_limitMB:"core._limitMB",batchSize:"core.batchSize",batchDebounceMs:"core.batchDebounceMs",metadata:"core.metadata",transforms:"core.transforms",throws:"nothrow",dataType:"(no longer used)",uri:"core.baseUrl",method:"core.fetch.method",headers:"core.fetch.headers",body:"core.fetch.body",mode:"core.fetch.mode",credentials:"core.fetch.credentials",cache:"core.fetch.cache",redirect:"core.fetch.redirect",referrer:"core.fetch.referrer",referrerPolicy:"core.fetch.referrerPolicy",integrity:"core.fetch.integrity",keepalive:"core.fetch.keepalive",signal:"core.fetch.signal"};var c=i(12388);let d=["baseUrl","fetch","mimeType","fallbackMimeType","ignoreRegisteredLoaders","nothrow","log","useLocalLibraries","CDN","worker","maxConcurrency","maxMobileConcurrency","reuseWorkers","_nodeWorkers","_workerType","limit","_limitMB","batchSize","batchDebounceMs","metadata","transforms"];function f(){globalThis.loaders=globalThis.loaders||{};let{loaders:e}=globalThis;return e._state||(e._state={}),e._state}function p(){let e=f();return e.globalOptions=e.globalOptions||{...h,core:{...h.core}},m(e.globalOptions)}function g(e,t,i,r){return function(e,t){for(let i of(_(e,null,h,u,t),t)){let r=e&&e[i.id]||{},s=i.options&&i.options[i.id]||{},n=i.deprecatedOptions&&i.deprecatedOptions[i.id]||{};_(r,i.id,s,n,t)}}(e,i=Array.isArray(i=i||[])?i:[i]),m(function(e,t,i){var r,n;let a=e.options||{},l={...a};return a.core&&(l.core={...a.core}),v(l),l.core?.log===null&&(l.core={...l.core,log:new o}),y(l,m(p())),y(l,m(t)),r=l,(n=i)&&r.core?.baseUrl===void 0&&(r.core||={},r.core.baseUrl=s.pD((0,c.S3)(n))),function(e){let t=e.core;if(t)for(let i of d)void 0!==t[i]&&(e[i]=t[i])}(l),l}(t,e,r))}function m(e){let t=function(e){let t={...e};return e.core&&(t.core={...e.core}),t}(e);for(let e of(v(t),d))t.core&&void 0!==t.core[e]&&delete t[e];return t.core&&void 0!==t.core._workerType&&delete t._worker,t}function _(e,t,i,s,o){let a=t||"Top level",l=t?`${t}.`:"";for(let h in e){let u=!t&&(0,r.Gv)(e[h]),c="baseUri"===h&&!t,d="workerUrl"===h&&t;if(!(h in i)&&!c&&!d){if(h in s)n.level>0&&n.warn(`${a} loader option '${l}${h}' no longer supported, use '${s[h]}'`)();else if(!u&&n.level>0){let e=function(e,t){let i=e.toLowerCase(),r="";for(let s of t)for(let t in s.options){if(e===t)return`Did you mean '${s.id}.${t}'?`;let n=t.toLowerCase();(i.startsWith(n)||n.startsWith(i))&&(r=r||`Did you mean '${s.id}.${t}'?`)}return r}(h,o);n.warn(`${a} loader option '${l}${h}' not recognized. ${e}`)()}}}}function y(e,t){for(let i in t)if(i in t){let s=t[i];(0,r.aC)(s)&&(0,r.aC)(e[i])?e[i]={...e[i],...t[i]}:e[i]=t[i]}}function v(e){for(let t of(void 0!==e.baseUri&&(e.core||={},void 0===e.core.baseUrl&&(e.core.baseUrl=e.baseUri)),d))if(void 0!==e[t]){let i=e.core=e.core||{};void 0===i[t]&&(i[t]=e[t])}let t=e._worker;void 0!==t&&(e.core||={},void 0===e.core._workerType&&(e.core._workerType=t))}},75278:(e,t,i)=>{"use strict";var r=i(58280);function s(e,t,i,r,s){this.properties={},this.extent=i,this.type=0,this._pbf=e,this._geometry=-1,this._keys=r,this._values=s,e.readFields(n,this,t)}function n(e,t,i){1==e?t.id=i.readVarint():2==e?function(e,t){for(var i=e.readVarint()+e.pos;e.pos<i;){var r=t._keys[e.readVarint()],s=t._values[e.readVarint()];t.properties[r]=s}}(i,t):3==e?t.type=i.readVarint():4==e&&(t._geometry=i.pos)}e.exports=s,s.types=["Unknown","Point","LineString","Polygon"],s.prototype.loadGeometry=function(){var e=this._pbf;e.pos=this._geometry;for(var t,i=e.readVarint()+e.pos,s=1,n=0,o=0,a=0,l=[];e.pos<i;){if(n<=0){var h=e.readVarint();s=7&h,n=h>>3}if(n--,1===s||2===s)o+=e.readSVarint(),a+=e.readSVarint(),1===s&&(t&&l.push(t),t=[]),t.push(new r(o,a));else if(7===s)t&&t.push(t[0].clone());else throw Error("unknown command "+s)}return t&&l.push(t),l},s.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,i=1,r=0,s=0,n=0,o=1/0,a=-1/0,l=1/0,h=-1/0;e.pos<t;){if(r<=0){var u=e.readVarint();i=7&u,r=u>>3}if(r--,1===i||2===i)s+=e.readSVarint(),n+=e.readSVarint(),s<o&&(o=s),s>a&&(a=s),n<l&&(l=n),n>h&&(h=n);else if(7!==i)throw Error("unknown command "+i)}return[o,l,a,h]},s.prototype.toGeoJSON=function(e,t,i){var r,n,o=this.extent*Math.pow(2,i),a=this.extent*e,l=this.extent*t,h=this.loadGeometry(),u=s.types[this.type];function c(e){for(var t=0;t<e.length;t++){var i=e[t],r=180-(i.y+l)*360/o;e[t]=[(i.x+a)*360/o-180,360/Math.PI*Math.atan(Math.exp(r*Math.PI/180)
805)-90]}}switch(this.type){case 1:var d=[];for(r=0;r<h.length;r++)d[r]=h[r][0];c(h=d);break;case 2:for(r=0;r<h.length;r++)c(h[r]);break;case 3:for(r=0,h=function(e){var t=e.length;if(t<=1)return[e];for(var i,r,s=[],n=0;n<t;n++){var o=function(e){for(var t,i,r=0,s=0,n=e.length,o=n-1;s<n;o=s++)t=e[s],r+=((i=e[o]).x-t.x)*(t.y+i.y);return r}(e[n]);0!==o&&(void 0===r&&(r=o<0),r===o<0?(i&&s.push(i),i=[e[n]]):i.push(e[n]))}return i&&s.push(i),s}(h);r<h.length;r++)for(n=0;n<h[r].length;n++)c(h[r][n])}1===h.length?h=h[0]:u="Multi"+u;var f={type:"Feature",geometry:{type:u,coordinates:h},properties:this.properties};return"id"in this&&(f.id=this.id),f}},75457:(e,t,i)=>{"use strict";i.d(t,{g:()=>l});var r=i(60154),s=i(20430),n=i(79904),o=i(30971);let a={"1d":"1d","2d":"2d","2d-array":"2d",cube:"2d","cube-array":"2d","3d":"3d"};class l extends r.F{static SAMPLE=4;static STORAGE=8;static RENDER=16;static COPY_SRC=1;static COPY_DST=2;static TEXTURE=4;static RENDER_ATTACHMENT=16;dimension;baseDimension;format;width;height;depth;mipLevels;samples;byteAlignment;ready=Promise.resolve(this);isReady=!0;updateTimestamp;get[Symbol.toStringTag](){return"Texture"}toString(){return`Texture(${this.id},${this.format},${this.width}x${this.height})`}constructor(e,t,i){if(super(e,t=l.normalizeProps(e,t),l.defaultProps),this.dimension=this.props.dimension,this.baseDimension=a[this.dimension],this.format=this.props.format,this.width=this.props.width,this.height=this.props.height,this.depth=this.props.depth,this.mipLevels=this.props.mipLevels,this.samples=this.props.samples||1,"cube"===this.dimension&&(this.depth=6),void 0===this.props.width||void 0===this.props.height)if(e.isExternalImage(t.data)){let i=e.getExternalImageSize(t.data);this.width=i?.width||1,this.height=i?.height||1}else this.width=1,this.height=1,(void 0===this.props.width||void 0===this.props.height)&&n.R.warn(`${this} created with undefined width or height. This is deprecated. Use DynamicTexture instead.`)();this.byteAlignment=i?.byteAlignment||1,this.updateTimestamp=e.incrementTimestamp()}clone(e){return this.device.createTexture({...this.props,...e})}setSampler(e){this.sampler=e instanceof s.L?e:this.device.createSampler(e)}copyImageData(e){let{data:t,depth:i,...r}=e;this.writeData(t,{...r,depthOrArrayLayers:r.depthOrArrayLayers??i})}computeMemoryLayout(e={}){let{width:t=this.width,height:i=this.height,depthOrArrayLayers:r=this.depth}=this._normalizeTextureReadOptions(e),{format:s,byteAlignment:n}=this;return o.vz.computeMemoryLayout({format:s,width:t,height:i,depth:r,byteAlignment:n})}readBuffer(e,t){throw Error("readBuffer not implemented")}readDataAsync(e){throw Error("readBuffer not implemented")}writeBuffer(e,t){throw Error("readBuffer not implemented")}writeData(e,t){throw Error("readBuffer not implemented")}readDataSyncWebGL(e){throw Error("readDataSyncWebGL not available")}generateMipmapsWebGL(){throw Error("generateMipmapsWebGL not available")}static normalizeProps(e,t){let i={...t},{width:r,height:s}=i;return"number"==typeof r&&(i.width=Math.max(1,Math.ceil(r))),"number"==typeof s&&(i.height=Math.max(1,Math.ceil(s))),i}_initializeData(e){this.device.isExternalImage(e)?this.copyExternalImage({image:e,width:this.width,height:this.height,depth:this.depth,mipLevel:0,x:0,y:0,z:0,aspect:"all",colorSpace:"srgb",premultipliedAlpha:!1,flipY:!1}):e&&this.copyImageData({data:e,mipLevel:0,x:0,y:0,z:0,aspect:"all"})}_normalizeCopyImageDataOptions(e){let{data:t,depth:i,...r}=e,s=this._normalizeTextureWriteOptions({...r,depthOrArrayLayers:r.depthOrArrayLayers??i});return{data:t,depth:s.depthOrArrayLayers,...s}}_normalizeCopyExternalImageOptions(e){let t=l._omitUndefined(e),i=t.mipLevel??0,r=this._getMipLevelSize(i),s=this.device.getExternalImageSize(e.image),n={...l.defaultCopyExternalImageOptions,...r,...s,...t};return n.width=Math.min(n.width,r.width-n.x),n.height=Math.min(n.height,r.height-n.y),n.depth=Math.min(n.depth,r.depthOrArrayLayers-n.z),n}_normalizeTextureReadOptions(e){let t=l._omitUndefined(e),i=t.mipLevel??0,r=this._getMipLevelSize(i),s={...l.defaultTextureReadOptions,...r,...t};return s.width=Math.min(s.width,r.width-s.x),s.height=Math.min(s.height,r.height-s.y),s.depthOrArrayLayers=Math.min(s.depthOrArrayLayers,r.depthOrArrayLayers-s.z),s}
805_getSupportedColorReadOptions(e){let t=this._normalizeTextureReadOptions(e),i=o.vz.getInfo(this.format);switch(this._validateColorReadAspect(t),this._validateColorReadFormat(i),this.dimension){case"2d":case"cube":case"cube-array":case"2d-array":case"3d":return t;default:throw Error(`${this} color readback does not support ${this.dimension} textures`)}}_validateColorReadAspect(e){if("all"!==e.aspect)throw Error(`${this} color readback only supports aspect 'all'`)}_validateColorReadFormat(e){if(e.compressed)throw Error(`${this} color readback does not support compressed formats (${this.format})`);switch(e.attachment){case"color":return;case"depth":throw Error(`${this} color readback does not support depth formats (${this.format})`);case"stencil":throw Error(`${this} color readback does not support stencil formats (${this.format})`);case"depth-stencil":throw Error(`${this} color readback does not support depth-stencil formats (${this.format})`);default:throw Error(`${this} color readback does not support format ${this.format}`)}}_normalizeTextureWriteOptions(e){let t=l._omitUndefined(e),i=t.mipLevel??0,r=this._getMipLevelSize(i),s={...l.defaultTextureWriteOptions,...r,...t};s.width=Math.min(s.width,r.width-s.x),s.height=Math.min(s.height,r.height-s.y),s.depthOrArrayLayers=Math.min(s.depthOrArrayLayers,r.depthOrArrayLayers-s.z);let n=o.vz.computeMemoryLayout({format:this.format,width:s.width,height:s.height,depth:s.depthOrArrayLayers,byteAlignment:this.byteAlignment}),a=n.bytesPerPixel*s.width;if(s.bytesPerRow=t.bytesPerRow??n.bytesPerRow,s.rowsPerImage=t.rowsPerImage??s.height,s.bytesPerRow<a)throw Error(`bytesPerRow (${s.bytesPerRow}) must be at least ${a} for ${this.format}`);if(s.rowsPerImage<s.height)throw Error(`rowsPerImage (${s.rowsPerImage}) must be at least ${s.height} for ${this.format}`);let h=this.device.getTextureFormatInfo(this.format).bytesPerPixel;if(h&&s.bytesPerRow%h!=0)throw Error(`bytesPerRow (${s.bytesPerRow}) must be a multiple of bytesPerPixel (${h}) for ${this.format}`);return s}_getMipLevelSize(e){let t=Math.max(1,this.width>>e);return{width:t,height:"1d"===this.baseDimension?1:Math.max(1,this.height>>e),depthOrArrayLayers:"3d"===this.dimension?Math.max(1,this.depth>>e):this.depth}}getAllocatedByteLength(){let e=0;for(let t=0;t<this.mipLevels;t++){let{width:i,height:r,depthOrArrayLayers:s}=this._getMipLevelSize(t);e+=o.vz.computeMemoryLayout({format:this.format,width:i,height:r,depth:s,byteAlignment:1}).byteLength}return e*this.samples}static _omitUndefined(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>void 0!==e))}static defaultProps={...r.F.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",usage:l.SAMPLE|l.RENDER|l.COPY_DST,width:void 0,height:void 0,depth:1,mipLevels:1,samples:void 0,sampler:{},view:void 0};static defaultCopyDataOptions={data:void 0,byteOffset:0,bytesPerRow:void 0,rowsPerImage:void 0,width:void 0,height:void 0,depthOrArrayLayers:void 0,depth:1,mipLevel:0,x:0,y:0,z:0,aspect:"all"};static defaultCopyExternalImageOptions={image:void 0,sourceX:0,sourceY:0,width:void 0,height:void 0,depth:1,mipLevel:0,x:0,y:0,z:0,aspect:"all",colorSpace:"srgb",premultipliedAlpha:!1,flipY:!1};static defaultTextureReadOptions={x:0,y:0,z:0,width:void 0,height:void 0,depthOrArrayLayers:1,mipLevel:0,aspect:"all"};static defaultTextureWriteOptions={byteOffset:0,bytesPerRow:void 0,rowsPerImage:void 0,x:0,y:0,z:0,width:void 0,height:void 0,depthOrArrayLayers:1,mipLevel:0,aspect:"all"}}},76664:(e,t,i)=>{"use strict";i.d(t,{Ay:()=>a,Ik:()=>h,uL:()=>u});var r=i(10840),s=i(24365),n=i(81849),o=i(48064);let a=function e(t){var i=(0,o.uN)(t);function s(e,t){var s=i((e=(0,r.Qh)(e)).r,(t=(0,r.Qh)(t)).r),n=i(e.g,t.g),a=i(e.b,t.b),l=(0,o.Ay)(e.opacity,t.opacity);return function(t){return e.r=s(t),e.g=n(t),e.b=a(t),e.opacity=l(t),e+""}}return s.gamma=e,s}(1);function l(e){return function(t){var i,s,n=t.length,o=Array(n),a=Array(n),l=Array(n);for(i=0;i<n;++i)s=(0,r.Qh)(t[i]),o[i]=s.r||0,a[i]=s.g||0,l[i]=s.b||0;return o=e(o),a=e(a),l=e(l),s.opacity=1,function(e){return s.r=o(e),s.g=a(e),s.b=l(e),s+""}}}var h=l(s.A),u=l(n.A)},76680:e=>{e.exports.RADIUS=6378137,e.exports.FLATTENING=1/298.257223563,e.exports.POLAR_RADIUS=6356752.3142},77142:(e,t,i)=>{"use strict";i.d(t,{$:()=>l,l:()=>h});var r,s=i(79904);!
vendor: 10,734 bytes, line 805
805function(e){e[e.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",e[e.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",e[e.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",e[e.POINTS=0]="POINTS",e[e.LINES=1]="LINES",e[e.LINE_LOOP=2]="LINE_LOOP",e[e.LINE_STRIP=3]="LINE_STRIP",e[e.TRIANGLES=4]="TRIANGLES",e[e.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",e[e.TRIANGLE_FAN=6]="TRIANGLE_FAN",e[e.ZERO=0]="ZERO",e[e.ONE=1]="ONE",e[e.SRC_COLOR=768]="SRC_COLOR",e[e.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.DST_ALPHA=772]="DST_ALPHA",e[e.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",e[e.DST_COLOR=774]="DST_COLOR",e[e.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",e[e.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",e[e.CONSTANT_COLOR=32769]="CONSTANT_COLOR",e[e.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",e[e.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",e[e.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",e[e.FUNC_ADD=32774]="FUNC_ADD",e[e.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",e[e.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",e[e.BLEND_EQUATION=32777]="BLEND_EQUATION",e[e.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",e[e.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",e[e.BLEND_DST_RGB=32968]="BLEND_DST_RGB",e[e.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",e[e.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",e[e.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",e[e.BLEND_COLOR=32773]="BLEND_COLOR",e[e.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",e[e.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",e[e.LINE_WIDTH=2849]="LINE_WIDTH",e[e.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",e[e.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",e[e.CULL_FACE_MODE=2885]="CULL_FACE_MODE",e[e.FRONT_FACE=2886]="FRONT_FACE",e[e.DEPTH_RANGE=2928]="DEPTH_RANGE",e[e.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",e[e.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",e[e.DEPTH_FUNC=2932]="DEPTH_FUNC",e[e.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",e[e.STENCIL_FUNC=2962]="STENCIL_FUNC",e[e.STENCIL_FAIL=2964]="STENCIL_FAIL",e[e.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",e[e.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",e[e.STENCIL_REF=2967]="STENCIL_REF",e[e.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",e[e.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",e[e.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",e[e.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",e[e.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",e[e.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",e[e.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",e[e.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",e[e.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",e[e.VIEWPORT=2978]="VIEWPORT",e[e.SCISSOR_BOX=3088]="SCISSOR_BOX",e[e.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",e[e.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",e[e.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",e[e.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",e[e.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",e[e.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",e[e.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",e[e.RED_BITS=3410]="RED_BITS",e[e.GREEN_BITS=3411]="GREEN_BITS",e[e.BLUE_BITS=3412]="BLUE_BITS",e[e.ALPHA_BITS=3413]="ALPHA_BITS",e[e.DEPTH_BITS=3414]="DEPTH_BITS",e[e.STENCIL_BITS=3415]="STENCIL_BITS",e[e.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",e[e.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",e[e.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",e[e.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",e[e.SAMPLES=32937]="SAMPLES",e[e.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",e[e.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",e[e.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",e[e.VENDOR=7936]="VENDOR",e[e.RENDERER=7937]="RENDERER",e[e.VERSION=7938]="VERSION",e[e.IMPLEMENTATION_COLOR_READ_TYPE=35738]="IMPLEMENTATION_COLOR_READ_TYPE",e[e.IMPLEMENTATION_COLOR_READ_FORMAT=35739]="IMPLEMENTATION_COLOR_READ_FORMAT",e[e.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",e[e.STATIC_DRAW=35044]="STATIC_DRAW",e[e.STREAM_DRAW=35040]="STREAM_DRAW",e[e.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",e[e.ARRAY_BUFFER=34962]="ARRAY_BUFFER",e[e.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",e[e.BUFFER_SIZE=34660]="BUFFER_SIZE",e[e.BUFFER_USAGE=34661]="BUFFER_USAGE",e[e.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",e[e.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",e[e.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",e[e.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",e[e.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",e[e.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",e[e.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",e[e.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",e[e.CULL_FACE=2884]="CULL_FACE",e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK",e[e.FRONT_AND_BACK=1032]="FRONT_AND_BACK",e[e.BLEND=3042]="BLEND",e[e.DEPTH_TEST=2929]="DEPTH_TEST",e[e.DITHER=3024]="DITHER",e[e.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",e[e.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",e[e.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",e[e.SCISSOR_TEST=3089]="SCISSOR_TEST",e[e.STENCIL_TEST=2960]="STENCIL_TEST",e[e.NO_ERROR=0]="NO_ERROR",e[e.INVALID_ENUM=1280]="INVALID_ENUM",e[e.INVALID_VALUE=1281]="INVALID_VALUE",e[e.INVALID_OPERATION=1282]="INVALID_OPERATION",e[e.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",e[e.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",e[e.CW=2304]="CW",e[e.CCW=2305]="CCW",e[e.DONT_CARE=4352]="DONT_CARE",e[e.FASTEST=4353]="FASTEST",e[e.NICEST=4354]="NICEST",e[e.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.INT=5124]="INT",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.FLOAT=5126]="FLOAT",e[e.DOUBLE=5130]="DOUBLE",e[e.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",e[e.ALPHA=6406]="ALPHA",e[e.RGB=6407]="RGB",e[e.RGBA=6408]="RGBA",e[e.LUMINANCE=6409]="LUMINANCE",e[e.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",e[e.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",e[e.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",e[e.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",e[e.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",e[e.VERTEX_SHADER=35633]="VERTEX_SHADER",e[e.COMPILE_STATUS=35713]="COMPILE_STATUS",e[e.DELETE_STATUS=35712]="DELETE_STATUS",e[e.LINK_STATUS=35714]="LINK_STATUS",e[e.VALIDATE_STATUS=35715]="VALIDATE_STATUS",e[e.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",e[e.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",e[e.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",e[e.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",e[e.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",e[e.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",e[e.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",e[e.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",e[e.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",e[e.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",e[e.SHADER_TYPE=35663]="SHADER_TYPE",e[e.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",e[e.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",e[e.NEVER=512]="NEVER",e[e.LESS=513]="LESS",e[e.EQUAL=514]="EQUAL",e[e.LEQUAL=515]="LEQUAL",e[e.GREATER=516]="GREATER",e[e.NOTEQUAL=517]="NOTEQUAL",e[e.GEQUAL=518]="GEQUAL",e[e.ALWAYS=519]="ALWAYS",e[e.KEEP=7680]="KEEP",e[e.REPLACE=7681]="REPLACE",e[e.INCR=7682]="INCR",e[e.DECR=7683]="DECR",e[e.INVERT=5386]="INVERT",e[e.INCR_WRAP=34055]="INCR_WRAP",e[e.DECR_WRAP=34056]="DECR_WRAP",e[e.NEAREST=9728]="NEAREST",e[e.LINEAR=9729]="LINEAR",e[e.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",e[e.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",e[e.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",e[e.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",e[e.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",e[e.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",e[e.TEXTURE_2D=3553]="TEXTURE_2D",e[e.TEXTURE=5890]="TEXTURE",e[e.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",e[e.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",e[e.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",e[e.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",e[e.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",e[e.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",e[e.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",e[e.TEXTURE0=33984]="TEXTURE0",e[e.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",e[e.REPEAT=10497]="REPEAT",e[e.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",e[e.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",e[e.TEXTURE_WIDTH=4096]="TEXTURE_WIDTH",e[e.TEXTURE_HEIGHT=4097]="TEXTURE_HEIGHT",e[e.FLOAT_VEC2=35664]="FLOAT_VEC2",e[e.FLOAT_VEC3=35665]="FLOAT_VEC3",e[e.FLOAT_VEC4=35666]="FLOAT_VEC4",e[e.INT_VEC2=35667]="INT_VEC2",e[e.INT_VEC3=35668]="INT_VEC3",e[e.INT_VEC4=35669]="INT_VEC4",e[e.BOOL=35670]="BOOL",e[e.BOOL_VEC2=35671]="BOOL_VEC2",e[e.BOOL_VEC3=35672]="BOOL_VEC3",e[e.BOOL_VEC4=35673]="BOOL_VEC4",e[e.FLOAT_MAT2=35674]="FLOAT_MAT2",e[e.FLOAT_MAT3=35675]="FLOAT_MAT3",e[e.FLOAT_MAT4=35676]="FLOAT_MAT4",e[e.SAMPLER_2D=35678]="SAMPLER_2D",e[e.SAMPLER_CUBE=35680]="SAMPLER_CUBE",e[e.LOW_FLOAT=36336]="LOW_FLOAT",e[e.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",e[e.HIGH_FLOAT=36338]="HIGH_FLOAT",e[e.LOW_INT=36339]="LOW_INT",e[e.MEDIUM_INT=36340]="MEDIUM_INT",e[e.HIGH_INT=36341]="HIGH_INT",e[e.FRAMEBUFFER=36160]="FRAMEBUFFER",e[e.RENDERBUFFER=36161]="RENDERBUFFER",e[e.RGBA4=32854]="RGBA4",e[e.RGB5_A1=32855]="RGB5_A1",e[e.RGB565=36194]="RGB565",e[e.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",e[e.STENCIL_INDEX=6401]="STENCIL_INDEX",e[e.STENCIL_INDEX8=36168]="STENCIL_INDEX8",e[e.DEPTH_STENCIL=34041]="DEPTH_STENCIL",e[e.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",e[e.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",e[e.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",e[e.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",e[e.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",e[e.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",e[e.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",e[e.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",e[e.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_OBJ
vendor: 14,201 bytes, line 805
805ECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",e[e.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",e[e.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",e[e.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",e[e.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",e[e.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",e[e.NONE=0]="NONE",e[e.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",e[e.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",e[e.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",e[e.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",e[e.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",e[e.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",e[e.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",e[e.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",e[e.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER",e[e.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",e[e.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",e[e.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",e[e.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",e[e.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",e[e.READ_BUFFER=3074]="READ_BUFFER",e[e.UNPACK_ROW_LENGTH=3314]="UNPACK_ROW_LENGTH",e[e.UNPACK_SKIP_ROWS=3315]="UNPACK_SKIP_ROWS",e[e.UNPACK_SKIP_PIXELS=3316]="UNPACK_SKIP_PIXELS",e[e.PACK_ROW_LENGTH=3330]="PACK_ROW_LENGTH",e[e.PACK_SKIP_ROWS=3331]="PACK_SKIP_ROWS",e[e.PACK_SKIP_PIXELS=3332]="PACK_SKIP_PIXELS",e[e.TEXTURE_BINDING_3D=32874]="TEXTURE_BINDING_3D",e[e.UNPACK_SKIP_IMAGES=32877]="UNPACK_SKIP_IMAGES",e[e.UNPACK_IMAGE_HEIGHT=32878]="UNPACK_IMAGE_HEIGHT",e[e.MAX_3D_TEXTURE_SIZE=32883]="MAX_3D_TEXTURE_SIZE",e[e.MAX_ELEMENTS_VERTICES=33e3]="MAX_ELEMENTS_VERTICES",e[e.MAX_ELEMENTS_INDICES=33001]="MAX_ELEMENTS_INDICES",e[e.MAX_TEXTURE_LOD_BIAS=34045]="MAX_TEXTURE_LOD_BIAS",e[e.MAX_FRAGMENT_UNIFORM_COMPONENTS=35657]="MAX_FRAGMENT_UNIFORM_COMPONENTS",e[e.MAX_VERTEX_UNIFORM_COMPONENTS=35658]="MAX_VERTEX_UNIFORM_COMPONENTS",e[e.MAX_ARRAY_TEXTURE_LAYERS=35071]="MAX_ARRAY_TEXTURE_LAYERS",e[e.MIN_PROGRAM_TEXEL_OFFSET=35076]="MIN_PROGRAM_TEXEL_OFFSET",e[e.MAX_PROGRAM_TEXEL_OFFSET=35077]="MAX_PROGRAM_TEXEL_OFFSET",e[e.MAX_VARYING_COMPONENTS=35659]="MAX_VARYING_COMPONENTS",e[e.FRAGMENT_SHADER_DERIVATIVE_HINT=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT",e[e.RASTERIZER_DISCARD=35977]="RASTERIZER_DISCARD",e[e.VERTEX_ARRAY_BINDING=34229]="VERTEX_ARRAY_BINDING",e[e.MAX_VERTEX_OUTPUT_COMPONENTS=37154]="MAX_VERTEX_OUTPUT_COMPONENTS",e[e.MAX_FRAGMENT_INPUT_COMPONENTS=37157]="MAX_FRAGMENT_INPUT_COMPONENTS",e[e.MAX_SERVER_WAIT_TIMEOUT=37137]="MAX_SERVER_WAIT_TIMEOUT",e[e.MAX_ELEMENT_INDEX=36203]="MAX_ELEMENT_INDEX",e[e.RED=6403]="RED",e[e.RGB8=32849]="RGB8",e[e.RGBA8=32856]="RGBA8",e[e.RGB10_A2=32857]="RGB10_A2",e[e.TEXTURE_3D=32879]="TEXTURE_3D",e[e.TEXTURE_WRAP_R=32882]="TEXTURE_WRAP_R",e[e.TEXTURE_MIN_LOD=33082]="TEXTURE_MIN_LOD",e[e.TEXTURE_MAX_LOD=33083]="TEXTURE_MAX_LOD",e[e.TEXTURE_BASE_LEVEL=33084]="TEXTURE_BASE_LEVEL",e[e.TEXTURE_MAX_LEVEL=33085]="TEXTURE_MAX_LEVEL",e[e.TEXTURE_COMPARE_MODE=34892]="TEXTURE_COMPARE_MODE",e[e.TEXTURE_COMPARE_FUNC=34893]="TEXTURE_COMPARE_FUNC",e[e.SRGB=35904]="SRGB",e[e.SRGB8=35905]="SRGB8",e[e.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",e[e.COMPARE_REF_TO_TEXTURE=34894]="COMPARE_REF_TO_TEXTURE",e[e.RGBA32F=34836]="RGBA32F",e[e.RGB32F=34837]="RGB32F",e[e.RGBA16F=34842]="RGBA16F",e[e.RGB16F=34843]="RGB16F",e[e.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",e[e.TEXTURE_BINDING_2D_ARRAY=35869]="TEXTURE_BINDING_2D_ARRAY",e[e.R11F_G11F_B10F=35898]="R11F_G11F_B10F",e[e.RGB9_E5=35901]="RGB9_E5",e[e.RGBA32UI=36208]="RGBA32UI",e[e.RGB32UI=36209]="RGB32UI",e[e.RGBA16UI=36214]="RGBA16UI",e[e.RGB16UI=36215]="RGB16UI",e[e.RGBA8UI=36220]="RGBA8UI",e[e.RGB8UI=36221]="RGB8UI",e[e.RGBA32I=36226]="RGBA32I",e[e.RGB32I=36227]="RGB32I",e[e.RGBA16I=36232]="RGBA16I",e[e.RGB16I=36233]="RGB16I",e[e.RGBA8I=36238]="RGBA8I",e[e.RGB8I=36239]="RGB8I",e[e.RED_INTEGER=36244]="RED_INTEGER",e[e.RGB_INTEGER=36248]="RGB_INTEGER",e[e.RGBA_INTEGER=36249]="RGBA_INTEGER",e[e.R8=33321]="R8",e[e.RG8=33323]="RG8",e[e.R16F=33325]="R16F",e[e.R32F=33326]="R32F",e[e.RG16F=33327]="RG16F",e[e.RG32F=33328]="RG32F",e[e.R8I=33329]="R8I",e[e.R8UI=33330]="R8UI",e[e.R16I=33331]="R16I",e[e.R16UI=33332]="R16UI",e[e.R32I=33333]="R32I",e[e.R32UI=33334]="R32UI",e[e.RG8I=33335]="RG8I",e[e.RG8UI=33336]="RG8UI",e[e.RG16I=33337]="RG16I",e[e.RG16UI=33338]="RG16UI",e[e.RG32I=33339]="RG32I",e[e.RG32UI=33340]="RG32UI",e[e.R8_SNORM=36756]="R8_SNORM",e[e.RG8_SNORM=36757]="RG8_SNORM",e[e.RGB8_SNORM=36758]="RGB8_SNORM",e[e.RGBA8_SNORM=36759]="RGBA8_SNORM",e[e.RGB10_A2UI=36975]="RGB10_A2UI",e[e.TEXTURE_IMMUTABLE_FORMAT=37167]="TEXTURE_IMMUTABLE_FORMAT",e[e.TEXTURE_IMMUTABLE_LEVELS=33503]="TEXTURE_IMMUTABLE_LEVELS",e[e.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",e[e.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",e[e.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",e[e.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",e[e.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",e[e.HALF_FLOAT=5131]="HALF_FLOAT",e[e.RG=33319]="RG",e[e.RG_INTEGER=33320]="RG_INTEGER",e[e.INT_2_10_10_10_REV=36255]="INT_2_10_10_10_REV",e[e.CURRENT_QUERY=34917]="CURRENT_QUERY",e[e.QUERY_RESULT=34918]="QUERY_RESULT",e[e.QUERY_RESULT_AVAILABLE=34919]="QUERY_RESULT_AVAILABLE",e[e.ANY_SAMPLES_PASSED=35887]="ANY_SAMPLES_PASSED",e[e.ANY_SAMPLES_PASSED_CONSERVATIVE=36202]="ANY_SAMPLES_PASSED_CONSERVATIVE",e[e.MAX_DRAW_BUFFERS=34852]="MAX_DRAW_BUFFERS",e[e.DRAW_BUFFER0=34853]="DRAW_BUFFER0",e[e.DRAW_BUFFER1=34854]="DRAW_BUFFER1",e[e.DRAW_BUFFER2=34855]="DRAW_BUFFER2",e[e.DRAW_BUFFER3=34856]="DRAW_BUFFER3",e[e.DRAW_BUFFER4=34857]="DRAW_BUFFER4",e[e.DRAW_BUFFER5=34858]="DRAW_BUFFER5",e[e.DRAW_BUFFER6=34859]="DRAW_BUFFER6",e[e.DRAW_BUFFER7=34860]="DRAW_BUFFER7",e[e.DRAW_BUFFER8=34861]="DRAW_BUFFER8",e[e.DRAW_BUFFER9=34862]="DRAW_BUFFER9",e[e.DRAW_BUFFER10=34863]="DRAW_BUFFER10",e[e.DRAW_BUFFER11=34864]="DRAW_BUFFER11",e[e.DRAW_BUFFER12=34865]="DRAW_BUFFER12",e[e.DRAW_BUFFER13=34866]="DRAW_BUFFER13",e[e.DRAW_BUFFER14=34867]="DRAW_BUFFER14",e[e.DRAW_BUFFER15=34868]="DRAW_BUFFER15",e[e.MAX_COLOR_ATTACHMENTS=36063]="MAX_COLOR_ATTACHMENTS",e[e.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",e[e.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",e[e.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",e[e.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",e[e.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",e[e.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",e[e.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",e[e.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",e[e.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",e[e.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",e[e.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",e[e.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",e[e.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",e[e.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",e[e.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15",e[e.SAMPLER_3D=35679]="SAMPLER_3D",e[e.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",e[e.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",e[e.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",e[e.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",e[e.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",e[e.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",e[e.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",e[e.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",e[e.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",e[e.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",e[e.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",e[e.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY",e[e.MAX_SAMPLES=36183]="MAX_SAMPLES",e[e.SAMPLER_BINDING=35097]="SAMPLER_BINDING",e[e.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",e[e.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",e[e.PIXEL_PACK_BUFFER_BINDING=35053]="PIXEL_PACK_BUFFER_BINDING",e[e.PIXEL_UNPACK_BUFFER_BINDING=35055]="PIXEL_UNPACK_BUFFER_BINDING",e[e.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",e[e.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",e[e.COPY_READ_BUFFER_BINDING=36662]="COPY_READ_BUFFER_BINDING",e[e.COPY_WRITE_BUFFER_BINDING=36663]="COPY_WRITE_BUFFER_BINDING",e[e.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",e[e.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",e[e.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",e[e.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",e[e.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",e[e.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",e[e.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",e[e.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",e[e.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",e[e.UNSIGNED_NORMALIZED=35863]="UNSIGNED_NORMALIZED",e[e.SIGNED_NORMALIZED=36764]="SIGNED_NORMALIZED",e[e.VERTEX_ATTRIB_ARRAY_INTEGER=35069]="VERTEX_ATTRIB_ARRAY_INTEGER",e[e.VERTEX_ATTRIB_ARRAY_DIVISOR=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR",e[e.TRANSFORM_FEEDBACK_BUFFER_MODE=35967]="TRANSFORM_FEEDBACK_BUFFER_MODE",e[e.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS=35968]="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",e[e.TRANSFORM_FEEDBACK_VARYINGS=35971]="TRANSFORM_FEEDBACK_VARYINGS",e[e.TRANSFORM_FEEDBACK_BUFFER_START=35972]="TRANSFORM_FEEDBACK_BUFFER_START",e[e.TRANSFORM_FEEDBACK_BUFFER_SIZE=35973]="TRANSFORM_FEEDBACK_BUFFER_SIZE",e[e.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN=35976]="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",e[e.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS=35978]="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",e[e.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS=35979]="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",e[e.INTERLEAVED_ATTRIBS=35980]="INTERLEAVED_ATTRIBS",e[e.SEPARATE_ATTRIBS=35981]="SEPARATE_ATTRIBS",e[e.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER",e[e.TRANSFORM_FEEDBACK_BUFFER_BINDING=35983]="TRANSFORM_FEEDBACK_BUFFER_BINDING",e[e.TRANSFORM_FEEDBACK=36386]="TRANSFORM_FEEDBACK",e[e.TRANSFORM_FEEDBACK_PAUSED=36387]="TRANSFORM_FEEDBACK_PAUSED",e[e.TRANSFORM_FEEDBACK_ACTIVE=36388]="TRANSFORM_FEEDBACK_ACTIVE",e[e.TRANSFORM_FEEDBACK_BINDING=36389]="TRANSFORM_FEEDBACK_BINDING",e[e.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",e[e.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",e[e.FRAMEBUFFER_ATTACHMENT_RED_SIZE=33298]="FRAMEBUFFER_ATTACHMENT_RED_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE=33299]="FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE=33300]="FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE=33301]="FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE=33302]="FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE=33303]="FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",e[e.FRAMEBUFFER_DEFAULT=33304]="FRAMEBUFFER_DEFAULT",e[e.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",e[e.DRAW_FRAMEBUFFER_BINDING=36006]="DRAW_FRAMEBUFFER_BINDING",e[e.READ_FRAMEBUFFER_BINDING=36010]="READ_FRAMEBUFFER_BINDING",e[e.RENDERBUFFER_SAMPLES=36011]="RENDERBUFFER_SAMPLES",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER=36052]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",e[e.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE=36182]="FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",e[e.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",e[e.UNIFORM_BUFFER_BINDING=35368]="UNIFORM_BUFFER_BINDING",e[e.UNIFORM_BUFFER_START=35369]="UNIFORM_BUFFER_START",e[e.UNIFORM_BUFFER_SIZE=35370]="UNIFORM_BUFFER_SIZE",e[e.MAX_VERTEX_UNIFORM_BLOCKS=35371]="MAX_VERTEX_UNIFORM_BLOCKS",e[e.MAX_FRAGMENT_UNIFORM_BLOCKS=35373]="MAX_FRAGMENT_UNIFORM_BLOCKS",e[e.MAX_COMBINED_UNIFORM_BLOCKS=35374]="MAX_COMBINED_UNIFORM_BLOCKS",e[e.MAX_UNIFORM_BUFFER_BINDINGS=35375]="MAX_UNIFORM_BUFFER_BINDINGS",e[e.MAX_UNIFORM_BLOCK_SIZE=35376]="MAX_UNIFORM_BLOCK_SIZE",e[e.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS=35377]="MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",e[e.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS=35379]="MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",e[e.UNIFORM_BUFFER_OFFSET_ALIGNMENT=35380]="UNIFORM_BUFFER_OFFSET_ALIGNMENT",e[e.ACTIVE_UNIFORM_BLOCKS=35382]="ACTIVE_UNIFORM_BLOCKS",e[e.UNIFORM_TYPE=35383]="UNIFORM_TYPE",e[e.UNIFORM_SIZE=35384]="UNIFORM_SIZE",e[e.UNIFORM_BLOCK_INDEX=35386]="UNIFORM_BLOCK_INDEX",e[e.UNIFORM_OFFSET=35387]="UNIFORM_OFFSET",e[e.UNIFORM_ARRAY_STRIDE=35388]="UNIFORM_ARRAY_STRIDE",e[e.UNIFORM_MATRIX_STRIDE=35389]="UNIFORM_MATRIX_STRIDE",e[e.UNIFORM_IS_ROW_MAJOR=35390]="UNIFORM_IS_ROW_MAJOR",e[e.UNIFORM_BLOCK_BINDING=35391]="UNIFORM_BLOCK_BINDING",e[e.UNIFORM_BLOCK_DATA_SIZE=35392]="UNIFORM_BLOCK_DATA_SIZE",e[e.UNIFORM_BLOCK_ACTIVE_UNIFORMS=35394]="UNIFORM_BLOCK_ACTIVE_UNIFORMS",e[e.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES=35395]="UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",e[e.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER=35396]="UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",e[e.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER=35398]="UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",e[e.OBJECT_TYPE=37138]="OBJECT_TYPE",e[e.SYNC_CONDITION=37139]="SYNC_CONDITION",e[e.SYNC_STATUS=37140]="SYNC_STATUS",e[e.SYNC_FLAGS=37141]="SYNC_FLAGS",e[e.SYNC_FENCE=37142]="SYNC_FENCE",e[e.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE",e[e.UNSIGNALED=37144]="UNSIGNALED",e[e.SIGNALED=37145]="SIGNALED",e[e.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",e[e.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",e[e.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",e[e.WAIT_FAILED=37149]="WAIT_FAILED",e[e.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT",e[e.COLOR=6144]="COLOR",e[e.DEPTH=6145]="DEPTH",e[e.STENCIL=6146]="STENCIL",e[e.MIN=32775]="MIN",e[e.MAX=32776]="MAX",e[e.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",e[e.STREAM_READ=35041]="STREAM_READ",e[e.STREAM_COPY=35042]="STREAM_COPY",e[e.STATIC_READ=35045]="STATIC_READ",e[e.STATIC_COPY=35046]="STATIC_COPY",e[e.DYNAMIC_READ=35049]="DYNAMIC_READ",e[e.DYNAMIC_COPY=35050]="DYNAMIC_COPY",e[e.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",e[e.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8",e[e.INVALID_INDEX=
8050xffffffff]="INVALID_INDEX",e[e.TIMEOUT_IGNORED=-1]="TIMEOUT_IGNORED",e[e.MAX_CLIENT_WAIT_TIMEOUT_WEBGL=37447]="MAX_CLIENT_WAIT_TIMEOUT_WEBGL",e[e.UNMASKED_VENDOR_WEBGL=37445]="UNMASKED_VENDOR_WEBGL",e[e.UNMASKED_RENDERER_WEBGL=37446]="UNMASKED_RENDERER_WEBGL",e[e.MAX_TEXTURE_MAX_ANISOTROPY_EXT=34047]="MAX_TEXTURE_MAX_ANISOTROPY_EXT",e[e.TEXTURE_MAX_ANISOTROPY_EXT=34046]="TEXTURE_MAX_ANISOTROPY_EXT",e[e.R16_EXT=33322]="R16_EXT",e[e.RG16_EXT=33324]="RG16_EXT",e[e.RGB16_EXT=32852]="RGB16_EXT",e[e.RGBA16_EXT=32859]="RGBA16_EXT",e[e.R16_SNORM_EXT=36760]="R16_SNORM_EXT",e[e.RG16_SNORM_EXT=36761]="RG16_SNORM_EXT",e[e.RGB16_SNORM_EXT=36762]="RGB16_SNORM_EXT",e[e.RGBA16_SNORM_EXT=36763]="RGBA16_SNORM_EXT",e[e.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",e[e.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",e[e.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",e[e.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",e[e.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",e[e.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",e[e.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",e[e.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",e[e.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",e[e.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",e[e.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",e[e.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",e[e.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",e[e.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",e[e.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",e[e.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",e[e.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",e[e.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",e[e.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",e[e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",e[e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",e[e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",e[e.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",e[e.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",e[e.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",e[e.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",e[e.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",e[e.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",e[e.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",e[e.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",e[e.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",e[e.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",e[e.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",e[e.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",e[e.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",e[e.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",e[e.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",e[e.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",e[e.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",e[e.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",e[e.QUERY_COUNTER_BITS_EXT=34916]="QUERY_COUNTER_BITS_EXT",e[e.CURRENT_QUERY_EXT=34917]="CURRENT_QUERY_EXT",e[e.QUERY_RESULT_EXT=34918]="QUERY_RESULT_EXT",e[e.QUERY_RESULT_AVAILABLE_EXT=34919]="QUERY_RESULT_AVAILABLE_EXT",e[e.TIME_ELAPSED_EXT=35007]="TIME_ELAPSED_EXT",e[e.TIMESTAMP_EXT=36392]="TIMESTAMP_EXT",e[e.GPU_DISJOINT_EXT=36795]="GPU_DISJOINT_EXT",e[e.COMPLETION_STATUS_KHR=37297]="COMPLETION_STATUS_KHR",e[e.DEPTH_CLAMP_EXT=34383]="DEPTH_CLAMP_EXT",e[e.FIRST_VERTEX_CONVENTION_WEBGL=36429]="FIRST_VERTEX_CONVENTION_WEBGL",e[e.LAST_VERTEX_CONVENTION_WEBGL=36430]="LAST_VERTEX_CONVENTION_WEBGL",e[e.PROVOKING_VERTEX_WEBL=36431]="PROVOKING_VERTEX_WEBL",e[e.POLYGON_MODE_WEBGL=2880]="POLYGON_MODE_WEBGL",e[e.POLYGON_OFFSET_LINE_WEBGL=10754]="POLYGON_OFFSET_LINE_WEBGL",e[e.LINE_WEBGL=6913]="LINE_WEBGL",e[e.FILL_WEBGL=6914]="FILL_WEBGL",e[e.MAX_CLIP_DISTANCES_WEBGL=3378]="MAX_CLIP_DISTANCES_WEBGL",e[e.MAX_CULL_DISTANCES_WEBGL=33529]="MAX_CULL_DISTANCES_WEBGL",e[e.MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL=33530]="MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL",e[e.CLIP_DISTANCE0_WEBGL=12288]="CLIP_DISTANCE0_WEBGL",e[e.CLIP_DISTANCE1_WEBGL=12289]="CLIP_DISTANCE1_WEBGL",e[e.CLIP_DISTANCE2_WEBGL=12290]="
805CLIP_DISTANCE2_WEBGL",e[e.CLIP_DISTANCE3_WEBGL=12291]="CLIP_DISTANCE3_WEBGL",e[e.CLIP_DISTANCE4_WEBGL=12292]="CLIP_DISTANCE4_WEBGL",e[e.CLIP_DISTANCE5_WEBGL=12293]="CLIP_DISTANCE5_WEBGL",e[e.CLIP_DISTANCE6_WEBGL=12294]="CLIP_DISTANCE6_WEBGL",e[e.CLIP_DISTANCE7_WEBGL=12295]="CLIP_DISTANCE7_WEBGL",e[e.POLYGON_OFFSET_CLAMP_EXT=36379]="POLYGON_OFFSET_CLAMP_EXT",e[e.LOWER_LEFT_EXT=36001]="LOWER_LEFT_EXT",e[e.UPPER_LEFT_EXT=36002]="UPPER_LEFT_EXT",e[e.NEGATIVE_ONE_TO_ONE_EXT=37726]="NEGATIVE_ONE_TO_ONE_EXT",e[e.ZERO_TO_ONE_EXT=37727]="ZERO_TO_ONE_EXT",e[e.CLIP_ORIGIN_EXT=37724]="CLIP_ORIGIN_EXT",e[e.CLIP_DEPTH_MODE_EXT=37725]="CLIP_DEPTH_MODE_EXT",e[e.SRC1_COLOR_WEBGL=35065]="SRC1_COLOR_WEBGL",e[e.SRC1_ALPHA_WEBGL=34185]="SRC1_ALPHA_WEBGL",e[e.ONE_MINUS_SRC1_COLOR_WEBGL=35066]="ONE_MINUS_SRC1_COLOR_WEBGL",e[e.ONE_MINUS_SRC1_ALPHA_WEBGL=35067]="ONE_MINUS_SRC1_ALPHA_WEBGL",e[e.MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL=35068]="MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL",e[e.MIRROR_CLAMP_TO_EDGE_EXT=34627]="MIRROR_CLAMP_TO_EDGE_EXT"}(r||(r={}));var n=i(2622),o=i(36286);function a(e){return e.luma=e.luma||{},e.luma}async function l(){(0,n.B)()&&!globalThis.WebGLDebugUtils&&(globalThis.global=globalThis.global||globalThis,globalThis.global.module={},await (0,o.k)("https://unpkg.com/[email protected]/index.js"))}function h(e,t={}){return t.debugWebGL||t.traceWebGL?function(e,t){if(!globalThis.WebGLDebugUtils)return s.R.warn("webgl-debug not loaded")(),e;let i=a(e);if(i.debugContext)return i.debugContext;globalThis.WebGLDebugUtils.init({...r,...e});let n=globalThis.WebGLDebugUtils.makeDebugContext(e,c.bind(null,t),d.bind(null,t));for(let e in r)e in n||"number"!=typeof r[e]||(n[e]=r[e]);class o{}Object.setPrototypeOf(n,Object.getPrototypeOf(e)),Object.setPrototypeOf(o,n);let l=Object.create(o);return i.realContext=e,i.debugContext=l,l.luma=i,l.debug=!0,l}(e,t):function(e){let t=a(e);return t.realContext?t.realContext:e}(e)}function u(e,t){t=Array.from(t).map(e=>void 0===e?"undefined":e);let i=globalThis.WebGLDebugUtils.glFunctionArgsToString(e,t);return i=`${i.slice(0,100)}${i.length>100?"...":""}`,`gl.${e}(${i})`}function c(e,t,i,r){r=Array.from(r).map(e=>void 0===e?"undefined":e);let n=globalThis.WebGLDebugUtils.glEnumToString(t),o=globalThis.WebGLDebugUtils.glFunctionArgsToString(i,r),a=`${n} in gl.${i}(${o})`;throw s.R.error("%cWebGL","color: white; background: red; padding: 2px 6px; border-radius: 3px;",a)(),Error(a)}function d(e,t,i){let r="";for(let n of(e.traceWebGL&&s.R.level>=1&&(r=u(t,i),s.R.info(1,"%cWebGL","color: white; background: blue; padding: 2px 6px; border-radius: 3px;",r)()),i))void 0===n&&(r=r||u(t,i))}},77513:(e,t,i)=>{"use strict";var r=i(75278);function s(e,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(n,this,t),this.length=this._features.length}function n(e,t,i){15===e?t.version=i.readVarint():1===e?t.name=i.readString():5===e?t.extent=i.readVarint():2===e?t._features.push(i.pos):3===e?t._keys.push(i.readString()):4===e&&t._values.push(function(e){for(var t=null,i=e.readVarint()+e.pos;e.pos<i;){var r=e.readVarint()>>3;t=1===r?e.readString():2===r?e.readFloat():3===r?e.readDouble():4===r?e.readVarint64():5===r?e.readVarint():6===r?e.readSVarint():7===r?e.readBoolean():null}return t}(i))}e.exports=s,s.prototype.feature=function(e){if(e<0||e>=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[e];var t=this._pbf.readVarint()+this._pbf.pos;return new r(this._pbf,t,this.extent,this._keys,this._values)}},77541:(e,t,i)=>{"use strict";i.d(t,{WebGLDevice:()=>ts});var r=i(64734),s=i(79904);let n={3042:!1,32773:new Float32Array([0,0,0,0]),32777:32774,34877:32774,32969:1,32968:0,32971:1,32970:0,3106:new Float32Array([0,0,0,0]),3107:[!0,!0,!0,!0],2884:!1,2885:1029,2929:!1,2931:1,2932:513,2928:new Float32Array([0,1]),2930:!0,3024:!0,35725:null,36006:null,36007:null,34229:null,34964:null,2886:2305,33170:4352,2849:1,32823:!1,32824:0,10752:0,32926:!1,32928:!1,32938:1,32939:!1,3089:!1,3088:new Int32Array([0,0,1024,1024]),2960:!1,2961:0,2968:0xffffffff,36005:0xffffffff,2962:519,2967:0,2963:0xffffffff,34816:519,36003:0,36004:0xffffffff,2964:7680,2965:7680,2966:7680,34817:7680,34818:7680,34819:7680,2978:[0,0,1024,1024],36389:null,36662:null,36663:null,35053:null,35055:null,35723:4352,36010:null,35977:!1,3333:4,3317:4,37440:!1,37441:!1,37443:37444,3330:0,3332:0,3331:0,3314:0,32878:0,3316:0,3315:0,32877:0},o=(e,t,i)=>t?e.enable(i):e.disable(i),a=(e,t,i)=>e.hint(i,t),l=(e,t,i)=>e.pixelStorei(i,t),h=(e,t,i)=>e.bindFramebuffer(36006===i?36009:36008,t),u=(e,t,i)=>{e.bindBuffer({34964:34962,36662:36662,36663:36663,35053:35051,35055:35052}[i],t)};function c(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}
vendor: 2,100 bytes, line 805
805let d={3042:o,32773:(e,t)=>e.blendColor(...t),32777:"blendEquation",34877:"blendEquation",32969:"blendFunc",32968:"blendFunc",32971:"blendFunc",32970:"blendFunc",3106:(e,t)=>e.clearColor(...t),3107:(e,t)=>e.colorMask(...t),2884:o,2885:(e,t)=>e.cullFace(t),2929:o,2931:(e,t)=>e.clearDepth(t),2932:(e,t)=>e.depthFunc(t),2928:(e,t)=>e.depthRange(...t),2930:(e,t)=>e.depthMask(t),3024:o,35723:a,35725:(e,t)=>e.useProgram(t),36007:(e,t)=>e.bindRenderbuffer(36161,t),36389:(e,t)=>e.bindTransformFeedback?.(36386,t),34229:(e,t)=>e.bindVertexArray(t),36006:h,36010:h,34964:u,36662:u,36663:u,35053:u,35055:u,2886:(e,t)=>e.frontFace(t),33170:a,2849:(e,t)=>e.lineWidth(t),32823:o,32824:"polygonOffset",10752:"polygonOffset",35977:o,32926:o,32928:o,32938:"sampleCoverage",32939:"sampleCoverage",3089:o,3088:(e,t)=>e.scissor(...t),2960:o,2961:(e,t)=>e.clearStencil(t),2968:(e,t)=>e.stencilMaskSeparate(1028,t),36005:(e,t)=>e.stencilMaskSeparate(1029,t),2962:"stencilFuncFront",2967:"stencilFuncFront",2963:"stencilFuncFront",34816:"stencilFuncBack",36003:"stencilFuncBack",36004:"stencilFuncBack",2964:"stencilOpFront",2965:"stencilOpFront",2966:"stencilOpFront",34817:"stencilOpBack",34818:"stencilOpBack",34819:"stencilOpBack",2978:(e,t)=>e.viewport(...t),34383:o,10754:o,12288:o,12289:o,12290:o,12291:o,12292:o,12293:o,12294:o,12295:o,3333:l,3317:l,37440:l,37441:l,37443:l,3330:l,3332:l,3331:l,3314:l,32878:l,3316:l,3315:l,32877:l,framebuffer:(e,t)=>{let i=t&&"handle"in t?t.handle:t;return e.bindFramebuffer(36160,i)},blend:(e,t)=>t?e.enable(3042):e.disable(3042),blendColor:(e,t)=>e.blendColor(...t),blendEquation:(e,t)=>{e.blendEquationSeparate(..."number"==typeof t?[t,t]:t)},blendFunc:(e,t)=>{let i=t?.length===2?[...t,...t]:t;e.blendFuncSeparate(...i)},clearColor:(e,t)=>e.clearColor(...t),clearDepth:(e,t)=>e.clearDepth(t),clearStencil:(e,t)=>e.clearStencil(t),colorMask:(e,t)=>e.colorMask(...t),cull:(e,t)=>t?e.enable(2884):e.disable(2884),cullFace:(e,t)=>e.cullFace(t),depthTest:(e,t)=>t?e.enable(2929):e.disable(2929),depthFunc:(e,t)=>e.depthFunc(t),depthMask:(e,t)=>e.depthMask(t),depthRange:(e,t)=>
805e.depthRange(...t),dither:(e,t)=>t?e.enable(3024):e.disable(3024),derivativeHint:(e,t)=>{e.hint(35723,t)},frontFace:(e,t)=>e.frontFace(t),mipmapHint:(e,t)=>e.hint(33170,t),lineWidth:(e,t)=>e.lineWidth(t),polygonOffsetFill:(e,t)=>t?e.enable(32823):e.disable(32823),polygonOffset:(e,t)=>e.polygonOffset(...t),sampleCoverage:(e,t)=>e.sampleCoverage(t[0],t[1]||!1),scissorTest:(e,t)=>t?e.enable(3089):e.disable(3089),scissor:(e,t)=>e.scissor(...t),stencilTest:(e,t)=>t?e.enable(2960):e.disable(2960),stencilMask:(e,t)=>{let[i,r]=t=c(t)?t:[t,t];e.stencilMaskSeparate(1028,i),e.stencilMaskSeparate(1029,r)},stencilFunc:(e,t)=>{let[i,r,s,n,o,a]=t=c(t)&&3===t.length?[...t,...t]:t;e.stencilFuncSeparate(1028,i,r,s),e.stencilFuncSeparate(1029,n,o,a)},stencilOp:(e,t)=>{let[i,r,s,n,o,a]=t=c(t)&&3===t.length?[...t,...t]:t;e.stencilOpSeparate(1028,i,r,s),e.stencilOpSeparate(1029,n,o,a)},viewport:(e,t)=>e.viewport(...t)};function f(e,t,i){return void 0!==t[e]?t[e]:i[e]}let p={blendEquation:(e,t,i)=>e.blendEquationSeparate(f(32777,t,i),f(34877,t,i)),blendFunc:(e,t,i)=>e.blendFuncSeparate(f(32969,t,i),f(32968,t,i),f(32971,t,i),f(32970,t,i)),polygonOffset:(e,t,i)=>e.polygonOffset(f(32824,t,i),f(10752,t,i)),sampleCoverage:(e,t,i)=>e.sampleCoverage(f(32938,t,i),f(32939,t,i)),stencilFuncFront:(e,t,i)=>e.stencilFuncSeparate(1028,f(2962,t,i),f(2967,t,i),f(2963,t,i)),stencilFuncBack:(e,t,i)=>e.stencilFuncSeparate(1029,f(34816,t,i),f(36003,t,i),f(36004,t,i)),stencilOpFront:(e,t,i)=>e.stencilOpSeparate(1028,f(2964,t,i),f(2965,t,i),f(2966,t,i)),stencilOpBack:(e,t,i)=>e.stencilOpSeparate(1029,f(34817,t,i),f(34818,t,i),f(34819,t,i))},g={enable:(e,t)=>
805e({[t]:!0}),disable:(e,t)=>e({[t]:!1}),pixelStorei:(e,t,i)=>e({[t]:i}),hint:(e,t,i)=>e({[t]:i}),useProgram:(e,t)=>e({35725:t}),bindRenderbuffer:(e,t,i)=>e({36007:i}),bindTransformFeedback:(e,t,i)=>e({36389:i}),bindVertexArray:(e,t)=>e({34229:t}),bindFramebuffer:(e,t,i)=>{switch(t){case 36160:return e({36006:i,36010:i});case 36009:return e({36006:i});case 36008:return e({36010:i});default:return null}},bindBuffer:(e,t,i)=>{let r={34962:[34964],36662:[36662],36663:[36663],35051:[35053],35052:[35055]}[t];return r?e({[r]:i}):{valueChanged:!0}},blendColor:(e,t,i,r,s)=>e({32773:new Float32Array([t,i,r,s])}),blendEquation:(e,t)=>e({32777:t,34877:t}),blendEquationSeparate:(e,t,i)=>e({32777:t,34877:i}),blendFunc:(e,t,i)=>e({32969:t,32968:i,32971:t,32970:i}),blendFuncSeparate:(e,t,i,r,s)=>e({32969:t,32968:i,32971:r,32970:s}),clearColor:(e,t,i,r,s)=>e({3106:new Float32Array([t,i,r,s])}),clearDepth:(e,t)=>e({2931:t}),clearStencil:(e,t)=>e({2961:t}),colorMask:(e,t,i,r,s)=>e({3107:[t,i,r,s]}),cullFace:(e,t)=>e({2885:t}),depthFunc:(e,t)=>e({2932:t}),depthRange:(e,t,i)=>e({2928:new Float32Array([t,i])}),depthMask:(e,t)=>e({2930:t}),frontFace:(e,t)=>e({2886:t}),lineWidth:(e,t)=>e({2849:t}),polygonOffset:(e,t,i)=>e({32824:t,10752:i}),sampleCoverage:(e,t,i)=>e({32938:t,32939:i}),scissor:(e,t,i,r,s)=>e({3088:new Int32Array([t,i,r,s])}),stencilMask:(e,t)=>e({2968:t,36005:t}),stencilMaskSeparate:(e,t,i)=>e({[1028===t?2968:36005]:i}),stencilFunc:(e,t,i,r)=>e({2962:t,2967:i,2963:r,34816:t,36003:i,36004:r}),stencilFuncSeparate:(e,t,i,r,s)=>e({[1028===t?2962:34816]:i,[1028===t?2967:36003]:r,[1028===t?2963:36004]:s}),stencilOp:(e,t,i,r)=>e({2964:t,2965:i,2966:r,34817:t,34818:i,34819:r}),stencilOpSeparate:(e,t,i,r,s)=>e({[1028===t?2964:34817]:i,[1028===t?2965:34818]:r,[1028===t?2966:34819]:s}),viewport:(e,t,i,r,s)=>e({2978:[t,i,r,s]})},m=(e,t)=>e.isEnabled(t),_={3042:m,2884:m,2929:m,3024:m,32823:m,32926:m,32928:m,3089:m,2960:m,35977:m},y=new Set([34016,36388,36387,35983,35368,34965,35739,35738,3074,34853,34854,34855,34856,34857,34858,34859,34860,34861,34862,34863,34864,34865,34866,34867,34868,35097,32873,35869,32874,34068]);function v(e,t){if(function(e){for(let t in e)return!1;return!0}(t))return;let i={};for(let r in t){let s=Number(r),n=d[r];n&&("string"==typeof n?i[n]=!0:n(e,t[r],s))}let r=e.lumaState?.cache;if(r)for(let s in i)(0,p[s])(e,t,r)}function b(e,t=n){if("number"==typeof t){let i=_[t];return i?i(e,t):e.getParameter(t)}let i=Array.isArray(t)?t:Object.keys(t),r={};for(let t of i){let i=_[t];r[t]=i?i(e,Number(t)):e.getParameter(Number(t))}return r}function E(e){return Array.isArray(e)||ArrayBuffer.isView(e)}class x{static get(e){return e.lumaState}gl;program=null;stateStack=[];enable=!0;cache=null;log;initialized=!1;constructor(e,t){this.gl=e,this.log=t?.log||(()=>{}),this._updateCache=this._updateCache.bind(this),Object.seal(this)}push(e={}){this.stateStack.push({})}pop(){let e=this.stateStack[this.stateStack.length-1];v(this.gl,e),this.stateStack.pop()}trackState(e,t){if(this.cache=t?.copyState?b(e):Object.assign({},n),this.initialized)throw Error("WebGLStateTracker");for(let t in this.initialized=!0,this.gl.lumaState=this,function(e){let t=e.useProgram.bind(e);e.useProgram=function(i){let r=x.get(e);r.program!==i&&(t(i),r.program=i)}}(e),g){let i=g[t];!function(e,t,i){if(!e[t])return;let r=e[t].bind(e);e[t]=function(...t){let{valueChanged:s,oldValue:n}=i(x.get(e)._updateCache,...t);return s&&r(...t),n}
805,Object.defineProperty(e[t],"name",{value:`${t}-to-cache`,configurable:!1})}(e,t,i)}w(e,"getParameter"),w(e,"isEnabled")}_updateCache(e){let t,i=!1,r=this.stateStack.length>0?this.stateStack[this.stateStack.length-1]:null;for(let s in e){let n=e[s],o=this.cache[s];!function(e,t){if(e===t)return!0;if(E(e)&&E(t)&&e.length===t.length){for(let i=0;i<e.length;++i)if(e[i]!==t[i])return!1;return!0}return!1}(n,o)&&(i=!0,t=o,!r||s in r||(r[s]=o),this.cache[s]=n)}return{valueChanged:i,oldValue:t}}}function w(e,t){let i=e[t].bind(e);e[t]=function(t){if(void 0===t||y.has(t))return i(t);let r=x.get(e);return t in r.cache||(r.cache[t]=i(t)),r.enable?r.cache[t]:i(t)},Object.defineProperty(e[t],"name",{value:`${t}-from-cache`,configurable:!1})}var S=i(29884);function P(e,t,i){return void 0===i[t]&&(i[t]=e.getExtension(t)||null),i[t]}function T(e,t){return/NVIDIA/i.exec(e)||/NVIDIA/i.exec(t)?"nvidia":/INTEL/i.exec(e)||/INTEL/i.exec(t)?"intel":/Apple/i.exec(e)||/Apple/i.exec(t)?"apple":/AMD/i.exec(e)||/AMD/i.exec(t)||/ATI/i.exec(e)||/ATI/i.exec(t)?"amd":/SwiftShader/i.exec(e)||/SwiftShader/i.exec(t)?"software":"unknown"}var A=i(30971);function M(e){switch(e){case"uint8":case"unorm8":return 5121;case"sint8":case"snorm8":return 5120;case"uint16":case"unorm16":return 5123;case"sint16":case"snorm16":return 5122;case"uint32":return 5125;case"sint32":return 5124;case"float16":return 5131;case"float32":return 5126}throw Error(String(e))}let C="WEBGL_compressed_texture_s3tc",R="WEBGL_compressed_texture_s3tc_srgb",L="EXT_texture_compression_rgtc",I="EXT_texture_compression_bptc",O="EXT_render_snorm",N="EXT_color_buffer_float",F="snorm8-renderable-webgl",D="norm16-renderable-webgl",B="snorm16-renderable-webgl",G="float16-renderable-webgl",k="float32-renderable-webgl",U={"float32-renderable-webgl":{extensions:[N]},"float16-renderable-webgl":{extensions:["EXT_color_buffer_half_float"]},"rgb9e5ufloat-renderable-webgl":{extensions:["WEBGL_render_shared_exponent"]},"snorm8-renderable-webgl":{extensions:[O]},"norm16-webgl":{extensions:["EXT_texture_norm16"]},"norm16-renderable-webgl":{features:["norm16-webgl"]},"snorm16-renderable-webgl":{features:["norm16-webgl"],extensions:[O]},"float32-filterable":{extensions:["OES_texture_float_linear"]},"float16-filterable-webgl":{extensions:["OES_texture_half_float_linear"]},"texture-filterable-anisotropic-webgl":{extensions:["EXT_texture_filter_anisotropic"]},"texture-blend-float-webgl":{extensions:["EXT_float_blend"]},"texture-compression-bc":{extensions:[C,R,L,I]},"texture-compression-bc5-webgl":{extensions:[L]},"texture-compression-bc7-webgl":{extensions:[I]},"texture-compression-etc2":{extensions:["WEBGL_compressed_texture_etc"]},"texture-compression-astc":{extensions:["WEBGL_compressed_texture_astc"]},"texture-compression-etc1-webgl":{extensions:["WEBGL_compressed_texture_etc1"]},"texture-compression-pvrtc-webgl":{extensions:["WEBGL_compressed_texture_pvrtc"]},"texture-compression-atc-webgl":{extensions:["WEBGL_compressed_texture_atc"]}};function z(e,t,i){return function e(t,i,r,s){let n=U[i];if(!n||s.has(i))return!1;s.add(i);let o=(n.features||[]).every(i=>e(t,i,r,s));return s.delete(i),!!o&&(n.extensions||[]).every(e=>!!P(t,e,r))}(e,t,i,new Set)}let j={r8unorm:{gl:33321,rb:!0},r8snorm:{gl:36756,r:F},r8uint:{gl:33330,rb:!0},r8sint:{gl:33329,rb:!0},rg8unorm:{gl:33323,rb:!0},rg8snorm:{gl:36757,r:F},rg8uint:{gl:33336,rb:!0},rg8sint:{gl:33335,rb:!0},r16uint:{gl:33332,rb:!0},r16sint:{gl:33331,rb:!0},r16float:{gl:33325,rb:!0,r:G},r16unorm:{gl:33322,rb:!0,r:D},r16snorm:{gl:36760,r:B},"rgba4unorm-webgl":{gl:32854,rb:!0},"rgb565unorm-webgl":{gl:36194,rb:!0},"rgb5a1unorm-webgl":{gl:32855,rb:!0},"rgb8unorm-webgl":{gl:32849},"rgb8snorm-webgl":{gl:36758},rgba8unorm:{gl:32856},"rgba8unorm-srgb":{gl:35907},rgba8snorm:{gl:36759,r:F},rgba8uint:{gl:36220},rgba8sint:{gl:36238},bgra8unorm:{},"bgra8unorm-srgb":{},rg16uint:{gl:33338},rg16sint:{gl:33337},rg16float:{gl:33327,rb:!0,r:G},rg16unorm:{gl:33324,r:D},rg16snorm:{gl:36761,r:B},r32uint:{gl:33334,rb:!0},r32sint:{gl:33333,rb:!0},r32float:{gl:33326,r:k},rgb9e5ufloat:{gl:35901,r:"rgb9e5ufloat-renderable-webgl"},rg11b10ufloat:{gl:35898,rb:!0}
805,rgb10a2unorm:{gl:32857,rb:!0},rgb10a2uint:{gl:36975,rb:!0},"rgb16unorm-webgl":{gl:32852,r:!1},"rgb16snorm-webgl":{gl:36762,r:!1},rg32uint:{gl:33340,rb:!0},rg32sint:{gl:33339,rb:!0},rg32float:{gl:33328,rb:!0,r:k},rgba16uint:{gl:36214,rb:!0},rgba16sint:{gl:36232,rb:!0},rgba16float:{gl:34842,r:G},rgba16unorm:{gl:32859,rb:!0,r:D},rgba16snorm:{gl:36763,r:B},"rgb32float-webgl":{gl:34837,x:N,r:k,dataFormat:6407,types:[5126]},rgba32uint:{gl:36208,rb:!0},rgba32sint:{gl:36226,rb:!0},rgba32float:{gl:34836,rb:!0,r:k},stencil8:{gl:36168,rb:!0},depth16unorm:{gl:33189,dataFormat:6402,types:[5123],rb:!0},depth24plus:{gl:33190,dataFormat:6402,types:[5125]},depth32float:{gl:36012,dataFormat:6402,types:[5126],rb:!0},"depth24plus-stencil8":{gl:35056,rb:!0,depthTexture:!0,dataFormat:34041,types:[34042]},"depth32float-stencil8":{gl:36013,dataFormat:34041,types:[36269],rb:!0},"bc1-rgb-unorm-webgl":{gl:33776,x:C},"bc1-rgb-unorm-srgb-webgl":{gl:35916,x:R},"bc1-rgba-unorm":{gl:33777,x:C},"bc1-rgba-unorm-srgb":{gl:35916,x:R},"bc2-rgba-unorm":{gl:33778,x:C},"bc2-rgba-unorm-srgb":{gl:35918,x:R},"bc3-rgba-unorm":{gl:33779,x:C},"bc3-rgba-unorm-srgb":{gl:35919,x:R},"bc4-r-unorm":{gl:36283,x:L},"bc4-r-snorm":{gl:36284,x:L},"bc5-rg-unorm":{gl:36285,x:L},"bc5-rg-snorm":{gl:36286,x:L},"bc6h-rgb-ufloat":{gl:36495,x:I},"bc6h-rgb-float":{gl:36494,x:I},"bc7-rgba-unorm":{gl:36492,x:I},"bc7-rgba-unorm-srgb":{gl:36493,x:I},"etc2-rgb8unorm":{gl:37492},"etc2-rgb8unorm-srgb":{gl:37494},"etc2-rgb8a1unorm":{gl:37496},"etc2-rgb8a1unorm-srgb":{gl:37497},"etc2-rgba8unorm":{gl:37493},"etc2-rgba8unorm-srgb":{gl:37495},"eac-r11unorm":{gl:37488},"eac-r11snorm":{gl:37489},"eac-rg11unorm":{gl:37490},"eac-rg11snorm":{gl:37491},"astc-4x4-unorm":{gl:37808},"astc-4x4-unorm-srgb":{gl:37840},"astc-5x4-unorm":{gl:37809},"astc-5x4-unorm-srgb":{gl:37841},"astc-5x5-unorm":{gl:37810},"astc-5x5-unorm-srgb":{gl:37842},"astc-6x5-unorm":{gl:37811},"astc-6x5-unorm-srgb":{gl:37843},"astc-6x6-unorm":{gl:37812},"astc-6x6-unorm-srgb":{gl:37844},"astc-8x5-unorm":{gl:37813},"astc-8x5-unorm-srgb":{gl:37845},"astc-8x6-unorm":{gl:37814},"astc-8x6-unorm-srgb":{gl:37846},"astc-8x8-unorm":{gl:37815},"astc-8x8-unorm-srgb":{gl:37847},"astc-10x5-unorm":{gl:37816},"astc-10x5-unorm-srgb":{gl:37848},"astc-10x6-unorm":{gl:37817},"astc-10x6-unorm-srgb":{gl:37849},"astc-10x8-unorm":{gl:37818},"astc-10x8-unorm-srgb":{gl:37850},"astc-10x10-unorm":{gl:37819},"astc-10x10-unorm-srgb":{gl:37851},"astc-12x10-unorm":{gl:37820},"astc-12x10-unorm-srgb":{gl:37852},"astc-12x12-unorm":{gl:37821},"astc-12x12-unorm-srgb":{gl:37853},"pvrtc-rgb4unorm-webgl":{gl:35840},"pvrtc-rgba4unorm-webgl":{gl:35842},"pvrtc-rgb2unorm-webgl":{gl:35841},"pvrtc-rgba2unorm-webgl":{gl:35843},"etc1-rbg-unorm-webgl":{gl:36196},"atc-rgb-unorm-webgl":{gl:35986},"atc-rgba-unorm-webgl":{gl:35986},"atc-rgbai-unorm-webgl":{gl:34798}};function V(e){let t=j[e],i=function(e){let t=j[e],i=t?.gl;if(void 0===i)throw Error(`Unsupported texture format ${e}`);return i}(e),r=A.vz.getInfo(e);return r.compressed&&(t.dataFormat=i),{internalFormat:i,format:t?.dataFormat||function(e,t,i,r){if(6408===r||6407===r)return r;switch(e){case"r":return t&&!i?36244:6403;case"rg":return t&&!i?33320:33319;case"rgb":return t&&!i?36248:6407;case"rgba":return t&&!i?36249:6408;case"bgra":throw Error("bgra pixels not supported by WebGL");default:return 6408}}(r.channels,r.integer,r.normalized,i),type:r.dataType?M(r.dataType):t?.types?.[0]||5121,compressed:r.compressed||!1}}let W={"depth-clip-control":"EXT_depth_clamp","timestamp-query":"EXT_disjoint_timer_query_webgl2","compilation-status-async-webgl":"KHR_parallel_shader_compile","polygon-mode-webgl":"WEBGL_polygon_mode","provoking-vertex-webgl":"WEBGL_provoking_vertex","shader-clip-cull-distance-webgl":"WEBGL_clip_cull_distance","shader-noperspective-interpolation-webgl":"NV_shader_noperspective_interpolation","shader-conservative-depth-webgl":"EXT_conservative_depth"};class $ extends r.I7{gl;extensions;testedFeatures=new Set;constructor(e,t,i){super([],i),this.gl=e,this.extensions=t,P(e,"EXT_color_buffer_float",t)}*[Symbol.iterator](){for(let e of this.getFeatures())this.has(e)&&(yield e);return[]}has(e){return!this.disabledFeatures?.[e]&&(!this.testedFeatures.has(e)&&(this.testedFeatures.add(e),e in U&&z(this.gl,e,this.extensions)&&this.features.add(e),this.getWebGLFeature(e)&&this.features.add(e)),this.features.has(e))}initializeFeatures(){for(let e of this.getFeatures().filter(e=>"polygon-mode-webgl"!==e))this.has(e)}getFeatures(){return[...Object.keys(W),...Object.keys(U)]}getWebGLFeature(e){let t=W[e];return"string"==typeof t?!!P(this.gl,t,this.extensions):!!t}}class H extends r.PI{get maxTextureDimension1D(){return 0}get maxTextureDimension2D(){return this.getParameter(3379)}get maxTextureDimension3D(){return this.getParameter(32883)}get maxTextureArrayLayers(){return this.getParameter(35071)}get maxBindGroups(){return 0}get maxDynamicUniformBuffersPerPipelineLayout(){return 0}get maxDynamicStorageBuffersPerPipelineLayout(){return 0}get maxSampledTexturesPerShaderStage(){return this.getParameter(35660)}get maxSamplersPerShaderStage(){return this.getParameter(35661)}get maxStorageBuffersPerShaderStage(){return 0}get maxStorageTexturesPerShaderStage(){return 0}get maxUniformBuffersPerShaderStage(){return this.getParameter(35375)}get maxUniformBufferBindingSize(){return this.getParameter(35376)}get maxStorageBufferBindingSize(){return 0}get minUniformBufferOffsetAlignment(){return this.getParameter(35380)}get minStorageBufferOffsetAlignment(){return 0}get maxVertexBuffers(){return 16}get maxVertexAttributes(){return this.getParameter(34921)}get maxVertexBufferArrayStride(){return 2048}get maxInterStageShaderVariables(){return this.getParameter(35659)}get maxComputeWorkgroupStorageSize(){return 0}get maxComputeInvocationsPerWorkgroup(){return 0}get maxComputeWorkgroupSizeX(){return 0}get maxComputeWorkgroupSizeY(){return 0}get maxComputeWorkgroupSizeZ(){return 0}get maxComputeWorkgroupsPerDimension(){return 0}gl;limits={};constructor(e){super(),this.gl=e}getParameter(e){return void 0===this.limits[e]&&(this.limits[e]=this.gl.getParameter(e)),this.limits[e]||0}}var q=i(2622);class K{props;_resizeObserver;_intersectionObserver;_observeDevicePixelRatioTimeout=null;_observeDevicePixelRatioMediaQuery=null;_handleDevicePixelRatioChange=()=>this._refreshDevicePixelRatio();_trackPositionInterval=null;_started=!1;get started(){return this._started}constructor(e){this.props=e}
805start(){if(this._started||!this.props.canvas)return;this._started=!0,this._intersectionObserver||=new IntersectionObserver(e=>this.props.onIntersection(e)),this._resizeObserver||=new ResizeObserver(e=>this.props.onResize(e)),this._intersectionObserver.observe(this.props.canvas);let e=this.props.resizeObserverBox;try{this._resizeObserver.observe(this.props.canvas,{box:e})}catch{this._resizeObserver.observe(this.props.canvas,{box:"content-box"})}this._observeDevicePixelRatioTimeout=setTimeout(()=>this._refreshDevicePixelRatio(),0),this.props.trackPosition&&this._trackPosition()}stop(){this._started&&(this._started=!1,this._observeDevicePixelRatioTimeout&&(clearTimeout(this._observeDevicePixelRatioTimeout),this._observeDevicePixelRatioTimeout=null),this._observeDevicePixelRatioMediaQuery&&(this._observeDevicePixelRatioMediaQuery.removeEventListener("change",this._handleDevicePixelRatioChange),this._observeDevicePixelRatioMediaQuery=null),this._trackPositionInterval&&(clearInterval(this._trackPositionInterval),this._trackPositionInterval=null),this._resizeObserver?.disconnect(),this._intersectionObserver?.disconnect())}_refreshDevicePixelRatio(){this._started&&(this.props.onDevicePixelRatioChange(),this._observeDevicePixelRatioMediaQuery?.removeEventListener("change",this._handleDevicePixelRatioChange),this._observeDevicePixelRatioMediaQuery=matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`),this._observeDevicePixelRatioMediaQuery.addEventListener("change",this._handleDevicePixelRatioChange,{once:!0}))}_trackPosition(e=100){this._trackPositionInterval||(this._trackPositionInterval=setInterval(()=>{this._started?this.props.onPositionChange():this._trackPositionInterval&&(clearInterval(this._trackPositionInterval),this._trackPositionInterval=null)},e))}}var X=i(504);function Y(e,t){return!function e(t,i){if(!t){let t=Error(i??"luma.gl assertion failed.");throw Error.captureStackTrace?.(t,e),t}}(e,t),e}class Z{static isHTMLCanvas(e){return"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement}static isOffscreenCanvas(e){return"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas}static defaultProps={id:void 0,canvas:null,width:800,height:600,useDevicePixels:!0,pixelSizeSource:"exact",autoResize:!0,container:null,visible:!0,alphaMode:"opaque",colorSpace:"srgb",trackPosition:!1};id;props;canvas;htmlCanvas;offscreenCanvas;type;initialized;isInitialized=!1;isVisible=!0;cssWidth;cssHeight;devicePixelRatio;devicePixelWidth;devicePixelHeight;drawingBufferWidth;drawingBufferHeight;_initializedResolvers=(function(){let e,t;return{promise:new Promise((i,r)=>{e=i,t=r}),resolve:e,reject:t}})();_canvasObserver;_position=[0,0];destroyed=!1;_needsDrawingBufferResize=!0;toString(){return`${this[Symbol.toStringTag]}(${this.id})`}constructor(e){this.props={...Z.defaultProps,...e},e=this.props,this.initialized=this._initializedResolvers.promise,(0,q.B)()?e.canvas?"string"==typeof e.canvas?this.canvas=function(e){let t=document.getElementById(e);if(!Z.isHTMLCanvas(t))throw Error("Object is not a canvas element");return t}(e.canvas):this.canvas=e.canvas:this.canvas=function(e){let{width:t,height:i}=e,r=document.createElement("canvas");r.id=(0,X.L)("lumagl-auto-created-canvas"),r.width=t||1,r.height=i||1,r.style.width=Number.isFinite(t)?`${t}px`:"100%",r.style.height=Number.isFinite(i)?`${i}px`:"100%",e?.visible||(r.style.visibility="hidden");let s=function(e){if("string"==typeof e){let t=document.getElementById(e);if(!t)throw Error(`${e} is not an HTML element`);return t}return e||document.body}(e?.container||null);return s.insertBefore(r,s.firstChild),r}(e):this.canvas={width:e.width||1,height:e.height||1},Z.isHTMLCanvas(this.canvas)?(this.id=e.id||this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):Z.isOffscreenCanvas(this.canvas)?(this.id=e.id||"offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas):(this.id=e.id||"node-canvas-context",this.type="node"),this.cssWidth=this.htmlCanvas?.clientWidth||this.canvas.width,this.cssHeight=this.htmlCanvas?.clientHeight||this.canvas.height,this.devicePixelWidth=this.canvas.width,this.devicePixelHeight=this.canvas.height,this.drawingBufferWidth=this.canvas.width,this.drawingBufferHeight=this.canvas.height,this.devicePixelRatio=globalThis.devicePixelRatio||1,this._position=[0,0],this._canvasObserver=new K({canvas:this.htmlCanvas,trackPosition:this.props.trackPosition,resizeObserverBox:"css-dpr"===this.props.pixelSizeSource?"content-box":"device-pixel-content-box",onResize:e=>this._handleResize(e),onIntersection:e=>this._handleIntersection(e),onDevicePixelRatioChange:()=>this._observeDevicePixelRatio(),onPositionChange:()=>this.updatePosition()})}destroy(){this.destroyed||(this.destroyed=!0,this._stopObservers(),this.device=null)}setProps(e){return"useDevicePixels"in e&&(this.props.useDevicePixels=e.useDevicePixels||!1,this._updateDrawingBufferSize()),this}getCurrentFramebuffer(e){return this._resizeDrawingBufferIfNeeded(),this._getCurrentFramebuffer(e)}getCSSSize(){return[this.cssWidth,this.cssHeight]}getPosition(){return this._position}getDevicePixelSize(){return[this.devicePixelWidth,this.devicePixelHeight]}getDrawingBufferSize(){return[this.drawingBufferWidth,this.drawingBufferHeight]}getMaxDrawingBufferSize(){let e=this.device.limits.maxTextureDimension2D;return[e,e]}setDrawingBufferSize(e,t){e=Math.floor(e),t=Math.floor(t),(this.drawingBufferWidth!==e||this.drawingBufferHeight!==t)&&(this.drawingBufferWidth=e,this.drawingBufferHeight=t,this._needsDrawingBufferResize=!0)}getDevicePixelRatio(){return"undefined"!=typeof window&&window.devicePixelRatio||1}cssToDevicePixels(e,t=!0){let i=this.cssToDeviceRatio(),[r,s]=this.getDrawingBufferSize();return function(e,t,i,r,s){let n,o=Q(e[0],t,i),a=J(e[1],t,r,s),l=Q(e[0]+1,t,i
805),h=l===i-1?l:l-1;return l=J(e[1]+1,t,r,s),s?(l=0===l?l:l+1,n=a,a=l):n=l===r-1?l:l-1,{x:o,y:a,width:Math.max(h-o+1,1),height:Math.max(n-a+1,1)}}(e,i,r,s,t)}getPixelSize(){return this.getDevicePixelSize()}getAspect(){let[e,t]=this.getDrawingBufferSize();return e>0&&t>0?e/t:1}cssToDeviceRatio(){try{let[e]=this.getDrawingBufferSize(),[t]=this.getCSSSize();return t?e/t:1}catch{return 1}}resize(e){this.setDrawingBufferSize(e.width,e.height)}_setAutoCreatedCanvasId(e){this.htmlCanvas?.id==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=e)}_startObservers(){this.destroyed||this._canvasObserver.start()}_stopObservers(){this._canvasObserver.stop()}_handleIntersection(e){if(this.destroyed)return;let t=e.find(e=>e.target===this.canvas);if(!t)return;let i=t.isIntersecting;this.isVisible!==i&&(this.isVisible=i,this.device.props.onVisibilityChange(this))}_handleResize(e){if(this.destroyed)return;let t=e.find(e=>e.target===this.canvas);if(!t)return;let i=Y(t.contentBoxSize?.[0]);this.cssWidth=i.inlineSize,this.cssHeight=i.blockSize;let r=this.getDevicePixelSize();this._setDevicePixelSize(this._getDevicePixelSizeFromResizeEntry(t)),this._updateDrawingBufferSize(),this.device.props.onResize(this,{oldPixelSize:r})}_updateDrawingBufferSize(){if(this.props.autoResize)if("number"==typeof this.props.useDevicePixels){let e=this.props.useDevicePixels;this.setDrawingBufferSize(this.cssWidth*e,this.cssHeight*e)}else this.props.useDevicePixels?this.setDrawingBufferSize(this.devicePixelWidth,this.devicePixelHeight):this.setDrawingBufferSize(this.cssWidth,this.cssHeight);this._initializedResolvers.resolve(),this.isInitialized=!0,this.updatePosition()}_getDevicePixelSizeFromResizeEntry(e){let t=Y(e.contentBoxSize?.[0]);return"css-dpr"===this.props.pixelSizeSource?this._getDevicePixelSizeFromCSSSize(t.inlineSize,t.blockSize):{devicePixelWidth:e.devicePixelContentBoxSize?.[0]?.inlineSize||t.inlineSize*devicePixelRatio,devicePixelHeight:e.devicePixelContentBoxSize?.[0]?.blockSize||t.blockSize*devicePixelRatio}}_getDevicePixelSizeFromCSSSize(e,t){let i=this.getDevicePixelRatio();return{devicePixelWidth:Math.floor(e*i),devicePixelHeight:Math.floor(t*i)}}_setDevicePixelSize({devicePixelWidth:e,devicePixelHeight:t}){let[i,r]=this.getMaxDrawingBufferSize();this.devicePixelWidth=Math.max(1,Math.min(e,i)),this.devicePixelHeight=Math.max(1,Math.min(t,r))}_resizeDrawingBufferIfNeeded(){this._needsDrawingBufferResize&&(this._needsDrawingBufferResize=!1,(this.drawingBufferWidth!==this.canvas.width||this.drawingBufferHeight!==this.canvas.height)&&(this.canvas.width=this.drawingBufferWidth,this.canvas.height=this.drawingBufferHeight,this._configureDevice()))}_observeDevicePixelRatio(){if(this.destroyed||!this._canvasObserver.started)return;let e=this.devicePixelRatio;if(this.devicePixelRatio=window.devicePixelRatio,"css-dpr"===this.props.pixelSizeSource){let e=this.getDevicePixelSize();this._setDevicePixelSize(this._getDevicePixelSizeFromCSSSize(this.cssWidth,this.cssHeight)),this._updateDrawingBufferSize(),this.device.props.onResize(this,{oldPixelSize:e})}this.updatePosition(),this.device.props.onDevicePixelRatioChange?.(this,{oldRatio:e})}updatePosition(){if(this.destroyed)return;let e=this.htmlCanvas?.getBoundingClientRect();if(e){let t=[e.left,e.top];if(this._position??=t,t[0]!==this._position[0]||t[1]!==this._position[1]){let e=this._position;this._position=t,this.device.props.onPositionChange?.(this,{oldPosition:e})}}}}function Q(e,t,i){return Math.min(Math.round(e*t),i-1)}function J(e,t,i,r){return r?Math.max(0,i-1-Math.round(e*t)):Math.min(Math.round(e*t),i-1)}class ee extends Z{static defaultProps=Z.defaultProps}var et=i(60154),ei=i(75457);class er extends et.F{get[Symbol.toStringTag](){return"Framebuffer"}width;height;constructor(e,t={}){super(e,t,er.defaultProps),this.width=this.props.width,this.height=this.props.height}clone(e){let t=this.colorAttachments.map(t=>t.texture.clone(e)),i=this.depthStencilAttachment&&this.depthStencilAttachment.texture.clone(e);return this.device.createFramebuffer({...this.props,...e,colorAttachments:t,depthStencilAttachment:i})}resize(e){let t=!e;if(e){let[i,r]=Array.isArray(e)?e:[e.width,e.height];t=t||r!==this.height||i!==this.width,this.width=i,this.height=r}t&&(s.R.log(2,`Resizing framebuffer ${this.id} to ${this.width}x${this.height}`)(),this.resizeAttachments(this.width,this.height))}autoCreateAttachmentTextures(){if(0===this.props.colorAttachments.length&&!this.props.depthStencilAttachment)throw Error("Framebuffer has noattachments");this.colorAttachments=this.props.colorAttachments.map((e,t)=>{if("string"==typeof e){let i=this.createColorTexture(e,t);return this.attachResource(i),i.view}return e instanceof ei.g?e.view:e});let e=this.props.depthStencilAttachment;if(e)if("string"==typeof e){let t=this.createDepthStencilTexture(e);this.attachResource(t),this.depthStencilAttachment=t.view}else e instanceof ei.g?this.depthStencilAttachment=e.view:this.depthStencilAttachment=e}createColorTexture(e,t){return this.device.createTexture({id:`${this.id}-color-attachment-${t}`,usage:ei.g.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height,sampler:{magFilter:"linear",minFilter:"linear"}})}createDepthStencilTexture(e){return this.device.createTexture({id:`${this.id}-depth-stencil-attachment`,usage:ei.g.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height})}
805resizeAttachments(e,t){if(this.colorAttachments.forEach((i,r)=>{let s=i.texture.clone({width:e,height:t});this.destroyAttachedResource(i),this.colorAttachments[r]=s.view,this.attachResource(s.view)}),this.depthStencilAttachment){let i=this.depthStencilAttachment.texture.clone({width:e,height:t});this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=i.view,this.attachResource(i)}this.updateAttachments()}static defaultProps={...et.F.defaultProps,width:1,height:1,colorAttachments:[],depthStencilAttachment:null}}class es extends er{device;gl;handle;colorAttachments=[];depthStencilAttachment=null;constructor(e,t){super(e,t);let i=null===t.handle;this.device=e,this.gl=e.gl,this.handle=this.props.handle||i?this.props.handle:this.gl.createFramebuffer(),!i&&(e._setWebGLDebugMetadata(this.handle,this,{spector:this.props}),t.handle||(this.autoCreateAttachmentTextures(),this.updateAttachments()))}destroy(){super.destroy(),this.destroyed||null===this.handle||this.props.handle||this.gl.deleteFramebuffer(this.handle)}updateAttachments(){let e=this.gl.bindFramebuffer(36160,this.handle);for(let e=0;e<this.colorAttachments.length;++e){let t=this.colorAttachments[e];if(t){let i=36064+e;this._attachTextureView(i,t)}}if(this.depthStencilAttachment){let e=function(e){switch(A.vz.getInfo(e).attachment){case"depth":return 36096;case"stencil":return 36128;case"depth-stencil":return 33306;default:throw Error(`Not a depth stencil format: ${e}`)}}(this.depthStencilAttachment.props.format);this._attachTextureView(e,this.depthStencilAttachment)}if(this.device.props.debug){let e=this.gl.checkFramebufferStatus(36160);if(36053!==e)throw Error(`Framebuffer ${function(e){switch(e){case 36053:return"success";case 36054:return"Mismatched attachments";case 36055:return"No attachments";case 36057:return"Height/width mismatch";case 36061:return"Unsupported or split attachments";case 36182:return"Samples mismatch";default:return`${e}`}}(e)}`)}this.gl.bindFramebuffer(36160,e)}_attachTextureView(e,t){let{gl:i}=this.device,{texture:r}=t,s=t.props.baseMipLevel,n=t.props.baseArrayLayer;switch(i.bindTexture(r.glTarget,r.handle),r.glTarget){case 35866:case 32879:i.framebufferTextureLayer(36160,e,r.handle,s,n);break;case 34067:var o;let a=(o=n)<34069?o+34069:o;i.framebufferTexture2D(36160,e,a,r.handle,s);break;case 3553:i.framebufferTexture2D(36160,e,3553,r.handle,s);break;default:throw Error("Illegal texture type")}i.bindTexture(r.glTarget,null)}resizeAttachments(e,t){if(null===this.handle){this.width=e,this.height=t;return}super.resizeAttachments(e,t)}}class en extends ee{device;handle=null;_framebuffer=null;get[Symbol.toStringTag](){return"WebGLCanvasContext"}constructor(e,t){super(t),this.device=e,this._setAutoCreatedCanvasId(`${this.device.id}-canvas`),this._configureDevice()}_configureDevice(){(this.drawingBufferWidth!==this._framebuffer?.width||this.drawingBufferHeight!==this._framebuffer?.height)&&this._framebuffer?.resize([this.drawingBufferWidth,this.drawingBufferHeight])}_getCurrentFramebuffer(){return this._framebuffer||=new es(this.device,{id:"canvas-context-framebuffer",handle:null,width:this.drawingBufferWidth,height:this.drawingBufferHeight}),this._framebuffer}}class eo extends Z{}class ea extends eo{device;handle=null;context2d;get[Symbol.toStringTag](){return"WebGLPresentationContext"}constructor(e,t={}){super(t),this.device=e;let i=`${this[Symbol.toStringTag]}(${this.id})`;if(!this.device.getDefaultCanvasContext().offscreenCanvas)throw Error(`${i}: WebGL PresentationContext requires the default CanvasContext canvas to be an OffscreenCanvas`);let r=this.canvas.getContext("2d");if(!r)throw Error(`${i}: Failed to create 2d presentation context`);this.context2d=r,this._setAutoCreatedCanvasId(`${this.device.id}-presentation-canvas`),this._configureDevice(),this._startObservers()}present(){this._resizeDrawingBufferIfNeeded(),this.device.submit();let e=this.device.getDefaultCanvasContext(),[t,i]=e.getDrawingBufferSize();if(0!==this.drawingBufferWidth&&0!==this.drawingBufferHeight&&0!==t&&0!==i&&0!==e.canvas.width&&0!==e.canvas.height){if(t!==this.drawingBufferWidth||i!==this.drawingBufferHeight||e.canvas.width!==this.drawingBufferWidth||e.canvas.height!==this.drawingBufferHeight)throw Error(`${this[Symbol.toStringTag]}(${this.id}): Default canvas context size ${t}x${i} does not match presentation size ${this.drawingBufferWidth}x${this.drawingBufferHeight}`);this.context2d.clearRect(0,0,this.drawingBufferWidth,this.drawingBufferHeight),this.context2d.drawImage(e.canvas,0,0)}}_configureDevice(){}_getCurrentFramebuffer(e){let t=this.device.getDefaultCanvasContext();return t.setDrawingBufferSize(this.drawingBufferWidth,this.drawingBufferHeight),t.getCurrentFramebuffer(e)}}var el=i(44168),eh=i(77142);let eu={};var ec=i(69804);class ed extends ec.h{device;gl;handle;glTarget;glUsage;glIndexType=5123;byteLength=0;bytesUsed=0;constructor(e,t={}){super(e,t),this.device=e,this.gl=this.device.gl;let i="object"==typeof t?t.handle:void 0;this.handle=i||this.gl.createBuffer(),e._setWebGLDebugMetadata(this.handle,this,{spector:{...this.props,data:typeof this.props.data}}),this.glTarget=function(e){return e&ec.h.INDEX?34963:e&ec.h.VERTEX?34962:e&ec.h.UNIFORM?35345:34962}(this.props.usage),this.glUsage=function(e){return e&ec.h.INDEX||e&ec.h.VERTEX?35044:e&ec.h.UNIFORM?35048:35044}(this.props.usage),this.glIndexType="uint32"===this.props.indexType?5125:5123,t.data?this._initWithData(t.data,t.byteOffset,t.byteLength):this._initWithByteLength(t.byteLength||0)}destroy(){!this.destroyed&&this.handle&&(this.removeStats(),this.props.handle?this.trackDeallocatedReferencedMemory("Buffer"):(this.trackDeallocatedMemory(),this.gl.deleteBuffer(this.handle)),this.destroyed=!0,this.handle=null)}_initWithData(e,t=0,i=e.byteLength+t){let r=this.glTarget;this.gl.bindBuffer(r,this.handle),this.gl.bufferData(r,i,this.glUsage),this.gl.bufferSubData(r,t,e),this.gl.bindBuffer(r,null),this.bytesUsed=i,this.byteLength=i,this._setDebugData(e,t,i),this.props.handle?this.trackReferencedMemory(i,"Buffer"):this.trackAllocatedMemory(i)}_initWithByteLength(e){let t=e;0===e&&(t=new Float32Array(0));let i=this.glTarget;return this.gl.bindBuffer(i,this.handle),this.gl.bufferData(i,t,this.glUsage),this.gl.bindBuffer(i,null),this.bytesUsed=e,this.byteLength=e,this._setDebugData(null,0,e),this.props.handle?this.trackReferencedMemory(e,"Buffer"):this.trackAllocatedMemory(e),this}write(e,t=0){let i=ArrayBuffer.isView(e)?e:new Uint8Array(e),r=void 0;this.gl.bindBuffer(36663,this.handle),void 0!==r?this.gl.bufferSubData(36663,t,i,0,r):this.gl.bufferSubData(36663,t,i),this.gl.bindBuffer(36663,null),this._setDebugData(e,t,e.byteLength)}async mapAndWriteAsync(e,t=0,i=this.byteLength-t){let r=new ArrayBuffer(i);await e(r,"copied"),this.write(r,t)}
805async readAsync(e=0,t){return this.readSyncWebGL(e,t)}async mapAndReadAsync(e,t=0,i){let r=await this.readAsync(t,i);return await e(r.buffer,"copied")}readSyncWebGL(e=0,t){let i=new Uint8Array(t=t??this.byteLength-e);return this.gl.bindBuffer(36662,this.handle),this.gl.getBufferSubData(36662,e,i,0,t),this.gl.bindBuffer(36662,null),this._setDebugData(i,e,t),i}}var ef=i(99416);function ep(e){let t=e.toLowerCase();return["warning","error","info"].includes(t)?t:"info"}class eg extends ef.M{device;handle;constructor(e,t){switch(super(e,t),this.device=e,this.props.stage){case"vertex":this.handle=this.props.handle||this.device.gl.createShader(35633);break;case"fragment":this.handle=this.props.handle||this.device.gl.createShader(35632);break;default:throw Error(this.props.stage)}e._setWebGLDebugMetadata(this.handle,this,{spector:this.props});let i=this._compile(this.source);i&&"function"==typeof i.catch&&i.catch(()=>{this.compilationStatus="error"})}destroy(){this.handle&&(this.removeStats(),this.device.gl.deleteShader(this.handle),this.destroyed=!0,this.handle.de
805stroyed=!0)}get asyncCompilationStatus(){return this._waitForCompilationComplete().then(()=>(this._getCompilationStatus(),this.compilationStatus))}async getCompilationInfo(){return await this._waitForCompilationComplete(),this.getCompilationInfoSync()}getCompilationInfoSync(){let e=this.device.gl.getShaderInfoLog(this.handle);return e?function(e){let t=e.split(/\r?\n/),i=[];for(let e of t){if(e.length<=1)continue;let t=e.trim(),r=e.split(":"),s=r[0]?.trim();if(2===r.length){let[e,n]=r;if(!e||!n){i.push({message:t,type:ep(s||"info"),lineNum:0,linePos:0});continue}i.push({message:n.trim(),type:ep(e),lineNum:0,linePos:0});continue}let[n,o,a,...l]=r;if(!n||!o||!a){i.push({message:r.slice(1).join(":").trim()||t,type:ep(s||"info"),lineNum:0,linePos:0});continue}let h=parseInt(a,10);Number.isNaN(h)&&(h=0);let u=parseInt(o,10);Number.isNaN(u)&&(u=0),i.push({message:l.join(":").trim(),type:ep(n),lineNum:h,linePos:u})}return i}(e):[]}getTranslatedSource(){let e=this.device.getExtension("WEBGL_debug_shaders").WEBGL_debug_shaders;return e?.getTranslatedShaderSource(this.handle)||null}_compile(e){e=e.startsWith("#version ")?e:`#version 300 es 806${e}`;let{gl:t}=this.device;if(t.shaderSource(this.handle,e),t.compileShader(this.handle),!this.device.props.debug){this.compilationStatus="pending";return}if(!this.device.features.has("compilation-status-async-webgl")){if(this._getCompilationStatus(),this.debugShader(),"error"===this.compilationStatus)throw Error(`GLSL compilation errors in ${this.props.stage} shader ${this.props.id}`);return}return s.R.once(1,"Shader compilation is asynchronous")(),this._waitForCompilationComplete().then(()=>{s.R.info(2,`Shader ${this.id} - async compilation complete: ${this.compilationStatus}`)(),this._getCompilationStatus(),this.debugShader()})}async _waitForCompilationComplete(){let e=async e=>await new Promise(t=>setTimeout(t,e));if(!this.device.features.has("compilation-status-async-webgl"))return void await e(10);let{gl:t}=this.device;for(;;){if(t.getShaderParameter(this.handle,37297))return;await e(10)}}_getCompilationStatus(){this.compilationStatus=this.device.gl.getShaderParameter(this.handle,35713)?"success":"error"}}var em=i(20430);function e_(e,t){return eE(e,t,{never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519})}function ey(e,t){return eE(e,t,{keep:7680,zero:0,replace:7681,invert:5386,"increment-clamp":7682,"decrement-clamp":7683,"increment-wrap":34055,"decrement-wrap":34056})}function ev(e,t){return eE(e,t,{add:32774,subtract:32778,"reverse-subtract":32779,min:32775,max:32776})}function eb(e,t,i="color"){return eE(e,t,{one:1,zero:0,src:768,"one-minus-src":769,dst:774,"one-minus-dst":775,"src-alpha":770,"one-minus-src-alpha":771,"dst-alpha":772,"one-minus-dst-alpha":773,"src-alpha-saturated":776,constant:"color"===i?32769:32771,"one-minus-constant":"color"===i?32770:32772,src1:768,"one-minus-src1":769,"src1-alpha":770,"one-minus-src1-alpha":771})}function eE(e,t,i){if(!(t in i))throw Error(`Illegal parameter ${t} for ${e}`);return i[t]}function ex(e){let t={};return e.addressModeU&&(t[10242]=ew(e.addressModeU)),e.addressModeV&&(t[10243]=ew(e.addressModeV)),e.addressModeW&&(t[32882]=ew(e.addressModeW)),e.magFilter&&(t[10240]=eS(e.magFilter)),(e.minFilter||e.mipmapFilter)&&(t[10241]=function(e,t="none"){if(!t)return eS(e);switch(t){case"none":return eS(e);case"nearest":switch(e){case"nearest":return 9984;case"linear":return 9985}break;case"linear":switch(e){case"nearest":return 9986;case"linear":return 9987}}}(e.minFilter||"linear",e.mipmapFilter)),void 0!==e.lodMinClamp&&(t[33082]=e.lodMinClamp),void 0!==e.lodMaxClamp&&(t[33083]=e.lodMaxClamp),"comparison-sampler"===e.type&&(t[34892]=34894),e.compare&&(t[34893]=e_("compare",e.compare)),e.maxAnisotropy&&(t[34046]=e.maxAnisotropy),t}function ew(e){switch(e){case"clamp-to-edge":return 33071;case"repeat":return 10497;case"mirror-repeat":return 33648}}function eS(e){switch(e){case"nearest":return 9728;case"linear":return 9729}}class eP extends em.L{device;handle;parameters;constructor(e,t){super(e,t),this.device=e,this.parameters=ex(t),this.handle=t.handle||this.device.gl.createSampler(),this._setSamplerParameters(this.parameters)}destroy(){this.handle&&(this.device.gl.deleteSampler(this.handle),this.handle=void 0)}toString(){return`Sampler(${this.id},${JSON.stringify(this.props)})`}_setSamplerParameters(e){for(let[t,i]of Object.entries(e)){let e=Number(t);switch(e){case 33082:case 33083:this.device.gl.samplerParameterf(this.handle,e,i);break;default:this.device.gl.samplerParameteri(this.handle,e,i)}}}}var eT=i(47941);function eA(e,t,i){let r;if(function(e){for(let t in e)return!1;return!0}(t))return i(e);let{nocatch:s=!0}=t,n=x.get(e);if(n.push(),v(e,t),s)r=i(e),n.pop();else try{r=i(e)}finally{n.pop()}return r}var eM=i(85745);class eC extends eM.X{device;gl;handle;texture;constructor(e,t){super(e,{...ei.g.defaultProps,...t}),this.device=e,this.gl=this.device.gl,this.handle=null,this.texture=t.texture}}let eR={5124:"sint32",5125:"uint32",5122:"sint16",5123:"uint16",5120:"sint8",5121:"uint8",5126:"float32",5131:"float16",33635:"uint16",32819:"uint16",32820:"uint16",33640:"uint32",35899:"uint32",35902:"uint32",34042:"uint32",36269:"uint32"};class eL extends ei.g{device;gl;handle;sampler=void 0;view;glTarget;glFormat;glType;glInternalFormat;compressed;_textureUnit=0;_framebuffer=null;_framebufferAttachmentKey=null;constructor(e,t){super(e,t,{byteAlignment:1}),this.device=e,this.gl=this.device.gl;let i=V(this.props.format);this.glTarget=function(e){switch(e){case"1d":break;case"2d":return 3553;case"3d":return 32879;case"cube":return 34067;case"2d-array":return 35866}throw Error(e)}(this.props.dimension),this.glInternalFormat=i.internalFormat,this.glFormat=i.format,this.glType=i.type,this.compressed=i.compressed,this.handle=this.props.handle||this.gl.createTexture(),this.device._setWebGLDebugMetadata(this.handle,this,{spector:this.props}),this.gl.bindTexture(this.glTarget,this.handle);let{dimension:r,width:s,height:n,depth:o,mipLevels:a,glTarget:l,glInternalFormat:h}=this;if(!this.compressed)switch(r){case"2d":case"cube":this.gl.texStorage2D(l,a,h,s,n);break;case"2d-array":case"3d":this.gl.texStorage3D(l,a,h,s,n,o);break;default:throw Error(r)}this.gl.bindTexture(this.glTarget,null),this._initializeData(t.data),this.props.handle?this.trackReferencedMemory(this.getAllocatedByteLength(),"Texture"):this.trackAllocatedMemory(this.getAllocatedByteLength(),"Texture"),this.setSampler(this.props.sampler),this.view=new eC(this.device,{...this.props,texture:this}),Object.seal(this)}destroy(){this.handle&&(this._framebuffer?.destroy(),this._framebuffer=null,this._framebufferAttachmentKey=null,this.removeStats(),this.props.handle?this.trackDeallocatedReferencedMemory("Texture"):(this.gl.deleteTexture(this.handle),this.trackDeallocatedMemory("Texture")),this.destroyed=!0)}createView(e){return new eC(this.device,{...e,texture:this})}setSampler(e={}){super.setSampler(e);let t=ex(this.sampler.props);this._setSamplerParameters(t)}copyExternalImage(e){let t=this._normalizeCopyExternalImageOptions(e);if(t.sourceX||t.sourceY)throw Error("WebGL does not support sourceX/sourceY)");let{glFormat:i,glType:r}=this,{image:s,depth:n,mipLevel:o,x:a,y:l,z:h,width:u,height:c}=t,d=eI(this.glTarget,this.dimension,h),f=t.flipY?{37440:!0}:{};return this.gl.bindTexture(this.glTarget,this.handle),eA(this.gl,f,()=>{switch(this.dimension){case"2d":case"cube":this.gl.texSubImage2D(d,o,a,l,u,c,i,r,s);break;case"2d-array":case"3d":this.gl.texSubImage3D(d,o,a,l,h,u,c,n,i,r,s)}}),this.gl.bindTexture(this.glTarget,null),{width:t.width,height:t.height}}copyImageData(e){super.copyImageData(e)}readBuffer(e={},t){if(!t)throw Error(`${this} readBuffer requires a destination buffer`);let i=this._getSupportedColorReadOptions(e),r=e.byteOffset??0,s=this.computeMemoryLayout(i);if(t.byteLength<r+s.byteLength)throw Error(`${this} readBuffer target is too small (${t.byteLength} < ${r+s.byteLength})`);this.gl.bindBuffer(35051,t.handle);try{this._readColorTextureLayers(i,s,e=>{this.gl.readPixels(i.x,i.y,i.width,i.height,this.glFormat,this.glType,r+e)})}finally{this.gl.bindBuffer(35051,null)}return t}async readDataAsync(e={}){throw Error(`${this} readDataAsync is deprecated; use readBuffer() with an explicit destination buffer or DynamicTexture.readAsync()`)}writeBuffer(e,t={}){let i=this._normalizeTextureWriteOptions(t),{width:r,height:s,depthOrArrayLayers:n,mipLevel:o,byteOffset:a,x:l,y:h,z:u}=i,{glFormat:c,glType:d,compressed:f}=this,p=eI(this.glTarget,this.dimension,u);if(f)throw Error("writeBuffer for compressed textures is not implemented in WebGL");let{bytesPerPixel:g}=this.device.getTextureFormatInfo(this.format),m=g?i.bytesPerRow/g:void 0,_={3317:this.byteAlignment,...void 0!==m?{3314:m}:{},32878:i.rowsPerImage};this.gl.bindTexture(this.glTarget,this.handle),this.gl.bindBuffer(35052,e.handle),eA(this.gl,_,()=>{switch(this.dimension){case"2d":case"cube":this.gl.texSubImage2D(p,o,l,h,r,s,c,d,a);break;case"2d-array":case"3d":this.gl.texSubImage3D(p,o,l,h,u,r,s,n,c,d,a)}}),this.gl.bindBuffer(35052,null),this.gl.bindTexture(this.glTarget,null)}writeData(e,t={}){let i,r=this._normalizeTextureWriteOptions(t),s=ArrayBuffer.isView(e)?e:new Uint8Array(e),{width:n,height:o,depthOrArrayLayers:a,mipLevel:l,x:h,y:u,z:c,byteOffset:d}=r,{glFormat:f,glType:p,compressed:g}=this,m=eI(this.glTarget,this.dimension,c);if(!g){let{bytesPerPixel:e}=this.device.getTextureFormatInfo(this.format);e&&(i=r.bytesPerRow/e)}let _=this.compressed?{}:{3317:this.byteAlignment,...void 0!==i?{3314:i}:{},32878:r.rowsPerImage},y=function(e,t){if(t%e.BYTES_PER_ELEMENT!=0)throw Error(`Texture byteOffset ${t} must align to typed array element size ${e.BYTES_PER_ELEMENT}`);return t/e.BYTES_PER_ELEMENT}(s,d),v=g?function(e,t=0){return t?new e.constructor(e.buffer,e.byteOffset+t,(e.byteLength-t)/e.BYTES_PER_ELEMENT):e}(s,d):s,b=this._getMipLevelSize(l),E=0===h&&0===u&&0===c&&n===b.width&&o===b.height&&a===b.depthOrArrayLayers;this.gl.bindTexture(this.glTarget,this.handle),this.gl.bindBuffer(35052,null),eA(this.gl,_,()=>{switch(this.dimension){case"2d":case"cube":g?E?this.gl.compressedTexImage2D(m,l,f,n,o,0,v):this.gl.compressedTexSubImage2D(m,l,h,u,n,o,f,v):this.gl.texSubImage2D(m,l,h,u,n,o,f,p,s,y);break;case"2d-array":case"3d":g?E?this.gl.compressedTexImage3D(m,l,f,n,o,a,0,v):this.gl.compressedTexSubImage3D(m,l,h,u,c,n,o,a,f,v):this.gl.texSubImage3D(m,l,h,u,c,n,o,a,f,p,s,y)}}),this.gl.bindTexture(this.glTarget,null)}_getRowByteAlignment(e,t){return 1}_getFramebuffer(){return this._framebuffer||=this.device.createFramebuffer({
806id:`framebuffer-for-${this.id}`,width:this.width,height:this.height,colorAttachments:[this]}),this._framebuffer}readDataSyncWebGL(e={}){let t=this._getSupportedColorReadOptions(e),i=this.computeMemoryLayout(t),r=eR[this.glType],s=(0,eT.Ak)(r),n=new s(i.byteLength/s.BYTES_PER_ELEMENT);return this._readColorTextureLayers(t,i,e=>{let r=new s(n.buffer,n.byteOffset+e,i.bytesPerImage/s.BYTES_PER_ELEMENT);this.gl.readPixels(t.x,t.y,t.width,t.height,this.glFormat,this.glType,r)}),n.buffer}_readColorTextureLayers(e,t,i){let r=this._getFramebuffer(),s=t.bytesPerRow/t.bytesPerPixel,n={3333:this.byteAlignment,...s!==e.width?{3330:s}:{}},o=this.gl.getParameter(3074),a=this.gl.bindFramebuffer(36160,r.handle);try{this.gl.readBuffer(36064),eA(this.gl,n,()=>{for(let s=0;s<e.depthOrArrayLayers;s++)this._attachReadSubresource(r,e.mipLevel,e.z+s),i(s*t.bytesPerImage)})}finally{this.gl.bindFramebuffer(36160,a||null),this.gl.readBuffer(o)}}_attachReadSubresource(e,t,i){let r=`${t}:${i}`;if(this._framebufferAttachmentKey!==r){switch(this.dimension){case"2d":this.gl.framebufferTexture2D(36160,36064,3553,this.handle,t);break;case"cube":this.gl.framebufferTexture2D(36160,36064,eI(this.glTarget,this.dimension,i),this.handle,t);break;case"2d-array":case"3d":this.gl.framebufferTextureLayer(36160,36064,this.handle,t,i);break;default:throw Error(`${this} color readback does not support ${this.dimension} textures`)}if(this.device.props.debug){let t=Number(this.gl.checkFramebufferStatus(36160));if(t!==Number(36053))throw Error(`${e} incomplete for ${this} readback (${t})`)}this._framebufferAttachmentKey=r}}generateMipmapsWebGL(e){if(this.device.isTextureFormatRenderable(this.props.format)&&this.device.isTextureFormatFilterable(this.props.format)||(s.R.warn(`${this} is not renderable or filterable, may not be able to generate mipmaps`)(),e?.force))try{this.gl.bindTexture(this.glTarget,this.handle),this.gl.generateMipmap(this.glTarget)}catch(e){s.R.warn(`Error generating mipmap for ${this}: ${e.message}`)()}finally{this.gl.bindTexture(this.glTarget,null)}}_setSamplerParameters(e){for(let[t,i]of(s.R.log(2,`${this.id} sampler parameters`,this.device.getGLKeys(e))(),this.gl.bindTexture(this.glTarget,this.handle),Object.entries(e))){let e=Number(t);switch(e){case 33082:case 33083:this.gl.texParameterf(this.glTarget,e,i);break;case 10240:case 10241:case 10242:case 10243:case 32882:case 34892:case 34893:this.gl.texParameteri(this.glTarget,e,i);break;case 34046:this.device.features.has("texture-filterable-anisotropic-webgl")&&this.gl.texParameteri(this.glTarget,e,i)}}this.gl.bindTexture(this.glTarget,null)}_getActiveUnit(){return this.gl.getParameter(34016)-33984}_bind(e){let{gl:t}=this;return void 0!==e&&(this._textureUnit=e,t.activeTexture(33984+e)),t.bindTexture(this.glTarget,this.handle),e}_unbind(e){let{gl:t}=this;return void 0!==e&&(this._textureUnit=e,t.activeTexture(33984+e)),t.bindTexture(this.glTarget,null),e}}function eI(e,t,i){return"cube"===t?34069+i:e}var eO=i(34315),eN=i(84062);class eF extends eO.r{device;handle;vs;fs;introspectedLayout;bindings={};uniforms={};varyings=null;_uniformCount=0;_uniformSetters={};get[Symbol.toStringTag](){return"WEBGLRenderPipeline"}constructor(e,t){super(e,t),this.device=e;let i=this.sharedRenderPipeline||this.device._createSharedRenderPipelineWebGL(t);this.sharedRenderPipeline=i,this.handle=i.handle,this.vs=i.vs,this.fs=i.fs,this.linkStatus=i.linkStatus,this.introspectedLayout=i.introspectedLayout,this.device._setWebGLDebugMetadata(this.handle,this,{spector:{id:this.props.id}}),this.shaderLayout=t.shaderLayout?function(e,t){let i={...e,attributes:e.attributes.map(e=>({...e})),bindings:e.bindings.map(e=>({...e}))};for(let e of t?.attributes||[]){let t=i.attributes.find(t=>t.name===e.name);t?(t.type=e.type||t.type,t.stepMode=e.stepMode||t.stepMode):s.R.warn(`shader layout attribute ${e.name} not present in shader`)}for(let e of t?.bindings||[]){let t=eD(i,e.name);if(!t){s.R.warn(`shader layout binding ${e.name} not present in shader`);continue}Object.assign(t,e)}return i}(this.introspectedLayout,t.shaderLayout):this.introspectedLayout}destroy(){this.destroyed||(this.sharedRenderPipeline&&!this.props._sharedRenderPipeline&&this.sharedRenderPipeline.destroy(),this.destroyResource())}setBindings(e,t){for(let[i,r]of Object.entries((0,eN.h0)((0,eN.gO)(this.shaderLayout,e)))){let e=eD(this.shaderLayout,i);if(e){switch(!r&&s.R.warn(`Unsetting binding "${i}" in render pipeline "${this.id}"`)(),e.type){case"uniform":if(!(r instanceof ed)&&!(r.buffer instanceof ed))throw Error("buffer value");break;case"texture":if(!(r instanceof eC||r instanceof eL||r instanceof es))throw Error(`${this} Bad texture binding for ${i}`);break;case"sampler":s.R.warn(`Ignoring sampler ${i}`)();break;default:throw Error(e.type)}this.bindings[i]=r}else{let e=this.shaderLayout.bindings.map(e=>`"${e.name}"`).join(", ");t?.disableWarnings||s.R.warn(`No binding "${i}" in render pipeline "${this.id}", expected one of ${e}`,r)()}}}draw(e){this._syncLinkStatus();let t=e.bindGroups?(0,eN.h0)(e.bindGroups):e.bindings||this.bindings,{renderPass:i,parameters:r=this.props.parameters,topology:n=this.props.topology,vertexArray:o,vertexCount:a,instanceCount:l,isInstanced:h=!1,first
806Vertex:u=0,transformFeedback:c,uniforms:d=this.uniforms}=e,f=function(e){switch(e){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 3;case"triangle-list":return 4;case"triangle-strip":return 5;default:throw Error(e)}}(n),p=!!o.indexBuffer,g=o.indexBuffer?.glIndexType;return"success"!==this.linkStatus?(s.R.info(2,`RenderPipeline:${this.id}.draw() aborted - waiting for shader linking`)(),!1):this._areTexturesRenderable(t)?(this.device.gl.useProgram(this.handle),o.bindBeforeRender(i),c&&c.begin(this.props.topology),this._applyBindings(t,{disableWarnings:this.props.disableWarnings}),this._applyUniforms(d),!function(e,t,i,r){if(function(e){let t=!0;for(let i in e){t=!1;break}return t}(t))return r(e);e.pushState();try{return function(e,t){let{gl:i}=e;if(t.cullMode)switch(t.cullMode){case"none":i.disable(2884);break;case"front":i.enable(2884),i.cullFace(1028);break;case"back":i.enable(2884),i.cullFace(1029)}if(t.frontFace&&i.frontFace(eE("frontFace",t.frontFace,{ccw:2305,cw:2304})),t.unclippedDepth&&e.features.has("depth-clip-control")&&i.enable(34383),void 0!==t.depthBias&&(i.enable(32823),i.polygonOffset(t.depthBias,t.depthBiasSlopeScale||0)),t.provokingVertex&&e.features.has("provoking-vertex-webgl")){let i=e.getExtension("WEBGL_provoking_vertex").WEBGL_provoking_vertex,r=eE("provokingVertex",t.provokingVertex,{first:36429,last:36430});i?.provokingVertexWEBGL(r)}if((t.polygonMode||t.polygonOffsetLine)&&e.features.has("polygon-mode-webgl")){if(t.polygonMode){let i=e.getExtension("WEBGL_polygon_mode").WEBGL_polygon_mode,r=eE("polygonMode",t.polygonMode,{fill:6914,line:6913});i?.polygonModeWEBGL(1028,r),i?.polygonModeWEBGL(1029,r)}t.polygonOffsetLine&&i.enable(10754)}if(e.features.has("shader-clip-cull-distance-webgl")&&(t.clipDistance0&&i.enable(12288),t.clipDistance1&&i.enable(12289),t.clipDistance2&&i.enable(12290),t.clipDistance3&&i.enable(12291),t.clipDistance4&&i.enable(12292),t.clipDistance5&&i.enable(12293),t.clipDistance6&&i.enable(12294),t.clipDistance7&&i.enable(12295)),void 0!==t.depthWriteEnabled&&i.depthMask(t.depthWriteEnabled),t.depthCompare&&("always"!==t.depthCompare?i.enable(2929):i.disable(2929),i.depthFunc(e_("depthCompare",t.depthCompare))),void 0!==t.clearDepth&&i.clearDepth(t.clearDepth),t.stencilWriteMask){let e=t.stencilWriteMask;i.stencilMaskSeparate(1028,e),i.stencilMaskSeparate(1029,e)}if(t.stencilReadMask&&s.R.warn("stencilReadMask not supported under WebGL"),t.stencilCompare){let e=t.stencilReadMask||0xffffffff,r=e_("depthCompare",t.stencilCompare);"always"!==t.stencilCompare?i.enable(2960):i.disable(2960),i.stencilFuncSeparate(1028,r,0,e),i.stencilFuncSeparate(1029,r,0,e)}if(t.stencilPassOperation&&t.stencilFailOperation&&t.stencilDepthFailOperation){let e=ey("stencilPassOperation",t.stencilPassOperation),r=ey("stencilFailOperation",t.stencilFailOperation),s=ey("stencilDepthFailOperation",t.stencilDepthFailOperation);i.stencilOpSeparate(1028,r,s,e),i.stencilOpSeparate(1029,r,s,e)}switch(t.blend){case!0:i.enable(3042);break;case!1:i.disable(3042)}if(t.blendColorOperation||t.blendAlphaOperation){let e=ev("blendColorOperation",t.blendColorOperation||"add"),r=ev("blendAlphaOperation",t.blendAlphaOperation||"add");i.blendEquationSeparate(e,r);let s=eb("blendColorSrcFactor",t.blendColorSrcFactor||"one"),n=eb("blendColorDstFactor",t.blendColorDstFactor||"zero"),o=eb("blendAlphaSrcFactor",t.blendAlphaSrcFactor||"one"),a=eb("blendAlphaDstFactor",t.blendAlphaDstFactor||"zero");i.blendFuncSeparate(s,n,o,a)}}(e,t),v(e.gl,i),r(e)}finally{e.popState()}}(this.device,r,i.glParameters,()=>{p&&h?this.device.gl.drawElementsInstanced(f,a||0,g,u,l||0):p?this.device.gl.drawElements(f,a||0,g,u):h?this.device.gl.drawArraysInstanced(f,u,a||0,l||0):this.device.gl.drawArrays(f,u,a||0),c&&c.end()}),o.unbindAfterRender(i),!0):(s.R.info(2,`RenderPipeline:${this.id}.draw() aborted - textures not yet loaded`)(),!1)}_areTexturesRenderable(e){let t=!0;for(let i of this.shaderLayout.bindings)eB(e,i.name)||(s.R.warn(`Binding ${i.name} not found in ${this.id}`)(),t=!1);return t}_applyBindings(e,t){if(this._syncLinkStatus(),"success"!==this.linkStatus)return;let{gl:i}=this.device;i.useProgram(this.handle);let r=0,n=0;for(let t of this.shaderLayout.bindings){let o=eB(e,t.name);if(!o)throw Error(`No value for binding ${t.name} in ${this.id}`);switch(t.type){case"uniform":let{name:a}=t,l=i.getUniformBlockIndex(this.handle,a);if(0xffffffff===l)throw Error(`Invalid uniform block name ${a}`);i.uniformBlockBinding(this.handle,l,n),o instanceof ed?i.bindBufferBase(35345,n,o.handle):i.bindBufferRange(35345,n,o.buffer.handle,o.offset||0,o.size||o.buffer.byteLength-(o.offset||0)),n+=1;break;case"texture":let h;
806if(!(o instanceof eC||o instanceof eL||o instanceof es))throw Error("texture");if(o instanceof eC)h=o.texture;else if(o instanceof eL)h=o;else if(o instanceof es&&o.colorAttachments[0]instanceof eC)s.R.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")(),h=o.colorAttachments[0].texture;else throw Error("No texture");i.activeTexture(33984+r),i.bindTexture(h.glTarget,h.handle),r+=1;break;case"sampler":break;case"storage":case"read-only-storage":throw Error(`binding type '${t.type}' not supported in WebGL`)}}}_applyUniforms(e){for(let t of this.shaderLayout.uniforms||[]){let{name:i,location:r,type:s,textureUnit:n}=t,o=e[i]??n;void 0!==o&&function(e,t,i,r){let s=r;!0===s&&(s=1),!1===s&&(s=0);let n="number"==typeof s?[s]:s;switch(i){case 35678:case 35680:case 35679:case 35682:case 36289:case 36292:case 36293:case 36298:case 36299:case 36300:case 36303:case 36306:case 36307:case 36308:case 36311:if("number"!=typeof r)throw Error("samplers must be set to integers");return e.uniform1i(t,r);case 5126:return e.uniform1fv(t,n);case 35664:return e.uniform2fv(t,n);case 35665:return e.uniform3fv(t,n);case 35666:return e.uniform4fv(t,n);case 5124:case 35670:return e.uniform1iv(t,n);case 35667:case 35671:return e.uniform2iv(t,n);case 35668:case 35672:return e.uniform3iv(t,n);case 35669:case 35673:return e.uniform4iv(t,n);case 5125:return e.uniform1uiv(t,n,1);case 36294:return e.uniform2uiv(t,n,2);case 36295:return e.uniform3uiv(t,n,3);case 36296:return e.uniform4uiv(t,n,4);case 35674:return e.uniformMatrix2fv(t,!1,n);case 35675:return e.uniformMatrix3fv(t,!1,n);case 35676:return e.uniformMatrix4fv(t,!1,n);case 35685:return e.uniformMatrix2x3fv(t,!1,n);case 35686:return e.uniformMatrix2x4fv(t,!1,n);case 35687:return e.uniformMatrix3x2fv(t,!1,n);case 35688:return e.uniformMatrix3x4fv(t,!1,n);case 35689:return e.uniformMatrix4x2fv(t,!1,n);case 35690:return e.uniformMatrix4x3fv(t,!1,n)}throw Error("Illegal uniform")}(this.device.gl,r,s,o)}}_syncLinkStatus(){this.linkStatus=this.sharedRenderPipeline.linkStatus}}function eD(e,t){return e.bindings.find(e=>e.name===t||e.name===`${t}Uniforms`||`${e.name}Uniforms`===t)}function eB(e,t){return e[t]||e[`${t}Uniforms`]||e[t.replace(/Uniforms$/,"")]}class eG extends et.F{get[Symbol.toStringTag](){return"SharedRenderPipeline"}constructor(e,t){super(e,t,{...et.F.defaultProps,handle:void 0,vs:void 0,fs:void 0,varyings:void 0,bufferMode:void 0})}}var ek=i(29288);let eU={5126:"f32",35664:"vec2<f32>",35665:"vec3<f32>",35666:"vec4<f32>",5124:"i32",35667:"vec2<i32>",35668:"vec3<i32>",35669:"vec4<i32>",5125:"u32",36294:"vec2<u32>",36295:"vec3<u32>",36296:"vec4<u32>",35670:"f32",35671:"vec2<f32>",35672:"vec3<f32>",35673:"vec4<f32>",35674:"mat2x2<f32>",35685:"mat2x3<f32>",35686:"mat2x4<f32>",35687:"mat3x2<f32>",35675:"mat3x3<f32>",35688:"mat3x4<f32>",35689:"mat4x2<f32>",35690:"mat4x3<f32>",35676:"mat4x4<f32>"},ez={35678:{viewDimension:"2d",sampleType:"float"},35680:{viewDimension:"cube",sampleType:"float"},35679:{viewDimension:"3d",sampleType:"float"},35682:{viewDimension:"3d",sampleType:"depth"},36289:{viewDimension:"2d-array",sampleType:"float"},36292:{viewDimension:"2d-array",sampleType:"depth"},36293:{viewDimension:"cube",sampleType:"float"},36298:{viewDimension:"2d",sampleType:"sint"},36299:{viewDimension:"3d",sampleType:"sint"},36300:{viewDimension:"cube",sampleType:"sint"},36303:{viewDimension:"2d-array",sampleType:"uint"},36306:{viewDimension:"2d",sampleType:"uint"},36307:{viewDimension:"3d",sampleType:"uint"},36308:{viewDimension:"cube",sampleType:"uint"},36311:{viewDimension:"2d-array",sampleType:"uint"}},ej={uint8:5121,sint8:5120,unorm8:5121,snorm8:5120,uint16:5123,sint16:5122,unorm16:5123,snorm16:5122,uint32:5125,sint32:5124,float16:5131,float32:5126};class eV extends eG{device;handle;vs;fs;introspectedLayout={attributes:[],bindings:[],uniforms:[]};linkStatus="pending";constructor(e,t){super(e,t),this.device=e,this.handle=t.handle||this.device.gl.createProgram(),this.vs=t.vs,this.fs=t.fs,t.varyings&&t.varyings.length>0&&this.device.gl.transformFeedbackVaryings(this.handle,t.varyings,t.bufferMode||35981),this._linkShaders(),s.R.time(3,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.introspectedLayout=function(e,t){let i={attributes:[],bindings:[]};for(let r of(i.attributes=function(e,t){let i=[],r=e.getProgramParameter(t,35721);for(let s=0;s<r;s++){let r=e.getActiveAttrib(t,s);if(!r)throw Error("activeInfo");let{name:n,type:o}=r,a=e.getAttribLocation(t,n);if(a>=0){let e=eU[o],t=/instance/i.test(n)?"instance":"vertex";i.push({name:n,location:a,stepMode:t,type:e})}}return i.sort((e,t)=>
806e.location-t.location),i}(e,t),function(e,t){let i=(i,r)=>e.getActiveUniformBlockParameter(t,i,r),r=[],n=e.getProgramParameter(t,35382);for(let o=0;o<n;o++){let n={name:e.getActiveUniformBlockName(t,o)||"",location:i(o,35391),byteLength:i(o,35392),vertex:i(o,35396),fragment:i(o,35398),uniformCount:i(o,35394),uniforms:[]},a=i(o,35395)||[],l=e.getActiveUniforms(t,a,35383),h=e.getActiveUniforms(t,a,35384),u=e.getActiveUniforms(t,a,35387),c=e.getActiveUniforms(t,a,35388);for(let i=0;i<n.uniformCount;++i){let r=a[i];if(void 0!==r){let s=e.getActiveUniform(t,r);if(!s)throw Error("activeInfo");let o=eU[l[i]];n.uniforms.push({name:s.name,format:o,type:l[i],arrayLength:h[i],byteOffset:u[i],byteStride:c[i]})}}let d=new Set(n.uniforms.map(e=>e.name.split(".")[0]).filter(e=>!!e)),f=n.name.replace(/Uniforms$/,"");if(1===d.size&&!d.has(n.name)&&!d.has(f)){let[e]=d;s.R.warn(`Uniform block "${n.name}" uses GLSL instance "${e}". luma.gl binds uniform buffers by block name ("${n.name}") and alias ("${f}"). Prefer matching the instance name to one of those to avoid confusing silent mismatches.`)()}r.push(n)}return r.sort((e,t)=>e.location-t.location),r}(e,t))){let e=r.uniforms.map(e=>({name:e.name,format:e.format,byteOffset:e.byteOffset,byteStride:e.byteStride,arrayLength:e.arrayLength}));i.bindings.push({type:"uniform",name:r.name,group:0,location:r.location,visibility:!!r.vertex&2*!!r.fragment,minBindingSize:r.byteLength,uniforms:e})}let r=function(e,t){let i=[],r=e.getProgramParameter(t,35718);for(let s=0;s<r;s++){let r=e.getActiveUniform(t,s);if(!r)throw Error("activeInfo");let{name:n,size:o,type:a}=r,{name:l,isArray:h}=function(e){if("]"!==e[e.length-1])return{name:e,length:1,isArray:!1};let t=/([^[]*)(\[[0-9]+\])?/.exec(e);return{name:Y(t?.[1],`Failed to parse GLSL uniform name ${e}`),length:+!!t?.[2],isArray:!!t?.[2]}}(n),u=e.getUniformLocation(t,l),c={location:u,name:l,size:o,type:a,isArray:h};if(i.push(c),c.size>1)for(let r=0;r<c.size;r++){let s=`${l}[${r}]`;u=e.getUniformLocation(t,s);let n={...c,name:s,location:u};i.push(n)}}return i}(e,t),n=0;for(let e of r)if(ez[e.type]){let{viewDimension:t,sampleType:r}=ez[e.type];i.bindings.push({type:"texture",name:e.name,group:0,location:n,viewDimension:t,sampleType:r}),e.textureUnit=n,n+=1}r.length&&(i.uniforms=r);let o=function(e,t){let i=[],r=e.getProgramParameter(t,35971);for(let s=0;s<r;s++){let r=e.getTransformFeedbackVarying(t,s);if(!r)throw Error("activeInfo");let{name:n,type:o,size:a}=r,l=eU[o],{type:h,components:u}=(0,ek.k0)(l);i.push({location:s,name:n,type:h,size:a*u})}return i.sort((e,t)=>e.location-t.location),i}(e,t);return o?.length&&(i.varyings=o),i}(this.device.gl,this.handle),s.R.timeEnd(3,`RenderPipeline ${this.id} - shaderLayout introspection`)()}destroy(){this.destroyed||(this.device.gl.useProgram(null),this.device.gl.deleteProgram(this.handle),this.handle.de
806stroyed=!0,this.destroyResource())}async _linkShaders(){let{gl:e}=this.device;if(e.attachShader(this.handle,this.vs.handle),e.attachShader(this.handle,this.fs.handle),s.R.time(4,`linkProgram for ${this.id}`)(),e.linkProgram(this.handle),s.R.timeEnd(4,`linkProgram for ${this.id}`)(),!this.device.features.has("compilation-status-async-webgl")){let e=this._getLinkStatus();this._reportLinkStatus(e);return}s.R.once(1,"RenderPipeline linking is asynchronous")(),await this._waitForLinkComplete(),s.R.info(2,`RenderPipeline ${this.id} - async linking complete: ${this.linkStatus}`)();let t=this._getLinkStatus();this._reportLinkStatus(t)}async _reportLinkStatus(e){if("success"!==e){let t="link-error"===e?"Link error":"Validation error";switch(this.vs.compilationStatus){case"error":throw this.vs.debugShader(),Error(`${this} ${t} during compilation of ${this.vs}`);case"pending":await this.vs.asyncCompilationStatus,this.vs.debugShader()}switch(this.fs?.compilationStatus){case"error":throw this.fs.debugShader(),Error(`${this} ${t} during compilation of ${this.fs}`);case"pending":await this.fs.asyncCompilationStatus,this.fs.debugShader()}let i=this.device.gl.getProgramInfoLog(this.handle);this.device.reportError(Error(`${t} during ${e}: ${i}`),this)(),this.device.debug()}}_getLinkStatus(){let{gl:e}=this.device;return e.getProgramParameter(this.handle,35714)?(this._initializeSamplerUniforms(),e.validateProgram(this.handle),e.getProgramParameter(this.handle,35715))?(this.linkStatus="success","success"):(this.linkStatus="error","validation-error"):(this.linkStatus="error","link-error")}_initializeSamplerUniforms(){let{gl:e}=this.device;e.useProgram(this.handle);let t=0,i=e.getProgramParameter(this.handle,35718);for(let r=0;r<i;r++){let i=e.getActiveUniform(this.handle,r);if(i&&ez[i.type]){let r=i.name.endsWith("[0]"),s=r?i.name.slice(0,-3):i.name,n=e.getUniformLocation(this.handle,s);null!==n&&(t=this._assignSamplerUniform(n,i,r,t))}}}_assignSamplerUniform(e,t,i,r){let{gl:s}=this.device;if(i&&t.size>1){let i=Int32Array.from({length:t.size},(e,t)=>r+t);return s.uniform1iv(e,i),r+t.size}return s.uniform1i(e,r),r+1}async _waitForLinkComplete(){let e=async e=>await new Promise(t=>setTimeout(t,e));if(!this.device.features.has("compilation-status-async-webgl"))return void await e(10);let{gl:t}=this.device;for(;;){if(t.getProgramParameter(this.handle,37297))return;await e(10)}}}class eW extends et.F{get[Symbol.toStringTag](){return"CommandEncoder"}_timeProfilingQuerySet=null;_timeProfilingSlotCount=0;_gpuTimeMs;constructor(e,t){super(e,t,eW.defaultProps),this._timeProfilingQuerySet=t.timeProfilingQuerySet??null,this._timeProfilingSlotCount=0,this._gpuTimeMs=void 0}async resolveTimeProfilingQuerySet(){if(this._gpuTimeMs=void 0,!this._timeProfilingQuerySet)return;let e=Math.floor(this._timeProfilingSlotCount/2);if(e<=0)return;let t=2*e,i=await this._timeProfilingQuerySet.readResults({firstQuery:0,queryCount:t}),r=0n;for(let e=0;e<t;e+=2)r+=i[e+1]-i[e];this._gpuTimeMs=Number(r)/1e6}getTimeProfilingSlotCount(){return this._timeProfilingSlotCount}getTimeProfilingQuerySet(){return this._timeProfilingQuerySet}_applyTimeProfilingToPassProps(e){let t=e||{};if(!this._supportsTimestampQueries()||!this._timeProfilingQuerySet||void 0!==t.timestampQuerySet||void 0!==t.beginTimestampIndex||void 0!==t.endTimestampIndex)return t;let i=this._timeProfilingSlotCount;return i+1>=this._timeProfilingQuerySet.props.count?t:(this._timeProfilingSlotCount+=2,{...t,timestampQuerySet:this._timeProfilingQuerySet,beginTimestampIndex:i,endTimestampIndex:i+1})}_supportsTimestampQueries(){return this.device.features.has("timestamp-query")}static defaultProps={...et.F.defaultProps,measureExecutionTime:void 0,timeProfilingQuerySet:void 0}}class e$ extends et.F{get[Symbol.toStringTag](){return"CommandBuffer"}constructor(e,t){super(e,t,e$.defaultProps)}static defaultProps={...et.F.defaultProps}}class eH extends e${device;handle=null;commands=[];constructor(e,t={}){super(e,t),this.device=e}_executeCommands(e=this.commands){for(let t of e)switch(t.name){case"copy-buffer-to-buffer":!function(e,t){let i=t.sourceBuffer,r=t.destinationBuffer;e.gl.bindBuffer(36662,i.handle),e.gl.bindBuffer(36663,r.handle),e.gl.copyBufferSubData(36662,36663,t.sourceOffset??0,t.destinationOffset??0,t.size),e.gl.bindBuffer(36662,null),e.gl.bindBuffer(36663,null)}(this.device,t.options);break;case"copy-buffer-to-texture":this.device,t.options;throw Error("copyBufferToTexture is not supported in WebGL");case"copy-texture-to-buffer":!function(e,t){let i,{sourceTexture:r,mipLevel:s=0,aspect:n="all",width:o=t.sourceTexture.width,height:a=t.sourceTexture.height,depthOrArrayLayers:l,origin:h=[0,0,0],destinationBuffer:u,byteOffset:c=0,bytesPerRow:d,rowsPerImage:f}=t;if(r instanceof ei.g)return r.readBuffer({x:h[0]??0,y:h[1]??0,z:h[2]??0,width:o,height:a,depthOrArrayLayers:l,mipLevel:s,aspect:n,byteOffset:c},u);if("all"!==n)throw Error("aspect not supported in WebGL");if(0!==s||void 0!==l||d||f)throw Error("not implemented");let{framebuffer:p,destroyFramebuffer:g}=eq(r);
806try{let t=o||p.width,r=a||p.height,s=Y(p.colorAttachments[0]),n=V(s.texture.props.format),l=n.format,d=n.type;e.gl.bindBuffer(35051,u.handle),i=e.gl.bindFramebuffer(36160,p.handle),e.gl.readPixels(h[0],h[1],t,r,l,d,c)}finally{e.gl.bindBuffer(35051,null),void 0!==i&&e.gl.bindFramebuffer(36160,i),g&&p.destroy()}}(this.device,t.options);break;case"copy-texture-to-texture":!function(e,t){let i,r,{sourceTexture:s,destinationMipLevel:n=0,origin:o=[0,0],destinationOrigin:a=[0,0,0],destinationTexture:l}=t,{width:h=t.destinationTexture.width,height:u=t.destinationTexture.height}=t,{framebuffer:c,destroyFramebuffer:d}=eq(s),[f=0,p=0]=o,[g,m,_]=a,y=e.gl.bindFramebuffer(36160,c.handle);if(l instanceof eL)i=l,h=Number.isFinite(h)?h:i.width,u=Number.isFinite(u)?u:i.height,i._bind(0),r=i.glTarget;else throw Error("invalid destination");switch(r){case 3553:case 34067:e.gl.copyTexSubImage2D(r,n,g,m,f,p,h,u);break;case 35866:case 32879:e.gl.copyTexSubImage3D(r,n,g,m,_,f,p,h,u)}i&&i._unbind(),e.gl.bindFramebuffer(36160,y),d&&c.destroy()}(this.device,t.options);break;default:throw Error(t.name)}}}function eq(e){if(e instanceof ei.g){let{width:t,height:i,id:r}=e;return{framebuffer:e.device.createFramebuffer({id:`framebuffer-for-${r}`,width:t,height:i,colorAttachments:[e]}),destroyFramebuffer:!0}}return{framebuffer:e,destroyFramebuffer:!1}}class eK extends et.F{static defaultClearColor=[0,0,0,1];static defaultClearDepth=1;static defaultClearStencil=0;get[Symbol.toStringTag](){return"RenderPass"}constructor(e,t){super(e,t=eK.normalizeProps(e,t),eK.defaultProps)}static normalizeProps(e,t){return t}static defaultProps={...et.F.defaultProps,framebuffer:null,parameters:void 0,clearColor:eK.defaultClearColor,clearColors:void 0,clearDepth:eK.defaultClearDepth,clearStencil:eK.defaultClearStencil,depthReadOnly:!1,stencilReadOnly:!1,discard:!1,occlusionQuerySet:void 0,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0}}let eX=[1,2,4,8];class eY extends eK{device;handle=null;glParameters={};constructor(e,t){let i;super(e,t),this.device=e;let r=this.props.framebuffer,s=!r||null===r.handle;if(s&&e.getDefaultCanvasContext()._resizeDrawingBufferIfNeeded(),!t?.parameters?.viewport)if(!s&&r){let{width:e,height:t}=r;i=[0,0,e,t]}else{let[t,r]=e.getDefaultCanvasContext().getDrawingBufferSize();i=[0,0,t,r]}if(this.device.pushState(),this.setParameters({viewport:i,...this.props.parameters}),!s&&r?.colorAttachments.length){let e=r.colorAttachments.map((e,t)=>36064+t);this.device.gl.drawBuffers(e)}else s&&this.device.gl.drawBuffers([1029]);this.clear(),this.props.timestampQuerySet&&void 0!==this.props.beginTimestampIndex&&this.props.timestampQuerySet.writeTimestamp(this.props.beginTimestampIndex)}end(){this.destroyed||(this.props.timestampQuerySet&&void 0!==this.props.endTimestampIndex&&this.props.timestampQuerySet.writeTimestamp(this.props.endTimestampIndex),this.device.popState(),this.destroy())}pushDebugGroup(e){}popDebugGroup(){}insertDebugMarker(e){}setParameters(e={}){let t={...this.glParameters};t.framebuffer=this.props.framebuffer||null,this.props.depthReadOnly&&(t.depthMask=!this.props.depthReadOnly),t.stencilMask=+!this.props.stencilReadOnly,t[35977]=this.props.discard,e.viewport&&(e.viewport.length>=6?(t.viewport=e.viewport.slice(0,4),t.depthRange=[e.viewport[4],e.viewport[5]]):t.viewport=e.viewport),e.scissorRect&&(t.scissorTest=!0,t.scissor=e.scissorRect),e.blendConstant&&(t.blendColor=e.blendConstant),void 0!==e.stencilReference&&(t[2967]=e.stencilReference,t[36003]=e.stencilReference),"colorMask"in e&&(t.colorMask=eX.map(t=>!!(t&e.colorMask))),this.glParameters=t,v(this.device.gl,t)}beginOcclusionQuery(e){let t=this.props.occlusionQuerySet;t?.beginOcclusionQuery()}endOcclusionQuery(){let e=this.props.occlusionQuerySet;e?.endOcclusionQuery()}clear(){let e={...this.glParameters},t=0;this.props.clearColors&&this.props.clearColors.forEach((e,t)=>{e&&this.clearColorBuffer(t,e)}),!1!==this.props.clearColor&&void 0===this.props.clearColors&&(t|=16384,e.clearColor=this.props.clearColor),!1!==this.props.clearDepth&&(t|=256,e.clearDepth=this.props.clearDepth),!1!==this.props.clearStencil&&(t|=1024,e.clearStencil=this.props.clearStencil),0!==t&&eA(this.device.gl,e,()=>{this.device.gl.clear(t)})}clearColorBuffer(e=0,t=[0,0,0,0]){eA(this.device.gl,{framebuffer:this.props.framebuffer},()=>{switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:this.device.gl.clearBufferiv(6144,e,t);break;case Uint8Array:case Uint8ClampedArray:case Uint16Array:case Uint32Array:this.device.gl.clearBufferuiv(6144,e,t);break;
806case Float32Array:this.device.gl.clearBufferfv(6144,e,t);break;default:throw Error("clearColorBuffer: color must be typed array")}})}}class eZ extends eW{device;handle=null;commandBuffer;constructor(e,t){super(e,t),this.device=e,this.commandBuffer=new eH(e,{id:`${this.props.id}-command-buffer`})}destroy(){this.destroyResource()}finish(e){return e?.id&&this.commandBuffer.id!==e.id&&(this.commandBuffer.id=e.id,this.commandBuffer.props.id=e.id),this.destroy(),this.commandBuffer}beginRenderPass(e={}){return new eY(this.device,this._applyTimeProfilingToPassProps(e))}beginComputePass(e={}){throw Error("ComputePass not supported in WebGL")}copyBufferToBuffer(e){this.commandBuffer.commands.push({name:"copy-buffer-to-buffer",options:e})}copyBufferToTexture(e){this.commandBuffer.commands.push({name:"copy-buffer-to-texture",options:e})}copyTextureToBuffer(e){this.commandBuffer.commands.push({name:"copy-texture-to-buffer",options:e})}copyTextureToTexture(e){this.commandBuffer.commands.push({name:"copy-texture-to-texture",options:e})}pushDebugGroup(e){}popDebugGroup(){}insertDebugMarker(e){}resolveQuerySet(e,t,i){throw Error("resolveQuerySet is not supported in WebGL")}writeTimestamp(e,t){e.writeTimestamp(t)}}var eQ=i(92354);class eJ extends et.F{static defaultProps={...et.F.defaultProps,shaderLayout:void 0,bufferLayout:[]};get[Symbol.toStringTag](){return"VertexArray"}maxVertexAttributes;attributeInfos;indexBuffer=null;attributes;constructor(e,t){super(e,t,eJ.defaultProps),this.maxVertexAttributes=e.limits.maxVertexAttributes,this.attributes=Array(this.maxVertexAttributes).fill(null),this.attributeInfos=(0,eQ.M)(t.shaderLayout,t.bufferLayout,this.maxVertexAttributes)}setConstantWebGL(e,t){this.device.reportError(Error("constant attributes not supported"),this)()}}var e0=i(29929),e1=i(40768),e3=i(86021);class e2 extends eJ{get[Symbol.toStringTag](){return"VertexArray"}device;handle;buffer=null;bufferValue=null;static isConstantAttributeZeroSupported(e){var t;return"Chrome"===((0,q.B)()?(0,e1.b)(t)?"Electron":(t||e3.gM.userAgent||"").indexOf("Edge")>-1?"Edge":globalThis.chrome?"Chrome":globalThis.safari?"Safari":globalThis.mozInnerScreenX?"Firefox":"Unknown":"Node")}constructor(e,t){super(e,t),this.device=e,this.handle=this.device.gl.createVertexArray()}destroy(){super.destroy(),this.buffer&&this.buffer?.destroy(),this.handle&&(this.device.gl.deleteVertexArray(this.handle),this.handle=void 0)}setIndexBuffer(e){if(e&&34963!==e.glTarget)throw Error("Use .setBuffer()");this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34963,e?e.handle:null),this.indexBuffer=e,this.device.gl.bindVertexArray(null)}setBuffer(e,t){if(34963===t.glTarget)throw Error("Use .setIndexBuffer()");let{size:i,type:r,stride:s,offset:n,normalized:o,integer:a,divisor:l}=this._getAccessor(e);this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34962,t.handle),a?this.device.gl.vertexAttribIPointer(e,i,r,s,n):this.device.gl.vertexAttribPointer(e,i,r,o,s,n),this.device.gl.bindBuffer(34962,null),this.device.gl.enableVertexAttribArray(e),this.device.gl.vertexAttribDivisor(e,l||0),this.attributes[e]=t,this.device.gl.bindVertexArray(null)}setConstantWebGL(e,t){this._enable(e,!1),this.attributes[e]=t}bindBeforeRender(){this.device.gl.bindVertexArray(this.handle),this._applyConstantAttributes()}unbindAfterRender(){this.device.gl.bindVertexArray(null)}_applyConstantAttributes(){for(let e=0;e<this.maxVertexAttributes;++e){let t=this.attributes[e];ArrayBuffer.isView(t)&&this.device.setConstantAttributeWebGL(e,t)}}_getAccessor(e){let t=this.attributeInfos[e];if(!t)throw Error(`Unknown attribute location ${e}`);let i=M(t.bufferDataType);return{size:t.bufferComponents,type:i,stride:t.byteStride,offset:t.byteOffset,normalized:t.normalized,integer:t.integer,divisor:+("instance"===t.stepMode)}}_enable(e,t=!0){let i=e2.isConstantAttributeZeroSupported(this.device)||0!==e;(t||i)&&(e=Number(e),this.device.gl.bindVertexArray(this.handle),t?this.device.gl.enableVertexAttribArray(e):this.device.gl.disableVertexAttribArray(e),this.device.gl.bindVertexArray(null))}getConstantBuffer(e,t){var i;let r=Array.isArray(i=t)?new Float32Array(i):i,s=r.byteLength*e,n=r.length*e;if(this.buffer&&s!==this.buffer.byteLength)throw Error(`Buffer size is immutable, byte length ${s} !== ${this.buffer.byteLength}.`);let o=!this.buffer;if(this.buffer=this.buffer||this.device.createBuffer({byteLength:s}),o||=!function(e,t){if(!e||!t||e.length!==t.length||e.constructor!==t.constructor)return!1;for(let i=0;i<e.length;++i)if(e[i]!==t[i])return!1;return!0}(r,this.bufferValue)){let e=(0,e0.X)(t.constructor,n);!function(e){let{target:t,source:i,start:r=0,count:s=1}=e,n=i.length,o=s*n,a=0;for(let e=r;a<n;
806a++)t[e++]=i[a]??0;for(;a<o;)a<o-a?(t.copyWithin(r+a,r,r+a),a*=2):(t.copyWithin(r+a,r,r+o-a),a=o);e.target}({target:e,source:r,start:0,count:n}),this.buffer.write(e),this.bufferValue=t}return this.buffer}}class e4 extends et.F{static defaultProps={...et.F.defaultProps,layout:void 0,buffers:{}};get[Symbol.toStringTag](){return"TransformFeedback"}constructor(e,t){super(e,t,e4.defaultProps)}}class e6 extends e4{device;gl;handle;layout;buffers={};unusedBuffers={};bindOnUse=!0;_bound=!1;constructor(e,t){super(e,t),this.device=e,this.gl=e.gl,this.handle=this.props.handle||this.gl.createTransformFeedback(),this.layout=this.props.layout,t.buffers&&this.setBuffers(t.buffers),Object.seal(this)}destroy(){this.gl.deleteTransformFeedback(this.handle),super.destroy()}begin(e="point-list"){this.gl.bindTransformFeedback(36386,this.handle),this.bindOnUse&&this._bindBuffers(),this.gl.beginTransformFeedback(function(e){switch(e){case"point-list":return 0;case"line-list":case"line-strip":return 1;case"triangle-list":case"triangle-strip":return 4;default:throw Error(e)}}(e))}end(){this.gl.endTransformFeedback(),this.bindOnUse&&this._unbindBuffers(),this.gl.bindTransformFeedback(36386,null)}setBuffers(e){this.buffers={},this.unusedBuffers={},this.bind(()=>{for(let[t,i]of Object.entries(e))this.setBuffer(t,i)})}setBuffer(e,t){let i=this._getVaryingIndex(e),{buffer:r,byteLength:n,byteOffset:o}=this._getBufferRange(t);if(i<0){this.unusedBuffers[e]=r,s.R.warn(`${this.id} unusedBuffers varying buffer ${e}`)();return}this.buffers[i]={buffer:r,byteLength:n,byteOffset:o},this.bindOnUse||this._bindBuffer(i,r,o,n)}getBuffer(e){if(e8(e))return this.buffers[e]||null;let t=this._getVaryingIndex(e);return this.buffers[t]??null}bind(e=this.handle){let t;return"function"!=typeof e?(this.gl.bindTransformFeedback(36386,e),this):(this._bound?t=e():(this.gl.bindTransformFeedback(36386,this.handle),this._bound=!0,t=e(),this._bound=!1,this.gl.bindTransformFeedback(36386,null)),t)}unbind(){this.bind(null)}_getBufferRange(e){if(e instanceof ed)return{buffer:e,byteOffset:0,byteLength:e.byteLength};let{buffer:t,byteOffset:i=0,byteLength:r=e.buffer.byteLength}=e;return{buffer:t,byteOffset:i,byteLength:r}}_getVaryingIndex(e){if(e8(e))return Number(e);for(let t of this.layout.varyings||[])if(e===t.name)return t.location;return -1}_bindBuffers(){for(let[e,t]of Object.entries(this.buffers)){let{buffer:i,byteLength:r,byteOffset:s}=this._getBufferRange(t);this._bindBuffer(Number(e),i,s,r)}}_unbindBuffers(){for(let e in this.buffers)this.gl.bindBufferBase(35982,Number(e),null)}_bindBuffer(e,t,i=0,r){let s=t&&t.handle;s&&void 0!==r?this.gl.bindBufferRange(35982,e,s,i,r):this.gl.bindBufferBase(35982,e,s)}}function e8(e){return"number"==typeof e?Number.isInteger(e):/^\d+$/.test(e)}class e5 extends et.F{get[Symbol.toStringTag](){return"QuerySet"}constructor(e,t){super(e,t,e5.defaultProps)}static defaultProps={...et.F.defaultProps,type:void 0,count:void 0}}class e7 extends e5{device;handle;_timestampPairs=[];_pendingReads=new Set;_occlusionQuery=null;_occlusionActive=!1;get[Symbol.toStringTag](){return"QuerySet"}constructor(e,t){if(super(e,t),this.device=e,"timestamp"===t.type){if(t.count<2)throw Error("Timestamp QuerySet requires at least two query slots");this._timestampPairs=Array(Math.ceil(t.count/2)).fill(null).map(()=>({activeQuery:null,completedQueries:[]})),this.handle=null}else{if(t.count>1)throw Error("WebGL occlusion QuerySet can only have one value");let e=this.device.gl.createQuery();if(!e)throw Error("WebGL query not supported");this.handle=e}
806Object.seal(this)}destroy(){if(!this.destroyed){for(let e of(this.handle&&this.device.gl.deleteQuery(this.handle),this._timestampPairs))for(let t of(e.activeQuery&&(this._cancelPendingQuery(e.activeQuery),this.device.gl.deleteQuery(e.activeQuery.handle)),e.completedQueries))this._cancelPendingQuery(t),this.device.gl.deleteQuery(t.handle);for(let e of(this._occlusionQuery&&(this._cancelPendingQuery(this._occlusionQuery),this.device.gl.deleteQuery(this._occlusionQuery.handle)),Array.from(this._pendingReads)))this._cancelPendingQuery(e);this.destroyResource()}}isResultAvailable(e){return"timestamp"===this.props.type?void 0===e?this._timestampPairs.some((e,t)=>this._isTimestampPairAvailable(t)):this._isTimestampPairAvailable(this._getTimestampPairIndex(e)):!!this._occlusionQuery&&this._pollQueryAvailability(this._occlusionQuery)}async readResults(e){let t=e?.firstQuery||0,i=e?.queryCount||this.props.count-t;if(this._validateRange(t,i),"timestamp"===this.props.type){let e=Array(i).fill(0n),r=Math.floor(t/2),s=Math.floor((t+i-1)/2);for(let n=r;n<=s;n++){let r=await this._consumeTimestampPairResult(n),s=2*n,o=s+1;s>=t&&s<t+i&&(e[s-t]=0n),o>=t&&o<t+i&&(e[o-t]=r)}return e}if(!this._occlusionQuery)throw Error("Occlusion query has not been started");return[await this._consumeQueryResult(this._occlusionQuery)]}async readTimestampDuration(e,t){if("timestamp"!==this.props.type)throw Error("Timestamp durations require a timestamp QuerySet");if(e<0||t>=this.props.count||t<=e)throw Error("Timestamp duration range is out of bounds");if(e%2!=0||t!==e+1)throw Error("WebGL timestamp durations require adjacent even/odd query indices");return Number(await this._consumeTimestampPairResult(this._getTimestampPairIndex(e)))/1e6}beginOcclusionQuery(){if("occlusion"!==this.props.type)throw Error("Occlusion queries require an occlusion QuerySet");if(!this.handle)throw Error("WebGL occlusion query is not available");if(this._occlusionActive)throw Error("Occlusion query is already active");this.device.gl.beginQuery(35887,this.handle),this._occlusionQuery={handle:this.handle,promise:null,result:null,disjoint:!1,cancelled:!1,pollRequestId:null,resolve:null,reject:null},this._occlusionActive=!0}endOcclusionQuery(){if(!this._occlusionActive)throw Error("Occlusion query is not active");this.device.gl.endQuery(35887),this._occlusionActive=!1}writeTimestamp(e){if("timestamp"!==this.props.type)throw Error("Timestamp writes require a timestamp QuerySet");let t=this._getTimestampPairIndex(e),i=this._timestampPairs[t];if(e%2==0){if(i.activeQuery)throw Error("Timestamp query pair is already active");let e=this.device.gl.createQuery();if(!e)throw Error("WebGL query not supported");this.device.gl.beginQuery(35007,e),i.activeQuery={handle:e,promise:null,result:null,disjoint:!1,cancelled:!1,pollRequestId:null,resolve:null,reject:null};return}if(!i.activeQuery)throw Error("Timestamp query pair was ended before it was started");this.device.gl.endQuery(35007),i.completedQueries.push(i.activeQuery),i.activeQuery=null}_validateRange(e,t){if(e<0||t<0||e+t>this.props.count)throw Error("Query read range is out of bounds")}_getTimestampPairIndex(e){if(e<0||e>=this.props.count)throw Error("Query index is out of bounds");return Math.floor(e/2)}_isTimestampPairAvailable(e){let t=this._timestampPairs[e];return!!t&&0!==t.completedQueries.length&&this._pollQueryAvailability(t.completedQueries[0])}_pollQueryAvailability(e){if(e.cancelled||this.destroyed)return e.result=0n,!0;if(null!==e.result||e.disjoint)return!0;if(!this.device.gl.getQueryParameter(e.handle,34919))return!1;let t=!!this.device.gl.getParameter(36795);return e.disjoint=t,e.result=t?0n:BigInt(this.device.gl.getQueryParameter(e.handle,34918)),!0}async _consumeTimestampPairResult(e){let t=this._timestampPairs[e];if(!t||0===t.completedQueries.length)throw Error("Timestamp query pair has no completed result");let i=t.completedQueries.shift();try{return await this._consumeQueryResult(i)}finally{this.device.gl.deleteQuery(i.handle)}}_consumeQueryResult(e){return e.promise||(this._pendingReads.add(e),e.promise=new Promise((t,i)=>{e.resolve=t,e.reject=i;let r=()=>{if(e.pollRequestId=null,e.cancelled||this.destroyed){this._pendingReads.delete(e),e.promise=null,e.resolve=null,e.reject=null,t(0n);return}if(!this._pollQueryAvailability(e)){e.pollRequestId=this._requestAnimationFrame(r);return}
806this._pendingReads.delete(e),e.promise=null,e.resolve=null,e.reject=null,e.disjoint?i(Error("GPU timestamp query was invalidated by a disjoint event")):t(e.result||0n)};r()})),e.promise}_cancelPendingQuery(e){if(this._pendingReads.delete(e),e.cancelled=!0,null!==e.pollRequestId&&(this._cancelAnimationFrame(e.pollRequestId),e.pollRequestId=null),e.resolve){let t=e.resolve;e.promise=null,e.resolve=null,e.reject=null,t(0n)}}_requestAnimationFrame(e){return requestAnimationFrame(e)}_cancelAnimationFrame(e){cancelAnimationFrame(e)}}class e9 extends et.F{static defaultProps={...et.F.defaultProps};get[Symbol.toStringTag](){return"Fence"}constructor(e,t={}){super(e,t,e9.defaultProps)}}class te extends e9{device;gl;handle;signaled;_signaled=!1;constructor(e,t={}){super(e,{}),this.device=e,this.gl=e.gl;let i=this.props.handle||this.gl.fenceSync(this.gl.SYNC_GPU_COMMANDS_COMPLETE,0);if(!i)throw Error("Failed to create WebGL fence");this.handle=i,this.signaled=new Promise(e=>{let t=()=>{let i=this.gl.clientWaitSync(this.handle,0,0);i===this.gl.ALREADY_SIGNALED||i===this.gl.CONDITION_SATISFIED?(this._signaled=!0,e()):setTimeout(t,1)};t()})}isSignaled(){if(this._signaled)return!0;let e=this.gl.getSyncParameter(this.handle,this.gl.SYNC_STATUS);return this._signaled=e===this.gl.SIGNALED,this._signaled}destroy(){this.destroyed||this.gl.deleteSync(this.handle)}}var tt=i(29642);function ti(e){switch(e){case 6406:case 33326:case 6403:case 36244:return 1;case 33339:case 33340:case 33328:case 33320:case 33319:return 2;case 6407:case 36248:case 34837:return 3;case 6408:case 36249:case 34836:return 4;default:return 0}}function tr(e){return e instanceof er?{framebuffer:e,deleteFramebuffer:!1}:{framebuffer:function(e,t){let{device:i,width:r,height:s,id:n}=e;return i.createFramebuffer({...void 0,id:`framebuffer-for-${n}`,width:r,height:s,colorAttachments:[e]})}(e),deleteFramebuffer:!0}}class ts extends r.pF{static getDeviceFromContext(e){return e?e.luma?.device??null:null}type="webgl";handle;features;limits;info;canvasContext;preferredColorFormat="rgba8unorm";
806preferredDepthFormat="depth24plus";commandEncoder;lost;_resolveContextLost;gl;_constants;extensions;_polyfilled=!1;spectorJS;get[Symbol.toStringTag](){return"WebGLDevice"}toString(){return`${this[Symbol.toStringTag]}(${this.id})`}isVertexFormatSupported(e){return"unorm8x4-bgra"!==e}constructor(e){super({...e,id:e.id||function(e="id"){eu[e]=eu[e]||1;let t=eu[e]++;return`${e}-${t}`}("webgl-device")});let t=r.pF._getCanvasContextProps(e);if(!t)throw Error("WebGLDevice requires props.createCanvasContext to be set");let i=t.canvas?.gl??null,n=ts.getDeviceFromContext(i);if(n)throw Error(`WebGL context already attached to device ${n.id}`);this.canvasContext=new en(this,t),this.lost=new Promise(e=>{this._resolveContextLost=e});let o={...e.webgl};"premultiplied"===t.alphaMode&&(o.premultipliedAlpha=!0),void 0!==e.powerPreference&&(o.powerPreference=e.powerPreference),void 0!==e.failIfMajorPerformanceCaveat&&(o.failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat);let a=this.props._handle||function(e,t,i){let r="",s=e=>{let t=e.statusMessage;t&&(r||=t)};e.addEventListener("webglcontextcreationerror",s,!1);let n=!0!==i.failIfMajorPerformanceCaveat,o={preserveDrawingBuffer:!0,...i,failIfMajorPerformanceCaveat:!0},a=null;try{(a||=e.getContext("webgl2",o))||!o.failIfMajorPerformanceCaveat||(r||="Only software GPU is available. Set `failIfMajorPerformanceCaveat: false` to allow.");let i=!1;if(!a&&n&&(o.failIfMajorPerformanceCaveat=!1,a=e.getContext("webgl2",o),i=!0),!a&&(a=e.getContext("webgl",{}))&&(a=null,r||="Your browser only supports WebGL1"),!a)throw r||="Your browser does not support WebGL",Error(`Failed to create WebGL context: ${r}`);(0,S.V)(a).softwareRenderer=i;let{onContextLost:s,onContextRestored:l}=t;return e.addEventListener("webglcontextlost",e=>s(e),!1),e.addEventListener("webglcontextrestored",e=>l(e),!1),a}finally{e.removeEventListener("webglcontextcreationerror",s,!1)}}(this.canvasContext.canvas,{onContextLost:e=>this._resolveContextLost?.({reason:"destroyed",message:"Entered sleep mode, or too many apps or browser tabs are using the GPU."}),onContextRestored:e=>console.log("WebGL context restored")},o);if(!a)throw Error("WebGL context creation failed");if(n=ts.getDeviceFromContext(a)){if(e._reuseDevices)return s.R.log(1,`Not creating a new Device, instead returning a reference to Device ${n.id} already attached to WebGL context`,n)(),this.canvasContext.destroy(),n._reused=!0,n;throw Error(`WebGL context already attached to device ${n.id}`)}this.handle=a,this.gl=a,this.spectorJS=(0,el.k2)({...this.props,gl:this.handle});let l=(0,S.V)(this.handle);l.device=this,l.extensions||(l.extensions={}),this.extensions=l.extensions,this.info=function(e,t){var i,r;let s=e.getParameter(7936),n=e.getParameter(7937);P(e,"WEBGL_debug_renderer_info",t);let o=t.WEBGL_debug_renderer_info,a=e.getParameter(o?o.UNMASKED_VENDOR_WEBGL:7936),l=e.getParameter(o?o.UNMASKED_RENDERER_WEBGL:7937),h=a||s,u=l||n,c=e.getParameter(7938),d=T(h,u),f=(i=h,r=u,/Metal/i.exec(i)||/Metal/i.exec(r)?"metal":
806/ANGLE/i.exec(i)||/ANGLE/i.exec(r)?"opengl":"unknown");return{type:"webgl",gpu:d,gpuType:function(e,t){if(/SwiftShader/i.exec(e)||/SwiftShader/i.exec(t))return"cpu";switch(T(e,t)){case"apple":var i,r;return(i=e,r=t,/Apple (M\d|A\d|GPU)/i.test(`${i} ${r}`))?"integrated":"unknown";case"intel":return"integrated";case"software":return"cpu";case"unknown":return"unknown";default:return"discrete"}}(h,u),gpuBackend:f,vendor:h,renderer:u,version:c,shadingLanguage:"glsl",shadingLanguageVersion:300}}(this.gl,this.extensions),this.limits=new H(this.gl),this.features=new $(this.gl,this.extensions,this.props._disabledFeatures),this.props._initializeFeatures&&this.features.initializeFeatures(),new x(this.gl,{log:(...e)=>s.R.log(1,...e)()}).trackState(this.gl,{copyState:!1}),(e.debug||e.debugWebGL)&&(this.gl=(0,eh.l)(this.gl,{debugWebGL:!0,traceWebGL:e.debugWebGL}),s.R.warn("WebGL debug mode activated. Performance reduced.")()),e.debugWebGL&&(s.R.level=Math.max(s.R.level,1)),this.commandEncoder=new eZ(this,{id:`${this}-command-encoder`}),this.canvasContext._startObservers()}destroy(){this.commandEncoder?.destroy(),this.props._reuseDevices||this._reused||((0,S.V)(this.handle).device=null)}get isLost(){return this.gl.isContextLost()}createCanvasContext(e){throw Error("WebGL only supports a single canvas")}createPresentationContext(e){return new ea(this,e||{})}createBuffer(e){return new ed(this,this._normalizeBufferProps(e))}createTexture(e){return new eL(this,e)}createExternalTexture(e){throw Error("createExternalTexture() not implemented")}createSampler(e){return new eP(this,e)}createShader(e){return new eg(this,e)}createFramebuffer(e){return new es(this,e)}createVertexArray(e){return new e2(this,e)}createTransformFeedback(e){return new e6(this,e)}createQuerySet(e){return new e7(this,e)}createFence(){return new te(this)}createRenderPipeline(e){return new eF(this,e)}_createSharedRenderPipelineWebGL(e){return new eV(this,e)}createComputePipeline(e){throw Error("ComputePipeline not supported in WebGL")}createCommandEncoder(e={}){return new eZ(this,e)}submit(e){let t=null;e||({submittedCommandEncoder:t,commandBuffer:e}=this._finalizeDefaultCommandEncoderForSubmit());try{e._executeCommands(),t&&t.resolveTimeProfilingQuerySet().then(()=>{this.commandEncoder._gpuTimeMs=t._gpuTimeMs}).catch(()=>{})}finally{e.destroy()}}_finalizeDefaultCommandEncoderForSubmit(){let e=this.commandEncoder,t=e.finish();return this.commandEncoder.destroy(),this.commandEncoder=this.createCommandEncoder({id:e.props.id,timeProfilingQuerySet:e.getTimeProfilingQuerySet()}),{submittedCommandEncoder:e,commandBuffer:t}}readPixelsToArrayWebGL(e,t){return function(e,t){let{sourceX:i=0,sourceY:r=0,sourceAttachment:s=0}=t||{},{target:n=null,sourceWidth:o,sourceHeight:a,sourceDepth:l,sourceFormat:h,sourceType:u}=t||{},{framebuffer:c,deleteFramebuffer:d}=tr(e),{gl:f,handle:p}=c;o||=c.width,a||=c.height;let g=c.colorAttachments[s]?.texture;if(!g)throw Error(`Invalid framebuffer attachment ${s}`);l=g?.depth||1,h||=g?.glFormat||6408,u||=g?.glType||5121,n=function(e,t,i,r,s,n){if(e)return e;let o=eR[t||=5121];return new(tt.r.getTypedArrayConstructor(o))(r*s*ti(i))}(n,u,h,o,a,0);let m=tt.r.getDataType(n);u=u||ej[m];let _=f.bindFramebuffer(36160,p);return f.readBuffer(36064+s),f.readPixels(i,r,o,a,h,u,n),f.readBuffer(36064),f.bindFramebuffer(36160,_||null),d&&c.destroy(),n}(e,t)}readPixelsToBufferWebGL(e,t){return function(e,t){let{target:i,sourceX:r=0,sourceY:s=0,sourceFormat:n=6408,targetByteOffset:o=0}=t||{},{sourceWidth:a,sourceHeight:l,sourceType:h}=t||{},{framebuffer:u,deleteFramebuffer:c}=tr(e);a=a||u.width,l=l||u.height,h=h||5121;let d=i;if(!d){let e=o+a*l*ti(n)*function(e){switch(e){case 5121:return 1;case 33635:case 32819:case 32820:return 2;case 5126:return 4;default:return 0}}(h);d=u.device.createBuffer({byteLength:e})}let f=e.device.createCommandEncoder();return f.copyTextureToBuffer({sourceTexture:e,width:a,height:l,origin:[r,s],destinationBuffer:d,byteOffset:o}),f.destroy(),c&&u.destroy(),d}(e,t)}setParametersWebGL(e){v(this.gl,e)}getParametersWebGL(e){return b(this.gl,e)}withParametersWebGL(e,t){return eA(this.gl,e,t)}resetWebGL(){s.R.warn("WebGLDevice.resetWebGL is deprecated, use only for debugging")(),v(this.gl,n)}_getDeviceSpecificTextureFormatCapabilities(e){return function(e,t,i){let r=t.create,s=j[t.format];s?.gl===void 0&&(r=!1),s?.x&&(r=r&&!!P(e,s.x,i)),"stencil8"===t.format&&(r=!1);let n=s?.r!==!1&&(s?.r===void 0||z(e,s.r,i)),o=r&&t.render&&n&&function(e,t,i){let r=j[t],s=r?.gl;if(void 0===s||r?.x&&!P(e,r.x,i))return!1;let n=e.getParameter(32873),o=e.getParameter(36006),a=e.createTexture(),l=e.createFramebuffer();if(!a||!l)return!1;let h=Number(0),u=Number(e.getError());for(;u!==h;)u=e.getError();let c=!1;try{if(e.bindTexture(3553,a),e.texStorage2D(3553,1,s,1,1),Number(e.getError())!==h)return!1;e.bindFramebuffer(36160,l),e.framebufferTexture2D(36160,36064,3553,a,0),c=Number(e.checkFramebufferStatus(36160))===Number(36053)&&Number(e.getError())===h}finally{e.bindFramebuffer(36160,o),e.deleteFramebuffer(l),e.bindTexture(3553,n),e.deleteTexture(a)}return c}(e,t.format,i);
806return{format:t.format,create:r&&t.create,render:o,filter:r&&t.filter,blend:r&&t.blend,store:r&&t.store}}(this.gl,e,this.extensions)}loseDevice(){let e=!1,t=this.getExtension("WEBGL_lose_context").WEBGL_lose_context;return t&&(e=!0,t.loseContext()),this._resolveContextLost?.({reason:"destroyed",message:"Application triggered context loss"}),e}pushState(){x.get(this.gl).push()}popState(){x.get(this.gl).pop()}getGLKey(e,t){let i=Number(e);for(let e in this.gl)if(this.gl[e]===i)return`GL.${e}`;return t?.emptyIfUnknown?"":String(e)}getGLKeys(e){let t={emptyIfUnknown:!0};return Object.entries(e).reduce((e,[i,r])=>(e[`${i}:${this.getGLKey(i,t)}`]=`${r}:${this.getGLKey(r,t)}`,e),{})}setConstantAttributeWebGL(e,t){let i=this.limits.maxVertexAttributes;this._constants=this._constants||Array(i).fill(null);let r=this._constants[e];switch(r&&function(e,t){if(!e||!t||e.length!==t.length||e.constructor!==t.constructor)return!1;for(let i=0;i<e.length;++i)if(e[i]!==t[i])return!1;return!0}(r,t)&&s.R.info(1,`setConstantAttributeWebGL(${e}) could have been skipped, value unchanged`)(),this._constants[e]=t,t.constructor){case Float32Array:var n,o,a,l,h,u,c=this,d=e,f=t;switch(f.length){case 1:c.gl.vertexAttrib1fv(d,f);break;case 2:c.gl.vertexAttrib2fv(d,f);break;case 3:c.gl.vertexAttrib3fv(d,f);break;case 4:c.gl.vertexAttrib4fv(d,f)}break;case Int32Array:n=this,o=e,a=t,n.gl.vertexAttribI4iv(o,a);break;case Uint32Array:l=this,h=e,u=t,l.gl.vertexAttribI4uiv(h,u);break;default:throw Error("constant")}}getExtension(e){return P(this.gl,e,this.extensions),this.extensions}_setWebGLDebugMetadata(e,t,i){e.luma=t,e.__SPECTOR_Metadata={props:i.spector,id:i.spector.id}}}},77797:(e,t,i)=>{"use strict";i.d(t,{E:()=>n});var r=i(29642);class s{getVertexFormatInfo(e){let t;e.endsWith("-webgl")&&(e.replace("-webgl",""),t=!0);let[i,s]=e.split("x"),n=s?parseInt(s):1,o=r.r.getDataTypeInfo(i),a={type:i,components:n,byteLength:o.byteLength*n,integer:o.integer,signed:o.signed,normalized:o.normalized};return t&&(a.webglOnly=!0),a}makeVertexFormat(e,t,i){let s=i?r.r.getNormalizedDataType(e):e;switch(s){case"unorm8":if(1===t)return"unorm8";if(3===t)return"unorm8x3-webgl";return`${s}x${t}`;case"snorm8":if(1===t)return"snorm8";if(3===t)return"snorm8x3-webgl";return`${s}x${t}`;case"uint8":case"sint8":case"float16":if(1===t||3===t)throw Error(`size: ${t}`);return`${s}x${t}`;case"uint16":if(1===t)return"uint16";if(3===t)return"uint16x3-webgl";return`${s}x${t}`;case"sint16":if(1===t)return"sint16";if(3===t)return"sint16x3-webgl";return`${s}x${t}`;case"unorm16":if(1===t)return"unorm16";if(3===t)return"unorm16x3-webgl";return`${s}x${t}`;case"snorm16":if(1===t)return"snorm16";if(3===t)return"snorm16x3-webgl";return`${s}x${t}`;default:return 1===t?s:`${s}x${t}`}}getVertexFormatFromAttribute(e,t,i){if(!t||t>4)throw Error(`size ${t}`);let s=r.r.getDataType(e);return this.makeVertexFormat(s,t,i)}getCompatibleVertexFormat(e){let t;switch(e.primitiveType){case"f32":t="float32";break;case"i32":t="sint32";break;case"u32":t="uint32";break;case"f16":return e.components<=2?"float16x2":"float16x4"}return 1===e.components?t:`${t}x${e.components}`}}let n=new s},79549:(e,t,i)=>{"use strict";i.d(t,{LB:()=>f,aY:()=>m,ow:()=>g});var r=i(74073),s=i(92577),n=i(27645),o=i(67238);let a=[0,0,0,0],l=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0],h=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],u=[0,0,0],c=[0,0,0],d={default:-1,cartesian:0,lnglat:1,"meter-offsets":2,"lnglat-offsets":3};function f(e){let t=d[e];if(void 0===t)throw Error(`Invalid coordinateSystem: ${e}`);return t}let p=(0,o.A)(function({viewport:e,devicePixelRatio:t,coordinateSystem:i,coordinateOrigin:n}){let{projectionCenter:o,viewProjectionMatrix:c,originCommon:d,cameraPosCommon:p,shaderCoordinateOrigin:m,geospatialOrigin:_}=function(e,t,i){let{viewMatrixUncentered:n,projectionMatrix:o}=e,{viewMatrix:h,viewProjectionMatrix:u}=e,c=a,d=a,f=e.cameraPosition,{geospatialOrigin:p,shaderCoordinateOrigin:m,offsetMode:_}=g(e,t,i);return _&&(d=e.projectPosition(p||m),f=[f[0]-d[0],f[1]-d[1],f[2]-d[2]],d[3]=1,c=r.Z0([],d,u),h=n||h,u=s.lw([],o,h),u=s.lw([],u,l)),{viewMatrix:h,viewProjectionMatrix:u,projectionCenter:c,originCommon:d,cameraPosCommon:f,shaderCoordinateOrigin:m,geospatialOrigin:p}}(e,i,n),y=e.getDistanceScales(),v=[e.width*t,e.height*t],b=r.Z0([],[0,0,-e.focalDistance,1],e.projectionMatrix)[3]||1,E={coordinateSystem:f(i),projectionMode:e.projectionMode,coordinateOrigin:m,commonOrigin:d.slice(0,3),center:o,pseudoMeters:!!e._pseudoMeters,viewportSize:v,devicePixelRatio:t,focalDistance:b,commonUnitsPerMeter:y.unitsPerMeter,commonUnitsPerWorldUnit:y.unitsPerMeter,commonUnitsPerWorldUnit2:u,scale:e.scale,wrapLongitude:!1,viewProjectionMatrix:c,modelMatrix:h,cameraPosition:p};if(_){let t=e.getDistanceScales(_);switch(i){case"meter-offsets":E.commonUnitsPerWorldUnit=t.unitsPerMeter,E.commonUnitsPerWorldUnit2=t.unitsPerMeter2;break;case"lnglat":case"lnglat-offsets":e._pseudoMeters||(E.commonUnitsPerMeter=t.unitsPerMeter),E.c
806ommonUnitsPerWorldUnit=t.unitsPerDegree,E.commonUnitsPerWorldUnit2=t.unitsPerDegree2;break;case"cartesian":E.commonUnitsPerWorldUnit=[1,1,t.unitsPerMeter[2]],E.commonUnitsPerWorldUnit2=[0,0,t.unitsPerMeter2[2]]}}return E});function g(e,t,i=c){let r;i.length<3&&(i=[i[0],i[1],0]);let s=i,o=!0;switch(r="lnglat-offsets"===t||"meter-offsets"===t?i:e.isGeospatial?[Math.fround(e.longitude),Math.fround(e.latitude),0]:null,e.projectionMode){case n.Kx.WEB_MERCATOR:("lnglat"===t||"cartesian"===t)&&(r=[0,0,0],o=!1);break;case n.Kx.WEB_MERCATOR_AUTO_OFFSET:"lnglat"===t?s=r:"cartesian"===t&&(s=[Math.fround(e.center[0]),Math.fround(e.center[1]),0],r=e.unprojectPosition(s),s[0]-=i[0],s[1]-=i[1],s[2]-=i[2]);break;case n.Kx.IDENTITY:(s=e.position.map(Math.fround))[2]=s[2]||0;break;case n.Kx.GLOBE:o=!1,r=null;break;default:o=!1}return{geospatialOrigin:r,shaderCoordinateOrigin:s,offsetMode:o}}function m({viewport:e,devicePixelRatio:t=1,modelMatrix:i=null,coordinateSystem:r="default",coordinateOrigin:s=c,autoWrapLongitude:n=!1}){"default"===r&&(r=e.isGeospatial?"lnglat":"cartesian");let o=p({viewport:e,devicePixelRatio:t,coordinateSystem:r,coordinateOrigin:s});return o.wrapLongitude=n,o.modelMatrix=i||h,o}},79565:(e,t,i)=>{"use strict";i.d(t,{A:()=>eU});var r=i(69804),s=i(77541),n=i(47941),o=i(29642);let a=o.r.getDataType.bind(o.r);function l(e,t,i){if(t.size>4)return null;let r="webgpu"===i&&"uint8"===t.type?"unorm8":t.type;return{attribute:e,format:t.size>1?`${r}x${t.size}`:t.type,byteOffset:t.offset||0}}function h(e){return e.stride||e.size*e.bytesPerElement}var u=i(94996),c=i(62768),d=i(43280);function f(e,t){t.offset&&d.A.removed("shaderAttribute.offset","vertexOffset, elementOffset")();let i=h(e),r=(void 0!==t.vertexOffset?t.vertexOffset:e.vertexOffset||0)*i+(t.elementOffset||0)*e.bytesPerElement+(e.offset||0);return{...t,offset:r,stride:i}}class p{constructor(e,t,i){let r;this._buffer=null,this.device=e,this.id=t.id||"",this.size=t.size||1;let s=t.logicalType||t.type,o="float64"===s,{defaultValue:a}=t;a=Number.isFinite(a)?[a]:a||Array(this.size).fill(0),r=o?"float32":!s&&t.isIndexed?"uint32":s||"float32";let l=function(e){switch(e){case"float64":return Float64Array;case"uint8":case"unorm8":return Uint8ClampedArray;default:return(0,n.Ak)(e)}}(s||r);this.doublePrecision=o,o&&!1===t.fp64&&(l=Float32Array),this.value=null,this.settings={...t,defaultType:l,defaultValue:a,logicalType:s,type:r,normalized:r.includes("norm"),size:this.size,bytesPerElement:l.BYTES_PER_ELEMENT},this.state={...i,externalBuffer:null,bufferAccessor:this.settings,allocatedValue:null,numInstances:0,bounds:null,constant:!1}}get isConstant(){return this.state.constant}get buffer(){return this._buffer}get byteOffset(){let e=this.getAccessor();return e.vertexOffset?e.vertexOffset*h(e):0}get numInstances(){return this.state.numInstances}set numInstances(e){this.state.numInstances=e}delete(){this._buffer&&(this._buffer.delete(),this._buffer=null),u.A.release(this.state.allocatedValue)}getBuffer(){return this.state.constant?null:this.state.externalBuffer||this._buffer}getValue(e=this.id,t=null){let i={};if(this.state.constant){let r=this.value;if(t){let s=f(this.getAccessor(),t),n=s.offset/r.BYTES_PER_ELEMENT,o=s.size||this.size;i[e]=r.subarray(n,n+o)}else i[e]=r}else i[e]=this.getBuffer();return this.doublePrecision&&(this.value instanceof Float64Array?i[`${e}64Low`]=i[e]:i[`${e}64Low`]=new Float32Array(this.size)),i}_getBufferLayout(e=this.id,t=null){let i=this.getAccessor(),r=[],s={name:this.id,byteStride:h(i)};if(this.doublePrecision){let s=function(e,t){let i=f(e,t);return{high:i,low:{...i,offset:i.offset+4*e.size}}}(i,t||{});r.push(l(e,{...i,...s.high},this.device.type),l(`${e}64Low`,{...i,...s.low},this.device.type))}else if(t){let s=f(i,t);r.push(l(e,{...i,...s},this.device.type))}else r.push(l(e,i,this.device.type));return s.attributes=r.filter(Boolean),s}setAccessor(e){this.state.bufferAccessor=e}getAccessor(){return this.state.bufferAccessor}getBounds(){if(this.state.bounds)return this.state.bounds;let e=null;if(this.state.constant&&this.value){let t=Array.from(this.value);e=[t,t]}else{let{value:t,numInstances:i,size:r}=this,s=i*r;if(t&&s&&t.length>=s){let i=Array(r).fill(1/0),n=Array(r).fill(-1/0);for(let e=0;e<s;)for(let s=0;s<r;s++){let r=t[e++];r<i[s]&&(i[s]=r),r>n[s]&&(n[s]=r)}e=[i,n]}}return this.state.bounds=e,e}setData(e){let t,{state:i}=this;t=ArrayBuffer.isView(e)?{value:e}:e instanceof r.h?{buffer:e}:e;let s={...this.settings,...t};if(ArrayBuffer.isView(t.value)){if(!t.type)if(this.doublePrecision&&t.value instanceof Float64Array)s.type="float32";else{let e=a(t.value);s.type=s.normalized?e.replace("int","norm"):e}s.bytesPerElement=t.value.BYTES_PER_ELEMENT,s.stride=h(s)}if(i.bounds=null,t.constant){let e=t.value;if(e=this._normalizeValue(e,[],0),this.settings.normalized&&(e=this.normalizeConstant(e)),!(!i.
806constant||!this._areValuesEqual(e,this.value)))return!1;i.externalBuffer=null,i.constant=!0,this.value=ArrayBuffer.isView(e)?e:new Float32Array(e)}else if(t.buffer)i.externalBuffer=t.buffer,i.constant=!1,this.value=t.value||null;else if(t.value){this._checkExternalBuffer(t);let e=t.value;i.externalBuffer=null,i.constant=!1,this.value=e;let{buffer:r}=this,n=h(s),o=(s.vertexOffset||0)*n;if(this.doublePrecision&&e instanceof Float64Array&&(e=(0,c.cT)(e,s)),this.settings.isIndexed){let t=this.settings.defaultType;e.constructor!==t&&(e=new t(e))}let a=e.byteLength+o+2*n;(!r||r.byteLength<a)&&(r=this._createBuffer(a)),r.write(e,o)}return this.setAccessor(s),!0}updateSubBuffer(e={}){this.state.bounds=null;let t=this.value,{startOffset:i=0,endOffset:r}=e;this.buffer.write(this.doublePrecision&&t instanceof Float64Array?(0,c.cT)(t,{size:this.size,startIndex:i,endIndex:r}):t.subarray(i,r),i*t.BYTES_PER_ELEMENT+this.byteOffset)}allocate(e,t=!1){let{state:i}=this,r=i.allocatedValue,s=u.A.allocate(r,e+1,{size:this.size,type:this.settings.defaultType,copy:t});this.value=s;let{byteOffset:n}=this,{buffer:o}=this;return(!o||o.byteLength<s.byteLength+n)&&(o=this._createBuffer(s.byteLength+n),t&&r&&o.write(r instanceof Float64Array?(0,c.cT)(r,this):r,n)),i.allocatedValue=s,i.constant=!1,i.externalBuffer=null,this.setAccessor(this.settings),!0}_checkExternalBuffer(e){let{value:t}=e;if(!ArrayBuffer.isView(t))throw Error(`Attribute ${this.id} value is not TypedArray`);let i=this.settings.defaultType,r=!1;if(this.doublePrecision&&(r=t.BYTES_PER_ELEMENT<4),r)throw Error(`Attribute ${this.id} does not support ${t.constructor.name}`);t instanceof i||!this.settings.normalized||"normalized"in e||d.A.warn(`Attribute ${this.id} is normalized`)()}normalizeConstant(e){switch(this.settings.type){case"snorm8":return new Float32Array(e).map(e=>(e+128)/255*2-1);case"snorm16":return new Float32Array(e).map(e=>(e+32768)/65535*2-1);case"unorm8":return new Float32Array(e).map(e=>e/255);case"unorm16":return new Float32Array(e).map(e=>e/65535);default:return e}}_normalizeValue(e,t,i){let{defaultValue:r,size:s}=this.settings;if(Number.isFinite(e))return t[i]=e,t;if(!e){let e=s;for(;--e>=0;)t[i+e]=r[e];return t}switch(s){case 4:t[i+3]=Number.isFinite(e[3])?e[3]:r[3];case 3:t[i+2]=Number.isFinite(e[2])?e[2]:r[2];case 2:t[i+1]=Number.isFinite(e[1])?e[1]:r[1];case 1:t[i+0]=Number.isFinite(e[0])?e[0]:r[0];break;default:let n=s;for(;--n>=0;)t[i+n]=Number.isFinite(e[n])?e[n]:r[n]}return t}_areValuesEqual(e,t){if(!e||!t)return!1;let{size:i}=this;for(let r=0;r<i;r++)if(e[r]!==t[r])return!1;return!0}_createBuffer(e){this._buffer&&this._buffer.destroy();let{isIndexed:t,type:i}=this.settings;return this._buffer=this.device.createBuffer({...this._buffer?.props,id:this.id,usage:(t?r.h.INDEX:r.h.VERTEX)|r.h.COPY_DST,indexType:t?i:void 0,byteLength:e}),this._buffer}}var g=i(63344),m=i(73452),_=i(7460);let y=[],v=[[0,1/0]],b={interpolation:{duration:0,easing:e=>e},spring:{stiffness:.05,damping:.5}};function E(e,t){if(!e)return null;Number.isFinite(e)&&(e={type:"interpolation",duration:e});let i=e.type||"interpolation";return{...b[i],...t,...e,type:i}}class x extends p{constructor(e,t){super(e,t,{startIndices:null,lastExternalBuffer:null,binaryValue:null,binaryAccessor:null,needsUpdate:!0,needsRedraw:!1,layoutChanged:!1,updateRanges:v}),this.constant=!1,this.settings.update=t.update||(t.accessor?this._autoUpdater:void 0),Object.seal(this.settings),Object.seal(this.state),this._validateAttributeUpdaters()}get startIndices(){return this.state.startIndices}set startIndices(e){this.state.startIndices=e}needsUpdate(){return this.state.needsUpdate}needsRedraw({clearChangedFlags:e=!1}={}){let t=this.state.needsRedraw;return this.state.needsRedraw=t&&!e,t}layoutChanged(){return this.state.layoutChanged}setAccessor(e){var t,i;(t=this.state).layoutChanged||(i=this.getAccessor(),t.layoutChanged=e.type!==i.type||e.size!==i.size||h(e)!==h(i)||(e.offset||0)!==(i.offset||0)),super.setAccessor(e)}getUpdateTriggers(){let{accessor:e}=this.settings;return[this.id].concat("function"!=typeof e&&e||[])}supportsTransition(){return!!this.settings.transition}getTransitionSetting(e){if(!e||!this.supportsTransition())return null;let{accessor:t}=this.settings,i=this.settings.transition;return E(Array.isArray(t)?e[t.find(t=>e[t])]:e[t],i)}setNeedsUpdate(e=this.id,t){if(this.state.needsUpdate=this.state.needsUpdate||e,this.setNeedsRedraw(e),t){let{startRow:e=0,endRow:i=1/0}=t;this.state.updateRanges=function(e,t){if(e===v||(t[0]<0&&(t[0]=0),t[0]>=t[1]))return e;let i=[],r=e.length,s=0;for(let n=0;n<r;n++){let r=e[n];r[1]<t[0]?(i.push(r),s=n+1):r[0]>t[1]?i.push(r):t=[Math.min(r[0],t[0]),Math.max(r[1],t[1])]}return i.splice(s,0,t),i}(this.state.updateRanges,[e,i])}else this.state.updateRanges=v}clearNeedsUpdate(){this.state.needsUpdate=!1,this.state.updateRanges=y}
806setNeedsRedraw(e=this.id){this.state.needsRedraw=this.state.needsRedraw||e}allocate(e){let{state:t,settings:i}=this;return!i.noAlloc&&!!i.update&&(super.allocate(e,t.updateRanges!==v),!0)}updateBuffer({numInstances:e,data:t,props:i,context:r}){if(!this.needsUpdate())return!1;let{state:{updateRanges:s},settings:{update:n,noAlloc:o}}=this,a=!0;if(n){for(let[o,a]of s)n.call(r,this,{data:t,startRow:o,endRow:a,props:i,numInstances:e});if(this.value)if(this.constant||!this.buffer||this.buffer.byteLength<this.value.byteLength+this.byteOffset)this.constant?this.setConstantValue(r,this.value):this.setData({value:this.value,constant:this.constant}),this.constant=!1;else for(let[t,i]of s){let r=Number.isFinite(t)?this.getVertexOffset(t):0,s=Number.isFinite(i)?this.getVertexOffset(i):o||!Number.isFinite(e)?this.value.length:e*this.size;super.updateSubBuffer({startOffset:r,endOffset:s})}this._checkAttributeArray()}else a=!1;return this.clearNeedsUpdate(),this.setNeedsRedraw(),a}setConstantValue(e,t){if(void 0===t||"function"==typeof t)return!1;let i=this.settings.transform&&e?this.settings.transform.call(e,t):t;return"webgpu"===this.device.type?this.setConstantBufferValue(i,this.numInstances):(this.setData({constant:!0,value:i})&&this.setNeedsRedraw(),this.clearNeedsUpdate(),!0)}setConstantBufferValue(e,t){let i=this.settings.defaultType,r=this._normalizeValue(e,new i(this.size),0);if(this._hasConstantBufferValue(r,t))return this.constant=!1,this.clearNeedsUpdate(),!1;let s=new i(Math.max(t,1)*this.size);for(let e=0;e<s.length;e+=this.size)s.set(r,e);let n=this.setData({value:s});return this.constant=!1,this.clearNeedsUpdate(),n&&this.setNeedsRedraw(),n}_hasConstantBufferValue(e,t){let i=this.value,r=Math.max(t,1)*this.size;if(!ArrayBuffer.isView(i)||i.length!==r||i.length%this.size!=0)return!1;for(let t=0;t<i.length;t+=this.size)for(let r=0;r<this.size;r++)if(i[t+r]!==e[r])return!1;return!0}setExternalBuffer(e){let{state:t}=this;return e?(this.clearNeedsUpdate(),t.lastExternalBuffer===e||(t.lastExternalBuffer=e,this.setNeedsRedraw(),this.setData(e),!0)):(t.lastExternalBuffer=null,!1)}setBinaryValue(e,t=null){let{state:i,settings:r}=this;if(!e)return i.binaryValue=null,i.binaryAccessor=null,!1;if(r.noAlloc)return!1;if(i.binaryValue===e)return this.clearNeedsUpdate(),!0;if(i.binaryValue=e,this.setNeedsRedraw(),r.transform||t!==this.startIndices){ArrayBuffer.isView(e)&&(e={value:e});let s=e;(0,g.A)(ArrayBuffer.isView(s.value),`invalid ${r.accessor}`);let n=!!s.size&&s.size!==this.size;return i.binaryAccessor=(0,m.I)(s.value,{size:s.size||this.size,stride:s.stride,offset:s.offset,startIndices:t,nested:n}),!1}return this.clearNeedsUpdate(),this.setData(e),!0}getVertexOffset(e){let{startIndices:t}=this;return(t?e<t.length?t[e]:this.numInstances:e)*this.size}getValue(){let e=this.settings.shaderAttributes,t=super.getValue();if(!e)return t;for(let i in e)Object.assign(t,super.getValue(i,e[i]));return t}getBufferLayout(e){this.state.layoutChanged=!1;let t=this.settings.shaderAttributes,i=super._getBufferLayout(),{stepMode:r}=this.settings;if("dynamic"===r?i.stepMode=e?e.isInstanced?"instance":"vertex":"instance":i.stepMode=r??"vertex",!t)return i;for(let e in t){let r=super._getBufferLayout(e,t[e]);i.attributes.push(...r.attributes)}return i}_autoUpdater(e,{data:t,startRow:i,endRow:r,props:s,numInstances:n}){let{settings:o,state:a,value:l,size:h,startIndices:u}=e,{accessor:c,transform:d}=o,f=a.binaryAccessor||("function"==typeof c?c:s[c]);(0,g.A)("function"==typeof f,`accessor "${c}" is not a function`);let p=e.getVertexOffset(i),{iterable:y,objectInfo:v}=(0,m.X)(t,i,r);for(let t of y){v.index++;let i=f(t,v);if(d&&(i=d.call(this,i)),u){let t=(v.index<u.length-1?u[v.index+1]:n)-u[v.index];if(i&&Array.isArray(i[0])){let t=p;for(let r of i)e._normalizeValue(r,l,t),t+=h}else i&&i.length>h?l.set(i,p):(e._normalizeValue(i,v.target,0),(0,_.R)({target:l,source:v.target,start:p,count:t}));p+=t*h}else e._normalizeValue(i,l,p),p+=h}}_validateAttributeUpdaters(){let{settings:e}=this;if(!(e.noAlloc||"function"==typeof e.update))throw Error(`Attribute ${this.id} missing update or accessor`)}_checkAttributeArray(){let{value:e}=this,t=Math.min(4,this.size);if(e&&e.length>=t){let i=!0;switch(t){case 4:i=i&&Number.isFinite(e[3]);case 3:i=i&&Number.isFinite(e[2]);case 2:i=i&&Number.isFinite(e[1]);case 1:i=i&&Number.isFinite(e[0]);break;default:i=!1}if(!i)throw Error(`Illegal attribute generated for ${this.id}`)}}}var w=i(67238),S=i(40712);let P=`\ 807out vec4 transform_output; 808void main() { 809 transform_output = vec4(0); 810}`,T=`#version 300 es 811${P}`;var A=i(60875);class M{device;model;transformFeedback;static defaultProps={...A.K.defaultProps,outputs:void 0,feedbackBuffers:void 0};static isSupported(e){return e?.info?.type==="webgl"}constructor(e,t=M.defaultProps){if(!M.isSupported(e))throw Error("BufferTransform not yet implemented on WebGPU");this.device=e,this.model=new A.K(this.device,{id:t.id||"buffer-transform-model",fs:t.fs||function(e){let{input
811:t,inputChannels:i,output:r}={};if(!t)return T;if(!i)throw Error("inputChannels");let s=function(e){switch(e){case 1:return"float";case 2:return"vec2";case 3:return"vec3";case 4:return"vec4";default:throw Error(`invalid channels: ${e}`)}}(i),n=function(e,t){switch(t){case 1:return`vec4(${e}, 0.0, 0.0, 1.0)`;case 2:return`vec4(${e}, 0.0, 1.0)`;case 3:return`vec4(${e}, 1.0)`;case 4:return e;default:throw Error(`invalid channels: ${t}`)}}(t,i);return`\ 812#version 300 es 813in ${s} ${t}; 814out vec4 ${r}; 815void main() { 816 ${r} = ${n}; 817}`}(),topology:t.topology||"point-list",varyings:t.outputs||t.varyings,...t}),this.transformFeedback=this.device.createTransformFeedback({layout:this.model.pipeline.shaderLayout,buffers:t.feedbackBuffers}),this.model.setTransformFeedback(this.transformFeedback),Object.seal(this)}destroy(){this.model&&this.model.destroy()}delete(){this.destroy()}run(e){e?.inputBuffers&&this.model.setAttributes(e.inputBuffers),e?.outputBuffers&&this.transformFeedback.setBuffers(e.outputBuffers);let t=this.device.beginRenderPass(e);this.model.draw(t),t.end()}getBuffer(e){return this.transformFeedback.getBuffer(e)}readAsync(e){let t=this.getBuffer(e);if(!t)throw Error("BufferTransform#getBuffer");if(t instanceof r.h)return t.readAsync();let{buffer:i,byteOffset:s=0,byteLength:n=i.byteLength}=t;return i.readAsync(s,n)}}function C(e,t=[],i=0){let r=Math.fround(e),s=e-r;return t[i]=r,t[i+1]=s,t}let R=`\ 818 819layout(std140) uniform fp64arithmeticUniforms { 820 uniform float ONE; 821 uniform float SPLIT; 822} fp64; 823 824/* 825About LUMA_FP64_CODE_ELIMINATION_WORKAROUND 826 827The purpose of this workaround is to prevent shader compilers from 828optimizing away necessary arithmetic operations by swapping their sequences 829or transform the equation to some 'equivalent' form. 830 831These helpers implement Dekker/Veltkamp-style error tracking. If the compiler 832folds constants or reassociates the arithmetic, the high/low split can stop 833tracking the rounding error correctly. That failure mode tends to look fine in 834simple coordinate setup, but then breaks down inside iterative arithmetic such 835as fp64 Mandelbrot loops. 836 837The method is to multiply an artifical variable, ONE, which will be known to 838the compiler to be 1 only at runtime. The whole expression is then represented 839as a polynomial with respective to ONE. In the coefficients of all terms, only one a 840and one b should appear 841 842err = (a + b) * ONE^6 - a * ONE^5 - (a + b) * ONE^4 + a * ONE^3 - b - (a + b) * ONE^2 + a * ONE 843*/ 844 845float prevent_fp64_optimization(float value) { 846#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) 847 return value + fp64.ONE * 0.0; 848#else 849 return value; 850#endif 851} 852 853// Divide float number to high and low floats to extend fraction bits 854vec2 split(float a) { 855 // Keep SPLIT as a runtime uniform so the compiler cannot fold the Dekker 856 // split into a constant expression and reassociate the recovery steps. 857 float split = prevent_fp64_optimization(fp64.SPLIT); 858 float t = prevent_fp64_optimization(a * split); 859 float temp = t - a; 860 float a_hi = t - temp; 861 float a_lo = a - a_hi; 862 return vec2(a_hi, a_lo); 863} 864 865// Divide float number again when high float uses too many fraction bits 866vec2 split2(vec2 a) { 867 vec2 b = split(a.x); 868 b.y += a.y; 869 return b; 870} 871 872// Special sum operation when a > b 873vec2 quickTwoSum(float a, float b) { 874#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) 875 float sum = (a + b) * fp64.ONE; 876 float err = b - (sum - a) * fp64.ONE; 877#else 878 float sum = a + b; 879 float err = b - (sum - a); 880#endif 881 return vec2(sum, err); 882} 883 884// General sum operation 885vec2 twoSum(float a, float b) { 886 float s = (a + b); 887#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) 888 float v = (s * fp64.ONE - a) * fp64.ONE; 889 float err = (a - (s - v) * fp64.ONE) * fp64.ONE * fp64.ONE * fp64.ONE + (b - v); 890#else 891 float v = s - a; 892 float err = (a - (s - v)) + (b - v); 893#endif 894 return vec2(s, err); 895} 896 897vec2 twoSub(float a, float b) { 898 float s = (a - b); 899#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) 900 float v = (s * fp64.ONE - a) * fp64.ONE; 901 float err = (a - (s - v) * fp64.ONE) * fp64.ONE * fp64.ONE * fp64.ONE - (b + v); 902#else 903 float v = s - a; 904 float err = (a - (s - v)) - (b + v); 905#endif 906 return vec2(s, err); 907} 908 909vec2 twoSqr(float a) { 910 float prod = a * a; 911 vec2 a_fp64 = split(a); 912#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) 913 float err = ((a_fp64.x * a_fp64.x - prod) * fp64.ONE + 2.0 * a_fp64.x * 914 a_fp64.y * fp64.ONE * fp64.ONE) + a_fp64.y * a_fp64.y * fp64.ONE * fp64.ONE * fp64.ONE; 915#else 916 float err = ((a_fp64.x * a_fp64.x - prod) + 2.0 * a_fp64.x * a_fp64.y) + a_fp64.y * a_fp64.y; 917#endif 918 return vec2(prod, err); 919} 920 921vec2 twoProd(float a, float b) { 922 float prod = a * b; 923 vec2 a_fp64 = split(a); 924 vec2 b_fp64 = split(b); 925 // twoProd is especially sensitive because mul_fp64 and div_fp64 both depend 926 // on the split terms and cross terms staying in the original evaluation 927 // order. If the compiler folds or reassociates them, the low part tends to 928 // collapse to zero or NaN on some drivers. 929 float highProduct = prevent_fp64_optimization(a_fp64.x * b_fp64.x); 930 float crossProduct1 = prevent_fp64_optimization(a_fp64.x * b_fp64.y); 931 float crossProduct2 = prevent_fp64_optimization(a_fp64.y * b_fp64.x); 932 float lowProduct = prevent_fp64_optimization(a_fp64.y * b_fp64.y); 933#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) 934 float err1 = (highProduct - prod) * fp64.ONE; 935 float err2 = crossProduct1 * fp64.ONE * fp64.ONE; 936 float err3 = crossProduct2 * fp64.ONE * fp64.ONE * fp64.ONE; 937 float err4 = lowProduct * fp64.ONE * fp64.ONE * fp64.ONE * fp64.ONE; 938#else 939 float err1 = highProduct - prod; 940 float err2 = crossProduct1; 941 float err3 = crossProduct2; 942 float err4 = lowProduct; 943#endif 944 float err = ((err1 + err2) + err3) + err4; 945 return vec2(prod, err); 946} 947 948vec2 sum_fp64(vec2 a, vec2 b) { 949 vec2 s, t;
950 s = twoSum(a.x, b.x); 951 t = twoSum(a.y, b.y); 952 s.y += t.x; 953 s = quickTwoSum(s.x, s.y); 954 s.y += t.y; 955 s = quickTwoSum(s.x, s.y); 956 return s; 957} 958 959vec2 sub_fp64(vec2 a, vec2 b) { 960 vec2 s, t; 961 s = twoSub(a.x, b.x); 962 t = twoSub(a.y, b.y); 963 s.y += t.x; 964 s = quickTwoSum(s.x, s.y); 965 s.y += t.y; 966 s = quickTwoSum(s.x, s.y); 967 return s; 968} 969 970vec2 mul_fp64(vec2 a, vec2 b) { 971 vec2 prod = twoProd(a.x, b.x); 972 // y component is for the error 973 prod.y += a.x * b.y; 974#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND) 975 prod = split2(prod); 976#endif 977 prod = quickTwoSum(prod.x, prod.y); 978 prod.y += a.y * b.x; 979#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND) 980 prod = split2(prod); 981#endif 982 prod = quickTwoSum(prod.x, prod.y); 983 return prod; 984} 985 986vec2 div_fp64(vec2 a, vec2 b) { 987 float xn = 1.0 / b.x; 988#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND) 989 vec2 yn = mul_fp64(a, vec2(xn, 0)); 990#else 991 vec2 yn = a * xn; 992#endif 993 float diff = (sub_fp64(a, mul_fp64(b, yn))).x; 994 vec2 prod = twoProd(xn, diff); 995 return sum_fp64(yn, prod); 996} 997 998vec2 sqrt_fp64(vec2 a) { 999 if (a.x == 0.0 && a.y == 0.0) return vec2(0.0, 0.0); 1000 if (a.x < 0.0) return vec2(0.0 / 0.0, 0.0 / 0.0); 1001 1002 float x = 1.0 / sqrt(a.x); 1003 float yn = a.x * x; 1004#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) 1005 vec2 yn_sqr = twoSqr(yn) * fp64.ONE; 1006#else 1007 vec2 yn_sqr = twoSqr(yn); 1008#endif 1009 float diff = sub_fp64(a, yn_sqr).x; 1010 vec2 prod = twoProd(x * 0.5, diff); 1011#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND) 1012 return sum_fp64(split(yn), prod); 1013#else 1014 return sum_fp64(vec2(yn, 0.0), prod); 1015#endif 1016} 1017`,L={name:"fp64arithmetic",source:`\ 1018struct Fp64ArithmeticUniforms { 1019 ONE: f32, 1020 SPLIT: f32, 1021}; 1022 1023@group(0) @binding(auto) var<uniform> fp64arithmetic : Fp64ArithmeticUniforms; 1024 1025fn fp64_nan(seed: f32) -> f32 { 1026 let nanBits = 0x7fc00000u | select(0u, 1u, seed < 0.0); 1027 return bitcast<f32>(nanBits); 1028} 1029 1030fn fp64_runtime_zero() -> f32 { 1031 return fp64arithmetic.ONE * 0.0; 1032} 1033 1034fn prevent_fp64_optimization(value: f32) -> f32 { 1035#ifdef LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1036 return value + fp64_runtime_zero(); 1037#else 1038 return value; 1039#endif 1040} 1041 1042fn split(a: f32) -> vec2f { 1043 let splitValue = prevent_fp64_optimization(fp64arithmetic.SPLIT + fp64_runtime_zero()); 1044 let t = prevent_fp64_optimization(a * splitValue); 1045 let temp = prevent_fp64_optimization(t - a); 1046 let aHi = prevent_fp64_optimization(t - temp); 1047 let aLo = prevent_fp64_optimization(a - aHi); 1048 return vec2f(aHi, aLo); 1049} 1050 1051fn split2(a: vec2f) -> vec2f { 1052 var b = split(a.x); 1053 b.y = b.y + a.y; 1054 return b; 1055} 1056 1057fn quickTwoSum(a: f32, b: f32) -> vec2f { 1058#ifdef LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1059 let sum = prevent_fp64_optimization((a + b) * fp64arithmetic.ONE); 1060 let err = prevent_fp64_optimization(b - (sum - a) * fp64arithmetic.ONE); 1061#else 1062 let sum = prevent_fp64_optimization(a + b); 1063 let err = prevent_fp64_optimization(b - (sum - a)); 1064#endif 1065 return vec2f(sum, err); 1066} 1067 1068fn twoSum(a: f32, b: f32) -> vec2f { 1069 let s = prevent_fp64_optimization(a + b); 1070#ifdef LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1071 let v = prevent_fp64_optimization((s * fp64arithmetic.ONE - a) * fp64arithmetic.ONE); 1072 let err = 1073 prevent_fp64_optimization((a - (s - v) * fp64arithmetic.ONE) * 1074 fp64arithmetic.ONE * 1075 fp64arithmetic.ONE * 1076 fp64arithmetic.ONE) + 1077 prevent_fp64_optimization(b - v); 1078#else 1079 let v = prevent_fp64_optimization(s - a); 1080 let err = prevent_fp64_optimization(a - (s - v)) + prevent_fp64_optimization(b - v); 1081#endif 1082 return vec2f(s, err); 1083} 1084 1085fn twoSub(a: f32, b: f32) -> vec2f { 1086 let s = prevent_fp64_optimization(a - b); 1087#ifdef LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1088 let v = prevent_fp64_optimization((s * fp64arithmetic.ONE - a) * fp64arithmetic.ONE); 1089 let err = 1090 prevent_fp64_optimization((a - (s - v) * fp64arithmetic.ONE) * 1091 fp64arithmetic.ONE * 1092 fp64arithmetic.ONE * 1093 fp64arithmetic.ONE) - 1094 prevent_fp64_optimization(b + v); 1095#else 1096 let v = prevent_fp64_optimization(s - a); 1097 let err = prevent_fp64_optimization(a - (s - v)) - prevent_fp64_optimization(b + v); 1098#endif 1099 return vec2f(s, err); 1100} 1101 1102fn twoSqr(a: f32) -> vec2f { 1103 let prod = prevent_fp64_optimization(a * a); 1104 let aFp64 = split(a); 1105 let highProduct = prevent_fp64_optimization(aFp64.x * aFp64.x); 1106 let crossProduct = prevent_fp64_optimization(2.0 * aFp64.x * aFp64.y); 1107 let lowProduct = prevent_fp64_optimization(aFp64.y * aFp64.y); 1108#ifdef LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1109 let err = 1110 (prevent_fp64_optimization(highProduct - prod) * fp64arithmetic.ONE + 1111 crossProduct * fp64arithmetic.ONE * fp64arithmetic.ONE) + 1112 lowProduct * fp64arithmetic.ONE * fp64arithmetic.ONE * fp64arithmetic.ONE; 1113#else 1114 let err = ((prevent_fp64_optimization(highProduct - prod) + crossProduct) + lowProduct); 1115#endif 1116 return vec2f(prod, err); 1117} 1118 1119fn twoProd(a: f32, b: f32) -> vec2f { 1120 let prod = prevent_fp64_optimization(a * b); 1121 let aFp64 = split(a); 1122 let bFp64 = split(b); 1123 let highProduct = prevent_fp64_optimization(aFp64.x * bFp64.x); 1124 let crossProduct1 = prevent_fp64_optimization(aFp64.x * bFp64.y
1124); 1125 let crossProduct2 = prevent_fp64_optimization(aFp64.y * bFp64.x); 1126 let lowProduct = prevent_fp64_optimization(aFp64.y * bFp64.y); 1127#ifdef LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1128 let err1 = (highProduct - prod) * fp64arithmetic.ONE; 1129 let err2 = crossProduct1 * fp64arithmetic.ONE * fp64arithmetic.ONE; 1130 let err3 = crossProduct2 * fp64arithmetic.ONE * fp64arithmetic.ONE * fp64arithmetic.ONE; 1131 let err4 = 1132 lowProduct * 1133 fp64arithmetic.ONE * 1134 fp64arithmetic.ONE * 1135 fp64arithmetic.ONE * 1136 fp64arithmetic.ONE; 1137#else 1138 let err1 = highProduct - prod; 1139 let err2 = crossProduct1; 1140 let err3 = crossProduct2; 1141 let err4 = lowProduct; 1142#endif 1143 let err12InputA = prevent_fp64_optimization(err1); 1144 let err12InputB = prevent_fp64_optimization(err2); 1145 let err12 = prevent_fp64_optimization(err12InputA + err12InputB); 1146 let err123InputA = prevent_fp64_optimization(err12); 1147 let err123InputB = prevent_fp64_optimization(err3); 1148 let err123 = prevent_fp64_optimization(err123InputA + err123InputB); 1149 let err1234InputA = prevent_fp64_optimization(err123); 1150 let err1234InputB = prevent_fp64_optimization(err4); 1151 let err = prevent_fp64_optimization(err1234InputA + err1234InputB); 1152 return vec2f(prod, err); 1153} 1154 1155fn sum_fp64(a: vec2f, b: vec2f) -> vec2f { 1156 var s = twoSum(a.x, b.x); 1157 let t = twoSum(a.y, b.y); 1158 s.y = prevent_fp64_optimization(s.y + t.x); 1159 s = quickTwoSum(s.x, s.y); 1160 s.y = prevent_fp64_optimization(s.y + t.y); 1161 s = quickTwoSum(s.x, s.y); 1162 return s; 1163} 1164 1165fn sub_fp64(a: vec2f, b: vec2f) -> vec2f { 1166 var s = twoSub(a.x, b.x); 1167 let t = twoSub(a.y, b.y); 1168 s.y = prevent_fp64_optimization(s.y + t.x); 1169 s = quickTwoSum(s.x, s.y); 1170 s.y = prevent_fp64_optimization(s.y + t.y); 1171 s = quickTwoSum(s.x, s.y); 1172 return s; 1173} 1174 1175fn mul_fp64(a: vec2f, b: vec2f) -> vec2f { 1176 var prod = twoProd(a.x, b.x); 1177 let crossProduct1 = prevent_fp64_optimization(a.x * b.y); 1178 prod.y = prevent_fp64_optimization(prod.y + crossProduct1); 1179#ifdef LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1180 prod = split2(prod); 1181#endif 1182 prod = quickTwoSum(prod.x, prod.y); 1183 let crossProduct2 = prevent_fp64_optimization(a.y * b.x); 1184 prod.y = prevent_fp64_optimization(prod.y + crossProduct2); 1185#ifdef LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1186 prod = split2(prod); 1187#endif 1188 prod = quickTwoSum(prod.x, prod.y); 1189 return prod; 1190} 1191 1192fn div_fp64(a: vec2f, b: vec2f) -> vec2f { 1193 let xn = prevent_fp64_optimization(1.0 / b.x); 1194 let yn = mul_fp64(a, vec2f(xn, fp64_runtime_zero())); 1195 let diff = prevent_fp64_optimization(sub_fp64(a, mul_fp64(b, yn)).x); 1196 let prod = twoProd(xn, diff); 1197 return sum_fp64(yn, prod); 1198} 1199 1200fn sqrt_fp64(a: vec2f) -> vec2f { 1201 if (a.x == 0.0 && a.y == 0.0) { 1202 return vec2f(0.0, 0.0); 1203 } 1204 if (a.x < 0.0) { 1205 let nanValue = fp64_nan(a.x); 1206 return vec2f(nanValue, nanValue); 1207 } 1208 1209 let x = prevent_fp64_optimization(1.0 / sqrt(a.x)); 1210 let yn = prevent_fp64_optimization(a.x * x); 1211#ifdef LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1212 let ynSqr = twoSqr(yn) * fp64arithmetic.ONE; 1213#else 1214 let ynSqr = twoSqr(yn); 1215#endif 1216 let diff = prevent_fp64_optimization(sub_fp64(a, ynSqr).x); 1217 let prod = twoProd(prevent_fp64_optimization(x * 0.5), diff); 1218#ifdef LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1219 return sum_fp64(split(yn), prod); 1220#else 1221 return sum_fp64(vec2f(yn, 0.0), prod); 1222#endif 1223} 1224`,fs:R,vs:R,defaultUniforms:{ONE:1,SPLIT:4097},uniformTypes:{ONE:"f32",SPLIT:"f32"},fp64ify:C,fp64LowPart:function(e){return e-Math.fround(e)},fp64ifyMatrix4:function(e){let t=new Float32Array(32);for(let i=0;i<4;++i)for(let r=0;r<4;++r){let s=4*i+r;C(e[4*r+i],t,2*s)}return t}};function I(e){let{source:t,target:i,start:r=0,size:s,getData:n}=e,o=e.end||i.length,a=t.length,l=o-r;if(a>l)return void i.set(t.subarray(0,l),r);if(i.set(t,r),!n)return;let h=a;for(;h<l;){let e=n(h,t);for(let t=0;t<s;t++)i[r+h]=e[t]||0,h++}}function O(e){switch(e){case 1:return"float";case 2:return"vec2";case 3:return"vec3";case 4:return"vec4";default:throw Error(`No defined attribute type for size "${e}"`)}}function N(e){switch(e){case 1:return"float32";case 2:return"float32x2";case 3:return"float32x3";case 4:return"float32x4";default:throw Error("invalid type size")}}function F(e){e.push(e.shift())}function D({device:e,source:t,target:i}){return(!i||i.byteLength<t.byteLength)&&(i?.destroy(),i=e.createBuffer({byteLength:t.byteLength,usage:t.usage})),i}function B({device:e,buffer:t,attribute:i,fromLength:r,toLength:s,fromStartIndices:n,getData:o=e=>e}){let a=i.doublePrecision&&i.value instanceof Float64Array?2:1,l=i.size*a,h=i.byteOffset,u=i.settings.bytesPerElement<4?h/i.settings.bytesPerElement*4:h,c=i.startIndices,d=n&&c,f=i.isConstant;if(!d&&t&&r>=s)return t;let p=i.value instanceof Float64Array?Float32Array:i.value.constructor,g=f?i.value:new p(i.getBuffer().readSyncWebG
1224L(h,s*p.BYTES_PER_ELEMENT).buffer);if(i.settings.normalized&&!f){let e=o;o=(t,r)=>i.normalizeConstant(e(t,r))}let m=f?(e,t)=>o(g,t):(e,t)=>o(g.subarray(e+h,e+h+l),t),_=new Float32Array(t?t.readSyncWebGL(u,4*r).buffer:0),y=new Float32Array(s);return!function({source:e,target:t,size:i,getData:r,sourceStartIndices:s,targetStartIndices:n}){if(!s||!n)return I({source:e,target:t,size:i,getData:r});let o=0,a=0,l=r&&((e,t)=>r(e+a,t)),h=Math.min(s.length,n.length);for(let r=1;r<h;r++){let h=s[r]*i,u=n[r]*i;I({source:e.subarray(o,h),target:t,start:a,end:u,size:i,getData:l}),o=h,a=u}a<t.length&&I({source:[],target:t,start:a,size:i,getData:l})}({source:_,target:y,sourceStartIndices:n,targetStartIndices:c,size:l,getData:m}),(!t||t.byteLength<y.byteLength+u)&&(t?.destroy(),t=e.createBuffer({byteLength:y.byteLength+u,usage:35050})),t.write(y,u),t}var G=i(33086);class k{constructor({device:e,attribute:t,timeline:i}){this.buffers=[],this.currentLength=0,this.device=e,this.transition=new G.A(i),this.attribute=t,this.attributeInTransition=function(e){let{device:t,settings:i,value:r}=e,s=new x(t,i);return s.setData({value:r instanceof Float64Array?new Float64Array(0):new Float32Array(0),normalized:i.normalized}),s}(t),this.currentStartIndices=t.startIndices}get inProgress(){return this.transition.inProgress}start(e,t,i=1/0){this.settings=e,this.currentStartIndices=this.attribute.startIndices,this.currentLength=function(e,t){let{doublePrecision:i,settings:r,value:s,size:n}=e,o=i&&s instanceof Float64Array?2:1,a=0,{shaderAttributes:l}=e.settings;if(l)for(let e of Object.values(l))a=Math.max(a,e.vertexOffset??0);return(r.noAlloc?s.length:(t+a)*n)*o}(this.attribute,t),this.transition.start({...e,duration:i})}update(){let e=this.transition.update();return e&&this.onUpdate(),e}setBuffer(e){this.attributeInTransition.setData({buffer:e,normalized:this.attribute.settings.normalized,value:this.attributeInTransition.value})}cancel(){this.transition.cancel()}delete(){for(let e of(this.cancel(),this.buffers))e.destroy();this.buffers.length=0}}class U extends k{constructor({device:e,attribute:t,timeline:i}){super({device:e,attribute:t,timeline:i}),this.type="interpolation",this.transform=function(e,t){let i=t.size,r=O(i),s=N(i),n=t.getBufferLayout();return W(t)?new M(e,{vs:V,bufferLayout:[{name:"aFrom",byteStride:8*i,attributes:[{attribute:"aFrom",format:s,byteOffset:0},{attribute:"aFrom64Low",format:s,byteOffset:4*i}]},{name:"aTo",byteStride:8*i,attributes:[{attribute:"aTo",format:s,byteOffset:0},{attribute:"aTo64Low",format:s,byteOffset:4*i}]}],modules:[L,z],defines:{ATTRIBUTE_TYPE:r,ATTRIBUTE_SIZE:i},moduleSettings:{},varyings:["vCurrent","vCurrent64Low"],bufferMode:35980,disableWarnings:!0}):new M(e,{vs:j,bufferLayout:[{name:"aFrom",format:s},{name:"aTo",format:n.attributes[0].format}],modules:[z],defines:{ATTRIBUTE_TYPE:r},varyings:["vCurrent"],disableWarnings:!0})}(e,t)}start(e,t){let i=this.currentLength,r=this.currentStartIndices;if(super.start(e,t,e.duration),e.duration<=0)return void this.transition.cancel();let{buffers:s,attribute:n}=this;F(s),s[0]=B({device:this.device,buffer:s[0],attribute:n,fromLength:i,toLength:this.currentLength,fromStartIndices:r,getData:e.enter}),s[1]=D({device:this.device,source:s[0],target:s[1]}),this.setBuffer(s[1]);let{transform:o}=this,a=o.model,l=Math.floor(this.currentLength/n.size);W(n)&&(l/=2),a.setVertexCount(l),n.isConstant?(a.setAttributes({aFrom:s[0]}),a.setConstantAttributes({aTo:n.value})):a.setAttributes({aFrom:s[0],aTo:n.getBuffer()}),o.transformFeedback.setBuffers({vCurrent:s[1]})}onUpdate(){let{duration:e,easing:t}=this.settings,{time:i}=this.transition,r=i/e;t&&(r=t(r));let{model:s}=this.transform,n={time:r};s.shaderInputs.setProps({interpolation:n}),this.transform.run({discard:!0})}delete(){super.delete(),this.transform.destroy()}}let z={name:"interpolation",vs:`\ 1225layout(std140) uniform interpolationUniforms { 1226 float time; 1227} interpolation; 1228`,uniformTypes:{time:"f32"}},j=`\ 1229#version 300 es 1230#define SHADER_NAME interpolation-transition-vertex-shader 1231 1232in ATTRIBUTE_TYPE aFrom; 1233in ATTRIBUTE_TYPE aTo; 1234out ATTRIBUTE_TYPE vCurrent; 1235 1236void main(void) { 1237 vCurrent = mix(aFrom, aTo, interpolation.time); 1238 gl_Position = vec4(0.0); 1239} 1240`,V=`\ 1241#version 300 es 1242#define SHADER_NAME interpolation-transition-vertex-shader 1243 1244in ATTRIBUTE_TYPE aFrom; 1245in ATTRIBUTE_TYPE aFrom64Low; 1246in ATTRIBUTE_TYPE aTo; 1247in ATTRIBUTE_TYPE aTo64Low; 1248out ATTRIBUTE_TYPE vCurrent; 1249out ATTRIBUTE_TYPE vCurrent64Low; 1250 1251vec2 mix_fp64(vec2 a, vec2 b, float x) { 1252 vec2 range = sub_fp64(b, a); 1253 return sum_fp64(a, mul_fp64(range, vec2(x, 0.0))); 1254} 1255 1256void main(void) { 1257 for (int i=0; i<ATTRIBUTE_SIZE; i++) { 1258 vec2 value = mix_fp64(vec2(aFrom[i], aFrom64Low[i]), vec2(aTo[i], aTo64Low[i]), interpolation.time); 1259 vCurrent[i] = value.x; 1260 vCurrent64Low[i] = value.y; 1261 } 1262 gl_Position = vec4(0.0); 1263} 1264`;function W(e){return e.doublePrecision&&e.value instanceof Float64Array}
1264class $ extends k{constructor({device:e,attribute:t,timeline:i}){var r,s;super({device:e,attribute:t,timeline:i}),this.type="spring",this.texture=e.createTexture({data:new Uint8Array(4),format:"rgba8unorm",width:1,height:1}),this.framebuffer=(r=e,s=this.texture,r.createFramebuffer({id:"spring-transition-is-transitioning-framebuffer",width:1,height:1,colorAttachments:[s]})),this.transform=function(e,t){let i=O(t.size),r=N(t.size);return new M(e,{vs:q,fs:K,bufferLayout:[{name:"aPrev",format:r},{name:"aCur",format:r},{name:"aTo",format:t.getBufferLayout().attributes[0].format}],varyings:["vNext"],modules:[H],defines:{ATTRIBUTE_TYPE:i},parameters:{depthCompare:"always",blendColorOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaOperation:"max",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"}})}(e,t)}start(e,t){let i=this.currentLength,r=this.currentStartIndices;super.start(e,t);let{buffers:s,attribute:n}=this;for(let t=0;t<2;t++)s[t]=B({device:this.device,buffer:s[t],attribute:n,fromLength:i,toLength:this.currentLength,fromStartIndices:r,getData:e.enter});s[2]=D({device:this.device,source:s[0],target:s[2]}),this.setBuffer(s[1]);let{model:o}=this.transform;o.setVertexCount(Math.floor(this.currentLength/n.size)),n.isConstant?o.setConstantAttributes({aTo:n.value}):o.setAttributes({aTo:n.getBuffer()})}onUpdate(){let{buffers:e,transform:t,framebuffer:i,transition:r}=this,s=this.settings;t.model.setAttributes({aPrev:e[0],aCur:e[1]}),t.transformFeedback.setBuffers({vNext:e[2]});let n={stiffness:s.stiffness,damping:s.damping};t.model.shaderInputs.setProps({spring:n}),t.run({framebuffer:i,discard:!1,parameters:{viewport:[0,0,1,1]},clearColor:[0,0,0,0]}),F(e),this.setBuffer(e[1]),this.device.readPixelsToArrayWebGL(i)[0]>0||r.end()}delete(){super.delete(),this.transform.destroy(),this.texture.destroy(),this.framebuffer.destroy()}}let H={name:"spring",vs:`\ 1265layout(std140) uniform springUniforms { 1266 float damping; 1267 float stiffness; 1268} spring; 1269`,uniformTypes:{damping:"f32",stiffness:"f32"}},q=`\ 1270#version 300 es 1271#define SHADER_NAME spring-transition-vertex-shader 1272 1273#define EPSILON 0.00001 1274 1275in ATTRIBUTE_TYPE aPrev; 1276in ATTRIBUTE_TYPE aCur; 1277in ATTRIBUTE_TYPE aTo; 1278out ATTRIBUTE_TYPE vNext; 1279out float vIsTransitioningFlag; 1280 1281ATTRIBUTE_TYPE getNextValue(ATTRIBUTE_TYPE cur, ATTRIBUTE_TYPE prev, ATTRIBUTE_TYPE dest) { 1282 ATTRIBUTE_TYPE velocity = cur - prev; 1283 ATTRIBUTE_TYPE delta = dest - cur; 1284 ATTRIBUTE_TYPE force = delta * spring.stiffness; 1285 ATTRIBUTE_TYPE resistance = velocity * spring.damping; 1286 return force - resistance + velocity + cur; 1287} 1288 1289void main(void) { 1290 bool isTransitioning = length(aCur - aPrev) > EPSILON || length(aTo - aCur) > EPSILON; 1291 vIsTransitioningFlag = isTransitioning ? 1.0 : 0.0; 1292 1293 vNext = getNextValue(aCur, aPrev, aTo); 1294 gl_Position = vec4(0, 0, 0, 1); 1295 gl_PointSize = 100.0; 1296} 1297`,K=`\ 1298#version 300 es 1299#define SHADER_NAME spring-transition-is-transitioning-fragment-shader 1300 1301in float vIsTransitioningFlag; 1302 1303out vec4 fragColor; 1304 1305void main(void) { 1306 if (vIsTransitioningFlag == 0.0) { 1307 discard; 1308 } 1309 fragColor = vec4(1.0); 1310}`,X={interpolation:U,spring:$};class Y{constructor(e,{id:t,timeline:i}){if(!e)throw Error("AttributeTransitionManager is constructed without device");this.id=t,this.device=e,this.timeline=i,this.transitions={},this.needsRedraw=!1,this.numInstances=1}finalize(){for(let e in this.transitions)this._removeTransition(e)}update({attributes:e,transitions:t,numInstances:i}){for(let r in this.numInstances=i||1,e){let i=e[r],s=i.getTransitionSetting(t);s&&this._updateAttribute(r,i,s)}for(let i in this.transitions){let r=e[i];r&&r.getTransitionSetting(t)||this._removeTransition(i)}}hasAttribute(e){let t=this.transitions[e];return t&&t.inProgress}getAttributes(){let e={};for(let t in this.transitions){let i=this.transitions[t];i.inProgress&&(e[t]=i.attributeInTransition)}return e}run(){if(0===this.numInstances)return!1;for(let e in this.transitions)this.transitions[e].update()&&(this.needsRedraw=!0);let e=this.needsRedraw;return this.needsRedraw=!1,e}_removeTransition(e){this.transitions[e].delete(),delete this.transitions[e]}_updateAttribute(e,t,i){let r=this.transitions[e],s=!r||r.type!==i.type;if(s){r&&this._removeTransition(e);let n=X[i.type];
1310n?this.transitions[e]=new n({attribute:t,timeline:this.timeline,device:this.device}):(d.A.error(`unsupported transition type '${i.type}'`)(),s=!1)}(s||t.needsRedraw())&&(this.needsRedraw=!0,this.transitions[e].start(i,this.numInstances))}}let Z="attributeManager.invalidate";class Q{constructor(e,{id:t="attribute-manager",stats:i,timeline:r}={}){this.mergeBoundsMemoized=(0,w.A)(c._Z),this.id=t,this.device=e,this.attributes={},this.updateTriggers={},this.needsRedraw=!0,this.userData={},this.stats=i,this.attributeTransitionManager=new Y(e,{id:`${t}-transitions`,timeline:r}),Object.seal(this)}finalize(){for(let e in this.attributes)this.attributes[e].delete();this.attributeTransitionManager.finalize()}getNeedsRedraw(e={clearRedrawFlags:!1}){let t=this.needsRedraw;return this.needsRedraw=this.needsRedraw&&!e.clearRedrawFlags,t&&this.id}setNeedsRedraw(){this.needsRedraw=!0}add(e){this._add(e)}addInstanced(e){this._add(e,{stepMode:"instance"})}remove(e){for(let t of e)void 0!==this.attributes[t]&&(this.attributes[t].delete(),delete this.attributes[t])}invalidate(e,t){let i=this._invalidateTrigger(e,t);(0,S.A)(Z,this,e,i)}invalidateAll(e){for(let t in this.attributes)this.attributes[t].setNeedsUpdate(t,e);(0,S.A)(Z,this,"all")}update({data:e,numInstances:t,startIndices:i=null,transitions:r,props:s={},buffers:n={},context:o={}}){let a=!1;for(let r in(0,S.A)("attributeManager.updateStart",this),this.stats&&this.stats.get("Update Attributes").timeStart(),this.attributes){let l=this.attributes[r],h=l.settings.accessor;l.startIndices=i,l.numInstances=t,s[r]&&d.A.removed(`props.${r}`,`data.attributes.${r}`)(),l.setExternalBuffer(n[r])||l.setBinaryValue("string"==typeof h?n[h]:void 0,e.startIndices)||"string"==typeof h&&!n[h]&&l.setConstantValue(o,s[h])||l.needsUpdate()&&(a=!0,this._updateAttribute({attribute:l,numInstances:t,data:e,props:s,context:o})),this.needsRedraw=this.needsRedraw||l.needsRedraw()}a&&(0,S.A)("attributeManager.updateEnd",this,t),this.stats&&(this.stats.get("Update Attributes").timeEnd(),a&&this.stats.get("Attributes updated").incrementCount()),this.attributeTransitionManager.update({attributes:this.attributes,numInstances:t,transitions:r})}updateTransition(){let{attributeTransitionManager:e}=this,t=e.run();return this.needsRedraw=this.needsRedraw||t,t}getAttributes(){return{...this.attributes,...this.attributeTransitionManager.getAttributes()}}getBounds(e){let t=e.map(e=>this.attributes[e]?.getBounds());return this.mergeBoundsMemoized(t)}getChangedAttributes(e={clearChangedFlags:!1}){let{attributes:t,attributeTransitionManager:i}=this,r={...i.getAttributes()};for(let s in t){let n=t[s];n.needsRedraw(e)&&!i.hasAttribute(s)&&(r[s]=n)}return r}getBufferLayouts(e){return Object.values(this.getAttributes()).map(t=>t.getBufferLayout(e))}_add(e,t){for(let i in e){let r=e[i],s={...r,id:i,size:r.isIndexed&&1||r.size||1,...t};this.attributes[i]=new x(this.device,s)}this._mapUpdateTriggersToAttributes()}_mapUpdateTriggersToAttributes(){let e={};for(let t in this.attributes)this.attributes[t].getUpdateTriggers().forEach(i=>{e[i]||(e[i]=[]),e[i].push(t)});this.updateTriggers=e}_invalidateTrigger(e,t){let{attributes:i,updateTriggers:r}=this,s=r[e];return s&&s.forEach(e=>{let r=i[e];r&&r.setNeedsUpdate(r.id,t)}),s}_updateAttribute(e){let{attribute:t,numInstances:i}=e;if((0,S.A)("attribute.updateStart",t),t.constant)return void t.setConstantValue(e.context,t.value);t.allocate(i)&&(0,S.A)("attribute.allocate",t,i),t.updateBuffer(e)&&(this.needsRedraw=!0,(0,S.A)("attribute.updateEnd",t,i))}}var J=i(27366);class ee extends G.A{get value(){return this._value}_onUpdate(){let{time:e,settings:{fromValue:t,toValue:i,duration:r,easing:s}}=this,n=s(e/r);this._value=(0,J.Cc)(t,i,n)}}function et(e,t,i,r,s){let n=t-e;return(i-t)*s+-n*r+n+t}function ei(e,t){if(Array.isArray(e)){let i=0;for(let r=0;r<e.length;r++){let s=e[r]-t[r];i+=s*s}return Math.sqrt(i)}return Math.abs(e-t)}class er extends G.A{get value(){return this._currValue}_onUpdate(){let{fromValue:e,toValue:t,damping:i,stiffness:r}=this.settings,{_prevValue:s=e,_currValue:n=e}=this,o=function(e,t,i,r,s){if(Array.isArray(i)){let n=[];for(let o=0;o<i.length;o++)n[o]=et(e[o],t[o],i[o],r,s);return n}return et(e,t,i,r,s)}(s,n,t,i,r),a=ei(o,t),l=ei(o,n);a<1e-5&&l<1e-5&&(o=t,this.end()),this._prevValue=n,this._currValue=o}}let es={interpolation:ee,spring:er};class en{constructor(e){this.transitions=new Map,this.timeline=e}get active(){return this.transitions.size>0}add(e,t,i,r){let{transitions:s}=this;if(s.has(e)){let i=s.get(e),{value:r=i.settings.fromValue}=i;t=r,this.remove(e)}if(!(r=E(r)))return;let n=es[r.type];if(!n)return void d.A.error(`unsupported transition type '${r.type}'`)();let o=new n(this.timeline);o.start({...r,fromValue:t,toValue:i}),s.set(e,o)}remove(e){let{transitions:t}=this;t.has(e)&&(t.get(e).cancel(),t.delete(e))}update(){let e={};for(let[t,i]of this.transitions)i.update(),e[t]=i.value,i.inProgress||this.remove(t);return e}clear(){for(let e of this.transitions.keys())this.remove(e)}}var eo=i(73254);function ea({newProps:e,oldProps:t,ignoreProps:i={},propTypes:r={},triggerName:s="props"}){if(t===e)return!1;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return`${s} changed shallowly`;for(let n of Object.keys(e))if(!(n in i)){if(!(n in t))return`${s}.${n} added`;let i=el(e[n],t[n],r[n]);if(i)return`${s}.${n} ${i}`}for(let n of Object.keys(t))if(!(n in i)){if(!(n in e))return`${s}.${n} dropped`;if(!Object.hasOwnProperty.call(e,n)){let i=el(e[n],t[n],r[n]);if(i)return`${s}.${n} ${i}`}}return!1}function el(e,t,i){let r=i&&i.equal;return r&&!r(e,t,i)||!r&&(r=e&&t&&e.equals)&&!r.call(e,t)?"changed deeply":r||t===e?null:"changed shallowly"}function eh(e,t,i){let r=e.updateTriggers[i];r=null==r?{}:r;let s=t.updateTriggers[i];return ea({oldProps:s=null==s?{}:s,newProps:r,triggerName:i})}function eu(e,t){if(!t)return e;let i={...e,...t};if("defines"in t&&(i.defines={...e.defines,...t.defines}),"modules"in t&&(i.modules=(e.modules||[]).concat(t.modules),t.modules.some(e=>"project64"===e.name))){let e=i.modules.findIndex(e=>"project32"===e.name);e>=0&&i.modules.splice(e,1)}if("inject"in t)if(e.inject){let r={...e.inject};
1310for(let e in t.inject)r[e]=(r[e]||"")+t.inject[e];i.inject=r}else i.inject=t.inject;return i}var ec=i(79549),ed=i(6797),ef=i(74073),ep=i(85476),eg=i(45692);let em=[0,0,0];function e_(e,t,i=!1){let r=t.projectPosition(e);if(i&&t instanceof ed.A){let[i,s,n=0]=e,o=t.getDistanceScales([i,s]);r[2]=n*o.unitsPerMeter[2]}return r}function ey(e,{viewport:t,modelMatrix:i,coordinateSystem:r,coordinateOrigin:s,offsetMode:n}){let[o,a,l=0]=e;switch(i&&([o,a,l]=ef.Z0([],[o,a,l,1],i)),r){case"default":return ey(e,{viewport:t,modelMatrix:i,coordinateSystem:t.isGeospatial?"lnglat":"cartesian",coordinateOrigin:s,offsetMode:n});case"lnglat":return e_([o,a,l],t,n);case"lnglat-offsets":return e_([o+s[0],a+s[1],l+(s[2]||0)],t,n);case"meter-offsets":return e_((0,eg.dT)(s,[o,a,l]),t,n);case"cartesian":return t.isGeospatial?[o+s[0],a+s[1],l+s[2]]:t.projectPosition([o,a,l]);default:throw Error(`Invalid coordinateSystem: ${r}`)}}var ev=i(75457);let eb={minFilter:"linear",mipmapFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"},eE={};var ex=i(19277);let ew={boolean:{validate:(e,t)=>!0,equal:(e,t,i)=>!!e==!!t},number:{validate:(e,t)=>Number.isFinite(e)&&(!("max"in t)||e<=t.max)&&(!("min"in t)||e>=t.min)},color:{validate:(e,t)=>t.optional&&!e||eP(e)&&(3===e.length||4===e.length),equal:(e,t,i)=>(0,ex.b)(e,t,1)},accessor:{validate(e,t){let i=eT(e);return"function"===i||i===eT(t.value)},equal:(e,t,i)=>"function"==typeof t||(0,ex.b)(e,t,1)},array:{validate:(e,t)=>t.optional&&!e||eP(e),equal(e,t,i){let{compare:r}=i,s=Number.isInteger(r)?r:+!!r;return r?(0,ex.b)(e,t,s):e===t}},object:{equal(e,t,i){if(i.ignore)return!0;let{compare:r}=i,s=Number.isInteger(r)?r:+!!r;return r?(0,ex.b)(e,t,s):e===t}},function:{validate:(e,t)=>t.optional&&!e||"function"==typeof e,equal:(e,t,i)=>!i.compare&&!1!==i.ignore||e===t},data:{transform:(e,t,i)=>{if(!e)return e;let{dataTransform:r}=i.props;return r?r(e):"string"==typeof e.shape&&e.shape.endsWith("-table")&&Array.isArray(e.data)?e.data:e}},image:{transform:(e,t,i)=>{let r=i.context;return r&&r.device?function(e,t,i,r){if(i instanceof ev.g)return i;i.constructor&&"Object"!==i.constructor.name&&(i={data:i});let s=null;i.compressed&&(s={minFilter:"linear",mipmapFilter:i.data.length>1?"nearest":"linear"});let{width:n,height:o}=i.data,a=t.createTexture({...i,sampler:{...eb,...s,...r},mipLevels:t.getMipLevelCount(n,o)});return"webgl"===t.type?a.generateMipmapsWebGL():"webgpu"===t.type&&t.generateMipmapsWebGPU(a),eE[a.id]=e,a}(i.id,r.device,e,{...t.parameters,...i.props.textureParameters}):null},release:(e,t,i)=>{!function(e,t){t&&t instanceof ev.g&&eE[t.id]===e&&(t.delete(),delete eE[t.id])}(i.id,e)}}};function eS(e,t){return"type"in t?{name:e,...ew[t.type],...t}:"value"in t?{name:e,type:eT(t.value),...t}:{name:e,type:"object",value:t}}function eP(e){return Array.isArray(e)||ArrayBuffer.isView(e)}function eT(e){return eP(e)?"array":null===e?"null":typeof e}function eA(e,t){return Object.prototype.hasOwnProperty.call(e,t)}let eM=0;class eC{constructor(...e){this.props=function(e,t){let i;for(let e=t.length-1;e>=0;e--){let r=t[e];"extensions"in r&&(i=r.extensions)}let r=Object.create(function e(t,i){var r,s;if(!(t instanceof eR.constructor))return{};let n="_mergedDefaultProps";if(i)for(let e of i){let t=e.constructor;t&&(n+=`:${t.extensionName||t.name}`)}let o=eA(r=t,s=n)&&r[s];return o||(t[n]=function(t,i){if(!t.prototype)return null;let r=e(Object.getPrototypeOf(t)),s=function(e){let t={},i={},r={};for(let[s,n]of Object.entries(e)){let e=n?.deprecatedFor;if(e)r[s]=Array.isArray(e)?e:[e];else{let e=function(e,t){switch(eT(t)){case"object":return eS(e,t);case"array":return eS(e,{type:"array",value:t,compare:!1});case"boolean":return eS(e,{type:"boolean",value:t});case"number":return eS(e,{type:"number",value:t});case"function":return eS(e,{type:"function",value:t,compare:!0});default:return{name:e,type:"unknown",value:t}}}(s,n);t[s]=e,i[s]=e.value}}return{propTypes:t,defaultProps:i,deprecatedProps:r}}(function(e,t){return eA(e,t)&&e[t]}(t,"defaultProps")||{}),n=Object.assign(Object.create(null),r,s.defaultProps),o=Object.assign(Object.create(null),r?.[eo.fW],s.propTypes),a=Object.assign(Object.create(null),r?.[eo.uH],s.deprecatedProps);for(let t of i){let i=e(t.constructor);i&&(Object.assign(n,i),Object.assign(o,i[eo.fW]),Object.assign(a,i[eo.uH]))}return Object.defineProperties(n,{id:{writable:!0,value:function(e){let t=e.componentName;return t||d.A.warn(`${e.name}.componentName not specified`)(),t||e.name}(t)}}),function(e,t){let i={},r={};for(let e in t){let s=t[e],{name:n,value:o}=s;s.async&&(i[n]=o,r[n]=function(e){return{enumerable:!0,set(t){"string"==typeof t||t instanceof Promise||(0,m.Td)(t)?this[eo.YN][e]=t:this[eo.vf][e]=t}
1310,get(){if(this[eo.vf]){if(e in this[eo.vf])return this[eo.vf][e]||this[eo.jA][e];if(e in this[eo.YN]){let t=this[eo.r3]&&this[eo.r3].internalState;if(t&&t.hasAsyncProp(e))return t.getAsyncProp(e)||this[eo.jA][e]}}return this[eo.jA][e]}}}(n))}e[eo.jA]=i,e[eo.YN]={},Object.defineProperties(e,r)}(n,o),function(e,t){for(let i in t)Object.defineProperty(e,i,{enumerable:!1,set(e){let r=`${this.id}: ${i}`;for(let r of t[i])eA(this,r)||(this[r]=e);d.A.deprecated(r,t[i].join("/"))()}})}(n,a),n[eo.fW]=o,n[eo.uH]=a,0!==i.length||eA(t,"_propTypes")||(t._propTypes=o),n}(t,i||[]))}(e.constructor,i));r[eo.r3]=e,r[eo.YN]={},r[eo.vf]={};for(let e=0;e<t.length;++e){let i=t[e];for(let e in i)r[e]=i[e]}return Object.freeze(r),r}(this,e),this.id=this.props.id,this.count=eM++}clone(e){let{props:t}=this,i={};for(let e in t[eo.jA])e in t[eo.vf]?i[e]=t[eo.vf][e]:e in t[eo.YN]&&(i[e]=t[eo.YN][e]);return new this.constructor({...t,...i,...e})}}eC.componentName="Component",eC.defaultProps={};let eR=eC,eL=Object.freeze({});class eI{constructor(e){this.component=e,this.asyncProps={},this.onAsyncPropUpdated=()=>{},this.oldProps=null,this.oldAsyncProps=null}finalize(){for(let e in this.asyncProps){let t=this.asyncProps[e];t&&t.type&&t.type.release&&t.type.release(t.resolvedValue,t.type,this.component)}this.asyncProps={},this.component=null,this.resetOldProps()}getOldProps(){return this.oldAsyncProps||this.oldProps||eL}resetOldProps(){this.oldAsyncProps=null,this.oldProps=this.component?this.component.props:null}hasAsyncProp(e){return e in this.asyncProps}getAsyncProp(e){let t=this.asyncProps[e];return t&&t.resolvedValue}isAsyncPropLoading(e){if(e){let t=this.asyncProps[e];return!!(t&&t.pendingLoadCount>0&&t.pendingLoadCount!==t.resolvedLoadCount)}for(let e in this.asyncProps)if(this.isAsyncPropLoading(e))return!0;return!1}reloadAsyncProp(e,t){this._watchPromise(e,Promise.resolve(t))}setAsyncProps(e){this.component=e[eo.r3]||this.component;let t=e[eo.vf]||{},i=e[eo.YN]||e,r=e[eo.jA]||{};for(let e in t){let i=t[e];this._createAsyncPropData(e,r[e]),this._updateAsyncProp(e,i),t[e]=this.getAsyncProp(e)}for(let e in i){let t=i[e];this._createAsyncPropData(e,r[e]),this._updateAsyncProp(e,t)}}_fetch(e,t){return null}_onResolve(e,t){}_onError(e,t){}_updateAsyncProp(e,t){if(this._didAsyncInputValueChange(e,t)){if("string"==typeof t&&(t=this._fetch(e,t)),t instanceof Promise)return void this._watchPromise(e,t);if((0,m.Td)(t))return void this._resolveAsyncIterable(e,t);this._setPropValue(e,t)}}_freezeAsyncOldProps(){if(!this.oldAsyncProps&&this.oldProps)for(let e in this.oldAsyncProps=Object.create(this.oldProps),this.asyncProps)Object.defineProperty(this.oldAsyncProps,e,{enumerable:!0,value:this.oldProps[e]})}_didAsyncInputValueChange(e,t){let i=this.asyncProps[e];return t!==i.resolvedValue&&t!==i.lastValue&&(i.lastValue=t,!0)}_setPropValue(e,t){this._freezeAsyncOldProps();let i=this.asyncProps[e];i&&(t=this._postProcessValue(i,t),i.resolvedValue=t,i.pendingLoadCount++,i.resolvedLoadCount=i.pendingLoadCount)}_setAsyncPropValue(e,t,i){let r=this.asyncProps[e];r&&i>=r.resolvedLoadCount&&void 0!==t&&(this._freezeAsyncOldProps(),r.resolvedValue=t,r.resolvedLoadCount=i,this.onAsyncPropUpdated(e,t))}_watchPromise(e,t){let i=this.asyncProps[e];if(i){i.pendingLoadCount++;let r=i.pendingLoadCount;t.then(t=>{this.component&&(t=this._postProcessValue(i,t),this._setAsyncPropValue(e,t,r),this._onResolve(e,t))}).catch(t=>{this._onError(e,t)})}}async _resolveAsyncIterable(e,t){if("data"!==e)return void this._setPropValue(e,t);let i=this.asyncProps[e];if(!i)return;i.pendingLoadCount++;let r=i.pendingLoadCount,s=[],n=0;for await(let i of t){if(!this.component)return;let{dataTransform:t}=this.component.props;Object.defineProperty(s=t?t(i,s):s.concat(i),"__diff",{enumerable:!1,value:[{startRow:n,endRow:s.length}]}),n=s.length,this._setAsyncPropValue(e,s,r)}
1310this._onResolve(e,s)}_postProcessValue(e,t){let i=e.type;return i&&this.component&&(i.release&&i.release(e.resolvedValue,i,this.component),i.transform)?i.transform(t,i,this.component):t}_createAsyncPropData(e,t){if(!this.asyncProps[e]){let i=this.component&&this.component.props[eo.fW];this.asyncProps[e]={type:i&&i[e],lastValue:null,resolvedValue:t,pendingLoadCount:0,resolvedLoadCount:0}}}}class eO extends eI{constructor({attributeManager:e,layer:t}){super(t),this.attributeManager=e,this.needsRedraw=!0,this.needsUpdate=!0,this.subLayers=null,this.usesPickingColorCache=!1}get layer(){return this.component}_fetch(e,t){let i=this.layer,r=i?.props.fetch;return r?r(t,{propName:e,layer:i}):super._fetch(e,t)}_onResolve(e,t){let i=this.layer;if(i){let r=i.props.onDataLoad;"data"===e&&r&&r(t,{propName:e,layer:i})}}_onError(e,t){let i=this.layer;i&&i.raiseError(t,`loading ${e} of ${this.layer}`)}}var eN=i(41487);let eF=Object.freeze([]),eD=(0,w.A)(({oldViewport:e,viewport:t})=>e.equals(t)),eB=new Uint8ClampedArray(0),eG={data:{type:"data",value:eF,async:!0},dataComparator:{type:"function",value:null,optional:!0},_dataDiff:{type:"function",value:e=>e&&e.__diff,optional:!0},dataTransform:{type:"function",value:null,optional:!0},onDataLoad:{type:"function",value:null,optional:!0},onError:{type:"function",value:null,optional:!0},fetch:{type:"function",value:(e,{propName:t,layer:i,loaders:r,loadOptions:s,signal:n})=>{let{resourceManager:o}=i.context;s=s||i.getLoadOptions(),r=r||i.props.loaders,n&&(s={...s,core:{...s?.core,fetch:{...s?.core?.fetch,signal:n}}});let a=o.contains(e);return(a||s||(o.add({resourceId:e,data:(0,eN.H)(e,r),persistent:!1}),a=!0),a)?o.subscribe({resourceId:e,onChange:e=>i.internalState?.reloadAsyncProp(t,e),consumerId:i.id,requestId:t}):(0,eN.H)(e,r,s)}},updateTriggers:{},visible:!0,pickable:!1,opacity:{type:"number",min:0,max:1,value:1},operation:"draw",onHover:{type:"function",value:null,optional:!0},onClick:{type:"function",value:null,optional:!0},onDragStart:{type:"function",value:null,optional:!0},onDrag:{type:"function",value:null,optional:!0},onDragEnd:{type:"function",value:null,optional:!0},coordinateSystem:"default",coordinateOrigin:{type:"array",value:[0,0,0],compare:!0},modelMatrix:{type:"array",value:null,compare:!0,optional:!0},wrapLongitude:!1,positionFormat:"XYZ",colorFormat:"RGBA",parameters:{type:"object",value:{},optional:!0,compare:2},loadOptions:{type:"object",value:null,optional:!0,ignore:!0},transitions:null,extensions:[],loaders:{type:"array",value:[],optional:!0,ignore:!0},getPolygonOffset:{type:"function",value:({layerIndex:e})=>[0,-(100*e)]},highlightedObjectIndex:null,autoHighlight:!1,highlightColor:{type:"accessor",value:[0,0,128,128]}};class ek extends eR{constructor(){super(...arguments),this.internalState=null,this.lifecycle=eo.VD.NO_STATE,this.parent=null}static get componentName(){return Object.prototype.hasOwnProperty.call(this,"layerName")?this.layerName:""}get root(){let e=this;for(;e.parent;)e=e.parent;return e}toString(){let e=this.constructor.layerName||this.constructor.name;return`${e}({id: '${this.props.id}'})`}project(e){(0,g.A)(this.internalState);let t=this.internalState.viewport||this.context.viewport,i=ey(e,{viewport:t,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem}),[r,s,n]=(0,eg.VJ)(i,t.pixelProjectionMatrix);return 2===e.length?[r,s]:[r,s,n]}unproject(e){return(0,g.A)(this.internalState),(this.internalState.viewport||this.context.viewport).unproject(e)}projectPosition(e,t){return(0,g.A)(this.internalState),function(e,t){let{viewport:i,coordinateSystem:r,coordinateOrigin:s,modelMatrix:n,fromCoordinateSystem:o,fromCoordinateOrigin:a}=function(e){let{viewport:t,modelMatrix:i,coordinateOrigin:r}=e,{coordinateSystem:s,fromCoordinateSystem:n,fromCoordinateOrigin:o}=e;return"default"===s&&(s=t.isGeospatial?"lnglat":"cartesian"),void 0===n?n=s:"default"===n&&(n=t.isGeospatial?"lnglat":"cartesian"),void 0===o&&(o=r),{viewport:t,coordinateSystem:s,coordinateOrigin:r,modelMatrix:i,fromCoordinateSystem:n,fromCoordinateOrigin:o}}(t),{autoOffset:l=!0}=t,{geospatialOrigin:h=em,shaderCoordinateOrigin:u=em,offsetMode:c=!1}=l?(0,ec.ow)(i,r,s):{}
1310,d=ey(e,{viewport:i,modelMatrix:n,coordinateSystem:o,coordinateOrigin:a,offsetMode:c});if(c){let e=i.projectPosition(h||u);ep.jb(d,d,e)}return d}(e,{viewport:this.internalState.viewport||this.context.viewport,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem,...t})}get isComposite(){return!1}get isDrawable(){return!0}setState(e){this.setChangeFlags({stateChanged:!0}),Object.assign(this.state,e),this.setNeedsRedraw()}setNeedsRedraw(){this.internalState&&(this.internalState.needsRedraw=!0)}setNeedsUpdate(){this.internalState&&(this.context.layerManager.setNeedsUpdate(String(this)),this.internalState.needsUpdate=!0)}get isLoaded(){return!!this.internalState&&!this.internalState.isAsyncPropLoading()}get wrapLongitude(){return this.props.wrapLongitude}isPickable(){return this.props.pickable&&this.props.visible}getModels(){let e=this.state;return e&&(e.models||e.model&&[e.model])||[]}setShaderModuleProps(...e){for(let t of this.getModels())t.shaderInputs.setProps(...e)}getAttributeManager(){return this.internalState&&this.internalState.attributeManager}getCurrentLayer(){return this.internalState&&this.internalState.layer}getLoadOptions(){return this.props.loadOptions}use64bitPositions(){let{coordinateSystem:e}=this.props;return"default"===e||"lnglat"===e||"cartesian"===e}onHover(e,t){return!!this.props.onHover&&(this.props.onHover(e,t)||!1)}onClick(e,t){return!!this.props.onClick&&(this.props.onClick(e,t)||!1)}nullPickingColor(){return[0,0,0]}encodePickingColor(e,t=[]){return t[0]=e+1&255,t[1]=e+1>>8&255,t[2]=e+1>>8>>8&255,t}decodePickingColor(e){(0,g.A)(e instanceof Uint8Array);let[t,i,r]=e;return t+256*i+65536*r-1}getNumInstances(){if(Number.isFinite(this.props.numInstances))return this.props.numInstances;if(this.state&&void 0!==this.state.numInstances)return this.state.numInstances;var e,t,i=this.props.data;if(null===(e=i)||"object"!=typeof e)throw Error("count(): argument not an object");if("function"==typeof i.count)return i.count();if(Number.isFinite(i.size))return i.size;if(Number.isFinite(i.length))return i.length;if(null!==(t=i)&&"object"==typeof t&&t.constructor===Object)return Object.keys(i).length;throw Error("count(): argument not a container")}getStartIndices(){return this.props.startIndices?this.props.startIndices:this.state&&this.state.startIndices?this.state.startIndices:null}getBounds(){return this.getAttributeManager()?.getBounds(["positions","instancePositions"])}getShaders(e){for(let t of(e=eu(e,{disableWarnings:!0,modules:this.context.defaultShaderModules}),this.props.extensions))e=eu(e,t.getShaders.call(this,t));return e}shouldUpdateState(e){return e.changeFlags.propsOrDataChanged}updateState(e){let t=this.getAttributeManager(),{dataChanged:i}=e.changeFlags;if(i&&t)if(Array.isArray(i))for(let e of i)t.invalidateAll(e);else t.invalidateAll();if(t){let{props:i}=e,r=this.internalState.hasPickingBuffer,s=Number.isInteger(i.highlightedObjectIndex)||!!i.pickable||i.extensions.some(e=>e.getNeedsPickingBuffer.call(this,e));if(r!==s){this.internalState.hasPickingBuffer=s;let{pickingColors:e,instancePickingColors:i}=t.attributes,r=e||i;r&&(s&&r.constant&&(r.constant=!1,t.invalidate(r.id)),r.value||s||(r.constant=!0,r.value=[0,0,0]))}}}finalizeState(e){for(let e of this.getModels())e.destroy();let t=this.getAttributeManager();t&&t.finalize(),this.context&&this.context.resourceManager.unsubscribe({consumerId:this.id}),this.internalState&&(this.internalState.uniformTransitions.clear(),this.internalState.finalize())}draw(e){for(let t of this.getModels())t.draw(e.renderPass)}getPickingInfo({info:e,mode:t,sourceLayer:i}){let{index:r}=e;return r>=0&&Array.isArray(this.props.data)&&(e.object=this.props.data[r]),e}raiseError(e,t){t&&(e=Error(`${t}: ${e.message}`,{cause:e})),this.props.onError?.(e)||this.context?.onError?.(e,this)}getNeedsRedraw(e={clearRedrawFlags:!1}){return this._getNeedsRedraw(e)}needsUpdate(){return!!this.internalState&&(this.internalState.needsUpdate||this.hasUniformTransition()||this.shouldUpdateState(this._getUpdateParams()))}hasUniformTransition(){return this.internalState?.uniformTransitions.active||!1}activateViewport(e){if(!this.internalState)return;let t=this.internalState.viewport;this.internalState.viewport=e,t&&eD({oldViewport:t,viewport:e})||(this.setChangeFlags({viewportChanged:!0}),this.isComposite?this.needsUpdate()&&this.setNeedsUpdate():this._update())}invalidateAttribute(e="all"){let t=this.getAttributeManager();
1310t&&("all"===e?t.invalidateAll():t.invalidate(e))}updateAttributes(e){let t=!1;for(let i in e)e[i].layoutChanged()&&(t=!0);for(let i of this.getModels())this._setModelAttributes(i,e,t)}_updateAttributes(){let e=this.getAttributeManager();if(!e)return;let t=this.props,i=this.getNumInstances(),r=this.getStartIndices();e.update({data:t.data,numInstances:i,startIndices:r,props:t,transitions:t.transitions,buffers:t.data.attributes,context:this});let s=e.getChangedAttributes({clearChangedFlags:!0});this.updateAttributes(s)}_updateAttributeTransition(){let e=this.getAttributeManager();e&&e.updateTransition()}_updateUniformTransition(){let{uniformTransitions:e}=this.internalState;if(e.active){let t=e.update(),i=Object.create(this.props);for(let e in t)Object.defineProperty(i,e,{value:t[e]});return i}return this.props}calculateInstancePickingColors(e,{numInstances:t}){if(e.constant)return;let i=Math.floor(eB.length/4);this.internalState.usesPickingColorCache=!0;let r=t>0&&0===eB[0];if(i<t||r){t>0xffffff&&d.A.warn("Layer has too many data objects. Picking might not be able to distinguish all objects.")();let e=Math.floor((eB=u.A.allocate(eB,t,{size:4,copy:!0,maxCount:Math.max(t,0xffffff)})).length/4),s=[0,0,0],n=r?0:i;for(let t=n;t<e;t++)this.encodePickingColor(t,s),eB[4*t+0]=s[0],eB[4*t+1]=s[1],eB[4*t+2]=s[2],eB[4*t+3]=0}e.value=eB.subarray(0,4*t)}_setModelAttributes(e,t,i=!1){if(!Object.keys(t).length)return;if(i){let i=this.getAttributeManager();e.setBufferLayout(i.getBufferLayouts(e)),t=i.getAttributes()}let s=e.userData?.excludeAttributes||{},n={},o={};for(let i in t){if(s[i])continue;let a=t[i].getValue();for(let s in a){let l=a[s];l instanceof r.h?t[i].settings.isIndexed?e.setIndexBuffer(l):n[s]=l:l&&(o[s]=l)}}e.setAttributes(n),e.setConstantAttributes(o)}disablePickingIndex(e){let t=this.props.data;if(!("attributes"in t))return void this._disablePickingIndex(e);let{pickingColors:i,instancePickingColors:r}=this.getAttributeManager().attributes,s=i||r,n=s&&t.attributes&&t.attributes[s.id];if(n&&n.value){let i=n.value,r=this.encodePickingColor(e);for(let e=0;e<t.length;e++){let t=s.getVertexOffset(e);i[t]===r[0]&&i[t+1]===r[1]&&i[t+2]===r[2]&&this._disablePickingIndex(e)}}else this._disablePickingIndex(e)}_disablePickingIndex(e){let{pickingColors:t,instancePickingColors:i}=this.getAttributeManager().attributes,r=t||i;if(!r)return;let s=r.getVertexOffset(e),n=r.getVertexOffset(e+1);r.buffer.write(new Uint8Array(n-s),s)}restorePickingColors(){let{pickingColors:e,instancePickingColors:t}=this.getAttributeManager().attributes,i=e||t;i&&(this.internalState.usesPickingColorCache&&i.value.buffer!==eB.buffer&&(i.value=eB.subarray(0,i.value.length)),i.updateSubBuffer({startOffset:0}))}_initialize(){(0,g.A)(!this.internalState),(0,S.A)("layer.initialize",this);let e=this._getAttributeManager();for(let t of(e&&e.addInstanced({instancePickingColors:{type:"uint8",size:4,noAlloc:!0,update:this.calculateInstancePickingColors}}),this.internalState=new eO({attributeManager:e,layer:this}),this._clearChangeFlags(),this.state={},Object.defineProperty(this.state,"attributeManager",{get:()=>(d.A.deprecated("layer.state.attributeManager","layer.getAttributeManager()")(),e)}),this.internalState.uniformTransitions=new en(this.context.timeline),this.internalState.onAsyncPropUpdated=this._onAsyncPropUpdated.bind(this),this.internalState.setAsyncProps(this.props),this.initializeState(this.context),this.props.extensions))t.initializeState.call(this,this.context,t);this.setChangeFlags({dataChanged:"init",propsChanged:"init",viewportChanged:!0,extensionsChanged:!0}),this._update()}_transferState(e){(0,S.A)("layer.matched",this,this===e);let{state:t,internalState:i}=e;this!==e&&(this.internalState=i,this.state=t,this.internalState.setAsyncProps(this.props),this._diffProps(this.props,this.internalState.getOldProps()))}_update(){let e=this.needsUpdate();if((0,S.A)("layer.update",this,e),!e)return;this.context.stats.get("Layer updates").incrementCount();let t=this.props,i=this.context,r=this.internalState,s=i.viewport,n=this._updateUniformTransition();r.propsInTransition=n,i.viewport=r.viewport||s,this.props=n;
1310try{let e=this._getUpdateParams(),t=this.getModels();if(i.device)this.updateState(e);else try{this.updateState(e)}catch(e){}for(let t of this.props.extensions)t.updateState.call(this,e,t);this.setNeedsRedraw(),this._updateAttributes();let r=this.getModels()[0]!==t[0];this._postUpdate(e,r)}finally{i.viewport=s,this.props=t,this._clearChangeFlags(),r.needsUpdate=!1,r.resetOldProps()}}_finalize(){for(let e of((0,S.A)("layer.finalize",this),this.finalizeState(this.context),this.props.extensions))e.finalizeState.call(this,this.context,e)}_drawLayer({renderPass:e,shaderModuleProps:t=null,uniforms:i={},parameters:r={}}){this._updateAttributeTransition();let n=this.props,o=this.context;this.props=this.internalState.propsInTransition||n;try{t&&this.setShaderModuleProps(t);let{getPolygonOffset:n}=this.props,a=n&&n(i)||[0,0];o.device instanceof s.WebGLDevice&&o.device.setParametersWebGL({polygonOffset:a});let l=o.device instanceof s.WebGLDevice?null:function(e){let{blendConstant:t,...i}=e;return t?{pipelineParameters:i,renderPassParameters:{blendConstant:t}}:{pipelineParameters:i}}(r);if(function(e,t,i,r){for(let s of e)"webgpu"===s.device.type?(function(e,t){let i=t.props.framebuffer||(t.framebuffer??null);if(!i)return;let r=i.colorAttachments.map(e=>e?.texture?.format??null),s=i.depthStencilAttachment?.texture?.format;(!function(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0}(e.props.colorAttachmentFormats,r)||e.props.depthStencilAttachmentFormat!==s)&&(e.props.colorAttachmentFormats=r,e.props.depthStencilAttachmentFormat=s,e._setPipelineNeedsUpdate("attachment formats"))}(s,t),s.setParameters({...s.parameters,...r?.pipelineParameters})):s.setParameters(i)}(this.getModels(),e,r,l),o.device instanceof s.WebGLDevice)o.device.withParametersWebGL(r,()=>{let s={renderPass:e,shaderModuleProps:t,uniforms:i,parameters:r,context:o};for(let e of this.props.extensions)e.draw.call(this,s,e);this.draw(s)});else{l?.renderPassParameters&&e.setParameters(l.renderPassParameters);let s={renderPass:e,shaderModuleProps:t,uniforms:i,parameters:r,context:o};for(let e of this.props.extensions)e.draw.call(this,s,e);this.draw(s)}}finally{this.props=n}}getChangeFlags(){return this.internalState?.changeFlags}setChangeFlags(e){if(!this.internalState)return;let{changeFlags:t}=this.internalState;for(let i in e)if(e[i]){let r=!1;if("dataChanged"===i){let s=e[i],n=t[i];s&&Array.isArray(n)&&(t.dataChanged=Array.isArray(s)?n.concat(s):s,r=!0)}t[i]||(t[i]=e[i],r=!0),r&&(0,S.A)("layer.changeFlag",this,i,e)}let i=!!(t.dataChanged||t.updateTriggersChanged||t.propsChanged||t.extensionsChanged);t.propsOrDataChanged=i,t.somethingChanged=i||t.viewportChanged||t.stateChanged}_clearChangeFlags(){this.internalState.changeFlags={dataChanged:!1,propsChanged:!1,updateTriggersChanged:!1,viewportChanged:!1,stateChanged:!1,extensionsChanged:!1,propsOrDataChanged:!1,somethingChanged:!1}}_diffProps(e,t){let i=function(e,t){let i=ea({newProps:e,oldProps:t,propTypes:e[eo.fW],ignoreProps:{data:null,updateTriggers:null,extensions:null,transitions:null}}),r=function(e,t){if(null===t)return"oldProps is null, initial diff";let i=!1,{dataComparator:r,_dataDiff:s}=e;return r?r(e.data,t.data)||(i="Data comparator detected a change"):e.data!==t.data&&(i="A new data container was supplied"),i&&s&&(i=s(e.data,t.data)||i),i}(e,t),s=!1;return r||(s=function(e,t){if(null===t||"all"in e.updateTriggers&&eh(e,t,"all"))return{all:!0};let i={},r=!1;for(let s in e.updateTriggers)"all"!==s&&eh(e,t,s)&&(i[s]=!0,r=!0);return!!r&&i}(e,t)),{dataChanged:r,propsChanged:i,updateTriggersChanged:s,extensionsChanged:function(e,t){if(null===t)return!0;let i=t.extensions,{extensions:r}=e;if(r===i)return!1;if(!i||!r||r.length!==i.length)return!0;for(let e=0;e<r.length;e++)if(!r[e].equals(i[e]))return!0;return!1}(e,t),transitionsChanged:function(e,t){if(!e.transitions)return!1;let i={},r=e[eo.fW],s=!1;for(let n in e.transitions){let o=r[n],a=o&&o.type;("number"===a||"color"===a||"array"===a)&&el(e[n],t[n],o)&&(i[n]=!0,s=!0)}return!!s&&i}(e,t)}}(e,t);if(i.updateTriggersChanged)for(let e in i.updateTriggersChanged)i.updateTriggersChanged[e]&&this.invalidateAttribute(e);
1310if(i.transitionsChanged)for(let r in i.transitionsChanged)this.internalState.uniformTransitions.add(r,t[r],e[r],e.transitions?.[r]);return this.setChangeFlags(i)}validateProps(){!function(e){let t=e[eo.fW];for(let i in t){let r=t[i],{validate:s}=r;if(s&&!s(e[i],r))throw Error(`Invalid prop ${i}: ${e[i]}`)}}(this.props)}updateAutoHighlight(e){this.props.autoHighlight&&!Number.isInteger(this.props.highlightedObjectIndex)&&this._updateAutoHighlight(e)}_updateAutoHighlight(e){let t={highlightedObjectColor:e.picked?e.color:null},{highlightColor:i}=this.props;e.picked&&"function"==typeof i&&(t.highlightColor=i(e)),this.setShaderModuleProps({picking:t}),this.setNeedsRedraw()}_getAttributeManager(){let e=this.context;return new Q(e.device,{id:this.props.id,stats:e.stats,timeline:e.timeline})}_postUpdate(e,t){let{props:i,oldProps:r}=e,s=this.state.model;s?.isInstanced&&s.setInstanceCount(this.getNumInstances());let{autoHighlight:n,highlightedObjectIndex:o,highlightColor:a}=i;if(t||r.autoHighlight!==n||r.highlightedObjectIndex!==o||r.highlightColor!==a){let e={};Array.isArray(a)&&(e.highlightColor=a),(t||r.autoHighlight!==n||o!==r.highlightedObjectIndex)&&(e.highlightedObjectColor=Number.isFinite(o)&&o>=0?this.encodePickingColor(o):null),this.setShaderModuleProps({picking:e})}}_getUpdateParams(){return{props:this.props,oldProps:this.internalState.getOldProps(),context:this.context,changeFlags:this.internalState.changeFlags}}_getNeedsRedraw(e){if(!this.internalState)return!1;let t=!1;t=this.internalState.needsRedraw&&this.id;let i=this.getAttributeManager(),r=!!i&&i.getNeedsRedraw(e);if(t=t||r)for(let e of this.props.extensions)e.onNeedsRedraw.call(this,e);return this.internalState.needsRedraw=this.internalState.needsRedraw&&!e.clearRedrawFlags,t}_onAsyncPropUpdated(){this._diffProps(this.props,this.internalState.getOldProps()),this.setNeedsUpdate()}}ek.defaultProps=eG,ek.layerName="Layer";let eU=ek},79904:(e,t,i)=>{"use strict";i.d(t,{R:()=>r});let r=new(i(97517)).hW({id:"luma.gl"})},81403:(e,t,i)=>{"use strict";i.d(t,{L:()=>s});let r={};function s(e="id"){r[e]=r[e]||1;let t=r[e]++;return`${e}-${t}`}},81849:(e,t,i)=>{"use strict";i.d(t,{A:()=>s});var r=i(24365);function s(e){var t=e.length;return function(i){var s=Math.floor(((i%=1)<0?++i:i)*t),n=e[(s+t-1)%t],o=e[s%t],a=e[(s+1)%t],l=e[(s+2)%t];return(0,r.H)((i-s/t)*t,n,o,a,l)}}},81866:(e,t,i)=>{"use strict";i.d(t,{D:()=>n,l:()=>s});var r=i(89575);function s(e){return!!e&&(Array.isArray(e)&&(e=e[0]),Array.isArray(e?.extensions))}function n(e){let t;return(0,r.v)(e,"null loader"),(0,r.v)(s(e),"invalid loader"),Array.isArray(e)&&(t=e[1],e={...e=e[0],options:{...e.options,...t}}),(e?.parseTextSync||e?.parseText)&&(e.text=!0),e.text||(e.binary=!0),e}},82831:(e,t,i)=>{"use strict";i.d(t,{A:()=>e7});var r={};i.r(r),i.d(r,{LAT_MAX:()=>v,LAT_MIN:()=>_,LAT_RENDERED_MAX:()=>b,LAT_RENDERED_MIN:()=>y,LNG_MAX:()=>x,LNG_MIN:()=>E,activeStates:()=>g,classes:()=>o,cursors:()=>l,events:()=>d,geojsonTypes:()=>u,interactions:()=>m,meta:()=>p,modes:()=>c,sources:()=>a,types:()=>h,updateActions:()=>f});var s={};i.r(s),i.d(s,{isActiveFeature:()=>P,isBackspaceKey:()=>O,isDeleteKey:()=>N,isDigit1Key:()=>F,isDigit2Key:()=>D,isDigit3Key:()=>B,isDigitKey:()=>G,isEnterKey:()=>I,isEscapeKey:()=>L,isFeature:()=>M,isInactiveFeature:()=>T,isOfMetaType:()=>w,isShiftDown:()=>R,isShiftMousedown:()=>S,isTrue:()=>k,isVertex:()=>C,noTarget:()=>A});var n={};i.r(n),i.d(n,{CommonSelectors:()=>s,ModeHandler:()=>ee,StringSet:()=>H,constrainFeatureMovement:()=>ez,createMidPoint:()=>eI,createSupplementaryPoints:()=>eO,createVertex:()=>ew,doubleClickZoom:()=>eN,euclideanDistance:()=>Z,featuresAt:()=>K,getFeatureAtAndSetCursors:()=>Y,isClick:()=>Q,isEventAtCoordinates:()=>eK,isTap:()=>J,mapEventToBoundingBox:()=>W,moveFeatures:()=>ej,sortFeatures:()=>V,stringSetsAreEqual:()=>e4,theme:()=>eb,toDenseArray:()=>ed});let o={CANVAS:"mapboxgl-canvas",CONTROL_BASE:"mapboxgl-ctrl",CONTROL_PREFIX:"mapboxgl-ctrl-",CONTROL_BUTTON:"mapbox-gl-draw_ctrl-draw-btn",CONTROL_BUTTON_LINE:"mapbox-gl-draw_line",CONTROL_BUTTON_POLYGON:"mapbox-gl-draw_polygon",CONTROL_BUTTON_POINT:"mapbox-gl-draw_point",CONTROL_BUTTON_TRASH:"mapbox-gl-draw_trash",CONTROL_BUTTON_COMB
1310INE_FEATURES:"mapbox-gl-draw_combine",CONTROL_BUTTON_UNCOMBINE_FEATURES:"mapbox-gl-draw_uncombine",CONTROL_GROUP:"mapboxgl-ctrl-group",ATTRIBUTION:"mapboxgl-ctrl-attrib",ACTIVE_BUTTON:"active",BOX_SELECT:"mapbox-gl-draw_boxselect"},a={HOT:"mapbox-gl-draw-hot",COLD:"mapbox-gl-draw-cold"},l={ADD:"add",MOVE:"move",DRAG:"drag",POINTER:"pointer",NONE:"none"},h={POLYGON:"polygon",LINE:"line_string",POINT:"point"},u={FEATURE:"Feature",POLYGON:"Polygon",LINE_STRING:"LineString",POINT:"Point",FEATURE_COLLECTION:"FeatureCollection",MULTI_PREFIX:"Multi",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon"},c={DRAW_LINE_STRING:"draw_line_string",DRAW_POLYGON:"draw_polygon",DRAW_POINT:"draw_point",SIMPLE_SELECT:"simple_select",DIRECT_SELECT:"direct_select"},d={CREATE:"draw.create",DELETE:"draw.delete",UPDATE:"draw.update",SELECTION_CHANGE:"draw.selectionchange",MODE_CHANGE:"draw.modechange",ACTIONABLE:"draw.actionable",RENDER:"draw.render",COMBINE_FEATURES:"draw.combine",UNCOMBINE_FEATURES:"draw.uncombine"},f={MOVE:"move",CHANGE_PROPERTIES:"change_properties",CHANGE_COORDINATES:"change_coordinates"},p={FEATURE:"feature",MIDPOINT:"midpoint",VERTEX:"vertex"},g={ACTIVE:"true",INACTIVE:"false"},m=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate"],_=-90,y=-85,v=90,b=85,E=-270,x=270;function w(e){return function(t){let i=t.featureTarget;return!!i&&!!i.properties&&i.properties.meta===e}}function S(e){return!!e.originalEvent&&!!e.originalEvent.shiftKey&&0===e.originalEvent.button}function P(e){return!!e.featureTarget&&!!e.featureTarget.properties&&e.featureTarget.properties.active===g.ACTIVE&&e.featureTarget.properties.meta===p.FEATURE}function T(e){return!!e.featureTarget&&!!e.featureTarget.properties&&e.featureTarget.properties.active===g.INACTIVE&&e.featureTarget.properties.meta===p.FEATURE}function A(e){return void 0===e.featureTarget}function M(e){return!!e.featureTarget&&!!e.featureTarget.properties&&e.featureTarget.properties.meta===p.FEATURE}function C(e){let t=e.featureTarget;return!!t&&!!t.properties&&t.properties.meta===p.VERTEX}function R(e){return!!e.originalEvent&&!0===e.originalEvent.shiftKey}function L(e){return"Escape"===e.key||27===e.keyCode}function I(e){return"Enter"===e.key||13===e.keyCode}function O(e){return"Backspace"===e.key||8===e.keyCode}function N(e){return"Delete"===e.key||46===e.keyCode}function F(e){return"1"===e.key||49===e.keyCode}function D(e){return"2"===e.key||50===e.keyCode}function B(e){return"3"===e.key||51===e.keyCode}function G(e){let t=e.key||String.fromCharCode(e.keyCode);return t>="0"&&t<="9"}function k(){return!0}var U=i(71312);let z={Point:0,LineString:1,MultiLineString:1,Polygon:2};function j(e,t){let i=z[e.geometry.type]-z[t.geometry.type];return 0===i&&e.geometry.type===u.POLYGON?e.area-t.area:i}let V=function(e){return e.map(e=>(e.geometry.type===u.POLYGON&&(e.area=U.geometry({type:u.FEATURE,property:{},geometry:e.geometry})),e)).sort(j).map(e=>(delete e.area,e))},W=function(e,t=0){return[[e.point.x-t,e.point.y-t],[e.point.x+t,e.point.y+t]]};function $(e){if(this._items={},this._nums={},this._length=e?e.length:0,e)for(let t=0,i=e.length;t<i;t++)this.add(e[t]),void 0!==e[t]&&("string"==typeof e[t]?this._items[e[t]]=t:this._nums[e[t]]=t)}$.prototype.add=function(e){return this.has(e)||(this._length++,"string"==typeof e?this._items[e]=this._length:this._nums[e]=this._length),this},$.prototype.delete=function(e){return!1===this.has(e)||(this._length--,delete this._items[e],delete this._nums[e]),this},$.prototype.has=function(e){return("string"==typeof e||"number"==typeof e)&&(void 0!==this._items[e]||void 0!==this._nums[e])},$.prototype.values=function(){let e=[];return Object.keys(this._items).forEach(t=>{e.push({k:t,v:this._items[t]})}),Object.keys(this._nums).forEach(t=>{e.push({k:JSON.parse(t),v:this._nums[t]})}),e.sort((e,t)=>e.v-t.v).map(e=>e.k)},$.prototype.clear=function(){return this._length=0,this._items={},this._nums={},this};let H=$,q=[p.FEATURE,p.MIDPOINT,p.VERTEX],K={click:function(e,t,i){return X(e,t,i,i.options.clickBuffer)},touch:function(e,t,i){return X(e,t,i,i.options.touchBuffer)}};function X(e,t,i,r){if(null===i.map)return[];let s=e?W(e,r):t,n={};i.options.styles&&(n.layers=i.options.styles.map(e=>e.id).filter(e=>null!=i.map.getLayer(e)));let o=i.map.queryRenderedFeatures(s,n).filter(e=>-1!==q.indexOf(e.properties.meta)),a=new H,l=[];
1310return o.forEach(e=>{let t=e.properties.id;a.has(t)||(a.add(t),l.push(e))}),V(l)}function Y(e,t){let i=K.click(e,null,t),r={mouse:l.NONE};return i[0]&&(r.mouse=i[0].properties.active===g.ACTIVE?l.MOVE:l.POINTER,r.feature=i[0].properties.meta),-1!==t.events.currentModeName().indexOf("draw")&&(r.mouse=l.ADD),t.ui.queueMapClasses(r),t.ui.updateMapClasses(),i[0]}function Z(e,t){let i=e.x-t.x,r=e.y-t.y;return Math.sqrt(i*i+r*r)}function Q(e,t,i={}){let r=null!=i.fineTolerance?i.fineTolerance:4,s=null!=i.grossTolerance?i.grossTolerance:12,n=null!=i.interval?i.interval:500;e.point=e.point||t.point,e.time=e.time||t.time;let o=Z(e.point,t.point);return o<r||o<s&&t.time-e.time<n}function J(e,t,i={}){let r=null!=i.tolerance?i.tolerance:25,s=null!=i.interval?i.interval:250;return e.point=e.point||t.point,e.time=e.time||t.time,Z(e.point,t.point)<r&&t.time-e.time<s}let ee=function(e,t){let i={drag:[],click:[],mousemove:[],mousedown:[],mouseup:[],mouseout:[],keydown:[],keyup:[],touchstart:[],touchmove:[],touchend:[],tap:[]},r={on(e,t,r){if(void 0===i[e])throw Error(`Invalid event type: ${e}`);i[e].push({selector:t,fn:r})},render(e){t.store.featureChanged(e)}},s=function(e,s){let n=i[e],o=n.length;for(;o--;){let e=n[o];if(e.selector(s)){e.fn.call(r,s)||t.store.render(),t.ui.updateMapClasses();break}}};return e.start.call(r),{render:e.render,stop(){e.stop&&e.stop()},trash(){e.trash&&(e.trash(),t.store.render())},combineFeatures(){e.combineFeatures&&e.combineFeatures()},uncombineFeatures(){e.uncombineFeatures&&e.uncombineFeatures()},drag(e){s("drag",e)},click(e){s("click",e)},mousemove(e){s("mousemove",e)},mousedown(e){s("mousedown",e)},mouseup(e){s("mouseup",e)},mouseout(e){s("mouseout",e)},keydown(e){s("keydown",e)},keyup(e){s("keyup",e)},touchstart(e){s("touchstart",e)},touchmove(e){s("touchmove",e)},touchend(e){s("touchend",e)},tap(e){s("tap",e)}}},et=((e,t=21)=>(i=t)=>{let r="",s=0|i;for(;s--;)r+=e[Math.random()*e.length|0];return r})("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",32),ei=function(e,t){this.ctx=e,this.properties=t.properties||{},this.coordinates=t.geometry.coordinates,this.id=t.id||et(),this.type=t.geometry.type};ei.prototype.changed=function(){this.ctx.store.featureChanged(this.id)},ei.prototype.incomingCoords=function(e){this.setCoordinates(e)},ei.prototype.setCoordinates=function(e){this.coordinates=e,this.changed()},ei.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.coordinates))},ei.prototype.setProperty=function(e,t){this.properties[e]=t},ei.prototype.toGeoJSON=function(){return JSON.parse(JSON.stringify({id:this.id,type:u.FEATURE,properties:this.properties,geometry:{coordinates:this.getCoordinates(),type:this.t
1310ype}}))},ei.prototype.internal=function(e){let t={id:this.id,meta:p.FEATURE,"meta:type":this.type,active:g.INACTIVE,mode:e};if(this.ctx.options.userProperties)for(let e in this.properties)t[`user_${e}`]=this.properties[e];return{type:u.FEATURE,properties:t,geometry:{coordinates:this.getCoordinates(),type:this.type}}};let er=function(e,t){ei.call(this,e,t)};er.prototype=Object.create(ei.prototype),er.prototype.isValid=function(){return"number"==typeof this.coordinates[0]&&"number"==typeof this.coordinates[1]},er.prototype.updateCoordinate=function(e,t,i){3==arguments.length?this.coordinates=[t,i]:this.coordinates=[e,t],this.changed()},er.prototype.getCoordinate=function(){return this.getCoordinates()};let es=function(e,t){ei.call(this,e,t)};es.prototype=Object.create(ei.prototype),es.prototype.isValid=function(){return this.coordinates.length>1},es.prototype.addCoordinate=function(e,t,i){this.changed();let r=parseInt(e,10);this.coordinates.splice(r,0,[t,i])},es.prototype.getCoordinate=function(e){let t=parseInt(e,10);return JSON.parse(JSON.stringify(this.coordinates[t]))},es.prototype.removeCoordinate=function(e){this.changed(),this.coordinates.splice(parseInt(e,10),1)},es.prototype.updateCoordinate=function(e,t,i){let r=parseInt(e,10);this.coordinates[r]=[t,i],this.changed()};let en=function(e,t){ei.call(this,e,t),this.coordinates=this.coordinates.map(e=>e.slice(0,-1))};en.prototype=Object.create(ei.prototype),en.prototype.isValid=function(){return 0!==this.coordinates.length&&this.coordinates.every(e=>e.length>2)},en.prototype.incomingCoords=function(e){this.coordinates=e.map(e=>e.slice(0,-1)),this.changed()},en.prototype.setCoordinates=function(e){this.coordinates=e,this.changed()},en.prototype.addCoordinate=function(e,t,i){this.changed();let r=e.split(".").map(e=>parseInt(e,10));this.coordinates[r[0]].splice(r[1],0,[t,i])},en.prototype.removeCoordinate=function(e){this.changed();let t=e.split(".").map(e=>parseInt(e,10)),i=this.coordinates[t[0]];i&&(i.splice(t[1],1),i.length<3&&this.coordinates.splice(t[0],1))},en.prototype.getCoordinate=function(e){let t=e.split(".").map(e=>parseInt(e,10));return JSON.parse(JSON.stringify(this.coordinates[t[0]][t[1]]))},en.prototype.getCoordinates=function(){return this.coordinates.map(e=>e.concat([e[0]]))},en.prototype.updateCoordinate=function(e,t,i){this.changed();let r=e.split("."),s=parseInt(r[0],10),n=parseInt(r[1],10);void 0===this.coordinates[s]&&(this.coordinates[s]=[]),this.coordinates[s][n]=[t,i]};let eo={MultiPoint:er,MultiLineString:es,MultiPolygon:en},ea=(e,t,i,r,s)=>{let n=i.split("."),o=parseInt(n[0],10),a=n[1]?n.slice(1).join("."):null;return e[o][t](a,r,s)},el=function(e,t){if(ei.call(this,e,t),delete this.coordinates,this.model=eo[t.geometry.type],void 0===this.model)throw TypeError(`${t.geometry.type} is not a valid type`);this.features=this._coordinatesToFeatures(t.geometry.coordinates)};function eh(e){this.map=e.map,this.drawConfig=JSON.parse(JSON.stringify(e.options||{})),this._ctx=e}el.prototype=Object.create(ei.prototype),el.prototype._coordinatesToFeatures=function(e){let t=this.model.bind(this);return e.map(e=>new t(this.ctx,{id:et(),type:u.FEATURE,properties:{},geometry:{coordinates:e,type:this.type.replace("Multi","")}}))},el.prototype.isValid=function(){return this.features.every(e=>e.isValid())},el.prototype.setCoordinates=function(e){this.features=this._coordinatesToFeatures(e),this.changed()},el.prototype.getCoordinate=function(e){return ea(this.features,"getCoordinate",e)},el.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.features.map(e=>e.type===u.POLYGON?e.getCoordinates():e.coordinates)))},el.prototype.updateCoordinate=function(e,t,i){ea(this.features,"updateCoordinate",e,t,i),this.changed()},el.prototype.addCoordinate=function(e,t,i){ea(this.features,"addCoordinate",e,t,i),this.changed()},el.prototype.removeCoordinate=function(e){ea(this.features,"removeCoordinate",e),this.changed()},el.prototype.getFeatures=function(){return this.features},eh.prototype.setSelected=function(e){return this._ctx.store.setSelected(e)},eh.prototype.setSelectedCoordinates=function(e){this._ctx.store.setSelectedCoordinates(e),e.reduce((e,t)=>
1310(void 0===e[t.feature_id]&&(e[t.feature_id]=!0,this._ctx.store.get(t.feature_id).changed()),e),{})},eh.prototype.getSelected=function(){return this._ctx.store.getSelected()},eh.prototype.getSelectedIds=function(){return this._ctx.store.getSelectedIds()},eh.prototype.isSelected=function(e){return this._ctx.store.isSelected(e)},eh.prototype.getFeature=function(e){return this._ctx.store.get(e)},eh.prototype.select=function(e){return this._ctx.store.select(e)},eh.prototype.deselect=function(e){return this._ctx.store.deselect(e)},eh.prototype.deleteFeature=function(e,t={}){return this._ctx.store.delete(e,t)},eh.prototype.addFeature=function(e,t={}){return this._ctx.store.add(e,t)},eh.prototype.clearSelectedFeatures=function(){return this._ctx.store.clearSelected()},eh.prototype.clearSelectedCoordinates=function(){return this._ctx.store.clearSelectedCoordinates()},eh.prototype.setActionableState=function(e={}){let t={trash:e.trash||!1,combineFeatures:e.combineFeatures||!1,uncombineFeatures:e.uncombineFeatures||!1};return this._ctx.events.actionable(t)},eh.prototype.changeMode=function(e,t={},i={}){return this._ctx.events.changeMode(e,t,i)},eh.prototype.fire=function(e,t){return this._ctx.events.fire(e,t)},eh.prototype.updateUIClasses=function(e){return this._ctx.ui.queueMapClasses(e)},eh.prototype.activateUIButton=function(e){return this._ctx.ui.setActiveButton(e)},eh.prototype.featuresAt=function(e,t,i="click"){if("click"!==i&&"touch"!==i)throw Error("invalid buffer type");return K[i](e,t,this._ctx)},eh.prototype.newFeature=function(e){let t=e.geometry.type;return t===u.POINT?new er(this._ctx,e):t===u.LINE_STRING?new es(this._ctx,e):t===u.POLYGON?new en(this._ctx,e):new el(this._ctx,e)},eh.prototype.isInstanceOf=function(e,t){if(e===u.POINT)return t instanceof er;if(e===u.LINE_STRING)return t instanceof es;if(e===u.POLYGON)return t instanceof en;if("MultiFeature"===e)return t instanceof el;throw Error(`Unknown feature class: ${e}`)},eh.prototype.doRender=function(e){return this._ctx.store.featureChanged(e)},eh.prototype.onSetup=function(){},eh.prototype.onDrag=function(){},eh.prototype.onClick=function(){},eh.prototype.onMouseMove=function(){},eh.prototype.onMouseDown=function(){},eh.prototype.onMouseUp=function(){},eh.prototype.onMouseOut=function(){},eh.prototype.onKeyUp=function(){},eh.prototype.onKeyDown=function(){},eh.prototype.onTouchStart=function(){},eh.prototype.onTouchMove=function(){},eh.prototype.onTouchEnd=function(){},eh.prototype.onTap=function(){},eh.prototype.onStop=function(){},eh.prototype.onTrash=function(){},eh.prototype.onCombineFeature=function(){},eh.prototype.onUncombineFeature=function(){},eh.prototype.toDisplayFeatures=function(){throw Error("You must overwrite toDisplayFeatures")};let eu={drag:"onDrag",click:"onClick",mousemove:"onMouseMove",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseout:"onMouseOut",keyup:"onKeyUp",keydown:"onKeyDown",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",tap:"onTap"},ec=Object.keys(eu),ed=function(e){return[].concat(e).filter(e=>void 0!==e)};function ef(){let e=this;if(!(e.ctx.map&&void 0!==e.ctx.map.getSource(a.HOT)))return l();let t=e.ctx.events.currentModeName();e.ctx.ui.queueMapClasses({mode:t});let i=[],r=[];e.isDirty?r=e.getAllIds():(i=e.getChangedIds().filter(t=>void 0!==e.get(t)),r=e.sources.hot.filter(t=>t.properties.id&&-1===i.indexOf(t.properties.id)&&void 0!==e.get(t.properties.id)).map(e=>e.properties.id)),e.sources.hot=[];let s=e.sources.cold.length;e.sources.cold=e.isDirty?[]:e.sources.cold.filter(e=>{let t=e.properties.id||e.properties.parent;return -1===i.indexOf(t)});let n=s!==e.sources.cold.length||r.length>0;function o(i,r){let s=e.get(i).internal(t);e.ctx.events.currentModeRender(s,i=>{i.properties.mode=t,e.sources[r].push(i)})}function l(){e.isDirty=!1,e.clearChangedIds()}i.forEach(e=>o(e,"hot")),r.forEach(e=>o(e,"cold")),n&&e.ctx.map.getSource(a.COLD).setData({type:u.FEATURE_COLLECTION,features:e.sources.cold}),e.ctx.map.getSource(a.HOT).setData({type:u.FEATURE_COLLECTION,features:e.sources.hot}),l()}function ep(e){let t;this._features={},this._featureIds=new H,this._selectedFeatureIds=new H,this._selectedCoordinates=[],this._changedFeatureIds=new H,this._emitSelectionChange=!1,this._mapInitialConfig={},this.ctx=e,this.sources={hot:[],cold:[]},this.render=()=>{t||(t=requestAnimationFrame(()=>{t=null,ef.call(this),this._emitSelectionChange&&(this.ctx.events.fire(d.SELECTION_CHANGE,{features:this.getSelected().map(e=>e.toGeoJSON()),points:this.getSelectedCoordinates().map(e=>({type:u.FEATURE,properties:{},geometry:{type:u.POINT,coordinates:e.coordinates}}))}),this._emitSelectionChange=!1),this.ctx.events.fire(d.RENDER,{})}))},this.isDirty=!1}function eg(e,t={}){let i=e._selectedCoordinates.filter(t=>e._selectedFeatureIds.has(t.feature_id));e._selectedCoordinates.length===i.length||t.silent||(e._emitSelectionChange=!0),e._selectedCoordinates=i}ep.prototype.createRenderBatch=function(){let e=this.render,t=0;return this.render=function(){t++},()=>{this.render=e,t>0&&this.render()}},ep.prototype.setDirty=function(){return this.isDirty=!0,this},ep.prototype.featureCreated=function(e,t={}
1310){if(this._changedFeatureIds.add(e),!0!==(null!=t.silent?t.silent:this.ctx.options.suppressAPIEvents)){let t=this.get(e);this.ctx.events.fire(d.CREATE,{features:[t.toGeoJSON()]})}return this},ep.prototype.featureChanged=function(e,t={}){return this._changedFeatureIds.add(e),!0!==(null!=t.silent?t.silent:this.ctx.options.suppressAPIEvents)&&this.ctx.events.fire(d.UPDATE,{action:t.action?t.action:f.CHANGE_COORDINATES,features:[this.get(e).toGeoJSON()]}),this},ep.prototype.getChangedIds=function(){return this._changedFeatureIds.values()},ep.prototype.clearChangedIds=function(){return this._changedFeatureIds.clear(),this},ep.prototype.getAllIds=function(){return this._featureIds.values()},ep.prototype.add=function(e,t={}){return this._features[e.id]=e,this._featureIds.add(e.id),this.featureCreated(e.id,{silent:t.silent}),this},ep.prototype.delete=function(e,t={}){let i=[];return ed(e).forEach(e=>{this._featureIds.has(e)&&(this._featureIds.delete(e),this._selectedFeatureIds.delete(e),t.silent||-1!==i.indexOf(this._features[e])||i.push(this._features[e].toGeoJSON()),delete this._features[e],this.isDirty=!0)}),i.length&&this.ctx.events.fire(d.DELETE,{features:i}),eg(this,t),this},ep.prototype.get=function(e){return this._features[e]},ep.prototype.getAll=function(){return Object.keys(this._features).map(e=>this._features[e])},ep.prototype.select=function(e,t={}){return ed(e).forEach(e=>{!this._selectedFeatureIds.has(e)&&(this._selectedFeatureIds.add(e),this._changedFeatureIds.add(e),t.silent||(this._emitSelectionChange=!0))}),this},ep.prototype.deselect=function(e,t={}){return ed(e).forEach(e=>{this._selectedFeatureIds.has(e)&&(this._selectedFeatureIds.delete(e),this._changedFeatureIds.add(e),t.silent||(this._emitSelectionChange=!0))}),eg(this,t),this},ep.prototype.clearSelected=function(e={}){return this.deselect(this._selectedFeatureIds.values(),{silent:e.silent}),this},ep.prototype.setSelected=function(e,t={}){return e=ed(e),this.deselect(this._selectedFeatureIds.values().filter(t=>-1===e.indexOf(t)),{silent:t.silent}),this.select(e.filter(e=>!this._selectedFeatureIds.has(e)),{silent:t.silent}),this},ep.prototype.setSelectedCoordinates=function(e){return this._selectedCoordinates=e,this._emitSelectionChange=!0,this},ep.prototype.clearSelectedCoordinates=function(){return this._selectedCoordinates=[],this._emitSelectionChange=!0,this},ep.prototype.getSelectedIds=function(){return this._selectedFeatureIds.values()},ep.prototype.getSelected=function(){return this.getSelectedIds().map(e=>this.get(e))},ep.prototype.getSelectedCoordinates=function(){return this._selectedCoordinates.map(e=>({coordinates:this.get(e.feature_id).getCoordinate(e.coord_path)}))},ep.prototype.isSelected=function(e){return this._selectedFeatureIds.has(e)},ep.prototype.setFeatureProperty=function(e,t,i,r={}){this.get(e).setProperty(t,i),this.featureChanged(e,{silent:r.silent,action:f.CHANGE_PROPERTIES})},ep.prototype.storeMapConfig=function(){m.forEach(e=>{this.ctx.map[e]&&(this._mapInitialConfig[e]=this.ctx.map[e].isEnabled())})},ep.prototype.restoreMapConfig=function(){Object.keys(this._mapInitialConfig).forEach(e=>{this._mapInitialConfig[e]?this.ctx.map[e].enable():this.ctx.map[e].disable()})},ep.prototype.getInitialConfigValue=function(e){return void 0===this._mapInitialConfig[e]||this._mapInitialConfig[e]};let em=["mode","feature","mouse"],e_="#3bb2d0",ey="#fbb03b",ev="#fff",eb=[{id:"gl-draw-polygon-fill",type:"fill",filter:["all",["==","$type","Polygon"]],paint:{"fill-color":["case",["==",["get","active"],"true"],ey,e_],"fill-opacity":.1}},{id:"gl-draw-lines",type:"line",filter:["any",["==","$type","LineString"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["case",["==",["get","active"],"true"],ey,e_],"line-dasharray":["case",["==",["get","active"],"true"],[.2,2],[2,0]],"line-width":2}},{id:"gl-draw-point-outer",type:"circle",filter:["all",["==","$type","Point"],["==","meta","feature"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],7,5],"circle-color":ev}},{id:"gl-draw-point-inner",type:"circle",filter:["all",["==","$type","Point"],["==","meta","feature"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],5,3],"circle-color":["case",["==",["get","active"],"true"],ey,e_]}},{id:"gl-draw-vertex-outer",type:"circle",filter:["all",["==","$type","Point"],["==","meta","vertex"],["!=","mode","simple_select"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],7,5],"circle-color":ev}},{id:"gl-draw-vertex-inner",type:"circle",filter:["all",["==","$type","Point"],["==","meta","vertex"],["!=","mode","simple_select"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],5,3],"circle-color":ey}},{id:"gl-draw-midpoint",type:"circle",filter:["all",["==","meta","midpoint"]],paint:{"circle-radius":3,"circle-color":ey}}];function eE(e,t){this.x=e,this.y=t}eE.prototype={clone(){return new eE(this.x,this.y)},add(e){return this.clone()._add(e)},sub(e){return this.clone()._sub(e)},multByPoint(e){return this.clone()._multByPoint(e)},divByPoint(e){return this.clone()._divByPoint(e)},mult(e){return this.clone()._mult(e)},div(e){return this.clone()._div(e)},rotate(e){return this.clone()._rotate(e)}
1310,rotateAround(e,t){return this.clone()._rotateAround(e,t)},matMult(e){return this.clone()._matMult(e)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(e){return this.x===e.x&&this.y===e.y},dist(e){return Math.sqrt(this.distSqr(e))},distSqr(e){let t=e.x-this.x,i=e.y-this.y;return t*t+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith(e){return this.angleWithSep(e.x,e.y)},angleWithSep(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult(e){let t=e[0]*this.x+e[1]*this.y,i=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=i,this},_add(e){return this.x+=e.x,this.y+=e.y,this},_sub(e){return this.x-=e.x,this.y-=e.y,this},_mult(e){return this.x*=e,this.y*=e,this},_div(e){return this.x/=e,this.y/=e,this},_multByPoint(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint(e){return this.x/=e.x,this.y/=e.y,this},_unit(){return this._div(this.mag()),this},_perp(){let e=this.y;return this.y=this.x,this.x=-e,this},_rotate(e){let t=Math.cos(e),i=Math.sin(e),r=t*this.x-i*this.y,s=i*this.x+t*this.y;return this.x=r,this.y=s,this},_rotateAround(e,t){let i=Math.cos(e),r=Math.sin(e),s=t.x+i*(this.x-t.x)-r*(this.y-t.y),n=t.y+r*(this.x-t.x)+i*(this.y-t.y);return this.x=s,this.y=n,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:eE},eE.convert=function(e){if(e instanceof eE)return e;if(Array.isArray(e))return new eE(+e[0],+e[1]);if(void 0!==e.x&&void 0!==e.y)return new eE(+e.x,+e.y);throw Error("Expected [x, y] or {x, y} point format")};let ex=function(e,t){let i=t.getBoundingClientRect();return new eE(e.clientX-i.left-(t.clientLeft||0),e.clientY-i.top-(t.clientTop||0))};function ew(e,t,i,r){return{type:u.FEATURE,properties:{meta:p.VERTEX,parent:e,coord_path:i,active:r?g.ACTIVE:g.INACTIVE},geometry:{type:u.POINT,coordinates:t}}}var eS=i(74503),eP=i(85347);function eT(e){let t={type:"Feature"};return Object.keys(e).forEach(i=>{switch(i){case"type":case"properties":case"geometry":return;default:t[i]=e[i]}}),t.properties=function e(t){let i={};return t&&Object.keys(t).forEach(r=>{let s=t[r];"object"==typeof s?null===s?i[r]=null:Array.isArray(s)?i[r]=s.map(e=>e):i[r]=e(s):i[r]=s}),i}(e.properties),null==e.geometry?t.geometry=null:t.geometry=eA(e.geometry),t}function eA(e){let t={type:e.type};return(e.bbox&&(t.bbox=e.bbox),"GeometryCollection"===e.type)?t.geometries=e.geometries.map(e=>eA(e)):t.coordinates=function e(t){return"object"!=typeof t[0]?t.slice():t.map(t=>e(t))}(e.coordinates),t}function eM(e,t={}){return eC(e,"mercator",t)}function eC(e,t,i={}){var r=(i=i||{}).mutate;if(!e)throw Error("geojson is required");return Array.isArray(e)&&(0,eP.Et)(e[0])?e="mercator"===t?eR(e):eL(e):(!0!==r&&(e=function(e){if(!e)throw Error("geojson is required");switch(e.type){case"Feature":return eT(e);case"FeatureCollection":var t=e;let i={type:"FeatureCollection"};return Object.keys(t).forEach(e=>{switch(e){case"type":case"features":return;default:i[e]=t[e]}}),i.features=t.features.map(e=>eT(e)),i;case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return eA(e);default:throw Error("unknown GeoJSON type")}}(e)),(0,eS.Fh)(e,function(e){var i="mercator"===t?eR(e):eL(e);e[0]=i[0],e[1]=i[1]})),e}function eR(e){var t,i=Math.PI/180,r=[6378137*(180>=Math.abs(e[0])?e[0]:e[0]-360*((t=e[0])<0?-1:+(t>0)))*i,6378137*Math.log(Math.tan(.25*Math.PI+.5*e[1]*i))];return r[0]>20037508.342789244&&(r[0]=20037508.342789244),r[0]<-20037508.342789244&&(r[0]=-20037508.342789244),r[1]>20037508.342789244&&(r[1]=20037508.342789244),r[1]<-20037508.342789244&&(r[1]=-20037508.342789244),r}function eL(e){var t=180/Math.PI;return[e[0]*t/6378137,(.5*Math.PI-2*Math.atan(Math.exp(-e[1]/6378137)))*t]}function eI(e,t,i){let r=t.geometry.coordinates,s=i.geometry.coordinates;if(r[1]>b||r[1]<y||s[1]>b||s[1]<y)return null;let n=eM(r),o=eM(s),a=e=>Number(e.toFixed(8)),l=function(e,t={}){return eC(e,"wgs84",t)}([(n[0]+o[0])/2,(n[1]+o[1])/2]),h=[a(l[0]),a(l[1])];return{type:u.FEATURE,properties:{meta:p.MIDPOINT,parent:e,lng:h[0],lat:h[1],coord_path:i.properties.coord_path},geometry:{type:u.POINT,coordinates:h}}}let eO=function e(t,i={},r=null){let{type:s,coordinates:n}=t.geometry,o=t.properties&&t.properties.id,a=[];function l(e,t){let r="",s=null;e.forEach((e,n)=>{let l=null!=t?`${t}.${n}`:String(n),u=ew(o,e,l,h(l));if(i.midpoints&&s){let e=eI(o,s,u);e&&a.push(e)}s=u;let c=JSON.stringify(e);r!==c&&a.push(u),0===n&&(r=c)})}function h(e){return!!i.selectedPaths&&-1!==i.selectedPaths.indexOf(e)}return s===u.POINT?a.push(ew(o,n,r,h(r))):s===u.POLYGON?n.forEac
1310h((e,t)=>{l(e,null!==r?`${r}.${t}`:String(t))}):s===u.LINE_STRING?l(n,r):0===s.indexOf(u.MULTI_PREFIX)&&function(){let r=s.replace(u.MULTI_PREFIX,"");n.forEach((s,n)=>{let o={type:u.FEATURE,properties:t.properties,geometry:{type:r,coordinates:s}};a=a.concat(e(o,i,n))})}(),a},eN={enable(e){setTimeout(()=>{e.map&&e.map.doubleClickZoom&&e._ctx&&e._ctx.store&&e._ctx.store.getInitialConfigValue&&e._ctx.store.getInitialConfigValue("doubleClickZoom")&&e.map.doubleClickZoom.enable()},0)},disable(e){setTimeout(()=>{e.map&&e.map.doubleClickZoom&&e.map.doubleClickZoom.disable()},0)}},{LAT_MIN:eF,LAT_MAX:eD,LAT_RENDERED_MIN:eB,LAT_RENDERED_MAX:eG,LNG_MIN:ek,LNG_MAX:eU}=r;function ez(e,t){let i=eF,r=eD,s=eF,n=eD,o=eU,a=ek;return e.forEach(e=>{let t=function(e){let t={Point:0,LineString:1,Polygon:2,MultiPoint:1,MultiLineString:2,MultiPolygon:3}[e.geometry.type],i=[e.geometry.coordinates].flat(t),r=i.map(e=>e[0]),s=i.map(e=>e[1]),n=e=>Math.min.apply(null,e),o=e=>Math.max.apply(null,e);return[n(r),n(s),o(r),o(s)]}(e),l=t[1],h=t[3],u=t[0],c=t[2];l>i&&(i=l),h<r&&(r=h),h>s&&(s=h),l<n&&(n=l),u<o&&(o=u),c>a&&(a=c)}),i+t.lat>eG&&(t.lat=eG-i),s+t.lat>eD&&(t.lat=eD-s),r+t.lat<eB&&(t.lat=eB-r),n+t.lat<eF&&(t.lat=eF-n),o+t.lng<=ek&&(t.lng+=360*Math.ceil(Math.abs(t.lng)/360)),a+t.lng>=eU&&(t.lng-=360*Math.ceil(Math.abs(t.lng)/360)),t}function ej(e,t){let i=ez(e.map(e=>e.toGeoJSON()),t);e.forEach(e=>{let t,r=e.getCoordinates(),s=e=>{let t={lng:e[0]+i.lng,lat:e[1]+i.lat};return[t.lng,t.lat]},n=e=>e.map(e=>s(e));e.type===u.POINT?t=s(r):e.type===u.LINE_STRING||e.type===u.MULTI_POINT?t=r.map(s):e.type===u.POLYGON||e.type===u.MULTI_LINE_STRING?t=r.map(n):e.type===u.MULTI_POLYGON&&(t=r.map(e=>e.map(e=>n(e)))),e.incomingCoords(t)})}let eV={};eV.onSetup=function(e){let t={dragMoveLocation:null,boxSelectStartLocation:null,boxSelectElement:void 0,boxSelecting:!1,canBoxSelect:!1,dragMoving:!1,canDragMove:!1,initialDragPanState:this.map.dragPan.isEnabled(),initiallySelectedFeatureIds:e.featureIds||[]};return this.setSelected(t.initiallySelectedFeatureIds.filter(e=>void 0!==this.getFeature(e))),this.fireActionable(),this.setActionableState({combineFeatures:!0,uncombineFeatures:!0,trash:!0}),t},eV.fireUpdate=function(){this.fire(d.UPDATE,{action:f.MOVE,features:this.getSelected().map(e=>e.toGeoJSON())})},eV.fireActionable=function(){let e=this.getSelected(),t=e.filter(e=>this.isInstanceOf("MultiFeature",e)),i=!1;if(e.length>1){i=!0;let t=e[0].type.replace("Multi","");e.forEach(e=>{e.type.replace("Multi","")!==t&&(i=!1)})}let r=t.length>0,s=e.length>0;this.setActionableState({combineFeatures:i,uncombineFeatures:r,trash:s})},eV.getUniqueIds=function(e){return e.length?e.map(e=>e.properties.id).filter(e=>void 0!==e).reduce((e,t)=>(e.add(t),e),new H).values():[]},eV.stopExtendedInteractions=function(e){e.boxSelectElement&&(e.boxSelectElement.parentNode&&e.boxSelectElement.parentNode.removeChild(e.boxSelectElement),e.boxSelectElement=null),(e.canDragMove||e.canBoxSelect)&&!0===e.initialDragPanState&&this.map.dragPan.enable(),e.boxSelecting=!1,e.canBoxSelect=!1,e.dragMoving=!1,e.canDragMove=!1},eV.onStop=function(){eN.enable(this)},eV.onMouseMove=function(e,t){return M(t)&&e.dragMoving&&this.fireUpdate(),this.stopExtendedInteractions(e),!0},eV.onMouseOut=function(e){return!e.dragMoving||this.fireUpdate()},eV.onTap=eV.onClick=function(e,t){return A(t)?this.clickAnywhere(e,t):w(p.VERTEX)(t)?this.clickOnVertex(e,t):M(t)?this.clickOnFeature(e,t):void 0},eV.clickAnywhere=function(e){let t=this.getSelectedIds();t.length&&(this.clearSelectedFeatures(),t.forEach(e=>this.doRender(e))),eN.enable(this),this.stopExtendedInteractions(e)},eV.clickOnVertex=function(e,t){this.changeMode(c.DIRECT_SELECT,{featureId:t.featureTarget.properties.parent,coordPath:t.featureTarget.properties.coord_path,startPos:t.lngLat}),this.updateUIClasses({mouse:l.MOVE})},eV.startOnActiveFeature=function(e,t){this.stopExtendedInteractions(e),this.map.dragPan.disable(),this.doRender(t.featureTarget.properties.id),e.canDragMove=!0,e.dragMoveLocation=t.lngLat},eV.clickOnFeature=function(e,t){eN.disable(this),this.stopExtendedInteractions(e);let i=R(t),r=this.getSelectedIds(),s=t.featureTarget.properties.id,n=this.isSelected(s);if(!i&&n&&this.getFeature(s).type!==u.POINT)return this.changeMode(c.DIRECT_SELECT,{featureId:s});n&&i?(this.deselect(s),this.updateUIClasses({mouse:l.POINTER}),1===r.length&&eN.enable(this)):!n&&i?(this.select(s),this.updateUIClasses({mouse:l.MO
1310VE})):n||i||(r.forEach(e=>this.doRender(e)),this.setSelected(s),this.updateUIClasses({mouse:l.MOVE})),this.doRender(s)},eV.onMouseDown=function(e,t){return(e.initialDragPanState=this.map.dragPan.isEnabled(),P(t))?this.startOnActiveFeature(e,t):this.drawConfig.boxSelect&&S(t)?this.startBoxSelect(e,t):void 0},eV.startBoxSelect=function(e,t){this.stopExtendedInteractions(e),this.map.dragPan.disable(),e.boxSelectStartLocation=ex(t.originalEvent,this.map.getContainer()),e.canBoxSelect=!0},eV.onTouchStart=function(e,t){if(P(t))return this.startOnActiveFeature(e,t)},eV.onDrag=function(e,t){return e.canDragMove?this.dragMove(e,t):this.drawConfig.boxSelect&&e.canBoxSelect?this.whileBoxSelect(e,t):void 0},eV.whileBoxSelect=function(e,t){e.boxSelecting=!0,this.updateUIClasses({mouse:l.ADD}),e.boxSelectElement||(e.boxSelectElement=document.createElement("div"),e.boxSelectElement.classList.add(o.BOX_SELECT),this.map.getContainer().appendChild(e.boxSelectElement));let i=ex(t.originalEvent,this.map.getContainer()),r=Math.min(e.boxSelectStartLocation.x,i.x),s=Math.max(e.boxSelectStartLocation.x,i.x),n=Math.min(e.boxSelectStartLocation.y,i.y),a=Math.max(e.boxSelectStartLocation.y,i.y),h=`translate(${r}px, ${n}px)`;e.boxSelectElement.style.transform=h,e.boxSelectElement.style.WebkitTransform=h,e.boxSelectElement.style.width=`${s-r}px`,e.boxSelectElement.style.height=`${a-n}px`},eV.dragMove=function(e,t){e.dragMoving=!0,t.originalEvent.stopPropagation();let i={lng:t.lngLat.lng-e.dragMoveLocation.lng,lat:t.lngLat.lat-e.dragMoveLocation.lat};ej(this.getSelected(),i),e.dragMoveLocation=t.lngLat},eV.onTouchEnd=eV.onMouseUp=function(e,t){if(e.dragMoving)this.fireUpdate();else if(e.boxSelecting){let i=[e.boxSelectStartLocation,ex(t.originalEvent,this.map.getContainer())],r=this.featuresAt(null,i,"click"),s=this.getUniqueIds(r).filter(e=>!this.isSelected(e));s.length&&(this.select(s),s.forEach(e=>this.doRender(e)),this.updateUIClasses({mouse:l.MOVE}))}this.stopExtendedInteractions(e)},eV.toDisplayFeatures=function(e,t,i){t.properties.active=this.isSelected(t.properties.id)?g.ACTIVE:g.INACTIVE,i(t),this.fireActionable(),t.properties.active===g.ACTIVE&&t.geometry.type!==u.POINT&&eO(t).forEach(i)},eV.onTrash=function(){this.deleteFeature(this.getSelectedIds()),this.fireActionable()},eV.onCombineFeatures=function(){let e=this.getSelected();if(0===e.length||e.length<2)return;let t=[],i=[],r=e[0].type.replace("Multi","");for(let s=0;s<e.length;s++){let n=e[s];if(n.type.replace("Multi","")!==r)return;
1310n.type.includes("Multi")?n.getCoordinates().forEach(e=>{t.push(e)}):t.push(n.getCoordinates()),i.push(n.toGeoJSON())}if(i.length>1){let e=this.newFeature({type:u.FEATURE,properties:i[0].properties,geometry:{type:`Multi${r}`,coordinates:t}});this.addFeature(e),this.deleteFeature(this.getSelectedIds(),{silent:!0}),this.setSelected([e.id]),this.fire(d.COMBINE_FEATURES,{createdFeatures:[e.toGeoJSON()],deletedFeatures:i})}this.fireActionable()},eV.onUncombineFeatures=function(){let e=this.getSelected();if(0===e.length)return;let t=[],i=[];for(let r=0;r<e.length;r++){let s=e[r];this.isInstanceOf("MultiFeature",s)&&(s.getFeatures().forEach(e=>{this.addFeature(e),e.properties=s.properties,t.push(e.toGeoJSON()),this.select([e.id])}),this.deleteFeature(s.id,{silent:!0}),i.push(s.toGeoJSON()))}t.length>1&&this.fire(d.UNCOMBINE_FEATURES,{createdFeatures:t,deletedFeatures:i}),this.fireActionable()};let eW=w(p.VERTEX),e$=w(p.MIDPOINT),eH={};eH.fireUpdate=function(){this.fire(d.UPDATE,{action:f.CHANGE_COORDINATES,features:this.getSelected().map(e=>e.toGeoJSON())})},eH.fireActionable=function(e){this.setActionableState({combineFeatures:!1,uncombineFeatures:!1,trash:e.selectedCoordPaths.length>0})},eH.startDragging=function(e,t){null==e.initialDragPanState&&(e.initialDragPanState=this.map.dragPan.isEnabled()),this.map.dragPan.disable(),e.canDragMove=!0,e.dragMoveLocation=t.lngLat},eH.stopDragging=function(e){e.canDragMove&&!0===e.initialDragPanState&&this.map.dragPan.enable(),e.initialDragPanState=null,e.dragMoving=!1,e.canDragMove=!1,e.dragMoveLocation=null},eH.onVertex=function(e,t){this.startDragging(e,t);let i=t.featureTarget.properties,r=e.selectedCoordPaths.indexOf(i.coord_path);R(t)||-1!==r?R(t)&&-1===r&&e.selectedCoordPaths.push(i.coord_path):e.selectedCoordPaths=[i.coord_path];let s=this.pathsToCoordinates(e.featureId,e.selectedCoordPaths);this.setSelectedCoordinates(s)},eH.onMidpoint=function(e,t){this.startDragging(e,t);let i=t.featureTarget.properties;e.feature.addCoordinate(i.coord_path,i.lng,i.lat),this.fireUpdate(),e.selectedCoordPaths=[i.coord_path]},eH.pathsToCoordinates=function(e,t){return t.map(t=>({feature_id:e,coord_path:t}))},eH.onFeature=function(e,t){0===e.selectedCoordPaths.length?this.startDragging(e,t):this.stopDragging(e)},eH.dragFeature=function(e,t,i){ej(this.getSelected(),i),e.dragMoveLocation=t.lngLat},eH.dragVertex=function(e,t,i){let r=e.selectedCoordPaths.map(t=>e.feature.getCoordinate(t)),s=ez(r.map(e=>({type:u.FEATURE,properties:{},geometry:{type:u.POINT,coordinates:e}})),i);for(let t=0;t<r.length;t++){let i=r[t];e.feature.updateCoordinate(e.selectedCoordPaths[t],i[0]+s.lng,i[1]+s.lat)}},eH.clickNoTarget=function(){this.changeMode(c.SIMPLE_SELECT)},eH.clickInactive=function(){this.changeMode(c.SIMPLE_SELECT)},eH.clickActiveFeature=function(e){e.selectedCoordPaths=[],this.clearSelectedCoordinates(),e.feature.changed()},eH.onSetup=function(e){let t=e.featureId,i=this.getFeature(t);if(!i)throw Error("You must provide a featureId to enter direct_select mode");if(i.type===u.POINT)throw TypeError("direct_select mode doesn't handle point features");let r={featureId:t,feature:i,dragMoveLocation:e.startPos||null,dragMoving:!1,canDragMove:!1,selectedCoordPaths:e.coordPath?[e.coordPath]:[]};return this.setSelectedCoordinates(this.pathsToCoordinates(t,r.selectedCoordPaths)),this.setSelected(t),eN.disable(this),this.setActionableState({trash:!0}),r},eH.onStop=function(){eN.enable(this),this.clearSelectedCoordinates()},eH.toDisplayFeatures=function(e,t,i){e.featureId===t.properties.id?(t.properties.active=g.ACTIVE,i(t),eO(t,{map:this.map,midpoints:!0,selectedPaths:e.selectedCoordPaths}).forEach(i)):(t.properties.active=g.INACTIVE,i(t)),this.fireActionable(e)},eH.onTrash=function(e){e.selectedCoordPaths.sort((e,t)=>t.localeCompare(e,"en",{numeric:!0})).forEach(t=>e.feature.removeCoordinate(t)),this.fireUpdate(),e.selectedCoordPaths=[],this.clearSelectedCoordinates(),this.fireActionable(e),!1===e.feature.isValid()&&(this.deleteFeature([e.featureId]),this.changeMode(c.SIMPLE_SELECT,{}))},eH.onMouseMove=function(e,t){let i=P(t),r=eW(t),s=e$(t),n=0===e.selectedCoordPaths.length;
1310return i&&n||r&&!n?this.updateUIClasses({mouse:l.MOVE}):this.updateUIClasses({mouse:l.NONE}),(r||i||s)&&e.dragMoving&&this.fireUpdate(),this.stopDragging(e),!0},eH.onMouseOut=function(e){return e.dragMoving&&this.fireUpdate(),!0},eH.onTouchStart=eH.onMouseDown=function(e,t){return eW(t)?this.onVertex(e,t):P(t)?this.onFeature(e,t):e$(t)?this.onMidpoint(e,t):void 0},eH.onDrag=function(e,t){if(!0!==e.canDragMove)return;e.dragMoving=!0,t.originalEvent.stopPropagation();let i={lng:t.lngLat.lng-e.dragMoveLocation.lng,lat:t.lngLat.lat-e.dragMoveLocation.lat};e.selectedCoordPaths.length>0?this.dragVertex(e,t,i):this.dragFeature(e,t,i),e.dragMoveLocation=t.lngLat},eH.onClick=function(e,t){return A(t)?this.clickNoTarget(e,t):P(t)?this.clickActiveFeature(e,t):T(t)?this.clickInactive(e,t):void this.stopDragging(e)},eH.onTap=function(e,t){return A(t)?this.clickNoTarget(e,t):P(t)?this.clickActiveFeature(e,t):T(t)?this.clickInactive(e,t):void 0},eH.onTouchEnd=eH.onMouseUp=function(e){e.dragMoving&&this.fireUpdate(),this.stopDragging(e)};let eq={};eq.onSetup=function(){let e=this.newFeature({type:u.FEATURE,properties:{},geometry:{type:u.POINT,coordinates:[]}});return this.addFeature(e),this.clearSelectedFeatures(),this.updateUIClasses({mouse:l.ADD}),this.activateUIButton(h.POINT),this.setActionableState({trash:!0}),{point:e}},eq.stopDrawingAndRemove=function(e){this.deleteFeature([e.point.id],{silent:!0}),this.changeMode(c.SIMPLE_SELECT)},eq.onTap=eq.onClick=function(e,t){this.updateUIClasses({mouse:l.MOVE}),e.point.updateCoordinate("",t.lngLat.lng,t.lngLat.lat),this.fire(d.CREATE,{features:[e.point.toGeoJSON()]}),this.changeMode(c.SIMPLE_SELECT,{featureIds:[e.point.id]})},eq.onStop=function(e){this.activateUIButton(),e.point.getCoordinate().length||this.deleteFeature([e.point.id],{silent:!0})},eq.toDisplayFeatures=function(e,t,i){let r=t.properties.id===e.point.id;if(t.properties.active=r?g.ACTIVE:g.INACTIVE,!r)return i(t)},eq.onTrash=eq.stopDrawingAndRemove,eq.onKeyUp=function(e,t){if(L(t)||I(t))return this.stopDrawingAndRemove(e,t)};let eK=function(e,t){return!!e.lngLat&&e.lngLat.lng===t[0]&&e.lngLat.lat===t[1]},eX={};eX.onSetup=function(){let e=this.newFeature({type:u.FEATURE,properties:{},geometry:{type:u.POLYGON,coordinates:[[]]}});return this.addFeature(e),this.clearSelectedFeatures(),eN.disable(this),this.updateUIClasses({mouse:l.ADD}),this.activateUIButton(h.POLYGON),this.setActionableState({trash:!0}),{polygon:e,currentVertexPosition:0}},eX.clickAnywhere=function(e,t){if(e.currentVertexPosition>0&&eK(t,e.polygon.coordinates[0][e.currentVertexPosition-1]))return this.changeMode(c.SIMPLE_SELECT,{featureIds:[e.polygon.id]});this.updateUIClasses({mouse:l.ADD}),e.polygon.updateCoordinate(`0.${e.currentVertexPosition}`,t.lngLat.lng,t.lngLat.lat),e.currentVertexPosition++,e.polygon.updateCoordinate(`0.${e.currentVertexPosition}`,t.lngLat.lng,t.lngLat.lat)},eX.clickOnVertex=function(e){return this.changeMode(c.SIMPLE_SELECT,{featureIds:[e.polygon.id]})},eX.onMouseMove=function(e,t){e.polygon.updateCoordinate(`0.${e.currentVertexPosition}`,t.lngLat.lng,t.lngLat.lat),C(t)&&this.updateUIClasses({mouse:l.POINTER})},eX.onTap=eX.onClick=function(e,t){return C(t)?this.clickOnVertex(e,t):this.clickAnywhere(e,t)},eX.onKeyUp=function(e,t){L(t)?(this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(c.SIMPLE_SELECT)):I(t)&&this.changeMode(c.SIMPLE_SELECT,{featureIds:[e.polygon.id]})},eX.onStop=function(e){this.updateUIClasses({mouse:l.NONE}),eN.enable(this),this.activateUIButton(),void 0!==this.getFeature(e.polygon.id)&&(e.polygon.removeCoordinate(`0.${e.currentVertexPosition}`),e.polygon.isValid()?this.fire(d.CREATE,{features:[e.polygon.toGeoJSON()]}):(this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(c.SIMPLE_SELECT,{},{silent:!0})))},eX.toDisplayFeatures=function(e,t,i){let r=t.properties.id===e.polygon.id;if(t.properties.active=r?g.ACTIVE:g.INACTIVE,!r)return i(t);if(0===t.geometry.coordinates.length)return;let s=t.geometry.coordinates[0].length;if(!(s<3)){if(t.properties.meta=p.FEATURE,i(ew(e.polygon.id,t.geometry.coordinates[0][0],"0.0",!1)),s>3){let r=t.geometry.coordinates[0].length-3;i(ew(e.polygon.id,t.geometry.coordinates[0][r],`0.${r}`,!1))}if(s<=4){let e=[[t.geometry.coordinates[0][0][0],t.geometry.coordinates[0][0][1]],[t.geometry.coordinates[0][1][0],t.geometry.coordinates[0][1][1]]];if(i({type:u.FEATURE,properties:t.properties,geometry:{coordinates:e,type:u.LINE_STRING}}),3===s)return}return i(t)}}
1310,eX.onTrash=function(e){this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(c.SIMPLE_SELECT)};let eY={};eY.onSetup=function(e){let t,i,r=(e=e||{}).featureId,s="forward";if(r){if(!(t=this.getFeature(r)))throw Error("Could not find a feature with the provided featureId");let n=e.from;if(n&&"Feature"===n.type&&n.geometry&&"Point"===n.geometry.type&&(n=n.geometry),n&&"Point"===n.type&&n.coordinates&&2===n.coordinates.length&&(n=n.coordinates),!n||!Array.isArray(n))throw Error("Please use the `from` property to indicate which point to continue the line from");let o=t.coordinates.length-1;if(t.coordinates[o][0]===n[0]&&t.coordinates[o][1]===n[1])i=o+1,t.addCoordinate(i,...t.coordinates[o]);else if(t.coordinates[0][0]===n[0]&&t.coordinates[0][1]===n[1])s="backwards",i=0,t.addCoordinate(i,...t.coordinates[0]);else throw Error("`from` should match the point at either the start or the end of the provided LineString")}else t=this.newFeature({type:u.FEATURE,properties:{},geometry:{type:u.LINE_STRING,coordinates:[]}}),i=0,this.addFeature(t);return this.clearSelectedFeatures(),eN.disable(this),this.updateUIClasses({mouse:l.ADD}),this.activateUIButton(h.LINE),this.setActionableState({trash:!0}),{line:t,currentVertexPosition:i,direction:s}},eY.clickAnywhere=function(e,t){if(e.currentVertexPosition>0&&eK(t,e.line.coordinates[e.currentVertexPosition-1])||"backwards"===e.direction&&eK(t,e.line.coordinates[e.currentVertexPosition+1]))return this.changeMode(c.SIMPLE_SELECT,{featureIds:[e.line.id]});this.updateUIClasses({mouse:l.ADD}),e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat),"forward"===e.direction?(e.currentVertexPosition++,e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat)):e.line.addCoordinate(0,t.lngLat.lng,t.lngLat.lat)},eY.clickOnVertex=function(e){return this.changeMode(c.SIMPLE_SELECT,{featureIds:[e.line.id]})},eY.onMouseMove=function(e,t){e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat),C(t)&&this.updateUIClasses({mouse:l.POINTER})},eY.onTap=eY.onClick=function(e,t){if(C(t))return this.clickOnVertex(e,t);this.clickAnywhere(e,t)},eY.onKeyUp=function(e,t){I(t)?this.changeMode(c.SIMPLE_SELECT,{featureIds:[e.line.id]}):L(t)&&(this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(c.SIMPLE_SELECT))},eY.onStop=function(e){eN.enable(this),this.activateUIButton(),void 0!==this.getFeature(e.line.id)&&(e.line.removeCoordinate(`${e.currentVertexPosition}`),e.line.isValid()?this.fire(d.CREATE,{features:[e.line.toGeoJSON()]}):(this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(c.SIMPLE_SELECT,{},{silent:!0})))},eY.onTrash=function(e){this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(c.SIMPLE_SELECT)},eY.toDisplayFeatures=function(e,t,i){let r=t.properties.id===e.line.id;if(t.properties.active=r?g.ACTIVE:g.INACTIVE,!r)return i(t);t.geometry.coordinates.length<2||(t.properties.meta=p.FEATURE,i(ew(e.line.id,t.geometry.coordinates["forward"===e.direction?t.geometry.coordinates.length-2:1],`${"forward"===e.direction?t.geometry.coordinates.length-2:1}`,!1)),i(t))};let eZ={simple_select:eV,direct_select:eH,draw_point:eq,draw_polygon:eX,draw_line_string:eY},eQ={defaultMode:c.SIMPLE_SELECT,keybindings:!0,touchEnabled:!0,clickBuffer:2,touchBuffer:25,boxSelect:!0,displayControlsDefault:!0,styles:eb,modes:eZ,controls:{},userProperties:!1,suppressAPIEvents:!0},eJ={point:!0,line_string:!0,polygon:!0,trash:!0,combine_features:!0,uncombine_features:!0},e0={point:!1,line_string:!1,polygon:!1,trash:!1,combine_features:!1,uncombine_features:!1};function e1(e,t){return e.map(e=>e.source?e:Object.assign({},e,{id:`${e.id}.${t}`,source:"hot"===t?a.HOT:a.COLD}))}var e3=i(26785),e2=i(50246);function e4(e,t){return e.length===t.length&&JSON.stringify(e.map(e=>e).sort())===JSON.stringify(t.map(e=>e).sort())}let e6={Polygon:en,LineString:es,Point:er,MultiPolygon:el,MultiLineString:el,MultiPoint:el},e8=function(e,t){let i={options:e=function(e={}){let t=Object.assign({},e);return e.controls||(t.controls={}),!1===e.displayControlsDefault?t.controls=Object.assign({},e0,e.controls):t.controls=Object.assign({},eJ,e.controls),(t=Object.assign({},eQ,t)).styles=e1(t.styles,"cold").concat(e1(t.styles,"hot")),t}(e)};t=function(e,t){t.modes=c;let i=void 0===e.options.suppressAPIEvents||!!e.options.suppressAPIEvents;return t.getFeatureIdsAt=function(t){return K.click({point:t},null,e).map(e=>e.properties.id)},t.getSelectedIds=function(){return e.store.getSelectedIds()},t.getSelected=function(){return{type:u.FEATURE_COLLECTION,features:e.store.getSelectedIds().map(t=>e.store.get(t)).map(e=>e.toGeoJSON())}},t.getSelectedPoints=function(){return{type:u.FEATURE_COLLECTION,features:e.store.getSelectedCoordinates().map(e=>({type:u.FEATURE,properties:{},geometry:{type:u.POINT,coordinates:e.coordinates}}))}},t.set=function(i){if(void 0===i.type||i.type!==u.FEATURE_COLLECTION||!Array.isArray(i.features))throw Error("Invalid FeatureCollection");let r=e.store.createRenderBatch(),s=e.store.getAllIds().slice(),n=t.add(i),o=new H(n);return(s=s.filter(e=>!o.has(e))).length&&t.delete(s),r(),n},t.add=function(t){let r=JSON.parse(JSON.stringify(e2(t))).features.map(t=>{if(t.id=t.id||et(),null===t.geometry)throw Error("Invalid geometry: null");if(void 0===e.store.get(t.id)||e.store.get(t.id).type!==t.geometry.type){let r=e6[t.geometry.type];if(void 0===r)throw Error(`Invalid geometry type: ${t.geometry.type}.`);let s=new r(e,t);e.store.add(s,{silent:i})}else{let r=e.store.get(t.id),s=r.properties;r.properties=t.properties,e3(s,t.properties)||e.store.featureChanged(r.id,{silent:i}),e3(r.getCoordinates(),t.geometry.coordinates)||r.incomingCoords(t.geometry.coordinates)}return t.id});return e.store.render(),r},t.get=function(t){let i=e.store.get(t);if(i)return i.toGeoJSON()},t.getAll=function(){return{type:u.FEATURE_COLLECTION,features:e.store.getAll().map(e=>e.toGeoJSON())}},t.delete=function(r){return e.store.delete(r,{silent:i}),t.getMode()!==c.DIRECT_SELECT||e.store.getSelectedIds().length?e.store.render():e.events.changeMode(c.SIMPLE_SELECT,void 0,{silent:i}),t},t.deleteAll=function(){return e.store.delete(e.store.getAllIds(),{silent:i}),t.getMode()===c.DIRECT_SELECT?e.events.changeMode(c.SIMPLE_SELECT,void 0,{silent:i}):e.store.render(),t},t.changeMode=function(r,s={}){return r===c.SIMPLE_SELECT&&t.getMode()===c.SIMPLE_SELECT?(e4(s.featureIds||[],e.store.getSelectedIds())||
1310(e.store.setSelected(s.featureIds,{silent:i}),e.store.render()),t):(r===c.DIRECT_SELECT&&t.getMode()===c.DIRECT_SELECT&&s.featureId===e.store.getSelectedIds()[0]||e.events.changeMode(r,s,{silent:i}),t)},t.getMode=function(){return e.events.getMode()},t.trash=function(){return e.events.trash({silent:i}),t},t.combineFeatures=function(){return e.events.combineFeatures({silent:i}),t},t.uncombineFeatures=function(){return e.events.uncombineFeatures({silent:i}),t},t.setFeatureProperty=function(r,s,n){return e.store.setFeatureProperty(r,s,n,{silent:i}),t},t}(i,t),i.api=t;let r=function(e){let t=null,i=null,r={onRemove(){return e.map.off("load",r.connect),clearInterval(i),r.removeLayers(),e.store.restoreMapConfig(),e.ui.removeButtons(),e.events.removeEventListeners(),e.ui.clearMapClasses(),e.boxZoomInitial&&e.map.boxZoom.enable(),e.map=null,e.container=null,e.store=null,t&&t.parentNode&&t.parentNode.removeChild(t),t=null,this},connect(){e.map.off("load",r.connect),clearInterval(i),r.addLayers(),e.store.storeMapConfig(),e.events.addEventListeners()},onAdd(s){if(e.map=s,e.events=function(e){let t=Object.keys(e.options.modes).reduce((t,i)=>(t[i]=function(e){let t=Object.keys(e);return function(i,r={}){let s={},n=t.reduce((t,i)=>(t[i]=e[i],t),new eh(i));return{start(){s=n.onSetup(r),ec.forEach(t=>{let i=eu[t],r=()=>!1;e[i]&&(r=()=>!0),this.on(t,r,e=>n[i](s,e))})},stop(){n.onStop(s)},trash(){n.onTrash(s)},combineFeatures(){n.onCombineFeatures(s)},uncombineFeatures(){n.onUncombineFeatures(s)},render(e,t){n.toDisplayFeatures(s,e,t)}}}}(e.options.modes[i]),t),{}),i={},r={},s={},n=null,a=null;s.drag=function(t,i){i({point:t.point,time:new Date().getTime()})?(e.ui.queueMapClasses({mouse:l.DRAG}),a.drag(t)):t.originalEvent.stopPropagation()},s.mousedrag=function(e){s.drag(e,e=>!Q(i,e))},s.touchdrag=function(e){s.drag(e,e=>!J(r,e))},s.mousemove=function(t){if(1===(void 0!==t.originalEvent.buttons?t.originalEvent.buttons:t.originalEvent.which))return s.mousedrag(t);let i=Y(t,e);t.featureTarget=i,a.mousemove(t)},s.mousedown=function(t){i={time:new Date().getTime(),point:t.point};let r=Y(t,e);t.featureTarget=r,a.mousedown(t)},s.mouseup=function(t){let r=Y(t,e);t.featureTarget=r,Q(i,{point:t.point,time:new Date().getTime()})?a.click(t):a.mouseup(t)},s.mouseout=function(e){a.mouseout(e)},s.touchstart=function(t){if(!e.options.touchEnabled)return;r={time:new Date().getTime(),point:t.point};let i=K.touch(t,null,e)[0];t.featureTarget=i,a.touchstart(t)},s.touchmove=function(t){if(e.options.touchEnabled)return a.touchmove(t),s.touchdrag(t)},s.touchend=function(t){if(t.originalEvent.preventDefault(),!e.options.touchEnabled)return;let i=K.touch(t,null,e)[0];t.featureTarget=i,J(r,{time:new Date().getTime(),point:t.point})?a.tap(t):a.touchend(t)};let h=e=>{let t=O(e),i=N(e),r=G(e);return!(t||i||r)};function u(i,r,s={}){a.stop();let o=t[i];if(void 0===o)throw Error(`${i} is not valid`);n=i,a=ee(o(e,r),e),s.silent||e.map.fire(d.MODE_CHANGE,{mode:i}),e.store.setDirty(),e.store.render()}s.keydown=function(t){(t.srcElement||t.target).classList.contains(o.CANVAS)&&((O(t)||N(t))&&e.options.controls.trash?(t.preventDefault(),a.trash()):h(t)?a.keydown(t):F(t)&&e.options.controls.point?u(c.DRAW_POINT):D(t)&&e.options.controls.line_string?u(c.DRAW_LINE_STRING):B(t)&&e.options.controls.polygon&&u(c.DRAW_POLYGON))},s.keyup=function(e){h(e)&&a.keyup(e)},s.zoomend=function(){e.store.changeZoom()},s.data=function(t){if("style"===t.dataType){let{setup:t,map:i,options:r,store:s}=e;r.styles.some(e=>i.getLayer(e.id))||(t.addLayers(),s.setDirty(),s.render())}};let f={trash:!1,combineFeatures:!1,uncombineFeatures:!1};return{start(){a=ee(t[n=e.options.defaultMode](e),e)},changeMode:u,actionable:function(t){let i=!1;Object.keys(t).forEach(e=>{if(void 0===f[e])throw Error("Invalid action type");f[e]!==t[e]&&(i=!0),f[e]=t[e]}),i&&e.map.fire(d.ACTIONABLE,{actions:f})},currentModeName:()=>n,currentModeRender:(e,t)=>a.render(e,t),fire(t,i){e.map&&e.map.fire(t,i)},addEventListeners(){e.map.on("mousemove",s.mousemove),e.map.on("mousedown",s.mousedown),e.map.on("mouseup",s.mouseup),e.map.on("data",s.data),e.map.on("touchmove",s.touchmove),e.map.on("touchstart",s.touchstart),e.map.on("touchend",s.touchend),e.container.addEventListener("mouseout",s.mouseout),e.options.keybindings&&(e.container.addEventListener("keydown",s.keydown),e.container.addEventListener("keyup",s.keyup))},removeEventListeners(){e.map.off("mousemove",s.mousemove),e.map.off("mousedown",s.mousedown),e.map.off("mouseup",s.mouseup),e.map.off("data",s.data),e.map.off("touchmove",s.touchmove),e.map.off("touchstart",s.touchstart),e.map.off("touchend",s.touchend),e.container.removeEventListener("mouseout",s.mouseout),e.options.keybindings&&(e.container.removeEventListener("keydown",s.keydown),e.container.removeEventListener("keyup",s.keyup))},trash(e){a.trash(e)},combineFeatures(){a.combineFeatures()},uncombineFeatures(){a.uncombineFeatures()},getMode:()=>n}}(e),e.ui=function(e){let t={},i=null,r={mode:null,feature:null,mouse:null},s={mode:null,feature:null,mouse:null};function n(e){s=Object.assign(s,e)}function a(){if(!e.container)return;let t=[],i=[];
1310em.forEach(e=>{s[e]!==r[e]&&(t.push(`${e}-${r[e]}`),null!==s[e]&&i.push(`${e}-${s[e]}`))}),t.length>0&&e.container.classList.remove(...t),i.length>0&&e.container.classList.add(...i),r=Object.assign(r,s)}function l(e,t={}){let r=document.createElement("button");return r.className=`${o.CONTROL_BUTTON} ${t.className}`,r.setAttribute("title",t.title),t.container.appendChild(r),r.addEventListener("click",r=>{if(r.preventDefault(),r.stopPropagation(),r.target===i){u(),t.onDeactivate();return}d(e),t.onActivate()},!0),r}function u(){i&&(i.classList.remove(o.ACTIVE_BUTTON),i=null)}function d(e){u();let r=t[e];r&&r&&"trash"!==e&&(r.classList.add(o.ACTIVE_BUTTON),i=r)}return{setActiveButton:d,queueMapClasses:n,updateMapClasses:a,clearMapClasses:function(){n({mode:null,feature:null,mouse:null}),a()},addButtons:function(){let i=e.options.controls,r=document.createElement("div");return r.className=`${o.CONTROL_GROUP} ${o.CONTROL_BASE}`,i&&(i[h.POINT]&&(t[h.POINT]=l(h.POINT,{container:r,className:o.CONTROL_BUTTON_POINT,title:`Marker tool ${e.options.keybindings?"(1)":""}`,onActivate:()=>e.events.changeMode(c.DRAW_POINT),onDeactivate:()=>e.events.trash()})),i[h.LINE]&&(t[h.LINE]=l(h.LINE,{container:r,className:o.CONTROL_BUTTON_LINE,title:`LineString tool ${e.options.keybindings?"(2)":""}`,onActivate:()=>e.events.changeMode(c.DRAW_LINE_STRING),onDeactivate:()=>e.events.trash()})),i[h.POLYGON]&&(t[h.POLYGON]=l(h.POLYGON,{container:r,className:o.CONTROL_BUTTON_POLYGON,title:`Polygon tool ${e.options.keybindings?"(3)":""}`,onActivate:()=>e.events.changeMode(c.DRAW_POLYGON),onDeactivate:()=>e.events.trash()})),i.trash&&(t.trash=l("trash",{container:r,className:o.CONTROL_BUTTON_TRASH,title:"Delete",onActivate:()=>{e.events.trash()}})),i.combine_features&&(t.combine_features=l("combineFeatures",{container:r,className:o.CONTROL_BUTTON_COMBINE_FEATURES,title:"Combine",onActivate:()=>{e.events.combineFeatures()}})),i.uncombine_features&&(t.uncombine_features=l("uncombineFeatures",{container:r,className:o.CONTROL_BUTTON_UNCOMBINE_FEATURES,title:"Uncombine",onActivate:()=>{e.events.uncombineFeatures()}}))),r},removeButtons:function(){Object.keys(t).forEach(e=>{let i=t[e];i.parentNode&&i.parentNode.removeChild(i),delete t[e]})}}}(e),e.container=s.getContainer(),e.store=new ep(e),t=e.ui.addButtons(),e.options.boxSelect){e.boxZoomInitial=s.boxZoom.isEnabled(),s.boxZoom.disable();let t=s.dragPan.isEnabled();s.dragPan.disable(),s.dragPan.enable(),t||s.dragPan.disable()}return s.loaded()?r.connect():(s.on("load",r.connect),i=setInterval(()=>{s.loaded()&&r.connect()},16)),e.events.start(),t},addLayers(){e.map.addSource(a.COLD,{data:{type:u.FEATURE_COLLECTION,features:[]},type:"geojson"}),e.map.addSource(a.HOT,{data:{type:u.FEATURE_COLLECTION,features:[]},type:"geojson"}),e.options.styles.forEach(t=>{e.map.addLayer(t)}),e.store.setDirty(!0),e.store.render()},removeLayers(){e.options.styles.forEach(t=>{e.map.getLayer(t.id)&&e.map.removeLayer(t.id)}),e.map.getSource(a.COLD)&&e.map.removeSource(a.COLD),e.map.getSource(a.HOT)&&e.map.removeSource(a.HOT)}};return e.setup=r,r}(i);return t.onAdd=r.onAdd,t.onRemove=r.onRemove,t.types=h,t.options=e,t};function e5(e){e8(e,this)}e5.modes=eZ,e5.constants=r,e5.lib=n;let e7=e5},83829:(e,t,i)=>{"use strict";i.d(t,{v4:()=>l,UP:()=>u});var r=i(97681),s=i(57981);async function n(e,t,i){if(0===t.length)return[];let r=i?.coalesce??1048576,s=i?.maxRangeSize??0x1000000,n=i?.signal,a=function(e,t,i){let r=[...e].sort((e,t)=>e.offset-t.offset),s=[],n=null;for(let e of r){if(null==n){n={offset:e.offset,length:e.length};continue}let r=n.offset+n.length,o=e.offset+e.length,a=e.offset-r,l=Math.max(r,o),h=l-n.offset;a<=t&&h<=i?n.length=l-n.offset:(s.push(n),n={offset:e.offset,length:e.length})}return null!=n&&s.push(n),s}(t,r,s),l=await o(e,a,n),h=Array(t.length);for(let e=0;e<t.length;e++){let i=t[e],r=function(e,t){let i=0,r=e.length-1;for(;i<r;){let s=i+r+1>>>1;e[s].offset<=t?i=s:r=s-1}return i}(a,i.offset),s=a[r],n=l[r],o=i.offset-s.offset,u=o+i.length;if(u>n.byteLength)throw Error(`Failed to fetch bytes from offset:${i.offset} wanted:${i.length} got:${n.byteLength-o}`);h[e]=n.slice(o,u)}return h}async function o(e,t,i){let r=Array(t.length);for(let s=0;s<t.length;s+=6){let n=t.slice(s,s+6),o=await Promise.all(n.map(t=>e.fetch(t.offset,t.length,{signal:i})));for(let e=0;e<o.length;e++)r[s+e]=o[e]}return r}var a=i(3991);async function l(e,t,i,{boundless:r=!0,pool:s,signal:n}={}){let o=f(e,t,i,{signal:n}),a=null!=e.maskImage?y(e.maskImage,t,i,e.dataSource,{signal:n,debug:e._debug?{label:"mask"}:void 0}):Promise.resolve(null),[u,c]=await Promise.all([o,a]);return h(e,t,i,u,c,{boundless:r,pool:s})}async function h(e,t,i,n,o,{boundless:a,pool:l}){let{bitsPerSample:h,predictor:u,planarConfiguration:f,sampleFormat:p,lercParameters:g}=e.cachedTags,{sampleFormat:m,bitsPerSample:_}=w(p,h),y=(0,s.Zz)(e.transform,(0,s.wT)(t*e.tileWidth,i*e.tileHeight)),v=e.image.value(r._l.SamplesPerPixel)??1,b={sampleFormat:m,bitsPerSample:_,samplesPerPixel:v,width:e.tileWidth,height:e.tileHeight,predictor:u,planarConfiguration:f,lercParameters:g},[E,S]=await Promise.all([d(n,b,l),null!=o&&null!=e.maskImage?c(o,e.maskImage,l):Prom
1310ise.resolve(null)]),P={...E,count:v,height:e.tileHeight,width:e.tileWidth,mask:S,transform:y,crs:e.crs,nodata:e.nodata};return{x:t,y:i,array:!0===a?P:function(e,t,i,r){let{width:s,height:n}=e.image.getTileBounds(t,i);if(s===e.tileWidth&&n===e.tileHeight)return r;let o=r.mask?x(r.mask,e.tileWidth,s,n,1):r.mask;if("pixel-interleaved"===r.layout){let{count:t,data:i}=r,a=x(i,e.tileWidth,s,n,t);return{...r,width:s,height:n,data:a,mask:o}}let{bands:a}=r,l=a.map(t=>x(t,e.tileWidth,s,n,1));return{...r,width:s,height:n,bands:l,mask:o}}(e,t,i,P)}}async function u(e,t,{boundless:i=!0,pool:r,signal:s}={}){if(0===t.length)return[];let n=m(e,t,{signal:s}),o=null!=e.maskImage?E(e.maskImage,t,e.dataSource,{signal:s,debug:e._debug?{label:"mask"}:void 0}):Promise.resolve(t.map(()=>null)),[a,l]=await Promise.all([n,o]);return Promise.all(t.map(([t,s],n)=>h(e,t,s,a[n],l[n]??null,{boundless:i,pool:r})))}async function c(e,t,i){let{sampleFormat:s,bitsPerSample:n}=w(t.value(r._l.SampleFormat)??[1],new Uint16Array(t.value(r._l.BitsPerSample)??[8])),{width:o,height:l}=t.tileSize,h={sampleFormat:s,bitsPerSample:n,samplesPerPixel:t.value(r._l.SamplesPerPixel)??1,width:o,height:l,predictor:t.value(r._l.Predictor)??1,planarConfiguration:t.value(r._l.PlanarConfiguration)??r.lI.Contig},{bytes:u,compression:c}=e,d=await (i?i.decode(u,c,h):(0,a.D4)(u,c,h)),f="pixel-interleaved"===d.layout?d.data:d.bands[0];if(f instanceof Uint8Array)return f;throw Error("Expected mask data to decode to Uint8Array")}async function d(e,t,i){let r=(e,t,r)=>i?i.decode(e,t,r):(0,a.D4)(e,t,r);if(Array.isArray(e)){let i={...t,samplesPerPixel:1};return{layout:"band-separate",bands:(await Promise.all(e.map(({bytes:e,compression:t})=>r(e,t,i)))).map(e=>"band-separate"===e.layout?e.bands[0]:e.data)}}{let{bytes:i,compression:s}=e;return r(i,s,t)}}async function f(e,t,i,{signal:s}={}){let n=e._debug?{label:"data"}:void 0;switch(e.cachedTags.planarConfiguration){case r.lI.Contig:{let r=await y(e.image,t,i,e.dataSource,{signal:s,debug:n});if(null===r)throw Error(`Tile at (${t}, ${i}) not found`);return r}case r.lI.Separate:return await g(e,t,i,{signal:s});default:throw Error(`Unsupported PlanarConfiguration: ${e.cachedTags.planarConfiguration}`)}}async function p(e,t,i,r){let{x:s,y:n}=e.image.tileCount,o=s*n;return Promise.all([...Array(e.cachedTags.samplesPerPixel).keys()].map(n=>e.image.getTileSize(n*o+i*s+t,r)))}async function g(e,t,i,r={}){let{signal:s}=r,n=e._debug?{label:"data"}:void 0;return Promise.all((await p(e,t,i,r)).map(async({offset:r,imageSize:o})=>{let a=await v(e.image,r,o,e.dataSource,{signal:s,debug:n});if(null===a)throw Error(`Tile at (${t}, ${i}) not found`);return a}))}async function m(e,t,{signal:i}={}){let s=e._debug?{label:"data"}:void 0;switch(e.cachedTags.planarConfiguration){case r.lI.Contig:return(await E(e.image,t,e.dataSource,{signal:i,debug:s})).map((e,i)=>{if(null===e){let[e,r]=t[i];throw Error(`Tile at (${e}, ${r}) not found`)}return e});case r.lI.Separate:return _(e,t,{signal:i});default:throw Error(`Unsupported PlanarConfiguration: ${e.cachedTags.planarConfiguration}`)}}async function _(e,t,i={}){let{signal:r}=i,s=e._debug?{label:"data"}:void 0,n=e.cachedTags.samplesPerPixel,o=(await Promise.all(t.map(([t,r])=>p(e,t,r,i)))).flatMap(e=>e.map(({offset:e,imageSize:t})=>({offset:e,byteCount:t}))),a=await b(e.image,o,e.dataSource,{signal:r,debug:s});return t.map(([e,t],i)=>a.slice(i*n,i*n+n).map(i=>{if(null===i)throw Error(`Tile at (${e}, ${t}) not found`);return i}))}async function y(e,t,i,r,s){let{size:n,tileSize:o}=e;if(null==o)throw Error("Tiff is not tiled");let a=Math.ceil(n.height/o.height),l=Math.ceil(n.width/o.width);if(t>=l||i>=a)throw Error(`Tile index is outside of range x:${t} >= ${l} or y:${i} >= ${a}`);let h=i*l+t,u=l*a;if(h>=u)throw Error(`Tile index is outside of tile range: ${h} >= ${u}`);let{offset:c,imageSize:d}=await e.getTileSize(h,{signal:s?.signal});return v(e,c,d,r,s)}async function v(e,t,i,s,n){if(0===i)return null;n?.debug!==void 0&&console.log(`[geotiff dataSource] ${n.debug.label}: offset=${t} length=${i}`);let o=await s.fetch(t,i,n);if(o.byteLength<i)throw Error(`Failed to fetch bytes from offset:${t} wanted:${i} got:${o.byteLength}`);let a=e.value(r._l.Compression)??r.Pr.None;return a===r.Pr.Jpeg?{bytes:e.getJpegHeader(o),compression:a}:{bytes:o,compression:a}}async function b(e,t,i,s){if(0===t.length)return[];let o=Array(t.length),a=[],l=[];for(let e=0;e<t.length;e++){let i=t[e];0===i.offset||0===i.byteCount?o[e]=null:(l.push(e),a.push({offset:i.offset,length:i.byteCount}))}if(0===a.length)return o;if(s?.debug!==void 0)for(let e of a)console.log(`[geotiff dataSource] ${s.debug.label}: offset=${e.offset} length=${e.length}`);let h=await n(i,a,{coalesce:s?.coalesce,maxRangeSize:s?.maxRangeSize,signal:s?.signal}),u=e.value(r._l.Compression)??r.Pr.None;for(let t=0;t<h.length;t++){let i=l[t],s=h[t],n=u===r.Pr.Jpeg?e.getJpegHeader(s):s;o[i]={bytes:n,compression:u}}return o}async function E(e,t,i,r){if(0===t.length)return[];let{size:s,tileSize:n}=e;if(null==n)throw Error("Tiff is not tiled");let o=Math.ceil(s.height/n.height),a=Math.ceil(s.width/n.width),l=a*o,h=t.map(([e,t])=>
1310{if(e>=a||t>=o)throw Error(`Tile index is outside of range x:${e} >= ${a} or y:${t} >= ${o}`);let i=t*a+e;if(i>=l)throw Error(`Tile index is outside of tile range: ${i} >= ${l}`);return i}),u=await Promise.all(h.map(t=>e.getTileSize(t,{signal:r?.signal})));return b(e,u.map(e=>({offset:e.offset,byteCount:e.imageSize})),i,r)}function x(e,t,i,r,s){let n=t*s,o=i*s,a=new e.constructor(o*r);for(let t=0;t<r;t++)a.set(e.subarray(t*n,t*n+o),t*o);return a}function w(e,t){let i=new Set(e),r=new Set(t);if(i.size>1)throw Error("Multiple sample formats are not supported.");if(r.size>1)throw Error("Multiple bits per sample values are not supported.");let s=e[0],n=t[0];if(void 0===s||void 0===n)throw Error("SampleFormat and BitsPerSample arrays cannot be empty.");return{sampleFormat:s,bitsPerSample:n}}},84062:(e,t,i)=>{"use strict";i.d(t,{gO:()=>s,h0:()=>n});var r=i(79904);function s(e,t){if(!t)return{};if(function(e){let t=Object.keys(e);return t.length>0&&t.every(e=>/^\d+$/.test(e))}(t))return Object.fromEntries(Object.entries(t).map(([e,t])=>[Number(e),{...t}]));let i={};for(let[s,n]of Object.entries(t)){let t=function(e,t,i){let s=e.bindings.find(e=>e.name===t||`${e.name.toLocaleLowerCase()}uniforms`===t.toLocaleLowerCase());return s||r.R.warn(`Binding ${t} not set: Not found in shader layout.`)(),s||null}(e,s),o=t?.group??0;i[o]||={},i[o][s]=n}return i}function n(e){let t={};for(let i of Object.values(e))Object.assign(t,i);return t}},85745:(e,t,i)=>{"use strict";i.d(t,{X:()=>s});var r=i(60154);class s extends r.F{get[Symbol.toStringTag](){return"TextureView"}constructor(e,t){super(e,t,s.defaultProps)}static defaultProps={...r.F.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0}}},88743:(e,t,i)=>{"use strict";i.d(t,{d:()=>l});var r=i(47694);let s=["Adapter","GPU","GPU Type","GPU Backend","Frame Rate","CPU Time","GPU Time","GPU Memory","Buffer Memory","Texture Memory","Referenced Buffer Memory","Referenced Texture Memory","Swap Chain Texture"],n=new WeakMap,o=new WeakMap;class a{stats=new Map;getStats(e){return this.get(e)}get(e){this.stats.has(e)||this.stats.set(e,new r.Uz({id:e}));let t=this.stats.get(e);return"GPU Time and Memory"===e&&function(e,t){let i=e.stats,r=!1;for(let s of t)i[s]||(e.get(s),r=!0);let s=Object.keys(i).length,a=n.get(e);if(!r&&a?.orderedStatNames===t&&a.statCount===s)return;let l={},h=o.get(t);for(let e of(h||(h=new Set(t),o.set(t,h)),t))i[e]&&(l[e]=i[e]);for(let[e,t]of Object.entries(i))h.has(e)||(l[e]=t);for(let e of Object.keys(i))delete i[e];Object.assign(i,l),n.set(e,{orderedStatNames:t,statCount:s})}(t,s),t}}let l=new a},89575:(e,t,i)=>{"use strict";function r(e,t){if(!e)throw Error(t||"loader assertion failed.")}i.d(t,{v:()=>r})},90182:(e,t,i)=>{"use strict";i.d(t,{A:()=>t6});let r=1,s=1;class n{time=0;channels=new Map;animations=new Map;playing=!1;lastEngineTime=-1;constructor(){}addChannel(e){let{delay:t=0,duration:i=1/0,rate:s=1,repeat:n=1}=e,o=r++,a={time:0,delay:t,duration:i,rate:s,repeat:n};return this._setChannelTime(a,this.time),this.channels.set(o,a),o}removeChannel(e){for(let[t,i]of(this.channels.delete(e),this.animations))i.channel===e&&this.detachAnimation(t)}isFinished(e){let t=this.channels.get(e);return void 0!==t&&this.time>=t.delay+t.duration*t.repeat}getTime(e){if(void 0===e)return this.time;let t=this.channels.get(e);return void 0===t?-1:t.time}setTime(e){for(let t of(this.time=Math.max(0,e),this.channels.values()))this._setChannelTime(t,this.time);for(let e of this.animations.values()){let{animation:t,channel:i}=e;t.setTime(this.getTime(i))}}play(){this.playing=!0}pause(){this.playing=!1,this.lastEngineTime=-1}reset(){this.setTime(0)}attachAnimation(e,t){let i=s++;return this.animations.set(i,{animation:e,channel:t}),e.setTime(this.getTime(t)),i}detachAnimation(e){this.animations.delete(e)}update(e){this.playing&&(-1===this.lastEngineTime&&(this.lastEngineTime=e),this.setTime(this.time+(e-this.lastEngineTime)),this.lastEngineTime=e)}_setChannelTime(e,t){let i=t-e.delay;i>=e.duration*e.repeat?e.time=e.duration*e.rate:(e.time=Math.max(0,i)%e.duration,e.time*=e.rate)}}var o=i(42846);let a=[i(43406).A],l=["vs:DECKGL_FILTER_SIZE(inout vec3 size, VertexGeometry geometry)","vs:DECKGL_FILTER_GL_POSITION(inout vec4 position, VertexGeometry geometry)","vs:DECKGL_FILTER_COLOR(inout vec4 color, VertexGeometry geometry)","fs:DECKGL_FILTER_COLOR(inout vec4 color, FragmentGeometry geometry)"],h=[],u=`\ 1311layout(std140) uniform layerUniforms { 1312 uniform float opacity; 1313} layer;
1314`,c={name:"layer",source:`\ 1315struct LayerUniforms { 1316 opacity: f32, 1317}; 1318 1319@group(0) @binding(auto) 1320var<uniform> layer: LayerUniforms; 1321`,vs:u,fs:u,getUniforms:e=>({opacity:Math.pow(e.opacity,1/2.2)}),uniformTypes:{opacity:"f32"}};var d=i(73254),f=i(43280),p=i(40712),g=i(7460),m=i(47694),_=i(41487);class y{constructor(e,t,i){this._loadCount=0,this._subscribers=new Set,this.id=e,this.context=i,this.setData(t)}subscribe(e){this._subscribers.add(e)}unsubscribe(e){this._subscribers.delete(e)}inUse(){return this._subscribers.size>0}delete(){}getData(){return this.isLoaded?this._error?Promise.reject(this._error):this._content:this._loader.then(()=>this.getData())}setData(e,t){if(e===this._data&&!t)return;this._data=e;let i=++this._loadCount,r=e;for(let t of("string"==typeof e&&(r=(0,_.H)(e)),r instanceof Promise?(this.isLoaded=!1,this._loader=r.then(e=>{this._loadCount===i&&(this.isLoaded=!0,this._error=void 0,this._content=e)}).catch(e=>{this._loadCount===i&&(this.isLoaded=!0,this._error=e||!0)})):(this.isLoaded=!0,this._error=void 0,this._content=e),this._subscribers))t.onChange(this.getData())}}class v{constructor(e){this.protocol=e.protocol||"resource://",this._context={device:e.device,gl:e.device?.gl,resourceManager:this},this._resources={},this._consumers={},this._pruneRequest=null}contains(e){return!!e.startsWith(this.protocol)||e in this._resources}add({resourceId:e,data:t,forceUpdate:i=!1,persistent:r=!0}){let s=this._resources[e];s?s.setData(t,i):(s=new y(e,t,this._context),this._resources[e]=s),s.persistent=r}remove(e){let t=this._resources[e];t&&(t.delete(),delete this._resources[e])}unsubscribe({consumerId:e}){let t=this._consumers[e];if(t){for(let e in t){let i=t[e],r=this._resources[i.resourceId];r&&r.unsubscribe(i)}delete this._consumers[e],this.prune()}}subscribe({resourceId:e,onChange:t,consumerId:i,requestId:r="default"}){let{_resources:s,protocol:n}=this;e.startsWith(n)&&(s[e=e.replace(n,"")]||this.add({resourceId:e,data:null,persistent:!1}));let o=s[e];if(this._track(i,r,o,t),o)return o.getData()}prune(){this._pruneRequest||(this._pruneRequest=setTimeout(()=>this._prune(),0))}finalize(){for(let e in this._resources)this._resources[e].delete()}_track(e,t,i,r){let s=this._consumers,n=s[e]=s[e]||{},o=n[t],a=o&&o.resourceId&&this._resources[o.resourceId];a&&(a.unsubscribe(o),this.prune()),i&&(o?(o.onChange=r,o.resourceId=i.id):o={onChange:r,resourceId:i.id},n[t]=o,i.subscribe(o))}_prune(){for(let e of(this._pruneRequest=null,Object.keys(this._resources))){let t=this._resources[e];t.persistent||t.inUse()||(t.delete(),delete this._resources[e])}}}var b=i(27466);class E{constructor(e,t){this._lastRenderedLayers=[],this._needsRedraw=!1,this._needsUpdate=!1,this._nextLayers=null,this._debug=!1,this._defaultShaderModulesChanged=!1,this.activateViewport=e=>{(0,p.A)("layerManager.activateViewport",this,e),e&&(this.context.viewport=e)};let{deck:i,stats:r,viewport:s,timeline:u}=t||{};this.layers=[],this.resourceManager=new v({device:e,protocol:"deck://"}),this.context={mousePosition:null,userData:{},layerManager:this,device:e,gl:e?.gl,deck:i,shaderAssembler:function(e){let t=o._.getDefaultShaderAssembler();for(let e of a)t.addDefaultModule(e);for(let i of(t._hookFunctions.length=0,"glsl"===e?l:h))t.addShaderHook(i);return t}(e?.info?.shadingLanguage||"glsl"),defaultShaderModules:[c],renderPass:void 0,stats:r||new m.Uz({id:"deck.gl"}),viewport:s||new b.A({id:"DEFAULT-INITIAL-VIEWPORT"}),timeline:u||new n,resourceManager:this.resourceManager,onError:void 0},Object.seal(this)}finalize(){for(let e of(this.resourceManager.finalize(),this.layers))this._finalizeLayer(e)}needsRedraw(e={clearRedrawFlags:!1}){let t=this._needsRedraw;for(let i of(e.clearRedrawFlags&&(this._needsRedraw=!1),this.layers)){let r=i.getNeedsRedraw(e);t=t||r}return t}needsUpdate(){return this._nextLayers&&this._nextLayers!==this._lastRenderedLayers?"layers changed":this._defaultShaderModulesChanged?"shader modules changed":this._needsUpdate}setNeedsRedraw(e){this._needsRedraw=this._needsRedraw||e}setNeedsUpdate(e){this._needsUpdate=this._needsUpdate||e}getLayers({layerIds:e}={}){return e?this.layers.filter(t=>e.find(e=>0===t.id.indexOf(e))):this.layers}setProps(e){"debug"in e&&(this._debug=e.debug),"userData"in e&&(this.context.userData=e.userData),"layers"in e&&(this._nextLayers=e.layers
1321),"onError"in e&&(this.context.onError=e.onError)}setLayers(e,t){(0,p.A)("layerManager.setLayers",this,t,e),this._lastRenderedLayers=e;let i=(0,g.B)(e,Boolean);for(let e of i)e.context=this.context;this._updateLayers(this.layers,i)}updateLayers(){let e=this.needsUpdate();e&&(this.setNeedsRedraw(`updating layers: ${e}`),this.setLayers(this._nextLayers||this._lastRenderedLayers,e)),this._nextLayers=null}addDefaultShaderModule(e){let{defaultShaderModules:t}=this.context;t.find(t=>t.name===e.name)||(t.push(e),this._defaultShaderModulesChanged=!0)}removeDefaultShaderModule(e){let{defaultShaderModules:t}=this.context,i=t.findIndex(t=>t.name===e.name);i>=0&&(t.splice(i,1),this._defaultShaderModulesChanged=!0)}_handleError(e,t,i){i.raiseError(t,`${e} of ${i}`)}_updateLayers(e,t){let i={};for(let t of e)i[t.id]?f.A.warn(`Multiple old layers with same id ${t.id}`)():i[t.id]=t;if(this._defaultShaderModulesChanged){for(let t of e)t.setNeedsUpdate(),t.setChangeFlags({extensionsChanged:!0});this._defaultShaderModulesChanged=!1}let r=[];this._updateSublayersRecursively(t,i,r),this._finalizeOldLayers(i);let s=!1;for(let e of r)if(e.hasUniformTransition()){s=`Uniform transition in ${e}`;break}this._needsUpdate=s,this.layers=r}_updateSublayersRecursively(e,t,i){for(let r of e){r.context=this.context;let e=t[r.id];null===e&&f.A.warn(`Multiple new layers with same id ${r.id}`)(),t[r.id]=null;let s=null;try{this._debug&&e!==r&&r.validateProps(),e?(this._transferLayerState(e,r),this._updateLayer(r)):this._initializeLayer(r),i.push(r),s=r.isComposite?r.getSubLayers():null}catch(e){this._handleError("matching",e,r)}s&&this._updateSublayersRecursively(s,t,i)}}_finalizeOldLayers(e){for(let t in e){let i=e[t];i&&this._finalizeLayer(i)}}_initializeLayer(e){try{e._initialize(),e.lifecycle=d.VD.INITIALIZED}catch(t){this._handleError("initialization",t,e)}}_transferLayerState(e,t){t._transferState(e),t.lifecycle=d.VD.MATCHED,t!==e&&(e.lifecycle=d.VD.AWAITING_GC)}_updateLayer(e){try{e._update()}catch(t){this._handleError("update",t,e)}}_finalizeLayer(e){this._needsRedraw=this._needsRedraw||`finalized ${e}`,e.lifecycle=d.VD.AWAITING_FINALIZATION;try{e._finalize(),e.lifecycle=d.VD.FINALIZED}catch(t){this._handleError("finalization",t,e)}}}var x=i(19277);class w{constructor(e){this.views=[],this.width=100,this.height=100,this.viewState={},this.controllers={},this.timeline=e.timeline,this._viewports=[],this._viewportMap={},this._isUpdating=!1,this._needsRedraw="First render",this._needsUpdate="Initialize",this._eventManager=e.eventManager,this._eventCallbacks={onViewStateChange:e.onViewStateChange,onInteractionStateChange:e.onInteractionStateChange},this._pickPosition=e.pickPosition,Object.seal(this),this.setProps(e)}finalize(){for(let e in this.controllers){let t=this.controllers[e];t&&t.finalize()}this.controllers={}}needsRedraw(e={clearRedrawFlags:!1}){let t=this._needsRedraw;return e.clearRedrawFlags&&(this._needsRedraw=!1),t}setNeedsUpdate(e){this._needsUpdate=this._needsUpdate||e,this._needsRedraw=this._needsRedraw||e}updateViewStates(){for(let e in this.controllers){let t=this.controllers[e];t&&t.updateTransition()}}getViewports(e){return e?this._viewports.filter(t=>t.containsPixel(e)):this._viewports}getViews(){let e={};return this.views.forEach(t=>{e[t.id]=t}),e}getView(e){return this.views.find(t=>t.id===e)}getViewState(e){let t="string"==typeof e?this.getView(e):e,i=t&&this.viewState[t.getViewStateId()]||this.viewState;return t?t.filterViewState(i):i}getViewport(e){return this._viewportMap[e]}unproject(e,t){let i=this.getViewports(),r={x:e[0],y:e[1]};for(let s=i.length-1;s>=0;--s){let n=i[s];if(n.containsPixel(r)){let i=e.slice();return i[0]-=n.x,i[1]-=n.y,n.unproject(i,t)}}return null}setProps(e){e.views&&this._setViews(e.views),e.viewState&&this._setViewState(e.viewState),("width"in e||"height"in e)&&this._setSize(e.width,e.height),"pickPosition"in e&&(this._pickPosition=e.pickPosition),this._isUpdating||this._update()}_update(){this._isUpdating=!0,this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports()),this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports()),this._isUpdating=!1}_setSize(e,t){(e!==this.width||t!==this.height)&&(this.width=e,this.height=t,this.setNeedsUpdate("Size changed"))}_setViews(e){e=(0,g.B)(e,Boolean),this._diffViews(e,this.views)&&this.setNeedsUpdate("views changed"),this.views=e}_setViewState(e){e?((0,x.b)(e,this.viewState,3)||this.setNeedsUpdate("viewState changed"),this.viewState=e):f.A.warn("missing `viewState` or `initialViewState`")()}_createController(e,t){return new t.type({timeline:this.timeline,eventManager:this._eventManager,onViewStateChange:this._eventCallbacks.onViewStateChange,onStateChange:this._eventCallbacks.onInteractionStateChange,makeViewport:t=>this.getView(e.id)?.makeViewport({viewState:t,width:this.width,height:this.height}),pickPosition:this._pickPosition})}_updateController(e,t,i,r){let s=e.controller;if(s&&i){let n={...t,...s,id:e.id,x:i.x,y:i.y,width:i.width,height:i.height};return r&&r.constructor===s.type||(r=this._createController(e,n)),r&&r.setProps(n),r}return null}_rebuildViewports(){let{views:e}=this,t=this.controllers;this._viewports=[],this.controllers={};let i=!1;for(let r=e.length;r--;){let s=e[r],n=this.getViewState(s),o=s.makeViewport({viewState:n,width:this.width,height:this.height}),a=t[s.id],l=!!s.controller;l&&!a&&(i=!0),(i||!l)&&a&&(a.finalize(),a=null),this.controllers[s.id]=this._updateController(s,n,o,a),o&&this._viewports.unshift(o)}for(let e in t){let i=t[e];i&&!this.controllers[e]&&i.finalize()}this._buildViewportMap()}_buildViewportMap(){this._viewportMap={}
1321,this._viewports.forEach(e=>{e.id&&(this._viewportMap[e.id]=this._viewportMap[e.id]||e)})}_diffViews(e,t){return e.length!==t.length||e.some((i,r)=>!e[r].equals(t[r]))}}let S=/^(?:\d+\.?\d*|\.\d+)$/;function P(e){switch(typeof e){case"number":if(!Number.isFinite(e))throw Error(`Could not parse position string ${e}`);return{type:"literal",value:e};case"string":try{let t=function(e){let t=[],i=0;for(;i<e.length;){let r=e[i];if(/\s/.test(r)){i++;continue}if("+"===r||"-"===r||"("===r||")"===r||"%"===r){t.push({type:"symbol",value:r}),i++;continue}if(M(r)||"."===r){let s=i,n="."===r;for(i++;i<e.length;){let t=e[i];if(M(t)){i++;continue}if("."===t&&!n){n=!0,i++;continue}break}let o=e.slice(s,i);if(!S.test(o))throw Error("Invalid number token");t.push({type:"number",value:parseFloat(o)});continue}if(C(r)){let r=i;for(;i<e.length&&C(e[i]);)i++;let s=e.slice(r,i).toLowerCase();t.push({type:"word",value:s});continue}throw Error("Invalid token in position string")}return t}(e);return new A(t).parseExpression()}catch(i){let t=i instanceof Error?i.message:String(i);throw Error(`Could not parse position string ${e}: ${t}`)}default:throw Error(`Could not parse position string ${e}`)}}function T(e,t){return function e(t,i){switch(t.type){case"literal":return t.value;case"percentage":return Math.round(t.value*i);case"binary":let r=e(t.left,i),s=e(t.right,i);return"+"===t.operator?r+s:r-s;default:throw Error("Unknown layout expression type")}}(e,t)}class A{constructor(e){this.index=0,this.tokens=e}parseExpression(){let e=this.parseBinaryExpression();if(this.index<this.tokens.length)throw Error("Unexpected token at end of expression");return e}parseBinaryExpression(){var e;let t=this.parseFactor(),i=this.peek();for(;(e=i)&&"symbol"===e.type&&("+"===e.value||"-"===e.value);){this.index++;let e=this.parseFactor();t={type:"binary",operator:i.value,left:t,right:e},i=this.peek()}return t}parseFactor(){let e=this.peek();if(!e)throw Error("Unexpected end of expression");if("symbol"===e.type&&"+"===e.value)return this.index++,this.parseFactor();if("symbol"===e.type&&"-"===e.value)return this.index++,{type:"binary",operator:"-",left:{type:"literal",value:0},right:this.parseFactor()};if("symbol"===e.type&&"("===e.value){this.index++;let e=this.parseBinaryExpression();if(!this.consumeSymbol(")"))throw Error("Missing closing parenthesis");return e}if("word"===e.type&&"calc"===e.value){if(this.index++,!this.consumeSymbol("("))throw Error("Missing opening parenthesis after calc");let e=this.parseBinaryExpression();if(!this.consumeSymbol(")"))throw Error("Missing closing parenthesis");return e}if("number"===e.type){this.index++;let t=e.value,i=this.peek();return i&&"symbol"===i.type&&"%"===i.value?(this.index++,{type:"percentage",value:t/100}):(i&&"word"===i.type&&"px"===i.value&&this.index++,{type:"literal",value:t})}throw Error("Unexpected token in expression")}consumeSymbol(e){let t=this.peek();return!!t&&"symbol"===t.type&&t.value===e&&(this.index++,!0)}peek(){return this.tokens[this.index]||null}}function M(e){return e>="0"&&e<="9"}function C(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"}class R{constructor(e){let{id:t,x:i=0,y:r=0,width:s="100%",height:n="100%",padding:o=null}=e;this.id=t||this.constructor.displayName||"view",this.props={...e,id:this.id},this._x=P(i),this._y=P(r),this._width=P(s),this._height=P(n),this._padding=o&&{left:P(o.left||0),right:P(o.right||0),top:P(o.top||0),bottom:P(o.bottom||0)},this.equals=this.equals.bind(this),Object.seal(this)}equals(e){return this===e||this.constructor===e.constructor&&(0,x.b)(this.props,e.props,2)}clone(e){return new this.constructor({...this.props,...e})}makeViewport({width:e,height:t,viewState:i}){i=this.filterViewState(i);let r=this.getDimensions({width:e,height:t});return r.height&&r.width?new(this.getViewportType(i))({...i,...this.props,...r}):null}getViewStateId(){let{viewState:e}=this.props;return"string"==typeof e?e:e?.id||this.id}filterViewState(e){if(this.props.viewState&&"object"==typeof this.props.viewState){if(!this.props.viewState.id)return this.props.viewState;var t=this.props.viewState;let i={...e};for(let e in t)"id"!==e&&(Array.isArray(i[e])&&Array.isArray(t[e])?i[e]=function(e,t){e=e.slice();for(let i=0;i<t.length;i++){let r=t[i];Number.isFinite(r)&&(e[i]=r)}return e}(i[e],t[e]):i[e]=t[e]);return i}return e}getDimensions({width:e,height:t}){let i={x:T(this._x,e),y:T(this._y,t),width:T(this._width,e),height:T(this._height,t)};return this._padding&&(i.padding={left:T(this._padding.left,e),top:T(this._padding.top,t),right:T(this._padding.right,e),bottom:T(this._padding.bottom,t)}),i}get controller(){let e=this.props.controller;return e?!0===e?{type:this.ControllerType}:"function"==typeof e?{type:e}:{type:this.ControllerType,...e}:null}}var L=i(6797),I=i(27366),O=i(33086);let N=()=>{},F={BREAK:1,SNAP_TO_END:2,IGNORE:3},D=e=>e,B=F.BREAK;class G{constructor(e){this._onTransitionUpdate=e=>{let{time:t,settings:{interpolator:i,startProps:r,endProps:s,duration:n,easing:o}}=e,a=o(t/n),l=i.interpolateProps(r,s,a);this.propsInTransition=this.getControllerState({...this.props,...l}).getViewportProps(),this.onViewStateChange({viewState:this.propsInTransition,oldViewState:this.props})},this.getControllerState=e.getControllerState,this.propsInTransition=null,this.transition=new O.A(e.timeline),this.onViewStateChange=e.onViewStateChange||N,this.onStateChange=e.onStateChange||N}finalize(){this.transition.cancel()}getViewportInTransition(){return this.propsInTransition}processViewStateChange(e){let t=!1,i=this.props;if(this.props=e,!i||this._shouldIgnoreViewportChange(i,e))return!1;if(this._isTransitionEnabled(e)){let r=i;if(this.transition.inProgress){let{interruption:e,endProps:t}=this.transition.settings;r={...i,...e===F.SNAP_TO_END?t:this.propsInTransition||i}}this._triggerTransition(r,e),t=!0}else this.transition.cancel();return t}updateTransition(){this.transition.update()}_isTransitionEnabled(e){let{transitionDuration:t,transitionInterpolator:i}=e;return(t>0||"auto"===t)&&!!i}_isUpdateDueToCurrentTransition(e){return!!this.transition.inProgress&&!!this.propsInTransition&&this.transition.settings.interpolator.arePropsEqual(e,this.propsInTransition)}_shouldIgnoreViewportChange(e,t){return this.transition.inProgress?this.transition.settings.interruption===F.IGNORE||this._isUpdateDueToCurrentTransition(t):!this._isTransitionEnabled(t)||t.transitionInterpolator.arePropsEqual(e,t)}_triggerTransition(e,t){let i=this.getControllerState(e),r=this.getControllerState(t).shortestPathFrom(i),s=t.transitionInterpolator,n=s.getDuration?s.getDuration(e,t):t.transitionDuration;if(0===n)return;let o=s.initializeProps(e,r);this.propsInTransition={};let a={duration:n,easing:t.transitionEasing||D,interpolator:s,interruption:t.transitionInterruption||B,startProps:o.start,endProps:o.end,onStart:t.onTransitionStart,onUpdate:this._onTransitionUpdate,onInterrupt:this._onTransitionEnd(t.onTransitionInterrupt),onEnd:this._onTransitionEnd(t.onTransitionEnd)};this.transition.start(a),this.onStateChange({inTransition:!0}),this.updateTransition()}_onTransitionEnd(e){return t=>{this.propsInTransition=null,this.onStateChange({inTransition:!1,isZooming:!1,isPanning:!1,isRotating:!1}),e?.(t)}}}var k=i(63344);
1321class U{constructor(e){let{compare:t,extract:i,required:r}=e;this._propsToCompare=t,this._propsToExtract=i||t,this._requiredProps=r}arePropsEqual(e,t){for(let i of this._propsToCompare)if(!(i in e)||!(i in t)||!(0,I.aI)(e[i],t[i]))return!1;return!0}initializeProps(e,t){let i={},r={};for(let s of this._propsToExtract)(s in e||s in t)&&(i[s]=e[s],r[s]=t[s]);return this._checkRequiredProps(i),this._checkRequiredProps(r),{start:i,end:r}}getDuration(e,t){return t.transitionDuration}_checkRequiredProps(e){this._requiredProps&&this._requiredProps.forEach(t=>{let i=e[t];(0,k.A)(Number.isFinite(i)||Array.isArray(i),`${t} is required for transition`)})}}var z=i(10430);let j=["longitude","latitude","zoom","bearing","pitch"],V=["longitude","latitude","zoom"];class W extends U{constructor(e={}){let t=Array.isArray(e)?e:e.transitionProps,i=Array.isArray(e)?{}:e;i.transitionProps=Array.isArray(t)?{compare:t,required:t}:t||{compare:j,required:V},super(i.transitionProps),this.opts=i}initializeProps(e,t){let i=super.initializeProps(e,t),{makeViewport:r,around:s}=this.opts;if(r&&s)if(r(e)instanceof z.Ay)f.A.warn("around not supported in GlobeView")();else{let n=r(e),o=r(t),a=n.unproject(s);i.start.around=s,Object.assign(i.end,{around:o.project(a),aroundPosition:a,width:t.width,height:t.height})}return i}interpolateProps(e,t,i){let r={};for(let s of this._propsToExtract)r[s]=(0,I.Cc)(e[s]||0,t[s]||0,i);if(t.aroundPosition&&this.opts.makeViewport){let s=this.opts.makeViewport({...t,...r});Object.assign(r,s.panByPosition(t.aroundPosition,(0,I.Cc)(e.around,t.around,i)))}return r}}let $={transitionDuration:0},H=e=>1-(1-e)*(1-e),q={WHEEL:["wheel"],PAN:["panstart","panmove","panend"],PINCH:["pinchstart","pinchmove","pinchend"],MULTI_PAN:["multipanstart","multipanmove","multipanend"],DOUBLE_CLICK:["dblclick"],KEYBOARD:["keydown"]},K={};class X{constructor(e){this.state={},this._events={},this._interactionState={isDragging:!1},this._customEvents=[],this._eventStartBlocked=null,this._panMove=!1,this.invertPan=!1,this.dragMode="rotate",this.inertia=0,this.scrollZoom=!0,this.dragPan=!0,this.dragRotate=!0,this.doubleClickZoom=!0,this.touchZoom=!0,this.touchRotate=!1,this.keyboard=!0,this.transitionManager=new G({...e,getControllerState:e=>new this.ControllerState(e),onViewStateChange:this._onTransition.bind(this),onStateChange:this._setInteractionState.bind(this)}),this.handleEvent=this.handleEvent.bind(this),this.eventManager=e.eventManager,this.onViewStateChange=e.onViewStateChange||(()=>{}),this.onStateChange=e.onStateChange||(()=>{}),this.makeViewport=e.makeViewport,this.pickPosition=e.pickPosition}set events(e){this.toggleEvents(this._customEvents,!1),this.toggleEvents(e,!0),this._customEvents=e,this.props&&this.setProps(this.props)}finalize(){for(let e in this._events)this._events[e]&&this.eventManager?.off(e,this.handleEvent);this.transitionManager.finalize()}handleEvent(e){this._controllerState=void 0;let t=this._eventStartBlocked;switch(e.type){case"panstart":return!t&&this._onPanStart(e);case"panmove":return this._onPan(e);case"panend":return this._onPanEnd(e);case"pinchstart":return!t&&this._onPinchStart(e);case"pinchmove":return this._onPinch(e);case"pinchend":return this._onPinchEnd(e);case"multipanstart":return!t&&this._onMultiPanStart(e);case"multipanmove":return this._onMultiPan(e);case"multipanend":return this._onMultiPanEnd(e);case"dblclick":return this._onDoubleClick(e);case"wheel":return this._onWheel(e);case"keydown":return this._onKeyDown(e);default:return!1}}get controllerState(){return this._controllerState=this._controllerState||new this.ControllerState({makeViewport:this.makeViewport,...this.props,...this.state}),this._controllerState}getCenter(e){let{x:t,y:i}=this.props,{offsetCenter:r}=e;return[r.x-t,r.y-i]}isPointInBounds(e,t){let{width:i,height:r}=this.props;if(t&&t.handled)return!1;let s=e[0]>=0&&e[0]<=i&&e[1]>=0&&e[1]<=r;return s&&t&&t.stopPropagation(),s}isFunctionKeyPressed(e){let{srcEvent:t}=e;return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}isDragging(){return this._interactionState.isDragging||!1}blockEvents(e){let t=setTimeout(()=>{this._eventStartBlocked===t&&(this._eventStartBlocked=null)},e);this._eventStartBlocked=t}setProps(e){e.dragMode&&(this.dragMode=e.dragMode);let t=this.props;this.props=e,"transitionInterpolator"in e||(e.transitionInterpolator=this._getTransitionProps().transitionInterpolator),this.transitionManager.processViewStateChange(e);let{inertia:i}=e;this.inertia=Number.isFinite(i)?i:300*(!0===i);let{scrollZoom:r=!0,dragPan:s=!0,dragRotate:n=!0,doubleClickZoom:o=!0,touchZoom:a=!0,touchRotate:l=!1,keyboard:h=!0}=e,u=!!this.onViewStateChange;if(this.toggleEvents(q.WHEEL,u&&r),this.toggleEvents(q.PAN,u),this.toggleEvents(q.PINCH,u&&(
1321a||l)),this.toggleEvents(q.MULTI_PAN,u&&l),this.toggleEvents(q.DOUBLE_CLICK,u&&o),this.toggleEvents(q.KEYBOARD,u&&h),this.scrollZoom=r,this.dragPan=s,this.dragRotate=n,this.doubleClickZoom=o,this.touchZoom=a,this.touchRotate=l,this.keyboard=h,(!t||t.height!==e.height||t.width!==e.width||t.maxBounds!==e.maxBounds)&&e.maxBounds){let t=new this.ControllerState({...e,makeViewport:this.makeViewport}),i=t.getViewportProps();Object.keys(i).some(t=>!(0,x.b)(i[t],e[t],1))&&this.updateViewport(t)}}updateTransition(){this.transitionManager.updateTransition()}toggleEvents(e,t){this.eventManager&&e.forEach(e=>{this._events[e]!==t&&(this._events[e]=t,t?this.eventManager.on(e,this.handleEvent):this.eventManager.off(e,this.handleEvent))})}updateViewport(e,t=null,i={}){let r={...e.getViewportProps(),...t},s=this.controllerState!==e;if(this.state=e.getState(),this._setInteractionState(i),s){let e=this.controllerState&&this.controllerState.getViewportProps();this.onViewStateChange&&this.onViewStateChange({viewState:r,interactionState:this._interactionState,oldViewState:e,viewId:this.props.id})}}_onTransition(e){this.onViewStateChange({...e,interactionState:this._interactionState,viewId:this.props.id})}_setInteractionState(e){Object.assign(this._interactionState,e),this.onStateChange(this._interactionState)}_onPanStart(e){let t=this.getCenter(e);if(!this.isPointInBounds(t,e))return!1;let i=this.isFunctionKeyPressed(e)||e.rightButton||!1;(this.invertPan||"pan"===this.dragMode)&&(i=!i);let r=this.controllerState[i?"panStart":"rotateStart"]({pos:t});return this._panMove=i,this.updateViewport(r,$,{isDragging:!0}),!0}_onPan(e){return!!this.isDragging()&&(this._panMove?this._onPanMove(e):this._onPanRotate(e))}_onPanEnd(e){return!!this.isDragging()&&(this._panMove?this._onPanMoveEnd(e):this._onPanRotateEnd(e))}_onPanMove(e){if(!this.dragPan)return!1;let t=this.getCenter(e),i=this.controllerState.pan({pos:t});return this.updateViewport(i,$,{isDragging:!0,isPanning:!0}),!0}_onPanMoveEnd(e){let{inertia:t}=this;if(this.dragPan&&t&&e.velocity){let i=this.getCenter(e),r=[i[0]+e.velocityX*t/2,i[1]+e.velocityY*t/2],s=this.controllerState.pan({pos:r}).panEnd();this.updateViewport(s,{...this._getTransitionProps(),transitionDuration:t,transitionEasing:H},{isDragging:!1,isPanning:!0})}else{let e=this.controllerState.panEnd();this.updateViewport(e,null,{isDragging:!1,isPanning:!1})}return!0}_onPanRotate(e){if(!this.dragRotate)return!1;let t=this.getCenter(e),i=this.controllerState.rotate({pos:t});return this.updateViewport(i,$,{isDragging:!0,isRotating:!0}),!0}_onPanRotateEnd(e){let{inertia:t}=this;if(this.dragRotate&&t&&e.velocity){let i=this.getCenter(e),r=[i[0]+e.velocityX*t/2,i[1]+e.velocityY*t/2],s=this.controllerState.rotate({pos:r}).rotateEnd();this.updateViewport(s,{...this._getTransitionProps(),transitionDuration:t,transitionEasing:H},{isDragging:!1,isRotating:!0})}else{let e=this.controllerState.rotateEnd();this.updateViewport(e,null,{isDragging:!1,isRotating:!1})}return!0}_onWheel(e){if(!this.scrollZoom)return!1;let t=this.getCenter(e);if(!this.isPointInBounds(t,e))return!1;e.srcEvent.preventDefault();let{speed:i=.01,smooth:r=!1}=!0===this.scrollZoom?{}:this.scrollZoom,{delta:s}=e,n=2/(1+Math.exp(-Math.abs(s*i)));s<0&&0!==n&&(n=1/n);let o=r?{...this._getTransitionProps({around:t}),transitionDuration:250}:$,a=this.controllerState.zoom({pos:t,scale:n});return this.updateViewport(a,o,{isZooming:!0,isPanning:!0}),r||this._setInteractionState({isZooming:!1,isPanning:!1}),!0}_onMultiPanStart(e){let t=this.getCenter(e);if(!this.isPointInBounds(t,e))return!1;let i=this.controllerState.rotateStart({pos:t});return this.updateViewport(i,$,{isDragging:!0}),!0}_onMultiPan(e){if(!this.touchRotate||!this.isDragging())return!1;let t=this.getCenter(e);t[0]-=e.deltaX;let i=this.controllerState.rotate({pos:t});return this.updateViewport(i,$,{isDragging:!0,isRotating:!0}),!0}_onMultiPanEnd(e){if(!this.isDragging())return!1;let{inertia:t}=this;if(this.touchRotate&&t&&e.velocityY){let i=this.getCenter(e),r=[i[0],i[1]+=e.velocityY*t/2],s=this.controllerState.rotate({pos:r});this.updateViewport(s,{...this._getTransitionProps(),transitionDuration:t,transitionEasing:H},{isDragging:!1,isRotating:!0}),this.blockEvents(t)}else{let e=this.controllerState.rotateEnd();this.updateViewport(e,null,{isDragging:!1,isRotating:!1})}return!0}_onPinchStart(e){let t=this.getCenter(e);if(!this.isPointInBounds(t,e))return!1;let i=this.controllerState.zoomStart({pos:t}).rotateStart({pos:t});return K._startPinchRotation=e.rotation,K._lastPinchEvent=e,this.updateViewport(i,$,{isDragging:!0}),!0}_onPinch(e){if(!this.touchZoom&&!this.touchRotate||!this.isDragging())return!1;let t=this.controllerState;if(this.touchZoom){let{scale:i}=e,r=this.getCenter(e);t=t.zoom({pos:r,scale:i})}if(this.touchRotate){let{rotation:i}=e;t=t.rotate({deltaAngleX:K._startPinchRotation-i})}return this.updateViewport(t,$,{isDragging:!0,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:this.touchRotate}),K._lastPinchEvent=e,!0}_onPinchEnd(e){if(!this.isDragging())return!1;let{inertia:t}=this,{_lastPinchEvent:i}=K;if(this.touchZoom&&t&&i&&e.scale!==i.scale){let r=this.getCenter(e),s=this.controllerState.rotateEnd(),n=Math.log2(e.scale),o=(n-Math.log2(i.scale))/(e.deltaTime-i.deltaTime),a=Math.pow(2,n+o*t/2);s=s.zoom({pos:r,scale:a}).zoomEnd(),this.updateViewport(s,{...this._getTransitionProps({around:r}),transitionDuration:t,transitionEasing:H},{isDragging:!1,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:!1}),this.blockEvents(t)}else{let e=this.controllerState.zoomEnd().rotateEnd();this.updateViewport(e,null,{isDragging:!1,isPanning:!1,isZooming:!1,isRotating:!1})}return K._startPinchRotation=null,K._lastPinchEvent=null,!0}_onDoubleClick(e){if(!this.doubleClickZoom)return!1;let t=this.getCenter(e);if(!this.isPointInBounds(t,e))return!1;let i=this.isFunctionKeyPressed(e),r=this.controllerState.zoom({pos:t,scale:i?.5:2});return this.updateViewport(r,this._getTransitionProps({around:t}),{isZooming:!0,isPanning:!0}),this.blockEvents(100),!0}_onKeyDown(e){let t;if(!this.keyboard)return!1;let i=this.isFunctionKeyPressed(e),{zoomSpeed:r,moveSpeed:s,rotateSpeedX:n,rotateSpeedY:o}=!0===this.keyboard?{}:this.keyboard,{controllerState:a}=this,l={};switch(e.srcEvent.code){case"Minus":t=i?a.zoomOut(r).zoomOut(r):a.zoomOut(r),l.isZooming=!0;break;case"Equal":t=i?a.zoomIn(r).zoomIn(r):a.zoomIn(r),l.isZooming=!0;break;case"ArrowLeft":i?(t=a.rotateLeft(n),l.isRotating=!0):(t=a.moveLeft(s),l.isPanning=!0);break;case"ArrowRight":i?(t=a.rotateRight(n),l.isRotating=!0):(t=a.moveRight(s),l.isPanning=!0);break;case"ArrowUp":i?(t=a.rotateUp(o),l.isRotating=!0):(t=a.moveUp(s),l.isPanning=!0);break;case"ArrowDown":i?(t=a.rotateDown(o),l.isRotating=!0):(t=a.moveDown(s),l.isPanning=!0);break;default:return!1}return this.updateViewport(t,this._getTransitionProps(),l),!0}_getTransitionProps(e){let{transition:t}=this;return t&&t.transitionInterpolator?e?{...t,transitionInterpolator:new W({...e,...t.transitionInterpolator.opts,makeViewport:this.controllerState.makeViewport})}:t:$}}class Y{constructor(e,t,i){this.makeViewport=i,this._viewportProps=this.applyConstraints(e),this._state=t}getViewportProps(){return this._viewportProps}getState(){return this._state}}var Z=i(45692),Q=i(62768);let J=[[-1/0,-90],[1/0,90]];function ee([e,t]){if(Math.abs(t)>90&&(t=90*Math.sign(t)),Number.isFinite(e)){let[i,r]=(0,Z.Gw)([e,t]);return[i,(0,I.qE)(r,0,512)]}let[,i]=(0,Z.Gw)([0,t]);return[e,(0,I.qE)(i,0,512)]}class et extends Y{constructor(e){let{width:t,height:i,latitude:r,longitude:s,zoom:n,bearing:o=0,pitch:a=0,altitude:l=1.5,position:h=[0,0,0],maxZoom:u=20,minZoom:c=0,maxPitch:d=60,minPitch:f=0,startPanLngLat:p,startZoomLngLat:g,startRotatePos:m,startRotateLngLat:_,startBearing:y,startPitch:v,startZoom:b,normalize:E=!0}=e;(0,k.A)(Number.isFinite(s)),(0,k.A)(Number.isFinite(r)),(0,k.A)(Number.isFinite(n)),super({width:t,height:i,latitude:r,longitude:s,zoom:n,bearing:o,pitch:a,altitude:l,maxZoom:u,minZoom:c,maxPitch:d,minPitch:f,normalize:E,position:h,maxBounds:e.maxBounds||(E?J:null)},{startPanLngLat:p,startZoomLngLat:g,startRotatePos:m,startRotateLngLat:_,startBearing:y,startPitch:v,startZoom:b},e.makeViewport),this.getAltitude=e.getAltitude}panStart({pos:e}
1321){return this._getUpdatedState({startPanLngLat:this._unproject(e)})}pan({pos:e,startPos:t}){let i=this.getState().startPanLngLat||this._unproject(t);if(!i)return this;let r=this.makeViewport(this.getViewportProps()).panByPosition(i,e);return this._getUpdatedState(r)}panEnd(){return this._getUpdatedState({startPanLngLat:null})}rotateStart({pos:e}){let t=this.getAltitude?.(e);return this._getUpdatedState({startRotatePos:e,startRotateLngLat:void 0!==t?this._unproject3D(e,t):void 0,startBearing:this.getViewportProps().bearing,startPitch:this.getViewportProps().pitch})}rotate({pos:e,deltaAngleX:t=0,deltaAngleY:i=0}){let r,{startRotatePos:s,startRotateLngLat:n,startBearing:o,startPitch:a}=this.getState();if(!s||void 0===o||void 0===a)return this;if(r=e?this._getNewRotation(e,s,a,o):{bearing:o+t,pitch:a+i},n){let e=this.makeViewport({...this.getViewportProps(),...r}),t="panByPosition3D"in e?"panByPosition3D":"panByPosition";return this._getUpdatedState({...r,...e[t](n,s)})}return this._getUpdatedState(r)}rotateEnd(){return this._getUpdatedState({startRotatePos:null,startRotateLngLat:null,startBearing:null,startPitch:null})}zoomStart({pos:e}){return this._getUpdatedState({startZoomLngLat:this._unproject(e),startZoom:this.getViewportProps().zoom})}zoom({pos:e,startPos:t,scale:i}){let{startZoom:r,startZoomLngLat:s}=this.getState();if(s||(r=this.getViewportProps().zoom,s=this._unproject(t)||this._unproject(e)),!s)return this;let n=this._constrainZoom(r+Math.log2(i)),o=this.makeViewport({...this.getViewportProps(),zoom:n});return this._getUpdatedState({zoom:n,...o.panByPosition(s,e)})}zoomEnd(){return this._getUpdatedState({startZoomLngLat:null,startZoom:null})}zoomIn(e=2){return this._zoomFromCenter(e)}zoomOut(e=2){return this._zoomFromCenter(1/e)}moveLeft(e=100){return this._panFromCenter([e,0])}moveRight(e=100){return this._panFromCenter([-e,0])}moveUp(e=100){return this._panFromCenter([0,e])}moveDown(e=100){return this._panFromCenter([0,-e])}rotateLeft(e=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing-e})}rotateRight(e=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing+e})}rotateUp(e=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch+e})}rotateDown(e=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch-e})}shortestPathFrom(e){let t=e.getViewportProps(),i={...this.getViewportProps()},{bearing:r,longitude:s}=i;return Math.abs(r-t.bearing)>180&&(i.bearing=r<0?r+360:r-360),Math.abs(s-t.longitude)>180&&(i.longitude=s<0?s+360:s-360),i}applyConstraints(e){let{maxPitch:t,minPitch:i,pitch:r,longitude:s,bearing:n,normalize:o,maxBounds:a}=e;if(o&&((s<-180||s>180)&&(e.longitude=(0,Q.zi)(s+180,360)-180),(n<-180||n>180)&&(e.bearing=(0,Q.zi)(n+180,360)-180)),e.pitch=(0,I.qE)(r,i,t),e.zoom=this._constrainZoom(e.zoom,e),a){let t=ee(a[0]),i=ee(a[1]),r=2**e.zoom,s=e.width/2/r,n=e.height/2/r,[o,l]=(0,Z.iV)([t[0]+s,t[1]+n]),[h,u]=(0,Z.iV)([i[0]-s,i[1]-n]);e.longitude=(0,I.qE)(e.longitude,o,h),e.latitude=(0,I.qE)(e.latitude,l,u)}return e}_constrainZoom(e,t){t||(t=this.getViewportProps());let{maxZoom:i,maxBounds:r}=t,s=null!==r&&t.width>0&&t.height>0,{minZoom:n}=t;if(s){let e=ee(r[0]),s=ee(r[1]),o=s[0]-e[0],a=s[1]-e[1];Number.isFinite(o)&&o>0&&(n=Math.max(n,Math.log2(t.width/o))),Number.isFinite(a)&&a>0&&(n=Math.max(n,Math.log2(t.height/a))),n>i&&(n=i)}return(0,I.qE)(e,n,i)}_zoomFromCenter(e){let{width:t,height:i}=this.getViewportProps();return this.zoom({pos:[t/2,i/2],scale:e})}_panFromCenter(e){let{width:t,height:i}=this.getViewportProps();return this.pan({startPos:[t/2,i/2],pos:[t/2+e[0],i/2+e[1]]})}_getUpdatedState(e){return new this.constructor({makeViewport:this.makeViewport,...this.getViewportProps(),...this.getState(),...e})}_unproject(e){let t=this.makeViewport(this.getViewportProps());return e&&t.unproject(e)}_unproject3D(e,t){return this.makeViewport(this.getViewportProps()).unproject(e,{targetZ:t})}_getNewRotation(e,t,i,r){let s=e[0]-t[0],n=e[1]-t[1],o=e[1],a=t[1],{width:l,height:h}=this.getViewportProps(),u=0;n>0?Math.abs(h-a)>5&&(u=n/(a-h)*1.2):n<0&&a>5&&(u=1-o/a),u=(0,I.qE)(u,-1,1);let{minPitch:c,maxPitch:d}=this.getViewportProps(),f=i;return u>0?f=i+u*(d-i):u<0&&(f=i-u*(c-i)),{pitch:f,bearing:r+s/l*180}}}class ei extends X{constructor(){super(...arguments),this.ControllerState=et,this.transition={transitionDuration:300,transitionInterpolator:new W({transitionProps:{compare:["longitude","latitude","zoom","bearing","pitch","position"],required:["longitude","latitude","zoom"]}})},this.dragMode="pan",this.rotationPivot="center",this._getAltitude=e=>{if("2d"===this.rotationPivot)return 0;if("3d"===this.rotationPivot&&this.pickPosition){let{x:t,y:i}=this.props,r=this.pickPosition(t+e[0],i+e[1]);if(r&&r.coordinate&&r.coordinate.length>
1321=3)return r.coordinate[2]}}}setProps(e){"rotationPivot"in e&&(this.rotationPivot=e.rotationPivot||"center"),e.getAltitude=this._getAltitude,e.position=e.position||[0,0,0],e.maxBounds=e.maxBounds||(!1===e.normalize?null:J),super.setProps(e)}updateViewport(e,t=null,i={}){let r=e.getState();i.isDragging&&r.startRotateLngLat?i={...i,rotationPivotPosition:r.startRotateLngLat}:!1===i.isDragging&&(i={...i,rotationPivotPosition:void 0}),super.updateViewport(e,t,i)}}class er extends R{constructor(e={}){super(e)}getViewportType(){return L.A}get ControllerType(){return ei}}er.displayName="MapView";let es=[255,255,255],en=0;class eo{constructor(e={}){this.type="ambient";let{color:t=es}=e,{intensity:i=1}=e;this.id=e.id||`ambient-${en++}`,this.color=t,this.intensity=i}}var ea=i(3546);let el=[255,255,255],eh=[0,0,-1],eu=0;class ec{constructor(e={}){this.type="directional";let{color:t=el}=e,{intensity:i=1}=e,{direction:r=eh}=e,{_shadow:s=!1}=e;this.id=e.id||`directional-${eu++}`,this.color=t,this.intensity=i,this.type="directional",this.direction=new ea.P(r).normalize().toArray(),this.shadow=s}getProjectedLight(e){return this}}var ed=i(13541);class ef{constructor(e,t={id:"pass"}){let{id:i}=t;this.id=i,this.device=e,this.props={...t}}setProps(e){Object.assign(this.props,e)}render(e){}cleanup(){}}let ep={depthWriteEnabled:!0,depthCompare:"less-equal",blendColorOperation:"add",blendColorSrcFactor:"src-alpha",blendColorDstFactor:"one",blendAlphaOperation:"add",blendAlphaSrcFactor:"one-minus-dst-alpha",blendAlphaDstFactor:"one"};class eg extends ef{constructor(){super(...arguments),this._lastRenderIndex=-1}render(e){this._render(e)}_render(e){let t=this.device.canvasContext,i=e.target??t.getCurrentFramebuffer(),[r,s]=t.getDrawingBufferSize(),n=e.clearCanvas??!0,o=e.clearColor??(!!n&&[0,0,0,0]),a=e.colorMask??15,l={viewport:[0,0,r,s]};e.colorMask&&(l.colorMask=a),e.scissorRect&&(l.scissorRect=e.scissorRect);let h=this.device.beginRenderPass({framebuffer:i,parameters:l,clearColor:o,clearDepth:!!n&&1,clearStencil:!!n&&0});try{return this._drawLayers(h,e)}finally{h.end(),this.device.submit()}}_drawLayers(e,t){let{target:i,shaderModuleProps:r,viewports:s,views:n,onViewportActive:o,clearStack:a=!0}=t;t.pass=t.pass||"unknown",a&&(this._lastRenderIndex=-1);let l=[];for(let a of s){let s=n&&n[a.id];o?.(a);let h=this._getDrawLayerParams(a,t);for(let n of a.subViewports||[a]){let o=this._drawLayersInViewport(e,{target:i,shaderModuleProps:r,viewport:n,view:s,pass:t.pass,layers:t.layers},h);l.push(o)}}return l}_getDrawLayerParams(e,{layers:t,pass:i,isPicking:r=!1,layerFilter:s,cullRect:n,views:o,effects:a,shaderModuleProps:l},h=!1){let u=[],c=function e(t=0,i={}){let r={},s=(n,o)=>{let a,l=n.props._offset,h=n.id,u=n.parent&&n.parent.id;if(!u||u in i||s(n.parent,!1),u in r){let t=r[u]=r[u]||e(i[u],i);a=t(n,o),r[h]=t}else Number.isFinite(l)?(a=l+(i[u]||0),r[h]=null):a=t;return o&&a>=t&&(t=a+1),i[h]=a,a};return s}(this._lastRenderIndex+1),d={layer:t[0],viewport:e,isPicking:r,renderPass:i,cullRect:n},f={};for(let r=0;r<t.length;r++){let n=t[r],p=this._shouldDrawLayer(n,d,s,f),g={shouldDrawLayer:p};p&&!h&&(g.shouldDrawLayer=!0,g.layerRenderIndex=c(n,p),g.shaderModuleProps=this._getShaderModuleProps(n,a,i,l),g.layerParameters={..."webgpu"===n.context.device.type?ep:null,...n.context.deck?.props.parameters,...o?.[e.id]?.props.parameters,...this.getLayerParameters(n,r,e)}),u[r]=g}return u}_drawLayersInViewport(e,{layers:t,shaderModuleProps:i,pass:r,target:s,viewport:n,view:o},a){let l=function(e,{shaderModuleProps:t,target:i,viewport:r}){let s=t?.project?.devicePixelRatio??e.canvasContext.cssToDeviceRatio(),[,n]=e.canvasContext.getDrawingBufferSize(),o=i?i.height:n;return[r.x*s,o-(r.y+r.height)*s,r.width*s,r.height*s]}(this.device,{shaderModuleProps:i,target:s,viewport:n});if(o){let{clear:e,clearColor:t,clearDepth:i,clearStencil:r}=o.props;if(e){let e=[0,0,0,0],n=1,o=0;Array.isArray(t)?e=[...t.slice(0,3),t[3]||255].map(e=>e/255):!1===t&&(e=!1),void 0!==i&&(n=i),void 0!==r&&(o=r),this.device.beginRenderPass({framebuffer:s,parameters:{viewport:l,scissorRect:l},clearColor:e,clearDepth:n,clearStencil:o}).end()}}let h={totalCount:t.length,visibleCount:0,compositeCount:0,pickableCount:0};e.setParameters({viewport:l});for(let i=0;i<t.length;i++){let s=t[i],o=a[i],{shouldDrawLayer:l}=o;if(l&&s.props.pickable&&h.pickableCount++,s.isComposite&&h.compositeCount++,s.isDrawable&&o.shouldDrawLayer){let{layerRenderIndex:t,shaderModuleProps:i,layerParameters:a}=o;h.visibleCount++,this._lastRenderIndex=Math.max(this._lastRenderIndex,t),i.project&&(i.project.viewport=n),s.context.renderPass=e;try{s._drawLayer({renderPass:e,shaderModuleProps:i,uniforms:{layerIndex:t},parameters:a})}catch(e){s.raiseError(e,`drawing ${s} to ${r}`)}}}return h}shouldDrawLayer(e){return!0}getShaderModuleProps(e,t,i){return null}getLayerParameters(e,t,i){return e.props.parameters}_shouldDrawLayer(e,t,i,r){if(!(e.props.visible&&this.shouldDrawLayer(e)))return!1;t.layer=e;let s=e.parent;for(;s;){if(!s.props.visible||!s.filterSubLayer(t))return!1;t.layer=s,s=s.parent}if(i){let e=t.layer.id;if(e in r||(r[e]=i(t)),!r[e])return!1}return e.activateViewport(t.viewport),!0}_getShaderModuleProps(e,t,i,r){let s=this.device.canvasContext.cssToDeviceRatio(),n=e.internalState?.propsInTransition||e.props,o={layer:n,picking:{isActive:!1},project:{viewport:e.context.viewport,devicePixelRatio:s,modelMatrix:n.modelMatrix,coordinateSystem:n.coordinateSystem,coordinateOrigin:n.coordinateOrigin,autoWrapLongitude:e.wrapLongitude}};if(t)for(let i of t)em(o,i.getShaderModuleProps?.(e,o));for(let t of e.context.defaultShaderModules)t.name in o||(o[t.name]={});
1321return em(o,this.getShaderModuleProps(e,t,o),r)}}function em(e,...t){for(let i of t)if(i)for(let t in i)e[t]?Object.assign(e[t],i[t]):e[t]=i[t];return e}class e_ extends eg{constructor(e,t){super(e,t);let i=e.createTexture({format:"rgba8unorm",width:1,height:1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}}),r=e.createTexture({format:"depth16unorm",width:1,height:1});this.fbo=e.createFramebuffer({id:"shadowmap",width:1,height:1,colorAttachments:[i],depthStencilAttachment:r})}delete(){this.fbo&&(this.fbo.destroy(),this.fbo=null)}getShadowMap(){return this.fbo.colorAttachments[0].texture}render(e){let t=this.fbo,i=this.device.canvasContext.cssToDeviceRatio(),r=e.viewports[0],s=r.width*i,n=r.height*i;(s!==t.width||n!==t.height)&&t.resize({width:s,height:n}),super.render({...e,clearColor:[1,1,1,1],target:t,pass:"shadow"})}getLayerParameters(e,t,i){return{...e.props.parameters,blend:!1,depthWriteEnabled:!0,depthCompare:"less-equal"}}shouldDrawLayer(e){return!1!==e.props.shadowEnabled}getShaderModuleProps(e,t,i){return{shadow:{project:i.project,drawToShadowMap:!0}}}}var ey=i(27645),ev=i(36426),eb=i(67238),eE=i(79549);let ex=` 1322layout(std140) uniform shadowUniforms { 1323 bool drawShadowMap; 1324 bool useShadowMap; 1325 vec4 color; 1326 highp int lightId; 1327 float lightCount; 1328 mat4 viewProjectionMatrix0; 1329 mat4 viewProjectionMatrix1; 1330 vec4 projectCenter0; 1331 vec4 projectCenter1; 1332} shadow; 1333`,ew=` 1334const int max_lights = 2; 1335 1336out vec3 shadow_vPosition[max_lights]; 1337 1338vec4 shadow_setVertexPosition(vec4 position_commonspace) { 1339 mat4 viewProjectionMatrices[max_lights]; 1340 viewProjectionMatrices[0] = shadow.viewProjectionMatrix0; 1341 viewProjectionMatrices[1] = shadow.viewProjectionMatrix1; 1342 vec4 projectCenters[max_lights]; 1343 projectCenters[0] = shadow.projectCenter0; 1344 projectCenters[1] = shadow.projectCenter1; 1345 1346 if (shadow.drawShadowMap) { 1347 return project_common_position_to_clipspace(position_commonspace, viewProjectionMatrices[shadow.lightId], projectCenters[shadow.lightId]); 1348 } 1349 if (shadow.useShadowMap) { 1350 for (int i = 0; i < max_lights; i++) { 1351 if(i < int(shadow.lightCount)) { 1352 vec4 shadowMap_position = project_common_position_to_clipspace(position_commonspace, viewProjectionMatrices[i], projectCenters[i]); 1353 shadow_vPosition[i] = (shadowMap_position.xyz / shadowMap_position.w + 1.0) / 2.0; 1354 } 1355 } 1356 } 1357 return gl_Position; 1358} 1359`,eS=` 1360${ex} 1361${ew} 1362`,eP=` 1363const int max_lights = 2; 1364uniform sampler2D shadow_uShadowMap0; 1365uniform sampler2D shadow_uShadowMap1; 1366 1367in vec3 shadow_vPosition[max_lights]; 1368 1369const vec4 bitPackShift = vec4(1.0, 255.0, 65025.0, 16581375.0); 1370const vec4 bitUnpackShift = 1.0 / bitPackShift; 1371const vec4 bitMask = vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0); 1372 1373float shadow_getShadowWeight(vec3 position, sampler2D shadowMap) { 1374 vec4 rgbaDepth = texture(shadowMap, position.xy); 1375 1376 float z = dot(rgbaDepth, bitUnpackShift); 1377 return smoothstep(0.001, 0.01, position.z - z); 1378} 1379 1380vec4 shadow_filterShadowColor(vec4 color) { 1381 if (shadow.drawShadowMap) { 1382 vec4 rgbaDepth = fract(gl_FragCoord.z * bitPackShift); 1383 rgbaDepth -= rgbaDepth.gbaa * bitMask; 1384 return rgbaDepth; 1385 } 1386 if (shadow.useShadowMap) { 1387 float shadowAlpha = 0.0; 1388 shadowAlpha += shadow_getShadowWeight(shadow_vPosition[0], shadow_uShadowMap0); 1389 if(shadow.lightCount > 1.0) { 1390 shadowAlpha += shadow_getShadowWeight(shadow_vPosition[1], shadow_uShadowMap1); 1391 } 1392 shadowAlpha *= shadow.color.a / shadow.lightCount; 1393 float blendedAlpha = shadowAlpha + color.a * (1.0 - shadowAlpha); 1394 1395 return vec4( 1396 mix(color.rgb, shadow.color.rgb, shadowAlpha / blendedAlpha), 1397 blendedAlpha 1398 ); 1399 } 1400 return color; 1401} 1402`,eT=` 1403${ex} 1404${eP} 1405`,eA=(0,eb.A)(function({viewport:e,center:t}){return new ed.k(e.viewProjectionMatrix).invert().transform(t)}),eM=(0,eb.A)(function({viewport:e,shadowMatrices:t}){let i=[],r=e.pixelUnprojectionMatrix,s=e.isGeospatial?void 0:1,n=[[0,0,s],[e.width,0,s],[0,e.height,s],[e.width,e.height,s],[0,0,-1],[e.width,0,-1],[0,e.height,-1],[e.width,e.height,-1]].map(e=>(function(e,t){let[i,r,s]=e,n=(0,Z.xJ)([i,r,s],t);return Number.isFinite(s)?n:[n[0],n[1],0]})(e,r));for(let r of t){let t=r.clone().translate(new ea.P(e.center).negate()),s=n.map(e=>t.transform(e)),o=new ed.k().ortho({left:Math.min(...s.map(e=>e[0])),right:Math.max(...s.map(e=>e[0])),bottom:Math.min(...s.map(e=>e[1])),top:Math.max(...s.map(e=>e[1])),near:Math.min(...s.map(e=>-e[2])),far:Math.max(...s.map(e=>-e[2]))});i.push(o.multiplyRight(r))}return i}),eC=[0,0,0,1],eR=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0],eL={name:"shadow",dependencies:[ev.A],vs:eS,fs:eT,inject:{"vs:DECKGL_FILTER_GL_POSITION":` 1406 position = shadow_setVertexPosition(geometry.position); 1407 `,"fs:DECKGL_FILTER_COLOR":` 1408 color = shadow_filterShadowColor(color); 1409 `},getUniforms:function(e){let{shadowEnabled:t=!0,project:i}=e;if(!t||!i||!e.shadowMatrices||!e.shadowMatrices.length)return{drawShadowMap:!1,useShadowMap:!1,shadow_uShadowMap0:e.dummyShadowMap,shadow_uShadowMap1:e.dummyShadowMap};let r=ev.A.getUniforms(i),s=eA({viewport:i.viewport,center:r.center}),n=[],o=eM({shadowMatrices:e.shadowMatrices,viewport:i.viewport}).slice();for(let t=0;t<e.shadowMatrices.length;t++){let e=o[t],a=e.clone().translate(new ea.P(i.viewport.center).negate());
1409r.coordinateSystem===(0,eE.LB)("lnglat")&&r.projectionMode===ey.Kx.WEB_MERCATOR?(o[t]=a,n[t]=s):(o[t]=e.clone().multiplyRight(eR),n[t]=a.transform(s))}let a={drawShadowMap:!!e.drawToShadowMap,useShadowMap:!!e.shadowMaps&&e.shadowMaps.length>0,color:e.shadowColor||eC,lightId:e.shadowLightId||0,lightCount:e.shadowMatrices.length,shadow_uShadowMap0:e.dummyShadowMap,shadow_uShadowMap1:e.dummyShadowMap};for(let e=0;e<o.length;e++)a[`viewProjectionMatrix${e}`]=o[e],a[`projectCenter${e}`]=n[e];for(let t=0;t<2;t++)a[`shadow_uShadowMap${t}`]=e.shadowMaps&&e.shadowMaps[t]||e.dummyShadowMap;return a},uniformTypes:{drawShadowMap:"f32",useShadowMap:"f32",color:"vec4<f32>",lightId:"i32",lightCount:"f32",viewProjectionMatrix0:"mat4x4<f32>",viewProjectionMatrix1:"mat4x4<f32>",projectCenter0:"vec4<f32>",projectCenter1:"vec4<f32>"}},eI={color:[255,255,255],intensity:1},eO=[{color:[255,255,255],intensity:1,direction:[-1,3,-1]},{color:[255,255,255],intensity:.9,direction:[1,-8,-2.5]}],eN=[0,0,0,200/255];class eF{constructor(e={}){this.id="lighting-effect",this.shadowColor=eN,this.shadow=!1,this.directionalLights=[],this.pointLights=[],this.shadowPasses=[],this.dummyShadowMap=null,this.setProps(e)}setup(e){this.context=e;let{device:t,deck:i}=e;this.shadow&&!this.dummyShadowMap&&(this._createShadowPasses(t),i._addDefaultShaderModule(eL),this.dummyShadowMap=t.createTexture({width:1,height:1}))}setProps(e){for(let t in this.ambientLight=void 0,this.directionalLights=[],this.pointLights=[],e){let i=e[t];switch(i.type){case"ambient":this.ambientLight=i;break;case"directional":this.directionalLights.push(i);break;case"point":this.pointLights.push(i)}}this._applyDefaultLights(),this.shadow=this.directionalLights.some(e=>e.shadow),this.context&&this.setup(this.context),this.props=e}preRender({layers:e,layerFilter:t,viewports:i,onViewportActive:r,views:s}){if(this.shadow){this.shadowMatrices=this._calculateMatrices();for(let n=0;n<this.shadowPasses.length;n++)this.shadowPasses[n].render({layers:e,layerFilter:t,viewports:i,onViewportActive:r,views:s,shaderModuleProps:{shadow:{shadowLightId:n,dummyShadowMap:this.dummyShadowMap,shadowMatrices:this.shadowMatrices}}})}}getShaderModuleProps(e,t){let i=this.shadow?{project:t.project,shadowMaps:this.shadowPasses.map(e=>e.getShadowMap()),dummyShadowMap:this.dummyShadowMap,shadowColor:this.shadowColor,shadowMatrices:this.shadowMatrices}:{},r={enabled:!0,lights:this._getLights(e)},s=e.props.material;return{shadow:i,lighting:r,phongMaterial:s,gouraudMaterial:s}}cleanup(e){for(let e of this.shadowPasses)e.delete();this.shadowPasses.length=0,this.dummyShadowMap&&(this.dummyShadowMap.destroy(),this.dummyShadowMap=null,e.deck._removeDefaultShaderModule(eL))}_calculateMatrices(){let e=[];for(let t of this.directionalLights){let i=new ed.k().lookAt({eye:new ea.P(t.direction).negate()});e.push(i)}return e}_createShadowPasses(e){for(let t=0;t<this.directionalLights.length;t++){let i=new e_(e);this.shadowPasses[t]=i}}_applyDefaultLights(){let{ambientLight:e,pointLights:t,directionalLights:i}=this;e||0!==t.length||0!==i.length||(this.ambientLight=new eo(eI),this.directionalLights.push(new ec(eO[0]),new ec(eO[1])))}_getLights(e){let t=[];for(let i of(this.ambientLight&&t.push(this.ambientLight),this.pointLights))t.push(i.getProjectedLight({layer:e}));for(let i of this.directionalLights)t.push(i.getProjectedLight({layer:e}));return t}}let eD=new eF;class eB{constructor(e){this._resolvedEffects=[],this._defaultEffects=[],this.effects=[],this._context=e,this._needsRedraw="Initial render",this._setEffects([])}addDefaultEffect(e){let t=this._defaultEffects;if(!t.find(t=>t.id===e.id)){let i=t.findIndex(t=>{var i,r;return i=t,r=e,(i.order??1/0)-(r.order??1/0)>0});i<0?t.push(e):t.splice(i,0,e),e.setup(this._context),this._setEffects(this.effects)}}setProps(e){"effects"in e&&!(0,x.b)(e.effects,this.effects,1)&&this._setEffects(e.effects)}needsRedraw(e={clearRedrawFlags:!1}){let t=this._needsRedraw;return e.clearRedrawFlags&&(this._needsRedraw=!1),t}getEffects(){return this._resolvedEffects}_setEffects(e){let t={};for(let e of this.effects)t[e.id]=e;let i=[];for(let r of e){let e=t[r.id],s=r;e&&e!==r?e.setProps?(e.setProps(r.props),s=e):e.cleanup(this._context):e||r.setup(this._context),i.push(s),delete t[r.id]}for(let e in t)t[e].cleanup(this._context);this.effects=i,this._resolvedEffects=i.concat(this._defaultEffects),e.some(e=>e instanceof eF)||this._resolvedEffects.push(eD),this._needsRedraw="effects changed"}finalize(){for(let e of this._resolvedEffects)e.cleanup(this._context);this.effects.length=0,this._resolvedEffects.length=0,this._defaultEffects.length=0}}class eG extends eg{shouldDrawLayer(e){let{operation:t}=e.props;return t.includes("draw")||t.includes("terrain")}render(e){return this._render(e)}}let ek={blendColorOperation:"add",blendColorSrcFactor:"one",blendColorDstFactor:"zero",blendAlphaOperation:"add",blendAlphaSrcFactor:"
1409constant",blendAlphaDstFactor:"zero"};class eU extends eg{constructor(){super(...arguments),this._colorEncoderState=null}render(e){return"pickingFBO"in e?this._drawPickingBuffer(e):{decodePickingColor:null,stats:super._render(e)}}_drawPickingBuffer({layers:e,layerFilter:t,views:i,viewports:r,onViewportActive:s,pickingFBO:n,deviceRect:{x:o,y:a,width:l,height:h},cullRect:u,effects:c,pass:d="picking",pickZ:f,shaderModuleProps:p,clearColor:g}){this.pickZ=f;let m=this._resetColorEncoder(f),_=super._render({target:n,layers:e,layerFilter:t,views:i,viewports:r,onViewportActive:s,cullRect:u,effects:c?.filter(e=>e.useInPicking),pass:d,isPicking:!0,shaderModuleProps:p,clearColor:g??[0,0,0,0],colorMask:15,scissorRect:[o,a,l,h]});return this._colorEncoderState=null,{decodePickingColor:m&&ej.bind(null,m),stats:_}}shouldDrawLayer(e){let{pickable:t,operation:i}=e.props;return t&&i.includes("draw")||i.includes("terrain")||i.includes("mask")}getShaderModuleProps(e,t,i){return{picking:{isActive:1,isAttribute:this.pickZ},lighting:{enabled:!1}}}getLayerParameters(e,t,i){let r={...e.props.parameters},{pickable:s,operation:n}=e.props;return this._colorEncoderState?s&&n.includes("draw")?(Object.assign(r,ek),r.blend=!0,"webgpu"===this.device.type?r.blendConstant=ez(this._colorEncoderState,e,i):r.blendColor=ez(this._colorEncoderState,e,i),n.includes("terrain")&&e.state?._hasPickingCover&&(r.blendAlphaSrcFactor="one")):n.includes("terrain")&&(r.blend=!1):r.blend=!1,r}_resetColorEncoder(e){return this._colorEncoderState=e?null:{byLayer:new Map,byAlpha:[]},this._colorEncoderState}}function ez(e,t,i){let r,{byLayer:s,byAlpha:n}=e,o=s.get(t);return o?(o.viewports.push(i),r=o.a):(r=s.size+1)<=255?(o={a:r,layer:t,viewports:[i]},s.set(t,o),n[r]=o):(f.A.warn("Too many pickable layers, only picking the first 255")(),r=0),[0,0,0,r/255]}function ej(e,t){let i=e.byAlpha[t[3]];return i&&{pickedLayer:i.layer,pickedViewports:i.viewports,pickedObjectIndex:i.layer.decodePickingColor(t)}}class eV{constructor(e,t={}){this.device=e,this.stats=t.stats,this.layerFilter=null,this.drawPickingColors=!1,this.drawLayersPass=new eG(e),this.pickLayersPass=new eU(e),this.renderCount=0,this._needsRedraw="Initial render",this.renderBuffers=[],this.lastPostProcessEffect=null}setProps(e){this.layerFilter!==e.layerFilter&&(this.layerFilter=e.layerFilter,this._needsRedraw="layerFilter changed"),this.drawPickingColors!==e.drawPickingColors&&(this.drawPickingColors=e.drawPickingColors,this._needsRedraw="drawPickingColors changed")}renderLayers(e){if(!e.viewports.length)return;let t=this.drawPickingColors?this.pickLayersPass:this.drawLayersPass,i={layerFilter:this.layerFilter,isPicking:this.drawPickingColors,...e};i.effects&&this._preRender(i.effects,i);let r=this.lastPostProcessEffect?this.renderBuffers[0]:i.target;this.lastPostProcessEffect&&(i.clearColor=[0,0,0,0],i.clearCanvas=!0);let s=t.render({...i,target:r}),n="stats"in s?s.stats:s;i.effects&&(this.lastPostProcessEffect&&(i.clearCanvas=void 0===e.clearCanvas||e.clearCanvas),this._postRender(i.effects,i)),this.renderCount++,(0,p.A)("deckRenderer.renderLayers",this,n,e),this._updateStats(n)}needsRedraw(e={clearRedrawFlags:!1}){let t=this._needsRedraw;return e.clearRedrawFlags&&(this._needsRedraw=!1),t}finalize(){let{renderBuffers:e}=this;for(let t of e)t.delete();e.length=0}_updateStats(e){if(!this.stats)return;let t=0;for(let{visibleCount:i}of e)t+=i;this.stats.get("Layers rendered").addCount(t)}_preRender(e,t){for(let i of(this.lastPostProcessEffect=null,t.preRenderStats=t.preRenderStats||{},e))t.preRenderStats[i.id]=i.preRender(t),i.postRender&&(this.lastPostProcessEffect=i.id);this.lastPostProcessEffect&&this._resizeRenderBuffers()}_resizeRenderBuffers(){let{renderBuffers:e}=this,t=this.device.canvasContext.getDrawingBufferSize(),[i,r]=t;for(let s of(0===e.length&&[0,1].map(t=>{let s=this.device.createTexture({sampler:{minFilter:"linear",magFilter:"linear"},width:i,height:r});e.push(this.device.createFramebuffer({id:`deck-renderbuffer-${t}`,colorAttachments:[s]}))}),e))s.resize(t)}_postRender(e,t){let{renderBuffers:i}=this,r={...t,inputBuffer:i[0],swapBuffer:i[1]};for(let s of e)if(s.postRender){r.target=s.id===this.lastPostProcessEffect?t.target:void 0;let e=s.postRender(r);
1409r.inputBuffer=e,r.swapBuffer=e===i[0]?i[1]:i[0]}}}var eW=i(75457),e$=i(69804);let eH={pickedColor:null,pickedObjectIndex:-1};function eq({pickedColors:e,decodePickingColor:t,deviceX:i,deviceY:r,deviceRadius:s,deviceRect:n}){let{x:o,y:a,width:l,height:h}=n,u=s*s,c=-1,d=0;for(let t=0;t<h;t++){let s=t+a-r,n=s*s;if(n>u)d+=4*l;else for(let t=0;t<l;t++){if(e[d+3]-1>=0){let e=t+o-i,r=e*e+n;r<=u&&(u=r,c=d)}d+=4}}if(c>=0){let i=e.slice(c,c+4),r=t(i);if(r){let e=Math.floor(c/4/l),t=c/4-e*l;return{...r,pickedColor:i,pickedX:o+t,pickedY:a+e}}f.A.error("Picked non-existent layer. Is picking buffer corrupt?")()}return eH}function eK({pickedColors:e,decodePickingColor:t}){let i=new Map;if(e){for(let r=0;r<e.length;r+=4)if(e[r+3]-1>=0){let s=e.slice(r,r+4),n=s.join(",");if(!i.has(n)){let e=t(s);e?i.set(n,{...e,color:s}):f.A.error("Picked non-existent layer. Is picking buffer corrupt?")()}}}return Array.from(i.values())}function eX({pickInfo:e,viewports:t,pixelRatio:i,x:r,y:s,z:n}){let o,a=t[0];if(t.length>1&&(a=function(e,t){for(let i=e.length-1;i>=0;i--){let r=e[i];if(r.containsPixel(t))return r}return e[0]}(e?.pickedViewports||t,{x:r,y:s})),a){let e=[r-a.x,s-a.y];void 0!==n&&(e[2]=n),o=a.unproject(e)}
1409return{color:null,layer:null,viewport:a,index:-1,picked:!1,x:r,y:s,pixel:[r,s],coordinate:o,devicePixel:e&&"pickedX"in e?[e.pickedX,e.pickedY]:void 0,pixelRatio:i}}function eY(e){let{pickInfo:t,lastPickedInfo:i,mode:r,layers:s}=e,{pickedColor:n,pickedLayer:o,pickedObjectIndex:a}=t,l=o?[o]:[];if("hover"===r){let e=i.index,t=i.layerId,r=o?o.props.id:null;if(r!==t||a!==e){if(r!==t){let e=s.find(e=>e.props.id===t);e&&l.unshift(e)}i.layerId=r,i.index=a,i.info=null}}let h=eX(e),u=new Map;return u.set(null,h),l.forEach(e=>{let t={...h};e===o&&(t.color=n,t.index=a,t.picked=!0);let s=(t=eZ({layer:e,info:t,mode:r})).layer;e===o&&"hover"===r&&(i.info=t),u.set(s.id,t),"hover"===r&&s.updateAutoHighlight(t)}),u}function eZ({layer:e,info:t,mode:i}){for(;e&&t;){let r=t.layer||null;t.sourceLayer=r,t.layer=e,t=e.getPickingInfo({info:t,mode:i,sourceLayer:r}),e=e.parent}return t}class eQ{constructor(e,t={}){this._pickable=!0,this.device=e,this.stats=t.stats,this.pickLayersPass=new eU(e),this.lastPickedInfo={index:-1,layerId:null,info:null}}setProps(e){"layerFilter"in e&&(this.layerFilter=e.layerFilter),"_pickable"in e&&(this._pickable=e._pickable)}finalize(){this.pickingFBO&&this.pickingFBO.destroy(),this.depthFBO&&this.depthFBO.destroy()}
1409pickObjectAsync(e){return this._pickClosestObjectAsync(e)}pickObjectsAsync(e){return this._pickVisibleObjectsAsync(e)}pickObject(e){return this._pickClosestObject(e)}pickObjects(e){return this._pickVisibleObjects(e)}getLastPickedObject({x:e,y:t,layers:i,viewports:r},s=this.lastPickedInfo.info){let n=s&&s.layer&&s.layer.id,o=s&&s.viewport&&s.viewport.id,a=n?i.find(e=>e.id===n):null,l=o&&r.find(e=>e.id===o)||r[0],h=l&&l.unproject([e-l.x,t-l.y]);return{...s,x:e,y:t,viewport:l,coordinate:h,layer:a}}_resizeBuffer(e=this.device.getDefaultCanvasContext()){if(!this.pickingFBO){let e=this.device.createTexture({format:"rgba8unorm",width:1,height:1,usage:eW.g.RENDER_ATTACHMENT|eW.g.COPY_SRC});if(this.pickingFBO=this.device.createFramebuffer({colorAttachments:[e],depthStencilAttachment:"depth16unorm"}),this.device.isTextureFormatRenderable("rgba32float")){let e=this.device.createTexture({format:"rgba32float",width:1,height:1,usage:eW.g.RENDER_ATTACHMENT|eW.g.COPY_SRC}),t=this.device.createFramebuffer({colorAttachments:[e],depthStencilAttachment:"depth16unorm"});this.depthFBO=t}}let[t,i]=e.getDrawingBufferSize();this.pickingFBO?.resize({width:t,height:i}),this.depthFBO?.resize({width:t,height:i})}_getPickable(e){if(!1===this._pickable)return null;let t=e.filter(e=>this.pickLayersPass.shouldDrawLayer(e)&&!e.isComposite);return t.length?t:null}async _pickClosestObjectAsync({layers:e,views:t,viewports:i,x:r,y:s,radius:n=0,depth:o=1,mode:a="query",unproject3D:l,canvasContext:h=this.device.getDefaultCanvasContext(),onViewportActive:u,effects:c}){let d,f=h.cssToDeviceRatio(),p=this._getPickable(e);if(!p||0===i.length)return{result:[],emptyInfo:eX({viewports:i,x:r,y:s,pixelRatio:f})};this._resizeBuffer(h);let g=h.cssToDevicePixels([r,s],!0),m=[g.x+Math.floor(g.width/2),g.y+Math.floor(g.height/2)],_=Math.round(n*f),{width:y,height:v}=this.pickingFBO,b=this._getPickingRect({deviceX:m[0],deviceY:m[1],deviceRadius:_,deviceWidth:y,deviceHeight:v}),E={x:r-n,y:s-n,width:2*n+1,height:2*n+1},x=[],w=new Set;for(let e=0;e<o;e++){let n,h;n=b?eq({...await this._drawAndSampleAsync({layers:p,views:t,viewports:i,onViewportActive:u,deviceRect:b,cullRect:E,effects:c,pass:`picking:${a}`}),deviceX:m[0],deviceY:m[1],deviceRadius:_,deviceRect:b}):{pickedColor:null,pickedObjectIndex:-1};let g=this._getDepthLayers(n,p,l);if(g.length>0){let{pickedColors:e}=await this._drawAndSampleAsync({layers:g,views:t,viewports:i,onViewportActive:u,deviceRect:{x:n.pickedX??m[0],y:n.pickedY??m[1],width:1,height:1},cullRect:E,effects:c,pass:`picking:${a}:z`},!0);e[3]&&(h=e[0])}for(let t of(n.pickedLayer&&e+1<o&&(w.add(n.pickedLayer),n.pickedLayer.disablePickingIndex(n.pickedObjectIndex)),(d=eY({pickInfo:n,lastPickedInfo:this.lastPickedInfo,mode:a,layers:p,viewports:i,x:r,y:s,z:h,pixelRatio:f})).values()))t.layer&&x.push(t);if(!n.pickedColor)break}for(let e of w)e.restorePickingColors();return{result:x,emptyInfo:d.get(null)}}_pickClosestObject({layers:e,views:t,viewports:i,x:r,y:s,radius:n=0,depth:o=1,mode:a="query",unproject3D:l,canvasContext:h=this.device.getDefaultCanvasContext(),onViewportActive:u,effects:c}){let d,f=h.cssToDeviceRatio(),p=this._getPickable(e);if(!p||0===i.length)return{result:[],emptyInfo:eX({viewports:i,x:r,y:s,pixelRatio:f})};this._resizeBuffer(h);let g=h.cssToDevicePixels([r,s],!0),m=[g.x+Math.floor(g.width/2),g.y+Math.floor(g.height/2)],_=Math.round(n*f),{width:y,height:v}=this.pickingFBO,b=this._getPickingRect({deviceX:m[0],deviceY:m[1],deviceRadius:_,deviceWidth:y,deviceHeight:v}),E={x:r-n,y:s-n,width:2*n+1,height:2*n+1},x=[],w=new Set;for(let e=0;e<o;e++){let n,h;n=b?eq({...this._drawAndSample({layers:p,views:t,viewports:i,onViewportActive:u,deviceRect:b,cullRect:E,effects:c,pass:`picking:${a}`}),deviceX:m[0],deviceY:m[1],deviceRadius:_,deviceRect:b}):{pickedColor:null,pickedObjectIndex:-1};let g=this._getDepthLayers(n,p,l);if(g.length>0){let{pickedColors:e}=this._drawAndSample({layers:g,views:t,viewports:i,onViewportActive:u,deviceRect:{x:n.pickedX??m[0],y:n.pickedY??m[1],width:1,height:1},cullRect:E,effects:c,pass:`picking:${a}:z`},!0);e[3]&&(h=e[0])}for(let t of(n.pickedLayer&&e+1<o&&(w.add(n.pickedLayer),n.pickedLayer.disablePickingIndex(n.pickedObjectIndex)),(d=eY({pickInfo:n,lastPickedInfo:this.lastPickedInfo,mode:a,layers:p,viewports:i,x:r,y:s,z:h,pixelRatio:f}
1409)).values()))t.layer&&x.push(t);if(!n.pickedColor)break}for(let e of w)e.restorePickingColors();return{result:x,emptyInfo:d.get(null)}}async _pickVisibleObjectsAsync({layers:e,views:t,viewports:i,x:r,y:s,width:n=1,height:o=1,mode:a="query",maxObjects:l=null,canvasContext:h=this.device.getDefaultCanvasContext(),onViewportActive:u,effects:c}){let d=this._getPickable(e);if(!d||0===i.length)return[];this._resizeBuffer(h);let f=h.cssToDeviceRatio(),p=h.cssToDevicePixels([r,s],!0),g=p.x,m=p.y+p.height,_=h.cssToDevicePixels([r+n,s+o],!0),y=_.x+_.width,v=_.y,b=await this._drawAndSampleAsync({layers:d,views:t,viewports:i,onViewportActive:u,deviceRect:{x:g,y:v,width:y-g,height:m-v},cullRect:{x:r,y:s,width:n,height:o},effects:c,pass:`picking:${a}`}),E=eK(b),x=new Map,w=[],S=Number.isFinite(l);for(let e=0;e<E.length&&(!S||!(w.length>=l));e++){let t=E[e],i={color:t.pickedColor,layer:null,index:t.pickedObjectIndex,picked:!0,x:r,y:s,pixelRatio:f},n=(i=eZ({layer:t.pickedLayer,info:i,mode:a})).layer.id;x.has(n)||x.set(n,new Set);let o=x.get(n),l=i.object??i.index;o.has(l)||(o.add(l),w.push(i))}return w}_pickVisibleObjects({layers:e,views:t,viewports:i,x:r,y:s,width:n=1,height:o=1,mode:a="query",maxObjects:l=null,canvasContext:h=this.device.getDefaultCanvasContext(),onViewportActive:u,effects:c}){let d=this._getPickable(e);if(!d||0===i.length)return[];this._resizeBuffer(h);let f=h.cssToDeviceRatio(),p=h.cssToDevicePixels([r,s],!0),g=p.x,m=p.y+p.height,_=h.cssToDevicePixels([r+n,s+o],!0),y=_.x+_.width,v=_.y,b=this._drawAndSample({layers:d,views:t,viewports:i,onViewportActive:u,deviceRect:{x:g,y:v,width:y-g,height:m-v},cullRect:{x:r,y:s,width:n,height:o},effects:c,pass:`picking:${a}`}),E=eK(b),x=new Map,w=[],S=Number.isFinite(l);for(let e=0;e<E.length&&(!S||!(w.length>=l));e++){let t=E[e],i={color:t.pickedColor,layer:null,index:t.pickedObjectIndex,picked:!0,x:r,y:s,pixelRatio:f},n=(i=eZ({layer:t.pickedLayer,info:i,mode:a})).layer.id;x.has(n)||x.set(n,new Set);let o=x.get(n),l=i.object??i.index;o.has(l)||(o.add(l),w.push(i))}return w}async _drawAndSampleAsync({layers:e,views:t,viewports:i,onViewportActive:r,deviceRect:s,cullRect:n,effects:o,pass:a},l=!1){let h=l?this.depthFBO:this.pickingFBO,u={layers:e,layerFilter:this.layerFilter,views:t,viewports:i,onViewportActive:r,pickingFBO:h,deviceRect:s,cullRect:n,effects:o,pass:a,pickZ:l,preRenderStats:{},isPicking:!0};for(let e of o)e.useInPicking&&(u.preRenderStats[e.id]=e.preRender(u));let{decodePickingColor:c,stats:d}=this.pickLayersPass.render(u);this._updateStats(d);let{x:p,y:g,width:m,height:_}=s,y=h.colorAttachments[0]?.texture;if(!y)throw Error("Picking framebuffer color attachment is missing");let v=await this._readTextureDataAsync(y,{x:p,y:g,width:m,height:_},l?Float32Array:Uint8Array);if(!l){let e=!1;for(let t=3;t<v.length;t+=4)if(0!==v[t]){e=!0;break}!e&&v.length>0&&f.A.warn("Async pick readback returned only zero alpha values",{deviceRect:s,bytes:Array.from(v.subarray(0,Math.min(v.length,16)))})()}return{pickedColors:v,decodePickingColor:c}}async _readTextureDataAsync(e,t,i){let{width:r,height:s}=t,n=e.computeMemoryLayout(t),o=this.device.createBuffer({byteLength:n.byteLength,usage:e$.h.COPY_DST|e$.h.MAP_READ});try{e.readBuffer(t,o);let a=await o.readAsync(0,n.byteLength),l=i.BYTES_PER_ELEMENT;if(n.bytesPerRow%l!=0)throw Error(`Texture readback row stride ${n.bytesPerRow} is not aligned to ${l}-byte elements.`);let h=new i(a.buffer,a.byteOffset,n.byteLength/l),u=4*r,c=n.bytesPerRow/l;if(c<u)throw Error(`Texture readback row stride ${c} is smaller than packed row length ${u}.`);let d=new i(r*s*4);for(let e=0;e<s;e++){let t=e*c;d.set(h.subarray(t,t+u),e*u)}return d}finally{o.destroy()}}_drawAndSample({layers:e,views:t,viewports:i,onViewportActive:r,deviceRect:s,cullRect:n,effects:o,pass:a},l=!1){let h=l?this.depthFBO:this.pickingFBO,u={layers:e,layerFilter:this.layerFilter,views:t,viewports:i,onViewportActive:r,pickingFBO:h,deviceRect:s,cullRect:n,effects:o,pass:a,pickZ:l,preRenderStats:{},isPicking:!0};for(let e of o)e.useInPicking&&(u.preRenderStats[e.id]=e.preRender(u));let{decodePickingColor:c,stats:d}=this.pickLayersPass.render(u);this._updateStats(d);let{x:f,y:p,width:g,height:m}=s,_=new(l?Float32Array:Uint8Array)(g*m*4);return this.device.readPixelsToArrayWebGL(h,{sourceX:f,sourceY:p,sourceWidth:g,sourceHeight:m,target:_}),{pickedColors:_,decodePickingColor:c}}_updateStats(e){if(!this.stats)return;let t=0;for(let{visibleCount:i}of e)t+=i;this.stats.get("Layers picked").addCount(t)}_getDepthLayers(e,t,i){if(!i||!this.depthFBO)return[];let{pickedLayer:r}=e,s=r?.state?.terrainDrawMode==="drape";return r&&!s?[r]:t.filter(e=>e.props.operation.includes("terrain"))}_getPickingRect({deviceX:e,deviceY:t,deviceRadius:i,deviceWidth:r,deviceHeight:s}){let n=Math.max(0,e-i),o=Math.max(0,t-i),a=Math.min(r,e+i+1)-n,l=Math.min(s,t+i+1)-o;return a<=0||l<=0?null:{x:n,y:o,width:a,height:l}}}let eJ={"top-left":{top:0,left:0},"top-right":{top:0,right:0},"bottom-left":{bottom:0,left:0},"bottom-right":{bottom:0,right:0},fill:{top:0,left:0,bottom:0,right:0}},e0="root";class e1{constructor({deck:e,parentElement:t}){this.defaultWidgets=[],this.widgets=[],this.resolvedWidgets=[],this.containers={},this.lastViewports={},this.deck=e,t?.classList.add("deck-widget-container"),this.parentElement=t}getWidgets(){return this.resolvedWidgets}setProps(e){if(e.widgets&&!(0,x.b)(e.widgets,this.widgets,1)){let t=e.widgets.filter(
1409Boolean);this._setWidgets(t)}}finalize(){for(let e of this.getWidgets())this._removeWidget(e);for(let e in this.defaultWidgets.length=0,this.resolvedWidgets.length=0,this.containers)this.containers[e].remove()}addDefault(e){this.defaultWidgets.find(t=>t.id===e.id)||(this._addWidget(e),this.defaultWidgets.push(e),this._setWidgets(this.widgets))}onRedraw({viewports:e,layers:t}){let i=e.reduce((e,t)=>(e[t.id]=t,e),{});for(let r of this.getWidgets()){let{viewId:s}=r;if(s){let e=i[s];e&&(r.onViewportChange&&r.onViewportChange(e),r.onRedraw?.({viewports:[e],layers:t}))}else{if(r.onViewportChange)for(let t of e)r.onViewportChange(t);r.onRedraw?.({viewports:e,layers:t})}}this.lastViewports=i,this._updateContainers()}onHover(e,t){for(let i of this.getWidgets()){let{viewId:r}=i;r&&r!==e.viewport?.id||i.onHover?.(e,t)}}onEvent(e,t){let i=ey.tg[t.type];if(i)for(let r of this.getWidgets()){let{viewId:s}=r;s&&s!==e.viewport?.id||r[i]?.(e,t)}}_setWidgets(e){let t={};for(let e of this.resolvedWidgets)t[e.id]=e;for(let e of(this.resolvedWidgets.length=0,this.defaultWidgets))t[e.id]=null,this.resolvedWidgets.push(e);for(let i of e){let e=t[i.id];e?e.viewId!==i.viewId||e.placement!==i.placement?(this._removeWidget(e),this._addWidget(i)):i!==e&&(e.setProps(i.props),i=e):this._addWidget(i),t[i.id]=null,this.resolvedWidgets.push(i)}for(let e in t){let i=t[e];i&&this._removeWidget(i)}this.widgets=e}_addWidget(e){let{viewId:t=null,placement:i="top-left"}=e,r=e.props._container??t;e.widgetManager=this,e.deck=this.deck,e.rootElement=e._onAdd({deck:this.deck,viewId:t}),e.rootElement&&this._getContainer(r,i).append(e.rootElement),e.updateHTML()}_removeWidget(e){e.onRemove?.(),e.rootElement&&e.rootElement.remove(),e.rootElement=void 0,e.deck=void 0,e.widgetManager=void 0}_getContainer(e,t){if(e&&"string"!=typeof e)return e;let i=e||e0,r=this.containers[i];r||((r=document.createElement("div")).style.pointerEvents="none",r.style.position="absolute",r.style.overflow="hidden",this.parentElement?.append(r),this.containers[i]=r);let s=r.querySelector(`.${t}`);return s||((s=globalThis.document.createElement("div")).className=t,s.style.position="absolute",s.style.zIndex="2",Object.assign(s.style,eJ[t]),r.append(s)),s}_updateContainers(){let e=this.deck.width,t=this.deck.height;for(let i in this.containers){let r=this.lastViewports[i]||null,s=i===e0||r,n=this.containers[i];s?(n.style.display="block",n.style.left=`${r?r.x:0}px`,n.style.top=`${r?r.y:0}px`,n.style.width=`${r?r.width:e}px`,n.style.height=`${r?r.height:t}px`):n.style.display="none"}}}function e3(e,t){t&&Object.entries(t).map(([t,i])=>{t.startsWith("--")?e.style.setProperty(t,i):e.style[t]=i})}class e2{constructor(e){this.viewId=null,this.props={...this.constructor.defaultProps,...e},this.id=this.props.id}setProps(e){let t=this.props,i=this.rootElement;if(i&&t.className!==e.className&&(t.className&&i.classList.remove(t.className),e.className&&i.classList.add(e.className)),i&&!(0,x.b)(t.style,e.style,1)){var r;(r=t.style)&&Object.keys(r).map(e=>{e.startsWith("--")?i.style.removeProperty(e):i.style[e]=""}),e3(i,e.style)}Object.assign(this.props,e),this.updateHTML()}updateHTML(){this.rootElement&&this.onRenderHTML(this.rootElement)}get viewIds(){return this.viewId?[this.viewId]:this.deck?.getViews().map(e=>e.id)??[]}getViewState(e){return this.deck?.viewManager?.getViewState(e)||{}}setViewState(e,t){this.deck?._onViewStateChange({viewId:e,viewState:t,interactionState:{}})}onCreateRootElement(){let e=["deck-widget",this.className,this.props.className],t=document.createElement("div");return e.filter(e=>"string"==typeof e&&e.length>0).forEach(e=>t.classList.add(e)),e3(t,this.props.style),t}_onAdd(e){return this.onAdd(e)??this.onCreateRootElement()}onAdd(e){}onRemove(){}onViewportChange(e){}onRedraw(e){}onHover(e,t){}onClick(e,t){}onDrag(e,t){}onDragStart(e,t){}onDragEnd(e,t){}}e2.defaultProps={id:"widget",style:{},_container:null,className:""};let e4={zIndex:"1",position:"absolute",pointerEvents:"none",color:"#a0a7b4",backgroundColor:"#29323c",padding:"10px",top:"0",left:"0",display:"none"};class e6 extends e2{constructor(e={}){super(e),this.id="default-tooltip",this.placement="fill",this.className="deck-tooltip",this.isVisible=!1,this.setProps(e)}
1409onCreateRootElement(){let e=document.createElement("div");return e.className=this.className,Object.assign(e.style,e4),e}onRenderHTML(e){}onViewportChange(e){this.isVisible&&e.id===this.lastViewport?.id&&!e.equals(this.lastViewport)&&this.setTooltip(null),this.lastViewport=e}onHover(e){let{deck:t}=this,i=t&&t.props.getTooltip;if(!i)return;let r=i(e);this.setTooltip(r,e.x,e.y)}setTooltip(e,t,i){let r=this.rootElement;if(r){if("string"==typeof e)r.innerText=e;else if(e)e.text&&(r.innerText=e.text),e.html&&(r.innerHTML=e.html),e.className&&(r.className=e.className);else{this.isVisible=!1,r.style.display="none";return}this.isVisible=!0,r.style.display="block",r.style.transform=`translate(${t}px, ${i}px)`,e&&"object"==typeof e&&"style"in e&&Object.assign(r.style,e.style)}}}e6.defaultProps={...e2.defaultProps};var e8=i(94996),e5=i(68456),e7=i(89575),e9=i(96347);let te=globalThis.loaders?.parseImageNode,tt="undefined"!=typeof Image,ti="undefined"!=typeof ImageBitmap,tr=!!e9.Bd||!!te,ts=/^data:image\/svg\+xml/,tn=/\.svg((\?|#).*)?$/;function to(e){return e&&(ts.test(e)||tn.test(e))}function ta(e,t){if(to(t))throw Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function tl(e,t,i){let r=function(e,t){if(to(t)){let t=new TextDecoder().decode(e);try{"function"==typeof unescape&&"function"==typeof encodeURIComponent&&(t=unescape(encodeURIComponent(t)))}catch(e){throw Error(e.message)}return`data:image/svg+xml;base64,${btoa(t)}`}return ta(e,t)}
1409(e,i),s=self.URL||self.webkitURL,n="string"!=typeof r&&s.createObjectURL(r);try{return await th(n||r,t)}finally{n&&s.revokeObjectURL(n)}}async function th(e,t){let i=new Image;return(i.src=e,t.image&&t.image.decode&&i.decode)?(await i.decode(),i):await new Promise((e,t)=>{try{i.onload=()=>e(i),i.onerror=e=>{let i=e instanceof Error?e.message:"error";t(Error(i))}}catch(e){t(e)}})}let tu=!0;async function tc(e,t,i){let r;r=to(i)?await tl(e,t,i):ta(e,i);let s=t&&t.imagebitmap;return await td(r,s)}async function td(e,t=null){if((function(e){if(!e)return!0;for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(t)||!tu)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(e){console.warn(e),tu=!1}return await createImageBitmap(e)}function tf(e){let t=tp(e);return function(e){let t=tp(e);return t.byteLength>=24&&0x89504e47===t.getUint32(0,!1)?{mimeType:"image/png",width:t.getUint32(16,!1),height:t.getUint32(20,!1)}:null}(t)||function(e){let t=tp(e);if(!(t.byteLength>=3&&65496===t.getUint16(0,!1)&&255===t.getUint8(2)))return null;let{tableMarkers:i,sofMarkers:r}=function(){let e=new Set([65499,65476,65484,65501,65534]);for(let t=65504;t<65520;++t)e.add(t);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}(),s=2;for(;s+9<t.byteLength;){let e=t.getUint16(s,!1);if(r.has(e))return{mimeType:"image/jpeg",height:t.getUint16(s+5,!1),width:t.getUint16(s+7,!1)};if(!i.has(e))break;s+=2,s+=t.getUint16(s,!1)}return null}(t)||function(e){let t=tp(e);return t.byteLength>=10&&0x47494638===t.getUint32(0,!1)?{mimeType:"image/gif",width:t.getUint16(6,!0),height:t.getUint16(8,!0)}:null}(t)||function(e){let t=tp(e);return t.byteLength>=14&&16973===t.getUint16(0,!1)&&t.getUint32(2,!0)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,!0),height:t.getUint32(22,!0)}:null}(t)||function(e){var t;let i=!function(e,t,i=0){let r=[...t].map(e=>e.charCodeAt(0));for(let t=0;t<r.length;++t)if(r[t]!==e[t+i])return!1;return!0}(t=new Uint8Array(e instanceof DataView?e.buffer:e),"ftyp",4)||(96&t[8])==0?null:function(e){switch(String.fromCharCode(...e.slice(8,12)).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}(t);return i?{mimeType:i.mimeType,width:0,height:0}:null}(t)}function tp(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw Error("toDataView")}async function tg(e,t){let{mimeType:i}=tf(e)||{},r=globalThis.loaders?.parseImageNode;return(0,e7.v)(r),await r(e,i)}let tm={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:"4.4.3",mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],extensions:["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],parse:async function e(e,t,i){let r,s=((t=t||{}).image||{}).type||"auto",{url:n}=i||{};switch(function(e){switch(e){case"auto":case"data":if(ti)return"imagebitmap";if(tt)return"image";if(tr)return"data";throw Error("Install '@loaders.gl/polyfills' to parse images under Node.js");default:return!function(e){switch(e){case"auto":return ti;case"imagebitmap":case"image":case"data":return;default:throw Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}(e),e}}(s)){case"imagebitmap":r=await tc(e,t,n);break;case"image":r=await tl(e,t,n);break;case"data":r=await tg(e,t);break;default:(0,e7.v)(!1)}return"data"===s&&(r=function(e){switch(function(e){var t;let i=(t=e,"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?"imagebitmap":"undefined"!=typeof Image&&t instanceof Image?"image":t&&"object"==typeof t&&t.data&&t.width&&t.height?"data":null);if(!i)throw Error("Not an image");return i}(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),i=t.getContext("2d");if(!i)throw Error("getImageData");return t.width=e.width,t.height=e.height,i.drawImage(e,0,0),i.getImageData(0,0,e.width,e.height);default:throw Error("getImageData")}}(r)),r},tests:[e=>!!tf(new DataView(e))],options:{image:{type:"auto",decode:!0}}},t_={dataType:null,batchType:null,id:"JSON",name:"JSON",module:"",version:"",options:{},extensions:["json","geojson"],mimeTypes:["application/json","application/geo+json"],testText:function(e){let t=e[0],i=e[e.length-1];return"{"===t&&"}"===i||"["===t&&"]"===i},parseTextSync:JSON.parse},ty=function(){let e="9.3.6",t=globalThis.deck&&globalThis.deck.VERSION;if(t&&t!==e)throw Error(`deck.gl - multiple versions detected: ${t} vs ${e}`);return t||(f.A.log(1,`deck.gl ${e}`)(),globalThis.deck={...globalThis.deck,VERSION:e,version:e,log:f.A,_registerLoggers:p.k},(0,e5.mk)([t_,[tm,{imagebitmap:{premultiplyAlpha:"none"}}]])),e}();var tv=i(64734),tb=i(88743),tE=i(79904);let tx="No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.";class tw{static defaultProps={...tv.pF.defaultProps,type:"best-available",adapters:void 0,waitForPageLoad:!0};stats=tb.d;log=tE.R;VERSION="9.3.6";spector;preregisteredAdapters=new Map;constructor(){if(globalThis.luma){if(globalThis.luma.VERSION!==this.VERSION)throw tE.R.error(`Found luma.gl ${globalThis.luma.VERSION} while initialzing ${this.VERSION}`)(),tE.R.error("'yarn why @luma.gl/core' can help identify the source of the conflict")(),Error("luma.gl - multiple versions detected: see console log");tE.R.error("This version of luma.gl has already been initialized")()}tE.R.log(1,`${this.VERSION} - set luma.log.level=1 (or higher) to trace rendering`)(),globalThis.luma=this}async createDevice(e={}){let t={...tw.defaultProps,...e},i=this.selectAdapter(t.type,t.adapters);if(!i)throw Error(tx);return t.waitForPageLoad&&await i.pageLoaded,await i.create(t)}async attachDevice(e,t){let i=this._getTypeFromHandle(e,t.adapters),r=i&&this.selectAdapter(i,t.adapters);if(!r)throw Error(tx);return await r?.attach?.(e,t)}registerAdapters(e){for(let t of e)this.preregisteredAdapters.set(t.type,t)}
1409getSupportedAdapters(e=[]){return Array.from(this._getAdapterMap(e)).map(([,e])=>e).filter(e=>e.isSupported?.()).map(e=>e.type)}getBestAvailableAdapterType(e=[]){let t=this._getAdapterMap(e);for(let e of["webgpu","webgl","null"])if(t.get(e)?.isSupported?.())return e;return null}selectAdapter(e,t=[]){let i=e;"best-available"===e&&(i=this.getBestAvailableAdapterType(t));let r=this._getAdapterMap(t);return i&&r.get(i)||null}enforceWebGL2(e=!0,t=[]){let i=this._getAdapterMap(t).get("webgl");i||tE.R.warn("enforceWebGL2: webgl adapter not found")(),i?.enforceWebGL2?.(e)}setDefaultDeviceProps(e){Object.assign(tw.defaultProps,e)}_getAdapterMap(e=[]){let t=new Map(this.preregisteredAdapters);for(let i of e)t.set(i.type,i);return t}_getTypeFromHandle(e,t=[]){return e instanceof WebGL2RenderingContext?"webgl":"undefined"!=typeof GPUDevice&&e instanceof GPUDevice||e?.queue?"webgpu":null===e?"null":(e instanceof WebGLRenderingContext?tE.R.warn("WebGL1 is not supported",e)():tE.R.warn("Unknown handle type",e)(),null)}}let tS=new tw;var tP=i(2622);class tT{get pageLoaded(){return tM||(tM=tA&&"complete"===document.readyState||"undefined"==typeof window?Promise.resolve():new Promise(e=>window.addEventListener("load",()=>e()))),tM}}let tA=(0,tP.B)()&&"undefined"!=typeof document,tM=null,tC={WEBGL_depth_texture:{UNSIGNED_INT_24_8_WEBGL:34042},OES_element_index_uint:{},OES_texture_float:{},OES_texture_half_float:{HALF_FLOAT_OES:5131},EXT_color_buffer_float:{},OES_standard_derivatives:{FRAGMENT_SHADER_DERIVATIVE_HINT_OES:35723},EXT_frag_depth:{},EXT_blend_minmax:{MIN_EXT:32775,MAX_EXT:32776},EXT_shader_texture_lod:{}};var tR=i(44168),tL=i(77142);class tI extends tT{type="webgl";constructor(){super(),tv.pF.defaultProps={...tv.pF.defaultProps,...tR.ic}}enforceWebGL2(e){!function(e=!0){let t=HTMLCanvasElement.prototype;if(!e&&t.originalGetContext){t.getContext=t.originalGetContext,t.originalGetContext=void 0;return}t.originalGetContext=t.getContext,t.getContext=function(e,t){if("webgl"===e||"experimental-webgl"===e){let e=this.originalGetContext("webgl2",t);return e instanceof HTMLElement&&function(e){e.getExtension("EXT_color_buffer_float");let t={...tC,WEBGL_disjoint_timer_query:e.getExtension("EXT_disjoint_timer_query_webgl2"),WEBGL_draw_buffers:{drawBuffersWEBGL:t=>e.drawBuffers(t),COLOR_ATTACHMENT0_WEBGL:36064,COLOR_ATTACHMENT1_WEBGL:36065,COLOR_ATTACHMENT2_WEBGL:36066,COLOR_ATTACHMENT3_WEBGL:36067},OES_vertex_array_object:{VERTEX_ARRAY_BINDING_OES:34229,createVertexArrayOES:()=>e.createVertexArray(),deleteVertexArrayOES:t=>e.deleteVertexArray(t),isVertexArrayOES:t=>e.isVertexArray(t),bindVertexArrayOES:t=>e.bindVertexArray(t)},ANGLE_instanced_arrays:{VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE:35070,drawArraysInstancedANGLE:(...t)=>e.drawArraysInstanced(...t),drawElementsInstancedANGLE:(...t)=>e.drawElementsInstanced(...t),vertexAttribDivisorANGLE:(...t)=>e.vertexAttribDivisor(...t)}},i=e.getExtension;e.getExtension=function(r){let s=i.call(e,r);return s||(r in t?t[r]:null)};let r=e.getSupportedExtensions;e.getSupportedExtensions=function(){let i=r.apply(e)||[];return i?.concat(Object.keys(t))}}(e),e}return this.originalGetContext(e,t)}}(e)}isSupported(){return"undefined"!=typeof WebGL2RenderingContext}isDeviceHandle(e){return!!("undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext)||("undefined"!=typeof WebGLRenderingContext&&e instanceof WebGLRenderingContext&&tE.R.warn("WebGL1 is not supported",e)(),!1)}async attach(e,t={}){var r;let{WebGLDevice:s}=await Promise.resolve().then(i.bind(i,77541));if(e instanceof s)return e;let n=s.getDeviceFromContext(e);if(n)return n;if(r=e,!("undefined"!=typeof WebGL2RenderingContext&&r instanceof WebGL2RenderingContext)&&(!r||"function"!=typeof r.createVertexArray))throw Error("Invalid WebGL2RenderingContext");let o=!0===t.createCanvasContext?{}:t.createCanvasContext;return new s({...t,_handle:e,createCanvasContext:{canvas:e.canvas,autoResize:!1,...o}})}async create(e={}){let{WebGLDevice:t}=await Promise.resolve().then(i.bind(i,77541)),r=[];for(let t of((e.debugWebGL||e.debug)&&r.push((0,tL.$)()),e.debugSpectorJS&&r.push((0,tR._G)(e)),await Promise.allSettled(r)))"rejected"===t.status&&tE.R.error(`Failed to initialize debug libraries ${t.reason}`)();try{let i=new t(e);tE.R.groupCollapsed(1,`WebGLDevice ${i.id} created`)();let r=`\ 1410${i._reused?"Reusing":"Created"} device with WebGL2 ${i.props.debug?"debug ":""}context: \ 1411${i.info.vendor}, ${i.info.renderer} for canvas: ${i.canvasContext.id}`;return tE.R.probe(1,r)(),tE.R.table(1,i.info)(),i}finally{tE.R.groupEnd(1)(),tE.R.info(1,"%cWebGL call tracing: luma.log.set('debug-webgl') ","color: white; background: blue; padding: 2px 6px; border-radius: 3px;")()}}}let tO=new tI,tN=0;class tF{static defaultAnimationLoopProps={device:null,onAddHTML:()=>"",onInitialize:async()=>null,onRender:()=>{},onFinalize:()=>{},onError:e=>console.error(e),stats:void 0,autoResizeViewport:!1};device=null;canvas=null;props;animationProps=null;timeline=null;stats;sharedStats;cpuTime;gpuTime;frameRate;display;_needsRedraw="initialized";_initialized=!1;_running=!1;_animationFrameId=null;_nextFramePromise=null;_resolveNextFrame=null;_cpuStartTime=0;_error=null;_lastFrameTime=0;constructor(e){if(this.props={...tF.defaultAnimationLoopProps,...e}
1411,!(e=this.props).device)throw Error("No device provided");this.stats=e.stats||new m.Uz({id:`animation-loop-${tN++}`}),this.sharedStats=tS.stats.get("Animation Loop"),this.frameRate=this.stats.get("Frame Rate"),this.frameRate.setSampleSize(1),this.cpuTime=this.stats.get("CPU Time"),this.gpuTime=this.stats.get("GPU Time"),this.setProps({autoResizeViewport:e.autoResizeViewport}),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this._onMousemove=this._onMousemove.bind(this),this._onMouseleave=this._onMouseleave.bind(this)}destroy(){this.stop(),this._setDisplay(null),this.device?._disableDebugGPUTime()}delete(){this.destroy()}reportError(e){this.props.onError(e),this._error=e}setNeedsRedraw(e){return this._needsRedraw=this._needsRedraw||e,this}needsRedraw(){let e=this._needsRedraw;return this._needsRedraw=!1,e}setProps(e){return"autoResizeViewport"in e&&(this.props.autoResizeViewport=e.autoResizeViewport||!1),this}async start(){if(this._running)return this;this._running=!0;try{let e;if(!this._initialized){if(this._initialized=!0,await this._initDevice(),this._initialize(),!this._running)return null;await this.props.onInitialize(this._getAnimationProps())}if(!this._running)return null;return!1!==e&&(this._cancelAnimationFrame(),this._requestAnimationFrame()),this}catch(t){let e=t instanceof Error?t:Error("Unknown error");throw this.props.onError(e),e}}stop(){return this._running&&(this.animationProps&&!this._error&&this.props.onFinalize(this.animationProps),this._cancelAnimationFrame(),this._nextFramePromise=null,this._resolveNextFrame=null,this._running=!1,this._lastFrameTime=0),this}redraw(e){return this.device?.isLost||this._error||(this._beginFrameTimers(e),this._setupFrame(),this._updateAnimationProps(),this._renderFrame(this._getAnimationProps()),this._clearNeedsRedraw(),this._resolveNextFrame&&(this._resolveNextFrame(this),this._nextFramePromise=null,this._resolveNextFrame=null),this._endFrameTimers()),this}attachTimeline(e){return this.timeline=e,this.timeline}detachTimeline(){this.timeline=null}waitForRender(){return this.setNeedsRedraw("waitForRender"),this._nextFramePromise||(this._nextFramePromise=new Promise(e=>{this._resolveNextFrame=e})),this._nextFramePromise}async toDataURL(){if(this.setNeedsRedraw("toDataURL"),await this.waitForRender(),this.canvas instanceof HTMLCanvasElement)return this.canvas.toDataURL();throw Error("OffscreenCanvas")}_initialize(){this._startEventHandling(),this._initializeAnimationProps(),this._updateAnimationProps(),this._resizeViewport(),this.device?._enableDebugGPUTime()}_setDisplay(e){this.display&&(this.display.destroy(),this.display.animationLoop=null),e&&(e.animationLoop=this),this.display=e}_requestAnimationFrame(){this._running&&(this._animationFrameId=function(e){let t="undefined"!=typeof window?window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame:null;return t?t.call(window,e):setTimeout(()=>e("undefined"!=typeof performance?performance.now():Date.now()),1e3/60)}(this._animationFrame.bind(this)))}_cancelAnimationFrame(){null!==this._animationFrameId&&(!function(e){let t="undefined"!=typeof window?window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame:null;if(t)return t.call(window,e);clearTimeout(e)}(this._animationFrameId),this._animationFrameId=null)}_animationFrame(e){this._running&&(this.redraw(e),this._requestAnimationFrame())}_renderFrame(e){if(this.display)return void this.display._renderFrame(e);this.props.onRender(this._getAnimationProps()),this.device?.submit()}_clearNeedsRedraw(){this._needsRedraw=!1}_setupFrame(){this._resizeViewport()}_initializeAnimationProps(){let e=this.device?.getDefaultCanvasContext();if(!this.device||!e)throw Error("loop");let t=e?.canvas,i=e.props.useDevicePixels;this.animationProps={animationLoop:this,device:this.device,canvasContext:e,canvas:t,useDevicePixels:i,timeline:this.timeline,needsRedraw:!1,width:1,height:1,aspect:1,time:0,startTime:Date.now(),engineTime:0,tick:0,tock:0,_mousePosition:null}}_getAnimationProps(){if(!this.animationProps)throw Error("animationProps");return this.animationProps}_updateAnimationProps(){if(!this.animationProps)return;let{width:e,height:t,aspect:i}=this._getSizeAndAspect();(e!==this.animationProps.width||t!==this.animationProps.height)&&this.setNeedsRedraw("drawing buffer resized"),i!==this.animationProps.aspect&&this.setNeedsRedraw("drawing buffer aspect changed"),this.animationProps.width=e,this.animationProps.height=t,this.animationProps.aspect=i,this.animationProps.needsRedraw=this._needsRedraw,this.animationProps.engineTime=Date.now()-this.animationProps.startTime,this.timeline&&this.timeline.update(this.animationProps.engineTime),this.animationProps.tick=Math.floor(this.animationProps.time/1e3*60),this.animationProps.tock++,this.animationProps.time=this.timeline?this.timeline.getTime():this.animationProps.engineTime}async _initDevice(){if(this.device=await this.props.device,!this.device)throw Error("No device provided");this.canvas=this.device.getDefaultCanvasContext().canvas||null}_createInfoDiv(){if(this.canvas&&this.props.onAddHTML){let e=document.createElement("div");document.body.appendChild(e),e.style.position="relative";let t=document.createElement("div");t.style.position="absolute",t.style.left="10px",t.style.bottom="10px",t.style.width="300px",t.style.background="white",this.canvas instanceof HTMLCanvasElement&&e.appendChild(this.canvas),e.appendChild(t);let i=this.props.onAddHTML(t);i&&(t.innerHTML=i)}}_getSizeAndAspect(){if(!this.device)return{width:1,height:1,aspect:1};let[e,t]=this.device.getDefaultCanvasContext().getDrawingBufferSize();return{width:e,height:t,aspect:e>0&&t>0?e/t:1}}_resizeViewport(){this.props.autoResizeViewport&&this.device.gl&&this.device.gl.viewport(0,0,this.device.gl.drawingBufferWidth,this.device.gl.drawingBufferHeight)}_beginFrameTimers(e){let t=e??("undefined"!=typeof performance?performance.now():Date.now());if(this._lastFrameTime){let e=t-this._lastFrameTime;e>0&&this.frameRate.addTime(e)}this._lastFrameTime=t,this.device?._isDebugGPUTimeEnabled()&&this._consumeEncodedGpuTime(),this.cpuTime.timeStart()}_endFrameTimers(){this.device?._isDebugGPUTimeEnabled()&&this._consumeEncodedGpuTime(),this.cpuTime.timeEnd(),this._updateSharedStats()}_consumeEncodedGpuTime(){if(!this.device)return;let e=this.device.commandEncoder._gpuTimeMs;void 0!==e&&(this.gpuTime.addTime(e),this.device.commandEncoder._gpuTimeMs=void 0)}_updateSharedStats(){if(this.stats!==this.sharedStats){for(let e of Object.keys(this.sharedStats.stats)
1411)this.stats.stats[e]||delete this.sharedStats.stats[e];this.stats.forEach(e=>{let t=this.sharedStats.get(e.name,e.type);t.sampleSize=e.sampleSize,t.time=e.time,t.count=e.count,t.samples=e.samples,t.lastTiming=e.lastTiming,t.lastSampleTime=e.lastSampleTime,t.lastSampleCount=e.lastSampleCount,t._count=e._count,t._time=e._time,t._samples=e._samples,t._startTime=e._startTime,t._timerPending=e._timerPending})}}_startEventHandling(){this.canvas&&(this.canvas.addEventListener("mousemove",this._onMousemove.bind(this)),this.canvas.addEventListener("mouseleave",this._onMouseleave.bind(this)))}_onMousemove(e){e instanceof MouseEvent&&(this._getAnimationProps()._mousePosition=[e.offsetX,e.offsetY])}_onMouseleave(e){this._getAnimationProps()._mousePosition=null}}var tD=i(84996);function tB(){}let tG={id:"",width:"100%",height:"100%",style:null,viewState:null,initialViewState:null,pickingRadius:0,pickAsync:"auto",layerFilter:null,parameters:{},parent:null,device:null,deviceProps:{},gl:null,canvas:null,layers:[],effects:[],views:null,controller:null,useDevicePixels:!0,touchAction:"none",eventRecognizerOptions:{},_framebuffer:null,_animate:!1,_pickable:!0,_typedArrayManagerProps:{},_customRender:null,widgets:[],onDeviceInitialized:tB,onWebGLInitialized:tB,onResize:tB,onViewStateChange:tB,onInteractionStateChange:tB,onBeforeRender:tB,onAfterRender:tB,onLoad:tB,onError:e=>f.A.error(e.message,e.cause)(),onHover:null,onClick:null,onDragStart:null,onDrag:null,onDragEnd:null,_onMetrics:null,getCursor:({isDragging:e})=>e?"grabbing":"grab",getTooltip:null,debug:!1,drawPickingColors:!1};class tk{constructor(e){this.width=0,this.height=0,this.userData={},this.device=null,this.canvas=null,this.viewManager=null,this.layerManager=null,this.effectManager=null,this.deckRenderer=null,this.deckPicker=null,this.eventManager=null,this.widgetManager=null,this.tooltip=null,this.animationLoop=null,this._canvasContext=null,this._deviceResizeHandler=null,this.cursorState={isHovering:!1,isDragging:!1},this.stats=new m.Uz({id:"deck.gl"}),this.metrics={fps:0,setPropsTime:0,layersCount:0,drawLayersCount:0,updateLayersCount:0,updateAttributesCount:0,updateAttributesTime:0,framesRedrawn:0,pickTime:0,pickCount:0,pickLayersCount:0,gpuTime:0,gpuTimePerFrame:0,cpuTime:0,cpuTimePerFrame:0,bufferMemory:0,textureMemory:0,renderbufferMemory:0,gpuMemory:0},this._metricsCounter=0,this._hoverPickSequence=0,this._pointerDownPickSequence=0,this._needsRedraw="Initial render",this._pickRequest={mode:"hover",x:-1,y:-1,radius:0,event:null,unproject3D:!1},this._lastPointerDownInfo=null,this._lastPointerDownInfoPromise=null,this._onPointerMove=e=>{let{_pickRequest:t}=this;if("pointerleave"===e.type)t.x=-1,t.y=-1,t.radius=0;else{if(e.leftButton||e.rightButton)return;let i=e.offsetCenter;if(!i)return;t.x=i.x,t.y=i.y,t.radius=this.props.pickingRadius}this.layerManager&&(this.layerManager.context.mousePosition={x:t.x,y:t.y}),t.event=e},this._onEvent=e=>{let t=ey.tg[e.type],i=e.offsetCenter;if(!t||!i||!this.layerManager)return;let r=this.layerManager.getLayers(),s=this._getInternalPickingMode();if(s){if("sync"===s){let t="click"===e.type&&this._shouldUnproject3D(r)?this._getFirstPickedInfo(this._pickPointSync(this._getPointPickOptions(i.x,i.y,{unproject3D:!0},r))):this._getLastPointerDownPickingInfo(i.x,i.y,r);this._dispatchPickingEvent(t,e);return}(this._lastPointerDownInfoPromise||Promise.resolve(this._getLastPointerDownPickingInfo(i.x,i.y,r))).then(t=>{this._dispatchPickingEvent(t,e)}).catch(e=>this.props.onError?.(e))}},this._onPointerDown=e=>{let t=e.offsetCenter;if(!t)return;let i=this._getInternalPickingMode();if(!i)return;let r=this.layerManager?.getLayers()||[],s=++this._pointerDownPickSequence;if("sync"===i){let e=this._pickPointSync({x:t.x,y:t.y,radius:this.props.pickingRadius}),i=this._getFirstPickedInfo(e);this._lastPointerDownInfo=i,this._lastPointerDownInfoPromise=Promise.resolve(i);return}let n=this._pickPointAsync(this._getPointPickOptions(t.x,t.y,{},r)).then(e=>this._getFirstPickedInfo(e)).then(e=>(s===this._pointerDownPickSequence&&(this._lastPointerDownInfo=e),e)).catch(e=>{this.props.onError?.(e);let i=this.deckPicker&&this.viewManager?this._getLastPointerDownPickingInfo(t.x,t.y,r):{};return s===this._pointerDownPickSequence&&(this._lastPointerDownInfo=i),i});this._lastPointerDownInfo=null,this._lastPointerDownInfoPromise=n};let t=e;this.props={...tG,...e},(e=this.props).viewState&&e.initialViewState&&f.A.warn("View state tracking is disabled. Use either `initialViewState` for auto update or `viewState` for manual update.")(),this.viewState=this.props.initialViewState,e.device&&(this.device=e.device,this._setDeviceCanvasContext(e.device));let i=this.device;!i&&e.gl&&(e.gl instanceof WebGLRenderingContext&&f.A.error("WebGL1 context not supported.")(),i=tO.attach(e.gl,{_cacheShaders:!0,_cachePipelines:!0,...this.props.deviceProps})),i||(i=this._createDevice(e)),this.animationLoop=this._createAnimationLoop(i,e),this.setProps(t),e._typedArrayManagerProps&&e8.A.setOptions(e._typedArrayManagerProps),this.animationLoop.start()}finalize(){this._restoreDeviceResizeHandler(),this.animationLoop?.stop(),this.animationLoop?.destroy(),this.animationLoop=null,this._hoverPickSequence++,this._pointerDownPickSequence++,this._lastPointerDownInfo=null,this._lastPointerDownInfoPromise=null,this.layerManager?.finalize(),this.layerManager=null,this.viewManager?.finalize(),this.viewManager=null,this.effectManager?.finalize(),this.effectManager=null,this.deckRenderer?.finalize(),this.deckRenderer=null,this.deckPicker?.finalize(),this.deckPicker=null,this.eventManager?.destroy(),this.eventManager=null,this.widgetManager?.finalize(),this.widgetManager=null,this.props.canvas||this.props.device||this.props.gl||!this.canvas||(this.canvas.parentElement?.removeChild(this.canvas),this.canvas=null),this._canvasContext=null}setProps(e){this.stats.get("setProps Time").timeStart(),"onLayerHover"in e&&f.A.removed("onLayerHover","onHover")(),"onLayerClick"in e&&f.A.removed("onLayerClick","onClick")(),e.initialViewState&&!(0,x.b)(this.props.initialViewState,e.initialViewState,3)&&(this.viewState=e.initialViewState),Object.assign(this.props,e),this._val
1411idateInternalPickingMode(),this._setCanvasSize(this.props);let t=Object.create(this.props);if(Object.assign(t,{views:this._getViews(),width:this.width,height:this.height,viewState:this._getViewState()}),e.device&&e.device.id!==this.device?.id){let t=e.device.getDefaultCanvasContext();this.animationLoop?.stop(),this.canvas!==t.canvas&&(this.canvas?.remove(),this.eventManager?.destroy(),this.canvas=null),this._setDeviceCanvasContext(e.device),f.A.log(`recreating animation loop for new device! id=${e.device.id}`)(),this.animationLoop=this._createAnimationLoop(e.device,e),this.animationLoop.start()}this.animationLoop?.setProps(t),void 0!==e.useDevicePixels&&this._canvasContext?.setProps&&this._canvasContext.setProps({useDevicePixels:e.useDevicePixels}),this.layerManager&&(this.viewManager.setProps(t),this.layerManager.activateViewport(this.getViewports()[0]),this.layerManager.setProps(t),this.effectManager.setProps(t),this.deckRenderer.setProps(t),this.deckPicker.setProps(t),this.widgetManager.setProps(t)),this.stats.get("setProps Time").timeEnd()}needsRedraw(e={clearRedrawFlags:!1}){if(!this.layerManager)return!1;if(this.props._animate)return"Deck._animate";let t=this._needsRedraw;e.clearRedrawFlags&&(this._needsRedraw=!1);let i=this.viewManager.needsRedraw(e),r=this.layerManager.needsRedraw(e),s=this.effectManager.needsRedraw(e),n=this.deckRenderer.needsRedraw(e);return t||i||r||s||n}redraw(e){if(!this.layerManager)return;let t=this.needsRedraw({clearRedrawFlags:!0});(t=e||t)&&(this.stats.get("Redraw Count").incrementCount(),this.props._customRender?this.props._customRender(t):this._drawLayers(t))}get isInitialized(){return null!==this.viewManager}getViews(){return(0,k.A)(this.viewManager),this.viewManager.views}getView(e){return(0,k.A)(this.viewManager),this.viewManager.getView(e)}getViewports(e){return(0,k.A)(this.viewManager),this.viewManager.getViewports(e)}getCanvas(){return this.canvas}async pickObjectAsync(e){let t=(await this._pickAsync("pickObjectAsync","pickObject Time",e)).result;return t.length?t[0]:null}async pickObjectsAsync(e){return await this._pickAsync("pickObjectsAsync","pickObjects Time",e)}pickObject(e){let t=this._pick("pickObject","pickObject Time",e).result;return t.length?t[0]:null}pickMultipleObjects(e){return e.depth=e.depth||10,this._pick("pickObject","pickMultipleObjects Time",e).result}pickObjects(e){return this._pick("pickObjects","pickObjects Time",e)}_pickPositionForController(e,t){return"sync"!==this._getInternalPickingMode()?null:this.pickObject({x:e,y:t,radius:0,unproject3D:!0})}_addResources(e,t=!1){for(let i in e)this.layerManager.resourceManager.add({resourceId:i,data:e[i],force
1411Update:t})}_removeResources(e){for(let t of e)this.layerManager.resourceManager.remove(t)}_addDefaultEffect(e){this.effectManager.addDefaultEffect(e)}_addDefaultShaderModule(e){this.layerManager.addDefaultShaderModule(e)}_removeDefaultShaderModule(e){this.layerManager?.removeDefaultShaderModule(e)}_resolveInternalPickingMode(){let{pickAsync:e}=this.props,t=this.device?.type||this.props.deviceProps?.type;if("auto"===e)return"webgpu"===t?"async":"sync";if("sync"===e&&"webgpu"===t)throw Error('`pickAsync: "sync"` is not supported when Deck is using a WebGPU device.');return e}_getInternalPickingMode(){try{return this._resolveInternalPickingMode()}catch(e){return this.props.onError?.(e),null}}_validateInternalPickingMode(){this._getInternalPickingMode()}_getFirstPickedInfo({result:e,emptyInfo:t}){return e[0]||t}_shouldUnproject3D(e=this.layerManager?.getLayers()||[]){return e.some(e=>"3d"===e.props.pickable)}_getPointPickOptions(e,t,i={},r=this.layerManager?.getLayers()||[]){return{x:e,y:t,radius:this.props.pickingRadius,unproject3D:this._shouldUnproject3D(r),...i}}_pickPointSync(e){return this._pick("pickObject","pickObject Time",e)}_pickPointAsync(e){return this._pickAsync("pickObjectAsync","pickObject Time",e)}_getLastPointerDownPickingInfo(e,t,i=this.layerManager?.getLayers()||[]){return this.deckPicker.getLastPickedObject({x:e,y:t,layers:i,viewports:this.getViewports({x:e,y:t})},this._lastPointerDownInfo)}_applyHoverCallbacks({result:e,emptyInfo:t},i){if(!this.widgetManager)return;this.cursorState.isHovering=e.length>0;let r=t,s=!1;for(let t of e)r=t,s=t.layer?.onHover(t,i)||s;s||(this.props.onHover?.(r,i),this.widgetManager.onHover(r,i))}_dispatchPickingEvent(e,t){if(!this.layerManager||!this.widgetManager)return;let i=ey.tg[t.type];if(!i)return;let{layer:r}=e,s=r&&(r[i]||r.props[i]),n=this.props[i],o=!1;s&&(o=s.call(r,e,t)),o||(n?.(e,t),this.widgetManager.onEvent(e,t))}_pickAsync(e,t,i){(0,k.A)(this.deckPicker);let{stats:r}=this;r.get("Pick Count").incrementCount(),r.get(t).timeStart();let s=this.deckPicker[e]({layers:this.layerManager.getLayers(i),views:this.viewManager.getViews(),viewports:this.getViewports(i),onViewportActive:this.layerManager.activateViewport,effects:this.effectManager.getEffects(),...i,canvasContext:this._canvasContext||void 0});return r.get(t).timeEnd(),s}_pick(e,t,i){(0,k.A)(this.deckPicker);let{stats:r}=this;r.get("Pick Count").incrementCount(),r.get(t).timeStart();let s=this.deckPicker[e]({layers:this.layerManager.getLayers(i),views:this.viewManager.getViews(),viewports:this.getViewports(i),onViewportActive:this.layerManager.activateViewport,effects:this.effectManager.getEffects(),...i,canvasContext:this._canvasContext||void 0});return r.get(t).timeEnd(),s}_createCanvas(e){let t=e.canvas;return"string"==typeof t&&(t=document.getElementById(t),(0,k.A)(t)),t||((t=document.createElement("canvas")).id=e.id||"deckgl-overlay",e.width&&"number"==typeof e.width&&(t.width=e.width),e.height&&"number"==typeof e.height&&(t.height=e.height),(e.parent||document.body).appendChild(t)),Object.assign(t.style,e.style),t}_setCanvasContext(e){this._canvasContext=e,"style"in e.canvas&&(this.canvas=e.canvas)}_setDeviceCanvasContext(e,t={}){let i=e.getDefaultCanvasContext();this._setCanvasContext(i),this._setDeviceResizeHandler(e,t)}_setDeviceResizeHandler(e,t={}){let i=!!t.syncDrawingBuffer;if(this._deviceResizeHandler?.device===e){this._deviceResizeHandler.syncDrawingBuffer=i;return}this._restoreDeviceResizeHandler();let r=e=>{e===this._canvasContext&&this._canvasContext&&this._onCanvasContextResize(this._canvasContext,{syncDrawingBuffer:this._deviceResizeHandler?.syncDrawingBuffer})};e.props.onResize=r,this._deviceResizeHandler={device:e,onResize:r,syncDrawingBuffer:i}}_restoreDeviceResizeHandler(){let e=this._deviceResizeHandler;e&&e.device.props?.onResize===e.onResize&&(e.device.props.onResize=tB),this._deviceResizeHandler=null}_setCanvasSize(e){if(!this.canvas)return;let{width:t,height:i}=e;if(t||0===t){let e=Number.isFinite(t)?`${t}px`:t;this.canvas.style.width=e}if(i||0===i){let t=Number.isFinite(i)?`${i}px`:i;this.canvas.style.position=e.style?.position||"absolute",this.canvas.style.height=t}}_updateCanvasSize(e=this._canvasContext){let{canvas:t}=this,[i,r]=e?e.getCSSSize():[t?.clientWidth??t?.width??0,t?.clientHeight??t?.height??0];(i!==this.width||r!==this.height)&&(this.width=i,this.height=r,this.viewManager?.setProps({width:i,height:r}),this.layerManager?.activateViewport(this.getViewports()[0]),this.props.onResize({width:i,height:r},e||void 0))}_onCanvasContextResize(e,t={}){if(t.syncDrawingBuffer){let{width:t,height:i}=e.canvas;e.setDrawingBufferSize(t,i)}this._needsRedraw="Canvas resized",this._updateCanvasSize(e)}_createAnimationLoop(e,t){let{gl:i,onError:r}=t;return new tF({device:e,autoResizeDrawingBuffer:!i,autoResizeViewport:!1,onInitialize:e=>this._setDevice(e.device),onRender:this._onRenderFrame.bind(this),onError:r})}_createDevice(e){let t=this.props.deviceProps?.createCanvasContext,i={adapters:[],_cacheShaders:!0,_cachePipelines:!0,...e.deviceProps};i.adapters.includes(tO)||i.adapters.push(tO);let r={alphaMode:this.props.deviceProps?.type==="webgpu"?"premultiplied":void 0};
1411return tS.createDevice({_reuseDevices:!0,type:"webgl",...i,createCanvasContext:{...r,..."object"==typeof t?t:void 0,canvas:this._createCanvas(e),useDevicePixels:this.props.useDevicePixels,autoResize:!0}})}_getViewState(){return this.props.viewState||this.viewState}_getViews(){let{views:e}=this.props,t=Array.isArray(e)?e:e?[e]:[new er({id:"default-view"})];return t.length&&this.props.controller&&(t[0].props.controller=this.props.controller),t}_onContextLost(){let{onError:e}=this.props;this.animationLoop&&e&&e(Error("WebGL context is lost"))}_pickAndCallback(){let{_pickRequest:e}=this;if(e.event){let t=e.event,i=this.layerManager?.getLayers()||[],r=this._getPointPickOptions(e.x,e.y,{radius:e.radius,mode:e.mode},i),s=this._getInternalPickingMode(),n=++this._hoverPickSequence;if(e.event=null,!s)return;if("sync"===s)return void this._applyHoverCallbacks(this._pickPointSync(r),t);this._pickPointAsync(r).then(({result:e,emptyInfo:i})=>{n===this._hoverPickSequence&&this._applyHoverCallbacks({result:e,emptyInfo:i},t)}).catch(e=>this.props.onError?.(e))}}_updateCursor(){let e=this.props.parent||this.canvas;e&&(e.style.cursor=this.props.getCursor(this.cursorState))}_setDevice(e){if(this.device=e,this._validateInternalPickingMode(),!this.animationLoop)return;this._setDeviceCanvasContext(e,{syncDrawingBuffer:!!(this.props.gl&&this.props.device!==e)}),this.canvas&&!this.canvas.isConnected&&this.props.parent&&this.props.parent.insertBefore(this.canvas,this.props.parent.firstChild),"webgl"===this.device.type&&this.device.setParametersWebGL({blend:!0,blendFunc:[770,771,1,771],polygonOffsetFill:!0,depthTest:!0,depthFunc:515}),this.props.onDeviceInitialized(this.device),"webgl"===this.device.type&&this.props.onWebGLInitialized(this.device.gl);let t=new n;t.play(),this.animationLoop.attachTimeline(t);let i=this.props.parent?.querySelector(".deck-events-root")||this.canvas;for(let e in this.eventManager=new tD.EU(i,{touchAction:this.props.touchAction,recognizers:Object.keys(ey.We).map(e=>{let[t,i,r,s]=ey.We[e],n=this.props.eventRecognizerOptions?.[e];return{recognizer:new t({...i,...n,event:e}),recognizeWith:r,requireFailure:s}}),events:{pointerdown:this._onPointerDown,pointermove:this._onPointerMove,pointerleave:this._onPointerMove}}),ey.tg)this.eventManager.on(e,this._onEvent);this.viewManager=new w({timeline:t,eventManager:this.eventManager,onViewStateChange:this._onViewStateChange.bind(this),onInteractionStateChange:this._onInteractionStateChange.bind(this),pickPosition:this._pickPositionForController.bind(this),views:this._getViews(),viewState:this._getViewState(),width:this.width,height:this.height});let r=this.viewManager.getViewports()[0];this.layerManager=new E(this.device,{deck:this,stats:this.stats,viewport:r,timeline:t}),this.effectManager=new eB({deck:this,device:this.device}),this.deckRenderer=new eV(this.device,{stats:this.stats}),this.deckPicker=new eQ(this.device,{stats:this.stats});let s=this.props.parent?.querySelector(".deck-widgets-root")||this.canvas?.parentElement;this.widgetManager=new e1({deck:this,parentElement:s}),this.widgetManager.addDefault(new e6),this.setProps({}),this._updateCanvasSize(this._canvasContext),this.props.onLoad()}_drawLayers(e,t){let{device:i,gl:r}=this.layerManager.context;this.props.onBeforeRender({device:i,gl:r});let s={target:this.props._framebuffer,layers:this.layerManager.getLayers(),viewports:this.viewManager.getViewports(),onViewportActive:this.layerManager.activateViewport,views:this.viewManager.getViews(),pass:"screen",effects:this.effectManager.getEffects(),...t};this.deckRenderer?.renderLayers(s),"screen"===s.pass&&this.widgetManager.onRedraw({viewports:s.viewports,layers:s.layers}),this.props.onAfterRender({device:i,gl:r})}_onRenderFrame(){this._getFrameStats(),this._metricsCounter++%60==0&&(this._getMetrics(),this.stats.reset(),f.A.table(4,this.metrics)(),this.props._onMetrics&&this.props._onMetrics(this.metrics)),this._updateCursor(),this.layerManager.updateLayers(),this._pickAndCallback(),this.redraw(),this.viewManager&&this.viewManager.updateViewStates()}_onViewStateChange(e){let t=this.props.onViewStateChange(e)||e.viewState;this.viewState&&(this.viewState={...this.viewState,[e.viewId]:t},!this.props.viewState&&this.viewManager&&this.viewManager.setProps({viewState:this.viewState}))}_onInteractionStateChange(e){this.cursorState.isDragging=e.isDragging||!1,this.props.onInteractionStateChange(e)}_getFrameStats(){let{stats:e}=this;e.get("frameRate").timeEnd(),e.get("frameRate").timeStart();let t=this.animationLoop.stats;e.get("GPU Time").addTime(t.get("GPU Time").lastTiming),e.get("CPU Time").addTime(t.get("CPU Time").lastTiming)}_getMetrics(){let{metrics:e,stats:t}=this;e.fps=t.get("frameRate").getHz(),e.setPropsTime=t.get("setProps Time").time,e.updateAttributesTime=t.get("Update Attributes").time,e.framesRedrawn=t.get("Redraw Count").count,e.pickTime=t.get("pickObject Time").time+t.get("pickMultipleObjects Time").time+t.get("pickObjects Time").time,e.pickCount=t.get("Pick Count").count,e.layersCount=this.layerManager?.layers.length??0,e.drawLayersCount=t.get("Layers rendered").lastSampleCount,e.pickLayersCount=t.get("Layers picked").lastSampleCount,e.updateAttributesCount=t.get("Layers updated").count,e.updateAttributesCount=t.get("Attributes updated").count,e.gpuTime=t.get("GPU Time").time,e.cpuTime=t.get("CPU Time").time,e.gpuTimePerFrame=t.get("GPU Time").getAverageTime(),e.cpuTimePerFrame=t.get("CPU Time").getAverageTime();let i=tS.stats.get("GPU Time and Memory");e.bufferMemory=i.get("Buffer Memory").count,e.textureMemory=i.get("Texture Memory").count,e.renderbufferMemory=i.get("Renderbuffer Memory").count,e.gpuMemory=i.get("GPU Memory").count}}tk.defaultProps=tG,tk.VERSION=ty;let tU=Math.PI/180,tz=180/Math.PI;function tj(e,t=0){let i=Math.min(180,e)*tU;return 2*z.rf*Math.sin(i/2)*Math.pow(2,t)}function tV(e,t=0){return 2*Math.asin(Math.min(1,e/Math.pow(2,t)/z.rf/2))*tz}class tW extends et{constructor(e){let{startPanPos:t,...i}=e;i.normalize=!1,super(i),void 0!==t&&(this._state.startPanPos=t)}panStart({pos:e}){let{latitude:t,longitude:i,zoom:r}=this.getViewportProps();
1411return this._getUpdatedState({startPanLngLat:[i,t],startPanPos:e,startZoom:r})}pan({pos:e,startPos:t}){let i=this.getState(),r=i.startPanLngLat||this._unproject(t);if(!r)return this;let s=i.startZoom??this.getViewportProps().zoom,n=i.startPanPos||t,o=[r[0],r[1],s],a=this.makeViewport(this.getViewportProps()).panByPosition(o,e,n);return this._getUpdatedState(a)}panEnd(){return this._getUpdatedState({startPanLngLat:null,startPanPos:null,startZoom:null})}zoom({scale:e}){let t=(this.getState().startZoom||this.getViewportProps().zoom)+Math.log2(e);return this._getUpdatedState({zoom:t})}applyConstraints(e){let{longitude:t,latitude:i,maxBounds:r}=e;if(e.zoom=this._constrainZoom(e.zoom,e),(t<-180||t>180)&&(e.longitude=(0,Q.zi)(t+180,360)-180),e.latitude=(0,I.qE)(i,-Z.aH,Z.aH),r&&(e.longitude=(0,I.qE)(e.longitude,r[0][0],r[1][0]),e.latitude=(0,I.qE)(e.latitude,r[0][1],r[1][1])),r){let t=e.zoom-(0,z.bl)(i),s=r[1][0]-r[0][0],n=r[1][1]-r[0][1];if(n>0&&n<2*Z.aH){let i=Math.min(tV(e.height,t),n)/2;e.latitude=(0,I.qE)(e.latitude,r[0][1]+i,r[1][1]-i)}if(s>0&&s<360){let i=Math.min(tV(e.width/Math.cos(e.latitude*tU),t),s)/2;e.longitude=(0,I.qE)(e.longitude,r[0][0]+i,r[1][0]-i)}}return e.latitude!==i&&(e.zoom+=(0,z.bl)(e.latitude)-(0,z.bl)(i)),e}_constrainZoom(e,t){t||(t=this.getViewportProps());let{latitude:i,maxZoom:r,maxBounds:s}=t,{minZoom:n}=t,o=(0,z.bl)(0),a=(0,z.bl)(i)-o;if(null!==s&&t.width>0&&t.height>0){let e=s[0][1],i=s[1][1],a=Math.sign(e)===Math.sign(i)?Math.min(Math.abs(e),Math.abs(i)):0,l=tj(s[1][0]-s[0][0])*Math.cos(a*tU),h=tj(s[1][1]-s[0][1]);l>0&&(n=Math.max(n,Math.log2(t.width/l)+o)),h>0&&(n=Math.max(n,Math.log2(t.height/h)+o)),n>r&&(n=r)}return(0,I.qE)(e,n+a,r+a)}}class t$ extends X{constructor(){super(...arguments),this.ControllerState=tW,this.transition={transitionDuration:300,transitionInterpolator:new W(["longitude","latitude","zoom"])},this.dragMode="pan"}setProps(e){super.setProps(e),this.dragRotate=!1,this.touchRotate=!1}}let tH={cullMode:"back"};class tq extends R{constructor(e={}){super({...e,parameters:{...tH,...e.parameters}})}getViewportType(e){return e.zoom>12?L.A:z.Ay}get ControllerType(){return t$}}tq.displayName="GlobeView";class tK{constructor(e){(0,k.A)(e.id,"id is required"),this.id=e.id,this.type="custom",this.renderingMode=e.renderingMode||"3d",this.slot=e.slot,this.beforeId=e.beforeId,this.map=null}onAdd(e,t){this.map=e}render(e,t){this.map&&function(e,t,i,r){if(!e.isInitialized)return;let{currentViewport:s}=e.userData,n=!1;s||(s=t4(e,t,r),e.userData.currentViewport=s,n=!0),s&&e._drawLayers("mapbox-repaint",{viewports:[s],layerFilter:t=>{if(e.props.layerFilter&&!e.props.layerFilter(t))return!1;let r=t.layer;return r.props.beforeId===i.beforeId&&r.props.slot===i.slot},clearStack:n,clearCanvas:!1})}(this.map.__deck,this.map,this,t)}}let tX="__UNDEFINED__";function tY(e){return e.props.beforeId?`deck-layer-group-before:${e.props.beforeId}`:e.props.slot?`deck-layer-group-slot:${e.props.slot}`:"deck-layer-group-last"}let tZ="mapbox",tQ=Math.PI/180;function tJ(e,t){let i=()=>{var r,s;e.isInitialized?(r=e,s=t,r.setProps({viewState:t2(s)}),r.needsRedraw({clearRedrawFlags:!0})):t.off("move",i)};t.on("move",i)}function t0(e,t){return t?{depthWriteEnabled:!0,depthCompare:"less-equal",depthBias:0,blend:!0,blendColorSrcFactor:"src-alpha",blendColorDstFactor:"one-minus-src-alpha",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one-minus-src-alpha",blendColorOperation:"add",blendAlphaOperation:"add"}:{}}function t1(e){let t=e.getProjection?.(),i=t?.type||t?.name;if("globe"===i)return"globe";if(i&&"mercator"!==i)throw Error("Unsupported projection");return"mercator"}function t3(e){return"globe"===t1(e)?new tq({id:tZ}):new er({id:tZ})}function t2(e){let{lng:t,lat:i}=e.getCenter(),r={longitude:(t+540)%360-180,latitude:i,zoom:e.getZoom(),bearing:e.getBearing(),pitch:e.getPitch(),padding:e.getPadding(),repeat:e.getRenderWorldCopies()};return e.getTerrain?.()&&function(e,t){if(e.getFreeCameraOptions){let{position:i}=e.getFreeCameraOptions();if(!i||void 0===i.z)return;let r=e.transform.height,{longitude:s,latitude:n,pitch:o}=t,a=512*i.x,l=(1-i.y)*512,h=512*i.z,u=(0,Z.Gw)([s,n]),c=a-u[0],d=l-u[1],f=Math.sqrt(c*c+d*d),p=o*tQ,g=1.5*r,m=p<.001?g*Math.cos(p)/h:g*Math.sin(p)/f;t.zoom=Math.log2(m),t.position=[0,0,(h-g*Math.cos(p)/m)/(0,Z.mY)(n)]}else"number"==typeof e.transform.elevation&&(t.position=[0,0,e.transform.elevation])}(e,r),r}function t4(e,t,i){let r=t2(t),s=e.getView(tZ)||t3(t);i&&(s.props.nearZMultiplier=.2);let n=i?.nearZ??t.transform._nearZ,o=i?.farZ??t.transform._farZ;return Number.isFinite(n)&&(r.nearZ=n/t.transform.height,r.farZ=o/t.transform.height),s.makeViewport({width:e.width,height:e.height,viewState:r})}class t6{constructor(e){this._handleStyleChange=()=>{this._resolveLayers(this._map,this._deck,this._props.layers,this._props.layers),this._map&&t1(this._map)&&this._deck?.setProps({views:this._getViews(this._map)})},this._updateContainerSize=()=>{if(this._map&&this._container){let{clientWidth:e,clientHeight:t}=this._map.getContainer();Object.assign(this._container.style,{width:`${e}px`,height:`${t}px`})}},this._updateViewState=()=>{let e=this._deck,t=this._map;e&&t&&(e.setProps({views:this._getViews(t),viewState:t2(t)}),e.isInitialized&&e.redraw())},this._handleMouseEvent=e=>{let t=this._deck;if(!t||!t.isInitialized)return;let i={type:e.type,offsetCenter:e.point,srcEvent:e},r=this._lastMouseDownPoint;switch(!e.point&&r&&(i.deltaX=e.originalEvent.clientX-r.clientX,i.deltaY=e.originalEvent.clientY-r.clientY,i.offsetCenter={x:r.x+i.deltaX,y:r.y+i.deltaY}),i.type){case"mousedown":t._onPointerDown(i),this._lastMouseDownPoint={...e.point,clientX:e.originalEvent.clientX,clientY:e.originalEvent.clientY};break;case"dragstart":i.type="panstart",t._onEvent(i);break;case"drag":i.type="panmove",t._onEvent(i);break;case"dragend":i.type="panend",t._onEvent(i);break;case"click":i.tapCount=1,t._onEvent(i);break;case"dblclick":i.type="click",i.tapCount=2,t._onEvent(i);break;case"mousemove":i.type="pointermove",t._onPointerMove(i);break;case"mouseout":i.type="pointerleave",t._onPointerMove(i);break;default:return}};let{interleaved:t=!1}=e;this._interleaved=t,this._props=this.filterProps(e)}filterProps(e){let{interleaved:t=!1,useDevicePixels:i,...r}=e;return t||void 0===i||(r.useDevicePixels=i),r}setProps(e){this._interleaved&&e.layers&&this._resolveLayers(this._map,this._deck,this._props.layers,e.layers),Object.assign(this._props,this.filterProps(e)),this._deck&&this._map&&this._deck.setProps({...this._props,views:this._getViews(this._map),parameters:{...t0(this._map,this._interleaved),...this._props.parameters}})}onAdd(e){return this._map=e,this._interleaved?this._onAddInterleaved(e):this._onAddOverlaid(e)}_onAddOverlaid(e){let t=document.createElement("div");return Object.assign(t.style,{position:"absolute",left:0,top:0,textAlign:"initial",pointerEvents:"none"}),this._container=t,this._deck=new tk({...this._props,parent:t,parameters:{...t0(e,!1),...this._props.parameters},views:this._getViews(e),viewState:t2(e)}),e.on("resize",this._updateContainerSize),e.on("render",this._updateViewState),e.on("mousedown",this._handleMouseEvent),e.on("dragstart",this._handleMouseEvent),e.on("drag",this._handleMouseEvent),e.on("dragend",this._handleMouseEvent),e.on("mousemove",this._handleMouseEvent),e.on("mouseout",this._handleMouseEvent),e.on("click",this._handleMouseEvent),e.on("dblclick",this._handleMouseEvent),this._updateContainerSize(),t}_onAddInterleaved(e){let t=e.painter.context.gl;return t instanceof WebGLRenderingContext&&f.A.warn("Incompatible basemap library. See: https://deck.gl/docs/api-reference/mapbox/overview#compatibility")(),this._deck=function({map:e,deck:t}){if(e.__deck)return e.__deck;let i=t.props._customRender,r=t.props.onLoad,s={...t.props,_customRender:()=>{e.triggerRepaint(),i?.("")}};return s.views||(s.views=t3(e)),Object.assign(s,{width:null,height:null,touchAction:"unset",viewState:t2(e)}),t.isInitialized?tJ(t,e):s.onLoad=()=>
1411{r?.(),tJ(t,e)},t.setProps(s),e.__deck=t,e.on("render",()=>{t.isInitialized&&function(e,t){let i=(0,g.B)(e.props.layers,Boolean).some(e=>e&&!t.getLayer(tY(e))),r=e.getViewports(),s=r.findIndex(e=>e.id===tZ),n=r.length>1||s<0;if(i||n){if(s>=0){r=r.slice();let i=t4(e,t);i?r[s]=i:r.splice(s,1)}e._drawLayers("mapbox-repaint",{viewports:r,layerFilter:i=>(!e.props.layerFilter||e.props.layerFilter(i))&&(i.viewport.id!==tZ||!t.getLayer(tY(i.layer))),clearCanvas:!1})}else{let t=e.device,i=t?.gl;e.props.onBeforeRender?.({device:t,gl:i}),e.props.onAfterRender?.({device:t,gl:i})}e.userData.currentViewport=null}(t,e)}),t}({map:e,deck:new tk({...this._props,views:this._getViews(e),gl:t,parameters:{...t0(e,!0),...this._props.parameters}})}),e.on("styledata",this._handleStyleChange),this._resolveLayers(e,this._deck,[],this._props.layers),document.createElement("div")}_resolveLayers(e,t,i,r){!function(e,t,i){if(!e||!e.style||!e.style._loaded)return;let r=(0,g.B)(i,Boolean);if(t!==i){let i=new Set((0,g.B)(t,Boolean).map(e=>tY(e))),s=new Set(r.map(e=>tY(e)));for(let t of i)!s.has(t)&&e.getLayer(t)&&e.removeLayer(t)}let s={};for(let t of r){let i=tY(t),r=e.getLayer(i);if(r){let e=r.implementation||r;s[i]=e}else{let r=new tK({id:i,slot:t.props.slot,beforeId:t.props.beforeId});s[i]=r,e.addLayer(r,t.props.beforeId)}}let n=e.style._order;for(let[t,i]of Object.entries(s)){let r=i.beforeId||tX,s=r===tX?n.length:n.indexOf(r);if(n.indexOf(t)!==s-1){let i=r===tX?void 0:r;e.moveLayer(t,i)}}}(e,i,r)}onRemove(){let e=this._map;e&&(this._interleaved?this._onRemoveInterleaved(e):this._onRemoveOverlaid(e)),this._deck=void 0,this._map=void 0,this._container=void 0}_onRemoveOverlaid(e){e.off("resize",this._updateContainerSize),e.off("render",this._updateViewState),e.off("mousedown",this._handleMouseEvent),e.off("dragstart",this._handleMouseEvent),e.off("drag",this._handleMouseEvent),e.off("dragend",this._handleMouseEvent),e.off("mousemove",this._handleMouseEvent),e.off("mouseout",this._handleMouseEvent),e.off("click",this._handleMouseEvent),e.off("dblclick",this._handleMouseEvent),this._deck?.finalize()}_onRemoveInterleaved(e){e.off("styledata",this._handleStyleChange),this._resolveLayers(e,this._deck,this._props.layers,[]),e.__deck?.finalize(),e.__deck=null}getDefaultPosition(){return"top-left"}pickObject(e){return(0,k.A)(this._deck),this._deck.pickObject(e)}pickMultipleObjects(e){return(0,k.A)(this._deck),this._deck.pickMultipleObjects(e)}pickObjects(e){return(0,k.A)(this._deck),this._deck.pickObjects(e)}finalize(){this._map&&this._map.removeControl(this)}getCanvas(){return this._map?this._interleaved?this._map.getCanvas():this._deck.getCanvas():null}_getViews(e){if(!this._props.views)return t3(e);let t=Array.isArray(this._props.views)?this._props.views:[this._props.views];return t.some(e=>e.id===tZ)?this._props.views:[t3(e),...t]}}},90564:(e,t,i)=>{"use strict";i.d(t,{O_:()=>a,bv:()=>h,Uu:()=>l});let r={vertex:`\ 1412#ifdef MODULE_LOGDEPTH 1413 logdepth_adjustPosition(gl_Position); 1414#endif 1415`,fragment:`\ 1416#ifdef MODULE_MATERIAL 1417 fragColor = material_filterColor(fragColor); 1418#endif 1419 1420#ifdef MODULE_LIGHTING 1421 fragColor = lighting_filterColor(fragColor); 1422#endif 1423 1424#ifdef MODULE_FOG 1425 fragColor = fog_filterColor(fragColor); 1426#endif 1427 1428#ifdef MODULE_PICKING 1429 fragColor = picking_filterHighlightColor(fragColor); 1430 fragColor = picking_filterPickingColor(fragColor); 1431#endif 1432 1433#ifdef MODULE_LOGDEPTH 1434 logdepth_setFragDepth(); 1435#endif 1436`},s=/void\s+main\s*\([^)]*\)\s*\{\n?/,n=/}\n?[^{}]*$/,o=[],a="__LUMA_INJECT_DECLARATIONS__";function l(e){let t={vertex:{},fragment:{}};for(let i in e){let r=e[i];"string"==typeof r&&(r={order:0,injection:r}),t[function(e){let t=e.slice(0,2);switch(t){case"vs":return"vertex";case"fs":return"fragment";default:throw Error(t)}}(i)][i]=r}return t}function h(e,t,i,l=!1){let u="vertex"===t;for(let t in i){let r=i[t];r.sort((e,t)=>e.order-t.order),o.length=r.length;for(let e=0,t=r.length;e<t;++e)o[e]=r[e].injection;let l=`${o.join("\n")} 1437`;switch(t){case"vs:#decl":u&&(e=e.replace(a,l));break;case"vs:#main-start":u&&(e=e.replace(s,e=>e+l));break;case"vs:#main-end":u&&(e=e.replace(n,e=>l+e));break;case"fs:#decl":u||(e=e.replace(a,l));break;case"fs:#main-start":u||(e=e.replace(s,e=>e+l));break;case"fs:#main-end":u||(e=e.replace(n,e=>l+e));break;default:e=e.replace(t,e=>e+l)}}return e=e.replace(a,""),l&&(e=e.replace(/\}\s*$/,e=>e+r[t])),e}},92354:(e,t,i)=>{"use strict";i.d(t,{M:()=>a,P:()=>o});var r=i(79904),s=i(29288),n=i(77797);function o(e,t){let i={};for(let o of e.attributes){let a=function(e,t,i){let o=function(e,t){let i=e.attributes.find(e=>e.name===t);return i||r.R.warn(`shader layout attribute "${t}" not present in shader`),i||null}(e,i),a=function(e,t){var i=e;for(let e of i)(e.attributes&&e.format||!e.attributes&&!e.format)&&r.R.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`);let s=function(e,t){for(let i of e)if(i.format&&i.name===t)return{attributeName:i.name,bufferName:t,stepMode:i.stepMode,vertexFormat:i.format,byteOffset:0,byteStride:i.byteStride||0};return null}(e,t);return s||(s=function(e,t){for(let i of e){let e=i.byteStride;if("number"!=typeof i.byteStride)for(let t of i.attributes||[])e+=n.E.getVertexFormatInfo(t.format).byteLength;let r=i.attributes?.find(e=>e.attribute===t);if(r)return{attributeName:r.attribute,bufferName:i.name,stepMode:i.stepMode,vertexFormat:r.format,byteOffset:r.byteOffset,byteStride:e}}return null}(e,t))?s:(r.R.warn(`layout for attribute "${t}" not present in buffer layout`),null)}(t,i);if(!o)return null;let l=s.Co.getAttributeShaderTypeInfo(o.type),h=n.E.getCompatibleVertexFormat(l),u=a?.vertexFormat||h,c=n.E.getVertexFormatInfo(u);return{attributeName:a?.attributeName||o.name,bufferName:a?.bufferName||o.name,location:o.location,shaderType:o.type,primitiveType:l.primitiveType,shaderComponents:l.components,vertexFormat:u,bufferDataType:c.type,bufferComponents:c.components,normalized:c.normalized,integer:l.integer,stepMode:a?.stepMode||o.stepMode||"vertex",byteOffset:a?.byteOffset||0,byteStride:a?.byteStride||0}}(e,t,o.name);a&&(i[o.name]=a)}return i}function a(e,t,i=16){let r=o(e,t),s=Array(i).fill(null);for(let e of Object.values(r))s[e.location]=e;return s}},94501:(e,t,i)=>{"use strict";let r,s;i.d(t,{n:()=>oH});var n,o=i(79565),a=i(40712),l=i(7460),h=i(73254);class u extends o.A{get isComposite(){return!0}get isDrawable(){return!1}
1437get isLoaded(){return super.isLoaded&&this.getSubLayers().every(e=>e.isLoaded)}getSubLayers(){return this.internalState&&this.internalState.subLayers||[]}initializeState(e){}setState(e){super.setState(e),this.setNeedsUpdate()}getPickingInfo({info:e}){let{object:t}=e;return t&&t.__source&&t.__source.parent&&t.__source.parent.id===this.id&&(e.object=t.__source.object,e.index=t.__source.index),e}filterSubLayer(e){return!0}shouldRenderSubLayer(e,t){return t&&t.length}getSubLayerClass(e,t){let{_subLayerProps:i}=this.props;return i&&i[e]&&i[e].type||t}getSubLayerRow(e,t,i){return e.__source={parent:this,object:t,index:i},e}getSubLayerAccessor(e){if("function"==typeof e){let t={index:-1,data:this.props.data,target:[]};return(i,r)=>i&&i.__source?(t.index=i.__source.index,e(i.__source.object,t)):e(i,r)}return e}getSubLayerProps(e={}){let{opacity:t,pickable:i,visible:r,parameters:s,getPolygonOffset:n,highlightedObjectIndex:o,autoHighlight:a,highlightColor:l,coordinateSystem:u,coordinateOrigin:c,wrapLongitude:d,positionFormat:f,modelMatrix:p,extensions:g,fetch:m,operation:_,_subLayerProps:y}=this.props,v={id:"",updateTriggers:{},opacity:t,pickable:i,visible:r,parameters:s,getPolygonOffset:n,highlightedObjectIndex:o,autoHighlight:a,highlightColor:l,coordinateSystem:u,coordinateOrigin:c,wrapLongitude:d,positionFormat:f,modelMatrix:p,extensions:g,fetch:m,operation:_},b=y&&e.id&&y[e.id],E=b&&b.updateTriggers,x=e.id||"sublayer";if(b){let t=this.props[h.fW],i=e.type?e.type._propTypes:{};for(let e in b){let r=i[e]||t[e];r&&"accessor"===r.type&&(b[e]=this.getSubLayerAccessor(b[e]))}}for(let t of(Object.assign(v,e,b),v.id=`${this.props.id}-${x}`,v.updateTriggers={all:this.props.updateTriggers?.all,...e.updateTriggers,...E},g)){let e=t.getSubLayerProps.call(this,t);e&&Object.assign(v,e,{updateTriggers:Object.assign(v.updateTriggers,e.updateTriggers)})}return v}_updateAutoHighlight(e){for(let t of this.getSubLayers())t.updateAutoHighlight(e)}_getAttributeManager(){return null}_postUpdate(e,t){let i=this.internalState.subLayers,r=!i||this.needsUpdate();if(r){let e=this.renderLayers();i=(0,l.B)(e,Boolean),this.internalState.subLayers=i}for(let e of((0,a.A)("compositeLayer.renderLayers",this,r,i),i))e.parent=this}}u.layerName="CompositeLayer";let c=u;function d({data:e,getIndex:t,dataRange:i,replace:r}){let{startRow:s=0,endRow:n=1/0}=i,o=e.length,a=o,l=o;for(let i=0;i<o;i++){let r=t(e[i]);if(a>i&&r>=s&&(a=i),r>=n){l=i;break}}let h=a,u=l-a!==r.length?e.slice(l):void 0;for(let t=0;t<r.length;t++)e[h++]=r[t];if(u){for(let t=0;t<u.length;t++)e[h++]=u[t];e.length=h}return{startRow:a,endRow:a+r.length}}var f=i(36426);let p=`\ 1438// Define a structure to hold both the clip-space position and the common position. 1439struct ProjectResult { 1440 clipPosition: vec4<f32>, 1441 commonPosition: vec4<f32>, 1442}; 1443 1444// This function mimics the GLSL version with the 'out' parameter by returning both values. 1445fn project_position_to_clipspace_and_commonspace( 1446 position: vec3<f32>, 1447 position64Low: vec3<f32>, 1448 offset: vec3<f32> 1449) -> ProjectResult { 1450 // Compute the projected position. 1451 let projectedPosition: vec3<f32> = project_position_vec3_f64(position, position64Low); 1452 1453 // Start with the provided offset. 1454 var finalOffset: vec3<f32> = offset; 1455 1456 // Get whether a rotation is needed and the rotation matrix. 1457 let rotationResult = project_needs_rotation(projectedPosition); 1458 1459 // If rotation is needed, update the offset. 1460 if (rotationResult.needsRotation) { 1461 finalOffset = rotationResult.transform * offset; 1462 } 1463 1464 // Compute the common position. 1465 let commonPosition: vec4<f32> = vec4<f32>(projectedPosition + finalOffset, 1.0); 1466 1467 // Convert to clip-space. 1468 let clipPosition: vec4<f32> = project_common_position_to_clipspace(commonPosition); 1469 1470 return ProjectResult(clipPosition, commonPosition); 1471} 1472 1473// A convenience overload that returns only the clip-space position. 1474fn project_position_to_clipspace( 1475 position: vec3<f32>, 1476 position64Low: vec3<f32>, 1477 offset: vec3<f32> 1478) -> vec4<f32> { 1479 return project_position_to_clipspace_and_commonspace(position, position64Low, offset).clipPosition; 1480} 1481`,g=`\ 1482vec4 project_position_to_clipspace( 1483 vec3 position, vec3 position64Low, vec3 offset, out vec4 commonPosition 1484) { 1485 vec3 projectedPosition = project_position(position, position64Low); 1486 mat3 rotation; 1487 if (project_needs_rotation(projectedPosition, rotation)) { 1488 // offset is specified as ENU 1489 // when in globe projection, rotate offset so that the ground alighs with the surface of the globe 1490 offset = rotation * offset; 1491 } 1492 commonPosition = vec4(projectedPosition + offset, 1.0); 1493 return project_common_position_to_clipspace(commonPosition); 1494} 1495 1496vec4 project_position_to_clipspace( 1497 vec3 position, vec3 position64Low, vec3 offset 1498) { 1499 vec4 commonPosition; 1500 return project_position_to_clipspace(position, position64Low, offset, commonPosition); 1501}
1502`,m={name:"project32",dependencies:[f.A],source:p,vs:g},_={name:"color",dependencies:[],source:` 1503 1504@must_use 1505fn deckgl_premultiplied_alpha(fragColor: vec4<f32>) -> vec4<f32> { 1506 return vec4(fragColor.rgb * fragColor.a, fragColor.a); 1507}; 1508`,getUniforms:e=>({})};function y(e,t=!0){return e??t}function v(e=[0,0,0],t=!0){return t?e.map(e=>e/255):[...e]}let b={props:{},uniforms:{},name:"picking",uniformTypes:{isActive:"f32",isAttribute:"f32",isHighlightActive:"f32",useByteColors:"f32",highlightedObjectColor:"vec3<f32>",highlightColor:"vec4<f32>"},defaultUniforms:{isActive:!1,isAttribute:!1,isHighlightActive:!1,useByteColors:!0,highlightedObjectColor:[0,0,0],highlightColor:[0,1,1,1]},vs:`\ 1509layout(std140) uniform pickingUniforms { 1510 float isActive; 1511 float isAttribute; 1512 float isHighlightActive; 1513 float useByteColors; 1514 vec3 highlightedObjectColor; 1515 vec4 highlightColor; 1516} picking; 1517 1518out vec4 picking_vRGBcolor_Avalid; 1519 1520// Normalize unsigned byte color to 0-1 range 1521vec3 picking_normalizeColor(vec3 color) { 1522 return picking.useByteColors > 0.5 ? color / 255.0 : color; 1523} 1524 1525// Normalize unsigned byte color to 0-1 range 1526vec4 picking_normalizeColor(vec4 color) { 1527 return picking.useByteColors > 0.5 ? color / 255.0 : color; 1528} 1529 1530bool picking_isColorZero(vec3 color) { 1531 return dot(color, vec3(1.0)) < 0.00001; 1532} 1533 1534bool picking_isColorValid(vec3 color) { 1535 return dot(color, vec3(1.0)) > 0.00001; 1536} 1537 1538// Check if this vertex is highlighted 1539bool isVertexHighlighted(vec3 vertexColor) { 1540 vec3 highlightedObjectColor = picking_normalizeColor(picking.highlightedObjectColor); 1541 return 1542 bool(picking.isHighlightActive) && picking_isColorZero(abs(vertexColor - highlightedObjectColor)); 1543} 1544 1545// Set the current picking color 1546void picking_setPickingColor(vec3 pickingColor) { 1547 pickingColor = picking_normalizeColor(pickingColor); 1548 1549 if (bool(picking.isActive)) { 1550 // Use alpha as the validity flag. If pickingColor is [0, 0, 0] fragment is non-pickable 1551 picking_vRGBcolor_Avalid.a = float(picking_isColorValid(pickingColor)); 1552 1553 if (!bool(picking.isAttribute)) { 1554 // Stores the picking color so that the fragment shader can render it during picking 1555 picking_vRGBcolor_Avalid.rgb = pickingColor; 1556 } 1557 } else { 1558 // Do the comparison with selected item color in vertex shader as it should mean fewer compares 1559 picking_vRGBcolor_Avalid.a = float(isVertexHighlighted(pickingColor)); 1560 } 1561} 1562 1563void picking_setPickingAttribute(float value) { 1564 if (bool(picking.isAttribute)) { 1565 picking_vRGBcolor_Avalid.r = value; 1566 } 1567} 1568 1569void picking_setPickingAttribute(vec2 value) { 1570 if (bool(picking.isAttribute)) { 1571 picking_vRGBcolor_Avalid.rg = value; 1572 } 1573} 1574 1575void picking_setPickingAttribute(vec3 value) { 1576 if (bool(picking.isAttribute)) { 1577 picking_vRGBcolor_Avalid.rgb = value; 1578 } 1579} 1580`,fs:`\ 1581layout(std140) uniform pickingUniforms { 1582 float isActive; 1583 float isAttribute; 1584 float isHighlightActive; 1585 float useByteColors; 1586 vec3 highlightedObjectColor; 1587 vec4 highlightColor; 1588} picking; 1589 1590in vec4 picking_vRGBcolor_Avalid; 1591 1592/* 1593 * Returns highlight color if this item is selected. 1594 */ 1595vec4 picking_filterHighlightColor(vec4 color) { 1596 // If we are still picking, we don't highlight 1597 if (picking.isActive > 0.5) { 1598 return color; 1599 } 1600 1601 bool selected = bool(picking_vRGBcolor_Avalid.a); 1602 1603 if (selected) { 1604 // Blend in highlight color based on its alpha value 1605 float highLightAlpha = picking.highlightColor.a; 1606 float blendedAlpha = highLightAlpha + color.a * (1.0 - highLightAlpha); 1607 float highLightRatio = highLightAlpha / blendedAlpha; 1608 1609 vec3 blendedRGB = mix(color.rgb, picking.highlightColor.rgb, highLightRatio); 1610 return vec4(blendedRGB, blendedAlpha); 1611 } else { 1612 return color; 1613 } 1614} 1615 1616/* 1617 * Returns picking color if picking enabled else unmodified argument. 1618 */ 1619vec4 picking_filterPickingColor(vec4 color) { 1620 if (bool(picking.isActive)) { 1621 if (picking_vRGBcolor_Avalid.a == 0.0) { 1622 discard; 1623 } 1624 return picking_vRGBcolor_Avalid; 1625 } 1626 return color; 1627} 1628 1629/* 1630 * Returns picking color if picking is enabled if not 1631 * highlight color if this item is selected, otherwise unmodified argument. 1632 */ 1633vec4 picking_filterColor(vec4 color) { 1634 vec4 highlightColor = picking_filterHighlightColor(color); 1635 return picking_filterPickingColor(highlightColor); 1636} 1637`,getUniforms:function(e={},t){let i={},r=y(e.useByteColors,!0);return void 0===e.highlightedObjectColor||(null===e.highlightedObjectColor?i.isHighlightActive=!1:(i.isHighlightActive=!0,i.highlightedObjectColor=e.highlightedObjectColor.slice(0,3))),e.highlightColor&&(i.highlightColor=function(e,t=!0){let i=v(e.slice(0,3),t),r=Number.isFinite(e[3]),s=r?e[3]:1;return[i[0],i[1],i[2],t&&r?s/255:s]}(e.highlightColor,r)),void 0!==e.isActive&&(i.isActive=!!e.isActive,i.isAttribute=!!e.isAttribute),void 0!==e.useByteColors&&(i.useByteColors=!!e.useByteColors),i}},E=`\ 1638struct pickingUniforms { 1639 isActive: f32, 1640 isAttribute: f32, 1641 isHighlightActive: f32, 1642 useByteColors: f32, 1643 highlightedObjectColor: vec3<f32>, 1644 highlightColor: vec4<f32>, 1645}; 1646 1647@group(0) @binding(auto) var<uniform> picking: pickingUniforms; 1648 1649fn picking_normalizeColor(color: vec3<f32>) -> vec3<f32> { 1650 return select(color, color / 255.0, picking.useByteColors > 0.5); 1651} 1652 1653fn picking_normalizeColor4(color: vec4<f32>) -> vec4<f32> { 1654 return select(color, color / 255.0, picking.useByteColors > 0.5); 1655} 1656 1657fn picking_isColorZero(color: vec3<f32>) -> bool { 1658 return dot(color, vec3<f32>(1.0)) < 0.00001; 1659} 1660 1661fn picking_isColorValid(color: vec3<f32>) -> bool { 1662 return dot(color, vec3<f32>(1.0)) > 0.00001; 1663} 1664`,x={...b,source:E,defaultUniforms:{...b.defaultUniforms,useByteColors:!0},inject:{"vs:DECKGL_FILTER_GL_POSITION":` 1665 // for picking depth values 1666 picking_setPickingAttribute(position.z / position.w); 1667 `,"vs:DECKGL_FILTER_COLOR":` 1668 picking_setPickingColor(geometry.pickingColor); 1669 `,"fs:DECKGL_FILTER_COLOR":{order:99,injection:` 1670 // use highlight color if this fragment belongs to the selected object. 1671 color = picking_filterHighlightColor(color); 1672 1673 // use picking color if rendering to picking FBO. 1674 color = picking_filterPickingColor(color); 1675 `}}};var w=i(27645),S=i(43280),P=i(60875),T=i(81403);class A{id;topology;vertexCount;indices;attributes;userData={};constructor(e){let{attributes:t={},indices:i=null,vertexCount:r=null}=e;for(let[r,s]of(this.id=e.id||(0,T.L)("geometry"),this.topology=e.topology,i&&(this.indices=ArrayBuffer.isView(i)?{value:i,size:1}:i),this.attributes={},Object.entries(t))){let e=ArrayBuffer.isView(s)?{value:s}:s;if(!ArrayBuffer.isView(e.value))throw Error(`${this._print(r)}: must be typed array or object with value as typed array`);if("POSITION"!==r&&"positions"!==r||e.size||(e.size=3),"indices"===r){if(this.indices)throw Error("Multiple indices detected");this.indices=e}else this.attributes[r]=e}this.indices&&void 0!==this.indices.isIndexed&&(this.indices=Object.assign({},this.indices),delete this.indices.isIndexed),this.vertexCount=r||this._calculateVertexCount(this.attributes,this.indices)}getVertexCount(){return this.vertexCount}getAttributes(){return this.indices?{indices:this.indices,...this.attributes}:this.attributes}_print(e){return`Geometry ${this.id} attribute ${e}`}_setAttributes(e,t){return this}_calculateVertexCount(e,t){if(t)return t.value.length;let i=1/0;for(let t of Object.values(e)){let{value:e,size:r,constant:s}=t;!s&&e&&void 0!==r&&r>=1&&(i=Math.min(i,e.length/r))}return i}}let M=`\ 1676layout(std140) uniform iconUniforms { 1677 float sizeScale; 1678 vec2 iconsTextureDim; 1679 float sizeBasis;
1680 float sizeMinPixels; 1681 float sizeMaxPixels; 1682 bool billboard; 1683 highp int sizeUnits; 1684 float alphaCutoff; 1685} icon; 1686`,C={name:"icon",vs:M,fs:M,uniformTypes:{sizeScale:"f32",iconsTextureDim:"vec2<f32>",sizeBasis:"f32",sizeMinPixels:"f32",sizeMaxPixels:"f32",billboard:"f32",sizeUnits:"i32",alphaCutoff:"f32"}},R=`\ 1687#version 300 es 1688#define SHADER_NAME icon-layer-vertex-shader 1689in vec2 positions; 1690in vec3 instancePositions; 1691in vec3 instancePositions64Low; 1692in float instanceSizes; 1693in float instanceAngles; 1694in vec4 instanceColors; 1695in vec3 instancePickingColors; 1696in vec4 instanceIconFrames; 1697in float instanceColorModes; 1698in vec2 instanceOffsets; 1699in vec2 instancePixelOffset; 1700out float vColorMode; 1701out vec4 vColor; 1702out vec2 vTextureCoords; 1703out vec2 uv; 1704vec2 rotate_by_angle(vec2 vertex, float angle) { 1705float angle_radian = angle * PI / 180.0; 1706float cos_angle = cos(angle_radian); 1707float sin_angle = sin(angle_radian); 1708mat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle); 1709return rotationMatrix * vertex; 1710} 1711void main(void) { 1712geometry.worldPosition = instancePositions; 1713geometry.uv = positions; 1714geometry.pickingColor = instancePickingColors; 1715uv = positions; 1716vec2 iconSize = instanceIconFrames.zw; 1717float sizePixels = clamp( 1718project_size_to_pixel(instanceSizes * icon.sizeScale, icon.sizeUnits),
1719icon.sizeMinPixels, icon.sizeMaxPixels 1720); 1721float iconConstraint = icon.sizeBasis == 0.0 ? iconSize.x : iconSize.y; 1722float instanceScale = iconConstraint == 0.0 ? 0.0 : sizePixels / iconConstraint; 1723vec2 pixelOffset = positions / 2.0 * iconSize + instanceOffsets; 1724pixelOffset = rotate_by_angle(pixelOffset, instanceAngles) * instanceScale; 1725pixelOffset += instancePixelOffset; 1726pixelOffset.y *= -1.0; 1727if (icon.billboard) { 1728gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position); 1729DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 1730vec3 offset = vec3(pixelOffset, 0.0); 1731DECKGL_FILTER_SIZE(offset, geometry); 1732gl_Position.xy += project_pixel_size_to_clipspace(offset.xy); 1733} else { 1734vec3 offset_common = vec3(project_pixel_size(pixelOffset), 0.0); 1735DECKGL_FILTER_SIZE(offset_common, geometry); 1736gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset_common, geometry.position); 1737DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 1738} 1739vTextureCoords = mix( 1740instanceIconFrames.xy, 1741instanceIconFrames.xy + iconSize, 1742(positions.xy + 1.0) / 2.0 1743) / icon.iconsTextureDim; 1744vColor = instanceColors; 1745DECKGL_FILTER_COLOR(vColor, geometry); 1746vColorMode = instanceColorModes; 1747} 1748`,L=`\ 1749#version 300 es 1750#define SHADER_NAME icon-layer-fragment-shader 1751precision highp float; 1752uniform sampler2D iconsTexture; 1753in float vColorMode; 1754in vec4 vColor; 1755in vec2 vTextureCoords; 1756in vec2 uv; 1757out vec4 fragColor; 1758void main(void) { 1759geometry.uv = uv; 1760vec4 texColor = texture(iconsTexture, vTextureCoords); 1761vec3 color = mix(texColor.rgb, vColor.rgb, vColorMode); 1762float a = texColor.a * layer.opacity * vColor.a; 1763if (a < icon.alphaCutoff) { 1764discard; 1765} 1766fragColor = vec4(color, a); 1767DECKGL_FILTER_COLOR(fragColor, geometry); 1768} 1769`,I=`\ 1770struct IconUniforms { 1771 sizeScale: f32, 1772 iconsTextureDim: vec2<f32>, 1773 sizeBasis: f32, 1774 sizeMinPixels: f32, 1775 sizeMaxPixels: f32, 1776 billboard: i32, 1777 sizeUnits: i32, 1778 alphaCutoff: f32 1779}; 1780 1781@group(0) @binding(auto) var<uniform> icon: IconUniforms; 1782@group(0) @binding(auto) var iconsTexture : texture_2d<f32>; 1783@group(0) @binding(auto) var iconsTextureSampler : sampler; 1784 1785fn rotate_by_angle(vertex: vec2<f32>, angle_deg: f32) -> vec2<f32> { 1786 let angle_radian = angle_deg * PI / 180.0; 1787 let c = cos(angle_radian); 1788 let s = sin(angle_radian); 1789 let rotation = mat2x2<f32>(vec2<f32>(c, s), vec2<f32>(-s, c)); 1790 return rotation * vertex; 1791} 1792 1793struct Attributes { 1794 @location(0) positions: vec2<f32>, 1795 1796 @location(1) instancePositions: vec3<f32>, 1797 @location(2) instancePositions64Low: vec3<f32>, 1798 @location(3) instanceSizes: f32, 1799 @location(4) instanceAngles: f32, 1800 @location(5) instanceColors: vec4<f32>, 1801 @location(6) instancePickingColors: vec3<f32>, 1802 @location(7) instanceIconFrames: vec4<f32>, 1803 @location(8) instanceColorModes: f32, 1804 @location(9) instanceOffsets: vec2<f32>, 1805 @location(10) instancePixelOffset: vec2<f32>, 1806}; 1807 1808struct Varyings { 1809 @builtin(position) position: vec4<f32>, 1810 1811 @location(0) vColorMode: f32, 1812 @location(1) vColor: vec4<f32>, 1813 @location(2) vTextureCoords: vec2<f32>, 1814 @location(3) uv: vec2<f32>, 1815 @location(4) pickingColor: vec3<f32>, 1816}; 1817 1818@vertex 1819fn vertexMain(inp: Attributes) -> Varyings { 1820 // write geometry fields used by filters + FS 1821 geometry.worldPosition = inp.instancePositions; 1822 geometry.uv = inp.positions; 1823 geometry.pickingColor = inp.instancePickingColors; 1824 1825 var outp: Varyings; 1826 outp.uv = inp.positions; 1827 1828 let iconSize = inp.instanceIconFrames.zw; 1829 1830 // convert size in meters to pixels, then clamp 1831 let sizePixels = clamp( 1832 project_unit_size_to_pixel(inp.instanceSizes * icon.sizeScale, icon.sizeUnits),
1833 icon.sizeMinPixels, icon.sizeMaxPixels 1834 ); 1835 1836 // scale icon height to match instanceSize 1837 let iconConstraint = select(iconSize.y, iconSize.x, icon.sizeBasis == 0.0); 1838 let instanceScale = select(sizePixels / iconConstraint, 0.0, iconConstraint == 0.0); 1839 1840 // scale and rotate vertex in "pixel" units; then add per-instance pixel offset 1841 var pixelOffset = inp.positions / 2.0 * iconSize + inp.instanceOffsets; 1842 pixelOffset = rotate_by_angle(pixelOffset, inp.instanceAngles) * instanceScale; 1843 pixelOffset = pixelOffset + inp.instancePixelOffset; 1844 pixelOffset.y = pixelOffset.y * -1.0; 1845 1846 if (icon.billboard != 0) { 1847 var pos = project_position_to_clipspace(inp.instancePositions, inp.instancePositions64Low, vec3<f32>(0.0)); // TODO, &geometry.position); 1848 // DECKGL_FILTER_GL_POSITION(pos, geometry); 1849 1850 var offset = vec3<f32>(pixelOffset, 0.0); 1851 // DECKGL_FILTER_SIZE(offset, geometry); 1852 let clipOffset = project_pixel_size_to_clipspace(offset.xy); 1853 pos = vec4<f32>(pos.x + clipOffset.x, pos.y + clipOffset.y, pos.z, pos.w); 1854 outp.position = pos; 1855 } else { 1856 var offset_common = vec3<f32>(project_pixel_size_vec2(pixelOffset), 0.0); 1857 // DECKGL_FILTER_SIZE(offset_common, geometry); 1858 var pos = project_position_to_clipspace(inp.instancePositions, inp.instancePositions64Low, offset_common); // TODO, &geometry.position); 1859 // DECKGL_FILTER_GL_POSITION(pos, geometry); 1860 outp.position = pos; 1861 } 1862 1863 let uvMix = (inp.positions.xy + vec2<f32>(1.0, 1.0)) * 0.5; 1864 outp.vTextureCoords = mix(inp.instanceIconFrames.xy, inp.instanceIconFrames.xy + iconSize, uvMix) / icon.iconsTextureDim; 1865 1866 outp.vColor = inp.instanceColors; 1867 // DECKGL_FILTER_COLOR(outp.vColor, geometry); 1868 1869 outp.vColorMode = inp.instanceColorModes; 1870 outp.pickingColor = inp.instancePickingColors; 1871 1872 return outp; 1873} 1874 1875@fragment 1876fn fragmentMain(inp: Varyings) -> @location(0) vec4<f32> { 1877 // expose to deck.gl filter hooks 1878 geometry.uv = inp.uv; 1879 1880 let texColor = textureSample(iconsTexture, iconsTextureSampler, inp.vTextureCoords); 1881 1882 // if colorMode == 0, use pixel color from the texture 1883 // if colorMode == 1 (or picking), use texture as transparency mask 1884 let rgb = mix(texColor.rgb, inp.vColor.rgb, inp.vColorMode); 1885 let a = texColor.a * layer.opacity * inp.vColor.a; 1886 1887 if (a < icon.alphaCutoff) { 1888 discard; 1889 } 1890 1891 if (picking.isActive > 0.5) { 1892 if (!picking_isColorValid(inp.pickingColor)) { 1893 discard; 1894 } 1895 return vec4<f32>(inp.pickingColor, 1.0); 1896 } 1897 1898 var fragColor = deckgl_premultiplied_alpha(vec4<f32>(rgb, a)); 1899 1900 if (picking.isHighlightActive > 0.5) { 1901 let highlightedObjectColor = picking_normalizeColor(picking.highlightedObjectColor); 1902 if (picking_isColorZero(abs(inp.pickingColor - highlightedObjectColor))) { 1903 let highLightAlpha = picking.highlightColor.a; 1904 let blendedAlpha = highLightAlpha + fragColor.a * (1.0 - highLightAlpha); 1905 if (blendedAlpha > 0.0) { 1906 let highLightRatio = highLightAlpha / blendedAlpha; 1907 fragColor = vec4<f32>( 1908 mix(fragColor.rgb, picking.highlightColor.rgb, highLightRatio), 1909 blendedAlpha 1910 ); 1911 } else { 1912 fragColor = vec4<f32>(fragColor.rgb, 0.0); 1913 } 1914 } 1915 } 1916 1917 return fragColor; 1918} 1919`;var O=i(41487),N=i(73452);let F=()=>{},D={minFilter:"linear",mipmapFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"},B={x:0,y:0,width:0,height:0};function G(e){return e&&(e.id||e.url)}function k(e){let{device:t}=e;"webgl"===t.type?e.generateMipmapsWebGL():"webgpu"===t.type&&t.generateMipmapsWebGPU(e)}function U(e,t,i){for(let r=0;r<t.length;r++){let{icon:s,xOffset:n}=t[r];e[G(s)]={...s,x:n,y:i}}}class z{constructor(e,{onUpdate:t=F,onError:i=F}){this._loadOptions=null,this._texture=null,this._externalTexture=null,this._mapping={},this._samplerParameters=null,this._pendingCount=0,this._autoPacking=!1,this._xOffset=0,this._yOffset=0,this._rowHeight=0,this._buffer=4,this._canvasWidth=1024,this._canvasHeight=0,this._canvas=null,this.device=e,this.onUpdate=t,this.onError=i}finalize(){this._texture?.delete()}getTexture(){return this._texture||this._externalTexture}getIconMapping(e){let t=this._autoPacking?G(e):e;return this._mapping[t]||B}setProps({loadOptions:e,autoPacking:t,iconAtlas:i,iconMapping:r,textureParameters:s}){e&&(this._loadOptions=e),void 0!==t&&(this._autoPacking=t),r&&(this._mapping=r),i&&(this._texture?.delete(),this._texture=null,this._externalTexture=i),s&&(this._samplerParameters=s)}
1919get isLoaded(){return 0===this._pendingCount}packIcons(e,t){if(!this._autoPacking||"undefined"==typeof document)return;let i=Object.values(function(e,t,i){if(!e||!t)return null;i=i||{};let r={},{iterable:s,objectInfo:n}=(0,N.X)(e);for(let e of s){n.index++;let s=t(e,n),o=G(s);if(!s)throw Error("Icon is missing.");if(!s.url)throw Error("Icon url is missing.");r[o]||i[o]&&s.url===i[o].url||(r[o]={...s,source:e,sourceIndex:n.index})}return r}(e,t,this._mapping)||{});if(i.length>0){let{mapping:e,xOffset:t,yOffset:r,rowHeight:s,canvasHeight:n}=function({icons:e,buffer:t,mapping:i={},xOffset:r=0,yOffset:s=0,rowHeight:n=0,canvasWidth:o}){let a=[];for(let l=0;l<e.length;l++){let h=e[l];if(!i[G(h)]){let{height:e,width:l}=h;r+l+t>o&&(U(i,a,s),r=0,s=n+s+t,n=0,a=[]),a.push({icon:h,xOffset:r}),r=r+l+t,n=Math.max(n,e)}}return a.length>0&&U(i,a,s),{mapping:i,rowHeight:n,xOffset:r,yOffset:s,canvasWidth:o,canvasHeight:Math.pow(2,Math.ceil(Math.log2(n+s+t)))}}({icons:i,buffer:this._buffer,canvasWidth:this._canvasWidth,mapping:this._mapping,rowHeight:this._rowHeight,xOffset:this._xOffset,yOffset:this._yOffset});this._rowHeight=s,this._mapping=e,this._xOffset=t,this._yOffset=r,this._canvasHeight=n,this._texture||(this._texture=this.device.createTexture({format:"rgba8unorm",data:null,width:this._canvasWidth,height:this._canvasHeight,sampler:this._samplerParameters||D,mipLevels:this.device.getMipLevelCount(this._canvasWidth,this._canvasHeight)})),this._texture.height!==this._canvasHeight&&(this._texture=function(e,t,i,r){let{width:s,height:n,device:o}=e,a=o.createTexture({format:"rgba8unorm",width:t,height:i,sampler:r,mipLevels:o.getMipLevelCount(t,i)}),l=o.createCommandEncoder();l.copyTextureToTexture({sourceTexture:e,destinationTexture:a,width:s,height:n});let h=l.finish();return o.submit(h),k(a),e.destroy(),a}(this._texture,this._canvasWidth,this._canvasHeight,this._samplerParameters||D)),this.onUpdate(!0),this._canvas=this._canvas||document.createElement("canvas"),this._loadIcons(i)}}_loadIcons(e){let t=this._canvas.getContext("2d",{willReadFrequently:!0});for(let i of e)this._pendingCount++,(0,O.H)(i.url,this._loadOptions).then(e=>{let r=G(i),s=this._mapping[r],{x:n,y:o,width:a,height:l}=s,{image:h,width:u,height:c}=function(e,t,i,r){let s=Math.min(i/t.width,r/t.height),n=Math.floor(t.width*s),o=Math.floor(t.height*s);return 1===s?{image:t,width:n,height:o}:(e.canvas.height=o,e.canvas.width=n,e.clearRect(0,0,n,o),e.drawImage(t,0,0,t.width,t.height,0,0,n,o),{image:e.canvas,width:n,height:o})}(t,e,a,l),d=n+(a-u)/2,f=o+(l-c)/2;this._texture?.copyExternalImage({image:h,x:d,y:f,width:u,height:c}),s.x=d,s.y=f,s.width=u,s.height=c,this._texture&&k(this._texture),this.onUpdate(u!==a||c!==l)}).catch(e=>{this.onError({url:i.url,source:i.source,sourceIndex:i.sourceIndex,loadOptions:this._loadOptions,error:e})}).finally(()=>{this._pendingCount--})}}let j=[0,0,0,255],V={iconAtlas:{type:"image",value:null,async:!0},iconMapping:{type:"object",value:{},async:!0},sizeScale:{type:"number",value:1,min:0},billboard:!0,sizeUnits:"pixels",sizeBasis:"height",sizeMinPixels:{type:"number",min:0,value:0},sizeMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},alphaCutoff:{type:"number",value:.05,min:0,max:1},getPosition:{type:"accessor",value:e=>e.position},getIcon:{type:"accessor",value:e=>e.icon},getColor:{type:"accessor",value:j},getSize:{type:"accessor",value:1},getAngle:{type:"accessor",value:0},getPixelOffset:{type:"accessor",value:[0,0]},onIconError:{type:"function",value:null,optional:!0},textureParameters:{type:"object",ignore:!0,value:null}};class W extends o.A{getShaders(){return super.getShaders({vs:R,fs:L,source:I,modules:[m,_,x,C]})}initializeState(){this.state={iconManager:new z(this.context.device,{onUpdate:this._onUpdate.bind(this),onError:this._onError.bind(this)})},this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceSizes:{size:1,transition:!0,accessor:"getSize",defaultValue:1},instanceIconDefs:{size:7,accessor:"getIcon",transform:this.getInstanceIconDef,shaderAttributes:{instanceOffsets:{size:2,elementOffset:0},instanceIconFrames:{size:4,elementOffset:2},instanceColorModes:{size:1,elementOffset:6}}},instanceColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getColor",defaultValue:j},instanceAngles:{size:1,transition:!0,accessor:"getAngle"},instancePixelOffset:{size:2,transition:!0,accessor:"getPixelOffset"}})}updateState(e){super.updateState(e);let{props:t,oldProps:i,changeFlags:r}=e,s=this.getAttributeManager(),{iconAtlas:n,iconMapping:o,data:a,getIcon:l,textureParameters:h}=t,{iconManager:u}=this.state;if("string"==typeof n)return;let c=n||this.internalState.isAsyncPropLoading("iconAtlas");u.setProps({loadOptions:t.loadOptions,autoPacking:!c,iconAtlas:n,iconMapping:c?o:null,textureParameters:h}),c?i.iconMapping!==t.iconMapping&&s.invalidate("getIcon"):(r.dataChanged||r.updateTriggersChanged&&(r.updateTriggersChanged.all||r.updateTriggersChanged.getIcon))&&u.packIcons(a,l),r.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),s.invalidateAll())}get isLoaded(){return super.isLoaded&&this.state.iconManager.isLoaded}finalizeState(e){super.finalizeState(e),this.state.iconManager.finalize()}draw({uniforms:e}
1919){let{sizeScale:t,sizeBasis:i,sizeMinPixels:r,sizeMaxPixels:s,sizeUnits:n,billboard:o,alphaCutoff:a}=this.props,{iconManager:l}=this.state,h=l.getTexture();if(h){let e=this.state.model,l={iconsTexture:h,iconsTextureDim:[h.width,h.height],sizeUnits:w.p5[n],sizeScale:t,sizeBasis:+("height"===i),sizeMinPixels:r,sizeMaxPixels:s,billboard:o,alphaCutoff:a};e.shaderInputs.setProps({icon:l}),e.draw(this.context.renderPass)}}_getModel(){return new P.K(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new A({topology:"triangle-strip",attributes:{positions:{size:2,value:new Float32Array([-1,-1,1,-1,-1,1,1,1])}}}),isInstanced:!0})}_onUpdate(e){e?(this.getAttributeManager()?.invalidate("getIcon"),this.setNeedsUpdate()):this.setNeedsRedraw()}_onError(e){let t=this.getCurrentLayer()?.props.onIconError;t?t(e):S.A.error(e.error.message)()}getInstanceIconDef(e){let{x:t,y:i,width:r,height:s,mask:n,anchorX:o=r/2,anchorY:a=s/2}=this.state.iconManager.getIconMapping(e);return[r/2-o,s/2-a,t,i,r,s,+!!n]}}W.defaultProps=V,W.layerName="IconLayer";let $=W,H=`\ 1920layout(std140) uniform scatterplotUniforms { 1921 float radiusScale; 1922 float radiusMinPixels; 1923 float radiusMaxPixels; 1924 float lineWidthScale; 1925 float lineWidthMinPixels; 1926 float lineWidthMaxPixels; 1927 float stroked; 1928 float filled; 1929 bool antialiasing; 1930 bool billboard; 1931 highp int radiusUnits; 1932 highp int lineWidthUnits; 1933} scatterplot; 1934`,q={name:"scatterplot",vs:H,fs:H,source:"",uniformTypes:{radiusScale:"f32",radiusMinPixels:"f32",radiusMaxPixels:"f32",lineWidthScale:"f32",lineWidthMinPixels:"f32",lineWidthMaxPixels:"f32",stroked:"f32",filled:"f32",antialiasing:"f32",billboard:"f32",radiusUnits:"i32",lineWidthUnits:"i32"}},K=`\ 1935#version 300 es 1936#define SHADER_NAME scatterplot-layer-vertex-shader 1937in vec3 positions; 1938in vec3 instancePositions; 1939in vec3 instancePositions64Low; 1940in float instanceRadius; 1941in float instanceLineWidths; 1942in vec4 instanceFillColors; 1943in vec4 instanceLineColors; 1944in vec3 instancePickingColors; 1945in vec2 instancePixelOffset; 1946out vec4 vFillColor; 1947out vec4 vLineColor; 1948out vec2 unitPosition; 1949out float innerUnitRadius; 1950out float outerRadiusPixels; 1951void main(void) { 1952geometry.worldPosition = instancePositions; 1953outerRadiusPixels = clamp( 1954project_size_to_pixel(scatterplot.radiusScale * instanceRadius, scatterplot.radiusUnits), 1955scatterplot.radiusMinPixels, scatterplot.radiusMaxPixels 1956); 1957float lineWidthPixels = clamp( 1958project_size_to_pixel(scatterplot.lineWidthScale * instanceLineWidths, scatterplot.lineWidthUnits), 1959scatterplot.lineWidthMinPixels, scatterplot.lineWidthMaxPixels 1960); 1961outerRadiusPixels += scatterplot.stroked * lineWidthPixels / 2.0; 1962float edgePadding = scatterplot.antialiasing ? (outerRadiusPixels + SMOOTH_EDGE_RADIUS) / outerRadiusPixels : 1.0; 1963unitPosition = edgePadding * positions.xy; 1964geometry.uv = unitPosition; 1965geometry.pickingColor = instancePickingColors; 1966innerUnitRadius = 1.0 - scatterplot.stroked * lineWidthPixels / outerRadiusPixels; 1967if (scatterplot.billboard) { 1968gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position); 1969DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 1970vec3 offset = edgePadding * positions * outerRadiusPixels; 1971offset.xy += instancePixelOffset; 1972DECKGL_FILTER_SIZE(offset, geometry); 1973gl_Position.xy += project_pixel_size_to_clipspace(offset.xy); 1974} else { 1975vec3 offset = edgePadding * positions * project_pixel_size(outerRadiusPixels); 1976offset.xy += project_pixel_size(instancePixelOffset); 1977DECKGL_FILTER_SIZE(offset, geometry); 1978gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset, geometry.position); 1979DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 1980} 1981vFillColor = vec4(instanceFillColors.rgb, instanceFillColors.a * layer.opacity); 1982DECKGL_FILTER_COLOR(vFillColor, geometry); 1983vLineColor = vec4(instanceLineColors.rgb, instanceLineColors.a * layer.opacity); 1984DECKGL_FILTER_COLOR(vLineColor, geometry); 1985} 1986`,X=`\ 1987#version 300 es 1988#define SHADER_NAME scatterplot-layer-fragment-shader 1989precision highp float; 1990in vec4 vFillColor; 1991in vec4 vLineColor; 1992in vec2 unitPosition; 1993in float innerUnitRadius; 1994in float outerRadiusPixels; 1995out vec4 fragColor; 1996void main(void) { 1997geometry.uv = unitPosition; 1998float distToCenter = length(unitPosition) * outerRadiusPixels; 1999float inCircle = scatterplot.antialiasing ? 2000smoothedge(distToCenter, outerRadiusPixels) : 2001step(distToCenter, outerRadiusPixels); 2002if (inCircle == 0.0) { 2003discard; 2004} 2005if (scatterplot.stroked > 0.5) { 2006float isLine = scatterplot.antialiasing ? 2007smoothedge(innerUnitRadius * outerRadiusPixels, distToCenter) : 2008step(innerUnitRadius * outerRadiusPixels, distToCenter); 2009if (scatterplot.filled > 0.5) { 2010fragColor = mix(vFillColor, vLineColor, isLine); 2011} else { 2012if (isLine == 0.0) { 2013discard; 2014} 2015fragColor = vec4(vLineColor.rgb, vLineColor.a * isLine); 2016} 2017} else if (scatterplot.filled < 0.5) { 2018discard; 2019} else { 2020fragColor = vFillColor; 2021} 2022fragColor.a *= inCircle; 2023DECKGL_FILTER_COLOR(fragColor, geometry); 2024} 2025`,Y=`\ 2026// Main shaders 2027 2028struct ScatterplotUniforms { 2029 radiusScale: f32, 2030 radiusMinPixels: f32, 2031 radiusMaxPixels: f32, 2032 lineWidthScale: f32, 2033 lineWidthMinPixels: f32, 2034 lineWidthMaxPixels: f32, 2035 stroked: f32, 2036 filled: i32, 2037 antialiasing: i32, 2038 billboard: i32, 2039 radiusUnits: i32, 2040 lineWidthUnits: i32, 2041}; 2042 2043struct ConstantAttributeUniforms { 2044 instancePositions: vec3<f32>, 2045 instancePositions64Low: vec3<f32>, 2046 instanceRadius: f32, 2047 instanceLineWidths: f32, 2048 instanceFillColors: vec4<f32>, 2049 instanceLineColors: vec4<f32>, 2050 instancePickingColors: vec3<f32>, 2051 instancePixelOffset: vec2<f32>, 2052 2053 instancePositionsConstant: i32, 2054 instancePositions64LowConstant: i32, 2055 instanceRadiusConstant: i32, 2056 instanceLineWidthsConstant: i32, 2057 instanceFillColorsConstant: i32, 2058 instanceLineColorsConstant: i32, 2059 instancePickingColorsConstant: i32, 2060 instancePixelOffsetConstant: i32 2061}; 2062 2063@group(0) @binding(0) var<uniform> scatterplot: ScatterplotUniforms; 2064 2065struct ConstantAttributes { 2066 instancePositions: vec3<f32>, 2067 instancePositions64Low: vec3<f32>, 2068 instanceRadius: f32, 2069 instanceLineWidths: f32, 2070 instanceFillColors: vec4<f32>, 2071 instanceLineColors: vec4<f32>, 2072 instancePickingColors: vec3<f32>, 2073 instancePixelOffset: vec2<f32> 2074}; 2075 2076const constants = ConstantAttributes( 2077 vec3<f32>(0.0), 2078 vec3<f32>(0.0), 2079 0.0, 2080 0.0, 2081 vec4<f32>(0.0, 0.0, 0.0, 1.0), 2082 vec4<f32>(0.0, 0.0, 0.0, 1.0), 2083 vec3<f32>(0.0), 2084 vec2<f32>(0.0) 2085); 2086 2087struct Attributes { 2088 @builtin(instance_index) instanceIndex : u32, 2089 @builtin(vertex_index) vertexIndex : u32, 2090 @location(0) positions: vec3<f32>, 2091 @location(1) instancePositions: vec3<f32>, 2092 @location(2) instancePositions64Low: vec3<f32>, 2093 @location(3) instanceRadius: f32, 2094 @location(4) instanceLineWidths: f32, 2095 @location(5) instanceFillColors: vec4<f32>, 2096 @location(6) instanceLineColors: vec4<f32>, 2097 @location(7) instancePickingColors: vec3<f32>, 2098 @location(8) instancePixelOffset: vec2<f32> 2099}; 2100
2101struct Varyings { 2102 @builtin(position) position: vec4<f32>, 2103 @location(0) vFillColor: vec4<f32>, 2104 @location(1) vLineColor: vec4<f32>, 2105 @location(2) unitPosition: vec2<f32>, 2106 @location(3) innerUnitRadius: f32, 2107 @location(4) outerRadiusPixels: f32, 2108 @location(5) pickingColor: vec3<f32>, 2109}; 2110 2111@vertex 2112fn vertexMain(attributes: Attributes) -> Varyings { 2113 var varyings: Varyings; 2114 2115 // Draw an inline geometry constant array clip space triangle to verify that rendering works. 2116 // var positions = array<vec2<f32>, 3>(vec2(0.0, 0.5), vec2(-0.5, -0.5), vec2(0.5, -0.5)); 2117 // if (attributes.instanceIndex == 0) { 2118 // varyings.position = vec4<f32>(positions[attributes.vertexIndex], 0.0, 1.0); 2119 // return varyings; 2120 // } 2121 2122 geometry.worldPosition = attributes.instancePositions; 2123 2124 // Multiply out radius and clamp to limits 2125 varyings.outerRadiusPixels = clamp( 2126 project_unit_size_to_pixel(scatterplot.radiusScale * attributes.instanceRadius, scatterplot.radiusUnits), 2127 scatterplot.radiusMinPixels, scatterplot.radiusMaxPixels 2128 ); 2129 2130 // Multiply out line width and clamp to limits 2131 let lineWidthPixels = clamp( 2132 project_unit_size_to_pixel(scatterplot.lineWidthScale * attributes.instanceLineWidths, scatterplot.lineWidthUnits), 2133 scatterplot.lineWidthMinPixels, scatterplot.lineWidthMaxPixels 2134 ); 2135 2136 // outer radius needs to offset by half stroke width 2137 varyings.outerRadiusPixels += scatterplot.stroked * lineWidthPixels / 2.0; 2138 // Expand geometry to accommodate edge smoothing 2139 let edgePadding = select( 2140 (varyings.outerRadiusPixels + SMOOTH_EDGE_RADIUS) / varyings.outerRadiusPixels, 2141 1.0, 2142 scatterplot.antialiasing != 0 2143 ); 2144 2145 // position on the containing square in [-1, 1] space 2146 varyings.unitPosition = edgePadding * attributes.positions.xy; 2147 geometry.uv = varyings.unitPosition; 2148 geometry.pickingColor = attributes.instancePickingColors; 2149 2150 varyings.innerUnitRadius = 1.0 - scatterplot.stroked * lineWidthPixels / varyings.outerRadiusPixels; 2151 2152 if (scatterplot.billboard != 0) { 2153 varyings.position = project_position_to_clipspace(attributes.instancePositions, attributes.instancePositions64Low, vec3<f32>(0.0)); // TODO , geometry.position); 2154 // DECKGL_FILTER_GL_POSITION(varyings.position, geometry); 2155 var offset = edgePadding * attributes.positions * varyings.outerRadiusPixels; 2156 offset = vec3<f32>(offset.xy + attributes.instancePixelOffset, offset.z); 2157 // DECKGL_FILTER_SIZE(offset, geometry); 2158 let clipPixels = project_pixel_size_to_clipspace(offset.xy); 2159 varyings.position = vec4<f32>(varyings.position.x + clipPixels.x, varyings.position.y + clipPixels.y, varyings.position.z, varyings.position.w); 2160 } else { 2161 var offset = edgePadding * attributes.positions * project_pixel_size_float(varyings.outerRadiusPixels); 2162 offset = vec3<f32>(offset.xy + project_pixel_size_vec2(attributes.instancePixelOffset), offset.z); 2163 // DECKGL_FILTER_SIZE(offset, geometry); 2164 varyings.position = project_position_to_clipspace(attributes.instancePositions, attributes.instancePositions64Low, offset); // TODO , geometry.position); 2165 // DECKGL_FILTER_GL_POSITION(varyings.position, geometry); 2166 } 2167 2168 // Apply opacity to instance color, or return instance picking color 2169 varyings.vFillColor = vec4<f32>(attributes.instanceFillColors.rgb, attributes.instanceFillColors.a * layer.opacity); 2170 // DECKGL_FILTER_COLOR(varyings.vFillColor, geometry); 2171 varyings.vLineColor = vec4<f32>(attributes.instanceLineColors.rgb, attributes.instanceLineColors.a * layer.opacity); 2172 // DECKGL_FILTER_COLOR(varyings.vLineColor, geometry); 2173 varyings.pickingColor = attributes.instancePickingColors; 2174 2175 return varyings; 2176} 2177 2178@fragment 2179fn fragmentMain(varyings: Varyings) -> @location(0) vec4<f32> { 2180 // var geometry: Geometry; 2181 // geometry.uv = unitPosition; 2182 2183 let distToCenter = length(varyings.unitPosition) * varyings.outerRadiusPixels; 2184 let inCircle = select( 2185 smoothedge(distToCenter, varyings.outerRadiusPixels), 2186 step(distToCenter, varyings.outerRadiusPixels), 2187 scatterplot.antialiasing != 0 2188 ); 2189 2190 if (inCircle == 0.0) { 2191 discard; 2192 } 2193 2194 var fragColor: vec4<f32>; 2195 2196 if (scatterplot.stroked != 0) { 2197 let isLine = select( 2198 smoothedge(varyings.innerUnitRadius * varyings.outerRadiusPixels, distToCenter), 2199 step(varyings.innerUnitRadius * varyings.outerRadiusPixels, distToCenter), 2200 scatterplot.antialiasing != 0 2201 ); 2202 2203 if (scatterplot.filled != 0) { 2204 fragColor = mix(varyings.vFillColor, varyings.vLineColor, isLine); 2205 } else { 2206 if (isLine == 0.0) { 2207 discard; 2208 } 2209 fragColor = vec4<f32>(varyings.vLineColor.rgb, varyings.vLineColor.a * isLine); 2210 } 2211 } else if (scatterplot.filled == 0) { 2212 discard; 2213 } else { 2214 fragColor = varyings.vFillColor; 2215 } 2216 2217 fragColor.a *= inCircle; 2218 2219 if (picking.isActive > 0.5) { 2220 if (!picking_isColorValid(varyings.pickingColor)) { 2221 discard; 2222 } 2223 return vec4<f32>(varyings.pickingColor, 1.0); 2224 } 2225 2226 if (picking.isHighlightActive > 0.5) { 2227 let highlightedObjectColor = picking_normalizeColor(picking.highlightedObjectColor); 2228 if (picking_isColorZero(abs(varyings.pickingColor - highlightedObjectColor))) { 2229 let highLightAlpha = picking.highlightColor.a; 2230 let blendedAlpha = highLightAlpha + fragColor.a * (1.0 - highLightAlpha); 2231 if (blendedAlpha > 0.0) { 2232 let highLightRatio = highLightAlpha / blendedAlpha; 2233 fragColor = vec4<f32>( 2234 mix(fragColor.rgb, picking.highlightColor.rgb, highLightRatio), 2235 blendedAlpha 2236 ); 2237 } else { 2238 fragColor = vec4<f32>(fragColor.rgb, 0.0); 2239 } 2240 } 2241 } 2242 2243 // Apply premultiplied alpha as required by transparent canvas 2244 fragColor = deckgl_premultiplied_alpha(fragColor); 2245 2246 return fragColor; 2247 // return vec4<f32>(0, 0, 1, 1); 2248} 2249`,Z=[0,0,0,255],Q={radiusUnits:"meters",radiusScale:{type:"number",min:0,value:1},radiusMinPixels:{type:"number",min:0,value:0},radiusMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},lineWidthUnits:"meters",lineWidthScale:{type:"number",min:0,value:1},lineWidthMinPixels:{type:"number",min:0,value:0},lineWidthMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},stroked:!1,filled:!0,billboard:!1,antialiasing:!0,getPosition:{type:"accessor",value:e=>e.position},getRadius:{type:"accessor",value:1},getFillColor:{type:"accessor",value:Z},getLineColor:{type:"accessor",value:Z},getLineWidth:{type:"accessor",value:1},getPixelOffset:{type:"accessor",value:[0,0]},strokeWidth:{deprecatedFor:"getLineWidth"},outline:{deprecatedFor:"stroked"},getColor:{deprecatedFor:["getFillColor","getLineColor"]}};class J extends o.A{getShaders(){return super.getShaders({vs:K,fs:X,source:Y,modules:[m,_,x,q]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceRadius:{size:1,transition:!0,accessor:"getRadius",defaultValue:1},instanceFillColors:{size:this.props.colorFormat.length,transition:!0,type:"unorm8",accessor:"getFillColor",defaultValue:[0,0,0,255]},instanceLineColors:{size:this.props.colorFormat.length,transition:!0,type:"unorm8",accessor:"getLineColor",defaultValue:[0,0,0,255]},instanceLineWidths:{size:1,transition:!0,accessor:"getLineWidth",defaultValue:1},instancePixelOffset:{size:2,transition:!0,accessor:"getPixelOffset"}})}updateState(e){super.updateState(e),e.changeFlags.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll())}draw({uniforms:e}){let{radiusUnits:t,radiusScale:i,radiusMinPixels:r,radiusMaxPixels:s,stroked:n,filled:o,billboard:a,antialiasing:l,lineWidthUnits:h,lineWidthScale:u,lineWidthMinPixels:c,lineWidthMaxPixels:d}=this.props,f={stroked:n,filled:o,billboard:a,antialiasing:l,radiusUnits:w.p5[t],radiusScale:i,radiusMinPixels:r,radiusMaxPixels:s,lineWidthUnits:w.p5[h],lineWidthScale:u,lineWidthMinPixels:c,lineWidthMaxPixels:d},p=this.state.model;p.shaderInputs.setProps({scatterplot:f}),p.draw(this.context.renderPass)}
2249_getModel(){return new P.K(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new A({topology:"triangle-strip",attributes:{positions:{size:3,value:new Float32Array([-1,-1,0,1,-1,0,-1,1,0,1,1,0])}}}),isInstanced:!0})}}J.defaultProps=Q,J.layerName="ScatterplotLayer";let ee=`\ 2250layout(std140) uniform sdfUniforms { 2251 float gamma; 2252 bool enabled; 2253 float buffer; 2254 float outlineBuffer; 2255 vec4 outlineColor; 2256} sdf; 2257`,et={name:"sdf",vs:ee,fs:ee,uniformTypes:{gamma:"f32",enabled:"f32",buffer:"f32",outlineBuffer:"f32",outlineColor:"vec4<f32>"}},ei={none:0,start:1,center:2,end:3},er={name:"text",vs:`\ 2258layout(std140) uniform textUniforms { 2259 highp vec2 cutoffPixels; 2260 highp ivec2 align; 2261 highp float fontSize; 2262 bool flipY; 2263} text; 2264 2265#define ALIGN_MODE_START ${ei.start} 2266#define ALIGN_MODE_CENTER ${ei.center} 2267#define ALIGN_MODE_END ${ei.end} 2268`,getUniforms:({contentCutoffPixels:e=[0,0],contentAlignHorizontal:t="none",contentAlignVertical:i="none",fontSize:r,viewport:s})=>({cutoffPixels:e,align:[ei[t],ei[i]],fontSize:r,flipY:s?.flipY??!1}),uniformTypes:{cutoffPixels:"vec2<f32>",align:"vec2<i32>",fontSize:"f32",flipY:"f32"}},es=`\ 2269#version 300 es 2270#define SHADER_NAME multi-icon-layer-vertex-shader 2271in vec2 positions; 2272in vec3 instancePositions; 2273in vec3 instancePositions64Low; 2274in float instanceSizes; 2275in float instanceAngles; 2276in vec4 instanceColors; 2277in vec3 instancePickingColors; 2278in vec4 instanceIconFrames; 2279in float instanceColorModes; 2280in vec2 instanceOffsets; 2281in vec2 instancePixelOffset; 2282in vec4 instanceClipRect; 2283out float vColorMode; 2284out vec4 vColor; 2285out vec2 vTextureCoords; 2286out vec2 uv; 2287vec2 rotate_by_angle(vec2 vertex, float angle) { 2288float angle_radian = angle * PI / 180.0; 2289float cos_angle = cos(angle_radian); 2290float sin_angle = sin(angle_radian); 2291mat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle); 2292return rotationMatrix * vertex; 2293} 2294float getPixelOffsetFromAlignment(float anchor, float extent, float clipStart, float clipEnd, int mode) { 2295if (clipEnd < clipStart) return 0.0; 2296if (mode == ALIGN_MODE_START) { 2297return max(- (anchor + clipStart), 0.0); 2298} 2299if (mode == ALIGN_MODE_CENTER) { 2300float _min = max(0., anchor + clipStart); 2301float _max = min(extent, anchor + clipEnd); 2302return _min < _max ? (_min + _max) / 2.0 - anchor : 0.0; 2303} 2304if (mode == ALIGN_MODE_END) { 2305return min(extent - (anchor + clipEnd), 0.); 2306} 2307return 0.0; 2308} 2309void main(void) { 2310geometry.worldPosition = instancePositions; 2311geometry.uv = positions; 2312geometry.pickingColor = instancePickingColors; 2313uv = positions; 2314vec2 iconSize = instanceIconFrames.zw; 2315float sizePixels = clamp( 2316project_size_to_pixel(instanceSizes * icon.sizeScale, icon.sizeUnits),
2317icon.sizeMinPixels, icon.sizeMaxPixels 2318); 2319float instanceScale = sizePixels / text.fontSize; 2320vec2 pixelOffset = positions / 2.0 * iconSize + instanceOffsets; 2321pixelOffset = rotate_by_angle(pixelOffset, instanceAngles) * instanceScale; 2322pixelOffset += instancePixelOffset; 2323pixelOffset.y *= -1.0; 2324vec2 anchorPosScreen; 2325if (icon.billboard) { 2326gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position); 2327anchorPosScreen = gl_Position.xy / gl_Position.w; 2328DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 2329vec3 offset = vec3(pixelOffset, 0.0); 2330DECKGL_FILTER_SIZE(offset, geometry); 2331gl_Position.xy += project_pixel_size_to_clipspace(offset.xy); 2332} else { 2333vec3 offset_common = vec3(project_pixel_size(pixelOffset), 0.0); 2334if (text.flipY) { 2335offset_common.y *= -1.; 2336} 2337DECKGL_FILTER_SIZE(offset_common, geometry); 2338vec4 anchorPos = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0)); 2339anchorPosScreen = anchorPos.xy / anchorPos.w; 2340gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset_common, geometry.position); 2341DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 2342} 2343anchorPosScreen = vec2(anchorPosScreen.x + 1.0, 1.0 - anchorPosScreen.y) / 2.0 * project.viewportSize / project.devicePixelRatio; 2344vec2 xy = project_size_to_pixel(instanceClipRect.xy); 2345vec2 wh = project_size_to_pixel(instanceClipRect.zw); 2346if (text.flipY) { 2347xy.y = -xy.y - wh.y; 2348} 2349if (text.align.x > 0 || text.align.y > 0) { 2350vec2 viewportPixels = project.viewportSize / project.devicePixelRatio; 2351vec2 scrollPixels = vec2( 2352getPixelOffsetFromAlignment(anchorPosScreen.x, viewportPixels.x, xy.x, xy.x + wh.x, text.align.x), 2353-getPixelOffsetFromAlignment(anchorPosScreen.y, viewportPixels.y, -xy.y - wh.y, -xy.y, text.align.y) 2354); 2355pixelOffset += scrollPixels; 2356gl_Position.xy += project_pixel_size_to_clipspace(scrollPixels); 2357} 2358if (instanceClipRect.z >= 0.) { 2359if (pixelOffset.x < xy.x || pixelOffset.x > xy.x + wh.x) { 2360gl_Position = vec4(0.0); 2361} 2362else if (text.cutoffPixels.x > 0.) { 2363float vpWidth = project.viewportSize.x / project.devicePixelRatio; 2364float l = max(anchorPosScreen.x + xy.x, 0.0); 2365float r = min(anchorPosScreen.x + xy.x + wh.x, vpWidth); 2366if (r - l < text.cutoffPixels.x) { 2367gl_Position = vec4(0.0); 2368} 2369} 2370} 2371if (instanceClipRect.w >= 0.) { 2372if (pixelOffset.y < xy.y || pixelOffset.y > xy.y + wh.y) { 2373gl_Position = vec4(0.0); 2374} 2375else if (text.cutoffPixels.y > 0.) { 2376float vpHeight = project.viewportSize.y / project.devicePixelRatio; 2377float t = max(anchorPosScreen.y - xy.y - wh.y, 0.0); 2378float b = min(anchorPosScreen.y - xy.y, vpHeight); 2379if (b - t < text.cutoffPixels.y) { 2380gl_Position = vec4(0.0); 2381} 2382} 2383} 2384vTextureCoords = mix( 2385instanceIconFrames.xy, 2386instanceIconFrames.xy + iconSize, 2387(positions.xy + 1.0) / 2.0 2388) / icon.iconsTextureDim; 2389vColor = instanceColors; 2390DECKGL_FILTER_COLOR(vColor, geometry); 2391vColorMode = instanceColorModes; 2392} 2393`,en=`\ 2394#version 300 es 2395#define SHADER_NAME multi-icon-layer-fragment-shader 2396precision highp float; 2397uniform sampler2D iconsTexture; 2398in vec4 vColor; 2399in vec2 vTextureCoords; 2400in vec2 uv; 2401out vec4 fragColor; 2402void main(void) { 2403geometry.uv = uv; 2404if (!bool(picking.isActive)) { 2405float alpha = texture(iconsTexture, vTextureCoords).a; 2406vec4 color = vColor; 2407if (sdf.enabled) { 2408float distance = alpha; 2409alpha = smoothstep(sdf.buffer - sdf.gamma, sdf.buffer + sdf.gamma, distance); 2410if (sdf.outlineBuffer > 0.0) { 2411float inFill = alpha; 2412float inBorder = smoothstep(sdf.outlineBuffer - sdf.gamma, sdf.outlineBuffer + sdf.gamma, distance); 2413color = mix(sdf.outlineColor, vColor, inFill); 2414alpha = inBorder; 2415} 2416} 2417float a = alpha * color.a; 2418if (a < icon.alphaCutoff) { 2419discard; 2420} 2421fragColor = vec4(color.rgb, a * layer.opacity); 2422} 2423DECKGL_FILTER_COLOR(fragColor, geometry); 2424} 2425`;class eo extends ${getShaders(){let e=super.getShaders();return{...e,modules:[...e.modules,er,et],vs:es,fs:en}}initializeState(){super.initializeState();let e=this.getAttributeManager();e.attributes.instanceIconDefs.settings.update=this.calculateInstanceIconDefs,e.addInstanced({instancePickingColors:{type:"uint8",size:4,accessor:(e,{index:t,target:i})=>this.encodePickingColor(t,i)},instanceClipRect:{size:4,accessor:"getContentBox",defaultValue:[0,0,-1,-1]}})}updateState(e){super.updateState(e);let{props:t,oldProps:i,changeFlags:r}=e,{outlineColor:s}=t;if(r.updateTriggersChanged&&(r.updateTriggersChanged.getIcon||r.updateTriggersChanged.getIconOffsets)&&this.getAttributeManager().invalidate("instanceIconDefs"),s!==i.outlineColor){let e=[s[0]/255,s[1]/255,s[2]/255,(s[3]??255)/255];this.setState({outlineColor:e})}!t.sdf&&t.outlineWidth&&S.A.warn(`${this.id}: fontSettings.sdf is required to render outline`)()}draw(e){let{sdf:t,smoothing:i,fontSize:r,outlineWidth:s,contentCutoffPixels:n,contentAlignHorizontal:o,contentAlignVertical:a}=this.props,{outlineColor:l}=this.state,h=s?Math.max(i,.75*(1-s)):-1,u=this.state.model,c={buffer:.75,outlineBuffer:h,gamma:i,enabled:!!t,outlineColor:l},d={contentCutoffPixels:n,contentAlignHorizontal:o,contentAlignVertical:a,fontSize:r,viewport:this.context.viewport};if(u.shaderInputs.setProps({sdf:c,text:d}),super.draw(e),t&&s){let{iconManager:e}=this.state;
2425e.getTexture()&&(u.shaderInputs.setProps({sdf:{...c,outlineBuffer:.75}}),u.draw(this.context.renderPass))}}calculateInstanceIconDefs(e,{startRow:t,endRow:i}){let{data:r,getIcon:s,getIconOffsets:n}=this.props,o=e.getVertexOffset(t),a=e.value,{iterable:l,objectInfo:h}=(0,N.X)(r,t,i);for(let t of l){h.index++;let i=s(t,h),r=n(t,h);if(i){let t=0;for(let s of Array.from(i)){let i=super.getInstanceIconDef(s);i[0]=r[2*t],i[1]+=r[2*t+1],i[6]=1,a.set(i,o),o+=e.size,t++}}}}}eo.defaultProps={getIconOffsets:{type:"accessor",value:e=>e.offsets},getContentBox:{type:"accessor",value:[0,0,-1,-1]},fontSize:1,alphaCutoff:.001,smoothing:.1,outlineWidth:0,outlineColor:{type:"color",value:[0,0,0,255]},contentCutoffPixels:{type:"array",value:[0,0]},contentAlignHorizontal:"none",contentAlignVertical:"none"},eo.layerName="MultiIconLayer";let ea=new Float64Array(256);for(let e=0;e<256;e++){let t=.5-Math.pow(e/255,1/2.2);ea[e]=t*Math.abs(t)}ea[255]=-1e20;class el{constructor({fontSize:e=24,buffer:t=3,radius:i=8,cutoff:r=.25,fontFamily:s="sans-serif",fontWeight:n="normal",fontStyle:o="normal",lang:a=null}={}){this.buffer=t,this.radius=i,this.cutoff=r,this.lang=a;let l=this.size=e+4*t,h=this._createCanvas(l),u=this.ctx=h.getContext("2d",{willReadFrequently:!0});u.font=`${o} ${n} ${e}px ${s}`,u.textBaseline="alphabetic",u.textAlign="left",u.fillStyle="black",this.gridOuter=new Float64Array(l*l),this.gridInner=new Float64Array(l*l),this.f=new Float64Array(l),this.z=new Float64Array(l+1),this.v=new Uint16Array(l)}_createCanvas(e){if("undefined"!=typeof OffscreenCanvas)return new OffscreenCanvas(e,e);let t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){let{width:t,actualBoundingBoxAscent:i,actualBoundingBoxDescent:r,actualBoundingBoxLeft:s,actualBoundingBoxRight:n}=this.ctx.measureText(e),o=Math.ceil(i),a=Math.floor(s),l=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(n)-a)),h=Math.max(0,Math.min(this.size-this.buffer,o+Math.ceil(r))),u=l+2*this.buffer,c=h+2*this.buffer,d=Math.max(u*c,0),f=new Uint8ClampedArray(d),p={data:f,width:u,height:c,glyphWidth:l,glyphHeight:h,glyphTop:o,glyphLeft:a,glyphAdvance:t};if(0===l||0===h)return p;let{ctx:g,buffer:m,gridInner:_,gridOuter:y}=this;this.lang&&(g.lang=this.lang),g.clearRect(m,m,l,h),g.fillText(e,m-a,m+o);let v=g.getImageData(m,m,l,h);y.fill(1e20,0,d),_.fill(0,0,d);let b=3;for(let e=0;e<h;e++){let t=(e+m)*u+m;for(let e=0;e<l;e++,b+=4,t++){let e=v.data[b];if(0===e)continue;let i=ea[e];y[t]=Math.max(0,i),_[t]=Math.max(0,-i)}}eh(y,0,0,u,c,u,this.f,this.v,this.z),eh(_,m,m,l,h,u,this.f,this.v,this.z);let E=255/this.radius,x=255*(1-this.cutoff);for(let e=0;e<d;e++){let t=Math.sqrt(y[e])-Math.sqrt(_[e]);f[e]=Math.round(x-E*t)}return p}}function eh(e,t,i,r,s,n,o,a,l){for(let h=t;h<t+r;h++)eu(e,i*n+h,n,s,o,a,l);for(let h=i;h<i+s;h++)eu(e,h*n+t,1,r,o,a,l)}function eu(e,t,i,r,s,n,o){n[0]=0,o[0]=-1e20,o[1]=1e20,s[0]=e[t];for(let a=1,l=0,h=0;a<r;a++){s[a]=e[t+a*i];let r=a*a;do{let e=n[l];h=(s[a]-s[e]+r-e*e)/(a-e)/2}while(h<=o[l]&&--l>-1);n[++l]=a,o[l]=h,o[l+1]=1e20}for(let a=0,l=0;a<r;a++){for(;o[l+1]<a;)l++;let r=n[l],h=a-r;e[t+a*i]=s[r]+h*h}}let ec=[];function ed(e,t,i,r){let s=0;for(let n=t;n<i;n++){let t=e[n];s+=r[t]?.advance||0}return s}function ef(e,t,i,r,s,n){let o=t,a=0;for(let l=t;l<i;l++){let t=ed(e,l,l+1,s);a+t>r&&(o<l&&n.push(l),o=l,a=0),a+=t}return a}class ep{constructor(e=5){this._cache={},this._order=[],this.limit=e}get(e){let t=this._cache[e];return t&&(this._deleteOrder(e),this._appendOrder(e)),t}set(e,t){this._cache[e]?this.delete(e):Object.keys(this._cache).length===this.limit&&this.delete(this._order[0]),this._cache[e]=t,this._appendOrder(e)}delete(e){this._cache[e]&&(delete this._cache[e],this._deleteOrder(e))}_deleteOrder(e){let t=this._order.indexOf(e);t>=0&&this._order.splice(t,1)}_appendOrder(e){this._order.push(e)}}let eg={fontFamily:"Monaco, monospace",fontWeight:"normal",characterSet:function(){let e=[];for(let t=32;t<128;t++)e.push(String.fromCharCode(t));return e}(),fontSize:64,buffer:4,sdf:!1,cutoff:.25,radius:12,smoothing:.1},em=new ep(3);function e_(e,t,i,r){e.font=`${r} ${i}px ${t}`,e.fillStyle="#000",e.textBaseline="alphabetic",e.textAlign="left"}class ey{constructor(){this.props={...eg}}get atlas(){return this._atlas}get mapping(){return this._atlas&&this._atlas.mapping}setProps(e={}){Object.assign(this.props,e),e._getFontRenderer&&(this._getFontRenderer=e._getFontRenderer),this._key=this._getKey();let t=function(e,t){let i;i=new Set("string"==typeof t?Array.from(t):t);let r=em.get(e);if(!r)return i;for(let e in r.mapping)i.has(e)&&i.delete(e);return i}(this._key,this.props.characterSet),i=em.get(this._key);if(i&&0===t.size){this._atlas!==i&&(this._atlas=i);return}let r=this._generateFontAtlas(t,i);this._atlas=r,em.set(this._key,r)}_generateFontAtlas(e,t){let i,{fontFamily:r,fontWeight:s,fontSize:n,buffer:o,sdf:a,radius:l,cutoff:h}=this.props,u=t&&t.data;u||((u=document.createElement("canvas")).width=1024);let c=u.getContext("2d",{willReadFrequently:!0});e_(c,r,n,s);let d=e=>(function(e,t,i){if(void 0===i){let i=e.measureText("A");return i.fontBoundingBoxAscent?{advance:0,width:0,ascent:Math.ceil(i.fontBoundingBoxAscent),descent:Math.ceil(i.fontBoundingBoxDescent)}:{advance:0,width:0,ascent:.9*t,descent:.3*t}}let r=e.measureText(i);return r.actualBoundingBoxAscent?{advance:r.width,width:Math.ceil(r.actualBoundingBoxRight-r.actualBoundingBoxLeft),ascent:Math.ceil(r.actualBoundingBoxAscent),descent:Math.ceil(r.actualBoundingBoxDescent)}:{advance:r.width,width:r.width,ascent:.9*t,descent:.3*t}}
2425)(c,n,e);this._getFontRenderer?i=this._getFontRenderer(this.props):a&&(i={measure:d,draw:function({fontSize:e,buffer:t,radius:i,cutoff:r,fontFamily:s,fontWeight:n}){let o=new el({fontSize:e,buffer:t,radius:i,cutoff:r,fontFamily:s,fontWeight:`${n}`});return e=>{let{data:i,width:r,height:s}=o.draw(e),n=new ImageData(r,s);for(let e=0;e<i.length;e++)n.data[4*e+3]=i[e];return{data:n,left:t,top:t}}}(this.props)});let{mapping:f,canvasHeight:p,xOffset:g,yOffsetMin:m,yOffsetMax:_}=function({characterSet:e,measureText:t,buffer:i,maxCanvasWidth:r,mapping:s={},xOffset:n=0,yOffsetMin:o=0,yOffsetMax:a=0}){let l=n,h=o,u=a;for(let n of e)if(!s[n]){let{advance:e,width:o,ascent:a,descent:c}=t(n),d=a+c;l+o+2*i>r&&(l=0,h=u),s[n]={x:l+i,y:h+i,width:o,height:d,advance:e,anchorX:o/2,anchorY:a},l+=o+2*i,u=Math.max(u,h+d+2*i)}return{mapping:s,xOffset:l,yOffsetMin:h,yOffsetMax:u,canvasHeight:Math.pow(2,Math.ceil(Math.log2(u)))}}({measureText:e=>i?i.measure(e):d(e),buffer:o,characterSet:e,maxCanvasWidth:1024,...t&&{mapping:t.mapping,xOffset:t.xOffset,yOffsetMin:t.yOffsetMin,yOffsetMax:t.yOffsetMax}});if(u.height!==p){let e=u.height>0?c.getImageData(0,0,u.width,u.height):null;u.height=p,e&&c.putImageData(e,0,0)}if(e_(c,r,n,s),i)for(let t of e){let e=f[t],{data:r,left:s=0,top:n=0}
2425=i.draw(t),o=e.x-s,a=e.y-n,l=Math.max(0,Math.round(o)),h=Math.max(0,Math.round(a)),d=Math.min(r.width,u.width-l),p=Math.min(r.height,u.height-h);c.putImageData(r,l,h,0,0,d,p),e.x+=l-o,e.y+=h-a}else for(let t of e){let e=f[t];c.fillText(t,e.x,e.y+e.anchorY)}let y=i?i.measure():d();return{baselineOffset:(y.ascent-y.descent)/2,xOffset:g,yOffsetMin:m,yOffsetMax:_,mapping:f,data:u,width:u.width,height:u.height}}_getKey(){let{fontFamily:e,fontWeight:t,fontSize:i,buffer:r,sdf:s,radius:n,cutoff:o}=this.props;return s?`${e} ${t} ${i} ${r} ${n} ${o}`:`${e} ${t} ${i} ${r}`}}let ev=`\ 2426layout(std140) uniform textBackgroundUniforms { 2427 bool billboard; 2428 float sizeScale; 2429 float sizeMinPixels; 2430 float sizeMaxPixels; 2431 vec4 borderRadius; 2432 vec4 padding; 2433 highp int sizeUnits; 2434 bool stroked; 2435} textBackground; 2436`,eb={name:"textBackground",vs:ev,fs:ev,uniformTypes:{billboard:"f32",sizeScale:"f32",sizeMinPixels:"f32",sizeMaxPixels:"f32",borderRadius:"vec4<f32>",padding:"vec4<f32>",sizeUnits:"i32",stroked:"f32"}},eE=`\ 2437#version 300 es 2438#define SHADER_NAME text-background-layer-vertex-shader 2439in vec2 positions; 2440in vec3 instancePositions; 2441in vec3 instancePositions64Low; 2442in vec4 instanceRects; 2443in vec4 instanceClipRect; 2444in float instanceSizes; 2445in float instanceAngles; 2446in vec2 instancePixelOffsets; 2447in float instanceLineWidths; 2448in vec4 instanceFillColors; 2449in vec4 instanceLineColors; 2450in vec3 instancePickingColors; 2451out vec4 vFillColor; 2452out vec4 vLineColor; 2453out float vLineWidth; 2454out vec2 uv; 2455out vec2 dimensions; 2456vec2 rotate_by_angle(vec2 vertex, float angle) { 2457float angle_radian = radians(angle); 2458float cos_angle = cos(angle_radian); 2459float sin_angle = sin(angle_radian); 2460mat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle); 2461return rotationMatrix * vertex; 2462} 2463void main(void) { 2464geometry.worldPosition = instancePositions; 2465geometry.uv = positions; 2466geometry.pickingColor = instancePickingColors; 2467uv = positions; 2468vLineWidth = instanceLineWidths; 2469float sizePixels = clamp( 2470project_size_to_pixel(instanceSizes * textBackground.sizeScale, textBackground.sizeUnits), 2471textBackground.sizeMinPixels, textBackground.sizeMaxPixels 2472); 2473float instanceScale = sizePixels / text.fontSize; 2474dimensions = instanceRects.zw * instanceScale + textBackground.padding.xy + textBackground.padding.zw; 2475vec2 pixelOffset = (positions * instanceRects.zw + instanceRects.xy) * instanceScale + mix(-textBackground.padding.xy, textBackground.padding.zw, positions); 2476pixelOffset = rotate_by_angle(pixelOffset, instanceAngles); 2477pixelOffset += instancePixelOffsets; 2478pixelOffset.y *= -1.0; 2479vec2 xy = project_size_to_pixel(instanceClipRect.xy); 2480vec2 wh = project_size_to_pixel(instanceClipRect.zw); 2481if (text.flipY) { 2482xy.y = -xy.y - wh.y; 2483} 2484if (instanceClipRect.z >= 0.0) { 2485dimensions.x = wh.x; 2486pixelOffset.x = xy.x + uv.x * wh.x + mix(-textBackground.padding.x, textBackground.padding.z, uv.x); 2487} 2488if (instanceClipRect.w >= 0.0) { 2489dimensions.y = wh.y; 2490pixelOffset.y = xy.y + uv.y * wh.y + mix(-textBackground.padding.y, textBackground.padding.w, uv.y); 2491} 2492if (textBackground.billboard) { 2493gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position); 2494DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 2495vec3 offset = vec3(pixelOffset, 0.0); 2496DECKGL_FILTER_SIZE(offset, geometry); 2497gl_Position.xy += project_pixel_size_to_clipspace(offset.xy); 2498} else { 2499vec3 offset_common = vec3(project_pixel_size(pixelOffset), 0.0); 2500if (text.flipY) { 2501offset_common.y *= -1.; 2502} 2503DECKGL_FILTER_SIZE(offset_common, geometry); 2504gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset_common, geometry.position); 2505DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 2506} 2507vFillColor = vec4(instanceFillColors.rgb, instanceFillColors.a * layer.opacity); 2508DECKGL_FILTER_COLOR(vFillColor, geometry); 2509vLineColor = vec4(instanceLineColors.rgb, instanceLineColors.a * layer.opacity); 2510DECKGL_FILTER_COLOR(vLineColor, geometry); 2511} 2512`,ex=`\ 2513#version 300 es 2514#define SHADER_NAME text-background-layer-fragment-shader 2515precision highp float; 2516in vec4 vFillColor; 2517in vec4 vLineColor; 2518in float vLineWidth; 2519in vec2 uv; 2520in vec2 dimensions; 2521out vec4 fragColor;
2522float round_rect(vec2 p, vec2 size, vec4 radii) { 2523vec2 pixelPositionCB = (p - 0.5) * size; 2524vec2 sizeCB = size * 0.5; 2525float maxBorderRadius = min(size.x, size.y) * 0.5; 2526vec4 borderRadius = vec4(min(radii, maxBorderRadius)); 2527borderRadius.xy = 2528(pixelPositionCB.x > 0.0) ? borderRadius.xy : borderRadius.zw; 2529borderRadius.x = (pixelPositionCB.y > 0.0) ? borderRadius.x : borderRadius.y; 2530vec2 q = abs(pixelPositionCB) - sizeCB + borderRadius.x; 2531return -(min(max(q.x, q.y), 0.0) + length(max(q, 0.0)) - borderRadius.x); 2532} 2533float rect(vec2 p, vec2 size) { 2534vec2 pixelPosition = p * size; 2535return min(min(pixelPosition.x, size.x - pixelPosition.x), 2536min(pixelPosition.y, size.y - pixelPosition.y)); 2537} 2538vec4 get_stroked_fragColor(float dist) { 2539float isBorder = smoothedge(dist, vLineWidth); 2540return mix(vFillColor, vLineColor, isBorder); 2541} 2542void main(void) { 2543geometry.uv = uv; 2544if (textBackground.borderRadius != vec4(0.0)) { 2545float distToEdge = round_rect(uv, dimensions, textBackground.borderRadius); 2546float shapeAlpha = smoothedge(-distToEdge, 0.0); 2547if (shapeAlpha == 0.0) { 2548discard; 2549} 2550if (textBackground.stroked) { 2551fragColor = get_stroked_fragColor(distToEdge); 2552} else { 2553fragColor = vFillColor; 2554} 2555fragColor.a *= shapeAlpha; 2556} else { 2557if (textBackground.stroked) { 2558float distToEdge = rect(uv, dimensions); 2559fragColor = get_stroked_fragColor(distToEdge); 2560} else { 2561fragColor = vFillColor; 2562} 2563} 2564DECKGL_FILTER_COLOR(fragColor, geometry); 2565} 2566`,ew={billboard:!0,sizeScale:1,sizeUnits:"pixels",sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,fontSize:1,borderRadius:{type:"object",value:0},padding:{type:"array",value:[0,0,0,0]},getPosition:{type:"accessor",value:e=>e.position},getSize:{type:"accessor",value:1},getAngle:{type:"accessor",value:0},getPixelOffset:{type:"accessor",value:[0,0]},getBoundingRect:{type:"accessor",value:[0,0,0,0]},getClipRect:{type:"accessor",value:[0,0,-1,-1]},getFillColor:{type:"accessor",value:[0,0,0,255]},getLineColor:{type:"accessor",value:[0,0,0,255]},getLineWidth:{type:"accessor",value:1}};class eS extends o.A{getShaders(){return super.getShaders({vs:eE,fs:ex,modules:[m,x,eb,er]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceSizes:{size:1,transition:!0,accessor:"getSize",defaultValue:1},instanceAngles:{size:1,transition:!0,accessor:"getAngle"},instanceRects:{size:4,accessor:"getBoundingRect"},instanceClipRect:{size:4,accessor:"getClipRect",defaultValue:[0,0,-1,-1]},instancePixelOffsets:{size:2,transition:!0,accessor:"getPixelOffset"},instanceFillColors:{size:4,transition:!0,type:"unorm8",accessor:"getFillColor",defaultValue:[0,0,0,255]},instanceLineColors:{size:4,transition:!0,type:"unorm8",accessor:"getLineColor",defaultValue:[0,0,0,255]},instanceLineWidths:{size:1,transition:!0,accessor:"getLineWidth",defaultValue:1}})}updateState(e){super.updateState(e);let{changeFlags:t}=e;t.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll())}draw({uniforms:e}){let{billboard:t,sizeScale:i,sizeUnits:r,sizeMinPixels:s,sizeMaxPixels:n,getLineWidth:o,fontSize:a}=this.props,{padding:l,borderRadius:h}=this.props;l.length<4&&(l=[l[0],l[1],l[0],l[1]]),Array.isArray(h)||(h=[h,h,h,h]);let u=this.state.model,c={billboard:t,stroked:!!o,borderRadius:h,padding:l,sizeUnits:w.p5[r],sizeScale:i,sizeMinPixels:s,sizeMaxPixels:n},d={fontSize:a,viewport:this.context.viewport};u.shaderInputs.setProps({textBackground:c,text:d}),u.draw(this.context.renderPass)}_getModel(){return new P.K(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new A({topology:"triangle-strip",vertexCount:4,attributes:{positions:{size:2,value:new Float32Array([0,0,1,0,0,1,1,1])}}}),isInstanced:!0})}}eS.defaultProps=ew,eS.layerName="TextBackgroundLayer";let eP={start:1,middle:0,end:-1},eT={top:1,center:0,bottom:-1},eA=[0,0,0,255],eM={billboard:!0,sizeScale:1,sizeUnits:"pixels",sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,background:!1,getBackgroun
2566dColor:{type:"accessor",value:[255,255,255,255]},getBorderColor:{type:"accessor",value:eA},getBorderWidth:{type:"accessor",value:0},backgroundBorderRadius:{type:"object",value:0},backgroundPadding:{type:"array",value:[0,0,0,0]},characterSet:{type:"object",value:eg.characterSet},fontFamily:eg.fontFamily,fontWeight:eg.fontWeight,lineHeight:1,outlineWidth:{type:"number",value:0,min:0},outlineColor:{type:"color",value:eA},fontSettings:{type:"object",value:{},compare:1},wordBreak:"break-word",maxWidth:{type:"number",value:-1},contentCutoffPixels:{type:"array",value:[0,0]},contentAlignHorizontal:"none",contentAlignVertical:"none",getText:{type:"accessor",value:e=>e.text},getPosition:{type:"accessor",value:e=>e.position},getColor:{type:"accessor",value:eA},getSize:{type:"accessor",value:32},getAngle:{type:"accessor",value:0},getTextAnchor:{type:"accessor",value:"middle"},getAlignmentBaseline:{type:"accessor",value:"center"},getPixelOffset:{type:"accessor",value:[0,0]},getContentBox:{type:"accessor",value:[0,0,-1,-1]},backgroundColor:{deprecatedFor:["background","getBackgroundColor"]}};class eC extends c{constructor(){super(...arguments),this.getBoundingRect=(e,t)=>{let{size:[i,r]}=this.transformParagraph(e,t),{getTextAnchor:s,getAlignmentBaseline:n}=this.props;return[(eP["function"==typeof s?s(e,t):s]-1)*i/2,(eT["function"==typeof n?n(e,t):n]-1)*r/2,i,r]},this.getIconOffsets=(e,t)=>{let{getTextAnchor:i,getAlignmentBaseline:r}=this.props,{x:s,y:n,rowWidth:o,size:[,a]}=this.transformParagraph(e,t),l=eP["function"==typeof i?i(e,t):i],h=eT["function"==typeof r?r(e,t):r],u=s.length,c=Array(2*u),d=0;for(let e=0;e<u;e++)c[d++]=(l-1)*o[e]/2+s[e],c[d++]=(h-1)*a/2+n[e];return c}}initializeState(){this.state={styleVersion:0,fontAtlasManager:new ey},this.props.maxWidth>0&&S.A.once(1,"v8.9 breaking change: TextLayer maxWidth is now relative to text size")()}updateState(e){let{props:t,oldProps:i,changeFlags:r}=e;(r.dataChanged||r.updateTriggersChanged&&(r.updateTriggersChanged.all||r.updateTriggersChanged.getText))&&this._updateText(),(this._updateFontAtlas()||t.lineHeight!==i.lineHeight||t.wordBreak!==i.wordBreak||t.maxWidth!==i.maxWidth)&&this.setState({styleVersion:this.state.styleVersion+1})}getPickingInfo({info:e}){return e.object=e.index>=0?this.props.data[e.index]:null,e}_updateFontAtlas(){let{fontSettings:e,fontFamily:t,fontWeight:i,_getFontRenderer:r}=this.props,{fontAtlasManager:s,characterSet:n}=this.state,o={...e,characterSet:n,fontFamily:t,fontWeight:i,_getFontRenderer:r};if(!s.mapping)return s.setProps(o),!0;for(let e in o)if(o[e]!==s.props[e])return s.setProps(o),!0;return!1}_updateText(){let e,{data:t,characterSet:i}=this.props,r=t.attributes?.getText,{getText:s}=this.props,n=t.startIndices,o="auto"===i&&new Set;if(r&&n){let{texts:i,characterCount:a}=function({value:e,length:t,stride:i,offset:r,startIndices:s,characterSet:n}){let o=e.BYTES_PER_ELEMENT,a=i?i/o:1,l=r?r/o:0,h=s[t]||Math.ceil((e.length-l)/a),u=n&&new Set,c=Array(t),d=e;if(a>1||l>0){d=new e.constructor(h);for(let t=0;t<h;t++)d[t]=e[t*a+l]}for(let e=0;e<t;e++){let t=s[e],i=s[e+1]||h,r=d.subarray(t,i);c[e]=String.fromCodePoint.apply(null,r),u&&r.forEach(u.add,u)}if(u)for(let e of u)n.add(String.fromCodePoint(e));return{texts:c,characterCount:h}}({...ArrayBuffer.isView(r)?{value:r}:r,length:t.length,startIndices:n,characterSet:o});e=a,s=(e,{index:t})=>i[t]}else{let{iterable:i,objectInfo:r}=(0,N.X)(t);for(let t of(n=[0],e=0,i)){r.index++;let i=Array.from(s(t,r)||"");o&&i.forEach(o.add,o),e+=i.length,n.push(e)}}this.setState({getText:s,startIndices:n,numInstances:e,characterSet:o||i})}transformParagraph(e,t){let{fontAtlasManager:i}=this.state,r=i.mapping,{baselineOffset:s}=i.atlas,{fontSize:n}=i.props,o=this.state.getText,{wordBreak:a,lineHeight:l,maxWidth:h}=this.props;return function(e,t,i,r,s,n){let o=Array.from(e),a=o.length,l=Array(a),h=Array(a),u=Array(a),c=("break-word"===r||"break-all"===r)&&isFinite(s)&&s>0,d=[0,0],f=[0,0],p=0,g=t+i/2,m=0,_=0;for(let e=0;e<=a;e++){let t=o[e];if(("\n"===t||e===a)&&(_=e),_>m){let e=c?function(e,t,i,r,s=0,n){void 0===n&&(n=e.length);let o=[];return"break-all"===t?ef(e,s,n,i,r,o):!function(e,t,i,r,s,n){let o=t,a=t,l=t,h=0;for(let u=t;u<i;u++)if(" "===e[u]?l=u+1:(" "===e[u+1]||u+1===i)&&(l=u+1),l>a){let t=ed(e,a,l,s);h+t>r&&(o<a&&(n.push(a),o=a,h=0),t>r&&(t=ef(e,a,l,r,s,n),o=n[n.length-1])),a=l,h+=t}}(e,s,n,i,r,o),o}(o,r,s,n,m,_):ec;for(let t=0;t<=e.length;t++){let r=0===t?m:e[t-1],s=t<e.length?e[t]:_;!function(e,t,i,r,s,n){let o=0,a=0;for(let s=t;s<i;s++){let t=r[e[s]];t&&(a=Math.max(a,t.height))}for(let n=t;n<i;n++){let t=e[n],i=r[t];i?(s[n]=o+i.anchorX,o+=i.advance):(S.A.warn(`Missing character: ${t} (${t.codePointAt(0)})`)(),s[n]=o,o+=32)}n[0]=o,n[1]=a}(o,r,s,n,l,f);for(let e=r;e<s;e++)h[e]=g,u[e]=f[0];p++,g+=i,d[0]=Math.max(d[0],f[0])}m=_}"\n"===t&&(l[m]=0,h[m]=0,u[m]=0,m++)}return d[1]=p*i,{x:l,y:h,rowWidth:u,size:d}}(o(e,t)||"",s,l*n,a,h*n,r)}renderLayers(){let{startIndices:e,numInstances:t,getText:i,fontAtlasManager:{atlas:r,mapping:s},styleVersion:n}=this.state,{data:o,_dataDiff:a,getPosition:l,getColor:h,getSize:u,getAngle:c,getPixelOffset:d,getBackgroun
vendor: 2,002 bytes, line 2566
2566dColor:f,getBorderColor:p,getBorderWidth:g,getContentBox:m,backgroundBorderRadius:_,backgroundPadding:y,background:v,billboard:b,fontSettings:E,outlineWidth:x,outlineColor:w,sizeScale:S,sizeUnits:P,sizeMinPixels:T,sizeMaxPixels:A,contentCutoffPixels:M,contentAlignHorizontal:C,contentAlignVertical:R,transitions:L,updateTriggers:I}=this.props,O=this.getSubLayerClass("characters",eo),N=this.getSubLayerClass("background",eS),{fontSize:F}=this.state.fontAtlasManager.props;return[v&&new N({getFillColor:f,getLineColor:p,getLineWidth:g,borderRadius:_,padding:y,getPosition:l,getSize:u,getAngle:c,getPixelOffset:d,getClipRect:m,billboard:b,sizeScale:S,sizeUnits:P,sizeMinPixels:T,sizeMaxPixels:A,fontSize:F,transitions:L&&{getPosition:L.getPosition,getAngle:L.getAngle,getSize:L.getSize,getFillColor:L.getBackgroundColor,getLineColor:L.getBorderColor,getLineWidth:L.getBorderWidth,getPixelOffset:L.getPixelOffset}},this.getSubLayerProps({id:"background",updateTriggers:{getPosition:I.getPosition,getAngle:I.getAngle,getSize:I.getSize,getFillColor:I.getBackgroundColor,getLineColor:I.getBorderColor,getLineWidth:I.getBorderWidth,getPixelOffset:I.getPixelOffset,getBoundingRect:{getText:I.getText,getTextAnchor:I.getTextAnchor,getAlignmentBaseline:I.getAlignmentBaseline,styleVersion:n}}}),{data:o.attributes&&o.attributes.background?{length:o.length,attributes:o.attributes.background}:o,_dataDiff:a,autoHighlight:!1,getBoundingRect:this.getBoundingRect}),new O({sdf:E.sdf,smoothing:Number.isFinite(E.smoothing)?E.smoothing:eg.smoothing,outlineWidth:x/(E.radius||eg.radius),outlineColor:w,iconAtlas:r,iconMapping:s,getPosition:l,getColor:h,getSize:u,getAngle:c,getPixelOffset:d,getContentBox:m,billboard:b,sizeScale:S,sizeUnits:P,sizeMinPixels:T,sizeMaxPixels:A,fontSize:F,contentCutoffPixels:M,contentAlignHorizontal:C,contentAlignVertical:R,transitions:L&&{getPosition:L.getPosition,getAngle:L.getAngle,getColor:L.getColor,getSize:L.getSize,getPixelOffset:L.getPixelOffset,getContentBox:L.getContentBox}}
2566,this.getSubLayerProps({id:"characters",updateTriggers:{all:I.getText,getPosition:I.getPosition,getAngle:I.getAngle,getColor:I.getColor,getSize:I.getSize,getPixelOffset:I.getPixelOffset,getContentBox:I.getContentBox,getIconOffsets:{getTextAnchor:I.getTextAnchor,getAlignmentBaseline:I.getAlignmentBaseline,styleVersion:n}}}),{data:o,_dataDiff:a,startIndices:e,numInstances:t,getIconOffsets:this.getIconOffsets,getIcon:i})]}static set fontAtlasCacheLimit(e){S.A.assert(Number.isFinite(e)&&e>=3,"Invalid cache limit"),em=new ep(e)}}eC.defaultProps=eM,eC.layerName="TextLayer";var eR=i(94996),eL=i(63344),eI=i(69804);class eO{constructor(e){this.indexStarts=[0],this.vertexStarts=[0],this.vertexCount=0,this.instanceCount=0;let{attributes:t={}}=e;this.typedArrayManager=eR.A,this.attributes={},this._attributeDefs=t,this.opts=e,this.updateGeometry(e)}updateGeometry(e){Object.assign(this.opts,e);let{data:t,buffers:i={},getGeometry:r,geometryBuffer:s,positionFormat:n,dataChanged:o,normalize:a=!0}=this.opts;if(this.data=t,this.getGeometry=r,this.positionSize=s&&s.size||("XY"===n?2:3),this.buffers=i,this.normalize=a,s&&((0,eL.A)(t.startIndices),this.getGeometry=this.getGeometryFromBuffer(s),a||(i.vertexPositions=s)),this.geometryBuffer=i.vertexPositions,Array.isArray(o))for(let e of o)this._rebuildGeometry(e);else this._rebuildGeometry()}updatePartialGeometry({startRow:e,endRow:t}){this._rebuildGeometry({startRow:e,endRow:t})}getGeometryFromBuffer(e){let t=e.value||e;return ArrayBuffer.isView(t)?(0,N.I)(t,{size:this.positionSize,offset:e.offset,stride:e.stride,startIndices:this.data.startIndices}):null}_allocate(e,t){let{attributes:i,buffers:r,_attributeDefs:s,typedArrayManager:n}=this;for(let o in s)if(o in r)n.release(i[o]),i[o]=null;else{let r=s[o];r.copy=t,i[o]=n.allocate(i[o],e,r)}}_forEachGeometry(e,t,i){let{data:r,getGeometry:s}=this,{iterable:n,objectInfo:o}=(0,N.X)(r,t,i);for(let t of n)o.index++,e(s?s(t,o):null,o.index)}_rebuildGeometry(e){if(!this.data)return;let{indexStarts:t,vertexStarts:i,instanceCount:r}=this,{data:s,geometryBuffer:n}=this,{startRow:o=0,endRow:a=1/0}=e||{},l={};if(e||(t=[0],i=[0]),this.normalize||!n)this._forEachGeometry((e,t)=>{let r=e&&this.normalizeGeometry(e);l[t]=r,i[t+1]=i[t]+(r?this.getGeometrySize(r):0)},o,a),r=i[i.length-1];else if(r=(i=s.startIndices)[s.length]||0,ArrayBuffer.isView(n))r=r||n.length/this.positionSize;else if(n instanceof eI.h){let e=4*this.positionSize;r=r||n.byteLength/e}else if(n.buffer){let e=n.stride||4*this.positionSize;r=r||n.buffer.byteLength/e}else if(n.value){let e=n.value,t=n.stride/e.BYTES_PER_ELEMENT||this.positionSize;r=r||e.length/t}this._allocate(r,!!e),this.indexStarts=t,this.vertexStarts=i,this.instanceCount=r;let h={};this._forEachGeometry((e,s)=>{let n=l[s]||e;h.vertexStart=i[s],h.indexStart=t[s],h.geometrySize=(s<i.length-1?i[s+1]:r)-i[s],h.geometryIndex=s,this.updateGeometryAttributes(n,h)},o,a),this.vertexCount=t[t.length-1]}}let eN={CLOCKWISE:1,COUNTER_CLOCKWISE:-1};function eF(e,t,i={}){return function(e,t={}){return Math.sign(function(e,t={}){let{start:i=0,end:r=e.length,plane:s="xy"}=t,n=t.size||2,o=0,a=eD[s[0]],l=eD[s[1]];for(let t=i,s=r-n;t<r;t+=n)o+=(e[t+a]-e[s+a])*(e[t+l]+e[s+l]),s=t;return o/2}(e,t))}(e,i)!==t&&(function(e,t){let{start:i=0,end:r=e.length,size:s=2}=t,n=(r-i)/s,o=Math.floor(n/2);for(let t=0;t<o;++t){let r=i+t*s,o=i+(n-1-t)*s;for(let t=0;t<s;++t){let i=e[r+t];e[r+t]=e[o+t],e[o+t]=i}}}(e,i),!0)}let eD={x:0,y:1,z:2};function eB(e,t,i,r,s=[]){let n,o;if(8&i)n=(r[3]-e[1])/(t[1]-e[1]),o=3;else if(4&i)n=(r[1]-e[1])/(t[1]-e[1]),o=1;else if(2&i)n=(r[2]-e[0])/(t[0]-e[0]),o=2;else{if(!(1&i))return null;n=(r[0]-e[0])/(t[0]-e[0]),o=0}for(let i=0;i<e.length;i++)s[i]=(1&o)===i?r[o]:n*(t[i]-e[i])+e[i];return s}function eG(e,t){let i=0;return e[0]<t[0]?i|=1:e[0]>t[2]&&(i|=2),e[1]<t[1]?i|=4:e[1]>t[3]&&(i|=8),i}function ek(e,t){let i=t.length,r=e.length;if(r>0){let s=!0;for(let n=0;n<i;n++)if(e[r-i+n]!==t[n]){s=!1;break}if(s)return!1}for(let s=0;s<i;s++)e[r+s]=t[s];return!0}function eU(e,t){let i=t.length;for(let r=0;r<i;r++)e[r]=t[r]}function ez(e,t,i,r,s=[]){let n=r+t*i;for(let t=0;t<i;t++)s[t]=e[n+t];return s}function ej(e,t){let i,r,{size:s=2,broken:n=!1,gridResolution:o=10,gridOffset:a=[0,0],startIndex:l=0,endIndex:h=e.length}=t||{},u=(h-l)/s,c=[],d=[c],f=ez(e,0,s,l),p=e$(f,o,a,[]),g=[];ek(c,f);for(let t=1;t<u;t++){for(r=eG(i=ez(e,t,s,l,i),p);r;){var m,_,y;eB(f,i,r,p,g);let e=eG(g,p);e&&(eB(f,g,e,p,g),r=e),ek(c,g),eU(f,g),m=p,_=o,8&(y=r)?(m[1]+=_,m[3]+=_):4&y?(m[1]-=_,m[3]-=_):2&y?(m[0]+=_,m[2]+=_):1&y&&(m[0]-=_,m[2]-=_),n&&c.length>s&&(c=[],d.push(c),ek(c,f)),r=eG(i,p)}ek(c,i),eU(f,i)}return n?d:d[0]}function eV(e,t=null,i){if(!e.length)return[];let{size:r=2,gridResolution:s=10,gridOffset:n=[0,0],edgeTypes:o=!1}=i||{},a=[],l=[{pos:e,types:o?Array(e.length/r).fill(1):null,holes:t||[]}],h=[[],[]],u=[];for(;l.length;){let{pos:e,types:t,holes:i}=l.shift();(function(e,t,i,r){let s=1/0,n=-1/0,o=1/0,a=-1/0;for(let r=0;r<i;r+=t){let t=e[r],i=e[r+1];s=t<s?t:s,n=t>n?t:n,o=i<o?i:o,a=i>a?i:a}r[0][0]=s,r[0][1]=o,r[1][0]=n,r[1][1]=a})(e,r,i[0]||e.length,h),u=e$(h[0],s,n,u);let c=eG(h[1],u);if(c){let s=eW(e,t,r,0,i[0]||e.length,u,c),n={pos:s[0].pos,types:s[0].types,holes:[]},a={pos:s[1].pos,types:s[1].types,holes:[]};l.push(n,a);for(let l=0;l<i.length;l++)(s=eW(e,t,r,i[l],i[l+1]||e.length,u,c))[0]&&(n.holes.push(n.pos.length),n.pos=eH(n.pos,s[0].pos),o&&(n.types=eH(n.types,s[0].types))),s[1]&&(a.holes.push(a.pos.length),a.pos=eH(a.pos,s[1].pos),o&&(a.types=eH(a.types,s[1].types)))}else{let r={positions:e};o&&(r.edgeTypes=t),i.length&&(r.holeIndices=i),a.push(r)}}return a}function eW(e,t,i,r,s,n,o){let a,l,h,u=(s-r)/i,c=[],d=[],f=[],p=[],g=[],m=ez(e,u-1,i,r),_=Math.sign(8&o?m[1]-n[3]:m[0]-n[2]),y=t&&t[u-1],v=0,b=0;for(let s=0;s<u;s++)a=ez(e,s,i,r,a),l=Math.sign(8&o?a[1]-n[3]:a[0]-n[2]),h=t&&t[r/i+s],l&&_&&_!==l&&(eB(m,a,o,n,g),ek(c,g)&&f.push(y),ek(d,g)&&p.push(y)),l<=0?(ek(c,a)&&f.push(h),v-=l):f.length&&(f[f.length-1]=0),l>=0?(ek(d,a)&&p.push(h),b+=l):p.length&&(p[p.length-1]=0),eU(m,a),_=l,y=h;return[v?{pos:c,types:t&&f}:null,b?{pos:d,types:t&&p}:null]}function e$(e,t,i,r){let s=Math.floor((e[0]-i[0])/t)*t+i[0],n=Math.floor((e[1]-i[1])/t)*t+i[1];return r[0]=s,r[1]=n,r[2]=s+t,r[3]=n+t,r}function eH(e,t){for(let i=0;i<t.length;i++)e.push(t[i]);return e}function eq(e,t,i,r){let s,n=e[0];for(let o=i;o<r;o+=t){let t=(s=e[o])-n;(t>180||t<-180)&&(s-=360*Math.round(t/360)),e[o]=n=s}}function eK(e,t){let i,r=e.length/t;for(let s=0;s<r&&((i=e[s*t])+180)%360==0;s++);let s=-(360*Math.round(i/360));if(0!==s)for(let i=0;i<r;i++)e[i*t]+=s}class eX extends eO{constructor(e){super({...e,attributes:{positions:{size:3,padding:18,initialize:!0,type:e.fp64?Float64Array:Float32Array},segmentTypes:{size:1,type:Uint8ClampedArray}}})}get(e){return this.attributes[e]}getGeometryFromBuffer(e){return this.normalize?super.getGeometryFromBuffer(e):null}normalizeGeometry(e){return this.normalize?function(e,t,i,r){let s;if(Array.isArray(e[0])){s=Array(e.length*t);for(let i=0;i<e.length;i++)for(let r=0;r<t;r++)s[i*t+r]=e[i][r]||0}else s=e;return i?ej(s,{size:t,gridResolution:i}):r?function(e,t){let{size:i=2,startIndex:r=0,endIndex:s=e.length,normalize:n=!0}=t||{},o=e.slice(r,s);eq(o,i,0,s-r);let a=ej(o,{size:i,broken:!0,gridResolution:360,gridOffset:[-180,-180]});if(n)for(let e of a)eK(e,i);return a}(s,{size:t}):s}(e,this.positionSize,this.opts.resolution,this.opts.wrapLongitude):e}getGeometrySize(e){if(eY(e)){let t=0;for(let i of e)t+=this.getGeometrySize(i);return t}let t=this.getPathLength(e);return t<2?0:this.isClosed(e)?t<3?0:t+2:t}updateGeometryAttributes(e,t){if(0!==t.geometrySize)if(e&&eY(e))for(let i of e){let e=this.getGeometrySize(i);t.geometrySize=e,this.updateGeometryAttributes(i,t),t.vertexStart+=e}else this._updateSegmentTypes(e,t),this._updatePositions(e,t)}_updateSegmentTypes(e,t){let i=this.attributes.segmentTypes,r=!!e&&this.isClosed(e),{vertexStart:s,geometrySize:n}=t;i.fill(0,s,s+n),r?(i[s]=4,i[s+n-2]=4):(i[s]+=1,i[s+n-2]+=2),i[s+n-1]=4}_updatePositions(e,t){let{positions:i}=this.attributes;if(!i||!e)return;let{vertexStart:r,geometrySize:s}=t,n=[,,,];for(let t=r,o=0;o<s;t++,o++)this.getPointOnPath(e,o,n),i[3*t]=n[0],i[3*t+1]=n[1],i[3*t+2]=n[2]}getPathLength(e){return e.length/this.positionSize}getPointOnPath(e,t,i=[]){let{positionSize:r}=this;t*r>=e.length&&(t+=1-e.length/r);let s=t*r;return i[0]=e[s],i[1]=e[s+1],i[2]=3===r&&e[s+2]||0,i}isClosed(e){if(!this.normalize)return!!this.opts.loop;let{positionSize:t}=this,i=e.length-t;return e[0]===e[i]&&e[1]===e[i+1]&&(2===t||e[2]===e[i+2])}}function eY(e){return Array.isArray(e[0])}let eZ=`\ 2567layout(std140) uniform pathUniforms { 2568 float widthScale; 2569 float widthMinPixels; 2570 float widthMaxPixels; 2571 float jointType; 2572 float capType; 2573 float miterLimit; 2574 bool billboard; 2575 highp int widthUnits; 2576} path; 2577`,eQ={name:"path",vs:eZ,fs:eZ,uniformTypes:{widthScale:"f32",widthMinPixels:"f32",widthMaxPixels:"f32",jointType:"f32",capType:"f32",miterLimit:"f32",billboard:"f32",widthUnits:"i32"}},eJ=`\ 2578#version 300 es 2579#define SHADER_NAME path-layer-vertex-shader 2580in vec2 positions; 2581in float instanceTypes; 2582in vec3 instanceStartPositions; 2583in vec3 instanceEndPositions; 2584in vec3 instanceLeftPositions; 2585in vec3 instanceRightPositions; 2586in vec3 instanceLeftPositions64Low; 2587in vec3 instanceStartPositions64Low; 2588in vec3 instanceEndPositions64Low; 2589in vec3 instanceRightPositions64Low; 2590in float instanceStrokeWidths; 2591in vec4 instanceColors; 2592in vec3 instancePickingColors; 2593uniform float opacity; 2594out vec4 vColor; 2595out vec2 vCornerOffset; 2596out float vMiterLength; 2597out vec2 vPathPosition; 2598out float vPathLength; 2599out float vJointType; 2600const float EPSILON = 0.001; 2601const vec3 ZERO_OFFSET = vec3(0.0); 2602float flipIfTrue(bool flag) { 2603return -(float(flag) * 2. - 1.); 2604} 2605vec3 getLineJoinOffset( 2606vec3 prevPoint, vec3 currPoint, vec3 nextPoint, 2607vec2 width 2608) { 2609bool isEnd = positions.x > 0.0; 2610float sideOfPath = positions.y; 2611float isJoint = float(sideOfPath == 0.0); 2612vec3 deltaA3 = (currPoint - prevPoint); 2613vec3 deltaB3 = (nextPoint - currPoint); 2614mat3 rotationMatrix; 2615bool needsRotation = !path.billboard && project_needs_rotation(currPoint, rotationMatrix); 2616if (needsRotation) { 2617deltaA3 = deltaA3 * rotationMatrix; 2618deltaB3 = deltaB3 * rotationMatrix; 2619} 2620vec2 deltaA = deltaA3.xy / width; 2621vec2 deltaB = deltaB3.xy / width; 2622float lenA = length(deltaA); 2623float lenB = length(deltaB); 2624vec2 dirA = lenA > 0. ? normalize(deltaA) : vec2(0.0, 0.0); 2625vec2 dirB = lenB > 0. ? normalize(deltaB) : vec2(0.0, 0.0); 2626vec2 perpA = vec2(-dirA.y, dirA.x); 2627vec2 perpB = vec2(-dirB.y, dirB.x); 2628vec2 tangent = dirA + dirB; 2629tangent = length(tangent) > 0. ? normalize(tangent) : perpA; 2630vec2 miterVec = vec2(-tangent.y, tangent.x); 2631vec2 dir = isEnd ? dirA : dirB; 2632vec2 perp = isEnd ? perpA : perpB; 2633float L = isEnd ? lenA : lenB; 2634float sinHalfA = abs(dot(miterVec, perp));
2635float cosHalfA = abs(dot(dirA, miterVec)); 2636float turnDirection = flipIfTrue(dirA.x * dirB.y >= dirA.y * dirB.x); 2637float cornerPosition = sideOfPath * turnDirection; 2638float miterSize = 1.0 / max(sinHalfA, EPSILON); 2639miterSize = mix( 2640min(miterSize, max(lenA, lenB) / max(cosHalfA, EPSILON)), 2641miterSize, 2642step(0.0, cornerPosition) 2643); 2644vec2 offsetVec = mix(miterVec * miterSize, perp, step(0.5, cornerPosition)) 2645* (sideOfPath + isJoint * turnDirection); 2646bool isStartCap = lenA == 0.0 || (!isEnd && (instanceTypes == 1.0 || instanceTypes == 3.0)); 2647bool isEndCap = lenB == 0.0 || (isEnd && (instanceTypes == 2.0 || instanceTypes == 3.0)); 2648bool isCap = isStartCap || isEndCap; 2649if (isCap) { 2650offsetVec = mix(perp * sideOfPath, dir * path.capType * 4.0 * flipIfTrue(isStartCap), isJoint); 2651vJointType = path.capType; 2652} else { 2653vJointType = path.jointType; 2654} 2655vPathLength = L; 2656vCornerOffset = offsetVec; 2657vMiterLength = dot(vCornerOffset, miterVec * turnDirection); 2658vMiterLength = isCap ? isJoint : vMiterLength; 2659vec2 offsetFromStartOfPath = vCornerOffset + deltaA * float(isEnd); 2660vPathPosition = vec2( 2661dot(offsetFromStartOfPath, perp), 2662dot(offsetFromStartOfPath, dir) 2663); 2664geometry.uv = vPathPosition; 2665float isValid = step(instanceTypes, 3.5); 2666vec3 offset = vec3(offsetVec * width * isValid, 0.0); 2667if (needsRotation) { 2668offset = rotationMatrix * offset; 2669} 2670return offset; 2671} 2672void clipLine(inout vec4 position, vec4 refPosition) { 2673if (position.w < EPSILON) { 2674float r = (EPSILON - refPosition.w) / (position.w - refPosition.w); 2675position = refPosition + (position - refPosition) * r; 2676} 2677} 2678void main() { 2679geometry.pickingColor = instancePickingColors; 2680vColor = vec4(instanceColors.rgb, instanceColors.a * layer.opacity); 2681float isEnd = positions.x; 2682vec3 prevPosition = mix(instanceLeftPositions, instanceStartPositions, isEnd); 2683vec3 prevPosition64Low = mix(instanceLeftPositions64Low, instanceStartPositions64Low, isEnd); 2684vec3 currPosition = mix(instanceStartPositions, instanceEndPositions, isEnd); 2685vec3 currPosition64Low = mix(instanceStartPositions64Low, instanceEndPositions64Low, isEnd); 2686vec3 nextPosition = mix(instanceEndPositions, instanceRightPositions, isEnd); 2687vec3 nextPosition64Low = mix(instanceEndPositions64Low, instanceRightPositions64Low, isEnd); 2688geometry.worldPosition = currPosition; 2689vec2 widthPixels = vec2(clamp( 2690project_size_to_pixel(instanceStrokeWidths * path.widthScale, path.widthUnits), 2691path.widthMinPixels, path.widthMaxPixels) / 2.0); 2692vec3 width; 2693if (path.billboard) { 2694vec4 prevPositionScreen = project_position_to_clipspace(prevPosition, prevPosition64Low, ZERO_OFFSET); 2695vec4 currPositionScreen = project_position_to_clipspace(currPosition, currPosition64Low, ZERO_OFFSET, geometry.position); 2696vec4 nextPositionScreen = project_position_to_clipspace(nextPosition, nextPosition64Low, ZERO_OFFSET); 2697clipLine(prevPositionScreen, currPositionScreen); 2698clipLine(nextPositionScreen, currPositionScreen); 2699clipLine(currPositionScreen, mix(nextPositionScreen, prevPositionScreen, isEnd)); 2700width = vec3(widthPixels, 0.0); 2701DECKGL_FILTER_SIZE(width, geometry); 2702vec3 offset = getLineJoinOffset( 2703prevPositionScreen.xyz / prevPositionScreen.w, 2704currPositionScreen.xyz / currPositionScreen.w, 2705nextPositionScreen.xyz / nextPositionScreen.w, 2706project_pixel_size_to_clipspace(width.xy) 2707); 2708DECKGL_FILTER_GL_POSITION(currPositionScreen, geometry); 2709gl_Position = vec4(currPositionScreen.xyz + offset * currPositionScreen.w, currPositionScreen.w); 2710} else { 2711prevPosition = project_position(prevPosition, prevPosition64Low); 2712currPosition = project_position(currPosition, currPosition64Low); 2713nextPosition = project_position(nextPosition, nextPosition64Low); 2714width = vec3(project_pixel_size(widthPixels), 0.0); 2715DECKGL_FILTER_SIZE(width, geometry); 2716vec3 offset = getLineJoinOffset(prevPosition, currPosition, nextPosition, width.xy); 2717geometry.position = vec4(currPosition + offset, 1.0); 2718gl_Position = project_common_position_to_clipspace(geometry.position); 2719DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 2720} 2721DECKGL_FILTER_COLOR(vColor, geometry); 2722} 2723`,e0=`\ 2724#version 300 es 2725#define SHADER_NAME path-layer-fragment-shader 2726precision highp float; 2727in vec4 vColor; 2728in vec2 vCornerOffset; 2729in float vMiterLength; 2730in vec2 vPathPosition; 2731in float vPathLength; 2732in float vJointType; 2733out vec4 fragColor; 2734void main(void) { 2735geometry.uv = vPathPosition; 2736if (vPathPosition.y < 0.0 || vPathPosition.y > vPathLength) { 2737if (vJointType > 0.5 && length(vCornerOffset) > 1.0) { 2738discard; 2739} 2740if (vJointType < 0.5 && vMiterLength > path.miterLimit + 1.0) { 2741discard; 2742} 2743} 2744fragColor = vColor; 2745DECKGL_FILTER_COLOR(fragColor, geometry); 2746} 2747`,e1=[0,0,0,255],e3={widthUnits:"meters",widthScale:{type:"number",min:0,value:1},widthMinPixels:{type:"number",min:0,value:0},widthMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},jointRounded:!1,capRounded:!1,miterLimit:{type:"number",min:0,value:4},billboard:!1,_pathType:null,getPath:{type:"accessor",value:e=>e.path},getColor:{type:"accessor",value:e1},getWidth:{type:"accessor",value:1}
2747,rounded:{deprecatedFor:["jointRounded","capRounded"]}},e2={enter:(e,t)=>t.length?t.subarray(t.length-e.length):e};class e4 extends o.A{getShaders(){return super.getShaders({vs:eJ,fs:e0,modules:[m,x,eQ]})}get wrapLongitude(){return!1}getBounds(){return this.getAttributeManager()?.getBounds(["vertexPositions"])}initializeState(){this.getAttributeManager().addInstanced({vertexPositions:{size:3,vertexOffset:1,type:"float64",fp64:this.use64bitPositions(),transition:e2,accessor:"getPath",update:this.calculatePositions,noAlloc:!0,shaderAttributes:{instanceLeftPositions:{vertexOffset:0},instanceStartPositions:{vertexOffset:1},instanceEndPositions:{vertexOffset:2},instanceRightPositions:{vertexOffset:3}}},instanceTypes:{size:1,type:"uint8",update:this.calculateSegmentTypes,noAlloc:!0},instanceStrokeWidths:{size:1,accessor:"getWidth",transition:e2,defaultValue:1},instanceColors:{size:this.props.colorFormat.length,type:"unorm8",accessor:"getColor",transition:e2,defaultValue:e1},instancePickingColors:{size:4,type:"uint8",accessor:(e,{index:t,target:i})=>this.encodePickingColor(e&&e.__source?e.__source.index:t,i)}}),this.setState({pathTesselator:new eX({fp64:this.use64bitPositions()})})}updateState(e){super.updateState(e);let{props:t,changeFlags:i}=e,r=this.getAttributeManager();if(i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getPath)){let{pathTesselator:e}=this.state,s=t.data.attributes||{};e.updateGeometry({data:t.data,geometryBuffer:s.getPath,buffers:s,normalize:!t._pathType,loop:"loop"===t._pathType,getGeometry:t.getPath,positionFormat:t.positionFormat,wrapLongitude:t.wrapLongitude,resolution:this.context.viewport.resolution,dataChanged:i.dataChanged}),this.setState({numInstances:e.instanceCount,startIndices:e.vertexStarts}),i.dataChanged||r.invalidateAll()}i.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),r.invalidateAll())}getPickingInfo(e){let t=super.getPickingInfo(e),{index:i}=t,r=this.props.data;return r[0]&&r[0].__source&&(t.object=r.find(e=>e.__source.index===i)),t}disablePickingIndex(e){let t=this.props.data;if(t[0]&&t[0].__source)for(let i=0;i<t.length;i++)t[i].__source.index===e&&this._disablePickingIndex(i);else super.disablePickingIndex(e)}draw({uniforms:e}){let{jointRounded:t,capRounded:i,billboard:r,miterLimit:s,widthUnits:n,widthScale:o,widthMinPixels:a,widthMaxPixels:l}=this.props,h=this.state.model,u={jointType:Number(t),capType:Number(i),billboard:r,widthUnits:w.p5[n],widthScale:o,miterLimit:s,widthMinPixels:a,widthMaxPixels:l};h.shaderInputs.setProps({path:u}),h.draw(this.context.renderPass)}_getModel(){return new P.K(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new A({topology:"triangle-list",attributes:{indices:new Uint16Array([0,1,2,1,4,2,1,3,4,3,5,4]),positions:{value:new Float32Array([0,0,0,-1,0,1,1,-1,1,1,1,0]),size:2}}}),isInstanced:!0})}calculatePositions(e){let{pathTesselator:t}=this.state;e.startIndices=t.vertexStarts,e.value=t.get("positions")}calculateSegmentTypes(e){let{pathTesselator:t}=this.state;e.startIndices=t.vertexStarts,e.value=t.get("segmentTypes")}}e4.defaultProps=e3,e4.layerName="PathLayer";let e6=`\ 2748layout(std140) uniform floatColorsUniforms { 2749 float useByteColors; 2750} floatColors; 2751 2752vec3 floatColors_normalize(vec3 inputColor) { 2753 return floatColors.useByteColors > 0.5 ? inputColor / 255.0 : inputColor; 2754} 2755 2756vec4 floatColors_normalize(vec4 inputColor) { 2757 return floatColors.useByteColors > 0.5 ? inputColor / 255.0 : inputColor; 2758} 2759 2760vec4 floatColors_premultiplyAlpha(vec4 inputColor) { 2761 return vec4(inputColor.rgb * inputColor.a, inputColor.a); 2762} 2763 2764vec4 floatColors_unpremultiplyAlpha(vec4 inputColor) { 2765 return inputColor.a > 0.0 ? vec4(inputColor.rgb / inputColor.a, inputColor.a) : vec4(0.0); 2766} 2767 2768vec4 floatColors_premultiply_alpha(vec4 inputColor) { 2769 return floatColors_premultiplyAlpha(inputColor); 2770} 2771 2772vec4 floatColors_unpremultiply_alpha(vec4 inputColor) { 2773 return floatColors_unpremultiplyAlpha(inputColor); 2774} 2775`,e8={name:"floatColors",props:{},uniforms:{},vs:e6,fs:e6,source:`\ 2776struct floatColorsUniforms { 2777 useByteColors: f32 2778}; 2779 2780@group(0) @binding(auto) var<uniform>
2780 floatColors : floatColorsUniforms; 2781 2782fn floatColors_normalize(inputColor: vec3<f32>) -> vec3<f32> { 2783 return select(inputColor, inputColor / 255.0, floatColors.useByteColors > 0.5); 2784} 2785 2786fn floatColors_normalize4(inputColor: vec4<f32>) -> vec4<f32> { 2787 return select(inputColor, inputColor / 255.0, floatColors.useByteColors > 0.5); 2788} 2789 2790fn floatColors_premultiplyAlpha(inputColor: vec4<f32>) -> vec4<f32> { 2791 return vec4<f32>(inputColor.rgb * inputColor.a, inputColor.a); 2792} 2793 2794fn floatColors_unpremultiplyAlpha(inputColor: vec4<f32>) -> vec4<f32> { 2795 return select( 2796 vec4<f32>(0.0), 2797 vec4<f32>(inputColor.rgb / inputColor.a, inputColor.a), 2798 inputColor.a > 0.0 2799 ); 2800} 2801 2802fn floatColors_premultiply_alpha(inputColor: vec4<f32>) -> vec4<f32> { 2803 return floatColors_premultiplyAlpha(inputColor); 2804} 2805 2806fn floatColors_unpremultiply_alpha(inputColor: vec4<f32>) -> vec4<f32> { 2807 return floatColors_unpremultiplyAlpha(inputColor); 2808} 2809`,uniformTypes:{useByteColors:"f32"},defaultUniforms:{useByteColors:!0}};var e5=i(79904);let e7=`\ 2810precision highp int; 2811 2812// #if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX)) 2813struct AmbientLight { 2814 vec3 color; 2815}; 2816 2817struct PointLight { 2818 vec3 color; 2819 vec3 position; 2820 vec3 attenuation; // 2nd order x:Constant-y:Linear-z:Exponential 2821}; 2822 2823struct SpotLight { 2824 vec3 color; 2825 vec3 position; 2826 vec3 direction; 2827 vec3 attenuation; 2828 vec2 coneCos; 2829}; 2830 2831struct DirectionalLight { 2832 vec3 color; 2833 vec3 direction; 2834}; 2835 2836struct UniformLight { 2837 vec3 color; 2838 vec3 position; 2839 vec3 direction; 2840 vec3 attenuation; 2841 vec2 coneCos; 2842}; 2843 2844layout(std140) uniform lightingUniforms { 2845 int enabled; 2846 int directionalLightCount; 2847 int pointLightCount; 2848 int spotLightCount; 2849 vec3 ambientColor; 2850 UniformLight lights[5]; 2851} lighting; 2852 2853PointLight lighting_getPointLight(int index) { 2854 UniformLight light = lighting.lights[index]; 2855 return PointLight(light.color, light.position, light.attenuation); 2856} 2857 2858SpotLight lighting_getSpotLight(int index) { 2859 UniformLight light = lighting.lights[lighting.pointLightCount + index]; 2860 return SpotLight(light.color, light.position, light.direction, light.attenuation, light.coneCos); 2861} 2862 2863DirectionalLight lighting_getDirectionalLight(int index) { 2864 UniformLight light = 2865 lighting.lights[lighting.pointLightCount + lighting.spotLightCount + index]; 2866 return DirectionalLight(light.color, light.direction); 2867} 2868 2869float getPointLightAttenuation(PointLight pointLight, float distance) { 2870 return pointLight.attenuation.x 2871 + pointLight.attenuation.y * distance 2872 + pointLight.attenuation.z * distance * distance; 2873} 2874 2875float getSpotLightAttenuation(SpotLight spotLight, vec3 positionWorldspace) { 2876 vec3 light_direction = normalize(positionWorldspace - spotLight.position); 2877 float coneFactor = smoothstep( 2878 spotLight.coneCos.y, 2879 spotLight.coneCos.x, 2880 dot(normalize(spotLight.direction), light_direction) 2881 ); 2882 float distanceAttenuation = getPointLightAttenuation( 2883 PointLight(spotLight.color, spotLight.position, spotLight.attenuation), 2884 distance(spotLight.position, positionWorldspace) 2885 ); 2886 return distanceAttenuation / max(coneFactor, 0.0001); 2887} 2888 2889// #endif 2890`,e9=`\ 2891// #if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX)) 2892const MAX_LIGHTS: i32 = 5; 2893 2894struct AmbientLight { 2895 color: vec3<f32>, 2896}; 2897 2898struct PointLight { 2899 color: vec3<f32>, 2900 position: vec3<f32>, 2901 attenuation: vec3<f32>, // 2nd order x:Constant-y:Linear-z:Exponential 2902}; 2903 2904struct SpotLight { 2905 color: vec3<f32>, 2906 position: vec3<f32>, 2907 direction: vec3<f32>, 2908 attenuation: vec3<f32>, 2909 coneCos: vec2<f32>, 2910}; 2911 2912struct DirectionalLight { 2913 color: vec3<f32>, 2914 direction: vec3<f32>, 2915}; 2916 2917struct UniformLight { 2918 color: vec3<f32>, 2919 position: vec3<f32>, 2920 direction: vec3<f32>, 2921 attenuation: vec3<f32>, 2922 coneCos: vec2<f32>, 2923}; 2924 2925struct lightingUniforms { 2926 enabled: i32, 2927 directionalLightCount: i32, 2928 pointLightCount: i32, 2929 spotLightCount: i32, 2930 ambientColor: vec3<f32>, 2931 lights: array<UniformLight, 5>, 2932}; 2933 2934@group(2) @binding(auto) var<uniform> lighting : lightingUniforms; 2935 2936fn lighting_getPointLight(index: i32) -> PointLight { 2937 let light = lighting.lights[index]; 2938 return PointLight(light.color, light.position, light.attenuation); 2939} 2940 2941fn lighting_getSpotLight(index: i32) -> SpotLight { 2942 let light = lighting.lights[lighting.pointLightCount + index]; 2943 return SpotLight(light.color, light.position, light.direction, light.attenuation, light.coneCos); 2944} 2945 2946fn lighting_getDirectionalLight(index: i32) -> DirectionalLight { 2947 let light = lighting.lights[lighting.pointLightCount + lighting.spotLightCount + index]; 2948 return DirectionalLight(light.color, light.direction); 2949} 2950 2951fn getPointLightAttenuation(pointLight: PointLight, distance: f32) -> f32 { 2952 return pointLight.attenuation.x
2953 + pointLight.attenuation.y * distance 2954 + pointLight.attenuation.z * distance * distance; 2955} 2956 2957fn getSpotLightAttenuation(spotLight: SpotLight, positionWorldspace: vec3<f32>) -> f32 { 2958 let lightDirection = normalize(positionWorldspace - spotLight.position); 2959 let coneFactor = smoothstep( 2960 spotLight.coneCos.y, 2961 spotLight.coneCos.x, 2962 dot(normalize(spotLight.direction), lightDirection) 2963 ); 2964 let distanceAttenuation = getPointLightAttenuation( 2965 PointLight(spotLight.color, spotLight.position, spotLight.attenuation), 2966 distance(spotLight.position, positionWorldspace) 2967 ); 2968 return distanceAttenuation / max(coneFactor, 0.0001); 2969} 2970`,te={props:{},uniforms:{},name:"lighting",defines:{},uniformTypes:{enabled:"i32",directionalLightCount:"i32",pointLightCount:"i32",spotLightCount:"i32",ambientColor:"vec3<f32>",lights:[{color:"vec3<f32>",position:"vec3<f32>",direction:"vec3<f32>",attenuation:"vec3<f32>",coneCos:"vec2<f32>"},5]},defaultUniforms:ti(),bindingLayout:[{name:"lighting",group:2}],firstBindingSlot:0,source:e9,vs:e7,fs:e7,getUniforms:function(e,t={}){if(!(e=e?{...e}:e))return ti();e.lights&&(e={...e,...function(e){let t={pointLights:[],spotLights:[],directionalLights:[]};for(let i of e||[])switch(i.type){case"ambient":t.ambientLight=i;break;case"directional":t.directionalLights?.push(i);break;case"point":t.pointLights?.push(i);break;case"spot":t.spotLights?.push(i)}return t}(e.lights),lights:void 0});let{useByteColors:i,ambientLight:r,pointLights:s,spotLights:n,directionalLights:o}=e||{};if(!(r||s&&s.length>0||n&&n.length>0||o&&o.length>0))return{...ti(),enabled:0};let a={...ti(),...function({useByteColors:e,ambientLight:t,pointLights:i=[],spotLights:r=[],directionalLights:s=[]}){let n=tr(),o=0,a=0,l=0,h=0;for(let t of i){if(o>=5)break;n[o]={...n[o],color:tt(t,e),position:t.position,attenuation:t.attenuation||[1,0,0]},o++,a++}for(let t of r){var u;if(o>=5)break;n[o]={...n[o],color:tt(t,e),position:t.position,direction:t.direction,attenuation:t.attenuation||[1,0,0],coneCos:[Math.cos((u=t).innerConeAngle??0),Math.cos(u.outerConeAngle??Math.PI/4)]},o++,l++}for(let t of s){if(o>=5)break;n[o]={...n[o],color:tt(t,e),direction:t.direction},o++,h++}return i.length+r.length+s.length>5&&e5.R.warn("MAX_LIGHTS exceeded, truncating to 5")(),{ambientColor:tt(t,e),directionalLightCount:h,pointLightCount:a,spotLightCount:l,lights:n}}({useByteColors:i,ambientLight:r,pointLights:s,spotLights:n,directionalLights:o})};return void 0!==e.enabled&&(a.enabled=+!!e.enabled),a}};function tt(e={},t){let{color:i=[0,0,0],intensity:r=1}=e;return v(i,y(t,!0)).map(e=>e*r)}function ti(){return{enabled:1,directionalLightCount:0,pointLightCount:0,spotLightCount:0,ambientColor:[.1,.1,.1],lights:tr()}}function tr(){return Array.from({length:5},()=>({color:[1,1,1],position:[1,1,2],direction:[1,1,1],attenuation:[1,0,0],coneCos:[1,0]}))}let ts=`\ 2971layout(std140) uniform phongMaterialUniforms { 2972 uniform bool unlit; 2973 uniform float ambient; 2974 uniform float diffuse; 2975 uniform float shininess; 2976 uniform vec3 specularColor; 2977} material; 2978`,tn=`\ 2979layout(std140) uniform phongMaterialUniforms { 2980 uniform bool unlit; 2981 uniform float ambient; 2982 uniform float diffuse; 2983 uniform float shininess; 2984 uniform vec3 specularColor; 2985} material; 2986 2987vec3 lighting_getLightColor(vec3 surfaceColor, vec3 light_direction, vec3 view_direction, vec3 normal_worldspace, vec3 color) { 2988 vec3 halfway_direction = normalize(light_direction + view_direction); 2989 float lambertian = dot(light_direction, normal_worldspace); 2990 float specular = 0.0; 2991 if (lambertian > 0.0) { 2992 float specular_angle = max(dot(normal_worldspace, halfway_direction), 0.0); 2993 specular = pow(specular_angle, material.shininess); 2994 } 2995 lambertian = max(lambertian, 0.0); 2996 return (lambertian * material.diffuse * surfaceColor + specular * floatColors_normalize(material.specularColor)) * color; 2997} 2998 2999vec3 lighting_getLightColor(vec3 surfaceColor, vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) { 3000 vec3 lightColor = surfaceColor; 3001 3002 if (material.unlit) { 3003 return surfaceColor; 3004 } 3005 3006 if (lighting.enabled == 0) { 3007 return lightColor; 3008 } 3009 3010 vec3 view_direction = normalize(cameraPosition - position_worldspace); 3011 lightColor = material.ambient * surfaceColor * lighting.ambientColor; 3012 3013 for (int i = 0; i < lighting.pointLightCount; i++) { 3014 PointLight pointLight = lighting_getPointLight(i); 3015 vec3 light_position_worldspace = pointLight.position; 3016 vec3 light_direction = normalize(light_position_worldspace - position_worldspace); 3017 float light_attenuation = getPointLightAttenuation(pointLight, distance(light_position_worldspace, position_worldspace)); 3018 lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color / light_attenuation); 3019 } 3020 3021 for (int i = 0; i < lighting.spotLightCount; i++) { 3022 SpotLight spotLight = lighting_getSpotLight(i); 3023 vec3 light_position_worldspace = spotLight.position; 3024 vec3 light_direction = normalize(light_position_worldspace - position_worldspace); 3025 float light_attenuation = getSpotLightAttenuation(spotLight, position_worldspace); 3026 lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, spotLight.color / light_attenuation); 3027 } 3028 3029 for (int i = 0; i < lighting.directionalLightCount; i++) { 3030 DirectionalLight directionalLight = lighting_getDirectionalLight(i); 3031 lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color); 3032 } 3033 3034 return lightColor; 3035} 3036`,to=`\ 3037struct phongMaterialUniforms { 3038 unlit: u32, 3039 ambient: f32, 3040 diffuse: f32, 3041 shininess: f32, 3042 specularColor: vec3<f32>, 3043}; 3044 3045@group(3) @binding(auto) var<uniform> phongMaterial : phongMaterialUniforms; 3046 3047fn lighting_getLightColor(surfaceColor: vec3<f32>, light_direction: vec3<f32>, view_direction: vec3<f32>, normal_worldspace: vec3<f32>, color: vec3<f32>) -> vec3<f32> { 3048 let halfway_direction: vec3<f32> = normalize(light_direction + view_direction); 3049 var lambertian: f32 = dot(light_direction, normal_worldspace); 3050 var specular: f32 = 0.0; 3051 if (lambertian > 0.0) { 3052 let specular_angle = max(dot(normal_worldspace, halfway_direction), 0.0); 3053 specular = pow(specular_angle, phongMaterial.shininess); 3054 } 3055 lambertian = max(lambertian, 0.0); 3056 return ( 3057 lambertian * phongMaterial.diffuse * surfaceColor + 3058 specular * floatColors_normalize(phongMaterial.specularColor) 3059 ) * color; 3060} 3061 3062fn lighting_getLightColor2(surfaceColor: vec3<f32>, cameraPosition: vec3<f32>, position_worldspace: vec3<f32>, normal_worldspace: vec3<f32>) -> vec3<f32> { 3063 var lightColor: vec3<f32> = surfaceColor; 3064 3065 if (phongMaterial.unlit != 0u) { 3066 return surfaceColor; 3067 } 3068 3069 if (lighting.enabled == 0) { 3070 return lightColor; 3071 } 3072 3073 let view_direction: vec3<f32> = normalize(cameraPosition - position_worldspace); 3074 lightColor = phongMaterial.ambient * surfaceColor * lighting.ambientColor; 3075 3076 for (var i: i32 = 0; i < lighting.pointLightCount; i++) { 3077 let pointLight: PointLight = lighting_getPointLight(i); 3078 let light_position_worldspace: vec3<f32> = pointLight.position; 3079 let light_direction: vec3<f32> = normalize(light_position_worldspace - position_worldspace); 3080 let light_attenuation = getPointLightAttenuation( 3081 pointLight, 3082 distance(light_position_worldspace, position_worldspace) 3083 ); 3084 lightColor += lighting_getLightColor( 3085 surfaceColor, 3086 light_direction, 3087 view_direction, 3088 normal_worldspace, 3089 pointLight.color / light_attenuation 3090 ); 3091 } 3092 3093 for (var i: i32 = 0; i < lighting.spotLightCount; i++) { 3094 let spotLight: SpotLight = lighting_getSpotLight(i); 3095 let light_position_worldspace: vec3<f32> = spotLight.position; 3096 let light_direction: vec3<f32> = normalize(light_position_worldspace - position_worldspace); 3097 let light_attenuation = getSpotLightAttenuation(spotLight, position_worldspace); 3098 lightColor += lighting_getLightColor( 3099 surfaceColor, 3100 light_direction, 3101 view_direction, 3102 normal_worldspace, 3103 spotLight.color / light_attenuation 3104 ); 3105 } 3106 3107 for (var i: i32 = 0; i < lighting.directionalLightCount; i++) { 3108 let directionalLight: DirectionalLight = lighting_getDirectionalLight(i); 3109 lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color); 3110 } 3111 3112 return lightColor; 3113} 3114 3115fn lighting_getSpecularLightColor(cameraPosition: vec3<f32>, position_worldspace: vec3<f32>, normal_worldspace: vec3<f32>) -> vec3<f32>{ 3116 var lightColor = vec3<f32>(0, 0, 0); 3117 let surfaceColor = vec3<f32>(0, 0, 0); 3118 3119 if (lighting.enabled != 0) { 3120 let view_direction = normalize(cameraPosition - position_worldspace); 3121 3122 for (var i: i32 = 0; i < lighting.pointLightCount; i++) { 3123 let pointLight: PointLight = lighting_getPointLight(i); 3124 let light_position_worldspace: vec3<f32> = pointLight.position; 3125 let light_direction: vec3<f32> = normalize(light_position_worldspace - position_worldspace); 3126 let light_attenuation = getPointLightAttenuation( 3127 pointLight, 3128 distance(light_position_worldspace, position_worldspace) 3129 ); 3130 lightColor += lighting_getLightColor( 3131 surfaceColor, 3132 light_direction, 3133 view_direction, 3134 normal_worldspace, 3135 pointLight.color / light_attenuation 3136 ); 3137 } 3138 3139 for (var i: i32 = 0; i < lighting.spotLightCount; i++) { 3140 let spotLight: SpotLight = lighting_getSpotLight(i); 3141 let light_position_worldspace: vec3<f32> = spotLight.position; 3142 let light_direction: vec3<f32> = normalize(light_position_worldspace - position_worldspace); 3143 let light_attenuation = getSpotLightAttenuation(spotLight, position_worldspace); 3144 lightColor += lighting_getLightColor( 3145 surfaceColor, 3146 light_direction, 3147 view_direction, 3148 normal_worldspace, 3149 spotLight.color / light_attenuation 3150 ); 3151 } 3152 3153 for (var i: i32 = 0; i < lighting.directionalLightCount; i++) { 3154 let directionalLight: DirectionalLight = lighting_getDirectionalLight(i); 3155 lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color); 3156 } 3157 } 3158 return lightColor; 3159} 3160`,ta={props:{},name:"gouraudMaterial",bindingLayout:[{name:"gouraudMaterial",group:3}],vs:tn.replace("phongMaterial","gouraudMaterial"),fs:ts.replace("phongMaterial","gouraudMaterial"),source:to.replaceAll("phongMaterial","gouraudMaterial"),defines:{LIGHTING_VERTEX:!0},dependencies:[te,e8],uniformTypes:{unlit:"i32",ambient:"f32",diffuse:"f32",shininess:"f32",specularColor:"vec3<f32>"},defaultUniforms:{unlit:!1,ambient:.35,diffuse:.6,shininess:32,specularColor:[38.25,38.25,38.25]},getUniforms:e=>({...ta.defaultUniforms,...e})};var tl=i(12286);let th=eN.CLOCKWISE,tu=eN.COUNTER_CLOCKWISE,tc={isClosed:!0};function td(e){return"positions"in e?e.positions:e}function tf(e){return"holeIndices"in e?e.holeIndices:null}function tp(e,t,i,r,s){let n=t,o=i.length;for(let t=0;t<o;t++)for(let s=0;s<r;s++)e[n++]=i[t][s]||0;if(!function(e){let t=e[0],i=e[e.length-1];return t[0]===i[0]&&t[1]===i[1]&&t[2]===i[2]}(i))for(let t=0;t<r;t++)e[n++]=i[0][t]||0;return tc.start=t,tc.end=n,tc.size=r,eF(e,s,tc),n}function tg(e,t,i,r,s=0,n,o){let a=(n=n||i.length)-s;if(a<=0)return t;let l=t;for(let t=0;t<a;t++)e[l++]=i[s+t];if(!function(e,t,i,r){for(let s=0;s<t;s++)if(e[i+s]!==e[r-t+s])return!1;return!0}(i,r,s,n))for(let t=0;t<r;t++)e[l++]=i[s+t];return tc.start=t,tc.end=l,tc.size=r,eF(e,o,tc),l}function tm(e,t){var i,r=e;if(!Array.isArray(r=r&&r.positions||r)&&!ArrayBuffer.isView(r))throw Error("invalid polygon");let s=[],n=[];if("positions"in e){let{positions:i,holeIndices:r}=e;if(r){let e=0;for(let o=0;o<=r.length;o++)e=tg(s,e,i,t,r[o-1],r[o],0===o?th:tu),n.push(e);return n.pop(),{positions:s,holeIndices:n}}e=i}if(!Array.isArray(e[0]))return tg(s,0,e,t,0,s.length,th),s;if(!((i=e).length>=1&&i[0].length>=2&&Number.isFinite(i[0][0]))){let i=0;for(let[r,o]of e.entries())i=tp(s,i,o,t,0===r?th:tu),n.push(i);return n.pop(),{positions:s,holeIndices:n}}return tp(s,0,e,t,th),s}function t_(e,t,i){let r=e.length/3,s=0;for(let n=0;n<r;n++){let o=(n+1)%r;s+=e[3*n+t]*e[3*o+i],s-=e[3*o+t]*e[3*n+i]}return Math.abs(s/2)}function ty(e,t,i,r){let s=e.length/3;for(let n=0;n<s;n++){let s=3*n,o=e[s+0],a=e[s+1],l=e[s+2];e[s+t]=o,e[s+i]=a,e[s+r]=l}}class tv extends eO{constructor(e){let{fp64:t,IndexType:i=Uint32Array}=e;super({...e,attributes:{positions:{size:3,type:t?Float64Array:Float32Array},vertexValid:{type:Uint16Array,size:1},indices:{type:i,size:1}}})}get(e){let{attributes:t}=this;return"indices"===e?t.indices&&t.indices.subarray(0,this.vertexCount):t[e]}updateGeometry(e){super.updateGeometry(e);let t=this.buffers.indices;if(t)this.vertexCount=(t.value||t).length;else if(this.data&&!this.getGeometry)throw Error("missing indices buffer")}normalizeGeometry(e){if(this.normalize){let t=tm(e,this.positionSize);return this.opts.resolution?eV(td(t),tf(t),{size:this.positionSize,gridResolution:this.opts.resolution,edgeTypes:!0}):this.opts.wrapLongitude?function(e,t=null,i){let{size:r=2,normalize:s=!0,edgeTypes:n=!1}=i||{};t=t||[];let o=[],a=[],l=0,h=0;for(let s=0;s<=t.length;s++){let n=t[s]||e.length,u=h,c=function(e,t,i,r){let s=-1,n=-1;for(let o=i+1;o<r;o+=t){let t=Math.abs(e[o]);t>s&&(s=t,n=o-1)}return n}(e,r,l,n);for(let t=c;t<n;t++)o[h++]=e[t];for(let t=l;t<c;t++)o[h++]=e[t];eq(o,r,u,h),function(e,t,i,r,s=85.051129){let n=e[i],o=e[r-t];if(Math.abs(n-o)>180){let r=ez(e,0,t,i);r[0]+=360*Math.round((o-n)/360),ek(e,r),r[1]=Math.sign(r[1])*s,ek(e,r),r[0]=n,ek(e,r)}}(o,r,u,h,i?.maxLatitude),l=n,a[s]=h}a.pop();let u=eV(o,a,{size:r,gridResolution:360,gridOffset:[-180,-180],edgeTypes:n});if(s)for(let e of u)eK(e.positions,r);return u}(td(t),tf(t),{size:this.positionSize,maxLatitude:86,edgeTypes:!0}):t}return e}getGeometrySize(e){if(tb(e)){let t=0;for(let i of e)t+=this.getGeometrySize(i);return t}return td(e).length/this.positionSize}getGeometryFromBuffer(e){return this.normalize||!this.buffers.indices?super.getGeometryFromBuffer(e):null}updateGeometryAttributes(e,t){if(e&&tb(e))for(let i of e){let e=this.getGeometrySize(i);t.geometrySize=e,this.updateGeometryAttributes(i,t),t.vertexStart+=e,t.indexStart=this.indexStarts[t.geometryIndex+1]}else this._updateIndices(e,t),this._updatePositions(e,t),this._updateVertexValid(e,t)}_updateIndices(e,{geometryIndex:t,vertexStart:i,indexStart:r}){let{attributes:s,indexStarts:n,typedArrayManager:o}=this,a=s.indices;if(!a||!e)return;let l=r,h=function(e,t,i,r){let s=tf(e);s&&(s=s.map(e=>e/t));let n=td(e),o=r&&3===t;if(i){let e=n.length;n=n.slice();let r=[];for(let s=0;s<e;s+=t){r[0]=n[s],r[1]=n[s+1],o&&(r[2]=n[s+2]);let e=i(r);n[s]=e[0],n[s+1]=e[1],o&&(n[s+2]=e[2])}}if(o){let e=t_(n,0,1),t=t_(n,0,2),r=t_(n,1,2);
3160if(!e&&!t&&!r)return[];e>t&&e>r||(t>r?(i||(n=n.slice()),ty(n,0,2,1)):(i||(n=n.slice()),ty(n,2,0,1)))}return tl(n,s,t)}(e,this.positionSize,this.opts.preproject,this.opts.full3d);a=o.allocate(a,r+h.length,{copy:!0});for(let e=0;e<h.length;e++)a[l++]=h[e]+i;n[t+1]=r+h.length,s.indices=a}_updatePositions(e,{vertexStart:t,geometrySize:i}){let{attributes:{positions:r},positionSize:s}=this;if(!r||!e)return;let n=td(e);for(let e=t,o=0;o<i;e++,o++){let t=n[o*s],i=n[o*s+1],a=s>2?n[o*s+2]:0;r[3*e]=t,r[3*e+1]=i,r[3*e+2]=a}}_updateVertexValid(e,{vertexStart:t,geometrySize:i}){let{positionSize:r}=this,s=this.attributes.vertexValid,n=e&&tf(e);if(e&&e.edgeTypes?s.set(e.edgeTypes,t):s.fill(1,t,t+i),n)for(let e=0;e<n.length;e++)s[t+n[e]/r-1]=0;s[t+i-1]=0}}function tb(e){return Array.isArray(e)&&e.length>0&&!Number.isFinite(e[0])}let tE=`\ 3161layout(std140) uniform solidPolygonUniforms { 3162 bool extruded; 3163 bool isWireframe; 3164 float elevationScale; 3165} solidPolygon; 3166`,tx={name:"solidPolygon",vs:tE,fs:tE,uniformTypes:{extruded:"f32",isWireframe:"f32",elevationScale:"f32"}},tw=`\ 3167in vec4 fillColors; 3168in vec4 lineColors; 3169in vec3 pickingColors; 3170out vec4 vColor; 3171struct PolygonProps { 3172vec3 positions; 3173vec3 positions64Low; 3174vec3 normal; 3175float elevations; 3176}; 3177vec3 project_offset_normal(vec3 vector) { 3178if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT || 3179project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSETS) { 3180return normalize(vector * project.commonUnitsPerWorldUnit); 3181} 3182return project_normal(vector); 3183} 3184void calculatePosition(PolygonProps props) { 3185vec3 pos = props.positions; 3186vec3 pos64Low = props.positions64Low; 3187vec3 normal = props.normal; 3188vec4 colors = solidPolygon.isWireframe ? lineColors : fillColors; 3189geometry.worldPosition = props.positions; 3190geometry.pickingColor = pickingColors; 3191if (solidPolygon.extruded) { 3192pos.z += props.elevations * solidPolygon.elevationScale; 3193} 3194gl_Position = project_position_to_clipspace(pos, pos64Low, vec3(0.), geometry.position); 3195DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 3196if (solidPolygon.extruded) { 3197#ifdef IS_SIDE_VERTEX 3198normal = project_offset_normal(normal); 3199#else 3200normal = project_normal(normal); 3201#endif 3202geometry.normal = normal; 3203vec3 lightColor = lighting_getLightColor(colors.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal); 3204vColor = vec4(lightColor, colors.a * layer.opacity); 3205} else { 3206vColor = vec4(colors.rgb, colors.a * layer.opacity); 3207} 3208DECKGL_FILTER_COLOR(vColor, geometry); 3209} 3210`,tS=`\ 3211#version 300 es 3212#define SHADER_NAME solid-polygon-layer-vertex-shader 3213in vec3 vertexPositions; 3214in vec3 vertexPositions64Low; 3215in float elevations; 3216${tw} 3217void main(void) { 3218PolygonProps props; 3219props.positions = vertexPositions; 3220props.positions64Low = vertexPositions64Low; 3221props.elevations = elevations; 3222props.normal = vec3(0.0, 0.0, 1.0); 3223calculatePosition(props); 3224} 3225`,tP=`\ 3226#version 300 es 3227#define SHADER_NAME solid-polygon-layer-vertex-shader-side 3228#define IS_SIDE_VERTEX 3229in vec2 positions; 3230in vec3 vertexPositions; 3231in vec3 nextVertexPositions; 3232in vec3 vertexPositions64Low; 3233in vec3 nextVertexPositions64Low; 3234in float elevations; 3235in float instanceVertexValid; 3236${tw} 3237void main(void) { 3238if(instanceVertexValid < 0.5){ 3239gl_Position = vec4(0.); 3240return; 3241} 3242PolygonProps props; 3243vec3 pos; 3244vec3 pos64Low; 3245vec3 nextPos; 3246vec3 nextPos64Low; 3247#if RING_WINDING_ORDER_CW == 1 3248pos = vertexPositions; 3249pos64Low = vertexPositions64Low; 3250nextPos = nextVertexPositions; 3251nextPos64Low = nextVertexPositions64Low; 3252#else 3253pos = nextVertexPositions; 3254pos64Low = nextVertexPositions64Low; 3255nextPos = vertexPositions; 3256nextPos64Low = vertexPositions64Low; 3257#endif 3258props.positions = mix(pos, nextPos, positions.x); 3259props.positions64Low = mix(pos64Low, nextPos64Low, positions.x); 3260props.normal = vec3( 3261pos.y - nextPos.y + (pos64Low.y - nextPos64Low.y), 3262nextPos.x - pos.x + (nextPos64Low.x - pos64Low.x), 32630.0); 3264props.elevations = elevations * positions.y; 3265calculatePosition(props); 3266} 3267`,tT=`\ 3268#version 300 es 3269#define SHADER_NAME solid-polygon-layer-fragment-shader 3270precision highp float; 3271in vec4 vColor; 3272out vec4 fragColor; 3273void main(void) { 3274fragColor = vColor; 3275geometry.uv = vec2(0.); 3276DECKGL_FILTER_COLOR(fragColor, geometry); 3277} 3278`,tA=[0,0,0,255],tM={enter:(e,t)=>t.length?t.subarray(t.length-e.length):e};class tC extends o.A{getShaders(e){return super.getShaders({vs:"top"===e?tS:tP,fs:tT,defines:{RING_WINDING_ORDER_CW:this.props._normalize||"CCW"!==this.props._windingOrder?1:0},modules:[m,ta,x,tx]})}get wrapLongitude(){return!1}getBounds(){return this.getAttributeManager()?.getBounds(["vertexPositions"])}initializeState(){let e,{viewport:t}=this.context,{coordinateSystem:i}=this.props,{_full3d:r}=this.props;t.isGeospatial&&"default"===i&&(i="lnglat"),"lnglat"===i&&(e=r?t.projectPosition.bind(t):t.projectFlat.bind(t)),this.setState({numInstances:0,polygonTesselator:new tv
3278({preproject:e,fp64:this.use64bitPositions(),IndexType:Uint32Array})});let s=this.getAttributeManager();s.remove(["instancePickingColors"]),s.add({indices:{size:1,isIndexed:!0,update:this.calculateIndices,noAlloc:!0},vertexPositions:{size:3,type:"float64",stepMode:"dynamic",fp64:this.use64bitPositions(),transition:tM,accessor:"getPolygon",update:this.calculatePositions,noAlloc:!0,shaderAttributes:{nextVertexPositions:{vertexOffset:1}}},instanceVertexValid:{size:1,type:"uint16",stepMode:"instance",update:this.calculateVertexValid,noAlloc:!0},elevations:{size:1,stepMode:"dynamic",transition:tM,accessor:"getElevation"},fillColors:{size:this.props.colorFormat.length,type:"unorm8",stepMode:"dynamic",transition:tM,accessor:"getFillColor",defaultValue:tA},lineColors:{size:this.props.colorFormat.length,type:"unorm8",stepMode:"dynamic",transition:tM,accessor:"getLineColor",defaultValue:tA},pickingColors:{size:4,type:"uint8",stepMode:"dynamic",accessor:(e,{index:t,target:i})=>this.encodePickingColor(e&&e.__source?e.__source.index:t,i)}})}getPickingInfo(e){let t=super.getPickingInfo(e),{index:i}=t,r=this.props.data;return r[0]&&r[0].__source&&(t.object=r.find(e=>e.__source.index===i)),t}disablePickingIndex(e){let t=this.props.data;if(t[0]&&t[0].__source)for(let i=0;i<t.length;i++)t[i].__source.index===e&&this._disablePickingIndex(i);else super.disablePickingIndex(e)}draw({uniforms:e}){let{extruded:t,filled:i,wireframe:r,elevationScale:s}=this.props,{topModel:n,sideModel:o,wireframeModel:a,polygonTesselator:l}=this.state,h={extruded:!!t,elevationScale:s,isWireframe:!1};a&&r&&(a.setInstanceCount(l.instanceCount-1),a.shaderInputs.setProps({solidPolygon:{...h,isWireframe:!0}}),a.draw(this.context.renderPass)),o&&i&&(o.setInstanceCount(l.instanceCount-1),o.shaderInputs.setProps({solidPolygon:h}),o.draw(this.context.renderPass)),n&&i&&(n.setVertexCount(l.vertexCount),n.shaderInputs.setProps({solidPolygon:h}),n.draw(this.context.renderPass))}updateState(e){super.updateState(e),this.updateGeometry(e);let{props:t,oldProps:i,changeFlags:r}=e,s=this.getAttributeManager();(r.extensionsChanged||t.filled!==i.filled||t.extruded!==i.extruded)&&(this.state.models?.forEach(e=>e.destroy()),this.setState(this._getModels()),s.invalidateAll())}updateGeometry({props:e,oldProps:t,changeFlags:i}){if(i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getPolygon)){let{polygonTesselator:t}=this.state,r=e.data.attributes||{};t.updateGeometry({data:e.data,normalize:e._normalize,geometryBuffer:r.getPolygon,buffers:r,getGeometry:e.getPolygon,positionFormat:e.positionFormat,wrapLongitude:e.wrapLongitude,resolution:this.context.viewport.resolution,fp64:this.use64bitPositions(),dataChanged:i.dataChanged,full3d:e._full3d}),this.setState({numInstances:t.instanceCount,startIndices:t.vertexStarts}),i.dataChanged||this.getAttributeManager().invalidateAll()}}_getModels(){let e,t,i,{id:r,filled:s,extruded:n}=this.props;if(s){let t=this.getShaders("top");t.defines.NON_INSTANCED_MODEL=1;let i=this.getAttributeManager().getBufferLayouts({isInstanced:!1});e=new P.K(this.context.device,{...t,id:`${r}-top`,topology:"triangle-list",bufferLayout:i,isIndexed:!0,userData:{excludeAttributes:{instanceVertexValid:!0}}})}if(n){let e=this.getAttributeManager().getBufferLayouts({isInstanced:!0});t=new P.K(this.context.device,{...this.getShaders("side"),id:`${r}-side`,bufferLayout:e,geometry:new A({topology:"triangle-strip",attributes:{positions:{size:2,value:new Float32Array([1,0,0,0,1,1,0,1])}}}),isInstanced:!0,userData:{excludeAttributes:{indices:!0}}}),i=new P.K(this.context.device,{...this.getShaders("side"),id:`${r}-wireframe`,bufferLayout:e,geometry:new A({topology:"line-strip",attributes:{positions:{size:2,value:new Float32Array([1,0,0,0,0,1,1,1])}}}),isInstanced:!0,userData:{excludeAttributes:{indices:!0}}})}return{models:[t,i,e].filter(Boolean),topModel:e,sideModel:t,wireframeModel:i}}calculateIndices(e){let{polygonTesselator:t}=this.state;e.startIndices=t.indexStarts,e.value=t.get("indices")}calculatePositions(e){let{polygonTesselator:t}=this.state;e.startIndices=t.vertexStarts,e.value=t.get("positions")}calculateVertexValid(e){e.value=this.state.polygonTesselator.get("vertexValid")}}
3278tC.defaultProps={filled:!0,extruded:!1,wireframe:!1,_normalize:!0,_windingOrder:"CW",_full3d:!1,elevationScale:{type:"number",min:0,value:1},getPolygon:{type:"accessor",value:e=>e.polygon},getElevation:{type:"accessor",value:1e3},getFillColor:{type:"accessor",value:tA},getLineColor:{type:"accessor",value:tA},material:!0},tC.layerName="SolidPolygonLayer";let tR={circle:{type:J,props:{filled:"filled",stroked:"stroked",lineWidthMaxPixels:"lineWidthMaxPixels",lineWidthMinPixels:"lineWidthMinPixels",lineWidthScale:"lineWidthScale",lineWidthUnits:"lineWidthUnits",pointRadiusMaxPixels:"radiusMaxPixels",pointRadiusMinPixels:"radiusMinPixels",pointRadiusScale:"radiusScale",pointRadiusUnits:"radiusUnits",pointAntialiasing:"antialiasing",pointBillboard:"billboard",getFillColor:"getFillColor",getLineColor:"getLineColor",getLineWidth:"getLineWidth",getPointRadius:"getRadius"}},icon:{type:$,props:{iconAtlas:"iconAtlas",iconMapping:"iconMapping",iconSizeMaxPixels:"sizeMaxPixels",iconSizeMinPixels:"sizeMinPixels",iconSizeScale:"sizeScale",iconSizeUnits:"sizeUnits",iconAlphaCutoff:"alphaCutoff",iconBillboard:"billboard",getIcon:"getIcon",getIconAngle:"getAngle",getIconColor:"getColor",getIconPixelOffset:"getPixelOffset",getIconSize:"getSize"}},text:{type:eC,props:{textSizeMaxPixels:"sizeMaxPixels",textSizeMinPi
3278xels:"sizeMinPixels",textSizeScale:"sizeScale",textSizeUnits:"sizeUnits",textBackground:"background",textBackgroundPadding:"backgroundPadding",textFontFamily:"fontFamily",textFontWeight:"fontWeight",textLineHeight:"lineHeight",textMaxWidth:"maxWidth",textOutlineColor:"outlineColor",textOutlineWidth:"outlineWidth",textWordBreak:"wordBreak",textCharacterSet:"characterSet",textBillboard:"billboard",textFontSettings:"fontSettings",getText:"getText",getTextAngle:"getAngle",getTextColor:"getColor",getTextPixelOffset:"getPixelOffset",getTextSize:"getSize",getTextAnchor:"getTextAnchor",getTextAlignmentBaseline:"getAlignmentBaseline",getTextBackgroundColor:"getBackgroundColor",getTextBorderColor:"getBorderColor",getTextBorderWidth:"getBorderWidth"}}},tL={type:e4,props:{lineWidthUnits:"widthUnits",lineWidthScale:"widthScale",lineWidthMinPixels:"widthMinPixels",lineWidthMaxPixels:"widthMaxPixels",lineJointRounded:"jointRounded",lineCapRounded:"capRounded",lineMiterLimit:"miterLimit",lineBillboard:"billboard",getLineColor:"getColor",getLineWidth:"getWidth"}},tI={type:tC,props:{extruded:"extruded",filled:"filled",wireframe:"wireframe",elevationScale:"elevationScale",material:"material",_full3d:"_full3d",getElevation:"getElevation",getFillColor:"getFillColor",getLineColor:"getLineColor"}};function tO({type:e,props:t}){let i={};for(let r in t)i[r]=e.defaultProps[t[r]];return i}function tN(e,t){let{transitions:i,updateTriggers:r}=e.props,s={updateTriggers:{},transitions:i&&{getPosition:i.geometry}};for(let n in t){let o=t[n],a=e.props[n];n.startsWith("get")&&(a=e.getSubLayerAccessor(a),s.updateTriggers[o]=r[n],i&&(s.transitions[o]=i[n])),s[o]=a}return s}function tF(e,t,i={}){let r={pointFeatures:[],lineFeatures:[],polygonFeatures:[],polygonOutlineFeatures:[]},{startRow:s=0,endRow:n=e.length}=i;for(let i=s;i<n;i++){let s=e[i],{geometry:n}=s;if(n)if("GeometryCollection"===n.type){S.A.assert(Array.isArray(n.geometries),"GeoJSON does not have geometries array");let{geometries:e}=n;for(let n=0;n<e.length;n++)tD(e[n],r,t,s,i)}else tD(n,r,t,s,i)}return r}function tD(e,t,i,r,s){let{type:n,coordinates:o}=e,{pointFeatures:a,lineFeatures:l,polygonFeatures:h,polygonOutlineFeatures:u}=t;if(!function(e,t){let i=tB[e];for(S.A.assert(i,`Unknown GeoJSON type ${e}`);t&&--i>0;)t=t[0];return t&&Number.isFinite(t[0])}(n,o))return void S.A.warn(`${n} coordinates are malformed`)();switch(n){case"Point":a.push(i({geometry:e},r,s));break;case"MultiPoint":o.forEach(e=>{a.push(i({geometry:{type:"Point",coordinates:e}},r,s))});break;case"LineString":l.push(i({geometry:e},r,s));break;case"MultiLineString":o.forEach(e=>{l.push(i({geometry:{type:"LineString",coordinates:e}},r,s))});break;case"Polygon":h.push(i({geometry:e},r,s)),o.forEach(e=>{u.push(i({geometry:{type:"LineString",coordinates:e}},r,s))});break;case"MultiPolygon":o.forEach(e=>{h.push(i({geometry:{type:"Polygon",coordinates:e}},r,s)),e.forEach(e=>{u.push(i({geometry:{type:"LineString",coordinates:e}},r,s))})})}}let tB={Point:1,MultiPoint:2,LineString:2,MultiLineString:3,Polygon:3,MultiPolygon:4};function tG(){return{points:{},lines:{},polygons:{},polygonsOutline:{}}}function tk(e){return e.geometry.coordinates}let tU=["points","linestrings","polygons"],tz={...tO(tR.circle),...tO(tR.icon),...tO(tR.text),...tO(tL),...tO(tI),stroked:!0,filled:!0,extruded:!1,wireframe:!1,_full3d:!1,iconAtlas:{type:"object",value:null},iconMapping:{type:"object",value:{}},getIcon:{type:"accessor",value:e=>e.properties.icon},getText:{type:"accessor",value:e=>e.properties.text},pointType:"circle",getRadius:{deprecatedFor:"getPointRadius"}};class tj extends c{initializeState(){this.state={layerProps:{},features:{},featuresDiff:{}}}updateState({props:e,changeFlags:t}){if(!t.dataChanged)return;let{data:i}=this.props,r=i&&"points"in i&&"polygons"in i&&"lines"in i;this.setState({binary:r}),r?this._updateStateBinary({props:e,changeFlags:t}):this._updateStateJSON({props:e,changeFlags:t})}_updateStateBinary({props:e,changeFlags:t}){let i=function(e,t){let i=tG(),{points:r,lines:s,polygons:n}=e,o=function(e,t){let i={points:null,lines:null,polygons:null};for(let r in i){let s=e[r].globalFeatureIds.value;i[r]=new Uint8ClampedArray(4*s.length);let n=[];for(let e=0;e<s.length;e++)t(s[e],n),i[r][4*e+0]=n[0],i[r][4*e+1]=n[1],i[r][4*e+2]=n[2],i[r][4*e+3]=255}return i}(e,t);i.points.data={length:r.positions.value.length/r.positions.size,attributes:{...r.attributes,getPosition:r.positions,instancePickingColors:{size:4,value:o.points}},properties:r.properties,numericProps:r.numericProps,featureIds:r.featureIds},i.lines.data={length:s.pathIndices.value.length-1,startIndices:s.pathIndices.value,attributes:{...s.attributes,getPath:s.positions,instancePickingColors:{size:4,value:o.lines}},properties:s.properties,numericProps:s.numericProps,featureIds:s.featureIds},i.lines._pathType="open";let a=Array(n.positions.value.length/n.positions.size).fill(1);for(let e of n.primitivePolygonIndices.value)a[e-1]=0;return i.polygons.data={length:n.polygonIndices.value.length-1,startIndices:n.polygonIndices.value,attributes:{...n.attributes,getPolygon:n.positions,instanceVertexValid:{size:1,value:new Uint16Array(a)},pickingColors:{size:4,value:o.polygons}},properties:n.properties,numericProps:n.numericProps,featureIds:n.featureIds},i.polygons._normalize=!1,n.triangles&&(i.polygons.data.attributes.indices=n.triangles.value),i.polygonsOutline.data={length:n.primitivePolygonIndices.value.length-1,startIndices:n.primitivePolygonIndices.value,attributes:{...n.attributes,getPath:n.positions,instancePickingColors:{size:4,value:o.polygons}},properties:n.properties,numericProps:n.numericProps,featureIds:n.featureIds},i.polygonsOutline._pathType="open",i}(e.data,this.encodePickingColor);this.setState({layerProps:i})}_updateStateJSON({props:e,changeFlags:t}){let i=function(e){if(Array.isArray(e))return e;switch(S.A.assert(e.type,"GeoJSON does not have type"),e.type){case"Feature":return[e];case"FeatureCollection":return S.A.assert(Array.isArray(e.features),"GeoJSON does not have features array"),e.features;default:return[{geometry:e}]}}(e.data),r=this.getSubLayerRow.bind(this),s={},n={};if(Array.isArray(t.dataChanged)){let e=this.state.features;for(let t in e)s[t]=e[t].slice(),n[t]=[];for(let o of t.dataChanged){let t=tF(i,r,o);
3278for(let i in e)n[i].push(d({data:s[i],getIndex:e=>e.__source.index,dataRange:o,replace:t[i]}))}}else s=tF(i,r);let o=function(e,t){let i=tG(),{pointFeatures:r,lineFeatures:s,polygonFeatures:n,polygonOutlineFeatures:o}=e;return i.points.data=r,i.points._dataDiff=t.pointFeatures&&(()=>t.pointFeatures),i.points.getPosition=tk,i.lines.data=s,i.lines._dataDiff=t.lineFeatures&&(()=>t.lineFeatures),i.lines.getPath=tk,i.polygons.data=n,i.polygons._dataDiff=t.polygonFeatures&&(()=>t.polygonFeatures),i.polygons.getPolygon=tk,i.polygonsOutline.data=o,i.polygonsOutline._dataDiff=t.polygonOutlineFeatures&&(()=>t.polygonOutlineFeatures),i.polygonsOutline.getPath=tk,i}(s,n);this.setState({features:s,featuresDiff:n,layerProps:o})}getPickingInfo(e){let t=super.getPickingInfo(e),{index:i,sourceLayer:r}=t;return t.featureType=tU.find(e=>r.id.startsWith(`${this.id}-${e}-`)),i>=0&&r.id.startsWith(`${this.id}-points-text`)&&this.state.binary&&(t.index=this.props.data.points.globalFeatureIds.value[i]),t}_updateAutoHighlight(e){let t=`${this.id}-points-`,i="points"===e.featureType;for(let r of this.getSubLayers())r.id.startsWith(t)===i&&r.updateAutoHighlight(e)}_renderPolygonLayer(){let{extruded:e,wireframe:t}=this.props,{layerProps:i}=this.state,r="polygons-fill",s=this.shouldRenderSubLayer(r,i.polygons?.data)&&this.getSubLayerClass(r,tI.type);if(s){let n=tN(this,tI.props),o=e&&t;return o||delete n.getLineColor,n.updateTriggers.lineColors=o,new s(n,this.getSubLayerProps({id:r,updateTriggers:n.updateTriggers}),i.polygons)}return null}_renderLineLayers(){let{extruded:e,stroked:t}=this.props,{layerProps:i}=this.state,r="polygons-stroke",s="linestrings",n=!e&&t&&this.shouldRenderSubLayer(r,i.polygonsOutline?.data)&&this.getSubLayerClass(r,tL.type),o=this.shouldRenderSubLayer(s,i.lines?.data)&&this.getSubLayerClass(s,tL.type);if(n||o){let e=tN(this,tL.props);return[n&&new n(e,this.getSubLayerProps({id:r,updateTriggers:e.updateTriggers}),i.polygonsOutline),o&&new o(e,this.getSubLayerProps({id:s,updateTriggers:e.updateTriggers}),i.lines)]}return null}_renderPointLayers(){let{pointType:e}=this.props,{layerProps:t,binary:i}=this.state,{highlightedObjectIndex:r}=this.props;!i&&Number.isFinite(r)&&(r=t.points.data.findIndex(e=>e.__source.index===r));let s=new Set(e.split("+")),n=[];for(let e of s){let s=`points-${e}`,o=tR[e],a=o&&this.shouldRenderSubLayer(s,t.points?.data)&&this.getSubLayerClass(s,o.type);if(a){let l=tN(this,o.props),h=t.points;if("text"===e&&i){let{instancePickingColors:e,...t}=h.data.attributes;h={...h,data:{...h.data,attributes:t}}}n.push(new a(l,this.getSubLayerProps({id:s,updateTriggers:l.updateTriggers,highlightedObjectIndex:r}),h))}}return n}renderLayers(){let{extruded:e}=this.props,t=this._renderPolygonLayer();return[!e&&t,this._renderLineLayers(),this._renderPointLayers(),e&&t]}getSubLayerAccessor(e){let{binary:t}=this.state;return t&&"function"==typeof e?(t,i)=>{let{data:r,index:s}=i;return e(function(e,t){if(!e)return null;let i="startIndices"in e?e.startIndices[t]:t,r=e.featureIds.value[i];return -1!==i?function(e,t,i){let r={properties:{...e.properties[t]}};for(let t in e.numericProps)r.properties[t]=e.numericProps[t].value[i];return r}(e,r,i):null}(r,s),i)}:super.getSubLayerAccessor(e)}}tj.layerName="GeoJsonLayer",tj.defaultProps=tz;var tV=i(47694);let tW={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0};class t${props;stats;activeRequestCount=0;requestQueue=[];requestMap=new Map;updateTimer=null;constructor(e={}){this.props={...tW,...e},this.stats=new tV.Uz({id:this.props.id}),this.stats.get("Queued Requests"),this.stats.get("Active Requests"),this.stats.get("Cancelled Requests"),this.stats.get("Queued Requests Ever"),this.stats.get("Active Requests Ever")}setProps(e){void 0!==e.throttleRequests&&(this.props.throttleRequests=e.throttleRequests),void 0!==e.maxRequests&&(this.props.maxRequests=e.maxRequests),void 0!==e.debounceTime&&(this.props.debounceTime=e.debounceTime)}scheduleRequest(e,t=()=>0){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(e))return this.requestMap.get(e);
3278let i={handle:e,priority:0,getPriority:t},r=new Promise(e=>(i.resolve=e,i));return this.requestQueue.push(i),this.requestMap.set(e,r),this._issueNewRequests(),r}_issueRequest(e){let{handle:t,resolve:i}=e,r=!1,s=()=>{r||(r=!0,this.requestMap.delete(t),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,i?i({done:s}):Promise.resolve({done:s})}_issueNewRequests(){null!==this.updateTimer&&clearTimeout(this.updateTimer),this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),this.props.debounceTime)}_issueNewRequestsAsync(){null!==this.updateTimer&&clearTimeout(this.updateTimer),this.updateTimer=null;let e=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(0!==e){this._updateAllRequests();for(let t=0;t<e;++t){let e=this.requestQueue.shift();e&&this._issueRequest(e)}}}_updateAllRequests(){let e=this.requestQueue;for(let t=0;t<e.length;++t){let i=e[t];!this._updateRequest(i)&&(e.splice(t,1),this.requestMap.delete(i.handle),t--)}e.sort((e,t)=>e.priority-t.priority)}_updateRequest(e){return e.priority=e.getPriority(e.handle),!(e.priority<0)||(e.resolve(null),!1)}}var tH=i(13541),tq=i(27366);class tK{constructor(e){this.index=e,this.isVisible=!1,this.isSelected=!1,this.parent=null,this.children=[],this.content=null,this._loader=void 0,this._abortController=null,this._loaderId=0,this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1}get bbox(){return this._bbox}set bbox(e){this._bbox||(this._bbox=e,"west"in e?this.boundingBox=[[e.west,e.south],[e.east,e.north]]:this.boundingBox=[[e.left,e.top],[e.right,e.bottom]])}get data(){return this.isLoading&&this._loader?this._loader.then(()=>this.data):this.content}get isLoaded(){return this._isLoaded&&!this._needsReload}get isLoading(){return!!this._loader&&!this._isCancelled}get needsReload(){return this._needsReload||this._isCancelled}get byteLength(){let e=this.content?this.content.byteLength:0;return Number.isFinite(e)||console.error("byteLength not defined in tile data"),e}async _loadData({getData:e,requestScheduler:t,onLoad:i,onError:r}){let s,{index:n,id:o,bbox:a,userData:l,zoom:h}=this,u=this._loaderId;this._abortController=new AbortController;let{signal:c}=this._abortController,d=await t.scheduleRequest(this,e=>e.isSelected?1:-1);if(!d){this._isCancelled=!0;return}if(this._isCancelled)return void d.done();let f=null;try{f=await e({index:n,id:o,bbox:a,userData:l,zoom:h,signal:c})}catch(e){s=e||!0}finally{d.done()}if(u===this._loaderId){if(this._loader=void 0,this.content=f,this._isCancelled&&!f){this._isLoaded=!1;return}this._isLoaded=!0,this._isCancelled=!1,s?r(s,this):i(this)}}loadData(e){return this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1,this._loaderId++,this._loader=this._loadData(e),this._loader}setNeedsReload(){this.isLoading&&(this.abort(),this._loader=void 0),this._needsReload=!0}abort(){this.isLoaded||(this._isCancelled=!0,this._abortController?.abort())}}var tX=i(10430),tY=i(6797);let tZ={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var tQ=i(3546);let tJ=new tQ.P,t0=new tQ.P;class t1{constructor(e=[0,0,0],t=[0,0,0],i){i=i||tJ.copy(e).add(t).scale(.5),this.center=new tQ.P(i),this.halfDiagonal=new tQ.P(t).subtract(this.center),this.minimum=new tQ.P(e),this.maximum=new tQ.P(t)}clone(){return new t1(this.minimum,this.maximum,this.center)}equals(e){return this===e||!!e&&this.minimum.equals(e.minimum)&&this.maximum.equals(e.maximum)}transform(e){return this.center.transformAsPoint(e),this.halfDiagonal.transform(e),this.minimum.transform(e),this.maximum.transform(e),this}intersectPlane(e){let{halfDiagonal:t}=this,i=t0.from(e.normal),r=t.x*Math.abs(i.x)+t.y*Math.abs(i.y)+t.z*Math.abs(i.z),s=this.center.dot(i)+e.distance;return s-r>0?tZ.INSIDE:s+r<0?tZ.OUTSIDE:tZ.INTERSECTING}distanceTo(e){return Math.sqrt(this.distanceSquaredTo(e))}distanceSquaredTo(e){let t,i=tJ.from(e).subtract(this.center),{halfDiagonal:r}=this,s=0;return(t=Math.abs(i.x)-r.x)>0&&(s+=t*t),(t=Math.abs(i.y)-r.y)>0&&(s+=t*t),(t=Math.abs(i.z)-r.z)>0&&(s+=t*t),s}}var t3=i(92577);let t2=new tQ.P,t4=new tQ.P;class t6{constructor(e=[0,0,0],t=0){this.radius=-0,this.center=new tQ.P,this.fromCenterRadius(e,t)}fromCenterRadius(e,t){return this.center.from(e),this.radius=t,this}fromCornerPoints(e,t){return t=t2.from(t),this.center=new tQ.P().from(e).add(t).scale(.5),this.radius=this.center.distance(t),this}equals(e){return this===e||!!e&&this.center.equals(e.center)&&this.radius===e.radius}clone(){return new t6(this.center,this.radius)}union(e){let t=this.center,i=this.radius,r=e.center,s=e.radius,n=t2.copy(r).subtract(t),o=n.magnitude();if(i>=o+s)return this.clone();if(s>=o+i)return e.clone();let a=(i+o+s)*.5;return t4.copy(n).scale((-i+a)/o).add(t),this.center.copy(t4),this.radius=a,this}expand(e){let t=t2.from(e).subtract(this.center).magnitude();return t>this.radius&&(this.radius=t),this}transform(e){this.center.transform(e);let t=t3.IL(t2,e);return this.radius=Math.max(t[0],Math.max(t[1],t[2]))*this.radius,this}distanceSquaredTo(e){let t=this.distanceTo(e);return t*t}distanceTo(e){return Math.max(0,t2.from(e).subtract(this.center).len()-this.radius)}intersectPlane(e){let t=this.center,i=this.radius,r=e.normal.dot(t)+e.distance;
3278return r<-i?tZ.OUTSIDE:r<i?tZ.INTERSECTING:tZ.INSIDE}}var t8=i(18001),t5=i(52092),t7=i(6650),t9=i(49098);function ie(e,t,i){let r=t[0],s=t[1],n=t[2],o=t[3],a=t[4],l=t[5],h=t[6],u=t[7],c=t[8],d=i[0],f=i[1],p=i[2],g=i[3],m=i[4],_=i[5],y=i[6],v=i[7],b=i[8];return e[0]=d*r+f*o+p*h,e[1]=d*s+f*a+p*u,e[2]=d*n+f*l+p*c,e[3]=g*r+m*o+_*h,e[4]=g*s+m*a+_*u,e[5]=g*n+m*l+_*c,e[6]=y*r+v*o+b*h,e[7]=y*s+v*a+b*u,e[8]=y*n+v*l+b*c,e}function it(e,t,i){let r=i[0],s=i[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=s*t[3],e[4]=s*t[4],e[5]=s*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}var ii=i(15703),ir=i(85476);!function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL1ROW0=3]="COL1ROW0",e[e.COL1ROW1=4]="COL1ROW1",e[e.COL1ROW2=5]="COL1ROW2",e[e.COL2ROW0=6]="COL2ROW0",e[e.COL2ROW1=7]="COL2ROW1",e[e.COL2ROW2=8]="COL2ROW2"}(n||(n={}));let is=Object.freeze([1,0,0,0,1,0,0,0,1]);class io extends t8.u{static get IDENTITY(){return ia||Object.freeze(ia=new io),ia}static get ZERO(){return r||Object.freeze(r=new io([0,0,0,0,0,0,0,0,0])),r}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return n}constructor(e,...t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),1==arguments.length&&Array.isArray(e)?this.copy(e):t.length>0?this.copy([e,...t]):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this.check()}identity(){return this.copy(is)}fromObject(e){return this.check()}fromQuaternion(e){return!function(e,t){let i=t[0],r=t[1],s=t[2],n=t[3],o=i+i,a=r+r,l=s+s,h=i*o,u=r*o,c=r*a,d=s*o,f=s*a,p=s*l,g=n*o,m=n*a,_=n*l;e[0]=1-c-p,e[3]=u-_,e[6]=d+m,e[1]=u+_,e[4]=1-h-p,e[7]=f-g,e[2]=d-m,e[5]=f+g,e[8]=1-h-c}(this,e),this.check()}set(e,t,i,r,s,n,o,a,l){return this[0]=e,this[1]=t,this[2]=i,this[3]=r,this[4]=s,this[5
3278]=n,this[6]=o,this[7]=a,this[8]=l,this.check()}setRowMajor(e,t,i,r,s,n,o,a,l){return this[0]=e,this[1]=r,this[2]=o,this[3]=t,this[4]=s,this[5]=a,this[6]=i,this[7]=n,this[8]=l,this.check()}determinant(){return function(e){let t=e[0],i=e[1],r=e[2],s=e[3],n=e[4],o=e[5],a=e[6],l=e[7],h=e[8];return t*(h*n-o*l)+i*(-h*s+o*a)+r*(l*s-n*a)}(this)}transpose(){return!function(e,t){if(e===t){let i=t[1],r=t[2],s=t[5];e[1]=t[3],e[2]=t[6],e[3]=i,e[5]=t[7],e[6]=r,e[7]=s}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8]}(this,this),this.check()}invert(){return!function(e,t){let i=t[0],r=t[1],s=t[2],n=t[3],o=t[4],a=t[5],l=t[6],h=t[7],u=t[8],c=u*o-a*h,d=-u*n+a*l,f=h*n-o*l,p=i*c+r*d+s*f;p&&(p=1/p,e[0]=c*p,e[1]=(-u*r+s*h)*p,e[2]=(a*r-s*o)*p,e[3]=d*p,e[4]=(u*i-s*l)*p,e[5]=(-a*i+s*n)*p,e[6]=f*p,e[7]=(-h*i+r*l)*p,e[8]=(o*i-r*n)*p)}(this,this),this.check()}multiplyLeft(e){return ie(this,e,this),this.check()}multiplyRight(e){return ie(this,this,e),this.check()}rotate(e){return!function(e,t,i){let r=t[0],s=t[1],n=t[2],o=t[3],a=t[4],l=t[5],h=t[6],u=t[7],c=t[8],d=Math.sin(i),f=Math.cos(i);e[0]=f*r+d*o,e[1]=f*s+d*a,e[2]=f*n+d*l,e[3]=f*o-d*r,e[4]=f*a-d*s,e[5]=f*l-d*n,e[6]=h,e[7]=u,e[8]=c}(this,this,e),this.check()}scale(e){return Array.isArray(e)?it(this,this,e):it(this,this,[e,e]),this.check()}translate(e){return!function(e,t,i){let r=t[0],s=t[1],n=t[2],o=t[3],a=t[4],l=t[5],h=t[6],u=t[7],c=t[8],d=i[0],f=i[1];e[0]=r,e[1]=s,e[2]=n,e[3]=o,e[4]=a,e[5]=l,e[6]=d*r+f*o+h,e[7]=d*s+f*a+u,e[8]=d*n+f*l+c}(this,this,e),this.check()}transform(e,t){let i;switch(e.length){case 2:i=(0,ii.ei)(t||[-0,-0],e,this);break;case 3:i=(0,ir.ei)(t||[-0,-0,-0],e,this);break;case 4:i=(0,t7.vE)(t||[-0,-0,-0,-0],e,this);break;default:throw Error("Illegal vector")}return(0,t5.qk)(i,e.length),i}transformVector(e,t){return this.transform(e,t)}transformVector2(e,t){return this.transform(e,t)}transformVector3(e,t){return this.transform(e,t)}}let ia=null;var il=i(29406),ih=i(35943);class iu extends ih.M{static get ZERO(){return s||Object.freeze(s=new iu(0,0,0,0)),s}constructor(e=0,t=0,i=0,r=0){super(-0,-0,-0,-0),(0,tq.cy)(e)&&1==arguments.length?this.copy(e):(tq.$W.debug&&((0,t5.ws)(e),(0,t5.ws)(t),(0,t5.ws)(i),(0,t5.ws)(r)),this[0]=e,this[1]=t,this[2]=i,this[3]=r)}set(e,t,i,r){return this[0]=e,this[1]=t,this[2]=i,this[3]=r,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this.check()}fromObject(e){return tq.$W.debug&&((0,t5.ws)(e.x),(0,t5.ws)(e.y),(0,t5.ws)(e.z),(0,t5.ws)(e.w)),this[0]=e.x,this[1]=e.y,this[2]=e.z,this[3]=e.w,this}toObject(e){return e.x=this[0],e.y=this[1],e.z=this[2],e.w=this[3],e}get ELEMENTS(){return 4}get z(){return this[2]}set z(e){this[2]=(0,t5.ws)(e)}get w(){return this[3]}set w(e){this[3]=(0,t5.ws)(e)}transform(e){return(0,ir.Z0)(this,this,e),this.check()}transformByMatrix3(e){return(0,t7.vE)(this,this,e),this.check()}transformByMatrix2(e){return(0,t7.Cg)(this,this,e),this.check()}transformByQuaternion(e){return(0,ir.gL)(this,this,e),this.check()}applyMatrix4(e){return e.transform(this,this),this}}var ic=i(74073);function id(){let e=new t9.tb(4);return t9.tb!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function ip(e,t,i){let r=Math.sin(i*=.5);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(i),e}function ig(e,t,i){let r=t[0],s=t[1],n=t[2],o=t[3],a=i[0],l=i[1],h=i[2],u=i[3];return e[0]=r*u+o*a+s*h-n*l,e[1]=s*u+o*l+n*a-r*h,e[2]=n*u+o*h+r*l-s*a,e[3]=o*u-r*a-s*l-n*h,e}ic.o8,ic.fA,ic.C,ic.hZ;let im=ic.WQ,i_=ic.hs,iy=ic.Om,iv=ic.Cc,ib=ic.Bw,iE=ic.m3,ix=ic.S8;ic.t2;let iw=function(){let e=ir.vt(),t=ir.fA(1,0,0),i=ir.fA(0,1,0);return function(r,s,n){let o=ir.Om(s,n);return o<-.999999?(ir.$A(e,t,s),1e-6>ir.Il(e)&&ir.$A(e,i,s),ir.S8(e,e),ip(r,e,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(ir.$A(e,s,n),r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=1+o,ix(r,r))}}();id(),id(),function(){let e=new t9.tb(9);t9.tb!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1}();let iS=[0,0,0,1];class iP extends il.a{constructor(e=0,t=0,i=0,r=1){super(-0,-0,-0,-0),Array.isArray(e)&&1==arguments.length?this.copy(e):this.set(e,t,i,r)}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this.check()}set(e,t,i,r){return this[0]=e,this[1]=t,this[2]=i,this[3]=r,this.check()}fromObject(e){return this[0]=e.x,this[1]=e.y,this[2]=e.z,this[3]=e.w,this.check()}fromMatrix3(e){return!function(e,t){let i,r=t[0]+t[4]+t[8];if(r>0)i=Math.sqrt(r+1),e[3]=.5*i,i=.5/i,e[0]=(t[5]-t[7])*i,e[1]=(t[6]-t[2])*i,e[2]=(t[1]-t[3])*i;else{let r=0;t[4]>t[0]&&(r=1),t[8]>t[3*r+r]&&(r=2);let s=(r+1)%3,n=(r+2)%3;i=Math.sqrt(t[3*r+r]-t[3*s+s]-t[3*n+n]+1),e[r]=.5*i,i=.5/i,e[3]=(t[3*s+n]-t[3*n+s])*i,e[s]=(t[3*s+r]+t[3*r+s])*i,e[n]=(t[3*n+r]+t[3*r+n])*i}}(this,e),this.check()}fromAxisRotation(e,t){return ip(this,e,t),this.check()}identity(){return this[0]=0,this[1]=0,this[2]=0,this[3]=1,this.check()}setAxisAngle(e,t){return this.fromAxisRotation(e,t)}get ELEMENTS(){return 4}get x(){return this[0]}set x(e){this[0]=(0,t5.ws)(e)}get y(){return this[1]}set y(e){this[1]=(0,t5.ws)(e)}get z(){return this[2]}set z(e){this[2]=(0,t5.ws)(e)}get w(){return this[3]}set w(e){this[3]=(0,t5.ws)(e)}len(){return ib(this)}lengthSquared(){return iE(this)}dot(e){return iy(this,e)}rotationTo(e,t){return iw(this,e,t),this.check()}add(e){return im(this,this,e),this.check()}calculateW(){return!function(e,t){let i=t[0],r=t[1],s=t[2];e[0]=i,e[1]=r,e[2]=s,e[3]=Math.sqrt(Math.abs(1-i*i-r*r-s*s))}(this,this),this.check()}conjugate(){return this[0]=-this[0],this[1]=-this[1],this[2]=-this[2],this[3]=this[3],this.check()}invert(){return!function(e,t){let i=t[0],r=t[1],s=t[2],n=t[3],o=i*i+r*r+s*s+n*n,a=o?1/o:0;e[0]=-i*a,e[1]=-r*a,e[2]=-s*a,e[3]=n*a}(this,this),this.check()}lerp(e,t,i){return void 0===i?this.lerp(this,e,t):(iv(this,e,t,i),this.check())}multiplyRight(e){return ig(this,this,e),this.check()}multiplyLeft(e){return ig(this,e,this),this.check()}normalize(){let e=this.len(),t=e>0?1/e:0;return this[0]=this[0]*t,this[1]=this[1]*t,this[2]=this[2]*t,this[3]=this[3]*t,0===e&&(this[3]=1),this.check()}rotateX(e){return!function(e,t,i){i*=.5;let r=t[0],s=t[1],n=t[2],o=t[3],a=Math.sin(i),l=Math.cos(i);e[0]=r*l+o*a,e[1]=s*l+n*a,e[2]=n*l-s*a,e[3]=o*l-r*a}(this,this,e),this.check()}rotateY(e){return!function(e,t,i){i*=.5;let r=t[0],s=t[1],n=t[2],o=t[3],a=Math.sin(i),l=Math.cos(i);e[0]=r*l-n*a,e[1]=s*l+o*a,e[2]=n*l+r*a,e[3]=o*l-s*a}(this,this,e),this.check()}rotateZ(e){return!function(e,t,i){i*=.5;let r=t[0],s=t[1],n=t[2],o=t[3],a=Math.sin(i),l=Math.cos(i);e[0]=r*l+s*a,e[1]=s*l-r*a,e[2]=n*l+o*a,e[3]=o*l-n*a}(this,this,e),this.check()}scale(e){return i_(this,this,e),this.check()}slerp(e,t,i){let r,s,n;switch(arguments.length){case 1:({start:r=iS,target:s,ratio:n}=e);break;case 2:r=this,s=e,n=t;break;default:r=e,s=t,n=i}return!function(e,t,i,r){let s,n,o,a,l,h=t[0],u=t[1],c=t[2],d=t[3],f=i[0],p=i[1],g=i[2],m=i[3];(s=h*f+u*p+c*g+d*m)<0&&(s=-s,f=-f,p=-p,g=-g,m=-m),1-s>t9.p8?(l=Math.sin(n=Math.acos(s)),o=Math.sin((1-r)*n)/l,a=Math.sin(r*n)/l):(o=1-r,a=r),e[0]=o*h+a*f,e[1]=o*u+a*p,e[2]=o*c+a*g,e[3]=o*d+a*m}(this,r,s,n),this.check()}
3278transformVector4(e,t=new iu){return(0,ic.gL)(t,e,this),(0,t5.qk)(t,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(e,t){return this.setAxisAngle(e,t)}premultiply(e){return this.multiplyLeft(e)}multiply(e){return this.multiplyRight(e)}}let iT=new tQ.P,iA=new tQ.P,iM=new tQ.P,iC=new tQ.P,iR=new tQ.P,iL=new tQ.P,iI=new tQ.P,iO={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8};class iN{constructor(e=[0,0,0],t=[0,0,0,0,0,0,0,0,0]){this.center=new tQ.P().from(e),this.halfAxes=new io(t)}get halfSize(){let e=this.halfAxes.getColumn(0),t=this.halfAxes.getColumn(1),i=this.halfAxes.getColumn(2);return[new tQ.P(e).len(),new tQ.P(t).len(),new tQ.P(i).len()]}get quaternion(){let e=this.halfAxes.getColumn(0),t=this.halfAxes.getColumn(1),i=this.halfAxes.getColumn(2),r=new tQ.P(e).normalize(),s=new tQ.P(t).normalize(),n=new tQ.P(i).normalize();return new iP().fromMatrix3(new io([...r,...s,...n]))}fromCenterHalfSizeQuaternion(e,t,i){let r=new iP(i),s=new io().fromQuaternion(r);return s[0]=s[0]*t[0],s[1]=s[1]*t[0],s[2]=s[2]*t[0],s[3]=s[3]*t[1],s[4]=s[4]*t[1],s[5]=s[5]*t[1],s[6]=s[6]*t[2],s[7]=s[7]*t[2],s[8]=s[8]*t[2],this.center=new tQ.P().from(e),this.halfAxes=s,this}clone(){return new iN(this.center,this.halfAxes)}equals(e){return this===e||!!e&&this.center.equals(e.center)&&this.halfAxes.equals(e.halfAxes)}getBoundingSphere(e=new t6){let t=this.halfAxes,i=t.getColumn(0,iM),r=t.getColumn(1,iC),s=t.getColumn(2,iR),n=iT.copy(i).add(r).add(s);return e.center.copy(this.center),e.radius=n.magnitude(),e}intersectPlane(e){let t=this.center,i=e.normal,r=this.halfAxes,s=i.x,n=i.y,o=i.z,a=Math.abs(s*r[iO.COLUMN0ROW0]+n*r[iO.COLUMN0ROW1]+o*r[iO.COLUMN0ROW2])+Math.abs(s*r[iO.COLUMN1ROW0]+n*r[iO.COLUMN1ROW1]+o*r[iO.COLUMN1ROW2])+Math.abs(s*r[iO.COLUMN2ROW0]+n*r[iO.COLUMN2ROW1]+o*r[iO.COLUMN2ROW2]),l=i.dot(t)+e.distance;return l<=-a?tZ.OUTSIDE:l>=a?tZ.INSIDE:tZ.INTERSECTING}distanceTo(e){return Math.sqrt(this.distanceSquaredTo(e))}distanceSquaredTo(e){let t,i=iA.from(e).subtract(this.center),r=this.halfAxes,s=r.getColumn(0,iM),n=r.getColumn(1,iC),o=r.getColumn(2,iR),a=s.magnitude(),l=n.magnitude(),h=o.magnitude();s.normalize(),n.normalize(),o.normalize();let u=0;return(t=Math.abs(i.dot(s))-a)>0&&(u+=t*t),(t=Math.abs(i.dot(n))-l)>0&&(u+=t*t),(t=Math.abs(i.dot(o))-h)>0&&(u+=t*t),u}computePlaneDistances(e,t,i=[-0,-0]){let r=1/0,s=-1/0,n=this.center,o=this.halfAxes,a=o.getColumn(0,iM),l=o.getColumn(1,iC),h=o.getColumn(2,iR),u=iL.copy(a).add(l).add(h).add(n),c=iI.copy(u).subtract(e),d=t.dot(c);return r=Math.min(d,r),s=Math.max(d,s),u.copy(n).add(a).add(l).subtract(h),c.copy(u).subtract(e),r=Math.min(d=t.dot(c),r),s=Math.max(d,s),u.copy(n).add(a).subtract(l).add(h),c.copy(u).subtract(e),r=Math.min(d=t.dot(c),r),s=Math.max(d,s),u.copy(n).add(a).subtract(l).subtract(h),c.copy(u).subtract(e),r=Math.min(d=t.dot(c),r),s=Math.max(d,s),n.copy(u).subtract(a).add(l).add(h),c.copy(u).subtract(e),r=Math.min(d=t.dot(c),r),s=Math.max(d,s),n.copy(u).subtract(a).add(l).subtract(h),c.copy(u).subtract(e),r=Math.min(d=t.dot(c),r),s=Math.max(d,s),n.copy(u).subtract(a).subtract(l).add(h),c.copy(u).subtract(e),r=Math.min(d=t.dot(c),r),s=Math.max(d,s),n.copy(u).subtract(a).subtract(l).subtract(h),c.copy(u).subtract(e),r=Math.min(d=t.dot(c),r),s=Math.max(d,s),i[0]=r,i[1]=s,i}transform(e){this.center.transformAsPoint(e);let t=this.halfAxes.getColumn(0,iM);t.transformAsPoint(e);let i=this.halfAxes.getColumn(1,iC);i.transformAsPoint(e);let r=this.halfAxes.getColumn(2,iR);return r.transformAsPoint(e),this.halfAxes=new io([...t,...i,...r]),this}getTransform(){throw Error("not implemented")}}var iF=i(37077);let iD=new tQ.P,iB=new tQ.P;class iG{constructor(e=[0,0,1],t=0){this.normal=new tQ.P,this.distance=-0,this.fromNormalDistance(e,t)}fromNormalDistance(e,t){return(0,iF.v)(Number.isFinite(t)),this.normal.from(e).normalize(),this.distance=t,this}fromPointNormal(e,t){e=iD.from(e),this.normal.from(t).normalize();let i=-this.normal.dot(e);return this.distance=i,this}fromCoefficients(e,t,i,r){return this.normal.set(e,t,i),(0,iF.v)((0,tq.aI)(this.normal.len(),1)),this.distance=r,this}clone(){return new iG(this.normal,this.distance)}equals(e){return(0,tq.aI)(this.distance,e.distance)&&(0,tq.aI)(this.normal,e.normal)}getPointDistance(e){return this.normal.dot(e)+this.distance}transform(e){let t=iB.copy(this.normal).transformAsVector(e).normalize(),i=this.normal.scale(-this.distance).transform(e);return this.fromPointNormal(i,t)}projectPointOntoPlane(e,t=[0,0,0]){let i=iD.from(e),r=this.getPointDistance(i),s=iB.copy(this.normal).scale(r);return i.subtract(s).to(t)}}let ik=[new tQ.P([1,0,0]),new tQ.P([0,1,0]),new tQ.P([0,0,1])],iU=new tQ.P,iz=ne
3278w tQ.P;class ij{constructor(e=[]){this.planes=e}fromBoundingSphere(e){this.planes.length=2*ik.length;let t=e.center,i=e.radius,r=0;for(let e of ik){let s=this.planes[r],n=this.planes[r+1];s||(s=this.planes[r]=new iG),n||(n=this.planes[r+1]=new iG);let o=iU.copy(e).scale(-i).add(t);s.fromPointNormal(o,e);let a=iU.copy(e).scale(i).add(t),l=iz.copy(e).negate();n.fromPointNormal(a,l),r+=2}return this}computeVisibility(e){let t=tZ.INSIDE;for(let i of this.planes)switch(e.intersectPlane(i)){case tZ.OUTSIDE:return tZ.OUTSIDE;case tZ.INTERSECTING:t=tZ.INTERSECTING}return t}computeVisibilityWithPlaneMask(e,t){if((0,iF.v)(Number.isFinite(t),"parentPlaneMask is required."),t===ij.MASK_OUTSIDE||t===ij.MASK_INSIDE)return t;let i=ij.MASK_INSIDE,r=this.planes;for(let s=0;s<this.planes.length;++s){let n=s<31?1<<s:0;if(s<31&&(t&n)==0)continue;let o=r[s],a=e.intersectPlane(o);if(a===tZ.OUTSIDE)return ij.MASK_OUTSIDE;a===tZ.INTERSECTING&&(i|=n)}return i}}ij.MASK_OUTSIDE=0xffffffff,ij.MASK_INSIDE=0,ij.MASK_INDETERMINATE=0x7fffffff,new tQ.P,new tQ.P,new tQ.P,new tQ.P,new tQ.P,new tQ.P,new tQ.P,new tQ.P,new tQ.P,new tQ.P,new tQ.P,new tQ.P,new tQ.P,new tQ.P,new tQ.P,new tQ.P,new tQ.P;let iV=new io,iW=new io,i$=new io,iH=new io,iq=new io,iK=[1,0,0],iX=[2,2,1],iY=new tQ.P,iZ=new tQ.P,iQ=new tQ.P,iJ=new tQ.P,i0=new tQ.P,i1=new io,i3={diagonal:new io,unitary:new io};function i2(e,t=new iN){if(!e||0===e.length)return t.halfAxes=new io([0,0,0,0,0,0,0,0,0]),t.center=new tQ.P,t;let i=e.length,r=new tQ.P(0,0,0);for(let t of e)r.add(t);let s=1/i;r.multiplyByScalar(s);let n=0,o=0,a=0,l=0,h=0,u=0;for(let t of e){let e=iY.copy(t).subtract(r);n+=e.x*e.x,o+=e.x*e.y,a+=e.x*e.z,l+=e.y*e.y,h+=e.y*e.z,u+=e.z*e.z}n*=s,o*=s,a*=s,l*=s,h*=s,u*=s,i1[0]=n,i1[1]=o,i1[2]=a,i1[3]=o,i1[4]=l,i1[5]=h,i1[6]=a,i1[7]=h,i1[8]=u;let{unitary:c}=function(e,t={}){let i=0,r=0;iW.identity(),i$.copy(e);let s=1e-20*function(e){let t=0;for(let i=0;i<9;++i){let r=e[i];t+=r*r}return Math.sqrt(t)}(i$);for(;r<10&&function(e){let t=0;for(let i=0;i<3;++i){let r=e[iV.getElementIndex(iX[i],iK[i])];t+=2*r*r}return Math.sqrt(t)}(i$)>s;)(function(e,t){let i=0,r=1;for(let t=0;t<3;++t){let s=Math.abs(e[iV.getElementIndex(iX[t],iK[t])]);s>i&&(r=t,i=s)}let s=iK[r],n=iX[r],o=1,a=0;if(Math.abs(e[iV.getElementIndex(n,s)])>1e-15){let t,i=e[iV.getElementIndex(n,n)],r=(i-e[iV.getElementIndex(s,s)])/2/e[iV.getElementIndex(n,s)];o=1/Math.sqrt(1+(t=r<0?-1/(-r+Math.sqrt(1+r*r)):1/(r+Math.sqrt(1+r*r)))*t),a=t*o}io.IDENTITY.to(t),t[iV.getElementIndex(s,s)]=t[iV.getElementIndex(n,n)]=o,t[iV.getElementIndex(n,s)]=a,t[iV.getElementIndex(s,n)]=-a})(i$,iH),iq.copy(iH).transpose(),i$.multiplyRight(iH),i$.multiplyLeft(iq),iW.multiplyRight(iH),++i>2&&(++r,i=0);return t.unitary=iW.toTarget(t.unitary),t.diagonal=i$.toTarget(t.diagonal),t}(i1,i3),d=t.halfAxes.copy(c),f=d.getColumn(0,iQ),p=d.getColumn(1,iJ),g=d.getColumn(2,i0),m=-Number.MAX_VALUE,_=-Number.MAX_VALUE,y=-Number.MAX_VALUE,v=Number.MAX_VALUE,b=Number.MAX_VALUE,E=Number.MAX_VALUE;for(let t of e)iY.copy(t),m=Math.max(iY.dot(f),m),_=Math.max(iY.dot(p),_),y=Math.max(iY.dot(g),y),v=Math.min(iY.dot(f),v),b=Math.min(iY.dot(p),b),E=Math.min(iY.dot(g),E);f=f.multiplyByScalar(.5*(v+m)),p=p.multiplyByScalar(.5*(b+_)),g=g.multiplyByScalar(.5*(E+y)),t.center.copy(f).add(p).add(g);let x=iZ.set(m-v,_-b,y-E).multiplyByScalar(.5),w=new io([x[0],0,0,0,x[1],0,0,0,x[2]]);return t.halfAxes.multiplyRight(w),t}var i4=i(45692);let i6=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],i8=i6.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),i5=i8.concat([[.25,.5],[.75,.5]]);class i7{constructor(e,t,i){this.x=e,this.y=t,this.z=i}get children(){if(!this._children){let e=2*this.x,t=2*this.y,i=this.z+1;this._children=[new i7(e,t,i),new i7(e,t+1,i),new i7(e+1,t,i),new i7(e+1,t+1,i)]}return this._children}update(e){let{viewport:t,cullingVolume:i,elevationBounds:r,minZ:s,maxZ:n,bounds:o,offset:a,project:l}=e,h=this.getBoundingVolume(r,a,l);if(o&&!this.insideBounds(o)||0>i.computeVisibility(h))return!1;if(!this.childVisible){let{z:e}=this;if(e<n&&e>=s&&(e+=Math.floor(Math.log2(h.distanceTo(t.cameraPosition)*t.scale/t.height))),e>=n)return this.selected=!0,!0}for(let t of(this.selected=!1,this.childVisible=!0,this.children))t.update(e);return!0}getSelected(e=[]){if(this.selected&&e.push(this),this._children)for(let t of this._children)t.getSelected(e);return e}insideBounds([e,t,i,r]){let s=512/Math.pow(2,this.z);return this.x*s<i&&this.y*s<r&&(this.x+1)*s>e&&(this.y+1)*s>t}getBoundingVolume(e,t,i){if(i){let t=this.z<1?i5:this.z<2?i8:i6,r=[];for(let s of t){let t=rr(this.x+s[0],this.y+s[1],this.z);t[2]=e[0],r.push(i(t)),e[0]!==e[1]&&(t[2]=e[1],r.push(i(t)))}return i2(r)}let r=512/Math.pow(2,this.z),s=this.x*r+512*t,n=512-(this.y+1)*r;return new t1([s,n,e[0]],[s+r,n+r,e[1]])}}let i9=[-1/0,-1/0,1/0,1/0];function re(e,t){let i=[t.transformAsPoint([e[0],e[1]]),t.transformAsPoint([e[2],e[1]]),t.transformAsPoint([e[0],e[3]]),t.transformAsPoint([e[2],e[3]])];return[Math.min(...i.map(e=>e[0])),Math.min(...i.map(e=>e[1])),Math.max(...i.map(e=>e[0])),Math.max(...i.map(e=>e[1]))]}function rt({viewport:e,z:t,cullRect:i}){return(e.subViewports||[e]).map(e=>(function e(t,i,r){if(!Array.isArray(i)){let e=r.x-t.x,s=r.y-t.y,{width:n,height:o}=r,a={targetZ:i},l=t.unproject([e,s],a),h=t.unproject([e+n,s],a),u=t.unproject([e,s+o],a),c=t.unproject([e+n,s+o],a);return[Math.min(l[0],h[0],u[0],c[0]),Math.min(l[1],h[1],u[1],c[1]),Math.max(l[0],h[0],u[0],c[0]),Math.max(l[1],h[1],u[1],c[1])]}let s=e(t,i[0],r),n=e(t,i[1],r);return[Math.min(s[0],n[0]),Math.min(s[1],n[1]),Math.max(s[2],n[2]),Math.max(s[3],n[3])]})(e,t||0,i))}function ri(e,t){return 512*Math.pow(2,e)/t}function rr(e,t,i){let r=ri(i,512),s=Math.PI-2*Math.PI*t/r;return[e/r*360-180,180/Math.PI*Math.atan(.5*(Math.exp(s)-Math.exp(-s)))]}function rs(e,t,i,r){let s=ri(i,r);return[e/s*512,t/s*512]}let rn="best-available",ro={[rn]:function(e){for(let t of e)t.state=0;for(let t of e)t.isSelected&&!rh(t)&&ru(t);for(let t of e)t.isVisible=!!(2&t.state)},"no-overlap":function(e){for(let t of e)t.state=0;for(let t of e)t.isSelected&&rh(t);for(let t of Array.from(e).sort((e,t)=>
3278e.zoom-t.zoom))if(t.isVisible=!!(2&t.state),t.children&&(t.isVisible||1&t.state))for(let e of t.children)e.state=1;else t.isSelected&&ru(t)},never:()=>{}},ra={extent:null,tileSize:512,maxZoom:null,minZoom:null,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:"best-available",zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0,visibleMinZoom:null,visibleMaxZoom:null,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{}};class rl{constructor(e){this._getCullBounds=function(e){let t,i={};return r=>{for(let s in r)if(!function(e,t){if(e===t)return!0;if(Array.isArray(e)){let i=e.length;if(!t||t.length!==i)return!1;for(let r=0;r<i;r++)if(e[r]!==t[r])return!1;return!0}return!1}(r[s],i[s])){t=e(r),i=r;break}return t}}(rt),this.opts={...ra,...e},this.setOptions(this.opts),this.onTileLoad=e=>{this.opts.onTileLoad?.(e),null!==this.opts.maxCacheByteSize&&(this._cacheByteSize+=e.byteLength,this._resizeCache())},this._requestScheduler=new t$({throttleRequests:this.opts.maxRequests>0||this.opts.debounceTime>0,maxRequests:this.opts.maxRequests,debounceTime:this.opts.debounceTime}),this._cache=new Map,this._tiles=[],this._dirty=!1,this._cacheByteSize=0,this._viewport=null,this._zRange=null,this._selectedTiles=null,this._frameNumber=0,this._modelMatrix=new tH.k,this._modelMatrixInverse=new tH.k}get tiles(){return this._tiles}get selectedTiles(){return this._selectedTiles}get isLoaded(){return null!==this._selectedTiles&&this._selectedTiles.every(e=>e.isLoaded)}get needsReload(){return null!==this._selectedTiles&&this._selectedTiles.some(e=>e.needsReload)}setOptions(e){Object.assign(this.opts,e),Number.isFinite(e.maxZoom)&&(this._maxZoom=Math.floor(e.maxZoom)),Number.isFinite(e.minZoom)&&(this._minZoom=Math.ceil(e.minZoom)),this._viewport=null}finalize(){for(let e of this._cache.values())e.isLoading&&e.abort();this._cache.clear(),this._tiles=[],this._selectedTiles=null}reloadAll(){for(let e of this._cache.keys()){let t=this._cache.get(e);this._selectedTiles&&this._selectedTiles.includes(t)?t.setNeedsReload():this._cache.delete(e)}}update(e,{zRange:t,modelMatrix:i}={zRange:null,modelMatrix:null}){let r=i?new tH.k(i):new tH.k,s=!r.equals(this._modelMatrix);if(this._viewport&&e.equals(this._viewport)&&(0,tq.aI)(this._zRange,t)&&!s)this.needsReload&&(this._selectedTiles=this._selectedTiles.map(e=>this._getTile(e.index,!0)));else{s&&(this._modelMatrixInverse=r.clone().invert(),this._modelMatrix=r),this._viewport=e,this._zRange=t;let i=this.getTileIndices({viewport:e,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:t,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=i.map(e=>this._getTile(e,!0)),this._dirty&&this._rebuildTree()}let n=this.updateTileStates();return this._pruneRequests(),this._dirty&&this._resizeCache(),n&&this._frameNumber++,this._frameNumber}isTileVisible(e,t,i){if(!e.isVisible)return!1;if(t&&this._viewport){let r=this._getCullBounds({viewport:this._viewport,z:this._zRange,cullRect:t}),{bbox:s}=e;for(let[e,t,n,o]of r){let r;if("west"in s)r=s.west<n&&s.east>e&&s.south<o&&s.north>t;else{if(i&&!tH.k.IDENTITY.equals(i)){let[e,t,r,n]=re([s.left,s.top,s.right,s.bottom],i);s={left:e,top:t,right:r,bottom:n}}let a=Math.min(s.top,s.bottom),l=Math.max(s.top,s.bottom);r=s.left<n&&s.right>e&&a<o&&l>t}if(r)return!0}return!1}return!0}getTileIndices({viewport:e,maxZoom:t,minZoom:i,zRange:r,modelMatrix:s,modelMatrixInverse:n}){let{tileSize:o,extent:a,zoomOffset:l,visibleMinZoom:h,visibleMaxZoom:u}=this.opts;return function({viewport:e,maxZoom:t,minZoom:i,zRange:r,extent:s,tileSize:n=512,modelMatrix:o,modelMatrixInverse:a,zoomOffset:l=0,visibleMinZoom:h,visibleMaxZoom:u}){let c=e.isGeospatial?Math.round(e.zoom+Math.log2(512/n)+l):Math.ceil(e.zoom+l);if("number"==typeof i&&Number.isFinite(i)&&c<i){if(!s)return[];c=i}if("number"==typeof t&&Number.isFinite(t)&&c>t&&(c=t),null!=h&&e.zoom<h||null!=u&&e.zoom>u)return[];let d=s;return o&&a&&s&&!e.isGeospatial&&(d=re(s,o)),e.isGeospatial?function(e,t,i,r){let s=e instanceof tX.Ay&&e.resolution?e.projectPosition:null,n=new ij(Object.values(e.getFrustumPlanes()).map(({normal:e,distance:t})=>new iG(e.clone().negate(),t))),o=e.distanceScales.unitsPerMeter[2],a=i&&i[0]*o||0,l=i&&i[1]*o||0,h=e instanceof tY.A&&e.pitch<=60?t:0;if(r){let[e,t,i,s]=r,n=(0,i4.Gw)([e,s]),o=(0,i4.Gw)([i,t]);r=[n[0],512-n[1],o[0],512-o[1]]}let u=new i7(0,0,0),c={viewport:e,project:s,cullingVolume:n,elevationBounds:[a,l],minZ:h,maxZ:t,boun
3278ds:r,offset:0};if(u.update(c),e instanceof tY.A&&e.subViewports&&e.subViewports.length>1){for(c.offset=-1;u.update(c)&&!(--c.offset<-3););for(c.offset=1;u.update(c)&&!(++c.offset>3););}return u.getSelected()}(e,c,r,s):function(e,t,i,r,s){var n,o;let a,l=(n=e,o=r,a=n.getBounds(),n.isGeospatial?[Math.max(a[0],o[0]),Math.max(a[1],o[1]),Math.min(a[2],o[2]),Math.min(a[3],o[3])]:[Math.max(Math.min(a[0],o[2]),o[0]),Math.max(Math.min(a[1],o[3]),o[1]),Math.min(Math.max(a[2],o[0]),o[2]),Math.min(Math.max(a[3],o[1]),o[3])]),h=ri(t,i),[u,c,d,f]=s?re(l,s).map(e=>e*h/512):l.map(e=>e*h/512),p=[];for(let e=Math.floor(u);e<d;e++)for(let i=Math.floor(c);i<f;i++)p.push({x:e,y:i,z:t});return p}(e,c,n,d||i9,a)}({viewport:e,maxZoom:t,minZoom:i,zRange:r,tileSize:o,extent:a,modelMatrix:s,modelMatrixInverse:n,zoomOffset:l,visibleMinZoom:h,visibleMaxZoom:u})}getTileId(e){return`${e.x}-${e.y}-${e.z}`}getTileZoom(e){return e.z}getTileMetadata(e){let{tileSize:t}=this.opts;return{bbox:function(e,t,i,r,s=512){if(e.isGeospatial){let[e,s]=rr(t,i,r),[n,o]=rr(t+1,i+1,r);return{west:e,north:s,east:n,south:o}}let[n,o]=rs(t,i,r,s),[a,l]=rs(t+1,i+1,r,s);return{left:n,top:o,right:a,bottom:l}}(this._viewport,e.x,e.y,e.z,t)}}getParentIndex(e){let t=Math.floor(e.x/2);return{x:t,y:Math.floor(e.y/2),z:e.z-1}}updateTileStates(){let e=this.opts.refinementStrategy||rn,t=Array(this._cache.size),i=0;for(let e of this._cache.values())t[i++]=e.isVisible,e.isSelected=!1,e.isVisible=!1;for(let e of this._selectedTiles)e.isSelected=!0,e.isVisible=!0;for(let r of(("function"==typeof e?e:ro[e])(Array.from(this._cache.values())),i=0,this._cache.values()))if(t[i++]!==r.isVisible)return!0;return!1}_pruneRequests(){let{maxRequests:e=0}=this.opts,t=[],i=0;for(let e of this._cache.values())e.isLoading&&(i++,e.isSelected||e.isVisible||t.push(e));for(;e>0&&i>e&&t.length>0;)t.shift().abort(),i--}_rebuildTree(){let{_cache:e}=this;for(let t of e.values())t.parent=null,t.children&&(t.children.length=0);for(let t of e.values()){let e=this._getNearestAncestor(t);t.parent=e,e?.children&&e.children.push(t)}}_resizeCache(){let{_cache:e,opts:t}=this,i=t.maxCacheSize??(null!==t.maxCacheByteSize?1/0:5*this.selectedTiles.length),r=t.maxCacheByteSize??1/0;if(e.size>i||this._cacheByteSize>r){for(let[s,n]of e)if(n.isVisible||n.isSelected||(this._cacheByteSize-=null!==t.maxCacheByteSize?n.byteLength:0,e.delete(s),this.opts.onTileUnload?.(n)),e.size<=i&&this._cacheByteSize<=r)break;this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort((e,t)=>e.zoom-t.zoom),this._dirty=!1)}_getTile(e,t){let i=this.getTileId(e),r=this._cache.get(i),s=!1;return!r&&t?(Object.assign(r=new tK(e),this.getTileMetadata(r.index)),Object.assign(r,{id:i,zoom:this.getTileZoom(r.index)}),s=!0,this._cache.set(i,r),this._dirty=!0):r&&r.needsReload&&(s=!0),r&&s&&r.loadData({getData:this.opts.getTileData,requestScheduler:this._requestScheduler,onLoad:this.onTileLoad,onError:this.opts.onTileError}),r}_getNearestAncestor(e){let{_minZoom:t=0}=this,i=e.index;for(;this.getTileZoom(i)>t;){i=this.getParentIndex(i);let e=this._getTile(i);if(e)return e}return null}}function rh(e){let t=e;for(;t;){if(t.isLoaded||t.content)return t.state|=2,!0;t=t.parent}return!1}function ru(e){for(let t of e.children)t.isLoaded||t.content?t.state|=2:ru(t)}class rc extends c{initializeState(){this.state={tileset:null,isLoaded:!1}}finalizeState(){var e,t;null==(t=this.state)||null==(e=t.tileset)||e.finalize()}get isLoaded(){var e,t,i;return!!(null==(i=this.state)||null==(t=i.tileset)||null==(e=t.selectedTiles)?void 0:e.every(e=>e.isLoaded&&(!e.content||!e.layers||e.layers.every(e=>e.isLoaded))))}shouldUpdateState(e){let{changeFlags:t}=e;return t.somethingChanged}updateState(e){let{changeFlags:t}=e,{tileset:i}=this.state,r=t.propsOrDataChanged||t.updateTriggersChanged,s=t.dataChanged||t.updateTriggersChanged&&(t.updateTriggersChanged.all||t.updateTriggersChanged.getTileData);i?r&&(i.setOptions(this._getTilesetOptions()),s?i.reloadAll():i.tiles.forEach(e=>{e.layers=null})):(i=new this.props.TilesetClass(this._getTilesetOptions()),this.setState({tileset:i})),this._updateTileset()}_getTilesetOptions(){let{tileSize:e,maxCacheSize:t,maxCacheByteSize:i,refinementStrategy:r,extent:s,maxZoom:n,minZoom:o,maxRequests:a,debounceTime:l,zoomOffset:h,visibleMinZoom:u,visibleMaxZoom:c}=this.props;return{maxCacheSize:t,maxCacheByteSize:i,maxZoom:n,minZoom:o,tileSize:e,refinementStrategy:r,extent:s,maxRequests:a,debounceTime:l,zoomOffset:h,visibleMinZoom:u,visibleMaxZoom:c,getTileData:this.getTileData.bind(this),onTileLoad:this._onTileLoad.bind(this),onTileError:this._onTileError.bind(this),onTileUnload:this._onTileUnload.bind(this)}}_updateTileset(){let e=this.state.tileset,{zRange:t,modelMatrix:i}=this.props,r=e.update(this.context.viewport,{zRange:t,modelMatrix:i}),{isLoaded:s}=e,n=this.state.isLoaded!==s,o=this.state.frameNumber!==r;s&&(n||o)&&this._onViewportLoad(),o&&this.setState({frameNumber:r}),this.state.isLoaded=s}_onViewportLoad(){let{tileset:e}=this.state,{onViewportLoad:t}=this.props;t&&t(e.selectedTiles)}_onTileLoad(e){this.props.onTileLoad(e),e.layers=null,this.setNeedsUpdate()}_onTileError(e,t){this.props.onTileError(e),t.layers=null,this.setNeedsUpdate()}_onTileUnload(e){this.props.onTileUnload(e)}getTileData(e){let{data:t,getTileData:i,fetch:r}=this.props,{signal:s}=e;return(e.url="string"==typeof t||Array.isArray(t)?function(e,t){if(!e||!e.length)return null;let{index:i,id:r}=t;if(Array.isArray(e)){let t=Math.abs(r.split("").reduce((e,t)=>
3278(e<<5)-e+t.charCodeAt(0)|0,0))%e.length;e=e[t]}let s=e;for(let e of Object.keys(i)){let t=RegExp(`{${e}}`,"g");s=s.replace(t,String(i[e]))}return Number.isInteger(i.y)&&Number.isInteger(i.z)&&(s=s.replace(/\{-y\}/g,String(Math.pow(2,i.z)-i.y-1))),s}(t,e):null,i)?i(e):r&&e.url?r(e.url,{propName:"data",layer:this,signal:s}):null}renderSubLayers(e){return this.props.renderSubLayers(e)}getSubLayerPropsByTile(e){return null}getPickingInfo(e){let t=e.sourceLayer,i=t.props.tile,r=e.info;return r.picked&&(r.tile=i),r.sourceTile=i,r.sourceTileSubLayer=t,r}_updateAutoHighlight(e){e.sourceTileSubLayer.updateAutoHighlight(e)}renderLayers(){let{visibleMinZoom:e,visibleMaxZoom:t,minZoom:i,extent:r}=this.props,s=this.context.viewport.zoom;if(null!=e&&s<e||null!=t&&s>t||null!=i&&!r&&s<i){for(let e of this.state.tileset.tiles)e.layers=null;return[]}return this.state.tileset.tiles.map(e=>{let t=this.getSubLayerPropsByTile(e);if(e.isLoaded||e.content)if(e.layers)t&&e.layers[0]&&Object.keys(t).some(i=>e.layers[0].props[i]!==t[i])&&(e.layers=e.layers.map(e=>e.clone(t)));else{let i=this.renderSubLayers({...this.props,...this.getSubLayerProps({id:e.id,updateTriggers:this.props.updateTriggers}),data:e.content,_offset:0,tile:e});e.layers=(0,l.B)(i,Boolean).map(i=>i.clone({tile:e,...t}))}return e.layers})}filterSubLayer(e){let{layer:t,cullRect:i}=e,{tile:r}=t.props,{modelMatrix:s}=this.props;return this.state.tileset.isTileVisible(r,i,s?new tH.k(s):null)}}rc.defaultProps={TilesetClass:rl,data:{type:"data",value:[]},dataComparator:(e,t)=>{if(e===t)return!0;if(!Array.isArray(e)||!Array.isArray(t))return!1;let i=e.length;if(i!==t.length)return!1;for(let r=0;r<i;r++)if(e[r]!==t[r])return!1;return!0},renderSubLayers:{type:"function",value:e=>new tj(e)},getTileData:{type:"function",optional:!0,value:null},onViewportLoad:{type:"function",optional:!0,value:null},onTileLoad:{type:"function",value:e=>{}},onTileUnload:{type:"function",value:e=>{}},onTileError:{type:"function",value:e=>console.error(e)},extent:{type:"array",optional:!0,value:null,compare:!0},tileSize:512,maxZoom:null,minZoom:0,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:rn,zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0,visibleMinZoom:null,visibleMaxZoom:null},rc.layerName="TileLayer";let rd=[0,0,0,255],rf={stroked:!0,filled:!0,extruded:!1,elevationScale:1,wireframe:!1,_normalize:!0,_windingOrder:"CW",lineWidthUnits:"meters",lineWidthScale:1,lineWidthMinPixels:0,lineWidthMaxPixels:Number.MAX_SAFE_INTEGER,lineJointRounded:!1,lineMiterLimit:4,getPolygon:{type:"accessor",value:e=>e.polygon},getFillColor:{type:"accessor",value:[0,0,0,255]},getLineColor:{type:"accessor",value:rd},getLineWidth:{type:"accessor",value:1},getElevation:{type:"accessor",value:1e3},material:!0};class rp extends c{initializeState(){this.state={paths:[],pathsDiff:null},this.props.getLineDashArray&&S.A.removed("getLineDashArray","PathStyleExtension")()}updateState({changeFlags:e}){let t=e.dataChanged||e.updateTriggersChanged&&(e.updateTriggersChanged.all||e.updateTriggersChanged.getPolygon);if(t&&Array.isArray(e.dataChanged)){let t=this.state.paths.slice(),i=e.dataChanged.map(e=>
vendor: 2,007 bytes, line 3278
3278d({data:t,getIndex:e=>e.__source.index,dataRange:e,replace:this._getPaths(e)}));this.setState({paths:t,pathsDiff:i})}else t&&this.setState({paths:this._getPaths(),pathsDiff:null})}_getPaths(e={}){let{data:t,getPolygon:i,positionFormat:r,_normalize:s}=this.props,n=[],o="XY"===r?2:3,{startRow:a,endRow:l}=e,{iterable:h,objectInfo:u}=(0,N.X)(t,a,l);for(let e of h){u.index++;let t=i(e,u);s&&(t=tm(t,o));let{holeIndices:r}=t,a=t.positions||t;if(r)for(let t=0;t<=r.length;t++){let i=a.slice(r[t-1]||0,r[t]||a.length);n.push(this.getSubLayerRow({path:i},e,u.index))}else n.push(this.getSubLayerRow({path:a},e,u.index))}return n}renderLayers(){let{data:e,_dataDiff:t,stroked:i,filled:r,extruded:s,wireframe:n,_normalize:o,_windingOrder:a,elevationScale:l,transitions:h,positionFormat:u}=this.props,{lineWidthUnits:c,lineWidthScale:d,lineWidthMinPixels:f,lineWidthMaxPixels:p,lineJointRounded:g,lineMiterLimit:m,lineDashJustified:_}=this.props,{getFillColor:y,getLineColor:v,getLineWidth:b,getLineDashArray:E,getElevation:x,getPolygon:w,updateTriggers:S,material:P}=this.props,{paths:T,pathsDiff:A}=this.state,M=this.getSubLayerClass("fill",tC),C=this.getSubLayerClass("stroke",e4),R=this.shouldRenderSubLayer("fill",T)&&new M({_dataDiff:t,extruded:s,elevationScale:l,filled:r,wireframe:n,_normalize:o,_windingOrder:a,getElevation:x,getFillColor:y,getLineColor:s&&n?v:rd,material:P,transitions:h},this.getSubLayerProps({id:"fill",updateTriggers:S&&{getPolygon:S.getPolygon,getElevation:S.getElevation,getFillColor:S.getFillColor,lineColors:s&&n,getLineColor:S.getLineColor}}),{data:e,positionFormat:u,getPolygon:w}),L=!s&&i&&this.shouldRenderSubLayer("stroke",T)&&new C({_dataDiff:A&&(()=>A),widthUnits:c,widthScale:d,widthMinPixels:f,widthMaxPixels:p,jointRounded:g,miterLimit:m,dashJustified:_,_pathType:"loop",transitions:h&&{getWidth:h.getLineWidth,getColor:h.getLineColor,getPath:h.getPolygon},getColor:this.getSubLayerAccessor(v),getWidth:this.getSubLayerAccessor(b),getDashArray:this.getSubLayerAccessor(E)}
3278,this.getSubLayerProps({id:"stroke",updateTriggers:S&&{getWidth:S.getLineWidth,getColor:S.getLineColor,getDashArray:S.getLineDashArray}}),{data:T,positionFormat:u,getPath:e=>e.path});return[!s&&R,L,s&&R]}}rp.layerName="PolygonLayer",rp.defaultProps=rf;let rg=[[1/3,1/3,1/3],[.5,.5,0],[.5,0,.5],[0,.5,.5]];function rm(e,t,i,r){return{uvs:[e,t,i,t,e,r,i,r],triangles:[3,0,2,0,3,1],halfedges:[3,-1,-1,0,-1,-1]}}let r_=rm(0,0,1,1);class ry{reprojectors;width;height;uvs;exactOutputPositions;triangles;_halfedges;_candidatesUV;_queueIndices;_queue;_errors;_pending;_pendingLen;constructor(e,t,i=t,r={}){this.reprojectors=e,this.width=t,this.height=i,this.uvs=[],this.exactOutputPositions=[],this.triangles=[],this._halfedges=[],this._candidatesUV=[],this._queueIndices=[],this._queue=[],this._errors=[],this._pending=[],this._pendingLen=0,this._seed(r.initialTriangulation??r_),this._flush()}_seed(e){for(let t=0;t<e.uvs.length;t+=2)this._addPoint(e.uvs[t],e.uvs[t+1]);for(let t=0;t<e.triangles.length;t++)this.triangles[t]=e.triangles[t],this._halfedges[t]=e.halfedges[t];let t=e.triangles.length/3;for(let e=0;e<t;e++)this._candidatesUV[2*e]=0,this._candidatesUV[2*e+1]=0,this._queueIndices[e]=-1,this._pending[this._pendingLen++]=e}run(e=.125,{maxIterations:t=1e4}={}){if(e<=0)throw Error("maxError must be positive");let i=0;for(;this.getMaxError()>e;)if(this.refine(),++i>t){console.warn(`RasterReprojector: mesh refinement did not converge after ${i} iterations (maxError=${e}, currentError=${this.getMaxError()})`);break}}refine(){this._step(),this._flush()}getMaxError(){return this._errors[0]}_flush(){for(let e=0;e<this._pendingLen;e++){let t=this._pending[e];this._findReprojectionCandidate(t)}this._pendingLen=0}_findReprojectionCandidate(e){let t=2*this.triangles[3*e+0],i=2*this.triangles[3*e+1],r=2*this.triangles[3*e+2],s=this.uvs[t],n=this.uvs[t+1],o=this.uvs[i],a=this.uvs[i+1],l=this.uvs[r],h=this.uvs[r+1],u=this.exactOutputPositions[t],c=this.exactOutputPositions[t+1],d=this.exactOutputPositions[i],f=this.exactOutputPositions[i+1],p=this.exactOutputPositions[r],g=this.exactOutputPositions[r+1],m=0,_=0,y=0;for(let e of rg){var v,b,E,x,w,S,P,T,A,M,C,R,L,I,O,N,F,D,B,G;let t=(v=s,b=o,E=l,x=e[0],w=e[1],x*v+w*b+e[2]*E),i=(S=n,P=a,T=h,A=e[0],M=e[1],A*S+M*P+e[2]*T),r=(C=u,R=d,L=p,I=e[0],O=e[1],I*C+O*R+e[2]*L),k=(N=c,F=f,D=g,B=e[0],G=e[1],B*N+G*F+e[2]*D),U=t*(this.width-1),z=i*(this.height-1),j=this.reprojectors.inverseReproject(r,k),V=this.reprojectors.inverseTransform(j[0],j[1]),W=Math.hypot(U-V[0],z-V[1]);W>m&&(m=W,_=t,y=i)}(_===s&&y===n||_===o&&y===a||_===l&&y===h)&&(m=0),this._candidatesUV[2*e]=_,this._candidatesUV[2*e+1]=y,this._queuePush(e,m)}_step(){var e,t,i,r,s,n,o,a,l,h,u,c,d,f,p,g,m,_;let y=this._queuePop(),v=3*y+0,b=3*y+1,E=3*y+2,x=this.triangles[v],w=this.triangles[b],S=this.triangles[E],P=this.uvs[2*x],T=this.uvs[2*x+1],A=this.uvs[2*w],M=this.uvs[2*w+1],C=this.uvs[2*S],R=this.uvs[2*S+1],L=this._candidatesUV[2*y],I=this._candidatesUV[2*y+1],O=this._addPoint(L,I);if(0==(e=P,t=T,i=A,r=M,(i-(s=L))*(t-(n=I))-(r-n)*(e-s)))this._handleCollinear(O,v);else{if(0==(o=A,a=M,l=C,h=R,(l-(u=L))*(a-(c=I))-(h-c)*(o-u)))this._handleCollinear(O,b);else{if(0==(d=C,f=R,p=P,g=T,(p-(m=L))*(f-(_=I))-(g-_)*(d-m)))this._handleCollinear(O,E);else{let e=this._halfedges[v],t=this._halfedges[b],i=this._halfedges[E],r=this._addTriangle(x,w,O,e,-1,-1,v),s=this._addTriangle(w,S,O,t,-1,r+1),n=this._addTriangle(S,x,O,i,r+2,s+1);this._legalize(r),this._legalize(s),this._legalize(n)}}}}_addPoint(e,t){let i=this.uvs.length>>1;this.uvs.push(e,t);let r=e*(this.width-1),s=t*(this.height-1),n=this.reprojectors.forwardTransform(r,s),o=this.reprojectors.forwardReproject(n[0],n[1]);return this.exactOutputPositions.push(o[0],o[1]),i}_addTriangle(e,t,i,r,s,n,o=this.triangles.length){let a=o/3;return this.triangles[o+0]=e,this.triangles[o+1]=t,this.triangles[o+2]=i,this._halfedges[o+0]=r,this._halfedges[o+1]=s,this._halfedges[o+2]=n,r>=0&&(this._halfedges[r]=o+0),s>=0&&(this._halfedges[s]=o+1),n>=0&&(this._halfedges[n]=o+2),this._candidatesUV[2*a+0]=0,this._candidatesUV[2*a+1]=0,this._queueIndices[a]=-1,this._pending[this._pendingLen++]=a,o}_legalize(e){let t=this._halfedges[e];if(t<0)return;let i=e-e%3,r=t-t%3,s=i+(e+1)%3,n=i+(e+2)%3,o=r+(t+2)%3,a=r+(t+1)%3,l=this.triangles[n],h=this.triangles[e],u=this.triangles[s],c=this.triangles[o],d=this.uvs;if(!function(e,t,i,r,s,n,o,a){let l=e-o,h=t-a,u=i-o,c=r-a,d=s-o,f=n-a,p=u*u+c*c,g=d*d+f*f;return l*(c*g-p*f)-h*(u*g-p*d)+(l*l+h*h)*(u*f-c*d)<0}(d[2*l],d[2*l+1],d[2*h],d[2*h+1],d[2*u],d[2*u+1],d[2*c],d[2*c+1]))return;let f=this._halfedges[s],p=this._halfedges[n],g=this._halfedges[o],m=this._halfedges[a];this._queueRemove(i/3),this._queueRemove(r/3);let _=this._addTriangle(l,c,u,-1,g,f,i),y=this._addTriangle(c,l,h,_,p,m,r);this._legalize(_+1),this._legalize(y+2)}_handleCollinear(e,t){let i=t-t%3,r=i+(t+1)%3,s=i+(t+2)%3,n=this.triangles[s],o=this.triangles[t],a=this.triangles[r],l=this._halfedges[r],h=this._halfedges[s],u=this._halfedges[t];
3278if(u<0){let t=this._addTriangle(e,n,o,-1,h,-1,i),r=this._addTriangle(n,e,a,t,-1,l);this._legalize(t+1),this._legalize(r+2);return}let c=u-u%3,d=c+(u+2)%3,f=c+(u+1)%3,p=this.triangles[d],g=this._halfedges[d],m=this._halfedges[f];this._queueRemove(c/3);let _=this._addTriangle(n,o,e,h,-1,-1,i),y=this._addTriangle(o,p,e,m,-1,_+1,c),v=this._addTriangle(p,a,e,g,-1,y+1),b=this._addTriangle(a,n,e,l,_+2,v+1);this._legalize(_),this._legalize(y),this._legalize(v),this._legalize(b)}_queuePush(e,t){let i=this._queue.length;this._queueIndices[e]=i,this._queue.push(e),this._errors.push(t),this._queueUp(i)}_queuePop(){let e=this._queue.length-1;return this._queueSwap(0,e),this._queueDown(0,e),this._queuePopBack()}_queuePopBack(){let e=this._queue.pop();return this._errors.pop(),this._queueIndices[e]=-1,e}_queueRemove(e){let t=this._queueIndices[e];if(t<0){let t=this._pending.indexOf(e);if(-1!==t)this._pending[t]=this._pending[--this._pendingLen];else throw Error("Broken triangulation (something went wrong).");return}let i=this._queue.length-1;i!==t&&(this._queueSwap(t,i),this._queueDown(t,i)||this._queueUp(t)),this._queuePopBack()}_queueLess(e,t){return this._errors[e]>this._errors[t]}_queueSwap(e,t){let i=this._queue[e],r=this._queue[t];this._queue[e]=r,this._queue[t]=i,this._queueIndices[i]=t,this._queueIndices[r]=e;let s=this._errors[e];this._errors[e]=this._errors[t],this._errors[t]=s}_queueUp(e){let t=e;for(;;){let e=t-1>>1;
3278if(e===t||!this._queueLess(t,e))break;this._queueSwap(e,t),t=e}}_queueDown(e,t){let i=e;for(;;){let e=2*i+1;if(e>=t||e<0)break;let r=e+1,s=e;if(r<t&&this._queueLess(r,e)&&(s=r),!this._queueLess(s,i))break;this._queueSwap(i,s),i=s}return i>e}}function rv(e){let t=new Float32Array(e.length),i=new Float32Array(e.length);for(let r=0;r<e.length;r++){let s=e[r],n=Math.fround(s);i[r]=n,t[r]=s-n}return[t,i]}let rb={name:"phongMaterial",firstBindingSlot:0,bindingLayout:[{name:"phongMaterial",group:3}],dependencies:[te,e8],source:to,vs:ts,fs:tn,defines:{LIGHTING_FRAGMENT:!0},uniformTypes:{unlit:"i32",ambient:"f32",diffuse:"f32",shininess:"f32",specularColor:"vec3<f32>"},defaultUniforms:{unlit:!1,ambient:.35,diffuse:.6,shininess:32,specularColor:[38.25,38.25,38.25]},getUniforms:e=>({...rb.defaultUniforms,...e})};var rE=i(75457);let rx=Math.PI/180,rw=new Float32Array(16),rS=new Float32Array(12);function rP(e,t,i){let r=t[0]*rx,s=t[1]*rx,n=t[2]*rx,o=Math.sin(n),a=Math.sin(r),l=Math.sin(s),h=Math.cos(n),u=Math.cos(r),c=Math.cos(s),d=i[0],f=i[1],p=i[2];e[0]=d*c*u,e[1]=d*l*u,e[2]=-(d*a),e[3]=f*(-l*h+c*a*o),e[4]=f*(c*h+l*a*o),e[5]=f*u*o,e[6]=p*(l*o+c*a*h),e[7]=p*(-c*o+l*a*h),e[8]=p*u*h}function rT(e){return e[0]=e[0],e[1]=e[1],e[2]=e[2],e[3]=e[4],e[4]=e[5],e[5]=e[6],e[6]=e[8],e[7]=e[9],e[8]=e[10],e[9]=e[12],e[10]=e[13],e[11]=e[14],e.subarray(0,12)}let rA={size:12,accessor:["getOrientation","getScale","getTranslation","getTransformMatrix"],shaderAttributes:{instanceModelMatrixCol0:{size:3,elementOffset:0},instanceModelMatrixCol1:{size:3,elementOffset:3},instanceModelMatrixCol2:{size:3,elementOffset:6},instanceTranslation:{size:3,elementOffset:9}},update(e,{startRow:t,endRow:i}){let{data:r,getOrientation:s,getScale:n,getTranslation:o,getTransformMatrix:a}=this.props,l=Array.isArray(a),h=l&&16===a.length,u=Array.isArray(n),c=Array.isArray(s),d=Array.isArray(o),f=h||!l&&!!a(r[0]);f?e.constant=h:e.constant=c&&u&&d;let p=e.value;if(e.constant){let t;f?(rw.set(a),t=rT(rw)):(rP(t=rS,s,n),t.set(o,9)),e.value=new Float32Array(t)}else{let l=t*e.size,{iterable:g,objectInfo:m}=(0,N.X)(r,t,i);for(let e of g){let t;(m.index++,f)?(rw.set(h?a:a(e,m)),t=rT(rw)):(rP(t=rS,c?s:s(e,m),u?n:n(e,m)),t.set(d?o:o(e,m),9)),p[l++]=t[0],p[l++]=t[1],p[l++]=t[2],p[l++]=t[3],p[l++]=t[4],p[l++]=t[5],p[l++]=t[6],p[l++]=t[7],p[l++]=t[8],p[l++]=t[9],p[l++]=t[10],p[l++]=t[11]}}}},rM=`\ 3279layout(std140) uniform simpleMeshUniforms { 3280 float sizeScale; 3281 bool composeModelMatrix; 3282 bool hasTexture; 3283 bool flatShading; 3284} simpleMesh; 3285`,rC={name:"simpleMesh",vs:rM,fs:rM,uniformTypes:{sizeScale:"f32",composeModelMatrix:"f32",hasTexture:"f32",flatShading:"f32"}},rR=`#version 300 es 3286#define SHADER_NAME simple-mesh-layer-vs 3287in vec3 positions; 3288in vec3 normals; 3289in vec3 colors; 3290in vec2 texCoords; 3291in vec3 instancePositions; 3292in vec3 instancePositions64Low; 3293in vec4 instanceColors; 3294in vec3 instancePickingColors; 3295in vec3 instanceModelMatrixCol0; 3296in vec3 instanceModelMatrixCol1; 3297in vec3 instanceModelMatrixCol2; 3298in vec3 instanceTranslation; 3299out vec2 vTexCoord; 3300out vec3 cameraPosition; 3301out vec3 normals_commonspace; 3302out vec4 position_commonspace; 3303out vec4 vColor; 3304void main(void) { 3305geometry.worldPosition = instancePositions; 3306geometry.uv = texCoords; 3307geometry.pickingColor = instancePickingColors; 3308vTexCoord = texCoords; 3309cameraPosition = project.cameraPosition; 3310vColor = vec4(colors * instanceColors.rgb, instanceColors.a); 3311mat3 instanceModelMatrix = mat3(instanceModelMatrixCol0, instanceModelMatrixCol1, instanceModelMatrixCol2); 3312vec3 pos = (instanceModelMatrix * positions) * simpleMesh.sizeScale + instanceTranslation; 3313if (simpleMesh.composeModelMatrix) { 3314DECKGL_FILTER_SIZE(pos, geometry); 3315normals_commonspace = project_normal(instanceModelMatrix * normals); 3316geometry.worldPosition += pos; 3317gl_Position = project_position_to_clipspace(pos + instancePositions, instancePositions64Low, vec3(0.0), position_commonspace); 3318geometry.position = position_commonspace; 3319} 3320else { 3321pos = project_size(pos); 3322DECKGL_FILTER_SIZE(pos, geometry); 3323gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, pos, position_commonspace); 3324geometry.position = position_commonspace; 3325normals_commonspace = project_normal(instanceModelMatrix * normals); 3326} 3327geometry.normal = normals_commonspace; 3328DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 3329DECKGL_FILTER_COLOR(vColor, geometry); 3330} 3331`,rL=`#version 300 es 3332#define SHADER_NAME simple-mesh-layer-fs 3333precision highp float; 3334uniform sampler2D sampler; 3335in vec2 vTexCoord; 3336in vec3 cameraPosition; 3337in vec3 normals_commonspace; 3338in vec4 position_commonspace; 3339in vec4 vColor; 3340out vec4 fragColor; 3341void main(void) { 3342geometry.uv = vTexCoord; 3343vec3 normal; 3344if (simpleMesh.flatShading) { 3345normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz))); 3346} else { 3347normal = normals_commonspace; 3348} 3349vec4 color = simpleMesh.hasTexture ? texture(sampler, vTexCoord) : vColor; 3350DECKGL_FILTER_COLOR(color, geometry); 3351vec3 lightColor = lighting_getLightColor(color.rgb, cameraPosition, position_commonspace.xyz, normal); 3352fragColor = vec4(lightColor, color.a * layer.opacity); 3353} 3354`;function rI(e){let t=e.positions||e.POSITION;S.A.assert(t,'no "postions" or "POSITION" attribute in mesh');let i=t.value.length/t.size,r=e.COLOR_0||e.colors;r||(r={size:3,value:new Float32Array(3*i).fill(1)});let s=e.NORMAL||e.normals;s||(s={size:3,value:new Float32Array(3*i).fill(0)});let n=e.TEXCOORD_0||e.texCoords;return n||(n={size:2,value:new Float32Array(2*i).fill(0)}),{positions:t,colors:r,normals:s,texCoords:n}}function rO(e){return e instanceof A?(e.attributes=rI(e.attributes),e):new A(e.attributes?{...e,to
3354pology:"triangle-list",attributes:rI(e.attributes)}:{topology:"triangle-list",attributes:rI(e)})}class rN extends o.A{getShaders(){return super.getShaders({vs:rR,fs:rL,modules:[m,rb,x,rC]})}getBounds(){if(this.props._instanced)return super.getBounds();let e=this.state.positionBounds;if(e)return e;let{mesh:t}=this.props;if(!t)return null;if(!(e=t.header?.boundingBox)){let{attributes:i}=rO(t);i.POSITION=i.POSITION||i.positions,e=function(e){let t=1/0,i=1/0,r=1/0,s=-1/0,n=-1/0,o=-1/0,a=e.POSITION?e.POSITION.value:[],l=a&&a.length;for(let e=0;e<l;e+=3){let l=a[e],h=a[e+1],u=a[e+2];t=l<t?l:t,i=h<i?h:i,r=u<r?u:r,s=l>s?l:s,n=h>n?h:n,o=u>o?u:o}return[[t,i,r],[s,n,o]]}(i)}return this.state.positionBounds=e,e}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{transition:!0,type:"float64",fp64:this.use64bitPositions(),size:3,accessor:"getPosition"},instanceColors:{type:"unorm8",transition:!0,size:this.props.colorFormat.length,accessor:"getColor",defaultValue:[0,0,0,255]},instanceModelMatrix:rA}),this.setState({emptyTexture:this.context.device.createTexture({data:new Uint8Array(4),width:1,height:1})})}updateState(e){super.updateState(e);let{props:t,oldProps:i,changeFlags:r}=e;if(t.mesh!==i.mesh||r.extensionsChanged){if(this.state.positionBounds=null,this.state.model?.destroy(),t.mesh){this.state.model=this.getModel(t.mesh);let e=t.mesh.attributes||t.mesh;this.setState({hasNormals:!!(e.NORMAL||e.normals)})}this.getAttributeManager().invalidateAll()}t.texture!==i.texture&&t.texture instanceof rE.g&&this.setTexture(t.texture),this.state.model&&this.state.model.setTopology(this.props.wireframe?"line-strip":"triangle-list")}finalizeState(e){super.finalizeState(e),this.state.emptyTexture.delete()}draw({uniforms:e}){let{model:t}=this.state;if(!t)return;let{viewport:i,renderPass:r}=this.context,{sizeScale:s,coordinateSystem:n,_instanced:o}=this.props,a={sizeScale:s,composeModelMatrix:!o||"cartesian"===n||"meter-offsets"===n||"default"===n&&!i.isGeospatial,flatShading:!this.state.hasNormals};t.shaderInputs.setProps({simpleMesh:a}),t.draw(r)}get isLoaded(){return!!(this.state?.model&&super.isLoaded)}getModel(e){let t=new P.K(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:rO(e),isInstanced:!0}),{texture:i}=this.props,{emptyTexture:r}=this.state;return t.shaderInputs.setProps({simpleMesh:{sampler:i||r,hasTexture:!!i}}),t}setTexture(e){let{emptyTexture:t,model:i}=this.state;i&&i.shaderInputs.setProps({simpleMesh:{sampler:e||t,hasTexture:!!e}})}}rN.defaultProps={mesh:{type:"object",value:null,async:!0},texture:{type:"image",value:null,async:!0},sizeScale:{type:"number",value:1,min:0},_instanced:!0,wireframe:!1,material:!0,getPosition:{type:"accessor",value:e=>e.position},getColor:{type:"accessor",value:[0,0,0,255]},getOrientation:{type:"accessor",value:[0,0,0]},getScale:{type:"accessor",value:[1,1,1]},getTranslation:{type:"accessor",value:[0,0,0]},getTransformMatrix:{type:"accessor",value:[]},textureParameters:{type:"object",ignore:!0,value:null}},rN.layerName="SimpleMeshLayer";let rF=rN,rD={name:"create-texture-unorm",inject:{"fs:#decl":"uniform sampler2D textureName;","fs:DECKGL_FILTER_COLOR":` 3355 color = texture(textureName, geometry.uv); 3356 `},getUniforms:e=>({textureName:e.textureName})},rB=`#version 300 es 3357#define SHADER_NAME mesh-texture-layer-fs 3358 3359precision highp float; 3360 3361in vec2 vTexCoord; 3362in vec3 cameraPosition; 3363in vec3 normals_commonspace; 3364in vec4 position_commonspace; 3365in vec4 vColor; 3366 3367out vec4 fragColor; 3368 3369void main(void) { 3370 geometry.uv = vTexCoord; 3371 3372 vec3 normal; 3373 if (simpleMesh.flatShading) { 3374 3375 normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz))); 3376 } else { 3377 normal = normals_commonspace; 3378 } 3379 3380 // We initialize color here before passing into DECKGL_FILTER_COLOR 3381 vec4 color; 3382 DECKGL_FILTER_COLOR(color, geometry); 3383 3384 vec3 lightColor = lighting_getLightColor(color.rgb, cameraPosition, position_commonspace.xyz, normal); 3385 fragColor = vec4(lightColor, color.a * layer.opacity); 3386} 3387`,rG=`#version 300 es
3388#define SHADER_NAME mesh-texture-layer-vs 3389 3390// Primitive attributes 3391in vec3 positions; 3392in vec3 positions64Low; 3393in vec3 normals; 3394in vec3 colors; 3395in vec2 texCoords; 3396 3397// Instance attributes 3398in vec3 instancePositions; 3399in vec3 instancePositions64Low; 3400in vec4 instanceColors; 3401in vec3 instancePickingColors; 3402in vec3 instanceModelMatrixCol0; 3403in vec3 instanceModelMatrixCol1; 3404in vec3 instanceModelMatrixCol2; 3405in vec3 instanceTranslation; 3406 3407// Outputs to fragment shader 3408out vec2 vTexCoord; 3409out vec3 cameraPosition; 3410out vec3 normals_commonspace; 3411out vec4 position_commonspace; 3412out vec4 vColor; 3413 3414void main(void) { 3415 geometry.worldPosition = instancePositions; 3416 geometry.uv = texCoords; 3417 geometry.pickingColor = instancePickingColors; 3418 3419 vTexCoord = texCoords; 3420 cameraPosition = project.cameraPosition; 3421 vColor = vec4(colors * instanceColors.rgb, instanceColors.a); 3422 3423 mat3 instanceModelMatrix = mat3(instanceModelMatrixCol0, instanceModelMatrixCol1, instanceModelMatrixCol2); 3424 vec3 pos = (instanceModelMatrix * positions) * simpleMesh.sizeScale + instanceTranslation; 3425 3426 DECKGL_FILTER_SIZE(pos, geometry); 3427 // Call project_normal before project_position so the normal isn't affected by 3428 // a position offset (unused for unlit raster, kept for parity with upstream). 3429 normals_commonspace = project_normal(instanceModelMatrix * normals); 3430 geometry.worldPosition += pos; 3431 3432 // No composeModelMatrix branch: that flag only matters when placing an 3433 // instanced model offset from an anchor. MeshTextureLayer always draws one 3434 // mesh at instancePositions = [0,0,0] with identity transforms, so we project 3435 // the mesh vertex directly (with its fp64 low part). This is correct for both 3436 // cartesian (common-space, Web Mercator) and lnglat (degrees, GlobeView) — 3437 // project_position_to_clipspace handles each coordinate system. 3438 gl_Position = project_position_to_clipspace(pos + instancePositions, positions64Low + instancePositions64Low, vec3(0.0), position_commonspace); 3439 geometry.position = position_commonspace; 3440 3441 geometry.normal = normals_commonspace; 3442 DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 3443 3444 DECKGL_FILTER_COLOR(vColor, geometry); 3445} 3446`,rk={...rF.defaultProps,renderPipeline:{type:"array",value:[],compare:!0},_instanced:!1,getPosition:{type:"accessor",value:[0,0,0]},material:{ambient:1,diffuse:0,shininess:0,specularColor:[0,0,0]}};class rU extends rF{static layerName="mesh-texture-layer";static defaultProps=rk;initializeState(){super.initializeState();let e=this.getAttributeManager();e&&e.add({positions64Low:{size:3,type:"float32",noAlloc:!0}})}_resolveRenderPipeline(){let{image:e,renderPipeline:t}=this.props;return[...e?[{module:rD,props:{textureName:e}}]:[],...t??[]]}updateState(e){this.hasRenderPipelineChanged(e)&&(e.changeFlags.extensionsChanged=!0),super.updateState(e)}hasRenderPipelineChanged(e){let{oldProps:t,props:i}=e;if(!!t.image!=!!i.image)return!0;let r=t.renderPipeline??[],s=i.renderPipeline??[];if(r.length!==s.length)return!0;for(let e=0;e<r.length;e++)if(r[e]?.module.name!==s[e]?.module.name)return!0;return!1}getShaders(){let e=super.getShaders(),t=e.modules;for(let e of this._resolveRenderPipeline())t.push(e.module);return{...e,vs:rG,fs:rB,modules:t}}draw(e){let t={};for(let e of this._resolveRenderPipeline())t[e.module.name]=e.props||{};for(let e of super.getModels())e.shaderInputs.setProps(t);super.draw(e)}}let rz=[[252,73,163],[255,51,204],[204,102,255],[153,51,255],[102,204,255],[51,153,255],[102,255,204],[51,255,170],[0,255,0],[51,204,51],[255,204,102],[255,179,71],[255,102,102],[255,80,80],[255,0,0],[204,0,0],[255,128,0],[255,153,51],[255,255,102],[255,255,51],[0,255,255],[0,204,255]],rj={image:{type:"image",value:null,async:!0},renderPipeline:{type:"array",value:[],compare:!0},debug:!1,debugOpacity:.5};class rV extends c{static layerName="RasterLayer";static defaultProps=rj;initializeState(){this.setState({})}updateState(e){super.updateState(e);let{props:t,oldProps:i,changeFlags:r}=e,s=t.reprojectionFns.forwardTransform!==i.reprojectionFns?.forwardTransform||t.reprojectionFns.inverseTransform!==i.reprojectionFns?.inverseTransform||t.reprojectionFns.forwardReproject!==i.reprojectionFns?.forwardReproject||t.reprojectionFns.inverseReproject!==i.reprojectionFns?.inverseReproject;(r.dataChanged||t.width!==i.width||t.height!==i.height||s||t.maxError!==i.maxError||t.initialTriangulation!==i.initialTriangulation)&&this._generateMesh()}_generateMesh(){let{width:e,height:t,reprojectionFns:i,initialTriangulation:r,maxError:s=.125}=this.props;if(this.context?.viewport?.resolution!==void 0){let{indices:r,positions64High:s,positions64Low:n,texCoords:o}=function(e,t,i,r=32){let{forwardTransform:s,forwardReproject:n}=e,o=(r+1)*(r+1),a=new Float64Array(3*o),l=new Float32Array(2*o),h=0;for(let e=0;e<=r;e++)for(let o=0;o<=r;o++){let u=o/r,c=e/r,[d,f]=s(u*(t-1),c*(i-1)),[p,g]=n(d,f);a[3*h]=p,a[3*h+1]=g,a[3*h+2]=0,l[2*h]=u,l[2*h+1]=c,h++}let[u,c]=rv(a),d=new Uint32Array(r*r*6),f=0;for(let e=0;e<r;e++)for(let t=0;t<r;
3446t++){let i=e*(r+1)+t,s=i+1,n=i+(r+1),o=n+1;d[f++]=i,d[f++]=n,d[f++]=s,d[f++]=s,d[f++]=n,d[f++]=o}return{indices:d,positions64High:c,positions64Low:u,texCoords:l}}(i,e+1,t+1);this.setState({reprojector:void 0,mesh:{indices:{value:r,size:1},attributes:{POSITION:{value:s,size:3},TEXCOORD_0:{value:o,size:2}}},positions64Low:n});return}let n=new ry(i,e+1,t+1,{initialTriangulation:r});n.run(s);let{indices:o,positions64High:a,positions64Low:l,texCoords:h}=function(e){let t=e.uvs.length/2,i=new Float32Array(e.uvs),r=new Float64Array(3*t);for(let i=0;i<t;i++)r[3*i]=e.exactOutputPositions[2*i],r[3*i+1]=e.exactOutputPositions[2*i+1],r[3*i+2]=0;let[s,n]=rv(r);return{indices:new Uint32Array(e.triangles),positions64High:n,positions64Low:s,texCoords:i}}(n);this.setState({reprojector:n,mesh:{indices:{value:o,size:1},attributes:{POSITION:{value:a,size:3},TEXCOORD_0:{value:h,size:2}}},positions64Low:l})}renderDebugLayer(){let{reprojector:e}=this.state,{debugOpacity:t}=this.props;return e?new rp(this.getSubLayerProps({id:"polygon",data:{reprojector:e,length:e.triangles.length/3},getPolygon:(t,{index:i,data:r})=>{let s=r.reprojector.triangles,n=e.exactOutputPositions,o=s[3*i],a=s[3*i+1],l=s[3*i+2];return[[n[2*o],n[2*o+1]],[n[2*a],n[2*a+1]],[n[2*l],n[2*l+1]],[n[2*o],n[2*o+1]]]},getFillColor:(e,{index:t,target:i})=>{let r=rz[t%rz.length];return i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=255,i},getLineColor:[0,0,0],getLineWidth:1,lineWidthUnits:"pixels",opacity:void 0!==t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):1,pickable:!1})):null}renderLayers(){let{mesh:e,positions64Low:t}=this.state,{debug:i,image:r,renderPipeline:s}=this.props;if(!e||!t||!r&&(s?.length??0)===0)return null;let n=[new rU(this.getSubLayerProps({id:"raster",image:r,renderPipeline:s,data:{length:1,attributes:{positions64Low:t}},mesh:e,getColor:[255,255,255]}))];if(i){let e=this.renderDebugLayer();e&&n.push(e)}return n}}function rW(e,t,i,r,s,n={}){let{densifyPts:o=21}=n,a=[t,r,r,t],l=[i,i,s,s],h=1/0,u=1/0,c=-1/0,d=-1/0;for(let t=0;t<4;t++){let i=a[t],r=l[t],s=a[(t+1)%4],n=l[(t+1)%4];for(let t=0;t<=o;t++){let a=t/(o+1),[l,f]=e(i+(s-i)*a,r+(n-r)*a);l<h&&(h=l),f<u&&(u=f),l>c&&(c=l),f>d&&(d=f)}}return[h,u,c,d]}class r${entries=new Map;maxEntries;constructor({maxEntries:e=65536}={}){this.maxEntries=Math.max(0,e)}get size(){return this.entries.size}get(e,t,i){let r=`${e}/${t}/${i}`,s=this.entries.get(r);if(void 0!==s)return this.entries.delete(r),this.entries.set(r,s),s}set(e,t,i,r){let s=`${e}/${t}/${i}`;this.entries.delete(s),this.entries.set(s,r)}clear(){this.entries.clear()}sweep(){if(this.entries.size<=this.maxEntries)return;let e=Math.floor(this.maxEntries/2),t=this.entries.size-e,i=[];for(let e of this.entries.keys())if(i.push(e),i.length>=t)break;for(let e of i)this.entries.delete(e)}}let rH=[[.5,.5],[0,0],[0,1],[1,0],[1,1]].concat([[0,.5],[.5,0],[1,.5],[.5,1]]),rq=rH.concat([[.25,.5],[.75,.5]]),rK=2*Math.PI*6378137,rX=rK/2;class rY{x;y;z;descriptor;childVisible;selected;_children;constructor(e,t,i,{descriptor:r}){this.x=e,this.y=t,this.z=i,this.descriptor=r}get level(){return this.descriptor.levels[this.z]}get children(){if(!this._children){let e=this.descriptor.levels.length-1;if(this.z>=e)return this._children=null,null;let t=this.z+1,i=this.descriptor.levels[t],r=function({topLeft:e,topRight:t,bottomLeft:i,bottomRight:r}){let s=[e[0],t[0],i[0],r[0]],n=[e[1],t[1],i[1],r[1]];return[Math.min(...s),Math.min(...n),Math.max(...s),Math.max(...n)]}(this.level.projectedTileCorners(this.x,this.y)),{minCol:s,maxCol:n,minRow:o,maxRow:a}=i.crsBoundsToTileRange(...r),l=[],{descriptor:h}=this;for(let e=o;e<=a;e++)for(let i=s;i<=n;i++)l.push(new rY(i,e,t,{descriptor:h}));this._children=l.length>0?l:null}return this._children}update(e){let{viewport:t,cullingVolume:i,elevationBounds:r,minZ:s,maxZ:n=this.descriptor.levels.length-1,project:o,bounds:a,pixelRatio:l,worldOffset:h=0,boundingVolumeCache:u}=e;0===h&&(this.childVisible=!1,this.selected=!1);let{boundingVolume:c,commonSpaceBounds:d}=this.getBoundingVolume(r,o,u,h);if(a){let e=this.getBoundingVolume(r,o,u,0);if(!this.insideBounds(a,e.commonSpaceBounds))return!1}if(0>i.computeVisibility(c))return!1;let f=this.children;if(!this.childVisible&&this.z>=s){let e=function(e,t){let[i,r,s,n]=e,[,o]=(0,i4.iV)([(i+s)/2,(r+n)/2]);return 40075016.686*Math.cos(o*Math.PI/180)/2**(t+8)}(d,t.zoom);if(this.level.metersPerPixel*l/e<=1||this.z>=n||null===f&&this.z>=s)return this.selected=!0,!0}if(f&&f.length>0){0===h&&(this.selected=!1);let t=!1;for(let i of f)i.update(e)&&(t=!0);return t&&(this.childVisible=!0),t}return!0}getSelected(e=[]){if(this.selected&&e.push(this),this._children)for(let t of this._children)t.getSelected(e);return e}insideBounds(e,t){let[i,r,s,n]=e,[o,a,l,h]=t;return o<s&&l>i&&a<n&&h>r}getBoundingVolume(e,t,i,r=0){let s,n=i.get(this.z,this.x,this.y);return(n&&n.zRange[0]===e[0]&&n.zRange[1]===e[1]?s=n:(s=this.computeBoundingVolume(e,t),i.set(this.z,this.x,this.y,{zRange:e,...s})),0===r)?s:function(e,t){let{boundingVolume:i,commonSpaceBounds:r}=e,s=i.center;
3446return{boundingVolume:new iN(new tQ.P((s[0]??0)+t,s[1]??0,s[2]??0),i.halfAxes),commonSpaceBounds:[r[0]+t,r[1],r[2]+t,r[3]]}}(s,512*r)}computeBoundingVolume(e,t){return t?this._getGlobeBoundingVolume(t):this._getGenericBoundingVolume(e)}_getGenericBoundingVolume(e){let[t,i]=e,r=(function(e,t,i,r){let{topLeft:s,topRight:n,bottomLeft:o,bottomRight:a}=t,l=(e,t)=>{let[s,n]=i(e,t);if(Number.isFinite(s)&&Number.isFinite(n))return[s,n];let[o,a]=r(e,t);return[o*Math.PI*6378137/180,6378137*Math.log(Math.tan(Math.PI/4+Math.max(-85.05112877980659,Math.min(85.05112877980659,a))*Math.PI/180/2))]},h=[];for(let[t,i]of e){let[e,r]=rJ(s,n,o,a,t,i);h.push(l(e,r))}return h})(rH,this.level.projectedTileCorners(this.x,this.y),this.descriptor.projectTo3857,this.descriptor.projectTo4326).map(e=>rZ(e)),s=[];for(let e of r)s.push([e[0],e[1],t]),t!==i&&s.push([e[0],e[1],i]);let n=1/0,o=1/0,a=-1/0,l=-1/0;for(let[e,t]of r)e<n&&(n=e),t<o&&(o=t),e>a&&(a=e),t>l&&(l=t);let h=[n,o,a,l];return{boundingVolume:i2(s),commonSpaceBounds:h}}_getGlobeBoundingVolume(e){let t=function(e,t,i){let{topLeft:r,topRight:s,bottomLeft:n,bottomRight:o}=t,a=[];for(let[t,l]of e){let[e,h]=rJ(r,s,n,o,t,l);a.push(i(e,h))}return a}(rq,this.level.projectedTileCorners(this.x,this.y),this.descriptor.projectTo4326),i=[],r=1/0,s=1/0,n=-1/0,o=-1/0;for(let[a,l]of t){let t=e([a,l,0]);i.push([t[0],t[1],t[2]]);let[h,u]=(0,i4.Gw)([a,l]);h<r&&(r=h),u<s&&(s=u),h>n&&(n=h),u>o&&(o=u)}return{boundingVolume:i2(i),commonSpaceBounds:[r,s,n,o]}}}function rZ([e,t]){return[(e/rK+.5)*512,(Math.max(-rX,Math.min(rX,t))/rK+.5)*512]}function rQ(e,t,i){let r=!1;for(let s of e)s.update({...t,worldOffset:i})&&(r=!0);return r}function rJ(e,t,i,r,s,n){let o=(1-s)*(1-n),a=s*(1-n),l=(1-s)*n,h=s*n;return[e[0]*o+t[0]*a+i[0]*l+r[0]*h,e[1]*o+t[1]*a+i[1]*l+r[1]*h]}class r0 extends rl{descriptor;wgs84Bounds;getPixelRatio;boundingVolumeCache;projectPosition;unprojectPosition;lastViewportIsGlobe;constructor(e,t,{getPixelRatio:i,maxBoundingVolumeCacheSize:r}={}){super(e),this.descriptor=t,this.getPixelRatio=i??(()=>1),this.boundingVolumeCache=new r$({maxEntries:r}),this.projectPosition=(e,i)=>rZ(t.projectTo3857(e,i)),this.unprojectPosition=(e,i)=>{let[r,s]=function([e,t]){return[(e/512-.5)*rK,(t/512-.5)*rK]}([e,i]);return t.projectFrom3857(r,s)};let s=rW(this.descriptor.projectTo4326,...this.descriptor.projectedBounds);this.wgs84Bounds=[s[0],Math.max(s[1],-85.0511287798066),s[2],Math.min(s[3],85.0511287798066)]}getTileIndices(e){let{viewport:t,minZoom:i}=e,r=!!(t instanceof tX.Ay&&t.resolution);if(void 0!==this.lastViewportIsGlobe&&this.lastViewportIsGlobe!==r&&this.boundingVolumeCache.clear(),this.lastViewportIsGlobe=r,"number"==typeof i&&t.zoom<i)return[];let s=this.descriptor.levels.length-1,n="number"==typeof e.maxZoom?Math.min(e.maxZoom,s):s,o=function(e,t){let{viewport:i,maxZ:r,zRange:s,wgs84Bounds:n,pixelRatio:o=1}=t,a=t.boundingVolumeCache??new r$;a.sweep();let l=i instanceof tX.Ay&&i.resolution?i.projectPosition:null,h=new ij(Object.values(i.getFrustumPlanes()).map(({normal:e,distance:t})=>new iG(e.clone().negate(),t))),u=i.distanceScales.unitsPerMeter[2],c=s&&s[0]*u||0,d=s&&s[1]*u||0,[f,p,g,m]=n,_=(0,i4.Gw)([f,p]),y=(0,i4.Gw)([g,m]),v=[_[0],_[1],y[0],y[1]],b=function(e){let{descriptor:t,viewport:i,datasetWgs84Bounds:r}=e,s=t.levels[0],n=[];if(s.matrixWidth*s.matrixHeight<=100){for(let e=0;e<s.matrixHeight;e++)for(let i=0;i<s.matrixWidth;i++)n.push(new rY(i,e,0,{descriptor:t}));return n}let o=i.getBounds(),a=[Math.max(r[0],o[0]),Math.max(r[1],o[1]),Math.min(r[2],o[2]),Math.min(r[3],o[3])];if(a[0]>a[2]||a[1]>a[3])return n;let[l,h,u,c]=rW(t.projectFrom4326,a[0],a[1],a[2],a[3]),d=s.crsBoundsToTileRange(l,h,u,c);for(let e=d.minRow;e<=d.maxRow;e++)for(let i=d.minCol;i<=d.maxCol;i++)n.push(new rY(i,e,0,{descriptor:t}));return n}({descriptor:e,viewport:i,datasetWgs84Bounds:n}),E={viewport:i,project:l,cullingVolume:h,elevationBounds:[c,d],minZ:0,maxZ:r,bounds:v,pixelRatio:o,boundingVolumeCache:a};for(let e of b)e.update(E);if((i.subViewports?.length??0)>1){for(let e=-1;e>=-3&&rQ(b,E,e);e--);for(let e=1;e<=3&&rQ(b,E,e);e++);}let x=[];for(let e of b)e.getSelected(x);return x}(this.descriptor,{viewport:t,maxZ:n,zRange:e.zRange??null,wgs84Bounds:this.wgs84Bounds,pixelRatio:this.getPixelRatio(),boundingVolumeCache:this.boundingVolumeCache});return this.sortTileIndicesByDistance(o,t)}sortTileIndicesByDistance(e,t){let{maxRequests:i}=this.opts;if(e.length<=i)return e;let r=this.descriptor,[s,n,o,a]=t.getBounds();return function(e,t){let i=e.length;if(i<2)return e;let{getCenter:r,reference:s}=t,n=s[0],o=s[1],a=new Float64Array(i);for(let t=0;t<i;t++){let i=r(e[t]),s=i[0]-n,l=i[1]-o;a[t]=s*s+l*l}let l=new Uint32Array(i);for(let e=0;e<i;e++)l[e]=e;l.sort((e,t)=>
3446a[e]-a[t]);let h=e.slice();for(let t=0;t<i;t++)e[t]=h[l[t]];return e}(e,{reference:[(s+o)/2,(n+a)/2],getCenter:e=>{let{x:t,y:i,z:s}=e,{topLeft:n,bottomRight:o}=r.levels[s].projectedTileCorners(t,i),a=[(n[0]+o[0])/2,(n[1]+o[1])/2];return r.projectTo4326(a[0],a[1])}})}getTileId(e){return`${e.x}-${e.y}-${e.z}`}getParentIndex(e){if(0===e.z)return e;let t=this.descriptor.levels[e.z],i=this.descriptor.levels[e.z-1],r=i.metersPerPixel*i.tileWidth,s=i.metersPerPixel*i.tileHeight,n=t.metersPerPixel*t.tileWidth,o=t.metersPerPixel*t.tileHeight;return{x:Math.floor(e.x/(r/n)),y:Math.floor(e.y/(s/o)),z:e.z-1}}getTileZoom(e){return e.z}getTileMetadata(e){let{x:t,y:i,z:r}=e,s=this.descriptor.levels[r],{tileHeight:n,tileWidth:o}=s,{topLeft:a,topRight:l,bottomLeft:h,bottomRight:u}=s.projectedTileCorners(t,i),c=[Math.min(a[0],l[0],h[0],u[0]),Math.min(a[1],l[1],h[1],u[1]),Math.max(a[0],l[0],h[0],u[0]),Math.max(a[1],l[1],h[1],u[1])],[d,f,p,g]=rW(this.descriptor.projectTo4326,...c),{forwardTransform:m,inverseTransform:_}=s.tileTransform(t,i),y=e=>this.descriptor.projectTo4326(e[0],e[1])[1],v=function(e,t=85.05112877980659){let{topLeft:i,topRight:r,bottomLeft:s,bottomRight:n}=e;if(!(1e-6>Math.abs(i-r)&&1e-6>Math.abs(s-n))||1e-6>=Math.abs(s-i)||i<=t&&i>=-t&&s<=t&&s>=-t)return;let o=e=>Math.max(0,Math.min(1,e)),a=(t-i)/(s-i),l=(-t-i)/(s-i),h=o(Math.min(a,l)),u=o(Math.max(a,l));if(!(u-h<1e-6))return rm(0,h,1,u)}({topLeft:y(a),topRight:y(l),bottomLeft:y(h),bottomRight:y(u)});return{bbox:{west:d,south:f,east:p,north:g},projectedBbox:{left:c[0],bottom:c[1],right:c[2],top:c[3]},projectedCorners:{topLeft:a,topRight:l,bottomLeft:h,bottomRight:u},tileWidth:o,tileHeight:n,forwardTransform:m,inverseTransform:_,_projectPosition:this.projectPosition,_unprojectPosition:this.unprojectPosition,_webMercatorInitialTriangulation:v}}}let r1={...rc.defaultProps,maxError:.125,debug:!1,debugOpacity:.5};class r3 extends c{static layerName="RasterTileLayer";static defaultProps=r1;_tilesetDescriptor(){return this.props.tilesetDescriptor}_getTileDataCallback(){return this.props.getTileData}_renderTileCallback(){return this.props.renderTile}_renderDebug(e,t){let i=this._tilesetDescriptor();return i?function(e,t,i){let{projectedCorners:r}=t,{topLeft:s,topRight:n,bottomRight:o,bottomLeft:a}=r,l=i(s[0],s[1]),h=i(n[0],n[1]),u=i(o[0],o[1]),c=[l,h,u,i(a[0],a[1]),l],d=new eC({id:`${e}-label`,data:[{position:[(l[0]+u[0])/2,(l[1]+u[1])/2],text:`x=${t.index.x} y=${t.index.y} z=${t.index.z}`}],getColor:[255,255,255,255],getSize:24,sizeUnits:"pixels",outlineWidth:3,outlineColor:[0,0,0,255],fontSettings:{sdf:!0}});return[new e4({id:e,data:[c],getPath:e=>e,getColor:[255,0,0,255],getWidth:2,widthUnits:"pixels",pickable:!1}),d]}(`${this.id}-${e.id}-bounds`,e,i.projectTo4326):[]}renderLayers(){let e=this._tilesetDescriptor(),t=this._getTileDataCallback(),i=this._renderTileCallback();return e&&t&&i?this._renderTileLayer(e,t,i):null}_renderTileLayer(e,t,i){let r=this.context.device;class s extends r0{constructor(t){super(t,e,{getPixelRatio:()=>{let e=r.getDefaultCanvasContext(),[t]=e.getDrawingBufferSize(),[i]=e.getCSSSize();return i?t/i:1}})}}let{tileSize:n,zoomOffset:o,maxZoom:a,minZoom:l,extent:h,debounceTime:u,maxCacheSize:c,maxCacheByteSize:d,maxRequests:f,refinementStrategy:p,updateTriggers:g,onTileError:m,onTileLoad:_,onTileUnload:y,onViewportLoad:v}=this.props;return new rc({id:`raster-tile-layer-${this.id}`,TilesetClass:s,getTileData:e=>this._wrapGetTileData(e,t),renderSubLayers:t=>this._renderSubLayers(t,e,i),updateTriggers:{renderSubLayers:g?.renderTile},tileSize:n,zoomOffset:o,maxZoom:a,minZoom:l,extent:h,debounceTime:u,maxCacheSize:c,maxCacheByteSize:d,maxRequests:f,refinementStrategy:p,onTileError:m,onTileLoad:_,onTileUnload:y,onViewportLoad:v})}async _wrapGetTileData(e,t){let{signal:i}=e,r=this.props.signal,s=r&&i?AbortSignal.any([r,i]):r??i;return t(e,{device:this.context.device,signal:s})}_renderSubLayers(e,t,i){let r,s,{maxError:n,debug:o,debugOpacity:a}=this.props,l=e.tile,h=o?this._renderDebug(l,e.data??null):[];if(!e.data)return h;let{forwardTransform:u,inverseTransform:c}=l,d=i(e.data);if(!d)return h;let{image:f,renderPipeline:p}=d,{width:g,height:m}=e.data,_=void 0!==this.context.viewport.resolution;if(_)r={forwardTransform:u,inverseTransform:c,forwardReproject:t.projectTo4326,inverseReproject:t.projectFrom4326},s="lnglat";else{let{_projectPosition:e,_unprojectPosition:t}=l;r={forwardTransform:u,inverseTransform:c,forwardReproject:e,inverseReproject:t},s="cartesian"}return[new rV(this.getSubLayerProps({id:`${e.id}-raster`,width:g,height:m,...void 0!==f&&{image:f},renderPipeline:p,maxError:n,reprojectionFns:r,initialTriangulation:_?void 0:l._webMercatorInitialTriangulation,debug:o,debugOpacity:a,coordinateSystem:s})),...h]}}var r2=i(3991);class r4{worker;jobIdCounter=0;jobs=new Map;constructor(e){this.worker=e,this.worker.addEventListener("message",e=>this.onMessage(e))}get jobCount(){return this.jobs.size}onMessage(e){let{jobId:t,error:i,pixels:r}=e.data,s=this.jobs.get(t);this.jobs.delete(t),s&&(i?s.reject(Error(i)):s.resolve(r))}submitJob(e,t){let i=this.jobIdCounter++;return new Promise((r,s)=>{this.jobs.set(i,{resolve:r,reject:s}),this.worker.postMessage({...e,jobId:i},{transfer:t})})}terminate(){this.worker.terminate()}}let r6="undefined"!=typeof navigator?navigator.hardwareConcurrency??2:2;class r8{workerWrappers;constructor(e={}){let{size:t=r6,createWorker:i}=e;if(this.workerWrappers=[],i&&t>0)for(let e=0;e<t;e++)this.workerWrappers.push(new r4(i()))}get hasWorkers(){return this.workerWrappers.length>0}async decode(e,t,i){if(!this.hasWorkers)return(0,r2.D4)(e,t,i);let r=this.leastLoaded();return await r.submitJob({compression:t,metadata:i,buffer:e},[e])}destroy(){for(let e of this.workerWrappers)e.terminate();this.workerWrappers.length=0}leastLoaded(){let e=this.workerWrappers[0];for(let t=1;t<this.workerWrappers.length;t++)this.workerWrappers[t].jobCount<e.jobCount&&(e=this.workerWrappers[t]);return e}}let r5=null;var r7=i(2186);let r9=new Map;async function se(e){let t=`EPSG:${e}`,i=r9.get(t);if(void 0!==i)return i;let r=await st(e),s=(0,r7._)(r);return r9.set(t,s),s}async function st(e){let t=`https://epsg.io/${e}.json`,i=await fetch(t);if(!i.ok)throw Error(`Failed to fetch PROJJSON from ${t}`);return await i.json()}var si=Math.PI/2,sr=Math.PI/4,ss=2*Math.PI,sn={};sn.greenwich=0,sn.lisbon=-9.131906111111,sn.paris=2.337229166667,sn.bogota=-74.080916666667,sn.madrid=-3.687938888889,sn.rome=12.452333333333,sn.bern=7.439583333333,sn.jakarta=106.807719444444,sn.ferro=-17.666666666667,sn.brussels=4.367975,sn.stockholm=18.058277777778,sn.athens=23.7163375,sn.oslo=10.722916666667;let so={mm:{to_meter:.001},cm:{to_meter:.01},ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937},fath:{to_meter:1.8288},kmi:{to_meter:1852},"us-ch":{to_meter:20.1168402336805},"us-mi":{to_meter:1609.34721869444},km:{to_meter:1e3},"ind-ft":{to_meter:.30479841},"ind-yd":{to_meter:.91439523},mi:{to_meter:1609.344},yd:{to_meter:.9144},ch:{to_meter:20.1168},link:{to_meter:.201168},dm:{to_meter:.1},in:{to_meter:.0254},"ind-ch":{to_meter:20.11669506},"us-in":{to_meter:.025400050800101},"us-yd":{to_meter:.914401828803658}};var sa=/[\s_\-\/\(\)]/g;function sl(e,t){if(e[t])return e[t];for(var i,r=Object.keys(e),s=t.toLowerCase().replace(sa,""),n=-1;++n<r.length;)if((i=r[n]).toLowerCase().replace(sa,"")===s)return e[i]}function sh(e){var t,i,r,s={},n=e.split("+").map(function(e){return e.trim()}).filter(function(e){return e}).reduce(function(e,t){var i=t.split("=");return i.push(!0),e[i[0].toLowerCase()]=i[1],e},{}),o={proj:"projName",datum:"datumCode",rf:function(e){s.rf=parseFloat(e)},lat_0:function(e){s.lat0=.017453292519943295*e},lat_1:function(e){s.lat1=.017453292519943295*e},lat_2:function(e){s.lat2=.017453292519943295*e},lat_ts:function(e){s.lat_ts=.017453292519943295*e},lon_0:function(e){s.long0=.017453292519943295*e},lon_1:function(e){s.long1=.017453292519943295*e},lon_2:function(e){s.long2=.017453292519943295*e}
3446,alpha:function(e){s.alpha=.017453292519943295*parseFloat(e)},gamma:function(e){s.rectified_grid_angle=.017453292519943295*parseFloat(e)},lonc:function(e){s.longc=.017453292519943295*e},x_0:function(e){s.x0=parseFloat(e)},y_0:function(e){s.y0=parseFloat(e)},k_0:function(e){s.k0=parseFloat(e)},k:function(e){s.k0=parseFloat(e)},a:function(e){s.a=parseFloat(e)},b:function(e){s.b=parseFloat(e)},r:function(e){s.a=s.b=parseFloat(e)},r_a:function(){s.R_A=!0},zone:function(e){s.zone=parseInt(e,10)},south:function(){s.utmSouth=!0},towgs84:function(e){s.datum_params=e.split(",").map(function(e){return parseFloat(e)})},to_meter:function(e){s.to_meter=parseFloat(e)},units:function(e){s.units=e;var t=sl(so,e);t&&(s.to_meter=t.to_meter)},from_greenwich:function(e){s.from_greenwich=.017453292519943295*e},pm:function(e){s.from_greenwich=.017453292519943295*(sl(sn,e)||parseFloat(e))},nadgrids:function(e){"@null"===e?s.datumCode="none":s.nadgrids=e},axis:function(e){var t="ewnsud";3===e.length&&-1!==t.indexOf(e.substr(0,1))&&-1!==t.indexOf(e.substr(1,1))&&-1!==t.indexOf(e.substr(2,1))&&(s.axis=e)},approx:function(){s.approx=!0},over:function(){s.over=!0}};for(t in n)i=n[t],t in o?"function"==typeof(r=o[t])?r(i):s[r]=i:s[t]=i;return"string"==typeof s.datumCode&&"WGS84"!==s.datumCode&&(s.datumCode=s.datumCode.toLowerCase()),s.projStr=e,s}var su=i(38809);function sc(e){var t=this;if(2==arguments.length){var i=arguments[1];"string"==typeof i?"+"===i.charAt(0)?sc[e]=sh(arguments[1]):sc[e]=(0,su.A)(arguments[1]):!i||"object"!=typeof i||"projName"in i?(sc[e]=i,i||delete sc[e]):sc[e]=(0,su.A)(arguments[1])}else if(1==arguments.length){if(Array.isArray(e))return e.map(function(e){return Array.isArray(e)?sc.apply(t,e):sc(e)});if("string"==typeof e){if(e in sc)return sc[e]}else"EPSG"in e?sc["EPSG:"+e.EPSG]=e:"ESRI"in e?sc["ESRI:"+e.ESRI]=e:"IAU2000"in e?sc["IAU2000:"+e.IAU2000]=e:console.log(e);return}}!function(e){e("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),e("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),e("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs");for(var t=1;t<=60;++t)e("EPSG:"+(32600+t),"+proj=utm +zone="+t+" +datum=WGS84 +units=m"),e("EPSG:"+(32700+t),"+proj=utm +zone="+t+" +south +datum=WGS84 +units=m");e("EPSG:5041","+title=WGS 84 / UPS North (E,N) +proj=stere +lat_0=90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m"),e("EPSG:5042","+title=WGS 84 / UPS South (E,N) +proj=stere +lat_0=-90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m"),e.WGS84=e["EPSG:4326"],e["EPSG:3785"]=e["EPSG:3857"],e.GOOGLE=e["EPSG:3857"],e["EPSG:900913"]=e["EPSG:3857"],e["EPSG:102113"]=e["EPSG:3857"]}(sc);var sd=["3857","900913","3785","102113"];let sf=function(e){let t;if("string"==typeof e)if(e in sc)t=sc[e];else if((0===e.indexOf("+")||-1===e.indexOf("["))&&("object"!=typeof e||"srsCode"in e))"+"===e[0]&&(t=sh(e));else{var i=function(e){var t=sl(e,"extension");if(t)return sl(t,"proj4")}(t=(0,su.A)(e));i&&(t=sh(i))}else t="projName"in e?e:(0,su.A)(e);return t&&function(e){if(e.title)return 0===e.title.toLowerCase().indexOf("epsg:")&&sd.indexOf(e.title.substr(5))>-1;var t=sl(e,"authority");if(t){var i=sl(t,"epsg");return i&&sd.indexOf(i)>-1}}(t)?sc["EPSG:3857"]:t};function sp(e,t){var i,r;if(e=e||{},!t)return e;for(r in t)void 0!==(i=t[r])&&(e[r]=i);return e}function sg(e,t,i){var r=e*t;return i/Math.sqrt(1-r*r)}function sm(e){return e<0?-1:1}function s_(e,t){return t||3.14159265359>=Math.abs(e)?e:e-sm(e)*ss}function sy(e,t,i){var r=e*i;return Math.tan(.5*(si-t))/(r=Math.pow((1-r)/(1+r),.5*e))}function sv(e,t){for(var i,r,s=.5*e,n=si-2*Math.atan(t),o=0;o<=15;o++)if(r=si-2*Math.atan(t*Math.pow((1-(i=e*Math.sin(n)))/(1+i),s))-n,n+=r,1e-10>=Math.abs(r))return n;return -9999}function sb(e){return e}var sE=["longlat","identity"],sx=[{init:function(){var e=this.b/this.a;this.es=1-e*e,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=sg(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)},forward:function(e){var t,i,r=e.x,s=e.y;if(57.29577951308232*s>90&&57.29577951308232*s<-90&&57.29577951308232*r>180&&57.29577951308232*r<-180||1e-10>=Math.abs(Math.abs(s)-si))return null;if(this.sphere)t=this.x0+this.a*this.k0*s_(r-this.long0,this.over),i=this.y0+this.a*this.k0*Math.log(Math.tan(sr+.5*s));else{var n=Math.sin(s),o=sy(this.e,s,n);t=this.x0+this.a*this.k0*s_(r-this.long0,this.over),i=this.y0-this.a*this.k0*Math.log(o)}return e.x=t,e.y=i,e},inverse:function(e){var t,i=e.x-this.x0,r=e.y-this.y0;if(this.sphere)t=si-2*Math.atan(Math.exp(-r/(this.a*this.k0)));else{var s=Math.exp(-r/(this.a*this.k0));if(-9999===(t=sv(this.e,s)))return null}return e.x=s_(this.long0+i/(this.a*this.k0),this.over),e.y=t,e},names:["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","Mercator_Variant_A","merc"]},{init:function(){},forward:sb,inverse:sb,names:sE}],sw={},sS=[];function sP(e,t){var i=sS.length;
3446return e.names?(sS[i]=e,e.names.forEach(function(e){sw[e.toLowerCase()]=i}),this):(console.log(t),!0)}function sT(e){return e.replace(/[-\(\)\s]+/g," ").trim().replace(/ /g,"_")}let sA={MERIT:{a:6378137,rf:298.257,ellipseName:"MERIT 1983"},SGS85:{a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},GRS80:{a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},IAU76:{a:6378140,rf:298.257,ellipseName:"IAU 1976"},airy:{a:6377563.396,b:6356256.91,ellipseName:"Airy 1830"},APL4:{a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},NWL9D:{a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},mod_airy:{a:6377340.189,b:6356034.446,ellipseName:"Modified Airy"},andrae:{a:6377104.43,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},aust_SA:{a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},GRS67:{a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},bessel:{a:6377397.155,rf:299.1528128,ellipseName:"Bessel 1841"},bess_nam:{a:6377483.865,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},clrk66:{a:6378206.4,b:6356583.8,ellipseName:"Clarke 1866"},clrk80:{a:6378249.145,rf:293.4663,ellipseName:"Clarke 1880 mod."},clrk80ign:{a:6378249.2,b:6356515,rf:293.4660213,ellipseName:"Clarke 1880 (IGN)"},clrk58:{a:6378293.645208759,rf:294.2606763692654,ellipseName:"Clarke 1858"},CPM:{a:6375738.7,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},delmbr:{a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},engelis:{a:6378136.05,rf:298.2566,ellipseName:"Engelis 1985"},evrst30:{a:6377276.345,rf:300.8017,ellipseName:"Everest 1830"},evrst48:{a:6377304.063,rf:300.8017,ellipseName:"Everest 1948"},evrst56:{a:6377301.243,rf:300.8017,ellipseName:"Everest 1956"},evrst69:{a:6377295.664,rf:300.8017,ellipseName:"Everest 1969"},evrstSS:{a:6377298.556,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},fschr60:{a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},fschr60m:{a:6378155,rf:298.3,ellipseName:"Fischer 1960"},fschr68:{a:6378150,rf:298.3,ellipseName:"Fischer 1968"},helmert:{a:6378200,rf:298.3,ellipseName:"Helmert 1906"},hough:{a:6378270,rf:297,ellipseName:"Hough"},intl:{a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},kaula:{a:6378163,rf:298.24,ellipseName:"Kaula 1961"},lerch:{a:6378139,rf:298.257,ellipseName:"Lerch 1979"},mprts:{a:6397300,rf:191,ellipseName:"Maupertius 1738"},new_intl:{a:6378157.5,b:6356772.2,ellipseName:"New International 1967"},plessis:{a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},krass:{a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},SEasia:{a:6378155,b:6356773.3205,ellipseName:"Southeast Asia"},walbeck:{a:6376896,b:6355834.8467,ellipseName:"Walbeck"},WGS60:{a:6378165,rf:298.3,ellipseName:"WGS 60"},WGS66:{a:6378145,rf:298.25,ellipseName:"WGS 66"},WGS7:{a:6378135,rf:298.26,ellipseName:"WGS 72"},WGS84:{a:6378137,rf:298.257223563,ellipseName:"WGS 84"},sphere:{a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"}}
3446,sM=sA.WGS84;var sC={wgs84:{towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},ch1903:{towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},ggrs87:{towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},nad83:{towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},nad27:{nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},potsdam:{towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},carthage:{towgs84:"-263.0,6.0,431.0",ellipse:"clark80
vendor: 19,713 bytes, line 3446
3446",datumName:"Carthage 1934 Tunisia"},hermannskogel:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"},mgi:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Militar-Geographische Institut"},osni52:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},ire65:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},rassadiran:{towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},nzgd49:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},osgb36:{towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Ordnance Survey of Great Britain 1936"},s_jtsk:{towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},beduaram:{towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},gunung_segara:{towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},rnb72:{towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"},EPSG_5451:{towgs84:"6.41,-49.05,-11.28,1.5657,0.5242,6.9718,-5.7649"},IGNF_LURESG:{towgs84:"-192.986,13.673,-39.309,-0.4099,-2.9332,2.6881,0.43"},EPSG_4614:{towgs84:"-119.4248,-303.65872,-11.00061,1.164298,0.174458,1.096259,3.657065"},EPSG_4615:{towgs84:"-494.088,-312.129,279.877,-1.423,-1.013,1.59,-0.748"},ESRI_37241:{towgs84:"-76.822,257.457,-12.817,2.136,-0.033,-2.392,-0.031"},ESRI_37249:{towgs84:"-440.296,58.548,296.265,1.128,10.202,4.559,-0.438"},ESRI_37245:{towgs84:"-511.151,-181.269,139.609,1.05,2.703,1.798,3.071"},EPSG_4178:{towgs84:"24.9,-126.4,-93.2,-0.063,-0.247,-0.041,1.01"},EPSG_4622:{towgs84:"-472.29,-5.63,-304.12,0.4362,-0.8374,0.2563,1.8984"},EPSG_4625:{towgs84:"126.93,547.94,130.41,-2.7867,5.1612,-0.8584,13.8227"},EPSG_5252:{towgs84:"0.023,0.036,-0.068,0.00176,0.00912,-0.01136,0.00439"},EPSG_4314:{towgs84:"597.1,71.4,412.1,0.894,0.068,-1.563,7.58"},EPSG_4282:{towgs84:"-178.3,-316.7,-131.5,5.278,6.077,10.979,19.166"},EPSG_4231:{towgs84:"-83.11,-97.38,-117.22,0.005693,-0.044698,0.044285,0.1218"},EPSG_4274:{towgs84:"-230.994,102.591,25.199,0.633,-0.239,0.9,1.95"},EPSG_4134:{towgs84:"-180.624,-225.516,173.919,-0.81,-1.898,8.336,16.71006"},EPSG_4254:{towgs84:"18.38,192.45,96.82,0.056,-0.142,-0.2,-0.0013"},EPSG_4159:{towgs84:"-194.513,-63.978,-25.759,-3.4027,3.756,-3.352,-0.9175"},EPSG_4687:{towgs84:"0.072,-0.507,-0.245,0.0183,-0.0003,0.007,-0.0093"},EPSG_4227:{towgs84:"-83.58,-397.54,458.78,-17.595,-2.847,4.256,3.225"},EPSG_4746:{towgs84:"599.4,72.4,419.2,-0.062,-0.022,-2.723,6.46"},EPSG_4745:{towgs84:"612.4,77,440.2,-0.054,0.057,-2.797,2.55"},EPSG_6311:{towgs84:"8.846,-4.394,-1.122,-0.00237,-0.146528,0.130428,0.783926"},EPSG_4289:{towgs84:"565.7381,50.4018,465.2904,-0.395026,0.330772,-1.876073,4.07244"},EPSG_4230:{towgs84:"-68.863,-134.888,-111.49,-0.53,-0.14,0.57,-3.4"},EPSG_4154:{towgs84:"-123.02,-158.95,-168.47"},EPSG_4156:{towgs84:"570.8,85.7,462.8,4.998,1.587,5.261,3.56"},EPSG_4299:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4179:{towgs84:"33.4,-146.6,-76.3,-0.359,-0.053,0.844,-0.84"},EPSG_4313:{towgs84:"-106.8686,52.2978,-103.7239,0.3366,-0.457,1.8422,-1.2747"},EPSG_4194:{towgs84:"163.511,127.533,-159.789"},EPSG_4195:{towgs84:"105,326,-102.5"},EPSG_4196:{towgs84:"-45,417,-3.5"},EPSG_4611:{towgs84:"-162.619,-276.959,-161.764,0.067753,-2.243648,-1.158828,-1.094246"},EPSG_4633:{towgs84:"137.092,131.66,91.475,-1.9436,-11.5993,-4.3321,-7.4824"},EPSG_4641:{towgs84:"-408.809,366.856,-412.987,1.8842,-0.5308,2.1655,-121.0993"},EPSG_4643:{towgs84:"-480.26,-438.32,-643.429,16.3119,20.1721,-4.0349,-111.7002"},EPSG_4300:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4188:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4660:{towgs84:"982.6087,552.753,-540.873,6.681627,-31.611492,-19.848161,16.805"},EPSG_4662:{towgs84:"97.295,-263.247,310.882,-1.5999,0.8386,3.1409,13.3259"},EPSG_3906:{towgs84:"577.88891,165.22205,391.18289,4.9145,-0.94729,-13.05098,7.78664"},EPSG_4307:{towgs84:"-209.3622,-87.8162,404.6198,0.0046,3.4784,0.5805,-1.4547"},EPSG_6892:{towgs84:"-76.269,-16.683,68.562,-6.275,10.536,-4.286,-13.686"},EPSG_4690:{towgs84:"221.597,152.441,176.523,2.403,1.3893,0.884,11.4648"},EPSG_4691:{towgs84:"218.769,150.75,176.75,3.5231,2.0037,1.288,10.9817"},EPSG_4629:{towgs84:"72.51,345.411,79.241,-1.5862,-0.8826,-0.5495,1.3653"},EPSG_4630:{towgs84:"165.804,216.213,180.26,-0.6251,-0.4515,-0.0721,7.4111"},EPSG_4692:{towgs84:"217.109,86.452,23.711,0.0183,-0.0003,0.007,-0.0093"},EPSG_9333:{towgs84:"0,0,0,-0.008393,0.000749,-0.010276,0"},EPSG_9059:{towgs84:"0,0,0"},EPSG_4312:{towgs84:"601.705,84.263,485.227,4.7354,1.3145,5.393,-2.3887"},EPSG_4123:{towgs84:"-96.062,-82.428,-121.753,4.801,0.345,-1.376,1.496"},EPSG_4309:{towgs84:"-124.45,183.74,44.64,-0.4384,0.5446,-0.9706,-2.1365"},ESRI_104106:{towgs84:"-283.088,-70.693,117.445,-1.157,0.059,-0.652,-4.058"},EPSG_4281:{towgs84:"-219.247,-73.802,269.529"},EPSG_4322:{towgs84:"0,0,4.5"},EPSG_4324:{towgs84:"0,0,1.9"},EPSG_4284:{towgs84:"43.822,-108.842,-119.585,1.455,-0.761,0.737,0.549"},EPSG_4277:{towgs84:"446.448,-125.157,542.06,0.15,0.247,0.842,-20.489"},EPSG_4207:{towgs84:"-282.1,-72.2,120,-1.529,0.145,-0.89,-4.46"},EPSG_4688:{towgs84:"347.175,1077.618,2623.677,33.9058,-70.6776,9.4013,186.0647"},EPSG_4689:{towgs84:"410.793,54.542,80.501,-2.5596,-2.3517,-0.6594,17.3218"},EPSG_4720:{towgs84:"0,0,4.5"},EPSG_4273:{towgs84:"278.3,93,474.5,7.889,0.05,-6.61,6.21"},EPSG_4240:{towgs84:"204.64,834.74,293.8"},EPSG_4817:{towgs84:"278.3,93,474.5,7.889,0.05,-6.61,6.21"},ESRI_104131:{towgs84:"426.62,142.62,460.09,4.98,4.49,-12.42,-17.1"},EPSG_4265:{towgs84:"-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68"},EPSG_4263:{towgs84:"-111.92,-87.85,114.5,1.875,0.202,0.219,0.032"},EPSG_4298:{towgs84:"-689.5937,623.84046,-65.93566,-0.02331,1.17094,-0.80054,5.88536"},EPSG_4270:{towgs84:"-253.4392,-148.452,386.5267,0.15605,0.43,-0.1013,-0.0424"},EPSG_4229:{towgs84:"-121.8,98.1,-10.7"},EPSG_4220:{towgs84:"-55.5,-348,-229.2"},EPSG_4214:{towgs84:"12.646,-155.176,-80.863"},EPSG_4232:{towgs84:"-345,3,223"},EPSG_4238:{towgs84:"-1.977,-13.06,-9.993,0.364,0.254,0.689,-1.037"},EPSG_4168:{towgs84:"-170,33,326"},EPSG_4131:{towgs84:"199,931,318.9"},EPSG_4152:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_5228:{towgs84:"572.213,85.334,461.94,4.9732,1.529,5.2484,3.5378"},EPSG_8351:{towgs84:"485.021,169.465,483.839,7.786342,4.397554,4.102655,0"},EPSG_4683:{towgs84:"-127.62,-67.24,-47.04,-3.068,4.903,1.578,-1.06"},EPSG_4133:{towgs84:"0,0,0"},EPSG_7373:{towgs84:"0.819,-0.5762,-1.6446,-0.00378,-0.03317,0.00318,0.0693"},EPSG_9075:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_9072:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_9294:{towgs84:"1.16835,-1.42001,-2.24431,-0.00822,-0.05508,0.01818,0.23388"},EPSG_4212:{towgs84:"-267.434,173.496,181.814,-13.4704,8.7154,7.3926,14.7492"},EPSG_4191:{towgs84:"-44.183,-0.58,-38.489,2.3867,2.7072,-3.5196,-8.2703"},EPSG_4237:{towgs84:"52.684,-71.194,-13.975,-0.312,-0.1063,-0.3729,1.0191"},EPSG_4740:{towgs84:"-1.08,-0.27,-0.9"},EPSG_4124:{towgs84:"419.3836,99.3335,591.3451,0.850389,1.817277,-7.862238,-0.99496"},EPSG_5681:{towgs84:"584.9636,107.7175,413.8067,1.1155,0.2824,-3.1384,7.9922"},EPSG_4141:{towgs84:"23.772,17.49,17.859,-0.3132,-1.85274,1.67299,-5.4262"},EPSG_4204:{towgs84:"-85.645,-273.077,-79.708,2.289,-1.421,2.532,3.194"},EPSG_4319:{towgs84:"226.702,-193.337,-35.371,-2.229,-4.391,9.238,0.9798"},EPSG_4200:{towgs84:"24.82,-131.21,-82.66"},EPSG_4130:{towgs84:"0,0,0"},EPSG_4127:{towgs84:"-82.875,-57.097,-156.768,-2.158,1.524,-0.982,-0.359"},EPSG_4149:{towgs84:"674.374,15.056,405.346"},EPSG_4617:{towgs84:"-0.991,1.9072,0.5129,0.02579,0.00965,0.01166,0"},EPSG_4663:{towgs84:"-210.502,-66.902,-48.476,2.094,-15.067,-5.817,0.485"},EPSG_4664:{towgs84:"-211.939,137.626,58.3,-0.089,0.251,0.079,0.384"},EPSG_4665:{towgs84:"-105.854,165.589,-38.312,-0.003,-0.026,0.024,-0.048"},EPSG_4666:{towgs84:"631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43"},EPSG_4756:{towgs84:"-192.873,-39.382,-111.202,-0.00205,-0.0005,0.00335,0.0188"},EPSG_4723:{towgs84:"-179.483,-69.379,-27.584,-7.862,8.163,6.042,-13.925"},EPSG_4726:{towgs84:"8.853,-52.644,180.304,-0.393,-2.323,2.96,-24.081"},EPSG_4267:{towgs84:"-8.0,160.0,176.0"},EPSG_5365:{towgs84:"-0.16959,0.35312,0.51846,0.03385,-0.16325,0.03446,0.03693"},EPSG_4218:{towgs84:"304.5,306.5,-318.1"},EPSG_4242:{towgs84:"-33.722,153.789,94.959,-8.581,-4.478,4.54,8.95"},EPSG_4216:{towgs84:"-292.295,248.758,429.447,4.9971,2.99,6.6906,1.0289"},ESRI_104105:{towgs84:"631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43"},ESRI_104129:{towgs84:"0,0,0"},EPSG_4673:{towgs84:"174.05,-25.49,112.57"},EPSG_4202:{towgs84:"-124,-60,154"},EPSG_4203:{towgs84:"-117.763,-51.51,139.061,0.292,0.443,0.277,-0.191"},EPSG_3819:{towgs84:"595.48,121.69,515.35,4.115,-2.9383,0.853,-3.408"},EPSG_8694:{towgs84:"-93.799,-132.737,-219.073,-1.844,0.648,-6.37,-0.169"},EPSG_4145:{towgs84:"275.57,676.78,229.6"},EPSG_4283:{towgs84:"0.06155,-0.01087,-0.04019,0.039492,0.032722,0.032898,-0.009994"},EPSG_4317:{towgs84:"2.3287,-147.0425,-92.0802,-0.309248,0.324822,0.497299,5.689063"},EPSG_4272:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993"},EPSG_4248:{towgs84:"-307.7,265.3,-363.5"},EPSG_5561:{towgs84:"24,-121,-76"},EPSG_5233:{towgs84:"-0.293,766.95,87.713,0.195704,1.695068,3.473016,-0.039338"},ESRI_104130:{towgs84:"-86,-98,-119"},ESRI_104102:{towgs84:"682,-203,480"},ESRI_37207:{towgs84:"7,-10,-26"},EPSG_4675:{towgs84:"59.935,118.4,-10.871"},ESRI_104109:{towgs84:"-89.121,-348.182,260.871"},ESRI_104112:{towgs84:"-185.583,-230.096,281.361"},ESRI_104113:{towgs84:"25.1,-275.6,222.6"},IGNF_WGS72G:{towgs84:"0,12,6"},IGNF_NTFG:{towgs84:"-168,-60,320"},IGNF_EFATE57G:{towgs84:"-127,-769,472"},IGNF_PGP50G:{towgs84:"324.8,153.6,172.1"},IGNF_REUN47G:{towgs84:"94,-948,-1262"},IGNF_CSG67G:{towgs84:"-186,230,110"},IGNF_GUAD48G:{towgs84:"-467,-16,-300"},IGNF_TAHI51G:{towgs84:"162,117,154"},IGNF_TAHAAG:{towgs84:"65,342,77"},IGNF_NUKU72G:{towgs84:"84,274,65"},IGNF_PETRELS72G:{towgs84:"365,194,166"},IGNF_WALL78G:{towgs84:"253,-133,-127"},IGNF_MAYO50G:{towgs84:"-382,-59,-262"},IGNF_TANNAG:{towgs84:"-139,-967,436"},IGNF_IGN72G:{towgs84:"-13,-348,292"},IGNF_ATIGG:{towgs84:"1118,23,66"},IGNF_FANGA84G:{towgs84:"150.57,158.33,118.32"},IGNF_RUSAT84G:{towgs84:"202.13,174.6,-15.74"},IGNF_KAUE70G:{towgs84:"126.74,300.1,-75.49"},IGNF_MOP90G:{towgs84:"-10.8,-1.8,12.77"},IGNF_MHPF67G:{towgs84:"338.08,212.58,-296.17"},IGNF_TAHI79G:{towgs84:"160.61,116.05,153.69"},IGNF_ANAA92G:{towgs84:"1.5,3.84,4.81"},IGNF_MARQUI72G:{towgs84:"330.91,-13.92,58.56"},IGNF_APAT86G:{towgs84:"143.6,197.82,74.05"},IGNF_TUBU69G:{towgs84:"237.17,171.61,-77.84"},IGNF_STPM50G:{towgs84:"11.363,424.148,373.13"},EPSG_4150:{towgs84:"674.374,15.056,405.346"},EPSG_4754:{towgs84:"-208.4058,-109.8777,-2.5764"},ESRI_104101:{towgs84:"372.87,149.23,585.29"},EPSG_4693:{towgs84:"0,-0.15,0.68"},EPSG_6207:{towgs84:"293.17,726.18,245.36"},EPSG_4153:{towgs84:"-133.63,-157.5,-158.62"},EPSG_4132:{towgs84:"-241.54,-163.64,396.06"},EPSG_4221:{towgs84:"-154.5,150.7,100.4"},EPSG_4266:{towgs84:"-80.7,-132.5,41.1"},EPSG_4193:{towgs84:"-70.9,-151.8,-41.4"},EPSG_5340:{towgs84:"-0.41,0.46,-0.35"},EPSG_4246:{towgs84:"-294.7,-200.1,525.5"},EPSG_4318:{towgs84:"-3.2,-5.7,2.8"},EPSG_4121:{towgs84:"-199.87,74.79,246.62"},EPSG_4223:{towgs84:"-260.1,5.5,432.2"},EPSG_4158:{towgs84:"-0.465,372.095,171.736"},EPSG_4285:{towgs84:"-128.16,-282.42,21.93"},EPSG_4613:{towgs84:"-404.78,685.68,45.47"},EPSG_4607:{towgs84:"195.671,332.517,274.607"},EPSG_4475:{towgs84:"-381.788,-57.501,-256.673"},EPSG_4208:{towgs84:"-157.84,308.54,-146.6"},EPSG_4743:{towgs84:"70.995,-335.916,262.898"},EPSG_4710:{towgs84:"-323.65,551.39,-491.22"},EPSG_7881:{towgs84:"-0.077,0.079,0.086"},EPSG_4682:{towgs84:"283.729,735.942,261.143"},EPSG_4739:{towgs84:"-156,-271,-189"},EPSG_4679:{towgs84:"-80.01,253.26,291.19"},EPSG_4750:{towgs84:"-56.263,16.136,-22.856"},EPSG_4644:{towgs84:"-10.18,-350.43,291.37"},EPSG_4695:{towgs84:"-103.746,-9.614,-255.95"},EPSG_4292:{towgs84:"-355,21,72"},EPSG_4302:{towgs84:"-61.702,284.488,472.052"},EPSG_4143:{towgs84:"-124.76,53,466.79"},EPSG_4606:{towgs84:"-153,153,307"},EPSG_4699:{towgs84:"-770.1,158.4,-498.2"},EPSG_4247:{towgs84:"-273.5,110.6,-357.9"},EPSG_4160:{towgs84:"8.88,184.86,106.69"},EPSG_4161:{towgs84:"-233.43,6.65,173.64"},EPSG_9251:{towgs84:"-9.5,122.9,138.2"},EPSG_9253:{towgs84:"-78.1,101.6,133.3"},EPSG_4297:{towgs84:"-198.383,-240.517,-107.909"},EPSG_4269:{towgs84:"0,0,0"},EPSG_4301:{towgs84:"-147,506,687"},EPSG_4618:{towgs84:"-59,-11,-52"},EPSG_4612:{towgs84:"0,0,0"},EPSG_4678:{towgs84:"44.585,-131.212,-39.544"},EPSG_4250:{towgs84:"-130,29,364"},EPSG_4144:{towgs84:"214,804,268"},EPSG_4147:{towgs84:"-17.51,-108.32,-62.39"},EPSG_4259:{towgs84:"-254.1,-5.36,-100.29"},EPSG_4164:{towgs84:"-76,-138,67"},EPSG_4211:{towgs84:"-378.873,676.002,-46.255"},EPSG_4182:{towgs84:"-422.651,-172.995,84.02"},EPSG_4224:{towgs84:"-143.87,243.37,-33.52"},EPSG_4225:{towgs84:"-205.57,168.77,-4.12"},EPSG_5527:{towgs84:"-67.35,3.88,-38.22"},EPSG_4752:{towgs84:"98,390,-22"},EPSG_4310:{towgs84:"-30,190,89"},EPSG_9248:{towgs84:"-192.26,65.72,132.08"},EPSG_4680:{towgs84:"124.5,-63.5,-281"},EPSG_4701:{towgs84:"-79.9,-158,-168.9"},EPSG_4706:{towgs84:"-146.21,112.63,4.05"},EPSG_4805:{towgs84:"682,-203,480"},EPSG_4201:{towgs84:"-165,-11,206"},EPSG_4210:{towgs84:"-157,-2,-299"},EPSG_4183:{towgs84:"-104,167,-38"},EPSG_4139:{towgs84:"11,72,-101"},EPSG_4668:{towgs84:"-86,-98,-119"},EPSG_4717:{towgs84:"-2,151,181"},EPSG_4732:{towgs84:"102,52,-38"},EPSG_4280:{towgs84:"-377,681,-50"},EPSG_4209:{towgs84:"-138,-105,-289"},EPSG_4261:{towgs84:"31,146,47"},EPSG_4658:{towgs84:"-73,46,-86"},EPSG_4721:{towgs84:"265.025,384.929,-194.046"},EPSG_4222:{towgs84:"-136,-108,-292"},EPSG_4601:{towgs84:"-255,-15,71"},EPSG_4602:{towgs84:"725,685,536"},EPSG_4603:{towgs84:"72,213.7,93"},EPSG_4605:{towgs84:"9,183,236"},EPSG_4621:{towgs84:"137,248,-430"},EPSG_4657:{towgs84:"-28,199,5"},EPSG_4316:{towgs84:"103.25,-100.4,-307.19"},EPSG_4642:{towgs84:"-13,-348,292"},EPSG_4698:{towgs84:"145,-187,103"},EPSG_4192:{towgs84:"-206.1,-174.7,-87.7"},EPSG_4311:{towgs84:"-265,120,-358"},EPSG_4135:{towgs84:"58,-283,-182"},ESRI_104138:{towgs84:"198,-226,-347"},EPSG_4245:{towgs84:"-11,851,5"},EPSG_4142:{towgs84:"-125,53,467"},EPSG_4213:{towgs84:"-106,-87,188"},EPSG_4253:{towgs84:"-133,-77,-51"},EPSG_4129:{towgs84:"-132,-110,-335"},EPSG_4713:{towgs84:"-77,-128,142"},EPSG_4239:{towgs84:"217,823,299"},EPSG_4146:{towgs84:"295,736,257"},EPSG_4155:{towgs84:"-83,37,124"},EPSG_4165:{towgs84:"-173,253,27"},EPSG_4672:{towgs84:"175,-38,113"},EPSG_4236:{towgs84:"-637,-549,-203"},EPSG_4251:{towgs84:"-90,40,88"},EPSG_4271:{towgs84:"-2,374,172"},EPSG_4175:{towgs84:"-88,4,101"},EPSG_4716:{towgs84:"298,-304,-375"},EPSG_4315:{towgs84:"-23,259,-9"},EPSG_4744:{towgs84:"-242.2,-144.9,370.3"},EPSG_4244:{towgs84:"-97,787,86"},EPSG_4293:{towgs84:"616,97,-251"},EPSG_4714:{towgs84:"-127,-769,472"},EPSG_4736:{towgs84:"260,12,-147"},EPSG_6883:{towgs84:"-235,-110,393"},EPSG_6894:{towgs84:"-63,176,185"},EPSG_4205:{towgs84:"-43,-163,45"},EPSG_4256:{towgs84:"41,-220,-134"},EPSG_4262:{towgs84:"639,405,60"},EPSG_4604:{towgs84:"174,359,365"},EPSG_4169:{towgs84:"-115,118,426"},EPSG_4620:{towgs84:"-106,-129,165"},EPSG_4184:{towgs84:"-203,141,53"},EPSG_4616:{towgs84:"-289,-124,60"},EPSG_9403:{towgs84:"-307,-92,127"},EPSG_4684:{towgs84:"-133,-321,50"},EPSG_4708:{towgs84:"-491,-22,435"},EPSG_4707:{towgs84:"114,-116,-333"},EPSG_4709:{towgs84:"145,75,-272"},EPSG_4712:{towgs84:"-205,107,53"},EPSG_4711:{towgs84:"124,-234,-25"},EPSG_4718:{towgs84:"230,-199,-752"},EPSG_4719:{towgs84:"211,147,111"},EPSG_4724:{towgs84:"208,-435,-229"},EPSG_4725:{towgs84:"189,-79,-202"},EPSG_4735:{towgs84:"647,1777,-1124"},EPSG_4722:{towgs84:"-794,119,-298"},EPSG_4728:{towgs84:"-307,-92,127"},EPSG_4734:{towgs84:"-632,438,-609"},EPSG_4727:{towgs84:"912,-58,1227"},EPSG_4729:{towgs84:"185,165,42"},EPSG_4730:{towgs84:"170,42,84"},EPSG_4733:{towgs84:"276,-57,149"},ESRI_37218:{towgs84:"230,-199,-752"},ESRI_37240:{towgs84:"-7,215,225"},ESRI_37221:{towgs84:"252,-209,-751"},ESRI_4305:{towgs84:"-123,-206,219"},ESRI_104139:{towgs84:"-73,-247,227"},EPSG_4748:{towgs84:"51,391,-36"},EPSG_4219:{towgs84:"-384,664,-48"},EPSG_4255:{towgs84:"-333,-222,114"},EPSG_4257:{towgs84:"-587.8,519.75,145.76"},EPSG_4646:{towgs84:"-963,510,-359"},EPSG_6881:{towgs84:"-24,-203,268"},EPSG_6882:{towgs84:"-183,-15,273"},EPSG_4715:{towgs84:"-104,-129,239"},IGNF_RGF93GDD:{towgs84:"0,0,0"},IGNF_RGM04GDD:{towgs84:"0,0,0"},IGNF_RGSPM06GDD:{towgs84:"0,0,0"},IGNF_RGTAAF07GDD:{towgs84:"0,0,0"},IGNF_RGFG95GDD:{towgs84:"0,0,0"},IGNF_RGNCG:{towgs84:"0,0,0"},IGNF_RGPFGDD:{towgs84:"0,0,0"},IGNF_ETRS89G:{towgs84:"0,0,0"},IGNF_RGR92GDD:{towgs84:"0,0,0"},EPSG_4173:{towgs84:"0,0,0"},EPSG_4180:{towgs84:"0,0,0"},EPSG_4619:{towgs84:"0,0,0"},EPSG_4667:{towgs84:"0,0,0"},EPSG_4075:{towgs84:"0,0,0"},EPSG_6706:{towgs84:"0,0,0"},EPSG_7798:{towgs84:"0,0,0"},EPSG_4661:{towgs84:"0,0,0"},EPSG_4669:{towgs84:"0,0,0"},EPSG_8685:{towgs84:"0,0,0"},EPSG_4151:{towgs84:"0,0,0"},EPSG_9702:{towgs84:"0,0,0"},EPSG_4758:{towgs84:"0,0,0"},EPSG_4761:{towgs84:"0,0,0"},EPSG_4765:{towgs84:"0,0,0"},EPSG_8997:{towgs84:"0,0,0"},EPSG_4023:{towgs84:"0,0,0"},EPSG_4670:{towgs84:"0,0,0"},EPSG_4694:{towgs84:"0,0,0"},EPSG_4148:{towgs84:"0,0,0"},EPSG_4163:{towgs84:"0,0,0"},EPSG_4167:{towgs84:"0,0,0"},EPSG_4189:{towgs84:"0,0,0"},EPSG_4190:{towgs84:"0,0,0"},EPSG_4176:{towgs84:"0,0,0"},EPSG_4659:{towgs84:"0,0,0"},EPSG_3824:{towgs84:"0,0,0"},EPSG_3889:{towgs84:"0,0,0"},EPSG_4046:{towgs84:"0,0,0"},EPSG_4081:{towgs84:"0,0,0"},EPSG_4558:{towgs84:"0,0,0"},EPSG_4483:{towgs84:"0,0,0"},EPSG_5013:{towgs84:"0,0,0"},EPSG_5264:{towgs84:"0,0,0"},EPSG_5324:{towgs84:"0,0,0"},EPSG_5354:{towgs84:"0,0,0"},EPSG_5371:{towgs84:"0,0,0"},EPSG_5373:{towgs84:"0,0,0"},EPSG_5381:{towgs84:"0,0,0"},EPSG_5393:{towgs84:"0,0,0"},EPSG_5489:{towgs84:"0,0,0"},EPSG_5593:{towgs84:"0,0,0"},EPSG_6135:{towgs84:"0,0,0"},EPSG_6365:{towgs84:"0,0,0"},EPSG_5246:{towgs84:"0,0,0"},EPSG_7886:{towgs84:"0,0,0"},EPSG_8431:{towgs84:"0,0,0"},EPSG_8427:{towgs84:"0,0,0"},EPSG_8699:{towgs84:"0,0,0"},EPSG_8818:{towgs84:"0,0,0"},EPSG_4757:{towgs84:"0,0,0"},EPSG_9140:{towgs84:"0,0,0"},EPSG_8086:{towgs84:"0,0,0"},EPSG_4686:{towgs84:"0,0,0"},EPSG_4737:{towgs84:"0,0,0"},EPSG_4702:{towgs84:"0,0,0"},EPSG_4747:{towgs84:"0,0,0"},EPSG_4749:{towgs84:"0,0,0"},EPSG_4674:{towgs84:"0,0,0"},EPSG_4755:{towgs84:"0,0,0"},EPSG_4759:{towgs84:"0,0,0"},EPSG_4762:{towgs84:"0,0,0"},EPSG_4763:{towgs84:"0,0,0"},EPSG_4764:{towgs84:"0,0,0"},EPSG_4166:{towgs84:"0,0,0"},EPSG_4170:{towgs84:"0,0,0"},EPSG_5546:{towgs84:"0,0,0"},EPSG_7844:{towgs84:"0,0,0"},EPSG_4818:{towgs84:"589,76,480"},EPSG_10328:{towgs84:"0,0,0"},EPSG_9782:{towgs84:"0,0,0"},EPSG_9777:{towgs84:"0,0,0"},EPSG_10690:{towgs84:"0,0,0"},EPSG_10639:{towgs84:"0,0,0"},EPSG_10739:{towgs84:"0,0,0"},EPSG_7686:{towgs84:"0,0,0"},EPSG_8900:{towgs84:"0,0,0"},EPSG_5886:{towgs84:"0,0,0"},EPSG_7683:{towgs84:"0,0,0"},EPSG_6668:{towgs84:"0,0,0"},EPSG_20046:{towgs84:"0,0,0"},EPSG_10299:{towgs84:"0,0,0"},EPSG_10310:{towgs84:"0,0,0"},EPSG_10475:{towgs84:"0,0,0"},EPSG_4742:{towgs84:"0,0,0"},EPSG_10671:{towgs84:"0,0,0"},EPSG_10762:{towgs84:"0,0,0"},EPSG_10725:{towgs84:"0,0,0"},EPSG_10791:{towgs84:"0,0,0"},EPSG_10800:{towgs84:"0,0,0"},EPSG_10305:{towgs84:"0,0,0"},EPSG_10941:{towgs84:"0,0,0"},EPSG_10968:{towgs84:"0,0,0"},EPSG_10875:{towgs84:"0,0,0"},EPSG_6318:{towgs84:"0,0,0"},EPSG_10910:{towgs84:"0,0,0"}};for(var
3446sR in sC){var sL=sC[sR];sL.datumName&&(sC[sL.datumName]=sL)}let sI=function(e,t,i,r,s,n,o){var a={};return a.datum_type=5,t&&(a.datum_type=4,a.datum_params=t.map(parseFloat),(0!==a.datum_params[0]||0!==a.datum_params[1]||0!==a.datum_params[2])&&(a.datum_type=1),a.datum_params.length>
34463&&(0!==a.datum_params[3]||0!==a.datum_params[4]||0!==a.datum_params[5]||0!==a.datum_params[6])&&(a.datum_type=2,a.datum_params[3]*=484813681109536e-20,a.datum_params[4]*=484813681109536e-20,a.datum_params[5]*=484813681109536e-20,a.datum_params[6]=a.datum_params[6]/1e6+1)),o&&(a.datum_type=3,a.grids=o),a.a=i,a.b=r,a.es=s,a.ep2=n,a};var sO={};async function sN(e,t){for(var i=[],r=await t.getImageCount(),s=r-1;s>=0;s--){var n=await t.getImage(s),o=await n.readRasters(),a=[n.getWidth(),n.getHeight()],l=n.getBoundingBox().map(sD),h="function"==typeof n.fileDirectory.getValue?n.fileDirectory.getValue("ModelPixelScale"):n.fileDirectory.ModelPixelScale,u=[h[0],h[1]].map(sD),c=l[0]+(a[0]-1)*u[0],d=l[3]-(a[1]-1)*u[1],f=o[0],p=o[1],g=[];for(let e=a[1]-1;e>=0;e--)for(let t=a[0]-1;t>=0;t--){var m=e*a[0]+t;g.push([-sB(p[m]),sB(f[m])])}i.push({del:u,lim:a,ll:[-c,d],cvs:g})}var _={header:{nSubgrids:r},subgrids:i};return sO[e]=_,_}function sF(e){if(0===e.length)return null;var t="@"===e[0];return(t&&(e=e.slice(1)),"null"===e)?{name:"null",mandatory:!t,grid:null,isNull:!0}:{name:e,mandatory:!t,grid:sO[e]||null,isNull:!1}}function sD(e){return e*Math.PI/180}function sB(e){return e/3600*Math.PI/180}function sG(e,t,i){return String.fromCharCode.apply(null,new Uint8Array(e.buffer.slice(t,i)))}function sk(e,t){if(!(this instanceof sk))return new sk(e);this.forward=null,this.inverse=null,this.init=null,this.name,this.axis,this.names=null,this.title,t=t||function(e){if(e)throw e};var i,r,s,n,o,a,l,h,u=sf(e);if("object"!=typeof u)return void t("Could not parse to valid json: "+e);var c=sk.projections.get(u.projName);if(!c)return void t("Could not get projection name from: "+e);if(u.datumCode&&"none"!==u.datumCode){var d=sl(sC,u.datumCode);d&&(u.datum_params=u.datum_params||(d.towgs84?d.towgs84.split(","):null),u.ellps=d.ellipse,u.datumName=d.datumName?d.datumName:u.datumCode)}u.k0=u.k0||1,u.axis=u.axis||"enu",u.ellps=u.ellps||"wgs84",u.lat1=u.lat1||u.lat0;var f=function(e,t,i,r,s){if(!e){var n=sl(sA,r);n||(n=sM),e=n.a,t=n.b,i=n.rf}return i&&!t&&(t=(1-1/i)*e),(0===i||1e-10>Math.abs(e-t))&&(s=!0,t=e),{a:e,b:t,rf:i,sphere:s}}(u.a,u.b,u.rf,u.ellps,u.sphere),p=(i=f.a,r=f.b,f.rf,s=u.R_A,a=((n=i*i)-(o=r*r))/n,l=0,s?(i*=1-a*(.16666666666666666+a*(.04722222222222222+.022156084656084655*a)),n=i*i,a=0):l=Math.sqrt(a),{es:a,e:l,ep2:(n-o)/o}),g=void 0===(h=u.nadgrids)?null:h.split(",").map(sF),m=u.datum||sI(u.datumCode,u.datum_params,f.a,f.b,p.es,p.ep2,g);sp(this,u),sp(this,c),this.a=f.a,this.b=f.b,this.rf=f.rf,this.sphere=f.sphere,this.es=p.es,this.e=p.e,this.ep2=p.ep2,this.datum=m,"init"in this&&"function"==typeof this.init&&this.init(),t(null,this)}function sU(e,t,i){var r,s,n,o=e.x,a=e.y,l=e.z?e.z:0;if(a<-si&&a>-1.001*si)a=-si;else if(a>si&&a<1.001*si)a=si;else if(a<-si)return{x:-1/0,y:-1/0,z:e.z};else if(a>si)return{x:1/0,y:1/0,z:e.z};return o>Math.PI&&(o-=2*Math.PI),s=Math.sin(a),n=Math.cos(a),{x:((r=i/Math.sqrt(1-s*s*t))+l)*n*Math.cos(o),y:(r+l)*n*Math.sin(o),z:(r*(1-t)+l)*s}}function sz(e,t,i,r){var s,n,o,a,l,h,u,c,d,f,p,g,m,_,y,v=1e-12*1e-12,b=e.x,E=e.y,x=e.z?e.z:0;if(s=Math.sqrt(b*b+E*E),n=Math.sqrt(b*b+E*E+x*x),s/i<1e-12){if(_=0,n/i<1e-12)return y=-r,{x:e.x,y:e.y,z:e.z}}else _=Math.atan2(E,b);o=x/n,l=1/Math.sqrt(1-t*(2-t)*(a=s/n)*a),c=a*(1-t)*l,d=o*l,m=0;do m++,u=i/Math.sqrt(1-t*d*d),y=s*c+x*d-u*(1-t*d*d),l=1/Math.sqrt(1-(h=t*u/(u+y))*(2-h)*a*a),f=a*(1-h)*l,g=(p=o*l)*c-f*d,c=f,d=p;while(g*g>v&&m<30);return{x:_,y:Math.atan(p/Math.abs(f)),z:y}}function sj(e){return 1===e||2===e}function sV(e,t,i){if(null===e.grids||0===e.grids.length)return console.log("Grid shift grids not found"),-1;var r={x:-i.x,y:i.y},s={x:NaN,y:NaN},n=[];e:for(var o=0;o<e.grids.length;o++){var a=e.grids[o];if(n.push(a.name),a.isNull){s=r;break}if(null===a.grid){if(a.mandatory)return console.log("Unable to find mandatory grid '"+a.name+"'"),-1;continue}for(var l=a.grid.subgrids,h=0,u=l.length;h<u;h++){var c=l[h],d=(Math.abs(c.del[1])+Math.abs(c.del[0]))/1e4,f=c.ll[0]-d,p=c.ll[1]-d,g=c.ll[0]+(c.lim[0]-1)*c.del[0]+d,m=c.ll[1]+(c.lim[1]-1)*c.del[1]+d;if(!(p>r.y)&&!(f>r.x)&&!(m<r.y)&&!(g<r.x)&&!isNaN((s=function(e,t,i){var r={x:NaN,y:NaN};if(isNaN(e.x))return r;var s={x:e.x,y:e.y};s.x-=i.ll[0],s.y-=i.ll[1],s.x=s_(s.x-Math.PI)+Math.PI;var n=sW(s,i);if(t){if(isNaN(n.x))return r;n.x=s.x-n.x,n.y=s.y-n.y;var o,a,l=9;do{if(isNaN((a=sW(n,i)).x)){console.log("Inverse grid shift iteration failed, presumably at grid edge. Using first approximation.");break}o={x:s.x-(a.x+n.x),y:s.y-(a.y+n.y)},n.x+=o.x,n.y+=o.y}while(l--&&Math.abs(o.x)>1e-12&&Math.abs(o.y)>1e-12);if(l<0)return console.log("Inverse grid shift iterator failed to converge."),r;r.x=s_(n.x+i.ll[0]),r.y=n.y+i.ll[1]}else isNaN(n.x)||(r.x=e.x+n.x,r.y=e.y+n.y);return r}(r,t,c)).x))break e}}return isNaN(s.x)?(console.log("Failed to find a grid shift table for location '"+-(57.29577951308232*r.x)+" "+57.29577951308232*r.y+" tried: '"+n+"'"),-1):(i.x=-s.x,i.y=s.y,0)}function sW(e,t){var i,r={x:e.x/t.del[0],y:e.y/t.del[1]},s={x:Math.floor(r.x),y:Math.floor(r.y)},n={x:r.x-s.x,y:r.y-s.y},o={x:NaN,y:NaN};if(s.x<0||s.x>=t.lim[0]||s.y<0||s.y>=t.lim[1])return o;i=s.y*t.lim[0]+s.x;var a={x:t.cvs[i][0],y:t.cvs[i][1]};i++;var l={x:t.cvs[i][0],y:t.cvs[i][1]};i+=t.lim[0];var h={x:t.cvs[i][0],y:t.cvs[i][1]};i--;var u={x:t.cvs[i][0],y:t.cvs[i][1]},c=n.x*n.y,d=n.x*(1-n.y),f=(1-n.x)*(1-n.y),p=(1-n.x)*n.y;return o.x=f*a.x+d*l.x+p*u.x+c*h.x,o.y=f*a.y+d*l.y+p*u.y+c*h.y,o}
3446sk.projections={start:function(){sx.forEach(sP)},add:sP,get:function(e){if(!e)return!1;var t=e.toLowerCase();if(void 0!==sw[t]&&sS[sw[t]]||(t=sT(t))in sw&&sS[sw[t]])return sS[sw[t]]}},sk.projections.start();var s$=["x","y","z"];function sH(e){var t={x:e[0],y:e[1]};return e.length>2&&(t.z=e[2]),e.length>3&&(t.m=e[3]),t}function sq(e){if("function"==typeof Number.isFinite){if(Number.isFinite(e))return;throw TypeError("coordinates must be finite numbers")}if("number"!=typeof e||e!=e||!isFinite(e))throw TypeError("coordinates must be finite numbers")}function sK(e,t,i,r){var s,n,o,a=void 0!==i.z;if(sq((s=i).x),sq(s.y),e.datum&&t.datum&&((1===(n=e).datum.datum_type||2===n.datum.datum_type||3===n.datum.datum_type)&&"WGS84"!==t.datumCode||(1===t.datum.datum_type||2===t.datum.datum_type||3===t.datum.datum_type)&&"WGS84"!==n.datumCode)&&(i=sK(e,o=new sk("WGS84"),i,r),e=o),r&&"enu"!==e.axis&&(i=function(e,t){let i={};for(let r=0,s=e.axis.length;r<s;r++){if(2===r&&void 0===t.z)continue;let s=t[s$[r]];switch(e.axis[r]){case"e":i.x=s;break;case"w":i.x=-s;break;case"n":i.y=s;break;case"s":i.y=-s;break;case"u":i.z=s;break;case"d":i.z=-s;break;default:return null}}return i}(e,i)),"longlat"===e.projName)i={x:.017453292519943295*i.x,y:.017453292519943295*i.y,z:i.z||0};else if(e.to_meter&&(i={x:i.x*e.to_meter,y:i.y*e.to_meter,z:i.z||0}),!(i=e.inverse(i)))return;if(e.from_greenwich&&(i.x+=e.from_greenwich),i=function(e,t,i){if(r=e,s=t,!(r.datum_type!==s.datum_type||r.a!==s.a||Math.abs(r.es-s.es)>5e-11)&&(1===r.datum_type?r.datum_params[0]===s.datum_params[0]&&r.datum_params[1]===s.datum_params[1]&&r.datum_params[2]===s.datum_params[2]:2!==r.datum_type||r.datum_params[0]===s.datum_params[0]&&r.datum_params[1]===s.datum_params[1]&&r.datum_params[2]===s.datum_params[2]&&r.datum_params[3]===s.datum_params[3]&&r.datum_params[4]===s.datum_params[4]&&r.datum_params[5]===s.datum_params[5]&&r.datum_params[6]===s.datum_params[6])||5===e.datum_type||5===t.datum_type)return i;var r,s,n=e.a,o=e.es;if(3===e.datum_type){if(0!==sV(e,!1,i))return;n=6378137,o=.0066943799901413165}var a=t.a,l=t.b,h=t.es;if(3===t.datum_type&&(a=6378137,l=6356752.314,h=.0066943799901413165),o===h&&n===a&&!sj(e.datum_type)&&!sj(t.datum_type)||(i=sU(i,o,n),sj(e.datum_type)&&(i=function(e,t,i){if(1===t)return{x:e.x+i[0],y:e.y+i[1],z:e.z+i[2]};if(2===t){var r=i[0],s=i[1],n=i[2],o=i[3],a=i[4],l=i[5],h=i[6];return{x:h*(e.x-l*e.y+a*e.z)+r,y:h*(l*e.x+e.y-o*e.z)+s,z:h*(-a*e.x+o*e.y+e.z)+n}}}(i,e.datum_type,e.datum_params)),sj(t.datum_type)&&(i=function(e,t,i){if(1===t)return{x:e.x-i[0],y:e.y-i[1],z:e.z-i[2]};if(2===t){var r=i[0],s=i[1],n=i[2],o=i[3],a=i[4],l=i[5],h=i[6],u=(e.x-r)/h,c=(e.y-s)/h,d=(e.z-n)/h;return{x:u+l*c-a*d,y:-l*u+c+o*d,z:a*u-o*c+d}}}(i,t.datum_type,t.datum_params)),i=sz(i,h,a,l),3!==t.datum_type||0===sV(t,!0,i)))return i}(e.datum,t.datum,i)){if(t.from_greenwich&&(i={x:i.x-t.from_greenwich,y:i.y,z:i.z||0}),"longlat"===t.projName?i={x:57.29577951308232*i.x,y:57.29577951308232*i.y,z:i.z||0}:(i=t.forward(i),t.to_meter&&(i={x:i.x/t.to_meter,y:i.y/t.to_meter,z:i.z||0})),r&&"enu"!==t.axis){var l=i;let e={};for(let i=0,r=t.axis.length;i<r;i++)if(2!==i||void 0!==l.z)switch(t.axis[i]){case"e":e[s$[i]]=l.x;break;case"w":e[s$[i]]=-l.x;break;case"n":e[s$[i]]=l.y;break;case"s":e[s$[i]]=-l.y;break;case"u":e[s$[i]]=l.z;break;case"d":e[s$[i]]=-l.z;break;default:return null}return e}return i&&!a&&"geocent"!==t.projName&&delete i.z,i}}var sX=sk("WGS84");function sY(e,t,i,r){var s,n,o;if(Array.isArray(i)){if(s=sK(e,t,sH(i),r)||{x:NaN,y:NaN},i.length>2)return(n=void 0!==e.name&&"geocent"===e.name||void 0!==t.name&&"geocent"===t.name)?"number"==typeof s.z?[s.x,s.y,s.z].concat(i.slice(3)):[s.x,s.y,i[2]].concat(i.slice(3)):r&&"number"==typeof s.z?[s.x,s.y,s.z].concat(i.slice(3)):[s.x,s.y].concat(i.slice(2));return[s.x,s.y]}return s=sK(e,t,{x:i.x,y:i.y,z:i.z,m:i.m},r)||{x:NaN,y:NaN},2===(o=Object.keys(i)).length||(n=void 0!==e.name&&"geocent"===e.name||void 0!==t.name&&"geocent"===t.name,o.forEach(function(e){"x"!==e&&"y"!==e&&("z"===e&&(n||r)||(s[e]=i[e]))})),s}function sZ(e){return e instanceof sk?e:"object"==typeof e&&"oProj"in e?e.oProj:sk(e)}var sQ="AJSAJS",sJ="AFAFAF";function s0(e,t){var i,r,s,n,o,a,l,h,u,c,d,f,p,g,m;return t=t||5,i=function(e){var t,i,r,s,n,o,a,l,h=e.lat,u=e.lon,c=s3(h),d=s3(u);l=Math.floor((u+180)/6)+1,180===u&&(l=60),h>=56&&h<64&&u>=3&&u<12&&(l=32),h>=72&&h<84&&(u>=0&&u<9?l=31:u>=9&&u<21?l=33:u>=21&&u<33?l=35:u>=33&&u<42&&(l=37)),a=s3((l-1)*6-180+3),r=6378137/Math.sqrt(1-.00669438*Math.sin(c)*Math.sin(c)),s=Math.tan(c)
3446*Math.tan(c),n=.006739496752268451*Math.cos(c)*Math.cos(c);var f=.9996*r*((o=Math.cos(c)*(d-a))+(1-s+n)*o*o*o/6+(5-18*s+s*s+72*n-.39089081163157013)*o*o*o*o*o/120)+5e5,p=.9996*(6378137*(.9983242984503243*c-.002514607064228144*Math.sin(2*c)+2639046602129982e-21*Math.sin(4*c)-3418046101696858e-24*Math.sin(6*c))+r*Math.tan(c)*(o*o/2+(5-s+9*n+4*n*n)*o*o*o*o/24+(61-58*s+s*s+600*n-2.2240339282485886)*o*o*o*o*o*o/720));return h<0&&(p+=1e7),{northing:Math.round(p),easting:Math.round(f),zoneNumber:l,zoneLetter:(i="Z",84>=(t=h)&&t>=72?i="X":72>t&&t>=64?i="W":64>t&&t>=56?i="V":56>t&&t>=48?i="U":48>t&&t>=40?i="T":40>t&&t>=32?i="S":32>t&&t>=24?i="R":24>t&&t>=16?i="Q":16>t&&t>=8?i="P":8>t&&t>=0?i="N":0>t&&t>=-8?i="M":-8>t&&t>=-16?i="L":-16>t&&t>=-24?i="K":-24>t&&t>=-32?i="J":-32>t&&t>=-40?i="H":-40>t&&t>=-48?i="G":-48>t&&t>=-56?i="F":-56>t&&t>=-64?i="E":-64>t&&t>=-72?i="D":-72>t&&t>=-80&&(i="C"),i)}}({lat:e[1],lon:e[0]}),r=t,s="00000"+i.easting,n="00000"+i.northing,i.zoneNumber+i.zoneLetter+(o=i.easting,a=i.northing,l=i.zoneNumber,h=Math.floor(o/1e5),u=Math.floor(a/1e5)%20,c=s6(l)-1,d=sQ.charCodeAt(c),f=sJ.charCodeAt(c),p=d+h-1,g=f+u,m=!1,p>90&&(p=p-90+65-1,m=!0),(73===p||d<73&&p>73||(p>73||d<73)&&m)&&p++,(79===p||d<79&&p>79||(p>79||d<79)&&m)&&73==++p&&p++,p>90&&(p=p-90+65-1),g>86?(g=g-86+65-1,m=!0):m=!1,(73===g||f<73&&g>73||(g>73||f<73)&&m)&&g++,(79===g||f<79&&g>79||(g>79||f<79)&&m)&&73==++g&&g++,g>86&&(g=g-86+65-1),String.fromCharCode(p)+String.fromCharCode(g))+s.substr(s.length-5,r)+n.substr(n.length-5,r)}function s1(e){var t=s4(s8(e.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat]:[(t.left+t.right)/2,(t.top+t.bottom)/2]}function s3(e){return Math.PI/180*e}function s2(e){return e/Math.PI*180}function s4(e){var t,i,r,s,n,o,a,l,h=e.northing,u=e.easting,c=e.zoneLetter,d=e.zoneNumber;if(d<0||d>60)return null;var f=(1-Math.sqrt(.99330562))/(1+Math.sqrt(.99330562)),p=h;c<"N"&&(p-=1e7),t=6378137/Math.sqrt(1-.00669438*Math.sin(a=(o=p/.9996/6367449.145945056)+(3*f/2-27*f*f*f/32)*Math.sin(2*o)+(21*f*f/16-55*f*f*f*f/32)*Math.sin(4*o)+151*f*f*f/96*Math.sin(6*o))*Math.sin(a)),i=Math.tan(a)*Math.tan(a),r=.006739496752268451*Math.cos(a)*Math.cos(a),s=6335439.32722994/Math.pow(1-.00669438*Math.sin(a)*Math.sin(a),1.5),n=(u-5e5)/(.9996*t);var g=a-t*Math.tan(a)/s*(n*n/2-(5+3*i+10*r-4*r*r-.06065547077041606)*n*n*n*n/24+(61+90*i+298*r+45*i*i-1.6983531815716497-3*r*r)*n*n*n*n*n*n/720);g=s2(g);var m=(n-(1+2*i+r)*n*n*n/6+(5-2*r+28*i-3*r*r+.05391597401814761+24*i*i)*n*n*n*n*n/120)/Math.cos(a);if(m=(d-1)*6-180+3+s2(m),e.accuracy){var _=s4({northing:e.northing+e.accuracy,easting:e.easting+e.accuracy,zoneLetter:e.zoneLetter,zoneNumber:e.zoneNumber});
3446l={top:_.lat,right:_.lon,bottom:g,left:m}}else l={lat:g,lon:m};return l}function s6(e){var t=e%6;return 0===t&&(t=6),t}function s8(e){if(e&&0===e.length)throw"MGRSPoint coverting from nothing";for(var t,i,r=e.length,s=null,n="",o=0;!/[A-Z]/.test(t=e.charAt(o));){if(o>=2)throw"MGRSPoint bad conversion from: "+e;n+=t,o++}var a=parseInt(n,10);if(0===o||o+3>r)throw"MGRSPoint bad conversion from: "+e;var l=e.charAt(o++);if(l<="A"||"B"===l||"Y"===l||l>="Z"||"I"===l||"O"===l)throw"MGRSPoint zone letter "+l+" not handled: "+e;s=e.substring(o,o+=2);for(var h=s6(a),u=function(e,t){for(var i=sQ.charCodeAt(t-1),r=1e5,s=!1;i!==e.charCodeAt(0);){if(73==++i&&i++,79===i&&i++,i>90){if(s)throw"Bad character: "+e;i=65,s=!0}r+=1e5}return r}(s.charAt(0),h),c=function(e,t){if(e>"V")throw"MGRSPoint given invalid Northing "+e;for(var i=sJ.charCodeAt(t-1),r=0,s=!1;i!==e.charCodeAt(0);){if(73==++i&&i++,79===i&&i++,i>86){if(s)throw"Bad character: "+e;i=65,s=!0}r+=1e5}return r}(s.charAt(1),h);c<function(e){var t;switch(e){case"C":t=11e5;break;case"D":t=2e6;break;case"E":t=28e5;break;case"F":t=37e5;break;case"G":t=46e5;break;case"H":t=55e5;break;case"J":t=64e5;break;case"K":t=73e5;break;case"L":t=82e5;break;case"M":t=91e5;break;case"N":t=0;break;case"P":t=8e5;break;case"Q":t=17e5;break;case"R":t=26e5;break;case"S":t=35e5;break;case"T":t=44e5;break;case"U":t=53e5;break;case"V":t=62e5;break;case"W":t=7e6;break;case"X":t=79e5;break;default:t=-1}if(t>=0)return t;throw"Invalid zone letter: "+e}(l);)c+=2e6;var d=r-o;if(d%2!=0)throw"MGRSPoint has to have an even number \nof digits after the zone letter and two 100km letters - front \nhalf for easting meters, second half for \nnorthing meters"+e;var f=d/2,p=0,g=0;return f>0&&(i=1e5/Math.pow(10,f),p=parseFloat(e.substring(o,o+f))*i,g=parseFloat(e.substring(o+f))*i),{easting:p+u,northing:g+c,zoneLetter:l,zoneNumber:a,accuracy:i}}function s5(e,t,i){if(!(this instanceof s5))return new s5(e,t,i);if(Array.isArray(e))this.x=e[0],this.y=e[1],this.z=e[2]||0;else if("object"==typeof e)this.x=e.x,this.y=e.y,this.z=e.z||0;else if("string"==typeof e&&void 0===t){var r=e.split(",");this.x=parseFloat(r[0]),this.y=parseFloat(r[1]),this.z=parseFloat(r[2])||0}else this.x=e,this.y=t,this.z=i||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}function s7(e){var t=[];t[0]=1-e*(.25+e*(.046875+e*(.01953125+.01068115234375*e))),t[1]=e*(.75-e*(.046875+e*(.01953125+.01068115234375*e)));var i=e*e;return t[2]=i*(.46875-e*(.013020833333333334+.007120768229166667*e)),i*=e,t[3]=i*(.3645833333333333-.005696614583333333*e),t[4]=i*e*.3076171875,t}function s9(e,t,i,r){return i*=t,t*=t,r[0]*e-i*(r[1]+t*(r[2]+t*(r[3]+t*r[4])))}function ne(e,t,i){for(var r=1/(1-t),s=e,n=20;n;--n){var o=Math.sin(s),a=1-t*o*o;if(a=(s9(s,o,Math.cos(s),i)-e)*(a*Math.sqrt(a))*r,s-=a,1e-10>Math.abs(a))break}return s}s5.fromMGRS=function(e){return new s5(s1(e))},s5.prototype.toMGRS=function(e){return s0([this.x,this.y],e)};let nt={init:function(){this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0,this.lat0=void 0!==this.lat0?this.lat0:0,this.es&&(this.en=s7(this.es),this.ml0=s9(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))},forward:function(e){var t,i,r=e.x,s=e.y,n=s_(r-this.long0,this.over),o=Math.sin(s),a=Math.cos(s);if(this.es){var l=a*n,h=Math.pow(l,2),u=this.ep2*Math.pow(a,2),c=Math.pow(u,2),d=Math.pow(Math.abs(a)>1e-10?Math.tan(s):0,2),f=Math.pow(d,2);l/=Math.sqrt(1-this.es*Math.pow(o,2));var p=s9(s,o,a,this.en);t=this.a*(this.k0*l*(1+h/6*(1-d+u+h/20*(5-18*d+f+14*u-58*d*u+h/42*(61+179*f-f*d-479*d)))))+this.x0,i=this.a*(this.k0*(p-this.ml0+o*n*l/2*(1+h/12*(5-d+9*u+4*c+h/30*(61+f-58*d+270*u-330*d*u+h/56*(1385+543*f-f*d-3111*d))))))+this.y0}else{var g=a*Math.sin(n);if(1e-10>Math.abs(Math.abs(g)-1))return 93;if(t=.5*this.a*this.k0*Math.log((1+g)/(1-g))+this.x0,(g=Math.abs(i=a*Math.cos(n)/Math.sqrt(1-Math.pow(g,2))))>=1)if(g-1>1e-10)return 93;else i=0;else i=Math.acos(i);s<0&&(i=-i),i=this.a*this.k0*(i-this.lat0)+this.y0}return e.x=t,e.y=i,e},inverse:function(e){var t,i,r,s,n=(e.x-this.x0)*(1/this.a),o=(e.y-this.y0)*(1/this.a);if(this.es)if(Math.abs(i=ne(t=this.ml0+o/this.k0,this.es,this.en))<si){var a=Math.sin(i),l=Math.cos(i),h=Math.abs(l)>1e-10?Math.tan(i):0,u=this.ep2*Math.pow(l,2),c=Math.pow(u,2),d=Math.pow(h,2),f=Math.pow(d,2),p=n*Math.sqrt(t=1-this.es*Math.pow(a,2))/this.k0,g=Math.pow(p,2);t*=h,r=i-t*g/(1-this.es)*.5*(1-g/12*(5+3*d-9*u*d+u-4*c-g/30*(61+90*d-252*u*d+45*f+46*u-g/56*(1385+3633*d+4095*f+1574*f*d)))),s=s_(this.long0+p*(1-g/6*(1+2*d+u-g/20*(5+28*d+24*f+8*u*d+6*u-g/42*(61+662*d+1320*f+720*f*d))))/l,this.over)}else r=si*sm(o),s=0;else{var m=Math.exp(n/this.k0),_=.5*(m-1/m),y=Math.cos(this.lat0+o/this.k0);r=Math.asin(t=Math.sqrt((1-Math.pow(y,2))/(1+Math.pow(_,2)))),o<0&&(r=-r),s=0===_&&0===y?0:s_(Math.atan2(_,y)+this.long0,this.over)}return e.x=s,e.y=r,e},names:["Fast_Transverse_Mercator","Fast Transverse Mercator"]};function ni(e){var t=Math.exp(e);return(t-1/t)/2}function nr(e,t){var i=Math.max(e=Math.abs(e),t=Math.abs(t)),r=M
3446ath.min(e,t)/(i||1);return i*Math.sqrt(1+Math.pow(r,2))}function ns(e,t){for(var i,r=2*Math.cos(2*t),s=e.length-1,n=e[s],o=0;--s>=0;)i=-o+r*n+e[s],o=n,n=i;return t+i*Math.sin(2*t)}function nn(e,t,i){for(var r,s,n,o=Math.sin(t),a=Math.cos(t),l=ni(i),h=r=((r=Math.exp(i))+1/r)/2,u=2*a*h,c=-2*o*l,d=e.length-1,f=e[d],p=0,g=0,m=0;--d>=0;)s=g,n=p,f=-s+u*(g=f)-c*(p=m)+e[d],m=-n+c*g+u*p;return[(u=o*h)*f-(c=a*l)*m,u*m+c*f]}let no={init:function(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.');this.approx&&(nt.init.apply(this),this.forward=nt.forward,this.inverse=nt.inverse),this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0,this.lat0=void 0!==this.lat0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var e=this.es/(1+Math.sqrt(1-this.es)),t=e/(2-e),i=t;this.cgb[0]=t*(2+t*(-2/3+t*(-2+t*(116/45+t*(26/45+-2854/675*t))))),this.cbg[0]=t*(-2+t*(2/3+t*(4/3+t*(-82/45+t*(32/45+4642/4725*t))))),i*=t,this.cgb[1]=i*(7/3+t*(-1.6+t*(-227/45+t*(2704/315+2323/945*t)))),this.cbg[1]=i*(5/3+t*(-16/15+t*(-13/9+t*(904/315+-1522/945*t)))),i*=t,this.cgb[2]=i*(56/15+t*(-136/35+t*(-1262/105+73814/2835*t))),this.cbg[2]=i*(-26/15+t*(34/21+t*(1.6+-12686/2835*t))),i*=t,this.cgb[3]=i*(4279/630+t*(-332/35+-399572/14175*t)),this.cbg[3]=i*(1237/630+t*(-2.4+-24832/14175*t)),i*=t,this.cgb[4]=i*(4174/315+-144838/6237*t),this.cbg[4]=i*(-734/315+109598/31185*t),i*=t,this.cgb[5]=601676/22275*i,this.cbg[5]=444337/155925*i,i=Math.pow(t,2),this.Qn=this.k0/(1+t)*(1+i*(1/4+i*(1/64+i/256))),this.utg[0]=t*(-.5+t*(2/3+t*(-37/96+t*(1/360+t*(81/512+-96199/604800*t))))),this.gtu[0]=t*(.5+t*(-2/3+t*(5/16+t*(41/180+t*(-127/288+7891/37800*t))))),this.utg[1]=i*(-1/48+t*(-1/15+t*(437/1440+t*(-46/105+1118711/3870720*t)))),this.gtu[1]=i*(13/48+t*(-.6+t*(557/1440+t*(281/630+-1983433/1935360*t)))),i*=t,this.utg[2]=i*(-17/480+t*(37/840+t*(209/4480+-5569/90720*t))),this.gtu[2]=i*(61/240+t*(-103/140+t*(15061/26880+167603/181440*t))),i*=t,this.utg[3]=i*(-4397/161280+t*(11/504+830251/7257600*t)),this.gtu[3]=i*(49561/161280+t*(-179/168+6601661/7257600*t)),i*=t,this.utg[4]=i*(-4583/161280+108847/3991680*t),this.gtu[4]=i*(34729/80640+-3418889/1995840*t),i*=t,this.utg[5]=-0x13b12f5/0x26115000*i,this.gtu[5]=.6650675310896665*i;var r=ns(this.cbg,this.lat0);this.Zb=-this.Qn*(r+function(e,t){for(var i,r=2*Math.cos(t),s=e.length-1,n=e[s],o=0;--s>=0;)i=-o+r*n+e[s],o=n,n=i;return Math.sin(t)*i}(this.gtu,2*r))},forward:function(e){var t,i,r,s,n,o,a,l=s_(e.x-this.long0,this.over),h=e.y,u=Math.sin(h=ns(this.cbg,h)),c=Math.cos(h),d=Math.sin(l),f=Math.cos(l);h=Math.atan2(u,f*c),i=0==(n=(s=1+(r=(i=Math.abs(t=Math.tan(l=Math.atan2(d*c,nr(u,c*f)))))*(1+i/(nr(1,i)+1))))-1)?r:r*Math.log(s)/n,l=t<0?-i:i;var p=nn(this.gtu,2*h,2*l);return h+=p[0],2.623395162778>=Math.abs(l+=p[1])?(o=this.a*(this.Qn*l)+this.x0,a=this.a*(this.Qn*h+this.Zb)+this.y0):(o=1/0,a=1/0),e.x=o,e.y=a,e},inverse:function(e){var t,i,r=(e.x-this.x0)*(1/this.a),s=(e.y-this.y0)*(1/this.a);if(s=(s-this.Zb)/this.Qn,2.623395162778>=Math.abs(r/=this.Qn)){var n=nn(this.utg,2*s,2*r);
3446s+=n[0],r+=n[1],r=Math.atan(ni(r));var o=Math.sin(s),a=Math.cos(s),l=Math.sin(r),h=Math.cos(r);s=Math.atan2(o*h,nr(l,h*a)),t=s_((r=Math.atan2(l,h*a))+this.long0,this.over),i=ns(this.cgb,s)}else t=1/0,i=1/0;return e.x=t,e.y=i,e},names:["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc","Transverse_Mercator","Transverse Mercator","Gauss Kruger","Gauss_Kruger","tmerc"]},na={init:function(){var e=function(e,t){if(void 0===e){if((e=Math.floor((s_(t)+Math.PI)*30/Math.PI)+1)<0)return 0;if(e>60)return 60}return e}(this.zone,this.long0);if(void 0===e)throw Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(e)-183)*.017453292519943295,this.x0=5e5,this.y0=1e7*!!this.utmSouth,this.k0=.9996,no.init.apply(this),this.forward=no.forward,this.inverse=no.inverse},names:["Universal Transverse Mercator System","utm"],dependsOn:"etmerc"};function nl(e,t){return Math.pow((1-e)/(1+e),t)}let nh={init:function(){var e=Math.sin(this.lat0),t=Math.cos(this.lat0);t*=t,this.rc=Math.sqrt(1-this.es)/(1-this.es*e*e),this.C=Math.sqrt(1+this.es*t*t/(1-this.es)),this.phic0=Math.asin(e/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+sr)/(Math.pow(Math.tan(.5*this.lat0+sr),this.C)*nl(this.e*e,this.ratexp))},forward:function(e){var t=e.x,i=e.y;return e.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*i+sr),this.C)*nl(this.e*Math.sin(i),this.ratexp))-si,e.x=this.C*t,e},inverse:function(e){for(var t=e.x/this.C,i=e.y,r=Math.pow(Math.tan(.5*i+sr)/this.K,1/this.C),s=20;s>0&&!(1e-14>Math.abs((i=2*Math.atan(r*nl(this.e*Math.sin(e.y),-.5*this.e))-si)-e.y));--s)e.y=i;return s?(e.x=t,e.y=i,e):null},names:["gauss"]},nu={init:function(){nh.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))},forward:function(e){var t,i,r,s;return e.x=s_(e.x-this.long0,this.over),nh.forward.apply(this,[e]),t=Math.sin(e.y),i=Math.cos(e.y),r=Math.cos(e.x),e.x=(s=this.k0*this.R2/(1+this.sinc0*t+this.cosc0*i*r))*i*Math.sin(e.x),e.y=s*(this.cosc0*t-this.sinc0*i*r),e.x=this.a*e.x+this.x0,e.y=this.a*e.y+this.y0,e},inverse:function(e){var t,i,r,s,n;if(e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,e.x/=this.k0,e.y/=this.k0,n=nr(e.x,e.y)){var o=2*Math.atan2(n,this.R2);t=Math.sin(o),s=Math.asin((i=Math.cos(o))*this.sinc0+e.y*t*this.cosc0/n),r=Math.atan2(e.x*t,n*this.cosc0*i-e.y*this.sinc0*t)}else s=this.phic0,r=0;return e.x=r,e.y=s,nh.inverse.apply(this,[e]),e.x=s_(e.x+this.long0,this.over),e},names:["Stereographic_North_Pole","Oblique_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"]};function nc(e,t,i){return Math.tan(.5*(si+e))*Math.pow((1-(t*=i))/(1+t),.5*i)}let nd={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?1===this.k0&&!isNaN(this.lat_ts)&&1e-10>=Math.abs(this.coslat0)&&(this.k0=.5*(1+sm(this.lat0)*Math.sin(this.lat_ts))):(1e-10>=Math.abs(this.coslat0)&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),1===this.k0&&!isNaN(this.lat_ts)&&1e-10>=Math.abs(this.coslat0)&&Math.abs(Math.cos(this.lat_ts))>1e-10&&(this.k0=.5*this.cons*sg(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/sy(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=sg(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(nc(this.lat0,this.sinlat0,this.e))-si,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))},forward:function(e){var t,i,r,s,n,o,a=e.x,l=e.y,h=Math.sin(l),u=Math.cos(l),c=s_(a-this.long0,this.over);if(1e-10>=Math.abs(Math.abs(a-this.long0)-Math.PI)&&1e-10>=Math.abs(l+this.lat0))return e.x=NaN,e.y=NaN,e;if(this.sphere)t=2*this.k0/(1+this.sinlat0*h+this.coslat0*u*Math.cos(c)),e.x=this.a*t*u*Math.sin(c)+this.x0,e.y=this.a*t*(this.coslat0*h-this.sinlat0*u*Math.cos(c))+this.y0;else{if(s=Math.cos(i=2*Math.atan(nc(l,h,this.e))-si),r=Math.sin(i),1e-10>=Math.abs(this.coslat0))return n=sy(this.e,l*this.con,this.con*h),o=2*this.a*this.k0*n/this.cons,e.x=this.x0+o*M
3446ath.sin(a-this.long0),e.y=this.y0-this.con*o*Math.cos(a-this.long0),e;1e-10>Math.abs(this.sinlat0)?e.y=(t=2*this.a*this.k0/(1+s*Math.cos(c)))*r:e.y=(t=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*r+this.cosX0*s*Math.cos(c))))*(this.cosX0*r-this.sinX0*s*Math.cos(c))+this.y0,e.x=t*s*Math.sin(c)+this.x0}return e},inverse:function(e){e.x-=this.x0,e.y-=this.y0;var t,i,r,s,n,o=Math.sqrt(e.x*e.x+e.y*e.y);if(this.sphere){var a=2*Math.atan(o/(2*this.a*this.k0));return t=this.long0,i=this.lat0,o<=1e-10||(i=Math.asin(Math.cos(a)*this.sinlat0+e.y*Math.sin(a)*this.coslat0/o),t=1e-10>Math.abs(this.coslat0)?this.lat0>0?s_(this.long0+Math.atan2(e.x,-1*e.y),this.over):s_(this.long0+Math.atan2(e.x,e.y),this.over):s_(this.long0+Math.atan2(e.x*Math.sin(a),o*this.coslat0*Math.cos(a)-e.y*this.sinlat0*Math.sin(a)),this.over)),e.x=t,e.y=i,e}if(1e-10>=Math.abs(this.coslat0)){if(o<=1e-10)return i=this.lat0,e.x=t=this.long0,e.y=i,e;e.x*=this.con,e.y*=this.con,r=o*this.cons/(2*this.a*this.k0),i=this.con*sv(this.e,r),t=this.con*s_(this.con*this.long0+Math.atan2(e.x,-1*e.y),this.over)}else s=2*Math.atan(o*this.cosX0/(2*this.a*this.k0*this.ms1)),t=this.long0,o<=1e-10?n=this.X0:(n=Math.asin(Math.cos(s)*this.sinX0+e.y*Math.sin(s)*this.cosX0/o),t=s_(this.long0+Math.atan2(e.x*Math.sin(s),o*this.cosX0*Math.cos(s)-e.y*this.sinX0*Math.sin(s)),this.over)),i=-1*sv(this.e,Math.tan(.5*(si+n)));return e.x=t,e.y=i,e},names:["stere","Stereographic_South_Pole","Polar_Stereographic_variant_A","Polar_Stereographic_variant_B","Polar_Stereographic"],ssfn_:nc},nf={init:function(){var e=this.lat0;this.lambda0=this.long0;var t=Math.sin(e),i=this.a,r=1/this.rf,s=2*r-Math.pow(r,2),n=this.e=Math.sqrt(s);this.R=this.k0*i*Math.sqrt(1-s)/(1-s*Math.pow(t,2)),this.alpha=Math.sqrt(1+s/(1-s)*Math.pow(Math.cos(e),4)),this.b0=Math.asin(t/this.alpha);var o=Math.log(Math.tan(Math.PI/4+this.b0/2)),a=Math.log(Math.tan(Math.PI/4+e/2)),l=Math.log((1+n*t)/(1-n*t));this.K=o-this.alpha*a+this.alpha*n/2*l},forward:function(e){var t=Math.log(Math.tan(Math.PI/4-e.y/2)),i=this.e/2*Math.log((1+this.e*Math.sin(e.y))/(1-this.e*Math.sin(e.y))),r=2*(Math.atan(Math.exp(-this.alpha*(t+i)+this.K))-Math.PI/4),s=this.alpha*(e.x-this.lambda0),n=Math.atan(Math.sin(s)/(Math.sin(this.b0)*Math.tan(r)+Math.cos(this.b0)*Math.cos(s))),o=Math.asin(Math.cos(this.b0)*Math.sin(r)-Math.sin(this.b0)*Math.cos(r)*Math.cos(s));return e.y=this.R/2*Math.log((1+Math.sin(o))/(1-Math.sin(o)))+this.y0,e.x=this.R*n+this.x0,e},inverse:function(e){for(var t=e.x-this.x0,i=e.y-this.y0,r=t/this.R,s=2*(Math.atan(Math.exp(i/this.R))-Math.PI/4),n=Math.asin(Math.cos(this.b0)*Math.sin(s)+Math.sin(this.b0)*Math.cos(s)*Math.cos(r)),o=Math.atan(Math.sin(r)/(Math.cos(this.b0)*Math.cos(r)-Math.sin(this.b0)*Math.tan(s))),a=this.lambda0+o/this.alpha,l=0,h=n,u=-1e3,c=0;Math.abs(h-u)>1e-7;){if(++c>20)return;l=1/this.alpha*(Math.log(Math.tan(Math.PI/4+n/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(h))/2)),u=h,h=2*Math.atan(Math.exp(l))-Math.PI/2}return e.x=a,e.y=h,e},names:["somerc"]},np={init:function(){var e,t,i,r,s,n,o,a,l,h,u,c,d=0,f=0,p=0,g=0,m=0,_=0,y=0;this.no_off=(e=["Hotine_Oblique_Mercator","Hotine_Oblique_Mercator_variant_A","Hotine_Oblique_Mercator_Azimuth_Natural_Origin"],t="object"==typeof this.projName?Object.keys(this.projName)[0]:this.projName,"no_uoff"in this||"no_off"in this||-1!==e.indexOf(t)||-1!==e.indexOf(sT(t))),this.no_rot="no_rot"in this;var v=!1;"alpha"in this&&(v=!0);var b=!1;if("rectified_grid_angle"in this&&(b=!0),v&&(y=this.alpha),b&&(d=this.rectified_grid_angle,v||(y=0,v=!0)),v||b)f=this.longc;else if(p=this.long1,m=this.lat1,g=this.long2,1e-7>=Math.abs(m-(_=this.lat2))||(i=Math.abs(m))<=1e-7||1e-7>=Math.abs(i-si)||1e-7>=Math.abs(Math.abs(this.lat0)-si)||1e-7>=Math.abs(Math.abs(_)-si))throw Error();var E=1-this.es;(r=Math.sqrt(E),Math.abs(this.lat0)>1e-10?(h=Math.sin(this.lat0),s=Math.cos(this.lat0),i=1-this.es*h*h,this.B=s*s,this.B=Math.sqrt(1+this.es*this.B*this.B/E),this.A=this.B*this.k0*r/i,(o=(n=this.B*r/(s*Math.sqrt(i)))*n-1)<=0?o=0:(o=Math.sqrt(o),this.lat0<0&&(o=-o)),this.E=o+=n,this.E*=Math.pow(sy(this.e,this.lat0,h),this.B)):(this.B=1/r,this.A=this.k0,this.E=n=o=1),v||b)?(v?(c=Math.asin(Math.sin(y)/n),b||(d=y)):y=Math.asin(n*Math.sin(c=d)),this.lam0=f-Math.asin(.5*(o-1/o)*Math.tan(c))/this.B):(a=Math.pow(sy(this.e,m,Math.sin(m)),this.B),l=Math.pow(sy(this.e,_,Math.sin(_)),this.B),o=this.E/a,u=((u=this.E*this.E)-l*a)/(u+l*a),(i=p-g)<-Math.PI?g-=ss:i>
3446Math.PI&&(g+=ss),this.lam0=s_(.5*(p+g)-Math.atan(u*Math.tan(.5*this.B*(p-g))/((l-a)/(l+a)))/this.B,this.over),d=y=Math.asin(n*Math.sin(c=Math.atan(2*Math.sin(this.B*s_(p-this.lam0,this.over))/(o-1/o))))),this.singam=Math.sin(c),this.cosgam=Math.cos(c),this.sinrot=Math.sin(d),this.cosrot=Math.cos(d),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(n*n-1)/Math.cos(y))),this.lat0<0&&(this.u_0=-this.u_0)),o=.5*c,this.v_pole_n=this.ArB*Math.log(Math.tan(sr-o)),this.v_pole_s=this.ArB*Math.log(Math.tan(sr+o))},forward:function(e){var t,i,r,s,n,o,a,l,h={};if(e.x=e.x-this.lam0,Math.abs(Math.abs(e.y)-si)>1e-10){if(o=1/(n=this.E/Math.pow(sy(this.e,e.y,Math.sin(e.y)),this.B)),t=.5*(n-o),i=.5*(n+o),s=Math.sin(this.B*e.x),1e-10>Math.abs(Math.abs(r=(t*this.singam-s*this.cosgam)/i)-1))throw Error();l=.5*this.ArB*Math.log((1-r)/(1+r)),a=1e-7>Math.abs(o=Math.cos(this.B*e.x))?this.A*e.x:this.ArB*Math.atan2(t*this.cosgam+s*this.singam,o)}else l=e.y>0?this.v_pole_n:this.v_pole_s,a=this.ArB*e.y;return this.no_rot?(h.x=a,h.y=l):(a-=this.u_0,h.x=l*this.cosrot+a*this.sinrot,h.y=a*this.cosrot-l*this.sinrot),h.x=this.a*h.x+this.x0,h.y=this.a*h.y+this.y0,h},inverse:function(e){var t,i,r,s,n,o,a={};if(e.x=(e.x-this.x0)*(1/this.a),e.y=(e.y-this.y0)*(1/this.a),this.no_rot?(i=e.y,t=e.x):(i=e.x*this.cosrot-e.y*this.sinrot,t=e.y*this.cosrot+e.x*this.sinrot+this.u_0),s=.5*((r=Math.exp(-this.BrA*i))-1/r),1e-10>Math.abs(Math.abs(o=((n=Math.sin(this.BrA*t))*this.cosgam+s*this.singam)/(.5*(r+1/r)))-1))a.x=0,a.y=o<0?-si:si;else{if(a.y=this.E/Math.sqrt((1+o)/(1-o)),a.y=sv(this.e,Math.pow(a.y,1/this.B)),a.y===1/0)throw Error();a.x=-this.rB*Math.atan2(s*this.cosgam-n*this.singam,Math.cos(this.BrA*t))}return a.x+=this.lam0,a},names:["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_variant_A","Hotine_Oblique_Mercator_Variant_B","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Two_Point_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","Oblique_Mercator","omerc"]},ng={init:function(){if(this.lat2||(this.lat2=this.lat1),this.k0||(this.k0=1),this.x0=this.x0||0,this.y0=this.y0||0,!(1e-10>Math.abs(this.lat1+this.lat2))){var e=this.b/this.a;this.e=Math.sqrt(1-e*e);var t=Math.sin(this.lat1),i=Math.cos(this.lat1),r=sg(this.e,t,i),s=sy(this.e,this.lat1,t),n=Math.sin(this.lat2),o=Math.cos(this.lat2),a=sg(this.e,n,o),l=sy(this.e,this.lat2,n),h=1e-10>Math.abs(Math.abs(this.lat0)-si)?0:sy(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>1e-10?this.ns=Math.log(r/a)/Math.log(s/l):this.ns=t,isNaN(this.ns)&&(this.ns=t),this.f0=r/(this.ns*Math.pow(s,this.ns)),this.rh=this.a*this.f0*Math.pow(h,this.ns),this.title||(this.title="Lambert Conformal Conic")}},forward:function(e){var t,i,r=e.x,s=e.y;1e-10>=Math.abs(2*Math.abs(s)-Math.PI)&&(s=sm(s)*(si-2e-10));var n=Math.abs(Math.abs(s)-si);if(n>1e-10)t=sy(this.e,s,Math.sin(s)),i=this.a*this.f0*Math.pow(t,this.ns);else{if((n=s*this.ns)<=0)return null;i=0}var o=this.ns*s_(r-this.long0,this.over);return e.x=this.k0*(i*Math.sin(o))+this.x0,e.y=this.k0*(this.rh-i*Math.cos(o))+this.y0,e},inverse:function(e){var t,i,r,s,n=(e.x-this.x0)/this.k0,o=this.rh-(e.y-this.y0)/this.k0;this.ns>0?(t=Math.sqrt(n*n+o*o),i=1):(t=-Math.sqrt(n*n+o*o),i=-1);var a=0;if(0!==t&&(a=Math.atan2(i*n,i*o)),0!==t||this.ns>0){if(i=1/this.ns,r=Math.pow(t/(this.a*this.f0),i),-9999===(s=sv(this.e,r)))return null}else s=-si;return e.x=s_(a/this.ns+this.long0,this.over),e.y=s,e},names:["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_1SP","Lambert_Conformal_Conic_2SP","lcc","Lambert Conic Conformal (1SP)","Lambert Conic Conformal (2SP)"]},nm={init:function(){this.a=6377397.155,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.4334234309119251),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq},forward:function(e){var t,i,r,s,n,o,a,l=e.x,h=e.y,u=s_(l-this.long0,this.over);return t=Math.pow((1+this.e*Math.sin(h))/(1-this.e*Math.sin(h)),this.alfa*this.e/2),i=2*(Math.atan(this.k*Math.pow(Math.tan(h/2+this.s45),this.alfa)/t)-this.s45),r=-u*this.alfa,s=Math.asin(Math.cos(this.ad)*Math.sin(i)+Math.sin(this.ad)*Math.cos(i)*Math.cos(r)),n=Math.asin(Math.cos(i)*Math.sin(r)/Math.cos(s)),o=this.n*n,e.y=(a=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(s/2+this.s45),this.n))*Math.cos(o)/1,e.x=a*Math.sin(o)/1,this.czech||(e.y*=-1,e.x*=-1),e},inverse:function(e){var t,i,r,s,n,o,a,l=e.x;e.x=e.y,e.y=l,this.czech||(e.y*=-1,e.x*=-1),n=Math.sqrt(e.x*e.x+e.y*e.y),s=Math.atan2(e.y,e.x)/Math.sin(this.s0),r=2*(Math.atan(Math.pow(this.ro0/n,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),t=Math.asin(Math.cos(this.ad)*Math.sin(r)-Math.sin(this.ad)*Math.cos(r)*Math.cos(s)),i=Math.asin(Math.cos(r)*Math.sin(s)/Math.cos(t)),e.x=this.long0-i/this.alfa,o=t,a=0;var h=0;do e.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(t/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(o))/(1-this.e*Math.sin(o)),this.e/2))-this.s45),1e-10>Math.abs(o-e.y)&&(a=1),o=e.y,h+=1;while(0===a&&h<15);return h>=15?null:e},names:["Krovak","Krovak Modified","Krovak (North Orientated)","Krovak Modified (North Orientated)","krovak"]};function n_(e,t,i,r,s){return e*s-t*Math.sin(2*s)+i*Math.sin(4*s)-r*Math.sin(6*s)}function ny(e){return 1-.25*e*(1+e/16*(3+1.25*e))}function nv(e){return .375*e*(1+.25*e*(1+.46875*e))}function nb(e){return .05859375*e*e*(1+.75*e)}function nE(e){return e*e*e*(35/3072)}function nx(e,t,i){var r=t*i;return e/Math.sqrt(1-r*r)}function nw(e){return Math.abs(e)<si?e:e-sm(e)*Math.PI}function nS(e,t,i,r,s){n=e/t;for(var n,o,a=0;a<15;a++)if(o=(e-(t*n-i*Math.sin(2*n)+r*Math.sin(4*n)-s*Math.sin(6*n)))/(t-2*i*Math.cos(2*n)+4*r*Math.cos(4*n)-6*s*Math.cos(6*n)),n+=o,1e
3446-10>=Math.abs(o))return n;return NaN}let nP={init:function(){this.sphere||(this.e0=ny(this.es),this.e1=nv(this.es),this.e2=nb(this.es),this.e3=nE(this.es),this.ml0=this.a*n_(this.e0,this.e1,this.e2,this.e3,this.lat0))},forward:function(e){var t,i,r=e.x,s=e.y;if(r=s_(r-this.long0,this.over),this.sphere)t=this.a*Math.asin(Math.cos(s)*Math.sin(r)),i=this.a*(Math.atan2(Math.tan(s),Math.cos(r))-this.lat0);else{var n=Math.sin(s),o=Math.cos(s),a=nx(this.a,this.e,n),l=Math.tan(s)*Math.tan(s),h=r*Math.cos(s),u=h*h,c=this.es*o*o/(1-this.es),d=this.a*n_(this.e0,this.e1,this.e2,this.e3,s);t=a*h*(1-u*l*(1/6-(8-l+8*c)*u/120)),i=d-this.ml0+a*n/o*u*(.5+(5-l+6*c)*u/24)}return e.x=t+this.x0,e.y=i+this.y0,e},inverse:function(e){e.x-=this.x0,e.y-=this.y0;var t,i,r=e.x/this.a,s=e.y/this.a;if(this.sphere){var n=s+this.lat0;t=Math.asin(Math.sin(n)*Math.cos(r)),i=Math.atan2(Math.tan(r),Math.cos(n))}else{var o=nS(this.ml0/this.a+s,this.e0,this.e1,this.e2,this.e3);if(1e-10>=Math.abs(Math.abs(o)-si))return e.x=this.long0,e.y=si,s<0&&(e.y*=-1),e;var a=nx(this.a,this.e,Math.sin(o)),l=a*a*a/this.a/this.a*(1-this.es),h=Math.pow(Math.tan(o),2),u=r*this.a/a,c=u*u;t=o-a*Math.tan(o)/l*u*u*(.5-(1+3*h)*u*u/24),i=u*(1-c*(h/3+(1+3*h)*h*c/15))/Math.cos(o)}return e.x=s_(i+this.long0,this.over),e.y=nw(t),e},names:["Cassini","Cassini_Soldner","cass"]};function nT(e,t){var i;return e>1e-7?(i=e*t,(1-e*e)*(t/(1-i*i)-.5/e*Math.log((1-i)/(1+i)))):2*t}function nA(e){var t,i=[];return i[0]=.3333333333333333*e,t=e*e,i[0]+=.17222222222222222*t,i[1]=.06388888888888888*t,t*=e,i[0]+=.10257936507936508*t,i[1]+=.0664021164021164*t,i[2]=.016415012942191543*t,i}function nM(e,t){var i=e+e;return e+t[0]*Math.sin(i)+t[1]*Math.sin(i+i)+t[2]*Math.sin(i+i+i)}let nC={init:function(){var e,t=Math.abs(this.lat0);if(1e-10>Math.abs(t-si)?this.mode=this.lat0<0?1:2:1e-10>Math.abs(t)?this.mode=3:this.mode=4,this.es>0)switch(this.qp=nT(this.e,1),this.mmf=.5/(1-this.es),this.apa=nA(this.es),this.mode){case 2:case 1:this.dd=1;break;case 3:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case 4:this.rq=Math.sqrt(.5*this.qp),e=Math.sin(this.lat0),this.sinb1=nT(this.e,e)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*e*e)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd}else 4===this.mode&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))},forward:function(e){var t,i,r,s,n,o,a,l,h,u,c=e.x,d=e.y;if(c=s_(c-this.long0,this.over),this.sphere){if(n=Math.sin(d),u=Math.cos(d),r=Math.cos(c),this.mode===this.OBLIQ||this.mode===this.EQUIT){if((i=this.mode===this.EQUIT?1+u*r:1+this.sinph0*n+this.cosph0*u*r)<=1e-10)return null;t=(i=Math.sqrt(2/i))*u*Math.sin(c),i*=this.mode===this.EQUIT?n:this.cosph0*n-this.sinph0*u*r}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(r=-r),1e-10>Math.abs(d+this.lat0))return null;i=sr-.5*d,t=(i=2*(this.mode===this.S_POLE?Math.cos(i):Math.sin(i)))*Math.sin(c),i*=r}}else{switch(a=0,l=0,h=0,r=Math.cos(c),s=Math.sin(c),n=Math.sin(d),o=nT(this.e,n),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(l=Math.sqrt(1-(a=o/this.qp)*a)),this.mode){case this.OBLIQ:h=1+this.sinb1*a+this.cosb1*l*r;break;case this.EQUIT:h=1+l*r;break;case this.N_POLE:h=si+d,o=this.qp-o;break;case this.S_POLE:h=d-si,o=this.qp+o}if(1e-10>Math.abs(h))return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:h=Math.sqrt(2/h),i=this.mode===this.OBLIQ?this.ymf*h*(this.cosb1*a-this.sinb1*l*r):(h=Math.sqrt(2/(1+l*r)))*a*this.ymf,t=this.xmf*h*l*s;break;case this.N_POLE:case this.S_POLE:o>=0?(t=(h=Math.sqrt(o))*s,i=r*(this.mode===this.S_POLE?h:-h)):t=i=0}}return e.x=this.a*t+this.x0,e.y=this.a*i+this.y0,e},inverse:function(e){e.x-=this.x0,e.y-=this.y0;var t=e.x/this.a,i=e.y/this.a;if(this.sphere){var r,s,n,o,a,l,h,u,c=0,d=0;if((s=.5*(u=Math.sqrt(t*t+i*i)))>1)return null;switch(s=2*Math.asin(s),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(d=Math.sin(s),c=Math.cos(s)),this.mode){case this.EQUIT:s=1e-10>=Math.abs(u)?0:Math.asin(i*d/u),t*=d,i=c*u;break;case this.OBLIQ:s=1e-10>=Math.abs(u)?this.lat0:Math.asin(c*this.sinph0+i*d*this.cosph0/u),t*=d*this.cosph0,i=(c-Math.sin(s)*this.sinph0)*u;break;case this.N_POLE:i=-i,s=si-s;break;case this.S_POLE:s-=si}r=0===i&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(t,i)}else{if(h=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(t/=this.dd,i*=this.dd,(l=Math.sqrt(t*t+i*i))<1e-10)return e.x=this.long0,e.y=this.lat0,e;n=Math.cos(o=2*Math.asin(.5*l/this.rq)),t*=o=Math.sin(o),this.mode===this.OBLIQ?(h=n*this.sinb1+i*o*this.cosb1/l,a=this.qp*h,i=l*this.cosb1*n-i*this.sinb1*o):(h=i*o/l,a=this.qp*h,i=l*n)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(i=-i),!(a=t*t+i*i))return e.x=this.long0,e.y=this.lat0,e;h=1-a/this.qp,this.mode===this.S_POLE&&(h=-h)}r=Math.atan2(t,i),s=nM(Math.asin(h),this.apa)}return e.x=s_(this.long0+r,this.over),e.y=s,e}
3446,names:["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],S_POLE:1,N_POLE:2,EQUIT:3,OBLIQ:4};function nR(e){return Math.abs(e)>1&&(e=e>1?1:-1),Math.asin(e)}let nL={init:function(){1e-10>Math.abs(this.lat1+this.lat2)||(this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=sg(this.e3,this.sin_po,this.cos_po),this.qs1=nT(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=sg(this.e3,this.sin_po,this.cos_po),this.qs2=nT(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=nT(this.e3,this.sin_po),Math.abs(this.lat1-this.lat2)>1e-10?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)},forward:function(e){var t=e.x,i=e.y;this.sin_phi=Math.sin(i),this.cos_phi=Math.cos(i);var r=nT(this.e3,this.sin_phi),s=this.a*Math.sqrt(this.c-this.ns0*r)/this.ns0,n=this.ns0*s_(t-this.long0,this.over),o=s*Math.sin(n)+this.x0,a=this.rh-s*Math.cos(n)+this.y0;return e.x=o,e.y=a,e},inverse:function(e){var t,i,r,s,n;return e.x-=this.x0,e.y=this.rh-e.y+this.y0,this.ns0>=0?(t=Math.sqrt(e.x*e.x+e.y*e.y),r=1):(t=-Math.sqrt(e.x*e.x+e.y*e.y),r=-1),s=0,0!==t&&(s=Math.atan2(r*e.x,r*e.y)),r=t*this.ns0/this.a,this.sphere?n=Math.asin((this.c-r*r)/(2*this.ns0)):(i=(this.c-r*r)/this.ns0,n=this.phi1z(this.e3,i)),e.x=s_(s/this.ns0+this.long0,this.over),e.y=n,e},names:["Albers_Conic_Equal_Area","Albers_Equal_Area","Albers","aea"],phi1z:function(e,t){var i,r,s,n,o,a=nR(.5*t);if(e<1e-10)return a;for(var l=e*e,h=1;h<=25;h++)if(i=Math.sin(a),r=Math.cos(a),a+=o=.5*(n=1-(s=e*i)*s)*n/r*(t/(1-l)-i/n+.5/e*Math.log((1-s)/(1+s))),1e-7>=Math.abs(o))return a;return null}},nI={init:function(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1},forward:function(e){var t,i,r,s,n,o,a,l=e.x,h=e.y;return r=s_(l-this.long0,this.over),t=Math.sin(h),i=Math.cos(h),s=Math.cos(r),(n=this.sin_p14*t+this.cos_p14*i*s)>0||1e-10>=Math.abs(n)?(o=this.x0+this.a*i*Math.sin(r)/n,a=this.y0+this.a*(this.cos_p14*t-this.sin_p14*i*s)/n):(o=this.x0+this.infinity_dist*i*Math.sin(r),a=this.y0+this.infinity_dist*(this.cos_p14*t-this.sin_p14*i*s)),e.x=o,e.y=a,e},inverse:function(e){var t,i,r,s,n,o;return e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,e.x/=this.k0,e.y/=this.k0,(t=Math.sqrt(e.x*e.x+e.y*e.y))?(i=Math.sin(s=Math.atan2(t,this.rc)),o=nR((r=Math.cos(s))*this.sin_p14+e.y*i*this.cos_p14/t),n=Math.atan2(e.x*i,t*this.cos_p14*r-e.y*this.sin_p14*i),n=s_(this.long0+n,this.over)):(o=this.phic0,n=0),e.x=n,e.y=o,e},names:["gnom"]},nO={init:function(){this.sphere||(this.k0=sg(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))},forward:function(e){var t,i,r=e.x,s=e.y,n=s_(r-this.long0,this.over);if(this.sphere)t=this.x0+this.a*n*Math.cos(this.lat_ts),i=this.y0+this.a*Math.sin(s)/Math.cos(this.lat_ts);else{var o=nT(this.e,Math.sin(s));t=this.x0+this.a*this.k0*n,i=this.y0+this.a*o*.5/this.k0}return e.x=t,e.y=i,e},inverse:function(e){var t,i;return e.x-=this.x0,e.y-=this.y0,this.sphere?(t=s_(this.long0+e.x/this.a/Math.cos(this.lat_ts),this.over),i=Math.asin(e.y/this.a*Math.cos(this.lat_ts))):(i=function(e,t){if(1e-6>Math.abs(Math.abs(t)-(1-(1-e*e)/(2*e)*Math.log((1-e)/(1+e)))))if(t<0)return -1*si;else return si;for(var i,r,s,n,o=Math.asin(.5*t),a=0;a<30;a++)if(r=Math.sin(o),s=Math.cos(o),o+=i=Math.pow(1-(n=e*r)*n,2)/(2*s)*(t/(1-e*e)-r/(1-n*n)+.5/e*Math.log((1-n)/(1+n))),1e-10>=Math.abs(i))return o;return NaN}(this.e,2*e.y*this.k0/this.a),t=s_(this.long0+e.x/(this.a*this.k0),this.over)),e.x=t,e.y=i,e},names:["cea"]},nN={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)},forward:function(e){var t=e.x,i=e.y,r=s_(t-this.long0,this.over),s=nw(i-this.lat0);return e.x=this.x0+this.a*r*this.rc,e.y=this.y0+this.a*s,e},inverse:function(e){var t=e.x,i=e.y;return e.x=s_(this.long0+(t-this.x0)/(this.a*this.rc),this.over),e.y=nw(this.lat0+(i-this.y0)/this.a),e},names:["Equirectangular","Equidistant_Cylindrical","Equidistant_Cylindrical_Spherical","eqc"]},nF={init:function(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=ny(this.es),this.e1=nv(this.es),this.e2=nb(this.es),this.e3=nE(this.es),this.ml0=this.a*n_(this.e0,this.e1,this.e2,this.e3,this.lat0)},forward:function(e){var t,i,r,s=e.x,n=e.y,o=s_(s-this.long0,this.over);if(r=o*Math.sin(n),this.sphere)1e-10>=Math.abs(n)?(t=this.a*o,i=-1*this.a*this.lat0):(t=this.a*Math.sin(r)/Math.tan(n),i=this.a*(nw(n-this.lat0)+(1-Math.cos(r))/Math.tan(n)));else if(1e-10>=Math.abs(n))t=this.a*o,i=-1*this.ml0;else{var a=nx(this.a,this.e,Math.sin(n))/Math.tan(n);t=a*Math.sin(r),i=this.a*n_(this.e0,this.e1,this.e2,this.e3,n)-this.ml0+a*(1-Math.cos(r))}return e.x=t+this.x0,e.y=i+this.y0,e},inverse:function(e){var t,i,r,s,n,o,a,l,h,u,c,d,f,p,g;if(r=e.x-this.x0,s=e.y-this.y0,this.sphere)if(1e-10>=Math.abs(s+this.a*this.lat0))t=s_(r/this.a+this.long0,this.over),i=0;else{for(n=20,o=this.lat0+s/this.a,a=r*r/this.a/this.a+o*o,l=o;n;--n)if(u=Math.tan(l),h=-1*(o*(l*u+1)-l-.5*(l*l+a)*u)/((l-o)/u-1),l+=h,1e-10>=Math.abs(h)){i=l;break}t=s_(this.long0+Math.asin(r*Math.tan(l)/this.a)/Math.sin(i),this.over)}else if(1e-10>=Math.abs(s+this.ml0))i=0,t=s_(this.long0+r/this.a,this.over);else{for(n=20,o=(this.ml0+s)/this.a,a=r*r/this.a/this.a+o*o,l=o;n;--n)if(c=Math.sqrt(1-(g=this.e*Math.sin(l))*g)*Math.tan(l),d=this.a*n_(this.e0,this.e1,this.e2,this.e3,l),f=this.e0-2*this.e1*Math.cos(2*l)+4*this.e2*Math.cos(4*l)-6*this.e3*Math.cos(6*l),h=(o*(c*(p=d/this.a)+1)-p-.5*c*(p*p+a))
3446/(this.es*Math.sin(2*l)*(p*p+a-2*o*p)/(4*c)+(o-p)*(c*f-2/Math.sin(2*l))-f),l-=h,1e-10>=Math.abs(h)){i=l;break}c=Math.sqrt(1-this.es*Math.pow(Math.sin(i),2))*Math.tan(i),t=s_(this.long0+Math.asin(r*c/this.a)/Math.sin(i),this.over)}return e.x=t,e.y=i,e},names:["Polyconic","American_Polyconic","poly"]},nD={init:function(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013},forward:function(e){var t,i,r,s=e.x,n=e.y-this.lat0,o=s-this.long0,a=n/484813681109536e-20*1e-5,l=1,h=0;for(t=1;t<=10;t++)l*=a,h+=this.A[t]*l;var u=h,c=1,d=0,f=0,p=0;for(t=1;t<=6;t++)i=c*u-d*o,r=d*u+c*o,c=i,d=r,f=f+this.B_re[t]*c-this.B_im[t]*d,p=p+this.B_im[t]*c+this.B_re[t]*d;return e.x=p*this.a+this.x0,e.y=f*this.a+this.y0,e},inverse:function(e){var t=e.x,i=e.y,r=t-this.x0,s=(i-this.y0)/this.a,n=r/this.a,o=1,a=0,l=0,h=0;for(c=1;c<=6;c++)d=o*s-a*n,f=a*s+o*n,o=d,a=f,l=l+this.C_re[c]*o-this.C_im[c]*a,h=h+this.C_im[c]*o+this.C_re[c]*a;for(var u=0;u<this.iterations;u++){var c,d,f,p,g,m=l,_=h,y=s,v=n;for(c=2;c<=6;c++)p=m*l-_*h,g=_*l+m*h,m=p,_=g,y+=(c-1)*(this.B_re[c]*m-this.B_im[c]*_),v+=(c-1)*(this.B_im[c]*m+this.B_re[c]*_);m=1,_=0;var b=this.B_re[1],E=this.B_im[1];for(c=2;c<=6;c++)p=m*l-_*h,g=_*l+m*h,m=p,_=g,b+=c*(this.B_re[c]*m-this.B_im[c]*_),E+=c*(this.B_im[c]*m+this.B_re[c]*_);var x=b*b+E*E;l=(y*b+v*E)/x,h=(v*b-y*E)/x}var w=l,S=h,P=1,T=0;for(c=1;c<=9;c++)P*=w,T+=this.D[c]*P;var A=this.lat0+484813681109536e-20*T*1e5;return e.x=this.long0+S,e.y=A,e},names:["New_Zealand_Map_Grid","nzmg"]},nB={init:function(){},forward:function(e){var t=e.x,i=e.y,r=s_(t-this.long0,this.over),s=this.x0+this.a*r,n=this.y0+this.a*Math.log(Math.tan(Math.PI/4+i/2.5))*1.25;return e.x=s,e.y=n,e},inverse:function(e){e.x-=this.x0,e.y-=this.y0;var t=s_(this.long0+e.x/this.a,this.over),i=2.5*(Math.atan(Math.exp(.8*e.y/this.a))-Math.PI/4);return e.x=t,e.y=i,e},names:["Miller_Cylindrical","mill"]};function nG(e){var t,i,r=e.x,s=e.y;if(r=s_(r-this.long0,this.over),this.sphere){if(this.m)for(var n=this.n*Math.sin(s),o=20;o;--o){var a=(this.m*s+Math.sin(s)-n)/(this.m+Math.cos(s));if(s-=a,1e-10>Math.abs(a))break}else s=1!==this.n?Math.asin(this.n*Math.sin(s)):s;t=this.a*this.C_x*r*(this.m+Math.cos(s)),i=this.a*this.C_y*s}else{var l=Math.sin(s),h=Math.cos(s);i=this.a*s9(s,l,h,this.en),t=this.a*r*h/Math.sqrt(1-this.es*l*l)}return e.x=t,e.y=i,e}function nk(e){var t,i,r;return e.x-=this.x0,i=e.x/this.a,e.y-=this.y0,t=e.y/this.a,this.sphere?(t/=this.C_y,i/=this.C_x*(this.m+Math.cos(t)),this.m?t=nR((this.m*t+Math.sin(t))/this.n):1!==this.n&&(t=nR(Math.sin(t)/this.n)),i=s_(i+this.long0,this.over),t=nw(t)):(r=Math.abs(t=ne(e.y/this.a,this.es,this.en)))<si?(r=Math.sin(t),i=s_(this.long0+e.x*Math.sqrt(1-this.es*r*r)/(this.a*Math.cos(t)),this.over)):r-1e-10<si&&(i=this.long0),e.x=i,e.y=t,e}let nU={init:function(){this.long0=this.long0||0,this.sphere?(this.n=1,this.m=0,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)):this.en=s7(this.es)},forward:nG,inverse:nk,names:["Sinusoidal","sinu"]},nz={init:function(){this.sphere=!0,this.b=this.a,this.m=1,this.n=2.5707963267948966,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)},forward:nG,inverse:nk,names:["Eckert_VI","eck6"]},nj={init:function(){this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0},forward:function(e){for(var t=e.x,i=e.y,r=s_(t-this.long0,this.over),s=i,n=Math.PI*Math.sin(i);;){var o=-(s+Math.sin(s)-n)/(1+Math.cos(s));if(s+=o,1e-10>Math.abs(o))break}s/=2,Math.PI/2-Math.abs(i)<1e-10&&(r=0);var a=.900316316158*this.a*r*Math.cos(s)+this.x0,l=1.4142135623731*this.a*Math.sin(s)+this.y0;return e.x=a,e.y=l,e},inverse:function(e){e.x-=this.x0,e.y-=this.y0,Math.abs(t=e.y/(1.4142135623731*this.a))>.999999999999&&(t=.999999999999);var t,i=Math.asin(t),r=s_(this.long0+e.x/(.900316316158*this.a*Math.cos(i)),this.over);r<-Math.PI&&(r=-Math.PI),r>Math.PI&&(r=Math.PI),Math.abs(t=(2*i+Math.sin(2*i))/Math.PI)>1&&(t=1);var s=Math.asin(t);return e.x=r,e.y=s,e},names:["Mollweide","moll"]},nV={init:function(){1e-10>Math.abs(this.lat1+this.lat2)||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=ny(this.es),this.e1=nv(this.es),this.e2=nb(this.es),this.e3=nE(this.es),this.sin_phi=Math.sin(this.lat1),this.cos_phi=Math.cos(this.lat1),this.ms1=sg(this.e,this.sin_phi,this.cos_phi),this.ml1=n_(this.e0,this.e1,this.e2,this.e3,this.lat1),1e-10>Math.abs(this.lat1-this.lat2)?this.ns=this.sin_phi:(this.sin_phi=Math.sin(this.lat2),this.cos_phi=Math.cos(this.lat2),this.ms2=sg(this.e,this.sin_phi,this.cos_phi),this.ml2=n_(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=n_(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))},forward:function(e){var t,i=e.x,r=e.y;if(this.sphere)t=this.a*(this.g-r);else{var s=n_(this.e0,this.e1,this.e2,this.e3,r);t=this.a*(this.g-s)}var n=this.ns*s_(i-this.long0,this.over),o=this.x0+t*Math.sin(n),a=this.y0+this.rh-t*Math.cos(n);return e.x=o,e.y=a,e},inverse:function(e){e.x-=this.x0,e.y=this.rh-e.y+this.y0,this.ns>=0?(i=Math.sqrt(e.x*e.x+e.y*e.y),t=1):(i=-Math.sqrt(e.x*e.x+e.y*e.y),t=-1);var t,i,r,s,n=0;return(0!==i&&(n=Math.atan2(t*e.x,t*e.y)),this.sphere)?(s=s_(this.long0+n/this.ns,this.over),r=nw(this.g-i/this.a),e.x=s):(r=nS(this.g-i/this.a,this.e0,this.e1,this.e2,this.e3),e.x=s=s_(this.long0+n/this.ns,this.over)),e.y=r,e},names:["Equidistant_Conic","eqdc"]},nW={init:function(){this.R=this.a},forward:function(e){var t,i,r=e.x,s=e.y,n=s_(r-this.long0,this.over);1e-10>=Math.abs(s)&&(t=this.x0+this.R*n,i=this.y0);var o=nR(2*Math.abs(s/Math.PI));(1e-10>=Math.abs(n)||1e-10>=Math.abs(Math.abs(s)-si))&&(t=this.x0,i=s>=0?this.y0+Math.PI*this.R*Math.tan(.5*o):this.y0+-(Math.PI*this.R*Math.tan(.5*o)));var a=.5*Math.abs(Math.PI/n-n/Math.PI),l=a*a,h=Math.sin(o),u=Math.cos(o),c=u/(h+u-1),d=c*(2/h-1),f=d*d,p=Math.PI*this.R*(a*(c-f)+Math.sqrt(l*(c-f)*(c-f)-(f+l)*(c*c-f)))/(f+l);n<0&&(p=-p),t=this.x0+p;var g=l+c;return p=Math.PI*this.R*(d*g-a*Math.sqrt((f+l)*(l+1)-g*g))/(f+l),i=s>=0?this.y0+p:this.y0-p,e.x=t,e.y=i,e},inverse:function(e){var t,i,r,s,n,o,a,l,h,u,c,d;return e.x-=this.x0,e.y-=this.y0,u=Math.PI*this.R,s=(i=e.x/u)*i+(r=e.y/u)*r,o=(n=-Math.abs(r)*(1+s))-2*r*r+i*i,a=-2*n+1+2*r*r+s*s,d=r*r/a+(2*o
3446*o*o/a/a/a-9*n*o/a/a)/27,h=2*Math.sqrt(-(l=(n-o*o/3/a)/a)/3),Math.abs(u=3*d/l/h)>1&&(u=u>=0?1:-1),c=Math.acos(u)/3,t=e.y>=0?(-h*Math.cos(c+Math.PI/3)-o/3/a)*Math.PI:-(-h*Math.cos(c+Math.PI/3)-o/3/a)*Math.PI,e.x=1e-10>Math.abs(i)?this.long0:s_(this.long0+Math.PI*(s-1+Math.sqrt(1+2*(i*i-r*r)+s*s))/2/i,this.over),e.y=t,e},names:["Van_der_Grinten_I","VanDerGrinten","Van_der_Grinten","vandg"]},n$={init:function(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0),this.f=this.es/(1+Math.sqrt(1-this.es))},forward:function(e){var t,i,r,s,n,o,a,l,h,u,c=e.x,d=e.y,f=Math.sin(e.y),p=Math.cos(e.y),g=s_(c-this.long0,this.over);if(this.sphere)if(1e-10>=Math.abs(this.sin_p12-1))return e.x=this.x0+this.a*(si-d)*Math.sin(g),e.y=this.y0-this.a*(si-d)*Math.cos(g),e;else if(1e-10>=Math.abs(this.sin_p12+1))return e.x=this.x0+this.a*(si+d)*Math.sin(g),e.y=this.y0+this.a*(si+d)*Math.cos(g),e;else return l=(a=Math.acos(this.sin_p12*f+this.cos_p12*p*Math.cos(g)))?a/Math.sin(a):1,e.x=this.x0+this.a*l*p*Math.sin(g),e.y=this.y0+this.a*l*(this.cos_p12*f-this.sin_p12*p*Math.cos(g)),e;return(t=ny(this.es),i=nv(this.es),r=nb(this.es),s=nE(this.es),1e-10>=Math.abs(this.sin_p12-1))?(n=this.a*n_(t,i,r,s,si),o=this.a*n_(t,i,r,s,d),e.x=this.x0+(n-o)*Math.sin(g),e.y=this.y0-(n-o)*Math.cos(g),e):1e-10>=Math.abs(this.sin_p12+1)?(n=this.a*n_(t,i,r,s,si),o=this.a*n_(t,i,r,s,d),e.x=this.x0+(n+o)*Math.sin(g),e.y=this.y0+(n+o)*Math.cos(g),e):(1e-10>Math.abs(c)&&1e-10>Math.abs(d-this.lat0)?e.x=e.y=0:(u=(h=function(e,t,i,r,s,n){let o,a,l,h,u,c,d,f,p,g,m,_,y=r-t,v=Math.atan((1-n)*Math.tan(e)),b=Math.atan((1-n)*Math.tan(i)),E=Math.sin(v),x=Math.cos(v),w=Math.sin(b),S=Math.cos(b),P=y,T,A=100;do{if(0===(l=Math.sqrt(S*(o=Math.sin(P))*(S*o)+(x*w-E*S*(a=Math.cos(P)))*(x*w-E*S*a))))return{azi1:0,s12:0};u=Math.atan2(l,h=E*w+x*S*a),f=0!=(d=1-(c=x*S*o/l)*c)?h-2*E*w/d:0,p=n/16*d*(4+n*(4-3*d)),T=P,P=y+(1-p)*n*c*(u+p*l*(f+p*h*(-1+2*f*f)))}while(Math.abs(P-T)>1e-12&&--A>0);return 0===A?{azi1:NaN,s12:NaN}:(m=1+(g=d*(s*s-s*(1-n)*(s*(1-n)))/(s*(1-n)*(s*(1-n))))/16384*(4096+g*(-768+g*(320-175*g))),{azi1:Math.atan2(S*o,x*w-E*S*a),s12:s*(1-n)*m*(u-(_=g/1024*(256+g*(-128+g*(74-47*g))))*l*(f+_/4*(h*(-1+2*f*f)-_/6*f*(-3+4*l*l)*(-3+4*f*f))))})}(this.lat0,this.long0,d,c,this.a,this.f)).azi1,e.x=h.s12*Math.sin(u),e.y=h.s12*Math.cos(u)),e)},inverse:function(e){var t,i,r,s,n,o,a,l,h,u,c,d,f,p;if(e.x-=this.x0,e.y-=this.y0,this.sphere){if((t=Math.sqrt(e.x*e.x+e.y*e.y))>2*si*this.a)return;return r=Math.sin(i=t/this.a),s=Math.cos(i),n=this.long0,1e-10>=Math.abs(t)?o=this.lat0:(o=nR(s*this.sin_p12+e.y*r*this.cos_p12/t),n=1e-10>=Math.abs(Math.abs(this.lat0)-si)?this.lat0>=0?s_(this.long0+Math.atan2(e.x,-e.y),this.over):s_(this.long0-Math.atan2(-e.x,e.y),this.over):s_(this.long0+Math.atan2(e.x*r,t*this.cos_p12*s-e.y*this.sin_p12*r),this.over)),e.x=n,e.y=o,e}return(a=ny(this.es),l=nv(this.es),h=nb(this.es),u=nE(this.es),1e-10>=Math.abs(this.sin_p12-1))?(o=nS(((c=this.a*n_(a,l,h,u,si))-(t=Math.sqrt(e.x*e.x+e.y*e.y)))/this.a,a,l,h,u),n=s_(this.long0+Math.atan2(e.x,-1*e.y),this.over),e.x=n,e.y=o):1e-10>=Math.abs(this.sin_p12+1)?(c=this.a*n_(a,l,h,u,si),o=nS(((t=Math.sqrt(e.x*e.x+e.y*e.y))-c)/this.a,a,l,h,u),n=s_(this.long0+Math.atan2(e.x,e.y),this.over),e.x=n,e.y=o):(d=Math.atan2(e.x,e.y),f=Math.sqrt(e.x*e.x+e.y*e.y),e.x=(p=function(e,t,i,r,s,n){let o,a,l,h,u=Math.atan((1-n)*Math.tan(e)),c=Math.sin(u),d=Math.cos(u),f=Math.sin(i),p=Math.cos(i),g=Math.atan2(c,d*p),m=d*f,_=1-m*m,y=_*(s*s-s*(1-n)*(s*(1-n)))/(s*(1-n)*(s*(1-n))),v=1+y/16384*(4096+y*(-768+y*(320-175*y))),b=y/1024*(256+y*(-128+y*(74-47*y))),E=r/(s*(1-n)*v),x,w=100;do o=Math.cos(2*g+E),h=b*(a=Math.sin(E))*(o+b/4*((l=Math.cos(E))*(-1+2*o*o)-b/6*o*(-3+4*a*a)*(-3+4*o*o))),x=E,E=r/(s*(1-n)*v)+h;while(Math.abs(E-x)>1e-12&&--w>0);if(0===w)return{lat2:NaN,lon2:NaN};let S=c*a-d*l*p,P=Math.atan2(c*l+d*a*p,(1-n)*Math.sqrt(m*m+S*S)),T=n/16*_*(4+n*(4-3*_));return{lat2:P,lon2:t+(Math.atan2(a*f,d*l-c*a*p)-(1-T)*n*m*(E+T*a*(o+T*l*(-1+2*o*o))))}}(this.lat0,this.long0,d,f,this.a,this.f)).lon2,e.y=p.lat2),e},names:["Azimuthal_Equidistant","aeqd"]},nH={init:function(){this.sin_p14=Math.sin(this.lat0||0),this.cos_p14=Math.cos(this.lat0||0)},forward:function(e){var t,i,r,s,n,o,a,l=e.x,h=e.y;return r=s_(l-(this.long0||0),this.over),t=Math.sin(h),i=Math.cos(h),s=Math.cos(r),((n=this.sin_p14*t+this.cos_p14*i*s)>0||1e-10>=Math.abs(n))&&(o=this.a*i*Math.sin(r),a=(this.y0||0)+this.a*(this.cos_p14*t-this.sin_p14*i*s)),e.x=o,e.y=a,e},inverse:function(e){var t,i,r,s,n,o,a,l;return(e.x-=this.x0||0,e.y-=this.y0||0,r=Math.sin(i=nR((t=Math.sqrt(e.x*e.x+e.y*e.y))/this.a)),s=Math.cos(i),a=this.long0||0,l=this.lat0||0,n=a,1e-10>=Math.abs(t))?o=l:(o=nR(s*this.sin_p14+e.y*r*this.cos_p14/t),1e-10>=Math.abs(Math.abs(l)-si))?n=l>=0?s_(a+Math.atan2(e.x,-e.y),this.over):s_(a-Math.atan2(-e.x,e.y),this.over):n=s_(a+Math.atan2(e.x*r,t*this.cos_p14*s-e.y*this.sin_p14*r),this.over),e.x=n,e.y=o,e},names:["ortho"]};var nq={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},nK={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function nX(e,t,i,r){var s;return e<1e-10?(r.value=nK.AREA_0,s=0):Math.abs(s=Math.atan2(t,i))<=sr?r.value=nK.AREA_0:s>sr&&s<=si+sr?(r.value=nK.AREA_1,s-=si):s>si+sr||s<=-(si+sr)?(r.value=nK.AREA_2,s=s>=0?s-3.14159265359:s+3.14159265359):(r.value=nK.AREA_3,s+=si),s}function nY(e,t){var i=e+t;return i<-3.14159265359?i+=ss:i>3.14159265359&&(i-=ss),i}let nZ={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.lat0>=si-sr/2?this.face=nq.TOP:this.lat0<=-(si-sr/2)?this.face=nq.BOTTOM:Math.abs(this.long0)<=sr?this.face=nq.FRONT:Math.abs(this.long0)<=si+sr?this.face=this.long0>0?nq.RIGHT:nq.LEFT:this.face=nq.BACK,0!==this.es&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)},forward:function(e){var t,i,r,s,n,o,a,l,h,u,c,d={x:0,y:0},f={value:0};return(e.x-=this.long0,t=0!==this.es?Math.atan(this.one_minus_f_squared*Math.tan(e.y)):e.y,i=e.x,this.face===nq.TOP)?(s=si-t,i>=sr&&i<=si+sr?(f.value=nK.AREA_0,r=i-si):i>si+sr||i<=-(si+sr)?(f.value=nK.AREA_1,r=i>0?i-3.14159265359:i+3.14159265359):i>-(si+sr)&&i<=-sr?(f.value=nK.AREA_2,r=i+si):(f.value=nK.AREA_3,r=i)):this.face===nq.BOTTOM?(s=si+t,i>=sr&&i<=si+sr?(f.value=nK.AREA_0,r=-i+si):i<sr&&i>=-sr?(f.value=nK.AREA_1,r=-i):i<-sr&&i>=-(si+sr)?(f.value=nK.AREA_2,r=-i-si):(f.value=nK.AREA_3,r=i>0?-i+3.14159265359:-i-3.14159265359)):(this.face===nq.RIGHT?i=nY(i,+si):this.face===nq.BACK?i=nY(i,3.14159265359):this.face===nq.LEFT&&(i=nY(i,-si)),h=Math.sin(t),u=Math.cos(t),c=Math.sin(i),a=u*Math.cos(i),l=u*c,this.face===nq.FRONT?r=nX(s=Math.acos(a),h,l,f):this.face===nq.RIGHT?r=nX(s=Math.acos(l),h,-a,f):this.face===nq.BACK?r=nX(s=Math.acos(-a),h,-l,f):this.face===nq.LEFT?r=nX(s=Math.acos(-l),h,a,f):(s=r=0,f.value=nK.AREA_0)),n=Math.sqrt((1-Math.cos(s))/(Math.cos(o=Math.atan(3.8197186342052367*(r+Math.acos(Math.sin(r)*Math.cos(sr))-si)))*Math.cos(o))/(1-Math.cos(Math.atan(1/Math.cos(r))))),f.value===nK.AREA_1?o+=si:f.value===nK.AREA_2?o+=3.14159265359:f.value===nK.AREA_3&&(o+=4.7123889803850005),d.x=n*Math.cos(o),d.y=n*Math.sin(o),d.x=d.x*this.a+this.x0,d.y=d.y*this.a+this.y0,e.x=d.x,e.y=d.y,e},inverse:function(e){var t,i,r,s,n,o,a,l,h,u,c,d,f,p={lam:0,phi:0},g={value:0};return e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,i=Math.atan(Math.sqrt(e.x*e.x+e.y*e.y)),t=Math.atan2(e.y,e.x),e.x>=0&&e.x>=Math.abs(e.y)?g.value=nK.AREA_0:e.y>=0&&e.y>=Math.abs(e.x)?(g.value=nK.AREA_1,t-=si):e.x<0&&-e.x>=Math.abs(e.y)?(g.value=nK.AREA_2,t=t<0?t+3.14159265359:t-3.14159265359):(g.value=nK.AREA_3,t+=si),n=Math.atan(Math.sin(a=3.14159265359/12*Math.tan(t))/(Math.cos(a)-1/Math.sqrt(2))),(o=1-(r=Math.cos(t))*r*(s=Math.tan(i))*s*(1-Math.cos(Math.atan(1/Math.cos(n)))))<-1?o=-1:o>1&&(o=1),this.face===nq.TOP?(p.phi=si-Math.acos(o),g.value===nK.AREA_0?p.lam=n+si:g.value===nK.AREA_1?p.lam=n<0?n+3.14159265359:n-3.14159265359:g.value===nK.AREA_2?p.lam=n-si:p.lam=n):this.face===nq.BOTTOM?(p.phi=Math.acos(o)-si,g.value===nK.AREA_0?p.lam=-n+si:g.value===nK.AREA_1?p.lam=-n:g.value===nK.AREA_2?p.lam=-n-si:p.lam=n<0?-n-3.14159265359:-n+3.14159265359):(u=(a=(l=o)*l)>=1?0:Math.sqrt(1-a)*Math.sin(n),a+=u*u,h=a>=1?0:Math.sqrt(1-a),g.value===nK.AREA_1?(a=h,h=-u,u=a):g.value===nK.AREA_2?(h=-h,u=-u):g.value===nK.AREA_3&&(a=h,h=u,u=-a),this.face===nq.RIGHT?(a=l,l=-h,h=a):this.face===nq.BACK?(l=-l,h=-h):this.face===nq.LEFT&&(a=l,l=h,h=-a),p.phi=Math.acos(-u)-si,p.lam=Math.atan2(h,l),this.face===nq.RIGHT?p.lam=nY(p.lam,-si):this.face===nq.BACK?p.lam=nY(p.lam,-3.14159265359):this.face===nq.LEFT&&(p.lam=nY(p.lam,+si))),0!==this.es&&(c=+(p.p
3446hi<0),d=Math.tan(p.phi),f=this.b/Math.sqrt(d*d+this.one_minus_f_squared),p.phi=Math.atan(Math.sqrt(this.a*this.a-f*f)/(this.one_minus_f*f)),c&&(p.phi=-p.phi)),p.lam+=this.long0,e.x=p.lam,e.y=p.phi,e},names:["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"]};var nQ=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-986701e-12],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,18736e-12],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,934959e-12],[.7986,-.00755338,-500009e-10,935324e-12],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],nJ=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-126793e-14,422642e-15],[.124,.0124,507171e-14,-160604e-14],[.186,.0123999,-190189e-13,600152e-14],[.248,.0124002,710039e-13,-224e-10],[.31,.0123992,-264997e-12,835986e-13],[.372,.0124029,988983e-12,-311994e-12],[.434,.0123893,-369093e-11,-435621e-12],[.4958,.0123198,-102252e-10,-345523e-12],[.5571,.0121916,-154081e-10,-582288e-12],[.6176,.0119938,-241424e-10,-525327e-12],[.6769,.011713,-320223e-10,-516405e-12],[.7346,.0113541,-397684e-10,-609052e-12],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-140374e-14],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],n0=function(e,t){return e[0]+t*(e[1]+t*(e[2]+t*e[3]))};let n1={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"},forward:function(e){var t=s_(e.x-this.long0,this.over),i=Math.abs(e.y),r=Math.floor(11.459155902616464*i);r<0?r=0:r>=18&&(r=17),i=57.29577951308232*(i-.08726646259971647*r);var s={x:n0(nQ[r],i)*t,y:n0(nJ[r],i)};return e.y<0&&(s.y=-s.y),s.x=s.x*this.a*.8487+this.x0,s.y=s.y*this.a*1.3523+this.y0,s},inverse:function(e){var t={x:(e.x-this.x0)/(.8487*this.a),y:Math.abs(e.y-this.y0)/(1.3523*this.a)};if(t.y>=1)t.x/=nQ[18][0],t.y=e.y<0?-si:si;else{var i=Math.floor(18*t.y);for(i<0?i=0:i>=18&&(i=17);;)if(nJ[i][0]>t.y)--i;else if(nJ[i+1][0]<=t.y)++i;else break;var r=nJ[i],s=5*(t.y-r[0])/(nJ[i+1][0]-r[0]);s=function(e,t,i,r){for(var s=t;r;--r){var n=e(s);if(s-=n,1e-10>Math.abs(n))break}return s}(function(e){return(n0(r,e)-t.y)/(r[1]+e*(2*r[2]+3*e*r[3]))},s,0,100),t.x/=n0(nQ[i],s),t.y=(5*i+s)*.017453292519943295,e.y<0&&(t.y=-t.y)}return t.x=s_(t.x+this.long0,this.over),t},names:["Robinson","robin"]},n3={init:function(){this.name="geocent"},forward:function(e){return sU(e,this.es,this.a)},inverse:function(e){return sz(e,this.es,this.a,this.b)},names:["Geocentric","geocentric","geocent","Geocent"]};var n2={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3},n4={h:{def:1e5,num:!0},azi:{def:0,num:!0,degrees:!0},tilt:{def:0,num:!0,degrees:!0},long0:{def:0,num:!0},lat0:{def:0,num:!0}};let n6={init:function(){if(Object.keys(n4).forEach((function(e){if(void 0===this[e])this[e]=n4[e].def;else if(n4[e].num&&isNaN(this[e]))throw Error("Invalid parameter value, must be numeric "+e+" = "+this[e]);else n4[e].num&&(this[e]=parseFloat(this[e]));n4[e].degrees&&(this[e]=.017453292519943295*this[e])}).bind(this)),1e-10>Math.abs(Math.abs(this.lat0)-si)?this.mode=this.lat0<0?n2.S_POLE:n2.N_POLE:1e-10>Math.abs(this.lat0)?this.mode=n2.EQUIT:(this.mode=n2.OBLIQ,this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0)),this.pn1=this.h/this.a,this.pn1<=0||this.pn1>1e10)throw Error("Invalid height");this.p=1+this.pn1,this.rp=1/this.p,this.h1=1/this.pn1,this.pfact=(this.p+1)*this.h1,this.es=0;var e=this.tilt,t=this.azi;this.cg=Math.cos(t),this.sg=Math.sin(t),this.cw=Math.cos(e),this.sw=Math.sin(e)},forward:function(e){e.x-=this.long0;var t,i,r,s,n=Math.sin(e.y),o=Math.cos(e.y),a=Math.cos(e.x);switch(this.mode){case n2.OBLIQ:i=this.sinph0*n+this.cosph0*o*a;break;case n2.EQUIT:i=o*a;break;case n2.S_POLE:i=-n;break;case n2.N_POLE:i=n}switch(t=(i=this.pn1/(this.p-i))*o*Math.sin(e.x),this.mode){case n2.OBLIQ:i*=this.cosph0*n-this.sinph0*o*a;break;case n2.EQUIT:i*=n;break;case n2.N_POLE:i*=-(o*a);break;case n2.S_POLE:i*=o*a}return s=1/((r=i*this.cg+t*this.sg)*this.sw*this.h1+this.cw),t=(t*this.cg-i*this.sg)*this.cw*s,i=r*s,e.x=t*this.a,e.y=i*this.a,e},inverse:function(e){e.x/=this.a,e.y/=this.a;var t,i,r,s,n,o={x:e.x,y:e.y};r=1/(this.pn1-e.y*this.sw),t=this.pn1*e.x*r,i=this.pn1*e.y*this.cw*r,e.x=t*this.cg+i*this.sg,e.y=i*this.cg-t*this.sg;var a=nr(e.x,e.y);if(1e-10>
3446Math.abs(a))o.x=0,o.y=e.y;else{switch(n=1-a*a*this.pfact,s=Math.sqrt(1-(n=(this.p-Math.sqrt(n))/(this.pn1/a+a/this.pn1))*n),this.mode){case n2.OBLIQ:o.y=Math.asin(s*this.sinph0+e.y*n*this.cosph0/a),e.y=(s-this.sinph0*Math.sin(o.y))*a,e.x*=n*this.cosph0;break;case n2.EQUIT:o.y=Math.asin(e.y*n/a),e.y=s*a,e.x*=n;break;case n2.N_POLE:o.y=Math.asin(s),e.y=-e.y;break;case n2.S_POLE:o.y=-Math.asin(s)}o.x=Math.atan2(e.x,e.y)}return e.x=o.x+this.long0,e.y=o.y,e},names:["Tilted_Perspective","tpers"]},n8={init:function(){if(this.flip_axis=+("x"===this.sweep),this.h=Number(this.h),this.radius_g_1=this.h/this.a,this.radius_g_1<=0||this.radius_g_1>1e10)throw Error();if(this.radius_g=1+this.radius_g_1,this.C=this.radius_g*this.radius_g-1,0!==this.es){var e=1-this.es;this.radius_p=Math.sqrt(e),this.radius_p2=e,this.radius_p_inv2=1/e,this.shape="ellipse"}else this.radius_p=1,this.radius_p2=1,this.radius_p_inv2=1,this.shape="sphere";this.title||(this.title="Geostationary Satellite View")},forward:function(e){var t,i,r,s,n=e.x,o=e.y;if(n-=this.long0,"ellipse"===this.shape){o=Math.atan(this.radius_p2*Math.tan(o));var a=this.radius_p/nr(this.radius_p*Math.cos(o),Math.sin(o));if(i=a*Math.cos(n)*Math.cos(o),r=a*Math.sin(n)*Math.cos(o),s=a*Math.sin(o),(this.radius_g-i)*i-r*r-s*s*this.radius_p_inv2<0)return e.x=NaN,e.y=NaN,e;t=this.radius_g-i,this.flip_axis?(e.x=this.radius_g_1*Math.atan(r/nr(s,t)),e.y=this.radius_g_1*Math.atan(s/t)):(e.x=this.radius_g_1*Math.atan(r/t),e.y=this.radius_g_1*Math.atan(s/nr(r,t)))}else"sphere"===this.shape&&(i=Math.cos(n)*(t=Math.cos(o)),r=Math.sin(n)*t,s=Math.sin(o),t=this.radius_g-i,this.flip_axis?(e.x=this.radius_g_1*Math.atan(r/nr(s,t)),e.y=this.radius_g_1*Math.atan(s/t)):(e.x=this.radius_g_1*Math.atan(r/t),e.y=this.radius_g_1*Math.atan(s/nr(r,t))));return e.x=e.x*this.a,e.y=e.y*this.a,e},inverse:function(e){var t,i,r,s,n=-1,o=0,a=0;if(e.x=e.x/this.a,e.y=e.y/this.a,"ellipse"===this.shape){this.flip_axis?(a=Math.tan(e.y/this.radius_g_1),o=Math.tan(e.x/this.radius_g_1)*nr(1,a)):(o=Math.tan(e.x/this.radius_g_1),a=Math.tan(e.y/this.radius_g_1)*nr(1,o));var l=a/this.radius_p;if(t=o*o+l*l+n*n,(r=(i=2*this.radius_g*n)*i-4*t*this.C)<0)return e.x=NaN,e.y=NaN,e;s=(-i-Math.sqrt(r))/(2*t),n=this.radius_g+s*n,o*=s,a*=s,e.x=Math.atan2(o,n),e.y=Math.atan(a*Math.cos(e.x)/n),e.y=Math.atan(this.radius_p_inv2*Math.tan(e.y))}else if("sphere"===this.shape){if(this.flip_axis?(a=Math.tan(e.y/this.radius_g_1),o=Math.tan(e.x/this.radius_g_1)*Math.sqrt(1+a*a)):(o=Math.tan(e.x/this.radius_g_1),a=Math.tan(e.y/this.radius_g_1)*Math.sqrt(1+o*o)),t=o*o+a*a+n*n,(r=(i=2*this.radius_g*n)*i-4*t*this.C)<0)return e.x=NaN,e.y=NaN,e;s=(-i-Math.sqrt(r))/(2*t),n=this.radius_g+s*n,o*=s,a*=s,e.x=Math.atan2(o,n),e.y=Math.atan(a*Math.cos(e.x)/n)}return e.x=e.x+this.long0,e},names:["Geostationary Satellite View","Geostationary_Satellite","geos"]};var n5=Math.sqrt(3)/2;let n7={init:function(){this.long0=void 0!==this.long0?this.long0:0,this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,0!==this.es&&(this.apa=nA(this.es),this.qp=nT(this.e,1),this.rqda=Math.sqrt(.5*this.qp))},forward:function(e){var t=s_(e.x-this.long0,this.over),i=Math.sin(e.y);0!==this.es&&(i=nT(this.e,i)/this.qp);var r=Math.asin(n5*i),s=r*r,n=s*s*s;return e.x=t*Math.cos(r)/(n5*(1.340264+-.24331799999999998*s+n*(.0062510000000000005+.034164*s))),e.y=r*(1.340264+-.081106*s+n*(893e-6+.003796*s)),0!==this.es&&(e.x*=this.rqda,e.y*=this.rqda),e.x=this.a*e.x+this.x0,e.y=this.a*e.y+this.y0,e},inverse:function(e){e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,0!==this.es&&(e.x/=this.rqda,e.y/=this.rqda);var t,i,r,s,n,o=e.y;for(n=0;n<12&&(i=(t=o*o)*t*t,r=o*(1.340264+-.081106*t+i*(893e-6+.003796*t))-e.y,o-=s=r/(1.340264+-.24331799999999998*t+i*(.0062510000000000005+.034164*t)),!(1e-9>Math.abs(s)));++n);return i=(t=o*o)*t*t,e.x=n5*e.x*(1.340264+-.24331799999999998*t+i*(.0062510000000000005+.034164*t))/Math.cos(o),e.y=Math.asin(Math.sin(o)/n5),0!==this.es&&(e.y=nM(e.y,this.apa)),e.x=s_(e.x+this.long0,this.over),e},names:["eqearth","Equal Earth","Equal_Earth"]};function n9(e){var t,i,r,s=s_(e.x-(this.long0||0),this.over),n=e.y;return t=this.am1+this.m1-s9(n,i=Math.sin(n),r=Math.cos(n),this.en),i=r*s/(t*Math.sqrt(1-this.es*i*i)),e.x=t*Math.sin(i),e.y=this.am1-t*Math.cos(i),e.x=this.a*e.x+(this.x0||0),e.y=this.a*e.y+(this.y0||0),e}function oe(e){var t,i,r,s;if(e.x=(e.x-(this.x0||0))/this.a,e.y=(e.y-(this.y0||0))/this.a,i=nr(e.x,e.y=this.am1-e.y),(t=Math.abs(s=ne(this.am1+this.m1-i,this.es,this.en)))<si)t=Math.sin(s),r=i*Math.atan2(e.x,e.y)*Math.sqrt(1-this.es*t*t)/Math.cos(s);else if(1e-10>=Math.abs(t-si))r=0;else throw Error();return e.x=s_(r+(this.long0||0),this.over),e.y=nw(s),e}function ot(e){var t,i,r=s_(e.x-(this.long0||0),this.over),s=e.y;return Math.abs(i=this.cphi1+this.phi1-s)>1e-10?(e.x=i*Math.sin(t=r*Math.cos(s)/i),e.y=this.cphi1-i*Math.cos(t)):e.x=e.y=0,e.x=this.a*e.x+(this.x0||0),e.y=this.a*e.y+(this.y0||0),e}function oi(e){e.x=(e.x-(this.x0||0))/this.a,e.y=(e.y-(this.y0||0))/this.a;var t,i,r=nr(e.x,e.y=this.cphi1-e.y);if(Math.abs(i=this.cphi1+this.phi1-r)>si)throw Error();return t=1e-10>=Math.abs(Math.abs(i)-si)?0:r*Math.atan2(e.x,e.y)/Math.cos(i),e.x=s_(t+(this.long0||0),this.over),e.y=nw(i),e}let or={init:function(){var e;if(this.phi1=this.lat1,1e-10>Math.abs(this.phi1))throw Error();this.es?(this.en=s7(this.es),this.m1=s9(this.phi1,this.am1=Math.sin(this.phi1),e=Math.cos(this.phi1),this.en),this.am1=e/(Math.sqrt(1-this.es*this.am1*this.am1)*this.am1),this.inverse=oe,this.forward=n9):(Math.abs(this.phi1)+1e-10>=si?this.cphi1=0:this.cphi1=1/Math.tan(this.phi1),this.inverse=oi,this.forward=ot)},names:["bonne","Bonne (Werner lat_1=90)"]},os={OBLIQUE:{forward:function(e,t){let{x:i,y:r}
3446=t,s=Math.cos(i=s_(i-e.long0,e.over)),n=Math.sin(r),o=Math.cos(r);t.x=s_(Math.atan2(o*Math.sin(i),e.sphip*o*s+e.cphip*n)+e.lamp),t.y=Math.asin(e.sphip*n-e.cphip*o*s);let a=e.obliqueProjection.forward(t);return e.isIdentity&&(a.x*=57.29577951308232,a.y*=57.29577951308232),a},inverse:function(e,t){e.isIdentity&&(t.x*=.017453292519943295,t.y*=.017453292519943295);let{x:i,y:r}=e.obliqueProjection.inverse(t);if(i<Number.MAX_VALUE){let s=Math.cos(i-=e.lamp),n=Math.sin(r),o=Math.cos(r);t.x=Math.atan2(o*Math.sin(i),e.sphip*o*s-e.cphip*n),t.y=Math.asin(e.sphip*n+e.cphip*o*s)}return t.x=s_(t.x+e.long0),t}},TRANSVERSE:{forward:function(e,t){let{x:i,y:r}=t;i=s_(i-e.long0,e.over);let s=Math.cos(r),n=Math.cos(i);t.x=s_(Math.atan2(s*Math.sin(i),Math.sin(r))+e.lamp),t.y=Math.asin(-1*s*n);let o=e.obliqueProjection.forward(t);return e.isIdentity&&(o.x*=57.29577951308232,o.y*=57.29577951308232),o},inverse:function(e,t){e.isIdentity&&(t.x*=.017453292519943295,t.y*=.017453292519943295);let{x:i,y:r}=e.obliqueProjection.inverse(t);if(i<Number.MAX_VALUE){let s=Math.cos(r);t.x=Math.atan2(s*Math.sin(i-=e.lamp),-1*Math.sin(r)),t.y=Math.asin(s*Math.cos(i))}return t.x=s_(t.x+e.long0),t}}},on={ROTATE:{o_alpha:"oAlpha",o_lon_c:"oLongC",o_lat_c:"oLatC"},NEW_POLE:{o_lat_p:"oLatP",o_lon_p:"oLongP"},NEW_EQUATOR:{o_lon_1:"oLong1",o_lat_1:"oLat1",o_lon_2:"oLong2",o_lat_2:"oLat2"}},oo={init:function(){let e;if(this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.title=this.title||"General Oblique Transformation",this.isIdentity=sE.includes(this.o_proj),!this.o_proj)throw Error("Missing parameter: o_proj");if("ob_tran"===this.o_proj)throw Error("Invalid value for o_proj: "+this.o_proj);let t=sk(this.projStr.replace("+proj=ob_tran","").replace("+o_proj=","+proj=").trim());if(!t)throw Error("Invalid parameter: o_proj. Unknown projection "+this.o_proj);t.long0=0,this.obliqueProjection=t;let i=Object.keys(on),r=e=>{if(void 0===this[e])return;let t=.017453292519943295*parseFloat(this[e]);if(isNaN(t))throw Error("Invalid value for "+e+": "+this[e]);return t};for(let t=0;t<i.length;t++){let s=on[i[t]],n=Object.entries(s);if(n.some(([e])=>void 0!==this[e])){e=s;for(let e=0;e<n.length;e++){let[t,i]=n[e],s=r(t);if(void 0===s)throw Error("Missing parameter: "+t+".");this[i]=s}break}}if(!e)throw Error("No valid parameters provided for ob_tran projection.");let{lamp:s,phip:n}=function(e,t){let i,r;if(t===on.ROTATE){let t=e.oLongC,s=e.oLatC,n=e.oAlpha;if(1e-10>=Math.abs(Math.abs(s)-si))throw Error("Invalid value for o_lat_c: "+e.o_lat_c+" should be < 90\xb0");r=t+Math.atan2(-1*Math.cos(n),-1*Math.sin(n)*Math.sin(s)),i=Math.asin(Math.cos(s)*Math.sin(n))}else if(t===on.NEW_POLE)r=e.oLongP,i=e.oLatP;else{let t=e.oLong1,s=e.oLat1,n=e.oLong2,o=e.oLat2,a=Math.abs(s);if(Math.abs(s)>si-1e-10)throw Error("Invalid value for o_lat_1: "+e.o_lat_1+" should be < 90\xb0");if(Math.abs(o)>si-1e-10)throw Error("Invalid value for o_lat_2: "+e.o_lat_2+" should be < 90\xb0");if(1e-10>Math.abs(s-o))throw Error("Invalid value for o_lat_1 and o_lat_2: o_lat_1 should be different from o_lat_2");if(a<1e-10)throw Error("Invalid value for o_lat_1: o_lat_1 should be different from zero");i=Math.atan(-1*Math.cos((r=Math.atan2(Math.cos(s)*Math.sin(o)*Math.cos(t)-Math.sin(s)*Math.cos(o)*Math.cos(n),Math.sin(s)*Math.cos(o)*Math.sin(n)-Math.cos(s)*Math.sin(o)*Math.sin(t)))-t)/Math.tan(s))}return{lamp:r,phip:i}}(this,e);this.lamp=s,Math.abs(n)>1e-10?(this.cphip=Math.cos(n),this.sphip=Math.sin(n),this.projectionType=os.OBLIQUE):this.projectionType=os.TRANSVERSE},forward:function(e){return this.projectionType.forward(this,e)},inverse:function(e){return this.projectionType.inverse(this,e)},names:["General Oblique Transformation","General_Oblique_Transformation","ob_tran"]},oa=Object.assign(function(e,t,i){var r,s,n,o=!1;return(void 0===t?(s=sZ(e),r=sX,o=!0):(void 0!==t.x||Array.isArray(t))&&(i=t,s=sZ(e),r=sX,o=!0),r||(r=sZ(e)),s||(s=sZ(t)),i)?sY(r,s,i):(n={forward:function(e,t){return sY(r,s,e,t)},inverse:function(e,t){return sY(s,r,e,t)}},o&&(n.oProj=s),n)},{defaultDatum:"WGS84",Proj:sk,WGS84:new sk("WGS84"),Point:s5,toPoint:sH,defs:sc,nadgrid:function(e,t,i){var r,s,n,o,a,l,h,u,c,d,f,p,g;return t instanceof ArrayBuffer?(r=e,s=t,o=!0,void 0!==(n=i)&&!1===n.includeErrorFields&&(o=!1),d=11!==(l=(a=c=new DataView(s)).getInt32(8,!1))&&(11!==(l=a.getInt32(8,!0))&&console.warn("Failed to detect nadgrid endian-ness, defaulting to little-endian"),!0),f=(h=c,u=d,{nFields:h.getInt32(8,u),nSubgridFields:h.getInt32(24,u),nSubgrids:h.getInt32(40,u),shiftType:sG(h,56,64).trim(),fromSemiMajorAxis:h.getFloat64(120,u),fromSemiMinorAxis:h.getFloat64(136,u),toSemiMajorAxis:h.getFloat64(152,u),toSemiMinorAxis:h.getFloat64(168,u)}),p=function(e,t,i,r){for(var s=176,n=[],o=0;o<t.nSubgrids;o++){var a,l,h,u=(a=e,l=s,h=i,{name:sG(a,l+8,l+16).trim(),parent:sG(a,l+24,l+24+8).trim(),lowerLatitude:a.getFloat64(l+72,h),upperLatitude:a.getFloat64(l+88,h),lowerLongitude:a.getFloat64(l+104,h),upperLongitude:a.getFloat64(l+120,h),latitudeInterval:a.getFloat64(l+136,h),longitudeInterval:a.getFloat64(l+152,h),gridNodeCount:a.getInt32(l+168,h)}),c=function(e,t,i,r,s){var n=t+176,o=16;!1===s&&(o=8);for(var a=[],l=0;l<i.gridNodeCount;l++){var h={latitudeShift:e.getFloat32(n+l*o,r),longitudeShift:e.getFloat32(n+l*o+4,r)};!1!==s&&(h.latitudeAccuracy=e.getFloat32(n+l*o+8,r),h.longitudeAccuracy=e.getFloat32(n+l*o+12,r)),a.push(h)}return a}(e,s,u,i,r),d=Math.round(1+(u.upperLongitude-u.lowerLongitude)/u.longitudeInterval),f=Math.round(1+(u.upperLatitude-u.lowerLatitude)/u.latitudeInterval);n.push({ll:[sB(u.lowerLongitude),sB(u.lowerLatitude)],del:[sB(u.longitudeInterval),sB(u.latitudeInterval)],lim:[d,f],count:u.gridNodeCount,cvs:c.map(function(e){return[sB(e.longitudeShift),sB(e.latitudeShift)]})});var p=16;!1===r&&(p=8),s+=176+u.gridNodeCount*p}return n}(c,f,d,o),g={header:f,subgrids:p},sO[r]=g,g):{ready:sN(e,t)}},transform:function(e,t,i,r){return sK(e,t,Array.isArray(i)?sH(i):{x:i.x,y:i.y,z:i.z,m:i.m},r)},mgrs:{forward:s0,inverse:function(e){var t=s4(s8(e.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat,t.lon,t.lat]:[t.left,t.bottom,t.right,t.top]},toPoint:s1},version:"__VERSION__"});function ol(e){return void 0===e||Number.isNaN(e)?0:e}!function(e){e.Proj.projections.add(nt),e.Proj.projections.add(no),e.Proj.projections.add(na),e.Proj.projections.add(nu),e.Proj.projections.add(nd),e.Proj.projections.add(nf),e.Proj.projections.add(np),e.Proj.projections.add(ng),e.Proj.projections.add(nm),e.Proj.projections.add(nP),e.Proj.projections.add(nC),e.Proj.projections.add(nL),e.Proj.projections.add(nI),e.Proj.projections.add(nO),e.Proj.projections.add(nN),e.Proj.projections.add(nF),e.Proj.projections.add(nD),e.Proj.projections.add(nB),e.Proj.projections.add(nU),e.Proj.projections.add(nz),e.Proj.projections.add(nj),e.Proj.projections.add(nV),e.Proj.projections.add(nW),e.Proj.projections.add(n$),e.Proj.projections.add(nH),e.Proj.projections.add(nZ),e.Proj.projections.add(n1),e.Proj.projections.add(n3),e.Proj.projections.add(n6),e.Proj.projections.add(n8),e.Proj.projections.add(n7),e.Proj.projections.add(or),e.Proj.projections.add(oo
3446)}(oa);class oh{active=0;maxRequests;queue=[];constructor(e){this.maxRequests=e.maxRequests}acquire(e,t){return e?.aborted?Promise.reject(e.reason):this.active<this.maxRequests?(this.active+=1,Promise.resolve(this._makeRelease())):new Promise((i,r)=>{let s={resolve:i,reject:r,signal:e,getPriority:t};if(e){let t=()=>{let t=this.queue.indexOf(s);t>=0&&(this.queue.splice(t,1),r(e.reason))};s.onAbort=t,e.addEventListener("abort",t,{once:!0})}this.queue.push(s)})}_makeRelease(){let e=!1;return()=>{e||(e=!0,this._releaseOne())}}_releaseOne(){if(0===this.queue.length){this.active-=1;return}let e=0,t=this.queue[0].getPriority?.()??0;for(let i=1;i<this.queue.length;i++){let r=this.queue[i].getPriority?.()??0;0>function(e,t){let i="number"==typeof e?[e]:e,r="number"==typeof t?[t]:t,s=Math.max(i.length,r.length);for(let e=0;e<s;e++){let t=ol(i[e]),s=ol(r[e]);if(t<s)return -1;if(t>s)return 1}return 0}(r,t)&&(e=i,t=r)}let i=this.queue.splice(e,1)[0];i.signal&&i.onAbort&&i.signal.removeEventListener("abort",i.onAbort),i.resolve(this._makeRelease())}}class ou{maxRequests;byOrigin=new Map;constructor(e){this.maxRequests=e.maxRequests}acquire(e,t,i){let{origin:r}=e,s=this.byOrigin.get(r);return s||(s=new oh({maxRequests:this.maxRequests}),this.byOrigin.set(r,s)),s.acquire(t,i)}}class oc{name="limiter";url;limiter;getPriority;constructor(e){this.url=e.url,this.limiter=e.limiter,this.getPriority=e.getPriority}async fetch(e,t){let i=await this.limiter.acquire(this.url,e.signal,this.getPriority);try{return await t(e)}finally{i()}}}let od=new ou({maxRequests:6});class of{name="source:cache";maxSize;size=0;resets=0;cacheA=new Map;cacheB=new Map;protocols;constructor(e){this.maxSize=e.size,this.protocols=new Set(e.protocols??[])}fetch(e,t){if(this.protocols.size>0&&!this.protocols.has(e.source.url.protocol)||null==e.length)return t(e);let i=`${e.source.url.toString()}@${e.offset}+${e.length}`,r=this.cacheA.get(i);return r?r.hits++:((r=this.cacheB.get(i))?(r.hits++,r.saves++,this.size+=r.size):(r={promise:t(e),hits:0,saves:0,size:e.length},this.size+=r.size,this.size>this.maxSize&&(this.size=r.size,this.cacheB=this.cacheA,this.cacheA=new Map,this.resets++)),this.cacheA.set(i,r)),r.promise}}class op extends Error{code;url;source;constructor(e,t,i,r){super(e,{cause:r}),this.code=t,this.url=i.url,this.source=i,Object.defineProperty(this,"_sourceError",{enumerable:!1,value:"SourceError"})}static is(e){return e instanceof op||"object"==typeof e&&null!=e&&"_sourceError"in e&&"SourceError"===e._sourceError}}let og={toRange(e,t){if(null==t)return`bytes=${e}`;if(e<0)throw Error("Cannot read from remote source with negative offset and length");return`bytes=${e}-${e+t-1}`},parseSize(e){let[t,i]=e.split(" ");if("bytes"!==t||null==i)throw Error("Failed to parse content-range: "+e);let[,r]=i.split("/"),s=Number(r);if(isNaN(s))throw Error("Failed to parse content-range: "+e);return s}};class om{source;middleware;static is(e){return"middleware"in e}constructor(e,t=[]){this.source=e,this.middleware=t}get type(){return this.source.type}get url(){return this.source.url}get metadata(){return this.source.metadata}head(e){return this.source.head(e)}async fetch(e,t,i){let r=this.middleware;if(null==r||0===r.length)return this.source.fetch(e,t,i);let s=e=>this.source.fetch(e.offset,e.length,i);return this.run(s,e,t,i)}async run(e,t,i,r){let s=this.middleware;if(null==s)return e({source:this,offset:t,length:i,signal:r?.signal});for(let t=s.length-1;t>=0;t--)e=function(e,t){return i=>e.fetch(i,t)}(s[t],e);return e({source:this,offset:t,length:i,signal:r?.signal})}}class o_{name="source:chunk";chunkSize;constructor(e){this.chunkSize=e.size??32768}async fetch(e,t){if(e.offset<0||null==e.length)return t(e);let i=Math.floor(e.offset/this.chunkSize),r=Math.ceil((e.offset+e.length)/this.chunkSize),s=e.source.metadata?.size;if(null!=s&&e.offset+e.length>s)throw new op(`Request outside of bounds ${og.toRange(e.offset,e.length)}`,416,e.source);let n=i*this.chunkSize,o=(null!=s?Math.min(r*this.chunkSize,s):r*this.chunkSize)-n,a=e.offset-n;return r-i>1?(await this.fetchChunks(e,i,r)).slice(a,a+e.length):e.offset===n&&e.length===o?t(e):(await t({...e,offset:n,length:o})).slice(a,a+e.length)}async fetchChunks(e,t,i){let r=[],s=e.source.metadata?.size??i*this.chunkSize;for(let n=t;n<i;n++){let t=n*this.chunkSize,i=Math.min(t+this.chunkSize,s)-t;r.push(e.source.fetch(n*this.chunkSize,i,e.signal?{signal:e.signal}:void 0))}let n=await Promise.all(r),o=new Uint8Array(r.length*this.chunkSize);for(let e=0;e<n.length;e++)o.set(new Uint8Array(n[e]),e*this.chunkSize);return o.buffer}}function oy(e){let t={},i=e.headers.get("content-length");i&&(t.size=parseInt(i));let r=e.headers.get("content-range");return null!=r&&(t.size=og.parseSize(r)),t.eTag=e.headers.get("etag")??void 0,t.contentType=e.headers.get("content-type")??void 0,t.contentDisposition=e.headers.get("content-disposition")??void 0,t.cac
3446heControl=e.headers.get("cache-control")??void 0,t.contentEncoding=e.headers.get("content-encoding")??void 0,t}class ov{constructor(e,t){this.type="http",this.url="string"==typeof e?ov.tryUrl(e):e,this.headers=t}static tryUrl(e){try{return new URL(e)}catch(t){if("undefined"!=typeof document)return new URL(e,document.baseURI);return new URL(e,"file:///home/ubuntu/Tanso-Seni/node_modules/@chunkd/source-http/build/src/index.js")}}head(){return this._head||(this._head=ov.fetch(this.url,{method:"HEAD",headers:this.headers}).then(e=>{if(!e.ok)throw delete this._head,Error(`Failed to HEAD ${this.url.href}`,{cause:{statusCode:e.status,msg:e.statusText}});return this.metadata=oy(e),this.metadata})),this._head}async fetch(e,t,i){try{let r={range:og.toRange(e,t),...this.headers},s=await ov.fetch(this.url,{headers:r,signal:i?.signal});if(!s.ok)throw new op(`Failed to fetch ${this.url.href} ${r.range}`,s.status,this,Error(s.statusText));let n=oy(s);if(null==this.metadata)this.metadata=n;else if(this.metadata.eTag&&this.metadata.eTag!==n.eTag)throw new op(`ETag conflict ${this.url.href} ${r.range} expected: ${this.metadata.eTag} got: ${n.eTag}`,409,this);return s.arrayBuffer()}catch(e){if(op.is(e)&&e.source===this)throw e;throw new op(`Failed to fetch: ${this.url.href}`,500,this,e)}}}ov.fetch=(e,t)=>fetch(e,t);class ob{url;type="memory";data;metadata;static toArrayBuffer(e){return e instanceof ArrayBuffer?e:e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}constructor(e,t){let i=ob.toArrayBuffer(t??new Uint8Array);this.url=function(e){if("string"!=typeof e)return e;let t=function(e){try{return new URL(e)}catch(e){return null}}(e);return t||new URL("memory://"+e)}(e),this.data=i,this.metadata={size:i.byteLength}}head(){return Promise.resolve({size:this.data.byteLength})}fetch(e,t){if(e<0&&(e=this.data.byteLength+e),e>this.data.byteLength)throw new op(`Read offset outside of file bounds range:${og.toRange(e,t)} fileSize:${this.data.byteLength}`,416,this);return Promise.resolve(this.data.slice(e,null==t?void 0:e+t))}}var oE=i(97681);let ox="https://proj.org/schemas/v0.7/projjson.schema.json",ow={9102:"degree",9101:"radian",9105:"grad"},oS={9001:"metre",9002:"foot",9003:{type:"LinearUnit",name:"US survey foot",conversion_factor:.30480060960121924}},oP="ESRI PE String =";function oT(e,t){let i,r=function(e){if(null!==e.ellipsoid&&32767!==e.ellipsoid){let t={name:`EPSG ellipsoid ${e.ellipsoid}`};return null!==e.ellipsoidSemiMajorAxis&&(t.semi_major_axis=e.ellipsoidSemiMajorAxis),null!==e.ellipsoidInvFlattening?t.inverse_flattening=e.ellipsoidInvFlattening:null!==e.ellipsoidSemiMinorAxis&&(t.semi_minor_axis=e.ellipsoidSemiMinorAxis),t}if(null===e.ellipsoidSemiMajorAxis)throw Error("User-defined ellipsoid requires ellipsoidSemiMajorAxis");let t={name:e.geodeticCitation??"User-defined",semi_major_axis:e.ellipsoidSemiMajorAxis};if(null!==e.ellipsoidInvFlattening)t.inverse_flattening=e.ellipsoidInvFlattening;else if(null!==e.ellipsoidSemiMinorAxis)t.semi_minor_axis=e.ellipsoidSemiMinorAxis;else throw Error("User-defined ellipsoid requires ellipsoidInvFlattening or ellipsoidSemiMinorAxis");return t}(e),s="Greenwich",n=0;null!==e.primeMeridian&&32767!==e.primeMeridian?s=`EPSG:${e.primeMeridian}`:null!==e.primeMeridianLongitude&&(n=e.primeMeridianLongitude,s="User-defined"),i=null!==e.geodeticDatum&&32767!==e.geodeticDatum?{type:"GeodeticReferenceFrame",name:`Unknown datum based upon EPSG ${e.geodeticDatum} ellipsoid`}:{type:"GeodeticReferenceFrame",name:e.geodeticCitation??"User-defined",ellipsoid:r,prime_meridian:{name:s,longitude:n}};let o={type:"GeographicCRS",name:e.geodeticCitation??"User-defined",datum:i,coordinate_system:function(e){let t=ow[e.angularUnits??9102]??"degree";return{subtype:"ellipsoidal",axis:[{name:"Geodetic latitude",abbreviation:"Lat",direction:"north",unit:t},{name:"Geodetic longitude",abbreviation:"Lon",direction:"east",unit:t}]}}(e)};return void 0!==t&&(o.$schema=t),o}var oA=i(83829);async function oM(e,t={}){let{signal:i}=t,r=e.value(oE._l.Compression);if(null===r)throw Error("Compression tag should always exist.");let[s,n,o,a,l,h,u,c,d,f,p,g,m]=await Promise.all([e.fetch(oE._l.BitsPerSample,{signal:i}),e.fetch(oE._l.ColorMap,{signal:i}),e.fetch(oE._l.GdalNoData,{signal:i}),e.fetch(oE._l.GdalMetadata,{signal:i}),e.fetch(oE._l.LercParameters,{signal:i}),e.fetch(oE._l.ModelPixelScale,{signal:i}),e.fetch(oE._l.ModelTiePoint,{signal:i}),e.fetch(oE._l.ModelTransformation,{signal:i}),e.fetch(oE._l.Photometric,{signal:i}),e.fetch(oE._l.PlanarConfiguration,{signal:i}),e.fetch(oE._l.Predictor,{signal:i}),e.fetch(oE._l.SampleFormat,{signal:i}),e.fetch(oE._l.SamplesPerPixel,{signal:i})]),_=e=>{throw Error(`${e} tag should always exist.`)};return null===s&&_("BitsPerSample"),null===m&&_("SamplesPerPixel"),null===d&&_("Photometric"),{bitsPerSample:ne
3446w Uint16Array(s),colorMap:n?new Uint16Array(n):void 0,compression:r,gdalMetadata:a,lercParameters:l,modelTiepoint:u,modelPixelScale:h,modelTransformation:c,nodata:null!==o?Number(o):null,photometric:d,planarConfiguration:f??oE.lI.Contig,predictor:p??oE.XE.None,sampleFormat:g??[oE.wF.Uint],samplesPerPixel:m}}var oC=i(63542),oR=i(54059);class oL{overviews;_crs;cachedTags;dataSource;tiff;image;maskImage;gkd;gdalMetadata;_debug;constructor(e,t,i,r,s,n,o,a,l){this.tiff=e,this.image=t,this.maskImage=i,this.gkd=r,this.overviews=s,this.cachedTags=n,this.dataSource=o,this.gdalMetadata=a,this._debug=l}static async open(e){let{dataSource:t,headerSource:i,signal:r,debug:s}=e,n=await new oE.aL(i).init({signal:r});return n.options=void 0,oL.fromTiff(n,t,{signal:r,debug:s})}static async fromTiff(e,t,i={}){let{signal:r,debug:s=!1}=i,n=e.images;if(0===n.length)throw Error("TIFF does not contain any IFDs");await Promise.all(n.map(e=>e.init(!0,{signal:r})));let o=n[0],a=function(e){let t=t=>e.valueGeo(t)??null;return{modelType:t(oE.nk.GTModelTypeGeoKey),rasterType:t(oE.nk.GTRasterTypeGeoKey),citation:t(oE.nk.GTCitationGeoKey),geodeticCRS:t(oE.nk.GeodeticCRSGeoKey),geodeticCitation:t(oE.nk.GeodeticCitationGeoKey),geodeticDatum:t(oE.nk.GeodeticDatumGeoKey),primeMeridian:t(oE.nk.PrimeMeridianGeoKey),linearUnits:t(oE.nk.GeogLinearUnitsGeoKey),linearUnitSize:t(oE.nk.GeogLinearUnitSizeGeoKey),angularUnits:t(oE.nk.GeogAngularUnitsGeoKey),angularUnitSize:t(oE.nk.GeogAngularUnitSizeGeoKey),ellipsoid:t(oE.nk.EllipsoidGeoKey),ellipsoidSemiMajorAxis:t(oE.nk.EllipsoidSemiMajorAxisGeoKey),ellipsoidSemiMinorAxis:t(oE.nk.EllipsoidSemiMinorAxisGeoKey),ellipsoidInvFlattening:t(oE.nk.EllipsoidInvFlatteningGeoKey),azimuthUnits:t(oE.nk.GeogAzimuthUnitsGeoKey),primeMeridianLongitude:t(oE.nk.PrimeMeridianLongitudeGeoKey),toWGS84:t(oE.nk.GeogTOWGS84GeoKey),projectedCRS:t(oE.nk.ProjectedCRSGeoKey),projectedCitation:t(oE.nk.ProjectedCitationGeoKey),projection:t(oE.nk.ProjectionGeoKey),projMethod:t(oE.nk.ProjMethodGeoKey),projLinearUnits:t(oE.nk.ProjLinearUnitsGeoKey),projLinearUnitSize:t(oE.nk.ProjLinearUnitSizeGeoKey),projStdParallel1:t(oE.nk.ProjStdParallel1GeoKey),projStdParallel2:t(oE.nk.ProjStdParallel2GeoKey),projNatOriginLong:t(oE.nk.ProjNatOriginLongGeoKey),projNatOriginLat:t(oE.nk.ProjNatOriginLatGeoKey),projFalseEasting:t(oE.nk.ProjFalseEastingGeoKey),projFalseNorthing:t(oE.nk.ProjFalseNorthingGeoKey),projFalseOriginLong:t(oE.nk.ProjFalseOriginLongGeoKey),projFalseOriginLat:t(oE.nk.ProjFalseOriginLatGeoKey),projFalseOriginEasting:t(oE.nk.ProjFalseOriginEastingGeoKey),projFalseOriginNorthing:t(oE.nk.ProjFalseOriginNorthingGeoKey),projCenterLong:t(oE.nk.ProjCenterLongGeoKey),projCenterLat:t(oE.nk.ProjCenterLatGeoKey),projCenterEasting:t(oE.nk.ProjCenterEastingGeoKey),projCenterNorthing:t(oE.nk.ProjCenterNorthingGeoKey),projScaleAtNatOrigin:t(oE.nk.ProjScaleAtNatOriginGeoKey),projScaleAtCenter:t(oE.nk.ProjScaleAtCenterGeoKey),projAzimuthAngle:t(oE.nk.ProjAzimuthAngleGeoKey),projStraightVertPoleLong:t(oE.nk.ProjStraightVertPoleLongGeoKey),projRectifiedGridAngle:t(oE.nk.ProjRectifiedGridAngleGeoKey),verticalCRS:t(oE.nk.VerticalGeoKey),verticalCitation:t(oE.nk.VerticalCitationGeoKey),verticalDatum:t(oE.nk.VerticalDatumGeoKey),verticalUnits:t(oE.nk.VerticalUnitsGeoKey)}}(o),l=new Map,h=new Map;for(let e=1;e<n.length;e++){let t=n[e],i=t.size,r=`${i.width},${i.height}`;!function(e){let t=e.value(oE._l.SubFileType),i=e.value(oE._l.Photometric);return null!==t&&(t&oE.JT.Mask)!=0&&i===oE.th.Mask}(t)?l.set(r,t):h.set(r,t)}let u=`${o.size.width},${o.size.height}`,c=h.get(u)??null,d=Array.from(l.entries());d.sort((e,t)=>{let i=e[1].size,r=t[1].size;return r.width*r.height-i.width*i.height});let f=await oM(o,{signal:r}),p=function(e,{count:t}){if(null==e)return null;let i=new DOMParser().parseFromString(e,"text/xml").documentElement;if("GDALMetadata"!==i.tagName)throw Error("Not a GDALMetadata XML block");let r=new Map,s=Array(t).fill(0),n=Array(t).fill(1),o=e=>{let t=parseInt(e,10)+1;return r.has(t)||r.set(t,{max:null,min:null,mean:null,std:null,validPercent:null}),r.get(t)};for(let e of Array.from(i.querySelectorAll("Item"))){let t=e.getAttribute("name"),i=e.getAttribute("sample"),r=e.textContent??"";if(null!==i)switch(t){case"STATISTICS_MAXIMUM":o(i).max=parseFloat(r);break;case"STATISTICS_MEAN":o(i).mean=parseFloat(r);break;case"STATISTICS_MINIMUM":o(i).min=parseFloat(r);break;case"STATISTICS_STDDEV":o(i).std=parseFloat(r);break;
3446case"STATISTICS_VALID_PERCENT":o(i).validPercent=parseFloat(r);break;case"OFFSET":s[parseInt(i,10)]=parseFloat(r);break;case"SCALE":n[parseInt(i,10)]=parseFloat(r)}}return{bandStatistics:r,offsets:s,scales:n}}(f.gdalMetadata,{count:f.samplesPerPixel}),g=new oL(e,o,c,a,[],f,t,p,s),m=d.map(([e,i])=>{let r=h.get(e)??null;return new oC.A(g,a,i,r,f,t)});return g.overviews=m,g}static async fromArrayBuffer(e){let t=new ob("memory://input.tif",e);return await oL.open({dataSource:t,headerSource:t})}static async fromUrl(e,{chunkSize:t=65536,cacheSize:i=8388608,signal:r,debug:s,concurrencyLimiter:n,getPriority:o}={}){let a=new ov(e,{});a.metadata={size:1/0};let l=n?new oc({url:new URL(e),limiter:n,getPriority:o}):null,h=new om(a,[new o_({size:t}),new of({size:i}),...l?[l]:[]]),u=l?new om(a,[l]):a;return await oL.open({dataSource:u,headerSource:h,signal:r,debug:s})}get crs(){return void 0===this._crs&&(this._crs=function(e){let t=e.modelType;if(1===t){var i=e;let t=i.projectedCRS;return null!==t&&32767!==t?t:function(e){let t=oT(e),i=function(e){let t=e.projMethod;if(null===t)throw Error("User-defined projected CRS requires projMethod");let i=(e,t,i=0)=>({name:e,value:t??i,unit:"degree"}),r=(e,t,i=0)=>({name:e,value:t??i,unit:"metre"}),s=(e,t,i=1)=>({name:e,value:t??i,unit:"unity"});switch(t){case 1:case 2:case 27:{let n=1===t?"Transverse Mercator":"Transverse Mercator (South Orientated)";return{name:n,method:{name:n},parameters:[i("Latitude of natural origin",e.projNatOriginLat),i("Longitude of natural origin",e.projNatOriginLong),s("Scale factor at natural origin",e.projScaleAtNatOrigin),r("False easting",e.projFalseEasting),r("False northing",e.projFalseNorthing)]}}case 3:case 4:case 5:case 6:{let t="Hotine Oblique Mercator (variant B)";return{name:t,method:{name:t},parameters:[i("Latitude of projection centre",e.projCenterLat),i("Longitude of projection centre",e.projCenterLong),i("Azimuth of initial line",e.projAzimuthAngle),i("Angle from Rectified to Skew Grid",e.projAzimuthAngle),s("Scale factor on initial line",e.projScaleAtCenter),r("Easting at projection centre",e.projCenterEasting),r("Northing at projection centre",e.projCenterNorthing)]}}case 7:{let t="Mercator (variant A)";return{name:t,method:{name:t},parameters:[i("Latitude of natural origin",e.projNatOriginLat),i("Longitude of natural origin",e.projNatOriginLong),s("Scale factor at natural origin",e.projScaleAtNatOrigin),r("False easting",e.projFalseEasting),r("False northing",e.projFalseNorthing)]}}case 8:{let t="Lambert Conic Conformal (2SP)";return{name:t,method:{name:t},parameters:[i("Latitude of false origin",e.projFalseOriginLat??e.projNatOriginLat),i("Longitude of false origin",e.projFalseOriginLong??e.projNatOriginLong),i("Latitude of 1st standard parallel",e.projStdParallel1),i("Latitude of 2nd standard parallel",e.projStdParallel2),r("Easting at false origin",e.projFalseOriginEasting??e.projFalseEasting),r("Northing at false origin",e.projFalseOriginNorthing??e.projFalseNorthing)]}}case 9:{let t="Lambert Conic Conformal (1SP)";return{name:t,method:{name:t},parameters:[i("Latitude of natural origin",e.projNatOriginLat),i("Longitude of natural origin",e.projNatOriginLong),s("Scale factor at natural origin",e.projScaleAtNatOrigin),r("False easting",e.projFalseEasting),r("False northing",e.projFalseNorthing)]}}case 10:{let t="Lambert Azimuthal Equal Area";return{name:t,method:{name:t},parameters:[i("Latitude of natural origin",e.projCenterLat),i("Longitude of natural origin",e.projCenterLong),r("False easting",e.projFalseEasting),r("False northing",e.projFalseNorthing)]}}case 11:{let t="Albers Equal Area";return{name:t,method:{name:t},parameters:[i("Latitude of false origin",e.projFalseOriginLat??e.projNatOriginLat),i("Longitude of false origin",e.projFalseOriginLong??e.projNatOriginLong),i("Latitude of 1st standard parallel",e.projStdParallel1),i("Latitude of 2nd standard parallel",e.projStdParallel2),r("Easting at false origin",e.projFalseOriginEasting??e.projFalseEasting),r("Northing at false origin",e.projFalseOriginNorthing??e.projFalseNorthing)]}}case 12:{let t="Modified Azimuthal Equidistant";return{name:t,method:{name:t},parameters:[i("Latitude of natural origin",e.projCenterLat),i("Longitude of natural origin",e.projCenterLong),r("False easting",e.projFalseEasting),r("False northing",e.projFalseNorthing)]}}case 14:{let t="Stereographic";return{name:t,method:{name:t},parameters:[i("Latitude of natural origin",e.projCenterLat),i("Longitude of natural origin",e.projCenterLong),s("Scale factor at natural origin",e.projScaleAtCenter),r("False easting",e.projFalseEasting),r("False northing",e.projFalseNorthing)]}}case 15:{let t="Polar Stereographic (variant B)";return{name:t,method:{name:t},parameters:[i("Latitude of standard parallel",e.projNatOriginLat??e.projStdParallel1),i("Longitude of origin",e.projStraightVertPoleLong??e.projNatOriginLong),r("False easting",e.projFalseEasting),r("False northing",e.projFalseNorthing)]}}case 16:{let t="Oblique Stereographic";return{name:t,method:{name:t},parameters:[i("Latitude of natural origin",e.projCenterLat),i("Longitude of natural origin",e.projCenterLong),s("Scale factor at natural origin",e.projScaleAtCenter),r("False easting",e.projFalseEasting),r("False northing",e.projFalseNorthing)]}}case 17:{let t="Equidistant Cylindrical";return{name:t,method:{name:t},parameters:[i("Latitude of 1st standard parallel",e.projStdParallel1??e.projCenterLat),i("Longitude of natural origin",e.projCenterLong),r("False easting",e.projFalseEasting),r("False northing",e.projFalseNorthing)]}}case 18:{let t="Cassini-Soldner";return{name:t,method:{name:t},parameters:[i("Latitude of natural origin",e.projNatOriginLat),i("Longitude of natural origin",e.projNatOriginLong),r("False easting",e.projFalseEasting),r("False northing",e.projFalseNorthing)]}}case 22:{let t="American Polyconic";return{name:t,method:{name:t},parameters:[i("Latitude of natural origin",e.projNatOriginLat),i("Longitude of natural origin",e.projNatOriginLong),r("False easting",e.projFalseEasting),r("False northing",e.projFalseNorthing)]}}case 24:{let t="Sinusoidal";return{name:t,method:{name:t},parameters:[i("Longitude of natural origin",e.projCenterLong),r("False easting",e.projFalseEasting),r("False northing",e.projFalseNorthing)]}}
3446case 21:{let t="Orthographic";return{name:t,method:{name:t},parameters:[i("Latitude of natural origin",e.projCenterLat),i("Longitude of natural origin",e.projCenterLong),r("False easting",e.projFalseEasting),r("False northing",e.projFalseNorthing)]}}case 26:{let t="New Zealand Map Grid";return{name:t,method:{name:t},parameters:[i("Latitude of natural origin",e.projNatOriginLat),i("Longitude of natural origin",e.projNatOriginLong),r("False easting",e.projFalseEasting),r("False northing",e.projFalseNorthing)]}}default:throw Error(`Unsupported coordinate transformation type: ${t}`)}}(e),r=function(e){let t=oS[e.projLinearUnits??9001]??"metre";return{subtype:"Cartesian",axis:[{name:"Easting",abbreviation:"E",direction:"east",unit:t},{name:"Northing",abbreviation:"N",direction:"north",unit:t}]}}(e);return{type:"ProjectedCRS",$schema:ox,name:e.projectedCitation??e.citation??"User-defined",base_crs:t,conversion:i,coordinate_system:r}}(i)}if(2===t){var r=e;let t=r.geodeticCRS;return null!==t&&32767!==t?t:oT(r,ox)}if(32767===t){let t=function(e){let t=e.projectedCitation;return null!==t&&t.includes(oP)?t.split(oP,2)[1]?.trim()||null:null}(e);if(null!==t)return t}throw Error(`Unsupported GeoTIFF CRS definition with model type: ${t}`)}(this.gkd)),this._crs}get width(){return this.image.size.width}get height(){return this.image.size.height}get tileCount(){return this.image.tileCount}get tileWidth(){return this.image.tileSize.width}get tileHeight(){return this.image.tileSize.height}get nodata(){return this.image.noData}get isTiled(){return this.image.isTiled()}get storedStats(){let e=this.gdalMetadata?.bandStatistics;return e&&e.size>0?e:null}get offsets(){return this.gdalMetadata?.offsets??Array(this.count).fill(0)}get scales(){return this.gdalMetadata?.scales??Array(this.count).fill(1)}get count(){return this.image.value(oE._l.SamplesPerPixel)??1}get bbox(){return this.image.bbox}get transform(){let{modelPixelScale:e,modelTiepoint:t,modelTransformation:i}=this.cachedTags;return(0,oR.l)({modelTiepoint:t,modelPixelScale:e,modelTransformation:i,rasterType:this.gkd.rasterType})}async fetchTile(e,t,i={}){return await (0,oA.v4)(this,e,t,i)}async fetchTiles(e,t={}){return await (0,oA.UP)(this,e,t)}index(e,t,i=Math.floor){return(0,oR.P)(this,e,t,i)}xy(e,t,i="center"){return(0,oR.xy)(this,e,t,i)}}async function oI(e,t={}){return"string"==typeof e||e instanceof URL?await oL.fromUrl(e,t):e instanceof ArrayBuffer?await oL.fromArrayBuffer(e):e}let oO="nodata",oN=`\ 3447uniform ${oO}Uniforms { 3448 float value; 3449} ${oO}; 3450`,oF={name:oO,fs:oN,inject:{"fs:DECKGL_FILTER_COLOR":` 3451 if (color.r == nodata.value) { 3452 discard; 3453 } 3454 `},uniformTypes:{value:"f32"},getUniforms:e=>({value:e.value})},oD={name:"mask-texture",inject:{"fs:#decl":"uniform sampler2D maskTexture;","fs:DECKGL_FILTER_COLOR":` 3455 float maskValue = texture(maskTexture, geometry.uv).r; 3456 if (maskValue == 0.0) { 3457 discard; 3458 } 3459 `},getUniforms:e=>({maskTexture:e.maskTexture})},oB={name:"white-is-zero",inject:{"fs:#decl":` 3460 vec3 white_zero_to_rgb(float value) { 3461 return vec3(1.0 - value, 1.0 - value, 1.0 - value); 3462 } 3463`,"fs:DECKGL_FILTER_COLOR":` 3464 color.rgb = white_zero_to_rgb(color.r); 3465 `}},oG={name:"black-is-zero",inject:{"fs:#decl":` 3466 vec3 black_zero_to_rgb(float value) { 3467 return vec3(value, value, value); 3468 } 3469`,"fs:DECKGL_FILTER_COLOR":` 3470 color.rgb = black_zero_to_rgb(color.r); 3471 `}};var ok=i(2137);let oU={name:"cmyk-to-rgb",inject:{"fs:#decl":` 3472 vec3 cmykToRgb(vec4 cmyk) { 3473 // cmyk in [0.0, 1.0] 3474 float invK = 1.0 - cmyk.a; 3475 3476 return vec3( 3477 (1.0 - cmyk.r) * invK, 3478 (1.0 - cmyk.g) * invK, 3479 (1.0 - cmyk.b) * invK 3480 ); 3481 } 3482`,"fs:DECKGL_FILTER_COLOR":` 3483 color.rgb = cmykToRgb(color); 3484 `}},oz={name:"cielab-to-rgb",inject:{"fs:#decl":` 3485 const vec3 D65 = vec3( 3486 0.95047, // Xn 3487 1.00000, // Yn 3488 1.08883 // Zn 3489 ); 3490 3491 vec3 cielabToRgb(vec3 labTex) { 3492 // labTex in [0,1] from RGB8 texture 3493 float L = labTex.r * 255.0; 3494 float a = (labTex.g - 0.5) * 255.0; 3495 float b = (labTex.b - 0.5) * 255.0; 3496 3497 float y = (L + 16.0) / 116.0; 3498 float x = (a / 500.0) + y; 3499 float z = y - (b / 200.0); 3500 3501 vec3 xyz; 3502 vec3 v = vec3(x, y, z); 3503 vec3 v3 = v * v * v; 3504 3505 xyz = D65 * mix( 3506 (v - 16.0 / 116.0) / 7.787, 3507 v3, 3508 step(0.008856, v3) 3509 ); 3510 3511 vec3 rgb = mat3( 3512 3.2406, -1.5372, -0.4986, 3513 -0.9689, 1.8758, 0.0415, 3514 0.0557, -0.2040, 1.0570 3515 ) * xyz; 3516 3517 // sRGB gamma 3518 rgb = mix( 3519 12.92 * rgb, 3520 1.055 * pow(rgb, vec3(1.0 / 2.4)) - 0.055, 3521 step(0.0031308, rgb) 3522 ); 3523 3524 return clamp(rgb, 0.0, 1.0); 3525 } 3526`,"fs:DECKGL_FILTER_COLOR":` 3527 color.rgb = cielabToRgb(color); 3528 `}},oj={"1:sint:8":"r8sint","1:uint:8":"r8uint","1:unorm:8":"r8unorm","1:float:16":"r16float","1:sint:16":"r16sint","1:uint:16":"r16uint","1:unorm:16":"r16unorm","2:sint:8":"rg8sint","2:uint:8":"rg8uint","2:unorm:8":"rg8unorm","1:float:32":"r32float","1:sint:32":"r32sint","1:uint:32":"r32uint","2:float:16":"rg16float","2:sint:16":"rg16sint","2:uint:16":"rg16uint","2:unorm:16":"rg16unorm","4:sint:8":"rgba8sint","4:uint:8":"rgba8uint","4:unorm:8":"rgba8unorm","3:uint:16":"rgb16unorm-webgl","2:float:32":"rg32float","2:sint:32":"rg32sint","2:uint:32":"rg32uint","4:float:16":"rgba16float","4:sint:16":"rgba16sint","4:uint:16":"rgba16uint","4:unorm:16":"rgba16unorm","3:float:32":"rgb32float-webgl","4:float:32":"rgba32float","4:sint:32":"rgba32sint","4:uint:32":"rgba32uint"};var oV=i(57981);class oW{tileWidth;tileHeight;matrixWidth;matrixHeight;metersPerPixel;projectedBounds;_affine;_invAffine;constructor(e){this._affine=e.affine,this._invAffine=oV.B8(e.affine),this.tileWidth=e.tileWidth,this.tileHeight=e.tileHeight,this.matrixWidth=Math.ceil(e.arrayWidth/e.tileWidth),this.matrixHeight=Math.ceil(e.arrayHeight/e.tileHeight);
3528let t=oV.a(e.affine),i=oV.e(e.affine);this.metersPerPixel=Math.sqrt(Math.abs(t*i))*e.mpu;let r=[oV.Bb(e.affine,0,0),oV.Bb(e.affine,e.arrayWidth,0),oV.Bb(e.affine,0,e.arrayHeight),oV.Bb(e.affine,e.arrayWidth,e.arrayHeight)],s=r.map(([e])=>e),n=r.map(([,e])=>e);this.projectedBounds=[Math.min(...s),Math.min(...n),Math.max(...s),Math.max(...n)]}projectedTileCorners(e,t){let i=this.tileWidth,r=this.tileHeight,s=this._affine;return{topLeft:oV.Bb(s,e*i,t*r),topRight:oV.Bb(s,(e+1)*i,t*r),bottomLeft:oV.Bb(s,e*i,(t+1)*r),bottomRight:oV.Bb(s,(e+1)*i,(t+1)*r)}}tileTransform(e,t){let i=oV.wT(e*this.tileWidth,t*this.tileHeight),r=oV.Zz(this._affine,i),s=oV.B8(r);return{forwardTransform:(e,t)=>oV.Bb(r,e,t),inverseTransform:(e,t)=>oV.Bb(s,e,t)}}crsBoundsToTileRange(e,t,i,r){let s=this._invAffine,n=[oV.Bb(s,e,t),oV.Bb(s,i,t),oV.Bb(s,e,r),oV.Bb(s,i,r)],o=n.map(([e])=>e),a=n.map(([,e])=>e),l=Math.min(...o),h=Math.max(...o),u=Math.min(...a),c=Math.max(...a),d=this.tileWidth,f=this.tileHeight,p=this.matrixWidth-1,g=this.matrixHeight-1;return{minCol:Math.max(0,Math.floor(l/d)),maxCol:Math.min(p,Math.floor(h/d)),minRow:Math.max(0,Math.floor(u/f)),maxRow:Math.min(g,Math.floor(c/f))}}}class o${levels;projectTo3857;projectFrom3857;projectTo4326;projectFrom4326;projectedBounds;constructor(e){if(0===e.levels.length)throw Error("AffineTileset requires at least one level");this.levels=e.levels,this.projectTo3857=e.projectTo3857,this.projectFrom3857=e.projectFrom3857,this.projectTo4326=e.projectTo4326,this.projectFrom4326=e.projectFrom4326,this.projectedBounds=e.levels[0].projectedBounds}}class oH extends r3{static layerName="COGLayer";static defaultProps={...r3.defaultProps,epsgResolver:se,concurrencyLimiter:od};initializeState(){this.setState({abortController:new AbortController})}finalizeState(e){this.state.abortController?.abort(),super.finalizeState(e)}updateState(e){super.updateState(e);let{props:t,oldProps:i,changeFlags:r}=e;(r.dataChanged||t.geotiff!==i.geotiff)&&(this.clearState(),this._parseGeoTIFF())}clearState(){this.setState({geotiff:void 0,tilesetDescriptor:void 0,defaultGetTileData:void 0,defaultRenderTile:void 0})}async _parseGeoTIFF(){var e,t,i;let r,s,n,o=this.state.abortController?.signal;try{r=await oI(this.props.geotiff,{concurrencyLimiter:this.props.concurrencyLimiter,signal:o})}catch(e){if(o?.aborted)return;throw e}let a=r.crs,l="number"==typeof a?await this.props.epsgResolver(a):(0,r7._)(a);if(o?.aborted)return;let h=oa(l,"EPSG:4326"),u=(e,t)=>h.forward([e,t],!1),c=oa(l,"EPSG:3857"),d=(e=(e,t)=>c.forward([e,t],!1),(t,i)=>{let[r,s]=e(t,i);if(Number.isFinite(r)&&Number.isFinite(s))return[r,s];let[n,o]=u(t,i);return[n*Math.PI*6378137/180,6378137*Math.log(Math.tan(Math.PI/4+Math.max(-85.05112877980659,Math.min(85.05112877980659,o))*Math.PI/180/2))]}),f=l.units;if(!f)throw Error("Source projection is missing 'units' property, cannot compute meters per unit");let p=function(e,{semiMajorAxis:t}={}){switch(e=e.toLowerCase()){case"m":case"metre":case"meter":case"meters":return 1;case"foot":return .3048;case"us survey foot":return 1200/3937}if("degree"===e){if(void 0===t)throw Error("CRS with degrees unit requires ellipsoid semi-major-axis");return 2*Math.PI*t/360}throw Error(`Unsupported CRS units: ${e} when computing metersPerUnit.`)}(f,{semiMajorAxis:l.datum?.a??l.a}),g=(t=r,i={projectTo4326:u,projectFrom4326:(e,t)=>h.inverse([e,t],!1),projectTo3857:d,projectFrom3857:(e,t)=>c.inverse([e,t],!1),mpu:p},new o$({levels:[...[...t.overviews].reverse(),t].map(e=>new oW({affine:e.transform,arrayWidth:e.width,arrayHeight:e.height,tileWidth:e.tileWidth,tileHeight:e.tileHeight,mpu:i.mpu})),projectTo3857:i.projectTo3857,projectFrom3857:i.projectFrom3857,projectTo4326:i.projectTo4326,projectFrom4326:i.projectFrom4326}));if(this.props.onGeoTIFFLoad){let e=function(e,t){let[i,r,s,n]=e.bbox,o=[t.forward([i,r]),t.forward([s,r]),t.forward([s,n]),t.forward([i,n])],a=o.map(e=>e[0]),l=o.map(e=>e[1]);return{west:Math.min(...a),south:Math.min(...l),east:Math.max(...a),north:Math.max(...l)}}(r,h);this.props.onGeoTIFFLoad(r,{projection:l,geographicBounds:e})}this.props.getTileData&&this.props.renderTile||({getTileData:s,renderTile:n}=function(e,t){let{sampleFormat:i}=e.cachedTags;if(null===i)throw Error("SampleFormat tag is required to infer render pipeline");if(i[0]===oE.wF.Uint)return function(e,t){let{bitsPerSample:i,colorMap:r,photometric:s,sampleFormat:n,samplesPerPixel:o,nodata:a}=e.cachedTags,l=[{module:rD,props:{textureName:e=>e.texture}}];if(null!==a){let e=2**i[0]-1;l.push({module:oF,props:{value:a/e}})}null!==e.maskImage&&l.push({module:oD,props:{maskTexture:e=>e.mask}});let h=function({count:e,colorMap:t,device:i,photometric:r}){if(3===e||4===e)return null;switch(r){case oE.th.MinIsWhite:return{module:oB};case oE.th.MinIsBlack:return{module:oG};case oE.th.Rgb:return null;case oE.th.Palette:{if(!t)throw Error("ColorMap is required for PhotometricInterpretation Palette");let{data:e,width:r,height:s}=function(e,t){let i=e.length/3,r=new Uint8ClampedArray(4*i),s=2*i;for(let t=0;t<i;t++)r[4*t+0]=e[0+t]>>8,r[4*t+1]=e[i+t]>>8,r[4*t+2]=e[s+t]>>8,r[4*t+3]=255;return new ImageData(r,i,1)}(t),n=i.createTexture({dimension:"2d-array",data:e,format:"rgba8unorm",width:r,height:s,depth:1,mipLevels:1,sampler:{minFilter:"nearest",magFilter:"nearest",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge"}});return{module:ok.M,props:{colormapTexture:n}}}case oE.th.Separated:return{module:oU};case oE.th.Ycbcr:return null;case oE.th.Cielab:return{module:oz};default:throw Error(`Unsupported PhotometricInterpretation ${r}`)}}({count:o,photometric:s,device:t,colorMap:r});h&&l.push(h);let u=s===oE.th.Palette?{magFilter:"nearest",minFilter:"nearest"}:{magFilter:"linear",minFilter:"linear"};return{getTileData:async(e,t)=>{let r,{device:s,x:a,y:l,signal:h,pool:c}=t,{array:d}=await e.fetchTile(a,l,{boundless:!1,pool:c,signal:h}),{width:f,height:p,mask:g}=d,m=o;if(3===o&&(d=function(e){let{height:t,width:i}=e;if("band-separate"===e.layout)throw Error("Band-separate images not yet implemented.");
3528if(e.data.length===t*i*4)return e;if(e.data.length===t*i*3){let t=e.data.length/3*4,i=e.data instanceof Uint16Array,r=i?new Uint16Array(t):new Uint8ClampedArray(t),s=i?65535:255;for(let t=0;t<e.data.length/3;++t)r[4*t]=e.data[3*t],r[4*t+1]=e.data[3*t+1],r[4*t+2]=e.data[3*t+2],r[4*t+3]=s;return{...e,count:4,data:r}}throw Error(`Unexpected number of channels in raster data: ${e.data.length/(t*i)}`)}(d),m=4),"band-separate"===d.layout)throw Error("Band-separate images not yet implemented.");let _=function(e,t,i){let r=function(e){if(1===e||2===e||3===e||4===e)return e;throw Error(`Unsupported SamplesPerPixel ${e}. Only 1, 2, 3, or 4 are supported.`)}(e),s=function(e){let t=e[0];for(let i=1;i<e.length;i++)if(e[i]!==t)throw Error(`Unsupported varying BitsPerSample ${e}. All samples must have the same bit width.`);if(8!==t&&16!==t&&32!==t)throw Error(`Unsupported BitsPerSample ${t}. Only 8, 16, or 32 are supported.`);return t}(t),n=function(e){let t=e[0];for(let i=1;i<e.length;i++)if(e[i]!==t)throw Error(`Unsupported varying SampleFormat ${e}. All samples must have the same format.`);switch(t){case oE.wF.Uint:return"unorm";case oE.wF.Int:return"sint";case oE.wF.Float:return"float";default:throw Error(`Unsupported SampleFormat ${e}`)}}(i),o=oj[`${r}:${n}:${s}`];if(!o)throw Error(`Unsupported texture format for SamplesPerPixel=${e}, BitsPerSample=${t}, SampleFormat=${i}`);return o}(m,i,n),y=d.data.byteLength,v=s.createTexture({data:d.data,format:_,width:f,height:p,sampler:u});return null!==g&&(r=s.createTexture({data:g,format:"r8unorm",width:f,height:p,sampler:{minFilter:"nearest",magFilter:"nearest"}}),y+=g.byteLength),{texture:v,mask:r,byteLength:y,height:d.height,width:d.width}},renderTile:e=>({renderPipeline:l.map((t,i)=>(function(e,t){let{module:i,props:r}=e;if(!r)return{module:i};let s={};for(let[e,i]of Object.entries(r)){let r="function"==typeof i?i(t):i;void 0!==r&&(s[e]=r)}return{module:i,props:s}})(t,e))})}}(e,t);throw Error(`Inferring render pipeline for non-unsigned integers not yet supported. Found SampleFormat: ${i}`)}(r,this.context.device)),this.setState({geotiff:r,tilesetDescriptor:g,defaultGetTileData:s,defaultRenderTile:n})}_tilesetDescriptor(){return this.state.tilesetDescriptor}_getTileDataCallback(){let e=this.state.geotiff;if(!e)return;let t=this.props.getTileData??this.state.defaultGetTileData;if(t)return async(r,s)=>{let{x:n,y:o,z:a}=r.index;return t(a===e.overviews.length?e:e.overviews[e.overviews.length-1-a],{device:s.device,x:n,y:o,signal:s.signal,pool:this.props.pool??(null!==r5?r5:r5=new r8({createWorker:()=>new Worker(i.tu(new URL(i.p+i.u(89459),i.b)),{type:void 0})}))})}}_renderTileCallback(){let e=this.props.renderTile??this.state.defaultRenderTile;if(e)return e}}},96347:(e,t,i)=>{"use strict";i.d(t,{Bd:()=>n});var r=i(40459);let s={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:"undefined"!=typeof global&&global,document:"undefined"!=typeof document&&document};s.self||s.window||s.global,s.window||s.self||s.global,s.global||s.self||s.window,s.document;let n=("object"!=typeof r||"[object process]"!==String(r),!0),o=void 0!==r&&r.version&&/v([0-9]*)/.exec(r.version);o&&parseFloat(o[1])},97254:(e,t,i)=>{"use strict";function r(e,t=4,i=!0){let s=e.toString(16).padStart(t,"0");return i?"0x"+s:s}i.d(t,{n:()=>r})},97681:(e,t,i)=>{"use strict";i.d(t,{Pr:()=>p,th:()=>y,lI:()=>g,XE:()=>m,jE:()=>c,wF:()=>_,JT:()=>h,aL:()=>Z,_l:()=>v,nk:()=>b}),function(e){e[e.Big=19789]="Big",e[e.Little=18761]="Little"}(l||(l={})),function(e){e[e.ReducedImage=1]="ReducedImage",e[e.Page=2]="Page",e[e.Mask=4]="Mask"}(h||(h={})),function(e){e[e.TopLeft=1]="TopLeft",e[e.TopRight=2]="TopRight",e[e.BottomRight=3]="BottomRight",e[e.BottomLeft=4]="BottomLeft",e[e.LeftTop=5]="LeftTop",e[e.RightTOP=6]="RightTOP",e[e.RightBottom=7]="RightBottom",e[e.LeftBottom=8]="LeftBottom"}(u||(u={})),function(e){e[e.PixelIsArea=1]="PixelIsArea",e[e.PixelIsPoint=2]="PixelIsPoint"}(c||(c={})),function(e){e[e.Unknown=0]="Unknown",e[e.Projected=1]="Projected",e[e.Geographic=2]="Geographic",e[e.Geocentric=3]="Geocentric",e[e.UserDefined=32767]="UserDefined"}(d||(d={})),function(e){e[e.Image=1]="Image",e[e.ReducedImage=2]="ReducedImage",e[e.Page=3]="Page"}(f||(f={})),function(e){e[e.None=1]="None",e[e.Ccittrle=2]="Ccittrle",e[e.CcittT4=3]="CcittT4",e[e.CcittT6=4]="CcittT6",e[e.Lzw=5]="Lzw",e[e.Jpeg6=6]="Jpeg6",e[e.Jpeg=7]="Jpeg",e[e.DeflateOther=8]="DeflateOther",e[e.T85=9]="T85",e[e.T43=10]="T43",e[e.Next=32766]="Next",e[e.Ccittrlew=32771]="Ccittrlew",e[e.PackBits=32773]="PackBits",e[e.ThunderScan=32809]="ThunderScan",e[e.It8ctpad=32895]="It8ctpad",e[e.It8lw=32896]="It8lw",e[e.It8mp=32897
3528]="It8mp",e[e.It8bl=32898]="It8bl",e[e.PixarFilm=32908]="PixarFilm",e[e.PixarLog=32909]="PixarLog",e[e.Deflate=32946]="Deflate",e[e.Dcs=32947]="Dcs",e[e.Jbig=34661]="Jbig",e[e.SgiLog=34676]="SgiLog",e[e.SgiLog24=34677]="SgiLog24",e[e.Jp2000=34712]="Jp2000",e[e.Lerc=34887]="Lerc",e[e.Lzma=34925]="Lzma",e[e.Zstd=5e4]="Zstd",e[e.Webp=50001]="Webp",e[e.JpegXl=50002]="JpegXl",e[e.JpegXlDng17=52546]="JpegXlDng17"}(p||(p={})),function(e){e[e.Contig=1]="Contig",e[e.Separate=2]="Separate"}(g||(g={})),function(e){e[e.None=1]="None",e[e.Horizontal=2]="Horizontal",e[e.FloatingPoint=3]="FloatingPoint"}(m||(m={})),function(e){e[e.Uint=1]="Uint",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Void=4]="Void",e[e.ComplexInt=5]="ComplexInt",e[e.ComplexFloat=6]="ComplexFloat"}(_||(_={})),function(e){e[e.MinIsWhite=0]="MinIsWhite",e[e.MinIsBlack=1]="MinIsBlack",e[e.Rgb=2]="Rgb",e[e.Palette=3]="Palette",e[e.Mask=4]="Mask",e[e.Separated=5]="Separated",e[e.Ycbcr=6]="Ycbcr",e[e.Cielab=8]="Cielab",e[e.Icclab=9]="Icclab",e[e.Itulab=10]="Itulab",e[e.Cfa=32803]="Cfa",e[e.Logl=32844]="Logl",e[e.Logluv=32845]="Logluv"}(y||(y={})),function(e){e[e.SubFileType=254]="SubFileType",e[e.OldSubFileType=255]="OldSubFileType",e[e.ImageWidth=256]="ImageWidth",e[e.ImageHeight=257]="ImageHeight",e[e.BitsPerSample=258]="BitsPerSample",e[e.SampleFormat=339]="SampleFormat",e[e.Compression=259]="Compression",e[e.Photometric=262]="Photometric",e[e.TileWidth=322]="TileWidth",e[e.TileHeight=323]="TileHeight",e[e.TileOffsets=324]="TileOffsets",e[e.TileByteCounts=325]="TileByteCounts",e[e.JpegTables=347]="JpegTables",e[e.StripOffsets=273]="StripOffsets",e[e.StripByteCounts=279]="StripByteCounts",e[e.GdalMetadata=42112]="GdalMetadata",e[e.GdalNoData=42113]="GdalNoData",e[e.ModelPixelScale=33550]="ModelPixelScale",e[e.ModelTiePoint=33922]="ModelTiePoint",e[e.ModelTransformation=34264]="ModelTransformation",e[e.GeoKeyDirectory=34735]="GeoKeyDirectory",e[e.GeoDoubleParams=34736]="GeoDoubleParams",e[e.GeoAsciiParams=34737]="GeoAsciiParams",e[e.LercParameters=50674]="LercParameters",e[e.PlanarConfiguration=284]="PlanarConfiguration",e[e.CellLength=265]="CellLength",e[e.CellWidth=264]="CellWidth",e[e.ColorMap=320]="ColorMap",e[e.Copyright=33432]="Copyright",e[e.DateTime=306]="DateTime",e[e.ExtraSamples=338]="ExtraSamples",e[e.FillOrder=266]="FillOrder",e[e.FreeByteCounts=289]="FreeByteCounts",e[e.FreeOffsets=288]="FreeOffsets",e[e.GrayResponseCurve=291]="GrayResponseCurve",e[e.GrayResponseUnit=290]="GrayResponseUnit",e[e.HostComputer=316]="HostComputer",e[e.ImageDescription=270]="ImageDescription",e[e.Make=271]="Make",e[e.MaxSampleValue=281]="MaxSampleValue",e[e.MinSampleValue=280]="MinSampleValue",e[e.Model=272]="Model",e[e.Orientation=274]="Orientation",e[e.ResolutionUnit=296]="ResolutionUnit",e[e.RowsPerStrip=278]="RowsPerStrip",e[e.SamplesPerPixel=277]="SamplesPerPixel",e[e.Software=305]="Software",e[e.Threshholding=263]="Threshholding",e[e.XResolution=282]="XResolution",e[e.YResolution=283]="YResolution",e[e.BadFaxLines=326]="BadFaxLines",e[e.CleanFaxData=327]="CleanFaxData",e[e.ClipPath=343]="ClipPath",e[e.ConsecutiveBadFaxLines=328]="ConsecutiveBadFaxLines",e[e.Decode=433]="Decode",e[e.DefaultImageColor=434]="DefaultImageColor",e[e.DocumentName=269]="DocumentName",e[e.DotRange=336]="DotRange",e[e.HalftoneHints=321]="HalftoneHints",e[e.Indexed=346]="Indexed",e[e.PageName=285]="PageName",e[e.PageNumber=297]="PageNumber",e[e.Predictor=317]="Predictor",e[e.PrimaryChromaticities=319]="PrimaryChromaticities",e[e.ReferenceBlackWhite=532]="ReferenceBlackWhite",e[e.SMinSampleValue=340]="SMinSampleValue",e[e.SMaxSampleValue=341]="SMaxSampleValue",e[e.StripRowCounts=559]="StripRowCounts",e[e.SubIFDs=330]="SubIFDs",e[e.T4Options=292]="T4Options",e[e.T6Options=293]="T6Options",e[e.TransferFunction=301]="TransferFunction",e[e.WhitePoint=318]="WhitePoint",e[e.XClipPathUnits=344]="XClipPathUnits",e[e.XPosition=286]="XPosition",e[e.YCbCrCoefficients=529]="YCbCrCoefficients",e[e.YCbCrPositioning=531]="YCbCrPositioning",e[e.YCbCrSubSampling=530]="YCbCrSubSampling",e[e.YClipPathUnits=345]="YClipPathUnits",e[e.YPosition=287]="YPosition",e[e.ApertureValue=37378]="ApertureValue",e[e.ColorSpace
3528=40961]="ColorSpace",e[e.DateTimeDigitized=36868]="DateTimeDigitized",e[e.DateTimeOriginal=36867]="DateTimeOriginal",e[e.ExifIFD=34665]="ExifIFD",e[e.ExifVersion=36864]="ExifVersion",e[e.ExposureTime=33434]="ExposureTime",e[e.FileSource=41728]="FileSource",e[e.Flash=37385]="Flash",e[e.FlashpixVersion=40960]="FlashpixVersion",e[e.FNumber=33437]="FNumber",e[e.ImageUniqueID=42016]="ImageUniqueID",e[e.LightSource=37384]="LightSource",e[e.MakerNote=37500]="MakerNote",e[e.ShutterSpeedValue=37377]="ShutterSpeedValue",e[e.UserComment=37510]="UserComment",e[e.IPTC=33723]="IPTC",e[e.ICCProfile=34675]="ICCProfile",e[e.XMP=700]="XMP"}(v||(v={})),function(e){e[e.GTModelTypeGeoKey=1024]="GTModelTypeGeoKey",e[e.GTRasterTypeGeoKey=1025]="GTRasterTypeGeoKey",e[e.GTCitationGeoKey=1026]="GTCitationGeoKey",e[e.GeodeticCRSGeoKey=2048]="GeodeticCRSGeoKey",e[e.GeodeticCitationGeoKey=2049]="GeodeticCitationGeoKey",e[e.GeodeticDatumGeoKey=2050]="GeodeticDatumGeoKey",e[e.PrimeMeridianGeoKey=2051]="PrimeMeridianGeoKey",e[e.GeogLinearUnitsGeoKey=2052]="GeogLinearUnitsGeoKey",e[e.GeogLinearUnitSizeGeoKey=2053]="GeogLinearUnitSizeGeoKey",e[e.GeogAngularUnitsGeoKey=2054]="GeogAngularUnitsGeoKey",e[e.GeogAngularUnitSizeGeoKey=2055]="GeogAngularUnitSizeGeoKey",e[e.EllipsoidGeoKey=2056]="EllipsoidGeoKey",e[e.EllipsoidSemiMajorAxisGeoKey=2057]="EllipsoidSemiMajorAxisGeoKey",e[e.EllipsoidSemiMinorAxisGeoKey=2058]="EllipsoidSemiMinorAxisGeoKey",e[e.EllipsoidInvFlatteningGeoKey=2059]="EllipsoidInvFlatteningGeoKey",e[e.PrimeMeridianLongitudeGeoKey=2061]="PrimeMeridianLongitudeGeoKey",e[e.GeogTOWGS84GeoKey=2062]="GeogTOWGS84GeoKey",e[e.GeogAzimuthUnitsGeoKey=2060]="GeogAzimuthUnitsGeoKey",e[e.ProjectedCRSGeoKey=3072]="ProjectedCRSGeoKey",e[e.ProjectedCitationGeoKey=3073]="ProjectedCitationGeoKey",e[e.ProjectionGeoKey=3074]="ProjectionGeoKey",e[e.ProjMethodGeoKey=3075]="ProjMethodGeoKey",e[e.ProjLinearUnitsGeoKey=3076]="ProjLinearUnitsGeoKey",e[e.ProjLinearUnitSizeGeoKey=3077]="ProjLinearUnitSizeGeoKey",e[e.ProjStdParallel1GeoKey=3078]="ProjStdParallel1GeoKey",e[e.ProjStdParallel2GeoKey=3079]="ProjStdParallel2GeoKey",e[e.ProjNatOriginLongGeoKey=3080]="ProjNatOriginLongGeoKey",e[e.ProjNatOriginLatGeoKey=3081]="ProjNatOriginLatGeoKey",e[e.ProjFalseEastingGeoKey=3082]="ProjFalseEastingGeoKey",e[e.ProjFalseNorthingGeoKey=3083]="ProjFalseNorthingGeoKey",e[e.ProjFalseOriginLongGeoKey=3084]="ProjFalseOriginLongGeoKey",e[e.ProjFalseOriginLatGeoKey=3085]="ProjFalseOriginLatGeoKey",e[e.ProjFalseOriginEastingGeoKey=3086]="ProjFalseOriginEastingGeoKey",e[e.ProjFalseOriginNorthingGeoKey=3087]="ProjFalseOriginNorthingGeoKey",e[e.ProjCenterLongGeoKey=3088]="ProjCenterLongGeoKey",e[e.ProjCenterLatGeoKey=3089]="ProjCenterLatGeoKey",e[e.ProjCenterEastingGeoKey=3090]="ProjCenterEastingGeoKey",e[e.ProjCenterNorthingGeoKey=3091]="ProjCenterNorthingGeoKey",e[e.ProjScaleAtNatOriginGeoKey=3092]="ProjScaleAtNatOriginGeoKey",e[e.ProjScaleAtCenterGeoKey=3093]="ProjScaleAtCenterGeoKey",e[e.ProjAzimuthAngleGeoKey=3094]="ProjAzimuthAngleGeoKey",e[e.ProjStraightVertPoleLongGeoKey=3095]="ProjStraightVertPoleLongGeoKey",e[e.ProjRectifiedGridAngleGeoKey=3096]="ProjRectifiedGridAngleGeoKey",e[e.VerticalGeoKey=4096]="VerticalGeoKey",e[e.VerticalCitationGeoKey=4097]="VerticalCitationGeoKey",e[e.VerticalDatumGeoKey=4098]="VerticalDatumGeoKey",e[e.VerticalUnitsGeoKey=4099]="VerticalUnitsGeoKey"}(b||(b={})),function(e){e[e.Radian=9101]="Radian",e[e.Degree=9102]="Degree",e[e.ArcMinute=9103]="ArcMinute",e[e.ArcDegree=9104]="ArcDegree",e[e.Grad=9105]="Grad",e[e.Gon=9106]="Gon",e[e.Dms=9107]="Dms"}(E||(E={})),function(e){e[e.Metre=9001]="Metre",e[e.Foot=9002]="Foot",e[e.FootUsSurvey=9003]="FootUsSurvey",e[e.FootModifiedAmerican=9004]="FootModifiedAmerican",e[e.FootClarke=9005]="FootClarke",e[e.FootIndian=9006]="FootIndian",e[e.Link=9007]="Link",e[e.LinkBenoit=9008]="LinkBenoit",e[e.LinkSears=9009]="LinkSears",e[e.ChainBenoit=9010]="ChainBenoit",e[e.ChainSears=9011]="ChainSears",e[e.YardSears=9012]="YardSears",e[e.YardIndian=9013]="YardIndian",e[e.Fathom=9014]="Fathom",e[e.MileInternationalNautical=9015]="MileInternationalNautical"}(x||(x={}));let r={[v.TileByteCounts]:!0,[v.TileOffsets]:!0,[v.StripOffsets]:!0,[v.StripByteCounts]:!0,[v.BitsPerSample]:!0,[v.SampleFormat]:!0,[v.GeoKeyDirectory]:!0,[v.GeoDoubleParams]:!0};!function(e){e.None="application/octet-stream",e.Jbig="image/jbig",e.Dcs="image/x-kodak-dcs",e.PackBits="application/packbits",e.Jpeg="image/jpeg",e.Jp2000="image/jp2",e.JpegXl="image/jpegxl",e.Webp="image/webp",e.Zstd="application/zstd",e.Lzw="application/lzw",e.Deflate="application/deflate",e.Lerc="application/lerc",e.Lzma="application/x-lzma"}(w||(w={}));let s={[p.None]:w.None,[p.Lzw]:w.Lzw,[p.Jpeg6]:w.Jpeg,[p.Jpeg]:w.Jpeg,[p.DeflateOther]:w.Deflate,[p.Deflate]:w.Deflate,[p.Lerc]:w.Lerc,[p.Lzma]:w.Lzma,[p.Jp2000]:w.Jp2000,[p.Zstd]:w.Zstd,[p.Webp]:w.Webp,[p.JpegXl]:w.JpegXl,[p.Ccittrle]:w.None,[p.CcittT4]:w.None,[p.CcittT6]:w.None,[p.T85
3528]:w.Jbig,[p.T43]:w.Jbig,[p.Next]:w.None,[p.Ccittrlew]:w.None,[p.PackBits]:w.PackBits,[p.ThunderScan]:w.None,[p.It8ctpad]:w.None,[p.It8lw]:w.None,[p.It8mp]:w.None,[p.It8bl]:w.None,[p.PixarFilm]:w.None,[p.PixarLog]:w.None,[p.Dcs]:w.Dcs,[p.Jbig]:w.Jbig,[p.SgiLog]:w.None,[p.SgiLog24]:w.None,[p.JpegXlDng17]:w.JpegXl};function n(e){switch(e){case S.Uint8:case S.Ascii:case S.Int8:case S.Undefined:return 1;case S.Uint16:case S.Int16:return 2;case S.Uint32:case S.Int32:case S.Float32:case S.Ifd:return 4;case S.Rational:case S.SignedRational:case S.Float64:case S.Uint64:case S.Int64:case S.Ifd8:return 8;default:throw Error(`Invalid fieldType ${String(e)}`)}}function o(e,t,i){let r=e.getUint32(t,i),s=e.getUint32(t+4,i),n=i?r+0x100000000*s:0x100000000*r+s;if(!Number.isSafeInteger(n))throw Error(n+" exceeds MAX_SAFE_INTEGER. Precision may is lost");return n}function a(e,t,i,r){switch(i){case A.UInt8:return e.getUint8(t);case A.UInt16:return e.getUint16(t,r);case A.UInt32:return e.getUint32(t,r);case A.UInt64:return o(e,t,r)}}!function(e){e[e.Uint8=1]="Uint8",e[e.Ascii=2]="Ascii",e[e.Uint16=3]="Uint16",e[e.Uint32=4]="Uint32",e[e.Rational=5]="Rational",e[e.Int8=6]="Int8",e[e.Undefined=7]="Undefined",e[e.Int16=8]="Int16",e[e.Int32=9]="Int32",e[e.SignedRational=10]="SignedRational",e[e.Float32=11]="Float32",e[e.Float64=12]="Float64",e[e.Ifd=13]="Ifd",e[e.Uint64=16]="Uint64",e[e.Int64=17]="Int64",e[e.Ifd8=18]="Ifd8"}(S||(S={})),function(e){e[e.BigTiff=43]="BigTiff",e[e.Tiff=42]="Tiff"}(P||(P={})),function(e){e[e.Double=8]="Double",e[e.Float32=4]="Float32"}(T||(T={})),function(e){e[e.UInt64=8]="UInt64",e[e.UInt32=4]="UInt32",e[e.UInt16=2]="UInt16",e[e.UInt8=1]="UInt8"}(A||(A={}));var l,h,u,c,d,f,p,g,m,_,y,v,b,E,x,w,S,P,T,A,M,C,R,L=i(5725);let I=new ArrayBuffer(4),O=new Uint32Array(I),N=new Uint8Array(I);O[0]=1;let F=1===N[0];function D(e,t,i,r){switch(e){case S.Ascii:return String.fromCharCode(t.getUint8(i));case S.Undefined:case S.Uint8:return t.getUint8(i);case S.Int8:return t.getInt8(i);case S.Uint16:return t.getUint16(i,r);case S.Int16:return t.getInt16(i,r);case S.Uint32:case S.Ifd:return t.getUint32(i,r);case S.Int32:return t.getInt32(i,r);case S.Rational:return[t.getUint32(i,r),t.getUint32(i+4,r)];case S.SignedRational:return[t.getInt32(i,r),t.getInt32(i+4,r)];case S.Float64:return t.getFloat64(i,r);case S.Float32:return t.getFloat32(i,r);case S.Uint64:return o(t,i,r);default:throw Error(`Unknown read type "${e}" "${S[e]}"`)}}function B(e,t,i,r,s){switch(s){case S.Uint8:return new Uint8Array(t.buffer.slice(t.byteOffset+i,t.byteOffset+i+r));case S.Uint16:if(e.isLittleEndian!==F)break;return new Uint16Array(t.buffer.slice(t.byteOffset+i,t.byteOffset+i+r));case S.Uint32:if(e.isLittleEndian!==F)break;return new Uint32Array(t.buffer.slice(t.byteOffset+i,t.byteOffset+i+r))}return null}function G(e,t,i,s,o,a){let l=n(o),h=a*l;if(1===a){let n=D(o,i,s,e.isLittleEndian);return t&&r[t]?[n]:n}if(o===S.Ascii)return String.fromCharCode.apply(null,new Uint8Array(i.buffer,s,h-1));if(t===v.TileOffsets||t===v.TileByteCounts||t===v.StripOffsets||t===v.StripByteCounts){let t=B(e,i,s,h,o);if(t)return t}let u=[];for(let t=0;t<h;t+=l)u.push(D(o,i,s+t,e.isLittleEndian));return u}async function k(e,t,i){if(null!=e.value)return e.value;let r=n(e.dataType)*e.count,s=new DataView(await t.source.fetch(e.dataOffset,r,i));return e.value=G(t,e.id,s,0,e.dataType,e.count),e.value}async function U(e,t,i){let r=n(t.dataType);if(null==t.view){let s=await e.source.fetch(t.dataOffset,r*t.count,i);t.view=new DataView(s),t.view.sourceOffset=t.dataOffset}return t.value=G(e,t.id,t.view,0,t.dataType,t.count),t.view=void 0,t.isLoaded=!0,t.value}async function z(e,t,i,r){if(i>t.count||i<0)throw Error("TagOffset: out of bounds :"+i);if(null!=t.value[i])return t.value[i];let s=n(t.dataType);if(null==t.view){let n=new DataView(await e.source.fetch(t.dataOffset+i*s,s,r)),o=G(e,void 0,n,0,t.dataType,1);if("number"!=typeof o)throw Error("Value is not a number");return t.value[i]=o,o}let o=G(e,void 0,t.view,i*s,t.dataType,1);if("number"!=typeof o)throw Error("Value is not a number");return t.value[i]=o,o}let j=new Set([v.Compression,v.ImageHeight,v.ImageWidth,v.ModelPixelScale,v.ModelTiePoint,v.ModelTransformation,v.TileHeight,v.TileWidth]),V=new Set([v.GeoKeyDirectory,v.GeoAsciiParams,v.GeoDoubleParams]);class W{id;tiff;isGeoTagsLoaded=!1;tagsGeo=new Map;tags;constructor(e,t,i){this.tiff=e,this.id=t,this.tags=i}async init(e=!0,t){let i=[];
3528j.forEach(e=>{i.push(this.fetch(e,t))}),e&&V.forEach(e=>{i.push(this.fetch(e,t))}),await Promise.all(i),e&&await this.loadGeoTiffTags()}value(e){let t=this.tags.get(e);return null==t||"offset"===t.type&&!1===t.isLoaded?null:t.value}has(e){return this.tags.has(e)}async fetch(e,t){let i=this.tags.get(e);if(null==i)return null;if("inline"===i.type)return i.value;if("lazy"===i.type)return k(i,this.tiff,t);if(i.isLoaded)return i.value;if("offset"===i.type)return U(this.tiff,i,t);throw Error("Cannot fetch:"+e)}valueGeo(e){if(!1===this.isGeoTagsLoaded)throw Error("loadGeoTiffTags() has not been called");return this.tagsGeo.get(e)}get noData(){let e=this.tags.get(v.GdalNoData);if(null==e)return null;if(null!=e.value)return Number(e.value);throw Error("GdalNoData tag is not loaded")}async loadGeoTiffTags(){if(this.isGeoTagsLoaded)return;let e=this.tags.get(v.GeoKeyDirectory);if(null==e){this.isGeoTagsLoaded=!0;return}if("lazy"===e.type&&null==e.value&&await Promise.all([this.fetch(v.GeoKeyDirectory),this.fetch(v.GeoAsciiParams),this.fetch(v.GeoDoubleParams)]),this.isGeoTagsLoaded=!0,null==e.value)return;let t=e.value;if("number"==typeof t)throw Error("Invalid geo tags found");for(let e=4;e<=4*t[3];e+=4){let i=t[e],r=t[e+1],s=t[e+3];if(0===r){this.tagsGeo.set(i,s);continue}let n=this.tags.get(r);if(null==n||null==n.value)continue;let o=t[e+2];if("string"==typeof n.value)this.tagsGeo.set(i,n.value.slice(s,s+o-1).trim());else if(Array.isArray(n.value))1===o?this.tagsGeo.set(i,n.value[s]):this.tagsGeo.set(i,n.value.slice(s,s+o));else throw Error("Failed to extract GeoTiffTags")}}get origin(){let e=this.value(v.ModelTiePoint);if(null!=e&&6===e.length)return[e[3],e[4],e[5]];let t=this.value(v.ModelTransformation);if(null!=t)return[t[3],t[7],t[11]];if(this.value(v.SubFileType)===h.ReducedImage&&0!==this.id)return this.tiff.images[0].origin;throw Error("Image does not have a geo transformation.")}get isGeoLocated(){return null!=this.value(v.ModelPixelScale)||null!=this.value(v.ModelTransformation)||!!this.isSubImage&&0!==this.id&&this.tiff.images[0].isGeoLocated}get resolution(){let e=this.value(v.ModelPixelScale);if(null!=e)return[e[0],-e[1],e[2]];let t=this.value(v.ModelTransformation);if(null!=t)return[t[0],t[5],t[10]];if(this.isSubImage&&0!==this.id){let e=this.tiff.images[0],[t,i,r]=e.resolution,s=e.size,n=this.size;return[t*s.width/n.width,i*s.height/n.height,r]}throw Error("Image does not have a geo transformation.")}get isSubImage(){return this.value(v.SubFileType)===h.ReducedImage}get bbox(){let e=this.size,t=this.origin,i=this.resolution;if(null==t||null==e||null==i)throw Error("Unable to calculate bounding box");let r=t[0],s=t[1],n=r+i[0]*e.width,o=s+i[1]*e.height;return[Math.min(r,n),Math.min(s,o),Math.max(r,n),Math.max(s,o)]}get compression(){let e=this.value(v.Compression);return null==e?null:s[e]}get epsg(){let e=this.valueGeo(b.ProjectionGeoKey);if(null!=e&&32767!==e)return e;let t=null;switch(this.valueGeo(b.GTModelTypeGeoKey)){case d.Unknown:return null;case d.Projected:t=this.valueGeo(b.ProjectedCRSGeoKey);break;case d.Geographic:case d.Geocentric:t=this.valueGeo(b.GeodeticCRSGeoKey);break;case d.UserDefined:return null}return 32767===t?null:t}get size(){let e=this.value(v.ImageWidth),t=this.value(v.ImageHeight);if(null==e||null==t)throw Error("Tiff has no height or width");return{width:e,height:t}}isTiled(){return null!==this.value(v.TileWidth)}get tileSize(){let e=this.value(v.TileWidth),t=this.value(v.TileHeight);if(null==e||null==t)throw Error("Tiff is not tiled");return{width:e,height:t}}get tileCount(){let e=this.size,t=this.tileSize;return{x:Math.ceil(e.width/t.width),y:Math.ceil(e.height/t.height)}}get tileOffset(){let e=this.tags.get(v.TileOffsets);if(null==e)throw Error("No tile offsets found");return e}get stripCount(){return this.tags.get(v.StripByteCounts)?.count??0}getTileBounds(e,t){let{size:i,tileSize:r}=this,s=t*r.height,n=e*r.width,o=n+r.width>=i.width?i.width-n:r.width,a=s+r.height>=i.height?i.height-s:r.height;return{x:n,y:s,width:o,height:a}}async getStrip(e,t){if(this.isTiled())throw Error("Cannot read stripes, tiff is tiled: "+e);let i=this.tags.get(v.StripByteCounts),r=this.tags.get(v.StripOffsets);if(e>=i.count)throw Error("Cannot read strip, index out of bounds");let[s,n]=await Promise.all([$(this.tiff,r,e,t),$(this.tiff,i,e,t)]);return this.getBytes(s,n,t)}getJpegHeader(e){let t=this.value(v.JpegTables);if(null==t)throw Error("Unable to find Jpeg header");let i=t.slice(0,t.length-2),r=new Uint8Array(e.byteLength+i.length-2);return r.set(i,0),r.set(new Uint8Array(e).slice(2),i.length),r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength)}async getBytes(e,t,i){var r;if(0===t)return null;let n=await this.tiff.source.fetch(e,t,i);if(n.byteLength<t)throw Error(`Failed to fetch bytes from offset:${e} wanted:${t} got:${n.byteLength}`);let o=this.value(v.Compression);null==o&&(o=p.None);let a=(null==(r=o)?null:s[r])??w.None;
3528return o===p.Jpeg?{mimeType:a,bytes:this.getJpegHeader(n),compression:o}:{mimeType:a,bytes:n,compression:o}}async getTile(e,t,i){let r=this.size,s=this.tileSize;if(null==s)throw Error("Tiff is not tiled");let n=Math.ceil(r.height/s.height),o=Math.ceil(r.width/s.width);if(e>=o||t>=n)throw Error(`Tile index is outside of range x:${e} >= ${o} or y:${t} >= ${n}`);let a=t*o+e,l=o*n;if(a>=l)throw Error(`Tile index is outside of tile range: ${a} >= ${l}`);let{offset:h,imageSize:u}=await this.getTileSize(a,i);return this.getBytes(h,u,i)}async hasTile(e,t,i){let r=this.tileSize,s=this.size;if(null==r)throw Error("Tiff is not tiled");let n=Math.ceil(s.height/r.height),o=Math.ceil(s.width/r.width);return!(e>=o)&&!(t>=n)&&(await this.getTileSize(t*o+e,i)).offset>0}async getTileSize(e,t){let i=this.tags.get(v.TileByteCounts),r=H(this.tiff,this.tileOffset,e),s=H(this.tiff,i,e);if(null!=r&&null!=s)return{offset:r,imageSize:s};let n=this.tiff.options?.tileLeaderByteSize;if(n){let i=r??await $(this.tiff,this.tileOffset,e,t);if(0===i)return{offset:0,imageSize:0};let s=await this.tiff.source.fetch(i-n,n,t);return{offset:i,imageSize:a(new DataView(s),0,n,this.tiff.isLittleEndian)}}if(null==i)throw Error("No tile byte counts found");let[o,l]=await Promise.all([r??$(this.tiff,this.tileOffset,e,t),s??$(this.tiff,i,e,t)]);return{offset:o,imageSize:l}}}function $(e,t,i,r){let s=H(e,t,i);return null!=s?Promise.resolve(s):z(e,t,i,r)}function H(e,t,i){if(i<0)throw Error(`Tiff: ${e.source.url.href} out of bounds ${v[t.id]} index:${i} total:${t.count}`);if(i>=t.count)return 0;if("inline"===t.type||t.isLoaded)return t.value[i];if(i>t.count||i<0)throw Error("TagOffset: out of bounds :"+i);if(null!=t.value[i])return t.value[i];if(null==t.view)return null;let r=n(t.dataType),s=G(e,void 0,t.view,i*r,t.dataType,1);if("number"!=typeof s)throw Error("Value is not a number");return t.value[i]=s,s}!function(e){e.GdalStructuralMetadataSize="GDAL_STRUCTURAL_METADATA_SIZE",e.Layout="LAYOUT",e.BlockOrder="BLOCK_ORDER",e.BlockLeader="BLOCK_LEADER",e.BlockTrailer="BLOCK_TRAILER",e.KnownIncompatibleEdition="KNOWN_INCOMPATIBLE_EDITION",e.MaskInterleavedWithImagery="MASK_INTERLEAVED_WITH_IMAGERY"}(M||(M={})),(C||(C={})).RowMajor="ROW_MAJOR",(R||(R={})).uint32="SIZE_AS_UINT4";class q{options=new Map;get isCogOptimized(){return!this.isBroken&&"IFDS_BEFORE_DATA"===this.options.get(M.Layout)}get isBroken(){return"YES"===this.options.get(M.KnownIncompatibleEdition)}process(e,t,i){let r="",s="",n=!1;for(let o=0;o<i;o++){let i=e.getUint8(t+o);if(0===i)break;let a=String.fromCharCode(i);"\n"===a?(this.options.set(r.trim(),s.trim()),r="",s="",n=!1):"="===a?n=!0:n?s+=a:r+=a}}get tileLeaderByteSize(){return this.options.get(M.BlockLeader)===R.uint32?A.UInt32:null}get isMaskInterleaved(){return"YES"===this.options.get(M.MaskInterleavedWithImagery)}}let K={version:P.Tiff,pointer:A.UInt32,offset:A.UInt16,ifd:A.UInt16+A.UInt16+2*A.UInt32},X={version:P.BigTiff,pointer:A.UInt64,offset:A.UInt64,ifd:A.UInt16+A.UInt16+2*A.UInt64};P.BigTiff,P.Tiff;var Y=i(97254);class Z{static DefaultReadSize=16384;defaultReadSize=Z.DefaultReadSize;source;version=P.Tiff;images=[];options;ifdConfig=K;isLittleEndian=!1;isInitialized=!1;_initPromise;constructor(e,t={defaultReadSize:Z.DefaultReadSize}){this.source=e,this.defaultReadSize=t.defaultReadSize}static create(e,t={defaultReadSize:Z.DefaultReadSize}){return new Z(e,t).init(t)}init(e){return this.isInitialized?Promise.resolve(this):(this._initPromise||(this._initPromise=this.readHeader(e)),this._initPromise)}getImageByResolution(e){let t=this.images[0],i=t.size,[r]=t.resolution,s=r*i.width;for(let t=this.images.length-1;t>0;t--){let i=this.images[t];if(s/i.size.width-e<=.01)return i}return t}async readHeader(e){let t;if(this.isInitialized)return this;let i=new DataView(await this.source.fetch(0,Q(this.source,0,this.defaultReadSize),e));if(0===i.byteLength)throw Error("Unable to read empty tiff");i.sourceOffset=0;let r=0,s=i.getUint16(r,this.isLittleEndian);if(r+=2,this.isLittleEndian=s===l.Little,this.version=i.getUint16(r,this.isLittleEndian),r+=2,this.version===P.BigTiff){this.ifdConfig=X;let e=i.getUint16(r,this.isLittleEndian);if(r+=2,8!==e)throw Error("Only 8byte pointers are supported");let s=i.getUint16(r,this.isLittleEndian);if(r+=2,0!==s)throw Error("Invalid big tiff header");t=a(i,r,this.ifdConfig.pointer,this.isLittleEndian),r+=this.ifdConfig.pointer}else if(this.version===P.Tiff)t=a(i,r,this.ifdConfig.pointer,this.isLittleEndian),r+=this.ifdConfig.pointer;else throw Error(`Only tiff supported version:${String(this.version)}`);let n=t-r;for(n>0&&n<16384&&(this.options=new q,this.options.process(i,r,n));0!==t;){let r=i;
3528(0,L.g)(r,t,1024)||((r=new DataView(await this.source.fetch(t,Q(this.source,t,this.defaultReadSize),e))).sourceOffset=t),t=this.readIfd(t,r)}return await Promise.all(this.images.map(t=>t.init(!0,e))),this.isInitialized=!0,this}readIfd(e,t){let i=e-t.sourceOffset,r=a(t,i,this.ifdConfig.offset,this.isLittleEndian),s=new Map,o=r*this.ifdConfig.ifd;if(!(0,L.g)(t,e,o))throw Error("IFD out of range @ "+(0,Y.n)(e)+" IFD"+this.images.length);let l=this.ifdConfig.ifd,h=i+this.ifdConfig.offset;for(let e=0;e<r;e++){let i=function(e,t,i){let r=t.getUint16(i+0,e.isLittleEndian),s=t.getUint16(i+2,e.isLittleEndian),o=a(t,i+4,e.ifdConfig.pointer,e.isLittleEndian),l=n(s)*o;if(l<=e.ifdConfig.pointer){let n=G(e,r,t,i+4+e.ifdConfig.pointer,s,o);return{type:"inline",id:r,name:v[r],count:o,value:n,dataType:s,tagOffset:i}}let h=a(t,i+4+e.ifdConfig.pointer,e.ifdConfig.pointer,e.isLittleEndian);switch(r){case v.TileOffsets:case v.TileByteCounts:case v.StripByteCounts:case v.StripOffsets:let u={type:"offset",id:r,name:v[r],count:o,dataType:s,dataOffset:h,isLoaded:!1,value:[],tagOffset:i};if((0,L.g)(t,h,l)){let i=B(e,t,h-t.sourceOffset,l,s);i?(u.value=i,u.isLoaded=!0):function(e,t){let i=n(e.dataType),r=t.byteOffset+e.dataOffset-t.sourceOffset;e.view=new DataView(t.buffer.slice(r,r+i*e.count)),e.view.sourceOffset=e.dataOffset}(u,t)}return u}if((0,L.g)(t,h,l)){let n=G(e,r,t,h-t.sourceOffset,s,o);return{type:"inline",id:r,name:v[r],count:o,value:n,dataType:s,tagOffset:i}}return{type:"lazy",id:r,name:v[r],count:o,dataOffset:h,dataType:s,tagOffset:i}}(this,t,h+e*l);s.set(i.id,i)}return this.images.push(new W(this,this.images.length,s)),a(t,h+r*l,this.ifdConfig.pointer,this.isLittleEndian)}}function Q(e,t,i){let r=e.metadata?.size;return null==r||r<0?i:t+i>r?r-t:i}},98328:(e,t,i)=>{"use strict";function r(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(t+1):e}function s(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(0,t):""}i.d(t,{iW:()=>r,pD:()=>s})},99416:(e,t,i)=>{"use strict";i.d(t,{M:()=>a});var r=i(60154),s=i(504);function n(e,t,i,r){if(r?.inlineSource){let r=function(e,t,i){let r="";for(let i=t-2;i<=t;i++){let s=e[i-1];void 0!==s&&(r+=o(s,t,void 0))}return r}(t,i),s=e.linePos>0?`${" ".repeat(e.linePos+5)}^^^ 3529`:"";return` 3530${r}${s}${e.type.toUpperCase()}: ${e.message} 3531 3532`}let s="error"===e.type?"red":"orange";return r?.html?`<div class='luma-compiler-log-${e.type}' style="color:${s};"><b> ${e.type.toUpperCase()}: ${e.message}</b></div>`:`${e.type.toUpperCase()}: ${e.message}`}function o(e,t,i){let r=i?.html?e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'"):e;return`${function(e,t){let i="";for(let t=e.length;t<4;++t)i+=" ";return i+e}(String(t),4)}: ${r}${i?.html?"<br/>":"\n"}`}class a extends r.F{get[Symbol.toStringTag](){return"Shader"}stage;source;compilationStatus="pending";constructor(e,t){t={...t,debugShaders:t.debugShaders||e.props.debugShaders||"errors"},super(e,{id:function(e){return function(e,t="unnamed"){let i=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(e);return i?.[1]??t}(e.source)||e.id||(0,s.L)(`unnamed ${e.stage}-shader`)}(t),...t},a.defaultProps),this.stage=this.props.stage,this.source=this.props.source}getCompilationInfoSync(){return null}getTranslatedSource(){return null}async debugShader(){let e=this.props.debugShaders;switch(e){case"never":return;case"errors":if("success"===this.compilationStatus)return}let t=await this.getCompilationInfo();("warnings"!==e||t?.length!==0)&&this._displayShaderLog(t,this.id)}_displayShaderLog(e,t){if("undefined"==typeof document||!document?.createElement)return;let i=`${this.stage} shader "${t}"`,r=function(e,t,i){let r="",s=t.split(/\r?\n/),a=e.slice().sort((e,t)=>e.lineNum-t.lineNum);switch(i?.showSourceCode||"no"){case"all":let l=0;for(let e=1;e<=s.length;e++){let t=s[e-1],h=a[l];for(t&&h&&(r+=o(t,e,i));a.length>l&&h.lineNum===e;){let e=a[l++];e&&(r+=n(e,s,e.lineNum,{...i,inlineSource:!1}))}}for(;a.length>l;){let e=a[l++];e&&(r+=n(e,[],0,{...i,inlineSource:!1}))}return r;case"issues":case"no":for(let t of e)r+=n(t,s,t.lineNum,{inlineSource:i?.showSourceCode!=="no"});return r}}(e,this.source,{showSourceCode:"all",html:!0}),s=this.getTranslatedSource(),a=document.createElement("div");a.innerHTML=`\ 3533<h1>Compilation error in ${i}</h1> 3534<div style="display:flex;position:fixed;top:10px;right:20px;gap:2px;"> 3535<button id="copy">Copy source</button><br/> 3536<button id="close">Close</button> 3537</div> 3538<code><pre>${r}</pre></code>`,s&&(a.innerHTML+=`<br /><h1>Translated Source</h1><br /><br /><code><pre>${s}</pre></code>`),a.style.top="0",a.style.left="0",a.style.background="white",a.style.position="fixed",a.style.zIndex="9999",a.style.maxWidth="100vw",a.style.maxHeight="100vh",a.style.overflowY="auto",document.body.appendChild(a);let l=a.querySelector(".luma-compiler-log-error");l?.scrollIntoView(),a.querySelector("button#close").onclick=()=>{a.remove()},a.querySelector("button#copy").onclick=()=>{navigator.clipboard.writeText(this.source)}}static defaultProps={...r.F.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debugShaders:void 0}}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.